@lucern/contracts 0.3.0-alpha.3 → 0.3.0-alpha.4

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 (110) hide show
  1. package/dist/component-host-boundary.contract.d.ts +41 -0
  2. package/dist/component-host-boundary.contract.js +54 -0
  3. package/dist/component-host-boundary.contract.js.map +1 -0
  4. package/dist/function-registry/beliefs.d.ts +41 -41
  5. package/dist/function-registry/beliefs.js +202 -8
  6. package/dist/function-registry/beliefs.js.map +1 -1
  7. package/dist/function-registry/coding.js +187 -8
  8. package/dist/function-registry/coding.js.map +1 -1
  9. package/dist/function-registry/context.d.ts +13 -13
  10. package/dist/function-registry/context.js +187 -9
  11. package/dist/function-registry/context.js.map +1 -1
  12. package/dist/function-registry/contracts.js +158 -5
  13. package/dist/function-registry/contracts.js.map +1 -1
  14. package/dist/function-registry/coordination.js +158 -5
  15. package/dist/function-registry/coordination.js.map +1 -1
  16. package/dist/function-registry/edges.js +169 -6
  17. package/dist/function-registry/edges.js.map +1 -1
  18. package/dist/function-registry/evidence.d.ts +33 -33
  19. package/dist/function-registry/evidence.js +202 -9
  20. package/dist/function-registry/evidence.js.map +1 -1
  21. package/dist/function-registry/graph.d.ts +53 -53
  22. package/dist/function-registry/graph.js +217 -12
  23. package/dist/function-registry/graph.js.map +1 -1
  24. package/dist/function-registry/helpers.d.ts +1 -1
  25. package/dist/function-registry/helpers.js +158 -5
  26. package/dist/function-registry/helpers.js.map +1 -1
  27. package/dist/function-registry/identity.js +158 -5
  28. package/dist/function-registry/identity.js.map +1 -1
  29. package/dist/function-registry/index.d.ts +1 -1
  30. package/dist/function-registry/index.js +158 -5
  31. package/dist/function-registry/index.js.map +1 -1
  32. package/dist/function-registry/judgments.d.ts +9 -9
  33. package/dist/function-registry/judgments.js +170 -8
  34. package/dist/function-registry/judgments.js.map +1 -1
  35. package/dist/function-registry/legacy.js +158 -5
  36. package/dist/function-registry/legacy.js.map +1 -1
  37. package/dist/function-registry/lenses.d.ts +17 -17
  38. package/dist/function-registry/lenses.js +181 -8
  39. package/dist/function-registry/lenses.js.map +1 -1
  40. package/dist/function-registry/manifest.d.ts +3 -3
  41. package/dist/function-registry/manifest.js +1 -1
  42. package/dist/function-registry/manifest.js.map +1 -1
  43. package/dist/function-registry/ontologies.d.ts +45 -45
  44. package/dist/function-registry/ontologies.js +176 -11
  45. package/dist/function-registry/ontologies.js.map +1 -1
  46. package/dist/function-registry/pipeline.d.ts +13 -13
  47. package/dist/function-registry/pipeline.js +167 -8
  48. package/dist/function-registry/pipeline.js.map +1 -1
  49. package/dist/function-registry/questions.d.ts +49 -49
  50. package/dist/function-registry/questions.js +255 -13
  51. package/dist/function-registry/questions.js.map +1 -1
  52. package/dist/function-registry/tasks.js +158 -5
  53. package/dist/function-registry/tasks.js.map +1 -1
  54. package/dist/function-registry/topics.d.ts +21 -21
  55. package/dist/function-registry/topics.js +172 -8
  56. package/dist/function-registry/topics.js.map +1 -1
  57. package/dist/function-registry/types.d.ts +1 -1
  58. package/dist/function-registry/worktrees.d.ts +80 -41
  59. package/dist/function-registry/worktrees.js +292 -17
  60. package/dist/function-registry/worktrees.js.map +1 -1
  61. package/dist/function-registry-input-audit.d.ts +13 -0
  62. package/dist/function-registry-input-audit.js +164 -0
  63. package/dist/function-registry-input-audit.js.map +1 -0
  64. package/dist/gateway.contract.d.ts +1 -0
  65. package/dist/gateway.contract.js.map +1 -1
  66. package/dist/generated/convexSchemas.js +1 -1
  67. package/dist/generated/convexSchemas.js.map +1 -1
  68. package/dist/index.d.ts +188 -35
  69. package/dist/index.js +1370 -17
  70. package/dist/index.js.map +1 -1
  71. package/dist/infisical-runtime.contract.d.ts +174 -0
  72. package/dist/infisical-runtime.contract.js +192 -0
  73. package/dist/infisical-runtime.contract.js.map +1 -0
  74. package/dist/schemas/index.js +3 -1
  75. package/dist/schemas/index.js.map +1 -1
  76. package/dist/schemas/manifest.d.ts +935 -905
  77. package/dist/schemas/manifest.js +3 -1
  78. package/dist/schemas/manifest.js.map +1 -1
  79. package/dist/schemas/sl-opinion.d.ts +4 -4
  80. package/dist/schemas/tables/identity/platform.d.ts +10 -10
  81. package/dist/schemas/tables/kernel/epistemic.d.ts +6 -6
  82. package/dist/schemas/tables/kernel/infra.d.ts +4 -4
  83. package/dist/schemas/tables/kernel/intelligence.d.ts +10 -10
  84. package/dist/schemas/tables/kernel/lens.d.ts +4 -4
  85. package/dist/schemas/tables/kernel/platform.d.ts +12 -12
  86. package/dist/schemas/tables/kernel/spine.d.ts +2 -2
  87. package/dist/schemas/tables/kernel/task.d.ts +42 -42
  88. package/dist/schemas/tables/kernel/worktree.d.ts +62 -62
  89. package/dist/schemas/tables/mc/identity.d.ts +2 -2
  90. package/dist/schemas/tables/mc/pack.d.ts +20 -20
  91. package/dist/schemas/tables/mc/registry.d.ts +4 -4
  92. package/dist/schemas/tables/mc/workspace.d.ts +9 -3
  93. package/dist/schemas/tables/mc/workspace.js +3 -1
  94. package/dist/schemas/tables/mc/workspace.js.map +1 -1
  95. package/dist/sdk-methods.contract.d.ts +1 -1
  96. package/dist/{sdk-tools.contract-S4ia0TTo.d.ts → sdk-tools.contract-CD-N1Jf7.d.ts} +1 -1
  97. package/dist/sdk-tools.contract.d.ts +2 -2
  98. package/dist/sdk-tools.contract.js +157 -4
  99. package/dist/sdk-tools.contract.js.map +1 -1
  100. package/dist/tenant-bootstrap-seed.contract.d.ts +1097 -0
  101. package/dist/tenant-bootstrap-seed.contract.js +651 -0
  102. package/dist/tenant-bootstrap-seed.contract.js.map +1 -0
  103. package/dist/tenant-bootstrap-seed.defaults.d.ts +16 -0
  104. package/dist/tenant-bootstrap-seed.defaults.js +303 -0
  105. package/dist/tenant-bootstrap-seed.defaults.js.map +1 -0
  106. package/dist/{tool-contracts-C92-9ueT.d.ts → tool-contracts-BcKz-VGj.d.ts} +4 -2
  107. package/dist/tool-contracts.d.ts +1 -1
  108. package/dist/tool-contracts.js +158 -5
  109. package/dist/tool-contracts.js.map +1 -1
  110. package/package.json +1 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Component host persistence boundary
