@dsh-enhanced/assistant-work-items 0.0.0-stage → 0.1.66

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 (152) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +685 -2
  3. package/cordis.patch.yml +11 -0
  4. package/lib/acceptance-binding.d.ts +86 -0
  5. package/lib/acceptance-binding.d.ts.map +1 -0
  6. package/lib/acceptance-binding.js +250 -0
  7. package/lib/acceptance-binding.js.map +1 -0
  8. package/lib/admission.d.ts +95 -0
  9. package/lib/admission.d.ts.map +1 -0
  10. package/lib/admission.js +642 -0
  11. package/lib/admission.js.map +1 -0
  12. package/lib/authority.d.ts +92 -0
  13. package/lib/authority.d.ts.map +1 -0
  14. package/lib/authority.js +205 -0
  15. package/lib/authority.js.map +1 -0
  16. package/lib/config.d.ts +365 -0
  17. package/lib/config.d.ts.map +1 -0
  18. package/lib/config.js +672 -0
  19. package/lib/config.js.map +1 -0
  20. package/lib/continuation-contract.d.ts +126 -0
  21. package/lib/continuation-contract.d.ts.map +1 -0
  22. package/lib/continuation-contract.js +109 -0
  23. package/lib/continuation-contract.js.map +1 -0
  24. package/lib/continuation-record.d.ts +32 -0
  25. package/lib/continuation-record.d.ts.map +1 -0
  26. package/lib/continuation-record.js +57 -0
  27. package/lib/continuation-record.js.map +1 -0
  28. package/lib/continuation.d.ts +89 -0
  29. package/lib/continuation.d.ts.map +1 -0
  30. package/lib/continuation.js +607 -0
  31. package/lib/continuation.js.map +1 -0
  32. package/lib/diagnosis-contract.d.ts +95 -0
  33. package/lib/diagnosis-contract.d.ts.map +1 -0
  34. package/lib/diagnosis-contract.js +167 -0
  35. package/lib/diagnosis-contract.js.map +1 -0
  36. package/lib/diagnosis.d.ts +70 -0
  37. package/lib/diagnosis.d.ts.map +1 -0
  38. package/lib/diagnosis.js +466 -0
  39. package/lib/diagnosis.js.map +1 -0
  40. package/lib/dispatch.d.ts +100 -0
  41. package/lib/dispatch.d.ts.map +1 -0
  42. package/lib/dispatch.js +317 -0
  43. package/lib/dispatch.js.map +1 -0
  44. package/lib/engineering-context.d.ts +86 -0
  45. package/lib/engineering-context.d.ts.map +1 -0
  46. package/lib/engineering-context.js +263 -0
  47. package/lib/engineering-context.js.map +1 -0
  48. package/lib/evaluation.d.ts +125 -0
  49. package/lib/evaluation.d.ts.map +1 -0
  50. package/lib/evaluation.js +295 -0
  51. package/lib/evaluation.js.map +1 -0
  52. package/lib/event-follow.d.ts +93 -0
  53. package/lib/event-follow.d.ts.map +1 -0
  54. package/lib/event-follow.js +150 -0
  55. package/lib/event-follow.js.map +1 -0
  56. package/lib/feedback-targets.d.ts +91 -0
  57. package/lib/feedback-targets.d.ts.map +1 -0
  58. package/lib/feedback-targets.js +362 -0
  59. package/lib/feedback-targets.js.map +1 -0
  60. package/lib/index.d.ts +27 -0
  61. package/lib/index.d.ts.map +1 -0
  62. package/lib/index.js +25 -0
  63. package/lib/index.js.map +1 -0
  64. package/lib/intake-admission.d.ts +49 -0
  65. package/lib/intake-admission.d.ts.map +1 -0
  66. package/lib/intake-admission.js +100 -0
  67. package/lib/intake-admission.js.map +1 -0
  68. package/lib/intake-evaluation-runtime.d.ts +74 -0
  69. package/lib/intake-evaluation-runtime.d.ts.map +1 -0
  70. package/lib/intake-evaluation-runtime.js +343 -0
  71. package/lib/intake-evaluation-runtime.js.map +1 -0
  72. package/lib/intake-evaluation.d.ts +180 -0
  73. package/lib/intake-evaluation.d.ts.map +1 -0
  74. package/lib/intake-evaluation.js +440 -0
  75. package/lib/intake-evaluation.js.map +1 -0
  76. package/lib/intake.d.ts +118 -0
  77. package/lib/intake.d.ts.map +1 -0
  78. package/lib/intake.js +137 -0
  79. package/lib/intake.js.map +1 -0
  80. package/lib/ledger.d.ts +86 -0
  81. package/lib/ledger.d.ts.map +1 -0
  82. package/lib/ledger.js +145 -0
  83. package/lib/ledger.js.map +1 -0
  84. package/lib/mandate.d.ts +45 -0
  85. package/lib/mandate.d.ts.map +1 -0
  86. package/lib/mandate.js +168 -0
  87. package/lib/mandate.js.map +1 -0
  88. package/lib/outcome.d.ts +137 -0
  89. package/lib/outcome.d.ts.map +1 -0
  90. package/lib/outcome.js +303 -0
  91. package/lib/outcome.js.map +1 -0
  92. package/lib/owner-access.d.ts +35 -0
  93. package/lib/owner-access.d.ts.map +1 -0
  94. package/lib/owner-access.js +152 -0
  95. package/lib/owner-access.js.map +1 -0
  96. package/lib/owner-continuation.d.ts +27 -0
  97. package/lib/owner-continuation.d.ts.map +1 -0
  98. package/lib/owner-continuation.js +131 -0
  99. package/lib/owner-continuation.js.map +1 -0
  100. package/lib/owner-recall.d.ts +85 -0
  101. package/lib/owner-recall.d.ts.map +1 -0
  102. package/lib/owner-recall.js +134 -0
  103. package/lib/owner-recall.js.map +1 -0
  104. package/lib/owner-replies.d.ts +44 -0
  105. package/lib/owner-replies.d.ts.map +1 -0
  106. package/lib/owner-replies.js +232 -0
  107. package/lib/owner-replies.js.map +1 -0
  108. package/lib/peers.d.ts +622 -0
  109. package/lib/peers.d.ts.map +1 -0
  110. package/lib/peers.js +10 -0
  111. package/lib/peers.js.map +1 -0
  112. package/lib/policy-notice.d.ts +31 -0
  113. package/lib/policy-notice.d.ts.map +1 -0
  114. package/lib/policy-notice.js +137 -0
  115. package/lib/policy-notice.js.map +1 -0
  116. package/lib/reply-contract.d.ts +67 -0
  117. package/lib/reply-contract.d.ts.map +1 -0
  118. package/lib/reply-contract.js +58 -0
  119. package/lib/reply-contract.js.map +1 -0
  120. package/lib/service.d.ts +625 -0
  121. package/lib/service.d.ts.map +1 -0
  122. package/lib/service.js +2388 -0
  123. package/lib/service.js.map +1 -0
  124. package/lib/settlement.d.ts +74 -0
  125. package/lib/settlement.d.ts.map +1 -0
  126. package/lib/settlement.js +233 -0
  127. package/lib/settlement.js.map +1 -0
  128. package/lib/signals.d.ts +176 -0
  129. package/lib/signals.d.ts.map +1 -0
  130. package/lib/signals.js +497 -0
  131. package/lib/signals.js.map +1 -0
  132. package/lib/store.d.ts +789 -0
  133. package/lib/store.d.ts.map +1 -0
  134. package/lib/store.js +3266 -0
  135. package/lib/store.js.map +1 -0
  136. package/lib/tools.d.ts +7 -0
  137. package/lib/tools.d.ts.map +1 -0
  138. package/lib/tools.js +443 -0
  139. package/lib/tools.js.map +1 -0
  140. package/lib/types.d.ts +831 -0
  141. package/lib/types.d.ts.map +1 -0
  142. package/lib/types.js +29 -0
  143. package/lib/types.js.map +1 -0
  144. package/lib/version.d.ts +2 -0
  145. package/lib/version.d.ts.map +1 -0
  146. package/lib/version.js +2 -0
  147. package/lib/version.js.map +1 -0
  148. package/lib/workspace.d.ts +43 -0
  149. package/lib/workspace.d.ts.map +1 -0
  150. package/lib/workspace.js +137 -0
  151. package/lib/workspace.js.map +1 -0
  152. package/package.json +101 -3
