@sema-agent/client-core 0.101.0 → 0.103.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 (125) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +19 -11
  3. package/dist/adapt/toolCards.d.ts +4 -2
  4. package/dist/adapt/toolCards.js +22 -6
  5. package/dist/adapt.d.ts +1 -1
  6. package/dist/adapt.js +1 -1
  7. package/dist/adapter/downstream/eventToSdkMessage.d.ts +5 -1
  8. package/dist/adapter/downstream/eventToSdkMessage.js +26 -70
  9. package/dist/adapter/downstream/terminalToSdkResult.js +0 -1
  10. package/dist/adapter/downstream/wiringManifestView.d.ts +1 -0
  11. package/dist/adapter/downstream/wiringManifestView.js +141 -0
  12. package/dist/cloudConfigWireCaps.js +6 -3
  13. package/dist/compensations.js +1 -1
  14. package/dist/credentialPlaneCapability.d.ts +22 -0
  15. package/dist/credentialPlaneCapability.js +75 -0
  16. package/dist/deviceExecutorManagementCapability.d.ts +1 -0
  17. package/dist/deviceExecutorManagementCapability.js +3 -1
  18. package/dist/displayUntrusted.d.ts +8 -4
  19. package/dist/displayUntrusted.js +769 -96
  20. package/dist/engineErrorCodes.d.ts +1 -0
  21. package/dist/engineErrorCodes.js +3 -1
  22. package/dist/engineNoticeCodes.d.ts +26 -0
  23. package/dist/engineNoticeCodes.js +121 -12
  24. package/dist/engineRowRef.js +2 -0
  25. package/dist/errorSupplementRoles.js +1 -3
  26. package/dist/eventLeg.js +2 -1
  27. package/dist/fleet/fleetProjection.js +16 -10
  28. package/dist/gateOutcome.d.ts +20 -0
  29. package/dist/gateOutcome.js +89 -0
  30. package/dist/generated/engineAskFaceTables.js +2 -2
  31. package/dist/generated/engineFactTables.d.ts +6 -2
  32. package/dist/generated/engineFactTables.js +41 -1
  33. package/dist/generated/engineNoticeTables.js +18 -0
  34. package/dist/generated/settingsSchemaDefaultModel.d.ts +1 -1
  35. package/dist/generated/settingsSchemaDefaultModel.js +2 -2
  36. package/dist/generated/settingsSchemaFns.d.ts +15 -0
  37. package/dist/generated/settingsSchemaFns.js +25 -2
  38. package/dist/generated/settingsSchemaHooksClassifier.js +109 -29
  39. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
  40. package/dist/generated/settingsSchemaMcpRequestEntry.js +213 -93
  41. package/dist/generated/settingsSchemaMcpServerName.d.ts +1 -0
  42. package/dist/generated/settingsSchemaMcpServerName.js +8 -0
  43. package/dist/generated/settingsSchemaOwnKeyRead.d.ts +1 -0
  44. package/dist/generated/settingsSchemaOwnKeyRead.js +172 -0
  45. package/dist/generated/settingsSchemaPlainJsonObject.d.ts +1 -0
  46. package/dist/generated/settingsSchemaPlainJsonObject.js +28 -0
  47. package/dist/generated/settingsSchemaSafetyMergeSpec.js +10 -7
  48. package/dist/generated/settingsSchemaTierWords.d.ts +1 -0
  49. package/dist/generated/settingsSchemaTierWords.js +7 -0
  50. package/dist/generated/settingsSchemaTypes.d.ts +3 -1
  51. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  52. package/dist/hitl/decisionConflict.js +11 -11
  53. package/dist/hitl/decisionRefusal.d.ts +1 -0
  54. package/dist/hitl/decisionRefusal.js +4 -2
  55. package/dist/hitl/editedRuleTextPrecheck.d.ts +1 -0
  56. package/dist/hitl/editedRuleTextPrecheck.js +26 -1
  57. package/dist/hitl/persistedRulesWire.js +1 -0
  58. package/dist/hitl/planReviewWire.d.ts +2 -1
  59. package/dist/hitl/planReviewWire.js +8 -12
  60. package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
  61. package/dist/hitl/sessionPolicyDeliverable.js +0 -5
  62. package/dist/hitl/sessionPolicyWire.js +1 -1
  63. package/dist/hitl/toolApprovalWire.d.ts +18 -6
  64. package/dist/hitl/toolApprovalWire.js +9 -4
  65. package/dist/i18n/messages.en.d.ts +43 -0
  66. package/dist/i18n/messages.en.js +44 -1
  67. package/dist/i18n/messages.zh.js +46 -1
  68. package/dist/index.d.ts +11 -2
  69. package/dist/index.js +7 -1
  70. package/dist/inheritEnvWire.d.ts +1 -0
  71. package/dist/inheritEnvWire.js +8 -5
  72. package/dist/interactiveHalt.d.ts +3 -1
  73. package/dist/interactiveHalt.js +2 -0
  74. package/dist/interactiveInterrupt.d.ts +2 -0
  75. package/dist/interactiveInterrupt.js +15 -0
  76. package/dist/mcpEngineLeg.d.ts +3 -0
  77. package/dist/mcpEngineLeg.js +4 -1
  78. package/dist/mcpLiveness.d.ts +18 -0
  79. package/dist/mcpLiveness.js +48 -1
  80. package/dist/mcpReconnect.d.ts +3 -0
  81. package/dist/mcpReconnect.js +6 -0
  82. package/dist/mcpStatusSupersetKeys.js +24 -1
  83. package/dist/mcpWireCaps.d.ts +2 -3
  84. package/dist/mcpWireCaps.js +9 -8
  85. package/dist/memoryEntriesWire.d.ts +35 -1
  86. package/dist/memoryEntriesWire.js +110 -14
  87. package/dist/modsFace.d.ts +8 -0
  88. package/dist/modsFace.js +63 -0
  89. package/dist/ownKey.d.ts +1 -0
  90. package/dist/ownKey.js +15 -0
  91. package/dist/postureKnob.js +1 -1
  92. package/dist/prepareRefusal.d.ts +0 -1
  93. package/dist/prepareRefusal.js +0 -3
  94. package/dist/printToolResultFrame.js +1 -1
  95. package/dist/promptProfileWireCaps.d.ts +1 -3
  96. package/dist/promptProfileWireCaps.js +2 -2
  97. package/dist/request/printNotification.js +1 -1
  98. package/dist/request/taskRequest.d.ts +22 -1
  99. package/dist/request/taskRequest.js +126 -10
  100. package/dist/retryStatus.d.ts +13 -1
  101. package/dist/retryStatus.js +20 -5
  102. package/dist/seam.js +1 -1
  103. package/dist/seatContract.d.ts +22 -6
  104. package/dist/seatContract.js +45 -6
  105. package/dist/sessionBackground.d.ts +165 -0
  106. package/dist/sessionBackground.js +781 -0
  107. package/dist/sessionBackgroundHandoff.d.ts +54 -0
  108. package/dist/sessionBackgroundHandoff.js +321 -0
  109. package/dist/sessionMap.js +4 -1
  110. package/dist/sessionMemoryErase.js +24 -2
  111. package/dist/settingsCredentialKeyPaths.js +2 -17
  112. package/dist/thinkingLatch.d.ts +69 -0
  113. package/dist/thinkingLatch.js +255 -0
  114. package/dist/thinkingLatchWords.d.ts +7 -0
  115. package/dist/thinkingLatchWords.js +4 -0
  116. package/dist/toolResult.js +2 -24
  117. package/dist/turnFailurePresentation.js +8 -1
  118. package/dist/wireFailureShape.d.ts +12 -1
  119. package/dist/wireFailureShape.js +58 -24
  120. package/dist/wireRefusalCopy.d.ts +0 -3
  121. package/dist/wireRefusalCopy.js +0 -17
  122. package/docs/INTEGRATION-CLIENTS.md +458 -14
  123. package/package.json +5 -5
  124. package/dist/argvFlagValue.d.ts +0 -8
  125. package/dist/argvFlagValue.js +0 -37
