@spencerboucher/switchyard 0.9.0 → 0.11.0

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 (122) hide show
  1. package/README.md +2 -2
  2. package/dist/bridge/pi-model.js +12 -0
  3. package/dist/bridge/switchyard-terminal.js +66 -1
  4. package/dist/switchyard.mjs +7442 -5422
  5. package/dist/terminal/holder.js +76 -4
  6. package/package.json +1 -1
  7. package/web-dist/assets/AutomationView-CrKqim2i.js +2 -0
  8. package/web-dist/assets/{AutomationView-D7Syv1En.js.map → AutomationView-CrKqim2i.js.map} +1 -1
  9. package/web-dist/assets/Card-XMb6DfZU.js +2 -0
  10. package/web-dist/assets/Card-XMb6DfZU.js.map +1 -0
  11. package/web-dist/assets/Checkbox-CeUPbVi7.js +2 -0
  12. package/web-dist/assets/Checkbox-CeUPbVi7.js.map +1 -0
  13. package/web-dist/assets/Copy-CGnl0Vga.js +2 -0
  14. package/web-dist/assets/{Copy-B6XSAIUd.js.map → Copy-CGnl0Vga.js.map} +1 -1
  15. package/web-dist/assets/DangerZone-og55TRug.js +2 -0
  16. package/web-dist/assets/DangerZone-og55TRug.js.map +1 -0
  17. package/web-dist/assets/Field-DVurWE-E.js +2 -0
  18. package/web-dist/assets/Field-DVurWE-E.js.map +1 -0
  19. package/web-dist/assets/{InteractionCard-DF1EcSpm.js → InteractionCard-1ePc4XOF.js} +4 -4
  20. package/web-dist/assets/{InteractionCard-DF1EcSpm.js.map → InteractionCard-1ePc4XOF.js.map} +1 -1
  21. package/web-dist/assets/Menu-CYZQ97c0.js +2 -0
  22. package/web-dist/assets/Menu-CYZQ97c0.js.map +1 -0
  23. package/web-dist/assets/Overlay-DlLhg1cK.js +2 -0
  24. package/web-dist/assets/Overlay-DlLhg1cK.js.map +1 -0
  25. package/web-dist/assets/Priority-BCHLJqWN.js +2 -0
  26. package/web-dist/assets/{Priority-CHmzfoHg.js.map → Priority-BCHLJqWN.js.map} +1 -1
  27. package/web-dist/assets/{SegmentedControl-C_hEVQMB.js → SegmentedControl-CSO0EMTX.js} +2 -2
  28. package/web-dist/assets/{SegmentedControl-C_hEVQMB.js.map → SegmentedControl-CSO0EMTX.js.map} +1 -1
  29. package/web-dist/assets/{Select-Cfql4Nwu.js → Select-Dgmnmpz3.js} +2 -2
  30. package/web-dist/assets/{Select-Cfql4Nwu.js.map → Select-Dgmnmpz3.js.map} +1 -1
  31. package/web-dist/assets/{Switch-DBfzmqkm.js → Switch-DS4NRENd.js} +2 -2
  32. package/web-dist/assets/{Switch-DBfzmqkm.js.map → Switch-DS4NRENd.js.map} +1 -1
  33. package/web-dist/assets/{Tabs-BNuL3_Et.js → Tabs-9xp-tGja.js} +4 -4
  34. package/web-dist/assets/{Tabs-BNuL3_Et.js.map → Tabs-9xp-tGja.js.map} +1 -1
  35. package/web-dist/assets/{TextArea-CKybrQyn.js → TextArea-PfVKaz29.js} +2 -2
  36. package/web-dist/assets/{TextArea-CKybrQyn.js.map → TextArea-PfVKaz29.js.map} +1 -1
  37. package/web-dist/assets/{TextLink-OzzyP2-p.js → TextLink-CYqiAUlK.js} +2 -2
  38. package/web-dist/assets/{TextLink-OzzyP2-p.js.map → TextLink-CYqiAUlK.js.map} +1 -1
  39. package/web-dist/assets/attention-CTkX5JXq.js +2 -0
  40. package/web-dist/assets/attention-CTkX5JXq.js.map +1 -0
  41. package/web-dist/assets/automations-CsdtA3xp.js +2 -0
  42. package/web-dist/assets/{automations-Cw5Gacgm.js.map → automations-CsdtA3xp.js.map} +1 -1
  43. package/web-dist/assets/board-CJL75uGb.js +10 -0
  44. package/web-dist/assets/board-CJL75uGb.js.map +1 -0
  45. package/web-dist/assets/code-B1njb2Cr.css +1 -0
  46. package/web-dist/assets/code-CEYPZt-J.js +21 -0
  47. package/web-dist/assets/code-CEYPZt-J.js.map +1 -0
  48. package/web-dist/assets/{describe-D6KLGKWa.js → describe-DjRsBpcB.js} +3 -3
  49. package/web-dist/assets/{describe-D6KLGKWa.js.map → describe-DjRsBpcB.js.map} +1 -1
  50. package/web-dist/assets/enroll-DcEYGgoX.js +2 -0
  51. package/web-dist/assets/{enroll-DwT7AcuS.js.map → enroll-DcEYGgoX.js.map} +1 -1
  52. package/web-dist/assets/index-BeJqGnFE.css +2 -0
  53. package/web-dist/assets/index-DSJZdQ79.js +11 -0
  54. package/web-dist/assets/index-DSJZdQ79.js.map +1 -0
  55. package/web-dist/assets/more-BQSa_-H6.js +2 -0
  56. package/web-dist/assets/{more-DQR5uu1c.js.map → more-BQSa_-H6.js.map} +1 -1
  57. package/web-dist/assets/plus-BLP-wIYD.js +2 -0
  58. package/web-dist/assets/plus-BLP-wIYD.js.map +1 -0
  59. package/web-dist/assets/preload-helper-Huh16h6r.js +13 -0
  60. package/web-dist/assets/preload-helper-Huh16h6r.js.map +1 -0
  61. package/web-dist/assets/queue-CCjBjQhT.js +2 -0
  62. package/web-dist/assets/{queue-DUg1rS8t.js.map → queue-CCjBjQhT.js.map} +1 -1
  63. package/web-dist/assets/repo-pkFfpra6.js +2 -0
  64. package/web-dist/assets/repo-pkFfpra6.js.map +1 -0
  65. package/web-dist/assets/settings-vrxspmWN.js +7 -0
  66. package/web-dist/assets/settings-vrxspmWN.js.map +1 -0
  67. package/web-dist/assets/shared-Bm6Rhfqw.js +3 -0
  68. package/web-dist/assets/shared-Bm6Rhfqw.js.map +1 -0
  69. package/web-dist/assets/states-BQxrRFdh.js +56 -0
  70. package/web-dist/assets/states-BQxrRFdh.js.map +1 -0
  71. package/web-dist/assets/{terminal-login-S5CAd5xA.js → terminal-login-D9enO0EH.js} +2 -2
  72. package/web-dist/assets/{terminal-login-S5CAd5xA.js.map → terminal-login-D9enO0EH.js.map} +1 -1
  73. package/web-dist/assets/timer-BCIucSXh.js +2 -0
  74. package/web-dist/assets/timer-BCIucSXh.js.map +1 -0
  75. package/web-dist/assets/useBreakpoint-LY_qlpRG.js +2 -0
  76. package/web-dist/assets/useBreakpoint-LY_qlpRG.js.map +1 -0
  77. package/web-dist/assets/useNow-BUvGqrfn.js +2 -0
  78. package/web-dist/assets/{useNow-Dj7oEiwn.js.map → useNow-BUvGqrfn.js.map} +1 -1
  79. package/web-dist/assets/{useResource-CDGSq2At.js → useResource-Dul6MTDM.js} +2 -2
  80. package/web-dist/assets/{useResource-CDGSq2At.js.map → useResource-Dul6MTDM.js.map} +1 -1
  81. package/web-dist/index.html +10 -3
  82. package/web-dist/sw.js +1 -1
  83. package/web-dist/sw.js.map +1 -1
  84. package/web-dist/assets/AutomationView-D7Syv1En.js +0 -2
  85. package/web-dist/assets/Checkbox-D6tRfEeI.js +0 -2
  86. package/web-dist/assets/Checkbox-D6tRfEeI.js.map +0 -1
  87. package/web-dist/assets/Copy-B6XSAIUd.js +0 -2
  88. package/web-dist/assets/DangerZone-DfYlxDC1.js +0 -2
  89. package/web-dist/assets/DangerZone-DfYlxDC1.js.map +0 -1
  90. package/web-dist/assets/Field-D-Ty7fKT.js +0 -2
  91. package/web-dist/assets/Field-D-Ty7fKT.js.map +0 -1
  92. package/web-dist/assets/Menu-BfOszNC4.js +0 -2
  93. package/web-dist/assets/Menu-BfOszNC4.js.map +0 -1
  94. package/web-dist/assets/Overlay-DUQwh6_b.js +0 -2
  95. package/web-dist/assets/Overlay-DUQwh6_b.js.map +0 -1
  96. package/web-dist/assets/Priority-CHmzfoHg.js +0 -2
  97. package/web-dist/assets/attention-V86Gye3I.js +0 -2
  98. package/web-dist/assets/attention-V86Gye3I.js.map +0 -1
  99. package/web-dist/assets/automations-Cw5Gacgm.js +0 -2
  100. package/web-dist/assets/board-B8X7TYYR.js +0 -10
  101. package/web-dist/assets/board-B8X7TYYR.js.map +0 -1
  102. package/web-dist/assets/code-BKroYJmR.js +0 -12
  103. package/web-dist/assets/code-BKroYJmR.js.map +0 -1
  104. package/web-dist/assets/enroll-DwT7AcuS.js +0 -2
  105. package/web-dist/assets/index-B3F7WcYf.css +0 -2
  106. package/web-dist/assets/index-hxvDvCS7.js +0 -12
  107. package/web-dist/assets/index-hxvDvCS7.js.map +0 -1
  108. package/web-dist/assets/more-DQR5uu1c.js +0 -2
  109. package/web-dist/assets/queue-DUg1rS8t.js +0 -2
  110. package/web-dist/assets/repo-XzzzEI0d.js +0 -2
  111. package/web-dist/assets/repo-XzzzEI0d.js.map +0 -1
  112. package/web-dist/assets/search-C6cn5WOo.js +0 -2
  113. package/web-dist/assets/search-C6cn5WOo.js.map +0 -1
  114. package/web-dist/assets/server-BqZ-w6M8.js +0 -2
  115. package/web-dist/assets/server-BqZ-w6M8.js.map +0 -1
  116. package/web-dist/assets/settings-DyUu0tJM.js +0 -8
  117. package/web-dist/assets/settings-DyUu0tJM.js.map +0 -1
  118. package/web-dist/assets/states-ZhrxQa3K.js +0 -56
  119. package/web-dist/assets/states-ZhrxQa3K.js.map +0 -1
  120. package/web-dist/assets/useBackTo-BIrCq3W2.js +0 -2
  121. package/web-dist/assets/useBackTo-BIrCq3W2.js.map +0 -1
  122. package/web-dist/assets/useNow-Dj7oEiwn.js +0 -2
