@sema-agent/client-core 0.100.0 → 0.102.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 (358) hide show
  1. package/CHANGELOG.md +452 -0
  2. package/README.md +172 -120
  3. package/dist/adapt/arms.js +51 -16
  4. package/dist/adapt/textStream.js +7 -4
  5. package/dist/adapt/toolCards.d.ts +2 -1
  6. package/dist/adapt/toolCards.js +28 -13
  7. package/dist/adapt.d.ts +1 -1
  8. package/dist/adapt.js +8 -2
  9. package/dist/adapter/activeRunSelfHeal.d.ts +24 -2
  10. package/dist/adapter/activeRunSelfHeal.js +108 -6
  11. package/dist/adapter/downstream/eventToSdkMessage.js +38 -79
  12. package/dist/adapter/downstream/terminalToSdkResult.d.ts +60 -1
  13. package/dist/adapter/downstream/terminalToSdkResult.js +209 -39
  14. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
  15. package/dist/adapter/downstream/wiringManifestView.js +138 -0
  16. package/dist/adapter/runStream.d.ts +4 -4
  17. package/dist/adapter/runStream.js +158 -43
  18. package/dist/agentsWireCaps.d.ts +2 -7
  19. package/dist/agentsWireCaps.js +1 -2
  20. package/dist/approvalDecidedByCapability.js +2 -2
  21. package/dist/approvalFrameFamilies.d.ts +33 -0
  22. package/dist/approvalFrameFamilies.js +120 -0
  23. package/dist/approvalsStreamLiveCapability.js +2 -2
  24. package/dist/attachmentsWireCaps.js +41 -13
  25. package/dist/callerCwdCapability.js +2 -2
  26. package/dist/centerWiringCapability.js +2 -2
  27. package/dist/clockReading.d.ts +2 -0
  28. package/dist/clockReading.js +4 -0
  29. package/dist/cloudConfigWireCaps.d.ts +19 -5
  30. package/dist/cloudConfigWireCaps.js +193 -56
  31. package/dist/compensations.js +1 -1
  32. package/dist/coreValuePorts.d.ts +12 -2
  33. package/dist/coreValuePorts.js +9 -0
  34. package/dist/decideFailureNote.js +5 -3
  35. package/dist/decideReceipt.js +2 -2
  36. package/dist/deviceExecutorManagementCapability.js +2 -2
  37. package/dist/deviceFlowPolling.js +1 -1
  38. package/dist/disableSkillsWire.d.ts +1 -1
  39. package/dist/disableSkillsWire.js +4 -3
  40. package/dist/displayUntrusted.d.ts +9 -4
  41. package/dist/displayUntrusted.js +834 -104
  42. package/dist/engineCapReader.js +1 -1
  43. package/dist/engineConfigDrift.js +1 -1
  44. package/dist/engineErrorCodes.d.ts +14 -5
  45. package/dist/engineErrorCodes.js +27 -6
  46. package/dist/engineGenerationConvergence.d.ts +39 -0
  47. package/dist/engineGenerationConvergence.js +95 -0
  48. package/dist/engineGenerationPort.d.ts +61 -0
  49. package/dist/engineGenerationPort.js +144 -0
  50. package/dist/engineHealthFacts.d.ts +23 -0
  51. package/dist/engineHealthFacts.js +92 -0
  52. package/dist/engineIdentity.d.ts +4 -0
  53. package/dist/engineIdentity.js +11 -0
  54. package/dist/engineNoticeCodes.d.ts +2 -5
  55. package/dist/engineRowRef.js +4 -0
  56. package/dist/engineSessionMessages.js +2 -2
  57. package/dist/engineToolDirectory.js +2 -2
  58. package/dist/engineWireFor.d.ts +99 -0
  59. package/dist/engineWireFor.js +248 -6
  60. package/dist/engineWireTarget.d.ts +1 -0
  61. package/dist/engineWireTarget.js +8 -0
  62. package/dist/env/uiLanguage.js +1 -1
  63. package/dist/errorSupplementRoles.d.ts +3 -0
  64. package/dist/errorSupplementRoles.js +37 -0
  65. package/dist/executionLaneCapability.js +2 -2
  66. package/dist/fileHistoryCaptureCapability.js +3 -3
  67. package/dist/finalVerifyWire.d.ts +6 -3
  68. package/dist/finalVerifyWire.js +6 -23
  69. package/dist/flagInput.d.ts +4 -0
  70. package/dist/flagInput.js +24 -0
  71. package/dist/fleet/fleetLedger.js +5 -2
  72. package/dist/fleet/fleetProjection.d.ts +1 -0
  73. package/dist/fleet/fleetProjection.js +16 -3
  74. package/dist/gateVocabulary.js +3 -0
  75. package/dist/generated/engineFactTables.d.ts +7 -3
  76. package/dist/generated/engineFactTables.js +52 -0
  77. package/dist/generated/engineNoticeTables.js +12 -0
  78. package/dist/generated/settingsSchemaActiveTiers.d.ts +1 -0
  79. package/dist/generated/settingsSchemaActiveTiers.js +14 -0
  80. package/dist/generated/settingsSchemaCallerTextEcho.d.ts +1 -0
  81. package/dist/generated/settingsSchemaCallerTextEcho.js +8 -0
  82. package/dist/generated/settingsSchemaControlAndBidi.d.ts +1 -0
  83. package/dist/generated/settingsSchemaControlAndBidi.js +8 -0
  84. package/dist/generated/settingsSchemaDefaultModel.d.ts +11 -0
  85. package/dist/generated/settingsSchemaDefaultModel.js +25 -0
  86. package/dist/generated/settingsSchemaFns.d.ts +54 -0
  87. package/dist/generated/settingsSchemaFns.js +26 -1
  88. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
  89. package/dist/generated/settingsSchemaMcpRequestEntry.js +1 -7
  90. package/dist/generated/settingsSchemaSafetyMergeSpec.d.ts +1 -0
  91. package/dist/generated/settingsSchemaSafetyMergeSpec.js +95 -0
  92. package/dist/generated/settingsSchemaSettingsSources.d.ts +1 -0
  93. package/dist/generated/settingsSchemaSettingsSources.js +58 -0
  94. package/dist/generated/settingsSchemaTables.d.ts +2 -0
  95. package/dist/generated/settingsSchemaTables.js +13 -0
  96. package/dist/generated/settingsSchemaUrlPattern.d.ts +1 -0
  97. package/dist/generated/settingsSchemaUrlPattern.js +183 -0
  98. package/dist/headlessPermissionModeWire.d.ts +18 -2
  99. package/dist/headlessPermissionModeWire.js +30 -19
  100. package/dist/hitl/allowRuleShadow.js +7 -5
  101. package/dist/hitl/approvalCardReading.d.ts +3 -0
  102. package/dist/hitl/approvalCardReading.js +17 -0
  103. package/dist/hitl/approvalCompleteParked.js +1 -1
  104. package/dist/hitl/approvalDelivery.d.ts +87 -0
  105. package/dist/hitl/approvalDelivery.js +193 -0
  106. package/dist/hitl/approvalResolution.d.ts +11 -0
  107. package/dist/hitl/approvalResolution.js +50 -11
  108. package/dist/hitl/askClassPair.d.ts +6 -0
  109. package/dist/hitl/askClassPair.js +30 -3
  110. package/dist/hitl/askParkAutoReopenBlock.d.ts +30 -0
  111. package/dist/hitl/askParkAutoReopenBlock.js +117 -0
  112. package/dist/hitl/askParkRowRouting.js +4 -1
  113. package/dist/hitl/attributionLadder.d.ts +42 -3
  114. package/dist/hitl/attributionLadder.js +79 -8
  115. package/dist/hitl/automaticAnswerVerdict.d.ts +6 -1
  116. package/dist/hitl/automaticAnswerVerdict.js +46 -11
  117. package/dist/hitl/crashConverged.js +2 -2
  118. package/dist/hitl/decisionConflict.d.ts +6 -2
  119. package/dist/hitl/decisionConflict.js +24 -9
  120. package/dist/hitl/decisionRefusal.d.ts +20 -10
  121. package/dist/hitl/decisionRefusal.js +99 -54
  122. package/dist/hitl/decisionSend.d.ts +3 -0
  123. package/dist/hitl/decisionSend.js +87 -103
  124. package/dist/hitl/frameRouter.d.ts +1 -0
  125. package/dist/hitl/frameRouter.js +9 -2
  126. package/dist/hitl/hitlBridge.d.ts +18 -6
  127. package/dist/hitl/hitlBridge.js +41 -37
  128. package/dist/hitl/livePendingAsk.js +4 -3
  129. package/dist/hitl/noAllowCause.js +1 -1
  130. package/dist/hitl/parkResolver.js +3 -2
  131. package/dist/hitl/persistedRulesWire.js +1 -0
  132. package/dist/hitl/planReviewWire.d.ts +4 -0
  133. package/dist/hitl/planReviewWire.js +59 -30
  134. package/dist/hitl/resumeRunningCard.d.ts +3 -2
  135. package/dist/hitl/resumeRunningCard.js +17 -11
  136. package/dist/hitl/sessionPolicyDeliverable.d.ts +5 -2
  137. package/dist/hitl/sessionPolicyDeliverable.js +62 -29
  138. package/dist/hitl/sessionPolicyWire.d.ts +13 -3
  139. package/dist/hitl/sessionPolicyWire.js +81 -16
  140. package/dist/hitl/standingRows.js +1 -1
  141. package/dist/hitl/toolApprovalWire.d.ts +9 -10
  142. package/dist/hitl/toolApprovalWire.js +72 -54
  143. package/dist/hookMatcherVerdict.d.ts +2 -0
  144. package/dist/hookMatcherVerdict.js +12 -0
  145. package/dist/hooksCompactTransition.d.ts +19 -0
  146. package/dist/hooksCompactTransition.js +41 -0
  147. package/dist/hooksWireCaps.d.ts +1 -1
  148. package/dist/hooksWireCaps.js +202 -203
  149. package/dist/host.d.ts +1 -14
  150. package/dist/host.js +0 -8
  151. package/dist/hostCallbackGuard.d.ts +1 -0
  152. package/dist/hostCallbackGuard.js +1 -1
  153. package/dist/hostSettingsSource.d.ts +172 -0
  154. package/dist/hostSettingsSource.js +675 -0
  155. package/dist/hostTurnSettings.d.ts +73 -17
  156. package/dist/hostTurnSettings.js +594 -97
  157. package/dist/httpHookPolicy.d.ts +37 -0
  158. package/dist/httpHookPolicy.js +176 -0
  159. package/dist/humanTurn.d.ts +2 -1
  160. package/dist/humanTurn.js +37 -7
  161. package/dist/humanTurnRead.js +4 -3
  162. package/dist/humanTurnSentences.d.ts +10 -0
  163. package/dist/humanTurnSentences.js +74 -0
  164. package/dist/i18n/messages.en.d.ts +222 -2
  165. package/dist/i18n/messages.en.js +225 -5
  166. package/dist/i18n/messages.zh.js +237 -5
  167. package/dist/i18n/translate.js +3 -3
  168. package/dist/index.d.ts +77 -15
  169. package/dist/index.js +50 -13
  170. package/dist/inheritEnvCapability.d.ts +3 -1
  171. package/dist/inheritEnvCapability.js +31 -17
  172. package/dist/inheritEnvWire.d.ts +2 -1
  173. package/dist/inheritEnvWire.js +11 -5
  174. package/dist/interactiveHalt.d.ts +3 -1
  175. package/dist/interactiveHalt.js +2 -0
  176. package/dist/interactiveInterrupt.d.ts +2 -0
  177. package/dist/interactiveInterrupt.js +15 -0
  178. package/dist/interactiveToolsWire.d.ts +4 -2
  179. package/dist/interactiveToolsWire.js +5 -5
  180. package/dist/jsonFaithful.d.ts +20 -0
  181. package/dist/jsonFaithful.js +152 -0
  182. package/dist/limitsWire.d.ts +7 -2
  183. package/dist/limitsWire.js +19 -13
  184. package/dist/liveInitToolFace.d.ts +6 -1
  185. package/dist/liveInitToolFace.js +5 -3
  186. package/dist/liveModelCatalog.d.ts +22 -0
  187. package/dist/liveModelCatalog.js +132 -18
  188. package/dist/mcpPanel.js +1 -1
  189. package/dist/mcpProbeCapability.js +2 -2
  190. package/dist/mcpStatusSupersetKeys.d.ts +24 -0
  191. package/dist/mcpStatusSupersetKeys.js +45 -0
  192. package/dist/mcpToolToggles.js +2 -1
  193. package/dist/mcpWireCaps.d.ts +39 -1
  194. package/dist/mcpWireCaps.js +254 -50
  195. package/dist/memoryComplianceCapability.js +2 -2
  196. package/dist/memoryOriginCapability.js +2 -2
  197. package/dist/model/catalogDefault.d.ts +24 -0
  198. package/dist/model/catalogDefault.js +4 -0
  199. package/dist/model/liveCatalogShape.js +5 -4
  200. package/dist/model/modelsPolicy.js +4 -3
  201. package/dist/model/onboardJudgement.d.ts +1 -0
  202. package/dist/model/onboardJudgement.js +1 -1
  203. package/dist/model/subagentModelWord.js +2 -2
  204. package/dist/modelCapabilityProbe.js +6 -6
  205. package/dist/modelIdentityResolvability.d.ts +10 -1
  206. package/dist/modelIdentityResolvability.js +62 -39
  207. package/dist/modsFace.d.ts +8 -0
  208. package/dist/modsFace.js +59 -0
  209. package/dist/modsKernelIdentity.d.ts +10 -0
  210. package/dist/modsKernelIdentity.js +103 -0
  211. package/dist/modsKernelTransit.d.ts +8 -0
  212. package/dist/modsKernelTransit.js +6 -0
  213. package/dist/notifications.d.ts +30 -12
  214. package/dist/notifications.js +241 -53
  215. package/dist/outputStyleSeatCapability.js +2 -2
  216. package/dist/ownKey.d.ts +12 -0
  217. package/dist/ownKey.js +179 -3
  218. package/dist/panelReduce.js +1 -1
  219. package/dist/peerFrames.d.ts +1 -1
  220. package/dist/peerFrames.js +6 -2
  221. package/dist/peerLaneCapability.js +2 -2
  222. package/dist/permissionModesCapability.js +4 -4
  223. package/dist/permissionRuleIssue.js +2 -0
  224. package/dist/permissionRulesWriteCapability.js +2 -2
  225. package/dist/permissionsAllowGrantCapability.js +2 -2
  226. package/dist/permissionsDeclaration.d.ts +43 -4
  227. package/dist/permissionsDeclaration.js +102 -35
  228. package/dist/pluginHooksWire.d.ts +20 -4
  229. package/dist/pluginHooksWire.js +92 -53
  230. package/dist/prepareRefusal.d.ts +3 -2
  231. package/dist/prepareRefusal.js +27 -9
  232. package/dist/printInitToolFace.js +2 -2
  233. package/dist/printModelStatus.js +1 -1
  234. package/dist/printToolResultFrame.js +1 -1
  235. package/dist/projectMemory.d.ts +32 -0
  236. package/dist/projectMemory.js +70 -0
  237. package/dist/promptBlockedCopy.d.ts +2 -1
  238. package/dist/promptBlockedCopy.js +2 -1
  239. package/dist/promptDelivery.d.ts +23 -3
  240. package/dist/promptDelivery.js +169 -30
  241. package/dist/providerRejection.d.ts +19 -1
  242. package/dist/providerRejection.js +75 -4
  243. package/dist/queuedDelivery.d.ts +48 -0
  244. package/dist/queuedDelivery.js +233 -0
  245. package/dist/reattachWindow.d.ts +94 -0
  246. package/dist/reattachWindow.js +127 -0
  247. package/dist/request/printNotification.d.ts +1 -1
  248. package/dist/request/printNotification.js +6 -2
  249. package/dist/request/submissionIdentity.d.ts +37 -0
  250. package/dist/request/submissionIdentity.js +65 -0
  251. package/dist/request/taskRequest.d.ts +33 -4
  252. package/dist/request/taskRequest.js +341 -156
  253. package/dist/resultFrameKeys.d.ts +1 -0
  254. package/dist/resultFrameKeys.js +4 -1
  255. package/dist/retryStatus.d.ts +8 -0
  256. package/dist/retryStatus.js +57 -9
  257. package/dist/rewindArchiveCapability.js +2 -2
  258. package/dist/rewindEngineAction.d.ts +2 -0
  259. package/dist/rewindEngineAction.js +23 -1
  260. package/dist/rowKind.d.ts +36 -0
  261. package/dist/rowKind.js +97 -0
  262. package/dist/ruleCompileVerdict.d.ts +18 -0
  263. package/dist/ruleCompileVerdict.js +67 -2
  264. package/dist/ruleReadings.d.ts +58 -0
  265. package/dist/ruleReadings.js +132 -0
  266. package/dist/ruleRefusalSentence.d.ts +4 -0
  267. package/dist/ruleRefusalSentence.js +9 -3
  268. package/dist/runCancelContext.d.ts +0 -1
  269. package/dist/runCancelContext.js +1 -2
  270. package/dist/runTerminal.d.ts +5 -0
  271. package/dist/runTerminal.js +52 -17
  272. package/dist/sandboxWire.d.ts +1 -1
  273. package/dist/sandboxWire.js +4 -6
  274. package/dist/scenarioRefusal.js +1 -1
  275. package/dist/scenarioSkills.d.ts +20 -0
  276. package/dist/scenarioSkills.js +72 -0
  277. package/dist/scenarioWire.d.ts +5 -2
  278. package/dist/scenarioWire.js +9 -9
  279. package/dist/sealedKeyCapability.js +2 -2
  280. package/dist/seam.d.ts +2 -0
  281. package/dist/seam.js +3 -3
  282. package/dist/seatContract.d.ts +68 -7
  283. package/dist/seatContract.js +84 -25
  284. package/dist/selfOrchestrationDenial.js +1 -1
  285. package/dist/sessionBackground.d.ts +165 -0
  286. package/dist/sessionBackground.js +781 -0
  287. package/dist/sessionBackgroundHandoff.d.ts +54 -0
  288. package/dist/sessionBackgroundHandoff.js +321 -0
  289. package/dist/sessionMap.js +4 -1
  290. package/dist/sessionPolicyCapability.js +2 -2
  291. package/dist/sessionRulesChildrenReadLive.d.ts +6 -0
  292. package/dist/sessionRulesChildrenReadLive.js +5 -0
  293. package/dist/sessionRulesNamespaceFormsCapability.d.ts +12 -0
  294. package/dist/sessionRulesNamespaceFormsCapability.js +29 -0
  295. package/dist/sessionSyncFileHistoryCapability.js +2 -2
  296. package/dist/settingsCredentialKeyPaths.js +55 -15
  297. package/dist/settingsHooksSalvage.d.ts +1 -0
  298. package/dist/settingsHooksSalvage.js +7 -1
  299. package/dist/settingsLayerAdmission.d.ts +4 -0
  300. package/dist/settingsLayerAdmission.js +16 -0
  301. package/dist/skillToolListsCapability.js +6 -5
  302. package/dist/skillsWireCaps.d.ts +14 -0
  303. package/dist/skillsWireCaps.js +47 -16
  304. package/dist/slashCommandGate.d.ts +24 -0
  305. package/dist/slashCommandGate.js +74 -0
  306. package/dist/slashCommandTable.d.ts +14 -0
  307. package/dist/slashCommandTable.js +99 -0
  308. package/dist/sqlEngineCapability.js +2 -2
  309. package/dist/steerPriorityCapability.js +2 -2
  310. package/dist/storePostureCapability.js +2 -2
  311. package/dist/subagent/agentStateDetail.js +1 -1
  312. package/dist/subagent/engineDelegatedPrompt.d.ts +9 -0
  313. package/dist/subagent/engineDelegatedPrompt.js +38 -7
  314. package/dist/subagent/engineRowStopGate.js +2 -2
  315. package/dist/subagent/engineSubagentResume.js +3 -3
  316. package/dist/subagent/engineTaskHandleWire.d.ts +1 -0
  317. package/dist/subagent/engineTaskHandleWire.js +10 -0
  318. package/dist/submitFailure.d.ts +8 -0
  319. package/dist/submitFailure.js +17 -0
  320. package/dist/supportFloor.d.ts +1 -0
  321. package/dist/supportFloor.js +7 -0
  322. package/dist/terminationIntent.d.ts +55 -0
  323. package/dist/terminationIntent.js +352 -0
  324. package/dist/thinkingLatch.d.ts +69 -0
  325. package/dist/thinkingLatch.js +255 -0
  326. package/dist/thinkingLatchWords.d.ts +7 -0
  327. package/dist/thinkingLatchWords.js +4 -0
  328. package/dist/toolHistoryMismatch.d.ts +8 -0
  329. package/dist/toolHistoryMismatch.js +37 -6
  330. package/dist/toolResult.d.ts +13 -3
  331. package/dist/toolResult.js +159 -32
  332. package/dist/toolResultContent.d.ts +13 -0
  333. package/dist/toolResultContent.js +82 -7
  334. package/dist/toolRoster.d.ts +18 -0
  335. package/dist/toolRoster.js +64 -0
  336. package/dist/turnFailurePresentation.js +27 -90
  337. package/dist/usageLimitAutoResume.d.ts +74 -0
  338. package/dist/usageLimitAutoResume.js +227 -0
  339. package/dist/userAttachmentEnvelope.js +1 -1
  340. package/dist/userAttachmentSeat.js +5 -5
  341. package/dist/userInvokedSkillsCapability.js +2 -2
  342. package/dist/webSearchBackendCapability.js +2 -2
  343. package/dist/wireErrorTriage.js +99 -50
  344. package/dist/wireFailureShape.d.ts +25 -1
  345. package/dist/wireFailureShape.js +92 -5
  346. package/dist/wireRefusalCopy.d.ts +24 -1
  347. package/dist/wireRefusalCopy.js +253 -32
  348. package/dist/wiringFleetDoctor.d.ts +3 -0
  349. package/dist/wiringFleetDoctor.js +21 -0
  350. package/dist/workflow.d.ts +2 -1
  351. package/dist/workflow.js +38 -1
  352. package/dist/workflowClient.d.ts +2 -7
  353. package/dist/workflowsJournalCapability.js +2 -2
  354. package/dist/writeProtectionCapability.js +2 -2
  355. package/docs/INTEGRATION-CLIENTS.md +907 -182
  356. package/package.json +14 -3
  357. package/dist/argvFlagValue.d.ts +0 -8
  358. package/dist/argvFlagValue.js +0 -37
