@sema-agent/client-core 0.91.0 → 0.93.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 (195) hide show
  1. package/CHANGELOG.md +351 -0
  2. package/README.md +51 -34
  3. package/dist/adapt/arms.js +6 -12
  4. package/dist/adapt/panelTasks.d.ts +0 -2
  5. package/dist/adapt/panelTasks.js +6 -26
  6. package/dist/adapt/toolCards.js +6 -4
  7. package/dist/adapt.d.ts +1 -1
  8. package/dist/adapt.js +3 -3
  9. package/dist/adapter/activeRunSelfHeal.d.ts +0 -2
  10. package/dist/adapter/activeRunSelfHeal.js +5 -27
  11. package/dist/adapter/downstream/terminalToSdkResult.js +16 -7
  12. package/dist/adapter/runStream.js +6 -2
  13. package/dist/agentsWireCaps.js +1 -1
  14. package/dist/approvalDecidedByCapability.d.ts +16 -0
  15. package/dist/approvalDecidedByCapability.js +47 -0
  16. package/dist/approvalsStreamLiveCapability.js +3 -3
  17. package/dist/askSurvivesStandingAnswer.d.ts +4 -1
  18. package/dist/askSurvivesStandingAnswer.js +13 -0
  19. package/dist/autoModeUnavailable.js +3 -2
  20. package/dist/centerWiringCapability.js +1 -1
  21. package/dist/cloudConfigWireCaps.js +10 -9
  22. package/dist/compensations.js +7 -7
  23. package/dist/controlRouter.d.ts +23 -23
  24. package/dist/controlRouter.js +114 -49
  25. package/dist/coreValuePorts.d.ts +4 -2
  26. package/dist/coreValuePorts.js +5 -0
  27. package/dist/decideFailureNote.js +4 -2
  28. package/dist/decideReceipt.d.ts +11 -0
  29. package/dist/decideReceipt.js +95 -9
  30. package/dist/detachWire.d.ts +2 -14
  31. package/dist/detachWire.js +1 -47
  32. package/dist/deviceExecutorManagementCapability.d.ts +6 -2
  33. package/dist/deviceExecutorManagementCapability.js +61 -15
  34. package/dist/displayUntrusted.js +2 -1
  35. package/dist/effectiveFacts.d.ts +14 -4
  36. package/dist/effectiveFacts.js +45 -5
  37. package/dist/engineAgentAbsence.js +2 -1
  38. package/dist/engineCapReader.js +16 -10
  39. package/dist/engineCapsCache.d.ts +2 -0
  40. package/dist/engineCapsCache.js +13 -2
  41. package/dist/engineConfigDrift.d.ts +20 -0
  42. package/dist/engineConfigDrift.js +54 -0
  43. package/dist/engineErrorCodes.d.ts +17 -0
  44. package/dist/engineErrorCodes.js +45 -0
  45. package/dist/engineInlineTaskStats.d.ts +1 -0
  46. package/dist/engineNoticeCodes.d.ts +16 -2
  47. package/dist/engineNoticeCodes.js +71 -0
  48. package/dist/engineWireFor.d.ts +22 -0
  49. package/dist/engineWireFor.js +154 -9
  50. package/dist/engineWireSdk.d.ts +0 -1
  51. package/dist/engineWireSdk.js +0 -3
  52. package/dist/executionLaneCapability.js +4 -2
  53. package/dist/fileHistoryCaptureCapability.d.ts +1 -1
  54. package/dist/fileHistoryCaptureCapability.js +1 -6
  55. package/dist/fileHistoryLegNotice.d.ts +1 -1
  56. package/dist/fileHistoryLegNotice.js +1 -6
  57. package/dist/gateOutcome.js +2 -17
  58. package/dist/gateVocabulary.d.ts +2 -8
  59. package/dist/gateVocabulary.js +6 -32
  60. package/dist/generated/engineFactTables.d.ts +17 -1
  61. package/dist/generated/engineFactTables.js +91 -0
  62. package/dist/generated/engineNoticeTables.d.ts +1 -1
  63. package/dist/generated/engineNoticeTables.js +4 -1
  64. package/dist/generated/settingsSchemaTables.d.ts +8 -0
  65. package/dist/generated/settingsSchemaTables.js +40 -0
  66. package/dist/goalStopHook.d.ts +1 -8
  67. package/dist/goalStopHook.js +2 -58
  68. package/dist/headlessPermissionModeWire.d.ts +3 -2
  69. package/dist/headlessPermissionModeWire.js +46 -5
  70. package/dist/hitl/allowRuleShadow.d.ts +21 -0
  71. package/dist/hitl/allowRuleShadow.js +167 -0
  72. package/dist/hitl/askClassPair.d.ts +14 -0
  73. package/dist/hitl/askClassPair.js +42 -0
  74. package/dist/hitl/askGateWire.js +1 -0
  75. package/dist/hitl/askParkRowRouting.js +2 -2
  76. package/dist/hitl/askSurvivesPosture.d.ts +5 -0
  77. package/dist/hitl/askSurvivesPosture.js +17 -0
  78. package/dist/hitl/automaticAnswerVerdict.d.ts +21 -0
  79. package/dist/hitl/automaticAnswerVerdict.js +143 -0
  80. package/dist/hitl/crashConverged.d.ts +1 -0
  81. package/dist/hitl/crashConverged.js +1 -1
  82. package/dist/hitl/frameRouter.d.ts +2 -0
  83. package/dist/hitl/frameRouter.js +73 -16
  84. package/dist/hitl/gateLedger.d.ts +7 -0
  85. package/dist/hitl/gateLedger.js +37 -5
  86. package/dist/hitl/hitlBridge.d.ts +1 -0
  87. package/dist/hitl/hitlBridge.js +6 -1
  88. package/dist/hitl/hitlHostSurface.d.ts +5 -2
  89. package/dist/hitl/hitlHostSurface.js +25 -3
  90. package/dist/hitl/livePendingAsk.js +24 -5
  91. package/dist/hitl/parkResolver.js +24 -4
  92. package/dist/hitl/persistedRulesWire.d.ts +4 -1
  93. package/dist/hitl/persistedRulesWire.js +38 -19
  94. package/dist/hitl/planReviewWire.d.ts +0 -2
  95. package/dist/hitl/planReviewWire.js +3 -20
  96. package/dist/hitl/replayedApproval.d.ts +21 -0
  97. package/dist/hitl/replayedApproval.js +89 -0
  98. package/dist/hitl/sessionPolicyDeliverable.js +20 -2
  99. package/dist/hitl/sessionPolicyWire.d.ts +10 -0
  100. package/dist/hitl/sessionPolicyWire.js +19 -6
  101. package/dist/hitl/toolApprovalWire.d.ts +27 -7
  102. package/dist/hitl/toolApprovalWire.js +153 -94
  103. package/dist/hookMatcherVerdict.js +2 -1
  104. package/dist/hooksWireCaps.d.ts +1 -1
  105. package/dist/hooksWireCaps.js +1 -1
  106. package/dist/humanTurn.js +3 -4
  107. package/dist/index.d.ts +21 -6
  108. package/dist/index.js +17 -4
  109. package/dist/inheritEnvWire.d.ts +1 -4
  110. package/dist/inheritEnvWire.js +3 -22
  111. package/dist/limitsWire.d.ts +0 -6
  112. package/dist/limitsWire.js +0 -38
  113. package/dist/mcpLiveness.js +2 -1
  114. package/dist/mcpProbeCapability.js +1 -1
  115. package/dist/mcpProbeWire.js +10 -12
  116. package/dist/mcpReconnect.d.ts +5 -0
  117. package/dist/mcpReconnect.js +28 -0
  118. package/dist/memoryComplianceCapability.js +2 -2
  119. package/dist/memoryOriginCapability.js +2 -2
  120. package/dist/memoryVerbsWire.d.ts +1 -1
  121. package/dist/memoryVerbsWire.js +17 -13
  122. package/dist/model/catalog.js +2 -1
  123. package/dist/model/providerPresets.d.ts +3 -1
  124. package/dist/model/tierVocabulary.d.ts +2 -1
  125. package/dist/model/tierVocabulary.js +3 -8
  126. package/dist/ownKey.d.ts +2 -0
  127. package/dist/ownKey.js +15 -0
  128. package/dist/peerFrames.js +2 -2
  129. package/dist/peerLaneCapability.js +2 -2
  130. package/dist/permissionModesCapability.d.ts +16 -0
  131. package/dist/permissionModesCapability.js +71 -0
  132. package/dist/permissionRuleIssue.js +10 -7
  133. package/dist/permissionRulesWriteCapability.js +2 -2
  134. package/dist/permissionWireCaps.d.ts +2 -0
  135. package/dist/permissionWireCaps.js +8 -1
  136. package/dist/permissionsAllowGrantCapability.js +7 -2
  137. package/dist/permissionsDeclaration.d.ts +7 -1
  138. package/dist/permissionsDeclaration.js +29 -20
  139. package/dist/pluginHooksWire.js +2 -11
  140. package/dist/postureKnob.js +1 -1
  141. package/dist/promptProfileWireCaps.d.ts +2 -1
  142. package/dist/protocolSegment.d.ts +11 -0
  143. package/dist/protocolSegment.js +31 -0
  144. package/dist/readFacePosture.js +1 -1
  145. package/dist/request/taskRequest.js +1 -15
  146. package/dist/resumeRefusalCopy.d.ts +1 -0
  147. package/dist/resumeRefusalCopy.js +26 -3
  148. package/dist/retryStatus.js +2 -1
  149. package/dist/rewindArchiveCapability.js +2 -2
  150. package/dist/ruleCompileVerdict.d.ts +2 -0
  151. package/dist/ruleCompileVerdict.js +13 -0
  152. package/dist/ruleRemovalConsequence.d.ts +2 -1
  153. package/dist/runCancelContext.d.ts +12 -0
  154. package/dist/runCancelContext.js +83 -1
  155. package/dist/runTerminal.d.ts +16 -0
  156. package/dist/runTerminal.js +32 -3
  157. package/dist/seam.d.ts +1 -0
  158. package/dist/seam.js +1 -1
  159. package/dist/seatContract.d.ts +2 -1
  160. package/dist/sessionMemoryStatus.d.ts +2 -4
  161. package/dist/sessionPolicyCapability.js +1 -1
  162. package/dist/sessionSyncFileHistoryCapability.d.ts +18 -0
  163. package/dist/sessionSyncFileHistoryCapability.js +50 -0
  164. package/dist/skillToolListsCapability.d.ts +18 -0
  165. package/dist/skillToolListsCapability.js +50 -0
  166. package/dist/sqlEngineCapability.js +2 -9
  167. package/dist/steerPriorityCapability.d.ts +18 -0
  168. package/dist/steerPriorityCapability.js +80 -0
  169. package/dist/steerReceipt.d.ts +9 -0
  170. package/dist/steerReceipt.js +25 -0
  171. package/dist/storePostureCapability.js +2 -2
  172. package/dist/subagent/engineSubagentSteer.js +2 -9
  173. package/dist/supportFloor.d.ts +1 -0
  174. package/dist/supportFloor.js +15 -5
  175. package/dist/taskRequestWords.d.ts +4 -2
  176. package/dist/taskRequestWords.js +1 -1
  177. package/dist/toolHistoryBadTurn.js +1 -2
  178. package/dist/toolResult.d.ts +10 -1
  179. package/dist/toolResult.js +80 -6
  180. package/dist/types/engineState.d.ts +2 -12
  181. package/dist/userInvokedSkillsCapability.d.ts +18 -0
  182. package/dist/userInvokedSkillsCapability.js +50 -0
  183. package/dist/webSearchBackendCapability.js +2 -2
  184. package/dist/webSearchWireCaps.d.ts +1 -1
  185. package/dist/webSearchWireCaps.js +40 -2
  186. package/dist/wireFailureShape.d.ts +2 -0
  187. package/dist/wireFailureShape.js +6 -2
  188. package/dist/wireRefusalCopy.d.ts +9 -3
  189. package/dist/wireRefusalCopy.js +41 -4
  190. package/dist/workflowsJournalCapability.d.ts +18 -0
  191. package/dist/workflowsJournalCapability.js +50 -0
  192. package/dist/writeProtectionCapability.d.ts +2 -4
  193. package/dist/writeProtectionCapability.js +1 -1
  194. package/docs/INTEGRATION-CLIENTS.md +1516 -18
  195. package/package.json +2 -2