package/README.md CHANGED
@@ -77,7 +77,7 @@ sequenceDiagram
77
77
  | Area | What you get |
78
78
  |---|---|
79
79
  | **Sessions** | Persistent Pi conversations on any host; the same live session in every client; steer or queue follow-ups; take over and return to automation; resume after crashes with the same conversation (never a silent new one); import existing Pi sessions; switch model and effort, see context use and compact, a slash-command picker |
80
- | **Workspaces** | A git worktree per task or session inside the repository, discovery of worktrees you made yourself, setup commands, removal that refuses to lose uncommitted or unmerged work, and project folders per host whose repositories are added automatically |
80
+ | **Workspaces** | A git worktree per task or session inside the repository, discovery of worktrees you made yourself, setup commands, `.worktreeinclude` to copy ignored files such as `.env` into new worktrees, removal that refuses to lose uncommitted or unmerged work, and project folders per host whose repositories are added automatically |
81
81
  | **Tasks and board** | Backlog, Ready, In progress, Review, Done; dependencies with cycle detection; priorities; per-project concurrency limits; a Queue view explaining why queued work waits |
82
82
  | **Review** | Changed files and diffs on desktop and phone, line comments sent as one follow-up, request changes, accept |
83
83
  | **Bounded continuation** | Optional: keep the agent working toward an objective, within a maximum number of continuations, a time limit and token or cost caps, ending in your checks and your review |
