@skrr-ai/cli 0.1.189 → 0.1.191
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/dist/commands/agents/supervision.d.ts +4 -0
- package/dist/commands/agents/supervision.js +132 -15
- package/dist/commands/convos/fork.js +14 -3
- package/dist/commands/convos/handover.js +8 -3
- package/dist/commands/harnesses/evaluations/platform-h9-turn.js +13 -3
- package/dist/commands/tasks/interrupt.js +12 -1
- package/dist/lib/chat-supervision.d.ts +2 -2
- package/dist/lib/chat-supervision.js +4 -1
- package/dist/lib/h9-platform-stream.d.ts +2 -0
- package/dist/lib/h9-platform-stream.js +8 -2
- package/dist/node_modules/@skrr-ai/data-provider/index.js +1200 -1198
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +4 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +38 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +77 -12
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +2 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +2 -2
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +38 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +113 -13
- package/oclif.manifest.json +18 -6
- package/package.json +3 -3
|
@@ -21,5 +21,9 @@ export default class AgentSupervision extends BaseCommand {
|
|
|
21
21
|
reason: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
22
|
'recheck-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
23
|
};
|
|
24
|
+
private printStatus;
|
|
25
|
+
private printCheck;
|
|
26
|
+
private printChats;
|
|
27
|
+
private printExplanation;
|
|
24
28
|
run(): Promise<void>;
|
|
25
29
|
}
|
|
@@ -4,6 +4,38 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const base_command_1 = require("../../base-command");
|
|
5
5
|
const api_fetch_1 = require("../../lib/api-fetch");
|
|
6
6
|
const chat_supervision_1 = require("../../lib/chat-supervision");
|
|
7
|
+
const chatStates = {
|
|
8
|
+
observing: 'Awaiting a fresh check',
|
|
9
|
+
waiting: 'Waiting',
|
|
10
|
+
intervening: 'Checking recovery',
|
|
11
|
+
verifying: 'Checking recovery',
|
|
12
|
+
needs_owner: 'Needs your attention',
|
|
13
|
+
paused: 'Follow-up paused',
|
|
14
|
+
settled: 'Checked',
|
|
15
|
+
};
|
|
16
|
+
const chatReasons = {
|
|
17
|
+
no_execution_to_follow: 'No work has started in this chat yet.',
|
|
18
|
+
execution_completed: 'The chat’s last execution completed.',
|
|
19
|
+
person_stopped: 'You stopped this work. It will stay stopped.',
|
|
20
|
+
owner_excluded: 'You paused follow-up for this chat.',
|
|
21
|
+
chat_excluded: 'You paused follow-up for this chat.',
|
|
22
|
+
owner_reincluded: 'You resumed follow-up. A fresh check is pending.',
|
|
23
|
+
background_paused: 'Turn on Always-On to resume chat checks.',
|
|
24
|
+
supervision_disabled: 'Follow up on chats is off for this Agent.',
|
|
25
|
+
execution_source_changed: 'The chat state changed and needs another check.',
|
|
26
|
+
execution_state_unknown: 'The runtime has yet to confirm the execution state.',
|
|
27
|
+
execution_state_unconfirmed_too_long: 'We could not confirm whether the work finished. Open the chat to review it.',
|
|
28
|
+
platform_recovery_unavailable: 'The chat was interrupted and automatic recovery is unavailable.',
|
|
29
|
+
waiting_for_question: 'The chat is waiting for an answer.',
|
|
30
|
+
waiting_for_permission: 'The chat is waiting for an approval.',
|
|
31
|
+
waiting_for_human_input: 'The chat is waiting for your input.',
|
|
32
|
+
waiting_for_answer_delivery: 'The runtime has yet to confirm delivery of the answer.',
|
|
33
|
+
waiting_for_decision_delivery: 'The runtime has yet to confirm delivery of the approval decision.',
|
|
34
|
+
waiting_for_interaction_confirmation: 'The runtime has yet to confirm whether the chat is waiting for input.',
|
|
35
|
+
waiting_for_billing: 'The chat is waiting for available credits.',
|
|
36
|
+
waiting_for_quota: 'The chat is waiting for provider quota.',
|
|
37
|
+
waiting_for_runtime: 'The chat is waiting for its runtime.',
|
|
38
|
+
};
|
|
7
39
|
class AgentSupervision extends base_command_1.BaseCommand {
|
|
8
40
|
static description = 'Manage this Agent’s chat follow-through, inspect current state, or schedule a condition check.';
|
|
9
41
|
static args = {
|
|
@@ -28,11 +60,13 @@ class AgentSupervision extends base_command_1.BaseCommand {
|
|
|
28
60
|
}),
|
|
29
61
|
};
|
|
30
62
|
static examples = [
|
|
63
|
+
'<%= config.bin %> agents supervision <agent-id> preflight',
|
|
31
64
|
'<%= config.bin %> agents supervision <agent-id> preflight --json',
|
|
32
65
|
'<%= config.bin %> agents supervision <agent-id> enable --revision 0 --request-id <stable-key> --json',
|
|
33
66
|
'<%= config.bin %> agents supervision <agent-id> disable --revision 1 --request-id <new-stable-key> --json',
|
|
34
67
|
'<%= config.bin %> agents supervision <agent-id> exclude --watch <watch-id> --plan-revision 2 --json',
|
|
35
68
|
'<%= config.bin %> agents supervision <agent-id> explain --watch <watch-id> --json',
|
|
69
|
+
'<%= config.bin %> agents supervision <agent-id> check-now',
|
|
36
70
|
'<%= config.bin %> agents supervision <agent-id> check-now --json',
|
|
37
71
|
'<%= config.bin %> agents supervision <agent-id> chats --json',
|
|
38
72
|
'<%= config.bin %> agents supervision <agent-id> inspect --watch <watch-id> --json',
|
|
@@ -52,7 +86,7 @@ class AgentSupervision extends base_command_1.BaseCommand {
|
|
|
52
86
|
}),
|
|
53
87
|
mode: core_1.Flags.string({
|
|
54
88
|
options: ['recover', 'shadow'],
|
|
55
|
-
description: '
|
|
89
|
+
description: 'Use recover or monitoring-only shadow. By default, enable uses monitoring when recovery is unconfirmed or unavailable, and disable keeps the saved mode.',
|
|
56
90
|
}),
|
|
57
91
|
'plan-revision': core_1.Flags.integer({ min: 1, description: 'Current planRevision from inspect' }),
|
|
58
92
|
'source-revision': core_1.Flags.string({ description: 'Current sourceRevision from inspect' }),
|
|
@@ -65,43 +99,126 @@ class AgentSupervision extends base_command_1.BaseCommand {
|
|
|
65
99
|
reason: core_1.Flags.string({ description: 'Why this chat needs this condition check' }),
|
|
66
100
|
'recheck-id': core_1.Flags.string({ description: 'Exact current recheck.id to cancel' }),
|
|
67
101
|
};
|
|
102
|
+
printStatus(view) {
|
|
103
|
+
const { configuration, operational } = view;
|
|
104
|
+
const readiness = operational.recoveryReadiness ??
|
|
105
|
+
(operational.recoverySupported ? 'available' : 'unconfirmed');
|
|
106
|
+
const fallsBack = configuration.mode === 'recover' && readiness !== 'available';
|
|
107
|
+
const mode = configuration.mode === 'shadow' ? 'monitoring only' : 'automatic recovery';
|
|
108
|
+
this.log(`Chat follow-up is ${configuration.enabled ? 'on' : 'off'}.`);
|
|
109
|
+
this.log(`Configuration revision ${configuration.revision}.`);
|
|
110
|
+
if (operational.backgroundPaused)
|
|
111
|
+
this.log('Turn on Always-On from the Agent profile for chat checks to run.');
|
|
112
|
+
if (configuration.enabled) {
|
|
113
|
+
this.log(`Saved mode is ${mode}.`);
|
|
114
|
+
if (fallsBack)
|
|
115
|
+
this.log(`Automatic recovery is ${readiness}.`);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.log(`Turning it on will use ${fallsBack ? 'monitoring only' : mode}.`);
|
|
119
|
+
if (fallsBack)
|
|
120
|
+
this.log(`Automatic recovery is ${readiness}.`);
|
|
121
|
+
this.log('Enable follow-up with the current revision and a fresh request ID.');
|
|
122
|
+
this.log(` ${this.config.bin} agents supervision ${view.agentId} enable --revision ${configuration.revision} --request-id <new-id>`);
|
|
123
|
+
}
|
|
124
|
+
printCheck(receipt) {
|
|
125
|
+
if (receipt.status === 'queued') {
|
|
126
|
+
this.log('Chat check queued.');
|
|
127
|
+
if (receipt.checkId)
|
|
128
|
+
this.log(`Check ID ${receipt.checkId}`);
|
|
129
|
+
if (receipt.check?.dutyId) {
|
|
130
|
+
this.log('To see its result, list the duty checks and find this ID.');
|
|
131
|
+
this.log(` ${this.config.bin} duties checks ${receipt.check.dutyId}`);
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.log(receipt.reason === 'active_check' || receipt.reason === 'reservation_exists'
|
|
136
|
+
? 'A previous check is preventing a new chat check.'
|
|
137
|
+
: 'No chat check was started. Read supervision status before trying again.');
|
|
138
|
+
}
|
|
139
|
+
printChats(page) {
|
|
140
|
+
if (!page.items.length)
|
|
141
|
+
this.log('No followed chats are listed yet.');
|
|
142
|
+
for (const chat of page.items) {
|
|
143
|
+
const title = chat.title?.replace(/\s+/g, ' ').trim() ||
|
|
144
|
+
(chat.chatRef.kind === 'agent_main' ? 'Main chat' : 'Thread');
|
|
145
|
+
this.log(`${title} · ${chatStates[chat.state] ?? 'Status unconfirmed'} · Watch ${chat.id}`);
|
|
146
|
+
}
|
|
147
|
+
if (page.nextCursor)
|
|
148
|
+
this.log(`More chats are available. Continue with --cursor ${page.nextCursor}`);
|
|
149
|
+
}
|
|
150
|
+
printExplanation({ chat }) {
|
|
151
|
+
const title = chat.chatRef.kind === 'agent_main' ? 'Main chat' : 'Thread';
|
|
152
|
+
this.log(`${title} · ${chatStates[chat.state] ?? 'Status unconfirmed'}`);
|
|
153
|
+
if (chat.reason)
|
|
154
|
+
this.log(chatReasons[chat.reason] ?? 'Use --json to see the recorded reason.');
|
|
155
|
+
if (chat.lastCheckedAt)
|
|
156
|
+
this.log(`Last checked ${chat.lastCheckedAt}`);
|
|
157
|
+
if (chat.nextCheckAt)
|
|
158
|
+
this.log(`Next check ${chat.nextCheckAt}`);
|
|
159
|
+
if (chat.recheck?.status === 'scheduled')
|
|
160
|
+
this.log(`Condition check due ${chat.recheck.dueAt}`);
|
|
161
|
+
}
|
|
68
162
|
async run() {
|
|
69
163
|
this.requireAuth();
|
|
70
164
|
const { args, flags } = await this.parse(AgentSupervision);
|
|
71
165
|
const required = (name) => {
|
|
72
166
|
const value = flags[name];
|
|
73
167
|
if (value == null || value === '')
|
|
74
|
-
this.error(
|
|
168
|
+
this.error(name === 'root' && args.action === 'recheck'
|
|
169
|
+
? '--root is required for recheck. Use the work anchor from inspect. If the chat has no work yet, start a turn first.'
|
|
170
|
+
: `--${name} is required for ${args.action}. Read status/preflight or inspect for the relevant revision first.`);
|
|
75
171
|
return value;
|
|
76
172
|
};
|
|
77
173
|
try {
|
|
78
174
|
let receipt;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
175
|
+
const interactive = process.stdout.isTTY && !flags.json && !this.wantsJsonOutput();
|
|
176
|
+
if (args.action === 'status' || args.action === 'preflight') {
|
|
177
|
+
const view = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, args.action === 'preflight' ? '/preflight' : ''));
|
|
178
|
+
if (interactive)
|
|
179
|
+
return this.printStatus(view);
|
|
180
|
+
receipt = view;
|
|
181
|
+
}
|
|
83
182
|
else if (['enable', 'disable'].includes(args.action))
|
|
84
183
|
receipt = await (0, chat_supervision_1.setChatSupervision)(args.id, {
|
|
85
184
|
enabled: args.action === 'enable',
|
|
86
185
|
expectedRevision: required('revision'),
|
|
87
186
|
controlId: required('request-id'),
|
|
88
|
-
mode:
|
|
187
|
+
mode: flags.mode,
|
|
89
188
|
});
|
|
90
|
-
else if (args.action === 'check-now')
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
189
|
+
else if (args.action === 'check-now') {
|
|
190
|
+
const check = await (0, chat_supervision_1.requestChatInspection)(args.id);
|
|
191
|
+
if (interactive)
|
|
192
|
+
return this.printCheck(check);
|
|
193
|
+
receipt = check;
|
|
194
|
+
}
|
|
195
|
+
else if (args.action === 'chats') {
|
|
196
|
+
const page = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, `/chats${flags.cursor ? `?cursor=${encodeURIComponent(flags.cursor)}` : ''}`));
|
|
197
|
+
if (interactive)
|
|
198
|
+
return this.printChats(page);
|
|
199
|
+
receipt = page;
|
|
200
|
+
}
|
|
94
201
|
else {
|
|
95
202
|
const watch = required('watch');
|
|
96
|
-
if (args.action === 'explain')
|
|
97
|
-
|
|
203
|
+
if (args.action === 'explain') {
|
|
204
|
+
const explanation = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatSupervisionPath)(args.id, `/chats/${encodeURIComponent(watch)}`));
|
|
205
|
+
if (interactive)
|
|
206
|
+
return this.printExplanation(explanation);
|
|
207
|
+
receipt = explanation;
|
|
208
|
+
}
|
|
98
209
|
else if (['include', 'exclude'].includes(args.action))
|
|
99
210
|
receipt = await (0, chat_supervision_1.setChatSupervisionEnrollment)(args.id, watch, {
|
|
100
211
|
enrollment: args.action === 'include' ? 'active' : 'excluded',
|
|
101
212
|
expectedPlanRevision: required('plan-revision'),
|
|
102
213
|
});
|
|
103
|
-
else if (args.action === 'inspect')
|
|
104
|
-
|
|
214
|
+
else if (args.action === 'inspect') {
|
|
215
|
+
const inspection = await (0, api_fetch_1.apiFetch)((0, chat_supervision_1.chatRecheckPath)(args.id, watch));
|
|
216
|
+
if (interactive && inspection.workAnchorId === null) {
|
|
217
|
+
this.log('This chat has no work to recheck yet. Start a turn in the chat, then inspect it again.');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
receipt = inspection;
|
|
221
|
+
}
|
|
105
222
|
else if (args.action === 'cancel')
|
|
106
223
|
receipt = await (0, chat_supervision_1.cancelChatRecheck)(args.id, watch, {
|
|
107
224
|
expectedPlanRevision: required('plan-revision'),
|
|
@@ -3,11 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const core_1 = require("@oclif/core");
|
|
4
4
|
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
5
5
|
const base_command_1 = require("../../base-command");
|
|
6
|
+
const forkOptions = {
|
|
7
|
+
target: data_provider_1.ForkOptions.TARGET_LEVEL,
|
|
8
|
+
branch: data_provider_1.ForkOptions.INCLUDE_BRANCHES,
|
|
9
|
+
[data_provider_1.ForkOptions.DIRECT_PATH]: data_provider_1.ForkOptions.DIRECT_PATH,
|
|
10
|
+
[data_provider_1.ForkOptions.INCLUDE_BRANCHES]: data_provider_1.ForkOptions.INCLUDE_BRANCHES,
|
|
11
|
+
[data_provider_1.ForkOptions.TARGET_LEVEL]: data_provider_1.ForkOptions.TARGET_LEVEL,
|
|
12
|
+
};
|
|
6
13
|
class ConvosFork extends base_command_1.BaseCommand {
|
|
7
14
|
static description = 'Fork a conversation from a specific message';
|
|
8
15
|
static examples = [
|
|
9
16
|
'<%= config.bin %> convos fork <id> --message <messageId>',
|
|
10
|
-
'<%= config.bin %> convos fork <id> --message <messageId> --split-at-target',
|
|
17
|
+
'<%= config.bin %> convos fork <id> --message <messageId> --split-at-target --latest-message <latestMessageId>',
|
|
11
18
|
'<%= config.bin %> convos fork <id> --message <messageId> --option target --json',
|
|
12
19
|
];
|
|
13
20
|
static args = {
|
|
@@ -20,9 +27,13 @@ class ConvosFork extends base_command_1.BaseCommand {
|
|
|
20
27
|
description: 'Message ID to fork from',
|
|
21
28
|
required: true,
|
|
22
29
|
}),
|
|
23
|
-
option: core_1.Flags.string({
|
|
30
|
+
option: core_1.Flags.string({
|
|
31
|
+
description: 'Fork option (target includes the target level; branch includes siblings)',
|
|
32
|
+
options: Object.keys(forkOptions),
|
|
33
|
+
}),
|
|
24
34
|
'split-at-target': core_1.Flags.boolean({
|
|
25
35
|
description: 'Split the conversation at the target message',
|
|
36
|
+
dependsOn: ['latest-message'],
|
|
26
37
|
}),
|
|
27
38
|
'latest-message': core_1.Flags.string({ description: 'Latest message ID to include in the fork' }),
|
|
28
39
|
};
|
|
@@ -34,7 +45,7 @@ class ConvosFork extends base_command_1.BaseCommand {
|
|
|
34
45
|
result = await data_provider_1.dataService.forkConversation({
|
|
35
46
|
conversationId: args.id,
|
|
36
47
|
messageId: flags.message,
|
|
37
|
-
option: flags.option,
|
|
48
|
+
option: flags.option ? forkOptions[flags.option] : undefined,
|
|
38
49
|
splitAtTarget: flags['split-at-target'],
|
|
39
50
|
latestMessageId: flags['latest-message'],
|
|
40
51
|
});
|
|
@@ -19,7 +19,7 @@ const web_url_1 = require("../../lib/web-url");
|
|
|
19
19
|
* docs/architecture/agent-chat-handover-2026-08-20.md
|
|
20
20
|
*/
|
|
21
21
|
class ConvosHandover extends base_command_1.BaseCommand {
|
|
22
|
-
static description = '
|
|
22
|
+
static description = 'Copy saved chat history to a new conversation with another agent. The source chat and any live turn continue independently.';
|
|
23
23
|
static examples = [
|
|
24
24
|
'<%= config.bin %> convos handover <id> --to <agentId>',
|
|
25
25
|
'<%= config.bin %> convos handover <id> --to <agentId> --reason "frontend problem"',
|
|
@@ -39,7 +39,7 @@ class ConvosHandover extends base_command_1.BaseCommand {
|
|
|
39
39
|
required: true,
|
|
40
40
|
}),
|
|
41
41
|
'up-to': core_1.Flags.string({
|
|
42
|
-
description: 'Carry history up to this message ID (default: the
|
|
42
|
+
description: 'Carry saved history up to this message ID (default: the latest saved turn)',
|
|
43
43
|
}),
|
|
44
44
|
reason: core_1.Flags.string({
|
|
45
45
|
description: 'Why the work is moving — recorded in provenance and the forward link',
|
|
@@ -84,6 +84,10 @@ class ConvosHandover extends base_command_1.BaseCommand {
|
|
|
84
84
|
this.handleApiError(err);
|
|
85
85
|
}
|
|
86
86
|
const r = result;
|
|
87
|
+
const disposition = {
|
|
88
|
+
handoverMode: 'saved_history_snapshot',
|
|
89
|
+
sourceDisposition: 'continues_independently',
|
|
90
|
+
};
|
|
87
91
|
if (flags.json) {
|
|
88
92
|
// The link belongs in BOTH modes. The repo's own rule is to hand over a
|
|
89
93
|
// clickable link rather than a bare id, and PR #1842 added one — to the
|
|
@@ -92,7 +96,7 @@ class ConvosHandover extends base_command_1.BaseCommand {
|
|
|
92
96
|
const jsonUrl = r.conversation
|
|
93
97
|
? (0, web_url_1.conversationUrlFrom)(this.cliConfig.baseURL, r.conversation)
|
|
94
98
|
: null;
|
|
95
|
-
this.log(JSON.stringify({ ...result, ...(jsonUrl ? { url: jsonUrl } : {}) }, null, 2));
|
|
99
|
+
this.log(JSON.stringify({ ...result, ...disposition, ...(jsonUrl ? { url: jsonUrl } : {}) }, null, 2));
|
|
96
100
|
return;
|
|
97
101
|
}
|
|
98
102
|
const newId = r.conversation?.conversationId ?? r.conversation?._id ?? '?';
|
|
@@ -114,6 +118,7 @@ class ConvosHandover extends base_command_1.BaseCommand {
|
|
|
114
118
|
this.log(carried === undefined
|
|
115
119
|
? '? messages carried'
|
|
116
120
|
: `${carried} ${carried === 1 ? 'message' : 'messages'} carried`);
|
|
121
|
+
this.log('The source chat and any live turn continue independently.');
|
|
117
122
|
if (r.forwardLinked === false) {
|
|
118
123
|
// The handover itself committed; only the breadcrumb is missing. Say so
|
|
119
124
|
// rather than letting it look like a partial failure.
|
|
@@ -173,8 +173,11 @@ class HarnessesEvaluationsPlatformH9Turn extends base_command_1.BaseCommand {
|
|
|
173
173
|
...(0, h9_prior_stream_1.bindH9PriorStreamSettlement)(plan, stream, priorFinance, priorEvidence, grantBinding),
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
const
|
|
177
|
-
|
|
176
|
+
const authorizationDeadline = Math.min(Date.parse(grant.expiresAt ?? ''), Date.parse(plan.expiresAt));
|
|
177
|
+
const acceptanceDeadline = Math.min(Date.now() + h9_platform_stream_1.H9_ACCEPTANCE_WINDOW_MS, authorizationDeadline);
|
|
178
|
+
if (cancelled.signal.aborted ||
|
|
179
|
+
!Number.isFinite(acceptanceDeadline) ||
|
|
180
|
+
acceptanceDeadline <= Date.now() + 10_000)
|
|
178
181
|
throw new Error('H9_TIMELINE_EXHAUSTED');
|
|
179
182
|
const recover = receiptPath(label);
|
|
180
183
|
const identity = {
|
|
@@ -197,7 +200,7 @@ class HarnessesEvaluationsPlatformH9Turn extends base_command_1.BaseCommand {
|
|
|
197
200
|
credential: this.resolvedCredential,
|
|
198
201
|
signal: AbortSignal.any([
|
|
199
202
|
cancelled.signal,
|
|
200
|
-
AbortSignal.timeout(Math.max(1,
|
|
203
|
+
AbortSignal.timeout(Math.max(1, acceptanceDeadline - Date.now())),
|
|
201
204
|
]),
|
|
202
205
|
body: {
|
|
203
206
|
endpoint: 'agents',
|
|
@@ -229,6 +232,7 @@ class HarnessesEvaluationsPlatformH9Turn extends base_command_1.BaseCommand {
|
|
|
229
232
|
(0, operator_probe_files_1.durable)(recover, { ...identity, ...admittedIds, state: 'accepted' });
|
|
230
233
|
(0, h9_platform_stream_1.validateH9Acceptance)(accepted, scope);
|
|
231
234
|
emit({ type: 'run.accepted', ...admittedIds });
|
|
235
|
+
const deadline = Math.min(Date.now() + h9_platform_stream_1.H9_EXECUTION_WINDOW_MS, authorizationDeadline);
|
|
232
236
|
const summary = await (0, h9_platform_stream_1.streamH9PlatformTurn)({
|
|
233
237
|
label,
|
|
234
238
|
nonce: plan.nonce,
|
|
@@ -279,6 +283,12 @@ class HarnessesEvaluationsPlatformH9Turn extends base_command_1.BaseCommand {
|
|
|
279
283
|
process.exitCode = 1;
|
|
280
284
|
}
|
|
281
285
|
catch (error) {
|
|
286
|
+
// Retain the reviewed probe's typed failure across the operator's child
|
|
287
|
+
// process boundary without forwarding arbitrary provider error text.
|
|
288
|
+
const code = error instanceof Error && /^H9_[A-Z0-9_]+$/.test(error.message)
|
|
289
|
+
? error.message
|
|
290
|
+
: 'H9_PLATFORM_TURN_FAILED';
|
|
291
|
+
emit({ type: 'h9.turn.failure', code });
|
|
282
292
|
// A normal start may already have launched. Bind interruption to its actual returned session.
|
|
283
293
|
if (admittedIds.sessionId) {
|
|
284
294
|
const client = new agentic_stream_1.AgenticStreamClient({
|
|
@@ -45,7 +45,18 @@ class TasksInterrupt extends base_command_1.BaseCommand {
|
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
47
|
const c = result;
|
|
48
|
-
|
|
48
|
+
const stop = c.interrupt;
|
|
49
|
+
if (stop?.acknowledged) {
|
|
50
|
+
this.log(`Run ${stop.runId ?? '?'} for task ${taskRef} has ended.`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (stop?.requested === false) {
|
|
54
|
+
this.log(stop.reason === 'no_current_checkout'
|
|
55
|
+
? `Task ${taskRef} has no current checkout to stop.`
|
|
56
|
+
: `No stop was requested for task ${taskRef} (${stop.reason ?? 'run unavailable'}). Check the current run before trying again.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.log(`Stop requested for ${stop?.runId ? `run ${stop.runId} of ` : ''}task ${taskRef} (comment ${c.id ?? c._id ?? '?'}). Inspect run state to confirm it stopped.`);
|
|
49
60
|
}
|
|
50
61
|
}
|
|
51
62
|
exports.default = TasksInterrupt;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHAT_RECHECK_CONDITIONS } from '@skrr-ai/data-provider';
|
|
2
|
-
import type { ChatRecheckCondition, ChatRecheckProposal, ChatSupervisionControl } from '@skrr-ai/data-provider';
|
|
2
|
+
import type { ChatRecheckCondition, ChatRecheckProposal, ChatSupervisionControl, ChatSupervisionInspectionReceipt } from '@skrr-ai/data-provider';
|
|
3
3
|
export declare const chatSupervisionPath: (agentId: string, suffix?: string) => string;
|
|
4
4
|
export declare const chatRecheckPath: (agentId: string, watchId: string) => string;
|
|
5
5
|
/** All authority and current revisions are checked server-side. No CLI cache,
|
|
@@ -18,4 +18,4 @@ export declare function setChatSupervisionEnrollment(agentId: string, watchId: s
|
|
|
18
18
|
enrollment: 'active' | 'excluded';
|
|
19
19
|
expectedPlanRevision: number;
|
|
20
20
|
}): Promise<unknown>;
|
|
21
|
-
export declare function requestChatInspection(agentId: string): Promise<
|
|
21
|
+
export declare function requestChatInspection(agentId: string): Promise<ChatSupervisionInspectionReceipt>;
|
|
@@ -33,5 +33,8 @@ function setChatSupervisionEnrollment(agentId, watchId, input) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
function requestChatInspection(agentId) {
|
|
36
|
-
return (0, api_fetch_1.apiFetch)((0, exports.chatSupervisionPath)(agentId, '/inspect'), {
|
|
36
|
+
return (0, api_fetch_1.apiFetch)((0, exports.chatSupervisionPath)(agentId, '/inspect'), {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
body: {},
|
|
39
|
+
});
|
|
37
40
|
}
|
|
@@ -2,6 +2,8 @@ import { type AgenticStreamEvent, type EnvelopeReplayPage } from './agentic-stre
|
|
|
2
2
|
export declare const H9_TURN_LABELS: readonly ["streaming", "toolCalls", "remember", "interrupt", "recall", "cancel"];
|
|
3
3
|
export type H9TurnLabel = (typeof H9_TURN_LABELS)[number];
|
|
4
4
|
export type H9Harness = 'pi' | 'copilot-sdk';
|
|
5
|
+
export declare const H9_EXECUTION_WINDOW_MS = 120000;
|
|
6
|
+
export declare const H9_ACCEPTANCE_WINDOW_MS = 60000;
|
|
5
7
|
type Row = Record<string, any>;
|
|
6
8
|
/** Fixed prompts for the two reviewed platform qualification pairs. */
|
|
7
9
|
export declare function h9FixedPrompt(label: H9TurnLabel, nonce: string, harness?: H9Harness): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.H9_TURN_LABELS = void 0;
|
|
3
|
+
exports.H9_ACCEPTANCE_WINDOW_MS = exports.H9_EXECUTION_WINDOW_MS = exports.H9_TURN_LABELS = void 0;
|
|
4
4
|
exports.h9FixedPrompt = h9FixedPrompt;
|
|
5
5
|
exports.validateH9Acceptance = validateH9Acceptance;
|
|
6
6
|
exports.streamH9PlatformTurn = streamH9PlatformTurn;
|
|
@@ -16,6 +16,10 @@ exports.H9_TURN_LABELS = [
|
|
|
16
16
|
'recall',
|
|
17
17
|
'cancel',
|
|
18
18
|
];
|
|
19
|
+
// An accepted production turn still needs to clear the worker queue, prepare
|
|
20
|
+
// managed inference and reach the daemon before it can run the fixed case.
|
|
21
|
+
exports.H9_EXECUTION_WINDOW_MS = 120_000;
|
|
22
|
+
exports.H9_ACCEPTANCE_WINDOW_MS = 60_000;
|
|
19
23
|
const need = (value, code) => {
|
|
20
24
|
if (!value)
|
|
21
25
|
throw new Error(code);
|
|
@@ -123,7 +127,9 @@ function recordedH9Response(rows, accepted, outcome) {
|
|
|
123
127
|
async function streamH9PlatformTurn(input) {
|
|
124
128
|
h9FixedPrompt(input.label, input.nonce, input.scope.harness);
|
|
125
129
|
const now = Date.now();
|
|
126
|
-
need(Number.isFinite(input.deadline) &&
|
|
130
|
+
need(Number.isFinite(input.deadline) &&
|
|
131
|
+
input.deadline > now &&
|
|
132
|
+
input.deadline <= now + exports.H9_EXECUTION_WINDOW_MS, 'H9_TURN_DEADLINE_INVALID');
|
|
127
133
|
const context = validateH9Acceptance(input.accepted, input.scope);
|
|
128
134
|
// Non-tool turns intentionally have no permission gate. Their first ask cancels the run.
|
|
129
135
|
const permission = input.label === 'toolCalls'
|