@sema-agent/client-core 0.102.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 (95) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/README.md +8 -5
  3. package/dist/adapt/toolCards.d.ts +2 -1
  4. package/dist/adapt/toolCards.js +3 -1
  5. package/dist/adapter/downstream/eventToSdkMessage.d.ts +5 -1
  6. package/dist/adapter/downstream/eventToSdkMessage.js +21 -3
  7. package/dist/adapter/downstream/terminalToSdkResult.js +0 -1
  8. package/dist/adapter/downstream/wiringManifestView.js +4 -1
  9. package/dist/cloudConfigWireCaps.js +6 -3
  10. package/dist/credentialPlaneCapability.d.ts +22 -0
  11. package/dist/credentialPlaneCapability.js +75 -0
  12. package/dist/deviceExecutorManagementCapability.d.ts +1 -0
  13. package/dist/deviceExecutorManagementCapability.js +3 -1
  14. package/dist/engineErrorCodes.d.ts +1 -0
  15. package/dist/engineErrorCodes.js +3 -1
  16. package/dist/engineNoticeCodes.d.ts +26 -0
  17. package/dist/engineNoticeCodes.js +121 -12
  18. package/dist/engineRowRef.js +1 -0
  19. package/dist/errorSupplementRoles.js +1 -3
  20. package/dist/eventLeg.js +2 -1
  21. package/dist/fleet/fleetProjection.js +15 -9
  22. package/dist/gateOutcome.d.ts +20 -0
  23. package/dist/gateOutcome.js +89 -0
  24. package/dist/generated/engineAskFaceTables.js +2 -2
  25. package/dist/generated/engineFactTables.d.ts +6 -2
  26. package/dist/generated/engineFactTables.js +41 -1
  27. package/dist/generated/engineNoticeTables.js +18 -0
  28. package/dist/generated/settingsSchemaDefaultModel.d.ts +1 -1
  29. package/dist/generated/settingsSchemaDefaultModel.js +2 -2
  30. package/dist/generated/settingsSchemaFns.d.ts +15 -0
  31. package/dist/generated/settingsSchemaFns.js +25 -2
  32. package/dist/generated/settingsSchemaHooksClassifier.js +109 -29
  33. package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
  34. package/dist/generated/settingsSchemaMcpRequestEntry.js +213 -93
  35. package/dist/generated/settingsSchemaMcpServerName.d.ts +1 -0
  36. package/dist/generated/settingsSchemaMcpServerName.js +8 -0
  37. package/dist/generated/settingsSchemaOwnKeyRead.d.ts +1 -0
  38. package/dist/generated/settingsSchemaOwnKeyRead.js +172 -0
  39. package/dist/generated/settingsSchemaPlainJsonObject.d.ts +1 -0
  40. package/dist/generated/settingsSchemaPlainJsonObject.js +28 -0
  41. package/dist/generated/settingsSchemaSafetyMergeSpec.js +10 -7
  42. package/dist/generated/settingsSchemaTierWords.d.ts +1 -0
  43. package/dist/generated/settingsSchemaTierWords.js +7 -0
  44. package/dist/generated/settingsSchemaTypes.d.ts +3 -1
  45. package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
  46. package/dist/hitl/decisionConflict.js +11 -11
  47. package/dist/hitl/decisionRefusal.d.ts +1 -0
  48. package/dist/hitl/decisionRefusal.js +4 -2
  49. package/dist/hitl/editedRuleTextPrecheck.d.ts +1 -0
  50. package/dist/hitl/editedRuleTextPrecheck.js +26 -1
  51. package/dist/hitl/persistedRulesWire.js +1 -0
  52. package/dist/hitl/planReviewWire.d.ts +2 -1
  53. package/dist/hitl/planReviewWire.js +8 -12
  54. package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
  55. package/dist/hitl/sessionPolicyDeliverable.js +0 -5
  56. package/dist/hitl/sessionPolicyWire.js +1 -1
  57. package/dist/hitl/toolApprovalWire.d.ts +18 -6
  58. package/dist/hitl/toolApprovalWire.js +9 -4
  59. package/dist/i18n/messages.en.d.ts +5 -0
  60. package/dist/i18n/messages.en.js +6 -1
  61. package/dist/i18n/messages.zh.js +6 -1
  62. package/dist/index.d.ts +3 -2
  63. package/dist/index.js +2 -1
  64. package/dist/inheritEnvWire.d.ts +1 -0
  65. package/dist/inheritEnvWire.js +8 -5
  66. package/dist/mcpEngineLeg.d.ts +3 -0
  67. package/dist/mcpEngineLeg.js +4 -1
  68. package/dist/mcpLiveness.d.ts +18 -0
  69. package/dist/mcpLiveness.js +48 -1
  70. package/dist/mcpReconnect.d.ts +3 -0
  71. package/dist/mcpReconnect.js +6 -0
  72. package/dist/mcpStatusSupersetKeys.js +24 -1
  73. package/dist/mcpWireCaps.d.ts +2 -3
  74. package/dist/mcpWireCaps.js +9 -8
  75. package/dist/memoryEntriesWire.d.ts +35 -1
  76. package/dist/memoryEntriesWire.js +110 -14
  77. package/dist/modsFace.js +7 -3
  78. package/dist/postureKnob.js +1 -1
  79. package/dist/prepareRefusal.d.ts +0 -1
  80. package/dist/prepareRefusal.js +0 -3
  81. package/dist/promptProfileWireCaps.d.ts +1 -3
  82. package/dist/promptProfileWireCaps.js +2 -2
  83. package/dist/request/taskRequest.d.ts +1 -1
  84. package/dist/request/taskRequest.js +3 -3
  85. package/dist/retryStatus.d.ts +13 -1
  86. package/dist/retryStatus.js +20 -5
  87. package/dist/seatContract.js +10 -0
  88. package/dist/sessionMemoryErase.js +24 -2
  89. package/dist/turnFailurePresentation.js +8 -1
  90. package/dist/wireFailureShape.d.ts +12 -1
  91. package/dist/wireFailureShape.js +58 -24
  92. package/dist/wireRefusalCopy.d.ts +0 -3
  93. package/dist/wireRefusalCopy.js +0 -17
  94. package/docs/INTEGRATION-CLIENTS.md +155 -10
  95. package/package.json +5 -5
