@sema-agent/client-core 0.94.0 → 0.96.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 (332) hide show
  1. package/CHANGELOG.md +521 -0
  2. package/README.md +104 -57
  3. package/dist/adapt/arms.js +12 -7
  4. package/dist/adapt/panelTasks.js +4 -10
  5. package/dist/adapt/toolCards.d.ts +1 -0
  6. package/dist/adapt/toolCards.js +18 -5
  7. package/dist/adapt/wireShapes.js +5 -24
  8. package/dist/adapter/activeRunSelfHeal.d.ts +12 -3
  9. package/dist/adapter/activeRunSelfHeal.js +50 -16
  10. package/dist/adapter/downstream/eventToSdkMessage.js +33 -18
  11. package/dist/adapter/downstream/terminalToSdkResult.js +19 -12
  12. package/dist/adapter/runStream.js +30 -46
  13. package/dist/adapter/types.d.ts +7 -0
  14. package/dist/adapter/types.js +15 -0
  15. package/dist/agentSession/backgroundView.js +5 -1
  16. package/dist/agentSession/engineAgentRegistryRead.js +7 -5
  17. package/dist/agentSession/engineSessionBackgroundStop.js +25 -17
  18. package/dist/agentsWireCaps.d.ts +2 -0
  19. package/dist/agentsWireCaps.js +13 -2
  20. package/dist/approvalDecidedByCapability.d.ts +0 -1
  21. package/dist/approvalDecidedByCapability.js +2 -7
  22. package/dist/approvalsStreamLiveCapability.d.ts +0 -1
  23. package/dist/approvalsStreamLiveCapability.js +2 -6
  24. package/dist/atMostOnce.d.ts +8 -0
  25. package/dist/atMostOnce.js +36 -0
  26. package/dist/attachmentSeatCapability.d.ts +0 -1
  27. package/dist/attachmentSeatCapability.js +0 -3
  28. package/dist/attachmentsWireCaps.js +11 -6
  29. package/dist/bashExitReading.d.ts +10 -0
  30. package/dist/bashExitReading.js +12 -0
  31. package/dist/callerCwdCapability.d.ts +0 -5
  32. package/dist/callerCwdCapability.js +2 -13
  33. package/dist/centerWiringCapability.d.ts +1 -7
  34. package/dist/centerWiringCapability.js +18 -27
  35. package/dist/classifierStatus.js +4 -4
  36. package/dist/classifierVerdictWire.js +4 -16
  37. package/dist/clientSlice.js +1 -1
  38. package/dist/cloudConfigWireCaps.d.ts +3 -3
  39. package/dist/cloudConfigWireCaps.js +85 -43
  40. package/dist/compensations.js +1 -1
  41. package/dist/coreValuePorts.d.ts +11 -7
  42. package/dist/coreValuePorts.js +5 -8
  43. package/dist/credentialProvenance.d.ts +28 -0
  44. package/dist/credentialProvenance.js +76 -0
  45. package/dist/cycleOrder.d.ts +15 -0
  46. package/dist/cycleOrder.js +45 -0
  47. package/dist/decideFailureNote.js +7 -2
  48. package/dist/decideReceipt.d.ts +2 -1
  49. package/dist/decideReceipt.js +39 -14
  50. package/dist/declared/supportFloorDeclared.d.ts +1 -0
  51. package/dist/declared/supportFloorDeclared.js +5 -0
  52. package/dist/deviceExecutorManagementCapability.d.ts +0 -1
  53. package/dist/deviceExecutorManagementCapability.js +7 -16
  54. package/dist/deviceRebind.d.ts +88 -0
  55. package/dist/deviceRebind.js +242 -0
  56. package/dist/displayUntrusted.d.ts +8 -3
  57. package/dist/displayUntrusted.js +661 -63
  58. package/dist/engineAgentAbsence.d.ts +2 -2
  59. package/dist/engineAgentPanelStore.d.ts +8 -18
  60. package/dist/engineAgentPanelStore.js +19 -537
  61. package/dist/engineCapReader.d.ts +6 -6
  62. package/dist/engineCapReader.js +30 -43
  63. package/dist/engineCapsCache.d.ts +13 -2
  64. package/dist/engineCapsCache.js +276 -44
  65. package/dist/engineCredentialRequirement.d.ts +9 -0
  66. package/dist/engineCredentialRequirement.js +23 -0
  67. package/dist/engineDirectory.d.ts +79 -0
  68. package/dist/engineDirectory.js +186 -0
  69. package/dist/engineEnvSourcing.d.ts +53 -0
  70. package/dist/engineEnvSourcing.js +81 -0
  71. package/dist/engineErrorCodes.d.ts +28 -4
  72. package/dist/engineErrorCodes.js +68 -25
  73. package/dist/engineIdentity.js +2 -0
  74. package/dist/engineNoticeCodes.d.ts +17 -0
  75. package/dist/engineNoticeCodes.js +57 -3
  76. package/dist/engineWireSdk.js +2 -2
  77. package/dist/engineWordRenames.d.ts +8 -0
  78. package/dist/engineWordRenames.js +13 -0
  79. package/dist/executionLaneCapability.d.ts +2 -3
  80. package/dist/executionLaneCapability.js +18 -23
  81. package/dist/fileHistoryCaptureCapability.d.ts +14 -1
  82. package/dist/fileHistoryCaptureCapability.js +72 -6
  83. package/dist/fileHistoryLegNotice.d.ts +3 -2
  84. package/dist/fileHistoryLegNotice.js +51 -2
  85. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  86. package/dist/fleet/bgSubagentRow.js +67 -0
  87. package/dist/fleet/fleetLedger.d.ts +3 -0
  88. package/dist/fleet/fleetLedger.js +153 -122
  89. package/dist/fleet/fleetProjection.d.ts +1 -3
  90. package/dist/fleet/fleetProjection.js +19 -19
  91. package/dist/fleetAgentPanelProjection.d.ts +4 -17
  92. package/dist/fleetAgentPanelProjection.js +7 -197
  93. package/dist/fleetAgentRowLike.d.ts +16 -0
  94. package/dist/fleetAgentRowLike.js +1 -0
  95. package/dist/fleetTaskDesc.js +4 -17
  96. package/dist/gateOutcome.d.ts +12 -1
  97. package/dist/gateOutcome.js +87 -18
  98. package/dist/gateVocabulary.d.ts +7 -2
  99. package/dist/gateVocabulary.js +5 -1
  100. package/dist/generated/engineAskFaceTables.js +1 -1
  101. package/dist/generated/engineFactTables.d.ts +5 -3
  102. package/dist/generated/engineFactTables.js +17 -4
  103. package/dist/generated/engineNoticeTables.js +12 -3
  104. package/dist/generated/sdkFactTables.d.ts +2 -0
  105. package/dist/generated/sdkFactTables.js +17 -0
  106. package/dist/generated/settingsSchemaFns.d.ts +13 -0
  107. package/dist/generated/settingsSchemaFns.js +75 -0
  108. package/dist/generated/toolNameTables.d.ts +1 -0
  109. package/dist/generated/toolNameTables.js +1 -0
  110. package/dist/headlessPermissionModeWire.d.ts +1 -1
  111. package/dist/headlessPermissionModeWire.js +1 -1
  112. package/dist/headlessReconnectWire.js +49 -20
  113. package/dist/hitl/allowRuleShadow.d.ts +1 -1
  114. package/dist/hitl/allowRuleShadow.js +49 -8
  115. package/dist/hitl/approvalCompleteParked.d.ts +1 -0
  116. package/dist/hitl/approvalCompleteParked.js +14 -0
  117. package/dist/hitl/approvalEndingCause.d.ts +7 -0
  118. package/dist/hitl/approvalEndingCause.js +71 -0
  119. package/dist/hitl/approvalHolds.d.ts +12 -2
  120. package/dist/hitl/approvalHolds.js +53 -2
  121. package/dist/hitl/approvalsFeed.js +23 -11
  122. package/dist/hitl/askGateWire.d.ts +2 -1
  123. package/dist/hitl/askGateWire.js +26 -1
  124. package/dist/hitl/askParkRowRouting.js +1 -1
  125. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  126. package/dist/hitl/automaticAnswerVerdict.js +15 -10
  127. package/dist/hitl/crashConverged.js +2 -0
  128. package/dist/hitl/decisionConflict.d.ts +3 -0
  129. package/dist/hitl/decisionConflict.js +41 -0
  130. package/dist/hitl/decisionRefusal.d.ts +12 -0
  131. package/dist/hitl/decisionRefusal.js +63 -4
  132. package/dist/hitl/frameRouter.d.ts +0 -1
  133. package/dist/hitl/frameRouter.js +32 -57
  134. package/dist/hitl/gateLedger.d.ts +5 -0
  135. package/dist/hitl/gateLedger.js +21 -0
  136. package/dist/hitl/hitlBridge.d.ts +17 -2
  137. package/dist/hitl/hitlBridge.js +91 -55
  138. package/dist/hitl/hitlHostSurface.js +3 -11
  139. package/dist/hitl/livePendingAsk.d.ts +16 -6
  140. package/dist/hitl/livePendingAsk.js +36 -4
  141. package/dist/hitl/localAllowRule.d.ts +1 -0
  142. package/dist/hitl/localAllowRule.js +2 -2
  143. package/dist/hitl/noAllowCause.d.ts +2 -1
  144. package/dist/hitl/noAllowCause.js +3 -2
  145. package/dist/hitl/parkExpiryJudgements.d.ts +19 -0
  146. package/dist/hitl/parkExpiryJudgements.js +46 -0
  147. package/dist/hitl/parkResolver.d.ts +4 -7
  148. package/dist/hitl/parkResolver.js +12 -34
  149. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  150. package/dist/hitl/parkRowBirthWait.js +2 -2
  151. package/dist/hitl/persistedRulesWire.js +5 -1
  152. package/dist/hitl/planReviewWire.d.ts +3 -2
  153. package/dist/hitl/planReviewWire.js +154 -50
  154. package/dist/hitl/replayedApproval.d.ts +9 -0
  155. package/dist/hitl/replayedApproval.js +139 -10
  156. package/dist/hitl/resumeRunningCard.d.ts +2 -0
  157. package/dist/hitl/resumeRunningCard.js +15 -4
  158. package/dist/hitl/sessionPolicyDeliverable.js +8 -6
  159. package/dist/hitl/standingRows.d.ts +18 -0
  160. package/dist/hitl/standingRows.js +127 -0
  161. package/dist/hitl/toolApprovalWire.d.ts +39 -7
  162. package/dist/hitl/toolApprovalWire.js +351 -61
  163. package/dist/hookMatcherVerdict.d.ts +1 -9
  164. package/dist/hookMatcherVerdict.js +21 -61
  165. package/dist/hooksWireCaps.js +40 -8
  166. package/dist/host.d.ts +5 -0
  167. package/dist/host.js +3 -1
  168. package/dist/hostCallbackGuard.d.ts +2 -0
  169. package/dist/hostCallbackGuard.js +31 -0
  170. package/dist/index.d.ts +48 -17
  171. package/dist/index.js +36 -15
  172. package/dist/interactiveInterrupt.d.ts +8 -0
  173. package/dist/interactiveInterrupt.js +54 -0
  174. package/dist/limitsWire.d.ts +5 -0
  175. package/dist/limitsWire.js +49 -3
  176. package/dist/liveModelCatalog.d.ts +95 -0
  177. package/dist/liveModelCatalog.js +297 -32
  178. package/dist/mcpEngineLeg.d.ts +25 -0
  179. package/dist/mcpEngineLeg.js +71 -15
  180. package/dist/mcpPanel.js +2 -1
  181. package/dist/mcpProbeCapability.d.ts +0 -5
  182. package/dist/mcpProbeCapability.js +2 -12
  183. package/dist/mcpReconnect.d.ts +1 -3
  184. package/dist/mcpReconnect.js +10 -5
  185. package/dist/memoryComplianceCapability.d.ts +0 -5
  186. package/dist/memoryComplianceCapability.js +2 -12
  187. package/dist/memoryOriginCapability.d.ts +0 -5
  188. package/dist/memoryOriginCapability.js +2 -12
  189. package/dist/memorySpecWire.js +2 -2
  190. package/dist/memoryVerbsWire.d.ts +1 -1
  191. package/dist/memoryVerbsWire.js +4 -0
  192. package/dist/model/liveCatalogShape.d.ts +14 -0
  193. package/dist/model/liveCatalogShape.js +71 -0
  194. package/dist/model/modelSupplyRules.d.ts +1 -0
  195. package/dist/model/modelSupplyRules.js +30 -9
  196. package/dist/model/modelsPolicy.d.ts +21 -0
  197. package/dist/model/modelsPolicy.js +90 -0
  198. package/dist/modelIdentityResolvability.d.ts +2 -2
  199. package/dist/modelIdentityResolvability.js +14 -12
  200. package/dist/modelSwitchFallback.d.ts +69 -0
  201. package/dist/modelSwitchFallback.js +206 -0
  202. package/dist/noticePresentation.d.ts +68 -0
  203. package/dist/noticePresentation.js +247 -0
  204. package/dist/notifications.js +12 -11
  205. package/dist/outputStyleSeatCapability.d.ts +0 -2
  206. package/dist/outputStyleSeatCapability.js +2 -10
  207. package/dist/ownKey.d.ts +8 -0
  208. package/dist/ownKey.js +66 -0
  209. package/dist/panelReduce.d.ts +114 -0
  210. package/dist/panelReduce.js +1135 -0
  211. package/dist/panelStateHolder.d.ts +17 -0
  212. package/dist/panelStateHolder.js +201 -0
  213. package/dist/peerFrames.js +13 -9
  214. package/dist/peerLaneCapability.d.ts +0 -1
  215. package/dist/peerLaneCapability.js +2 -6
  216. package/dist/permissionModesCapability.d.ts +0 -5
  217. package/dist/permissionModesCapability.js +5 -16
  218. package/dist/permissionRuleIssue.js +0 -3
  219. package/dist/permissionRulesWriteCapability.d.ts +0 -1
  220. package/dist/permissionRulesWriteCapability.js +2 -6
  221. package/dist/permissionsAllowGrantCapability.d.ts +0 -1
  222. package/dist/permissionsAllowGrantCapability.js +3 -9
  223. package/dist/permissionsDeclaration.d.ts +8 -0
  224. package/dist/permissionsDeclaration.js +101 -41
  225. package/dist/printPermissionOutcome.d.ts +12 -0
  226. package/dist/printPermissionOutcome.js +50 -0
  227. package/dist/printToolResultFrame.d.ts +1 -0
  228. package/dist/printToolResultFrame.js +5 -17
  229. package/dist/promptBlockedCopy.d.ts +5 -0
  230. package/dist/promptBlockedCopy.js +35 -0
  231. package/dist/promptDelivery.js +0 -8
  232. package/dist/protocolSegment.d.ts +9 -6
  233. package/dist/protocolSegment.js +31 -21
  234. package/dist/providerRejection.d.ts +4 -0
  235. package/dist/providerRejection.js +75 -14
  236. package/dist/replayBody.d.ts +12 -0
  237. package/dist/replayBody.js +25 -0
  238. package/dist/resumeRefusalCopy.d.ts +18 -1
  239. package/dist/resumeRefusalCopy.js +127 -32
  240. package/dist/retryStatus.d.ts +9 -1
  241. package/dist/retryStatus.js +9 -2
  242. package/dist/rewindArchiveCapability.d.ts +5 -14
  243. package/dist/rewindArchiveCapability.js +18 -61
  244. package/dist/rewindArchiveReading.d.ts +15 -0
  245. package/dist/rewindArchiveReading.js +56 -0
  246. package/dist/rewindEngineAction.d.ts +21 -0
  247. package/dist/rewindEngineAction.js +36 -0
  248. package/dist/rewindWireCaps.d.ts +2 -1
  249. package/dist/rewindWireCaps.js +1 -0
  250. package/dist/ruleCompileVerdict.d.ts +9 -1
  251. package/dist/ruleCompileVerdict.js +29 -4
  252. package/dist/runTerminal.d.ts +15 -12
  253. package/dist/runTerminal.js +60 -35
  254. package/dist/sandboxWire.js +13 -0
  255. package/dist/sdkRegistryTransit.d.ts +2 -1
  256. package/dist/sdkRegistryTransit.js +1 -0
  257. package/dist/sealedKeyCapability.d.ts +0 -5
  258. package/dist/sealedKeyCapability.js +3 -15
  259. package/dist/seam.js +4 -2
  260. package/dist/seatContract.d.ts +125 -34
  261. package/dist/seatContract.js +583 -179
  262. package/dist/sessionIdSegment.d.ts +1 -0
  263. package/dist/sessionIdSegment.js +11 -0
  264. package/dist/sessionMemoryErase.d.ts +1 -1
  265. package/dist/sessionMemoryErase.js +6 -1
  266. package/dist/sessionMemoryStatus.js +3 -2
  267. package/dist/sessionPolicyCapability.d.ts +0 -1
  268. package/dist/sessionPolicyCapability.js +2 -6
  269. package/dist/sessionReadRedactionCapability.d.ts +0 -5
  270. package/dist/sessionReadRedactionCapability.js +2 -13
  271. package/dist/sessionSyncFileHistory.d.ts +4 -0
  272. package/dist/sessionSyncFileHistory.js +66 -0
  273. package/dist/sessionSyncFileHistoryCapability.d.ts +0 -2
  274. package/dist/sessionSyncFileHistoryCapability.js +2 -9
  275. package/dist/skillToolListsCapability.d.ts +0 -2
  276. package/dist/skillToolListsCapability.js +2 -9
  277. package/dist/skillsWireCaps.d.ts +4 -0
  278. package/dist/skillsWireCaps.js +66 -1
  279. package/dist/sqlEngineCapability.d.ts +0 -1
  280. package/dist/sqlEngineCapability.js +9 -14
  281. package/dist/steerPriorityCapability.d.ts +0 -2
  282. package/dist/steerPriorityCapability.js +3 -12
  283. package/dist/storePostureCapability.d.ts +1 -5
  284. package/dist/storePostureCapability.js +16 -22
  285. package/dist/streamDrainingLegs.d.ts +6 -0
  286. package/dist/streamDrainingLegs.js +23 -0
  287. package/dist/subagent/engineCompactWire.js +13 -38
  288. package/dist/subagent/engineDelegatedPrompt.js +10 -6
  289. package/dist/subagent/engineSubagentOutput.d.ts +0 -1
  290. package/dist/subagent/engineSubagentOutput.js +5 -20
  291. package/dist/subagent/engineSubagentSteer.js +7 -5
  292. package/dist/subagent/engineSubagentTail.d.ts +0 -1
  293. package/dist/subagent/engineSubagentTail.js +7 -32
  294. package/dist/subagentContentStore.js +7 -18
  295. package/dist/supportFloor.d.ts +1 -0
  296. package/dist/supportFloor.js +15 -14
  297. package/dist/systemReminderTag.d.ts +1 -0
  298. package/dist/systemReminderTag.js +8 -0
  299. package/dist/terminalStatuses.d.ts +30 -0
  300. package/dist/terminalStatuses.js +67 -0
  301. package/dist/toolHistoryMismatch.d.ts +0 -3
  302. package/dist/toolHistoryMismatch.js +3 -7
  303. package/dist/toolResult.d.ts +6 -1
  304. package/dist/toolResult.js +90 -37
  305. package/dist/toolResultContent.d.ts +2 -0
  306. package/dist/toolResultContent.js +63 -0
  307. package/dist/types/engineState.d.ts +2 -1
  308. package/dist/usageAnalytics.d.ts +146 -0
  309. package/dist/usageAnalytics.js +335 -0
  310. package/dist/userInvokedSkillsCapability.d.ts +0 -2
  311. package/dist/userInvokedSkillsCapability.js +2 -9
  312. package/dist/webSearchBackendCapability.d.ts +0 -1
  313. package/dist/webSearchBackendCapability.js +3 -7
  314. package/dist/webSearchWireCaps.js +3 -11
  315. package/dist/wireErrorTriage.d.ts +2 -0
  316. package/dist/wireErrorTriage.js +34 -5
  317. package/dist/wireFailureShape.d.ts +23 -2
  318. package/dist/wireFailureShape.js +88 -43
  319. package/dist/wireRefusalCopy.js +2 -18
  320. package/dist/workflowClient.js +7 -11
  321. package/dist/workflowsJournalCapability.d.ts +0 -1
  322. package/dist/workflowsJournalCapability.js +2 -6
  323. package/dist/writeProtectionCapability.d.ts +0 -1
  324. package/dist/writeProtectionCapability.js +5 -10
  325. package/docs/INTEGRATION-CLIENTS.md +2279 -27
  326. package/package.json +5 -5
  327. package/dist/engineCapsGenerationGuard.d.ts +0 -4
  328. package/dist/engineCapsGenerationGuard.js +0 -19
  329. package/dist/panelRunningHistory.d.ts +0 -22
  330. package/dist/panelRunningHistory.js +0 -82
  331. package/dist/registryConflict.d.ts +0 -3
  332. package/dist/registryConflict.js +0 -44
