@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
@@ -0,0 +1,223 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FixedCopilotPermission = void 0;
4
+ exports.interactiveAdmission = interactiveAdmission;
5
+ exports.fixedCopilotCommand = fixedCopilotCommand;
6
+ exports.copilotPlatformScratchDirectory = copilotPlatformScratchDirectory;
7
+ exports.copilotPlatformScratchCommand = copilotPlatformScratchCommand;
8
+ const object = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
9
+ const exact = (value, keys) => JSON.stringify(Object.keys(value).sort()) === JSON.stringify([...keys].sort());
10
+ const text = (value) => typeof value === 'string' && /^[A-Za-z0-9][A-Za-z0-9_.:@-]{0,239}$/.test(value);
11
+ function interactiveAdmission(value) {
12
+ if (!object(value) ||
13
+ !exact(value, ['version', 'kind', 'sessionId', 'responseMessageId', 'generation']) ||
14
+ value.version !== 1 ||
15
+ value.kind !== 'interactive' ||
16
+ !text(value.sessionId) ||
17
+ !text(value.responseMessageId) ||
18
+ typeof value.generation !== 'string' ||
19
+ !/^[a-f0-9]{64}$/.test(value.generation))
20
+ throw new Error('PROBE_INTERACTIVE_ADMISSION_REQUIRED');
21
+ return { ...value };
22
+ }
23
+ function requireProbeNonce(nonce) {
24
+ if (!/^[a-f0-9]{32}$/.test(nonce))
25
+ throw new Error('PROBE_NONCE_INVALID');
26
+ }
27
+ function fixedCopilotCommand(nonce) {
28
+ requireProbeNonce(nonce);
29
+ return `printf '%s\\n' 'COPILOT-PROBE-${nonce}'`;
30
+ }
31
+ function copilotPlatformScratchDirectory(nonce) {
32
+ requireProbeNonce(nonce);
33
+ return `/tmp/osk-copilot-h9-${nonce}`;
34
+ }
35
+ /** Create a private, non-existing directory and remove it before reporting successful exit. */
36
+ function copilotPlatformScratchCommand(nonce) {
37
+ const scratch = copilotPlatformScratchDirectory(nonce);
38
+ const marker = `${scratch}/marker`;
39
+ return `(umask 077; mkdir -- '${scratch}' || exit; trap 'rm -f -- "${marker}"; rmdir -- "${scratch}"' EXIT; output=$(${fixedCopilotCommand(nonce)} | tee -- '${marker}') || exit; rm -- '${marker}' && rmdir -- '${scratch}' || exit; trap - EXIT; printf '%s\\n' "$output")`;
40
+ }
41
+ /** Constructed only after normal authenticated owner/grant/image/sole-Harness checks. */
42
+ class FixedCopilotPermission {
43
+ deadline;
44
+ now;
45
+ matchesOutput;
46
+ platformCopilotScratch;
47
+ admission;
48
+ command;
49
+ output;
50
+ claimed = null;
51
+ announced = null;
52
+ recorded = false;
53
+ completed = false;
54
+ failure = null;
55
+ stopped = false;
56
+ constructor(admission, nonce, deadline, now = Date.now, matchesOutput = (actual, expected) => actual === expected, platformCopilotScratch = false) {
57
+ this.deadline = deadline;
58
+ this.now = now;
59
+ this.matchesOutput = matchesOutput;
60
+ this.platformCopilotScratch = platformCopilotScratch;
61
+ this.admission = interactiveAdmission(admission);
62
+ this.command = platformCopilotScratch
63
+ ? copilotPlatformScratchCommand(nonce)
64
+ : fixedCopilotCommand(nonce);
65
+ this.output = `COPILOT-PROBE-${nonce}\n`;
66
+ if (!Number.isFinite(deadline) || deadline <= now() || deadline > now() + 120_000)
67
+ throw new Error('PROBE_DEADLINE_INVALID');
68
+ }
69
+ stop(reason = 'PROBE_CANCELLED') {
70
+ this.stopped = true;
71
+ this.failure ??= reason;
72
+ }
73
+ close() {
74
+ this.stopped = true;
75
+ }
76
+ get refused() {
77
+ return this.failure !== null;
78
+ }
79
+ /** The exact answered/admitted notice dismisses the prompt without proving execution. */
80
+ answerNotice(frame) {
81
+ const binding = frame.permissionBinding;
82
+ return (this.active() &&
83
+ !!this.claimed &&
84
+ (frame.reason === 'answered' ||
85
+ (frame.reason === 'response_admitted' && frame.executionConfirmed === false)) &&
86
+ frame.sessionId === this.admission.sessionId &&
87
+ frame.toolUseId === this.claimed.toolUseId &&
88
+ object(binding) &&
89
+ binding.epoch === this.admission.generation &&
90
+ binding.requestId === this.claimed.requestId);
91
+ }
92
+ refuse(reason) {
93
+ this.failure ??= reason;
94
+ return false;
95
+ }
96
+ active() {
97
+ return !this.stopped && !this.failure && this.now() < this.deadline;
98
+ }
99
+ tool(frame, observedStart = false) {
100
+ const input = frame.toolInput;
101
+ return (typeof frame.toolName === 'string' &&
102
+ /^(bash|Bash)$/.test(frame.toolName) &&
103
+ text(frame.toolUseId) &&
104
+ object(input) &&
105
+ input.command === this.command &&
106
+ (exact(input, ['command']) ||
107
+ (observedStart &&
108
+ this.platformCopilotScratch &&
109
+ exact(input, ['command', 'description']) &&
110
+ typeof input.description === 'string' &&
111
+ Buffer.byteLength(input.description) <= 256)));
112
+ }
113
+ /** Synchronous consumption happens BEFORE any asynchronous decision transport. */
114
+ decide(frame) {
115
+ if (!this.active())
116
+ return this.refuse('PROBE_CLOSED_OR_EXPIRED');
117
+ const context = frame.interactiveAdmission;
118
+ const binding = frame.permissionBinding;
119
+ if (frame.sessionId !== this.admission.sessionId ||
120
+ frame.purpose !== undefined ||
121
+ frame.runtimeElicitation !== undefined ||
122
+ frame.decisionStatus !== undefined ||
123
+ !this.tool(frame) ||
124
+ !object(context) ||
125
+ !exact(context, [
126
+ 'version',
127
+ 'kind',
128
+ 'sessionId',
129
+ 'responseMessageId',
130
+ 'generation',
131
+ 'requestId',
132
+ ]) ||
133
+ !object(binding) ||
134
+ !exact(binding, ['epoch', 'requestId']) ||
135
+ !text(binding.requestId) ||
136
+ context.version !== 1 ||
137
+ context.kind !== 'interactive' ||
138
+ context.sessionId !== this.admission.sessionId ||
139
+ context.responseMessageId !== this.admission.responseMessageId ||
140
+ context.generation !== this.admission.generation ||
141
+ binding.epoch !== this.admission.generation ||
142
+ context.requestId !== binding.requestId ||
143
+ typeof frame.timeoutAt !== 'number' ||
144
+ !Number.isFinite(frame.timeoutAt) ||
145
+ frame.timeoutAt <= this.now())
146
+ return this.refuse('PROBE_PERMISSION_MISMATCH');
147
+ if (this.claimed || (this.announced && this.announced !== frame.toolUseId))
148
+ return this.refuse('PROBE_ADDITIONAL_REQUEST');
149
+ this.claimed = { toolUseId: frame.toolUseId, requestId: binding.requestId };
150
+ return true;
151
+ }
152
+ decisionReceipt(frame, approved, receipt) {
153
+ if (!approved ||
154
+ !this.active() ||
155
+ !this.claimed ||
156
+ frame.toolUseId !== this.claimed.toolUseId ||
157
+ receipt.type !== 'permission.response_recorded' ||
158
+ receipt.duplicate === true ||
159
+ typeof receipt.status !== 'string' ||
160
+ !['recorded', 'admitted'].includes(receipt.status)) {
161
+ this.refuse('PROBE_DECISION_UNCONFIRMED');
162
+ return;
163
+ }
164
+ this.recorded = true; // A response receipt alone never sets completed.
165
+ }
166
+ observe(frame) {
167
+ if (typeof frame.type !== 'string') {
168
+ this.stop('PROBE_MALFORMED_EVENT');
169
+ return;
170
+ }
171
+ if (['stream.gap', 'transport.error', 'run.handed_over', 'text.reset'].includes(String(frame.type))) {
172
+ this.stop('PROBE_TRANSPORT_CONTEXT_LOST');
173
+ return;
174
+ }
175
+ if (!['tool.started', 'tool.completed', 'run.cancel_requested', 'permission.cancelled'].includes(String(frame.type)))
176
+ return;
177
+ if (frame.type === 'run.cancel_requested' || frame.type === 'permission.cancelled') {
178
+ this.stop();
179
+ return;
180
+ }
181
+ if (!this.active() || frame.sessionId !== this.admission.sessionId) {
182
+ this.refuse('PROBE_TOOL_CONTEXT_MISMATCH');
183
+ return;
184
+ }
185
+ if (frame.type === 'tool.started') {
186
+ if (!this.tool(frame, true) ||
187
+ this.announced ||
188
+ (this.claimed && this.claimed.toolUseId !== frame.toolUseId)) {
189
+ this.refuse('PROBE_UNEXPECTED_TOOL');
190
+ return;
191
+ }
192
+ this.announced = frame.toolUseId;
193
+ }
194
+ else {
195
+ if (this.completed ||
196
+ !this.claimed ||
197
+ this.announced !== this.claimed.toolUseId ||
198
+ frame.toolUseId !== this.claimed.toolUseId ||
199
+ typeof frame.toolName !== 'string' ||
200
+ !/^(bash|Bash)$/.test(frame.toolName) ||
201
+ frame.status !== 'completed' ||
202
+ !this.matchesOutput(frame.toolResponse, this.output)) {
203
+ this.refuse('PROBE_TOOL_RESULT_MISMATCH');
204
+ return;
205
+ }
206
+ this.completed = true;
207
+ }
208
+ }
209
+ result() {
210
+ return {
211
+ permissionRecorded: this.recorded,
212
+ toolVerified: this.completed && this.recorded && !this.failure,
213
+ failure: this.failure,
214
+ toolUseId: this.claimed?.toolUseId ?? null,
215
+ requestId: this.claimed?.requestId ?? null,
216
+ interactiveAdmission: this.admission,
217
+ autonomousRunClaimed: false,
218
+ autonomousAttemptClaimed: false,
219
+ approvalSource: 'exact-local-operator-rule',
220
+ };
221
+ }
222
+ }
223
+ exports.FixedCopilotPermission = FixedCopilotPermission;
@@ -61,6 +61,7 @@ import { buildManagedInferenceRelayCredential, startManagedInferenceBroker, type
61
61
  import { type ApiFetchOptions } from './api-fetch';
62
62
  import { type EngineExitOutcome } from './first-party-harness';
63
63
  import { type FirstPartyHarnessAgent } from './first-party-harness-agent';
64
+ import { type ManagedSmokeOperations } from './inference-overload-smoke-contract';
64
65
  /**
65
66
  * Reasons the server accepts for a release. An ALLOW-LIST on its side, mirrored
66
67
  * here as a type so a typo becomes a compile error rather than a silent
@@ -122,6 +123,8 @@ export interface ManagedSessionHandle {
122
123
  * process until the reaper notices. `reason` is what an operator greps.
123
124
  */
124
125
  stop(reason?: ManagedReleaseReason): Promise<void>;
126
+ /** Fixed diagnostic operations; the current session capability stays inside this factory. */
127
+ overloadSmoke?: ManagedSmokeOperations;
125
128
  }
