@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,261 @@
1
+ /** Fixed synthetic inference smoke contract. No caller-configurable workload or authority. */
2
+ export const OVERLOAD_SMOKE_PLAN = Object.freeze({
3
+ version: 1, total: 128, baseline: 32, mixedNative: 32, nativeCount: 64, batch: 64,
4
+ durationMs: 180000, nativeSpacingMs: 2100, maxOutputTokens: 16, maxInputUnits: 1024,
5
+ maxResponseBytes: 65536, nativeOrdinalWaitMs: 10000, nativeOrdinalPollMs: 250,
6
+ alias: 'claude-haiku-4-5', nativeModel: 'anthropic/claude-haiku-4-5',
7
+ purpose: 'utility.diagnostics.overload', feature: 'inference-overload-smoke',
8
+ providerExposurePerSendUsd: 0.0023184,
9
+ });
10
+ const LIMITS = OVERLOAD_SMOKE_PLAN;
11
+ const ALIAS = OVERLOAD_SMOKE_PLAN.alias;
12
+ export function overloadSmokeError(code) {
13
+ return Object.assign(new Error(code), { code });
14
+ }
15
+ const refusal = overloadSmokeError;
16
+ /** utf8_bytes_json_v1 input bound, not provider token usage. API parity controls hold this
17
+ * equal to the existing authoritative native accounting strategy for these fixed JSON bodies. */
18
+ export function countAnthropicSmokeInputUnits(body) {
19
+ let serialized;
20
+ try {
21
+ serialized = JSON.stringify(body);
22
+ }
23
+ catch {
24
+ throw refusal('SMOKE_WIRE_CHANGED');
25
+ }
26
+ if (!serialized)
27
+ throw refusal('SMOKE_WIRE_CHANGED');
28
+ let containers = 0;
29
+ const pending = [body];
30
+ while (pending.length) {
31
+ const value = pending.pop();
32
+ if (Array.isArray(value)) {
33
+ containers += 1 + value.length;
34
+ pending.push(...value);
35
+ }
36
+ else if (value && typeof value === 'object') {
37
+ containers += 1;
38
+ pending.push(...Object.values(value));
39
+ }
40
+ }
41
+ return Buffer.byteLength(serialized, 'utf8') + 256 + containers * 4;
42
+ }
43
+ function integer(value) {
44
+ return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0;
45
+ }
46
+ export function overloadSmokePrompt(index) {
47
+ if (!Number.isSafeInteger(index) || index < 0 || index >= 128)
48
+ throw refusal('SMOKE_INDEX_INVALID');
49
+ return `Reply only OK. OSK24476 synthetic probe ${String(index).padStart(3, '0')}.`;
50
+ }
51
+ export function overloadSmokeNativePayload(index, modelSelector = ALIAS) {
52
+ if (!Number.isSafeInteger(index) || index < 0 || index >= 64)
53
+ throw refusal('SMOKE_INDEX_INVALID');
54
+ return {
55
+ model: modelSelector,
56
+ max_tokens: LIMITS.maxOutputTokens,
57
+ stream: true,
58
+ messages: [{ role: 'user', content: overloadSmokePrompt(index) }],
59
+ };
60
+ }
61
+ export function boundedOverloadSmokeBody(body, expectedPrompt) {
62
+ const allowed = new Set([
63
+ 'model',
64
+ 'max_tokens',
65
+ 'messages',
66
+ 'stream',
67
+ 'temperature',
68
+ 'top_p',
69
+ 'top_k',
70
+ 'stop_sequences',
71
+ 'thinking',
72
+ ]);
73
+ if (!body ||
74
+ Object.keys(body).some((key) => !allowed.has(key)) ||
75
+ ![ALIAS, OVERLOAD_SMOKE_PLAN.nativeModel].includes(body.model) ||
76
+ body.max_tokens !== LIMITS.maxOutputTokens ||
77
+ body.messages?.length !== 1 ||
78
+ body.messages[0].role !== 'user' ||
79
+ body.tools != null ||
80
+ body.system != null ||
81
+ body.output_config != null ||
82
+ (body.thinking != null &&
83
+ (body.thinking.type !== 'disabled' || Object.keys(body.thinking).length !== 1)))
84
+ throw refusal('SMOKE_WIRE_CHANGED');
85
+ const content = body.messages[0].content;
86
+ const text = typeof content === 'string'
87
+ ? content
88
+ : Array.isArray(content) &&
89
+ content.length === 1 &&
90
+ content[0].type === 'text' &&
91
+ Object.keys(content[0]).every((key) => ['type', 'text'].includes(key))
92
+ ? content[0].text
93
+ : null;
94
+ if (text !== expectedPrompt)
95
+ throw refusal('SMOKE_WIRE_CHANGED');
96
+ const units = countAnthropicSmokeInputUnits(body);
97
+ if (units > LIMITS.maxInputUnits)
98
+ throw refusal('SMOKE_INPUT_BOUND');
99
+ return units;
100
+ }
101
+ function checkedUsage(usage) {
102
+ const input = usage?.input_tokens ?? usage?.inputTokens ?? usage?.input;
103
+ const output = usage?.output_tokens ?? usage?.outputTokens ?? usage?.output;
104
+ if (!integer(input) ||
105
+ !integer(output) ||
106
+ input > LIMITS.maxInputUnits ||
107
+ output > LIMITS.maxOutputTokens ||
108
+ usage.cache_creation_input_tokens ||
109
+ usage.cache_read_input_tokens)
110
+ throw refusal('SMOKE_USAGE_UNKNOWN');
111
+ return { input, output };
112
+ }
113
+ /** Consume the real native Messages stream; retain metadata only, never generated text. */
114
+ export async function readOverloadSmokeNativeReceipt(upstream, signal, now, started) {
115
+ if (upstream.status !== 200)
116
+ throw refusal(`SMOKE_NATIVE_HTTP_${upstream.status}`);
117
+ const reader = upstream.body?.getReader();
118
+ if (!reader)
119
+ throw refusal('SMOKE_NATIVE_STREAM_MISSING');
120
+ let buffer = '';
121
+ let bytes = 0;
122
+ let firstByteMs = null;
123
+ let stopped = false;
124
+ let stopReason = null;
125
+ let input = null;
126
+ let output = null;
127
+ let responseId = null;
128
+ let reportedModel = null;
129
+ const decoder = new TextDecoder();
130
+ const consume = (frame) => {
131
+ const data = frame
132
+ .split(/\r?\n/)
133
+ .filter((line) => line.startsWith('data:'))
134
+ .map((line) => line.slice(5).trim())
135
+ .join('\n');
136
+ if (!data)
137
+ return;
138
+ let event;
139
+ try {
140
+ event = JSON.parse(data);
141
+ }
142
+ catch {
143
+ throw refusal('SMOKE_NATIVE_STREAM_INVALID');
144
+ }
145
+ if (event.type === 'message_start') {
146
+ if (input !== null)
147
+ throw refusal('SMOKE_NATIVE_MULTIPLE_RESPONSES');
148
+ const usage = checkedUsage({
149
+ ...event.message?.usage,
150
+ output_tokens: event.message?.usage?.output_tokens ?? 0,
151
+ });
152
+ input = usage.input;
153
+ output = usage.output;
154
+ responseId = typeof event.message?.id === 'string' && /^msg[-_A-Za-z0-9:.]{1,188}$/.test(event.message.id) ? event.message.id : null;
155
+ reportedModel = typeof event.message?.model === 'string' && /^(?:anthropic\/)?claude-haiku-4-5(?:-20251001)?$/.test(event.message.model) ? event.message.model : null;
156
+ }
157
+ if (event.type === 'message_delta') {
158
+ if (!integer(event.usage?.output_tokens))
159
+ throw refusal('SMOKE_USAGE_UNKNOWN');
160
+ output = event.usage.output_tokens;
161
+ stopReason = event.delta?.stop_reason;
162
+ }
163
+ if (event.type === 'message_stop')
164
+ stopped = true;
165
+ if (event.type === 'error' ||
166
+ (event.type === 'content_block_start' && event.content_block?.type === 'tool_use'))
167
+ throw refusal('SMOKE_NATIVE_UNEXPECTED_WORK');
168
+ };
169
+ const onAbort = () => {
170
+ void reader.cancel().catch(() => { });
171
+ };
172
+ signal.addEventListener('abort', onAbort, { once: true });
173
+ try {
174
+ while (true) {
175
+ if (signal.aborted)
176
+ throw signal.reason || refusal('SMOKE_ABORTED');
177
+ const chunk = await reader.read();
178
+ if (chunk.done)
179
+ break;
180
+ if (chunk.value.byteLength === 0)
181
+ continue;
182
+ if (firstByteMs === null)
183
+ firstByteMs = now() - started;
184
+ bytes += chunk.value.byteLength;
185
+ if (bytes > LIMITS.maxResponseBytes)
186
+ throw refusal('SMOKE_RESPONSE_BOUND');
187
+ buffer += decoder.decode(chunk.value, { stream: true });
188
+ let match;
189
+ while ((match = /\r?\n\r?\n/.exec(buffer))) {
190
+ consume(buffer.slice(0, match.index));
191
+ buffer = buffer.slice(match.index + match[0].length);
192
+ }
193
+ }
194
+ if (signal.aborted)
195
+ throw signal.reason || refusal('SMOKE_ABORTED');
196
+ if (buffer.trim())
197
+ consume(buffer);
198
+ if (!stopped ||
199
+ !['end_turn', 'max_tokens'].includes(stopReason || '') ||
200
+ !responseId ||
201
+ !/^msg[-_A-Za-z0-9:.]{1,188}$/.test(responseId) ||
202
+ !/^(?:anthropic\/)?claude-haiku-4-5(?:-20251001)?$/.test(reportedModel || ''))
203
+ throw refusal('SMOKE_NATIVE_INCOMPLETE');
204
+ return {
205
+ tokens: checkedUsage({ input_tokens: input, output_tokens: output }),
206
+ responseId,
207
+ reportedModel,
208
+ firstByteMs,
209
+ };
210
+ }
211
+ catch (error) {
212
+ const failure = error instanceof Error ? error : refusal("SMOKE_NATIVE_STREAM_INVALID");
213
+ Object.assign(failure, { observed: {
214
+ input: integer(input) ? input : null,
215
+ output: integer(output) ? output : null,
216
+ responseId,
217
+ reportedModel,
218
+ firstByteMs,
219
+ } });
220
+ throw failure;
221
+ }
222
+ finally {
223
+ signal.removeEventListener('abort', onAbort);
224
+ await reader.cancel().catch(() => { });
225
+ }
226
+ }
227
+ export async function boundedOverloadSmokeResponse(response, signal) {
228
+ const reader = response.body?.getReader();
229
+ if (!reader)
230
+ throw refusal('SMOKE_RESPONSE_MISSING');
231
+ const chunks = [];
232
+ let size = 0;
233
+ const abort = () => {
234
+ void reader.cancel().catch(() => { });
235
+ };
236
+ signal.addEventListener('abort', abort, { once: true });
237
+ try {
238
+ while (true) {
239
+ if (signal.aborted)
240
+ throw signal.reason || refusal('SMOKE_ABORTED');
241
+ const { value, done } = await reader.read();
242
+ if (done)
243
+ break;
244
+ size += value.byteLength;
245
+ if (size > LIMITS.maxResponseBytes)
246
+ throw refusal('SMOKE_RESPONSE_BOUND');
247
+ chunks.push(Buffer.from(value));
248
+ }
249
+ if (signal.aborted)
250
+ throw signal.reason || refusal('SMOKE_ABORTED');
251
+ return new Response(new Uint8Array(Buffer.concat(chunks)), {
252
+ status: response.status,
253
+ statusText: response.statusText,
254
+ headers: response.headers,
255
+ });
256
+ }
257
+ finally {
258
+ signal.removeEventListener('abort', abort);
259
+ await reader.cancel().catch(() => { });
260
+ }
261
+ }