@skrr-ai/cli 0.1.179 → 0.1.180

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.
Files changed (62) hide show
  1. package/dist/commands/code/index.js +5 -0
  2. package/dist/commands/diagnostics/inference-smoke.d.ts +13 -0
  3. package/dist/commands/diagnostics/inference-smoke.js +50 -0
  4. package/dist/commands/harnesses/evaluations/evidence.d.ts +2 -0
  5. package/dist/commands/harnesses/evaluations/evidence.js +20 -0
  6. package/dist/commands/harnesses/evaluations/fixed-tool.d.ts +10 -0
  7. package/dist/commands/harnesses/evaluations/fixed-tool.js +189 -0
  8. package/dist/commands/harnesses/evaluations/platform-h9-turn.d.ts +13 -0
  9. package/dist/commands/harnesses/evaluations/platform-h9-turn.js +322 -0
  10. package/dist/commands/machines/hosted/identity-evaluations/issue.d.ts +12 -0
  11. package/dist/commands/machines/hosted/identity-evaluations/issue.js +40 -0
  12. package/dist/commands/machines/hosted/identity-evaluations/revoke.d.ts +11 -0
  13. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +21 -0
  14. package/dist/commands/machines/hosted/identity-evaluations/show.d.ts +8 -0
  15. package/dist/commands/machines/hosted/identity-evaluations/show.js +20 -0
  16. package/dist/commands/machines/hosted/start.d.ts +1 -0
  17. package/dist/commands/machines/hosted/start.js +6 -0
  18. package/dist/lib/agentic-stream.d.ts +3 -0
  19. package/dist/lib/agentic-stream.js +63 -1
  20. package/dist/lib/copilot-fixed-probe-runner.d.ts +72 -0
  21. package/dist/lib/copilot-fixed-probe-runner.js +213 -0
  22. package/dist/lib/copilot-fixed-probe.d.ts +61 -0
  23. package/dist/lib/copilot-fixed-probe.js +223 -0
  24. package/dist/lib/first-party-harness-broker.d.ts +5 -0
  25. package/dist/lib/first-party-harness-broker.js +99 -0
  26. package/dist/lib/h9-platform-stream.d.ts +63 -0
  27. package/dist/lib/h9-platform-stream.js +317 -0
  28. package/dist/lib/h9-prior-stream.d.ts +44 -0
  29. package/dist/lib/h9-prior-stream.js +217 -0
  30. package/dist/lib/harness-evaluations.d.ts +85 -0
  31. package/dist/lib/harness-evaluations.js +8 -0
  32. package/dist/lib/hosted-identity-evaluations.d.ts +26 -0
  33. package/dist/lib/hosted-identity-evaluations.js +18 -0
  34. package/dist/lib/hosted-machines.d.ts +1 -0
  35. package/dist/lib/inference-overload-smoke-contract.d.ts +53 -0
  36. package/dist/lib/inference-overload-smoke-contract.js +192 -0
  37. package/dist/lib/inference-overload-smoke.d.ts +78 -0
  38. package/dist/lib/inference-overload-smoke.js +350 -0
  39. package/dist/lib/operator-probe-files.d.ts +6 -0
  40. package/dist/lib/operator-probe-files.js +68 -0
  41. package/dist/lib/platform-h9-plan.d.ts +47 -0
  42. package/dist/lib/platform-h9-plan.js +78 -0
  43. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +150 -0
  44. package/dist/node_modules/@skrr-ai/data-provider/index.js +6 -6
  45. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +3 -1
  46. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +23 -1
  47. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.d.ts +8 -0
  48. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.js +40 -0
  49. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +2 -11
  50. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +31 -5
  51. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.d.ts +56 -0
  52. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.js +277 -0
  53. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +3 -1
  54. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +3 -1
  55. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.d.ts +8 -0
  56. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.js +20 -0
  57. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +2 -11
  58. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +28 -4
  59. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.d.ts +56 -0
  60. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.js +261 -0
  61. package/oclif.manifest.json +473 -1
  62. 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,8 @@
