text
stringlengths
185
73.3k
repo
stringlengths
7
100
path
stringlengths
4
146
language
stringclasses
7 values
hash
stringlengths
16
16
score
float64
7
8.5
stars
int64
0
237k
""" Add extended fields to buyers (ledgers) """ from sqlalchemy import text def up(conn) -> None: columns = { "email": "ALTER TABLE buyers ADD COLUMN email VARCHAR", "website": "ALTER TABLE buyers ADD COLUMN website VARCHAR", "bank_name": "ALTER TABLE buyers ADD COLUMN bank_name VARCHAR",...
nikhilb2/simple_invoicing
backend/migrations/20260101000003_add_extended_buyer_fields.py
.py
b97391df872e334b
7.5
9
""" Add gst_rate to products """ from sqlalchemy import text def up(conn) -> None: existing = { row[0] for row in conn.execute( text("SELECT column_name FROM information_schema.columns WHERE table_name = 'products'") ).fetchall() } if "gst_rate" not in existing: ...
nikhilb2/simple_invoicing
backend/migrations/20260101000004_add_gst_rate_to_products.py
.py
1edfc142031c0d7a
7.5
9
""" Add tax fields to invoice_items """ from sqlalchemy import text def up(conn) -> None: columns = { "gst_rate": "ALTER TABLE invoice_items ADD COLUMN gst_rate NUMERIC(5,2) NOT NULL DEFAULT 0", "taxable_amount": "ALTER TABLE invoice_items ADD COLUMN taxable_amount NUMERIC(10,2) NOT NULL DEFAULT ...
nikhilb2/simple_invoicing
backend/migrations/20260101000005_add_tax_fields_to_invoice_items.py
.py
b0c59341d3cb090f
7.5
9
""" Add GST compliance fields: hsn_sac on products/invoice_items, invoice_number and tax breakup on invoices """ from sqlalchemy import text def up(conn) -> None: # Products: HSN/SAC code existing_products = { row[0] for row in conn.execute( text("SELECT column_name FROM informati...
nikhilb2/simple_invoicing
backend/migrations/20260101000006_add_gst_compliance_fields.py
.py
71dd0c7ecfb039d3
7.5
9
""" create_smtp_configs_table """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS smtp_configs ( id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL, host VARCHAR(255) NOT NULL, port INTEGER NOT NULL, ...
nikhilb2/simple_invoicing
backend/migrations/20260403211655_create_smtp_configs_table.py
.py
b3d822d2b4de900c
7.5
9
""" add_due_date_to_invoices """ from sqlalchemy import text def up(conn) -> None: conn.execute(text("ALTER TABLE invoices ADD COLUMN IF NOT EXISTS due_date TIMESTAMPTZ")) conn.execute(text("CREATE INDEX IF NOT EXISTS ix_invoices_due_date ON invoices (due_date)")) def down(conn) -> None: conn.execute(tex...
nikhilb2/simple_invoicing
backend/migrations/20260404092600_add_due_date_to_invoices.py
.py
3bea9f4d9d8b026b
7
9
""" create_user_shortcuts_table """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS user_shortcuts ( id SERIAL PRIMARY KEY, user_id INT NOT NULL REFERENCES users(id) ON DELETE CASCADE, action_key VARCHAR NOT NULL, ...
nikhilb2/simple_invoicing
backend/migrations/20260407000001_create_user_shortcuts_table.py
.py
467eaed8f7f8b0cc
7.5
9
""" rename_use_tls_to_use_starttls """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" DO $$ BEGIN IF EXISTS ( SELECT 1 FROM information_schema.columns WHERE table_name = 'smtp_configs' AND column_name = 'use_tls' ) T...
nikhilb2/simple_invoicing
backend/migrations/20260408000001_rename_use_tls_to_use_starttls.py
.py
408df7de358fcdfa
7.5
9
""" Add status column to invoices (active | cancelled). """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NOT EXISTS status VARCHAR DEFAULT 'active'; """)) conn.execute(text(""" CREATE INDEX IF NOT EXISTS idx_invoices_status ON ...
nikhilb2/simple_invoicing
backend/migrations/20260409000001_add_status_to_invoices.py
.py
adb0caf0ca8f1d51
7.5
9
""" Add supplier_invoice_number column to invoices. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NOT EXISTS supplier_invoice_number VARCHAR; """)) def down(conn) -> None: conn.execute(text("ALTER TABLE invoices DROP COLUMN IF EXI...
nikhilb2/simple_invoicing
backend/migrations/20260409000002_add_supplier_invoice_number_to_invoices.py
.py
4e1dda66cad892e4
7
9
""" Add tax_inclusive flag to invoices. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NOT EXISTS tax_inclusive BOOLEAN DEFAULT FALSE; """)) def down(conn) -> None: conn.execute(text("ALTER TABLE invoices DROP COLUMN IF EXISTS tax_...
nikhilb2/simple_invoicing
backend/migrations/20260409000003_add_tax_inclusive_to_invoices.py
.py
72fb539a0a4fd7cb
7
9
""" Create invoice_series table with default seeds, add series_id FK to invoices, and add series_id + payment_number to payments. """ from sqlalchemy import text def up(conn) -> None: # Create invoice_series table conn.execute(text(""" CREATE TABLE IF NOT EXISTS invoice_series ( id ...
nikhilb2/simple_invoicing
backend/migrations/20260409000004_create_invoice_series_table.py
.py
04061aac1945bc7f
7.5
9
""" Add round-off fields to invoices. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NOT EXISTS apply_round_off BOOLEAN NOT NULL DEFAULT FALSE; """)) conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NO...
nikhilb2/simple_invoicing
backend/migrations/20260410000001_add_round_off_to_invoices.py
.py
6cb4c6017f3e634c
7.5
9
""" Create financial_years table and seed default FY 2025-26. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS financial_years ( id SERIAL PRIMARY KEY, label VARCHAR NOT NULL, start_date DATE NOT NULL, ...
nikhilb2/simple_invoicing
backend/migrations/20260410000001_create_financial_years_table.py
.py
041cb732d9e1cdda
7.5
9
""" Extend invoice_series with financial_year_id FK. - Add financial_year_id INTEGER NULLABLE FK -> financial_years.id - Drop old UNIQUE(voucher_type) constraint - Add UNIQUE(voucher_type, financial_year_id) constraint - Backfill existing rows to the default active FY (2025-26) """ from sqlalchemy import text def up...
nikhilb2/simple_invoicing
backend/migrations/20260410000002_fy_scope_invoice_series.py
.py
16125d4b7d962418
7.5
9
""" Add UNIQUE constraint on financial_years.label to prevent duplicate FY entries. """ from sqlalchemy import text def up(conn) -> None: # Remove duplicate labels, keeping the row with the lowest id for each label. # Must delete child rows in invoice_series first due to FK constraint. conn.execute(text(...
nikhilb2/simple_invoicing
backend/migrations/20260410000004_add_unique_label_to_financial_years.py
.py
a6466f1ebd9fb6e4
7.5
9
""" Add status column to payments (active | cancelled) for soft delete support. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE payments ADD COLUMN IF NOT EXISTS status VARCHAR DEFAULT 'active'; """)) conn.execute(text(""" CREATE INDEX IF NOT EXISTS...
nikhilb2/simple_invoicing
backend/migrations/20260411000001_add_status_to_payments.py
.py
1d0f15a5f899086c
7.5
9
""" Add suffix support to invoice_series. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoice_series ADD COLUMN IF NOT EXISTS suffix VARCHAR NOT NULL DEFAULT '' """)) conn.execute(text(""" UPDATE invoice_series SET suffix...
nikhilb2/simple_invoicing
backend/migrations/20260412000001_add_suffix_to_invoice_series.py
.py
09b95c457e1fd91d
7
9
""" Add credit_status column to invoices table. Values: not_credited | partially_credited | fully_credited Default: not_credited Status is computed per invoice by summing line_total of all active credit_note_items where cn_item.invoice_id = invoice.id. """ from sqlalchemy import text def up(conn) -> None: conn...
nikhilb2/simple_invoicing
backend/migrations/20260412000003_add_credit_status_to_invoices.py
.py
fb910824ed858310
7.5
9
""" Seed credit_note series rows for all existing financial years that don't already have one, so CN numbering can be configured without manual DB fixes. Copies format settings (prefix, suffix, year_format, etc.) from the existing 'sales' series of the same FY where available, then applies CN-specific defaults. """ f...
nikhilb2/simple_invoicing
backend/migrations/20260412000004_seed_credit_note_series.py
.py
39ee186b3b0d69ea
7.5
9
""" Make buyer (ledger) GST optional """ from sqlalchemy import text def up(conn) -> None: conn.execute(text("UPDATE buyers SET gst = NULL WHERE btrim(gst) = ''")) conn.execute(text("ALTER TABLE buyers ALTER COLUMN gst DROP NOT NULL")) def down(conn) -> None: conn.execute(text("UPDATE buyers SET gst = ...
nikhilb2/simple_invoicing
backend/migrations/20260414000001_make_buyer_gst_optional.py
.py
e65f6984ced9c4a2
7
9
""" Add item-level GST split fields to invoice_items """ from sqlalchemy import text def up(conn) -> None: columns = { "cgst_amount": "ALTER TABLE invoice_items ADD COLUMN cgst_amount NUMERIC(10,2) NOT NULL DEFAULT 0", "sgst_amount": "ALTER TABLE invoice_items ADD COLUMN sgst_amount NUMERIC(10,2)...
nikhilb2/simple_invoicing
backend/migrations/20260416000001_add_item_tax_split_fields.py
.py
94adb86f87c9d801
7.5
9
""" Backfill item-level GST split fields for existing invoices """ from decimal import Decimal, ROUND_HALF_UP from sqlalchemy import text def _money(value: Decimal) -> Decimal: return value.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP) def _is_interstate_supply(company_gst: str | None, buyer_gst: str | No...
nikhilb2/simple_invoicing
backend/migrations/20260416000002_backfill_item_tax_split_fields.py
.py
d573505b448cadbc
7.5
9
""" Add description field to invoice_items for serial numbers and batch codes """ from sqlalchemy import text def up(conn) -> None: stmt = "ALTER TABLE invoice_items ADD COLUMN description TEXT" existing = { row[0] for row in conn.execute( text("SELECT column_name FROM inform...
nikhilb2/simple_invoicing
backend/migrations/20260416000004_add_description_to_invoice_items.py
.py
4dbfc64eaf56350c
7.5
9
""" Create company_accounts table and link optional account_id on payments. Existing payments remain unallocated (NULL account_id). """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS company_accounts ( id SERIAL PRIMARY KEY, acc...
nikhilb2/simple_invoicing
backend/migrations/20260417000001_create_company_accounts_and_link_payments.py
.py
a6ebefcd57a6a608
7.5
9
"""Create payment_invoice_allocations table for invoice-level receipt/payment allocations.""" from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS payment_invoice_allocations ( id SERIAL PRIMARY KEY, payment_id INTEGER NOT NULL REFEREN...
nikhilb2/simple_invoicing
backend/migrations/20260419000002_create_payment_invoice_allocations.py
.py
be3a7b0a0828738a
7.5
9
"""Backfill zero-quantity inventory rows for products missing inventory.""" from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" INSERT INTO inventory (company_id, product_id, quantity) SELECT p.company_id, p.id, 0 FROM products p LEFT JOIN inventory i ...
nikhilb2/simple_invoicing
backend/migrations/20260425000001_backfill_missing_inventory_rows.py
.py
8214cb4390c83f97
7.5
9
"""Scope buyer GST uniqueness to company. Drops legacy global unique index on buyers.gst and replaces it with company-scoped unique index. """ from sqlalchemy import text def up(conn) -> None: # Remove old global uniqueness on GST, if present. conn.execute(text("DROP INDEX IF EXISTS ix_buyers_gst")) con...
nikhilb2/simple_invoicing
backend/migrations/20260425000001_scope_buyer_gst_uniqueness_per_company.py
.py
67fefb24a9d2af39
7.5
9
"""Scope financial year label uniqueness per company.""" from sqlalchemy import text def up(conn) -> None: # Remove legacy global uniqueness on label. conn.execute(text(""" ALTER TABLE financial_years DROP CONSTRAINT IF EXISTS uq_financial_years_label """)) # Ensure scoped uniqueness...
nikhilb2/simple_invoicing
backend/migrations/20260425000002_scope_financial_year_label_uniqueness_per_company.py
.py
23c9dfa47b5d2661
7.5
9
""" Add reference_notes field to invoices. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoices ADD COLUMN IF NOT EXISTS reference_notes VARCHAR(255); """)) def down(conn) -> None: conn.execute(text("ALTER TABLE invoices DROP COLUMN IF EXISTS referenc...
nikhilb2/simple_invoicing
backend/migrations/20260426000001_add_reference_notes_to_invoices.py
.py
ab5f6266c16f2712
7
9
""" Add maintain_inventory flag to products. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE products ADD COLUMN IF NOT EXISTS maintain_inventory BOOLEAN NOT NULL DEFAULT TRUE; """)) def down(conn) -> None: conn.execute(text("ALTER TABLE products ...
nikhilb2/simple_invoicing
backend/migrations/20260426000002_add_maintain_inventory_to_products.py
.py
1074af931819543c
7
9
""" create_global_settings_table """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" CREATE TABLE IF NOT EXISTS global_settings ( id INTEGER PRIMARY KEY, max_companies INTEGER NOT NULL DEFAULT 1, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), ...
nikhilb2/simple_invoicing
backend/migrations/20260429000001_create_global_settings_table.py
.py
a6133c73f4ffdb28
7.5
9
""" Make invoice item quantity decimal-capable. """ from sqlalchemy import text def up(conn) -> None: conn.execute(text(""" ALTER TABLE invoice_items ALTER COLUMN quantity TYPE NUMERIC(12, 3) USING quantity::numeric; """)) def down(conn) -> None: conn.execute(text(""" AL...
nikhilb2/simple_invoicing
backend/migrations/20260430000002_make_invoice_item_quantity_decimal.py
.py
1231029f1ef0b80b
7
9
""" Delete legacy cancelled credit notes. This data cleanup migration removes soft-deleted credit notes that were marked as status='cancelled' before the hard-delete cancellation behavior was adopted. Some environments may have non-cascading foreign keys, so dependent rows are removed explicitly before deleting from ...
nikhilb2/simple_invoicing
backend/migrations/20260505000002_delete_cancelled_credit_notes.py
.py
9572b7bcef26d688
7.5
9
"""Scope product SKU uniqueness to company. Drops the legacy global unique index on products.sku and replaces it with a company-scoped composite unique index, allowing the same SKU to exist across different companies. """ from sqlalchemy import text def up(conn) -> None: # Remove old global uniqueness on SKU. ...
nikhilb2/simple_invoicing
backend/migrations/20260514000001_scope_product_sku_uniqueness_per_company.py
.py
110f73d646a60fbe
7.5
9
"""All seven steps, ending in a picture. pip install 'multiset-unitree-go2[viz]' python examples/visualize.py --mesh map.glb 1. read GO2_IP and the MultiSet credentials from .env 2. (done once beforehand: go2-credentials --save) 3. connect to the robot 4. open the camera 5. capture a frame...
MultiSet-AI/multiset-python
packages/unitree-go2/examples/visualize.py
.py
0629605663a4c85b
7.56
12
"""Shared plumbing for the CLIs: logging, error reporting, .env writing.""" from __future__ import annotations import argparse import logging import sys from collections.abc import Callable from multiset.vps import MultisetError log = logging.getLogger("multiset") def add_common(parser: argparse.ArgumentParser) -...
MultiSet-AI/multiset-python
packages/unitree-go2/src/multiset/unitree/go2/cli/_common.py
.py
35fa8303bcf0e1cb
7.56
12
"""What it takes to reach one Go2. VPS credentials are NOT in here. They are two different things with two different owners: the address and AES key belong to the robot in front of you, the MultiSet client id and map code belong to your account and are the same for every device you run. Keeping them in one object made...
MultiSet-AI/multiset-python
packages/unitree-go2/src/multiset/unitree/go2/config.py
.py
a2362fcb54b88059
7.56
12
"""The robot's AES key and serial, from Unitree's cloud. Firmware >= 1.1.15 encrypts the LAN handshake and refuses the connection without a per-device AES-128 key. That key cannot be derived or read off the robot -- not even from its IP -- so this takes the account email and password. Nothing here writes to disk or p...
MultiSet-AI/multiset-python
packages/unitree-go2/src/multiset/unitree/go2/credentials.py
.py
b42be6fcf1ba1a0a
7.56
12
"""Find a Go2 on the local network. Two independent methods, because the first one does not always work: `find_serial()` asks over multicast and gets the serial for free, but the responder does not run on every firmware -- a robot can be up, listening on 9991 and perfectly reachable while answering nothing. The swee...
MultiSet-AI/multiset-python
packages/unitree-go2/src/multiset/unitree/go2/discovery.py
.py
e02520d0fdc5feae
7.56
12
"""Failures specific to the Go2, plus the shared ones re-exported. Go2Error inherits from multiset.vps.MultisetError, so one except clause covers both packages. Frame timeouts and calibration mismatches are not Go2-only, so they stay in multiset.vps and are re-exported here -- the SAME classes, not parallel ones. """ ...
MultiSet-AI/multiset-python
packages/unitree-go2/src/multiset/unitree/go2/errors.py
.py
f2b3ff88775e549b
7.56
12
"""Test configuration. Everything here runs without a robot, without credentials and without the internet. Anything that needs hardware is marked and deselected by default -- see pyproject's addopts. """ from __future__ import annotations import numpy as np import pytest @pytest.fixture def frame_720p() -> np.ndar...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/conftest.py
.py
dffb6edb10b89611
7.06
12
"""Discovery, with the network stubbed out. Port probing is monkeypatched, so these assert the classification rules rather than whatever happens to be on the machine's LAN. """ from __future__ import annotations import pytest from multiset.unitree.go2 import discovery from multiset.unitree.go2.discovery import Host,...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/test_discovery.py
.py
ef24faf71bbe0417
8.06
12
"""The frame conversions that are silent when wrong.""" from __future__ import annotations import math import numpy as np import pytest from multiset.unitree.go2 import YUP_TO_ZUP, camera_pose_to_base def test_yup_to_zup_maps_axes_as_documented(): """(x, y, z) -> (x, -z, y): the map's up axis becomes Z.""" ...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/test_frames.py
.py
386bf1a707401a72
8.06
12
"""Composing odometry onto a VPS fix. The maths that puts the robot in the right room. It is ported from the navigator deliberately unchanged, so these tests pin the behaviour rather than merely exercising it. """ from __future__ import annotations import math import pytest from multiset.unitree.go2 import compose_...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/test_odometry.py
.py
1d3f6a6b87c59658
8.06
12
from __future__ import annotations import pytest from multiset.unitree.go2 import ConfigError, Go2Settings def test_real_environment_beats_the_file(tmp_path, monkeypatch): """GO2_IP=... python app.py must work without editing anything.""" env = tmp_path / ".env" env.write_text("GO2_IP=1.1.1.1\n") mon...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/test_settings.py
.py
00cddf7439f2de90
8.06
12
from __future__ import annotations import numpy as np import pytest from multiset.unitree.go2 import FRONT, GO2_FRONT_720P from multiset.vps import CalibrationError, Rectifier def test_rectified_intrinsics_are_the_known_values(): """Pinned against the reference implementation this was ported from. These fou...
MultiSet-AI/multiset-python
packages/unitree-go2/tests/test_undistort.py
.py
394a778bdb3b863e
8.06
12
"""Every failure this package raises. MultisetError is the root, so one except clause covers all of them. Nothing here calls sys.exit(): SystemExit inherits from BaseException, so a caller's `except Exception` would not catch it. """ from __future__ import annotations class MultisetError(Exception): """Base for...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/errors.py
.py
bc7331221cceac47
7.56
12
"""Frame conventions. Each of these is silent when wrong -- you get a plausible result, not an error. 1. VPS returns Y-up; maps and viewers are Z-up. -> YUP_TO_ZUP 2. VPS returns an ARKit camera frame (+Y up, -Z forward); mount chains are written in OpenCV optical (+Y down, +Z forward). -> CAM_TO_OPT...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/frames.py
.py
36a72ea5d16a0483
7.56
12
"""Fisheye in, pinhole out -- with the intrinsics that describe the result. Most cameras worth localizing with are wide, and VPS -- like any pinhole pose solver -- expects a rectified image described by pinhole intrinsics. A raw frame means nothing geometrically until it is remapped. THE ONE THING TO GET RIGHT ------...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/intrinsics.py
.py
1695baefd94b91a2
7.56
12
"""One call: a frame source in, a Pose out.""" from __future__ import annotations import numpy as np from .client import VPSClient from .intrinsics import PinholeIntrinsics from .pose import Pose from .settings import VPSSettings from .sources import FrameSource def localize( source: FrameSource, settings:...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/localize.py
.py
8d6d0b1826ab8dc4
7.56
12
"""The result type: what VPS answered about one frame. One type for every frame source, so poses compose without conversion. """ from __future__ import annotations import math from dataclasses import dataclass, field import numpy as np from .frames import quaternion_matrix @dataclass(frozen=True) class Pose: ...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/pose.py
.py
1f4db5837bd27228
7.56
12
"""Configuration as a value. Nothing is read at import time.""" from __future__ import annotations import json import logging import os from dataclasses import dataclass, field, replace from pathlib import Path from .errors import ConfigError log = logging.getLogger(__name__) DEFAULT_API_BASE = "https://api.multis...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/settings.py
.py
917b671dfcfd5f3d
7.56
12
"""The contract a frame source implements. Anything that can hand over a rectified image with the intrinsics describing it can be localized. class MyCamera: def capture(self) -> Frame: ... pose = localize(MyCamera()) """ from __future__ import annotations from typing import NamedTuple, ...
MultiSet-AI/multiset-python
packages/vps/src/multiset/vps/sources.py
.py
01a8cba7fd06bbeb
7.56
12
from __future__ import annotations import numpy as np import pytest from multiset.vps import HANDHELD, YUP_TO_ZUP, Mount, camera_pose_to_origin def test_yup_to_zup_is_a_rotation(): R = YUP_TO_ZUP[:3, :3] assert np.allclose(R @ R.T, np.eye(3)) assert np.isclose(np.linalg.det(R), 1.0) def test_yup_to_zup...
MultiSet-AI/multiset-python
packages/vps/tests/test_frames.py
.py
4ae111640fd507ea
8.06
12
"""The namespace itself is load-bearing, so it gets a test. An __init__.py anywhere in a namespace directory turns it into a regular package and makes every SIBLING distribution invisible -- multiset.vps installed, then `import multiset.unitree.go2` raises ModuleNotFoundError with nothing in the traceback pointing at ...
MultiSet-AI/multiset-python
packages/vps/tests/test_namespace.py
.py
e6aec2670e938285
8.06
12
from __future__ import annotations import pytest from multiset.vps import ConfigError, VPSSettings from multiset.vps.settings import parse_env_file def test_parse_env_file_ignores_comments_and_blanks(tmp_path): env = tmp_path / ".env" env.write_text("# a comment\n\nGO2_IP=10.0.0.5\n GO2_SN = B42 \nnot_a_pa...
MultiSet-AI/multiset-python
packages/vps/tests/test_settings.py
.py
1b4ffc8279953d74
8.06
12
"""Alembic migration environment.""" # ruff: noqa: I001 - Imports structured for Jinja2 template conditionals from logging.config import fileConfig from alembic import context from sqlalchemy import engine_from_config, pool from app.core.config import settings from app.db.base import Base from app.db.vector_tables i...
vstorm-co/agenticos
backend/alembic/env.py
.py
2189f6925ae43e2a
7.54
11
"""Agent workspaces - the files an agent keeps between turns Revision ID: 0002_agent_workspaces Revises: 0001_baseline Create Date: 2026-08-03 Two things live in this table and they are not the same shape, which is why `files` is nullable rather than defaulted: * a `state` workspace *is* the row - `files` holds the ...
vstorm-co/agenticos
backend/alembic/versions/0002_agent_workspaces.py
.py
02653d700617216d
7.54
11
"""Sandbox connections - where an organization's sandboxes run Revision ID: 0003_sandbox_connections Revises: 0002_agent_workspaces Create Date: 2026-08-03 Three changes, all consequences of one: the address and token a container-backed workspace needs stop being deployment settings and become a row per organization,...
vstorm-co/agenticos
backend/alembic/versions/0003_sandbox_connections.py
.py
e642b920cefc4bb4
7.54
11
"""Skill changes an agent proposed, waiting for a person to decide Revision ID: 0004_skill_proposals Revises: 0003_sandbox_connections Create Date: 2026-08-03 An agent with a workspace gets its skills as files, which is what makes a skill's script runnable at all - it is on disk beside the shell that can run it. Writ...
vstorm-co/agenticos
backend/alembic/versions/0004_skill_proposals.py
.py
67a54baa6429f02a
7.54
11
"""What a turn cost, on the message it cost it on Revision ID: 0006_message_usage Revises: 0005_usage_reporting Create Date: 2026-08-03 A turn's cost lived only in the `complete` frame on the WebSocket, so it existed for exactly as long as the tab did. Reopening a conversation showed no cost at all - not under the in...
vstorm-co/agenticos
backend/alembic/versions/0006_message_usage.py
.py
fd65ca1d1d5fc916
7.54
11
"""Rename the indexes 0002-0004 named the old way Revision ID: 0009_align_index_names Revises: 0008_approval_delegate Create Date: 2026-08-05 `0001_baseline` moved every index name onto `Base.metadata.naming_convention` (`<table>_<col>_idx`) to end the drift that made `alembic revision --autogenerate` emit four hundr...
vstorm-co/agenticos
backend/alembic/versions/0009_align_index_names.py
.py
c09eefd07a67004d
7.54
11
"""Seal the shared secret that authenticates an inbound webhook. `channel_bots.webhook_secret` was a 32-byte credential written straight to a `String(255)` column, in the same row as `token_encrypted`, `slack_signing_secret_encrypted` and `slack_app_token_encrypted` - all sealed. It is the only thing standing between ...
vstorm-co/agenticos
backend/alembic/versions/0013_seal_webhook_secret.py
.py
eff45c90efccdb56
7.54
11
"""A binding can add to what the agent was told. The same published agent answers in a dashboard, on a website widget and in a Mattermost channel, and those want different things of it: how to lay a message out, whether headings render, how to give a link, how long an answer should be. None of that is a different agen...
vstorm-co/agenticos
backend/alembic/versions/0015_exposure_prompt.py
.py
5b627e925dd0b253
7.54
11
"""Give bindings that already exist the style their platform needs. `agent_exposures.prompt` opens holding what that chat client renders - Slack draws no Markdown and writes a link as `<url|text>`, Mattermost renders headings and tables, Telegram rejects an unclosed `*`. A binding made before the column existed has no...
vstorm-co/agenticos
backend/alembic/versions/0016_seed_exposure_prompts.py
.py
cffe705d774a2cf3
7.54
11
"""What the agent may look up on *this* bot. An organization can bind one agent to two Mattermost servers and three Slack workspaces, and "may this agent list the members of the channel it is in" has a different answer on each of them - the internal Mattermost is not the customer Slack. A switch in the agent spec has ...
vstorm-co/agenticos
backend/alembic/versions/0017_exposure_tools.py
.py
71dd5cb10b68ac88
7.54
11
"""One agent per bot, not several behind one handle. A bot user is one identity in the chat. On Mattermost every reply arrives from the same avatar and the same name whichever agent produced it, so serving several behind one bot meant somebody in a channel had to type a slug to pick between agents they could not see -...
vstorm-co/agenticos
backend/alembic/versions/0018_one_agent_per_bot.py
.py
0287b49252437a7a
7.54
11
"""How talkative an agent is about cost, on the binding rather than on the bot. It sat on `channel_bots`, which made it a property of the chat platform: an operator with `channels:manage` set it, and it appeared in a table of servers and tokens next to nothing else about the agent. But what a turn cost is something th...
vstorm-co/agenticos
backend/alembic/versions/0019_exposure_usage_reporting.py
.py
b483b24de453753e
7.54
11
"""A widget can declare what the page must tell it. `agent_embeds.context` is a sentence somebody wrote once, the same for every visitor - "you are on the pricing page". What it could not say is anything about *this* visitor, and the integrator is the only one who knows that: which plan they are on, which locale, whic...
vstorm-co/agenticos
backend/alembic/versions/0020_embed_context_variables.py
.py
15aa8b6636fce244
7.54
11
"""Clear `channel_tools` out of the specs that briefly carried it. The capability was offered in the Toolbox for one commit before it moved to the binding, where it belongs - a bot serves one agent and each binding grants its own lookups, so a single switch on the spec had one answer for every bot. Any agent switched ...
vstorm-co/agenticos
backend/alembic/versions/0021_drop_channel_tools_bindings.py
.py
31d03f1bd24ce421
7.54
11
"""One kind per embed, and one config column instead of three. `0022` gave an embed a `hosted` boolean and a second config column beside its `theme`, so a row carried three columns saying what it was: a flag, a widget theme it might not use, and a page config it might not use either. The product that sat on top read a...
vstorm-co/agenticos
backend/alembic/versions/0023_embed_kinds.py
.py
0e2efe40e1662a03
7.54
11
"""A hosted page may show a picture uploaded for it. Its other two choices - the agent's avatar, the organization's - are images this platform already stores, so `config.logo` only had to name which. An uploaded one needs somewhere for the file to live, and the question is which side of the wall it lives on. A column...
vstorm-co/agenticos
backend/alembic/versions/0025_embed_page_logo.py
.py
339fe2e5545798ea
7.54
11
"""Who wrote a message, when the writer was a chat account. A channel thread is one conversation with several people in it, and `messages` recorded none of them: a room where four people spoke was stored as an undifferentiated sequence of `user` and `assistant` rows. That was invisible while a thread belonged to whoev...
vstorm-co/agenticos
backend/alembic/versions/0026_message_author.py
.py
fb5846a738e5e989
7.54
11
"""What order the turns of a conversation were written in. `created_at` could not answer it. Both rows of one turn - the question and the answer - are written inside a single transaction, and `func.now()` is the *transaction's* start time in Postgres, so the two carry the same timestamp to the microsecond. `ORDER BY c...
vstorm-co/agenticos
backend/alembic/versions/0027_message_ordinal.py
.py
1fce98211c233c1f
7.54
11
"""Whether a message's recorded cost is a floor rather than the whole of it. `messages` has carried `input_tokens`, `output_tokens` and `cost_usd` since the transcript learned to show what an answer cost. What it could not say is that the number is short: when a run reaches a model `genai-prices` has no entry for, the...
vstorm-co/agenticos
backend/alembic/versions/0032_message_cost_partial.py
.py
21757ed80cefbaf6
7.54
11
"""How many tokens the history sent with a turn occupied. The reading existed only on the live `complete` frame, so it was on screen for as long as the tab was: reload the chat and the gauge was gone. That is the one moment somebody asks "how close am I to the ceiling before I send the next message" — the same reason ...
vstorm-co/agenticos
backend/alembic/versions/0033_message_context_fill.py
.py
d4ee10d20c273a3f
7.54
11
"""A chosen default-avatar colour for a user, an organization and an agent. A row with no uploaded picture falls back to two initials on a colour derived from its id. This lets that colour be chosen instead: `avatar_color` is a slot 1..10 into the `--avatar-*` ramp the frontend renders, and null means auto - the id-de...
vstorm-co/agenticos
backend/alembic/versions/0035_avatar_color.py
.py
b379ab92edbf442e
7.54
11
"""Whether a publish moves an environment on its own. Publish repointed the default environment silently, so "publish" and "deploy to production" were the same click and nothing on screen said so. Each environment now says which it is: pinned - the default - waits to be promoted onto, and `tracks_latest` follows every...
vstorm-co/agenticos
backend/alembic/versions/0040_environment_release_mode.py
.py
14c0162fbe55d8db
7.54
11
"""A link's remaining capacity counts the people who registered under it. `used_count` counts acceptances, and acceptance needs a session - so on an `invite_only` deployment a one-use link admitted an unbounded number of *registrations*, because each one only looked at `used_count` and nothing had consumed a use yet. ...
vstorm-co/agenticos
backend/alembic/versions/0041_invitation_reservations.py
.py
c418357a5583cff2
7.54
11
"""A sync source references a vault secret, and belongs to an organization. `sync_sources.config` held the credential: a Google service account JSON or an AWS key pair, pasted into a JSONB column and encrypted by `app/core/crypto.py` - one deployment-wide Fernet key for every tenant, which is exactly the weakness the ...
vstorm-co/agenticos
backend/alembic/versions/0042_sync_source_secret_id.py
.py
0f4d2dd07d3f7b29
7.54
11
"""A tracking row says which file it tracks. `rag_documents` held a `filename` and nothing else identifying, so a row could only be found again by name - and two objects with the same basename in one bucket, `a/readme.md` beside `b/readme.md`, are indistinguishable that way. That is the collision `0042`'s successor re...
vstorm-co/agenticos
backend/alembic/versions/0043_rag_document_source_path.py
.py
33f6539f5a21a171
7.54
11
"""An embed records which master-key version sealed its signing secret. `agent_embeds.jwt_secret_encrypted` was sealed by the vault but the row kept no `key_version`, so the verifier unsealed at an implicit v1. That is a latent bug: the day a master-key rotation runs `rewrap` over the vault, every `jwt` widget's secre...
vstorm-co/agenticos
backend/alembic/versions/0044_agent_embed_key_version.py
.py
3b84e6f61133362a
7.54
11
"""Agent triggers - a schedule that fires an agent with no one at the keyboard Revision ID: 0046_agent_triggers Revises: 0045_audit_impersonator Create Date: 2026-08-10 One table, `agent_triggers`, behind agenticos#44. A trigger is operational state beside the agent - like `agent_exposures`, deliberately outside the ...
vstorm-co/agenticos
backend/alembic/versions/0046_agent_triggers.py
.py
96d9d9bca724739d
7.54
11
"""Event triggers - fire an agent on a GitHub issue or an inbound email Revision ID: 0047_agent_event_triggers Revises: 0046_agent_triggers Create Date: 2026-08-11 `0037` gave `agent_triggers` one shape: a clock schedule (interval or cron). This adds the second concept behind agenticos#44 - an *event* trigger, fired ...
vstorm-co/agenticos
backend/alembic/versions/0047_agent_event_triggers.py
.py
b9a941522bb20c99
7.54
11
"""Agent trigger name - a human title, shown instead of the agent's name Revision ID: 0048_agent_trigger_name Revises: 0047_agent_event_triggers Create Date: 2026-08-11 A trigger has always been listed by the agent it fires, so two schedules on one agent read identically. This adds an optional `name`: a human title s...
vstorm-co/agenticos
backend/alembic/versions/0048_agent_trigger_name.py
.py
badece1856e8a9e5
7.54
11
"""YAML frontmatter parsing and @mention extraction. Handles two file formats: * ``.md`` files with ``---`` delimited YAML frontmatter + markdown body * ``.yaml`` / ``.yml`` files where the entire file is YAML (body is ``""``) """ from __future__ import annotations import re from pathlib import Path from typing imp...
microsoft/amplifier-foundation
amplifier_foundation/bundle_docs/frontmatter.py
.py
7ad610dc93e9fa9c
7.62
16
"""Token estimation and color tier classification for DOT diagrams. Token estimation uses ``len(content) // 4`` — consistent with the existing ``validate-single-bundle.yaml`` recipe. Color tiers classify token counts into green/yellow/orange/red based on per-category thresholds. """ # — Color tier hex values COLOR_G...
microsoft/amplifier-foundation
amplifier_foundation/bundle_docs/token_cost.py
.py
8256912fba878532
7.62
16
"""Disk-based cache implementation for bundles.""" from __future__ import annotations import hashlib import json from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: from amplifier_foundation.bundle import Bundle class DiskCache: """Disk-based cache for bundles. Persists bundle ...
microsoft/amplifier-foundation
amplifier_foundation/cache/disk.py
.py
5d6a3cc24928653c
7.62
16
"""Protocol for bundle caching.""" from __future__ import annotations from typing import TYPE_CHECKING from typing import Protocol if TYPE_CHECKING: from amplifier_foundation.bundle import Bundle class CacheProviderProtocol(Protocol): """Protocol for caching loaded bundles. Foundation provides SimpleC...
microsoft/amplifier-foundation
amplifier_foundation/cache/protocol.py
.py
77fa042ae1e9afc2
7.62
16
"""Simple in-memory cache implementation.""" from __future__ import annotations from typing import TYPE_CHECKING if TYPE_CHECKING: from amplifier_foundation.bundle import Bundle class SimpleCache: """Simple in-memory cache for bundles. No TTL or eviction policy - bundles cached until clear() is called...
microsoft/amplifier-foundation
amplifier_foundation/cache/simple.py
.py
2a967f8af86715a0
7.62
16
"""Foundation data types for item provenance and records. These types form the contract between the foundation layer (provenance tracking) and the app-cli layer (rendering). The BundleInspector returns list[ItemRecord] from all six *_list() methods. The app-cli ItemRenderer consumes only ItemRecord. """ from __futu...
microsoft/amplifier-foundation
amplifier_foundation/configurator/_types.py
.py
694a4658110a72b7
7.62
16
"""Dictionary navigation utilities.""" from __future__ import annotations from typing import Any def get_nested( data: dict[str, Any], path: list[str], default: Any = None, ) -> Any: """Get a value from a nested dictionary by path. Args: data: Dictionary to navigate. path: List ...
microsoft/amplifier-foundation
amplifier_foundation/dicts/navigation.py
.py
00609ee77b9514a8
7.62
16
"""gRPC service adapters: bridges Python tools and providers to gRPC service contracts.""" import asyncio import inspect import json import logging from typing import Any from google.protobuf import json_format as _proto_json_format from pydantic import BaseModel as _PydanticBaseModel try: import grpc except Imp...
microsoft/amplifier-foundation
amplifier_foundation/grpc_adapter/services.py
.py
6bd72992329f5557
7.62
16
"""Content deduplication for @mentioned files.""" from __future__ import annotations import hashlib from pathlib import Path from .models import ContextFile class ContentDeduplicator: """Deduplicate content by SHA-256 hash with multi-path attribution. Tracks files that have been added and returns only uni...
microsoft/amplifier-foundation
amplifier_foundation/mentions/deduplicator.py
.py
20231f4d4ee47b94
7.62
16
"""Load @mentioned files recursively.""" from __future__ import annotations from pathlib import Path from amplifier_foundation.io.files import read_with_retry from .deduplicator import ContentDeduplicator from .models import MentionResult from .parser import parse_mentions from .protocol import MentionResolverProto...
microsoft/amplifier-foundation
amplifier_foundation/mentions/loader.py
.py
4004332059d4e508
7.62
16
"""Data models for @mention handling.""" from __future__ import annotations from dataclasses import dataclass from pathlib import Path @dataclass class ContextFile: """A context file loaded from an @mention. Supports multi-path attribution: when the same content is found at multiple paths (e.g., @found...
microsoft/amplifier-foundation
amplifier_foundation/mentions/models.py
.py
b29a961a490bd758
7.62
16
"""@mention extraction from text.""" from __future__ import annotations import re def parse_mentions(text: str) -> list[str]: """Extract @mentions from text, excluding code blocks. Finds patterns like: - @bundle:context-name - @path/to/file - @./relative/path Excludes mentions inside: ...
microsoft/amplifier-foundation
amplifier_foundation/mentions/parser.py
.py
8581a34bc3cabf3f
7.62
16
"""Protocol for @mention resolution.""" from __future__ import annotations from pathlib import Path from typing import Protocol class MentionResolverProtocol(Protocol): """Protocol for resolving @mentions to file paths. Foundation provides BaseMentionResolver with minimal patterns. Apps extend with add...
microsoft/amplifier-foundation
amplifier_foundation/mentions/protocol.py
.py
f6fbc23ccfe6520e
7.62
16
"""Base @mention resolver implementation.""" from __future__ import annotations from pathlib import Path from typing import TYPE_CHECKING if TYPE_CHECKING: from amplifier_foundation.bundle import Bundle class BaseMentionResolver: """Base implementation of MentionResolverProtocol. Supports patterns: ...
microsoft/amplifier-foundation
amplifier_foundation/mentions/resolver.py
.py
c7add0fa5941a338
7.62
16