@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,5 +1,8 @@
1
1
  import type { AgentEvent } from '@sema-agent/sdk';
2
2
  import type { EngineBoundRun } from './engineRowRef.js';
3
+ import type { ApprovalFrameContext } from './eventLeg.js';
4
+ export declare function registerApprovalFrameContext(frame: AgentEvent, ctx: ApprovalFrameContext): void;
5
+ export declare function approvalFrameContextOfFrame(frame: object | null | undefined): ApprovalFrameContext | undefined;
3
6
  export declare function registerFrameBinding(frame: AgentEvent, binding: EngineBoundRun): void;
4
7
  export declare function frameBindingOf(frame: AgentEvent): EngineBoundRun | undefined;
5
8
  export declare function inheritFrameBinding<T extends AgentEvent>(from: AgentEvent, to: T): T;
@@ -1,4 +1,13 @@
1
1
  const frameBindings = new WeakMap();
2
+ const approvalFrameContexts = new WeakMap();
3
+ export function registerApprovalFrameContext(frame, ctx) {
4
+ if (typeof frame !== 'object' || frame === null || approvalFrameContexts.has(frame))
5
+ return;
6
+ approvalFrameContexts.set(frame, ctx);
7
+ }
8
+ export function approvalFrameContextOfFrame(frame) {
9
+ return typeof frame === 'object' && frame !== null ? approvalFrameContexts.get(frame) : undefined;
10
+ }
2
11
  export function registerFrameBinding(frame, binding) {
3
12
  if (typeof frame !== 'object' || frame === null)
4
13
  return;
@@ -19,5 +28,8 @@ export function inheritFrameBinding(from, to) {
19
28
  const binding = frameBindings.get(from);
20
29
  if (binding !== undefined && !frameBindings.has(to))
21
30
  frameBindings.set(to, binding);
31
+ const ctx = approvalFrameContexts.get(from);
32
+ if (ctx !== undefined && !approvalFrameContexts.has(to))
33
+ approvalFrameContexts.set(to, ctx);
22
34
  return to;
23
35
  }
@@ -237,9 +237,23 @@ export function gateOutcomeOf(frame) {
237
237
  return readGateRecord(frame)?.view;
238
238
  }
239
239
  export function isGateParkedToolEnd(frame) {
240
- if (typeof frame !== 'object' || frame === null || Array.isArray(frame))
240
+ if (typeof frame !== 'object' || frame === null)
241
+ return false;
242
+ try {
243
+ if (Array.isArray(frame))
244
+ return false;
245
+ if (readOwnDataValue(frame, 'errorCode') === GATE_PARKED_ERROR_CODE)
246
+ return true;
247
+ if (readOwnDataValue(frame, 'role') !== 'toolResult')
248
+ return false;
249
+ const details = readOwnDataValue(frame, 'details');
250
+ if (typeof details !== 'object' || details === null || Array.isArray(details))
251
+ return false;
252
+ return readOwnDataValue(details, 'code') === GATE_PARKED_ERROR_CODE;
253
+ }
254
+ catch {
241
255
  return false;
242
- return frame.errorCode === GATE_PARKED_ERROR_CODE;
256
+ }
243
257
  }
244
258
  export function gateModeRelease(g) {
245
259
  return g?.disposition.kind === 'allowed' ? g.disposition.released : undefined;
@@ -1,4 +1,5 @@
1
1
  import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
2
+ import type { UiLanguage } from './env/uiLanguage.js';
2
3
  export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
3
4
  export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
4
5
  export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
@@ -7,15 +8,15 @@ export declare function ccToolDenialKindForSettledBy(settledBy: unknown): CcTool
7
8
  export type GateDeniedByWord = (typeof CORE_DENIED_BY_VALUES)[number];
8
9
  export declare const GATE_DENIED_BY_WORDS: readonly GateDeniedByWord[];
9
10
  export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
10
- export declare function gateDeniedByDetail(deniedBy: unknown): string;
11
- export declare function askOriginDetail(origin: unknown): string;
12
- export declare function askOriginNoteOf(origin: string | undefined): string | undefined;
11
+ export declare function gateDeniedByDetail(deniedBy: unknown, lang?: UiLanguage): string;
12
+ export declare function askOriginDetail(origin: unknown, lang?: UiLanguage): string;
13
+ export declare function askOriginNoteOf(origin: string | undefined, lang?: UiLanguage): string | undefined;
13
14
  export declare function ruleOffersAbsenceDetail(reason: string | undefined, opts?: {
14
15
  readonly deploymentListSessionRow?: boolean;
15
- }): string | undefined;
16
- export declare function ruleOfferUncoveredDetail(reason: string | undefined): string;
17
- export declare function mandatedApprovalDetail(): string;
16
+ }, lang?: UiLanguage): string | undefined;
17
+ export declare function ruleOfferUncoveredDetail(reason: string | undefined, lang?: UiLanguage): string;
18
+ export declare function mandatedApprovalDetail(lang?: UiLanguage): string;
18
19
  export declare const APPROVAL_MANDATE_WORDS: readonly (typeof CORE_PERSISTED_RULE_MANDATES)[number][];
