@sema-agent/client-core 0.91.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 +351 -0
- package/README.md +51 -34
- package/dist/adapt/arms.js +6 -12
- package/dist/adapt/panelTasks.d.ts +0 -2
- package/dist/adapt/panelTasks.js +6 -26
- package/dist/adapt/toolCards.js +6 -4
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +3 -3
- package/dist/adapter/activeRunSelfHeal.d.ts +0 -2
- package/dist/adapter/activeRunSelfHeal.js +5 -27
- package/dist/adapter/downstream/terminalToSdkResult.js +16 -7
- package/dist/adapter/runStream.js +6 -2
- 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 +4 -1
- package/dist/askSurvivesStandingAnswer.js +13 -0
- package/dist/autoModeUnavailable.js +3 -2
- package/dist/centerWiringCapability.js +1 -1
- package/dist/cloudConfigWireCaps.js +10 -9
- package/dist/compensations.js +7 -7
- package/dist/controlRouter.d.ts +23 -23
- package/dist/controlRouter.js +114 -49
- package/dist/coreValuePorts.d.ts +4 -2
- package/dist/coreValuePorts.js +5 -0
- package/dist/decideFailureNote.js +4 -2
- package/dist/decideReceipt.d.ts +11 -0
- package/dist/decideReceipt.js +95 -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/displayUntrusted.js +2 -1
- package/dist/effectiveFacts.d.ts +14 -4
- package/dist/effectiveFacts.js +45 -5
- package/dist/engineAgentAbsence.js +2 -1
- package/dist/engineCapReader.js +16 -10
- package/dist/engineCapsCache.d.ts +2 -0
- package/dist/engineCapsCache.js +13 -2
- package/dist/engineConfigDrift.d.ts +20 -0
- package/dist/engineConfigDrift.js +54 -0
- package/dist/engineErrorCodes.d.ts +17 -0
- package/dist/engineErrorCodes.js +45 -0
- package/dist/engineInlineTaskStats.d.ts +1 -0
- package/dist/engineNoticeCodes.d.ts +16 -2
- package/dist/engineNoticeCodes.js +71 -0
- 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 +4 -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/gateOutcome.js +2 -17
- package/dist/gateVocabulary.d.ts +2 -8
- package/dist/gateVocabulary.js +6 -32
- package/dist/generated/engineFactTables.d.ts +17 -1
- package/dist/generated/engineFactTables.js +91 -0
- package/dist/generated/engineNoticeTables.d.ts +1 -1
- package/dist/generated/engineNoticeTables.js +4 -1
- package/dist/generated/settingsSchemaTables.d.ts +8 -0
- package/dist/generated/settingsSchemaTables.js +40 -0
- 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/allowRuleShadow.d.ts +21 -0
- package/dist/hitl/allowRuleShadow.js +167 -0
- package/dist/hitl/askClassPair.d.ts +14 -0
- package/dist/hitl/askClassPair.js +42 -0
- package/dist/hitl/askGateWire.js +1 -0
- package/dist/hitl/askParkRowRouting.js +2 -2
- package/dist/hitl/askSurvivesPosture.d.ts +5 -0
- package/dist/hitl/askSurvivesPosture.js +17 -0
- package/dist/hitl/automaticAnswerVerdict.d.ts +21 -0
- package/dist/hitl/automaticAnswerVerdict.js +143 -0
- package/dist/hitl/crashConverged.d.ts +1 -0
- package/dist/hitl/crashConverged.js +1 -1
- package/dist/hitl/frameRouter.d.ts +2 -0
- package/dist/hitl/frameRouter.js +73 -16
- package/dist/hitl/gateLedger.d.ts +7 -0
- package/dist/hitl/gateLedger.js +37 -5
- package/dist/hitl/hitlBridge.d.ts +1 -0
- package/dist/hitl/hitlBridge.js +6 -1
- package/dist/hitl/hitlHostSurface.d.ts +5 -2
- package/dist/hitl/hitlHostSurface.js +25 -3
- package/dist/hitl/livePendingAsk.js +24 -5
- package/dist/hitl/parkResolver.js +24 -4
- package/dist/hitl/persistedRulesWire.d.ts +4 -1
- package/dist/hitl/persistedRulesWire.js +38 -19
- package/dist/hitl/planReviewWire.d.ts +0 -2
- package/dist/hitl/planReviewWire.js +3 -20
- package/dist/hitl/replayedApproval.d.ts +21 -0
- package/dist/hitl/replayedApproval.js +89 -0
- package/dist/hitl/sessionPolicyDeliverable.js +20 -2
- package/dist/hitl/sessionPolicyWire.d.ts +10 -0
- package/dist/hitl/sessionPolicyWire.js +19 -6
- package/dist/hitl/toolApprovalWire.d.ts +27 -7
- package/dist/hitl/toolApprovalWire.js +153 -94
- package/dist/hookMatcherVerdict.js +2 -1
- package/dist/hooksWireCaps.d.ts +1 -1
- package/dist/hooksWireCaps.js +1 -1
- package/dist/humanTurn.js +3 -4
- package/dist/index.d.ts +21 -6
- package/dist/index.js +17 -4
- package/dist/inheritEnvWire.d.ts +1 -4
- package/dist/inheritEnvWire.js +3 -22
- package/dist/limitsWire.d.ts +0 -6
- package/dist/limitsWire.js +0 -38
- package/dist/mcpLiveness.js +2 -1
- 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.d.ts +1 -1
- package/dist/memoryVerbsWire.js +17 -13
- package/dist/model/catalog.js +2 -1
- package/dist/model/providerPresets.d.ts +3 -1
- package/dist/model/tierVocabulary.d.ts +2 -1
- package/dist/model/tierVocabulary.js +3 -8
- package/dist/ownKey.d.ts +2 -0
- package/dist/ownKey.js +15 -0
- package/dist/peerFrames.js +2 -2
- package/dist/peerLaneCapability.js +2 -2
- package/dist/permissionModesCapability.d.ts +16 -0
- package/dist/permissionModesCapability.js +71 -0
- package/dist/permissionRuleIssue.js +10 -7
- 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/permissionsDeclaration.d.ts +7 -1
- package/dist/permissionsDeclaration.js +29 -20
- package/dist/pluginHooksWire.js +2 -11
- package/dist/postureKnob.js +1 -1
- package/dist/promptProfileWireCaps.d.ts +2 -1
- package/dist/protocolSegment.d.ts +11 -0
- package/dist/protocolSegment.js +31 -0
- package/dist/readFacePosture.js +1 -1
- package/dist/request/taskRequest.js +1 -15
- 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/ruleCompileVerdict.d.ts +2 -0
- package/dist/ruleCompileVerdict.js +13 -0
- package/dist/ruleRemovalConsequence.d.ts +2 -1
- package/dist/runCancelContext.d.ts +12 -0
- package/dist/runCancelContext.js +83 -1
- package/dist/runTerminal.d.ts +16 -0
- package/dist/runTerminal.js +32 -3
- package/dist/seam.d.ts +1 -0
- package/dist/seam.js +1 -1
- package/dist/seatContract.d.ts +2 -1
- package/dist/sessionMemoryStatus.d.ts +2 -4
- package/dist/sessionPolicyCapability.js +1 -1
- package/dist/sessionSyncFileHistoryCapability.d.ts +18 -0
- package/dist/sessionSyncFileHistoryCapability.js +50 -0
- package/dist/skillToolListsCapability.d.ts +18 -0
- package/dist/skillToolListsCapability.js +50 -0
- package/dist/sqlEngineCapability.js +2 -9
- package/dist/steerPriorityCapability.d.ts +18 -0
- package/dist/steerPriorityCapability.js +80 -0
- package/dist/steerReceipt.d.ts +9 -0
- package/dist/steerReceipt.js +25 -0
- package/dist/storePostureCapability.js +2 -2
- package/dist/subagent/engineSubagentSteer.js +2 -9
- package/dist/supportFloor.d.ts +1 -0
- package/dist/supportFloor.js +15 -5
- package/dist/taskRequestWords.d.ts +4 -2
- package/dist/taskRequestWords.js +1 -1
- package/dist/toolHistoryBadTurn.js +1 -2
- package/dist/toolResult.d.ts +10 -1
- package/dist/toolResult.js +80 -6
- package/dist/types/engineState.d.ts +2 -12
- package/dist/userInvokedSkillsCapability.d.ts +18 -0
- package/dist/userInvokedSkillsCapability.js +50 -0
- package/dist/webSearchBackendCapability.js +2 -2
- package/dist/webSearchWireCaps.d.ts +1 -1
- package/dist/webSearchWireCaps.js +40 -2
- package/dist/wireFailureShape.d.ts +2 -0
- package/dist/wireFailureShape.js +6 -2
- package/dist/wireRefusalCopy.d.ts +9 -3
- package/dist/wireRefusalCopy.js +41 -4
- package/dist/workflowsJournalCapability.d.ts +18 -0
- package/dist/workflowsJournalCapability.js +50 -0
- package/dist/writeProtectionCapability.d.ts +2 -4
- package/dist/writeProtectionCapability.js +1 -1
- package/docs/INTEGRATION-CLIENTS.md +1516 -18
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CORE_TOOL_TURN_INCOMPLETE_CAUSES,
|
|
1
|
+
import { CORE_TOOL_TURN_INCOMPLETE_CAUSES, CORE_USER_INPUT_UNDRAINED_CAUSES } from './generated/engineNoticeTables.js';
|
|
2
2
|
export type NoticeAudience = 'user' | 'operator';
|
|
3
3
|
export declare const ENGINE_NOTICE_CODES: readonly string[];
|
|
4
4
|
export declare function engineNoticeInCatalog(code: unknown): boolean;
|
|
@@ -157,7 +157,7 @@ export interface ToolTurnIncompleteFactsView {
|
|
|
157
157
|
runId: string;
|
|
158
158
|
}
|
|
159
159
|
export declare function readToolTurnIncomplete(notice: unknown): ToolTurnIncompleteFactsView | undefined;
|
|
160
|
-
export type UserSteerUndrainedCause = (typeof
|
|
160
|
+
export type UserSteerUndrainedCause = (typeof CORE_USER_INPUT_UNDRAINED_CAUSES)[number];
|
|
161
161
|
export interface UserInputUndrainedFactsView {
|
|
162
162
|
kind: 'steer' | 'followUp';
|
|
163
163
|
count: number;
|
|
@@ -169,6 +169,19 @@ export interface UserInputUndrainedFactsView {
|
|
|
169
169
|
}
|
|
170
170
|
export declare function readUserInputUndrained(notice: unknown): UserInputUndrainedFactsView | undefined;
|
|
171
171
|
export declare function userInputUndrainedNotice(facts: Pick<UserInputUndrainedFactsView, 'kind' | 'count' | 'cause' | 'childSessionId'>): string | undefined;
|
|
172
|
+
export interface TurnInterruptedFactsView {
|
|
173
|
+
lane: 'input_now' | 'user_halt' | 'unrecognized';
|
|
174
|
+
inputId?: string;
|
|
175
|
+
cause?: string;
|
|
176
|
+
sessionId?: string;
|
|
177
|
+
runId?: string;
|
|
178
|
+
taskId?: string;
|
|
179
|
+
actorId?: string;
|
|
180
|
+
}
|
|
181
|
+
export declare function readTurnInterrupted(notice: unknown): TurnInterruptedFactsView | undefined;
|
|
182
|
+
export declare function turnInterruptedNotice(facts: Pick<TurnInterruptedFactsView, 'lane'>): string | undefined;
|
|
183
|
+
export type SteerCutVerdict = 'this_input' | 'other_input' | 'user_halt' | 'unattributed' | 'not_a_cut';
|
|
184
|
+
export declare function steerCutVerdict(notice: unknown, messageId: string | undefined): SteerCutVerdict;
|
|
172
185
|
export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
|
|
173
186
|
readonly 'mcp.injection_dropped': typeof readMcpInjectionDrop;
|
|
174
187
|
readonly 'delegation.ask_unresolvable': typeof readAskUnresolvable;
|
|
@@ -189,6 +202,7 @@ export declare const ENGINE_NOTICE_FACT_READERS: Readonly<{
|
|
|
189
202
|
readonly 'task.tool_turn_incomplete': typeof readToolTurnIncomplete;
|
|
190
203
|
readonly 'task.user_steer_undrained': typeof readUserInputUndrained;
|
|
191
204
|
readonly 'task.user_followup_undrained': typeof readUserInputUndrained;
|
|
205
|
+
readonly 'task.turn_interrupted': typeof readTurnInterrupted;
|
|
192
206
|
}>;
|
|
193
207
|
type FactReaderTable = typeof ENGINE_NOTICE_FACT_READERS;
|
|
194
208
|
export type EngineNoticeFactsCode = keyof FactReaderTable;
|
|
@@ -643,6 +643,76 @@ export function userInputUndrainedNotice(facts) {
|
|
|
643
643
|
}
|
|
644
644
|
return unrecognizedUndrainedSentence(n, kind);
|
|
645
645
|
}
|
|
646
|
+
export function readTurnInterrupted(notice) {
|
|
647
|
+
return guardedRead(notice, readTurnInterruptedOf);
|
|
648
|
+
}
|
|
649
|
+
function readTurnInterruptedOf(notice) {
|
|
650
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
651
|
+
return undefined;
|
|
652
|
+
const n = notice;
|
|
653
|
+
if (ownSeat(n, 'code') !== 'task.turn_interrupted')
|
|
654
|
+
return undefined;
|
|
655
|
+
const d = ownSeat(n, 'detail');
|
|
656
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
657
|
+
return undefined;
|
|
658
|
+
const o = d;
|
|
659
|
+
const causeRaw = ownSeat(o, 'cause');
|
|
660
|
+
const cause = nonEmpty(causeRaw);
|
|
661
|
+
const inputId = nonEmpty(ownSeat(o, 'inputId'));
|
|
662
|
+
const lane = causeRaw === undefined && inputId !== undefined ? 'input_now' : cause === 'user_halt' ? 'user_halt' : 'unrecognized';
|
|
663
|
+
const sessionId = nonEmpty(optionalOwnSeat(o, 'sessionId'));
|
|
664
|
+
const runId = nonEmpty(optionalOwnSeat(o, 'runId'));
|
|
665
|
+
const taskId = nonEmpty(optionalOwnSeat(o, 'taskId'));
|
|
666
|
+
const actorId = nonEmpty(optionalOwnSeat(o, 'actorId'));
|
|
667
|
+
return {
|
|
668
|
+
lane,
|
|
669
|
+
...(lane === 'input_now' && inputId !== undefined ? { inputId } : {}),
|
|
670
|
+
...(cause !== undefined ? { cause } : {}),
|
|
671
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
672
|
+
...(runId !== undefined ? { runId } : {}),
|
|
673
|
+
...(taskId !== undefined ? { taskId } : {}),
|
|
674
|
+
...(actorId !== undefined ? { actorId } : {}),
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
const TURN_INTERRUPTED_SENTENCE = Object.freeze({
|
|
678
|
+
input_now: 'Your message interrupted the running turn — tool calls that had already finished keep their results, and the run continues with your message first.',
|
|
679
|
+
user_halt: 'You stopped the run — the running turn was cut, and tool calls that had already finished keep their results.',
|
|
680
|
+
unrecognized: 'A running turn was cut for a reason this version does not recognise — tool calls that had already finished keep their results.',
|
|
681
|
+
});
|
|
682
|
+
export function turnInterruptedNotice(facts) {
|
|
683
|
+
try {
|
|
684
|
+
if (facts === null || typeof facts !== 'object' || Array.isArray(facts) || !Object.hasOwn(facts, 'lane'))
|
|
685
|
+
return undefined;
|
|
686
|
+
const lane = facts.lane;
|
|
687
|
+
return typeof lane === 'string' && Object.hasOwn(TURN_INTERRUPTED_SENTENCE, lane)
|
|
688
|
+
? TURN_INTERRUPTED_SENTENCE[lane]
|
|
689
|
+
: undefined;
|
|
690
|
+
}
|
|
691
|
+
catch {
|
|
692
|
+
return undefined;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
export function steerCutVerdict(notice, messageId) {
|
|
696
|
+
let code;
|
|
697
|
+
try {
|
|
698
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
699
|
+
return 'not_a_cut';
|
|
700
|
+
code = ownSeat(notice, 'code');
|
|
701
|
+
}
|
|
702
|
+
catch {
|
|
703
|
+
return 'not_a_cut';
|
|
704
|
+
}
|
|
705
|
+
if (code !== 'task.turn_interrupted')
|
|
706
|
+
return 'not_a_cut';
|
|
707
|
+
const facts = readTurnInterrupted(notice);
|
|
708
|
+
if (facts === undefined || facts.lane === 'unrecognized')
|
|
709
|
+
return 'unattributed';
|
|
710
|
+
if (facts.lane === 'user_halt')
|
|
711
|
+
return 'user_halt';
|
|
712
|
+
if (typeof messageId !== 'string' || messageId.length === 0 || facts.inputId === undefined)
|
|
713
|
+
return 'unattributed';
|
|
714
|
+
return facts.inputId === messageId ? 'this_input' : 'other_input';
|
|
715
|
+
}
|
|
646
716
|
export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
647
717
|
'mcp.injection_dropped': readMcpInjectionDrop,
|
|
648
718
|
'delegation.ask_unresolvable': readAskUnresolvable,
|
|
@@ -663,6 +733,7 @@ export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
|
663
733
|
'task.tool_turn_incomplete': readToolTurnIncomplete,
|
|
664
734
|
'task.user_steer_undrained': readUserInputUndrained,
|
|
665
735
|
'task.user_followup_undrained': readUserInputUndrained,
|
|
736
|
+
'task.turn_interrupted': readTurnInterrupted,
|
|
666
737
|
});
|
|
667
738
|
const _factReaderTablePin = true;
|
|
668
739
|
void _factReaderTablePin;
|
package/dist/engineWireFor.d.ts
CHANGED
|
@@ -41,4 +41,26 @@ export declare function noAnswerKindOf(e: object | null | undefined): EngineWire
|
|
|
41
41
|
export declare function noAnswerDetailFrom(e: object | null | undefined): string | null;
|
|
42
42
|
export declare function sendOnce<T>(signal: AbortSignal | null | undefined, run: () => Promise<T>): Promise<T>;
|
|
43
43
|
export declare function provablyNotSent(e: object | null | undefined): boolean;
|
|
44
|
+
export interface TransportFailureSocket {
|
|
45
|
+
readonly localPort?: number;
|
|
46
|
+
readonly remotePort?: number;
|
|
47
|
+
readonly bytesWritten?: number;
|
|
48
|
+
readonly bytesRead?: number;
|
|
49
|
+
}
|
|
50
|
+
export interface TransportFailureLayer {
|
|
51
|
+
readonly name?: string;
|
|
52
|
+
readonly code?: string;
|
|
53
|
+
readonly errno?: number;
|
|
54
|
+
readonly syscall?: string;
|
|
55
|
+
readonly socket?: TransportFailureSocket;
|
|
56
|
+
}
|
|
57
|
+
export type TransportFailureChainEnd = 'complete' | 'depth_cap' | 'cycle' | 'unreadable';
|
|
58
|
+
export interface TransportFailureScene {
|
|
59
|
+
readonly layers: ReadonlyArray<TransportFailureLayer>;
|
|
60
|
+
readonly end: TransportFailureChainEnd;
|
|
61
|
+
readonly status?: number;
|
|
62
|
+
readonly provablyNotSent: boolean;
|
|
63
|
+
readonly noAnswer: EngineWireNoAnswerKind | null;
|
|
64
|
+
}
|
|
65
|
+
export declare function transportFailureScene(error: unknown): TransportFailureScene;
|
|
44
66
|
export declare function settleInjected<T>(ms: number, signal: AbortSignal | null | undefined, run: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
package/dist/engineWireFor.js
CHANGED
|
@@ -206,19 +206,33 @@ function allAttemptsFailedBeforeSend(errors) {
|
|
|
206
206
|
return false;
|
|
207
207
|
return errors.every((x) => x !== null && typeof x === 'object' && isPreSendCode(x.code, x.syscall));
|
|
208
208
|
}
|
|
209
|
-
|
|
209
|
+
const CAUSE_CHAIN_MAX_LAYERS = 4;
|
|
210
|
+
function walkCauseChain(e, visit) {
|
|
210
211
|
let cur = e;
|
|
211
|
-
for (let depth = 0; depth <
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return true;
|
|
215
|
-
if (allAttemptsFailedBeforeSend(o.errors))
|
|
216
|
-
return true;
|
|
212
|
+
for (let depth = 0; depth < CAUSE_CHAIN_MAX_LAYERS && cur !== null && typeof cur === 'object'; depth++) {
|
|
213
|
+
if (visit(cur, depth) === 'stop')
|
|
214
|
+
return { stopped: true };
|
|
217
215
|
cur = cur.cause;
|
|
218
216
|
}
|
|
219
|
-
return false;
|
|
217
|
+
return { stopped: false, end: cur !== null && typeof cur === 'object' ? 'depth_cap' : 'complete' };
|
|
218
|
+
}
|
|
219
|
+
function readLayerEvidence(layer) {
|
|
220
|
+
const o = layer;
|
|
221
|
+
const code = o.code;
|
|
222
|
+
const syscall = o.syscall;
|
|
223
|
+
if (isPreSendCode(code, syscall))
|
|
224
|
+
return { proof: 'code', code, syscall };
|
|
225
|
+
if (allAttemptsFailedBeforeSend(o.errors))
|
|
226
|
+
return { proof: 'attempts', code, syscall };
|
|
227
|
+
return { proof: null, code, syscall };
|
|
228
|
+
}
|
|
229
|
+
function failedBeforeSend(e) {
|
|
230
|
+
return walkCauseChain(e, (layer) => (readLayerEvidence(layer).proof !== null ? 'stop' : undefined)).stopped;
|
|
220
231
|
}
|
|
221
232
|
export function noAnswerKindOf(e) {
|
|
233
|
+
return noAnswerKindWith(e, () => failedBeforeSend(e));
|
|
234
|
+
}
|
|
235
|
+
function noAnswerKindWith(e, chainProof) {
|
|
222
236
|
try {
|
|
223
237
|
if (e === null || typeof e !== 'object')
|
|
224
238
|
return null;
|
|
@@ -231,7 +245,7 @@ export function noAnswerKindOf(e) {
|
|
|
231
245
|
const name = e.name;
|
|
232
246
|
if (name === 'TimeoutError')
|
|
233
247
|
return 'time-limit';
|
|
234
|
-
if ((e instanceof TypeError || name === 'TypeError') && !
|
|
248
|
+
if ((e instanceof TypeError || name === 'TypeError') && !chainProof())
|
|
235
249
|
return 'connection-lost';
|
|
236
250
|
return null;
|
|
237
251
|
}
|
|
@@ -339,6 +353,137 @@ export function provablyNotSent(e) {
|
|
|
339
353
|
return false;
|
|
340
354
|
}
|
|
341
355
|
}
|
|
356
|
+
const TRANSPORT_BIT_STRING = /^[A-Za-z0-9_.:-]{1,64}$/;
|
|
357
|
+
function bitString(v) {
|
|
358
|
+
return typeof v === 'string' && TRANSPORT_BIT_STRING.test(v) ? v : undefined;
|
|
359
|
+
}
|
|
360
|
+
function bitNumber(v) {
|
|
361
|
+
return typeof v === 'number' && Number.isFinite(v) ? v : undefined;
|
|
362
|
+
}
|
|
363
|
+
function layerBitsOf(layer, onUnreadable, known) {
|
|
364
|
+
const read = (target, key) => {
|
|
365
|
+
try {
|
|
366
|
+
return target[key];
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
onUnreadable();
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
const name = bitString(read(layer, 'name'));
|
|
374
|
+
const code = bitString(known !== undefined ? known.code : read(layer, 'code'));
|
|
375
|
+
const errno = bitNumber(read(layer, 'errno'));
|
|
376
|
+
const syscall = bitString(known !== undefined ? known.syscall : read(layer, 'syscall'));
|
|
377
|
+
const sock = read(layer, 'socket');
|
|
378
|
+
let socket;
|
|
379
|
+
if (sock !== null && typeof sock === 'object') {
|
|
380
|
+
const localPort = bitNumber(read(sock, 'localPort'));
|
|
381
|
+
const remotePort = bitNumber(read(sock, 'remotePort'));
|
|
382
|
+
const bytesWritten = bitNumber(read(sock, 'bytesWritten'));
|
|
383
|
+
const bytesRead = bitNumber(read(sock, 'bytesRead'));
|
|
384
|
+
const counters = {
|
|
385
|
+
...(localPort !== undefined ? { localPort } : {}),
|
|
386
|
+
...(remotePort !== undefined ? { remotePort } : {}),
|
|
387
|
+
...(bytesWritten !== undefined ? { bytesWritten } : {}),
|
|
388
|
+
...(bytesRead !== undefined ? { bytesRead } : {}),
|
|
389
|
+
};
|
|
390
|
+
if (Object.keys(counters).length > 0)
|
|
391
|
+
socket = Object.freeze(counters);
|
|
392
|
+
}
|
|
393
|
+
return Object.freeze({
|
|
394
|
+
...(name !== undefined ? { name } : {}),
|
|
395
|
+
...(code !== undefined ? { code } : {}),
|
|
396
|
+
...(errno !== undefined ? { errno } : {}),
|
|
397
|
+
...(syscall !== undefined ? { syscall } : {}),
|
|
398
|
+
...(socket !== undefined ? { socket } : {}),
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
export function transportFailureScene(error) {
|
|
402
|
+
const layers = [];
|
|
403
|
+
const seen = [];
|
|
404
|
+
let unreadable = false;
|
|
405
|
+
const markUnreadable = () => {
|
|
406
|
+
unreadable = true;
|
|
407
|
+
};
|
|
408
|
+
let cycleSeen = false;
|
|
409
|
+
let marked = false;
|
|
410
|
+
let blocked = false;
|
|
411
|
+
let proven = false;
|
|
412
|
+
let aborted = false;
|
|
413
|
+
let end = 'complete';
|
|
414
|
+
let walked = false;
|
|
415
|
+
const walk = () => {
|
|
416
|
+
if (walked)
|
|
417
|
+
return;
|
|
418
|
+
walked = true;
|
|
419
|
+
try {
|
|
420
|
+
const result = walkCauseChain(error, (layer) => {
|
|
421
|
+
const revisit = seen.includes(layer);
|
|
422
|
+
if (revisit)
|
|
423
|
+
cycleSeen = true;
|
|
424
|
+
else
|
|
425
|
+
seen.push(layer);
|
|
426
|
+
let known;
|
|
427
|
+
if (!proven) {
|
|
428
|
+
try {
|
|
429
|
+
const evidence = readLayerEvidence(layer);
|
|
430
|
+
known = { code: evidence.code, syscall: evidence.syscall };
|
|
431
|
+
if (evidence.proof !== null)
|
|
432
|
+
proven = true;
|
|
433
|
+
}
|
|
434
|
+
catch {
|
|
435
|
+
unreadable = true;
|
|
436
|
+
aborted = true;
|
|
437
|
+
if (!revisit)
|
|
438
|
+
layers.push(layerBitsOf(layer, markUnreadable, undefined));
|
|
439
|
+
return 'stop';
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
if (!revisit)
|
|
443
|
+
layers.push(layerBitsOf(layer, markUnreadable, known));
|
|
444
|
+
return undefined;
|
|
445
|
+
});
|
|
446
|
+
if (!result.stopped)
|
|
447
|
+
end = result.end;
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
unreadable = true;
|
|
451
|
+
aborted = true;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
const failedBefore = () => {
|
|
455
|
+
walk();
|
|
456
|
+
if (aborted && !proven)
|
|
457
|
+
throw new Error('cause chain unreadable');
|
|
458
|
+
return proven;
|
|
459
|
+
};
|
|
460
|
+
let status;
|
|
461
|
+
let noAnswer = null;
|
|
462
|
+
if (error !== null && typeof error === 'object') {
|
|
463
|
+
try {
|
|
464
|
+
marked = markedNotSent(error);
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
blocked = true;
|
|
468
|
+
unreadable = true;
|
|
469
|
+
}
|
|
470
|
+
noAnswer = noAnswerKindWith(error, failedBefore);
|
|
471
|
+
walk();
|
|
472
|
+
try {
|
|
473
|
+
status = bitNumber(error.status);
|
|
474
|
+
}
|
|
475
|
+
catch {
|
|
476
|
+
unreadable = true;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
return Object.freeze({
|
|
480
|
+
layers: Object.freeze(layers),
|
|
481
|
+
end: unreadable ? 'unreadable' : cycleSeen ? 'cycle' : end,
|
|
482
|
+
...(status !== undefined ? { status } : {}),
|
|
483
|
+
provablyNotSent: !blocked && (marked || proven),
|
|
484
|
+
noAnswer,
|
|
485
|
+
});
|
|
486
|
+
}
|
|
342
487
|
export function settleInjected(ms, signal, run) {
|
|
343
488
|
const settled = settleInjectedOnce(ms, signal, run);
|
|
344
489
|
Object.defineProperty(settled, SETTLED_BY_PACKAGE_BRAND, { value: true, enumerable: false });
|
package/dist/engineWireSdk.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export type WireAuthToken = string | {
|
|
|
5
5
|
export type WireAuthTokenSource = string | (() => string | undefined);
|
|
6
6
|
export declare function isLoopbackWireUrl(url: string): boolean;
|
|
7
7
|
export declare function resolveWireAuth(baseUrl: string | undefined, token?: string): WireAuthToken;
|
|
8
|
-
export declare function wireAuthTokenFor(baseUrl: string, token?: string): WireAuthToken;
|
|
9
8
|
export type EngineProbeClient = Pick<AgentClient, 'capabilities' | 'scenarioCapabilities'>;
|
|
10
9
|
export interface EngineWireInjection<C> {
|
|
11
10
|
client: C;
|
package/dist/engineWireSdk.js
CHANGED
|
@@ -16,9 +16,6 @@ export function resolveWireAuth(baseUrl, token) {
|
|
|
16
16
|
return { mode: 'loopback-unauthed' };
|
|
17
17
|
return 'anon';
|
|
18
18
|
}
|
|
19
|
-
export function wireAuthTokenFor(baseUrl, token) {
|
|
20
|
-
return resolveWireAuth(baseUrl, token);
|
|
21
|
-
}
|
|
22
19
|
function headersToRecord(init) {
|
|
23
20
|
const out = {};
|
|
24
21
|
if (init === undefined)
|
|
@@ -64,6 +64,8 @@ export function observedExecutionLane(baseUrl = engineWireTarget()?.baseUrl) {
|
|
|
64
64
|
export function toolsRunHereFromExecutionLane(reading, legacyInference) {
|
|
65
65
|
if (reading.kind === 'present')
|
|
66
66
|
return reading.view.toolsOnThisHost;
|
|
67
|
+
if (reading.kind === 'not_reported')
|
|
68
|
+
return false;
|
|
67
69
|
return legacyInference;
|
|
68
70
|
}
|
|
69
71
|
export function noOsSandboxOnThisHost(reading) {
|
|
@@ -95,9 +97,9 @@ export function executionLaneDoctorDetail(reading) {
|
|
|
95
97
|
switch (reading.kind) {
|
|
96
98
|
case 'unobserved':
|
|
97
99
|
return ('execution lane not observed — the engine reports it on /v1/capabilities; ' +
|
|
98
|
-
'this process has no usable capabilities reading cached for it (none received, or the last one was
|
|
100
|
+
'this process has no usable capabilities reading cached for it (none received, the last one was unreadable, or the last one was discarded when the engine connection was reset; this process cannot tell which)');
|
|
99
101
|
case 'not_reported':
|
|
100
|
-
return ('execution lane not reported by this engine
|
|
102
|
+
return ('execution lane not reported by this engine; ' +
|
|
101
103
|
'this does not say where tools run, so the client keeps inferring it the way it did before');
|
|
102
104
|
case 'present': {
|
|
103
105
|
const lane = capForDisplay(reading.view.provider, LANE_DETAIL_MAX);
|
|
@@ -6,7 +6,7 @@ export type FileHistoryCaptureReading = {
|
|
|
6
6
|
kind: 'present';
|
|
7
7
|
word: string;
|
|
8
8
|
};
|
|
9
|
-
export type FileHistoryCaptureMode = 'off' | 'on-
|
|
9
|
+
export type FileHistoryCaptureMode = 'off' | 'on-optional' | 'unknown';
|
|
10
10
|
export declare function projectFileHistoryCaptureCapability(caps: unknown): FileHistoryCaptureReading | undefined;
|
|
11
11
|
export declare function noteEngineCapsForFileHistoryCapture(baseUrl: string, caps: unknown, opts?: {
|
|
12
12
|
generation?: number;
|
|
@@ -43,8 +43,6 @@ export function fileHistoryCaptureMode(reading) {
|
|
|
43
43
|
return 'off';
|
|
44
44
|
if (word === 'on-optional')
|
|
45
45
|
return 'on-optional';
|
|
46
|
-
if (word === 'on-always')
|
|
47
|
-
return 'on-always';
|
|
48
46
|
return 'unknown';
|
|
49
47
|
}
|
|
50
48
|
export function fileHistoryDeclarationField(reading, captureOff) {
|
|
@@ -66,7 +64,7 @@ export function fileHistoryCaptureDoctorDetail(reading) {
|
|
|
66
64
|
}
|
|
67
65
|
switch (kind) {
|
|
68
66
|
case 'not_reported':
|
|
69
|
-
return 'file history capture not reported by this engine
|
|
67
|
+
return 'file history capture not reported by this engine; this does not say whether file history is captured here';
|
|
70
68
|
case 'present':
|
|
71
69
|
if (typeof word !== 'string' || word.length === 0)
|
|
72
70
|
return unobserved;
|
|
@@ -76,9 +74,6 @@ export function fileHistoryCaptureDoctorDetail(reading) {
|
|
|
76
74
|
if (word === 'on-optional') {
|
|
77
75
|
return 'file history capture on — the engine snapshots files before changing them, and a session on this deployment can opt out of capture for its own runs';
|
|
78
76
|
}
|
|
79
|
-
if (word === 'on-always') {
|
|
80
|
-
return 'file history capture always on — the engine snapshots files before changing them in every session, and it cannot be turned off for a single session here';
|
|
81
|
-
}
|
|
82
77
|
return `file history capture reported as "${capForDisplay(word, WORD_DETAIL_MAX)}" — a mode this client does not know yet, so whether it captures is shown as unknown`;
|
|
83
78
|
default:
|
|
84
79
|
return unobserved;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentEvent } from '@sema-agent/sdk';
|
|
2
2
|
import { type FileHistoryCaptureReading } from './fileHistoryCaptureCapability.js';
|
|
3
3
|
export type FileHistoryDeclarationFact = 'sent' | 'not_sent' | 'unknown';
|
|
4
|
-
export declare const FILE_HISTORY_LEG_VERDICTS: readonly ["not_honored", "
|
|
4
|
+
export declare const FILE_HISTORY_LEG_VERDICTS: readonly ["not_honored", "honored", "not_declared", "unknown"];
|
|
5
5
|
export type FileHistoryLegNoticeVerdict = (typeof FILE_HISTORY_LEG_VERDICTS)[number];
|
|
6
6
|
export interface FileHistoryLegNoticeInput {
|
|
7
7
|
readonly capability: FileHistoryCaptureReading;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileHistoryCaptureMode } from './fileHistoryCaptureCapability.js';
|
|
2
2
|
import { frameProvesDelivery } from './promptDelivery.js';
|
|
3
3
|
import { FILE_HISTORY_DISABLED } from './request/taskRequest.js';
|
|
4
|
-
export const FILE_HISTORY_LEG_VERDICTS = Object.freeze(['not_honored', '
|
|
4
|
+
export const FILE_HISTORY_LEG_VERDICTS = Object.freeze(['not_honored', 'honored', 'not_declared', 'unknown']);
|
|
5
5
|
function ownRead(o, key) {
|
|
6
6
|
return Object.hasOwn(o, key) ? o[key] : undefined;
|
|
7
7
|
}
|
|
@@ -31,19 +31,14 @@ export function fileHistoryLegNoticeVerdict(input) {
|
|
|
31
31
|
if (!offByUser)
|
|
32
32
|
return 'not_declared';
|
|
33
33
|
const mode = fileHistoryCaptureMode(capability);
|
|
34
|
-
if (legWord === 'on' && mode === 'on-always')
|
|
35
|
-
return 'not_offered';
|
|
36
34
|
if (declaration === 'not_sent' && (legWord === FILE_HISTORY_DISABLED || mode === 'on-optional'))
|
|
37
35
|
return 'not_declared';
|
|
38
36
|
return 'unknown';
|
|
39
37
|
}
|
|
40
38
|
const NOT_HONORED_SENTENCE = 'The engine is still capturing file history for this session, though your settings asked it not to.';
|
|
41
|
-
const NOT_OFFERED_SENTENCE = 'This engine always captures file history and cannot turn it off per session, even though file checkpoints are off in your settings.';
|
|
42
39
|
export function fileHistoryLegNoticeSentence(verdict) {
|
|
43
40
|
if (verdict === 'not_honored')
|
|
44
41
|
return NOT_HONORED_SENTENCE;
|
|
45
|
-
if (verdict === 'not_offered')
|
|
46
|
-
return NOT_OFFERED_SENTENCE;
|
|
47
42
|
return null;
|
|
48
43
|
}
|
|
49
44
|
export function fileHistoryDeclarationOfBody(body) {
|
package/dist/gateOutcome.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ccToolDenialKindForSettledBy, isCcToolDenialKind, isGateDeniedByWord } from './gateVocabulary.js';
|
|
2
2
|
import { GATE_PARKED_ERROR_CODE } from './engineErrorCodes.js';
|
|
3
|
-
import { CORE_MODE_RELEASE_REASONS } from './generated/engineFactTables.js';
|
|
3
|
+
import { CORE_MODE_RELEASE_REASONS, CORE_SETTLEMENT_KINDS } from './generated/engineFactTables.js';
|
|
4
4
|
function str(v) {
|
|
5
5
|
return typeof v === 'string' && v.length > 0 ? v : undefined;
|
|
6
6
|
}
|
|
@@ -8,22 +8,7 @@ export const GATE_MODE_RELEASE_REASON_WORDS = CORE_MODE_RELEASE_REASONS;
|
|
|
8
8
|
export function isGateModeReleaseReasonWord(v) {
|
|
9
9
|
return typeof v === 'string' && CORE_MODE_RELEASE_REASONS.includes(v);
|
|
10
10
|
}
|
|
11
|
-
export const SETTLEMENT_KIND_WORDS =
|
|
12
|
-
'human_allowed',
|
|
13
|
-
'human_refused',
|
|
14
|
-
'approval_window_expired',
|
|
15
|
-
'denial_limit_window_expired',
|
|
16
|
-
'park_sla_expired',
|
|
17
|
-
'no_approver',
|
|
18
|
-
'approver_unavailable',
|
|
19
|
-
'approver_error',
|
|
20
|
-
'approver_contract',
|
|
21
|
-
'presentation_failed',
|
|
22
|
-
'blanket_allow_refused',
|
|
23
|
-
'policy_allowed',
|
|
24
|
-
'policy_refused',
|
|
25
|
-
'task_aborted',
|
|
26
|
-
]);
|
|
11
|
+
export const SETTLEMENT_KIND_WORDS = CORE_SETTLEMENT_KINDS;
|
|
27
12
|
function readWho(v) {
|
|
28
13
|
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
29
14
|
return undefined;
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -5,18 +5,12 @@ export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
|
|
|
5
5
|
export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
|
|
6
6
|
export declare function isCcToolDenialKindADenial(v: unknown): boolean;
|
|
7
7
|
export declare function ccToolDenialKindForSettledBy(settledBy: unknown): CcToolDenialKind | undefined;
|
|
8
|
-
|
|
9
|
-
export type GateDeniedByWord = (typeof CORE_DENIED_BY_VALUES)[number] | (typeof RETIRED_DENIED_BY_WORDS)[number];
|
|
8
|
+
export type GateDeniedByWord = (typeof CORE_DENIED_BY_VALUES)[number];
|
|
10
9
|
export declare const GATE_DENIED_BY_WORDS: readonly GateDeniedByWord[];
|
|
11
10
|
export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
|
|
12
11
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
13
|
-
export declare function askOriginDetail(origin: unknown
|
|
14
|
-
export declare const RULE_STORE_UNREADABLE_KINDS: readonly ["store", "call"];
|
|
15
|
-
export type RuleStoreUnreadableKind = (typeof RULE_STORE_UNREADABLE_KINDS)[number];
|
|
16
|
-
export declare function isRuleStoreUnreadableKind(v: unknown): v is RuleStoreUnreadableKind;
|
|
17
|
-
export declare function ruleStoreUnreadableDetail(kind: RuleStoreUnreadableKind): string;
|
|
12
|
+
export declare function askOriginDetail(origin: unknown): string;
|
|
18
13
|
export declare function mandatedApprovalDetail(): string;
|
|
19
14
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
|
20
15
|
export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
|
|
21
16
|
export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
|
|
22
|
-
export {};
|
package/dist/gateVocabulary.js
CHANGED
|
@@ -21,8 +21,7 @@ export function ccToolDenialKindForSettledBy(settledBy) {
|
|
|
21
21
|
return 'permission-rule';
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
export const GATE_DENIED_BY_WORDS = Object.freeze([...CORE_DENIED_BY_VALUES, ...RETIRED_DENIED_BY_WORDS]);
|
|
24
|
+
export const GATE_DENIED_BY_WORDS = Object.freeze([...CORE_DENIED_BY_VALUES]);
|
|
26
25
|
const _deniedByWordsPin = true;
|
|
27
26
|
void _deniedByWordsPin;
|
|
28
27
|
const DENIED_BY_SENTENCES = Object.freeze({
|
|
@@ -31,7 +30,6 @@ const DENIED_BY_SENTENCES = Object.freeze({
|
|
|
31
30
|
org: 'denied by an organization rule',
|
|
32
31
|
persisted_rule: 'denied by a persisted rule',
|
|
33
32
|
classifier: 'denied by the auto-mode classifier',
|
|
34
|
-
plan_mode: 'denied because plan mode only allows reads',
|
|
35
33
|
compliance: 'denied by a compliance lock',
|
|
36
34
|
write_protection: 'denied because the write landed on a write-protected path',
|
|
37
35
|
ask_resolution: 'denied when the approval was resolved',
|
|
@@ -46,11 +44,11 @@ export function gateDeniedByDetail(deniedBy) {
|
|
|
46
44
|
return DENIED_BY_SENTENCES[deniedBy];
|
|
47
45
|
}
|
|
48
46
|
const word = typeof deniedBy === 'string' && deniedBy.length > 0 ? deniedBy : '(none)';
|
|
49
|
-
return `denied by a layer this build does not know (${word}) — this build does not know this layer name
|
|
47
|
+
return `denied by a layer this build does not know (${word}) — this build does not know this layer name, so it cannot say which layer refused this call or why`;
|
|
50
48
|
}
|
|
51
49
|
const ASK_ORIGIN_SENTENCES = Object.freeze({
|
|
52
50
|
content_question: 'the tool itself asked you a question',
|
|
53
|
-
ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate): it must reach the park with no synchronous decision-maker in between',
|
|
51
|
+
ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate; this client cannot tell which from the origin alone): it must reach the park with no synchronous decision-maker in between',
|
|
54
52
|
org_unavailable: 'the organization policy was unavailable, so this call asks',
|
|
55
53
|
org_rule: 'an organization rule asks about this call',
|
|
56
54
|
rule_store_unavailable: 'this call could not be checked against your standing deny/ask rules, so it asks',
|
|
@@ -58,42 +56,18 @@ const ASK_ORIGIN_SENTENCES = Object.freeze({
|
|
|
58
56
|
ask_rule: 'a persisted ask rule matches this call',
|
|
59
57
|
denial_limit_fallback: 'the auto-mode classifier hit its denial limit and handed this call back to you',
|
|
60
58
|
shell_gate_tighten: 'the coarse shell check rates this command above the tier it lets through, so it asks',
|
|
61
|
-
safety_tighten: 'the gate tightened on this call’s own facts (network egress, irreversibility, or a protected write)',
|
|
59
|
+
safety_tighten: 'the gate tightened on this call’s own facts (network egress, irreversibility, or a protected write; this client cannot tell which from the origin alone)',
|
|
62
60
|
policy: 'this deployment’s permission policy asks about this call',
|
|
63
61
|
});
|
|
64
|
-
|
|
65
|
-
export function askOriginDetail(origin, message) {
|
|
62
|
+
export function askOriginDetail(origin) {
|
|
66
63
|
const known = typeof origin === 'string' && Object.hasOwn(ASK_ORIGIN_SENTENCES, origin)
|
|
67
64
|
? ASK_ORIGIN_SENTENCES[origin]
|
|
68
65
|
: undefined;
|
|
69
|
-
if (typeof origin === 'string' && ORIGIN_PREFERS_ENGINE_MESSAGE.has(origin)) {
|
|
70
|
-
const spoken = typeof message === 'string' ? message.trim() : '';
|
|
71
|
-
if (spoken.length > 0)
|
|
72
|
-
return spoken;
|
|
73
|
-
}
|
|
74
66
|
if (known !== undefined)
|
|
75
67
|
return known;
|
|
76
68
|
const word = typeof origin === 'string' && origin.length > 0 ? origin : '(none)';
|
|
77
69
|
return `this call asks; its origin ${word} is a word newer than this client, so answer it as usual`;
|
|
78
70
|
}
|
|
79
|
-
export const RULE_STORE_UNREADABLE_KINDS = Object.freeze(['store', 'call']);
|
|
80
|
-
const RULE_STORE_UNREADABLE_SET = new Set(RULE_STORE_UNREADABLE_KINDS);
|
|
81
|
-
export function isRuleStoreUnreadableKind(v) {
|
|
82
|
-
return typeof v === 'string' && RULE_STORE_UNREADABLE_SET.has(v);
|
|
83
|
-
}
|
|
84
|
-
const RULE_STORE_UNREADABLE_SENTENCES = Object.freeze({
|
|
85
|
-
store: 'your standing deny/ask rules could not be read at all (the rule store did not answer), so this call asks',
|
|
86
|
-
call: 'this command could not be read against your standing deny/ask rules (the engine’s own sentence is on this ask), so it asks',
|
|
87
|
-
});
|
|
88
|
-
export function ruleStoreUnreadableDetail(kind) {
|
|
89
|
-
const known = Object.hasOwn(RULE_STORE_UNREADABLE_SENTENCES, kind)
|
|
90
|
-
? RULE_STORE_UNREADABLE_SENTENCES[kind]
|
|
91
|
-
: undefined;
|
|
92
|
-
if (typeof known === 'string')
|
|
93
|
-
return known;
|
|
94
|
-
const word = typeof kind === 'string' && kind.length > 0 ? kind : '(none)';
|
|
95
|
-
return `your standing deny/ask rules could not be applied to this call; the reported reason ${word} is not one of the mechanisms this client's closed set knows, so answer this ask as usual`;
|
|
96
|
-
}
|
|
97
71
|
export function mandatedApprovalDetail() {
|
|
98
72
|
return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here, by a hook, or by an automatic check the deployment runs — and an answer covers only that call';
|
|
99
73
|
}
|
|
@@ -106,7 +80,7 @@ const APPROVAL_MANDATE_SENTENCES = Object.freeze({
|
|
|
106
80
|
operator_always: 'this deployment requires a separate confirmation for each shell command, and this call is one of them',
|
|
107
81
|
tool_marks: 'this tool declares that it reaches outside this machine or makes changes that cannot be undone',
|
|
108
82
|
probe_mandate: 'the check run on this call marked it as needing its own confirmation (the built-in shell check does so for a read outside the directories allowed for this session)',
|
|
109
|
-
probe_unanswered: 'the check run on this call did not answer (it timed out or failed), so whether the call stays inside the directories allowed for this session is unknown',
|
|
83
|
+
probe_unanswered: 'the check run on this call did not answer (it timed out or failed; this client cannot tell which), so whether the call stays inside the directories allowed for this session is unknown',
|
|
110
84
|
write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
|
|
111
85
|
write_protection_unresolved: 'the protected-location check could not tell where this change lands, so whether it touches a protected location is unknown',
|
|
112
86
|
});
|
|
@@ -21,4 +21,20 @@ export interface CoreModeArbitrationRow {
|
|
|
21
21
|
readonly ruleMayClear: boolean;
|
|
22
22
|
readonly hookAskFloor: boolean;
|
|
23
23
|
}
|
|
24
|
-
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "operator_forced" | "shell_floor" | "write_protection_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
|
|
24
|
+
export declare const CORE_MODE_ARBITRATION: Readonly<Record<"content_question" | "hook" | "ancestor" | "unverifiable_delete" | "transcript_write" | "org_rule" | "governance_unavailable" | "rule_unreadable" | "ask_rule" | "denial_limit_fallback" | "classifier_no_ruling" | "requires_user_interaction" | "operator_forced" | "shell_floor" | "write_protection_unresolved" | "probe" | "write_protection" | "tool_marks_mcp" | "tool_marks_a2a" | "policy_rra" | "artifact_shared_read" | "mode" | "unstated" | "ordinary", CoreModeArbitrationRow>>;
|
|
25
|
+
export declare const CORE_SKILL_GRANT_ORIGINS: readonly ["model", "user", "inherited"];
|
|
26
|
+
export declare const CORE_ALLOW_ENTRY_INERT_REASONS: readonly ["wildcard_all", "namespace_wildcard", "path_pattern", "domain", "content_unsupported", "grammar", "tool_name", "near_miss"];
|
|
27
|
+
export declare const CORE_ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"];
|
|
28
|
+
export declare const CORE_RULE_TOOL_NAME_VERDICTS: readonly ["current", "retired", "unprefixed_namespace", "unmintable_segment"];
|
|
29
|
+
export declare const CORE_SETTLEMENT_KINDS: readonly ["human_allowed", "human_refused", "approval_window_expired", "denial_limit_window_expired", "park_sla_expired", "no_approver", "approver_unavailable", "approver_error", "approver_contract", "presentation_failed", "blanket_allow_refused", "policy_allowed", "policy_refused", "task_aborted"];
|
|
30
|
+
export declare const CORE_CLASSIFIER_DENY_CAUSES: readonly ["unavailable", "parse_error"];
|
|
31
|
+
export declare const CORE_AUTO_MODE_UNAVAILABLE_CAUSES: readonly ["error", "timeout"];
|
|
32
|
+
export declare const CORE_DEFAULT_TIER_ORDER: readonly ["ultra", "max", "pro", "flash", "lite"];
|
|
33
|
+
export declare const CORE_CC_MODEL_TIER_ALIASES: Readonly<Record<"fable" | "mythos" | "opus" | "sonnet" | "haiku", (typeof CORE_DEFAULT_TIER_ORDER)[number]>>;
|
|
34
|
+
export declare const CORE_DURABLE_AGENT_HANDLE_RE: RegExp;
|
|
35
|
+
export declare const CORE_PERMISSION_MODE_CLASSES: readonly ["bypass", "prompting"];
|
|
36
|
+
export declare const CORE_MCP_LIVENESS_STATES: readonly ["reachable", "unreachable", "unknown"];
|
|
37
|
+
export declare const CORE_RULE_BEHAVIORS: readonly ["deny", "ask", "allow"];
|
|
38
|
+
export declare const CORE_MCP_IMAGE_MAX_BASE64: number;
|
|
39
|
+
export declare const CORE_MAX_PENDING_STEER_CHARS: number;
|
|
40
|
+
export declare const CORE_PROMPT_BLOCK_CAUSES: readonly ["block", "crashed", "timeout", "cancelled"];
|