@sema-agent/client-core 0.84.1 → 0.85.1
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 +206 -0
- package/README.md +20 -13
- package/dist/adapt/arms.js +1 -1
- package/dist/adapt.d.ts +1 -1
- package/dist/adapt.js +1 -1
- package/dist/adapter/activeRunSelfHeal.d.ts +3 -0
- package/dist/adapter/activeRunSelfHeal.js +149 -17
- package/dist/adapter/downstream/terminalToSdkResult.js +9 -5
- 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/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.js +4 -1
- package/dist/decideReceipt.d.ts +6 -0
- package/dist/decideReceipt.js +30 -1
- package/dist/effortWire.d.ts +2 -1
- package/dist/effortWire.js +2 -4
- package/dist/engineErrorCodes.d.ts +9 -0
- package/dist/engineErrorCodes.js +29 -0
- package/dist/engineNoticeCodes.d.ts +9 -0
- package/dist/engineNoticeCodes.js +44 -156
- package/dist/engineWireFor.d.ts +43 -0
- package/dist/engineWireFor.js +399 -0
- package/dist/engineWireSdk.d.ts +4 -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/armedGateRegistry.d.ts +1 -0
- package/dist/hitl/armedGateRegistry.js +1 -1
- package/dist/hitl/frameRouter.js +4 -2
- package/dist/hitl/parkResolver.js +3 -1
- package/dist/hitl/planReviewWire.d.ts +11 -0
- package/dist/hitl/planReviewWire.js +191 -72
- package/dist/hitl/rosterMountedNames.d.ts +2 -0
- package/dist/hitl/rosterMountedNames.js +38 -0
- package/dist/hitl/sessionPolicyDeliverable.d.ts +6 -2
- package/dist/hitl/sessionPolicyDeliverable.js +25 -45
- package/dist/hitl/sessionPolicyWire.js +1 -38
- package/dist/hitl/toolApprovalWire.d.ts +4 -2
- package/dist/hitl/toolApprovalWire.js +4 -2
- package/dist/host.d.ts +1 -1
- package/dist/host.js +11 -2
- package/dist/index.d.ts +10 -4
- package/dist/index.js +7 -3
- package/dist/permissionWireCaps.d.ts +2 -1
- package/dist/permissionWireCaps.js +2 -7
- package/dist/request/taskRequest.d.ts +4 -0
- package/dist/request/taskRequest.js +30 -1
- package/dist/resumeRefusalCopy.js +4 -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/subagent/subagentOwnerAbsence.js +2 -5
- 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 +867 -22
- package/package.json +1 -1
|
@@ -6,13 +6,16 @@ export type FileHistoryCaptureReading = {
|
|
|
6
6
|
kind: 'present';
|
|
7
7
|
word: string;
|
|
8
8
|
};
|
|
9
|
-
export type FileHistoryCaptureMode = 'off' | 'on-always' | 'unknown';
|
|
9
|
+
export type FileHistoryCaptureMode = 'off' | 'on-always' | 'on-optional' | 'unknown';
|
|
10
10
|
export declare function projectFileHistoryCaptureCapability(caps: unknown): FileHistoryCaptureReading | undefined;
|
|
11
11
|
export declare function noteEngineCapsForFileHistoryCapture(baseUrl: string, caps: unknown, opts?: {
|
|
12
12
|
generation?: number;
|
|
13
13
|
}): void;
|
|
14
14
|
export declare function observedFileHistoryCapture(baseUrl?: string | undefined): FileHistoryCaptureReading;
|
|
15
15
|
export declare function fileHistoryCaptureMode(reading: FileHistoryCaptureReading): FileHistoryCaptureMode;
|
|
16
|
+
export declare function fileHistoryDeclarationField(reading: FileHistoryCaptureReading, captureOff: boolean): {
|
|
17
|
+
fileHistory: 'disabled';
|
|
18
|
+
} | Record<string, never>;
|
|
16
19
|
export declare function fileHistoryCaptureDoctorDetail(reading: FileHistoryCaptureReading): string;
|
|
17
20
|
export declare function forgetFileHistoryCaptureReading(baseUrl: string | undefined): void;
|
|
18
21
|
export declare function __resetFileHistoryCaptureReadingsForTests(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { capForDisplay } from './fleetTaskDesc.js';
|
|
2
2
|
import { engineWireTarget } from './engineWireTarget.js';
|
|
3
3
|
import { createEngineCapReader } from './engineCapReader.js';
|
|
4
|
+
import { FILE_HISTORY_DISABLED } from './request/taskRequest.js';
|
|
4
5
|
export function projectFileHistoryCaptureCapability(caps) {
|
|
5
6
|
if (caps === null || typeof caps !== 'object' || Array.isArray(caps))
|
|
6
7
|
return undefined;
|
|
@@ -25,29 +26,62 @@ export function observedFileHistoryCapture(baseUrl = engineWireTarget()?.baseUrl
|
|
|
25
26
|
return reader.observed(baseUrl);
|
|
26
27
|
}
|
|
27
28
|
export function fileHistoryCaptureMode(reading) {
|
|
28
|
-
if (reading
|
|
29
|
+
if (typeof reading !== 'object' || reading === null)
|
|
29
30
|
return 'unknown';
|
|
30
|
-
|
|
31
|
+
let kind;
|
|
32
|
+
let word;
|
|
33
|
+
try {
|
|
34
|
+
kind = reading.kind;
|
|
35
|
+
word = kind === 'present' ? reading.word : undefined;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return 'unknown';
|
|
39
|
+
}
|
|
40
|
+
if (kind !== 'present')
|
|
41
|
+
return 'unknown';
|
|
42
|
+
if (word === 'off')
|
|
31
43
|
return 'off';
|
|
32
|
-
if (
|
|
44
|
+
if (word === 'on-optional')
|
|
45
|
+
return 'on-optional';
|
|
46
|
+
if (word === 'on-always')
|
|
33
47
|
return 'on-always';
|
|
34
48
|
return 'unknown';
|
|
35
49
|
}
|
|
50
|
+
export function fileHistoryDeclarationField(reading, captureOff) {
|
|
51
|
+
return captureOff === true && fileHistoryCaptureMode(reading) === 'on-optional' ? { fileHistory: FILE_HISTORY_DISABLED } : {};
|
|
52
|
+
}
|
|
36
53
|
const WORD_DETAIL_MAX = 40;
|
|
37
54
|
export function fileHistoryCaptureDoctorDetail(reading) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
55
|
+
const unobserved = 'file history capture not observed — the engine reports it on /v1/capabilities; this process has no usable capabilities reading cached for it, so whether this deployment captures file history is unknown';
|
|
56
|
+
if (typeof reading !== 'object' || reading === null)
|
|
57
|
+
return unobserved;
|
|
58
|
+
let kind;
|
|
59
|
+
let word;
|
|
60
|
+
try {
|
|
61
|
+
kind = reading.kind;
|
|
62
|
+
word = kind === 'present' ? reading.word : undefined;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return unobserved;
|
|
66
|
+
}
|
|
67
|
+
switch (kind) {
|
|
41
68
|
case 'not_reported':
|
|
42
69
|
return 'file history capture not reported by this engine — only newer engines advertise it; this does not say whether file history is captured here';
|
|
43
70
|
case 'present':
|
|
44
|
-
if (
|
|
71
|
+
if (typeof word !== 'string' || word.length === 0)
|
|
72
|
+
return unobserved;
|
|
73
|
+
if (word === 'off') {
|
|
45
74
|
return 'file history capture off on this deployment — the engine takes no snapshots of the files it changes; whether code can be rewound here is answered separately by the rewind readings';
|
|
46
75
|
}
|
|
47
|
-
if (
|
|
76
|
+
if (word === 'on-optional') {
|
|
77
|
+
return 'file history capture on — the engine snapshots files before changing them, and a session on this deployment can opt out of capture for its own runs';
|
|
78
|
+
}
|
|
79
|
+
if (word === 'on-always') {
|
|
48
80
|
return 'file history capture always on — the engine snapshots files before changing them in every session, and it cannot be turned off for a single session here';
|
|
49
81
|
}
|
|
50
|
-
return `file history capture reported as "${capForDisplay(
|
|
82
|
+
return `file history capture reported as "${capForDisplay(word, WORD_DETAIL_MAX)}" — a mode this client does not know yet, so whether it captures is shown as unknown`;
|
|
83
|
+
default:
|
|
84
|
+
return unobserved;
|
|
51
85
|
}
|
|
52
86
|
}
|
|
53
87
|
export function forgetFileHistoryCaptureReading(baseUrl) {
|
package/dist/gateVocabulary.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DeniedBy } from '@sema-agent/sdk';
|
|
2
|
+
import type { APPROVAL_MANDATE_WORDS } from './hitl/toolApprovalWire.js';
|
|
2
3
|
export declare const CC_TOOL_DENIAL_KINDS: readonly ["user-rejected", "permission-rule", "automode-blocked", "automode-unavailable", "automode-parsing-error", "interrupted", "cancelled"];
|
|
3
4
|
export type CcToolDenialKind = (typeof CC_TOOL_DENIAL_KINDS)[number];
|
|
4
5
|
export declare function isCcToolDenialKind(v: unknown): v is CcToolDenialKind;
|
|
@@ -7,14 +8,12 @@ export declare function ccToolDenialKindForSettledBy(settledBy: unknown): CcTool
|
|
|
7
8
|
export declare const GATE_DENIED_BY_WORDS: readonly DeniedBy[];
|
|
8
9
|
export declare function isGateDeniedByWord(v: unknown): v is DeniedBy;
|
|
9
10
|
export declare function gateDeniedByDetail(deniedBy: unknown): string;
|
|
10
|
-
export declare const ASK_ORIGIN_WORDS: readonly string[];
|
|
11
11
|
export declare function askOriginDetail(origin: unknown, message?: unknown): string;
|
|
12
12
|
export declare const RULE_STORE_UNREADABLE_KINDS: readonly ["store", "call"];
|
|
13
13
|
export type RuleStoreUnreadableKind = (typeof RULE_STORE_UNREADABLE_KINDS)[number];
|
|
14
14
|
export declare function isRuleStoreUnreadableKind(v: unknown): v is RuleStoreUnreadableKind;
|
|
15
15
|
export declare function ruleStoreUnreadableDetail(kind: RuleStoreUnreadableKind): string;
|
|
16
16
|
export declare function mandatedApprovalDetail(): string;
|
|
17
|
-
export declare const APPROVAL_MANDATE_WORDS: readonly ["operator_always", "tool_marks", "probe_mandate", "probe_unanswered", "write_protection", "write_protection_unresolved"];
|
|
18
17
|
export type ApprovalMandateWord = (typeof APPROVAL_MANDATE_WORDS)[number];
|
|
19
18
|
export declare function isApprovalMandateWord(v: unknown): v is ApprovalMandateWord;
|
|
20
19
|
export declare function approvalMandateDetail(word: ApprovalMandateWord): string;
|
package/dist/gateVocabulary.js
CHANGED
|
@@ -54,19 +54,6 @@ export function gateDeniedByDetail(deniedBy) {
|
|
|
54
54
|
const word = typeof deniedBy === 'string' && deniedBy.length > 0 ? deniedBy : '(none)';
|
|
55
55
|
return `denied by a layer this build does not know (${word}) — this build does not know this layer name: a newer engine may have added it, or the record may be damaged; this client cannot tell which`;
|
|
56
56
|
}
|
|
57
|
-
export const ASK_ORIGIN_WORDS = Object.freeze([
|
|
58
|
-
'content_question',
|
|
59
|
-
'ancestor_marked',
|
|
60
|
-
'org_unavailable',
|
|
61
|
-
'org_rule',
|
|
62
|
-
'rule_store_unavailable',
|
|
63
|
-
'hook',
|
|
64
|
-
'ask_rule',
|
|
65
|
-
'denial_limit_fallback',
|
|
66
|
-
'shell_gate_tighten',
|
|
67
|
-
'safety_tighten',
|
|
68
|
-
'policy',
|
|
69
|
-
]);
|
|
70
57
|
const ASK_ORIGIN_SENTENCES = Object.freeze({
|
|
71
58
|
content_question: 'the tool itself asked you a question',
|
|
72
59
|
ancestor_marked: 'an ancestor marked this call (an inherited approver-unavailable float, or a durable mandate): it must reach the park with no synchronous decision-maker in between',
|
|
@@ -118,17 +105,8 @@ export function ruleStoreUnreadableDetail(kind) {
|
|
|
118
105
|
export function mandatedApprovalDetail() {
|
|
119
106
|
return 'no saved allow rule and no remembered answer can retire this question; each call is settled on its own — by you here, by a hook, or by an automatic check the deployment runs — and an answer covers only that call';
|
|
120
107
|
}
|
|
121
|
-
export const APPROVAL_MANDATE_WORDS = Object.freeze([
|
|
122
|
-
'operator_always',
|
|
123
|
-
'tool_marks',
|
|
124
|
-
'probe_mandate',
|
|
125
|
-
'probe_unanswered',
|
|
126
|
-
'write_protection',
|
|
127
|
-
'write_protection_unresolved',
|
|
128
|
-
]);
|
|
129
108
|
const _mandateWordsPin = true;
|
|
130
109
|
void _mandateWordsPin;
|
|
131
|
-
const APPROVAL_MANDATE_SET = new Set(APPROVAL_MANDATE_WORDS);
|
|
132
110
|
export function isApprovalMandateWord(v) {
|
|
133
111
|
return APPROVAL_MANDATE_SET.has(v);
|
|
134
112
|
}
|
|
@@ -140,6 +118,7 @@ const APPROVAL_MANDATE_SENTENCES = Object.freeze({
|
|
|
140
118
|
write_protection: "this change lands on a protected location (the agent's own configuration), which is confirmed one change at a time",
|
|
141
119
|
write_protection_unresolved: 'the protected-location check could not tell where this change lands, so whether it touches a protected location is unknown',
|
|
142
120
|
});
|
|
121
|
+
const APPROVAL_MANDATE_SET = new Set(Object.keys(APPROVAL_MANDATE_SENTENCES));
|
|
143
122
|
export function approvalMandateDetail(word) {
|
|
144
123
|
if (typeof word === 'string' && Object.hasOwn(APPROVAL_MANDATE_SENTENCES, word)) {
|
|
145
124
|
return APPROVAL_MANDATE_SENTENCES[word];
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
export const CORE_ENGINE_NOTICE_CODES = Object.freeze([
|
|
2
|
+
"config.autocompact_window_clamped",
|
|
3
|
+
"config.env_timeout_discarded",
|
|
4
|
+
"config.materialize_env_discarded",
|
|
5
|
+
"config.models_swapped",
|
|
6
|
+
"config.context_settings_swapped",
|
|
7
|
+
"config.read_face_swapped",
|
|
8
|
+
"config.read_face_deployment_clamped",
|
|
9
|
+
"config.write_face_swapped",
|
|
10
|
+
"config.write_face_deployment_clamped",
|
|
11
|
+
"config.tool_model_gate_removed",
|
|
12
|
+
"config.tool_model_gate_unknown_class",
|
|
13
|
+
"config.tool_model_gate_env_invalid",
|
|
14
|
+
"config.artifact_host_invalid",
|
|
15
|
+
"config.task_root_not_canonical",
|
|
16
|
+
"config.write_protection_target_view_absent",
|
|
17
|
+
"config.write_protection_unresolved",
|
|
18
|
+
"config.execution_env_capability_invalid",
|
|
19
|
+
"config.tool_card_undeclared",
|
|
20
|
+
"config.tool_face_undeclared",
|
|
21
|
+
"config.tool_face_invalid",
|
|
22
|
+
"config.forward_sink_failed",
|
|
23
|
+
"config.durable_gate_unavailable",
|
|
24
|
+
"config.peer_admission_out_of_range",
|
|
25
|
+
"config.peer_lane_unmounted",
|
|
26
|
+
"config.secret_env_scrubbed",
|
|
27
|
+
"peer.inbound_disposition",
|
|
28
|
+
"peer.held_settled",
|
|
29
|
+
"peer.idle_subscription",
|
|
30
|
+
"classifier.denial_limit",
|
|
31
|
+
"classifier.fallback",
|
|
32
|
+
"classifier.role_defaulted",
|
|
33
|
+
"classifier.contract_broken",
|
|
34
|
+
"checkpoint.execution_outcome_unrecorded",
|
|
35
|
+
"delegation.transcript_integrity",
|
|
36
|
+
"delegation.ask_unresolvable",
|
|
37
|
+
"mcp.injection_dropped",
|
|
38
|
+
"mcp.revocation_probe_failed",
|
|
39
|
+
"mcp.server_redialed",
|
|
40
|
+
"workflow.governance_key_stripped",
|
|
41
|
+
"workflow.agent_option_ignored",
|
|
42
|
+
"memory.session_polluted",
|
|
43
|
+
"memory.harvest_quarantined",
|
|
44
|
+
"memory.delegation_static_mark_waived",
|
|
45
|
+
"memory.content_class_declared",
|
|
46
|
+
"memory.hold_opened",
|
|
47
|
+
"memory.hold_released",
|
|
48
|
+
"memory.hold_disposed",
|
|
49
|
+
"memory.consolidation_recommended",
|
|
50
|
+
"memory.consolidation_committed",
|
|
51
|
+
"memory.consolidation_conflict",
|
|
52
|
+
"memory.consolidation_incomplete",
|
|
53
|
+
"memory.consolidation_refused",
|
|
54
|
+
"memory.consolidation_withheld",
|
|
55
|
+
"memory.restore_withheld",
|
|
56
|
+
"memory.project_scope_absent",
|
|
57
|
+
"route.fallback_to_primary",
|
|
58
|
+
"route.classifier_unroutable",
|
|
59
|
+
"route.base_url_changed_key_unchanged",
|
|
60
|
+
"route.response_model_mismatch",
|
|
61
|
+
"task.user_steer_undrained",
|
|
62
|
+
"task.user_followup_undrained",
|
|
63
|
+
"steering.parked_input_blocked",
|
|
64
|
+
"task.turn_interrupted",
|
|
65
|
+
"task.halt_unconsumed",
|
|
66
|
+
"task.late_approval",
|
|
67
|
+
"task.interrupt_unconsumed",
|
|
68
|
+
"approval.read_root_granted",
|
|
69
|
+
"approval.read_root_grant_rejected",
|
|
70
|
+
"memory.capture_opted_out",
|
|
71
|
+
"memory.capture_optout_unpersisted",
|
|
72
|
+
"skills.listing_truncated",
|
|
73
|
+
"agents.listing_truncated",
|
|
74
|
+
"tool_result.offload_put_failed",
|
|
75
|
+
]);
|
|
76
|
+
export const CORE_NOTICE_AUDIENCE = Object.freeze({
|
|
77
|
+
"config.autocompact_window_clamped": "operator",
|
|
78
|
+
"config.env_timeout_discarded": "operator",
|
|
79
|
+
"config.materialize_env_discarded": "operator",
|
|
80
|
+
"config.models_swapped": "operator",
|
|
81
|
+
"config.context_settings_swapped": "operator",
|
|
82
|
+
"config.read_face_swapped": "operator",
|
|
83
|
+
"config.read_face_deployment_clamped": "operator",
|
|
84
|
+
"config.write_face_swapped": "operator",
|
|
85
|
+
"config.write_face_deployment_clamped": "operator",
|
|
86
|
+
"config.tool_model_gate_removed": "operator",
|
|
87
|
+
"config.tool_model_gate_unknown_class": "operator",
|
|
88
|
+
"config.tool_model_gate_env_invalid": "operator",
|
|
89
|
+
"config.artifact_host_invalid": "operator",
|
|
90
|
+
"config.task_root_not_canonical": "operator",
|
|
91
|
+
"config.write_protection_target_view_absent": "operator",
|
|
92
|
+
"config.write_protection_unresolved": "operator",
|
|
93
|
+
"config.execution_env_capability_invalid": "operator",
|
|
94
|
+
"config.tool_card_undeclared": "operator",
|
|
95
|
+
"config.tool_face_undeclared": "operator",
|
|
96
|
+
"config.tool_face_invalid": "operator",
|
|
97
|
+
"config.forward_sink_failed": "operator",
|
|
98
|
+
"config.durable_gate_unavailable": "user",
|
|
99
|
+
"config.peer_admission_out_of_range": "operator",
|
|
100
|
+
"config.peer_lane_unmounted": "operator",
|
|
101
|
+
"config.secret_env_scrubbed": "operator",
|
|
102
|
+
"peer.inbound_disposition": "user",
|
|
103
|
+
"peer.held_settled": "user",
|
|
104
|
+
"peer.idle_subscription": "user",
|
|
105
|
+
"classifier.denial_limit": "user",
|
|
106
|
+
"classifier.fallback": "operator",
|
|
107
|
+
"classifier.role_defaulted": "operator",
|
|
108
|
+
"classifier.contract_broken": "operator",
|
|
109
|
+
"checkpoint.execution_outcome_unrecorded": "operator",
|
|
110
|
+
"delegation.transcript_integrity": "operator",
|
|
111
|
+
"delegation.ask_unresolvable": "user",
|
|
112
|
+
"mcp.injection_dropped": "user",
|
|
113
|
+
"mcp.revocation_probe_failed": "operator",
|
|
114
|
+
"mcp.server_redialed": "operator",
|
|
115
|
+
"workflow.governance_key_stripped": "operator",
|
|
116
|
+
"workflow.agent_option_ignored": "operator",
|
|
117
|
+
"memory.session_polluted": "user",
|
|
118
|
+
"memory.harvest_quarantined": "user",
|
|
119
|
+
"memory.delegation_static_mark_waived": "user",
|
|
120
|
+
"memory.content_class_declared": "operator",
|
|
121
|
+
"memory.hold_opened": "user",
|
|
122
|
+
"memory.hold_released": "user",
|
|
123
|
+
"memory.hold_disposed": "user",
|
|
124
|
+
"memory.consolidation_recommended": "operator",
|
|
125
|
+
"memory.consolidation_committed": "operator",
|
|
126
|
+
"memory.consolidation_conflict": "operator",
|
|
127
|
+
"memory.consolidation_incomplete": "operator",
|
|
128
|
+
"memory.consolidation_refused": "operator",
|
|
129
|
+
"memory.consolidation_withheld": "operator",
|
|
130
|
+
"memory.restore_withheld": "operator",
|
|
131
|
+
"memory.project_scope_absent": "operator",
|
|
132
|
+
"route.fallback_to_primary": "operator",
|
|
133
|
+
"route.classifier_unroutable": "operator",
|
|
134
|
+
"route.base_url_changed_key_unchanged": "operator",
|
|
135
|
+
"route.response_model_mismatch": "operator",
|
|
136
|
+
"task.user_steer_undrained": "user",
|
|
137
|
+
"task.user_followup_undrained": "user",
|
|
138
|
+
"steering.parked_input_blocked": "user",
|
|
139
|
+
"task.turn_interrupted": "user",
|
|
140
|
+
"task.halt_unconsumed": "user",
|
|
141
|
+
"task.late_approval": "user",
|
|
142
|
+
"task.interrupt_unconsumed": "user",
|
|
143
|
+
"approval.read_root_granted": "user",
|
|
144
|
+
"approval.read_root_grant_rejected": "user",
|
|
145
|
+
"memory.capture_opted_out": "user",
|
|
146
|
+
"memory.capture_optout_unpersisted": "user",
|
|
147
|
+
"skills.listing_truncated": "operator",
|
|
148
|
+
"agents.listing_truncated": "operator",
|
|
149
|
+
"tool_result.offload_put_failed": "operator",
|
|
150
|
+
});
|
|
151
|
+
export const CORE_MCP_INJECTION_DROP_REASONS = Object.freeze([
|
|
152
|
+
"malformed_entry",
|
|
153
|
+
"name_reserved_by_deployment",
|
|
154
|
+
"gate_closed",
|
|
155
|
+
"over_cap",
|
|
156
|
+
]);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const CORE_PROTOCOL_PREFIXES = ["mcp__", "a2a__"];
|
|
2
|
+
export const CORE_RETIRED_TOOL_CURRENT_NAMES = new Map([
|
|
3
|
+
["read_file", "Read"],
|
|
4
|
+
["edit_file", "Edit"],
|
|
5
|
+
["write_file", "Write"],
|
|
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,11 +1,9 @@
|
|
|
1
1
|
import { permissionModeField } from './permissionWireCaps.js';
|
|
2
2
|
import { hostEnv } from './hostEnv.js';
|
|
3
3
|
import { lastFlagValue } from './argvFlagValue.js';
|
|
4
|
+
import { PERMISSION_MODE_WORDS } from './taskRequestWords.js';
|
|
4
5
|
export const HEADLESS_PERMISSION_MODE_ENV = 'SEMA_HEADLESS_PERMISSION_MODE';
|
|
5
|
-
const
|
|
6
|
-
const _headlessPermissionModePins = [true, true];
|
|
7
|
-
void _headlessPermissionModePins;
|
|
8
|
-
export const HEADLESS_PERMISSION_WIRE_MODES = HEADLESS_PERMISSION_WIRE_MODE_TUPLE;
|
|
6
|
+
export const HEADLESS_PERMISSION_WIRE_MODES = [...PERMISSION_MODE_WORDS];
|
|
9
7
|
const SHELL_INTERNAL_MODE_TO_WIRE = new Map([
|
|
10
8
|
['manual', 'default'],
|
|
11
9
|
['dontAsk', 'default'],
|
|
@@ -9,6 +9,7 @@ export declare function gateArmedWaitMs(): number;
|
|
|
9
9
|
export declare function waitForGateArmed(keys: readonly string[], timeoutMs: number): Promise<boolean>;
|
|
10
10
|
export declare function waitForGateArmedFor(sessionKey: string, keys: readonly string[], timeoutMs: number): Promise<boolean>;
|
|
11
11
|
export declare function registerArmedGateFromQuestionId(questionId: unknown): void;
|
|
12
|
+
export declare function registerArmedGateFromQuestionIdFor(sessionKey: string, questionId: unknown): void;
|
|
12
13
|
export declare function planReviewArmedKey(taskId: string): string;
|
|
13
14
|
export declare function planReviewArmedKeyFor(sessionKey: string, taskId: string): string;
|
|
14
15
|
export declare function notePlanReviewAnswered(questionId: unknown): void;
|
|
@@ -120,7 +120,7 @@ function armedKeyForQuestionIdFor(sessionKey, questionId) {
|
|
|
120
120
|
export function registerArmedGateFromQuestionId(questionId) {
|
|
121
121
|
registerArmedGateFromQuestionIdFor(DEFAULT_SESSION_KEY, questionId);
|
|
122
122
|
}
|
|
123
|
-
function registerArmedGateFromQuestionIdFor(sessionKey, questionId) {
|
|
123
|
+
export function registerArmedGateFromQuestionIdFor(sessionKey, questionId) {
|
|
124
124
|
if (typeof questionId !== 'string' || questionId.length === 0)
|
|
125
125
|
return;
|
|
126
126
|
if (questionId.startsWith(PLAN_REVIEW_QUESTION_ID_PREFIX) && !questionId.includes(REOPEN_ID_TAIL)) {
|
package/dist/hitl/frameRouter.js
CHANGED
|
@@ -6,7 +6,9 @@ import { readRunTerminal, runTerminalCode, runTerminalGateKind, runTerminalGateT
|
|
|
6
6
|
import { surfaceForCurrentSession } from './hitlHostSurface.js';
|
|
7
7
|
import { SEMA_DENIAL_KIND_KEY } from './gateLedger.js';
|
|
8
8
|
import { ccToolDenialKindForSettledBy } from '../gateVocabulary.js';
|
|
9
|
-
|
|
9
|
+
import { REJECT_MESSAGE } from '../adapt/wireShapes.js';
|
|
10
|
+
import { RUN_CANCELLED_CODE } from '../runCancelContext.js';
|
|
11
|
+
export const HITL_REJECT_MESSAGE = REJECT_MESSAGE;
|
|
10
12
|
export const HITL_POLICY_DENY_MESSAGE = 'Permission for this tool use was denied: it requires interactive approval, and permission prompts are ' +
|
|
11
13
|
'not available in this session. The action was NOT performed. Do not claim it succeeded, and do not retry ' +
|
|
12
14
|
'it in this session \u2014 report the limitation to the user, or suggest an alternative.';
|
|
@@ -31,7 +33,7 @@ function denyStampedEnd(ev, attribution) {
|
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
export const HITL_INTERRUPT_MESSAGE_FOR_TOOL_USE = '[Request interrupted by user for tool use]';
|
|
34
|
-
const RUN_CANCELLED_ERROR_CODE =
|
|
36
|
+
const RUN_CANCELLED_ERROR_CODE = RUN_CANCELLED_CODE;
|
|
35
37
|
export const ENGINE_ABORT_TOOL_RESULT = 'Operation aborted';
|
|
36
38
|
export function toolEndOutputText(output) {
|
|
37
39
|
if (typeof output === 'string')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { putOwnKey } from '../ownKey.js';
|
|
2
2
|
import { DecideTransportRetryExhaustedError, HitlBridge, HitlSafetyError, findPendingForTask, readDecideCurrentPending, readWireErrorCode, } from './hitlBridge.js';
|
|
3
|
-
import { PARKED_RESUME_STARTUP_FAILED, RESUME_POLICY_FOLD_CODE } from '../engineErrorCodes.js';
|
|
3
|
+
import { PARKED_RESUME_STARTUP_FAILED, RESUME_POLICY_FOLD_CODE, isDecideParkMovedCode } from '../engineErrorCodes.js';
|
|
4
4
|
import { publishQuestionFrame, registerLocalQuestionResponder, hasQuestionOverlay, } from '../liveQuestionStore.js';
|
|
5
5
|
import { hostLog } from '../host.js';
|
|
6
6
|
import { surfaceFsApprovalAndDecide } from './toolApprovalWire.js';
|
|
@@ -46,6 +46,8 @@ function isAlreadyResolvedFailure(outcome) {
|
|
|
46
46
|
return code === 'no_pending';
|
|
47
47
|
if ('errorCode' in outcome && isCodeClassifiedGateFailure(outcome.errorCode))
|
|
48
48
|
return false;
|
|
49
|
+
if ('errorCode' in outcome && isDecideParkMovedCode(outcome.errorCode))
|
|
50
|
+
return true;
|
|
49
51
|
return isAlreadyResolvedGateReason(outcome.reason);
|
|
50
52
|
}
|
|
51
53
|
export function isGateStandingErrorCode(code) {
|
|
@@ -65,6 +65,16 @@ export interface PlanReviewDeliveryOptions {
|
|
|
65
65
|
export interface DecidePlanReviewOptions extends PlanReviewDeliveryOptions {
|
|
66
66
|
reason?: string;
|
|
67
67
|
}
|
|
68
|
+
export interface PlanReviewDecisionHandle {
|
|
69
|
+
settle(): void;
|
|
70
|
+
revoke(): void;
|
|
71
|
+
}
|
|
72
|
+
export declare function notePlanReviewDecisionHandedOver(taskId: string): PlanReviewDecisionHandle | null;
|
|
73
|
+
export declare function planReviewPendingReadMark(): number;
|
|
74
|
+
export declare function planReviewDecisionInFlight(taskId: string, pendingReadStartedAt?: number): boolean;
|
|
75
|
+
export declare function notePlanReviewDecisionNotApplied(taskId: string): void;
|
|
76
|
+
export declare function notePlanReviewGateLeft(taskId: string): void;
|
|
77
|
+
export declare function latestPlanReviewDecisionMark(taskId: string): number | null;
|
|
68
78
|
export declare function __resetPlanReviewDecisionLatchForTests(): void;
|
|
69
79
|
export declare function decidePlanReview(taskId: string, decision: 'approve' | 'reject', permissionModeAfter?: string, opts?: DecidePlanReviewOptions): Promise<void>;
|
|
70
80
|
export interface ReopenPlanReviewOpts {
|
|
@@ -77,6 +87,7 @@ export interface ReopenPlanReviewOpts {
|
|
|
77
87
|
trigger?: PlanReviewReopenTrigger;
|
|
78
88
|
readGateInstanceKeys?: PlanReviewGateInstanceReader;
|
|
79
89
|
decisionHandedOver?: (taskId: string) => boolean;
|
|
90
|
+
pendingReadStartedAt?: number;
|
|
80
91
|
}
|
|
81
92
|
export declare function _resetActiveReopenRespondersForTest(): void;
|
|
82
93
|
export declare function reopenPlanReviewCard(taskId: string, opts: ReopenPlanReviewOpts & {
|