@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.
Files changed (66) 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/agent-model-check.d.ts +19 -0
  19. package/dist/lib/agent-model-check.js +10 -20
  20. package/dist/lib/agentic-stream.d.ts +3 -0
  21. package/dist/lib/agentic-stream.js +63 -1
  22. package/dist/lib/copilot-fixed-probe-runner.d.ts +72 -0
  23. package/dist/lib/copilot-fixed-probe-runner.js +213 -0
  24. package/dist/lib/copilot-fixed-probe.d.ts +61 -0
  25. package/dist/lib/copilot-fixed-probe.js +223 -0
  26. package/dist/lib/credential-resolver.d.ts +1 -0
  27. package/dist/lib/credential-resolver.js +5 -1
  28. package/dist/lib/first-party-harness-broker.d.ts +5 -10
  29. package/dist/lib/first-party-harness-broker.js +121 -50
  30. package/dist/lib/h9-platform-stream.d.ts +63 -0
  31. package/dist/lib/h9-platform-stream.js +317 -0
  32. package/dist/lib/h9-prior-stream.d.ts +44 -0
  33. package/dist/lib/h9-prior-stream.js +217 -0
  34. package/dist/lib/harness-evaluations.d.ts +85 -0
  35. package/dist/lib/harness-evaluations.js +8 -0
  36. package/dist/lib/hosted-identity-evaluations.d.ts +26 -0
  37. package/dist/lib/hosted-identity-evaluations.js +18 -0
  38. package/dist/lib/hosted-machines.d.ts +1 -0
  39. package/dist/lib/inference-overload-smoke-contract.d.ts +53 -0
  40. package/dist/lib/inference-overload-smoke-contract.js +192 -0
  41. package/dist/lib/inference-overload-smoke.d.ts +78 -0
  42. package/dist/lib/inference-overload-smoke.js +350 -0
  43. package/dist/lib/operator-probe-files.d.ts +6 -0
  44. package/dist/lib/operator-probe-files.js +68 -0
  45. package/dist/lib/platform-h9-plan.d.ts +47 -0
  46. package/dist/lib/platform-h9-plan.js +78 -0
  47. package/dist/node_modules/@skrr-ai/auth-core/dist/cjs/codex-model-catalog.json +150 -0
  48. package/dist/node_modules/@skrr-ai/data-provider/index.js +6 -6
  49. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.d.ts +3 -1
  50. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/index.js +23 -1
  51. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.d.ts +8 -0
  52. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-haiku-none.js +40 -0
  53. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.d.ts +2 -11
  54. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/managed-inference-broker.js +31 -5
  55. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.d.ts +56 -0
  56. package/dist/node_modules/@skrr-ai/inference-broker/dist/cjs/overload-smoke.js +277 -0
  57. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.d.ts +3 -1
  58. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/index.js +3 -1
  59. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.d.ts +8 -0
  60. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-haiku-none.js +20 -0
  61. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.d.ts +2 -11
  62. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/managed-inference-broker.js +28 -4
  63. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.d.ts +56 -0
  64. package/dist/node_modules/@skrr-ai/inference-broker/dist/esm/overload-smoke.js +261 -0
  65. package/oclif.manifest.json +473 -1
  66. package/package.json +2 -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;
@@ -14,6 +14,8 @@ export default class HarnessesEvaluationsEvidence extends BaseCommand {
14
14
  static flags: {
15
15
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
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>;
17
19
  conversation: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
20
  };
19
21
  run(): Promise<void>;
@@ -20,6 +20,12 @@ class HarnessesEvaluationsEvidence extends base_command_1.BaseCommand {
20
20
  static flags = {
21
21
  json: core_1.Flags.boolean({ description: 'Output as JSON' }),
22
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
+ }),
23
29
  conversation: core_1.Flags.string({
24
30
  description: 'Also read prompt-free persisted pointers for one of your own conversations',
25
31
  }),
@@ -27,6 +33,20 @@ class HarnessesEvaluationsEvidence extends base_command_1.BaseCommand {
27
33
  async run() {
28
34
  this.requireAuth();
29
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
+ }
30
50
  let result;
31
51
  try {
32
52
  result = await (0, harness_evaluations_1.harnessEvaluationEvidence)(args.grantId, {
@@ -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,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
+ }