@@ -118,7 +118,7 @@ switchyard up
118
118
  ```sh
119
119
  docker run -d --name switchyard -p 127.0.0.1:7400:7400 -v switchyard-data:/data \
120
120
  -e SWITCHYARD_PUBLIC_URL=https://switchyard.example.com \
121
- ghcr.io/justmytwospence/switchyard:0.9.0
121
+ ghcr.io/justmytwospence/switchyard:0.11.0
122
122
  # Single sign-on is required off localhost: see docs/auth.md
123
123
  ```
124
124
 
@@ -29,6 +29,17 @@ export function supportedThinkingLevels(model) {
29
29
  return true;
30
30
  });
31
31
  }
32
+ function promptCacheOf(model) {
33
+ const pc = model?.promptCache;
34
+ if (!pc || typeof pc !== "object")
35
+ return null;
36
+ const out = {};
37
+ if (typeof pc.short === "number")
38
+ out.short = pc.short;
39
+ if (typeof pc.long === "number")
40
+ out.long = pc.long;
41
+ return out.short !== undefined || out.long !== undefined ? out : null;
42
+ }
32
43
  export function modelInfo(model) {
33
44
  if (!model || typeof model.provider !== "string" || typeof model.id !== "string")
34
45
  return null;
@@ -39,6 +50,7 @@ export function modelInfo(model) {
39
50
  contextWindow: typeof model.contextWindow === "number" ? model.contextWindow : null,
40
51
  reasoning: model.reasoning === true,
41
52
  thinkingLevels: supportedThinkingLevels(model),
53
+ promptCache: promptCacheOf(model),
42
54
  };
43
55
  }
