@conarium-ai/core 0.2.11 → 0.2.13

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.
Files changed (136) hide show
  1. package/CHANGELOG.md +149 -1
  2. package/LICENSE +21 -21
  3. package/LIMITATIONS.md +36 -2
  4. package/LIMITATIONS.tr.md +25 -2
  5. package/SECURITY.md +1 -0
  6. package/bin/conarium-coverage.mjs +89 -6
  7. package/bin/conarium-doctor.mjs +62 -0
  8. package/bin/conarium-verify.mjs +110 -51
  9. package/dist/anchor.d.ts +11 -0
  10. package/dist/anchor.d.ts.map +1 -1
  11. package/dist/anchor.js +27 -0
  12. package/dist/anchor.js.map +1 -1
  13. package/dist/audit.d.ts +4 -0
  14. package/dist/audit.d.ts.map +1 -1
  15. package/dist/audit.js +136 -33
  16. package/dist/audit.js.map +1 -1
  17. package/dist/config.d.ts +28 -8
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +51 -1
  20. package/dist/config.js.map +1 -1
  21. package/dist/connectors/custom-sql.d.ts +22 -0
  22. package/dist/connectors/custom-sql.d.ts.map +1 -0
  23. package/dist/connectors/custom-sql.js +67 -0
  24. package/dist/connectors/custom-sql.js.map +1 -0
  25. package/dist/connectors/index.d.ts +1 -0
  26. package/dist/connectors/index.d.ts.map +1 -1
  27. package/dist/connectors/index.js +5 -1
  28. package/dist/connectors/index.js.map +1 -1
  29. package/dist/connectors/openapi.d.ts +14 -1
  30. package/dist/connectors/openapi.d.ts.map +1 -1
  31. package/dist/connectors/openapi.js +78 -6
  32. package/dist/connectors/openapi.js.map +1 -1
  33. package/dist/connectors/postgres.js +8 -8
  34. package/dist/connectors/supabase_rest.d.ts.map +1 -1
  35. package/dist/connectors/supabase_rest.js +0 -1
  36. package/dist/connectors/supabase_rest.js.map +1 -1
  37. package/dist/console-receipts.d.ts +12 -1
  38. package/dist/console-receipts.d.ts.map +1 -1
  39. package/dist/console-receipts.js +14 -2
  40. package/dist/console-receipts.js.map +1 -1
  41. package/dist/console.d.ts.map +1 -1
  42. package/dist/console.js +15 -4
  43. package/dist/console.js.map +1 -1
  44. package/dist/coverage.d.ts +17 -1
  45. package/dist/coverage.d.ts.map +1 -1
  46. package/dist/coverage.js +30 -3
  47. package/dist/coverage.js.map +1 -1
  48. package/dist/digit_pii.d.ts.map +1 -1
  49. package/dist/digit_pii.js +24 -5
  50. package/dist/digit_pii.js.map +1 -1
  51. package/dist/executor.d.ts.map +1 -1
  52. package/dist/executor.js +0 -1
  53. package/dist/executor.js.map +1 -1
  54. package/dist/governance.d.ts +2 -0
  55. package/dist/governance.d.ts.map +1 -1
  56. package/dist/governance.js +23 -8
  57. package/dist/governance.js.map +1 -1
  58. package/dist/http.d.ts +11 -1
  59. package/dist/http.d.ts.map +1 -1
  60. package/dist/http.js +87 -7
  61. package/dist/http.js.map +1 -1
  62. package/dist/iban.d.ts.map +1 -1
  63. package/dist/iban.js +6 -3
  64. package/dist/iban.js.map +1 -1
  65. package/dist/index.js +1 -0
  66. package/dist/index.js.map +1 -1
  67. package/dist/keys.d.ts +5 -0
  68. package/dist/keys.d.ts.map +1 -1
  69. package/dist/keys.js +22 -7
  70. package/dist/keys.js.map +1 -1
  71. package/dist/mask-text.d.ts +11 -0
  72. package/dist/mask-text.d.ts.map +1 -0
  73. package/dist/mask-text.js +42 -0
  74. package/dist/mask-text.js.map +1 -0
  75. package/dist/receipt-view.d.ts +13 -0
  76. package/dist/receipt-view.d.ts.map +1 -1
  77. package/dist/receipt-view.js +28 -5
  78. package/dist/receipt-view.js.map +1 -1
  79. package/dist/search_policy.d.ts.map +1 -1
  80. package/dist/search_policy.js +8 -4
  81. package/dist/search_policy.js.map +1 -1
  82. package/dist/server.d.ts.map +1 -1
  83. package/dist/server.js +111 -20
  84. package/dist/server.js.map +1 -1
  85. package/dist/sql-executor.d.ts +14 -0
  86. package/dist/sql-executor.d.ts.map +1 -0
  87. package/dist/sql-executor.js +75 -0
  88. package/dist/sql-executor.js.map +1 -0
  89. package/dist/sql-gate/mssql.d.ts.map +1 -1
  90. package/dist/sql-gate/mssql.js +36 -2
  91. package/dist/sql-gate/mssql.js.map +1 -1
  92. package/dist/sql-gate/oracle.d.ts.map +1 -1
  93. package/dist/sql-gate/oracle.js +24 -3
  94. package/dist/sql-gate/oracle.js.map +1 -1
  95. package/dist/sql-gate/rules.d.ts +19 -1
  96. package/dist/sql-gate/rules.d.ts.map +1 -1
  97. package/dist/sql-gate/rules.js +116 -7
  98. package/dist/sql-gate/rules.js.map +1 -1
  99. package/dist/table-unavailable.d.ts +12 -0
  100. package/dist/table-unavailable.d.ts.map +1 -0
  101. package/dist/table-unavailable.js +32 -0
  102. package/dist/table-unavailable.js.map +1 -0
  103. package/dist/types.d.ts +10 -3
  104. package/dist/types.d.ts.map +1 -1
  105. package/docs/API-STABILITY.md +4 -4
  106. package/docs/ARCHITECTURE.md +42 -42
  107. package/docs/BENCHMARK.md +20 -0
  108. package/docs/RECEIPT-SPEC.md +17 -11
  109. package/docs/benchmarks/concurrency-20260814.json +38 -0
  110. package/docs/plans/2026-07-02-redteam-harness.md +416 -416
  111. package/docs/security/NPM-PROVENANCE.md +64 -0
  112. package/docs/security/THREAT-MODEL.md +18 -0
  113. package/docs/specs/2026-07-02-redteam-harness-design.md +90 -90
  114. package/docs/superpowers/TODO-gate1-f4.md +23 -23
  115. package/docs/superpowers/plans/2026-07-29-conarium-receipt-plan.md +200 -200
  116. package/docs/superpowers/specs/2026-07-29-conarium-receipt-design.md +202 -202
  117. package/examples/claude-desktop-config.json +9 -9
  118. package/examples/cursor-mcp-settings.json +10 -10
  119. package/examples/custom-sql/README.md +50 -0
  120. package/examples/custom-sql/conarium.config.json +22 -0
  121. package/examples/custom-sql/memory-executor.mjs +16 -0
  122. package/package.json +8 -4
  123. package/public/app.js +378 -378
  124. package/public/index.html +160 -160
  125. package/public/style.css +504 -504
  126. package/scripts/benchmark-concurrency.mjs +133 -0
  127. package/scripts/conarium_sabah_brief.mjs +107 -107
  128. package/scripts/start-mcp-c1.mjs +93 -93
  129. package/test-vectors/sql-gate/LAST-RUN.json +1 -1
  130. package/test-vectors/sql-gate/vectors.json +28 -0
  131. package/dist/openapi_connector.d.ts +0 -6
  132. package/dist/openapi_connector.d.ts.map +0 -1
  133. package/dist/openapi_connector.js +0 -145
  134. package/dist/openapi_connector.js.map +0 -1
  135. package/docs/audit/2026-08-14-security-scan.md +0 -48
  136. package/docs/audit/2026-08-14-surface-sync.md +0 -34
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../src/sql-gate/rules.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS;IAC1E,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS;CACzD,CAAA;AAEV,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,KAAK;IACL,KAAK;IACL,OAAO;IACP,MAAM;IACN,SAAS;IACT,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,YAAY;IACZ,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,QAAQ;IACR,cAAc;IACd,gBAAgB;IAChB,uBAAuB;IACvB,SAAS;IACT,OAAO;IACP,OAAO;IACP,YAAY;IACZ,KAAK;IACL,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,GAAG,CAAC;IAC5C,WAAW;IACX,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;CACb,CAAC,CAAA;AAEF,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,OAAO,IAAI,GAAG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CAAA;YAC/B,CAAC,IAAI,CAAC,CAAA;YACN,SAAQ;QACV,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAA;YACf,GAAG,IAAI,CAAC,CAAA;YACR,CAAC,IAAI,CAAC,CAAA;YACN,SAAQ;QACV,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,CAAC,IAAI,CAAC,CAAA;YACN,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;gBAAE,CAAC,IAAI,CAAC,CAAA;YACnE,GAAG,IAAI,GAAG,CAAA;YACV,SAAQ;QACV,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YAC3B,CAAC,IAAI,CAAC,CAAA;YACN,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,CAAC;gBAAE,CAAC,IAAI,CAAC,CAAA;YACxE,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM;gBAAE,CAAC,IAAI,CAAC,CAAA;YAC1B,GAAG,IAAI,GAAG,CAAA;YACV,SAAQ;QACV,CAAC;QACD,GAAG,IAAI,CAAC,CAAA;QACR,CAAC,IAAI,CAAC,CAAA;IACR,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Assistant-facing table errors must not distinguish "denied" from "missing".
3
+ * The audit log keeps the real reason. Timing is a residual side channel:
4
+ * a deny never reaches the connector (that stays); a missing table may.
5
+ */
6
+ export declare function tableUnavailableMessage(table: string): string;
7
+ export declare function tableUnavailableError(table: string): Error;
8
+ export declare function tableFromAccessDeny(message: string): string | undefined;
9
+ export declare function isMissingTableMessage(message: string): boolean;
10
+ /** After the real reason is in the audit log, rewrite the assistant error. */
11
+ export declare function publicizeTableError(err: unknown, fallbackTable?: string): never;
12
+ //# sourceMappingURL=table-unavailable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-unavailable.d.ts","sourceRoot":"","sources":["../src/table-unavailable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGvE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAI9D;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAW/E"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Assistant-facing table errors must not distinguish "denied" from "missing".
3
+ * The audit log keeps the real reason. Timing is a residual side channel:
4
+ * a deny never reaches the connector (that stays); a missing table may.
5
+ */
6
+ export function tableUnavailableMessage(table) {
7
+ return `Access to table '${table}' is not available.`;
8
+ }
9
+ export function tableUnavailableError(table) {
10
+ return new Error(tableUnavailableMessage(table));
11
+ }
12
+ export function tableFromAccessDeny(message) {
13
+ const m = message.match(/Access to table '([^']+)' is not permitted by policy/);
14
+ return m?.[1];
15
+ }
16
+ export function isMissingTableMessage(message) {
17
+ return /not found|does not exist|invalid object name|ora-00942|unknown table|unknown relation/i.test(message);
18
+ }
19
+ /** After the real reason is in the audit log, rewrite the assistant error. */
20
+ export function publicizeTableError(err, fallbackTable) {
21
+ const msg = err instanceof Error ? err.message : String(err);
22
+ const denied = tableFromAccessDeny(msg);
23
+ if (denied)
24
+ throw tableUnavailableError(denied);
25
+ if (isMissingTableMessage(msg)) {
26
+ const named = msg.match(/(?:table|relation)\s+(?:not found:\s*)?['"]?([a-zA-Z0-9_.]+)/i)?.[1] ??
27
+ fallbackTable;
28
+ throw tableUnavailableError(named ?? 'unknown');
29
+ }
30
+ throw err;
31
+ }
32
+ //# sourceMappingURL=table-unavailable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-unavailable.js","sourceRoot":"","sources":["../src/table-unavailable.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,OAAO,oBAAoB,KAAK,qBAAqB,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAa;IACjD,OAAO,IAAI,KAAK,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAA;IAC/E,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,OAAO,wFAAwF,CAAC,IAAI,CAClG,OAAO,CACR,CAAA;AACH,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,mBAAmB,CAAC,GAAY,EAAE,aAAsB;IACtE,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACvC,IAAI,MAAM;QAAE,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAA;IAC/C,IAAI,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,KAAK,GACT,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/E,aAAa,CAAA;QACf,MAAM,qBAAqB,CAAC,KAAK,IAAI,SAAS,CAAC,CAAA;IACjD,CAAC;IACD,MAAM,GAAG,CAAA;AACX,CAAC"}
package/dist/types.d.ts CHANGED
@@ -8,6 +8,12 @@ export interface ConariumConfig {
8
8
  policy?: GovernancePolicy;
9
9
  /** Audit configuration. */
10
10
  audit?: AuditConfig;
11
+ /**
12
+ * Proof profile. `production` requires Ed25519 AND HMAC, turns G3 strict
13
+ * signatures and anchoring on, and defaults HTTP rate-limit to 60/min
14
+ * unless CONARIUM_MCP_RATE_PER_MIN is explicitly 0.
15
+ */
16
+ profile?: 'production';
11
17
  }
12
18
  export interface GovernancePolicy {
13
19
  /** Allow-list of schema-qualified tables (glob: "billing.*", "*"). Missing or empty = deny all (default-deny). */
@@ -20,8 +26,9 @@ export interface GovernancePolicy {
20
26
  maxRows?: number;
21
27
  /**
22
28
  * Which SQL gate the shipped `query` tool uses. Operator declaration —
23
- * never inferred from the statement. Omitted = `postgres` (today's path).
24
- * Unknown values reject the config; they do not fall back.
29
+ * never inferred from the statement. Omitted = `postgres` (today's path)
30
+ * except when a `custom-sql` connector is present: that path requires an
31
+ * explicit dialect. Unknown values reject the config; they do not fall back.
25
32
  */
26
33
  dialect?: 'postgres' | 'mssql' | 'oracle';
27
34
  /**
@@ -133,7 +140,7 @@ export interface AuditConfig {
133
140
  };
134
141
  }
135
142
  export interface ConnectorConfig {
136
- type: 'postgres' | 'supabase' | 'supabase-rest' | 'openapi' | 'files' | 'docs' | 'slack' | 'jira';
143
+ type: 'postgres' | 'supabase' | 'supabase-rest' | 'openapi' | 'files' | 'docs' | 'slack' | 'jira' | 'custom-sql';
137
144
  name: string;
138
145
  description: string;
139
146
  config: Record<string, string>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;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,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IACpC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAClD,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;CAC/D"}
@@ -63,8 +63,8 @@ No dates. Shipping 1.0 is a decision, not a document.
63
63
  | `conarium` | `--config <path>` (default `conarium.config.json`) | experimental — stdio MCP entry |
64
64
  | `conarium-init` | `--out` `--force` `--no-keys` `--help` | experimental |
65
65
  | `conarium-doctor` | `--config` `--no-net` `--help` | experimental |
66
- | `conarium-verify` | `--pubkey` (repeatable) `--anchor-check` `--anchors` `--expect-seq-from` `--expect-count` `--expect-last-hash` `--json` `--help` | **candidate** (exit codes + flags in RECEIPT-SPEC) |
67
- | `conarium-coverage` | `--pubkey` `--receipts` `--allow-gaps` `--json` `--help` | experimental |
66
+ | `conarium-verify` | `--pubkey` (repeatable) `--anchor-check` `--require-head-anchor` `--anchors` `--expect-seq-from` `--expect-count` `--expect-last-hash` `--strict` `--json` `--help` | **candidate** (exit codes + flags in RECEIPT-SPEC) |
67
+ | `conarium-coverage` | `--pubkey` `--receipts` `--expect-seq-from` `--allow-gaps` `--json` `--help` | experimental |
68
68
  | `conarium-reconcile` | `--before` `--after` `--receipts` `--json` `--help` | experimental |
69
69
  | `conarium-stamp` | `--sidecar` `--json` `--help` | experimental |
70
70
  | `conarium-anchor-upgrade` | `<anchors.jsonl>` | experimental |
@@ -82,11 +82,11 @@ Parsed by `src/config.ts` (Zod `.strict()`). Unknown keys reject the file.
82
82
  | Field | Label |
83
83
  |---|---|
84
84
  | `connectors[]` (`type`, `name`, `description`, `config`) | experimental |
85
- | `connectors[].type` enum (`postgres`, `supabase`, `supabase-rest`, `openapi`, `files`, `docs`, `slack`, `jira`) | experimental — values can be added or removed |
85
+ | `connectors[].type` enum (`postgres`, `supabase`, `supabase-rest`, `openapi`, `files`, `docs`, `slack`, `jira`, `custom-sql`) | experimental — values can be added or removed |
86
86
  | `serverName` `serverVersion` `consumer` | experimental |
87
87
  | `policy.allowTables` `denyTables` | **candidate** (default-deny, deny wins) |
88
88
  | `policy.maskColumns` `maxRows` | experimental (cap ceiling is 10 000 at parse) |
89
- | `policy.dialect` (`postgres` omitted default, `mssql`, `oracle`) | experimental — unknown values reject the file; not inferred from SQL |
89
+ | `policy.dialect` (`postgres` omitted default, `mssql`, `oracle`) | experimental — unknown values reject the file; not inferred from SQL; required when a `custom-sql` connector is present |
90
90
  | `policy.allowConnectors` `denyConnectors` | experimental — empty allow is fail-closed |
91
91
  | `policy.allowTools` `denyTools` | experimental |
92
92
  | `policy.profiles` `actorProfiles` | experimental |
@@ -1,42 +1,42 @@
1
- # Conarium architecture
2
-
3
- ## Thesis
4
-
5
- MCP made "connect an AI assistant to your data" a commodity. The durable value is **not** the connection — it is everything an enterprise needs *around* the connection before it can safely let an AI read internal systems:
6
-
7
- 1. **Ingestion** of messy internal sources (schemas today; docs, ADRs, APIs next).
8
- 2. **Governance + audit** — what the AI may see, and a record of what it saw.
9
- 3. **Self-hosting** — data never leaves the customer's network.
10
- 4. **Freshness** — incremental re-index so context never goes stale.
11
-
12
- Conarium owns this layer and stays **tool-agnostic**: it speaks MCP, so it plugs into Cursor, Copilot, Claude Code, Windsurf, Continue.dev — whatever wins.
13
-
14
- ## Request path
15
-
16
- ```
17
- AI client ──MCP──▶ index.ts (tool dispatch)
18
- │
19
- ├─▶ Governance.allowsTable / guardQuery / maxRows / redact
20
- ├─▶ Audit.log(decision)
21
- └─▶ Connector (postgres | supabase | …) ──▶ source system
22
- ```
23
-
24
- Governance is enforced **before** the connector runs (table access, query shape) and **after** it returns (row cap, PII masking). Audit records the decision either way. A connector can never bypass the layer because the layer owns the tool handlers.
25
-
26
- ## Modules
27
-
28
- | File | Responsibility |
29
- |---|---|
30
- | `src/index.ts` | MCP server, tool dispatch, wires governance + audit around every call |
31
- | `src/governance.ts` | Policy: allow/deny tables, query guard, row caps, PII masking |
32
- | `src/audit.ts` | Append-only JSONL audit of every tool call |
33
- | `src/connectors/*` | Source adapters implementing the `Connector` interface |
34
- | `src/types.ts` | Config, policy, schema and result contracts |
35
-
36
- ## Connector contract
37
-
38
- A connector implements `listTables / describeTable / query / search`. It only knows how to *read a source*; it knows nothing about policy or audit. This keeps new connectors (docs, OpenAPI, Slack) cheap to add — they inherit governance for free.
39
-
40
- ## Design partner
41
-
42
- ZION is the first connector and reference deployment: a live ERP with real schemas, real business rules (e.g. "use `price2`, not `price3`"), and real governance needs (mask customer PII, deny accounting-internal tables). It validates the layer against a real company before selling it to others.
1
+ # Conarium architecture
2
+
3
+ ## Thesis
4
+
5
+ MCP made "connect an AI assistant to your data" a commodity. The durable value is **not** the connection — it is everything an enterprise needs *around* the connection before it can safely let an AI read internal systems:
6
+
7
+ 1. **Ingestion** of messy internal sources (schemas today; docs, ADRs, APIs next).
8
+ 2. **Governance + audit** — what the AI may see, and a record of what it saw.
9
+ 3. **Self-hosting** — data never leaves the customer's network.
10
+ 4. **Freshness** — incremental re-index so context never goes stale.
11
+
12
+ Conarium owns this layer and stays **tool-agnostic**: it speaks MCP, so it plugs into Cursor, Copilot, Claude Code, Windsurf, Continue.dev — whatever wins.
13
+
14
+ ## Request path
15
+
16
+ ```
17
+ AI client ──MCP──▶ index.ts (tool dispatch)
18
+ │
19
+ ├─▶ Governance.allowsTable / guardQuery / maxRows / redact
20
+ ├─▶ Audit.log(decision)
21
+ └─▶ Connector (postgres | supabase | …) ──▶ source system
22
+ ```
23
+
24
+ Governance is enforced **before** the connector runs (table access, query shape) and **after** it returns (row cap, PII masking). Audit records the decision either way. A connector can never bypass the layer because the layer owns the tool handlers.
25
+
26
+ ## Modules
27
+
28
+ | File | Responsibility |
29
+ |---|---|
30
+ | `src/index.ts` | MCP server, tool dispatch, wires governance + audit around every call |
31
+ | `src/governance.ts` | Policy: allow/deny tables, query guard, row caps, PII masking |
32
+ | `src/audit.ts` | Append-only JSONL audit of every tool call |
33
+ | `src/connectors/*` | Source adapters implementing the `Connector` interface |
34
+ | `src/types.ts` | Config, policy, schema and result contracts |
35
+
36
+ ## Connector contract
37
+
38
+ A connector implements `listTables / describeTable / query / search`. It only knows how to *read a source*; it knows nothing about policy or audit. This keeps new connectors (docs, OpenAPI, Slack) cheap to add — they inherit governance for free.
39
+
40
+ ## Design partner
41
+
42
+ ZION is the first connector and reference deployment: a live ERP with real schemas, real business rules (e.g. "use `price2`, not `price3`"), and real governance needs (mask customer PII, deny accounting-internal tables). It validates the layer against a real company before selling it to others.
package/docs/BENCHMARK.md CHANGED
@@ -122,3 +122,23 @@ Not a substitute for the table above. Shows the same cliff without a socket.
122
122
  100 is the last measured point still in the low-millisecond band
123
123
  (same-limit partial overhead p50 = 5.0 ms). 500 is already 87 ms.
124
124
  The doctor and `parseConariumConfig` warn. They do not reject the query.
125
+
126
+ ---
127
+
128
+ ## Concurrency (in-process, not Hetzner)
129
+
130
+ Replay: `node scripts/benchmark-concurrency.mjs` (needs `npm run build`).
131
+ Raw: [`benchmarks/concurrency-20260814.json`](benchmarks/concurrency-20260814.json).
132
+
133
+ | | |
134
+ |---|---|
135
+ | CPU | Intel Core Ultra 9 275HX × 24 |
136
+ | RAM | 32 GB |
137
+ | OS | win32 10.0.26200 |
138
+ | Node | v24.5.0 |
139
+ | N | 50 concurrent MCP `query` (mock connector) |
140
+ | When | 2026-08-14T18:19Z |
141
+
142
+ p50 **45.5 ms** · p95 **48.6 ms** · p99 **61.3 ms** · wall **98 ms** · error rate **0**.
143
+ Single `Audit` instance: 50 entries, **0** `prevHash` breaks (`log()` is synchronous).
144
+ This is not a leak hunt and not a two-process sink race.
@@ -92,14 +92,17 @@ merely *who* it is, and the coverage declaration's rule that absence is reported
92
92
  ## Verifier
93
93
 
94
94
  ```
95
- conarium-verify <file|dir> --pubkey <path> [--pubkey <path2>] [--anchor-check] [--expect-seq-from N] [--expect-count N] [--expect-last-hash sha256:…] [--json]
95
+ conarium-verify <file|dir> --pubkey <path> [--pubkey <path2>] [--anchor-check] [--require-head-anchor] [--expect-seq-from N] [--expect-count N] [--expect-last-hash sha256:…] [--strict] [--json]
96
96
  ```
97
97
 
98
98
  `--expect-count` / `--expect-last-hash` are **opt-in tail pins**. Without them,
99
99
  a chain that had its last receipts deleted still exits 0 — the remainder is a
100
- valid shorter chain. With them, a count or last-hash miss is exit **11** (same
100
+ valid shorter chain. An unpinned run prints one stderr note and, with `--json`,
101
+ `"tailPinned": false`. With a pin, a count or last-hash miss is exit **11** (same
101
102
  code as a `prevHash` break: the chain as presented is not the chain you pinned).
102
- Default behaviour and the exit-code list are unchanged.
103
+ `--strict` requires a tail pin (else exit 11) and, if `--expect-seq-from` is
104
+ omitted, pins the first receipt at seq 1. Default exit codes without `--strict`
105
+ are unchanged.
103
106
 
104
107
  | Exit | Meaning |
105
108
  |---|---|
@@ -108,7 +111,7 @@ Default behaviour and the exit-code list are unchanged.
108
111
  | 11 | `prevHash` break — deleted or inserted; also `--expect-count` / `--expect-last-hash` mismatch |
109
112
  | 12 | `seq` gap / non-increasing — missing or reordered |
110
113
  | 13 | Signature invalid / pubkey missing (fail-closed) |
111
- | 14 | Anchor missing/invalid under `--anchor-check` |
114
+ | 14 | Claimed anchor invalid under `--anchor-check`, or `--require-head-anchor` when the head is unanchored. `anchor:null` receipts are skipped (periodic anchoring). |
112
115
  | 15 | Anchor **could not be checked** — calendar unreachable, or the OpenTimestamps verifier is not installed. Deliberately distinct from 14: "I could not verify this" is not "this is invalid". The digest comparison is performed offline and still holds; only the timestamp attestation is unconfirmed. A verifier that collapsed the two would be asserting something it did not measure. |
113
116
  | 20 | Schema invalid |
114
117
 
@@ -150,7 +153,7 @@ your own key.
150
153
  ## Coverage declaration (one-sided)
151
154
 
152
155
  ```
153
- conarium-coverage <declaration.json> --pubkey <path> [--receipts <receipts.jsonl>] [--allow-gaps] [--json]
156
+ conarium-coverage <declaration.json> --pubkey <path> [--receipts <receipts.jsonl>] [--expect-seq-from N] [--allow-gaps] [--json]
154
157
  ```
155
158
 
156
159
  A signed declaration over a period and the declared scope (`policy.allowTables`):
@@ -160,9 +163,9 @@ occurred"** — an absent record is ambiguous by nature.
160
163
 
161
164
  | Exit | Meaning |
162
165
  |---|---|
163
- | 0 | Declaration signature valid (+ consistent with receipts if given), chain contiguous |
164
- | 12 | Chain has gaps — coverage incomplete (`--allow-gaps` verifies authenticity only) |
165
- | 13 | Signature invalid / pubkey missing (fail-closed) |
166
+ | 0 | Declaration signature valid (+ consistent with receipts if given), chain contiguous. Unpinned window start is printed, not a silent complete. |
167
+ | 12 | Chain has gaps — coverage incomplete (`--allow-gaps` verifies authenticity only); also `--expect-seq-from` miss |
168
+ | 13 | Signature invalid / pubkey missing (fail-closed); also a receipt Ed25519 failure under `--receipts` |
166
169
  | 20 | Schema invalid |
167
170
  | 30 | Inconsistent with the receipts file |
168
171
 
@@ -260,7 +263,7 @@ revision history is itself timestamped.
260
263
  1. **`actor` is a service identity unless per-user tokens are configured.** With a token file (`CONARIUM_TOKENS_FILE`, default `conarium.tokens.json`), the audit line and the receipt name the individual and set `assurance: "per-user-token"`. Without it the actor is the connecting service, with `assurance: "shared-token"`. This is an operator-managed token map — **not** OAuth or SSO; there is no identity-provider integration, so the assurance is only as good as the operator's token hygiene. For shared-token deployments, marketing must not claim "who accessed".
261
264
  2. **Bypass detection — addressed as of reconcile v0.1, with stated limits.** Disabling Conarium and reading the DB directly still produces no receipt — no gateway can prevent that from inside. What changed: absence is now *checkable from both sides*. One-sided: `conarium-coverage` emits a signed declaration (chain contiguity + which declared objects have recorded access). Two-sided: `conarium-reconcile` compares the database's own per-role query counters against the in-window receipts and reports any DB-recorded pattern no receipt covers (see §Reconciliation). Remaining limits, stated: reconciliation trusts the DB's own counters (an attacker who can falsify `pg_stat_statements` is out of scope), requires a dedicated DB role per gateway instance, and matches per pattern/table — never per call count. **The language rule stands: "access NOT RECORDED", never "no access occurred."**
262
265
  3. **Creation-time truth is not proven.** Without hardware attestation, an operator can still write false-but-well-formed receipts *before* anchoring.
263
- 4. **In-file `sig` stripping + HMAC/`anchor` reduction.** Content `hash` is computed with `{hash, sig, anchor}` (and audit `signature`/`sig`) excluded, so an operator who controls the file can drop or thin those fields without invalidating the content hash itself. Contiguity and the trust store catch some boot-time cases, but full protection against in-file strip/reduce games is **not solvable in-file** (*in-file çözülemez*) — it needs an external transparency-log anchor and/or out-of-band key ceremony. **Mitigation available today, measured:** keep `CONARIUM_AUDIT_HMAC_KEY` enabled alongside Ed25519. HMAC is keyed, so an actor who strips `sig` and recomputes the unkeyed hashes still fails the HMAC check (`entry signature mismatch`). Verified by test: Ed25519 alone → strip-all passes the boot check; Ed25519 + HMAC → caught. `conarium-verify --pubkey` also catches it (exit 13, `missing sig`) because it is told to expect signatures. **Anchor is available** (`CONARIUM_ANCHOR_SINK=opentimestamps`) but starts as `pending` — Bitcoin finality is delayed (hours); see §Anchoring.
266
+ 4. **In-file `sig` stripping + HMAC/`anchor` reduction.** Content `hash` is computed with `{hash, sig, anchor}` (and audit `signature`/`sig`) excluded, so an operator who controls the file can drop or thin those fields without invalidating the content hash itself. Contiguity and the trust store catch some boot-time cases, but full protection against in-file strip/reduce games is **not solvable in-file** (*in-file çözülemez*) — it needs an external transparency-log anchor and/or out-of-band key ceremony. **Opt-in strict boot (G3):** `CONARIUM_AUDIT_REQUIRE_SIG=1` rejects a chain with any unsigned line when a signing key is configured; the default stays the 08-05 compatibility open. **Mitigation available today, measured:** keep `CONARIUM_AUDIT_HMAC_KEY` enabled alongside Ed25519. HMAC is keyed, so an actor who strips `sig` and recomputes the unkeyed hashes still fails the HMAC check (`entry signature mismatch`). Verified by test: Ed25519 alone → strip-all passes the boot check; Ed25519 + HMAC → caught. `conarium-verify --pubkey` also catches it (exit 13, `missing sig`) because it is told to expect signatures. **Anchor is available** (`CONARIUM_ANCHOR_SINK=opentimestamps`) but starts as `pending` — Bitcoin finality is delayed (hours); see §Anchoring.
264
267
  5. **`argsHash` hurts debugging.** Support cases need the customer's own logs to correlate.
265
268
  6. **Tail truncation is invisible to `conarium-verify` unless pinned.** Deleting the last N receipts leaves a consistent leftover chain (exit 0). `--expect-count` / `--expect-last-hash` exist for operators who have an external length or last-hash; they are opt-in so a verifier that saw the same file yesterday still exits 0 today. Anchoring the head, or `conarium-reconcile` against the database's own counters, are the other pins.
266
269
 
@@ -286,8 +289,11 @@ chain, not hash calendars.
286
289
  implementation; institutional buyers may prefer it, but it requires trusting a TSA.
287
290
 
288
291
  **Honest latency:** “not backdated” becomes Bitcoin-hard only after upgrade. Pending
289
- is disclosed — `conarium-verify --anchor-check` exits 0 with a stderr warning while
290
- pending, and exits 14 if the proof is missing or does not match the hash.
292
+ is disclosed — `conarium-verify --anchor-check` skips `anchor:null` (periodic
293
+ anchoring), exits 0 with a stderr warning while pending, and exits 14 if a
294
+ *claimed* anchor's proof is missing or does not match the hash. The run prints
295
+ `N/M anchored, head anchored: yes/no`. `--require-head-anchor` exits 14 when
296
+ the chain head is unanchored.
291
297
 
292
298
  **Manual dogfood — done 31 July 2026.** A real stamp was submitted, not simulated.
293
299
  The proof is committed at `docs/dogfood/2026-07-31-anchor.anchors.jsonl` so anyone can
@@ -0,0 +1,38 @@
1
+ {
2
+ "when": "2026-08-14T18:19:21.122Z",
3
+ "hardware": {
4
+ "cpu": "Intel(R) Core(TM) Ultra 9 275HX",
5
+ "cores": 24,
6
+ "ramBytes": 33752997888,
7
+ "os": "win32 10.0.26200",
8
+ "node": "v24.5.0"
9
+ },
10
+ "n": 50,
11
+ "wallMs": 98,
12
+ "latencyMs": {
13
+ "p50": 45.5191,
14
+ "p95": 48.5808,
15
+ "p99": 61.335,
16
+ "min": 41.8328,
17
+ "max": 61.335
18
+ },
19
+ "errorRate": 0,
20
+ "chain": {
21
+ "entries": 50,
22
+ "prevHashBreaks": []
23
+ },
24
+ "twoInstanceRace": {
25
+ "entries": 2,
26
+ "prevHashBreaks": []
27
+ },
28
+ "heap": {
29
+ "heapUsed0": 25426680,
30
+ "heapUsed1": 35596152,
31
+ "delta": 10169472
32
+ },
33
+ "hugeSql": {
34
+ "isError": false,
35
+ "preview": "{\n \"rowCount\": 1,\n \"fields\": [\n \"id\",\n \"email\"\n ],\n \"rows\": [\n {\n \"id\": 1,\n \"email\": \"[MASKED_PII"
36
+ },
37
+ "elapsedNs": 121576800
38
+ }