@zergai/ztc 0.20.0-beta.1 → 0.21.0-beta.1

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 (43) hide show
  1. package/bin/zmux-darwin-arm64 +0 -0
  2. package/bin/ztc-audio-darwin-arm64 +0 -0
  3. package/bin/ztc-capture-darwin-arm64 +0 -0
  4. package/bin/ztc-tui-darwin-arm64 +0 -0
  5. package/bin/zterm-darwin-arm64 +2 -2
  6. package/dist/agent/commands/config.js +7 -1
  7. package/dist/agent/commands/model.js +9 -5
  8. package/dist/agent/commands/models.js +2 -4
  9. package/dist/agent/commands/provider.d.ts +12 -0
  10. package/dist/agent/commands/provider.js +38 -2
  11. package/dist/agent/commands/provider_selection.d.ts +24 -1
  12. package/dist/agent/commands/provider_selection.js +70 -36
  13. package/dist/agent/commands/runtime_model.d.ts +11 -2
  14. package/dist/agent/commands/runtime_model.js +23 -5
  15. package/dist/agent/commands/settings.js +12 -3
  16. package/dist/agent/commands/types.d.ts +24 -4
  17. package/dist/app/runtime_choices.d.ts +78 -1
  18. package/dist/app/runtime_choices.js +229 -0
  19. package/dist/app/runtime_choices_source.d.ts +45 -0
  20. package/dist/app/runtime_choices_source.js +127 -0
  21. package/dist/app/selection_completion.js +1 -14
  22. package/dist/cli_ratatui.d.ts +94 -16
  23. package/dist/cli_ratatui.js +510 -124
  24. package/dist/config/provider_models.d.ts +15 -0
  25. package/dist/config/provider_models.js +28 -0
  26. package/dist/config.d.ts +114 -4
  27. package/dist/config.js +306 -62
  28. package/dist/headless.js +13 -5
  29. package/dist/panes/pane_registry.d.ts +16 -1
  30. package/dist/panes/pane_registry.js +17 -0
  31. package/dist/panes/types.d.ts +14 -0
  32. package/dist/panes/ztc_launch.d.ts +3 -0
  33. package/dist/panes/ztc_launch.js +10 -7
  34. package/dist/simulation/toolkit/dynamic_meetings.d.ts +2 -2
  35. package/dist/simulation/toolkit/dynamic_story_review.d.ts +3 -3
  36. package/dist/ui/ratatui/pane_relay.d.ts +22 -1
  37. package/dist/ui/ratatui/pane_relay.js +57 -6
  38. package/dist/ui/ratatui/protocol.d.ts +97 -1
  39. package/dist/ui/ratatui/protocol.js +136 -6
  40. package/dist/utils/router_catalog_facts.d.ts +3 -0
  41. package/dist/utils/router_catalog_facts.js +14 -0
  42. package/dist/zlm-embed.mjs +275 -52
  43. package/package.json +16 -16