package/dist/humanTurn.js CHANGED
@@ -1,10 +1,9 @@
1
+ import { CORE_MAX_PENDING_STEER_CHARS, CORE_MCP_IMAGE_MAX_BASE64 } from './generated/engineFactTables.js';
1
2
  import { mintEnvelopeOf, mintReferenceOf } from './userAttachmentEnvelope.js';
2
3
  import { readEncodingShares, readHumanTurnInput } from './humanTurnRead.js';
3
4
  const REQUEST_BODY_MAX_BYTES = 8 * 1024 * 1024;
4
5
  const IMAGE_SEAT_MAX_COUNT = 20;
5
- const IMAGE_MAX_BASE64_CHARS_EACH = 6 * 1024 * 1024;
6
6
  const IMAGE_SEAT_MAX_BASE64_CHARS_TOTAL = 6 * 1024 * 1024;
7
- const STEER_MAX_CHARS = 16000;
8
7
  const STEER_REMINDER_TAG = /<\s*\/?\s*system-reminder(?:\s[^>]*)?>/i;
9
8
  const STEER_CONTROL_CHARS = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
10
9
  function utf8Length(s) {
@@ -46,7 +45,7 @@ function steerRefusal(text) {
46
45
  return 'reminder_tag';
47
46
  if (STEER_CONTROL_CHARS.test(text))
48
47
  return 'control_char';
49
- if (text.length > STEER_MAX_CHARS)
48
+ if (text.length > CORE_MAX_PENDING_STEER_CHARS)
50
49
  return 'too_long';
51
50
  return undefined;
52
51
  }
@@ -148,7 +147,7 @@ function encodeObjective(v) {
148
147
  let count = 0;
149
148
  let total = 0;
150
149
  const seat = (len) => {
151
- if (len > IMAGE_MAX_BASE64_CHARS_EACH)
150
+ if (len > CORE_MCP_IMAGE_MAX_BASE64)
152
151
  return 'image_too_large';
153
152
  if (count + 1 > IMAGE_SEAT_MAX_COUNT)
154
153
  return 'seat_count';
package/dist/index.d.ts CHANGED
@@ -50,11 +50,21 @@ export * from './mcpPanel.js';
50
50
  export * from './mcpLiveness.js';
51
51
  export * from './mcpEngineLeg.js';
52
52
  export * from './mcpProbeCapability.js';
53
+ export * from './sessionSyncFileHistoryCapability.js';
54
+ export * from './workflowsJournalCapability.js';
55
+ export * from './userInvokedSkillsCapability.js';
56
+ export * from './skillToolListsCapability.js';
57
+ export * from './steerPriorityCapability.js';
58
+ export * from './permissionModesCapability.js';
59
+ export * from './approvalDecidedByCapability.js';
53
60
  export * from './mcpProbeWire.js';
54
61
  export * from './effectiveFacts.js';
55
62
  export * from './gateOutcome.js';
56
63
  export * from './postureKnob.js';
57
64
  export * from './engineIdentity.js';
65
+ export { transportFailureScene } from './engineWireFor.js';
66
+ export type { EngineWireNoAnswerKind, TransportFailureChainEnd, TransportFailureLayer, TransportFailureScene, TransportFailureSocket } from './engineWireFor.js';
67
+ export * from './engineConfigDrift.js';
58
68
  export * from './gateVocabulary.js';
59
69
  export * from './permissionRuleIssue.js';
60
70
  export * from './toolRoster.js';
@@ -69,14 +79,15 @@ export type { DisplayUntrustedOptions, DisplayMark, DisplayMarkSpan, DisplayUntr
69
79
  export type * from './types/engineState.js';
70
80
  export * from './hostEnv.js';
71
81
  export * from './unrefTimer.js';
72
- export { ControlRouter, ControlSafetyError, errCodes, steerRefusalAdviceOf, steeringRefusedBeforeEngine, type ControlClientLike, type ControlRouterOptions, type ControlSafetyCode, type ErrCodes, type QueuedCommand, type QueuePriority, type RunsResourceLike, type SteerRefusalAdvice, type SteeringRefusedBeforeEngine, } from './controlRouter.js';
82
+ export { ControlRouter, ControlSafetyError, errCodes, steerBodyOf, steerRefusalAdviceOf, steeringRefusedBeforeEngine, type ControlClientLike, type ControlRouterOptions, type ControlRouterSteerOptions, type ControlSafetyCode, type ErrCodes, type RunsResourceLike, type SteerBody, type SteerBodyInput, type SteerRefusalAdvice, type SteeringRefusedBeforeEngine, } from './controlRouter.js';
83
+ export { readSteerReceipt, type SteerReceiptReading } from './steerReceipt.js';
73
84
  export * from './sseIdleTriage.js';
74
85
  export * from './engineWireSdk.js';
75
86
  export * from './classifierVerdictWire.js';
76
87
  export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
77
88
  export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
78
- export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
79
- export type { DelegationCapDisposition, ModelFallbackReason, } from './engineErrorCodes.js';
89
+ export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
90
+ export type { DelegationCapDisposition, ModelFallbackReason, OperatorGateRefusal, RunDeathVerdictCode, } from './engineErrorCodes.js';
80
91
  export * from './agentsWireCaps.js';
81
92
  export * from './attachmentsWireCaps.js';
82
93
  export * from './clientContextWireCaps.js';
@@ -119,7 +130,7 @@ export * from './request/taskRequest.js';
119
130
  export { disableSkillsDeclaration, disableSkillsDeclarationSettled } from './disableSkillsWire.js';
120
131
  export type { DisableSkillsDeclaration } from './disableSkillsWire.js';
121
132
  export { PERMISSIONS_KEPT_REASONS, permissionsDeclaration, permissionsDeclarationReport } from './permissionsDeclaration.js';
122
- export type { PermissionsDeclaration, PermissionsDeclarationBuckets, PermissionsDeclarationInput, PermissionsDeclarationReport, PermissionsKeptReason, PermissionsKeptRule, PermissionsRewrittenRule, PermissionsUncheckedRule, WireRuleOrigin, WireRuleOrigins, } from './permissionsDeclaration.js';
133
+ export type { PermissionsDeclaration, PermissionsDeclarationBuckets, PermissionsDeclarationInput, PermissionsDeclarationReport, PermissionsKeptReason, PermissionsKeptRule, PermissionsRewrittenRule, PermissionsUncheckedRule, PermissionsUnreachableRule, WireRuleOrigin, WireRuleOrigins, } from './permissionsDeclaration.js';
123
134
  export * from './clientSlice.js';
124
135
  export * from './host.js';
125
136
  export { abortableSleep } from './abortableSleep.js';
@@ -171,7 +182,7 @@ export type { AttachmentSeatReading } from './attachmentSeatCapability.js';
171
182
  export * from './resumeRefusalCopy.js';
172
183
  export * from './wireRefusalCopy.js';
173
184
  export * from './inheritEnvWire.js';
174
- export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier } from './supportFloor.js';
185
+ export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier, coreVersionTier } from './supportFloor.js';
175
186
  export type { SupportFloor, SupportFloorComponent, EngineVersionTier } from './supportFloor.js';
176
187
  export * from './decideReceipt.js';
177
188
  export * from './sessionMap.js';
@@ -195,7 +206,7 @@ export * from './hitl/suspendedReopen.js';
195
206
  export * from './hitl/approvalOutcomeNote.js';
196
207
  export * from './hitl/approvalResolution.js';
197
208
  export { toolEndOutputText, ENGINE_ABORT_TOOL_RESULT } from './hitl/frameRouter.js';
198
- export { _resetHitlHostSurfaceForTest, CANCEL_DENY_BUDGET_MS, CANCEL_DENY_WARN_TEXT, EDIT_NOT_FORWARDED_WARN_TEXT, EDIT_REFUSED_ON_BLIND_ASK_WARN_TEXT, hitlHostSurfaceFor, hitlHostSurfaceMisses, hitlHostSurfaceMissesFor, installHitlHostSurface, installHitlHostSurfaceFor, observeCancelByDeny, REMEMBER_NOT_APPLIED_WARN_TEXT, RULE_NOT_SENT_REJECTED_WARN_TEXT, RULE_NOT_SENT_WARN_TEXT, surfaceEditRefusedOnBlindAsk, surfaceForCurrentSession, surfaceRememberNotApplied, } from './hitl/hitlHostSurface.js';
209
+ export { _resetHitlHostSurfaceForTest, CANCEL_DENY_BUDGET_MS, CANCEL_DENY_WARN_TEXT, EDIT_NOT_FORWARDED_WARN_TEXT, EDIT_REFUSED_ON_BLIND_ASK_WARN_TEXT, hitlHostSurfaceFor, hitlHostSurfaceMisses, hitlHostSurfaceMissesFor, installHitlHostSurface, installHitlHostSurfaceFor, observeCancelByDeny, REMEMBER_NOT_APPLIED_WARN_TEXT, REPLAYED_APPROVAL_LIST_UNREADABLE_WARN_TEXT, RULE_NOT_SENT_REJECTED_WARN_TEXT, RULE_NOT_SENT_WARN_TEXT, surfaceEditRefusedOnBlindAsk, surfaceForCurrentSession, surfaceRememberNotApplied, } from './hitl/hitlHostSurface.js';
199
210
  export type { ClassifierDenyContext, HitlHostSurface, HitlNotice, } from './hitl/hitlHostSurface.js';
200
211
  export * from './hitl/toolApprovalWire.js';
201
212
  export * from './hitl/editedRuleTextPrecheck.js';
@@ -215,7 +226,11 @@ export * from './hitl/sessionPolicyWire.js';
215
226
  export * from './hitl/sessionPolicyDeliverable.js';
216
227
  export * from './hitl/approvalsFeed.js';
217
228
  export * from './hitl/livePendingAsk.js';
229
+ export { replayedApprovalDisposition } from './hitl/replayedApproval.js';
230
+ export type { ReplayedApprovalDisposition, ReplayPendingBasis } from './hitl/replayedApproval.js';
218
231
  export * from './hitl/askSurvivesPosture.js';
232
+ export { automaticAnswerVerdict, type AutomaticAnswerLane, type AutomaticAnswerFacts, type AutomaticAnswerRoad, type AutomaticAnswerUnknownWhy, type AutomaticAnswerVerdict, } from './hitl/automaticAnswerVerdict.js';
233
+ export { readApprovalAllowRuleShadow, approvalAllowRuleShadowed, type ApprovalAllowRuleShadow, type ApprovalAllowRuleShadowMember, type AllowRuleShadowedWireMember, } from './hitl/allowRuleShadow.js';
219
234
  export { projectCrashConverged } from './hitl/crashConverged.js';
220
235
  export type { ApprovalsListEnvelope, CrashConvergedOrphanState, CrashConvergedProjection, CrashConvergedRow } from './hitl/crashConverged.js';
221
236
  export * from './hitl/crashConvergedNotice.js';
package/dist/index.js CHANGED
@@ -44,11 +44,20 @@ export * from './mcpPanel.js';
44
44
  export * from './mcpLiveness.js';
45
45
  export * from './mcpEngineLeg.js';
46
46
  export * from './mcpProbeCapability.js';
47
+ export * from './sessionSyncFileHistoryCapability.js';
48
+ export * from './workflowsJournalCapability.js';
49
+ export * from './userInvokedSkillsCapability.js';
50
+ export * from './skillToolListsCapability.js';
51
+ export * from './steerPriorityCapability.js';
52
+ export * from './permissionModesCapability.js';
53
+ export * from './approvalDecidedByCapability.js';
47
54
  export * from './mcpProbeWire.js';
48
55
  export * from './effectiveFacts.js';
49
56
  export * from './gateOutcome.js';
50
57
  export * from './postureKnob.js';
51
58
  export * from './engineIdentity.js';
59
+ export { transportFailureScene } from './engineWireFor.js';
60
+ export * from './engineConfigDrift.js';
52
61
  export * from './gateVocabulary.js';
53
62
  export * from './permissionRuleIssue.js';
54
63
  export * from './toolRoster.js';
@@ -61,13 +70,14 @@ export * from './fleetTaskDesc.js';
61
70
  export { displayUntrusted, displayUntrustedMarks } from './displayUntrusted.js';
62
71
  export * from './hostEnv.js';
63
72
  export * from './unrefTimer.js';
64
- export { ControlRouter, ControlSafetyError, errCodes, steerRefusalAdviceOf, steeringRefusedBeforeEngine, } from './controlRouter.js';
73
+ export { ControlRouter, ControlSafetyError, errCodes, steerBodyOf, steerRefusalAdviceOf, steeringRefusedBeforeEngine, } from './controlRouter.js';
74
+ export { readSteerReceipt } from './steerReceipt.js';
65
75
  export * from './sseIdleTriage.js';
66
76
  export * from './engineWireSdk.js';
67
77
  export * from './classifierVerdictWire.js';
68
78
  export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
69
79
  export { findSystemReminderOpenTag } from './systemReminderTag.js';
70
- export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
80
+ export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, DECIDE_WORKFLOW_PARK_FORKED, DECIDE_WORKFLOW_PARKS_UNREADABLE, DECIDE_WORKFLOW_REMEMBER_UNSUPPORTED, DELEGATION_CAP_CODES, DELEGATION_CONCURRENCY_CAP, DELEGATION_SESSION_CAP, delegationCapDispositionOf, DRAINING_ERROR_CODE, ENGINE_STOP_REASONS, engineStopReasonToCc, ENV_LIFETIME_EXPIRED, FLEET_LEASE_UNAVAILABLE, GATE_PARKED_ERROR_CODE, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, isRulesRefusalCode, isStatusDerivedCoarseCode, isWorkflowParkRefusalCode, LIMITS_MAX_COST_EXCEEDED, LIMITS_MAX_TOKENS_EXCEEDED, LIMITS_MAX_TURNS_EXCEEDED, LIMITS_MAX_WALLTIME_EXCEEDED, MCP_SERVER_REVOKED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, RESUME_AT_ERROR_CODE_PREFIX, RESUME_CONTEXT_UNAVAILABLE, RESUME_ENV_FAILED, RESUME_PLACEMENT_MISMATCH, RESUME_POLICY_FOLD_CODE, RESUME_PREFLIGHT_REJECTED, RESUME_REOPEN_CODES, RESUME_RETRY_LATER_CODES, RESUME_TOOL_CONTRACT_MISMATCH, RESUME_TOOL_UNAVAILABLE, RESUME_USAGE_WINDOW_EXHAUSTED, REWIND_ERROR_CODE_PREFIXES, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
71
81
  export * from './agentsWireCaps.js';
72
82
  export * from './attachmentsWireCaps.js';
73
83
  export * from './clientContextWireCaps.js';
@@ -149,7 +159,7 @@ export { noteEngineCapsForAttachmentSeat, observedAttachmentSeat, forgetAttachme
149
159
  export * from './resumeRefusalCopy.js';
150
160
  export * from './wireRefusalCopy.js';
151
161
  export * from './inheritEnvWire.js';
152
- export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier } from './supportFloor.js';
162
+ export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier, coreVersionTier } from './supportFloor.js';
153
163
  export * from './decideReceipt.js';
154
164
  export * from './sessionMap.js';
155
165
  export * from './detachWire.js';
@@ -170,7 +180,7 @@ export * from './hitl/suspendedReopen.js';
170
180
  export * from './hitl/approvalOutcomeNote.js';
171
181
  export * from './hitl/approvalResolution.js';
172
182
  export { toolEndOutputText, ENGINE_ABORT_TOOL_RESULT } from './hitl/frameRouter.js';
173
- export { _resetHitlHostSurfaceForTest, CANCEL_DENY_BUDGET_MS, CANCEL_DENY_WARN_TEXT, EDIT_NOT_FORWARDED_WARN_TEXT, EDIT_REFUSED_ON_BLIND_ASK_WARN_TEXT, hitlHostSurfaceFor, hitlHostSurfaceMisses, hitlHostSurfaceMissesFor, installHitlHostSurface, installHitlHostSurfaceFor, observeCancelByDeny, REMEMBER_NOT_APPLIED_WARN_TEXT, RULE_NOT_SENT_REJECTED_WARN_TEXT, RULE_NOT_SENT_WARN_TEXT, surfaceEditRefusedOnBlindAsk, surfaceForCurrentSession, surfaceRememberNotApplied, } from './hitl/hitlHostSurface.js';
183
+ export { _resetHitlHostSurfaceForTest, CANCEL_DENY_BUDGET_MS, CANCEL_DENY_WARN_TEXT, EDIT_NOT_FORWARDED_WARN_TEXT, EDIT_REFUSED_ON_BLIND_ASK_WARN_TEXT, hitlHostSurfaceFor, hitlHostSurfaceMisses, hitlHostSurfaceMissesFor, installHitlHostSurface, installHitlHostSurfaceFor, observeCancelByDeny, REMEMBER_NOT_APPLIED_WARN_TEXT, REPLAYED_APPROVAL_LIST_UNREADABLE_WARN_TEXT, RULE_NOT_SENT_REJECTED_WARN_TEXT, RULE_NOT_SENT_WARN_TEXT, surfaceEditRefusedOnBlindAsk, surfaceForCurrentSession, surfaceRememberNotApplied, } from './hitl/hitlHostSurface.js';
174
184
  export * from './hitl/toolApprovalWire.js';
175
185
  export * from './hitl/editedRuleTextPrecheck.js';
176
186
  export * from './coreValuePorts.js';
@@ -189,7 +199,10 @@ export * from './hitl/sessionPolicyWire.js';
189
199
  export * from './hitl/sessionPolicyDeliverable.js';
190
200
  export * from './hitl/approvalsFeed.js';
191
201
  export * from './hitl/livePendingAsk.js';
202
+ export { replayedApprovalDisposition } from './hitl/replayedApproval.js';
192
203
  export * from './hitl/askSurvivesPosture.js';
204
+ export { automaticAnswerVerdict, } from './hitl/automaticAnswerVerdict.js';
205
+ export { readApprovalAllowRuleShadow, approvalAllowRuleShadowed, } from './hitl/allowRuleShadow.js';
193
206
  export { projectCrashConverged } from './hitl/crashConverged.js';
194
207
  export * from './hitl/crashConvergedNotice.js';
195
208
  export * from './interactiveHalt.js';
@@ -1,8 +1,5 @@
1
1
  import { type InheritEnvWord, type TaskRequestLike } from './request/taskRequest.js';
2
- export declare const INHERIT_ENV_MIN_SERVER: readonly [number, number, number];
3
- export type InheritEnvServerSupport = 'supported' | 'unsupported' | 'unknown';
4
- export declare function inheritEnvServerSupport(version: string | undefined): InheritEnvServerSupport;
5
- export type InheritEnvWithheldCause = 'server_version_unknown' | 'server_too_old';
2
+ export type InheritEnvWithheldCause = 'server_version_unknown';
6
3
  export interface InheritEnvWithheld {
7
4
  readonly cause: InheritEnvWithheldCause;
8
5
  readonly word: InheritEnvWord;
@@ -1,19 +1,6 @@
1
1
  import { INHERIT_ENV_WORDS, isInheritEnvWord } from './request/taskRequest.js';
2
2
  import { settingsPermissionBucketRefusalFromError } from './wireRefusalCopy.js';
3
- export const INHERIT_ENV_MIN_SERVER = Object.freeze([7, 106, 0]);
4
- export function inheritEnvServerSupport(version) {
5
- const mm = typeof version === 'string' ? /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version) : null;
6
- if (!mm)
7
- return 'unknown';
8
- const got = [Number(mm[1]), Number(mm[2]), Number(mm[3])];
9
- for (let i = 0; i < 3; i++) {
10
- const g = got[i];
11
- const need = INHERIT_ENV_MIN_SERVER[i];
12
- if (g !== need)
13
- return g > need ? 'supported' : 'unsupported';
14
- }
15
- return 'supported';
16
- }
3
+ import { engineVersionTier } from './supportFloor.js';
17
4
  const EMPTY_DECLARATION = Object.freeze({ field: Object.freeze({}) });
18
5
  export function inheritEnvDeclaration(word, serverVersion) {
19
6
  if (word === undefined || word === null)
@@ -21,17 +8,11 @@ export function inheritEnvDeclaration(word, serverVersion) {
21
8
  if (!isInheritEnvWord(word)) {
22
9
  throw new TypeError(`inheritEnvDeclaration: inheritEnv 只接受 ${INHERIT_ENV_WORDS.map((w) => `'${w}'`).join(' / ')} 或缺席 —— 收到 ${Array.isArray(word) ? 'typeof=object / array' : `typeof=${typeof word}`}。坏词在版本判定之前就拒:「这一次不发」不许顺手吞掉一个打错字的声明。错误文本只报形状,不回显值。`);
23
10
  }
24
- const support = inheritEnvServerSupport(serverVersion);
25
- if (support === 'supported')
11
+ if (engineVersionTier(serverVersion) !== 'unknown')
26
12
  return Object.freeze({ field: Object.freeze({ inheritEnv: word }) });
27
- const cause = support === 'unsupported' ? 'server_too_old' : 'server_version_unknown';
28
- return Object.freeze({ field: Object.freeze({}), withheld: Object.freeze({ cause, word }) });
13
+ return Object.freeze({ field: Object.freeze({}), withheld: Object.freeze({ cause: 'server_version_unknown', word }) });
29
14
  }
30
15
  const WITHHELD_NOTICES = Object.freeze({
31
- server_too_old: Object.freeze({
32
- all: "Not sent with this request: this engine is too old to accept the setting that lets the shell inherit this machine's whole environment, so this run's shell gets the default environment, with credential-like variables removed.",
33
- scrub: 'Not sent with this request: this engine is too old to accept the default-environment setting, so it was left out; that has the same effect, because the default environment (credential-like variables removed) is what this run gets anyway.',
34
- }),
35
16
  server_version_unknown: Object.freeze({
36
17
  all: "Not sent with this request: the engine's version is not known yet, and an engine that does not know the setting that lets the shell inherit this machine's whole environment refuses the whole request, so it was held back; this run's shell gets the default environment, with credential-like variables removed, and on an engine that does know the setting, leaving it out also clears an earlier whole-environment choice for this session.",
37
18
  scrub: "Not sent with this request: the engine's version is not known yet, so the default-environment setting was left out; that has the same effect, because leaving it out also gives this run the default environment (credential-like variables removed).",
@@ -8,7 +8,6 @@ export declare const MAX_TURNS_MIN = 1;
8
8
  export declare const MAX_TURNS_MAX: number;
9
9
  export declare const MAX_TOKENS_MIN = 1;
10
10
  export declare const MAX_TOKENS_MAX: number;
11
- export declare const LIMITS_WIRE_MIN_ENGINE: readonly [number, number, number];
12
11
  export interface HeadlessLimits {
13
12
  maxWalltimeMs?: number;
14
13
  maxTurns?: number;
@@ -32,8 +31,3 @@ export type HeadlessEnvLimitsResult = {
32
31
  };
33
32
  export declare function headlessLimitsFromEnv(env?: EnvLike): HeadlessEnvLimitsResult;
34
33
  export declare function limitsForPrint(argv: string[], env?: EnvLike): LimitsParseResult;
35
- export declare function versionSupportsLimits(v: string | undefined): boolean;
36
- export declare function engineLimitsSupportWarning(baseUrl: string, flaggedFlags: string[], opts?: {
37
- fetchImpl?: typeof fetch;
38
- timeoutMs?: number;
39
- }): Promise<string | undefined>;
@@ -10,7 +10,6 @@ export const MAX_TURNS_MAX = Number.MAX_SAFE_INTEGER;
10
10
  export const MAX_TOKENS_MIN = 1;
11
11
  export const MAX_TOKENS_MAX = Number.MAX_SAFE_INTEGER;
12
12
  const SEC_TO_MS = 1_000;
13
- export const LIMITS_WIRE_MIN_ENGINE = [1, 196, 0];
14
13
  const DEADLINE_USAGE = `sema: --deadline expects a whole number of seconds between ${DEADLINE_SEC_MIN} and ${DEADLINE_SEC_MAX}.\n` +
15
14
  ' --deadline <sec> wall-clock budget for this run (sema superset — no upstream equivalent):\n' +
16
15
  ' reaching it ends the run LOUDLY (failed / limits.max_walltime_exceeded)\n' +
@@ -112,40 +111,3 @@ export function limitsForPrint(argv, env = hostEnv()) {
112
111
  const merged = { ...(fromEnv.limits ?? {}), ...(parsed.limits ?? {}) };
113
112
  return { ok: true, ...(hasAnyLimit(merged) ? { limits: merged } : {}), flaggedFlags: parsed.flaggedFlags };
114
113
  }
115
- export function versionSupportsLimits(v) {
116
- const m = v ? /^(\d+)\.(\d+)\.(\d+)/.exec(v) : null;
117
- if (!m)
118
- return false;
119
- const [a, b, c] = [Number(m[1]), Number(m[2]), Number(m[3])];
120
- const [ma, mb, mc] = LIMITS_WIRE_MIN_ENGINE;
121
- if (a !== ma)
122
- return a > ma;
123
- if (b !== mb)
124
- return b > mb;
125
- return c >= mc;
126
- }
127
- export async function engineLimitsSupportWarning(baseUrl, flaggedFlags, opts) {
128
- const fetchImpl = opts?.fetchImpl ?? fetch;
129
- const controller = new AbortController();
130
- const timer = setTimeout(() => controller.abort(), opts?.timeoutMs ?? 1500);
131
- try {
132
- const res = await fetchImpl(`${baseUrl.replace(/\/+$/, '')}/health`, {
133
- method: 'GET',
134
- signal: controller.signal,
135
- });
136
- if (!res.ok)
137
- return undefined;
138
- const body = (await res.json());
139
- const version = typeof body?.version === 'string' ? body.version : undefined;
140
- if (versionSupportsLimits(version))
141
- return undefined;
142
- const flags = flaggedFlags.length > 0 ? flaggedFlags.join('/') : '--deadline/--max-turns/--max-tokens';
143
- return `[sema] engine ${version ?? '(unversioned, pre-1.96)'} does not support ${flags} (needs ≥1.196.0); the flag will be ignored by the engine`;
144
- }
145
- catch {
146
- return undefined;
147
- }
148
- finally {
149
- clearTimeout(timer);
150
- }
151
- }
@@ -1,4 +1,5 @@
1
- export const MCP_LIVENESS_STATES = Object.freeze(['reachable', 'unreachable', 'unknown']);
1
+ import { CORE_MCP_LIVENESS_STATES } from './generated/engineFactTables.js';
2
+ export const MCP_LIVENESS_STATES = CORE_MCP_LIVENESS_STATES;
2
3
  void MCP_LIVENESS_STATES;
3
4
  void true;
4
5
  void true;
@@ -34,7 +34,7 @@ export function mcpProbeDoctorDetail(reading) {
34
34
  switch (reading.kind) {
35
35
  case 'unobserved':
36
36
  return ('per-server MCP status face not observed — the engine reports whether it has one on /v1/capabilities; ' +
37
- 'this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)');
37
+ '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)');
38
38
  case 'not_reported':
39
39
  return ('per-server MCP status face not reported by this engine — this binary predates the face, so that path is not expected to exist here ' +
40
40
  '(asking it usually answers with a machine-readable route-not-found, though a timeout or an uncoded gateway answer still says nothing either way); ' +
@@ -111,32 +111,32 @@ function narrowProbeFace(body) {
111
111
  let servers;
112
112
  try {
113
113
  if (!plainObject(body))
114
- return { ok: false, why: 'result_unreadable' };
114
+ return { ok: false, why: 'result_unreadable', what: 'the body is not a plain object' };
115
115
  probedAt = body.probedAt;
116
116
  ttlSec = body.ttlSec;
117
117
  servers = body.servers;
118
118
  }
119
119
  catch {
120
- return { ok: false, why: 'result_unreadable' };
120
+ return { ok: false, why: 'result_unreadable', what: 'the body threw when read' };
121
121
  }
122
122
  if (!nonEmptyString(probedAt))
123
- return { ok: false, why: 'result_unreadable' };
123
+ return { ok: false, why: 'result_unreadable', what: 'the reading time is missing or empty' };
124
124
  if (typeof ttlSec !== 'number' || !Number.isFinite(ttlSec) || ttlSec < 0)
125
- return { ok: false, why: 'result_unreadable' };
125
+ return { ok: false, why: 'result_unreadable', what: 'the reuse window is not a non-negative number' };
126
126
  const raw = snapshotArray(servers);
127
127
  if (raw === null)
128
- return { ok: false, why: 'result_unreadable' };
128
+ return { ok: false, why: 'result_unreadable', what: 'the per-server rows are not a readable list' };
129
129
  let rows;
130
130
  try {
131
131
  rows = projectMcpSection(raw);
132
132
  }
133
133
  catch {
134
- return { ok: false, why: 'result_unreadable' };
134
+ return { ok: false, why: 'result_unreadable', what: 'the per-server rows could not be read' };
135
135
  }
136
136
  if (rows === undefined)
137
- return { ok: false, why: 'result_unreadable' };
137
+ return { ok: false, why: 'result_unreadable', what: 'none of the per-server rows could be read' };
138
138
  if (rows.length !== raw.length)
139
- return { ok: false, why: 'result_unreadable' };
139
+ return { ok: false, why: 'result_unreadable', what: 'some of the per-server rows could not be read' };
140
140
  return { ok: true, face: { probedAt, ttlSec, servers: rows } };
141
141
  }
142
142
  const FACE_ABSENT_MESSAGE = 'this engine reports no per-server MCP status face on this deployment, so nothing was sent; ' +
@@ -172,8 +172,7 @@ export async function readMcpCapabilities(facade, call, opts) {
172
172
  }
173
173
  const narrowed = narrowProbeFace(res);
174
174
  if (!narrowed.ok) {
175
- return unknownBy(narrowed.why, 'the per-server MCP status call answered 2xx with a body this client cannot stand behind ' +
176
- '(the reading time, the reuse window, or the per-server rows) — refusing to present it as a reading, ' +
175
+ return unknownBy(narrowed.why, `the per-server MCP status call answered 2xx with a body this client cannot stand behind (${narrowed.what}) — refusing to present it as a reading, ` +
177
176
  'because a normal-looking empty list is exactly the false answer this face exists to remove');
178
177
  }
179
178
  return { status: 'face', face: narrowed.face };
@@ -206,8 +205,7 @@ export async function probeMcpServers(facade, call, opts) {
206
205
  }
207
206
  const narrowed = narrowProbeFace(res);
208
207
  if (!narrowed.ok) {
209
- return unknownBy(narrowed.why, 'the declaration probe answered 2xx with a body this client cannot stand behind ' +
210
- '(the reading time, the reuse window, or the per-server rows) — refusing to present it as a reading');
208
+ return unknownBy(narrowed.why, `the declaration probe answered 2xx with a body this client cannot stand behind (${narrowed.what}) — refusing to present it as a reading`);
211
209
  }
212
210
  if (narrowed.face.servers.length !== submitted.length) {
213
211
  return unknownBy('index_misaligned', `the declaration probe answered with ${narrowed.face.servers.length} row(s) for ${submitted.length} declaration(s) — ` +
@@ -1,5 +1,6 @@
1
1
  export declare const MCP_RECONNECT_OUTCOMES: readonly string[];
2
2
  export declare const MCP_RECONNECT_TRANSACTION_NOTICE: string;
3
+ export declare const MCP_RECONNECT_UNSETTLED_NOTICE: string;
3
4
  export interface McpReconnectStatusView {
4
5
  name: string;
5
6
  status: string;
@@ -51,6 +52,10 @@ export type McpReconnectVerdict = {
51
52
  readonly reason: 'capability' | 'route' | 'feature';
52
53
  } | {
53
54
  readonly kind: 'not_found';
55
+ } | {
56
+ readonly kind: 'unsettled';
57
+ readonly errorCode: 'state.mcp_reconnect_unsettled';
58
+ readonly error?: string;
54
59
  } | {
55
60
  readonly kind: 'failed';
56
61
  readonly error: unknown;
@@ -2,6 +2,9 @@ import { capForDisplay } from './fleetTaskDesc.js';
2
2
  export const MCP_RECONNECT_OUTCOMES = Object.freeze(['accepted', 'refused', 'unsupported']);
3
3
  export const MCP_RECONNECT_TRANSACTION_NOTICE = 'Reconnecting closes the current connection before dialing again. On a healthy server this is a transaction, ' +
4
4
  'not a refresh: a failed re-dial leaves the server down and withdraws its tools from the model until a later re-dial succeeds.';
5
+ export const MCP_RECONNECT_UNSETTLED_NOTICE = 'The MCP re-dial did not settle within the time this request waits, so there is no result yet: the re-dial was not cancelled and may still be running. ' +
6
+ "Check the server's state before re-dialing it again — a second request that arrives after the dial has settled closes the connection and dials once more.";
7
+ const UNSETTLED_CODE = 'state.mcp_reconnect_unsettled';
5
8
  const RECONNECT_TEXT_MAX = 200;
6
9
  const RECONNECT_WORD_MAX = 40;
7
10
  const SERVER_NAME_MAX = 190;
@@ -88,6 +91,27 @@ export function projectMcpReconnectResult(body) {
88
91
  }
89
92
  return view;
90
93
  }
94
+ function unsettledVerdict(carrier) {
95
+ let text;
96
+ try {
97
+ const r = carrier;
98
+ text = nonEmpty(r.error) ? r.error : r.message;
99
+ }
100
+ catch {
101
+ text = undefined;
102
+ }
103
+ return nonEmpty(text)
104
+ ? { kind: 'unsettled', errorCode: UNSETTLED_CODE, error: capForDisplay(text, RECONNECT_TEXT_MAX) }
105
+ : { kind: 'unsettled', errorCode: UNSETTLED_CODE };
106
+ }
107
+ function isUnsettledBody(raw) {
108
+ try {
109
+ return isRecord(raw) && !('outcome' in raw) && raw.errorCode === UNSETTLED_CODE;
110
+ }
111
+ catch {
112
+ return false;
113
+ }
114
+ }
91
115
  export function classifyMcpReconnectFailure(e) {
92
116
  let code;
93
117
  try {
@@ -96,6 +120,8 @@ export function classifyMcpReconnectFailure(e) {
96
120
  catch {
97
121
  return { kind: 'failed', error: e };
98
122
  }
123
+ if (code === UNSETTLED_CODE)
124
+ return unsettledVerdict(e);
99
125
  if (code === 'steering.invalid_content')
100
126
  return { kind: 'invalid' };
101
127
  if (code === 'steering.not_running')
@@ -123,6 +149,8 @@ export async function reconnectMcpServer(client, sessionId, server, opts) {
123
149
  return { kind: 'failed', error: opts.signal.reason ?? new Error('mcpReconnect: aborted before the verb was called') };
124
150
  }
125
151
  const raw = await client.sessions.mcpReconnect(sessionId, { server }, opts?.signal ? { signal: opts.signal } : undefined);
152
+ if (isUnsettledBody(raw))
153
+ return unsettledVerdict(raw);
126
154
  const view = projectMcpReconnectResult(raw);
127
155
  if (view === undefined)
128
156
  return { kind: 'failed', error: new Error('mcpReconnect: malformed body') };
@@ -35,9 +35,9 @@ export function memoryComplianceVerbsAvailable(reading) {
35
35
  export function memoryComplianceDoctorDetail(reading) {
36
36
  switch (reading.kind) {
37
37
  case 'unobserved':
38
- return 'memory compliance face not observed — the engine reports it on /v1/capabilities (memoryCompliance); this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)';
38
+ return 'memory compliance face not observed — the engine reports it on /v1/capabilities (memoryCompliance); 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)';
39
39
  case 'not_reported':
40
- return 'memory compliance face not reported by this engine — only newer engines advertise it; this does not say whether the provenance and erasure endpoints exist, probe them directly';
40
+ return 'memory compliance face not reported by this engine; this does not say whether the provenance and erasure endpoints exist, probe them directly';
41
41
  case 'absent':
42
42
  return `memory compliance face off on this deployment — the entry-provenance and erasure endpoints are unavailable (${MEMORY_ENGINE_REQUIRED_CODE}); the engine does not say which half is missing (a memory backend that does not own the engine control plane, or an empty operator roster), so do not guess`;
43
43
  case 'present':
@@ -35,9 +35,9 @@ export function memoryOriginVerbsAvailable(reading) {
35
35
  export function memoryOriginDoctorDetail(reading) {
36
36
  switch (reading.kind) {
37
37
  case 'unobserved':
38
- return 'external-origin face not observed — the engine reports it on /v1/capabilities (memoryOrigin); this process has no usable capabilities reading cached for it (none received, or the last one was unreadable)';
38
+ return 'external-origin face not observed — the engine reports it on /v1/capabilities (memoryOrigin); 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)';
39
39
  case 'not_reported':
40
- return 'external-origin face not reported by this engine — only newer engines advertise it; this does not say whether the origin listing and clearance endpoints exist, probe them directly';
40
+ return 'external-origin face not reported by this engine; this does not say whether the origin listing and clearance endpoints exist, probe them directly';
41
41
  case 'absent':
42
42
  return `external-origin face off on this deployment — the origin listing and clearance endpoints are unavailable (${MEMORY_ENGINE_REQUIRED_CODE}); the engine does not say which half is missing (a memory backend that does not own the engine control plane, or an empty operator roster), so do not guess`;
43
43
  case 'present':
@@ -19,7 +19,7 @@ export interface MemoryFacade {
19
19
  signal?: AbortSignal;
20
20
  }): Promise<MemoryOriginClearReceipt>;
21
21
  }
22
- export declare const MEMORY_VERB_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "store_absent", "operator_only", "unauthorized", "service_token_required", "id_invalid", "request_id_required", "body_shape", "query_invalid", "selector_invalid", "evidence_unavailable", "selector_mismatch", "census_incomplete", "clear_unattributed", "clear_invalid", "clear_not_marked", "clear_challenged", "clear_conflict", "clear_pending"];
22
+ export declare const MEMORY_VERB_REFUSAL_CAUSES: readonly ["face_absent", "client_too_old", "unreadable_request", "store_absent", "operator_only", "operators_unconfigured", "unauthorized", "service_token_required", "id_invalid", "request_id_required", "body_shape", "query_invalid", "selector_invalid", "evidence_unavailable", "selector_mismatch", "census_incomplete", "clear_unattributed", "clear_invalid", "clear_not_marked", "clear_challenged", "clear_conflict", "clear_pending"];
23
23
  export type MemoryVerbRefusalCause = (typeof MEMORY_VERB_REFUSAL_CAUSES)[number];
24
24
  export declare const MEMORY_VERB_UNKNOWN_WHYS: readonly ["no_verdict", "server_fault", "control_plane_corrupt", "clear_unknown", "clear_failed", "result_unreadable", "unsupported_version", "identity_mismatch", "unclassified"];
25
25
  export type MemoryVerbUnknownWhy = (typeof MEMORY_VERB_UNKNOWN_WHYS)[number];
@@ -8,6 +8,7 @@ export const MEMORY_VERB_REFUSAL_CAUSES = Object.freeze([
8
8
  'unreadable_request',
9
9
  'store_absent',
10
10
  'operator_only',
11
+ 'operators_unconfigured',
11
12
  'unauthorized',
12
13
  'service_token_required',
13
14
  'id_invalid',
@@ -51,6 +52,8 @@ export function classifyMemoryFailure(e) {
51
52
  return refusedBy('unauthorized', message);
52
53
  case 'auth.operator_only':
53
54
  return refusedBy('operator_only', message);
55
+ case 'capability.operator_principals_required':
56
+ return refusedBy('operators_unconfigured', message);
54
57
  case 'auth.service_token_required':
55
58
  return refusedBy('service_token_required', message);
56
59
  case 'capability.memory_engine_required':
@@ -173,7 +176,7 @@ function narrowProvenanceAccount(body, entryId) {
173
176
  let exclusionCode;
174
177
  try {
175
178
  if (!plainObject(body))
176
- return { ok: false, why: 'result_unreadable' };
179
+ return { ok: false, why: 'result_unreadable', what: 'the body is not a plain object' };
177
180
  v = body.v;
178
181
  id = body.id;
179
182
  binding = body.binding;
@@ -188,27 +191,28 @@ function narrowProvenanceAccount(body, entryId) {
188
191
  exclusionCode = plainObject(exclusion) ? exclusion.code : undefined;
189
192
  }
190
193
  catch {
191
- return { ok: false, why: 'result_unreadable' };
194
+ return { ok: false, why: 'result_unreadable', what: 'the body threw when read' };
192
195
  }
193
196
  if (typeof v !== 'number' || !Number.isFinite(v))
194
- return { ok: false, why: 'result_unreadable' };
197
+ return { ok: false, why: 'result_unreadable', what: 'the envelope version is missing or not a number' };
195
198
  if (v !== PROVENANCE_ACCOUNT_VERSION)
196
- return { ok: false, why: 'unsupported_version' };
199
+ return { ok: false, why: 'unsupported_version', what: 'the envelope version is newer than this client knows' };
197
200
  if (!nonEmptyString(id))
198
- return { ok: false, why: 'result_unreadable' };
201
+ return { ok: false, why: 'result_unreadable', what: 'the entry id is missing or empty' };
199
202
  if (!plainObject(binding) || !nonEmptyString(bindingState))
200
- return { ok: false, why: 'result_unreadable' };
203
+ return { ok: false, why: 'result_unreadable', what: 'the binding is missing or has no usable state' };
201
204
  if (!plainObject(custody) || !nonEmptyString(custodyState) || !Array.isArray(custodyEvents)) {
202
- return { ok: false, why: 'result_unreadable' };
203
- }
204
- if (!Array.isArray(contributors) || !nonEmptyString(contentState)) {
205
- return { ok: false, why: 'result_unreadable' };
205
+ return { ok: false, why: 'result_unreadable', what: 'the custody chain is missing or has no usable state or event list' };
206
206
  }
207
+ if (!Array.isArray(contributors))
208
+ return { ok: false, why: 'result_unreadable', what: 'the contributor list is missing or not a list' };
209
+ if (!nonEmptyString(contentState))
210
+ return { ok: false, why: 'result_unreadable', what: 'the content state is missing or empty' };
207
211
  if (hasExclusion && !(plainObject(exclusion) && nonEmptyString(exclusionCode))) {
208
- return { ok: false, why: 'result_unreadable' };
212
+ return { ok: false, why: 'result_unreadable', what: 'the exclusion record is present but unreadable' };
209
213
  }
210
214
  if (id !== entryId)
211
- return { ok: false, why: 'identity_mismatch' };
215
+ return { ok: false, why: 'identity_mismatch', what: 'the account is for a different entry id' };
212
216
  return { ok: true, account: body };
213
217
  }
214
218
  export async function readEntryProvenance(facade, call, opts) {
@@ -235,7 +239,7 @@ export async function readEntryProvenance(facade, call, opts) {
235
239
  ? 'the provenance account came back stamped with a newer envelope version than this client knows — refusing to reinterpret it; upgrade the client'
236
240
  : narrowed.why === 'identity_mismatch'
237
241
  ? 'the provenance account came back for a different entry id than the one that was asked about — refusing to present it as this entry account'
238
- : 'the provenance call answered 2xx with a body this client cannot branch on (envelope, entry id, binding or custody) — refusing to present it as an account');
242
+ : `the provenance call answered 2xx with a body this client cannot branch on (${narrowed.what}) — refusing to present it as an account`);
239
243
  }
240
244
  return { status: 'account', account: narrowed.account };
241
245
  }
@@ -1,4 +1,5 @@
1
1
  import { PROVIDER_PRESETS } from './providerPresets.js';
2
+ import { SETTINGS_MODEL_API_WORDS } from '../generated/settingsSchemaTables.js';
2
3
  export const CATALOG_SCHEMA_VERSION_MIN = 1;
3
4
  export const CATALOG_SCHEMA_VERSION_MAX = 1;
4
5
  export function isSupportedCatalogSchemaVersion(v) {
@@ -15,7 +16,7 @@ function isProviderRow(v) {
15
16
  r.id.length > 0 &&
16
17
  typeof r.name === 'string' &&
17
18
  typeof r.baseUrl === 'string' &&
18
- (r.api === 'anthropic-messages' || r.api === 'openai-completions') &&
19
+ typeof r.api === 'string' && SETTINGS_MODEL_API_WORDS.includes(r.api) &&
19
20
  typeof r.authEnv === 'string' &&
20
21
  Array.isArray(r.models));
21
22
  }
@@ -1,3 +1,5 @@
1
+ import type { SETTINGS_MODEL_API_WORDS } from '../generated/settingsSchemaTables.js';
2
+ export type ModelApiWord = (typeof SETTINGS_MODEL_API_WORDS)[number];
1
3
  export type PresetModel = {
2
4
  id: string;
3
5
  contextWindow: number;
@@ -8,7 +10,7 @@ export type ProviderPreset = {
8
10
  id: string;
9
11
  name: string;
10
12
  baseUrl: string;
11
- api: 'anthropic-messages' | 'openai-completions';
13
+ api: ModelApiWord;
12
14
  authEnv: string;
13
15
  models: PresetModel[];
14
16
  modelViaFamily?: boolean;
@@ -1,4 +1,5 @@
1
- export type Tier = 'ultra' | 'max' | 'pro' | 'flash' | 'lite';
1
+ import { CORE_DEFAULT_TIER_ORDER } from '../generated/engineFactTables.js';
2
+ export type Tier = (typeof CORE_DEFAULT_TIER_ORDER)[number];
2
3
  export declare const TIER_ORDER: readonly Tier[];
3
4
  export declare const SURFACED_TIERS: readonly Tier[];
4
5
  export declare const CC_TIER_ALIASES: Readonly<Record<string, Tier>>;