openplanr 1.16.2 → 1.18.0

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 (128) hide show
  1. package/dist/cli/commands/operate.d.ts +10 -1
  2. package/dist/cli/commands/operate.d.ts.map +1 -1
  3. package/dist/cli/commands/operate.js +240 -13
  4. package/dist/cli/commands/operate.js.map +1 -1
  5. package/dist/services/ai-service.d.ts +25 -0
  6. package/dist/services/ai-service.d.ts.map +1 -1
  7. package/dist/services/ai-service.js +38 -0
  8. package/dist/services/ai-service.js.map +1 -1
  9. package/dist/services/operate/advisors.d.ts +82 -1
  10. package/dist/services/operate/advisors.d.ts.map +1 -1
  11. package/dist/services/operate/advisors.js +469 -17
  12. package/dist/services/operate/advisors.js.map +1 -1
  13. package/dist/services/operate/artifacts.d.ts +27 -1
  14. package/dist/services/operate/artifacts.d.ts.map +1 -1
  15. package/dist/services/operate/artifacts.js +103 -1
  16. package/dist/services/operate/artifacts.js.map +1 -1
  17. package/dist/services/operate/cadence.d.ts +50 -0
  18. package/dist/services/operate/cadence.d.ts.map +1 -0
  19. package/dist/services/operate/cadence.js +56 -0
  20. package/dist/services/operate/cadence.js.map +1 -0
  21. package/dist/services/operate/citation-resolution.d.ts +101 -0
  22. package/dist/services/operate/citation-resolution.d.ts.map +1 -0
  23. package/dist/services/operate/citation-resolution.js +308 -0
  24. package/dist/services/operate/citation-resolution.js.map +1 -0
  25. package/dist/services/operate/config.d.ts +93 -1
  26. package/dist/services/operate/config.d.ts.map +1 -1
  27. package/dist/services/operate/config.js +199 -9
  28. package/dist/services/operate/config.js.map +1 -1
  29. package/dist/services/operate/decision-brief.d.ts +148 -0
  30. package/dist/services/operate/decision-brief.d.ts.map +1 -0
  31. package/dist/services/operate/decision-brief.js +194 -0
  32. package/dist/services/operate/decision-brief.js.map +1 -0
  33. package/dist/services/operate/doctor.d.ts.map +1 -1
  34. package/dist/services/operate/doctor.js +271 -3
  35. package/dist/services/operate/doctor.js.map +1 -1
  36. package/dist/services/operate/engine.d.ts +66 -2
  37. package/dist/services/operate/engine.d.ts.map +1 -1
  38. package/dist/services/operate/engine.js +219 -7
  39. package/dist/services/operate/engine.js.map +1 -1
  40. package/dist/services/operate/event-store.d.ts +35 -1
  41. package/dist/services/operate/event-store.d.ts.map +1 -1
  42. package/dist/services/operate/event-store.js +142 -29
  43. package/dist/services/operate/event-store.js.map +1 -1
  44. package/dist/services/operate/evidence-cache.d.ts +25 -1
  45. package/dist/services/operate/evidence-cache.d.ts.map +1 -1
  46. package/dist/services/operate/evidence-cache.js +62 -1
  47. package/dist/services/operate/evidence-cache.js.map +1 -1
  48. package/dist/services/operate/evidence.d.ts +20 -1
  49. package/dist/services/operate/evidence.d.ts.map +1 -1
  50. package/dist/services/operate/evidence.js +148 -0
  51. package/dist/services/operate/evidence.js.map +1 -1
  52. package/dist/services/operate/index.d.ts +2 -0
  53. package/dist/services/operate/index.d.ts.map +1 -1
  54. package/dist/services/operate/index.js +309 -46
  55. package/dist/services/operate/index.js.map +1 -1
  56. package/dist/services/operate/interaction/action-service.d.ts +17 -0
  57. package/dist/services/operate/interaction/action-service.d.ts.map +1 -1
  58. package/dist/services/operate/interaction/action-service.js +19 -0
  59. package/dist/services/operate/interaction/action-service.js.map +1 -1
  60. package/dist/services/operate/interaction/answer-service.d.ts +17 -0
  61. package/dist/services/operate/interaction/answer-service.d.ts.map +1 -1
  62. package/dist/services/operate/interaction/answer-service.js +49 -7
  63. package/dist/services/operate/interaction/answer-service.js.map +1 -1
  64. package/dist/services/operate/interaction/question-engine.d.ts.map +1 -1
  65. package/dist/services/operate/interaction/question-engine.js +9 -3
  66. package/dist/services/operate/interaction/question-engine.js.map +1 -1
  67. package/dist/services/operate/interaction/question-registry.d.ts +13 -0
  68. package/dist/services/operate/interaction/question-registry.d.ts.map +1 -1
  69. package/dist/services/operate/interaction/question-registry.js +116 -26
  70. package/dist/services/operate/interaction/question-registry.js.map +1 -1
  71. package/dist/services/operate/interaction/terminal-renderer.d.ts +12 -1
  72. package/dist/services/operate/interaction/terminal-renderer.d.ts.map +1 -1
  73. package/dist/services/operate/interaction/terminal-renderer.js +26 -15
  74. package/dist/services/operate/interaction/terminal-renderer.js.map +1 -1
  75. package/dist/services/operate/journal.d.ts.map +1 -1
  76. package/dist/services/operate/journal.js +11 -5
  77. package/dist/services/operate/journal.js.map +1 -1
  78. package/dist/services/operate/lifecycle.d.ts +8 -0
  79. package/dist/services/operate/lifecycle.d.ts.map +1 -1
  80. package/dist/services/operate/lifecycle.js +19 -1
  81. package/dist/services/operate/lifecycle.js.map +1 -1
  82. package/dist/services/operate/maintenance.d.ts +22 -0
  83. package/dist/services/operate/maintenance.d.ts.map +1 -1
  84. package/dist/services/operate/maintenance.js +406 -46
  85. package/dist/services/operate/maintenance.js.map +1 -1
  86. package/dist/services/operate/migration.d.ts +68 -0
  87. package/dist/services/operate/migration.d.ts.map +1 -0
  88. package/dist/services/operate/migration.js +235 -0
  89. package/dist/services/operate/migration.js.map +1 -0
  90. package/dist/services/operate/mission-dispatch.d.ts +193 -0
  91. package/dist/services/operate/mission-dispatch.d.ts.map +1 -0
  92. package/dist/services/operate/mission-dispatch.js +444 -0
  93. package/dist/services/operate/mission-dispatch.js.map +1 -0
  94. package/dist/services/operate/projection-persistence.d.ts +6 -0
  95. package/dist/services/operate/projection-persistence.d.ts.map +1 -1
  96. package/dist/services/operate/projection-persistence.js +87 -11
  97. package/dist/services/operate/projection-persistence.js.map +1 -1
  98. package/dist/services/operate/projection.d.ts +26 -1
  99. package/dist/services/operate/projection.d.ts.map +1 -1
  100. package/dist/services/operate/projection.js +62 -0
  101. package/dist/services/operate/projection.js.map +1 -1
  102. package/dist/services/operate/protocol.d.ts +50 -3
  103. package/dist/services/operate/protocol.d.ts.map +1 -1
  104. package/dist/services/operate/protocol.js +57 -5
  105. package/dist/services/operate/protocol.js.map +1 -1
  106. package/dist/services/operate/read-only-providers.d.ts +37 -0
  107. package/dist/services/operate/read-only-providers.d.ts.map +1 -1
  108. package/dist/services/operate/read-only-providers.js +130 -0
  109. package/dist/services/operate/read-only-providers.js.map +1 -1
  110. package/dist/services/operate/reports.d.ts +22 -0
  111. package/dist/services/operate/reports.d.ts.map +1 -1
  112. package/dist/services/operate/reports.js +226 -1
  113. package/dist/services/operate/reports.js.map +1 -1
  114. package/dist/services/operate/routes.d.ts.map +1 -1
  115. package/dist/services/operate/routes.js +79 -5
  116. package/dist/services/operate/routes.js.map +1 -1
  117. package/dist/services/operate/types.d.ts +139 -4
  118. package/dist/services/operate/types.d.ts.map +1 -1
  119. package/dist/services/operate/types.js +13 -0
  120. package/dist/services/operate/types.js.map +1 -1
  121. package/dist/services/operate/workspace.d.ts +7 -0
  122. package/dist/services/operate/workspace.d.ts.map +1 -1
  123. package/dist/services/operate/workspace.js +14 -5
  124. package/dist/services/operate/workspace.js.map +1 -1
  125. package/dist/services/runtime-manager-service.d.ts.map +1 -1
  126. package/dist/services/runtime-manager-service.js +25 -5
  127. package/dist/services/runtime-manager-service.js.map +1 -1
  128. package/package.json +2 -2
