pi-straw-boss 0.97.0 → 0.98.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/NOTICE.md +13 -3
- package/README.md +4 -2
- package/README.zh-TW.md +4 -2
- package/dist/gui/assets/{allyasks-D10CgLCk.js → allyasks-BY-NwiK5.js} +2 -2
- package/dist/gui/assets/allyunits-B9DbNTsq.js +2 -0
- package/dist/gui/assets/{answer-Bf5L7ikL.js → answer-ChjVWtA7.js} +1 -1
- package/dist/gui/assets/{ask-D3RGpzUJ.js → ask-BAt58Mlv.js} +1 -1
- package/dist/gui/assets/{asks-gZy3oCST.js → asks-grX34oB6.js} +1 -1
- package/dist/gui/assets/{askview-BHYiKj0D.js → askview-kfMnaYAk.js} +1 -1
- package/dist/gui/assets/autoback-BwfR4EQl.js +2 -0
- package/dist/gui/assets/{blockschunk-DxGXJvKd.js → blockschunk-DJacWeSo.js} +93 -83
- package/dist/gui/assets/boot-DFAu4Wgr.js +72 -0
- package/dist/gui/assets/{box-oqjw39YP.js → box-DOqsrONn.js} +1 -1
- package/dist/gui/assets/{chat-DhAI904v.js → chat-DrJQ99_m.js} +2 -2
- package/dist/gui/assets/{copy-OYhtU_G-.js → copy-BkYMWq9q.js} +1 -1
- package/dist/gui/assets/drawer-DjXNKvdU.js +1 -0
- package/dist/gui/assets/index-CQtxJFRw.js +4 -0
- package/dist/gui/assets/index-w4qFe3dr.css +1 -0
- package/dist/gui/assets/{lanwait-CnHAARL6.js → lanwait-RymCQjCx.js} +1 -1
- package/dist/gui/assets/layer-BIsQwhRo.js +1 -0
- package/dist/gui/assets/{lightbox-CCzRvB29.js → lightbox-BPXfZTek.js} +1 -1
- package/dist/gui/assets/link-n34y570C.js +1 -0
- package/dist/gui/assets/linkdialogs-CdnqqK-6.js +1 -0
- package/dist/gui/assets/marimba-C8mX0MKf.mp3 +0 -0
- package/dist/gui/assets/{mdbody-CCMLbIiV.js → mdbody-TCBjLlVA.js} +2 -2
- package/dist/gui/assets/{pair-CLHgWyGU.js → pair-Bt3_oS6r.js} +3 -3
- package/dist/gui/assets/{picker-BSsuidyx.js → picker-Dn11L7yC.js} +1 -1
- package/dist/gui/assets/{server-jRKNQ00n.js → server-W2hvaNUi.js} +2 -2
- package/dist/gui/assets/{sessionfacts-B10W8Tnp.js → sessionfacts-k-iYU6UE.js} +1 -1
- package/dist/gui/assets/{settings-CJjA_G-F.js → settings-ppzwBzTR.js} +2 -2
- package/dist/gui/assets/{spawn-Djs0ihu1.js → spawn-Bid-ciT4.js} +1 -1
- package/dist/gui/assets/{termcard-BiVW2HNE.js → termcard-BGxPw11W.js} +5 -5
- package/dist/gui/assets/{towerturns-DJ89gl5C.js → towerturns-CQXPvXLw.js} +1 -1
- package/dist/gui/assets/{trains-CHhLGtkV.js → trains-C-OyGvCg.js} +1 -1
- package/dist/gui/assets/{trust-DmzWsnkn.js → trust-Kha1VLdr.js} +1 -1
- package/dist/gui/assets/views-EUqV1oz2.js +3 -0
- package/dist/gui/assets/waitcard-DoDDMtr6.js +1 -0
- package/dist/gui/assets/yard-6HZ9KXEt.js +1 -0
- package/dist/gui/index.html +8 -7
- package/dist/gui/themes/geek/{geek-BEJdSv6Q.css → geek-DKTbBMez.css} +1 -1
- package/dist/gui/themes/raven/{raven-DGujKSc6.js → raven-C0zmMXos.js} +8 -1
- package/dist/gui/themes/storybook/backdrop-day-Dn3Fw0N1.webp +0 -0
- package/dist/gui/themes/storybook/backdrop-night-CgpfG4j3.webp +0 -0
- package/dist/gui/themes/storybook/favicon-storybook-DEGRmtRq.svg +1 -0
- package/dist/gui/themes/storybook/kalimba-thumb-pluck-BCuhSDJF.mp3 +0 -0
- package/dist/gui/themes/storybook/night-cricket-meadow-Bqg5DdBj.mp3 +0 -0
- package/dist/gui/themes/storybook/place-forest-birds-singing-CAVrIQL7.mp3 +0 -0
- package/dist/gui/themes/storybook/storybook-BMCr3y6o.css +1 -0
- package/dist/gui/themes/storybook/storybook-ChSlGjc_.js +11 -0
- package/dist/gui/themes/zen/zen-BjTzN8F5.js +2 -0
- package/dist/gui/themes.json +14 -8
- package/dist/server/main.mjs +7 -3
- package/package.json +2 -2
- package/src/answered.ts +2 -2
- package/src/boss.ts +1 -1
- package/src/bossviews.ts +2 -2
- package/src/host.ts +1 -1
- package/src/server/guihost.ts +4 -3
- package/src/server/guiprefs.ts +10 -2
- package/src/views.ts +11 -6
- package/dist/gui/assets/allyunits-4W1xhATx.js +0 -2
- package/dist/gui/assets/autoback-DLEkymBb.js +0 -2
- package/dist/gui/assets/boot-BCyyZKXB.js +0 -53
- package/dist/gui/assets/drawer-WFT2-tGS.js +0 -1
- package/dist/gui/assets/index-JNy9LPcl.js +0 -4
- package/dist/gui/assets/index-QWRB6fh0.css +0 -1
- package/dist/gui/assets/layer-C-twSMfn.js +0 -1
- package/dist/gui/assets/link-0Dk9mHpb.js +0 -1
- package/dist/gui/assets/linkdialogs-ZVggush6.js +0 -1
- package/dist/gui/assets/views-B752Jx2Y.js +0 -3
- package/dist/gui/assets/waitcard-BE0DHpyY.js +0 -1
- package/dist/gui/assets/waiting-DOg8-8gu.mp3 +0 -0
- package/dist/gui/assets/yard-v3MeFhGO.js +0 -1
- package/dist/gui/themes/zen/zen-D4lhOxtO.js +0 -2
- /package/dist/gui/themes/geek/{geek-BirbB51I.js → geek-Cwnsup9m.js} +0 -0
package/NOTICE.md
CHANGED
|
@@ -55,7 +55,7 @@ SOFTWARE.
|
|
|
55
55
|
|
|
56
56
|
## Sounds (`gui/sounds/`)
|
|
57
57
|
|
|
58
|
-
The GUI's one sound effect, `
|
|
58
|
+
The GUI's one sound effect, `marimba.mp3` (the question clip), is not covered by the MIT licence of this project's code, and it is not CC0. It comes from [Casper's free sound effects](https://www.casper.tw/sound-effects/zh-tw/) and is used under its licence, https://www.casper.tw/sound-effects/zh-tw/license/: free use, with no AI training, no repackaging as a sound pack, and no Content ID registration. It is 馬林巴短音 (ui-message-marimba), https://www.casper.tw/sound-effects/zh-tw/search/?q=ui-message-marimba, trimmed to its first 0.6 s with a 0.2 s fade-out and converted to mono MP3.
|
|
59
59
|
|
|
60
60
|
## BIP-39 English word list (`src/link/bip39-english.ts`)
|
|
61
61
|
|
|
@@ -67,7 +67,17 @@ The short lines under the Zen view's idle circle (`gui/zenlines.ts`) are one sen
|
|
|
67
67
|
|
|
68
68
|
## Raven Keep view (`gui/themes/raven/`)
|
|
69
69
|
|
|
70
|
-
The Raven Keep (鴉閣) view's art is original to this project. Its ten role icons and its crest favicon were drawn as an ink-engraving sheet with an image generator (Codex image generation) and traced to single-colour SVG with [potrace](https://potrace.sourceforge.net/) (`sprite.svg`, `favicon.svg`); the backdrop illustration (`backdrop.webp`) was made with the same generator and resized; so was the perched raven (`perch.webp`, one strip of two frames, profile and head turned: the head of the second frame is blended onto the body of the first). The chat page's four rooms (`room-study.webp`, `room-hall.webp`, `room-crypt.webp`, `room-library.webp`) are the same generator's pictures, resized to 1280 by 800; the blood goblet (`raven-main`) and the keep's front (`raven-crown`) in the sprite were redrawn by hand as bold single paths after their traced designs, so they read at 16 px. The Zen ensō and Geek `>_` tab icons (`gui/themes/zen/favicon.svg`, `gui/themes/geek/favicon.svg`) are drawn for this project. Nothing in them is copied from a published setting.
|
|
70
|
+
The Raven Keep (鴉閣) view's art is original to this project. Its ten role icons and its crest favicon were drawn as an ink-engraving sheet with an image generator (Codex image generation) and traced to single-colour SVG with [potrace](https://potrace.sourceforge.net/) (`sprite.svg`, `favicon.svg`); the backdrop illustration (`backdrop.webp`) was made with the same generator and resized; so was the perched raven (`perch.webp`, one strip of two frames, profile and head turned: the head of the second frame is blended onto the body of the first). The chat page's four rooms (`room-study.webp`, `room-hall.webp`, `room-crypt.webp`, `room-library.webp`) are the same generator's pictures, resized to 1280 by 800; the blood goblet (`raven-main`) and the keep's front (`raven-crown`) in the sprite were redrawn by hand as bold single paths after their traced designs, so they read at 16 px. The Zen ensō and Geek `>_` tab icons (`gui/themes/zen/favicon.svg`, `gui/themes/geek/favicon.svg`) are drawn for this project. The Storybook apple-tree house illustrations (`gui/themes/storybook/backdrop-day.webp` and `backdrop-night.webp`) are original Codex image generation artwork, resized to 1280 by 721. The Storybook animals were drawn with Codex image generation and traced with [potrace](https://potrace.sourceforge.net/) for `sprite.svg`; the bluebird and its letter were redrawn by hand for legibility at 16 px. The favicon uses the bunny from the same sheet. The seven kind icons in each of the Storybook and Raven Keep sprites were drawn with Codex image generation and traced with potrace. Nothing in them is copied from a published setting.
|
|
71
|
+
|
|
72
|
+
### Storybook sounds (`gui/themes/storybook/sounds/`): not MIT
|
|
73
|
+
|
|
74
|
+
These mono MP3 clips come from [Casper's free sound effects](https://www.casper.tw/sound-effects/zh-tw/) and are not MIT or CC0. [Casper's licence](https://www.casper.tw/sound-effects/zh-tw/license/) permits free use but prohibits AI training, repackaging as a sound pack, and Content ID registration.
|
|
75
|
+
|
|
76
|
+
- [拇指琴單音 (`kalimba-thumb-pluck`)](https://sound-effects.casper.tw/audio/kalimba-thumb-pluck.d0a056ae.mp3): trimmed to 1.7 seconds with a fade-out for the question cue.
|
|
77
|
+
- [森林鳥鳴 (`place-forest-birds-singing`)](https://sound-effects.casper.tw/audio/place-forest-birds-singing.f4919cfe.mp3): the daytime loop, with its ends cross-faded.
|
|
78
|
+
- [草地蟋蟀 (`night-cricket-meadow`)](https://sound-effects.casper.tw/audio/night-cricket-meadow.ab7dbe24.mp3): the nighttime loop, with its ends cross-faded.
|
|
79
|
+
|
|
80
|
+
Powered by Stability AI — This Stability AI Model is licensed under the Stability AI Community License, Copyright © Stability AI Ltd. All Rights Reserved.
|
|
71
81
|
|
|
72
82
|
### Raven Keep sounds (`gui/themes/raven/sounds/`): not MIT
|
|
73
83
|
|
|
@@ -83,7 +93,7 @@ This Stability AI Model is licensed under the Stability AI Community License, Co
|
|
|
83
93
|
|
|
84
94
|
## pi-better-show (`dist/gui/assets/blockschunk-*.js`)
|
|
85
95
|
|
|
86
|
-
The GUI's block chunk bundles [pi-better-show](https://github.com/wayne930242/pi-better-show) 0.
|
|
96
|
+
The GUI's block chunk bundles [pi-better-show](https://github.com/wayne930242/pi-better-show) 0.10.1 (its parser, its answer encoding, and its fourteen elements), and with it the [yaml](https://github.com/eemeli/yaml) library 2.9.1.
|
|
87
97
|
|
|
88
98
|
pi-better-show: MIT License, Copyright (c) 2026 wayne930242
|
|
89
99
|
|
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ English | [繁體中文](https://github.com/wayne930242/pi-straw-boss/blob/main/
|
|
|
12
12
|
|
|
13
13
|
<p align="center"><img src="docs/gui-board-capacity.png" width="49%" alt="The situation board in the Standard view: the device budget as 1-point slots, each deployed unit a chip over its points, the free slots, the barracks with the ready work, and each commander's units and ready count"> <img src="docs/gui-board-raven.png" width="49%" alt="The same board in Raven Keep: candle graves lit by the deployed bats, empty graves in mist, the keep's gate with the waiting bats, a pause as a shut coffin and a stale main as circling crows"></p>
|
|
14
14
|
|
|
15
|
+
<p align="center"><img src="docs/gui-storybook-day.png" width="80%" alt="The Storybook map by day, with animal icons on paper cards"></p>
|
|
16
|
+
|
|
15
17
|
<p align="center"><img src="docs/gui-comms.png" width="49%" alt="A unit's comms: its chat as a live log, the messages queued for its next turn, its todo list, its background monitors, and its dossier"> <img src="docs/gui-zen-item.png" width="49%" alt="The Zen view with one item: a robot_hand question on an ink-dark page, its choices as lines of text"></p>
|
|
16
18
|
|
|
17
19
|
## Why
|
|
@@ -22,7 +24,7 @@ pi-straw-boss lets them find each other and coordinate, without a scheduler or a
|
|
|
22
24
|
- **Everyone joins.** Each pi in Herdr joins its tab's net at start. An agent whose work grows (several steps, dispatching workers, more than one app) promotes itself to the tab's **main agent**; you, the boss, can take over with `/boss`.
|
|
23
25
|
- **A tower per workspace**, an agent in a tab of its own, opens when agents start to collide: a member dispatches a subagent, or an agent promotes itself. It coordinates the mains and the other towers, and opens a tab with a new main for work no session owns. You don't need to talk to it.
|
|
24
26
|
- **A head tower of your own** takes your instructions in one long conversation and hands each to the workspace that owns it.
|
|
25
|
-
- **The browser view**, `/boss gui`: every workspace, agent, and subagent live, and the questions they wait on, answered in place from a desktop or a paired phone.
|
|
27
|
+
- **The browser view**, `/boss gui`: every workspace, agent, and subagent live, and the questions they wait on, answered in place from a desktop or a paired phone. Choose Storybook for a notebook that changes from day to night, or press Zen in the header to see one thing at a time.
|
|
26
28
|
- **Merge trains**: a project can batch its reviewed branches, so the heavy gates (lint, build, full suites) run once per train instead of once per branch.
|
|
27
29
|
- **Straw Link** connects the towers of teammates' computers, and an unattended build box can take work from them.
|
|
28
30
|
- **Auto mode**: tell the head tower you are going to sleep, and no agent waits on you until you are back. Agents keep working, and what needed you goes back to the agent that asked, to ask you again when you are back.
|
|
@@ -72,4 +74,4 @@ The [documentation site](https://wayne930242.github.io/pi-straw-boss/docs/) is i
|
|
|
72
74
|
|
|
73
75
|
## License
|
|
74
76
|
|
|
75
|
-
MIT. The browser view's icons come from [game-icons.net](https://game-icons.net) (Lorc and Delapouite, [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)); see [gui/ICONS.md](gui/ICONS.md). The Raven
|
|
77
|
+
MIT. The browser view's icons come from [game-icons.net](https://game-icons.net) (Lorc and Delapouite, [CC BY 3.0](https://creativecommons.org/licenses/by/3.0/)); see [gui/ICONS.md](gui/ICONS.md). The recorded sounds in Standard, Raven Keep and Storybook are not MIT: they are used under Casper's sound-effects licence; see [NOTICE.md](NOTICE.md).
|
package/README.zh-TW.md
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
<p align="center"><img src="docs/gui-board-capacity.png" width="49%" alt="標準檢視的戰況板:裝置預算畫成每格 1 點的補給格,每個已部署的單位橫跨它的點數,旁邊是空格、放待命工作的兵營,以及每位指揮官的單位與可接件數"> <img src="docs/gui-board-raven.png" width="49%" alt="鴉閣檢視的同一張板:已部署的蝙蝠點亮燭火墓位,空墓泛霧,閣門前有待命的蝙蝠,額度停機是合上的棺木,停滯的主智慧體上方群鴉盤旋"></p>
|
|
14
14
|
|
|
15
|
+
<p align="center"><img src="docs/gui-storybook-day.png" width="80%" alt="白天的繪本地圖,每張紙卡上都有代表角色的動物圖示"></p>
|
|
16
|
+
|
|
15
17
|
<p align="center"><img src="docs/gui-comms.png" width="49%" alt="單位的通訊畫面:即時的對話紀錄、排隊等下一輪的訊息、待辦清單、背景 Monitor,以及單位檔案"> <img src="docs/gui-zen-item.png" width="49%" alt="禪檢視裡的一件待辦:墨色畫面上是一個 robot_hand 問題,選項是一行行的字"></p>
|
|
16
18
|
|
|
17
19
|
## 為什麼需要它
|
|
@@ -22,7 +24,7 @@ pi-straw-boss 讓它們能找到彼此、互相協調,不需要排程器,也
|
|
|
22
24
|
- **每個人都會加入。** Herdr 裡的每個 pi 一啟動就加入所在分頁的網。工作變多(步驟變多、要派工作者、涉及不只一個 app)的智慧體會升任為分頁的**主智慧體**;你,也就是老闆,可以用 `/boss` 接手。
|
|
23
25
|
- **每個工作區一座塔台**:它是一個在自己分頁裡的智慧體,在智慧體開始互相干擾時開起來(成員派出子智慧體,或有智慧體升任)。它協調各個主智慧體和其他塔台;沒有 session 負責的工作,它會開一個分頁、啟動新的主智慧體來處理。你不用跟它說話。
|
|
24
26
|
- **你自己的主塔台**,和你保持一場長對話,把你交代的每件事轉給該處理的工作區。
|
|
25
|
-
- **瀏覽器畫面** `/boss gui
|
|
27
|
+
- **瀏覽器畫面** `/boss gui`:即時看到每個工作區、智慧體和子智慧體,它們在等你回答的問題,可以直接在桌面或已配對的手機上回答。選「繪本」會看到隨日夜換色的手帳;按頁首的「禪」,就能一次只看一件事。
|
|
26
28
|
- **合併火車**:專案可以把審查過的分支整批合併,重型檢查(lint、build、完整測試)每列火車只跑一次,不必每條分支各跑一次。
|
|
27
29
|
- **Straw Link** 連起隊友電腦上的塔台,無人值守的建置機也能接隊友送來的工作。
|
|
28
30
|
- **自動模式**:跟主塔台說你要去睡了,在你回來之前,沒有智慧體會等你。智慧體照常工作,需要你的事等你回來時退回給提出的智慧體,由它再問你一次。
|
|
@@ -68,4 +70,4 @@ pi install npm:pi-straw-boss
|
|
|
68
70
|
|
|
69
71
|
## 授權
|
|
70
72
|
|
|
71
|
-
MIT。瀏覽器畫面的圖示來自 [game-icons.net](https://game-icons.net)(Lorc 與 Delapouite,[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/));見 [gui/ICONS.md](gui/ICONS.md)
|
|
73
|
+
MIT。瀏覽器畫面的圖示來自 [game-icons.net](https://game-icons.net)(Lorc 與 Delapouite,[CC BY 3.0](https://creativecommons.org/licenses/by/3.0/));見 [gui/ICONS.md](gui/ICONS.md)。標準、鴉閣與繪本使用的錄音不屬 MIT,依 Casper 音效庫的授權使用;見 [NOTICE.md](NOTICE.md)。
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{T as e}from"./towermodel-CUStB7ST.js";import{t}from"./runtime-ZX6HkxDa.js";import{
|
|
2
|
-
`);o!==i.ids&&(i.list.replaceChildren(...a),i.ids=o)}return{toggle:
|
|
1
|
+
import{T as e}from"./towermodel-CUStB7ST.js";import{t}from"./runtime-ZX6HkxDa.js";import{ft as n,gt as r,mt as i}from"./index-CQtxJFRw.js";import{mountDialogCards as a}from"./linkdialogs-CdnqqK-6.js";var o=t=>{let n=e(`en`,t?.count,{},!0);return n===`one`?`${t?.count} question waits for you: answer it here`:n===`other`?`${t?.count} questions wait for you: answer them here`:`ally_asks_button`},s=e=>`${e?.count} 個問題等你回答,在這裡回答`,c=((e,n={})=>(n.locale??t())===`zh-TW`?s(e):o(e)),l=e=>e.tower===`blocked`||e.tabs.some(e=>e.state===`blocked`);function u(e){let t=new Map,r=i(e?.allies??[]);for(let i of e?.alerts??[]){let e=i.kind===`dialog`?n(i):void 0;if(e!==`open`&&e!==`sent`)continue;let a=r.filter(e=>e.device===i.data.device),o=a.filter(e=>e.teams.some(e=>e.team===i.team)),s=o.length?o:a,c=s.find(l)??s[0];c&&t.set(c.id,[...t.get(c.id)??[],i])}return t}var d=`.ally-unit[data-state="blocked"], .ally-tab[data-state="blocked"]`;function f(){let e=new WeakMap,t=t=>{let i=e.get(t);if(i)return i;let o=r(`button`,{type:`button`,class:`ally-asks-btn`,"aria-expanded":`false`}),s=r(`ul`,{class:`ally-asks-list`}),c=r(`div`,{class:`ally-asks`},o,s);return i={box:c,btn:o,list:s,cards:a(),ids:``},e.set(t,i),o.onclick=()=>n(t),t.addEventListener(`click`,e=>{let r=e.target?.closest?.(d);r&&t.contains(r)&&t.dataset.asks&&!e.target.closest(`details`)&&n(t)}),t.append(c),i};function n(t){let n=e.get(t);if(!n||!t.dataset.asks)return;let r=t.dataset.asking===void 0;r?t.dataset.asking=``:delete t.dataset.asking,n.list.hidden=!r,n.btn.setAttribute(`aria-expanded`,String(r))}function i(n,r){if(!r.length&&!e.has(n))return;let i=t(n);if(i.box.hidden=!r.length,!r.length){delete n.dataset.asks,delete n.dataset.asking,i.btn.setAttribute(`aria-expanded`,`false`),i.cards.keep(new Set),i.list.replaceChildren(),i.ids=``;return}n.dataset.asks=String(r.length),i.btn.textContent=c({count:r.length}),i.list.hidden=n.dataset.asking===void 0,i.cards.keep(new Set(r.map(e=>e.id)));let a=r.map(e=>i.cards.row(e)),o=r.map(e=>e.id).join(`
|
|
2
|
+
`);o!==i.ids&&(i.list.replaceChildren(...a),i.ids=o)}return{toggle:n,fill:i,show:(e,t,n)=>i(e,u(n).get(t.id)??[])}}export{f as mountAllyAsks};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{T as e}from"./towermodel-CUStB7ST.js";import{t}from"./runtime-ZX6HkxDa.js";import{t as n}from"./sentencepack-DtYqpppS.js";import{t as r}from"./link_unit_ago-CvB9wMxM.js";import{At as i,C as a,E as o,Ht as s,K as c,Mt as l,T as u,W as d,ct as f,ht as p,it as ee,j as m,l as h,ot as te,v as g}from"./index-CQtxJFRw.js";var ne=e=>`by ${e?.who}`,re=e=>`派工者 ${e?.who}`,ie=((e,n={})=>(n.locale??t())===`zh-TW`?re(e):ne(e)),ae=((e={},n={})=>(n.locale??t())===`zh-TW`?`中斷並停止`:`Interrupt and stop`),oe=e=>`${e?.box} was not asked: ${e?.reason}`,se=e=>`沒有請 ${e?.box} 停止:${e?.reason}`,_=((e,n={})=>(n.locale??t())===`zh-TW`?se(e):oe(e)),v=((e={},n={})=>(n.locale??t())===`zh-TW`?`停止`:`Stop`),y=e=>`Stop the main ${e?.name}`,b=e=>`停止主智慧體 ${e?.name}`,x=((e,n={})=>(n.locale??t())===`zh-TW`?b(e):y(e)),S=(e,t)=>n(`link_main_stop_aria`,x,e,t),C=e=>`Ask ${e?.box} to stop the main ${e?.name}? Stop lets it quit when it is idle; Interrupt and stop aborts the turn it is in first. The box decides and tells you what happened.`,w=e=>`要請 ${e?.box} 停止主智慧體 ${e?.name} 嗎?「停止」等它閒下來才結束;「中斷並停止」會先中止它進行中的回合。由那台機器決定,結果會通知你。`,T=((e,n={})=>(n.locale??t())===`zh-TW`?w(e):C(e)),E=(e,t)=>n(`link_main_stop_ask`,T,e,t),D=e=>`waiting on this computer · ${e?.ids}`,O=e=>`等候本機 · ${e?.ids}`,k=((e,n={})=>(n.locale??t())===`zh-TW`?O(e):D(e)),A=e=>`Mains (${e?.count})`,j=e=>`主智慧體(${e?.count})`,M=((e,n={})=>(n.locale??t())===`zh-TW`?j(e):A(e)),N=(e,t)=>n(`link_mains`,M,e,t),P=((e={},n={})=>(n.locale??t())===`zh-TW`?`發生了什麼事`:`What happened`),F=((e={},n={})=>(n.locale??t())===`zh-TW`?`這個單位最後一次回報的時間`:`When this unit last reported`),I=t=>{let n=e(`en`,t?.count,{},!0);return n===`one`?`${t?.count} monitor`:n===`other`?`${t?.count} monitors`:`link_unit_monitors`},ce=e=>`${e?.count} 個監看程序`,L=((e,n={})=>(n.locale??t())===`zh-TW`?ce(e):I(e)),R=((e={},n={})=>(n.locale??t())===`zh-TW`?`最後回報`:`Last report`),z=((e={},n={})=>(n.locale??t())===`zh-TW`?`塔會為每則訊息喚醒一次短短的執行,執行之間待命。`:`A tower wakes a short run for each message and stands by between runs.`),B=((e={},n={})=>(n.locale??t())===`zh-TW`?`最近沒有狀態`:`no status lately`),V=((e={},n={})=>(n.locale??t())===`zh-TW`?`盒子已超過 3 分鐘沒送狀態,這是它最後一次的內容`:`The box has sent no status for 3 minutes; this is its last one`),H=((e={},n={})=>(n.locale??t())===`zh-TW`?`請在盒子的 trust.json 加入這個專案`:`Add the project to the box's trust.json`),U=((e={},n={})=>(n.locale??t())===`zh-TW`?`為什麼停了`:`Why it stopped`),W=((e={},n={})=>(n.locale??t())===`zh-TW`?`前更新`:` ago`),G=((e={},n={})=>(n.locale??t())===`zh-TW`?``:`updated `),K={choose:m,post:(e,t)=>c(e,t)},le=12e4,q=new Map,J=(e,t)=>`${e.device}/${t.handle}`,ue=(e,t,n=Date.now())=>n-(q.get(J(e,t))??-1/0)<le;async function Y(e,t,n){let r=await K.choose(E({box:n,name:t.name}),[{label:v(),value:`quit`},{label:ae(),value:`interrupt`,tone:`danger`}]);if(!r)return!1;let a=await K.post(`link/unit-stop`,{team:t.team,device:e.device,handle:t.handle,mode:r,reason:``}).catch(()=>({ok:!1,status:0,body:{}}));return a.ok?(q.set(J(e,t),Date.now()),!0):(await K.choose(_({box:n,reason:a.body.reason??(a.status?i({status:a.status}):l())}),[]),!1)}var de=[`standing`,`waking`,`running`],fe=()=>g(`<li class="ally-unit"><div class="au-head"><i class="au-dot"></i><b class="au-word"></b><span class="au-name"></span><span class="au-time" hidden><span class="au-pre"></span><span class="age"></span><span class="au-ago"></span></span><em class="au-stale" hidden></em></div><p class="au-mons" hidden><b></b><span></span></p><details class="au-mains" hidden><summary><b class="au-mains-label"></b></summary><ul class="au-main-list"></ul></details><details class="au-crash" hidden><summary><b></b><span class="au-time"><span class="age"></span><span class="au-ago"></span></span></summary><pre></pre><p class="au-hint" hidden></p></details><details class="au-report" hidden><summary><b class="au-label"></b><span class="au-peek"></span></summary><div class="md au-md"></div></details></li>`),X,Z=new WeakMap;function Q(e){let t=e.querySelector(`.au-md`),n=Z.get(e)??``;e.open&&t.dataset.report!==n&&(X?Promise.resolve(X):d(()=>import(`./markdown-Bk5NWfKQ.js`).then(e=>e.t).then(e=>X=e),[],import.meta.url)).then(({mount:r,parse:i})=>{e.open&&Z.get(e)===n&&(t.dataset.report=n,t.replaceChildren(r(i(n))))})}function $(e,t,n=``,i=r()){let a=e.querySelector(`.age`);a.dataset.since=String(t),a.textContent=h(t),e.querySelector(`.au-pre`)?.replaceChildren(n),e.querySelector(`.au-ago`).textContent=i}var pe=()=>g(`<li class="au-main"><span class="au-mdot"></span><svg class="au-micon" viewBox="0 0 512 512" aria-hidden="true"><use data-icon="main"/></svg><b class="au-mname"></b><em class="role au-mkind" hidden></em><span class="au-mstate"></span><span class="au-mby" hidden></span><button type="button" class="au-stop" hidden></button></li>`),me=e=>e===void 0||!f.includes(e)?``:e===`train`?a(`train`):a(`main`,e);function he(e,t,n){let r=e.querySelector(`.au-mains`);r.hidden=!t.mains.length,t.mains.length&&(o(r,`.au-mains-label`,N({count:t.mains.length})),u(r.querySelector(`.au-main-list`),t.mains.map(e=>({...e,id:e.handle})),pe,(e,r)=>{let i=r.stopping||ue(t,r),a=i?s():r.word;e.dataset.tone=i?`other`:r.tone,o(e,`.au-mname`,r.name);let c=me(r.kind),l=e.querySelector(`.au-mkind`);l.hidden=!c,l.textContent=c,c?e.dataset.kind=r.kind:delete e.dataset.kind;let u=e.querySelector(`use`),d=c&&r.kind===`train`?`train`:te(`main`,c?r.kind:void 0);u.dataset.icon=d,u.setAttribute(`href`,ee(d)),o(e,`.au-mstate`,a);let f=e.querySelector(`.au-mby`),p=[...r.byLabel===void 0?[]:[ie({who:r.byLabel})],...r.waiting?[k({ids:r.waiting.join(`, `)})]:[]];f.hidden=!p.length,f.textContent=p.join(` · `);let m=e.querySelector(`.au-stop`);m.hidden=!r.canStop||i,m.textContent=v(),m.setAttribute(`aria-label`,S({name:r.name})),m.onclick=()=>{m.disabled=!0,Y(t,r,n).then(t=>{m.disabled=!1,t&&(e.dataset.tone=`other`,o(e,`.au-mstate`,s()),m.hidden=!0)})}}))}function ge(e,t,n,r=``){u(e,t.map(e=>({...e,id:e.unit,named:n})),fe,(e,t)=>{e.dataset.state=t.state,e.dataset.tone=t.tone,e.classList.toggle(`stale`,t.stale),o(e,`.au-word`,t.word);let n=e.querySelector(`.au-word`);n.title=de.includes(t.state)?z():``,o(e,`.au-name`,t.named?t.unit:``);let i=e.querySelector(`.au-head > .au-time`);i.hidden=!1,i.title=F(),$(i,t.at,G(),W());let a=e.querySelector(`.au-stale`);a.hidden=!t.stale,a.textContent=t.stale?B():``,a.title=t.stale?V():``;let s=e.querySelector(`.au-mons`);s.hidden=!t.monitors.length,t.monitors.length&&(o(s,`b`,L({count:t.monitors.length})),o(s,`span`,t.monitors.join(` · `)),s.title=t.monitors.join(`
|
|
2
|
+
`)),he(e,t,r);let c=e.querySelector(`.au-crash`);if(c.hidden=!t.crash,c.toggleAttribute(`data-trust`,t.crash?.trust===!0),t.crash){o(c,`summary > b`,t.crash.trust?U():P()),$(c.querySelector(`summary > .au-time`),t.crash.at),o(c,`pre`,t.crash.text);let e=c.querySelector(`.au-hint`);e.hidden=!t.crash.trust,e.textContent=t.crash.trust?H():``}let l=e.querySelector(`.au-report`);l.hidden=!t.report,t.report&&(o(l,`.au-label`,R()),o(l,`.au-peek`,p(t.report)),Z.set(l,t.report),l.ontoggle=()=>Q(l),Q(l))})}export{ge as fillAllyUnits};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./ask-
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{t}from"./ask-BAt58Mlv.js";import{K as n}from"./index-CQtxJFRw.js";var r=e({answerPost:()=>i,canAnswer:()=>o,mountAnswer:()=>s,trustPost:()=>a}),i=(e,t)=>t?.(e)??((t,r)=>n(e.startsWith(`grant:`)?`panes/${encodeURIComponent(e.slice(6))}/${t}`:`sessions/${encodeURIComponent(e)}/${t}`,r)),a=e=>e??(e=>n(`trust/answer`,e)),o=(e,...t)=>e===`waiting`&&t.every(Boolean),s=(e,{key:n,show:r,post:i,remote:a,accepted:o,label:s,box:c})=>t(e,i,a,{key:n,show:r},o,s,c);export{a,s as i,r as n,o as r,i as t};
|
|
@@ -1 +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{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p,t as m,u as h}from"./askview-BHYiKj0D.js";import{Nt as g,_t as _,in as ee,t as te}from"./index-JNy9LPcl.js";var v=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`作用在那台機器本身畫面的選項,從這裡不能選。`:`Choices that act on the machine's own screen are not available from here.`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),M=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,N=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),R=((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.`),z=((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.`),B=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),W=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),G=e=>e.multiple?C():e.freeform&&e.options.length?S():``,K=(e,t)=>_(`div`,{class:`ask-one`},e.header&&_(`b`,{class:`ask-head`},e.header),o(e.question),e.context&&_(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&_(`ol`,{class:`ask-opts`,"aria-label":h()},...e.options.map(e=>_(`li`,{class:`ask-opt`},_(`b`,null,e.title),e.description&&_(`small`,null,e.description)))),t&&G(e)&&_(`small`,{class:`ask-how`},G(e))),q=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),J=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),oe=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),se=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),ce=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),le=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),Y={digest:P,"not-allowed":I,malformed:F};function X(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?w():n()]:a===`stale`?[`error`,s===`local`?U():s===`cancel`?V():H()]:a===`rejected`?[`error`,(Object.hasOwn(Y,String(o))?Y[String(o)]:L)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??g({status:e.status})]}var ue=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,Z=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function de(e){if(e.dataset.cued)return;e.dataset.cued=`1`;let t=()=>{e.toggleAttribute(`data-more`,e.scrollHeight-e.scrollTop-e.clientHeight>4);for(let t of e.querySelectorAll(`.ask-acts`))t.dataset.cue=x()};for(let n of[`scroll`,`input`])e.addEventListener(n,t,{passive:!0});typeof ResizeObserver<`u`&&new ResizeObserver(t).observe(e),typeof MutationObserver<`u`&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0,characterData:!0}),typeof requestAnimationFrame<`u`&&requestAnimationFrame(t)}var fe=0;function Q(e,t,n=location.hostname!==`127.0.0.1`,g,x,S=B,C=!1){let w=()=>typeof C==`function`?C():C,M=()=>n||w(),N,P,F,I=!1,L,V=!1,H;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>P&&!P.el.contains(e.target)&&(P.lost=void 0));let U=()=>{if(!P)return;let e=document.activeElement;e&&e!==document.body&&e!==P.lost&&(P.lost=void 0),P.controls.forEach(e=>e.disabled=!I||V||P.done),P.send&&(P.send.disabled=!I||V||P.done||!P.pick()),L&&!I&&!V&&!P.done&&!P.sending?(d(P.note,``,L),P.away=!0):P.away&&(d(P.note,``,``),P.away=!1),e&&P.el.contains(e)&&e.disabled&&(P.lost=e);let t=P.lost;t&&!t.disabled&&P.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),P.lost=void 0)};async function Y(e,n){[e.sending,V,e.spell]=[!0,!0,!1],U(),d(e.note,``,a());let o=await t(`answer`,n).catch(()=>void 0),s=_(`button`,{type:`button`,class:`cmp-link`},i());s.onclick=()=>void Y(e,n);let[c,l,u]=o?X(o,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,V,e.busy]=[!o||ue(o),!1,!1,o?.body.outcome===`busy`],d(e.note,c,l,...u?[s]:[]);let f=o?.body.outcome===`accepted`?o.body.then:void 0,p=f&&te(f,{key:g?.key??``,command:e.copy,answerId:String(n.answerId??``)});p&&d(e.note,c,`${l} ${p}`),U(),e.note.scrollIntoView?.({block:`nearest`}),x&&o?.body.outcome===`accepted`&&setTimeout(()=>x(!!f&&!p),f&&!p?0:1200)}function Q(e,t){let n,r=J(t).map(e=>c(`radio`,q(e.label),[e.note&&q(e.note)],()=>(n=e.i,r.forEach((n,r)=>f(n,J(t)[r].i===e.i)),U()),e.i+1)),i=t.select?.copy!==void 0&&_(`button`,{type:`button`,class:`cmp-link`},O());i&&(i.disabled=!navigator.clipboard,i.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>d(e.note,`ok`,D()),()=>d(e.note,`error`,E())));let a=e=>M()&&e.hereOnly===!0||w()&&e.next===`pane`,o=r.filter((e,n)=>!a(J(t)[n])),s=r.filter(e=>!o.includes(e));s.forEach(e=>e.disabled=!0);let p=s.length>0?_(`p`,{class:`ask-why ask-reason`,id:`ask-why-${++fe}`},b()):void 0;return p&&s.forEach(e=>e.setAttribute(`aria-describedby`,p.id)),e.pick=()=>n===void 0?void 0:{choice:n},e.first=l(e.el,[{opts:r,multiple:!1,answered:()=>n!==void 0}],()=>e.send),e.controls=o,[_(`pre`,{class:`ask-title`},q(t.select.title)),u(`radiogroup`,T(),...r),...p?[p]:[],m(e.send,e.cancel,i)]}function pe(e,t){let n=t.questions.map(()=>({picks:new Set,text:_(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:ae(),"aria-label":ie()}),note:_(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:j(),"aria-label":A()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],s=t.multiple?`checkbox`:`radio`,l=t.options.map((e,n)=>c(s,e.title,[e.description,e.preview&&k()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),l.forEach((e,t)=>f(e,a.picks.has(t))),U()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),l.forEach(e=>f(e,!1))),U()),e.controls.push(...l,a.text,a.note),r.push({opts:l,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),_(`div`,{class:`ask-one`},t.header&&_(`b`,{class:`ask-head`},t.header),o(t.question),u(t.multiple?`group`:`radiogroup`,h(),...l),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>oe(e.picks,e.text.value,e.note.value))}:void 0,e.first=l(e.el,r,()=>e.send),[...i,m(e.send,e.cancel)]}function me(e){let t=e.asks??(e.ask?[e.ask]:[]),n=t.length>1,r=e.answer,i={copy:r?.select?.copy,key:Z(e),el:_(`section`,{class:`ask`}),note:s(),controls:[],pick:()=>void 0,done:!1,sending:!1};r&&((i.send=p()).onclick=()=>void(i.pick()&&Y(i,se(r,i.pick(),crypto.randomUUID()))));let a=e.tool===`secret_drop`;r&&!a&&le(r,M())&&((i.cancel=_(`button`,{type:`button`,class:`ask-cancel`},ee())).onclick=()=>void Y(i,ce(r,crypto.randomUUID())));let o=_(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${n?y():v()} ${n||!t[0]?``:G(t[0])}`.trim()),c=g&&e.tool!==`secret_drop`&&_(`button`,{type:`button`,class:`cmp-link`},S());c&&(c.onclick=g.show);let l=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[_(`p`,{class:`ask-why`},ne({tool:e.tool}))]:[];return i.el.append(...l,...r&&!a?r.select?Q(i,r):pe(i,r):[...t.length?t.map(e=>K(e,n)):[_(`p`,{class:`ask-why`},a?M()?R():z():e.why??W())],m(a?_(`p`,{class:`ask-term`},v()):o,c)],i.note),i.cancel&&i.controls.push(i.cancel),i}let $=(t,n)=>{let r=document.activeElement;P&&P!==n&&(P.focus=P.el.contains(r)?r:void 0),[N,P,F]=[t,n,n?.send?n:F],e.replaceChildren(...n?[n.el]:[]),n&&de(n.el),U(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=P&&!P.done?P.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},cancel(){let e=P&&!P.done?P.cancel:void 0;return!!(e&&!e.disabled&&(e.click(),1))},sending:()=>V,update(e,t,n){[I,L]=[t,n],e&&(H=void clearTimeout(H)),!e&&(P?.done||P?.sending)?H??=setTimeout(()=>(H=void 0,$()),6e3):e?P&&(Z(e)===P.key||!e.answer&&(P.done||P.sending)&&e.callId===N?.callId)?((P.busy||P.sending)&&!e.answer?P.spell=!0:P.busy&&P.spell&&e.answer&&([P.done,P.busy]=[!1,!1],d(P.note,``,re())),N=e):$(e,F?.key===Z(e)&&!F.done?F:me(e)):$(),U()}}}export{Q as t};
|
|
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{a as o,c as s,i as c,l,n as u,o as d,r as f,s as p,t as m,u as h}from"./askview-kfMnaYAk.js";import{At as g,gt as _,t as ee,tn as te}from"./index-CQtxJFRw.js";var v=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer it in the terminal.`),y=((t={},n={})=>(n.locale??e())===`zh-TW`?`請在終端機中回答。`:`Answer them in the terminal.`),b=((t={},n={})=>(n.locale??e())===`zh-TW`?`作用在那台機器本身畫面的選項,從這裡不能選。`:`Choices that act on the machine's own screen are not available from here.`),x=((t={},n={})=>(n.locale??e())===`zh-TW`?`下方還有 ▾`:`More below ▾`),S=((t={},n={})=>(n.locale??e())===`zh-TW`?`也可以自己輸入答案。`:`It also takes your own words.`),C=((t={},n={})=>(n.locale??e())===`zh-TW`?`可以複選。`:`It takes several choices.`),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消。`:`Cancelled.`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`選擇`:`Choices`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`瀏覽器拒絕存取剪貼簿。`:`The browser refused the clipboard.`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`已複製到這台裝置的剪貼簿。`:`Copied to this device's clipboard.`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`複製指令`:`Copy command`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個選項有預覽;請在終端機中查看。`:`It has a preview; see it in the terminal.`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註`:`Note`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`備註(選填)`:`Note (optional)`),M=e=>`Opened while ${e?.tool} was running; it may not be about that call.`,N=e=>`在 ${e?.tool} 執行時開啟,不一定與該呼叫有關。`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),re=((t={},n={})=>(n.locale??e())===`zh-TW`?`另一個答案沒有被採用;這個可以送出。`:`The other answer was not taken; this one can go.`),ie=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的答案`:`Your own answer`),ae=((t={},n={})=>(n.locale??e())===`zh-TW`?`或自己輸入答案`:`Or type your own answer`),P=((t={},n={})=>(n.locale??e())===`zh-TW`?`問題已變更,請重新閱讀。`:`The question changed; read it again.`),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 讀不懂這個答案。`:`The session could not read that answer.`),I=((t={},n={})=>(n.locale??e())===`zh-TW`?`這個答案不符合問題。`:`That answer does not fit the question.`),L=((t={},n={})=>(n.locale??e())===`zh-TW`?`session 拒絕了這個答案。`:`The session refused that answer.`),R=((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.`),z=((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.`),B=((t={},n={})=>(n.locale??e())===`zh-TW`?`顯示終端機`:`Show terminal`),V=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中關閉。`:`It was dismissed in the terminal.`),H=((t={},n={})=>(n.locale??e())===`zh-TW`?`它已不再開啟。`:`It is no longer open.`),U=((t={},n={})=>(n.locale??e())===`zh-TW`?`已在終端機中回答。`:`It was already answered in the terminal.`),W=((t={},n={})=>(n.locale??e())===`zh-TW`?`它在等待對話框。`:`It waits on a dialog.`),G=e=>e.multiple?C():e.freeform&&e.options.length?S():``,K=(e,t)=>_(`div`,{class:`ask-one`},e.header&&_(`b`,{class:`ask-head`},e.header),o(e.question),e.context&&_(`div`,{class:`ask-ctx`},e.context),e.options.length>0&&_(`ol`,{class:`ask-opts`,"aria-label":h()},...e.options.map(e=>_(`li`,{class:`ask-opt`},_(`b`,null,e.title),e.description&&_(`small`,null,e.description)))),t&&G(e)&&_(`small`,{class:`ask-how`},G(e))),q=e=>e.replace(/[\u0000-\u0008\u000b-\u001f\u007f-\u009f\p{Cf}]/gu,`�`),J=e=>(e.select?.choices??[]).map((e,t)=>({...e,i:t})),oe=(e,t,n)=>({...e.size?{choices:[...e].sort((e,t)=>e-t)}:{},...t.trim()?{text:t}:{},...n.trim()?{note:n}:{}}),se=(e,t,n)=>({dialog:e.dialog,digest:e.digest,answerId:n,...t}),ce=(e,t)=>({dialog:e.dialog,digest:e.digest,answerId:t,cancel:!0}),le=(e,t)=>e.cancel===!0&&!(t&&e.select?.choices.every(e=>e.hereOnly)),Y={digest:P,"not-allowed":I,malformed:F};function X(e,i=!1){let{outcome:a,reason:o,by:s}=e.body;return a===`accepted`?[`ok`,i?w():n()]:a===`stale`?[`error`,s===`local`?U():s===`cancel`?V():H()]:a===`rejected`?[`error`,(Object.hasOwn(Y,String(o))?Y[String(o)]:L)()]:a===`busy`?[`error`,t()]:a===`unknown`||e.status===504?[`error`,r(),!0]:[`error`,o??g({status:e.status})]}var ue=e=>[`accepted`,`stale`,`busy`,`unknown`].includes(String(e.body.outcome))||e.status===504,Z=e=>e.answer?`d\n${e.answer.dialog}\n${e.answer.digest}`:`c\n${e.callId}\n${e.why??``}`;function de(e){if(e.dataset.cued)return;e.dataset.cued=`1`;let t=()=>{e.toggleAttribute(`data-more`,e.scrollHeight-e.scrollTop-e.clientHeight>4);for(let t of e.querySelectorAll(`.ask-acts`))t.dataset.cue=x()};for(let n of[`scroll`,`input`])e.addEventListener(n,t,{passive:!0});typeof ResizeObserver<`u`&&new ResizeObserver(t).observe(e),typeof MutationObserver<`u`&&new MutationObserver(t).observe(e,{childList:!0,subtree:!0,characterData:!0}),typeof requestAnimationFrame<`u`&&requestAnimationFrame(t)}var fe=0;function Q(e,t,n=location.hostname!==`127.0.0.1`,g,x,S=B,C=!1){let w=()=>typeof C==`function`?C():C,M=()=>n||w(),N,P,F,I=!1,L,V=!1,H;for(let e of[`focusin`,`pointerdown`])document.addEventListener(e,e=>P&&!P.el.contains(e.target)&&(P.lost=void 0));let U=()=>{if(!P)return;let e=document.activeElement;e&&e!==document.body&&e!==P.lost&&(P.lost=void 0),P.controls.forEach(e=>e.disabled=!I||V||P.done),P.send&&(P.send.disabled=!I||V||P.done||!P.pick()),L&&!I&&!V&&!P.done&&!P.sending?(d(P.note,``,L),P.away=!0):P.away&&(d(P.note,``,``),P.away=!1),e&&P.el.contains(e)&&e.disabled&&(P.lost=e);let t=P.lost;t&&!t.disabled&&P.el.contains(t)&&(!document.activeElement||document.activeElement===document.body)&&(t.focus(),P.lost=void 0)};async function Y(e,n){[e.sending,V,e.spell]=[!0,!0,!1],U(),d(e.note,``,a());let o=await t(`answer`,n).catch(()=>void 0),s=_(`button`,{type:`button`,class:`cmp-link`},i());s.onclick=()=>void Y(e,n);let[c,l,u]=o?X(o,n.cancel===!0):[`error`,r(),!0];[e.done,e.sending,V,e.busy]=[!o||ue(o),!1,!1,o?.body.outcome===`busy`],d(e.note,c,l,...u?[s]:[]);let f=o?.body.outcome===`accepted`?o.body.then:void 0,p=f&&ee(f,{key:g?.key??``,command:e.copy,answerId:String(n.answerId??``)});p&&d(e.note,c,`${l} ${p}`),U(),e.note.scrollIntoView?.({block:`nearest`}),x&&o?.body.outcome===`accepted`&&setTimeout(()=>x(!!f&&!p),f&&!p?0:1200)}function Q(e,t){let n,r=J(t).map(e=>c(`radio`,q(e.label),[e.note&&q(e.note)],()=>(n=e.i,r.forEach((n,r)=>f(n,J(t)[r].i===e.i)),U()),e.i+1)),i=t.select?.copy!==void 0&&_(`button`,{type:`button`,class:`cmp-link`},O());i&&(i.disabled=!navigator.clipboard,i.onclick=()=>void navigator.clipboard.writeText(t.select.copy).then(()=>d(e.note,`ok`,D()),()=>d(e.note,`error`,E())));let a=e=>M()&&e.hereOnly===!0||w()&&e.next===`pane`,o=r.filter((e,n)=>!a(J(t)[n])),s=r.filter(e=>!o.includes(e));s.forEach(e=>e.disabled=!0);let p=s.length>0?_(`p`,{class:`ask-why ask-reason`,id:`ask-why-${++fe}`},b()):void 0;return p&&s.forEach(e=>e.setAttribute(`aria-describedby`,p.id)),e.pick=()=>n===void 0?void 0:{choice:n},e.first=l(e.el,[{opts:r,multiple:!1,answered:()=>n!==void 0}],()=>e.send),e.controls=o,[_(`pre`,{class:`ask-title`},q(t.select.title)),u(`radiogroup`,T(),...r),...p?[p]:[],m(e.send,e.cancel,i)]}function pe(e,t){let n=t.questions.map(()=>({picks:new Set,text:_(`textarea`,{rows:`1`,maxlength:`8192`,class:`ask-own`,placeholder:ae(),"aria-label":ie()}),note:_(`input`,{type:`text`,maxlength:`2048`,class:`ask-own ask-memo`,placeholder:j(),"aria-label":A()})})),r=[],i=t.questions.map((t,i)=>{let a=n[i],s=t.multiple?`checkbox`:`radio`,l=t.options.map((e,n)=>c(s,e.title,[e.description,e.preview&&k()],()=>{t.multiple||(a.picks.clear(),a.text.value=``),a.picks.has(n)?a.picks.delete(n):a.picks.add(n),l.forEach((e,t)=>f(e,a.picks.has(t))),U()}));return a.text.oninput=()=>(t.multiple||(a.picks.clear(),l.forEach(e=>f(e,!1))),U()),e.controls.push(...l,a.text,a.note),r.push({opts:l,multiple:!!t.multiple,own:a.text,note:a.note,answered:()=>a.picks.size>0||a.text.value.trim()!==``}),_(`div`,{class:`ask-one`},t.header&&_(`b`,{class:`ask-head`},t.header),o(t.question),u(t.multiple?`group`:`radiogroup`,h(),...l),a.text,a.note)});return e.pick=()=>n.every(e=>e.picks.size||e.text.value.trim())?{answers:n.map(e=>oe(e.picks,e.text.value,e.note.value))}:void 0,e.first=l(e.el,r,()=>e.send),[...i,m(e.send,e.cancel)]}function me(e){let t=e.asks??(e.ask?[e.ask]:[]),n=t.length>1,r=e.answer,i={copy:r?.select?.copy,key:Z(e),el:_(`section`,{class:`ask`}),note:s(),controls:[],pick:()=>void 0,done:!1,sending:!1};r&&((i.send=p()).onclick=()=>void(i.pick()&&Y(i,se(r,i.pick(),crypto.randomUUID()))));let a=e.tool===`secret_drop`;r&&!a&&le(r,M())&&((i.cancel=_(`button`,{type:`button`,class:`ask-cancel`},te())).onclick=()=>void Y(i,ce(r,crypto.randomUUID())));let o=_(`p`,{class:`ask-term`},e.why&&t.length?e.why:`${n?y():v()} ${n||!t[0]?``:G(t[0])}`.trim()),c=g&&e.tool!==`secret_drop`&&_(`button`,{type:`button`,class:`cmp-link`},S());c&&(c.onclick=g.show);let l=e.answer?.twin&&e.tool&&e.tool!==`dialog`?[_(`p`,{class:`ask-why`},ne({tool:e.tool}))]:[];return i.el.append(...l,...r&&!a?r.select?Q(i,r):pe(i,r):[...t.length?t.map(e=>K(e,n)):[_(`p`,{class:`ask-why`},a?M()?R():z():e.why??W())],m(a?_(`p`,{class:`ask-term`},v()):o,c)],i.note),i.cancel&&i.controls.push(i.cancel),i}let $=(t,n)=>{let r=document.activeElement;P&&P!==n&&(P.focus=P.el.contains(r)?r:void 0),[N,P,F]=[t,n,n?.send?n:F],e.replaceChildren(...n?[n.el]:[]),n&&de(n.el),U(),n?.focus&&(!document.activeElement||document.activeElement===document.body)&&n.focus.focus()};return{enter(){let e=P&&!P.done?P.first?.():void 0;return!!(e&&!e.disabled&&(e.focus(),1))},cancel(){let e=P&&!P.done?P.cancel:void 0;return!!(e&&!e.disabled&&(e.click(),1))},sending:()=>V,update(e,t,n){[I,L]=[t,n],e&&(H=void clearTimeout(H)),!e&&(P?.done||P?.sending)?H??=setTimeout(()=>(H=void 0,$()),6e3):e?P&&(Z(e)===P.key||!e.answer&&(P.done||P.sending)&&e.callId===N?.callId)?((P.busy||P.sending)&&!e.answer?P.spell=!0:P.busy&&P.spell&&e.answer&&([P.done,P.busy]=[!1,!1],d(P.note,``,re())),N=e):$(e,F?.key===Z(e)&&!F.done?F:me(e)):$(),U()}}}export{Q as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{m as t}from"./towermodel-CUStB7ST.js";import{t as n}from"./runtime-ZX6HkxDa.js";import{t as r}from"./headkey-BhBqIerz.js";import{
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";import{m as t}from"./towermodel-CUStB7ST.js";import{t as n}from"./runtime-ZX6HkxDa.js";import{t as r}from"./headkey-BhBqIerz.js";import{At as i,K as a}from"./index-CQtxJFRw.js";var o=((e={},t={})=>(t.locale??n())===`zh-TW`?`沒有符合這個號碼的請求。`:`No request has that number.`),s=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經不在了。`:`That request is gone.`),c=((e={},t={})=>(t.locale??n())===`zh-TW`?`連續輸入三次錯誤號碼,所以所有等待中的請求都已拒絕。請按「新的配對碼」重新配對。`:`Three wrong numbers in a row, so every waiting request was denied. Press New code and pair again.`),l=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經變了,請重新看過。`:`That request changed. Look at it again.`),u=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個請求已經不在了,或已逾時。`:`That request is gone or has timed out.`),d=((e={},t={})=>(t.locale??n())===`zh-TW`?`這個團隊沒有在這台裝置上執行。`:`That team is not running on this device.`),f=((e={},t={})=>(t.locale??n())===`zh-TW`?`已在該裝置上取消。`:`It was cancelled at the device.`),p=((e={},t={})=>(t.locale??n())===`zh-TW`?`你已從這裡回答。`:`You answered it from here.`),m=((e={},t={})=>(t.locale??n())===`zh-TW`?`已在該裝置上回答。`:`Answered at the device itself.`),h=((e={},t={})=>(t.locale??n())===`zh-TW`?`已由團隊的另一個控制端回答。`:`Answered by another controller of this team.`),g=e=>`The answer was not sent: ${e?.reason}`,_=e=>`答案沒有送出:${e?.reason}`,v=((e,t={})=>(t.locale??n())===`zh-TW`?_(e):g(e)),y=((e={},t={})=>(t.locale??n())===`zh-TW`?`問題在有人回答前就結束了。`:`It ended before anyone answered it.`),b=((e={},t={})=>(t.locale??n())===`zh-TW`?`已送出你的答案;對方裝置還沒關閉這個問題。`:`Your answer was sent; the device has not closed the question yet.`),x=((e={},t={})=>(t.locale??n())===`zh-TW`?`你已不再負責回答這台裝置的問題;問題在那邊仍未結束。`:`You no longer answer this device's questions; it is still open there.`);function S(e){switch(e){case`sent`:return b();case`done-here`:return p();case`done-other`:return h();case`done-local`:return m();case`cancelled`:return f();case`expired`:return y();case`withdrawn`:return x()}}var C=e=>typeof e==`object`&&!!e&&!Array.isArray(e),w=e=>typeof e==`string`,T=e=>Array.isArray(e)&&e.every(e=>C(e)&&w(e.title));function E(e){let{dialog:t,dialogId:n,digest:r}=e.data;if(!w(t)||!w(n)||!w(r))return;let i;try{i=JSON.parse(t)}catch{return}if(!C(i))return;let{select:a,questions:o,cancel:s}=i,c={dialog:n,digest:r,...s===!0?{cancel:!0}:{}};if(C(a)&&w(a.title)&&Array.isArray(a.choices)&&a.choices.every(e=>C(e)&&w(e.label)))return{callId:n,tool:`dialog`,answer:{...c,select:a}};if(Array.isArray(o)&&o.length>0&&o.every(e=>C(e)&&w(e.question)&&T(e.options)))return{callId:n,tool:`dialog`,answer:{...c,questions:o}}}var D=e=>e.cancel===!0?{cancel:!0}:e.choice===void 0?{answers:e.answers}:{choice:e.choice},O=e({confirmActions:()=>N,confirmWhy:()=>P,forwardedAnswer:()=>F,joined:()=>A,lanActions:()=>L,lanReading:()=>R,outcome:()=>k,proposalActions:()=>I,runDialogActions:()=>z,taken:()=>M,waitActions:()=>j}),k=e=>{let t=e.body.outcome;return t===void 0?e.status===504?`unknown`:e.ok&&(e.body.accepted===!0||Array.isArray(e.body.entries))?`accepted`:`refused`:t===`accepted`?`accepted`:t===`unknown`?`unknown`:`refused`},A=e=>e.replace(/^([A-Z])(?=[a-z])/,e=>e.toLowerCase()),j=(e,n)=>({tell:t=>n(`input`,{text:t,as:`send`,answers:e.id}),press:(n,r)=>a(`${t(e.ws)}/memory`,{op:`press`,id:e.id,act:n,...r}),read:()=>a(`${t(e.ws)}/memory`,{op:`read`}),goto:{view:`session`,ws:e.ws,key:e.tower}}),M=e=>e.ok&&e.body.outcome===void 0?{...e,body:{...e.body,outcome:`accepted`}}:e,N=e=>{let t=t=>a(`link/confirm-answer`,{dialogId:e.dialogId,digest:e.digest,allow:t}).then(M);return{allow:()=>t(!0),deny:()=>t(!1)}},P=e=>{let t=String(e.body.reason??e.body.error??``);return[[/^That request is gone/,u],[/^That team is not running/,d],[/^That request changed/,l]].find(([e])=>e.test(t))?.[1]()??(t||i({status:e.status}))},F=e=>async(t,n)=>{let r=await a(`link/dialog-answer`,{device:e.device,dialogId:e.dialogId,digest:e.digest,answer:D(n)});return r.ok?M(r):{ok:!1,status:r.status,body:{reason:v({reason:r.body.reason??i({status:r.status})})}}},I=e=>({confirm:()=>a(`${t(e.ws)}/memory`,{op:`confirm`,proposal:e.id,rev:e.rev()}),reject:()=>a(`${t(e.ws)}/memory`,{op:`reject`,proposal:e.id})}),L=e=>({approve:t=>e(`lan/approve`,{number:t}).then(M),deny:t=>e(`lan/approve`,{deny:t}).then(e=>e.ok&&e.body.denied===0?{...e,ok:!1,body:{error:`gone`,reason:s()}}:M(e)),denyAll:()=>e(`lan/approve`,{deny:`all`}).then(M)});function R(e){let t=!e.ok&&e.body.error===`no_match`&&Number(e.body.denied)>0;return{answer:e.ok||t?``:e.body.error===`no_match`?o():String(e.body.reason??i({status:e.status})),verdict:t?c():``}}var z=(e,n=e.run===`head`?r:e.workspace,i=a)=>{let o=r=>i(`${t(n)}/dialog`,{key:e.key,...r}).then(M);return{answer:o,yes:()=>o({confirmed:!0}),no:()=>o({confirmed:!1}),value:e=>o({value:e}),cancel:()=>o({cancelled:!0})}};export{A as a,k as c,j as d,S as f,F as i,I as l,N as n,L as o,E as p,P as r,R as s,O as t,z as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{gt as t}from"./index-CQtxJFRw.js";var n=((t={},n={})=>(n.locale??e())===`zh-TW`?`選項`:`Options`),r=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出答案`:`Send answer`),i={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1};function a(e,t,n,r,a){let{q:o}=n,s=r[o],c=i[e]??0,l=e===`ArrowUp`,u=l||e===`ArrowDown`,d=()=>({to:r.map((e,t)=>({q:(o+1+t)%r.length,part:`opt`})).find(e=>e.q!==o&&!a[e.q])??`send`});if(e===`Tab`){let e=r[o-1],i=n.part===`opt`?s.own||s.note:n.part===`own`&&s.note;return t?n.part===`opt`&&e?{to:{q:o-1,part:e.note?`note`:e.own?`own`:`opt`}}:void 0:i||o===r.length-1?void 0:{to:{q:o+1,part:`opt`}}}if(!t){if(n.part===`opt`){let t=n.o+c;if(c)return t>=0&&t<s.options?{to:{q:o,part:`opt`,o:t},...s.multiple?{}:{pick:t}}:{to:c>0&&s.own?{q:o,part:`own`}:n};if(e===`Enter`||e===` `&&!s.multiple)return{...d(),...s.multiple?{}:{pick:n.o}}}else if(n.part===`own`){if(e===`Enter`)return d();if(u)return{to:l?{q:o,part:`opt`,o:s.options-1}:{q:o,part:`note`}}}else if(l)return{to:{q:o,part:`own`}}}}function o(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`)),o=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 s=e=>{let n=o(e.target);n?.part===`opt`&&i(t[n.q],n.o)};e.addEventListener(`focusin`,s),e.addEventListener(`click`,s);let c=!1,l=!1;return e.addEventListener(`keydown`,i=>{i.key===` `&&(l=!0);let s=o(i.target);if(!s||i.ctrlKey||i.altKey||i.metaKey||i.isComposing)return;let u=i.target;if(s.part!==`opt`&&(i.key===`ArrowUp`?u.selectionStart!==0:i.key===`ArrowDown`&&u.selectionEnd!==u.value.length))return;let d=a(i.key,i.shiftKey,s,t.map(e=>({options:e.opts.length,multiple:e.multiple,own:!!e.own,note:!!e.note})),t.map(e=>e.answered()));if(!d||(i.preventDefault(),i.repeat&&[`Enter`,` `].includes(i.key)))return;if(c=i.key===` `,d.pick!==void 0){let e=t[s.q].opts[d.pick];e.getAttribute(`aria-checked`)!==`true`&&e.click()}let f=d.to===`send`?void 0:t[d.to.q],p=d.to===`send`?n():d.to.part===`opt`?f.opts[d.to.o??r(f)]:d.to.part===`own`?f.own:f.note;p&&!p.disabled&&(e.dispatchEvent(new CustomEvent(`ask-reveal`,{detail:p})),p.focus())}),e.addEventListener(`keyup`,e=>{e.key===` `&&((c||!l)&&e.preventDefault(),c=l=!1)}),()=>t[0]?.opts[r(t[0])]}var s=(e,n={})=>t(`p`,{class:`ask-q`,...n,...e.length>90?{"data-long":``}:{}},e);function c(e,n,r,i,a){let o=t(`button`,{type:`button`,class:`ask-opt`,role:e,"aria-checked":`false`},t(`b`,a?{"data-n":String(a)}:null,n),...r.filter(Boolean).map(e=>t(`small`,null,e)));return o.onclick=i,o}var l=(e,n,...r)=>t(`div`,{class:`ask-opts`,role:e,"aria-label":n},...r),u=(...e)=>t(`div`,{class:`ask-acts`},...e),d=(e=r())=>t(`button`,{type:`button`,class:`ask-send`},e),f=()=>t(`p`,{class:`ask-note`,role:`status`,"aria-live":`polite`}),p=(e,t,n,...r)=>(e.dataset.tone=t,e.replaceChildren(n,...r)),m=(e,t)=>e.setAttribute(`aria-checked`,String(t));export{s as a,f as c,c as i,o as l,l as n,p as o,m as r,d as s,u as t,n as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-w4qFe3dr.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{t}from"./sentencepack-DtYqpppS.js";import{t as n}from"./headkey-BhBqIerz.js";import{K as r,W as i,_t as a,a as o,gt as s}from"./index-CQtxJFRw.js";var c=e=>`basis ${e?.basis}`,l=e=>`依據 ${e?.basis}`,ee=((t,n={})=>(n.locale??e())===`zh-TW`?l(t):c(t)),u=e=>`Asks of your other computers, left waiting (${e?.n})`,d=e=>`你控制的其他電腦的提問,仍在等待(${e?.n})`,te=((t,n={})=>(n.locale??e())===`zh-TW`?d(t):u(t)),f=e=>`Cancelled or refused (${e?.n})`,p=e=>`已取消或拒絕(${e?.n})`,m=((t,n={})=>(n.locale??e())===`zh-TW`?p(t):f(t)),h=((t={},n={})=>(n.locale??e())===`zh-TW`?`知道了`:`Got it`),g=e=>`Answered without you (${e?.n})`,_=e=>`沒有你,自行回覆了(${e?.n})`,v=((t,n={})=>(n.locale??e())===`zh-TW`?_(t):g(t)),y=e=>`${e?.n} outside change(s) to the auto mode file were put back`,b=e=>`有 ${e?.n} 次來自外部的自動模式檔案改動,已還原`,ne=((t,n={})=>(n.locale??e())===`zh-TW`?b(t):y(t)),x=e=>`closed: ${e?.name} was gone`,S=e=>`已結案:${e?.name} 已不在`,C=((t,n={})=>(n.locale??e())===`zh-TW`?S(t):x(t)),w=((t={},n={})=>(n.locale??e())===`zh-TW`?`由伺服器取消`:`cancelled by the server`),T=((t={},n={})=>(n.locale??e())===`zh-TW`?`已取消`:`cancelled`),E=((t={},n={})=>(n.locale??e())===`zh-TW`?`已當作 Esc 回覆`:`answered as Esc`),D=((t={},n={})=>(n.locale??e())===`zh-TW`?`再次詢問`:`asked again`),O=((t={},n={})=>(n.locale??e())===`zh-TW`?`已拒絕`:`refused`),k=((t={},n={})=>(n.locale??e())===`zh-TW`?`仍在等待`:`still waiting`),A=((t={},n={})=>(n.locale??e())===`zh-TW`?`信任詢問已回答不信任`:`trust question answered no`),j=((t={},n={})=>(n.locale??e())===`zh-TW`?`沒有暫放給你的事。`:`Nothing was parked for you.`),M=e=>`Parked for you (${e?.n})`,N=e=>`暫放給你的事(${e?.n})`,P=((t,n={})=>(n.locale??e())===`zh-TW`?N(t):M(t)),F=((t={},n={})=>(n.locale??e())===`zh-TW`?`自動模式這段時間做了什麼`:`What auto mode did meanwhile`),I=e=>`Sent back to ask you again (${e?.n})`,L=e=>`已退回,請對方再問你一次(${e?.n})`,R=((t,n={})=>(n.locale??e())===`zh-TW`?L(t):I(t)),z=e=>`${e?.n} more were answered since and are no longer waiting.`,B=e=>`另有 ${e?.n} 件之後已經回覆,不再等了。`,re=((t,n={})=>(n.locale??e())===`zh-TW`?B(t):z(t)),V=e=>`Still waiting, with no way to cancel (${e?.n})`,H=e=>`還在等,而且無法取消(${e?.n})`,U=((t,n={})=>(n.locale??e())===`zh-TW`?H(t):V(t)),W=((t={},n={})=>(n.locale??e())===`zh-TW`?`你不在的時候`:`While you were away`),G=e=>`back to ${e?.name}, who asks you again`,K=e=>`已退回給 ${e?.name},由它再問你`,q=((t,n={})=>(n.locale??e())===`zh-TW`?K(t):G(t)),J=((t={},n={})=>(n.locale??e())===`zh-TW`?`已退回給塔台,仍需要你時再問你`:`back to the tower, which asks you again if it still needs you`),Y=(e,n)=>t(`back_to_tower`,J,e,n),X=e=>`Auto mode ran from ${e?.from} to ${e?.until}`,ie=e=>`自動模式從 ${e?.from} 到 ${e?.until}`,ae=((t,n={})=>(n.locale??e())===`zh-TW`?ie(t):X(t)),oe=`sb.auto.back`,se,ce=()=>se??=Promise.all([i(()=>import(`./waitcard-DoDDMtr6.js`).then(e=>e.i),__vite__mapDeps([0]),import.meta.url),i(()=>import(`./asks-grX34oB6.js`).then(e=>e.t),__vite__mapDeps([0]),import.meta.url),i(()=>import(`./answer-ChjVWtA7.js`).then(e=>e.n),__vite__mapDeps([0]),import.meta.url)]).then(([e,t,n])=>({waitCard:e.waitCard,waitActions:t.waitActions,answerPost:n.answerPost}));function Z(e,t){if(!t.head){for(let n of e?.bases??[]){if(n.id!==t.workspace||!n.tower)continue;let e=n.tower.service?.memory?.bossWaits.find(e=>e.id===t.id);return e?{ws:n.id,key:n.tower.key,wait:e}:void 0}return}let r=e?.head,i=r?.service?.memory?.bossWaits.find(e=>e.id===t.id);return r&&i?{ws:n,key:r.key,wait:i}:void 0}var le={refused:O,cancelled:T,escaped:E,trust:A,"still-waiting":k,"re-asked":D,backstop:w},Q=(e,t)=>`${e.session||`?`}: ${e.tool} ${(le[e.kind]??(()=>e.kind))({},t)}${e.count>1?` ×${e.count}`:``}${e.gist?` “${e.gist}”`:``} (${o(e.first)})`,$=(e,t)=>t.length?s(`section`,{class:`auto-back-sec`},s(`h4`,null,e),s(`ul`,null,...t.map(e=>s(`li`,null,e)))):null;function ue(e,t){let n=t.locale?{locale:t.locale}:{},i=t.post??r,c,l=new Map,u=new Map;e.classList.add(`auto-back`),e.setAttribute(`aria-labelledby`,`auto-back-title`),e.setAttribute(`tabindex`,`-1`),e.hidden=!0;async function d(r){c=r;let i=t.net(),d=await ce(),p=s(`p`,{class:`auto-back-said`,role:`status`});l=new Map,u=new Map;let g=0,_=r.parked.filter(e=>e.returned),y=e=>e.returned===`tower`?Y({},n):e.returned===`gone`?C({name:e.from??`?`},n):q({name:e.from??`?`},n),b=r.parked.filter(e=>!e.returned).flatMap(e=>{let t=Z(i,e);if(!t||t.wait.state||t.wait.answered)return g++,[];let n=`${t.ws}\u001f${e.id}`,r=d.waitCard({host:`row`,wait:t.wait,...t.ws===`@head`?{head:!0}:{},actions:d.waitActions({ws:t.ws,id:e.id,tower:t.key},d.answerPost(t.key)),done:e=>p.textContent=e});return r.update(t.wait,document.body?.dataset?.stale!==`true`),l.set(n,r),u.set(n,e),[s(`li`,{class:`auto-back-card`},s(`small`,{class:`auto-back-from`},e.tower),r.el)]}),x=s(`button`,{type:`button`,class:`pair-btn auto-back-close`},h({},n));x.onclick=()=>f();let S=s(`details`,{class:`auto-back-rest`},s(`summary`,null,F({},n)),$(m({n:String(r.lines.reduce((e,t)=>e+(t.kind===`re-asked`?0:t.count),0))},n),r.lines.map(e=>Q(e,n))),$(v({n:String(r.decided.length)},n),r.decided.map(e=>`${o(e.at)} → ${e.to}${e.gist?`: ${e.gist}`:``} (${ee({basis:e.basis},n)})`)),$(U({n:String(r.stillWaiting.length)},n),r.stillWaiting.map(e=>Q(e,n))),$(te({n:String(r.boxes.length)},n),r.boxes.map(e=>`${e.box}: ${e.gist}`)),r.foreign.length?s(`p`,{class:`auto-back-foreign`},ne({n:String(r.foreign.length)},n)):null);e.replaceChildren(...a(s(`h2`,{class:`auto-back-title`,id:`auto-back-title`},W({},n)),s(`p`,{class:`auto-back-when`},ae({from:o(r.since),until:o(r.until)},n)),_.length?s(`section`,{class:`auto-back-returned`},s(`h3`,null,R({n:String(_.length)},n)),s(`ul`,null,..._.map(e=>s(`li`,null,`${e.id} · ${e.tower}: ${e.text} — ${y(e)}`)))):null,b.length?s(`section`,{class:`auto-back-parked`},s(`h3`,null,P({n:String(b.length)},n)),s(`ul`,{class:`auto-back-cards`},...b),p):_.length?null:s(`p`,{class:`auto-back-none`},j({},n)),g?s(`p`,{class:`auto-back-settled`},re({n:String(g)},n)):null,S,s(`div`,{class:`auto-back-acts`},x))),e.hidden=!1,e.showModal?.(),e.focus()}function f(){p(),e.hidden=!0,e.close?.()}function p(){c&&t.store.set(c.until)}e.addEventListener(`close`,p);async function g(e=!1){if(!e&&t.net()?.auto?.on)return;let n=await i(`auto/report`,{}).catch(()=>void 0),r=n?.ok?n.body.report:void 0;if(!r||r.v!==1||typeof r.until!=`string`||!Array.isArray(r.parked))return;let a=Date.parse(r.until),o=t.store.get();o&&a<=Date.parse(o)||t.now()-a>2592e5||await d(r)}return{open:d,check:g,close:f,net(e){for(let[t,n]of u){let r=Z(e,n);r&&l.get(t)?.update(r.wait,document.body?.dataset?.stale!==`true`,!!r.wait.state)}}}}export{oe as BACK_KEY,ue as mountBack};
|