@@ -184,6 +184,7 @@ const ZH = {
184
184
  'config.mcp.nameEdgeWhitespace': 'MCP 服务器名 {name}{where} 不能照原样使用,所以没有启动:它与其他设置里的同名对不上(例如禁用服务器列表)。请去掉名字里多余的空白。',
185
185
  'config.mcp.nameCollides': 'MCP 服务器名 {name}{where} 不能照原样使用,所以没有启动:去掉首尾空白后会与另一条 MCP 服务器重名。请去掉名字里多余的空白,或删掉重复的一条。',
186
186
  'config.mcp.nameTooLong': 'MCP 服务器名 {name}{where} 不可用,所以没有启动:服务器名最长 128 个字符。请缩短名字。',
187
+ 'config.mcp.nameReserved': 'MCP 服务器名 {name}{where} 不可用,所以没有启动:以 "remote-" 开头的名字留给已连接设备提供的 MCP 服务器。请给这台服务器换个名字。',
187
188
  'config.mcp.identityHeadersBothSet': 'MCP 服务器 {name}{where} 没有启动:它同时设置了 principalHeader 和 assertionHeader,而这两项指的是同一个身份头 —— 只保留其中一项。其他 MCP 服务器不受影响。',
188
189
  'config.mcp.transportUnreadable': '读不出(声明上的取值器或代理陷阱抛了错)',
189
190
  'config.mcp.transportInvalid': 'MCP 服务器 {name}{where} 没有启动:它的传输设置不可用 —— {path} {problem}。请修正这台服务器的这项设置(或删掉这台服务器);其他 MCP 服务器不受影响。',
@@ -302,7 +303,7 @@ const ZH = {
302
303
  'session.inheritEnv.withheld.scrub': '这次请求没有带上它:引擎的版本还不知道,所以缺省环境这项设置没有带;效果相同,因为不带它同样让这次 run 拿到缺省环境(看着像凭据的变量已去掉)。',
303
304
  'session.inheritEnv.withheld.unknown': '这次请求没有带上它:shell 环境这项设置因为一个这个版本不认识的原因被扣下了。',
304
305
  'session.inheritEnv.refusal': '引擎把这次请求当作无效拒掉了,用的是许多不同请求字段共用的一个拒绝码 · 这次请求要求 shell 继承本机的整份环境,而引擎只有在工具直接跑在它自己那台机器上、且请求属于某个会话时才接受这一项;如果它拒的正是这一项,请去掉这项设置(或改用缺省)再发一次',
305
- 'session.inheritEnv.refusalNamed': '引擎拒掉了「让 shell 继承本机整份环境」这项设置,它只有在工具直接跑在它自己那台机器上、且请求属于某个会话时才接受这一项 · 请去掉这项设置(或改用缺省)再发一次',
306
+ 'session.inheritEnv.refusalNamed': '引擎拒掉了这次请求里的 shell 环境设置:这一项只收缺省或本机整份环境两种取值,而整份环境只有在工具直接跑在它自己那台机器上、且请求属于某个会话时才接受 · 请去掉这项设置(或改用缺省)再发一次',
306
307
  'session.projectMemory.withheld.absent': '这次请求没有带上它:这台引擎没有声明支持「别读项目指令文件」这项设置,而不认识它的引擎会拒掉整个请求,所以先扣下了;项目指令文件仍会发给模型。',
307
308
  'session.projectMemory.withheld.declined': '这次请求没有带上它:这台引擎声明了不支持「别读项目指令文件」这项设置,所以先扣下了;项目指令文件仍会发给模型。',
308
309
  'session.projectMemory.withheld.unreadable': '这次请求没有带上它:引擎的能力声明没读到,所以不知道它是否支持「别读项目指令文件」这项设置,而不认识它的引擎会拒掉整个请求,所以先扣下了;项目指令文件仍会发给模型。',
@@ -584,6 +585,8 @@ const ZH = {
584
585
  'notice.wayOut.switchModel': '模型服务此刻无法处理这个请求 —— 请换一个模型试试',
585
586
  'notice.wayOut.wait': '模型服务仍在处理这个请求 —— 请稍等片刻后重试',
586
587
  'notice.wayOut.fixRequest': '模型服务拒绝了这个请求 —— 请修改请求后再发送;原样重发不会有变化',
588
+ 'notice.askUnresolvable.remedy.approver': '出路:接一个能答这类请求的审批人,或让已接的审批人可达,然后重试',
589
+ 'notice.askUnresolvable.remedy.permissionMode': '另一条出路(须本部署允许):{mode} 权限模式会不经人作答就放行这类请求,每一次这样放行都会标在它所放行的那次工具调用上',
587
590
  'rules.refusal.sentence.one': '权限:有 1 条规则不会被执行 —— {list}',
588
591
  'rules.refusal.sentence.other': '权限:有 {count} 条规则不会被执行 —— {list}',
589
592
  'rules.refusal.item': '{rule}({reason})',
@@ -780,6 +783,7 @@ const ZH = {
780
783
  'rules.match.host': '网站域名匹配(单个主机)',
781
784
  'rules.match.subdomain': '网站域名匹配(该域名下的每个主机)',
782
785
  'rules.match.pattern': '命令模式匹配(命令里带星号)',
786
+ 'rules.match.tool': '整个工具匹配(这个工具的每一次调用)',
783
787
  'rules.match.unreported': '没有报告匹配形式',
784
788
  'rules.match.unknown': '这个版本不认识的匹配形式',
785
789
  'model.tier.blurb.ultra': '预留在 max 之上 —— 等更强的模型出现时再绑定',
@@ -1010,9 +1014,50 @@ const ZH = {
1010
1014
  'config.hooks.plan.reason.compactionLocalFallback': '这一次压缩的摘要因引擎会话不可用而在本客户端本地生成,引擎不会替它运行这只 hook,所以由本客户端自己运行',
1011
1015
  'session.hooks.compactTransition.disclosure.engineOutcomeUnknown': '摘要改走本客户端时,压缩请求已经发给了引擎,所以引擎有没有运行压缩 hook 这里判不了,本客户端也没有再运行一遍。',
1012
1016
  'session.hooks.compactTransition.disclosure.neitherRan': '这一次压缩 hook 没有运行:引擎没有在这里压缩,本客户端的本地摘要也没能启动。引擎之后若仍会压缩,到时会运行它们。',
1017
+ 'session.background.handedOff': '已转到后台,结束时会告诉你。',
1018
+ 'session.background.refusal.noRun': '这块屏上没有可以转后台的、正在跑的回答。',
1019
+ 'session.background.refusal.streamEnded': '这条回答已不在最初的实时连接上,不能从这里转后台。',
1020
+ 'session.background.refusal.notStarted': '引擎还没开始输出这条回答,稍后再试。',
1021
+ 'session.background.refusal.alreadyHandedOff': '这条回答已经在后台了。',
1022
+ 'session.background.refusal.finished': '这条回答已经结束了。',
1023
+ 'session.background.refusal.stopping': '这条回答正在被停止,不能转后台。',
1024
+ 'session.background.refusal.engineReplaced': '跑这条回答的引擎已停止或被替换,无法转后台。',
1025
+ 'session.background.refusal.declined': '无法转后台:这台引擎不会在你离开后继续跑回答。它会在这里跑完。',
1026
+ 'session.background.refusal.envOff': '送后台已被关闭(SEMA_HEADLESS_DETACH)。这条回答会在这里跑完。',
1027
+ 'session.background.refusal.notReattachable': '无法转后台:这个窗口接不回在别处跑的回答。',
1028
+ 'session.background.refusal.unconfirmed': '无法转后台:引擎还没确认它能独立跑完回答。',
1029
+ 'session.background.refusal.durableOff': '无法转后台:引擎表示你离开后它没法继续跑这条回答。',
1030
+ 'session.background.refusal.awaitingUser': '先回答屏上的问题 —— 正在等你回答的回答不能转后台。',
1031
+ 'session.background.unknown': '没法确认这条回答能安全转后台,所以它留在这里。',
1032
+ 'session.background.hostNotNotified': '已转到后台,但这块屏没能正常收尾。',
1033
+ 'session.background.settled.completed': '后台回答已完成。',
1034
+ 'session.background.settled.failed': '后台回答出错停止({code})。',
1035
+ 'session.background.settled.cancelled': '后台回答已取消。',
1036
+ 'session.background.settled.parked': '后台回答停在等批准上,打开它继续。',
1037
+ 'session.background.settled.observationStopped': '看不到后台回答了。它可能还在跑 —— 去任务列表看。',
1038
+ 'session.background.busy': '这个对话的回答还在后台跑。等它结束,或开个新对话。',
1039
+ 'session.thinking.state.on': '思考已开启',
1040
+ 'session.thinking.state.off': '思考已关闭',
1041
+ 'session.thinking.state.unset': '思考未设置:由思考档位决定,没有档位时交给引擎默认',
1042
+ 'session.thinking.offWithUltracodeOnBody': '这条消息同时带了 Ultracode 与关闭思考,以哪个为准由引擎决定。',
1043
+ 'session.thinking.modelCannotThink': '思考已开启,但模型 {model} 不使用扩展思考,这一设置对它不起作用。',
1044
+ 'session.thinking.storeUnreadable': '读不出思考设置,按未设处理:不加开关的限制,由思考档位决定。',
1045
+ 'session.thinking.notSaved': '思考设置没有存上,可能没有改变。',
1046
+ 'config.mods.card.mounted': '{name} 已装载',
1047
+ 'config.mods.card.refused': '{name} 没有装载:{refusedBy} 拒绝了它 —— {reason}',
1048
+ 'config.mods.card.none': '本腿没有注册的 mod',
1049
+ 'config.mods.card.counts': '{n} 已装载',
1050
+ 'config.mods.card.countsWithRefused': '{n} 已装载,{m} 被拒',
1051
+ 'config.mods.loader.failed': '{name} 装载失败:{reason}',
1052
+ 'config.mods.loader.failedNoReason': '{name} 装载失败',
1053
+ 'config.mods.refusal.by': '被 {by} 拒绝',
1054
+ 'config.mods.rewrite.resultInPlace': '由 {by} 代替工具作答',
1055
+ 'config.mods.rewrite.inputBy': '参数在放行前被 {by} 改过',
1013
1056
  };
1014
1057
  export const ZH_MESSAGES = Object.freeze(ZH);
1015
1058
  export const TERM_SLOTS = Object.freeze({
1059
+ 'session.background.refusal.envOff': ['SEMA_HEADLESS_DETACH'],
1060
+ 'session.thinking.offWithUltracodeOnBody': ['Ultracode'],
1016
1061
  'config.mcp.toolAxesInvalid': ['toolAxes'],
1017
1062
  'config.mcp.toolFacesInvalid': ['toolFaces'],
1018
1063
  'config.mcp.cloudToolAxesInvalid': ['toolAxes'],
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export * from './memoryOriginCapability.js';
50
50
  export * from './memoryEntriesWire.js';
51
51
  export * from './memoryVerbsWire.js';
52
52
  export * from './deviceExecutorManagementCapability.js';
53
+ export * from './credentialPlaneCapability.js';
53
54
  export * from './mcpReconnect.js';
54
55
  export * from './hitl/parkExpiryJudgements.js';
55
56
  export * from './usageAnalytics.js';
@@ -118,7 +119,7 @@ export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminde
118
119
  export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
119
120
  export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_IMAGE_INDEX_REQUIRED, CAPABILITY_K8S_LANE_REQUIRED, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MCP_SERVER_NAME_COLLISION, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_OUTPUT_STYLE_INVALID, CONFIG_TOOL_FACE_CONTROL, CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_ROW_UNREVIVABLE, 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, idempotencyPayloadMismatchContent, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, isDelegationCapCode, isIdempotencyPayloadMismatchCode, 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, MCP_TOOL_DECLARATION_CHANGED, MCP_TOOL_LISTING_UNREACHED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, PROMPT_ASSEMBLED_ROLE_REFUSED, REQUEST_AUTONOMY_LANE_REFUSED, 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, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
120
121
  export type { DelegationCapDisposition, ModelFallbackReason, OperatorGateRefusal, RunDeathVerdictCode, } from './engineErrorCodes.js';
121
- export { imageInvalidFailureNoteOf, prepareRefusalCodeOf, prepareRefusalNoteOf, type PrepareRefusalCode, type PrepareRefusalNoteFacts } from './prepareRefusal.js';
122
+ export { prepareRefusalCodeOf, prepareRefusalNoteOf, type PrepareRefusalCode, type PrepareRefusalNoteFacts } from './prepareRefusal.js';
122
123
  export * from './agentsWireCaps.js';
123
124
  export { engineToolDirectoryOf } from './engineToolDirectory.js';
124
125
  export type { EngineToolDirectory, EngineToolDirectorySource } from './engineToolDirectory.js';
@@ -161,6 +162,8 @@ export * from './effortWire.js';
161
162
  export * from './adapter/types.js';
162
163
  export * from './adapter/downstream/turnUsageToModelUsage.js';
163
164
  export * from './adapter/downstream/eventToSdkMessage.js';
165
+ export { MOD_LOADER_VERBS, readModRegistrationRefusedNotice, modCardSentence, modLoaderFailureSentence, type ModLoaderVerb } from './modsFace.js';
166
+ export { modRowsOf } from './adapter/downstream/wiringManifestView.js';
164
167
  export type { WiringManifestView, WiringManifestSections, WiringManifestFleetView } from './adapter/downstream/wiringManifestView.js';
165
168
  export { wiringFleetDoctorDetail } from './wiringFleetDoctor.js';
166
169
  export * from './adapter/downstream/terminalToSdkResult.js';
@@ -352,6 +355,10 @@ export * from './hitl/askSettlementLine.js';
352
355
  export * from './interactiveHalt.js';
353
356
  export { fireInteractiveInterrupt } from './interactiveInterrupt.js';
354
357
  export type { InteractiveInterruptRuns, InteractiveInterruptOptions } from './interactiveInterrupt.js';
358
+ export { readSessionBackgroundable, projectSessionBackgroundable, interactiveEngineWire, retireInteractiveEngineWire, interactiveDetachPosture, streamInteractiveRun, backgroundHandoffEligibility, backgroundHandoffSentence, interactiveStopFacts, } from './sessionBackground.js';
359
+ export type { SessionBackgroundableReading, InteractiveEngineLane, InteractiveEngineWireInit, InteractiveEngineWire, InteractiveOpeningInput, InteractiveDetachPostureReason, InteractiveDetachPosture, InteractiveStreamOptions, BackgroundHandoffVerdict, BackgroundHandoffRefusal, BackgroundHandoffUnknown, InteractiveStopFacts, } from './sessionBackground.js';
360
+ export { BACKGROUND_HANDOFF_ABORT_REASON, handoffInteractiveRun, handedOffRunsOf, forgetHandedOffRun } from './sessionBackgroundHandoff.js';
361
+ export type { BackgroundHandoffRequest, BackgroundHandoffOutcome, BackgroundRun, BackgroundRunSettlement, HandedOffRunRow, HandedOffRunsReading, } from './sessionBackgroundHandoff.js';
355
362
  export { listDevices, readSessionBinding, rebindSession, reconcileRebindOutcome, rebindProvesRequestNotApplied } from './deviceRebind.js';
356
363
  export { issueEnrollToken, enrollDevice, revokeDevice, deviceIdentityMismatchOf, deviceIdentityMismatchLine, deviceRegistrationOutcomeLine } from './deviceRebind.js';
357
364
  export type { DeviceSummary, DeviceListResult, DeviceBinding, DeviceSessionBinding, DeviceRebindRequest, DeviceRevokeRequest, DeviceRebindResult, DeviceEnrollToken, DeviceEnrollRequest, DeviceEnrollResult, DeviceRevokeResult, } from '@sema-agent/sdk';
@@ -363,6 +370,8 @@ export * from './request/printNotification.js';
363
370
  export * from './seatContract.js';
364
371
  export { mcpToolTogglesToExcludeTools } from './mcpToolToggles.js';
365
372
  export type { McpToolToggleKey, McpMountedServers } from './mcpToolToggles.js';
373
+ export { readThinkingLatch, writeThinkingLatch, thinkingLatchView, thinkingLatchSentence, thinkingLatchRowWordOf, readSeatThinkingLatch } from './thinkingLatch.js';
374
+ export type { ThinkingLatchState, ThinkingLatchEvent, ThinkingLatchRowWord, ThinkingLatchStorePort, ThinkingLatchReading, ThinkingLatchWriteOutcome, ThinkingLatchView, ThinkingLatchCarrier, ThinkingLatchSentenceSubject, } from './thinkingLatch.js';
366
375
  export { devicesFaceOf, devicesWritesAllowed, devicesFaceDetail } from './devicesFace.js';
367
376
  export type { DevicesFace, DevicesFaceInput, DevicesFaceUnavailableWhy } from './devicesFace.js';
368
377
  export { cloudLoginFailureOf, cloudLoginFailureText, engineTargetRefusalText, seatMcpReadingOf, watchEngineTarget } from './engineTargetSeat.js';
@@ -395,7 +404,7 @@ export * from './env/uiLanguage.js';
395
404
  export { EN_MESSAGES, type MessageKey } from './i18n/messages.en.js';
396
405
  export { ZH_MESSAGES } from './i18n/messages.zh.js';
397
406
  export { createMissLedger, createTranslator, DATA_FACE_LANGUAGE, msg, renderMessage, translate, uiMissLedger, type MessageParam, type MessageParams, type MessageRef, type MissLedger, type Translator, } from './i18n/translate.js';
398
- export type { PendingCheckpoint, RuleSuggestion } from '@sema-agent/sdk';
407
+ export type { PendingCheckpoint } from '@sema-agent/sdk';
399
408
  export * from './ruleRemovalConsequence.js';
400
409
  export { engineCredentialRequirementOf } from './engineCredentialRequirement.js';
401
410
  export type { EngineProbeAnswer, EngineCredentialNeed } from './engineCredentialRequirement.js';
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ export * from './memoryOriginCapability.js';
41
41
  export * from './memoryEntriesWire.js';
42
42
  export * from './memoryVerbsWire.js';
43
43
  export * from './deviceExecutorManagementCapability.js';
44
+ export * from './credentialPlaneCapability.js';
44
45
  export * from './mcpReconnect.js';
45
46
  export * from './hitl/parkExpiryJudgements.js';
46
47
  export * from './usageAnalytics.js';
@@ -99,7 +100,7 @@ export * from './classifierVerdictWire.js';
99
100
  export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
100
101
  export { findSystemReminderOpenTag } from './systemReminderTag.js';
101
102
  export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_IMAGE_INDEX_REQUIRED, CAPABILITY_K8S_LANE_REQUIRED, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_AGENT_UNKNOWN_TOOL, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MCP_SERVER_NAME_COLLISION, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_OUTPUT_STYLE_INVALID, CONFIG_TOOL_FACE_CONTROL, CONFLICT_IDEMPOTENCY_PAYLOAD_MISMATCH, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_ROW_UNREVIVABLE, 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, idempotencyPayloadMismatchContent, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, isDelegationCapCode, isIdempotencyPayloadMismatchCode, 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, MCP_TOOL_DECLARATION_CHANGED, MCP_TOOL_LISTING_UNREACHED, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, PROMPT_ASSEMBLED_ROLE_REFUSED, REQUEST_AUTONOMY_LANE_REFUSED, 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, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
102
- export { imageInvalidFailureNoteOf, prepareRefusalCodeOf, prepareRefusalNoteOf } from './prepareRefusal.js';
103
+ export { prepareRefusalCodeOf, prepareRefusalNoteOf } from './prepareRefusal.js';
103
104
  export * from './agentsWireCaps.js';
104
105
  export { engineToolDirectoryOf } from './engineToolDirectory.js';
105
106
  export * from './attachmentsWireCaps.js';
@@ -139,6 +140,8 @@ export * from './effortWire.js';
139
140
  export * from './adapter/types.js';
140
141
  export * from './adapter/downstream/turnUsageToModelUsage.js';
141
142
  export * from './adapter/downstream/eventToSdkMessage.js';
143
+ export { MOD_LOADER_VERBS, readModRegistrationRefusedNotice, modCardSentence, modLoaderFailureSentence } from './modsFace.js';
144
+ export { modRowsOf } from './adapter/downstream/wiringManifestView.js';
142
145
  export { wiringFleetDoctorDetail } from './wiringFleetDoctor.js';
143
146
  export * from './adapter/downstream/terminalToSdkResult.js';
144
147
  export { resultErrorCodeOf, resultSelectedModelOf, resultSalvagedResultOf, resultParkFailedReasonOf } from './resultFrameKeys.js';
@@ -288,6 +291,8 @@ export { approvalCompleteCauseOf } from './hitl/approvalEndingCause.js';
288
291
  export * from './hitl/askSettlementLine.js';
289
292
  export * from './interactiveHalt.js';
290
293
  export { fireInteractiveInterrupt } from './interactiveInterrupt.js';
294
+ export { readSessionBackgroundable, projectSessionBackgroundable, interactiveEngineWire, retireInteractiveEngineWire, interactiveDetachPosture, streamInteractiveRun, backgroundHandoffEligibility, backgroundHandoffSentence, interactiveStopFacts, } from './sessionBackground.js';
295
+ export { BACKGROUND_HANDOFF_ABORT_REASON, handoffInteractiveRun, handedOffRunsOf, forgetHandedOffRun } from './sessionBackgroundHandoff.js';
291
296
  export { listDevices, readSessionBinding, rebindSession, reconcileRebindOutcome, rebindProvesRequestNotApplied } from './deviceRebind.js';
292
297
  export { issueEnrollToken, enrollDevice, revokeDevice, deviceIdentityMismatchOf, deviceIdentityMismatchLine, deviceRegistrationOutcomeLine } from './deviceRebind.js';
293
298
  export { resolveEngineEnvSourcing, engineEnvView } from './engineEnvSourcing.js';
@@ -295,6 +300,7 @@ export * from './compensations.js';
295
300
  export * from './request/printNotification.js';
296
301
  export * from './seatContract.js';
297
302
  export { mcpToolTogglesToExcludeTools } from './mcpToolToggles.js';
303
+ export { readThinkingLatch, writeThinkingLatch, thinkingLatchView, thinkingLatchSentence, thinkingLatchRowWordOf, readSeatThinkingLatch } from './thinkingLatch.js';
298
304
  export { devicesFaceOf, devicesWritesAllowed, devicesFaceDetail } from './devicesFace.js';
299
305
  export { cloudLoginFailureOf, cloudLoginFailureText, engineTargetRefusalText, seatMcpReadingOf, watchEngineTarget } from './engineTargetSeat.js';
300
306
  export { KEY_SLOT_PREFIX, keyEnvNameForEntry, onboardBaseUrlProblem, onboardRefusalText, onboardWritePlan, onboardWriteVerdict, poolEntryNameOf, probeModelEndpoint, } from './model/onboardJudgement.js';
@@ -16,6 +16,7 @@ export declare function inheritEnvWithheldNotice(withheld: InheritEnvWithheld, l
16
16
  export interface InheritEnvRefusalDetail {
17
17
  readonly code: string;
18
18
  readonly field?: 'inheritEnv';
19
+ readonly reason?: string;
19
20
  }
20
21
  export declare function inheritEnvRefusalFromError(err: unknown, sentRequest: TaskRequestLike | undefined): InheritEnvRefusalDetail | null;
21
22
  export declare function inheritEnvRefusalContent(detail: InheritEnvRefusalDetail, lang?: UiLanguage): string;
@@ -1,6 +1,6 @@
1
1
  import { msg, renderMessage } from './i18n/translate.js';
2
2
  import { INHERIT_ENV_WORDS, isInheritEnvWord } from './request/taskRequest.js';
3
- import { readRefusalNamedFields } from './wireFailureShape.js';
3
+ import { readRefusalNamedFields, readRefusalSlots } from './wireFailureShape.js';
4
4
  import { engineVersionTier } from './supportFloor.js';
5
5
  import { guardedRead, readOwnDataValue } from './ownKey.js';
6
6
  const EMPTY_DECLARATION = Object.freeze({ field: Object.freeze({}) });
@@ -47,7 +47,8 @@ function readGuarded(o, key) {
47
47
  }
48
48
  export function inheritEnvRefusalFromError(err, sentRequest) {
49
49
  try {
50
- if (readGuarded(sentRequest, 'inheritEnv') !== 'all')
50
+ const sent = readGuarded(sentRequest, 'inheritEnv');
51
+ if (sent === undefined)
51
52
  return null;
52
53
  if (readGuarded(err, 'errorCode') !== FIELD_INVALID)
53
54
  return null;
@@ -55,9 +56,11 @@ export function inheritEnvRefusalFromError(err, sentRequest) {
55
56
  return null;
56
57
  const named = readRefusalNamedFields(err);
57
58
  if (named.length === 0)
58
- return Object.freeze({ code: FIELD_INVALID });
59
- if (named.includes(INHERIT_ENV_FIELD))
60
- return Object.freeze({ code: FIELD_INVALID, field: INHERIT_ENV_FIELD });
59
+ return sent === 'all' ? Object.freeze({ code: FIELD_INVALID }) : null;
60
+ if (named.includes(INHERIT_ENV_FIELD)) {
61
+ const reason = guardedRead(() => readRefusalSlots(err, ['reason']).reason.word);
62
+ return Object.freeze({ code: FIELD_INVALID, field: INHERIT_ENV_FIELD, ...(typeof reason === 'string' && reason.length > 0 ? { reason } : {}) });
63
+ }
61
64
  return null;
62
65
  }
63
66
  catch {
@@ -11,13 +11,15 @@ export type InteractiveHaltInterruptOutcome = {
11
11
  } | {
12
12
  kind: 'transport';
13
13
  detail?: string | undefined;
14
+ } | {
15
+ kind: 'withheld';
14
16
  };
15
17
  export interface InteractiveHaltInput {
16
18
  readonly parked?: boolean | undefined;
17
19
  readonly detachArmed?: boolean | undefined;
18
20
  readonly interruptOutcome?: InteractiveHaltInterruptOutcome | undefined;
19
21
  }
20
- export type InteractiveHaltReason = 'first-shot' | 'halted' | 'engine-says-run-level' | 'no-verdict-on-parked-card' | 'no-verdict-detach-armed' | 'no-verdict-not-parked' | 'refused-no-escalation' | 'unknown-outcome';
22
+ export type InteractiveHaltReason = 'first-shot' | 'halted' | 'engine-says-run-level' | 'no-verdict-on-parked-card' | 'no-verdict-detach-armed' | 'no-verdict-not-parked' | 'refused-no-escalation' | 'unknown-outcome' | 'handed-off';
21
23
  export interface InteractiveHaltPlan {
22
24
  readonly action: 'interrupt' | 'escalate-cancel' | 'none';
23
25
  readonly reason: InteractiveHaltReason;
@@ -32,6 +32,8 @@ export function planInteractiveHalt(input) {
32
32
  ? { action: 'escalate-cancel', reason: 'engine-says-run-level' }
33
33
  : { action: 'none', reason: 'refused-no-escalation' };
34
34
  }
35
+ if (kind === 'withheld')
36
+ return { action: 'none', reason: 'handed-off' };
35
37
  if (kind === 'transport' || kind === 'unarmed') {
36
38
  if (input.parked === true)
37
39
  return { action: 'escalate-cancel', reason: 'no-verdict-on-parked-card' };
@@ -1,8 +1,10 @@
1
1
  import type { AgentClient } from '@sema-agent/sdk';
2
2
  import type { InteractiveHaltInterruptOutcome } from './interactiveHalt.js';
3
+ import { type InteractiveEngineWire } from './sessionBackground.js';
3
4
  export type InteractiveInterruptRuns = Pick<AgentClient['runs'], 'interrupt'>;
4
5
  export interface InteractiveInterruptOptions {
5
6
  readonly sessionId?: string | undefined;
6
7
  readonly signal?: AbortSignal | undefined;
8
+ readonly wire?: InteractiveEngineWire | undefined;
7
9
  }
8
10
  export declare function fireInteractiveInterrupt(runs: InteractiveInterruptRuns | null | undefined, taskId: string, opts?: InteractiveInterruptOptions): Promise<InteractiveHaltInterruptOutcome>;
@@ -1,5 +1,6 @@
1
1
  import { atMostOnceVerdictOf } from './atMostOnce.js';
2
2
  import { readOwnDataValue } from './ownKey.js';
3
+ import { noteInteractiveStopRequested, ownSlotOf } from './sessionBackground.js';
3
4
  function guardedSlot(e, key) {
4
5
  if (e === null || (typeof e !== 'object' && typeof e !== 'function'))
5
6
  return undefined;
@@ -33,6 +34,20 @@ function turnCutOf(receipt) {
33
34
  }
34
35
  }
35
36
  export async function fireInteractiveInterrupt(runs, taskId, opts = {}) {
37
+ if (opts !== null && typeof opts === 'object') {
38
+ const ws = ownSlotOf(opts, 'wire');
39
+ if (ws.state === 'unreadable')
40
+ return { kind: 'withheld' };
41
+ if (ws.state === 'data') {
42
+ const wire = ws.value;
43
+ if (wire !== null) {
44
+ if (typeof wire !== 'object')
45
+ return { kind: 'withheld' };
46
+ if (noteInteractiveStopRequested(wire, taskId) === 'withheld')
47
+ return { kind: 'withheld' };
48
+ }
49
+ }
50
+ }
36
51
  const verb = guardedSlot(runs, 'interrupt');
37
52
  if (typeof verb !== 'function')
38
53
  return { kind: 'unarmed' };
@@ -1,4 +1,5 @@
1
1
  import type { WiringManifestMcpEntryView } from './adapter/downstream/eventToSdkMessage.js';
2
+ import { type McpAuthorizationView } from './mcpLiveness.js';
2
3
  export type McpEngineLegLiveness = {
3
4
  kind: 'unobserved';
4
5
  } | {
@@ -24,6 +25,8 @@ export type McpEngineLegConnection = {
24
25
  errorCode?: string;
25
26
  delivered?: string;
26
27
  httpStatus?: number;
28
+ authorization?: McpAuthorizationView;
29
+ authorizationUnreadable?: true;
27
30
  } | {
28
31
  state: 'not_connected';
29
32
  cause: 'skipped' | 'not_listed';
@@ -1,4 +1,4 @@
1
- import { isMcpLivenessState } from './mcpLiveness.js';
1
+ import { isMcpLivenessState, readMcpAuthorization } from './mcpLiveness.js';
2
2
  import { mcpSectionDroppedNamedRowsOf } from './ownKey.js';
3
3
  void true;
4
4
  void true;
@@ -121,12 +121,15 @@ export function mcpEngineLegConnectionOf(serverName, rows) {
121
121
  const errorCode = readKey(row, 'errorCode');
122
122
  const delivered = readKey(row, 'delivered');
123
123
  const httpStatus = readKey(row, 'httpStatus');
124
+ const authorization = readMcpAuthorization(row);
125
+ const authorizationUnreadable = authorization.kind === 'unreadable' || readKey(row, 'authorizationUnreadable') === true;
124
126
  return {
125
127
  state: 'not_connected',
126
128
  cause: 'failed',
127
129
  ...(typeof errorCode === 'string' && errorCode !== '' ? { errorCode } : {}),
128
130
  ...(typeof delivered === 'string' && delivered !== '' ? { delivered } : {}),
129
131
  ...(typeof httpStatus === 'number' && Number.isFinite(httpStatus) ? { httpStatus } : {}),
132
+ ...(authorization.kind === 'record' ? { authorization: authorization.authorization } : authorizationUnreadable ? { authorizationUnreadable: true } : {}),
130
133
  };
131
134
  }
132
135
  const rosterReadingOf = (v) => {
@@ -1,4 +1,5 @@
1
1
  import type { McpLivenessState } from '@sema-agent/sdk';
2
+ import { CORE_MCP_FAILURE_KINDS } from './generated/engineFactTables.js';
2
3
  export declare const MCP_LIVENESS_STATES: readonly ["reachable", "unreachable", "unknown"];
3
4
  export type { McpLivenessState };
4
5
  export declare const isMcpLivenessState: (v: unknown) => v is McpLivenessState;
@@ -28,3 +29,20 @@ export interface McpEngineLegHealth {
28
29
  }
29
30
  export declare function mcpLivenessRollupOf(rows: readonly McpLivenessBearingRow[] | undefined): McpEngineLegHealth;
30
31
  export declare function mcpEngineLegHealthDetail(health: McpEngineLegHealth | undefined): string;
32
+ export declare const MCP_FAILURE_KINDS: readonly ["connect_refused", "connection_failed", "connection_closed", "unauthorized", "http_status", "not_mcp_response", "spawn_failed", "timeout", "protocol", "invalid_config", "credential_unavailable", "unknown"];
33
+ export declare const MCP_AUTHORIZATION_REASONS: readonly ["rejected", "scope", "none"];
34
+ export declare const MCP_FAILURE_UNAUTHORIZED: Extract<(typeof CORE_MCP_FAILURE_KINDS)[number], 'unauthorized'>;
35
+ export interface McpAuthorizationView {
36
+ readonly reason: string;
37
+ readonly authorizeUrl?: string;
38
+ readonly resourceMetadataUrl?: string;
39
+ }
40
+ export type McpAuthorizationCell = {
41
+ readonly kind: 'absent';
42
+ } | {
43
+ readonly kind: 'unreadable';
44
+ } | {
45
+ readonly kind: 'record';
46
+ readonly authorization: McpAuthorizationView;
47
+ };
48
+ export declare function readMcpAuthorization(row: {} | null | undefined): McpAuthorizationCell;
@@ -1,4 +1,4 @@
1
- import { CORE_MCP_LIVENESS_STATES } from './generated/engineFactTables.js';
1
+ import { CORE_MCP_AUTHORIZATION_REASONS, CORE_MCP_FAILURE_KINDS, CORE_MCP_LIVENESS_STATES } from './generated/engineFactTables.js';
2
2
  export const MCP_LIVENESS_STATES = CORE_MCP_LIVENESS_STATES;
3
3
  void MCP_LIVENESS_STATES;
4
4
  void true;
@@ -100,3 +100,50 @@ export function mcpEngineLegHealthDetail(health) {
100
100
  + ` cannot tell which cause applies)${unreadable}`;
101
101
  }
102
102
  }
103
+ export const MCP_FAILURE_KINDS = CORE_MCP_FAILURE_KINDS;
104
+ export const MCP_AUTHORIZATION_REASONS = CORE_MCP_AUTHORIZATION_REASONS;
105
+ export const MCP_FAILURE_UNAUTHORIZED = 'unauthorized';
106
+ const ABSENT_AUTHORIZATION = Object.freeze({ kind: 'absent' });
107
+ const UNREADABLE_AUTHORIZATION = Object.freeze({ kind: 'unreadable' });
108
+ function ownDataCell(o, key) {
109
+ try {
110
+ const d = Object.getOwnPropertyDescriptor(o, key);
111
+ if (d === undefined)
112
+ return { kind: 'absent' };
113
+ if (!Object.hasOwn(d, 'value'))
114
+ return { kind: 'unreadable' };
115
+ return { kind: 'value', value: d.value };
116
+ }
117
+ catch {
118
+ return { kind: 'unreadable' };
119
+ }
120
+ }
121
+ const nonEmptyString = (c) => c.kind === 'value' && typeof c.value === 'string' && c.value.length > 0 ? c.value : undefined;
122
+ export function readMcpAuthorization(row) {
123
+ try {
124
+ if (!isRecord(row))
125
+ return UNREADABLE_AUTHORIZATION;
126
+ const cell = ownDataCell(row, 'authorization');
127
+ if (cell.kind === 'absent')
128
+ return ABSENT_AUTHORIZATION;
129
+ if (cell.kind === 'unreadable' || !isRecord(cell.value))
130
+ return UNREADABLE_AUTHORIZATION;
131
+ const rec = cell.value;
132
+ const reason = nonEmptyString(ownDataCell(rec, 'reason'));
133
+ if (reason === undefined)
134
+ return UNREADABLE_AUTHORIZATION;
135
+ const authorizeUrl = nonEmptyString(ownDataCell(rec, 'authorizeUrl'));
136
+ const resourceMetadataUrl = nonEmptyString(ownDataCell(rec, 'resourceMetadataUrl'));
137
+ return Object.freeze({
138
+ kind: 'record',
139
+ authorization: Object.freeze({
140
+ reason,
141
+ ...(authorizeUrl !== undefined ? { authorizeUrl } : {}),
142
+ ...(resourceMetadataUrl !== undefined ? { resourceMetadataUrl } : {}),
143
+ }),
144
+ });
145
+ }
146
+ catch {
147
+ return UNREADABLE_AUTHORIZATION;
148
+ }
149
+ }
@@ -1,3 +1,4 @@
1
+ import { type McpAuthorizationView } from './mcpLiveness.js';
1
2
  export declare const MCP_RECONNECT_OUTCOMES: readonly string[];
2
3
  export declare const MCP_RECONNECT_TRANSACTION_NOTICE: string;
3
4
  export declare const MCP_RECONNECT_UNSETTLED_NOTICE: string;
@@ -13,6 +14,8 @@ export interface McpReconnectStatusView {
13
14
  };
14
15
  error?: string;
15
16
  transportClosed?: true;
17
+ authorization?: McpAuthorizationView;
18
+ authorizationUnreadable?: true;
16
19
  }
17
20
  export interface McpReconnectListingIncompleteView {
18
21
  reason: string;
@@ -1,6 +1,7 @@
1
1
  import { capForDisplay } from './fleetTaskDesc.js';
2
2
  import { ownDataField } from './ownKey.js';
3
3
  import { isSessionIdPathSegment } from './sessionIdSegment.js';
4
+ import { readMcpAuthorization } from './mcpLiveness.js';
4
5
  export const MCP_RECONNECT_OUTCOMES = Object.freeze(['accepted', 'refused', 'unsupported']);
5
6
  export const MCP_RECONNECT_TRANSACTION_NOTICE = 'Reconnecting closes the current connection before dialing again. On a healthy server this is a transaction, ' +
6
7
  'not a refresh: a failed re-dial leaves the server down and withdraws its tools from the model until a later re-dial succeeds.';
@@ -33,6 +34,11 @@ function projectStatus(raw) {
33
34
  view.error = capForDisplay(raw.error, RECONNECT_TEXT_MAX);
34
35
  if (raw.transportClosed === true)
35
36
  view.transportClosed = true;
37
+ const authorization = readMcpAuthorization(raw);
38
+ if (authorization.kind === 'record')
39
+ view.authorization = authorization.authorization;
40
+ else if (authorization.kind === 'unreadable')
41
+ view.authorizationUnreadable = true;
36
42
  return view;
37
43
  }
38
44
  function projectListingIncomplete(raw) {
@@ -1,3 +1,4 @@
1
+ import { readMcpAuthorization } from './mcpLiveness.js';
1
2
  import { guardedRead, readOwnDataValue } from './ownKey.js';
2
3
  function slot(input, key) {
3
4
  return guardedRead(() => readOwnDataValue(input, key));
@@ -13,6 +14,9 @@ function shellConnectionOf(input) {
13
14
  ...(typeof error === 'string' && error !== '' ? { error } : {}),
14
15
  });
15
16
  }
17
+ const _legStructuralKeysPin = true;
18
+ void _legStructuralKeysPin;
19
+ const AUTHORIZATION_SEATS = new Set(['authorization', 'authorizationUnreadable']);
16
20
  function frozenCopyOfEngineLeg(leg) {
17
21
  if (typeof leg !== 'object' || leg === null)
18
22
  return undefined;
@@ -24,11 +28,30 @@ function frozenCopyOfEngineLeg(leg) {
24
28
  catch {
25
29
  return undefined;
26
30
  }
31
+ const put = (k, v) => {
32
+ Object.defineProperty(copy, k, { value: v, enumerable: true, writable: true, configurable: true });
33
+ };
34
+ const authorization = readMcpAuthorization(leg);
35
+ let authorizationPlaced = false;
36
+ const placeAuthorization = () => {
37
+ if (authorizationPlaced)
38
+ return;
39
+ authorizationPlaced = true;
40
+ if (authorization.kind === 'record')
41
+ put('authorization', authorization.authorization);
42
+ else if (authorization.kind === 'unreadable' || slot(leg, 'authorizationUnreadable') === true)
43
+ put('authorizationUnreadable', true);
44
+ };
27
45
  for (const k of keys) {
46
+ if (AUTHORIZATION_SEATS.has(k)) {
47
+ placeAuthorization();
48
+ continue;
49
+ }
28
50
  const v = slot(leg, k);
29
51
  if (typeof v === 'string' || typeof v === 'boolean' || (typeof v === 'number' && Number.isFinite(v)))
30
- Object.defineProperty(copy, k, { value: v, enumerable: true, writable: true, configurable: true });
52
+ put(k, v);
31
53
  }
54
+ placeAuthorization();
32
55
  return typeof copy['state'] === 'string' ? Object.freeze(copy) : undefined;
33
56
  }
34
57
  export function mcpStatusSupersetKeys(input) {
@@ -37,7 +37,6 @@ export type McpHttpIdentityHeaders = {
37
37
  export declare function readMcpHttpIdentityHeaders(transport: object): McpHttpIdentityHeaders;
38
38
  export declare function mcpConfigToSpec(name: string, c: McpConfigLike): McpServerSpec | null;
39
39
  export declare function mcpTransportVerdict(entry: McpTransportEntryLike | null | undefined): McpTransportVerdict;
40
- export declare function mcpConfigsToSpecs(servers: Record<string, McpConfigLike> | undefined): McpServerSpec[];
41
40
  export type McpToolAxesVerdict = {
42
41
  readonly kind: 'ok';
43
42
  readonly toolAxes?: Readonly<Record<string, object>>;
@@ -73,8 +72,8 @@ export type McpAllowToolsVerdict = {
73
72
  readonly problem: string;
74
73
  };
75
74
  export declare function mcpAllowToolsVerdict(read: () => {} | null | undefined, keyPrefix?: string): McpAllowToolsVerdict;
76
- export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long' | 'transport_invalid' | 'identity_headers_both_set' | 'tool_axes_invalid' | 'tool_faces_invalid' | 'elicitation_invalid' | 'allow_tools_invalid' | 'entry_not_object' | 'entry_unreadable';
77
- export type McpServerNameUnusableReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long';
75
+ export type McpConfigDropReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long' | 'name_reserved' | 'transport_invalid' | 'identity_headers_both_set' | 'tool_axes_invalid' | 'tool_faces_invalid' | 'elicitation_invalid' | 'allow_tools_invalid' | 'entry_not_object' | 'entry_unreadable';
76
+ export type McpServerNameUnusableReason = 'name_blank' | 'name_edge_whitespace' | 'name_collides_after_trim' | 'name_too_long' | 'name_reserved';
78
77
  export type McpServerNameVerdict = {
79
78
  readonly usable: true;
80
79
  } | {
@@ -1,4 +1,4 @@
1
- import { SETTINGS_DESCRIBE_BAD_WIRE_NAME, SETTINGS_IS_USABLE_WIRE_NAME, SETTINGS_READ_MCP_IDENTITY_HEADERS, SETTINGS_READ_REQUEST_MCP_TRANSPORT, } from './generated/settingsSchemaFns.js';
1
+ import { SETTINGS_DESCRIBE_BAD_MCP_SERVER_NAME, SETTINGS_IS_USABLE_MCP_SERVER_NAME, SETTINGS_IS_USABLE_WIRE_NAME, SETTINGS_READ_MCP_IDENTITY_HEADERS, SETTINGS_READ_REQUEST_MCP_TRANSPORT, } from './generated/settingsSchemaFns.js';
2
2
  import { snapshotArgs, wireTransportOf } from './mcpWireTransport.js';
3
3
  import { appendOwnElement, guardedRead } from './ownKey.js';
4
4
  import { readMcpToolAxes, readToolFaces } from './coreValuePorts.js';
@@ -173,9 +173,6 @@ export function mcpTransportVerdict(entry) {
173
173
  function transportBadVerdict(key, detail) {
174
174
  return Object.freeze({ kind: 'bad', key, detail });
175
175
  }
176
- export function mcpConfigsToSpecs(servers) {
177
- return projectMcpConfigs(servers).specs;
178
- }
179
176
  export function mcpToolAxesVerdict(declared) {
180
177
  if (declared === undefined)
181
178
  return Object.freeze({ kind: 'ok' });
@@ -252,11 +249,13 @@ export function mcpAllowToolsVerdict(read, keyPrefix = '') {
252
249
  return bad('allowTools', 'config.mcp.allowToolsUnreadable');
253
250
  }
254
251
  }
255
- const nameUsable = (name) => SETTINGS_IS_USABLE_WIRE_NAME(name);
252
+ const nameUsable = (name) => SETTINGS_IS_USABLE_MCP_SERVER_NAME(name);
256
253
  function mcpNameDropReasonOf(name) {
257
254
  if (typeof name !== 'string' || name.trim().length === 0)
258
255
  return 'name_blank';
259
- return name.trim() !== name ? 'name_edge_whitespace' : 'name_too_long';
256
+ if (name.trim() !== name)
257
+ return 'name_edge_whitespace';
258
+ return SETTINGS_IS_USABLE_WIRE_NAME(name) ? 'name_reserved' : 'name_too_long';
260
259
  }
261
260
  const _nameReasonsPin = true;
262
261
  void _nameReasonsPin;
@@ -316,7 +315,7 @@ function dropNotice(name, reason, problem, opts, path) {
316
315
  }
317
316
  const where = typeof label === 'string' && label.length > 0 ? ` (${capForDisplay(label, DROP_LABEL_SHOWN)})` : '';
318
317
  const quoted = `"${capForDisplay(name, DROP_NAME_SHOWN)}"`;
319
- const badName = () => capForDisplay(SETTINGS_DESCRIBE_BAD_WIRE_NAME(name), DROP_BAD_NAME_SHOWN);
318
+ const badName = () => capForDisplay(SETTINGS_DESCRIBE_BAD_MCP_SERVER_NAME(name), DROP_BAD_NAME_SHOWN);
320
319
  const ref = reason === 'entry_not_object'
321
320
  ? msg('config.mcp.entryNotObject', { name: quoted, where })
322
321
  : reason === 'entry_unreadable'
@@ -339,7 +338,9 @@ function dropNotice(name, reason, problem, opts, path) {
339
338
  ? msg('config.mcp.nameCollides', { name: badName(), where })
340
339
  : reason === 'name_too_long'
341
340
  ? msg('config.mcp.nameTooLong', { name: badName(), where })
342
- : msg('config.mcp.nameEdgeWhitespace', { name: badName(), where });
341
+ : reason === 'name_reserved'
342
+ ? msg('config.mcp.nameReserved', { name: badName(), where })
343
+ : msg('config.mcp.nameEdgeWhitespace', { name: badName(), where });
343
344
  return renderMessage(ref, opts?.lang);
344
345
  }
345
346
  function degradedNotice(name, lost, opts) {