runcloud 0.2.225 → 0.2.227

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.
@@ -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')
@@ -180,6 +180,7 @@ export function hostReport(host, canonical, extra, diagnoses, now, fleetTtl, dee
180
180
  operation: operation ? { operationId: safeFleetText(operation.operationId), kind: safeFleetText(operation.kind), component: safeFleetText(operation.component),
181
181
  phase: safeFleetText(operation.phase), status: safeFleetText(operation.status), progress: num(operation.progress), updatedAt: stamp(operation.updatedAt), owner: safeFleetText(operation.owner),
182
182
  ...observation(operation.updatedAt, now, 60, operation.stale), error: safeFleetText(operation.error) } : null },
183
+ parking: { savesAppState: admissionObservation.state === 'fresh' && typeof canonical.parkedSessions === 'boolean' ? canonical.parkedSessions : null },
183
184
  capacity: role === 'jenkins' ? null : pick(capacity, ['clean', 'leased', 'installing', 'dirty', 'preparing', 'recycling', 'total']),
184
185
  capacityObservation: capacitySource === host ? { source: 'hosted', ...hostedObservation(host, now, fleetTtl) } : {
185
186
  source: 'shared', ...observation(extra.observedAt, now, context.operatorTtl ?? 120, extra.collectorError)
@@ -297,8 +297,11 @@ function printReport(report, json) {
297
297
  return;
298
298
  }
299
299
  console.log(`${report.generatedAt}: ${report.summary.hosts} hosts, ${report.summary.cpu.freshHosts} fresh CPU samples; mean ${report.summary.cpu.meanBusyPercent?.toFixed(1) ?? 'unknown'}%.`);
300
- for (const host of report.hosts)
300
+ for (const host of report.hosts) {
301
301
  console.log(host.diagnosis);
302
+ if (host.parking.savesAppState === false)
303
+ console.log(`${host.id}: app state saving is OFF; users leased here lose their app data.`);
304
+ }
302
305
  console.log(`Matching failure rows: ${report.failures.length}. Event window ${report.eventCoverage.complete ? 'fully read' : 'incomplete'} (${report.eventCoverage.rowsRead} rows).`);
303
306
  for (const failure of report.failures)
304
307
  console.log(`${failure.timestamp ?? 'time missing'} ${failure.code ?? failure.type ?? 'failure'} host=${failure.hostId ?? 'unknown'} device=${failure.deviceId ?? 'unknown'} providerSession=${failure.providerSessionId ?? 'unknown'}; ${failure.correlation.causation}`);
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = '0.2.225';
1
+ export const CLI_VERSION = '0.2.227';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runcloud",
3
- "version": "0.2.225",
3
+ "version": "0.2.227",
4
4
  "description": "Create and control run.cloud remote mobile simulators and cloud sandboxes",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
Binary file
Binary file