@drisp/cli 0.7.10 → 0.7.11

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.
@@ -8,7 +8,7 @@ import {
8
8
  installWorkflowPlugins,
9
9
  resolveWorkflow,
10
10
  writeGlobalConfig
11
- } from "./chunk-FYXEDUQ6.js";
11
+ } from "./chunk-XITT6UQX.js";
12
12
  import "./chunk-G3PMV62Z.js";
13
13
 
14
14
  // src/setup/steps/WorkflowInstallWizard.tsx
@@ -93,4 +93,4 @@ function WorkflowInstallWizard({ source, onDone }) {
93
93
  export {
94
94
  WorkflowInstallWizard as default
95
95
  };
96
- //# sourceMappingURL=WorkflowInstallWizard-FKASDA6N.js.map
96
+ //# sourceMappingURL=WorkflowInstallWizard-UVNJCK72.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runMachineRunners
3
- } from "./chunk-ISH6VEYL.js";
3
+ } from "./chunk-YHXTTSJE.js";
4
4
 
5
5
  // src/app/entry/runnerDaemon.ts
6
6
  if (process.argv.includes("--help")) {
@@ -13,4 +13,4 @@ if (process.argv.includes("--help")) {
13
13
  process.exitCode = 1;
14
14
  });
15
15
  }
16
- //# sourceMappingURL=chunk-OORYDPD6.js.map
16
+ //# sourceMappingURL=chunk-RSJVWETP.js.map
@@ -21223,7 +21223,10 @@ import path6 from "path";
21223
21223
  // src/core/build/strings.ts
