Author SHA1 Message Date
wjl2023 a0952dd2e7 docs: refresh WeChat group 23 QR code
Replace the expired README community QR image while keeping the existing filename and 微信群 23 label.
2026-09-29 12:14:03 +08:00
Liang Jiaqing c91387136a reflect: support module-level LLM to select backend by name before each trigger 2026-09-29 09:28:08 +08:00
Liang Jiaqing 9dcbf5adf0 hub: persist token to temp/.hub_token; add intervene/keyinfo inject op + hub.call/peers helper 2026-09-29 09:28:08 +08:00
nianyucatfish e86ca723a9 fix(tui): polish rendering, history preview, and copy behavior (#816)
* fix(tui): repaint composer after macOS input

* feat(tui): add compact conversation history

* fix(tui): repaint messages after streaming and scroll

* fix(tui): polish history focus and scrollbar styling
2026-09-22 23:42:24 +08:00
Liang Jiaqing 9d1add7780 docs: update WeChat community QR code to group 23 2026-09-19 09:57:28 +08:00
Liang Jiaqing 1b6442fe4f prompt: constitution#3 dedupe (3-failure rule already in RULES); remember tool requires task success/checkpoint 2026-09-14 11:42:59 +08:00
Liang Jiaqing f07bfc57a2 abort(): register live socket at urllib3 request() so Force Stop wakes recv() even while waiting for response headers (was only after headers via active_response) 2026-09-14 11:39:06 +08:00
Liang Jiaqing 96be94586f docs: update verified default vision backend 2026-09-14 10:21:54 +08:00
Liang Jiaqing 86171aec3c hub_p2p: exponential backoff (1->60s) with jitter on reconnect failure; avoid thundering herd after relay restart 2026-09-11 10:18:38 +08:00
Liang Jiaqing 24aeead78c p2p_ws_client: fast-fail reconnect (ws ping 15/10s; Signal.expect aborts on closed/error instead of waiting full timeout) 2026-09-11 10:18:38 +08:00
Liang Jiaqing 0fd024bf8c llmcore: TTFT = first SSE event (count hidden thinking); default context_win 38000 / cut interval 8 2026-09-11 10:18:38 +08:00
Liang Jiaqing 4913a6162b hub: switch LLM channel (op llm / GET llms, POST llm) via agent.list_llms/next_llm only 2026-09-11 10:18:38 +08:00
nianyucatfish f6e5657fbe docs(ganet): cover macOS in the PC device-link setup SOP (#791)
GAnet 0.5.0 ships macOS sidecars, so the SOP no longer stops on non-Windows
desktops. The flow itself is unchanged; the edits are the platform facts GA
needs to follow it on a Mac:

- default component location moves to ~/.genericagent/components/GAnet on
  every platform; a checkout under the GA root's temp/ is wiped by the temp
  rewind mechanism
- launcher is ganet.cmd on Windows and ganet.sh on macOS; the bound Python
  shim is ga_python.cmd / ga_python.sh
- sidecar data lives in %LOCALAPPDATA%\GenericAgent\GAnet or
  ~/Library/Application Support/GenericAgent/GAnet; login autostart is the
  HKCU Run entry or a LaunchAgent; both are removed by remove_environment()
- release entries for macOS use platform "darwin", and verify_release checks
  Mach-O as well as PE
- on macOS, setup and upgrades request the screen-recording permission at the
  end and report it in screen_access; it is advisory and never blocks
- macOS needs no sudo; git/python placeholders without Xcode CLT must not be
  invoked
2026-09-03 14:37:00 +08:00
Liang Jiaqing 71cf559fab fix: str() session_id/tab_id; bump UA to 2.1.251; trim subagent.md 2026-09-02 08:20:29 +08:00
Liang Jiaqing 7fa5fa4ec0 fix: prevent WeChat polling from consuming chat input 2026-09-02 08:20:28 +08:00
YI QI LIMandabraxas914 efb3bc6ad1 feat(desktop): compiled React Desktop 2.0 v0.2.1 renderer update (#787)
* fix(desktop): expose explicit backup capabilities

* fix(desktop): align titlebar controls with native metrics

* release(desktop): prepare portable v0.2.1

* build(desktop): rebuild compiled dist from source 4a67226

Rebuild the compiled-only React Desktop 2.0 renderer from abraxas914/GenericAgent
main @4a67226, carrying the v0.2.1 iterations that PR #784 was closed to await:
live turn-timer persistence across session switch, Mixin image-to-path fallback,
folder drag-drop, per-turn duration, and image-thumbnail repair.

- dist/**: regenerated 98 manifest assets + entry HTML
- build-provenance.json: sourceCommit -> 4a67226, manifest sha256 recomputed
- verify-compiled-dist.mjs: expectedSourceCommit -> 4a67226
- dist/README.md: provenance source commit updated
- desktop_bridge.py, test_bridge_origin_security.py: synced to 4a67226
- core (agentmain.py, llmcore*, src/**, public/**) remains zero-diff vs upstream

---------

Co-authored-by: abraxas914 <abraxas345589144233@outlook.com>
2026-08-30 14:21:51 +08:00
nianyucatfish 7ad2162f30 docs(ganet): add PC device-link setup SOP (#786)
Adds the standalone Windows GAnet device-link setup and removal SOP.

Known review risks accepted by maintainer.
2026-08-28 22:18:18 +08:00
Liang Jiaqing 17d9f4d873 fix(wechatapp): avoid evaluating Win creationflags on Linux
_start_conductor built DETACHED_PROCESS/CREATE_NEW_PROCESS_GROUP before the
os.name=='nt' branch, causing AttributeError and crashing Conductor autostart
on Ubuntu. Keep those flags Windows-only; Linux uses start_new_session.
2026-08-27 21:44:07 +08:00
LJQ 8ea9533651 Merge pull request #779 from abraxas914/codex/react-desktop-v2-update-0827
feat(desktop): refresh compiled React Desktop 2.0 distribution
2026-08-25 18:29:05 +08:00
yiqi-017 bb4b2ca974 feat(desktop): refresh compiled React Desktop 2.0 distribution
Rebuild the compiled renderer from abraxas914/GenericAgent source
commit 9fe5d69b85cfad8778ace84b6f69bc75f9e0d392, refreshing:

- New-chat default model tag: the selected-model badge in Settings
  and the composer now read '新会话默认' / 'New chat default'.
- Model selectors display the configured profile name (备注名) so the
  same model served by different providers is distinguishable.
- desktop_bridge: syncing mixin llm_nos references when a profile is
  renamed, preventing orphan references in the mixin config.
- Release publisher sets GH_REPO so 'gh release create' resolves the
  target repository without checking out source, satisfying the
  publisher security contract while fixing the prerelease step.

Provenance and verifier updated to the new source commit and the
LF-normalized content manifest (98 generated assets).
2026-08-25 18:00:43 +08:00
Liang Jiaqing 3d62523d40 fix(abort): force-wake blocked stream recv via socket _real_close; interruptible retry backoff 2026-08-25 15:55:34 +08:00
Liang Jiaqing 13eef203f7 fix(stats): compute decode TPS at stream end 2026-08-25 11:36:25 +08:00
Liang Jiaqing 3327a6c88b fix stream recovery and runtime metrics 2026-08-25 10:16:19 +08:00
Liang Jiaqing 0c235a8068 perf: make history trimming linear 2026-08-24 13:09:31 +08:00
66 changed files with 1154 additions and 203 deletions

No files matched your search

+11 -4
View File
@@ -546,15 +546,24 @@ jobs:
build-macos:
name: macOS arm64 DMG
if: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/desktop-portable-')) || (github.event_name == 'workflow_dispatch' && (github.event.inputs.target == 'all' || github.event.inputs.target == 'macos')) }}
runs-on: macos-15
runs-on: macos-26
permissions:
contents: read
env:
DEVELOPER_DIR: /Applications/Xcode_26.5.app/Contents/Developer
steps:
- name: Checkout repository
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
persist-credentials: false
- name: Verify pinned macOS build environment
run: |
test "$(uname -m)" = arm64
test "$(xcodebuild -version | sed -n '1p')" = "Xcode 26.5"
test "$(xcodebuild -version | sed -n '2p')" = "Build version 17F42"
test "$(xcrun --sdk macosx --show-sdk-version)" = "26.5"
- name: Set up Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
@@ -587,9 +596,6 @@ jobs:
python3 -m pip install --require-hashes --only-binary=:all:
--requirement frontends/desktop/packaging/dmg-build-requirements.txt
- name: Assert macOS runner architecture
run: test "$(uname -m)" = arm64
- name: Verify tracked compiled renderer bytes
working-directory: frontends/desktop
run: npm run test:dist
@@ -778,6 +784,7 @@ jobs:
- name: Validate six assets and publish prerelease
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG_NAME: ${{ github.ref_name }}
TARGET_SHA: ${{ github.sha }}
shell: bash
+1 -1
View File
@@ -774,7 +774,7 @@ GA Web 工具运行在**真实、持久化的 Chrome/Chromium 会话**中,而
<div align="center">
<table>
<tr>
<td align="center"><strong>微信群 22</strong><br/><img src="assets/images/wechat_group22.jpg" alt="微信群 22 二维码" width="240"/></td>
<td align="center"><strong>微信群 23</strong><br/><img src="assets/images/wechat_group22.jpg" alt="微信群 23 二维码" width="240"/></td>
</tr>
</table>
</div>
+1 -1
View File
@@ -186,7 +186,7 @@ class TMWebDriver:
if session.ws_client == client: session.mark_disconnected()
def execute_js(self, code, timeout=15, session_id=None) -> Any:
if session_id is None: session_id = self.default_session_id
if session_id is None: session_id = str(self.default_session_id)
if self.is_remote:
safe_print('remote_execute_js')
response = self._remote_cmd({"cmd": "execute_js", "sessionId": session_id,
+10
View File
@@ -116,6 +116,15 @@ class GenericAgent:
if self.handler is not None: self.handler.code_stop_signal.append(1)
for sess in getattr(self.llmclient.backend, '_sessions', [self.llmclient.backend]):
sess.should_stop = lambda: self.stop_sig # live read; cleared by run()'s finally
try: # wake a recv() blocked in another thread (waiting headers OR reading stream). Verified on Windows:
# shutdown()/close() do NOT wake it (makefile refcount defers closesocket); _real_close() does
import socket as _socket
sock = sys.modules['llmcore']._INFLIGHT[sess._tid] # socket registered at urllib3 request() time, before headers
try: sock.shutdown(_socket.SHUT_RDWR) # for non-Windows semantics
except OSError: pass
try: sock._real_close() # CPython internal; bypasses refcount -> actual closesocket
except AttributeError: sock.close()
except Exception: pass
try: sess.active_response.close()
except Exception: pass
@@ -296,6 +305,7 @@ if __name__ == '__main__':
if task and task == '/exit': break
if task:
print(f'[Reflect] triggered: {task[:80]}')
if (_ln := getattr(mod, 'LLM', None)): agent.next_llm(next((i for i, b in enumerate(agent.llmclients) if not isinstance(b, dict) and b.backend.name == _ln), agent.llm_no))
dq = agent.put_task(task, source='reflect')
try:
while 'done' not in (item := dq.get(timeout=2200)): pass
Binary file not shown.

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 161 KiB

+1 -1
View File
@@ -4,6 +4,6 @@ L1 Insight是极简索引,L2/L3变更时同步L1,索引必须极简。写记
[CONSTITUTION]
1. 改自身源码先请示;./内可自主实验,允许装包和portable工具
2. 决策前查记忆,有SOP/utils必用;多次失败回看SOP;未查证不断言
3. 分步执行,控制粒度,限制失败半径;3次失败请求干预
3. 分步执行,控制粒度,限制失败半径
4. 密钥文件仅引用,不读取/移动
5. 写任何记忆前读META-SOP核验,memory下文件只能patch修改(除非新建)
+1 -1
View File
@@ -4,6 +4,6 @@ L1 Insight is a minimal index; sync L1 when L2/L3 changes; keep index minimal. R
[CONSTITUTION]
1. Ask before modifying own source code; free to experiment within ./; installing packages and portable tools allowed
2. Check memory before decisions; always use existing SOPs/utils; revisit SOPs on repeated failures; never assert without evidence
3. Execute step by step, control granularity, limit blast radius; request intervention after 3 failures
3. Execute step by step, control granularity, limit blast radius
4. Key/secret files: reference only, never read or move
5. Read META-SOP to verify before writing any memory; files under memory/ must be patched only (unless creating new)
+1 -1
View File
@@ -1,7 +1,7 @@
# Role: 物理级全能执行者
你拥有文件读写、脚本执行、用户浏览器JS注入、系统级干预的物理操作权限。禁止推诿"无法操作"——不空想,用工具探测。
## 行动原则
调用工具前先推演:当前阶段、上步结果是否符合预期、下步策略,必须在回复文本中用<summary>输出极简总结。
调用工具前先推演:当前阶段、上步结果是否符合预期、下步策略,必须在回复文本头部用小于30词<summary>输出极简总结。
- 探测优先:失败时先充分获取信息(日志/状态/上下文),关键信息存入工作记忆,再决定重试或换方案。不可逆操作先询问用户。
- 失败升级:1次→读错误理解原因,2次→探测环境状态,3次→深度分析后换方案或问用户。禁止无新信息的重复操作。
- 行动也是认识:边推进边用现实反馈校正方向,内部解释与计划只作暂时假说。根据任务选择高级sop调用
+2 -1
View File
@@ -2,6 +2,7 @@
You have full physical access: file I/O, script execution, browser JS injection, and system-level intervention. Never deflect with "can't do it" — don't speculate, use tools to probe.
Summarize and reply in user's language or follow user's prompt.
## Action Principles
Before each tool call, reason: current phase, whether the last result met expectations, and next strategy and <summary> in reply text of each turn.
Before each tool call, reason: current phase, whether the last result met expectations, and next strategy in reply text of each turn.
<summary> (<30 tokens) before reply text.
- Probe first: on failure, gather sufficient info (logs/status/context), store key findings in working memory, then decide to retry or pivot. Ask the user before irreversible operations.
- Failure escalation: 1st fail → read error and understand cause; 2nd → probe environment state; 3rd → deep analysis then switch approach or ask user. Never repeat an action without new information.
+5 -4
View File
@@ -809,11 +809,12 @@ def api_subagent_action(sid: str, body: SubagentActionIn):
return JSONResponse({"error": f"unknown action: {body.action}"}, status_code=400)
@app.get("/chat")
def api_get_chat(last: int = 20):
def api_get_chat(last: int = 20, mark_read: bool = True):
items = [m.copy() for m in chat_messages[-last:]]
for m in chat_messages:
if m.get("role") == "user" and not m.get("read"): m["read"] = True
schedule_broadcast({"type": "chat_read"})
if mark_read:
for m in chat_messages:
if m.get("role") == "user" and not m.get("read"): m["read"] = True
schedule_broadcast({"type": "chat_read"})
return {"items": items}
@app.post("/chat")
+1 -1
View File
@@ -69,7 +69,7 @@ existing core contracts.
## Version and release contract
Desktop package metadata is `0.2.0` across npm, Cargo, Tauri, and generated provenance. Upstream packages consume
Desktop package metadata is `0.2.1` across npm, Cargo, Tauri, and generated provenance. Upstream packages consume
the tracked `dist/**` tree, so an upstream maintainer can build official Windows, Linux, and macOS artifacts
without the React source. A `desktop-portable-*` tag starts three read-only platform builders. One separate
publisher receives write permission only after all three succeed, validates the six expected files and checksums,
+2 -2
View File
@@ -1,6 +1,6 @@
# GenericAgent React Desktop 2.0 — compiled distribution
This directory contains generated HTML, JavaScript, CSS, fonts, images, and license notices for the
This directory contains the v0.2.1 generated HTML, JavaScript, CSS, fonts, images, and license notices for the
GenericAgent React Desktop 2.0 renderer. It is build output, not the React development tree.
## Source and contributions
@@ -9,7 +9,7 @@ The public React source of truth and the place for renderer issues, pull request
- <https://github.com/abraxas914/GenericAgent>
- Exact source used for this distribution:
[`21f12f6dfe57ada8572bb21fe6604caac230b1cf`](https://github.com/abraxas914/GenericAgent/commit/21f12f6dfe57ada8572bb21fe6604caac230b1cf)
[`4a67226e18cb003db1210357ea4a283774773acc`](https://github.com/abraxas914/GenericAgent/commit/4a67226e18cb003db1210357ea4a283774773acc)
Over the two-month React Desktop 2.0 development cycle, [abraxas914](https://github.com/abraxas914) led the new
renderer architecture and UI, Desktop bridge and Tauri integration, startup and recovery surfaces, package
@@ -1 +1 @@
import{g as q}from"./tauri-compat-tfiFK9EG.js";var x,P;function Q(){if(P)return x;P=1;var i=4,t=.001,e=1e-7,s=10,n=11,a=1/(n-1),c=typeof Float32Array=="function";function l(u,o){return 1-3*o+3*u}function g(u,o){return 3*o-6*u}function T(u){return 3*u}function r(u,o,f){return((l(o,f)*u+g(o,f))*u+T(o))*u}function h(u,o,f){return 3*l(o,f)*u*u+2*g(o,f)*u+T(o)}function C(u,o,f,p,y){var m,_,F=0;do _=o+(f-o)/2,m=r(_,p,y)-u,m>0?f=_:o=_;while(Math.abs(m)>e&&++F<s);return _}function b(u,o,f,p){for(var y=0;y<i;++y){var m=h(o,f,p);if(m===0)return o;var _=r(o,f,p)-u;o-=_/m}return o}function d(u){return u}return x=function(o,f,p,y){if(!(0<=o&&o<=1&&0<=p&&p<=1))throw new Error("bezier x values must be in [0, 1] range");if(o===f&&p===y)return d;for(var m=c?new Float32Array(n):new Array(n),_=0;_<n;++_)m[_]=r(_*a,o,p);function F(v){for(var S=0,j=1,R=n-1;j!==R&&m[j]<=v;++j)S+=a;--j;var U=(v-m[j])/(m[j+1]-m[j]),A=S+U*a,k=h(A,o,p);return k>=t?b(v,A,o,p):k===0?A:C(v,S,S+a,o,p)}return function(S){return S===0?0:S===1?1:r(F(S),f,y)}},x}var K=Q();const z=q(K);function B(i,t,e){return Math.min(Math.max(i,t),e)}function W(i){const t=/\(([^)]+)\)/.exec(i);return t?t[1].split(",").map(e=>parseFloat(e)):[]}function V(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5;const e=B(i,1,10),s=B(t,.1,2);return n=>n===0||n===1?n:-e*Math.pow(2,10*(n-1))*Math.sin((n-1-s/(Math.PI*2)*Math.asin(1/e))*(Math.PI*2)/s)}const N=(()=>{const i=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],V],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],(s,n)=>a=>1-V(s,n)(1-a)],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],(s,n)=>a=>a<.5?V(s,n)(a*2)/2:1-V(s,n)(a*-2+2)/2]},e={linear:[.25,.25,.75,.75]};for(const s of Object.keys(t))t[s].forEach((n,a)=>{e["ease"+s+i[a]]=n});return e})();function D(i){if(typeof i=="function")return i;!i||typeof i!="string"?i="linear":i=i.trim();let t=i.split("(")[0];const e=W(i);let s;return t==="cubic-bezier"||t==="cubicBezier"?z(...e.length?e:N.linear):((!t||typeof t!="string"||typeof t=="string"&&N[t]==null)&&(t="linear"),s=N[t],typeof s=="function"?s(...e):e.length?z(...e):z(...s))}class Z{constructor(){this._eventMap=new Map}on(t,e){return t&&typeof e=="function"&&(this._eventMap.has(t)||this._eventMap.set(t,[]),this._eventMap.get(t).push(e)),this}once(t,e){var s=this;if(t&&typeof e=="function"){const n=function(){e(...arguments),s.off(t,n)};this.on(t,n)}}off(t,e){if(t)if(typeof e=="function"){const s=this._eventMap.get(t);if(Array.isArray(s)&&s.length){let n=-1;for(;(n=s.findIndex(a=>a===e))>-1;)s.splice(n,1)}}else e==null&&this._eventMap.delete(t);return this}emit(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return this._eventMap.has(t)?(this._eventMap.get(t).forEach(a=>a(...s)),!0):!1}}function M(i){return!!(i&&typeof i=="object"&&(i.duration>0||typeof i.easing=="string"||typeof i.easing=="function"))}function H(i,t,e,s,n){for(const a of Object.keys(t)){const c=t[a],l=typeof c=="number"?c:c.val;if(!(typeof c=="object"&&c.done)){if(M(c)&&s&&n&&c.duration){if(c.duration+s<=n||l!==i[a])return!1}else if(typeof e[a]=="number"&&e[a]!==0)return!1;if(i[a]!==l)return!1}}return!0}function E(i){const t={};for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=typeof i[e]=="number"?i[e]:i[e].val);return t}const I=[0,0];function L(i,t,e,s,n,a,c){const l=-n*(t-s),g=-a*e,T=l+g,r=e+T*i,h=t+r*i;return Math.abs(r)<c&&Math.abs(h-s)<c?(I[0]=s,I[1]=0,I):(I[0]=h,I[1]=r,I)}function J(i){const t={},e=i&&Object.keys(i)||[];for(const s of e)t[s]=0;return t}const $={default:{tension:170,friction:26}},Y=Object.assign(Object.assign({},$.default),{precision:.01});function G(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(M(t)){const s=D(t.easing),n=typeof t.duration=="number"&&t.duration>0?t.duration:1e3;t=Object.assign(Object.assign({},t),{easing:s,duration:n})}let e=Object.assign(Object.assign(Object.assign({},Y),t),{done:!1});if(i&&typeof i=="object"&&"val"in i){if(M(i)){const s=D(i.easing),n=typeof i.duration=="number"&&i.duration>0?i.duration:parseInt(t.duration)||1e3;i=Object.assign(Object.assign({},i),{easing:s,duration:n})}e=Object.assign(Object.assign({},e),i)}else e=Object.assign(Object.assign({},e),{val:i});return e}const w=()=>Date.now(),O=1e3/60;class tt extends Z{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),this._props=Object.assign({},t),this._config=Object.assign({},e),this.initStates()}_wrapConfig(t,e){e=e&&typeof e=="object"?Line truncated
import{g as q}from"./tauri-compat-D_GD_wMe.js";var x,P;function Q(){if(P)return x;P=1;var i=4,t=.001,e=1e-7,s=10,n=11,a=1/(n-1),c=typeof Float32Array=="function";function l(u,o){return 1-3*o+3*u}function g(u,o){return 3*o-6*u}function T(u){return 3*u}function r(u,o,f){return((l(o,f)*u+g(o,f))*u+T(o))*u}function h(u,o,f){return 3*l(o,f)*u*u+2*g(o,f)*u+T(o)}function C(u,o,f,p,y){var m,_,F=0;do _=o+(f-o)/2,m=r(_,p,y)-u,m>0?f=_:o=_;while(Math.abs(m)>e&&++F<s);return _}function b(u,o,f,p){for(var y=0;y<i;++y){var m=h(o,f,p);if(m===0)return o;var _=r(o,f,p)-u;o-=_/m}return o}function d(u){return u}return x=function(o,f,p,y){if(!(0<=o&&o<=1&&0<=p&&p<=1))throw new Error("bezier x values must be in [0, 1] range");if(o===f&&p===y)return d;for(var m=c?new Float32Array(n):new Array(n),_=0;_<n;++_)m[_]=r(_*a,o,p);function F(v){for(var S=0,j=1,R=n-1;j!==R&&m[j]<=v;++j)S+=a;--j;var U=(v-m[j])/(m[j+1]-m[j]),A=S+U*a,k=h(A,o,p);return k>=t?b(v,A,o,p):k===0?A:C(v,S,S+a,o,p)}return function(S){return S===0?0:S===1?1:r(F(S),f,y)}},x}var K=Q();const z=q(K);function B(i,t,e){return Math.min(Math.max(i,t),e)}function W(i){const t=/\(([^)]+)\)/.exec(i);return t?t[1].split(",").map(e=>parseFloat(e)):[]}function V(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:.5;const e=B(i,1,10),s=B(t,.1,2);return n=>n===0||n===1?n:-e*Math.pow(2,10*(n-1))*Math.sin((n-1-s/(Math.PI*2)*Math.asin(1/e))*(Math.PI*2)/s)}const N=(()=>{const i=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],V],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],(s,n)=>a=>1-V(s,n)(1-a)],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],(s,n)=>a=>a<.5?V(s,n)(a*2)/2:1-V(s,n)(a*-2+2)/2]},e={linear:[.25,.25,.75,.75]};for(const s of Object.keys(t))t[s].forEach((n,a)=>{e["ease"+s+i[a]]=n});return e})();function D(i){if(typeof i=="function")return i;!i||typeof i!="string"?i="linear":i=i.trim();let t=i.split("(")[0];const e=W(i);let s;return t==="cubic-bezier"||t==="cubicBezier"?z(...e.length?e:N.linear):((!t||typeof t!="string"||typeof t=="string"&&N[t]==null)&&(t="linear"),s=N[t],typeof s=="function"?s(...e):e.length?z(...e):z(...s))}class Z{constructor(){this._eventMap=new Map}on(t,e){return t&&typeof e=="function"&&(this._eventMap.has(t)||this._eventMap.set(t,[]),this._eventMap.get(t).push(e)),this}once(t,e){var s=this;if(t&&typeof e=="function"){const n=function(){e(...arguments),s.off(t,n)};this.on(t,n)}}off(t,e){if(t)if(typeof e=="function"){const s=this._eventMap.get(t);if(Array.isArray(s)&&s.length){let n=-1;for(;(n=s.findIndex(a=>a===e))>-1;)s.splice(n,1)}}else e==null&&this._eventMap.delete(t);return this}emit(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;n<e;n++)s[n-1]=arguments[n];return this._eventMap.has(t)?(this._eventMap.get(t).forEach(a=>a(...s)),!0):!1}}function M(i){return!!(i&&typeof i=="object"&&(i.duration>0||typeof i.easing=="string"||typeof i.easing=="function"))}function H(i,t,e,s,n){for(const a of Object.keys(t)){const c=t[a],l=typeof c=="number"?c:c.val;if(!(typeof c=="object"&&c.done)){if(M(c)&&s&&n&&c.duration){if(c.duration+s<=n||l!==i[a])return!1}else if(typeof e[a]=="number"&&e[a]!==0)return!1;if(i[a]!==l)return!1}}return!0}function E(i){const t={};for(const e in i)Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=typeof i[e]=="number"?i[e]:i[e].val);return t}const I=[0,0];function L(i,t,e,s,n,a,c){const l=-n*(t-s),g=-a*e,T=l+g,r=e+T*i,h=t+r*i;return Math.abs(r)<c&&Math.abs(h-s)<c?(I[0]=s,I[1]=0,I):(I[0]=h,I[1]=r,I)}function J(i){const t={},e=i&&Object.keys(i)||[];for(const s of e)t[s]=0;return t}const $={default:{tension:170,friction:26}},Y=Object.assign(Object.assign({},$.default),{precision:.01});function G(i){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(M(t)){const s=D(t.easing),n=typeof t.duration=="number"&&t.duration>0?t.duration:1e3;t=Object.assign(Object.assign({},t),{easing:s,duration:n})}let e=Object.assign(Object.assign(Object.assign({},Y),t),{done:!1});if(i&&typeof i=="object"&&"val"in i){if(M(i)){const s=D(i.easing),n=typeof i.duration=="number"&&i.duration>0?i.duration:parseInt(t.duration)||1e3;i=Object.assign(Object.assign({},i),{easing:s,duration:n})}e=Object.assign(Object.assign({},e),i)}else e=Object.assign(Object.assign({},e),{val:i});return e}const w=()=>Date.now(),O=1e3/60;class tt extends Z{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),this._props=Object.assign({},t),this._config=Object.assign({},e),this.initStates()}_wrapConfig(t,e){e=e&&typeof e=="object"?Line truncated
+1
View File
@@ -0,0 +1 @@
import{b as r,aj as l}from"./tauri-compat-D_GD_wMe.js";import{H as i,b as N,J as C,L as S,K as M,N as T,O as W,P as v,M as R,Q as E}from"./main-j7e_THPB.js";import{MarkdownPart as w}from"./MarkdownPart-ZJKeOipX.js";import"./index-9FI8Jlf5.js";import"./WindowsTitlebar-Byi-SYR_.js";import"./markdown-preprocess-Cc2i34eF.js";const $=200;function D({message:a}){const n=a.role==="user",e=a.role==="conductor";return l.jsx("div",{className:`collab-msg collab-msg--${a.role}`,"data-slot":"collab-msg",children:l.jsxs("div",{className:`collab-bubble ${n?"collab-bubble--user":e?"collab-bubble--conductor":"collab-bubble--system"}`,children:[a.images&&a.images.length>0&&l.jsx("div",{className:"collab-msg-images",children:a.images.map((c,s)=>l.jsx("img",{src:c.base64||c.path,alt:c.name,className:"collab-msg-img"},s))}),a.files&&a.files.length>0&&l.jsx("div",{className:"collab-msg-files",children:a.files.map((c,s)=>l.jsx("span",{className:"collab-msg-file-chip",children:c.name},s))}),e||a.role==="system"?l.jsx(w,{content:a.msg}):l.jsx("span",{className:"collab-msg-text",children:a.msg})]})})}function P({since:a}){const{t:n}=N();return l.jsx("div",{className:"collab-msg collab-msg--conductor","data-slot":"collab-typing",children:l.jsxs("div",{className:"collab-thinking-bar",children:[l.jsx("span",{className:"collab-thinking-dot"}),l.jsx("span",{className:"collab-thinking-label",children:n("collab.typing")}),l.jsx("span",{className:"collab-thinking-time",children:l.jsx(S,{since:a})})]})})}function B(){const a=i(o=>o.messages),n=i(o=>o.conductorTyping),e=i(o=>o.connectionStatus),{t:c}=N(),{scrollRef:s}=C(),[m,x]=r.useState(1),d=r.useRef(null),p=r.useRef(0);r.useEffect(()=>{(e==="connecting"||a.length===0)&&x(1)},[e,a.length]);const b=$*m,u=Math.max(0,a.length-b),k=a.slice(u),t=u,g=r.useCallback(()=>{const o=s.current;o&&(d.current=o.scrollHeight-o.scrollTop),x(h=>h+1)},[s]);r.useLayoutEffect(()=>{if(d.current==null)return;if(u>=p.current){d.current=null,p.current=u;return}const o=s.current;o&&(o.scrollTop=o.scrollHeight-d.current),d.current=null,p.current=u},[u,s]),r.useEffect(()=>{p.current=u},[u]);const j=[...a].reverse().find(o=>o.role==="user"),y=o=>o>1e12?o:o*1e3,f=r.useRef(Date.now());return j!=null&&j.ts&&(f.current=y(j.ts)),e==="connecting"?l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",children:l.jsxs("div",{className:"collab-connecting",children:[l.jsx("span",{className:"collab-connecting-dot"}),l.jsx("span",{children:c("status.connecting")})]})}):a.length===0?l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",children:l.jsx("div",{className:"collab-empty",children:l.jsx("p",{children:c("collab.placeholder")})})}):l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",ref:s,children:l.jsxs("div",{className:"collab-messages-scroll",children:[t>0&&l.jsxs("button",{type:"button","data-slot":"show-earlier-btn",onClick:g,children:["Show ",t," earlier"]}),k.map((o,h)=>l.jsx(D,{message:o},o.id||u+h)),n&&l.jsx(P,{since:f.current})]})})}function H(){const a=i(t=>t.sendMessage),n=i(t=>t.conductorTyping),e=i(t=>t.connectionStatus),c=i(t=>t.modelConfig),s=i(t=>t.runtimeModel),m=i(t=>t.loadModel),x=i(t=>t.selectModel),d=M(t=>t.defaultModelNo);r.useEffect(()=>{m()},[m]);const p=r.useCallback((t,g)=>{var f,o;const j=(f=g==null?void 0:g.files)==null?void 0:f.map(h=>({name:h.name,path:h.path})),y=(o=g==null?void 0:g.images)==null?void 0:o.map(h=>({name:h.name,path:h.path,base64:h.base64}));a(t,j,y)},[a]),b=r.useCallback(()=>{},[]),u=e!=="ready",k=(c==null?void 0:c.effective)??(c==null?void 0:c.configured)??d;return l.jsx("div",{className:"collab-composer-wrap","data-slot":"collab-composer","data-disabled":u||void 0,children:l.jsx(T,{onSend:p,onStop:b,isGenerating:n,hideStatusStack:!0,modelControl:l.jsx(W,{selectedNo:k,runningNo:s!=null&&s.running?s.effective:null,isRunning:!!(s!=null&&s.running),onSelect:x})})})}const L=[{key:"1",icon:"comment"},{key:"2",icon:"symbol-misc"},{key:"3",icon:"graph"},{key:"4",icon:"edit"}],F=["collab.chipProgress","collab.chipPause","collab.chipSummary"];function I({onChipClick:a}){const{t:n}=N();return l.jsxs("div",{className:"collab-welcome","data-slot":"collab-welcome",children:[l.jsx("h2",{className:"collab-welcome-title",children:n("collab.guideTitle")}),l.jsx("p",{className:"collab-welcome-sub",children:n("collab.guideWhen")}),l.jsx("div",{className:"collab-welcome-steps",children:L.map(e=>l.jsxs("div",{className:"collab-welcome-step",children:[l.jsx("span",{className:"collab-welcome-step-icon",children:l.jsx(v,{name:e.icon,size:"1rem"})}),l.jsxs("span",{className:"collab-welcome-step-text",children:[l.jsx("span",{className:"collab-welcome-step-label",children:n(`collab.guideStep${e.key}t`)}),l.jsx("span",{className:"collab-welcome-step-desc",children:n(`collab.guideStep${e.key}d`)})]})]},e.key))}),l.jsx("div",{className:"collab-welcome-chips",children:F.map(e=>l.jsx("button",{type:"button",className:"collab-welcome-chip",oLine truncated
-1
View File
@@ -1 +0,0 @@
import{b as r,aj as l}from"./tauri-compat-tfiFK9EG.js";import{H as i,b as N,J as C,K as S,L as M,N as T,O as v,M as E,P as W}from"./main-Knf6L_en.js";import{MarkdownPart as w}from"./MarkdownPart-Bhe_jloX.js";import"./index-Bpi3BHKj.js";import"./WindowsTitlebar-CrkUa1UM.js";import"./markdown-preprocess-Bvg4n8KE.js";function R(e){const c=Math.floor(e/1e3);if(c<60)return`${c}s`;const a=Math.floor(c/60),n=c%60;return`${a}m ${n}s`}function $({since:e}){const[c,a]=r.useState(Date.now());return r.useEffect(()=>{const n=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(n)},[]),l.jsx(l.Fragment,{children:R(c-e)})}const D=200;function P({message:e}){const c=e.role==="user",a=e.role==="conductor";return l.jsx("div",{className:`collab-msg collab-msg--${e.role}`,"data-slot":"collab-msg",children:l.jsxs("div",{className:`collab-bubble ${c?"collab-bubble--user":a?"collab-bubble--conductor":"collab-bubble--system"}`,children:[e.images&&e.images.length>0&&l.jsx("div",{className:"collab-msg-images",children:e.images.map((n,s)=>l.jsx("img",{src:n.base64||n.path,alt:n.name,className:"collab-msg-img"},s))}),e.files&&e.files.length>0&&l.jsx("div",{className:"collab-msg-files",children:e.files.map((n,s)=>l.jsx("span",{className:"collab-msg-file-chip",children:n.name},s))}),a||e.role==="system"?l.jsx(w,{content:e.msg}):l.jsx("span",{className:"collab-msg-text",children:e.msg})]})})}function B({since:e}){const{t:c}=N();return l.jsx("div",{className:"collab-msg collab-msg--conductor","data-slot":"collab-typing",children:l.jsxs("div",{className:"collab-thinking-bar",children:[l.jsx("span",{className:"collab-thinking-dot"}),l.jsx("span",{className:"collab-thinking-label",children:c("collab.typing")}),l.jsx("span",{className:"collab-thinking-time",children:l.jsx($,{since:e})})]})})}function I(){const e=i(o=>o.messages),c=i(o=>o.conductorTyping),a=i(o=>o.connectionStatus),{t:n}=N(),{scrollRef:s}=C(),[u,x]=r.useState(1),d=r.useRef(null),p=r.useRef(0);r.useEffect(()=>{(a==="connecting"||e.length===0)&&x(1)},[a,e.length]);const b=D*u,m=Math.max(0,e.length-b),k=e.slice(m),t=m,g=r.useCallback(()=>{const o=s.current;o&&(d.current=o.scrollHeight-o.scrollTop),x(h=>h+1)},[s]);r.useLayoutEffect(()=>{if(d.current==null)return;if(m>=p.current){d.current=null,p.current=m;return}const o=s.current;o&&(o.scrollTop=o.scrollHeight-d.current),d.current=null,p.current=m},[m,s]),r.useEffect(()=>{p.current=m},[m]);const j=[...e].reverse().find(o=>o.role==="user"),y=o=>o>1e12?o:o*1e3,f=r.useRef(Date.now());return j!=null&&j.ts&&(f.current=y(j.ts)),a==="connecting"?l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",children:l.jsxs("div",{className:"collab-connecting",children:[l.jsx("span",{className:"collab-connecting-dot"}),l.jsx("span",{children:n("status.connecting")})]})}):e.length===0?l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",children:l.jsx("div",{className:"collab-empty",children:l.jsx("p",{children:n("collab.placeholder")})})}):l.jsx("div",{className:"collab-messages-area","data-slot":"collab-messages",ref:s,children:l.jsxs("div",{className:"collab-messages-scroll",children:[t>0&&l.jsxs("button",{type:"button","data-slot":"show-earlier-btn",onClick:g,children:["Show ",t," earlier"]}),k.map((o,h)=>l.jsx(P,{message:o},o.id||m+h)),c&&l.jsx(B,{since:f.current})]})})}function F(){const e=i(t=>t.sendMessage),c=i(t=>t.conductorTyping),a=i(t=>t.connectionStatus),n=i(t=>t.modelConfig),s=i(t=>t.runtimeModel),u=i(t=>t.loadModel),x=i(t=>t.selectModel),d=S(t=>t.defaultModelNo);r.useEffect(()=>{u()},[u]);const p=r.useCallback((t,g)=>{var f,o;const j=(f=g==null?void 0:g.files)==null?void 0:f.map(h=>({name:h.name,path:h.path})),y=(o=g==null?void 0:g.images)==null?void 0:o.map(h=>({name:h.name,path:h.path,base64:h.base64}));e(t,j,y)},[e]),b=r.useCallback(()=>{},[]),m=a!=="ready",k=(n==null?void 0:n.effective)??(n==null?void 0:n.configured)??d;return l.jsx("div",{className:"collab-composer-wrap","data-slot":"collab-composer","data-disabled":m||void 0,children:l.jsx(M,{onSend:p,onStop:b,isGenerating:c,hideStatusStack:!0,modelControl:l.jsx(T,{selectedNo:k,runningNo:s!=null&&s.running?s.effective:null,isRunning:!!(s!=null&&s.running),onSelect:x})})})}const H=[{key:"1",icon:"comment"},{key:"2",icon:"symbol-misc"},{key:"3",icon:"graph"},{key:"4",icon:"edit"}],L=["collab.chipProgress","collab.chipPause","collab.chipSummary"];function O({onChipClick:e}){const{t:c}=N();return l.jsxs("div",{className:"collab-welcome","data-slot":"collab-welcome",children:[l.jsx("h2",{className:"collab-welcome-title",children:c("collab.guideTitle")}),l.jsx("p",{className:"collab-welcome-sub",children:c("collab.guideWhen")}),l.jsx("div",{className:"collab-welcome-steps",children:H.map(a=>l.jsxs("div",{className:"collab-welcome-step",children:[l.jsx("span",{className:"collab-welcome-step-icon",children:l.jsx(v,{name:a.icon,size:"1rem"})}),l.jsxs("span",{className:"collab-welcome-step-text",children:[l.jsx("span",{className:"collabLine truncated
@@ -1 +1 @@
import{c as t,b as e}from"./tauri-compat-tfiFK9EG.js";function n(a){return e.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},a),e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2a1 1 0 0 0-1-1H6a2 2 0 0 0-2 2v18c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V10a1 1 0 0 0-1-1h-5a2 2 0 0 1-2-2V2ZM7 8a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H8a1 1 0 0 1-1-1Zm0 5a1 1 0 0 1 1-1h8a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Zm1 4a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Zm11.07-9.5H14.5a1 1 0 0 1-1-1V1.93a.8.8 0 0 1 1.37-.56l4.76 4.76a.8.8 0 0 1-.56 1.37Z",fill:"currentColor"}))}const l=t(n,"file");export{l as I};
import{c as t,b as e}from"./tauri-compat-D_GD_wMe.js";function n(a){return e.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},a),e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2a1 1 0 0 0-1-1H6a2 2 0 0 0-2 2v18c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V10a1 1 0 0 0-1-1h-5a2 2 0 0 1-2-2V2ZM7 8a1 1 0 0 1 1-1h1a1 1 0 0 1 0 2H8a1 1 0 0 1-1-1Zm0 5a1 1 0 0 1 1-1h8a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Zm1 4a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Zm11.07-9.5H14.5a1 1 0 0 1-1-1V1.93a.8.8 0 0 1 1.37-.56l4.76 4.76a.8.8 0 0 1-.56 1.37Z",fill:"currentColor"}))}const l=t(n,"file");export{l as I};
@@ -1,4 +1,4 @@
var an=Object.defineProperty;var nn=(r,e,t)=>e in r?an(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var nr=(r,e,t)=>nn(r,typeof e!="symbol"?e+"":e,t);import{bs as ir,g as sn,b as a0,aj as U}from"./tauri-compat-tfiFK9EG.js";import{M as ln,r as on,a as un,b as cn,p as hn,S as dn}from"./markdown-preprocess-Bvg4n8KE.js";import{Q as sr,S as mn,U as pn}from"./main-Knf6L_en.js";import"./index-Bpi3BHKj.js";import"./WindowsTitlebar-CrkUa1UM.js";var at={exports:{}},lr;function fn(){return lr||(lr=1,(function(r){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
var an=Object.defineProperty;var nn=(r,e,t)=>e in r?an(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var nr=(r,e,t)=>nn(r,typeof e!="symbol"?e+"":e,t);import{bs as ir,g as sn,b as a0,aj as U}from"./tauri-compat-D_GD_wMe.js";import{M as ln,r as on,a as un,b as cn,p as hn,S as dn}from"./markdown-preprocess-Cc2i34eF.js";import{S as sr,U as mn,V as pn}from"./main-j7e_THPB.js";import"./index-9FI8Jlf5.js";import"./WindowsTitlebar-Byi-SYR_.js";var at={exports:{}},lr;function fn(){return lr||(lr=1,(function(r){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};/**
* Prism: Lightweight, robust, elegant syntax highlighting
*
* @license MIT <https://opensource.org/licenses/MIT>
@@ -1,4 +1,4 @@
import{c as se,b as u,ax as Le,f as Ee,h as S,_ as K,i as oe,R as v,k as Te,ay as re,l as D,n as le,V as Oe,az as X,P as f,aj as i,ab as Me}from"./tauri-compat-tfiFK9EG.js";import{T as He,a as Ve,b as ce}from"./index-DwVcZP0M.js";import{_ as he,t as Fe,c as Pe,I as Ie,a as $e,u as Be,b as q,d as z,M as fe,e as xe,i as be,f as Y,E as ye,T as ee,g as Ae,h as de}from"./main-Knf6L_en.js";import{B as _,c as Q,I as Ke}from"./index-Bpi3BHKj.js";import{S as G}from"./index-D_sWIqse.js";import{I as ve}from"./IconFile-CgfQSwGI.js";import"./WindowsTitlebar-CrkUa1UM.js";function We(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{d:"M5 2.9a1 1 0 0 1 1.57-.82l13.23 9.1a1 1 0 0 1 0 1.64l-13.23 9.1A1 1 0 0 1 5 21.1V2.9Z",fill:"currentColor"}))}const we=se(We,"play");function Ue(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 5.07c-.8.47-1.8.46-2.6 0l-.24-.15a1.4 1.4 0 0 0-1.82.29c-.64.82-1.16 1.73-1.55 2.7a1.4 1.4 0 0 0 .66 1.71l.24.14a2.57 2.57 0 0 1 0 4.48l-.24.14a1.4 1.4 0 0 0-.66 1.72 11.1 11.1 0 0 0 1.55 2.69 1.4 1.4 0 0 0 1.82.3l.25-.15a2.57 2.57 0 0 1 3.88 2.24v.28c-.01.7.46 1.33 1.16 1.43a11 11 0 0 0 3.1 0 1.4 1.4 0 0 0 1.17-1.43v-.28a2.57 2.57 0 0 1 3.87-2.24l.25.14c.6.36 1.38.26 1.82-.29.64-.82 1.16-1.73 1.55-2.7a1.4 1.4 0 0 0-.66-1.71l-.24-.14a2.57 2.57 0 0 1 0-4.48l.24-.14a1.4 1.4 0 0 0 .66-1.72 11.08 11.08 0 0 0-1.55-2.69 1.4 1.4 0 0 0-1.82-.3l-.25.15a2.57 2.57 0 0 1-3.88-2.24v-.28c.01-.7-.46-1.33-1.16-1.43a10.99 10.99 0 0 0-3.1 0c-.7.1-1.17.72-1.17 1.43v.28C9.3 3.75 8.8 4.61 8 5.07Zm6 10.4a4 4 0 1 0-4-6.93 4 4 0 0 0 4 6.92Z",fill:"currentColor"}))}const De=se(Ue,"setting");function qe(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{d:"M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Z",fill:"currentColor"}))}const Se=se(qe,"stop");let R=null;const ue={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},ge=s=>{Object.keys(ue).forEach(e=>{s.style.setProperty(e,ue[e],"important")})},pe=(s,e)=>{const t=s.scrollHeight;return e.sizingStyle.boxSizing==="border-box"?t+e.borderSize:t-e.paddingSize};function Ze(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1/0;R||(R=document.createElement("textarea"),R.setAttribute("tab-index","-1"),R.setAttribute("aria-hidden","true"),ge(R)),R.parentNode===null&&document.body.appendChild(R);const{paddingSize:a,borderSize:o,sizingStyle:r}=s,{boxSizing:l}=r;Object.keys(r).forEach(x=>{R.style[x]=r[x]}),ge(R),R.value=e;let c=pe(R,s);R.value="x";const g=pe(R,s)-a-o;let m=g*t;l==="border-box"&&(m=m+a+o),c=Math.max(m,c);let w=g*n;return l==="border-box"&&(w=w+a+o),c=Math.min(w,c),c}const Xe=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width"],Ye=s=>{const e=window.getComputedStyle(s);if(e===null)return null;const t=Le(e,Xe),{boxSizing:n}=t;if(n==="")return null;const a=parseFloat(t.paddingBottom)+parseFloat(t.paddingTop),o=parseFloat(t.borderBottomWidth)+parseFloat(t.borderTopWidth);return{sizingStyle:t,paddingSize:a,borderSize:o}};class ne extends Ee{static get textAreaDefaultAdapter(){return{notifyChange:S,setValue:S,toggleFocusing:S,toggleHovering:S,notifyFocus:S,notifyBlur:S,notifyKeyDown:S,notifyEnterPress:S}}constructor(e){super(Object.assign(Object.assign({},ne.textAreaDefaultAdapter),e)),this.compositionEnter=!1,this._changeValue=(t,n)=>{this._isControlledComponent()?this._adapter.notifyChange(t,n):(this._adapter.setValue(t),this._adapter.notifyChange(t,n))},this.getNextValue=t=>{const{maxLength:n,minLength:a,getValueLength:o}=this._adapter.getProps();return K(o)?n?this.handleVisibleMaxLength(t):(a&&this.handleVisibleMinLength(t),t):t},this.handleCompositionStart=t=>{this.compositionEnter=!0,this._adapter.notifyCompositionStart(t)},this.handleCompositionEnd=t=>{const{composition:n}=this._adapter.getProps(),a=t.target.value;if(this.compositionEnter=!1,this._adapter.notifyCompositionEnd(t),n){const c=this.getNextValue(a);this._changeValue(c,t);return}const{getValueLength:o,maxLength:r,minLength:l}=this.getProps();if(K(o)){if(r){const c=this.handleVisibleMaxLength(a);c!==a&&this._changeValue(c,t)}l&&this.handleVisibleMinLength(a)}},this.handleCompositionUpdate=t=>{this._adapter.notifyCompLine truncated
import{c as se,b as u,ax as Le,f as Ee,h as S,_ as K,i as oe,R as v,k as Te,ay as re,l as D,n as le,V as Oe,az as X,P as f,aj as i,ab as Me}from"./tauri-compat-D_GD_wMe.js";import{T as He,a as Ve,b as ce}from"./index-BkPDmlaQ.js";import{_ as he,t as Fe,c as Pe,I as Ie,a as $e,u as Be,b as q,d as z,M as fe,e as xe,i as be,f as Y,E as ye,T as ee,g as Ae,h as de}from"./main-j7e_THPB.js";import{B as _,c as Q,I as Ke}from"./index-9FI8Jlf5.js";import{S as G}from"./index-D9Nakaf3.js";import{I as ve}from"./IconFile-C8B3WX2U.js";import"./WindowsTitlebar-Byi-SYR_.js";function We(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{d:"M5 2.9a1 1 0 0 1 1.57-.82l13.23 9.1a1 1 0 0 1 0 1.64l-13.23 9.1A1 1 0 0 1 5 21.1V2.9Z",fill:"currentColor"}))}const we=se(We,"play");function Ue(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 5.07c-.8.47-1.8.46-2.6 0l-.24-.15a1.4 1.4 0 0 0-1.82.29c-.64.82-1.16 1.73-1.55 2.7a1.4 1.4 0 0 0 .66 1.71l.24.14a2.57 2.57 0 0 1 0 4.48l-.24.14a1.4 1.4 0 0 0-.66 1.72 11.1 11.1 0 0 0 1.55 2.69 1.4 1.4 0 0 0 1.82.3l.25-.15a2.57 2.57 0 0 1 3.88 2.24v.28c-.01.7.46 1.33 1.16 1.43a11 11 0 0 0 3.1 0 1.4 1.4 0 0 0 1.17-1.43v-.28a2.57 2.57 0 0 1 3.87-2.24l.25.14c.6.36 1.38.26 1.82-.29.64-.82 1.16-1.73 1.55-2.7a1.4 1.4 0 0 0-.66-1.71l-.24-.14a2.57 2.57 0 0 1 0-4.48l.24-.14a1.4 1.4 0 0 0 .66-1.72 11.08 11.08 0 0 0-1.55-2.69 1.4 1.4 0 0 0-1.82-.3l-.25.15a2.57 2.57 0 0 1-3.88-2.24v-.28c.01-.7-.46-1.33-1.16-1.43a10.99 10.99 0 0 0-3.1 0c-.7.1-1.17.72-1.17 1.43v.28C9.3 3.75 8.8 4.61 8 5.07Zm6 10.4a4 4 0 1 0-4-6.93 4 4 0 0 0 4 6.92Z",fill:"currentColor"}))}const De=se(Ue,"setting");function qe(s){return u.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},s),u.createElement("path",{d:"M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V6Z",fill:"currentColor"}))}const Se=se(qe,"stop");let R=null;const ue={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},ge=s=>{Object.keys(ue).forEach(e=>{s.style.setProperty(e,ue[e],"important")})},pe=(s,e)=>{const t=s.scrollHeight;return e.sizingStyle.boxSizing==="border-box"?t+e.borderSize:t-e.paddingSize};function Ze(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1/0;R||(R=document.createElement("textarea"),R.setAttribute("tab-index","-1"),R.setAttribute("aria-hidden","true"),ge(R)),R.parentNode===null&&document.body.appendChild(R);const{paddingSize:a,borderSize:o,sizingStyle:r}=s,{boxSizing:l}=r;Object.keys(r).forEach(x=>{R.style[x]=r[x]}),ge(R),R.value=e;let c=pe(R,s);R.value="x";const g=pe(R,s)-a-o;let m=g*t;l==="border-box"&&(m=m+a+o),c=Math.max(m,c);let w=g*n;return l==="border-box"&&(w=w+a+o),c=Math.min(w,c),c}const Xe=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width"],Ye=s=>{const e=window.getComputedStyle(s);if(e===null)return null;const t=Le(e,Xe),{boxSizing:n}=t;if(n==="")return null;const a=parseFloat(t.paddingBottom)+parseFloat(t.paddingTop),o=parseFloat(t.borderBottomWidth)+parseFloat(t.borderTopWidth);return{sizingStyle:t,paddingSize:a,borderSize:o}};class ne extends Ee{static get textAreaDefaultAdapter(){return{notifyChange:S,setValue:S,toggleFocusing:S,toggleHovering:S,notifyFocus:S,notifyBlur:S,notifyKeyDown:S,notifyEnterPress:S}}constructor(e){super(Object.assign(Object.assign({},ne.textAreaDefaultAdapter),e)),this.compositionEnter=!1,this._changeValue=(t,n)=>{this._isControlledComponent()?this._adapter.notifyChange(t,n):(this._adapter.setValue(t),this._adapter.notifyChange(t,n))},this.getNextValue=t=>{const{maxLength:n,minLength:a,getValueLength:o}=this._adapter.getProps();return K(o)?n?this.handleVisibleMaxLength(t):(a&&this.handleVisibleMinLength(t),t):t},this.handleCompositionStart=t=>{this.compositionEnter=!0,this._adapter.notifyCompositionStart(t)},this.handleCompositionEnd=t=>{const{composition:n}=this._adapter.getProps(),a=t.target.value;if(this.compositionEnter=!1,this._adapter.notifyCompositionEnd(t),n){const c=this.getNextValue(a);this._changeValue(c,t);return}const{getValueLength:o,maxLength:r,minLength:l}=this.getProps();if(K(o)){if(r){const c=this.handleVisibleMaxLength(a);c!==a&&this._changeValue(c,t)}l&&this.handleVisibleMinLength(a)}},this.handleCompositionUpdate=t=>{this._adapter.notifyCompLine truncated
`):[""],m=D(`${y}-textarea-lineNumber`,n),w=c?this.getTextareaLineHeightPx(c):21,x=Object.assign(Object.assign({},a||{}),{height:l?`${l}px`:void 0,maxHeight:l?`${l}px`:void 0});return v.createElement("div",{ref:this.lineNumberRef,className:m,style:x},g.map((E,C)=>{const k=c?this.calculateWrappedLines(E,c):1;return v.createElement("div",{key:C,className:`${y}-textarea-lineNumber-item`,style:{minHeight:`${k*w}px`,lineHeight:`${w}px`}},t+C)}))}render(){const e=this.props,{autosize:t,placeholder:n,onEnterPress:a,onResize:o,resize:r,disabled:l,readonly:c,className:g,showCounter:m,validateStatus:w,maxCount:x,defaultValue:E,style:C,textareaStyle:k,forwardRef:T,getValueLength:H,maxLength:p,minLength:N,showClear:O,borderless:L,autoFocus:I,showLineNumber:h,lineNumberStart:d,lineNumberClassName:b,lineNumberStyle:M,composition:U}=e,$=Qe(e,["autosize","placeholder","onEnterPress","onResize","resize","disabled","readonly","className","showCounter","validateStatus","maxCount","defaultValue","style","textareaStyle","forwardRef","getValueLength","maxLength","minLength","showClear","borderless","autoFocus","showLineNumber","lineNumberStart","lineNumberClassName","lineNumberStyle","composition"]),{isFocus:Z,value:B,minLength:F}=this.state,A=!le(r),je=!t&&A&&["horizontal","both","inline"].includes(r),Re=!t&&A&&["vertical","both","block"].includes(r),_e=D(g,`${y}-textarea-wrapper`,{[`${y}-textarea-borderless`]:L,[`${y}-textarea-wrapper-disabled`]:l,[`${y}-textarea-wrapper-readonly`]:c,[`${y}-textarea-wrapper-${w}`]:!!w,[`${y}-textarea-wrapper-focus`]:Z,[`${y}-textarea-wrapper-withLineNumber`]:h,[`${y}-textarea-wrapper-resizeX`]:je,[`${y}-textarea-wrapper-resizeY`]:Re}),ke=D(`${y}-textarea`,{[`${y}-textarea-disabled`]:l,[`${y}-textarea-readonly`]:c,[`${y}-textarea-autosize`]:$e(t)?le(t==null?void 0:t.maxRows):t,[`${y}-textarea-showClear`]:O}),J=Object.assign({},k||{});t?J.resize="none":A&&(J.resize=r);const ie=!t&&A&&r&&r!=="none",V=Object.assign(Object.assign({},Oe($,"insetLabel","insetLabelId","getValueLength","onClear","showClear","disabledEnterStartNewLine","composition")),{style:J,autoFocus:I||this.props.autofocus,className:ke,disabled:l,readOnly:c,placeholder:n||null,onChange:j=>this.foundation.handleChange(j.target.value,j),onFocus:j=>this.foundation.handleFocus(j),onBlur:j=>this.foundation.handleBlur(j.nativeEvent),onKeyDown:j=>this.foundation.handleKeyDown(j),onScroll:this.handleTextAreaScroll,value:B??"",onCompositionStart:this.foundation.handleCompositionStart,onCompositionEnd:this.foundation.handleCompositionEnd,onCompositionUpdate:this.foundation.handleCompositionUpdate});return K(H)||(V.maxLength=p),F&&(V.minLength=F),v.createElement("div",{className:_e,style:C,onMouseEnter:j=>this.foundation.handleMouseEnter(j),onMouseLeave:j=>this.foundation.handleMouseLeave(j),onClick:j=>this.handleClick(j)},this.renderLineNumbers(),h?v.createElement("div",{className:`${y}-textarea-content`},t?v.createElement(X,{onResize:this.throttledResizeTextarea},v.createElement("textarea",Object.assign({},V,{ref:this.setRef}))):ie?v.createElement(X,{onResize:this.throttledNotifyNativeResize},v.createElement("textarea",Object.assign({},V,{ref:this.setRef}))):v.createElement("textarea",Object.assign({},V,{ref:this.setRef}))):t?v.createElement(X,{onResize:this.throttledResizeTextarea},v.createElement("textarea",Object.assign({},V,{ref:this.setRef}))):ie?v.createElement(X,{onResize:this.throttledNotifyNativeResize},v.createElement("textarea",Object.assign({},V,{ref:this.setRef}))):v.createElement("textarea",Object.assign({},V,{ref:this.setRef})),this.renderClearBtn(),this.renderCounter())}}ae.propTypes={autosize:f.oneOfType([f.bool,f.object]),borderless:f.bool,placeholder:f.string,value:f.string,rows:f.number,cols:f.number,maxCount:f.number,onEnterPress:f.func,validateStatus:f.string,className:f.string,style:f.object,textareaStyle:f.object,showClear:f.bool,onClear:f.func,onResize:f.func,onCompositionStart:f.func,onCompositionEnd:f.func,onCompositionUpdate:f.func,getValueLength:f.func,disabledEnterStartNewLine:f.bool,composition:f.bool,showLineNumber:f.bool,lineNumberStart:f.number,lineNumberClassName:f.string,lineNumberStyle:f.object,resize:f.oneOf(["none","both","horizontal","vertical","block","inline"])};ae.defaultProps={autosize:!1,borderless:!1,rows:4,cols:20,showCounter:!1,showClear:!1,onEnterPress:S,onChange:S,onBlur:S,onFocus:S,onKeyDown:S,onResize:S,onClear:S,onCompositionStart:S,onCompositionEnd:S,onCompositionUpdate:S,composition:!1,showLineNumber:!1,lineNumberStart:1};const Ge=v.forwardRef((s,e)=>v.createElement(ae,Object.assign({},s,{forwardRef:e})));function Je({lines:s,emptyLabel:e="No logs",className:t}){const n=u.useRef(null),a=u.useRef(!0),[o,r]=u.useState(!1);u.useEffect(()=>{const g=n.current;g&&a.current&&(g.scrollTop=g.scrollHeight)},[s]);const l=u.useCallback(g=>{const m=g.currentTarget;a.current=m.scrollHeight-m.scrollTop-m.clientHeight<24},[]),c=u.useCallback(()=>{s!=null&&s.length&&navigator.clipboard.writeText(s.join( Line truncated
`)).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})},[s]);return i.jsxs("div",{className:`ga-log-tail ${t??""}`,children:[i.jsx("button",{type:"button",className:`ga-log-tail-copy ${o?"copied":""}`,onClick:c,title:"Copy",children:o?"✓":"⎘"}),i.jsx("div",{ref:n,className:"ga-log-tail-scroll",onScroll:l,children:s===null?i.jsx("p",{className:"ga-log-tail-empty",children:"…"}):s.length===0?i.jsx("p",{className:"ga-log-tail-empty",children:e}):i.jsx("pre",{className:"ga-log-tail-pre",children:s.map((g,m)=>i.jsxs("span",{className:g.startsWith("=====")?"ga-log-separator":void 0,children:[g,`
`]},m))})})]})}function Ce(s,e){Be.getState().notify({kind:e,message:s})}function W(s){Ce(s,"error")}function P(s){Ce(s,"success")}const et=3e3;function ze({serviceId:s,onClose:e}){const{t}=q(),n=z(c=>c.fetchLogs),[a,o]=u.useState(null),r=u.useRef(null),l=u.useCallback(async()=>{if(!s)return;const c=await n(s);o(c)},[s,n]);return u.useEffect(()=>(s&&(o(null),l(),r.current=setInterval(l,et)),()=>{r.current&&(clearInterval(r.current),r.current=null)}),[s,l]),i.jsx(fe,{title:t("modal.channelLogs"),visible:s!==null,onCancel:e,footer:null,width:870,centered:!0,closeOnEsc:!0,className:"ga-log-dialog",children:a===null?i.jsx("div",{className:"ga-services-loading",style:{padding:24},children:i.jsx(G,{})}):i.jsx(Je,{lines:a,emptyLabel:t("ch.logEmpty"),className:"ga-log-modal-body"})})}function tt({visible:s,onClose:e}){const{t}=q(),n=z(x=>x.fetchMykey),a=z(x=>x.saveMykey),o=z(x=>x.mykeyContent),r=z(x=>x.mykeyLoading),[l,c]=u.useState(""),[g,m]=u.useState(!1);u.useEffect(()=>{s&&n()},[s,n]),u.useEffect(()=>{c(o)},[o]);const w=async()=>{m(!0);const x=await a(l);m(!1),x?(P(t("sys.configSaved")),e()):W(t("err.mykeyExport"))};return i.jsx(fe,{title:t("modal.mykeyConfig"),visible:s,onCancel:e,width:870,centered:!0,closeOnEsc:!0,className:"ga-settings-dialog",footer:i.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end",padding:"8px 0"},children:[i.jsx(_,{onClick:e,children:t("common.cancel")}),i.jsx(_,{type:"primary",loading:g,onClick:w,children:t("common.save")})]}),children:r?i.jsx("div",{className:"ga-services-loading",children:i.jsx(G,{})}):i.jsx(Ge,{value:l,onChange:x=>c(x),autosize:{minRows:16,maxRows:30},style:{fontFamily:"var(--font-mono)",fontSize:13}})})}const st="data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eTencent%20QQ%3c/title%3e%3cpath%20d='M21.395%2015.035a40%2040%200%200%200-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526%204.632%2017.351%200%2012%200S4.474%204.632%204.474%209.241c0%20.274.013.804.014.836l-1.08%202.695a39%2039%200%200%200-.802%202.264c-1.021%203.283-.69%204.643-.438%204.673.54.065%202.103-2.472%202.103-2.472%200%201.469.756%203.387%202.394%204.771-.612.188-1.363.479-1.845.835-.434.32-.379.646-.301.778.343.578%205.883.369%207.482.189%201.6.18%207.14.389%207.483-.189.078-.132.132-.458-.301-.778-.483-.356-1.233-.646-1.846-.836%201.637-1.384%202.393-3.302%202.393-4.771%200%200%201.563%202.537%202.103%202.472.251-.03.581-1.39-.438-4.673'/%3e%3c/svg%3e",nt="data:image/svg+xml,%3csvg%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eWeChat%3c/title%3e%3cpath%20d='M8.691%202.188C3.891%202.188%200%205.476%200%209.53c0%202.212%201.17%204.203%203.002%205.55a.59.59%200%200%201%20.213.665l-.39%201.48c-.019.07-.048.141-.048.213%200%20.163.13.295.29.295a.326.326%200%200%200%20.167-.054l1.903-1.114a.864.864%200%200%201%20.717-.098%2010.16%2010.16%200%200%200%202.837.403c.276%200%20.543-.027.811-.05-.857-2.578.157-4.972%201.932-6.446%201.703-1.415%203.882-1.98%205.853-1.838-.576-3.583-4.196-6.348-8.596-6.348zM5.785%205.991c.642%200%201.162.529%201.162%201.18a1.17%201.17%200%200%201-1.162%201.178A1.17%201.17%200%200%201%204.623%207.17c0-.651.52-1.18%201.162-1.18zm5.813%200c.642%200%201.162.529%201.162%201.18a1.17%201.17%200%200%201-1.162%201.178%201.17%201.17%200%200%201-1.162-1.178c0-.651.52-1.18%201.162-1.18zm5.34%202.867c-1.797-.052-3.746.512-5.28%201.786-1.72%201.428-2.687%203.72-1.78%206.22.942%202.453%203.666%204.229%206.884%204.229.826%200%201.622-.12%202.361-.336a.722.722%200%200%201%20.598.082l1.584.926a.272.272%200%200%200%20.14.047c.134%200%20.24-.111.24-.247%200-.06-.023-.12-.038-.177l-.327-1.233a.582.582%200%200%201-.023-.156.49.49%200%200%201%20.201-.398C23.024%2018.48%2024%2016.82%2024%2014.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53%203.274c.535%200%20.969.44.969.982a.976.976%200%200%201-.969.983.976.976%200%200%201-.969-.983c0-.542.434-.982.97-.982zm4.844%200c.535%200%20.969.44.969.982a.976.976%200%200%201-.969.983.976.976%200%200%201-.969-.983c0-.542.434-.982.969-.982z'/%3e%3c/svg%3e",at="data:image/svg+xml,%3csvg%20width='46'%20height='46'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_338_13245)'%3e%3cpath%20d='M39.743%200H6.257A6.257%206.257%200%200%200%200%206.257v33.487A6.257%206.257%200%200%200%206.257%2046h33.487A6.257%206.257%200%200%200%2046%2039.743V6.257A6.257%206.257%200%200%200%2039.743%200'%20fill='%23fff'/%3e%3cmask%20id='mask0_338_13245'%20style='mask-type:luminance'%20maskUnits='userSpaceOnUse'%20x='5'%20y='8'%20width='36'%20height='30'%3e%3cpath%20d='M40.514%208.373H5.484v29.262h35.03z'%20fill='%23fff'/%3e%3c/mask%3e%3cg%20mask='url(%23mask0_338_13245)'%3e%3cpath%20d='M28.856%2031.647a.483.483%200%200%200%20.06.738%206.2%206.2%200%200%201%201.911%203.725%202.02%202.02%200%201%200%202.16-2.54%206.2%206.2%200%200%201-3.448-1.922.483.483%200%200%200-.683-.001'%20fill='%23fb Line truncated
-1
View File
@@ -1 +0,0 @@
import{b as s,aj as r}from"./tauri-compat-tfiFK9EG.js";import{M as o,S as m,r as t,a as e,b as n,p}from"./markdown-preprocess-Bvg4n8KE.js";import{S as i,U as c}from"./main-Knf6L_en.js";import"./index-Bpi3BHKj.js";import"./WindowsTitlebar-CrkUa1UM.js";const u={...c},O=s.memo(function({content:a}){return r.jsx("div",{"data-slot":"summary-block",children:r.jsx(o,{remarkPlugins:[e,n],rehypePlugins:[[t,u]],components:m,urlTransform:i,children:p(a)})})});export{O as SummaryPart};
+1
View File
@@ -0,0 +1 @@
import{b as s,aj as r}from"./tauri-compat-D_GD_wMe.js";import{M as o,S as m,r as t,a as e,b as n,p}from"./markdown-preprocess-Cc2i34eF.js";import{U as i,V as c}from"./main-j7e_THPB.js";import"./index-9FI8Jlf5.js";import"./WindowsTitlebar-Byi-SYR_.js";const u={...c},O=s.memo(function({content:a}){return r.jsx("div",{"data-slot":"summary-block",children:r.jsx(o,{remarkPlugins:[e,n],rehypePlugins:[[t,u]],components:m,urlTransform:i,children:p(a)})})});export{O as SummaryPart};
@@ -1,2 +1,2 @@
import{aA as F,aB as L,aC as ee,aD as ze,aE as Xe,aF as wt,aG as Vr,c as Dt,b as J,aH as Br,aI as Gr,B,d as Yi,e as Li,x as $i,aJ as Hi,g as ia,aK as Ui,_ as st,f as He,ae as Be,w as qi,i as Wi,aL as De,N as oe,j as ji,R as b,k as Ue,l as Y,P as p,q as We,h as Q,aM as Vi,aN as Bi,M as K,aO as Gi,aP as zi,ay as Xi,X as zr,T as Zi,O as Xr,s as Qi,aQ as Ki,ax as Ji,aj as A}from"./tauri-compat-tfiFK9EG.js";import{_ as es,c as M,V as ts,i as Sn,d as ns,e as Et,I as Zr,f as as,r as rs,g as rt,h as Un,j as Qn,k as is,l as ss,T as os,a as us,b as Ta}from"./index-DwVcZP0M.js";import{s as Qr,a as Kr,F as gt,I as ls,j as cs,k as ds,B as Jr,C as fs,l as hs,m as wa,b as lt,n as ps,T as ms,E as ei,g as gs}from"./main-Knf6L_en.js";import{a as pt,B as yt}from"./index-Bpi3BHKj.js";import{A as vs}from"./Animation-TKQfYYOo.js";import{B as Da}from"./index-DpGuh58E.js";import{S as ys}from"./index-D_sWIqse.js";import"./WindowsTitlebar-CrkUa1UM.js";function Le(s,e){F(2,arguments);var t=L(s),n=ee(e);if(isNaN(n))return new Date(NaN);if(!n)return t;var a=t.getDate(),i=new Date(t.getTime());i.setMonth(t.getMonth()+n+1,0);var r=i.getDate();return a>=r?i:(t.setFullYear(i.getFullYear(),i.getMonth(),a),t)}function Ts(s,e){F(2,arguments);var t=L(s).getTime(),n=ee(e);return new Date(t+n)}function ti(s){var e=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return e.setUTCFullYear(s.getFullYear()),s.getTime()-e.getTime()}function Kn(s){F(1,arguments);var e=L(s);return e.setHours(0,0,0,0),e}function xn(s,e){F(2,arguments);var t=ee(e);return Le(s,t*12)}var sa=6e4,oa=36e5,ws=1e3;function ua(s,e){F(2,arguments);var t=Kn(s),n=Kn(e);return t.getTime()===n.getTime()}function Jn(s){return F(1,arguments),s instanceof Date||ze(s)==="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Ce(s){if(F(1,arguments),!Jn(s)&&typeof s!="number")return!1;var e=L(s);return!isNaN(Number(e))}function je(s,e){F(2,arguments);var t=L(s),n=L(e),a=t.getFullYear()-n.getFullYear(),i=t.getMonth()-n.getMonth();return a*12+i}function Ds(s,e){F(2,arguments);var t=L(s),n=L(e);return t.getFullYear()-n.getFullYear()}function bs(s){F(1,arguments);var e=L(s);return e.setDate(1),e.setHours(0,0,0,0),e}function ni(s,e){F(2,arguments);var t=ee(e);return Ts(s,-t)}var _s=864e5;function Cs(s){F(1,arguments);var e=L(s),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),a=t-n;return Math.floor(a/_s)+1}function ot(s){F(1,arguments);var e=1,t=L(s),n=t.getUTCDay(),a=(n<e?7:0)+n-e;return t.setUTCDate(t.getUTCDate()-a),t.setUTCHours(0,0,0,0),t}function ai(s){F(1,arguments);var e=L(s),t=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var a=ot(n),i=new Date(0);i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0);var r=ot(i);return e.getTime()>=a.getTime()?t+1:e.getTime()>=r.getTime()?t:t-1}function Is(s){F(1,arguments);var e=ai(s),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var n=ot(t);return n}var Rs=6048e5;function ri(s){F(1,arguments);var e=L(s),t=ot(e).getTime()-Is(e).getTime();return Math.round(t/Rs)+1}function la(s,e){var t,n,a,i,r,u,o,l;F(1,arguments);var c=L(s),d=c.getUTCFullYear(),f=wt(),h=ee((t=(n=(a=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(r=e.locale)===null||r===void 0||(u=r.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:f.firstWeekContainsDate)!==null&&n!==void 0?n:(o=f.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&t!==void 0?t:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=new Date(0);v.setUTCFullYear(d+1,0,h),v.setUTCHours(0,0,0,0);var w=Xe(v,e),m=new Date(0);m.setUTCFullYear(d,0,h),m.setUTCHours(0,0,0,0);var g=Xe(m,e);return c.getTime()>=w.getTime()?d+1:c.getTime()>=g.getTime()?d:d-1}function Ps(s,e){var t,n,a,i,r,u,o,l;F(1,arguments);var c=wt(),d=ee((t=(n=(a=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(r=e.locale)===null||r===void 0||(u=r.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:c.firstWeekContainsDate)!==null&&n!==void 0?n:(o=c.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&t!==void 0?t:1),f=la(s,e),h=new Date(0);h.setUTCFullYear(f,0,d),h.setUTCHours(0,0,0,0);var v=Xe(h,e);return v}var Es=6048e5;function ii(s,e){F(1,arguments);var t=L(s),n=Xe(t,e).getTime()-Ps(t,e).getTime();return Math.round(n/Es)+1}function z(s,e){for(var t=s<0?"-":"",n=Math.abs(s).toString();n.length<e;)n="0"+n;return t+n}var Fe={y:function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return z(t==="yy"?a%100:a,t.length)},M:function(e,t){var n=e.getUTCMonth();return t==="M"?String(n+1):z(n+1,2)},d:function(e,t){return z(e.getUTCDate(),t.length)},a:function(e,t){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aLine truncated
import{aA as F,aB as L,aC as ee,aD as ze,aE as Xe,aF as wt,aG as Vr,c as Dt,b as J,aH as Br,aI as Gr,B,d as Yi,e as Li,x as $i,aJ as Hi,g as ia,aK as Ui,_ as st,f as He,ae as Be,w as qi,i as Wi,aL as De,N as oe,j as ji,R as b,k as Ue,l as Y,P as p,q as We,h as Q,aM as Vi,aN as Bi,M as K,aO as Gi,aP as zi,ay as Xi,X as zr,T as Zi,O as Xr,s as Qi,aQ as Ki,ax as Ji,aj as A}from"./tauri-compat-D_GD_wMe.js";import{_ as es,c as M,V as ts,i as Sn,d as ns,e as Et,I as Zr,f as as,r as rs,g as rt,h as Un,j as Qn,k as is,l as ss,T as os,a as us,b as Ta}from"./index-BkPDmlaQ.js";import{s as Qr,a as Kr,F as gt,I as ls,j as cs,k as ds,B as Jr,C as fs,l as hs,m as wa,b as lt,n as ps,T as ms,E as ei,g as gs}from"./main-j7e_THPB.js";import{a as pt,B as yt}from"./index-9FI8Jlf5.js";import{A as vs}from"./Animation-DbFrgT1j.js";import{B as Da}from"./index-C-iCGtYr.js";import{S as ys}from"./index-D9Nakaf3.js";import"./WindowsTitlebar-Byi-SYR_.js";function Le(s,e){F(2,arguments);var t=L(s),n=ee(e);if(isNaN(n))return new Date(NaN);if(!n)return t;var a=t.getDate(),i=new Date(t.getTime());i.setMonth(t.getMonth()+n+1,0);var r=i.getDate();return a>=r?i:(t.setFullYear(i.getFullYear(),i.getMonth(),a),t)}function Ts(s,e){F(2,arguments);var t=L(s).getTime(),n=ee(e);return new Date(t+n)}function ti(s){var e=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return e.setUTCFullYear(s.getFullYear()),s.getTime()-e.getTime()}function Kn(s){F(1,arguments);var e=L(s);return e.setHours(0,0,0,0),e}function xn(s,e){F(2,arguments);var t=ee(e);return Le(s,t*12)}var sa=6e4,oa=36e5,ws=1e3;function ua(s,e){F(2,arguments);var t=Kn(s),n=Kn(e);return t.getTime()===n.getTime()}function Jn(s){return F(1,arguments),s instanceof Date||ze(s)==="object"&&Object.prototype.toString.call(s)==="[object Date]"}function Ce(s){if(F(1,arguments),!Jn(s)&&typeof s!="number")return!1;var e=L(s);return!isNaN(Number(e))}function je(s,e){F(2,arguments);var t=L(s),n=L(e),a=t.getFullYear()-n.getFullYear(),i=t.getMonth()-n.getMonth();return a*12+i}function Ds(s,e){F(2,arguments);var t=L(s),n=L(e);return t.getFullYear()-n.getFullYear()}function bs(s){F(1,arguments);var e=L(s);return e.setDate(1),e.setHours(0,0,0,0),e}function ni(s,e){F(2,arguments);var t=ee(e);return Ts(s,-t)}var _s=864e5;function Cs(s){F(1,arguments);var e=L(s),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var n=e.getTime(),a=t-n;return Math.floor(a/_s)+1}function ot(s){F(1,arguments);var e=1,t=L(s),n=t.getUTCDay(),a=(n<e?7:0)+n-e;return t.setUTCDate(t.getUTCDate()-a),t.setUTCHours(0,0,0,0),t}function ai(s){F(1,arguments);var e=L(s),t=e.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var a=ot(n),i=new Date(0);i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0);var r=ot(i);return e.getTime()>=a.getTime()?t+1:e.getTime()>=r.getTime()?t:t-1}function Is(s){F(1,arguments);var e=ai(s),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var n=ot(t);return n}var Rs=6048e5;function ri(s){F(1,arguments);var e=L(s),t=ot(e).getTime()-Is(e).getTime();return Math.round(t/Rs)+1}function la(s,e){var t,n,a,i,r,u,o,l;F(1,arguments);var c=L(s),d=c.getUTCFullYear(),f=wt(),h=ee((t=(n=(a=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(r=e.locale)===null||r===void 0||(u=r.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:f.firstWeekContainsDate)!==null&&n!==void 0?n:(o=f.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&t!==void 0?t:1);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var v=new Date(0);v.setUTCFullYear(d+1,0,h),v.setUTCHours(0,0,0,0);var w=Xe(v,e),m=new Date(0);m.setUTCFullYear(d,0,h),m.setUTCHours(0,0,0,0);var g=Xe(m,e);return c.getTime()>=w.getTime()?d+1:c.getTime()>=g.getTime()?d:d-1}function Ps(s,e){var t,n,a,i,r,u,o,l;F(1,arguments);var c=wt(),d=ee((t=(n=(a=(i=e==null?void 0:e.firstWeekContainsDate)!==null&&i!==void 0?i:e==null||(r=e.locale)===null||r===void 0||(u=r.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&a!==void 0?a:c.firstWeekContainsDate)!==null&&n!==void 0?n:(o=c.locale)===null||o===void 0||(l=o.options)===null||l===void 0?void 0:l.firstWeekContainsDate)!==null&&t!==void 0?t:1),f=la(s,e),h=new Date(0);h.setUTCFullYear(f,0,d),h.setUTCHours(0,0,0,0);var v=Xe(h,e);return v}var Es=6048e5;function ii(s,e){F(1,arguments);var t=L(s),n=Xe(t,e).getTime()-Ps(t,e).getTime();return Math.round(n/Es)+1}function z(s,e){for(var t=s<0?"-":"",n=Math.abs(s).toString();n.length<e;)n="0"+n;return t+n}var Fe={y:function(e,t){var n=e.getUTCFullYear(),a=n>0?n:1-n;return z(t==="yy"?a%100:a,t.length)},M:function(e,t){var n=e.getUTCMonth();return t==="M"?String(n+1):z(n+1,2)},d:function(e,t){return z(e.getUTCDate(),t.length)},a:function(e,t){var n=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aLine truncated
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,r=!0,u=!1;return{s:function(){t=t.call(s)},n:function(){var l=t.next();return r=l.done,l},e:function(l){u=!0,i=l},f:function(){try{r||t.return==null||t.return()}finally{if(u)throw i}}}}function q(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),e&&es(s,e)}function Nn(s){return Nn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},Nn(s)}function di(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(di=function(){return!!s})()}function Ws(s,e){if(e&&(ze(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return M(s)}function W(s){var e=di();return function(){var t,n=Nn(s);if(e){var a=Nn(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return Ws(this,t)}}function $(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function js(s,e){if(ze(s)!="object"||!s)return s;var t=s[Symbol.toPrimitive];if(t!==void 0){var n=t.call(s,e);if(ze(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(s)}function fi(s){var e=js(s,"string");return ze(e)=="symbol"?e:e+""}function Vs(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,fi(n.key),n)}}function H(s,e,t){return e&&Vs(s.prototype,e),Object.defineProperty(s,"prototype",{writable:!1}),s}function S(s,e,t){return(e=fi(e))in s?Object.defineProperty(s,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):s[e]=t,s}var Bs=10,hi=(function(){function s(){$(this,s),S(this,"priority",void 0),S(this,"subPriority",0)}return H(s,[{key:"validate",value:function(t,n){return!0}}]),s})(),Gs=(function(s){q(t,s);var e=W(t);function t(n,a,i,r,u){var o;return $(this,t),o=e.call(this),o.value=n,o.validateValue=a,o.setValue=i,o.priority=r,u&&(o.subPriority=u),o}return H(t,[{key:"validate",value:function(a,i){return this.validateValue(a,this.value,i)}},{key:"set",value:function(a,i,r){return this.setValue(a,i,this.value,r)}}]),t})(hi),zs=(function(s){q(t,s);var e=W(t);function t(){var n;$(this,t);for(var a=arguments.length,i=new Array(a),r=0;r<a;r++)i[r]=arguments[r];return n=e.call.apply(e,[this].concat(i)),S(M(n),"priority",Bs),S(M(n),"subPriority",-1),n}return H(t,[{key:"set",value:function(a,i){if(i.timestampIsSet)return a;var r=new Date(0);return r.setFullYear(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate()),r.setHours(a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()),r}}]),t})(hi),j=(function(){function s(){$(this,s),S(this,"incompatibleTokens",void 0),S(this,"priority",void 0),S(this,"subPriority",void 0)}return H(s,[{key:"run",value:function(t,n,a,i){var r=this.parse(t,n,a,i);return r?{setter:new Gs(r.value,this.validate,this.set,this.priority,this.subPriority),rest:r.rest}:null}},{key:"validate",value:function(t,n,a){return!0}}]),s})(),Xs=(function(s){q(t,s);var e=W(t);function t(){var n;$(this,t);for(var a=arguments.length,i=new Array(a),r=0;r<a;r++)i[r]=arguments[r];return n=e.call.apply(e,[this].concat(i)),S(M(n),"priority",140),S(M(n),"incompatibleTokens",["R","u","t","T"]),n}return H(t,[{key:"parse",value:function(a,i,r){switch(i){case"G":case"GG":case"GGG":return r.era(a,{width:"abbreviated"})||r.era(a,{width:"narrow"});case"GGGGG":return r.era(a,{width:"narrow"});case"GGGG":default:return r.era(a,{width:"wide"})||r.era(a,{width:"abbreviated"})||r.era(a,{width:"narrow"})}}},{key:"set",value:function(a,i,r){return i.era=r,a.setUTCFullYear(r,0,1),a.setUTCHours(0,0,0,0),a}}]),t})(j),ue={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Ee={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function le(s,e){return s&&{value:e(s.value),rest:s.rest}}function ae(s,e){var t=e.match(s);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function Oe(s,e){var t=e.match(s);if(!t)return null;if(t[0]==="Z")return{value:0,rest: Line truncated
@@ -1 +1 @@
import{aj as t}from"./tauri-compat-tfiFK9EG.js";function d(){var n,e,o;const i=(o=(e=(n=window.__TAURI__)==null?void 0:n.window)==null?void 0:e.getCurrentWindow)==null?void 0:o.call(e);return i?t.jsxs("div",{className:"ga-win-controls","data-no-drag":!0,children:[t.jsx("button",{type:"button",className:"ga-win-btn",onClick:()=>i.minimize(),"aria-label":"Minimize",children:t.jsx("svg",{width:"10",height:"1",viewBox:"0 0 10 1",children:t.jsx("rect",{fill:"currentColor",width:"10",height:"1"})})}),t.jsx("button",{type:"button",className:"ga-win-btn",onClick:()=>i.toggleMaximize(),"aria-label":"Maximize",children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:t.jsx("rect",{x:"0.5",y:"0.5",width:"9",height:"9",stroke:"currentColor",strokeWidth:"1"})})}),t.jsx("button",{type:"button",className:"ga-win-btn ga-win-btn--close",onClick:()=>i.close(),"aria-label":"Close",children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",children:t.jsx("path",{d:"M1 1l8 8M9 1l-8 8",stroke:"currentColor",strokeWidth:"1.2"})})})]}):null}function c(){const i=n=>{var o,r,s,a,l;n.button!==0||n.target.closest("button, a, input, [data-no-drag]")||(n.preventDefault(),(l=(a=(s=(r=(o=window.__TAURI__)==null?void 0:o.window)==null?void 0:r.getCurrentWindow)==null?void 0:s.call(r))==null?void 0:a.startDragging)==null||l.call(a))};return t.jsx("div",{className:"ga-win-titlebar","data-testid":"windows-titlebar",onMouseDown:i,children:t.jsx(d,{})})}export{c as W};
import{aj as t}from"./tauri-compat-D_GD_wMe.js";function d(){var n,e,o;const i=(o=(e=(n=window.__TAURI__)==null?void 0:n.window)==null?void 0:e.getCurrentWindow)==null?void 0:o.call(e);return i?t.jsxs("div",{className:"ga-win-controls","data-no-drag":!0,children:[t.jsx("button",{type:"button",className:"ga-win-btn",onClick:()=>i.minimize(),"aria-label":"Minimize",children:t.jsx("svg",{width:"10",height:"1",viewBox:"0 0 10 1",children:t.jsx("rect",{fill:"currentColor",width:"10",height:"1"})})}),t.jsx("button",{type:"button",className:"ga-win-btn",onClick:()=>i.toggleMaximize(),"aria-label":"Maximize",children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",children:t.jsx("rect",{x:"0.5",y:"0.5",width:"9",height:"9",stroke:"currentColor",strokeWidth:"1"})})}),t.jsx("button",{type:"button",className:"ga-win-btn ga-win-btn--close",onClick:()=>i.close(),"aria-label":"Close",children:t.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",children:t.jsx("path",{d:"M1 1l8 8M9 1l-8 8",stroke:"currentColor",strokeWidth:"1.2"})})})]}):null}function c(){const i=n=>{var o,r,s,a,l;n.button!==0||n.target.closest("button, a, input, [data-no-drag]")||(n.preventDefault(),(l=(a=(s=(r=(o=window.__TAURI__)==null?void 0:o.window)==null?void 0:r.getCurrentWindow)==null?void 0:s.call(r))==null?void 0:a.startDragging)==null||l.call(a))};return t.jsx("div",{className:"ga-win-titlebar","data-testid":"windows-titlebar",onMouseDown:i,children:t.jsx(d,{})})}export{c as W};
@@ -1 +1 @@
import{c as I,b as a,B as R,V as F,l as j,R as i,q as $,P as n,aw as Z,h as N,s as D}from"./tauri-compat-tfiFK9EG.js";function U(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{prefix:o="",length:s=7}=t,e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ",l=e.length;let g="";for(let m=0;m<s;m++){const c=Math.floor(Math.random()*l);g+=e.charAt(c)}return o?`${o}-${g}`:g}function H(t,o){if(typeof t=="string")return new Array(o).fill(t);if(Array.isArray(t)){const s=t.length;let e=t;if(s<o){let l=0;for(e=[];l<o;)e.push(t[l%s]),l++;return e}else s>o&&(e=t.slice(0,o));return e.reverse()}return["rgba(233,69,255)","rgba(166,71,255)","rgba(107,97,255)","rgba(46,140,255)"]}var X=function(t,o){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&o.indexOf(e)<0&&(s[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,e=Object.getOwnPropertySymbols(t);l<e.length;l++)o.indexOf(e[l])<0&&Object.prototype.propertyIsEnumerable.call(t,e[l])&&(s[e[l]]=t[e[l]]);return s};function G(t){const{fill:o}=t,s=X(t,["fill"]),e=U({prefix:"semi-ai-loading"}),[l,g,m,c]=H(o,4);return a.createElement("svg",Object.assign({viewBox:"0 0 16 16",width:"1em",height:"1em",fill:"none",xmlns:"http://www.w3.org/2000/svg",focusable:!1,"aria-hidden":!0},s),a.createElement("path",{d:"M15.1112 7.99978C15.1112 4.07242 11.9275 0.888672 8.00009 0.888672C5.18219 0.888672 2.74711 2.52771 1.59619 4.90445",stroke:`url(#${e})`,strokeWidth:"1.77778",strokeLinecap:"round"}),a.createElement("defs",null,a.createElement("linearGradient",{id:e,x1:"16",y1:"8",x2:"2.68594",y2:"11.022",gradientUnits:"userSpaceOnUse"},a.createElement("stop",{stopColor:l}),a.createElement("stop",{offset:"0.3",stopColor:g}),a.createElement("stop",{offset:"0.6",stopColor:m}),a.createElement("stop",{offset:"1",stopColor:c,stopOpacity:"0"}))))}const V=I(G,"ai_loading");function q(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m10.23 2.4-8.7 16.67A2 2 0 0 0 3.3 22h17.4a2 2 0 0 0 1.77-2.93L13.77 2.4a2 2 0 0 0-3.54 0ZM13.14 14a1.15 1.15 0 0 1-2.28 0l-.58-4.03a1.73 1.73 0 1 1 3.44 0l-.58 4.03Zm.36 4.49a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",fill:"currentColor"}))}const se=I(q,"alert_triangle");function W(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{d:"M17.66 19.78a1.5 1.5 0 0 0 2.12-2.12L14.12 12l5.66-5.66a1.5 1.5 0 0 0-2.12-2.12L12 9.88 6.34 4.22a1.5 1.5 0 1 0-2.12 2.12L9.88 12l-5.66 5.66a1.5 1.5 0 0 0 2.12 2.12L12 14.12l5.66 5.66Z",fill:"currentColor"}))}const re=I(W,"close");function K(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm2-16a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-5 3.75c0-.41.34-.75.75-.75h2.75a1 1 0 0 1 1 1v5.5h.75a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5h.75v-5h-.75a.75.75 0 0 1-.75-.75Z",fill:"currentColor"}))}const ie=I(K,"info_circle"),B={PREFIX:`${R}-button`},w={sizes:["default","small","large"],iconPositions:["left","right"],htmlTypes:["button","reset","submit"],btnTypes:["primary","secondary","tertiary","warning","danger"],themes:["solid","borderless","light","outline"],DEFAULT_ICON_POSITION:"left"},Q={SIZE:["extra-small","small","default","large","extra-large","custom"]};var Y=function(t,o){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&o.indexOf(e)<0&&(s[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,e=Object.getOwnPropertySymbols(t);l<e.length;l++)o.indexOf(e[l])<0&&Object.prototype.propertyIsEnumerable.call(t,e[l])&&(s[e[l]]=t[e[l]]);return s};const J=w.sizes,{htmlTypes:ee,btnTypes:te}=w;let E=class extends a.PureComponent{render(){const o=this.props,{children:s,block:e,htmlType:l,loading:g,circle:m,className:c,style:f,disabled:p,size:P,theme:u,type:h,colorful:C,prefixCls:r,iconPosition:T}=o,y=Y(o,["children","block","htmlType","loading","circle","className","style","disabled","size","theme","type","colorful","prefixCls","iconPosition"]),S=Object.assign(Object.assign({disabled:p},F(y,["x-semi-children-alias"])),{className:j(r,{[`${r}-${h}`]:!p&&h,[`${r}-disabled`]:p,[`${r}-size-large`]:P==="large",[`${r}-size-small`]:P==="small",[`${r}-block`]:e,[`${r}-circle`]:m,[`${r}-${u}`]:u,[`${r}-${h}-disabled`]:p&&h,[`${r}-colorful`]:C},c),type:l,"aria-disabled":p}),O={};return c&&c.includes("-with-icon")||(O["x-semi-prop"]=this.props["x-semi-children-alias"]||"children"),i.createElement("button",Object.assign({},S,{onClick:this.props.onClick,onMouseDown:this.props.onMouseDown,style:f}),i.creaLine truncated
import{c as I,b as a,B as R,V as F,l as j,R as i,q as $,P as n,aw as Z,h as N,s as D}from"./tauri-compat-D_GD_wMe.js";function U(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{prefix:o="",length:s=7}=t,e="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ",l=e.length;let g="";for(let m=0;m<s;m++){const c=Math.floor(Math.random()*l);g+=e.charAt(c)}return o?`${o}-${g}`:g}function H(t,o){if(typeof t=="string")return new Array(o).fill(t);if(Array.isArray(t)){const s=t.length;let e=t;if(s<o){let l=0;for(e=[];l<o;)e.push(t[l%s]),l++;return e}else s>o&&(e=t.slice(0,o));return e.reverse()}return["rgba(233,69,255)","rgba(166,71,255)","rgba(107,97,255)","rgba(46,140,255)"]}var X=function(t,o){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&o.indexOf(e)<0&&(s[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,e=Object.getOwnPropertySymbols(t);l<e.length;l++)o.indexOf(e[l])<0&&Object.prototype.propertyIsEnumerable.call(t,e[l])&&(s[e[l]]=t[e[l]]);return s};function G(t){const{fill:o}=t,s=X(t,["fill"]),e=U({prefix:"semi-ai-loading"}),[l,g,m,c]=H(o,4);return a.createElement("svg",Object.assign({viewBox:"0 0 16 16",width:"1em",height:"1em",fill:"none",xmlns:"http://www.w3.org/2000/svg",focusable:!1,"aria-hidden":!0},s),a.createElement("path",{d:"M15.1112 7.99978C15.1112 4.07242 11.9275 0.888672 8.00009 0.888672C5.18219 0.888672 2.74711 2.52771 1.59619 4.90445",stroke:`url(#${e})`,strokeWidth:"1.77778",strokeLinecap:"round"}),a.createElement("defs",null,a.createElement("linearGradient",{id:e,x1:"16",y1:"8",x2:"2.68594",y2:"11.022",gradientUnits:"userSpaceOnUse"},a.createElement("stop",{stopColor:l}),a.createElement("stop",{offset:"0.3",stopColor:g}),a.createElement("stop",{offset:"0.6",stopColor:m}),a.createElement("stop",{offset:"1",stopColor:c,stopOpacity:"0"}))))}const V=I(G,"ai_loading");function q(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m10.23 2.4-8.7 16.67A2 2 0 0 0 3.3 22h17.4a2 2 0 0 0 1.77-2.93L13.77 2.4a2 2 0 0 0-3.54 0ZM13.14 14a1.15 1.15 0 0 1-2.28 0l-.58-4.03a1.73 1.73 0 1 1 3.44 0l-.58 4.03Zm.36 4.49a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z",fill:"currentColor"}))}const se=I(q,"alert_triangle");function W(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{d:"M17.66 19.78a1.5 1.5 0 0 0 2.12-2.12L14.12 12l5.66-5.66a1.5 1.5 0 0 0-2.12-2.12L12 9.88 6.34 4.22a1.5 1.5 0 1 0-2.12 2.12L9.88 12l-5.66 5.66a1.5 1.5 0 0 0 2.12 2.12L12 14.12l5.66 5.66Z",fill:"currentColor"}))}const re=I(W,"close");function K(t){return a.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 23a11 11 0 1 0 0-22 11 11 0 0 0 0 22Zm2-16a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm-5 3.75c0-.41.34-.75.75-.75h2.75a1 1 0 0 1 1 1v5.5h.75a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5h.75v-5h-.75a.75.75 0 0 1-.75-.75Z",fill:"currentColor"}))}const ie=I(K,"info_circle"),B={PREFIX:`${R}-button`},w={sizes:["default","small","large"],iconPositions:["left","right"],htmlTypes:["button","reset","submit"],btnTypes:["primary","secondary","tertiary","warning","danger"],themes:["solid","borderless","light","outline"],DEFAULT_ICON_POSITION:"left"},Q={SIZE:["extra-small","small","default","large","extra-large","custom"]};var Y=function(t,o){var s={};for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&o.indexOf(e)<0&&(s[e]=t[e]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,e=Object.getOwnPropertySymbols(t);l<e.length;l++)o.indexOf(e[l])<0&&Object.prototype.propertyIsEnumerable.call(t,e[l])&&(s[e[l]]=t[e[l]]);return s};const J=w.sizes,{htmlTypes:ee,btnTypes:te}=w;let E=class extends a.PureComponent{render(){const o=this.props,{children:s,block:e,htmlType:l,loading:g,circle:m,className:c,style:f,disabled:p,size:P,theme:u,type:h,colorful:C,prefixCls:r,iconPosition:T}=o,y=Y(o,["children","block","htmlType","loading","circle","className","style","disabled","size","theme","type","colorful","prefixCls","iconPosition"]),S=Object.assign(Object.assign({disabled:p},F(y,["x-semi-children-alias"])),{className:j(r,{[`${r}-${h}`]:!p&&h,[`${r}-disabled`]:p,[`${r}-size-large`]:P==="large",[`${r}-size-small`]:P==="small",[`${r}-block`]:e,[`${r}-circle`]:m,[`${r}-${u}`]:u,[`${r}-${h}-disabled`]:p&&h,[`${r}-colorful`]:C},c),type:l,"aria-disabled":p}),O={};return c&&c.includes("-with-icon")||(O["x-semi-prop"]=this.props["x-semi-children-alias"]||"children"),i.createElement("button",Object.assign({},S,{onClick:this.props.onClick,onMouseDown:this.props.onMouseDown,style:f}),i.creaLine truncated
@@ -1,4 +1,4 @@
import{g as te,C as _t,c as Oe,b as L,R as b,P as a,B as X,f as ge,i as Ce,l as M,au as qt,aR as va,ad as Ca,aS as Gt,aT as Qo,aU as Jo,K as ei,L as _a,D as Oa,aV as ti,aW as Ra,aX as Ea,aY as ni,v as xa,y as Ta,N as x,aZ as Ps,n as ft,w as $e,a_ as Yt,h as H,k as he,o as jt,aL as re,a$ as Ia,b0 as As,a as Pa,u as si,b1 as Aa,b2 as Da,b3 as ri,G as oi,b4 as Na,b5 as Ds,t as ii,b6 as Ns,b7 as ai,b8 as ka,b9 as li,M as La,_ as ue,az as Pt,s as ks,a0 as Ma,V as ye,J as je,p as Et,E as ja,ae as Xt,aQ as yt,X as Ee,aa as za,ba as Fa,bb as Ka,bc as $a,bd as Ba,m as hr,O as Ls,aH as ci,ag as Ms,be as Ha,bf as Wa,bg as le,bh as Ua,x as di,A as Va,bi as Zt,ax as Ne,bj as qa,bk as we,ab as ui,Y as hi,j as Ae,bl as Ga,bm as Ya,d as Xa,e as Za,aJ as Qa,bn as Ja,H as el,bo as St,bp as pr,bq as zt,br as tl}from"./tauri-compat-tfiFK9EG.js";import{_ as gt,r as nl,o as pi,p as sl,q as rl,v as ol,w as il,x as fi,y as al,T as mt,z as gi,F as fr,I as ll,A as cl,D as gr,G as Fe,R as dl,a as Re,j as ul}from"./main-Knf6L_en.js";import{S as mi}from"./index-D_sWIqse.js";import{B as Ft,I as hl}from"./index-Bpi3BHKj.js";const pl=["default","error","warning","success"];var fl=_t();const gl=te(fl);function mr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _s(i,e){return _s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},_s(i,e)}function ml(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m17.55 15.66-4.8 5.48a1 1 0 0 1-1.5 0l-4.8-5.48A1 1 0 0 1 7.2 14h9.6a1 1 0 0 1 .75 1.66Z",fill:"currentColor"}))}const bl=Oe(ml,"caretdown");function yl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m6.45 8.34 4.8-5.48a1 1 0 0 1 1.5 0l4.8 5.48A1 1 0 0 1 16.8 10H7.2a1 1 0 0 1-.75-1.66Z",fill:"currentColor"}))}const Sl=Oe(yl,"caretup");function wl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"M5 12.5c0-.83.67-1.5 1.5-1.5h11a1.5 1.5 0 0 1 0 3h-11A1.5 1.5 0 0 1 5 12.5Z",fill:"currentColor"}))}const vl=Oe(wl,"checkbox_indeterminate");function Cl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.41 7.3c.66.51.78 1.45.28 2.11l-6.5 8.5a1.5 1.5 0 0 1-2.37.01l-3.5-4.5a1.5 1.5 0 1 1 2.36-1.84L10 14.54l5.32-6.95a1.5 1.5 0 0 1 2.1-.28Z",fill:"currentColor"}))}const _l=Oe(Cl,"checkbox_tick");function Ol(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.28 4.24a1.5 1.5 0 0 1 0 2.12l-5.66 5.66 5.66 5.65a1.5 1.5 0 1 1-2.12 2.13l-6.72-6.72a1.5 1.5 0 0 1 0-2.12l6.72-6.72a1.5 1.5 0 0 1 2.12 0Z",fill:"currentColor"}))}const bi=Oe(Ol,"chevron_left");function Rl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.44 19.8a1.5 1.5 0 0 1 0-2.13l5.66-5.65-5.66-5.66a1.5 1.5 0 1 1 2.12-2.12l6.72 6.72a1.5 1.5 0 0 1 0 2.12L9.56 19.8a1.5 1.5 0 0 1-2.12 0Z",fill:"currentColor"}))}const js=Oe(Rl,"chevron_right");function El(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.1 2.58A1 1 0 0 1 2 2h20a1 1 0 0 1 .76 1.65l-8.2 9.18V21a1 1 0 0 1-1.44.9l-3.07-2a1 1 0 0 1-.55-.9v-6.17L1.24 3.65a1 1 0 0 1-.15-1.07Z",fill:"currentColor"}))}const xl=Oe(El,"filter");function Tl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5 2a8.5 8.5 0 1 0 4.86 15.48l4.08 4.08a1.5 1.5 0 1 0 2.12-2.12l-4.08-4.08A8.5 8.5 0 0 0 10.5 2ZM5 10.5a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",fill:"currentColor"}))}const Il=Oe(Tl,"search");function Pl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m20.56 9.66-7.8 8.97a1 1 0 0 1-1.51 0L3.44 9.66A1 1 0 0 1 4.19 8h15.62a1 1 0 Line truncated
import{g as te,C as _t,c as Oe,b as L,R as b,P as a,B as X,f as ge,i as Ce,l as M,au as qt,aR as va,ad as Ca,aS as Gt,aT as Qo,aU as Jo,K as ei,L as _a,D as Oa,aV as ti,aW as Ra,aX as Ea,aY as ni,v as xa,y as Ta,N as x,aZ as Ps,n as ft,w as $e,a_ as Yt,h as H,k as he,o as jt,aL as re,a$ as Ia,b0 as As,a as Pa,u as si,b1 as Aa,b2 as Da,b3 as ri,G as oi,b4 as Na,b5 as Ds,t as ii,b6 as Ns,b7 as ai,b8 as ka,b9 as li,M as La,_ as ue,az as Pt,s as ks,a0 as Ma,V as ye,J as je,p as Et,E as ja,ae as Xt,aQ as yt,X as Ee,aa as za,ba as Fa,bb as Ka,bc as $a,bd as Ba,m as hr,O as Ls,aH as ci,ag as Ms,be as Ha,bf as Wa,bg as le,bh as Ua,x as di,A as Va,bi as Zt,ax as Ne,bj as qa,bk as we,ab as ui,Y as hi,j as Ae,bl as Ga,bm as Ya,d as Xa,e as Za,aJ as Qa,bn as Ja,H as el,bo as St,bp as pr,bq as zt,br as tl}from"./tauri-compat-D_GD_wMe.js";import{_ as gt,r as nl,o as pi,p as sl,q as rl,v as ol,w as il,x as fi,y as al,T as mt,z as gi,F as fr,I as ll,A as cl,D as gr,G as Fe,R as dl,a as Re,j as ul}from"./main-j7e_THPB.js";import{S as mi}from"./index-D9Nakaf3.js";import{B as Ft,I as hl}from"./index-9FI8Jlf5.js";const pl=["default","error","warning","success"];var fl=_t();const gl=te(fl);function mr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function _s(i,e){return _s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},_s(i,e)}function ml(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m17.55 15.66-4.8 5.48a1 1 0 0 1-1.5 0l-4.8-5.48A1 1 0 0 1 7.2 14h9.6a1 1 0 0 1 .75 1.66Z",fill:"currentColor"}))}const bl=Oe(ml,"caretdown");function yl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m6.45 8.34 4.8-5.48a1 1 0 0 1 1.5 0l4.8 5.48A1 1 0 0 1 16.8 10H7.2a1 1 0 0 1-.75-1.66Z",fill:"currentColor"}))}const Sl=Oe(yl,"caretup");function wl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"M5 12.5c0-.83.67-1.5 1.5-1.5h11a1.5 1.5 0 0 1 0 3h-11A1.5 1.5 0 0 1 5 12.5Z",fill:"currentColor"}))}const vl=Oe(wl,"checkbox_indeterminate");function Cl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.41 7.3c.66.51.78 1.45.28 2.11l-6.5 8.5a1.5 1.5 0 0 1-2.37.01l-3.5-4.5a1.5 1.5 0 1 1 2.36-1.84L10 14.54l5.32-6.95a1.5 1.5 0 0 1 2.1-.28Z",fill:"currentColor"}))}const _l=Oe(Cl,"checkbox_tick");function Ol(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.28 4.24a1.5 1.5 0 0 1 0 2.12l-5.66 5.66 5.66 5.65a1.5 1.5 0 1 1-2.12 2.13l-6.72-6.72a1.5 1.5 0 0 1 0-2.12l6.72-6.72a1.5 1.5 0 0 1 2.12 0Z",fill:"currentColor"}))}const bi=Oe(Ol,"chevron_left");function Rl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.44 19.8a1.5 1.5 0 0 1 0-2.13l5.66-5.65-5.66-5.66a1.5 1.5 0 1 1 2.12-2.12l6.72 6.72a1.5 1.5 0 0 1 0 2.12L9.56 19.8a1.5 1.5 0 0 1-2.12 0Z",fill:"currentColor"}))}const js=Oe(Rl,"chevron_right");function El(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.1 2.58A1 1 0 0 1 2 2h20a1 1 0 0 1 .76 1.65l-8.2 9.18V21a1 1 0 0 1-1.44.9l-3.07-2a1 1 0 0 1-.55-.9v-6.17L1.24 3.65a1 1 0 0 1-.15-1.07Z",fill:"currentColor"}))}const xl=Oe(El,"filter");function Tl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.5 2a8.5 8.5 0 1 0 4.86 15.48l4.08 4.08a1.5 1.5 0 1 0 2.12-2.12l-4.08-4.08A8.5 8.5 0 0 0 10.5 2ZM5 10.5a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",fill:"currentColor"}))}const Il=Oe(Tl,"search");function Pl(i){return L.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},i),L.createElement("path",{d:"m20.56 9.66-7.8 8.97a1 1 0 0 1-1.51 0L3.44 9.66A1 1 0 0 1 4.19 8h15.62a1 1 0 Line truncated
Please note that this is not a legal way to use it`);return}t?n=e:n=e.map(r=>r.value),this.handleValueChange(n),this._adapter.notifyChange(n)}checkMultipleProps(e){if(this._isMultiple()){const t=e||this.getProps(),{defaultValue:n,value:s}=t,r=s||n;!Xt(r)&&!Array.isArray(r)&&$e(!0,"[Semi Select] defaultValue/value should be array type in multiple mode")}}updateScrollTop(){this._adapter.updateScrollTop()}updateOverflowItemCount(e,t){const{maxTagCount:n,ellipsisTrigger:s}=this.getProps();s&&(t?this._adapter.updateOverflowItemCount(t):typeof n=="number"&&(e-n>0?this._adapter.updateOverflowItemCount(e-n):this._adapter.updateOverflowItemCount(0)))}updateIsFullTags(){const{isFullTags:e}=this.getStates();e||this._adapter.setState({isFullTags:!0})}handlePopoverClose(){this._adapter.emit("popoverClose")}handleSlotMouseEnter(){this._adapter.updateFocusIndex(-1)}}const lt=al.PREFIX,Ki=gi.TAG_SIZE,Rd=gi.AVATAR_SHAPE;class Ht extends L.PureComponent{renderNTag(e,t){const{size:n,showPopover:s,popoverProps:r,onPlusNMouseEnter:o}=this.props;let l=b.createElement(mt,{closable:!1,size:n,color:"grey",style:{backgroundColor:"transparent"},key:"_+n",onMouseEnter:o},"+",e);return s&&(l=b.createElement(yt,Object.assign({showArrow:!0,content:t,trigger:"hover",position:"top",autoAdjustOverflow:!0,className:`${lt}-rest-group-popover`},r,{key:"_+n_Popover"}),l)),l}renderMergeTags(e){const{maxTagCount:t,tagList:n,restCount:s}=this.props,r=s||n.length-t;let o=e;const l=e.slice(0,t),c=e.slice(t);let d=null;return r>0&&(d=this.renderNTag(r,c),l.push(d),o=l),o}renderAllTags(){const{tagList:e,size:t,mode:n,avatarShape:s,onTagClose:r}=this.props;return e.map(l=>{if(n==="custom")return l;const c=Object.assign({},l);return c.size||(c.size=t),c.avatarShape||(c.avatarShape=s),c.tagKey||(typeof c.children=="string"||typeof c.children=="number"?c.tagKey=c.children:c.tagKey=Math.random()),b.createElement(mt,Object.assign({},c,{key:c.tagKey,onClose:(d,u,h)=>{c.onClose&&c.onClose(d,u,h),r&&r(d,u,h)}}))})}render(){const{style:e,className:t,maxTagCount:n,size:s}=this.props,r=M({[`${lt}-group`]:!0,[`${lt}-group-max`]:n,[`${lt}-group-small`]:s==="small",[`${lt}-group-large`]:s==="large"},t),o=this.renderAllTags(),l=typeof n>"u"?o:this.renderMergeTags(o);return b.createElement("div",{style:e,className:r},l)}}Ht.defaultProps={style:{},className:"",size:Ki[0],avatarShape:"square",onTagClose:()=>{},onPlusNMouseEnter:()=>{}};Ht.propTypes={children:a.node,style:a.object,className:a.string,maxTagCount:a.number,restCount:a.number,tagList:a.array,size:a.oneOf(Ki),mode:a.string,onTagClose:a.func,showPopover:a.bool,popoverProps:a.object,avatarShape:a.oneOf(Rd)};var Ed=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(t[n[s]]=i[n[s]]);return t};const so=(i,e,t,n)=>{const s=i.props;if(!i||!s)return null;const r=Object.assign(Object.assign({value:s.value,label:s.label||s.children||s.value,_show:!0,_selected:!1,_scrollIndex:t},s),{_parentGroup:e});return r._keyInJsx=n||i.key,r},xd=i=>{let e=[],t=[];const n={label:"",children:[],_show:!1};let s=b.Children.toArray(i);s=s.filter(l=>l&&l.props);let r="",o=-1;return s.forEach(l=>{if(l.type.isSelectOption){r="option",o++;const c=so(l,void 0,o);n.children.push(c),t.push(c)}else if(l.type.isSelectOptionGroup){r="group";let c=l.props,{children:d}=c,u=Ed(c,["children"]);u.key=l.key;let h=[];Array.isArray(d)?h=d.map(y=>y.key):h.push(d.key),d=b.Children.toArray(d);const g=d.map((y,p)=>{let f=y.key;return h[p]===null&&(f=l.key+""+y.key),o++,so(y,u,o,f)}),m=Object.assign(Object.assign({},l.props),{children:g,key:l.key});e.push(m),t=t.concat(g)}else $e(!0,"[Semi Select] The children of `Select` should be `Select.Option` or `Select.OptionGroup`")}),r==="option"&&(e=[n]),{optionGroups:e,options:t}},Td=i=>{let{index:e,data:t,style:n}=i;const{visibleOptions:s,renderOption:r}=t,o=s[e];return r(o,e,n)};var ro=function(i,e){var t={};for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&e.indexOf(n)<0&&(t[n]=i[n]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(i);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(i,n[s])&&(t[n[s]]=i[n[s]]);return t};let He=class extends L.PureComponent{onClick(e,t){var{value:n,label:s,children:r}=e,o=ro(e,["value","label","children"]);const{props:l}=this;l.disabled||l.onSelect(Object.assign(Object.assign({},o),{value:n,label:s||r}),t)}renderOptionContent(e){let{config:t,children:n,inputValue:s,prefixCls:r}=e;return Ce(n)&&s?b.createElement(zs,{searchWords:t.searchWords,sourceString:t.sourceString,highlightClassName:t.highlightClassName}):n}render(){const e=this.props,{children:t,disabled:n,value:s,selected:r,label:o,empty:l,emptyContent:c,onSelect:d,focused:u, Line truncated
`,T.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
`,C.getElementsByTagName("head")[0].appendChild(T)}C.body&&pa(C.body,"react-draggable-transparent-selection")}function or(C){window.requestAnimationFrame?window.requestAnimationFrame(()=>{ir(C)}):ir(C)}function ir(C){if(C)try{C.body&&fa(C.body,"react-draggable-transparent-selection");const R=C.selection;if(R)R.empty();else{const T=(C.defaultView||window).getSelection();T&&T.type!=="Caret"&&T.removeAllRanges()}}catch{}}function pa(C,R){C.classList?C.classList.add(R):C.className.match(new RegExp(`(?:^|\\s)${R}(?!\\S)`))||(C.className+=` ${R}`)}function fa(C,R){C.classList?C.classList.remove(R):C.className=C.className.replace(new RegExp(`(?:^|\\s)${R}(?!\\S)`,"g"),"")}function ga(C,R,T){if(!C.props.bounds)return[R,T];let{bounds:D}=C.props;D=typeof D=="string"?D:ya(D);const j=fn(C);if(typeof D=="string"){const{ownerDocument:J}=j,Y=J.defaultView;if(!Y)throw new Error("Cannot resolve the owner window of the draggable node.");let ee;if(D==="parent"?ee=j.parentNode:ee=j.getRootNode().querySelector(D),!(ee instanceof Y.HTMLElement))throw new Error('Bounds selector "'+D+'" could not find an element.');const fe=ee,Me=Y.getComputedStyle(j),Ue=Y.getComputedStyle(fe);D={left:-j.offsetLeft+w(Ue.paddingLeft)+w(Me.marginLeft),top:-j.offsetTop+w(Ue.paddingTop)+w(Me.marginTop),right:G(fe)-V(j)-j.offsetLeft+w(Ue.paddingRight)-w(Me.marginRight),bottom:W(fe)-q(j)-j.offsetTop+w(Ue.paddingBottom)-w(Me.marginBottom)}}return v(D.right)&&(R=Math.min(R,D.right)),v(D.bottom)&&(T=Math.min(T,D.bottom)),v(D.left)&&(R=Math.max(R,D.left)),v(D.top)&&(T=Math.max(T,D.top)),[R,T]}function ar(C,R,T){const D=Math.round(R/C[0])*C[0],j=Math.round(T/C[1])*C[1];return[D,j]}function ma(C){return C.props.axis==="both"||C.props.axis==="x"}function ba(C){return C.props.axis==="both"||C.props.axis==="y"}function un(C,R,T){const D=typeof R=="number"?de(C,R):null;if(typeof R=="number"&&!D)return null;const j=fn(T),J=T.props.offsetParent||j.offsetParent||j.ownerDocument.body;return se(D||C,J,T.props.scale)}function hn(C,R,T){const D=!v(C.lastX),j=fn(C);return D?{node:j,deltaX:0,deltaY:0,lastX:R,lastY:T,x:R,y:T}:{node:j,deltaX:R-C.lastX,deltaY:T-C.lastY,lastX:C.lastX,lastY:C.lastY,x:R,y:T}}function pn(C,R){const T=C.props.scale;return{node:R.node,x:C.state.x+R.deltaX/T,y:C.state.y+R.deltaY/T,deltaX:R.deltaX/T,deltaY:R.deltaY/T,lastX:C.state.x,lastY:C.state.y}}function ya(C){return{left:C.left,top:C.top,right:C.right,bottom:C.bottom}}function fn(C){const R=C.findDOMNode();if(!R)throw new Error("<DraggableCore>: Unmounted during event!");return R}var gn=d(St()),ae=d(zt()),Sa=d(pr());function Se(...C){i.DRAGGABLE_DEBUG&&console.log(...C)}var me={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},Ie=me.mouse,Le=class extends gn.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=C=>{if(this.props.onMouseDown(C),!this.props.allowAnyClick&&(typeof C.button=="number"&&C.button!==0||C.ctrlKey))return!1;const R=this.findDOMNode();if(!R||!R.ownerDocument||!R.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:T}=R;if(this.props.disabled||!(C.target instanceof T.defaultView.Node)||this.props.handle&&!F(C.target,this.props.handle,R)||this.props.cancel&&F(C.target,this.props.cancel,R))return;C.type==="touchstart"&&!this.props.allowMobileScroll&&C.preventDefault();const D=ie(C);this.touchIdentifier=D;const j=un(C,D,this);if(j==null)return;const{x:J,y:Y}=j,ee=hn(this,J,Y);Se("DraggableCore: handleDragStart: %j",ee),Se("calling",this.props.onStart),!(this.props.onStart(C,ee)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&ha(T,this.props.nonce),this.dragging=!0,this.lastX=J,this.lastY=Y,K(T,Ie.move,this.handleDrag),K(T,Ie.stop,this.handleDragStop))},this.handleDrag=C=>{const R=un(C,this.touchIdentifier,this);if(R==null)return;let{x:T,y:D}=R;if(Array.isArray(this.props.grid)){let Y=T-this.lastX,ee=D-this.lastY;if([Y,ee]=ar(this.props.grid,Y,ee),!Y&&!ee)return;T=this.lastX+Y,D=this.lastY+ee}const j=hn(this,T,D);if(Se("DraggableCore: handleDrag: %j",j),this.props.onDrag(C,j)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const Y=document.createEvent("MouseEvents");Y.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(Y)}return}this.lastX=T,this.lastY=D},this.handleDragStop=C=>{if(!this.dragging)return;const R=un(C,this.touchIdentifier,this);if(R==null)return;let{x:T,y:D}=R;if(Array.isArray(this.props.grid)){let ee=T-this.lastX||0,fe=D-this.lastY||0;[ee,fe]=ar(this.props.grid,ee,fe),T=this.lastX+ee,D=this.lastY+fe}const j=hn(this,T,D);if(this.props.onStop(C,j)===!1||this.mounted===!1)return!1;const Y=this.findDOMNode();Y&&this.props.enableUserSelectHack&&or(Y.ownerDocument),Se("DraggableCore: handleDragStop: %j",j),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,Y&&(Se("DraggableCore Line truncated
@@ -1 +1 @@
import{B as g,f as y,k as E,w as C,R as t,l as m,T as u,U as $,S as v,P as o}from"./tauri-compat-tfiFK9EG.js";import{a as I,I as N,b as x,c as B}from"./index-Bpi3BHKj.js";const P={PREFIX:`${g}-banner`},w={TYPE:["info","success","danger","warning"]};class l extends y{constructor(e){super(Object.assign(Object.assign({},l.defaultAdapter),e))}removeBanner(e){this._adapter.notifyClose(e),this._adapter.setVisible()}}const n=P.PREFIX,T=w.TYPE;class h extends E{constructor(e){super(e),this.remove=s=>{s&&s.stopPropagation(),this.foundation.removeBanner(s)},this.state={visible:!0},C("target"in this.props,"[Semi Banner] 'target' has been deprecated, please write JSX directly instead.")}get adapter(){return Object.assign(Object.assign({},super.adapter),{setVisible:()=>{this.setState({visible:!1})},notifyClose:e=>{const{onClose:s}=this.props;s(e)}})}componentDidMount(){this.foundation=new l(this.adapter),this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}renderCloser(){const{closeIcon:e}=this.props;return e===null?e:t.createElement(I,{className:`${n}-close`,onClick:this.remove,icon:e||t.createElement(N,{"x-semi-prop":"closeIcon","aria-hidden":!0}),theme:"borderless",size:"small",type:"tertiary","aria-label":"Close"})}renderIcon(){const{type:e,icon:s}=this.props;let a={warning:t.createElement(B,{size:"large","aria-label":"warning"}),success:t.createElement(v,{size:"large","aria-label":"success"}),info:t.createElement(x,{size:"large","aria-label":"info"}),danger:t.createElement($,{size:"large","aria-label":"danger"})}[e];const r=m({[`${n}-icon`]:!0});return typeof s<"u"&&(a=s),a?t.createElement("div",{className:r,"x-semi-prop":"icon"},a):null}render(){const{children:e,type:s,className:c,style:a,bordered:r,title:p,description:d,fullMode:i}=this.props,{visible:b}=this.state,f=m(n,c,{[`${n}-${s}`]:s,[`${n}-full`]:i,[`${n}-in-container`]:!i,[`${n}-bordered`]:!i&&r});return b?t.createElement("div",Object.assign({className:f,style:a,role:"alert"},this.getDataAttr(this.props)),t.createElement("div",{className:`${n}-content-wrapper`},t.createElement("div",{className:`${n}-content`},this.renderIcon(),t.createElement("div",{className:`${n}-content-body`},p?t.createElement(u.Title,{heading:5,className:`${n}-title`,component:"div","x-semi-prop":"title"},p):null,d?t.createElement(u.Paragraph,{className:`${n}-description`,component:"div","x-semi-prop":"description"},d):null)),this.renderCloser()),e?t.createElement("div",{className:`${n}-extra`,"x-semi-prop":"children"},e):null):null}}h.propTypes={fullMode:o.bool,type:o.oneOf(T),title:o.node,description:o.node,icon:o.node,closeIcon:o.node,children:o.node,style:o.object,className:o.string,onClose:o.func,bordered:o.bool};h.defaultProps={onClose:()=>{},type:"info",fullMode:!0};export{h as B};
import{B as g,f as y,k as E,w as C,R as t,l as m,T as u,U as $,S as v,P as o}from"./tauri-compat-D_GD_wMe.js";import{a as I,I as N,b as x,c as B}from"./index-9FI8Jlf5.js";const P={PREFIX:`${g}-banner`},w={TYPE:["info","success","danger","warning"]};class l extends y{constructor(e){super(Object.assign(Object.assign({},l.defaultAdapter),e))}removeBanner(e){this._adapter.notifyClose(e),this._adapter.setVisible()}}const n=P.PREFIX,T=w.TYPE;class h extends E{constructor(e){super(e),this.remove=s=>{s&&s.stopPropagation(),this.foundation.removeBanner(s)},this.state={visible:!0},C("target"in this.props,"[Semi Banner] 'target' has been deprecated, please write JSX directly instead.")}get adapter(){return Object.assign(Object.assign({},super.adapter),{setVisible:()=>{this.setState({visible:!1})},notifyClose:e=>{const{onClose:s}=this.props;s(e)}})}componentDidMount(){this.foundation=new l(this.adapter),this.foundation.init()}componentWillUnmount(){this.foundation.destroy()}renderCloser(){const{closeIcon:e}=this.props;return e===null?e:t.createElement(I,{className:`${n}-close`,onClick:this.remove,icon:e||t.createElement(N,{"x-semi-prop":"closeIcon","aria-hidden":!0}),theme:"borderless",size:"small",type:"tertiary","aria-label":"Close"})}renderIcon(){const{type:e,icon:s}=this.props;let a={warning:t.createElement(B,{size:"large","aria-label":"warning"}),success:t.createElement(v,{size:"large","aria-label":"success"}),info:t.createElement(x,{size:"large","aria-label":"info"}),danger:t.createElement($,{size:"large","aria-label":"danger"})}[e];const r=m({[`${n}-icon`]:!0});return typeof s<"u"&&(a=s),a?t.createElement("div",{className:r,"x-semi-prop":"icon"},a):null}render(){const{children:e,type:s,className:c,style:a,bordered:r,title:p,description:d,fullMode:i}=this.props,{visible:b}=this.state,f=m(n,c,{[`${n}-${s}`]:s,[`${n}-full`]:i,[`${n}-in-container`]:!i,[`${n}-bordered`]:!i&&r});return b?t.createElement("div",Object.assign({className:f,style:a,role:"alert"},this.getDataAttr(this.props)),t.createElement("div",{className:`${n}-content-wrapper`},t.createElement("div",{className:`${n}-content`},this.renderIcon(),t.createElement("div",{className:`${n}-content-body`},p?t.createElement(u.Title,{heading:5,className:`${n}-title`,component:"div","x-semi-prop":"title"},p):null,d?t.createElement(u.Paragraph,{className:`${n}-description`,component:"div","x-semi-prop":"description"},d):null)),this.renderCloser()),e?t.createElement("div",{className:`${n}-extra`,"x-semi-prop":"children"},e):null):null}}h.propTypes={fullMode:o.bool,type:o.oneOf(T),title:o.node,description:o.node,icon:o.node,closeIcon:o.node,children:o.node,style:o.object,className:o.string,onClose:o.func,bordered:o.bool};h.defaultProps={onClose:()=>{},type:"info",fullMode:!0};export{h as B};
@@ -1 +1 @@
import{B as f,f as y,k as h,R as l,aw as S,l as _,P as a,s as b}from"./tauri-compat-tfiFK9EG.js";const O=`${f}-spin`,E={PREFIX:O},P={SIZE:["small","middle","large"]};class d extends y{static get spinDefaultAdapter(){return{getProp:()=>{},setLoading:e=>{}}}constructor(e){super(Object.assign(Object.assign({},d.spinDefaultAdapter),e))}updateLoadingIfNeedDelay(){const{spinning:e,delay:n}=this._adapter.getProps(),{delay:t}=this._adapter.getStates();if(t){const s=this;this._timer=setTimeout(()=>{s._adapter.setState({loading:e,delay:0})},n)}}destroy(){this._timer&&(clearTimeout(this._timer),this._timer=null)}}var j=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(i);s<t.length;s++)e.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(i,t[s])&&(n[t[s]]=i[t[s]]);return n};const r=E.PREFIX;class o extends h{constructor(e){super(e),this.foundation=new d(this.adapter),this.state={delay:e.delay,loading:!0}}static getDerivedStateFromProps(e){return e.delay?e.spinning===!1?{delay:0,loading:!1}:{delay:e.delay}:{loading:e.spinning}}get adapter(){return Object.assign(Object.assign({},super.adapter),{setLoading:e=>{this.setState({loading:e})}})}componentWillUnmount(){this.foundation.destroy()}renderSpin(){const{indicator:e,tip:n}=this.props,{loading:t}=this.state;return t?l.createElement("div",{className:`${r}-wrapper`},e?l.createElement("div",{className:`${r}-animate`,"x-semi-prop":"indicator"},e):l.createElement(S,null),n?l.createElement("div",{"x-semi-prop":"tip"},n):null):null}render(){this.foundation.updateLoadingIfNeedDelay();const e=this.props,{children:n,style:t,wrapperClassName:s,childStyle:c,size:p}=e,m=j(e,["children","style","wrapperClassName","childStyle","size"]),{loading:u}=this.state,g=_(r,s,{[`${r}-${p}`]:p,[`${r}-block`]:n,[`${r}-hidden`]:!u});return l.createElement("div",Object.assign({className:g,style:t},this.getDataAttr(m)),this.renderSpin(),l.createElement("div",{className:`${r}-children`,style:c,"x-semi-prop":"children"},n))}}o.propTypes={size:a.oneOf(P.SIZE),spinning:a.bool,children:a.node,indicator:a.node,delay:a.number,tip:a.node,wrapperClassName:a.string,childStyle:a.object,style:a.object};o.__SemiComponentName__="Spin";o.defaultProps=b(o.__SemiComponentName__,{size:"middle",spinning:!0,children:null,indicator:null,delay:0});export{o as S};
import{B as f,f as y,k as h,R as l,aw as S,l as _,P as a,s as b}from"./tauri-compat-D_GD_wMe.js";const O=`${f}-spin`,E={PREFIX:O},P={SIZE:["small","middle","large"]};class d extends y{static get spinDefaultAdapter(){return{getProp:()=>{},setLoading:e=>{}}}constructor(e){super(Object.assign(Object.assign({},d.spinDefaultAdapter),e))}updateLoadingIfNeedDelay(){const{spinning:e,delay:n}=this._adapter.getProps(),{delay:t}=this._adapter.getStates();if(t){const s=this;this._timer=setTimeout(()=>{s._adapter.setState({loading:e,delay:0})},n)}}destroy(){this._timer&&(clearTimeout(this._timer),this._timer=null)}}var j=function(i,e){var n={};for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(i);s<t.length;s++)e.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(i,t[s])&&(n[t[s]]=i[t[s]]);return n};const r=E.PREFIX;class o extends h{constructor(e){super(e),this.foundation=new d(this.adapter),this.state={delay:e.delay,loading:!0}}static getDerivedStateFromProps(e){return e.delay?e.spinning===!1?{delay:0,loading:!1}:{delay:e.delay}:{loading:e.spinning}}get adapter(){return Object.assign(Object.assign({},super.adapter),{setLoading:e=>{this.setState({loading:e})}})}componentWillUnmount(){this.foundation.destroy()}renderSpin(){const{indicator:e,tip:n}=this.props,{loading:t}=this.state;return t?l.createElement("div",{className:`${r}-wrapper`},e?l.createElement("div",{className:`${r}-animate`,"x-semi-prop":"indicator"},e):l.createElement(S,null),n?l.createElement("div",{"x-semi-prop":"tip"},n):null):null}render(){this.foundation.updateLoadingIfNeedDelay();const e=this.props,{children:n,style:t,wrapperClassName:s,childStyle:c,size:p}=e,m=j(e,["children","style","wrapperClassName","childStyle","size"]),{loading:u}=this.state,g=_(r,s,{[`${r}-${p}`]:p,[`${r}-block`]:n,[`${r}-hidden`]:!u});return l.createElement("div",Object.assign({className:g,style:t},this.getDataAttr(m)),this.renderSpin(),l.createElement("div",{className:`${r}-children`,style:c,"x-semi-prop":"children"},n))}}o.propTypes={size:a.oneOf(P.SIZE),spinning:a.bool,children:a.node,indicator:a.node,delay:a.number,tip:a.node,wrapperClassName:a.string,childStyle:a.object,style:a.object};o.__SemiComponentName__="Spin";o.defaultProps=b(o.__SemiComponentName__,{size:"middle",spinning:!0,children:null,indicator:null,delay:0});export{o as S};
@@ -1,2 +1,2 @@
import{c as ie,b as v,B as oe,l as A,R as x,au as Y,P as l,an as le,aj as o,T as j,ap as K,S as te,U as ce,ak as pe,at as de,aq as ue,as as ge,ar as he}from"./tauri-compat-tfiFK9EG.js";import{S as fe}from"./index-D_sWIqse.js";import{A as me}from"./Animation-TKQfYYOo.js";import{W as be}from"./WindowsTitlebar-CrkUa1UM.js";function ye(e){return v.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),v.createElement("g",{clipPath:"url(#clip_loading)"},v.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 0c.66 0 1.2.54 1.2 1.2v5.2a1.2 1.2 0 0 1-2.4 0V1.2c0-.66.54-1.2 1.2-1.2Zm7.05 2.3c.54.38.66 1.13.27 1.67l-3.06 4.2a1.2 1.2 0 0 1-1.94-1.4l3.06-4.21a1.2 1.2 0 0 1 1.67-.27Zm-14.1 0a1.2 1.2 0 0 1 1.67.26l3.06 4.2a1.2 1.2 0 1 1-1.94 1.41l-3.06-4.2a1.2 1.2 0 0 1 .27-1.68Zm-4.36 6c.2-.64.88-.98 1.5-.78l4.95 1.6a1.2 1.2 0 0 1-.74 2.3L1.36 9.8a1.2 1.2 0 0 1-.77-1.5Zm22.82 0c.2.62-.14 1.3-.77 1.5l-4.94 1.61a1.2 1.2 0 0 1-.74-2.28l4.94-1.6c.63-.21 1.3.13 1.51.76Zm-15.6 5.06c.21.63-.13 1.3-.77 1.51l-4.94 1.6a1.2 1.2 0 0 1-.74-2.27l4.94-1.61c.63-.2 1.31.14 1.52.77Zm8.37 0c.21-.63.89-.98 1.52-.77l4.94 1.6a1.2 1.2 0 0 1-.74 2.29l-4.94-1.6a1.2 1.2 0 0 1-.78-1.52Zm-6.77 2.2c.54.39.66 1.14.27 1.68l-3.06 4.2a1.2 1.2 0 1 1-1.94-1.4l3.06-4.21a1.2 1.2 0 0 1 1.67-.27Zm5.18 0a1.2 1.2 0 0 1 1.67.27l3.06 4.2a1.2 1.2 0 0 1-1.94 1.41l-3.06-4.2a1.2 1.2 0 0 1 .27-1.68ZM12 16.4c.66 0 1.2.54 1.2 1.2v5.2a1.2 1.2 0 0 1-2.4 0v-5.2c0-.66.54-1.2 1.2-1.2Z",fill:"currentColor"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip_loading"},v.createElement("rect",{width:24,height:24,fill:"currentColor"}))))}const Se=ie(ye,"loading"),ve={PREFIX:`${oe}-progress`},m={types:["line","circle"],DEFAULT_TYPE:"line",STROKE_DEFAULT:"var(--semi-color-success)",strokeLineCap:["square","round"],DEFAULT_LINECAP:"round",sizes:["default","small","large"],DEFAULT_SIZE:"default",directions:["vertical","horizontal"],DEFAULT_DIRECTION:"horizontal"};function ke(e,r,t){try{const n=xe(e,r,t);if(n.length!==0)return n}catch{return}}function xe(e,r,t){if(e.sort((s,i)=>s.percent-i.percent),e[0].percent>r)return m.STROKE_DEFAULT;const n=e[e.length-1];if(n.percent<r)return F(n.color);for(const[s,i]of e.entries()){if(i.percent===r)return F(i.color);if(r>i.percent)continue;const a=e[s-1];return t?Ee({startColor:F(a.color),endColor:F(i.color),size:i.percent-a.percent-1},r-a.percent-1):F(a.color)}}function Ee(e,r){const{startColor:t,endColor:n,size:s}=e,i=t.split(""),a=n.split(""),c=[parseInt(`${i[1]}${i[2]}`,16),parseInt(`${a[1]}${a[2]}`,16)],h=[parseInt(`${i[3]}${i[4]}`,16),parseInt(`${a[3]}${a[4]}`,16)],d=[parseInt(`${i[5]}${i[6]}`,16),parseInt(`${a[5]}${a[6]}`,16)],p=[parseInt(`${i[7]}${i[8]}`,16),parseInt(`${a[7]}${a[8]}`,16)],u=(c[0]-c[1])/(s+1),D=(h[0]-h[1])/(s+1),O=(d[0]-d[1])/(s+1),R=(p[0]-p[1])/(s+1);function $(g){const k=Math.round(c[0]-u*(g+1)).toString(16),_=Math.round(h[0]-D*(g+1)).toString(16),G=Math.round(d[0]-O*(g+1)).toString(16),w=`${N(k)}${N(_)}${N(G)}`,b=Math.floor(R*(g+1)+p[1]).toString(16);return S.Hex(`#${w}`,b)}function N(g){return g.length===1?`0${g}`:g.length===0?"00":g}if(typeof r>"u"){const g=[t];for(let k=0;k<s;k+=1)g.push($(k));return g}return $(r)}function F(e){if(e=e.trim().toLowerCase(),C.hex.test(e))return S.Hex(e,void 0);if(C.hslA.test(e))return S.Hex(S.HslA(e),void 0);if(C.rgbA.test(e))return S.Hex(S.RgbA(e),void 0);if(C.semiDesignTokens.test(e))return V.ALONG.indexOf(e)!==-1?S.SemiDesignToken(e):V.SEQUENCE.indexOf(e)!==-1?S.SemiDesignToken(`${e}-5`):S.SemiDesignToken(`${e}`)}const S={Hex(e,r){return e=e.replace("#",""),e.length===8?`#${e}`:e.length===6?`#${e}${r||"ff"}`:(e.length===3&&(e=e.split("").map(t=>t+t).join("")),`#${e}${r||"ff"}`)},SemiDesignToken(e){if(typeof window>"u")return;const r=getComputedStyle(document.body).getPropertyValue(`--semi-${e}`);if(r==="")return;const t=`rgba(${r}, 1)`;return S.RgbA(t)},HslA(e){const r=C.hslA.exec(e),t=parseInt(r[2]),n=parseInt(r[3])/100,s=parseInt(r[4])/100,i=r[5],a=(1-Math.abs(2*s-1))*n,c=a*(1-Math.abs(t/60%2-1)),h=s-a/2;let d=0,p=0,u=0;return 0<=t&&t<60?(d=a,p=c,u=0):60<=t&&t<120?(d=c,p=a,u=0):120<=t&&t<180?(d=0,p=a,u=c):180<=t&&t<240?(d=0,p=c,u=a):240<=t&&t<300?(d=c,p=0,u=a):300<=t&&t<360&&(d=a,p=0,u=c),d=Math.round((d+h)*255).toString(16),p=Math.round((p+h)*255).toString(16),u=Math.round((u+h)*255).toString(16),S.utils.pAL(d,p,u,i)},RgbA(e){const r=C.rgbA.exec(e),t=parseInt(r[2],10).toString(16),n=parseInt(r[3],10).toString(16),s=parseInt(r[4],10).toString(16),i=r[5];return S.utils.pAL(t,n,s,i)},utils:{pAL(e,r,t,n){return e.length==1&&(e="0"+e),r.length==1&&(r="0"+r),t.length==1&&(t="0"+t),typeof n<"u"?(n=Math.round(parseInt(n)*255).toString(16),n.length==1&&(n="0"+n),"#"+e+r+t+n):"#"+e+r+t}}},C={hex:/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,hslA:/(hsl)a?\(\s*?(\d+),?\s*?(\d+)%,?\s*?(\d+)%,?\s*?\/?(\s*?[\d.]+)?\s*?\)/,rgbA:/(rgb)a?\(\s*?(\d+),?\s*?(Line truncated
import{c as ie,b as v,B as oe,l as A,R as k,au as Y,P as l,an as le,aj as o,T as j,ap as K,S as te,U as ce,al as pe,at as de,aq as ue,as as ge,ar as he}from"./tauri-compat-D_GD_wMe.js";import{S as fe}from"./index-D9Nakaf3.js";import{A as me}from"./Animation-DbFrgT1j.js";import{W as be}from"./WindowsTitlebar-Byi-SYR_.js";function ye(e){return v.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),v.createElement("g",{clipPath:"url(#clip_loading)"},v.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 0c.66 0 1.2.54 1.2 1.2v5.2a1.2 1.2 0 0 1-2.4 0V1.2c0-.66.54-1.2 1.2-1.2Zm7.05 2.3c.54.38.66 1.13.27 1.67l-3.06 4.2a1.2 1.2 0 0 1-1.94-1.4l3.06-4.21a1.2 1.2 0 0 1 1.67-.27Zm-14.1 0a1.2 1.2 0 0 1 1.67.26l3.06 4.2a1.2 1.2 0 1 1-1.94 1.41l-3.06-4.2a1.2 1.2 0 0 1 .27-1.68Zm-4.36 6c.2-.64.88-.98 1.5-.78l4.95 1.6a1.2 1.2 0 0 1-.74 2.3L1.36 9.8a1.2 1.2 0 0 1-.77-1.5Zm22.82 0c.2.62-.14 1.3-.77 1.5l-4.94 1.61a1.2 1.2 0 0 1-.74-2.28l4.94-1.6c.63-.21 1.3.13 1.51.76Zm-15.6 5.06c.21.63-.13 1.3-.77 1.51l-4.94 1.6a1.2 1.2 0 0 1-.74-2.27l4.94-1.61c.63-.2 1.31.14 1.52.77Zm8.37 0c.21-.63.89-.98 1.52-.77l4.94 1.6a1.2 1.2 0 0 1-.74 2.29l-4.94-1.6a1.2 1.2 0 0 1-.78-1.52Zm-6.77 2.2c.54.39.66 1.14.27 1.68l-3.06 4.2a1.2 1.2 0 1 1-1.94-1.4l3.06-4.21a1.2 1.2 0 0 1 1.67-.27Zm5.18 0a1.2 1.2 0 0 1 1.67.27l3.06 4.2a1.2 1.2 0 0 1-1.94 1.41l-3.06-4.2a1.2 1.2 0 0 1 .27-1.68ZM12 16.4c.66 0 1.2.54 1.2 1.2v5.2a1.2 1.2 0 0 1-2.4 0v-5.2c0-.66.54-1.2 1.2-1.2Z",fill:"currentColor"})),v.createElement("defs",null,v.createElement("clipPath",{id:"clip_loading"},v.createElement("rect",{width:24,height:24,fill:"currentColor"}))))}const Se=ie(ye,"loading"),ve={PREFIX:`${oe}-progress`},m={types:["line","circle"],DEFAULT_TYPE:"line",STROKE_DEFAULT:"var(--semi-color-success)",strokeLineCap:["square","round"],DEFAULT_LINECAP:"round",sizes:["default","small","large"],DEFAULT_SIZE:"default",directions:["vertical","horizontal"],DEFAULT_DIRECTION:"horizontal"};function xe(e,r,t){try{const n=ke(e,r,t);if(n.length!==0)return n}catch{return}}function ke(e,r,t){if(e.sort((s,i)=>s.percent-i.percent),e[0].percent>r)return m.STROKE_DEFAULT;const n=e[e.length-1];if(n.percent<r)return F(n.color);for(const[s,i]of e.entries()){if(i.percent===r)return F(i.color);if(r>i.percent)continue;const a=e[s-1];return t?Ee({startColor:F(a.color),endColor:F(i.color),size:i.percent-a.percent-1},r-a.percent-1):F(a.color)}}function Ee(e,r){const{startColor:t,endColor:n,size:s}=e,i=t.split(""),a=n.split(""),c=[parseInt(`${i[1]}${i[2]}`,16),parseInt(`${a[1]}${a[2]}`,16)],h=[parseInt(`${i[3]}${i[4]}`,16),parseInt(`${a[3]}${a[4]}`,16)],d=[parseInt(`${i[5]}${i[6]}`,16),parseInt(`${a[5]}${a[6]}`,16)],p=[parseInt(`${i[7]}${i[8]}`,16),parseInt(`${a[7]}${a[8]}`,16)],u=(c[0]-c[1])/(s+1),D=(h[0]-h[1])/(s+1),O=(d[0]-d[1])/(s+1),R=(p[0]-p[1])/(s+1);function $(g){const x=Math.round(c[0]-u*(g+1)).toString(16),_=Math.round(h[0]-D*(g+1)).toString(16),G=Math.round(d[0]-O*(g+1)).toString(16),w=`${N(x)}${N(_)}${N(G)}`,b=Math.floor(R*(g+1)+p[1]).toString(16);return S.Hex(`#${w}`,b)}function N(g){return g.length===1?`0${g}`:g.length===0?"00":g}if(typeof r>"u"){const g=[t];for(let x=0;x<s;x+=1)g.push($(x));return g}return $(r)}function F(e){if(e=e.trim().toLowerCase(),C.hex.test(e))return S.Hex(e,void 0);if(C.hslA.test(e))return S.Hex(S.HslA(e),void 0);if(C.rgbA.test(e))return S.Hex(S.RgbA(e),void 0);if(C.semiDesignTokens.test(e))return V.ALONG.indexOf(e)!==-1?S.SemiDesignToken(e):V.SEQUENCE.indexOf(e)!==-1?S.SemiDesignToken(`${e}-5`):S.SemiDesignToken(`${e}`)}const S={Hex(e,r){return e=e.replace("#",""),e.length===8?`#${e}`:e.length===6?`#${e}${r||"ff"}`:(e.length===3&&(e=e.split("").map(t=>t+t).join("")),`#${e}${r||"ff"}`)},SemiDesignToken(e){if(typeof window>"u")return;const r=getComputedStyle(document.body).getPropertyValue(`--semi-${e}`);if(r==="")return;const t=`rgba(${r}, 1)`;return S.RgbA(t)},HslA(e){const r=C.hslA.exec(e),t=parseInt(r[2]),n=parseInt(r[3])/100,s=parseInt(r[4])/100,i=r[5],a=(1-Math.abs(2*s-1))*n,c=a*(1-Math.abs(t/60%2-1)),h=s-a/2;let d=0,p=0,u=0;return 0<=t&&t<60?(d=a,p=c,u=0):60<=t&&t<120?(d=c,p=a,u=0):120<=t&&t<180?(d=0,p=a,u=c):180<=t&&t<240?(d=0,p=c,u=a):240<=t&&t<300?(d=c,p=0,u=a):300<=t&&t<360&&(d=a,p=0,u=c),d=Math.round((d+h)*255).toString(16),p=Math.round((p+h)*255).toString(16),u=Math.round((u+h)*255).toString(16),S.utils.pAL(d,p,u,i)},RgbA(e){const r=C.rgbA.exec(e),t=parseInt(r[2],10).toString(16),n=parseInt(r[3],10).toString(16),s=parseInt(r[4],10).toString(16),i=r[5];return S.utils.pAL(t,n,s,i)},utils:{pAL(e,r,t,n){return e.length==1&&(e="0"+e),r.length==1&&(r="0"+r),t.length==1&&(t="0"+t),typeof n<"u"?(n=Math.round(parseInt(n)*255).toString(16),n.length==1&&(n="0"+n),"#"+e+r+t+n):"#"+e+r+t}}},C={hex:/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,hslA:/(hsl)a?\(\s*?(\d+),?\s*?(\d+)%,?\s*?(\d+)%,?\s*?\/?(\s*?[\d.]+)?\s*?\)/,rgbA:/(rgb)a?\(\s*?(\d+),?\s*?(Line truncated
`)})})})]})}function Me(){return o.jsxs("section",{className:"ga-bootstrap-screen ga-bootstrap-ready","aria-live":"polite",children:[o.jsx(te,{size:"extra-large",className:"ga-bootstrap-ready-icon","aria-hidden":"true"}),o.jsx(j.Title,{heading:5,className:"ga-bootstrap-title",children:E("ready")}),o.jsx(j.Text,{type:"tertiary",children:E("readyDetail")})]})}function Ue(){const[e,r]=v.useReducer(Ne,we);v.useEffect(()=>(je(r).catch(n=>{console.error("[bootstrap] failed to subscribe to startup state",n)}),()=>De()),[]);let t;switch(e.route){case"loading":t=o.jsx(Re,{mode:e.mode});break;case"progress":t=o.jsx(Fe,{stages:e.stages,overallPct:e.overallPct,logs:e.logs});break;case"ready":t=o.jsx(Me,{});break}return o.jsxs("div",{className:"ga-bootstrap-shell",children:[pe&&o.jsx(be,{}),o.jsx("main",{className:"ga-bootstrap-app","data-route":e.route,children:t})]})}function ne(e){e.matches?(document.documentElement.dataset.appearance="dark",document.body.setAttribute("theme-mode","dark")):(document.documentElement.dataset.appearance="light",document.body.removeAttribute("theme-mode"))}const M=window.matchMedia("(prefers-color-scheme: dark)");ne(M);var ee;(ee=M.addEventListener)==null||ee.call(M,"change",()=>ne(M));const J=document.getElementById("loading-root");J&&de.createRoot(J).render(o.jsx(v.StrictMode,{children:o.jsx(ue,{locale:f?ge:he,children:o.jsx(Ue,{})})}));
-33
View File
@@ -1,33 +0,0 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPart-Bhe_jloX.js","assets/tauri-compat-tfiFK9EG.js","assets/tauri-compat-BTcpEvqB.css","assets/markdown-preprocess-Bvg4n8KE.js","assets/markdown-preprocess-Cp579UoJ.css","assets/index-Bpi3BHKj.js","assets/index-D0pGtk0y.css","assets/WindowsTitlebar-CrkUa1UM.js","assets/WindowsTitlebar-U0YG9JNA.css","assets/MarkdownPart-Cp90Gu77.css","assets/SummaryPart-D48OOFSQ.js","assets/ServicesPage-DrjRw530.js","assets/index-DwVcZP0M.js","assets/index-D_sWIqse.js","assets/index-DkG9Cu-r.css","assets/index-gTPS8Hpa.css","assets/IconFile-CgfQSwGI.js","assets/ServicesPage-Cbm5nbW7.css","assets/TokenPage-C6-RA6yj.js","assets/Animation-TKQfYYOo.js","assets/index-DpGuh58E.js","assets/index-ClU1uQYs.css","assets/TokenPage-DwLDOw_j.css","assets/CollabPage-bnm43hIR.js","assets/CollabPage-CG38jm3S.css"])))=>i.map(i=>d[i]);
var _i=Object.defineProperty;var Mi=(n,e,t)=>e in n?_i(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var xt=(n,e,t)=>Mi(n,typeof e!="symbol"?e+"":e,t);import{g as We,r as Li,a as Ii,c as fe,b as a,d as $s,e as As,B as Te,_ as Be,f as ge,h as $,i as De,j as Ti,E as Ri,R as g,k as de,l as I,m as Ge,n as Fs,P as h,w as zs,o as jo,p as Je,q as rn,s as ln,t as No,u as Ni,v as Di,x as $i,y as Ai,z as Fi,A as zi,C as Bi,D as Ui,F as Vi,G as Ki,H as Bs,I as Wi,T as Do,J as sn,K as Hi,L as Zi,M as qi,N as Pt,O as Us,Q as Vs,S as Ks,U as Ws,V as Gi,W as Hs,X as Zs,Y as Eo,Z as Qi,$ as Yi,a0 as Xi,a1 as Ji,a2 as ea,a3 as ta,a4 as na,a5 as oa,a6 as ra,a7 as sa,a8 as ia,a9 as aa,aa as Go,ab as $e,ac as la,ad as ca,ae as Jt,af as da,ag as ua,ah as Oo,ai as me,aj as i,ak as pa,al as ha,am as ma,an as fa,ao as Qo,ap as dt,aq as ga,ar as ya,as as ba,at as va}from"./tauri-compat-tfiFK9EG.js";import{I as cn,a as qs,b as Gs,c as Qs,B as ie}from"./index-Bpi3BHKj.js";import{W as xa}from"./WindowsTitlebar-CrkUa1UM.js";const wa="modulepreload",Ca=function(n){return"/"+n},Yo={},Gt=function(e,t,o){let r=Promise.resolve();if(t&&t.length>0){let l=function(p){return Promise.all(p.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));r=l(t.map(p=>{if(p=Ca(p),p in Yo)return;Yo[p]=!0;const d=p.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":wa,d||(f.as="script"),f.crossOrigin="",f.href=p,u&&f.setAttribute("nonce",u),document.head.appendChild(f),d)return new Promise((b,y)=>{f.addEventListener("load",b),f.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return r.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};function Xo(n,e){const t=e,o=new URL(t);if(o.protocol!=="http:"&&o.protocol!=="https:")throw new Error(`Service endpoint must use HTTP(S): ${t}`);return o.toString().replace(/\/+$/,"")}function Jo(n){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname=`${e.pathname.replace(/\/+$/,"")}/ws`,e.toString().replace(/\/$/,"")}function Sa(n){const e=Xo(n.VITE_BRIDGE_BASE,"http://127.0.0.1:14168"),t=Xo(n.VITE_CONDUCTOR_BASE,"http://127.0.0.1:8900");return{bridgeBase:e,conductorBase:t,wsUrl:Jo(e),conductorWsUrl:Jo(t)}}const dn=Sa({VITE_BRIDGE_BASE:void 0,VITE_CONDUCTOR_BASE:void 0}),ee=dn.bridgeBase,ka=dn.conductorBase,ja=dn.wsUrl,Ea=dn.conductorWsUrl,Oa=1e3,Pa=3e4;let ke=null,Po=0,kn=null;const jt=new Map;let _o="offline";const Mo=new Set;let er=!1;const _a=new Set;function jn(n){n!==_o&&(_o=n,n==="ready"&&(er||(er=!0,_a.forEach(e=>e()))),Mo.forEach(e=>e(n)))}function tr(){return _o}function Ys(n){return Mo.add(n),()=>{Mo.delete(n)}}function Xs(){if(!(ke&&(ke.readyState===WebSocket.OPEN||ke.readyState===WebSocket.CONNECTING))){jn("connecting");try{ke=new WebSocket(ja)}catch{nr();return}ke.onopen=()=>{Po=0,jn("ready")},ke.onmessage=n=>{try{const e=JSON.parse(n.data),t=e.type;if(!t)return;const o=jt.get(t);o&&o.forEach(r=>r(e))}catch{}},ke.onclose=()=>{ke=null,jn("connecting"),nr()},ke.onerror=()=>{ke==null||ke.close()}}}function nr(){if(kn)return;const n=Math.min(Oa*2**Po,Pa);Po++,kn=setTimeout(()=>{kn=null,Xs()},n)}function Ve(n,e){return jt.has(n)||jt.set(n,new Set),jt.get(n).add(e),Xs(),()=>{var t;(t=jt.get(n))==null||t.delete(e)}}let or=[];const Ma=new Set;let rr=!1;function La(){for(const n of Ma)n()}function En(n){or=[...or.slice(-39),n],La()}function Ia(){rr||(rr=!0,Ve("session-state",n=>{const e=n;if(!e.sessionId||!e.status)return;const t=e.status==="running"?"Turn started":e.status==="idle"?"Turn complete":e.status==="error"?"Turn error":`Session ${e.status}`;En(t)}),Ve("service.changed",n=>{const e=n;if(!e.service)return;const t=e.service.name??e.service.id??"service",o=e.service.status??"unknown";En(`${t}: ${o}`)}),Ve("token.changed",n=>{const e=n;!e.session_id||!e.total_output||En(`Token update: +${e.total_output} output`)}))}Ia();const Js=new Set(["http:","https:"]),Ta=new Set(["\\href","\\url"]),Ra=/^data:image\/(?:avif|gif|jpeg|png|webp);base64,[a-z0-9+/]+={0,2}$/i,Na=/^(?:\/|\.\/)?assets\//,Da=/%(?:2e|2f|5c)/i,ei=/[\u0000-\u001f\u007f]/;function $o(n){const e=n.trim();if(!/^https?:\/\//i.test(e)||ei.test(e))return null;try{const t=new URL(e);return Js.has(t.protocol)?t.href:null}catch{return null}}function $a(n){if(!Na.test(n)||n.startsWith("//")||n.includes("\\")||Da.test(n))return null;try{const e=new URL(n,"https://genericagent.invalid/");return e.origin==="https://genericagent.invalid"&&e.pathname.startsWith("/assets/")?n:null}catch{return null}Line truncated
/new 新会话 /clear 清屏 /stop 停止 /settings 设置`,"slash.unknown":"未知命令","upload.hint":"上传文件:选择 / 拖拽 / 粘贴","upload.button":"上传文件","upload.tooLarge":"文件过大或数量超限","upload.empty":"跳过空文件","upload.failed":"上传失败","err.charLimit":"已达字数上限({n}),发送时将自动截断","err.charLimitReached":"已达字数上限({n})","err.numMax":"不能超过 {n}","file.openFailed":"无法打开文件","file.kindGeneric":"文件","file.kindDoc":"文档","file.kindSheet":"表格","file.kindSlide":"幻灯片","file.kindCode":"代码","file.kindArchive":"压缩包","file.kindAudio":"音频","file.kindVideo":"视频","upload.removeTitle":"移除","upload.dropHint":"松开以上传文件","lightbox.closeTitle":"关闭","fold.thinking":"思考","fold.tool":"工具调用","fold.toolResult":"工具结果","fold.llm":"LLM Running","fold.turn":"第 {n} 轮","plan.header":"计划 ({done}/{total})","plan.complete":"✓ 计划完成 ({n}/{n})","plan.running":"计划执行中","plan.completeTitle":"计划完成","plan.placeholder":"计划模式已激活","plan.waiting":"等待写入 {path} …","plan.overflow":"还有 {n} 项","plan.current":"当前","plan.collapse":"收起","plan.expand":"展开","plan.details":"详情","plan.capsuleRunning":"运行中","plan.capsuleComplete":"已完成","timing.elapsed":"已运行 {t}","chip.plan":"Plan","chip.auto":"Auto","ch.wechat":"微信","ch.wecom":"企业微信","ch.lark":"飞书","ch.dingtalk":"钉钉","ch.qq":"QQ","ch.telegram":"Telegram","ch.discord":"Discord","ch.loading":"加载中…","ch.empty":"未发现 IM 进程脚本","ch.logEmpty":"暂无日志","err.channelLoad":"加载失败","err.channelStart":"启动失败","err.channelStop":"停止失败","err.mykeyImport":"导入模型配置失败","err.mykeyExport":"导出模型配置失败","err.channelNotConfigured":"请先在密钥配置中完成该平台设置","sys.channelStarted":"已启动","sys.channelStopped":"已停止","sys.bridgeDisconnecting":"正在断开本地连接","modal.channelLogs":"进程日志","modal.mykeyConfig":"密钥配置","sys.configSaved":"配置已保存","sys.mykeyImported":"模型配置已导入","sys.mykeyExported":"模型配置已导出","st.starting":"启动中…","st.stopping":"停止中…","st.online":"在线","st.offline":"离线","st.error":"错误","st.running":"运行中","st.stopped":"已停止","st.abnormal":"异常","st.warning":"警告","err.portBusy":"端口被占用,已自动重连","err.conductorCrash":"内部线程异常退出","err.missingModule":"缺少依赖模块","err.connRefused":"连接被拒绝,将自动重试","err.timeout":"连接超时","err.apiKeyInvalid":"API Key 无效或已过期","err.modelNotFound":"模型不存在或不可用","err.rateLimit":"请求频率超限,请稍后重试","err.quotaExceeded":"额度不足","err.processCrash":"后台进程异常退出","act.configure":"配置","act.logs":"日志","act.restart":"重启","act.stop":"停止","act.start":"启动","act.disconnect":"断开","act.copy":"复制","act.copied":"已复制","act.copyTex":"TeX","act.send":"发送","proc.imbotWechat":"imbot · 微信","proc.imbotDing":"imbot · 钉钉","proc.bridge":"本地连接","proc.bridgeSummary":"连接桌面应用与本地运行环境","proc.bridgeTip":"保持桌面应用与本地运行环境通信","proc.scheduler":"定时任务","proc.schedulerSummary":"按计划自动执行任务","proc.schedulerTip":"在设定时间自动触发并执行任务","proc.conductor":"指挥家","proc.conductorSummary":"异步处理多步骤任务","proc.conductorTip":"通过异步对话拆解任务、分派执行,并持续跟进进度","proc.runtimeComponent":"运行组件","proc.runtimeComponentSummary":"本地运行环境中持续工作的组件","proc.runtimeComponentTip":"查看该组件的状态、日志与控制项","cm.scheduling":"调度中","cm.running":"执行中","cm.idleSt":"空闲","cm.master":"已派 3 子任务","cm.w1":"子任务:抓取数据","cm.w2":"子任务:复核结果","cm.sub":"等待派单","tok.total":"累计","tok.cost":"缓存率","tok.today":"今日","tok.tabAll":"会话","tok.tabConductor":"指挥家","tok.condTotal":"指挥家累计","tok.condCurrent":"指挥家本次","tok.condTip":"指挥家消耗不计入会话累计","tok.condOffline":"指挥家服务离线","tok.disclaimer":"不同 API 网站的计费价格可能会有差异,请以实际网站为准。","tok.colSession":"会话","tok.colIn":"输入","tok.colOut":"输出","tok.colCacheW":"缓存写入","tok.colCache":"缓存读取","tok.colCost":"成本","tok.from":"从","tok.to":"到","tok.reset":"重置","tok.noData":"暂无记录","tok.deleted":"此会话已删除","tok.pricingUnknown":"⚠ 此模型计费规则尚未明确,按默认估算","tok.priceInput":"输入: $","tok.priceOutput":"输出: $","tok.priceCacheW":"缓存写入: $","tok.priceCacheR":"缓存读取: $","presetPrompt.goal":"Line truncated
/new new chat /clear clear /stop stop /settings settings`,"slash.unknown":"Unknown command","upload.hint":"Upload file: pick / drag / paste","upload.button":"Upload file","upload.tooLarge":"File too large or limit reached","upload.empty":"Skipped empty file","upload.failed":"Upload failed","err.charLimit":"Character limit reached ({n}), text will be truncated on send","err.charLimitReached":"Character limit reached ({n})","err.numMax":"Cannot exceed {n}","file.openFailed":"Cannot open file","file.kindGeneric":"File","file.kindDoc":"Document","file.kindSheet":"Spreadsheet","file.kindSlide":"Slides","file.kindCode":"Code","file.kindArchive":"Archive","file.kindAudio":"Audio","file.kindVideo":"Video","upload.removeTitle":"Remove","upload.dropHint":"Drop to upload files","lightbox.closeTitle":"Close","fold.thinking":"Thinking","fold.tool":"Tool call","fold.toolResult":"Tool result","fold.llm":"LLM Running","fold.turn":"Turn {n}","plan.header":"Plan ({done}/{total})","plan.complete":"✓ Plan complete ({n}/{n})","plan.running":"Running plan","plan.completeTitle":"Plan complete","plan.placeholder":"Plan mode activated","plan.waiting":"waiting for {path} …","plan.overflow":"+{n} more","plan.current":"Now","plan.collapse":"Collapse","plan.expand":"Expand","plan.details":"Details","plan.capsuleRunning":"Running","plan.capsuleComplete":"Done","timing.elapsed":"Elapsed {t}","chip.plan":"Plan","chip.auto":"Auto","ch.wechat":"WeChat","ch.wecom":"WeCom","ch.lark":"Lark","ch.dingtalk":"DingTalk","ch.qq":"QQ","ch.telegram":"Telegram","ch.discord":"Discord","ch.loading":"Loading…","ch.empty":"No IM process scripts found","ch.logEmpty":"No log output yet","err.channelLoad":"Failed to load","err.channelStart":"Start failed","err.channelStop":"Stop failed","err.mykeyImport":"Failed to import model config","err.mykeyExport":"Failed to export model config","err.channelNotConfigured":"Complete this platform setup in Key configuration first","sys.channelStarted":"Started","sys.channelStopped":"Stopped","sys.bridgeDisconnecting":"Disconnecting from the local runtime","modal.channelLogs":"Process logs","modal.mykeyConfig":"Key configuration","sys.configSaved":"Configuration saved","sys.mykeyImported":"Model config imported","sys.mykeyExported":"Model config exported","st.starting":"Starting…","st.stopping":"Stopping…","st.online":"Online","st.offline":"Offline","st.error":"Error","st.running":"Running","st.stopped":"Stopped","st.abnormal":"Error","st.warning":"Warning","err.portBusy":"Port was busy, reconnected","err.conductorCrash":"Internal thread crashed","err.missingModule":"Missing module","err.connRefused":"Connection refused, retrying","err.timeout":"Connection timed out","err.apiKeyInvalid":"API key invalid or expired","err.modelNotFound":"Model not found or unavailable","err.rateLimit":"Rate limited, try again later","err.quotaExceeded":"Quota exceeded","err.processCrash":"Background process crashed","act.configure":"Configure","act.logs":"Logs","act.restart":"Restart","act.stop":"Stop","act.start":"Start","act.disconnect":"Disconnect","act.copy":"Copy","act.copied":"Copied","act.copyTex":"TeX","act.send":"Send","proc.imbotWechat":"imbot · WeChat","proc.imbotDing":"imbot · DingTalk","proc.bridge":"Local connection","proc.bridgeSummary":"Connects the desktop app to the local runtime","proc.bridgeTip":"Keeps the desktop app and local runtime communicating","proc.scheduler":"Scheduled tasks","proc.schedulerSummary":"Runs tasks on schedule","proc.schedulerTip":"Triggers and runs tasks at configured times","proc.conductor":"Conductor","proc.conductorSummary":"Handles multi-step work asynchronously","proc.conductorTip":"Uses async conversations to break down, delegate, and follow through on tasks","proc.runtimeComponent":"Runtime component","proc.runtimeComponentSummary":"A component that runs in the local environment","proc.runtimeComponentTip":"View this component’s status, logs, and controls","cm.scheduling":"Scheduling","cm.running":"Running","cm.idleSt":"Idle","cm.master":"Dispatched 3 subtasks","cm.w1":"Subtask: fetch data","cm.w2":"Subtask: review results","cm.sub":"Waiting for tasks","tok.total":"Total","tok.cost":"Cache rate","tok.today":"Today","tok.tabAll":"Chat","tok.tabConductor":"Conductor","tok.condTotal":"Conductor Total","tok.condCurrent":"Conductor Current","tok.condTip":"Conductor usage is not included in chat totals","tok.condOffline":"Service offline","tok.disclaimer":"Pricing may vary by API provider. Please refer to the actual website.","tok.colSession":"Session","tok.colIn":"Input","tok.colOut":"Output","tok.colCacheW":"Cache write","tok.colCache":"Cache read","tok.colCost":"Cost","tok.from":"From","tok.to":"To","tok.reset":"Reset","tok.noData":"No records","tok.deleted":"Session deleted","tok.pricingUnknown":"⚠ Pricing not confirmed, using defaults","tok.priceInput":"Input: $","tok.priceOutput":"Output: $","tok.priceCacheW":"Cache write: $","tok.priceCacheR":"Cache read: $","presetPromptLine truncated
`)}),i.jsxs("div",{className:"ga-bridge-panel-section-foot",children:[_&&i.jsx("span",{className:"ga-bridge-panel-truncated",children:e("bridge.logLineCount",{count:m})}),i.jsxs("button",{className:"ga-bridge-panel-link-btn",onClick:k,children:[e("bridge.viewAllLogs")," →"]})]})]})]})}const lu=[{key:"services",icon:"symbol-misc",textKey:"nav.services"},{key:"collab",icon:"robot",textKey:"nav.collab"},{key:"token",icon:"graph",textKey:"nav.token"}];function cu(){const{activePage:n,setPage:e}=Ie(),t=H(E=>E.open),o=X(E=>E.newSession),r=X(E=>E.sessions),s=X(E=>E.activeSessionId),l=X(E=>E.setActiveSession),c=X(E=>E.runningSessions),{t:u}=ce(),[p,d]=a.useState(!0),[m,f]=a.useState(""),[b,y]=a.useState(!1),[S,w]=a.useState(!1),C=a.useCallback(()=>y(!1),[]),k=a.useCallback(()=>{C(),t()},[C,t]),_=a.useCallback(()=>{w(!1),y(E=>!E)},[]),x=[...r].sort((E,D)=>{if(E.pinned&&!D.pinned)return-1;if(!E.pinned&&D.pinned)return 1;const P=Number(E.updatedAt||E.createdAt||0);return Number(D.updatedAt||D.createdAt||0)-P}),j=m.trim()?x.filter(E=>E.title.toLowerCase().includes(m.trim().toLowerCase())):x;function v(){o(),e("chat")}function O(E){l(E),e("chat")}return i.jsxs("div",{className:"ga-left-sidebar",children:[i.jsxs("nav",{className:"ga-nav-rail","aria-label":"Main navigation",children:[i.jsxs("button",{type:"button",className:"ga-nav-btn",onClick:v,"aria-label":u("nav.chat"),children:[i.jsx("span",{className:"ga-nav-icon",children:i.jsx(Ee,{name:"comment",size:"1rem"})}),i.jsx("span",{className:"ga-nav-label",children:u("nav.chat")})]}),lu.map(E=>i.jsxs("button",{type:"button",className:`ga-nav-btn${n===E.key?" active":""}`,onClick:()=>e(E.key),"aria-label":u(E.textKey),"aria-current":n===E.key?"page":void 0,children:[i.jsx("span",{className:"ga-nav-icon",children:i.jsx(Ee,{name:E.icon,size:"1rem"})}),i.jsx("span",{className:"ga-nav-label",children:u(E.textKey)})]},E.key))]}),i.jsx("div",{className:"ga-sidebar-search",children:i.jsx(ut,{prefix:i.jsx(ti,{style:{fontSize:14}}),placeholder:u("search.placeholder"),size:"small",value:m,onChange:f})}),!m&&i.jsx(zd,{label:u("section.sessions"),count:r.length,open:p,onToggle:d,onAction:v}),i.jsx("div",{className:"ga-session-section",children:(m||p)&&(j.length===0?i.jsx("div",{className:"ga-session-empty",children:i.jsx("p",{children:u(m?"search.noResults":"conv.emptyList")})}):i.jsx("div",{className:"ga-session-list",children:j.map(E=>i.jsx(Ud,{session:E,isActive:E.id===s,isWorking:c.has(E.id),onClick:()=>O(E.id)},E.id))}))}),i.jsxs("div",{className:"ga-sidebar-footer",children:[i.jsx($e,{content:u("foot.settings"),position:"top",clickToHide:!0,children:i.jsx("button",{type:"button",className:"ga-sidebar-footer-btn",onClick:k,"aria-label":u("foot.settings"),children:i.jsx(Ee,{name:"settings-gear",size:"1rem"})})}),i.jsxs("div",{className:"ga-sidebar-footer-anchor",children:[i.jsx($e,{content:u("foot.runtimeManagement"),position:"top",visible:S&&!b,onVisibleChange:w,children:i.jsx("button",{type:"button",className:"ga-sidebar-footer-btn",onClick:_,"aria-label":u("foot.runtimeManagement"),"aria-expanded":b,"aria-haspopup":"dialog","aria-controls":"ga-runtime-management-panel",children:i.jsx(Ee,{name:"server-process",size:"1rem"})})}),b&&i.jsx(au,{onClose:C})]})]})]})}const du=24;function uu(){const n=a.useRef(null),[e,t]=a.useState(!0),o=a.useRef(!0),r=a.useRef(0),s=a.useCallback(()=>{const u=n.current;if(!u)return;const p=u.scrollHeight-u.scrollTop-u.clientHeight<du;t(p),o.current=p},[]),l=a.useCallback((u="instant")=>{const p=n.current;p&&(u==="instant"?p.scrollTop=p.scrollHeight:pu(p,p.scrollHeight-p.clientHeight,170),o.current=!0,t(!0))},[]),c=a.useCallback(()=>{o.current=!1},[]);return a.useEffect(()=>{const u=n.current;if(!u)return;const p=()=>s(),d=new MutationObserver(()=>{o.current&&(cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight}))});return u.addEventListener("scroll",p,{passive:!0}),d.observe(u,{childList:!0,subtree:!0,characterData:!0}),()=>{u.removeEventListener("scroll",p),d.disconnect(),cancelAnimationFrame(r.current)}},[s]),{scrollRef:n,isAtBottom:e,scrollToBottom:l,stopScroll:c}}function pu(n,e,t){const o=n.scrollTop,r=e-o,s=performance.now();function l(c){const u=c-s,p=Math.min(u/t,1),d=1-Math.pow(1-p,3);n.scrollTop=o+r*d,p<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}function hu(n,e,t,o){a.useEffect(()=>{const r=n.current;if(!r||!o)return;t(),r.scrollTop=r.scrollHeight;let s=0,l=r.scrollHeight,c=0;function u(){if(r){if(c++,r.scrollHeight===l?s++:(s=0,l=r.scrollHeight,r.scrollTop=r.scrollHeight),s>=5||c>=90){e("instant");return}requestAnimationFrame(u)}}requestAnimationFrame(u)},[o,n,e,t])}function mu({children:n}){return i.jsx("div",{"data-slot":"aui_thread-content",children:n})}function yt(n){const e=/^[ \t]*(`{3,})([^\n`]*)[ \t]*$/.exec(n??"");return e?{ticks:e[1].length,tag:e[2]}:null}function bi(n,e){if(/^🛠️ Tool:/.test(n))return!0;if(!(e!=null&&e.forToolResult)){const t=yt(n);if(t&&t.ticks>=5&&t. Line truncated
`),nextLine:l+1}}function xi(n,e){const t=yt(n[e]);if(!t||t.ticks<5||t.tag!=="")return null;const o=e+1,r=xn(n,o,{forToolResult:!0}),s=wn(n,o,r,t.ticks);return s<0?null:{body:n.slice(o,s).join(`
`),nextLine:s+1}}function fu(n,e){if(vi(n,e))return null;const t=/^🛠️ Tool: `([^`]+)`/.exec(n[e]||"");if(!t)return null;const o=yt(n[e+1]);let r,s;if(o&&o.tag==="text"){if(r=e+2,s=xn(n,r),wn(n,r,s,o.ticks)>=0)return null}else{r=e+1,s=n.length;for(let l=e+1;l<n.length;l++)if(bi(n[l])){s=l;break}}return{name:t[1],body:n.slice(r,s).join(`
`),nextLine:s,inFlight:!0}}function gu(n,e){if(xi(n,e))return null;const t=yt(n[e]);if(!t||t.ticks<5||t.tag!=="")return null;const o=e+1,r=xn(n,o,{forToolResult:!0});return wn(n,o,r,t.ticks)>=0?null:{body:n.slice(o,r).join(`
`),nextLine:r,inFlight:!0}}function yu(n){return n.replace(/^\s*\**LLM Running \(Turn \d+\) \.\.\.\**\s*/i,"")}function bu(n,e){const t=String(n||"").split(`
`),o=[];let r=0,s=0;const l=c=>{c<=r||(o.push(t.slice(r,c).join(`
`)),r=c)};for(;s<t.length;){const c=vi(t,s);if(c){l(s),o.push(e.onTool(c.name,c.body)),s=c.nextLine,r=s;continue}const u=xi(t,s);if(u){l(s),o.push(e.onResult(u.body)),s=u.nextLine,r=s;continue}const p=fu(t,s);if(p){l(s),o.push(e.onTool(p.name,p.body,{inFlight:!0})),s=p.nextLine,r=s;continue}const d=gu(t,s);if(d){l(s),o.push(e.onResult(d.body,{inFlight:!0})),s=d.nextLine,r=s;continue}s++}return l(t.length),o.join("")}function vu(n){const e=n.split(`
`),t=[];let o=!1;for(const r of e){if(/candidates:/i.test(r)){o=!0;continue}if(o){const s=/^\s*-\s*(.+)/.exec(r);s&&t.push(s[1].trim())}}if(t.length===0)try{const r=JSON.parse(n);if(Array.isArray(r==null?void 0:r.candidates))return r.candidates.map(String)}catch{}return t}function xu(n){const e=n.split(`
`),t=[];for(const o of e){if(/candidates:/i.test(o))break;const r=o.replace(/^["{\s]*question[":\s]*/i,"").replace(/[",}\s]*$/,"");r&&t.push(r)}if(t.length>0)return t.join(`
`);try{const o=JSON.parse(n);if(o!=null&&o.question)return String(o.question)}catch{}return n.trim()}function To(n){const e=[];let t=yu(n);const o=[];t=t.replace(/<thinking>([\s\S]*?)<\/thinking>/gi,(u,p)=>(o.push(p),`
§§THINK:${o.length-1}§§
`));const r=[];t=t.replace(/<summary>([\s\S]*?)<\/summary>/gi,(u,p)=>(r.push(p),`
§§SUMMARY:${r.length-1}§§
`));const s=[],l=[];t=bu(t,{onTool(u,p,d){return s.push({name:u,body:p,inFlight:d==null?void 0:d.inFlight}),`
§§TOOL:${s.length-1}§§
`},onResult(u,p){return l.push({body:u,inFlight:p==null?void 0:p.inFlight}),`
§§RESULT:${l.length-1}§§
`}}),t=t.replace(/<function_calls>[\s\S]*?<\/function_calls>/gi,u=>(s.push({name:"function_call",body:u}),`
§§TOOL:${s.length-1}§§
`)),t=t.replace(/<function_results>[\s\S]*?<\/function_results>/gi,u=>(l.push({body:u}),`
§§RESULT:${l.length-1}§§
`));const c=t.split(/\n?(§§(?:THINK|TOOL|RESULT|SUMMARY):\d+§§)\n?/);for(const u of c){const p=/^§§THINK:(\d+)§§$/.exec(u);if(p){e.push({type:"thinking",content:o[Number(p[1])]});continue}const d=/^§§TOOL:(\d+)§§$/.exec(u);if(d){const y=s[Number(d[1])];if(y.name==="ask_user"){const S=vu(y.body),w=xu(y.body);e.push({type:"approval",content:w,candidates:S})}else e.push({type:"tool",content:y.body,label:y.name,inFlight:y.inFlight});continue}const m=/^§§RESULT:(\d+)§§$/.exec(u);if(m){const y=l[Number(m[1])];e.push({type:"result",content:y.body,inFlight:y.inFlight});continue}const f=/^§§SUMMARY:(\d+)§§$/.exec(u);if(f){e.push({type:"summary",content:r[Number(f[1])]});continue}const b=u.trim();b&&e.push({type:"prose",content:b})}return e}function Hr(n){return n.map((e,t)=>{const o=To(e),r=o.reduce((s,l)=>s+l.content.length,0);return{index:t,segments:o,weight:r}})}function wu(n){const e=[];let t=0;for(;t<n.length;){const o=n[t];if(o.role==="user"){const r=n[t+1];if(r&&r.role==="assistant"){const s=r.turn_segs??(r.content?[r.content]:[]),l=Hr(s);e.push({kind:"turn",userMsg:o,assistantMsg:r,turns:l}),t+=2}else e.push({kind:"standalone",msg:o}),t++}else{if(o.role==="assistant"){const r=o.turn_segs??(o.content?[o.content]:[]),s=Hr(r);e.push({kind:"turn",userMsg:{id:"__synthetic__",role:"user",content:"",status:"completed"},assistantMsg:o,turns:s})}else e.push({kind:"standalone",msg:o});t++}}return e}const Xe=[{id:"plan",title:"Plan",desc:{en:"Explore, plan, execute, verify",zh:"探索、规划、执行、验证"},prompt:"Enter Plan mode: read memory/plan_sop.md, follow Explore → Plan → Execute → Verify flow for the task I describe next."},{id:"goal",title:"Goal",desc:{en:"Achieve a specific objective autonomously",zh:"自主达成指定目标"},prompt:"Enter Goal mode: read L3 goal mode SOP, autonomously achieve the goal I describe next."},{id:"autonomous",title:"Autonomous",desc:{en:"Select tasks and execute independently",zh:"自主选取任务并独立执行"},prompt:"Enter autonomous mode: read memory/autonomous_operation_sop.md, select or plan tasks, execute independently and produce a report."},{id:"hive",title:"Hive",desc:{en:"Multi-agent parallel collaboration",zh:"多 agent 并行协作"},prompt:"Start Goal Hive mode: follow hive SOP, spawn multiple workers to collaboratively achieve my next goal."},{id:"review",title:"Review",desc:{en:"Critical review of latest output",zh:"对最近产出做严格复核"},prompt:"Enter reviewer mode: rigorously critique the latest output, check each item and report issues."},{id:"findwork",title:"Find Work",desc:{en:"Analyze context, suggest next tasks",zh:"分析当前情况,推荐下一步"},prompt:"Analyze my situation using the autonomous planning approach, generate a batch of TODOs that would interest me."}];function Cu(n){for(const e of Xe)if(n.startsWith(e.prompt)){const t=n.slice(e.prompt.length).trimStart();return{id:e.id,rest:t}}return null}function Su(n){return n?n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`:""}function ku(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())||"";return["js","ts","tsx","jsx","py","rs","go","c","cpp","java"].includes(e)?"◇":["json","yaml","yml","toml","xml"].includes(e)?"{}":["md","txt","log","csv"].includes(e)?"¶":["pdf"].includes(e)?"⊞":"◎"}function ju({text:n}){const[e,t]=a.useState(!1),o=a.useRef(),r=a.useCallback(s=>{s.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{t(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>t(!1),2e3)})},[n]);return typeof navigator>"u"||!navigator.clipboard?null:i.jsx("button",{"data-slot":"user-bubble-copy",onClick:r,title:e?"Copied":"Copy",children:e?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M3 8.5l3 3 7-7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("rect",{x:"5.5",y:"5.5",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M3.5 10.5v-7a1 1 0 011-1h7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})})}const wi=a.memo(function({content:e,msgId:t,images:o,files:r}){const s=a.useRef(null),[l,c]=a.useState(!1),[u,p]=a.useState(!1),d=a.useRef(!1);if(d.current=u,a.useLayoutEffect(()=>{const f=s.current;if(!f)return;const b=new ResizeObserver(()=>{d.current||c(f.scrollHeight>f.clientHeight+2)});return b.observe(f),()=>b.disconnect()},[]),!e&&(!o||o.length===0)&&(!r||r.length===0))return null;const m=Cu(e);return i.jsxs(i.Fragment,{children:[o&&o.length>0&&i.jsx("div",{"data-slot":"user-images",children:o.map((f,b)=>i.jsx("img",{"data-slot":"user-image-thumb",src:f.path.startsWith("data:")?f.path:`${ee}/upload/raw?path=${encodeURIComponent(f.path)}`,alt:f.name},b))}),r&&r.length>0&&i.jsx("div",{"data-slot":"user-files",children:r.map((f,b)=>i.jsxs("div Line truncated
`)},[]);return i.jsxs("div",{"data-slot":"aui_assistant-message-root","data-role":"assistant","data-streaming":t||void 0,children:[i.jsx(Du,{segments:o,isStreaming:t,messageId:String(e.id)}),i.jsx($u,{getMessageText:s})]})}),Fu=a.memo(function({userMsg:e,assistantMsg:t,isStreaming:o}){return i.jsxs("div",{"data-slot":"aui_turn-pair",children:[i.jsx(wi,{content:e.content,msgId:e.id,images:e.images,files:e.files}),i.jsx(Au,{message:t,isStreaming:o})]})}),zu=[{pattern:/invalid.?api.?key|api.?key.?invalid|Incorrect API key/i,key:"err.apiKeyInvalid"},{pattern:/model.*not found|does not exist|model_not_found/i,key:"err.modelNotFound"},{pattern:/rate.?limit|429|Too Many Requests/i,key:"err.rateLimit"},{pattern:/quota|insufficient.?funds|balance|billing/i,key:"err.quotaExceeded"},{pattern:/timed?\s*out|TimeoutError/i,key:"err.timeout"},{pattern:/Connection\s*refused|ConnectionRefusedError/i,key:"err.connRefused"},{pattern:/errno 48|address already in use/i,key:"err.portBusy"},{pattern:/Traceback|Exception.*thread|exit code \d+/i,key:"err.processCrash"}];function Bu(n,e){if(!n)return"";for(const t of zu)if(t.pattern.test(n))return e(t.key);return n.length<=80?n:n.slice(0,77)+"…"}const Uu=a.memo(function({error:e,msgId:t}){const{t:o}=ce(),r=Bu(e,o);return i.jsx("div",{className:"ga-inline-error",role:"alert",id:`msg-${t}`,children:i.jsx("span",{className:"ga-inline-error-text",children:r})})}),Vu=300;function Ku(n){return n.kind==="turn"?n.turns.reduce((e,t)=>e+t.segments.length,0):1}const Wu=a.memo(function({messages:e,isRunning:t,budgetMultiplier:o,onShowEarlier:r,scrollRef:s}){const l=a.useMemo(()=>wu(e),[e]),c=a.useRef(null),u=a.useMemo(()=>{if(!isFinite(o))return 0;const f=Vu*o;let b=0;for(let y=l.length-1;y>=0;y--)if(b+=Ku(l[y]),b>f)return y+1;return 0},[l,o]),p=a.useMemo(()=>l.slice(u),[l,u]),d=u;a.useLayoutEffect(()=>{c.current!==null&&(s!=null&&s.current)&&(s.current.scrollTop=s.current.scrollHeight-c.current,c.current=null)});const m=()=>{const f=s==null?void 0:s.current;f&&(c.current=f.scrollHeight-f.scrollTop),r()};return e.length===0?i.jsx("div",{"data-slot":"thread-empty",children:i.jsx("p",{children:"Send a message to begin."})}):i.jsxs(i.Fragment,{children:[d>0&&i.jsxs("button",{"data-slot":"show-earlier-btn",onClick:m,children:["Show ",d," earlier messages"]}),p.map((f,b)=>{const y=u+b;return f.kind==="turn"?i.jsx(Fu,{userMsg:f.userMsg,assistantMsg:f.assistantMsg,isStreaming:t&&y===l.length-1},f.assistantMsg.id):f.msg.role==="user"?i.jsx("div",{"data-slot":"aui_turn-pair",children:i.jsx(wi,{content:f.msg.content,msgId:f.msg.id,images:f.msg.images,files:f.msg.files})},f.msg.id):f.msg.role==="error"?i.jsx(Uu,{error:f.msg.content,msgId:f.msg.id},f.msg.id):i.jsx("div",{"data-slot":"standalone-message","data-status":f.msg.status,children:f.msg.content},f.msg.id)})]})}),Qr=3,Yr=40,Hu=170,Xr=12;function Jr(n){const e=n.replace(/\s+/g," ").trim();return e.length<=Yr?e:e.slice(0,Yr)+"…"}function Zu(n){return 1-Math.pow(1-n,3)}let eo=0;function qu(n,e,t){cancelAnimationFrame(eo);const o=n.scrollTop,r=e-o;if(Math.abs(r)<1)return;const s=performance.now();function l(c){const u=c-s,p=Math.min(u/t,1);n.scrollTop=o+r*Zu(p),p<1&&(eo=requestAnimationFrame(l))}eo=requestAnimationFrame(l)}const Gu=a.memo(function({messages:e,stopScroll:t,onJumpToCollapsed:o}){const r=a.useMemo(()=>e.filter(y=>y.role==="user").map(y=>({id:y.id,content:y.content})),[e]),[s,l]=a.useState(null),[c,u]=a.useState(!1),p=a.useRef(null),d=a.useRef(0),m=a.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null),u(!0)},[]),f=a.useCallback(()=>{p.current=setTimeout(()=>{u(!1),p.current=null},150)},[]);a.useEffect(()=>{if(r.length<Qr)return;const y=document.querySelector('[data-slot="aui_thread-viewport"]');if(!y)return;function S(){if(d.current=0,!y)return;const C=y.getBoundingClientRect().top;let k=null;for(const _ of r){const x=document.getElementById(`msg-${_.id}`);if(!x)continue;if(x.getBoundingClientRect().top-C<=Xr)k=_.id;else break}!k&&r.length>0&&(k=r[0].id),k&&l(k)}function w(){d.current||(d.current=requestAnimationFrame(S))}return y.addEventListener("scroll",w,{passive:!0}),S(),()=>{y.removeEventListener("scroll",w),cancelAnimationFrame(d.current)}},[r]);const b=a.useCallback(y=>{const S=document.querySelector('[data-slot="aui_thread-viewport"]'),w=document.getElementById(`msg-${y}`);if(!w){o(y);return}if(!S)return;t();const _=(w.closest('[data-slot="aui_turn-pair"]')||w).offsetTop-Xr;qu(S,_,Hu)},[t,o]);return r.length<Qr?null:i.jsx("nav",{"data-slot":"user-turn-rail","data-expanded":c||void 0,"aria-label":"User message navigation",children:i.jsxs("div",{"data-slot":"rail-hitarea",onMouseEnter:m,onMouseLeave:f,children:[i.jsx("div",{"data-slot":"rail-panel","aria-hidden":!c,children:r.map(y=>i.jsx("button",{"data-slot":"rail-panel-item","data-active":y.id===s||void 0,onClick:()=>b(y.id),children:Jr(y.content)},y.id))}),i.jsx("div",{"data-slot":"rail-marks",children:r.map(y=>i.jsx("button",{"data-slot":"rail-mark","data-a Line truncated
`;else{const o=Ro(t);o&&(e+=`
`+o)}return e}function Yu(n){const e=Array.from(n.childNodes);for(const t of e)if(t instanceof HTMLElement){if(t.dataset.refText||t.tagName==="BR")continue;if(t.tagName==="DIV"||t.tagName==="P"){const o=document.createElement("br");for(n.insertBefore(o,t);t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}n.normalize()}function ki(n){const e=document.createRange();e.selectNodeContents(n),e.collapse(!1);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function es(n,e){n.focus();const t=window.getSelection();if(!t||t.rangeCount===0){n.appendChild(e);return}const o=t.getRangeAt(0);o.deleteContents(),o.insertNode(e),o.setStartAfter(e),o.collapse(!0),t.removeAllRanges(),t.addRange(o)}function Xu(n,e){n.textContent=e,ki(n)}function Ju(n,e,t){const o=document.createElement("span");return o.contentEditable="false",o.dataset.refText=`@${n}:\`${e}\``,o.dataset.refKind=n,o.className="ref-chip",o.innerHTML=`<span class="ref-chip-icon">${r0(n)}</span><span class="ref-chip-label">${o0(t||e)}</span>`,o}function e0(n,e,t,o){const r=Ju(e,t,o);es(n,r);const s=document.createTextNode(" ");es(n,s)}function t0(n,e){const t=document.createElement("span");return t.contentEditable="false",t.dataset.refText=e,t.dataset.skillId=n,t.className="skill-chip",t.textContent=`/${n}`,t}function n0(n,e,t){n.textContent="";const o=t0(e,t);n.appendChild(o);const r=document.createTextNode(" ");n.appendChild(r),ki(n)}function o0(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function r0(n){switch(n){case"file":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><path d="M4 2h5l4 4v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z" stroke="currentColor" stroke-width="1.2"/><path d="M9 2v4h4" stroke="currentColor" stroke-width="1.2"/></svg>';case"url":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><path d="M6.5 9.5l3-3M7 11l-1.5 1.5a2.12 2.12 0 1 1-3-3L4 8m5-3l1.5-1.5a2.12 2.12 0 1 1 3 3L12 8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>';case"image":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><rect x="2" y="2" width="12" height="12" rx="1" stroke="currentColor" stroke-width="1.2"/><circle cx="5.5" cy="5.5" r="1" fill="currentColor"/><path d="M2 11l3-3 2 2 3-3 4 4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>';default:return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="5" stroke="currentColor" stroke-width="1.2"/></svg>'}}const s0=a.forwardRef(function({placeholder:e,disabled:t,onInput:o,onKeyDown:r,onSlashTrigger:s,onSlashDismiss:l,onAtTrigger:c,onAtDismiss:u,onPasteFiles:p},d){const m=a.useRef(null),f=a.useRef(!1),b=a.useRef("");a.useImperativeHandle(d,()=>({focus(){var x;(x=m.current)==null||x.focus()},clear(){m.current&&(m.current.textContent="",b.current="")},getText(){return m.current?Ro(m.current):""},setText(x){m.current&&(Xu(m.current,x),b.current=x,o(x))},insertChip(x,j,v){m.current&&(m.current.focus(),e0(m.current,x,j,v),y())},setSkillChip(x,j){m.current&&(n0(m.current,x,j),y())},getElement(){return m.current}}));const y=a.useCallback(()=>{if(!m.current)return;const x=Ro(m.current);b.current=x,o(x);const j=x.trimStart();j.startsWith("/")&&!j.includes(`
`)?s==null||s(j.slice(1)):l==null||l();const v=x.match(/@([^\s@]*)$/);v?c==null||c(v[1]):u==null||u()},[o,s,l,c,u]),S=a.useCallback(()=>{f.current||(m.current&&Yu(m.current),y())},[y]),w=a.useCallback(()=>{f.current=!0},[]),C=a.useCallback(()=>{f.current=!1,S()},[S]),k=a.useCallback(x=>{f.current||x.nativeEvent.isComposing||x.keyCode===229||r(x)},[r]),_=a.useCallback(x=>{var E;const j=(E=x.clipboardData)==null?void 0:E.items;if(!j)return;const v=[];for(const D of Array.from(j))if(D.type.startsWith("image/")&&D.type!=="image/svg+xml"){const P=D.getAsFile();P&&v.push(P)}if(v.length>0){x.preventDefault(),p==null||p(v);return}const O=x.clipboardData.getData("text/plain");O&&(x.preventDefault(),document.execCommand("insertText",!1,O))},[p]);return a.useEffect(()=>{const x=m.current;if(!x)return;const j=new ResizeObserver(v=>{var E,D,P;const O=((P=(D=(E=v[0])==null?void 0:E.borderBoxSize)==null?void 0:D[0])==null?void 0:P.blockSize)??x.offsetHeight;x.style.setProperty("--editor-scroll-height",`${O}px`)});return j.observe(x),()=>j.disconnect()},[]),i.jsx("div",{ref:m,"data-slot":"composer-rich-input",contentEditable:!t,role:"textbox","aria-multiline":"true","aria-placeholder":e,"data-placeholder":e,suppressContentEditableWarning:!0,onInput:S,onKeyDown:k,onCompositionStart:w,onCompositionEnd:C,onPaste:_})});function i0(){try{const n=localStorage.getItem("ga_custom_presets");return n?JSON.parse(n):[]}catch{return[]}}function a0({visible:n,query:e,onSelect:t,onClose:o}){const r=H(m=>m.lang),[s,l]=a.useState(0),c=a.useRef(null),u=i0(),p=[...Xe,...u],d=e?p.filter(m=>m.id.startsWith(e.toLowerCase())||m.title.toLowerCase().includes(e.toLowerCase())):p;return a.useEffect(()=>{l(0)},[e]),a.useEffect(()=>{if(!n)return;function m(f){f.key==="ArrowDown"?(f.preventDefault(),l(b=>Math.min(b+1,d.length-1))):f.key==="ArrowUp"?(f.preventDefault(),l(b=>Math.max(b-1,0))):f.key==="Enter"?(f.preventDefault(),d[s]&&t(d[s].id,d[s].prompt)):f.key==="Escape"&&(f.preventDefault(),o())}return document.addEventListener("keydown",m,!0),()=>document.removeEventListener("keydown",m,!0)},[n,s,d,t,o]),a.useEffect(()=>{if(!c.current)return;const m=c.current.querySelector("[data-focused]");m==null||m.scrollIntoView({block:"nearest"})},[s]),!n||d.length===0?null:i.jsx("div",{ref:c,"data-slot":"completion-drawer",children:d.map((m,f)=>i.jsx("button",{"data-slot":"completion-item","data-focused":f===s?"":void 0,onClick:()=>t(m.id,m.prompt),onMouseEnter:()=>l(f),children:i.jsxs("span",{"data-slot":"completion-info",children:[i.jsxs("span",{"data-slot":"completion-title",children:["/",m.id]}),i.jsx("span",{"data-slot":"completion-desc",children:m.desc[r]||m.desc.en})]})},m.id))})}const l0=[{id:"file",label:"file"},{id:"url",label:"url"},{id:"image",label:"image"}];function c0({visible:n,query:e,onConfirm:t,onClose:o}){const r=a.useRef(null),[s,l]=a.useState("file"),[c,u]=a.useState("");a.useEffect(()=>{n&&(u(e),l("file"),setTimeout(()=>{var d;return(d=r.current)==null?void 0:d.focus()},0))},[n,e]),a.useEffect(()=>{if(!n)return;function d(m){m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),o())}return document.addEventListener("keydown",d,!0),()=>document.removeEventListener("keydown",d,!0)},[n,o]);const p=a.useCallback(d=>{d.preventDefault();const m=c.trim();m&&t(s,m)},[s,c,t]);return n?i.jsx("div",{"data-slot":"at-ref-popover",children:i.jsxs("form",{onSubmit:p,"data-slot":"at-ref-form",children:[i.jsx("div",{"data-slot":"at-ref-kinds",children:l0.map(d=>i.jsx("button",{type:"button","data-slot":"at-ref-kind-btn","data-active":d.id===s?"":void 0,onClick:()=>l(d.id),title:d.label,children:i.jsx(d0,{kind:d.id})},d.id))}),i.jsx("input",{ref:r,"data-slot":"at-ref-input",type:"text",value:c,onChange:d=>u(d.target.value),placeholder:s==="url"?"https://...":"path/to/file"}),i.jsx("button",{type:"submit","data-slot":"at-ref-confirm",disabled:!c.trim(),children:"↵"})]})}):null}function d0({kind:n}){switch(n){case"file":return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("path",{d:"M4 2h5l4 4v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 2v4h4",stroke:"currentColor",strokeWidth:"1.2"})]});case"url":return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M6.5 9.5l3-3M7 11l-1.5 1.5a2.12 2.12 0 1 1-3-3L4 8m5-3l1.5-1.5a2.12 2.12 0 1 1 3 3L12 8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})});case"image":return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("circle",{cx:"5.5",cy:"5.5",r:"1",fill:"currentColor"}),i.jsx("path",{d:"M2 11l3-3 2 2 3-3 4 4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});default:return null}}const ts={title:{zh:"附加",en:"Attach"},file:{zh:"文件…",en:"File…"},image:{zh:"图片…",en:"Image…"},paste: Line truncated
`)})]})})]})}return this.props.children}}async function bm(){const n=document.getElementById("app");va.createRoot(n).render(i.jsx(ym,{children:i.jsx(gm,{})}))}bm();export{Hn as A,ee as B,ka as C,Re as D,ai as E,ut as F,ae as G,yi as H,Ha as I,uu as J,H as K,Ih as L,re as M,ph as N,Ee as O,G as P,Fa as Q,et as R,Sm as S,Ae as T,km as U,Aa as V,$o as W,Io as _,jm as a,ce as b,oi as c,Is as d,Zo as e,Pi as f,pl as g,Ie as h,Om as i,Lo as j,Yl as k,gt as l,Ve as m,X as n,Nl as o,zl as p,Al as q,$l as r,Qt as s,xl as t,_s as u,Fl as v,Vl as w,Il as x,Kl as y,pn as z};
@@ -1 +1 @@
*{box-sizing:border-box;margin:0;padding:0}.no-transition,.no-transition *,.no-transition *:before,.no-transition *:after{transition:none!important;animation:none!important}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--semi-color-fill-2);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--semi-color-fill-1)}@font-face{font-family:codicon;src:url(/assets/codicon-DjkITdqj.ttf) format("truetype");font-weight:400;font-style:normal}.codicon{font-family:codicon;font-weight:400;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;--foreground: hsl(0 0% 8%);--background: hsl(0 0% 100%);--ui-text-secondary: hsl(0 0% 30%);--ui-text-tertiary: hsl(0 0% 48%);--ui-text-quaternary: hsl(0 0% 60%);--ui-icon-nav: hsl(0 0% 24%);--ui-icon-nav-active: hsl(0 0% 8%);--theme-primary: hsl(220 80% 50%);--ui-row-hover-background: hsl(0 0% 95%);--ui-row-active-background: hsl(0 0% 92%);--ui-control-hover-background: hsl(0 0% 95%);--ui-control-active-background: hsl(0 0% 90%);--ui-sidebar-surface-background: hsl(0 0% 100%);--ui-stroke-tertiary: hsl(0 0% 88%);--sidebar-edge-border: hsl(0 0% 86%);--ui-accent: hsl(220 80% 50%);--chrome-action-hover: hsl(0 0% 93%);--dt-card: hsl(0 0% 100%);--dt-background: hsl(0 0% 97%);--ui-chat-surface-background: hsl(0 0% 100%);--ui-chat-bubble-background: hsl(0 0% 96%);--ui-stroke-secondary: hsl(0 0% 78%);--ui-tooltip-surface: #17181b;--ui-tooltip-text: #fff}[data-appearance=dark]{--foreground: hsl(0 0% 95%);--background: hsl(240 3% 7.5%);--ui-text-secondary: hsl(0 0% 78%);--ui-text-tertiary: hsl(0 0% 60%);--ui-text-quaternary: hsl(0 0% 48%);--ui-icon-nav: hsl(0 0% 72%);--ui-icon-nav-active: hsl(0 0% 95%);--theme-primary: hsl(220 80% 68%);--ui-row-hover-background: hsl(220 3% 15%);--ui-row-active-background: hsl(220 3% 18%);--ui-control-hover-background: hsl(220 3% 16%);--ui-control-active-background: hsl(220 3% 22%);--ui-sidebar-surface-background: hsl(210 3% 12%);--ui-stroke-tertiary: hsl(220 3% 22%);--sidebar-edge-border: hsl(220 3% 20%);--ui-accent: hsl(220 80% 68%);--chrome-action-hover: hsl(220 3% 18%);--dt-card: hsl(220 3% 14%);--dt-background: hsl(240 3% 7.5%);--ui-chat-surface-background: hsl(240 3% 7.5%);--ui-chat-bubble-background: hsl(220 3% 14%);--ui-stroke-secondary: hsl(220 3% 32%)}html,body,#app{height:100%;width:100%;overflow:hidden;font-family:var(--font-sans)}body{background:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.semi-tooltip-wrapper{padding:5px 8px;background-color:var(--ui-tooltip-surface);color:var(--ui-tooltip-text);font-family:var(--font-sans);font-size:12px;line-height:18px}.semi-tooltip-wrapper .semi-tooltip-icon-arrow{color:var(--ui-tooltip-surface)}button,input,select,textarea{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;color:inherit}[data-appearance=dark] body{color-scheme:dark}[data-slot=model-chip-label],[data-slot=model-menu-name],.ga-model-name,.ga-mixin-member-name{font-family:var(--font-mono)}.ga-root-error{width:min(100%,620px);min-height:100%;margin:0 auto;padding:48px 32px;overflow:auto;color:var(--semi-color-text-0)}.ga-root-error-result.semi-empty{padding:32px 0 18px}.ga-root-error-details{margin-top:18px;border-top:1px solid var(--semi-color-border)}.ga-root-error-details .semi-collapse-header{padding-inline:4px;color:var(--semi-color-text-2)}.ga-root-error-details .semi-typography{margin-top:0}.ga-root-error-details pre{max-height:280px;margin:0;padding:14px;overflow:auto;border:1px solid var(--semi-color-border);border-radius:var(--semi-border-radius-medium);outline:none;background:var(--semi-color-fill-0);color:var(--semi-color-text-1);font:12px/1.55 var(--font-mono);white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}.ga-root-error-details pre:focus-visible{border-color:var(--semi-color-primary);box-shadow:0 0 0 2px var(--semi-color-primary-light-default)}@keyframes semi-input-active{0%{transform:scale(1)}to{transform:scale(.97)}}@keyframes semi-input-inactive{0%{transform:scale(.97)}to{transform:scale(1)}}.semi-input{transition:background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none),border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);transform:scale(var(--semi-transform_scale-none))}.semi-input-wrapper{display:inline-block;position:relative;vertical-align:middle;box-shadow:none;font-size:14px;line-height:20px;font-family:Inter,-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Segoe UI,Line truncated
*{box-sizing:border-box;margin:0;padding:0}.no-transition,.no-transition *,.no-transition *:before,.no-transition *:after{transition:none!important;animation:none!important}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb{background:var(--semi-color-fill-2);border-radius:3px}::-webkit-scrollbar-thumb:hover{background:var(--semi-color-fill-1)}@font-face{font-family:codicon;src:url(/assets/codicon-DjkITdqj.ttf) format("truetype");font-weight:400;font-style:normal}.codicon{font-family:codicon;font-weight:400;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}:root{--font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;--foreground: hsl(0 0% 8%);--background: hsl(0 0% 100%);--ui-text-secondary: hsl(0 0% 30%);--ui-text-tertiary: hsl(0 0% 48%);--ui-text-quaternary: hsl(0 0% 60%);--ui-icon-nav: hsl(0 0% 24%);--ui-icon-nav-active: hsl(0 0% 8%);--theme-primary: hsl(220 80% 50%);--ui-row-hover-background: hsl(0 0% 95%);--ui-row-active-background: hsl(0 0% 92%);--ui-control-hover-background: hsl(0 0% 95%);--ui-control-active-background: hsl(0 0% 90%);--ui-sidebar-surface-background: hsl(0 0% 100%);--ui-stroke-tertiary: hsl(0 0% 88%);--sidebar-edge-border: hsl(0 0% 86%);--ui-accent: hsl(220 80% 50%);--chrome-action-hover: hsl(0 0% 93%);--dt-card: hsl(0 0% 100%);--dt-background: hsl(0 0% 97%);--ui-chat-surface-background: hsl(0 0% 100%);--ui-chat-bubble-background: hsl(0 0% 96%);--ui-stroke-secondary: hsl(0 0% 78%);--ui-tooltip-surface: #17181b;--ui-tooltip-text: #fff}[data-appearance=dark]{--foreground: hsl(0 0% 95%);--background: hsl(240 3% 7.5%);--ui-text-secondary: hsl(0 0% 78%);--ui-text-tertiary: hsl(0 0% 60%);--ui-text-quaternary: hsl(0 0% 48%);--ui-icon-nav: hsl(0 0% 72%);--ui-icon-nav-active: hsl(0 0% 95%);--theme-primary: hsl(220 80% 68%);--ui-row-hover-background: hsl(220 3% 15%);--ui-row-active-background: hsl(220 3% 18%);--ui-control-hover-background: hsl(220 3% 16%);--ui-control-active-background: hsl(220 3% 22%);--ui-sidebar-surface-background: hsl(210 3% 12%);--ui-stroke-tertiary: hsl(220 3% 22%);--sidebar-edge-border: hsl(220 3% 20%);--ui-accent: hsl(220 80% 68%);--chrome-action-hover: hsl(220 3% 18%);--dt-card: hsl(220 3% 14%);--dt-background: hsl(240 3% 7.5%);--ui-chat-surface-background: hsl(240 3% 7.5%);--ui-chat-bubble-background: hsl(220 3% 14%);--ui-stroke-secondary: hsl(220 3% 32%)}html,body,#app{height:100%;width:100%;overflow:hidden;font-family:var(--font-sans)}body{background:var(--background);color:var(--foreground);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.semi-tooltip-wrapper{padding:5px 8px;background-color:var(--ui-tooltip-surface);color:var(--ui-tooltip-text);font-family:var(--font-sans);font-size:12px;line-height:18px}.semi-tooltip-wrapper .semi-tooltip-icon-arrow{color:var(--ui-tooltip-surface)}button,input,select,textarea{font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;color:inherit}[data-appearance=dark] body{color-scheme:dark}[data-slot=model-chip-label],[data-slot=model-menu-name],.ga-model-name,.ga-mixin-member-name{font-family:var(--font-mono)}.ga-root-error{width:min(100%,620px);min-height:100%;margin:0 auto;padding:48px 32px;overflow:auto;color:var(--semi-color-text-0)}.ga-root-error-result.semi-empty{padding:32px 0 18px}.ga-root-error-details{margin-top:18px;border-top:1px solid var(--semi-color-border)}.ga-root-error-details .semi-collapse-header{padding-inline:4px;color:var(--semi-color-text-2)}.ga-root-error-details .semi-typography{margin-top:0}.ga-root-error-details pre{max-height:280px;margin:0;padding:14px;overflow:auto;border:1px solid var(--semi-color-border);border-radius:var(--semi-border-radius-medium);outline:none;background:var(--semi-color-fill-0);color:var(--semi-color-text-1);font:12px/1.55 var(--font-mono);white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}.ga-root-error-details pre:focus-visible{border-color:var(--semi-color-primary);box-shadow:0 0 0 2px var(--semi-color-primary-light-default)}@keyframes semi-input-active{0%{transform:scale(1)}to{transform:scale(.97)}}@keyframes semi-input-inactive{0%{transform:scale(.97)}to{transform:scale(1)}}.semi-input{transition:background-color var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none),border var(--semi-transition_duration-none) var(--semi-transition_function-easeIn) var(--semi-transition_delay-none);transform:scale(var(--semi-transform_scale-none))}.semi-input-wrapper{display:inline-block;position:relative;vertical-align:middle;box-shadow:none;font-size:14px;line-height:20px;font-family:Inter,-apple-system,BlinkMacSystemFont,PingFang SC,Hiragino Sans GB,Microsoft YaHei,Segoe UI,Line truncated
+36
View File
@@ -0,0 +1,36 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownPart-ZJKeOipX.js","assets/tauri-compat-D_GD_wMe.js","assets/tauri-compat-BTcpEvqB.css","assets/markdown-preprocess-Cc2i34eF.js","assets/markdown-preprocess-Cp579UoJ.css","assets/index-9FI8Jlf5.js","assets/index-D0pGtk0y.css","assets/WindowsTitlebar-Byi-SYR_.js","assets/WindowsTitlebar-U0YG9JNA.css","assets/MarkdownPart-Cp90Gu77.css","assets/SummaryPart-zs-In9mf.js","assets/ServicesPage-9DKyWUIu.js","assets/index-BkPDmlaQ.js","assets/index-D9Nakaf3.js","assets/index-DkG9Cu-r.css","assets/index-gTPS8Hpa.css","assets/IconFile-C8B3WX2U.js","assets/ServicesPage-Cbm5nbW7.css","assets/TokenPage-8X0HZ3hU.js","assets/Animation-DbFrgT1j.js","assets/index-C-iCGtYr.js","assets/index-ClU1uQYs.css","assets/TokenPage-DwLDOw_j.css","assets/CollabPage-DD4zkzQv.js","assets/CollabPage-CG38jm3S.css"])))=>i.map(i=>d[i]);
var Mi=Object.defineProperty;var Li=(n,e,t)=>e in n?Mi(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var bt=(n,e,t)=>Li(n,typeof e!="symbol"?e+"":e,t);import{g as We,r as Ii,a as Ti,c as be,b as a,d as Ds,e as As,B as Re,_ as Be,f as ve,h as A,i as De,j as Ri,E as Ni,R as g,k as me,l as I,m as Ge,n as zs,P as h,w as Fs,o as So,p as Je,q as nn,s as an,t as To,u as $i,v as Di,x as Ai,y as zi,z as Fi,A as Bi,C as Ui,D as Vi,F as Ki,G as Wi,H as Bs,I as Hi,T as Ro,J as on,K as Zi,L as qi,M as Gi,N as Et,O as Us,Q as Vs,S as Ks,U as Ws,V as Qi,W as Hs,X as Zs,Y as ko,Z as Yi,$ as Xi,a0 as Ji,a1 as ea,a2 as ta,a3 as na,a4 as oa,a5 as ra,a6 as sa,a7 as ia,a8 as aa,a9 as la,aa as Zo,ab as Ae,ac as ca,ad as da,ae as Yt,af as ua,ag as pa,ah as jo,ai as ye,aj as i,ak as qs,al as ha,am as ma,an as fa,ao as qo,ap as ct,aq as ga,ar as ya,as as ba,at as va}from"./tauri-compat-D_GD_wMe.js";import{I as ln,a as Gs,b as Qs,c as Ys,B as de}from"./index-9FI8Jlf5.js";import{W as xa}from"./WindowsTitlebar-Byi-SYR_.js";const wa="modulepreload",Ca=function(n){return"/"+n},Go={},Zt=function(e,t,o){let r=Promise.resolve();if(t&&t.length>0){let l=function(p){return Promise.all(p.map(d=>Promise.resolve(d).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),u=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));r=l(t.map(p=>{if(p=Ca(p),p in Go)return;Go[p]=!0;const d=p.endsWith(".css"),m=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${m}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":wa,d||(f.as="script"),f.crossOrigin="",f.href=p,u&&f.setAttribute("nonce",u),document.head.appendChild(f),d)return new Promise((y,b)=>{f.addEventListener("load",y),f.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${p}`)))})}))}function s(l){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=l,window.dispatchEvent(c),!c.defaultPrevented)throw l}return r.then(l=>{for(const c of l||[])c.status==="rejected"&&s(c.reason);return e().catch(s)})};function Qo(n,e){const t=e,o=new URL(t);if(o.protocol!=="http:"&&o.protocol!=="https:")throw new Error(`Service endpoint must use HTTP(S): ${t}`);return o.toString().replace(/\/+$/,"")}function Yo(n){const e=new URL(n);return e.protocol=e.protocol==="https:"?"wss:":"ws:",e.pathname=`${e.pathname.replace(/\/+$/,"")}/ws`,e.toString().replace(/\/$/,"")}function Sa(n){const e=Qo(n.VITE_BRIDGE_BASE,"http://127.0.0.1:14168"),t=Qo(n.VITE_CONDUCTOR_BASE,"http://127.0.0.1:8900");return{bridgeBase:e,conductorBase:t,wsUrl:Yo(e),conductorWsUrl:Yo(t)}}const cn=Sa({VITE_BRIDGE_BASE:void 0,VITE_CONDUCTOR_BASE:void 0}),ne=cn.bridgeBase,ka=cn.conductorBase,ja=cn.wsUrl,Ea=cn.conductorWsUrl,Oa=1e3,Pa=3e4;let je=null,Eo=0,Sn=null;const St=new Map;let Oo="offline";const Po=new Set;let Xo=!1;const _a=new Set;function kn(n){n!==Oo&&(Oo=n,n==="ready"&&(Xo||(Xo=!0,_a.forEach(e=>e()))),Po.forEach(e=>e(n)))}function Jo(){return Oo}function Xs(n){return Po.add(n),()=>{Po.delete(n)}}function Js(){if(!(je&&(je.readyState===WebSocket.OPEN||je.readyState===WebSocket.CONNECTING))){kn("connecting");try{je=new WebSocket(ja)}catch{er();return}je.onopen=()=>{Eo=0,kn("ready")},je.onmessage=n=>{try{const e=JSON.parse(n.data),t=e.type;if(!t)return;const o=St.get(t);o&&o.forEach(r=>r(e))}catch{}},je.onclose=()=>{je=null,kn("connecting"),er()},je.onerror=()=>{je==null||je.close()}}}function er(){if(Sn)return;const n=Math.min(Oa*2**Eo,Pa);Eo++,Sn=setTimeout(()=>{Sn=null,Js()},n)}function Ve(n,e){return St.has(n)||St.set(n,new Set),St.get(n).add(e),Js(),()=>{var t;(t=St.get(n))==null||t.delete(e)}}let tr=[];const Ma=new Set;let nr=!1;function La(){for(const n of Ma)n()}function jn(n){tr=[...tr.slice(-39),n],La()}function Ia(){nr||(nr=!0,Ve("session-state",n=>{const e=n;if(!e.sessionId||!e.status)return;const t=e.status==="running"?"Turn started":e.status==="idle"?"Turn complete":e.status==="error"?"Turn error":`Session ${e.status}`;jn(t)}),Ve("service.changed",n=>{const e=n;if(!e.service)return;const t=e.service.name??e.service.id??"service",o=e.service.status??"unknown";jn(`${t}: ${o}`)}),Ve("token.changed",n=>{const e=n;!e.session_id||!e.total_output||jn(`Token update: +${e.total_output} output`)}))}Ia();const ei=new Set(["http:","https:"]),Ta=new Set(["\\href","\\url"]),Ra=/^data:image\/(?:avif|gif|jpeg|png|webp);base64,[a-z0-9+/]+={0,2}$/i,Na=/^(?:\/|\.\/)?assets\//,$a=/%(?:2e|2f|5c)/i,ti=/[\u0000-\u001f\u007f]/;function No(n){const e=n.trim();if(!/^https?:\/\//i.test(e)||ti.test(e))return null;try{const t=new URL(e);return ei.has(t.protocol)?t.href:null}catch{return null}}function Da(n){if(!Na.test(n)||n.startsWith("//")||n.includes("\\")||$a.test(n))return null;try{const e=new URL(n,"https://genericagent.invalid/");return e.origin==="https://genericagent.invalid"&&e.pathname.startsWith("/assets/")?n:null}catch{return null}Line truncated
/new 新会话 /clear 清屏 /stop 停止 /settings 设置`,"slash.unknown":"未知命令","upload.hint":"上传文件:选择 / 拖拽 / 粘贴","upload.button":"上传文件","upload.tooLarge":"文件过大或数量超限","upload.empty":"跳过空文件","upload.failed":"上传失败","err.charLimit":"已达字数上限({n}),发送时将自动截断","err.charLimitReached":"已达字数上限({n})","err.numMax":"不能超过 {n}","file.openFailed":"无法打开文件","file.kindGeneric":"文件","file.kindDoc":"文档","file.kindSheet":"表格","file.kindSlide":"幻灯片","file.kindCode":"代码","file.kindArchive":"压缩包","file.kindAudio":"音频","file.kindVideo":"视频","upload.removeTitle":"移除","upload.dropHint":"松开以上传文件","lightbox.closeTitle":"关闭","fold.thinking":"思考","fold.tool":"工具调用","fold.toolResult":"工具结果","fold.llm":"LLM Running","fold.turn":"第 {n} 轮","plan.header":"计划 ({done}/{total})","plan.complete":"✓ 计划完成 ({n}/{n})","plan.running":"计划执行中","plan.completeTitle":"计划完成","plan.placeholder":"计划模式已激活","plan.waiting":"等待写入 {path} …","plan.overflow":"还有 {n} 项","plan.current":"当前","plan.collapse":"收起","plan.expand":"展开","plan.details":"详情","plan.capsuleRunning":"运行中","plan.capsuleComplete":"已完成","timing.elapsed":"已运行 {t}","chip.plan":"Plan","chip.auto":"Auto","ch.wechat":"微信","ch.wecom":"企业微信","ch.lark":"飞书","ch.dingtalk":"钉钉","ch.qq":"QQ","ch.telegram":"Telegram","ch.discord":"Discord","ch.loading":"加载中…","ch.empty":"未发现 IM 进程脚本","ch.logEmpty":"暂无日志","err.channelLoad":"加载失败","err.channelStart":"启动失败","err.channelStop":"停止失败","err.mykeyImport":"导入模型配置失败","err.mykeyExport":"导出模型配置失败","err.channelNotConfigured":"请先在密钥配置中完成该平台设置","sys.channelStarted":"已启动","sys.channelStopped":"已停止","sys.bridgeDisconnecting":"正在断开本地连接","modal.channelLogs":"进程日志","modal.mykeyConfig":"密钥配置","sys.configSaved":"配置已保存","sys.mykeyImported":"模型配置已导入","sys.mykeyExported":"模型配置已导出","st.starting":"启动中…","st.stopping":"停止中…","st.online":"在线","st.offline":"离线","st.error":"错误","st.running":"运行中","st.stopped":"已停止","st.abnormal":"异常","st.warning":"警告","err.portBusy":"端口被占用,已自动重连","err.conductorCrash":"内部线程异常退出","err.missingModule":"缺少依赖模块","err.connRefused":"连接被拒绝,将自动重试","err.timeout":"连接超时","err.apiKeyInvalid":"API Key 无效或已过期","err.modelNotFound":"模型不存在或不可用","err.rateLimit":"请求频率超限,请稍后重试","err.quotaExceeded":"额度不足","err.processCrash":"后台进程异常退出","act.configure":"配置","act.logs":"日志","act.restart":"重启","act.stop":"停止","act.start":"启动","act.disconnect":"断开","act.copy":"复制","act.copied":"已复制","act.copyTex":"TeX","act.send":"发送","proc.imbotWechat":"imbot · 微信","proc.imbotDing":"imbot · 钉钉","proc.bridge":"本地连接","proc.bridgeSummary":"连接桌面应用与本地运行环境","proc.bridgeTip":"保持桌面应用与本地运行环境通信","proc.scheduler":"定时任务","proc.schedulerSummary":"按计划自动执行任务","proc.schedulerTip":"在设定时间自动触发并执行任务","proc.conductor":"指挥家","proc.conductorSummary":"异步处理多步骤任务","proc.conductorTip":"通过异步对话拆解任务、分派执行,并持续跟进进度","proc.runtimeComponent":"运行组件","proc.runtimeComponentSummary":"本地运行环境中持续工作的组件","proc.runtimeComponentTip":"查看该组件的状态、日志与控制项","cm.scheduling":"调度中","cm.running":"执行中","cm.idleSt":"空闲","cm.master":"已派 3 子任务","cm.w1":"子任务:抓取数据","cm.w2":"子任务:复核结果","cm.sub":"等待派单","tok.total":"累计","tok.cost":"缓存率","tok.today":"今日","tok.tabAll":"会话","tok.tabConductor":"指挥家","tok.condTotal":"指挥家累计","tok.condCurrent":"指挥家本次","tok.condTip":"指挥家消耗不计入会话累计","tok.condOffline":"指挥家服务离线","tok.disclaimer":"不同 API 网站的计费价格可能会有差异,请以实际网站为准。","tok.colSession":"会话","tok.colIn":"输入","tok.colOut":"输出","tok.colCacheW":"缓存写入","tok.colCache":"缓存读取","tok.colCost":"成本","tok.from":"从","tok.to":"到","tok.reset":"重置","tok.noData":"暂无记录","tok.deleted":"此会话已删除","tok.pricingUnknown":"⚠ 此模型计费规则尚未明确,按默认估算","tok.priceInput":"输入: $","tok.priceOutput":"输出: $","tok.priceCacheW":"缓存写入: $","tok.priceCacheR":"缓存读取: $","presetPrompt.goal":"Line truncated
/new new chat /clear clear /stop stop /settings settings`,"slash.unknown":"Unknown command","upload.hint":"Upload file: pick / drag / paste","upload.button":"Upload file","upload.tooLarge":"File too large or limit reached","upload.empty":"Skipped empty file","upload.failed":"Upload failed","err.charLimit":"Character limit reached ({n}), text will be truncated on send","err.charLimitReached":"Character limit reached ({n})","err.numMax":"Cannot exceed {n}","file.openFailed":"Cannot open file","file.kindGeneric":"File","file.kindDoc":"Document","file.kindSheet":"Spreadsheet","file.kindSlide":"Slides","file.kindCode":"Code","file.kindArchive":"Archive","file.kindAudio":"Audio","file.kindVideo":"Video","upload.removeTitle":"Remove","upload.dropHint":"Drop to upload files","lightbox.closeTitle":"Close","fold.thinking":"Thinking","fold.tool":"Tool call","fold.toolResult":"Tool result","fold.llm":"LLM Running","fold.turn":"Turn {n}","plan.header":"Plan ({done}/{total})","plan.complete":"✓ Plan complete ({n}/{n})","plan.running":"Running plan","plan.completeTitle":"Plan complete","plan.placeholder":"Plan mode activated","plan.waiting":"waiting for {path} …","plan.overflow":"+{n} more","plan.current":"Now","plan.collapse":"Collapse","plan.expand":"Expand","plan.details":"Details","plan.capsuleRunning":"Running","plan.capsuleComplete":"Done","timing.elapsed":"Elapsed {t}","chip.plan":"Plan","chip.auto":"Auto","ch.wechat":"WeChat","ch.wecom":"WeCom","ch.lark":"Lark","ch.dingtalk":"DingTalk","ch.qq":"QQ","ch.telegram":"Telegram","ch.discord":"Discord","ch.loading":"Loading…","ch.empty":"No IM process scripts found","ch.logEmpty":"No log output yet","err.channelLoad":"Failed to load","err.channelStart":"Start failed","err.channelStop":"Stop failed","err.mykeyImport":"Failed to import model config","err.mykeyExport":"Failed to export model config","err.channelNotConfigured":"Complete this platform setup in Key configuration first","sys.channelStarted":"Started","sys.channelStopped":"Stopped","sys.bridgeDisconnecting":"Disconnecting from the local runtime","modal.channelLogs":"Process logs","modal.mykeyConfig":"Key configuration","sys.configSaved":"Configuration saved","sys.mykeyImported":"Model config imported","sys.mykeyExported":"Model config exported","st.starting":"Starting…","st.stopping":"Stopping…","st.online":"Online","st.offline":"Offline","st.error":"Error","st.running":"Running","st.stopped":"Stopped","st.abnormal":"Error","st.warning":"Warning","err.portBusy":"Port was busy, reconnected","err.conductorCrash":"Internal thread crashed","err.missingModule":"Missing module","err.connRefused":"Connection refused, retrying","err.timeout":"Connection timed out","err.apiKeyInvalid":"API key invalid or expired","err.modelNotFound":"Model not found or unavailable","err.rateLimit":"Rate limited, try again later","err.quotaExceeded":"Quota exceeded","err.processCrash":"Background process crashed","act.configure":"Configure","act.logs":"Logs","act.restart":"Restart","act.stop":"Stop","act.start":"Start","act.disconnect":"Disconnect","act.copy":"Copy","act.copied":"Copied","act.copyTex":"TeX","act.send":"Send","proc.imbotWechat":"imbot · WeChat","proc.imbotDing":"imbot · DingTalk","proc.bridge":"Local connection","proc.bridgeSummary":"Connects the desktop app to the local runtime","proc.bridgeTip":"Keeps the desktop app and local runtime communicating","proc.scheduler":"Scheduled tasks","proc.schedulerSummary":"Runs tasks on schedule","proc.schedulerTip":"Triggers and runs tasks at configured times","proc.conductor":"Conductor","proc.conductorSummary":"Handles multi-step work asynchronously","proc.conductorTip":"Uses async conversations to break down, delegate, and follow through on tasks","proc.runtimeComponent":"Runtime component","proc.runtimeComponentSummary":"A component that runs in the local environment","proc.runtimeComponentTip":"View this component’s status, logs, and controls","cm.scheduling":"Scheduling","cm.running":"Running","cm.idleSt":"Idle","cm.master":"Dispatched 3 subtasks","cm.w1":"Subtask: fetch data","cm.w2":"Subtask: review results","cm.sub":"Waiting for tasks","tok.total":"Total","tok.cost":"Cache rate","tok.today":"Today","tok.tabAll":"Chat","tok.tabConductor":"Conductor","tok.condTotal":"Conductor Total","tok.condCurrent":"Conductor Current","tok.condTip":"Conductor usage is not included in chat totals","tok.condOffline":"Service offline","tok.disclaimer":"Pricing may vary by API provider. Please refer to the actual website.","tok.colSession":"Session","tok.colIn":"Input","tok.colOut":"Output","tok.colCacheW":"Cache write","tok.colCache":"Cache read","tok.colCost":"Cost","tok.from":"From","tok.to":"To","tok.reset":"Reset","tok.noData":"No records","tok.deleted":"Session deleted","tok.pricingUnknown":"⚠ Pricing not confirmed, using defaults","tok.priceInput":"Input: $","tok.priceOutput":"Output: $","tok.priceCacheW":"Cache write: $","tok.priceCacheR":"Cache read: $","presetPromptLine truncated
`)}),i.jsxs("div",{className:"ga-bridge-panel-section-foot",children:[_&&i.jsx("span",{className:"ga-bridge-panel-truncated",children:e("bridge.logLineCount",{count:m})}),i.jsxs("button",{className:"ga-bridge-panel-link-btn",onClick:k,children:[e("bridge.viewAllLogs")," →"]})]})]})]})}const uu=[{key:"services",icon:"symbol-misc",textKey:"nav.services"},{key:"collab",icon:"robot",textKey:"nav.collab"},{key:"token",icon:"graph",textKey:"nav.token"}];function pu(){const{activePage:n,setPage:e}=Te(),t=Z(O=>O.open),o=G(O=>O.newSession),r=G(O=>O.sessions),s=G(O=>O.activeSessionId),l=G(O=>O.setActiveSession),c=G(O=>O.runningSessions),{t:u}=he(),[p,d]=a.useState(!0),[m,f]=a.useState(""),[y,b]=a.useState(!1),[x,C]=a.useState(!1),S=a.useCallback(()=>b(!1),[]),k=a.useCallback(()=>{S(),t()},[S,t]),_=a.useCallback(()=>{C(!1),b(O=>!O)},[]),v=[...r].sort((O,D)=>{if(O.pinned&&!D.pinned)return-1;if(!O.pinned&&D.pinned)return 1;const P=Number(O.updatedAt||O.createdAt||0);return Number(D.updatedAt||D.createdAt||0)-P}),j=m.trim()?v.filter(O=>O.title.toLowerCase().includes(m.trim().toLowerCase())):v;function w(){o(),e("chat")}function E(O){l(O),e("chat")}return i.jsxs("div",{className:"ga-left-sidebar",children:[i.jsxs("nav",{className:"ga-nav-rail","aria-label":"Main navigation",children:[i.jsxs("button",{type:"button",className:"ga-nav-btn",onClick:w,"aria-label":u("nav.chat"),children:[i.jsx("span",{className:"ga-nav-icon",children:i.jsx(Pe,{name:"comment",size:"1rem"})}),i.jsx("span",{className:"ga-nav-label",children:u("nav.chat")})]}),uu.map(O=>i.jsxs("button",{type:"button",className:`ga-nav-btn${n===O.key?" active":""}`,onClick:()=>e(O.key),"aria-label":u(O.textKey),"aria-current":n===O.key?"page":void 0,children:[i.jsx("span",{className:"ga-nav-icon",children:i.jsx(Pe,{name:O.icon,size:"1rem"})}),i.jsx("span",{className:"ga-nav-label",children:u(O.textKey)})]},O.key))]}),i.jsx("div",{className:"ga-sidebar-search",children:i.jsx(dt,{prefix:i.jsx(ni,{style:{fontSize:14}}),placeholder:u("search.placeholder"),size:"small",value:m,onChange:f})}),!m&&i.jsx(Bd,{label:u("section.sessions"),count:r.length,open:p,onToggle:d,onAction:w}),i.jsx("div",{className:"ga-session-section",children:(m||p)&&(j.length===0?i.jsx("div",{className:"ga-session-empty",children:i.jsx("p",{children:u(m?"search.noResults":"conv.emptyList")})}):i.jsx("div",{className:"ga-session-list",children:j.map(O=>i.jsx(Wd,{session:O,isActive:O.id===s,isWorking:c.has(O.id),onClick:()=>E(O.id)},O.id))}))}),i.jsxs("div",{className:"ga-sidebar-footer",children:[i.jsx(Ae,{content:u("foot.settings"),position:"top",clickToHide:!0,children:i.jsx("button",{type:"button",className:"ga-sidebar-footer-btn",onClick:k,"aria-label":u("foot.settings"),children:i.jsx(Pe,{name:"settings-gear",size:"1rem"})})}),i.jsxs("div",{className:"ga-sidebar-footer-anchor",children:[i.jsx(Ae,{content:u("foot.runtimeManagement"),position:"top",visible:x&&!y,onVisibleChange:C,children:i.jsx("button",{type:"button",className:"ga-sidebar-footer-btn",onClick:_,"aria-label":u("foot.runtimeManagement"),"aria-expanded":y,"aria-haspopup":"dialog","aria-controls":"ga-runtime-management-panel",children:i.jsx(Pe,{name:"server-process",size:"1rem"})})}),y&&i.jsx(du,{onClose:S})]})]})]})}const hu=24;function mu(){const n=a.useRef(null),[e,t]=a.useState(!0),o=a.useRef(!0),r=a.useRef(0),s=a.useCallback(()=>{const u=n.current;if(!u)return;const p=u.scrollHeight-u.scrollTop-u.clientHeight<hu;t(p),o.current=p},[]),l=a.useCallback((u="instant")=>{const p=n.current;p&&(u==="instant"?p.scrollTop=p.scrollHeight:fu(p,p.scrollHeight-p.clientHeight,170),o.current=!0,t(!0))},[]),c=a.useCallback(()=>{o.current=!1},[]);return a.useEffect(()=>{const u=n.current;if(!u)return;const p=()=>s(),d=new MutationObserver(()=>{o.current&&(cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{u.scrollTop=u.scrollHeight}))});return u.addEventListener("scroll",p,{passive:!0}),d.observe(u,{childList:!0,subtree:!0,characterData:!0}),()=>{u.removeEventListener("scroll",p),d.disconnect(),cancelAnimationFrame(r.current)}},[s]),{scrollRef:n,isAtBottom:e,scrollToBottom:l,stopScroll:c}}function fu(n,e,t){const o=n.scrollTop,r=e-o,s=performance.now();function l(c){const u=c-s,p=Math.min(u/t,1),d=1-Math.pow(1-p,3);n.scrollTop=o+r*d,p<1&&requestAnimationFrame(l)}requestAnimationFrame(l)}function gu(n,e,t,o){a.useEffect(()=>{const r=n.current;if(!r||!o)return;t(),r.scrollTop=r.scrollHeight;let s=0,l=r.scrollHeight,c=0;function u(){if(r){if(c++,r.scrollHeight===l?s++:(s=0,l=r.scrollHeight,r.scrollTop=r.scrollHeight),s>=5||c>=90){e("instant");return}requestAnimationFrame(u)}}requestAnimationFrame(u)},[o,n,e,t])}function yu({children:n}){return i.jsx("div",{"data-slot":"aui_thread-content",children:n})}function gt(n){const e=/^[ \t]*(`{3,})([^\n`]*)[ \t]*$/.exec(n??"");return e?{ticks:e[1].length,tag:e[2]}:null}function vi(n,e){if(/^🛠️ Tool:/.test(n))return!0;if(!(e!=null&&e.forToolResult)){const t=gt(n);if(t&&t.ticks>=5&&t. Line truncated
`),nextLine:l+1}}function wi(n,e){const t=gt(n[e]);if(!t||t.ticks<5||t.tag!=="")return null;const o=e+1,r=vn(n,o,{forToolResult:!0}),s=xn(n,o,r,t.ticks);return s<0?null:{body:n.slice(o,s).join(`
`),nextLine:s+1}}function bu(n,e){if(xi(n,e))return null;const t=/^🛠️ Tool: `([^`]+)`/.exec(n[e]||"");if(!t)return null;const o=gt(n[e+1]);let r,s;if(o&&o.tag==="text"){if(r=e+2,s=vn(n,r),xn(n,r,s,o.ticks)>=0)return null}else{r=e+1,s=n.length;for(let l=e+1;l<n.length;l++)if(vi(n[l])){s=l;break}}return{name:t[1],body:n.slice(r,s).join(`
`),nextLine:s,inFlight:!0}}function vu(n,e){if(wi(n,e))return null;const t=gt(n[e]);if(!t||t.ticks<5||t.tag!=="")return null;const o=e+1,r=vn(n,o,{forToolResult:!0});return xn(n,o,r,t.ticks)>=0?null:{body:n.slice(o,r).join(`
`),nextLine:r,inFlight:!0}}function xu(n){return n.replace(/^\s*\**LLM Running \(Turn \d+\) \.\.\.\**\s*/i,"")}function wu(n,e){const t=String(n||"").split(`
`),o=[];let r=0,s=0;const l=c=>{c<=r||(o.push(t.slice(r,c).join(`
`)),r=c)};for(;s<t.length;){const c=xi(t,s);if(c){l(s),o.push(e.onTool(c.name,c.body)),s=c.nextLine,r=s;continue}const u=wi(t,s);if(u){l(s),o.push(e.onResult(u.body)),s=u.nextLine,r=s;continue}const p=bu(t,s);if(p){l(s),o.push(e.onTool(p.name,p.body,{inFlight:!0})),s=p.nextLine,r=s;continue}const d=vu(t,s);if(d){l(s),o.push(e.onResult(d.body,{inFlight:!0})),s=d.nextLine,r=s;continue}s++}return l(t.length),o.join("")}function Cu(n){const e=n.split(`
`),t=[];let o=!1;for(const r of e){if(/candidates:/i.test(r)){o=!0;continue}if(o){const s=/^\s*-\s*(.+)/.exec(r);s&&t.push(s[1].trim())}}if(t.length===0)try{const r=JSON.parse(n);if(Array.isArray(r==null?void 0:r.candidates))return r.candidates.map(String)}catch{}return t}function Su(n){const e=n.split(`
`),t=[];for(const o of e){if(/candidates:/i.test(o))break;const r=o.replace(/^["{\s]*question[":\s]*/i,"").replace(/[",}\s]*$/,"");r&&t.push(r)}if(t.length>0)return t.join(`
`);try{const o=JSON.parse(n);if(o!=null&&o.question)return String(o.question)}catch{}return n.trim()}function Lo(n){const e=[];let t=xu(n);const o=[];t=t.replace(/<thinking>([\s\S]*?)<\/thinking>/gi,(u,p)=>(o.push(p),`
§§THINK:${o.length-1}§§
`));const r=[];t=t.replace(/<summary>([\s\S]*?)<\/summary>/gi,(u,p)=>(r.push(p),`
§§SUMMARY:${r.length-1}§§
`));const s=[],l=[];t=wu(t,{onTool(u,p,d){return s.push({name:u,body:p,inFlight:d==null?void 0:d.inFlight}),`
§§TOOL:${s.length-1}§§
`},onResult(u,p){return l.push({body:u,inFlight:p==null?void 0:p.inFlight}),`
§§RESULT:${l.length-1}§§
`}}),t=t.replace(/<function_calls>[\s\S]*?<\/function_calls>/gi,u=>(s.push({name:"function_call",body:u}),`
§§TOOL:${s.length-1}§§
`)),t=t.replace(/<function_results>[\s\S]*?<\/function_results>/gi,u=>(l.push({body:u}),`
§§RESULT:${l.length-1}§§
`));const c=t.split(/\n?(§§(?:THINK|TOOL|RESULT|SUMMARY):\d+§§)\n?/);for(const u of c){const p=/^§§THINK:(\d+)§§$/.exec(u);if(p){e.push({type:"thinking",content:o[Number(p[1])]});continue}const d=/^§§TOOL:(\d+)§§$/.exec(u);if(d){const b=s[Number(d[1])];if(b.name==="ask_user"){const x=Cu(b.body),C=Su(b.body);e.push({type:"approval",content:C,candidates:x})}else e.push({type:"tool",content:b.body,label:b.name,inFlight:b.inFlight});continue}const m=/^§§RESULT:(\d+)§§$/.exec(u);if(m){const b=l[Number(m[1])];e.push({type:"result",content:b.body,inFlight:b.inFlight});continue}const f=/^§§SUMMARY:(\d+)§§$/.exec(u);if(f){e.push({type:"summary",content:r[Number(f[1])]});continue}const y=u.trim();y&&e.push({type:"prose",content:y})}return e}function Kr(n){return n.map((e,t)=>{const o=Lo(e),r=o.reduce((s,l)=>s+l.content.length,0);return{index:t,segments:o,weight:r}})}function ku(n){const e=[];let t=0;for(;t<n.length;){const o=n[t];if(o.role==="user"){const r=n[t+1];if(r&&r.role==="assistant"){const s=r.turn_segs??(r.content?[r.content]:[]),l=Kr(s);e.push({kind:"turn",userMsg:o,assistantMsg:r,turns:l}),t+=2}else e.push({kind:"standalone",msg:o}),t++}else{if(o.role==="assistant"){const r=o.turn_segs??(o.content?[o.content]:[]),s=Kr(r);e.push({kind:"turn",userMsg:{id:"__synthetic__",role:"user",content:"",status:"completed"},assistantMsg:o,turns:s})}else e.push({kind:"standalone",msg:o});t++}}return e}const Xe=[{id:"plan",title:"Plan",desc:{en:"Explore, plan, execute, verify",zh:"探索、规划、执行、验证"},prompt:"Enter Plan mode: read memory/plan_sop.md, follow Explore → Plan → Execute → Verify flow for the task I describe next."},{id:"goal",title:"Goal",desc:{en:"Achieve a specific objective autonomously",zh:"自主达成指定目标"},prompt:"Enter Goal mode: read L3 goal mode SOP, autonomously achieve the goal I describe next."},{id:"autonomous",title:"Autonomous",desc:{en:"Select tasks and execute independently",zh:"自主选取任务并独立执行"},prompt:"Enter autonomous mode: read memory/autonomous_operation_sop.md, select or plan tasks, execute independently and produce a report."},{id:"hive",title:"Hive",desc:{en:"Multi-agent parallel collaboration",zh:"多 agent 并行协作"},prompt:"Start Goal Hive mode: follow hive SOP, spawn multiple workers to collaboratively achieve my next goal."},{id:"review",title:"Review",desc:{en:"Critical review of latest output",zh:"对最近产出做严格复核"},prompt:"Enter reviewer mode: rigorously critique the latest output, check each item and report issues."},{id:"findwork",title:"Find Work",desc:{en:"Analyze context, suggest next tasks",zh:"分析当前情况,推荐下一步"},prompt:"Analyze my situation using the autonomous planning approach, generate a batch of TODOs that would interest me."}];function ju(n){for(const e of Xe)if(n.startsWith(e.prompt)){const t=n.slice(e.prompt.length).trimStart();return{id:e.id,rest:t}}return null}function Eu(n){return n?n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`:""}function Ou(n){var t;const e=((t=n.split(".").pop())==null?void 0:t.toLowerCase())||"";return["js","ts","tsx","jsx","py","rs","go","c","cpp","java"].includes(e)?"◇":["json","yaml","yml","toml","xml"].includes(e)?"{}":["md","txt","log","csv"].includes(e)?"¶":["pdf"].includes(e)?"⊞":"◎"}function Pu({text:n}){const[e,t]=a.useState(!1),o=a.useRef(),r=a.useCallback(s=>{s.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{t(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>t(!1),2e3)})},[n]);return typeof navigator>"u"||!navigator.clipboard?null:i.jsx("button",{"data-slot":"user-bubble-copy",onClick:r,title:e?"Copied":"Copy",children:e?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M3 8.5l3 3 7-7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("rect",{x:"5.5",y:"5.5",width:"7",height:"7",rx:"1",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M3.5 10.5v-7a1 1 0 011-1h7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})})}const Ci=a.memo(function({content:e,msgId:t,images:o,files:r}){const s=a.useRef(null),[l,c]=a.useState(!1),[u,p]=a.useState(!1),d=a.useRef(!1);if(d.current=u,a.useLayoutEffect(()=>{const f=s.current;if(!f)return;const y=new ResizeObserver(()=>{d.current||c(f.scrollHeight>f.clientHeight+2)});return y.observe(f),()=>y.disconnect()},[]),!e&&(!o||o.length===0)&&(!r||r.length===0))return null;const m=ju(e);return i.jsxs(i.Fragment,{children:[o&&o.length>0&&i.jsx("div",{"data-slot":"user-images",children:o.map((f,y)=>i.jsx("img",{"data-slot":"user-image-thumb",src:f.path.startsWith("data:")?f.path:`${ne}/upload/raw?path=${encodeURIComponent(f.path)}`,alt:f.name},y))}),r&&r.length>0&&i.jsx("div",{"data-slot":"user-files",children:r.map((f,y)=>i.jsxs("div Line truncated
`)},[]);return i.jsxs("div",{"data-slot":"aui_assistant-message-root","data-role":"assistant","data-streaming":t||void 0,children:[i.jsx(zu,{segments:o,isStreaming:t,messageId:String(e.id)}),i.jsx(Bu,{getMessageText:s,executionMs:e.executionMs})]})}),Vu=a.memo(function({userMsg:e,assistantMsg:t,isStreaming:o}){return i.jsxs("div",{"data-slot":"aui_turn-pair",children:[i.jsx(Ci,{content:e.content,msgId:e.id,images:e.images,files:e.files}),i.jsx(Uu,{message:t,isStreaming:o})]})}),Ku=[{pattern:/invalid.?api.?key|api.?key.?invalid|Incorrect API key/i,key:"err.apiKeyInvalid"},{pattern:/model.*not found|does not exist|model_not_found/i,key:"err.modelNotFound"},{pattern:/rate.?limit|429|Too Many Requests/i,key:"err.rateLimit"},{pattern:/quota|insufficient.?funds|balance|billing/i,key:"err.quotaExceeded"},{pattern:/timed?\s*out|TimeoutError/i,key:"err.timeout"},{pattern:/Connection\s*refused|ConnectionRefusedError/i,key:"err.connRefused"},{pattern:/errno 48|address already in use/i,key:"err.portBusy"},{pattern:/Traceback|Exception.*thread|exit code \d+/i,key:"err.processCrash"}];function Wu(n,e){if(!n)return"";for(const t of Ku)if(t.pattern.test(n))return e(t.key);return n.length<=80?n:n.slice(0,77)+"…"}const Hu=a.memo(function({error:e,msgId:t}){const{t:o}=he(),r=Wu(e,o);return i.jsx("div",{className:"ga-inline-error",role:"alert",id:`msg-${t}`,children:i.jsx("span",{className:"ga-inline-error-text",children:r})})}),Zu=300;function qu(n){return n.kind==="turn"?n.turns.reduce((e,t)=>e+t.segments.length,0):1}const Gu=a.memo(function({messages:e,isRunning:t,budgetMultiplier:o,onShowEarlier:r,scrollRef:s}){const l=a.useMemo(()=>ku(e),[e]),c=a.useRef(null),u=a.useMemo(()=>{if(!isFinite(o))return 0;const f=Zu*o;let y=0;for(let b=l.length-1;b>=0;b--)if(y+=qu(l[b]),y>f)return b+1;return 0},[l,o]),p=a.useMemo(()=>l.slice(u),[l,u]),d=u;a.useLayoutEffect(()=>{c.current!==null&&(s!=null&&s.current)&&(s.current.scrollTop=s.current.scrollHeight-c.current,c.current=null)});const m=()=>{const f=s==null?void 0:s.current;f&&(c.current=f.scrollHeight-f.scrollTop),r()};return e.length===0?i.jsx("div",{"data-slot":"thread-empty",children:i.jsx("p",{children:"Send a message to begin."})}):i.jsxs(i.Fragment,{children:[d>0&&i.jsxs("button",{"data-slot":"show-earlier-btn",onClick:m,children:["Show ",d," earlier messages"]}),p.map((f,y)=>{const b=u+y;return f.kind==="turn"?i.jsx(Vu,{userMsg:f.userMsg,assistantMsg:f.assistantMsg,isStreaming:t&&b===l.length-1},f.assistantMsg.id):f.msg.role==="user"?i.jsx("div",{"data-slot":"aui_turn-pair",children:i.jsx(Ci,{content:f.msg.content,msgId:f.msg.id,images:f.msg.images,files:f.msg.files})},f.msg.id):f.msg.role==="error"?i.jsx(Hu,{error:f.msg.content,msgId:f.msg.id},f.msg.id):i.jsx("div",{"data-slot":"standalone-message","data-status":f.msg.status,children:f.msg.content},f.msg.id)})]})}),qr=3,Gr=40,Qu=170,Qr=12;function Yr(n){const e=n.replace(/\s+/g," ").trim();return e.length<=Gr?e:e.slice(0,Gr)+"…"}function Yu(n){return 1-Math.pow(1-n,3)}let Jn=0;function Xu(n,e,t){cancelAnimationFrame(Jn);const o=n.scrollTop,r=e-o;if(Math.abs(r)<1)return;const s=performance.now();function l(c){const u=c-s,p=Math.min(u/t,1);n.scrollTop=o+r*Yu(p),p<1&&(Jn=requestAnimationFrame(l))}Jn=requestAnimationFrame(l)}const Ju=a.memo(function({messages:e,stopScroll:t,onJumpToCollapsed:o}){const r=a.useMemo(()=>e.filter(b=>b.role==="user").map(b=>({id:b.id,content:b.content})),[e]),[s,l]=a.useState(null),[c,u]=a.useState(!1),p=a.useRef(null),d=a.useRef(0),m=a.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null),u(!0)},[]),f=a.useCallback(()=>{p.current=setTimeout(()=>{u(!1),p.current=null},150)},[]);a.useEffect(()=>{if(r.length<qr)return;const b=document.querySelector('[data-slot="aui_thread-viewport"]');if(!b)return;function x(){if(d.current=0,!b)return;const S=b.getBoundingClientRect().top;let k=null;for(const _ of r){const v=document.getElementById(`msg-${_.id}`);if(!v)continue;if(v.getBoundingClientRect().top-S<=Qr)k=_.id;else break}!k&&r.length>0&&(k=r[0].id),k&&l(k)}function C(){d.current||(d.current=requestAnimationFrame(x))}return b.addEventListener("scroll",C,{passive:!0}),x(),()=>{b.removeEventListener("scroll",C),cancelAnimationFrame(d.current)}},[r]);const y=a.useCallback(b=>{const x=document.querySelector('[data-slot="aui_thread-viewport"]'),C=document.getElementById(`msg-${b}`);if(!C){o(b);return}if(!x)return;t();const _=(C.closest('[data-slot="aui_turn-pair"]')||C).offsetTop-Qr;Xu(x,_,Qu)},[t,o]);return r.length<qr?null:i.jsx("nav",{"data-slot":"user-turn-rail","data-expanded":c||void 0,"aria-label":"User message navigation",children:i.jsxs("div",{"data-slot":"rail-hitarea",onMouseEnter:m,onMouseLeave:f,children:[i.jsx("div",{"data-slot":"rail-panel","aria-hidden":!c,children:r.map(b=>i.jsx("button",{"data-slot":"rail-panel-item","data-active":b.id===s||void 0,onClick:()=>y(b.id),children:Yr(b.content)},b.id))}),i.jsx("div",{"data-slot":"rail-marks",children:r.map(b=>i.jsx("button",{"data Line truncated
`;else{const o=Io(t);o&&(e+=`
`+o)}return e}function t0(n){const e=Array.from(n.childNodes);for(const t of e)if(t instanceof HTMLElement){if(t.dataset.refText||t.tagName==="BR")continue;if(t.tagName==="DIV"||t.tagName==="P"){const o=document.createElement("br");for(n.insertBefore(o,t);t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}}n.normalize()}function ji(n){const e=document.createRange();e.selectNodeContents(n),e.collapse(!1);const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function Xr(n,e){n.focus();const t=window.getSelection();if(!t||t.rangeCount===0){n.appendChild(e);return}const o=t.getRangeAt(0);o.deleteContents(),o.insertNode(e),o.setStartAfter(e),o.collapse(!0),t.removeAllRanges(),t.addRange(o)}function n0(n,e){n.textContent=e,ji(n)}function o0(n,e,t){const o=document.createElement("span");return o.contentEditable="false",o.dataset.refText=`@${n}:\`${e}\``,o.dataset.refKind=n,o.className="ref-chip",o.innerHTML=`<span class="ref-chip-icon">${l0(n)}</span><span class="ref-chip-label">${a0(t||e)}</span>`,o}function r0(n,e,t,o){const r=o0(e,t,o);Xr(n,r);const s=document.createTextNode(" ");Xr(n,s)}function s0(n,e){const t=document.createElement("span");return t.contentEditable="false",t.dataset.refText=e,t.dataset.skillId=n,t.className="skill-chip",t.textContent=`/${n}`,t}function i0(n,e,t){n.textContent="";const o=s0(e,t);n.appendChild(o);const r=document.createTextNode(" ");n.appendChild(r),ji(n)}function a0(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function l0(n){switch(n){case"file":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><path d="M4 2h5l4 4v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z" stroke="currentColor" stroke-width="1.2"/><path d="M9 2v4h4" stroke="currentColor" stroke-width="1.2"/></svg>';case"url":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><path d="M6.5 9.5l3-3M7 11l-1.5 1.5a2.12 2.12 0 1 1-3-3L4 8m5-3l1.5-1.5a2.12 2.12 0 1 1 3 3L12 8" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>';case"image":return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><rect x="2" y="2" width="12" height="12" rx="1" stroke="currentColor" stroke-width="1.2"/><circle cx="5.5" cy="5.5" r="1" fill="currentColor"/><path d="M2 11l3-3 2 2 3-3 4 4" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/></svg>';default:return'<svg width="12" height="12" viewBox="0 0 16 16" fill="none"><circle cx="8" cy="8" r="5" stroke="currentColor" stroke-width="1.2"/></svg>'}}const c0=a.forwardRef(function({placeholder:e,disabled:t,onInput:o,onKeyDown:r,onSlashTrigger:s,onSlashDismiss:l,onAtTrigger:c,onAtDismiss:u,onPasteFiles:p},d){const m=a.useRef(null),f=a.useRef(!1),y=a.useRef("");a.useImperativeHandle(d,()=>({focus(){var v;(v=m.current)==null||v.focus()},clear(){m.current&&(m.current.textContent="",y.current="")},getText(){return m.current?Io(m.current):""},setText(v){m.current&&(n0(m.current,v),y.current=v,o(v))},insertChip(v,j,w){m.current&&(m.current.focus(),r0(m.current,v,j,w),b())},setSkillChip(v,j){m.current&&(i0(m.current,v,j),b())},getElement(){return m.current}}));const b=a.useCallback(()=>{if(!m.current)return;const v=Io(m.current);y.current=v,o(v);const j=v.trimStart();j.startsWith("/")&&!j.includes(`
`)?s==null||s(j.slice(1)):l==null||l();const w=v.match(/@([^\s@]*)$/);w?c==null||c(w[1]):u==null||u()},[o,s,l,c,u]),x=a.useCallback(()=>{f.current||(m.current&&t0(m.current),b())},[b]),C=a.useCallback(()=>{f.current=!0},[]),S=a.useCallback(()=>{f.current=!1,x()},[x]),k=a.useCallback(v=>{f.current||v.nativeEvent.isComposing||v.keyCode===229||r(v)},[r]),_=a.useCallback(v=>{var O;const j=(O=v.clipboardData)==null?void 0:O.items;if(!j)return;const w=[];for(const D of Array.from(j))if(D.type.startsWith("image/")&&D.type!=="image/svg+xml"){const P=D.getAsFile();P&&w.push(P)}if(w.length>0){v.preventDefault(),p==null||p(w);return}const E=v.clipboardData.getData("text/plain");E&&(v.preventDefault(),document.execCommand("insertText",!1,E))},[p]);return a.useEffect(()=>{const v=m.current;if(!v)return;const j=new ResizeObserver(w=>{var O,D,P;const E=((P=(D=(O=w[0])==null?void 0:O.borderBoxSize)==null?void 0:D[0])==null?void 0:P.blockSize)??v.offsetHeight;v.style.setProperty("--editor-scroll-height",`${E}px`)});return j.observe(v),()=>j.disconnect()},[]),i.jsx("div",{ref:m,"data-slot":"composer-rich-input",contentEditable:!t,role:"textbox","aria-multiline":"true","aria-placeholder":e,"data-placeholder":e,suppressContentEditableWarning:!0,onInput:x,onKeyDown:k,onCompositionStart:C,onCompositionEnd:S,onPaste:_})});function d0(){try{const n=localStorage.getItem("ga_custom_presets");return n?JSON.parse(n):[]}catch{return[]}}function u0({visible:n,query:e,onSelect:t,onClose:o}){const r=Z(m=>m.lang),[s,l]=a.useState(0),c=a.useRef(null),u=d0(),p=[...Xe,...u],d=e?p.filter(m=>m.id.startsWith(e.toLowerCase())||m.title.toLowerCase().includes(e.toLowerCase())):p;return a.useEffect(()=>{l(0)},[e]),a.useEffect(()=>{if(!n)return;function m(f){f.key==="ArrowDown"?(f.preventDefault(),l(y=>Math.min(y+1,d.length-1))):f.key==="ArrowUp"?(f.preventDefault(),l(y=>Math.max(y-1,0))):f.key==="Enter"?(f.preventDefault(),d[s]&&t(d[s].id,d[s].prompt)):f.key==="Escape"&&(f.preventDefault(),o())}return document.addEventListener("keydown",m,!0),()=>document.removeEventListener("keydown",m,!0)},[n,s,d,t,o]),a.useEffect(()=>{if(!c.current)return;const m=c.current.querySelector("[data-focused]");m==null||m.scrollIntoView({block:"nearest"})},[s]),!n||d.length===0?null:i.jsx("div",{ref:c,"data-slot":"completion-drawer",children:d.map((m,f)=>i.jsx("button",{"data-slot":"completion-item","data-focused":f===s?"":void 0,onClick:()=>t(m.id,m.prompt),onMouseEnter:()=>l(f),children:i.jsxs("span",{"data-slot":"completion-info",children:[i.jsxs("span",{"data-slot":"completion-title",children:["/",m.id]}),i.jsx("span",{"data-slot":"completion-desc",children:m.desc[r]||m.desc.en})]})},m.id))})}const p0=[{id:"file",label:"file"},{id:"url",label:"url"},{id:"image",label:"image"}];function h0({visible:n,query:e,onConfirm:t,onClose:o}){const r=a.useRef(null),[s,l]=a.useState("file"),[c,u]=a.useState("");a.useEffect(()=>{n&&(u(e),l("file"),setTimeout(()=>{var d;return(d=r.current)==null?void 0:d.focus()},0))},[n,e]),a.useEffect(()=>{if(!n)return;function d(m){m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),o())}return document.addEventListener("keydown",d,!0),()=>document.removeEventListener("keydown",d,!0)},[n,o]);const p=a.useCallback(d=>{d.preventDefault();const m=c.trim();m&&t(s,m)},[s,c,t]);return n?i.jsx("div",{"data-slot":"at-ref-popover",children:i.jsxs("form",{onSubmit:p,"data-slot":"at-ref-form",children:[i.jsx("div",{"data-slot":"at-ref-kinds",children:p0.map(d=>i.jsx("button",{type:"button","data-slot":"at-ref-kind-btn","data-active":d.id===s?"":void 0,onClick:()=>l(d.id),title:d.label,children:i.jsx(m0,{kind:d.id})},d.id))}),i.jsx("input",{ref:r,"data-slot":"at-ref-input",type:"text",value:c,onChange:d=>u(d.target.value),placeholder:s==="url"?"https://...":"path/to/file"}),i.jsx("button",{type:"submit","data-slot":"at-ref-confirm",disabled:!c.trim(),children:"↵"})]})}):null}function m0({kind:n}){switch(n){case"file":return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("path",{d:"M4 2h5l4 4v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("path",{d:"M9 2v4h4",stroke:"currentColor",strokeWidth:"1.2"})]});case"url":return i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:i.jsx("path",{d:"M6.5 9.5l3-3M7 11l-1.5 1.5a2.12 2.12 0 1 1-3-3L4 8m5-3l1.5-1.5a2.12 2.12 0 1 1 3 3L12 8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})});case"image":return i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",children:[i.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.2"}),i.jsx("circle",{cx:"5.5",cy:"5.5",r:"1",fill:"currentColor"}),i.jsx("path",{d:"M2 11l3-3 2 2 3-3 4 4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]});default:return null}}const Jr={title:{zh:"附加",en:"Attach"},file:{zh:"文件…",en:"File…"},image:{zh:"图片…",en:"Image…"},paste: Line truncated
`);U&&(te=te?`${te}
${U}`:U)}else ee.images=V.map(U=>({name:U.name,path:U.path||U.name,base64:U.preview}));n(te||"",Object.keys(ee).length>0?ee:void 0),(Fe=c.current)==null||Fe.clear(),y(""),x([])},[f,b,n]),D=a.useCallback($=>{$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),O())},[O]),P=a.useCallback($=>{y($)},[]),N=a.useCallback($=>{_($)},[]),L=a.useCallback(()=>{_(null)},[]),B=a.useCallback(($,V)=>{var q,R;(q=c.current)==null||q.setSkillChip($,V),(R=c.current)==null||R.focus(),_(null)},[]),Q=a.useCallback($=>{j($)},[]),z=a.useCallback(()=>{j(null)},[]),M=a.useCallback(($,V)=>{var oe,ee,se,te;const q=((oe=c.current)==null?void 0:oe.getText())||"",R=q.lastIndexOf("@");R>=0&&((ee=c.current)==null||ee.setText(q.slice(0,R))),(se=c.current)==null||se.insertChip($,V),(te=c.current)==null||te.focus(),j(null)},[]),Y=a.useCallback($=>{w($)},[w]),fe=a.useCallback($=>{x(V=>V.filter(q=>q.id!==$))},[]),Se=a.useCallback(($,V)=>{var q,R;(q=c.current)==null||q.setSkillChip($,V),(R=c.current)==null||R.focus()},[]),T=a.useCallback(()=>{var $;($=p.current)==null||$.click()},[]),F=a.useCallback(()=>{var $;($=d.current)==null||$.click()},[]),J=a.useCallback(async()=>{try{const $=await navigator.clipboard.read();for(const V of $){const q=V.types.find(R=>R.startsWith("image/"));if(q){const R=await V.getType(q),oe=new File([R],"clipboard-image.png",{type:q});w([oe]);return}}}catch{}},[w]),ce=a.useCallback($=>{$.target.files&&$.target.files.length>0&&w($.target.files),$.target.value=""},[w]);a.useEffect(()=>{var R,oe,ee;const $=(ee=(oe=(R=window.__TAURI__)==null?void 0:R.webview)==null?void 0:oe.getCurrentWebview)==null?void 0:ee.call(oe);if(!$)return;let V,q=!1;return $.onDragDropEvent(se=>{const te=se.payload.type;te==="enter"||te==="over"?S(!0):te==="leave"?S(!1):te==="drop"&&(S(!1),se.payload.paths&&se.payload.paths.length>0&&E(se.payload.paths))}).then(se=>{q?se():V=se}),()=>{q=!0,V==null||V()}},[E]);const ie=f.trim().length>0||b.length>0,ke=b.some($=>$.status==="uploading"),ge=Eh(t,ie,ke);return i.jsxs("div",{ref:u,"data-slot":"composer-root",children:[C&&i.jsx("div",{"data-slot":"composer-drop-overlay",children:"Drop files here"}),i.jsxs("div",{"data-slot":"composer-surface",children:[!r&&i.jsx(Lh,{}),i.jsx(wh,{files:b,onRemove:fe}),i.jsx(u0,{visible:k!==null,query:k||"",onSelect:B,onClose:L}),i.jsx(h0,{visible:v!==null,query:v||"",onConfirm:M,onClose:z}),i.jsx("div",{"data-slot":"composer-input-row",children:i.jsx(c0,{ref:c,placeholder:m,disabled:!1,onInput:P,onKeyDown:D,onSlashTrigger:N,onSlashDismiss:L,onAtTrigger:Q,onAtDismiss:z,onPasteFiles:Y})}),i.jsxs("div",{"data-slot":"composer-toolbar",children:[i.jsxs("div",{"data-slot":"composer-toolbar-left",children:[i.jsx(f0,{onUploadFile:T,onUploadImage:F,onPasteImage:J}),i.jsx(kh,{onSelect:Se})]}),i.jsxs("div",{"data-slot":"composer-toolbar-right",children:[s===void 0?i.jsx(fh,{}):s,i.jsx(Oh,{state:ge,onSend:O,onStop:e,onQueue:O})]})]})]}),i.jsx("input",{ref:p,type:"file",multiple:!0,style:{display:"none"},onChange:ce}),i.jsx("input",{ref:d,type:"file",multiple:!0,accept:"image/*",style:{display:"none"},onChange:ce})]})}const $h="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%201099.5%20105'%20width='1099.5'%20height='105'%20fill='%23000000'%3e%3cg%20transform='translate(-5.6%2088.5)'%3e%3cpath%20d='M62.70%200L20.40%200Q16.40%200%2013-2Q9.60-4%207.60-7.40Q5.60-10.80%205.60-14.80L5.60-14.80L5.60-57.20Q5.60-61.30%207.60-64.65Q9.60-68%2013-70Q16.40-72%2020.40-72L20.40-72L62.70-72Q66.80-72%2070.15-70Q73.50-68%2075.55-64.65Q77.60-61.30%2077.60-57.20L77.60-57.20L77.60-50.40L61.90-50.40L61.90-56.40L21.10-56.40L21.10-15.60L61.90-15.60L61.90-26.40L46.30-26.40L46.30-42L77.60-42L77.60-14.80Q77.60-10.80%2075.55-7.40Q73.50-4%2070.15-2Q66.80%200%2062.70%200L62.70%200ZM161.30%200L94.80%200L94.80-72L161.30-72L161.30-56.40L110.50-56.40L110.50-43.80L151.40-43.80L151.40-28.20L110.50-28.20L110.50-15.60L161.30-15.60L161.30%200ZM192.70%200L177.20%200L177.20-72L193.20-72L233.50-24L233.50-72L249.20-72L249.20%200L233.20%200L192.70-48.20L192.70%200ZM333.10%200L266.60%200L266.60-72L333.10-72L333.10-56.40L282.30-56.40L282.30-43.80L323.20-43.80L323.20-28.20L282.30-28.20L282.30-15.60L333.10-15.60L333.10%200ZM420.90%200L404.90%200L385.00-23.60L364.50-23.60L364.50%200L349.00%200L349.00-71.90L406.10-71.90Q410.20-71.90%20413.55-69.90Q416.90-67.90%20418.95-64.50Q421.00-61.10%20421.00-57.10L421.00-57.10L421.00-38.50Q421.00-34.50%20418.95-31.10Q416.90-27.70%20413.55-25.70Q410.20-23.70%20406.10-23.70L406.10-23.70L405.30-23.70L420.90-5.30L420.90%200ZM364.50-56.40L364.50-39.30L405.30-39.30L405.30-56.40L364.50-56.40ZM450.30%200L435.00%200L435.00-72L450.30-72L450.30%200ZM536.70%200L479.70%200Q475.60%200%20472.25-2Q468.90-4%20466.90-7.35Q464.90-10.70%20464.90-14.80L464.90-14.80L464.90-57.20Q464.90-61.30%20466.90-64.65Q468.90-68%20472.25-70Q475.60-72%20479.70-72L479.70-72L536.70-72L536.70-56.40L483.70-56.40Q482.10-56.40%20481.25-55.60Q480.40-54.80%20480.40-53.10L480.40-53.10L480.40-18.90Q480.40-17.30% Line truncated
`)})]})})]})}return this.props.children}}async function Cm(){const n=document.getElementById("app");va.createRoot(n).render(i.jsx(wm,{children:i.jsx(xm,{})}))}Cm();export{Wn as A,ne as B,ka as C,Ne as D,li as E,dt as F,ue as G,bi as H,Ha as I,mu as J,Z as K,Vd as L,le as M,Nh as N,fh as O,Pe as P,X as Q,et as R,za as S,ze as T,Om as U,Pm as V,Aa as W,No as X,Mo as _,_m as a,he as b,ri as c,Is as d,Wo as e,_i as f,pl as g,Te as h,Lm as i,_o as j,Yl as k,ft as l,Ve as m,G as n,Nl as o,Fl as p,Al as q,Dl as r,qt as s,xl as t,Ps as u,zl as v,Vl as w,Il as x,Kl as y,un as z};
@@ -1,4 +1,4 @@
import{g as ml,aj as jt}from"./tauri-compat-tfiFK9EG.js";import{V as To,W as Co}from"./main-Knf6L_en.js";function br(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ci(e.position):"start"in e||"end"in e?Ci(e):"line"in e||"column"in e?p0(e):""}function p0(e){return zi(e&&e.line)+":"+zi(e&&e.column)}function Ci(e){return p0(e&&e.start)+"-"+p0(e&&e.end)}function zi(e){return e&&typeof e=="number"?e:1}class Be extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},l=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const o=n.indexOf(":");o===-1?a.ruleId=n:(a.source=n.slice(0,o),a.ruleId=n.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=br(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Be.prototype.file="";Be.prototype.name="";Be.prototype.reason="";Be.prototype.message="";Be.prototype.stack="";Be.prototype.column=void 0;Be.prototype.line=void 0;Be.prototype.ancestors=void 0;Be.prototype.cause=void 0;Be.prototype.fatal=void 0;Be.prototype.place=void 0;Be.prototype.ruleId=void 0;Be.prototype.source=void 0;const at={basename:zo,dirname:Mo,extname:Eo,join:Io,sep:"/"};function zo(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mr(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let l=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else l<0&&(a=!0,l=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(n=i):(s=-1,n=l));return r===n?n=l:n<0&&(n=e.length),e.slice(r,n)}function Mo(e){if(Mr(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Eo(e){Mr(e);let t=e.length,r=-1,n=0,i=-1,a=0,l;for(;t--;){const s=e.codePointAt(t);if(s===47){if(l){n=t+1;break}continue}r<0&&(l=!0,r=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function Io(...e){let t=-1,r;for(;++t<e.length;)Mr(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Do(r)}function Do(e){Mr(e);const t=e.codePointAt(0)===47;let r=Bo(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Bo(e,t){let r="",n=0,i=-1,a=0,l=-1,s,o;for(;++l<=e.length;){if(l<e.length)s=e.codePointAt(l);else{if(s===47)break;s=47}if(s===47){if(!(i===l-1||a===1))if(i!==l-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(o=r.lastIndexOf("/"),o!==r.length-1){o<0?(r="",n=0):(r=r.slice(0,o),n=r.length-1-r.lastIndexOf("/")),i=l,a=0;continue}}else if(r.length>0){r="",n=0,i=l,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),n=l-i-1;i=l,a=0}else s===46&&a>-1?a++:a=-1}return r}function Mr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fo={cwd:Ro};function Ro(){return"/"}function d0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Lo(e){if(typeof e=="string")e=new URL(e);else if(!d0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return No(e)}function No(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Rn=["history","path","basename","stem","extname","dirname"];class fl{constructor(t){let r;t?d0(t)?r={path:t}:typeof t=="string"||Po(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Fo.cwd(),this.data={},thLine truncated
import{g as ml,aj as jt}from"./tauri-compat-D_GD_wMe.js";import{W as To,X as Co}from"./main-j7e_THPB.js";function br(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ci(e.position):"start"in e||"end"in e?Ci(e):"line"in e||"column"in e?p0(e):""}function p0(e){return zi(e&&e.line)+":"+zi(e&&e.column)}function Ci(e){return p0(e&&e.start)+"-"+p0(e&&e.end)}function zi(e){return e&&typeof e=="number"?e:1}class Be extends Error{constructor(t,r,n){super(),typeof r=="string"&&(n=r,r=void 0);let i="",a={},l=!1;if(r&&("line"in r&&"column"in r?a={place:r}:"start"in r&&"end"in r?a={place:r}:"type"in r?a={ancestors:[r],place:r.position}:a={...r}),typeof t=="string"?i=t:!a.cause&&t&&(l=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof n=="string"){const o=n.indexOf(":");o===-1?a.ruleId=n:(a.source=n.slice(0,o),a.ruleId=n.slice(o+1))}if(!a.place&&a.ancestors&&a.ancestors){const o=a.ancestors[a.ancestors.length-1];o&&(a.place=o.position)}const s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=br(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Be.prototype.file="";Be.prototype.name="";Be.prototype.reason="";Be.prototype.message="";Be.prototype.stack="";Be.prototype.column=void 0;Be.prototype.line=void 0;Be.prototype.ancestors=void 0;Be.prototype.cause=void 0;Be.prototype.fatal=void 0;Be.prototype.place=void 0;Be.prototype.ruleId=void 0;Be.prototype.source=void 0;const at={basename:zo,dirname:Mo,extname:Eo,join:Io,sep:"/"};function zo(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mr(e);let r=0,n=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else n<0&&(a=!0,n=i+1);return n<0?"":e.slice(r,n)}if(t===e)return"";let l=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){r=i+1;break}}else l<0&&(a=!0,l=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(n=i):(s=-1,n=l));return r===n?n=l:n<0&&(n=e.length),e.slice(r,n)}function Mo(e){if(Mr(e),e.length===0)return".";let t=-1,r=e.length,n;for(;--r;)if(e.codePointAt(r)===47){if(n){t=r;break}}else n||(n=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Eo(e){Mr(e);let t=e.length,r=-1,n=0,i=-1,a=0,l;for(;t--;){const s=e.codePointAt(t);if(s===47){if(l){n=t+1;break}continue}r<0&&(l=!0,r=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||r<0||a===0||a===1&&i===r-1&&i===n+1?"":e.slice(i,r)}function Io(...e){let t=-1,r;for(;++t<e.length;)Mr(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":Do(r)}function Do(e){Mr(e);const t=e.codePointAt(0)===47;let r=Bo(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function Bo(e,t){let r="",n=0,i=-1,a=0,l=-1,s,o;for(;++l<=e.length;){if(l<e.length)s=e.codePointAt(l);else{if(s===47)break;s=47}if(s===47){if(!(i===l-1||a===1))if(i!==l-1&&a===2){if(r.length<2||n!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(o=r.lastIndexOf("/"),o!==r.length-1){o<0?(r="",n=0):(r=r.slice(0,o),n=r.length-1-r.lastIndexOf("/")),i=l,a=0;continue}}else if(r.length>0){r="",n=0,i=l,a=0;continue}}t&&(r=r.length>0?r+"/..":"..",n=2)}else r.length>0?r+="/"+e.slice(i+1,l):r=e.slice(i+1,l),n=l-i-1;i=l,a=0}else s===46&&a>-1?a++:a=-1}return r}function Mr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Fo={cwd:Ro};function Ro(){return"/"}function d0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Lo(e){if(typeof e=="string")e=new URL(e);else if(!d0(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return No(e)}function No(e){if(e.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const n=t.codePointAt(r+2);if(n===70||n===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Rn=["history","path","basename","stem","extname","dirname"];class fl{constructor(t){let r;t?d0(t)?r={path:t}:typeof t=="string"||Po(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":Fo.cwd(),this.data={},thLine truncated
`,u="/",h="*",m="",d="comment",p="declaration";function y(C,A){if(typeof C!="string")throw new TypeError("First argument must be a string");if(!C)return[];A=A||{};var z=1,I=1;function q(Y){var H=Y.match(t);H&&(z+=H.length);var ae=Y.lastIndexOf(o);I=~ae?Y.length-ae:I+Y.length}function O(){var Y={line:z,column:I};return function(H){return H.position=new M(Y),U(),H}}function M(Y){this.start=Y,this.end={line:z,column:I},this.source=A.source}M.prototype.content=C;function G(Y){var H=new Error(A.source+":"+z+":"+I+": "+Y);if(H.reason=Y,H.filename=A.source,H.line=z,H.column=I,H.source=C,!A.silent)throw H}function X(Y){var H=Y.exec(C);if(H){var ae=H[0];return q(ae),C=C.slice(ae.length),H}}function U(){X(r)}function E(Y){var H;for(Y=Y||[];H=V();)H!==!1&&Y.push(H);return Y}function V(){var Y=O();if(!(u!=C.charAt(0)||h!=C.charAt(1))){for(var H=2;m!=C.charAt(H)&&(h!=C.charAt(H)||u!=C.charAt(H+1));)++H;if(H+=2,m===C.charAt(H-1))return G("End of comment missing");var ae=C.slice(2,H-2);return I+=2,q(ae),C=C.slice(H),I+=2,Y({type:d,comment:ae})}}function $(){var Y=O(),H=X(n);if(H){if(V(),!X(i))return G("property missing ':'");var ae=X(a),pe=Y({type:p,property:w(H[0].replace(e,m)),value:ae?w(ae[0].replace(e,m)):m});return X(l),pe}}function se(){var Y=[];E(Y);for(var H;H=$();)H!==!1&&(Y.push(H),E(Y));return Y}return U(),se()}function w(C){return C?C.replace(s,m):m}return On=y,On}var Li;function Qo(){if(Li)return Kt;Li=1;var e=Kt&&Kt.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.default=r;const t=e(Zo());function r(n,i){let a=null;if(!n||typeof n!="string")return a;const l=(0,t.default)(n),s=typeof i=="function";return l.forEach(o=>{if(o.type!=="declaration")return;const{property:u,value:h}=o;s?i(u,h,o):h&&(a=a||{},a[u]=h)}),a}return Kt}var pr={},Ni;function Jo(){if(Ni)return pr;Ni=1,Object.defineProperty(pr,"__esModule",{value:!0}),pr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,n=/^-(webkit|moz|ms|o|khtml)-/,i=/^-(ms)-/,a=function(u){return!u||r.test(u)||e.test(u)},l=function(u,h){return h.toUpperCase()},s=function(u,h){return"".concat(h,"-")},o=function(u,h){return h===void 0&&(h={}),a(u)?u:(u=u.toLowerCase(),h.reactCompat?u=u.replace(i,s):u=u.replace(n,s),u.replace(t,l))};return pr.camelCase=o,pr}var dr,Pi;function eu(){if(Pi)return dr;Pi=1;var e=dr&&dr.__importDefault||function(i){return i&&i.__esModule?i:{default:i}},t=e(Qo()),r=Jo();function n(i,a){var l={};return!i||typeof i!="string"||(0,t.default)(i,function(s,o){s&&o&&(l[(0,r.camelCase)(s,a)]=o)}),l}return n.default=n,dr=n,dr}var tu=eu();const ru=ml(tu),nu=/[ \t\n\f\r]/g;function iu(e){return typeof e=="object"?e.type==="text"?Oi(e.value):!1:Oi(e)}function Oi(e){return e.replace(nu,"")===""}const Sl=Al("end"),G0=Al("start");function Al(e){return t;function t(r){const n=r&&r.position&&r.position[e]||{};if(typeof n.line=="number"&&n.line>0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function au(e){const t=G0(e),r=Sl(e);if(t&&r)return{start:t,end:r}}function qi(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}const Hi=document.createElement("i");function W0(e){const t="&"+e+";";Hi.innerHTML=t;const r=Hi.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}const Ne=Dt(/[A-Za-z]/),Ie=Dt(/[\dA-Za-z]/),lu=Dt(/[#-'*+\--9=?A-Z^-~]/);function rn(e){return e!==null&&(e<32||e===127)}const y0=Dt(/\d/),su=Dt(/[\dA-Fa-f]/),ou=Dt(/[!-/:-@[-`{-~]/);function K(e){return e!==null&&e<-2}function me(e){return e!==null&&(e<0||e===32)}function le(e){return e===-2||e===-1||e===32}const dn=Dt(new RegExp("\\p{P}|\\p{S}","u")),Ut=Dt(/\s/);function Dt(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ie(e,t,r,n){const i=n?n-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(o){return le(o)?(e.enter(r),s(o)):t(o)}function s(o){return le(o)&&a++<i?(e.consume(o),s):(e.exit(r),t(o))}}function Ge(e,t,r,n){const i=e.length;let a=0,l;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,r=r>0?r:0,n.length<1e4)l=Array.from(n),l.unshift(t,r),e.splice(...l);else for(r&&e.splice(t,r);a<n.length;)l=n.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Qe(e,t){return e.length>0?(Ge(e,e.length,0,t),e):t}function er(e){if(e===null||me(e)||Ut(e))return 1;if(dn(e))return 2}function gn(e,t,r){const n=[];let i=-1;for(;++i<e.length;){const a=e[i].resolveAll;a&&!n.includes(a)&&(t=a(t,r),n.push(a))}return t}const b0={name:"attention",resolveAll:uu,tokenize:cu};function uu(e,t){let r=-1,n,i,a,l,s,o,u,h;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(n=r;n--;)if(e[n][0]==="exit"&&e[n][1].type==="attentionSequence"&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){Line truncated
`;break}case-3:{l=`\r
`;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&i)continue;l=" ";break}default:l=String.fromCharCode(a)}i=a===-2,n.push(l)}return n.join("")}function Q1(e){const n={constructs:Bl([X1,...(e||{}).extensions||[]]),content:i(M1),defined:[],document:i(I1),flow:i(F1),lazy:{},string:i(N1),text:i(P1)};return n;function i(a){return l;function l(s){return Y1(n,a,s)}}}function J1(e){for(;!Ml(e););return e}const Yi=/[\0\t\n\r]/g;function ec(){let e=1,t="",r=!0,n;return i;function i(a,l,s){const o=[];let u,h,m,d,p;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),m=0,t="",r&&(a.charCodeAt(0)===65279&&m++,r=void 0);m<a.length;){if(Yi.lastIndex=m,u=Yi.exec(a),d=u&&u.index!==void 0?u.index:a.length,p=a.charCodeAt(d),!u){t=a.slice(m);break}if(p===10&&m===d&&n)o.push(-3),n=void 0;else switch(n&&(o.push(-5),n=void 0),m<d&&(o.push(a.slice(m,d)),e+=d-m),p){case 0:{o.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,o.push(-2);e++<h;)o.push(-1);break}case 10:{o.push(-4),e=1;break}default:n=!0,e=1}m=d+1}return s&&(n&&o.push(-5),t&&o.push(t),o.push(null)),o}}const tc=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rc(e){return e.replace(tc,nc)}function nc(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const i=r.charCodeAt(1),a=i===120||i===88;return Rl(r.slice(a?2:1),a?16:10)}return W0(r)||e}const Pl={}.hasOwnProperty;function ic(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),ac(r)(J1(Q1(r).document().write(ec()(e,t,!0))))}function ac(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(cr),autolinkProtocol:U,autolinkEmail:U,atxHeading:a(Lr),blockQuote:a(mt),characterEscape:U,characterReference:U,codeFenced:a(Ft),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Ft,l),codeText:a(Rr,l),codeTextData:U,data:U,codeFlowValue:U,definition:a(Wt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Xt),hardBreakEscape:a(Nr),hardBreakTrailing:a(Nr),htmlFlow:a(Pr,l),htmlFlowData:U,htmlText:a(Pr,l),htmlTextData:U,image:a(Or),label:l,link:a(cr),listItem:a(Bn),listItemValue:d,listOrdered:a(Rt,m),listUnordered:a(Rt),paragraph:a(Fn),reference:S,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Lr),strong:a(hr),thematicBreak:a(Hr)},exit:{atxHeading:o(),atxHeadingSequence:O,autolink:o(),autolinkEmail:Ue,autolinkProtocol:tt,blockQuote:o(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:it,characterReferenceMarkerNumeric:it,characterReferenceValue:Te,characterReference:Ze,codeFenced:o(C),codeFencedFence:w,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:E,codeIndented:o(A),codeText:o(H),codeTextData:E,data:E,definition:o(),definitionDestinationString:q,definitionLabelString:z,definitionTitleString:I,emphasis:o(),hardBreakEscape:o($),hardBreakTrailing:o($),htmlFlow:o(se),htmlFlowData:E,htmlText:o(Y),htmlTextData:E,image:o(pe),label:$e,labelText:Me,lineEnding:V,link:o(ae),listItem:o(),listOrdered:o(),listUnordered:o(),paragraph:o(),referenceString:Ee,resourceDestinationString:k,resourceTitleString:xe,resource:Fe,setextHeading:o(X),setextHeadingLineSequence:G,setextHeadingText:M,strong:o(),thematicBreak:o()}};Ol(t,(e||{}).mdastExtensions||[]);const r={};return n;function n(D){let j={type:"root",children:[]};const Q={stack:[j],tokenStack:[],config:t,enter:s,exit:u,buffer:l,resume:h,data:r},ne=[];let ce=-1;for(;++ce<D.length;)if(D[ce][1].type==="listOrdered"||D[ce][1].type==="listUnordered")if(D[ce][0]==="enter")ne.push(ce);else{const rt=ne.pop();ce=i(D,rt,ce)}for(ce=-1;++ce<D.length;){const rt=t[D[ce][0]];Pl.call(rt,D[ce][1].type)&&rt[D[ce][1].type].call(Object.assign({sliceSerialize:D[ce][2].sliceSerialize},Q),D[ce][1])}if(Q.tokenStack.length>0){const rt=Q.tokenStack[Q.tokenStack.length-1];(rt[1]||Ki).call(Q,void 0,rt[0])}for(j.position={start:St(D.length>0?D[0][1].start:{line:1,column:1,offset:0}),end:St(D.length>0?D[D.length-2][1].end:{line:1,column:1,offset:0})},ce=-1;++ce<t.transforms.length;)j=t.transforms[ce](j)||j;return j}function i(D,j,Q){let ne=j-1,ce=-1,rt=!1,Lt,ft,mr,fr;for(;++ne<=Q;){const Ve=D[ne];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?ce++:ce--,fr=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(Lt&&!fr&&!ce&&!mr&&(mr=ne),fr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fr=void 0}if(!ce&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||ce===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(Lt){let Yt=ne;for(ft=void 0;Yt--;){const pt=D[Yt];if(pt[1].type==="lineEnding"||pt[1].type==="lineEndingBlank"){if(pt[0]==="exit")continue;ft&&(D[ft][1].type="lineEndingBlank",rt=!0),pt[1].type="lineEnding",ft=Yt}else if(!(pt[1].type==="linePrefix"||pt[1].type==="blockQuotePrefix"||pt[1].type==="blockQuotePrefixWhitespace"||pt[1].type==="blockQuoteMarkLine truncated
@@ -1,2 +1,2 @@
import{c as te,b as c,an as G,ao as oe,aj as r,T as f,ap as I,av as re,at as ne,aq as ae,as as ie,ar as ce}from"./tauri-compat-tfiFK9EG.js";import{B as F}from"./index-DpGuh58E.js";import{B as L}from"./index-Bpi3BHKj.js";import{I as se}from"./IconFile-CgfQSwGI.js";function le(t){return c.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h3.3a2 2 0 0 1 1.25.44l1.13.9a3 3 0 0 0 1.87.66H18c2 0 3 2 3 4H7.53A2 2 0 0 0 5.6 9.48L2.57 20.76C2.21 20.26 2 19.66 2 19V5Zm20.17 5H9.5a2 2 0 0 0-1.92 1.44l-2.7 9.28A1 1 0 0 0 5.82 22H18.5a2 2 0 0 0 1.92-1.44l2.7-9.28a1 1 0 0 0-.95-1.28Z",fill:"currentColor"}))}const pe=te(le,"folder_open");function C(){return window.__TAURI__}function de(t,e){return Number.isFinite(e.seq)?e.seq>t:!0}function O(t,e,n,i="prepare_failed"){const u=e==null?"":oe(e);return{seq:n,mode:"cold_start",phase:"failed",stage:null,progress:0,failure:{code:u?i:"unknown",detail:u},diagnostics:{buildId:"",platform:navigator.platform||"",projectDir:t[1]||"",pythonPath:t[0]||"",portState:"unknown",bridgeIdentity:null,recentLogs:[]}}}async function ue(t,e=0){const n=await t("get_config").catch(()=>["",""]);try{return{config:n,mode:"snapshot",snapshot:await t("get_bootstrap_snapshot")}}catch(i){if(!G(i,"get_bootstrap_snapshot"))throw i;const u=await t("get_prepare_error").catch(()=>null);return{config:n,mode:"legacy",snapshot:O(n,u,e)}}}async function he(t,e,n){if(n==="snapshot")try{return await t("retry_bootstrap",e),{mode:"snapshot"}}catch(i){if(!G(i,"retry_bootstrap"))return{mode:"snapshot",error:i}}try{return await t("start_bridge_with_config",e),{mode:"legacy"}}catch(i){return{mode:"legacy",error:i}}}async function ye(t,e,n){const i=await t("pick_directory",{title:n});if(!i)return null;const u=await t("discover_python_for_project",{projectDir:i,currentPython:e||null}).catch(()=>e);return{projectDir:i,pythonPath:u||""}}async function ge(t,e){return t("pick_python_interpreter",{title:e})}const H={config_unresolved:{zh:{title:"未找到应用文件",description:"请选择应用文件夹后继续。"},en:{title:"Application files not found",description:"Choose the application folder to continue."}},prepare_failed:{zh:{title:"运行环境尚未准备完成",description:"请检查所选应用文件夹和 Python 环境,然后继续启动。"},en:{title:"Environment setup is incomplete",description:"Check the application folder and Python environment, then continue startup."}},spawn_failed:{zh:{title:"本地连接未能启动",description:"请选择可用的应用文件夹和 Python 环境后继续。"},en:{title:"Local connection could not start",description:"Choose a usable application folder and Python environment to continue."}},bridge_shutdown_refused:{zh:{title:"本地连接暂时无法安全重启",description:"请等待当前操作完成后重试。"},en:{title:"Local connection cannot restart safely",description:"Wait for the current operation to finish, then retry."}},port_conflict:{zh:{title:"本地连接被占用",description:"另一个应用正在使用本地连接。关闭相关应用后继续启动。"},en:{title:"Local connection is in use",description:"Another app is using the local connection. Close it, then continue startup."}},service_timeout:{zh:{title:"本地连接启动时间过长",description:"请检查所选位置;诊断信息中包含最近的启动记录。"},en:{title:"Local connection is taking too long",description:"Check the selected locations. Diagnostics contain the latest startup records."}},service_exited:{zh:{title:"本地连接意外停止",description:"诊断信息中包含停止状态和最近的启动记录。"},en:{title:"Local connection stopped unexpectedly",description:"Diagnostics contain the stop status and latest startup records."}},ui_navigation_failed:{zh:{title:"主界面未能打开",description:"本地连接已经就绪,但界面加载失败。诊断信息中包含详细原因。"},en:{title:"Main window could not open",description:"The local connection is ready, but the interface failed to load. Diagnostics contain details."}},unknown:{zh:{title:"启动尚未完成",description:"请检查所选位置;需要协助时可复制诊断信息。"},en:{title:"Startup is not complete",description:"Check the selected locations. Copy diagnostics if you need support."}}},fe={zh:{pageTitle:"完成启动设置",intro:"选择应用运行所需的位置。你的记忆、会话和设置不会受到影响。",projectLabel:"应用文件夹",projectHint:"选择此前用于运行桌面版的应用文件夹。",projectPickerTitle:"选择应用文件夹",chooseProject:"选择文件夹",changeProject:"重新选择",projectEmpty:"尚未选择应用文件夹",pythonLabel:"Python 环境",pythonHint:"应用会自动选择可用环境;如有需要,可以重新选择。",pythonPickerTitlLine truncated
`)}const B={projectDir:"",pythonPath:""};function q({label:t,hint:e,value:n,emptyText:i,buttonText:u,buttonLabel:l,loading:k,disabled:m,icon:j,onChoose:P}){return r.jsxs("section",{className:"ga-setup-location","aria-label":t,children:[r.jsxs("div",{className:"ga-setup-location-header",children:[r.jsx(f.Text,{strong:!0,children:t}),r.jsx(L,{size:"small",type:"tertiary",theme:"light",icon:j,loading:k,disabled:m,"aria-label":l,onClick:P,children:u})]}),r.jsx("div",{className:`ga-setup-path${n?"":" ga-setup-path--empty"}`,role:"textbox","aria-readonly":"true","aria-label":t,tabIndex:0,children:n?r.jsx("code",{children:n}):r.jsx("span",{children:i})}),r.jsx(f.Paragraph,{type:"tertiary",size:"small",className:"ga-setup-location-hint",children:e})]})}function S(t,e){return{seq:e,mode:"cold_start",phase:"failed",stage:null,progress:0,failure:{code:"unknown",detail:String(t)},diagnostics:{buildId:"",platform:navigator.platform||"",projectDir:"",pythonPath:"",portState:"unknown",bridgeIdentity:null,recentLogs:[]}}}function Pe(){var M;const t=V(),e=me(t),n=c.useRef(B),[i,u]=c.useState(B),[l,k]=c.useState(null),[m,j]=c.useState(!1),[P,N]=c.useState(!1),[T,z]=c.useState(!1),[R,b]=c.useState(""),[W,E]=c.useState(""),g=c.useRef(-1),w=c.useRef(null),D=c.useRef("snapshot"),h=c.useCallback(o=>{n.current=o,u(o)},[]),y=c.useCallback(o=>{var d,s,_,v;const a=w.current;if(!de(g.current,o))return;g.current=Number.isFinite(o.seq)?o.seq:g.current+1,w.current=o,k(o),o.phase==="failed"&&j(!1);const p={};(d=o.diagnostics)!=null&&d.projectDir&&(!n.current.projectDir||((s=a==null?void 0:a.diagnostics)==null?void 0:s.projectDir)===n.current.projectDir)&&(p.projectDir=o.diagnostics.projectDir),(_=o.diagnostics)!=null&&_.pythonPath&&(!n.current.pythonPath||((v=a==null?void 0:a.diagnostics)==null?void 0:v.pythonPath)===n.current.pythonPath)&&(p.pythonPath=o.diagnostics.pythonPath),Object.keys(p).length&&h({...n.current,...p})},[h]);c.useEffect(()=>{var o;(o=window.__GA_SETUP_MARK_READY__)==null||o.call(window)},[]),c.useEffect(()=>{const o=C();if(!(o!=null&&o.core.invoke)){y(S("Tauri bootstrap API is unavailable",0));return}let a=!0,p;return(async()=>{var v;if((v=o.event)!=null&&v.listen)try{const x=await o.event.listen("bootstrap",ee=>{a&&y(ee.payload)});if(!a){x();return}p=x}catch(x){console.warn("[setup] bootstrap events unavailable; using command compatibility mode",x)}const d=await ue(o.core.invoke,g.current+1);if(!a)return;D.current=d.mode;const s=d.config,_={pythonPath:(s==null?void 0:s[0])||"",projectDir:(s==null?void 0:s[1])||""};h({pythonPath:n.current.pythonPath||_.pythonPath,projectDir:n.current.projectDir||_.projectDir}),y(d.snapshot)})().catch(d=>{a&&y(S(d,g.current+1))}),()=>{a=!1,p==null||p()}},[h,y]);const $=c.useMemo(()=>{var o;return je((o=l==null?void 0:l.failure)==null?void 0:o.code,t)},[t,(M=l==null?void 0:l.failure)==null?void 0:M.code]),A=c.useMemo(()=>be(l),[l]),Z=c.useCallback(async()=>{const o=C();if(!(o!=null&&o.core.invoke)){b(e.pickerError);return}N(!0),b("");try{const a=await ye(o.core.invoke,n.current.pythonPath,e.projectPickerTitle);a&&h(a)}catch(a){console.error("[setup] application folder selection failed",a),b(e.pickerError)}finally{N(!1)}},[h,e]),J=c.useCallback(async()=>{const o=C();if(!(o!=null&&o.core.invoke)){b(e.pickerError);return}z(!0),b("");try{const a=await ge(o.core.invoke,e.pythonPickerTitle);a&&h({...n.current,pythonPath:a})}catch(a){console.error("[setup] Python environment selection failed",a),b(e.pickerError)}finally{z(!1)}},[h,e]),Q=c.useCallback(async()=>{const o=n.current.projectDir.trim(),a=n.current.pythonPath.trim();if(h({projectDir:o,pythonPath:a}),E(""),!o){const s=w.current??S("",g.current+1);y({...s,seq:g.current+1,phase:"failed",failure:{code:"config_unresolved",detail:""}});return}j(!0);const p=C();if(!(p!=null&&p.core.invoke)){y(S("Tauri bootstrap API is unavailable",g.current+1)),j(!1);return}const d=await he(p.core.invoke,{pythonPath:a,projectDir:o},D.current);if(D.current=d.mode,d.error){if(d.mode==="legacy")y(O([a,o],d.error,g.current+1,"spawn_failed"));else{const s=await p.core.invoke("get_bootstrap_snapshot").catch(()=>w.current);s&&y(s)}j(!1)}},[h,y]),X=c.useCallback(async()=>{var o;try{if(!((o=navigator.clipboard)!=null&&o.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(A),E(e.copied)}catch{const p=document.getElementById("diagnostics");if(p){const d=document.createRange();d.selectNodeContents(p);const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(d),p.focus()}E(e.selectCopy)}},[e,A]);return r.jsx("main",{className:"ga-setup-page",children:r.jsxs("section",{className:"ga-setup-panel","aria-labelledby":"ga-setup-title",children:[r.jsxs("header",{className:"ga-setup-header",children:[r.jsx(f.Title,{id:"ga-setup-title",heading:3,children:e.pageTitle}),r.jsx(f.Paragraph,{type:"tertiary",children:e.intro})]}),(l==null?void 0:l.failure)&&r.jsx(F,{className:"ga-setup-banner",type:"danger",fullMode:!1,bordered Line truncated
import{c as te,b as c,an as G,ao as oe,aj as r,T as f,ap as L,av as re,at as ne,aq as ae,as as ie,ar as ce}from"./tauri-compat-D_GD_wMe.js";import{B as F}from"./index-C-iCGtYr.js";import{B as A}from"./index-9FI8Jlf5.js";import{I as se}from"./IconFile-C8B3WX2U.js";function le(t){return c.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},t),c.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h3.3a2 2 0 0 1 1.25.44l1.13.9a3 3 0 0 0 1.87.66H18c2 0 3 2 3 4H7.53A2 2 0 0 0 5.6 9.48L2.57 20.76C2.21 20.26 2 19.66 2 19V5Zm20.17 5H9.5a2 2 0 0 0-1.92 1.44l-2.7 9.28A1 1 0 0 0 5.82 22H18.5a2 2 0 0 0 1.92-1.44l2.7-9.28a1 1 0 0 0-.95-1.28Z",fill:"currentColor"}))}const pe=te(le,"folder_open");function C(){return window.__TAURI__}function de(t,e){return Number.isFinite(e.seq)?e.seq>t:!0}function O(t,e,n,i="prepare_failed"){const u=e==null?"":oe(e);return{seq:n,mode:"cold_start",phase:"failed",stage:null,progress:0,failure:{code:u?i:"unknown",detail:u},diagnostics:{buildId:"",platform:navigator.platform||"",projectDir:t[1]||"",pythonPath:t[0]||"",portState:"unknown",bridgeIdentity:null,recentLogs:[]}}}async function ue(t,e=0){const n=await t("get_config").catch(()=>["",""]);try{return{config:n,mode:"snapshot",snapshot:await t("get_bootstrap_snapshot")}}catch(i){if(!G(i,"get_bootstrap_snapshot"))throw i;const u=await t("get_prepare_error").catch(()=>null);return{config:n,mode:"legacy",snapshot:O(n,u,e)}}}async function he(t,e,n){if(n==="snapshot")try{return await t("retry_bootstrap",e),{mode:"snapshot"}}catch(i){if(!G(i,"retry_bootstrap"))return{mode:"snapshot",error:i}}try{return await t("start_bridge_with_config",e),{mode:"legacy"}}catch(i){return{mode:"legacy",error:i}}}async function ye(t,e,n){const i=await t("pick_directory",{title:n});if(!i)return null;const u=await t("discover_python_for_project",{projectDir:i,currentPython:e||null}).catch(()=>e);return{projectDir:i,pythonPath:u||""}}async function ge(t,e){return t("pick_python_interpreter",{title:e})}const H={config_unresolved:{zh:{title:"未找到应用文件",description:"请选择应用文件夹后继续。"},en:{title:"Application files not found",description:"Choose the application folder to continue."}},prepare_failed:{zh:{title:"运行环境尚未准备完成",description:"请检查所选应用文件夹和 Python 环境,然后继续启动。"},en:{title:"Environment setup is incomplete",description:"Check the application folder and Python environment, then continue startup."}},spawn_failed:{zh:{title:"本地连接未能启动",description:"请选择可用的应用文件夹和 Python 环境后继续。"},en:{title:"Local connection could not start",description:"Choose a usable application folder and Python environment to continue."}},bridge_shutdown_refused:{zh:{title:"本地连接暂时无法安全重启",description:"请等待当前操作完成后重试。"},en:{title:"Local connection cannot restart safely",description:"Wait for the current operation to finish, then retry."}},port_conflict:{zh:{title:"本地连接被占用",description:"另一个应用正在使用本地连接。关闭相关应用后继续启动。"},en:{title:"Local connection is in use",description:"Another app is using the local connection. Close it, then continue startup."}},service_timeout:{zh:{title:"本地连接启动时间过长",description:"请检查所选位置;诊断信息中包含最近的启动记录。"},en:{title:"Local connection is taking too long",description:"Check the selected locations. Diagnostics contain the latest startup records."}},service_exited:{zh:{title:"本地连接意外停止",description:"诊断信息中包含停止状态和最近的启动记录。"},en:{title:"Local connection stopped unexpectedly",description:"Diagnostics contain the stop status and latest startup records."}},ui_navigation_failed:{zh:{title:"主界面未能打开",description:"本地连接已经就绪,但界面加载失败。诊断信息中包含详细原因。"},en:{title:"Main window could not open",description:"The local connection is ready, but the interface failed to load. Diagnostics contain details."}},unknown:{zh:{title:"启动尚未完成",description:"请检查所选位置;需要协助时可复制诊断信息。"},en:{title:"Startup is not complete",description:"Check the selected locations. Copy diagnostics if you need support."}}},fe={zh:{pageTitle:"完成启动设置",intro:"选择应用运行所需的位置。你的记忆、会话和设置不会受到影响。",projectLabel:"应用文件夹",projectHint:"选择此前用于运行桌面版的应用文件夹。",projectPickerTitle:"选择应用文件夹",chooseProject:"选择文件夹",changeProject:"重新选择",projectEmpty:"尚未选择应用文件夹",pythonLabel:"Python 环境",pythonHint:"应用会自动选择可用环境;如有需要,可以重新选择。",pythonPickerTitlLine truncated
`)}const B={projectDir:"",pythonPath:""};function q({label:t,hint:e,value:n,emptyText:i,buttonText:u,buttonLabel:l,loading:k,disabled:m,icon:j,onChoose:P}){return r.jsxs("section",{className:"ga-setup-location","aria-label":t,children:[r.jsxs("div",{className:"ga-setup-location-header",children:[r.jsx(f.Text,{strong:!0,children:t}),r.jsx(A,{size:"small",type:"tertiary",theme:"light",icon:j,loading:k,disabled:m,"aria-label":l,onClick:P,children:u})]}),r.jsx("div",{className:`ga-setup-path${n?"":" ga-setup-path--empty"}`,role:"textbox","aria-readonly":"true","aria-label":t,tabIndex:0,children:n?r.jsx("code",{children:n}):r.jsx("span",{children:i})}),r.jsx(f.Paragraph,{type:"tertiary",size:"small",className:"ga-setup-location-hint",children:e})]})}function S(t,e){return{seq:e,mode:"cold_start",phase:"failed",stage:null,progress:0,failure:{code:"unknown",detail:String(t)},diagnostics:{buildId:"",platform:navigator.platform||"",projectDir:"",pythonPath:"",portState:"unknown",bridgeIdentity:null,recentLogs:[]}}}function Pe(){var M;const t=V(),e=me(t),n=c.useRef(B),[i,u]=c.useState(B),[l,k]=c.useState(null),[m,j]=c.useState(!1),[P,N]=c.useState(!1),[T,z]=c.useState(!1),[R,b]=c.useState(""),[W,E]=c.useState(""),g=c.useRef(-1),w=c.useRef(null),D=c.useRef("snapshot"),h=c.useCallback(o=>{n.current=o,u(o)},[]),y=c.useCallback(o=>{var d,s,_,v;const a=w.current;if(!de(g.current,o))return;g.current=Number.isFinite(o.seq)?o.seq:g.current+1,w.current=o,k(o),o.phase==="failed"&&j(!1);const p={};(d=o.diagnostics)!=null&&d.projectDir&&(!n.current.projectDir||((s=a==null?void 0:a.diagnostics)==null?void 0:s.projectDir)===n.current.projectDir)&&(p.projectDir=o.diagnostics.projectDir),(_=o.diagnostics)!=null&&_.pythonPath&&(!n.current.pythonPath||((v=a==null?void 0:a.diagnostics)==null?void 0:v.pythonPath)===n.current.pythonPath)&&(p.pythonPath=o.diagnostics.pythonPath),Object.keys(p).length&&h({...n.current,...p})},[h]);c.useEffect(()=>{var o;(o=window.__GA_SETUP_MARK_READY__)==null||o.call(window)},[]),c.useEffect(()=>{const o=C();if(!(o!=null&&o.core.invoke)){y(S("Tauri bootstrap API is unavailable",0));return}let a=!0,p;return(async()=>{var v;if((v=o.event)!=null&&v.listen)try{const x=await o.event.listen("bootstrap",ee=>{a&&y(ee.payload)});if(!a){x();return}p=x}catch(x){console.warn("[setup] bootstrap events unavailable; using command compatibility mode",x)}const d=await ue(o.core.invoke,g.current+1);if(!a)return;D.current=d.mode;const s=d.config,_={pythonPath:(s==null?void 0:s[0])||"",projectDir:(s==null?void 0:s[1])||""};h({pythonPath:n.current.pythonPath||_.pythonPath,projectDir:n.current.projectDir||_.projectDir}),y(d.snapshot)})().catch(d=>{a&&y(S(d,g.current+1))}),()=>{a=!1,p==null||p()}},[h,y]);const $=c.useMemo(()=>{var o;return je((o=l==null?void 0:l.failure)==null?void 0:o.code,t)},[t,(M=l==null?void 0:l.failure)==null?void 0:M.code]),I=c.useMemo(()=>be(l),[l]),Z=c.useCallback(async()=>{const o=C();if(!(o!=null&&o.core.invoke)){b(e.pickerError);return}N(!0),b("");try{const a=await ye(o.core.invoke,n.current.pythonPath,e.projectPickerTitle);a&&h(a)}catch(a){console.error("[setup] application folder selection failed",a),b(e.pickerError)}finally{N(!1)}},[h,e]),J=c.useCallback(async()=>{const o=C();if(!(o!=null&&o.core.invoke)){b(e.pickerError);return}z(!0),b("");try{const a=await ge(o.core.invoke,e.pythonPickerTitle);a&&h({...n.current,pythonPath:a})}catch(a){console.error("[setup] Python environment selection failed",a),b(e.pickerError)}finally{z(!1)}},[h,e]),Q=c.useCallback(async()=>{const o=n.current.projectDir.trim(),a=n.current.pythonPath.trim();if(h({projectDir:o,pythonPath:a}),E(""),!o){const s=w.current??S("",g.current+1);y({...s,seq:g.current+1,phase:"failed",failure:{code:"config_unresolved",detail:""}});return}j(!0);const p=C();if(!(p!=null&&p.core.invoke)){y(S("Tauri bootstrap API is unavailable",g.current+1)),j(!1);return}const d=await he(p.core.invoke,{pythonPath:a,projectDir:o},D.current);if(D.current=d.mode,d.error){if(d.mode==="legacy")y(O([a,o],d.error,g.current+1,"spawn_failed"));else{const s=await p.core.invoke("get_bootstrap_snapshot").catch(()=>w.current);s&&y(s)}j(!1)}},[h,y]),X=c.useCallback(async()=>{var o;try{if(!((o=navigator.clipboard)!=null&&o.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(I),E(e.copied)}catch{const p=document.getElementById("diagnostics");if(p){const d=document.createRange();d.selectNodeContents(p);const s=window.getSelection();s==null||s.removeAllRanges(),s==null||s.addRange(d),p.focus()}E(e.selectCopy)}},[e,I]);return r.jsx("main",{className:"ga-setup-page",children:r.jsxs("section",{className:"ga-setup-panel","aria-labelledby":"ga-setup-title",children:[r.jsxs("header",{className:"ga-setup-header",children:[r.jsx(f.Title,{id:"ga-setup-title",heading:3,children:e.pageTitle}),r.jsx(f.Paragraph,{type:"tertiary",children:e.intro})]}),(l==null?void 0:l.failure)&&r.jsx(F,{className:"ga-setup-banner",type:"danger",fullMode:!1,bordered Line truncated
@@ -44,4 +44,4 @@ function H_(s,i){for(var r=0;r<i.length;r++){const o=i[r];if(typeof o!="string"&
`).replace(n_,"")}function go(e,t,n){if(t=Ep(t),Ep(e)!==t&&n)throw Error(r(425))}function mo(){}var as=null,ss=null;function ls(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var us=typeof setTimeout=="function"?setTimeout:void 0,r_=typeof clearTimeout=="function"?clearTimeout:void 0,Op=typeof Promise=="function"?Promise:void 0,i_=typeof queueMicrotask=="function"?queueMicrotask:typeof Op<"u"?function(e){return Op.resolve(null).then(e).catch(o_)}:us;function o_(e){setTimeout(function(){throw e})}function cs(e,t){var n=t,a=0;do{var u=n.nextSibling;if(e.removeChild(n),u&&u.nodeType===8)if(n=u.data,n==="/$"){if(a===0){e.removeChild(u),ni(t);return}a--}else n!=="$"&&n!=="$?"&&n!=="$!"||a++;n=u}while(n);ni(t)}function On(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Pp(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var _r=Math.random().toString(36).slice(2),Yt="__reactFiber$"+_r,pi="__reactProps$"+_r,ln="__reactContainer$"+_r,fs="__reactEvents$"+_r,a_="__reactListeners$"+_r,s_="__reactHandles$"+_r;function Gn(e){var t=e[Yt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ln]||n[Yt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Pp(e);e!==null;){if(n=e[Yt])return n;e=Pp(e)}return t}e=n,n=e.parentNode}return null}function hi(e){return e=e[Yt]||e[ln],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function vo(e){return e[pi]||null}var ds=[],Sr=-1;function Pn(e){return{current:e}}function ke(e){0>Sr||(e.current=ds[Sr],ds[Sr]=null,Sr--)}function xe(e,t){Sr++,ds[Sr]=e.current,e.current=t}var bn={},rt=Pn(bn),dt=Pn(!1),Xn=bn;function Cr(e,t){var n=e.type.contextTypes;if(!n)return bn;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===t)return a.__reactInternalMemoizedMaskedChildContext;var u={},c;for(c in n)u[c]=t[c];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=u),u}function pt(e){return e=e.childContextTypes,e!=null}function yo(){ke(dt),ke(rt)}function bp(e,t,n){if(rt.current!==bn)throw Error(r(168));xe(rt,t),xe(dt,n)}function xp(e,t,n){var a=e.stateNode;if(t=t.childContextTypes,typeof a.getChildContext!="function")return n;a=a.getChildContext();for(var u in a)if(!(u in t))throw Error(r(108,he(e)||"Unknown",u));return G({},n,a)}function _o(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||bn,Xn=rt.current,xe(rt,e),xe(dt,dt.current),!0}function Rp(e,t,n){var a=e.stateNode;if(!a)throw Error(r(169));n?(e=xp(e,t,Xn),a.__reactInternalMemoizedMergedChildContext=e,ke(dt),ke(rt),xe(rt,e)):ke(dt),xe(dt,n)}var un=null,wo=!1,ps=!1;function kp(e){un===null?un=[e]:un.push(e)}function l_(e){wo=!0,kp(e)}function xn(){if(!ps&&un!==null){ps=!0;var e=0,t=Oe;try{var n=un;for(Oe=1;e<n.length;e++){var a=n[e];do a=a(!0);while(a!==null)}un=null,wo=!1}catch(u){throw un!==null&&(un=un.slice(e+1)),Ad(Ma,xn),u}finally{Oe=t,ps=!1}}return null}var Tr=[],Er=0,So=null,Co=0,bt=[],xt=0,Qn=null,cn=1,fn="";function Yn(e,t){Tr[Er++]=Co,Tr[Er++]=So,So=e,Co=t}function Ip(e,t,n){bt[xt++]=cn,bt[xt++]=fn,bt[xt++]=Qn,Qn=e;var a=cn;e=fn;var u=32-qt(a)-1;a&=~(1<<u),n+=1;var c=32-qt(t)+u;if(30<c){var h=u-u%5;c=(a&(1<<h)-1).toString(32),a>>=h,u-=h,cn=1<<32-qt(t)+u|n<<u|a,fn=c+e}else cn=1<<c|n<<u|a,fn=e}function hs(e){e.return!==null&&(Yn(e,1),Ip(e,1,0))}function gs(e){for(;e===So;)So=Tr[--Er],Tr[Er]=null,Co=Tr[--Er],Tr[Er]=null;for(;e===Qn;)Qn=bt[--xt],bt[xt]=null,fn=bt[--xt],bt[xt]=null,cn=bt[--xt],bt[xt]=null}var St=null,Ct=null,Ie=!1,$t=null;function Ap(e,t){var n=At(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Np(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,St=e,Ct=On(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,St=e,Ct=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Qn!==null?{id:cn,overflow:fn}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=At(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,St=e,Ct=null,!0):!1;default:return!1}}function ms(e){return(e.mode&1)!==0&&(e.flags&128)===0}function vs(e){if(Ie){var t=Ct;if(t){var n=t;if(!Np(e,t)){if(ms(e))throw Error(r(418));t=On(n.nextSibling);var a=St;t&&Np(e,t)?Ap(a,n):(e.flags=e.flags&-4097|2,Ie=!1,St=e)}}else{if(ms(e))throw Error(r(418));e.flags=e.flags&-4097|2,Ie=!1,St=e}}}function jp(e){for(e=e. Line truncated
Error generating stack: `+c.message+`
`+c.stack}return{value:e,source:t,stack:u,digest:null}}function qs(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function zs(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var v_=typeof WeakMap=="function"?WeakMap:Map;function hh(e,t,n){n=pn(-1,n),n.tag=3,n.payload={element:null};var a=t.value;return n.callback=function(){Bo||(Bo=!0,tl=a),zs(e,t)},n}function gh(e,t,n){n=pn(-1,n),n.tag=3;var a=e.type.getDerivedStateFromError;if(typeof a=="function"){var u=t.value;n.payload=function(){return a(u)},n.callback=function(){zs(e,t)}}var c=e.stateNode;return c!==null&&typeof c.componentDidCatch=="function"&&(n.callback=function(){zs(e,t),typeof a!="function"&&(An===null?An=new Set([this]):An.add(this));var h=t.stack;this.componentDidCatch(t.value,{componentStack:h!==null?h:""})}),n}function mh(e,t,n){var a=e.pingCache;if(a===null){a=e.pingCache=new v_;var u=new Set;a.set(t,u)}else u=a.get(t),u===void 0&&(u=new Set,a.set(t,u));u.has(n)||(u.add(n),e=I_.bind(null,e,t,n),t.then(e,e))}function vh(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function yh(e,t,n,a,u){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=pn(-1,1),t.tag=2,kn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=u,e)}var y_=$.ReactCurrentOwner,ht=!1;function ut(e,t,n,a){t.child=e===null?Fp(t,null,n,a):Pr(t,e.child,n,a)}function _h(e,t,n,a,u){n=n.render;var c=t.ref;return xr(t,u),a=Is(e,t,n,a,c,u),n=As(),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~u,hn(e,t,u)):(Ie&&n&&hs(t),t.flags|=1,ut(e,t,a,u),t.child)}function wh(e,t,n,a,u){if(e===null){var c=n.type;return typeof c=="function"&&!ll(c)&&c.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=c,Sh(e,t,c,a,u)):(e=Go(n.type,null,a,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,(e.lanes&u)===0){var h=c.memoizedProps;if(n=n.compare,n=n!==null?n:li,n(h,a)&&e.ref===t.ref)return hn(e,t,u)}return t.flags|=1,e=Dn(c,a),e.ref=t.ref,e.return=t,t.child=e}function Sh(e,t,n,a,u){if(e!==null){var c=e.memoizedProps;if(li(c,a)&&e.ref===t.ref)if(ht=!1,t.pendingProps=a=c,(e.lanes&u)!==0)(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,hn(e,t,u)}return $s(e,t,n,a,u)}function Ch(e,t,n){var a=t.pendingProps,u=a.children,c=e!==null?e.memoizedState:null;if(a.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},xe(Ar,Tt),Tt|=n;else{if((n&1073741824)===0)return e=c!==null?c.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,xe(Ar,Tt),Tt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},a=c!==null?c.baseLanes:n,xe(Ar,Tt),Tt|=a}else c!==null?(a=c.baseLanes|n,t.memoizedState=null):a=n,xe(Ar,Tt),Tt|=a;return ut(e,t,u,n),t.child}function Th(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function $s(e,t,n,a,u){var c=pt(n)?Xn:rt.current;return c=Cr(t,c),xr(t,u),n=Is(e,t,n,a,c,u),a=As(),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~u,hn(e,t,u)):(Ie&&a&&hs(t),t.flags|=1,ut(e,t,n,u),t.child)}function Eh(e,t,n,a,u){if(pt(n)){var c=!0;_o(t)}else c=!1;if(xr(t,u),t.stateNode===null)Lo(e,t),dh(t,n,a),Fs(t,n,a,u),a=!0;else if(e===null){var h=t.stateNode,y=t.memoizedProps;h.props=y;var w=h.context,P=n.contextType;typeof P=="object"&&P!==null?P=Rt(P):(P=pt(n)?Xn:rt.current,P=Cr(t,P));var L=n.getDerivedStateFromProps,q=typeof L=="function"||typeof h.getSnapshotBeforeUpdate=="function";q||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==a||w!==P)&&ph(t,h,a,P),Rn=!1;var D=t.memoizedState;h.state=D,xo(t,a,h,u),w=t.memoizedState,y!==a||D!==w||dt.current||Rn?(typeof L=="function"&&(Ls(t,n,L,a),w=t.memoizedState),(y=Rn||fh(t,n,y,a,D,w,P))?(q||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=a,t.memoizedState=w),h.props=a,h.state=w,h.context=P,a=y):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),a=!1)}else{h=t.stateNode,zp(e,t),y=t.memoizedProps,P=t.type===t.elementType?y:Bt(t.type,y),h.props=P,q=t.pendingProps,D=h.context,w=n.contextType,typeof w=="object"&&w!==null?w=Rt(w):(w=pt(n)?Xn:rt.current,w=Cr(t,w));var Q=n.getDerivedStateFromProps;(L=typeof Q=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(y!==q||D!==w)&&ph(t,h,a,w),Rn=!1,D=t.memoizedState,h.state=D,xo(t,a,h,u Line truncated
[Semi UI] createRoot 不可用。如果您正在使用 React 19,请在使用 Semi 组件前注入 createRoot。详情请参阅:https://semi.design/zh-CN/ecosystem/react19`))}const Di="__semi_react_root__";function OO(s,i){WC();const r=VC();if(r){Hy(!0);const o=i[Di]||r(i);Hy(!1),o.render(s),i[Di]=o}else qy?qy(s,i):KC()}function PO(s){s[Di]?(s[Di].unmount(),delete s[Di]):zy&&zy(s)}function GC(s){var i;try{const r=(i=s==null?void 0:s._reactInternals)!==null&&i!==void 0?i:s==null?void 0:s._reactInternalFiber;if(!r||typeof r!="object")return null;let o=r.child,l=0;const f=50;for(;o&&l<f;){if(l++,o.stateNode instanceof Element)return o.stateNode;if(o.child){o=o.child;continue}for(;o&&!o.sibling;){if(o===r)return null;o=o.return}if(o&&o!==r)o=o.sibling;else break}}catch{}return null}function ji(s){if(!s)return null;if(s instanceof Element)return s;if($y)try{const i=$y(s);return i instanceof Element?i:null}catch{return null}return GC(s)}function L1(s){var i,r,o;return s?D1>=19?(r=(i=s.props)===null||i===void 0?void 0:i.ref)!==null&&r!==void 0?r:null:(o=s.ref)!==null&&o!==void 0?o:null:null}const xa=I.createContext({}),XC=()=>document.body;class Ra extends Ee.PureComponent{constructor(i,r){var o;super(i),o=this,this.initContainer=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var d,p;try{let g;if(!o.el||!(!((d=o.state)===null||d===void 0)&&d.container)||!Array.from(o.state.container.childNodes).includes(o.el)){o.el=document.createElement("div");const _=(o.props.getPopupContainer||l.getPopupContainer||XC)();return _.appendChild(o.el),o.addStyle(o.props.style),o.addClass(o.props.prefixCls,l,o.props.className),g=_,g}}catch(g){if(!f)throw g}return(p=o.state)===null||p===void 0?void 0:p.container},this.addStyle=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(o.el)for(const f of Object.keys(l))o.el.style[f]=l[f]},this.addClass=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o.context;const{direction:d}=f;for(var p=arguments.length,g=new Array(p>2?p-2:0),m=2;m<p;m++)g[m-2]=arguments[m];const _=Le(l,...g,{[`${l}-rtl`]:d==="rtl"});o.el&&(o.el.className=_)},this.state={container:this.initContainer(r,!0)}}componentDidMount(){const i=this.initContainer(this.context);i!==this.state.container&&this.setState({container:i})}componentDidUpdate(i){const{didUpdate:r}=this.props;r&&r(i)}componentWillUnmount(){const{container:i}=this.state;i&&i.removeChild(this.el)}render(){const{state:i,props:r}=this;return i.container?_d.createPortal(r.children,this.el):null}}Ra.contextType=xa;Ra.defaultProps={prefixCls:`${qn}-portal`};Ra.propTypes={children:v.node,prefixCls:v.string,getPopupContainer:v.func,className:v.string,didUpdate:v.func};var QC=function(s,i){var r={};for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.indexOf(o)<0&&(r[o]=s[o]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(s);l<o.length;l++)i.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(s,o[l])&&(r[o[l]]=s[o[l]]);return r};const YC=s=>{const{className:i,style:r}=s,o=QC(s,["className","style"]);return I.createElement("svg",Object.assign({"aria-hidden":!0,className:i,style:r},o,{width:"24",height:"7",viewBox:"0 0 24 7",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"}),I.createElement("path",{d:"M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z"}))};var ZC=function(s,i){var r={};for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.indexOf(o)<0&&(r[o]=s[o]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(s);l<o.length;l++)i.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(s,o[l])&&(r[o[l]]=s[o[l]]);return r};const JC=s=>{const{className:i,style:r}=s,o=ZC(s,["className","style"]);return I.createElement("svg",Object.assign({"aria-hidden":!0,className:i,style:r},o,{width:"7",height:"24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"}),I.createElement("path",{d:"M0 0L1 0C1 4, 2 5.5, 4 7.5S7,10 7,12S6 14.5, 4 16.5S1,20 1,24L0 24L0 0z"}))},eT=v.shape({offsetX:v.number,offsetY:v.number,width:v.number,height:v.number});class F1 extends I.Component{constructor(i){super(i),this.handleAnimationStart=()=>{var r,o;(o=(r=this.props).onAnimationStart)===null||o===void 0||o.call(r)},this.handleAnimationEnd=()=>{this.setState({currentClassName:this.props.endClassName,extraStyle:{animationFillMode:this.props.fillMode},isAnimating:!1},()=>{var r,o;(o=(r=this.props).onAnimationEnd)===null||o===void 0||o.call(r,!1)})},this.state={currentClassName:this.props.startClassName,extraStyle:{animationFillMode:this.props.fillMode},isAnimating:!0}}componentDidMount(){var i,r,o,l;(r=(i=this.props).onAnimationStart)===null||r===void 0||r.call(i),this.props.motion||((l=(o=this.props).onAnimationEnd)===null||l===void 0||l.call(o,!1),this.setState({isAnimating:!1}))}componentDidUpdate(i,r,o){const l=Object.keys(this.props).filter(f=>! Line truncated
[Semi UI] createRoot 不可用。如果您正在使用 React 19,请在使用 Semi 组件前注入 createRoot。详情请参阅:https://semi.design/zh-CN/ecosystem/react19`))}const Di="__semi_react_root__";function OO(s,i){WC();const r=VC();if(r){Hy(!0);const o=i[Di]||r(i);Hy(!1),o.render(s),i[Di]=o}else qy?qy(s,i):KC()}function PO(s){s[Di]?(s[Di].unmount(),delete s[Di]):zy&&zy(s)}function GC(s){var i;try{const r=(i=s==null?void 0:s._reactInternals)!==null&&i!==void 0?i:s==null?void 0:s._reactInternalFiber;if(!r||typeof r!="object")return null;let o=r.child,l=0;const f=50;for(;o&&l<f;){if(l++,o.stateNode instanceof Element)return o.stateNode;if(o.child){o=o.child;continue}for(;o&&!o.sibling;){if(o===r)return null;o=o.return}if(o&&o!==r)o=o.sibling;else break}}catch{}return null}function ji(s){if(!s)return null;if(s instanceof Element)return s;if($y)try{const i=$y(s);return i instanceof Element?i:null}catch{return null}return GC(s)}function L1(s){var i,r,o;return s?D1>=19?(r=(i=s.props)===null||i===void 0?void 0:i.ref)!==null&&r!==void 0?r:null:(o=s.ref)!==null&&o!==void 0?o:null:null}const xa=I.createContext({}),XC=()=>document.body;class Ra extends Ee.PureComponent{constructor(i,r){var o;super(i),o=this,this.initContainer=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;var d,p;try{let g;if(!o.el||!(!((d=o.state)===null||d===void 0)&&d.container)||!Array.from(o.state.container.childNodes).includes(o.el)){o.el=document.createElement("div");const _=(o.props.getPopupContainer||l.getPopupContainer||XC)();return _.appendChild(o.el),o.addStyle(o.props.style),o.addClass(o.props.prefixCls,l,o.props.className),g=_,g}}catch(g){if(!f)throw g}return(p=o.state)===null||p===void 0?void 0:p.container},this.addStyle=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(o.el)for(const f of Object.keys(l))o.el.style[f]=l[f]},this.addClass=function(l){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o.context;const{direction:d}=f;for(var p=arguments.length,g=new Array(p>2?p-2:0),m=2;m<p;m++)g[m-2]=arguments[m];const _=Le(l,...g,{[`${l}-rtl`]:d==="rtl"});o.el&&(o.el.className=_)},this.state={container:this.initContainer(r,!0)}}componentDidMount(){const i=this.initContainer(this.context);i!==this.state.container&&this.setState({container:i})}componentDidUpdate(i){const{didUpdate:r}=this.props;r&&r(i)}componentWillUnmount(){const{container:i}=this.state;i&&i.removeChild(this.el)}render(){const{state:i,props:r}=this;return i.container?_d.createPortal(r.children,this.el):null}}Ra.contextType=xa;Ra.defaultProps={prefixCls:`${qn}-portal`};Ra.propTypes={children:v.node,prefixCls:v.string,getPopupContainer:v.func,className:v.string,didUpdate:v.func};var QC=function(s,i){var r={};for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.indexOf(o)<0&&(r[o]=s[o]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(s);l<o.length;l++)i.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(s,o[l])&&(r[o[l]]=s[o[l]]);return r};const YC=s=>{const{className:i,style:r}=s,o=QC(s,["className","style"]);return I.createElement("svg",Object.assign({"aria-hidden":!0,className:i,style:r},o,{width:"24",height:"7",viewBox:"0 0 24 7",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"}),I.createElement("path",{d:"M24 0V1C20 1 18.5 2 16.5 4C14.5 6 14 7 12 7C10 7 9.5 6 7.5 4C5.5 2 4 1 0 1V0H24Z"}))};var ZC=function(s,i){var r={};for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.indexOf(o)<0&&(r[o]=s[o]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var l=0,o=Object.getOwnPropertySymbols(s);l<o.length;l++)i.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(s,o[l])&&(r[o[l]]=s[o[l]]);return r};const JC=s=>{const{className:i,style:r}=s,o=ZC(s,["className","style"]);return I.createElement("svg",Object.assign({"aria-hidden":!0,className:i,style:r},o,{width:"7",height:"24",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor"}),I.createElement("path",{d:"M0 0L1 0C1 4, 2 5.5, 4 7.5S7,10 7,12S6 14.5, 4 16.5S1,20 1,24L0 24L0 0z"}))},eT=v.shape({offsetX:v.number,offsetY:v.number,width:v.number,height:v.number});class F1 extends I.Component{constructor(i){super(i),this.handleAnimationStart=()=>{var r,o;(o=(r=this.props).onAnimationStart)===null||o===void 0||o.call(r)},this.handleAnimationEnd=()=>{this.setState({currentClassName:this.props.endClassName,extraStyle:{animationFillMode:this.props.fillMode},isAnimating:!1},()=>{var r,o;(o=(r=this.props).onAnimationEnd)===null||o===void 0||o.call(r,!1)})},this.state={currentClassName:this.props.startClassName,extraStyle:{animationFillMode:this.props.fillMode},isAnimating:!0}}componentDidMount(){var i,r,o,l;(r=(i=this.props).onAnimationStart)===null||r===void 0||r.call(i),this.props.motion||((l=(o=this.props).onAnimationEnd)===null||l===void 0||l.call(o,!1),this.setState({isAnimating:!1}))}componentDidUpdate(i,r,o){const l=Object.keys(this.props).filter(f=>! Line truncated
+3 -3
View File
@@ -1,9 +1,9 @@
{
"schemaVersion": 1,
"product": "GenericAgent React Desktop 2.0",
"version": "0.2.0",
"version": "0.2.1",
"sourceRepository": "https://github.com/abraxas914/GenericAgent",
"sourceCommit": "21f12f6dfe57ada8572bb21fe6604caac230b1cf",
"sourceCommit": "4a67226e18cb003db1210357ea4a283774773acc",
"generatedAssetCount": 98,
"generatedManifestSha256": "7ed4bd56d50919d1ea6f92f60658403f19a93f117612704252f6e154ba39f92e"
"generatedManifestSha256": "06cbee59e1d232982095bb3966d7b23621b1aa785a6c7e90d82d66dedc5af7ed"
}
+1 -1
View File
@@ -21,7 +21,7 @@
<p class="ga-picker-status" id="picker-status" role="status" aria-live="polite"></p>
<button class="ga-primary" id="retry" type="button">继续启动</button>
<details><summary id="diagnostics-label">诊断信息</summary><div class="ga-diagnostics-actions"><button class="ga-copy" id="copy" type="button">复制诊断信息</button><span class="ga-copy-status" id="copy-status" aria-live="polite"></span></div><pre id="diagnostics" tabindex="0">GenericAgent Desktop startup diagnostics</pre><p class="ga-privacy" id="privacy">诊断信息由启动服务脱敏后提供,包含本机路径和错误日志,不包含 API Key、会话或记忆内容。</p></details>
<details><summary id="help-feedback-label">帮助与反馈</summary><p class="ga-contact-copy" id="contact-copy">如果仍无法完成启动,可添加微信联系:</p><div class="ga-contact-ids"><code>RoundSquisheen</code><code>_Ashes_in_the_Snow_</code></div></details>
<details><summary id="help-feedback-label">帮助与反馈</summary><p class="ga-contact-copy" id="contact-copy">如果仍无法完成启动,可添加微信联系:</p><div class="ga-contact-ids"><code>RoundSquisheen</code><code>persist0612</code></div></details>
</main>
<script>
(function () {
+5 -5
View File
@@ -23,14 +23,14 @@
document.documentElement.style.setProperty('--chat-font',cfp+'px');
})();
</script>
<script type="module" crossorigin src="/assets/main-Knf6L_en.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-tfiFK9EG.js">
<link rel="modulepreload" crossorigin href="/assets/index-Bpi3BHKj.js">
<link rel="modulepreload" crossorigin href="/assets/WindowsTitlebar-CrkUa1UM.js">
<script type="module" crossorigin src="/assets/main-j7e_THPB.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-D_GD_wMe.js">
<link rel="modulepreload" crossorigin href="/assets/index-9FI8Jlf5.js">
<link rel="modulepreload" crossorigin href="/assets/WindowsTitlebar-Byi-SYR_.js">
<link rel="stylesheet" crossorigin href="/assets/tauri-compat-BTcpEvqB.css">
<link rel="stylesheet" crossorigin href="/assets/index-D0pGtk0y.css">
<link rel="stylesheet" crossorigin href="/assets/WindowsTitlebar-U0YG9JNA.css">
<link rel="stylesheet" crossorigin href="/assets/main-uLcKKTNv.css">
<link rel="stylesheet" crossorigin href="/assets/main-gzsbzrvY.css">
</head>
<body class="no-transition">
<div id="app"></div>
+5 -5
View File
@@ -16,11 +16,11 @@ window.gaProgress = function (pct, key) {
window.__GA_LEGACY_PROGRESS__.push({ pct: pct, key: key });
};
</script>
<script type="module" crossorigin src="/assets/loading-VXGdS4iv.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-tfiFK9EG.js">
<link rel="modulepreload" crossorigin href="/assets/index-D_sWIqse.js">
<link rel="modulepreload" crossorigin href="/assets/Animation-TKQfYYOo.js">
<link rel="modulepreload" crossorigin href="/assets/WindowsTitlebar-CrkUa1UM.js">
<script type="module" crossorigin src="/assets/loading-C2VTZYXF.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-D_GD_wMe.js">
<link rel="modulepreload" crossorigin href="/assets/index-D9Nakaf3.js">
<link rel="modulepreload" crossorigin href="/assets/Animation-DbFrgT1j.js">
<link rel="modulepreload" crossorigin href="/assets/WindowsTitlebar-Byi-SYR_.js">
<link rel="stylesheet" crossorigin href="/assets/tauri-compat-BTcpEvqB.css">
<link rel="stylesheet" crossorigin href="/assets/index-DkG9Cu-r.css">
<link rel="stylesheet" crossorigin href="/assets/WindowsTitlebar-U0YG9JNA.css">
+5 -5
View File
@@ -34,11 +34,11 @@
window.__GA_SETUP_FALLBACK__ = fallback;
}());
</script>
<script type="module" crossorigin src="/assets/setup-BtYdaXRD.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-tfiFK9EG.js">
<link rel="modulepreload" crossorigin href="/assets/index-Bpi3BHKj.js">
<link rel="modulepreload" crossorigin href="/assets/index-DpGuh58E.js">
<link rel="modulepreload" crossorigin href="/assets/IconFile-CgfQSwGI.js">
<script type="module" crossorigin src="/assets/setup-BpPmqi-U.js"></script>
<link rel="modulepreload" crossorigin href="/assets/tauri-compat-D_GD_wMe.js">
<link rel="modulepreload" crossorigin href="/assets/index-9FI8Jlf5.js">
<link rel="modulepreload" crossorigin href="/assets/index-C-iCGtYr.js">
<link rel="modulepreload" crossorigin href="/assets/IconFile-C8B3WX2U.js">
<link rel="stylesheet" crossorigin href="/assets/tauri-compat-BTcpEvqB.css">
<link rel="stylesheet" crossorigin href="/assets/index-D0pGtk0y.css">
<link rel="stylesheet" crossorigin href="/assets/index-ClU1uQYs.css">
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "genericagent-web2",
"version": "0.2.0",
"version": "0.2.1",
"scripts": {
"tauri": "tauri",
"test:dist": "node scripts/verify-compiled-dist.mjs",
+6 -2
View File
@@ -16,6 +16,8 @@ The React source, issue tracker, and contribution home is
recorded in `dist/build-provenance.json`. `frontends/desktop/static/**` remains the independent Desktop v1 and is
unchanged by Desktop 2.0 packaging.
The submitted package, bundle, qualification, and provenance version for this release is `0.2.1`.
The Semi Design MIT text is tracked as `dist/THIRD_PARTY_NOTICES.txt`. Root attributes force the source notice and
compiled notice to LF on every platform, and all three package builders verify the locked notice SHA-256 before
building.
@@ -51,8 +53,10 @@ frontends/desktop/packaging/
`2acf865e87e59090121369aac0575467067fdd7999923a70d785a46ceae3330f` and failing on any byte drift.
- python-build-standalone is fixed at release `20260814`, CPython `3.12.14`, an explicit architecture, and an
archive SHA-256 on each platform.
- The macOS builder runs on the Apple-silicon `macos-15` host and uses host CPython `3.12.10` only for the
hash-locked DMG layout tools. That host interpreter is separate from the embedded `3.12.14` runtime.
- The macOS builder runs on the Apple-silicon `macos-26` host with
`DEVELOPER_DIR=/Applications/Xcode_26.5.app/Contents/Developer` and hard-fails unless Xcode `26.5`
(build `17F42`) and the macOS `26.5` SDK are active. Host CPython `3.12.10` is used only for the hash-locked
DMG layout tools and remains separate from the embedded `3.12.14` runtime.
- Windows converts `RUNNER_TEMP` with `cygpath -u` before passing its archive path to POSIX tools.
- Linux builds on Ubuntu 22.04, uses a dedicated glibc-2.35 Rust cache prefix with target/bin caching disabled,
and scans every packaged ELF to reject a maximum GLIBC requirement above 2.35.
@@ -39,7 +39,7 @@ BRIDGE_HOST = "127.0.0.1"
DEFAULT_BRIDGE_PORT = 14168
BRIDGE_PORT = DEFAULT_BRIDGE_PORT
BRIDGE_BASE = f"http://{BRIDGE_HOST}:{BRIDGE_PORT}"
RELEASE_VERSION = "0.2.0"
RELEASE_VERSION = "0.2.1"
CONDUCTOR_SERVICE_ID = "frontends/conductor.py"
DEFAULT_CONDUCTOR_PORT = 8900
E2E_CONDUCTOR_PORT_ENV = "GA_DESKTOP_E2E_CONDUCTOR_PORT"
@@ -56,8 +56,8 @@ def assert_report(name: str, report: dict[str, Any], expected_commit: str) -> li
actual_commit = str(report.get("expectedCommit", "")).lower()
if actual_commit != expected_commit.lower():
failures.append(f"{name}: commit {actual_commit!r} != {expected_commit!r}")
if report.get("releaseVersion") != "0.2.0":
failures.append(f"{name}: release version is not 0.2.0")
if report.get("releaseVersion") != "0.2.1":
failures.append(f"{name}: release version is not 0.2.1")
if report.get("success") is not True:
failures.append(f"{name}: automated qualification did not pass")
if not str(report.get("artifact", {}).get("sha256", "")):
@@ -152,7 +152,7 @@ def main() -> int:
manifest = {
"schemaVersion": 1,
"candidateCommit": args.expected_commit,
"releaseVersion": "0.2.0",
"releaseVersion": "0.2.1",
"platforms": {
name: {
"report": report["_path"],
@@ -7,8 +7,8 @@ import { fileURLToPath } from 'node:url';
const desktopDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const repoRoot = path.resolve(desktopDir, '..', '..');
const distDir = path.join(desktopDir, 'dist');
const expectedVersion = '0.2.0';
const expectedSourceCommit = '21f12f6dfe57ada8572bb21fe6604caac230b1cf';
const expectedVersion = '0.2.1';
const expectedSourceCommit = '4a67226e18cb003db1210357ea4a283774773acc';
const expectedNoticeSha256 = '2acf865e87e59090121369aac0575467067fdd7999923a70d785a46ceae3330f';
const noticeAttributeRules = [
'frontends/desktop/public/THIRD_PARTY_NOTICES.txt text eol=lf',
@@ -141,10 +141,10 @@ async function verifyVersionsRendererAndEntry() {
for (const sourceBuildKey of ['beforeBuildCommand', 'beforeDevCommand', 'devUrl']) {
if (sourceBuildKey in tauriConfig.build) fail(`compiled-only Tauri config must not require ${sourceBuildKey}`);
}
if (!/^\[package\][\s\S]*?^name = "ga-desktop"$[\s\S]*?^version = "0\.2\.0"$/m.test(cargoToml)) {
if (!/^\[package\][\s\S]*?^name = "ga-desktop"$[\s\S]*?^version = "0\.2\.1"$/m.test(cargoToml)) {
fail(`Cargo.toml ga-desktop version must be ${expectedVersion}`);
}
if (!/^\[\[package\]\][\s\S]*?^name = "ga-desktop"$\nversion = "0\.2\.0"$/m.test(cargoLock)) {
if (!/^\[\[package\]\][\s\S]*?^name = "ga-desktop"$\nversion = "0\.2\.1"$/m.test(cargoLock)) {
fail(`Cargo.lock ga-desktop version must be ${expectedVersion}`);
}
@@ -249,11 +249,15 @@ async function verifyReleaseContract() {
fail('Windows packaging must convert RUNNER_TEMP with cygpath before POSIX tools use it');
}
const macos = workflowJob(workflow, 'build-macos');
if (!macos.includes('runs-on: macos-15')
if (!macos.includes('runs-on: macos-26')
|| !macos.includes('DEVELOPER_DIR: /Applications/Xcode_26.5.app/Contents/Developer')
|| !macos.includes('test "$(uname -m)" = arm64')
|| !macos.includes('test "$(xcodebuild -version | sed -n \'1p\')" = "Xcode 26.5"')
|| !macos.includes('test "$(xcodebuild -version | sed -n \'2p\')" = "Build version 17F42"')
|| !macos.includes('test "$(xcrun --sdk macosx --show-sdk-version)" = "26.5"')
|| !workflow.includes('MACOS_PACKAGING_PYTHON_VERSION: "3.12.10"')
|| !workflow.includes('PBS_PYTHON_VERSION: "3.12.14"')) {
fail('macOS packaging must use the pinned arm64 host and separate Python inputs');
fail('macOS packaging must pin macos-26, Xcode 26.5 build 17F42, SDK 26.5, arm64, and separate Python inputs');
}
const linux = workflowJob(workflow, 'build-linux');
if (!linux.includes('runs-on: ubuntu-22.04')
@@ -347,12 +351,26 @@ async function main() {
if (forbiddenSource.length > 0) fail(`compiled distribution contains source files: ${forbiddenSource.join(', ')}`);
const searchableFiles = files.filter((file) => /\.(?:html|js|css)$/i.test(file));
const searchableContents = [];
for (const file of searchableFiles) {
const contents = await readFile(file, 'utf8');
searchableContents.push(contents);
if (/(?:webdriverio|__GA_E2E__|wdio:|sourceMappingURL|webpack:\/\/|\/Users\/)/i.test(contents)) {
fail(`compiled distribution leaks source/E2E material: ${relativeToDist(file)}`);
}
}
const compiledRenderer = searchableContents.join('\n');
for (const marker of [
'services/capabilities',
'data-import-row',
'data-export-row',
'get_macos_titlebar_metrics',
'titlebar-controls',
]) {
if (!compiledRenderer.includes(marker)) {
fail(`compiled distribution is missing the v0.2.1 renderer contract: ${marker}`);
}
}
const notice = await readFile(path.join(distDir, 'THIRD_PARTY_NOTICES.txt'));
if (sha256(notice) !== expectedNoticeSha256) fail('Semi Design third-party notice hash is incorrect');
+2 -1
View File
@@ -1253,9 +1253,10 @@ dependencies = [
[[package]]
name = "ga-desktop"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"dirs 5.0.1",
"objc2-app-kit",
"rfd",
"serde",
"serde_json",
+4 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "ga-desktop"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
[build-dependencies]
@@ -17,6 +17,9 @@ serde_json = "1"
dirs = "5"
rfd = "0.15"
[target.'cfg(target_os = "macos")'.dependencies]
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["NSButton", "NSControl", "NSView", "NSWindow"] }
[features]
default = []
e2e = ["dep:tauri-plugin-wdio", "dep:tauri-plugin-wdio-webdriver"]
@@ -21,6 +21,7 @@
"allow-validate-ga-source",
"allow-set-ga-source",
"allow-clear-ga-source",
"allow-get-macos-titlebar-metrics",
"allow-shortcut-should-ask",
"allow-shortcut-decide",
"opener:allow-open-url",
@@ -78,6 +78,11 @@ identifier = "allow-clear-ga-source"
description = "Clear the external GA source override and fall back to the bundled runtime."
commands.allow = ["clear_ga_source"]
[[permission]]
identifier = "allow-get-macos-titlebar-metrics"
description = "Read native macOS traffic-light geometry for the main window."
commands.allow = ["get_macos_titlebar_metrics"]
[[permission]]
identifier = "allow-shortcut-should-ask"
description = "Check whether to show the first-run desktop-shortcut prompt."
+96
View File
@@ -2729,6 +2729,101 @@ async fn clear_ga_source(app_handle: tauri::AppHandle) -> Result<String, String>
apply_ga_source_with_rollback(app_handle, None, previous_override).await
}
#[derive(Clone, Debug, Serialize)]
#[serde(rename_all = "camelCase")]
struct MacosTitlebarMetrics {
traffic_light_center_y: f64,
traffic_light_right_x: f64,
}
#[cfg(target_os = "macos")]
fn measure_macos_titlebar_metrics(
webview: &tauri::webview::PlatformWebview,
) -> Result<MacosTitlebarMetrics, String> {
use objc2_app_kit::{NSView, NSWindow, NSWindowButton};
let ns_window = webview.ns_window();
let webview_handle = webview.inner();
if ns_window.is_null() || webview_handle.is_null() {
return Err("macOS titlebar native handles are unavailable".to_string());
}
// SAFETY: Tauri documents these handles as the NSWindow and WKWebView for
// this callback. with_webview schedules the callback on the main thread.
let window = unsafe { &*ns_window.cast::<NSWindow>() };
let content_view = unsafe { &*webview_handle.cast::<NSView>() };
let bounds = content_view.bounds();
let mut min_y = f64::INFINITY;
let mut max_x = f64::NEG_INFINITY;
let mut max_y = f64::NEG_INFINITY;
for kind in [
NSWindowButton::CloseButton,
NSWindowButton::MiniaturizeButton,
NSWindowButton::ZoomButton,
] {
let button = window
.standardWindowButton(kind)
.ok_or_else(|| "macOS titlebar button is unavailable".to_string())?;
// SAFETY: AppKit owns the standard button and its superview for the
// lifetime of this main-thread callback.
let superview = unsafe { button.superview() }
.ok_or_else(|| "macOS titlebar button has no superview".to_string())?;
let rect = content_view.convertRect_fromView(button.frame(), Some(&superview));
min_y = min_y.min(rect.origin.y);
max_x = max_x.max(rect.origin.x + rect.size.width);
max_y = max_y.max(rect.origin.y + rect.size.height);
}
let appkit_center_y = min_y + (max_y - min_y) / 2.0;
let traffic_light_center_y = if content_view.isFlipped() {
appkit_center_y - bounds.origin.y
} else {
bounds.origin.y + bounds.size.height - appkit_center_y
};
let metrics = MacosTitlebarMetrics {
traffic_light_center_y,
traffic_light_right_x: max_x - bounds.origin.x,
};
if !metrics.traffic_light_center_y.is_finite()
|| !metrics.traffic_light_right_x.is_finite()
|| metrics.traffic_light_center_y < 0.0
|| metrics.traffic_light_right_x < 0.0
{
return Err("macOS titlebar metrics are invalid".to_string());
}
Ok(metrics)
}
#[tauri::command]
async fn get_macos_titlebar_metrics(
window: tauri::WebviewWindow,
) -> Result<Option<MacosTitlebarMetrics>, String> {
#[cfg(target_os = "macos")]
{
let (sender, receiver) = std::sync::mpsc::sync_channel(1);
window
.with_webview(move |webview| {
let _ = sender.send(measure_macos_titlebar_metrics(&webview));
})
.map_err(|error| format!("cannot schedule macOS titlebar measurement: {error}"))?;
return tauri::async_runtime::spawn_blocking(move || {
receiver
.recv_timeout(Duration::from_secs(1))
.map_err(|_| "macOS titlebar measurement timed out".to_string())?
.map(Some)
})
.await
.map_err(|error| format!("macOS titlebar measurement task failed: {error}"))?;
}
#[cfg(not(target_os = "macos"))]
{
let _ = window;
Ok(None)
}
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let args: Vec<String> = std::env::args().collect();
@@ -2783,6 +2878,7 @@ pub fn run() {
validate_ga_source,
set_ga_source,
clear_ga_source,
get_macos_titlebar_metrics,
shortcut_should_ask,
shortcut_decide
])
+1 -1
View File
@@ -1,6 +1,6 @@
{
"productName": "GenericAgent",
"version": "0.2.0",
"version": "0.2.1",
"identifier": "com.genericagent.app",
"build": {
"frontendDist": "../dist"
+100 -5
View File
@@ -23,6 +23,7 @@ HTTP API:
POST /services/stop body: {"id":"frontends/qqapp.py"}
GET /services/logs?id=frontends/qqapp.py&tail=200
GET /services/panel
GET /services/capabilities
GET /services/mykey
POST /services/mykey body: {"content":"..."}
POST /services/stop-extras stop conductor + scheduler (127.0.0.1 only)
@@ -724,7 +725,22 @@ class AgentManager:
def update_model_profile(self, profile_id: int, data: dict) -> dict:
var, existing = self._profile_at(profile_id)
text = self._mykey_file().read_text(encoding="utf-8")
profiles = self._save_mykey_text(self._patch_var_block(text, var, self._build_cfg(data, existing, require_key=False)))
# Sync mixin llm_nos when name changes to avoid orphan references
old_name = str(existing.get("name") or existing.get("model") or "").strip()
new_cfg = self._build_cfg(data, existing, require_key=False)
new_name = str(new_cfg.get("name") or new_cfg.get("model") or "").strip()
if old_name != new_name:
keys, mk = self._mykey_vars()
mvar, mcfg = self._mixin_entry(keys, mk)
if mcfg and mvar is not None and old_name in [str(m) for m in (mcfg.get("llm_nos") or [])]:
# Replace old name with new name in mixin's llm_nos
updated_nos = [new_name if str(m) == old_name else str(m) for m in (mcfg.get("llm_nos") or [])]
mcfg = {**mcfg, "llm_nos": updated_nos}
text = self._patch_var_block(text, mvar, mcfg)
profiles = self._save_mykey_text(self._patch_var_block(text, var, new_cfg))
return {"varName": var, "profileId": profile_id, "profiles": profiles}
def delete_model_profile(self, profile_id: int) -> dict:
@@ -1006,7 +1022,9 @@ class AgentManager:
sess.cancel_requested = False
sess.active_turn_id = turn_id
sess.last_error = ""
sess.partial = {"id": sess.msg_seq + 1, "role": "assistant", "content": "", "ts": time.time(), "partial": True,
_turn_start = time.time()
sess.partial = {"id": sess.msg_seq + 1, "role": "assistant", "content": "", "ts": _turn_start, "partial": True,
"turn_started": _turn_start, # stable turn-start clock (ts gets bumped on each stream chunk)
"curr_turn": 0, "turn_segs": []} # turn_segs[i]=第i轮全文(权威结构化,前端按轮渲染);content保留双轮兜底
image_paths = [m["path"] for m in (image_metas or []) if m.get("path")]
t = threading.Thread(
@@ -1196,16 +1214,19 @@ class AgentManager:
with self.lock:
if sess.active_turn_id != turn_id:
return
turn_started = sess.partial.get("turn_started") if sess.partial else None
sess.partial = None
full = strip_final_info_marker(full)
import plan_state
plan_state.sync_plan_path_from_text(sess, full, sess.cwd or self.ga_root)
# 轨道2: 落库时带结构化全量轮(权威turn_segs),前端按轮渲染;content保留兜底
_final_segs = normalize_final_turn_segs(full, done_outputs)
msg_extra = {}
if _final_segs:
self.add_message(sess, "assistant", full, turn_segs=_final_segs)
else:
self.add_message(sess, "assistant", full)
msg_extra["turn_segs"] = _final_segs
if turn_started:
msg_extra["executionMs"] = round((time.time() - turn_started) * 1000)
self.add_message(sess, "assistant", full, **msg_extra)
try: sess.llm_history = json.loads(json.dumps(agent.llmclient.backend.history, ensure_ascii=False, default=str))
except Exception: pass
sess.running_llm_no = None
@@ -1941,6 +1962,29 @@ def _allowed_request_origins() -> Set[str]:
return origins
# Read-only GET endpoints that are meant to be loaded as browser subresources
# (<img>/<video>/<audio>/font). Cross-origin resource loads never carry an
# Origin header but do set Sec-Fetch-Site: cross-site, so the generic CSRF guard
# below would 403 them. These endpoints have no side effects and are confined to
# a whitelisted directory, so a cross-site *resource* GET/HEAD is safe to allow.
_RESOURCE_GET_PATHS = frozenset({"/upload/raw"})
_RESOURCE_FETCH_DESTS = frozenset({"image", "video", "audio", "font"})
def _is_safe_cross_site_resource_get(request) -> bool:
"""True for a no-side-effect subresource GET the desktop webview issues for
a message-bubble thumbnail (bridge origin differs from the tauri app origin,
so the <img> request is cross-site and carries no Origin header)."""
if request.method not in ("GET", "HEAD"):
return False
if request.path not in _RESOURCE_GET_PATHS:
return False
dest = request.headers.get("Sec-Fetch-Dest", "").strip().lower()
# Only genuine subresource loads — never a cross-site top-level navigation
# (Sec-Fetch-Dest: document) — are exempted.
return dest in _RESOURCE_FETCH_DESTS
def _request_origin_error(request) -> Optional[str]:
origin = request.headers.get("Origin")
if origin is not None:
@@ -1948,6 +1992,8 @@ def _request_origin_error(request) -> Optional[str]:
return "request origin is not allowed"
return None
if request.headers.get("Sec-Fetch-Site", "").strip().lower() == "cross-site":
if _is_safe_cross_site_resource_get(request):
return None
return "cross-site request without an Origin header is not allowed"
return None
@@ -2399,6 +2445,49 @@ async def upload_handler(request):
return json_ok({"ok": True, "path": str(fpath)})
# Max bytes we will base64 back to the webview for an image preview. Larger
# images (and all non-images) skip the read: the agent opens them by path.
_DROP_PREVIEW_MAX = 50 * 1024 * 1024
async def drop_stat_handler(request):
"""Inspect a path dropped onto the window via Tauri's native drag-drop.
Body: {path: "<abs path>", preview: <bool>}
Native drops give absolute paths (not File objects), so the client asks the
bridge what the path is. Returns is_dir + size for every path; when preview
is truthy and the target is a readable image under the size cap, also returns
a base64 data payload so the composer can render a thumbnail. Files and
folders otherwise travel to the agent by path alone (it reads via file_read
/ os.walk), so no bytes cross the wire for them.
"""
import mimetypes
data = await read_json(request)
raw = (data.get("path") or "").strip()
want_preview = bool(data.get("preview"))
if not raw:
return json_ok({"ok": False, "error": "missing path"})
try:
target = Path(raw)
st = target.stat()
except FileNotFoundError:
return json_ok({"ok": False, "error": "not found"})
except OSError as e:
return json_ok({"ok": False, "error": str(e)})
is_dir = target.is_dir()
size = 0 if is_dir else st.st_size
result = {"ok": True, "is_dir": is_dir, "size": size, "name": target.name}
if want_preview and not is_dir and size <= _DROP_PREVIEW_MAX:
ctype = mimetypes.guess_type(target.name)[0] or ""
if ctype.startswith("image/") and ctype != "image/svg+xml":
try:
encoded = base64.b64encode(target.read_bytes()).decode("ascii")
result["preview"] = f"data:{ctype};base64,{encoded}"
except OSError:
pass
return json_ok(result)
async def upload_delete_handler(request):
"""Delete a previously-uploaded file. Path must live under _WEB_UPLOAD_DIR."""
data = await read_json(request)
@@ -2733,6 +2822,10 @@ async def identity_handler(request):
"build_id": os.environ.get("GA_BUILD_ID", "")})
async def service_capabilities_handler(request):
return json_ok({"dataBackup": True})
def _exit_bridge() -> None:
with contextlib.suppress(Exception):
services.stop_all_extras()
@@ -2855,6 +2948,7 @@ def create_app():
app.router.add_post("/upload", upload_handler)
app.router.add_delete("/upload", upload_delete_handler)
app.router.add_get("/upload/raw", upload_raw_handler)
app.router.add_post("/drop/stat", drop_stat_handler)
app.router.add_get("/token-stats", token_stats_handler)
app.router.add_get("/token-history", get_token_history_handler)
app.router.add_get("/subscription-portal", subscription_portal_handler)
@@ -2872,6 +2966,7 @@ def create_app():
app.router.add_post("/services/conductor/model", conductor_model_save_handler)
app.router.add_post("/services/stop-extras", stop_extras_handler)
app.router.add_post("/services/start-extras", start_extras_handler)
app.router.add_get("/services/capabilities", service_capabilities_handler)
app.router.add_get("/services/identity", identity_handler)
app.router.add_post("/services/bridge/exit", bridge_exit_handler)
if _e2e_control_token() is not None:
+25 -6
View File
@@ -46,7 +46,8 @@ body{margin:0;height:100vh;display:flex;background:var(--bg);color:var(--fg);
#tip{min-height:16px;margin-top:5px;font-size:12px;color:var(--dim)}
#tip.err{color:#c0392b}
#main>.hd{font-size:18px;margin-bottom:18px;padding-bottom:12px;
border-bottom:1px solid var(--line)}
border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px}
#main>.hd .ttl{flex:1} #main>.hd .llm{font-size:12px;max-width:180px}
.msg{margin:0 0 14px}
.msg.user{background:var(--user);border-radius:12px;padding:10px 14px;
white-space:pre-wrap;max-width:70%;margin-left:auto}
@@ -116,7 +117,7 @@ async function loadPeers(){
d.className = 'peer' + (p.name === cur ? ' on' : '');
d.dataset.name = p.name;
d.innerHTML = `<div class="t">${esc(p.title || p.name)}</div>
<div class="m">${esc(p.name)} · ${p.n_msgs} 条</div>`;
<div class="m">${esc(p.name)} · ${p.n_msgs} 条${p.llm ? ' · ' + esc(p.llm) : ''}</div>`;
d.onclick = () => open_(p.name);
el.appendChild(d);
}
@@ -156,8 +157,9 @@ async function sync(first){
if (!first && (olds.length > total || (olds.length && t0 && olds[0]._input !== t0.input)))
return open_(name);
const atEnd = m.scrollHeight - m.scrollTop - m.clientHeight < 80;
if (first || !m.querySelector('.hd')) m.innerHTML = '<div class="hd"></div>';
m.querySelector('.hd').textContent = r.title || name;
if (first || !m.querySelector('.hd')) m.innerHTML = '<div class="hd"><span class="ttl"></span><select class="llm" title="切换 LLM"></select></div>';
m.querySelector('.hd .ttl').textContent = r.title || name;
llmSel(m.querySelector('.hd .llm'), name, r.llm);
for (const t of tasks){
const el = m.querySelector(`.task[data-i="${t.i}"]`);
@@ -228,6 +230,23 @@ function segEl(name, i, s){
return det;
}
// LLM channel switch: the <select> lists the host's channels on first click, POST llm {no} on change
function llmSel(sel, name, llm){
if (sel._llm === llm) return; sel._llm = llm;
sel.innerHTML = `<option>${esc(llm || '?')}</option>`; sel.disabled = !llm;
sel.onmousedown = async () => {
if (sel.options.length > 1) return;
const r = await api(`/api/${encodeURIComponent(name)}/llms`);
if (r.error) return;
sel.innerHTML = r.items.map((n, i) => `<option value="${i}"${i === r.cur ? ' selected' : ''}>${esc(n)}</option>`).join('');
};
sel.onchange = async () => {
const r = await post('llm', {no: +sel.value});
say(r.error || '已切换 ' + sel.options[sel.selectedIndex].text, !!r.error);
if (r.error) sel._llm = null; // next sync repaints the true state
};
}
// ---- composer: send a task / abort the running one (both are idempotent-safe) ----
const box = $('#box'), tip = $('#tip');
@@ -235,11 +254,11 @@ function say(t, err){ tip.textContent = t || ''; tip.classList.toggle('err', !!e
function enable(on){ for (const e of [box, $('#send'), $('#stop')]) e.disabled = !on;
box.placeholder = on ? 'Enter 发送 / Shift+Enter 换行' : '先选择一个会话…'; }
async function post(path){ // -> {ok} | {error, code}
async function post(path, body){ // -> {ok} | {error, code}
try {
const r = await fetch(`/api/${encodeURIComponent(cur)}/${path}`, {
method: 'POST', headers: {'Content-Type': 'application/json'},
body: JSON.stringify({text: box.value})});
body: JSON.stringify(body || {text: box.value})});
return await r.json();
} catch(e){ return {error: '网络错误'}; }
}
+60 -9
View File
@@ -1,10 +1,11 @@
"""GA Hub: `import hub` -> client (silent if no server); `python hub.py` -> WS server.
hub.connect(agent, 'stapp') # or override any hook: connect(a, n, put_task=, get_outputs=, abort=)
hub.connect(agent, 'stapp') # or override any hook: connect(a, n, put_task=, get_outputs=, abort=, llm=)
default put -> 'busy' if agent.is_running, else parks plain text in agent._hub_inbox for the UI
HTTP (errors = {'error','code'} + status: offline/gone 404, busy 409, timeout 504, nosupport 501, badop 400):
GET peers -> [{name,title,n_msgs,sig}] | {name}/messages?detail=1&sig= -> {title,tasks:[{i,input,steps:
[{j,title,n}]}],sig} or {same:1,sig} | {name}/seg/{i}/{j}?off=N -> {content,off,n} (step bodies, tailable)
POST {name}/put {"text":..} -> {ok:1} | {name}/abort -> {ok:1}
GET {name}/llms -> {cur,items:[name]} | POST {name}/llm {"no":N} -> {ok:1,cur} (switch LLM channel, busy 409)
"""
import os, re, sys, json, time, asyncio, threading, random, hmac, hashlib
PORT = int(os.environ.get('GA_HUB_PORT', 19736))
@@ -15,8 +16,8 @@ TITLE_MIN = 12 # a too short last input gets the previous one
NOISE = re.compile(r'\**LLM Running \(Turn \d+\) \.\.\.\**|`{3,}.*?`{3,}|<thinking>.*?</thinking>', re.DOTALL)
class HubClient:
def __init__(self, name, put_task=None, get_outputs=None, abort=None, state=None, on_ev=None, sub=(), fixed=False):
self.name, self.put_task, self.get_outputs, self.abort = name, put_task, get_outputs, abort
def __init__(self, name, put_task=None, get_outputs=None, abort=None, state=None, on_ev=None, sub=(), fixed=False, llm=None, inject=None):
self.name, self.put_task, self.get_outputs, self.abort, self.llm, self.inject = name, put_task, get_outputs, abort, llm, inject
self.state, self.on_ev, self.sub, self.fixed = state or dict, on_ev, list(sub), fixed # fixed -> stable name
self._tc, self._ws, self._lp = {}, None, None # (i,j) -> (fp, title): a finished step is never re-scanned
def emit(self, topic, data=None, to=None): # thread-safe fire-and-forget from the host thread
@@ -31,7 +32,7 @@ class HubClient:
try:
async with websockets.connect(URL, open_timeout=3, max_size=None) as ws:
self._ws, self._lp = ws, asyncio.get_running_loop()
caps = [k for k, v in (('get', self.get_outputs), ('put', self.put_task), ('abort', self.abort)) if v]
caps = [k for k, v in (('get', self.get_outputs), ('put', self.put_task), ('abort', self.abort), ('llm', self.llm), ('inject', self.inject)) if v]
await ws.send(json.dumps({'op': 'hello', 'name': self.name, 'pid': os.getpid(),
'fixed': self.fixed, 'caps': caps, 'sub': self.sub}))
async for raw in ws: await self._on_cmd(ws, json.loads(raw))
@@ -76,8 +77,28 @@ class HubClient:
if op in ('get', 'seg'): data = await asyncio.to_thread(self._build if op == 'get' else self._seg, c)
elif op == 'put_task': data = (c.get('text') and await asyncio.to_thread(self.put_task, c['text'])) or {'ok': 1}
elif op == 'abort': data = (await asyncio.to_thread(self.abort) or {'ok': 1}) if self.abort else {'error': 'no abort hook', 'code': 'nosupport'}
elif op == 'llm': data = await asyncio.to_thread(self.llm, c.get('no')) if self.llm else {'error': 'no llm hook', 'code': 'nosupport'}
elif op == 'inject': data = (await asyncio.to_thread(self.inject, c.get('kind'), c.get('text')) or {'ok': 1}) if self.inject else {'error': 'no inject hook', 'code': 'nosupport'}
await ws.send(json.dumps({'op': 'r', 'id': c.get('id'), 'name': self.name, 'data': data}, default=str))
_ROUTES = {'put': ('POST', 'put'), 'abort': ('POST', 'abort'), 'intervene': ('POST', 'intervene'), 'keyinfo': ('POST', 'keyinfo'),
'llm': ('POST', 'llm'), 'llms': ('GET', 'llms'), 'messages': ('GET', 'messages')}
def call(name=None, op='peers', timeout=20, **kw):
"""Drive any registered GA over HTTP (token from temp/.hub_token), e.g. from another GA:
hub.call('stapp-123', 'intervene', text=...) | 'keyinfo' (running only) | 'put' (idle only) | 'abort' | 'messages' | 'llm', no=N"""
import urllib.request, urllib.parse
tok = os.environ.get('GA_HUB_TOKEN') or open(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'temp', '.hub_token'), encoding='utf-8').read().strip()
if op == 'peers': method, path = 'GET', '/api/peers'
else: method, sub = _ROUTES[op]; path = f'/api/{urllib.parse.quote(name)}/{sub}'
q = {'t': tok, **(kw if method == 'GET' else {})}
req = urllib.request.Request(f'http://127.0.0.1:{WEB_PORT}{path}?{urllib.parse.urlencode(q)}', method=method,
data=json.dumps(kw).encode() if method == 'POST' else None, headers={'Content-Type': 'application/json'})
try: r = urllib.request.build_opener(urllib.request.ProxyHandler({})).open(req, timeout=timeout).read()
except urllib.error.HTTPError as e: r = e.read()
return json.loads(r or b'{}')
def peers(): return call()
def serve():
"""Bring the hub up on demand: any host may spawn it, the port is the lock (a loser just exits).
Detached + windowless, so it outlives its spawner and no console ever flashes."""
@@ -91,7 +112,7 @@ def serve():
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
creationflags=0x08000008 if os.name == 'nt' else 0) # DETACHED | NO_WINDOW
def connect(agent, name=None, put_task=None, get_outputs=None, abort=None, fold=None):
def connect(agent, name=None, put_task=None, get_outputs=None, abort=None, fold=None, llm=None, inject=None):
"""One line to wire a GA host: `hub.connect(agent, 'stapp')`; any hook can still be overridden.
Default put refuses while the agent is busy (a remote must not cut in line), else it parks
plain text in agent._hub_inbox; the UI feeds it through its own input entrance when idle,
@@ -101,13 +122,27 @@ def connect(agent, name=None, put_task=None, get_outputs=None, abort=None, fold=
if not isinstance(text, str): return {'error': 'text must be a string', 'code': 'badop'}
if getattr(agent, 'is_running', False): return {'error': f'peer {name} is busy', 'code': 'busy'}
agent._hub_inbox.append(text) # no put_task here: the UI's unified entrance sends it
def _llm(no=None): # no=None -> list; no=N -> switch channel (same as the stapp sidebar)
if no is None: return {'cur': agent.llm_no, 'items': [n for _, n, _ in agent.list_llms()]}
if getattr(agent, 'is_running', False): return {'error': f'peer {name} is busy', 'code': 'busy'}
if not 0 <= no < len(agent.list_llms()): return {'error': f'no llm #{no}', 'code': 'badop'}
agent.next_llm(no); return {'ok': 1, 'cur': no}
def _inject(kind, text): # mid-run steering, read by ga turn_end as [MASTER] (same as _intervene/_keyinfo files)
attr = {'intervene': 'intervene', 'keyinfo': 'extrakeyinfo'}.get(kind)
if not attr or not isinstance(text, str) or not text: return {'error': 'kind must be intervene|keyinfo, text non-empty', 'code': 'badop'}
if not getattr(agent, 'is_running', False): return {'error': f'peer {name} is idle, use put', 'code': 'idle'}
old = getattr(agent, attr, None)
setattr(agent, attr, f'{old}\n\n{text}' if old else text) # append: several injects in one turn all land
try:
try: serve() # best effort: bring up a local hub if none is listening
except Exception: pass
if not hasattr(agent, '_hub_inbox'): agent._hub_inbox = []
agent._hub = HubClient(name or getattr(agent, 'name', 'agent'), put_task or _put,
get_outputs or (lambda: agent.all_outputs), abort or agent.abort,
state=lambda: {'run': bool(getattr(agent, 'is_running', False))})
llm=llm or (_llm if hasattr(agent, 'list_llms') else None),
inject=inject or (_inject if hasattr(agent, 'intervene') else None),
state=lambda: {'run': bool(getattr(agent, 'is_running', False)),
'llm': getattr(getattr(agent, 'llmclient', None), 'name', '')})
return agent._hub.start()
except Exception: return None
@@ -116,7 +151,15 @@ if __name__ == '__main__':
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, Request, Response
from fastapi.responses import FileResponse, JSONResponse; import uvicorn
HERE, OK_ORIGIN = os.path.dirname(os.path.abspath(__file__)), ('', f'http://127.0.0.1:{PORT}', f'http://localhost:{PORT}')
STATUS = {'offline': 404, 'gone': 404, 'timeout': 504, 'nosupport': 501, 'badop': 400, 'busy': 409}
TOKEN_FILE = os.path.join(os.path.dirname(HERE), 'temp', '.hub_token') # detached spawn drops stdout: token lives here
if not os.environ.get('GA_HUB_TOKEN'): # env > persisted file > fresh random
try: TOKEN = open(TOKEN_FILE, encoding='utf-8').read().strip() or TOKEN
except OSError: pass
try:
os.makedirs(os.path.dirname(TOKEN_FILE), exist_ok=True)
with open(TOKEN_FILE, 'w', encoding='utf-8') as f: f.write(TOKEN)
except OSError: pass
STATUS = {'offline': 404, 'gone': 404, 'timeout': 504, 'nosupport': 501, 'badop': 400, 'busy': 409, 'idle': 409}
app, peers, meta, waits, seq, pcache, pdead = FastAPI(), {}, {}, {}, [0], {}, {} # ws / hello / futures / row / probe
@app.middleware('http')
async def guard(req: Request, call_next):
@@ -175,10 +218,10 @@ if __name__ == '__main__':
if 'get' not in caps: rows.append({'name': n, 'title': '', 'n_msgs': 0, 'sig': None, 'caps': caps}); continue
if r is None or r.get('error') or (r.get('same') and n in pcache): # busy/skipped/idle -> last row
rows.append({**(pcache.get(n) or {'name': n, 'title': '?', 'n_msgs': 0, 'sig': None}),
'caps': caps, 'run': (r or {}).get('run')}); continue
'caps': caps, 'run': (r or {}).get('run'), 'llm': (r or {}).get('llm')}); continue
msgs = sum(1 for t in r.get('tasks', []) if not (t.get('input') or '').lstrip().startswith('/'))
rows.append({'name': n, 'title': r.get('title', '?'), 'n_msgs': msgs, 'sig': r.get('sig'),
'caps': caps, 'run': r.get('run')})
'caps': caps, 'run': r.get('run'), 'llm': r.get('llm')})
if r.get('sig'): pcache[n] = rows[-1]
for n in [x for x in pcache if x not in peers]: pcache.pop(n, None)
if psig is None: return rows
@@ -193,8 +236,16 @@ if __name__ == '__main__':
t = body.get('text', '')
if not isinstance(t, str): return JSONResponse({'error': 'text must be a string', 'code': 'badop'}, 400)
return out(await ask(name, {'op': 'put_task', 'text': t}))
@app.post('/api/{name}/intervene')
async def api_intervene(name: str, body: dict): return out(await ask(name, {'op': 'inject', 'kind': 'intervene', 'text': body.get('text')}))
@app.post('/api/{name}/keyinfo')
async def api_keyinfo(name: str, body: dict): return out(await ask(name, {'op': 'inject', 'kind': 'keyinfo', 'text': body.get('text')}))
@app.post('/api/{name}/abort')
async def api_abort(name: str): return out(await ask(name, {'op': 'abort'}))
@app.get('/api/{name}/llms')
async def api_llms(name: str): return out(await ask(name, {'op': 'llm'}))
@app.post('/api/{name}/llm')
async def api_llm(name: str, body: dict): return out(await ask(name, {'op': 'llm', 'no': int(body.get('no', -1))}))
# ---- optional P2P pairing; delete this block to remove it completely ----
try:
from hub_p2p import install as _install_p2p
+6 -1
View File
@@ -1,6 +1,7 @@
"""Optional P2P phone pairing plug-in for hub.py."""
import asyncio
import os
import random
from pathlib import Path
from fastapi import Response
@@ -28,6 +29,7 @@ def install(app, *, web_port, token, here):
await exporter.close()
async def reconnect():
delay = 1
while True:
connected = False
try:
@@ -42,7 +44,10 @@ def install(app, *, web_port, token, here):
raise
except Exception as exc:
state["status"], state["error"] = "error", str(exc)
await asyncio.sleep(0.2 if connected else 5)
# 连上过就立刻重连(对端掉线/被顶号);连不上则指数退避+抖动,
# 避免服务端重启时上千个 hub 同一秒齐涌。
delay = 1 if connected else min(delay * 2, 60)
await asyncio.sleep(0.2 if connected else delay * random.uniform(0.5, 1.5))
async def new_pair():
try:
+19 -2
View File
@@ -140,7 +140,10 @@ class Signal:
return signed_url(self.url, "ws", self.room, self.access_key)
async def start(self):
self._ws = await websockets.connect(self._signed_url(), max_size=1 << 21)
# 半开连接(切网/熄屏)靠 ping 在 ~25s 内暴露,默认 20+20s 太慢
self._ws = await websockets.connect(
self._signed_url(), max_size=1 << 21, ping_interval=15, ping_timeout=10,
)
self._ready.set()
self._task = asyncio.create_task(self._loop())
return self
@@ -162,7 +165,21 @@ class Signal:
return self._queues.setdefault(type_, asyncio.Queue())
async def expect(self, type_: str, timeout: float = 15):
return await asyncio.wait_for(self.queue(type_).get(), timeout)
"""等指定类型消息;连接关闭或服务端报错(如被顶号)时立即抛错,不傻等到超时。"""
want = asyncio.ensure_future(self.queue(type_).get())
fail = [asyncio.ensure_future(self.queue(t).get()) for t in ("closed", "error")]
try:
done, _ = await asyncio.wait(
[want, *fail], timeout=timeout, return_when=asyncio.FIRST_COMPLETED)
if want in done:
return want.result()
if not done:
raise asyncio.TimeoutError(f"no {type_!r} within {timeout}s")
raise ConnectionError(f"signal ended while waiting {type_!r}: {next(iter(done)).result()}")
finally:
for f in (want, *fail):
if not f.done():
f.cancel()
async def send(self, obj: dict, timeout: float = 15):
"""等连接就绪后发送;重连期间会阻塞而不是直接失败。"""
+15 -4
View File
@@ -284,16 +284,21 @@ def _poll_main_task(max_items=256):
def _render_stat_badge(is_running):
if 'task_start_ts' not in st.session_state or not hasattr(llmcore, 'STATS'): return
end_ts = time.time() if is_running else st.session_state.get('task_end_ts', time.time())
now = time.time()
end_ts = now if is_running else st.session_state.get('task_end_ts', now)
secs = max(0, int(end_ts - st.session_state.task_start_ts))
stats = dict(llmcore.STATS)
short = lambda n: f'{n / 1000:.0f}k' if n >= 1000 else str(n)
_p = []
if stats.get('t_start') and stats.get('t_ttft') is not None and stats['t_ttft'] != stats['t_start']:
_p.append(f"ttft{stats['t_ttft'] - stats['t_start']:.1f}s")
if stats.get('tps'): _p.append(f"{stats['tps']:.0f}t/s")
_tail = (' │ ' + '·'.join(_p)) if _p else ''
usage = ((f"{stats['session']} │ " if stats.get('session') else '') +
f"{short(stats['ctx'])} chars·{stats['msgs']}msgs │ "
f"in {short(stats.get('inp', 0))} toks·cached{short(stats.get('cached', 0))}·out{short(stats.get('out', 0))} │ "
f"in {short(stats.get('inp', 0))} toks·cached{short(stats.get('cached', 0))}·out{short(stats.get('out', 0))}{_tail}"
if 'ctx' in stats else '')
st.markdown(f'<div class="ga-stat-badge">{usage}{secs // 60}:{secs % 60:02d}</div>',
unsafe_allow_html=True)
st.markdown(f'<div class="ga-stat-badge">{usage} │ {secs // 60}:{secs % 60:02d}</div>', unsafe_allow_html=True)
if not hasattr(agent, "_ui_messages"): agent._ui_messages = st.session_state.get("messages", [])
@@ -359,6 +364,7 @@ if prompt:
st.session_state.reply_ts = ""
st.session_state.current_prompt = ""
st.session_state.last_reply_time = int(time.time())
st.session_state.show_full_history = False
st.rerun()
def _slash_missing(name):
st.session_state.messages.extend([
@@ -379,6 +385,11 @@ if prompt:
target = sessions[idx][0] if 0 <= idx < len(sessions) else None
result = handle_frontend_command(agent, cmd)
history = extract_ui_messages(target) if target and result.startswith('✅') else None
if history:
for x in history:
if x['role'] == 'assistant' and len(x['content']) > 120_000:
m = re.search(r'\**LLM Running \(Turn \d+\) \.\.\.\**', x['content'][-120_000:])
x['content'] = x['content'][-120_000 + m.start():] if m else ''
tail = [{"role": "assistant", "content": result, "time": ts}]
if history: st.session_state.messages[:] = history + tail
else: st.session_state.messages.extend([{"role": "user", "content": cmd, "time": ts}] + tail)
@@ -0,0 +1,40 @@
"""Regression coverage for explicit Desktop bridge capabilities."""
from __future__ import annotations
import asyncio
import pytest
from aiohttp.test_utils import TestClient, TestServer
from frontends.tests.test_bridge_sessions import _mod as bridge
def test_real_aiohttp_routes_expose_data_backup_capability(
monkeypatch: pytest.MonkeyPatch,
) -> None:
monkeypatch.setattr(bridge.services, "autostart_extras", lambda: None)
monkeypatch.setattr(bridge.services, "stop_all_extras", lambda: None)
async def scenario() -> None:
app = bridge.create_app()
client = TestClient(TestServer(app))
await client.start_server()
try:
inspect_head = await client.head("/memory/import/inspect")
assert inspect_head.status == 404
capabilities = await client.get("/services/capabilities")
assert capabilities.status == 200
assert await capabilities.json() == {"dataBackup": True}
routes = {
(route.method, route.resource.canonical)
for route in app.router.routes()
}
assert ("POST", "/memory/import/inspect") in routes
assert ("POST", "/memory/import") in routes
assert ("POST", "/memory/export") in routes
finally:
await client.close()
asyncio.run(scenario())
@@ -15,6 +15,7 @@ PROTECTED_PATHS = (
"/status",
"/memory/export",
"/memory/import/inspect",
"/services/capabilities",
"/upload",
"/upload/raw",
)
@@ -131,6 +132,58 @@ def test_no_origin_cli_is_allowed_but_cross_site_navigation_is_rejected(
asyncio.run(_with_client(scenario, tmp_path))
def test_cross_site_resource_get_is_allowed_for_upload_raw_only(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
"""Subresource loads (<img>/<video>) from the webview must reach /upload/raw
even though the bridge origin (127.0.0.1) differs from the app origin
(tauri.localhost), causing browsers to send Sec-Fetch-Site: cross-site without
an Origin header. Other paths and non-resource destinations remain blocked."""
monkeypatch.delenv("GA_E2E", raising=False)
async def scenario(client: TestClient, side_effect: Path):
# Real <img> load: cross-site, no Origin, Sec-Fetch-Dest: image → allowed
response = await client.get(
"/upload/raw",
headers={"Sec-Fetch-Site": "cross-site", "Sec-Fetch-Dest": "image"},
)
assert response.status == 200
assert await response.text() == "protected-secret"
# Also OK for video, audio, font
for dest in ("video", "audio", "font"):
side_effect.unlink()
r = await client.get(
"/upload/raw",
headers={"Sec-Fetch-Site": "cross-site", "Sec-Fetch-Dest": dest},
)
assert r.status == 200
# But top-level cross-site navigation (Sec-Fetch-Dest: document) → blocked
side_effect.unlink()
nav = await client.get(
"/upload/raw",
headers={"Sec-Fetch-Site": "cross-site", "Sec-Fetch-Dest": "document"},
)
assert nav.status == 403
assert not side_effect.exists()
# Evil Origin to /upload/raw still rejected (existing coverage)
for origin in ("http://evil.example", "null"):
rejected = await client.get("/upload/raw", headers={"Origin": origin})
assert rejected.status == 403
# Other protected paths remain cross-site blocked
for path in ("/status", "/upload", "/services/capabilities"):
rejected = await client.get(
path,
headers={"Sec-Fetch-Site": "cross-site", "Sec-Fetch-Dest": "image"},
)
assert rejected.status == 403
asyncio.run(_with_client(scenario, tmp_path))
def test_e2e_origin_requires_explicit_mode_and_a_strict_valid_port(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
):
@@ -64,7 +64,7 @@ def complete_report(platform: str = "linux"):
}
return {
"expectedCommit": "abc1234",
"releaseVersion": "0.2.0",
"releaseVersion": "0.2.1",
"artifact": {"sha256": "f" * 64},
"environment": {"isolatedConductorPort": isolated_port},
"success": True,
@@ -180,8 +180,8 @@ def write_info_plist(root: Path, **overrides):
contents = root / "Contents"
contents.mkdir(parents=True, exist_ok=True)
values = {
"CFBundleShortVersionString": "0.2.0",
"CFBundleVersion": "0.2.0",
"CFBundleShortVersionString": "0.2.1",
"CFBundleVersion": "0.2.1",
**overrides,
}
with (contents / "Info.plist").open("wb") as stream:
@@ -190,11 +190,11 @@ def write_info_plist(root: Path, **overrides):
def test_macos_package_version_comes_from_both_native_bundle_keys(tmp_path):
write_info_plist(tmp_path)
assert journey.read_macos_bundle_versions(tmp_path) == ("0.2.0", "0.2.0")
assert journey.read_macos_bundle_versions(tmp_path) == ("0.2.1", "0.2.1")
@pytest.mark.parametrize("key", ["CFBundleShortVersionString", "CFBundleVersion"])
@pytest.mark.parametrize("value", ["0.2.1", 200])
@pytest.mark.parametrize("value", ["0.2.0", 200])
def test_macos_package_version_rejects_wrong_or_non_string_keys(tmp_path, key, value):
write_info_plist(tmp_path, **{key: value})
with pytest.raises(journey.JourneyFailure, match=key):
@@ -258,8 +258,8 @@ def test_package_shape_rejects_excluded_source_package_json(tmp_path):
(runtime_root / "app" / "frontends" / "desktop" / "package.json").unlink()
candidate.check_package_shape()
assert candidate.report["checks"] == {
"packagedVersion": "0.2.0",
"packagedBundleVersion": "0.2.0",
"packagedVersion": "0.2.1",
"packagedBundleVersion": "0.2.1",
"packageShape": True,
}
@@ -76,6 +76,7 @@ def test_main_and_setup_capabilities_are_window_scoped_without_remote_ipc_access
"core:window:allow-start-dragging",
"opener:allow-open-url",
"opener:allow-default-urls",
"allow-get-macos-titlebar-metrics",
} <= main_permissions
assert {
@@ -94,6 +95,7 @@ def test_main_and_setup_capabilities_are_window_scoped_without_remote_ipc_access
"allow-reveal-in-file-manager",
"allow-set-ga-source",
"allow-clear-ga-source",
"allow-get-macos-titlebar-metrics",
"opener:allow-open-url",
}
)
@@ -123,3 +125,16 @@ def test_e2e_config_only_adds_test_driver_and_dynamic_loopback_connectivity():
"ws://127.0.0.1:*",
}
assert not any(source.startswith("https://") for source in connect_sources)
def test_native_titlebar_metrics_command_is_main_window_only():
main = _json(TAURI_ROOT / "capabilities" / "default.json")
setup = _json(TAURI_ROOT / "capabilities" / "setup.json")
permissions = (TAURI_ROOT / "permissions" / "bridge-commands.toml").read_text(
encoding="utf-8"
)
assert "allow-get-macos-titlebar-metrics" in main["permissions"]
assert "allow-get-macos-titlebar-metrics" not in setup["permissions"]
assert 'identifier = "allow-get-macos-titlebar-metrics"' in permissions
assert 'commands.allow = ["get_macos_titlebar_metrics"]' in permissions
+296 -22
View File
@@ -1739,6 +1739,13 @@ Screen { background: $ga-bg; color: $ga-fg; }
/* Reserve the 1-col scrollbar gutter up front so overflowing the window
doesn't suddenly squeeze the session rows narrower. */
scrollbar-gutter: stable;
scrollbar-background: $ga-bg;
scrollbar-background-hover: $ga-bg;
scrollbar-background-active: $ga-bg;
scrollbar-color: $ga-border;
scrollbar-color-hover: $ga-border-hi;
scrollbar-color-active: $ga-dim;
scrollbar-corner-color: $ga-bg;
}
#sidebar-scroll.-hidden, #sidebar-scroll.-narrow { display: none; }
@@ -1767,6 +1774,9 @@ Screen { background: $ga-bg; color: $ga-fg; }
scrollbar-color-active: $ga-dim;
}
#history-open { display: none; width: 100%; height: 1; min-height: 1; background: $ga-bg; color: $ga-muted; content-align: center middle; text-align: center; }
#history-open.-visible { display: block; }
/* Plan/todo panel — fixed 5-row card between messages and composer.
`display: none` default so the empty post-compose frame doesn't flash;
renderer flips it on once items materialize. Fixed height (no scroll)
@@ -2769,7 +2779,7 @@ class InputArea(TextArea):
Binding("ctrl+v", "paste", "Paste", show=False),
# macOS muscle-memory alias: most terminals swallow Cmd+V (forward via bracketed
# paste → _on_paste); this only hits if the terminal forwards Cmd as a key.
Binding("cmd+v", "paste", "Paste", show=False),
Binding("cmd+v,super+v", "paste", "Paste", show=False),
# Ctrl+U: readline-style kill-line, repurposed here to clear the whole input.
Binding("ctrl+u", "clear_input", "ClearInput", show=False),
# Ctrl+S: toggle-stash the current draft. First press → stash
@@ -3457,6 +3467,133 @@ class HelpScreen(ModalScreen):
yield Static(self._content)
@dataclass
class HistoryPrompt:
text: str
def __rich_console__(self, console, options):
from rich.padding import Padding
width = max(1, options.max_width)
lines = Text(self.text).wrap(console, width, overflow="fold")
if len(lines) > 3:
lines = lines[:3]
lines[-1].truncate(width - 1, overflow="crop")
lines[-1].append("…")
# OptionList's height calculation excludes component vertical padding.
# Match the main session sidebar: equal space above and below the text.
yield Padding(Text("\n").join(lines), (1, 0, 1, 0))
class HistoryScreen(ModalScreen):
"""Read-only history: full prompt index and one lazily rendered turn."""
CSS = """
HistoryScreen { background: $ga-bg; padding: 1 2; }
#history-title { height: 2; color: $ga-muted; }
#history-columns { height: 1fr; }
#history-index {
width: 25%; min-width: 18; border: none;
border-right: solid $ga-border; padding: 0 1 0 0;
background: $ga-bg;
}
/* OptionList tints its own background on focus. The option rows cover
most of that surface, leaving the scrollbar gutter as a bright stripe. */
#history-index:focus { background-tint: transparent; }
#history-detail {
width: 1fr; padding: 0 2; background: $ga-bg;
overflow-x: hidden; overflow-y: scroll;
}
#history-index, #history-detail {
scrollbar-size: 1 1;
scrollbar-background: $ga-bg;
scrollbar-background-hover: $ga-bg;
scrollbar-background-active: $ga-bg;
scrollbar-color: $ga-border;
scrollbar-color-hover: $ga-border-hi;
scrollbar-color-active: $ga-border-hi;
}
#history-index > .option-list--option { padding: 0 2; }
#history-detail .role { margin-top: 1; margin-bottom: 1; }
#history-detail .fold-header { color: $ga-muted; }
"""
BINDINGS = [Binding("escape", "dismiss", "返回", priority=True),
Binding("ctrl+g,cmd+shift+h", "dismiss", "返回", show=False, priority=True)]
def __init__(self, session):
super().__init__()
self.session = session
self.starts = [i for i, m in enumerate(session.messages) if m.role == "user"]
if session.messages and (not self.starts or self.starts[0] != 0):
self.starts.insert(0, 0)
self.end = len(session.messages)
self.selected_turn = None
self.preview = []
self._render_version = 0
def compose(self):
yield Static("全部历史 · ↑↓ 选择 · Tab 切换栏 · Esc 返回", id="history-title")
with Horizontal(id="history-columns"):
yield OptionList(id="history-index")
yield VerticalScroll(id="history-detail")
def on_mount(self):
self.call_after_refresh(self._populate_index)
def _populate_index(self):
index = self.query_one("#history-index", OptionList)
options = []
for turn in range(len(self.starts)):
m = self.session.messages[self.starts[turn]]
label = " ".join(m.content.split()) or "(空提问)"
options.append(Option(HistoryPrompt(label), id=str(turn)))
index.add_options(options)
if options:
index.highlighted = 0
index.focus()
async def on_option_list_option_highlighted(self, event):
event.stop()
self.selected_turn = int(event.option.id)
start = self.starts[self.selected_turn]
end = (self.starts[self.selected_turn + 1]
if self.selected_turn + 1 < len(self.starts) else self.end)
# Separate models keep preview folds and widget references out of live chat.
self.preview = [ChatMessage(m.role, m.content, done=True,
image_paths=list(m.image_paths))
for m in self.session.messages[start:end]]
await self._render_preview()
def on_option_list_option_selected(self, event):
event.stop()
async def _render_preview(self, *, preserve_scroll=False):
self._render_version += 1
version = self._render_version
detail = self.query_one("#history-detail", VerticalScroll)
scroll_y = detail.scroll_y if preserve_scroll else 0
await detail.remove_children()
if version != self._render_version or not self.is_mounted:
return
for m in self.preview:
self.app._mount_message(detail, m, preview=True)
if preserve_scroll:
self.call_after_refresh(detail.scroll_to, y=scroll_y, animate=False)
else:
detail.scroll_home(animate=False)
async def on_click(self, event):
if isinstance(event.widget, FoldHeader):
event.stop()
m = event.widget.msg
m._toggled_folds.symmetric_difference_update({event.widget.fold_idx})
m._cached_body = None
await self._render_preview(preserve_scroll=True)
def on_resize(self):
if self.is_mounted and self.preview:
self.call_after_refresh(self._render_preview)
class ThemePicker(ModalScreen):
# Live-preview theme picker: highlight applies the theme so the rest of the
# UI repaints behind the modal; Enter commits + persists, Esc reverts.
@@ -3543,9 +3680,11 @@ class GenericAgentTUI(App[None]):
BINDINGS = [
Binding("ctrl+c", "handle_ctrl_c", "Stop/Quit", show=False, priority=True),
# macOS muscle-memory aliases — only fire if the terminal forwards Cmd as a key
# (Terminal.app / default iTerm2 swallow them; Ghostty / WezTerm / kitty can forward).
Binding("cmd+c", "handle_ctrl_c", "Stop/Quit", show=False, priority=True),
Binding("ctrl+g,cmd+shift+h", "show_history", "历史", show=False, priority=True),
# Ghostty forwards Cmd+C to TUI applications in its default
# configuration, so GA can copy its internal Textual selection directly.
# Terminals that intercept Cmd+C natively may require their own setup.
Binding("cmd+c,super+c", "copy_selection", "Copy", show=False, priority=True),
Binding("ctrl+n", "new_session", "New", show=False),
Binding("cmd+n", "new_session", "New", show=False),
Binding("ctrl+b", "toggle_sidebar","Sidebar", show=False),
@@ -3567,6 +3706,13 @@ class GenericAgentTUI(App[None]):
def __init__(self, agent_factory: Optional[AgentFactory] = None) -> None:
super().__init__()
self._apple_terminal_ime = (
sys.platform == "darwin"
and os.environ.get("TERM_PROGRAM") == "Apple_Terminal"
)
self._input_repaint_pending = False
self._pending_stream_renders: dict[tuple[int, int], ChatMessage] = {}
self._stream_render_timer = None
self.agent_factory: AgentFactory = agent_factory or default_agent_factory
self.sessions: dict[int, AgentSession] = {}
self.current_id: Optional[int] = None
@@ -3682,6 +3828,7 @@ class GenericAgentTUI(App[None]):
_sidebar.can_focus = False
yield _sidebar
with Vertical(id="main"):
yield Static("Ctrl+G 查看所有历史会话", id="history-open")
yield VerticalScroll(id="messages")
# Plan card: pinned header/step (#planbar-head) above a task list
# (#planbar) that scrolls inside a 4-row window (#planbar-tasks).
@@ -3719,6 +3866,9 @@ class GenericAgentTUI(App[None]):
# CSS `#planbar-scroll { display: none }` keeps it hidden by default —
# the renderer adds `-visible` once plan items materialize.
self.query_one("#input", InputArea).focus()
messages = self.query_one("#messages", VerticalScroll)
self.watch(messages, "scroll_y", self._watch_messages_scroll, init=False)
self.call_after_refresh(self._update_history_open)
self.set_interval(0.5, self._tick)
self._patch_auto_scroll_for_selection()
self._start_plan_watcher()
@@ -3737,6 +3887,18 @@ class GenericAgentTUI(App[None]):
self._last_size = size
self._apply_responsive_layout()
def _schedule_input_repaint(self) -> None:
if self._apple_terminal_ime and not self._input_repaint_pending:
self._input_repaint_pending = True
self.call_after_refresh(self._repaint_input_rows)
def _repaint_input_rows(self) -> None:
"""Repair committed input rows, including cells beyond the composer."""
self._input_repaint_pending = False
inp = self.query_one("#input", InputArea)
region = inp.region
self.screen.refresh(Region(0, region.y, self.screen.size.width, region.height))
def _patch_auto_scroll_for_selection(self) -> None:
# Make selection-drag into #input still scroll #messages: include _select_start as a
# candidate source, and trigger when the mouse leaves the scrollable above or below.
@@ -4195,9 +4357,8 @@ class GenericAgentTUI(App[None]):
return
super().copy_to_clipboard(text)
def action_handle_ctrl_c(self) -> None:
# Two-stage quit: when no task is running, first press clears input and arms;
# second press within 2s exits.
def _copy_selected_text(self) -> bool:
"""Copy application selection; an empty selection must not stop a task."""
try:
inp = self.query_one("#input", InputArea)
except Exception:
@@ -4208,7 +4369,7 @@ class GenericAgentTUI(App[None]):
try: self.copy_to_clipboard(inp.selected_text)
except Exception: pass
self._disarm_quit()
return
return True
try:
selected_text = self.screen.get_selected_text()
except Exception:
@@ -4217,7 +4378,21 @@ class GenericAgentTUI(App[None]):
try: self.copy_to_clipboard(selected_text)
except Exception: pass
self._disarm_quit()
return True
return False
def action_copy_selection(self) -> None:
self._copy_selected_text()
def action_handle_ctrl_c(self) -> None:
# Ctrl+C retains the TUI's stop/quit behavior. Cmd+C is handled by the
# copy action above when the terminal forwards it to the application.
if self._copy_selected_text():
return
try:
inp = self.query_one("#input", InputArea)
except Exception:
inp = None
sess = self.sessions.get(self.current_id)
if sess is not None and sess.status == "running":
self._cmd_stop([], "")
@@ -4260,7 +4435,7 @@ class GenericAgentTUI(App[None]):
except Exception: pass
def on_key(self, event: events.Key) -> None:
if self._quit_armed and event.key not in ("ctrl+c", "cmd+c"):
if self._quit_armed and event.key != "ctrl+c":
self._disarm_quit()
if self._rewind_armed and event.key != "escape":
self._disarm_rewind()
@@ -4466,6 +4641,7 @@ class GenericAgentTUI(App[None]):
("Esc", "取消选择 / 关闭面板 / 关闭帮助"),
("Esc Esc", "打开回退选择"),
(fmt_key("ctrl+t"), "切换主题"),
(fmt_keys("ctrl+g", "cmd+shift+h"), "查看全部历史"),
(fmt_key("ctrl+/"), "显示 / 隐藏本帮助"),
]
t = Text()
@@ -4601,7 +4777,7 @@ class GenericAgentTUI(App[None]):
m._segment_widgets = []
m._segment_sig = ()
m._spinner_widget = None
for m in self.current.messages:
for m in self._recent_messages(self.current):
self._mount_message(container, m)
if was_at_bottom:
container.scroll_end(animate=False)
@@ -4621,6 +4797,7 @@ class GenericAgentTUI(App[None]):
inp._skip_change_next = False
return
self._resize_input(inp)
self._schedule_input_repaint()
val = (inp.text or "").lstrip()
if self._suppress_palette_open:
self._suppress_palette_open = False
@@ -6348,6 +6525,10 @@ class GenericAgentTUI(App[None]):
pass
def on_unmount(self) -> None:
if self._stream_render_timer is not None:
self._stream_render_timer.stop()
self._stream_render_timer = None
self._pending_stream_renders.clear()
self._reset_terminal_title()
# Drop this run's empty signal dirs on graceful exit; the startup
# sweep mops up anything a crash leaves behind.
@@ -6569,6 +6750,8 @@ class GenericAgentTUI(App[None]):
return
def _on_stream(self, agent_id, task_id, text, done):
if done:
self._pending_stream_renders.pop((agent_id, task_id), None)
s = self.sessions.get(agent_id)
if not s: return
if s.current_task_id != task_id:
@@ -6591,16 +6774,16 @@ class GenericAgentTUI(App[None]):
except Exception: self._refresh_messages()
else:
self._refresh_messages()
if refresh_chrome:
self._refresh_sidebar()
self._refresh_topbar()
self._refresh_sidebar()
self._refresh_topbar()
self._ensure_spinner()
return
s.buffer = text
if done:
s.status = "idle"
s.current_display_queue = None
self._update_assistant(agent_id, text, task_id=task_id, done=done, refresh_chrome=True)
self._update_assistant(agent_id, text, task_id=task_id, done=done,
refresh_chrome=True, defer_render=not done)
if done:
self._rw_commit(s) # 落 checkpoint 节点(文件改动已由 tool_before 钩子追踪)
self._update_plan_state(s, text)
@@ -6772,7 +6955,26 @@ class GenericAgentTUI(App[None]):
if agent_id != prev: self.current_id = prev
return value
def _update_assistant(self, agent_id, text, *, task_id=None, done=True, refresh_chrome=False):
def _flush_stream_renders(self) -> None:
self._stream_render_timer = None
pending = self._pending_stream_renders
self._pending_stream_renders = {}
refreshed = False
for (agent_id, task_id), message in pending.items():
sess = self.sessions.get(agent_id)
if (sess is None or agent_id != self.current_id
or sess.current_task_id != task_id or message.done
or not any(m is message for m in sess.messages)):
continue
self._render_assistant_update(message)
refreshed = True
if refreshed:
self._refresh_sidebar()
self._refresh_topbar()
self._ensure_spinner()
def _update_assistant(self, agent_id, text, *, task_id=None, done=True,
refresh_chrome=False, defer_render=False):
# task_id=None matches the last assistant message; otherwise matches by task_id.
s = self.sessions.get(agent_id)
if not s: return
@@ -6785,6 +6987,20 @@ class GenericAgentTUI(App[None]):
break
if agent_id != self.current_id:
return
if defer_render and found is not None:
# Keep data current for stop/copy/session switching; coalesce only paint.
self._pending_stream_renders[(agent_id, task_id)] = found
if self._stream_render_timer is None:
self._stream_render_timer = self.set_timer(0.05, self._flush_stream_renders)
return
self._pending_stream_renders.pop((agent_id, task_id), None)
self._render_assistant_update(found)
if refresh_chrome:
self._refresh_sidebar()
self._refresh_topbar()
self._ensure_spinner()
def _render_assistant_update(self, found: Optional[ChatMessage]) -> None:
if found and found._segment_widgets:
try:
container = self.query_one("#messages", VerticalScroll)
@@ -6796,10 +7012,6 @@ class GenericAgentTUI(App[None]):
self._refresh_messages()
else:
self._refresh_messages()
if refresh_chrome:
self._refresh_sidebar()
self._refresh_topbar()
self._ensure_spinner()
# ---------------- Plan/todo panel ----------------
# State machine (graces absorb mid-stream parse misses / let final tally read):
@@ -7178,6 +7390,45 @@ class GenericAgentTUI(App[None]):
except Exception:
return True
def _watch_messages_scroll(self, _scroll_y) -> None:
self._update_history_open()
try:
messages = self.query_one("#messages", VerticalScroll)
# Scrolling changes which virtual rows are visible. In some terminal
# backends the compositor leaves stale cells until the container is
# explicitly invalidated.
messages.refresh()
except Exception:
pass
def _update_history_open(self) -> None:
"""Show the history entry only while the main conversation is at its top."""
try:
messages = self.query_one("#messages", VerticalScroll)
button = self.query_one("#history-open", Static)
except Exception:
return
starts = [m for m in self.current.messages if m.role == "user"]
truncated = len(starts) > 20
button.set_class(truncated and messages.scroll_y <= 0, "-visible")
def action_show_history(self):
if isinstance(self.screen, HistoryScreen):
self.pop_screen()
elif self.current_id is not None:
self.push_screen(HistoryScreen(self.current))
@staticmethod
def _recent_messages(sess):
# Keep complete recent turns, including all pending interaction cards.
starts = [i for i, m in enumerate(sess.messages) if m.role == "user"]
start = starts[-20] if len(starts) > 20 else 0
for i, m in enumerate(sess.messages[:start]):
if m.kind in ("choice", "multi_choice") and m.selected_label is None:
start = i
break
return sess.messages[start:]
def _refresh_messages(self):
if not self.is_mounted or self.current_id is None: return
sess = self.current
@@ -7193,7 +7444,20 @@ class GenericAgentTUI(App[None]):
m._segment_sig = ()
m._spinner_widget = None
self._last_session_id = sess.agent_id
recent = self._recent_messages(sess)
visible = {id(m) for m in recent}
for m in sess.messages:
if id(m) not in visible and m._role_widget is not None:
widgets = [m._role_widget, m._body_widget, m._hint_widget,
m._spinner_widget, *m._segment_widgets]
for w in {id(w): w for w in widgets if w is not None}.values():
w.remove()
m._role_widget = m._body_widget = m._hint_widget = m._spinner_widget = None
m._segment_widgets = []
m._segment_sig = ()
m._cached_body = None
m._seg_render_cache.clear()
for m in recent:
if m._role_widget is None:
self._mount_message(container, m)
if was_at_bottom:
@@ -7610,7 +7874,7 @@ class GenericAgentTUI(App[None]):
# (in-place .update of last widget) vs. full remount (when folds appear/expand).
return tuple((kind, idx) for kind, _, idx in segs)
def _mount_message(self, container: VerticalScroll, m: ChatMessage) -> None:
def _mount_message(self, container: VerticalScroll, m: ChatMessage, *, preview=False) -> None:
# Looked up at call time (not class init) so theme switches propagate.
color = {"user": C_PURPLE, "system": C_BLUE, "assistant": C_GREEN}.get(m.role, C_GREEN)
label = m.role.upper() if m.role != "assistant" else "AGENT"
@@ -7685,7 +7949,8 @@ class GenericAgentTUI(App[None]):
container.mount(m._body_widget)
return
if m.role == "user":
body = Text(); body.append("> ", style=C_DIM); body.append(_elide_user_display(m.content), style=C_FG)
body = Text(); body.append("> ", style=C_DIM); body.append(
m.content if preview else _elide_user_display(m.content), style=C_FG)
for path in m.image_paths:
body.append(f"\n📎 {path}", style=C_MUTED)
m._body_widget = SelectableStatic(body, classes="msg")
@@ -7696,7 +7961,8 @@ class GenericAgentTUI(App[None]):
container.mount(m._body_widget)
return
# assistant — multi-segment for per-fold click-to-expand
segs = self._assistant_segments(m, self._messages_width())
width = max(10, container.scrollable_content_region.width) if preview else self._messages_width()
segs = self._assistant_segments(m, width)
self._mount_assistant_segments(container, m, segs)
def _mount_assistant_segments(self, container, m: ChatMessage, segs: list[tuple],
@@ -7801,6 +8067,10 @@ class GenericAgentTUI(App[None]):
# progress-bar overwrites still work.
display = last_text.replace("\r\n", "\n")
last_widget.update(Text.from_ansi(display, style=C_FG))
try:
self.query_one("#messages", VerticalScroll).refresh()
except Exception:
pass
if m.done and m._spinner_widget is not None:
# Convert the live spinner into the post-turn ⠿ card in place.
self._capture_done_summary(m)
@@ -7843,6 +8113,10 @@ class GenericAgentTUI(App[None]):
m._spinner_widget = None
segs = self._assistant_segments(m, self._messages_width())
self._mount_assistant_segments(container, m, segs, after=anchor)
try:
container.refresh()
except Exception:
pass
# ---------- CLI ----------
+8 -4
View File
@@ -312,9 +312,13 @@ def _cond_up():
def _start_conductor():
if _cond_up(): return True
flags = (subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |
getattr(subprocess, 'CREATE_NO_WINDOW', 0))
kw = {'creationflags': flags} if os.name == 'nt' else {'start_new_session': True}
# Win-only creationflags must not be evaluated on Linux (AttributeError).
if os.name == 'nt':
flags = (subprocess.DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |
getattr(subprocess, 'CREATE_NO_WINDOW', 0))
kw = {'creationflags': flags}
else:
kw = {'start_new_session': True}
try:
subprocess.Popen([sys.executable, os.path.join(os.path.dirname(__file__), 'conductor.py'), '--no-browser'],
cwd=os.path.dirname(__file__), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, **kw)
@@ -334,7 +338,7 @@ def _cond_forward(bot, text, seq):
seen = {mine['id']}
while seq == _cond_seq:
time.sleep(5)
try: items = requests.get(_COND, params={'last': 50}, timeout=10).json()['items']
try: items = requests.get(_COND, params={'last': 50, 'mark_read': 'false'}, timeout=10).json()['items']
except Exception as e:
print(f'[WX] conductor poll err: {e}', file=sys.__stdout__); continue
for item in items:
+3 -2
View File
@@ -171,7 +171,7 @@ def web_execute_js(script, switch_tab_id=None, no_monitor=False):
try:
if driver is None: first_init_driver()
if len(driver.get_all_sessions()) == 0: return {"status": "error", "msg": "没有可用的浏览器标签页,查L3记忆分析原因。"}
if switch_tab_id: driver.default_session_id = switch_tab_id
if switch_tab_id: driver.default_session_id = str(switch_tab_id)
result = simphtml.execute_js_rich(script, driver, no_monitor=no_monitor)
return result
except Exception as e: return {"status": "error", "msg": format_error(e)}
@@ -528,7 +528,8 @@ class GenericAgentHandler(BaseHandler):
'''Agent觉得当前任务完成后有重要信息需要记忆时调用此工具。'''
prompt = '''### [总结提炼经验] 既然你觉得当前任务有重要信息需要记忆,请提取最近一次任务中【事实验证成功且长期有效】的环境事实、用户偏好、重要步骤,更新记忆。
本工具是标记开启结算过程,若已在更新记忆过程或没有值得记忆的点,忽略本次调用。
**如果没有经验证的,未来能用上的信息,忽略本次调用!**
**如果没有经过验证的,未来能用上的信息,忽略本次调用!**
**必须成功完成任务,或到达重要检查点才能进行记忆提炼,未成功完成则忽略本次调用!**
**只能提取行动验证成功的信息**:
- **环境事实**(路径/凭证/配置)→ `file_patch` 更新 L2,同步 L1
- **复杂任务经验**(关键坑点/前置条件/重要步骤)→ L3 精简 SOP(只记你被坑得多次重试的核心要点)
+44 -11
View File
@@ -1,6 +1,11 @@
import os, json, re, time, requests, sys, threading, urllib3, base64, importlib, uuid, pathlib, copy
from datetime import datetime
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
_INFLIGHT = {} # thread ident -> live socket; lets abort() close it even before response headers arrive
_orig_conn_request = urllib3.connection.HTTPConnection.request
def _conn_request_hook(self, *a, **k): # after request() the socket is connected+sent; conn.sock may later be None'd by http.client
r = _orig_conn_request(self, *a, **k); _INFLIGHT[threading.get_ident()] = self.sock; return r
urllib3.connection.HTTPConnection.request = _conn_request_hook
_RESP_CACHE_KEY = str(uuid.uuid4()); _RESP_CODEX_KEY = str(uuid.uuid4())
_ROOT = os.path.dirname(os.path.abspath(__file__))
if _ROOT not in sys.path: sys.path.append(_ROOT)
@@ -109,11 +114,12 @@ def trim_messages_history(history, sess):
if c <= cap: return
compress_history_tags(history, keep_recent=4, force=True)
if cost(history) <= target: return
pre, post = history[:kp], history[kp:]
while len(post) > 9 and cost(pre) + cost(post) > target:
post.pop(0)
while post and post[0].get('role') != 'user': post.pop(0)
if post and post[0].get('role') == 'user': post[0] = _sanitize_leading_user_msg(post[0])
pre, post = history[:kp], history[kp:]; costs = [len(json.dumps(m, ensure_ascii=False)) for m in post]; c = cost(pre) + sum(costs); i = 0
while len(post) - i > 9 and c > target:
c -= costs[i]; i += 1
while i < len(post) and post[i].get('role') != 'user': c -= costs[i]; i += 1
if i < len(post): old = costs[i]; post[i] = _sanitize_leading_user_msg(post[i]); costs[i] = len(json.dumps(post[i], ensure_ascii=False)); c += costs[i] - old
post = post[i:]
if kp and pre:
m = pre[-1]
if m.get('role') == 'assistant' and isinstance(m.get('content'), list):
@@ -445,9 +451,20 @@ def _stream_with_retry(sess, url, headers, payload, parse_fn):
try: ra = float((resp.headers or {}).get("retry-after"))
except: ra = None
return None if ra and ra > cap else max(0.5, ra or min(30.0, 3.0 * (2 ** attempt)))
def _stopped(): return getattr(sess, 'should_stop', None) and sess.should_stop()
def _sleep(d): # interruptible sleep; True if aborted
end = time.time() + d
while time.time() < end:
if _stopped(): return True
time.sleep(0.2)
return _stopped()
for attempt in range(sess.max_retries + 1):
if _stopped(): return []
streamed = False
STATS.update(t_start=time.time(), t_ttft=None)
if not sess.stream: STATS['t_ttft'] = STATS['t_start']
try:
sess._tid = threading.get_ident() # abort() looks up _INFLIGHT[_tid]
with requests.post(url, headers=headers, json=payload, stream=sess.stream,
timeout=(sess.connect_timeout, sess.read_timeout), proxies=sess.proxies, verify=sess.verify) as r:
sess.active_response = r
@@ -456,16 +473,31 @@ def _stream_with_retry(sess, url, headers, payload, parse_fn):
d = _delay(r, attempt) if r.status_code in _RETRYABLE and attempt < sess.max_retries else None
if d is not None:
print(f"[LLM Retry] HTTP {r.status_code}, retry in {d:.1f}s ({attempt+1}/{sess.max_retries+1})")
time.sleep(d); continue
if _sleep(d): return []
continue
try: body = r.text.strip()[:500]
except: body = ""
err = f"!!!Error: HTTP {r.status_code}" + (f" (retry-after > {cap:.0f}s)" if d is None and r.status_code in _RETRYABLE and attempt < sess.max_retries else "") + (f": {body}" if body else "")
yield err; return [{"type": "text", "text": err}]
if sess.stream: # TTFT = first SSE event (prefill done), not first visible chunk; hidden thinking must count in decode window
_il = r.iter_lines
def _probe(*a, **k):
for line in _il(*a, **k):
if line and STATS.get('t_ttft') is None: STATS['t_ttft'] = time.time()
yield line
r.iter_lines = _probe
gen = parse_fn(r)
try:
while True: chunk = next(gen); streamed = True; yield chunk
while True:
if getattr(sess, 'should_stop', None) and sess.should_stop():
STATS['t_end'] = time.time(); return []
chunk = next(gen)
if chunk and STATS.get('t_ttft') is None: STATS['t_ttft'] = time.time()
streamed = True; yield chunk
except StopIteration as e:
if not e.value and not streamed: raise requests.ConnectionError("empty response")
STATS['t_end'] = time.time()
STATS['tps'] = STATS.get('out', 0) / max(1e-9, STATS['t_end'] - max(STATS['t_ttft'] or 0, STATS['t_start']))
return e.value or []
except (requests.Timeout, requests.ConnectionError, requests.exceptions.ChunkedEncodingError) as e:
err = f"!!!Error: {type(e).__name__}: {e}" if str(e) else f"!!!Error: {type(e).__name__}"
@@ -473,7 +505,8 @@ def _stream_with_retry(sess, url, headers, payload, parse_fn):
if attempt < sess.max_retries:
d = _delay(None, attempt)
print(f"[LLM Retry] {type(e).__name__}, retry in {d:.1f}s ({attempt+1}/{sess.max_retries+1})")
time.sleep(d); continue
if _sleep(d): return []
continue
yield err; return [{"type": "text", "text": err}]
except Exception as e:
err = f"\n\n[!!! 流异常中断 {type(e).__name__}: {e} !!!]" if streamed else f"!!!Error: {type(e).__name__}: {e}"
@@ -608,7 +641,7 @@ class BaseSession:
self.api_key = cfg['apikey']
self.api_base = cfg['apibase'].rstrip('/')
self.model = cfg.get('model', '')
default_context_win = 35000; default_cut_msg_interval = 7
default_context_win = 38000; default_cut_msg_interval = 8
if 'deepseek' in self.model.lower():
default_context_win = 80000; default_cut_msg_interval = 25; self.trim_keep_rate = 0.3
self.context_win = cfg.get('context_win', default_context_win)
@@ -641,7 +674,7 @@ class BaseSession:
self.api_mode = 'responses' if mode in ('responses', 'response') else 'chat_completions'
self.temperature = cfg.get('temperature', 1)
self.max_tokens = cfg.get('max_tokens')
self.default_ua = "claude-cli/2.1.152 (external, cli)"
self.default_ua = "claude-cli/2.1.251 (external, cli)"
self.user_agent = cfg.get("user_agent", self.default_ua)
def _apply_claude_thinking(self, payload):
if self.thinking_type:
@@ -753,7 +786,7 @@ def _fix_messages(messages):
return merged
class NativeClaudeSession(BaseSession):
native_ua = "claude-cli/2.1.152 (native, cli)"
native_ua = "claude-cli/2.1.251 (native, cli)"
def __init__(self, cfg):
super().__init__(cfg)
self.fake_cc_system_prompt = cfg.get("fake_cc_system_prompt", False)
+207
View File
@@ -0,0 +1,207 @@
# 配置设备互联环境
触发词:`帮我配置设备互联`、`帮我配置 GAnet`;卸载见第 7 节,触发词:`帮我卸载 GAnet`、`帮我卸载设备互联`。
目标:把当前电脑准备为可与手机 GA 安全配对和连接的设备。
> 当前适配 Windows 与 macOS(Apple Silicon 与 Intel);Linux 暂不支持本配置流程,发现操作系统不适配时停止配置并提醒用户,并告诉用户后续测试开发完善后会上线。
实际配置顺序:
```text
安装 GAnet 组件
→ 准备设备访问环境并打开 GAnet 用户中心
→ 确认 GA 登录
→ 准备 GAnet 网络组件
→ 准备内嵌 SSH 环境(授权文件与主机密钥)
→ 登记电脑并加入 GAnet
→ 复检
→ 在用户中心配对手机
```
SSH 终端与文件访问由 GAnet 网络组件内嵌提供,全程不需要 Windows 管理员权限或 macOS 的 sudo。
遇到环境缺失或安装失败,可以向用户说明情况、给出建议并提问,但问题必须是首次配置ganet的新手也能回答的(例如是否同意安装、是否继续、屏幕上是否出现某个提示);不要询问用户不知道的信息。
完成标准:GAnet 组件和设备访问环境已准备,且基础环境、GAnet 控制面、SSH 服务、安全性检查四项检查均通过。
## 1. 安装 GAnet 组件
GAnet 是独立组件:组件形态是 GAnet 仓库的 git 检出,运行在当前 GA 的 Python 环境上,没有自带 Python 运行时。组件位置由用户决定,可整体移动;唯一位置约束是不把组件内容提交进 GenericAgent 的 Git。
先读取固定定位记录 `~/.genericagent/ganet/component.json`;记录只用于发现组件位置,不是可信或完整性证明。若记录结构有效,则以记录中的组件目录为工作目录、用当前 GA 进程的绝对 `sys.executable` 运行 `<sys.executable> -m ganet inspect-component --json`;只有命令成功,且返回的 `ok` 为 `true`、`layout` 为 `source`、`packageRoot` 和 `launcher` 与实际位置一致时,才复用该组件。定位记录不存在或自检失败时,以同样标准检查默认安装位置 `~/.genericagent/components/GAnet`(Windows 即 `%USERPROFILE%\.genericagent\components\GAnet`);不要扫描磁盘,也不要仅凭目录、`ganet.cmd` 或定位记录认定组件有效。不要把组件放进 GA 根目录的 `temp\`:该目录会被 GA 的回退机制清空。两处都没有有效组件时,按新安装处理。`inspect-component` 是只读检查,不会写入定位记录。
组件不存在时,用 git 克隆固定公开仓库获取代码:
```text
git clone https://github.com/nianyucatfish/GAnet "~/.genericagent/components/GAnet"
```
(Windows 上把 `~` 换成 `%USERPROFILE%`;父目录 `components` 不存在时先创建。)也可克隆到用户选择的其他目录。git 不可用时先安装 Git 再继续,不要改用 ZIP 或 raw 文件获取源代码;macOS 上未安装 Xcode 命令行工具时,`/usr/bin/git` 与 `/usr/bin/python3` 只是会弹出安装对话框的占位程序,不要调用它们——Python 一律用当前 GA 进程的 `sys.executable`,Git 缺失则请用户先安装。首次克隆前向用户说明:GAnet 是可选设备互联组件,Python 代码来自上述公开 GitHub 仓库,网络组件二进制后续从 `ganet.gaagent.ai` 下载并经服务器签名清单校验;当前 Windows 发布文件尚未进行 Authenticode 签名。组件代码同样需要更新检查:用户要求配置或修复设备互联而组件已存在时,先在组件目录执行一次 `git pull` 再复用;用户对组件有本地改动时按普通 git 合并处理,不要强制覆盖;拉取失败但当前组件自检通过时,保留当前代码继续,不把网络失败报告为组件损坏。克隆或更新后必须按上段运行 `inspect-component --json` 自检。不要将组件内容加入 GenericAgent Git;若 Windows 应用控制策略阻止运行网络组件,停止并如实报告,不关闭或绕过系统安全策略。
组件的轻量 Python 依赖安装进当前 GA 解释器,用当前进程的 `<sys.executable> -m pip install "cryptography>=42" "Pillow>=10" "qrcode>=7.4"` 做最小安装;不得调用裸 `pip`、猜测虚拟环境或安装到其他 Python。GA 解释器缺少 `pip` 模块时,先运行 `<sys.executable> -m ensurepip --upgrade` 补齐再安装。
GA 根目录是本 SOP 所在 `memory\` 目录的上一级,按你读取本 SOP 时实际使用的绝对路径计算,并在传参前确认该目录下 `ga.py`、`agent_loop.py`、`TMWebDriver.py` 和 `assets/tools_schema.json` 齐全;不要用临时脚本的 `__file__`、工作目录或相对层级推算(临时脚本不一定位于 GA 根目录下)。由当前 GA runtime 确定 `sys.executable` 的绝对路径;不要猜测路径,不让用户填写,也不要直接编辑 GAnet 配置文件。以组件目录为工作目录,用当前 GA 解释器准备设备访问环境:
```text
<sys.executable> -m ganet configure-host --ga-root "<GA 根目录绝对路径>" --ga-python "<当前 sys.executable 绝对路径>"
```
相同环境重复执行应直接通过。若现有记录指向另一套或已经移动的 GA/Python,先向用户说明需要修复,再仅在本次明确修复流程中追加 `--repair`;不要静默替换。命令成功后,绑定的 GA Python 会写入 `~/.genericagent/ganet/ga_python.cmd`;该文件只由本命令生成和更新,不要手工创建或编辑。
打开 GAnet 用户中心:无参数运行 `<组件目录>\ganet.cmd`(macOS 为 `<组件目录>/ganet.sh`,Finder 双击 `ganet.command` 同样有效;绑定的 Python 写在 `~/.genericagent/ganet/ga_python.sh`)。用户双击同样有效。它以绑定的 GA Python 启动仅监听本机回环地址的用户中心,打印访问地址并自动打开系统默认浏览器;该进程前台驻留,由 GA 代为打开时作为独立进程启动,不要在当前会话阻塞等待。日常打开用户中心不要求 GA 正在运行,也不需要再次传入 GA 根目录或 Python;组件整体移动后从新位置启动会刷新自身入口和定位记录,不应改变已保存的 GA/Python。
## 2. 确认登录并检查环境
正式 GA 登录为后续电脑登记和 GAnet 入网提供身份。登录接口位于 GAnet 组件的 `ganet/device_connection/auth.py`。
```python
from ganet.device_connection import auth
identity = auth.current_identity()
logged_in = bool(auth.get_token() and identity and identity.get("valid"))
```
未登录时,请用户在已经打开的 GAnet 用户中心完成登录;已登录时继续。
环境检查由 GAnet 组件的 `ganet/device_connection/network.py` 中的 `check_env()` 提供。
本节及后续 Python 接口均使用当前 GA 进程的绝对 `sys.executable`,并以 GAnet 组件目录为工作目录执行,`ganet` 包直接从组件目录导入;不要把 `ganet` 安装进 site-packages,也不要把 GA 根目录临时加入 `sys.path`。
这一步只读,检查:
- GAnet 网络组件是否已安装、运行、加入 GAnet 并监听设备连接;
- GAnet 网络组件版本状态:`current`、`available`、`required` 或 `unknown`;
- 内嵌 SSH 服务状态:私有网络监听、本机回环监听、端口可达;
- GAnet 独立授权文件、ACL 与内嵌 SSH 主机密钥;
- 二维码和电脑截图所需的当前 GA 组件。
版本状态只影响“基础环境”节点的呈现:`available` 为黄色提示,表示当前连接仍可用;`required` 与组件缺失、无法响应一样进入修复流程;`unknown` 不影响当前可用链路。其他状态从 `chain` 和 `checks` 汇总实际缺失项。
组件本机状态和版本状态由:
```python
from ganet.device_connection import sidecar_manager
component = sidecar_manager.inspect()
```
读取。`inspect()` 返回 `installed`、`running`、`online`、`listening`、`version_state` 和脱敏 `reason`;`version_state` 取 `current`、`available`、`required` 或 `unknown`。
变更前,用一句话向用户说明将自动安装或修复的项目并取得一次确认。配置全程运行在当前用户权限下;只有下载运行网络组件可能被安全软件拦截,被拦截时如实报告,不关闭或绕过系统安全策略。
如需向 GA 解释器修复 Python 依赖,官方 PyPI 下载缓慢或出现读取超时时,使用镜像源重试,例如:`<sys.executable> -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple <包名>`;不要因单次下载超时误判 Python 或运行环境损坏。
## 3. 准备缺失组件
GAnet 网络组件提供电脑与手机之间的私有连接,并内嵌 SSH/SFTP 服务提供终端和文件访问。组件准备完成不代表已经完成组网。
### GAnet 网络组件
网络组件接口位于 `ganet.device_connection.sidecar_manager`,各平台共用同一套调用;组件文件在 Windows 位于 `%LOCALAPPDATA%\GenericAgent\GAnet\ganet-sidecar.exe`,在 macOS 位于 `~/Library/Application Support/GenericAgent/GAnet/ganet-sidecar`,登录自启动分别是当前用户的注册表 Run 项与 `~/Library/LaunchAgents/ai.gaagent.ganet-sidecar.plist`。安装、替换和入网是不同阶段:本节只处理组件文件与本机进程;第 4 节才使用正式 GA 登录态让组件加入 GAnet。
#### 读取发布列表并选择文件
```python
from ganet.device_connection import sidecar_manager
releases = sidecar_manager.list_releases()
release = sidecar_manager.select_release(releases)
```
`list_releases()` 读取 `https://ganet.gaagent.ai/releases/sidecar/`,返回发布页实际列出的可用条目及其签名验证结果。每个有效条目至少包含:
```python
{
"platform": "windows",
"architecture": "amd64", # 以发布页实际值为准
"version": "…",
"url": "…",
"sha256": "…",
"size": 12345678,
"update_level": "available",
}
```
条目选择只用 `select_release(releases)`:它按本机实际平台和架构筛选(macOS 条目的 `platform` 值为 `darwin`,与 Python `platform.system().lower()` 一致),并返回其中版本最新的一条,没有匹配项时报错。不要自行筛选列表,不得从 SOP、记忆或固定文件名推断版本或架构映射。若发布页不可读但当前组件可用,保留当前组件并继续设备互联,不把版本检查失败报告为连接故障。
#### 下载、验证与安装
```python
artifact = sidecar_manager.download_release(release)
verified = sidecar_manager.verify_release(artifact, release)
result = sidecar_manager.install_release(verified)
```
- `download_release(release)` 仅下载选定条目到临时目录,返回本地 artifact;不替换已安装组件。
- `verify_release(artifact, release)` 验证发布签名、SHA-256、可执行文件格式(Windows PE / macOS Mach-O)、平台和架构;任一检查失败立即停止,不返回可安装 artifact。
- `install_release(verified)` 安装缺失组件,或安全替换已安装组件:停止旧进程、保留可回滚副本、原子替换、恢复当前用户登录启动项并验证二进制版本;已有入网配置时启动组件并确认可响应,首次安装尚未入网时允许保持未运行;失败恢复旧版。macOS 上成功替换后会顺带申请屏幕录制权限,结果在返回值 `screen_access` 中(见第 8 节),不影响安装结论。
安装成功后重新运行第 2 节检查。组件缺失、无法响应或版本 `required` 时,完成本节后才进入第 4 节;版本 `available` 时当前连接仍可用,但用户本次要求配置或修复设备互联则按本节完成替换后再复检。
连通性验证使用系统自带的 OpenSSH Client(Windows 10 及以上的 `ssh.exe`,macOS 自带 `ssh`),用于配置完成后的模拟手机连接。
组件安装完成后,重新运行第 2 节检查。
## 4. 配置电脑并加入 GAnet
完整编排入口是 GAnet 组件 `ganet/device_connection/pairing.py` 的 `configure_environment()`。它先检查正式登录态,再依次调用 `ganet/device_connection/network.py` 中的系统配置和入网实现,最后返回权威环境检查结果。
GAnet 网络组件就绪后,先不带参数调用一次,探明是否有待授权的变更:
```python
from ganet.device_connection import pairing
result = pairing.configure_environment()
```
返回 `needs_approval` 时,按 4.1 向用户说明并取得同意,再带 `approved=True` 重新调用。`approved=True` 授权写入内嵌 SSH 授权文件与主机密钥,并继续完成登记入网;未取得用户同意不要传入。本调用不安装网络组件:组件缺失或版本 `required` 时返回 `needs_system_setup`,按第 3 节完成后重新开始。
带授权的调用在当前用户权限下依次执行两个阶段:先配置电脑访问能力(独立授权文件 `~/.genericagent/ganet/authorized_keys` 与内嵌 SSH 主机密钥),再用正式登录态登记电脑并加入 GAnet。两个阶段都幂等,重复执行修复现状而不是累加配置。排障时读取 `~/.genericagent/ganet/setup-elevated.log`,失败返回的 `message` 也会带上该路径。
### 4.1 处理结果
- `needs_project_setup`:说明 `message` 中缺失的当前 GAnet 组件,补齐后从第 1 节重新开始。
- `needs_system_setup`:说明 `message` 中缺失或需更新的网络组件,按第 3 节完成后重新开始。
- `needs_login`:当前正式登录态无效,请用户在 GAnet 用户中心登录,登录后重新开始。
- `needs_approval`:需要配置内嵌 SSH 环境。向用户一句话说明并取得同意后,带 `approved=True` 重新调用;用户不同意则停止并如实说明现状。
- `blocked`:根据 `stage`、`message` 和环境检查报告失败阶段、真实原因及已经完成的状态,不把本地 SSH 环境失败解释为登录或入网失败。
- `ok`:进入验收。若基础环境仅有 `available` 版本提示,仍可进入验收;在本轮按第 3 节完成组件替换后再复检。macOS 上返回值还带 `screen_access`(手机远程截图所需的屏幕录制权限,经网络组件的进程链主动申请):`granted` 为 `false` 时 `message` 会说明电脑上已弹出授权请求,请原样转达用户并请其趁在电脑旁完成——macOS 15 及以上的弹窗只有"打开系统设置",用户需在屏幕录制列表中打开 `ganet-sidecar` 的开关;若列表里已有一条开着却不生效的 `ganet-sidecar`(早期未签名版本留下的),删掉后由新弹窗重新加入。这不是失败,不需要重试,也不阻塞后续配对;除截图外的工具都不依赖它。
带授权参数的 `configure_environment()` 每轮只调用一次;无参调用只用于探明待授权事项,不作为失败重试手段。若 `blocked` 信息不足或返回状态与上述阶段职责不一致,可读取 `pairing.py` 中的 `configure_environment()` 以及 `network.py` 中对应的 `apply_confirmed()` 或 `enroll()` 定位接口故障;不要用临时脚本或手工命令绕开受管接口修改授权文件或网络组件状态。
## 5. 复检与手机配对
`configure_environment()` 返回的 `environment` 是本轮最终检查结果。必要时只再运行一次第 2 节的只读检查,确认:
```text
基础环境 → GAnet 控制面 → SSH 服务 → 安全性检查
```
同时确认第 1 节设备访问环境准备命令已成功;四项均通过后,向用户说明:
```text
设备互联环境已配置完成。
请回到已打开的“GAnet 用户中心”页面,在“我的设备”中点击“添加设备”,再使用手机 GA 扫描电脑显示的二维码。
```
完成扫码、电脑确认和一次真实连接验证后,才能确认端到端设备互联可用(这些由用户完成)。
## 6. 安全边界
- GAnet 组件内容不提交进 GenericAgent 的 Git;运行其 Python 接口时使用当前 GA 解释器并以组件目录为工作目录,轻量依赖装在 GA 环境中,当前 GA 根目录和 `sys.executable` 只由第 1 节内部配置入口显式传入。
- 保留用户原有 SSH 密钥、`authorized_keys`、系统服务、防火墙规则、DNS、hosts 与已有网络客户端状态;不代装或修改任何系统服务。
- SSH 默认端口为 `48222`,由网络组件内嵌服务提供;仅接受 GAnet 私有网络与本机回环连接,只允许公钥认证、命令执行和 SFTP,不提供交互终端和端口转发。
- token、一次性入网授权、配对短消息和 SSH 私钥不写入日志或聊天记录。
## 7. 卸载
用户要求卸载时,先按第 1 节定位组件;组件代码不存在则本机没有可卸载的 GAnet,如实说明即可。向用户确认一次「将移除本机 GAnet 设备互联环境(配对密钥、网络组件与本机数据),组件代码目录保留」,取得同意后在组件目录以 GA 解释器执行:
```python
from ganet.device_connection import pairing
result = pairing.remove_environment(approved=True)
```
该调用按固定顺序完成全部卸载:注销远端设备记录(未登录或不可达时自动跳过,结果无须向用户展开)、停止常驻 Worker 与 GAnet 网络组件、移除登录自启动(Windows 注册表 Run 项 / macOS LaunchAgent)、删除配对密钥与配对记录、删除组件数据目录(Windows `%LOCALAPPDATA%\GenericAgent\GAnet`,macOS `~/Library/Application Support/GenericAgent/GAnet`)和 `~/.genericagent/ganet`。不要用手工命令替代或补充这些步骤。macOS 的屏幕录制授权记录不会被卸载删除,如用户在意可提醒其在"系统设置 → 隐私与安全性 → 屏幕录制"中移除。
- `removed`:向用户说明卸载完成,组件代码目录保留、以后可随时重新配置;提醒用户可在手机 GA 的设备列表中删除这台电脑。用户如要求彻底删除,此时可再删除组件代码目录本身。
- `partial`:按 `message` 与 `steps` 如实报告未完成的本机步骤(常见原因是文件被占用),处理后重新执行同一调用即可,卸载操作可安全重复。
- 未取得用户同意不要传 `approved=True`;无参调用仅返回卸载计划,不做任何变更。
-26
View File
@@ -33,29 +33,3 @@
**用途**:N个独立同构子任务分发,独立上下文避免交叉污染
**约束**:文件系统共享(优点);键鼠不可共享;浏览器避免同tab
**流程**:准备独立输入文件→每个启动subagent(--func优先)→收集输出汇总
## subagent内部plan_mode使用
**原则**:subagent本身是完整agent,接收多步骤任务时应在内部创建plan管理执行
**触发条件**:任务包含3个以上子步骤、子步骤之间有依赖关系、需要checkpoint来恢复执行
**实现方式**:
1. **主agent创建subagent时**:在input.txt中说明任务包含多个步骤,建议使用plan_mode
2. **subagent内部执行**:检测到多步骤任务后,创建 `./subagent_plan.md` 并使用plan_mode执行
3. **主agent监控**:只关注最终结果(output*.txt),不需要关心subagent内部如何执行
4. **文件传递机制**:主agent创建subagent时在task_dir中生成 `context.json`,包含所有文件的**绝对路径**
**⚠ subagent启动后第一步必须读取context.json**
**⚠ 所有文件操作必须使用context.json中的绝对路径**
**格式示例**:
```json
{
"task": "任务描述",
"work_dir": "/absolute/path/to/plan_dir/",
"input_files": {
"paper_info": "/absolute/path/to/paper_info.txt"
},
"output_files": {
"pdf": "/absolute/path/to/paper.pdf",
"report": "/absolute/path/to/paper_report.md"
},
"dependencies": ["paper_info.txt必须存在"]
}
```
+3 -1
View File
@@ -12,7 +12,9 @@
from vision_api import ask_vision
result = ask_vision(image, prompt="描述图片内容", timeout=60, max_pixels=1_440_000)
# image: 文件路径(str/Path) 或 PIL Image
# backend: 'claude'(默认) | 'openai' | 'modelscope'
# backend: 'openai'(默认) | 'claude' | 'modelscope' | 'auto'
# 默认配置: native_oai_config0 (xAI,使用配置内代理);文件路径/PIL Image 均已实测
# 旧配置 native_oai_config15 返回 HTTP 503;备用 native_oai_config_fr113 曾实测识图成功
# 返回 str:成功为模型回复,失败为 'Error: ...'
```