@sema-agent/client-core 0.85.2 → 0.86.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 +208 -0
- package/README.md +20 -13
- package/dist/adapt/arms.js +5 -1
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +3 -3
- package/dist/agentSession/backgroundView.js +7 -1
- package/dist/agentSession/contract.d.ts +1 -1
- package/dist/centerWiringCapability.d.ts +38 -0
- package/dist/centerWiringCapability.js +202 -0
- package/dist/decideFailureNote.js +3 -0
- package/dist/engineCapReader.d.ts +8 -0
- package/dist/engineCapReader.js +15 -0
- package/dist/engineErrorCodes.d.ts +3 -0
- package/dist/engineErrorCodes.js +8 -0
- package/dist/engineNoticeCodes.d.ts +62 -0
- package/dist/engineNoticeCodes.js +247 -29
- package/dist/executionLaneCapability.d.ts +6 -0
- package/dist/executionLaneCapability.js +55 -2
- package/dist/fleet/fleetProjection.js +6 -8
- package/dist/fleet/workflowSizeWarning.js +2 -5
- package/dist/gateOutcome.d.ts +13 -0
- package/dist/gateOutcome.js +48 -1
- package/dist/gateVocabulary.d.ts +6 -3
- package/dist/gateVocabulary.js +7 -15
- package/dist/generated/engineFactTables.d.ts +10 -0
- package/dist/generated/engineFactTables.js +113 -0
- package/dist/generated/engineNoticeTables.js +14 -0
- package/dist/hitl/refusedToolNameProse.d.ts +4 -0
- package/dist/hitl/refusedToolNameProse.js +7 -0
- package/dist/hitl/sessionPolicyDeliverable.js +9 -5
- package/dist/hitl/sessionPolicyWire.d.ts +16 -0
- package/dist/hitl/sessionPolicyWire.js +49 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/inheritEnvWire.d.ts +22 -0
- package/dist/inheritEnvWire.js +84 -0
- package/dist/peerFrames.js +2 -10
- package/dist/printInitToolFace.d.ts +6 -0
- package/dist/printInitToolFace.js +115 -2
- package/dist/readCredentialRefusal.d.ts +2 -0
- package/dist/readCredentialRefusal.js +7 -0
- package/dist/request/taskRequest.d.ts +4 -5
- package/dist/request/taskRequest.js +33 -23
- package/dist/runTerminal.js +2 -6
- package/dist/sqlEngineCapability.js +15 -2
- package/dist/storePostureCapability.d.ts +25 -0
- package/dist/storePostureCapability.js +132 -0
- package/dist/toolResult.js +2 -47
- package/dist/wireErrorTriage.d.ts +1 -0
- package/dist/wireErrorTriage.js +3 -0
- package/dist/wireFailureShape.d.ts +3 -0
- package/dist/wireFailureShape.js +44 -0
- package/dist/wireRefusalCopy.d.ts +39 -1
- package/dist/wireRefusalCopy.js +350 -2
- package/dist/workflowClient.d.ts +4 -0
- package/dist/workflowClient.js +12 -4
- package/docs/INTEGRATION-CLIENTS.md +716 -14
- package/package.json +2 -2
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { AUTO_MODE_UNAVAILABLE_CAUSES } from './autoModeUnavailable.js';
|
|
1
2
|
import { CORE_ENGINE_NOTICE_CODES, CORE_MCP_INJECTION_DROP_REASONS, CORE_NOTICE_AUDIENCE } from './generated/engineNoticeTables.js';
|
|
3
|
+
import { CORE_ASK_UNRESOLVABLE_CAUSES, CORE_DURABLE_MANDATE_SOURCES, CORE_PERMISSION_MODE_FOLD_REASONS, } from './generated/engineFactTables.js';
|
|
2
4
|
export const ENGINE_NOTICE_CODES = CORE_ENGINE_NOTICE_CODES;
|
|
3
5
|
const CATALOG = new Set(ENGINE_NOTICE_CODES);
|
|
4
6
|
export const SERVER_NOTICE_AUDIENCE = Object.freeze({
|
|
@@ -30,20 +32,28 @@ export function readMcpInjectionDrop(notice) {
|
|
|
30
32
|
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
31
33
|
return undefined;
|
|
32
34
|
const o = d;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
35
|
+
const sessionIdIn = o.sessionId;
|
|
36
|
+
const serverIn = o.server;
|
|
37
|
+
const reasonIn = o.reason;
|
|
38
|
+
const sessionId = typeof sessionIdIn === 'string' && sessionIdIn.length > 0 ? sessionIdIn : undefined;
|
|
39
|
+
const server = typeof serverIn === 'string' && serverIn.length > 0 ? serverIn : undefined;
|
|
40
|
+
const reason = typeof reasonIn === 'string' && DROP_REASONS.has(reasonIn) ? reasonIn : undefined;
|
|
36
41
|
if (sessionId === undefined || server === undefined || reason === undefined)
|
|
37
42
|
return undefined;
|
|
38
|
-
const
|
|
43
|
+
const fieldIn = o.field;
|
|
44
|
+
const field = typeof fieldIn === 'string' && fieldIn.length > 0 ? fieldIn : undefined;
|
|
39
45
|
return { sessionId, server, reason, ...(field !== undefined ? { field } : {}) };
|
|
40
46
|
}
|
|
41
|
-
export const ASK_UNRESOLVABLE_CAUSES =
|
|
42
|
-
'approver_unavailable',
|
|
43
|
-
'no_approver_wired',
|
|
44
|
-
'mandate_unreconstructible',
|
|
45
|
-
]);
|
|
47
|
+
export const ASK_UNRESOLVABLE_CAUSES = CORE_ASK_UNRESOLVABLE_CAUSES;
|
|
46
48
|
const ASK_UNRESOLVABLE_CAUSE_SET = new Set(ASK_UNRESOLVABLE_CAUSES);
|
|
49
|
+
function optionalSeat(o, key) {
|
|
50
|
+
try {
|
|
51
|
+
return o[key];
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
47
57
|
export function readAskUnresolvable(notice) {
|
|
48
58
|
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
49
59
|
return undefined;
|
|
@@ -54,25 +64,29 @@ export function readAskUnresolvable(notice) {
|
|
|
54
64
|
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
55
65
|
return undefined;
|
|
56
66
|
const o = d;
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
67
|
+
const sessionIdIn = o.sessionId;
|
|
68
|
+
const toolNameIn = o.toolName;
|
|
69
|
+
const toolCallIdIn = o.toolCallId;
|
|
70
|
+
const causeIn = o.cause;
|
|
71
|
+
const sessionId = typeof sessionIdIn === 'string' && sessionIdIn.length > 0 ? sessionIdIn : undefined;
|
|
72
|
+
const toolName = typeof toolNameIn === 'string' && toolNameIn.length > 0 ? toolNameIn : undefined;
|
|
73
|
+
const toolCallId = typeof toolCallIdIn === 'string' && toolCallIdIn.length > 0 ? toolCallIdIn : undefined;
|
|
74
|
+
const cause = typeof causeIn === 'string' && ASK_UNRESOLVABLE_CAUSE_SET.has(causeIn) ? causeIn : undefined;
|
|
61
75
|
if (sessionId === undefined || toolName === undefined || toolCallId === undefined || cause === undefined) {
|
|
62
76
|
return undefined;
|
|
63
77
|
}
|
|
78
|
+
const parkIn = o.parkLaneExisted;
|
|
79
|
+
const remedyIn = optionalSeat(o, 'remedy');
|
|
64
80
|
return {
|
|
65
81
|
sessionId,
|
|
66
82
|
toolName,
|
|
67
83
|
toolCallId,
|
|
68
84
|
cause,
|
|
69
|
-
...(typeof
|
|
85
|
+
...(typeof parkIn === 'boolean' ? { parkLaneExisted: parkIn } : {}),
|
|
86
|
+
...(typeof remedyIn === 'string' && remedyIn.length > 0 ? { remedy: remedyIn } : {}),
|
|
70
87
|
};
|
|
71
88
|
}
|
|
72
|
-
export const DURABLE_MANDATE_SOURCES =
|
|
73
|
-
'force_durable_gate',
|
|
74
|
-
'durable_approval',
|
|
75
|
-
]);
|
|
89
|
+
export const DURABLE_MANDATE_SOURCES = CORE_DURABLE_MANDATE_SOURCES;
|
|
76
90
|
const DURABLE_MANDATE_SOURCE_SET = new Set(DURABLE_MANDATE_SOURCES);
|
|
77
91
|
export function readDurableGateUnavailable(notice) {
|
|
78
92
|
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
@@ -84,26 +98,41 @@ export function readDurableGateUnavailable(notice) {
|
|
|
84
98
|
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
85
99
|
return undefined;
|
|
86
100
|
const o = d;
|
|
87
|
-
const
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
101
|
+
const sessionIdIn = o.sessionId;
|
|
102
|
+
const runIdIn = o.runId;
|
|
103
|
+
const sourceIn = o.source;
|
|
104
|
+
const causeIn = o.cause;
|
|
105
|
+
const sessionId = typeof sessionIdIn === 'string' && sessionIdIn.length > 0 ? sessionIdIn : undefined;
|
|
106
|
+
const runId = typeof runIdIn === 'string' && runIdIn.length > 0 ? runIdIn : undefined;
|
|
107
|
+
const source = typeof sourceIn === 'string' && DURABLE_MANDATE_SOURCE_SET.has(sourceIn) ? sourceIn : undefined;
|
|
108
|
+
const cause = typeof causeIn === 'string' && causeIn.length > 0 ? causeIn : undefined;
|
|
91
109
|
if (sessionId === undefined || runId === undefined || source === undefined || cause === undefined) {
|
|
92
110
|
return undefined;
|
|
93
111
|
}
|
|
94
|
-
const
|
|
112
|
+
const principalIn = o.principal;
|
|
113
|
+
const principal = typeof principalIn === 'string' && principalIn.length > 0 ? principalIn : undefined;
|
|
114
|
+
const liveApprover = o.liveApprover;
|
|
115
|
+
const liveQuestionFace = o.liveQuestionFace;
|
|
95
116
|
return {
|
|
96
117
|
sessionId,
|
|
97
118
|
runId,
|
|
98
119
|
...(principal !== undefined ? { principal } : {}),
|
|
99
120
|
source,
|
|
100
121
|
cause,
|
|
101
|
-
...(typeof
|
|
102
|
-
...(typeof
|
|
122
|
+
...(typeof liveApprover === 'boolean' ? { liveApprover } : {}),
|
|
123
|
+
...(typeof liveQuestionFace === 'boolean' ? { liveQuestionFace } : {}),
|
|
103
124
|
};
|
|
104
125
|
}
|
|
105
126
|
const nonNegInt = (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : undefined;
|
|
106
|
-
const nameList = (v) =>
|
|
127
|
+
const nameList = (v) => {
|
|
128
|
+
if (!Array.isArray(v))
|
|
129
|
+
return undefined;
|
|
130
|
+
const n = v.length;
|
|
131
|
+
const copy = [];
|
|
132
|
+
for (let i = 0; i < n; i++)
|
|
133
|
+
copy.push(v[i]);
|
|
134
|
+
return copy.every((x) => typeof x === 'string' && x.length > 0) ? Object.freeze(copy) : undefined;
|
|
135
|
+
};
|
|
107
136
|
export function readSkillsListingTruncated(notice) {
|
|
108
137
|
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
109
138
|
return undefined;
|
|
@@ -123,7 +152,8 @@ export function readSkillsListingTruncated(notice) {
|
|
|
123
152
|
return undefined;
|
|
124
153
|
}
|
|
125
154
|
const descMaxChars = nonNegInt(o.descMaxChars);
|
|
126
|
-
const
|
|
155
|
+
const sessionIdIn = o.sessionId;
|
|
156
|
+
const sessionId = typeof sessionIdIn === 'string' && sessionIdIn.length > 0 ? sessionIdIn : undefined;
|
|
127
157
|
return {
|
|
128
158
|
budgetBytes,
|
|
129
159
|
...(descMaxChars !== undefined ? { descMaxChars } : {}),
|
|
@@ -148,7 +178,8 @@ export function readMcpServerRedialed(notice) {
|
|
|
148
178
|
const str = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
149
179
|
const count = (v) => (typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : undefined);
|
|
150
180
|
const server = str(o.server);
|
|
151
|
-
const
|
|
181
|
+
const outcomeIn = o.outcome;
|
|
182
|
+
const outcome = typeof outcomeIn === 'string' && MCP_REDIAL_OUTCOMES.includes(outcomeIn) ? outcomeIn : undefined;
|
|
152
183
|
const added = count(o.added);
|
|
153
184
|
const removed = count(o.removed);
|
|
154
185
|
const sessionId = str(o.sessionId);
|
|
@@ -224,7 +255,8 @@ export function readInstructionsSourceChanged(notice) {
|
|
|
224
255
|
const o = d;
|
|
225
256
|
const previous = ownPathOrNull(o, 'previous');
|
|
226
257
|
const current = ownPathOrNull(o, 'current');
|
|
227
|
-
const
|
|
258
|
+
const sessionIdIn = o.sessionId;
|
|
259
|
+
const sessionId = typeof sessionIdIn === 'string' && sessionIdIn.length > 0 ? sessionIdIn : undefined;
|
|
228
260
|
if (previous === undefined || current === undefined || sessionId === undefined)
|
|
229
261
|
return undefined;
|
|
230
262
|
return { previous, current, sessionId };
|
|
@@ -271,6 +303,186 @@ export function sessionRecordsSkippedNote(facts) {
|
|
|
271
303
|
return ("None of this session's earlier entries could be read, so this turn runs with an empty context — the model sees nothing of the earlier conversation. " +
|
|
272
304
|
'If that history matters, whoever operates this engine has to repair the stored log of this session.');
|
|
273
305
|
}
|
|
306
|
+
const nonEmpty = (v) => (typeof v === 'string' && v.length > 0 ? v : undefined);
|
|
307
|
+
function guardedRead(notice, read) {
|
|
308
|
+
try {
|
|
309
|
+
return read(notice);
|
|
310
|
+
}
|
|
311
|
+
catch {
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export function readRuleStoreUnavailable(notice) {
|
|
316
|
+
return guardedRead(notice, readRuleStoreUnavailableOf);
|
|
317
|
+
}
|
|
318
|
+
function readRuleStoreUnavailableOf(notice) {
|
|
319
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
320
|
+
return undefined;
|
|
321
|
+
const n = notice;
|
|
322
|
+
if (n.code !== 'permission.rule_store_unavailable')
|
|
323
|
+
return undefined;
|
|
324
|
+
const d = n.detail;
|
|
325
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
326
|
+
return undefined;
|
|
327
|
+
const o = d;
|
|
328
|
+
const at = nonEmpty(o.at);
|
|
329
|
+
const sessionId = nonEmpty(o.sessionId);
|
|
330
|
+
const runId = nonEmpty(o.runId);
|
|
331
|
+
if (at === undefined || sessionId === undefined || runId === undefined)
|
|
332
|
+
return undefined;
|
|
333
|
+
return { at, sessionId, runId };
|
|
334
|
+
}
|
|
335
|
+
const CLASSIFIER_UNAVAILABLE_DISPOSITIONS = Object.freeze(['asked', 'denied']);
|
|
336
|
+
const _classifierDispositionPin = true;
|
|
337
|
+
void _classifierDispositionPin;
|
|
338
|
+
const AUTO_MODE_UNAVAILABLE_CAUSE_SET = new Set(AUTO_MODE_UNAVAILABLE_CAUSES);
|
|
339
|
+
export function readClassifierUnavailable(notice) {
|
|
340
|
+
return guardedRead(notice, readClassifierUnavailableOf);
|
|
341
|
+
}
|
|
342
|
+
function readClassifierUnavailableOf(notice) {
|
|
343
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
344
|
+
return undefined;
|
|
345
|
+
const n = notice;
|
|
346
|
+
if (n.code !== 'classifier.unavailable')
|
|
347
|
+
return undefined;
|
|
348
|
+
const d = n.detail;
|
|
349
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
350
|
+
return undefined;
|
|
351
|
+
const o = d;
|
|
352
|
+
const toolName = nonEmpty(o.toolName);
|
|
353
|
+
const toolCallId = nonEmpty(o.toolCallId);
|
|
354
|
+
const causeIn = o.cause;
|
|
355
|
+
const dispositionIn = o.disposition;
|
|
356
|
+
const cause = typeof causeIn === 'string' && AUTO_MODE_UNAVAILABLE_CAUSE_SET.has(causeIn) ? causeIn : undefined;
|
|
357
|
+
const disposition = CLASSIFIER_UNAVAILABLE_DISPOSITIONS.includes(dispositionIn)
|
|
358
|
+
? dispositionIn
|
|
359
|
+
: undefined;
|
|
360
|
+
if (toolName === undefined || toolCallId === undefined || cause === undefined || disposition === undefined)
|
|
361
|
+
return undefined;
|
|
362
|
+
const sessionId = nonEmpty(optionalSeat(o, 'sessionId'));
|
|
363
|
+
const runId = nonEmpty(optionalSeat(o, 'runId'));
|
|
364
|
+
return {
|
|
365
|
+
toolName,
|
|
366
|
+
toolCallId,
|
|
367
|
+
cause,
|
|
368
|
+
disposition,
|
|
369
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
370
|
+
...(runId !== undefined ? { runId } : {}),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
export const PERMISSION_MODE_FOLD_REASONS = CORE_PERMISSION_MODE_FOLD_REASONS;
|
|
374
|
+
const PERMISSION_MODE_FOLD_REASON_SET = new Set(PERMISSION_MODE_FOLD_REASONS);
|
|
375
|
+
export function readPermissionModeUnavailable(notice) {
|
|
376
|
+
return guardedRead(notice, readPermissionModeUnavailableOf);
|
|
377
|
+
}
|
|
378
|
+
function readPermissionModeUnavailableOf(notice) {
|
|
379
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
380
|
+
return undefined;
|
|
381
|
+
const n = notice;
|
|
382
|
+
if (n.code !== 'config.permission_mode_unavailable')
|
|
383
|
+
return undefined;
|
|
384
|
+
const d = n.detail;
|
|
385
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
386
|
+
return undefined;
|
|
387
|
+
const o = d;
|
|
388
|
+
const requested = nonEmpty(o.requested);
|
|
389
|
+
const effective = nonEmpty(o.effective);
|
|
390
|
+
const byIn = o.by;
|
|
391
|
+
const by = typeof byIn === 'string' && PERMISSION_MODE_FOLD_REASON_SET.has(byIn) ? byIn : undefined;
|
|
392
|
+
const sessionId = nonEmpty(o.sessionId);
|
|
393
|
+
const runId = nonEmpty(o.runId);
|
|
394
|
+
if (requested === undefined || effective === undefined || by === undefined || sessionId === undefined || runId === undefined) {
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
const childSessionId = nonEmpty(optionalSeat(o, 'childSessionId'));
|
|
398
|
+
return { requested, effective, by, sessionId, runId, ...(childSessionId !== undefined ? { childSessionId } : {}) };
|
|
399
|
+
}
|
|
400
|
+
export function readAskReleasedByMode(notice) {
|
|
401
|
+
return guardedRead(notice, readAskReleasedByModeOf);
|
|
402
|
+
}
|
|
403
|
+
function readAskReleasedByModeOf(notice) {
|
|
404
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
405
|
+
return undefined;
|
|
406
|
+
const n = notice;
|
|
407
|
+
if (n.code !== 'permission.ask_released_by_mode')
|
|
408
|
+
return undefined;
|
|
409
|
+
const d = n.detail;
|
|
410
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
411
|
+
return undefined;
|
|
412
|
+
const o = d;
|
|
413
|
+
const mode = nonEmpty(o.mode);
|
|
414
|
+
const askClass = nonEmpty(o.askClass);
|
|
415
|
+
const count = nonNegInt(o.count);
|
|
416
|
+
const firstToolCallId = nonEmpty(o.firstToolCallId);
|
|
417
|
+
if (mode === undefined || askClass === undefined || count === undefined || count < 1 || firstToolCallId === undefined) {
|
|
418
|
+
return undefined;
|
|
419
|
+
}
|
|
420
|
+
const origin = nonEmpty(optionalSeat(o, 'origin'));
|
|
421
|
+
const mandate = nonEmpty(optionalSeat(o, 'mandate'));
|
|
422
|
+
const sessionId = nonEmpty(optionalSeat(o, 'sessionId'));
|
|
423
|
+
const runId = nonEmpty(optionalSeat(o, 'runId'));
|
|
424
|
+
return {
|
|
425
|
+
mode,
|
|
426
|
+
askClass,
|
|
427
|
+
...(origin !== undefined ? { origin } : {}),
|
|
428
|
+
...(mandate !== undefined ? { mandate } : {}),
|
|
429
|
+
count,
|
|
430
|
+
firstToolCallId,
|
|
431
|
+
...(sessionId !== undefined ? { sessionId } : {}),
|
|
432
|
+
...(runId !== undefined ? { runId } : {}),
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
export function readReadDenyUnapplied(notice) {
|
|
436
|
+
return guardedRead(notice, readReadDenyUnappliedOf);
|
|
437
|
+
}
|
|
438
|
+
function readReadDenyUnappliedOf(notice) {
|
|
439
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
440
|
+
return undefined;
|
|
441
|
+
const n = notice;
|
|
442
|
+
if (n.code !== 'permission.read_deny_unapplied')
|
|
443
|
+
return undefined;
|
|
444
|
+
const d = n.detail;
|
|
445
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
446
|
+
return undefined;
|
|
447
|
+
const o = d;
|
|
448
|
+
const mode = nonEmpty(o.mode);
|
|
449
|
+
const toolCallId = nonEmpty(o.toolCallId);
|
|
450
|
+
const tiers = nameList(o.tiers);
|
|
451
|
+
const rows = nameList(o.rows);
|
|
452
|
+
const rowCount = nonNegInt(o.rowCount);
|
|
453
|
+
const sessionId = nonEmpty(o.sessionId);
|
|
454
|
+
const runId = nonEmpty(o.runId);
|
|
455
|
+
if (mode === undefined || toolCallId === undefined || tiers === undefined || rows === undefined ||
|
|
456
|
+
rowCount === undefined || sessionId === undefined || runId === undefined) {
|
|
457
|
+
return undefined;
|
|
458
|
+
}
|
|
459
|
+
return { mode, toolCallId, tiers, rows, rowCount, sessionId, runId };
|
|
460
|
+
}
|
|
461
|
+
export function readLegacyModeSeedMigrated(notice) {
|
|
462
|
+
return guardedRead(notice, readLegacyModeSeedMigratedOf);
|
|
463
|
+
}
|
|
464
|
+
function readLegacyModeSeedMigratedOf(notice) {
|
|
465
|
+
if (typeof notice !== 'object' || notice === null || Array.isArray(notice))
|
|
466
|
+
return undefined;
|
|
467
|
+
const n = notice;
|
|
468
|
+
if (n.code !== 'resume.legacy_mode_seed_migrated')
|
|
469
|
+
return undefined;
|
|
470
|
+
const d = n.detail;
|
|
471
|
+
if (typeof d !== 'object' || d === null || Array.isArray(d))
|
|
472
|
+
return undefined;
|
|
473
|
+
const o = d;
|
|
474
|
+
const m = o.migrated;
|
|
475
|
+
if (typeof m !== 'object' || m === null || Array.isArray(m))
|
|
476
|
+
return undefined;
|
|
477
|
+
const mo = m;
|
|
478
|
+
const droppedKeys = nameList(mo.droppedKeys);
|
|
479
|
+
const sessionId = nonEmpty(o.sessionId);
|
|
480
|
+
const runId = nonEmpty(o.runId);
|
|
481
|
+
if (droppedKeys === undefined || sessionId === undefined || runId === undefined)
|
|
482
|
+
return undefined;
|
|
483
|
+
const permissionMode = nonEmpty(optionalSeat(mo, 'permissionMode'));
|
|
484
|
+
return { ...(permissionMode !== undefined ? { permissionMode } : {}), droppedKeys, sessionId, runId };
|
|
485
|
+
}
|
|
274
486
|
export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
275
487
|
'mcp.injection_dropped': readMcpInjectionDrop,
|
|
276
488
|
'delegation.ask_unresolvable': readAskUnresolvable,
|
|
@@ -281,6 +493,12 @@ export const ENGINE_NOTICE_FACT_READERS = Object.freeze({
|
|
|
281
493
|
'approval.read_root_granted': readReadRootGrantNotice,
|
|
282
494
|
'approval.read_root_grant_rejected': readReadRootGrantNotice,
|
|
283
495
|
'session.records_skipped': readSessionRecordsSkipped,
|
|
496
|
+
'permission.rule_store_unavailable': readRuleStoreUnavailable,
|
|
497
|
+
'classifier.unavailable': readClassifierUnavailable,
|
|
498
|
+
'config.permission_mode_unavailable': readPermissionModeUnavailable,
|
|
499
|
+
'permission.ask_released_by_mode': readAskReleasedByMode,
|
|
500
|
+
'permission.read_deny_unapplied': readReadDenyUnapplied,
|
|
501
|
+
'resume.legacy_mode_seed_migrated': readLegacyModeSeedMigrated,
|
|
284
502
|
});
|
|
285
503
|
const _factReaderTablePin = true;
|
|
286
504
|
void _factReaderTablePin;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export type ExecutionLaneIsolatedAbsence = 'no_hands' | 'not_reported' | 'unreadable';
|
|
1
2
|
export interface ExecutionLaneCapabilityView {
|
|
2
3
|
provider: string;
|
|
3
4
|
toolsOnThisHost: boolean;
|
|
5
|
+
isolated?: boolean;
|
|
6
|
+
isolatedAbsent?: ExecutionLaneIsolatedAbsence;
|
|
4
7
|
}
|
|
5
8
|
export type ExecutionLaneReading = {
|
|
6
9
|
kind: 'unobserved';
|
|
@@ -11,11 +14,14 @@ export type ExecutionLaneReading = {
|
|
|
11
14
|
view: ExecutionLaneCapabilityView;
|
|
12
15
|
};
|
|
13
16
|
export declare function projectExecutionLaneCapability(caps: unknown): ExecutionLaneReading | undefined;
|
|
17
|
+
export declare function projectExecutionLaneWiring(wiring: unknown): ExecutionLaneReading | undefined;
|
|
14
18
|
export declare function noteEngineCapsForExecutionLane(baseUrl: string, caps: unknown, opts?: {
|
|
15
19
|
generation?: number;
|
|
16
20
|
}): void;
|
|
17
21
|
export declare function observedExecutionLane(baseUrl?: string | undefined): ExecutionLaneReading;
|
|
18
22
|
export declare function toolsRunHereFromExecutionLane(reading: ExecutionLaneReading, legacyInference: boolean): boolean;
|
|
23
|
+
export declare function noOsSandboxOnThisHost(reading: ExecutionLaneReading): 'yes' | 'no' | 'unknown';
|
|
24
|
+
export declare function noOsSandboxContent(): string;
|
|
19
25
|
export declare function executionLaneDoctorDetail(reading: ExecutionLaneReading): string;
|
|
20
26
|
export declare function forgetExecutionLaneReading(baseUrl: string | undefined): void;
|
|
21
27
|
export declare function __resetExecutionLaneReadingsForTests(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
|
-
import { createEngineCapReader } from './engineCapReader.js';
|
|
3
|
+
import { capsGenerationOf, createEngineCapReader } from './engineCapReader.js';
|
|
4
4
|
export function projectExecutionLaneCapability(caps) {
|
|
5
5
|
if (caps === null || typeof caps !== 'object')
|
|
6
6
|
return undefined;
|
|
@@ -11,6 +11,9 @@ export function projectExecutionLaneCapability(caps) {
|
|
|
11
11
|
const lane = caps.executionLane;
|
|
12
12
|
if (lane === undefined)
|
|
13
13
|
return { kind: 'not_reported' };
|
|
14
|
+
return projectExecutionLaneObject(lane, () => capsGenerationOf(caps).generation === 'new');
|
|
15
|
+
}
|
|
16
|
+
function projectExecutionLaneObject(lane, newGeneration) {
|
|
14
17
|
if (lane === null || typeof lane !== 'object' || Array.isArray(lane))
|
|
15
18
|
return undefined;
|
|
16
19
|
const provider = lane.provider;
|
|
@@ -19,7 +22,33 @@ export function projectExecutionLaneCapability(caps) {
|
|
|
19
22
|
return undefined;
|
|
20
23
|
if (typeof toolsOnThisHost !== 'boolean')
|
|
21
24
|
return undefined;
|
|
22
|
-
|
|
25
|
+
let isolated;
|
|
26
|
+
let isolatedThrew = false;
|
|
27
|
+
try {
|
|
28
|
+
isolated = Object.hasOwn(lane, 'isolated') ? lane.isolated : undefined;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
isolatedThrew = true;
|
|
32
|
+
}
|
|
33
|
+
if (!isolatedThrew && typeof isolated === 'boolean')
|
|
34
|
+
return { kind: 'present', view: { provider, toolsOnThisHost, isolated } };
|
|
35
|
+
const isolatedAbsent = isolatedThrew || isolated !== undefined ? 'unreadable' : !newGeneration() ? 'not_reported' : toolsOnThisHost ? 'unreadable' : 'no_hands';
|
|
36
|
+
return { kind: 'present', view: { provider, toolsOnThisHost, isolatedAbsent } };
|
|
37
|
+
}
|
|
38
|
+
export function projectExecutionLaneWiring(wiring) {
|
|
39
|
+
try {
|
|
40
|
+
if (wiring === null || typeof wiring !== 'object' || Array.isArray(wiring))
|
|
41
|
+
return undefined;
|
|
42
|
+
if (!Object.hasOwn(wiring, 'executionLane'))
|
|
43
|
+
return { kind: 'not_reported' };
|
|
44
|
+
const lane = wiring.executionLane;
|
|
45
|
+
if (lane === undefined)
|
|
46
|
+
return { kind: 'not_reported' };
|
|
47
|
+
return projectExecutionLaneObject(lane, () => true);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
23
52
|
}
|
|
24
53
|
const reader = createEngineCapReader({
|
|
25
54
|
name: 'executionLane',
|
|
@@ -37,6 +66,30 @@ export function toolsRunHereFromExecutionLane(reading, legacyInference) {
|
|
|
37
66
|
return reading.view.toolsOnThisHost;
|
|
38
67
|
return legacyInference;
|
|
39
68
|
}
|
|
69
|
+
export function noOsSandboxOnThisHost(reading) {
|
|
70
|
+
if (typeof reading !== 'object' || reading === null)
|
|
71
|
+
return 'unknown';
|
|
72
|
+
try {
|
|
73
|
+
if (reading.kind !== 'present')
|
|
74
|
+
return 'unknown';
|
|
75
|
+
const view = reading.view;
|
|
76
|
+
if (typeof view !== 'object' || view === null)
|
|
77
|
+
return 'unknown';
|
|
78
|
+
const tools = view.toolsOnThisHost;
|
|
79
|
+
const isolated = view.isolated;
|
|
80
|
+
if (tools === false || isolated === true)
|
|
81
|
+
return 'no';
|
|
82
|
+
if (tools === true && isolated === false)
|
|
83
|
+
return 'yes';
|
|
84
|
+
return 'unknown';
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return 'unknown';
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function noOsSandboxContent() {
|
|
91
|
+
return 'Tools run directly on this machine with no OS sandbox — files and commands they change here are changed for real, so permission rules and approvals are the only guard';
|
|
92
|
+
}
|
|
40
93
|
const LANE_DETAIL_MAX = 40;
|
|
41
94
|
export function executionLaneDoctorDetail(reading) {
|
|
42
95
|
switch (reading.kind) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { collapseLabel, escapeDisplayControlChars, taskDescFromName } from '../fleetTaskDesc.js';
|
|
2
2
|
import { rowIdTail } from '../workflow.js';
|
|
3
3
|
import { frozenSet } from '../frozenSet.js';
|
|
4
|
+
import { CORE_RESERVED_AGENT_NAMES } from '../generated/engineFactTables.js';
|
|
4
5
|
export const TERMINAL_FLEET_TASK_STATUSES = frozenSet([
|
|
5
6
|
'completed',
|
|
6
7
|
'failed',
|
|
@@ -52,15 +53,12 @@ function deriveAgentLabel(agentType, agentName, name, id) {
|
|
|
52
53
|
const tail = rowIdTail(id).slice(-8);
|
|
53
54
|
return tail ? `agent ${tail}` : 'agent';
|
|
54
55
|
}
|
|
56
|
+
const CONTROL_VERB_LEGACY_NAMES = ['Task', 'Fork'];
|
|
57
|
+
const CONTROL_VERB_GOAL_NAMES = ['DeclareDone'];
|
|
55
58
|
export const CONTROL_TOOL_VERBS = frozenSet([
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
'StructuredOutput',
|
|
60
|
-
'ReportBlocked',
|
|
61
|
-
'ReadToolResult',
|
|
62
|
-
'ToolSearch',
|
|
63
|
-
'DeclareDone',
|
|
59
|
+
...CORE_RESERVED_AGENT_NAMES,
|
|
60
|
+
...CONTROL_VERB_LEGACY_NAMES,
|
|
61
|
+
...CONTROL_VERB_GOAL_NAMES,
|
|
64
62
|
]);
|
|
65
63
|
export function projectDescription(description) {
|
|
66
64
|
const d = description ?? '';
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
import { CORE_WORKFLOW_SIZE_GUIDELINE_AGENT_CAPS } from '../generated/engineFactTables.js';
|
|
1
2
|
export const WORKFLOW_SIZE_WARNING_AGENT_CAP = 25;
|
|
2
3
|
export const WORKFLOW_SIZE_WARNING_TOKEN_CAP = 1_500_000;
|
|
3
4
|
export const WORKFLOW_SIZE_WARNING_TOKENS_PER_AGENT = 70_000;
|
|
4
|
-
export const WORKFLOW_SIZE_GUIDELINE_AGENT_CAPS =
|
|
5
|
-
small: 5,
|
|
6
|
-
medium: 15,
|
|
7
|
-
large: 50,
|
|
8
|
-
});
|
|
5
|
+
export const WORKFLOW_SIZE_GUIDELINE_AGENT_CAPS = CORE_WORKFLOW_SIZE_GUIDELINE_AGENT_CAPS;
|
|
9
6
|
export const WORKFLOW_SIZE_WARNING_ENV_NAMES = Object.freeze({
|
|
10
7
|
agents: Object.freeze(['SEMA_CODE_WORKFLOW_SIZE_WARNING_AGENTS', 'CLAUDE_CODE_WORKFLOW_SIZE_WARNING_AGENTS']),
|
|
11
8
|
tokens: Object.freeze(['SEMA_CODE_WORKFLOW_SIZE_WARNING_TOKENS', 'CLAUDE_CODE_WORKFLOW_SIZE_WARNING_TOKENS']),
|
package/dist/gateOutcome.d.ts
CHANGED
|
@@ -3,9 +3,13 @@ import { type CcToolDenialKind } from './gateVocabulary.js';
|
|
|
3
3
|
export type GateDispositionView = {
|
|
4
4
|
kind: 'allowed';
|
|
5
5
|
classifier?: GateClassifierRoundView;
|
|
6
|
+
released?: GateModeReleaseView;
|
|
6
7
|
} | {
|
|
7
8
|
kind: 'denied';
|
|
8
9
|
classifier?: GateClassifierRoundView;
|
|
10
|
+
mode?: string;
|
|
11
|
+
askClass?: string;
|
|
12
|
+
classes?: readonly string[];
|
|
9
13
|
deniedBy: DeniedBy | (string & {});
|
|
10
14
|
cause?: string;
|
|
11
15
|
};
|
|
@@ -19,6 +23,14 @@ export interface GateClassifierFallbackView {
|
|
|
19
23
|
to: string;
|
|
20
24
|
cause: string;
|
|
21
25
|
}
|
|
26
|
+
export interface GateModeReleaseView {
|
|
27
|
+
mode: string;
|
|
28
|
+
askClass: string;
|
|
29
|
+
classes: readonly string[];
|
|
30
|
+
origin?: string;
|
|
31
|
+
mandate?: string;
|
|
32
|
+
reason?: string;
|
|
33
|
+
}
|
|
22
34
|
export interface SettlementWhoView {
|
|
23
35
|
party: string;
|
|
24
36
|
approver?: string;
|
|
@@ -38,6 +50,7 @@ export interface GateOutcomeView {
|
|
|
38
50
|
}
|
|
39
51
|
export declare function gateOutcomeOf(frame: unknown): GateOutcomeView | undefined;
|
|
40
52
|
export declare function isGateParkedToolEnd(frame: unknown): boolean;
|
|
53
|
+
export declare function gateModeRelease(g: GateOutcomeView | undefined): GateModeReleaseView | undefined;
|
|
41
54
|
export declare function isDeniedGate(g: GateOutcomeView | undefined): boolean;
|
|
42
55
|
export declare function gateDeniedBy(g: GateOutcomeView | undefined): string | undefined;
|
|
43
56
|
export declare function gateApprover(g: GateOutcomeView | undefined): string | undefined;
|
package/dist/gateOutcome.js
CHANGED
|
@@ -50,6 +50,39 @@ function readSettlement(v) {
|
|
|
50
50
|
...(note !== undefined ? { note } : {}),
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
|
+
function nonEmptyStringList(v) {
|
|
54
|
+
if (!Array.isArray(v) || v.length === 0)
|
|
55
|
+
return undefined;
|
|
56
|
+
const out = [];
|
|
57
|
+
for (const x of v) {
|
|
58
|
+
const t = str(x);
|
|
59
|
+
if (t === undefined)
|
|
60
|
+
return undefined;
|
|
61
|
+
out.push(t);
|
|
62
|
+
}
|
|
63
|
+
return Object.freeze(out);
|
|
64
|
+
}
|
|
65
|
+
function readModeRelease(raw) {
|
|
66
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
67
|
+
return undefined;
|
|
68
|
+
const r = raw;
|
|
69
|
+
const mode = str(r.mode);
|
|
70
|
+
const askClass = str(r.askClass);
|
|
71
|
+
const classes = nonEmptyStringList(r.classes);
|
|
72
|
+
if (mode === undefined || askClass === undefined || classes === undefined)
|
|
73
|
+
return undefined;
|
|
74
|
+
const origin = str(r.origin);
|
|
75
|
+
const mandate = str(r.mandate);
|
|
76
|
+
const reason = str(r.reason);
|
|
77
|
+
return {
|
|
78
|
+
mode,
|
|
79
|
+
askClass,
|
|
80
|
+
classes,
|
|
81
|
+
...(origin !== undefined ? { origin } : {}),
|
|
82
|
+
...(mandate !== undefined ? { mandate } : {}),
|
|
83
|
+
...(reason !== undefined ? { reason } : {}),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
53
86
|
function readClassifierRound(raw) {
|
|
54
87
|
if (typeof raw !== 'object' || raw === null || Array.isArray(raw))
|
|
55
88
|
return undefined;
|
|
@@ -85,18 +118,29 @@ export function gateOutcomeOf(frame) {
|
|
|
85
118
|
let disposition;
|
|
86
119
|
const classifier = readClassifierRound(dr.classifier);
|
|
87
120
|
if (dk === 'allowed') {
|
|
88
|
-
|
|
121
|
+
const released = readModeRelease(dr.released);
|
|
122
|
+
disposition = {
|
|
123
|
+
kind: 'allowed',
|
|
124
|
+
...(classifier !== undefined ? { classifier } : {}),
|
|
125
|
+
...(released !== undefined ? { released } : {}),
|
|
126
|
+
};
|
|
89
127
|
}
|
|
90
128
|
else if (dk === 'denied') {
|
|
91
129
|
const deniedBy = str(dr.deniedBy);
|
|
92
130
|
if (deniedBy === undefined)
|
|
93
131
|
return undefined;
|
|
94
132
|
const cause = str(dr.cause);
|
|
133
|
+
const mode = str(dr.mode);
|
|
134
|
+
const askClass = str(dr.askClass);
|
|
135
|
+
const classes = nonEmptyStringList(dr.classes);
|
|
95
136
|
disposition = {
|
|
96
137
|
kind: 'denied',
|
|
97
138
|
deniedBy,
|
|
98
139
|
...(cause !== undefined ? { cause } : {}),
|
|
99
140
|
...(classifier !== undefined ? { classifier } : {}),
|
|
141
|
+
...(mode !== undefined ? { mode } : {}),
|
|
142
|
+
...(askClass !== undefined ? { askClass } : {}),
|
|
143
|
+
...(classes !== undefined ? { classes } : {}),
|
|
100
144
|
};
|
|
101
145
|
}
|
|
102
146
|
else {
|
|
@@ -115,6 +159,9 @@ export function isGateParkedToolEnd(frame) {
|
|
|
115
159
|
return false;
|
|
116
160
|
return frame.errorCode === GATE_PARKED_ERROR_CODE;
|
|
117
161
|
}
|
|
162
|
+
export function gateModeRelease(g) {
|
|
163
|
+
return g?.disposition.kind === 'allowed' ? g.disposition.released : undefined;
|
|
164
|
+
}
|
|
118
165
|
export function isDeniedGate(g) {
|
|
119
166
|
return g?.disposition.kind === 'denied';
|
|
120
167
|
}
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CORE_DENIED_BY_VALUES } from './generated/engineFactTables.js';
|
|
2
2
|
import type { APPROVAL_MANDATE_WORDS } from './hitl/toolApprovalWire.js';
|
|
3
3
|
export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
|
|
4
4
|
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
|
|
8
|
+
declare const RETIRED_DENIED_BY_WORDS: readonly ["plan_mode"];
|
|
9
|
+
export type GateDeniedByWord = (typeof CORE_DENIED_BY_VALUES)[number] | (typeof RETIRED_DENIED_BY_WORDS)[number];
|
|
10
|
+
export declare const GATE_DENIED_BY_WORDS: readonly GateDeniedByWord[];
|
|
11
|
+
export declare function isGateDeniedByWord(v: unknown): v is GateDeniedByWord;
|
|
10
12
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
11
13
|
export declare function askOriginDetail(origin: unknown, message?: unknown): string;
|
|
12
14
|
export declare const RULE_STORE_UNREADABLE_KINDS: readonly ["store", "call"];
|
|
@@ -17,3 +19,4 @@ export declare function mandatedApprovalDetail(): string;
|
|
|
17
19
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
|
18
20
|
export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
|
|
19
21
|
export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
|
|
22
|
+
export {};
|