3
+ *
4
+ * Host deployments may call component APIs, but they must not create or mutate
5
+ * component-owned tables directly through top-level ctx.db. This contract keeps
6
+ * tenant SDK clients from accidentally recreating Lucern kernel/identity tables
7
+ * as host "ghost tables".
8
+ */
9
+ declare const COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION: "2026-04-28";
10
+ declare const COMPONENT_HOST_PROTECTED_TABLES: readonly ["backgroundJobRuns", "backgroundJobSettings", "systemLogs", "epistemicAudit", "platformPolicyDecisionLogs", "tenantApiKeys", "projectGrants", "userSessions"];
11
+ type ComponentHostProtectedTable = (typeof COMPONENT_HOST_PROTECTED_TABLES)[number];
12
+ declare const COMPONENT_HOST_PROTECTED_TABLE_OWNERS: {
13
+ readonly backgroundJobRuns: "kernel_component";
14
+ readonly backgroundJobSettings: "kernel_component";
15
+ readonly systemLogs: "kernel_component";
16
+ readonly epistemicAudit: "reasoning_kernel_component";
17
+ readonly platformPolicyDecisionLogs: "identity_component";
18
+ readonly tenantApiKeys: "identity_component";
19
+ readonly projectGrants: "identity_component";
20
+ readonly userSessions: "tenant_or_control_plane_schema";
21
+ };
22
+ declare const COMPONENT_HOST_DB_WRITE_OPERATIONS: readonly ["insert", "patch", "replace", "delete"];
23
+ type ComponentHostDbWriteOperation = (typeof COMPONENT_HOST_DB_WRITE_OPERATIONS)[number];
24
+ declare const COMPONENT_HOST_DB_READ_OPERATIONS: readonly ["query"];
25
+ type ComponentHostDbReadOperation = (typeof COMPONENT_HOST_DB_READ_OPERATIONS)[number];
26
+ type ComponentHostDbOperation = ComponentHostDbWriteOperation | ComponentHostDbReadOperation;
27
+ declare const COMPONENT_HOST_WRITE_AUDIT_ROOTS: readonly ["apps/web/convex", "packages/server-core/src", "services/kernel-template/convex", "services/identity-template/convex", "services/master-control/convex"];
28
+ type ComponentHostWriteAuditRoot = (typeof COMPONENT_HOST_WRITE_AUDIT_ROOTS)[number];
29
+ declare const COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS: readonly [{
30
+ readonly file: "services/master-control/convex/userSessions.ts";
31
+ readonly table: "userSessions";
32
+ readonly operation: "insert";
33
+ readonly reason: "Master Control declares and owns its own userSessions table for gateway session validation.";
34
+ }, {
35
+ readonly file: "services/master-control/convex/userSessions.ts";
36
+ readonly table: "userSessions";
37
+ readonly operation: "query";
38
+ readonly reason: "Master Control declares and owns its own userSessions table for gateway session validation.";
39
+ }];
40
+
41
+ export { COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION, COMPONENT_HOST_DB_READ_OPERATIONS, COMPONENT_HOST_DB_WRITE_OPERATIONS, COMPONENT_HOST_PROTECTED_TABLES, COMPONENT_HOST_PROTECTED_TABLE_OWNERS, COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS, COMPONENT_HOST_WRITE_AUDIT_ROOTS, type ComponentHostDbOperation, type ComponentHostDbReadOperation, type ComponentHostDbWriteOperation, type ComponentHostProtectedTable, type ComponentHostWriteAuditRoot };
@@ -0,0 +1,54 @@
1
+ // src/component-host-boundary.contract.ts
2
+ var COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION = "2026-04-28";
3
+ var COMPONENT_HOST_PROTECTED_TABLES = [
4
+ "backgroundJobRuns",
5
+ "backgroundJobSettings",
6
+ "systemLogs",
7
+ "epistemicAudit",
8
+ "platformPolicyDecisionLogs",
9
+ "tenantApiKeys",
10
+ "projectGrants",
11
+ "userSessions"
12
+ ];
13
+ var COMPONENT_HOST_PROTECTED_TABLE_OWNERS = {
14
+ backgroundJobRuns: "kernel_component",
15
+ backgroundJobSettings: "kernel_component",
16
+ systemLogs: "kernel_component",
17
+ epistemicAudit: "reasoning_kernel_component",
18
+ platformPolicyDecisionLogs: "identity_component",
19
+ tenantApiKeys: "identity_component",
20
+ projectGrants: "identity_component",
21
+ userSessions: "tenant_or_control_plane_schema"
22
+ };
23
+ var COMPONENT_HOST_DB_WRITE_OPERATIONS = [
24
+ "insert",
25
+ "patch",
26
+ "replace",
27
+ "delete"
28
+ ];
29
+ var COMPONENT_HOST_DB_READ_OPERATIONS = ["query"];
30
+ var COMPONENT_HOST_WRITE_AUDIT_ROOTS = [
31
+ "apps/web/convex",
32
+ "packages/server-core/src",
33
+ "services/kernel-template/convex",
34
+ "services/identity-template/convex",
35
+ "services/master-control/convex"
36
+ ];
37
+ var COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS = [
38
+ {
39
+ file: "services/master-control/convex/userSessions.ts",
40
+ table: "userSessions",
41
+ operation: "insert",
42
+ reason: "Master Control declares and owns its own userSessions table for gateway session validation."
43
+ },
44
+ {
45
+ file: "services/master-control/convex/userSessions.ts",
46
+ table: "userSessions",
47
+ operation: "query",
48
+ reason: "Master Control declares and owns its own userSessions table for gateway session validation."
49
+ }
50
+ ];
51
+
52
+ export { COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION, COMPONENT_HOST_DB_READ_OPERATIONS, COMPONENT_HOST_DB_WRITE_OPERATIONS, COMPONENT_HOST_PROTECTED_TABLES, COMPONENT_HOST_PROTECTED_TABLE_OWNERS, COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS, COMPONENT_HOST_WRITE_AUDIT_ROOTS };
53
+ //# sourceMappingURL=component-host-boundary.contract.js.map
54
+ //# sourceMappingURL=component-host-boundary.contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/component-host-boundary.contract.ts"],"names":[],"mappings":";AASO,IAAM,wCAAA,GAA2C;AAEjD,IAAM,+BAAA,GAAkC;AAAA,EAC7C,mBAAA;AAAA,EACA,uBAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AAAA,EACA,4BAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF;AAIO,IAAM,qCAAA,GAAwC;AAAA,EACnD,iBAAA,EAAmB,kBAAA;AAAA,EACnB,qBAAA,EAAuB,kBAAA;AAAA,EACvB,UAAA,EAAY,kBAAA;AAAA,EACZ,cAAA,EAAgB,4BAAA;AAAA,EAChB,0BAAA,EAA4B,oBAAA;AAAA,EAC5B,aAAA,EAAe,oBAAA;AAAA,EACf,aAAA,EAAe,oBAAA;AAAA,EACf,YAAA,EAAc;AAChB;AAEO,IAAM,kCAAA,GAAqC;AAAA,EAChD,QAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF;AAIO,IAAM,iCAAA,GAAoC,CAAC,OAAO;AAQlD,IAAM,gCAAA,GAAmC;AAAA,EAC9C,iBAAA;AAAA,EACA,0BAAA;AAAA,EACA,iCAAA;AAAA,EACA,mCAAA;AAAA,EACA;AACF;AAIO,IAAM,uCAAA,GAA0C;AAAA,EACrD;AAAA,IACE,IAAA,EAAM,gDAAA;AAAA,IACN,KAAA,EAAO,cAAA;AAAA,IACP,SAAA,EAAW,QAAA;AAAA,IACX,MAAA,EACE;AAAA,GACJ;AAAA,EACA;AAAA,IACE,IAAA,EAAM,gDAAA;AAAA,IACN,KAAA,EAAO,cAAA;AAAA,IACP,SAAA,EAAW,OAAA;AAAA,IACX,MAAA,EACE;AAAA;AAEN","file":"component-host-boundary.contract.js","sourcesContent":["/**\n * Component host persistence boundary\n *\n * Host deployments may call component APIs, but they must not create or mutate\n * component-owned tables directly through top-level ctx.db. This contract keeps\n * tenant SDK clients from accidentally recreating Lucern kernel/identity tables\n * as host \"ghost tables\".\n */\n\nexport const COMPONENT_HOST_BOUNDARY_CONTRACT_VERSION = \"2026-04-28\" as const;\n\nexport const COMPONENT_HOST_PROTECTED_TABLES = [\n \"backgroundJobRuns\",\n \"backgroundJobSettings\",\n \"systemLogs\",\n \"epistemicAudit\",\n \"platformPolicyDecisionLogs\",\n \"tenantApiKeys\",\n \"projectGrants\",\n \"userSessions\",\n] as const;\nexport type ComponentHostProtectedTable =\n (typeof COMPONENT_HOST_PROTECTED_TABLES)[number];\n\nexport const COMPONENT_HOST_PROTECTED_TABLE_OWNERS = {\n backgroundJobRuns: \"kernel_component\",\n backgroundJobSettings: \"kernel_component\",\n systemLogs: \"kernel_component\",\n epistemicAudit: \"reasoning_kernel_component\",\n platformPolicyDecisionLogs: \"identity_component\",\n tenantApiKeys: \"identity_component\",\n projectGrants: \"identity_component\",\n userSessions: \"tenant_or_control_plane_schema\",\n} as const satisfies Record<ComponentHostProtectedTable, string>;\n\nexport const COMPONENT_HOST_DB_WRITE_OPERATIONS = [\n \"insert\",\n \"patch\",\n \"replace\",\n \"delete\",\n] as const;\nexport type ComponentHostDbWriteOperation =\n (typeof COMPONENT_HOST_DB_WRITE_OPERATIONS)[number];\n\nexport const COMPONENT_HOST_DB_READ_OPERATIONS = [\"query\"] as const;\nexport type ComponentHostDbReadOperation =\n (typeof COMPONENT_HOST_DB_READ_OPERATIONS)[number];\n\nexport type ComponentHostDbOperation =\n | ComponentHostDbWriteOperation\n | ComponentHostDbReadOperation;\n\nexport const COMPONENT_HOST_WRITE_AUDIT_ROOTS = [\n \"apps/web/convex\",\n \"packages/server-core/src\",\n \"services/kernel-template/convex\",\n \"services/identity-template/convex\",\n \"services/master-control/convex\",\n] as const;\nexport type ComponentHostWriteAuditRoot =\n (typeof COMPONENT_HOST_WRITE_AUDIT_ROOTS)[number];\n\nexport const COMPONENT_HOST_WRITE_ALLOWED_EXCEPTIONS = [\n {\n file: \"services/master-control/convex/userSessions.ts\",\n table: \"userSessions\",\n operation: \"insert\",\n reason:\n \"Master Control declares and owns its own userSessions table for gateway session validation.\",\n },\n {\n file: \"services/master-control/convex/userSessions.ts\",\n table: \"userSessions\",\n operation: \"query\",\n reason:\n \"Master Control declares and owns its own userSessions table for gateway session validation.\",\n },\n] as const satisfies ReadonlyArray<{\n file: string;\n table: ComponentHostProtectedTable;\n operation: ComponentHostDbOperation;\n reason: string;\n}>;\n"]}
@@ -1,4 +1,4 @@
1
- import * as zod from 'zod';
1
+ import { z } from 'zod';
2
2
 
