runcloud 0.2.226 → 0.2.228
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.
- package/dist/commands/goals.js +43 -0
- package/dist/commands/sandbox.js +32 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/runcloud-0.2.228.tgz +0 -0
- package/runcloud-0.2.226.tgz +0 -0
package/dist/commands/goals.js
CHANGED
|
@@ -96,6 +96,15 @@ function output(value, options) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
const repeat = (value, previous) => [...previous, value];
|
|
99
|
+
export function parseEvidenceNumber(text) {
|
|
100
|
+
const match = /^([^=]+)=\s*(null|[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?)(?:\s+(\S.*))?$/.exec(text.trim());
|
|
101
|
+
if (!match)
|
|
102
|
+
throw new Error(`--evidence must look like "label=value[ unit]", got "${text}".`);
|
|
103
|
+
const value = match[2] === 'null' ? null : Number(match[2]);
|
|
104
|
+
if (value !== null && !Number.isFinite(value))
|
|
105
|
+
throw new Error('--evidence value must be finite.');
|
|
106
|
+
return { label: match[1].trim(), value, ...(match[3] ? { unit: match[3].trim() } : {}) };
|
|
107
|
+
}
|
|
99
108
|
const segment = encodeURIComponent;
|
|
100
109
|
const pathFor = (goalId, suffix = '') => `${GOAL_SYNC_API}/goals/${segment(goalId)}${suffix}`;
|
|
101
110
|
async function findGoal(context, identifier) {
|
|
@@ -261,6 +270,40 @@ export function registerGoals(program, dependencies = {}) {
|
|
|
261
270
|
.option('--report-file <path>', 'existing authored report JSON to deliver when this turn stops')
|
|
262
271
|
.action(run(async (context, options, [goalId]) => deliverStoppedGoalReport(context, goalId, JSON.parse(readFileSync(options.file === '-' ? 0 : String(options.file), 'utf8')), { sessionId: options.session, turnId: options.turn,
|
|
263
272
|
...(options.reportFile ? { report: JSON.parse(readFileSync(String(options.reportFile), 'utf8')) } : {}) })));
|
|
273
|
+
goals.command('assess <goal>').description('Record an agent assessment: on_track, stalled or reframe, with evidence numbers')
|
|
274
|
+
.requiredOption('--verdict <verdict>', 'on_track, stalled or reframe').requiredOption('--why <text>', 'at most three sentences')
|
|
275
|
+
.requiredOption('--evidence <label=value[ unit]>', 'a number behind the verdict, e.g. "p90=265400 milliseconds"; repeat', repeat, [])
|
|
276
|
+
.requiredOption('--session <id>', 'your agent session ID')
|
|
277
|
+
.action(run(async (context, options, [identifier]) => {
|
|
278
|
+
if (!['on_track', 'stalled', 'reframe'].includes(String(options.verdict)))
|
|
279
|
+
throw new Error('--verdict must be on_track, stalled or reframe.');
|
|
280
|
+
if (!options.evidence.length)
|
|
281
|
+
throw new Error('Give at least one --evidence number.');
|
|
282
|
+
const goal = await findGoal(context, identifier);
|
|
283
|
+
return context.client.post(pathFor(goal.id, '/assessments'), { verdict: options.verdict, why: options.why,
|
|
284
|
+
evidence: options.evidence.map(parseEvidenceNumber), sessionId: options.session });
|
|
285
|
+
}));
|
|
286
|
+
goals.command('suggest <goal>').description('Open the goal\'s single reframe suggestion from a JSON file (format: newly-cli/docs/goal-sync.md)')
|
|
287
|
+
.requiredOption('--file <path>', 'reframe JSON: proposal, why, evidence, expectedEffect, author; - reads stdin')
|
|
288
|
+
.action(run(async (context, options, [identifier]) => {
|
|
289
|
+
const goal = await findGoal(context, identifier);
|
|
290
|
+
return context.client.post(pathFor(goal.id, '/suggestions'), JSON.parse(readFileSync(options.file === '-' ? 0 : String(options.file), 'utf8')));
|
|
291
|
+
}));
|
|
292
|
+
const suggestion = goals.command('suggestion').description('Comment on, withdraw, or (humans only) accept or decline a reframe suggestion');
|
|
293
|
+
suggestion.command('comment <suggestion>').requiredOption('--body <text>', 'what the evidence shows')
|
|
294
|
+
.requiredOption('--evidence <ref>', 'observation ID, PR, log or query reference; repeat', repeat, []).requiredOption('--session <id>', 'your agent session ID')
|
|
295
|
+
.action(run(async (context, options, [id]) => {
|
|
296
|
+
if (!options.evidence.length)
|
|
297
|
+
throw new Error('Give at least one --evidence reference.');
|
|
298
|
+
return context.client.post(`${GOAL_SYNC_API}/suggestions/${segment(id)}/comments`, { body: options.body, evidence: options.evidence, sessionId: options.session });
|
|
299
|
+
}));
|
|
300
|
+
suggestion.command('withdraw <suggestion>').description('Withdraw your own open suggestion')
|
|
301
|
+
.action(run((context, _options, [id]) => context.client.post(`${GOAL_SYNC_API}/suggestions/${segment(id)}/withdraw`, {})));
|
|
302
|
+
for (const action of ['accept', 'decline']) {
|
|
303
|
+
suggestion.command(`${action} <suggestion>`).description(`${action === 'accept' ? 'Accept into a new goal version' : 'Decline'} (signed-in humans only; agents are refused)`)
|
|
304
|
+
.requiredOption('--reason <text>', 'why; required, and kept on the goal history')
|
|
305
|
+
.action(run((context, options, [id]) => context.client.post(`${GOAL_SYNC_API}/suggestions/${segment(id)}/${action}`, { reason: options.reason })));
|
|
306
|
+
}
|
|
264
307
|
const decision = goals.command('decision').description('Propose changes and record authenticated human decisions');
|
|
265
308
|
decision.command('propose <goal>').requiredOption('--action <action>', 'start-exploration, pivot, stop, or reallocate')
|
|
266
309
|
.requiredOption('--reason <text>', 'evidence and reason for this decision').option('--bet <text>', 'proposed replacement bet')
|
package/dist/commands/sandbox.js
CHANGED
|
@@ -238,6 +238,28 @@ function metricSparkline(values) {
|
|
|
238
238
|
.map((value) => blocks[Math.min(blocks.length - 1, Math.floor((Math.max(0, value) / max) * (blocks.length - 1)))])
|
|
239
239
|
.join('');
|
|
240
240
|
}
|
|
241
|
+
const COST_METER_LABELS = {
|
|
242
|
+
cpu: 'CPU',
|
|
243
|
+
cpu_burst: 'CPU (burst)',
|
|
244
|
+
memory: 'Memory',
|
|
245
|
+
};
|
|
246
|
+
const COST_UNIT_LABELS = { vcpu_second: 'vCPU-s', gib_second: 'GiB-s' };
|
|
247
|
+
export function renderSandboxCost(cost) {
|
|
248
|
+
const nanoUsd = (nanodollars) => {
|
|
249
|
+
const value = BigInt(nanodollars);
|
|
250
|
+
const fraction = (value % 1000000000n).toString().padStart(9, '0').replace(/0+$/, '');
|
|
251
|
+
return `$${value / 1000000000n}${fraction ? `.${fraction}` : ''}`;
|
|
252
|
+
};
|
|
253
|
+
const lines = cost.lines.map((line) => ` ${(COST_METER_LABELS[line.meter] ?? line.meter).padEnd(12)} ${nanoUsd(line.nanodollars).padStart(12)} ${line.quantity} ${COST_UNIT_LABELS[line.unit] ?? line.unit}`);
|
|
254
|
+
const state = cost.status === 'final'
|
|
255
|
+
? `final${cost.availableUntil ? ` · kept until ${cost.availableUntil}` : ''}`
|
|
256
|
+
: 'accruing (still running or being metered)';
|
|
257
|
+
return [
|
|
258
|
+
`Sandbox cost · ${cost.sandboxId} · ${state}`,
|
|
259
|
+
...lines,
|
|
260
|
+
` ${'Total'.padEnd(12)} ${nanoUsd(cost.totalNanodollars).padStart(12)}`,
|
|
261
|
+
].join('\n');
|
|
262
|
+
}
|
|
241
263
|
export function renderSandboxMetrics(id, metrics) {
|
|
242
264
|
const point = metrics.current;
|
|
243
265
|
if (!point)
|
|
@@ -523,6 +545,16 @@ export function registerSandbox(program) {
|
|
|
523
545
|
await new Promise((resolveDelay) => setTimeout(resolveDelay, opts.interval * 1_000));
|
|
524
546
|
}
|
|
525
547
|
}));
|
|
548
|
+
withOutput(sandbox
|
|
549
|
+
.command('cost')
|
|
550
|
+
.description('Show what a sandbox has been billed, per meter (kept 30 days after it ends)')
|
|
551
|
+
.argument('<id>', 'sandbox id')).action((id, opts) => run(async () => {
|
|
552
|
+
const cost = (await runCloudApi().get(`/run-cloud/sandboxes/${encodeURIComponent(id)}/cost`));
|
|
553
|
+
if (opts.json)
|
|
554
|
+
printJson(cost);
|
|
555
|
+
else
|
|
556
|
+
console.log(renderSandboxCost(cost));
|
|
557
|
+
}));
|
|
526
558
|
const secrets = withOutput(sandbox
|
|
527
559
|
.command('secrets')
|
|
528
560
|
.description('Show what secrets a sandbox holds (names and origins, never values)')
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = '0.2.
|
|
1
|
+
export const CLI_VERSION = '0.2.228';
|
package/package.json
CHANGED
|
Binary file
|
package/runcloud-0.2.226.tgz
DELETED
|
Binary file
|