@@ -0,0 +1,10 @@
1
+ export interface BashFrameExit {
2
+ readonly exitCode: number | null;
3
+ readonly note?: string;
4
+ }
5
+ export interface BashExitReading {
6
+ readonly exitCode: number | null;
7
+ readonly benignNote: string | undefined;
8
+ }
9
+ export declare function bashExitOf(structured: unknown, parseFrame: () => BashFrameExit | null): BashExitReading;
10
+ export declare function bashExitReadingFailed(r: BashExitReading): boolean;
@@ -0,0 +1,12 @@
1
+ export function bashExitOf(structured, parseFrame) {
2
+ const s = typeof structured === 'object' && structured !== null ? structured : undefined;
3
+ const interp = typeof s?.returnCodeInterpretation === 'string' && s.returnCodeInterpretation.length > 0 ? s.returnCodeInterpretation : undefined;
4
+ if (s?.type === 'bash' && typeof s.exitCode === 'number')
5
+ return { exitCode: s.exitCode, benignNote: interp };
6
+ const parsed = parseFrame();
7
+ const note = typeof parsed?.note === 'string' && parsed.note.length > 0 ? parsed.note : undefined;
8
+ return { exitCode: parsed?.exitCode ?? null, benignNote: interp ?? note };
9
+ }
10
+ export function bashExitReadingFailed(r) {
11
+ return r.exitCode !== null && r.exitCode !== 0 && r.benignNote === undefined;
12
+ }
@@ -7,10 +7,5 @@ export type CallerCwdReading = {
7
7
  value: boolean;
8
8
  };