19
20
  export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
20
21
  export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
21
- export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
22
+ export declare function approvalMandateDetail(word: ApprovalMandateWord, lang?: UiLanguage): string;
@@ -1,5 +1,6 @@
1
1
  import { CORE_DENIED_BY_VALUES, CORE_PERSISTED_RULE_MANDATES } from './generated/engineFactTables.js';
2
2
  import { guardedRead, readOwnDataValue } from './ownKey.js';
3
+ import { msg, renderMessage } from './i18n/translate.js';
3
4
  export const CC_TOOL_DENIAL_KINDS = Object.freeze([
4
5
  'user-rejected',
5
6
  'permission-rule',
@@ -25,53 +26,53 @@ export function ccToolDenialKindForSettledBy(settledBy) {
25
26
  export const GATE_DENIED_BY_WORDS = Object.freeze([...CORE_DENIED_BY_VALUES]);
26
27
  const _deniedByWordsPin = true;
27
28
  void _deniedByWordsPin;
28
- const DENIED_BY_SENTENCES = Object.freeze({
29
- policy: "denied by this deployment's permission policy",
30
- hook: 'denied by a PreToolUse hook',
31
- org: 'denied by an organization rule',
32
- persisted_rule: 'denied by a persisted rule',
33
- classifier: 'denied by the auto-mode classifier',
34
- compliance: 'denied by a compliance lock',
35
- write_protection: 'denied because the write landed on a write-protected path',
36
- ask_resolution: 'denied when the approval was resolved',
37
- read_boundary: 'denied by the read boundary',
38
- mode: "denied by this session's permission mode",
29
+ const DENIED_BY_KEYS = Object.freeze({
30
+ policy: 'approval.deniedBy.policy',
31
+ hook: 'approval.deniedBy.hook',
32
+ org: 'approval.deniedBy.org',
33
+ persisted_rule: 'approval.deniedBy.persistedRule',
34
+ classifier: 'approval.deniedBy.classifier',
35
+ compliance: 'approval.deniedBy.compliance',
36
+ write_protection: 'approval.deniedBy.writeProtection',
37
+ ask_resolution: 'approval.deniedBy.askResolution',
38
+ read_boundary: 'approval.deniedBy.readBoundary',
39
+ mode: 'approval.deniedBy.mode',
39
40
  });
40
41
  export function isGateDeniedByWord(v) {
41
42
  return typeof v === 'string' && GATE_DENIED_BY_WORDS.includes(v);
42
43
  }
43
- export function gateDeniedByDetail(deniedBy) {
44
- if (typeof deniedBy === 'string' && Object.hasOwn(DENIED_BY_SENTENCES, deniedBy)) {
45
- return DENIED_BY_SENTENCES[deniedBy];
44
+ export function gateDeniedByDetail(deniedBy, lang) {
45
+ if (typeof deniedBy === 'string' && Object.hasOwn(DENIED_BY_KEYS, deniedBy)) {
46
+ return renderMessage(msg(DENIED_BY_KEYS[deniedBy]), lang);
46
47
  }
47
- const word = typeof deniedBy === 'string' && deniedBy.length > 0 ? deniedBy : '(none)';
48
- return `denied by a layer this build does not know (${word}) — this build does not know this layer name, so it cannot say which layer refused this call or why`;
48
+ const word = typeof deniedBy === 'string' && deniedBy.length > 0 ? deniedBy : msg('approval.card.noWord');
49
+ return renderMessage(msg('approval.deniedBy.unknown', { word }), lang);
49
50
  }
50
- const ASK_ORIGIN_SENTENCES = Object.freeze({
51
- content_question: 'the tool itself asked you a question',
52
- plan_review: 'the model paused its run for your verdict on the plan it proposed',
53
- ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate; this client cannot tell which from the origin alone): it must reach the park with no synchronous decision-maker in between',
54
- org_unavailable: 'the organization policy was unavailable, so this call asks',
55
- org_rule: 'an organization rule asks about this call',
56
- rule_store_unavailable: 'this call could not be checked against your standing deny/ask rules, so it asks',
57
- hook: 'a PreToolUse hook asked about this call',
58
- ask_rule: 'a persisted ask rule matches this call',
59
- denial_limit_fallback: 'the auto-mode classifier hit its denial limit and handed this call back to you',
60
- shell_gate_tighten: 'the coarse shell check rates this command above the tier it lets through, so it asks',
61
- safety_tighten: 'the gate tightened on this call’s own facts (network egress, irreversibility, or a protected write; this client cannot tell which from the origin alone)',
62
- policy: 'this deployment’s permission policy, or the permission mode’s default, asks about this call',
51
+ const ASK_ORIGIN_KEYS = Object.freeze({
52
+ content_question: 'approval.origin.contentQuestion',
53
+ plan_review: 'approval.origin.planReview',
54
+ ancestor_marked: 'approval.origin.ancestorMarked',
55
+ org_unavailable: 'approval.origin.orgUnavailable',
56
+ org_rule: 'approval.origin.orgRule',
57
+ rule_store_unavailable: 'approval.origin.ruleStoreUnavailable',
58
+ hook: 'approval.origin.hook',
59
+ ask_rule: 'approval.origin.askRule',
60
+ denial_limit_fallback: 'approval.origin.denialLimitFallback',
61
+ shell_gate_tighten: 'approval.origin.shellGateTighten',
62
+ safety_tighten: 'approval.origin.safetyTighten',
63
+ policy: 'approval.origin.policy',
63
64
  });
64
- export function askOriginDetail(origin) {
65
- const known = typeof origin === 'string' && Object.hasOwn(ASK_ORIGIN_SENTENCES, origin)
66
- ? ASK_ORIGIN_SENTENCES[origin]
65
+ export function askOriginDetail(origin, lang) {
66
+ const known = typeof origin === 'string' && Object.hasOwn(ASK_ORIGIN_KEYS, origin)
67
+ ? ASK_ORIGIN_KEYS[origin]
67
68
  : undefined;
68
69
  if (known !== undefined)
69
- return known;
70
- const word = typeof origin === 'string' && origin.length > 0 ? origin : '(none)';
71
- return unknownAskOriginSentence(word);
70
+ return renderMessage(msg(known), lang);
71
+ const word = typeof origin === 'string' && origin.length > 0 ? origin : msg('approval.card.noWord');
72
+ return renderMessage(unknownAskOriginSentence(word), lang);
72
73
  }
73
74
  function unknownAskOriginSentence(word) {
74
- return `this call asks; its origin ${word === undefined ? '' : `${word} `}is a word newer than this client, so answer it as usual`;
75
+ return word === undefined ? msg('approval.origin.unknownNoWord') : msg('approval.origin.unknownWithWord', { word });
75
76
  }
76
77
  const ASK_ORIGIN_QUIET = Object.freeze({
77
78
  content_question: true,
@@ -87,51 +88,48 @@ const ASK_ORIGIN_QUIET = Object.freeze({
87
88
  safety_tighten: false,
88
89
  policy: true,
89
90
  });
90
- export function askOriginNoteOf(origin) {
91
+ export function askOriginNoteOf(origin, lang) {
91
92
  if (typeof origin !== 'string' || origin === '')
92
93
  return undefined;
93
94
  if (Object.hasOwn(ASK_ORIGIN_QUIET, origin)) {
94
- return ASK_ORIGIN_QUIET[origin] === true ? undefined : askOriginDetail(origin);
95
+ return ASK_ORIGIN_QUIET[origin] === true ? undefined : askOriginDetail(origin, lang);
95
96
  }
96
- return unknownAskOriginSentence(undefined);
97
+ return renderMessage(unknownAskOriginSentence(undefined), lang);
97
98
  }
98
- const NO_REMEMBER_HEAD = 'no "don\'t ask again" option here';
99
- const RULE_OFFERS_ABSENCE_LINES = Object.freeze({
99
+ const RULE_OFFERS_ABSENCE_KEYS = Object.freeze({
100
100
  mandated: { line: null },
101
- allow_outranked: {
102
- line: `${NO_REMEMBER_HEAD}: an allow rule already matches this call, but this question outranks it — another allow rule would be outranked the same way`,
103
- },
101
+ allow_outranked: { line: 'approval.ruleOffer.absence.allowOutranked' },
104
102
  ask_rule_matched: {
105
- line: `${NO_REMEMBER_HEAD}: an ask rule matches this call and keeps asking — an allow rule changes nothing while it stands; to stop being asked, review your ask rules`,
106
- deploymentList: `${NO_REMEMBER_HEAD}: this deployment asks about every call to this tool and your own rules cannot switch that off — the "in this session" option stops it asking again until the session ends`,
103
+ line: 'approval.ruleOffer.absence.askRuleMatched',
104
+ deploymentList: 'approval.ruleOffer.absence.askRuleMatchedDeploymentList',
107
105
  },
108
- lane_cannot_speak: { line: `${NO_REMEMBER_HEAD}: this approval lane cannot persist rules` },
106
+ lane_cannot_speak: { line: 'approval.ruleOffer.absence.laneCannotSpeak' },
109
107
  });
110
- export function ruleOffersAbsenceDetail(reason, opts) {
108
+ export function ruleOffersAbsenceDetail(reason, opts, lang) {
111
109
  if (typeof reason !== 'string' || reason === '')
112
110
  return undefined;
113
- if (Object.hasOwn(RULE_OFFERS_ABSENCE_LINES, reason)) {
114
- const entry = RULE_OFFERS_ABSENCE_LINES[reason];
111
+ if (Object.hasOwn(RULE_OFFERS_ABSENCE_KEYS, reason)) {
112
+ const entry = RULE_OFFERS_ABSENCE_KEYS[reason];
115
113
  if (entry.line === null)
116
114
  return undefined;
117
115
  const onList = guardedRead(() => readOwnDataValue(opts, 'deploymentListSessionRow')) === true;
118
- return onList && entry.deploymentList !== undefined ? entry.deploymentList : entry.line;
116
+ return renderMessage(msg(onList && entry.deploymentList !== undefined ? entry.deploymentList : entry.line), lang);
119
117
  }
120
- return `${NO_REMEMBER_HEAD} (the reason is one this build does not know yet)`;
118
+ return renderMessage(msg('approval.ruleOffer.absence.unknown'), lang);
121
119
  }
122
- const RULE_OFFER_UNCOVERED_LINES = Object.freeze({
123
- redirection: 'always asks (shell redirection)',
124
- no_rule_form: 'no coverable rule form',
125
- cap_overflow: 'trimmed by the offer cap',
120
+ const RULE_OFFER_UNCOVERED_KEYS = Object.freeze({
121
+ redirection: 'approval.ruleOffer.uncovered.redirection',
122
+ no_rule_form: 'approval.ruleOffer.uncovered.noRuleForm',
123
+ cap_overflow: 'approval.ruleOffer.uncovered.capOverflow',
126
124
  });
127
- export function ruleOfferUncoveredDetail(reason) {
128
- if (typeof reason === 'string' && Object.hasOwn(RULE_OFFER_UNCOVERED_LINES, reason)) {
129
- return RULE_OFFER_UNCOVERED_LINES[reason];
125
+ export function ruleOfferUncoveredDetail(reason, lang) {
126
+ if (typeof reason === 'string' && Object.hasOwn(RULE_OFFER_UNCOVERED_KEYS, reason)) {
127
+ return renderMessage(msg(RULE_OFFER_UNCOVERED_KEYS[reason]), lang);
130
128
  }
131
- return 'a reason this build does not know yet';
129
+ return renderMessage(msg('approval.ruleOffer.uncovered.unknown'), lang);
132
130
  }
133
- export function mandatedApprovalDetail() {
134
- return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here or by an automatic check the deployment runs — and an answer covers only that call';
131
+ export function mandatedApprovalDetail(lang) {
132
+ return renderMessage(msg('approval.mandate.generic'), lang);
135
133
  }
136
134
  export const APPROVAL_MANDATE_WORDS = Object.freeze([...CORE_PERSISTED_RULE_MANDATES]);
137
135
  const _mandateWordsPin = true;
@@ -139,18 +137,18 @@ void _mandateWordsPin;
139
137
  export function isApprovalMandateWord(v) {
140
138
  return APPROVAL_MANDATE_SET.has(v);
141
139
  }
142
- const APPROVAL_MANDATE_SENTENCES = Object.freeze({
143
- operator_always: 'this deployment requires a separate confirmation for each shell command, and this call is one of them',
144
- tool_marks: 'this tool declares that it reaches outside this machine or makes changes that cannot be undone',
145
- probe_mandate: 'the check run on this call marked it as needing its own confirmation (the built-in shell check does so for a read outside the directories allowed for this session)',
146
- probe_unanswered: 'the check run on this call did not answer (it timed out or failed; this client cannot tell which), so whether the call stays inside the directories allowed for this session is unknown',
147
- write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
148
- target_unresolved: 'where this change lands on disk could not be determined (a link on the way could not be examined, or the target could not be resolved), so whether it lands on a guarded location is unknown',
140
+ const APPROVAL_MANDATE_KEYS = Object.freeze({
141
+ operator_always: 'approval.mandate.word.operatorAlways',
142
+ tool_marks: 'approval.mandate.word.toolMarks',
143
+ probe_mandate: 'approval.mandate.word.probeMandate',
144
+ probe_unanswered: 'approval.mandate.word.probeUnanswered',
145
+ write_protection: 'approval.mandate.word.writeProtection',
146
+ target_unresolved: 'approval.mandate.word.targetUnresolved',
149
147
  });
150
148
  const APPROVAL_MANDATE_SET = new Set(APPROVAL_MANDATE_WORDS);
151
- export function approvalMandateDetail(word) {
152
- if (typeof word === 'string' && Object.hasOwn(APPROVAL_MANDATE_SENTENCES, word)) {
153
- return APPROVAL_MANDATE_SENTENCES[word];
149
+ export function approvalMandateDetail(word, lang) {
150
+ if (typeof word === 'string' && Object.hasOwn(APPROVAL_MANDATE_KEYS, word)) {
151
+ return renderMessage(msg(APPROVAL_MANDATE_KEYS[word]), lang);
154
152
  }
155
- return 'the reason reported for this confirmation is not one this client recognises, so it shows no reason';
153
+ return renderMessage(msg('approval.mandate.unknownWord'), lang);
156
154
  }
@@ -43,5 +43,21 @@ export declare const CORE_PERMISSION_MODES: readonly ["default", "acceptEdits",
43
43
  export declare const CORE_APPROVAL_REACH: readonly ["none"];
44
44
  export declare const CORE_PERSISTED_RULE_MANDATES: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "target_unresolved"];
45
45
  export declare const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES: readonly ["completed", "failed", "killed", "cancelled"];
46
- export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "tool_unavailable", "configuration", "decision_rejected"];
46
+ export declare const CORE_RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"];
47
47
  export declare const CORE_BUILTIN_SUBAGENT_TYPES: readonly ["Explore", "Plan", "fork", "general-purpose"];
48
+ export declare const CORE_USER_ATTACHMENT_KINDS: readonly ["text", "notebook", "image", "pdf", "directory", "client_text", "client_image"];
49
+ export declare const CORE_USER_ATTACHMENT_SUPPLIES: readonly ["path", "content_text", "content_image"];
50
+ export declare const CORE_USER_ATTACHMENT_OUTCOMES: readonly ["attached", "partial", "unchanged", "not_attached"];
51
+ export interface CoreUserAttachmentSeatLimits {
52
+ readonly maxEntries: number;
53
+ readonly maxRenderedTextChars: number;
54
+ }
55
+ export interface CoreUserAttachmentSeat {
56
+ readonly entries: readonly string[];
57
+ readonly kinds: readonly (typeof CORE_USER_ATTACHMENT_KINDS)[number][];
58
+ readonly supplies: readonly (typeof CORE_USER_ATTACHMENT_SUPPLIES)[number][];
59
+ readonly limits: CoreUserAttachmentSeatLimits;
60
+ }
61
+ export declare const CORE_USER_ATTACHMENT_SEAT: CoreUserAttachmentSeat;
62
+ export declare const CORE_USER_ATTACHMENTS_MAX: number;
63
+ export declare const CORE_USER_ATTACHMENT_LABEL_MAX: number;
@@ -289,6 +289,7 @@ export const CORE_TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze([
289
289
  export const CORE_RESUME_STARTUP_CAUSES = Object.freeze([
290
290
  "environment",
291
291
  "session_gone",
292
+ "transcript_corrupt",
292
293
  "tool_unavailable",
293
294
  "configuration",
294
295
  "decision_rejected",
@@ -299,3 +300,31 @@ export const CORE_BUILTIN_SUBAGENT_TYPES = Object.freeze([
299
300
  "fork",
300
301
  "general-purpose",
301
302
  ]);
303
+ export const CORE_USER_ATTACHMENT_KINDS = Object.freeze([
304
+ "text",
305
+ "notebook",
306
+ "image",
307
+ "pdf",
308
+ "directory",
309
+ "client_text",
310
+ "client_image",
311
+ ]);
312
+ export const CORE_USER_ATTACHMENT_SUPPLIES = Object.freeze([
313
+ "path",
314
+ "content_text",
315
+ "content_image",
316
+ ]);
317
+ export const CORE_USER_ATTACHMENT_OUTCOMES = Object.freeze([
318
+ "attached",
319
+ "partial",
320
+ "unchanged",
321
+ "not_attached",
322
+ ]);
323
+ export const CORE_USER_ATTACHMENT_SEAT = Object.freeze({
324
+ entries: Object.freeze(["objective"]),
325
+ kinds: CORE_USER_ATTACHMENT_KINDS,
326
+ supplies: CORE_USER_ATTACHMENT_SUPPLIES,
327
+ limits: Object.freeze({ maxEntries: 20, maxRenderedTextChars: 100000 }),
328
+ });
329
+ export const CORE_USER_ATTACHMENTS_MAX = 20;
330
+ export const CORE_USER_ATTACHMENT_LABEL_MAX = 4096;
@@ -25,12 +25,14 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
25
25
  "config.peer_admission_out_of_range",
26
26
  "config.peer_lane_unmounted",
27
27
  "config.secret_env_scrubbed",
28
+ "config.credential_not_withheld",
28
29
  "config.permission_mode_unavailable",
29
30
  "permission.ask_released_by_mode",
30
31
  "permission.read_deny_unapplied",
31
32
  "permission.rule_store_unavailable",
32
33
  "permission.rule_row_dropped",
33
34
  "permission.allowed_tool_not_granted",
35
+ "mods.registration_refused",
34
36
  "peer.inbound_disposition",
35
37
  "peer.held_settled",
36
38
  "peer.idle_subscription",
@@ -64,7 +66,7 @@ export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
64
66
  "memory.project_scope_absent",
65
67
  "route.fallback_to_primary",
66
68
  "route.classifier_unroutable",
67
- "route.base_url_changed_key_unchanged",
69
+ "route.credential_origin_mismatch",
68
70
  "route.response_model_mismatch",
69
71
  "route.tool_call_id_folded",
70
72
  "route.finish_reason_unknown",
@@ -120,12 +122,14 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
120
122
  "config.peer_admission_out_of_range": "operator",
121
123
  "config.peer_lane_unmounted": "operator",
122
124
  "config.secret_env_scrubbed": "operator",
125
+ "config.credential_not_withheld": "operator",
123
126
  "config.permission_mode_unavailable": "user",
124
127
  "permission.ask_released_by_mode": "user",
125
128
  "permission.read_deny_unapplied": "user",
126
129
  "permission.rule_store_unavailable": "user",
127
130
  "permission.rule_row_dropped": "user",
128
131
  "permission.allowed_tool_not_granted": "user",
132
+ "mods.registration_refused": "user",
129
133
  "peer.inbound_disposition": "user",
130
134
  "peer.held_settled": "user",
131
135
  "peer.idle_subscription": "user",
@@ -159,7 +163,7 @@ export const CORE_NOTICE_AUDIENCE = Object.freeze({
159
163
  "memory.project_scope_absent": "operator",
160
164
  "route.fallback_to_primary": "operator",
161
165
  "route.classifier_unroutable": "operator",
162
- "route.base_url_changed_key_unchanged": "operator",
166
+ "route.credential_origin_mismatch": "user",
163
167
  "route.response_model_mismatch": "operator",
164
168
  "route.tool_call_id_folded": "operator",
165
169
  "route.finish_reason_unknown": "user",
@@ -221,12 +225,14 @@ export const CORE_NOTICE_MINTER = Object.freeze({
221
225
  "config.peer_admission_out_of_range": "engine",
222
226
  "config.peer_lane_unmounted": "engine",
223
227
  "config.secret_env_scrubbed": "engine",
228
+ "config.credential_not_withheld": "engine",
224
229
  "config.permission_mode_unavailable": "engine",
225
230
  "permission.ask_released_by_mode": "engine",
226
231
  "permission.read_deny_unapplied": "engine",
227
232
  "permission.rule_store_unavailable": "engine",
228
233
  "permission.rule_row_dropped": "engine",
229
234
  "permission.allowed_tool_not_granted": "engine",
235
+ "mods.registration_refused": "engine",
230
236
  "peer.inbound_disposition": "engine",
231
237
  "peer.held_settled": "engine",
232
238
  "peer.idle_subscription": "engine",
@@ -260,7 +266,7 @@ export const CORE_NOTICE_MINTER = Object.freeze({
260
266
  "memory.project_scope_absent": "engine",
261
267
  "route.fallback_to_primary": "engine",
262
268
  "route.classifier_unroutable": "engine",
263
- "route.base_url_changed_key_unchanged": "engine",
269
+ "route.credential_origin_mismatch": "engine",
264
270
  "route.response_model_mismatch": "engine",
265
271
  "route.tool_call_id_folded": "engine",
266
272
  "route.finish_reason_unknown": "engine",
@@ -1,3 +1,4 @@
1
+ import type { HooksClassification } from './settingsSchemaTypes.js';
1
2
  export declare const SETTINGS_AT_MENTION_MODES: readonly ["all", "none", "only"];
2
3
  export type SettingsAtMention = {
3
4
  readonly mode: Exclude<(typeof SETTINGS_AT_MENTION_MODES)[number], 'only'>;
@@ -11,3 +12,8 @@ export declare const SETTINGS_IS_HIERARCHICAL_URL: (raw: string) => boolean;
11
12
  export declare const SETTINGS_NARROW_AT_MENTION: (atMention: SettingsAtMention, available: ReadonlySet<string>) => SettingsAtMention;
12
13
  export declare const SETTINGS_HOOK_MATCHER_SELECTS: (matcher: string | undefined, name: string) => boolean | 'invalid';
13
14
  export declare const SETTINGS_HOOK_MATCHER_FORM: (matcher: string | undefined) => SettingsHookMatcherForm;
15
+ export declare const SETTINGS_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged", "MessageDisplay", "DirectoryAdded", "PreModelSwitch", "PostModelSwitch"];
16
+ export declare const SETTINGS_HOOKS_CLASSIFICATION_OUTCOMES: readonly ["loaded", "loaded-partial", "rejected"];
17
+ export declare const SETTINGS_HOOKS_DROPPED_PIECE_CODES: readonly ["hooks-not-object", "unknown-event", "event-not-array", "matcher-invalid", "entry-invalid"];
18
+ export declare const SETTINGS_HOOKS_REJECTION_CODES: readonly ["guard-outside-hooks", "hooks-is-matcher", "guard-under-unknown-event", "guard-event-not-array", "guard-matcher-invalid", "guard-entry-invalid"];
19
+ export declare const SETTINGS_CLASSIFY_HOOKS_CONFIG: (settingsDoc: unknown) => HooksClassification;
@@ -1,3 +1,4 @@
1
+ import { SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE } from './settingsSchemaHooksClassifier.js';
1
2
  export const SETTINGS_AT_MENTION_MODES = Object.freeze([
2
3
  "all",
3
4
  "none",
@@ -73,3 +74,59 @@ export const SETTINGS_HOOK_MATCHER_FORM = function hookMatcherForm(matcher) {
73
74
  }
74
75
  }
75
76
  };
77
+ export const SETTINGS_HOOK_EVENTS = Object.freeze([
78
+ "PreToolUse",
79
+ "PostToolUse",
80
+ "PostToolUseFailure",
81
+ "PostToolBatch",
82
+ "Notification",
83
+ "UserPromptSubmit",
84
+ "UserPromptExpansion",
85
+ "SessionStart",
86
+ "SessionEnd",
87
+ "Stop",
88
+ "StopFailure",
89
+ "SubagentStart",
90
+ "SubagentStop",
91
+ "PreCompact",
92
+ "PostCompact",
93
+ "PermissionRequest",
94
+ "PermissionDenied",
95
+ "Setup",
96
+ "TeammateIdle",
97
+ "TaskCreated",
98
+ "TaskCompleted",
99
+ "Elicitation",
100
+ "ElicitationResult",
101
+ "ConfigChange",
102
+ "WorktreeCreate",
103
+ "WorktreeRemove",
104
+ "InstructionsLoaded",
105
+ "CwdChanged",
106
+ "FileChanged",
107
+ "MessageDisplay",
108
+ "DirectoryAdded",
109
+ "PreModelSwitch",
110
+ "PostModelSwitch",
111
+ ]);
112
+ export const SETTINGS_HOOKS_CLASSIFICATION_OUTCOMES = Object.freeze([
113
+ "loaded",
114
+ "loaded-partial",
115
+ "rejected",
116
+ ]);
117
+ export const SETTINGS_HOOKS_DROPPED_PIECE_CODES = Object.freeze([
118
+ "hooks-not-object",
119
+ "unknown-event",
120
+ "event-not-array",
121
+ "matcher-invalid",
122
+ "entry-invalid",
123
+ ]);
124
+ export const SETTINGS_HOOKS_REJECTION_CODES = Object.freeze([
125
+ "guard-outside-hooks",
126
+ "hooks-is-matcher",
127
+ "guard-under-unknown-event",
128
+ "guard-event-not-array",
129
+ "guard-matcher-invalid",
130
+ "guard-entry-invalid",
131
+ ]);
132
+ export const SETTINGS_CLASSIFY_HOOKS_CONFIG = SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE(SETTINGS_HOOK_EVENTS);
@@ -0,0 +1,2 @@
1
+ import type { HooksClassification } from './settingsSchemaTypes.js';
2
+ export declare const SETTINGS_CLASSIFY_HOOKS_CONFIG_CLOSURE: (HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostToolUseFailure", "PostToolBatch", "Notification", "UserPromptSubmit", "UserPromptExpansion", "SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PermissionRequest", "PermissionDenied", "Setup", "TeammateIdle", "TaskCreated", "TaskCompleted", "Elicitation", "ElicitationResult", "ConfigChange", "WorktreeCreate", "WorktreeRemove", "InstructionsLoaded", "CwdChanged", "FileChanged", "MessageDisplay", "DirectoryAdded", "PreModelSwitch", "PostModelSwitch"]) => (settingsDoc: unknown) => HooksClassification;