@@ -0,0 +1,308 @@
1
+ import { stat } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { resolvePipelinePackage } from '../pipeline-package-service.js';
5
+ import { resolvePlanrArtifactCitation } from './artifacts.js';
6
+ import { canonicalDigest } from './canonical.js';
7
+ import { assertOperatingArtifact } from './protocol.js';
8
+ import { gitRevisionResolves, readGitCommitSummary, readGitPathAtRevision, } from './read-only-providers.js';
9
+ import { redactSensitiveText } from './redaction.js';
10
+ import { OperateError, } from './types.js';
11
+ import { isPathInside } from './workspace.js';
12
+ /**
13
+ * FR3 (E-003) — resolve every citation an advisor returns against the cycle's
14
+ * pinned revision and snapshot the cited content into machine-local evidence.
15
+ *
16
+ * This module owns NO precedence and NO citation/gap shape. Every fact/reason
17
+ * mapping (path → line → revision → artifact) and the canonical resolution and
18
+ * unresolvable-citation gap records come from the installed pipeline's
19
+ * `lib/operate/citation.mjs` (`operating-citation@1.3.0`). This module supplies
20
+ * the facts — computed honestly against live git/`.planr/` state at the pinned
21
+ * revision — and, on a resolved outcome, snapshots the cited bytes through the
22
+ * standard redaction + secret-scan path before attaching the resulting evidence
23
+ * ID to the proposal. A citation with any unresolvable component NEVER produces
24
+ * an evidence ID: it fails closed into a gap, and its proposal never reaches
25
+ * consolidation.
26
+ *
27
+ * The one classification this module adds beyond the library — which by design
28
+ * has no repo access and cannot make it — is the DISTINCT dirty-working-tree
29
+ * rejection. The pin is frozen at cycle start; a citation into content that is
30
+ * present in the working tree but not committed at the pin would otherwise be
31
+ * indistinguishable from a fabricated path. Naming it distinctly keeps a
32
+ * legitimate finding that points at in-flight work from being silently
33
+ * discarded as a fabrication.
34
+ */
35
+ const DEFAULT_SNAPSHOT_TTL_MS = 24 * 60 * 60 * 1_000;
36
+ let cachedModule = null;
37
+ async function loadCitationModule() {
38
+ cachedModule ??= (async () => {
39
+ const pkg = resolvePipelinePackage(false);
40
+ if (!pkg) {
41
+ throw new OperateError('E_PIPELINE_NOT_INSTALLED', 'Citation resolution requires the pipeline package with Protocol v1.3 (operating-citation@1.3.0).');
42
+ }
43
+ const modulePath = path.join(pkg.root, 'lib', 'operate', 'citation.mjs');
44
+ const loaded = (await import(pathToFileURL(modulePath).href));
45
+ if (typeof loaded.resolveOperatingCitation !== 'function' ||
46
+ typeof loaded.validateOperatingCitation !== 'function' ||
47
+ typeof loaded.buildUnresolvableCitationGap !== 'function') {
48
+ throw new OperateError('E_PIPELINE_VERSION_INCOMPATIBLE', `Installed planr-pipeline ${pkg.version} does not export the Protocol v1.3 citation resolver.`);
49
+ }
50
+ return loaded;
51
+ })();
52
+ return cachedModule;
53
+ }
54
+ function citationKind(citation) {
55
+ if (typeof citation.repositoryPath === 'string')
56
+ return 'repo-path';
57
+ if (typeof citation.gitRevision === 'string')
58
+ return 'git-revision';
59
+ if (typeof citation.planrArtifactId === 'string')
60
+ return 'planr-artifact';
61
+ return null;
62
+ }
63
+ function stableCitationKey(citation) {
64
+ if (typeof citation.citationKey === 'string' && /^[A-Za-z0-9._-]+$/.test(citation.citationKey)) {
65
+ return citation.citationKey;
66
+ }
67
+ return `cite-${canonicalDigest(citation).slice('sha256:'.length, 34)}`;
68
+ }
69
+ function lineRangeWithin(range, lineCount) {
70
+ return (Number.isInteger(range.start) &&
71
+ Number.isInteger(range.end) &&
72
+ range.start >= 1 &&
73
+ range.end >= range.start &&
74
+ range.end <= lineCount);
75
+ }
76
+ async function workingTreeHasFile(projectRoot, relativePath) {
77
+ const root = path.resolve(projectRoot);
78
+ const target = path.resolve(root, relativePath);
79
+ if (!isPathInside(root, target))
80
+ return false;
81
+ try {
82
+ return (await stat(target)).isFile();
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
88
+ function dirtyWorkingTreeGap(citation, context, now) {
89
+ const range = citation.lineRange
90
+ ? ` lines ${citation.lineRange.start}-${citation.lineRange.end}`
91
+ : '';
92
+ const createdAt = now.toISOString();
93
+ const gap = {
94
+ kind: 'operating-data-gap',
95
+ schemaVersion: '1.0.0',
96
+ protocolVersion: '1.3.0',
97
+ id: `GAP-${canonicalDigest({ citation, reason: 'dirty-working-tree' }).slice('sha256:'.length)}`,
98
+ cycleId: context.cycleId,
99
+ category: 'unresolvable-citation',
100
+ question: `The repository path "${citation.repositoryPath}"${range} cites uncommitted working-tree ` +
101
+ `content that is not present at pinned revision ${citation.pinnedRevision}; commit the change ` +
102
+ 'or cite the pinned revision before this proposal can be accepted.',
103
+ reason: 'dirty-working-tree',
104
+ unblocks: [],
105
+ status: 'open',
106
+ owner: context.owner && context.owner.length > 0 ? context.owner : 'chair',
107
+ evidenceRefs: [],
108
+ createdAt,
109
+ updatedAt: createdAt,
110
+ };
111
+ return gap;
112
+ }
113
+ async function observeCitation(citation, context, sensitivity) {
114
+ const kind = citationKind(citation);
115
+ if (kind === 'repo-path' && citation.repositoryPath) {
116
+ const blob = await readGitPathAtRevision(context.projectRoot, citation.pinnedRevision, citation.repositoryPath);
117
+ const inWorkingTree = blob.exists
118
+ ? true
119
+ : await workingTreeHasFile(context.projectRoot, citation.repositoryPath);
120
+ return {
121
+ kind,
122
+ pathExistsAtRevision: blob.exists,
123
+ inWorkingTree,
124
+ content: blob.content,
125
+ lineCount: blob.lineCount,
126
+ location: citation.repositoryPath,
127
+ };
128
+ }
129
+ if (kind === 'git-revision' && citation.gitRevision) {
130
+ const resolves = await gitRevisionResolves(context.projectRoot, citation.gitRevision);
131
+ const summary = resolves
132
+ ? await readGitCommitSummary(context.projectRoot, citation.gitRevision)
133
+ : null;
134
+ return {
135
+ kind,
136
+ revisionResolves: resolves,
137
+ content: summary ?? `commit ${citation.gitRevision}`,
138
+ location: `git:${citation.gitRevision}`,
139
+ };
140
+ }
141
+ // planr-artifact
142
+ const resolution = await resolvePlanrArtifactCitation({
143
+ projectRoot: context.projectRoot,
144
+ pinnedRevision: citation.pinnedRevision,
145
+ artifactId: citation.planrArtifactId,
146
+ sensitivity,
147
+ });
148
+ return {
149
+ kind: 'planr-artifact',
150
+ artifactExists: resolution.artifactExists,
151
+ content: resolution.content,
152
+ location: resolution.location,
153
+ preRedacted: true,
154
+ };
155
+ }
156
+ function factsFor(citation, observation, cyclePinnedRevision, sensitivity) {
157
+ const facts = { sensitivity };
158
+ if (observation.kind === 'repo-path') {
159
+ facts.pathExistsAtRevision = observation.pathExistsAtRevision === true;
160
+ if (citation.lineRange) {
161
+ facts.lineRangeInBounds =
162
+ observation.pathExistsAtRevision === true &&
163
+ lineRangeWithin(citation.lineRange, observation.lineCount ?? 0);
164
+ }
165
+ facts.revisionIsCurrent = citation.pinnedRevision === cyclePinnedRevision;
166
+ }
167
+ else if (observation.kind === 'git-revision') {
168
+ facts.revisionIsCurrent =
169
+ citation.pinnedRevision === cyclePinnedRevision && observation.revisionResolves === true;
170
+ }
171
+ else {
172
+ facts.artifactExists = observation.artifactExists === true;
173
+ }
174
+ return facts;
175
+ }
176
+ /**
177
+ * Resolve one citation against the cycle's pinned revision. Never throws for a
178
+ * resolvable/unresolvable outcome: a resolved citation carries an `evidenceId`
179
+ * whose snapshot has been persisted to machine-local evidence; a rejected one
180
+ * carries a distinct `reason` and a single unresolvable-citation `gap`.
181
+ */
182
+ export async function resolveOperatingCitationAtPin(citation, context) {
183
+ const module = await loadCitationModule();
184
+ try {
185
+ module.validateOperatingCitation(citation);
186
+ }
187
+ catch (error) {
188
+ throw new OperateError('E_OPERATE_STATE_INVALID', `Citation is not a valid operating-citation@1.3.0 anchor: ${error instanceof Error ? error.message : String(error)}.`);
189
+ }
190
+ const now = context.now ?? new Date();
191
+ const citationKey = stableCitationKey(citation);
192
+ const keyed = { ...citation, citationKey };
193
+ const sensitivity = context.sensitivityFor?.(citation) ?? context.defaultSensitivity ?? 'internal';
194
+ const observation = await observeCitation(keyed, context, sensitivity);
195
+ // Distinct dirty-working-tree classification, ahead of the library's
196
+ // path-existence precedence: a cited path absent at the pin but present and
197
+ // uncommitted in a dirty working tree is named separately from a fabrication.
198
+ if (observation.kind === 'repo-path' &&
199
+ observation.pathExistsAtRevision === false &&
200
+ observation.inWorkingTree === true &&
201
+ context.descriptor.dirtyFingerprint !== null) {
202
+ const gap = await assertOperatingArtifact('operating-data-gap', dirtyWorkingTreeGap(keyed, context, now));
203
+ return {
204
+ citation: keyed,
205
+ citationKey,
206
+ outcome: 'rejected',
207
+ reason: 'dirty-working-tree',
208
+ gap,
209
+ sensitivity,
210
+ };
211
+ }
212
+ const facts = factsFor(keyed, observation, context.descriptor.pinnedRevision, sensitivity);
213
+ const resolution = module.resolveOperatingCitation(keyed, facts);
214
+ if (resolution.outcome === 'rejected') {
215
+ const gap = module.buildUnresolvableCitationGap(keyed, resolution, {
216
+ cycleId: context.cycleId,
217
+ createdAt: now.toISOString(),
218
+ owner: context.owner,
219
+ affectedRoles: context.affectedRoles,
220
+ });
221
+ return {
222
+ citation: keyed,
223
+ citationKey,
224
+ outcome: 'rejected',
225
+ reason: resolution.reason,
226
+ gap,
227
+ sensitivity,
228
+ };
229
+ }
230
+ // Resolved: snapshot the cited bytes through the standard redaction path and
231
+ // persist them as machine-local evidence under the resolver-minted id.
232
+ const rawContent = observation.content ?? '';
233
+ const content = observation.preRedacted ? rawContent : redactSensitiveText(rawContent).value;
234
+ await context.cache.putCitationSnapshot({
235
+ evidenceId: resolution.evidenceId,
236
+ citationKey,
237
+ snapshotDigest: resolution.snapshotDigest,
238
+ sourceLocation: observation.location ?? citationKey,
239
+ sensitivity,
240
+ content,
241
+ }, context.snapshotTtlMs ?? DEFAULT_SNAPSHOT_TTL_MS, now);
242
+ return {
243
+ citation: keyed,
244
+ citationKey,
245
+ outcome: 'resolved',
246
+ evidenceId: resolution.evidenceId,
247
+ snapshotDigest: resolution.snapshotDigest,
248
+ sensitivity,
249
+ };
250
+ }
251
+ /**
252
+ * Resolve and enforce every proposal's citations before consolidation. A
253
+ * proposal whose citations all resolve is accepted with its minted evidence IDs
254
+ * attached; a proposal with ANY unresolvable citation is dropped and a single
255
+ * unresolvable-citation gap is opened in its place. Nothing with an unresolved
256
+ * citation is ever returned in `accepted`, so it can never reach consolidation.
257
+ */
258
+ export async function enforceProposalCitations(proposals, context) {
259
+ const accepted = [];
260
+ const rejected = [];
261
+ const gapsById = new Map();
262
+ const evidenceIds = new Set();
263
+ const resolutions = [];
264
+ for (const proposal of proposals) {
265
+ const citations = Array.isArray(proposal.citations) ? proposal.citations : [];
266
+ const proposalResolutions = [];
267
+ for (const citation of citations) {
268
+ const resolved = await resolveOperatingCitationAtPin(citation, context);
269
+ proposalResolutions.push(resolved);
270
+ resolutions.push(resolved);
271
+ }
272
+ const rejectedCitations = proposalResolutions.filter((resolution) => resolution.outcome === 'rejected');
273
+ if (rejectedCitations.length > 0) {
274
+ // Exactly one gap per rejected proposal: the first rejected citation is the
275
+ // representative cause and owns the opened gap.
276
+ const primary = rejectedCitations[0];
277
+ if (primary.gap)
278
+ gapsById.set(primary.gap.id, primary.gap);
279
+ rejected.push({
280
+ proposalKey: proposal.proposalKey,
281
+ reason: primary.reason,
282
+ reasons: [
283
+ ...new Set(rejectedCitations
284
+ .map((resolution) => resolution.reason)
285
+ .filter((reason) => Boolean(reason))),
286
+ ].sort(),
287
+ gapId: primary.gap?.id ?? '',
288
+ });
289
+ continue;
290
+ }
291
+ const evidenceRefs = [
292
+ ...new Set(proposalResolutions
293
+ .map((resolution) => resolution.evidenceId)
294
+ .filter((id) => Boolean(id))),
295
+ ].sort();
296
+ for (const id of evidenceRefs)
297
+ evidenceIds.add(id);
298
+ accepted.push({ proposal, evidenceRefs });
299
+ }
300
+ return {
301
+ accepted,
302
+ rejected,
303
+ gaps: [...gapsById.values()].sort((left, right) => left.id.localeCompare(right.id)),
304
+ evidenceIds: [...evidenceIds].sort(),
305
+ resolutions,
306
+ };
307
+ }
308
+ //# sourceMappingURL=citation-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citation-resolution.js","sourceRoot":"","sources":["../../../src/services/operate/citation-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,YAAY,GAGb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;GAsB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C,MAAM,CAAC,CAAC,CAC1E;iBACF,CAAC,IAAI,EAAE;gBACR,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE;aAC7B,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,MAAM,YAAY,GAAG;YACnB,GAAG,IAAI,GAAG,CACR,mBAAmB;iBAChB,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;iBAC1C,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAC7C;SACF,CAAC,IAAI,EAAE,CAAC;QACT,KAAK,MAAM,EAAE,IAAI,YAAY;YAAE,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnD,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO;QACL,QAAQ;QACR,QAAQ;QACR,IAAI,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnF,WAAW,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,EAAE;QACpC,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { type JournalWrite } from './journal.js';
2
- import { type OperatingCharter, type OperatingConfig, type OperatingEventHead, type OperatingInitAnswers, type OperatingLocalPreferences, type OperatingProfile, type OperatingWorkspaceManifest } from './types.js';
2
+ import type { OperatingDispatchMode } from './mission-dispatch.js';
3
+ import { type OperatingCharter, type OperatingConfig, type OperatingEventHead, type OperatingInitAnswers, type OperatingLocalPreferences, type OperatingProfile, type OperatingRoleId, type OperatingWorkspaceManifest } from './types.js';
3
4
  export declare const OPERATING_PROFILES: readonly OperatingProfile[];
4
5
  export declare function listOperatingProfiles(): OperatingProfile[];
5
6
  export declare function getOperatingProfile(id: OperatingProfile['id']): OperatingProfile;
@@ -9,6 +10,96 @@ export declare function getOperatingProfile(id: OperatingProfile['id']): Operati
9
10
  * (including accidental secrets) never reach command results.
10
11
  */
11
12
  export declare function normalizeCustomOperatingProfile(value: unknown): Partial<OperatingProfile>;
13
+ /**
14
+ * Per-project dispatch-mode overrides (FR4 / E-004). A map of role IDs to a
15
+ * `pack | mission` selection that overrides the derived v1.3 registry default.
16
+ *
17
+ * These live in the machine-local `preferences.json`, NOT the schema-frozen
18
+ * `operating-config` artifact: the v1.2 on-disk config surface is frozen
19
+ * (`additionalProperties: false`), so v1.3 dispatch policy is carried in the
20
+ * local operating preferences alongside `sensitivityCeiling` and `runtime`.
21
+ */
22
+ export type OperatingDispatchModeOverrides = Record<OperatingRoleId, OperatingDispatchMode>;
23
+ /**
24
+ * Strictly allowlist per-project dispatch-mode overrides before they are echoed,
25
+ * persisted, or consumed by dispatch — mirroring the `normalizeCustomOperatingProfile`
26
+ * pattern. Keys must be known registry role IDs; values must be exactly `pack`
27
+ * or `mission`. Unknown roles or values fail closed with `E_OPERATE_CONFIG_INVALID`.
28
+ */
29
+ export declare function normalizeOperatingDispatchModeOverrides(value: unknown): OperatingDispatchModeOverrides;
30
+ /**
31
+ * Parse repeatable `--dispatch-mode-override <roleId>=<pack|mission>` CLI tokens
32
+ * into a validated override map. Each token must be exactly `roleId=mode`.
33
+ */
34
+ export declare function parseOperatingDispatchModeOverrideFlags(flags?: readonly string[]): OperatingDispatchModeOverrides;
35
+ /** Read the validated per-project dispatch-mode overrides, or `{}` when none set. */
36
+ export declare function readOperatingDispatchModeOverrides(projectRoot: string, options?: {
37
+ localRoot?: string;
38
+ }): Promise<OperatingDispatchModeOverrides>;
39
+ /**
40
+ * Merge validated dispatch-mode overrides into the machine-local preferences and
41
+ * persist atomically (temp + rename, mode 0o600), matching how initialization
42
+ * writes preferences.json. An override set to the registry default can be
43
+ * cleared by omitting it. Requires the project to have been initialized.
44
+ */
45
+ export declare function applyOperatingDispatchModeOverrides(input: {
46
+ projectRoot: string;
47
+ localRoot?: string;
48
+ overrides: OperatingDispatchModeOverrides;
49
+ }): Promise<{
50
+ dispatchModeOverrides: OperatingDispatchModeOverrides;
51
+ changed: boolean;
52
+ }>;
53
+ /**
54
+ * Read the persisted per-project cadence `lastRunAt` marker (FR8 / E-008), or
55
+ * `null` when no cycle has completed yet. Machine-local, alongside
56
+ * `dispatchModeOverrides`.
57
+ */
58
+ export declare function readOperatingLastRunAt(projectRoot: string, options?: {
59
+ localRoot?: string;
60
+ }): Promise<string | null>;
61
+ /**
62
+ * Persist the per-project cadence `lastRunAt` marker into the machine-local
63
+ * preferences atomically (temp + rename, mode 0o600), matching how dispatch-mode
64
+ * overrides are written. FR8 / E-008: recorded whenever a cycle reaches
65
+ * reviewable/blocked/closed so `operate status` can surface the pipeline's
66
+ * `nextDueAt` under an injected clock. `lastRunAt` is the injected cycle instant,
67
+ * never a wall-clock read here. Requires an initialized project.
68
+ */
69
+ export declare function recordOperatingLastRunAt(input: {
70
+ projectRoot: string;
71
+ localRoot?: string;
72
+ lastRunAt: string;
73
+ }): Promise<{
74
+ lastRunAt: string;
75
+ changed: boolean;
76
+ }>;
77
+ /**
78
+ * FR10 / T-008 default adapter session lease: 15 minutes. A prepared native
79
+ * adapter session expires this long after `prepare`, and each successful `record`
80
+ * refreshes the window forward from the moment the record lands. This was a
81
+ * hardcoded constant in `maintenance.ts`; it is now the machine-local default,
82
+ * overridable per project via `preferences.json`.
83
+ */
84
+ export declare const DEFAULT_ADAPTER_LEASE_DURATION_MS: number;
85
+ /**
86
+ * Strictly validate an optional adapter-lease duration (milliseconds) before it is
87
+ * echoed, persisted, or honored by the adapter lifecycle — mirroring the strict
88
+ * `normalizeOperatingDispatchModeOverrides` allowlisting pattern. The value must be
89
+ * an integer within [1 minute, 60 minutes]. A non-integer or out-of-range value
90
+ * fails closed with `E_OPERATE_CONFIG_INVALID` rather than silently clamping, so a
91
+ * corrupt preference never quietly weakens or extends the lease.
92
+ */
93
+ export declare function normalizeOperatingAdapterLeaseDurationMs(value: unknown): number;
94
+ /**
95
+ * Read the machine-local adapter-lease duration (milliseconds), or the 15-minute
96
+ * default when unset. Machine-local, alongside `dispatchModeOverrides` and
97
+ * `evidenceTtlMs`; a present value is bounded-validated so a corrupt preference is
98
+ * rejected rather than trusted.
99
+ */
100
+ export declare function readOperatingAdapterLeaseDurationMs(projectRoot: string, options?: {
101
+ localRoot?: string;
102
+ }): Promise<number>;
12
103
  export declare function normalizeCharter(input?: Partial<OperatingCharter>): OperatingCharter;
13
104
  /** Normalize already-validated questionnaire or explicit CLI answers once. */
14
105
  export declare function normalizeOperatingInitializationAnswers(input: OperatingInitAnswers): OperatingInitAnswers;
@@ -41,6 +132,7 @@ export declare function prepareOperatingInitialization(input: {
41
132
  charter?: Partial<OperatingCharter>;
42
133
  customProfile?: Partial<OperatingProfile>;
43
134
  componentRoots?: string[];
135
+ dispatchModeOverrides?: OperatingDispatchModeOverrides;
44
136
  localRoot?: string;
45
137
  now?: string;
46
138
  }): Promise<OperatingInitializationPreview>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/services/operate/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,YAAY,EAGlB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAIL,KAAK,gBAAgB,EAErB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EAIrB,KAAK,0BAA0B,EAChC,MAAM,YAAY,CAAC;AA8CpB,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EAehD,CAAC;AAEX,wBAAgB,qBAAqB,IAAI,gBAAgB,EAAE,CAE1D;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,C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