@sema-agent/client-core 0.90.0 → 0.92.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 (172) hide show
  1. package/CHANGELOG.md +365 -0
  2. package/README.md +48 -32
  3. package/dist/adapt/arms.js +13 -12
  4. package/dist/adapt/panelTasks.d.ts +0 -2
  5. package/dist/adapt/panelTasks.js +6 -26
  6. package/dist/adapt.js +2 -2
  7. package/dist/adapter/activeRunSelfHeal.d.ts +0 -2
  8. package/dist/adapter/activeRunSelfHeal.js +5 -27
  9. package/dist/adapter/downstream/eventToSdkMessage.js +4 -2
  10. package/dist/adapter/downstream/terminalToSdkResult.js +16 -7
  11. package/dist/adapter/downstream/wiringManifestView.d.ts +6 -0
  12. package/dist/adapter/downstream/wiringManifestView.js +16 -0
  13. package/dist/adapter/runStream.js +39 -20
  14. package/dist/askSurvivesStandingAnswer.d.ts +13 -0
  15. package/dist/askSurvivesStandingAnswer.js +53 -0
  16. package/dist/attachmentSeatCapability.d.ts +11 -0
  17. package/dist/attachmentSeatCapability.js +27 -0
  18. package/dist/attachmentsWireCaps.d.ts +9 -0
  19. package/dist/attachmentsWireCaps.js +74 -21
  20. package/dist/autoModeUnavailable.js +3 -2
  21. package/dist/cloudConfigWireCaps.js +5 -4
  22. package/dist/compensations.js +13 -17
  23. package/dist/controlRouter.d.ts +32 -25
  24. package/dist/controlRouter.js +166 -63
  25. package/dist/coreValuePorts.d.ts +4 -2
  26. package/dist/coreValuePorts.js +5 -0
  27. package/dist/decideFailureNote.js +7 -3
  28. package/dist/decideReceipt.d.ts +9 -0
  29. package/dist/decideReceipt.js +62 -1
  30. package/dist/disableSkillsWire.d.ts +1 -0
  31. package/dist/disableSkillsWire.js +8 -1
  32. package/dist/displayUntrusted.js +155 -5
  33. package/dist/effectiveFacts.d.ts +14 -4
  34. package/dist/effectiveFacts.js +45 -5
  35. package/dist/engineAgentAbsence.js +2 -1
  36. package/dist/engineCapReader.js +16 -10
  37. package/dist/engineCapsCache.d.ts +5 -1
  38. package/dist/engineCapsCache.js +69 -8
  39. package/dist/engineClosedSets.d.ts +2 -0
  40. package/dist/engineClosedSets.js +3 -0
  41. package/dist/engineErrorCodes.d.ts +17 -0
  42. package/dist/engineErrorCodes.js +47 -0
  43. package/dist/engineNoticeCodes.d.ts +14 -0
  44. package/dist/engineNoticeCodes.js +71 -0
  45. package/dist/executionLaneCapability.js +2 -0
  46. package/dist/gateOutcome.js +2 -17
  47. package/dist/gateVocabulary.d.ts +2 -4
  48. package/dist/gateVocabulary.js +3 -11
  49. package/dist/generated/engineFactTables.d.ts +27 -0
  50. package/dist/generated/engineFactTables.js +128 -0
  51. package/dist/generated/engineNoticeTables.js +3 -0
  52. package/dist/generated/settingsSchemaTables.d.ts +8 -0
  53. package/dist/generated/settingsSchemaTables.js +40 -0
  54. package/dist/hitl/allowRuleShadow.d.ts +21 -0
  55. package/dist/hitl/allowRuleShadow.js +167 -0
  56. package/dist/hitl/askClassPair.d.ts +14 -0
  57. package/dist/hitl/askClassPair.js +42 -0
  58. package/dist/hitl/askGateWire.d.ts +1 -1
  59. package/dist/hitl/askGateWire.js +2 -1
  60. package/dist/hitl/askSurvivesPosture.d.ts +5 -0
  61. package/dist/hitl/askSurvivesPosture.js +17 -0
  62. package/dist/hitl/automaticAnswerVerdict.d.ts +21 -0
  63. package/dist/hitl/automaticAnswerVerdict.js +143 -0
  64. package/dist/hitl/crashConverged.d.ts +8 -0
  65. package/dist/hitl/crashConverged.js +58 -1
  66. package/dist/hitl/crashConvergedNotice.d.ts +4 -0
  67. package/dist/hitl/crashConvergedNotice.js +57 -0
  68. package/dist/hitl/frameRouter.d.ts +2 -0
  69. package/dist/hitl/frameRouter.js +66 -14
  70. package/dist/hitl/gateLedger.d.ts +6 -0
  71. package/dist/hitl/gateLedger.js +34 -5
  72. package/dist/hitl/hitlBridge.d.ts +7 -4
  73. package/dist/hitl/hitlHostSurface.d.ts +2 -0
  74. package/dist/hitl/hitlHostSurface.js +7 -0
  75. package/dist/hitl/livePendingAsk.js +24 -5
  76. package/dist/hitl/parkResolver.d.ts +7 -2
  77. package/dist/hitl/parkResolver.js +21 -7
  78. package/dist/hitl/persistedRulesWire.d.ts +4 -1
  79. package/dist/hitl/persistedRulesWire.js +9 -2
  80. package/dist/hitl/planReviewWire.d.ts +1 -1
  81. package/dist/hitl/planReviewWire.js +19 -5
  82. package/dist/hitl/replayedApproval.d.ts +21 -0
  83. package/dist/hitl/replayedApproval.js +89 -0
  84. package/dist/hitl/sessionPolicyDeliverable.js +20 -2
  85. package/dist/hitl/sessionPolicyWire.d.ts +13 -0
  86. package/dist/hitl/sessionPolicyWire.js +75 -2
  87. package/dist/hitl/suspendedReopen.js +2 -2
  88. package/dist/hitl/toolApprovalWire.d.ts +9 -1
  89. package/dist/hitl/toolApprovalWire.js +40 -40
  90. package/dist/hookMatcherVerdict.d.ts +29 -0
  91. package/dist/hookMatcherVerdict.js +266 -0
  92. package/dist/humanTurn.d.ts +91 -0
  93. package/dist/humanTurn.js +252 -0
  94. package/dist/humanTurnRead.d.ts +105 -0
  95. package/dist/humanTurnRead.js +331 -0
  96. package/dist/index.d.ts +38 -11
  97. package/dist/index.js +27 -8
  98. package/dist/inheritEnvWire.js +4 -5
  99. package/dist/liveModelCatalog.d.ts +2 -0
  100. package/dist/liveModelCatalog.js +51 -3
  101. package/dist/mcpLiveness.js +2 -1
  102. package/dist/memoryVerbsWire.d.ts +1 -1
  103. package/dist/memoryVerbsWire.js +3 -0
  104. package/dist/model/catalog.js +2 -1
  105. package/dist/model/providerPresets.d.ts +3 -1
  106. package/dist/model/tierVocabulary.d.ts +2 -1
  107. package/dist/model/tierVocabulary.js +3 -8
  108. package/dist/peerFrames.js +2 -2
  109. package/dist/permissionRuleIssue.d.ts +1 -1
  110. package/dist/permissionRuleIssue.js +31 -9
  111. package/dist/permissionsAllowGrantCapability.d.ts +2 -1
  112. package/dist/permissionsAllowGrantCapability.js +11 -2
  113. package/dist/permissionsDeclaration.d.ts +29 -0
  114. package/dist/permissionsDeclaration.js +155 -66
  115. package/dist/pluginHooksWire.js +2 -11
  116. package/dist/promptDelivery.d.ts +11 -3
  117. package/dist/promptDelivery.js +164 -29
  118. package/dist/promptProfileWireCaps.d.ts +2 -1
  119. package/dist/protocolSegment.d.ts +9 -0
  120. package/dist/protocolSegment.js +28 -0
  121. package/dist/providerRejection.d.ts +1 -0
  122. package/dist/providerRejection.js +20 -0
  123. package/dist/readDenyTiers.d.ts +10 -0
  124. package/dist/readDenyTiers.js +29 -0
  125. package/dist/request/taskRequest.js +3 -17
  126. package/dist/resumeRefusalCopy.d.ts +11 -0
  127. package/dist/resumeRefusalCopy.js +61 -4
  128. package/dist/rewindArchiveCapability.js +4 -4
  129. package/dist/rewindWireCaps.d.ts +2 -1
  130. package/dist/rewindWireCaps.js +19 -2
  131. package/dist/ruleCompileVerdict.d.ts +2 -0
  132. package/dist/ruleCompileVerdict.js +13 -0
  133. package/dist/ruleRemovalConsequence.d.ts +2 -1
  134. package/dist/runCancelContext.d.ts +12 -0
  135. package/dist/runCancelContext.js +83 -1
  136. package/dist/seam.d.ts +2 -0
  137. package/dist/seam.js +1 -1
  138. package/dist/seatContract.d.ts +2 -1
  139. package/dist/sessionMemoryStatus.d.ts +2 -4
  140. package/dist/sessionSyncFileHistoryCapability.d.ts +18 -0
  141. package/dist/sessionSyncFileHistoryCapability.js +50 -0
  142. package/dist/skillToolListsCapability.d.ts +18 -0
  143. package/dist/skillToolListsCapability.js +50 -0
  144. package/dist/sqlEngineCapability.js +1 -8
  145. package/dist/steerPriorityCapability.d.ts +18 -0
  146. package/dist/steerPriorityCapability.js +80 -0
  147. package/dist/steerReceipt.d.ts +9 -0
  148. package/dist/steerReceipt.js +25 -0
  149. package/dist/subagent/engineSubagentSteer.js +2 -9
  150. package/dist/supportFloor.js +2 -2
  151. package/dist/taskRequestWords.d.ts +7 -1
  152. package/dist/taskRequestWords.js +18 -8
  153. package/dist/toolHistoryBadTurn.d.ts +1 -0
  154. package/dist/toolHistoryBadTurn.js +89 -0
  155. package/dist/toolHistoryMismatch.d.ts +2 -1
  156. package/dist/toolHistoryMismatch.js +19 -6
  157. package/dist/toolResult.d.ts +8 -0
  158. package/dist/toolResult.js +47 -3
  159. package/dist/types/engineState.d.ts +2 -12
  160. package/dist/userAttachmentEnvelope.d.ts +61 -0
  161. package/dist/userAttachmentEnvelope.js +204 -0
  162. package/dist/userInvokedSkillsCapability.d.ts +18 -0
  163. package/dist/userInvokedSkillsCapability.js +50 -0
  164. package/dist/wireFailureShape.d.ts +3 -0
  165. package/dist/wireFailureShape.js +8 -0
  166. package/dist/wireRefusalCopy.d.ts +6 -0
  167. package/dist/wireRefusalCopy.js +26 -3
  168. package/dist/workflowsJournalCapability.d.ts +18 -0
  169. package/dist/workflowsJournalCapability.js +50 -0
  170. package/dist/writeProtectionCapability.d.ts +2 -4
  171. package/docs/INTEGRATION-CLIENTS.md +1489 -16
  172. package/package.json +3 -3
