@skrr-ai/cli 0.1.178 → 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 (79) 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 +22 -0
  5. package/dist/commands/harnesses/evaluations/evidence.js +92 -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/grant.d.ts +30 -0
  9. package/dist/commands/harnesses/evaluations/grant.js +109 -0
  10. package/dist/commands/harnesses/evaluations/list.d.ts +18 -0
  11. package/dist/commands/harnesses/evaluations/list.js +73 -0
  12. package/dist/commands/harnesses/evaluations/platform-h9-turn.d.ts +13 -0
  13. package/dist/commands/harnesses/evaluations/platform-h9-turn.js +322 -0
  14. package/dist/commands/harnesses/evaluations/revoke.d.ts +19 -0
  15. package/dist/commands/harnesses/evaluations/revoke.js +45 -0
  16. package/dist/commands/harnesses/evaluations/show.d.ts +14 -0
  17. package/dist/commands/harnesses/evaluations/show.js +46 -0
  18. package/dist/commands/harnesses/list.d.ts +1 -0
  19. package/dist/commands/harnesses/list.js +11 -2
  20. package/dist/commands/harnesses/show.js +5 -0
  21. package/dist/commands/machines/hosted/identity-evaluations/issue.d.ts +12 -0
  22. package/dist/commands/machines/hosted/identity-evaluations/issue.js +40 -0
  23. package/dist/commands/machines/hosted/identity-evaluations/revoke.d.ts +11 -0
  24. package/dist/commands/machines/hosted/identity-evaluations/revoke.js +21 -0
  25. package/dist/commands/machines/hosted/identity-evaluations/show.d.ts +8 -0
  26. package/dist/commands/machines/hosted/identity-evaluations/show.js +20 -0
  27. package/dist/commands/machines/hosted/start.d.ts +1 -0
  28. package/dist/commands/machines/hosted/start.js +6 -0
  29. package/dist/lib/agentic-stream.d.ts +3 -0
  30. package/dist/lib/agentic-stream.js +63 -1
  31. package/dist/lib/copilot-fixed-probe-runner.d.ts +72 -0
  32. package/dist/lib/copilot-fixed-probe-runner.js +213 -0
  33. package/dist/lib/copilot-fixed-probe.d.ts +61 -0
  34. package/dist/lib/copilot-fixed-probe.js +223 -0
  35. package/dist/lib/first-party-harness-broker.d.ts +5 -0
  36. package/dist/lib/first-party-harness-broker.js +99 -0
  37. package/dist/lib/h9-platform-stream.d.ts +63 -0
  38. package/dist/lib/h9-platform-stream.js +317 -0
  39. package/dist/lib/h9-prior-stream.d.ts +44 -0
  40. package/dist/lib/h9-prior-stream.js +217 -0
  41. package/dist/lib/harness-evaluations.d.ts +251 -0
  42. package/dist/lib/harness-evaluations.js +66 -0
  43. package/dist/lib/harness-labels.d.ts +10 -0
  44. package/dist/lib/harness-labels.js +23 -0
  45. package/dist/lib/hosted-identity-evaluations.d.ts +26 -0
  46. package/dist/lib/hosted-identity-evaluations.js +18 -0
  47. package/dist/lib/hosted-machines.d.ts +1 -0
  48. package/dist/lib/inference-overload-smoke-contract.d.ts +53 -0
  49. package/dist/lib/inference-overload-smoke-contract.js +192 -0
  50. package/dist/lib/inference-overload-smoke.d.ts +78 -0
  51. package/dist/lib/inference-overload-smoke.js +350 -0
  52. package/dist/lib/operator-probe-files.d.ts +6 -0
  53. package/dist/lib/operator-probe-files.js +68 -0
  54. package/dist/lib/platform-h9-plan.d.ts +47 -0
  55. package/dist/lib/platform-h9-plan.js +78 -0
  56. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +150 -0
  57. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.d.ts +12 -2
  58. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/inferenceBrokerHarnesses.js +12 -5
  59. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.d.ts +12 -2
  60. package/dist/node_modules/@skrr-ai/auth-core/dist/esm/inferenceBrokerHarnesses.js +21 -7
  61. package/dist/node_modules/@skrr-ai/data-provider/index.js +6 -6
  62. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +3 -1
  63. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +23 -1
  64. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.d.ts +8 -0
  65. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.js +40 -0
  66. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +11 -20
  67. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +88 -9
  68. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.d.ts +56 -0
  69. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.js +277 -0
  70. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +3 -1
  71. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +3 -1
  72. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.d.ts +8 -0
  73. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.js +20 -0
  74. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +11 -20
  75. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +105 -12
  76. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.d.ts +56 -0
  77. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.js +261 -0
  78. package/oclif.manifest.json +1391 -443
  79. package/package.json +5 -2
