@lucern/sdk 0.2.0-alpha.5 → 0.2.0-alpha.7

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 (166) hide show
  1. package/.turbo/turbo-build.log +7 -0
  2. package/.turbo/turbo-typecheck.log +4 -0
  3. package/CHANGELOG.md +13 -0
  4. package/examples/README.md +69 -0
  5. package/examples/contradiction.ts +94 -0
  6. package/examples/investigation-context.ts +118 -0
  7. package/examples/questions-and-tasks.ts +55 -0
  8. package/examples/quickstart.ts +97 -0
  9. package/examples/shared.ts +318 -0
  10. package/examples/strict-public-types.ts +143 -0
  11. package/examples/worktree-lifecycle.ts +79 -0
  12. package/package.json +16 -59
  13. package/src/README.md +6 -0
  14. package/src/adminClient.ts +789 -0
  15. package/{dist/lib/platform/sdk/answersClient.d.ts → src/answersClient.ts} +17 -4
  16. package/src/audiencesClient.ts +209 -0
  17. package/src/auditClient.ts +50 -0
  18. package/src/beliefsClient.ts +319 -0
  19. package/src/client.ts +2647 -0
  20. package/src/contextClient.ts +130 -0
  21. package/src/contextFacade.ts +15 -0
  22. package/src/contextPackCompiler.ts +828 -0
  23. package/src/contextPackSchema.ts +251 -0
  24. package/src/contextTypes.ts +153 -0
  25. package/src/contracts/api-enums.contract.ts +202 -0
  26. package/src/contracts/auth-session.contract.ts +109 -0
  27. package/src/contracts/context-pack.contract.ts +700 -0
  28. package/src/contracts/contextPack.ts +1 -0
  29. package/src/contracts/index.ts +10 -0
  30. package/src/contracts/lens-filter.contract.ts +183 -0
  31. package/src/contracts/lens-workflow.contract.ts +162 -0
  32. package/src/contracts/lensFilter.ts +1 -0
  33. package/src/contracts/lensWorkflow.ts +1 -0
  34. package/src/contracts/mcp-tools.contract.ts +3636 -0
  35. package/src/contracts/mcpTools.ts +1 -0
  36. package/src/contracts/prompt.contract.ts +50 -0
  37. package/src/contracts/prompt.ts +1 -0
  38. package/src/contracts/sdk-tools.contract.ts +1457 -0
  39. package/src/contracts/sdkTools.ts +1 -0
  40. package/src/contracts/workflow-runtime.contract.ts +440 -0
  41. package/src/contracts/workflowRuntime.ts +1 -0
  42. package/src/controlObjectOwnership.ts +286 -0
  43. package/src/coreClient.ts +570 -0
  44. package/src/customTools.ts +398 -0
  45. package/src/decisionsClient.ts +286 -0
  46. package/src/domainContext.ts +15 -0
  47. package/src/events.ts +531 -0
  48. package/src/eventsCore.ts +168 -0
  49. package/src/facade/beliefs.ts +83 -0
  50. package/src/facade/context.ts +110 -0
  51. package/src/facade/contradictions.ts +29 -0
  52. package/src/facade/edges.ts +30 -0
  53. package/src/facade/events.ts +23 -0
  54. package/src/facade/evidence.ts +41 -0
  55. package/src/facade/graph.ts +38 -0
  56. package/src/facade/identity.ts +16 -0
  57. package/src/facade/ontologies.ts +34 -0
  58. package/src/facade/questions.ts +59 -0
  59. package/src/facade/search.ts +16 -0
  60. package/src/facade/tasks.ts +37 -0
  61. package/src/facade/topics.ts +42 -0
  62. package/src/facade/webhooks.ts +58 -0
  63. package/src/facade/worktrees.ts +51 -0
  64. package/src/gatewayFacades.ts +1666 -0
  65. package/src/graphClient.ts +529 -0
  66. package/src/harnessClient.ts +585 -0
  67. package/src/identityClient.ts +278 -0
  68. package/{dist/lib/platform/sdk/index.d.ts → src/index.ts} +3 -0
  69. package/src/learningClient.ts +95 -0
  70. package/src/mcpParityClient.ts +240 -0
  71. package/src/mcpParitySurface.ts +70 -0
  72. package/src/ontologyClient.ts +275 -0
  73. package/src/packRuntime.ts +3 -0
  74. package/src/packsClient.ts +260 -0
  75. package/src/policyClient.ts +572 -0
  76. package/src/promptCatalog.ts +1 -0
  77. package/src/realtime/index.ts +51 -0
  78. package/src/realtime/refs.ts +17 -0
  79. package/src/reportsClient.ts +99 -0
  80. package/src/schemaClient.ts +129 -0
  81. package/src/sdkSurface.ts +190 -0
  82. package/src/topicsClient.ts +243 -0
  83. package/src/types.ts +807 -0
  84. package/src/workflowClient.ts +826 -0
  85. package/tsconfig.json +9 -0
  86. package/dist/.generated +0 -2
  87. package/dist/index.d.ts +0 -3
  88. package/dist/index.js +0 -3
  89. package/dist/lib/platform/auth/credentials.d.ts +0 -5
  90. package/dist/lib/platform/auth/credentials.js +0 -40
  91. package/dist/lib/platform/sdk/adminClient.d.ts +0 -404
  92. package/dist/lib/platform/sdk/adminClient.js +0 -384
  93. package/dist/lib/platform/sdk/answersClient.js +0 -21
  94. package/dist/lib/platform/sdk/audiencesClient.d.ts +0 -93
  95. package/dist/lib/platform/sdk/audiencesClient.js +0 -111
  96. package/dist/lib/platform/sdk/auditClient.d.ts +0 -24
  97. package/dist/lib/platform/sdk/auditClient.js +0 -21
  98. package/dist/lib/platform/sdk/beliefsClient.d.ts +0 -157
  99. package/dist/lib/platform/sdk/beliefsClient.js +0 -124
  100. package/dist/lib/platform/sdk/client.d.ts +0 -2369
  101. package/dist/lib/platform/sdk/client.js +0 -1831
  102. package/dist/lib/platform/sdk/contextClient.d.ts +0 -21
  103. package/dist/lib/platform/sdk/contextClient.js +0 -86
  104. package/dist/lib/platform/sdk/contextPackCompiler.d.ts +0 -100
  105. package/dist/lib/platform/sdk/contextPackCompiler.js +0 -534
  106. package/dist/lib/platform/sdk/contextTypes.d.ts +0 -133
  107. package/dist/lib/platform/sdk/contextTypes.js +0 -1
  108. package/dist/lib/platform/sdk/controlObjectOwnership.d.ts +0 -308
  109. package/dist/lib/platform/sdk/controlObjectOwnership.js +0 -220
  110. package/dist/lib/platform/sdk/coreClient.d.ts +0 -139
  111. package/dist/lib/platform/sdk/coreClient.js +0 -366
  112. package/dist/lib/platform/sdk/customTools.d.ts +0 -83
  113. package/dist/lib/platform/sdk/customTools.js +0 -247
  114. package/dist/lib/platform/sdk/decisionsClient.d.ts +0 -106
  115. package/dist/lib/platform/sdk/decisionsClient.js +0 -129
  116. package/dist/lib/platform/sdk/domainContext.d.ts +0 -1
  117. package/dist/lib/platform/sdk/domainContext.js +0 -1
  118. package/dist/lib/platform/sdk/events.d.ts +0 -176
  119. package/dist/lib/platform/sdk/events.js +0 -261
  120. package/dist/lib/platform/sdk/gatewayFacades.d.ts +0 -586
  121. package/dist/lib/platform/sdk/gatewayFacades.js +0 -845
  122. package/dist/lib/platform/sdk/graphClient.d.ts +0 -266
  123. package/dist/lib/platform/sdk/graphClient.js +0 -235
  124. package/dist/lib/platform/sdk/harnessClient.d.ts +0 -309
  125. package/dist/lib/platform/sdk/harnessClient.js +0 -219
  126. package/dist/lib/platform/sdk/identityClient.d.ts +0 -134
  127. package/dist/lib/platform/sdk/identityClient.js +0 -131
  128. package/dist/lib/platform/sdk/index.js +0 -46
  129. package/dist/lib/platform/sdk/learningClient.d.ts +0 -40
  130. package/dist/lib/platform/sdk/learningClient.js +0 -53
  131. package/dist/lib/platform/sdk/mcpParityClient.d.ts +0 -69
  132. package/dist/lib/platform/sdk/mcpParityClient.js +0 -196
  133. package/dist/lib/platform/sdk/mcpParitySurface.d.ts +0 -10
  134. package/dist/lib/platform/sdk/mcpParitySurface.js +0 -57
  135. package/dist/lib/platform/sdk/ontologyClient.d.ts +0 -131
  136. package/dist/lib/platform/sdk/ontologyClient.js +0 -161
  137. package/dist/lib/platform/sdk/packRuntime.d.ts +0 -1
  138. package/dist/lib/platform/sdk/packRuntime.js +0 -1
  139. package/dist/lib/platform/sdk/packsClient.d.ts +0 -126
  140. package/dist/lib/platform/sdk/packsClient.js +0 -157
  141. package/dist/lib/platform/sdk/policyClient.d.ts +0 -293
  142. package/dist/lib/platform/sdk/policyClient.js +0 -277
  143. package/dist/lib/platform/sdk/promptCatalog.d.ts +0 -1
  144. package/dist/lib/platform/sdk/promptCatalog.js +0 -1
  145. package/dist/lib/platform/sdk/reportsClient.d.ts +0 -34
  146. package/dist/lib/platform/sdk/reportsClient.js +0 -64
  147. package/dist/lib/platform/sdk/schemaClient.d.ts +0 -59
  148. package/dist/lib/platform/sdk/schemaClient.js +0 -71
  149. package/dist/lib/platform/sdk/sdkSurface.d.ts +0 -56
  150. package/dist/lib/platform/sdk/sdkSurface.js +0 -140
  151. package/dist/lib/platform/sdk/topicsClient.d.ts +0 -78
  152. package/dist/lib/platform/sdk/topicsClient.js +0 -118
  153. package/dist/lib/platform/sdk/types.d.ts +0 -692
  154. package/dist/lib/platform/sdk/types.js +0 -1
  155. package/dist/lib/platform/sdk/version.d.ts +0 -2
  156. package/dist/lib/platform/sdk/workflowClient.d.ts +0 -313
  157. package/dist/lib/platform/sdk/workflowClient.js +0 -366
  158. package/dist/lucern/contracts/src/api-enums.contract.d.ts +0 -58
  159. package/dist/lucern/contracts/src/api-enums.contract.js +0 -147
  160. package/dist/lucern/contracts/src/lens-filter.contract.d.ts +0 -70
  161. package/dist/lucern/contracts/src/lens-filter.contract.js +0 -95
  162. package/dist/lucern/contracts/src/lens-workflow.contract.d.ts +0 -84
  163. package/dist/lucern/contracts/src/lens-workflow.contract.js +0 -54
  164. package/dist/lucern/contracts/src/mcp-tools.contract.d.ts +0 -151
  165. package/dist/lucern/contracts/src/mcp-tools.contract.js +0 -3281
  166. /package/{dist/lib/platform/sdk/version.js → src/version.ts} +0 -0
@@ -0,0 +1 @@
1
+ export * from "./sdk-tools.contract";
@@ -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 @@
1
+ export * from "./workflow-runtime.contract";