@@ -8,9 +8,10 @@ import { projectDiagnosticsFrame } from '../diagnostics.js';
8
8
  import { recordEngineToolLabel } from '../engineToolLabelStore.js';
9
9
  import { registerSubagentAlias, registerSubagentContentAlias } from '../subagentContentStore.js';
10
10
  import { readAsyncLaunchedAgentReceipt } from '../toolResult.js';
11
- import { isWorkflowAgentTaskId, recordWorkflowAgentTaskId } from '../workflow.js';
11
+ import { recordWorkflowAgentTaskId } from '../workflow.js';
12
12
  import { isTerminalStatus } from '../runTerminal.js';
13
13
  import { readToolHistoryMismatchKey } from '../toolHistoryMismatch.js';
14
+ import { readProviderRejectionResendKey } from '../providerRejection.js';
14
15
  import { resolveEnginePanelTaskId } from '../engineAgentPanelStore.js';
15
16
  import { fleetRowAgentType } from '../fleet/fleetRowAgentType.js';
16
17
  import { chrome, mainLane, transcript, messageIdentityOf } from './ids.js';
@@ -23,6 +24,13 @@ function toolHistoryKeyCarry(m) {
23
24
  const key = readToolHistoryMismatchKey(typeof raw === 'object' && raw !== null ? raw : undefined);
24
25
  return key === undefined ? {} : { _sema_tool_history_mismatch: key };
25
26
  }