3
3
  /**
4
4
  * MCP Tool Contract Definitions
@@ -115,10 +115,10 @@ declare const beliefsContracts: readonly [{
115
115
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
116
116
  };
117
117
  convex: FunctionConvexTarget | undefined;
118
- args: zod.ZodTypeAny;
119
- returns: zod.ZodTypeAny;
120
- input: zod.ZodTypeAny;
121
- output: zod.ZodTypeAny;
118
+ args: z.ZodTypeAny;
119
+ returns: z.ZodTypeAny;
120
+ input: z.ZodTypeAny;
121
+ output: z.ZodTypeAny;
122
122
  openapi: {
123
123
  summary: string;
124
124
  tags: string[];
@@ -154,10 +154,10 @@ declare const beliefsContracts: readonly [{
154
154
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
155
155
  };
156
156
  convex: FunctionConvexTarget | undefined;
157
- args: zod.ZodTypeAny;
158
- returns: zod.ZodTypeAny;
159
- input: zod.ZodTypeAny;
160
- output: zod.ZodTypeAny;
157
+ args: z.ZodTypeAny;
158
+ returns: z.ZodTypeAny;
159
+ input: z.ZodTypeAny;
160
+ output: z.ZodTypeAny;
161
161
  openapi: {
162
162
  summary: string;
163
163
  tags: string[];
@@ -193,10 +193,10 @@ declare const beliefsContracts: readonly [{
193
193
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
194
194
  };
195
195
  convex: FunctionConvexTarget | undefined;
196
- args: zod.ZodTypeAny;
197
- returns: zod.ZodTypeAny;
198
- input: zod.ZodTypeAny;
199
- output: zod.ZodTypeAny;
196
+ args: z.ZodTypeAny;
197
+ returns: z.ZodTypeAny;
198
+ input: z.ZodTypeAny;
199
+ output: z.ZodTypeAny;
200
200
  openapi: {
201
201
  summary: string;
202
202
  tags: string[];
@@ -232,10 +232,10 @@ declare const beliefsContracts: readonly [{
232
232
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
233
233
  };
234
234
  convex: FunctionConvexTarget | undefined;
235
- args: zod.ZodTypeAny;
236
- returns: zod.ZodTypeAny;
237
- input: zod.ZodTypeAny;
238
- output: zod.ZodTypeAny;
235
+ args: z.ZodTypeAny;
236
+ returns: z.ZodTypeAny;
237
+ input: z.ZodTypeAny;
238
+ output: z.ZodTypeAny;
239
239
  openapi: {
240
240
  summary: string;
241
241
  tags: string[];
@@ -271,10 +271,10 @@ declare const beliefsContracts: readonly [{
271
271
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
272
272
  };
273
273
  convex: FunctionConvexTarget | undefined;
274
- args: zod.ZodTypeAny;
275
- returns: zod.ZodTypeAny;
276
- input: zod.ZodTypeAny;
277
- output: zod.ZodTypeAny;
274
+ args: z.ZodTypeAny;
275
+ returns: z.ZodTypeAny;
276
+ input: z.ZodTypeAny;
277
+ output: z.ZodTypeAny;
278
278
  openapi: {
279
279
  summary: string;
280
280
  tags: string[];
@@ -310,10 +310,10 @@ declare const beliefsContracts: readonly [{
310
310
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
311
311
  };
312
312
  convex: FunctionConvexTarget | undefined;
313
- args: zod.ZodTypeAny;
314
- returns: zod.ZodTypeAny;
315
- input: zod.ZodTypeAny;
316
- output: zod.ZodTypeAny;
313
+ args: z.ZodTypeAny;
314
+ returns: z.ZodTypeAny;
315
+ input: z.ZodTypeAny;
316
+ output: z.ZodTypeAny;
317
317
  openapi: {
318
318
  summary: string;
319
319
  tags: string[];
@@ -349,10 +349,10 @@ declare const beliefsContracts: readonly [{
349
349
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
350
350
  };
351
351
  convex: FunctionConvexTarget | undefined;
352
- args: zod.ZodTypeAny;
353
- returns: zod.ZodTypeAny;
354
- input: zod.ZodTypeAny;
355
- output: zod.ZodTypeAny;
352
+ args: z.ZodTypeAny;
353
+ returns: z.ZodTypeAny;
354
+ input: z.ZodTypeAny;
355
+ output: z.ZodTypeAny;
356
356
  openapi: {
357
357
  summary: string;
358
358
  tags: string[];
@@ -388,10 +388,10 @@ declare const beliefsContracts: readonly [{
388
388
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
389
389
  };
390
390
  convex: FunctionConvexTarget | undefined;
391
- args: zod.ZodTypeAny;
392
- returns: zod.ZodTypeAny;
393
- input: zod.ZodTypeAny;
394
- output: zod.ZodTypeAny;
391
+ args: z.ZodTypeAny;
392
+ returns: z.ZodTypeAny;
393
+ input: z.ZodTypeAny;
394
+ output: z.ZodTypeAny;
395
395
  openapi: {
396
396
  summary: string;
397
397
  tags: string[];
@@ -427,10 +427,10 @@ declare const beliefsContracts: readonly [{
427
427
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
428
428
  };
429
429
  convex: FunctionConvexTarget | undefined;
430
- args: zod.ZodTypeAny;
431
- returns: zod.ZodTypeAny;
432
- input: zod.ZodTypeAny;
433
- output: zod.ZodTypeAny;
430
+ args: z.ZodTypeAny;
431
+ returns: z.ZodTypeAny;
432
+ input: z.ZodTypeAny;
433
+ output: z.ZodTypeAny;
434
434
  openapi: {
435
435
  summary: string;
436
436
  tags: string[];
@@ -466,10 +466,10 @@ declare const beliefsContracts: readonly [{
466
466
  allowedPrincipalTypes: ("user" | "service" | "agent")[];
467
467
  };
468
468
  convex: FunctionConvexTarget | undefined;
469
- args: zod.ZodTypeAny;
470
- returns: zod.ZodTypeAny;
471
- input: zod.ZodTypeAny;
472
- output: zod.ZodTypeAny;
469
+ args: z.ZodTypeAny;
470
+ returns: z.ZodTypeAny;
471
+ input: z.ZodTypeAny;
472
+ output: z.ZodTypeAny;
473
473
  openapi: {
474
474
  summary: string;
475
475
  tags: string[];
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { v } from 'convex/values';
3
3
 
4
- // src/function-registry/helpers.ts
4
+ // src/function-registry/beliefs.ts
5
5
 
6
6
  // src/lens-workflow.contract.ts
7
7
  var LENS_PERSPECTIVE_TYPES = [
@@ -423,6 +423,14 @@ var ADD_WORKTREE = {
423
423
  description: "Check out a branch into an active worktree for investigation. Like `git worktree add <branch>` \u2014 creates independent working state on a thematic branch. Beliefs committed within the worktree can be freely amended (draft code on a feature branch). When investigation is complete, `merge` integrates findings into main.",
424
424
  parameters: {
425
425
  title: { type: "string", description: "Worktree name/objective" },
426
+ name: {
427
+ type: "string",
428
+ description: "Optional storage-name alias for callers that already use backend naming"
429
+ },
430
+ projectId: {
431
+ type: "string",
432
+ description: "Legacy topicId alias"
433
+ },
426
434
  topicId: { type: "string", description: "Optional topic scope hint" },
427
435
  branchId: {
428
436
  type: "string",
@@ -436,14 +444,87 @@ var ADD_WORKTREE = {
436
444
  type: "string",
437
445
  description: "The testable claim this worktree investigates"
438
446
  },
447
+ rationale: {
448
+ type: "string",
449
+ description: "Why this worktree exists and why it belongs in the campaign"
450
+ },
451
+ worktreeType: {
452
+ type: "string",
453
+ description: "Schema-enum worktree type used by the kernel lifecycle and retrieval layers"
454
+ },
455
+ gate: {
456
+ type: "string",
457
+ description: "Exit gate name for this worktree"
458
+ },
459
+ startDate: {
460
+ type: "number",
461
+ description: "Planned start timestamp in milliseconds since epoch"
462
+ },
463
+ endDate: {
464
+ type: "number",
465
+ description: "Planned end timestamp in milliseconds since epoch"
466
+ },
467
+ durationWeeks: {
468
+ type: "number",
469
+ description: "Planned duration in weeks"
470
+ },
471
+ confidenceImpact: {
472
+ type: "string",
473
+ description: "Expected confidence impact if the worktree succeeds",
474
+ enum: ["high", "medium", "low"]
475
+ },
476
+ beliefFocus: {
477
+ type: "string",
478
+ description: "Natural-language focus spanning the target belief neighborhood"
479
+ },
439
480
  beliefIds: {
440
481
  type: "array",
441
- description: "Beliefs to test in this worktree"
482
+ description: "Legacy alias for targetBeliefIds"
483
+ },
484
+ beliefs: {
485
+ type: "array",
486
+ description: "Legacy alias for targetBeliefIds"
487
+ },
488
+ targetBeliefIds: {
489
+ type: "array",
490
+ description: "Belief node IDs this worktree is expected to test or update"
491
+ },
492
+ targetQuestionIds: {
493
+ type: "array",
494
+ description: "Question node IDs this worktree is expected to answer"
495
+ },
496
+ keyQuestions: {
497
+ type: "array",
498
+ description: "Inline key question objects with question, optional status, answer, answerConfidence, and linkedQuestionId"
499
+ },
500
+ evidenceSignals: {
501
+ type: "array",
502
+ description: "Evidence signal objects with signal, optional collected state, progress, and notes"
503
+ },
504
+ decisionGate: {
505
+ type: "object",
506
+ description: "Decision gate object with goCriteria, noGoSignals, optional verdict, rationale, decidedAt, and decidedBy"
507
+ },
508
+ goCriteria: {
509
+ type: "array",
510
+ description: "Shorthand go criteria used to build decisionGate"
511
+ },
512
+ noGoSignals: {
513
+ type: "array",
514
+ description: "Shorthand no-go signals used to build decisionGate"
515
+ },
516
+ proofArtifacts: {
517
+ type: "array",
518
+ description: "Expected proof artifacts required to close the worktree"
442
519
  },
443
520
  autoShape: {
444
521
  type: "boolean",
445
522
  description: "Whether to invoke inquiry auto-shaping during worktree creation"
446
523
  },
524
+ autoFixPolicy: {
525
+ type: "object",
526
+ description: "Policy for permitted automatic remediation inside the worktree"
527
+ },
447
528
  domainPackId: {
448
529
  type: "string",
449
530
  description: "Optional domain pack whose shaping hooks should influence generated questions and tasks"
@@ -472,9 +553,17 @@ var ADD_WORKTREE = {
472
553
  type: "array",
473
554
  description: "Worktree IDs blocked by this worktree"
474
555
  },
475
- gate: {
556
+ staffingHint: {
476
557
  type: "string",
477
- description: "Exit gate name for this worktree"
558
+ description: "Suggested staffing or agent allocation note"
559
+ },
560
+ lensId: {
561
+ type: "string",
562
+ description: "Lens that scopes this worktree when applicable"
563
+ },
564
+ lastReconciledAt: {
565
+ type: "number",
566
+ description: "Timestamp when worktree metadata was last reconciled"
478
567
  }
479
568
  },
480
569
  required: ["title", "topicId"],
@@ -504,7 +593,7 @@ var MERGE = {
504
593
  worktreeId: { type: "string", description: "The worktree to merge" },
505
594
  outcomes: {
506
595
  type: "array",
507
- description: "Scoring outcomes for each belief: { beliefId, confidence, rationale }"
596
+ description: "Merge outcomes as key-finding strings, or scoring outcomes for beliefs: { beliefId, confidence, rationale }"
508
597
  },
509
598
  summary: { type: "string", description: "Overall findings summary" }
510
599
  },
@@ -3523,6 +3612,69 @@ var GENERATE_SESSION_HANDOFF = {
3523
3612
  tier: "showcase",
3524
3613
  internal: true
3525
3614
  };
3615
+ var BEGIN_BUILD_SESSION = {
3616
+ name: "begin_build_session",
3617
+ description: "Bootstrap a coding build session for a Lucern worktree. Like `git worktree add` plus `git status` \u2014 returns the compact context packet an agent needs before editing.",
3618
+ parameters: {
3619
+ worktreeId: {
3620
+ type: "string",
3621
+ description: "The Lucern worktree ID to bootstrap."
3622
+ },
3623
+ branch: {
3624
+ type: "string",
3625
+ description: "Optional git branch name. Auto-generated from the worktree name when omitted."
3626
+ },
3627
+ branchBase: {
3628
+ type: "string",
3629
+ description: 'Base branch for the feature branch. Default: "staging".'
3630
+ },
3631
+ prBase: {
3632
+ type: "string",
3633
+ description: 'Target branch for the PR. Default: "staging".'
3634
+ },
3635
+ sessionMode: {
3636
+ type: "string",
3637
+ description: 'Session mode: "async" for Codex/headless or "interactive" for live sessions.',
3638
+ enum: ["async", "interactive"]
3639
+ },
3640
+ activateIfPlanning: {
3641
+ type: "boolean",
3642
+ description: "When true, automatically activate a planning worktree during bootstrap."
3643
+ }
3644
+ },
3645
+ required: ["worktreeId"],
3646
+ response: {
3647
+ description: "A compact build-session packet with worktree metadata, graph anchors, questions, dependencies, and git defaults.",
3648
+ fields: {
3649
+ topicId: "string \u2014 canonical topic scope",
3650
+ topicName: "string \u2014 human-readable topic name",
3651
+ worktreeId: "string \u2014 worktree ID",
3652
+ worktreeName: "string \u2014 human-readable worktree name",
3653
+ branch: "string \u2014 git branch name",
3654
+ branchBase: "string \u2014 base branch",
3655
+ prBase: "string \u2014 PR target branch",
3656
+ campaign: "number | null \u2014 top-level pipeline campaign",
3657
+ lane: "string \u2014 campaign lane",
3658
+ gate: "string \u2014 exit gate",
3659
+ hypothesis: "string \u2014 worktree hypothesis",
3660
+ focus: "string \u2014 session focus",
3661
+ status: "string \u2014 worktree status after optional activation",
3662
+ sessionMode: "string \u2014 async | interactive",
3663
+ targetBeliefIds: "array \u2014 scoped belief IDs",
3664
+ targetQuestionIds: "array \u2014 scoped question IDs",
3665
+ topBeliefs: "array \u2014 highest-confidence scoped beliefs",
3666
+ openQuestions: "array \u2014 open scoped questions",
3667
+ resolvedDecisions: "array \u2014 answered questions summarized for the session",
3668
+ dependencies: "array \u2014 upstream worktrees",
3669
+ unblocks: "array \u2014 downstream worktrees",
3670
+ mergeOrderNotes: "string \u2014 merge ordering advisory"
3671
+ }
3672
+ },
3673
+ ownerModule: "bootstrap",
3674
+ ontologyPrimitive: "worktree",
3675
+ tier: "showcase",
3676
+ internal: true
3677
+ };
3526
3678
  var MCP_TOOL_CONTRACTS = {
3527
3679
  // Belief lifecycle (commit, amend, fork, archive)
3528
3680
  create_belief: CREATE_BELIEF,
@@ -3616,6 +3768,7 @@ var MCP_TOOL_CONTRACTS = {
3616
3768
  get_agent_inbox: GET_AGENT_INBOX,
3617
3769
  claim_files: CLAIM_FILES,
3618
3770
  generate_session_handoff: GENERATE_SESSION_HANDOFF,
3771
+ begin_build_session: BEGIN_BUILD_SESSION,
3619
3772
  // Policy / ACL (workhorse)
3620
3773
  check_permission: CHECK_PERMISSION,
3621
3774
  filter_by_permission: FILTER_BY_PERMISSION,
@@ -3829,6 +3982,7 @@ var PLATFORM_INTERNAL_OPERATION_NAMES = [
3829
3982
  "get_change_history",
3830
3983
  "get_failure_log",
3831
3984
  "record_attempt",
3985
+ "begin_build_session",
3832
3986
  "push",
3833
3987
  "open_pull_request",
3834
3988
  "record_judgment",
@@ -3883,7 +4037,6 @@ var SDK_ONLY_OPERATION_NAMES = [
3883
4037
  "find_semantic_orphans"
3884
4038
  ];
3885
4039
  var MCP_ONLY_INTERNAL_OPERATION_NAMES = [
3886
- "begin_build_session",
3887
4040
  "evaluate_engineering_contract",
3888
4041
  "evaluate_research_contract"
3889
4042
  ];
@@ -4425,6 +4578,45 @@ function hasProvenance(input) {
4425
4578
  }
4426
4579
 
4427
4580
  // src/function-registry/beliefs.ts
4581
+ var jsonRecordSchema = z.record(z.unknown());
4582
+ var sourceTypeSchema = z.enum(["human", "ai_extracted", "ai_generated"]);
4583
+ var reversibilitySchema = z.enum([
4584
+ "irreversible",
4585
+ "hard_to_reverse",
4586
+ "reversible",
4587
+ "trivial"
4588
+ ]);
4589
+ var predictionMetaSchema = z.object({
4590
+ isPrediction: z.boolean().describe("Whether this belief is a prediction."),
4591
+ registeredAt: z.number().describe("Timestamp when the prediction was registered."),
4592
+ expectedBy: z.number().optional().describe("Timestamp when the prediction should be evaluated.")
4593
+ });
4594
+ var createBeliefArgs = z.object({
4595
+ canonicalText: z.string().describe("The belief statement the agent holds to be true."),
4596
+ topicId: z.string().optional().describe("Topic scope hint for the belief."),
4597
+ baseRate: z.number().optional().describe("Prior base rate used to seed the vacuous opinion."),
4598
+ beliefType: z.string().optional().describe("Schema belief type."),
4599
+ metadata: jsonRecordSchema.optional().describe("Extra metadata merged into the belief node."),
4600
+ rationale: z.string().optional().describe("Why this belief should enter the reasoning graph."),
4601
+ pillar: z.string().optional().describe("Innovation pillar or product pillar associated with the belief."),
4602
+ worktreeId: z.string().optional().describe("Worktree responsible for creating or testing this belief."),
4603
+ sourceBeliefIds: z.array(z.string()).optional().describe("Source belief IDs this belief derives from."),
4604
+ sourceType: sourceTypeSchema.optional().describe("Actor/source class that produced the belief."),
4605
+ reversibility: reversibilitySchema.optional().describe("How reversible the belief's implied decision is."),
4606
+ predictionMeta: predictionMetaSchema.optional().describe("Prediction lifecycle metadata when this belief is a forecast.")
4607
+ });
4608
+ var forkBeliefArgs = z.object({
4609
+ nodeId: z.string().describe("The scored belief to fork from."),
4610
+ newFormulation: z.string().describe("The evolved belief statement."),
4611
+ forkReason: z.enum([
4612
+ "refinement",
4613
+ "contradiction_response",
4614
+ "scope_change",
4615
+ "confidence_collapse",
4616
+ "manual"
4617
+ ]).describe("Why this fork was created."),
4618
+ rationale: z.string().optional().describe("Why the fork is warranted.")
4619
+ });
4428
4620
  var beliefLookupInput = (input) => compactRecord({
4429
4621
  nodeId: input.nodeId ?? input.id ?? input.beliefId,
4430
4622
  beliefId: input.beliefId
@@ -4499,7 +4691,8 @@ var beliefsContracts = [
4499
4691
  functionName: "create",
4500
4692
  kind: "mutation",
4501
4693
  inputProjection: createBeliefInput
4502
- }
4694
+ },
4695
+ args: createBeliefArgs
4503
4696
  }),
4504
4697
  surfaceContract({
4505
4698
  name: "get_belief",
@@ -4590,7 +4783,8 @@ var beliefsContracts = [
4590
4783
  functionName: "forkBelief",
4591
4784
  kind: "mutation",
4592
4785
  inputProjection: forkBeliefInput
4593
- }
4786
+ },
4787
+ args: forkBeliefArgs
4594
4788
  }),
4595
4789
  surfaceContract({
4596
4790
  name: "archive_belief",