@lucern/contracts 0.1.0 → 0.1.1-alpha.1

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 (87) hide show
  1. package/dist/index.d.ts +2003 -21
  2. package/dist/index.js +5627 -22
  3. package/package.json +15 -25
  4. package/src/agents/v1.ts +8 -0
  5. package/src/api-enums.contract.ts +183 -0
  6. package/src/auth-context.contract.ts +9 -0
  7. package/src/auth-session.contract.ts +9 -0
  8. package/src/auth.contract.ts +162 -0
  9. package/src/beliefs/v1.ts +8 -0
  10. package/src/context-pack.contract.ts +704 -0
  11. package/src/convex-admin.contract.ts +14 -0
  12. package/src/events-types.contract.ts +9 -0
  13. package/src/events.contract.ts +376 -0
  14. package/src/evidence/v1.ts +8 -0
  15. package/src/gateway.contract.ts +151 -0
  16. package/src/graph/v1.ts +8 -0
  17. package/src/ids.contract.ts +36 -0
  18. package/src/index.ts +30 -0
  19. package/src/lens-filter.contract.ts +183 -0
  20. package/src/lens-workflow.contract.ts +162 -0
  21. package/src/mcp-tools.contract.ts +3636 -0
  22. package/src/ontologies/v1.ts +8 -0
  23. package/src/ontology-matching.contract.ts +9 -0
  24. package/src/prompt.contract.ts +50 -0
  25. package/src/questions/v1.ts +8 -0
  26. package/src/sdk-methods.contract.ts +522 -0
  27. package/src/sdk-tools.contract.ts +1545 -0
  28. package/src/text-matching.contract.ts +347 -0
  29. package/src/topic-scope.contract.ts +9 -0
  30. package/src/topics/v1.ts +8 -0
  31. package/src/v1/agents/v1.ts +8 -0
  32. package/src/v1/beliefs/v1.ts +8 -0
  33. package/src/v1/evidence/v1.ts +8 -0
  34. package/src/v1/graph/v1.ts +8 -0
  35. package/src/v1/ontologies/v1.ts +276 -0
  36. package/src/v1/questions/v1.ts +8 -0
  37. package/src/v1/topics/v1.ts +79 -0
  38. package/src/v1/worktrees/v1.ts +8 -0
  39. package/src/workflow-runtime.contract.ts +440 -0
  40. package/src/worktrees/v1.ts +8 -0
  41. package/tsconfig.json +9 -0
  42. package/dist/api-enums.contract.d.ts +0 -59
  43. package/dist/api-enums.contract.d.ts.map +0 -1
  44. package/dist/api-enums.contract.js +0 -148
  45. package/dist/api-enums.contract.js.map +0 -1
  46. package/dist/auth-session.contract.d.ts +0 -54
  47. package/dist/auth-session.contract.d.ts.map +0 -1
  48. package/dist/auth-session.contract.js +0 -50
  49. package/dist/auth-session.contract.js.map +0 -1
  50. package/dist/context-pack.contract.d.ts +0 -495
  51. package/dist/context-pack.contract.d.ts.map +0 -1
  52. package/dist/context-pack.contract.js +0 -170
  53. package/dist/context-pack.contract.js.map +0 -1
  54. package/dist/gateway.contract.d.ts +0 -74
  55. package/dist/gateway.contract.d.ts.map +0 -1
  56. package/dist/gateway.contract.js +0 -12
  57. package/dist/gateway.contract.js.map +0 -1
  58. package/dist/index.d.ts.map +0 -1
  59. package/dist/index.js.map +0 -1
  60. package/dist/lens-filter.contract.d.ts +0 -71
  61. package/dist/lens-filter.contract.d.ts.map +0 -1
  62. package/dist/lens-filter.contract.js +0 -96
  63. package/dist/lens-filter.contract.js.map +0 -1
  64. package/dist/lens-workflow.contract.d.ts +0 -85
  65. package/dist/lens-workflow.contract.d.ts.map +0 -1
  66. package/dist/lens-workflow.contract.js +0 -55
  67. package/dist/lens-workflow.contract.js.map +0 -1
  68. package/dist/mcp-tools.contract.d.ts +0 -152
  69. package/dist/mcp-tools.contract.d.ts.map +0 -1
  70. package/dist/mcp-tools.contract.js +0 -3282
  71. package/dist/mcp-tools.contract.js.map +0 -1
  72. package/dist/prompt.contract.d.ts +0 -25
  73. package/dist/prompt.contract.d.ts.map +0 -1
  74. package/dist/prompt.contract.js +0 -25
  75. package/dist/prompt.contract.js.map +0 -1
  76. package/dist/sdk-methods.contract.d.ts +0 -356
  77. package/dist/sdk-methods.contract.d.ts.map +0 -1
  78. package/dist/sdk-methods.contract.js +0 -17
  79. package/dist/sdk-methods.contract.js.map +0 -1
  80. package/dist/sdk-tools.contract.d.ts +0 -93
  81. package/dist/sdk-tools.contract.d.ts.map +0 -1
  82. package/dist/sdk-tools.contract.js +0 -1399
  83. package/dist/sdk-tools.contract.js.map +0 -1
  84. package/dist/workflow-runtime.contract.d.ts +0 -162
  85. package/dist/workflow-runtime.contract.d.ts.map +0 -1
  86. package/dist/workflow-runtime.contract.js +0 -258
  87. package/dist/workflow-runtime.contract.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ /**
2
+ * @lucern/contracts — TopicsV1 namespace (resource contracts)
3
+ *
4
+ * Moved from src/topic-scope.contract.ts in EK-16 T1 PR 2.
5
+ * Compat shim remains at the old path until the Lucern 1.0.0 cut.
6
+ */
7
+
8
+ export const ROOT_TOPIC_ID = "n17tm38rwet7wqgzrmwahyt1z582590y";
9
+
10
+ export type TopicDoc = {
11
+ _id: string;
12
+ name?: string;
13
+ parentTopicId?: string;
14
+ depth?: number;
15
+ type?: string;
16
+ };
17
+
18
+ /**
19
+ * BFS traversal collecting a topic and its neighborhood:
20
+ * ancestors up to root + descendants down to maxDescendantDepth.
21
+ */
22
+ export function collectTopicNeighborhood(
23
+ topics: TopicDoc[],
24
+ rootTopicId: string,
25
+ maxDescendantDepth = 2
26
+ ): string[] {
27
+ const byId = new Map<string, TopicDoc>();
28
+ const children = new Map<string, string[]>();
29
+ for (const topic of topics) {
30
+ const id = String(topic._id);
31
+ byId.set(id, topic);
32
+ if (!children.has(id)) {
33
+ children.set(id, []);
34
+ }
35
+ }
36
+ for (const topic of topics) {
37
+ if (!topic.parentTopicId) {
38
+ continue;
39
+ }
40
+ const parent = String(topic.parentTopicId);
41
+ const id = String(topic._id);
42
+ const list = children.get(parent) || [];
43
+ list.push(id);
44
+ children.set(parent, list);
45
+ }
46
+
47
+ const selected = new Set<string>();
48
+ selected.add(rootTopicId);
49
+
50
+ // Ancestors
51
+ let cursor = byId.get(rootTopicId);
52
+ while (cursor?.parentTopicId) {
53
+ const parentId = String(cursor.parentTopicId);
54
+ if (selected.has(parentId)) {
55
+ break;
56
+ }
57
+ selected.add(parentId);
58
+ cursor = byId.get(parentId);
59
+ }
60
+
61
+ // Descendants
62
+ const queue: Array<{ id: string; depth: number }> = [
63
+ { id: rootTopicId, depth: 0 },
64
+ ];
65
+ while (queue.length > 0) {
66
+ const current = queue.shift()!;
67
+ if (current.depth >= maxDescendantDepth) {
68
+ continue;
69
+ }
70
+ for (const childId of children.get(current.id) || []) {
71
+ if (!selected.has(childId)) {
72
+ selected.add(childId);
73
+ }
74
+ queue.push({ id: childId, depth: current.depth + 1 });
75
+ }
76
+ }
77
+
78
+ return Array.from(selected);
79
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @lucern/contracts — Worktrees v1 namespace
3
+ *
4
+ * Placeholder. Resource contracts land in EK-16 T1 PR 2 (two-taxonomy migration).
5
+ * Do not add symbols here — they must move from the flat contract files
6
+ * during the PR 2 migration.
7
+ */
8
+ export {};
@@ -0,0 +1,440 @@
1
+ /**
2
+ * Workflow Runtime Contract v1
3
+ *
4
+ * Canonical TypeScript contract for Lucern's graph-local workflow runtime.
5
+ * WF-1 defines the typed substrate for:
6
+ * - workflow definitions and run receipts
7
+ * - action mutation tiering and approval expectations
8
+ * - hooks over worktree/question/evidence/inbox events
9
+ * - output unions for domain-specific artifacts
10
+ * - deterministic integrity checks and operational metadata
11
+ *
12
+ * BREAKING CHANGE RULES:
13
+ * - Adding optional fields is NON-breaking
14
+ * - Removing fields or renaming enum values is BREAKING
15
+ * - Reclassifying a mutation tier is BREAKING
16
+ * - Changing canonical workflow IDs is BREAKING
17
+ */
18
+
19
+ export const WORKFLOW_RUNTIME_SCHEMA_VERSION = "1.0.0" as const;
20
+
21
+ export const WORKFLOW_MUTATION_TIERS = [
22
+ "read_only",
23
+ "low_risk_write",
24
+ "high_risk_write",
25
+ ] as const;
26
+ export type WorkflowMutationTier = (typeof WORKFLOW_MUTATION_TIERS)[number];
27
+
28
+ export const WORKFLOW_APPROVAL_MODES = [
29
+ "none",
30
+ "audit_only",
31
+ "human_required",
32
+ "auto_approve",
33
+ ] as const;
34
+ export type WorkflowApprovalMode = (typeof WORKFLOW_APPROVAL_MODES)[number];
35
+
36
+ export const DEFAULT_TIER_APPROVAL_MODE: Readonly<
37
+ Record<WorkflowMutationTier, WorkflowApprovalMode>
38
+ > = {
39
+ read_only: "none",
40
+ low_risk_write: "audit_only",
41
+ high_risk_write: "human_required",
42
+ } as const;
43
+
44
+ export const WORKFLOW_ACTION_KINDS = [
45
+ "context_pack",
46
+ "integrity_check",
47
+ "lucern_tool",
48
+ "report_compile",
49
+ "brief_publish",
50
+ "notification",
51
+ "custom",
52
+ ] as const;
53
+ export type WorkflowActionKind = (typeof WORKFLOW_ACTION_KINDS)[number];
54
+
55
+ export const WORKFLOW_HOOK_EVENTS = [
56
+ "schedule.tick",
57
+ "worktree.activated",
58
+ "worktree.completed",
59
+ "question.created",
60
+ "question.answered",
61
+ "evidence.appended",
62
+ "inbox.item_created",
63
+ ] as const;
64
+ export type WorkflowHookEvent = (typeof WORKFLOW_HOOK_EVENTS)[number];
65
+
66
+ export const WORKFLOW_OUTPUT_KINDS = [
67
+ "engineering_brief",
68
+ "research_memo",
69
+ "strategy_artifact",
70
+ "inbox_summary",
71
+ "pipeline_brief",
72
+ "structured_payload",
73
+ ] as const;
74
+ export type WorkflowOutputKind = (typeof WORKFLOW_OUTPUT_KINDS)[number];
75
+
76
+ export const WORKFLOW_RUN_STATUSES = [
77
+ "queued",
78
+ "running",
79
+ "awaiting_approval",
80
+ "completed",
81
+ "failed",
82
+ "cancelled",
83
+ ] as const;
84
+ export type WorkflowRunStatus = (typeof WORKFLOW_RUN_STATUSES)[number];
85
+
86
+ export const WORKFLOW_TRIGGER_KINDS = [
87
+ "manual",
88
+ "schedule",
89
+ "hook",
90
+ ] as const;
91
+ export type WorkflowTriggerKind = (typeof WORKFLOW_TRIGGER_KINDS)[number];
92
+
93
+ export const WORKFLOW_PROOF_ARTIFACT_KINDS = [
94
+ "report",
95
+ "brief",
96
+ "artifact",
97
+ "dashboard",
98
+ "test_evidence",
99
+ ] as const;
100
+ export type WorkflowProofArtifactKind =
101
+ (typeof WORKFLOW_PROOF_ARTIFACT_KINDS)[number];
102
+
103
+ export const WORKFLOW_STAFFING_HINTS = [
104
+ "solo",
105
+ "backend+tests",
106
+ "fullstack",
107
+ "mcp+tests",
108
+ ] as const;
109
+ export type WorkflowStaffingHint = (typeof WORKFLOW_STAFFING_HINTS)[number];
110
+
111
+ export const WORKFLOW_AUTO_FIX_MODES = [
112
+ "disabled",
113
+ "dry_run",
114
+ "safe",
115
+ "aggressive",
116
+ ] as const;
117
+ export type WorkflowAutoFixMode = (typeof WORKFLOW_AUTO_FIX_MODES)[number];
118
+
119
+ export const WORKFLOW_INTEGRITY_CHECKS = [
120
+ "null_dependency_refs",
121
+ "superseded_blockers",
122
+ "band_order_inconsistency",
123
+ "sparse_shaping",
124
+ "failed_completed_gate",
125
+ ] as const;
126
+ export type WorkflowIntegrityCheckId =
127
+ (typeof WORKFLOW_INTEGRITY_CHECKS)[number];
128
+
129
+ export type WorkflowProofArtifact = {
130
+ kind: WorkflowProofArtifactKind;
131
+ label: string;
132
+ required?: boolean;
133
+ sourceRef?: string;
134
+ };
135
+
136
+ export type WorkflowAutoFixPolicy = {
137
+ mode: WorkflowAutoFixMode;
138
+ maxActionsPerRun?: number;
139
+ permittedMutationTiers?: WorkflowMutationTier[];
140
+ requireAuditTrail?: boolean;
141
+ escalationGate?: string;
142
+ };
143
+
144
+ export const DEFAULT_WORKFLOW_AUTO_FIX_POLICY: WorkflowAutoFixPolicy = {
145
+ mode: "disabled",
146
+ permittedMutationTiers: ["read_only"],
147
+ requireAuditTrail: true,
148
+ };
149
+
150
+ export type WorkflowApprovalPolicy = {
151
+ mode: WorkflowApprovalMode;
152
+ approvalGate?: string;
153
+ autoApprovePolicyKey?: string;
154
+ rationaleRequired?: boolean;
155
+ };
156
+
157
+ export type WorkflowOutputBase = {
158
+ outputId: string;
159
+ kind: WorkflowOutputKind;
160
+ title: string;
161
+ summary: string;
162
+ generatedAt?: number;
163
+ };
164
+
165
+ export type EngineeringBriefOutput = WorkflowOutputBase & {
166
+ kind: "engineering_brief";
167
+ sections: Array<{
168
+ heading: string;
169
+ body: string;
170
+ }>;
171
+ touchedPaths?: string[];
172
+ };
173
+
174
+ export type ResearchMemoOutput = WorkflowOutputBase & {
175
+ kind: "research_memo";
176
+ claims: string[];
177
+ evidenceRefs?: string[];
178
+ };
179
+
180
+ export type StrategyArtifactOutput = WorkflowOutputBase & {
181
+ kind: "strategy_artifact";
182
+ recommendations: string[];
183
+ decisionWindow?: string;
184
+ };
185
+
186
+ export type InboxSummaryOutput = WorkflowOutputBase & {
187
+ kind: "inbox_summary";
188
+ channel: "developer_portal" | "chat" | "ops";
189
+ inboxTitle: string;
190
+ inboxBody: string;
191
+ };
192
+
193
+ export type PipelineBriefOutput = WorkflowOutputBase & {
194
+ kind: "pipeline_brief";
195
+ hingeWorktreeId?: string;
196
+ groupedBlockers: Array<{
197
+ blocker: string;
198
+ blockedWorktreeIds: string[];
199
+ }>;
200
+ };
201
+
202
+ export type StructuredPayloadOutput = WorkflowOutputBase & {
203
+ kind: "structured_payload";
204
+ payload: Record<string, unknown>;
205
+ };
206
+
207
+ export type WorkflowOutputContract =
208
+ | EngineeringBriefOutput
209
+ | ResearchMemoOutput
210
+ | StrategyArtifactOutput
211
+ | InboxSummaryOutput
212
+ | PipelineBriefOutput
213
+ | StructuredPayloadOutput;
214
+
215
+ export type WorkflowActionContract = {
216
+ actionId: string;
217
+ kind: WorkflowActionKind;
218
+ title: string;
219
+ description: string;
220
+ mutationTier: WorkflowMutationTier;
221
+ toolName?: string;
222
+ produces?: WorkflowOutputKind[];
223
+ idempotent?: boolean;
224
+ approval: WorkflowApprovalPolicy;
225
+ };
226
+
227
+ export type WorkflowHookContract = {
228
+ hookId: string;
229
+ event: WorkflowHookEvent;
230
+ description: string;
231
+ condition?: string;
232
+ actionIds: string[];
233
+ };
234
+
235
+ export type WorkflowTriggerContract =
236
+ | {
237
+ kind: "manual";
238
+ description?: string;
239
+ }
240
+ | {
241
+ kind: "schedule";
242
+ cadence: "hourly" | "daily" | "weekly";
243
+ timezone?: string;
244
+ }
245
+ | {
246
+ kind: "hook";
247
+ event: WorkflowHookEvent;
248
+ };
249
+
250
+ export type WorkflowDefinitionV1 = {
251
+ workflowId: string;
252
+ version: typeof WORKFLOW_RUNTIME_SCHEMA_VERSION;
253
+ title: string;
254
+ description: string;
255
+ trigger: WorkflowTriggerContract;
256
+ staffingHint?: WorkflowStaffingHint;
257
+ proofArtifacts?: WorkflowProofArtifact[];
258
+ autoFixPolicy?: WorkflowAutoFixPolicy;
259
+ actions: readonly WorkflowActionContract[];
260
+ hooks?: readonly WorkflowHookContract[];
261
+ outputs: readonly WorkflowOutputKind[];
262
+ integrityChecks?: readonly WorkflowIntegrityCheckId[];
263
+ };
264
+
265
+ export type WorkflowRunReceiptV1 = {
266
+ runId: string;
267
+ workflowId: string;
268
+ status: WorkflowRunStatus;
269
+ triggeredBy: WorkflowTriggerKind;
270
+ startedAt: number;
271
+ completedAt?: number;
272
+ outputKinds: WorkflowOutputKind[];
273
+ approvalsRequired?: number;
274
+ };
275
+
276
+ export const NIGHTLY_RECONCILIATION_WORKFLOW_ID =
277
+ "workflow.pipeline_reconciliation.v1" as const;
278
+
279
+ export const MORNING_BRIEF_WORKFLOW_ID =
280
+ "workflow.morning_brief.v1" as const;
281
+
282
+ export const CANONICAL_WORKFLOW_DEFINITIONS: readonly WorkflowDefinitionV1[] = [
283
+ {
284
+ workflowId: NIGHTLY_RECONCILIATION_WORKFLOW_ID,
285
+ version: WORKFLOW_RUNTIME_SCHEMA_VERSION,
286
+ title: "Nightly Pipeline Reconciliation",
287
+ description:
288
+ "Runs deterministic integrity checks, compiles pipeline state, and emits an operator-facing reconciliation brief.",
289
+ trigger: {
290
+ kind: "schedule",
291
+ cadence: "daily",
292
+ timezone: "America/New_York",
293
+ },
294
+ staffingHint: "backend+tests",
295
+ proofArtifacts: [
296
+ {
297
+ kind: "report",
298
+ label: "Pipeline reconciliation report",
299
+ required: true,
300
+ },
301
+ {
302
+ kind: "test_evidence",
303
+ label: "Integrity check receipt",
304
+ required: true,
305
+ },
306
+ ],
307
+ autoFixPolicy: {
308
+ mode: "safe",
309
+ maxActionsPerRun: 5,
310
+ permittedMutationTiers: ["read_only", "low_risk_write"],
311
+ requireAuditTrail: true,
312
+ escalationGate: "gate:workflow-runtime-contract-live",
313
+ },
314
+ actions: [
315
+ {
316
+ actionId: "compile_context_pack",
317
+ kind: "context_pack",
318
+ title: "Compile pipeline context",
319
+ description: "Build the ranked context needed for deterministic checks.",
320
+ mutationTier: "read_only",
321
+ produces: ["structured_payload"],
322
+ idempotent: true,
323
+ approval: { mode: "none" },
324
+ },
325
+ {
326
+ actionId: "run_integrity_checks",
327
+ kind: "integrity_check",
328
+ title: "Run integrity checks",
329
+ description:
330
+ "Evaluate dependency references, blockers, execution bands, shaping coverage, and completed gates.",
331
+ mutationTier: "read_only",
332
+ produces: ["structured_payload"],
333
+ idempotent: true,
334
+ approval: { mode: "none" },
335
+ },
336
+ {
337
+ actionId: "record_followup_questions",
338
+ kind: "lucern_tool",
339
+ title: "Record follow-up questions",
340
+ description:
341
+ "Create or reopen operator-facing questions for integrity failures that require human review.",
342
+ mutationTier: "low_risk_write",
343
+ toolName: "create_question",
344
+ produces: ["pipeline_brief"],
345
+ approval: { mode: "audit_only", rationaleRequired: true },
346
+ },
347
+ {
348
+ actionId: "publish_reconciliation_brief",
349
+ kind: "brief_publish",
350
+ title: "Publish reconciliation brief",
351
+ description:
352
+ "Emit an inbox-routed brief summarizing the nightly pipeline state and grouped blockers.",
353
+ mutationTier: "low_risk_write",
354
+ produces: ["pipeline_brief", "inbox_summary"],
355
+ approval: { mode: "audit_only" },
356
+ },
357
+ ],
358
+ hooks: [
359
+ {
360
+ hookId: "nightly-schedule",
361
+ event: "schedule.tick",
362
+ description: "Run once per nightly cadence.",
363
+ actionIds: [
364
+ "compile_context_pack",
365
+ "run_integrity_checks",
366
+ "record_followup_questions",
367
+ "publish_reconciliation_brief",
368
+ ],
369
+ },
370
+ ],
371
+ outputs: ["pipeline_brief", "inbox_summary", "structured_payload"],
372
+ integrityChecks: WORKFLOW_INTEGRITY_CHECKS,
373
+ },
374
+ {
375
+ workflowId: MORNING_BRIEF_WORKFLOW_ID,
376
+ version: WORKFLOW_RUNTIME_SCHEMA_VERSION,
377
+ title: "Morning Brief",
378
+ description:
379
+ "Compiles a developer-facing morning brief from graph state, overnight workflow outputs, and inbox routing preferences.",
380
+ trigger: {
381
+ kind: "schedule",
382
+ cadence: "daily",
383
+ timezone: "America/New_York",
384
+ },
385
+ staffingHint: "solo",
386
+ proofArtifacts: [
387
+ {
388
+ kind: "brief",
389
+ label: "Morning brief",
390
+ required: true,
391
+ },
392
+ ],
393
+ autoFixPolicy: {
394
+ mode: "dry_run",
395
+ maxActionsPerRun: 1,
396
+ permittedMutationTiers: ["read_only", "low_risk_write"],
397
+ requireAuditTrail: true,
398
+ },
399
+ actions: [
400
+ {
401
+ actionId: "compile_brief_inputs",
402
+ kind: "context_pack",
403
+ title: "Compile brief inputs",
404
+ description:
405
+ "Read graph state, worktree state, and overnight workflow receipts.",
406
+ mutationTier: "read_only",
407
+ produces: ["structured_payload"],
408
+ idempotent: true,
409
+ approval: { mode: "none" },
410
+ },
411
+ {
412
+ actionId: "publish_morning_brief",
413
+ kind: "brief_publish",
414
+ title: "Publish morning brief",
415
+ description:
416
+ "Publish a typed inbox summary with prioritized worktree and question context.",
417
+ mutationTier: "low_risk_write",
418
+ produces: ["engineering_brief", "inbox_summary"],
419
+ approval: { mode: "audit_only" },
420
+ },
421
+ ],
422
+ hooks: [
423
+ {
424
+ hookId: "morning-schedule",
425
+ event: "schedule.tick",
426
+ description: "Run once per morning cadence.",
427
+ actionIds: ["compile_brief_inputs", "publish_morning_brief"],
428
+ },
429
+ {
430
+ hookId: "worktree-complete-refresh",
431
+ event: "worktree.completed",
432
+ description:
433
+ "Refresh the queued morning brief inputs when worktree outcomes land overnight.",
434
+ actionIds: ["compile_brief_inputs"],
435
+ },
436
+ ],
437
+ outputs: ["engineering_brief", "inbox_summary", "structured_payload"],
438
+ integrityChecks: ["sparse_shaping"],
439
+ },
440
+ ] as const;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Worktree API Contract v1
3
+ *
4
+ * Defines the public surface for worktree operations:
5
+ * add, activate, merge, targets, metadata, tasks.
6
+ * Migrates from front-end/lucern/contracts/ during EK-16.
7
+ */
8
+ export {};
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "rootDir": "src"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
@@ -1,59 +0,0 @@
1
- /**
2
- * API Enum Contract Definitions
3
- *
4
- * Canonical enum values for all API-facing enumerations.
5
- * These are co-equal with MCP contracts as external contracts.
6
- * SDK types are DERIVED from these — not independently authored.
7
- *
8
- * CONTRACT SURFACE: Adding a new enum value is additive (non-breaking).
9
- * Removing or renaming an existing value is a BREAKING CHANGE.
10
- */
11
- /** Fork reasons — why a scored belief was branched */
12
- export declare const FORK_REASONS: readonly ["refinement", "contradiction_response", "scope_change", "confidence_collapse", "manual"];
13
- export type ForkReason = (typeof FORK_REASONS)[number];
14
- /** Confidence modulation triggers — what caused a confidence change */
15
- export declare const CONFIDENCE_TRIGGERS: readonly ["evidence_added", "contradiction_detected", "merge_outcome", "manual", "decay"];
16
- export type ConfidenceTrigger = (typeof CONFIDENCE_TRIGGERS)[number];
17
- /** Belief status — lifecycle state */
18
- export declare const BELIEF_STATUSES: readonly ["unscored", "scored", "archived"];
19
- export type BeliefStatus = (typeof BELIEF_STATUSES)[number];
20
- /** Reasoning methods — how an edge relationship was determined */
21
- export declare const REASONING_METHODS: readonly ["deductive", "inductive", "abductive", "analogical", "empirical"];
22
- export type ReasoningMethod = (typeof REASONING_METHODS)[number];
23
- /** Defeat types (Pollock taxonomy) — how a contradiction operates */
24
- export declare const DEFEAT_TYPES: readonly ["rebuts", "undercuts", "undermines"];
25
- export type DefeatType = (typeof DEFEAT_TYPES)[number];
26
- /** Contradiction severity levels */
27
- export declare const CONTRADICTION_SEVERITIES: readonly ["low", "medium", "high", "critical"];
28
- export type ContradictionSeverity = (typeof CONTRADICTION_SEVERITIES)[number];
29
- /** Contradiction resolution status */
30
- export declare const CONTRADICTION_STATUSES: readonly ["unresolved", "resolved", "accepted"];
31
- export type ContradictionStatus = (typeof CONTRADICTION_STATUSES)[number];
32
- /** Merge outcome types — how a worktree merge resolved */
33
- export declare const MERGE_OUTCOMES: readonly ["validated", "invalidated", "forked", "inconclusive"];
34
- export type MergeOutcome = (typeof MERGE_OUTCOMES)[number];
35
- /** Worktree phases — investigation lifecycle within a checked-out worktree */
36
- export declare const WORKTREE_PHASES: readonly ["hypothesis", "investigation", "evaluation", "resolution"];
37
- export type WorktreePhase = (typeof WORKTREE_PHASES)[number];
38
- /** Branch status — thematic branch lifecycle */
39
- export declare const BRANCH_STATUSES: readonly ["dormant", "active", "archived"];
40
- export type BranchStatus = (typeof BRANCH_STATUSES)[number];
41
- /** Pull request status — review lifecycle before merge */
42
- export declare const PULL_REQUEST_STATUSES: readonly ["pending_review", "changes_requested", "approved", "blocked"];
43
- export type PullRequestStatus = (typeof PULL_REQUEST_STATUSES)[number];
44
- /** Epistemic layers — the hierarchy of knowledge */
45
- export declare const EPISTEMIC_LAYERS: readonly ["L1", "L2", "L3", "L4"];
46
- export type EpistemicLayer = (typeof EPISTEMIC_LAYERS)[number];
47
- /**
48
- * Judgment type — classification of the determination.
49
- *
50
- * Phase 1: These are new enum values for the Judgment (L4) vocabulary.
51
- * The existing code uses "Decision" — these are the forward-looking terms
52
- * that will eventually replace the Decision vocabulary (Phase 2-3).
53
- */
54
- export declare const JUDGMENT_TYPES: readonly ["investment_thesis", "thesis_maturity", "contradiction_ruling", "scope_determination", "confidence_ruling"];
55
- export type JudgmentType = (typeof JUDGMENT_TYPES)[number];
56
- /** Core edge types used in the Integration Surfaces */
57
- export declare const INTEGRATION_EDGE_TYPES: readonly ["informs", "grounds", "answers", "contradicts", "supports", "depends_on", "derived_from", "contains", "supersedes", "tests"];
58
- export type IntegrationEdgeType = (typeof INTEGRATION_EDGE_TYPES)[number];
59
- //# sourceMappingURL=api-enums.contract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-enums.contract.d.ts","sourceRoot":"","sources":["../src/api-enums.contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,sDAAsD;AACtD,eAAO,MAAM,YAAY,oGAMf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,2FAMtB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,sCAAsC;AACtC,eAAO,MAAM,eAAe,6CAIlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM5D,kEAAkE;AAClE,eAAO,MAAM,iBAAiB,6EAMpB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,qEAAqE;AACrE,eAAO,MAAM,YAAY,gDAIf,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvD,oCAAoC;AACpC,eAAO,MAAM,wBAAwB,gDAK3B,CAAC;AACX,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,sCAAsC;AACtC,eAAO,MAAM,sBAAsB,iDAIzB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM1E,0DAA0D;AAC1D,eAAO,MAAM,cAAc,iEAKjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,8EAA8E;AAC9E,eAAO,MAAM,eAAe,sEAKlB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM7D,gDAAgD;AAChD,eAAO,MAAM,eAAe,4CAIlB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAM5D,0DAA0D;AAC1D,eAAO,MAAM,qBAAqB,yEAKxB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMvE,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,mCAKnB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAM/D;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,uHAMjB,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAM3D,uDAAuD;AACvD,eAAO,MAAM,sBAAsB,wIAczB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC"}