27
+ function providerResendKeyCarry(m) {
28
+ if (m._sema_api_error_message !== true)
29
+ return {};
30
+ const raw = m._sema_provider_rejection_resend;
31
+ const key = readProviderRejectionResendKey(typeof raw === 'object' && raw !== null ? raw : undefined);
32
+ return key === undefined ? {} : { _sema_provider_rejection_resend: key };
33
+ }
26
34
  const assistantArm = function* (m, { ctx, idOf, text, cards, inst }) {
27
35
  const message = m.message;
28
36
  const blocks = Array.isArray(message?.content)
@@ -129,6 +137,7 @@ const assistantArm = function* (m, { ctx, idOf, text, cards, inst }) {
129
137
  parent_tool_use_id: null,
130
138
  ...(m._sema_api_error_message === true ? { _sema_api_error_message: true } : {}),
131
139
  ...toolHistoryKeyCarry(m),
140
+ ...providerResendKeyCarry(m),
132
141
  }, ctx.now());
133
142
  text.markEmittedText(textBlock.text);
134
143
  }
@@ -569,9 +578,7 @@ const taskProgressArm = function* (m, { ctx, cards, panel, inst }) {
569
578
  const explicitParentRaw = m.parentToolCallId;
570
579
  const explicitParent = typeof explicitParentRaw === 'string' ? explicitParentRaw : undefined;
571
580
  const workflowRunId = typeof m.workflowRunId === 'string' ? m.workflowRunId : undefined;
572
- if (workflowRunId !== undefined ||
573
- isWorkflowAgentTaskId(taskId) ||
574
- (explicitParent !== undefined && inst.isWorkflowCard(explicitParent))) {
581
+ if (workflowRunId !== undefined) {
575
582
  recordWorkflowAgentTaskId(taskId);
576
583
  if (workflowRunId !== undefined && explicitParent !== undefined && inst.isWorkflowCard(explicitParent))
577
584
  noteOwnWorkflowRun(workflowRunId);
@@ -579,19 +586,13 @@ const taskProgressArm = function* (m, { ctx, cards, panel, inst }) {
579
586
  t: ctx.now(),
580
587
  taskId,
581
588
  lane: 'workflow',
582
- via: workflowRunId !== undefined
583
- ? 'workflowRunId'
584
- : isWorkflowAgentTaskId(taskId)
585
- ? 'wa-id'
586
- : 'workflow-card-parent',
589
+ via: 'workflowRunId',
587
590
  }));
588
591
  return;
589
592
  }
590
593
  if (explicitParent !== undefined)
591
594
  registerSubagentAlias(explicitParent, taskId);
592
- const cardId = explicitParent === undefined && !panel.isBound(taskId) && panel.unboundCandidates() > 1
593
- ? undefined
594
- : panel.bind(taskId, explicitParent);
595
+ const cardId = panel.bind(taskId, explicitParent);
595
596
  const usage = (m.usage ?? {});