@@ -4,6 +4,7 @@ exports.forwardToEngine = forwardToEngine;
4
4
  const core_1 = require("@oclif/core");
5
5
  const auth_core_1 = require("@skrr-ai/auth-core");
6
6
  const first_party_harness_1 = require("../../lib/first-party-harness");
7
+ const keychain_1 = require("../../lib/keychain");
7
8
  const first_party_harness_broker_1 = require("../../lib/first-party-harness-broker");
8
9
  const first_party_harness_startup_update_1 = require("../../lib/first-party-harness-startup-update");
9
10
  const first_party_harness_managed_1 = require("../../lib/first-party-harness-managed");
@@ -124,6 +125,10 @@ async function forwardToEngine(cmd, subcommand, passthrough, options = {}) {
124
125
  : null;
125
126
  for (const notice of policy?.notices ?? [])
126
127
  say(notice);
128
+ // Code forwards engine flags verbatim and does not extend BaseCommand. Resolve
129
+ // the same env or locked profile before the broker reads the saved credential.
130
+ if (options.managed)
131
+ (0, keychain_1.selectActiveProfile)(null);
127
132
  const managed = options.managed
128
133
  ? (0, first_party_harness_broker_1.createManagedEngineHooks)({
129
134
  subcommand,
@@ -0,0 +1,13 @@
1
+ import { Command } from '@oclif/core';
2
+ /** Manual entry only. Loading help or the command module runs no diagnostic. */
3
+ export default class InferenceSmoke extends Command {
4
+ static summary: string;
5
+ static description: string;
6
+ static flags: {
7
+ agent: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ session: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ };
11
+ static examples: string[];
12
+ run(): Promise<void>;
13
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const inference_overload_smoke_1 = require("../../lib/inference-overload-smoke");
5
+ /** Manual entry only. Loading help or the command module runs no diagnostic. */
6
+ class InferenceSmoke extends core_1.Command {
7
+ static summary = 'Check inference responsiveness with 128 small managed requests';
8
+ static description = 'Runs a fixed, bounded check for your selected Agent and returns request and billing receipts. This check uses your normal managed inference allowance or balance. It does not establish an overload performance guarantee.';
9
+ static flags = {
10
+ agent: core_1.Flags.string({ required: true, description: 'Agent to run this check for' }),
11
+ session: core_1.Flags.string({ required: true, description: 'The approved diagnostic session UUID' }),
12
+ json: core_1.Flags.boolean({ description: 'Print the complete metadata receipt as JSON' }),
13
+ };
14
+ static examples = [
15
+ '<%= config.bin %> diagnostics inference-smoke --agent Engineer --session <uuid> --json',
16
+ ];
17
+ async run() {
18
+ const { flags } = await this.parse(InferenceSmoke);
19
+ const controller = new AbortController();
20
+ const abort = () => controller.abort();
21
+ process.once('SIGINT', abort);
22
+ process.once('SIGTERM', abort);
23
+ try {
24
+ const result = await (0, inference_overload_smoke_1.runInferenceOverloadSmoke)({
25
+ agentRef: flags.agent,
26
+ sessionId: flags.session,
27
+ signal: controller.signal,
28
+ log: (line) => this.logToStderr(line),
29
+ });
30
+ if (flags.json)
31
+ this.log(JSON.stringify(result, null, 2));
32
+ else {
33
+ this.log(`Completed ${result.completed} of 128 requests.`);
34
+ if (result.problem)
35
+ this.log(`The check stopped (${result.problem}).`);
36
+ this.log(result.cleanup.reconciliationPending
37
+ ? 'Billing reconciliation is still pending.'
38
+ : 'Billing receipts are reconciled.');
39
+ this.log('This is a responsiveness check; overload qualification remains separate.');
40
+ }
41
+ if (result.problem || result.completed !== 128)
42
+ this.exit(1);
43
+ }
44
+ finally {
45
+ process.removeListener('SIGINT', abort);
46
+ process.removeListener('SIGTERM', abort);
47
+ }
48
+ }
49
+ }
50
+ exports.default = InferenceSmoke;
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * What the platform recorded for each turn a harness evaluation admitted (OSK-24597): the
4
+ * reservation, the relay's calls (`x-litellm-call-id`), and with `--gateway` the gateway's own spend
5
+ * row for each call. The platform-machine H9 runner reads its gateway-side facts from this.
6
+ */
7
+ export default class HarnessesEvaluationsEvidence extends BaseCommand {
8
+ static aliases: string[];
9
+ static description: string;
10
+ static examples: string[];
11
+ static args: {
12
+ grantId: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
13
+ };
14
+ static flags: {
15
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
+ gateway: import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
+ financial: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ 'financial-workspace': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
@@ -0,0 +1,92 @@
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 harness_evaluations_1 = require("../../../lib/harness-evaluations");
6
+ /**
7
+ * What the platform recorded for each turn a harness evaluation admitted (OSK-24597): the
8
+ * reservation, the relay's calls (`x-litellm-call-id`), and with `--gateway` the gateway's own spend
9
+ * row for each call. The platform-machine H9 runner reads its gateway-side facts from this.
10
+ */
11
+ class HarnessesEvaluationsEvidence extends base_command_1.BaseCommand {
12
+ static aliases = ['harnesses:evaluations:evidence'];
13
+ static description = 'Show the reservations, relay calls and gateway rows of a harness evaluation (platform admins)';
14
+ static examples = [
15
+ '<%= config.bin %> harnesses evaluations evidence hevg_<id> --gateway --json',
16
+ ];
17
+ static args = {
18
+ grantId: core_1.Args.string({ ignoreStdin: true, description: 'Grant id (hevg_...)', required: true }),
19
+ };
20
+ static flags = {
21
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
+ gateway: core_1.Flags.boolean({ description: "Also read each call's gateway spend row" }),
23
+ financial: core_1.Flags.boolean({
24
+ description: 'Read the bounded platform grant settlement snapshot',
25
+ }),
26
+ 'financial-workspace': core_1.Flags.string({
27
+ description: 'Read settlement for the exact private payer workspace',
28
+ }),
29
+ conversation: core_1.Flags.string({
30
+ description: 'Also read prompt-free persisted pointers for one of your own conversations',
31
+ }),
32
+ };
33
+ async run() {
34
+ this.requireAuth();
35
+ const { args, flags } = await this.parse(HarnessesEvaluationsEvidence);
36
+ if (flags['financial-workspace'] !== undefined && !flags.financial)
37
+ this.error('--financial-workspace requires --financial', { exit: 2 });
38
+ if (flags.financial) {
39
+ if (!flags.json || flags.gateway || flags.conversation)
40
+ this.error('--financial requires --json and a standalone read', { exit: 2 });
41
+ try {
42
+ const result = await (0, harness_evaluations_1.harnessEvaluationFinancialEvidence)(args.grantId, flags['financial-workspace']);
43
+ this.log(JSON.stringify(result, null, 2));
44
+ }
45
+ catch (err) {
46
+ this.handleApiError(err);
47
+ }
48
+ return;
49
+ }
50
+ let result;
51
+ try {
52
+ result = await (0, harness_evaluations_1.harnessEvaluationEvidence)(args.grantId, {
53
+ gateway: flags.gateway,
54
+ conversationId: flags.conversation,
55
+ });
56
+ }
57
+ catch (err) {
58
+ this.handleApiError(err);
59
+ return;
60
+ }
61
+ if (flags.json) {
62
+ this.log(JSON.stringify(result, null, 2));
63
+ return;
64
+ }
65
+ this.log(`${result.grant.grantId}: ${result.turns.length} turns`);
66
+ this.log(`Machine: ${result.machine.machineProduct ?? 'unknown'} ${result.machine.daemonId}; image ${result.machine.image ?? `unavailable (${result.machine.unavailable ?? 'unproven'})`}`);
67
+ if (result.continuity) {
68
+ const receipt = result.continuity.receipt;
69
+ this.log(receipt
70
+ ? `Native turn: ${receipt.platformSessionId}; ${receipt.resumed ? 'resumed' : 'started'}`
71
+ : 'Native continuity: no current grant-bound backend receipt');
72
+ }
73
+ for (const turn of result.turns) {
74
+ const r = turn.reservation;
75
+ this.log(` ${turn.claimedAt} ${turn.model} ${r ? `${r.status} settled $${r.settledUsd ?? '-'} (harness ${r.harnessVersion ?? '?'})` : 'no reservation'}`);
76
+ for (const call of turn.calls) {
77
+ const g = call.gateway;
78
+ const gw = g === undefined
79
+ ? ''
80
+ : g === null
81
+ ? ' gateway: no row'
82
+ : 'readError' in g
83
+ ? ` gateway: ${g.readError}`
84
+ : ` gateway: ${g.status ?? '?'} ${g.errorClass ?? ''}`.trimEnd();
85
+ this.log(` call ${call.providerRequestId} ${call.observation}${gw}`);
86
+ }
87
+ }
88
+ if (result.gateway?.unavailable)
89
+ this.log(`Gateway rows unavailable: ${result.gateway.unavailable}`);
90
+ }
91
+ }
92
+ exports.default = HarnessesEvaluationsEvidence;
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /** No machine/Agent/grant creation. No vendor/viewer key or fabricated lease. */
3
+ export default class HarnessesEvaluationsFixedTool extends BaseCommand {
4
+ static description: string;
5
+ static flags: {
6
+ plan: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
7
+ go: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("@oclif/core");
4
+ const node_stream_1 = require("node:stream");
5
+ const data_provider_1 = require("@skrr-ai/data-provider");
6
+ const base_command_1 = require("../../../base-command");
7
+ const agentic_stream_1 = require("../../../lib/agentic-stream");
8
+ const api_fetch_1 = require("../../../lib/api-fetch");
9
+ const harnesses_1 = require("../../../lib/harnesses");
10
+ const harness_evaluations_1 = require("../../../lib/harness-evaluations");
11
+ const copilot_fixed_probe_runner_1 = require("../../../lib/copilot-fixed-probe-runner");
12
+ const node_path_1 = require("node:path");
13
+ const operator_probe_files_1 = require("../../../lib/operator-probe-files");
14
+ /** No machine/Agent/grant creation. No vendor/viewer key or fabricated lease. */
15
+ class HarnessesEvaluationsFixedTool extends base_command_1.BaseCommand {
16
+ static description = 'Prepare, or explicitly authorize, one fixed Copilot evaluation tool turn';
17
+ static flags = {
18
+ plan: core_1.Flags.string({
19
+ required: true,
20
+ description: 'Private reviewed copilot-fixed-tool-plan.v1 JSON',
21
+ }),
22
+ go: core_1.Flags.string({
23
+ description: 'Exact SHA256 of a plan with paidOperationApproved:true; absent is preparation only',
24
+ }),
25
+ };
26
+ async run() {
27
+ const { flags } = await this.parse(HarnessesEvaluationsFixedTool);
28
+ const file = (0, operator_probe_files_1.privatePlan)(flags.plan), planSha256 = (0, operator_probe_files_1.sha)(file.raw);
29
+ let decoded;
30
+ try {
31
+ decoded = JSON.parse(file.raw.toString('utf8'));
32
+ }
33
+ catch {
34
+ throw new Error('PROBE_PLAN_INVALID');
35
+ }
36
+ const plan = (0, copilot_fixed_probe_runner_1.validateCopilotProbePlan)(decoded);
37
+ if (flags.go === undefined) {
38
+ this.log(JSON.stringify({
39
+ schema: 'copilot-fixed-tool-preparation.v1',
40
+ planSha256,
41
+ status: 'NOT_AUTHORIZED',
42
+ modelCalls: 0,
43
+ resourcesCreated: 0,
44
+ }));
45
+ return;
46
+ }
47
+ if (flags.go !== planSha256 || !plan.paidOperationApproved)
48
+ this.error('PROBE_EXACT_OPERATIONAL_GO_REQUIRED', { exit: 2 });
49
+ this.requireAuth();
50
+ // A plan is one-use even when the start acknowledgement or cleanup is lost.
51
+ // Root recovery uses its persisted original clientRequestId, never another turn.
52
+ const base = (0, node_path_1.join)((0, node_path_1.dirname)(file.absolute), plan.operationId);
53
+ (0, operator_probe_files_1.durable)(base + '.started.json', { planSha256, clientRequestId: `copilot-fixed:${plan.operationId}` }, true);
54
+ const persist = (value) => (0, operator_probe_files_1.durable)(base + '.recovery.json', value);
55
+ const sink = new node_stream_1.Writable({
56
+ write(_chunk, _encoding, done) {
57
+ done();
58
+ },
59
+ });
60
+ const stream = async (accepted, permission, deadline) => {
61
+ let runtimeStartObserved = false;
62
+ const client = new agentic_stream_1.AgenticStreamClient({
63
+ baseURL: this.cliConfig.baseURL,
64
+ token: this.resolvedCredential.token,
65
+ workspaceId: plan.workspaceId,
66
+ sessionId: accepted.sessionId,
67
+ conversationId: accepted.conversationId,
68
+ fixedCopilotProbe: permission,
69
+ quiet: true,
70
+ statusOutput: sink,
71
+ output: sink,
72
+ attachTimeoutMs: 10000,
73
+ replayEnvelopes: (from) => (0, api_fetch_1.apiFetch)(`/api/agentic/sessions/${encodeURIComponent(accepted.sessionId)}/envelopes?from=${from}&limit=500`, { credential: this.resolvedCredential, signal: AbortSignal.timeout(5000) }),
74
+ onEvent: (event) => {
75
+ if (event.sessionId !== accepted.sessionId || event.type !== 'session.output')
76
+ return;
77
+ for (const envelope of Array.isArray(event.envelopes) ? event.envelopes : []) {
78
+ const ev = envelope?.ev;
79
+ if (ev?.t === 'service' &&
80
+ /^Copilot SDK runtime ready \(pid: [1-9][0-9]*\)$/.test(ev.text ?? ''))
81
+ runtimeStartObserved = true;
82
+ }
83
+ },
84
+ });
85
+ const abort = () => {
86
+ permission.stop();
87
+ client.cancel('Fixed Copilot probe interrupted');
88
+ };
89
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP'])
90
+ process.on(signal, abort);
91
+ let timer, hard;
92
+ try {
93
+ timer = setTimeout(abort, Math.max(1, deadline - Date.now()));
94
+ const result = await Promise.race([
95
+ client.run(),
96
+ new Promise((_resolve, reject) => {
97
+ hard = setTimeout(() => {
98
+ abort();
99
+ reject(new Error('PROBE_TERMINAL_UNCONFIRMED'));
100
+ }, Math.max(1, deadline - Date.now()) + 15000);
101
+ }),
102
+ ]);
103
+ return { status: result.status, runtimeStartObserved };
104
+ }
105
+ finally {
106
+ clearTimeout(timer);
107
+ clearTimeout(hard);
108
+ client.close();
109
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP'])
110
+ process.off(signal, abort);
111
+ }
112
+ };
113
+ try {
114
+ const result = await (0, copilot_fixed_probe_runner_1.runCopilotFixedProbe)(plan, {
115
+ principal: () => this.resolveCurrentUserId(),
116
+ inspect: async () => {
117
+ const [grant, agent, harness, evidence] = await Promise.all([
118
+ (0, harness_evaluations_1.showHarnessEvaluation)(plan.grantId),
119
+ data_provider_1.dataService.getAgentById({ agent_id: plan.agentId }),
120
+ (0, harnesses_1.getHarness)(plan.harnessId),
121
+ (0, harness_evaluations_1.harnessEvaluationEvidence)(plan.grantId),
122
+ ]);
123
+ return {
124
+ grant: grant.grant,
125
+ agent,
126
+ harness: harness.harness,
127
+ machine: evidence.machine,
128
+ };
129
+ },
130
+ start: (body, deadline) => data_provider_1.dataService.startAgenticChat(body, {
131
+ signal: AbortSignal.timeout(Math.max(1, deadline - Date.now())),
132
+ timeout: Math.max(1, deadline - Date.now()),
133
+ }),
134
+ stream,
135
+ persist,
136
+ cancel: async (accepted) => {
137
+ // Even an older acceptance lacking public context is cancelled through
138
+ // the ordinary authenticated session transport, with approval disabled.
139
+ const client = new agentic_stream_1.AgenticStreamClient({
140
+ baseURL: this.cliConfig.baseURL,
141
+ token: this.resolvedCredential.token,
142
+ workspaceId: plan.workspaceId,
143
+ sessionId: accepted.sessionId,
144
+ quiet: true,
145
+ output: sink,
146
+ statusOutput: sink,
147
+ attachTimeoutMs: 5000,
148
+ onEvent: (event) => {
149
+ if (event.type === 'session.joined')
150
+ client.cancel('Fixed Copilot probe context unavailable');
151
+ },
152
+ });
153
+ const timer = setTimeout(() => client.close(), 6000);
154
+ let fallback;
155
+ try {
156
+ await Promise.race([
157
+ client.run(),
158
+ new Promise((resolve) => {
159
+ fallback = setTimeout(resolve, 6500);
160
+ }),
161
+ ]);
162
+ }
163
+ finally {
164
+ clearTimeout(timer);
165
+ clearTimeout(fallback);
166
+ client.close();
167
+ }
168
+ },
169
+ });
170
+ this.log(JSON.stringify(result));
171
+ if (result.outcome !== 'fixed-tool-observed')
172
+ process.exitCode = 1;
173
+ }
174
+ catch {
175
+ this.log(JSON.stringify({
176
+ schema: 'copilot-fixed-tool-result.v1',
177
+ outcome: 'inconclusive',
178
+ reason: 'PROBE_REFUSED_OR_UNCONFIRMED',
179
+ planSha256,
180
+ recoveryFile: base + '.recovery.json',
181
+ clientRequestId: `copilot-fixed:${plan.operationId}`,
182
+ physicalStopConfirmed: false,
183
+ billingClosureClaimed: false,
184
+ }));
185
+ process.exitCode = 1;
186
+ }
187
+ }
188
+ }
189
+ exports.default = HarnessesEvaluationsFixedTool;
@@ -0,0 +1,30 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /**
3
+ * Let a harness still evaluating on platform machines run on one of your own platform machines,
4
+ * for your own turns only (OSK-24597).
5
+ *
6
+ * The harness, its exact image version, the models and the machine are all named here, and the
7
+ * grant ends at `--ttl-minutes` (at most 360) or `--max-spend-usd` (at most 10), whichever comes
8
+ * first. Its turns run through the machine's daemon, broker, relay and gateway lease, exactly as an
9
+ * admitted harness's would. After granting, the command asks the daemon to re-register so the
10
+ * harness appears on the machine now (`--no-rescan` skips it; the next reconnect does the same).
11
+ */
12
+ export default class HarnessesEvaluationsGrant extends BaseCommand {
13
+ static aliases: string[];
14
+ static description: string;
15
+ static examples: string[];
16
+ static args: {
17
+ harness: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
18
+ };
19
+ static flags: {
20
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
21
+ version: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
22
+ model: import("@oclif/core/interfaces").OptionFlag<string[], import("@oclif/core/interfaces").CustomOptions>;
23
+ daemon: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
24
+ 'ttl-minutes': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ 'max-spend-usd': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ reason: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
27
+ 'no-rescan': import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ };
29
+ run(): Promise<void>;
30
+ }
@@ -0,0 +1,109 @@
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 harness_evaluations_1 = require("../../../lib/harness-evaluations");
6
+ /**
7
+ * Let a harness still evaluating on platform machines run on one of your own platform machines,
8
+ * for your own turns only (OSK-24597).
9
+ *
10
+ * The harness, its exact image version, the models and the machine are all named here, and the
11
+ * grant ends at `--ttl-minutes` (at most 360) or `--max-spend-usd` (at most 10), whichever comes
12
+ * first. Its turns run through the machine's daemon, broker, relay and gateway lease, exactly as an
13
+ * admitted harness's would. After granting, the command asks the daemon to re-register so the
14
+ * harness appears on the machine now (`--no-rescan` skips it; the next reconnect does the same).
15
+ */
16
+ class HarnessesEvaluationsGrant extends base_command_1.BaseCommand {
17
+ static aliases = ['harnesses:evaluations:grant'];
18
+ static description = 'Let a harness evaluating on platform machines run on one of your own (platform admins)';
19
+ static examples = [
20
+ '<%= config.bin %> harnesses evaluations grant pi --version 1.5.2 --model claude-sonnet-5 --daemon <daemon-id> --reason "H9 for pi on a Hosted Machine (OSK-24468)"',
21
+ '<%= config.bin %> harnesses evaluations grant copilot-sdk --version 1.0.112 --model claude-sonnet-5 --model gpt-5.6-terra --daemon <daemon-id> --ttl-minutes 90 --max-spend-usd 3 --reason "H9 for copilot-sdk (OSK-24469)" --json',
22
+ ];
23
+ static args = {
24
+ harness: core_1.Args.string({
25
+ ignoreStdin: true,
26
+ description: 'Registry harness id evaluating at platform-machine (for example pi, copilot-sdk)',
27
+ required: true,
28
+ }),
29
+ };
30
+ static flags = {
31
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
32
+ version: core_1.Flags.string({
33
+ description: 'The exact harness version the machine image reports (its Harness row cliVersion)',
34
+ required: true,
35
+ }),
36
+ model: core_1.Flags.string({
37
+ description: 'A catalog model alias the evaluation may run (1-4; repeat the flag)',
38
+ required: true,
39
+ multiple: true,
40
+ }),
41
+ daemon: core_1.Flags.string({
42
+ description: 'Daemon id of your Hosted Machine or Dedicated Runtime (from `skrr harnesses list`)',
43
+ required: true,
44
+ }),
45
+ 'ttl-minutes': core_1.Flags.integer({ description: 'How long it lasts (5-360, default 120)' }),
46
+ 'max-spend-usd': core_1.Flags.string({
47
+ description: 'Cap on what its turns may commit, in USD (0.5-10, default 4): settled turns count what they settled, unsettled ones their worst case',
48
+ }),
49
+ reason: core_1.Flags.string({
50
+ description: 'Why (8-512 characters). Recorded on the grant with your account.',
51
+ required: true,
52
+ }),
53
+ 'no-rescan': core_1.Flags.boolean({
54
+ description: 'Do not ask the daemon to re-register now',
55
+ }),
56
+ };
57
+ async run() {
58
+ this.requireAuth();
59
+ const { args, flags } = await this.parse(HarnessesEvaluationsGrant);
60
+ const maxSpendUsd = flags['max-spend-usd'] === undefined ? undefined : Number(flags['max-spend-usd']);
61
+ if (maxSpendUsd !== undefined && !Number.isFinite(maxSpendUsd)) {
62
+ this.error('--max-spend-usd must be a number', { exit: 2 });
63
+ }
64
+ let result;
65
+ try {
66
+ result = await (0, harness_evaluations_1.grantHarnessEvaluation)({
67
+ harness: args.harness,
68
+ version: flags.version,
69
+ models: flags.model,
70
+ daemonId: flags.daemon,
71
+ reason: flags.reason,
72
+ ...(flags['ttl-minutes'] !== undefined ? { ttlMinutes: flags['ttl-minutes'] } : {}),
73
+ ...(maxSpendUsd !== undefined ? { maxSpendUsd } : {}),
74
+ });
75
+ }
76
+ catch (err) {
77
+ this.handleApiError(err);
78
+ return;
79
+ }
80
+ let rescan = null;
81
+ if (!flags['no-rescan']) {
82
+ try {
83
+ const response = await (0, harness_evaluations_1.rescanDaemonHarnesses)(result.grant.daemonId);
84
+ rescan =
85
+ response.success === false
86
+ ? { ok: false, message: 'The daemon did not confirm its harness rescan' }
87
+ : { ok: true };
88
+ }
89
+ catch (err) {
90
+ rescan = { ok: false, message: err.message };
91
+ }
92
+ }
93
+ if (flags.json) {
94
+ this.log(JSON.stringify({ ...result, rescan }, null, 2));
95
+ return;
96
+ }
97
+ const { grant } = result;
98
+ this.log(`Granted ${grant.grantId}: ${grant.harness} ${grant.version} may run ${grant.models.join(', ')} ` +
99
+ `on daemon ${grant.daemonId} for your turns until ${grant.expiresAt}, up to $${grant.maxSpendUsd.toFixed(2)}.`);
100
+ if (rescan?.ok) {
101
+ this.log('The daemon re-registered; `skrr harnesses list --daemon <id>` should show the row as evaluating.');
102
+ }
103
+ else if (rescan) {
104
+ this.log(`The daemon did not re-register (${rescan.message}). The grant takes effect at its next successful registration; retry the harness rescan when the machine is available.`);
105
+ }
106
+ this.log('Pin an agent to that Harness row to run it; nobody else, and no other machine, is admitted.');
107
+ }
108
+ }
109
+ exports.default = HarnessesEvaluationsGrant;
@@ -0,0 +1,18 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ import { type HarnessEvaluationGrant } from '../../../lib/harness-evaluations';
3
+ /** One table row per grant. */
4
+ export declare function evaluationRows(grants: HarnessEvaluationGrant[]): Array<Record<string, string>>;
5
+ /** Your harness evaluations on platform machines (OSK-24597). */
6
+ export default class HarnessesEvaluationsList extends BaseCommand {
7
+ static aliases: string[];
8
+ static description: string;
9
+ static examples: string[];
10
+ static flags: {
11
+ json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ harness: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ daemon: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ 'include-ended': import("@oclif/core/interfaces").BooleanFlag<boolean>;
15
+ limit: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ };
17
+ run(): Promise<void>;
18
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.evaluationRows = evaluationRows;
4
+ const core_1 = require("@oclif/core");
5
+ const base_command_1 = require("../../../base-command");
6
+ const format_1 = require("../../../lib/format");
7
+ const list_output_1 = require("../../../lib/list-output");
8
+ const harness_evaluations_1 = require("../../../lib/harness-evaluations");
9
+ /** One table row per grant. */
10
+ function evaluationRows(grants) {
11
+ return grants.map((grant) => ({
12
+ grant: grant.grantId,
13
+ harness: `${grant.harness} ${grant.version}`,
14
+ models: grant.models.join(', '),
15
+ daemon: grant.daemonId,
16
+ state: (0, harness_evaluations_1.harnessEvaluationStateLabel)(grant),
17
+ turns: String(grant.admissions.length),
18
+ cap: `$${grant.maxSpendUsd.toFixed(2)}`,
19
+ }));
20
+ }
21
+ /** Your harness evaluations on platform machines (OSK-24597). */
22
+ class HarnessesEvaluationsList extends base_command_1.BaseCommand {
23
+ static aliases = ['harnesses:evaluations:list'];
24
+ static description = 'List your harness evaluations on platform machines (platform admins)';
25
+ static examples = [
26
+ '<%= config.bin %> harnesses evaluations list',
27
+ '<%= config.bin %> harnesses evaluations list --harness pi --include-ended --json',
28
+ ];
29
+ static flags = {
30
+ json: core_1.Flags.boolean({ description: 'Output as JSON' }),
31
+ harness: core_1.Flags.string({ description: 'Only this harness (for example pi)' }),
32
+ daemon: core_1.Flags.string({ description: 'Only this daemon id' }),
33
+ 'include-ended': core_1.Flags.boolean({ description: 'Include expired and withdrawn grants' }),
34
+ limit: core_1.Flags.integer({ description: 'At most this many grants (default 50, up to 200)' }),
35
+ };
36
+ async run() {
37
+ this.requireAuth();
38
+ const { flags } = await this.parse(HarnessesEvaluationsList);
39
+ let result;
40
+ try {
41
+ result = await (0, harness_evaluations_1.listHarnessEvaluations)({
42
+ harness: flags.harness,
43
+ daemonId: flags.daemon,
44
+ includeEnded: flags['include-ended'],
45
+ limit: flags.limit,
46
+ });
47
+ }
48
+ catch (err) {
49
+ this.handleApiError(err);
50
+ return;
51
+ }
52
+ if (flags.json) {
53
+ this.printJsonResult((0, list_output_1.listResult)(result.grants));
54
+ return;
55
+ }
56
+ if (result.grants.length === 0) {
57
+ this.log(flags['include-ended']
58
+ ? 'You have no harness evaluations.'
59
+ : 'You have no harness evaluation in force; --include-ended lists ended ones.');
60
+ return;
61
+ }
62
+ (0, format_1.renderTable)(evaluationRows(result.grants), [
63
+ { key: 'grant', header: 'GRANT' },
64
+ { key: 'harness', header: 'HARNESS' },
65
+ { key: 'models', header: 'MODELS', maxWidth: 32 },
66
+ { key: 'daemon', header: 'DAEMON' },
67
+ { key: 'state', header: 'STATE' },
68
+ { key: 'turns', header: 'TURNS' },
69
+ { key: 'cap', header: 'CAP' },
70
+ ], (line) => this.log(line));
71
+ }
72
+ }
73
+ exports.default = HarnessesEvaluationsList;
@@ -0,0 +1,13 @@
1
+ import { BaseCommand } from '../../../base-command';
2
+ /** Internal adapter for the checked-in fixed platform scenarios. */
3
+ export default class HarnessesEvaluationsPlatformH9Turn extends BaseCommand {
4
+ static hidden: boolean;
5
+ static description: string;
6
+ static flags: {
7
+ plan: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ go: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ label: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<void>;
13
+ }