@@ -0,0 +1,24 @@
1
+ import { guardedRead, readOwnDataValue } from './ownKey.js';
2
+ function flagSlot(flags, key) {
3
+ return guardedRead(() => readOwnDataValue(flags, key));
4
+ }
5
+ export function flagObject(flags, key) {
6
+ const v = flagSlot(flags, key);
7
+ try {
8
+ return typeof v === 'object' && v !== null && !Array.isArray(v) ? v : undefined;
9
+ }
10
+ catch {
11
+ return undefined;
12
+ }
13
+ }
14
+ export function flagIsWronglyTyped(flags, key) {
15
+ const v = flagSlot(flags, key);
16
+ return v !== undefined && typeof v !== 'string';
17
+ }
18
+ export function flagString(flags, key) {
19
+ const v = flagSlot(flags, key);
20
+ return typeof v === 'string' ? v : undefined;
21
+ }
22
+ export function flagTrue(flags, key) {
23
+ return flagSlot(flags, key) === true;
24
+ }
@@ -12,6 +12,7 @@ import { isSdkFleetTaskTerminal, isSdkFleetTaskTerminalNotSuccess } from '../ter
12
12
  import { projectTasks, projectWorkflows, wireCycleSeq, wireParentId, } from './fleetProjection.js';
13
13
  import { isInStreamDrainingEnd } from '../wireErrorTriage.js';
