@sema-agent/client-core 0.92.0 → 0.93.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 +179 -0
- package/README.md +23 -16
- package/dist/adapt/arms.js +2 -0
- package/dist/adapt/toolCards.js +6 -4
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +1 -1
- package/dist/adapter/runStream.js +3 -1
- package/dist/agentsWireCaps.js +1 -1
- package/dist/approvalDecidedByCapability.d.ts +16 -0
- package/dist/approvalDecidedByCapability.js +47 -0
- package/dist/approvalsStreamLiveCapability.js +3 -3
- package/dist/askSurvivesStandingAnswer.d.ts +1 -1
- package/dist/centerWiringCapability.js +1 -1
- package/dist/cloudConfigWireCaps.js +5 -5
- package/dist/compensations.js +2 -2
- package/dist/decideReceipt.d.ts +2 -0
- package/dist/decideReceipt.js +34 -9
- package/dist/detachWire.d.ts +2 -14
- package/dist/detachWire.js +1 -47
- package/dist/deviceExecutorManagementCapability.d.ts +6 -2
- package/dist/deviceExecutorManagementCapability.js +61 -15
- package/dist/engineConfigDrift.d.ts +20 -0
- package/dist/engineConfigDrift.js +54 -0
- package/dist/engineErrorCodes.d.ts +3 -0
- package/dist/engineErrorCodes.js +12 -4
- package/dist/engineInlineTaskStats.d.ts +1 -0
- package/dist/engineNoticeCodes.d.ts +2 -2
- package/dist/engineWireFor.d.ts +22 -0
- package/dist/engineWireFor.js +154 -9
- package/dist/engineWireSdk.d.ts +0 -1
- package/dist/engineWireSdk.js +0 -3
- package/dist/executionLaneCapability.js +2 -2
- package/dist/fileHistoryCaptureCapability.d.ts +1 -1
- package/dist/fileHistoryCaptureCapability.js +1 -6
- package/dist/fileHistoryLegNotice.d.ts +1 -1
- package/dist/fileHistoryLegNotice.js +1 -6
- package/dist/gateVocabulary.d.ts +1 -5
- package/dist/gateVocabulary.js +4 -22
- package/dist/generated/engineFactTables.d.ts +4 -3
- package/dist/generated/engineFactTables.js +10 -0
- package/dist/generated/engineNoticeTables.d.ts +1 -1
- package/dist/generated/engineNoticeTables.js +1 -1
- package/dist/goalStopHook.d.ts +1 -8
- package/dist/goalStopHook.js +2 -58
- package/dist/headlessPermissionModeWire.d.ts +3 -2
- package/dist/headlessPermissionModeWire.js +46 -5
- package/dist/hitl/askParkRowRouting.js +2 -2
- package/dist/hitl/frameRouter.js +7 -2
- package/dist/hitl/gateLedger.d.ts +1 -0
- package/dist/hitl/gateLedger.js +3 -0
- package/dist/hitl/hitlBridge.d.ts +1 -0
- package/dist/hitl/hitlBridge.js +6 -1
- package/dist/hitl/hitlHostSurface.d.ts +3 -2
- package/dist/hitl/hitlHostSurface.js +18 -3
- package/dist/hitl/parkResolver.js +22 -4
- package/dist/hitl/persistedRulesWire.js +29 -17
- package/dist/hitl/planReviewWire.d.ts +0 -2
- package/dist/hitl/planReviewWire.js +1 -18
- package/dist/hitl/sessionPolicyDeliverable.js +3 -3
- package/dist/hitl/sessionPolicyWire.d.ts +2 -0
- package/dist/hitl/sessionPolicyWire.js +7 -4
- package/dist/hitl/toolApprovalWire.d.ts +22 -7
- package/dist/hitl/toolApprovalWire.js +133 -54
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.js +6 -2
- package/dist/inheritEnvWire.d.ts +1 -4
- package/dist/inheritEnvWire.js +0 -18
- package/dist/limitsWire.d.ts +0 -6
- package/dist/limitsWire.js +0 -38
- package/dist/mcpProbeCapability.js +1 -1
- package/dist/mcpProbeWire.js +10 -12
- package/dist/mcpReconnect.d.ts +5 -0
- package/dist/mcpReconnect.js +28 -0
- package/dist/memoryComplianceCapability.js +2 -2
- package/dist/memoryOriginCapability.js +2 -2
- package/dist/memoryVerbsWire.js +14 -13
- package/dist/ownKey.d.ts +2 -0
- package/dist/ownKey.js +15 -0
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.d.ts +16 -0
- package/dist/permissionModesCapability.js +71 -0
- package/dist/permissionRuleIssue.js +1 -1
- package/dist/permissionRulesWriteCapability.js +2 -2
- package/dist/permissionWireCaps.d.ts +2 -0
- package/dist/permissionWireCaps.js +8 -1
- package/dist/permissionsAllowGrantCapability.js +7 -2
- package/dist/postureKnob.js +1 -1
- package/dist/protocolSegment.d.ts +2 -0
- package/dist/protocolSegment.js +3 -0
- package/dist/readFacePosture.js +1 -1
- package/dist/resumeRefusalCopy.d.ts +1 -0
- package/dist/resumeRefusalCopy.js +26 -3
- package/dist/retryStatus.js +2 -1
- package/dist/rewindArchiveCapability.js +2 -2
- package/dist/runTerminal.d.ts +16 -0
- package/dist/runTerminal.js +32 -3
- package/dist/seam.d.ts +1 -0
- package/dist/sessionPolicyCapability.js +1 -1
- package/dist/sessionSyncFileHistoryCapability.js +2 -2
- package/dist/skillToolListsCapability.js +1 -1
- package/dist/sqlEngineCapability.js +1 -1
- package/dist/steerPriorityCapability.js +1 -1
- package/dist/storePostureCapability.js +2 -2
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +13 -3
- package/dist/taskRequestWords.d.ts +4 -2
- package/dist/taskRequestWords.js +1 -1
- package/dist/toolHistoryBadTurn.js +1 -2
- package/dist/toolResult.d.ts +2 -1
- package/dist/toolResult.js +33 -3
- package/dist/userInvokedSkillsCapability.js +1 -1
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/webSearchWireCaps.d.ts +1 -1
- package/dist/webSearchWireCaps.js +40 -2
- package/dist/wireFailureShape.js +2 -2
- package/dist/wireRefusalCopy.d.ts +9 -3
- package/dist/wireRefusalCopy.js +41 -4
- package/dist/workflowsJournalCapability.js +1 -1
- package/dist/writeProtectionCapability.js +1 -1
- package/docs/INTEGRATION-CLIENTS.md +901 -15
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type GateCurrentPending, type HitlFailureStage, type HitlSafetyCode, type HitlClientLike, type DecideOperationObserver } from './hitlBridge.js';
|
|
2
2
|
import { type AllowRuleShadowedWireMember, type ApprovalAllowRuleShadow } from './allowRuleShadow.js';
|
|
3
|
-
import { type RuleStoreUnreadableKind } from '../gateVocabulary.js';
|
|
4
3
|
import { type ApprovalMandateWord } from '../gateVocabulary.js';
|
|
5
4
|
import type { ToolPermissionRequest } from '../seatContract.js';
|
|
6
5
|
import { type DenyAttributionRefusalDetail } from '../wireRefusalCopy.js';
|
|
6
|
+
import { type ApprovalDecidedByReading } from '../approvalDecidedByCapability.js';
|
|
7
7
|
import { type DecideReceiptView } from '../decideReceipt.js';
|
|
8
8
|
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS } from '@sema-agent/sdk';
|
|
9
|
-
import type {
|
|
9
|
+
import type { ToolApprovalRespondAck, PersistedRuleAnchor as SdkPersistedRuleAnchor, RuleOfferMatch as SdkRuleOfferMatch, RuleOfferBatchMember as SdkRuleOfferBatchMember, RuleOfferUncoveredDetail as SdkRuleOfferUncoveredDetail, RuleOfferUncoveredReason as SdkRuleOfferUncoveredReason, AskOrigin as SdkAskOrigin, RuleOffersAbsence as SdkRuleOffersAbsence, DenialLimitKind as SdkDenialLimitKind, DenialLimitFallback as SdkDenialLimitFallback } from '@sema-agent/sdk';
|
|
10
10
|
export declare function isFsApprovalGate(gate: {
|
|
11
11
|
kind?: unknown;
|
|
12
12
|
toolName?: unknown;
|
|
@@ -24,6 +24,7 @@ export type FsApprovalOutcome = {
|
|
|
24
24
|
denySettledBy?: ApprovalDenySettledBy | undefined;
|
|
25
25
|
denyReason?: string | undefined;
|
|
26
26
|
denyAttributionDropped?: true;
|
|
27
|
+
denyAttributionRenamed?: true;
|
|
27
28
|
receipt?: DecideReceiptView | undefined;
|
|
28
29
|
} | {
|
|
29
30
|
kind: 'aborted';
|
|
@@ -49,6 +50,7 @@ export interface FsApprovalWireDeps {
|
|
|
49
50
|
client: HitlClientLike;
|
|
50
51
|
onPresented?: () => void;
|
|
51
52
|
onDecideOperation?: DecideOperationObserver;
|
|
53
|
+
approvalDecidedBy?: ApprovalDecidedByReading | undefined;
|
|
52
54
|
}
|
|
53
55
|
export declare function structurallyEqual(a: unknown, b: unknown): boolean;
|
|
54
56
|
export type RuleOfferMatch = SdkRuleOfferMatch;
|
|
@@ -151,7 +153,6 @@ export interface ApprovalCardRequest {
|
|
|
151
153
|
origin?: string;
|
|
152
154
|
askClass?: string;
|
|
153
155
|
classes?: readonly string[];
|
|
154
|
-
ruleStoreUnreadable?: RuleStoreUnreadableKind;
|
|
155
156
|
}
|
|
156
157
|
export type ApprovalCardPort = (req: ApprovalCardRequest) => Promise<ApprovalCardDecision>;
|
|
157
158
|
export declare function installApprovalCardPort(port: ApprovalCardPort | null): () => void;
|
|
@@ -164,6 +165,11 @@ export declare function approvalCardPortFor(sessionKey: string): ApprovalCardPor
|
|
|
164
165
|
export declare function _resetApprovalCardPortForTest(): void;
|
|
165
166
|
export declare function surfaceApprovalCard(req: ApprovalCardRequest): Promise<ApprovalCardDecision>;
|
|
166
167
|
export declare function surfaceFsApprovalAndDecide(deps: FsApprovalWireDeps, taskId: string, argsByCall: Map<string, unknown>, signal?: AbortSignal, parkGatedCallId?: string): Promise<FsApprovalOutcome>;
|
|
168
|
+
export interface BoundSkillGrantsWire {
|
|
169
|
+
readonly skill: string | null;
|
|
170
|
+
readonly allowedTools: readonly string[];
|
|
171
|
+
readonly disallowedTools: readonly string[];
|
|
172
|
+
}
|
|
167
173
|
export interface ToolApprovalFrame {
|
|
168
174
|
type: 'tool_approval' | 'tool_approval_complete';
|
|
169
175
|
approvalId: string;
|
|
@@ -178,13 +184,14 @@ export interface ToolApprovalFrame {
|
|
|
178
184
|
sourceAgentName?: string;
|
|
179
185
|
governanceForced?: true;
|
|
180
186
|
delegation?: ToolApprovalDelegation;
|
|
181
|
-
ruleSuggestions?: RuleSuggestion[];
|
|
182
187
|
ruleOffers?: readonly WireRuleOffer[];
|
|
183
188
|
ruleOffersAbsence?: string;
|
|
184
189
|
denialLimitFallback?: DenialLimitFallback;
|
|
185
|
-
ruleStoreUnreadable?: string;
|
|
186
190
|
persistedRuleShadowed?: string;
|
|
187
191
|
allowRuleShadowed?: readonly AllowRuleShadowedWireMember[];
|
|
192
|
+
boundGrantDigest?: string;
|
|
193
|
+
boundGrants?: BoundSkillGrantsWire;
|
|
194
|
+
classifierNoRuling?: string;
|
|
188
195
|
probeCause?: unknown;
|
|
189
196
|
probeReason?: string;
|
|
190
197
|
rememberRefused?: true;
|
|
@@ -212,7 +219,7 @@ export interface ToolApprovalDelegation {
|
|
|
212
219
|
depth: number;
|
|
213
220
|
agentName?: string;
|
|
214
221
|
}
|
|
215
|
-
export declare const TOOL_APPROVAL_FRAME_KEYS_MIRROR: readonly ["type", "approvalId", "toolCallId", "toolName", "sourceTaskId", "fromSubagent", "sourceAgentName", "message", "args", "argsOmitted", "governanceForced", "
|
|
222
|
+
export declare const TOOL_APPROVAL_FRAME_KEYS_MIRROR: readonly ["type", "approvalId", "toolCallId", "toolName", "sourceTaskId", "fromSubagent", "sourceAgentName", "message", "args", "argsOmitted", "governanceForced", "ruleOffers", "ruleOffersAbsence", "denialLimitFallback", "readRootCandidate", "mandated", "mandate", "origin", "askClass", "classes", "inputHasBidi", "parked", "persistedRuleShadowed", "allowRuleShadowed", "probeCause", "probeReason", "rememberRefused", "boundGrantDigest", "boundGrants", "classifierNoRuling", "ruleEvidence", "requiresRealApproval", "expiresInMs", "expiresAtMs", "serverNowMs", "delegation", "outcome"];
|
|
216
223
|
export interface ApprovalMandatedFacts {
|
|
217
224
|
readonly mandated?: true;
|
|
218
225
|
readonly ruleOffersAbsence?: string;
|
|
@@ -233,11 +240,17 @@ export interface RespondToolApprovalOpts {
|
|
|
233
240
|
persistRuleBatchOfferIndex?: number;
|
|
234
241
|
note?: string;
|
|
235
242
|
settledBy?: 'policy';
|
|
243
|
+
decidedBy?: 'policy';
|
|
236
244
|
}
|
|
237
245
|
export type RespondToolApprovalFn = (approvalId: string, decision: ToolApprovalRespondDecision, opts?: RespondToolApprovalOpts) => Promise<ToolApprovalRespondAck | void>;
|
|
238
246
|
export type ToolApprovalRespondAckView = ToolApprovalRespondAck;
|
|
239
247
|
export type PersistedRuleAnchor = SdkPersistedRuleAnchor;
|
|
240
248
|
export declare function readToolApprovalRespondAck(v: unknown): ToolApprovalRespondAckView | undefined;
|
|
249
|
+
export declare function decisionAttributionKeyOf(reading: ApprovalDecidedByReading | undefined, denySettledBy: ApprovalDenySettledBy | undefined): {
|
|
250
|
+
decidedBy: 'policy';
|
|
251
|
+
} | {
|
|
252
|
+
settledBy: 'policy';
|
|
253
|
+
} | Record<never, never>;
|
|
241
254
|
export interface ToolApprovalFrameOutcome {
|
|
242
255
|
decision: ToolApprovalRespondDecision | 'unresolved';
|
|
243
256
|
ack?: ToolApprovalRespondAckView;
|
|
@@ -248,6 +261,7 @@ export interface ToolApprovalFrameOutcome {
|
|
|
248
261
|
denyReason?: string;
|
|
249
262
|
denyAttributionRefusal?: DenyAttributionRefusalDetail;
|
|
250
263
|
denyAttributionDropped?: true;
|
|
264
|
+
denyAttributionRenamed?: true;
|
|
251
265
|
}
|
|
252
266
|
interface ToolApprovalRespondRefusalFields {
|
|
253
267
|
status?: number;
|
|
@@ -265,11 +279,12 @@ export declare function readToolApprovalRespondRefusal(err: unknown): ToolApprov
|
|
|
265
279
|
export declare function isToolApprovalFrame(ev: unknown): ev is ToolApprovalFrame;
|
|
266
280
|
export declare function readDenialLimitFallback(v: unknown): DenialLimitFallback | undefined;
|
|
267
281
|
export declare function readRuleOffers(v: unknown): RuleOffer[] | undefined;
|
|
268
|
-
export declare function readRuleOfferSupply(offers: unknown
|
|
282
|
+
export declare function readRuleOfferSupply(offers: unknown): RuleOffer[] | undefined;
|
|
269
283
|
export interface ToolApprovalFrameLaneOpts {
|
|
270
284
|
approvalDecisionNoteCapable?: boolean;
|
|
271
285
|
respondFreeFormRulesCapable?: boolean;
|
|
272
286
|
respondBatchRuleOffersCapable?: boolean;
|
|
287
|
+
approvalDecidedBy?: ApprovalDecidedByReading | undefined;
|
|
273
288
|
windowIsCurrent?: boolean;
|
|
274
289
|
argsUnavailable?: true;
|
|
275
290
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { APPROVAL_CARD_PORT_KEY_MISMATCH_REASON, DEFAULT_DENY_REASON, DecideTransportRetryExhaustedError, HitlBridge, NO_APPROVAL_CARD_PORT_REASON, HitlSafetyError, denyReasonForWire, findPendingForTask, readDecideCurrentPending, readWireErrorCode, } from './hitlBridge.js';
|
|
2
2
|
import { askParkRowArm } from './askParkRowRouting.js';
|
|
3
3
|
import { hostLog } from '../host.js';
|
|
4
|
-
import { readOwnNonEmptyString } from '../ownKey.js';
|
|
4
|
+
import { readOwnDataValue, readOwnNonEmptyString } from '../ownKey.js';
|
|
5
5
|
import { readAskClassPair } from './askClassPair.js';
|
|
6
6
|
import { legacyShadowedRuleTextOf, readAllowRuleShadowFromWire } from './allowRuleShadow.js';
|
|
7
7
|
import { createSessionSlot, DEFAULT_SESSION_KEY } from '../sessionSlot.js';
|
|
@@ -10,6 +10,7 @@ import { observeCancelByDeny, surfaceRememberNotApplied, surfaceEditNotForwarded
|
|
|
10
10
|
import { approvalCallKey, liveFrameCallKey } from './gateIdentity.js';
|
|
11
11
|
import { isApprovalMandateWord } from '../gateVocabulary.js';
|
|
12
12
|
import { denyAttributionRefusalFromError } from '../wireRefusalCopy.js';
|
|
13
|
+
import { approvalDecidedByAdmitted } from '../approvalDecidedByCapability.js';
|
|
13
14
|
import { decideFailureNote } from '../decideFailureNote.js';
|
|
14
15
|
import { refusalSaysStillPending } from '../engineErrorCodes.js';
|
|
15
16
|
import { readDecideReceipt } from '../decideReceipt.js';
|
|
@@ -170,6 +171,7 @@ function isParkRowInputSizeMarker(v) {
|
|
|
170
171
|
return o.truncated === true && typeof o.bytes === 'number' && Number.isFinite(o.bytes) && o.bytes >= 0;
|
|
171
172
|
}
|
|
172
173
|
export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signal, parkGatedCallId) {
|
|
174
|
+
const decidedByReading = decidedByReadingSnapshotOf(deps);
|
|
173
175
|
const found = await findPendingForTask(deps.client, taskId, (toolName) => toolName !== undefined && (toolNameIsFsWrite(toolName) || toolNameIsShellExec(toolName)), signal ? { signal } : undefined, parkGatedCallId, (row) => askParkRowArm(row) === 'tool-gate');
|
|
174
176
|
if (!found.ok)
|
|
175
177
|
return { kind: 'failed', stage: 'fetch', reason: found.reason, ...(found.code !== undefined ? { code: found.code } : {}) };
|
|
@@ -190,7 +192,7 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
190
192
|
}
|
|
191
193
|
const bridge = new HitlBridge(deps.client, taskId, deps.onDecideOperation ? { onDecideOperation: deps.onDecideOperation } : undefined);
|
|
192
194
|
const callKey = approvalCallKey(gatedCallId, taskId);
|
|
193
|
-
const ruleOffersReadOnly =
|
|
195
|
+
const ruleOffersReadOnly = readRuleOffers(pending.ruleOffers);
|
|
194
196
|
const durableProbeCause = pending.riskDescriptor?.probeCause;
|
|
195
197
|
const durableProbeReason = readProbeReason(pending.riskDescriptor);
|
|
196
198
|
const durableShadow = readAllowRuleShadowFromWire(pending, 'row');
|
|
@@ -295,31 +297,56 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
295
297
|
}
|
|
296
298
|
case 'deny': {
|
|
297
299
|
const denySettledByForWire = readApprovalDenySettledBy(card);
|
|
300
|
+
const attributionKeys = decisionAttributionKeyOf(decidedByReading, denySettledByForWire);
|
|
298
301
|
const denyReasonSnapshot = typeof card.reason === 'string' ? card.reason : undefined;
|
|
299
302
|
let lastSendCarriedAttribution = false;
|
|
300
303
|
try {
|
|
301
304
|
const denyBody = {
|
|
302
305
|
decision: 'deny',
|
|
303
306
|
reason: denyReasonForWire(denyReasonSnapshot, `task ${taskId}`) ?? DEFAULT_DENY_REASON,
|
|
304
|
-
...
|
|
307
|
+
...attributionKeys,
|
|
305
308
|
};
|
|
306
309
|
let attributionDropped = false;
|
|
310
|
+
let attributionRenamed = false;
|
|
307
311
|
let raw;
|
|
308
|
-
lastSendCarriedAttribution =
|
|
312
|
+
lastSendCarriedAttribution = carriesAttributionKey(attributionKeys);
|
|
309
313
|
try {
|
|
310
314
|
raw = await bridge.decideTool(denyBody, gatedCallId, decideOpts, pending);
|
|
311
315
|
}
|
|
312
316
|
catch (first) {
|
|
313
|
-
if (
|
|
317
|
+
if (shouldResendWithoutAttribution(first, lastSendCarriedAttribution, signal)) {
|
|
318
|
+
const withoutAttribution = withoutAttributionKey(denyBody);
|
|
319
|
+
lastSendCarriedAttribution = false;
|
|
320
|
+
hostLog('debug', `liveToolApprovalWire: decide(deny) for task ${taskId} was refused because the settlement note is not part of ` +
|
|
321
|
+
'what this deployment signs — re-sending the SAME decision exactly once with that one key removed ' +
|
|
322
|
+
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
323
|
+
raw = await bridge.decideTool(withoutAttribution, gatedCallId, decideOpts, pending);
|
|
324
|
+
attributionDropped = true;
|
|
325
|
+
}
|
|
326
|
+
else if (shouldResendUnderSuccessorKey(first, Object.hasOwn(denyBody, 'settledBy'), signal)) {
|
|
327
|
+
const renamed = withAttributionKeyRenamed(denyBody);
|
|
328
|
+
hostLog('debug', `liveToolApprovalWire: decide(deny) for task ${taskId} was refused because the settlement note was sent under a name ` +
|
|
329
|
+
'this engine has retired — re-sending the SAME decision exactly once with that one key renamed to the name the refusal points to ' +
|
|
330
|
+
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
331
|
+
try {
|
|
332
|
+
raw = await bridge.decideTool(renamed, gatedCallId, decideOpts, pending);
|
|
333
|
+
attributionRenamed = true;
|
|
334
|
+
}
|
|
335
|
+
catch (second) {
|
|
336
|
+
if (!shouldResendWithoutAttribution(second, true, signal))
|
|
337
|
+
throw second;
|
|
338
|
+
const renamedWithoutAttribution = withoutAttributionKey(renamed);
|
|
339
|
+
lastSendCarriedAttribution = false;
|
|
340
|
+
hostLog('debug', `liveToolApprovalWire: decide(deny) for task ${taskId} was refused again because the settlement note is not part of ` +
|
|
341
|
+
'what this deployment signs — re-sending the SAME decision exactly once more with that key removed ' +
|
|
342
|
+
'(still before the approval was judged)');
|
|
343
|
+
raw = await bridge.decideTool(renamedWithoutAttribution, gatedCallId, decideOpts, pending);
|
|
344
|
+
attributionDropped = true;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
314
348
|
throw first;
|
|
315
|
-
|
|
316
|
-
void _droppedKey;
|
|
317
|
-
lastSendCarriedAttribution = false;
|
|
318
|
-
hostLog('debug', `liveToolApprovalWire: decide(deny) for task ${taskId} was refused because the settlement note is not part of ` +
|
|
319
|
-
'what this deployment signs — re-sending the SAME decision exactly once with that one key removed ' +
|
|
320
|
-
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
321
|
-
raw = await bridge.decideTool(withoutAttribution, gatedCallId, decideOpts, pending);
|
|
322
|
-
attributionDropped = true;
|
|
349
|
+
}
|
|
323
350
|
}
|
|
324
351
|
const receipt = readDecideReceipt(raw);
|
|
325
352
|
const denySettledBy = denySettledByForWire;
|
|
@@ -331,6 +358,7 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
331
358
|
...(denySettledBy !== undefined ? { denySettledBy } : {}),
|
|
332
359
|
...(denyReason !== undefined ? { denyReason } : {}),
|
|
333
360
|
...(attributionDropped ? { denyAttributionDropped: true } : {}),
|
|
361
|
+
...(attributionRenamed ? { denyAttributionRenamed: true } : {}),
|
|
334
362
|
...(receipt !== undefined ? { receipt } : {}),
|
|
335
363
|
};
|
|
336
364
|
}
|
|
@@ -360,6 +388,8 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
360
388
|
decideSpan.close();
|
|
361
389
|
}
|
|
362
390
|
}
|
|
391
|
+
const _boundGrantsPin = [true, true, true];
|
|
392
|
+
void _boundGrantsPin;
|
|
363
393
|
function readReadRootCandidate(v) {
|
|
364
394
|
if (typeof v !== 'object' || v === null)
|
|
365
395
|
return undefined;
|
|
@@ -382,11 +412,9 @@ export const TOOL_APPROVAL_FRAME_KEYS_MIRROR = [
|
|
|
382
412
|
'args',
|
|
383
413
|
'argsOmitted',
|
|
384
414
|
'governanceForced',
|
|
385
|
-
'ruleSuggestions',
|
|
386
415
|
'ruleOffers',
|
|
387
416
|
'ruleOffersAbsence',
|
|
388
417
|
'denialLimitFallback',
|
|
389
|
-
'ruleStoreUnreadable',
|
|
390
418
|
'readRootCandidate',
|
|
391
419
|
'mandated',
|
|
392
420
|
'mandate',
|
|
@@ -400,6 +428,9 @@ export const TOOL_APPROVAL_FRAME_KEYS_MIRROR = [
|
|
|
400
428
|
'probeCause',
|
|
401
429
|
'probeReason',
|
|
402
430
|
'rememberRefused',
|
|
431
|
+
'boundGrantDigest',
|
|
432
|
+
'boundGrants',
|
|
433
|
+
'classifierNoRuling',
|
|
403
434
|
'ruleEvidence',
|
|
404
435
|
'requiresRealApproval',
|
|
405
436
|
'expiresInMs',
|
|
@@ -550,13 +581,50 @@ function readPersistedRuleAnchors(v) {
|
|
|
550
581
|
function isNonNegativeSafeInt(v) {
|
|
551
582
|
return typeof v === 'number' && Number.isSafeInteger(v) && v >= 0;
|
|
552
583
|
}
|
|
553
|
-
function shouldResendWithoutAttribution(e,
|
|
554
|
-
if (!
|
|
584
|
+
function shouldResendWithoutAttribution(e, sentAttributionKey, signal) {
|
|
585
|
+
if (!sentAttributionKey)
|
|
555
586
|
return false;
|
|
556
587
|
if (signal?.aborted === true)
|
|
557
588
|
return false;
|
|
558
589
|
return denyAttributionRefusalFromError(e, true)?.kind === 'not_in_proof';
|
|
559
590
|
}
|
|
591
|
+
function shouldResendUnderSuccessorKey(e, lastSendCarriedRetiredKey, signal) {
|
|
592
|
+
if (!lastSendCarriedRetiredKey)
|
|
593
|
+
return false;
|
|
594
|
+
if (signal?.aborted === true)
|
|
595
|
+
return false;
|
|
596
|
+
return denyAttributionRefusalFromError(e, true)?.kind === 'retired_key';
|
|
597
|
+
}
|
|
598
|
+
export function decisionAttributionKeyOf(reading, denySettledBy) {
|
|
599
|
+
if (denySettledBy !== 'policy')
|
|
600
|
+
return {};
|
|
601
|
+
return approvalDecidedByAdmitted(reading) ? { decidedBy: 'policy' } : { settledBy: 'policy' };
|
|
602
|
+
}
|
|
603
|
+
function carriesAttributionKey(body) {
|
|
604
|
+
return Object.hasOwn(body, 'settledBy') || Object.hasOwn(body, 'decidedBy');
|
|
605
|
+
}
|
|
606
|
+
function withoutAttributionKey(body) {
|
|
607
|
+
const { settledBy: _droppedSettledBy, decidedBy: _droppedDecidedBy, ...rest } = body;
|
|
608
|
+
void _droppedSettledBy;
|
|
609
|
+
void _droppedDecidedBy;
|
|
610
|
+
return rest;
|
|
611
|
+
}
|
|
612
|
+
function withAttributionKeyRenamed(body) {
|
|
613
|
+
const { settledBy, decidedBy: _replaced, ...rest } = body;
|
|
614
|
+
void _replaced;
|
|
615
|
+
return settledBy === undefined ? rest : { ...rest, decidedBy: settledBy };
|
|
616
|
+
}
|
|
617
|
+
function readDecidedByReadingOf(holder) {
|
|
618
|
+
try {
|
|
619
|
+
return readOwnDataValue(holder, 'approvalDecidedBy');
|
|
620
|
+
}
|
|
621
|
+
catch {
|
|
622
|
+
return undefined;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
function decidedByReadingSnapshotOf(holder) {
|
|
626
|
+
return approvalDecidedByAdmitted(readDecidedByReadingOf(holder)) ? Object.freeze({ kind: 'present', value: true }) : undefined;
|
|
627
|
+
}
|
|
560
628
|
export function readToolApprovalRespondRefusal(err) {
|
|
561
629
|
const pick = (key) => {
|
|
562
630
|
try {
|
|
@@ -789,24 +857,8 @@ export function readRuleOffers(v) {
|
|
|
789
857
|
}
|
|
790
858
|
return out.length > 0 ? out : undefined;
|
|
791
859
|
}
|
|
792
|
-
function
|
|
793
|
-
|
|
794
|
-
return undefined;
|
|
795
|
-
if (v.length === 0 || v.length > MAX_RULE_OFFERS_TOLERATED)
|
|
796
|
-
return undefined;
|
|
797
|
-
const out = [];
|
|
798
|
-
for (let i = 0; i < v.length; i++) {
|
|
799
|
-
const triple = readRuleTriple(v[i]);
|
|
800
|
-
if (triple === undefined)
|
|
801
|
-
continue;
|
|
802
|
-
out.push({ kind: 'single', offerIndex: i, ...triple });
|
|
803
|
-
}
|
|
804
|
-
return out.length > 0 ? out : undefined;
|
|
805
|
-
}
|
|
806
|
-
export function readRuleOfferSupply(offers, legacy) {
|
|
807
|
-
if (offers !== undefined && offers !== null)
|
|
808
|
-
return readRuleOffers(offers);
|
|
809
|
-
return readLegacyRuleSuggestions(legacy);
|
|
860
|
+
export function readRuleOfferSupply(offers) {
|
|
861
|
+
return readRuleOffers(offers);
|
|
810
862
|
}
|
|
811
863
|
function subagentBadgeFor(frame) {
|
|
812
864
|
let name = typeof frame.sourceAgentName === 'string' && frame.sourceAgentName.length > 0 ? frame.sourceAgentName : '';
|
|
@@ -830,6 +882,7 @@ const MAX_RESPOND_NOTE_CHARS = 2048;
|
|
|
830
882
|
export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamArgs, signal, lane) {
|
|
831
883
|
const approvalId = frame.approvalId;
|
|
832
884
|
const frameToolCallId = typeof frame.toolCallId === 'string' && frame.toolCallId !== '' ? frame.toolCallId : undefined;
|
|
885
|
+
const decidedByReading = decidedByReadingSnapshotOf(lane);
|
|
833
886
|
const toolName = typeof frame.toolName === 'string' ? frame.toolName : 'Write';
|
|
834
887
|
let args = streamArgs !== undefined && streamArgs !== null
|
|
835
888
|
? streamArgs
|
|
@@ -854,7 +907,7 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
854
907
|
}
|
|
855
908
|
}
|
|
856
909
|
const argsNotRealInput = argsFallback || lane?.argsUnavailable === true;
|
|
857
|
-
const ruleOffers =
|
|
910
|
+
const ruleOffers = readRuleOffers(frame.ruleOffers);
|
|
858
911
|
const denialLimitFallback = readDenialLimitFallback(frame.denialLimitFallback);
|
|
859
912
|
const frameShadow = readAllowRuleShadowFromWire(frame, 'frame');
|
|
860
913
|
const card = await surfaceApprovalCard({
|
|
@@ -912,8 +965,9 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
912
965
|
}
|
|
913
966
|
const decision = card.kind === 'allow' ? (card.allowSession ? 'allow_session' : 'allow') : 'deny';
|
|
914
967
|
const denySettledByForWire = card.kind === 'deny' ? readApprovalDenySettledBy(card) : undefined;
|
|
915
|
-
const
|
|
916
|
-
|
|
968
|
+
const attributionKeys = decision === 'deny' ? decisionAttributionKeyOf(decidedByReading, denySettledByForWire) : {};
|
|
969
|
+
const sentAttributionKey = carriesAttributionKey(attributionKeys);
|
|
970
|
+
let lastSendCarriedAttribution = sentAttributionKey;
|
|
917
971
|
const denyReasonSnapshot = card.kind === 'deny' && typeof card.reason === 'string' ? card.reason : undefined;
|
|
918
972
|
if (card.kind === 'failed') {
|
|
919
973
|
hostLog('debug', `liveToolApprovalWire: approval card unavailable (${card.reason}) — fail-closed deny for ${approvalId}`);
|
|
@@ -940,14 +994,14 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
940
994
|
let persistRuleBatchOfferIndex;
|
|
941
995
|
let batchArmTarget;
|
|
942
996
|
let ruleArmDroppedForCaps = false;
|
|
943
|
-
let ruleArmDroppedForCheck
|
|
997
|
+
let ruleArmDroppedForCheck;
|
|
944
998
|
const wantsTextArm = card.kind === 'allow' && typeof card.persistRule === 'string' && card.persistRule !== '';
|
|
945
999
|
const wantsBatchArm = card.kind === 'allow' && card.persistRuleBatchOfferIndex !== undefined;
|
|
946
1000
|
if (wantsTextArm && wantsBatchArm) {
|
|
947
1001
|
hostLog('error', `liveToolApprovalWire: DROPPING the whole persistRule arm for ${approvalId} — the card returned BOTH a rule ` +
|
|
948
1002
|
'text and a batchOfferIndex; the server rejects that combination with a 400 that would take the decision down ' +
|
|
949
1003
|
'with it, and picking one arm here would be deciding on the user\'s behalf (the decision itself still goes through)');
|
|
950
|
-
ruleArmDroppedForCheck =
|
|
1004
|
+
ruleArmDroppedForCheck = 'both_arms';
|
|
951
1005
|
}
|
|
952
1006
|
else if (card.kind === 'allow' &&
|
|
953
1007
|
card.persistRuleBatchOfferIndex !== undefined &&
|
|
@@ -972,7 +1026,7 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
972
1026
|
hostLog('error', `liveToolApprovalWire: DROPPING persistRuleBatchOfferIndex(${String(idx)}) for ${approvalId} — that wire ` +
|
|
973
1027
|
'index is not a batch offer on this frame (out of range, a single offer, or not a non-negative integer); ' +
|
|
974
1028
|
'never redeeming an index the engine did not offer as a batch');
|
|
975
|
-
ruleArmDroppedForCheck =
|
|
1029
|
+
ruleArmDroppedForCheck = 'index_not_a_batch_offer';
|
|
976
1030
|
}
|
|
977
1031
|
}
|
|
978
1032
|
else if (wantsTextArm && card.kind === 'allow' && typeof card.persistRule === 'string' && decision !== 'deny') {
|
|
@@ -994,7 +1048,7 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
994
1048
|
}
|
|
995
1049
|
else {
|
|
996
1050
|
hostLog('error', `liveToolApprovalWire: DROPPING persistRule for ${approvalId} — the card returned a rule that is not among the frame's SINGLE offers (a batch member's text is not a selectable candidate either: a conjunction batch is redeemed by index, all-or-nothing) — never sending un-offered text to the rule store`);
|
|
997
|
-
ruleArmDroppedForCheck =
|
|
1051
|
+
ruleArmDroppedForCheck = 'text_not_offered';
|
|
998
1052
|
}
|
|
999
1053
|
}
|
|
1000
1054
|
const respondOpts = {
|
|
@@ -1004,24 +1058,48 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
1004
1058
|
...(persistRuleEdited !== undefined ? { persistRuleEdited } : {}),
|
|
1005
1059
|
...(persistRuleBatchOfferIndex !== undefined ? { persistRuleBatchOfferIndex } : {}),
|
|
1006
1060
|
...(note !== undefined ? { note } : {}),
|
|
1007
|
-
...
|
|
1061
|
+
...attributionKeys,
|
|
1008
1062
|
};
|
|
1009
1063
|
let attributionDropped = false;
|
|
1064
|
+
let attributionRenamed = false;
|
|
1010
1065
|
let raw;
|
|
1011
1066
|
try {
|
|
1012
1067
|
raw = await respond(approvalId, decision, respondOpts);
|
|
1013
1068
|
}
|
|
1014
1069
|
catch (first) {
|
|
1015
|
-
if (
|
|
1070
|
+
if (shouldResendWithoutAttribution(first, lastSendCarriedAttribution, signal)) {
|
|
1071
|
+
const withoutAttribution = withoutAttributionKey(respondOpts);
|
|
1072
|
+
lastSendCarriedAttribution = false;
|
|
1073
|
+
hostLog('debug', `liveToolApprovalWire: respond(deny) for ${approvalId} was refused because the settlement note is not part of ` +
|
|
1074
|
+
'what this deployment signs — re-sending the SAME decision exactly once with that one key removed ' +
|
|
1075
|
+
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
1076
|
+
raw = await respond(approvalId, decision, withoutAttribution);
|
|
1077
|
+
attributionDropped = true;
|
|
1078
|
+
}
|
|
1079
|
+
else if (shouldResendUnderSuccessorKey(first, Object.hasOwn(respondOpts, 'settledBy'), signal)) {
|
|
1080
|
+
const renamed = withAttributionKeyRenamed(respondOpts);
|
|
1081
|
+
hostLog('debug', `liveToolApprovalWire: respond(deny) for ${approvalId} was refused because the settlement note was sent under a name ` +
|
|
1082
|
+
'this engine has retired — re-sending the SAME decision exactly once with that one key renamed to the name the refusal points to ' +
|
|
1083
|
+
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
1084
|
+
try {
|
|
1085
|
+
raw = await respond(approvalId, decision, renamed);
|
|
1086
|
+
attributionRenamed = true;
|
|
1087
|
+
}
|
|
1088
|
+
catch (second) {
|
|
1089
|
+
if (!shouldResendWithoutAttribution(second, true, signal))
|
|
1090
|
+
throw second;
|
|
1091
|
+
const renamedWithoutAttribution = withoutAttributionKey(renamed);
|
|
1092
|
+
lastSendCarriedAttribution = false;
|
|
1093
|
+
hostLog('debug', `liveToolApprovalWire: respond(deny) for ${approvalId} was refused again because the settlement note is not part of ` +
|
|
1094
|
+
'what this deployment signs — re-sending the SAME decision exactly once more with that key removed ' +
|
|
1095
|
+
'(still before the approval was judged)');
|
|
1096
|
+
raw = await respond(approvalId, decision, renamedWithoutAttribution);
|
|
1097
|
+
attributionDropped = true;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
else {
|
|
1016
1101
|
throw first;
|
|
1017
|
-
|
|
1018
|
-
void _droppedKey;
|
|
1019
|
-
lastSendCarriedAttribution = false;
|
|
1020
|
-
hostLog('debug', `liveToolApprovalWire: respond(deny) for ${approvalId} was refused because the settlement note is not part of ` +
|
|
1021
|
-
'what this deployment signs — re-sending the SAME decision exactly once with that one key removed ' +
|
|
1022
|
-
'(the refusal happened before the approval was judged, so nothing was consumed and this is a re-delivery, not a second act)');
|
|
1023
|
-
raw = await respond(approvalId, decision, withoutAttribution);
|
|
1024
|
-
attributionDropped = true;
|
|
1102
|
+
}
|
|
1025
1103
|
}
|
|
1026
1104
|
const parsed = readToolApprovalRespondAck(raw);
|
|
1027
1105
|
let ack = parsed;
|
|
@@ -1077,8 +1155,8 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
1077
1155
|
}
|
|
1078
1156
|
if (ruleArmDroppedForCaps)
|
|
1079
1157
|
surfaceRuleArmNotSent();
|
|
1080
|
-
if (ruleArmDroppedForCheck)
|
|
1081
|
-
surfaceRuleArmRejected();
|
|
1158
|
+
if (ruleArmDroppedForCheck !== undefined)
|
|
1159
|
+
surfaceRuleArmRejected(ruleArmDroppedForCheck);
|
|
1082
1160
|
if (decision === 'allow_session' && ack?.rememberApplied === false) {
|
|
1083
1161
|
logAfterDecided(`liveToolApprovalWire: ${approvalId} allow_session ack rememberApplied=false — grant not stored, surfacing honest notice`);
|
|
1084
1162
|
surfaceRememberNotApplied();
|
|
@@ -1094,6 +1172,7 @@ export async function surfaceToolApprovalFrameAndRespond(frame, respond, streamA
|
|
|
1094
1172
|
const denyAttribution = decision === 'deny'
|
|
1095
1173
|
? {
|
|
1096
1174
|
...(attributionDropped ? { denyAttributionDropped: true } : {}),
|
|
1175
|
+
...(attributionRenamed ? { denyAttributionRenamed: true } : {}),
|
|
1097
1176
|
...(denySettledByForWire !== undefined ? { denySettledBy: denySettledByForWire } : {}),
|
|
1098
1177
|
...(denyReasonSnapshot !== undefined && denyReasonSnapshot.trim() !== ''
|
|
1099
1178
|
? { denyReason: denyReasonSnapshot }
|
package/dist/hooksWireCaps.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HooksWirePlan, type HooksWirePlanOptions } from './pluginHooksWire.js';
|
|
2
2
|
import { type HookFailureNotice } from './notifications.js';
|
|
3
3
|
import type { WireHooksConfig } from './finalVerifyWire.js';
|
|
4
|
-
export { GOAL_STOP_HOOK_WIRE_ENV,
|
|
4
|
+
export { GOAL_STOP_HOOK_WIRE_ENV, isGoalStopHookWireArmed, setWireSessionStopHook, getWireSessionStopHook, } from './goalStopHook.js';
|
|
5
5
|
export type { WireHooksConfig };
|
|
6
6
|
export interface HooksForWireOptions {
|
|
7
7
|
readonly plan?: HooksWirePlan;
|
package/dist/hooksWireCaps.js
CHANGED
|
@@ -5,7 +5,7 @@ import { hostLog, hostSettings } from './host.js';
|
|
|
5
5
|
import { createSettingsHookJudge, decidePluginHooks, dedupeSettingsHookGroups, filterSettingsHookGroups, occupancyOf, settingsHookDropText, } from './pluginHooksWire.js';
|
|
6
6
|
import { MAX_HOOK_NOTICE_TEXT_CHARS } from './notifications.js';
|
|
7
7
|
import { goalStopHookMatcher, __resetGoalStopHookForTests } from './goalStopHook.js';
|
|
8
|
-
export { GOAL_STOP_HOOK_WIRE_ENV,
|
|
8
|
+
export { GOAL_STOP_HOOK_WIRE_ENV, isGoalStopHookWireArmed, setWireSessionStopHook, getWireSessionStopHook, } from './goalStopHook.js';
|
|
9
9
|
const EDITABLE_HOOK_SOURCES = ['userSettings', 'projectSettings', 'localSettings'];
|
|
10
10
|
const ALL_HOOK_SOURCES = ['policySettings', ...EDITABLE_HOOK_SOURCES, 'flagSettings'];
|
|
11
11
|
const _hookSourceListsPin = [true, true];
|
package/dist/index.d.ts
CHANGED
|
@@ -55,11 +55,16 @@ export * from './workflowsJournalCapability.js';
|
|
|
55
55
|
export * from './userInvokedSkillsCapability.js';
|
|
56
56
|
export * from './skillToolListsCapability.js';
|
|
57
57
|
export * from './steerPriorityCapability.js';
|
|
58
|
+
export * from './permissionModesCapability.js';
|
|
59
|
+
export * from './approvalDecidedByCapability.js';
|
|
58
60
|
export * from './mcpProbeWire.js';
|
|
59
61
|
export * from './effectiveFacts.js';
|
|
60
62
|
export * from './gateOutcome.js';
|
|
61
63
|
export * from './postureKnob.js';
|
|
62
64
|
export * from './engineIdentity.js';
|
|
65
|
+
export { transportFailureScene } from './engineWireFor.js';
|
|
66
|
+
export type { EngineWireNoAnswerKind, TransportFailureChainEnd, TransportFailureLayer, TransportFailureScene, TransportFailureSocket } from './engineWireFor.js';
|
|
67
|
+
export * from './engineConfigDrift.js';
|
|
63
68
|
export * from './gateVocabulary.js';
|
|
64
69
|
export * from './permissionRuleIssue.js';
|
|
65
70
|
export * from './toolRoster.js';
|
|
@@ -81,7 +86,7 @@ export * from './engineWireSdk.js';
|
|
|
81
86
|
export * from './classifierVerdictWire.js';
|
|
82
87
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
83
88
|
export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
|
|
84
|
-
export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, 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, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, 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, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, 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, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
89
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, 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, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, 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, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, 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, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
85
90
|
export type { DelegationCapDisposition, ModelFallbackReason, OperatorGateRefusal, RunDeathVerdictCode, } from './engineErrorCodes.js';
|
|
86
91
|
export * from './agentsWireCaps.js';
|
|
87
92
|
export * from './attachmentsWireCaps.js';
|
|
@@ -177,7 +182,7 @@ export type { AttachmentSeatReading } from './attachmentSeatCapability.js';
|
|
|
177
182
|
export * from './resumeRefusalCopy.js';
|
|
178
183
|
export * from './wireRefusalCopy.js';
|
|
179
184
|
export * from './inheritEnvWire.js';
|
|
180
|
-
export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier } from './supportFloor.js';
|
|
185
|
+
export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier, coreVersionTier } from './supportFloor.js';
|
|
181
186
|
export type { SupportFloor, SupportFloorComponent, EngineVersionTier } from './supportFloor.js';
|
|
182
187
|
export * from './decideReceipt.js';
|
|
183
188
|
export * from './sessionMap.js';
|
package/dist/index.js
CHANGED
|
@@ -49,11 +49,15 @@ export * from './workflowsJournalCapability.js';
|
|
|
49
49
|
export * from './userInvokedSkillsCapability.js';
|
|
50
50
|
export * from './skillToolListsCapability.js';
|
|
51
51
|
export * from './steerPriorityCapability.js';
|
|
52
|
+
export * from './permissionModesCapability.js';
|
|
53
|
+
export * from './approvalDecidedByCapability.js';
|
|
52
54
|
export * from './mcpProbeWire.js';
|
|
53
55
|
export * from './effectiveFacts.js';
|
|
54
56
|
export * from './gateOutcome.js';
|
|
55
57
|
export * from './postureKnob.js';
|
|
56
58
|
export * from './engineIdentity.js';
|
|
59
|
+
export { transportFailureScene } from './engineWireFor.js';
|
|
60
|
+
export * from './engineConfigDrift.js';
|
|
57
61
|
export * from './gateVocabulary.js';
|
|
58
62
|
export * from './permissionRuleIssue.js';
|
|
59
63
|
export * from './toolRoster.js';
|
|
@@ -73,7 +77,7 @@ export * from './engineWireSdk.js';
|
|
|
73
77
|
export * from './classifierVerdictWire.js';
|
|
74
78
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
75
79
|
export { findSystemReminderOpenTag } from './systemReminderTag.js';
|
|
76
|
-
export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, DECIDE_WORKFLOW_HOST_UNKNOWN, DECIDE_WORKFLOW_LANE_CODES, 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, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, 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, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, 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, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
80
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, APPROVAL_EXPIRED, ASK_GONE, asModelFallbackReason, CAPABILITY_OPERATOR_PRINCIPALS_REQUIRED, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, CONFIG_IMAGE_INVALID, CONFIG_LEGACY_TOOL_NAME, CONFIG_LIMIT_INVALID, CONFIG_LIMIT_UNKNOWN_KEY, CONFIG_MEMORY_PROJECT_KEY_SPELLING, CONFIG_MEMORY_WRITE_SCOPE_MISMATCH, CONFIG_REFUSAL_CODES, CONFIG_STRATEGY_FIND_LIMIT_INVALID, CONFIG_STRATEGY_MAX_SIZE_INVALID, CORRUPT_SESSION_ERROR_CODE, DECIDE_CLAIM_LOST, DECIDE_GATE_MOVED, DECIDE_NOT_PARKED, DECIDE_PARK_MOVED_CODES, 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, imageInvalidFailureNoteOf, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, 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, MODEL_FALLBACK_INHERIT_NO_TIER_BINDING, operatorGateRefusalContent, OUTPUT_INVALID, PARKED_RESUME_STARTUP_FAILED, 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, RULES_LEGACY_TOOL_NAME, RUN_DEATH_VERDICT_CODES, RUN_ORPHANED, RUN_STALLED, runDeathVerdictNoteOf, SCENARIO_ASSIGNMENT_UNKNOWN_ERROR_CODE, SCENARIO_NOT_ALLOWED_ERROR_CODE, STATUS_DERIVED_COARSE_CODES, STOP_CONFLICT_CODES, STREAM_MAX_DURATION, TOOL_END_INTERRUPTED_NEVER_STARTED, TOOL_END_INTERRUPTED_OUTCOME_UNKNOWN, USAGE_WINDOW_EXHAUSTED, WORKFLOW_PARK_REFUSAL_CODES, } from './engineErrorCodes.js';
|
|
77
81
|
export * from './agentsWireCaps.js';
|
|
78
82
|
export * from './attachmentsWireCaps.js';
|
|
79
83
|
export * from './clientContextWireCaps.js';
|
|
@@ -155,7 +159,7 @@ export { noteEngineCapsForAttachmentSeat, observedAttachmentSeat, forgetAttachme
|
|
|
155
159
|
export * from './resumeRefusalCopy.js';
|
|
156
160
|
export * from './wireRefusalCopy.js';
|
|
157
161
|
export * from './inheritEnvWire.js';
|
|
158
|
-
export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier } from './supportFloor.js';
|
|
162
|
+
export { SUPPORT_FLOOR, supportFloorOf, engineVersionTier, coreVersionTier } from './supportFloor.js';
|
|
159
163
|
export * from './decideReceipt.js';
|
|
160
164
|
export * from './sessionMap.js';
|
|
161
165
|
export * from './detachWire.js';
|
package/dist/inheritEnvWire.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { type InheritEnvWord, type TaskRequestLike } from './request/taskRequest.js';
|
|
2
|
-
export
|
|
3
|
-
export type InheritEnvServerSupport = 'supported' | 'unsupported' | 'unknown';
|
|
4
|
-
export declare function inheritEnvServerSupport(version: string | undefined): InheritEnvServerSupport;
|
|
5
|
-
export type InheritEnvWithheldCause = 'server_version_unknown' | 'server_too_old';
|
|
2
|
+
export type InheritEnvWithheldCause = 'server_version_unknown';
|
|
6
3
|
export interface InheritEnvWithheld {
|
|
7
4
|
readonly cause: InheritEnvWithheldCause;
|
|
8
5
|
readonly word: InheritEnvWord;
|
package/dist/inheritEnvWire.js
CHANGED
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import { INHERIT_ENV_WORDS, isInheritEnvWord } from './request/taskRequest.js';
|
|
2
2
|
import { settingsPermissionBucketRefusalFromError } from './wireRefusalCopy.js';
|
|
3
3
|
import { engineVersionTier } from './supportFloor.js';
|
|
4
|
-
export const INHERIT_ENV_MIN_SERVER = Object.freeze([7, 106, 0]);
|
|
5
|
-
export function inheritEnvServerSupport(version) {
|
|
6
|
-
const mm = typeof version === 'string' ? /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.exec(version) : null;
|
|
7
|
-
if (!mm)
|
|
8
|
-
return 'unknown';
|
|
9
|
-
const got = [Number(mm[1]), Number(mm[2]), Number(mm[3])];
|
|
10
|
-
for (let i = 0; i < 3; i++) {
|
|
11
|
-
const g = got[i];
|
|
12
|
-
const need = INHERIT_ENV_MIN_SERVER[i];
|
|
13
|
-
if (g !== need)
|
|
14
|
-
return g > need ? 'supported' : 'unsupported';
|
|
15
|
-
}
|
|
16
|
-
return 'supported';
|
|
17
|
-
}
|
|
18
4
|
const EMPTY_DECLARATION = Object.freeze({ field: Object.freeze({}) });
|
|
19
5
|
export function inheritEnvDeclaration(word, serverVersion) {
|
|
20
6
|
if (word === undefined || word === null)
|
|
@@ -27,10 +13,6 @@ export function inheritEnvDeclaration(word, serverVersion) {
|
|
|
27
13
|
return Object.freeze({ field: Object.freeze({}), withheld: Object.freeze({ cause: 'server_version_unknown', word }) });
|
|
28
14
|
}
|
|
29
15
|
const WITHHELD_NOTICES = Object.freeze({
|
|
30
|
-
server_too_old: Object.freeze({
|
|
31
|
-
all: "Not sent with this request: this engine is too old to accept the setting that lets the shell inherit this machine's whole environment, so this run's shell gets the default environment, with credential-like variables removed.",
|
|
32
|
-
scrub: 'Not sent with this request: this engine is too old to accept the default-environment setting, so it was left out; that has the same effect, because the default environment (credential-like variables removed) is what this run gets anyway.',
|
|
33
|
-
}),
|
|
34
16
|
server_version_unknown: Object.freeze({
|
|
35
17
|
all: "Not sent with this request: the engine's version is not known yet, and an engine that does not know the setting that lets the shell inherit this machine's whole environment refuses the whole request, so it was held back; this run's shell gets the default environment, with credential-like variables removed, and on an engine that does know the setting, leaving it out also clears an earlier whole-environment choice for this session.",
|
|
36
18
|
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).",
|