44
56
  //# sourceMappingURL=pi-model.js.map
@@ -130,6 +130,14 @@ export default function switchyardTerminal(pi) {
130
130
  .filter(Boolean),
131
131
  });
132
132
  const sendQueue = () => send({ type: "queue_update", ...queue });
133
+ const sendLeaf = () => {
134
+ try {
135
+ send({ type: "leaf", leafId: ctx?.sessionManager?.getLeafId?.() ?? null });
136
+ }
137
+ catch {
138
+ // never throw into Pi
139
+ }
140
+ };
133
141
  /** Announce this session (and whether dialogs are remote-backed) to the host. */
134
142
  const hello = () => {
135
143
  if (!ctx)
@@ -569,6 +577,53 @@ export default function switchyardTerminal(pi) {
569
577
  }
570
578
  });
571
579
  return;
580
+ case "navigate_tree": {
581
+ const entryId = String(cmd.entryId ?? "");
582
+ if ((cmd.sessionFile ?? null) !== (ctx.sessionManager.getSessionFile() ?? null)) {
583
+ respond(id, type, undefined, "The session changed; reload and try again");
584
+ return;
585
+ }
586
+ if (!ctx.isIdle()) {
587
+ respond(id, type, undefined, "Wait for the current reply to finish");
588
+ return;
589
+ }
590
+ if (pending.size > 0) {
591
+ respond(id, type, undefined, "Answer the open dialog first");
592
+ return;
593
+ }
594
+ const target = ctx.sessionManager.getEntry?.(entryId);
595
+ if (!target) {
596
+ respond(id, type, undefined, "That message is not in this session");
597
+ return;
598
+ }
599
+ const summarize = cmd.summarize === true;
600
+ runInternal(async (c) => {
601
+ try {
602
+ const r = await c.navigateTree(entryId, {
603
+ summarize,
604
+ customInstructions: cmd.instructions || undefined,
605
+ });
606
+ if (r?.cancelled) {
607
+ respond(id, type, undefined, summarize ? "Summary cancelled" : "Rewind cancelled");
608
+ return;
609
+ }
610
+ const editorText = target.type === "message" && target.message?.role === "user"
611
+ ? messageText(target.message)
612
+ : null;
613
+ respond(id, type, {
614
+ leafId: ctx.sessionManager.getLeafId() ?? null,
615
+ editorText,
616
+ entries: ctx.sessionManager.getBranch(),
617
+ });
618
+ }
619
+ catch (e) {
620
+ respond(id, type, undefined, e?.message ?? String(e));
621
+ }
622
+ flushEntries();
623
+ sendLeaf();
624
+ });
625
+ return;
626
+ }
572
627
  case "reload":
573
628
  if (!ctx) {
574
629
  respond(id, type, undefined, "Session is not ready");
@@ -615,6 +670,7 @@ export default function switchyardTerminal(pi) {
615
670
  hello();
616
671
  sendModelState();
617
672
  sendQueue();
673
+ sendLeaf();
618
674
  }
619
675
  for (const p of pending.values())
620
676
  send(p.request);
@@ -726,6 +782,7 @@ export default function switchyardTerminal(pi) {
726
782
  const sessionFile = c.sessionManager.getSessionFile() ?? null;
727
783
  hello();
728
784
  sendModelState();
785
+ sendLeaf();
729
786
  if (event?.reason && event.reason !== "startup") {
730
787
  send({ type: "switchyard_native", sessionId, sessionFile });
731
788
  }
@@ -760,10 +817,18 @@ export default function switchyardTerminal(pi) {
760
817
  send(event);
761
818
  flushEntries();
762
819
  });
763
- on("turn_end", () => flushEntries());
820
+ on("turn_end", () => {
821
+ flushEntries();
822
+ sendLeaf();
823
+ });
824
+ on("session_tree", () => {
825
+ flushEntries();
826
+ sendLeaf();
827
+ });
764
828
  on("agent_settled", (event) => {
765
829
  send({ type: "agent_settled", aborted: event?.aborted === true });
766
830
  flushEntries();
831
+ sendLeaf();
767
832
  if (queue.steering.length > 0 || queue.followUp.length > 0) {
768
833
  queue.steering = [];
769
834
  queue.followUp = [];