@@ -118,7 +118,7 @@ export interface McpEntryKeyIssue {
118
118
  readonly path: string;
119
119
  readonly reason: string;
120
120
  readonly member?: string;
121
- readonly fault?: "not_plain_record" | "member_not_string" | "member_name_reserved";
121
+ readonly fault?: PlainStringRecordFault;
122
122
  }
123
123
  export type RequestMcpTransportRead = {
124
124
  ok: true;
@@ -128,6 +128,8 @@ export type RequestMcpTransportRead = {
128
128
  ok: false;
129
129
  issue: McpEntryKeyIssue;
130
130
  };
131
+ declare const PLAIN_STRING_RECORD_FAULTS: readonly ["not_plain_record", "member_not_string", "member_name_reserved"];
132
+ export type PlainStringRecordFault = (typeof PLAIN_STRING_RECORD_FAULTS)[number];
131
133
  declare const MCP_CONTENT_ORIGINS: readonly ["local", "execution", "external"];
132
134
  export type McpContentOrigin = (typeof MCP_CONTENT_ORIGINS)[number];
133
135
  export {};
@@ -20,7 +20,7 @@ export type AutomaticAnswerVerdict = {
20
20
  readonly kind: 'unknown';
21
21
  readonly why: AutomaticAnswerUnknownWhy;
22
22
  };
23
- export declare const MODE_ARBITRATION: Readonly<Record<"hook" | "write_protection" | "mode" | "target_unresolved" | "content_question" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
23
+ export declare const MODE_ARBITRATION: Readonly<Record<"hook" | "write_protection" | "mode" | "target_unresolved" | "content_question" | "ancestor" | "dangerous_delete" | "unverifiable_delete" | "unverifiable_shell_text" | "transcript_write" | "org_rule" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "cross_boundary" | "operator_forced" | "shell_floor" | "probe" | "write_protection_on_disk" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
24
24
  export declare function foldModeArbitrationRow(classes: Iterable<string>, askFace?: AutomaticAnswerAskFace): CoreModeArbitrationRow;
25
25
  export declare function automaticAnswerVerdict(card: object | null | undefined, lane: AutomaticAnswerLane, facts?: AutomaticAnswerFacts | null): AutomaticAnswerVerdict;
26
26
  export declare function mandatedApprovalDetailOf(card: object | null | undefined, lang?: UiLanguage): string;
@@ -1,9 +1,10 @@
1
1
  import { APPROVAL_BINDING_MISMATCH, CHECKPOINT_UNSUPPORTED_VERSION, RESUME_OUTCOME_INVALID } from '../engineErrorCodes.js';
2
2
  import { msg, renderMessage } from '../i18n/translate.js';
3
3
  import { ownDataField } from '../ownKey.js';
4
- import { isSlotCarrier, PROTOCOL_ERROR_NAME, protocolErrorNameOf, readRefusalField } from '../wireFailureShape.js';
4
+ import { isSlotCarrier, PROTOCOL_ERROR_NAME, protocolErrorNameReading, readRefusalSlots, readThrownExtraSnapshot } from '../wireFailureShape.js';
5
5
  const BINDING_SEAT_FIELDS = new Set(['boundCallId', 'boundInputHash']);
6
6
  const ANSWER_FIELD = 'answer';
7
+ const REFUSAL_WORD_KEYS = Object.freeze(['field', 'reason']);
7
8
  const GRANT_DIGEST_FIELD = 'boundGrantDigest';
8
9
  function namedProtocolOf(r) {
9
10
  return r.state === 'named' ? r.name : undefined;
@@ -11,6 +12,7 @@ function namedProtocolOf(r) {
11
12
  export function decisionConflictOf(err, captured, protocolNameRead) {
12
13
  if (!isSlotCarrier(err))
13
14
  return undefined;
15
+ const extra = readThrownExtraSnapshot(err);
14
16
  let code;
15
17
  if (captured !== undefined) {
16
18
  if (captured.state !== 'read')
@@ -25,23 +27,21 @@ export function decisionConflictOf(err, captured, protocolNameRead) {
25
27
  return undefined;
26
28
  }
27
29
  }
28
- const protocolName = protocolNameRead !== undefined ? namedProtocolOf(protocolNameRead) : protocolErrorNameOf(err);
30
+ const protocolName = namedProtocolOf(protocolNameRead ?? protocolErrorNameReading(err, extra));
29
31
  if (code === CHECKPOINT_UNSUPPORTED_VERSION)
30
32
  return 'format_version';
31
33
  const bindingFamily = code === APPROVAL_BINDING_MISMATCH || (code === undefined && protocolName === PROTOCOL_ERROR_NAME.ApprovalBindingMismatchError);
32
34
  if (!bindingFamily && code !== RESUME_OUTCOME_INVALID)
33
35
  return undefined;
34
- let field;
35
- try {
36
- field = readRefusalField(err);
37
- }
38
- catch {
39
- field = undefined;
40
- }
36
+ const slots = readRefusalSlots(err, REFUSAL_WORD_KEYS, extra.bag);
37
+ const field = slots.field.word;
41
38
  if (code === RESUME_OUTCOME_INVALID)
42
39
  return field === ANSWER_FIELD ? 'answer_invalid' : field === GRANT_DIGEST_FIELD ? 'grant_changed' : undefined;
43
- if (field === undefined)
44
- return 'row_integrity';
40
+ if (field === undefined) {
41
+ if (slots.field.present)
42
+ return undefined;
43
+ return slots.reason.word !== undefined ? 'row_integrity' : undefined;
44
+ }
45
45
  return BINDING_SEAT_FIELDS.has(field) ? 'binding_mismatch' : undefined;
46
46
  }
47
47
  export const DECISION_ANSWER_INVALID_CONTENT = 'The engine rejected the answer itself because it does not fit the question that was asked · Nothing was decided and the question is still waiting · Correct the answer and send it again';
@@ -54,6 +54,7 @@ export interface DecisionRefusalReading {
54
54
  readonly transient?: true;
55
55
  readonly conflict?: DecisionRefusalConflict;
56
56
  readonly unrecoverable?: true;
57
+ readonly acceptableForm?: {} | null;
57
58
  }
58
59
  export declare function mintDecisionRefusalReading(err: {} | null | undefined, context?: RefusalRouteContext, attributionCarried?: boolean, delivered?: DeliveredReading, carried?: RefusalCarrier): DecisionRefusalReading;
59
60
  export declare function readDecisionRefusalReading(err: {} | null | undefined, context?: RefusalRouteContext): DecisionRefusalReading;
@@ -1,4 +1,4 @@
1
- import { ASK_GONE, ASK_GONE_PARKED, RESUME_PREFLIGHT_REJECTED, isDecideAlreadyResolvedCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, refusalRetriableReading, refusalSaysStillPending } from '../engineErrorCodes.js';
1
+ import { ASK_GONE, ASK_GONE_PARKED, RESUME_CONSTRAINT_REJECTED, RESUME_PREFLIGHT_REJECTED, isDecideAlreadyResolvedCode, isDecideParkMovedCode, isDecideRowUnrevivableCode, refusalRetriableReading, refusalSaysStillPending } from '../engineErrorCodes.js';
2
2
  import { isUiLanguage } from '../env/uiLanguage.js';
3
3
  import { msg, renderMessage } from '../i18n/translate.js';
4
4
  import { notPendingCauseReading, refusalCauseWordOf } from './approvalEndingCause.js';
@@ -7,7 +7,7 @@ import { isAlreadyResolvedGateReason, isCodeClassifiedGateFailure } from './park
7
7
  import { decisionConflictOf } from './decisionConflict.js';
8
8
  import { readLivePendingRows } from './livePendingAsk.js';
9
9
  import { guardedRead, ownDataField, readOwnDataValue } from '../ownKey.js';
10
- import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, isDisplayableWireCode, isSlotCarrier, ownFoldedCodeBitsOf, protocolErrorNameReading, readErrorRecord, readRefusalField, readThrownSlot } from '../wireFailureShape.js';
10
+ import { PROTOCOL_ERROR_NAME, THROWN_SLOT_UNREADABLE, isDisplayableWireCode, isSlotCarrier, ownFoldedCodeBitsOf, protocolErrorNameReading, readErrorPresent, readErrorRecord, readRefusalField, readThrownSlot } from '../wireFailureShape.js';
11
11
  import { attributionRefusalOf, carrierReadOf } from './attributionLadder.js';
12
12
  import { CODE_UNREADABLE, ownReadingSlot } from '../engineWireFor.js';
13
13
  export const ASK_DECIDED_CODE = 'conflict.ask_decided';
@@ -223,6 +223,7 @@ export function mintDecisionRefusalReading(err, context, attributionCarried, del
223
223
  const inRange = standing !== undefined && status !== undefined;
224
224
  const conflict = inRange && status === 409 && obj !== undefined ? isolated(() => decisionConflictOf(obj, captured, pn)) : undefined;
225
225
  const unrecoverable = inRange && status !== undefined && Number.isInteger(status) && status >= 400 && status <= 599 && isDecideRowUnrevivableCode(errorCode);
226
+ const acceptableForm = errorCode === RESUME_CONSTRAINT_REJECTED && obj !== undefined ? isolated(() => readErrorPresent(obj, 'acceptableForm')) : undefined;
226
227
  const transient = inRange &&
227
228
  conflict !== 'grant_changed' &&
228
229
  !unrecoverable &&
@@ -244,6 +245,7 @@ export function mintDecisionRefusalReading(err, context, attributionCarried, del
244
245
  ...(transient ? { transient: true } : {}),
245
246
  ...(conflict !== undefined ? { conflict } : {}),
246
247
  ...(unrecoverable ? { unrecoverable: true } : {}),
248
+ ...(acceptableForm !== undefined ? { acceptableForm } : {}),
247
249
  });
248
250
  }
249
251
  export function readDecisionRefusalReading(err, context) {
@@ -12,6 +12,7 @@ export type EditedRuleTextPrecheck = {
12
12
  message: string;
13
13
  };
14
14
  export type EditedRuleTextPrechecker = (text: string, command: string) => EditedRuleTextPrecheck;
15
+ export declare function trimEditedRuleText(text: string): string;
15
16
  export declare function installEditedRuleTextPrechecker(fn: EditedRuleTextPrechecker | null): () => void;
16
17
  export declare function hasEditedRuleTextPrechecker(): boolean;
17
18
  export declare function precheckEditedRuleText(text: string, command: string): EditedRuleTextPrecheck | undefined;
@@ -1,4 +1,29 @@
1
1
  let installed = null;
2
+ function escapedAt(s, i) {
3
+ let n = 0;
4
+ for (let j = i - 1; j >= 0 && s[j] === '\\'; j -= 1)
5
+ n += 1;
6
+ return n % 2 === 1;
7
+ }
8
+ export function trimEditedRuleText(text) {
9
+ if (typeof text !== 'string')
10
+ return text;
11
+ const outer = text.trim();
12
+ let open = -1;
13
+ for (let i = 0; i < outer.length; i += 1) {
14
+ if (outer[i] === '(' && !escapedAt(outer, i)) {
15
+ open = i;
16
+ break;
17
+ }
18
+ }
19
+ if (open <= 0)
20
+ return outer;
21
+ const head = outer.slice(0, open);
22
+ const name = head.trimEnd();
23
+ if (name === head || name.length === 0 || name.endsWith('\\'))
24
+ return outer;
25
+ return name + outer.slice(open);
26
+ }
2
27
  export function installEditedRuleTextPrechecker(fn) {
3
28
  const prev = installed;
4
29
  installed = fn;
@@ -13,7 +38,7 @@ export function precheckEditedRuleText(text, command) {
13
38
  const fn = installed;
14
39
  if (fn === null)
15
40
  return undefined;
16
- return fn(text, command);
41
+ return fn(trimEditedRuleText(text), command);
17
42
  }
18
43
  export function _resetEditedRuleTextPrecheckerForTest() {
19
44
  installed = null;
@@ -208,6 +208,7 @@ const PERSISTED_RULE_MATCH_KEYS = Object.freeze({
208
208
  host: 'rules.match.host',
209
209
  subdomain: 'rules.match.subdomain',
210
210
  pattern: 'rules.match.pattern',
211
+ tool: 'rules.match.tool',
211
212
  });
212
213
  export function persistedRuleMatchLabel(ruleOrMatch, lang) {
213
214
  const word = typeof ruleOrMatch === 'string' ? ruleOrMatch : ownSlot(ruleOrMatch, 'match');
@@ -1,4 +1,5 @@
1
1
  import { type QuestionAnswer } from '../liveQuestionStore.js';
2
+ import type { EngineWireInjection } from '../engineWireSdk.js';
2
3
  import { type PlanReviewModeAfter } from './hitlBridge.js';
3
4
  import type { AgentClient } from '@sema-agent/sdk';
4
5
  import type { ReopenCardVerdict } from '../adapter/activeRunSelfHeal.js';
@@ -66,7 +67,7 @@ export type PlanReviewWireClient = {
66
67
  assistant: Pick<AgentClient['assistant'], 'planReview'>;
67
68
  runs: Pick<AgentClient['runs'], 'get'>;
68
69
  };
69
- export interface PlanReviewWire {
70
+ export interface PlanReviewWire extends EngineWireInjection<PlanReviewWireClient> {
70
71
  client: PlanReviewWireClient;
71
72
  }
72
73
  export interface PlanReviewDecisionOutcome extends PlanReviewOutcomeMeta {
@@ -2,6 +2,7 @@ import { publishQuestionFrame, publishQuestionFrameFor, registerLocalQuestionRes
2
2
  import { hostLog } from '../host.js';
3
3
  import { abortableSleep, settleWithinDeadline } from '../abortableSleep.js';
4
4
  import { clientHasVerbs, engineWireFor, noAnswerKindOf, sendOnce } from '../engineWireFor.js';
5
+ import { engineCapTrue } from '../engineCapsCache.js';
5
6
  import { engineWireTarget } from '../engineWireTarget.js';
6
7
  import { enqueuePlanReviewOutcome } from '../notifications.js';
7
8
  import { corruptStoredRowContent, corruptStoredRowWhere } from '../wireErrorTriage.js';
@@ -370,7 +371,7 @@ export function armPlanReviewApproval(result, sessionKey, opts) {
370
371
  }
371
372
  const wire = opts?.wire;
372
373
  if (wire !== undefined) {
373
- if (!usablePlanReviewWireClient(wire.client)) {
374
+ if (engineWireFor(wire, DEFAULT_SESSION_KEY, usablePlanReviewWireClient).kind !== 'injected') {
374
375
  hostLog('error', 'planReviewWire: plan_review card NOT armed — the engine client supplied by the host is not usable (needs assistant.planReview and runs.get)');
375
376
  return false;
376
377
  }
@@ -454,15 +455,6 @@ export function planReviewOutcomeTail(taskId, decision, effect, cause) {
454
455
  return `Do not state the result as fact: tell the user the ${decision} was submitted but its effect could not be confirmed; TaskOutput("${taskId}") shows where the task stands.`;
455
456
  }
456
457
  }
457
- function clientOnlyView(wire) {
458
- if (wire === undefined || wire === null || typeof wire !== 'object')
459
- return wire;
460
- return {
461
- get client() {
462
- return wire.client;
463
- },
464
- };
465
- }
466
458
  function planReviewDecisionTimedOutOutcome(decision) {
467
459
  return (`The plan_review ${decision} was sent, but no answer came back from the engine within the time limit this host allows for it — ` +
468
460
  `it may have taken effect (${decision === 'approve' ? 'an approval keeps the engine busy until the resumed work finishes' : 'the engine may still be applying it'}).`);
@@ -654,7 +646,7 @@ async function decidePlanReviewInner(taskId, decision, permissionModeAfter, disp
654
646
  let stillParkedCause;
655
647
  let statusSeen;
656
648
  const wire = opts?.wire;
657
- const resolved = engineWireFor(clientOnlyView(wire), DEFAULT_SESSION_KEY, usablePlanReviewWireClient);
649
+ const resolved = engineWireFor(wire, DEFAULT_SESSION_KEY, usablePlanReviewWireClient);
658
650
  const badMode = permissionModeAfter !== undefined && !isPlanReviewModeAfter(permissionModeAfter);
659
651
  if (badMode) {
660
652
  hostLog('error', `planReviewWire: ${decision} NOT sent — permissionModeAfter must be "default" or "acceptEdits"`);
@@ -683,11 +675,15 @@ async function decidePlanReviewInner(taskId, decision, permissionModeAfter, disp
683
675
  try {
684
676
  const mode = isPlanReviewModeAfter(permissionModeAfter) ? permissionModeAfter : undefined;
685
677
  const reason = denyReasonForWire(opts?.reason, `plan-review ${taskId}`);
678
+ const capsBase = resolved.kind === 'target' ? resolved.target.baseUrl : resolved.capsBaseUrl;
679
+ const checkpointId = gateBefore !== undefined && engineCapTrue(capsBase, 'planReviewCheckpointId') ? gateBefore : undefined;
686
680
  const reqBody = { decision };
687
681
  if (reason !== undefined)
688
682
  reqBody.reason = reason;
689
683
  if (mode !== undefined)
690
684
  reqBody.permissionModeAfter = mode;
685
+ if (checkpointId !== undefined)
686
+ reqBody.checkpointId = checkpointId;
691
687
  let body;
692
688
  try {
693
689
  body = await sendOnce(undefined, () => client.assistant.planReview(taskId, reqBody));
@@ -697,7 +693,7 @@ async function decidePlanReviewInner(taskId, decision, permissionModeAfter, disp
697
693
  const defaultConflict = mode === 'default' && conflict?.status === 400 && conflict?.errorCode === REQUEST_FIELD_CONFLICT;
698
694
  if (defaultConflict && !directFailureVerdictOf(e1, directSafetyStopOf(e1)).yields) {
699
695
  hostLog('debug', 'planReviewWire: permissionModeAfter "default" refused as not applicable — re-sending the approval without the key (same meaning)');
700
- body = await sendOnce(undefined, () => client.assistant.planReview(taskId, reason !== undefined ? { decision, reason } : { decision }));
696
+ body = await sendOnce(undefined, () => client.assistant.planReview(taskId, { decision, ...(reason !== undefined ? { reason } : {}), ...(checkpointId !== undefined ? { checkpointId } : {}) }));
701
697
  }
702
698
  else {
703
699
  throw e1;
@@ -22,4 +22,3 @@ export interface SessionPolicyDeliverableOptions {
22
22
  }
23
23
  export declare function sessionPolicyDeliverable(behavior: 'deny' | 'ask', rules: readonly string[], opts?: SessionPolicyDeliverableOptions): SessionPolicyDeliverability;
24
24
  export declare function sessionPolicyWithheldNotice(why: SessionPolicyWithheldWhy, lang?: UiLanguage): string;
25
- export declare function legacyToolNameFailureNoteOf(code: string | undefined): string | undefined;
@@ -1,11 +1,9 @@
1
- import { CONFIG_LEGACY_TOOL_NAME } from '../engineErrorCodes.js';
2
1
  import { rosterMountedNames } from '../rosterMountedNames.js';
3
2
  import { msg, renderMessage } from '../i18n/translate.js';
4
3
  import { readOwnDataValue } from '../ownKey.js';
5
4
  import { denyEntryReading, ruleCompileVerdict } from '../ruleCompileVerdict.js';
6
5
  import { ruleToolNameVerdictOf } from '../protocolSegment.js';
7
6
  import { PREFIXES_IN_PROSE, REFUSED_NAME_FIX } from './refusedToolNameProse.js';
8
- import { prepareRefusalNoteOf } from '../prepareRefusal.js';
9
7
  import { CORE_PROTOCOL_PREFIXES } from '../generated/toolNameTables.js';
10
8
  const COVERING_NAMESPACE_PREFIXES = CORE_PROTOCOL_PREFIXES;
11
9
  const WITHHELD_NOTICE = {
@@ -204,6 +202,3 @@ export function sessionPolicyWithheldNotice(why, lang) {
204
202
  }
205
203
  return 'Not written to this session’s rule record.';
206
204
  }
207
- export function legacyToolNameFailureNoteOf(code) {
208
- return code === CONFIG_LEGACY_TOOL_NAME ? prepareRefusalNoteOf(code) : undefined;
209
- }
@@ -21,7 +21,7 @@ const RULE_FIELD_PRESENCE = {
21
21
  toolDeny: true,
22
22
  allowDirs: true,
23
23
  };
24
- const RECORD_META_KEYS = Object.freeze(['rev', 'gen', 'grammar']);
24
+ const RECORD_META_KEYS = Object.freeze(['rev', 'gen', 'grammar', 'operatorRules']);
25
25
  const _metaKeysPin = true;
26
26
  void _metaKeysPin;
27
27
  export const SESSION_POLICY_RULE_FIELDS = Object.freeze(Object.keys(RULE_FIELD_PRESENCE));
@@ -1,6 +1,7 @@
1
1
  import { type HitlClientLike, type DecideOperationObserver } from './hitlBridge.js';
2
2
  import { readApprovalCardWord, type ApprovalCardWord } from './approvalCardReading.js';
3
3
  import { type ApprovalAllowRuleShadow } from './allowRuleShadow.js';
4
+ import { CORE_PERSISTED_RULE_MATCHES } from '../generated/engineFactTables.js';
4
5
  import type { UiLanguage } from '../env/uiLanguage.js';
5
6
  import type { SessionRuleInertReason } from './sessionPolicyWire.js';
6
7
  import { type ApprovalCardClaim } from './approvalHolds.js';
@@ -30,22 +31,33 @@ export type { RuleOfferBatchMember };
30
31
  export type { RuleOfferUncoveredDetail };
31
32
  export type { RuleOfferUncoveredReason };
32
33
  export { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS };
34
+ type RuleOfferMatchWord = (typeof CORE_PERSISTED_RULE_MATCHES)[number];
35
+ type RuleOfferBatchMemberReading = Exclude<RuleOfferBatchMember, {
36
+ kind: 'command';
37
+ }> | (Omit<Extract<RuleOfferBatchMember, {
38
+ kind: 'command';
39
+ }>, 'match'> & {
40
+ match: RuleOfferMatchWord;
41
+ });
33
42
  export type { AskOrigin };
34
43
  export type { RuleOffersAbsence };
35
44
  export type { DenialLimitKind };
36
45
  export type { DenialLimitFallback };
37
46
  export { RULE_OFFERS_ABSENCE_REASONS };
38
47
  export declare const ASK_ORIGIN_WORDS: readonly string[];
39
- export type RuleOfferReading = (Extract<SdkRuleOffer, {
48
+ export type RuleOfferReading = (Omit<Extract<SdkRuleOffer, {
40
49
  kind: 'single';
41
- }> & {
50
+ }>, 'match'> & {
51
+ match: RuleOfferMatchWord;
42
52
  offerIndex: number;
43
53
  }) | (Omit<Extract<SdkRuleOffer, {
44
54
  kind: 'batch';
45
- }>, 'uncoveredDetail'> & {
55
+ }>, 'uncoveredDetail' | 'rules'> & RuleOfferBatchReadingSeats);
56
+ interface RuleOfferBatchReadingSeats {
57
+ rules: RuleOfferBatchMemberReading[];
46
58
  offerIndex: number;
47
59
  uncoveredDetail?: readonly RuleOfferUncoveredDetail[];
48
- });
60
+ }
49
61
  export interface ApprovalCardAllowDecision {
50
62
  kind: 'allow';
51
63
  allowSession: boolean;
@@ -263,8 +275,8 @@ export declare function approvalSupersedesDetail(card: Pick<ApprovalCardRequest,
263
275
  export declare function readDenialLimitFallback(v: unknown): DenialLimitFallback | undefined;
264
276
  export declare function readRuleOffers(v: unknown): RuleOfferReading[] | undefined;
265
277
  export declare function readRuleOfferSupply(offers: unknown): RuleOfferReading[] | undefined;
266
- export type ApprovalCardV1Facts = Pick<ApprovalCardRequest, 'toolName' | 'args'> & Pick<ApprovalCardRequest, 'toolCallId' | 'workerBadge' | 'wireNote' | 'argsUnavailable' | 'governanceForced' | 'delegation' | 'ruleOffersReadOnly' | 'inputHasBidi' | 'allowRuleShadow' | 'probeCause' | 'rememberRefused' | 'ruleEvidence' | 'requiresRealApproval' | 'ruleOffersAbsence' | 'denialLimitFallback' | 'askClass' | 'classes' | 'grantBinding' | 'unreadableEvidence' | 'message'>;
267
- export type ApprovalCardFacts = ApprovalCardV1Facts & Pick<ApprovalCardRequest, 'ruleOffers' | 'probeReason' | 'mandated' | 'mandate' | 'readRootCandidate' | 'origin' | 'approvalCard' | 'boundGrants' | 'classifierNoRuling' | 'allowSessionCarried' | 'cardPayloadUnreadable'>;
278
+ export type ApprovalCardV1Facts = Pick<ApprovalCardRequest, 'toolName' | 'args'> & Pick<ApprovalCardRequest, 'toolCallId' | 'workerBadge' | 'wireNote' | 'argsUnavailable' | 'governanceForced' | 'delegation' | 'ruleOffersReadOnly' | 'inputHasBidi' | 'allowRuleShadow' | 'probeCause' | 'rememberRefused' | 'ruleEvidence' | 'requiresRealApproval' | 'ruleOffersAbsence' | 'denialLimitFallback' | 'askClass' | 'classes' | 'grantBinding' | 'unreadableEvidence' | 'message' | 'approvalCard'>;
279
+ export type ApprovalCardFacts = ApprovalCardV1Facts & Pick<ApprovalCardRequest, 'ruleOffers' | 'probeReason' | 'mandated' | 'mandate' | 'readRootCandidate' | 'origin' | 'boundGrants' | 'classifierNoRuling' | 'allowSessionCarried' | 'cardPayloadUnreadable'>;
268
280
  export interface ApprovalCardFrameFactsOptions {
269
281
  readonly streamArgs?: object;
270
282
  readonly argsUnavailable?: true;
@@ -3,6 +3,7 @@ import { askParkRowArm } from './askParkRowRouting.js';
3
3
  import { parkGateArmOf } from './frameRouter.js';
4
4
  import { seatSessionRowOf } from './standingRows.js';
5
5
  import { hostLog } from '../host.js';
6
+ import { trimEditedRuleText } from './editedRuleTextPrecheck.js';
6
7
  import { appendOwnElement, guardedRead, readAskOrigin, readOwnDataNonEmptyString, readOwnDataValue, readOwnNonEmptyString } from '../ownKey.js';
7
8
  import { ownReadingSlot } from '../engineWireFor.js';
8
9
  import { DEPLOYMENT_LIST_ASK_CLASSES, readAskClassPair } from './askClassPair.js';
@@ -12,7 +13,7 @@ import { readAllowRuleShadowFromWire, retiredAllowRuleShadowKeyPresent, RETIRED_
12
13
  import { createSessionSlot, DEFAULT_SESSION_KEY } from '../sessionSlot.js';
13
14
  import { readEngineActiveBgTasks } from '../fleet/fleetLedger.js';
14
15
  import { CORE_SKILL_TOOL_NAME } from '../generated/toolNameTables.js';
15
- import { CORE_ALLOW_ENTRY_INERT_REASONS } from '../generated/engineFactTables.js';
16
+ import { CORE_ALLOW_ENTRY_INERT_REASONS, CORE_PERSISTED_RULE_MATCHES } from '../generated/engineFactTables.js';
16
17
  import { msg, renderMessage } from '../i18n/translate.js';
17
18
  import { INTERRUPT_DENY_REASON, observeCancelByDeny, surfaceApprovalParking, surfaceRememberNotApplied, surfaceEditNotForwarded, surfaceEditRefusedOnBlindAsk, surfaceRuleArmNotSent, surfaceRuleArmRejected } from './hitlHostSurface.js';
18
19
  import { approvalCallKey, liveFrameCallKey } from './gateIdentity.js';
@@ -67,6 +68,8 @@ export function structurallyEqual(a, b) {
67
68
  return ka.every(k => structurallyEqual(a[k], b[k]));
68
69
  }
69
70
  export { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS };
71
+ const _sdkRuleOfferMatchWithinEngine = true;
72
+ void _sdkRuleOfferMatchWithinEngine;
70
73
  export { RULE_OFFERS_ABSENCE_REASONS };
71
74
  export const ASK_ORIGIN_WORDS = ASK_ORIGINS;
72
75
  export const APPROVAL_DENY_SETTLED_BY_WORDS = Object.freeze(['human', 'policy']);
@@ -1336,7 +1339,7 @@ export function readDenialLimitFallback(v) {
1336
1339
  };
1337
1340
  }
1338
1341
  function isRuleOfferMatch(v) {
1339
- return typeof v === 'string' && RULE_OFFER_MATCHES.includes(v);
1342
+ return typeof v === 'string' && CORE_PERSISTED_RULE_MATCHES.includes(v);
1340
1343
  }
1341
1344
  function readRuleTriple(v) {
1342
1345
  if (v === null || typeof v !== 'object')
@@ -1346,7 +1349,7 @@ function readRuleTriple(v) {
1346
1349
  return undefined;
1347
1350
  if (!isRuleOfferMatch(o.match))
1348
1351
  return undefined;
1349
- if (typeof o.command !== 'string' || o.command === '')
1352
+ if (typeof o.command !== 'string')
1350
1353
  return undefined;
1351
1354
  return { rule: o.rule, match: o.match, command: o.command };
1352
1355
  }
@@ -1624,6 +1627,8 @@ function cardFactsOf(carrier, leg, opts) {
1624
1627
  if (o !== undefined)
1625
1628
  out.origin = o;
1626
1629
  });
1630
+ }
1631
+ if (leg !== 'generic') {
1627
1632
  v1Bit(() => {
1628
1633
  const w = readApprovalCardWord(carrier);
1629
1634
  if (w !== undefined)
@@ -1899,7 +1904,7 @@ async function presentToolApprovalFrameAndRespond(frame, approvalId, respond, st
1899
1904
  const edited = card.persistRuleEdited === true;
1900
1905
  if (edited) {
1901
1906
  if (lane?.respondFreeFormRulesCapable === true) {
1902
- persistRule = card.persistRule;
1907
+ persistRule = trimEditedRuleText(card.persistRule);
1903
1908
  persistRuleEdited = true;
1904
1909
  }
1905
1910
  else {
@@ -184,6 +184,7 @@ declare const EN: {
184
184
  'config.mcp.nameEdgeWhitespace': string;
185
185
  'config.mcp.nameCollides': string;
186
186
  'config.mcp.nameTooLong': string;
187
+ 'config.mcp.nameReserved': string;
187
188
  'config.mcp.identityHeadersBothSet': string;
188
189
  'config.mcp.transportUnreadable': string;
189
190
  'config.mcp.transportInvalid': string;
@@ -584,6 +585,8 @@ declare const EN: {
584
585
  'notice.wayOut.switchModel': string;
585
586
  'notice.wayOut.wait': string;
586
587
  'notice.wayOut.fixRequest': string;
588
+ 'notice.askUnresolvable.remedy.approver': string;
589
+ 'notice.askUnresolvable.remedy.permissionMode': string;
587
590
  'rules.refusal.sentence.one': string;
588
591
  'rules.refusal.sentence.other': string;
589
592
  'rules.refusal.item': string;
@@ -780,6 +783,7 @@ declare const EN: {
780
783
  'rules.match.host': string;
781
784
  'rules.match.subdomain': string;
782
785
  'rules.match.pattern': string;
786
+ 'rules.match.tool': string;
783
787
  'rules.match.unreported': string;
784
788
  'rules.match.unknown': string;
785
789
  'model.tier.blurb.ultra': string;
@@ -1048,6 +1052,7 @@ declare const EN: {
1048
1052
  'config.mods.loader.failedNoReason': string;
1049
1053
  'config.mods.refusal.by': string;
1050
1054
  'config.mods.rewrite.resultInPlace': string;
1055
+ 'config.mods.rewrite.inputBy': string;
1051
1056
  };
1052
1057
  export declare const EN_MESSAGES: Readonly<typeof EN>;
1053
1058
  export type MessageKey = keyof typeof EN;
@@ -184,6 +184,7 @@ const EN = {
184
184
  'config.mcp.nameEdgeWhitespace': 'MCP server name {name}{where} cannot be used as written, so the server was not started: it would not match the same name in other settings (for example a list of disabled servers). Remove the extra whitespace from the name.',
185
185
  'config.mcp.nameCollides': 'MCP server name {name}{where} cannot be used as written, so the server was not started: without its leading or trailing whitespace it would be the same name as another MCP server entry. Remove the extra whitespace from the name, or delete the duplicate entry.',
186
186
  'config.mcp.nameTooLong': 'MCP server name {name}{where} cannot be used, so the server was not started: server names are limited to 128 characters. Shorten the name.',
187
+ 'config.mcp.nameReserved': 'MCP server name {name}{where} cannot be used, so the server was not started: names starting with "remote-" are kept for the MCP servers a connected device offers. Rename the server.',
187
188
  'config.mcp.identityHeadersBothSet': 'MCP server {name}{where} was not started: it sets both principalHeader and assertionHeader, which name the same identity header — keep only one of the two. The other MCP servers are unaffected.',
188
189
  'config.mcp.transportUnreadable': 'could not be read (a getter or proxy trap on the declaration threw)',
189
190
  'config.mcp.transportInvalid': 'MCP server {name}{where} was not started: its transport setting cannot be used — {path} {problem}. Fix that setting for this server (or remove the server); the other MCP servers are unaffected.',
@@ -302,7 +303,7 @@ const EN = {
302
303
  'session.inheritEnv.withheld.scrub': "Not sent with this request: the engine's version is not known yet, so the default-environment setting was left out; that has the same effect, because leaving it out also gives this run the default environment (credential-like variables removed).",
303
304
  'session.inheritEnv.withheld.unknown': 'Not sent with this request: the shell-environment setting was held back for a reason this version does not recognize.',
304
305
  'session.inheritEnv.refusal': "The engine refused this request as invalid, under a refusal code that many different request fields share · This request asked for the shell to inherit this machine's whole environment, which the engine accepts only when tools run directly on its own machine and the request belongs to a session; if that is what it refused, send it again without that setting (or with the default)",
305
- 'session.inheritEnv.refusalNamed': "The engine refused the setting that lets the shell inherit this machine's whole environment, which it accepts only when tools run directly on its own machine and the request belongs to a session · Send the request again without that setting (or with the default)",
306
+ 'session.inheritEnv.refusalNamed': "The engine refused this request's shell-environment setting: it accepts only the default or this machine's whole environment, and the whole environment only when tools run directly on its own machine and the request belongs to a session · Send the request again without that setting (or with the default)",
306
307
  'session.projectMemory.withheld.absent': 'Not sent with this request: this engine does not declare support for the setting that stops project instruction files from being read, and an engine that does not know it refuses the whole request, so it was held back; those files are still sent to the model.',
307
308
  'session.projectMemory.withheld.declined': 'Not sent with this request: this engine declares that it does not support the setting that stops project instruction files from being read, so it was held back; those files are still sent to the model.',
308
309
  'session.projectMemory.withheld.unreadable': "Not sent with this request: the engine's capabilities could not be read, so it is not known whether it supports the setting that stops project instruction files from being read, and an engine that does not know it refuses the whole request, so it was held back; those files are still sent to the model.",
@@ -584,6 +585,8 @@ const EN = {
584
585
  'notice.wayOut.switchModel': 'The model service cannot serve this request right now — try another model',
585
586
  'notice.wayOut.wait': 'The model service is still working on this request — wait a moment, then try again',
586
587
  'notice.wayOut.fixRequest': 'The model service refused this request — change the request before sending it again; sending it as it is will not help',
588
+ 'notice.askUnresolvable.remedy.approver': 'Way out: connect an approver who can answer requests like this one, or make the connected approver reachable, then try again',
589
+ 'notice.askUnresolvable.remedy.permissionMode': 'Another way out, if this deployment allows it: the {mode} permission mode lets requests like this one through without anyone answering them, and each request let through this way is marked on the tool call it applied to',
587
590
  'rules.refusal.sentence.one': 'permissions: 1 rule will not be enforced — {list}',
588
591
  'rules.refusal.sentence.other': 'permissions: {count} rules will not be enforced — {list}',
589
592
  'rules.refusal.item': '{rule} ({reason})',
@@ -780,6 +783,7 @@ const EN = {
780
783
  'rules.match.host': 'web domain match (one host)',
781
784
  'rules.match.subdomain': 'web domain match (every host under the domain)',
782
785
  'rules.match.pattern': 'command pattern match (a star placed anywhere in the command)',
786
+ 'rules.match.tool': 'whole-tool match (every call to the tool)',
783
787
  'rules.match.unreported': 'an unreported match form',
784
788
  'rules.match.unknown': 'a match form this build does not know',
785
789
  'model.tier.blurb.ultra': 'reserved above max — binds when a stronger model lands',
@@ -1048,5 +1052,6 @@ const EN = {
1048
1052
  'config.mods.loader.failedNoReason': '{name} could not be loaded',
1049
1053
  'config.mods.refusal.by': 'Refused by {by}',
1050
1054
  'config.mods.rewrite.resultInPlace': 'Answered by {by} in place of the tool',
1055
+ 'config.mods.rewrite.inputBy': 'Arguments changed by {by} before the call was let through',
1051
1056
  };
1052
1057
  export const EN_MESSAGES = Object.freeze(EN);
@@ -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 之上 —— 等更强的模型出现时再绑定',
@@ -1048,6 +1052,7 @@ const ZH = {
1048
1052
  'config.mods.loader.failedNoReason': '{name} 装载失败',
1049
1053
  'config.mods.refusal.by': '被 {by} 拒绝',
1050
1054
  'config.mods.rewrite.resultInPlace': '由 {by} 代替工具作答',
1055
+ 'config.mods.rewrite.inputBy': '参数在放行前被 {by} 改过',
1051
1056
  };
1052
1057
  export const ZH_MESSAGES = Object.freeze(ZH);
1053
1058
  export const TERM_SLOTS = Object.freeze({
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';
@@ -403,7 +404,7 @@ export * from './env/uiLanguage.js';
403
404
  export { EN_MESSAGES, type MessageKey } from './i18n/messages.en.js';
404
405
  export { ZH_MESSAGES } from './i18n/messages.zh.js';
405
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';
406
- export type { PendingCheckpoint, RuleSuggestion } from '@sema-agent/sdk';
407
+ export type { PendingCheckpoint } from '@sema-agent/sdk';
407
408
  export * from './ruleRemovalConsequence.js';
408
409
  export { engineCredentialRequirementOf } from './engineCredentialRequirement.js';
409
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';
@@ -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;