126
129
  type FetchLike = (url: string, init: RequestInit) => Promise<Response>;
127
130
  export interface AcquireManagedSessionInput {
@@ -129,6 +132,8 @@ export interface AcquireManagedSessionInput {
129
132
  agentRef?: string;
130
133
  /** The model the user named to the engine, if any. */
131
134
  model?: string;
135
+ /** Optional normal admission selection; absence preserves the policy default. */
136
+ reasoningEffort?: string;
132
137
  env?: NodeJS.ProcessEnv;
133
138
  onLeaseRenewalStopped?: (reason: RenewalStopReason, detail?: string) => void;
134
139
  /**
@@ -87,6 +87,7 @@ const first_party_harness_1 = require("./first-party-harness");
87
87
  const first_party_harness_agent_1 = require("./first-party-harness-agent");
88
88
  const first_party_harness_managed_1 = require("./first-party-harness-managed");
89
89
  const task_execution_1 = require("./task-execution");
90
+ const inference_overload_smoke_contract_1 = require("./inference-overload-smoke-contract");
90
91
  const RELEASE_LEASE_RE = /\/+$/;
91
92
  /**
92
93
  * Harness selections the POLICY resolves, mirroring the server's own set.
@@ -334,6 +335,9 @@ async function acquireManagedSession(input = {}, deps = {}) {
334
335
  sessionId,
335
336
  sessionToken,
336
337
  model: input.model?.trim() || AUTOMATIC_MODEL,
338
+ ...(input.reasoningEffort !== undefined
339
+ ? { reasoningEffort: input.reasoningEffort }
340
+ : {}),
337
341
  localRuntimeId: (deps.localRuntimeId ?? localRuntimeId)(),
338
342
  // The hardware id every Daemon row is keyed on — the same function
339
343
  // the daemon calls — not the minted `~/.skrr/daemon.id` UUIDv7,
@@ -507,6 +511,55 @@ async function acquireManagedSession(input = {}, deps = {}) {
507
511
  await compensate(releaseModel, sessionToken);
508
512
  throw err;
509
513
  }
514
+ let stopping = false;
515
+ let smokeBeginClaimed = false, smokeFailed = false, smokeBatchPending = false, nextSmokeBatch = 0;
516
+ let smokeOperationId = null;
517
+ const smokePath = `${serverUrl.replace(RELEASE_LEASE_RE, '')}/api/agentic/sessions/${encodeURIComponent(sessionId)}/inference/diagnostics/overload-smoke`;
518
+ const smokeRequest = async (body, signal) => {
519
+ if (stopping && body.action !== 'receipt')
520
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError('SMOKE_SESSION_STOPPED');
521
+ const controller = new AbortController();
522
+ const timeout = setTimeout(() => controller.abort(), body.action === 'receipt' ? RELEASE_TIMEOUT_MS : 180000);
523
+ const abort = () => controller.abort();
524
+ signal?.addEventListener('abort', abort, { once: true });
525
+ if (signal?.aborted)
526
+ abort();
527
+ try {
528
+ const raw = await fetchImpl(smokePath, {
529
+ method: 'POST',
530
+ headers: {
531
+ Accept: 'application/json',
532
+ 'Content-Type': 'application/json',
533
+ Authorization: `Bearer ${sessionToken}`,
534
+ },
535
+ body: JSON.stringify(body),
536
+ signal: controller.signal,
537
+ redirect: 'error',
538
+ });
539
+ const response = await (0, inference_broker_1.boundedOverloadSmokeResponse)(raw, controller.signal);
540
+ if (!response.ok) {
541
+ // Read a fixed code only. Server/transport bodies can carry requests and credentials.
542
+ const data = (await response.json().catch(() => null));
543
+ const code = data?.code ?? data?.error?.code;
544
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError(typeof code === 'string' && /^[A-Za-z0-9_.:-]{1,96}$/.test(code)
545
+ ? code
546
+ : `SMOKE_HTTP_${response.status}`);
547
+ }
548
+ return await response.json();
549
+ }
550
+ catch (error) {
551
+ if (error instanceof inference_overload_smoke_contract_1.InferenceSmokeError)
552
+ throw error;
553
+ const code = error?.code;
554
+ if (typeof code === 'string' && /^SMOKE_[A-Z0-9_]{1,90}$/.test(code))
555
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError(code);
556
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError(controller.signal.aborted ? 'SMOKE_ABORTED' : 'SMOKE_OPERATION_UNKNOWN');
557
+ }
558
+ finally {
559
+ clearTimeout(timeout);
560
+ signal?.removeEventListener('abort', abort);
561
+ }
562
+ };
510
563
  return {
511
564
  env: session.env,
512
565
  socketPath: session.socketPath,
@@ -519,7 +572,52 @@ async function acquireManagedSession(input = {}, deps = {}) {
519
572
  leaseExpiresInMs: lease.leaseExpiresInMs,
520
573
  ...(lease.renewalWindowMs !== undefined ? { renewalWindowMs: lease.renewalWindowMs } : {}),
521
574
  ...(lease.ceilingAtMs !== undefined ? { ceilingAtMs: lease.ceilingAtMs } : {}),
575
+ overloadSmoke: {
576
+ begin: async (signal) => {
577
+ if (smokeBeginClaimed || stopping)
578
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError('SMOKE_BEGIN_ALREADY_CLAIMED');
579
+ smokeBeginClaimed = true;
580
+ try {
581
+ const begun = (0, inference_overload_smoke_contract_1.projectSmokeBegin)(await smokeRequest({ action: 'begin' }, signal));
582
+ smokeOperationId = begun.operationId;
583
+ return begun;
584
+ }
585
+ catch (error) {
586
+ smokeFailed = true;
587
+ throw error;
588
+ }
589
+ },
590
+ batch: async (operationId, index, signal) => {
591
+ if (!Number.isSafeInteger(index) ||
592
+ index < 0 ||
593
+ index >= 64 ||
594
+ operationId !== smokeOperationId ||
595
+ index !== nextSmokeBatch ||
596
+ smokeBatchPending ||
597
+ smokeFailed ||
598
+ stopping)
599
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError('SMOKE_BATCH_INDEX_INVALID');
600
+ smokeBatchPending = true;
601
+ nextSmokeBatch += 1;
602
+ try {
603
+ return (0, inference_overload_smoke_contract_1.projectSmokeBatch)(await smokeRequest({ action: 'batch', operationId, index }, signal), index);
604
+ }
605
+ catch (error) {
606
+ smokeFailed = true;
607
+ throw error;
608
+ }
609
+ finally {
610
+ smokeBatchPending = false;
611
+ }
612
+ },
613
+ receipt: async (operationId, signal) => {
614
+ if (operationId !== smokeOperationId)
615
+ throw new inference_overload_smoke_contract_1.InferenceSmokeError('SMOKE_OPERATION_MISMATCH');
616
+ return (0, inference_overload_smoke_contract_1.projectSmokeReceipt)(await smokeRequest({ action: 'receipt', operationId }, signal), operationId);
617
+ },
618
+ },
522
619
  stop: async (reason = 'cli_session_ended') => {
620
+ stopping = true;
523
621
  try {
524
622
  // The broker FIRST, because `stop()` stops the renewal loop: releasing
525
623
  // while a heartbeat is in flight risks the renewal re-extending the lease
@@ -822,6 +920,7 @@ signal) {
822
920
  },
823
921
  body: JSON.stringify({
824
922
  model: input.model,
923
+ ...(input.reasoningEffort !== undefined ? { reasoningEffort: input.reasoningEffort } : {}),
825
924
  localRuntimeId: input.localRuntimeId,
826
925
  machineUuid: input.machineUuid,
827
926
  }),
@@ -0,0 +1,63 @@
1
+ import { type AgenticStreamEvent, type EnvelopeReplayPage } from './agentic-stream';
2
+ export declare const H9_TURN_LABELS: readonly ["streaming", "toolCalls", "remember", "interrupt", "recall", "cancel"];
3
+ export type H9TurnLabel = (typeof H9_TURN_LABELS)[number];
4
+ export type H9Harness = 'pi' | 'copilot-sdk';
5
+ type Row = Record<string, any>;
6
+ /** Fixed prompts for the two reviewed platform qualification pairs. */
7
+ export declare function h9FixedPrompt(label: H9TurnLabel, nonce: string, harness?: H9Harness): string;
8
+ export type H9AcceptedScope = {
9
+ agentId: string;
10
+ harnessId: string;
11
+ harness: H9Harness;
12
+ workspaceId?: string;
13
+ daemonId: string;
14
+ conversationId?: string;
15
+ };
16
+ /** Actual normal HTTP acceptance, not a caller-provided session or permission context. */
17
+ export declare function validateH9Acceptance(accepted: Row, scope: H9AcceptedScope): import("./copilot-fixed-probe").InteractiveAdmission;
18
+ export interface H9StreamInput {
19
+ label: H9TurnLabel;
20
+ nonce: string;
21
+ accepted: Row;
22
+ scope: H9AcceptedScope;
23
+ deadline: number;
24
+ baseURL: string;
25
+ token: string;
26
+ replayEnvelopes: (from: number) => Promise<EnvelopeReplayPage>;
27
+ readResponseMessage?: () => Promise<unknown>;
28
+ onEvent: (event: AgenticStreamEvent) => void;
29
+ signal?: AbortSignal;
30
+ }
31
+ /**
32
+ * Internal transport seam only. The closed operator runner must establish owner, unused
33
+ * grant, exact image/runtime/model and per-turn financial barriers before calling this.
34
+ * The shared client is the ONLY permission responder. No generic approval/input option.
35
+ */
36
+ export declare function streamH9PlatformTurn(input: H9StreamInput): Promise<{
37
+ result: {
38
+ responseMessageId: string | undefined;
39
+ sessionId: string;
40
+ text: string;
41
+ status: "completed" | "aborted" | "failed";
42
+ repaired?: true;
43
+ permissionDenials?: string[];
44
+ lastEvent?: AgenticStreamEvent;
45
+ };
46
+ permission: {
47
+ permissionRecorded: boolean;
48
+ toolVerified: boolean;
49
+ failure: string | null;
50
+ toolUseId: string | null;
51
+ requestId: string | null;
52
+ interactiveAdmission: import("./copilot-fixed-probe").InteractiveAdmission;
53
+ autonomousRunClaimed: boolean;
54
+ autonomousAttemptClaimed: boolean;
55
+ approvalSource: string;
56
+ } | null;
57
+ cancelRequestedAtMs: null;
58
+ successful: boolean;
59
+ refusal: null;
60
+ providerAbsenceClaimed: boolean;
61
+ financialSettlementClaimed: boolean;
62
+ }>;
63
+ export {};