@sema-agent/client-core 0.108.0 → 0.110.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 +294 -0
- package/README.md +77 -40
- package/dist/adapt/arms.js +41 -13
- package/dist/adapt/textStream.d.ts +2 -0
- package/dist/adapt/textStream.js +37 -16
- package/dist/adapter/activeRunSelfHeal.js +1 -1
- package/dist/adapter/downstream/eventToSdkMessage.js +11 -5
- package/dist/agentSession/engineAgentRegistryRead.js +2 -0
- package/dist/bashExitReading.d.ts +12 -0
- package/dist/bashExitReading.js +44 -0
- package/dist/checkpointRowVerdict.d.ts +1 -1
- package/dist/checkpointRowVerdict.js +4 -2
- package/dist/compensations.js +1 -1
- package/dist/declared/supportFloorDeclared.js +1 -1
- package/dist/displayUntrusted.js +132 -14
- package/dist/engineAgentAbsence.d.ts +2 -0
- package/dist/engineAgentAbsence.js +28 -0
- package/dist/engineErrorCodes.d.ts +7 -0
- package/dist/engineErrorCodes.js +7 -0
- package/dist/engineHealthFacts.d.ts +26 -0
- package/dist/engineHealthFacts.js +63 -4
- package/dist/engineInlineTaskStats.d.ts +4 -3
- package/dist/engineInlineTaskStats.js +18 -2
- package/dist/engineNoticeCodes.d.ts +138 -0
- package/dist/engineNoticeCodes.js +662 -55
- package/dist/engineRepoint.d.ts +140 -0
- package/dist/engineRepoint.js +285 -0
- package/dist/engineRowRef.js +2 -0
- package/dist/engineSessionMessages.d.ts +2 -1
- package/dist/engineSessionMessages.js +5 -0
- package/dist/errorSupplementRoles.js +5 -1
- package/dist/fleet/fleetProjection.js +3 -2
- package/dist/fleetTaskDesc.js +3 -3
- package/dist/generated/engineFactTables.d.ts +3 -0
- package/dist/generated/engineFactTables.js +18 -0
- package/dist/generated/engineNoticeTables.js +3 -0
- package/dist/generated/sdkFactTables.d.ts +1 -0
- package/dist/generated/sdkFactTables.js +4 -0
- package/dist/hitl/approvalAskers.d.ts +6 -0
- package/dist/hitl/approvalAskers.js +30 -0
- package/dist/hitl/approvalCardReasons.js +25 -4
- package/dist/hitl/approvalRequestFrameReading.d.ts +21 -0
- package/dist/hitl/approvalRequestFrameReading.js +90 -0
- package/dist/hitl/approvalResolution.d.ts +8 -1
- package/dist/hitl/approvalResolution.js +4 -0
- package/dist/hitl/approvalsFeed.js +1 -1
- package/dist/hitl/askGateWire.js +0 -2
- package/dist/hitl/askParkRowRouting.js +5 -2
- package/dist/hitl/automaticAnswerVerdict.d.ts +5 -2
- package/dist/hitl/automaticAnswerVerdict.js +18 -4
- package/dist/hitl/decisionConflict.d.ts +2 -1
- package/dist/hitl/decisionConflict.js +10 -4
- package/dist/hitl/decisionRefusal.js +1 -0
- package/dist/hitl/decisionSend.d.ts +3 -0
- package/dist/hitl/decisionSend.js +29 -11
- package/dist/hitl/editedApprovalAcceptance.d.ts +25 -0
- package/dist/hitl/editedApprovalAcceptance.js +26 -0
- package/dist/hitl/frameRouter.js +13 -19
- package/dist/hitl/gateLedger.d.ts +0 -4
- package/dist/hitl/gateLedger.js +0 -19
- package/dist/hitl/hitlBridge.d.ts +5 -0
- package/dist/hitl/hitlBridge.js +13 -9
- package/dist/hitl/hitlHostSurface.d.ts +1 -0
- package/dist/hitl/hitlHostSurface.js +7 -2
- package/dist/hitl/hostWithdrawal.d.ts +15 -0
- package/dist/hitl/hostWithdrawal.js +38 -0
- package/dist/hitl/livePendingAsk.js +17 -16
- package/dist/hitl/localAllowRule.js +2 -1
- package/dist/hitl/noAllowCause.d.ts +1 -1
- package/dist/hitl/noAllowCause.js +4 -2
- package/dist/hitl/parkExpiryJudgements.js +26 -1
- package/dist/hitl/parkOwnership.d.ts +2 -0
- package/dist/hitl/parkOwnership.js +48 -8
- package/dist/hitl/parkResolver.js +32 -16
- package/dist/hitl/parkedUnresumable.d.ts +13 -0
- package/dist/hitl/parkedUnresumable.js +80 -0
- package/dist/hitl/permissionRuleScope.d.ts +4 -0
- package/dist/hitl/permissionRuleScope.js +31 -0
- package/dist/hitl/persistedRulesWire.d.ts +2 -0
- package/dist/hitl/persistedRulesWire.js +13 -12
- package/dist/hitl/planReviewWire.js +14 -4
- package/dist/hitl/sessionAllowRoute.js +5 -4
- package/dist/hitl/sessionPolicyWire.js +6 -4
- package/dist/hitl/standingRows.d.ts +2 -5
- package/dist/hitl/standingRows.js +30 -15
- package/dist/hitl/toolApprovalWire.d.ts +42 -9
- package/dist/hitl/toolApprovalWire.js +267 -44
- package/dist/hooksWireCaps.js +35 -4
- package/dist/hostSettingsSource.js +2 -0
- package/dist/hostTurnSettings.d.ts +10 -4
- package/dist/hostTurnSettings.js +112 -5
- package/dist/i18n/messages.en.d.ts +251 -0
- package/dist/i18n/messages.en.js +254 -2
- package/dist/i18n/messages.zh.js +264 -2
- package/dist/index.d.ts +48 -12
- package/dist/index.js +29 -7
- package/dist/inheritEnvCapability.js +2 -0
- package/dist/inputAuthor.d.ts +16 -0
- package/dist/inputAuthor.js +44 -0
- package/dist/interruptRefusalNote.d.ts +2 -0
- package/dist/interruptRefusalNote.js +17 -0
- package/dist/liveModelCatalog.d.ts +2 -0
- package/dist/liveModelCatalog.js +21 -7
- package/dist/liveQuestionStore.d.ts +4 -1
- package/dist/liveQuestionStore.js +12 -3
- package/dist/localEngineJudge.d.ts +75 -0
- package/dist/localEngineJudge.js +242 -0
- package/dist/localEngineOccupancy.d.ts +88 -0
- package/dist/localEngineOccupancy.js +269 -0
- package/dist/localEngineSeatReading.d.ts +29 -0
- package/dist/localEngineSeatReading.js +294 -0
- package/dist/localEngineSpawn.d.ts +113 -0
- package/dist/localEngineSpawn.js +486 -0
- package/dist/localEngineStep.d.ts +286 -0
- package/dist/localEngineStep.js +1086 -0
- package/dist/localEngineStopLadder.d.ts +29 -0
- package/dist/localEngineStopLadder.js +139 -0
- package/dist/localEngineSwapCard.d.ts +43 -0
- package/dist/localEngineSwapCard.js +205 -0
- package/dist/localEngineTiming.d.ts +8 -0
- package/dist/localEngineTiming.js +8 -0
- package/dist/mcpEngineLeg.d.ts +3 -0
- package/dist/mcpEngineLeg.js +38 -1
- package/dist/mcpPanel.js +2 -0
- package/dist/mcpReconnect.d.ts +9 -1
- package/dist/mcpReconnect.js +132 -20
- package/dist/mcpWireCaps.js +2 -2
- package/dist/memoryEntriesWire.d.ts +1 -1
- package/dist/memoryEntriesWire.js +5 -0
- package/dist/modelCapabilityProbe.js +4 -3
- package/dist/modsFace.d.ts +8 -1
- package/dist/modsFace.js +27 -0
- package/dist/noticePresentation.d.ts +2 -0
- package/dist/noticePresentation.js +79 -1
- package/dist/notifications.d.ts +17 -6
- package/dist/notifications.js +67 -19
- package/dist/ownKey.d.ts +5 -0
- package/dist/ownKey.js +8 -1
- package/dist/peerFrames.d.ts +40 -2
- package/dist/peerFrames.js +158 -3
- package/dist/pluginHooksWire.d.ts +2 -1
- package/dist/pluginHooksWire.js +56 -1
- package/dist/replayBody.js +10 -2
- package/dist/request/taskRequest.d.ts +5 -0
- package/dist/request/taskRequest.js +138 -21
- package/dist/resumeRefusalCopy.d.ts +1 -3
- package/dist/resumeRefusalCopy.js +2 -1
- package/dist/retryStatus.d.ts +2 -2
- package/dist/retryStatus.js +2 -0
- package/dist/ruleReadings.js +1 -1
- package/dist/seam.d.ts +24 -2
- package/dist/seam.js +15 -2
- package/dist/seatContract.d.ts +125 -10
- package/dist/seatContract.js +373 -7
- package/dist/sessionBackground.js +4 -1
- package/dist/sessionBackgroundHandoff.js +2 -1
- package/dist/sessionEngine.d.ts +2 -0
- package/dist/sessionEngine.js +111 -0
- package/dist/sessionMemoryStatus.d.ts +2 -1
- package/dist/sessionSyncFileHistory.d.ts +4 -0
- package/dist/sessionSyncFileHistory.js +28 -0
- package/dist/sseIdleTriage.d.ts +13 -1
- package/dist/sseIdleTriage.js +24 -6
- package/dist/subagent/engineSubagentTail.js +6 -0
- package/dist/subagentContentStore.d.ts +12 -0
- package/dist/subagentContentStore.js +72 -11
- package/dist/terminalStatuses.d.ts +1 -0
- package/dist/terminalStatuses.js +4 -1
- package/dist/toolResult.js +18 -5
- package/dist/turnFailurePresentation.js +9 -2
- package/dist/typePins.d.ts +11 -0
- package/dist/usageAnalytics.d.ts +17 -0
- package/dist/usageAnalytics.js +44 -2
- package/dist/wireFailureShape.d.ts +22 -5
- package/dist/wireFailureShape.js +47 -26
- package/dist/wireRefusalCopy.d.ts +31 -1
- package/dist/wireRefusalCopy.js +167 -2
- package/docs/INTEGRATION-CLIENTS.md +3269 -21
- package/package.json +5 -5
|
@@ -24,7 +24,6 @@ export type ThrownExtraReading = {
|
|
|
24
24
|
};
|
|
25
25
|
export declare function readThrownExtra(o: {} | null | undefined): ThrownExtraReading;
|
|
26
26
|
export interface ThrownExtraSnapshot {
|
|
27
|
-
readonly sdkInstance: boolean;
|
|
28
27
|
readonly bag: ThrownExtraReading;
|
|
29
28
|
}
|
|
30
29
|
export declare function readThrownExtraSnapshot(o: {} | null | undefined): ThrownExtraSnapshot;
|
|
@@ -32,6 +31,7 @@ export declare const PROTOCOL_ERROR_NAME: Readonly<{
|
|
|
32
31
|
readonly ApprovalBindingMismatchError: "ApprovalBindingMismatchError";
|
|
33
32
|
readonly ApprovalStaleError: "ApprovalStaleError";
|
|
34
33
|
readonly AskDecidedError: "AskDecidedError";
|
|
34
|
+
readonly CheckpointInvalidOutcomeError: "CheckpointInvalidOutcomeError";
|
|
35
35
|
readonly ConflictError: "ConflictError";
|
|
36
36
|
readonly NotFoundError: "NotFoundError";
|
|
37
37
|
readonly ParkedResumeStartupError: "ParkedResumeStartupError";
|
|
@@ -47,18 +47,15 @@ export declare const PROTOCOL_ERROR_NAME: Readonly<{
|
|
|
47
47
|
readonly UsageWindowExhaustedError: "UsageWindowExhaustedError";
|
|
48
48
|
}>;
|
|
49
49
|
export type ProtocolErrorName = (typeof PROTOCOL_ERROR_NAME)[keyof typeof PROTOCOL_ERROR_NAME];
|
|
50
|
-
export declare function isSdkErrorInstance(o: object): boolean;
|
|
51
50
|
export type ProtocolErrorNameReading = {
|
|
52
51
|
readonly state: 'named';
|
|
53
52
|
readonly name: ProtocolErrorName;
|
|
54
53
|
} | {
|
|
55
54
|
readonly state: 'absent';
|
|
56
|
-
} | {
|
|
57
|
-
readonly state: 'sdk-instance';
|
|
58
55
|
} | {
|
|
59
56
|
readonly state: 'unreadable';
|
|
60
57
|
};
|
|
61
|
-
export declare function protocolErrorNameReading(e: object
|
|
58
|
+
export declare function protocolErrorNameReading(e: object): ProtocolErrorNameReading;
|
|
62
59
|
export declare function protocolErrorNameOf(e: object): ProtocolErrorName | undefined;
|
|
63
60
|
export type ThrownStatusReading = number | undefined | typeof THROWN_SLOT_UNREADABLE;
|
|
64
61
|
export declare function readThrownStatusSlot(o: object, notePresence?: (presence: SlotPresence) => void): ThrownStatusReading;
|
|
@@ -69,6 +66,26 @@ export interface OwnSlotRead {
|
|
|
69
66
|
}
|
|
70
67
|
export declare function slotPresenceOf(o: object, key: string): SlotPresence;
|
|
71
68
|
export declare function slotReadOf(o: object, key: string): OwnSlotRead;
|
|
69
|
+
export type InSlotRead = {
|
|
70
|
+
readonly state: 'absent';
|
|
71
|
+
} | {
|
|
72
|
+
readonly state: 'present';
|
|
73
|
+
readonly value: {} | null | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
readonly state: 'present_unreadable';
|
|
76
|
+
} | {
|
|
77
|
+
readonly state: 'unproven';
|
|
78
|
+
};
|
|
79
|
+
export declare function inSlotReadOf(o: object, key: string): InSlotRead;
|
|
80
|
+
export type InValueRead = {
|
|
81
|
+
readonly state: 'absent';
|
|
82
|
+
} | {
|
|
83
|
+
readonly state: 'present';
|
|
84
|
+
readonly value: {} | null | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
readonly state: 'unproven';
|
|
87
|
+
};
|
|
88
|
+
export declare function inValueOf(o: object, key: string): InValueRead;
|
|
72
89
|
export declare function readErrorNumber(o: object, key: string): number | undefined;
|
|
73
90
|
export declare function readErrorRecord(o: object, key: string): object | undefined;
|
|
74
91
|
export declare function readErrorPresent(o: object, key: string): {} | null | undefined;
|
package/dist/wireFailureShape.js
CHANGED
|
@@ -91,39 +91,39 @@ export function readThrownExtra(o) {
|
|
|
91
91
|
}
|
|
92
92
|
export function readThrownExtraSnapshot(o) {
|
|
93
93
|
if (o === null || o === undefined || (typeof o !== 'object' && typeof o !== 'function'))
|
|
94
|
-
return {
|
|
94
|
+
return { bag: { state: 'absent' } };
|
|
95
95
|
let at;
|
|
96
96
|
try {
|
|
97
97
|
at = extraSlotOf(o);
|
|
98
98
|
}
|
|
99
99
|
catch {
|
|
100
|
-
return {
|
|
100
|
+
return { bag: { state: 'unreadable' } };
|
|
101
101
|
}
|
|
102
|
-
const sdkInstance = at.kind === 'sdk-class';
|
|
103
102
|
if (at.kind === 'own-accessor')
|
|
104
|
-
return {
|
|
103
|
+
return { bag: { state: 'unreadable' } };
|
|
105
104
|
if (at.kind === 'none')
|
|
106
|
-
return {
|
|
105
|
+
return { bag: { state: 'absent' } };
|
|
107
106
|
let slot;
|
|
108
107
|
try {
|
|
109
108
|
slot = at.kind === 'own-data' ? at.value : Reflect.get(o, EXTRA_KEY);
|
|
110
109
|
}
|
|
111
110
|
catch {
|
|
112
|
-
return {
|
|
111
|
+
return { bag: { state: 'unreadable' } };
|
|
113
112
|
}
|
|
114
113
|
try {
|
|
115
114
|
if (typeof slot !== 'object' || slot === null || Array.isArray(slot))
|
|
116
|
-
return {
|
|
115
|
+
return { bag: { state: 'absent' } };
|
|
117
116
|
}
|
|
118
117
|
catch {
|
|
119
|
-
return {
|
|
118
|
+
return { bag: { state: 'unreadable' } };
|
|
120
119
|
}
|
|
121
|
-
return {
|
|
120
|
+
return { bag: { state: 'object', value: slot } };
|
|
122
121
|
}
|
|
123
122
|
export const PROTOCOL_ERROR_NAME = Object.freeze({
|
|
124
123
|
ApprovalBindingMismatchError: 'ApprovalBindingMismatchError',
|
|
125
124
|
ApprovalStaleError: 'ApprovalStaleError',
|
|
126
125
|
AskDecidedError: 'AskDecidedError',
|
|
126
|
+
CheckpointInvalidOutcomeError: 'CheckpointInvalidOutcomeError',
|
|
127
127
|
ConflictError: 'ConflictError',
|
|
128
128
|
NotFoundError: 'NotFoundError',
|
|
129
129
|
ParkedResumeStartupError: 'ParkedResumeStartupError',
|
|
@@ -139,20 +139,10 @@ export const PROTOCOL_ERROR_NAME = Object.freeze({
|
|
|
139
139
|
UsageWindowExhaustedError: 'UsageWindowExhaustedError',
|
|
140
140
|
});
|
|
141
141
|
const PROTOCOL_ERROR_NAMES = new Set(Object.values(PROTOCOL_ERROR_NAME));
|
|
142
|
-
export function
|
|
143
|
-
try {
|
|
144
|
-
return extraSlotOf(o).kind === 'sdk-class';
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
export function protocolErrorNameReading(e, extra) {
|
|
142
|
+
export function protocolErrorNameReading(e) {
|
|
151
143
|
if (typeof e !== 'object' || e === null)
|
|
152
144
|
return { state: 'absent' };
|
|
153
145
|
try {
|
|
154
|
-
if (extra !== undefined ? extra.sdkInstance : isSdkErrorInstance(e))
|
|
155
|
-
return { state: 'sdk-instance' };
|
|
156
146
|
const name = ownDataField(e, 'name');
|
|
157
147
|
return typeof name === 'string' && PROTOCOL_ERROR_NAMES.has(name) ? { state: 'named', name: name } : { state: 'absent' };
|
|
158
148
|
}
|
|
@@ -181,31 +171,62 @@ export function readThrownStatusSlot(o, notePresence) {
|
|
|
181
171
|
return undefined;
|
|
182
172
|
return typeof raw === 'number' ? raw : THROWN_SLOT_UNREADABLE;
|
|
183
173
|
}
|
|
184
|
-
function
|
|
174
|
+
function observeOwnSlot(o, key, withPresence) {
|
|
185
175
|
let d;
|
|
186
176
|
try {
|
|
187
177
|
d = Object.getOwnPropertyDescriptor(o, key);
|
|
188
178
|
}
|
|
189
179
|
catch {
|
|
190
|
-
return {
|
|
180
|
+
return { kind: 'thrown' };
|
|
191
181
|
}
|
|
192
182
|
if (d !== undefined)
|
|
193
|
-
return Object.hasOwn(d, 'value') ? { value: d.value
|
|
183
|
+
return Object.hasOwn(d, 'value') ? { kind: 'data', value: d.value } : { kind: 'accessor' };
|
|
194
184
|
if (!withPresence)
|
|
195
|
-
return {
|
|
185
|
+
return { kind: 'not-own', inChain: 'unasked' };
|
|
196
186
|
try {
|
|
197
|
-
return {
|
|
187
|
+
return { kind: 'not-own', inChain: key in o ? 'inherited' : 'none' };
|
|
198
188
|
}
|
|
199
189
|
catch {
|
|
200
|
-
return {
|
|
190
|
+
return { kind: 'not-own', inChain: 'in-thrown' };
|
|
201
191
|
}
|
|
202
192
|
}
|
|
193
|
+
function readOwnSlot(o, key, withPresence) {
|
|
194
|
+
const ob = observeOwnSlot(o, key, withPresence);
|
|
195
|
+
if (ob.kind === 'data')
|
|
196
|
+
return { value: ob.value, presence: 'present' };
|
|
197
|
+
if (ob.kind === 'thrown' || ob.kind === 'accessor')
|
|
198
|
+
return { value: THROWN_SLOT_UNREADABLE, presence: 'unreadable' };
|
|
199
|
+
return { value: undefined, presence: ob.inChain === 'none' ? 'absent' : 'unreadable' };
|
|
200
|
+
}
|
|
203
201
|
export function slotPresenceOf(o, key) {
|
|
204
202
|
return slotReadOf(o, key).presence;
|
|
205
203
|
}
|
|
206
204
|
export function slotReadOf(o, key) {
|
|
207
205
|
return readOwnSlot(o, key, true);
|
|
208
206
|
}
|
|
207
|
+
export function inSlotReadOf(o, key) {
|
|
208
|
+
const claimed = key in o;
|
|
209
|
+
const ob = observeOwnSlot(o, key, true);
|
|
210
|
+
if (ob.kind === 'thrown')
|
|
211
|
+
return { state: 'unproven' };
|
|
212
|
+
if (ob.kind === 'data' || ob.kind === 'accessor') {
|
|
213
|
+
if (!claimed)
|
|
214
|
+
return { state: 'unproven' };
|
|
215
|
+
return ob.kind === 'data' ? { state: 'present', value: ob.value } : { state: 'present_unreadable' };
|
|
216
|
+
}
|
|
217
|
+
if (ob.inChain === 'in-thrown' || ob.inChain === 'unasked')
|
|
218
|
+
return { state: 'unproven' };
|
|
219
|
+
const again = ob.inChain === 'inherited';
|
|
220
|
+
if (!claimed)
|
|
221
|
+
return again ? { state: 'unproven' } : { state: 'absent' };
|
|
222
|
+
return again ? { state: 'present_unreadable' } : { state: 'unproven' };
|
|
223
|
+
}
|
|
224
|
+
export function inValueOf(o, key) {
|
|
225
|
+
const s = inSlotReadOf(o, key);
|
|
226
|
+
if (s.state === 'present_unreadable')
|
|
227
|
+
return { state: 'present', value: o[key] };
|
|
228
|
+
return s;
|
|
229
|
+
}
|
|
209
230
|
function readErrorSlot(obj, key, accept) {
|
|
210
231
|
try {
|
|
211
232
|
const topRaw = readThrownSlot(obj, key, 'data');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CONFLICT_SESSION_ARCHIVE_STAMPED, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
1
|
+
import { CONFLICT_SESSION_ARCHIVE_STAMPED, CONFLICT_SESSION_ID_RETIRED, FLEET_LEASE_UNAVAILABLE, LIMIT_RATE_EXCEEDED, RATE_EXCEEDED_RUN_CONCURRENCY_CAP, REQUEST_ENV_CREDENTIAL_REFUSED, REQUEST_AUTONOMY_LANE_REFUSED, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
2
2
|
import type { TaskRequestLike } from './request/taskRequest.js';
|
|
3
3
|
import type { UiLanguage } from './env/uiLanguage.js';
|
|
4
4
|
export declare const CONFLICT_APPROVAL_SETTLED = "conflict.approval_settled";
|
|
@@ -53,6 +53,7 @@ export interface SessionDeleteConflictDetail {
|
|
|
53
53
|
}
|
|
54
54
|
export declare function sessionDeleteConflictFromError(err: unknown): SessionDeleteConflictDetail | null;
|
|
55
55
|
export declare function sessionDeleteConflictContent(detail: Pick<SessionDeleteConflictDetail, 'kind' | 'remaining' | 'activeTaskId'>, lang?: UiLanguage): string;
|
|
56
|
+
declare const FIELD_INVALID = "request.field_invalid";
|
|
56
57
|
export type SettingsPermissionBucket = 'allow' | 'deny' | 'ask';
|
|
57
58
|
export type SettingsPermissionBucketRefusalReason = 'over_cap' | 'bad_entry';
|
|
58
59
|
export interface SettingsPermissionBucketRefusalDetail {
|
|
@@ -145,6 +146,35 @@ export interface SessionArchiveStampedDetail {
|
|
|
145
146
|
export declare function sessionArchiveStampedFromError(err: {} | null | undefined): SessionArchiveStampedDetail | null;
|
|
146
147
|
export type SessionArchiveStampedScenario = 'fork' | 'push';
|
|
147
148
|
export declare function sessionArchiveStampedContent(lang?: UiLanguage, scenario?: SessionArchiveStampedScenario): string;
|
|
149
|
+
export interface EnvCredentialRefusalDetail {
|
|
150
|
+
readonly code: typeof REQUEST_ENV_CREDENTIAL_REFUSED;
|
|
151
|
+
readonly names?: readonly string[];
|
|
152
|
+
readonly folded?: true;
|
|
153
|
+
}
|
|
154
|
+
export declare function envCredentialRefusalFromError(err: {} | null | undefined): EnvCredentialRefusalDetail | null;
|
|
155
|
+
export declare function envCredentialRefusalContent(detail: Pick<EnvCredentialRefusalDetail, 'names' | 'folded'>, lang?: UiLanguage): string;
|
|
156
|
+
export interface SessionIdRetiredDetail {
|
|
157
|
+
readonly code: typeof CONFLICT_SESSION_ID_RETIRED;
|
|
158
|
+
readonly folded?: true;
|
|
159
|
+
}
|
|
160
|
+
export declare function sessionIdRetiredFromError(err: {} | null | undefined): SessionIdRetiredDetail | null;
|
|
161
|
+
export declare function sessionIdRetiredContent(detail: Pick<SessionIdRetiredDetail, 'folded'>, lang?: UiLanguage): string;
|
|
162
|
+
export type UnreadRequestMembersFace = 'settings_hooks' | 'settings_env' | 'settings_other' | 'mcp_transport' | 'a2a_headers';
|
|
163
|
+
export interface UnreadRequestMembersDetail {
|
|
164
|
+
readonly code: typeof FIELD_INVALID;
|
|
165
|
+
readonly field: string;
|
|
166
|
+
readonly face: UnreadRequestMembersFace;
|
|
167
|
+
readonly folded?: true;
|
|
168
|
+
}
|
|
169
|
+
export declare function unreadRequestMembersFromError(err: {} | null | undefined): UnreadRequestMembersDetail | null;
|
|
170
|
+
export declare function unreadRequestMembersContent(detail: Pick<UnreadRequestMembersDetail, 'field' | 'face' | 'folded'>, lang?: UiLanguage): string;
|
|
171
|
+
export interface RunConcurrencyCapDetail {
|
|
172
|
+
readonly code: typeof LIMIT_RATE_EXCEEDED;
|
|
173
|
+
readonly reason: typeof RATE_EXCEEDED_RUN_CONCURRENCY_CAP;
|
|
174
|
+
readonly retryAfterSec?: number;
|
|
175
|
+
}
|
|
176
|
+
export declare function runConcurrencyCapFromError(err: {} | null | undefined): RunConcurrencyCapDetail | null;
|
|
177
|
+
export declare function runConcurrencyCapContent(detail: Pick<RunConcurrencyCapDetail, 'retryAfterSec'>, lang?: UiLanguage): string;
|
|
148
178
|
export interface UnsupportedRuleRefusalProblem {
|
|
149
179
|
readonly code: string;
|
|
150
180
|
readonly field?: string;
|
package/dist/wireRefusalCopy.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { PROTOCOL_ERROR_NAME, REFUSAL_PROBLEMS_READ_MAX, THROWN_SLOT_UNREADABLE, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
1
|
+
import { PROTOCOL_ERROR_NAME, REFUSAL_PROBLEMS_READ_MAX, THROWN_SLOT_UNREADABLE, effectiveWireCodeReading, isSlotCarrier, protocolErrorNameOf, readErrorNumber, readErrorPresent, readErrorRecord, readErrorStrictStringList, readErrorString, readErrorStringList, readRefusalField, readRefusalSlots, readThrownSlot, readThrownStatusSlot } from './wireFailureShape.js';
|
|
2
2
|
import { appendOwnElement, guardedRead, readOwnDataValue, readOwnNonEmptyString } from './ownKey.js';
|
|
3
|
-
import { ACTIVE_RUN_BUSY_ERROR_CODE, CONFLICT_SESSION_ARCHIVE_STAMPED, FLEET_LEASE_UNAVAILABLE, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
3
|
+
import { ACTIVE_RUN_BUSY_ERROR_CODE, CONFLICT_SESSION_ARCHIVE_STAMPED, CONFLICT_SESSION_ID_RETIRED, FLEET_LEASE_UNAVAILABLE, LIMIT_RATE_EXCEEDED, RATE_EXCEEDED_RUN_CONCURRENCY_CAP, REQUEST_ENV_CREDENTIAL_REFUSED, REQUEST_AUTONOMY_LANE_REFUSED, REQUEST_FIELD_CONFLICT, RESUME_OUTCOME_INVALID, USAGE_WINDOW_EXHAUSTED, USER_ATTACHMENT_INVALID_ERROR_CODE, USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE } from './engineErrorCodes.js';
|
|
4
4
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
5
|
+
import { quoteUntrustedForSentence } from './displayUntrusted.js';
|
|
5
6
|
import { effectiveWireErrorCode } from './wireErrorTriage.js';
|
|
6
7
|
import { CORE_TOOL_DECLARATION_CODES } from './generated/engineFactTables.js';
|
|
7
8
|
import { SETTINGS_ECHO_CALLER_TEXT } from './generated/settingsSchemaFns.js';
|
|
@@ -815,6 +816,162 @@ export function sessionArchiveStampedFromError(err) {
|
|
|
815
816
|
export function sessionArchiveStampedContent(lang, scenario) {
|
|
816
817
|
return renderMessage(msg(scenario === 'fork' ? 'notice.wireRefusal.sessionArchiveStamped.fork' : 'notice.wireRefusal.sessionArchiveStamped'), lang);
|
|
817
818
|
}
|
|
819
|
+
const ENV_CREDENTIAL_NAME_SHOWN_MAX = 80;
|
|
820
|
+
const ENV_CREDENTIAL_NAMES_SHOWN = 8;
|
|
821
|
+
export function envCredentialRefusalFromError(err) {
|
|
822
|
+
try {
|
|
823
|
+
if (typeof err !== 'object' || err === null)
|
|
824
|
+
return null;
|
|
825
|
+
const effective = effectiveWireCodeReading(err);
|
|
826
|
+
if (effective.code !== REQUEST_ENV_CREDENTIAL_REFUSED)
|
|
827
|
+
return null;
|
|
828
|
+
const names = guardedRead(() => envCredentialNamesOf(readErrorPresent(err, 'entries')));
|
|
829
|
+
return Object.freeze({
|
|
830
|
+
code: REQUEST_ENV_CREDENTIAL_REFUSED,
|
|
831
|
+
...(names !== undefined ? { names } : {}),
|
|
832
|
+
...(effective.folded ? { folded: true } : {}),
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
catch {
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
function envCredentialNamesOf(list) {
|
|
840
|
+
if (!Array.isArray(list))
|
|
841
|
+
return undefined;
|
|
842
|
+
const out = [];
|
|
843
|
+
const len = Math.min(list.length, REFUSAL_PROBLEMS_READ_MAX);
|
|
844
|
+
for (let i = 0; i < len; i++) {
|
|
845
|
+
const key = guardedRead(() => {
|
|
846
|
+
const item = readOwnDataValue(list, String(i));
|
|
847
|
+
if (typeof item !== 'object' || item === null)
|
|
848
|
+
return undefined;
|
|
849
|
+
const k = readOwnDataValue(item, 'key');
|
|
850
|
+
return typeof k === 'string' && k !== '' ? k : undefined;
|
|
851
|
+
});
|
|
852
|
+
if (key !== undefined && !out.includes(key))
|
|
853
|
+
appendOwnElement(out, key);
|
|
854
|
+
}
|
|
855
|
+
return out.length === 0 ? undefined : Object.freeze(out);
|
|
856
|
+
}
|
|
857
|
+
export function envCredentialRefusalContent(detail, lang) {
|
|
858
|
+
const head = renderMessage(msg(detail.folded === true ? 'notice.wireRefusal.envCredential.folded' : 'notice.wireRefusal.envCredential'), lang);
|
|
859
|
+
const quoted = (detail.names ?? []).slice(0, ENV_CREDENTIAL_NAMES_SHOWN).map((n) => quoteUntrustedForSentence(n, ENV_CREDENTIAL_NAME_SHOWN_MAX)).filter((q) => q !== undefined);
|
|
860
|
+
const more = (detail.names?.length ?? 0) > ENV_CREDENTIAL_NAMES_SHOWN ? ', …' : '';
|
|
861
|
+
const named = quoted.length > 0 ? ` · ${renderMessage(msg('notice.wireRefusal.envCredential.names', { names: quoted.join(', ') + more }), lang)}` : '';
|
|
862
|
+
return `${head}${named} · ${renderMessage(msg('notice.wireRefusal.envCredential.remedy'), lang)}`;
|
|
863
|
+
}
|
|
864
|
+
export function sessionIdRetiredFromError(err) {
|
|
865
|
+
try {
|
|
866
|
+
if (typeof err !== 'object' || err === null)
|
|
867
|
+
return null;
|
|
868
|
+
const effective = effectiveWireCodeReading(err);
|
|
869
|
+
if (effective.code !== CONFLICT_SESSION_ID_RETIRED)
|
|
870
|
+
return null;
|
|
871
|
+
return Object.freeze({ code: CONFLICT_SESSION_ID_RETIRED, ...(effective.folded ? { folded: true } : {}) });
|
|
872
|
+
}
|
|
873
|
+
catch {
|
|
874
|
+
return null;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
export function sessionIdRetiredContent(detail, lang) {
|
|
878
|
+
return renderMessage(msg(detail.folded === true ? 'notice.wireRefusal.sessionIdRetired.folded' : 'notice.wireRefusal.sessionIdRetired'), lang);
|
|
879
|
+
}
|
|
880
|
+
function isIndexedMemberCoordinate(field, list, member) {
|
|
881
|
+
const head = `${list}[`;
|
|
882
|
+
if (!field.startsWith(head))
|
|
883
|
+
return false;
|
|
884
|
+
const close = field.indexOf(']', head.length);
|
|
885
|
+
if (close < 0 || !/^[0-9]+$/.test(field.slice(head.length, close)))
|
|
886
|
+
return false;
|
|
887
|
+
const rest = field.slice(close + 1);
|
|
888
|
+
return rest === `.${member}` || rest.startsWith(`.${member}.`);
|
|
889
|
+
}
|
|
890
|
+
function unreadMembersFaceOf(field) {
|
|
891
|
+
if (/^settings\.hooks(?:\.|$)/.test(field))
|
|
892
|
+
return 'settings_hooks';
|
|
893
|
+
if (/^settings\.env(?:\.|$)/.test(field))
|
|
894
|
+
return 'settings_env';
|
|
895
|
+
if (/^settings\.[^\s.[\]]/.test(field))
|
|
896
|
+
return 'settings_other';
|
|
897
|
+
if (isIndexedMemberCoordinate(field, 'mcpServers', 'transport'))
|
|
898
|
+
return 'mcp_transport';
|
|
899
|
+
if (isIndexedMemberCoordinate(field, 'a2aPeers', 'headers'))
|
|
900
|
+
return 'a2a_headers';
|
|
901
|
+
return undefined;
|
|
902
|
+
}
|
|
903
|
+
export function unreadRequestMembersFromError(err) {
|
|
904
|
+
try {
|
|
905
|
+
if (typeof err !== 'object' || err === null)
|
|
906
|
+
return null;
|
|
907
|
+
const effective = effectiveWireCodeReading(err);
|
|
908
|
+
if (effective.code !== FIELD_INVALID)
|
|
909
|
+
return null;
|
|
910
|
+
const slots = readRefusalSlots(err, ['field', 'reason', 'detail']);
|
|
911
|
+
if (slots.reason.present || slots.detail.present)
|
|
912
|
+
return null;
|
|
913
|
+
const field = slots.field.word;
|
|
914
|
+
if (field === undefined)
|
|
915
|
+
return null;
|
|
916
|
+
const face = unreadMembersFaceOf(field);
|
|
917
|
+
if (face === undefined)
|
|
918
|
+
return null;
|
|
919
|
+
return Object.freeze({ code: FIELD_INVALID, field, face, ...(effective.folded ? { folded: true } : {}) });
|
|
920
|
+
}
|
|
921
|
+
catch {
|
|
922
|
+
return null;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
function unreadMembersPartKey(face) {
|
|
926
|
+
switch (face) {
|
|
927
|
+
case 'settings_hooks':
|
|
928
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsHooks';
|
|
929
|
+
case 'settings_env':
|
|
930
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsEnv';
|
|
931
|
+
case 'settings_other':
|
|
932
|
+
return 'notice.wireRefusal.unreadMembers.part.settingsOther';
|
|
933
|
+
case 'mcp_transport':
|
|
934
|
+
return 'notice.wireRefusal.unreadMembers.part.mcpTransport';
|
|
935
|
+
case 'a2a_headers':
|
|
936
|
+
return 'notice.wireRefusal.unreadMembers.part.a2aHeaders';
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
const UNREAD_MEMBERS_FIELD_SHOWN_MAX = 120;
|
|
940
|
+
export function unreadRequestMembersContent(detail, lang) {
|
|
941
|
+
const folded = detail.folded === true;
|
|
942
|
+
const part = renderMessage(msg(unreadMembersPartKey(detail.face)), lang);
|
|
943
|
+
const head = renderMessage(msg(folded ? 'notice.wireRefusal.unreadMembers.folded' : 'notice.wireRefusal.unreadMembers', { part }), lang);
|
|
944
|
+
const quoted = quoteUntrustedForSentence(detail.field, UNREAD_MEMBERS_FIELD_SHOWN_MAX);
|
|
945
|
+
const where = quoted !== undefined ? ` · ${renderMessage(msg('notice.wireRefusal.unreadMembers.where', { where: quoted }), lang)}` : '';
|
|
946
|
+
return `${head}${where} · ${renderMessage(msg(folded ? 'notice.wireRefusal.unreadMembers.folded.remedy' : 'notice.wireRefusal.unreadMembers.remedy'), lang)}`;
|
|
947
|
+
}
|
|
948
|
+
export function runConcurrencyCapFromError(err) {
|
|
949
|
+
try {
|
|
950
|
+
if (typeof err !== 'object' || err === null)
|
|
951
|
+
return null;
|
|
952
|
+
if (effectiveWireCodeReading(err).code !== LIMIT_RATE_EXCEEDED)
|
|
953
|
+
return null;
|
|
954
|
+
if (readRefusalSlots(err, ['reason']).reason.word !== RATE_EXCEEDED_RUN_CONCURRENCY_CAP)
|
|
955
|
+
return null;
|
|
956
|
+
const rawSec = readErrorNumber(err, 'retryAfterSec');
|
|
957
|
+
const sec = nonNegativeFinite(rawSec)
|
|
958
|
+
? Math.ceil(rawSec)
|
|
959
|
+
: (() => {
|
|
960
|
+
const rawMs = readThrownSlot(err, 'retryAfterMs', 'data');
|
|
961
|
+
return nonNegativeFinite(rawMs) ? Math.ceil(rawMs / 1000) : undefined;
|
|
962
|
+
})();
|
|
963
|
+
return Object.freeze({ code: LIMIT_RATE_EXCEEDED, reason: RATE_EXCEEDED_RUN_CONCURRENCY_CAP, ...(sec !== undefined ? { retryAfterSec: sec } : {}) });
|
|
964
|
+
}
|
|
965
|
+
catch {
|
|
966
|
+
return null;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
export function runConcurrencyCapContent(detail, lang) {
|
|
970
|
+
const head = renderMessage(msg('notice.wireRefusal.runConcurrencyCap.head'), lang);
|
|
971
|
+
return detail.retryAfterSec !== undefined
|
|
972
|
+
? `${head} · ${renderMessage(msg('notice.wireRefusal.sendAgainAbout', { wait: humanWait(detail.retryAfterSec) }), lang)}`
|
|
973
|
+
: `${head} · ${renderMessage(msg('notice.wireRefusal.runConcurrencyCap.unknownWait'), lang)}`;
|
|
974
|
+
}
|
|
818
975
|
const REQUEST_UNPROCESSABLE = 'request.unprocessable';
|
|
819
976
|
const UNSUPPORTED_RULE_PROBLEMS_MAX = REFUSAL_PROBLEMS_READ_MAX;
|
|
820
977
|
const nonEmptyString = (v) => (typeof v === 'string' && v !== '' ? v : undefined);
|
|
@@ -980,3 +1137,11 @@ export function userAttachmentRefusalFromError(err) {
|
|
|
980
1137
|
export function userInvokedSkillRefusalFromError(err) {
|
|
981
1138
|
return effectiveWireErrorCode(err) === USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE ? { code: USER_INVOKED_SKILL_UNKNOWN_ERROR_CODE, retryable: false } : null;
|
|
982
1139
|
}
|
|
1140
|
+
const _pinRequestField = [true, true, true, true, true, true, true, true];
|
|
1141
|
+
void _pinRequestField;
|
|
1142
|
+
const _pinSettingsHooks = [true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true];
|
|
1143
|
+
void _pinSettingsHooks;
|
|
1144
|
+
const _pinAttachment = [true, true, true];
|
|
1145
|
+
void _pinAttachment;
|
|
1146
|
+
const _pinWallSource = [true, true, true];
|
|
1147
|
+
void _pinWallSource;
|