9
9
  export declare function projectCallerCwdCapability(caps: unknown): CallerCwdReading | undefined;
10
- export declare function noteEngineCapsForCallerCwd(baseUrl: string, caps: unknown, opts?: {
11
- generation?: number;
12
- }): void;
13
10
  export declare function observedCallerCwd(baseUrl?: string | undefined): CallerCwdReading;
14
11
  export declare function callerCwdAdmitted(reading: CallerCwdReading | undefined): boolean;
15
- export declare function forgetCallerCwdReading(baseUrl: string | undefined): void;
16
- export declare function __resetCallerCwdReadingsForTests(): void;
@@ -1,13 +1,11 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader } from './engineCapReader.js';
3
- import { readOwnDataValue } from './ownKey.js';
3
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
4
4
  export function projectCallerCwdCapability(caps) {
5
5
  try {
6
6
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
7
7
  return undefined;
8
- if (!Object.hasOwn(caps, 'callerCwd'))
9
- return { kind: 'not_reported' };
10
- const v = caps.callerCwd;
8
+ const v = ownDataField(caps, 'callerCwd');
11
9
  if (v === undefined)
12
10
  return { kind: 'not_reported' };
13
11
  return typeof v === 'boolean' ? { kind: 'present', value: v } : undefined;
@@ -21,9 +19,6 @@ const reader = createEngineCapReader({
21
19
  project: projectCallerCwdCapability,
22
20
  makeUnobserved: () => ({ kind: 'unobserved' }),
23
21
  });
24
- export function noteEngineCapsForCallerCwd(baseUrl, caps, opts) {
25
- reader.note(baseUrl, caps, opts);
26
- }
27
22
  export function observedCallerCwd(baseUrl = engineWireTarget()?.baseUrl) {
28
23
  return reader.observed(baseUrl);
29
24
  }
@@ -39,9 +34,3 @@ export function callerCwdAdmitted(reading) {
39
34
  return false;
40
35
  }
41
36
  }
42
- export function forgetCallerCwdReading(baseUrl) {
43
- reader.forget(baseUrl);
44
- }
45
- export function __resetCallerCwdReadingsForTests() {
46
- reader.__resetForTests();
47
- }
@@ -15,11 +15,10 @@ export interface CenterWiringView {
15
15
  usageReport: boolean;
16
16
  issuer: string;
17
17
  caller?: CenterWiringCallerView;
18
+ worker?: string;
18
19
  }
19
20
  export type CenterWiringReading = {
20
21
  kind: 'unobserved';
21
- } | {
22
- kind: 'not_reported';
23
22
  } | {
24
23
  kind: 'none';
25
24
  } | {
@@ -27,12 +26,7 @@ export type CenterWiringReading = {
27
26
  view: CenterWiringView;
28
27
  };
29
28
  export declare function projectCenterWiringCapability(caps: unknown): CenterWiringReading | undefined;
30
- export declare function noteEngineCapsForCenterWiring(baseUrl: string, caps: unknown, opts?: {
31
- generation?: number;
32
- }): void;
33
29
  export declare function observedCenterWiring(baseUrl?: string | undefined): CenterWiringReading;
34
30
  export type CallerQuotaLease = 'enforced' | 'not-enforced' | 'exhausted' | 'unobserved' | 'no-lease' | 'unknown';
35
31
  export declare function callerQuotaLease(reading: CenterWiringReading): CallerQuotaLease;
36
32
  export declare function centerWiringDoctorDetail(reading: CenterWiringReading): string;
37
- export declare function forgetCenterWiringReading(baseUrl: string | undefined): void;
38
- export declare function __resetCenterWiringReadingsForTests(): void;
@@ -1,12 +1,11 @@
1
1
  import { capForDisplay } from './fleetTaskDesc.js';
2
2
  import { engineWireTarget } from './engineWireTarget.js';
3
- import { capsGenerationOf, createEngineCapReader } from './engineCapReader.js';
3
+ import { createEngineCapReader } from './engineCapReader.js';
4
+ import { ownDataField } from './ownKey.js';
4
5
  const nonEmpty = (v) => typeof v === 'string' && v !== '';
5
6
  const isPlainObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
6
7
  function optionalSeat(o, key) {
7
- if (!Object.hasOwn(o, key))
8
- return { state: 'absent' };
9
- const value = o[key];
8
+ const value = ownDataField(o, key);
10
9
  return value === undefined ? { state: 'absent' } : { state: 'value', value };
11
10
  }
12
11
  export function projectCenterWiringCapability(caps) {
@@ -20,16 +19,16 @@ export function projectCenterWiringCapability(caps) {
20
19
  function projectCenterWiringOf(caps) {
21
20
  if (!isPlainObject(caps))
22
21
  return undefined;
23
- const cw = Object.hasOwn(caps, 'centerWiring') ? caps.centerWiring : undefined;
22
+ const cw = ownDataField(caps, 'centerWiring');
24
23
  if (cw === undefined)
25
- return capsGenerationOf(caps).generation === 'new' ? { kind: 'none' } : { kind: 'not_reported' };
24
+ return { kind: 'none' };
26
25
  if (!isPlainObject(cw))
27
26
  return undefined;
28
- const effectivePull = cw.effectivePull;
29
- const revisionRaw = cw.effectiveRevision;
30
- const lease = cw.lease;
31
- const usageReport = cw.usageReport;
32
- const issuer = cw.issuer;
27
+ const effectivePull = ownDataField(cw, 'effectivePull');
28
+ const revisionRaw = ownDataField(cw, 'effectiveRevision');
29
+ const lease = ownDataField(cw, 'lease');
30
+ const usageReport = ownDataField(cw, 'usageReport');
31
+ const issuer = ownDataField(cw, 'issuer');
33
32
  if (typeof effectivePull !== 'boolean' || typeof usageReport !== 'boolean')
34
33
  return undefined;
35
34
  if (!nonEmpty(lease) || !nonEmpty(issuer))
@@ -41,8 +40,8 @@ function projectCenterWiringOf(caps) {
41
40
  else {
42
41
  if (!isPlainObject(revisionRaw))
43
42
  return undefined;
44
- const version = revisionRaw.version;
45
- const updatedAt = revisionRaw.updatedAt;
43
+ const version = ownDataField(revisionRaw, 'version');
44
+ const updatedAt = ownDataField(revisionRaw, 'updatedAt');
46
45
  if (typeof version !== 'number' || !Number.isFinite(version) || !nonEmpty(updatedAt))
47
46
  return undefined;
48
47
  effectiveRevision = { version, updatedAt };
@@ -58,7 +57,7 @@ function projectCenterWiringOf(caps) {
58
57
  if (callerSeat.state === 'value') {
59
58
  if (!isPlainObject(callerSeat.value))
60
59
  return undefined;
61
- const callerLease = callerSeat.value.lease;
60
+ const callerLease = ownDataField(callerSeat.value, 'lease');
62
61
  if (!nonEmpty(callerLease))
63
62
  return undefined;
64
63
  const wait = optionalSeat(callerSeat.value, 'retryAfterSec');
@@ -66,6 +65,9 @@ function projectCenterWiringOf(caps) {
66
65
  return undefined;
67
66
  caller = { lease: callerLease, ...(wait.state === 'value' ? { retryAfterSec: wait.value } : {}) };
68
67
  }
68
+ const workerSeat = optionalSeat(cw, 'worker');
69
+ if (workerSeat.state === 'value' && !nonEmpty(workerSeat.value))
70
+ return undefined;
69
71
  return {
70
72
  kind: 'present',
71
73
  view: {
@@ -77,6 +79,7 @@ function projectCenterWiringOf(caps) {
77
79
  usageReport,
78
80
  issuer,
79
81
  ...(caller !== undefined ? { caller } : {}),
82
+ ...(workerSeat.state === 'value' ? { worker: workerSeat.value } : {}),
80
83
  },
81
84
  };
82
85
  }
@@ -85,9 +88,6 @@ const reader = createEngineCapReader({
85
88
  project: projectCenterWiringCapability,
86
89
  makeUnobserved: () => ({ kind: 'unobserved' }),
87
90
  });
88
- export function noteEngineCapsForCenterWiring(baseUrl, caps, opts) {
89
- reader.note(baseUrl, caps, opts);
90
- }
91
91
  export function observedCenterWiring(baseUrl = engineWireTarget()?.baseUrl) {
92
92
  return reader.observed(baseUrl);
93
93
  }
@@ -96,7 +96,7 @@ function guarded(reading) {
96
96
  return undefined;
97
97
  try {
98
98
  const kind = reading.kind;
99
- if (kind === 'not_reported' || kind === 'unobserved' || kind === 'none')
99
+ if (kind === 'unobserved' || kind === 'none')
100
100
  return { kind };
101
101
  if (kind !== 'present')
102
102
  return undefined;
@@ -158,9 +158,6 @@ function failModeClause(v) {
158
158
  export function centerWiringDoctorDetail(reading) {
159
159
  const unobserved = 'center wiring not observed — the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it, so whether this engine is connected to a configuration center is unknown';
160
160
  const r = guarded(reading);
161
- if (r?.kind === 'not_reported') {
162
- return 'center wiring not reported by this engine; this does not say whether the engine is connected to a configuration center';
163
- }
164
161
  if (r?.kind === 'none') {
165
162
  return 'no configuration center on this deployment — the engine runs on its own local configuration; no quota lease or usage reporting goes through a center';
166
163
  }
@@ -194,9 +191,3 @@ export function centerWiringDoctorDetail(reading) {
194
191
  return unobserved;
195
192
  }
196
193
  }
197
- export function forgetCenterWiringReading(baseUrl) {
198
- reader.forget(baseUrl);
199
- }
200
- export function __resetCenterWiringReadingsForTests() {
201
- reader.__resetForTests();
202
- }
@@ -1,4 +1,5 @@
1
1
  import { classifierDenyCauseOf } from './autoModeUnavailable.js';
2
+ import { readAskOrigin } from './ownKey.js';
2
3
  export const CLASSIFIER_STATUS_STATES = Object.freeze([
3
4
  'armed',
4
5
  'available',
@@ -8,14 +9,13 @@ const CLASSIFIER_RAN_ORIGINS = new Set(['denial_limit_fallback']);
8
9
  function askOriginOf(ask) {
9
10
  if (typeof ask !== 'object' || ask === null || Array.isArray(ask))
10
11
  return undefined;
11
- const top = ask.origin;
12
- if (typeof top === 'string' && top.length > 0)
12
+ const top = readAskOrigin(ask);
13
+ if (top !== undefined)
13
14
  return top;
14
15
  const gate = ask.gate;
15
16
  if (typeof gate !== 'object' || gate === null || Array.isArray(gate))
16
17
  return undefined;
17
- const inner = gate.origin;
18
- return typeof inner === 'string' && inner.length > 0 ? inner : undefined;
18
+ return readAskOrigin(gate);
19
19
  }
20
20
  const NOT_A_ROUND_FAILURE = new Set(['parse_error']);
21
21
  export function classifierStatusOf(autoMode, ask) {
@@ -1,21 +1,7 @@
1
1
  import { unwrapSystemReminder } from './systemReminderTag.js';
2
+ import { toolEndOutputText } from './toolResultContent.js';
2
3
  export const CLASSIFIER_DENY_SIGNATURE = 'auto-mode classifier blocked this call';
3
4
  const NOTICE_REASON_MAX = 80;
4
- function textFromWireOutput(output) {
5
- if (typeof output === 'string')
6
- return output;
7
- const blocks = Array.isArray(output)
8
- ? output
9
- : output !== null && typeof output === 'object' && Array.isArray(output.content)
10
- ? (output.content)
11
- : undefined;
12
- if (!blocks)
13
- return undefined;
14
- const texts = blocks
15
- .map(b => (b !== null && typeof b === 'object' && typeof b.text === 'string' ? b.text : undefined))
16
- .filter((t) => t !== undefined);
17
- return texts.length > 0 ? texts.join('\n') : undefined;
18
- }
19
5
  const CLASSIFIER_DENY_FORMS = [
20
6
  'auto-mode classifier blocked the approved edit at an inherited ancestor layer',
21
7
  'auto-mode classifier blocked this call at an inherited ancestor layer',
@@ -24,7 +10,9 @@ const CLASSIFIER_DENY_FORMS = [
24
10
  export function classifierDenyFromToolEnd(ev) {
25
11
  if (!ev || ev.type !== 'tool_end' || ev.isError !== true)
26
12
  return undefined;
27
- const raw = textFromWireOutput(ev.output);
13
+ if (Array.isArray(ev.output) && ev.output.length !== 1)
14
+ return undefined;
15
+ const raw = toolEndOutputText(ev.output);
28
16
  if (raw === undefined)
29
17
  return undefined;
30
18
  const message = unwrapSystemReminder(raw).trim();
@@ -14,4 +14,4 @@ export const CLIENT_VERBS = [
14
14
  { verb: 'probeHealth', required: false, duty: '健康探测' },
15
15
  ];
16
16
  export const PROBE_HEALTH_DIVERGENCE = 'probeHealth: SDK 要求 status==="ok",壳侧 limitsWire:225 / detachWire:82 手拼只要 res.ok。' +
17
- 'B4 保旧行为(res.ok),差异候裁 —— 换成 SDK 语义会让"自报 degraded 但可用"的引擎少发 detach 头。';
17
+ 'B4 保旧行为(res.ok),差异待定 —— 换成 SDK 语义会让"自报 degraded 但可用"的引擎少发 detach 头。';
@@ -4,7 +4,7 @@ import type { EnvLike } from './hostEnv.js';
4
4
  export type { McpServerSpec };
5
5
  type Rec = Record<string, unknown>;
6
6
  export type { EnvLike };
7
- export type CloudMcpDropReason = 'disabled' | 'missing-field' | 'unknown-transport' | 'capped';
7
+ export type CloudMcpDropReason = 'disabled' | 'missing-field' | 'unknown-transport' | 'capped' | 'principal-and-assertion-header';
8
8
  export interface CloudMcpDroppedServer {
9
9
  name?: string;
10
10
  reason: CloudMcpDropReason;
@@ -17,10 +17,10 @@ export interface CloudMcpProjection {
17
17
  export declare function cloudMcpToSpecs(servers: unknown, env: EnvLike): CloudMcpProjection;
18
18
  export declare function cloudSkillsToSpecs(manifestSkills: unknown, resolveBody: (contentHash: string) => string | null): SkillSpec[];
19
19
  export interface CloudModelRefIssue {
20
- readonly key: 'models' | 'default' | 'roles' | 'atModelAllowlist' | 'tierGroups' | 'activeTierGroup';
20
+ readonly key: 'models' | 'roles' | 'atMention' | 'tierGroups' | 'activeTierGroup';
21
21
  readonly at?: string;
22
22
  readonly target?: string;
23
- readonly reason: 'dangling' | 'rejected' | 'unreadable' | 'unsupported' | 'duplicate';
23
+ readonly reason: 'dangling' | 'rejected' | 'unreadable' | 'unsupported' | 'duplicate' | 'shadowed';
24
24
  readonly outcome: 'dropped' | 'kept';
25
25
  }
26
26
  export interface CloudModelsDocOptions {
@@ -1,6 +1,8 @@
1
1
  import { MCP_CAPS } from './mcpWireCaps.js';
2
2
  import { toCappedSpec } from './skillsWireCaps.js';
3
3
  import { TIER_ORDER } from './model/tierVocabulary.js';
4
+ import { SETTINGS_NARROW_AT_MENTION } from './generated/settingsSchemaFns.js';
5
+ import { modelsPolicyOf } from './model/modelsPolicy.js';
4
6
  import { SETTINGS_BUDGET_NUMBER_KEYS, SETTINGS_BUDGET_PER_MODEL_NUMBER_KEYS, SETTINGS_BUDGET_STRING_KEYS, SETTINGS_TIER_GROUP_NAME_RE, } from './generated/settingsSchemaTables.js';
5
7
  const asRec = (v) => (typeof v === 'object' && v !== null && !Array.isArray(v) ? v : undefined);
6
8
  const asArr = (v) => (Array.isArray(v) ? v : []);
@@ -60,6 +62,10 @@ export function cloudMcpToSpecs(servers, env) {
60
62
  drop(name, 'missing-field');
61
63
  continue;
62
64
  }
65
+ if (asStr(t.principalHeader) && asStr(t.assertionHeader)) {
66
+ drop(name, 'principal-and-assertion-header');
67
+ continue;
68
+ }
63
69
  const headers = {};
64
70
  for (const [headerName, ref] of Object.entries(asRec(t.headerRefs) ?? {})) {
65
71
  const refName = asStr(ref);
@@ -164,8 +170,10 @@ function modelsDocOf(models, opts) {
164
170
  const refOf = (v) => (typeof v === 'string' && v !== '' ? { target: v } : {});
165
171
  const reasonOf = (v) => typeof v === 'string' && v !== '' ? (rawNames.has(v) ? 'rejected' : 'dangling') : 'unreadable';
166
172
  let written = stripped;
173
+ let catalogKept = false;
167
174
  if (acceptedFlags && stripped.length > 0) {
168
175
  const anyAccepted = acceptedFlags.some((f) => f);
176
+ catalogKept = !anyAccepted;
169
177
  stripped.forEach((e, i) => {
170
178
  if (!acceptedFlags[i])
171
179
  issues.push({ key: 'models', target: e.name, reason: 'rejected', outcome: anyAccepted ? 'dropped' : 'kept' });
@@ -174,40 +182,81 @@ function modelsDocOf(models, opts) {
174
182
  written = stripped.filter((_, i) => acceptedFlags[i]);
175
183
  }
176
184
  const doc = { models: written };
177
- if (accept && Object.hasOwn(m, 'default')) {
178
- const d = m.default;
179
- if (typeof d === 'string' && names.has(d))
180
- doc.default = d;
185
+ const policy = modelsPolicyOf(m);
186
+ if (policy.unreadable) {
187
+ drop({ key: 'roles', at: 'default', reason: 'unreadable' });
188
+ drop({ key: 'atMention', at: 'models', reason: 'unreadable' });
189
+ }
190
+ if (policy.defaultUnreadable)
191
+ drop({ key: 'roles', at: 'default', reason: 'unreadable' });
192
+ const dm = policy.defaultModel;
193
+ let defaultRole;
194
+ if (accept && dm !== undefined && dm.from === 'default') {
195
+ if (names.has(dm.name))
196
+ defaultRole = { model: dm.name };
181
197
  else
182
- drop({ key: 'default', ...refOf(d), reason: reasonOf(d) });
198
+ drop({ key: 'roles', at: 'default', target: dm.name, reason: reasonOf(dm.name) });
183
199
  }
184
200
  const roles = asRec(m.roles);
185
- if (roles) {
186
- const kept = {};
187
- for (const [role, t] of Object.entries(roles)) {
188
- const tr = asRec(t);
189
- const model = tr && Object.hasOwn(tr, 'model') ? tr.model : undefined;
190
- if (typeof model === 'string' && !names.has(model)) {
191
- drop({ key: 'roles', at: role, ...refOf(model), reason: reasonOf(model) });
192
- continue;
201
+ const keptRoles = {};
202
+ for (const [role, t] of Object.entries(roles ?? {})) {
203
+ if (role === 'default' && defaultRole !== undefined) {
204
+ let same = false;
205
+ try {
206
+ same = JSON.stringify(t) === JSON.stringify(defaultRole);
207
+ }
208
+ catch {
209
+ same = false;
193
210
  }
194
- setOwn(kept, role, t);
211
+ if (!same) {
212
+ const tr = asRec(t);
213
+ const model = tr && Object.hasOwn(tr, 'model') ? tr.model : undefined;
214
+ drop({ key: 'roles', at: 'default', ...refOf(model), reason: 'shadowed' });
215
+ }
216
+ continue;
217
+ }
218
+ const tr = asRec(t);
219
+ const model = tr && Object.hasOwn(tr, 'model') ? tr.model : undefined;
220
+ if (typeof model === 'string' && !names.has(model)) {
221
+ drop({ key: 'roles', at: role, ...refOf(model), reason: reasonOf(model) });
222
+ continue;
195
223
  }
196
- doc.roles = kept;
224
+ setOwn(keptRoles, role, t);
197
225
  }
198
- if (Array.isArray(m.atModelAllowlist)) {
199
- const src = m.atModelAllowlist;
200
- const keep = src.filter((n) => typeof n === 'string' && names.has(n));
201
- if (keep.length === 0 && src.length > 0) {
202
- doc.atModelAllowlist = src;
203
- for (const n of src)
204
- issues.push({ key: 'atModelAllowlist', ...refOf(n), reason: reasonOf(n), outcome: 'kept' });
226
+ const rolesOut = {};
227
+ if (defaultRole !== undefined)
228
+ setOwn(rolesOut, 'default', defaultRole);
229
+ else if (Object.hasOwn(keptRoles, 'default'))
230
+ setOwn(rolesOut, 'default', keptRoles.default);
231
+ for (const [k, v] of Object.entries(keptRoles))
232
+ if (k !== 'default')
233
+ setOwn(rolesOut, k, v);
234
+ if (Object.keys(rolesOut).length > 0)
235
+ doc.roles = rolesOut;
236
+ const am = policy.atMention;
237
+ if (am?.kind === 'unreadable') {
238
+ drop({ key: 'atMention', at: am.from, reason: 'unreadable' });
239
+ }
240
+ else if (am !== undefined) {
241
+ for (let i = 0; i < am.unreadableEntries; i += 1)
242
+ drop({ key: 'atMention', reason: 'unreadable' });
243
+ const v = am.value;
244
+ if (v.mode === 'only') {
245
+ for (const n of v.models)
246
+ if (!names.has(n))
247
+ drop({ key: 'atMention', target: n, reason: reasonOf(n) });
248
+ const narrowed = SETTINGS_NARROW_AT_MENTION(v, names);
249
+ if (narrowed.mode === 'only') {
250
+ doc.atMention = { mode: 'only', models: [...narrowed.models] };
251
+ }
252
+ else {
253
+ doc.atMention = { mode: narrowed.mode };
254
+ if (narrowed.mode === 'none' && !catalogKept)
255
+ drop({ key: 'atMention', at: 'atMention', reason: 'dangling' });
256
+ }
205
257
  }
206
- else {
207
- for (const n of src)
208
- if (!(typeof n === 'string' && names.has(n)))
209
- drop({ key: 'atModelAllowlist', ...refOf(n), reason: reasonOf(n) });
210
- doc.atModelAllowlist = keep;
258
+ else if (v.mode === 'none') {
259
+ doc.atMention = { mode: 'none' };
211
260
  }
212
261
  }
213
262
  let groupNames;
@@ -494,8 +543,6 @@ const ENTRY_REJECTED = `is in the catalog, but its entry is one the local engine
494
543
  function warningNotice(w) {
495
544
  const where = quoted(w.domain, 'the configuration');
496
545
  switch (w.kind) {
497
- case 'hosts-grandfathered':
498
- return { level: 'warn', text: `cloud config warning: host entries exceeding the current limits were skipped by the registry${listOf(w.droppedNames, w.truncatedFrom)}` };
499
546
  case 'domain-defaulted':
500
547
  return { level: 'warn', text: `cloud config warning: ${where} could not be read by the registry and were served as defaults — what is configured there is not in effect` };
501
548
  case 'entry-dropped':
@@ -504,8 +551,6 @@ function warningNotice(w) {
504
551
  return { level: 'warn', text: `cloud config warning: the registry dropped unrecognised keys from ${where}${listOf(w.keys, w.truncatedFrom)}` };
505
552
  case 'unknown-keys-carried':
506
553
  return { level: 'warn', text: `cloud config warning: ${where} carry keys the registry does not recognise, passed on as written (check the spelling)${listOf(w.keys, w.truncatedFrom)}` };
507
- case 'legacy-governance-lifted':
508
- return { level: 'info', text: `cloud config note: ${where} were taken from their older location${listOf(w.keys, undefined)}` };
509
554
  case 'unread-config-file':
510
555
  return { level: 'warn', text: `cloud config warning: a configuration file was not read by the registry${w.file === undefined ? '' : ` (${w.file}${w.why === undefined ? '' : `: ${w.why}`})`}` };
511
556
  default:
@@ -518,11 +563,17 @@ function droppedRefNotice(d) {
518
563
  switch (d.key) {
519
564
  case 'models':
520
565
  return { level: 'warn', text: `cloud config: ${t === undefined ? 'a model entry' : `model "${t}"`} ${ENTRY_REJECTED} — it was left out of the local catalog` };
521
- case 'default':
522
- return { level: 'warn', text: `cloud config: ${t === undefined ? 'the default model setting could not be read' : `the default model "${t}" ${notServed}`}, so it was left out — the local engine picks its default from roles and tiers instead` };
523
566
  case 'roles':
567
+ if (d.at === 'default' && d.reason === 'unreadable')
568
+ return { level: 'warn', text: 'cloud config: the default model setting could not be read, so it was left out — the local engine picks its default from roles and tiers instead' };
569
+ if (d.reason === 'shadowed')
570
+ return { level: 'warn', text: `cloud config: the "${d.at ?? ''}" role${t === undefined ? '' : ` ("${t}")`} is overridden by the default model setting served to you — only one default model can be set, so that role entry was left out` };
524
571
  return { level: 'warn', text: `cloud config: role "${d.at ?? ''}" ${t === undefined ? 'names no readable model' : `points at model "${t}", which ${notServed}`} — the role was left out and falls back along the engine's role chain` };
525
- case 'atModelAllowlist':
572
+ case 'atMention':
573
+ if (d.at === 'atMention' && d.reason === 'dangling')
574
+ return { level: 'warn', text: 'cloud config: none of the models in the @-mention allowlist served to you can be used on the local engine, so @-mentions are turned off there' };
575
+ if (d.at !== undefined)
576
+ return { level: 'warn', text: 'cloud config: the @-mention setting served to you could not be read by this client — it was left out, so @-mentions are not restricted on the local engine' };
526
577
  return { level: 'warn', text: `cloud config: ${t === undefined ? 'an unreadable @-mention allowlist entry' : `@-mention allowlist entry "${t}" ${notServed} and`} was left out` };
527
578
  case 'tierGroups':
528
579
  if (d.reason === 'duplicate')
@@ -603,15 +654,6 @@ export function cloudEffectiveNotices(p) {
603
654
  'the catalog is kept as sent, and a locally started engine rejects the cloud model settings: at startup it uses its own environment catalog instead, and on a later refresh it keeps the previous configuration',
604
655
  });
605
656
  }
606
- const keptAllowlist = p.modelRefIssues.filter((d) => d.outcome === 'kept' && d.key === 'atModelAllowlist');
607
- if (keptAllowlist.length > 0) {
608
- const names = keptAllowlist.flatMap((d) => (d.target === undefined ? [] : [`"${d.target}"`]));
609
- out.push({
610
- level: 'warn',
611
- text: `cloud config: no @-mention allowlist entry${names.length > 0 ? ` (${names.join(', ')})` : ''} names a usable model in the catalog served to you — ` +
612
- 'the list is kept as sent, because an empty list would let every model be mentioned; with it, a locally started engine rejects the cloud model settings — at startup it uses its own environment catalog instead, and on a later refresh it keeps the previous configuration',
613
- });
614
- }
615
657
  out.push(budgetNotice(p.budget));
616
658
  out.push(runtimeCapsNotice(p.runtimeCaps));
617
659
  return out;
@@ -93,7 +93,7 @@ export const MIGRATED_COMPENSATIONS = [
93
93
  'adapt.ts importLedgerFromTranscript(消费口)',
94
94
  chromeArm: null,
95
95
  hostHalf: null,
96
- retireOn: 'RL-37',
96
+ retireOn: null,
97
97
  },
98
98
  {
99
99
  id: 'T25',
@@ -91,17 +91,21 @@ export interface PerModelAuthView {
91
91
  apiKey?: string;
92
92
  headers?: Record<string, string>;
93
93
  }
94
+ export type RuleGrammarView = 'command' | 'domain' | 'name' | 'path';
95
+ export interface RuleToolNameVerdictView {
96
+ readonly kind: 'current' | 'retired' | 'unprefixed_namespace' | 'unmintable_segment' | (string & {});
97
+ readonly guidance?: string;
98
+ readonly currentName?: string;
99
+ }
94
100
  export interface CoreValuePorts {
95
101
  resolveAutonomousLoopPrompt: (prompt: string, opts?: AutonomousLoopPromptOptionsView) => string | null;
96
102
  loosenReasons: (prior: SessionPermissionRules, next: SessionPermissionRules) => string[];
97
103
  combinePolicies: (...policies: CoreToolPolicyHandle[]) => CoreToolPolicyHandle;
98
104
  createAllowDenyPolicy: (opts: AllowDenyPolicyOptionsView) => CoreToolPolicyHandle;
99
105
  MCP_NAMESPACE: CoreProtocolNamespaceView;
100
- RETIRED_TOOL_NAMES: ReadonlyMap<string, string>;
101
106
  protocolOf: (name: string) => CoreProtocolNamespaceView | undefined;
102
- ruleToolGrammarOf: (toolName: string) => 'command' | 'path' | undefined;
107
+ ruleToolGrammarOf: (toolName: string) => RuleGrammarView | undefined;
103
108
  validatePermissionRules: (rules: PermissionRuleView[], opts?: ValidatePermissionRulesOptionsView) => PermissionRuleIssueView[];
104
- DISCUSSION_WORKFLOW_NAME: string;
105
109
  mintNamespacePrefix(ns: CoreProtocolNamespaceView, peer: string): string;
106
110
  compileAllowList(entries: readonly string[], behavior: 'allow' | 'deny', roster?: ReadonlySet<string>): AllowListReadingView;
107
111
  routeKeyOf(url: string | undefined): string;
@@ -113,8 +117,9 @@ export interface CoreValuePorts {
113
117
  routePairingStatus(brain: {
114
118
  adjudicateRoute?(model: RouteModelView, perModelAuth?: PerModelAuthView): RouteAdjudicationView | undefined;
115
119
  }, model: RouteModelView, perModelAuth?: PerModelAuthView): RoutePairingStatusView;
120
+ judgeRuleToolName(name: string, roster: ReadonlySet<string>): RuleToolNameVerdictView;
116
121
  }
117
- export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "RETIRED_TOOL_NAMES", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "DISCUSSION_WORKFLOW_NAME", "mintNamespacePrefix", "compileAllowList", "routeKeyOf", "joinRequestUrl", "resolveRouteCredential", "adjudicateModelRoute", "routePairingStatus"];
122
+ export declare const CORE_VALUE_PORT_NAMES: readonly ["resolveAutonomousLoopPrompt", "loosenReasons", "combinePolicies", "createAllowDenyPolicy", "MCP_NAMESPACE", "protocolOf", "ruleToolGrammarOf", "validatePermissionRules", "mintNamespacePrefix", "compileAllowList", "routeKeyOf", "joinRequestUrl", "resolveRouteCredential", "adjudicateModelRoute", "routePairingStatus", "judgeRuleToolName"];
118
123
  export type CoreValuePortName = (typeof CORE_VALUE_PORT_NAMES)[number];
119
124
  export declare function installCoreValuePorts(ports: Partial<CoreValuePorts> | null): () => void;
120
125
  export declare function hasCoreValuePorts(): boolean;
@@ -125,13 +130,12 @@ export declare function loosenReasons(prior: SessionPermissionRules, next: Sessi
125
130
  export declare function combinePolicies(...policies: CoreToolPolicyHandle[]): CoreToolPolicyHandle | undefined;
126
131
  export declare function createAllowDenyPolicy(opts: AllowDenyPolicyOptionsView): CoreToolPolicyHandle | undefined;
127
132
  export declare function mcpNamespace(): CoreProtocolNamespaceView | undefined;
128
- export declare function retiredToolNames(): ReadonlyMap<string, string> | undefined;
129
133
  export declare function protocolOf(name: string): CoreProtocolNamespaceView | undefined;
130
- export declare function ruleToolGrammarOf(toolName: string): 'command' | 'path' | undefined;
134
+ export declare function ruleToolGrammarOf(toolName: string): RuleGrammarView | undefined;
131
135
  export declare function validatePermissionRules(rules: PermissionRuleView[], opts?: ValidatePermissionRulesOptionsView): PermissionRuleIssueView[] | undefined;
132
- export declare function discussionWorkflowName(): string | undefined;
133
136
  export declare function mintNamespacePrefix(ns: CoreProtocolNamespaceView, peer: string): string | undefined;
134
137
  export declare function compileAllowList(entries: readonly string[], behavior: 'allow' | 'deny', roster?: ReadonlySet<string>): AllowListReadingView | undefined;
138
+ export declare function ruleToolNameJudgement(name: string, roster: ReadonlySet<string>): RuleToolNameVerdictView | undefined;
135
139
  export declare function routeKeyOf(url: string | undefined): string | undefined;
136
140
  export declare function joinRequestUrl(root: string | undefined, suffix: string): string | undefined;
137
141
  export declare function resolveRouteCredential(input: RouteCredentialInputView): RouteCredentialView | undefined;
@@ -4,11 +4,9 @@ export const CORE_VALUE_PORT_NAMES = Object.freeze([
4
4
  'combinePolicies',
5
5
  'createAllowDenyPolicy',
6
6
  'MCP_NAMESPACE',
7
- 'RETIRED_TOOL_NAMES',
8
7
  'protocolOf',
9
8
  'ruleToolGrammarOf',
10
9
  'validatePermissionRules',
11
- 'DISCUSSION_WORKFLOW_NAME',
12
10
  'mintNamespacePrefix',
13
11
  'compileAllowList',
14
12
  'routeKeyOf',
@@ -16,6 +14,7 @@ export const CORE_VALUE_PORT_NAMES = Object.freeze([
16
14
  'resolveRouteCredential',
17
15
  'adjudicateModelRoute',
18
16
  'routePairingStatus',
17
+ 'judgeRuleToolName',
19
18
  ]);
20
19
  let installed = null;
21
20
  export function installCoreValuePorts(ports) {
@@ -56,9 +55,6 @@ export function createAllowDenyPolicy(opts) {
56
55
  export function mcpNamespace() {
57
56
  return port('MCP_NAMESPACE');
58
57
  }
59
- export function retiredToolNames() {
60
- return port('RETIRED_TOOL_NAMES');
61
- }
62
58
  export function protocolOf(name) {
63
59
  const fn = port('protocolOf');
64
60
  return fn === undefined ? undefined : fn(name);
@@ -71,9 +67,6 @@ export function validatePermissionRules(rules, opts) {
71
67
  const fn = port('validatePermissionRules');
72
68
  return fn === undefined ? undefined : fn(rules, opts);
73
69
  }
74
- export function discussionWorkflowName() {
75
- return port('DISCUSSION_WORKFLOW_NAME');
76
- }
77
70
  export function mintNamespacePrefix(ns, peer) {
78
71
  const fn = port('mintNamespacePrefix');
79
72
  return fn === undefined ? undefined : fn(ns, peer);
@@ -82,6 +75,10 @@ export function compileAllowList(entries, behavior, roster) {
82
75
  const fn = port('compileAllowList');
83
76
  return fn === undefined ? undefined : fn(entries, behavior, roster);
84
77
  }
78
+ export function ruleToolNameJudgement(name, roster) {
79
+ const fn = port('judgeRuleToolName');
80
+ return fn === undefined ? undefined : fn(name, roster);
81
+ }
85
82
  export function routeKeyOf(url) {
86
83
  const fn = port('routeKeyOf');
87
84
  return fn === undefined ? undefined : fn(url);
@@ -0,0 +1,28 @@
1
+ export declare const CREDENTIAL_ATTACH_WORDS: readonly ["local-sidecar", "service-token", "registry", "none"];
2
+ export type CredentialAttachWord = (typeof CREDENTIAL_ATTACH_WORDS)[number];
3
+ declare const TARGET_KIND_WORDS: readonly ["local-managed", "loopback-pin", "remote", "unresolved"];
4
+ declare const TARGET_PROVENANCE_WORDS: readonly ["managed", "connect-pin", "manual", "none"];
5
+ declare const CONSENT_WORDS: readonly ["granted", "absent", "n/a"];
6
+ declare const SIDECAR_OWNERSHIP_WORDS: readonly ["verified", "mismatch"];
7
+ export type CredentialTargetKind = (typeof TARGET_KIND_WORDS)[number];
8
+ export type CredentialTargetProvenance = (typeof TARGET_PROVENANCE_WORDS)[number];
9
+ export type CredentialConsent = (typeof CONSENT_WORDS)[number];
10
+ export type CredentialSidecarOwnership = (typeof SIDECAR_OWNERSHIP_WORDS)[number];
11
+ export interface CredentialFacts {
12
+ readonly kind: CredentialTargetKind;
13
+ readonly provenance?: CredentialTargetProvenance;
14
+ readonly sidecarOwnership?: CredentialSidecarOwnership;
15
+ readonly serviceTokenAtFirstWrite?: boolean;
16
+ readonly loggedIn?: boolean;
17
+ readonly consent?: CredentialConsent;
18
+ }
19
+ export type CredentialFactName = 'facts' | 'kind' | 'sidecarOwnership' | 'serviceTokenAtFirstWrite' | 'loggedIn' | 'provenance' | 'consent';
20
+ export type CredentialProvenance = {
21
+ readonly kind: 'word';
22
+ readonly word: CredentialAttachWord;
23
+ } | {
24
+ readonly kind: 'unreadable';
25
+ readonly reason: CredentialFactName;
26
+ };
27
+ export declare function credentialProvenance(facts: CredentialFacts): CredentialProvenance;
28
+ export {};