@sema-agent/client-core 0.98.0 → 0.99.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 +199 -0
- package/README.md +35 -22
- package/dist/adapt/arms.js +61 -20
- package/dist/adapt/panelTasks.d.ts +1 -1
- package/dist/adapt/panelTasks.js +2 -2
- package/dist/adapter/activeRunSelfHeal.d.ts +4 -3
- package/dist/adapter/activeRunSelfHeal.js +162 -293
- package/dist/adapter/downstream/eventToSdkMessage.js +52 -4
- package/dist/adapter/runStream.js +52 -37
- package/dist/adapter/types.js +2 -1
- package/dist/agentSession/engineSessionBackgroundStop.js +16 -8
- package/dist/agentsWireCaps.d.ts +0 -3
- package/dist/agentsWireCaps.js +33 -24
- package/dist/cloudConfigWireCaps.d.ts +1 -1
- package/dist/cloudConfigWireCaps.js +26 -4
- package/dist/controlRouter.d.ts +4 -2
- package/dist/controlRouter.js +39 -51
- package/dist/coreValuePorts.d.ts +26 -1
- package/dist/coreValuePorts.js +10 -0
- package/dist/corruptSessionCopy.d.ts +2 -1
- package/dist/corruptSessionCopy.js +3 -3
- package/dist/declared/supportFloorDeclared.js +1 -1
- package/dist/detachWire.js +3 -2
- package/dist/devicesFace.d.ts +34 -0
- package/dist/devicesFace.js +90 -0
- package/dist/displayUntrusted.d.ts +1 -0
- package/dist/displayUntrusted.js +3 -0
- package/dist/engineAgentPanelStore.d.ts +7 -0
- package/dist/engineAgentPanelStore.js +14 -0
- package/dist/engineCapReader.d.ts +2 -1
- package/dist/engineCapReader.js +7 -5
- package/dist/engineCapsCache.d.ts +8 -0
- package/dist/engineCapsCache.js +59 -6
- package/dist/engineCapsChange.d.ts +2 -0
- package/dist/engineCapsChange.js +9 -0
- package/dist/engineErrorCodes.d.ts +2 -1
- package/dist/engineErrorCodes.js +2 -7
- package/dist/engineRowRef.js +3 -0
- package/dist/engineSessionMessages.d.ts +1 -0
- package/dist/engineSessionMessages.js +7 -1
- package/dist/engineTargetSeat.d.ts +27 -0
- package/dist/engineTargetSeat.js +199 -0
- package/dist/engineWireFor.js +3 -8
- package/dist/env/uiLanguage.d.ts +2 -1
- package/dist/env/uiLanguage.js +3 -2
- package/dist/eventLeg.d.ts +8 -0
- package/dist/eventLeg.js +61 -41
- package/dist/fileHistoryCaptureCapability.d.ts +2 -1
- package/dist/fileHistoryCaptureCapability.js +12 -18
- package/dist/fileHistoryLegNotice.d.ts +2 -1
- package/dist/fileHistoryLegNotice.js +3 -3
- package/dist/frameBinding.d.ts +3 -0
- package/dist/frameBinding.js +12 -0
- package/dist/gateOutcome.js +16 -2
- package/dist/gateVocabulary.d.ts +8 -7
- package/dist/gateVocabulary.js +71 -73
- package/dist/generated/engineFactTables.d.ts +17 -1
- package/dist/generated/engineFactTables.js +29 -0
- package/dist/generated/engineNoticeTables.js +9 -3
- package/dist/generated/settingsSchemaFns.d.ts +6 -0
- package/dist/generated/settingsSchemaFns.js +57 -0
- package/dist/generated/settingsSchemaHooksClassifier.d.ts +2 -0
- package/dist/generated/settingsSchemaHooksClassifier.js +254 -0
- package/dist/generated/settingsSchemaTables.d.ts +1 -0
- package/dist/generated/settingsSchemaTables.js +4 -0
- package/dist/generated/settingsSchemaTypes.d.ts +105 -0
- package/dist/generated/settingsSchemaTypes.js +1 -0
- package/dist/hitl/allowRuleShadow.d.ts +2 -1
- package/dist/hitl/allowRuleShadow.js +17 -14
- package/dist/hitl/approvalCardReasons.d.ts +3 -2
- package/dist/hitl/approvalCardReasons.js +27 -28
- package/dist/hitl/approvalHolds.d.ts +3 -0
- package/dist/hitl/approvalHolds.js +73 -29
- package/dist/hitl/askClassPair.d.ts +1 -1
- package/dist/hitl/askClassPair.js +16 -0
- package/dist/hitl/askGateWire.js +2 -1
- package/dist/hitl/askSettlementLine.d.ts +14 -4
- package/dist/hitl/askSettlementLine.js +67 -47
- package/dist/hitl/automaticAnswerVerdict.d.ts +2 -1
- package/dist/hitl/automaticAnswerVerdict.js +8 -8
- package/dist/hitl/crashConvergedNotice.d.ts +5 -4
- package/dist/hitl/crashConvergedNotice.js +28 -41
- package/dist/hitl/frameRouter.js +7 -8
- package/dist/hitl/hitlBridge.d.ts +1 -0
- package/dist/hitl/hitlBridge.js +3 -3
- package/dist/hitl/persistedRulesWire.d.ts +6 -5
- package/dist/hitl/persistedRulesWire.js +55 -73
- package/dist/hitl/planReviewWire.d.ts +5 -0
- package/dist/hitl/planReviewWire.js +8 -0
- package/dist/hitl/sessionPolicyDeliverable.d.ts +2 -0
- package/dist/hitl/sessionPolicyDeliverable.js +46 -3
- package/dist/hitl/sessionPolicyWire.d.ts +2 -1
- package/dist/hitl/sessionPolicyWire.js +23 -24
- package/dist/hitl/suspendedReopen.d.ts +2 -1
- package/dist/hitl/suspendedReopen.js +7 -10
- package/dist/hitl/toolApprovalWire.d.ts +17 -5
- package/dist/hitl/toolApprovalWire.js +79 -40
- package/dist/hooksWireCaps.js +145 -56
- package/dist/host.d.ts +21 -0
- package/dist/hostTurnSettings.d.ts +71 -0
- package/dist/hostTurnSettings.js +291 -0
- package/dist/humanTurn.d.ts +14 -1
- package/dist/humanTurn.js +100 -12
- package/dist/humanTurnRead.d.ts +2 -0
- package/dist/humanTurnRead.js +22 -1
- package/dist/i18n/messages.en.d.ts +582 -0
- package/dist/i18n/messages.en.js +582 -0
- package/dist/i18n/messages.zh.js +718 -1
- package/dist/index.d.ts +29 -13
- package/dist/index.js +18 -9
- package/dist/inheritEnvCapability.d.ts +3 -2
- package/dist/inheritEnvCapability.js +3 -3
- package/dist/inheritEnvWire.d.ts +3 -2
- package/dist/inheritEnvWire.js +12 -14
- package/dist/interactiveHalt.js +17 -6
- package/dist/liveModelCatalog.d.ts +2 -1
- package/dist/liveModelCatalog.js +14 -8
- package/dist/mcpPanel.d.ts +10 -1
- package/dist/mcpPanel.js +40 -13
- package/dist/mcpProbeCapability.d.ts +2 -1
- package/dist/mcpProbeCapability.js +7 -11
- package/dist/mcpProbeWire.d.ts +3 -1
- package/dist/mcpProbeWire.js +5 -0
- package/dist/mcpWireCaps.d.ts +34 -0
- package/dist/mcpWireCaps.js +117 -17
- package/dist/memoryEntriesWire.js +5 -10
- package/dist/model/onboardJudgement.d.ts +93 -0
- package/dist/model/onboardJudgement.js +415 -0
- package/dist/model/tierVocabulary.d.ts +2 -0
- package/dist/model/tierVocabulary.js +17 -5
- package/dist/modelCapabilityProbe.d.ts +64 -0
- package/dist/modelCapabilityProbe.js +600 -0
- package/dist/modelIdentityResolvability.d.ts +3 -0
- package/dist/modelIdentityResolvability.js +26 -17
- package/dist/ownKey.d.ts +7 -0
- package/dist/ownKey.js +34 -0
- package/dist/panelReduce.d.ts +6 -1
- package/dist/panelReduce.js +50 -3
- package/dist/permissionRuleIssue.js +2 -0
- package/dist/permissionRulesWriteCapability.d.ts +2 -1
- package/dist/permissionRulesWriteCapability.js +8 -6
- package/dist/pluginHooksWire.d.ts +46 -3
- package/dist/pluginHooksWire.js +217 -11
- package/dist/printModelStatus.d.ts +63 -0
- package/dist/printModelStatus.js +155 -0
- package/dist/request/taskRequest.d.ts +11 -5
- package/dist/request/taskRequest.js +112 -16
- package/dist/resumeRefusalCopy.d.ts +12 -9
- package/dist/resumeRefusalCopy.js +70 -143
- package/dist/retryStatus.d.ts +37 -0
- package/dist/retryStatus.js +79 -0
- package/dist/scenarioRefusal.d.ts +9 -0
- package/dist/scenarioRefusal.js +111 -0
- package/dist/seam.d.ts +25 -1
- package/dist/seam.js +10 -1
- package/dist/seatContract.d.ts +260 -10
- package/dist/seatContract.js +692 -19
- package/dist/selfOrchestrationDenial.js +7 -19
- package/dist/sessionIdSegment.d.ts +6 -0
- package/dist/sessionIdSegment.js +24 -0
- package/dist/sessionMemoryStatus.js +6 -11
- package/dist/sessionPolicyCapability.d.ts +2 -1
- package/dist/sessionPolicyCapability.js +8 -6
- package/dist/settingsHooksSalvage.d.ts +44 -0
- package/dist/settingsHooksSalvage.js +211 -0
- package/dist/skillToolListsCapability.d.ts +2 -1
- package/dist/skillToolListsCapability.js +8 -6
- package/dist/sseIdleTriage.js +3 -2
- package/dist/subagent/engineSubagentResume.js +15 -9
- package/dist/subagentContentStore.d.ts +3 -0
- package/dist/subagentContentStore.js +22 -0
- package/dist/toolHistoryMismatch.js +3 -2
- package/dist/toolRoster.d.ts +3 -2
- package/dist/toolRoster.js +21 -20
- package/dist/turnFailurePresentation.d.ts +12 -1
- package/dist/turnFailurePresentation.js +212 -15
- package/dist/usageAnalytics.js +6 -11
- package/dist/userAttachmentEnvelope.d.ts +1 -0
- package/dist/userAttachmentEnvelope.js +37 -7
- package/dist/userAttachmentSeat.d.ts +21 -0
- package/dist/userAttachmentSeat.js +75 -0
- package/dist/userInvokedSkillsCapability.d.ts +11 -1
- package/dist/userInvokedSkillsCapability.js +31 -7
- package/dist/wireErrorTriage.d.ts +7 -0
- package/dist/wireErrorTriage.js +23 -1
- package/dist/wireFailureShape.js +2 -1
- package/dist/wireRefusalCopy.d.ts +13 -1
- package/dist/wireRefusalCopy.js +24 -28
- package/dist/workflowsJournalCapability.d.ts +2 -1
- package/dist/workflowsJournalCapability.js +8 -6
- package/docs/INTEGRATION-CLIENTS.md +542 -30
- package/package.json +5 -5
package/dist/pluginHooksWire.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { displayUntrusted } from './displayUntrusted.js';
|
|
2
2
|
import { SETTINGS_ENGINE_OWNED_HOOK_EVENTS } from './generated/settingsSchemaTables.js';
|
|
3
|
+
import { HOOK_SETTINGS_SOURCE_TEXT, hooksSalvageMaskOf, salvageSettingsHooksEntries, } from './settingsHooksSalvage.js';
|
|
3
4
|
export const ENGINE_FIRED_HOOK_EVENTS = SETTINGS_ENGINE_OWNED_HOOK_EVENTS;
|
|
4
5
|
export const PLUGIN_HOOK_DISPOSITIONS = ['engine', 'shell', 'not_run'];
|
|
5
6
|
export const PLUGIN_HOOK_REASONS = [
|
|
@@ -22,6 +23,9 @@ export const PLUGIN_HOOK_REASONS = [
|
|
|
22
23
|
'engine_llm_limit',
|
|
23
24
|
'engine_unconfirmed',
|
|
24
25
|
'engine_elsewhere',
|
|
26
|
+
'hooks_module',
|
|
27
|
+
'scope_unsupported',
|
|
28
|
+
'source_incomplete',
|
|
25
29
|
];
|
|
26
30
|
export const PLUGIN_HOOK_EXCLUSION_REASONS = [
|
|
27
31
|
'workspace_untrusted',
|
|
@@ -32,6 +36,43 @@ export const PLUGIN_HOOK_EXCLUSION_REASONS = [
|
|
|
32
36
|
'prompt_not_user_authored',
|
|
33
37
|
];
|
|
34
38
|
export const SETTINGS_HOOK_DROP_REASONS = ['exec_form_unsupported', 'mcp_tool_unsupported'];
|
|
39
|
+
export function hooksWirePlanShapeOf(v) {
|
|
40
|
+
try {
|
|
41
|
+
if (typeof v !== 'object' || v === null || Array.isArray(v))
|
|
42
|
+
return 'not';
|
|
43
|
+
const o = v;
|
|
44
|
+
for (const k of PLAN_KEYS)
|
|
45
|
+
if (!Object.hasOwn(o, k) && !LATER_PLAN_KEYS.has(k))
|
|
46
|
+
return 'not';
|
|
47
|
+
const reader = o.pluginReader;
|
|
48
|
+
const engineFacts = o.engine;
|
|
49
|
+
const wire = o.wire;
|
|
50
|
+
const arrayOrAbsent = (k) => !Object.hasOwn(o, k) || Array.isArray(o[k]);
|
|
51
|
+
return Array.isArray(o.verdicts) &&
|
|
52
|
+
Array.isArray(o.excluded) &&
|
|
53
|
+
Array.isArray(o.settingsDropped) &&
|
|
54
|
+
arrayOrAbsent('settingsVerdicts') &&
|
|
55
|
+
arrayOrAbsent('settingsExcluded') &&
|
|
56
|
+
arrayOrAbsent('settingsSalvage') &&
|
|
57
|
+
arrayOrAbsent('moduleVerdicts') &&
|
|
58
|
+
arrayOrAbsent('sessionVerdicts') &&
|
|
59
|
+
(!Object.hasOwn(o, 'sessionReader') || o.sessionReader === 'present' || o.sessionReader === 'absent' || o.sessionReader === 'failed') &&
|
|
60
|
+
(!Object.hasOwn(o, 'closedBy') || o.closedBy === null || o.closedBy === 'workspace_untrusted' || o.closedBy === 'governance_unreadable' || o.closedBy === 'policy_disable_all') &&
|
|
61
|
+
(reader === 'present' || reader === 'absent' || reader === 'failed') &&
|
|
62
|
+
typeof engineFacts === 'object' &&
|
|
63
|
+
engineFacts !== null &&
|
|
64
|
+
(wire === undefined || (typeof wire === 'object' && wire !== null && !Array.isArray(wire)))
|
|
65
|
+
? 'plan'
|
|
66
|
+
: 'not';
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return 'threw';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const PLAN_KEYS = ['engine', 'pluginReader', 'verdicts', 'excluded', 'settingsDropped', 'settingsVerdicts', 'settingsExcluded', 'settingsSalvage', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy', 'wire'];
|
|
73
|
+
const LATER_PLAN_KEYS = new Set(['settingsVerdicts', 'settingsExcluded', 'settingsSalvage', 'moduleVerdicts', 'sessionVerdicts', 'sessionReader', 'closedBy']);
|
|
74
|
+
const _planKeysPin = [true, true];
|
|
75
|
+
void _planKeysPin;
|
|
35
76
|
export const ENGINE_HOOK_LIMITS = { maxGroupsPerEvent: 16, maxEntriesPerEvent: 32, maxCommandChars: 8192, maxLlmEntriesPerEvent: 4 };
|
|
36
77
|
const ENGINE_HOOK_TYPE_RUNS = new Set(['command', 'http', 'prompt', 'agent']);
|
|
37
78
|
const COMPACTION_EVENTS = new Set(['PreCompact', 'PostCompact']);
|
|
@@ -39,6 +80,8 @@ const judged = (disposition, reason) => ({ kind: 'judged', disposition, reason }
|
|
|
39
80
|
function hookExecutorOf(x) {
|
|
40
81
|
if (x.event === 'UserPromptSubmit' && !x.promptAuthoredByUser)
|
|
41
82
|
return { kind: 'excluded', reason: 'prompt_not_user_authored' };
|
|
83
|
+
if (x.source === 'session')
|
|
84
|
+
return judged(x.shellRuns ? 'shell' : 'not_run', 'scope_unsupported');
|
|
42
85
|
if (x.source === 'settings') {
|
|
43
86
|
const why = x.powershell
|
|
44
87
|
? { reason: 'engine_type_skipped', certain: true }
|
|
@@ -172,15 +215,25 @@ export function occupancyOf(wire) {
|
|
|
172
215
|
export function decidePluginHooks(input) {
|
|
173
216
|
const verdicts = [];
|
|
174
217
|
const excluded = [];
|
|
218
|
+
const modules = [];
|
|
175
219
|
const candidates = new Map();
|
|
176
220
|
let unreadable = 0;
|
|
177
221
|
const fallback = (event, type, reason) => input.shellRuns(event, typeof type === 'string' ? type : undefined) ? { disposition: 'shell', reason } : { disposition: 'not_run', reason };
|
|
178
222
|
input.plugins.forEach((p, pluginIndex) => {
|
|
179
|
-
if (!isRecord(p)
|
|
223
|
+
if (!isRecord(p)) {
|
|
224
|
+
unreadable++;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (p.hooksModule === true && input.exclusion === undefined && !(input.managedOnly && p.managed !== true)) {
|
|
228
|
+
modules.push({ pluginId: typeof p.id === 'string' ? p.id : '', pluginName: typeof p.name === 'string' ? p.name : '', disposition: 'not_run', reason: 'hooks_module' });
|
|
229
|
+
}
|
|
230
|
+
if (!isRecord(p.hooks)) {
|
|
180
231
|
unreadable++;
|
|
181
232
|
return;
|
|
182
233
|
}
|
|
183
234
|
const src = p;
|
|
235
|
+
const sv = salvageSettingsHooksEntries({ hooks: p.hooks });
|
|
236
|
+
const pieceMask = hooksSalvageMaskOf(sv.outcome === 'loaded-partial' ? sv.dropped : []);
|
|
184
237
|
const sourceOk = nonEmptyString(p.id) && nonEmptyString(p.name) && nonEmptyString(p.root) && nonEmptyString(p.dataDir);
|
|
185
238
|
const pluginId = typeof p.id === 'string' ? p.id : '';
|
|
186
239
|
const pluginName = typeof p.name === 'string' ? p.name : '';
|
|
@@ -207,7 +260,15 @@ export function decidePluginHooks(input) {
|
|
|
207
260
|
return;
|
|
208
261
|
}
|
|
209
262
|
const entryType = isRecord(entry) && typeof entry.type === 'string' ? entry.type : undefined;
|
|
210
|
-
|
|
263
|
+
if (!sourceOk) {
|
|
264
|
+
verdicts.push({ ...key, disposition: 'not_run', reason: 'source_incomplete' });
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (!pieceMask.eventDropped(event) && pieceMask.entryDropped(event, groupIndex, hookIndex)) {
|
|
268
|
+
verdicts.push({ ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
const shape = classifyEntry(entry, src.options);
|
|
211
272
|
if (shape.kind === 'malformed') {
|
|
212
273
|
verdicts.push({ ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
213
274
|
return;
|
|
@@ -299,7 +360,79 @@ export function decidePluginHooks(input) {
|
|
|
299
360
|
}
|
|
300
361
|
projected.set(event, groupsOut);
|
|
301
362
|
}
|
|
302
|
-
|
|
363
|
+
const suppressed = input.suppressedLocally;
|
|
364
|
+
if (suppressed !== undefined && suppressed.size > 0) {
|
|
365
|
+
for (const v of verdicts) {
|
|
366
|
+
if (v.disposition !== 'shell' || !suppressed.has(v.pluginId))
|
|
367
|
+
continue;
|
|
368
|
+
v.disposition = 'not_run';
|
|
369
|
+
if (!ENGINE_EVENTS.has(v.event))
|
|
370
|
+
v.reason = 'no_executor';
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return { verdicts, excluded, modules, projected, unreadable };
|
|
374
|
+
}
|
|
375
|
+
const SESSION_HOOK_ORIGINS = new Set(['skill', 'agent', 'sdk_host']);
|
|
376
|
+
const LOCAL_REGISTRATION_TYPES = new Set(['callback', 'function']);
|
|
377
|
+
const isLocalRegistration = (e) => isRecord(e) && typeof e.type === 'string' && LOCAL_REGISTRATION_TYPES.has(e.type);
|
|
378
|
+
const JUDGE_STAND_IN = Object.freeze({ type: 'command', command: 'true' });
|
|
379
|
+
function sessionHooksForJudge(hooks) {
|
|
380
|
+
const out = {};
|
|
381
|
+
for (const [event, groups] of Object.entries(hooks)) {
|
|
382
|
+
out[event] = Array.isArray(groups)
|
|
383
|
+
? groups.map((g) => isRecord(g) && Array.isArray(g.hooks) && g.hooks.some(isLocalRegistration)
|
|
384
|
+
? { ...g, hooks: g.hooks.map((e) => (isLocalRegistration(e) ? JUDGE_STAND_IN : e)) }
|
|
385
|
+
: g)
|
|
386
|
+
: groups;
|
|
387
|
+
}
|
|
388
|
+
return out;
|
|
389
|
+
}
|
|
390
|
+
export function decideSessionHooks(input) {
|
|
391
|
+
const out = [];
|
|
392
|
+
let unreadable = 0;
|
|
393
|
+
for (const src of input.sources) {
|
|
394
|
+
if (!isRecord(src) || typeof src.origin !== 'string' || !SESSION_HOOK_ORIGINS.has(src.origin) || !isRecord(src.hooks)) {
|
|
395
|
+
unreadable++;
|
|
396
|
+
continue;
|
|
397
|
+
}
|
|
398
|
+
const origin = src.origin;
|
|
399
|
+
const name = typeof src.name === 'string' ? src.name : '';
|
|
400
|
+
const sv = salvageSettingsHooksEntries({ hooks: sessionHooksForJudge(src.hooks) });
|
|
401
|
+
const rejectedWhole = sv.outcome === 'rejected';
|
|
402
|
+
const mask = hooksSalvageMaskOf(sv.outcome === 'loaded-partial' ? sv.dropped : []);
|
|
403
|
+
for (const [event, groups] of Object.entries(src.hooks)) {
|
|
404
|
+
if (!Array.isArray(groups)) {
|
|
405
|
+
unreadable++;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
;
|
|
409
|
+
groups.forEach((group, groupIndex) => {
|
|
410
|
+
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
411
|
+
unreadable++;
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
;
|
|
415
|
+
group.hooks.forEach((entry, hookIndex) => {
|
|
416
|
+
const key = { origin, name, event, groupIndex, hookIndex };
|
|
417
|
+
const type = isRecord(entry) && typeof entry.type === 'string' ? entry.type : undefined;
|
|
418
|
+
if (rejectedWhole || (!mask.eventDropped(event) && mask.entryDropped(event, groupIndex, hookIndex)) || type === undefined) {
|
|
419
|
+
out.push({ ...key, disposition: 'not_run', reason: 'malformed_entry' });
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const shellRuns = input.shellRuns(event, type);
|
|
423
|
+
if (!ENGINE_EVENTS.has(event)) {
|
|
424
|
+
out.push({ ...key, ...(shellRuns ? { disposition: 'shell', reason: 'shell_event' } : { disposition: 'not_run', reason: 'no_executor' }) });
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const ex = hookExecutorOf({ source: 'session', event, powershell: false, llmPosition: 0, engine: input.engine, shellRuns, promptAuthoredByUser: input.promptAuthoredByUser });
|
|
428
|
+
if (ex.kind === 'excluded')
|
|
429
|
+
return;
|
|
430
|
+
out.push({ ...key, disposition: ex.disposition, reason: ex.reason });
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return { verdicts: out, unreadable };
|
|
303
436
|
}
|
|
304
437
|
const SHELL_INERT_COMMAND = /^[A-Za-z0-9_./:+-]+$/;
|
|
305
438
|
function carriesArgs(entry) {
|
|
@@ -312,7 +445,7 @@ function carriesArgs(entry) {
|
|
|
312
445
|
}
|
|
313
446
|
return true;
|
|
314
447
|
}
|
|
315
|
-
export function filterSettingsHookGroups(source, event, groups, execFormCapable, shellRunsType, judge) {
|
|
448
|
+
export function filterSettingsHookGroups(source, event, groups, execFormCapable, shellRunsType, judge, mask) {
|
|
316
449
|
const drops = [];
|
|
317
450
|
const verdicts = [];
|
|
318
451
|
const excluded = [];
|
|
@@ -320,6 +453,8 @@ export function filterSettingsHookGroups(source, event, groups, execFormCapable,
|
|
|
320
453
|
let stripped = 0;
|
|
321
454
|
const engineEvent = ENGINE_EVENTS.has(event);
|
|
322
455
|
groups.forEach((group, groupIndex) => {
|
|
456
|
+
if (mask !== undefined && mask.groupDropped(event, groupIndex))
|
|
457
|
+
return;
|
|
323
458
|
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
324
459
|
out.push(group);
|
|
325
460
|
return;
|
|
@@ -327,6 +462,10 @@ export function filterSettingsHookGroups(source, event, groups, execFormCapable,
|
|
|
327
462
|
const kept = [];
|
|
328
463
|
let changed = false;
|
|
329
464
|
group.hooks.forEach((entry, hookIndex) => {
|
|
465
|
+
if (mask !== undefined && mask.entryDropped(event, groupIndex, hookIndex)) {
|
|
466
|
+
changed = true;
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
330
469
|
const reason = !isRecord(entry)
|
|
331
470
|
? undefined
|
|
332
471
|
: entry.type === 'mcp_tool'
|
|
@@ -665,18 +804,15 @@ const REASON_TEXT = {
|
|
|
665
804
|
engine_llm_limit: 'the engine may skip prompt or agent hooks after the first four on one event',
|
|
666
805
|
engine_unconfirmed: 'it is sent to the engine, which is expected to run it, but this client cannot confirm that',
|
|
667
806
|
engine_elsewhere: 'it is not confirmed that the engine was started by this client on this machine, so this client runs it itself',
|
|
807
|
+
hooks_module: 'hooks registered in code by a plugin module run neither in the engine nor in this client',
|
|
808
|
+
scope_unsupported: 'hooks registered for a skill, an agent or by the host application are not sent to the engine, and this client does not run this event',
|
|
809
|
+
source_incomplete: 'the plugin was reported without its id, name, root folder or data folder',
|
|
668
810
|
};
|
|
669
811
|
const DROP_TEXT = {
|
|
670
812
|
exec_form_unsupported: 'exec-form hooks (with "args") are sent to the engine only once it reports support for them',
|
|
671
813
|
mcp_tool_unsupported: 'MCP tool hooks are not supported by the engine',
|
|
672
814
|
};
|
|
673
|
-
const SOURCE_TEXT =
|
|
674
|
-
policySettings: 'Managed settings',
|
|
675
|
-
userSettings: 'User settings',
|
|
676
|
-
projectSettings: 'Project settings',
|
|
677
|
-
localSettings: 'Local settings',
|
|
678
|
-
flagSettings: 'Flag settings',
|
|
679
|
-
};
|
|
815
|
+
const SOURCE_TEXT = HOOK_SETTINGS_SOURCE_TEXT;
|
|
680
816
|
export function pluginHookReasonText(reason) {
|
|
681
817
|
return REASON_TEXT[reason];
|
|
682
818
|
}
|
|
@@ -786,5 +922,75 @@ export function hooksNotRunNotice(plan) {
|
|
|
786
922
|
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
787
923
|
lines.push(`${SOURCE_TEXT[row.source]}: ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${pluginHookReasonText(row.reason)}.`);
|
|
788
924
|
}
|
|
925
|
+
const moduleRows = plan.moduleVerdicts;
|
|
926
|
+
for (const raw of Array.isArray(moduleRows) ? moduleRows : []) {
|
|
927
|
+
if (!isRecord(raw) || ownField(raw, 'disposition') !== 'not_run')
|
|
928
|
+
continue;
|
|
929
|
+
const reason = ownField(raw, 'reason');
|
|
930
|
+
const name = ownField(raw, 'pluginName');
|
|
931
|
+
if (typeof reason !== 'string' || !REASON_SET.has(reason))
|
|
932
|
+
continue;
|
|
933
|
+
lines.push(`Plugin "${noticeLabel(typeof name === 'string' ? name : '') || '(unnamed)'}": hooks module will not run — ${pluginHookReasonText(reason)}.`);
|
|
934
|
+
}
|
|
935
|
+
const sessionRows = plan.sessionVerdicts;
|
|
936
|
+
const bySession = new Map();
|
|
937
|
+
for (const raw of Array.isArray(sessionRows) ? sessionRows : []) {
|
|
938
|
+
if (!isRecord(raw) || ownField(raw, 'disposition') !== 'not_run')
|
|
939
|
+
continue;
|
|
940
|
+
const origin = ownField(raw, 'origin');
|
|
941
|
+
const name = ownField(raw, 'name');
|
|
942
|
+
const reason = ownField(raw, 'reason');
|
|
943
|
+
const event = ownField(raw, 'event');
|
|
944
|
+
if (typeof origin !== 'string' || !SESSION_HOOK_ORIGINS.has(origin) || typeof reason !== 'string' || !REASON_SET.has(reason) || typeof event !== 'string')
|
|
945
|
+
continue;
|
|
946
|
+
const nm = typeof name === 'string' ? name : '';
|
|
947
|
+
const k = `${origin}\u0000${nm}\u0000${reason}`;
|
|
948
|
+
const row = bySession.get(k) ?? { origin: origin, name: nm, reason: reason, events: [], count: 0 };
|
|
949
|
+
if (!row.events.includes(event))
|
|
950
|
+
row.events.push(event);
|
|
951
|
+
row.count++;
|
|
952
|
+
bySession.set(k, row);
|
|
953
|
+
}
|
|
954
|
+
for (const row of bySession.values()) {
|
|
955
|
+
const events = row.events.map((e) => noticeLabel(e)).join(', ');
|
|
956
|
+
const who = row.origin === 'sdk_host' ? 'Host application hooks' : `${row.origin === 'skill' ? 'Skill' : 'Agent'} "${noticeLabel(row.name) || '(unnamed)'}"`;
|
|
957
|
+
lines.push(`${who}: ${events} ${row.count === 1 ? 'hook' : 'hooks'} will not run — ${pluginHookReasonText(row.reason)}.`);
|
|
958
|
+
}
|
|
959
|
+
const salvageRows = plan.settingsSalvage;
|
|
960
|
+
for (const row of Array.isArray(salvageRows) ? salvageRows : []) {
|
|
961
|
+
const notice = isRecord(row) ? ownField(row, 'notice') : undefined;
|
|
962
|
+
if (typeof notice === 'string' && notice.length > 0)
|
|
963
|
+
lines.push(notice);
|
|
964
|
+
}
|
|
789
965
|
return lines;
|
|
790
966
|
}
|
|
967
|
+
export function userPromptSubmitExecutorOf(plan) {
|
|
968
|
+
try {
|
|
969
|
+
const p = plan;
|
|
970
|
+
if (!isRecord(p))
|
|
971
|
+
return 'unknown';
|
|
972
|
+
const verdicts = ownField(p, 'verdicts');
|
|
973
|
+
if (!Array.isArray(verdicts))
|
|
974
|
+
return 'unknown';
|
|
975
|
+
const rows = [...verdicts];
|
|
976
|
+
for (const k of ['settingsVerdicts', 'sessionVerdicts']) {
|
|
977
|
+
const v = ownField(p, k);
|
|
978
|
+
if (v === undefined)
|
|
979
|
+
continue;
|
|
980
|
+
if (!Array.isArray(v))
|
|
981
|
+
return 'unknown';
|
|
982
|
+
rows.push(...v);
|
|
983
|
+
}
|
|
984
|
+
const ups = rows.filter((r) => isRecord(r) && ownField(r, 'event') === 'UserPromptSubmit').map((r) => ownField(r, 'disposition'));
|
|
985
|
+
if (ups.length === 0)
|
|
986
|
+
return 'none';
|
|
987
|
+
if (ups.some((d) => d === 'engine'))
|
|
988
|
+
return 'engine';
|
|
989
|
+
if (ups.every((d) => d === 'shell'))
|
|
990
|
+
return 'shell';
|
|
991
|
+
return 'unknown';
|
|
992
|
+
}
|
|
993
|
+
catch {
|
|
994
|
+
return 'unknown';
|
|
995
|
+
}
|
|
996
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { SDKAssistantMessageError } from '@sema-agent/agent-types';
|
|
2
|
+
import { type RetryStatus, type RetryStatusArmLike, type RetryStatusNotice } from './retryStatus.js';
|
|
3
|
+
export declare const PRINT_MODEL_STATUS_SUBTYPE = "_sema_model_status";
|
|
4
|
+
export declare const PRINT_LAST_MODEL_STATUS_KEY = "_sema_last_model_status";
|
|
5
|
+
export interface PrintModelStatusCtx {
|
|
6
|
+
readonly sessionId: string;
|
|
7
|
+
readonly nowMs: number;
|
|
8
|
+
readonly mintUuid: () => string;
|
|
9
|
+
readonly model?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PrintModelStatusPayload {
|
|
12
|
+
readonly kind: RetryStatus['kind'];
|
|
13
|
+
readonly terminal?: true;
|
|
14
|
+
readonly attempt?: number;
|
|
15
|
+
readonly max_retries?: number;
|
|
16
|
+
readonly retry_delay_ms?: number;
|
|
17
|
+
readonly error_status?: number;
|
|
18
|
+
readonly provider_condition?: string;
|
|
19
|
+
readonly err_class?: string;
|
|
20
|
+
readonly elapsed_ms?: number;
|
|
21
|
+
readonly timeout_ms?: number;
|
|
22
|
+
readonly model?: string;
|
|
23
|
+
readonly phase: RetryStatusNotice['phase'];
|
|
24
|
+
readonly recourse?: NonNullable<RetryStatusNotice['recourse']>;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PrintApiRetryFrame {
|
|
28
|
+
readonly type: 'system';
|
|
29
|
+
readonly subtype: 'api_retry';
|
|
30
|
+
readonly attempt: number;
|
|
31
|
+
readonly max_retries: number;
|
|
32
|
+
readonly retry_delay_ms: number;
|
|
33
|
+
readonly error_status: number | null;
|
|
34
|
+
readonly error: SDKAssistantMessageError;
|
|
35
|
+
readonly _sema_provider_condition?: string;
|
|
36
|
+
readonly _sema_model?: string;
|
|
37
|
+
readonly _sema_message: string;
|
|
38
|
+
readonly uuid: string;
|
|
39
|
+
readonly session_id: string;
|
|
40
|
+
}
|
|
41
|
+
export interface PrintModelStatusSupersetFrame {
|
|
42
|
+
readonly type: 'system';
|
|
43
|
+
readonly subtype: typeof PRINT_MODEL_STATUS_SUBTYPE;
|
|
44
|
+
readonly _sema_model_status: PrintModelStatusPayload & {
|
|
45
|
+
readonly refresh?: true;
|
|
46
|
+
};
|
|
47
|
+
readonly uuid: string;
|
|
48
|
+
readonly session_id: string;
|
|
49
|
+
}
|
|
50
|
+
export type PrintModelStatusFrame = PrintApiRetryFrame | PrintModelStatusSupersetFrame;
|
|
51
|
+
export interface PrintModelStatusResultFields {
|
|
52
|
+
readonly _sema_last_model_status?: PrintModelStatusPayload;
|
|
53
|
+
}
|
|
54
|
+
export interface PrintLaneArmLike extends RetryStatusArmLike {
|
|
55
|
+
readonly type?: string;
|
|
56
|
+
readonly event?: RetryStatusArmLike;
|
|
57
|
+
}
|
|
58
|
+
export interface PrintModelStatusTracker {
|
|
59
|
+
take(msg: PrintLaneArmLike | null | undefined, ctx: PrintModelStatusCtx): PrintModelStatusFrame | null;
|
|
60
|
+
beginTurn(): void;
|
|
61
|
+
resultFields(nowMs: number): PrintModelStatusResultFields;
|
|
62
|
+
}
|
|
63
|
+
export declare function createPrintModelStatusTracker(): PrintModelStatusTracker;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { retryStatusFromArm, retryStatusNotice } from './retryStatus.js';
|
|
2
|
+
import { guardedRead, readOwnDataFiniteNumber, readOwnDataNonEmptyString, readOwnDataValue } from './ownKey.js';
|
|
3
|
+
export const PRINT_MODEL_STATUS_SUBTYPE = '_sema_model_status';
|
|
4
|
+
export const PRINT_LAST_MODEL_STATUS_KEY = '_sema_last_model_status';
|
|
5
|
+
function httpStatusOf(v) {
|
|
6
|
+
return typeof v === 'number' && Number.isInteger(v) && v > 0 && v <= 999 ? v : undefined;
|
|
7
|
+
}
|
|
8
|
+
function ccRetryErrorCategory(status) {
|
|
9
|
+
const code = httpStatusOf(status.errorStatus);
|
|
10
|
+
if (code === 529 || status.providerCondition === 'overloaded')
|
|
11
|
+
return 'overloaded';
|
|
12
|
+
if (code === 429)
|
|
13
|
+
return 'rate_limit';
|
|
14
|
+
if (code === 401 || code === 403)
|
|
15
|
+
return 'authentication_failed';
|
|
16
|
+
if (code !== undefined && code >= 408)
|
|
17
|
+
return 'server_error';
|
|
18
|
+
return 'unknown';
|
|
19
|
+
}
|
|
20
|
+
function modelStatusPayload(status, ctx) {
|
|
21
|
+
const code = httpStatusOf(status.errorStatus);
|
|
22
|
+
const terminal = 'terminal' in status && status.terminal === true;
|
|
23
|
+
const sane = (v) => (typeof v === 'number' && Number.isFinite(v) && v >= 0 ? v : undefined);
|
|
24
|
+
const count = (v) => (typeof v === 'number' && Number.isInteger(v) && v >= 0 ? v : undefined);
|
|
25
|
+
const retryDelayMs = status.kind !== 'waiting' && !terminal ? sane(Math.max(0, status.deadline - ctx.nowMs)) : undefined;
|
|
26
|
+
const attempt = count(status.attempt);
|
|
27
|
+
const maxRetries = count(status.maxRetries);
|
|
28
|
+
const elapsed = sane(status.elapsedMs);
|
|
29
|
+
const ceiling = sane(status.timeoutMs);
|
|
30
|
+
const model = ctx.model !== undefined && ctx.model.length > 0 ? ctx.model : undefined;
|
|
31
|
+
const notice = retryStatusNotice(status, model !== undefined ? { modelName: model } : undefined);
|
|
32
|
+
return {
|
|
33
|
+
kind: status.kind,
|
|
34
|
+
...(terminal ? { terminal: true } : {}),
|
|
35
|
+
...(attempt !== undefined ? { attempt } : {}),
|
|
36
|
+
...(maxRetries !== undefined ? { max_retries: maxRetries } : {}),
|
|
37
|
+
...(retryDelayMs !== undefined ? { retry_delay_ms: retryDelayMs } : {}),
|
|
38
|
+
...(code !== undefined ? { error_status: code } : {}),
|
|
39
|
+
...(typeof status.providerCondition === 'string' ? { provider_condition: status.providerCondition } : {}),
|
|
40
|
+
...(typeof status.errClass === 'string' ? { err_class: status.errClass } : {}),
|
|
41
|
+
...(elapsed !== undefined ? { elapsed_ms: elapsed } : {}),
|
|
42
|
+
...(ceiling !== undefined ? { timeout_ms: ceiling } : {}),
|
|
43
|
+
...(model !== undefined ? { model } : {}),
|
|
44
|
+
phase: notice.phase,
|
|
45
|
+
...(notice.recourse !== undefined ? { recourse: notice.recourse } : {}),
|
|
46
|
+
message: notice.line,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function apiRetryKeyOf(status) {
|
|
50
|
+
const terminal = 'terminal' in status && status.terminal === true;
|
|
51
|
+
const ok = (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0;
|
|
52
|
+
if (status.kind === 'waiting' || terminal || !ok(status.attempt) || !ok(status.maxRetries))
|
|
53
|
+
return null;
|
|
54
|
+
return `${String(status.attempt)}/${String(status.maxRetries)}/${String(status.errClass ?? '')}/${String(status.errorStatus ?? '')}`;
|
|
55
|
+
}
|
|
56
|
+
function statusFrameOf(status, ctx, uuid, refresh) {
|
|
57
|
+
const payload = modelStatusPayload(status, ctx);
|
|
58
|
+
if (apiRetryKeyOf(status) !== null && !refresh) {
|
|
59
|
+
return {
|
|
60
|
+
type: 'system',
|
|
61
|
+
subtype: 'api_retry',
|
|
62
|
+
attempt: status.attempt ?? 0,
|
|
63
|
+
max_retries: status.maxRetries ?? 0,
|
|
64
|
+
retry_delay_ms: payload.retry_delay_ms ?? 0,
|
|
65
|
+
error_status: payload.error_status ?? null,
|
|
66
|
+
error: ccRetryErrorCategory(status),
|
|
67
|
+
...(payload.provider_condition !== undefined ? { _sema_provider_condition: payload.provider_condition } : {}),
|
|
68
|
+
...(payload.model !== undefined ? { _sema_model: payload.model } : {}),
|
|
69
|
+
_sema_message: payload.message,
|
|
70
|
+
uuid,
|
|
71
|
+
session_id: ctx.sessionId,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return { type: 'system', subtype: PRINT_MODEL_STATUS_SUBTYPE, _sema_model_status: { ...payload, ...(refresh ? { refresh: true } : {}) }, uuid, session_id: ctx.sessionId };
|
|
75
|
+
}
|
|
76
|
+
function isMainLaneArm(msg) {
|
|
77
|
+
const tri = (o, key) => {
|
|
78
|
+
try {
|
|
79
|
+
const d = Object.getOwnPropertyDescriptor(o, key);
|
|
80
|
+
if (d !== undefined && !('value' in d))
|
|
81
|
+
return { ok: false };
|
|
82
|
+
return { ok: true, v: readOwnDataValue(o, key) };
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return { ok: false };
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const top = tri(msg, 'parentToolCallId');
|
|
89
|
+
if (!top.ok)
|
|
90
|
+
return false;
|
|
91
|
+
const event = tri(msg, 'event');
|
|
92
|
+
if (!event.ok)
|
|
93
|
+
return false;
|
|
94
|
+
const nested = typeof event.v === 'object' && event.v !== null ? tri(event.v, 'parentToolCallId') : { ok: true, v: undefined };
|
|
95
|
+
if (!nested.ok)
|
|
96
|
+
return false;
|
|
97
|
+
return typeof top.v !== 'string' && typeof nested.v !== 'string';
|
|
98
|
+
}
|
|
99
|
+
export function createPrintModelStatusTracker() {
|
|
100
|
+
let last = null;
|
|
101
|
+
let lastApiRetryKey = null;
|
|
102
|
+
const clear = () => {
|
|
103
|
+
last = null;
|
|
104
|
+
lastApiRetryKey = null;
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
take(msg, ctx) {
|
|
108
|
+
try {
|
|
109
|
+
const type = guardedRead(() => readOwnDataValue(msg, 'type'));
|
|
110
|
+
if (type === 'stream_event' || type === 'tool_end_result') {
|
|
111
|
+
if (msg !== null && msg !== undefined && isMainLaneArm(msg))
|
|
112
|
+
clear();
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
if (type !== 'retry_status')
|
|
116
|
+
return null;
|
|
117
|
+
const sessionId = readOwnDataNonEmptyString(ctx, 'sessionId');
|
|
118
|
+
const mintUuid = readOwnDataValue(ctx, 'mintUuid');
|
|
119
|
+
const nowMs = readOwnDataFiniteNumber(ctx, 'nowMs');
|
|
120
|
+
if (sessionId === undefined || typeof mintUuid !== 'function' || nowMs === undefined)
|
|
121
|
+
return null;
|
|
122
|
+
const status = retryStatusFromArm(msg, nowMs);
|
|
123
|
+
if (status === undefined)
|
|
124
|
+
return null;
|
|
125
|
+
if (status === null) {
|
|
126
|
+
clear();
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const model = readOwnDataNonEmptyString(ctx, 'model');
|
|
130
|
+
const key = apiRetryKeyOf(status);
|
|
131
|
+
const refresh = key !== null && key === lastApiRetryKey;
|
|
132
|
+
const safeCtx = { sessionId, nowMs, mintUuid, ...(model !== undefined ? { model } : {}) };
|
|
133
|
+
const frame = statusFrameOf(status, safeCtx, mintUuid(), refresh);
|
|
134
|
+
lastApiRetryKey = key;
|
|
135
|
+
last = { status, model };
|
|
136
|
+
return frame;
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
beginTurn: clear,
|
|
143
|
+
resultFields(nowMs) {
|
|
144
|
+
try {
|
|
145
|
+
if (last === null)
|
|
146
|
+
return {};
|
|
147
|
+
const now = typeof nowMs === 'number' && Number.isFinite(nowMs) ? nowMs : 0;
|
|
148
|
+
return { _sema_last_model_status: modelStatusPayload(last.status, { ...(last.model !== undefined ? { model: last.model } : {}), nowMs: now }) };
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { TaskRequest } from '@sema-agent/sdk';
|
|
1
|
+
import type { TaskRequest, UserAttachment } from '@sema-agent/sdk';
|
|
2
2
|
import { type OutputStyleSeatReading } from '../outputStyleSeatCapability.js';
|
|
3
3
|
import { type ApprovalReachWord } from '../approvalReachWire.js';
|
|
4
|
+
import { type HostTurnSettings, type HostTurnSettingsInput } from '../hostTurnSettings.js';
|
|
4
5
|
export type RequestLane = 'interactive' | 'print' | 'utility';
|
|
5
6
|
export type TaskRequestLike = Record<string, unknown>;
|
|
6
7
|
export interface RequestFieldSpec {
|
|
@@ -22,7 +23,9 @@ export interface TaskRequestInput {
|
|
|
22
23
|
reasoningEffort?: string;
|
|
23
24
|
model?: string;
|
|
24
25
|
images?: readonly unknown[];
|
|
26
|
+
userAttachments?: readonly UserAttachment[];
|
|
25
27
|
skills?: unknown;
|
|
28
|
+
userInvokedSkills?: readonly string[];
|
|
26
29
|
mcpServers?: unknown;
|
|
27
30
|
clientContext?: Record<string, unknown>;
|
|
28
31
|
scratchpadDir?: string;
|
|
@@ -58,12 +61,13 @@ export interface TaskRequestInput {
|
|
|
58
61
|
disableSkills?: TaskRequest['disableSkills'];
|
|
59
62
|
rewind?: Record<string, unknown>;
|
|
60
63
|
repo?: string;
|
|
64
|
+
hostSettings: HostTurnSettings;
|
|
61
65
|
settings?: {
|
|
62
|
-
resolved?:
|
|
63
|
-
webSearch?:
|
|
66
|
+
resolved?: never;
|
|
67
|
+
webSearch?: never;
|
|
64
68
|
ultracode?: boolean;
|
|
65
|
-
hooks?:
|
|
66
|
-
outputStyle?:
|
|
69
|
+
hooks?: never;
|
|
70
|
+
outputStyle?: never;
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
export declare const TASK_REQUEST_OMISSION_CAUSES: readonly ["upstream_absent", "other_channel", "off_lane", "not_live"];
|
|
@@ -78,6 +82,7 @@ export declare function taskRequestOmissionCauseNotice(cause: unknown): string;
|
|
|
78
82
|
export interface TaskRequestAssembly {
|
|
79
83
|
readonly request: TaskRequestLike;
|
|
80
84
|
readonly omitted: readonly TaskRequestOmission[];
|
|
85
|
+
readonly host: HostTurnSettings;
|
|
81
86
|
}
|
|
82
87
|
export type TaskRequestSeatReading = {
|
|
83
88
|
readonly seat: 'seated';
|
|
@@ -95,6 +100,7 @@ export interface UpstreamAbsentRequestIntent {
|
|
|
95
100
|
export declare const UPSTREAM_ABSENT_REQUEST_INTENTS: readonly UpstreamAbsentRequestIntent[];
|
|
96
101
|
export declare const REQUEST_LANES: readonly RequestLane[];
|
|
97
102
|
export declare function taskRequestSeatOf(key: string, lane: RequestLane): TaskRequestSeatReading;
|
|
103
|
+
export declare function hostTurnSettings(input: HostTurnSettingsInput): HostTurnSettings;
|
|
98
104
|
export declare const MEMORY_CAPTURE_OFF: "off";
|
|
99
105
|
export declare function memoryCaptureDeclarationField(declared: boolean): {
|
|
100
106
|
memoryCapture: 'off';
|