596
597
  ctx.probe?.('tick', JSON.stringify({
597
598
  t: ctx.now(),
@@ -3,9 +3,7 @@ import type { AdapterInstanceLedger } from './instanceLedger.js';
3
3
  import type { OpenCardView } from './toolCards.js';
4
4
  export interface PanelTaskLedger {
5
5
  bind(taskId: string, parentToolCallId?: string): string | undefined;
6
- unboundCandidates(): number;
7
6
  laneOf(taskId: string): LaneProof;
8
- isBound(taskId: string): boolean;
9
7
  isLiveBound(taskId: string): boolean;
10
8
  isLive(taskId: string): boolean;
11
9
  markLive(taskId: string): void;
@@ -21,44 +21,24 @@ export function createPanelTaskLedger(ctx, cards, inst) {
21
21
  };
22
22
  return {
23
23
  laneOf,
24
- isBound: (taskId) => taskCardBinding.has(taskId),
25
24
  isLiveBound: (taskId) => liveBoundPanelTasks.has(taskId),
26
25
  bind(taskId, parentToolCallId) {
27
26
  const existing = taskCardBinding.get(taskId);
28
27
  if (existing !== undefined)
29
28
  return existing;
30
- let target;
31
- if (parentToolCallId !== undefined) {
32
- const named = cards.peek(parentToolCallId);
33
- if (named !== undefined && !SUBAGENT_TOOL_NAMES.has(named.name))
34
- return undefined;
35
- target = parentToolCallId;
36
- }
37
- else {
38
- for (const [id, p] of cards.entries()) {
39
- if (!boundToolCalls.has(id) && SUBAGENT_TOOL_NAMES.has(p.name)) {
40
- target = id;
41
- break;
42
- }
43
- }
44
- }
45
- if (target === undefined)
29
+ if (parentToolCallId === undefined)
46
30
  return undefined;
31
+ const named = cards.peek(parentToolCallId);
32
+ if (named !== undefined && !SUBAGENT_TOOL_NAMES.has(named.name))
33
+ return undefined;
34
+ const target = parentToolCallId;
47
35
  taskCardBinding.set(taskId, target);
48
36
  boundToolCalls.add(target);
49
37
  if (cards.has(target))
50
38
  liveBoundPanelTasks.add(taskId);
51
- ctx.probe?.('bind', `bind ${taskId} -> ${target} via=${parentToolCallId !== undefined ? 'explicit' : 'fifo'}`);
39
+ ctx.probe?.('bind', `bind ${taskId} -> ${target} via=explicit`);
52
40
  return target;
53
41
  },
54
- unboundCandidates() {
55
- let n = 0;
56
- for (const [id, p] of cards.entries()) {
57
- if (!boundToolCalls.has(id) && SUBAGENT_TOOL_NAMES.has(p.name))
58
- n++;
59
- }
60
- return n;
61
- },
62
42
  isLive: (taskId) => livePanelTasks.has(taskId),
63
43
  markLive: (taskId) => {
64
44
  livePanelTasks.add(taskId);
package/dist/adapt.js CHANGED
@@ -107,10 +107,10 @@ export const ADAPTER_DIVERGENCES = [
107
107
  '(0.81.0–0.82.x 曾与 CC 内部转录面驼峰 `toolUseResult` 同引用并铸,0.83.0 删驼峰);cli 侧仍带驼峰 —— 所钉的本包' +
108
108
  '旧版本两键同铸,升级后在转录入口从 `tool_use_result` 同值起别名。守卫在两键同在场且同引用时略过驼峰键、' +
109
109
  '按 snake 比(两侧对称);cli 侧不再带驼峰后本条自然零触发 ⇒ 自退役。',
110
- 'DIVERGENCE-11(0.83.0,C-R103):system 转录行的到达时戳 —— 本包只给 user / assistant 行补 `timestamp`' +
110
+ 'DIVERGENCE-11(0.83.0):system 转录行的到达时戳 —— 本包只给 user / assistant 行补 `timestamp`' +
111
111
  '(agent-types 只在这两臂声明),system 行不补(入参自带的照旧原样过境);壳的接收口给每条转录行补到达时刻(只补缺席)。' +
112
112
  '守卫在逐字比对前只从壳侧 system 行上去掉这一位;本包侧 system 行若带 `timestamp`,照样判不等。',
113
- 'DIVERGENCE-12(0.83.0,C-R103):记忆写入 —— 本包发 chrome `memory_saved` 臂(`notes` = 笔记原文,`id` 由这次写入的 wire ' +
113
+ 'DIVERGENCE-12(0.83.0):记忆写入 —— 本包发 chrome `memory_saved` 臂(`notes` = 笔记原文,`id` 由这次写入的 wire ' +
114
114
  '稳定键派生),转录面零行;壳侧是一条 system/memory_saved 转录行(`writtenPaths` 装同一份笔记)。守卫把壳侧这类行移出逐字比对,' +
115
115
  '改比:事件 `notes` ⇔ 行 `writtenPaths` 逐项相等、位置相等(之前已覆盖转录行的条数);`id` 不与旧行 uuid 比(本版不承诺相等)。',
116
116
  ];
@@ -192,8 +192,6 @@ export interface SelfHealFollowDeclaration {
192
192
  }
193
193
  export declare function readCancelRequested(body: unknown): boolean | undefined;
194
194
  export declare function atMostOnceFailureClass(e: unknown): 'rejected' | 'unknown';
195
- export declare function readSteerDelivery(receipt: unknown): string | null;
196
- export declare function readSteerReceiptStatus(receipt: unknown): string | null;
197
195
  export declare function clearRunningChoiceOffer(taskId: string, sessionId?: string): void;
198
196
  export declare function __resetRunningChoiceLedgerForTests(): void;
199
197
  export interface ClaimReleaseVerdict {
@@ -1,6 +1,7 @@
1
1
  import { abortableSleep } from '../abortableSleep.js';
2
2
  import { corruptStoredRowContent, corruptStoredRowWhere, effectiveWireErrorCode } from '../wireErrorTriage.js';
3
- import { steeringRefusedBeforeEngine, steeringStatusIs4xx } from '../controlRouter.js';
3
+ import { steerBodyOf, steeringRefusedBeforeEngine, steeringStatusIs4xx, UNOBSERVED_STEER_PRIORITY } from '../controlRouter.js';
4
+ import { readSteerReceipt } from '../steerReceipt.js';
4
5
  export const PLAN_REVIEW_GATE_KIND = 'plan_review';
5
6
  export const PLAN_REVIEW_GATE_KINDS = Object.freeze([PLAN_REVIEW_GATE_KIND, 'dry_run_review']);
6
7
  export const ASK_PARK_GATE_KINDS = Object.freeze(['human', 'irreversible_ask', 'policy_ask', 'tool_approval']);
@@ -265,28 +266,6 @@ export function atMostOnceFailureClass(e) {
265
266
  return 'rejected';
266
267
  return typeof e === 'object' && e !== null && steeringRefusedBeforeEngine(e) !== undefined ? 'rejected' : 'unknown';
267
268
  }
268
- export function readSteerDelivery(receipt) {
269
- try {
270
- if (typeof receipt !== 'object' || receipt === null || !('delivery' in receipt))
271
- return null;
272
- const d = receipt.delivery;
273
- return typeof d === 'string' && d.length > 0 ? d : null;
274
- }
275
- catch {
276
- return null;
277
- }
278
- }
279
- export function readSteerReceiptStatus(receipt) {
280
- try {
281
- if (typeof receipt !== 'object' || receipt === null || !('status' in receipt))
282
- return null;
283
- const s = receipt.status;
284
- return typeof s === 'string' && s.length > 0 ? s : null;
285
- }
286
- catch {
287
- return null;
288
- }
289
- }
290
269
  const CANCEL_RELEASE_WAIT_MS = 10_000;
291
270
  const RUNNING_LIVENESS_RECHECK_TIMEOUT_MS = 4_000;
292
271
  const runningChoiceDeclined = new Set();
@@ -772,9 +751,8 @@ async function runningChoiceArm(taskId, status, busy, statusFromWire, runs, deps
772
751
  }
773
752
  if (choice === 'steer' && canSteer && runs?.steer !== undefined) {
774
753
  try {
775
- const receipt = await runs.steer(taskId, { text }, sessionOpts(deps));
776
- const delivery = readSteerDelivery(receipt);
777
- const receiptStatus = readSteerReceiptStatus(receipt);
754
+ const receipt = await runs.steer(taskId, steerBodyOf({ text }, UNOBSERVED_STEER_PRIORITY), sessionOpts(deps));
755
+ const { delivery, status: receiptStatus } = readSteerReceipt(receipt);
778
756
  if (delivery === 'queued') {
779
757
  const verdict = receiptStatus !== null && PLAN_REVIEW_STATES.includes(receiptStatus)
780
758
  ? await planVerdict(taskId, deps)
@@ -1071,7 +1049,7 @@ function activeRunSelfHealBaseRow(outcome, signal, wayOut, following = false, ke
1071
1049
  }
1072
1050
  case 'running-steer-failed':
1073
1051
  if (outcome.delivery === 'rejected') {
1074
- return (`The engine rejected handing your message to the running run (run ${outcome.taskId}): ${outcome.detail}. ` +
1052
+ return (`Handing your message to the running run (run ${outcome.taskId}) was refused: ${outcome.detail}. ` +
1075
1053
  `sema did NOT retry it (a steer is not safe to send twice) and it did NOT cancel that run. ` +
1076
1054
  `Your message was NOT sent; send it again if you still want it.`);
1077
1055
  }
@@ -1,4 +1,4 @@
1
- import { readInstructionsSegment, wiringManifestViewOf } from './wiringManifestView.js';
1
+ import { readFleetSegment, readInstructionsSegment, wiringManifestViewOf } from './wiringManifestView.js';
2
2
  import { stamp, snapshotSegmentIdentity, } from '../types.js';
3
3
  import { turnUsageToModelUsage } from './turnUsageToModelUsage.js';
4
4
  import { ccToolDenialKindForToolEnd, gateOutcomeOf } from '../../gateOutcome.js';
@@ -551,7 +551,8 @@ function wiringManifestSupersetBody(ev) {
551
551
  const hands = projectHandsSection(ev);
552
552
  const fileHistory = projectFileHistorySection(ev);
553
553
  const instructions = readInstructionsSegment(ev, 'instructions');
554
- if (modelGate === undefined && autoMode === undefined && mcp === undefined && tools === undefined && hooks === undefined && lsp === undefined && writeProtection === undefined && autoConsolidation === undefined && readDeny === undefined && hands === undefined && fileHistory === undefined && instructions === undefined)
554
+ const fleet = readFleetSegment(ev, 'fleet');
555
+ if (modelGate === undefined && autoMode === undefined && mcp === undefined && tools === undefined && hooks === undefined && lsp === undefined && writeProtection === undefined && autoConsolidation === undefined && readDeny === undefined && hands === undefined && fileHistory === undefined && instructions === undefined && fleet === undefined)
555
556
  return undefined;
556
557
  return {
557
558
  ...(modelGate !== undefined ? { _sema_modelGate: modelGate } : {}),
@@ -566,6 +567,7 @@ function wiringManifestSupersetBody(ev) {
566
567
  ...(hands !== undefined ? { _sema_hands: hands } : {}),
567
568
  ...(fileHistory !== undefined ? { _sema_fileHistory: fileHistory } : {}),
568
569
  ...(instructions !== undefined ? { _sema_instructions: instructions } : {}),
570
+ ...(fleet !== undefined ? { _sema_fleet: fleet } : {}),
569
571
  };
570
572
  }
571
573
  function projectFileHistorySection(holder) {
@@ -7,8 +7,15 @@ import { isReviewPark, readRunTerminal, runTerminalCode, runTerminalGateToolName
7
7
  import { toCcModelUsage } from './turnUsageToModelUsage.js';
8
8
  import { LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, OUTPUT_INVALID, isCorruptSessionCode, isRewindFamilyCode, } from '../../engineErrorCodes.js';
9
9
  import { corruptSessionContent } from '../../corruptSessionCopy.js';
10
- function withSessionUnreadableNote(text, code) {
11
- return isCorruptSessionCode(code) ? `${text}\n${corruptSessionContent()}` : text;
10
+ import { abortCauseNoteOf, readAbortCause } from '../../runCancelContext.js';
11
+ function withTerminalNote(text, code, frame) {
12
+ const withCorrupt = isCorruptSessionCode(code) ? `${text}\n${corruptSessionContent()}` : text;
13
+ const abortNote = abortCauseNoteOf(frame);
14
+ return abortNote === undefined ? withCorrupt : `${withCorrupt}\n${abortNote}`;
15
+ }
16
+ function abortCauseWordOf(frame) {
17
+ const r = readAbortCause(frame);
18
+ return r === undefined ? undefined : r.kind === 'known' ? r.cause : r.word;
12
19
  }
13
20
  function finiteOr0(v) {
14
21
  return typeof v === 'number' && Number.isFinite(v) ? v : 0;
@@ -500,6 +507,7 @@ function errorResult(ctx, parts) {
500
507
  ...(parts.salvagedResult !== undefined ? { _sema_salvaged_result: parts.salvagedResult } : {}),
501
508
  ...(parts.outcomeUnknown === true ? { _sema_outcome: 'unknown' } : {}),
502
509
  ...(parts.parkFailedReason !== undefined ? { _sema_park_failed_reason: washCredentials(parts.parkFailedReason) } : {}),
510
+ ...(parts.abortCause !== undefined ? { _sema_abort_cause: parts.abortCause } : {}),
503
511
  });
504
512
  }
505
513
  export function doneToSdkResult(ev, ctx, observed) {
@@ -516,7 +524,7 @@ export function doneToSdkResult(ev, ctx, observed) {
516
524
  const degraded = degradedOf(r);
517
525
  const parkFailedRaw = ev._sema_park_failed_reason;
518
526
  const parkFailedReason = typeof parkFailedRaw === 'string' && parkFailedRaw.length > 0 ? parkFailedRaw : undefined;
519
- const errorBase = { durationMs, stats, model: r.model, errorCode, degraded, observed, facts: effectiveFactParts(rec), parkFailedReason };
527
+ const errorBase = { durationMs, stats, model: r.model, errorCode, degraded, observed, facts: effectiveFactParts(rec), parkFailedReason, abortCause: abortCauseWordOf(ev) };
520
528
  if (terminal?.kind === 'failed') {
521
529
  const failedCode = terminal.code;
522
530
  const failedMessage = terminal.message;
@@ -534,9 +542,9 @@ export function doneToSdkResult(ev, ctx, observed) {
534
542
  ...errorBase,
535
543
  subtype: failedSubtype,
536
544
  errors: [
537
- withSessionUnreadableNote(isRewindFamilyCode(failedCode) && failedMessage
545
+ withTerminalNote(isRewindFamilyCode(failedCode) && failedMessage
538
546
  ? `${failedMessage} (${failedCode})`
539
- : (failedMessage ?? 'run failed'), failedCode),
547
+ : (failedMessage ?? 'run failed'), failedCode, ev),
540
548
  ],
541
549
  });
542
550
  }
@@ -625,10 +633,11 @@ export function failedToSdkResult(ev, ctx, observed) {
625
633
  observed,
626
634
  durationMs: elapsedMs(ctx),
627
635
  errorCode: ev.errorCode,
636
+ abortCause: abortCauseWordOf(ev),
628
637
  errors: [
629
- withSessionUnreadableNote(isRewindFamilyCode(ev.errorCode) && ev.errorMessage
638
+ withTerminalNote(isRewindFamilyCode(ev.errorCode) && ev.errorMessage
630
639
  ? `${ev.errorMessage} (${ev.errorCode})`
631
- : (ev.errorMessage ?? ev.errorCode ?? 'run failed'), ev.errorCode),
640
+ : (ev.errorMessage ?? ev.errorCode ?? 'run failed'), ev.errorCode, ev),
632
641
  ],
633
642
  });
634
643
  }
@@ -15,8 +15,12 @@ export type WiringManifestSections = {
15
15
  _sema_instructions?: {
16
16
  readonly selected: readonly string[];
17
17
  };
18
+ _sema_fleet?: WiringManifestFleetView;
18
19
  eventId?: string;
19
20
  };
21
+ export interface WiringManifestFleetView {
22
+ readonly subagentTranscripts: string;
23
+ }
20
24
  export interface WiringManifestView {
21
25
  modelGate?: WiringManifestModelGate;
22
26
  autoMode?: WiringManifestAutoMode;
@@ -32,9 +36,11 @@ export interface WiringManifestView {
32
36
  instructions?: {
33
37
  readonly selected: readonly string[];
34
38
  };
39
+ fleet?: WiringManifestFleetView;
35
40
  eventId?: string;
36
41
  }
37
42
  export declare function readInstructionsSegment(holder: object, key: 'instructions' | '_sema_instructions'): {
38
43
  readonly selected: readonly string[];
39
44
  } | undefined;
45
+ export declare function readFleetSegment(holder: object, key: 'fleet' | '_sema_fleet'): WiringManifestFleetView | undefined;
40
46
  export declare function wiringManifestViewOf(s: WiringManifestSections): WiringManifestView | undefined;
@@ -27,9 +27,24 @@ export function readInstructionsSegment(holder, key) {
27
27
  return undefined;
28
28
  }
29
29
  }
30
+ export function readFleetSegment(holder, key) {
31
+ try {
32
+ if (!Object.hasOwn(holder, key))
33
+ return undefined;
34
+ const raw = holder[key];
35
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw) || !Object.hasOwn(raw, 'subagentTranscripts'))
36
+ return undefined;
37
+ const tier = raw.subagentTranscripts;
38
+ return typeof tier === 'string' && tier.length > 0 ? Object.freeze({ subagentTranscripts: tier }) : undefined;
39
+ }
40
+ catch {
41
+ return undefined;
42
+ }
43
+ }
30
44
  const isObj = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
31
45
  export function wiringManifestViewOf(s) {
32
46
  const instructions = readInstructionsSegment(s, '_sema_instructions');
47
+ const fleet = readFleetSegment(s, '_sema_fleet');
33
48
  const view = {
34
49
  ...(isObj(s._sema_modelGate) ? { modelGate: s._sema_modelGate } : {}),
35
50
  ...(isObj(s._sema_autoMode) ? { autoMode: s._sema_autoMode } : {}),
@@ -43,6 +58,7 @@ export function wiringManifestViewOf(s) {
43
58
  ...(isObj(s._sema_hands) && typeof s._sema_hands.mounted === 'boolean' ? { hands: s._sema_hands } : {}),
44
59
  ...(typeof s._sema_fileHistory === 'string' && s._sema_fileHistory.length > 0 ? { fileHistory: s._sema_fileHistory } : {}),
45
60
  ...(instructions !== undefined ? { instructions } : {}),
61
+ ...(fleet !== undefined ? { fleet } : {}),
46
62
  };
47
63
  if (Object.keys(view).length === 0)
48
64
  return undefined;
@@ -5,8 +5,10 @@ import { readRunCostFacts, terminalToSdkResult, TOOL_INPUT_JOIN_MAX_CALLS } from
5
5
  import { coerceOutput, publishSubagentContentEvent } from '../subagentContentStore.js';
6
6
  import { ACTIVE_RUN_BUSY_ERROR_CODE, OUTPUT_INVALID, isCorruptSessionCode, isLimitsExceededCode } from '../engineErrorCodes.js';
7
7
  import { corruptSessionContent } from '../corruptSessionCopy.js';
8
+ import { abortCauseNoteOf } from '../runCancelContext.js';
8
9
  import { classifyToolHistoryMismatch, noteToolHistoryTerminal, openToolHistoryGeneration, TOOL_HISTORY_REWIND_SENTENCE, toolHistoryMismatchRowKey, toolHistoryRepeatSentence, toolHistoryRewindOffered, } from '../toolHistoryMismatch.js';
9
10
  import { isReviewPark, readRunTerminal, runTerminalCode } from '../runTerminal.js';
11
+ import { providerRejectionResend } from '../providerRejection.js';
10
12
  import { washCredentials } from '../displayUntrusted.js';
11
13
  import { ccToolDenialKindForToolEnd, gateDeniedBy, gateOutcomeOf } from '../gateOutcome.js';
12
14
  import { resumeReopenContent, resumeReopenFromError, suspendedReopenOf } from '../hitl/suspendedReopen.js';
@@ -121,7 +123,7 @@ export function isModelOutputErrorRowText(text) {
121
123
  return text.trimStart().startsWith(`${MODEL_OUTPUT_ERROR_PREFIX}:`);
122
124
  }
123
125
  export const OUTCOME_UNKNOWN_ROW_PREFIX = 'Outcome unknown';
124
- function syntheticTerminalRow(ctx, text, historyKey) {
126
+ function syntheticTerminalRow(ctx, text, historyKey, resend) {
125
127
  return stamp(ctx, {
126
128
  uuid: undefined,
127
129
  session_id: undefined,
@@ -130,6 +132,7 @@ function syntheticTerminalRow(ctx, text, historyKey) {
130
132
  parent_tool_use_id: null,
131
133
  _sema_api_error_message: true,
132
134
  ...(historyKey !== undefined ? { _sema_tool_history_mismatch: historyKey } : {}),
135
+ ...(resend !== undefined ? { _sema_provider_rejection_resend: { resend: resend.resend, text: resend.text } } : {}),
133
136
  });
134
137
  }
135
138
  function engineRunIdOf(result) {
@@ -264,41 +267,52 @@ export function toolHistoryErrorCarrierOf(terminalOrResult) {
264
267
  return empty();
265
268
  }
266
269
  }
270
+ function terminalRowArmOf(facts) {
271
+ if (facts.errText === null)
272
+ return null;
273
+ return facts.busy.busy ? 'busy' : facts.governance ? 'governance' : isModelOutputErrorText(facts.errText) ? 'modelOutput' : 'apiError';
274
+ }
267
275
  function toolHistoryCarrierFromFacts(x, facts) {
268
- const empty = () => mintToolHistoryCarrier(undefined, undefined, undefined);
276
+ return apiErrorTerminalFromFacts(x, facts).carrier;
277
+ }
278
+ function apiErrorTerminalFromFacts(x, facts) {
279
+ const none = () => ({ carrier: mintToolHistoryCarrier(undefined, undefined, undefined), detail: undefined });
269
280
  try {
270
281
  const type = ownDataBit(x, 'type');
271
- if (facts.errText === null || facts.busy.busy || facts.governance || isModelOutputErrorText(facts.errText))
272
- return empty();
282
+ if (terminalRowArmOf(facts) !== 'apiError')
283
+ return none();
273
284
  if (type === 'failed')
274
- return mintToolHistoryCarrier(nonEmptyStr(ownDataBit(x, 'errorCode')), undefined, nonEmptyStr(ownDataBit(x, 'errorMessage')));
285
+ return { carrier: mintToolHistoryCarrier(nonEmptyStr(ownDataBit(x, 'errorCode')), undefined, nonEmptyStr(ownDataBit(x, 'errorMessage'))), detail: undefined };
275
286
  const result = type === 'done' ? plainObjectOf(ownDataBit(x, 'result')) : x;
276
287
  if (result === undefined)
277
- return empty();
288
+ return none();
278
289
  const snap = ownTerminalSnapshot(result);
279
290
  if (snap === undefined)
280
- return empty();
291
+ return none();
281
292
  const read = readRunTerminal(snap);
282
293
  if (read === null || read.kind !== 'failed')
283
- return empty();
294
+ return none();
284
295
  const detail = plainObjectOf(ownDataBit(read, 'detail'));
285
296
  const detailStatus = detail !== undefined && ownDataBit(detail, 'kind') === PROVIDER_REJECTED_DETAIL ? ownDataBit(detail, 'status') : undefined;
286
297
  const apiFailure = plainObjectOf(ownDataBit(result, 'apiFailure'));
287
298
  const apiStatus = apiFailure === undefined ? undefined : ownDataBit(apiFailure, 'status');
288
299
  const status = typeof apiStatus === 'number' && Number.isFinite(apiStatus) ? apiStatus : typeof detailStatus === 'number' ? detailStatus : undefined;
289
- return mintToolHistoryCarrier(nonEmptyStr(ownDataBit(read, 'code')), status, nonEmptyStr(ownDataBit(read, 'message')));
300
+ return {
301
+ carrier: mintToolHistoryCarrier(nonEmptyStr(ownDataBit(read, 'code')), status, nonEmptyStr(ownDataBit(read, 'message'))),
302
+ detail: detail,
303
+ };
290
304
  }
291
305
  catch {
292
- return empty();
306
+ return none();
293
307
  }
294
308
  }
295
- function toolHistoryCarrierOfRowFrame(ev, facts) {
309
+ function apiErrorTerminalOfRowFrame(ev, facts) {
296
310
  try {
297
311
  const x = plainObjectOf(ev);
298
- return x === undefined ? mintToolHistoryCarrier(undefined, undefined, undefined) : toolHistoryCarrierFromFacts(x, facts);
312
+ return x === undefined ? { carrier: mintToolHistoryCarrier(undefined, undefined, undefined), detail: undefined } : apiErrorTerminalFromFacts(x, facts);
299
313
  }
300
314
  catch {
301
- return mintToolHistoryCarrier(undefined, undefined, undefined);
315
+ return { carrier: mintToolHistoryCarrier(undefined, undefined, undefined), detail: undefined };
302
316
  }
303
317
  }
304
318
  const reportedDroppedTypes = new Set();
@@ -631,23 +645,25 @@ async function* runStreamInner(events, ctx, handle = {}) {
631
645
  const maxTokHint = /max_tokens/i.test(errText)
632
646
  ? '\nyour provider caps max_tokens lower — lower it in /model (press m, or M to type a value)'
633
647
  : '';
634
- const governance = rowFacts.governance;
635
648
  const busyHandle = busy.handle;
636
- const rowText = busy.busy
649
+ const arm = terminalRowArmOf(rowFacts);
650
+ const rowText = arm === 'busy'
637
651
  ? `This session is locked by an earlier run${busyHandle ? ` (run ${busyHandle})` : ''} that ` +
638
652
  `has not been released, so this message was NOT sent. Nothing releases it on its own — ` +
639
653
  `cancel that run (POST /v1/runs/${busyHandle ?? '<id>'}/cancel), or start a new session.`
640
- : governance
654
+ : arm === 'governance'
641
655
  ?
642
656
  `${isGovernanceStopRowText(errText) ? errText : `${RUN_STOPPED_MESSAGE_PREFIX}: ${errText}`}${maxTokHint}`
643
- : isModelOutputErrorText(errText)
657
+ : arm === 'modelOutput'
644
658
  ?
645
659
  `${MODEL_OUTPUT_ERROR_PREFIX}: ${errText}${maxTokHint}`
646
660
  : `API Error: ${errText}${maxTokHint}`;
647
661
  const sessionUnreadable = ev.type === 'failed'
648
662
  ? isCorruptSessionCode(ev.errorCode)
649
663
  : doneTerminal?.kind === 'failed' && isCorruptSessionCode(doneTerminal.code);
650
- const historyMismatch = classifyToolHistoryMismatch(toolHistoryCarrierOfRowFrame(ev, rowFacts));
664
+ const abortNote = abortCauseNoteOf(ev);
665
+ const historyTerminal = apiErrorTerminalOfRowFrame(ev, rowFacts);
666
+ const historyMismatch = classifyToolHistoryMismatch(historyTerminal.carrier);
651
667
  const historyEchoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
652
668
  const historyRepeat = noteToolHistoryTerminal({
653
669
  sessionId: historyEchoedSid ?? ctx.sessionId,
@@ -657,10 +673,13 @@ async function* runStreamInner(events, ctx, handle = {}) {
657
673
  replay: ev.type === 'done' && ev.replay === true,
658
674
  mismatch: historyMismatch,
659
675
  });
660
- const rewindLine = historyMismatch !== null && ctx.lane !== 'print' && ctx.lane !== 'utility' && toolHistoryRewindOffered(ctx.offersRewind)
676
+ const rewindOffered = historyMismatch !== null && ctx.lane !== 'print' && ctx.lane !== 'utility' && toolHistoryRewindOffered(ctx.offersRewind);
677
+ const rewindLine = rewindOffered
661
678
  ? `\n${TOOL_HISTORY_REWIND_SENTENCE}${historyRepeat !== undefined && historyRepeat >= 2 ? ` ${toolHistoryRepeatSentence(historyRepeat)}` : ''}`
662
679
  : '';
663
- yield syntheticTerminalRow(ctx, `${sessionUnreadable ? `${rowText}\n${corruptSessionContent()}` : rowText}${rewindLine}`, historyMismatch === null ? undefined : toolHistoryMismatchRowKey(historyMismatch, historyRepeat));
680
+ const resend = historyTerminal.detail !== undefined ? providerRejectionResend(historyTerminal.detail, historyTerminal.carrier) : undefined;
681
+ const resendLine = resend !== undefined ? `\n${resend.text}` : '';
682
+ yield syntheticTerminalRow(ctx, `${sessionUnreadable ? `${rowText}\n${corruptSessionContent()}` : rowText}${abortNote !== undefined ? `\n${abortNote}` : ''}${rewindLine}${resendLine}`, historyMismatch === null ? undefined : toolHistoryMismatchRowKey(historyMismatch, historyRepeat, rewindOffered), resend);
664
683
  }
665
684
  else {
666
685
  const echoedSid = ev.type === 'done' ? engineSessionIdOf(ev.result) : undefined;
@@ -0,0 +1,13 @@
1
+ import { type AutomaticAnswerRoad, type AutomaticAnswerUnknownWhy } from './hitl/automaticAnswerVerdict.js';
2
+ export declare const MODE_ARBITRATION: Readonly<Record<"hook" | "write_protection" | "mode" | "rule_unreadable" | "content_question" | "ancestor" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "ask_rule" | "denial_limit_fallback" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "write_protection_unresolved" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", import("./generated/engineFactTables.js").CoreModeArbitrationRow>>;
3
+ export type StandingAnswerVerdict = {
4
+ readonly kind: 'must_ask';
5
+ readonly by: string;
6
+ readonly road?: AutomaticAnswerRoad;
7
+ } | {
8
+ readonly kind: 'may_answer';
9
+ } | {
10
+ readonly kind: 'unknown';
11
+ readonly why?: AutomaticAnswerUnknownWhy;
12
+ };
13
+ export declare function askSurvivesStandingAnswer(card: object | null | undefined): StandingAnswerVerdict;
@@ -0,0 +1,53 @@
1
+ import { CORE_MODE_ARBITRATION } from './generated/engineFactTables.js';
2
+ import { automaticAnswerVerdict } from './hitl/automaticAnswerVerdict.js';
3
+ export const MODE_ARBITRATION = CORE_MODE_ARBITRATION;
4
+ const MUST_ASK_MANDATED = Object.freeze({ kind: 'must_ask', by: 'mandated' });
5
+ const MAY_ANSWER = Object.freeze({ kind: 'may_answer' });
6
+ const UNKNOWN = Object.freeze({ kind: 'unknown' });
7
+ export function askSurvivesStandingAnswer(card) {
8
+ const old = legacyStandingAnswerVerdict(card);
9
+ const neu = automaticAnswerVerdict(card, 'standing_rule');
10
+ if (old.kind === 'must_ask' || neu.kind === 'must_ask') {
11
+ const by = old.kind === 'must_ask' ? old.by : neu.kind === 'must_ask' ? (neu.askClass ?? neu.road) : 'mandated';
12
+ const road = neu.kind === 'must_ask' ? neu.road : by === 'mandated' ? 'mandated' : 'ask_class';
13
+ return Object.freeze({ kind: 'must_ask', by, road });
14
+ }
15
+ if (old.kind === 'unknown' || neu.kind === 'unknown')
16
+ return neu.kind === 'unknown' ? Object.freeze({ kind: 'unknown', why: neu.why }) : UNKNOWN;
17
+ return MAY_ANSWER;
18
+ }
19
+ function legacyStandingAnswerVerdict(card) {
20
+ try {
21
+ if (card === null || card === undefined || typeof card !== 'object')
22
+ return UNKNOWN;
23
+ if (Object.hasOwn(card, 'mandated') && card.mandated === true)
24
+ return MUST_ASK_MANDATED;
25
+ const classes = Object.hasOwn(card, 'classes') ? card.classes : undefined;
26
+ if (!Array.isArray(classes))
27
+ return UNKNOWN;
28
+ const length = classes.length;
29
+ if (typeof length !== 'number' || !Number.isSafeInteger(length) || length <= 0)
30
+ return UNKNOWN;
31
+ const names = [];
32
+ for (let i = 0; i < length; i += 1) {
33
+ if (!Object.hasOwn(classes, i))
34
+ return UNKNOWN;
35
+ const c = classes[i];
36
+ if (typeof c !== 'string')
37
+ return UNKNOWN;
38
+ names.push(c);
39
+ }
40
+ if (classes.length !== length)
41
+ return UNKNOWN;
42
+ for (const name of names) {
43
+ if (!Object.hasOwn(MODE_ARBITRATION, name))
44
+ return UNKNOWN;
45
+ if (MODE_ARBITRATION[name]?.ruleMayClear !== true)
46
+ return Object.freeze({ kind: 'must_ask', by: name });
47
+ }
48
+ return MAY_ANSWER;
49
+ }
50
+ catch {
51
+ return UNKNOWN;
52
+ }
53
+ }
@@ -0,0 +1,11 @@
1
+ export type AttachmentSeatReading = {
2
+ readonly kind: 'unobserved';
3
+ } | {
4
+ readonly kind: 'not_reported';
5
+ };
6
+ export declare function noteEngineCapsForAttachmentSeat(baseUrl: string, caps: unknown, opts?: {
7
+ generation?: number;
8
+ }): void;
9
+ export declare function observedAttachmentSeat(baseUrl?: string | undefined): AttachmentSeatReading;
10
+ export declare function forgetAttachmentSeatReading(baseUrl: string | undefined): void;
11
+ export declare function __resetAttachmentSeatReadingsForTests(): void;
@@ -0,0 +1,27 @@
1
+ import { engineWireTarget } from './engineWireTarget.js';
2
+ import { createEngineCapReader } from './engineCapReader.js';
3
+ function projectAttachmentSeat(caps) {
4
+ if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
5
+ return undefined;
6
+ const p = Object.getPrototypeOf(caps);
7
+ if (p !== Object.prototype && p !== null)
8
+ return undefined;
9
+ return { kind: 'not_reported' };
10
+ }
11
+ const reader = createEngineCapReader({
12
+ name: 'attachmentSeat',
13
+ project: projectAttachmentSeat,
14
+ makeUnobserved: () => ({ kind: 'unobserved' }),
15
+ });
16
+ export function noteEngineCapsForAttachmentSeat(baseUrl, caps, opts) {
17
+ reader.note(baseUrl, caps, opts);
18
+ }
19
+ export function observedAttachmentSeat(baseUrl = engineWireTarget()?.baseUrl) {
20
+ return reader.observed(baseUrl);
21
+ }
22
+ export function forgetAttachmentSeatReading(baseUrl) {
23
+ reader.forget(baseUrl);
24
+ }
25
+ export function __resetAttachmentSeatReadingsForTests() {
26
+ reader.__resetForTests();
27
+ }
@@ -28,3 +28,12 @@ export declare class AttachmentsSpecRefused extends TypeError {
28
28
  });
29
29
  }
30
30
  export declare function attachmentsForRequest(env?: EnvLike): AttachmentsSpec | undefined;
31
+ export type AttachmentsSubmitVerdict = {
32
+ readonly ok: true;
33
+ readonly attachments: AttachmentsSpec;
34
+ } | {
35
+ readonly ok: false;
36
+ readonly sentence: string;
37
+ readonly refusedKey: string | undefined;
38
+ };
39
+ export declare function attachmentsSubmitVerdict(env?: EnvLike): AttachmentsSubmitVerdict;