@aragon-agent/cli 0.6.48 → 0.6.49

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 (70) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/agent/controller.d.ts +21 -0
  3. package/dist/agent/controller.js +35 -8
  4. package/dist/agent/governance-wiring.d.ts +2 -0
  5. package/dist/agent/governance-wiring.js +4 -0
  6. package/dist/app/App.d.ts +2 -4
  7. package/dist/app/App.js +207 -511
  8. package/dist/cli.js +2 -150
  9. package/dist/commands/catalog.d.ts +17 -0
  10. package/dist/commands/catalog.js +52 -0
  11. package/dist/commands/create-registry.d.ts +13 -0
  12. package/dist/commands/create-registry.js +19 -0
  13. package/dist/commands/governance-command.js +5 -1
  14. package/dist/commands/skills.js +18 -67
  15. package/dist/config/env.d.ts +2 -0
  16. package/dist/config/env.js +1 -1
  17. package/dist/fast/review-call.d.ts +6 -0
  18. package/dist/fast/review-call.js +10 -0
  19. package/dist/governance/engine/budget.d.ts +18 -6
  20. package/dist/governance/engine/budget.js +61 -19
  21. package/dist/governance/engine/engine-core.d.ts +8 -0
  22. package/dist/governance/engine/engine-core.js +29 -9
  23. package/dist/governance/engine/engine.d.ts +1 -0
  24. package/dist/governance/engine/engine.js +9 -10
  25. package/dist/governance/engine/inspector.js +4 -3
  26. package/dist/governance/engine/lifecycle.js +4 -2
  27. package/dist/governance/engine/report.js +7 -1
  28. package/dist/governance/engine/run-digest.js +2 -1
  29. package/dist/governance/engine/stage-runner.js +1 -1
  30. package/dist/governance/engine/submissions.d.ts +2 -0
  31. package/dist/governance/engine/submissions.js +22 -3
  32. package/dist/governance/engine/visibility.d.ts +10 -0
  33. package/dist/governance/engine/visibility.js +28 -0
  34. package/dist/governance/rules/settlement.d.ts +7 -0
  35. package/dist/governance/rules/settlement.js +24 -0
  36. package/dist/governance/tools/shared-tools.d.ts +2 -0
  37. package/dist/governance/tools/shared-tools.js +15 -1
  38. package/dist/governance/tools/submit-tools.js +14 -7
  39. package/dist/host/commands.d.ts +18 -0
  40. package/dist/host/commands.js +30 -0
  41. package/dist/host/controller-factory.d.ts +109 -0
  42. package/dist/host/controller-factory.js +159 -0
  43. package/dist/host/controller-feed.d.ts +122 -0
  44. package/dist/host/controller-feed.js +356 -0
  45. package/dist/host/index-build.d.ts +23 -0
  46. package/dist/host/index-build.js +35 -0
  47. package/dist/host/index.d.ts +21 -0
  48. package/dist/host/index.js +21 -0
  49. package/dist/host/interaction.d.ts +58 -0
  50. package/dist/host/interaction.js +165 -0
  51. package/dist/host/logging.d.ts +7 -0
  52. package/dist/host/logging.js +7 -0
  53. package/dist/host/prompts.d.ts +10 -0
  54. package/dist/host/prompts.js +9 -0
  55. package/dist/host/sessions.d.ts +87 -0
  56. package/dist/host/sessions.js +234 -0
  57. package/dist/host/settings.d.ts +104 -0
  58. package/dist/host/settings.js +235 -0
  59. package/dist/host/skills.d.ts +19 -0
  60. package/dist/host/skills.js +38 -0
  61. package/dist/skills/command-names.d.ts +19 -0
  62. package/dist/skills/command-names.js +28 -0
  63. package/dist/skills/invoke.d.ts +38 -0
  64. package/dist/skills/invoke.js +65 -0
  65. package/dist/team/overseer.d.ts +25 -1
  66. package/dist/team/overseer.js +38 -1
  67. package/dist/team/runtime.d.ts +2 -0
  68. package/dist/team/runtime.js +10 -7
  69. package/dist/team/subagent.js +2 -4
  70. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ were written.
8
8
  ## Unreleased
9
9
 
10
10
  ### Changed
11
+ - **Internal: the controller/feed glue now lives in `src/host/`, shared with the desktop app.** `makeController`, the
12
+ session checkpoint writer and the ten controller-event-to-view-action subscriptions that used to be inline in
13
+ `cli.tsx` and `app/App.tsx` moved into Ink-free modules (`host/controller-factory.ts`, `host/controller-feed.ts`),
14
+ and `App.tsx` calls them. **Nothing you can see or type changes**; the full suite and the case ledger are the proof.
15
+ New Ink-free facades (`host/settings|sessions|prompts|logging`, `host/interaction`) exist for the Electron app and
16
+ are covered by their own tests. `PROVIDER_ENV_KEYS` is now exported from `config/env.ts`.
11
17
  - **Internal: the terminal interface moved to its own package, `@aragon-agent/tui`.** The Ink
