@sema-agent/client-core 0.109.0 → 0.111.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 (236) hide show
  1. package/CHANGELOG.md +342 -0
  2. package/README.md +88 -32
  3. package/dist/abortableSleep.d.ts +7 -0
  4. package/dist/abortableSleep.js +37 -0
  5. package/dist/adapt/arms.js +45 -11
  6. package/dist/adapt/toolCards.d.ts +3 -1
  7. package/dist/adapt/toolCards.js +4 -2
  8. package/dist/adapter/activeRunSelfHeal.d.ts +39 -0
  9. package/dist/adapter/activeRunSelfHeal.js +171 -3
  10. package/dist/adapter/downstream/eventToSdkMessage.js +20 -15
  11. package/dist/adapter/downstream/terminalToSdkResult.d.ts +2 -0
  12. package/dist/adapter/downstream/terminalToSdkResult.js +11 -0
  13. package/dist/adapter/runStream.d.ts +5 -0
  14. package/dist/adapter/runStream.js +15 -3
  15. package/dist/attachmentRoute.d.ts +20 -0
  16. package/dist/attachmentRoute.js +39 -0
  17. package/dist/attachmentsWireCaps.js +1 -1
  18. package/dist/builtinOutputStyles.d.ts +12 -0
  19. package/dist/builtinOutputStyles.js +147 -0
  20. package/dist/compactionStatus.d.ts +9 -0
  21. package/dist/compactionStatus.js +29 -5
  22. package/dist/controlRouter.js +2 -1
  23. package/dist/coreValuePorts.d.ts +39 -1
  24. package/dist/coreValuePorts.js +10 -0
  25. package/dist/declared/supportFloorDeclared.js +1 -1
  26. package/dist/displayUntrusted.d.ts +1 -0
  27. package/dist/displayUntrusted.js +138 -14
  28. package/dist/engineErrorCodes.d.ts +3 -0
  29. package/dist/engineErrorCodes.js +3 -0
  30. package/dist/engineHealthFacts.d.ts +20 -0
  31. package/dist/engineHealthFacts.js +42 -1
  32. package/dist/engineHealthProbeVerdict.d.ts +23 -0
  33. package/dist/engineHealthProbeVerdict.js +115 -0
  34. package/dist/engineInlineTaskStats.d.ts +4 -3
  35. package/dist/engineInlineTaskStats.js +18 -2
  36. package/dist/engineNoticeCodes.d.ts +10 -0
  37. package/dist/engineNoticeCodes.js +36 -6
  38. package/dist/engineRepoint.d.ts +147 -0
  39. package/dist/engineRepoint.js +310 -0
  40. package/dist/engineRowRef.d.ts +3 -0
  41. package/dist/engineRowRef.js +13 -1
  42. package/dist/engineSessionMessages.d.ts +2 -1
  43. package/dist/engineSessionMessages.js +5 -0
  44. package/dist/engineSwapCrossing.d.ts +57 -0
  45. package/dist/engineSwapCrossing.js +297 -0
  46. package/dist/engineUnavailable.d.ts +44 -0
  47. package/dist/engineUnavailable.js +492 -0
  48. package/dist/errorSupplementRoles.js +2 -1
  49. package/dist/eventLeg.js +3 -3
  50. package/dist/fleet/fleetProjection.js +3 -2
  51. package/dist/generated/engineFactTables.d.ts +2 -0
  52. package/dist/generated/engineFactTables.js +12 -0
  53. package/dist/generated/sdkFactTables.d.ts +2 -1
  54. package/dist/generated/sdkFactTables.js +5 -0
  55. package/dist/generated/settingsSchemaTables.d.ts +4 -0
  56. package/dist/generated/settingsSchemaTables.js +1 -0
  57. package/dist/hitl/approvalAskers.d.ts +6 -0
  58. package/dist/hitl/approvalAskers.js +30 -0
  59. package/dist/hitl/approvalCardReasons.js +6 -3
  60. package/dist/hitl/approvalDelivery.d.ts +1 -0
  61. package/dist/hitl/approvalDelivery.js +1 -1
  62. package/dist/hitl/approvalRequestFrameReading.d.ts +7 -0
  63. package/dist/hitl/approvalRequestFrameReading.js +11 -0
  64. package/dist/hitl/approvalResolution.d.ts +9 -2
  65. package/dist/hitl/approvalResolution.js +6 -1
  66. package/dist/hitl/askGateWire.js +5 -8
  67. package/dist/hitl/automaticAnswerVerdict.js +2 -2
  68. package/dist/hitl/decisionConflict.js +6 -3
  69. package/dist/hitl/decisionRefusal.d.ts +2 -0
  70. package/dist/hitl/decisionRefusal.js +8 -8
  71. package/dist/hitl/decisionRefusalCarrier.d.ts +3 -0
  72. package/dist/hitl/decisionRefusalCarrier.js +348 -0
  73. package/dist/hitl/decisionSend.d.ts +10 -0
  74. package/dist/hitl/decisionSend.js +57 -17
  75. package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
  76. package/dist/hitl/editedApprovalAcceptance.js +26 -0
  77. package/dist/hitl/elicitationRefusal.d.ts +4 -0
  78. package/dist/hitl/elicitationRefusal.js +23 -0
  79. package/dist/hitl/frameRouter.d.ts +2 -2
  80. package/dist/hitl/frameRouter.js +12 -33
  81. package/dist/hitl/gateIdentity.d.ts +5 -0
  82. package/dist/hitl/gateIdentity.js +23 -0
  83. package/dist/hitl/gateLedger.d.ts +0 -4
  84. package/dist/hitl/gateLedger.js +0 -19
  85. package/dist/hitl/hitlBridge.d.ts +7 -0
  86. package/dist/hitl/hitlBridge.js +14 -8
  87. package/dist/hitl/hitlHostSurface.d.ts +3 -1
  88. package/dist/hitl/hitlHostSurface.js +14 -4
  89. package/dist/hitl/hostWithdrawal.d.ts +15 -0
  90. package/dist/hitl/hostWithdrawal.js +38 -0
  91. package/dist/hitl/localAllowRedemption.d.ts +67 -0
  92. package/dist/hitl/localAllowRedemption.js +256 -0
  93. package/dist/hitl/parkResolver.js +32 -13
  94. package/dist/hitl/persistedRulesWire.d.ts +16 -0
  95. package/dist/hitl/persistedRulesWire.js +72 -2
  96. package/dist/hitl/planReviewWire.d.ts +3 -0
  97. package/dist/hitl/planReviewWire.js +37 -10
  98. package/dist/hitl/policyDenyCause.d.ts +1 -1
  99. package/dist/hitl/policyDenyCause.js +1 -1
  100. package/dist/hitl/resumeRunningCard.d.ts +1 -0
  101. package/dist/hitl/resumeRunningCard.js +1 -0
  102. package/dist/hitl/screenCardCarriers.d.ts +15 -0
  103. package/dist/hitl/screenCardCarriers.js +41 -0
  104. package/dist/hitl/screenDecisionCards.d.ts +98 -0
  105. package/dist/hitl/screenDecisionCards.js +362 -0
  106. package/dist/hitl/sessionPolicyWire.js +6 -4
  107. package/dist/hitl/standingRows.d.ts +4 -1
  108. package/dist/hitl/standingRows.js +33 -1
  109. package/dist/hitl/toolApprovalWire.d.ts +64 -15
  110. package/dist/hitl/toolApprovalWire.js +470 -125
  111. package/dist/hooksWireCaps.js +31 -1
  112. package/dist/hostSettingNoticeArm.d.ts +3 -0
  113. package/dist/hostSettingNoticeArm.js +12 -0
  114. package/dist/hostTurnSettings.d.ts +13 -4
  115. package/dist/hostTurnSettings.js +150 -10
  116. package/dist/humanTurnRead.js +11 -1
  117. package/dist/i18n/messages.en.d.ts +212 -0
  118. package/dist/i18n/messages.en.js +217 -5
  119. package/dist/i18n/messages.zh.js +235 -5
  120. package/dist/i18n/translate.d.ts +3 -0
  121. package/dist/i18n/translate.js +78 -10
  122. package/dist/i18n/zh.d.ts +1 -0
  123. package/dist/i18n/zh.js +1 -0
  124. package/dist/index.d.ts +56 -16
  125. package/dist/index.js +40 -12
  126. package/dist/inheritEnvCapability.js +2 -0
  127. package/dist/inputAuthor.d.ts +16 -0
  128. package/dist/inputAuthor.js +44 -0
  129. package/dist/interactiveHalt.js +2 -1
  130. package/dist/interactiveInterrupt.js +20 -2
  131. package/dist/interruptRefusalNote.d.ts +2 -0
  132. package/dist/interruptRefusalNote.js +17 -0
  133. package/dist/liveModelCatalog.d.ts +2 -0
  134. package/dist/liveModelCatalog.js +23 -9
  135. package/dist/liveQuestionStore.d.ts +4 -1
  136. package/dist/liveQuestionStore.js +12 -3
  137. package/dist/localEngineSeatReading.d.ts +2 -2
  138. package/dist/localEngineSeatReading.js +5 -3
  139. package/dist/localEngineSpawn.d.ts +0 -7
  140. package/dist/localEngineSpawn.js +0 -92
  141. package/dist/localEngineStep.d.ts +2 -2
  142. package/dist/localEngineStep.js +2 -0
  143. package/dist/mcpEngineLeg.d.ts +3 -0
  144. package/dist/mcpEngineLeg.js +38 -1
  145. package/dist/mcpPanel.js +2 -0
  146. package/dist/mcpReconnect.d.ts +9 -1
  147. package/dist/mcpReconnect.js +124 -19
  148. package/dist/mcpWireCaps.js +1 -1
  149. package/dist/model/engineModelWords.d.ts +3 -0
  150. package/dist/model/engineModelWords.js +13 -0
  151. package/dist/model/subagentModelWord.d.ts +21 -2
  152. package/dist/model/subagentModelWord.js +100 -29
  153. package/dist/modelCapabilityProbe.js +7 -43
  154. package/dist/modsFace.d.ts +8 -1
  155. package/dist/modsFace.js +27 -0
  156. package/dist/notifications.d.ts +36 -6
  157. package/dist/notifications.js +170 -20
  158. package/dist/ownKey.d.ts +6 -5
  159. package/dist/ownKey.js +31 -7
  160. package/dist/peerFrames.d.ts +40 -2
  161. package/dist/peerFrames.js +158 -3
  162. package/dist/pendingUserRow.d.ts +4 -0
  163. package/dist/pendingUserRow.js +16 -0
  164. package/dist/permissionsDeclaration.d.ts +1 -0
  165. package/dist/permissionsDeclaration.js +11 -1
  166. package/dist/planReviewCardFacts.d.ts +3 -0
  167. package/dist/planReviewCardFacts.js +52 -2
  168. package/dist/pluginHooksWire.d.ts +10 -1
  169. package/dist/pluginHooksWire.js +96 -7
  170. package/dist/printToolResultFrame.js +4 -2
  171. package/dist/promptBlockedCopy.js +11 -6
  172. package/dist/promptSuggestionBatch.d.ts +7 -0
  173. package/dist/promptSuggestionBatch.js +9 -0
  174. package/dist/promptSuggestionsTail.d.ts +39 -0
  175. package/dist/promptSuggestionsTail.js +116 -0
  176. package/dist/replayBody.js +10 -2
  177. package/dist/request/taskRequest.d.ts +5 -0
  178. package/dist/request/taskRequest.js +142 -21
  179. package/dist/requestCoordinate.d.ts +1 -0
  180. package/dist/requestCoordinate.js +13 -0
  181. package/dist/resumeRefusalCopy.d.ts +1 -3
  182. package/dist/resumeRefusalCopy.js +2 -1
  183. package/dist/retryStatus.d.ts +2 -2
  184. package/dist/retryStatus.js +2 -0
  185. package/dist/rewindArchiveReading.js +4 -4
  186. package/dist/runCancelContext.d.ts +2 -1
  187. package/dist/runCancelContext.js +1 -0
  188. package/dist/runPermissionModeSwitch.js +2 -2
  189. package/dist/scenarioRefusal.js +11 -13
  190. package/dist/scenarioSkills.js +11 -6
  191. package/dist/seam.d.ts +27 -2
  192. package/dist/seam.js +17 -1
  193. package/dist/seatContract.d.ts +189 -12
  194. package/dist/seatContract.js +401 -9
  195. package/dist/sessionBackground.js +2 -1
  196. package/dist/sessionBackgroundHandoff.js +2 -1
  197. package/dist/sessionCostReading.d.ts +70 -0
  198. package/dist/sessionCostReading.js +150 -0
  199. package/dist/sessionEngine.d.ts +2 -0
  200. package/dist/sessionEngine.js +111 -0
  201. package/dist/sessionHooksRoster.d.ts +4 -0
  202. package/dist/sessionHooksRoster.js +158 -0
  203. package/dist/sessionMemoryStatus.d.ts +2 -1
  204. package/dist/sessionMemoryStatus.js +2 -2
  205. package/dist/sessionReadRedaction.d.ts +7 -0
  206. package/dist/sessionReadRedaction.js +26 -0
  207. package/dist/sessionSyncFileHistory.d.ts +4 -0
  208. package/dist/sessionSyncFileHistory.js +27 -0
  209. package/dist/settingsHooksSalvage.js +2 -1
  210. package/dist/sseIdleTriage.d.ts +13 -1
  211. package/dist/sseIdleTriage.js +25 -6
  212. package/dist/storeDurabilityWord.d.ts +15 -0
  213. package/dist/storeDurabilityWord.js +18 -0
  214. package/dist/storePostureCapability.d.ts +7 -3
  215. package/dist/storePostureCapability.js +69 -39
  216. package/dist/subagent/engineSubagentResume.js +2 -2
  217. package/dist/subagent/engineSubagentTail.js +8 -1
  218. package/dist/subagentContentStore.d.ts +11 -0
  219. package/dist/subagentContentStore.js +28 -2
  220. package/dist/terminalStatuses.d.ts +1 -0
  221. package/dist/terminalStatuses.js +4 -1
  222. package/dist/toolResult.d.ts +1 -0
  223. package/dist/toolResult.js +2 -0
  224. package/dist/turnFailurePresentation.js +9 -2
  225. package/dist/typePins.d.ts +11 -0
  226. package/dist/usageAnalytics.d.ts +17 -0
  227. package/dist/usageAnalytics.js +44 -2
  228. package/dist/userAttachmentEnvelope.d.ts +2 -1
  229. package/dist/userAttachmentEnvelope.js +10 -0
  230. package/dist/wireErrorTriage.js +2 -1
  231. package/dist/wireFailureShape.d.ts +6 -5
  232. package/dist/wireFailureShape.js +150 -38
  233. package/dist/wireRefusalCopy.d.ts +16 -5
  234. package/dist/wireRefusalCopy.js +119 -86
  235. package/docs/INTEGRATION-CLIENTS.md +4228 -21
  236. package/package.json +7 -3
