@sema-agent/client-core 0.84.0 → 0.85.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 +247 -0
- package/README.md +27 -13
- package/dist/abortableSleep.d.ts +10 -0
- package/dist/abortableSleep.js +37 -0
- package/dist/adapt/arms.js +1 -1
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +1 -1
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +1 -0
- package/dist/adapter/downstream/terminalToSdkResult.js +19 -10
- package/dist/adapter/runStream.js +6 -2
- package/dist/agentSession/engineSessionBackgroundStop.d.ts +50 -0
- package/dist/agentSession/engineSessionBackgroundStop.js +291 -0
- package/dist/agentsWireCaps.d.ts +2 -1
- package/dist/agentsWireCaps.js +8 -0
- package/dist/cloudConfigWireCaps.js +2 -1
- package/dist/corruptSession.d.ts +3 -0
- package/dist/corruptSession.js +29 -0
- package/dist/corruptSessionCopy.d.ts +1 -0
- package/dist/corruptSessionCopy.js +4 -0
- package/dist/decideFailureNote.d.ts +2 -1
- package/dist/decideFailureNote.js +8 -3
- package/dist/decideReceipt.d.ts +6 -0
- package/dist/decideReceipt.js +30 -1
- package/dist/detachWire.d.ts +1 -0
- package/dist/detachWire.js +13 -5
- package/dist/displayUntrusted.js +114 -18
- package/dist/effortWire.d.ts +2 -1
- package/dist/effortWire.js +2 -4
- package/dist/engineErrorCodes.d.ts +11 -0
- package/dist/engineErrorCodes.js +32 -0
- package/dist/engineNoticeCodes.d.ts +39 -4
- package/dist/engineNoticeCodes.js +117 -161
- package/dist/engineWireFor.d.ts +43 -0
- package/dist/engineWireFor.js +399 -0
- package/dist/engineWireSdk.d.ts +6 -0
- package/dist/fileHistoryCaptureCapability.d.ts +4 -1
- package/dist/fileHistoryCaptureCapability.js +43 -9
- package/dist/gateVocabulary.d.ts +1 -2
- package/dist/gateVocabulary.js +1 -22
- package/dist/generated/engineNoticeTables.d.ts +3 -0
- package/dist/generated/engineNoticeTables.js +156 -0
- package/dist/generated/toolNameTables.d.ts +2 -0
- package/dist/generated/toolNameTables.js +43 -0
- package/dist/headlessPermissionModeWire.js +2 -4
- package/dist/hitl/askGateWire.d.ts +1 -1
- package/dist/hitl/askGateWire.js +1 -1
- package/dist/hitl/frameRouter.js +4 -2
- package/dist/hitl/hitlHostSurface.js +1 -1
- package/dist/hitl/parkResolver.d.ts +1 -0
- package/dist/hitl/parkResolver.js +11 -3
- package/dist/hitl/planReviewWire.d.ts +41 -3
- package/dist/hitl/planReviewWire.js +264 -49
- package/dist/hitl/rosterMountedNames.d.ts +2 -0
- package/dist/hitl/rosterMountedNames.js +38 -0
- package/dist/hitl/sessionPolicyDeliverable.d.ts +8 -2
- package/dist/hitl/sessionPolicyDeliverable.js +39 -48
- package/dist/hitl/sessionPolicyWire.d.ts +40 -0
- package/dist/hitl/sessionPolicyWire.js +173 -0
- package/dist/hitl/toolApprovalWire.d.ts +4 -2
- package/dist/hitl/toolApprovalWire.js +6 -4
- package/dist/index.d.ts +10 -3
- package/dist/index.js +7 -2
- package/dist/liveInitToolFace.js +28 -10
- package/dist/permissionWireCaps.d.ts +2 -1
- package/dist/permissionWireCaps.js +2 -7
- package/dist/request/taskRequest.d.ts +2 -0
- package/dist/request/taskRequest.js +18 -1
- package/dist/resumeRefusalCopy.d.ts +11 -0
- package/dist/resumeRefusalCopy.js +42 -2
- package/dist/runTerminal.js +4 -0
- package/dist/sandboxWire.js +1 -1
- package/dist/sealedKeyCapability.d.ts +17 -0
- package/dist/sealedKeyCapability.js +42 -0
- package/dist/seatContract.d.ts +2 -1
- package/dist/seatContract.js +5 -21
- package/dist/subagent/engineCompactWire.d.ts +13 -2
- package/dist/subagent/engineCompactWire.js +48 -37
- package/dist/subagent/engineDelegatedPrompt.d.ts +9 -1
- package/dist/subagent/engineDelegatedPrompt.js +16 -16
- package/dist/subagent/engineRowStopGate.d.ts +2 -2
- package/dist/subagent/engineRowStopGate.js +4 -4
- package/dist/subagent/engineSubagentOutput.d.ts +8 -0
- package/dist/subagent/engineSubagentOutput.js +37 -18
- package/dist/subagent/engineSubagentResume.d.ts +11 -2
- package/dist/subagent/engineSubagentResume.js +28 -14
- package/dist/subagent/engineSubagentSteer.d.ts +10 -1
- package/dist/subagent/engineSubagentSteer.js +16 -11
- package/dist/subagent/engineSubagentTail.d.ts +10 -1
- package/dist/subagent/engineSubagentTail.js +35 -17
- package/dist/subagent/engineTaskHandleWire.d.ts +13 -0
- package/dist/subagent/engineTaskHandleWire.js +41 -20
- package/dist/systemReminderTag.d.ts +5 -0
- package/dist/systemReminderTag.js +20 -9
- package/dist/taskRequestWords.d.ts +5 -0
- package/dist/taskRequestWords.js +4 -0
- package/dist/wireErrorTriage.d.ts +1 -0
- package/dist/wireErrorTriage.js +3 -1
- package/dist/wireRefusalCopy.d.ts +10 -0
- package/dist/wireRefusalCopy.js +62 -2
- package/docs/INTEGRATION-CLIENTS.md +1128 -22
- package/package.json +1 -1
|
@@ -1,46 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
['bash', 'Bash'],
|
|
7
|
-
['bash_readonly', null],
|
|
8
|
-
['glob', 'Glob'],
|
|
9
|
-
['grep', 'Grep'],
|
|
10
|
-
['web_fetch', 'WebFetch'],
|
|
11
|
-
['tool_search', 'ToolSearch'],
|
|
12
|
-
['skill', 'Skill'],
|
|
13
|
-
['present_plan', 'ExitPlanMode'],
|
|
14
|
-
['enter_plan_mode', 'EnterPlanMode'],
|
|
15
|
-
['spawn_subagent', 'Agent'],
|
|
16
|
-
['CronCancel', 'CronDelete'],
|
|
17
|
-
['lsp', 'LSP'],
|
|
18
|
-
['submit_output', 'StructuredOutput'],
|
|
19
|
-
['repo_map', 'RepoMap'],
|
|
20
|
-
['read_tool_result', 'ReadToolResult'],
|
|
21
|
-
['report_blocked', 'ReportBlocked'],
|
|
22
|
-
['declare_done', 'DeclareDone'],
|
|
23
|
-
['run_workflow', 'Workflow'],
|
|
24
|
-
['RunWorkflow', 'Workflow'],
|
|
25
|
-
['Task', 'Agent'],
|
|
26
|
-
['BashOutput', 'TaskOutput'],
|
|
27
|
-
['AgentOutputTool', 'TaskOutput'],
|
|
28
|
-
['BashOutputTool', 'TaskOutput'],
|
|
29
|
-
['AgentOutput', 'TaskOutput'],
|
|
30
|
-
['WorkflowStatus', null],
|
|
31
|
-
['KillShell', 'TaskStop'],
|
|
32
|
-
['KillBash', 'TaskStop'],
|
|
33
|
-
['ListMcpResources', 'ListMcpResourcesTool'],
|
|
34
|
-
['ReadMcpResource', 'ReadMcpResourceTool'],
|
|
35
|
-
['ReadMcpResourceDir', 'ReadMcpResourceDirTool'],
|
|
36
|
-
['MultiEdit', null],
|
|
37
|
-
['Fork', null],
|
|
38
|
-
['Sleep', null],
|
|
39
|
-
['Remember', null],
|
|
40
|
-
['remember', null],
|
|
41
|
-
['Recall', null],
|
|
42
|
-
['recall', null],
|
|
43
|
-
]);
|
|
1
|
+
import { CONFIG_LEGACY_TOOL_NAME } from '../engineErrorCodes.js';
|
|
2
|
+
import { rosterMountedNames } from './rosterMountedNames.js';
|
|
3
|
+
import { CORE_PROTOCOL_PREFIXES, CORE_RETIRED_TOOL_CURRENT_NAMES } from '../generated/toolNameTables.js';
|
|
4
|
+
const COVERING_NAMESPACE_PREFIXES = CORE_PROTOCOL_PREFIXES;
|
|
5
|
+
const ENGINE_RETIRED_TOOL_NAMES = CORE_RETIRED_TOOL_CURRENT_NAMES;
|
|
44
6
|
const PREFIXES_IN_PROSE = COVERING_NAMESPACE_PREFIXES.map((prefix) => `"${prefix}"`).join(' or ');
|
|
45
7
|
const WITHHELD_NOTICE = {
|
|
46
8
|
ask_no_bucket: 'Not written to this session’s rule record: that record only holds rules that block outright, and this rule asks before running instead — recording it as a block would change what it means.',
|
|
@@ -49,6 +11,7 @@ const WITHHELD_NOTICE = {
|
|
|
49
11
|
wildcard: 'Not written to this session’s rule record: this rule uses a wildcard (*), and an engine that matches that record by exact tool name would block none of the tools it covers.',
|
|
50
12
|
not_a_tool_name: 'Not written to this session’s rule record: this entry is not exactly one tool name — it is empty, not text, or has spaces around the name.',
|
|
51
13
|
legacy_tool_name: `Not written to this session’s rule record: unless a tool by exactly this name is available, the engine refuses it — it is a retired tool name, or it contains "__" but does not start with ${PREFIXES_IN_PROSE} — and with it in that record every later run of this session would fail at startup until that entry is removed from the record. If the tool still exists, use its current name; a server or agent-peer tool name starts with ${PREFIXES_IN_PROSE}.`,
|
|
14
|
+
not_in_roster: 'Not written to this session’s rule record: the tool roster supplied for this check has no tool by exactly this name, as a name or an alias, with letter case counted — it may be misspelled, or name a tool this deployment does not provide — so recorded as it is it would block nothing here.',
|
|
52
15
|
};
|
|
53
16
|
export const SESSION_POLICY_WITHHELD_WHY = Object.freeze(Object.keys(WITHHELD_NOTICE));
|
|
54
17
|
const MAX_RULES = 10_000;
|
|
@@ -71,13 +34,32 @@ function withheldWhyOf(rule) {
|
|
|
71
34
|
}
|
|
72
35
|
if (rule.trim() !== rule)
|
|
73
36
|
return 'not_a_tool_name';
|
|
74
|
-
if (
|
|
75
|
-
return 'legacy_tool_name';
|
|
76
|
-
if (rule.includes('__') && !COVERING_NAMESPACE_PREFIXES.some((prefix) => rule.startsWith(prefix)))
|
|
37
|
+
if (isEngineRefusedToolName(rule))
|
|
77
38
|
return 'legacy_tool_name';
|
|
78
39
|
return undefined;
|
|
79
40
|
}
|
|
80
|
-
export function
|
|
41
|
+
export function isEngineRefusedToolName(name) {
|
|
42
|
+
if (typeof name !== 'string')
|
|
43
|
+
return false;
|
|
44
|
+
if (ENGINE_RETIRED_TOOL_NAMES.has(name))
|
|
45
|
+
return true;
|
|
46
|
+
return name.includes('__') && !COVERING_NAMESPACE_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
47
|
+
}
|
|
48
|
+
function suppliedRosterNames(opts) {
|
|
49
|
+
if (opts === undefined || opts === null)
|
|
50
|
+
return 'absent';
|
|
51
|
+
let roster;
|
|
52
|
+
try {
|
|
53
|
+
if (typeof opts !== 'object')
|
|
54
|
+
return 'unreadable';
|
|
55
|
+
roster = opts.roster;
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return 'unreadable';
|
|
59
|
+
}
|
|
60
|
+
return rosterMountedNames(roster);
|
|
61
|
+
}
|
|
62
|
+
export function sessionPolicyDeliverable(behavior, rules, opts) {
|
|
81
63
|
const entries = [];
|
|
82
64
|
try {
|
|
83
65
|
if (behavior !== 'deny' && behavior !== 'ask')
|
|
@@ -99,6 +81,10 @@ export function sessionPolicyDeliverable(behavior, rules) {
|
|
|
99
81
|
catch {
|
|
100
82
|
return unreadable();
|
|
101
83
|
}
|
|
84
|
+
const known = suppliedRosterNames(opts);
|
|
85
|
+
if (known === 'unreadable')
|
|
86
|
+
return unreadable();
|
|
87
|
+
const mounted = known === 'absent' ? undefined : known;
|
|
102
88
|
const withheld = [];
|
|
103
89
|
if (behavior === 'ask') {
|
|
104
90
|
for (const r of entries)
|
|
@@ -111,7 +97,7 @@ export function sessionPolicyDeliverable(behavior, rules) {
|
|
|
111
97
|
withheld.push({ rule: '', why: 'not_a_tool_name' });
|
|
112
98
|
continue;
|
|
113
99
|
}
|
|
114
|
-
const why = withheldWhyOf(r);
|
|
100
|
+
const why = withheldWhyOf(r) ?? (mounted !== undefined && !mounted.has(r) ? 'not_in_roster' : undefined);
|
|
115
101
|
if (why === undefined)
|
|
116
102
|
exact.push(r);
|
|
117
103
|
else {
|
|
@@ -128,3 +114,8 @@ export function sessionPolicyWithheldNotice(why) {
|
|
|
128
114
|
? WITHHELD_NOTICE[why]
|
|
129
115
|
: 'Not written to this session’s rule record.';
|
|
130
116
|
}
|
|
117
|
+
const LEGACY_TOOL_NAME_FAILURE_NOTE = `This run did not start: a tool rule applied to it names a tool the engine refuses — a retired tool name, or a name that contains "__" but does not start with ${PREFIXES_IN_PROSE} (the engine's own error text names the entry). ` +
|
|
118
|
+
'Every later run fails the same way until that entry is removed from wherever it is set: this session’s rule record, the settings sent with the run, a parent session’s rule record, or the deployment’s own tool rules.';
|
|
119
|
+
export function legacyToolNameFailureNoteOf(code) {
|
|
120
|
+
return code === CONFIG_LEGACY_TOOL_NAME ? LEGACY_TOOL_NAME_FAILURE_NOTE : undefined;
|
|
121
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SessionPermissionRules, StoredSessionRules } from '@sema-agent/sdk';
|
|
2
2
|
import type { SessionPolicyReading } from '../sessionPolicyCapability.js';
|
|
3
|
+
import type { ToolRosterView } from '../toolRoster.js';
|
|
3
4
|
export interface SessionPolicyFacade {
|
|
4
5
|
getPolicy(sessionId: string, opts?: {
|
|
5
6
|
signal?: AbortSignal;
|
|
@@ -93,3 +94,42 @@ export declare function tightenSessionPolicy(facade: SessionPolicyFacade, req: S
|
|
|
93
94
|
signal?: AbortSignal;
|
|
94
95
|
}): Promise<SessionPolicyTightenOutcome>;
|
|
95
96
|
export declare function sessionPolicyTightenNotice(outcome: SessionPolicyTightenOutcome): string;
|
|
97
|
+
export interface SessionPolicyRemovedEntry {
|
|
98
|
+
readonly field: 'toolDeny' | 'toolAllow';
|
|
99
|
+
readonly rule: string;
|
|
100
|
+
}
|
|
101
|
+
export type SessionPolicyRemovalOutcome = {
|
|
102
|
+
kind: 'roster_required';
|
|
103
|
+
why: SessionPolicyRosterRequiredWhy;
|
|
104
|
+
} | {
|
|
105
|
+
kind: 'removed';
|
|
106
|
+
rev: number;
|
|
107
|
+
removed: readonly SessionPolicyRemovedEntry[];
|
|
108
|
+
} | {
|
|
109
|
+
kind: 'nothing_to_remove';
|
|
110
|
+
rev: number;
|
|
111
|
+
} | {
|
|
112
|
+
kind: 'loosen_forbidden';
|
|
113
|
+
message: string;
|
|
114
|
+
refused: readonly SessionPolicyRemovedEntry[];
|
|
115
|
+
} | {
|
|
116
|
+
kind: 'conflict';
|
|
117
|
+
rev: number;
|
|
118
|
+
} | {
|
|
119
|
+
kind: 'read_failed';
|
|
120
|
+
why: Extract<SessionPolicyTightenUnknownWhy, 'face_unavailable' | 'session_not_found' | 'session_ownerless' | 'unauthorized' | 'request_rejected' | 'store_corrupt' | 'read_unreadable' | 'read_failed'>;
|
|
121
|
+
message?: string;
|
|
122
|
+
} | {
|
|
123
|
+
kind: 'write_refused';
|
|
124
|
+
why: Extract<SessionPolicyTightenUnknownWhy, 'face_unavailable' | 'session_not_found' | 'session_ownerless' | 'unauthorized' | 'request_rejected' | 'store_corrupt' | 'write_refused'>;
|
|
125
|
+
message?: string;
|
|
126
|
+
} | {
|
|
127
|
+
kind: 'write_unconfirmed';
|
|
128
|
+
why: Extract<SessionPolicyTightenUnknownWhy, 'write_indeterminate' | 'write_receipt_unreadable' | 'write_receipt_mismatch'>;
|
|
129
|
+
message?: string;
|
|
130
|
+
};
|
|
131
|
+
export type SessionPolicyRosterRequiredWhy = 'absent' | 'unreadable';
|
|
132
|
+
export declare function removeRefusedSessionRules(facade: SessionPolicyFacade, sessionId: string, roster: ToolRosterView | undefined, opts?: {
|
|
133
|
+
signal?: AbortSignal;
|
|
134
|
+
}): Promise<SessionPolicyRemovalOutcome>;
|
|
135
|
+
export declare function sessionPolicyRemovalNotice(outcome: SessionPolicyRemovalOutcome): string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { wireFailureShapeOf } from '../wireFailureShape.js';
|
|
2
2
|
import { hostLog } from '../host.js';
|
|
3
|
+
import { isEngineRefusedToolName } from './sessionPolicyDeliverable.js';
|
|
4
|
+
import { rosterMountedNames } from './rosterMountedNames.js';
|
|
3
5
|
const RULE_FIELD_PRESENCE = {
|
|
4
6
|
toolAllow: true,
|
|
5
7
|
toolDeny: true,
|
|
@@ -306,3 +308,174 @@ export function sessionPolicyTightenNotice(outcome) {
|
|
|
306
308
|
}
|
|
307
309
|
}
|
|
308
310
|
}
|
|
311
|
+
function withoutRefusedEntries(prior, mounted) {
|
|
312
|
+
const REFUSABLE_NAME_FIELDS = ['toolDeny', 'toolAllow'];
|
|
313
|
+
const isRefusable = (f) => REFUSABLE_NAME_FIELDS.includes(f);
|
|
314
|
+
const next = {};
|
|
315
|
+
const removed = [];
|
|
316
|
+
for (const field of SESSION_POLICY_RULE_FIELDS) {
|
|
317
|
+
const list = Object.hasOwn(prior, field) ? prior[field] : undefined;
|
|
318
|
+
if (list === undefined)
|
|
319
|
+
continue;
|
|
320
|
+
if (!isRefusable(field)) {
|
|
321
|
+
next[field] = [...list];
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const kept = [];
|
|
325
|
+
const seen = new Set();
|
|
326
|
+
for (const x of list) {
|
|
327
|
+
if (!isEngineRefusedToolName(x) || mounted.has(x)) {
|
|
328
|
+
kept.push(x);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
if (seen.has(x))
|
|
332
|
+
continue;
|
|
333
|
+
seen.add(x);
|
|
334
|
+
removed.push({ field, rule: x });
|
|
335
|
+
}
|
|
336
|
+
next[field] = kept;
|
|
337
|
+
}
|
|
338
|
+
return { next, removed };
|
|
339
|
+
}
|
|
340
|
+
function removalFailed(failure, leg) {
|
|
341
|
+
const u = unknownFrom(failure, leg);
|
|
342
|
+
const message = u.message;
|
|
343
|
+
switch (u.why) {
|
|
344
|
+
case 'write_indeterminate':
|
|
345
|
+
return { kind: 'write_unconfirmed', why: 'write_indeterminate', ...(message !== undefined ? { message } : {}) };
|
|
346
|
+
case 'read_failed':
|
|
347
|
+
case 'read_unreadable':
|
|
348
|
+
return { kind: 'read_failed', why: u.why, ...(message !== undefined ? { message } : {}) };
|
|
349
|
+
case 'write_refused':
|
|
350
|
+
return { kind: 'write_refused', why: 'write_refused', ...(message !== undefined ? { message } : {}) };
|
|
351
|
+
case 'face_unavailable':
|
|
352
|
+
case 'session_not_found':
|
|
353
|
+
case 'session_ownerless':
|
|
354
|
+
case 'unauthorized':
|
|
355
|
+
case 'request_rejected':
|
|
356
|
+
case 'store_corrupt':
|
|
357
|
+
return leg === 'read'
|
|
358
|
+
? { kind: 'read_failed', why: u.why, ...(message !== undefined ? { message } : {}) }
|
|
359
|
+
: { kind: 'write_refused', why: u.why, ...(message !== undefined ? { message } : {}) };
|
|
360
|
+
default:
|
|
361
|
+
return leg === 'read'
|
|
362
|
+
? { kind: 'read_failed', why: 'read_failed', ...(message !== undefined ? { message } : {}) }
|
|
363
|
+
: { kind: 'write_unconfirmed', why: 'write_indeterminate', ...(message !== undefined ? { message } : {}) };
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
async function attemptRemoval(facade, sessionId, mounted, opts) {
|
|
367
|
+
const read = await readSessionPolicy(facade, sessionId, opts);
|
|
368
|
+
if (read.kind === 'failed')
|
|
369
|
+
return { done: removalFailed(read.failure, 'read') };
|
|
370
|
+
if (read.kind === 'malformed')
|
|
371
|
+
return { done: { kind: 'read_failed', why: 'read_unreadable', message: read.detail } };
|
|
372
|
+
const { next, removed } = withoutRefusedEntries(read.rules, mounted);
|
|
373
|
+
if (removed.length === 0)
|
|
374
|
+
return { done: { kind: 'nothing_to_remove', rev: read.rev } };
|
|
375
|
+
let receipt;
|
|
376
|
+
try {
|
|
377
|
+
receipt = await facade.putPolicy(sessionId, { rules: next, expectedRev: read.rev }, opts);
|
|
378
|
+
}
|
|
379
|
+
catch (e) {
|
|
380
|
+
const failure = classifySessionPolicyFailure(e);
|
|
381
|
+
if (failure.kind === 'loosen-forbidden')
|
|
382
|
+
return { done: { kind: 'loosen_forbidden', message: failure.message, refused: removed } };
|
|
383
|
+
if (failure.kind === 'cas-conflict')
|
|
384
|
+
return { retryAtRev: read.rev };
|
|
385
|
+
return { done: removalFailed(failure, 'write') };
|
|
386
|
+
}
|
|
387
|
+
let narrowed;
|
|
388
|
+
try {
|
|
389
|
+
narrowed = narrowStoredRecord(receipt);
|
|
390
|
+
}
|
|
391
|
+
catch {
|
|
392
|
+
narrowed = { ok: false, why: 'envelope', detail: 'policy write receipt could not be read' };
|
|
393
|
+
}
|
|
394
|
+
if (!narrowed.ok)
|
|
395
|
+
return { done: { kind: 'write_unconfirmed', why: 'write_receipt_unreadable', message: narrowed.detail } };
|
|
396
|
+
const mismatch = receiptMismatch(next, narrowed.rules, read.rev, narrowed.rev) ??
|
|
397
|
+
(removed.some((e) => {
|
|
398
|
+
const r = Object.hasOwn(narrowed.rules, e.field) ? narrowed.rules[e.field] : undefined;
|
|
399
|
+
return r !== undefined && r.includes(e.rule);
|
|
400
|
+
})
|
|
401
|
+
? 'the write receipt still holds an entry that was sent for removal'
|
|
402
|
+
: null);
|
|
403
|
+
if (mismatch !== null)
|
|
404
|
+
return { done: { kind: 'write_unconfirmed', why: 'write_receipt_mismatch', message: mismatch } };
|
|
405
|
+
return { done: { kind: 'removed', rev: narrowed.rev, removed } };
|
|
406
|
+
}
|
|
407
|
+
export async function removeRefusedSessionRules(facade, sessionId, roster, opts) {
|
|
408
|
+
const mounted = rosterMountedNames(roster);
|
|
409
|
+
if (typeof mounted === 'string')
|
|
410
|
+
return { kind: 'roster_required', why: mounted };
|
|
411
|
+
const first = await attemptRemoval(facade, sessionId, mounted, opts);
|
|
412
|
+
if ('done' in first)
|
|
413
|
+
return first.done;
|
|
414
|
+
hostLog('debug', 'sessionPolicyWire: the session rule record moved between this read and this removal — re-reading once and judging the other writer’s record again');
|
|
415
|
+
const second = await attemptRemoval(facade, sessionId, mounted, opts);
|
|
416
|
+
if ('done' in second)
|
|
417
|
+
return second.done;
|
|
418
|
+
return { kind: 'conflict', rev: second.retryAtRev };
|
|
419
|
+
}
|
|
420
|
+
export function sessionPolicyRemovalNotice(outcome) {
|
|
421
|
+
const generic = 'The session’s rule record may not have changed — re-read it before doing anything else.';
|
|
422
|
+
if (outcome === null || typeof outcome !== 'object')
|
|
423
|
+
return generic;
|
|
424
|
+
switch (outcome.kind) {
|
|
425
|
+
case 'roster_required':
|
|
426
|
+
return outcome.why === 'unreadable'
|
|
427
|
+
? 'The tool roster supplied for this removal could not be read, so nothing was changed: without it an entry that looks refused may name a tool this deployment mounts itself, and removing it would lift a restriction that is in effect. Supply the tool roster exactly as read from a run’s assembly manifest and try again.'
|
|
428
|
+
: 'No tool roster was supplied for this removal, so nothing was changed: without it an entry that looks refused may name a tool this deployment mounts itself, and removing it would lift a restriction that is in effect. Supply the tool roster from a run of this session on this deployment (a run that fails at startup reports none) and try again.';
|
|
429
|
+
case 'removed': {
|
|
430
|
+
const list = Array.isArray(outcome.removed) ? outcome.removed : [];
|
|
431
|
+
const n = list.length;
|
|
432
|
+
const what = n === 1 ? '1 entry' : `${n} entries`;
|
|
433
|
+
const fields = new Set(list.map((e) => (typeof e === 'object' && e !== null ? e.field : undefined)));
|
|
434
|
+
const deny = fields.has('toolDeny')
|
|
435
|
+
? ' Removing names from the deny list lifts no block on any tool mounted for this session’s runs; to block such a tool under its current name, add a new deny rule with that name.'
|
|
436
|
+
: '';
|
|
437
|
+
const allow = fields.has('toolAllow')
|
|
438
|
+
? ' Removing names from the allow list allows nothing new: the tools those names were meant to allow stay outside it, and an allow list left empty allows no tool at all; to allow such a tool under its current name, add its current name to the allow list.'
|
|
439
|
+
: '';
|
|
440
|
+
return `Removed ${what} from this session’s rule record (now at version ${outcome.rev}): ${n === 1 ? 'it names' : 'each names'} a tool the engine refuses, and no tool in the supplied roster answers to ${n === 1 ? 'it' : 'those names'}; this record no longer stops the session’s runs from starting.${deny}${allow}`;
|
|
441
|
+
}
|
|
442
|
+
case 'nothing_to_remove':
|
|
443
|
+
return 'This session’s rule record holds no entry naming a tool the engine refuses that the supplied roster does not mount, so nothing was changed. If runs still fail at startup over a refused tool name, that entry is set somewhere this record does not cover — the settings sent with the run, a parent session’s rule record, or the deployment’s own tool rules — or it is a name the engine refuses that this version does not yet recognise, or the failing run does not mount a tool the supplied roster has under that name.';
|
|
444
|
+
case 'loosen_forbidden':
|
|
445
|
+
return 'The engine refused to take these entries out of this session’s rule record: on this engine only an operator can remove entries from it, so the record is unchanged. Ask an operator to remove them, or continue in a new session.';
|
|
446
|
+
case 'conflict':
|
|
447
|
+
return 'This session’s rule record was changed by someone else while the refused entries were being removed, twice in a row — nothing was changed. Try again once the other change has finished.';
|
|
448
|
+
case 'read_failed':
|
|
449
|
+
switch (outcome.why) {
|
|
450
|
+
case 'face_unavailable':
|
|
451
|
+
return 'This deployment does not keep per-session tool rules, so there is no session rule record to remove entries from — nothing was changed.';
|
|
452
|
+
case 'session_not_found':
|
|
453
|
+
return 'This session is not readable from here — it may not exist, or it may belong to someone else; nothing was changed.';
|
|
454
|
+
case 'session_ownerless':
|
|
455
|
+
return 'This session has no owner, so it has no session rule record to change; nothing was changed.';
|
|
456
|
+
case 'unauthorized':
|
|
457
|
+
return 'This call could not present a verifiable identity, so nothing was changed.';
|
|
458
|
+
case 'store_corrupt':
|
|
459
|
+
return 'The engine could not establish which version this session’s rules are at, so nothing was changed. This needs an operator to look at the rule store.';
|
|
460
|
+
case 'read_unreadable':
|
|
461
|
+
return 'The session’s current rules could not be read, so nothing was changed — rewriting a record that cannot be read could replace real restrictions.';
|
|
462
|
+
default:
|
|
463
|
+
return 'The session’s current rules could not be fetched, so nothing was changed.';
|
|
464
|
+
}
|
|
465
|
+
case 'write_refused':
|
|
466
|
+
switch (outcome.why) {
|
|
467
|
+
case 'store_corrupt':
|
|
468
|
+
return 'The engine could not establish which version this session’s rules are at and refused to stamp a new one, so nothing was changed. This needs an operator to look at the rule store.';
|
|
469
|
+
case 'session_not_found':
|
|
470
|
+
return 'This session is not writable from here — it may not exist, or it may belong to someone else; nothing was changed.';
|
|
471
|
+
case 'unauthorized':
|
|
472
|
+
return 'This call could not present a verifiable identity, so nothing was changed.';
|
|
473
|
+
default:
|
|
474
|
+
return 'The engine refused this change, so nothing was changed. Re-read the session’s rules before trying again.';
|
|
475
|
+
}
|
|
476
|
+
case 'write_unconfirmed':
|
|
477
|
+
return 'The removal was sent but no clear answer came back from the engine — it may already be in effect. Run the removal again: it re-reads the record, and reports nothing left to remove if it did take effect.';
|
|
478
|
+
default:
|
|
479
|
+
return generic;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
@@ -4,7 +4,7 @@ import { type ApprovalMandateWord } from '../gateVocabulary.js';
|
|
|
4
4
|
import type { ToolPermissionRequest } from '../seatContract.js';
|
|
5
5
|
import { type DenyAttributionRefusalDetail } from '../wireRefusalCopy.js';
|
|
6
6
|
import { type DecideReceiptView } from '../decideReceipt.js';
|
|
7
|
-
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS
|
|
7
|
+
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS } from '@sema-agent/sdk';
|
|
8
8
|
import type { RuleSuggestion, 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';
|
|
9
9
|
export declare function isFsApprovalGate(gate: {
|
|
10
10
|
kind?: unknown;
|
|
@@ -58,7 +58,9 @@ export type AskOrigin = SdkAskOrigin;
|
|
|
58
58
|
export type RuleOffersAbsence = SdkRuleOffersAbsence;
|
|
59
59
|
export type DenialLimitKind = SdkDenialLimitKind;
|
|
60
60
|
export type DenialLimitFallback = SdkDenialLimitFallback;
|
|
61
|
-
export { RULE_OFFERS_ABSENCE_REASONS
|
|
61
|
+
export { RULE_OFFERS_ABSENCE_REASONS };
|
|
62
|
+
export declare const ASK_ORIGIN_WORDS: readonly string[];
|
|
63
|
+
export declare const APPROVAL_MANDATE_WORDS: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "write_protection_unresolved"];
|
|
62
64
|
export type WireRuleOffer = {
|
|
63
65
|
kind: 'single';
|
|
64
66
|
rule: string;
|
|
@@ -11,7 +11,7 @@ import { isApprovalMandateWord } from '../gateVocabulary.js';
|
|
|
11
11
|
import { denyAttributionRefusalFromError } from '../wireRefusalCopy.js';
|
|
12
12
|
import { decideFailureNote } from '../decideFailureNote.js';
|
|
13
13
|
import { readDecideReceipt } from '../decideReceipt.js';
|
|
14
|
-
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS,
|
|
14
|
+
import { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS, RULE_OFFERS_ABSENCE_REASONS, ASK_ORIGINS, PERSISTED_RULE_MANDATES, } from '@sema-agent/sdk';
|
|
15
15
|
export function isFsApprovalGate(gate) {
|
|
16
16
|
if (!gate)
|
|
17
17
|
return false;
|
|
@@ -52,7 +52,9 @@ export function structurallyEqual(a, b) {
|
|
|
52
52
|
return ka.every(k => structurallyEqual(a[k], b[k]));
|
|
53
53
|
}
|
|
54
54
|
export { RULE_OFFER_MATCHES, RULE_OFFER_BATCH_MEMBER_KINDS, RULE_OFFER_UNCOVERED_REASONS };
|
|
55
|
-
export { RULE_OFFERS_ABSENCE_REASONS
|
|
55
|
+
export { RULE_OFFERS_ABSENCE_REASONS };
|
|
56
|
+
export const ASK_ORIGIN_WORDS = ASK_ORIGINS;
|
|
57
|
+
export const APPROVAL_MANDATE_WORDS = PERSISTED_RULE_MANDATES;
|
|
56
58
|
export const APPROVAL_DENY_SETTLED_BY_WORDS = Object.freeze(['human', 'policy']);
|
|
57
59
|
export function readApprovalDenySettledBy(decision) {
|
|
58
60
|
if (decision === null || typeof decision !== 'object')
|
|
@@ -282,7 +284,7 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
282
284
|
kind: 'failed',
|
|
283
285
|
stage: 'decide',
|
|
284
286
|
gatedCallId,
|
|
285
|
-
reason: `decide(approve) failed: ${String(e)}${decideFailureNote(e)}`,
|
|
287
|
+
reason: `decide(approve) failed: ${String(e)}${decideFailureNote(e, 'approve')}`,
|
|
286
288
|
...(e instanceof DecideTransportRetryExhaustedError ? { retryExhausted: true } : {}),
|
|
287
289
|
...(currentPending !== undefined ? { currentPending } : {}),
|
|
288
290
|
...(wireCode !== undefined ? { errorCode: wireCode } : {}),
|
|
@@ -339,7 +341,7 @@ export async function surfaceFsApprovalAndDecide(deps, taskId, argsByCall, signa
|
|
|
339
341
|
kind: 'failed',
|
|
340
342
|
stage: 'decide',
|
|
341
343
|
gatedCallId,
|
|
342
|
-
reason: `decide(deny) failed: ${String(e)}${decideFailureNote(e)}`,
|
|
344
|
+
reason: `decide(deny) failed: ${String(e)}${decideFailureNote(e, 'deny')}`,
|
|
343
345
|
...(e instanceof DecideTransportRetryExhaustedError ? { retryExhausted: true } : {}),
|
|
344
346
|
...(currentPending !== undefined ? { currentPending } : {}),
|
|
345
347
|
...(wireCode !== undefined ? { errorCode: wireCode } : {}),
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export { _resetLiveQuestionStore, hasLocalQuestionResponder, hasQuestionOverlay,
|
|
|
22
22
|
export type { AskQuestion, AskQuestionOption, QuestionAnswer, QuestionFrame, } from './liveQuestionStore.js';
|
|
23
23
|
export * from './engineInlineTaskStats.js';
|
|
24
24
|
export * from './printToolResultFrame.js';
|
|
25
|
-
export
|
|
25
|
+
export { __resetEngineCapsCacheForTests, engineCapState, engineCapString, engineCapsGeneration, engineCapsSettled, engineCapTrue, engineCapValue, invalidateEngineCaps, kickEngineCapsProbe, } from './engineCapsCache.js';
|
|
26
|
+
export type { EngineCapState, EngineCapValueState, } from './engineCapsCache.js';
|
|
26
27
|
export * from './sqlEngineCapability.js';
|
|
27
28
|
export * from './writeProtectionCapability.js';
|
|
28
29
|
export * from './webSearchBackendCapability.js';
|
|
@@ -70,7 +71,8 @@ export * from './sseIdleTriage.js';
|
|
|
70
71
|
export * from './engineWireSdk.js';
|
|
71
72
|
export * from './classifierVerdictWire.js';
|
|
72
73
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
73
|
-
export {
|
|
74
|
+
export { findSystemReminderOpenTag, type SystemReminderOpenTagSpan } from './systemReminderTag.js';
|
|
75
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, 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, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, 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, 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, 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';
|
|
74
76
|
export type { DelegationCapDisposition, ModelFallbackReason, } from './engineErrorCodes.js';
|
|
75
77
|
export * from './agentsWireCaps.js';
|
|
76
78
|
export * from './attachmentsWireCaps.js';
|
|
@@ -87,6 +89,7 @@ export * from './oneShotWireCaps.js';
|
|
|
87
89
|
export * from './rewindWireCaps.js';
|
|
88
90
|
export * from './rewindArchiveCapability.js';
|
|
89
91
|
export * from './fileHistoryCaptureCapability.js';
|
|
92
|
+
export * from './sealedKeyCapability.js';
|
|
90
93
|
export * from './registryQuotaUsage.js';
|
|
91
94
|
export * from './selfOrchestrationWireCaps.js';
|
|
92
95
|
export * from './skillsWireCaps.js';
|
|
@@ -128,7 +131,7 @@ export * from './subagent/engineRowStopGate.js';
|
|
|
128
131
|
export * from './subagent/engineSubagentOutput.js';
|
|
129
132
|
export * from './subagent/engineSubagentSteer.js';
|
|
130
133
|
export { __resetRetainWithoutWakeWarningForTests, auditRetainWithoutWake, classifySubagentResumeFailure, resolveOwnerRunId, resolveSubagentContinueTarget, resolveSubagentResumeContext, resumeSettledSubagent, SUBAGENT_RESUME_CAP, subagentResumeAvailable, } from './subagent/engineSubagentResume.js';
|
|
131
|
-
export type { RetainWithoutWakeInput, RetainWithoutWakeVerdict, SubagentOwnerContext, SubagentResumeContext, SubagentResumeFacade, SubagentResumeFailureKind, SubagentResumeFailureVerdict, SubagentResumeOutcome, } from './subagent/engineSubagentResume.js';
|
|
134
|
+
export type { RetainWithoutWakeInput, RetainWithoutWakeVerdict, SubagentOwnerContext, SubagentResumeContext, SubagentResumeFacade, SubagentResumeFailureKind, SubagentResumeFailureVerdict, SubagentResumeOutcome, SubagentResumeWire, SubagentResumeWireClient, } from './subagent/engineSubagentResume.js';
|
|
132
135
|
export * from './subagent/engineTaskHandleWire.js';
|
|
133
136
|
export * from './subagent/engineCompactWire.js';
|
|
134
137
|
export * from './subagent/engineSubagentTail.js';
|
|
@@ -138,6 +141,8 @@ export { engineWireTarget, engineWireTargetFor, installEngineWireTarget, install
|
|
|
138
141
|
export type { EngineWireTarget, } from './engineWireTarget.js';
|
|
139
142
|
export * from './principalWire.js';
|
|
140
143
|
export * from './wireErrorTriage.js';
|
|
144
|
+
export * from './corruptSession.js';
|
|
145
|
+
export * from './corruptSessionCopy.js';
|
|
141
146
|
export * from './resumeRefusalCopy.js';
|
|
142
147
|
export * from './wireRefusalCopy.js';
|
|
143
148
|
export * from './decideReceipt.js';
|
|
@@ -186,6 +191,8 @@ export * from './agentSession/contract.js';
|
|
|
186
191
|
export * from './agentSession/backgroundView.js';
|
|
187
192
|
export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
|
|
188
193
|
export type { EngineAgentRegistryClient } from './agentSession/engineAgentRegistryRead.js';
|
|
194
|
+
export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
|
|
195
|
+
export type { EngineSessionBackgroundStopClient, EngineSessionBackgroundStopWire, EngineSessionBackgroundStopOptions, EngineSessionBackgroundReceipt, EngineSessionBackgroundStopUnavailableWhy, EngineSessionBackgroundStopRefusedWhy, EngineSessionBackgroundStopResult, EngineSessionBackgroundReceiptState, EngineSessionBackgroundReceiptReading, } from './agentSession/engineSessionBackgroundStop.js';
|
|
189
196
|
export * from './model/catalog.js';
|
|
190
197
|
export * from './model/catalogLoader.js';
|
|
191
198
|
export * from './model/providerAuth.js';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export * from './fleetAgentPanelProjection.js';
|
|
|
18
18
|
export { _resetLiveQuestionStore, hasLocalQuestionResponder, hasQuestionOverlay, hasQuestionOverlayFor, onQuestionFrame, onQuestionFrameFor, publishQuestionFrame, publishQuestionFrameFor, registerLocalQuestionResponder, respondToQuestion, setQuestionRespond, } from './liveQuestionStore.js';
|
|
19
19
|
export * from './engineInlineTaskStats.js';
|
|
20
20
|
export * from './printToolResultFrame.js';
|
|
21
|
-
export
|
|
21
|
+
export { __resetEngineCapsCacheForTests, engineCapState, engineCapString, engineCapsGeneration, engineCapsSettled, engineCapTrue, engineCapValue, invalidateEngineCaps, kickEngineCapsProbe, } from './engineCapsCache.js';
|
|
22
22
|
export * from './sqlEngineCapability.js';
|
|
23
23
|
export * from './writeProtectionCapability.js';
|
|
24
24
|
export * from './webSearchBackendCapability.js';
|
|
@@ -64,7 +64,8 @@ export * from './sseIdleTriage.js';
|
|
|
64
64
|
export * from './engineWireSdk.js';
|
|
65
65
|
export * from './classifierVerdictWire.js';
|
|
66
66
|
export { stripSystemReminderBlocks, unwrapSystemReminder } from './systemReminderTag.js';
|
|
67
|
-
export {
|
|
67
|
+
export { findSystemReminderOpenTag } from './systemReminderTag.js';
|
|
68
|
+
export { ACTIVE_RUN_BUSY_ERROR_CODE, asModelFallbackReason, CAPABILITY_SELF_ORCHESTRATION_REQUIRED, CONFIG_DELEGATION_ENTRY_CAPS, 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, GATE_PARKED_ERROR_CODE, isConfigRefusalCode, isCorruptSessionCode, isDecideParkMovedCode, isDelegationCapCode, isInterruptedToolEndCode, isLimitsExceededCode, isRewindFamilyCode, 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, 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, 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';
|
|
68
69
|
export * from './agentsWireCaps.js';
|
|
69
70
|
export * from './attachmentsWireCaps.js';
|
|
70
71
|
export * from './clientContextWireCaps.js';
|
|
@@ -80,6 +81,7 @@ export * from './oneShotWireCaps.js';
|
|
|
80
81
|
export * from './rewindWireCaps.js';
|
|
81
82
|
export * from './rewindArchiveCapability.js';
|
|
82
83
|
export * from './fileHistoryCaptureCapability.js';
|
|
84
|
+
export * from './sealedKeyCapability.js';
|
|
83
85
|
export * from './registryQuotaUsage.js';
|
|
84
86
|
export * from './selfOrchestrationWireCaps.js';
|
|
85
87
|
export * from './skillsWireCaps.js';
|
|
@@ -127,6 +129,8 @@ export * from './engineSessionParam.js';
|
|
|
127
129
|
export { engineWireTarget, engineWireTargetFor, installEngineWireTarget, installEngineWireTargetFor, } from './engineWireTarget.js';
|
|
128
130
|
export * from './principalWire.js';
|
|
129
131
|
export * from './wireErrorTriage.js';
|
|
132
|
+
export * from './corruptSession.js';
|
|
133
|
+
export * from './corruptSessionCopy.js';
|
|
130
134
|
export * from './resumeRefusalCopy.js';
|
|
131
135
|
export * from './wireRefusalCopy.js';
|
|
132
136
|
export * from './decideReceipt.js';
|
|
@@ -172,6 +176,7 @@ export * from './seatContract.js';
|
|
|
172
176
|
export * from './agentSession/contract.js';
|
|
173
177
|
export * from './agentSession/backgroundView.js';
|
|
174
178
|
export { readEngineAgentRegistry, isEngineAgentRegistryListingSuperseded } from './agentSession/engineAgentRegistryRead.js';
|
|
179
|
+
export { stopEngineSessionBackground, engineSessionBackgroundReceiptReadingOf, ENGINE_SESSION_BACKGROUND_RECEIPT_STATES, } from './agentSession/engineSessionBackgroundStop.js';
|
|
175
180
|
export * from './model/catalog.js';
|
|
176
181
|
export * from './model/catalogLoader.js';
|
|
177
182
|
export * from './model/providerAuth.js';
|
package/dist/liveInitToolFace.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { makeEngineWireClient, resolveWireAuth } from './engineWireSdk.js';
|
|
2
|
+
import { settleWithinDeadline } from './abortableSleep.js';
|
|
2
3
|
import { hostLog } from './host.js';
|
|
3
4
|
import { scenarioForPrint } from './scenarioWire.js';
|
|
4
5
|
import { resolveHeadlessInteractiveTools } from './interactiveToolsWire.js';
|
|
@@ -58,17 +59,34 @@ export function _resetLiveInitToolFaceForTest() {
|
|
|
58
59
|
cached = null;
|
|
59
60
|
}
|
|
60
61
|
export async function probeScenarioTools(baseUrl, scenario, opts) {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
const injected = opts?.client;
|
|
63
|
+
let body;
|
|
64
|
+
if (injected !== undefined) {
|
|
65
|
+
if (typeof injected?.scenarioCapabilities !== 'function')
|
|
66
|
+
return null;
|
|
67
|
+
const got = await settleWithinDeadline(opts?.timeoutMs ?? 2000, (signal) => injected.scenarioCapabilities(scenario, { signal }));
|
|
68
|
+
if (got.kind !== 'value')
|
|
69
|
+
return null;
|
|
70
|
+
body = got.value;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const client = makeEngineWireClient({
|
|
74
|
+
baseUrl,
|
|
75
|
+
...(opts?.authToken ? { token: opts.authToken } : {}),
|
|
76
|
+
...(opts?.principal ? { principal: opts.principal } : {}),
|
|
77
|
+
timeoutMs: opts?.timeoutMs ?? 2000,
|
|
78
|
+
...(opts?.fetchImpl ? { fetchImpl: opts.fetchImpl } : {}),
|
|
79
|
+
});
|
|
80
|
+
if (!client)
|
|
81
|
+
return null;
|
|
82
|
+
try {
|
|
83
|
+
body = await client.scenarioCapabilities(scenario);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
70
89
|
try {
|
|
71
|
-
const body = await client.scenarioCapabilities(scenario);
|
|
72
90
|
if (!Array.isArray(body?.tools))
|
|
73
91
|
return null;
|
|
74
92
|
const names = body.tools.filter((t) => typeof t === 'string' && t.length > 0);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type TaskRequestPermissionMode } from './taskRequestWords.js';
|
|
2
|
+
export type PermissionMode = TaskRequestPermissionMode;
|
|
2
3
|
export interface PermissionModeField {
|
|
3
4
|
permissionMode?: PermissionMode;
|
|
4
5
|
}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
'plan',
|
|
4
|
-
'acceptEdits',
|
|
5
|
-
'bypassPermissions',
|
|
6
|
-
'auto',
|
|
7
|
-
]);
|
|
1
|
+
import { PERMISSION_MODE_WORDS } from './taskRequestWords.js';
|
|
2
|
+
const KNOWN = new Set(PERMISSION_MODE_WORDS);
|
|
8
3
|
export function permissionModeField(mode, opts) {
|
|
9
4
|
if (typeof mode === 'string' && mode !== 'default' && KNOWN.has(mode)) {
|
|
10
5
|
return { permissionMode: mode };
|
|
@@ -49,6 +49,7 @@ export interface TaskRequestInput {
|
|
|
49
49
|
memoryCapture?: 'off';
|
|
50
50
|
memory?: 'off';
|
|
51
51
|
approverPosture?: NonNullable<TaskRequest['approverPosture']>;
|
|
52
|
+
fileHistory?: 'disabled';
|
|
52
53
|
rewind?: Record<string, unknown>;
|
|
53
54
|
repo?: string;
|
|
54
55
|
council?: boolean;
|
|
@@ -102,6 +103,7 @@ export declare const APPROVER_POSTURE_BYPASS: "bypass";
|
|
|
102
103
|
export declare function approverPostureDeclarationField(declared: boolean): {
|
|
103
104
|
approverPosture: 'bypass';
|
|
104
105
|
} | Record<string, never>;
|
|
106
|
+
export declare const FILE_HISTORY_DISABLED: "disabled";
|
|
105
107
|
export declare function memoryOffDeclared(input: {
|
|
106
108
|
flag?: unknown;
|
|
107
109
|
settingsMemory?: unknown;
|