21224
21224
  var BUILD_STRINGS = {
21225
21225
  approvalQuestion: "Start building these issues?",
21226
- budgetPark: "This Build used its token budget. Stop it, then Build again to continue with a new budget.",
21226
+ /** How a token park opens; the app tells the park by it (root ADR-0011). */
21227
+ tokenParkLead: "This Build used its token budget.",
21228
+ /** How a tick-allowance park opens: more budget will not help, so the app offers Stop only. */
21229
+ tickParkLead: "This Build used its tick allowance.",
21227
21230
  templatePark: "Drisp was updated during this Build. Build again to re-plan.",
21228
21231
  notStarted: "Not started",
21229
21232
  waiting: "Waiting for child Runs.",
@@ -21241,8 +21244,23 @@ var BUILD_STRINGS = {
21241
21244
  workflowUnavailable: (identifier) => `The Runner has not listed the Workflow for ${identifier} yet.`,
21242
21245
  completedUnmerged: "The Run completed but its pull request is not merged and the issue is not Done in Linear.",
21243
21246
  hubUnreachable: (identifier) => `Drisp could not reach the Hub to start ${identifier}.`,
21244
- startRefused: (code) => `The Hub refused to start this issue's Run (${code}).`
21247
+ startRefused: (code) => `The Hub refused to start this issue's Run (${code}).`,
21248
+ /** The token park: what the Build used of its budget and what the next issue needs. */
21249
+ tokenPark: (park) => `${BUILD_STRINGS.tokenParkLead} Used ${tokens(park.used)} of ${tokens(park.tokenBudget)}, and the next issue, ${park.identifier}, is forecast at ${tokens(park.forecast)}.`,
21250
+ /** The token park when the Hub refused a start this CLI's own check allowed: the Hub counted more than it did. */
21251
+ tokenParkRefused: (identifier, forecast) => `${BUILD_STRINGS.tokenParkLead} The Hub refused to start the next issue, ${identifier}, forecast at ${tokens(forecast)}.`,
21252
+ /** The tick-allowance park: more budget will not help, so the app offers Stop only. */
21253
+ tickPark: (allowance) => `${BUILD_STRINGS.tickParkLead} The Orchestrator ran ${allowance} ticks. More budget will not help. Stop it, then Build again.`
21245
21254
  };
21255
+ function tokens(count) {
21256
+ const compact = (value, unit) => {
21257
+ const tenths = Math.round(value * 10) / 10;
21258
+ return `${Number.isInteger(tenths) ? tenths : tenths.toFixed(1)}${unit}`;
21259
+ };
21260
+ if (count >= 1e6) return compact(count / 1e6, "M");
21261
+ if (count >= 1e3) return compact(count / 1e3, "K");
21262
+ return String(count);
21263
+ }
21246
21264
  var GATES = [
21247
21265
  {
21248
21266
  title: "Explore",
@@ -22450,7 +22468,7 @@ function budgetTokens(memory) {
22450
22468
  function runUsage(memory) {
22451
22469
  const counted = budgetTokens(memory);
22452
22470
  if (counted === null) return null;
22453
- const whole = (tokens) => Number.isFinite(tokens) ? Math.min(Math.max(0, Math.round(tokens)), Number.MAX_SAFE_INTEGER) : 0;
22471
+ const whole = (tokens2) => Number.isFinite(tokens2) ? Math.min(Math.max(0, Math.round(tokens2)), Number.MAX_SAFE_INTEGER) : 0;
22454
22472
  return {
22455
22473
  counted: whole(counted),
22456
22474
  cacheRead: whole(memory.usage?.cacheRead ?? 0)
@@ -22523,8 +22541,8 @@ function readRestartContract(content, limit = DEFAULT_RESTART_TOKENS, expectedRu
22523
22541
  return null;
22524
22542
  if (expectedRunId && !text.split("\n").some((line) => line.trim() === `Run: ${expectedRunId}`))
22525
22543
  return null;
22526
- const tokens = estimateTokenCount(text);
22527
- return tokens <= limit ? { text, tokens } : null;
22544
+ const tokens2 = estimateTokenCount(text);
22545
+ return tokens2 <= limit ? { text, tokens: tokens2 } : null;
22528
22546
  }
22529
22547
  function restartInstructions(journalPath, runId, limit = DEFAULT_RESTART_TOKENS) {
22530
22548
  return `Maintain one ## Restart section in the Journal at ${journalPath} during this Workflow Run. Include Run: ${runId}, followed by these nonempty fields: ${fields.join(", ")}. Use none where appropriate. Update it after orientation and each meaningful work checkpoint, before large reads or risky operations; keep it within ${limit} estimated tokens. Preserve essential constraints and reference supporting evidence. Write changes atomically so interruption cannot leave a partial checkpoint. The Runner may replace your Agent Session at its context bound using only this section. Do not stop to request a Handover; continue working and declare the normal terminal marker when done.`;
@@ -24384,4 +24402,4 @@ export {
24384
24402
  compileWorkflowPlan,
24385
24403
  collectMcpServersWithOptions
24386
24404
  };
24387
- //# sourceMappingURL=chunk-FYXEDUQ6.js.map
24405
+ //# sourceMappingURL=chunk-XITT6UQX.js.map
@@ -56,7 +56,7 @@ import {
56
56
  verifyRendered,
57
57
  wakesFreshAfterHandover,
58
58
  workflowRegistryDir
59
- } from "./chunk-FYXEDUQ6.js";
59
+ } from "./chunk-XITT6UQX.js";
60
60
  import {
61
61
  __commonJS,
62
62
  __toESM
@@ -13086,6 +13086,19 @@ function classOfCap(declaredCap) {
13086
13086
  function forecastOfCap(declaredCap) {
13087
13087
  return SIZE_CLASS_FORECASTS[classOfCap(declaredCap)];
13088
13088
  }
13089
+ function attemptForecast(declaredCap) {
13090
+ const forecast = forecastOfCap(declaredCap);
13091
+ return declaredCap > 0 ? Math.min(declaredCap, forecast) : forecast;
13092
+ }
13093
+ function attemptCost(attempt) {
13094
+ const forecast = attemptForecast(attempt.tokenCap);
13095
+ if (attempt.closed) return attempt.spent ?? forecast;
13096
+ return Math.max(forecast, attempt.spent ?? 0);
13097
+ }
13098
+ function budgetCheck(input) {
13099
+ const used = input.attempts.reduce((sum, attempt) => sum + attemptCost(attempt), 0);
13100
+ return { used, fits: used + input.next <= input.tokenBudget };
13101
+ }
13089
13102
  var classCalibrationSchema = external_exports.strictObject({
13090
13103
  S: external_exports.strictObject({ forecast: external_exports.number(), runs: external_exports.number() }).optional(),
13091
13104
  M: external_exports.strictObject({ forecast: external_exports.number(), runs: external_exports.number() }).optional(),
@@ -13332,6 +13345,16 @@ var commandSchema = external_exports.strictObject({
13332
13345
  kind: external_exports.literal("resume"),
13333
13346
  interruptionId: id,
13334
13347
  guidance: external_exports.string().max(131072).optional()
13348
+ }),
13349
+ /**
13350
+ * A member rewrites an Orchestrator's `delegation.tokenBudget` (root ADR-0011), never below what its children
13351
+ * used. With `resume`, a parked Orchestrator with no live child is resumed when the value is strictly greater.
13352
+ * Hub-only: never delivered to a Runner.
13353
+ */
13354
+ external_exports.strictObject({
13355
+ kind: external_exports.literal("setBudget"),
13356
+ tokenBudget: delegationSchema.shape.tokenBudget,
13357
+ resume: external_exports.boolean().optional()
13335
13358
  })
13336
13359
  ])
13337
13360
  });
@@ -14924,7 +14947,7 @@ async function restoreCheckpoint(store, input) {
14924
14947
 
14925
14948
  // ../../modules/runtime/src/software-version.ts
14926
14949
  import "fs";
14927
- var runnerSoftwareVersion = true ? "0.7.10" : JSON.parse(readFileSync2(new URL("../../../apps/cli/package.json", import.meta.url), "utf8")).version;
14950
+ var runnerSoftwareVersion = true ? "0.7.11" : JSON.parse(readFileSync2(new URL("../../../apps/cli/package.json", import.meta.url), "utf8")).version;
14928
14951
 
14929
14952
  // ../../modules/runtime/src/connection.ts
14930
14953
  var runnerCapabilities = [
@@ -22171,7 +22194,8 @@ export {
22171
22194
  RUN_EXIT_CODE,
22172
22195
  localAnswerDecision,
22173
22196
  runExec,
22174
- forecastOfCap,
22197
+ attemptForecast,
22198
+ budgetCheck,
22175
22199
  calibrationSchema,
22176
22200
  repositoryBindingSchema,
22177
22201
  commandSchema,
@@ -22231,4 +22255,4 @@ export {
22231
22255
  runMachineRunners,
22232
22256
  writeIdentityOnce
22233
22257
  };
22234
- //# sourceMappingURL=chunk-ISH6VEYL.js.map
22258
+ //# sourceMappingURL=chunk-YHXTTSJE.js.map
package/dist/cli.js CHANGED
@@ -10,8 +10,10 @@ import {
10
10
  ServiceNotEnabledError,
11
11
  approvalAnswer,
12
12
  attachRuntimeEventLoop,
13
+ attemptForecast,
13
14
  behindMain,
14
15
  bootstrapRuntimeConfig,
16
+ budgetCheck,
15
17
  buildApiKeyHelperSettings,
16
18
  buildPhaseFeedEvent,
17
19
  buildPlanSchema,
@@ -49,7 +51,6 @@ import {
49
51
  finalizePlan,
50
52
  fit,
51
53
  fitAnsi,
52
- forecastOfCap,
53
54
  forgetRunner,
54
55
  formatClock,
55
56
  formatProbeCommand,
@@ -143,7 +144,7 @@ import {
143
144
  visualPositionToOffset,
144
145
  wrapText,
145
146
  writeIdentityOnce
146
- } from "./chunk-ISH6VEYL.js";
147
+ } from "./chunk-YHXTTSJE.js";
147
148
  import {
148
149
  generateId as generateId2
149
150
  } from "./chunk-PQIB66SG.js";
@@ -202,7 +203,7 @@ import {
202
203
  workflowRegistryDir,
203
204
  writeGlobalConfig,
204
205
  writeProjectConfig
205
- } from "./chunk-FYXEDUQ6.js";
206
+ } from "./chunk-XITT6UQX.js";
206
207
  import {
207
208
  __toESM
208
209
  } from "./chunk-G3PMV62Z.js";
@@ -14269,7 +14270,7 @@ function buildLimits(own, delegation) {
14269
14270
  return {
14270
14271
  ...own,
14271
14272
  maxChildren: Math.min(own.maxChildren, delegation.maxChildren),
14272
- tokenBudget: Math.min(own.tokenBudget, delegation.tokenBudget)
14273
+ tokenBudget: delegation.tokenBudget
14273
14274
  };
14274
14275
  }
14275
14276
  function occupies(view) {
@@ -14314,8 +14315,8 @@ function assessTick(facts) {
14314
14315
  ].sort((a, b) => a.n - b.n);
14315
14316
  }
14316
14317
  }
14317
- for (const attempts of Object.values(state.attempts))
14318
- for (const attempt of attempts) {
14318
+ for (const attempts2 of Object.values(state.attempts))
14319
+ for (const attempt of attempts2) {
14319
14320
  const view = views.get(attempt.runId);
14320
14321
  if (view?.closed && !attempt.outcome) attempt.outcome = outcomeOf(view);
14321
14322
  }
@@ -14341,8 +14342,8 @@ function assessTick(facts) {
14341
14342
  const repair = [];
14342
14343
  const repaired = new Set(state.repaired ?? []);
14343
14344
  for (const entry of entries) {
14344
- const attempts = attemptsOf(entry.id);
14345
- const newest = attempts.at(-1);
14345
+ const attempts2 = attemptsOf(entry.id);
14346
+ const newest = attempts2.at(-1);
14346
14347
  const view = newest && views.get(newest.runId);
14347
14348
  const linear = issues.get(entry.id)?.state.type;
14348
14349
  const statusOf = () => {
@@ -14374,7 +14375,7 @@ function assessTick(facts) {
14374
14375
  if (newest?.outcome === "template_mismatch") return "replan";
14375
14376
  if (newest?.outcome === "completed")
14376
14377
  state.needsPerson[entry.id] ??= entry.profile === "investigation" ? "The investigation ended without marking its accepted findings Done in Linear. Review its evidence." : BUILD_STRINGS.completedUnmerged;
14377
- if (state.needsPerson[entry.id] || newest && !mayRetry(attempts))
14378
+ if (state.needsPerson[entry.id] || newest && !mayRetry(attempts2))
14378
14379
  return "needs_person";
14379
14380
  const blockers = [
14380
14381
  .../* @__PURE__ */ new Set([
@@ -14399,22 +14400,43 @@ function assessTick(facts) {
14399
14400
  delete state.needsPerson[entry.id];
14400
14401
  }
14401
14402
  if (repaired.size > 0) state.repaired = [...repaired];
14402
- let parkReason = facts.templateVersion !== state.templateVersion ? "template" : state.tickCount >= facts.limits.tickAllowance ? "budget" : void 0;
14403
+ const tokenBudget = facts.limits.tokenBudget;
14404
+ const attempts = [
14405
+ ...facts.children.map((view) => ({
14406
+ tokenCap: view.parent?.tokenCap ?? Number.NaN,
14407
+ closed: view.closed
14408
+ })),
14409
+ ...Object.values(state.attempts).flat().filter((attempt) => !views.has(attempt.runId)).map((attempt) => ({ tokenCap: attempt.tokenCap, closed: false }))
14410
+ ];
14411
+ let park = facts.templateVersion !== state.templateVersion ? { reason: "template", message: BUILD_STRINGS.templatePark } : state.tickCount >= facts.limits.tickAllowance ? {
14412
+ reason: "ticks",
14413
+ message: BUILD_STRINGS.tickPark(facts.limits.tickAllowance)
14414
+ } : void 0;
14403
14415
  const occupying = entries.filter((entry) => {
14404
14416
  const newest = attemptsOf(entry.id).at(-1);
14405
14417
  return newest !== void 0 && occupies(views.get(newest.runId));
14406
14418
  }).length;
14407
14419
  const queue = [];
14408
- if (!parkReason) {
14409
- let committed = Object.values(state.attempts).flat().reduce((sum, attempt) => sum + forecastOfCap(attempt.tokenCap), 0);
14420
+ if (!park) {
14421
+ const admitted = [...attempts];
14410
14422
  for (const entry of entries) {
14411
14423
  if (status.get(entry.id) !== "ready") continue;
14412
- if (committed + forecastOfCap(entry.tokenCap) > facts.limits.tokenBudget) {
14413
- parkReason = "budget";
14424
+ const next = attemptForecast(entry.tokenCap);
14425
+ const check = budgetCheck({ tokenBudget, attempts: admitted, next });
14426
+ if (!check.fits) {
14427
+ park = {
14428
+ reason: "tokens",
14429
+ message: BUILD_STRINGS.tokenPark({
14430
+ used: check.used,
14431
+ tokenBudget,
14432
+ identifier: entry.identifier,
14433
+ forecast: next
14434
+ })
14435
+ };
14414
14436
  break;
14415
14437
  }
14416
14438
  queue.push(entry);
14417
- committed += forecastOfCap(entry.tokenCap);
14439
+ admitted.push({ tokenCap: entry.tokenCap, closed: false });
14418
14440
  }
14419
14441
  }
14420
14442
  return {
@@ -14423,7 +14445,7 @@ function assessTick(facts) {
14423
14445
  repair,
14424
14446
  queue,
14425
14447
  slots: Math.max(0, facts.limits.maxChildren - occupying),
14426
- ...parkReason ? { parkReason } : {}
14448
+ ...park ? { park } : {}
14427
14449
  };
14428
14450
  }
14429
14451
  function tickAction(input) {
@@ -14433,12 +14455,7 @@ function tickAction(input) {
14433
14455
  const remaining = input.entries.some(
14434
14456
  (entry) => ["ready", "pending"].includes(input.status.get(entry.id))
14435
14457
  );
14436
- if (input.parkReason && remaining)
14437
- return {
14438
- action: "park",
14439
- reason: input.parkReason,
14440
- message: input.parkReason === "budget" ? BUILD_STRINGS.budgetPark : BUILD_STRINGS.templatePark
14441
- };
14458
+ if (input.park && remaining) return { action: "park", ...input.park };
14442
14459
  if (live.length > 0) return { action: "wait" };
14443
14460
  const done = input.entries.filter(
14444
14461
  (entry) => input.status.get(entry.id) === "done"
@@ -14580,7 +14597,7 @@ async function runBuildTick(deps) {
14580
14597
  state: stored,
14581
14598
  children: children.runs,
14582
14599
  templateVersion,
14583
- // The approved plan's budget (the member's, once it is editable) narrowed by what the Hub enforces.
14600
+ // The Hub Run's budget, read each tick (a member may change it); the plan's binds only a Run without delegation.
14584
14601
  limits: buildLimits(
14585
14602
  { ...ORCHESTRATOR_LIMITS, tokenBudget: plan.budget.tokenBudget },
14586
14603
  parent.delegation
@@ -14591,7 +14608,7 @@ async function runBuildTick(deps) {
14591
14608
  now: deps.now().toISOString()
14592
14609
  });
14593
14610
  const { state, status } = assessment;
14594
- let parkReason = assessment.parkReason;
14611
+ let park = assessment.park;
14595
14612
  const record = () => {
14596
14613
  writeFile(statePath, json(state));
14597
14614
  const files = [path7.join(relativePlanDir, "build-state.json")];
@@ -14689,7 +14706,13 @@ async function runBuildTick(deps) {
14689
14706
  reason: BUILD_STRINGS.hubUnreachable(entry.identifier)
14690
14707
  });
14691
14708
  else if (result.kind === "budget") {
14692
- parkReason = "budget";
14709
+ park = {
14710
+ reason: "tokens",
14711
+ message: BUILD_STRINGS.tokenParkRefused(
14712
+ entry.identifier,
14713
+ attemptForecast(entry.tokenCap)
14714
+ )
14715
+ };
14693
14716
  break;
14694
14717
  } else {
14695
14718
  state.needsPerson[entry.id] = BUILD_STRINGS.startRefused(result.code);
@@ -14728,7 +14751,7 @@ async function runBuildTick(deps) {
14728
14751
  status,
14729
14752
  children: children.runs,
14730
14753
  started,
14731
- ...parkReason ? { parkReason } : {}
14754
+ ...park ? { park } : {}
14732
14755
  });
14733
14756
  }
14734
14757
  function locate(deps, entry, branchName) {
@@ -16346,7 +16369,7 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
16346
16369
  await exitWith(1);
16347
16370
  return;
16348
16371
  }
16349
- const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-FKASDA6N.js");
16372
+ const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-UVNJCK72.js");
16350
16373
  const { waitUntilExit } = render(
16351
16374
  /* @__PURE__ */ jsx24(
16352
16375
  WorkflowInstallWizard,
@@ -1,6 +1,6 @@
1
- import "./chunk-OORYDPD6.js";
2
- import "./chunk-ISH6VEYL.js";
1
+ import "./chunk-RSJVWETP.js";
2
+ import "./chunk-YHXTTSJE.js";
3
3
  import "./chunk-PQIB66SG.js";
4
- import "./chunk-FYXEDUQ6.js";
4
+ import "./chunk-XITT6UQX.js";
5
5
  import "./chunk-G3PMV62Z.js";
6
6
  //# sourceMappingURL=dashboard-daemon.js.map
package/dist/runner.js CHANGED
@@ -1,6 +1,6 @@
1
- import "./chunk-OORYDPD6.js";
2
- import "./chunk-ISH6VEYL.js";
1
+ import "./chunk-RSJVWETP.js";
2
+ import "./chunk-YHXTTSJE.js";
3
3
  import "./chunk-PQIB66SG.js";
4
- import "./chunk-FYXEDUQ6.js";
4
+ import "./chunk-XITT6UQX.js";
5
5
  import "./chunk-G3PMV62Z.js";
6
6
  //# sourceMappingURL=runner.js.map
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "hooks",
18
18
  "dashboard"
19
19
  ],
20
- "version": "0.7.10",
20
+ "version": "0.7.11",
21
21
  "license": "MIT",
22
22
  "bin": {
23
23
  "athena": "dist/cli.js",