@@ -0,0 +1,492 @@
1
+ import { appendOwnElement, readOwnDataValue } from './ownKey.js';
2
+ import { compareReleaseVersions } from './supportFloor.js';
3
+ import { LOCAL_ENGINE_SPAWN_ENV } from './localEngineSpawn.js';
4
+ import { SETTINGS_MODEL_PLANE_REFUSAL_CODES, SETTINGS_WEB_ADMIN_TOKEN_ENV } from './generated/settingsSchemaTables.js';
5
+ import { msg, renderMessage } from './i18n/translate.js';
6
+ export const ENGINE_UNAVAILABLE_REASONS = Object.freeze([
7
+ 'not_running',
8
+ 'not_answering',
9
+ 'address_refused',
10
+ 'version_refused',
11
+ 'model_setup',
12
+ 'credential_conflict',
13
+ 'credential_refused',
14
+ 'data_root_refused',
15
+ ]);
16
+ export const ENGINE_INSTALL_SHAPES = Object.freeze(['npm-global', 'managed', 'npm-local', 'dev', 'app', 'unknown']);
17
+ const SCHEMA_MISMATCH_CODE = 'config.schema_mismatch';
18
+ const WAYS_OUT_ANCHOR = /Ways out \(these three and no others\):/;
19
+ const MARKER_ROLE = /^the local engine high-water marker$/;
20
+ export const ENGINE_BOOT_REFUSAL_CODES = Object.freeze(Object.fromEntries([
21
+ ...SETTINGS_MODEL_PLANE_REFUSAL_CODES.map((c) => [c, 'model_setup']),
22
+ ['config.anthropic_credential_conflict', 'credential_conflict'],
23
+ ['config.center_credential_malformed', 'credential_refused'],
24
+ ['config.center_credential_user_session_multi_tenant', 'credential_refused'],
25
+ [SCHEMA_MISMATCH_CODE, 'data_root_refused'],
26
+ ]));
27
+ function isRecord(v) {
28
+ if (typeof v !== 'object' || v === null)
29
+ return false;
30
+ try {
31
+ return !Array.isArray(v);
32
+ }
33
+ catch {
34
+ return false;
35
+ }
36
+ }
37
+ function own(v, key) {
38
+ if (!isRecord(v))
39
+ return undefined;
40
+ try {
41
+ return readOwnDataValue(v, key);
42
+ }
43
+ catch {
44
+ return undefined;
45
+ }
46
+ }
47
+ function parseJsonLine(t) {
48
+ try {
49
+ return JSON.parse(t);
50
+ }
51
+ catch {
52
+ return undefined;
53
+ }
54
+ }
55
+ function deepFreeze(v) {
56
+ if (typeof v === 'object' && v !== null && !Object.isFrozen(v)) {
57
+ for (const k of Object.keys(v))
58
+ deepFreeze(v[k]);
59
+ Object.freeze(v);
60
+ }
61
+ return v;
62
+ }
63
+ function flat(s) {
64
+ return s.replace(/\s+/g, ' ').trim();
65
+ }
66
+ function stripEndStop(s) {
67
+ return s.replace(/[.。]+$/u, '');
68
+ }
69
+ const isRelease = (v) => compareReleaseVersions(v, v) !== undefined;
70
+ const CODE_TOKEN = '(config\\.[A-Za-z0-9_.-]*[A-Za-z0-9_])';
71
+ function refusalCodesIn(text) {
72
+ const out = [];
73
+ for (const m of text.matchAll(new RegExp(`\\[${CODE_TOKEN}\\]`, 'g')))
74
+ out.push({ at: m.index ?? 0, code: m[1] });
75
+ for (const m of text.matchAll(new RegExp(`(?:^|\\n)[ \\t]*(?:[A-Za-z]*Error(?: \\[[^\\]\\n]*\\])?:[ \\t]*)?${CODE_TOKEN}:`, 'g')))
76
+ out.push({ at: m.index ?? 0, code: m[1] });
77
+ out.sort((a, b) => a.at - b.at);
78
+ const seen = [];
79
+ for (const { code } of out)
80
+ if (!seen.includes(code))
81
+ seen.push(code);
82
+ return seen;
83
+ }
84
+ const BOOT_REFUSAL_MAX_CHARS = 800;
85
+ const BOOT_REFUSAL_MAX_HINTS = 2;
86
+ const BOOT_REFUSAL_MAX_FINDINGS = 8;
87
+ const CONFIG_CODE = /^config\.[A-Za-z0-9_.-]+$/;
88
+ function capSentence(s) {
89
+ const t = s.trim();
90
+ return t.length > BOOT_REFUSAL_MAX_CHARS ? `${t.slice(0, BOOT_REFUSAL_MAX_CHARS)}…` : t;
91
+ }
92
+ function dataRootReadingOf(text) {
93
+ if (!text.includes(SCHEMA_MISMATCH_CODE) || !WAYS_OUT_ANCHOR.test(text))
94
+ return undefined;
95
+ const lines = text.split(/\r?\n/);
96
+ const at = lines.findIndex((l) => l.includes(`${SCHEMA_MISMATCH_CODE}:`));
97
+ if (at < 0)
98
+ return undefined;
99
+ const first = lines[at];
100
+ const lead = first.lastIndexOf(`${SCHEMA_MISMATCH_CODE}: `);
101
+ const head = capSentence(lead >= 0 ? first.slice(lead) : first);
102
+ if (head.length === 0)
103
+ return undefined;
104
+ const findings = [];
105
+ let highWater;
106
+ let engineVersion;
107
+ let markerPath;
108
+ let newer = false;
109
+ let unreadable = false;
110
+ for (let i = at + 1; i < lines.length && findings.length < BOOT_REFUSAL_MAX_FINDINGS; i++) {
111
+ const l = lines[i];
112
+ if (WAYS_OUT_ANCHOR.test(l) || !/^\s+\S/.test(l))
113
+ break;
114
+ const f = capSentence(l);
115
+ findings.push(f);
116
+ const hw = /: engine high-water (\S+) — .*NEWER than this build \(([^()\s]+)\)/.exec(f);
117
+ if (hw !== null) {
118
+ newer = true;
119
+ if (isRelease(hw[1]))
120
+ highWater = hw[1];
121
+ if (isRelease(hw[2]))
122
+ engineVersion = hw[2];
123
+ const p = /^\S+ \(the local engine high-water marker\) at (.+?): engine high-water /.exec(f);
124
+ if (p !== null)
125
+ markerPath = p[1];
126
+ continue;
127
+ }
128
+ if (/: UNKNOWN field\(s\) .*NEWER than this build/.test(f)) {
129
+ newer = true;
130
+ continue;
131
+ }
132
+ const un = /^\S+ \(([^()]*)\) at (.+?): unreadable \([^()\s]+\)/.exec(f);
133
+ if (un !== null) {
134
+ unreadable = true;
135
+ if (MARKER_ROLE.test(un[1]))
136
+ markerPath = un[2];
137
+ }
138
+ }
139
+ return {
140
+ variant: newer ? 'newer_root' : unreadable ? 'unreadable' : 'unknown',
141
+ findings: [head, ...findings],
142
+ ...(highWater !== undefined ? { highWater } : {}),
143
+ ...(engineVersion !== undefined ? { engineVersion } : {}),
144
+ ...(markerPath !== undefined ? { markerPath } : {}),
145
+ };
146
+ }
147
+ function classifyRefusalText(text) {
148
+ for (const code of refusalCodesIn(text)) {
149
+ if (!Object.hasOwn(ENGINE_BOOT_REFUSAL_CODES, code))
150
+ continue;
151
+ const reason = ENGINE_BOOT_REFUSAL_CODES[code];
152
+ if (reason !== 'data_root_refused')
153
+ return { reason, code };
154
+ const dataRoot = dataRootReadingOf(text);
155
+ if (dataRoot !== undefined)
156
+ return { reason, code, dataRoot };
157
+ }
158
+ return undefined;
159
+ }
160
+ export function engineBootRefusalOf(lines, scrub) {
161
+ try {
162
+ const clean = (s) => {
163
+ try {
164
+ const out = scrub(s);
165
+ return typeof out === 'string' ? out : undefined;
166
+ }
167
+ catch {
168
+ return undefined;
169
+ }
170
+ };
171
+ const hints = [];
172
+ let code;
173
+ let hint;
174
+ let fatal;
175
+ let fatalClass;
176
+ let fatalCode;
177
+ let entryClass;
178
+ const list = Array.isArray(lines) ? [...lines] : [];
179
+ const plain = [];
180
+ for (const raw of list) {
181
+ if (typeof raw !== 'string')
182
+ continue;
183
+ const t0 = raw.trim();
184
+ if (!t0.startsWith('{')) {
185
+ plain.push(raw);
186
+ continue;
187
+ }
188
+ const line = clean(raw);
189
+ if (line === undefined)
190
+ continue;
191
+ const t = line.trim();
192
+ if (!t.startsWith('{'))
193
+ continue;
194
+ const o = parseJsonLine(t);
195
+ if (!isRecord(o))
196
+ continue;
197
+ const m = own(o, 'msg');
198
+ const err = own(o, 'err');
199
+ if (m === 'fatal' && typeof err === 'string' && err.trim() !== '') {
200
+ const full = clean(err);
201
+ const s = full === undefined ? undefined : full.replace(/^\s*Error:\s*/, '');
202
+ if (s !== undefined && s.trim() !== '') {
203
+ fatal = capSentence(s);
204
+ fatalClass = classifyRefusalText(s);
205
+ fatalCode = refusalCodesIn(s).find((x) => CONFIG_CODE.test(x));
206
+ }
207
+ continue;
208
+ }
209
+ const c = own(o, 'code');
210
+ const h = own(o, 'hint');
211
+ if (typeof c === 'string' && CONFIG_CODE.test(c) && typeof h === 'string' && h.trim() !== '') {
212
+ const model = own(o, 'model');
213
+ const who = typeof model === 'string' && model !== '' ? `"${model}": ` : '';
214
+ const s = clean(`${who}${h}`);
215
+ const cc = clean(c);
216
+ if (s === undefined || cc === undefined || !CONFIG_CODE.test(cc))
217
+ continue;
218
+ const sentence = capSentence(s);
219
+ code = cc;
220
+ const ch = clean(h);
221
+ hint = ch === undefined ? undefined : capSentence(ch);
222
+ if (Object.hasOwn(ENGINE_BOOT_REFUSAL_CODES, cc) && ENGINE_BOOT_REFUSAL_CODES[cc] !== 'data_root_refused')
223
+ entryClass = { reason: ENGINE_BOOT_REFUSAL_CODES[cc], code: cc };
224
+ if (hints.includes(sentence))
225
+ continue;
226
+ hints.push(sentence);
227
+ if (hints.length > BOOT_REFUSAL_MAX_HINTS)
228
+ hints.shift();
229
+ }
230
+ }
231
+ let text;
232
+ let cls = fatalClass ?? entryClass;
233
+ const parts = [...hints, ...(fatal !== undefined ? [fatal] : [])];
234
+ if (parts.length > 0)
235
+ text = parts.join('\n');
236
+ if (cls === undefined) {
237
+ let from = -1;
238
+ for (let i = plain.length - 1; i >= 0; i--)
239
+ if (plain[i].includes(SCHEMA_MISMATCH_CODE)) {
240
+ from = i;
241
+ break;
242
+ }
243
+ if (from >= 0) {
244
+ const block = clean(plain.slice(from).join('\n'));
245
+ const got = block === undefined ? undefined : classifyRefusalText(block);
246
+ if (block !== undefined && got !== undefined) {
247
+ cls = got;
248
+ if (text === undefined)
249
+ text = capSentence(block);
250
+ }
251
+ }
252
+ }
253
+ if (text === undefined)
254
+ return undefined;
255
+ if (code === undefined)
256
+ code = cls?.code ?? fatalCode;
257
+ const dr = cls?.dataRoot;
258
+ return deepFreeze({
259
+ ...(code !== undefined ? { code } : {}),
260
+ ...(hint !== undefined ? { hint } : {}),
261
+ text,
262
+ ...(cls !== undefined ? { reason: cls.reason, restartWouldHelp: false } : {}),
263
+ ...(dr !== undefined
264
+ ? {
265
+ variant: dr.variant,
266
+ findings: dr.findings,
267
+ ...(dr.highWater !== undefined ? { highWater: dr.highWater } : {}),
268
+ ...(dr.engineVersion !== undefined ? { engineVersion: dr.engineVersion } : {}),
269
+ ...(dr.markerPath !== undefined ? { markerPath: dr.markerPath } : {}),
270
+ waysOut: ['newer_build', 'separate_data_root', 'restore_backup', 'repair_access'],
271
+ }
272
+ : {}),
273
+ });
274
+ }
275
+ catch {
276
+ return undefined;
277
+ }
278
+ }
279
+ function againOf(retry, form) {
280
+ if (retry === 'command')
281
+ return msg('engine.unavailable.again.command');
282
+ return msg(form !== undefined && form.kind === 'embedded' && form.install === 'app' ? 'engine.unavailable.again.app' : 'engine.unavailable.again.session');
283
+ }
284
+ function configDirKey() {
285
+ for (const row of LOCAL_ENGINE_SPAWN_ENV)
286
+ if (row.value.kind === 'path' && row.value.slot === 'configHome' && !row.userOverridable)
287
+ return row.key;
288
+ return undefined;
289
+ }
290
+ function formOf(v) {
291
+ const kind = own(v, 'kind');
292
+ if (kind === 'deployment')
293
+ return { kind: 'deployment' };
294
+ if (kind !== 'embedded')
295
+ return undefined;
296
+ const install = own(v, 'install');
297
+ if (typeof install !== 'string' || !ENGINE_INSTALL_SHAPES.includes(install))
298
+ return undefined;
299
+ const dataDir = own(v, 'dataDir');
300
+ return { kind: 'embedded', install: install, ...(typeof dataDir === 'string' && dataDir.trim() !== '' ? { dataDir: flat(dataDir) } : {}) };
301
+ }
302
+ function dataRootWaysOut(form, highWater, retry) {
303
+ const again = againOf(retry, form);
304
+ if (form.kind === 'deployment') {
305
+ const who = highWater !== undefined ? msg('engine.bootRefusal.who.buildAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.build');
306
+ return msg('engine.bootRefusal.waysOut', {
307
+ newer: msg('engine.bootRefusal.newer.deployment', { who }),
308
+ separate: msg('engine.bootRefusal.separate.deployment'),
309
+ restore: msg('engine.bootRefusal.restoreDeployment'),
310
+ repair: msg('engine.bootRefusal.repairDeployment'),
311
+ });
312
+ }
313
+ const app = form.install === 'app';
314
+ const who = app
315
+ ? highWater !== undefined ? msg('engine.bootRefusal.who.appAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.app')
316
+ : highWater !== undefined ? msg('engine.bootRefusal.who.semaAtLeast', { version: highWater }) : msg('engine.bootRefusal.who.sema');
317
+ const newerKey = form.install === 'npm-global' || form.install === 'managed'
318
+ ? 'engine.bootRefusal.newer.update'
319
+ : form.install === 'npm-local'
320
+ ? 'engine.bootRefusal.newer.projectLocal'
321
+ : form.install === 'dev'
322
+ ? 'engine.bootRefusal.newer.devTree'
323
+ : app
324
+ ? 'engine.bootRefusal.newer.app'
325
+ : 'engine.bootRefusal.newer.unknown';
326
+ const key = configDirKey() ?? '';
327
+ return msg('engine.bootRefusal.waysOut', {
328
+ newer: msg(newerKey, { who, again }),
329
+ separate: msg(app ? 'engine.bootRefusal.separate.app' : 'engine.bootRefusal.separate.embedded', { key }),
330
+ restore: msg('engine.bootRefusal.restore', { folder: form.dataDir ?? msg('engine.bootRefusal.folder.default'), again }),
331
+ repair: msg('engine.bootRefusal.repair', { again }),
332
+ });
333
+ }
334
+ function armFix(reason, retry, facts, form) {
335
+ const again = againOf(retry, form);
336
+ switch (reason) {
337
+ case 'model_setup':
338
+ return msg('engine.unavailable.fix.modelSetup', { again });
339
+ case 'credential_conflict':
340
+ return msg('engine.unavailable.fix.credentialConflict', { again });
341
+ case 'credential_refused':
342
+ if (facts.code === 'config.center_credential_malformed')
343
+ return msg('engine.unavailable.fix.credentialMalformed', { again, tokenFile: SETTINGS_WEB_ADMIN_TOKEN_ENV.tokenFile });
344
+ if (facts.code === 'config.center_credential_user_session_multi_tenant') {
345
+ return msg('engine.unavailable.fix.credentialMultiTenant', { again, token: SETTINGS_WEB_ADMIN_TOKEN_ENV.token, tokenFile: SETTINGS_WEB_ADMIN_TOKEN_ENV.tokenFile });
346
+ }
347
+ return msg('engine.unavailable.fix.credential', { again });
348
+ case 'not_answering': {
349
+ const wait = msg(facts.answer === 'silent' ? 'engine.unavailable.wait.respond' : facts.answer === 'drain-stuck' ? 'engine.unavailable.wait.exit' : 'engine.unavailable.wait.healthy');
350
+ return facts.pid !== undefined ? msg('engine.unavailable.fix.waitPid', { wait, again, pid: facts.pid }) : msg('engine.unavailable.fix.wait', { wait, again });
351
+ }
352
+ case 'address_refused':
353
+ case 'version_refused':
354
+ return undefined;
355
+ default:
356
+ return msg('engine.unavailable.fix.diagnose', { retry: msg(retry === 'command' ? 'engine.unavailable.retry.command' : 'engine.unavailable.retry.session') });
357
+ }
358
+ }
359
+ function refusalView(r) {
360
+ const text = own(r, 'text');
361
+ const code = own(r, 'code');
362
+ const reason = own(r, 'reason');
363
+ const findingsRaw = own(r, 'findings');
364
+ let findings;
365
+ try {
366
+ if (Array.isArray(findingsRaw)) {
367
+ const fs = [];
368
+ const n = readOwnDataValue(findingsRaw, 'length');
369
+ for (let i = 0; typeof n === 'number' && i < n && i < BOOT_REFUSAL_MAX_FINDINGS + 1; i++) {
370
+ const f = readOwnDataValue(findingsRaw, String(i));
371
+ if (typeof f === 'string' && f.trim() !== '')
372
+ appendOwnElement(fs, f);
373
+ }
374
+ if (fs.length > 0)
375
+ findings = fs;
376
+ }
377
+ }
378
+ catch {
379
+ findings = undefined;
380
+ }
381
+ const hw = own(r, 'highWater');
382
+ const validReason = typeof reason === 'string' && Object.values(ENGINE_BOOT_REFUSAL_CODES).includes(reason) ? reason : undefined;
383
+ return {
384
+ ...(typeof text === 'string' && text.trim() !== '' ? { text } : {}),
385
+ ...(typeof code === 'string' && CONFIG_CODE.test(code) ? { code } : {}),
386
+ ...(validReason !== undefined ? { reason: validReason } : {}),
387
+ ...(findings !== undefined ? { findings } : {}),
388
+ ...(typeof hw === 'string' && isRelease(hw) ? { highWater: hw } : {}),
389
+ };
390
+ }
391
+ export function engineBootRefusalSentence(refusal, lang, form) {
392
+ try {
393
+ const r = refusalView(refusal);
394
+ if (r.text === undefined)
395
+ return undefined;
396
+ const f = formOf(form);
397
+ if (f !== undefined && r.reason !== undefined) {
398
+ if (r.reason === 'data_root_refused' && r.findings !== undefined) {
399
+ return renderMessage(msg('engine.bootRefusal.withWaysOut', { reason: flat(r.findings.join(' ')), waysOut: dataRootWaysOut(f, r.highWater, 'session') }), lang);
400
+ }
401
+ const fix = r.reason !== 'data_root_refused' ? armFix(r.reason, 'session', r.code !== undefined ? { code: r.code } : {}, f) : undefined;
402
+ if (fix !== undefined)
403
+ return renderMessage(msg('engine.bootRefusal.withFix', { reason: `${stripEndStop(r.text.trim())}.`, fix }), lang);
404
+ }
405
+ return renderMessage(msg('localEngine.bootRefusal', { reason: r.text }), lang);
406
+ }
407
+ catch {
408
+ return undefined;
409
+ }
410
+ }
411
+ const LANE_RETRY = Object.freeze({ interactive: 'session', print: 'command', utility: 'session' });
412
+ const HOST_CODE = /^[a-z][a-z0-9_]{0,63}$/;
413
+ export function engineUnavailableLine(facts, lane, lang) {
414
+ try {
415
+ if (typeof lane !== 'string' || !Object.hasOwn(LANE_RETRY, lane))
416
+ return undefined;
417
+ if (!isRecord(facts))
418
+ return undefined;
419
+ const retry = LANE_RETRY[lane];
420
+ const hostReasonRaw = own(facts, 'reason');
421
+ const hostReason = typeof hostReasonRaw === 'string' && ENGINE_UNAVAILABLE_REASONS.includes(hostReasonRaw) ? hostReasonRaw : undefined;
422
+ const codeRaw = own(facts, 'code');
423
+ const hostCode = typeof codeRaw === 'string' && HOST_CODE.test(codeRaw) ? codeRaw : undefined;
424
+ const detailRaw = own(facts, 'detail');
425
+ const hostDetail = typeof detailRaw === 'string' && detailRaw.trim() !== '' ? flat(detailRaw) : undefined;
426
+ const exitRaw = own(facts, 'engineExitCode');
427
+ const sigRaw = own(facts, 'engineSignal');
428
+ const pidRaw = own(facts, 'pid');
429
+ const pid = typeof pidRaw === 'number' && Number.isInteger(pidRaw) && pidRaw > 0 ? pidRaw : undefined;
430
+ const answerRaw = own(facts, 'answer');
431
+ const answer = answerRaw === 'silent' || answerRaw === 'answered' || answerRaw === 'drain-stuck' ? answerRaw : undefined;
432
+ const refusal = refusalView(own(facts, 'refusal'));
433
+ const form = formOf(own(facts, 'form'));
434
+ const reason = refusal.reason ?? hostReason;
435
+ const tag = `reason=${hostCode ?? reason ?? 'unknown'} ` +
436
+ `engine_exit=${typeof exitRaw === 'number' && Number.isFinite(exitRaw) ? String(exitRaw) : 'none'} ` +
437
+ `engine_signal=${typeof sigRaw === 'string' && /^[A-Z][A-Z0-9]{0,15}$/.test(sigRaw) ? sigRaw : 'none'}`;
438
+ let detail;
439
+ let fix;
440
+ if (refusal.reason !== undefined && refusal.text !== undefined) {
441
+ if (refusal.reason === 'data_root_refused' && form !== undefined && refusal.findings !== undefined) {
442
+ detail = flat(refusal.findings.join(' '));
443
+ fix = dataRootWaysOut(form, refusal.highWater, retry);
444
+ }
445
+ else if (refusal.reason === 'data_root_refused') {
446
+ detail = flat(refusal.text);
447
+ fix = undefined;
448
+ }
449
+ else {
450
+ detail = flat(refusal.text);
451
+ fix = armFix(refusal.reason, retry, refusal.code !== undefined ? { code: refusal.code } : {}, form);
452
+ }
453
+ }
454
+ else if (reason === 'data_root_refused') {
455
+ detail = hostDetail;
456
+ fix = form !== undefined ? dataRootWaysOut(form, undefined, retry) : undefined;
457
+ }
458
+ else {
459
+ detail = hostDetail;
460
+ fix = armFix(reason, retry, { ...(hostCode !== undefined ? { code: hostCode } : {}), ...(pid !== undefined ? { pid } : {}), ...(answer !== undefined ? { answer } : {}) }, form);
461
+ }
462
+ const head = reason === undefined
463
+ ? msg('engine.unavailable.head.unknown')
464
+ : reason === 'not_answering'
465
+ ? msg(answer === 'silent' ? 'engine.unavailable.head.notAnswering' : answer === 'drain-stuck' ? 'engine.unavailable.head.drainStuck' : 'engine.unavailable.head.noHealthyAnswer')
466
+ : reason === 'address_refused'
467
+ ? msg('engine.unavailable.head.addressRefused')
468
+ : reason === 'version_refused'
469
+ ? msg('engine.unavailable.head.versionRefused')
470
+ : reason === 'not_running' || (reason === 'model_setup' && refusal.reason === undefined)
471
+ ? msg('engine.unavailable.head.notRunning')
472
+ : msg('engine.unavailable.head.refused');
473
+ let ref;
474
+ if (reason === 'address_refused' || reason === 'version_refused') {
475
+ ref = detail !== undefined ? msg('engine.unavailable.lineRefusedUse', { tag, head, detail }) : msg('engine.unavailable.lineRefusedUseNoDetail', { tag, head });
476
+ }
477
+ else {
478
+ ref =
479
+ fix === undefined
480
+ ? detail !== undefined
481
+ ? msg('engine.unavailable.lineNoFix', { tag, head, detail })
482
+ : msg('engine.unavailable.lineBare', { tag, head })
483
+ : detail !== undefined
484
+ ? msg('engine.unavailable.line', { tag, head, detail: stripEndStop(detail), fix })
485
+ : msg('engine.unavailable.lineNoDetail', { tag, head, fix });
486
+ }
487
+ return flat(renderMessage(ref, lang));
488
+ }
489
+ catch {
490
+ return undefined;
491
+ }
492
+ }
@@ -5,7 +5,7 @@ import { resumeReopenContent } from './hitl/suspendedReopen.js';
5
5
  import { idempotencyPayloadMismatchContent } from './engineErrorCodes.js';
