@hasna/economy 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +12 -9
- package/dist/chunks/agent-registry-store-tpnhx3wj.js +39 -0
- package/dist/chunks/billing-bkpxy4kv.js +13 -0
- package/dist/chunks/config-j9mv3ehk.js +15 -0
- package/dist/chunks/index-2hwzmfgv.js +3407 -0
- package/dist/chunks/index-axh32d30.js +1313 -0
- package/dist/chunks/index-emvs5ph2.js +2085 -0
- package/dist/chunks/index-ez9thsr7.js +3440 -0
- package/dist/chunks/index-hesxq90g.js +62 -0
- package/dist/chunks/index-k540hfww.js +258 -0
- package/dist/chunks/index-kgy9b6bf.js +451 -0
- package/dist/chunks/index-kn5572kd.js +124 -0
- package/dist/chunks/index-p35cyhc4.js +4 -0
- package/dist/chunks/index-w3bvv0ns.js +26 -0
- package/dist/chunks/index-zpvea08j.js +3372 -0
- package/dist/chunks/menubar-6xtkt17h.js +296 -0
- package/dist/chunks/open-projects-6z4pq6mx.js +39 -0
- package/dist/chunks/pricing-f80p81gr.js +29 -0
- package/dist/chunks/pricing-vf2pycmh.js +30 -0
- package/dist/chunks/pricing-y21mcjsa.js +30 -0
- package/dist/chunks/serve-0k69e4h9.js +4655 -0
- package/dist/chunks/sqlite-store-501f32ts.js +258 -0
- package/dist/chunks/sqlite-store-fq4natnf.js +256 -0
- package/dist/chunks/sqlite-store-st99garx.js +258 -0
- package/dist/chunks/third-party-sqlite-5e85fxa2.js +11 -0
- package/dist/chunks/tui-7f8f951w.js +22 -0
- package/dist/chunks/watch-mm1j39vy.js +196 -0
- package/dist/chunks/webhooks-k4fh2t9c.js +109 -0
- package/dist/cli/commands/brief.d.ts.map +1 -1
- package/dist/cli/commands/extras.d.ts.map +1 -1
- package/dist/cli/commands/journal.d.ts +3 -0
- package/dist/cli/commands/journal.d.ts.map +1 -0
- package/dist/cli/commands/menubar.d.ts +97 -4
- package/dist/cli/commands/menubar.d.ts.map +1 -1
- package/dist/cli/commands/tui.d.ts +1 -1
- package/dist/cli/commands/tui.d.ts.map +1 -1
- package/dist/cli/commands/watch.d.ts.map +1 -1
- package/dist/cli/index.js +1358 -10114
- package/dist/db/cloud.d.ts +7 -9
- package/dist/db/cloud.d.ts.map +1 -1
- package/dist/db/database.d.ts +14 -12
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/ingest-concurrency-worker.d.ts +2 -0
- package/dist/db/ingest-concurrency-worker.d.ts.map +1 -0
- package/dist/db/ingest-errors.d.ts +9 -0
- package/dist/db/ingest-errors.d.ts.map +1 -0
- package/dist/db/ingest-schema.d.ts +3 -0
- package/dist/db/ingest-schema.d.ts.map +1 -0
- package/dist/db/ingest-specs.d.ts +8 -0
- package/dist/db/ingest-specs.d.ts.map +1 -0
- package/dist/db/ingest-test-contract.d.ts +3 -0
- package/dist/db/ingest-test-contract.d.ts.map +1 -0
- package/dist/db/ingest-validation.d.ts +12 -0
- package/dist/db/ingest-validation.d.ts.map +1 -0
- package/dist/db/ingest.d.ts +27 -0
- package/dist/db/ingest.d.ts.map +1 -0
- package/dist/db/legacy-schema.d.ts +7 -0
- package/dist/db/legacy-schema.d.ts.map +1 -0
- package/dist/db/observation-contract.d.ts +3 -0
- package/dist/db/observation-contract.d.ts.map +1 -0
- package/dist/db/observation-provenance.d.ts +23 -0
- package/dist/db/observation-provenance.d.ts.map +1 -0
- package/dist/db/observation-schema.d.ts +24 -0
- package/dist/db/observation-schema.d.ts.map +1 -0
- package/dist/db/pg-connection.d.ts +10 -0
- package/dist/db/pg-connection.d.ts.map +1 -0
- package/dist/db/pg-migrate.d.ts +4 -9
- package/dist/db/pg-migrate.d.ts.map +1 -1
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/db/pg-protocol.d.ts +28 -0
- package/dist/db/pg-protocol.d.ts.map +1 -0
- package/dist/db/sqlite-store.d.ts +4 -0
- package/dist/db/sqlite-store.d.ts.map +1 -0
- package/dist/db/sync-pg.d.ts +17 -21
- package/dist/db/sync-pg.d.ts.map +1 -1
- package/dist/db/third-party-sqlite.d.ts +10 -0
- package/dist/db/third-party-sqlite.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1161 -2464
- package/dist/ingest/claude-quota.d.ts.map +1 -1
- package/dist/ingest/claude.d.ts.map +1 -1
- package/dist/ingest/codex-quota.d.ts.map +1 -1
- package/dist/ingest/codex.d.ts +25 -0
- package/dist/ingest/codex.d.ts.map +1 -1
- package/dist/ingest/collection-outcome.d.ts +17 -0
- package/dist/ingest/collection-outcome.d.ts.map +1 -0
- package/dist/ingest/cursor.d.ts.map +1 -1
- package/dist/ingest/gemini.d.ts.map +1 -1
- package/dist/ingest/hermes.d.ts +1 -1
- package/dist/ingest/hermes.d.ts.map +1 -1
- package/dist/ingest/loops.d.ts.map +1 -1
- package/dist/ingest/opencode.d.ts +1 -1
- package/dist/ingest/opencode.d.ts.map +1 -1
- package/dist/ingest/pi.d.ts +1 -1
- package/dist/ingest/pi.d.ts.map +1 -1
- package/dist/ingest/quota-observation.d.ts +16 -0
- package/dist/ingest/quota-observation.d.ts.map +1 -0
- package/dist/ingest/source-time.d.ts +4 -0
- package/dist/ingest/source-time.d.ts.map +1 -0
- package/dist/lib/accounts-store.d.ts +39 -13
- package/dist/lib/accounts-store.d.ts.map +1 -1
- package/dist/lib/analytics.d.ts.map +1 -1
- package/dist/lib/api-display-url.d.ts +1 -1
- package/dist/lib/autosync-gate.d.ts +12 -5
- package/dist/lib/autosync-gate.d.ts.map +1 -1
- package/dist/lib/billing-diff.d.ts +18 -40
- package/dist/lib/billing-diff.d.ts.map +1 -1
- package/dist/lib/brief.d.ts +2 -0
- package/dist/lib/brief.d.ts.map +1 -1
- package/dist/lib/budget-decimal.d.ts +14 -0
- package/dist/lib/budget-decimal.d.ts.map +1 -0
- package/dist/lib/cloud-ingest.d.ts +15 -0
- package/dist/lib/cloud-ingest.d.ts.map +1 -1
- package/dist/lib/cloud-storage.d.ts.map +1 -1
- package/dist/lib/ingest-batches.d.ts +21 -0
- package/dist/lib/ingest-batches.d.ts.map +1 -0
- package/dist/lib/ingest-journal-client.d.ts +37 -0
- package/dist/lib/ingest-journal-client.d.ts.map +1 -0
- package/dist/lib/ingest-journal-lock.d.ts +5 -0
- package/dist/lib/ingest-journal-lock.d.ts.map +1 -0
- package/dist/lib/ingest-journal-maintenance.d.ts +92 -0
- package/dist/lib/ingest-journal-maintenance.d.ts.map +1 -0
- package/dist/lib/ingest-journal-operation.d.ts +55 -0
- package/dist/lib/ingest-journal-operation.d.ts.map +1 -0
- package/dist/lib/ingest-journal.d.ts +73 -0
- package/dist/lib/ingest-journal.d.ts.map +1 -0
- package/dist/lib/money-display.d.ts +13 -0
- package/dist/lib/money-display.d.ts.map +1 -0
- package/dist/lib/periods.d.ts +12 -0
- package/dist/lib/periods.d.ts.map +1 -1
- package/dist/lib/pricing.d.ts +14 -0
- package/dist/lib/pricing.d.ts.map +1 -1
- package/dist/lib/savings.d.ts +64 -7
- package/dist/lib/savings.d.ts.map +1 -1
- package/dist/lib/store/index.d.ts +25 -21
- package/dist/lib/store/index.d.ts.map +1 -1
- package/dist/lib/summary-contract.d.ts +32 -0
- package/dist/lib/summary-contract.d.ts.map +1 -0
- package/dist/lib/summary-test-contract.d.ts +3 -0
- package/dist/lib/summary-test-contract.d.ts.map +1 -0
- package/dist/lib/sync-all.d.ts +4 -0
- package/dist/lib/sync-all.d.ts.map +1 -1
- package/dist/lib/sync-maintenance.d.ts.map +1 -1
- package/dist/lib/sync-report.d.ts +4 -0
- package/dist/lib/sync-report.d.ts.map +1 -0
- package/dist/lib/test-keychain-fixture.d.ts +9 -0
- package/dist/lib/test-keychain-fixture.d.ts.map +1 -0
- package/dist/mcp/agent-registry-store.d.ts +30 -0
- package/dist/mcp/agent-registry-store.d.ts.map +1 -0
- package/dist/mcp/agent-registry.d.ts +9 -16
- package/dist/mcp/agent-registry.d.ts.map +1 -1
- package/dist/mcp/index.js +2281 -3457
- package/dist/mcp/ingest-journal-tool.d.ts +2 -0
- package/dist/mcp/ingest-journal-tool.d.ts.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/otel/index.js +1950 -288
- package/dist/server/human-auth.d.ts +20 -0
- package/dist/server/human-auth.d.ts.map +1 -0
- package/dist/server/index.js +10401 -6695
- package/dist/server/legacy-inventory.d.ts +52 -0
- package/dist/server/legacy-inventory.d.ts.map +1 -0
- package/dist/server/legacy-operations.d.ts +64 -0
- package/dist/server/legacy-operations.d.ts.map +1 -0
- package/dist/server/legacy-plan.d.ts +55 -0
- package/dist/server/legacy-plan.d.ts.map +1 -0
- package/dist/server/legacy-preservation.d.ts +58 -0
- package/dist/server/legacy-preservation.d.ts.map +1 -0
- package/dist/server/pg-sync-worker.js +195 -21
- package/dist/server/serve.d.ts +20 -16
- package/dist/server/serve.d.ts.map +1 -1
- package/dist/server/service-admission.d.ts +10 -0
- package/dist/server/service-admission.d.ts.map +1 -0
- package/dist/server/service-dispatcher.d.ts +45 -0
- package/dist/server/service-dispatcher.d.ts.map +1 -0
- package/dist/server/service-operations.d.ts +5 -0
- package/dist/server/service-operations.d.ts.map +1 -0
- package/dist/server/service-protocol.d.ts +50 -0
- package/dist/server/service-protocol.d.ts.map +1 -0
- package/dist/server/service-worker.d.ts +2 -0
- package/dist/server/service-worker.d.ts.map +1 -0
- package/dist/server/service-worker.js +8029 -0
- package/dist/types/index.d.ts +66 -0
- package/dist/types/index.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/cli.md +1 -1
- package/docs/configuration.md +5 -5
- package/docs/cost-reporting.md +49 -0
- package/docs/historical-data-reconciliation.md +203 -0
- package/docs/ingest-journal.md +108 -0
- package/docs/ingestion.md +60 -4
- package/docs/mcp.md +2 -2
- package/docs/native-budget-save.md +84 -0
- package/docs/native-human-auth.md +102 -0
- package/docs/rest-api.md +2 -2
- package/package.json +15 -12
- package/dist/lib/test-hermetic-accounts.d.ts +0 -7
- package/dist/lib/test-hermetic-accounts.d.ts.map +0 -1
- package/dist/lib/test-hermetic-fleet-env.d.ts +0 -4
- package/dist/lib/test-hermetic-fleet-env.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-quota.d.ts","sourceRoot":"","sources":["../../src/ingest/claude-quota.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"claude-quota.d.ts","sourceRoot":"","sources":["../../src/ingest/claude-quota.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA+DxE,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/ingest/claude.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/ingest/claude.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAWxE,OAAO,KAAK,EAAkB,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAiE9D,wBAAsB,YAAY,CAChC,EAAE,EAAE,QAAQ,EACZ,OAAO,UAAQ,EACf,WAAW,SAAsB,GAChC,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhE;AAED,wBAAsB,YAAY,CAChC,EAAE,EAAE,QAAQ,EACZ,OAAO,UAAQ,EACf,WAAW,SAAsB,GAChC,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhE;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,KAAK,EAChB,OAAO,UAAQ,GACd,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAoJhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex-quota.d.ts","sourceRoot":"","sources":["../../src/ingest/codex-quota.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"codex-quota.d.ts","sourceRoot":"","sources":["../../src/ingest/codex-quota.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA4ExE,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CA4BpG"}
|
package/dist/ingest/codex.d.ts
CHANGED
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
+
interface CodexTokenUsage {
|
|
3
|
+
input_tokens?: number;
|
|
4
|
+
cached_input_tokens?: number;
|
|
5
|
+
output_tokens?: number;
|
|
6
|
+
reasoning_output_tokens?: number;
|
|
7
|
+
total_tokens?: number;
|
|
8
|
+
}
|
|
9
|
+
interface CodexTokenEvent {
|
|
10
|
+
usage: CodexTokenUsage;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
model: string;
|
|
13
|
+
identity: string;
|
|
14
|
+
}
|
|
2
15
|
declare function readCodexModel(configPath?: string): string;
|
|
16
|
+
/** Event identity binds source time, model, usage and source request/turn IDs.
|
|
17
|
+
* Equal counts at distinct events are independent calls. Cumulative counts are
|
|
18
|
+
* only used to recognize repeated notifications and counter resets. */
|
|
19
|
+
export declare function parseCodexEvents(content: string): {
|
|
20
|
+
events: CodexTokenEvent[];
|
|
21
|
+
incomplete: boolean;
|
|
22
|
+
};
|
|
23
|
+
export interface CodexIngestIssue {
|
|
24
|
+
code: 'legacy_aggregate_requires_migration' | 'usage_events_unavailable' | 'usage_events_incomplete' | 'source_unreadable';
|
|
25
|
+
session_id?: string;
|
|
26
|
+
}
|
|
3
27
|
export declare function ingestCodex(db: Database, verbose?: boolean): Promise<{
|
|
4
28
|
sessions: number;
|
|
5
29
|
requests: number;
|
|
30
|
+
issues?: CodexIngestIssue[];
|
|
6
31
|
}>;
|
|
7
32
|
export { readCodexModel };
|
|
8
33
|
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/ingest/codex.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/ingest/codex.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAyBxE,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uBAAuB,CAAC,EAAE,MAAM,CAAA;IAChC,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,eAAe,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB;AAuDD,iBAAS,cAAc,CAAC,UAAU,SAAoB,GAAG,MAAM,CAS9D;AAkCD;;uEAEuE;AACvE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CA0CpG;AAED,MAAM,WAAW,gBAAgB;IAAG,IAAI,EAAE,qCAAqC,GAAG,0BAA0B,GAAG,yBAAyB,GAAG,mBAAmB,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE;AACrL,wBAAsB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC,CAmG7I;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CollectionStatus = 'success' | 'unchanged' | 'missing' | 'unsupported' | 'failed';
|
|
2
|
+
export interface CollectionOutcome {
|
|
3
|
+
source: string;
|
|
4
|
+
attempted_at: string;
|
|
5
|
+
completed_at: string;
|
|
6
|
+
status: CollectionStatus;
|
|
7
|
+
parser_version: string;
|
|
8
|
+
error_code: string | null;
|
|
9
|
+
}
|
|
10
|
+
/** Codes are authored constants, never raw provider/parser exception text. */
|
|
11
|
+
export declare function collectionProblem(status: 'missing' | 'unsupported' | 'failed', code: string): void;
|
|
12
|
+
export declare function collectionUnchanged(): void;
|
|
13
|
+
export declare function collectWithOutcome<T extends object>(source: string, run: () => Promise<T>, empty: T): Promise<{
|
|
14
|
+
result: T;
|
|
15
|
+
outcome: CollectionOutcome;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=collection-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-outcome.d.ts","sourceRoot":"","sources":["../../src/ingest/collection-outcome.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAA;AAC7F,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,gBAAgB,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAC,aAAa,GAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAG9F;AACD,wBAAgB,mBAAmB,IAAI,IAAI,CAAsE;AACjH,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAI,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAC,CAAC,GAAE,OAAO,CAAC;IAAC,MAAM,EAAC,CAAC,CAAC;IAAA,OAAO,EAAC,iBAAiB,CAAA;CAAC,CAAC,CASrJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/ingest/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/ingest/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAqCxE,wBAAsB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBlH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/ingest/gemini.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/ingest/gemini.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAmGxE,wBAAsB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA0HnH"}
|
package/dist/ingest/hermes.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
-
export declare function ingestHermes(db: Database, verbose?: boolean): Promise<{
|
|
2
|
+
export declare function ingestHermes(db: Database, verbose?: boolean, sourcePath?: string): Promise<{
|
|
3
3
|
sessions: number;
|
|
4
4
|
requests: number;
|
|
5
5
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../src/ingest/hermes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hermes.d.ts","sourceRoot":"","sources":["../../src/ingest/hermes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA0BxE,wBAAsB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,EAAE,UAAU,SAAY,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAiEzI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loops.d.ts","sourceRoot":"","sources":["../../src/ingest/loops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loops.d.ts","sourceRoot":"","sources":["../../src/ingest/loops.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAS7D,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC1C;AA0DD,wBAAgB,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAE7D;AACD,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAiCxE;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAc3C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAyGD,wBAAsB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA8FhH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
-
export declare function ingestOpenCode(db: Database, verbose?: boolean): Promise<{
|
|
2
|
+
export declare function ingestOpenCode(db: Database, verbose?: boolean, sourceDir?: string): Promise<{
|
|
3
3
|
files: number;
|
|
4
4
|
requests: number;
|
|
5
5
|
sessions: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/ingest/opencode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/ingest/opencode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA8CxE,wBAAsB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,EAAE,SAAS,SAAiB,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAqF9J"}
|
package/dist/ingest/pi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
-
export declare function ingestPi(db: Database, verbose?: boolean): Promise<{
|
|
2
|
+
export declare function ingestPi(db: Database, verbose?: boolean, sourceDir?: string): Promise<{
|
|
3
3
|
files: number;
|
|
4
4
|
requests: number;
|
|
5
5
|
sessions: number;
|
package/dist/ingest/pi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/ingest/pi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/ingest/pi.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAwCxE,wBAAsB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,UAAQ,EAAE,SAAS,SAAe,GAAG,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAkFtJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
+
import type { Agent } from '../lib/agents.js';
|
|
3
|
+
export interface QuotaContext {
|
|
4
|
+
provider: string;
|
|
5
|
+
account_key: string;
|
|
6
|
+
agent: Agent;
|
|
7
|
+
observed_at: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function isoTime(value: unknown): string | null;
|
|
10
|
+
export declare function quotaObservation(db: Database, ctx: QuotaContext, metric: string, value: unknown, unit: string, detail?: {
|
|
11
|
+
reset_at?: unknown;
|
|
12
|
+
window_seconds?: unknown;
|
|
13
|
+
value_kind?: 'gauge' | 'cumulative' | 'delta' | 'unknown';
|
|
14
|
+
}): number;
|
|
15
|
+
export declare function quotaSubscription(db: Database, ctx: QuotaContext, plan: string): void;
|
|
16
|
+
//# sourceMappingURL=quota-observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-observation.d.ts","sourceRoot":"","sources":["../../src/ingest/quota-observation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC7C,MAAM,WAAW,YAAY;IAAG,QAAQ,EAAC,MAAM,CAAC;IAAC,WAAW,EAAC,MAAM,CAAC;IAAC,KAAK,EAAC,KAAK,CAAC;IAAC,WAAW,EAAC,MAAM,CAAA;CAAE;AACtG,wBAAgB,OAAO,CAAC,KAAK,EAAC,OAAO,GAAE,MAAM,GAAC,IAAI,CAGjD;AACD,wBAAgB,gBAAgB,CAAC,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,MAAM,EACpG,MAAM,GAAC;IAAC,QAAQ,CAAC,EAAC,OAAO,CAAC;IAAA,cAAc,CAAC,EAAC,OAAO,CAAC;IAAA,UAAU,CAAC,EAAC,OAAO,GAAC,YAAY,GAAC,OAAO,GAAC,SAAS,CAAA;CAAI,GAAE,MAAM,CAOhH;AACD,wBAAgB,iBAAiB,CAAC,EAAE,EAAC,QAAQ,EAAC,GAAG,EAAC,YAAY,EAAC,IAAI,EAAC,MAAM,GAAE,IAAI,CAI/E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-time.d.ts","sourceRoot":"","sources":["../../src/ingest/source-time.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,KAAK,EAAC,OAAO,GAAE,MAAM,GAAC,IAAI,CAMpD;AACD,wBAAgB,gBAAgB,CAAC,KAAK,EAAC,OAAO,GAAE,MAAM,GAAC,IAAI,CAG1D"}
|
|
@@ -16,8 +16,8 @@ declare const profileSchema: z.ZodObject<{
|
|
|
16
16
|
lastUsedAt: z.ZodOptional<z.ZodString>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
name: string;
|
|
19
|
-
tool: string;
|
|
20
19
|
dir: string;
|
|
20
|
+
tool: string;
|
|
21
21
|
createdAt: string;
|
|
22
22
|
description?: string | undefined;
|
|
23
23
|
email?: string | undefined;
|
|
@@ -25,8 +25,8 @@ declare const profileSchema: z.ZodObject<{
|
|
|
25
25
|
lastUsedAt?: string | undefined;
|
|
26
26
|
}, {
|
|
27
27
|
name: string;
|
|
28
|
-
tool: string;
|
|
29
28
|
dir: string;
|
|
29
|
+
tool: string;
|
|
30
30
|
createdAt: string;
|
|
31
31
|
description?: string | undefined;
|
|
32
32
|
email?: string | undefined;
|
|
@@ -41,14 +41,14 @@ declare const toolDefSchema: z.ZodObject<{
|
|
|
41
41
|
defaultDir: z.ZodString;
|
|
42
42
|
bin: z.ZodString;
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
label: string;
|
|
45
44
|
id: string;
|
|
45
|
+
label: string;
|
|
46
46
|
envVar: string;
|
|
47
47
|
defaultDir: string;
|
|
48
48
|
bin: string;
|
|
49
49
|
}, {
|
|
50
|
-
label: string;
|
|
51
50
|
id: string;
|
|
51
|
+
label: string;
|
|
52
52
|
envVar: string;
|
|
53
53
|
defaultDir: string;
|
|
54
54
|
bin: string;
|
|
@@ -56,28 +56,54 @@ declare const toolDefSchema: z.ZodObject<{
|
|
|
56
56
|
export type Profile = z.infer<typeof profileSchema>;
|
|
57
57
|
export type ToolDef = z.infer<typeof toolDefSchema>;
|
|
58
58
|
/**
|
|
59
|
-
* The minimal store surface economy uses for attribution.
|
|
60
|
-
* (local JSON
|
|
59
|
+
* The minimal store surface economy uses for attribution. All three transports
|
|
60
|
+
* (local JSON, accounts-serve API, and the refusing no-registry store)
|
|
61
|
+
* implement it.
|
|
61
62
|
*/
|
|
62
63
|
export interface AccountsStore {
|
|
63
|
-
readonly transport: 'local' | 'api';
|
|
64
|
+
readonly transport: 'local' | 'api' | 'none';
|
|
64
65
|
listProfiles(tool?: string): Promise<Profile[]>;
|
|
65
66
|
findProfile(name: string, tool?: string): Promise<Profile | undefined>;
|
|
66
67
|
currentProfile(tool: string): Promise<Profile | undefined>;
|
|
67
68
|
listTools(): Promise<ToolDef[]>;
|
|
68
69
|
}
|
|
69
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* The profile name last applied to a tool's live default paths, if any.
|
|
72
|
+
*
|
|
73
|
+
* Reads the on-box registry directly (not through the store), so it carries
|
|
74
|
+
* the same gate: without economy's local opt-in there is no applied profile,
|
|
75
|
+
* because the file is not read at all.
|
|
76
|
+
*/
|
|
70
77
|
export declare function appliedProfileName(toolId: string): string | undefined;
|
|
71
78
|
/**
|
|
72
79
|
* Resolve the active registry store for this process — the credential chain
|
|
73
|
-
*
|
|
80
|
+
* first: the API transport when `@hasna/contracts` resolves an accounts
|
|
74
81
|
* credential for this environment (env `HASNA_ACCOUNTS_API_KEY` / legacy
|
|
75
82
|
* `ACCOUNTS_API_KEY`, the accounts credentials file, or the Keychain, with the
|
|
76
|
-
* authority defaulted to the fleet gateway `https://api.hasna.com/accounts`)
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
83
|
+
* authority defaulted to the fleet gateway `https://api.hasna.com/accounts`).
|
|
84
|
+
* Stale `*_STORAGE_MODE` / `*_MODE` variables are ignored — they never select
|
|
85
|
+
* a store and never error (owner directive 2026-08-15).
|
|
86
|
+
*
|
|
87
|
+
* WITH NO CREDENTIAL the on-box JSON registry is served ONLY under economy's
|
|
88
|
+
* explicit local opt-in (`HASNA_ECONOMY_LOCAL=1` / `ECONOMY_LOCAL=1`); every
|
|
89
|
+
* other run gets {@link NoRegistryStore} — no on-box read, attribution absent,
|
|
90
|
+
* one stderr line. Serving the on-box registry to a hosted client was the last
|
|
91
|
+
* silent-local branch in economy (fleet-alignment ruling d, 2026-09-11).
|
|
92
|
+
*
|
|
93
|
+
* FAIL CLOSED ON MISCONFIGURATION (hasna/apps#1720): the local registry is
|
|
94
|
+
* selected ONLY by "no credential AND no authority configure the API". A
|
|
95
|
+
* configured-but-unusable accounts API — a URL with no key, blank or
|
|
96
|
+
* disagreeing aliases, an unsafe or unreadable credentials file, a Keychain
|
|
97
|
+
* item that exists but cannot be read, a deliberate override that cannot be
|
|
98
|
+
* honoured — THROWS instead of silently degrading: the old catch-all fell
|
|
99
|
+
* back to local attribution on any error, which is exactly the false green
|
|
100
|
+
* the fail-closed ruling ends (attribution that quietly read an empty local
|
|
101
|
+
* registry while the fleet API was half configured). A local selection
|
|
102
|
+
* announces itself once on stderr, so a run can never be mistaken for a
|
|
103
|
+
* hosted one.
|
|
80
104
|
*/
|
|
81
105
|
export declare function resolveStore(env?: NodeJS.ProcessEnv, options?: ResolveAccountsStoreOptions): AccountsStore;
|
|
106
|
+
/** Test seam: forget that the local-mode line was printed. */
|
|
107
|
+
export declare function __resetAccountsLocalNotice(): void;
|
|
82
108
|
export {};
|
|
83
109
|
//# sourceMappingURL=accounts-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-store.d.ts","sourceRoot":"","sources":["../../src/lib/accounts-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accounts-store.d.ts","sourceRoot":"","sources":["../../src/lib/accounts-store.ts"],"names":[],"mappings":"AAsCA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAA6C,KAAK,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAMhH,sFAAsF;AACtF,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,sBAAsB,CAAA;CACrC;AAKD,uEAAuE;AACvE,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;EASjB,CAAA;AAEF,gFAAgF;AAChF,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMjB,CAAA;AAYF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAmBnD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;IAC5C,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC/C,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACtE,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC1D,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;CAChC;AAwDD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGrE;AAwQD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAC1B,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,OAAO,GAAE,2BAAgC,GACxC,aAAa,CAqCf;AA2DD,8DAA8D;AAC9D,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/lib/analytics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/lib/analytics.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAIxE,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAChD,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,YAAY,EAAE,oBAAoB,EAAE,CAAA;CACrC;AAED,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAmDzF;AAID,MAAM,MAAM,U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AAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,EAAE,CAWpE"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Normalization is intentionally limited to the gateway form. Legacy origins
|
|
12
12
|
* (`https://<app>.hasna.xyz`, allowed for todos until hasna/apps#1512 ships)
|
|
13
|
-
* and
|
|
13
|
+
* and custom endpoints keep the caller's existing display behavior:
|
|
14
14
|
* this helper returns `null` for anything that is not
|
|
15
15
|
* `https://api.hasna.com/<app>` or the already-resolved
|
|
16
16
|
* `https://api.hasna.com/<app>/v1`.
|
|
@@ -4,12 +4,19 @@ export declare const AUTOSYNC_STATE_KEY = "last_run";
|
|
|
4
4
|
export declare const DEFAULT_AUTOSYNC_INTERVAL_MS: number;
|
|
5
5
|
/** The auto-sync interval in ms: env seconds, 0 = always sync, default 10 min. */
|
|
6
6
|
export declare function autosyncIntervalMs(env?: NodeJS.ProcessEnv): number;
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The store that holds the autosync marker: the ingest cache in hosted mode,
|
|
9
|
+
* the local db otherwise.
|
|
10
|
+
*
|
|
11
|
+
* ASYNC because the SQLite lane is reached through ONE gated dynamic import
|
|
12
|
+
* (`db/sqlite-store.js`), which is what keeps `bun:sqlite` out of dist/cli and
|
|
13
|
+
* dist/mcp. Callers that already hold a handle pass it in and never pay for it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function autosyncMarkerStore(env?: NodeJS.ProcessEnv): Promise<Database>;
|
|
9
16
|
/** Epoch ms of the last auto-sync, or 0 when the store has never auto-synced. */
|
|
10
|
-
export declare function autosyncLastRun(db?: Database, env?: NodeJS.ProcessEnv): number
|
|
17
|
+
export declare function autosyncLastRun(db?: Database, env?: NodeJS.ProcessEnv): Promise<number>;
|
|
11
18
|
/** Record that an auto-sync just completed. */
|
|
12
|
-
export declare function markAutoSync(db?: Database, env?: NodeJS.ProcessEnv): void
|
|
19
|
+
export declare function markAutoSync(db?: Database, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
13
20
|
/** Whether the auto-sync should run now: always when the interval is 0, otherwise at most once per interval. */
|
|
14
|
-
export declare function autoSyncDue(db?: Database, env?: NodeJS.ProcessEnv): boolean
|
|
21
|
+
export declare function autoSyncDue(db?: Database, env?: NodeJS.ProcessEnv): Promise<boolean>;
|
|
15
22
|
//# sourceMappingURL=autosync-gate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autosync-gate.d.ts","sourceRoot":"","sources":["../../src/lib/autosync-gate.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAExE,eAAO,MAAM,qBAAqB,aAAa,CAAA;AAC/C,eAAO,MAAM,kBAAkB,aAAa,CAAA;AAC5C,eAAO,MAAM,4BAA4B,QAAc,CAAA;AAEvD,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM/E;AAED
|
|
1
|
+
{"version":3,"file":"autosync-gate.d.ts","sourceRoot":"","sources":["../../src/lib/autosync-gate.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAExE,eAAO,MAAM,qBAAqB,aAAa,CAAA;AAC/C,eAAO,MAAM,kBAAkB,aAAa,CAAA;AAC5C,eAAO,MAAM,4BAA4B,QAAc,CAAA;AAEvD,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM/E;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAIjG;AAED,iFAAiF;AACjF,wBAAsB,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1G;AAED,+CAA+C;AAC/C,wBAAsB,YAAY,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGrG;AAED,gHAAgH;AAChH,wBAAsB,WAAW,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAIvG"}
|
|
@@ -1,59 +1,37 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
-
import type { Period } from '../types/index.js';
|
|
2
|
+
import type { Period, CostSummary, BillingSummary } from '../types/index.js';
|
|
3
3
|
export interface BillingDiffRow {
|
|
4
4
|
agent: string;
|
|
5
|
+
basis: 'stored_request_rows_subtotal';
|
|
6
|
+
/** Raw stored request subtotal; no complete pricing or provider attribution claim. */
|
|
5
7
|
estimated_usd: number;
|
|
6
|
-
actual_usd: number;
|
|
7
|
-
delta_usd: number;
|
|
8
|
-
delta_pct: number;
|
|
8
|
+
actual_usd: number | null;
|
|
9
|
+
delta_usd: number | null;
|
|
10
|
+
delta_pct: number | null;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* - `no_billing_records` — no provider billing rows exist for the period at
|
|
14
|
-
* all. Nothing was imported; there is no "actual" to compare against.
|
|
15
|
-
* - `zero_actual_billing` — rows exist but total $0.00, so the denominator is
|
|
16
|
-
* still absent even though the import ran.
|
|
17
|
-
*/
|
|
18
|
-
export type BillingDiffIncomparableReason = 'no_billing_records' | 'zero_actual_billing';
|
|
19
|
-
/**
|
|
20
|
-
* Estimated-vs-actual drift as a percentage, or `null` when there is no actual
|
|
21
|
-
* to divide by.
|
|
22
|
-
*
|
|
23
|
-
* Returning `null` rather than `0` is the point. Three call sites independently
|
|
24
|
-
* wrote `actual > 0 ? (delta / actual) * 100 : 0`, and every one of them then
|
|
25
|
-
* rendered the fallback as a measured "0.0%" — reporting perfect agreement for
|
|
26
|
-
* the case where nothing was there to agree with.
|
|
27
|
-
*/
|
|
12
|
+
export type BillingDiffIncomparableReason = 'no_billing_records' | 'account_window_source_unverified';
|
|
13
|
+
/** Arithmetic only. A finite ratio does not establish billing comparability. */
|
|
28
14
|
export declare function billingDeltaPct(estimatedUsd: number, actualUsd: number): number | null;
|
|
29
15
|
export interface BillingDiffSummary {
|
|
30
16
|
period: Period;
|
|
17
|
+
basis: 'unmatched_subtotals';
|
|
18
|
+
/** Compatibility aliases of the explicitly scoped nested summaries. */
|
|
31
19
|
estimated_usd: number;
|
|
32
20
|
actual_usd: number;
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
usage_summary: CostSummary;
|
|
22
|
+
billing_summary: BillingSummary;
|
|
23
|
+
delta_usd: number | null;
|
|
24
|
+
delta_pct: number | null;
|
|
35
25
|
threshold_pct: number;
|
|
36
|
-
is_alert: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Whether `delta_pct` is a measurement at all. False means the two sides
|
|
39
|
-
* could not be compared, and `delta_pct` carries 0 only because the type is
|
|
40
|
-
* a number — read this before reporting the percentage as agreement.
|
|
41
|
-
*/
|
|
26
|
+
is_alert: boolean | null;
|
|
42
27
|
comparable: boolean;
|
|
43
|
-
incomparable_reason: BillingDiffIncomparableReason
|
|
28
|
+
incomparable_reason: BillingDiffIncomparableReason;
|
|
44
29
|
by_agent: BillingDiffRow[];
|
|
45
30
|
by_provider: Record<string, number>;
|
|
46
31
|
}
|
|
47
32
|
export declare function queryBillingDiff(db: Database, period: Period, thresholdPct?: number): BillingDiffSummary;
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
* Kept beside the diff rather than in the CLI because the interesting case is
|
|
52
|
-
* a semantic one: an unmeasurable drift must not render as a measured 0.0%.
|
|
53
|
-
* A check that cannot distinguish "the sides agree" from "there is nothing to
|
|
54
|
-
* compare" cannot fail, and this one is consulted to decide whether the rest
|
|
55
|
-
* of the tool's numbers are trustworthy.
|
|
56
|
-
*/
|
|
33
|
+
/** Refuse old hosted reports that call unmatched or partial totals measured drift. */
|
|
34
|
+
export declare function requireCurrentBillingDiffSummary(value: unknown): BillingDiffSummary;
|
|
57
35
|
export declare function billingDriftCheck(diff: BillingDiffSummary): {
|
|
58
36
|
ok: boolean;
|
|
59
37
|
msg: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-diff.d.ts","sourceRoot":"","sources":["../../src/lib/billing-diff.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billing-diff.d.ts","sourceRoot":"","sources":["../../src/lib/billing-diff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAExE,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAI5E,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,8BAA8B,CAAA;IACrC,sFAAsF;IACtF,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,MAAM,6BAA6B,GAAG,oBAAoB,GAAG,kCAAkC,CAAA;AAErG,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAItF;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,qBAAqB,CAAA;IAC5B,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,WAAW,CAAA;IAC1B,eAAe,EAAE,cAAc,CAAA;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,UAAU,EAAE,OAAO,CAAA;IACnB,mBAAmB,EAAE,6BAA6B,CAAA;IAClD,QAAQ,EAAE,cAAc,EAAE,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACpC;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,SAAK,GAAG,kBAAkB,CAsBpG;AAED,sFAAsF;AACtF,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAsBnF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAQxF"}
|
package/dist/lib/brief.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
2
|
+
import type { CostSummary } from '../types/index.js';
|
|
2
3
|
type BriefPeriod = 'today' | 'week';
|
|
3
4
|
export interface BriefTotals {
|
|
4
5
|
sessions: number;
|
|
@@ -14,6 +15,7 @@ export interface BriefTotals {
|
|
|
14
15
|
last_active: string | null;
|
|
15
16
|
}
|
|
16
17
|
export interface BriefPeriodSummary extends BriefTotals {
|
|
18
|
+
cost_summary?: CostSummary;
|
|
17
19
|
label: string;
|
|
18
20
|
period: BriefPeriod | 'since';
|
|
19
21
|
since?: string;
|
package/dist/lib/brief.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brief.d.ts","sourceRoot":"","sources":["../../src/lib/brief.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brief.d.ts","sourceRoot":"","sources":["../../src/lib/brief.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAQxE,OAAO,KAAK,EAAoC,WAAW,EAAU,MAAM,mBAAmB,CAAA;AAE9F,KAAK,WAAW,GAAG,OAAO,GAAG,MAAM,CAAA;AAEnC,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,iBAAiB,EAAE,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,sBAAsB,EAAE,MAAM,CAAA;IAC9B,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,YAAY,CAAC,EAAE,WAAW,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,WAAW,GAAG,OAAO,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,W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U,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAE,YAAiB,GAAG,YAAY,CAmD9E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface BudgetCostGroup {
|
|
2
|
+
cost_usd: number;
|
|
3
|
+
entries: number | string;
|
|
4
|
+
}
|
|
5
|
+
/** The numeric display fields retain the existing wire contract. Thresholds are
|
|
6
|
+
* determined from exact decimals before that projection, never from a rounded
|
|
7
|
+
* percentage or a database's floating-point SUM. */
|
|
8
|
+
export declare function meteredBudgetAmounts(groups: BudgetCostGroup[], limit: number, threshold: number): {
|
|
9
|
+
current_spend_usd: number;
|
|
10
|
+
percent_used: number;
|
|
11
|
+
is_over_limit: boolean;
|
|
12
|
+
is_over_alert: boolean;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=budget-decimal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"budget-decimal.d.ts","sourceRoot":"","sources":["../../src/lib/budget-decimal.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAAG,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE;AA0B/E;;oDAEoD;AACpD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;EAmB/F"}
|
|
@@ -2,11 +2,23 @@ import type { SqliteAdapter as Database } from '../db/sqlite-adapter.js';
|
|
|
2
2
|
import type { SyncAllResult } from './sync-all.js';
|
|
3
3
|
import type { ActiveEconomyCloudStorage } from './cloud-storage.js';
|
|
4
4
|
import type { SyncOptions } from '../types/index.js';
|
|
5
|
+
import { type IngestBatchReceipt } from './ingest-batches.js';
|
|
5
6
|
/**
|
|
6
7
|
* Machine-local mtime cache path: `HASNA_ECONOMY_INGEST_CACHE` when set, else
|
|
7
8
|
* `<cache root>/economy/ingest-cache.json`. Never under the app data home.
|
|
8
9
|
*/
|
|
9
10
|
export declare function getIngestCachePath(): string;
|
|
11
|
+
export declare class IngestRefused extends Error {
|
|
12
|
+
readonly status: number;
|
|
13
|
+
readonly code: string;
|
|
14
|
+
readonly reason: string;
|
|
15
|
+
constructor(status: number, code: string, reason?: string);
|
|
16
|
+
}
|
|
17
|
+
export declare function postIngest(cloud: ActiveEconomyCloudStorage, body: Record<string, Array<Record<string, unknown>>>): Promise<{
|
|
18
|
+
ingested: Record<string, number>;
|
|
19
|
+
total: number;
|
|
20
|
+
receipts: IngestBatchReceipt[];
|
|
21
|
+
}>;
|
|
10
22
|
/**
|
|
11
23
|
* Push every ingest-table row a scratch store holds to the shared API. The
|
|
12
24
|
* economy-otel sidecar uses this in hosted mode: same readers, same
|
|
@@ -16,6 +28,7 @@ export declare function pushIngestRows(cloud: ActiveEconomyCloudStorage, scratch
|
|
|
16
28
|
posted: boolean;
|
|
17
29
|
ingested: Record<string, number>;
|
|
18
30
|
total: number;
|
|
31
|
+
receipts: IngestBatchReceipt[];
|
|
19
32
|
}>;
|
|
20
33
|
export interface CloudSyncOptions extends SyncOptions {
|
|
21
34
|
/** Claude/Takumi JSONL root override (tests). */
|
|
@@ -36,6 +49,7 @@ export interface CloudSyncResult extends SyncAllResult {
|
|
|
36
49
|
ingested?: Record<string, number>;
|
|
37
50
|
/** Total rows accepted by /v1/ingest (absent when nothing posted). */
|
|
38
51
|
total?: number;
|
|
52
|
+
receipts?: IngestBatchReceipt[];
|
|
39
53
|
}
|
|
40
54
|
/**
|
|
41
55
|
* Cloud-client equivalent of `economy sync`: read this machine's on-box
|
|
@@ -62,6 +76,7 @@ export interface CloudBillingSyncResult {
|
|
|
62
76
|
posted: boolean;
|
|
63
77
|
ingested?: Record<string, number>;
|
|
64
78
|
total?: number;
|
|
79
|
+
receipts?: IngestBatchReceipt[];
|
|
65
80
|
}
|
|
66
81
|
/**
|
|
67
82
|
* Cloud-client equivalent of `economy billing sync`: fetch provider billing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-ingest.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-ingest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-ingest.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-ingest.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAqC,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAUhG;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAqED,qBAAa,aAAc,SAAQ,KAAK;IAC1B,QAAQ,CAAC,MAAM,EAAC,MAAM;IAAC,QAAQ,CAAC,IAAI,EAAC,MAAM;IAAC,QAAQ,CAAC,MAAM;gBAAlD,MAAM,EAAC,MAAM,EAAU,IAAI,EAAC,MAAM,EAAU,MAAM,SAAK;CAC7E;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,yBAAyB,EAChC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,GACnD,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAAC,CAqE9F;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,yBAAyB,EAChC,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MA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C5F,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAChC;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,yBAAyB,EAAE,IAAI,GAAE,uBAA4B,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAkC9I"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-storage.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloud-storage.d.ts","sourceRoot":"","sources":["../../src/lib/cloud-storage.ts"],"names":[],"mappings":"AAyCA,OAAO,EAIL,qBAAqB,EAMrB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA4B,KAAK,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAEzE,mEAAmE;AACnE,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC;;;;GAIG;AACH,MAAM,MAAM,6BAA6B,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,MAAM,MAAM,mBAAmB,GAC3B;IACE,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;CACrC,GACD;IACE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB,CAAC;AAEN;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,mDAAoD,CAAC;AAc3F;;;;GAIG;AACH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,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,gFAAgF;IAChF,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC7B,oFAAoF;IACpF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC5C,0EAA0E;IAC1E,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,SAAS,CAAC,EAAE,6BAA6B,GACxC,sBAAsB,CA2CxB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IngestBatch {
|
|
2
|
+
schema_version: 1;
|
|
3
|
+
idempotency_key: string;
|
|
4
|
+
[table: string]: unknown;
|
|
5
|
+
}
|
|
6
|
+
/** Stable table/PK order produces repeatable keys for the exact same staged
|
|
7
|
+
* observations. Each bounded command commits independently; there is no hidden
|
|
8
|
+
* retry or claim that a whole multi-command scan is a single transaction. */
|
|
9
|
+
export declare function ingestBatches(body: Record<string, Record<string, unknown>[]>): Generator<IngestBatch>;
|
|
10
|
+
export interface IngestBatchReceipt {
|
|
11
|
+
idempotency_key: string;
|
|
12
|
+
operation_key?: string;
|
|
13
|
+
replayed: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare class IngestBatchFailure extends Error {
|
|
16
|
+
readonly pending_key: string;
|
|
17
|
+
readonly completed: IngestBatchReceipt[];
|
|
18
|
+
readonly pending_command: IngestBatch;
|
|
19
|
+
constructor(pending_key: string, completed: IngestBatchReceipt[], pending_command: IngestBatch);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=ingest-batches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest-batches.d.ts","sourceRoot":"","sources":["../../src/lib/ingest-batches.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,CAAC,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;CACzB;AACD;;6EAE6E;AAC7E,wBAAiB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,WAAW,CAAC,CA2BtG;AAED,MAAM,WAAW,kBAAkB;IAAG,eAAe,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE;AAC1G,qBAAa,kBAAmB,SAAQ,KAAK;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM;IAAE,QAAQ,CAAC,SAAS,EAAE,kBAAkB,EAAE;IAAE,QAAQ,CAAC,eAAe,EAAE,WAAW;gBAApG,WAAW,EAAE,MAAM,EAAW,SAAS,EAAE,kBAAkB,EAAE,EAAW,eAAe,EAAE,WAAW;CAI1H"}
|