@hasna/todos 0.15.28 → 0.15.29

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.
@@ -70,7 +70,7 @@ var package_default;
70
70
  var init_package = __esm(() => {
71
71
  package_default = {
72
72
  name: "@hasna/todos",
73
- version: "0.15.28",
73
+ version: "0.15.29",
74
74
  description: "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
75
75
  type: "module",
76
76
  main: "dist/index.js",
@@ -6612,6 +6612,12 @@ function sqliteTodosProjectRegistrationSchemaSql() {
6612
6612
  authority_id, tenant_id, corpus_id, operation_id, step_id,
6613
6613
  resource_kind, direction, idempotency_key
6614
6614
  );
6615
+ CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_source_identity
6616
+ ON todos_project_registration_receipts (
6617
+ authority_id, tenant_id, corpus_id, route, package_version,
6618
+ operation_id, step_id, resource_kind, direction, idempotency_key,
6619
+ target_selector
6620
+ );
6615
6621
  CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_step
6616
6622
  ON todos_project_registration_receipts (
6617
6623
  authority_id, tenant_id, corpus_id, operation_id, step_id,
@@ -6711,6 +6717,12 @@ function postgresTodosProjectRegistrationSchemaSql() {
6711
6717
  authority_id, tenant_id, corpus_id, operation_id, step_id,
6712
6718
  resource_kind, direction, idempotency_key
6713
6719
  )`,
6720
+ `CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_source_identity_idx
6721
+ ON todos_project_registration_receipts (
6722
+ authority_id, tenant_id, corpus_id, route, package_version,
6723
+ operation_id, step_id, resource_kind, direction, idempotency_key,
6724
+ target_selector
6725
+ )`,
6714
6726
  `CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_step_idx
6715
6727
  ON todos_project_registration_receipts (
6716
6728
  authority_id, tenant_id, corpus_id, operation_id, step_id,
@@ -6852,8 +6864,9 @@ class PostgresTodosProjectRegistrationTransaction {
6852
6864
  const result = await this.client.query(`
6853
6865
  SELECT * FROM todos_project_registration_receipts
6854
6866
  WHERE authority_id = $1 AND tenant_id = $2 AND corpus_id = $3
6855
- AND operation_id = $4 AND step_id = $5 AND resource_kind = $6
6856
- AND direction = $7 AND idempotency_key = $8 AND target_selector = $9
6867
+ AND route = $4 AND package_version = $5
6868
+ AND operation_id = $6 AND step_id = $7 AND resource_kind = $8
6869
+ AND direction = $9 AND idempotency_key = $10 AND target_selector = $11
6857
6870
  ORDER BY CASE outcome
6858
6871
  WHEN 'terminal_nonacceptance' THEN 0
6859
6872
  WHEN 'duplicate_of_accepted' THEN 1
@@ -6864,6 +6877,8 @@ class PostgresTodosProjectRegistrationTransaction {
6864
6877
  identity.authority_id,
6865
6878
  identity.tenant_id,
6866
6879
  identity.corpus_id,
6880
+ identity.route,
6881
+ identity.package_version,
6867
6882
  identity.operation_id,
6868
6883
  identity.step_id,
6869
6884
  identity.resource_kind,
@@ -20463,6 +20478,7 @@ class SqliteTodosProjectRegistrationTransaction {
20463
20478
  const row = this.db.query(`
20464
20479
  SELECT * FROM todos_project_registration_receipts
20465
20480
  WHERE authority_id = ? AND tenant_id = ? AND corpus_id = ?
20481
+ AND route = ? AND package_version = ?
20466
20482
  AND operation_id = ? AND step_id = ? AND resource_kind = ?
20467
20483
  AND direction = ? AND idempotency_key = ? AND target_selector = ?
20468
20484
  ORDER BY CASE outcome
@@ -20471,7 +20487,7 @@ class SqliteTodosProjectRegistrationTransaction {
20471
20487
  ELSE 2
20472
20488
  END, created_at DESC, receipt_id DESC
20473
20489
  LIMIT 1
20474
- `).get(identity.authority_id, identity.tenant_id, identity.corpus_id, identity.operation_id, identity.step_id, identity.resource_kind, identity.direction, identity.idempotency_key, identity.target_selector);
20490
+ `).get(identity.authority_id, identity.tenant_id, identity.corpus_id, identity.route, identity.package_version, identity.operation_id, identity.step_id, identity.resource_kind, identity.direction, identity.idempotency_key, identity.target_selector);
20475
20491
  return row ? receiptFromRow2(row) : null;
20476
20492
  }
20477
20493
  async getReceiptById(receiptId) {
@@ -20625,7 +20641,7 @@ class StagedSqliteTodosProjectRegistrationTransaction {
20625
20641
  }
20626
20642
  async lockStep(_identity) {}
20627
20643
  async getReceiptForLookup(identity) {
20628
- const staged = [...this.receipts.values()].filter((receipt) => receipt.authority_id === identity.authority_id && receipt.tenant_id === identity.tenant_id && receipt.corpus_id === identity.corpus_id && receipt.operation_id === identity.operation_id && receipt.step_id === identity.step_id && receipt.resource_kind === identity.resource_kind && receipt.direction === identity.direction && receipt.idempotency_key === identity.idempotency_key && receipt.target_selector === identity.target_selector);
20644
+ const staged = [...this.receipts.values()].filter((receipt) => receipt.authority_id === identity.authority_id && receipt.tenant_id === identity.tenant_id && receipt.corpus_id === identity.corpus_id && receipt.route === identity.route && receipt.package_version === identity.package_version && receipt.operation_id === identity.operation_id && receipt.step_id === identity.step_id && receipt.resource_kind === identity.resource_kind && receipt.direction === identity.direction && receipt.idempotency_key === identity.idempotency_key && receipt.target_selector === identity.target_selector);
20629
20645
  const stored = await this.direct.getReceiptForLookup(identity);
20630
20646
  if (stored)
20631
20647
  staged.push(stored);
@@ -21460,6 +21476,8 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21460
21476
  async existingForwardResolution(transaction, request, callDigest) {
21461
21477
  const exact = await transaction.getReceiptForLookup({
21462
21478
  ...authorityScope(this.capabilityValue),
21479
+ route: this.capabilityValue.route,
21480
+ package_version: this.capabilityValue.package_version,
21463
21481
  operation_id: request.operation_id,
21464
21482
  step_id: request.step_id,
21465
21483
  resource_kind: request.resource_kind,
@@ -21612,6 +21630,8 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21612
21630
  });
21613
21631
  const exact = await transaction.getReceiptForLookup({
21614
21632
  ...authorityScope(this.capabilityValue),
21633
+ route: this.capabilityValue.route,
21634
+ package_version: this.capabilityValue.package_version,
21615
21635
  operation_id: request.operation_id,
21616
21636
  step_id: request.step_id,
21617
21637
  resource_kind: request.resource_kind,
@@ -21662,9 +21682,18 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21662
21682
  if (request.max_items !== 1) {
21663
21683
  throw new TodosProjectRegistrationError("TODOS_PROJECT_REGISTRATION_INVALID_BOUNDS", "max_items must be exactly 1 for terminal receipt lookup");
21664
21684
  }
21665
- if (request.authority !== "todos" || request.authority_route !== this.capabilityValue.route || request.package_version !== this.capabilityValue.package_version || request.authority_id !== this.capabilityValue.authority_id || request.tenant_id !== this.capabilityValue.tenant_id || request.corpus_id !== this.capabilityValue.corpus_id) {
21685
+ if (request.authority !== "todos" || request.authority_id !== this.capabilityValue.authority_id || request.tenant_id !== this.capabilityValue.tenant_id || request.corpus_id !== this.capabilityValue.corpus_id) {
21666
21686
  throw new TodosProjectRegistrationError("TODOS_PROJECT_REGISTRATION_CAPABILITY_MISMATCH", "receipt lookup does not match this authority capability identity");
21667
21687
  }
21688
+ requireString(request.authority_route, "authority_route", {
21689
+ min: 3,
21690
+ max: 128,
21691
+ pattern: AUTHORITY_ROUTE_PATTERN
21692
+ });
21693
+ requireString(request.package_version, "package_version", {
21694
+ max: 128,
21695
+ pattern: PACKAGE_VERSION_PATTERN
21696
+ });
21668
21697
  requireString(request.operation_id, "operation_id", {
21669
21698
  min: 8,
21670
21699
  max: 128,
@@ -21686,6 +21715,8 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21686
21715
  }
21687
21716
  const receipt = await this.backend.getReceiptForLookup({
21688
21717
  ...authorityScope(this.capabilityValue),
21718
+ route: request.authority_route,
21719
+ package_version: request.package_version,
21689
21720
  operation_id: request.operation_id,
21690
21721
  step_id: request.step_id,
21691
21722
  resource_kind: request.resource_kind,
@@ -21724,6 +21755,8 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21724
21755
  });
21725
21756
  const exact = await transaction.getReceiptForLookup({
21726
21757
  ...authorityScope(this.capabilityValue),
21758
+ route: this.capabilityValue.route,
21759
+ package_version: this.capabilityValue.package_version,
21727
21760
  operation_id: request.operation_id,
21728
21761
  step_id: request.step_id,
21729
21762
  resource_kind: request.resource_kind,
@@ -21818,6 +21851,8 @@ class PackageOwnedTodosProjectRegistrationAuthority {
21818
21851
  await this.storedAcceptedReceipt(request, accepted);
21819
21852
  const receipt = await this.backend.getReceiptForLookup({
21820
21853
  ...authorityScope(this.capabilityValue),
21854
+ route: this.capabilityValue.route,
21855
+ package_version: this.capabilityValue.package_version,
21821
21856
  operation_id: request.operation_id,
21822
21857
  step_id: request.step_id,
21823
21858
  resource_kind: request.resource_kind,
@@ -21862,7 +21897,7 @@ function createPostgresTodosProjectRegistrationAuthority(client, options = {}) {
21862
21897
  cursorTableName
21863
21898
  }), authorityOptions);
21864
21899
  }
21865
- var UUID_PATTERN, WORKSPACE_ID_PATTERN, OPERATION_PATTERN, STEP_PATTERN, SHA256_PATTERN, IDEMPOTENCY_PATTERN, WriteBoundaryError;
21900
+ var UUID_PATTERN, WORKSPACE_ID_PATTERN, OPERATION_PATTERN, STEP_PATTERN, AUTHORITY_ROUTE_PATTERN, PACKAGE_VERSION_PATTERN, SHA256_PATTERN, IDEMPOTENCY_PATTERN, WriteBoundaryError;
21866
21901
  var init_authority = __esm(() => {
21867
21902
  init_package_version();
21868
21903
  init_postgres2();
@@ -21872,6 +21907,8 @@ var init_authority = __esm(() => {
21872
21907
  WORKSPACE_ID_PATTERN = /^wks_[A-Za-z0-9][A-Za-z0-9_-]{11,}$/;
21873
21908
  OPERATION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$/;
21874
21909
  STEP_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{2,127}$/;
21910
+ AUTHORITY_ROUTE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:-]{2,127}$/;
21911
+ PACKAGE_VERSION_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
21875
21912
  SHA256_PATTERN = /^[0-9a-f]{64}$/;
21876
21913
  IDEMPOTENCY_PATTERN = /^prk_[0-9a-f]{48}$/;
21877
21914
  WriteBoundaryError = class WriteBoundaryError extends Error {
package/dist/storage.js CHANGED
@@ -520,6 +520,12 @@ function sqliteTodosProjectRegistrationSchemaSql() {
520
520
  authority_id, tenant_id, corpus_id, operation_id, step_id,
521
521
  resource_kind, direction, idempotency_key
522
522
  );
523
+ CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_source_identity
524
+ ON todos_project_registration_receipts (
525
+ authority_id, tenant_id, corpus_id, route, package_version,
526
+ operation_id, step_id, resource_kind, direction, idempotency_key,
527
+ target_selector
528
+ );
523
529
  CREATE INDEX IF NOT EXISTS idx_todos_project_registration_receipts_step
524
530
  ON todos_project_registration_receipts (
525
531
  authority_id, tenant_id, corpus_id, operation_id, step_id,
@@ -619,6 +625,12 @@ function postgresTodosProjectRegistrationSchemaSql() {
619
625
  authority_id, tenant_id, corpus_id, operation_id, step_id,
620
626
  resource_kind, direction, idempotency_key
621
627
  )`,
628
+ `CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_source_identity_idx
629
+ ON todos_project_registration_receipts (
630
+ authority_id, tenant_id, corpus_id, route, package_version,
631
+ operation_id, step_id, resource_kind, direction, idempotency_key,
632
+ target_selector
633
+ )`,
622
634
  `CREATE INDEX IF NOT EXISTS todos_project_registration_receipts_step_idx
623
635
  ON todos_project_registration_receipts (
624
636
  authority_id, tenant_id, corpus_id, operation_id, step_id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/todos",
3
- "version": "0.15.28",
3
+ "version": "0.15.29",
4
4
  "description": "Universal task management for AI coding agents - CLI + MCP server + interactive TUI",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",