@@ -0,0 +1,317 @@
1
+ import { isActive } from "./config.js";
2
+ import { OPEN_STATES, WorkItemError } from "./types.js";
3
+ function fail(code, message, detail) {
4
+ throw new WorkItemError(code, message, detail);
5
+ }
6
+ function peerCode(error) {
7
+ if (error === null || typeof error !== 'object' || !('code' in error))
8
+ return 'unknown';
9
+ return String(error.code);
10
+ }
11
+ /**
12
+ * The two external effects of the ledger, both reused rather than reimplemented.
13
+ *
14
+ * `wake` hands one admitted item to the existing `assistant-automations`
15
+ * external-event intake, which owns the occurrence, the native agent run and
16
+ * the attempt budget. `notify` hands one terminal report to the existing
17
+ * `assistant-delivery` background outbox. Neither path owns a timer, an outbox
18
+ * or a session of its own.
19
+ */
20
+ export class WorkItemDispatch {
21
+ #deps;
22
+ #now;
23
+ constructor(dependencies) {
24
+ this.#deps = dependencies;
25
+ this.#now = dependencies.now ?? (() => Date.now());
26
+ }
27
+ /**
28
+ * Wake the worker automation for one dispatch generation.
29
+ *
30
+ * The event identity is read from the dispatch row, never reconstructed from
31
+ * the item: generation 0 uses the admission identity, and every re-arm has a
32
+ * distinct `(eventId, occurredAt)` pair so the automation intake starts a new
33
+ * occurrence instead of replaying the completed one. Within one generation
34
+ * the identity is stable, which is what makes a retry after a crash safe.
35
+ *
36
+ * Revalidation happens here, before the external effect: a revoked or
37
+ * unavailable mandate parks the item and returns `false` without creating an
38
+ * occurrence, so no worker run is ever started under a decision policy no
39
+ * longer supports. A later allow resumes the same row unchanged.
40
+ *
41
+ * Returns `true` only when this call actually handed the row to the worker.
42
+ */
43
+ wake(item) {
44
+ const config = this.#deps.config;
45
+ if (!isActive(config) || item.workerAutomationId !== config.workerAutomationId)
46
+ return false;
47
+ if (this.#deps.validateWake && !this.#deps.validateWake(item))
48
+ return false;
49
+ const automations = typeof this.#deps.automations === 'function' ? this.#deps.automations() : this.#deps.automations;
50
+ if (automations === undefined)
51
+ fail('missing-dependency', 'assistantAutomations is required to wake the worker');
52
+ const dispatch = this.#deps.store.getDispatch(item.id);
53
+ if (dispatch === undefined)
54
+ fail('storage', 'work item has no dispatch row');
55
+ // Only a pending row may wake: a dispatched row already owns an occurrence,
56
+ // and a failed one was withdrawn or refused, so waking it would hand
57
+ // cancelled work to a live automation before the guarded mark throws.
58
+ if (dispatch.state !== 'pending')
59
+ return false;
60
+ if (!this.#revalidate(item))
61
+ return false;
62
+ // Policy callbacks can synchronously cancel a reply or dispose its
63
+ // producer. Re-read the durable row and source fence after that callback,
64
+ // immediately before crossing the external occurrence boundary.
65
+ if (this.#deps.validateWake) {
66
+ const currentItem = this.#deps.store.findItemById(item.id), currentDispatch = this.#deps.store.getDispatch(item.id);
67
+ if (!currentItem || !currentDispatch || currentDispatch.state !== 'pending'
68
+ || currentDispatch.generation !== dispatch.generation || currentDispatch.eventId !== dispatch.eventId
69
+ || currentDispatch.occurredAt !== dispatch.occurredAt || !this.#deps.validateWake(currentItem)
70
+ || this.#deps.validateWakeLocal && !this.#deps.validateWakeLocal(currentItem)
71
+ || !this.#deps.store.isWakeSnapshotCurrent(currentItem, currentDispatch))
72
+ return false;
73
+ }
74
+ try {
75
+ const occurrence = automations.ingestExternal({
76
+ sourceId: config.intakeSourceId,
77
+ automationId: dispatch.automationId === '' ? (config.workerAutomationId ?? '') : dispatch.automationId,
78
+ eventId: dispatch.eventId,
79
+ occurredAt: dispatch.occurredAt,
80
+ });
81
+ this.#deps.store.markDispatchDispatched(item.id, occurrence.id);
82
+ return true;
83
+ }
84
+ catch (error) {
85
+ const code = peerCode(error);
86
+ // The persisted identity already belongs to a different event. Generation
87
+ // scoping makes this deterministic corruption rather than a replay, so it
88
+ // is recorded under its own reason and surfaced as a typed error instead
89
+ // of being laundered into a generic permanent failure.
90
+ if (code === 'idempotency-conflict') {
91
+ this.#deps.store.markDispatchFailed(item.id, 'idempotency-conflict');
92
+ throw new WorkItemError('dispatch-failed', 'worker automation wake hit a conflicting event identity', code);
93
+ }
94
+ // A fail-closed policy refusal is a definitive answer: the occurrence was
95
+ // never created, and re-waking cannot change the policy decision.
96
+ if (code === 'policy-denied' || code === 'policy') {
97
+ this.#deps.store.markDispatchFailed(item.id, 'policy-denied');
98
+ return false;
99
+ }
100
+ // Anything else is ambiguous: the peer may have committed the occurrence
101
+ // before the failure. Record that honestly and spend the generation's one
102
+ // bounded retry on the identical identity, so the retry either resolves
103
+ // the committed occurrence or creates it.
104
+ try {
105
+ this.#deps.store.markDispatchUnknown(item.id);
106
+ }
107
+ catch {
108
+ // If even the bookkeeping write fails, surface the original peer error;
109
+ // the row stays in whatever durable state the failed write left it.
110
+ }
111
+ throw new WorkItemError('dispatch-failed', 'worker automation wake outcome is unknown', code);
112
+ }
113
+ }
114
+ /**
115
+ * Apply the admission-mandate gate to one pending wake.
116
+ *
117
+ * A denied, missing, failing or malformed decision parks the item in
118
+ * `waiting` and returns `false`; an allow records the successful revalidation
119
+ * (lifting only a wait this gate created) and returns `true`. Items admitted
120
+ * before schema v7 have no basis and keep the legacy behaviour.
121
+ */
122
+ #revalidate(item) {
123
+ const authority = this.#deps.authority;
124
+ if (authority === undefined)
125
+ return true;
126
+ const check = authority.check(item);
127
+ if (check.kind === 'legacy')
128
+ return true;
129
+ if (check.kind === 'revoked') {
130
+ this.#deps.ledger.parkAuthority(item, 'authority-revoked', { reason: check.reasonCode });
131
+ return false;
132
+ }
133
+ if (check.kind === 'unavailable') {
134
+ this.#deps.ledger.parkAuthority(item, 'authority-unavailable', { reason: check.detail });
135
+ return false;
136
+ }
137
+ this.#deps.ledger.restoreAuthority(item);
138
+ return true;
139
+ }
140
+ /**
141
+ * Bounded lazy sweep over dispatch rows this host still owes a run.
142
+ *
143
+ * Unknown-outcome rows get their one same-generation retry first, then due
144
+ * pending rows are woken normally. Nothing here runs on a timer: the sweep is
145
+ * driven by the existing claim/admit/report touches and by startup.
146
+ */
147
+ wakePending(limit = 10) {
148
+ const woken = [];
149
+ const seen = new Set();
150
+ // One row's peer failure must not abort recovery for the rest: the durable
151
+ // row already records its own state/reason. Only the expected ambiguous-wake
152
+ // outcome is swallowed; a missing dependency, storage fault or invalid state
153
+ // is a host/programming error and must surface instead of sweeping silently.
154
+ const attempt = (itemId, retryUnknown) => {
155
+ const item = this.#deps.store.findItemById(itemId);
156
+ if (item === undefined || item.observed || !OPEN_STATES.includes(item.state)
157
+ || item.workerAutomationId !== this.#deps.config.workerAutomationId
158
+ || this.#deps.store.getContinuation(item.id) !== undefined)
159
+ return;
160
+ try {
161
+ if (retryUnknown)
162
+ this.#deps.store.retryUnknownDispatch(item.id);
163
+ if (this.wake(item))
164
+ woken.push(item);
165
+ }
166
+ catch (error) {
167
+ if (!(error instanceof WorkItemError) || error.code !== 'dispatch-failed')
168
+ throw error;
169
+ }
170
+ seen.add(item.id);
171
+ };
172
+ for (const dispatch of this.#deps.store.listRetryableUnknownDispatches(limit))
173
+ attempt(dispatch.itemId, true);
174
+ for (const dispatch of this.#deps.store.listOpenDispatches(limit)) {
175
+ if (seen.has(dispatch.itemId))
176
+ continue;
177
+ attempt(dispatch.itemId, false);
178
+ }
179
+ return Object.freeze(woken);
180
+ }
181
+ /** Build the owner-facing notification for one terminal report. */
182
+ notification(item, report, note) {
183
+ const lines = [
184
+ `**Work item ${report.status}: ${item.title}**`,
185
+ '',
186
+ report.summary,
187
+ '',
188
+ `- item: \`${item.id}\``,
189
+ `- kind: \`${item.kind}\``,
190
+ `- external id: \`${item.externalId}\``,
191
+ `- attempt: ${String(item.attempt)} of ${String(item.maxAttempts)}`,
192
+ ];
193
+ if (report.artifactPaths.length > 0) {
194
+ lines.push('', 'Artifacts:');
195
+ for (const path of report.artifactPaths)
196
+ lines.push(`- \`${path}\``);
197
+ }
198
+ if (report.truncated)
199
+ lines.push('', '_The report was truncated at the configured byte limit._');
200
+ if (note !== undefined)
201
+ lines.push('', note);
202
+ return Object.freeze({
203
+ item,
204
+ report,
205
+ text: lines.join('\n'),
206
+ idempotencyKey: report.deliveryKey,
207
+ format: 'markdown',
208
+ });
209
+ }
210
+ /** True when this report status escalates to the owner. */
211
+ shouldNotify(report) {
212
+ return this.#deps.config.notifyOn.includes(report.status);
213
+ }
214
+ /**
215
+ * Send one terminal notification through the delivery outbox.
216
+ *
217
+ * Delivery owns retry and the fail-closed policy check; the ledger only
218
+ * records the outcome, including `unknown` when the enqueue result is lost.
219
+ */
220
+ async notify(item, report) {
221
+ if (!isActive(this.#deps.config) || !this.shouldNotify(report))
222
+ return false;
223
+ return this.#deliver(item, report, complete => this.notification(item, complete));
224
+ }
225
+ /**
226
+ * WP21 slice 8 (`acceptance.holdReport`): send the report held while the
227
+ * verifier settles the binding. `achieved` sends the ordinary report,
228
+ * `unverified` sends it with an explicit timeout note, `blocked` sends a
229
+ * `blocked` report instead of the self-reported `ready` one, and `plain`
230
+ * recovers a row that lost its binding (or was never really held) by sending
231
+ * it exactly like an ordinary report. The delivery coordinates stay on the
232
+ * held report revision, so a crash or a later wake can never enqueue the same
233
+ * held report twice.
234
+ */
235
+ async notifyHeld(item, report, release) {
236
+ if (!isActive(this.#deps.config))
237
+ return false;
238
+ const target = release.kind === 'blocked'
239
+ ? Object.freeze({ ...report, status: 'blocked',
240
+ summary: `The independent verifier did not accept this work (${release.reason}). The worker reported: ${report.summary}` })
241
+ : report;
242
+ if (!this.shouldNotify(target))
243
+ return false;
244
+ const note = release.kind === 'unverified'
245
+ ? `_Unverified: no verifier verdict arrived within the ${String(Math.round(release.timeoutMs / 60_000))}-minute hold window, so this self-reported result was released on timeout._`
246
+ : undefined;
247
+ return this.#deliver(item, report, complete => {
248
+ const reported = release.kind === 'blocked'
249
+ ? Object.freeze({ ...complete, status: 'blocked',
250
+ summary: `The independent verifier did not accept this work (${release.reason}). The worker reported: ${complete.summary}` })
251
+ : complete;
252
+ const built = this.notification(item, reported, note);
253
+ // The blocked variant is a different message; give it its own delivery
254
+ // identity while still recording the outcome against the held revision.
255
+ return release.kind === 'blocked' ? Object.freeze({ ...built, idempotencyKey: `${report.deliveryKey}:blocked` }) : built;
256
+ });
257
+ }
258
+ async #deliver(item, report, build) {
259
+ const config = this.#deps.config;
260
+ const delivery = typeof this.#deps.delivery === 'function' ? this.#deps.delivery() : this.#deps.delivery;
261
+ if (delivery === undefined)
262
+ fail('missing-dependency', 'assistantDelivery is required to notify the owner');
263
+ // Feedback evidence binds the complete immutable bytes. Node 24's ordinary
264
+ // TEXT projection may hide a NUL suffix; use the bounded byte reader when
265
+ // this explicit metadata capability is enabled, without changing legacy sends.
266
+ const completeReport = config.ownerReportFeedback ? this.#deps.store.feedbackReportByRevision(item.id, report.revision) ?? report : report;
267
+ const notification = build(completeReport);
268
+ this.#deps.ledger.recordDelivery(item.id, report.revision, 'pending', null);
269
+ try {
270
+ const input = {
271
+ sourceId: config.intakeSourceId,
272
+ workspace: item.scope.workspace,
273
+ bindingId: item.originBindingId,
274
+ idempotencyKey: notification.idempotencyKey,
275
+ text: notification.text,
276
+ format: 'markdown',
277
+ };
278
+ // Opt-in cross-channel route: the Host keeps the origin while it is
279
+ // available and otherwise queues one inspect-only report on an owner-
280
+ // listed linked channel. Absent config never calls this seam.
281
+ const linkedFallback = config.ownerReportRouting?.linkedFallback;
282
+ if (linkedFallback !== undefined && typeof delivery.routeWorkItemReport === 'function') {
283
+ const routed = delivery.routeWorkItemReport({ sourceId: input.sourceId, workspace: input.workspace, originBindingId: input.bindingId,
284
+ idempotencyKey: input.idempotencyKey, text: input.text, format: input.format, itemId: item.id, reportRevision: report.revision, linkedFallback,
285
+ ...(config.ownerReportRouting?.prefer === 'recent' ? { prefer: 'recent' } : {}) });
286
+ if (routed.route === 'linked') {
287
+ this.#deps.ledger.recordDelivery(item.id, report.revision, 'sent', routed.outbox.id);
288
+ return true;
289
+ }
290
+ }
291
+ const typed = (config.ownerReplyContinuation || config.ownerReportFeedback) && delivery.workItemReplyProtocolVersion?.() === 1
292
+ && typeof delivery.enqueueWorkItemReport === 'function'
293
+ && this.#deps.replyReportEligible?.(item, completeReport, notification) === true;
294
+ // Eligibility is decided locally before the enqueue. Never fall back
295
+ // after an ambiguous typed enqueue, which could duplicate a real send.
296
+ const outbox = await (typed
297
+ ? delivery.enqueueWorkItemReport({ ...input, itemId: item.id, reportRevision: report.revision })
298
+ : delivery.enqueueBackground({ ...input, attention: { purpose: 'result', workItemId: item.id } }));
299
+ this.#deps.ledger.recordDelivery(item.id, report.revision, 'sent', outbox.id);
300
+ return true;
301
+ }
302
+ catch (error) {
303
+ const code = peerCode(error);
304
+ // A queue insert that may have committed before an ambiguous failure must
305
+ // never be retried blindly: mark it unknown so the owner sees the gap.
306
+ const state = code === 'missing-binding' || code === 'policy-denied' || code === 'runtime-conflict'
307
+ ? 'failed'
308
+ : 'unknown';
309
+ this.#deps.ledger.recordDelivery(item.id, report.revision, state, null);
310
+ throw new WorkItemError('dispatch-failed', 'owner notification failed', code);
311
+ }
312
+ }
313
+ now() {
314
+ return this.#now();
315
+ }
316
+ }
317
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKtC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM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AC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;YAC5B,0EAA0E;YAC1E,uEAAuE;YACvE,MAAM,KAAK,GAAG,IAAI,KAAK,iBAAiB,IAAI,IAAI,KAAK,eAAe,IAAI,IAAI,KAAK,kBAAkB;gBACjG,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,SAAS,CAAA;YACb,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;YACvE,MAAM,IAAI,aAAa,CAAC,iBAAiB,EAAE,2BAA2B,EAAE,IAAI,CAAC,CAAA;QAC/E,CAAC;IACH,CAAC;IAED,GAAG;QACD,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;CACF"}
@@ -0,0 +1,86 @@
1
+ import type { NormalizedConfig } from './config.js';
2
+ import type { WorkItemOwnerFeedbackTargets } from './feedback-targets.js';
3
+ import type { WorkItemStore } from './store.js';
4
+ export interface EngineeringReportRef {
5
+ readonly itemId: string;
6
+ readonly revision: number;
7
+ readonly digest: string;
8
+ readonly fullTextDigest: string;
9
+ readonly fullBytes: number;
10
+ readonly status: 'progress' | 'waiting' | 'ready' | 'blocked' | 'failed';
11
+ readonly truncated: boolean;
12
+ }
13
+ export interface EngineeringNode {
14
+ readonly itemId: string;
15
+ readonly planProtocol: 'assistant-work-items/foreground-diagnosis-plan/v1' | 'assistant-work-items/owner-continuation-plan/v1' | 'assistant-work-items/owner-continuation-plan/v2';
16
+ readonly planDigest: string;
17
+ readonly input: Readonly<{
18
+ kind: 'foreground';
19
+ inboxId: string;
20
+ sourceDigest: string;
21
+ executionRef: string;
22
+ completionSequence: number;
23
+ binding: Readonly<{
24
+ id: string;
25
+ version: number;
26
+ generation: number;
27
+ }>;
28
+ }> | Readonly<{
29
+ kind: 'continuation';
30
+ sourceDigest: string;
31
+ inputSha256: string;
32
+ inputBytes: number;
33
+ replyId?: string;
34
+ }>;
35
+ readonly parent: Readonly<{
36
+ itemId: string;
37
+ rootItemId: string;
38
+ report: Readonly<EngineeringReportRef> | null;
39
+ outcomeRevision: number | null;
40
+ productionDigest: string;
41
+ }> | null;
42
+ }
43
+ export interface WorkItemEngineeringMaterial {
44
+ readonly protocol: 'assistant-work-items/engineering-material/v1';
45
+ readonly itemId: string;
46
+ readonly rootItemId: string;
47
+ readonly feedbackProofDigest: string;
48
+ readonly nodes: readonly Readonly<EngineeringNode>[];
49
+ readonly continuationInputs: readonly Readonly<{
50
+ itemId: string;
51
+ text: string;
52
+ fullTextDigest: string;
53
+ fullBytes: number;
54
+ }>[];
55
+ readonly parentReports: readonly Readonly<{
56
+ itemId: string;
57
+ revision: number;
58
+ text: string;
59
+ fullTextDigest: string;
60
+ fullBytes: number;
61
+ }>[];
62
+ readonly materialDigest: string;
63
+ }
64
+ export declare const MAX_ENGINEERING_PARENT_LINKS = 32;
65
+ export declare const MAX_ENGINEERING_INPUT_BYTES = 16384;
66
+ export declare const MAX_ENGINEERING_REPORT_BYTES = 262144;
67
+ export declare const MAX_ENGINEERING_MATERIAL_BYTES = 524288;
68
+ export interface WorkItemEngineeringTargetDependencies {
69
+ readonly config: NormalizedConfig;
70
+ readonly store: () => WorkItemStore | undefined;
71
+ readonly feedback: () => WorkItemOwnerFeedbackTargets | undefined;
72
+ readonly current: () => boolean;
73
+ }
74
+ /** Separate ephemeral authority: no old feedback or Memory capability is
75
+ * upgraded into engineering-source authority merely by installing this API. */
76
+ export declare class WorkItemEngineeringTargets {
77
+ #private;
78
+ private readonly dependencies;
79
+ constructor(dependencies: WorkItemEngineeringTargetDependencies);
80
+ private resources;
81
+ issue(feedbackCapability: unknown): unknown | undefined;
82
+ resolve(capability: unknown): Readonly<WorkItemEngineeringMaterial> | undefined;
83
+ withTargetsFence<T>(capabilities: readonly unknown[], callback: (materials: readonly (Readonly<WorkItemEngineeringMaterial> | undefined)[]) => T): T;
84
+ close(): void;
85
+ }
86
+ //# sourceMappingURL=engineering-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engineering-context.d.ts","sourceRoot":"","sources":["../src/engineering-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAInD,OAAO,KAAK,EAA8B,4BAA4B,EAAE,MAAM,uBAAuB,CAAA;AAGrG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/C,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,QAAQ,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,MAAM,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,cAAc,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,SAAS,EAAC,MAAM,CAAA;IAC/H,QAAQ,CAAC,MAAM,EAAC,UAAU,GAAC,SAAS,GAAC,OAAO,GAAC,SAAS,GAAC,QAAQ,CAAC;IAAA,QAAQ,CAAC,SAAS,EAAC,OAAO,CAAA;CAC3F;AACD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAC,MAAM,CAAA;IACtB,QAAQ,CAAC,YAAY,EAAC,mDAAmD,GAAC,iDAAiD,GAAC,iDAAiD,CAAA;IAC7K,QAAQ,CAAC,UAAU,EAAC,MAAM,CAAA;IAC1B,QAAQ,CAAC,KAAK,EAAC,QAAQ,CAAC;QAAC,IAAI,EAAC,YAAY,CAAC;QAAA,OAAO,EAAC,MAAM,CAAC;QAAA,YAAY,EAAC,MAAM,CAAC;QAAA,YAAY,EAAC,MAAM,CAAC;QAAA,kBAAkB,EAAC,MAAM,CAAC;QAC1H,OAAO,EAAC,QAAQ,CAAC;YAAC,EAAE,EAAC,MAAM,CAAC;YAAA,OAAO,EAAC,MAAM,CAAC;YAAA,UAAU,EAAC,MAAM,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