1
+ import { BaseCommand } from '../../../../base-command';
2
+ export default class Show extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ run(): Promise<void>;
8
+ }
@@ -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,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;
@@ -933,6 +933,8 @@ class AgenticStreamClient {
933
933
  return this.terminalResult;
934
934
  }
935
935
  constructor(options) {
936
+ if (options.fixedCopilotProbe && (options.approveTools || options.input))
937
+ throw new Error('Fixed Copilot probe cannot use blanket or terminal approval');
936
938
  this.options = options;
937
939
  }
938
940
  async run() {
@@ -1085,6 +1087,7 @@ class AgenticStreamClient {
1085
1087
  return true;
1086
1088
  }
1087
1089
  cancel(reason = 'Interrupted by user') {
1090
+ this.options.fixedCopilotProbe?.stop();
1088
1091
  if (this.settled || !this.socket)
1089
1092
  return;
1090
1093
  // A handed-over turn has no relaying server left to carry an interrupt to
@@ -1101,6 +1104,7 @@ class AgenticStreamClient {
1101
1104
  this.emit({ type: 'run.cancel_requested', sessionId: this.options.sessionId, reason });
1102
1105
  }
1103
1106
  close() {
1107
+ this.options.fixedCopilotProbe?.close();
1104
1108
  if (this.closed)
1105
1109
  return;
1106
1110
  this.closed = true;
@@ -1861,6 +1865,26 @@ class AgenticStreamClient {
1861
1865
  if (this.replayPermissionDecision(event))
1862
1866
  return;
1863
1867
  this.emit({ ...event, type: 'permission.requested' });
1868
+ if (this.options.fixedCopilotProbe) {
1869
+ const approved = this.options.fixedCopilotProbe.decide(event);
1870
+ // No legacy unbound response and no continuing/session grant. The server
1871
+ // validates this public context against its own current lifetime and ask.
1872
+ const ordinaryToolAsk = event.purpose === undefined &&
1873
+ event.runtimeElicitation === undefined &&
1874
+ event.toolName !== 'ComputerUse';
1875
+ if (ordinaryToolAsk && event.permissionBinding)
1876
+ await this.sendBoundPermissionDecision(event, approved, {
1877
+ ...(event.interactiveAdmission
1878
+ ? { interactiveAdmission: event.interactiveAdmission }
1879
+ : {}),
1880
+ ...(approved
1881
+ ? { scope: 'once' }
1882
+ : { automatic: true, reason: 'Fixed Copilot probe refused this request' }),
1883
+ });
1884
+ if (!approved || this.options.fixedCopilotProbe.refused)
1885
+ this.cancel('Fixed Copilot probe permission refused or unconfirmed');
1886
+ return;
1887
+ }
1864
1888
  // Runtime-authored application consent is exclusively an interactive app
1865
1889
  // decision. A TTY or --approve-tools is not that authenticated human lane.
1866
1890
  // Recognize malformed runtime asks too, so they never fall into generic grants.
@@ -2004,6 +2028,11 @@ class AgenticStreamClient {
2004
2028
  event.runtimeElicitation !== undefined ||
2005
2029
  event.toolName === 'ComputerUse')
2006
2030
  return false;
2031
+ if (this.options.fixedCopilotProbe) {
2032
+ this.options.fixedCopilotProbe.stop('PROBE_REPLAYED_DECISION');
2033
+ this.cancel('Fixed Copilot probe cannot adopt a replayed permission decision');
2034
+ return true;
2035
+ }
2007
2036
  const generation = permissionGeneration(event);
2008
2037
  if (event.toolUseId) {
2009
2038
  this.openPermissionPrompts.get(event.toolUseId)?.abort();
@@ -2106,6 +2135,9 @@ class AgenticStreamClient {
2106
2135
  finish({
2107
2136
  type: 'permission.response_recorded',
2108
2137
  status: result.status,
2138
+ ...(this.options.fixedCopilotProbe && result.duplicate === true
2139
+ ? { duplicate: true }
2140
+ : {}),
2109
2141
  message: 'Response recorded. This does not confirm tool execution or a continuing permission grant.',
2110
2142
  });
2111
2143
  else
@@ -2123,11 +2155,21 @@ class AgenticStreamClient {
2123
2155
  decision: approved ? 'allow' : 'deny',
2124
2156
  executionConfirmed: false,
2125
2157
  });
2158
+ if (this.options.fixedCopilotProbe) {
2159
+ this.options.fixedCopilotProbe.decisionReceipt(event, approved, result);
2160
+ if (this.options.fixedCopilotProbe.refused)
2161
+ this.cancel('Fixed Copilot probe decision unconfirmed');
2162
+ }
2126
2163
  return true;
2127
2164
  }
2128
2165
  async handleQuestion(event) {
2129
2166
  if (this.closed)
2130
2167
  return;
2168
+ if (this.options.fixedCopilotProbe) {
2169
+ this.options.fixedCopilotProbe.stop('PROBE_UNEXPECTED_QUESTION');
2170
+ this.cancel('Fixed Copilot probe cannot answer questions');
2171
+ return;
2172
+ }
2131
2173
  // The same question can arrive twice (both delivery paths carry it — a
2132
2174
  // non-interactive run showed two `question.requested` for one questionId,
2133
2175
  // each answered). Answer it once, as tool events are emitted once.
@@ -2188,6 +2230,13 @@ class AgenticStreamClient {
2188
2230
  * and close the terminal prompt if this client is still showing it.
2189
2231
  */
2190
2232
  handlePermissionCancel(event) {
2233
+ if (this.options.fixedCopilotProbe) {
2234
+ if (this.options.fixedCopilotProbe.answerNotice(event))
2235
+ return;
2236
+ this.options.fixedCopilotProbe.stop('PROBE_PERMISSION_CANCELLED');
2237
+ this.cancel('Fixed Copilot probe permission closed');
2238
+ return;
2239
+ }
2191
2240
  const toolUseId = typeof event.toolUseId === 'string' ? event.toolUseId : undefined;
2192
2241
  // An unbound ask still being held for its bound twin was cancelled before it was ever shown.
2193
2242
  const heldAsk = toolUseId ? this.heldUnboundAsks.get(toolUseId) : undefined;
@@ -2399,6 +2448,18 @@ class AgenticStreamClient {
2399
2448
  return appended === undefined ? { ...rest, replace: text } : { ...rest, delta: appended };
2400
2449
  }
2401
2450
  emit(event) {
2451
+ this.options.fixedCopilotProbe?.observe(event);
2452
+ if (this.options.fixedCopilotProbe?.refused &&
2453
+ [
2454
+ 'tool.started',
2455
+ 'tool.completed',
2456
+ 'permission.cancelled',
2457
+ 'stream.gap',
2458
+ 'transport.error',
2459
+ 'run.handed_over',
2460
+ 'text.reset',
2461
+ ].includes(event.type))
2462
+ this.cancel('Fixed Copilot probe observed an unexpected or cancelled tool');
2402
2463
  this.lastEvent = event;
2403
2464
  this.options.onEvent?.(event);
2404
2465
  // Any event is proof the stream is alive; the watchdog only fires on real
@@ -2904,7 +2965,8 @@ exports.AgenticStreamClient = AgenticStreamClient;
2904
2965
  */
2905
2966
  const REALTIME_HOSTS = new Map([
2906
2967
  ...Object.values(publicEndpoints_generated_1.OVERSKY_ENVIRONMENT_ENDPOINTS).map((endpoint) => [
2907
- new URL(endpoint.appUrl).hostname, new URL(endpoint.realtimeUrl).hostname,
2968
+ new URL(endpoint.appUrl).hostname,
2969
+ new URL(endpoint.realtimeUrl).hostname,
2908
2970
  ]),
2909
2971
  [new URL(config_1.LEGACY_PROD_BASE_URL).hostname, `api.${new URL(config_1.LEGACY_PROD_BASE_URL).hostname}`],
2910
2972
  ]);