@sema-agent/client-core 0.98.0 → 0.99.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 (192) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/README.md +35 -22
  3. package/dist/adapt/arms.js +61 -20
  4. package/dist/adapt/panelTasks.d.ts +1 -1
  5. package/dist/adapt/panelTasks.js +2 -2
  6. package/dist/adapter/activeRunSelfHeal.d.ts +4 -3
  7. package/dist/adapter/activeRunSelfHeal.js +162 -293
  8. package/dist/adapter/downstream/eventToSdkMessage.js +52 -4
  9. package/dist/adapter/runStream.js +52 -37
  10. package/dist/adapter/types.js +2 -1
  11. package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
  12. package/dist/agentsWireCaps.d.ts +0 -3
  13. package/dist/agentsWireCaps.js +33 -24
  14. package/dist/cloudConfigWireCaps.d.ts +1 -1
  15. package/dist/cloudConfigWireCaps.js +26 -4
  16. package/dist/controlRouter.d.ts +4 -2
  17. package/dist/controlRouter.js +39 -51
  18. package/dist/coreValuePorts.d.ts +26 -1
  19. package/dist/coreValuePorts.js +10 -0
  20. package/dist/corruptSessionCopy.d.ts +2 -1
  21. package/dist/corruptSessionCopy.js +3 -3
  22. package/dist/declared/supportFloorDeclared.js +1 -1
  23. package/dist/detachWire.js +3 -2
  24. package/dist/devicesFace.d.ts +34 -0
  25. package/dist/devicesFace.js +90 -0
  26. package/dist/displayUntrusted.d.ts +1 -0
  27. package/dist/displayUntrusted.js +3 -0
  28. package/dist/engineAgentPanelStore.d.ts +7 -0
  29. package/dist/engineAgentPanelStore.js +14 -0
  30. package/dist/engineCapReader.d.ts +2 -1
  31. package/dist/engineCapReader.js +7 -5
  32. package/dist/engineCapsCache.d.ts +8 -0
  33. package/dist/engineCapsCache.js +59 -6
  34. package/dist/engineCapsChange.d.ts +2 -0
  35. package/dist/engineCapsChange.js +9 -0
  36. package/dist/engineErrorCodes.d.ts +2 -1
  37. package/dist/engineErrorCodes.js +2 -7
  38. package/dist/engineRowRef.js +3 -0
  39. package/dist/engineSessionMessages.d.ts +1 -0
  40. package/dist/engineSessionMessages.js +7 -1
  41. package/dist/engineTargetSeat.d.ts +27 -0
  42. package/dist/engineTargetSeat.js +199 -0
  43. package/dist/engineWireFor.js +3 -8
  44. package/dist/env/uiLanguage.d.ts +2 -1
  45. package/dist/env/uiLanguage.js +3 -2
  46. package/dist/eventLeg.d.ts +8 -0
  47. package/dist/eventLeg.js +61 -41
  48. package/dist/fileHistoryCaptureCapability.d.ts +2 -1
  49. package/dist/fileHistoryCaptureCapability.js +12 -18
  50. package/dist/fileHistoryLegNotice.d.ts +2 -1
  51. package/dist/fileHistoryLegNotice.js +3 -3
  52. package/dist/frameBinding.d.ts +3 -0
  53. package/dist/frameBinding.js +12 -0
  54. package/dist/gateOutcome.js +16 -2
  55. package/dist/gateVocabulary.d.ts +8 -7
  56. package/dist/gateVocabulary.js +71 -73
  57. package/dist/generated/engineFactTables.d.ts +17 -1
  58. package/dist/generated/engineFactTables.js +29 -0
  59. package/dist/generated/engineNoticeTables.js +9 -3
  60. package/dist/generated/settingsSchemaFns.d.ts +6 -0
  61. package/dist/generated/settingsSchemaFns.js +57 -0
  62. package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
  63. package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
  64. package/dist/generated/settingsSchemaTables.d.ts +1 -0
  65. package/dist/generated/settingsSchemaTables.js +4 -0
  66. package/dist/generated/settingsSchemaTypes.d.ts +105 -0
  67. package/dist/generated/settingsSchemaTypes.js +1 -0
  68. package/dist/hitl/allowRuleShadow.d.ts +2 -1
  69. package/dist/hitl/allowRuleShadow.js +17 -14
  70. package/dist/hitl/approvalCardReasons.d.ts +3 -2
  71. package/dist/hitl/approvalCardReasons.js +27 -28
  72. package/dist/hitl/approvalHolds.d.ts +3 -0
  73. package/dist/hitl/approvalHolds.js +73 -29
  74. package/dist/hitl/askClassPair.d.ts +1 -1
  75. package/dist/hitl/askClassPair.js +16 -0
  76. package/dist/hitl/askGateWire.js +2 -1
  77. package/dist/hitl/askSettlementLine.d.ts +14 -4
  78. package/dist/hitl/askSettlementLine.js +67 -47
  79. package/dist/hitl/automaticAnswerVerdict.d.ts +2 -1
  80. package/dist/hitl/automaticAnswerVerdict.js +8 -8
  81. package/dist/hitl/crashConvergedNotice.d.ts +5 -4
  82. package/dist/hitl/crashConvergedNotice.js +28 -41
  83. package/dist/hitl/frameRouter.js +7 -8
  84. package/dist/hitl/hitlBridge.d.ts +1 -0
  85. package/dist/hitl/hitlBridge.js +3 -3
  86. package/dist/hitl/persistedRulesWire.d.ts +6 -5
  87. package/dist/hitl/persistedRulesWire.js +55 -73
  88. package/dist/hitl/planReviewWire.d.ts +5 -0
  89. package/dist/hitl/planReviewWire.js +8 -0
  90. package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
  91. package/dist/hitl/sessionPolicyDeliverable.js +46 -3
  92. package/dist/hitl/sessionPolicyWire.d.ts +2 -1
  93. package/dist/hitl/sessionPolicyWire.js +23 -24
  94. package/dist/hitl/suspendedReopen.d.ts +2 -1
  95. package/dist/hitl/suspendedReopen.js +7 -10
  96. package/dist/hitl/toolApprovalWire.d.ts +17 -5
  97. package/dist/hitl/toolApprovalWire.js +79 -40
  98. package/dist/hooksWireCaps.js +145 -56
  99. package/dist/host.d.ts +21 -0
  100. package/dist/hostTurnSettings.d.ts +71 -0
  101. package/dist/hostTurnSettings.js +291 -0
  102. package/dist/humanTurn.d.ts +14 -1
  103. package/dist/humanTurn.js +100 -12
  104. package/dist/humanTurnRead.d.ts +2 -0
  105. package/dist/humanTurnRead.js +22 -1
  106. package/dist/i18n/messages.en.d.ts +582 -0
  107. package/dist/i18n/messages.en.js +582 -0
  108. package/dist/i18n/messages.zh.js +718 -1
  109. package/dist/index.d.ts +29 -13
  110. package/dist/index.js +18 -9
  111. package/dist/inheritEnvCapability.d.ts +3 -2
  112. package/dist/inheritEnvCapability.js +3 -3
  113. package/dist/inheritEnvWire.d.ts +3 -2
  114. package/dist/inheritEnvWire.js +12 -14
  115. package/dist/interactiveHalt.js +17 -6
  116. package/dist/liveModelCatalog.d.ts +2 -1
  117. package/dist/liveModelCatalog.js +14 -8
  118. package/dist/mcpPanel.d.ts +10 -1
  119. package/dist/mcpPanel.js +40 -13
  120. package/dist/mcpProbeCapability.d.ts +2 -1
  121. package/dist/mcpProbeCapability.js +7 -11
  122. package/dist/mcpProbeWire.d.ts +3 -1
  123. package/dist/mcpProbeWire.js +5 -0
  124. package/dist/mcpWireCaps.d.ts +34 -0
  125. package/dist/mcpWireCaps.js +117 -17
  126. package/dist/memoryEntriesWire.js +5 -10
  127. package/dist/model/onboardJudgement.d.ts +93 -0
  128. package/dist/model/onboardJudgement.js +415 -0
  129. package/dist/model/tierVocabulary.d.ts +2 -0
  130. package/dist/model/tierVocabulary.js +17 -5
  131. package/dist/modelCapabilityProbe.d.ts +64 -0
  132. package/dist/modelCapabilityProbe.js +600 -0
  133. package/dist/modelIdentityResolvability.d.ts +3 -0
  134. package/dist/modelIdentityResolvability.js +26 -17
  135. package/dist/ownKey.d.ts +7 -0
  136. package/dist/ownKey.js +34 -0
  137. package/dist/panelReduce.d.ts +6 -1
  138. package/dist/panelReduce.js +50 -3
  139. package/dist/permissionRuleIssue.js +2 -0
  140. package/dist/permissionRulesWriteCapability.d.ts +2 -1
  141. package/dist/permissionRulesWriteCapability.js +8 -6
  142. package/dist/pluginHooksWire.d.ts +46 -3
  143. package/dist/pluginHooksWire.js +217 -11
  144. package/dist/printModelStatus.d.ts +63 -0
  145. package/dist/printModelStatus.js +155 -0
  146. package/dist/request/taskRequest.d.ts +11 -5
  147. package/dist/request/taskRequest.js +112 -16
  148. package/dist/resumeRefusalCopy.d.ts +12 -9
  149. package/dist/resumeRefusalCopy.js +70 -143
  150. package/dist/retryStatus.d.ts +37 -0
  151. package/dist/retryStatus.js +79 -0
  152. package/dist/scenarioRefusal.d.ts +9 -0
  153. package/dist/scenarioRefusal.js +111 -0
  154. package/dist/seam.d.ts +25 -1
  155. package/dist/seam.js +10 -1
  156. package/dist/seatContract.d.ts +260 -10
  157. package/dist/seatContract.js +692 -19
  158. package/dist/selfOrchestrationDenial.js +7 -19
  159. package/dist/sessionIdSegment.d.ts +6 -0
  160. package/dist/sessionIdSegment.js +24 -0
  161. package/dist/sessionMemoryStatus.js +6 -11
  162. package/dist/sessionPolicyCapability.d.ts +2 -1
  163. package/dist/sessionPolicyCapability.js +8 -6
  164. package/dist/settingsHooksSalvage.d.ts +44 -0
  165. package/dist/settingsHooksSalvage.js +211 -0
  166. package/dist/skillToolListsCapability.d.ts +2 -1
  167. package/dist/skillToolListsCapability.js +8 -6
  168. package/dist/sseIdleTriage.js +3 -2
  169. package/dist/subagent/engineSubagentResume.js +15 -9
  170. package/dist/subagentContentStore.d.ts +3 -0
  171. package/dist/subagentContentStore.js +22 -0
  172. package/dist/toolHistoryMismatch.js +3 -2
  173. package/dist/toolRoster.d.ts +3 -2
  174. package/dist/toolRoster.js +21 -20
  175. package/dist/turnFailurePresentation.d.ts +12 -1
  176. package/dist/turnFailurePresentation.js +212 -15
  177. package/dist/usageAnalytics.js +6 -11
  178. package/dist/userAttachmentEnvelope.d.ts +1 -0
  179. package/dist/userAttachmentEnvelope.js +37 -7
  180. package/dist/userAttachmentSeat.d.ts +21 -0
  181. package/dist/userAttachmentSeat.js +75 -0
  182. package/dist/userInvokedSkillsCapability.d.ts +11 -1
  183. package/dist/userInvokedSkillsCapability.js +31 -7
  184. package/dist/wireErrorTriage.d.ts +7 -0
  185. package/dist/wireErrorTriage.js +23 -1
  186. package/dist/wireFailureShape.js +2 -1
  187. package/dist/wireRefusalCopy.d.ts +13 -1
  188. package/dist/wireRefusalCopy.js +24 -28
  189. package/dist/workflowsJournalCapability.d.ts +2 -1
  190. package/dist/workflowsJournalCapability.js +8 -6
  191. package/docs/INTEGRATION-CLIENTS.md +542 -30
  192. package/package.json +5 -5
