@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.
- package/CHANGELOG.md +96 -0
- package/README.md +8 -5
- package/dist/adapt/toolCards.d.ts +2 -1
- package/dist/adapt/toolCards.js +3 -1
- package/dist/adapter/downstream/eventToSdkMessage.d.ts +5 -1
- package/dist/adapter/downstream/eventToSdkMessage.js +21 -3
- package/dist/adapter/downstream/terminalToSdkResult.js +0 -1
- package/dist/adapter/downstream/wiringManifestView.js +4 -1
- package/dist/cloudConfigWireCaps.js +6 -3
- package/dist/credentialPlaneCapability.d.ts +22 -0
- package/dist/credentialPlaneCapability.js +75 -0
- package/dist/deviceExecutorManagementCapability.d.ts +1 -0
- package/dist/deviceExecutorManagementCapability.js +3 -1
- package/dist/engineErrorCodes.d.ts +1 -0
- package/dist/engineErrorCodes.js +3 -1
- package/dist/engineNoticeCodes.d.ts +26 -0
- package/dist/engineNoticeCodes.js +121 -12
- package/dist/engineRowRef.js +1 -0
- package/dist/errorSupplementRoles.js +1 -3
- package/dist/eventLeg.js +2 -1
- package/dist/fleet/fleetProjection.js +15 -9
- package/dist/gateOutcome.d.ts +20 -0
- package/dist/gateOutcome.js +89 -0
- package/dist/generated/engineAskFaceTables.js +2 -2
- package/dist/generated/engineFactTables.d.ts +6 -2
- package/dist/generated/engineFactTables.js +41 -1
- package/dist/generated/engineNoticeTables.js +18 -0
- package/dist/generated/settingsSchemaDefaultModel.d.ts +1 -1
- package/dist/generated/settingsSchemaDefaultModel.js +2 -2
- package/dist/generated/settingsSchemaFns.d.ts +15 -0
- package/dist/generated/settingsSchemaFns.js +25 -2
- package/dist/generated/settingsSchemaHooksClassifier.js +109 -29
- package/dist/generated/settingsSchemaMcpRequestEntry.d.ts +1 -1
- package/dist/generated/settingsSchemaMcpRequestEntry.js +213 -93
- package/dist/generated/settingsSchemaMcpServerName.d.ts +1 -0
- package/dist/generated/settingsSchemaMcpServerName.js +8 -0
- package/dist/generated/settingsSchemaOwnKeyRead.d.ts +1 -0
- package/dist/generated/settingsSchemaOwnKeyRead.js +172 -0
- package/dist/generated/settingsSchemaPlainJsonObject.d.ts +1 -0
- package/dist/generated/settingsSchemaPlainJsonObject.js +28 -0
- package/dist/generated/settingsSchemaSafetyMergeSpec.js +10 -7
- package/dist/generated/settingsSchemaTierWords.d.ts +1 -0
- package/dist/generated/settingsSchemaTierWords.js +7 -0
- package/dist/generated/settingsSchemaTypes.d.ts +3 -1
- package/dist/hitl/automaticAnswerVerdict.d.ts +1 -1
- package/dist/hitl/decisionConflict.js +11 -11
- package/dist/hitl/decisionRefusal.d.ts +1 -0
- package/dist/hitl/decisionRefusal.js +4 -2
- package/dist/hitl/editedRuleTextPrecheck.d.ts +1 -0
- package/dist/hitl/editedRuleTextPrecheck.js +26 -1
- package/dist/hitl/persistedRulesWire.js +1 -0
- package/dist/hitl/planReviewWire.d.ts +2 -1
- package/dist/hitl/planReviewWire.js +8 -12
- package/dist/hitl/sessionPolicyDeliverable.d.ts +0 -1
- package/dist/hitl/sessionPolicyDeliverable.js +0 -5
- package/dist/hitl/sessionPolicyWire.js +1 -1
- package/dist/hitl/toolApprovalWire.d.ts +18 -6
- package/dist/hitl/toolApprovalWire.js +9 -4
- package/dist/i18n/messages.en.d.ts +5 -0
- package/dist/i18n/messages.en.js +6 -1
- package/dist/i18n/messages.zh.js +6 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/inheritEnvWire.d.ts +1 -0
- package/dist/inheritEnvWire.js +8 -5
- package/dist/mcpEngineLeg.d.ts +3 -0
- package/dist/mcpEngineLeg.js +4 -1
- package/dist/mcpLiveness.d.ts +18 -0
- package/dist/mcpLiveness.js +48 -1
- package/dist/mcpReconnect.d.ts +3 -0
- package/dist/mcpReconnect.js +6 -0
- package/dist/mcpStatusSupersetKeys.js +24 -1
- package/dist/mcpWireCaps.d.ts +2 -3
- package/dist/mcpWireCaps.js +9 -8
- package/dist/memoryEntriesWire.d.ts +35 -1
- package/dist/memoryEntriesWire.js +110 -14
- package/dist/modsFace.js +7 -3
- package/dist/postureKnob.js +1 -1
- package/dist/prepareRefusal.d.ts +0 -1
- package/dist/prepareRefusal.js +0 -3
- package/dist/promptProfileWireCaps.d.ts +1 -3
- package/dist/promptProfileWireCaps.js +2 -2
- package/dist/request/taskRequest.d.ts +1 -1
- package/dist/request/taskRequest.js +3 -3
- package/dist/retryStatus.d.ts +13 -1
- package/dist/retryStatus.js +20 -5
- package/dist/seatContract.js +10 -0
- package/dist/sessionMemoryErase.js +24 -2
- package/dist/turnFailurePresentation.js +8 -1
- package/dist/wireFailureShape.d.ts +12 -1
- package/dist/wireFailureShape.js +58 -24
- package/dist/wireRefusalCopy.d.ts +0 -3
- package/dist/wireRefusalCopy.js +0 -17
- package/docs/INTEGRATION-CLIENTS.md +155 -10
- package/package.json +5 -5
|
@@ -21,7 +21,7 @@ export const REQUEST_FIELD_MATRIX = [
|
|
|
21
21
|
{ field: 'selfOrchestration', lanes: ['interactive', 'print'], live: true, why: 'SEMA_SELF_ORCHESTRATION opt-in → core 挂 run_workflow', whyUtilityLane: '无座:它挂的是编排工具,与零工具面直接矛盾' },
|
|
22
22
|
{ field: 'deferTools', lanes: ['interactive', 'print'], live: true, why: '[1052]① Workflow 延迟披露;selfOrchestration 前置门', whyUtilityLane: '无座:工具延迟披露是工具面的位,零工具面上没有对象' },
|
|
23
23
|
{ field: 'retainBackgroundProcesses', lanes: ['interactive', 'print'], live: true, why: '缺省 ON(2026-07-26 起翻转);SEMA_RETAIN_BACKGROUND=0 逃生', whyUtilityLane: '无座:后台进程是工具面的产物,零工具面产不出' },
|
|
24
|
-
{ field: '
|
|
24
|
+
{ field: 'promptLean', lanes: ['interactive', 'print'], live: true, why: '提示词形轴(0.103.0 起布尔,取代退役的两词形轴键;sdk 28 / 服务端 7.137.0):缺省不 stamp = 目录缺省;映射单铸点 promptLeanFromEnv', whyUtilityLane: '无座:提示词形是用户会话的偏好;side-channel 的系统提示由壳整段给出(见 systemPrompt 那一行),不再借形轴调形' },
|
|
25
25
|
{ field: 'enableFork', lanes: ['interactive', 'print'], live: true, why: '显式布尔才 stamp([503]② fail-OPEN 教训:off 必须显式)', whyUtilityLane: '无座:分叉是会话面的动作,而 side-channel 提交是一次性的独立会话' },
|
|
26
26
|
{ field: 'attachments', lanes: ['interactive', 'print'], live: true, why: 'design/133 + G1 缺省开的 turn 边界 attachment', whyUtilityLane: '无座:turn 边界的附件配置属用户会话;side-channel 提交不带附件' },
|
|
27
27
|
{ field: 'skills', lanes: ['interactive', 'print'], live: true, why: '本地技能目录投影(布局取 CC 同款);两条车道都由 launchRepl 载入面注入', whyUtilityLane: '无座:技能挂的是工具,与零工具面矛盾' },
|
|
@@ -152,7 +152,7 @@ const INPUT_KEY_ROUTES = {
|
|
|
152
152
|
selfOrchestration: row('selfOrchestration'),
|
|
153
153
|
deferTools: row('deferTools'),
|
|
154
154
|
retainBackgroundProcesses: row('retainBackgroundProcesses'),
|
|
155
|
-
|
|
155
|
+
promptLean: row('promptLean'),
|
|
156
156
|
enableFork: row('enableFork'),
|
|
157
157
|
attachments: row('attachments'),
|
|
158
158
|
attachmentIds: row('attachmentIds'),
|
|
@@ -1103,7 +1103,7 @@ export function assembleTaskRequest(input, laneOrIdentity) {
|
|
|
1103
1103
|
...(on('selfOrchestration') ? { selfOrchestration: i.selfOrchestration } : {}),
|
|
1104
1104
|
...(on('deferTools') ? { deferTools: i.deferTools } : {}),
|
|
1105
1105
|
...(on('retainBackgroundProcesses') ? { retainBackgroundProcesses: i.retainBackgroundProcesses } : {}),
|
|
1106
|
-
...(on('
|
|
1106
|
+
...(on('promptLean') ? { promptLean: i.promptLean } : {}),
|
|
1107
1107
|
...(on('enableFork') ? { enableFork: i.enableFork } : {}),
|
|
1108
1108
|
...(on('attachments') ? { attachments: attachmentsForWire } : {}),
|
|
1109
1109
|
...(on('repo') ? { repo: i.repo } : {}),
|
package/dist/retryStatus.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type RetryStatus = {
|
|
|
11
11
|
providerConditionSource?: string;
|
|
12
12
|
elapsedMs?: number;
|
|
13
13
|
timeoutMs?: number;
|
|
14
|
+
sleptMs?: number;
|
|
15
|
+
waitSegment?: BrainStatusWaitSegment | (string & {});
|
|
14
16
|
detail?: string;
|
|
15
17
|
} | {
|
|
16
18
|
kind: 'error';
|
|
@@ -26,6 +28,8 @@ export type RetryStatus = {
|
|
|
26
28
|
error: RetryStatusErrorPayload;
|
|
27
29
|
elapsedMs?: number;
|
|
28
30
|
timeoutMs?: number;
|
|
31
|
+
sleptMs?: number;
|
|
32
|
+
waitSegment?: BrainStatusWaitSegment | (string & {});
|
|
29
33
|
} | {
|
|
30
34
|
kind: 'waiting';
|
|
31
35
|
deadline: number;
|
|
@@ -38,6 +42,8 @@ export type RetryStatus = {
|
|
|
38
42
|
providerConditionSource?: string;
|
|
39
43
|
elapsedMs?: number;
|
|
40
44
|
timeoutMs?: number;
|
|
45
|
+
sleptMs?: number;
|
|
46
|
+
waitSegment?: BrainStatusWaitSegment | (string & {});
|
|
41
47
|
terminal?: never;
|
|
42
48
|
error: RetryStatusErrorPayload;
|
|
43
49
|
};
|
|
@@ -69,8 +75,12 @@ export interface BrainStatusPayload {
|
|
|
69
75
|
timeoutMs?: number;
|
|
70
76
|
providerCondition?: string;
|
|
71
77
|
providerConditionSource?: string;
|
|
78
|
+
sleptMs?: number;
|
|
79
|
+
waitSegment?: BrainStatusWaitSegment | (string & {});
|
|
72
80
|
}
|
|
73
|
-
export declare const
|
|
81
|
+
export declare const BRAIN_STATUS_WAIT_SEGMENTS: readonly ["response_headers", "first_token"];
|
|
82
|
+
export type BrainStatusWaitSegment = (typeof BRAIN_STATUS_WAIT_SEGMENTS)[number];
|
|
83
|
+
export declare const BRAIN_STATUS_PAYLOAD_KEYS: readonly ["phase", "detail", "retryInSec", "retryInMs", "attempt", "maxRetries", "errClass", "retryAtMs", "errorStatus", "elapsedMs", "timeoutMs", "providerCondition", "providerConditionSource", "sleptMs", "waitSegment"];
|
|
74
84
|
export declare function mapBrainStatusToRetry(p: BrainStatusPayload, nowMs: number): RetryStatus | null;
|
|
75
85
|
export interface RetryStatusArmLike {
|
|
76
86
|
readonly phase?: string;
|
|
@@ -86,6 +96,8 @@ export interface RetryStatusArmLike {
|
|
|
86
96
|
readonly timeoutMs?: number;
|
|
87
97
|
readonly providerCondition?: string;
|
|
88
98
|
readonly providerConditionSource?: string;
|
|
99
|
+
readonly sleptMs?: number;
|
|
100
|
+
readonly waitSegment?: string;
|
|
89
101
|
readonly parentToolCallId?: string;
|
|
90
102
|
}
|
|
91
103
|
export declare function retryStatusFromArm(arm: RetryStatusArmLike | null | undefined, nowMs: number): RetryStatus | null | undefined;
|
package/dist/retryStatus.js
CHANGED
|
@@ -11,6 +11,9 @@ export const BRAIN_STATUS_PHASES = [
|
|
|
11
11
|
'gave_up',
|
|
12
12
|
'waiting_first_token',
|
|
13
13
|
];
|
|
14
|
+
export const BRAIN_STATUS_WAIT_SEGMENTS = Object.freeze(['response_headers', 'first_token']);
|
|
15
|
+
void true;
|
|
16
|
+
void true;
|
|
14
17
|
export const BRAIN_STATUS_PAYLOAD_KEYS = [
|
|
15
18
|
'phase',
|
|
16
19
|
'detail',
|
|
@@ -25,6 +28,8 @@ export const BRAIN_STATUS_PAYLOAD_KEYS = [
|
|
|
25
28
|
'timeoutMs',
|
|
26
29
|
'providerCondition',
|
|
27
30
|
'providerConditionSource',
|
|
31
|
+
'sleptMs',
|
|
32
|
+
'waitSegment',
|
|
28
33
|
];
|
|
29
34
|
const _brainStatusKeyPin = [true, true];
|
|
30
35
|
void _brainStatusKeyPin;
|
|
@@ -41,9 +46,11 @@ export function mapBrainStatusToRetry(p, nowMs) {
|
|
|
41
46
|
const cause = typeof p.errClass === 'string' && p.errClass.length > 0 ? { errClass: p.errClass } : {};
|
|
42
47
|
const producerTiming = typeof p.retryAtMs === 'number' ? { retryAtMs: p.retryAtMs } : {};
|
|
43
48
|
const failureStatus = typeof p.errorStatus === 'number' ? { errorStatus: p.errorStatus } : {};
|
|
49
|
+
const providerCondition = p.providerCondition;
|
|
50
|
+
const providerConditionSource = p.providerConditionSource;
|
|
44
51
|
const providerJudged = {
|
|
45
|
-
...(typeof
|
|
46
|
-
...(typeof
|
|
52
|
+
...(typeof providerCondition === 'string' && providerCondition.length > 0 ? { providerCondition } : {}),
|
|
53
|
+
...(typeof providerConditionSource === 'string' && providerConditionSource.length > 0 ? { providerConditionSource } : {}),
|
|
47
54
|
};
|
|
48
55
|
const saneMs = (v) => typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : undefined;
|
|
49
56
|
const elapsedMs = saneMs(p.elapsedMs);
|
|
@@ -52,10 +59,16 @@ export function mapBrainStatusToRetry(p, nowMs) {
|
|
|
52
59
|
...(elapsedMs !== undefined ? { elapsedMs } : {}),
|
|
53
60
|
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
54
61
|
};
|
|
62
|
+
const sleptMs = saneMs(p.sleptMs);
|
|
63
|
+
const waitSegment = p.waitSegment;
|
|
64
|
+
const waitFacts = {
|
|
65
|
+
...(sleptMs !== undefined ? { sleptMs } : {}),
|
|
66
|
+
...(typeof waitSegment === 'string' && waitSegment.length > 0 ? { waitSegment } : {}),
|
|
67
|
+
};
|
|
55
68
|
const stalledShown = typeof p.detail === 'string' && p.detail.length > 0 ? displayUntrusted(p.detail) : '';
|
|
56
69
|
const stalledDetail = stalledShown.length > 0 ? { detail: stalledShown } : {};
|
|
57
70
|
const shown = (absent) => (typeof p.detail === 'string' ? displayUntrusted(p.detail) : absent);
|
|
58
|
-
const extra = { ...counts, ...cause, ...producerTiming, ...failureStatus, ...providerJudged, ...waitProgress };
|
|
71
|
+
const extra = { ...counts, ...cause, ...producerTiming, ...failureStatus, ...providerJudged, ...waitProgress, ...waitFacts };
|
|
59
72
|
switch (p.phase) {
|
|
60
73
|
case 'recovered':
|
|
61
74
|
return null;
|
|
@@ -99,8 +112,8 @@ export function retryStatusFromArm(arm, nowMs) {
|
|
|
99
112
|
const v = str(key);
|
|
100
113
|
return v !== undefined && v.length > 0 ? v : undefined;
|
|
101
114
|
};
|
|
102
|
-
const [detail, retryInSec, retryInMs, attempt, maxRetries, errClass, retryAtMs, errorStatus, elapsedMs, timeoutMs, providerCondition, providerConditionSource] = [
|
|
103
|
-
str('detail'), num('retryInSec'), num('retryInMs'), num('attempt'), num('maxRetries'), str('errClass'), num('retryAtMs'), num('errorStatus'), num('elapsedMs'), num('timeoutMs'), word('providerCondition'), word('providerConditionSource'),
|
|
115
|
+
const [detail, retryInSec, retryInMs, attempt, maxRetries, errClass, retryAtMs, errorStatus, elapsedMs, timeoutMs, providerCondition, providerConditionSource, sleptMs, waitSegment] = [
|
|
116
|
+
str('detail'), num('retryInSec'), num('retryInMs'), num('attempt'), num('maxRetries'), str('errClass'), num('retryAtMs'), num('errorStatus'), num('elapsedMs'), num('timeoutMs'), word('providerCondition'), word('providerConditionSource'), num('sleptMs'), word('waitSegment'),
|
|
104
117
|
];
|
|
105
118
|
const phase = str('phase');
|
|
106
119
|
if (phase === undefined)
|
|
@@ -119,6 +132,8 @@ export function retryStatusFromArm(arm, nowMs) {
|
|
|
119
132
|
...(timeoutMs !== undefined ? { timeoutMs } : {}),
|
|
120
133
|
...(providerCondition !== undefined ? { providerCondition } : {}),
|
|
121
134
|
...(providerConditionSource !== undefined ? { providerConditionSource } : {}),
|
|
135
|
+
...(sleptMs !== undefined ? { sleptMs } : {}),
|
|
136
|
+
...(waitSegment !== undefined ? { waitSegment } : {}),
|
|
122
137
|
}, nowMs);
|
|
123
138
|
}
|
|
124
139
|
const WAIT_SWITCH_FRACTION = 0.5;
|
package/dist/seatContract.js
CHANGED
|
@@ -162,6 +162,7 @@ const R_BOOL = ruleOf("boolean", (v) => typeof v === "boolean");
|
|
|
162
162
|
const R_THINKING_LATCH_ROW = oneOfRule("latch word", THINKING_LATCH_ROW_WORDS);
|
|
163
163
|
const R_TRUE = ruleOf("true", (v) => v === true);
|
|
164
164
|
const R_NUM = ruleOf("finite number", (v) => typeof v === "number" && Number.isFinite(v));
|
|
165
|
+
const R_NUM0 = ruleOf("finite non-negative number", (v) => typeof v === "number" && Number.isFinite(v) && v >= 0);
|
|
165
166
|
const R_INT0 = ruleOf("non-negative integer", (v) => typeof v === "number" && Number.isSafeInteger(v) && v >= 0);
|
|
166
167
|
const R_INT1 = ruleOf("positive integer", (v) => typeof v === "number" && Number.isSafeInteger(v) && v > 0);
|
|
167
168
|
const keyWords = (k) => k
|
|
@@ -882,6 +883,11 @@ function mcpPanelLivenessArms() {
|
|
|
882
883
|
return arms;
|
|
883
884
|
}
|
|
884
885
|
const MCP_PANEL_LIVENESS_VIEW = armsRule("mcp liveness", "state", mcpPanelLivenessArms());
|
|
886
|
+
const MCP_PANEL_AUTHORIZATION = shapeRule("mcp authorization", {
|
|
887
|
+
reason: reqF(R_NONEMPTY),
|
|
888
|
+
authorizeUrl: optF(R_NONEMPTY),
|
|
889
|
+
resourceMetadataUrl: optF(R_NONEMPTY),
|
|
890
|
+
});
|
|
885
891
|
const MCP_PANEL_LEG_ENTRY = shapeRule("leg entry", {
|
|
886
892
|
name: reqF(R_NONEMPTY),
|
|
887
893
|
status: reqF(R_NONEMPTY),
|
|
@@ -892,6 +898,8 @@ const MCP_PANEL_LEG_ENTRY = shapeRule("leg entry", {
|
|
|
892
898
|
httpStatus: optF(R_NUM),
|
|
893
899
|
liveness: optF(MCP_PANEL_LIVENESS_VIEW),
|
|
894
900
|
livenessUnreadable: optF(R_TRUE),
|
|
901
|
+
authorization: optF(MCP_PANEL_AUTHORIZATION),
|
|
902
|
+
authorizationUnreadable: optF(R_TRUE),
|
|
895
903
|
});
|
|
896
904
|
const MCP_PANEL_LAST_LEG = shapeRule("last leg", {
|
|
897
905
|
runId: reqF(R_NONEMPTY),
|
|
@@ -1069,6 +1077,8 @@ const RETRY_COMMON_SPEC = {
|
|
|
1069
1077
|
providerConditionSource: optF(R_STR),
|
|
1070
1078
|
elapsedMs: optF(R_NUM),
|
|
1071
1079
|
timeoutMs: optF(R_NUM),
|
|
1080
|
+
sleptMs: optF(R_NUM0),
|
|
1081
|
+
waitSegment: optF(R_NONEMPTY),
|
|
1072
1082
|
};
|
|
1073
1083
|
const RETRY_STATUS = armsRule("retry status", "kind", {
|
|
1074
1084
|
stalled: { ...RETRY_COMMON_SPEC, detail: optF(R_STR) },
|
|
@@ -245,7 +245,29 @@ const UNCONFIRMED_TEXT = {
|
|
|
245
245
|
unreadable: 'Not confirmed: the result of this erase could not be read.',
|
|
246
246
|
};
|
|
247
247
|
const ERASED_TEXT = 'Erased: every memory entry recorded as coming from this session was erased or was already gone.';
|
|
248
|
-
const
|
|
248
|
+
const PARTIAL_ENTRIES_TEXT = 'Partly erased: some memory entries from this session were not erased yet.';
|
|
249
|
+
const PARTIAL_UNKNOWN_TEXT = 'Partly erased: the engine reports this erase as not complete, and its receipt does not show whether memory entries or other stored records of them remain.';
|
|
250
|
+
function partialCarriersText(kinds) {
|
|
251
|
+
return kinds === 1
|
|
252
|
+
? 'Partly erased: every memory entry recorded as coming from this session was erased or was already gone, but 1 kind of stored record that refers to them was not confirmed removed, and trying again may not remove it.'
|
|
253
|
+
: `Partly erased: every memory entry recorded as coming from this session was erased or was already gone, but ${kinds} kinds of stored records that refer to them were not confirmed removed, and trying again may not remove them.`;
|
|
254
|
+
}
|
|
255
|
+
function partialTextOf(cause) {
|
|
256
|
+
if (cause === null)
|
|
257
|
+
return PARTIAL_UNKNOWN_TEXT;
|
|
258
|
+
switch (cause.kind) {
|
|
259
|
+
case 'entries_pending':
|
|
260
|
+
return PARTIAL_ENTRIES_TEXT;
|
|
261
|
+
case 'carriers_residual':
|
|
262
|
+
return partialCarriersText(cause.carriers.length);
|
|
263
|
+
case 'unknown':
|
|
264
|
+
return PARTIAL_UNKNOWN_TEXT;
|
|
265
|
+
default: {
|
|
266
|
+
const unreachable = cause;
|
|
267
|
+
return unreachable;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
249
271
|
const RETRY_TEXT = {
|
|
250
272
|
not_needed: 'Nothing more to do.',
|
|
251
273
|
same_request_id: 'It is safe to try again with the same request id.',
|
|
@@ -414,7 +436,7 @@ export function sessionMemoryEraseOutcome(answer) {
|
|
|
414
436
|
return { kind: 'erased', receipt: reading, text: ERASED_TEXT, retry: 'not_needed', retryText: RETRY_TEXT.not_needed };
|
|
415
437
|
}
|
|
416
438
|
const retry = memoryEraseReplayPosture(reading) === 'idempotent' ? 'same_request_id' : 'human_decision';
|
|
417
|
-
return { kind: 'partial', receipt: reading, text:
|
|
439
|
+
return { kind: 'partial', receipt: reading, text: partialTextOf(reading.partialCause), retry, retryText: RETRY_TEXT[retry] };
|
|
418
440
|
}
|
|
419
441
|
if (status < 400)
|
|
420
442
|
return unconfirmedBy('unclassified', signed, { status });
|
|
@@ -60,7 +60,14 @@ function isIdleWatchdog(err) {
|
|
|
60
60
|
return false;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const DETERMINISTIC_SERVER_CODES = new Set([
|
|
63
|
+
const DETERMINISTIC_SERVER_CODES = new Set([
|
|
64
|
+
CORRUPT_SESSION_ERROR_CODE,
|
|
65
|
+
CORRUPT_ROW_ERROR_CODE,
|
|
66
|
+
SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE,
|
|
67
|
+
MEMORY_CONTROL_PLANE_CORRUPT,
|
|
68
|
+
'approvals.read_corrupt',
|
|
69
|
+
'workflow.journal_incompatible',
|
|
70
|
+
]);
|
|
64
71
|
const BROWSER_FETCH_FAILURE = /\bfailed to fetch\b|\bnetworkerror\b|\bnetwork error\b|\bload failed\b/i;
|
|
65
72
|
function httpShapeOf(verdict, code) {
|
|
66
73
|
const status = verdict.status;
|
|
@@ -23,6 +23,11 @@ export type ThrownExtraReading = {
|
|
|
23
23
|
readonly state: 'unreadable';
|
|
24
24
|
};
|
|
25
25
|
export declare function readThrownExtra(o: {} | null | undefined): ThrownExtraReading;
|
|
26
|
+
export interface ThrownExtraSnapshot {
|
|
27
|
+
readonly sdkInstance: boolean;
|
|
28
|
+
readonly bag: ThrownExtraReading;
|
|
29
|
+
}
|
|
30
|
+
export declare function readThrownExtraSnapshot(o: {} | null | undefined): ThrownExtraSnapshot;
|
|
26
31
|
export declare const PROTOCOL_ERROR_NAME: Readonly<{
|
|
27
32
|
readonly ApprovalBindingMismatchError: "ApprovalBindingMismatchError";
|
|
28
33
|
readonly ApprovalStaleError: "ApprovalStaleError";
|
|
@@ -53,7 +58,7 @@ export type ProtocolErrorNameReading = {
|
|
|
53
58
|
} | {
|
|
54
59
|
readonly state: 'unreadable';
|
|
55
60
|
};
|
|
56
|
-
export declare function protocolErrorNameReading(e: object): ProtocolErrorNameReading;
|
|
61
|
+
export declare function protocolErrorNameReading(e: object, extra?: ThrownExtraSnapshot): ProtocolErrorNameReading;
|
|
57
62
|
export declare function protocolErrorNameOf(e: object): ProtocolErrorName | undefined;
|
|
58
63
|
export type ThrownStatusReading = number | undefined | typeof THROWN_SLOT_UNREADABLE;
|
|
59
64
|
export declare function readThrownStatusSlot(o: object, notePresence?: (presence: SlotPresence) => void): ThrownStatusReading;
|
|
@@ -66,6 +71,7 @@ export declare function slotPresenceOf(o: object, key: string): SlotPresence;
|
|
|
66
71
|
export declare function slotReadOf(o: object, key: string): OwnSlotRead;
|
|
67
72
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
68
73
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
74
|
+
export declare function readErrorPresent(o: object, key: string): {} | null | undefined;
|
|
69
75
|
export declare function readErrorString(o: object, key: string): string | undefined;
|
|
70
76
|
export declare function readErrorStringList(o: object, key: string): readonly string[] | undefined;
|
|
71
77
|
export declare function readErrorStrictStringList(o: object, key: string): readonly string[] | undefined;
|
|
@@ -106,6 +112,11 @@ export declare function ownFoldedCodeBitsOf(wire: {
|
|
|
106
112
|
readonly blockedBy?: string;
|
|
107
113
|
} | undefined): FoldedCodeBits;
|
|
108
114
|
export declare function readRefusalField(o: object): string | undefined;
|
|
115
|
+
export interface RefusalSlotReading {
|
|
116
|
+
readonly word: string | undefined;
|
|
117
|
+
readonly present: boolean;
|
|
118
|
+
}
|
|
119
|
+
export declare function readRefusalSlots<K extends string>(o: object, keys: readonly K[], bag?: ThrownExtraReading): Readonly<Record<K, RefusalSlotReading>>;
|
|
109
120
|
export declare const REFUSAL_PROBLEMS_READ_MAX = 1000;
|
|
110
121
|
export declare function readRefusalNamedFields(o: object): readonly string[];
|
|
111
122
|
export declare function isDisplayableWireCode(s: string): boolean;
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -87,28 +87,38 @@ function isBuiltinErrorPrototype(node) {
|
|
|
87
87
|
return ['message', 'name', 'toString'].every((k) => Object.getOwnPropertyDescriptor(node, k) !== undefined);
|
|
88
88
|
}
|
|
89
89
|
export function readThrownExtra(o) {
|
|
90
|
+
return readThrownExtraSnapshot(o).bag;
|
|
91
|
+
}
|
|
92
|
+
export function readThrownExtraSnapshot(o) {
|
|
90
93
|
if (o === null || o === undefined || (typeof o !== 'object' && typeof o !== 'function'))
|
|
91
|
-
return { state: 'absent' };
|
|
94
|
+
return { sdkInstance: false, bag: { state: 'absent' } };
|
|
95
|
+
let at;
|
|
96
|
+
try {
|
|
97
|
+
at = extraSlotOf(o);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return { sdkInstance: false, bag: { state: 'unreadable' } };
|
|
101
|
+
}
|
|
102
|
+
const sdkInstance = at.kind === 'sdk-class';
|
|
103
|
+
if (at.kind === 'own-accessor')
|
|
104
|
+
return { sdkInstance, bag: { state: 'unreadable' } };
|
|
105
|
+
if (at.kind === 'none')
|
|
106
|
+
return { sdkInstance, bag: { state: 'absent' } };
|
|
92
107
|
let slot;
|
|
93
108
|
try {
|
|
94
|
-
const at = extraSlotOf(o);
|
|
95
|
-
if (at.kind === 'own-accessor')
|
|
96
|
-
return { state: 'unreadable' };
|
|
97
|
-
if (at.kind === 'none')
|
|
98
|
-
return { state: 'absent' };
|
|
99
109
|
slot = at.kind === 'own-data' ? at.value : Reflect.get(o, EXTRA_KEY);
|
|
100
110
|
}
|
|
101
111
|
catch {
|
|
102
|
-
return { state: 'unreadable' };
|
|
112
|
+
return { sdkInstance, bag: { state: 'unreadable' } };
|
|
103
113
|
}
|
|
104
114
|
try {
|
|
105
115
|
if (typeof slot !== 'object' || slot === null || Array.isArray(slot))
|
|
106
|
-
return { state: 'absent' };
|
|
116
|
+
return { sdkInstance, bag: { state: 'absent' } };
|
|
107
117
|
}
|
|
108
118
|
catch {
|
|
109
|
-
return { state: 'unreadable' };
|
|
119
|
+
return { sdkInstance, bag: { state: 'unreadable' } };
|
|
110
120
|
}
|
|
111
|
-
return { state: 'object', value: slot };
|
|
121
|
+
return { sdkInstance, bag: { state: 'object', value: slot } };
|
|
112
122
|
}
|
|
113
123
|
export const PROTOCOL_ERROR_NAME = Object.freeze({
|
|
114
124
|
ApprovalBindingMismatchError: 'ApprovalBindingMismatchError',
|
|
@@ -137,11 +147,11 @@ export function isSdkErrorInstance(o) {
|
|
|
137
147
|
return false;
|
|
138
148
|
}
|
|
139
149
|
}
|
|
140
|
-
export function protocolErrorNameReading(e) {
|
|
150
|
+
export function protocolErrorNameReading(e, extra) {
|
|
141
151
|
if (typeof e !== 'object' || e === null)
|
|
142
152
|
return { state: 'absent' };
|
|
143
153
|
try {
|
|
144
|
-
if (isSdkErrorInstance(e))
|
|
154
|
+
if (extra !== undefined ? extra.sdkInstance : isSdkErrorInstance(e))
|
|
145
155
|
return { state: 'sdk-instance' };
|
|
146
156
|
const name = ownDataField(e, 'name');
|
|
147
157
|
return typeof name === 'string' && PROTOCOL_ERROR_NAMES.has(name) ? { state: 'named', name: name } : { state: 'absent' };
|
|
@@ -221,6 +231,10 @@ export function readErrorRecord(o, key) {
|
|
|
221
231
|
const v = readErrorSlot(o, key, (x) => typeof x === 'object' && x !== null && !Array.isArray(x));
|
|
222
232
|
return typeof v === 'object' && v !== null && !Array.isArray(v) ? v : undefined;
|
|
223
233
|
}
|
|
234
|
+
export function readErrorPresent(o, key) {
|
|
235
|
+
const v = readErrorSlot(o, key, (x) => x !== undefined);
|
|
236
|
+
return v === undefined ? undefined : v;
|
|
237
|
+
}
|
|
224
238
|
export function readErrorString(o, key) {
|
|
225
239
|
const v = readErrorSlot(o, key, (x) => typeof x === 'string');
|
|
226
240
|
return typeof v === 'string' ? v : undefined;
|
|
@@ -396,18 +410,38 @@ export function ownFoldedCodeBitsOf(wire) {
|
|
|
396
410
|
return Object.freeze({ errorCode: bit('errorCode'), blockedBy: bit('blockedBy') });
|
|
397
411
|
}
|
|
398
412
|
export function readRefusalField(o) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
return readRefusalSlots(o, REFUSAL_FIELD_ONLY).field.word;
|
|
414
|
+
}
|
|
415
|
+
const REFUSAL_SLOT_ABSENT = Object.freeze({ word: undefined, present: false });
|
|
416
|
+
const REFUSAL_SLOT_HELD_UNREADABLE = Object.freeze({ word: undefined, present: true });
|
|
417
|
+
const REFUSAL_FIELD_ONLY = Object.freeze(['field']);
|
|
418
|
+
function refusalSlotOf(container, key) {
|
|
419
|
+
try {
|
|
420
|
+
const d = Object.getOwnPropertyDescriptor(container, key);
|
|
421
|
+
if (d === undefined)
|
|
422
|
+
return REFUSAL_SLOT_ABSENT;
|
|
423
|
+
if (!Object.hasOwn(d, 'value'))
|
|
424
|
+
return REFUSAL_SLOT_HELD_UNREADABLE;
|
|
425
|
+
const v = d.value;
|
|
426
|
+
if (v === undefined)
|
|
427
|
+
return REFUSAL_SLOT_ABSENT;
|
|
428
|
+
return typeof v === 'string' && v !== '' ? Object.freeze({ word: v, present: true }) : REFUSAL_SLOT_HELD_UNREADABLE;
|
|
429
|
+
}
|
|
430
|
+
catch {
|
|
431
|
+
return REFUSAL_SLOT_HELD_UNREADABLE;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
export function readRefusalSlots(o, keys, bag = readThrownExtra(o)) {
|
|
435
|
+
const carrier = isSlotCarrier(o);
|
|
436
|
+
const out = Object.create(null);
|
|
437
|
+
for (const key of keys) {
|
|
438
|
+
const fromBag = bag.state === 'object' ? refusalSlotOf(bag.value, key) : REFUSAL_SLOT_ABSENT;
|
|
439
|
+
const top = carrier ? refusalSlotOf(o, key) : REFUSAL_SLOT_ABSENT;
|
|
440
|
+
const word = fromBag.word ?? top.word;
|
|
441
|
+
const present = bag.state === 'unreadable' || fromBag.present || top.present;
|
|
442
|
+
out[key] = word === undefined && !present ? REFUSAL_SLOT_ABSENT : Object.freeze({ word, present });
|
|
443
|
+
}
|
|
444
|
+
return Object.freeze(out);
|
|
411
445
|
}
|
|
412
446
|
export const REFUSAL_PROBLEMS_READ_MAX = 1000;
|
|
413
447
|
export function readRefusalNamedFields(o) {
|
|
@@ -126,7 +126,6 @@ export type HookMatcherRefusal = {
|
|
|
126
126
|
readonly totalMs?: number;
|
|
127
127
|
readonly path?: readonly (string | number)[];
|
|
128
128
|
};
|
|
129
|
-
export declare function hookMatcherRefusalFromError(err: unknown): HookMatcherRefusal | undefined;
|
|
130
129
|
export interface SettingsHooksRefusal {
|
|
131
130
|
readonly reason: string;
|
|
132
131
|
readonly path?: readonly (string | number)[];
|
|
@@ -159,11 +158,9 @@ export interface UserAttachmentRefusalDetail {
|
|
|
159
158
|
readonly path?: string;
|
|
160
159
|
}
|
|
161
160
|
export declare function userAttachmentRefusalFromError(err: {} | null | undefined): UserAttachmentRefusalDetail | null;
|
|
162
|
-
export declare function userAttachmentRefusalContent(detail?: Pick<UserAttachmentRefusalDetail, 'index'>): string;
|
|
163
161
|
export interface UserInvokedSkillRefusalDetail {
|
|
164
162
|
readonly code: typeof USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE;
|
|
165
163
|
readonly retryable: false;
|
|
166
164
|
}
|
|
167
165
|
export declare function userInvokedSkillRefusalFromError(err: {} | null | undefined): UserInvokedSkillRefusalDetail | null;
|
|
168
|
-
export declare function userInvokedSkillRefusalContent(): string;
|
|
169
166
|
export {};
|
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -4,7 +4,6 @@ import { ACTIVE_RUN_BUSY_ERROR_CODE, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_L
|
|
|
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 { prepareRefusalNoteOf } from './prepareRefusal.js';
|
|
8
7
|
import { PERMISSION_RULE_ISSUE_CODES, permissionRuleIssueDetail } from './permissionRuleIssue.js';
|
|
9
8
|
import { ruleRefusalListText } from './ruleRefusalSentence.js';
|
|
10
9
|
import { msg, renderMessage } from './i18n/translate.js';
|
|
@@ -734,9 +733,6 @@ export function hostPostureRefusalContent(detail, lang) {
|
|
|
734
733
|
}
|
|
735
734
|
}
|
|
736
735
|
const HOOK_MATCHER_REFUSAL_FIELD = 'settings.hooks';
|
|
737
|
-
export function hookMatcherRefusalFromError(err) {
|
|
738
|
-
return settingsHooksRefusalFromError(err)?.matcher;
|
|
739
|
-
}
|
|
740
736
|
function hooksRefusalPathOf(detail) {
|
|
741
737
|
try {
|
|
742
738
|
const raw = readOwnDataValue(detail, 'path');
|
|
@@ -979,19 +975,6 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
979
975
|
return null;
|
|
980
976
|
}
|
|
981
977
|
}
|
|
982
|
-
export function userAttachmentRefusalContent(detail) {
|
|
983
|
-
let index;
|
|
984
|
-
try {
|
|
985
|
-
index = detail === undefined || detail === null ? undefined : detail.index;
|
|
986
|
-
}
|
|
987
|
-
catch {
|
|
988
|
-
index = undefined;
|
|
989
|
-
}
|
|
990
|
-
return prepareRefusalNoteOf(USER_ATTACHMENT_INVALID_ERROR_CODE, typeof index === 'number' ? { index } : undefined);
|
|
991
|
-
}
|
|
992
978
|
export function userInvokedSkillRefusalFromError(err) {
|
|
993
979
|
return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
|
|
994
980
|
}
|
|
995
|
-
export function userInvokedSkillRefusalContent() {
|
|
996
|
-
return prepareRefusalNoteOf(USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE);
|
|
997
|
-
}
|