@skrr-ai/cli 0.1.179 → 0.1.181
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/code/index.js +5 -0
- package/dist/commands/diagnostics/inference-smoke.d.ts +13 -0
- package/dist/commands/diagnostics/inference-smoke.js +50 -0
- package/dist/commands/harnesses/evaluations/evidence.d.ts +2 -0
- package/dist/commands/harnesses/evaluations/evidence.js +20 -0
- package/dist/commands/harnesses/evaluations/fixed-tool.d.ts +10 -0
- package/dist/commands/harnesses/evaluations/fixed-tool.js +189 -0
- package/dist/commands/harnesses/evaluations/platform-h9-turn.d.ts +13 -0
- package/dist/commands/harnesses/evaluations/platform-h9-turn.js +322 -0
- package/dist/commands/machines/hosted/identity-evaluations/issue.d.ts +12 -0
- package/dist/commands/machines/hosted/identity-evaluations/issue.js +40 -0
- package/dist/commands/machines/hosted/identity-evaluations/revoke.d.ts +11 -0
- package/dist/commands/machines/hosted/identity-evaluations/revoke.js +21 -0
- package/dist/commands/machines/hosted/identity-evaluations/show.d.ts +8 -0
- package/dist/commands/machines/hosted/identity-evaluations/show.js +20 -0
- package/dist/commands/machines/hosted/start.d.ts +1 -0
- package/dist/commands/machines/hosted/start.js +6 -0
- package/dist/lib/agent-model-check.d.ts +19 -0
- package/dist/lib/agent-model-check.js +10 -20
- package/dist/lib/agentic-stream.d.ts +3 -0
- package/dist/lib/agentic-stream.js +63 -1
- package/dist/lib/copilot-fixed-probe-runner.d.ts +72 -0
- package/dist/lib/copilot-fixed-probe-runner.js +213 -0
- package/dist/lib/copilot-fixed-probe.d.ts +61 -0
- package/dist/lib/copilot-fixed-probe.js +223 -0
- package/dist/lib/credential-resolver.d.ts +1 -0
- package/dist/lib/credential-resolver.js +5 -1
- package/dist/lib/first-party-harness-broker.d.ts +5 -10
- package/dist/lib/first-party-harness-broker.js +121 -50
- package/dist/lib/h9-platform-stream.d.ts +63 -0
- package/dist/lib/h9-platform-stream.js +317 -0
- package/dist/lib/h9-prior-stream.d.ts +44 -0
- package/dist/lib/h9-prior-stream.js +217 -0
- package/dist/lib/harness-evaluations.d.ts +85 -0
- package/dist/lib/harness-evaluations.js +8 -0
- package/dist/lib/hosted-identity-evaluations.d.ts +26 -0
- package/dist/lib/hosted-identity-evaluations.js +18 -0
- package/dist/lib/hosted-machines.d.ts +1 -0
- package/dist/lib/inference-overload-smoke-contract.d.ts +53 -0
- package/dist/lib/inference-overload-smoke-contract.js +192 -0
- package/dist/lib/inference-overload-smoke.d.ts +78 -0
- package/dist/lib/inference-overload-smoke.js +350 -0
- package/dist/lib/operator-probe-files.d.ts +6 -0
- package/dist/lib/operator-probe-files.js +68 -0
- package/dist/lib/platform-h9-plan.d.ts +47 -0
- package/dist/lib/platform-h9-plan.js +78 -0
- package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +150 -0
- package/dist/node_modules/@skrr-ai/data-provider/index.js +6 -6
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +23 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.js +40 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +2 -11
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +31 -5
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.d.ts +56 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.js +277 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +3 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +3 -1
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.d.ts +8 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.js +20 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +2 -11
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +28 -4
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.d.ts +56 -0
- package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.js +261 -0
- package/oclif.manifest.json +473 -1
- package/package.json +2 -2
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const node_stream_1 = require("node:stream");
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
7
|
+
const base_command_1 = require("../../../base-command");
|
|
8
|
+
const agentic_stream_1 = require("../../../lib/agentic-stream");
|
|
9
|
+
const api_fetch_1 = require("../../../lib/api-fetch");
|
|
10
|
+
const harnesses_1 = require("../../../lib/harnesses");
|
|
11
|
+
const harness_evaluations_1 = require("../../../lib/harness-evaluations");
|
|
12
|
+
const h9_platform_stream_1 = require("../../../lib/h9-platform-stream");
|
|
13
|
+
const h9_prior_stream_1 = require("../../../lib/h9-prior-stream");
|
|
14
|
+
const copilot_fixed_probe_1 = require("../../../lib/copilot-fixed-probe");
|
|
15
|
+
const operator_probe_files_1 = require("../../../lib/operator-probe-files");
|
|
16
|
+
const platform_h9_plan_1 = require("../../../lib/platform-h9-plan");
|
|
17
|
+
const id = (value) => typeof value === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:@-]{0,239}$/.test(value);
|
|
18
|
+
/** Internal adapter for the checked-in fixed platform scenarios. */
|
|
19
|
+
class HarnessesEvaluationsPlatformH9Turn extends base_command_1.BaseCommand {
|
|
20
|
+
static hidden = true;
|
|
21
|
+
static description = 'Submit one fixed turn of a reviewed platform qualification';
|
|
22
|
+
static flags = {
|
|
23
|
+
plan: core_1.Flags.string({ required: true }),
|
|
24
|
+
go: core_1.Flags.string({ required: true }),
|
|
25
|
+
label: core_1.Flags.string({ required: true, options: [...h9_platform_stream_1.H9_TURN_LABELS] }),
|
|
26
|
+
conversation: core_1.Flags.string(),
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { flags } = await this.parse(HarnessesEvaluationsPlatformH9Turn);
|
|
30
|
+
const file = (0, operator_probe_files_1.privatePlan)(flags.plan);
|
|
31
|
+
if ((0, operator_probe_files_1.sha)(file.raw) !== flags.go)
|
|
32
|
+
throw new Error('H9_EXACT_PLAN_DIGEST_REQUIRED');
|
|
33
|
+
const plan = (0, platform_h9_plan_1.platformH9Plan)(JSON.parse(file.raw.toString('utf8')));
|
|
34
|
+
const expectedHarness = (0, platform_h9_plan_1.platformH9Harness)(plan);
|
|
35
|
+
const workspaceId = plan.workspaceId;
|
|
36
|
+
const scopeHeaders = { 'X-Workspace-Id': workspaceId ?? '' };
|
|
37
|
+
const label = flags.label;
|
|
38
|
+
const labels = (0, platform_h9_plan_1.platformH9Labels)(plan);
|
|
39
|
+
const ordinal = labels.indexOf(label);
|
|
40
|
+
if (ordinal < 0) {
|
|
41
|
+
throw new Error(plan.priorStream ? 'H9_PRIOR_STREAM_ALREADY_COVERED' : 'H9_LABEL_OUTSIDE_PLAN');
|
|
42
|
+
}
|
|
43
|
+
const requestId = (0, platform_h9_plan_1.platformH9RequestId)(plan, label);
|
|
44
|
+
if (['interrupt', 'recall'].includes(label)
|
|
45
|
+
? !id(flags.conversation)
|
|
46
|
+
: flags.conversation !== undefined)
|
|
47
|
+
throw new Error('H9_CONVERSATION_SCOPE');
|
|
48
|
+
this.requireAuth();
|
|
49
|
+
if (new URL(this.cliConfig.baseURL).origin !== plan.origin ||
|
|
50
|
+
process.env.OVERSKY_AUTONOMOUS_SESSION === '1')
|
|
51
|
+
throw new Error('H9_EXACT_HUMAN_ORIGIN_REQUIRED');
|
|
52
|
+
const cancelled = new AbortController();
|
|
53
|
+
const interrupt = () => cancelled.abort();
|
|
54
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
55
|
+
for (const signal of signals)
|
|
56
|
+
process.on(signal, interrupt);
|
|
57
|
+
const sink = new node_stream_1.Writable({
|
|
58
|
+
write(_chunk, _encoding, done) {
|
|
59
|
+
done();
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
const emit = (event) => process.stdout.write(JSON.stringify(event) + '\n');
|
|
63
|
+
try {
|
|
64
|
+
const [principal, agent, { harness }, { machine }, readback] = await Promise.all([
|
|
65
|
+
this.resolveCurrentUserId(),
|
|
66
|
+
workspaceId
|
|
67
|
+
? (0, api_fetch_1.apiFetch)(`/api/agents/${encodeURIComponent(plan.agentId)}`, {
|
|
68
|
+
headers: scopeHeaders,
|
|
69
|
+
credential: this.resolvedCredential,
|
|
70
|
+
singleAttempt: true,
|
|
71
|
+
})
|
|
72
|
+
: data_provider_1.dataService.getAgentById({ agent_id: plan.agentId }),
|
|
73
|
+
(0, harnesses_1.getHarness)(plan.harnessId),
|
|
74
|
+
(0, harness_evaluations_1.harnessEvaluationEvidence)(plan.grantId),
|
|
75
|
+
(0, harness_evaluations_1.harnessEvaluationFinancialEvidence)(plan.grantId, workspaceId),
|
|
76
|
+
]);
|
|
77
|
+
const { grant, financial } = readback;
|
|
78
|
+
const a = agent, h = harness;
|
|
79
|
+
const targets = a?.executionPolicy?.targets?.filter((target) => target.enabled !== false);
|
|
80
|
+
const grantBinding = grant.modelBindings?.[0];
|
|
81
|
+
if (principal !== plan.ownerUserId ||
|
|
82
|
+
grant.ownerUserId !== principal ||
|
|
83
|
+
grant.grantId !== plan.grantId ||
|
|
84
|
+
grant.harness !== expectedHarness ||
|
|
85
|
+
grant.version !== plan.version ||
|
|
86
|
+
grant.daemonId !== plan.daemonId ||
|
|
87
|
+
grant.maxSpendUsd !== 2 ||
|
|
88
|
+
!grant.active ||
|
|
89
|
+
grant.models?.length !== 1 ||
|
|
90
|
+
grant.models[0] !== plan.model ||
|
|
91
|
+
grant.modelBindings?.length !== 1 ||
|
|
92
|
+
grantBinding?.requestedAlias !== plan.model ||
|
|
93
|
+
grantBinding.gatewayAlias !== plan.model ||
|
|
94
|
+
grantBinding.upstreamProvider !== 'anthropic' ||
|
|
95
|
+
!/^[a-f0-9]{64}$/.test(grantBinding.bindingDigest) ||
|
|
96
|
+
(a?.id ?? a?.agent_id) !== plan.agentId ||
|
|
97
|
+
a.author !== principal ||
|
|
98
|
+
a.model !== plan.model ||
|
|
99
|
+
(workspaceId
|
|
100
|
+
? a.workspaceId !== workspaceId ||
|
|
101
|
+
(a.homeWorkspaceId != null && a.homeWorkspaceId !== workspaceId) ||
|
|
102
|
+
a.isPublic !== false
|
|
103
|
+
: a.workspaceId != null || a.homeWorkspaceId != null) ||
|
|
104
|
+
a.executionPolicy?.mode !== 'ordered' ||
|
|
105
|
+
targets?.length !== 1 ||
|
|
106
|
+
targets[0].kind !== 'harness' ||
|
|
107
|
+
targets[0].harnessId !== plan.harnessId ||
|
|
108
|
+
(targets[0].advanceOn?.length ?? 0) !== 0 ||
|
|
109
|
+
(h?.id ?? h?._id) !== plan.harnessId ||
|
|
110
|
+
h.provider !== expectedHarness ||
|
|
111
|
+
h.daemonId !== plan.daemonId ||
|
|
112
|
+
h.metadata?.cliVersion !== plan.version ||
|
|
113
|
+
h.metadata?.evaluation?.grantId !== plan.grantId ||
|
|
114
|
+
h.metadata?.evaluation?.version !== plan.version ||
|
|
115
|
+
machine.daemonId !== plan.daemonId ||
|
|
116
|
+
machine.image !== plan.image ||
|
|
117
|
+
machine.unavailable ||
|
|
118
|
+
!['hosted-machine', 'dedicated-machine'].includes(machine.machineProduct ?? '') ||
|
|
119
|
+
((plan.completionOnly || expectedHarness === 'copilot-sdk') &&
|
|
120
|
+
machine.machineProduct !== 'dedicated-machine') ||
|
|
121
|
+
!id(machine.machineUuid) ||
|
|
122
|
+
machine.machineUuid !== grant.machineUuid)
|
|
123
|
+
throw new Error('H9_EXACT_OWNER_GRANT_RUNTIME_REQUIRED');
|
|
124
|
+
const committed = financial.totals?.providerSettledUsd;
|
|
125
|
+
if (grant.admissions?.length !== ordinal ||
|
|
126
|
+
financial.grantId !== plan.grantId ||
|
|
127
|
+
financial.workspaceId !== workspaceId ||
|
|
128
|
+
financial.bindingDigest !== grantBinding.bindingDigest ||
|
|
129
|
+
financial.state !== 'closed' ||
|
|
130
|
+
financial.outstandingReservations !== 0 ||
|
|
131
|
+
financial.turns?.length !== ordinal ||
|
|
132
|
+
financial.turns.some((turn, i) => turn.state !== 'closed' ||
|
|
133
|
+
turn.closure !== 'provider_spend_reconciled' ||
|
|
134
|
+
turn.reservationId !== grant.admissions[i]?.reservationId ||
|
|
135
|
+
turn.sessionId !== grant.admissions[i]?.sessionId) ||
|
|
136
|
+
financial.providerAuthorizationUsd !== 1 ||
|
|
137
|
+
financial.customerQuoteUsageMicros !== 1_250_000 ||
|
|
138
|
+
!financial.priceBookVersion ||
|
|
139
|
+
typeof committed !== 'number' ||
|
|
140
|
+
!Number.isFinite(committed) ||
|
|
141
|
+
committed < 0 ||
|
|
142
|
+
committed + 1 > 2 + 1e-9)
|
|
143
|
+
throw new Error('H9_PREVIOUS_EXPOSURE_OR_QUOTE_UNPROVEN');
|
|
144
|
+
const receiptPath = (turn) => (0, node_path_1.join)((0, node_path_1.dirname)(file.absolute), `${plan.operationId}.${turn}.recovery.json`);
|
|
145
|
+
if (plan.priorStream || plan.completionOnly) {
|
|
146
|
+
for (const [index, previous] of labels.slice(0, ordinal).entries()) {
|
|
147
|
+
const receipt = JSON.parse((0, operator_probe_files_1.privatePlan)(receiptPath(previous)).raw.toString('utf8'));
|
|
148
|
+
if (receipt?.planSha256 !== flags.go ||
|
|
149
|
+
receipt.label !== previous ||
|
|
150
|
+
receipt.requestId !== (0, platform_h9_plan_1.platformH9RequestId)(plan, previous) ||
|
|
151
|
+
receipt.grantId !== plan.grantId ||
|
|
152
|
+
receipt.agentId !== plan.agentId ||
|
|
153
|
+
receipt.workspaceId !== workspaceId ||
|
|
154
|
+
receipt.state !== 'terminal_observed' ||
|
|
155
|
+
receipt.successful !== true ||
|
|
156
|
+
receipt.sessionId !== financial.turns[index].sessionId ||
|
|
157
|
+
(previous === 'toolCalls' &&
|
|
158
|
+
(receipt.permissionRecorded !== true || receipt.toolVerified !== true)) ||
|
|
159
|
+
(['remember', 'interrupt'].includes(previous) &&
|
|
160
|
+
['interrupt', 'recall'].includes(label) &&
|
|
161
|
+
receipt.conversationId !== flags.conversation))
|
|
162
|
+
throw new Error('H9_PREVIOUS_ORDERED_TURN_UNPROVEN');
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (plan.priorStream && ordinal === 0) {
|
|
166
|
+
const stream = (0, h9_prior_stream_1.capturedH9Stream)(plan, expectedHarness, machine.machineProduct);
|
|
167
|
+
const [priorFinance, priorEvidence] = await Promise.all([
|
|
168
|
+
(0, harness_evaluations_1.harnessEvaluationFinancialEvidence)(stream.grantId, workspaceId),
|
|
169
|
+
(0, harness_evaluations_1.harnessEvaluationEvidence)(stream.grantId, { gateway: true }),
|
|
170
|
+
]);
|
|
171
|
+
emit({
|
|
172
|
+
type: 'h9.prior_stream_verified',
|
|
173
|
+
...(0, h9_prior_stream_1.bindH9PriorStreamSettlement)(plan, stream, priorFinance, priorEvidence, grantBinding),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const deadline = Math.min(Date.now() + 60_000, Date.parse(grant.expiresAt ?? ''), Date.parse(plan.expiresAt));
|
|
177
|
+
if (cancelled.signal.aborted || !Number.isFinite(deadline) || deadline <= Date.now() + 10_000)
|
|
178
|
+
throw new Error('H9_TIMELINE_EXHAUSTED');
|
|
179
|
+
const recover = receiptPath(label);
|
|
180
|
+
const identity = {
|
|
181
|
+
planSha256: flags.go,
|
|
182
|
+
label,
|
|
183
|
+
requestId,
|
|
184
|
+
agentId: plan.agentId,
|
|
185
|
+
grantId: plan.grantId,
|
|
186
|
+
...(workspaceId ? { workspaceId } : {}),
|
|
187
|
+
...(expectedHarness === 'copilot-sdk' && label === 'toolCalls'
|
|
188
|
+
? { scratchDirectory: (0, copilot_fixed_probe_1.copilotPlatformScratchDirectory)(plan.nonce) }
|
|
189
|
+
: {}),
|
|
190
|
+
};
|
|
191
|
+
(0, operator_probe_files_1.durable)(recover, { ...identity, state: 'start_may_be_unacknowledged' }, true);
|
|
192
|
+
// Issue exactly one normal start with no credential, transport or idempotency retry.
|
|
193
|
+
const accepted = await (0, api_fetch_1.apiFetch)('/api/agentic/chat', {
|
|
194
|
+
method: 'POST',
|
|
195
|
+
singleAttempt: true,
|
|
196
|
+
headers: scopeHeaders,
|
|
197
|
+
credential: this.resolvedCredential,
|
|
198
|
+
signal: AbortSignal.any([
|
|
199
|
+
cancelled.signal,
|
|
200
|
+
AbortSignal.timeout(Math.max(1, deadline - Date.now())),
|
|
201
|
+
]),
|
|
202
|
+
body: {
|
|
203
|
+
endpoint: 'agents',
|
|
204
|
+
endpointType: 'agents',
|
|
205
|
+
agent_id: plan.agentId,
|
|
206
|
+
endpointOption: { endpoint: 'agents', agent_id: plan.agentId },
|
|
207
|
+
conversationId: flags.conversation ?? 'new',
|
|
208
|
+
clientRequestId: requestId,
|
|
209
|
+
executionEnvironment: 'local',
|
|
210
|
+
preferredDaemonId: plan.daemonId,
|
|
211
|
+
permissionMode: 'default',
|
|
212
|
+
text: (0, h9_platform_stream_1.h9FixedPrompt)(label, plan.nonce, expectedHarness),
|
|
213
|
+
},
|
|
214
|
+
});
|
|
215
|
+
const admittedIds = {
|
|
216
|
+
sessionId: id(accepted.sessionId) ? accepted.sessionId : null,
|
|
217
|
+
conversationId: id(accepted.conversationId) ? accepted.conversationId : null,
|
|
218
|
+
responseMessageId: id(accepted.responseMessageId) ? accepted.responseMessageId : null,
|
|
219
|
+
};
|
|
220
|
+
const scope = {
|
|
221
|
+
agentId: plan.agentId,
|
|
222
|
+
harnessId: plan.harnessId,
|
|
223
|
+
harness: expectedHarness,
|
|
224
|
+
workspaceId,
|
|
225
|
+
daemonId: plan.daemonId,
|
|
226
|
+
conversationId: flags.conversation,
|
|
227
|
+
};
|
|
228
|
+
try {
|
|
229
|
+
(0, operator_probe_files_1.durable)(recover, { ...identity, ...admittedIds, state: 'accepted' });
|
|
230
|
+
(0, h9_platform_stream_1.validateH9Acceptance)(accepted, scope);
|
|
231
|
+
emit({ type: 'run.accepted', ...admittedIds });
|
|
232
|
+
const summary = await (0, h9_platform_stream_1.streamH9PlatformTurn)({
|
|
233
|
+
label,
|
|
234
|
+
nonce: plan.nonce,
|
|
235
|
+
accepted,
|
|
236
|
+
scope,
|
|
237
|
+
deadline,
|
|
238
|
+
baseURL: this.cliConfig.baseURL,
|
|
239
|
+
token: this.resolvedCredential.token,
|
|
240
|
+
signal: cancelled.signal,
|
|
241
|
+
replayEnvelopes: (from) => (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(accepted.sessionId)}/envelopes?from=${from}&limit=500`, {
|
|
242
|
+
credential: this.resolvedCredential,
|
|
243
|
+
headers: scopeHeaders,
|
|
244
|
+
signal: AbortSignal.timeout(5000),
|
|
245
|
+
}),
|
|
246
|
+
readResponseMessage: () => (0, api_fetch_1.apiFetch)(`/api/messages/${encodeURIComponent(accepted.conversationId)}/${encodeURIComponent(accepted.responseMessageId)}`, {
|
|
247
|
+
credential: this.resolvedCredential,
|
|
248
|
+
headers: scopeHeaders,
|
|
249
|
+
signal: AbortSignal.timeout(5000),
|
|
250
|
+
singleAttempt: true,
|
|
251
|
+
}),
|
|
252
|
+
onEvent: emit,
|
|
253
|
+
});
|
|
254
|
+
const observed = {
|
|
255
|
+
successful: summary.successful,
|
|
256
|
+
cancelledAtMs: summary.cancelRequestedAtMs,
|
|
257
|
+
permissionRecorded: summary.permission?.permissionRecorded === true,
|
|
258
|
+
toolVerified: summary.permission?.toolVerified === true,
|
|
259
|
+
status: summary.result.status,
|
|
260
|
+
};
|
|
261
|
+
const permission = summary.permission;
|
|
262
|
+
(0, operator_probe_files_1.durable)(recover, {
|
|
263
|
+
...identity,
|
|
264
|
+
...admittedIds,
|
|
265
|
+
state: 'terminal_observed',
|
|
266
|
+
...observed,
|
|
267
|
+
...(permission?.permissionRecorded && permission.toolUseId && permission.requestId
|
|
268
|
+
? {
|
|
269
|
+
permissionReceipt: {
|
|
270
|
+
toolUseId: permission.toolUseId,
|
|
271
|
+
requestId: permission.requestId,
|
|
272
|
+
scope: 'once',
|
|
273
|
+
},
|
|
274
|
+
}
|
|
275
|
+
: {}),
|
|
276
|
+
});
|
|
277
|
+
emit({ type: 'h9.turn.result', ...observed });
|
|
278
|
+
if (!summary.successful)
|
|
279
|
+
process.exitCode = 1;
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
// A normal start may already have launched. Bind interruption to its actual returned session.
|
|
283
|
+
if (admittedIds.sessionId) {
|
|
284
|
+
const client = new agentic_stream_1.AgenticStreamClient({
|
|
285
|
+
baseURL: this.cliConfig.baseURL,
|
|
286
|
+
token: this.resolvedCredential.token,
|
|
287
|
+
sessionId: admittedIds.sessionId,
|
|
288
|
+
conversationId: admittedIds.conversationId ?? undefined,
|
|
289
|
+
workspaceId: workspaceId ?? '',
|
|
290
|
+
quiet: true,
|
|
291
|
+
output: sink,
|
|
292
|
+
statusOutput: sink,
|
|
293
|
+
attachTimeoutMs: 5000,
|
|
294
|
+
onEvent: (event) => {
|
|
295
|
+
if (event.type === 'session.joined')
|
|
296
|
+
client.cancel('H9 acceptance or completion unproved');
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
let timer;
|
|
300
|
+
try {
|
|
301
|
+
await Promise.race([
|
|
302
|
+
client.run(),
|
|
303
|
+
new Promise((resolve) => {
|
|
304
|
+
timer = setTimeout(resolve, 6000);
|
|
305
|
+
}),
|
|
306
|
+
]);
|
|
307
|
+
}
|
|
308
|
+
finally {
|
|
309
|
+
clearTimeout(timer);
|
|
310
|
+
client.close();
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
throw error;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
finally {
|
|
317
|
+
for (const signal of signals)
|
|
318
|
+
process.off(signal, interrupt);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
exports.default = HarnessesEvaluationsPlatformH9Turn;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../../base-command';
|
|
2
|
+
export default class Issue extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
build: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
'start-request': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'ttl-minutes': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
reason: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../../base-command");
|
|
5
|
+
const hosted_identity_evaluations_1 = require("../../../../lib/hosted-identity-evaluations");
|
|
6
|
+
class Issue extends base_command_1.BaseCommand {
|
|
7
|
+
static description = 'Explicitly authorize one fresh ordinary Hosted identity evaluation (signed-in platform admin)';
|
|
8
|
+
static flags = {
|
|
9
|
+
build: core_1.Flags.string({ description: 'Exact approved ordinary image build id', required: true }),
|
|
10
|
+
'start-request': core_1.Flags.string({
|
|
11
|
+
description: 'Exact --request-id of the future start; never reusable for another authorization',
|
|
12
|
+
required: true,
|
|
13
|
+
}),
|
|
14
|
+
'ttl-minutes': core_1.Flags.integer({
|
|
15
|
+
description: 'Expiry before initial bootstrap (1-30 minutes)',
|
|
16
|
+
default: 15,
|
|
17
|
+
}),
|
|
18
|
+
reason: core_1.Flags.string({ description: 'Recorded reason for this qualification', required: true }),
|
|
19
|
+
json: core_1.Flags.boolean({ description: 'Output JSON' }),
|
|
20
|
+
};
|
|
21
|
+
async run() {
|
|
22
|
+
this.requireAuth();
|
|
23
|
+
const { flags } = await this.parse(Issue);
|
|
24
|
+
try {
|
|
25
|
+
const result = await (0, hosted_identity_evaluations_1.issueHostedIdentityEvaluation)({
|
|
26
|
+
buildId: flags.build,
|
|
27
|
+
startRequestId: flags['start-request'],
|
|
28
|
+
ttlMinutes: flags['ttl-minutes'],
|
|
29
|
+
reason: flags.reason,
|
|
30
|
+
});
|
|
31
|
+
this.log(flags.json
|
|
32
|
+
? JSON.stringify(result, null, 2)
|
|
33
|
+
: `Prepared ${result.capability.capabilityId} for request ${result.capability.startRequestId}; expires ${result.capability.expiresAt}. No machine was started.`);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.handleApiError(error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.default = Issue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../../base-command';
|
|
2
|
+
export default class Revoke extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
reason: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../../base-command");
|
|
5
|
+
const hosted_identity_evaluations_1 = require("../../../../lib/hosted-identity-evaluations");
|
|
6
|
+
class Revoke extends base_command_1.BaseCommand {
|
|
7
|
+
static description = 'Withdraw your Hosted identity evaluation authorization (never changes an already split machine)';
|
|
8
|
+
static args = { id: core_1.Args.string({ required: true, ignoreStdin: true }) };
|
|
9
|
+
static flags = { reason: core_1.Flags.string({ required: true }) };
|
|
10
|
+
async run() {
|
|
11
|
+
this.requireAuth();
|
|
12
|
+
const { args, flags } = await this.parse(Revoke);
|
|
13
|
+
try {
|
|
14
|
+
this.log(JSON.stringify(await (0, hosted_identity_evaluations_1.revokeHostedIdentityEvaluation)(args.id, flags.reason), null, 2));
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
this.handleApiError(error);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = Revoke;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../../base-command");
|
|
5
|
+
const hosted_identity_evaluations_1 = require("../../../../lib/hosted-identity-evaluations");
|
|
6
|
+
class Show extends base_command_1.BaseCommand {
|
|
7
|
+
static description = 'Read your explicit Hosted identity evaluation authorization';
|
|
8
|
+
static args = { id: core_1.Args.string({ required: true, ignoreStdin: true }) };
|
|
9
|
+
async run() {
|
|
10
|
+
this.requireAuth();
|
|
11
|
+
const { args } = await this.parse(Show);
|
|
12
|
+
try {
|
|
13
|
+
this.log(JSON.stringify(await (0, hosted_identity_evaluations_1.readHostedIdentityEvaluation)(args.id), null, 2));
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
this.handleApiError(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = Show;
|
|
@@ -3,6 +3,7 @@ export default class HostedMachinesStart extends BaseCommand {
|
|
|
3
3
|
static description: string;
|
|
4
4
|
static examples: string[];
|
|
5
5
|
static flags: {
|
|
6
|
+
'identity-evaluation': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
7
|
agent: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
8
|
conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
environment: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -12,6 +12,9 @@ class HostedMachinesStart extends base_command_1.BaseCommand {
|
|
|
12
12
|
'<%= config.bin %> machines hosted start --egress-policy open --idle-timeout 45m --json',
|
|
13
13
|
];
|
|
14
14
|
static flags = {
|
|
15
|
+
'identity-evaluation': core_1.Flags.string({
|
|
16
|
+
description: 'Explicit owner-bound admin-issued fresh identity evaluation capability',
|
|
17
|
+
}),
|
|
15
18
|
agent: core_1.Flags.string({
|
|
16
19
|
description: "Agent id (an agent you can view): applies that agent's declared network access. Use `agents attach-harness` to make it the agent default.",
|
|
17
20
|
}),
|
|
@@ -64,6 +67,9 @@ class HostedMachinesStart extends base_command_1.BaseCommand {
|
|
|
64
67
|
}
|
|
65
68
|
const body = {
|
|
66
69
|
clientRequestId: flags['request-id'] || newRequestId(),
|
|
70
|
+
...(flags['identity-evaluation']
|
|
71
|
+
? { identityEvaluationId: flags['identity-evaluation'] }
|
|
72
|
+
: {}),
|
|
67
73
|
...(flags.agent ? { agentId: flags.agent } : {}),
|
|
68
74
|
...(flags.conversation ? { conversationId: flags.conversation } : {}),
|
|
69
75
|
...(flags.environment ? { environmentId: flags.environment } : {}),
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model id the agent's harness does not list, said at save time (OSK-12205).
|
|
3
|
+
*
|
|
4
|
+
* `agents create/update --model <id>` stored any well-formed id without a
|
|
5
|
+
* word; the first anyone heard of a typo was a failed turn, whose remedy then
|
|
6
|
+
* sent a local agent to "publish the agent". The server only validates the
|
|
7
|
+
* id's SHAPE on write — asking the daemon for its live list on every PATCH
|
|
8
|
+
* would put a machine round-trip on the write path — so the check lives here,
|
|
9
|
+
* after the write, and never fails the command.
|
|
10
|
+
*
|
|
11
|
+
* Only a list that speaks for the harness can say "not there": `live` (the
|
|
12
|
+
* installed harness enumerated it) or `managed` (the admission policy). A
|
|
13
|
+
* `curated` list is our suggestion, so a miss against it is reported as
|
|
14
|
+
* unverified, with the reason the live list was unavailable.
|
|
15
|
+
*/
|
|
1
16
|
interface ModelsReport {
|
|
2
17
|
provider?: string | null;
|
|
3
18
|
source?: string;
|
|
4
19
|
sourceReason?: string;
|
|
20
|
+
managedRefusal?: {
|
|
21
|
+
code?: string;
|
|
22
|
+
message?: string;
|
|
23
|
+
};
|
|
5
24
|
models?: Array<{
|
|
6
25
|
value?: string;
|
|
7
26
|
}>;
|
|
@@ -3,24 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.primaryHarnessId = primaryHarnessId;
|
|
4
4
|
exports.describeUnlistedModel = describeUnlistedModel;
|
|
5
5
|
exports.warnIfModelNotListed = warnIfModelNotListed;
|
|
6
|
+
const data_provider_1 = require("@skrr-ai/data-provider");
|
|
6
7
|
const harnesses_1 = require("./harnesses");
|
|
7
|
-
/**
|
|
8
|
-
* A model id the agent's harness does not list, said at save time (OSK-12205).
|
|
9
|
-
*
|
|
10
|
-
* `agents create/update --model <id>` stored any well-formed id without a
|
|
11
|
-
* word; the first anyone heard of a typo was a failed turn, whose remedy then
|
|
12
|
-
* sent a local agent to "publish the agent". The server only validates the
|
|
13
|
-
* id's SHAPE on write — asking the daemon for its live list on every PATCH
|
|
14
|
-
* would put a machine round-trip on the write path — so the check lives here,
|
|
15
|
-
* after the write, and never fails the command.
|
|
16
|
-
*
|
|
17
|
-
* Only a list that speaks for the harness can say "not there": `live` (the
|
|
18
|
-
* installed harness enumerated it) or `managed` (the admission policy). A
|
|
19
|
-
* `curated` list is our suggestion, so a miss against it is reported as
|
|
20
|
-
* unverified, with the reason the live list was unavailable.
|
|
21
|
-
*/
|
|
22
|
-
/** Not model names: "no selection", which runs the harness default. */
|
|
23
|
-
const SENTINELS = new Set(['', 'default', 'auto']);
|
|
24
8
|
/** The harness the saved agent runs on first, as the write response names it. */
|
|
25
9
|
function primaryHarnessId(agent) {
|
|
26
10
|
const record = (agent ?? {});
|
|
@@ -32,13 +16,19 @@ function primaryHarnessId(agent) {
|
|
|
32
16
|
}
|
|
33
17
|
function describeUnlistedModel(model, report, harnessId, bin) {
|
|
34
18
|
const id = typeof model === 'string' ? model.trim() : '';
|
|
35
|
-
if (
|
|
19
|
+
if (!id || data_provider_1.RESERVED_LOCAL_CLI_MODEL_SENTINELS.has(id.toLowerCase()))
|
|
36
20
|
return null;
|
|
37
|
-
const
|
|
21
|
+
const normalized = (0, data_provider_1.normalizeLocalCliModelForProvider)(report?.provider, id);
|
|
22
|
+
const listed = (report?.models ?? []).some((entry) => entry?.value === id ||
|
|
23
|
+
(normalized !== null &&
|
|
24
|
+
(0, data_provider_1.normalizeLocalCliModelForProvider)(report?.provider, entry?.value) === normalized));
|
|
38
25
|
if (listed)
|
|
39
26
|
return null;
|
|
40
27
|
const provider = report?.provider || 'this';
|
|
41
28
|
const remedy = `\`${bin} harnesses models ${harnessId}\` lists what it can run.`;
|
|
29
|
+
if (report?.source === 'managed' && report.managedRefusal?.message) {
|
|
30
|
+
return `Model '${id}' was saved. ${report.managedRefusal.message} ${remedy}`;
|
|
31
|
+
}
|
|
42
32
|
if (report?.source === 'live' || report?.source === 'managed') {
|
|
43
33
|
return (`Model '${id}' is not in the ${provider} harness's ${report.source} model list ` +
|
|
44
34
|
`(${harnessId}). It was saved, but a turn fails when the harness refuses it. ${remedy}`);
|
|
@@ -53,7 +43,7 @@ function describeUnlistedModel(model, report, harnessId, bin) {
|
|
|
53
43
|
/** Best effort: a check that cannot run says nothing rather than failing the save. */
|
|
54
44
|
async function warnIfModelNotListed(opts) {
|
|
55
45
|
const id = typeof opts.model === 'string' ? opts.model.trim() : '';
|
|
56
|
-
if (
|
|
46
|
+
if (!id || data_provider_1.RESERVED_LOCAL_CLI_MODEL_SENTINELS.has(id.toLowerCase()))
|
|
57
47
|
return;
|
|
58
48
|
const harnessId = primaryHarnessId(opts.agent);
|
|
59
49
|
if (!harnessId)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PublicProjection, type AssistantTextJoiner } from '@skrr-ai/data-provider';
|
|
2
|
+
import type { FixedCopilotPermission } from './copilot-fixed-probe';
|
|
2
3
|
/**
|
|
3
4
|
* Why a question was dismissed when no terminal exists to ask it on. It is the
|
|
4
5
|
* REASON for a dismissal, never an answer: it travels as the value of the
|
|
@@ -196,6 +197,8 @@ export type AgenticStreamOptions = {
|
|
|
196
197
|
*/
|
|
197
198
|
incrementalText?: boolean;
|
|
198
199
|
approveTools?: boolean;
|
|
200
|
+
/** Internal fixed operator probe; never combined with blanket approval or TTY answers. */
|
|
201
|
+
fixedCopilotProbe?: FixedCopilotPermission;
|
|
199
202
|
input?: NodeJS.ReadableStream;
|
|
200
203
|
output?: NodeJS.WritableStream;
|
|
201
204
|
onEvent?: (event: AgenticStreamEvent) => void;
|