@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
@@ -1,6 +1,6 @@
1
1
  import { engineCapValue } from './engineCapsCache.js';
2
2
  import { isUiLanguage } from './env/uiLanguage.js';
3
- import { engineWireTarget } from './engineWireTarget.js';
3
+ import { engineWireTargetBaseUrl } from './engineWireTarget.js';
4
4
  import { msg, renderMessage } from './i18n/translate.js';
5
5
  const OWN_CREDENTIALS_WITHHELD_KEY = 'inherit_env.own_credentials_withheld';
6
6
  const OWN_CREDENTIAL_VALUES_WITHHELD_KEY = 'inherit_env.own_credential_values_withheld';
@@ -46,39 +46,45 @@ function inheritEnvWordReading(baseUrl, key) {
46
46
  return UNOBSERVED;
47
47
  }
48
48
  }
49
- export function observedInheritEnvOwnCredentialsWithheld(baseUrl = engineWireTarget()?.baseUrl) {
49
+ export function observedInheritEnvOwnCredentialsWithheld(baseUrl = engineWireTargetBaseUrl()) {
50
50
  return inheritEnvWordReading(baseUrl, OWN_CREDENTIALS_WITHHELD_KEY);
51
51
  }
52
- export function observedInheritEnvOwnCredentialValuesWithheld(baseUrl = engineWireTarget()?.baseUrl) {
52
+ export function observedInheritEnvOwnCredentialValuesWithheld(baseUrl = engineWireTargetBaseUrl()) {
53
53
  return inheritEnvWordReading(baseUrl, OWN_CREDENTIAL_VALUES_WITHHELD_KEY);
54
54
  }
55
55
  const ALL = Object.freeze({ send: 'all' });
56
56
  const omit = (reason) => Object.freeze({ send: 'omit', reason });
57
57
  function fieldOf(input, key) {
58
58
  try {
59
+ if (!Object.hasOwn(input, key))
60
+ return undefined;
59
61
  return input[key];
60
62
  }
61
63
  catch {
62
64
  return undefined;
63
65
  }
64
66
  }
65
- function capabilityReasonOf(reading) {
67
+ function readingClassOf(reading) {
66
68
  try {
67
- if (typeof reading !== 'object' || reading === null)
68
- return 'capability_unreadable';
69
+ if (typeof reading !== 'object' || reading === null || !Object.hasOwn(reading, 'kind'))
70
+ return 'unreadable';
69
71
  const kind = reading.kind;
70
- if (kind === 'confirmed')
71
- return undefined;
72
- if (kind === 'absent')
73
- return 'capability_absent';
74
- if (kind === 'declined')
75
- return 'capability_declined';
76
- return 'capability_unreadable';
72
+ if (kind === 'confirmed' || kind === 'absent' || kind === 'declined')
73
+ return kind;
74
+ return 'unreadable';
77
75
  }
78
76
  catch {
79
- return 'capability_unreadable';
77
+ return 'unreadable';
80
78
  }
81
79
  }
80
+ function capabilityReasonOf(reading) {
81
+ const cls = readingClassOf(reading);
82
+ return cls === 'confirmed' ? undefined : cls === 'absent' ? 'capability_absent' : cls === 'declined' ? 'capability_declined' : 'capability_unreadable';
83
+ }
84
+ function valuesReasonOf(reading) {
85
+ const cls = readingClassOf(reading);
86
+ return cls === 'confirmed' ? undefined : cls === 'absent' ? 'capability_values_absent' : cls === 'declined' ? 'capability_values_declined' : 'capability_values_unreadable';
87
+ }
82
88
  export function inheritEnvIntentOf(input) {
83
89
  if (typeof input !== 'object' || input === null || Array.isArray(input))
84
90
  return omit('lane');
@@ -91,19 +97,27 @@ export function inheritEnvIntentOf(input) {
91
97
  return omit(cap);
92
98
  if (fieldOf(input, 'serviceIdentityVerified') !== true)
93
99
  return omit('identity_unverified');
100
+ const values = valuesReasonOf(fieldOf(input, 'ownCredentialValuesWithheld'));
101
+ if (values !== undefined)
102
+ return omit(values);
94
103
  return ALL;
95
104
  }
96
105
  export function inheritEnvNotConfirmedNotice(lang) {
97
106
  return renderMessage(msg('session.inheritEnv.notConfirmed'), isUiLanguage(lang) ? lang : undefined);
98
107
  }
108
+ export function inheritEnvValuesNotConfirmedNotice(lang) {
109
+ return renderMessage(msg('session.inheritEnv.valuesNotConfirmed'), isUiLanguage(lang) ? lang : undefined);
110
+ }
99
111
  export function inheritEnvNoticeOf(intent, lang) {
100
112
  try {
101
113
  if (typeof intent !== 'object' || intent === null || intent.send !== 'omit')
102
114
  return undefined;
103
115
  const reason = intent.reason;
104
- return reason === 'capability_absent' || reason === 'capability_declined' || reason === 'capability_unreadable'
105
- ? inheritEnvNotConfirmedNotice(lang)
106
- : undefined;
116
+ if (reason === 'capability_absent' || reason === 'capability_declined' || reason === 'capability_unreadable')
117
+ return inheritEnvNotConfirmedNotice(lang);
118
+ if (reason === 'capability_values_absent' || reason === 'capability_values_declined' || reason === 'capability_values_unreadable')
119
+ return inheritEnvValuesNotConfirmedNotice(lang);
120
+ return undefined;
107
121
  }
108
122
  catch {
109
123
  return undefined;
@@ -15,6 +15,7 @@ export declare function inheritEnvDeclaration(word: unknown, serverVersion: stri
15
15
  export declare function inheritEnvWithheldNotice(withheld: InheritEnvWithheld, lang?: UiLanguage): string;
16
16
  export interface InheritEnvRefusalDetail {
17
17
  readonly code: string;
18
+ readonly field?: 'inheritEnv';
18
19
  }
19
20
  export declare function inheritEnvRefusalFromError(err: unknown, sentRequest: TaskRequestLike | undefined): InheritEnvRefusalDetail | null;
20
- export declare function inheritEnvRefusalContent(_detail: InheritEnvRefusalDetail, lang?: UiLanguage): string;
21
+ export declare function inheritEnvRefusalContent(detail: InheritEnvRefusalDetail, lang?: UiLanguage): string;
@@ -1,6 +1,6 @@
1
1
  import { msg, renderMessage } from './i18n/translate.js';
2
2
  import { INHERIT_ENV_WORDS, isInheritEnvWord } from './request/taskRequest.js';
3
- import { fieldLimitRefusalFromError } from './wireRefusalCopy.js';
3
+ import { readRefusalNamedFields } from './wireFailureShape.js';
4
4
  import { engineVersionTier } from './supportFloor.js';
5
5
  import { guardedRead, readOwnDataValue } from './ownKey.js';
6
6
  const EMPTY_DECLARATION = Object.freeze({ field: Object.freeze({}) });
@@ -39,6 +39,7 @@ function inheritEnvWithheldKey(withheld) {
39
39
  }
40
40
  }
41
41
  const FIELD_INVALID = 'request.field_invalid';
42
+ const INHERIT_ENV_FIELD = 'inheritEnv';
42
43
  function readGuarded(o, key) {
43
44
  if (typeof o !== 'object' || o === null)
44
45
  return undefined;
@@ -50,14 +51,19 @@ export function inheritEnvRefusalFromError(err, sentRequest) {
50
51
  return null;
51
52
  if (readGuarded(err, 'errorCode') !== FIELD_INVALID)
52
53
  return null;
53
- if (fieldLimitRefusalFromError(err) !== null)
54
+ if (typeof err !== 'object' || err === null)
54
55
  return null;
55
- return Object.freeze({ code: FIELD_INVALID });
56
+ const named = readRefusalNamedFields(err);
57
+ if (named.length === 0)
58
+ return Object.freeze({ code: FIELD_INVALID });
59
+ if (named.includes(INHERIT_ENV_FIELD))
60
+ return Object.freeze({ code: FIELD_INVALID, field: INHERIT_ENV_FIELD });
61
+ return null;
56
62
  }
57
63
  catch {
58
64
  return null;
59
65
  }
60
66
  }
61
- export function inheritEnvRefusalContent(_detail, lang) {
62
- return renderMessage(msg('session.inheritEnv.refusal'), lang);
67
+ export function inheritEnvRefusalContent(detail, lang) {
68
+ return renderMessage(msg(readGuarded(detail, 'field') === INHERIT_ENV_FIELD ? 'session.inheritEnv.refusalNamed' : 'session.inheritEnv.refusal'), lang);
63
69
  }
@@ -11,13 +11,15 @@ export type InteractiveHaltInterruptOutcome = {
11
11
  } | {
12
12
  kind: 'transport';
13
13
  detail?: string | undefined;
14
+ } | {
15
+ kind: 'withheld';
14
16
  };
15
17
  export interface InteractiveHaltInput {
16
18
  readonly parked?: boolean | undefined;
17
19
  readonly detachArmed?: boolean | undefined;
18
20
  readonly interruptOutcome?: InteractiveHaltInterruptOutcome | undefined;
19
21
  }
20
- export type InteractiveHaltReason = 'first-shot' | 'halted' | 'engine-says-run-level' | 'no-verdict-on-parked-card' | 'no-verdict-detach-armed' | 'no-verdict-not-parked' | 'refused-no-escalation' | 'unknown-outcome';
22
+ export type InteractiveHaltReason = 'first-shot' | 'halted' | 'engine-says-run-level' | 'no-verdict-on-parked-card' | 'no-verdict-detach-armed' | 'no-verdict-not-parked' | 'refused-no-escalation' | 'unknown-outcome' | 'handed-off';
21
23
  export interface InteractiveHaltPlan {
22
24
  readonly action: 'interrupt' | 'escalate-cancel' | 'none';
23
25
  readonly reason: InteractiveHaltReason;
@@ -32,6 +32,8 @@ export function planInteractiveHalt(input) {
32
32
  ? { action: 'escalate-cancel', reason: 'engine-says-run-level' }
33
33
  : { action: 'none', reason: 'refused-no-escalation' };
34
34
  }
35
+ if (kind === 'withheld')
36
+ return { action: 'none', reason: 'handed-off' };
35
37
  if (kind === 'transport' || kind === 'unarmed') {
36
38
  if (input.parked === true)
37
39
  return { action: 'escalate-cancel', reason: 'no-verdict-on-parked-card' };
@@ -1,8 +1,10 @@
1
1
  import type { AgentClient } from '@sema-agent/sdk';
2
2
  import type { InteractiveHaltInterruptOutcome } from './interactiveHalt.js';
3
+ import { type InteractiveEngineWire } from './sessionBackground.js';
3
4
  export type InteractiveInterruptRuns = Pick<AgentClient['runs'], 'interrupt'>;
4
5
  export interface InteractiveInterruptOptions {
5
6
  readonly sessionId?: string | undefined;
6
7
  readonly signal?: AbortSignal | undefined;
8
+ readonly wire?: InteractiveEngineWire | undefined;
7
9
  }
8
10
  export declare function fireInteractiveInterrupt(runs: InteractiveInterruptRuns | null | undefined, taskId: string, opts?: InteractiveInterruptOptions): Promise<InteractiveHaltInterruptOutcome>;
@@ -1,5 +1,6 @@
1
1
  import { atMostOnceVerdictOf } from './atMostOnce.js';
2
2
  import { readOwnDataValue } from './ownKey.js';
3
+ import { noteInteractiveStopRequested, ownSlotOf } from './sessionBackground.js';
3
4
  function guardedSlot(e, key) {
4
5
  if (e === null || (typeof e !== 'object' && typeof e !== 'function'))
5
6
  return undefined;
@@ -33,6 +34,20 @@ function turnCutOf(receipt) {
33
34
  }
34
35
  }
35
36
  export async function fireInteractiveInterrupt(runs, taskId, opts = {}) {
37
+ if (opts !== null && typeof opts === 'object') {
38
+ const ws = ownSlotOf(opts, 'wire');
39
+ if (ws.state === 'unreadable')
40
+ return { kind: 'withheld' };
41
+ if (ws.state === 'data') {
42
+ const wire = ws.value;
43
+ if (wire !== null) {
44
+ if (typeof wire !== 'object')
45
+ return { kind: 'withheld' };
46
+ if (noteInteractiveStopRequested(wire, taskId) === 'withheld')
47
+ return { kind: 'withheld' };
48
+ }
49
+ }
50
+ }
36
51
  const verb = guardedSlot(runs, 'interrupt');
37
52
  if (typeof verb !== 'function')
38
53
  return { kind: 'unarmed' };
@@ -7,6 +7,8 @@ export type InteractiveToolsResolution = {
7
7
  source: 'default' | 'env' | 'plan-flag';
8
8
  warning?: string;
9
9
  };
10
- export declare function planModeExplicitlyRequested(argv: readonly string[]): boolean;
11
- export declare function resolveHeadlessInteractiveTools(argv: readonly string[], env?: EnvLike): InteractiveToolsResolution;
10
+ export interface HeadlessInteractiveToolsStance {
11
+ readonly permissionMode?: string;
12
+ }
13
+ export declare function resolveHeadlessInteractiveTools(stance: HeadlessInteractiveToolsStance | undefined, env?: EnvLike): InteractiveToolsResolution;
12
14
  export declare function _resetInteractiveToolsWireForTest(): void;
@@ -1,13 +1,13 @@
1
1
  import { hostEnv } from './hostEnv.js';
2
2
  import { envFlagOff, envFlagOn } from './envFlag.js';
3
- import { permissionModeFromArgv } from './headlessPermissionModeWire.js';
3
+ import { flagString } from './flagInput.js';
4
4
  export const HEADLESS_INTERACTIVE_TOOLS_ENV = 'SEMA_HEADLESS_INTERACTIVE_TOOLS';
5
- export function planModeExplicitlyRequested(argv) {
6
- return permissionModeFromArgv(argv) === 'plan';
5
+ function stanceIsPlanMode(stance) {
6
+ return flagString(stance, 'permissionMode') === 'plan';
7
7
  }
8
8
  let warnedInvalidEnv = false;
9
- export function resolveHeadlessInteractiveTools(argv, env = hostEnv()) {
10
- if (planModeExplicitlyRequested(argv)) {
9
+ export function resolveHeadlessInteractiveTools(stance, env = hostEnv()) {
10
+ if (stanceIsPlanMode(stance)) {
11
11
  return { fields: {}, source: 'plan-flag' };
12
12
  }
13
13
  const raw = env[HEADLESS_INTERACTIVE_TOOLS_ENV]?.trim();
@@ -0,0 +1,20 @@
1
+ export declare const shapeTag: (v: {} | null | undefined) => string;
2
+ export declare const isPlainRecord: (v: {} | null | undefined) => v is Record<string, {} | null | undefined>;
3
+ export type MaterializeResult = {
4
+ readonly bad: string;
5
+ } | {
6
+ readonly value: {} | null | undefined;
7
+ };
8
+ export interface MaterializeGuard {
9
+ readonly budget: {
10
+ left: number;
11
+ };
12
+ readonly visited?: WeakSet<object>;
13
+ }
14
+ export interface MaterializeOptions {
15
+ readonly guard?: MaterializeGuard;
16
+ readonly functionLeaf?: (captured: Readonly<Record<string, {} | null | undefined>>, key: string) => boolean;
17
+ readonly undefinedIsBad?: boolean;
18
+ }
19
+ export declare const materializeJsonFaithful: (v: {} | null | undefined, path: string, seen?: Set<object>, opts?: MaterializeOptions) => MaterializeResult;
20
+ export declare const jsonFaithfulCost: (v: {} | null | undefined) => number;
@@ -0,0 +1,152 @@
1
+ import { appendOwnElement } from './ownKey.js';
2
+ export const shapeTag = (v) => {
3
+ try {
4
+ const proto = Object.getPrototypeOf(v);
5
+ const carrier = proto === null
6
+ ? 'null-prototype'
7
+ : String(proto?.constructor?.name ?? 'anonymous');
8
+ return `typeof=${typeof v} / ${Object.prototype.toString.call(v)} / prototype=${carrier}`;
9
+ }
10
+ catch {
11
+ return `typeof=${typeof v} / shape=unreadable`;
12
+ }
13
+ };
14
+ export const isPlainRecord = (v) => {
15
+ if (typeof v !== 'object' || v === null)
16
+ return false;
17
+ const proto = Object.getPrototypeOf(v);
18
+ if (proto === null)
19
+ return true;
20
+ if (typeof proto !== 'object')
21
+ return false;
22
+ if (!Object.prototype.hasOwnProperty.call(proto, 'constructor'))
23
+ return false;
24
+ const ctor = proto.constructor;
25
+ if (typeof ctor !== 'function')
26
+ return false;
27
+ if (Function.prototype.toString.call(ctor) !== Function.prototype.toString.call(Object))
28
+ return false;
29
+ return ctor.prototype === proto;
30
+ };
31
+ export const materializeJsonFaithful = (v, path, seen = new Set(), opts = {}) => {
32
+ const guard = opts.guard;
33
+ if (guard !== undefined && --guard.budget.left < 0)
34
+ return { bad: `${path}(超出捕获预算 ⇒ 读数过大)` };
35
+ if (v === null)
36
+ return { value: null };
37
+ const t = typeof v;
38
+ if (t === 'string' || t === 'boolean')
39
+ return { value: v };
40
+ if (t === 'number') {
41
+ return Number.isFinite(v) ? { value: v } : { bad: `${path}(非有限数 ⇒ 序列化成 null)` };
42
+ }
43
+ if (t !== 'object')
44
+ return { bad: `${path}(typeof=${t} 不是 JSON 值)` };
45
+ const o = v;
46
+ if (seen.has(o))
47
+ return { bad: `${path}(循环引用)` };
48
+ if (guard?.visited !== undefined) {
49
+ if (guard.visited.has(o))
50
+ return { bad: `${path}(同一对象第二次出现 ⇒ 共享引用不是设置文件形)` };
51
+ guard.visited.add(o);
52
+ }
53
+ if (guard !== undefined && --guard.budget.left < 0)
54
+ return { bad: `${path}(超出捕获预算 ⇒ 读数过大)` };
55
+ const toJSONProp = o.toJSON;
56
+ if (typeof toJSONProp === 'function')
57
+ return { bad: `${path}(自报 toJSON ⇒ 字节被改写)` };
58
+ seen.add(o);
59
+ try {
60
+ if (Array.isArray(o)) {
61
+ if (guard !== undefined && --guard.budget.left < 0)
62
+ return { bad: `${path}(超出捕获预算 ⇒ 读数过大)` };
63
+ const rawLen = o.length;
64
+ if (typeof rawLen === 'bigint' || typeof rawLen === 'symbol') {
65
+ return { bad: `${path}(length 是 ${typeof rawLen} ⇒ 原生序列化直接抛,归 0 会静默发空表)` };
66
+ }
67
+ let lenNum;
68
+ try {
69
+ lenNum = +rawLen;
70
+ }
71
+ catch {
72
+ return { bad: `${path}(length 按 ToNumber 转换即抛(BigInt/symbol 形)⇒ 原生序列化也抛,归 0 会静默发空表)` };
73
+ }
74
+ if (lenNum === Number.POSITIVE_INFINITY) {
75
+ return { bad: `${path}(length 是 +Infinity ⇒ 原生序列化抛 RangeError,归 0 会静默发空表)` };
76
+ }
77
+ const len = Number.isNaN(lenNum)
78
+ ? 0
79
+ : Math.min(Math.max(0, Math.trunc(lenNum)), Number.MAX_SAFE_INTEGER);
80
+ const items = [];
81
+ for (let i = 0; i < len; i++) {
82
+ if (guard !== undefined && --guard.budget.left < 0)
83
+ return { bad: `${path}[${i}](超出捕获预算 ⇒ 读数过大)` };
84
+ const r = materializeJsonFaithful(o[i], `${path}[${i}]`, seen, opts);
85
+ if ('bad' in r)
86
+ return r;
87
+ appendOwnElement(items, r.value);
88
+ }
89
+ return { value: items };
90
+ }
91
+ const rec = Object.create(null);
92
+ const fnKeys = [];
93
+ if (guard !== undefined && --guard.budget.left < 0)
94
+ return { bad: `${path}(超出捕获预算 ⇒ 读数过大)` };
95
+ const keys = [];
96
+ for (const k of Reflect.ownKeys(o)) {
97
+ if (typeof k !== 'string')
98
+ continue;
99
+ if (guard !== undefined && --guard.budget.left < 0)
100
+ return { bad: `${path}.${k}(超出捕获预算 ⇒ 读数过大)` };
101
+ const d = Reflect.getOwnPropertyDescriptor(o, k);
102
+ if (d !== undefined && d.enumerable === true)
103
+ appendOwnElement(keys, k);
104
+ }
105
+ for (const k of keys) {
106
+ const val = o[k];
107
+ if (val === undefined) {
108
+ if (opts.undefinedIsBad === true)
109
+ return { bad: `${path}.${k}(值为 undefined 的键 ⇒ 不是包铸的形)` };
110
+ continue;
111
+ }
112
+ if (typeof val === 'function' && opts.functionLeaf !== undefined) {
113
+ if (guard !== undefined && --guard.budget.left < 0)
114
+ return { bad: `${path}.${k}(超出捕获预算 ⇒ 读数过大)` };
115
+ Object.defineProperty(rec, k, { value: val, enumerable: true, writable: true, configurable: true });
116
+ appendOwnElement(fnKeys, k);
117
+ continue;
118
+ }
119
+ const r = materializeJsonFaithful(val, `${path}.${k}`, seen, opts);
120
+ if ('bad' in r)
121
+ return r;
122
+ Object.defineProperty(rec, k, { value: r.value, enumerable: true, writable: true, configurable: true });
123
+ }
124
+ if (guard !== undefined && --guard.budget.left < 0)
125
+ return { bad: `${path}(超出捕获预算 ⇒ 读数过大)` };
126
+ if (!isPlainRecord(o))
127
+ return { bad: `${path}(${shapeTag(o)})` };
128
+ for (const k of fnKeys)
129
+ if (!opts.functionLeaf(rec, k))
130
+ return { bad: `${path}.${k}(typeof=function 不是 JSON 值,也不在调用方认的函数位上)` };
131
+ return { value: rec };
132
+ }
133
+ finally {
134
+ seen.delete(o);
135
+ }
136
+ };
137
+ export const jsonFaithfulCost = (v) => {
138
+ if (v === null || typeof v !== 'object')
139
+ return 1;
140
+ if (Array.isArray(v)) {
141
+ let n = 3;
142
+ for (let i = 0; i < v.length; i++)
143
+ n += 1 + jsonFaithfulCost(v[i]);
144
+ return n;
145
+ }
146
+ let n = 4;
147
+ for (const k of Object.keys(v)) {
148
+ const val = v[k];
149
+ n += 1 + (val === undefined ? 0 : jsonFaithfulCost(val));
150
+ }
151
+ return n;
152
+ };
@@ -20,7 +20,12 @@ export type LimitsParseResult = {
20
20
  ok: false;
21
21
  error: string;
22
22
  };
23
- export declare function parseLimitsArgv(argv: string[]): LimitsParseResult;
23
+ export interface LimitsFlags {
24
+ readonly deadline?: string;
25
+ readonly maxTurns?: string;
26
+ readonly maxTokens?: string;
27
+ }
28
+ export declare function parseLimitsFlags(flags: LimitsFlags | undefined): LimitsParseResult;
24
29
  export declare function explicitLimitFlagNames(parsed: LimitsParseResult): string[];
25
30
  export declare function limitsSupportNotice(reading: {
26
31
  observed: boolean;
@@ -34,4 +39,4 @@ export type HeadlessEnvLimitsResult = {
34
39
  error: string;
35
40
  };
36
41
  export declare function headlessLimitsFromEnv(env?: EnvLike): HeadlessEnvLimitsResult;
37
- export declare function limitsForPrint(argv: string[], env?: EnvLike): LimitsParseResult;
42
+ export declare function limitsForPrint(flags: LimitsFlags | undefined, env?: EnvLike): LimitsParseResult;
@@ -1,5 +1,5 @@
1
1
  import { hostEnv } from './hostEnv.js';
2
- import { lastFlagValue } from './argvFlagValue.js';
2
+ import { flagIsWronglyTyped, flagString } from './flagInput.js';
3
3
  import { engineVersionTier, SUPPORT_FLOOR } from './supportFloor.js';
4
4
  import { readThrownSlot } from './wireFailureShape.js';
5
5
  export const HEADLESS_DEADLINE_ENV = 'SEMA_HEADLESS_DEADLINE_SEC';
@@ -44,25 +44,31 @@ function parseIntInDomain(raw, min, max) {
44
44
  function hasAnyLimit(l) {
45
45
  return l.maxWalltimeMs !== undefined || l.maxTurns !== undefined || l.maxOutputTokens !== undefined;
46
46
  }
47
- export function parseLimitsArgv(argv) {
47
+ export function parseLimitsFlags(flags) {
48
48
  const limits = {};
49
- const dl = lastFlagValue(argv, LIMIT_FLAG_OF_KEY.maxWalltimeMs);
50
- if (dl.present) {
51
- const n = dl.raw !== undefined ? parseIntInDomain(dl.raw, DEADLINE_SEC_MIN, DEADLINE_SEC_MAX) : null;
49
+ if (flagIsWronglyTyped(flags, 'deadline'))
50
+ return { ok: false, error: DEADLINE_USAGE };
51
+ if (flagIsWronglyTyped(flags, 'maxTurns'))
52
+ return { ok: false, error: MAX_TURNS_USAGE };
53
+ if (flagIsWronglyTyped(flags, 'maxTokens'))
54
+ return { ok: false, error: MAX_TOKENS_USAGE };
55
+ const dl = flagString(flags, 'deadline');
56
+ if (dl !== undefined) {
57
+ const n = parseIntInDomain(dl, DEADLINE_SEC_MIN, DEADLINE_SEC_MAX);
52
58
  if (n === null)
53
59
  return { ok: false, error: DEADLINE_USAGE };
54
60
  limits.maxWalltimeMs = n * SEC_TO_MS;
55
61
  }
56
- const mt = lastFlagValue(argv, LIMIT_FLAG_OF_KEY.maxTurns);
57
- if (mt.present) {
58
- const n = mt.raw !== undefined ? parseIntInDomain(mt.raw, MAX_TURNS_MIN, MAX_TURNS_MAX) : null;
62
+ const mt = flagString(flags, 'maxTurns');
63
+ if (mt !== undefined) {
64
+ const n = parseIntInDomain(mt, MAX_TURNS_MIN, MAX_TURNS_MAX);
59
65
  if (n === null)
60
66
  return { ok: false, error: MAX_TURNS_USAGE };
61
67
  limits.maxTurns = n;
62
68
  }
63
- const mk = lastFlagValue(argv, LIMIT_FLAG_OF_KEY.maxOutputTokens);
64
- if (mk.present) {
65
- const n = mk.raw !== undefined ? parseIntInDomain(mk.raw, MAX_TOKENS_MIN, MAX_TOKENS_MAX) : null;
69
+ const mk = flagString(flags, 'maxTokens');
70
+ if (mk !== undefined) {
71
+ const n = parseIntInDomain(mk, MAX_TOKENS_MIN, MAX_TOKENS_MAX);
66
72
  if (n === null)
67
73
  return { ok: false, error: MAX_TOKENS_USAGE };
68
74
  limits.maxOutputTokens = n;
@@ -139,8 +145,8 @@ export function headlessLimitsFromEnv(env = hostEnv()) {
139
145
  }
140
146
  return { ok: true, limits: hasAnyLimit(out) ? out : undefined };
141
147
  }
142
- export function limitsForPrint(argv, env = hostEnv()) {
143
- const parsed = parseLimitsArgv(argv);
148
+ export function limitsForPrint(flags, env = hostEnv()) {
149
+ const parsed = parseLimitsFlags(flags);
144
150
  if (!parsed.ok)
145
151
  return parsed;
146
152
  const fromEnv = headlessLimitsFromEnv(env);
@@ -1,5 +1,6 @@
1
1
  import { type EngineProbeOpts } from './engineWireSdk.js';
2
2
  import type { EnvLike } from './hostEnv.js';
3
+ import { type ScenarioFlag } from './scenarioWire.js';
3
4
  export declare const ENGINE_HANDS_BAND: readonly string[];
4
5
  export declare const ENGINE_SCENARIO_EXTRAS_DEFAULT: readonly string[];
5
6
  export declare const ENGINE_RUNNER_FACE: readonly string[];
@@ -15,9 +16,13 @@ export declare function probeScenarioTools(baseUrl: string, scenario: string, op
15
16
  tools: string[];
16
17
  toolset?: string;
17
18
  } | null>;
19
+ export interface LiveInitToolFaceFlags {
20
+ readonly scenario?: ScenarioFlag;
21
+ readonly permissionMode?: string;
22
+ }
18
23
  export interface LiveInitToolFaceOptions {
19
24
  fetchImpl?: typeof fetch;
20
25
  timeoutMs?: number;
21
26
  webSearchStamped?: boolean;
22
27
  }
23
- export declare function resolveLiveInitToolFace(argv: readonly string[], env: EnvLike, opts?: LiveInitToolFaceOptions): Promise<LiveInitToolFace | null>;
28
+ export declare function resolveLiveInitToolFace(flags: LiveInitToolFaceFlags | undefined, env: EnvLike, opts?: LiveInitToolFaceOptions): Promise<LiveInitToolFace | null>;
@@ -3,6 +3,7 @@ import { settleWithinDeadline } from './abortableSleep.js';
3
3
  import { hostLog } from './host.js';
4
4
  import { scenarioForPrint } from './scenarioWire.js';
5
5
  import { resolveHeadlessInteractiveTools } from './interactiveToolsWire.js';
6
+ import { flagObject, flagString } from './flagInput.js';
6
7
  import { webSearchVerdictFromEnv } from './webSearchWireCaps.js';
7
8
  export const ENGINE_HANDS_BAND = [
8
9
  'Bash',
@@ -101,14 +102,14 @@ export async function probeScenarioTools(baseUrl, scenario, opts) {
101
102
  return null;
102
103
  }
103
104
  }
104
- export async function resolveLiveInitToolFace(argv, env, opts) {
105
+ export async function resolveLiveInitToolFace(flags, env, opts) {
105
106
  const baseUrl = env.SEMA_LIVE_BASEURL;
106
107
  if (!baseUrl)
107
108
  return null;
108
109
  try {
109
110
  let scenario;
110
111
  try {
111
- const sc = scenarioForPrint([...argv], env);
112
+ const sc = scenarioForPrint(flagObject(flags, 'scenario'), env);
112
113
  if (sc.ok && sc.scenario)
113
114
  scenario = sc.scenario;
114
115
  }
@@ -116,7 +117,8 @@ export async function resolveLiveInitToolFace(argv, env, opts) {
116
117
  }
117
118
  let askUserQuestion = false;
118
119
  try {
119
- const r = resolveHeadlessInteractiveTools([...argv], env);
120
+ const mode = flagString(flags, 'permissionMode');
121
+ const r = resolveHeadlessInteractiveTools(mode !== undefined ? { permissionMode: mode } : undefined, env);
120
122
  askUserQuestion = r.fields.interactiveTools !== false;
121
123
  }
122
124
  catch {
@@ -30,6 +30,10 @@ export declare function getLiveModelCatalog(): LiveModelCatalog | null;
30
30
  export declare function normalizeLiveModelRef(ref: string): string;
31
31
  export type ImageVision = 'yes' | 'no' | 'unknown';
32
32
  export declare function imageVisionOf(model: string | undefined, catalog?: LiveModelCatalog | null): ImageVision;
33
+ export declare function imageVisionReadingOf(model: string | undefined, catalog?: LiveModelCatalog | null): {
34
+ readonly vision: ImageVision;
35
+ readonly model?: string;
36
+ };
33
37
  export type EffortLevelsReading = {
34
38
  readonly kind: 'clamped';
35
39
  readonly levels: readonly string[];
@@ -44,6 +48,24 @@ export type EffortLevelsReading = {
44
48
  export declare function effortLevelsOf(model: string | undefined, catalog?: LiveModelCatalog | null): EffortLevelsReading;
45
49
  export declare function effortLevelHonored(reading: EffortLevelsReading, level: string): 'yes' | 'no' | 'unknown';
46
50
  export declare function liveDefaultModelName(): string | null;
51
+ export type ModelAcceptanceReading = {
52
+ readonly verdict: 'accepted';
53
+ readonly why: 'listed';
54
+ readonly model: string;
55
+ readonly defaultModel?: string;
56
+ } | {
57
+ readonly verdict: 'refused';
58
+ readonly why: 'not_listed' | 'disabled';
59
+ readonly model: string;
60
+ readonly defaultModel?: string;
61
+ } | {
62
+ readonly verdict: 'unknown';
63
+ readonly why: 'catalog_absent' | 'catalog_unreadable' | 'catalog_incomplete' | 'model_absent' | 'reserved_word';
64
+ readonly model?: string;
65
+ readonly defaultModel?: string;
66
+ };
67
+ export declare function modelAcceptanceOf(model: string | undefined, catalog?: LiveModelCatalog | null): ModelAcceptanceReading;
68
+ export declare function modelNotServedNotice(reading: ModelAcceptanceReading, lang?: UiLanguage): string | undefined;
47
69
  type SdkModelsListResult = Awaited<ReturnType<AgentClient['models']['list']>>;
48
70
  type SdkDroppedEntry = SdkModelsListResult extends {
49
71
  droppedEntries?: ReadonlyArray<infer E>;