@sema-agent/client-core 0.95.0 → 0.97.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 (233) hide show
  1. package/CHANGELOG.md +269 -0
  2. package/README.md +61 -31
  3. package/dist/adapt/arms.js +7 -1
  4. package/dist/adapt/toolCards.d.ts +1 -0
  5. package/dist/adapt/toolCards.js +16 -3
  6. package/dist/adapt/wireShapes.js +2 -16
  7. package/dist/adapter/activeRunSelfHeal.d.ts +4 -2
  8. package/dist/adapter/activeRunSelfHeal.js +32 -6
  9. package/dist/adapter/downstream/eventToSdkMessage.js +11 -3
  10. package/dist/adapter/downstream/terminalToSdkResult.js +14 -11
  11. package/dist/adapter/runStream.js +30 -47
  12. package/dist/agentSession/backgroundView.js +2 -15
  13. package/dist/agentSession/engineAgentRegistryRead.js +5 -4
  14. package/dist/agentSession/engineSessionBackgroundStop.js +22 -15
  15. package/dist/agentsWireCaps.d.ts +1 -1
  16. package/dist/agentsWireCaps.js +29 -12
  17. package/dist/approvalDecidedByCapability.d.ts +2 -0
  18. package/dist/approvalDecidedByCapability.js +0 -1
  19. package/dist/approvalsStreamLiveCapability.d.ts +2 -0
  20. package/dist/approvalsStreamLiveCapability.js +3 -2
  21. package/dist/attachmentSeatCapability.d.ts +2 -0
  22. package/dist/attachmentSeatCapability.js +0 -1
  23. package/dist/callerCwdCapability.d.ts +2 -4
  24. package/dist/callerCwdCapability.js +0 -7
  25. package/dist/centerWiringCapability.d.ts +2 -4
  26. package/dist/centerWiringCapability.js +4 -9
  27. package/dist/classifierVerdictWire.js +4 -16
  28. package/dist/clientSlice.js +1 -1
  29. package/dist/cloudConfigWireCaps.d.ts +4 -4
  30. package/dist/cloudConfigWireCaps.js +241 -85
  31. package/dist/coreValuePorts.d.ts +11 -7
  32. package/dist/coreValuePorts.js +5 -8
  33. package/dist/credentialProvenance.d.ts +28 -0
  34. package/dist/credentialProvenance.js +76 -0
  35. package/dist/decideFailureNote.js +3 -1
  36. package/dist/decideReceipt.js +7 -10
  37. package/dist/declared/supportFloorDeclared.js +3 -3
  38. package/dist/deviceExecutorManagementCapability.d.ts +2 -0
  39. package/dist/deviceExecutorManagementCapability.js +3 -2
  40. package/dist/displayUntrusted.d.ts +10 -3
  41. package/dist/displayUntrusted.js +371 -60
  42. package/dist/engineCapReader.d.ts +8 -2
  43. package/dist/engineCapReader.js +15 -7
  44. package/dist/engineCapsCache.d.ts +17 -3
  45. package/dist/engineCapsCache.js +268 -43
  46. package/dist/engineDirectory.d.ts +79 -0
  47. package/dist/engineDirectory.js +186 -0
  48. package/dist/engineErrorCodes.d.ts +17 -1
  49. package/dist/engineErrorCodes.js +46 -16
  50. package/dist/engineNoticeCodes.d.ts +17 -0
  51. package/dist/engineNoticeCodes.js +54 -1
  52. package/dist/executionLaneCapability.d.ts +2 -0
  53. package/dist/executionLaneCapability.js +3 -2
  54. package/dist/fileHistoryCaptureCapability.d.ts +16 -0
  55. package/dist/fileHistoryCaptureCapability.js +98 -2
  56. package/dist/fileHistoryLegNotice.js +4 -0
  57. package/dist/fleet/bgSubagentRow.d.ts +15 -0
  58. package/dist/fleet/bgSubagentRow.js +67 -0
  59. package/dist/fleet/fleetLedger.d.ts +1 -0
  60. package/dist/fleet/fleetLedger.js +164 -126
  61. package/dist/fleet/fleetProjection.d.ts +1 -0
  62. package/dist/fleet/fleetProjection.js +10 -3
  63. package/dist/fleetTaskDesc.js +4 -17
  64. package/dist/gateOutcome.d.ts +12 -1
  65. package/dist/gateOutcome.js +56 -1
  66. package/dist/gateVocabulary.d.ts +2 -2
  67. package/dist/gateVocabulary.js +4 -3
  68. package/dist/generated/engineAskFaceTables.js +1 -1
  69. package/dist/generated/engineFactTables.d.ts +5 -3
  70. package/dist/generated/engineFactTables.js +17 -4
  71. package/dist/generated/engineNoticeTables.js +12 -3
  72. package/dist/generated/sdkFactTables.d.ts +2 -0
  73. package/dist/generated/sdkFactTables.js +7 -0
  74. package/dist/generated/settingsSchemaFns.d.ts +3 -0
  75. package/dist/generated/settingsSchemaFns.js +53 -0
  76. package/dist/generated/toolNameTables.d.ts +1 -1
  77. package/dist/generated/toolNameTables.js +1 -42
  78. package/dist/hitl/approvalDecisionNoteAudit.js +2 -2
  79. package/dist/hitl/approvalEndingCause.d.ts +2 -0
  80. package/dist/hitl/approvalEndingCause.js +26 -21
  81. package/dist/hitl/approvalHolds.d.ts +16 -1
  82. package/dist/hitl/approvalHolds.js +52 -12
  83. package/dist/hitl/askGateWire.js +1 -0
  84. package/dist/hitl/askParkRowRouting.js +1 -1
  85. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  86. package/dist/hitl/automaticAnswerVerdict.js +13 -10
  87. package/dist/hitl/decisionConflict.js +4 -5
  88. package/dist/hitl/decisionRefusal.d.ts +8 -0
  89. package/dist/hitl/decisionRefusal.js +55 -14
  90. package/dist/hitl/frameRouter.d.ts +3 -1
  91. package/dist/hitl/frameRouter.js +58 -39
  92. package/dist/hitl/gateLedger.d.ts +0 -5
  93. package/dist/hitl/gateLedger.js +0 -21
  94. package/dist/hitl/hitlBridge.d.ts +6 -2
  95. package/dist/hitl/hitlBridge.js +46 -11
  96. package/dist/hitl/localAllowRule.d.ts +1 -0
  97. package/dist/hitl/localAllowRule.js +2 -2
  98. package/dist/hitl/noAllowCause.d.ts +2 -1
  99. package/dist/hitl/noAllowCause.js +3 -2
  100. package/dist/hitl/parkResolver.d.ts +1 -0
  101. package/dist/hitl/parkResolver.js +14 -56
  102. package/dist/hitl/parkRowBirthWait.d.ts +1 -0
  103. package/dist/hitl/parkRowBirthWait.js +2 -2
  104. package/dist/hitl/planReviewWire.d.ts +1 -0
  105. package/dist/hitl/planReviewWire.js +98 -20
  106. package/dist/hitl/replayedApproval.d.ts +3 -3
  107. package/dist/hitl/replayedApproval.js +21 -16
  108. package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
  109. package/dist/hitl/sessionPolicyDeliverable.js +17 -17
  110. package/dist/hitl/sessionPolicyWire.d.ts +2 -0
  111. package/dist/hitl/sessionPolicyWire.js +15 -3
  112. package/dist/hitl/standingRows.d.ts +19 -0
  113. package/dist/hitl/standingRows.js +148 -0
  114. package/dist/hitl/suspendedReopen.js +2 -1
  115. package/dist/hitl/toolApprovalWire.d.ts +22 -10
  116. package/dist/hitl/toolApprovalWire.js +286 -47
  117. package/dist/hookMatcherVerdict.d.ts +1 -9
  118. package/dist/hookMatcherVerdict.js +21 -61
  119. package/dist/hooksWireCaps.js +2 -2
  120. package/dist/hostCallbackGuard.d.ts +1 -0
  121. package/dist/hostCallbackGuard.js +6 -0
  122. package/dist/index.d.ts +26 -12
  123. package/dist/index.js +20 -10
  124. package/dist/liveModelCatalog.d.ts +13 -0
  125. package/dist/liveModelCatalog.js +56 -0
  126. package/dist/mcpProbeCapability.d.ts +2 -4
  127. package/dist/mcpProbeCapability.js +3 -8
  128. package/dist/mcpWireCaps.d.ts +1 -0
  129. package/dist/mcpWireCaps.js +4 -1
  130. package/dist/memoryComplianceCapability.d.ts +2 -4
  131. package/dist/memoryComplianceCapability.js +3 -8
  132. package/dist/memoryOriginCapability.d.ts +2 -4
  133. package/dist/memoryOriginCapability.js +3 -8
  134. package/dist/memorySpecWire.js +2 -2
  135. package/dist/modelIdentityResolvability.d.ts +2 -2
  136. package/dist/modelIdentityResolvability.js +14 -5
  137. package/dist/noticePresentation.d.ts +68 -0
  138. package/dist/noticePresentation.js +247 -0
  139. package/dist/outputStyleSeatCapability.d.ts +2 -1
  140. package/dist/outputStyleSeatCapability.js +0 -4
  141. package/dist/ownKey.d.ts +2 -0
  142. package/dist/ownKey.js +18 -0
  143. package/dist/peerFrames.js +13 -9
  144. package/dist/peerLaneCapability.d.ts +2 -0
  145. package/dist/peerLaneCapability.js +3 -2
  146. package/dist/permissionModesCapability.d.ts +2 -4
  147. package/dist/permissionModesCapability.js +0 -7
  148. package/dist/permissionRuleIssue.js +0 -3
  149. package/dist/permissionRulesWriteCapability.d.ts +2 -0
  150. package/dist/permissionRulesWriteCapability.js +3 -2
  151. package/dist/permissionsAllowGrantCapability.d.ts +2 -0
  152. package/dist/permissionsAllowGrantCapability.js +4 -2
  153. package/dist/permissionsDeclaration.d.ts +2 -0
  154. package/dist/permissionsDeclaration.js +72 -59
  155. package/dist/printPermissionOutcome.d.ts +12 -0
  156. package/dist/printPermissionOutcome.js +50 -0
  157. package/dist/printToolResultFrame.d.ts +1 -0
  158. package/dist/printToolResultFrame.js +5 -9
  159. package/dist/promptBlockedCopy.d.ts +5 -0
  160. package/dist/promptBlockedCopy.js +35 -0
  161. package/dist/protocolSegment.d.ts +9 -6
  162. package/dist/protocolSegment.js +31 -21
  163. package/dist/providerRejection.d.ts +4 -0
  164. package/dist/providerRejection.js +75 -14
  165. package/dist/replayBody.d.ts +12 -0
  166. package/dist/replayBody.js +25 -0
  167. package/dist/request/taskRequest.d.ts +1 -4
  168. package/dist/request/taskRequest.js +74 -19
  169. package/dist/resumeRefusalCopy.js +9 -25
  170. package/dist/retryStatus.d.ts +9 -1
  171. package/dist/retryStatus.js +9 -2
  172. package/dist/rewindArchiveCapability.d.ts +3 -13
  173. package/dist/rewindArchiveCapability.js +12 -58
  174. package/dist/rewindArchiveReading.d.ts +17 -0
  175. package/dist/rewindArchiveReading.js +55 -0
  176. package/dist/ruleCompileVerdict.d.ts +9 -1
  177. package/dist/ruleCompileVerdict.js +29 -4
  178. package/dist/runTerminal.d.ts +48 -5
  179. package/dist/runTerminal.js +215 -12
  180. package/dist/sandboxWire.js +13 -0
  181. package/dist/sdkWireTransit.d.ts +2 -1
  182. package/dist/sdkWireTransit.js +1 -0
  183. package/dist/sealedKeyCapability.d.ts +2 -4
  184. package/dist/sealedKeyCapability.js +0 -7
  185. package/dist/seam.js +4 -2
  186. package/dist/seatContract.d.ts +76 -11
  187. package/dist/seatContract.js +222 -27
  188. package/dist/sessionPolicyCapability.d.ts +2 -0
  189. package/dist/sessionPolicyCapability.js +3 -2
  190. package/dist/sessionReadRedactionCapability.d.ts +2 -4
  191. package/dist/sessionReadRedactionCapability.js +0 -7
  192. package/dist/sessionSyncFileHistory.d.ts +4 -0
  193. package/dist/sessionSyncFileHistory.js +66 -0
  194. package/dist/sessionSyncFileHistoryCapability.d.ts +2 -1
  195. package/dist/sessionSyncFileHistoryCapability.js +3 -5
  196. package/dist/skillToolListsCapability.d.ts +2 -1
  197. package/dist/skillToolListsCapability.js +3 -5
  198. package/dist/sqlEngineCapability.d.ts +2 -0
  199. package/dist/sqlEngineCapability.js +4 -3
  200. package/dist/steerPriorityCapability.d.ts +2 -1
  201. package/dist/steerPriorityCapability.js +3 -5
  202. package/dist/storePostureCapability.d.ts +2 -4
  203. package/dist/storePostureCapability.js +4 -9
  204. package/dist/subagent/engineSubagentSteer.js +7 -5
  205. package/dist/subagentContentStore.js +4 -15
  206. package/dist/supportFloor.d.ts +1 -0
  207. package/dist/supportFloor.js +13 -9
  208. package/dist/systemReminderTag.d.ts +1 -0
  209. package/dist/systemReminderTag.js +8 -0
  210. package/dist/toolHistoryBadTurn.js +3 -2
  211. package/dist/toolHistoryMismatch.d.ts +0 -3
  212. package/dist/toolHistoryMismatch.js +3 -7
  213. package/dist/toolResult.d.ts +12 -1
  214. package/dist/toolResult.js +55 -1
  215. package/dist/toolResultContent.d.ts +2 -0
  216. package/dist/toolResultContent.js +63 -0
  217. package/dist/usageAnalytics.js +40 -16
  218. package/dist/userInvokedSkillsCapability.d.ts +2 -1
  219. package/dist/userInvokedSkillsCapability.js +3 -5
  220. package/dist/webSearchBackendCapability.d.ts +2 -0
  221. package/dist/webSearchBackendCapability.js +3 -2
  222. package/dist/wireErrorTriage.d.ts +2 -0
  223. package/dist/wireErrorTriage.js +91 -38
  224. package/dist/wireFailureShape.d.ts +20 -3
  225. package/dist/wireFailureShape.js +128 -72
  226. package/dist/workflowsJournalCapability.d.ts +2 -0
  227. package/dist/workflowsJournalCapability.js +3 -2
  228. package/dist/writeProtectionCapability.d.ts +2 -0
  229. package/dist/writeProtectionCapability.js +3 -2
  230. package/docs/INTEGRATION-CLIENTS.md +1784 -20
  231. package/package.json +5 -5
  232. package/dist/engineRefusedToolName.d.ts +0 -1
  233. package/dist/engineRefusedToolName.js +0 -8