12
18
  components, terminal input handling, the scrollback renderer and the view model that `aragon`
13
19
  draws from are no longer part of this package's source; they are published as
@@ -606,6 +606,21 @@ export declare class AgentController {
606
606
  /** Return the opaque ID used by the view to match Core's acceptance receipt. */
607
607
  queueUserMessage(text: string): string;
608
608
  private enqueueSteering;
609
+ /**
610
+ * Withdraw a queued user message by the id `queueUserMessage` returned.
611
+ *
612
+ * The ENGINE QUEUE is the single authority: `removeQueuedSteering` answers whether the
613
+ * envelope was still waiting. `false` means Core already took it, so the message IS being
614
+ * delivered and the caller must say so rather than pretend. Synchronous, no `await`, so the
615
+ * decision and the map delete cannot interleave with a drain.
616
+ *
617
+ * Deliberately NOT rolled back: the `skills.absorbPendingFrames()` and `userAttention.notify()`
618
+ * that `enqueueSteering` ran. The former already merged pending skill frames into the run and
619
+ * the latter is only a "the user did something" signal; reversing either would need an inverse
620
+ * in two subsystems for an edge case. `pendingUserSteering` IS cleared, otherwise `continue()`
621
+ * would resurrect the withdrawn text into the next user turn.
622
+ */
623
+ withdrawQueuedUserMessage(id: string): 'withdrawn' | 'delivered' | 'unknown';
609
624
  followUp(text: string): void;
610
625
  /** Resume queued input without appending a duplicate user message. */
611
626
  continue(): Promise<PromptOutcome>;
@@ -707,6 +722,12 @@ export declare class AgentController {
707
722
  setGovernanceConfig(patch: Partial<GovernanceConfig>): GovernanceConfig;
708
723
  /** `submit_plan` approval: PLAN+GOVERN hands over to the team, plain PLAN goes to BUILD. */
709
724
  private onPlanApproved;
725
+ /**
726
+ * What the FAST tier (the supervisor, the reviewer) costs per token, or undefined when the
727
+ * tier is off or its model is unpriced (never $0.00). One authority for the team task report
728
+ * and for the governance ledger, so the two cannot disagree on whether fast spend has a price.
729
+ */
730
+ private fastTierModelCost;
710
731
  /** What a team child costs per token, or undefined for an unpriced model (never $0.00). */
711
732
  private teamModelCost;
712
733
  /**
@@ -476,6 +476,7 @@ export class AgentController {
476
476
  withHumanWait: (fn) => this.withHumanWait(fn),
477
477
  hasApiKey: () => this.hasApiKey(),
478
478
  modelCost: () => this.teamModelCost(),
479
+ fastModelCost: () => this.fastTierModelCost(),
479
480
  getRuntime: () => this.teamRuntime,
480
481
  });
481
482
  // THE LAUNCH POSTURE (`--govern` / `--plan-govern`, governance-mode 11.2). Only when the
@@ -805,14 +806,7 @@ export class AgentController {
805
806
  // resolution and the unknown-pricing predicate the fast
806
807
  // reviewer already uses: undefined prices as `pricing
807
808
  // unknown`, never as $0.00 (C-11 / RV-4).
808
- fastModelCost: () => {
809
- const tier = this.fast?.getTier();
810
- if (!tier || !tier.ok)
811
- return undefined;
812
- return this.isPricedModel(tier.ref)
813
- ? this.getModelInfoFor(tier.ref).cost
814
- : undefined;
815
- },
809
+ fastModelCost: () => this.fastTierModelCost(),
816
810
  withPausedWatchdog: (fn) => this.withPausedWatchdog(fn),
817
811
  }),
818
812
  ]
@@ -1609,6 +1603,28 @@ export class AgentController {
1609
1603
  this.userAttention.notify();
1610
1604
  return id;
1611
1605
  }
1606
+ /**
1607
+ * Withdraw a queued user message by the id `queueUserMessage` returned.
1608
+ *
1609
+ * The ENGINE QUEUE is the single authority: `removeQueuedSteering` answers whether the
1610
+ * envelope was still waiting. `false` means Core already took it, so the message IS being
1611
+ * delivered and the caller must say so rather than pretend. Synchronous, no `await`, so the
1612
+ * decision and the map delete cannot interleave with a drain.
1613
+ *
1614
+ * Deliberately NOT rolled back: the `skills.absorbPendingFrames()` and `userAttention.notify()`
1615
+ * that `enqueueSteering` ran. The former already merged pending skill frames into the run and
1616
+ * the latter is only a "the user did something" signal; reversing either would need an inverse
1617
+ * in two subsystems for an edge case. `pendingUserSteering` IS cleared, otherwise `continue()`
1618
+ * would resurrect the withdrawn text into the next user turn.
1619
+ */
1620
+ withdrawQueuedUserMessage(id) {
1621
+ if (!this.pendingUserSteering.has(id))
1622
+ return 'unknown';
1623
+ if (!this.agent.removeQueuedSteering(id))
1624
+ return 'delivered';
1625
+ this.pendingUserSteering.delete(id);
1626
+ return 'withdrawn';
1627
+ }
1612
1628
  followUp(text) {
1613
1629
  this.agent.followUp(text);
1614
1630
  }
@@ -1857,6 +1873,17 @@ export class AgentController {
1857
1873
  }
1858
1874
  this.setAgentMode('build', { force: true });
1859
1875
  }
1876
+ /**
1877
+ * What the FAST tier (the supervisor, the reviewer) costs per token, or undefined when the
1878
+ * tier is off or its model is unpriced (never $0.00). One authority for the team task report
1879
+ * and for the governance ledger, so the two cannot disagree on whether fast spend has a price.
1880
+ */
1881
+ fastTierModelCost() {
1882
+ const tier = this.fast?.getTier();
1883
+ if (!tier || !tier.ok)
1884
+ return undefined;
1885
+ return this.isPricedModel(tier.ref) ? this.getModelInfoFor(tier.ref).cost : undefined;
1886
+ }
1860
1887
  /** What a team child costs per token, or undefined for an unpriced model (never $0.00). */
1861
1888
  teamModelCost() {
1862
1889
  const resolution = this.subagentModelResolution();
@@ -45,6 +45,8 @@ export interface WiringDeps {
45
45
  withHumanWait: <T>(fn: () => Promise<T>) => Promise<T>;
46
46
  hasApiKey: () => boolean;
47
47
  modelCost: () => ModelCost | undefined;
48
+ /** The fast tier's price (the supervisor runs there); undefined = unknown, never the team's. */
49
+ fastModelCost?: () => ModelCost | undefined;
48
50
  getRuntime: () => TeamRuntimeLike | null;
49
51
  env?: Readonly<Record<string, string | undefined>>;
50
52
  now?: () => number;
@@ -315,6 +315,9 @@ export class GovernanceWiring {
315
315
  withPausedWatchdog: (fn) => this.deps.withPausedWatchdog(fn),
316
316
  hasApiKey: () => this.deps.hasApiKey(),
317
317
  modelCost: () => this.deps.modelCost(),
318
+ ...(this.deps.fastModelCost
319
+ ? { fastModelCost: () => this.deps.fastModelCost?.() }
320
+ : {}),
318
321
  takeApprovedPlan: () => this.takeApprovedPlan(),
319
322
  confirmCharter: (charter, signal) => this.confirmCharter(charter, signal),
320
323
  now: this.deps.now ?? Date.now,
@@ -454,6 +457,7 @@ export class GovernanceWiring {
454
457
  submitWork: (id, input) => e().submitWork(id, input),
455
458
  submitReview: (id, input) => e().submitReview(id, input),
456
459
  submitTest: (id, input) => e().submitTest(id, input),
460
+ rejectInvalid: (id, input, text) => e().rejectInvalid(id, input, text),
457
461
  inspectorApply: (input) => e().inspectorApply(input),
458
462
  inspectorRule: (input) => e().inspectorRule(input),
459
463
  inspectorSettle: (input) => e().inspectorSettle(input),
package/dist/app/App.d.ts CHANGED
@@ -7,7 +7,6 @@
7
7
  import React from 'react';
8
8
  import type { ScrollbarBridge } from '@aragon-agent/tui/ui/scrollbar-controller';
9
9
  import type { AgentController } from '../agent/controller.js';
10
- import type { ConfirmRequest } from '../tools/index.js';
11
10
  import { type Entry, type Overlay, type ToastLevel } from '@aragon-agent/tui/model/agent/reducer';
12
11
  import type { UpdateBridge } from '@aragon-agent/tui/model/update/types';
13
12
  import { type ScrollbackBridge } from '@aragon-agent/tui/ui/scrollback/use-scrollback-view';
@@ -19,9 +18,8 @@ import type { BranchCommandPort } from '../commands/branch-command.js';
19
18
  import type { SessionIdentity } from '../session/startup-session.js';
20
19
  import type { SelectionBridge } from '@aragon-agent/tui/ui/selection/selection-controller';
21
20
  import type { HumanInputBridge } from '@aragon-agent/tui/model/tools/human-input';
22
- export interface ConfirmBridge {
23
- handler: ((req: ConfirmRequest) => Promise<boolean>) | null;
24
- }
21
+ import type { ConfirmBridge } from '../host/controller-factory.js';
22
+ export type { ConfirmBridge };
25
23
  /** What the settings screen's `Max tokens` field resolved to. */
26
24
  export interface SettingsMaxTokens {
27
25
  /** Pushed into the live controller. `undefined` is AUTO. */