14
14
  import { cycleSeqOrder, cycleSeqValue } from '../cycleOrder.js';
15
+ import { guardedRead, ownSnapshotRecord, readOwnDataValue } from '../ownKey.js';
15
16
  export const TERMINAL_RETAIN_MS = 60_000;
16
17
  function hasRowId(row) {
17
18
  const id = row?.id;
@@ -382,7 +383,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
382
383
  hooks.onHookNotice?.(frame, sessionScopedMeta === true);
383
384
  break;
384
385
  case 'bg_notification':
385
- applyBgNotification(frame.notification, ing);
386
+ applyBgNotification(guardedRead(() => readOwnDataValue(frame, 'notification')), ing);
386
387
  break;
387
388
  default:
388
389
  if (isInStreamDrainingEnd(frame)) {
@@ -394,7 +395,8 @@ export function createFleetLedger(hooks = {}, opts = {}) {
394
395
  break;
395
396
  }
396
397
  }
397
- function applyBgNotification(n, ing) {
398
+ function applyBgNotification(raw, ing) {
399
+ const n = ownSnapshotRecord(raw);
398
400
  if (typeof n?.taskId !== 'string' || typeof n?.status !== 'string') {
399
401
  droppedMalformed++;
400
402
  debug('[fleet-frame] MALFORMED bg_notification dropped(taskId 或 status 缺席/非串)');
@@ -554,6 +556,7 @@ export function createFleetLedger(hooks = {}, opts = {}) {
554
556
  status: n.status,
555
557
  ...(typeof n.seq === 'number' ? { seq: n.seq } : {}),
556
558
  ...(typeof n.summary === 'string' ? { summary: n.summary } : {}),
559
+ ...(typeof n.completionId === 'string' && n.completionId.length > 0 ? { completionId: n.completionId } : {}),
557
560
  });
558
561
  }
559
562
  function project(nowMs, opts) {
@@ -54,6 +54,7 @@ export interface FleetWorkflowView {
54
54
  }
55
55
  export declare function coerceTaskStatus(s: string): FleetTaskStatus;
56
56
  export declare function coerceWorkflowStatus(s: string | undefined): FleetTaskStatus;
57
+ export declare function workflowRunDisplayStatusOf(run: object | null | undefined): FleetTaskStatus;
57
58
  export declare const CONTROL_TOOL_VERBS: ReadonlySet<string>;
58
59
  export declare function projectDescription(description: string | undefined): string;
59
60
  export declare function wireParentId(r: Pick<FleetTaskRow, 'parentId'>): string | undefined;
@@ -2,6 +2,7 @@ import { collapseLabel, escapeDisplayControlChars, taskDescFromName } from '../f
2
2
  import { rowIdTail } from '../workflow.js';
3
3
  import { cycleSeqValue } from '../cycleOrder.js';
4
4
  import { frozenSet } from '../frozenSet.js';
5
+ import { guardedRead, readOwnDataValue } from '../ownKey.js';
5
6
  import { CORE_RESERVED_AGENT_NAMES } from '../generated/engineFactTables.js';
6
7
  export function coerceTaskStatus(s) {
7
8
  if (s === 'parked')
@@ -26,7 +27,15 @@ export function coerceTaskStatus(s) {
26
27
  }
27
28
  }
28
29
  export function coerceWorkflowStatus(s) {
29
- switch (s) {
30
+ return workflowRunDisplayStatusOf({ status: s });
31
+ }
32
+ export function workflowRunDisplayStatusOf(run) {
33
+ const status = runField(run, 'status');
34
+ if (runField(run, 'parked') === true)
35
+ return 'awaiting approval';
36
+ if (status === 'failed' && runField(run, 'errorCode') === WORKFLOW_AGENT_PARKED_ERROR_CODE)
37
+ return 'awaiting approval';
38
+ switch (status) {
30
39
  case 'completed':
31
40
  return 'completed';
32
41
  case 'failed':
@@ -43,6 +52,10 @@ export function coerceWorkflowStatus(s) {
43
52
  return 'idle';
44
53
  }
45
54
  }
55
+ const WORKFLOW_AGENT_PARKED_ERROR_CODE = 'workflow.agent_parked';
56
+ function runField(run, key) {
57
+ return guardedRead(() => typeof run === 'object' && run !== null && !Array.isArray(run) ? readOwnDataValue(run, key) : undefined);
58
+ }
46
59
  function deriveAgentLabel(agentType, agentName, name, id) {
47
60
  const identity = collapseLabel(agentName ?? '') || collapseLabel(agentType ?? '');
48
61
  if (identity)
@@ -218,7 +231,7 @@ export function projectWorkflows(rows) {
218
231
  id: r.id,
219
232
  name: collapseLabel(r.name ?? '') || 'Dynamic workflow',
220
233
  description: projectDescription(r.description),
221
- status: coerceWorkflowStatus(r.status),
234
+ status: workflowRunDisplayStatusOf(r),
222
235
  ...wireNumberKey('doneCount', wireCount(r.doneCount)),
223
236
  ...wireNumberKey('totalCount', wireCount(r.totalCount)),
224
237
  ...wireNumberKey('elapsedMs', wireDuration(r.elapsedMs)),
@@ -315,7 +328,7 @@ export const FLEET_TASK_ROW_KEYS_NOT_PROJECTED = {
315
328
  kind: 'by-design',
316
329
  owner: 'client-core 规范重构轮',
317
330
  reason: 'SDK 3.0.0 新键([2070]① 让位半场:前台 delegation 复合 id 行带 "run-leg" 标)。**渲染视图**(FleetTaskView)不投 —— 渲染面没有按车道分支的需求,' +
318
- '#95 纪律:没人读的键不盲投。🆕 0.96.0 CC-643 起它有了消费者,但住在另一张读面:在飞 bg 读面行(EngineActiveBgTask)投了它,' +
331
+ '纪律:没人读的键不盲投。🆕 0.96.0 CC-643 起它有了消费者,但住在另一张读面:在飞 bg 读面行(EngineActiveBgTask)投了它,' +
319
332
  '「这一行是不是后台子代」的单一判定口 isBackgroundSubagentRow 读它(见 fleet/bgSubagentRow.ts);视图不投的理由不变,不是第二份真源。',
320
333
  },
321
334
  agentType: {
@@ -105,6 +105,8 @@ const RULE_OFFERS_ABSENCE_KEYS = Object.freeze({
105
105
  },
106
106
  lane_cannot_speak: { line: 'approval.ruleOffer.absence.laneCannotSpeak' },
107
107
  });
108
+ const _absenceWordsPin = true;
109
+ void _absenceWordsPin;
108
110
  export function ruleOffersAbsenceDetail(reason, opts, lang) {
109
111
  if (typeof reason !== 'string' || reason === '')
110
112
  return undefined;
@@ -144,6 +146,7 @@ const APPROVAL_MANDATE_KEYS = Object.freeze({
144
146
  probe_unanswered: 'approval.mandate.word.probeUnanswered',
145
147
  write_protection: 'approval.mandate.word.writeProtection',
146
148
  target_unresolved: 'approval.mandate.word.targetUnresolved',
149
+ cross_boundary_taint: 'approval.mandate.word.crossBoundaryTaint',
147
150
  });
148
151
  const APPROVAL_MANDATE_SET = new Set(APPROVAL_MANDATE_WORDS);
149
152
  export function approvalMandateDetail(word, lang) {
@@ -14,7 +14,7 @@ export declare const CORE_ASK_EVIDENCE_ABSENCE_VALUES: readonly ["not_wired", "n
14
14
  export declare const CORE_SYSTEM_INJECTION_PRIORITIES: readonly ["now", "next", "later"];
15
15
  export declare const CORE_READ_DENY_BUILTIN_TIERS: readonly ["credentials", "shell-history", "browser", "wallet", "agent-config"];
16
16
  export declare const CORE_READ_DENY_DEFAULT_TIERS: readonly ["credentials", "agent-config"];
17
- export declare const CORE_ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "unverifiable_delete", "unverifiable_shell_text", "transcript_write", "org_rule", "rule_unreadable", "ask_rule", "denial_limit_fallback", "classifier_no_ruling", "requires_user_interaction", "operator_forced", "shell_floor", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "unstated", "ordinary"];
17
+ export declare const CORE_ASK_CLASSES: readonly ["content_question", "hook", "ancestor", "dangerous_delete", "unverifiable_delete", "unverifiable_shell_text", "transcript_write", "org_rule", "rule_unreadable", "ask_rule", "denial_limit_fallback", "classifier_no_ruling", "requires_user_interaction", "cross_boundary", "operator_forced", "shell_floor", "target_unresolved", "probe", "write_protection", "tool_marks_mcp", "tool_marks_a2a", "policy_rra", "artifact_shared_read", "mode", "unstated", "ordinary"];
18
18
  export interface CoreModeArbitrationRow {
19
19
  readonly bypassImmune: boolean;
20
20
  readonly classifierEligible: boolean;
@@ -22,7 +22,7 @@ export interface CoreModeArbitrationRow {
22
22
  readonly ruleMayClear: boolean;
23
23
  readonly hookAskFloor: boolean;
24
24
  }
25
- export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
25
+ export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "target_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
26
26
  export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
27
27
  export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "content_unsupported", "grammar", "tool_name", "near_miss", "earlier_grammar"];
28
28
  export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
@@ -42,10 +42,14 @@ export declare const CORE_MAX_PENDING_STEER_CHARS: number;
42
42
  export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
43
43
  export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits", "plan", "auto", "bypassPermissions", "dontAsk"];
44
44
  export declare const CORE_APPROVAL_REACH: readonly ["none"];
45
- export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
45
+ export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved", "cross_boundary_taint"];
46
46
  export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
47
47
  export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"];
48
48
  export declare const CORE_BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
49
+ export declare const CORE_RULE_OFFERS_ABSENCES: readonly ["mandated", "allow_outranked", "ask_rule_matched", "lane_cannot_speak"];
50
+ export declare const CORE_TOOL_APPROVAL_CARDS: readonly ["file-edit", "file-write", "notebook-edit", "shell", "fetch", "skill", "workflow", "plan", "question", "generic"];
51
+ export declare const CORE_ASK_CLASSES_WITHOUT_REASON_ROW: readonly ["probe"];
52
+ export declare const CORE_ASK_CLASS_REASONS: Readonly<Record<Exclude<(typeof CORE_ASK_CLASSES)[number], (typeof CORE_ASK_CLASSES_WITHOUT_REASON_ROW)[number]>, string>>;
49
53
  export declare const CORE_USER_ATTACHMENT_KINDS: readonly ["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"];
50
54
  export declare const CORE_USER_ATTACHMENT_SUPPLIES: readonly ["path", "content_text", "content_image"];
51
55
  export declare const CORE_USER_ATTACHMENT_OUTCOMES: readonly ["attached", "partial", "unchanged", "not_attached"];
@@ -85,6 +85,7 @@ export const CORE_ENGINE_CARD_TYPES = Object.freeze([
85
85
  "workflow-run",
86
86
  "report-findings",
87
87
  "tool-search",
88
+ "advisor",
88
89
  "ask-question",
89
90
  "exit-plan-mode",
90
91
  "enter-plan-mode",
@@ -154,6 +155,7 @@ export const CORE_ASK_CLASSES = Object.freeze([
154
155
  "denial_limit_fallback",
155
156
  "classifier_no_ruling",
156
157
  "requires_user_interaction",
158
+ "cross_boundary",
157
159
  "operator_forced",
158
160
  "shell_floor",
159
161
  "target_unresolved",
@@ -181,6 +183,7 @@ export const CORE_MODE_ARBITRATION = Object.freeze({
181
183
  "denial_limit_fallback": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
182
184
  "classifier_no_ruling": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
183
185
  "requires_user_interaction": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: true }),
186
+ "cross_boundary": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: false, ruleMayClear: false, hookAskFloor: false }),
184
187
  "operator_forced": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
185
188
  "shell_floor": Object.freeze({ bypassImmune: true, classifierEligible: true, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: false }),
186
189
  "target_unresolved": Object.freeze({ bypassImmune: true, classifierEligible: false, sandboxAdmission: true, ruleMayClear: false, hookAskFloor: true }),
@@ -306,6 +309,7 @@ export const CORE_PERSISTED_RULE_MANDATES = Object.freeze([
306
309
  "probe_unanswered",
307
310
  "write_protection",
308
311
  "target_unresolved",
312
+ "cross_boundary_taint",
309
313
  ]);
310
314
  export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze([
311
315
  "completed",
@@ -327,6 +331,54 @@ export const CORE_BUILTIN_SUBAGENT_TYPES = Object.freeze([
327
331
  "fork",
328
332
  "general-purpose",
329
333
  ]);
334
+ export const CORE_RULE_OFFERS_ABSENCES = Object.freeze([
335
+ "mandated",
336
+ "allow_outranked",
337
+ "ask_rule_matched",
338
+ "lane_cannot_speak",
339
+ ]);
340
+ export const CORE_TOOL_APPROVAL_CARDS = Object.freeze([
341
+ "file-edit",
342
+ "file-write",
343
+ "notebook-edit",
344
+ "shell",
345
+ "fetch",
346
+ "skill",
347
+ "workflow",
348
+ "plan",
349
+ "question",
350
+ "generic",
351
+ ]);
352
+ export const CORE_ASK_CLASSES_WITHOUT_REASON_ROW = Object.freeze([
353
+ "probe",
354
+ ]);
355
+ export const CORE_ASK_CLASS_REASONS = Object.freeze({
356
+ "content_question": "the call is the engine's own question to a person",
357
+ "hook": "a PreToolUse hook asks about this call — the deployment's own screening is answered by a person",
358
+ "ancestor": "the task that delegated this one owns this question",
359
+ "dangerous_delete": "this removal targets a protected location (the filesystem root, a top-level directory, a home directory, or a workspace directory or one of its ancestors) — it is cleared by confirming this call, never by an allow rule",
360
+ "unverifiable_delete": "this removal could not be verified safe — it is cleared by confirming this call, never by an allow rule",
361
+ "unverifiable_shell_text": "the text this shell will run cannot be read by the engine — it is cleared by confirming this call, never by an allow rule",
362
+ "transcript_write": "this write targets the session transcript — it is cleared by confirming this call, never by an allow rule",
363
+ "org_rule": "an organization policy rule requires approval for this call",
364
+ "rule_unreadable": "a rule that may govern this call cannot currently be read (this deployment's organization policy, a partition of the person's standing rules, or this call against a deny or ask rule), so whether one forbids it is unknown",
365
+ "ask_rule": "an explicit ask rule matched this call (a person's or the deployment's ask-me-each-time outranks a standing allow rule)",
366
+ "denial_limit_fallback": "the auto-mode classifier refused too many calls in a row, so a person decides",
367
+ "classifier_no_ruling": "the auto-mode classifier could not judge this call, so a person decides",
368
+ "requires_user_interaction": "this tool's server declares that a call must be put to a person",
369
+ "cross_boundary": "this run executes on a device outside the deployment's trust boundary and the deployment is multi-tenant, so an org-side write — or, after an off-target read, a call bound for the device — is confirmed by the deployment's approver for this call: no standing allow rule and no automatic lane answers for it, and an allow the configuration gives (a blanket seat or a policy's answer) is refused",
370
+ "operator_forced": "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule",
371
+ "shell_floor": "this deployment mandates per-call confirmation for shell commands (shellGate: always)",
372
+ "target_unresolved": "where this write leads on disk could not be determined (a link on the way could not be examined, or the environment could not resolve the target), so whether it lands on a guarded path is unknown — it is cleared by confirming this call: no standing rule and no automatic decider answers for it, though a wired approver seat can",
373
+ "write_protection": "this write's target is on the deployment's write-protection table (the agent's own configuration is guarded one look per write) — it is cleared by confirming this call, never by a standing allow rule",
374
+ "tool_marks_mcp": "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)",
375
+ "tool_marks_a2a": "this tool carries egress/irreversibility/interaction marks (a mandated confirmation a rule cannot clear)",
376
+ "policy_rra": "the deployment's policy requires a real approval for this call",
377
+ "artifact_shared_read": "this read targets another task's shared artifact — it is cleared by confirming this call",
378
+ "mode": "the permission mode puts this question to a person",
379
+ "unstated": "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule",
380
+ "ordinary": "this call arrived already marked as requiring confirmation (an earlier layer of this run, or the task that delegated it, judged it so) — it is cleared by confirming this call, never by a standing allow rule",
381
+ });
330
382
  export const CORE_USER_ATTACHMENT_KINDS = Object.freeze([
331
383
  "text",
332
384
  "notebook",
@@ -26,6 +26,8 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
26
26
  "config.peer_lane_unmounted",
27
27
  "config.secret_env_scrubbed",
28
28
  "config.credential_not_withheld",
29
+ "config.cross_boundary_posture_undeclared",
30
+ "config.cross_boundary_record_unwritten",
29
31
  "config.permission_mode_unavailable",
30
32
  "permission.ask_released_by_mode",
31
33
  "permission.read_deny_unapplied",
@@ -67,6 +69,8 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
67
69
  "memory.project_scope_absent",
68
70
  "route.fallback_to_primary",
69
71
  "route.classifier_unroutable",
72
+ "route.seat_detached",
73
+ "advisor.not_attached",
70
74
  "route.credential_origin_mismatch",
71
75
  "route.response_model_mismatch",
72
76
  "route.tool_call_id_folded",
@@ -124,6 +128,8 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
124
128
  "config.peer_lane_unmounted": "operator",
125
129
  "config.secret_env_scrubbed": "operator",
126
130
  "config.credential_not_withheld": "operator",
131
+ "config.cross_boundary_posture_undeclared": "operator",
132
+ "config.cross_boundary_record_unwritten": "operator",
127
133
  "config.permission_mode_unavailable": "user",
128
134
  "permission.ask_released_by_mode": "user",
129
135
  "permission.read_deny_unapplied": "user",
@@ -165,6 +171,8 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
165
171
  "memory.project_scope_absent": "operator",
166
172
  "route.fallback_to_primary": "operator",
167
173
  "route.classifier_unroutable": "operator",
174
+ "route.seat_detached": "operator",
175
+ "advisor.not_attached": "user",
168
176
  "route.credential_origin_mismatch": "user",
169
177
  "route.response_model_mismatch": "operator",
170
178
  "route.tool_call_id_folded": "operator",
@@ -228,6 +236,8 @@ export const CORE_NOTICE_MINTER = Object.freeze({
228
236
  "config.peer_lane_unmounted": "engine",
229
237
  "config.secret_env_scrubbed": "engine",
230
238
  "config.credential_not_withheld": "engine",
239
+ "config.cross_boundary_posture_undeclared": "engine",
240
+ "config.cross_boundary_record_unwritten": "engine",
231
241
  "config.permission_mode_unavailable": "engine",
232
242
  "permission.ask_released_by_mode": "engine",
233
243
  "permission.read_deny_unapplied": "engine",
@@ -269,6 +279,8 @@ export const CORE_NOTICE_MINTER = Object.freeze({
269
279
  "memory.project_scope_absent": "engine",
270
280
  "route.fallback_to_primary": "engine",
271
281
  "route.classifier_unroutable": "engine",
282
+ "route.seat_detached": "engine",
283
+ "advisor.not_attached": "engine",
272
284
  "route.credential_origin_mismatch": "engine",
273
285
  "route.response_model_mismatch": "engine",
274
286
  "route.tool_call_id_folded": "engine",
@@ -0,0 +1 @@
1
+ export declare const SETTINGS_ACTIVE_TIERS_CLOSURE: () => any;
@@ -0,0 +1,14 @@
1
+ export const SETTINGS_ACTIVE_TIERS_CLOSURE = () => {
2
+ function resolveActiveTiers(models) {
3
+ if (!models.activeTierGroup)
4
+ return undefined;
5
+ const group = (models.tierGroups ?? []).find((g) => g.name === models.activeTierGroup);
6
+ if (!group)
7
+ return undefined;
8
+ const bound = Object.entries(group.tiers).filter((e) => typeof e[1] === "string" && e[1].length > 0);
9
+ if (bound.length === 0)
10
+ return undefined;
11
+ return Object.fromEntries(bound);
12
+ }
13
+ return { resolveActiveTiers };
14
+ };
@@ -0,0 +1 @@
1
+ export declare const SETTINGS_CALLER_TEXT_ECHO_CLOSURE: (stripControlAndBidi: (text: string) => string) => any;
@@ -0,0 +1,8 @@
1
+ export const SETTINGS_CALLER_TEXT_ECHO_CLOSURE = (stripControlAndBidi) => {
2
+ const CALLER_TEXT_ECHO_MAX_CHARS = 64;
3
+ function echoCallerText(text) {
4
+ const clean = stripControlAndBidi(text);
5
+ return clean.length > CALLER_TEXT_ECHO_MAX_CHARS ? `${clean.slice(0, CALLER_TEXT_ECHO_MAX_CHARS)}…` : clean;
6
+ }
7
+ return { echoCallerText };
8
+ };
@@ -0,0 +1 @@
1
+ export declare const SETTINGS_CONTROL_AND_BIDI_CLOSURE: () => any;
@@ -0,0 +1,8 @@
1
+ export const SETTINGS_CONTROL_AND_BIDI_CLOSURE = () => {
2
+ const CONTROL_AND_BIDI_CHARS = "\\u0000-\\u001f\\u007f\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069";
3
+ const STRIP_RE = new RegExp(`[${CONTROL_AND_BIDI_CHARS}]`, "g");
4
+ function stripControlAndBidi(text) {
5
+ return text.replace(STRIP_RE, "");
6
+ }
7
+ return { stripControlAndBidi, CONTROL_AND_BIDI_CHARS };
8
+ };
@@ -0,0 +1,11 @@
1
+ export declare const SETTINGS_DEFAULT_MODEL_CLOSURE: (resolveActiveTiers: (models: {
2
+ readonly tierGroups?: readonly {
3
+ readonly name: string;
4
+ readonly tiers?: {
5
+ readonly [tier: string]: string | undefined;
6
+ } | undefined;
7
+ }[] | undefined;
8
+ readonly activeTierGroup?: string | undefined;
9
+ }) => {
10
+ [tier: string]: string;
11
+ } | undefined) => any;
@@ -0,0 +1,25 @@
1
+ export const SETTINGS_DEFAULT_MODEL_CLOSURE = (resolveActiveTiers) => {
2
+ const DEFAULT_ROLE_TIER_LADDER = ["pro", "flash", "lite"];
3
+ function resolveCatalogDefaultModel(models, has, fallback) {
4
+ const target = models.roles?.default;
5
+ const named = target !== undefined && "model" in target ? target.model : undefined;
6
+ const select = target !== undefined && "select" in target ? target.select : undefined;
7
+ if (!named && select)
8
+ return { kind: "select", select };
9
+ const tiers = resolveActiveTiers(models) ?? {};
10
+ const candidates = [
11
+ { source: "roles.default", name: named },
12
+ ...DEFAULT_ROLE_TIER_LADDER.map((t) => ({ source: `tierGroup.${t}`, name: tiers[t] })),
13
+ ];
14
+ const dangling = [];
15
+ for (const c of candidates) {
16
+ if (c.name === undefined || c.name === "")
17
+ continue;
18
+ if (has(c.name))
19
+ return { kind: "named", name: c.name, source: c.source, dangling };
20
+ dangling.push({ source: c.source, name: c.name });
21
+ }
22
+ return { kind: "named", name: fallback, source: "fallback", dangling };
23
+ }
24
+ return { resolveCatalogDefaultModel, DEFAULT_ROLE_TIER_LADDER };
25
+ };
@@ -19,6 +19,9 @@ export declare const SETTINGS_HOOKS_CLASSIFICATION_OUTCOMES: readonly ["loaded",
19
19
  export declare const SETTINGS_HOOKS_DROPPED_PIECE_CODES: readonly ["hooks-not-object", "unknown-event", "event-not-array", "matcher-invalid", "entry-invalid"];
20
20
  export declare const SETTINGS_HOOKS_REJECTION_CODES: readonly ["guard-outside-hooks", "hooks-is-matcher", "guard-under-unknown-event", "guard-event-not-array", "guard-matcher-invalid", "guard-entry-invalid"];
21
21
  export declare const SETTINGS_CLASSIFY_HOOKS_CONFIG: (settingsDoc: unknown) => HooksClassification;
22
+ export declare const SETTINGS_STRIP_CONTROL_AND_BIDI: (text: string) => string;
23
+ export declare const SETTINGS_CONTROL_AND_BIDI_CHARS: string;
24
+ export declare const SETTINGS_ECHO_CALLER_TEXT: (text: string) => string;
22
25
  export declare const SETTINGS_READ_REQUEST_MCP_TRANSPORT: (t: unknown) => RequestMcpTransportRead;
23
26
  export declare const SETTINGS_READ_MCP_IDENTITY_HEADERS: (transport: Record<string, unknown>) => {
24
27
  principalHeader?: string;
@@ -29,3 +32,54 @@ export declare const SETTINGS_DESCRIBE_BAD_WIRE_NAME: (v: unknown) => string;
29
32
  export declare const SETTINGS_IS_CONTENT_ORIGIN_WORD: (v: unknown) => v is McpContentOrigin;
30
33
  export declare const SETTINGS_DESCRIBE_BAD_CONTENT_ORIGIN: (v: unknown) => string;
31
34
  export declare const SETTINGS_TOOL_WIRE_NAME_MAX_CHARS: 128;
35
+ export declare const SETTINGS_URL_ALLOW_PATTERN_MATCHES: (url: string, pattern: string) => boolean;
36
+ export declare const SETTINGS_IS_AT_LEAST: (layer: string, minTrust: string) => boolean;
37
+ export declare const SETTINGS_MEMBER_ADMISSION: (category: string, member: string) => object;
38
+ export declare const SETTINGS_SAFETY_MERGE_SPEC: object;
39
+ export declare const SETTINGS_LAYER_ADMISSION: (source: string, workspace: string, category: string, member?: string) => string;
40
+ export declare const SETTINGS_RESOLVE_ACTIVE_TIERS: (models: {
41
+ readonly tierGroups?: readonly {
42
+ readonly name: string;
43
+ readonly tiers?: {
44
+ readonly [tier: string]: string | undefined;
45
+ } | undefined;
46
+ }[] | undefined;
47
+ readonly activeTierGroup?: string | undefined;
48
+ }) => {
49
+ [tier: string]: string;
50
+ } | undefined;
51
+ export declare const SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL: (models: {
52
+ readonly roles?: {
53
+ readonly default?: {
54
+ readonly model?: string | undefined;
55
+ readonly select?: {
56
+ readonly tier?: string | undefined;
57
+ readonly needs?: readonly string[] | undefined;
58
+ readonly prefer?: string | undefined;
59
+ } | undefined;
60
+ } | undefined;
61
+ } | undefined;
62
+ readonly tierGroups?: readonly {
63
+ readonly name: string;
64
+ readonly tiers?: {
65
+ readonly [tier: string]: string | undefined;
66
+ } | undefined;
67
+ }[] | undefined;
68
+ readonly activeTierGroup?: string | undefined;
69
+ }, has: (name: string) => boolean, fallback: string) => {
70
+ readonly kind: "named";
71
+ readonly name: string;
72
+ readonly source: string;
73
+ readonly dangling: readonly {
74
+ readonly source: string;
75
+ readonly name: string;
76
+ }[];
77
+ } | {
78
+ readonly kind: "select";
79
+ readonly select: {
80
+ readonly tier?: string | undefined;
81
+ readonly needs?: readonly string[] | undefined;
82
+ readonly prefer?: string | undefined;
83
+ };
84
+ };
85
+ export declare const SETTINGS_DEFAULT_ROLE_TIER_LADDER: readonly ["pro", "flash", "lite"];
@@ -1,6 +1,14 @@
1
1
  import { SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE } from './settingsSchemaHooksClassifier.js';
2
+ import { SETTINGS_CONTROL_AND_BIDI_CLOSURE } from './settingsSchemaControlAndBidi.js';
3
+ import { SETTINGS_CALLER_TEXT_ECHO_CLOSURE } from './settingsSchemaCallerTextEcho.js';
2
4
  import { SETTINGS_MCP_REQUEST_ENTRY_CLOSURE } from './settingsSchemaMcpRequestEntry.js';
3
5
  import { SETTINGS_MCP_CONTENT_ORIGINS } from './settingsSchemaTables.js';
6
+ import { SETTINGS_URL_ALLOW_PATTERN_MATCHES_CLOSURE } from './settingsSchemaUrlPattern.js';
7
+ import { SETTINGS_SAFETY_MERGE_CLOSURE } from './settingsSchemaSafetyMergeSpec.js';
8
+ import { SETTINGS_MIN_TRUST_WORDS } from './settingsSchemaTables.js';
9
+ import { SETTINGS_LAYER_SOURCES_CLOSURE } from './settingsSchemaSettingsSources.js';
10
+ import { SETTINGS_ACTIVE_TIERS_CLOSURE } from './settingsSchemaActiveTiers.js';
11
+ import { SETTINGS_DEFAULT_MODEL_CLOSURE } from './settingsSchemaDefaultModel.js';
4
12
  export const SETTINGS_AT_MENTION_MODES = Object.freeze([
5
13
  "all",
6
14
  "none",
@@ -135,7 +143,12 @@ export const SETTINGS_HOOKS_REJECTION_CODES = Object.freeze([
135
143
  "guard-entry-invalid",
136
144
  ]);
137
145
  export const SETTINGS_CLASSIFY_HOOKS_CONFIG = SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE(SETTINGS_HOOK_EVENTS);
138
- const SETTINGS_MCP_REQUEST_ENTRY = SETTINGS_MCP_REQUEST_ENTRY_CLOSURE(SETTINGS_MCP_CONTENT_ORIGINS, SETTINGS_STARTS_WITH_HTTP_SCHEME);
146
+ const SETTINGS_CONTROL_AND_BIDI = SETTINGS_CONTROL_AND_BIDI_CLOSURE();
147
+ export const SETTINGS_STRIP_CONTROL_AND_BIDI = SETTINGS_CONTROL_AND_BIDI.stripControlAndBidi;
148
+ export const SETTINGS_CONTROL_AND_BIDI_CHARS = SETTINGS_CONTROL_AND_BIDI.CONTROL_AND_BIDI_CHARS;
149
+ const SETTINGS_CALLER_TEXT_ECHO = SETTINGS_CALLER_TEXT_ECHO_CLOSURE(SETTINGS_STRIP_CONTROL_AND_BIDI);
150
+ export const SETTINGS_ECHO_CALLER_TEXT = SETTINGS_CALLER_TEXT_ECHO.echoCallerText;
151
+ const SETTINGS_MCP_REQUEST_ENTRY = SETTINGS_MCP_REQUEST_ENTRY_CLOSURE(SETTINGS_MCP_CONTENT_ORIGINS, SETTINGS_STARTS_WITH_HTTP_SCHEME, SETTINGS_ECHO_CALLER_TEXT);
139
152
  export const SETTINGS_READ_REQUEST_MCP_TRANSPORT = SETTINGS_MCP_REQUEST_ENTRY.readRequestMcpTransport;
140
153
  export const SETTINGS_READ_MCP_IDENTITY_HEADERS = SETTINGS_MCP_REQUEST_ENTRY.readMcpIdentityHeaders;
141
154
  export const SETTINGS_IS_USABLE_WIRE_NAME = SETTINGS_MCP_REQUEST_ENTRY.isUsableWireName;
@@ -143,3 +156,15 @@ export const SETTINGS_DESCRIBE_BAD_WIRE_NAME = SETTINGS_MCP_REQUEST_ENTRY.descri
143
156
  export const SETTINGS_IS_CONTENT_ORIGIN_WORD = SETTINGS_MCP_REQUEST_ENTRY.isContentOriginWord;
144
157
  export const SETTINGS_DESCRIBE_BAD_CONTENT_ORIGIN = SETTINGS_MCP_REQUEST_ENTRY.describeBadContentOrigin;
145
158
  export const SETTINGS_TOOL_WIRE_NAME_MAX_CHARS = SETTINGS_MCP_REQUEST_ENTRY.TOOL_WIRE_NAME_MAX_CHARS;
159
+ export const SETTINGS_URL_ALLOW_PATTERN_MATCHES = SETTINGS_URL_ALLOW_PATTERN_MATCHES_CLOSURE();
160
+ const SETTINGS_SAFETY_MERGE = SETTINGS_SAFETY_MERGE_CLOSURE(SETTINGS_MIN_TRUST_WORDS);
161
+ export const SETTINGS_IS_AT_LEAST = SETTINGS_SAFETY_MERGE.isAtLeast;
162
+ export const SETTINGS_MEMBER_ADMISSION = SETTINGS_SAFETY_MERGE.memberAdmission;
163
+ export const SETTINGS_SAFETY_MERGE_SPEC = SETTINGS_SAFETY_MERGE.SAFETY_MERGE_SPEC;
164
+ const SETTINGS_LAYER_SOURCES = SETTINGS_LAYER_SOURCES_CLOSURE(SETTINGS_SAFETY_MERGE_SPEC, SETTINGS_IS_AT_LEAST, SETTINGS_MEMBER_ADMISSION);
165
+ export const SETTINGS_LAYER_ADMISSION = SETTINGS_LAYER_SOURCES.layerAdmission;
166
+ const SETTINGS_ACTIVE_TIERS = SETTINGS_ACTIVE_TIERS_CLOSURE();
167
+ export const SETTINGS_RESOLVE_ACTIVE_TIERS = SETTINGS_ACTIVE_TIERS.resolveActiveTiers;
168
+ const SETTINGS_DEFAULT_MODEL = SETTINGS_DEFAULT_MODEL_CLOSURE(SETTINGS_RESOLVE_ACTIVE_TIERS);
169
+ export const SETTINGS_RESOLVE_CATALOG_DEFAULT_MODEL = SETTINGS_DEFAULT_MODEL.resolveCatalogDefaultModel;
170
+ export const SETTINGS_DEFAULT_ROLE_TIER_LADDER = SETTINGS_DEFAULT_MODEL.DEFAULT_ROLE_TIER_LADDER;
@@ -1 +1 @@
1
- export declare const SETTINGS_MCP_REQUEST_ENTRY_CLOSURE: (MCP_CONTENT_ORIGINS: readonly ["local", "execution", "external"], startsWithHttpScheme: (raw: string) => boolean) => any;
1
+ export declare const SETTINGS_MCP_REQUEST_ENTRY_CLOSURE: (MCP_CONTENT_ORIGINS: readonly ["local", "execution", "external"], startsWithHttpScheme: (raw: string) => boolean, echoCallerText: (text: string) => string) => any;
@@ -1,4 +1,4 @@
1
- export const SETTINGS_MCP_REQUEST_ENTRY_CLOSURE = (MCP_CONTENT_ORIGINS, startsWithHttpScheme) => {
1
+ export const SETTINGS_MCP_REQUEST_ENTRY_CLOSURE = (MCP_CONTENT_ORIGINS, startsWithHttpScheme, echoCallerText) => {
2
2
  function describeValueShape(v) {
3
3
  if (v === undefined)
4
4
  return "nothing (the key is absent)";
@@ -18,12 +18,6 @@ export const SETTINGS_MCP_REQUEST_ENTRY_CLOSURE = (MCP_CONTENT_ORIGINS, startsWi
18
18
  function isStringArray(v) {
19
19
  return Array.isArray(v) && v.every((a) => typeof a === "string");
20
20
  }
21
- const CONTROL_AND_BIDI_STRIP_RE = /[\u0000-\u001f\u007f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
22
- const CALLER_TEXT_ECHO_MAX_CHARS = 64;
23
- function echoCallerText(text) {
24
- const clean = text.replace(CONTROL_AND_BIDI_STRIP_RE, "");
25
- return clean.length > CALLER_TEXT_ECHO_MAX_CHARS ? `${clean.slice(0, CALLER_TEXT_ECHO_MAX_CHARS)}…` : clean;
26
- }
27
21
  function quotedCallerText(text) {
28
22
  return `"${echoCallerText(text)}"`;
29
23
  }
@@ -0,0 +1 @@
1
+ export declare const SETTINGS_SAFETY_MERGE_CLOSURE: (MIN_TRUST_WORDS: readonly ["local", "session", "project", "global", "managed", "task"]) => any;