@@ -68,7 +68,7 @@ export type ProjectAgentsResult = {
68
68
  warnings: string[];
69
69
  toolListFlaws?: readonly AgentToolListFlaw[];
70
70
  };
71
- export type AgentToolListFlawKind = 'retired' | 'unprefixed_namespace' | 'case_twin';
71
+ export type AgentToolListFlawKind = 'retired' | 'unprefixed_namespace' | 'unmintable_segment' | 'unjudged' | 'case_twin';
72
72
  export interface AgentToolListFlaw {
73
73
  readonly agent: string;
74
74
  readonly list: 'tools' | 'disallowedTools';
@@ -1,9 +1,10 @@
1
1
  import { hostEnv } from './hostEnv.js';
2
+ import { ownDataField } from './ownKey.js';
2
3
  import { makeEngineWireClient } from './engineWireSdk.js';
3
4
  import { frozenSet } from './frozenSet.js';
4
5
  import { settleWithinDeadline } from './abortableSleep.js';
5
- import { isEngineRefusedToolName } from './engineRefusedToolName.js';
6
- import { CORE_PROTOCOL_PREFIXES, CORE_RETIRED_TOOL_CURRENT_NAMES } from './generated/toolNameTables.js';
6
+ import { ruleToolNameVerdictOf } from './protocolSegment.js';
7
+ import { CORE_PROTOCOL_PREFIXES } from './generated/toolNameTables.js';
7
8
  import { rosterMountedNames } from './rosterMountedNames.js';
8
9
  import { capForDisplay } from './fleetTaskDesc.js';
9
10
  export const MAX_TASK_AGENTS = 32;
@@ -42,7 +43,6 @@ const SOURCE_RANK = {
42
43
  function sourceRank(source) {
43
44
  return SOURCE_RANK[source] ?? 5;
44
45
  }
45
- const RETIRED_TABLE_CURRENT_NAMES = frozenSet([...CORE_RETIRED_TOOL_CURRENT_NAMES.values()].filter((v) => typeof v === 'string'));
46
46
  function unescapedIndexOf(s, ch, last) {
47
47
  for (let k = 0; k < s.length; k++) {
48
48
  const i = last ? s.length - 1 - k : k;
@@ -75,12 +75,15 @@ function toolNameFlawOf(entry, names, list) {
75
75
  if (name === undefined || name.length === 0 || name === '*' || names.has(name))
76
76
  return undefined;
77
77
  const named = name !== entry ? { toolName: name } : {};
78
- if (isEngineRefusedToolName(name)) {
79
- const current = CORE_RETIRED_TOOL_CURRENT_NAMES.get(name);
80
- if (current === undefined)
81
- return { kind: 'unprefixed_namespace', ...named };
82
- return typeof current === 'string' ? { kind: 'retired', currentName: current, ...named } : { kind: 'retired', ...named };
83
- }
78
+ const verdict = ruleToolNameVerdictOf(name);
79
+ if (verdict.kind === 'unknown')
80
+ return { kind: 'unjudged', ...named };
81
+ if (verdict.kind === 'unmintable_segment')
82
+ return { kind: 'unmintable_segment', ...named };
83
+ if (verdict.kind === 'unprefixed_namespace')
84
+ return { kind: 'unprefixed_namespace', ...named };
85
+ if (verdict.kind === 'retired')
86
+ return verdict.currentName !== undefined ? { kind: 'retired', currentName: verdict.currentName, ...named } : { kind: 'retired', ...named };
84
87
  if (CORE_PROTOCOL_PREFIXES.some((prefix) => name.startsWith(prefix)))
85
88
  return undefined;
86
89
  const folded = name.toLowerCase();
@@ -93,7 +96,7 @@ export function agentToolListFlaws(agents, roster) {
93
96
  if (!Array.isArray(agents) || agents.length === 0)
94
97
  return [];
95
98
  const mounted = rosterMountedNames(roster);
96
- const names = typeof mounted === 'object' ? mounted : RETIRED_TABLE_CURRENT_NAMES;
99
+ const names = typeof mounted === 'object' ? mounted : new Set();
97
100
  const out = [];
98
101
  for (const a of agents) {
99
102
  if (a === null || typeof a !== 'object' || typeof a.name !== 'string')
@@ -116,6 +119,10 @@ function toolListFlawPhrase(f) {
116
119
  return `${entry} is a retired tool name${f.currentName !== undefined ? ` (now ${JSON.stringify(f.currentName)})` : ' (no longer available under any name)'}`;
117
120
  if (f.kind === 'unprefixed_namespace')
118
121
  return `${entry} contains "__" but does not start with a tool protocol prefix`;
122
+ if (f.kind === 'unmintable_segment')
123
+ return `${entry} spells its server or agent peer part in a way the engine never uses when naming tools, so no tool answers to it`;
124
+ if (f.kind === 'unjudged')
125
+ return `${entry} could not be checked here, because the engine's tool-name check is not available in this client`;
119
126
  return `${entry} differs from the tool ${JSON.stringify(f.currentName ?? '')} only in letter case`;
120
127
  }
121
128
  export function projectAgentsForWire(defs, deps) {
@@ -289,7 +296,7 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
289
296
  if (typeof injected?.capabilities !== 'function')
290
297
  return undefined;
291
298
  const got = await settleWithinDeadline(opts.timeoutMs ?? 3000, (signal) => injected.capabilities({ signal }));
292
- return got.kind === 'value' ? got.value?.taskAgents === true : undefined;
299
+ return got.kind === 'value' ? taskAgentsOf(got.value) : undefined;
293
300
  }
294
301
  const client = makeEngineWireClient({
295
302
  baseUrl,
@@ -302,7 +309,17 @@ export async function engineSupportsTaskAgents(baseUrl, opts) {
302
309
  return undefined;
303
310
  try {
304
311
  const caps = await client.capabilities();
305
- return caps?.taskAgents === true;
312
+ return taskAgentsOf(caps);
313
+ }
314
+ catch {
315
+ return undefined;
316
+ }
317
+ }
318
+ function taskAgentsOf(caps) {
319
+ if (caps === null || typeof caps !== 'object')
320
+ return false;
321
+ try {
322
+ return ownDataField(caps, 'taskAgents') === true;
306
323
  }
307
324
  catch {
308
325
  return undefined;
@@ -1,5 +1,7 @@
1
1
  export type ApprovalDecidedByReading = {
2
2
  kind: 'unobserved';
3
+ } | {
4
+ kind: 'unreadable';
3
5
  } | {
4
6
  kind: 'not_reported';
5
7
  } | {
@@ -17,7 +17,6 @@ export function projectApprovalDecidedByCapability(caps) {
17
17
  const reader = createEngineCapReader({
18
18
  name: 'approvalDecidedBy',
19
19
  project: projectApprovalDecidedByCapability,
20
- makeUnobserved: () => ({ kind: 'unobserved' }),
21
20
  });
22
21
  export function noteEngineCapsForApprovalDecidedBy(baseUrl, caps, opts) {
23
22
  reader.note(baseUrl, caps, opts);
@@ -1,5 +1,7 @@
1
1
  export type ApprovalsStreamLiveReading = {
2
2
  kind: 'unobserved';
3
+ } | {
4
+ kind: 'unreadable';
3
5
  } | {
4
6
  kind: 'not_reported';
5
7
  } | {
@@ -1,5 +1,5 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
- import { createEngineCapReader } from './engineCapReader.js';
2
+ import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
3
  import { ownDataField } from './ownKey.js';
4
4
  export function projectApprovalsStreamLiveCapability(caps) {
5
5
  try {
@@ -21,7 +21,6 @@ export function projectApprovalsStreamLiveCapability(caps) {
21
21
  const reader = createEngineCapReader({
22
22
  name: 'approvalsStreamLive',
23
23
  project: projectApprovalsStreamLiveCapability,
24
- makeUnobserved: () => ({ kind: 'unobserved' }),
25
24
  });
26
25
  export function noteEngineCapsForApprovalsStreamLive(baseUrl, caps, opts) {
27
26
  reader.note(baseUrl, caps, opts);
@@ -34,6 +33,8 @@ export function livePendingNeedsReconcile(reading) {
34
33
  }
35
34
  export function approvalsStreamLiveDoctorDetail(reading) {
36
35
  switch (reading.kind) {
36
+ case 'unreadable':
37
+ return unreadableReadingDetail('live approval push');
37
38
  case 'unobserved':
38
39
  return 'live approval push not observed — the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which), so suspended asks are pulled by the reconcile cadence';
39
40
  case 'not_reported':
@@ -1,5 +1,7 @@
1
1
  export type AttachmentSeatReading = {
2
2
  readonly kind: 'unobserved';
3
+ } | {
4
+ readonly kind: 'unreadable';
3
5
  } | {
4
6
  readonly kind: 'not_reported';
5
7
  };
@@ -11,7 +11,6 @@ function projectAttachmentSeat(caps) {
11
11
  const reader = createEngineCapReader({
12
12
  name: 'attachmentSeat',
13
13
  project: projectAttachmentSeat,
14
- makeUnobserved: () => ({ kind: 'unobserved' }),
15
14
  });
16
15
  export function noteEngineCapsForAttachmentSeat(baseUrl, caps, opts) {
17
16
  reader.note(baseUrl, caps, opts);
@@ -1,5 +1,7 @@
1
1
  export type CallerCwdReading = {
2
2
  kind: 'unobserved';
3
+ } | {
4
+ kind: 'unreadable';
3
5
  } | {
4
6
  kind: 'not_reported';
5
7
  } | {
@@ -7,9 +9,5 @@ export type CallerCwdReading = {
7
9
  value: boolean;
8
10
  };
9
11
  export declare function projectCallerCwdCapability(caps: unknown): CallerCwdReading | undefined;
10
- export declare function noteEngineCapsForCallerCwd(baseUrl: string, caps: unknown, opts?: {
11
- generation?: number;
12
- }): void;
13
12
  export declare function observedCallerCwd(baseUrl?: string | undefined): CallerCwdReading;
14
13
  export declare function callerCwdAdmitted(reading: CallerCwdReading | undefined): boolean;
15
- export declare function __resetCallerCwdReadingsForTests(): void;
@@ -17,11 +17,7 @@ export function projectCallerCwdCapability(caps) {
17
17
  const reader = createEngineCapReader({
18
18
  name: 'callerCwd',
19
19
  project: projectCallerCwdCapability,
20
- makeUnobserved: () => ({ kind: 'unobserved' }),
21
20
  });
22
- export function noteEngineCapsForCallerCwd(baseUrl, caps, opts) {
23
- reader.note(baseUrl, caps, opts);
24
- }
25
21
  export function observedCallerCwd(baseUrl = engineWireTarget()?.baseUrl) {
26
22
  return reader.observed(baseUrl);
27
23
  }
@@ -37,6 +33,3 @@ export function callerCwdAdmitted(reading) {
37
33
  return false;
38
34
  }
39
35
  }
40
- export function __resetCallerCwdReadingsForTests() {
41
- reader.__resetForTests();
42
- }
@@ -19,6 +19,8 @@ export interface CenterWiringView {
19
19
  }
20
20
  export type CenterWiringReading = {
21
21
  kind: 'unobserved';
22
+ } | {
23
+ kind: 'unreadable';
22
24
  } | {
23
25
  kind: 'none';
24
26
  } | {
@@ -26,11 +28,7 @@ export type CenterWiringReading = {
26
28
  view: CenterWiringView;
27
29
  };
28
30
  export declare function projectCenterWiringCapability(caps: unknown): CenterWiringReading | undefined;
29
- export declare function noteEngineCapsForCenterWiring(baseUrl: string, caps: unknown, opts?: {
30
- generation?: number;
31
- }): void;
32
31
  export declare function observedCenterWiring(baseUrl?: string | undefined): CenterWiringReading;
33
32
  export type CallerQuotaLease = 'enforced' | 'not-enforced' | 'exhausted' | 'unobserved' | 'no-lease' | 'unknown';
34
33
  export declare function callerQuotaLease(reading: CenterWiringReading): CallerQuotaLease;
35
34
  export declare function centerWiringDoctorDetail(reading: CenterWiringReading): string;
36
- export declare function __resetCenterWiringReadingsForTests(): void;
@@ -1,6 +1,6 @@
1
1
  import { capForDisplay } from './fleetTaskDesc.js';
2
2
  import { engineWireTarget } from './engineWireTarget.js';
3
- import { createEngineCapReader } from './engineCapReader.js';
3
+ import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
4
4
  import { ownDataField } from './ownKey.js';
5
5
  const nonEmpty = (v) => typeof v === 'string' && v !== '';
6
6
  const isPlainObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
@@ -86,11 +86,7 @@ function projectCenterWiringOf(caps) {
86
86
  const reader = createEngineCapReader({
87
87
  name: 'centerWiring',
88
88
  project: projectCenterWiringCapability,
89
- makeUnobserved: () => ({ kind: 'unobserved' }),
90
89
  });
91
- export function noteEngineCapsForCenterWiring(baseUrl, caps, opts) {
92
- reader.note(baseUrl, caps, opts);
93
- }
94
90
  export function observedCenterWiring(baseUrl = engineWireTarget()?.baseUrl) {
95
91
  return reader.observed(baseUrl);
96
92
  }
@@ -99,7 +95,7 @@ function guarded(reading) {
99
95
  return undefined;
100
96
  try {
101
97
  const kind = reading.kind;
102
- if (kind === 'unobserved' || kind === 'none')
98
+ if (kind === 'unobserved' || kind === 'unreadable' || kind === 'none')
103
99
  return { kind };
104
100
  if (kind !== 'present')
105
101
  return undefined;
@@ -161,6 +157,8 @@ function failModeClause(v) {
161
157
  export function centerWiringDoctorDetail(reading) {
162
158
  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';
163
159
  const r = guarded(reading);
160
+ if (r?.kind === 'unreadable')
161
+ return unreadableReadingDetail('center wiring');
164
162
  if (r?.kind === 'none') {
165
163
  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
164
  }
@@ -194,6 +192,3 @@ export function centerWiringDoctorDetail(reading) {
194
192
  return unobserved;
195
193
  }
196
194
  }
197
- export function __resetCenterWiringReadingsForTests() {
198
- reader.__resetForTests();
199
- }
@@ -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' | 'unvouched';
24
24
  readonly outcome: 'dropped' | 'kept';
25
25
  }
26
26
  export interface CloudModelsDocOptions {
@@ -123,4 +123,4 @@ export interface CloudEffectiveNotice {
123
123
  readonly level: 'warn' | 'info';
124
124
  readonly text: string;
125
125
  }
126
- export declare function cloudEffectiveNotices(p: Pick<CloudProjection, 'effectiveWarnings' | 'budget' | 'runtimeCaps' | 'modelRefIssues'>): CloudEffectiveNotice[];
126
+ export declare function cloudEffectiveNotices(p: Pick<CloudProjection, 'effectiveWarnings' | 'budget' | 'runtimeCaps' | 'modelRefIssues' | 'droppedMcpServers'>): CloudEffectiveNotice[];