6
6
  import { inheritEnvRefusalContent } from './inheritEnvWire.js';
7
7
  import { projectSeedRefusalContent } from './projectSeed.js';
8
- import { usageWindowExhaustedContent, fleetLeaseUnavailableContent, settingsPermissionBucketRefusalContent, fieldLimitRefusalContent, autonomyLaneRefusalContent, sessionArchiveStampedContent, unsupportedRuleRefusalContent, admissionWallRefusalContent, hostPostureRefusalContent, toolDeclarationRefusalContent, envCredentialRefusalContent, sessionIdRetiredContent, runConcurrencyCapContent, } from './wireRefusalCopy.js';
8
+ import { usageWindowExhaustedContent, fleetLeaseUnavailableContent, settingsPermissionBucketRefusalContent, fieldLimitRefusalContent, autonomyLaneRefusalContent, sessionArchiveStampedContent, unsupportedRuleRefusalContent, admissionWallRefusalContent, hostPostureRefusalContent, toolDeclarationRefusalContent, envCredentialRefusalContent, sessionIdRetiredContent, runConcurrencyCapContent, unreadRequestMembersContent, } from './wireRefusalCopy.js';
9
9
  import { catalogDefaultRefusalContent } from './model/catalogDefault.js';
10
10
  const ROLE_BY_READER = new Map([
11
11
  [corruptSessionContent, 'replacement'],
@@ -28,6 +28,7 @@ const ROLE_BY_READER = new Map([
28
28
  [envCredentialRefusalContent, 'replacement'],
29
29
  [sessionIdRetiredContent, 'replacement'],
30
30
  [runConcurrencyCapContent, 'replacement'],
31
+ [unreadRequestMembersContent, 'replacement'],
31
32
  [admissionWallRefusalContent, 'supplement'],
32
33
  [hostPostureRefusalContent, 'supplement'],
33
34
  [toolDeclarationRefusalContent, 'supplement'],
package/dist/eventLeg.js CHANGED
@@ -9,7 +9,6 @@ import { hostLog } from './host.js';
9
9
  import { guardedRead, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
10
10
  import { settleEngineClosedApproval } from './hitl/approvalHolds.js';
11
11
  import { approvalCompleteParked } from './hitl/approvalCompleteParked.js';
12
- import { setBridgeRunHandleFallback } from './hitl/frameRouter.js';
13
12
  export const EVENT_LEG_KINDS = Object.freeze(['live', 'durable', 'continuation']);
14
13
  export const EVENT_LEG_TABLE = Object.freeze({
15
14
  live: Object.freeze({ stages: Object.freeze(['bindRun', 'stampOwner', 'hitlFrames', 'askBridge', 'idleTriage']), windowIsCurrent: true }),
@@ -249,7 +248,9 @@ export function composeEventLeg(source, leg, ports) {
249
248
  return;
250
249
  if (!isCurrentNow() || ports.signal?.aborted === true)
251
250
  return;
252
- callPort('askBridge.onBreak', () => port.call(hostBridge, event));
251
+ const legRun = lastBound?.taskId;
252
+ const named = event.runId === undefined && legRun !== undefined ? Object.freeze({ ...event, runId: legRun }) : event;
253
+ callPort('askBridge.onBreak', () => port.call(hostBridge, named));
253
254
  };
254
255
  const deps = hostView(hostBridge, {
255
256
  runsEvents: () => runsEvents,
@@ -259,7 +260,6 @@ export function composeEventLeg(source, leg, ports) {
259
260
  },
260
261
  onBreak: () => onBreak,
261
262
  });
262
- setBridgeRunHandleFallback(deps, () => lastBound?.taskId);
263
263
  inner = bridgeAskUserQuestionGates(inner, deps, { ...(ports.signal !== undefined ? { signal: ports.signal } : {}), ...(legRunId !== undefined ? { taskId: legRunId } : {}) });
264
264
  }
265
265
  const baseUrl = ports.idleTriage?.baseUrl;
@@ -3,7 +3,8 @@ import { rowIdTail } from '../workflow.js';
3
3
  import { cycleSeqValue } from '../cycleOrder.js';
4
4
  import { frozenSet } from '../frozenSet.js';
5
5
  import { guardedRead, readOwnDataValue } from '../ownKey.js';
6
- import { CORE_RESERVED_AGENT_NAMES, CORE_WORKFLOW_AGENT_PARKED_ERROR_CODE } from '../generated/engineFactTables.js';
6
+ import { CORE_RESERVED_AGENT_NAMES } from '../generated/engineFactTables.js';
7
+ import { isCoreWorkflowRunParkedEnd } from '../terminalStatuses.js';
7
8
  import { runParkedOf as coreRunParkedOf } from '../coreValuePorts.js';
8
9
  export function coerceTaskStatus(s) {
9
10
  if (s === 'parked')
@@ -34,7 +35,7 @@ export function workflowRunDisplayStatusOf(run) {
34
35
  const status = runField(run, 'status');
35
36
  if (parkedWindowOf(run, status))
36
37
  return 'awaiting approval';
37
- if (status === 'failed' && runField(run, 'errorCode') === CORE_WORKFLOW_AGENT_PARKED_ERROR_CODE)
38
+ if (isCoreWorkflowRunParkedEnd(status, runField(run, 'errorCode')))
38
39
  return 'awaiting approval';
39
40
  switch (status) {
40
41
  case 'completed':
@@ -75,3 +75,5 @@ export declare const CORE_PRESENT_PLAN_TOOL_NAME: "ExitPlanMode";
75
75
  export declare const CORE_WORKFLOW_AGENT_PARKED_ERROR_CODE: "workflow.agent_parked";
76
76
  export declare const CORE_REFUSAL_ECHO_KINDS: readonly ["path", "command", "pattern"];
77
77
  export declare const CORE_DISCARDED_DELIVERY_PATHS: readonly ["live", "box", "drain", "notice"];
78
+ export declare const CORE_INPUT_AUTHORS: readonly ["operator", "parent_model", "workflow", "peer", "observer", "engine", "extension"];
79
+ export declare const CORE_RUN_ORIGINS: readonly ["scheduled"];
@@ -477,3 +477,15 @@ export const CORE_DISCARDED_DELIVERY_PATHS = Object.freeze([
477
477
  "drain",
478
478
  "notice",
479
479
  ]);
480
+ export const CORE_INPUT_AUTHORS = Object.freeze([
481
+ "operator",
482
+ "parent_model",
483
+ "workflow",
484
+ "peer",
485
+ "observer",
486
+ "engine",
487
+ "extension",
488
+ ]);
489
+ export const CORE_RUN_ORIGINS = Object.freeze([
490
+ "scheduled",
491
+ ]);
@@ -1,4 +1,4 @@
1
- export declare const SDK_ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb"];
1
+ export declare const SDK_ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb", "stall_verdict"];
2
2
  export declare const SDK_STATUS_DERIVED_COARSE_CODES: readonly ["request.rejected", "auth.unauthorized", "auth.forbidden", "not_found.resource", "request.payload_too_large", "request.unprocessable", "limit.rate_exceeded", "capability.unavailable", "internal.error"];
3
3
  export declare const SDK_DENY_REASON_ROUTING_FAILURE: "routing_failure_fail_closed";
4
4
  export declare const SDK_ASK_ROW_ENDING_CAUSES: readonly ["routing_failure_fail_closed", "run_cancelled", "run_exited", "batch_aborted", "batch_sibling_withdrawn", "batch_bound_elsewhere", "adhoc_leg_no_durable_domain", "orphan_ttl_exceeded", "crashed_before_park", "shutdown_before_park"];
@@ -10,3 +10,4 @@ export declare const SDK_PERMISSION_MODE_PERSIST_MISSES: readonly ["claim_releas
10
10
  export declare const SDK_DECIDE_BINDING_KEYS: readonly ["boundCallId", "boundInputHash"];
11
11
  export declare const SDK_APPROVAL_QUEUE_KINDS: readonly ["checkpoint", "peer_inbound"];
12
12
  export declare const SDK_SESSION_MEMORY_UNOBSERVED_REASONS: readonly ["no_settled_run", "run_result_missing", "run_result_unobserved", "memory_not_mounted", "no_leaf"];
13
+ export declare const SDK_STREAM_ENDED_REASONS: readonly ["empty_legs", "consecutive_failures"];
@@ -2,6 +2,7 @@ export const SDK_ABORT_CAUSES = Object.freeze([
2
2
  "client_disconnected",
3
3
  "ask_park_grace_exhausted",
4
4
  "cancel_verb",
5
+ "stall_verdict",
5
6
  ]);
6
7
  export const SDK_STATUS_DERIVED_COARSE_CODES = Object.freeze([
7
8
  "request.rejected",
@@ -63,3 +64,7 @@ export const SDK_SESSION_MEMORY_UNOBSERVED_REASONS = Object.freeze([
63
64
  "memory_not_mounted",
64
65
  "no_leaf",
65
66
  ]);
67
+ export const SDK_STREAM_ENDED_REASONS = Object.freeze([
68
+ "empty_legs",
69
+ "consecutive_failures",
70
+ ]);
@@ -14,4 +14,8 @@ export declare const SETTINGS_MCP_CONTENT_ORIGINS: readonly ["local", "execution
14
14
  export declare const SETTINGS_MIN_TRUST_WORDS: readonly ["local", "session", "project", "global", "managed", "task"];
15
15
  export declare const SETTINGS_WORKSPACE_TRUST_STATES: readonly ["accepted", "declined", "no_trust_step"];
16
16
  export declare const SETTINGS_MODEL_PLANE_REFUSAL_CODES: readonly ["config.default_model_missing", "config.model_refused_name_minted", "config.model_route_endpoint_missing", "config.gateway_fallback_without_primary", "config.catalog_replaces_env_models"];
17
+ export declare const SETTINGS_WEB_ADMIN_TOKEN_ENV: Readonly<{
18
+ readonly token: "SEMA_WEB_ADMIN_TOKEN";
19
+ readonly tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE";
20
+ }>;
17
21
  export declare const SETTINGS_NO_EXECUTION_TARGET_LANES: readonly ["none"];
@@ -70,6 +70,7 @@ export const SETTINGS_MODEL_PLANE_REFUSAL_CODES = Object.freeze([
70
70
  "config.gateway_fallback_without_primary",
71
71
  "config.catalog_replaces_env_models",
72
72
  ]);
73
+ export const SETTINGS_WEB_ADMIN_TOKEN_ENV = Object.freeze({ token: "SEMA_WEB_ADMIN_TOKEN", tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE" });
73
74
  export const SETTINGS_NO_EXECUTION_TARGET_LANES = Object.freeze([
74
75
  "none",
75
76
  ]);
@@ -9,5 +9,11 @@ export interface ApprovalAskReasonByPolicy {
9
9
  readonly words: string;
10
10
  }
11
11
  export type ApprovalAskReason = ApprovalAskReasonByHook | ApprovalAskReasonByPolicy;
12
+ export interface ApprovalRequestedBy {
13
+ readonly kind: 'extension';
14
+ readonly name: string;
15
+ }
12
16
  export declare function approvalAskReasonsOf(carrier: object | null | undefined): readonly ApprovalAskReason[] | undefined;
17
+ export declare function requestedByViewOf(v: object | null | undefined): ApprovalRequestedBy | undefined;
18
+ export declare function approvalRequestedByOf(carrier: object | null | undefined): ApprovalRequestedBy | undefined;
13
19
  export declare function approvalAgentIdOf(carrier: object | null | undefined): string | undefined;