@@ -1,6 +1,7 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
- import { ownDataField } from './ownKey.js';
3
+ import { msg, renderMessage } from './i18n/translate.js';
4
+ import { ownDataField, readOwnDataValue } from './ownKey.js';
4
5
  export function projectUserInvokedSkillsCapability(caps) {
5
6
  try {
6
7
  if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
@@ -30,17 +31,40 @@ export function userInvokedSkillsAvailable(reading) {
30
31
  return 'no';
31
32
  return 'unknown';
32
33
  }
33
- export function userInvokedSkillsDoctorDetail(reading) {
34
+ export function userInvokedSkillsDoctorDetail(reading, lang) {
35
+ const subject = msg('notice.capability.subject.userInvokedSkills');
34
36
  switch (reading.kind) {
35
37
  case 'unreadable':
36
- return unreadableReadingDetail('user-invoked skills');
38
+ return unreadableReadingDetail(renderMessage(subject, lang), lang);
37
39
  case 'unobserved':
38
- return 'user-invoked skills not observed — the engine reports it on /v1/capabilities (userInvokedSkills); 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)';
40
+ return renderMessage(msg('notice.capability.unobserved', { subject, key: 'userInvokedSkills' }), lang);
39
41
  case 'not_reported':
40
- return 'user-invoked skills not reported by this engine — the engine predates it, so naming skills on a request is refused (do not send the key)';
42
+ return renderMessage(msg('notice.capability.userInvokedSkills.notReported'), lang);
41
43
  case 'absent':
42
- return 'user-invoked skills off on this deployment — naming skills on a request is not accepted';
44
+ return renderMessage(msg('notice.capability.userInvokedSkills.absent'), lang);
43
45
  case 'present':
44
- return 'user-invoked skills on — skills the user names on a request take effect when the run starts';
46
+ return renderMessage(msg('notice.capability.userInvokedSkills.present'), lang);
45
47
  }
46
48
  }
49
+ export function userInvokedSkillsDeclaration(names, reading) {
50
+ let named = false;
51
+ try {
52
+ named = Array.isArray(names) && names.length > 0;
53
+ }
54
+ catch {
55
+ named = false;
56
+ }
57
+ if (!named)
58
+ return { field: {} };
59
+ let kind;
60
+ try {
61
+ kind = reading !== null && typeof reading === 'object' ? readOwnDataValue(reading, 'kind') : undefined;
62
+ }
63
+ catch {
64
+ kind = undefined;
65
+ }
66
+ if (kind === 'present')
67
+ return { field: { userInvokedSkills: names } };
68
+ const cause = kind === 'absent' || kind === 'not_reported' || kind === 'unobserved' ? kind : 'unreadable';
69
+ return { field: {}, withheld: { cause } };
70
+ }
@@ -21,6 +21,13 @@ export declare function classifyTurnWireError(err: unknown): TurnWireErrorVerdic
21
21
  export declare function isWireTransportError(err: unknown): boolean;
22
22
  export declare function isPreStreamDrainingReject(err: unknown): boolean;
23
23
  export declare function effectiveWireErrorCode(err: unknown): string | undefined;
24
+ export type NotFoundFailure = {
25
+ readonly kind: 'not_found';
26
+ readonly code: string;
27
+ } | {
28
+ readonly kind: 'unknown_404';
29
+ };
30
+ export declare function isNotFoundFailure(e: {} | null | undefined): NotFoundFailure | false;
24
31
  export declare function corruptStoredRowWhere(err: unknown): string | undefined;
25
32
  export declare function corruptStoredRowContent(where: string): string;
26
33
  export declare function isResumeAtRejection(err: unknown): boolean;
@@ -1,4 +1,4 @@
1
- import { readBlockedBy, readErrorNumber, readErrorString, readErrorStringList, readThrownSlot, thrownIsInstanceOf, THROWN_SLOT_UNREADABLE, WIRE_FAILURE_UNRENDERABLE_TEXT, } from './wireFailureShape.js';
1
+ import { PROTOCOL_ERROR_NAME, protocolErrorNameOf, readBlockedBy, readErrorNumber, readErrorString, readErrorStringList, readThrownSlot, readThrownStatusSlot, thrownIsInstanceOf, THROWN_SLOT_UNREADABLE, WIRE_FAILURE_UNRENDERABLE_TEXT, } from './wireFailureShape.js';
2
2
  import { capForDisplay, escapeDisplayControlChars } from './fleetTaskDesc.js';
3
3
  import { readOwnDataValue } from './ownKey.js';
4
4
  import { fleetLeaseUnavailableFromError } from './wireRefusalCopy.js';
@@ -76,6 +76,28 @@ export function effectiveWireErrorCode(err) {
76
76
  const outer = typeof outerRaw === 'string' && outerRaw.length > 0 ? outerRaw : undefined;
77
77
  return foldedWireErrorCode(err, outer);
78
78
  }
79
+ export function isNotFoundFailure(e) {
80
+ try {
81
+ if (e === null || e === undefined || (typeof e !== 'object' && typeof e !== 'function'))
82
+ return false;
83
+ const code = readThrownSlot(e, 'errorCode', 'data');
84
+ if (code === THROWN_SLOT_UNREADABLE)
85
+ return false;
86
+ if (typeof code === 'string') {
87
+ return code.startsWith(NOT_FOUND_CODE_PREFIX) ? Object.freeze({ kind: 'not_found', code }) : false;
88
+ }
89
+ const status = readThrownStatusSlot(e);
90
+ if (status === 404)
91
+ return Object.freeze({ kind: 'unknown_404' });
92
+ if (status === undefined && typeof e === 'object' && protocolErrorNameOf(e) === PROTOCOL_ERROR_NAME.NotFoundError)
93
+ return Object.freeze({ kind: 'unknown_404' });
94
+ return false;
95
+ }
96
+ catch {
97
+ return false;
98
+ }
99
+ }
100
+ const NOT_FOUND_CODE_PREFIX = 'not_found.';
79
101
  function foldedWireErrorCode(err, outer) {
80
102
  if (outer !== RESUME_POLICY_FOLD_CODE)
81
103
  return outer;
@@ -1,3 +1,4 @@
1
+ import { msg, renderMessage } from './i18n/translate.js';
1
2
  import { guardedRead, ownDataField, readOwnDataValue } from './ownKey.js';
2
3
  export const THROWN_SLOT_UNREADABLE = Symbol('thrown-slot-unreadable');
3
4
  export function readThrownSlot(o, key, own = false) {
@@ -373,7 +374,7 @@ export function withAssemblyRefusal(err, cause) {
373
374
  export function asAssemblyRefusal(thrown, cause, who) {
374
375
  if (assemblyRefusalOf(thrown) !== undefined)
375
376
  return thrown;
376
- return withAssemblyRefusal(new Error(`${who}: 装配时出错,拒绝装配(原抛出物见 cause)。`, { cause: thrown }), cause);
377
+ return withAssemblyRefusal(new Error(renderMessage(msg('config.assembly.thrownDuringAssembly', { who })), { cause: thrown }), cause);
377
378
  }
378
379
  export function assemblyRefusalOf(x) {
379
380
  if (x === null || x === undefined)
@@ -1,4 +1,4 @@
1
- import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
1
+ import { FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
2
2
  import type { TaskRequestLike } from './request/taskRequest.js';
3
3
  export declare const CONFLICT_APPROVAL_SETTLED = "conflict.approval_settled";
4
4
  export declare const CONFLICT_RUN_NOT_RUNNING = "conflict.run_not_running";
@@ -98,3 +98,15 @@ export interface AutonomyLaneRefusalDetail {
98
98
  }
99
99
  export declare function autonomyLaneRefusalFromError(err: unknown): AutonomyLaneRefusalDetail | null;
100
100
  export declare function autonomyLaneRefusalContent(): string;
101
+ export interface UserAttachmentRefusalDetail {
102
+ readonly code: typeof USER_ATTACHMENT_INVALID_ERROR_CODE;
103
+ readonly retryable: false;
104
+ }
105
+ export declare function userAttachmentRefusalFromError(err: {} | null | undefined): UserAttachmentRefusalDetail | null;
106
+ export declare function userAttachmentRefusalContent(): string;
107
+ export interface UserInvokedSkillRefusalDetail {
108
+ readonly code: typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE;
109
+ readonly retryable: false;
110
+ }
111
+ export declare function userInvokedSkillRefusalFromError(err: {} | null | undefined): UserInvokedSkillRefusalDetail | null;
112
+ export declare function userInvokedSkillRefusalContent(): string;
@@ -1,9 +1,10 @@
1
1
  import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
2
2
  import { readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
3
- import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED } from './engineErrorCodes.js';
3
+ import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, RESUME_POLICY_FOLD_CODE, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
4
4
  import { capForDisplay } from './fleetTaskDesc.js';
5
5
  import { effectiveWireErrorCode } from './wireErrorTriage.js';
6
6
  import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
7
+ import { scenarioRefusalFromError } from './scenarioRefusal.js';
7
8
  export const CONFLICT_APPROVAL_SETTLED = 'conflict.approval_settled';
8
9
  export const CONFLICT_RUN_NOT_RUNNING = 'conflict.run_not_running';
9
10
  function ownNonEmptyStringSlot(o, key) {
@@ -138,33 +139,14 @@ export function fleetLeaseUnavailableContent(detail) {
138
139
  return `${head}${cause}${wait}`;
139
140
  }
140
141
  export function scenarioAssignmentUnknownFromError(err) {
141
- try {
142
- if (err === null || typeof err !== 'object')
143
- return null;
144
- if (effectiveWireErrorCode(err) !== SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE)
145
- return null;
146
- const detail = readErrorRecord(err, 'detail');
147
- const bit = (key) => {
148
- if (detail === undefined)
149
- return undefined;
150
- try {
151
- return Object.hasOwn(detail, key) ? detail[key] : undefined;
152
- }
153
- catch {
154
- return undefined;
155
- }
156
- };
157
- const scenario = bit('scenario');
158
- const source = bit('source');
159
- return {
160
- code: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
161
- ...(typeof scenario === 'string' && scenario.length > 0 ? { scenario } : {}),
162
- ...(source === 'ruling' || source === 'deployment' ? { source } : {}),
163
- };
164
- }
165
- catch {
142
+ const r = scenarioRefusalFromError(err);
143
+ if (r === null)
166
144
  return null;
167
- }
145
+ return {
146
+ code: SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
147
+ ...(r.scenario !== undefined ? { scenario: r.scenario } : {}),
148
+ ...(r.source !== undefined ? { source: r.source } : {}),
149
+ };
168
150
  }
169
151
  const SETTLED_BY_NOT_IN_PROOF = 'settled_by_not_in_proof';
170
152
  const DECIDED_BY_NOT_IN_PROOF = 'decided_by_not_in_proof';
@@ -526,7 +508,7 @@ function readProp(o, key) {
526
508
  }
527
509
  export function hostPostureRefusalFromError(err, sentRequest) {
528
510
  try {
529
- if (readProp(err, 'errorCode') !== HOST_POSTURE_REFUSED)
511
+ if (readThrownSlot(err, 'errorCode', 'data') !== HOST_POSTURE_REFUSED)
530
512
  return null;
531
513
  const askedWholeEnvironment = readProp(sentRequest, 'inheritEnv') === 'all';
532
514
  const askedOpenWriteFace = readProp(sentRequest, 'permissionMode') === BYPASS_PERMISSIONS ||
@@ -615,3 +597,17 @@ export function autonomyLaneRefusalContent() {
615
597
  return ('The engine did not start this leader run: this deployment runs in plan-only autonomy, and a leader run has no way to have its plan reviewed, ' +
616
598
  'so nothing was started · Submit the work as a regular run instead, or ask whoever operates the engine to change its autonomy setting');
617
599
  }
600
+ export function userAttachmentRefusalFromError(err) {
601
+ return effectiveWireErrorCode(err) === USER_ATTACHMENT_INVALID_ERROR_CODE ? { code: USER_ATTACHMENT_INVALID_ERROR_CODE, retryable: false } : null;
602
+ }
603
+ export function userAttachmentRefusalContent() {
604
+ return ('This message was not sent: the engine refused the files attached to it — together with the message they are more than it can take in one request on this model, ' +
605
+ 'or one of them is in a form it does not accept · Nothing was started and your draft is kept · Remove some attachments or attach smaller parts, then send it again');
606
+ }
607
+ export function userInvokedSkillRefusalFromError(err) {
608
+ return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
609
+ }
610
+ export function userInvokedSkillRefusalContent() {
611
+ return ('The engine did not start this run: a skill named for it is not one this run has loaded, or skills are turned off for this run · ' +
612
+ 'Nothing was started and your draft is kept · Check the skill name, or load that skill, then send it again');
613
+ }
@@ -1,3 +1,4 @@
1
+ import type { UiLanguage } from './env/uiLanguage.js';
1
2
  export type WorkflowsJournalReading = {
2
3
  kind: 'unobserved';
3
4
  } | {
@@ -12,4 +13,4 @@ export type WorkflowsJournalReading = {
12
13
  export declare function projectWorkflowsJournalCapability(caps: unknown): WorkflowsJournalReading | undefined;
13
14
  export declare function observedWorkflowsJournal(baseUrl?: string | undefined): WorkflowsJournalReading;
14
15
  export declare function workflowsJournalAvailable(reading: WorkflowsJournalReading): 'yes' | 'no' | 'unknown';
15
- export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading): string;
16
+ export declare function workflowsJournalDoctorDetail(reading: WorkflowsJournalReading, lang?: UiLanguage): string;
@@ -1,5 +1,6 @@
1
1
  import { engineWireTarget } from './engineWireTarget.js';
2
2
  import { createEngineCapReader, unreadableReadingDetail } from './engineCapReader.js';
3
+ import { msg, renderMessage } from './i18n/translate.js';
3
4
  import { ownDataField } from './ownKey.js';
4
5
  export function projectWorkflowsJournalCapability(caps) {
5
6
  try {
@@ -30,17 +31,18 @@ export function workflowsJournalAvailable(reading) {
30
31
  return 'no';
31
32
  return 'unknown';
32
33
  }
33
- export function workflowsJournalDoctorDetail(reading) {
34
+ export function workflowsJournalDoctorDetail(reading, lang) {
35
+ const subject = msg('notice.capability.subject.workflowsJournal');
34
36
  switch (reading.kind) {
35
37
  case 'unreadable':
36
- return unreadableReadingDetail('workflow journal');
38
+ return unreadableReadingDetail(renderMessage(subject, lang), lang);
37
39
  case 'unobserved':
38
- return 'workflow journal not observed — the engine reports it on /v1/capabilities (workflowsJournal); 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)';
40
+ return renderMessage(msg('notice.capability.unobserved', { subject, key: 'workflowsJournal' }), lang);
39
41
  case 'not_reported':
40
- return 'workflow journal not reported by this engine — the engine predates the separate flag, so the workflow listing flag still covers the journal';
42
+ return renderMessage(msg('notice.capability.workflowsJournal.notReported'), lang);
41
43
  case 'absent':
42
- return 'no workflow journal on this deployment — workflows can be listed and followed, but their execution journal cannot be read';
44
+ return renderMessage(msg('notice.capability.workflowsJournal.absent'), lang);
43
45
  case 'present':
44
- return 'workflow journal on — a workflow’s execution journal can be read';
46
+ return renderMessage(msg('notice.capability.workflowsJournal.present'), lang);
45
47
  }
46
48
  }