pi-straw-boss 0.46.0 → 0.48.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.
- package/README.md +12 -8
- package/README.zh-TW.md +10 -6
- package/dist/gui/assets/ask-BbPMnLTh.js +1 -0
- package/dist/gui/assets/chat-Czv0jPAD.js +2 -0
- package/dist/gui/assets/drawer-aV6sM3Cp.js +1 -0
- package/dist/gui/assets/index-BwRZ1vKG.js +1 -0
- package/dist/gui/assets/index-D3RS3c_W.css +1 -0
- package/dist/gui/assets/layer-fdSmeR4i.js +3 -0
- package/dist/gui/assets/lightbox-DeyJW1Ta.js +1 -0
- package/dist/gui/assets/link-DEyMVgpE.js +1 -0
- package/dist/gui/assets/pair-ChR0ekqj.js +1 -0
- package/dist/gui/assets/picker-CezqOEMn.js +1 -0
- package/dist/gui/assets/server-894bzpGw.js +2 -0
- package/dist/gui/assets/spawn-4YbdgJBa.js +1 -0
- package/dist/gui/assets/trust-Vf8ZY7v-.js +1 -0
- package/dist/gui/assets/unit_count-DFKHs2Sk.js +1 -0
- package/dist/gui/assets/views-BmcT2brW.js +13 -0
- package/dist/gui/index.html +2 -2
- package/dist/server/{chunk-XKWIT6MD.mjs → chunk-F4ZOTRQT.mjs} +519 -217
- package/dist/server/cli.mjs +515 -11
- package/dist/server/main.mjs +5398 -1324
- package/package.json +1 -1
- package/prompts/ally-run.md +9 -0
- package/prompts/main.md +4 -3
- package/prompts/member-no-main.md +1 -1
- package/prompts/member.md +1 -1
- package/prompts/tower-run.md +13 -0
- package/prompts/tower.md +1 -1
- package/src/agent/cli.ts +7 -3
- package/src/agent/config.ts +1 -1
- package/src/agent/kit.ts +2 -0
- package/src/agent/sidecar.ts +2 -1
- package/src/appentry.ts +58 -0
- package/src/balance.ts +4 -2
- package/src/board.ts +29 -9
- package/src/boardauto.ts +117 -0
- package/src/boardfill.ts +75 -0
- package/src/boardread.ts +7 -3
- package/src/boardset.ts +16 -9
- package/src/boss.ts +40 -4
- package/src/bridge.ts +21 -12
- package/src/closing.ts +8 -2
- package/src/control.ts +52 -3
- package/src/devices.ts +2 -2
- package/src/dialogs.ts +55 -15
- package/src/digest.ts +8 -0
- package/src/eventmarks.ts +9 -0
- package/src/gui.ts +41 -22
- package/src/handover.ts +1 -1
- package/src/header.ts +47 -4
- package/src/herdr.ts +23 -3
- package/src/history.ts +15 -8
- package/src/host.ts +11 -4
- package/src/index.ts +13 -7
- package/src/integration.ts +32 -0
- package/src/items.ts +7 -2
- package/src/link/allow.ts +2 -2
- package/src/link/approval.ts +1 -1
- package/src/link/gate.ts +1 -1
- package/src/link/holder.ts +252 -36
- package/src/link/hooks.ts +4 -12
- package/src/link/level.ts +25 -0
- package/src/link/remotelist.ts +23 -0
- package/src/link/runtime.ts +28 -27
- package/src/link/service.ts +24 -5
- package/src/link/store.ts +87 -0
- package/src/link/turn.ts +25 -3
- package/src/membership.ts +3 -3
- package/src/memorycmd.ts +157 -0
- package/src/memorytool.ts +17 -0
- package/src/net.ts +43 -10
- package/src/opener.ts +1 -1
- package/src/order.ts +9 -1
- package/src/orphan.ts +1 -1
- package/src/owners.ts +3 -2
- package/src/paircode.ts +36 -0
- package/src/pairing.ts +5 -4
- package/src/reach.ts +76 -28
- package/src/remote.ts +48 -8
- package/src/restored.ts +253 -0
- package/src/runmark.ts +12 -0
- package/src/runmode.ts +530 -0
- package/src/server/acl.ts +1 -1
- package/src/server/allows.ts +115 -0
- package/src/server/allyport.ts +29 -0
- package/src/server/allyroute.ts +66 -0
- package/src/server/asks.ts +69 -0
- package/src/server/bossconv.ts +123 -0
- package/src/server/cli.ts +84 -6
- package/src/server/client.ts +7 -5
- package/src/server/desk.ts +125 -0
- package/src/server/fatal.ts +21 -0
- package/src/server/guihost.ts +86 -19
- package/src/server/guisecrets.ts +37 -0
- package/src/server/herdrcode.ts +11 -0
- package/src/server/lineage.ts +122 -0
- package/src/server/main.ts +137 -22
- package/src/server/record.ts +9 -3
- package/src/server/rungate.ts +42 -0
- package/src/server/runs.ts +1668 -0
- package/src/server/runtools.ts +283 -0
- package/src/server/standing.ts +460 -0
- package/src/server/towerbrief.ts +197 -0
- package/src/server/towerclient.ts +7 -1
- package/src/server/towermemory.ts +473 -0
- package/src/server/towerpanel.ts +27 -0
- package/src/server/towerruns.ts +14 -7
- package/src/server/towerrunstore.ts +144 -0
- package/src/server/towers.ts +564 -49
- package/src/server/towerseen.ts +100 -0
- package/src/server/towerstore.ts +92 -42
- package/src/server/typegate.ts +306 -0
- package/src/server-look.ts +6 -2
- package/src/server-watch.ts +4 -3
- package/src/session.ts +28 -6
- package/src/stash.ts +6 -5
- package/src/state.ts +6 -3
- package/src/todo.ts +7 -3
- package/src/tools.ts +48 -23
- package/src/towercmd.ts +137 -0
- package/src/towerprompt/messages.ts +75 -0
- package/src/towerprompt/prompt.ts +305 -0
- package/src/towerprompt/serversource.ts +67 -0
- package/src/towerprompt/source.ts +27 -0
- package/src/towertab.ts +3 -2
- package/dist/gui/assets/ask-C-MCuDVp.js +0 -1
- package/dist/gui/assets/chat-BtYPqHgj.js +0 -2
- package/dist/gui/assets/drawer-Bfcx2nBu.js +0 -1
- package/dist/gui/assets/index-BvT-ssSF.js +0 -1
- package/dist/gui/assets/index-EvA0w7X9.css +0 -1
- package/dist/gui/assets/layer-BN3b_pYb.js +0 -3
- package/dist/gui/assets/lightbox-CLWeBhLv.js +0 -1
- package/dist/gui/assets/link-2O3tWz8e.js +0 -1
- package/dist/gui/assets/pair-7HvE6CHz.js +0 -1
- package/dist/gui/assets/picker-DXDJ3XpY.js +0 -1
- package/dist/gui/assets/registry-Bx4Ukv2M.js +0 -1
- package/dist/gui/assets/server-C_0vVG2D.js +0 -2
- package/dist/gui/assets/spawn-BB7ERCLo.js +0 -1
- package/dist/gui/assets/trust-CoZmlyVW.js +0 -1
- package/dist/gui/assets/unit_count-DTUtsZm9.js +0 -1
- package/dist/gui/assets/views-BEtNLp2g.js +0 -7
package/README.md
CHANGED
|
@@ -31,13 +31,14 @@ Run a few agents on the same project and they start stepping on each other: two
|
|
|
31
31
|
- **A tower per workspace.** It opens in its own tab, pinned first, when agents start to collide: a member dispatches a subagent (it promotes itself first), a workspace has two members while another workspace already has a tower, an agent promotes itself, or you type `/boss tower`. Mains and the tower go together: a tower that opens promotes each tab's earliest member, and a tower that quits turns every main back into a member (its subagents stay). It and coordinates the main agents and the other towers, and opens a tab with a main agent for work no session owns. You don't need to talk to it.
|
|
32
32
|
- **A live dashboard** in the tower: who joined, and what they and their subagents are doing.
|
|
33
33
|
- **Towers talk to each other.** A tower lists every workspace's tower (`tower_list`: who a message for it reaches, what its tabs work on) and writes to one or all of them (`tower_send`); a workspace without a tower is reached through its mains, else its members. Every `call_tower`, `boss_broadcast`, and `tower_send` message opens with a header the code writes: who sent it, in what role, to whom, and whether a reply is expected ([how](docs/how-it-works.md#talking-between-towers)).
|
|
34
|
-
- **A work board.** A main
|
|
34
|
+
- **A work board.** A main's board fills itself from its todo list and its name (`board_set` overrides it); allies see only an auto entry's name and progress (`<name> (3/5)`), never its task text; towers read every main's entry (`board_read`), on this computer and, with Straw Link, on teammates' computers, so a tower routes work knowing where each main stands ([how](docs/how-it-works.md#the-work-board)).
|
|
35
35
|
- **A tower closes the mains it opened.** A main a tower opened for a request reports to the sender and to the tower, and the tower closes it (`boss_close_main`) when nothing is running in it ([how](docs/how-it-works.md#closing-an-opened-main)).
|
|
36
36
|
- **A digest for the tower**: joins, subagent launches, and renames in its workspace since its last run, read into its next run once and cleared ([how](docs/how-it-works.md#the-towers-digest)).
|
|
37
37
|
- **A browser view** of the whole net, `/boss gui`: every workspace as a base with its tower, agents, and subagents, animated and read-only. Click a base to zoom in, click a unit to read its chat as a live comms log; units that wait on you queue up as alerts, and Space opens the next one, F enlarges the top dialog, and Escape closes it (none of them while you type); a question is answered from the keyboard too: arrows choose, Tab moves between questions, and Enter confirms and goes on. A switch in the header's settings (the gear) raises a system notification, and another plays a sound, when a unit waits on you, fails, or finishes; finished units wait in a list of their own, cleared one by one or all at once, and a finished subagent on the map is dismissed one by one or all at once (Dismiss finished, beside the location). A unit's comms show its background monitors, and one that fails or goes quiet raises a notice (a quiet entry under the header's Notices button; only a unit waiting on you raises the prominent alert); a unit that is idle while a subagent of it works, or while a monitor of it runs, shows as commanding with a glow, and one that only waits on a running monitor shows its note in red. On a desktop a unit's terminal takes your keyboard once you click into it. It reads in English or Traditional Chinese, following your browser, with a language menu in the header's settings. + New base, the last card on the map, opens a base in a folder you pick with one member and no tower. A base without a tower takes more members (+ Member on the base adds one in a new tab, on a squad beside that squad), and its tower opens by the rules above; a base with a tower takes new mains (+ Main, on the base or in the tower's comms), each in a tab of its own. In a session's composer, a file pasted, dropped, or picked with + (20 MB at most) is stored in a private temp folder and its path goes into the message. × closes a base, a squad, or (in its view) a unit after a confirmation: each agent quits pi as `/quit` would, then its pane, tab, or workspace closes; nothing closes if one of them refuses. Each opening form takes an optional first message; the folder is picked in Finder-style columns (with New folder, and the base named after the folder by default), staying inside your home folder and skipping hidden folders (on Windows also the ones with the Hidden or System attribute, such as AppData and the old profile links), and while the unit opens a deploy panel shows the real steps (create, start, join the net, deliver the first message) with each step's clock, and names the step and the reason when one fails. A pi that must confirm project trust before it starts (a folder with `.pi/` settings, extensions, skills, or MCP servers) asks in the GUI as an alert too, with the folder, what trusting would load, and Trust, Trust this time, or Don't trust (the terminal can answer as well, and the first answer counts; a paired phone may answer; the deploy panel of an opening shows it inline).
|
|
38
38
|
- **Broadcast** to a tab, a workspace, every tower (a workspace without one, through its mains or members), or every session.
|
|
39
39
|
- **Tidy tabs.** When a pi starts in a tab or quits out of it, the tab's panes are made equal again, so workers split off one by one don't leave a chain of halves.
|
|
40
40
|
- **Stranded subagents are asked to report.** A subagent that stays open after finishing, while the pi that launched it was restarted and no longer receives its result, is asked once over intercom to send its final report there ([how it works](docs/how-it-works.md#orphaned-subagents)).
|
|
41
|
+
- **Subagents a Herdr restart brought back as plain pi sessions are resumed.** A restart (`resume_agents_on_restore`) starts a plain `pi --session` in each subagent's pane, without what makes it a child, so its result never arrives. Straw Boss closes that restored pane and asks the launching session to resume the run with pi-herdr-agents' `subagent_resume`; a managed-worktree run keeps its pane and is reported instead ([how it works](docs/how-it-works.md#subagents-a-herdr-restore-brought-back-plain)).
|
|
41
42
|
- **A net view in Herdr's sidebar.** An optional plugin turns the Agents list into the net, towers first and each subagent under its launcher, on by default and switched by one key.
|
|
42
43
|
- **A reaper for leftover worktree panes.** A second optional plugin closes the panes agents leave behind in worktree workspaces, removes the clean checkouts nothing holds, and keeps the workspaces you pin.
|
|
43
44
|
|
|
@@ -50,6 +51,7 @@ pi install npm:pi-straw-boss
|
|
|
50
51
|
### Requirements
|
|
51
52
|
|
|
52
53
|
- pi running inside [Herdr](https://herdr.dev) 0.9.4 or newer.
|
|
54
|
+
- Herdr's pi integration (`herdr integration install pi`): without it Herdr does not name a pane's pi session, and the session cannot join the net; each session warns once, 20 s after its start, when it is missing.
|
|
53
55
|
- [pi-intercom](https://www.npmjs.com/package/pi-intercom) 0.18.1 or newer: the net's channels, messages, and the GUI's dialog relay run over it, and so does the sb server's connection (it checks the version at start and says so in `start-error.json` and `boss_server status` when pi-intercom is older or missing).
|
|
54
56
|
- Windows support is experimental: the extension reaches Herdr over its named pipe there, the sidebar plugin runs with the `node` on `PATH`, and the worktree reaper is macOS and Linux only ([what differs](docs/how-it-works.md#windows)).
|
|
55
57
|
|
|
@@ -76,7 +78,7 @@ Any extension's `select` and `confirm` (an `mp-infra` command review, say) can b
|
|
|
76
78
|
3. Type `/boss tower` to open the workspace's tower and watch its dashboard. It also opens by itself when agents start to collide.
|
|
77
79
|
4. Type `/boss gui` from any session to see the whole net in your browser.
|
|
78
80
|
|
|
79
|
-
The tower only routes and coordinates, so it can run a lighter model: set `towerModel` in `~/.pi/agent/straw-boss/config.json` ([how it works](docs/how-it-works.md#how-it-works)). The
|
|
81
|
+
The tower only routes and coordinates, so it can run a lighter model: set `towerModel` in `~/.pi/agent/straw-boss/config.json` ([how it works](docs/how-it-works.md#how-it-works)). The tower service of the sb server is on by default: the tower is a run that wakes for the events it gets and ends with a handoff note (`/boss tower <prompt>` writes to it), and a teammate's Straw Link message gets an ally run of its own. Each run starts fresh; what has to outlive it (your standing instructions and decisions, and the tower's open waits) sits in a small memory you read and change with `/boss memory`, or in the tower's comms in the GUI; the tower can only propose a standing instruction or a decision, and it takes effect when you confirm it ([how it works](docs/how-it-works.md#tower-memory)). Set `{ "towerRuns": { "enabled": false } }` there to keep resident towers ([how it works](docs/how-it-works.md#the-tower-service-b4)).
|
|
80
82
|
|
|
81
83
|
## Tools and commands
|
|
82
84
|
|
|
@@ -84,25 +86,27 @@ The tower only routes and coordinates, so it can run a lighter model: set `tower
|
|
|
84
86
|
|---|---|
|
|
85
87
|
| `boss_promote` | Become this tab's main agent (refused while it has one). |
|
|
86
88
|
| `boss_status` | Main agents, this workspace's tower, and the other towers. |
|
|
87
|
-
| `call_tower` | Message this workspace's tower, or another workspace's (under a header; `reply: false` for a notice
|
|
89
|
+
| `call_tower` | Message this workspace's tower, or another workspace's (under a header). `why` says milestone, shared, or blocked: the three points a main calls it; `reply: false` for a notice. |
|
|
88
90
|
| `boss_open_main` | Tower only: open a tab with a new main agent for a request no session owns. |
|
|
89
91
|
| `boss_close_main` | Tower only: close a main this tower opened, once nothing runs in it. |
|
|
90
92
|
| `tower_list` | Tower only: every workspace's tower, who a message for it reaches, its state, and what its tabs work on. |
|
|
91
93
|
| `tower_send` | Tower only: message one other tower (by workspace id or label), or all of them. |
|
|
92
94
|
| `board_read` | Tower only: the work board: what each main is doing and how far it is, here and on teammates' computers. |
|
|
93
|
-
| `board_set` | A tab's main:
|
|
95
|
+
| `board_set` | A tab's main: override its own board entry (one line of current work, up to 8 checklist items), or `auto: true` to give it back to the auto-fill from its todo list and name. |
|
|
94
96
|
| `boss_broadcast` | Message a tab, a workspace, all towers, or every session (under a header). |
|
|
95
97
|
| `boss_server` | See the sb server (status works with the server down), read its log (up to 200 lines), or restart it with a reason. Refused while the boss stopped the server, once a minute at most, and never in a remote turn. |
|
|
96
98
|
| `boss_rename` | Name this session with a short phrase for its current work; the net and the GUI show it, and a main agent's tab takes it as its label. Main agents call it when their work changes. |
|
|
97
99
|
| `/boss` | Take over as this tab's main agent. |
|
|
98
100
|
| `/boss status`, `/boss tower` | Show the status; open and focus the tower. |
|
|
99
|
-
| `/boss
|
|
101
|
+
| `/boss memory [-w workspace]`, `/boss memory confirm P1`, `reject P1`, `add standing\|decision <text>`, `edit S1 <text>`, `delete D1`, `resolve W1` | Read and change the tower's memory from pi: its standing instructions, decisions, and waits, and the proposals the tower made that wait for you. The GUI's Memory panel is the same operation. See [Tower memory](docs/how-it-works.md#tower-memory). |
|
|
102
|
+
| `/boss server`, `/boss server stop`, `/boss server restart [reason]` | Show the sb server and start it when it is down; stop it on purpose (after a confirm; nothing but a boss command starts it again); restart it (after a confirm) on the same port; the GUI keeps its address, so open pages reconnect by themselves. See [The sb server](docs/how-it-works.md#the-sb-server). |
|
|
100
103
|
| `/boss close` | Quit this session and close its pane. |
|
|
101
104
|
| `/boss close all` | Quit this base's tower, mains, and members and close it with its shells, without stashing. It is checked first as a stash checks it; anything running that would be lost (a turn, a queued message, a dialog, a monitor, a subagent, a busy shell) closes nothing, and every reason is listed. Other bases are never touched. |
|
|
102
105
|
| Stash, Stashed, Pop on the page | A base's Stash puts it away under its label; the HUD's Stashed list opens each one again with Pop. A base's Quit is checked first, as `/boss close all` is. |
|
|
103
106
|
| `/boss stash [name]`, `/boss pop [name]` | Put this whole base away (its tower, mains, members, and idle shells) and close it; open it again later, every pi resumed from its own session file in its old role. A stash refuses, naming why, while anything a resume would lose is there: a running turn, a queued message, an open dialog, a running monitor, a subagent, or a busy shell. |
|
|
104
|
-
| `/boss gui`, `/boss gui stop` | Open the net in the browser (any session, joins nothing); stop its GUI, from any session. The GUI is served by the sb server, one per machine, so it does not depend on which pi session runs: `/boss gui` starts the server when none runs and prints the URL, and a server that went down comes back when any pi session starts or looks (or from `cli.mjs up`). The URL carries a random token that
|
|
105
|
-
| `/boss gui remote`, `/boss gui remote off` | Reach the GUI from your phone over your tailnet (`tailscale serve`, never Funnel): pair by QR code, and a phone stays paired (90 days from its last use, `remote off` included) until you unpair it in the Phone tile or the GUI
|
|
107
|
+
| `/boss gui`, `/boss gui stop`, `/boss gui rotate` | Open the net in the browser (any session, joins nothing); stop its GUI, from any session. The GUI is served by the sb server, one per machine, so it does not depend on which pi session runs: `/boss gui` starts the server when none runs and prints the URL, and a server that went down comes back when any pi session starts or looks (or from `cli.mjs up`). The URL carries a random token that is kept across a restart, an upgrade, a crash, a reboot, and a `/boss gui stop` followed by `/boss gui` (on the same port, in `gui-secrets.json`), so a page left open reconnects by itself and a phone stays paired. A new token comes only from `/boss gui rotate` (after a confirm; it unpairs every phone and opens the new address), a missing or corrupt `gui-secrets.json`, or a port that was taken at the next start: the old address then answers 403 and a phone scans the QR code again. Keeping the token has a cost you chose: another account on this machine that binds the port during a crash or restart gap sees what an open page sends; rotate after a gap you do not trust. With `STRAW_BOSS_DESK=1` (a desk shell shows the page itself) it opens no browser and the page leaves out Phone and Stash. Only `/boss gui stop` keeps the GUI stopped, until the next `/boss gui` or `cli.mjs up`; `/boss stash` and `/boss close all` do not start a stopped GUI. The header's Server button (this computer's page only) shows the server's state, restarts it, and shows its log. Type into a session from its comms view, or work its terminal with the key pad under the terminal tile, or on a desktop by clicking into it and typing; answer a waiting `robot_hand` selector, `ask_user_question` questionnaire, or pi-code hook confirmation there or in its alert (so can any extension's `select` and `confirm`, also from a paired device; other dialogs show read-only, to answer in the terminal; `secret_drop` always takes its secret in the terminal, never on a page, local or over the tailnet, because pi-intercom identities are self-reported). Documents a session shows with [pi-herdr-doc-review](https://www.npmjs.com/package/pi-herdr-doc-review) 0.4.0 or newer open beside its comms: HTML in a sandboxed frame whose form answers the agent, text read-only. |
|
|
108
|
+
| `/boss gui remote`, `/boss gui remote off` | Reach the GUI from your phone over your tailnet (`tailscale serve`, never Funnel): pair by QR code (or, in an installed app, by the short code shown beside it), and a phone stays paired (90 days from its last use, `remote off` included) until you unpair it in the Phone tile or the GUI gets a new token (a pairing belongs to the token, which a restart keeps; `/boss gui rotate`, a lost `gui-secrets.json`, or a taken port makes a new one and the old pairings are cleared); remote access stays on across a restart or a new server until `remote off`, and a paired phone keeps working after a restart; after a new token a phone pairs again: in the browser by scanning the QR code, in an installed app by typing the pairing code (see below); off removes only its own serve entry. The serve entry points at a second loopback listener of the sb server's GUI, so a request is remote because of the listener it arrived on, whatever headers it carries. The page installs as an app (Add to Home Screen, or Chrome's Install) with a fixed entry, `https://<this machine>.<tailnet>.ts.net:8443/sb-app/`, as its start URL (a token-free address on the tailnet listener only): open with a pairing, it leads to the current page; open without one (after a new token, or on iOS, where the app keeps cookies of its own and scanning the QR in Safari never reaches it), it shows a field for the **pairing code** that `/boss gui remote` prints under the QR (and the Phone tile shows beside it). The code is 8 characters, works once within ten minutes, and is void after five wrong tries until you ask this computer for a new one. An app installed before this entry existed opens its old address, which now leads to the entry as well. |
|
|
109
|
+
| `node dist/server/cli.mjs up --dir <folder> --label <name>` (a shell, not a pi command) | The desk steps of `up`, for a shell that shows the page itself (straw-boss-desk): with `STRAW_BOSS_DESK=1` set in the environment of `herdr server` and of this command, it installs Herdr's pi integration when it is not current, makes the shell's home base (a workspace in the folder, recorded in `desk.json` and found again by its workspace id), has the sb server stand in for its tower, waits for the GUI, and prints one JSON line with `url`, `workspace`, `pane`, `tower`, `created`, and `integration`. Idempotent: a second run opens nothing. Without the switch it exits 2. See [Desk mode](docs/how-it-works.md#desk-mode-up---dir). |
|
|
106
110
|
|
|
107
111
|
Subagents and sessions in Herdr worktree workspaces never join: the session that launched them speaks for them. Outside Herdr the extension does nothing.
|
|
108
112
|
|
|
@@ -112,7 +116,7 @@ An optional Herdr plugin in [`herdr-plugin/`](herdr-plugin) turns the sidebar's
|
|
|
112
116
|
It lists the head tower's workspace first, in each workspace the tower, then each tab's main agent and members, and every subagent right under the session that launched it, even in a worktree workspace.
|
|
113
117
|
The view is on whenever the Herdr server starts, and one key switches it off and on again.
|
|
114
118
|
pi-straw-boss writes the sort key (`sb_order`), a role label (`sb_mark`) and, on subagents, a tree branch (`sb_indent`) and the subagent's name (`sb_name`) the view and your sidebar rows can use.
|
|
115
|
-
It needs Herdr 0.9.
|
|
119
|
+
It needs Herdr 0.9.5 or newer and node.
|
|
116
120
|
|
|
117
121
|
<p align="center"><img src="docs/sidebar-net-view.png" width="308" alt="Herdr's sidebar in the net view: each workspace's tower with the radio tower glyph first, each main agent on two rows with a star and its tab's label, and every subagent on a tree branch under the session that launched it"></p>
|
|
118
122
|
|
package/README.zh-TW.md
CHANGED
|
@@ -31,13 +31,14 @@
|
|
|
31
31
|
- **每個工作區一座塔台。** 工作區出現第一個主智慧體時,塔台就在自己的分頁開起來,固定排在最前面。它負責協調各個主智慧體和其他塔台;沒有 session 負責的工作,它會開一個分頁、啟動新的主智慧體來處理。你不用跟它說話。
|
|
32
32
|
- **即時儀表板**在塔台裡:誰加入了,他們和他們的子智慧體正在做什麼。
|
|
33
33
|
- **塔台之間可以直接溝通。** 塔台能列出每個工作區的塔台(`tower_list`:訊息會送到誰、各分頁在做什麼),也能對其中一座或全部發訊息(`tower_send`);沒有塔台的工作區,訊息改送它的主智慧體,沒有主智慧體就送成員。`call_tower`、`boss_broadcast`、`tower_send` 的每則訊息開頭都有一行程式寫的標頭:誰送的、什麼角色、送給誰、要不要回覆([細節](docs/how-it-works.md#talking-between-towers),英文)。
|
|
34
|
-
- **工作看板。**
|
|
34
|
+
- **工作看板。** 主智慧體的看板由它的待辦清單和名稱自動填入(`board_set` 可覆寫);塔台讀每個主智慧體的項目(`board_read`),本機的,加上 Straw Link 團隊中隊友電腦上的,這樣塔台分派工作時知道各主智慧體做到哪([細節](docs/how-it-works.md#the-work-board))。
|
|
35
35
|
- **塔台會關掉自己開的主智慧體。** 塔台替請求開出的主智慧體做完後,向發話者和那座塔台各回報一次;塔台確認裡面沒有東西在跑,就用 `boss_close_main` 把它關掉([細節](docs/how-it-works.md#closing-an-opened-main),英文)。
|
|
36
36
|
- **給塔台的摘要**:自塔台上一輪以來,工作區裡有誰加入、啟動了哪些子智慧體、誰改了名字;塔台下一輪會讀進來一次,讀完就清掉([細節](docs/how-it-works.md#the-towers-digest))。
|
|
37
37
|
- **瀏覽器畫面** `/boss gui` 看得到整張網:每個工作區是一座基地,裡面有塔台、智慧體和子智慧體,畫面會動,但只能看。點基地可以放大,點單位可以把它的對話當成即時通訊紀錄來讀;在等你回覆的單位會排成警示,按空白鍵開下一則,按 F 放大最上面的對話框,按 Esc 關掉它(打字時都不會觸發);回答問題也可以只用鍵盤:方向鍵選項目,Tab 換題,Enter 確認並跳到下一題。頂端齒輪「設定」裡有兩個開關:單位在等你、出錯或完成時,一個會跳系統通知,一個會播音效;已完成的單位另外排在自己的清單裡,可以一個一個清,也可以一次全清;地圖上已結束的子智慧體也可以一個一個移除,或用位置列旁的「移除已完成」一次全移除。單位的通訊畫面也會列出它在背景跑的 Monitor,出錯或太久沒輸出的 Monitor 會列進標頭的「通知」(只有在等你回答的單位才會跳出醒目的警示,出錯和完成都只是安靜的通知);自己閒置、但它的子智慧體在工作或等待,或它的 Monitor 還在跑的單位,會顯示成帶光暈的「指揮中」;只在等 Monitor 跑完的單位,備註會用紅字顯示「監看中」。在桌面上點進單位的終端機,就能直接用鍵盤操作它。畫面有英文和正體中文,預設跟隨瀏覽器語言,也可以從頂端「設定」裡的語言選單切換。地圖最後一張「+新基地」會在選定的資料夾開一座基地,裡面先有一位成員、沒有塔台。沒有塔台的基地只能加成員(基地上的「+成員」開在新分頁,小隊上的開在該小隊旁),等成員自己升格時才會開塔台;有塔台的基地只能加主智慧體(「+主智慧體」,各開在自己的分頁)。在 session 的輸入框貼上、拖進或用「+」選的檔案(最多 20 MB)會存到私有的暫存資料夾,路徑放進訊息。開啟表單都可以先填第一句指令;資料夾選擇只能在家目錄以下,也不會列出點開頭的資料夾。
|
|
38
38
|
- **廣播**給一個分頁、一個工作區、所有塔台(沒有塔台的工作區改送主智慧體或成員),或所有 session。
|
|
39
39
|
- **分頁保持整齊。** pi 在分頁裡啟動或結束時,分頁裡的 pane 會重新平均分配,一個一個切出來的 worker 就不會留下一長串對半切的窄 pane。
|
|
40
40
|
- **斷線的子智慧體會被提醒回報。** 子智慧體做完後還開著,但開出它的 pi 已經重開、收不到它的結果時,它會收到一則 intercom,請它把最終報告送回去,只會送一次([運作方式](docs/how-it-works.md#orphaned-subagents))。
|
|
41
|
+
- **Herdr 重啟後被還原成一般 pi 的子智慧體會被接回來。** Herdr 重啟時(`resume_agents_on_restore`)會在每個子智慧體的 pane 裡重開一個普通的 `pi --session`,少了讓它成為子智慧體的設定,結果永遠送不回來。Straw Boss 會關掉那個被還原的 pane,並請開出它的 session 用 pi-herdr-agents 的 `subagent_resume` 重新接手;受管 worktree 的子智慧體則保留原 pane,只回報給開出它的 session([運作方式](docs/how-it-works.md#subagents-a-herdr-restore-brought-back-plain),英文)。
|
|
41
42
|
- **Herdr 側邊欄的網路檢視。** 一個選用的 plugin 會把 Agents 清單排成網的樣子:塔台在前,每個子智慧體排在開出它的人底下。預設開啟,按一個鍵就能切換。
|
|
42
43
|
- **清理閒置的 worktree pane。** 另一個選用的 plugin 會關掉智慧體在 worktree 工作區留下的 pane,移除乾淨且沒有東西在用的 checkout,並保留你釘選的工作區。
|
|
43
44
|
|
|
@@ -50,6 +51,7 @@ pi install npm:pi-straw-boss
|
|
|
50
51
|
### 需求
|
|
51
52
|
|
|
52
53
|
- pi 要跑在 [Herdr](https://herdr.dev) 0.9.4 以上。
|
|
54
|
+
- Herdr 的 pi 整合(`herdr integration install pi`):沒有它,Herdr 不會替窗格標出 pi session,該 session 就無法加入網;每個 session 啟動 20 秒後若發現缺少,會警告一次。
|
|
53
55
|
- [pi-intercom](https://www.npmjs.com/package/pi-intercom) 0.18.1 以上:網的頻道、訊息,以及 GUI 轉送對話框,都是透過它,sb server 的連線也是;版本較舊或沒裝時,sb server 起不來(`start-error.json` 與 `boss_server status` 會說明)。
|
|
54
56
|
- Windows 支援是實驗性的:擴充套件在 Windows 上透過 Herdr 的 named pipe 連線,側邊欄 plugin 用 `PATH` 上的 `node` 執行,worktree reaper 則只支援 macOS 和 Linux([差異在哪](docs/how-it-works.md#windows),英文)。
|
|
55
57
|
|
|
@@ -84,22 +86,24 @@ pi install npm:pi-straw-boss
|
|
|
84
86
|
|---|---|
|
|
85
87
|
| `boss_promote` | 成為這個分頁的主智慧體(分頁已經有主智慧體時會被拒絕)。 |
|
|
86
88
|
| `boss_status` | 列出各個主智慧體、這個工作區的塔台,以及其他塔台。 |
|
|
87
|
-
| `call_tower` |
|
|
89
|
+
| `call_tower` | 傳訊息給這個工作區的塔台,或別的工作區的塔台(訊息開頭有標頭)。`why` 說明原因:`milestone`(完成一個階段)、`shared`(要動共用的東西之前)、`blocked`(卡住或在等),主智慧體只在這三個時機呼叫塔台;只是通知時可設 `reply: false`。 |
|
|
88
90
|
| `boss_open_main` | 只有塔台能用:替沒有 session 負責的請求開一個分頁,啟動新的主智慧體。 |
|
|
89
91
|
| `boss_close_main` | 只有塔台能用:關掉這座塔台自己開的主智慧體,裡面沒有東西在跑時才會關。 |
|
|
90
92
|
| `tower_list` | 只有塔台能用:列出每個工作區的塔台、訊息會送到誰、它的狀態,以及各分頁在做什麼。 |
|
|
91
93
|
| `tower_send` | 只有塔台能用:傳訊息給另一座塔台(用工作區 id 或名稱),或全部塔台。 |
|
|
92
94
|
| `board_read` | 只有塔台能用:看工作看板,也就是各主智慧體正在做什麼、做到哪;本機的,加上 Straw Link 團隊中隊友電腦上的。 |
|
|
93
|
-
| `board_set` |
|
|
95
|
+
| `board_set` | 分頁的主智慧體用:覆寫自己的看板項目(一行目前的工作,加最多 8 個清單項),或用 `auto: true` 交還給依待辦清單和名稱的自動填入。 |
|
|
94
96
|
| `boss_broadcast` | 傳訊息給一個分頁、一個工作區、所有塔台,或所有 session(訊息開頭有標頭)。 |
|
|
95
97
|
| `boss_rename` | 用一個短語替這個 session 命名,說明它現在在做什麼;net 與 GUI 會顯示它,主智慧體的分頁也會改成這個名稱。主智慧體換工作時會呼叫它。 |
|
|
96
98
|
| `/boss` | 接手成為這個分頁的主智慧體。 |
|
|
97
99
|
| `/boss status`、`/boss tower` | 顯示狀態;開啟塔台並切換過去。 |
|
|
100
|
+
| `/boss memory [-w workspace]`、`/boss memory confirm P1`、`reject P1`、`add standing\|decision <內容>`、`edit S1 <內容>`、`delete D1`、`resolve W1` | 在 pi 裡讀取與修改塔台的記憶(常駐指示、決定、等待),並回應塔台的提議;塔台只能提議,你確認才生效。GUI 的記憶面板是同一個操作。見 [Tower memory](docs/how-it-works.md#tower-memory)。 |
|
|
98
101
|
| `/boss close all` | 讓這個基地的塔台、主智慧體和成員結束,連同 shell 一起關掉,不存 stash。會先用 stash 的同一套檢查;有會遺失的東西(正在跑的回合、排隊中的訊息、對話框、Monitor、子智慧體、前景有程式的 shell)就什麼都不關,並列出所有原因。其他基地完全不碰。 |
|
|
99
102
|
| 網頁上的「收起」「已收起」「接回」 | 基地的「收起」以基地名稱收起它;上方的「已收起」列出收起的基地,按「接回」打開。基地的「關掉」會先檢查,和 `/boss close all` 一樣。 |
|
|
100
103
|
| `/boss stash [名稱]`、`/boss pop [名稱]` | 把整個基地(塔台、主智慧體、成員和閒置的 shell)收起來並關掉;之後再打開,每個 pi 都從自己的 session 檔接回原本的角色。只要有接回後會遺失的東西就拒絕並說明原因:正在跑的回合、排隊中的訊息、開著的對話框、執行中的 Monitor、子智慧體,或前景有程式在跑的 shell。 |
|
|
101
|
-
| `/boss gui`、`/boss gui stop` | 在瀏覽器開啟網(任何 session 都能開,不會加入任何東西);停止它的伺服器,在哪個 session
|
|
102
|
-
| `/boss gui remote`、`/boss gui remote off` | 透過你的 tailnet 用手機連 GUI(`tailscale serve`,絕不用 Funnel):掃 QR code
|
|
104
|
+
| `/boss gui`、`/boss gui stop`、`/boss gui rotate` | 在瀏覽器開啟網(任何 session 都能開,不會加入任何東西);停止它的伺服器,在哪個 session 都可以。整台機器只跑一個伺服器,網址會保留(見下):開它的 session `/reload` 之後會重開(網址不變);跑它的 session 結束時(關掉 pane、離開 pi、當機),另一個還開著的 session 會在幾秒內重開它(網址不變)(塔台優先;pi-straw-boss 版本比伺服器舊的 session 要等約六秒才接手,直到下一個較新的 session 再接回去);之後才啟動的 session 也會把停著的伺服器重開,即使所有 session 都離開過或機器重開機;版本較新的 session 會接手,但開著的頁面不會自動換成新版:它會顯示「這個網址已失效」,要用 `/boss gui` 重開。網址裡的 token 會跨過重啟保留:伺服器重啟、升級、當機、重開機,或 `/boss gui stop` 之後再 `/boss gui`,都沿用同一個 token(存在 `gui-secrets.json`,連同埠號),開著的分頁會自行重新連線,手機仍維持配對。只有 `/boss gui rotate`(會先確認;換新 token 與 CSRF 密鑰、解除所有手機的配對並開啟新網址)、`gui-secrets.json` 遺失或損毀,或下次啟動時埠號被占用,才會換新 token:舊網址回 403,手機要重新掃 QR code。保留 token 的代價是你選擇接受的:當機或重啟的空檔裡,這台機器上其他帳號若搶先佔用該埠,會看到開著的頁面送出的內容;對空檔不放心時請 rotate。設了 `STRAW_BOSS_DESK=1`(桌面殼自己顯示頁面)時,它不會開瀏覽器,頁面也不顯示 Phone 與 Stash。只有 `/boss gui stop` 會讓它維持停止,直到下一次 `/boss gui`;`/boss stash` 和 `/boss close all` 不會把停著的伺服器重開。可以在通訊畫面直接打字給某個 session,或用終端機畫面下方的按鍵面板操作它的終端機,在桌面上也可以點進終端機直接打字;在等回覆的 `robot_hand` 選單、`ask_user_question` 問卷或 pi-code 的 hook 確認,可以在那裡或它的警示裡作答(任何 extension 的 `select` 和 `confirm` 也可以,`confirm` 也可以從配對的裝置作答;其他對話框只能看,要回到終端機回答;`secret_drop` 的機密一律在終端機輸入,任何頁面(本機或 tailnet)都不接受,因為 pi-intercom 的身分是自己申報的,無法驗證)。session 用 [pi-herdr-doc-review](https://www.npmjs.com/package/pi-herdr-doc-review) 0.4.0 以上顯示的文件,會開在它的通訊畫面旁邊:HTML 放在沙箱框架裡,表單送出的答案會傳給智慧體;純文字只能讀。 |
|
|
105
|
+
| `/boss gui remote`、`/boss gui remote off` | 透過你的 tailnet 用手機連 GUI(`tailscale serve`,絕不用 Funnel):掃 QR code 配對(已安裝的 app 則輸入 QR 旁邊顯示的短配對碼),手機配對後的紀錄會保留(從最後一次使用起算 90 天,重啟與 `remote off` 都不影響),直到你在「手機」視窗解除配對;遠端存取在 stop、`/reload`、換新伺服器之後仍會保持開啟,直到 `remote off`;伺服器重啟後 token 不變,已配對的手機照常使用;GUI 換新 token(`/boss gui rotate`、`gui-secrets.json` 遺失,或埠號被占用)時,舊的配對全部清除(cookie 綁在舊 token 的路徑上),手機要重新配對:瀏覽器掃 QR code,已安裝的 app 輸入配對碼(見下);關閉時只移除它自己的 serve 設定。serve 指向 GUI 伺服器的第二個 loopback 監聽埠,請求算不算遠端取決於它進來的監聽埠,不看它帶什麼標頭。頁面可以安裝成 app(加入主畫面,或 Chrome 的「安裝」):app 的起始網址是固定入口 `https://<這台機器>.<tailnet>.ts.net:8443/sb-app/`(沒有 token,只在 tailnet 監聽埠上):已配對時它會帶你到目前的頁面;沒有配對時(換新 token 後,或 iOS 上 app 有自己的 cookie、在 Safari 掃 QR code 永遠到不了 app),它會顯示輸入欄,輸入 `/boss gui remote` 在 QR code 下方印出的**配對碼**(「手機」視窗也顯示在 QR code 旁)。配對碼 8 個字元,十分鐘內只能用一次,輸錯五次後作廢,要在這台電腦上重新取得新的才能再試。在這個入口出現之前安裝的 app,舊網址現在也會導向入口。 |
|
|
106
|
+
| `node dist/server/cli.mjs up --dir <資料夾> --label <名稱>`(給外殼程式用,不是 pi 指令) | `up` 的桌面步驟,給自己顯示頁面的外殼程式(straw-boss-desk)使用:在啟動 `herdr server` 與執行這個指令的環境都設了 `STRAW_BOSS_DESK=1` 時,它會在 Herdr 的 pi 整合不是最新時安裝,建立外殼的家基地(在該資料夾開一個工作區,記在 `desk.json`,之後以工作區 id 找回),讓 sb server 代替這個工作區的塔台,等 GUI 起來,最後印出一行 JSON,內有 `url`、`workspace`、`pane`、`tower`、`created`、`integration`。重複執行不會多開東西;沒設這個開關時以代碼 2 結束。詳見[桌面模式](docs/how-it-works.md#desk-mode-up---dir)。 |
|
|
103
107
|
|
|
104
108
|
子智慧體,以及在 Herdr worktree 工作區裡的 session,都不會加入網,由開出它們的 session 代表它們。不在 Herdr 裡時,這個擴充套件什麼都不做。
|
|
105
109
|
|
|
@@ -109,7 +113,7 @@ pi install npm:pi-straw-boss
|
|
|
109
113
|
它先列出首席塔台(head tower)所在的工作區;每個工作區裡先列塔台,再列各分頁的主智慧體和成員,每個子智慧體緊接在開出它的 session 底下,即使它在 worktree 工作區裡也一樣。
|
|
110
114
|
Herdr server 啟動時這個檢視就會打開,按一個鍵可以關掉,再按一次打開。
|
|
111
115
|
pi-straw-boss 會寫入排序鍵(`sb_order`)、角色標記(`sb_mark`),子智慧體另外有樹狀分支(`sb_indent`)和它的名稱(`sb_name`),網路檢視和你自己的側邊欄列設定都可以用。
|
|
112
|
-
需要 Herdr 0.9.
|
|
116
|
+
需要 Herdr 0.9.5 以上和 node。
|
|
113
117
|
在 Windows 上,切換動作是 `wayne930242.straw-boss.net-windows`(Herdr 要求動作 id 在各平台之間不能重複)。
|
|
114
118
|
|
|
115
119
|
<p align="center"><img src="docs/sidebar-net-view.png" width="308" alt="Herdr 側邊欄的網路檢視:每個工作區的塔台排第一,前面是訊號塔圖示;每個主智慧體佔兩列,有星號和它的分頁名稱;每個子智慧體以樹狀分支排在開出它的 session 底下"></p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{a as t,i as n,n as r,r as i,t as a}from"./sending-aEpvzoz2.js";import{X as o,dt as s}from"./index-BwRZ1vKG.js";var c=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),f=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),p=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),m=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),g=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),_=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),v=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),y=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,b=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,x=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`安全考量,遠端不支援輸入機密。請到執行 GUI 的那台電腦的終端機中回答。`:`For security, entering a secret is not supported remotely. Answer it in the terminal on the computer the GUI runs on.`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`機密內容只能在終端機輸入,這裡不接受。請到執行 GUI 的那台電腦的終端機中回答。`:`A secret is entered in the terminal only, not here. Answer it in the terminal on the computer the GUI runs on.`),M=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),R={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function z(e,t,n,r,i){let{q:a}=n,o=r[a],s=R[e]??0,c=e===`ArrowUp`,l=c||e===`ArrowDown`,u=()=>({to:r.map((e,t)=>({q:(a+1+t)%r.length,part:`opt`})).find(e=>e.q!==a&&!i[e.q])??`send`});if(e===`Tab`)return t?n.part===`opt`&&a>0?{to:{q:a-1,part:`opt`}}:void 0:a<r.length-1?{to:{q:a+1,part:`opt`}}:void 0;if(!t){if(n.part===`opt`){let t=n.o+s;if(s)return t>=0&&t<o.options?{to:{q:a,part:`opt`,o:t},...o.multiple?{}:{pick:t}}:{to:s>0&&o.own?{q:a,part:`own`}:n};if(e===`Enter`||e===` `&&!o.multiple)return{...u(),...o.multiple?{}:{pick:n.o}}}else if(n.part===`own`){if(e===`Enter`)return u();if(l)return{to:c?{q:a,part:`opt`,o:o.options-1}:{q:a,part:`note`}}}else if(c)return{to:{q:a,part:`own`}}}}function B(e,t,n){let r=e=>Math.max(0,e.opts.findIndex(e=>e.getAttribute(`aria-checked`)===`true`)),i=(e,t)=>e.opts.forEach((e,n)=>e.setAttribute(`tabindex`,n===t?`0`:`-1`)),a=e=>{for(let[n,r]of t.entries()){let t=r.opts.indexOf(e);if(t>=0)return{q:n,part:`opt`,o:t};if(e===r.own||e===r.note)return{q:n,part:e===r.own?`own`:`note`}}};t.forEach(e=>i(e,r(e)));let o=e=>{let n=a(e.target);n?.part===`opt`&&i(t[n.q],n.o)};e.addEventListener(`focusin`,o),e.addEventListener(`click`,o);let s=!1;return e.addEventListener(`keydown`,e=>{let i=a(e.target);if(!i||e.ctrlKey||e.altKey||e.metaKey||e.isComposing)return;let o=e.target;if(i.part!==`opt`&&(e.key===`ArrowUp`?o.selectionStart!==0:e.key===`ArrowDown`&&o.selectionEnd!==o.value.length))return;let c=z(e.key,e.shiftKey,i,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own})),t.map(e=>e.answered()));if(!c||(e.preventDefault(),e.repeat&&[`Enter`,` `].includes(e.key)))return;if(s=e.key===` `,c.pick!==void 0){let e=t[i.q].opts[c.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let l=c.to===`send`?void 0:t[c.to.q],u=c.to===`send`?n():c.to.part===`opt`?l.opts[c.to.o??r(l)]:c.to.part===`own`?l.own:l.note;u&&!u.disabled&&u.focus()}),e.addEventListener(`keyup`,e=>s&&e.key===` `&&(s=!1,e.preventDefault())),()=>t[0]?.opts[r(t[0])]}var V=e=>e.multiple?d():e.freeform&&e.options.length?u():``,H=(e,t)=>o(`div`,{class:`ask-one`},e.header&&o(`b`,{class:`ask-head`},e.header),o(`p`,{class:`ask-q`},e.question),e.context&&o(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&o(`ol`,{class:`ask-opts`,"aria-label":S()},...e.options.map(e=>o(`li`,{class:`ask-opt`},o(`b`,null,e.title),e.description&&o(`small`,null,e.description)))),t&&V(e)&&o(`small`,{class:`ask-how`},V(e))),U=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),W=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),G=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),K=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),q={digest:E,"not-allowed":O,malformed:D};function J(e){let{outcome:i,reason:a,by:o}=e.body;return i===`accepted`?[`ok`,n()]:i===`stale`?[`error`,o===`local`?I():o===`cancel`?P():F()]:i===`rejected`?[`error`,(Object.hasOwn(q,String(a))?q[String(a)]:k)()]:i===`busy`?[`error`,t()]:i===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,a??s({status:e.status})]}var Y=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,X=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function Z(e,t,n=location.hostname!==`127.0.0.1`,s,u){let d,y,b,E=!1,D=!1,O;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>y&&!y.el.contains(e.target)&&(y.lost=void 0));let k=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),P=()=>{if(!y)return;let e=document.activeElement;e&&e!==document.body&&e!==y.lost&&(y.lost=void 0),y.controls.forEach(e=>e.disabled=!E||D||y.done),y.send&&(y.send.disabled=!E||D||y.done||!y.pick()),e&&y.el.contains(e)&&e.disabled&&(y.lost=e);let t=y.lost;t&&!t.disabled&&y.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),y.lost=void 0)};async function F(e,n){[e.sending,D,e.spell]=[!0,!0,!1],P(),k(e.note,``,a());let s=await t(`answer`,n).catch(()=>void 0),c=o(`button`,{type:`button`,class:`cmp-link`},i());c.onclick=()=>void F(e,n);let[l,d,f]=s?J(s):[`error`,r(),!0];[e.done,e.sending,D,e.busy]=[!s||Y(s),!1,!1,s?.body.outcome===`busy`],k(e.note,l,d,...f?[c]:[]),P(),e.note.scrollIntoView?.({block:`nearest`}),u&&s?.body.outcome===`accepted`&&setTimeout(u,1200)}let I=(e,t,n,r,i)=>{let a=o(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},o(`b`,i?{"data-n":String(i)}:null,t),...n.filter(Boolean).map(e=>o(`small`,null,e)));return a.onclick=r,a};function R(e,t){let r,i=W(t).map(e=>I(`radio`,U(e.label),[e.note&&U(e.note)],()=>(r=e.i,i.forEach((n,r)=>n.setAttribute(`aria-checked`,String(W(t)[r].i===e.i))),P()),e.i+1)),a=t.select?.copy!==void 0&&o(`button`,{type:`button`,class:`cmp-link`},h());a&&(a.disabled=!navigator.clipboard,a.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>k(e.note,`ok`,m()),()=>k(e.note,`error`,p())));let s=i.filter((e,r)=>!(n&&W(t)[r].hereOnly));return i.forEach(e=>!s.includes(e)&&(e.disabled=!0)),e.pick=()=>r===void 0?void 0:{choice:r},e.first=B(e.el,[{opts:i,multiple:!1,answered:()=>r!==void 0}],()=>e.send),e.controls=s,[o(`pre`,{class:`ask-title`},U(t.select.title)),o(`div`,{class:`ask-opts`,role:`radiogroup`,"aria-label":f()},...i),o(`div`,{class:`ask-acts`},e.send,a)]}function z(e,t){let n=t.questions.map(()=>({picks:new Set,text:o(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:T(),"aria-label":w()}),note:o(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:v(),"aria-label":_()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],s=t.multiple?`checkbox`:`radio`,c=t.options.map((e,n)=>I(s,e.title,[e.description,e.preview&&g()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),c.forEach((e,t)=>e.setAttribute(`aria-checked`,String(a.picks.has(t)))),P()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),c.forEach(e=>e.setAttribute(`aria-checked`,`false`))),P()),e.controls.push(...c,a.text,a.note),r.push({opts:c,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),o(`div`,{class:`ask-one`},t.header&&o(`b`,{class:`ask-head`},t.header),o(`p`,{class:`ask-q`},t.question),o(`div`,{class:`ask-opts`,role:t.multiple?`group`:`radiogroup`,"aria-label":S()},...c),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>G(e.picks,e.text.value,e.note.value))}:void 0,e.first=B(e.el,r,()=>e.send),[...i,o(`div`,{class:`ask-acts`},e.send)]}function q(e){let t=e.asks??(e.ask?[e.ask]:[]),r=t.length>1,i=e.answer,a={key:X(e),el:o(`section`,{class:`ask`}),note:o(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),controls:[],pick:()=>void 0,done:!1,sending:!1};i&&((a.send=o(`button`,{type:`button`,class:`ask-send`},M())).onclick=()=>void(a.pick()&&F(a,K(i,a.pick(),crypto.randomUUID()))));let u=e.tool===`secret_drop`,d=o(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${r?l():c()} ${r||!t[0]?``:V(t[0])}`.trim()),f=s&&e.tool!==`secret_drop`&&o(`button`,{type:`button`,class:`cmp-link`},N());f&&(f.onclick=s);let p=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[o(`p`,{class:`ask-why`},x({tool:e.tool}))]:[];return a.el.append(...p,...i&&!u?i.select?R(a,i):z(a,i):[...t.length?t.map(e=>H(e,r)):[o(`p`,{class:`ask-why`},u?n?A():j():e.why??L())],o(`div`,{class:`ask-acts`},u?o(`p`,{class:`ask-term`},c()):d,f)],a.note),a}let Z=(t,n)=>{let r=document.activeElement;y&&y!==n&&(y.focus=y.el.contains(r)?r:void 0),[d,y,b]=[t,n,n?.send?n:b],e.replaceChildren(...n?[n.el]:[]),P(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=y&&!y.done?y.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},update(e,t){E=t,e&&(O=void clearTimeout(O)),!e&&(y?.done||y?.sending)?O??=setTimeout(()=>(O=void 0,Z()),6e3):e?y&&(X(e)===y.key||!e.answer&&(y.done||y.sending)&&e.callId===d?.callId)?((y.busy||y.sending)&&!e.answer?y.spell=!0:y.busy&&y.spell&&e.answer&&([y.done,y.busy]=[!1,!1],k(y.note,``,C())),d=e):Z(e,b?.key===X(e)&&!b.done?b:q(e)):Z(),P()}}}export{Z as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-D3RS3c_W.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{O as t,Q as n,X as r,d as i,h as a,n as o,w as s}from"./index-BwRZ1vKG.js";import{a as c,i as l,n as u,o as d,r as ee,t as te}from"./views-BmcT2brW.js";var ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`可能已被當機的 run 處理過:動手前先確認。`:`A run that crashed may already have handled this: check before acting.`),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`分支摘要`:`branch summary`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`通訊紀錄`:`Comms log`),f=e=>`context compacted · ${e?.tokens} tokens summarized`,p=e=>`上下文已壓縮 · 摘要了 ${e?.tokens} tokens`,ae=((t,n={})=>(n.locale??e())===`zh-TW`?p(t):f(t)),oe=((t={},n={})=>(n.locale??e())===`zh-TW`?`…(於 1 MB 截斷)`:`… (cut at 1 MB)`),m=e=>`exit ${e?.code}`,h=e=>`結束碼 ${e?.code}`,se=((t,n={})=>(n.locale??e())===`zh-TW`?h(t):m(t)),g=e=>`Image ${e?.n}`,_=e=>`圖片 ${e?.n}`,ce=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),le=((t={},n={})=>(n.locale??e())===`zh-TW`?`圖片無法讀取`:`Image unavailable`),v=e=>`${e?.count} image(s)`,y=e=>`${e?.count} 張圖片`,ue=((t,n={})=>(n.locale??e())===`zh-TW`?y(t):v(t)),de=((t={},n={})=>(n.locale??e())===`zh-TW`?`收到`:`incoming`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`跳到最新`:`jump to latest`),x=e=>`${e?.count} new`,S=e=>`${e?.count} 則新訊息`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),fe=((t={},n={})=>(n.locale??e())===`zh-TW`?`還沒有通訊。`:`No transmissions yet.`),pe=((t={},n={})=>(n.locale??e())===`zh-TW`?`通知`:`notice`),me=((t={},n={})=>(n.locale??e())===`zh-TW`?`細節`:`details`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`表單回覆`:`form answers`),he=((t={},n={})=>(n.locale??e())===`zh-TW`?`訊息,來自`:`message from`),T=e=>`answer from ${e?.from}`,E=e=>`${e?.from} 的回答`,ge=((t,n={})=>(n.locale??e())===`zh-TW`?E(t):T(t)),D=e=>`request from ${e?.from}`,O=e=>`${e?.from} 的請求`,_e=((t,n={})=>(n.locale??e())===`zh-TW`?O(t):D(t)),k=e=>`message from ${e?.from}`,A=e=>`${e?.from} 的訊息`,ve=((t,n={})=>(n.locale??e())===`zh-TW`?A(t):k(t)),j=e=>`reply to your ask from ${e?.from}`,M=e=>`${e?.from} 回覆了你的詢問`,ye=((t,n={})=>(n.locale??e())===`zh-TW`?M(t):j(t)),N=((t={},n={})=>(n.locale??e())===`zh-TW`?`記憶`:`memory`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`監看`:`monitor`),be=((t={},n={})=>(n.locale??e())===`zh-TW`?`本機`:`this computer`),xe=((t={},n={})=>(n.locale??e())===`zh-TW`?`隊友`:`teammate`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`提問,來自`:`question from`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`回報,來自`:`report from`),Se=((t={},n={})=>(n.locale??e())===`zh-TW`?`sb server 的通知`:`notice from the sb server`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`狀態:`:`status of`),R=((t={},n={})=>(n.locale??e())===`zh-TW`?`Straw Link 訊息`:`Straw Link message`),Ce=((t={},n={})=>(n.locale??e())===`zh-TW`?`喚醒鬧鐘`:`wake-up call`),z=((t={},n={})=>(n.locale??e())===`zh-TW`?`塔台事件`:`tower event`),we=((t={},n={})=>(n.locale??e())===`zh-TW`?`在旁開啟`:`open beside`),B=e=>`Open image ${e?.n}`,V=e=>`打開圖片 ${e?.n}`,Te=((t,n={})=>(n.locale??e())===`zh-TW`?V(t):B(t)),H=e=>`show all (${e?.size})`,U=e=>`顯示全部(${e?.size})`,Ee=((t,n={})=>(n.locale??e())===`zh-TW`?U(t):H(t)),De=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示全部參數`:`show all arguments`),W=e=>`◇ thought · ${e?.count} chars`,Oe=e=>`◇ 思考 · ${e?.count} 字元`,ke=((t,n={})=>(n.locale??e())===`zh-TW`?Oe(t):W(t)),Ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`◇ 思考 · 已遮蔽`:`◇ thought · redacted`),je=((t={},n={})=>(n.locale??e())===`zh-TW`?`這座塔台正在待命。有訊息進來時,sb server 會喚醒它跑一個 run;你在這裡送出的第一則訊息就會啟動它。`:`This tower stands by. The sb server wakes it for a run when a message arrives; your first message here starts that run.`),Me=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法取得`:`unavailable`),Ne=((t={},n={})=>(n.locale??e())===`zh-TW`?`你`:`you`);function Pe(){let e=!0,t=0;return{get pinned(){return e},scrolled(n){e=n,n&&(t=0)},hold:()=>void(e=!1),arrived(n){return e||(t+=n),e},jump:()=>void(e=!0,t=0),button:n=>e&&!n?void 0:t&&!n?C({count:t}):b()}}async function Fe(e,t,n,r){let i=()=>e.items.some(e=>e.id===n);for(;!i()&&e.before;)r(e.prepend(await t.older(e.before)));return i()?!0:(r(e.reset(await t.latest())),!1)}function Ie(e=600){let t=[],n,r=!1,i=new Set,a=new Map,o=new Map,s=e=>e.forEach(e=>(i.delete(e.id),e.tools?.forEach(e=>(o.delete(e.id),a.delete(e.id)))));function c(e,t){let n=[];for(let r of e)i.has(r.id)||(i.add(r.id),r.kind===`result`&&r.callId?(a.set(r.callId,r),o.has(r.callId)&&t.add(o.get(r.callId))):(r.tools?.forEach(e=>o.set(e.id,r.id)),n.push(r)));return n}let l=e=>({rebuild:!1,added:[],touched:[],dropped:[],front:!1,...e});return{get items(){return t},get before(){return n},get detached(){return r},result:e=>a.get(e),reset(e){return[t,n,r]=[[],e.before,!1],i.clear(),a.clear(),o.clear(),t=c(e.items,new Set),l({rebuild:!0,added:t})},append(i){if(r)return l({});let a=new Set,o=c(i,a);t.push(...o);let u=t.length>e?t.splice(0,t.length-e):[];return s(u),u.length&&(n=t[0].id),l({added:o,touched:[...a],dropped:u.map(e=>e.id)})},prepend(i){let a=new Set,o=c(i.items,a);t.unshift(...o),n=i.before;let u=t.length>e?t.splice(e):[];return s(u),u.length&&(r=!0),l({added:o,touched:[...a],dropped:u.map(e=>e.id),front:!0})}}}var Le=e=>a(e.role),Re=e=>e?new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}):``,ze=e=>e>=1024?`${(e/1024).toFixed(e>=10240?0:1)} KB`:`${e} B`,Be={intercom_message:he,subagent_result:I,subagent_ping:F,subagent_status:L,"pi-loop-monitor":P,"memory-context":N,"doc-review":w,"straw-tower":z,"straw-link":R},G=e=>{let t=i(`<span class="ava"><svg><use/></svg></span>`);return t.querySelector(`use`).setAttribute(`href`,`#i-${o[e]??e}`),t};function Ve(e){let t=[],n=0;for(let i of e.matchAll(/https?:\/\/[^\s<>)\]]+/g))t.push(e.slice(n,i.index),r(`a`,{href:i[0],rel:`noopener noreferrer`,target:`_blank`},i[0])),n=i.index+i[0].length;return[...t,e.slice(n)]}function K(e,i,{who:a,link:o,docFor:f}){let p=Ie(),m=new Map,h=new Set,g=()=>h.forEach(e=>e.button.isConnected?(e.shown=!0,e.button.hidden=!e.paths.some(e=>f?.(e))):e.shown&&h.delete(e)),_=r(`div`,{class:`chat-list`}),v=r(`div`,{class:`chat-top`}),y=r(`div`,{class:`chat-live`}),b=r(`div`,{class:`chat-end`}),x=r(`button`,{class:`chat-pill`,type:`button`,hidden:``}),S=r(`p`,{class:`chat-empty`},fe()),C=r(`div`,{class:`chat-scroll`,tabindex:`-1`,"aria-label":ie()},v,_,y,b);e.replaceChildren(C,x);let w=Pe(),T=!1,E=!1,D,O,k=0,A=!1,j,M=()=>A||j!==void 0,N=()=>(clearTimeout(j),j=setTimeout(()=>(j=void 0,w.pinned&&!p.detached&&F()),250)),P=(e=w.button(p.detached))=>(x.hidden=!e,x.textContent=e??``),F=()=>(w.jump(),O=void 0,C.scrollTop=C.scrollHeight,P());async function I(e){T=!0;let t=await Fe(p,i,e,e=>(q(e),X(e))).finally(()=>T=!1),r=m.get(e);if(D===e){if(!t||!r)return F();w.hold(),O=r,r.scrollIntoView({block:`center`}),n(r,`lit`),clearTimeout(k),k=window.setTimeout(()=>(O=void 0,r.classList.remove(`lit`)),2e3),P()}}let L=()=>D?void I(D):F(),R=(e,t,n,r)=>{e.disabled=!0,i.entry(n).then(n=>{let i=n&&r(n);if(i===void 0)return void(e.textContent=Me());t.textContent=i,e.remove()},()=>e.textContent=Me())};function z(e,t=0){if(!t||!i.pic)return null;let n=Array.from({length:t},(t,n)=>i.pic(e,n));return r(`div`,{class:`pics`},...n.map((e,t)=>{let i=r(`img`,{src:e,alt:ce({n:t+1}),loading:`lazy`,decoding:`async`}),a=r(`button`,{type:`button`,class:`pic`,"aria-label":Te({n:t+1})},i);return i.addEventListener(`error`,()=>a.replaceWith(r(`em`,{class:`pic-gone`},le()))),a.addEventListener(`click`,()=>void s(async()=>{let{lightbox:e}=await import(`./lightbox-DeyJW1Ta.js`);return{lightbox:e}},__vite__mapDeps([0]),import.meta.url).then(({lightbox:e})=>e(n,t))),a}))}function B(e,t){let n=p.result(e.id),i=r(`pre`,{class:`out`},n?.text??``),a=r(`pre`,{class:`args`},e.args??``),o=e.cut?r(`button`,{class:`more`,type:`button`},De()):null;o?.addEventListener(`click`,()=>R(o,a,t,t=>(e=>e&&`${e.args??``}${e.cut?`\n${oe()}`:``}`)(t.tools?.find(t=>t.id===e.id))));let s=n?.more?r(`button`,{class:`more`,type:`button`},Ee({size:ze(n.bytes??0)})):null;s?.addEventListener(`click`,()=>R(s,i,n.id,e=>e.text));let c=e.name===`show_doc`&&f?r(`button`,{class:`more open`,type:`button`,hidden:``},we()):null;c?.addEventListener(`click`,t=>(t.preventDefault(),e.summary.split(`, `).forEach(e=>f?.(e)?.()))),c&&h.add({paths:e.summary.split(`, `),button:c}),c&&queueMicrotask(g);let l=r(`details`,{class:`act`},r(`summary`,{"data-mark":n?n.isError?`error`:`done`:`working`},r(`b`,{class:`badge`}),r(`code`,null,e.name),r(`span`,{class:`sum`},e.summary),c),a,o,n&&r(`div`,{class:`result`},n.images?r(`em`,null,ue({count:n.images})):null,i,s)),u=n&&z(n.id,n.images);return u?[l,u]:[l]}let V=e=>r(`time`,null,Re(e.at)),H=(e,t,n,i)=>r(`article`,{class:`tx you`},r(`header`,null,V(e),r(`b`,null,Ne()),G(`user`)),r(`div`,{class:`bubble`,title:i},n?r(`small`,{class:`boss-flag`},ne()):null,...Ve(t),z(e.id,e.images))),U=(e,t,n,i={})=>r(`article`,{class:`tx sys`},r(`details`,{class:`notice`},r(`summary`,null,G(`comms`),r(`em`,null,de()),...t,V(e)),i.crashed?r(`small`,{class:`boss-flag`},ne()):null,r(`pre`,null,n),i.raw?r(`details`,{class:`notice-raw`},r(`summary`,null,me()),r(`pre`,{class:`raw`},i.raw)):null)),W=e=>{let t=l(e);return[he(),` `,t.name&&o(t.name)||t.name,t.id?` (${t.id})`:``,` · `,be()]},Oe=e=>e.kind===`link`?[{ask:_e,reply:ye,answer:ge,message:ve}[e.what]({from:e.from}),` · `,xe()]:e.kind===`intercom`?W(e.from):[e.kind===`server`?Se():Ce()];function K(e){switch(e.kind){case`user`:{let t=a().service?ee(e.text):void 0;if(t)return U(e,t.kind===`intercom`?W(t.from):[t.kind===`server`?Se():Ce()],e.text??``);let n=a().service?te(e.text):void 0;return H(e,n?n.body:e.text??``,n?.crashed,n?e.text??``:``)}case`assistant`:{let t=a(),n=r(`pre`,{class:`thought-text`}),i=e.thought?r(`button`,{class:`thought`,type:`button`},e.thought<0?Ae():ke({count:e.thought.toLocaleString()})):null;return e.thought&&e.thought>0&&i?.addEventListener(`click`,()=>R(i,n,e.id,e=>e.thoughtText)),r(`article`,{class:`tx in`},G(t.role),r(`div`,{class:`tx-body`},r(`header`,null,r(`b`,null,Le(t)),e.model?r(`span`,null,e.model):null,V(e),e.stop?r(`span`,{class:`stop`,"data-mark":`error`},e.stop):null),i,n,e.text?r(`div`,{class:`md`},c(d(e.text))):null,e.error?r(`p`,{class:`fault`},e.error):null,...(e.tools??[]).flatMap(t=>B(t,e.id))))}case`bash`:return r(`article`,{class:`tx sys`},r(`details`,{class:`act`},r(`summary`,{"data-mark":e.exit?`error`:`done`},r(`b`,{class:`badge`}),r(`code`,null,`shell`),r(`span`,{class:`sum`},`! ${e.command}`),e.exit?r(`span`,{class:`stop`,"data-mark":`error`},se({code:e.exit})):null),e.text?r(`pre`,{class:`out`},e.text):null));case`notice`:{let t=u(e);return t?.kind===`boss`&&a().service?H(e,t.body,t.crashed,e.text??``):t&&t.kind!==`boss`?U(e,Oe(t),t.body,t.kind===`link`?{raw:t.raw}:{crashed:t.crashed}):U(e,[Be[e.type??``]?.()??e.type??pe(),` `,e.from&&o(e.from)||(e.from??``)],e.text??``)}case`divider`:return r(`article`,{class:`tx rule`},r(`details`,null,r(`summary`,null,e.type===`compaction`?ae({tokens:(e.tokens??0).toLocaleString()}):re()),r(`pre`,null,e.text??``)));default:return r(`article`,{class:`tx note`},e.text??``,` `,V(e))}}function q(e){e.rebuild&&(m.clear(),_.replaceChildren());for(let t of e.dropped)m.get(t)?.remove(),m.delete(t);let t=e.added.map(e=>(m.set(e.id,K(e)),m.get(e.id)));e.front?_.prepend(...t):_.append(...t),E&&!e.front&&!e.rebuild&&t.forEach(e=>(e.classList.add(`fresh`),e.dataset.born=String(Date.now()))),S.remove();let n=a().service;S.textContent=n?.state===`standing`&&!n.run?je():fe(),p.items.length||_.append(S),v.hidden=!p.before,He()}let J=[],Y=new Map;function He(){let e=new Set;for(let n of J){let i=Date.parse(n.startedAt),a=p.items.findIndex(e=>e.at!==void 0&&Date.parse(e.at)>=i);if(a===0&&p.before)continue;let o=a<0?``:p.items[a].id,s=JSON.stringify([o,t(n)]),c=Y.get(n.id);if(e.add(n.id),c&&c.sig===s&&c.el.isConnected)continue;c?.el.remove();let l=t(n),u=r(`article`,{class:`tx rule conv-rule`},r(`div`,null,r(`b`,null,l.title),l.ended?r(`small`,null,l.ended):null));Y.set(n.id,{el:u,sig:s});let d=o?m.get(o):void 0;d?d.before(u):_.append(u)}for(let[t,n]of Y)e.has(t)||(n.el.remove(),Y.delete(t))}let X=e=>e.touched.forEach(e=>{let t=m.get(e),n=p.items.find(t=>t.id===e);if(t&&n){let r=K(n);t.classList.contains(`fresh`)&&Date.now()-Number(t.dataset.born??0)<400&&r.classList.add(`fresh`),t.replaceWith(r),m.set(e,r)}}),Ue=async()=>{if(!T&&p.before&&E){T=!0;try{let e=C.scrollHeight,t=p.prepend(await i.older(p.before));q(t),X(t),C.scrollTop+=C.scrollHeight-e}finally{T=!1}p.before&&C.clientHeight&&v.getBoundingClientRect().bottom>=C.getBoundingClientRect().top&&Ue()}};x.addEventListener(`click`,()=>{D=void 0,p.detached?i.latest().then(e=>(q(p.reset(e)),F())):F()});let Z=[new IntersectionObserver(e=>e.some(e=>e.isIntersecting)&&void Ue(),{root:C}),new IntersectionObserver(e=>C.clientHeight&&(w.scrolled(e.at(-1).isIntersecting),P()),{root:C,rootMargin:`0px 0px 67px`})],Q,We=()=>(Q??(Z[0].observe(v),Z[1].observe(b)),clearTimeout(Q),Q=setTimeout(()=>(Q=void 0,Z.forEach(e=>e.disconnect())),600));C.addEventListener(`scroll`,()=>(We(),!A&&j!==void 0&&N()),{passive:!0}),C.addEventListener(`touchstart`,()=>(A=!0,clearTimeout(j),j=void 0),{passive:!0});for(let e of[`touchend`,`touchcancel`])C.addEventListener(e,()=>(A=!1,N()),{passive:!0});for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])C.addEventListener(e,()=>O=D=void 0,{passive:!0});let $=new ResizeObserver(()=>M()?void 0:w.pinned&&!p.detached?C.scrollTop=C.scrollHeight:O?.scrollIntoView({block:`center`}));return $.observe(_),$.observe(C),{log:C,docs:g,runs(e){JSON.stringify(e)!==JSON.stringify(J)&&(J=e,He())},apply(e){if(e.reset)q(p.reset({items:e.items??[],before:e.before})),E=!0,L();else if(e.items?.length){let t=p.append(e.items);q(t),X(t),w.arrived(t.added.length)&&!p.detached&&!M()?F():P()}},reveal(e){D=e,E&&L()},setLive(e,t){y.dataset.mark=t,y.lastChild?.textContent!==e&&y.replaceChildren(...e?[r(`b`,{class:`badge`}),r(`span`,null,e)]:[])}}}export{K as mountChat,ce as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./open_main_title-Ccbha5pD.js";import{n,t as r}from"./unit_count-DFKHs2Sk.js";import{C as i,S as a,X as o,_ as s,a as c,d as l,g as u,h as d,i as f,it as p,l as m,m as h,o as g,v as _,x as v}from"./index-BwRZ1vKG.js";var y=((t={},n={})=>(n.locale??e())===`zh-TW`?`關閉清單`:`Close the list`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`切換到其他單位`:`Switch to a unit`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`回到主地圖`:`Back to the map`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`所有單位`:`All units`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`指揮中`:`commanding`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`已結束`:`ended`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`錯誤`:`error`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`閒置`:`idle`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`無狀態`:`unknown`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`等待`:`waiting`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`工作中`:`working`),A=.4;function j(e,t,n){let[r,i]=[Math.abs(e),Math.abs(t)];return Math.max(r,i)<10?`wait`:r>=1.7*i&&(n?e<0:e>0)?`drag`:`pass`}var M=(e,t,n)=>Math.abs(n)>=.45?n>0:e>=t*A,N=(e,t)=>t||e.some(e=>e.editable||e.sink||e.scrollsX||[`input`,`textarea`,`select`].includes(e.tag));function P(e){let t=e,n=getComputedStyle(e).overflowX;return{tag:e.tagName.toLowerCase(),editable:t.isContentEditable,sink:e.matches(`.composer, .term-sink`),scrollsX:(n===`auto`||n===`scroll`)&&e.scrollWidth>e.clientWidth+1}}var F=e=>{let t=[];for(let n=e;n;n=n.parentElement)t.push(P(n));return t},I={working:k,waiting:O,idle:E,done:w,error:T,unknown:D,commanding:C},L=(e,t,n)=>(t?w:I[e])({},n&&{locale:n}),R=(e,t)=>t.flatMap(t=>[t,...t.subs.map(e=>({...e,sub:!0}))].map(t=>({id:t.key,key:t.key,ws:e,name:t.name,role:t.role,mark:t.mark,note:t.note,ended:!!t.ended,sub:`sub`in t,control:!!t.control})));function z(e){return e.bases.flatMap(e=>{let t=[{id:`tower`,rows:e.tower?R(e.id,[{...e.tower,role:`tower`}]):[]},...e.tabs.map(t=>({id:t.id,label:p({label:t.label}),rows:R(e.id,t.units)})),{id:`outside`,label:n(),rows:R(e.id,e.outside)}].filter(e=>e.rows.length);return t.length?[{id:e.id,label:e.label,mark:e.mark,groups:t}]:[]})}var B=e=>e.role===`main`&&e.mark===`idle`,V=e=>e.reduce((e,t)=>(t.sub?e.at(-1)?.subs.push(t):e.push({...t,subs:[]}),e),[]),H=()=>l(`<div class="unit"><div class="card"><a class="hit"></a>${f}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><b class="dstate"></b><span class="note"></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button></div><div class="subs"></div></div>`),U=()=>l(`<div class="unit tower-row"><div class="trow"><a class="tower-go">${f}</a><button type="button" class="pair-btn tower-add"></button></div><div class="subs"></div></div>`),W=()=>l(`<section class="dbase"><h3><a></a><small></small></h3><div class="dgroups"></div></section>`),G=()=>l(`<div class="dgroup"><h4></h4><div class="drows"></div></div>`),K=()=>matchMedia(`(max-width: 640px)`).matches;function q(){let e=o(`div`,{class:`drawer-body`}),n=o(`button`,{type:`button`,class:`x`,"aria-label":y()},`×`),l=o(`a`,{class:`drawer-map`},x()),f=o(`button`,{type:`button`,class:`pair-btn`,"data-close":`dismiss-all`,hidden:``}),p=o(`div`,{class:`drawer-sweep`,hidden:``},f);c(l,{view:`map`});let C=o(`aside`,{class:`drawer`,"aria-label":b()},o(`header`,null,o(`b`,null,S()),n),e,o(`footer`,{class:`drawer-foot`},p,l)),w=o(`div`,{class:`drawer-veil`});document.body.append(w,C);let T,E,D=!1,O=0,k=0,A,P=()=>{i(f,T??{bases:[]}),p.hidden=f.hidden;let n=(e,t)=>{c(e.querySelector(`.hit`),{view:`session`,ws:t.ws,key:t.key}),e.querySelector(`.hit`).setAttribute(`aria-label`,`${t.name}: ${L(t.mark,t.ended)}`),e.classList.toggle(`current`,t.key===E),e.toggleAttribute(`data-dismiss`,t.role===`subagent`&&t.ended),e.dataset.key=t.key,h(e,t.mark),m(e.querySelector(`.plate`),t.role,t.mark),_(e,`.name`,t.name),_(e,`.role`,d(t.role)),_(e,`.dstate`,L(t.mark,t.ended)),u(e,`.note`,t.note,t.mark,t.note?void 0:``);let r=e.querySelector(`:scope > .card > .quit-btn`);B(t)?v(r,t):r.hidden=!0,s(e.querySelector(`.subs`),t.subs??[],H,n)},a=(e,r)=>{let i=e.querySelector(`.tower-go`),a=e.querySelector(`.tower-add`),o=T?.bases.find(e=>e.id===r.ws);c(i,{view:`session`,ws:r.ws,key:r.key}),i.setAttribute(`aria-label`,`${r.name}: ${L(r.mark,r.ended)}`),e.classList.toggle(`current`,r.key===E),e.dataset.key=r.key,h(e,r.mark),m(i.querySelector(`.plate`),`tower`,r.mark),a.hidden=!o,o&&(g(a,o),a.textContent=`+`,a.setAttribute(`aria-label`,t({base:o.label}))),s(e.querySelector(`.subs`),r.subs,H,n)};s(e,z(T??{bases:[]}),W,(e,t)=>{h(e,t.mark),_(e,`h3 a`,t.label),c(e.querySelector(`h3 a`),{view:`workspace`,ws:t.id}),_(e,`small`,r({count:t.groups.reduce((e,t)=>e+t.rows.length,0)})),s(e.querySelector(`.dgroups`),t.groups,G,(e,t)=>{_(e,`h4`,t.label??``),e.querySelector(`h4`).toggleAttribute(`hidden`,!t.label),t.id===`tower`?s(e.querySelector(`.drows`),V(t.rows),U,a):s(e.querySelector(`.drows`),V(t.rows),H,n)})})},I=e=>{O=Math.max(0,Math.min(k,e)),C.style.setProperty(`--dx`,`${O}px`),w.style.opacity=String(k?O/k:0),w.style.pointerEvents=O>0?`auto`:`none`},R=e=>{D=e,C.classList.toggle(`on`,e),C.inert=!e,document.documentElement.classList.remove(`drawer-drag`),I(e?k:0)},q=()=>{k=C.offsetWidth,P(),C.classList.add(`on`),document.documentElement.classList.add(`drawer-drag`)};C.inert=!0,document.addEventListener(`touchstart`,e=>{let t=e.target,n=C.contains(t)||t===w;if(A=void 0,!K()||e.touches.length!==1||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(D?!n:N(F(t),!!getSelection()?.toString())))return;let r=e.touches[0],i=D?t.closest(`.unit[data-dismiss] > .card`)??void 0:void 0;A={x0:r.clientX,y0:r.clientY,mode:`wait`,was:D,base:O,last:r.clientX,at:performance.now(),v:0,card:i}},{passive:!0}),document.addEventListener(`touchmove`,e=>{if(!A||A.mode===`pass`)return;let t=e.touches[0],n=t.clientX-A.x0,r=t.clientY-A.y0;if(A.mode===`wait`){let e=j(n,r,A.was);if(e===`wait`)return;if(e===`pass`&&A.card&&j(n,r,!1)===`drag`)A.mode=`card`,A.card.classList.add(`swiping`);else if(e===`pass`)return void(A.mode=`pass`);else A.mode=`drag`,q()}e.preventDefault();let i=performance.now();if(A.v=(t.clientX-A.last)/Math.max(1,i-A.at),[A.last,A.at]=[t.clientX,i],A.mode!==`card`)return I(A.base+n);let a=Math.max(0,n);A.card.style.setProperty(`--sx`,`${a}px`),A.card.style.setProperty(`--so`,String(1-a/A.card.offsetWidth))},{passive:!1});let J=(e,t)=>{e.classList.remove(`swiping`),e.style.removeProperty(`--sx`),e.style.removeProperty(`--so`),t&&(e.classList.add(`gone`),a({key:e.parentElement.dataset.key}).then(t=>t||e.classList.remove(`gone`)))},Y=e=>{let t=A;A=void 0,t?.mode===`drag`&&R(M(O,k,t.v)),t?.mode===`card`&&J(t.card,e.type===`touchend`&&M(Math.max(0,t.last-t.x0),t.card.offsetWidth,t.v))};return document.addEventListener(`touchend`,Y),document.addEventListener(`touchcancel`,Y),w.addEventListener(`click`,()=>R(!1)),C.addEventListener(`click`,e=>e.target.closest(`a[data-route], button[data-open], .x`)&&R(!1)),document.addEventListener(`keydown`,e=>D&&e.key===`Escape`&&(e.preventDefault(),R(!1)),!0),document.addEventListener(`sb-drawer`,()=>(D||q(),R(!D))),{net(e){T=e,D&&P()},route(e){E=e.view===`session`?e.key:void 0,l.toggleAttribute(`aria-current`,e.view===`map`),D&&P()}}}export{q as mountDrawer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{i as t,n,r,t as i}from"./runtime-ZX6HkxDa.js";var a=e=>`${e?.n}d`,o=e=>`${e?.n} 天`,s=((e,t={})=>(t.locale??i())===`zh-TW`?o(e):a(e)),c=e=>`${e?.n}h`,l=e=>`${e?.n} 小時`,u=((e,t={})=>(t.locale??i())===`zh-TW`?l(e):c(e)),d=e=>`${e?.n}m`,f=e=>`${e?.n} 分`,p=((e,t={})=>(t.locale??i())===`zh-TW`?f(e):d(e)),m=e=>`${e?.n}s`,h=e=>`${e?.n} 秒`,g=((e,t={})=>(t.locale??i())===`zh-TW`?h(e):m(e)),ee=((e={},t={})=>(t.locale??i())===`zh-TW`?`警示`:`Alerts`),te=((e={},t={})=>(t.locale??i())===`zh-TW`?`所有基地`:`all bases`),ne=e=>`ally run · ${e?.device}`,re=e=>`隊友 run · ${e?.device}`,ie=((e,t={})=>(t.locale??i())===`zh-TW`?re(e):ne(e)),ae=((e={},t={})=>(t.locale??i())===`zh-TW`?`唯讀查看這個隊友 run 的通訊`:`Read this ally run's comms (read only)`),oe=((e={},t={})=>(t.locale??i())===`zh-TW`?`還看不到它的通訊:尚未取得這個 run 的工作階段檔`:`Its comms are not shown yet: the run's session file is not known`);function se(e,t,n,r){if(typeof t!=`string`||n!==void 0&&!r)return new e(t,n);let i=se;if(n!==void 0){let r=i.prototypeKeys??=new Set([`constructor`,`__defineGetter__`,`__defineSetter__`,`hasOwnProperty`,`__lookupGetter__`,`__lookupSetter__`,`isPrototypeOf`,`propertyIsEnumerable`,`toString`,`valueOf`,`__proto__`,`toLocaleString`]);if(Object.getOwnPropertyNames(Object.prototype).some(e=>!r.has(e)))return new e(t,n)}let a=[];for(let r of Object.keys(n??{}).sort()){let i=n[r];if(i!==void 0){if(i!==null&&![`string`,`number`,`boolean`].includes(typeof i)||typeof i==`number`&&!Number.isFinite(i))return new e(t,n);a.push([r,i])}}let o=JSON.stringify([t,a]),s=i.caches??=new WeakMap,c=s.get(e);if(c||(c=new Map,s.set(e,c)),c.has(o))return c.get(o);let l=new e(t,n);if(c.size>=256){let e=c.keys().next().value;e!==void 0&&c.delete(e)}return c.set(o,l),l}function _(e,t,n,r=!1){return se(Intl.PluralRules,e,n,r).select(Number(t)-Number(n?.offset??0))}var ce=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} ally run`:t===`other`?`${e?.count} ally runs`:`ally_runs`},le=e=>`${e?.count} 個隊友 run`,ue=((e,t={})=>(t.locale??i())===`zh-TW`?le(e):ce(e)),de=e=>`${e?.team} · teammate`,fe=e=>`${e?.team} · 隊友`,pe=((e,t={})=>(t.locale??i())===`zh-TW`?fe(e):de(e)),me=((e={},t={})=>(t.locale??i())===`zh-TW`?``:`.`),he=((e={},t={})=>(t.locale??i())===`zh-TW`?`最後更新:`:`Last update`),ge=e=>`Disconnected. Gave up after ${e?.tries} tries; it reconnects when you return to this tab.`,_e=e=>`連線中斷。重試 ${e?.tries} 次後放棄;回到此分頁時會重新連線。`,ve=((e,t={})=>(t.locale??i())===`zh-TW`?_e(e):ge(e)),ye=e=>`The server is up but cannot read the net: ${e?.problem}`,be=e=>`伺服器正常,但讀不到網:${e?.problem}`,xe=((e,t={})=>(t.locale??i())===`zh-TW`?be(e):ye(e)),Se=((e={},t={})=>(t.locale??i())===`zh-TW`?`與稻草網的連線中斷,正在重新連線…畫面顯示的是最後已知狀態。`:`Disconnected from the straw net. Reconnecting… The view shows the last known state.`),Ce=e=>`Disconnected from the straw net. Reconnecting (try ${e?.attempt})… The view shows the last known state.`,we=e=>`與稻草網的連線中斷,正在重新連線(第 ${e?.attempt} 次)…畫面顯示的是最後已知狀態。`,Te=((e,t={})=>(t.locale??i())===`zh-TW`?we(e):Ce(e)),Ee=((e={},t={})=>(t.locale??i())===`zh-TW`?`這個網址在這裡無法使用(sb server 可能重新啟動過,或連結已過期):在這台電腦請開啟 /boss gui;在手機請重新掃描新的 QR code。`:`This address does not work here (the sb server may have restarted, or the link expired): on this computer open /boss gui; on a phone scan a new QR code.`),De=((e={},t={})=>(t.locale??i())===`zh-TW`?`Straw Net:所有基地`:`Straw Net: all bases`),Oe=((e={},t={})=>(t.locale??i())===`zh-TW`?`取消`:`Cancel`),ke=((e={},t={})=>(t.locale??i())===`zh-TW`?`關閉`:`Close`),Ae=e=>`Quit base ${e?.name}`,je=e=>`關掉基地 ${e?.name}`,Me=((e,t={})=>(t.locale??i())===`zh-TW`?je(e):Ae(e)),Ne=e=>`Quit base ${e?.name}? Every agent in it and its tower quit. Nothing quits while anything running would be lost.`,Pe=e=>`要關掉基地 ${e?.name} 嗎?裡面所有 agent 和塔台都會退出。有會遺失的東西時什麼都不關。`,Fe=((e,t={})=>(t.locale??i())===`zh-TW`?Pe(e):Ne(e)),Ie=e=>`Quit squad ${e?.name}`,Le=e=>`關掉小隊 ${e?.name}`,Re=((e,t={})=>(t.locale??i())===`zh-TW`?Le(e):Ie(e)),ze=e=>`Quit squad ${e?.name}? Every agent in it quits.`,Be=e=>`要關掉小隊 ${e?.name} 嗎?裡面所有 agent 都會退出。`,Ve=((e,t={})=>(t.locale??i())===`zh-TW`?Be(e):ze(e)),He=e=>`Quit the tower ${e?.name}? The base's mains become members again.`,Ue=e=>`要關掉塔台 ${e?.name} 嗎?這個基地的主智慧體都會降格成成員。`,We=((e,t={})=>(t.locale??i())===`zh-TW`?Ue(e):He(e)),Ge=e=>`Quit ${e?.name}`,Ke=e=>`關掉 ${e?.name}`,qe=((e,t={})=>(t.locale??i())===`zh-TW`?Ke(e):Ge(e)),Je=e=>`Quit ${e?.name}? It quits pi and its pane closes.`,Ye=e=>`要關掉 ${e?.name} 嗎?它會退出 pi,窗格也會關掉。`,Xe=((e,t={})=>(t.locale??i())===`zh-TW`?Ye(e):Je(e)),Ze=e=>`control tower · ${e?.state}`,Qe=e=>`塔台 · ${e?.state}`,$e=((e,t={})=>(t.locale??i())===`zh-TW`?Qe(e):Ze(e)),et=e=>`hard cap ${e?.time}`,tt=e=>`上限 ${e?.time}`,nt=((e,t={})=>(t.locale??i())===`zh-TW`?tt(e):et(e)),rt=((e={},t={})=>(t.locale??i())===`zh-TW`?`收尾中`:`closing`),it=e=>`Boss conversation · new session · ${e?.time}`,at=e=>`老闆對話・新的工作階段・${e?.time}`,ot=((e,t={})=>(t.locale??i())===`zh-TW`?at(e):it(e)),st=e=>`Boss conversation · resumed · ${e?.time}`,ct=e=>`老闆對話・接續・${e?.time}`,lt=((e,t={})=>(t.locale??i())===`zh-TW`?ct(e):st(e)),ut=e=>`ended ${e?.time}`,dt=e=>`${e?.time} 結束`,ft=((e,t={})=>(t.locale??i())===`zh-TW`?dt(e):ut(e)),pt=e=>`waiting for you; it ends at ${e?.time} if you stay quiet`,mt=e=>`等你說話;你若不說話,${e?.time} 結束`,ht=((e,t={})=>(t.locale??i())===`zh-TW`?mt(e):pt(e)),gt=((e={},t={})=>(t.locale??i())===`zh-TW`?`新的工作階段`:`new session`),_t=e=>`new session · ${e?.why}`,vt=e=>`新的工作階段・${e?.why}`,yt=((e,t={})=>(t.locale??i())===`zh-TW`?vt(e):_t(e)),bt=e=>`resumed session · boss turns: ${e?.turns}`,xt=e=>`接續舊工作階段・老闆輪數 ${e?.turns}`,St=((e,t={})=>(t.locale??i())===`zh-TW`?xt(e):bt(e)),Ct=((e={},t={})=>(t.locale??i())===`zh-TW`?`老闆對話・收尾中`:`boss conversation · closing`),wt=e=>`boss conversation · waiting for you · ends after ${e?.minutes} min idle`,Tt=e=>`老闆對話・等你說話・閒置 ${e?.minutes} 分鐘後結束`,Et=((e,t={})=>(t.locale??i())===`zh-TW`?Tt(e):wt(e)),Dt=e=>`boss conversation · ends after ${e?.minutes} min idle`,Ot=e=>`老闆對話・閒置 ${e?.minutes} 分鐘後結束`,kt=((e,t={})=>(t.locale??i())===`zh-TW`?Ot(e):Dt(e)),At=e=>`working; it ends after ${e?.minutes} min idle`,jt=e=>`處理中;閒置 ${e?.minutes} 分鐘後結束`,Mt=((e,t={})=>(t.locale??i())===`zh-TW`?jt(e):At(e)),Nt=((e={},t={})=>(t.locale??i())===`zh-TW`?`圖示來自 game-icons.net(Lorc、Delapouite),CC BY 3.0。`:`Icons from game-icons.net by Lorc and Delapouite, CC BY 3.0.`),Pt=((e={},t={})=>(t.locale??i())===`zh-TW`?`移除`:`Dismiss`),Ft=e=>`Dismiss finished (${e?.count})`,It=e=>`移除已完成(${e?.count})`,Lt=((e,t={})=>(t.locale??i())===`zh-TW`?It(e):Ft(e)),Rt=e=>`Dismiss ${e?.name}`,zt=e=>`從畫面移除 ${e?.name}`,Bt=((e,t={})=>(t.locale??i())===`zh-TW`?zt(e):Rt(e)),Vt=((e={},t={})=>(t.locale??i())===`zh-TW`?`文件`:`Documents`),Ht=((e={},t={})=>(t.locale??i())===`zh-TW`?`總塔台`:`head tower`),Ut=((e={},t={})=>(t.locale??i())===`zh-TW`?`語言`:`Language`),Wt=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower ${e?.tower}, which acts on a message you sent`,Gt=e=>`${e?.label}(${e?.short})請你確認它的塔台 ${e?.tower} 的一次 ${e?.tool} 呼叫,該塔台正在處理你送出的訊息`,Kt=((e,t={})=>(t.locale??i())===`zh-TW`?Gt(e):Wt(e)),qt=e=>`${e?.label} (${e?.short}) asks you to confirm a ${e?.tool} call from its tower`,Jt=e=>`${e?.label}(${e?.short})請你確認它塔台的一次 ${e?.tool} 呼叫`,Yt=((e,t={})=>(t.locale??i())===`zh-TW`?Jt(e):qt(e)),Xt=e=>`Team ${e?.team} stopped: ${e?.reason}`,Zt=e=>`團隊 ${e?.team} 已停止:${e?.reason}`,Qt=((e,t={})=>(t.locale??i())===`zh-TW`?Zt(e):Xt(e)),$t=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message has waited more than 10 minutes for an idle tower in team ${e?.team}`:t===`other`?`${e?.count} messages have waited more than 10 minutes for an idle tower in team ${e?.team}`:`link_a_held`},en=e=>`團隊 ${e?.team} 有 ${e?.count} 則訊息已等了超過 10 分鐘,塔台一直不閒`,tn=((e,t={})=>(t.locale??i())===`zh-TW`?en(e):$t(e)),nn=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message waits in the inbox of team ${e?.team}: no tower is open on its project`:t===`other`?`${e?.count} messages wait in the inbox of team ${e?.team}: no tower is open on its project`:`link_a_inbox`},rn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則訊息在等:專案上沒有開著的塔台`,an=((e,t={})=>(t.locale??i())===`zh-TW`?rn(e):nn(e)),on=e=>`${e?.label} (${e?.short}) asks to join team ${e?.team}`,sn=e=>`${e?.label}(${e?.short})要求加入團隊 ${e?.team}`,cn=((e,t={})=>(t.locale??i())===`zh-TW`?sn(e):on(e)),ln=e=>`${e?.label} (${e?.short}), an unattended device, asks to join team ${e?.team}`,un=e=>`${e?.label}(${e?.short})是無人值守的裝置,要求加入團隊 ${e?.team}`,dn=((e,t={})=>(t.locale??i())===`zh-TW`?un(e):ln(e)),fn=e=>`${e?.label} (${e?.short}) shows another roster than this computer in team ${e?.team}; the relay may be showing different rosters`,pn=e=>`團隊 ${e?.team} 中,${e?.label}(${e?.short})顯示的名冊和這台電腦不同;中繼站可能對不同人顯示不同名冊`,mn=((e,t={})=>(t.locale??i())===`zh-TW`?pn(e):fn(e)),hn=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} Straw Link message has waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps it waiting.`:t===`other`?`${e?.count} Straw Link messages have waited more than 10 minutes in the inbox of team ${e?.team} for an ally run. Look at the tower's card on the map: a held tower or a refused start keeps them waiting.`:`link_a_served`},gn=e=>`團隊 ${e?.team} 的收件匣有 ${e?.count} 則 Straw Link 訊息等隊友 run 接手已超過 10 分鐘。請看地圖上塔台的卡片:塔台已暫停或 run 啟動被拒,都會讓它們一直等。`,_n=((e,t={})=>(t.locale??i())===`zh-TW`?gn(e):hn(e)),vn=e=>`The relay of team ${e?.team} has been unreachable for ${e?.minutes} minutes`,yn=e=>`團隊 ${e?.team} 的中繼站已經 ${e?.minutes} 分鐘連不上`,bn=((e,t={})=>(t.locale??i())===`zh-TW`?yn(e):vn(e)),xn=e=>`Link ${e?.count}`,Sn=e=>`連線 ${e?.count}`,Cn=((e,t={})=>(t.locale??i())===`zh-TW`?Sn(e):xn(e)),wn=((e={},t={})=>(t.locale??i())===`zh-TW`?`Straw Link 通知`:`Straw Link notices`),Tn=((e={},t={})=>(t.locale??i())===`zh-TW`?`允許`:`Allow`),En=((e={},t={})=>(t.locale??i())===`zh-TW`?`團隊`:`Teams`),Dn=((e={},t={})=>(t.locale??i())===`zh-TW`?`Straw Link:跨電腦的團隊`:`Straw Link: teams across computers`),On=((e={},t={})=>(t.locale??i())===`zh-TW`?`連線中`:`connecting`),kn=((e={},t={})=>(t.locale??i())===`zh-TW`?`拒絕`:`Deny`),An=((e={},t={})=>(t.locale??i())===`zh-TW`?`即時`:`live`),jn=((e={},t={})=>(t.locale??i())===`zh-TW`?`尚未見到`:`not seen yet`),Mn=((e={},t={})=>(t.locale??i())===`zh-TW`?`離線`:`offline`),Nn=((e={},t={})=>(t.locale??i())===`zh-TW`?`在線`:`online`),Pn=((e={},t={})=>(t.locale??i())===`zh-TW`?`開啟團隊`:`Open Teams`),Fn=((e={},t={})=>(t.locale??i())===`zh-TW`?`重新連線中`:`reconnecting`),In=((e={},t={})=>(t.locale??i())===`zh-TW`?`查看`:`Review`),Ln=e=>`seen ${e?.ago} ago`,Rn=e=>`${e?.ago}前見到`,zn=((e,t={})=>(t.locale??i())===`zh-TW`?Rn(e):Ln(e)),Bn=((e={},t={})=>(t.locale??i())===`zh-TW`?`查看塔台`:`Show towers`),Vn=((e={},t={})=>(t.locale??i())===`zh-TW`?`正體中文`:`English`),Hn=((e={},t={})=>(t.locale??i())===`zh-TW`?`位置`:`Location`),Un=e=>`${e?.name} is commanding`,Wn=e=>`${e?.name} 指揮中`,Gn=((e,t={})=>(t.locale??i())===`zh-TW`?Wn(e):Un(e)),Kn=e=>`${e?.name} finished`,qn=e=>`${e?.name} 已完成`,Jn=((e,t={})=>(t.locale??i())===`zh-TW`?qn(e):Kn(e)),Yn=e=>`${e?.name} hit an error`,Xn=e=>`${e?.name} 發生錯誤`,Zn=((e,t={})=>(t.locale??i())===`zh-TW`?Xn(e):Yn(e)),Qn=e=>`${e?.name} went idle`,$n=e=>`${e?.name} 轉為閒置`,er=((e,t={})=>(t.locale??i())===`zh-TW`?$n(e):Qn(e)),tr=e=>`${e?.name} joined`,nr=e=>`${e?.name} 加入`,rr=((e,t={})=>(t.locale??i())===`zh-TW`?nr(e):tr(e)),ir=e=>`${e?.name} left`,ar=e=>`${e?.name} 離開`,or=((e,t={})=>(t.locale??i())===`zh-TW`?ar(e):ir(e)),sr=e=>`${e?.name} lost its status`,cr=e=>`${e?.name} 失去狀態`,lr=((e,t={})=>(t.locale??i())===`zh-TW`?cr(e):sr(e)),ur=e=>`${e?.name} is waiting on a question`,dr=e=>`${e?.name} 正在等待回答`,fr=((e,t={})=>(t.locale??i())===`zh-TW`?dr(e):ur(e)),pr=e=>`${e?.name} started working`,mr=e=>`${e?.name} 開始工作`,hr=((e,t={})=>(t.locale??i())===`zh-TW`?mr(e):pr(e)),gr=((e={},t={})=>(t.locale??i())===`zh-TW`?`指揮中`:`commanding`),_r=((e={},t={})=>(t.locale??i())===`zh-TW`?`已完成`:`finished`),vr=((e={},t={})=>(t.locale??i())===`zh-TW`?`錯誤`:`error`),yr=((e={},t={})=>(t.locale??i())===`zh-TW`?`閒置`:`idle`),br=((e={},t={})=>(t.locale??i())===`zh-TW`?`待命`:`standing by`),xr=((e={},t={})=>(t.locale??i())===`zh-TW`?`無狀態`:`no status`),v=((e={},t={})=>(t.locale??i())===`zh-TW`?`等待回答`:`waiting on a question`),Sr=((e={},t={})=>(t.locale??i())===`zh-TW`?`工作中`:`working`),Cr=((e={},t={})=>(t.locale??i())===`zh-TW`?`你的原話`:`your words`),wr=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台提議,你確認`:`proposed by the tower, confirmed by you`),Tr=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台自己的備註`:`the tower's note`),Er=((e={},t={})=>(t.locale??i())===`zh-TW`?`確認`:`Confirm`),Dr=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits`,Or=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待`,kr=((e,t={})=>(t.locale??i())===`zh-TW`?Or(e):Dr(e)),Ar=e=>`${e?.standing} standing · ${e?.decisions} decisions · ${e?.waits} waits · ${e?.proposals} to confirm`,jr=e=>`${e?.standing} 常駐指示・${e?.decisions} 決定・${e?.waits} 等待・${e?.proposals} 則待你確認`,Mr=((e,t={})=>(t.locale??i())===`zh-TW`?jr(e):Ar(e)),Nr=e=>`The tower proposes a decision: ${e?.text}`,Pr=e=>`塔台提議一項決定:${e?.text}`,Fr=((e,t={})=>(t.locale??i())===`zh-TW`?Pr(e):Nr(e)),Ir=e=>`The tower proposes a standing instruction: ${e?.text}`,Lr=e=>`塔台提議一則常駐指示:${e?.text}`,Rr=((e,t={})=>(t.locale??i())===`zh-TW`?Lr(e):Ir(e)),zr=e=>`The tower proposes to retire ${e?.id}: ${e?.text}`,Br=e=>`塔台提議撤掉 ${e?.id}:${e?.text}`,Vr=((e,t={})=>(t.locale??i())===`zh-TW`?Br(e):zr(e)),Hr=((e={},t={})=>(t.locale??i())===`zh-TW`?`駁回`:`Reject`),Ur=((e={},t={})=>(t.locale??i())===`zh-TW`?`你讀到記憶之後它又有變動,所以重新顯示了。請再試一次。`:`The memory changed since you read it, so it is shown again. Try once more.`),Wr=e=>`waits for ${e?.who}`,Gr=e=>`等 ${e?.who}`,Kr=((e,t={})=>(t.locale??i())===`zh-TW`?Gr(e):Wr(e)),qr=e=>`answered? a message came from ${e?.who}`,Jr=e=>`可能已回覆:${e?.who} 來了一則訊息`,Yr=((e,t={})=>(t.locale??i())===`zh-TW`?Jr(e):qr(e)),Xr=((e={},t={})=>(t.locale??i())===`zh-TW`?`等你決定`:`waits for you`),Zr=((e={},t={})=>(t.locale??i())===`zh-TW`?`已過 7 天而失效`:`expired after 7 days`),Qr=e=>`resolved: ${e?.outcome}`,$r=e=>`已處理:${e?.outcome}`,ei=((e,t={})=>(t.locale??i())===`zh-TW`?$r(e):Qr(e)),ti=((e={},t={})=>(t.locale??i())===`zh-TW`?`地圖總覽`:`Overview of the map`),ni=e=>`Monitor failed: ${e?.what}`,ri=e=>`Monitor 出錯:${e?.what}`,ii=((e,t={})=>(t.locale??i())===`zh-TW`?ri(e):ni(e)),ai=e=>`Monitor went quiet and stopped: ${e?.what}`,oi=e=>`Monitor 太久沒輸出,已停止:${e?.what}`,si=((e,t={})=>(t.locale??i())===`zh-TW`?oi(e):ai(e)),ci=((e={},t={})=>(t.locale??i())===`zh-TW`?`從未`:`never`),li=((e={},t={})=>(t.locale??i())===`zh-TW`?`+新基地`:`+ New base`),ui=((e={},t={})=>(t.locale??i())===`zh-TW`?`沒有執行中的智慧體`:`no agent running`),di=((e={},t={})=>(t.locale??i())===`zh-TW`?`無警示`:`no alerts`),y=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器沒有回應。`:`The server did not answer.`),fi=((e={},t={})=>(t.locale??i())===`zh-TW`?`尚無塔台`:`no tower yet`),pi=((e={},t={})=>(t.locale??i())===`zh-TW`?`監看中`:`Watching a monitor`),mi=((e={},t={})=>(t.locale??i())===`zh-TW`?`思考中`:`thinking`),hi=e=>`Finished ${e?.note}`,gi=e=>`完成了 ${e?.note}`,_i=((e,t={})=>(t.locale??i())===`zh-TW`?gi(e):hi(e)),vi=e=>`Failed ${e?.note}`,yi=e=>`出錯了 ${e?.note}`,bi=((e,t={})=>(t.locale??i())===`zh-TW`?yi(e):vi(e)),xi=e=>`Waiting on you ${e?.note}`,Si=e=>`等你回答 ${e?.note}`,Ci=((e,t={})=>(t.locale??i())===`zh-TW`?Si(e):xi(e)),wi=((e={},t={})=>(t.locale??i())===`zh-TW`?`+主智慧體`:`+ Main`),Ti=((e={},t={})=>(t.locale??i())===`zh-TW`?`+成員`:`+ Member`),Ei=((e={},t={})=>(t.locale??i())===`zh-TW`?`前哨`:`Outposts`),Di=((e={},t={})=>(t.locale??i())===`zh-TW`?`手機`:`Phone`),Oi=((e={},t={})=>(t.locale??i())===`zh-TW`?`透過 Tailscale 配對手機`:`Pair a phone over Tailscale`),ki=((e={},t={})=>(t.locale??i())===`zh-TW`?`接回`:`Pop`),Ai=e=>`Pop ${e?.name}`,ji=e=>`接回 ${e?.name}`,Mi=((e,t={})=>(t.locale??i())===`zh-TW`?ji(e):Ai(e)),Ni=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器送來的快照,頁面無法讀取`:`the server sent a snapshot the page cannot read`),Pi=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器回報了頁面無法讀取的問題`:`the server reported a problem the page cannot read`),b=((e={},t={})=>(t.locale??i())===`zh-TW`?`關掉`:`Quit`),Fi=((e={},t={})=>(t.locale??i())===`zh-TW`?`關掉塔台`:`Quit tower`),Ii=e=>`Refused (${e?.status}).`,Li=e=>`已拒絕(${e?.status})。`,x=((e,t={})=>(t.locale??i())===`zh-TW`?Li(e):Ii(e)),Ri=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒`:`Remind`),zi=((e={},t={})=>(t.locale??i())===`zh-TW`?`點一下允許瀏覽器通知`:`Press to allow browser notifications`),Bi=((e={},t={})=>(t.locale??i())===`zh-TW`?`瀏覽器已封鎖通知,要到網站設定裡允許`:`The browser blocks notifications; allow them in the site settings`),Vi=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒已關`:`Reminders off`),Hi=((e={},t={})=>(t.locale??i())===`zh-TW`?`提醒已開:分頁不在前景時,單位等你回答、完成或出錯會跳系統通知`:`Reminders on: while the page is in the background, a unit waiting on you, finishing, or failing raises a system notification`),Ui=((e={},t={})=>(t.locale??i())===`zh-TW`?`這個瀏覽器不支援通知`:`This browser has no notifications`),Wi=((e={},t={})=>(t.locale??i())===`zh-TW`?`隊友 run`:`ally run`),Gi=((e={},t={})=>(t.locale??i())===`zh-TW`?`主智慧體`:`main`),Ki=((e={},t={})=>(t.locale??i())===`zh-TW`?`成員`:`member`),qi=((e={},t={})=>(t.locale??i())===`zh-TW`?`前哨`:`outpost`),Ji=((e={},t={})=>(t.locale??i())===`zh-TW`?`未編入`:`unaligned`),Yi=((e={},t={})=>(t.locale??i())===`zh-TW`?`事件 run`:`event run`),Xi=((e={},t={})=>(t.locale??i(),`session`)),Zi=((e={},t={})=>(t.locale??i())===`zh-TW`?`子智慧體`:`subagent`),Qi=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台`:`tower`),$i=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器`:`Server`),ea=((e={},t={})=>(t.locale??i())===`zh-TW`?`sb 伺服器:狀態、重新啟動與記錄`:`The sb server: state, restart, and log`),ta=((e={},t={})=>(t.locale??i())===`zh-TW`?`設定`:`Settings`),na=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效`:`Sound`),ra=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效已關`:`Sounds off`),ia=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效已開`:`Sounds on`),aa=((e={},t={})=>(t.locale??i())===`zh-TW`?`音效:開關、音量與試聽`:`Sounds: on or off, volume, and a try`),oa=((e={},t={})=>(t.locale??i())===`zh-TW`?`▶ 試聽`:`▶ Try`),sa=((e={},t={})=>(t.locale??i())===`zh-TW`?`音量`:`Volume`),ca=((e={},t={})=>(t.locale??i())===`zh-TW`?`收起`:`Stash`),la=e=>`Stash base ${e?.name}`,ua=e=>`收起基地 ${e?.name}`,da=((e,t={})=>(t.locale??i())===`zh-TW`?ua(e):la(e)),fa=e=>`Stash base ${e?.name}? Its tower, mains, and members quit and come back with Pop. Nothing is stashed while anything running would be lost.`,pa=e=>`要收起基地 ${e?.name} 嗎?塔台、主智慧體和成員會結束,之後可以用「接回」叫回來。有會遺失的東西時不會收。`,ma=((e,t={})=>(t.locale??i())===`zh-TW`?pa(e):fa(e)),ha=e=>`Stashed (${e?.count})`,ga=e=>`已收起(${e?.count})`,_a=((e,t={})=>(t.locale??i())===`zh-TW`?ga(e):ha(e)),va=((e={},t={})=>(t.locale??i())===`zh-TW`?`智慧體`:`Agents`),ya=((e={},t={})=>(t.locale??i())===`zh-TW`?`基地`:`Bases`),ba=((e={},t={})=>(t.locale??i())===`zh-TW`?`指揮中`:`Commanding`),xa=((e={},t={})=>(t.locale??i())===`zh-TW`?`等待中`:`Waiting`),Sa=((e={},t={})=>(t.locale??i())===`zh-TW`?`工作中`:`Working`),Ca=((e={},t={})=>(t.locale??i())===`zh-TW`?`狀態`:`States`),wa=e=>`tab ${e?.label}`,Ta=e=>`分頁 ${e?.label}`,Ea=((e,t={})=>(t.locale??i())===`zh-TW`?Ta(e):wa(e)),Da=((e={},t={})=>(t.locale??i())===`zh-TW`?`即時網況 · 通訊`:`live net · comms`),Oa=((e={},t={})=>(t.locale??i())===`zh-TW`?`網路活動`:`Net activity`),ka=((e={},t={})=>(t.locale??i())===`zh-TW`?`伺服器啟動後還沒有動靜`:`Nothing has happened since the server started`),Aa=((e={},t={})=>(t.locale??i())===`zh-TW`?`現在`:`now`),ja=e=>`${e?.count} events in 30 min`,Ma=e=>`近 30 分鐘 ${e?.count} 筆`,Na=((e,t={})=>(t.locale??i())===`zh-TW`?Ma(e):ja(e)),Pa=((e={},t={})=>(t.locale??i())===`zh-TW`?`網的總計`:`Net totals`),Fa=e=>`The tower refused it: ${e?.reason}`,Ia=e=>`塔台拒絕了:${e?.reason}`,La=((e,t={})=>(t.locale??i())===`zh-TW`?Ia(e):Fa(e)),Ra=((e={},t={})=>(t.locale??i())===`zh-TW`?`回覆`:`Answer`),za=((e={},t={})=>(t.locale??i())===`zh-TW`?`重新送達`:`Deliver again`),Ba=((e={},t={})=>(t.locale??i())===`zh-TW`?`捨棄`:`Drop`),Va=((e={},t={})=>(t.locale??i())===`zh-TW`?`沒有這則已擱置的事件。`:`No such parked event.`),Ha=((e={},t={})=>(t.locale??i())===`zh-TW`?`sb server 沒有替這個工作區執行塔台。`:`The sb server runs no tower for this workspace.`),Ua=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} failed run lately`:t===`other`?`${e?.count} failed runs lately`:`tower_failures`},Wa=e=>`近來有 ${e?.count} 次 run 失敗`,Ga=((e,t={})=>(t.locale??i())===`zh-TW`?Wa(e):Ua(e)),Ka=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 當機`:`last run crashed`),qa=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 已結束`:`last run quit`),Ja=((e={},t={})=>(t.locale??i())===`zh-TW`?`上一次 run 逾時`:`last run timed out`),Ya=e=>`An event was parked after two runs crashed with it: ${e?.what}`,Xa=e=>`有一則事件在兩個 run 都當機後被擱置:${e?.what}`,Za=((e,t={})=>(t.locale??i())===`zh-TW`?Xa(e):Ya(e)),Qa=((e={},t={})=>(t.locale??i())===`zh-TW`?`run 一再當機或逾時,所以塔台不再自動喚醒。佇列仍保留;按重試,或由老闆送一則訊息,就會再喚醒它。`:`Runs crashed or timed out again and again, so the tower stops waking. The queue is kept; Retry, or a message from the boss, wakes it again.`),$a=((e={},t={})=>(t.locale??i())===`zh-TW`?`常駐窗格不在它自己的 shell:裡面有巢狀 shell 或程式在跑。請先離開它,再按重試`:`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`),eo=e=>`The tower types nothing in the standing pane: ${e?.reason}`,to=e=>`塔台不在常駐窗格輸入任何東西:${e?.reason}`,no=((e,t={})=>(t.locale??i())===`zh-TW`?to(e):eo(e)),ro=((e={},t={})=>(t.locale??i())===`zh-TW`?`重試`:`Retry`),io=e=>`A run could not start: ${e?.reason}`,ao=e=>`run 無法啟動:${e?.reason}`,oo=((e,t={})=>(t.locale??i())===`zh-TW`?ao(e):io(e)),so=((e={},t={})=>(t.locale??i())===`zh-TW`?`塔台無法檢查常駐窗格裡有沒有你的程式,所以不在那裡輸入任何東西;窗格空出來後請按重試`:`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`),co=e=>`Parked: ${e?.kind} from ${e?.from}: ${e?.first}`,lo=e=>`已擱置:${e?.kind},來自 ${e?.from}:${e?.first}`,uo=((e,t={})=>(t.locale??i())===`zh-TW`?lo(e):co(e)),fo=e=>`Parked: ${e?.kind}: ${e?.first}`,po=e=>`已擱置:${e?.kind}:${e?.first}`,mo=((e,t={})=>(t.locale??i())===`zh-TW`?po(e):fo(e)),ho=e=>{let t=_(`en`,e?.count,{},!0);return t===`one`?`${e?.count} message queued`:t===`other`?`${e?.count} messages queued`:`tower_queued`},go=e=>`${e?.count} 則排隊中`,_o=((e,t={})=>(t.locale??i())===`zh-TW`?go(e):ho(e)),vo=e=>`ally run · ${e?.device}`,yo=e=>`隊友 run · ${e?.device}`,bo=((e,t={})=>(t.locale??i())===`zh-TW`?yo(e):vo(e)),xo=((e={},t={})=>(t.locale??i())===`zh-TW`?`收工中`:`closing`),So=((e={},t={})=>(t.locale??i())===`zh-TW`?`已暫停`:`held`),Co=((e={},t={})=>(t.locale??i())===`zh-TW`?`喚醒中`:`waking`),wo=e=>`Waits for you: ${e?.text}`,To=e=>`等你決定:${e?.text}`,Eo=((e,t={})=>(t.locale??i())===`zh-TW`?To(e):wo(e)),Do=((e={},t={})=>(t.locale??i())===`zh-TW`?`處理中…`:`Working…`),Oo=((e={},t={})=>(t.locale??i())===`zh-TW`?`有智慧體等你同意,才能載入資料夾的設定`:`An agent needs your OK to load a folder's settings`),ko=((e={},t={})=>(t.locale??i())===`zh-TW`?`連不上伺服器。`:`The server could not be reached.`),Ao=e=>`using ${e?.tool}`,jo=e=>`使用 ${e?.tool}`,Mo=((e,t={})=>(t.locale??i())===`zh-TW`?jo(e):Ao(e)),No=`sb-locale`;function Po(e){let n=/^zh\b/i.test(e)&&(/-(hant|tw|hk|mo)\b/i.test(e)?`zh-TW`:/-(hans|cn|sg|my)\b/i.test(e)?`zh-CN`:void 0);return t(e)??(n?t(n):void 0)??t(e.split(`-`)[0])}function Fo(e,n){return t(e)??n.map(Po).find(Boolean)??`en`}var Io={brand_label:De,tagline:Da,totals_label:Pa,stat_bases:ya,stat_agents:va,stat_working:Sa,stat_waiting:xa,stat_commanding:ba,mark_commanding:gr,alerts:ee,no_alerts:di,pair_button:Di,pair_title:Oi,server_button:$i,server_title:ea,link_connecting:On,location:Hn,all_bases:te,documents:Vt,timeline:Oa,states:Ca,mark_working:Sr,mark_waiting:v,mark_idle:yr,mark_done:_r,mark_error:vr,credit:Nt,language:Ut,settings:ta,new_base:li,link_button:En,link_button_title:Dn};Object.keys(Io);function Lo(){let e=null;try{e=localStorage.getItem(No)}catch{}let t=Fo(e,navigator.languages??[navigator.language]);r(()=>t),document.documentElement.lang=t;let i={m:(e,t)=>e.textContent=t,mLabel:(e,t)=>e.setAttribute(`aria-label`,t),mTitle:(e,t)=>e.title=t,mEmpty:(e,t)=>e.dataset.empty=t};for(let e of document.querySelectorAll(`[data-m], [data-m-label], [data-m-title], [data-m-empty]`))for(let[t,n]of Object.entries(i))e.dataset[t]&&n(e,Io[e.dataset[t]]?.()??e.dataset[t]);let a=document.getElementById(`lang`);a.replaceChildren(...n.map(e=>new Option(Vn({},{locale:e}),e,!1,e===t))),a.onchange=()=>{try{localStorage.setItem(No,a.value),location.reload()}catch{a.value=t}}}var Ro=new Set,zo=e=>e.unit??e.key,Bo=e=>e.mark===`waiting`||e.pending?0:1;function Vo(e,t){let n=new Map;for(let r of e.bases)for(let e of[...r.tower?[{...r.tower,role:`tower`},...r.tower.subs]:[],...[...r.tabs.flatMap(e=>e.units),...r.outside].flatMap(e=>[e,...e.subs])]){n.set(e.key,{key:e.key,ws:r.id,name:e.name,role:e.role,mark:e.mark,note:e.note,at:t,pending:e.pending,closed:!e.control||!!e.ended});for(let i of e.monitors??[])(i.status===`error`||i.status===`stale`)&&(a=>n.set(a,{key:a,unit:e.key,ws:r.id,name:e.name,role:e.role,mark:`error`,note:`monitor:${i.status}:${i.what}`,at:t}))(`${e.key}\u001fmonitor:${i.id}:${i.at}`)}for(let r of e.trust??[])r.opening&&Ro.has(r.opening)||(e=>n.set(e,{key:e,ws:``,name:r.folder.split(/[\\/]/).filter(Boolean).at(-1)??r.folder,role:r.agents[0]?.role??`none`,mark:`waiting`,at:t,trust:r}))(`trust\u001f${r.folder}\u001f${r.digest}`);return n}function Ho(e,t){return[...t.values()].filter(t=>{let n=e?.get(t.key);return Bo(t)===0?!n||Bo(n)!==0||n.mark!==t.mark:e!==void 0&&n?.mark!==t.mark&&(t.mark===`error`||t.mark===`done`)})}var Uo=`input, textarea, select, [role=textbox], [role=combobox], [role=listbox], .term-scroll`,Wo=`button, a, summary, [role=button], [role=link]`,Go=`.ask-opt, [role=radio], [role=checkbox]`,Ko=`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`;function qo(e,t,n=!1){if(t||e.defaultPrevented||e.isComposing||e.ctrlKey||e.altKey||e.metaKey)return;let r=e.target;if(!(r?.isContentEditable||r?.closest?.(Uo))){if(e.key===`f`||e.key===`F`)return`zoom`;if(e.key===` `&&!r?.closest?.(Go)&&(n||!r?.closest?.(Wo)))return`next`}}function Jo(e,t=()=>document.querySelector(Ko)!==null,n=window){let r,i=!1,a=null;n.addEventListener(`pointerdown`,()=>i=!0,!0),n.addEventListener(`focusin`,e=>a=i?e.target:null,!0),n.addEventListener(`keydown`,n=>{let o=n.target===a;i=!1;let s=qo(n,t(),o);if(s){if(n.repeat)return r===s?n.preventDefault():void 0;e(s)&&(r=s,n.preventDefault())}}),n.addEventListener(`keyup`,e=>{r===`next`&&e.key===` `&&e.preventDefault(),r=void 0})}var Yo=(...e)=>e.filter(e=>e!==!1&&e!=null),Xo=(e,t)=>(e.classList.add(t),e.classList.toggle(`flip`));function S(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))r.setAttribute(e,n);return r.append(...Yo(...n)),r}var C=e=>String(e??``);function Zo(e){let t=e.data,n=e.teamName;switch(e.kind){case`join-request`:return t.unattended?dn({label:C(t.label),short:C(t.short),team:n}):cn({label:C(t.label),short:C(t.short),team:n});case`confirm`:return t.tower?Kt({label:C(t.label),short:C(t.short),tool:C(t.tool),tower:C(t.tower)}):Yt({label:C(t.label),short:C(t.short),tool:C(t.tool)});case`fork`:return Qt({team:n,reason:C(t.reason)});case`mismatch`:return mn({label:C(t.label),short:C(t.short),team:n});case`unreachable`:return bn({team:n,minutes:C(t.minutes)});case`inbox`:return an({count:Number(t.count)||0,team:n});case`held`:return tn({count:Number(t.count)||0,team:n});case`served`:return _n({count:Number(t.count)||0,team:n})}}var Qo=e=>{let t={error:0,warning:1,info:2};return[...e].sort((e,n)=>t[e.level]-t[n.level])};function $o(e){let t=Math.max(0,Math.ceil(e/1e3)),n=e=>String(e).padStart(2,`0`);return t>=3600?`${Math.floor(t/3600)}:${n(Math.floor(t/60)%60)}:${n(t%60)}`:`${Math.floor(t/60)}:${n(t%60)}`}function es(e,t){if(e===null)return jn();if(t)return Nn();let n=Math.floor(e/1e3);return zn({ago:n<3600?p({n:String(Math.max(1,Math.floor(n/60)))}):n<86400?u({n:String(Math.floor(n/3600))}):s({n:String(Math.floor(n/86400))})})}function ts(e){return e.online?e.tower===`blocked`?`waiting`:e.tower===`working`?`working`:e.tower===`unknown`?`unknown`:`idle`:`unknown`}function ns(e){switch(e){case`working`:return Sr();case`blocked`:return v();case`idle`:return yr();case`done`:return _r();case`unknown`:return xr();default:return e}}var rs=e({post:()=>w,sendFile:()=>as}),is=()=>document.querySelector(`meta[name="sb-csrf"]`)?.content??``,as=(e,t)=>fetch(`api/${e}`,{method:`POST`,cache:`no-store`,headers:{"content-type":`application/octet-stream`,"x-sb-name":encodeURIComponent(t.name||`pasted`),"x-sb-csrf":is()},body:t}).then(async e=>({ok:e.ok,status:e.status,body:await e.json().catch(()=>({}))})),w=(e,t)=>fetch(`api/${e}`,{method:`POST`,cache:`no-store`,headers:{"content-type":`application/json`,"x-sb-csrf":is()},body:JSON.stringify(t)}).then(async e=>({ok:e.ok,status:e.status,body:await e.json().catch(()=>({}))})),os=3e4,ss=[`pointermove`,`pointerdown`,`keydown`,`wheel`,`touchstart`];function cs(e=document.documentElement){if(matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=Date.now(),n,r=()=>{let i=t+os-Date.now();i>0?n=setTimeout(r,i):(n=void 0,e.toggleAttribute(`data-calm`,!0))},i=()=>{t=Date.now(),n===void 0&&(e.toggleAttribute(`data-calm`,!1),n=setTimeout(r,os))};for(let e of ss)addEventListener(e,i,{capture:!0,passive:!0});document.addEventListener(`visibilitychange`,()=>document.hidden||i()),i()}var ls=e=>e.route.view===`map`?``:e.route.ws;function us(e,t){for(let n of e?.bases??[]){if(n.tower?.key===t)return{u:{key:t,name:n.tower.name,role:`tower`,mark:n.tower.mark,control:n.tower.control,pending:n.tower.pending,queued:n.tower.queued,monitors:n.tower.monitors,service:n.tower.service,docs:n.tower.docs,docsCut:n.tower.docsCut,subs:n.tower.subs},base:n};for(let[e,r]of[...n.tabs.map(e=>[e.label,e.units]),[void 0,n.outside],[void 0,n.tower?.subs??[]]])for(let i of r){if(i.key===t)return{u:i,base:n,squad:e};let r=i.subs.find(e=>e.key===t);if(r)return{u:r,base:n,squad:e,launcher:i}}}}var ds=e=>e?.u.role===`tower`&&e.base.tower?.key===e.u.key?e.base:void 0,T=(e,t)=>(t?t!==`live`:!e)||!(!e?.ended||e.control);function fs(e,t,n){return n?`readonly`:T(e,t)?t===`recent`||e?.ended?`closed`:`none`:`live`}function ps(e){if(e.route.view!==`session`)return;let t=e.route.key,n=us(e.net,t),r=n?.u;return{key:t,hit:n,u:r,mk:r?.mark??`unknown`,state:e.info?.state,name:r?.name??e.info?.name??t}}var ms=e=>{try{return decodeURIComponent(e)}catch{return e}},hs=e=>/^\.+$/.test(e)?e.replaceAll(`.`,`%2E`):encodeURIComponent(e);function gs(e){let[t,n]=e.split(`#`)[0].split(`?`),[r,i,a,o]=t.replace(/^\/+|\/+$/g,``).split(`/`).map(ms);if(r!==`w`||!i)return{view:`map`};if(a!==`s`||!o)return{view:`workspace`,ws:i};let s=new URLSearchParams(n).get(`at`);return s?{view:`session`,ws:i,key:o,at:s}:{view:`session`,ws:i,key:o}}var E=e=>e.view===`map`?``:e.view===`workspace`?`w/${hs(e.ws)}`:`w/${hs(e.ws)}/s/${hs(e.key)}${e.at?`?at=${encodeURIComponent(e.at)}`:``}`,_s=e=>e.view===`session`?{view:`workspace`,ws:e.ws}:{view:`map`},vs=e=>e.view===`session`?e.key:e.view===`workspace`?`w:${e.ws}`:null,ys=e=>Math.max(0,e?.depth||0);function bs(e,t=new URL(document.baseURI).pathname){let n=()=>gs(location.pathname.slice(t.length)+location.search),r={route:n,href:e=>E(e)||`./`,go(n){let r=t+E(n);location.pathname+location.search!==r&&history.pushState({depth:ys(history.state)+1},``,r),e(n)}};return addEventListener(`popstate`,()=>e(n())),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-route]`);!t||e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t.hasAttribute(`data-back`)&&ys(history.state)>0?history.back():r.go(gs(t.getAttribute(`data-route`))))}),r}function xs(e,t,n){let r=n?.allyRuns??[],i=JSON.stringify([t,r.map(e=>[e.id,e.label,e.key])]);e.dataset.sig!==i&&(e.dataset.sig=i,e.hidden=!r.length,e.replaceChildren(...r.length>1?[S(`b`,null,ue({count:r.length}))]:[],...r.map(e=>{let n=ie({device:e.label});if(!e.key)return S(`span`,{class:`ally-chip`,title:oe()},n);let r=E({view:`session`,ws:t,key:e.key});return S(`a`,{class:`ally-chip`,href:r||`./`,"data-route":r,title:ae()},n)})))}var Ss=(e,t)=>e.allyRuns.length===1?bo({device:e.allyRuns[0].label},t):e.allyRuns.length>1?ue({count:e.allyRuns.length},t):Wi({},t),D=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,hour12:!1}),Cs=e=>Math.max(1,Math.round(e.idleMs/6e4)),ws=(e,t)=>e.closing?Ct({},t):(e.idle?Et:kt)({minutes:Cs(e)},t);function Ts(e,t){return{began:e.resumed?St({turns:e.turns},t):e.why?yt({why:e.why},t):gt({},t),...e.why?{why:e.why}:{},now:e.closing?rt({},t):e.idle&&e.idleAt?ht({time:D(e.idleAt)},t):Mt({minutes:Cs(e)},t),cap:nt({time:D(e.capAt)},t)}}function Es(e,t){return{title:(e.resumed?lt:ot)({time:D(e.startedAt)},t),...e.endedAt?{ended:[ft({time:D(e.endedAt)},t),e.note].filter(Boolean).join(` · `)}:{}}}function Ds(e,t,n,r){if(!e)return n(t);switch(e.state){case`held`:return So({},r);case`waking`:return Co({},r);case`closing`:return xo({},r);case`running`:return e.run?.kind===`ally`?Ss(e,r):e.conversation&&t!==`waiting`?ws(e.conversation,r):n(t);case`standing`:return t===`idle`?e.allyRuns.length?Ss(e,r):br({},r):n(t)}}var Os={crashed:e=>Ka({},e),timeout:e=>Ja({},e),quit:e=>qa({},e)};function ks(e,t){if(!e||e.run)return;let n=Object.hasOwn(Os,e.lastRun?.outcome??``)?Os[e.lastRun.outcome](t):void 0;return n&&[n,e.crashes?Ga({count:e.crashes},t):``].filter(Boolean).join(` · `)}var As=(e,t,n,r)=>[Ds(e,t,n,r),ks(e,r)].filter(Boolean).join(` · `),js=(e,t)=>e?.queued?_o({count:e.queued},t):void 0,Ms=`A run could not start: `,Ns=`The tower could not check the standing pane for a program of yours, so it types nothing there; press Retry when it is free`,Ps=`The standing pane is not at its own shell: a nested shell or a program runs there. Leave it, then press Retry`,Fs=`The tower types nothing in the standing pane: `,Is=`An event was parked after two runs crashed with it: `;function Ls(e,t){return(e.kind===`settings`||e.kind===`start`)&&e.text.startsWith(Ms)?oo({reason:e.text.slice(23)},t):e.kind===`start`&&e.text===Ns?so({},t):e.kind===`start`&&e.text===Ps?$a({},t):e.kind===`start`&&e.text.startsWith(Fs)?no({reason:e.text.slice(46)},t):e.kind===`loop`?Qa({},t):e.kind===`late`&&e.text.startsWith(Is)?Za({what:e.text.slice(52)},t):e.text}function Rs(e,t){return[...(e?.notices??[]).filter(e=>!e.id.startsWith(`parked-`)).map(e=>({id:e.id,level:e.level,text:Ls(e,t),actions:e.kind===`loop`||e.kind===`start`&&e.id===`start`?[`retry`]:[]})),...(e?.memory?.bossWaits??[]).map(e=>({id:`wait-${e.id}`,level:`warning`,text:Eo({text:e.text},t),actions:[`answer`]})),...(e?.memory?.proposals??[]).map(n=>({id:`proposal-${n.id}`,level:`warning`,text:Us(n,t),proposal:n.id,rev:e.memory.rev,actions:[`confirm`,`reject`]})),...e?.memory?.problem?[{id:`memory-unreadable`,level:`warning`,text:e.memory.problem,actions:[]}]:[],...(e?.parked??[]).map(e=>({id:`parked-${e.id}`,level:`warning`,text:e.from?uo({kind:e.kind,from:e.from,first:e.first},t):mo({kind:e.kind,first:e.first},t),event:e.id,actions:[`deliver`,`drop`]}))]}function zs(e,t){if(!(e.status<400)){if(e.body.reason===`No such parked event`)return Va({},t);if(e.body.reason?.startsWith(`The sb server stands in for no tower`))return Ha({},t)}}async function Bs(e,t,n,r=1200){let i=e.textContent;e.disabled=!0,e.textContent=Do(),t(void 0);try{let e=await n();e.ok?r&&await new Promise(e=>setTimeout(e,r)):t(La({reason:zs(e)??e.body.reason??e.body.error??String(e.status)}))}catch{t(La({reason:ko()}))}finally{e.disabled=!1,e.textContent=i}}var Vs={standing:12,decision:24};function Hs(e){let t=e=>e.state===`resolved`||e.state===`expired`;return{standing:e.filter(e=>e.kind===`standing`),decisions:e.filter(e=>e.kind===`decision`).reverse(),waits:e.filter(e=>e.kind===`wait`).sort((e,n)=>Number(t(e))-Number(t(n)))}}var Us=(e,t)=>e.op===`retire`?Vr({id:e.target??``,text:e.text},t):(e.kind===`standing`?Rr:Fr)({text:e.text},t),Ws=(e,t)=>e.proposals.length?Mr({standing:e.standing,decisions:e.decisions,waits:e.waits,proposals:e.proposals.length},t):kr({standing:e.standing,decisions:e.decisions,waits:e.waits},t);function Gs(e,t){return[e.kind===`wait`?Tr({},t):e.via===`proposal`?wr({},t):Cr({},t),e.kind===`wait`?e.for===`boss`?Xr({},t):Kr({who:e.on??``},t):void 0,e.state===`answered`?Yr({who:e.on??``},t):e.state===`resolved`?ei({outcome:e.outcome??``},t):e.state===`expired`?Zr({},t):void 0].filter(Boolean).join(` · `)}function Ks(e,t){return e.body.error===`rev`?Ur({},t):String(e.body.reason??e.body.error??e.status)}var qs={retry:ro,deliver:za,drop:Ba,answer:Ra,confirm:Er,reject:Hr};function Js(e,t,n,r){let i=Rs(n),a=JSON.stringify([t,i]);e.dataset.sig!==a&&(e.dataset.sig=a,e.replaceChildren(...i.map(e=>{let n=S(`small`,{class:`tnote-fail`,role:`alert`}),i=S(`p`,{class:`tnote ${e.level}`},S(`span`,null,e.text));for(let a of e.actions){if(a===`answer`){let e=r?E({view:`session`,ws:t,key:r}):``,n=S(`a`,{class:`pair-btn`,href:e||`./`,"data-route":e},qs[a]());n.addEventListener(`click`,()=>document.querySelector(`.composer-root textarea`)?.focus()),i.append(n);continue}let o=S(`button`,{type:`button`,class:`pair-btn`},qs[a]()),[s,c]=e.proposal&&(a===`confirm`||a===`reject`)?[`memory`,a===`confirm`?{op:`confirm`,proposal:e.proposal,rev:e.rev}:{op:`reject`,proposal:e.proposal}]:[a,e.event?{id:e.event}:{}];o.onclick=()=>void Bs(o,e=>n.textContent=e??``,()=>w(`tower/${encodeURIComponent(t)}/${s}`,c)),i.append(o)}return i.append(n),i})))}var Ys=140;function Xs(e,t){let n=document.createElement(`nav`),r=document.createElement(`div`),i=document.createElement(`i`);[n.className,r.className,i.className,n.hidden]=[`minimap`,`mm-in`,`mm-view`,!0],n.setAttribute(`aria-label`,ti()),n.append(r,i),document.body.append(n);let a=1,o=0,s=()=>{o=0;let t=e.getBoundingClientRect();i.style.transform=`translateY(${Math.round(Math.max(0,-t.top)*a)}px)`,i.style.height=`${Math.round(Math.min(innerHeight-Math.max(0,t.top),t.bottom)*a)}px`,n.classList.toggle(`away`,t.bottom<innerHeight)},c=()=>{let i=e.getBoundingClientRect();n.hidden=e.hidden||i.height<innerHeight*1.05||!matchMedia(`(min-width: 900px) and (hover: hover)`).matches,!n.hidden&&(a=Math.min(Ys/i.width,innerHeight*.4/i.height),Object.assign(n.style,{width:`${Math.round(i.width*a)}px`,height:`${Math.round(i.height*a)}px`}),r.replaceChildren(...[...t.querySelectorAll(`:scope > .base:not(.leaving)`)].map(e=>{let t=e.getBoundingClientRect(),n=document.createElement(`i`);return n.dataset.mark=e.dataset.mark??`idle`,n.style.cssText=`left:${(t.left-i.left)*a}px;top:${(t.top-i.top)*a}px;width:${t.width*a}px;height:${t.height*a}px`,n})),s())};return addEventListener(`scroll`,()=>o||=requestAnimationFrame(s),{passive:!0}),addEventListener(`resize`,c),n.addEventListener(`click`,t=>{let n=e.getBoundingClientRect(),i=(t.clientY-r.getBoundingClientRect().top)/a;scrollTo({top:n.top+scrollY+i-innerHeight/2,behavior:matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})}),c}function Zs({x1:e,y1:t,x2:n,y2:r,mid:i},a=64){let o=Array.from({length:201},(a,o)=>{let s=o/200,c=1-s;return[c**3*e+3*c*c*s*i+3*c*s*s*i+s**3*n,c**3*t+3*c*c*s*t+3*c*s*s*r+s**3*r]}),s=o.reduce((e,t,n)=>(e.push(n?e[n-1]+Math.hypot(t[0]-o[n-1][0],t[1]-o[n-1][1]):0),e),[]);return Array.from({length:a+1},(e,t)=>{let n=t/a*s.at(-1),r=Math.max(1,s.findIndex(e=>e>=n)),[i,c]=[o[r-1],o[r]],l=s[r]>s[r-1]?(n-s[r-1])/(s[r]-s[r-1]):0;return[i[0]+(c[0]-i[0])*l,i[1]+(c[1]-i[1])*l]})}function Qs(e,t){if(t||!e.length)return[];let n=document.createElement(`style`);return n.textContent=e.map((e,t)=>`@keyframes pk${t}{${Zs(e).map(([e,t],n,r)=>`${(n/(r.length-1)*100).toFixed(2)}%{transform:translate(${e.toFixed(1)}px,${t.toFixed(1)}px)}`).join(``)}}`).join(``),[n,...e.map((e,t)=>(e=>(e.className=`packet`,e.style.animationName=`pk${t}`,e))(document.createElement(`i`)))]}var $s=typeof document<`u`&&typeof document.querySelector==`function`&&((e=document)=>e.querySelector(`meta[name="sb-desk"]`)?.content===`1`)(),ec=(e,t=$s)=>t||e!==`127.0.0.1`,tc=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),nc=function(e,t){return new URL(e,t).href},rc={},ic=function(e){return e.pathname.endsWith(`.css`)},ac=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},O=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=nc(t,n);let r=s(t),i=ic(r);return ac(rc,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:tc,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function k(e,t,n,r,i=!1){Object.assign(e.dataset,t),[e.hidden,e.textContent]=[i,n],r&&e.setAttribute(`aria-label`,r)}var oc=(e,t)=>t.role===`subagent`&&t.ended&&t.key?k(e,{close:`dismiss`,key:t.key,name:t.name,role:t.role},Pt(),Bt({name:t.name})):k(e,{close:`unit`,key:t.key??``,name:t.name,role:t.role},b(),qe({name:t.name}),!(t.control&&t.key)||t.role===`subagent`),sc=(e,t)=>k(e,{key:t?.key??``,name:t?.name??``,role:`tower`},Fi(),void 0,!t?.control);function cc(e,t){e.dataset.close=`unit`,t?.u.role===`tower`&&t.base.tower?.key===t.u.key?sc(e,t.base.tower):t&&oc(e,t.u),e.hidden=!t||e.dataset.close!==`unit`||e.hidden}var lc=(e,t)=>k(e,{ws:t.id,name:t.label},b(),Me({name:t.label})),uc=(e,t,n=$s)=>k(e,{ws:t.id,name:t.label},ca(),da({name:t.label}),n),dc=(e,t,n)=>k(e,{ws:t.id,name:n.label,tab:n.id},b(),Re({name:n.label})),A=(e,t)=>new Promise(n=>{let r=document.createElement(`dialog`),i=document.createElement(`p`),a=document.createElement(`div`),o=(e,t,i)=>Object.assign(document.createElement(`button`),{type:`button`,className:t,textContent:e,onclick:()=>(r.close(),n(i))});[r.className,i.textContent,a.className]=[`sheet`,e,`sheet-row`],a.append(...t?[o(Oe(),`later`,!1),o(t,`sheet-yes`,!0)]:[o(ke(),`later`,!1)]),r.append(i,a),r.addEventListener(`close`,()=>(r.remove(),n(!1))),document.body.append(r),r.showModal()}),fc=e=>e.bases.flatMap(e=>[...e.tower?[e.tower]:[],...e.tabs.flatMap(e=>e.units),...e.outside]).flatMap(e=>e.subs).filter(e=>e.ended).map(e=>e.key);function pc(e,t){let n=fc(t).length;e.hidden=!n,n&&(e.textContent=Lt({count:n}))}function mc(e,t,n,r=$s){if(r)return void(e.hidden=!0);let i=n.stashed??[],a=JSON.stringify(i);e.hidden=!i.length;let o=t.closest(`[popover]`);!i.length&&o?.matches(`:popover-open`)&&o.hidePopover(),i.length&&(e.textContent=_a({count:i.length})),t.dataset.key!==a&&(t.dataset.key=a,t.replaceChildren(...i.map(e=>{let t=document.createElement(`li`),n=document.createElement(`span`),r=document.createElement(`button`);return n.textContent=e.name===e.label?e.label:`${e.name} (${e.label})`,[r.type,r.className]=[`button`,`pair-btn`],k(r,{close:`pop`,name:e.name},ki(),Mi({name:e.name})),t.append(n,r),t})))}var hc=e=>O(async()=>{let{post:e}=await Promise.resolve().then(()=>rs);return{post:e}},void 0,import.meta.url).then(({post:t})=>t(`dismiss`,e)).then(e=>e.ok||(A(e.body.reason??x({status:e.status})),!1),()=>(A(y()),!1));function gc(e,{route:t,net:n,go:r}){let i=t();if(i.view===`map`)return;if(e.close===`base`||e.close===`stash`)return void(i.ws===e.ws&&r({view:`map`}));let a=e=>e.flatMap(e=>[e.key,...a(e.subs)]),o=e.close===`tab`&&i.ws===e.ws?n()?.bases.find(t=>t.id===e.ws)?.tabs.find(t=>t.id===e.tab):void 0;i.view===`session`&&(e.close===`unit`?i.key===e.key:o&&a(o.units).includes(i.key))&&r({view:`workspace`,ws:i.ws})}function _c(e){document.addEventListener(`click`,t=>{let n=t.target?.closest?.(`button[data-close]`),r=n?.dataset;if(n&&r){if(t.preventDefault(),r.close===`dismiss`||r.close===`dismiss-all`)return void hc(r.close===`dismiss`?{key:r.key}:{all:!0});if(r.close===`pop`)return void(n.toggleAttribute(`disabled`,!0),Promise.all([O(()=>Promise.resolve().then(()=>rs),void 0,import.meta.url),O(()=>import(`./refusal--wJ5SRx-.js`).then(e=>e.n),[],import.meta.url)]).then(([{post:e},{reasonOf:t}])=>e(`close/pop`,{name:r.name}).then(e=>e.ok||A(t(e.body.reason,e.body.settings)??x({status:e.status})))).catch(()=>A(y())).finally(()=>n.toggleAttribute(`disabled`,!1)));A((r.close===`stash`?ma:r.close===`base`?Fe:r.close===`tab`?Ve:r.role===`tower`?We:Xe)({name:r.name??``}),r.close===`stash`?ca():b()).then(t=>{t&&(n.toggleAttribute(`disabled`,!0),O(async()=>{let{post:e}=await Promise.resolve().then(()=>rs);return{post:e}},void 0,import.meta.url).then(({post:e})=>e(`close/${r.close===`base`?`all`:r.close}`,r.close===`unit`?{key:r.key}:{workspace:r.ws,...r.tab&&{tab:r.tab}})).then(t=>t.ok?gc(r,e):A(t.body.reason??x({status:t.status})),()=>A(y())).finally(()=>n.toggleAttribute(`disabled`,!1)))})}})}var vc={main:`main`,member:`member`,subagent:`subagent`,outpost:`outpost`,outside:`outside`,tower:`tower`,ally:`tower`,run:`tower`},j={commanding:gr,working:Sr,waiting:v,idle:yr,done:_r,error:vr,unknown:xr},yc={ally:Wi,run:Yi,main:Gi,member:Ki,subagent:Zi,tower:Qi,outpost:qi,outside:Ji,session:Xi},bc={thinking:mi,"watching a monitor":pi,idle:yr,"waiting on a question":v,finished:_r},xc={claude:`Claude`,codex:`Codex`},Sc=e=>Object.hasOwn(yc,e)?yc[e]():e,Cc=e=>e===`waiting`||e===`error`,M=e=>{let t=new DOMParser().parseFromString(e.trim(),`text/html`).body.firstElementChild;if(!(t instanceof HTMLElement))throw Error(`bad template`);return document.importNode(t,!0)},N=(e,t)=>{let n=document.getElementById(e);if(!(n instanceof t))throw Error(`#${e} is missing from the page`);return n},P=(e,t,n)=>{let r=e.querySelector(t);r.textContent!==n&&(r.textContent=n)},F=(e,t)=>{if(e.dataset.mark===t)return;let n=e.dataset.mark!==void 0;e.dataset.mark=t,n&&Xo(e,`flash`)},wc=e=>(t=>(e.slice(8,t)===`stale`?si:ii)({what:e.slice(t+1)}))(e.indexOf(`:`,8)),I=(e,t)=>e?e.startsWith(`tool:`)?Mo({tool:e.slice(5)}):e.startsWith(`monitor:`)?wc(e):Object.hasOwn(bc,e)?bc[e]():e:j[t](),Tc=(e,t,n)=>T(e,t)?``:n===`working`||n===`commanding`?I(e?.note,n):Cc(n)?j[n]():``,Ec=(e,t,n)=>T(e,t)&&(n===`working`||n===`commanding`)?`done`:n,Dc=(e,t,n,r,i=I(n,r))=>{P(e,t,i),e.querySelector(t).toggleAttribute(`data-monitoring`,i===I(n,r)&&n===`watching a monitor`)},L=(e,t)=>{e.toggleAttribute(`hidden`,!t),t&&(e.setAttribute(`href`,E(t)||`./`),e.setAttribute(`data-route`,E(t)))},R=(e,t)=>{let n=t.getBoundingClientRect(),r=e.offsetWidth;e.style.top=`${n.bottom+8}px`,e.style.left=`${Math.max(8,Math.min(n.right-r,innerWidth-r-8))}px`},Oc=`<div class="plate"><i class="ring"></i><svg><use href="#i-main"/></svg><b class="badge"></b></div>`;function kc(e,t,n,r){F(e,n);let i=e.querySelector(`use`),a=`#i-${vc[t]??`member`}`,o=r?.filter(e=>e.onScreen).length;i.getAttribute(`href`)!==a&&i.setAttribute(`href`,a),o?e.dataset.docs=String(o):delete e.dataset.docs}function z(e,t,n,r){let i=new Map;for(let t of e.children)!t.classList.contains(`leaving`)&&t.dataset.key&&i.set(t.dataset.key,t);let a=e.firstElementChild;for(let o of t){let t=i.get(o.id);for(t||(t=n(o),t.dataset.key=o.id,t.classList.add(`enter`),setTimeout(()=>t.classList.remove(`enter`),600)),i.delete(o.id);a?.classList.contains(`leaving`);)a=a.nextElementSibling;t===a?a=a.nextElementSibling:e.insertBefore(t,a),r(t,o)}for(let e of i.values())e.classList.add(`leaving`),setTimeout(()=>e.remove(),400)}var Ac=(e,t=Math.max(0,Date.now()-e)/1e3)=>t<60?g({n:String(Math.floor(t))}):t<3600?p({n:String(Math.floor(t/60))}):t<86400?u({n:String(Math.floor(t/3600))}):s({n:String(Math.floor(t/86400))}),jc=(e,t)=>(t===void 0?delete e.dataset.since:e.dataset.since=String(t),e.textContent=t===void 0?``:Ac(t));function Mc(e,t=[]){let n=e.querySelector(`:scope > .ticks`),r=t.map(e=>`${e.at}${e.mark}`).join();n.dataset.sig!==r&&(n.dataset.sig=r,e.classList.toggle(`ticked`,t.length>0),n.replaceChildren(...t.map((e,n)=>{let r=document.createElement(`i`);return r.dataset.mark=e.mark,r.style.setProperty(`--o`,((n+1)/t.length).toFixed(2)),r})))}var B=()=>M(`<div class="unit"><div class="card"><a class="hit"></a>${Oc}<div class="meta"><span class="name"></span><span class="line"><em class="role"></em><em class="agent"></em><span class="note"></span><span class="age"></span></span><span class="todo" hidden><b></b><span></span></span></div><button type="button" class="quit-btn" data-close="unit" hidden></button><span class="ticks" aria-hidden="true"></span></div><div class="subs"></div></div>`);function V(e,t){let n=e.closest(`.base`)?.dataset.key,r=e.querySelector(`.hit`),i=Ec(t,void 0,t.mark),a=T(t)?void 0:t.note;L(r,t.key&&n?{view:`session`,ws:n,key:t.key}:void 0),r.setAttribute(`aria-label`,`${t.name}: ${I(a,i)}`),r.toggleAttribute(`data-alert`,Cc(i)),F(e,i),kc(e.querySelector(`.plate`),t.role,i,t.docs),P(e,`.name`,t.name),P(e,`.role`,Sc(t.role)),P(e,`.agent`,t.agent?xc[t.agent]:``),Dc(e,`.note`,a,i),jc(e.querySelector(`:scope > .card .age`),t.since);let o=e.querySelector(`:scope > .card .todo`);o.hidden=!t.todo,t.todo&&(P(o,`b`,`${t.todo.done<t.todo.total?`◐`:`✓`} ${t.todo.done}/${t.todo.total}`),P(o,`span`,t.todo.now??``)),Mc(e.querySelector(`:scope > .card`),t.ticks),oc(e.querySelector(`:scope > .card > .quit-btn`),t),z(e.querySelector(`.subs`),t.subs??[],B,V)}function Nc(e,t,n){let r=t.tower?`main`:`member`;e.hidden=!!(n&&t.tower),e.dataset.open=r,e.dataset.ws=t.id,n&&(e.dataset.tab=n),e.textContent!==(r===`main`?wi():Ti())&&(e.textContent=r===`main`?wi():Ti())}var Pc=()=>M(`<section class="base"><header><div class="tower"><i class="sweep"></i><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><span class="crown"><svg><use href="#i-crown"/></svg>${Ht()}</span><h2><a class="enter-base"></a></h2><p><span class="tstate"></span><span class="tqueue"></span><span class="age"></span></p><div class="allies" hidden></div><button type="button" class="quit-btn tower-quit" data-close="unit" hidden></button></div><button type="button" class="quit-btn" data-close="base"></button></header><div class="subs tower-subs"></div><div class="tower-notices"></div><div class="spawn-btns"><button type="button" class="pair-btn"></button><button type="button" class="pair-btn" data-close="stash"></button></div><div class="tabs"></div><div class="outposts" data-label="${Ei()}"></div></section>`),Fc=e=>As(e.service,e.mark,e=>j[e]());function Ic(e,t){F(e,t.mark),e.classList.toggle(`head`,t.head);let n=e.querySelector(`.tower`);n.classList.toggle(`ghost`,!t.tower),F(n,t.tower?.mark??`unknown`),P(e,`h2 a`,t.label),L(e.querySelector(`h2 a`),{view:`workspace`,ws:t.id}),P(e,`.title .tstate`,t.tower?$e({state:Fc(t.tower)}):fi()),P(e,`.title .tqueue`,js(t.tower?.service)??``),jc(e.querySelector(`.title .age`),t.tower?.since),Nc(e.querySelector(`.spawn-btns button`),t),lc(e.querySelector(`header > .quit-btn`),t),uc(e.querySelector(`.spawn-btns [data-close=stash]`),t),sc(e.querySelector(`.tower-quit`),t.tower),z(e.querySelector(`.tower-subs`),t.tower?.subs??[],B,V),xs(e.querySelector(`.title .allies`),t.id,t.tower?.service),Js(e.querySelector(`.tower-notices`),t.id,t.tower?.service,t.tower?.key),z(e.querySelector(`.tabs`),t.tabs,()=>M(`<div class="tab"><h3><span></span><button type="button" class="tab-add"></button><button type="button" class="quit-btn" data-close="tab"></button></h3><div class="units"></div></div>`),(e,n)=>{P(e,`h3 span`,Ea({label:n.label})),dc(e.querySelector(`.quit-btn`),t,n),Nc(e.querySelector(`.tab-add`),t,n.id),z(e.querySelector(`.units`),n.units,B,V)}),z(e.querySelector(`.outposts`),t.outposts.map(e=>({id:e.id,name:e.label,role:`outpost`,mark:e.mark,note:e.mark===`unknown`?ui():void 0,since:e.since,ticks:e.ticks})),B,V)}var Lc=()=>M(`<section class="base ally"><header><div class="tower"><i class="pulse"></i><svg><use href="#i-tower"/></svg><b class="badge"></b></div><div class="title"><span class="crown"><svg><use href="#i-main"/></svg><em class="ally-tag"></em></span><h2></h2><p><span class="tstate"></span></p></div></header><ul class="ally-tabs"></ul></section>`);function Rc(e,t){let n=ts(t);F(e,n),e.classList.toggle(`offline`,!t.online),F(e.querySelector(`.tower`),n),P(e,`.ally-tag`,pe({team:t.teamName})),P(e,`h2`,t.workspace??t.label),P(e,`.tstate`,`${t.workspace?`${t.label} · `:``}${t.short} · ${t.online?ns(t.tower):Mn()}`),z(e.querySelector(`.ally-tabs`),t.tabs.map((e,t)=>({id:`${t}`,...e})),()=>M(`<li class="ally-tab"><b></b><span></span></li>`),(e,n)=>{P(e,`b`,n.label),P(e,`span`,t.online?ns(n.state):``),e.dataset.state=n.state})}function zc(e,t,n,r){let i=[...e.querySelectorAll(`.base:not(.leaving):not(.ally) .tower`)],a=e.querySelector(`.base.head:not(.leaving) .tower`),o=e.getBoundingClientRect(),s=e=>{let t=e.getBoundingClientRect();return[Math.round(t.x+t.width/2-o.x),Math.round(t.y+t.height/2-o.y)]},c=a?i.filter(e=>e!==a):[],l=c.map(e=>{let[[t,n],[r,i]]=[s(a),s(e)];return{x1:t,y1:n,x2:r,y2:i,mid:Math.round((t+r)/2)}}),u=l.map(({x1:e,y1:t,x2:n,y2:r,mid:i})=>`M${e} ${t}C${i} ${t} ${i} ${r} ${n} ${r}`),d=u.join(`|`);t.dataset.sig!==d&&(t.dataset.sig=d,t.replaceChildren(...u.map(e=>(t=>(t.setAttribute(`class`,`wire`),t.setAttribute(`d`,e),t))(document.createElementNS(`http://www.w3.org/2000/svg`,`path`)))),n.replaceChildren(...Qs(l,r))),n.querySelectorAll(`.packet`).forEach((e,t)=>e.toggleAttribute(`data-live`,[`working`,`commanding`].includes(a.dataset.mark??``)||[`working`,`commanding`].includes(c[t].dataset.mark??``)))}var Bc=2,Vc=20;function Hc(){let[e,t,n,r]=[N(`map`,HTMLElement),N(`bases`,HTMLElement),N(`links`,SVGSVGElement),N(`packets`,HTMLElement)],i=matchMedia(`(prefers-reduced-motion: reduce)`).matches,a=new Set,o=Xs(e,t),s=()=>(o(),!e.hidden&&zc(e,n,r,i)),c=0,l=()=>c||=requestAnimationFrame(()=>(c=0,s())),u=new ResizeObserver(e=>(e.forEach(({target:e,borderBoxSize:t})=>e.style.gridRowEnd=`span ${Math.ceil((t[0].blockSize+Vc)/Bc)}`),l()));return setInterval(()=>document.querySelectorAll(`.age[data-since]`).forEach(e=>jc(e,Number(e.dataset.since))),15e3),addEventListener(`resize`,l),new ResizeObserver(([e])=>document.documentElement.style.setProperty(`--hud`,`${Math.ceil(e.borderBoxSize[0].blockSize)}px`)).observe(document.querySelector(`.hud`)),cs(),{layout:s,stats(e){let t=e.bases.flatMap(e=>[...e.tower?.subs??[],...e.tabs.flatMap(e=>e.units.flatMap(e=>[e,...e.subs]))]),n=e=>String(t.filter(t=>!e||t.mark===e).length);N(`s-commanding`,HTMLElement).parentElement.toggleAttribute(`data-on`,t.some(e=>e.mark===`commanding`));for(let[t,r]of[[`s-bases`,String(e.bases.length)],[`s-agents`,n()],[`s-working`,n(`working`)],[`s-commanding`,n(`commanding`)],[`s-waiting`,n(`waiting`)]])N(t,HTMLElement).textContent=r},show(e){let n=(e.link?.allies??[]).map(e=>({...e,id:`ally/${e.id}`,ally:!0}));z(t,[...e.bases,...n],e=>`ally`in e?Lc():Pc(),(e,t)=>`ally`in t?Rc(e,t):Ic(e,t));for(let e of t.children)a.has(e)||(a.add(e),u.observe(e));for(let e of a)e.isConnected||(a.delete(e),u.unobserve(e));requestAnimationFrame(s)},pause(e){document.documentElement.classList.toggle(`paused`,e)}}}function Uc(e,t){let n=N(`link-alerts`,HTMLButtonElement),r=N(`link-alerts-pop`,HTMLElement),i=N(`link-alerts-list`,HTMLElement),a=``,o=new Set,s=!0;r.addEventListener(`toggle`,e=>e.newState===`open`&&R(r,n)),r.setAttribute(`aria-label`,wn()),n.title=wn();let c=(e,t,n)=>{let r=n.querySelector(`.link-note`);for(let e of n.querySelectorAll(`button`))e.disabled=!0;w(`link/confirm-answer`,{dialogId:e.dialogId,allow:t}).then(e=>{e.ok||(r.textContent=e.body.reason??x({status:e.status}));for(let e of n.querySelectorAll(`button`))e.disabled=!1},()=>{r.textContent=y();for(let e of n.querySelectorAll(`button`))e.disabled=!1})},l=e=>{let t=S(`li`,{class:`link-alert`,"data-level":`warning`}),n=S(`button`,{type:`button`,class:`pair-btn`},Tn()),r=S(`button`,{type:`button`,class:`pair-btn`},kn());return n.onclick=()=>c(e,!0,t),r.onclick=()=>c(e,!1,t),t.append(S(`b`,null,Zo({id:``,kind:`confirm`,level:`warning`,team:e.team,teamName:``,data:{label:e.fromLabel,short:e.fromShort,tool:e.tool,tower:e.tower}})),S(`pre`,{class:`link-args`},e.args),S(`div`,{class:`devices-acts`},n,r),S(`small`,{class:`link-note`,role:`status`})),t};return{net(c){let u=Qo((c?.alerts??[]).filter(e=>e.kind!==`confirm`)),d=c?.confirms??[],f=JSON.stringify([u,d]);if(f===a)return;a=f;let p=new Set([...d.map(e=>`c/${e.dialogId}`),...u.filter(e=>e.kind===`join-request`).map(e=>e.id)]);s||t([...p].filter(e=>!o.has(e)).length),[o,s]=[p,!1];let m=u.length+d.length;n.hidden=m===0,n.textContent=Cn({count:String(m)}),n.dataset.state=d.length||u.some(e=>e.level===`error`)?`error`:u.some(e=>e.level===`warning`)?`waiting`:`done`,!m&&r.matches(`:popover-open`)&&r.hidePopover(),i.replaceChildren(...Yo(...d.map(l),...u.map(t=>{let n=S(`li`,{class:`link-alert`,"data-level":t.level},S(`span`,null,Zo(t)));if(t.kind===`join-request`||t.kind===`fork`||t.kind===`mismatch`){let i=S(`button`,{type:`button`,class:`later`},t.kind===`join-request`?In():Pn());i.onclick=()=>(r.hidePopover(),e()),n.append(i)}if(t.kind===`served`){let e=S(`a`,{class:`later`,href:`./`,"data-route":``},Bn());e.onclick=()=>r.hidePopover(),n.append(e)}return n})))}}}var Wc=new URL(`done-jqKY4qf5.mp3`,import.meta.url).href,Gc=new URL(`error-DdTLgPEw.mp3`,import.meta.url).href,Kc={waiting:new URL(`waiting-DOg8-8gu.mp3`,import.meta.url).href,error:Gc,done:Wc},qc=e=>e.mark===`waiting`||e.pending?`waiting`:e.mark===`error`?`error`:e.mark===`done`?`done`:void 0,Jc=(e,t)=>{try{return localStorage.getItem(e)??t}catch{return t}},Yc=(e,t)=>{try{localStorage.setItem(e,t)}catch{}};function Xc(e){let t=e=>document.getElementById(e),n=t(`remind`),r=t(`sound`),i=t(`sound-pop`),a=t(`sound-on`),o=t(`sound-vol`),s=t(`sound-vol-out`),c=typeof Notification<`u`,l=Jc(`sb.remind`,`1`)===`1`,u=Jc(`sb.sound`,`0`)===`1`,d=Math.min(100,Math.max(0,Number(Jc(`sb.volume`,`60`))||0)),f,p,m=new Map,h=()=>{let e=c?Notification.permission:`denied`;n.setAttribute(`aria-pressed`,String(l)),n.dataset.state=l?e===`granted`?`on`:e===`denied`?`blocked`:`ask`:`off`,n.title=c?l?e===`granted`?Hi():e===`denied`?Bi():zi():Vi():Ui(),r.dataset.state=u?`on`:`off`,r.setAttribute(`aria-label`,u?ia():ra()),a.checked=u,o.value=s.value=String(d),p&&(p.gain.value=(d/100)**2)};n.textContent=Ri(),r.textContent=na(),r.title=aa(),t(`sound-on-label`).textContent=na(),t(`sound-vol-label`).textContent=sa(),t(`sound-try`).textContent=oa(),n.onclick=async()=>{l&&c&&Notification.permission==="default"?await Notification.requestPermission().catch(()=>{}):Yc(`sb.remind`,(l=!l)?`1`:`0`),h()},i.addEventListener(`toggle`,e=>e.newState===`open`&&R(i,r)),a.onchange=()=>{Yc(`sb.sound`,(u=a.checked)?`1`:`0`),h(),u&&g(`done`)},o.oninput=()=>(Yc(`sb.volume`,String(d=Number(o.value))),h()),o.onchange=()=>g(`done`),t(`sound-try`).onclick=()=>g(`done`);function g(e){f??=new AudioContext,p||((p=f.createGain()).connect(f.destination),h());let t=f,n=p;m.has(e)||m.set(e,fetch(Kc[e]).then(e=>e.arrayBuffer()).then(e=>t.decodeAudioData(e))),Promise.all([t.resume(),m.get(e)]).then(([,e])=>{let r=t.createBufferSource();r.buffer=e,r.connect(n),r.start()}).catch(()=>m.delete(e))}return h(),{chime:()=>u&&g(`done`),signal(t){let n=t.flatMap(e=>(t=>t?[{a:e,k:t}]:[])(qc(e)));if(n.length&&(u&&g([`waiting`,`error`,`done`].find(e=>n.some(t=>t.k===e))),l&&c&&Notification.permission===`granted`&&(document.hidden||!document.hasFocus())))for(let{a:t,k:r}of n){let n=new Notification(t.name,{body:t.trust?Oo():{waiting:Ci,error:bi,done:_i}[r]({note:t.note??``}).trim(),tag:t.key,icon:document.querySelector(`link[rel="icon"]`)?.href,silent:r!==`waiting`});n.onclick=()=>(window.focus(),n.close(),e(t))}}}}var Zc=45e3,Qc=1e3,$c=3e4,el=(e,t)=>Math.min($c,Qc*2**(e-1))*(.8+.4*t);function tl(e){try{return JSON.parse(e)}catch{return}}function nl(e){let t,n,r,i=0,a={state:`connecting`,attempt:0},o=t=>e.onStatus(a={...a,...t}),s=()=>(e.clearTimeout(n),e.clearTimeout(r),n=r=void 0),c=()=>{let e=t;t=void 0,e?.close()},l=()=>{e.clearTimeout(r),r=e.setTimeout(()=>u(),Zc),o({state:`live`,attempt:0,lastContact:e.now()})},u=()=>{c(),s();let t=a.attempt+1;if(t>8)return o({state:`offline`,attempt:t});o({state:`reconnecting`,attempt:t}),e.hidden()||(n=e.setTimeout(d,el(t,e.random())))},d=()=>{c(),s(),i=e.now();let n=t=e.open();n.onError(()=>{t===n&&(u(),e.replaced?.().then(e=>{e&&a.state!==`live`&&a.state!==`replaced`&&(c(),s(),o({state:`replaced`}))},()=>{}))}),n.listen(`message`,r=>{if(t!==n)return;let i=tl(r);i&&e.onNet(i),o({problem:i?void 0:Ni()}),l()}),n.listen(`ping`,()=>t===n&&l()),n.listen(`problem`,e=>{t===n&&(o({problem:tl(e)??Pi()}),l())}),r=e.setTimeout(()=>u(),Zc)};return{start(){o({state:`connecting`,attempt:0}),d()},resume(){if(a.state===`replaced`)return;let n=e.now()-i<2e3||a.lastContact!==void 0&&e.now()-a.lastContact<=2e4;t&&n||(o({attempt:0,state:a.state===`live`?`reconnecting`:a.state}),d())},restart:d,hide(){e.clearTimeout(n),n=void 0},stop(){c(),s()}}}var rl={commanding:Gn,working:hr,waiting:fr,idle:er,done:Jn,error:Zn,unknown:lr},il=e=>(e.kind===`joined`?rr:e.kind===`left`?or:rl[e.mark])({name:e.name}),al=18e5,ol={waiting:0,error:0,working:1,commanding:1},sl=e=>new Date(e).toLocaleTimeString([],{hour12:!1});function cl(e){let[t,n,r,i,a]=[`.tl-lanes`,`.tl-axis`,`.tl-at`,`.tl-last`,`.tl-span`].map(t=>e.querySelector(t)),o=[],s=``;matchMedia(`(max-width: 640px)`).matches&&(e.open=!1);let c=()=>{let e=Date.now()-al,s=o.filter(t=>t.at>=e),c=s.at(-1);t.replaceChildren(...s.map(t=>{let n=document.createElement(`a`),r=(t.at-e)/al*100;return n.className=`tl-mark ${t.kind}${r>70?` end`:``}`,n.dataset.mark=t.kind===`left`?`unknown`:t.mark,n.style.cssText=`left:${r.toFixed(2)}%;top:${(ol[t.mark]??2)*14+4}px`,n.setAttribute(`aria-label`,`${sl(t.at)} ${il(t)}`),L(n,t.key&&t.kind!==`left`?{view:`session`,ws:t.ws,key:t.key}:{view:`workspace`,ws:t.ws}),n})),n.replaceChildren(...[0,10,20].map(t=>Object.assign(document.createElement(`span`),{textContent:sl(e+t*6e4).slice(0,5)})),Object.assign(document.createElement(`span`),{textContent:Aa()})),r.textContent=c?sl(c.at):``,i.textContent=c?il(c):ka(),a.textContent=Na({count:String(s.length)})};return setInterval(c,3e4),c(),{net(e){let t=e.events??[],n=t.map(e=>`${e.at}${e.kind}${e.key??e.name}${e.mark}`).join();n!==s&&(s=n,o=t,c())}}}Lo();var H=Hc(),ll=cl(document.getElementById(`timeline`)),U=e=>document.getElementById(e),ul=e=>e?new Date(e).toLocaleTimeString([],{hour12:!1}):ci(),dl,W,fl,pl={state:`connecting`,attempt:0},G={view:`map`},ml=!1,hl,gl=``,K,_l,vl=e=>K?e(K):void _l?.then(e);function yl(){_l??=O(async()=>{let{mountFocus:e}=await import(`./views-BmcT2brW.js`);return{mountFocus:e}},[],import.meta.url).then(({mountFocus:e})=>(K=e({data:Fl,restart:()=>Q.restart(),openTile:Y,embedTerminal:(e,t,n)=>new Promise(r=>J(i=>r(i.terminal.embed(e,t,n)))),online:()=>pl.state===`live`}),K.show(G,G),W&&K.net(W),K))}var q,bl,J=e=>{if(q)return e(q);bl??=O(async()=>{let{mountPanels:e}=await import(`./layer-fdSmeR4i.js`);return{mountPanels:e}},[],import.meta.url).then(({mountPanels:e})=>q=e({label:e=>W?.bases.find(t=>t.id===e)?.label??e,recent:async e=>(await(Pl?Pl.data(e).latest():Nl(e,`?limit=12`))).items,post:e=>Pl&&((t,n)=>Pl.data(e).post(t,n)),stream:()=>gl,showTerminal:(e,t)=>(q?.stack.close(),K?.terminal(t),Z.go({view:`session`,ws:e,key:t}))})),bl.then(e)},Y=(e,t)=>J(n=>n.tiles.open(e,t)),X=document.querySelector(`link[rel="icon"]`),xl=X&&decodeURIComponent(X.href.slice(X.href.indexOf(`,`)+1)),Sl=0;function Cl(e){let t=e.bases.flatMap(e=>[...e.tower?[e.tower,...e.tower.subs]:[],...[...e.tabs.flatMap(e=>e.units),...e.outside].flatMap(e=>[e,...e.subs])]).filter(e=>e.mark===`waiting`||e.pending).length+(e.trust?.length??0);if(!X||!xl||t===Sl)return;Sl=t;let n=`<circle cx='23' cy='9' r='9' fill='#e0af68' stroke='#1a1b26' stroke-width='2'/><text x='23' y='13' text-anchor='middle' font-family='sans-serif' font-size='${t>9?9:12}' font-weight='700' fill='#16161e'>${t>9?`9+`:t}</text>`;X.href=`data:image/svg+xml,${encodeURIComponent(t?xl.replace(`</svg>`,`${n}</svg>`):xl)}`}var wl;function Tl(e){W=fl=e,Cl(e),Rl.net(e.link);let t=Vo(e,Date.now());if(wl&&zl.signal(Ho(wl,t)),wl=t,document.hidden)return;H.stats(e),pc(U(`dismiss-all`),e),mc(U(`stashed`),U(`stashed-list`),e),$?.net(e);let n=Ho(hl,t);(n.length||q)&&J(e=>e.alerts(n,t)),hl=t,ll.net(e),vl(t=>t.net(e)),G.view===`map`&&(H.show(e),dl=e,fl=void 0)}function El(e){let t=G,n=e.view===`workspace`&&t.view===`map`?document.querySelector(`#bases [data-key="${CSS.escape(e.ws)}"]`)?.getBoundingClientRect():void 0;G=e,$?.route(e),e.view!==`map`&&yl(),U(`map`).hidden=e.view!==`map`,U(`legend`).hidden=e.view===`session`,U(`stage`).dataset.view=e.view,vl(r=>r.show(e,t,n)),e.view===`map`&&W&&W!==dl&&(Tl(W),requestAnimationFrame(H.layout)),ml&&vs(e)!==vs(t)&&Q.restart()}function Dl(e){pl=e;let t=e.state===`reconnecting`||e.state===`offline`||e.state===`replaced`;document.body.dataset.stale=U(`stage`).dataset.stale=String(t),U(`link`).dataset.state=e.state,U(`link-text`).textContent={connecting:On,live:An,reconnecting:Fn,offline:Mn,replaced:Mn}[e.state](),K&&W&&K.net(W),q?.stack.redraw();let n=U(`banner`);n.hidden=!t&&!e.problem;let r=e.state===`replaced`?Ee():e.state===`offline`?ve({tries:e.attempt-1}):e.state===`reconnecting`?e.attempt?Te({attempt:e.attempt}):Se():xe({problem:e.problem??``}),i=document.createElement(`b`);i.textContent=ul(e.lastContact),n.replaceChildren(`${r} ${he()} `,i,me())}function Ol(e,t){try{let n=JSON.parse(t);vl(t=>e===`history`?t.history(n):t.cards(n))}catch{}}var kl=document.querySelector(`meta[name="sb-build"]`)?.content,Al=e=>!!(kl&&kl!==JSON.parse(e).build);function jl(e){let t=new EventSource(e?`events?watch=${encodeURIComponent(e)}`:`events`);return{onError:e=>t.onerror=e,listen:(e,n)=>t.addEventListener(e,e=>n(e.data)),close:()=>t.close()}}var Ml=e=>fetch(`api/${e}`,{cache:`no-store`}).then(e=>e.ok?e.json():Promise.reject(Error(String(e.status)))),Nl=(e,t=``)=>Ml(`history/${encodeURIComponent(e)}${t}`),Pl=void 0,Fl=e=>({older:t=>Nl(e,`?before=${encodeURIComponent(t)}`),latest:()=>Nl(e),entry:t=>Ml(`entry/${encodeURIComponent(e)}/${encodeURIComponent(t)}`).catch(()=>void 0),pic:(t,n)=>`api/image/${encodeURIComponent(e)}/${encodeURIComponent(t)}/${n}`}),Il=()=>{let e=jl(vs(G));return e.listen(`history`,e=>Ol(`history`,e)),e.listen(`cards`,e=>Ol(`cards`,e)),e.listen(`hello`,e=>Al(e)?location.reload():(gl=e,q?.terminal.hello())),e.listen(`mirror`,e=>q?.terminal.frame(e)),e};document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[data-alert]`),n=t&&gs(t.getAttribute(`data-route`)??``);if(!n||n.view!==`session`||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let r=hl?.get(n.key);r&&(e.preventDefault(),J(e=>e.stack.show(r)))},!0);var Z=bs(e=>El(e)),Ll=()=>void O(async()=>{let{linkTile:e}=await import(`./link-DEyMVgpE.js`);return{linkTile:e}},[],import.meta.url).then(({linkTile:e})=>Y(e(),!0)),Rl=Uc(Ll,e=>e&&zl.chime()),zl=Xc(e=>e.trust?J(t=>t.stack.show(e)):Z.go({view:`session`,ws:e.ws,key:zo(e)})),Q=nl({open:Il,now:Date.now,setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e),random:Math.random,hidden:()=>document.hidden,onNet:Tl,onStatus:Dl,replaced:()=>fetch(`./`,{cache:`no-store`}).then(e=>e.status===403)}),Bl=()=>Q.resume();document.addEventListener(`visibilitychange`,()=>{if(H.pause(document.hidden),document.hidden)return Q.hide();fl&&Tl(fl),vl(e=>e.wake()),Bl()}),addEventListener(`keydown`,e=>{e.key!==`Escape`||e.defaultPrevented||document.querySelector(`dialog.sheet[open], dialog.lightbox[open], [popover]:popover-open`)||(e.preventDefault(),!q?.stack.close()&&G.view!==`map`&&Z.go(_s(G)))}),Jo(e=>q?.hotkey(e)??!1),U(`teams`).addEventListener(`click`,Ll),U(`pair`).hidden=ec(location.hostname),U(`pair`).addEventListener(`click`,()=>void O(async()=>{let{pairTile:e}=await import(`./pair-ChR0ekqj.js`);return{pairTile:e}},[],import.meta.url).then(({pairTile:e})=>Y(e(),!0))),U(`server`).hidden=location.hostname!==`127.0.0.1`,U(`server`).addEventListener(`click`,()=>void O(async()=>{let{serverTile:e}=await import(`./server-894bzpGw.js`);return{serverTile:e}},[],import.meta.url).then(({serverTile:e})=>Y(e(),!0)));var $,Vl=matchMedia(`(pointer: coarse), (max-width: 640px)`),Hl=()=>void O(async()=>{let{mountDrawer:e}=await import(`./drawer-aV6sM3Cp.js`);return{mountDrawer:e}},[],import.meta.url).then(({mountDrawer:e})=>($??=e(),W&&$.net(W),$.route(G)));Vl.matches?Hl():Vl.addEventListener(`change`,()=>Vl.matches&&!$&&Hl(),{once:!0}),_c({route:()=>G,net:()=>W,go:e=>Z.go(e)}),U(`stashed-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&R(U(`stashed-pop`),U(`stashed`))),U(`prefs-pop`).addEventListener(`toggle`,e=>e.newState===`open`&&R(U(`prefs-pop`),U(`prefs`))),document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`button[data-open]`);t&&O(async()=>{let{openingOf:e,spawnTile:t}=await import(`./spawn-4YbdgJBa.js`);return{openingOf:e,spawnTile:t}},[],import.meta.url).then(({openingOf:e,spawnTile:n})=>{let r=e(t,W?.bases??[]);r&&Y(n(r,(e,t,n)=>(q?.tiles.close(n),Z.go({view:`session`,ws:e,key:t})),()=>zl.chime()),!0)})});for(let e of[`focus`,`pageshow`,`online`])window.addEventListener(e,()=>!document.hidden&&Bl());Dl(pl),El(Z.route()),Q.start(),ml=!0;export{Ko as $,Bs as A,ie as At,fs as B,pc as C,Qt as Ct,zs as D,ke as Dt,Vs as E,$e as Et,Us as F,ls as G,us as H,js as I,$o as J,w as K,As as L,Hs as M,Gs as N,Es as O,Oe as Ot,Ks as P,Xo as Q,xs as R,hc as S,cn as St,Js as T,Vt as Tt,ps as U,T as V,ds as W,S as X,es as Y,Yo as Z,z as _,ci as _t,L as a,Sa as at,cc as b,bn as bt,I as c,Ki as ct,M as d,x as dt,Ro as et,Ec as f,Ei as ft,Dc as g,ui as gt,Sc as h,di as ht,Oc as i,Ea as it,Ws as j,te as jt,Ts as k,_ as kt,kc as l,Gi as lt,F as m,y as mt,vc as n,zo as nt,Nc as o,xa as ot,Tc as p,fi as pt,as as q,j as r,ko as rt,N as s,Yi as st,xc as t,Bo as tt,R as u,Wi as ut,P as v,Hr as vt,O as w,Ht as wt,oc as x,dn as xt,Cc as y,Er as yt,E as z};
|