@@ -211,6 +211,23 @@ export declare class RatatuiApp {
211
211
  private desktopTaskSignature;
212
212
  private desktopTaskState;
213
213
  private runtimeMutationInFlight;
214
+ /** What this pane's header menus list, gathered from cached state (see runtimeChoicesFor); made when first needed. */
215
+ private runtimeChoicesSource;
216
+ /** Stops marking the lists stale on saved settings; set with the source. */
217
+ private stopFollowingChoiceSettings;
218
+ /** Stops telling ConfigStore the directory this pane works in (ConfigStore.followRouteDirectory). */
219
+ private stopFollowingRouteDirectory;
220
+ private readonly runtimeChoicesPublication;
221
+ private publishedRuntimeChoices;
222
+ private runtimeChoicesBuiltAt;
223
+ /** Set when what the lists show may have changed (a switch, a saved setting, discovery); the next sync rebuilds them. */
224
+ private runtimeChoicesStale;
225
+ /** The models this pane ran with each provider, for its model menu's Recent group and a switch back to a provider. */
226
+ private readonly paneModels;
227
+ /** Slash commands running now; while any runs, the profile isn't reloaded under it (see refreshSettingsFromElsewhere). */
228
+ private commandsRunning;
229
+ /** Runtime changes nested in one another, each holding runtimeMutationInFlight (see withRuntimeMutation). */
230
+ private runtimeMutationDepth;
214
231
  private accountReloadPending;
215
232
  private runtimeAccounts;
216
233
  private runtimeUsage;
@@ -459,10 +476,6 @@ export declare class RatatuiApp {
459
476
  private pendingPaneReplacements;
460
477
  private paneRegistry;
461
478
  private resumedPaneSpecs;
462
- /** Overseer-only model override from the web mirror dropdown.
463
- * Stored separately from configStore CLI overrides so it doesn't
464
- * leak to new child panes (which should use configStore.getModel()). */
465
- private overseerModelOverride;
466
479
  private paneMode;
467
480
  /**
468
481
  * Another ZTC launched this one into one of its panes (ZTC_PARENT_PID or ZTC_COLONY_CHILD, see launchedByAnotherZtc):
@@ -568,10 +581,55 @@ export declare class RatatuiApp {
568
581
  private runtimeSwitchBlockedReason;
569
582
  private reloadAccountAgent;
570
583
  private applyAccountOperation;
584
+ /**
585
+ * Bring in what another ZTC on this profile saved since this one read it (a default chosen in another pane, a key,
586
+ * a Router login), unless a command or a runtime change is running here, which may still save its own settings.
587
+ * This pane keeps the route it runs on (ConfigStore.refreshIfChangedElsewhere). True when the profile was reloaded.
588
+ */
589
+ private refreshSettingsFromElsewhere;
571
590
  private refreshRuntimeProjection;
572
591
  private currentRuntimeUsage;
573
592
  private desktopRuntimeProjection;
593
+ /**
594
+ * The lists this pane's header menus show, for a renderer that draws them (desktop_runtime_choices_v1), and never for
595
+ * a hosted runtime. They are rebuilt from cached state on the 5 s tick, or at once after a switch, a saved setting or
596
+ * discovery; their revision moves only when they change (RuntimeChoicesPublication). Undefined sends none.
597
+ */
598
+ private runtimeChoicesFor;
599
+ private ensureRuntimeChoicesSource;
600
+ /** The route this pane runs on, as its header shows it; routed when it goes through Zerg Router. */
601
+ private currentPaneRoute;
602
+ /** What new panes start on, and whether that goes through Zerg Router. */
603
+ private newPaneChoice;
604
+ /** This pane runs its current model with its provider: a switch back to that provider lands on it. */
605
+ private rememberPaneModel;
606
+ private runtimeChoicePane;
574
607
  private handleDesktopRuntimeAction;
608
+ /**
609
+ * Run `change` as a runtime change: agent turns and the queue wait while it runs (runAgent, handleSubmit), the
610
+ * desktop app greys out the runtime controls, and pending work runs once it ends. Changes nest: a pane switch inside
611
+ * a picker holds the flag until the picker ends.
612
+ */
613
+ private withRuntimeMutation;
614
+ /**
615
+ * The actions a pane header's menus send (desktop_runtime_choices_v1), which zterm sends only for a pane whose state
616
+ * carries `runtime_choices`. Each is checked against this pane's session and owner; a choice also against the lists
617
+ * it was made from: the lists' revision up to the state's current one (a newer state with the same lists still
618
+ * holds them).
619
+ */
620
+ private handleRuntimeChoiceAction;
621
+ /**
622
+ * A header's provider or model choice, for this pane alone. Settings another pane saved meanwhile (a key, a login)
623
+ * count, and the choice is checked again against the lists as they are now; then it applies as /provider would,
624
+ * asking for a missing key or login in this pane, and finishing once it is saved.
625
+ */
626
+ private selectPaneRuntime;
627
+ /** "Use for new panes": this pane's route becomes the default, as /provider would set it. */
628
+ private saveRouteAsDefault;
629
+ /** Router's catalog and the pane's provider's models again, as a menu asks; the lists follow as they load. */
630
+ private refreshRuntimeChoices;
631
+ /** A header's "Log in to Zerg Router…": the login runs in this pane, which shows its code; the lists follow. */
632
+ private runRouterLogin;
575
633
  /**
576
634
  * The model chip's picker: a provider first, Zerg Router's from the cached catalog whatever this pane's route, then
577
635
  * the person's own keys, and then that provider's models (see pickProviderAndModel). Nothing new crosses the wire,
@@ -749,6 +807,15 @@ export declare class RatatuiApp {
749
807
  private buildZtcCommand;
750
808
  private createZtcPaneSpec;
751
809
  private registerPaneSpec;
810
+ /**
811
+ * A child ZTC's report of its own pane, relayed: its runtime names the provider and model it runs on, and its header's
812
+ * lists name the provider choice, through Zerg Router or not. Trusted only from the relay connection that named that
813
+ * pane, and only for a ZTC child this process registered or a native ZTC pane (#860's More… → ZTC). The pane's record
814
+ * follows it: the web mirror's badge, and the launch spec a restore or a split relaunches it from, auth mode included
815
+ * (the Router origin is kept). A native ZTC pane's launch spec is its native record, which only the desktop's native
816
+ * owner writes: its route is kept beside it, for a split.
817
+ */
818
+ private noteChildPaneReport;
752
819
  private trackPendingPaneReplacement;
753
820
  private isReplacementStale;
754
821
  private isPaneReplacementPending;
@@ -1313,6 +1380,7 @@ export declare class RatatuiApp {
1313
1380
  * its panes reads from its terminal (see handleSubmit).
1314
1381
  */
1315
1382
  private handleCommand;
1383
+ private runCommand;
1316
1384
  /**
1317
1385
  * Swap in a new live agent, disposing the one being dropped so its backend
1318
1386
  * (e.g. a codex app-server child, which now outlives a single turn) doesn't
@@ -1320,21 +1388,25 @@ export declare class RatatuiApp {
1320
1388
  */
1321
1389
  private replaceAgent;
1322
1390
  /**
1323
- * Hot-swap the model for this ZTC instance without restarting the process.
1324
- * Used by both the overseer (pane 0, called directly) and child panes
1325
- * (called via stdin JSON command from the parent).
1391
+ * Hot-swap the model for this ZTC instance without restarting the process: the main pane's (the web mirror's model
1392
+ * menu, a header choice) and a child pane's (its parent's set_model, a header choice) alike.
1326
1393
  *
1327
- * For the overseer: stores the override on this instance only, keeping
1328
- * configStore clean so new child panes still use the config default.
1329
- * For child panes: uses CLI overrides since each child is its own process.
1330
- * `pinRoute`, for a choice that also set the saved default, sets the CLI
1331
- * overrides on the overseer too, so its launch flags stop masking it.
1332
- * `authMode`, given when the choice names its route, moves with the provider
1333
- * and model: a pane's launch --auth-mode would otherwise keep the old route.
1334
- * A failed rebuild restores everything this set. False when this pane then
1335
- * runs on another route than the one asked for, which it says why.
1394
+ * The choice becomes this pane's own route in ConfigStore (setPaneRoute), which every reader of this pane's route
1395
+ * sees and nothing saves, so new panes still start on the configured route. No provider and model puts the pane
1396
+ * back on the configured route. `setsDefault`, for a choice just saved as the default for new panes (/provider,
1397
+ * /model, /settings), also drops this process's own launch flags (--provider, --model and --auth-mode, not
1398
+ * --router-url), which would otherwise outrank the new default for the panes it opens. `authMode`, given when the
1399
+ * choice names its route, moves with the provider and model: a pane's launch --auth-mode would otherwise keep the
1400
+ * old route. `keepsRoute` rebuilds on the route the pane runs on as it stands (its own, else the configured one with
1401
+ * the launch flags it was started with), as a changed effort needs. A failed rebuild keeps the pane on the route its
1402
+ * live agent was built on. False when this pane then runs on another route than the one asked for, which it says why.
1336
1403
  */
1337
1404
  private hotSwapModel;
1405
+ /**
1406
+ * Rebuild this pane's agent on the route it runs on, as a changed effort needs: its own when it has one, else the
1407
+ * configured one with the launch flags it was started with (a split's, a restored pane's), which stay.
1408
+ */
1409
+ private rebuildOnCurrentRoute;
1338
1410
  /**
1339
1411
  * Rebuild the agent when the active mode differs from the mode it was built
1340
1412
  * for. Cheap no-op when they match (the common case). Fixes ZTC-24: a
@@ -1495,6 +1567,12 @@ export declare class RatatuiApp {
1495
1567
  * working. Ctrl+B c does not come through here — that raises the chooser.
1496
1568
  */
1497
1569
  private handleCreatePaneRequest;
1570
+ /**
1571
+ * The route a ZTC split of `target` starts on: this pane's own route when it splits itself, a ZTC child's or a native
1572
+ * ZTC pane's as it last reported it (see noteChildPaneReport), and otherwise none, so the split starts on the default
1573
+ * for new panes, as this pane does when it has no route of its own.
1574
+ */
1575
+ private splitRouteFor;
1498
1576
  /**
1499
1577
  * Open the user's own Claude Code or Codex in a pane: the chooser's and the
1500
1578
  * desktop menu's entry point. Returns what to tell the user (an error or a