dsh-edge 0.3.0-alpha.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.i18n.yaml CHANGED
@@ -2,5 +2,5 @@
2
2
  # last confirmed-consistent state. Both languages carry equal authority.
3
3
  # After editing either side, update both and re-record every pair with:
4
4
  # pnpm run doc-pairs -- --write
5
- README.md: 50dc27b1d0be05e08f3ffce591a7e33257e1ac1c
6
- README.zh.md: 698b8511580befa735b51f41a20cf3a51b35cf77
5
+ README.md: f341a64cd11e666f6bc70c18635b0e7212eb5a50
6
+ README.zh.md: fea9635e544b436cadb2bf33159ae1b8ca866938
package/README.md CHANGED
@@ -8,9 +8,29 @@ English | [中文](README.zh.md)
8
8
 
9
9
  The checked-in Wrangler configuration exposes two deployment targets from the same application graph. The default target is direct mode for Workers Free and has no Worker Loader binding. The named `isolated` target adds the `LOADER` binding and requires Workers Paid, but does not fork the DSH protocol, storage, UI, or tool implementation.
10
10
 
11
- The runtime runs persistent conversations through the upstream Cordis-composed `ReactLoopAgent`, `AgentRegistry`, `LlmRuntime`, `ToolRuntime`, `SystemPrompt`, `SessionStore`, and `SessionPersistence`. Edge code only binds a request-scoped DeepSeek adapter and maps one native DSH `bash` tool definition onto Cloudflare Computer. Durable Object SQLite implements the upstream persistence backend contract; `PersistenceCoordinator` still owns write-behind, revisions, resume preparation, and crash recovery. Model history is projected from canonical events rather than persisted separately.
11
+ The runtime keeps upstream ownership clear:
12
12
 
13
- The browser is the upstream Web shell and upstream client-plugin bundles. A build-time assembler derives the browser roster from the upstream base and Web bundle configs, injects the standard `window.__DSH_BOOT__` graph, and publishes the result as Cloudflare static assets. The Durable Object implements the supported upstream `ApiProxy` methods through the standard HTTP carrier and supplies the two upstream downlinks as hibernatable WebSockets. The upstream image composer, gallery, lightbox, attachment wire contract, and DeepSeek serializer are reused unchanged; the storage seam selects private R2 for new permanent deployments, bounded Durable Object storage for temporary deployments, and a one-time owner choice for pre-0.3 Workers. Edge excludes client plugins whose host domains are absent instead of forking their UI code; this includes session-log export until its server endpoint exists. A small Edge-owned login shell protects the upstream UI and protocol without changing either one. Optional local-host plugins remain unavailable.
13
+ - `ReactLoopAgent`, `AgentRegistry`, `LlmRuntime`, `ToolRuntime`, `SystemPrompt`, `SessionStore`, and `SessionPersistence` run through the upstream Cordis composition.
14
+ - Edge binds a request-scoped DeepSeek adapter and maps the native DSH `bash` tool onto Cloudflare Computer.
15
+ - Durable Object SQLite implements the upstream persistence backend contract. `PersistenceCoordinator` still owns write-behind, revisions, resume preparation, and crash recovery.
16
+ - Model history is projected from canonical events rather than persisted in a second Edge schema.
17
+
18
+ The browser also remains upstream-owned:
19
+
20
+ - A build-time assembler derives the Web roster from upstream configs, injects the standard `window.__DSH_BOOT__` graph, and emits Cloudflare static assets.
21
+ - The Durable Object implements supported upstream `ApiProxy` methods through the standard HTTP carrier and supplies both downlinks as hibernatable WebSockets.
22
+ - The image composer, gallery, lightbox, attachment wire contract, and DeepSeek serializer are reused unchanged.
23
+ - The storage seam chooses private R2 for new permanent deployments, bounded Durable Object storage for temporary deployments, and a one-time owner choice for pre-0.3 Workers.
24
+ - Client plugins whose host domains are unavailable are excluded instead of forked. Session-log export and optional local-host plugins remain unavailable.
25
+ - A small Edge-owned login shell protects the upstream UI and protocol without changing either one.
26
+
27
+ ## Find what you need
28
+
29
+ - [Install or upgrade on Cloudflare](#install-on-cloudflare)
30
+ - [Compare native, adapted, and unavailable capabilities](#cloudflare-compatibility-matrix)
31
+ - [Configure DeepSeek credentials, models, timeouts, and owner authentication](#api-key-boundary)
32
+ - [Run the release runtime locally](#run-locally)
33
+ - [Inspect routes, limits, and durability behavior](#edge-api)
14
34
 
15
35
  ## Run locally
16
36
 
@@ -70,13 +90,15 @@ curl -b /tmp/dsh-edge-cookie -N -X POST -H 'content-type: application/json' \
70
90
  http://localhost:8787/api/sessions/SESSION_ID/turn
71
91
  ```
72
92
 
73
- The session turn sends upstream `SessionEvent` values directly as SSE data, including `agent/inbox/spliced`, `assistant/chunk`, `assistant/message`, `tool/call`, `tool/result`, and turn/step boundaries. The live stream queues at most 1 MiB for its client; a slower reader is disconnected without cancelling the turn or its persistence. `GET /api/sessions/SESSION_ID` returns bounded session metadata only; clients obtain history from `GET /api/sessions/SESSION_ID/events?after=SEQ&limit=COUNT`, which replays a bounded page by upstream `seq`. Replay defaults to 128 events, accepts at most 256, preflights stored payload bytes before loading rows, and retains at most 1 MiB of encoded SSE; `x-dsh-edge-has-more` and `x-dsh-edge-next-after` drive the next request.
74
-
75
- Session listing is also bounded: `GET /api/sessions?after=SESSION_ID&limit=COUNT` defaults to 50 summaries, accepts at most 100, and returns `hasMore` plus `nextAfter` in the JSON body. The Durable Object derives titles and latest timestamps from canonical rows without loading each session log. The upstream Web session list additionally includes retained blank headers that have no canonical event yet.
76
-
77
- The upstream `session.history` browser RPC uses one Edge admission budget before live and cold paths diverge: every request is capped at the browser's 50-message page size. Cold logs apply that boundary in Durable Object SQL before decoding payloads and validate the selected contiguous window under 8,192-event and 8 MiB stored-payload ceilings. Live logs locate the same boundary without first copying the complete in-memory window, then enforce the same event ceiling and an 8 MiB encoded-response ceiling. An over-budget window is refused instead of truncated. Model-directory, model-selection, and turn-admission existence checks use header point reads; only a turn that must resume the agent decodes canonical history.
93
+ The diagnostic session APIs preserve upstream events while bounding every read:
78
94
 
79
- The upstream sidebar's `session.search` RPC scans canonical current user and assistant messages without a second Edge index or wire format. One request examines at most the 32 sessions with the most recent human activity and searches only complete logs of at most 512 events; a cold log must also fit within 256 KiB of stored payload. It returns the upstream maximum of 20 bounded snippets; `hasMore` is true when a result or work bound prevents an exhaustive answer.
95
+ - A turn streams upstream `SessionEvent` values directly as SSE, including inbox splices, assistant chunks/messages, tool calls/results, and turn/step boundaries.
96
+ - A live stream queues at most 1 MiB per client. A slower reader is disconnected without cancelling the turn or its persistence.
97
+ - Session detail returns bounded metadata. Event replay defaults to 128 events, accepts at most 256, preflights stored bytes, retains at most 1 MiB of encoded SSE, and exposes continuation headers.
98
+ - Session listing defaults to 50 summaries and accepts at most 100. The Durable Object derives titles and timestamps from canonical rows without loading each log; upstream Web also receives retained blank headers.
99
+ - Browser history is capped at 50 messages and refuses, rather than truncates, windows above 8,192 events or 8 MiB. Cold paths apply the boundary in SQL; live paths locate it without copying the complete in-memory log.
100
+ - Sidebar search uses canonical current user/assistant messages without a second index or wire format. It examines at most 32 recent sessions, requires complete logs of at most 512 events and 256 KiB when cold, and returns at most 20 snippets with `hasMore` when a bound is reached.
101
+ - Model lookup and selection use header point reads. Only a turn that resumes the agent decodes canonical history.
80
102
 
81
103
  Every authenticated request uses the deployment's fixed `owner` Durable Object. The legacy `x-dsh-edge-instance` header and `instance` query parameter are rejected rather than treated as identities. `/api/sessions/SESSION_ID/turn` continues the stored canonical history.
82
104
 
@@ -131,23 +153,63 @@ Cloudflare static assets -> upstream Web shell + client plugin graph
131
153
  -> upstream Web runtime reconciles and renders the canonical events
132
154
  ```
133
155
 
134
- The local integration check uses an SSE stand-in and the real Wrangler, Durable Object SQLite, local R2, the default direct Computer workspace backend, static asset service, HTTP carrier, and WebSockets. Direct mode exercises the temporary DO attachment backend while Isolated mode exercises private R2. It verifies owner login, API and WebSocket cookie enforcement, rejection of legacy instance selectors, disabled direct-shell networking, the upstream session create/list/history/search/prompt/rename/fork flow; an image prompt through the upstream composer/protocol/provider path; authorized attachment reads, cross-session rejection, fork reuse, and attachment persistence after restart; queue edit, removal, and promotion to steering; workspace create/list/rename/delete/session reorder/archive; the corresponding live and reconnect baselines and Host frames; real browser boot and UI-issued workspace rename, image turn, content search, branch, and archive actions; automatic return to login when the browser session expires; conversation continuity, event replay, two-step bash and Web Search tool exchanges, and restoration after a Wrangler restart. A focused failure test proves that a post-enqueue durability failure blocks model use without reporting the already-woken prompt as rejected. Committed model-visible and ARIA goldens pin the tool transcripts and the assembled upstream Web client through the Edge HTTP/WebSocket protocol. A live DeepSeek call requires the developer's own key and is intentionally not part of the repository test suite.
156
+ The local integration suite uses an SSE stand-in with real Wrangler, Durable Object SQLite, local R2, the Direct Computer workspace backend, static assets, the HTTP carrier, and WebSockets. Direct mode exercises DO attachment storage; Isolated mode exercises private R2. Together they verify:
157
+
158
+ - owner login, API/WebSocket cookie enforcement, legacy-selector rejection, and disabled Direct-shell networking;
159
+ - upstream session create/list/history/search/prompt/rename/fork and queue edit/remove/steering flows;
160
+ - image admission through the upstream composer, protocol, provider, authorization, fork reuse, and restart persistence;
161
+ - Workspace create/list/rename/delete/reorder/archive, live/reconnect baselines, and Host frames;
162
+ - real browser boot, UI-issued Workspace rename, image turn, content search, branch, archive, and expired-session login recovery;
163
+ - conversation continuity, event replay, two-step bash and Web Search tool exchanges, and Wrangler-restart restoration.
164
+
165
+ A focused failure test proves that post-enqueue durability failure blocks model use without reporting the already-woken prompt as rejected. Committed model-visible and ARIA goldens pin tool transcripts and the assembled upstream Web client. A live DeepSeek call requires the developer's key and is intentionally outside the repository test suite.
135
166
 
136
167
  ## API-key boundary
137
168
 
138
- `DEEPSEEK_API_KEY` from `.dev.vars` is the local credential source. A read-only Edge provider exposes that Worker secret through the upstream `ctx.credentials` service for each chat or search operation without writing it to Durable Object storage, the VFS, session events, or responses. It removes surrounding whitespace and treats a blank value as unconfigured. `DEEPSEEK_BASE_URL` controls chat and must be an HTTP(S) URL without URL userinfo; its read-only browser projection omits query and fragment components that may carry gateway credentials. `DEEPSEEK_SEARCH_BASE_URL` independently controls the Anthropic-compatible Messages endpoint used by DeepSeek native search, defaults to `https://api.deepseek.com/anthropic/v1`, and must be an HTTP(S) URL without userinfo, query, or fragment. Edge mounts the upstream `web_search` tool, its 30-second tool-call timeout policy, and structured Web result presentation; `web_fetch` remains disabled because the runtime has no arbitrary-URL network policy. Search requests do not follow redirects. `DEEPSEEK_MODEL` selects the validated deployment default and defaults to `deepseek-v4-flash`; each session can choose another entry from the upstream provider catalog. `DEEPSEEK_REASONING_EFFORT` accepts `off`, `low`, `high`, or `max` and defaults to `off`. `DEEPSEEK_MAX_OUTPUT_TOKENS` optionally overrides the 8,192-token chat default and must be a positive safe integer. `DEEPSEEK_STREAM_IDLE_TIMEOUT_MS` optionally overrides the 120,000 ms chat default and must be a positive integer no greater than 2,147,483,647. Invalid deployment configuration fails before session lookup or the SSE response opens.
169
+ `DEEPSEEK_API_KEY` from `.dev.vars` is the local credential source. A read-only Edge provider exposes it through upstream `ctx.credentials` for each chat or search operation without writing the value to Durable Object storage, the VFS, session events, or responses. Surrounding whitespace is removed; a blank value is unconfigured.
170
+
171
+ | Variable | Purpose and validation |
172
+ | --- | --- |
173
+ | `DEEPSEEK_BASE_URL` | Chat endpoint. Must be HTTP(S) without URL userinfo. The browser projection omits query and fragment components that may carry gateway credentials. |
174
+ | `DEEPSEEK_SEARCH_BASE_URL` | Anthropic-compatible Messages endpoint for native Web Search. Defaults to `https://api.deepseek.com/anthropic/v1`; must be HTTP(S) without userinfo, query, or fragment. Search does not follow redirects. |
175
+ | `DEEPSEEK_MODEL` | Validated deployment default; defaults to `deepseek-v4-flash`. Each session may choose another upstream catalog entry. |
176
+ | `DEEPSEEK_REASONING_EFFORT` | `off`, `low`, `high`, or `max`; defaults to `off`. |
177
+ | `DEEPSEEK_MAX_OUTPUT_TOKENS` | Optional positive safe integer overriding the 8,192-token chat default. |
178
+ | `DEEPSEEK_STREAM_IDLE_TIMEOUT_MS` | Optional positive integer up to 2,147,483,647; defaults to 120,000 ms. |
179
+ | `DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS` | Default Computer command timeout; defaults to 120,000 ms. |
180
+ | `DSH_EDGE_MAX_COMMAND_TIMEOUT_MS` | Caller-selectable timeout ceiling; defaults to 120,000 ms and cannot be lower than the default. |
139
181
 
140
- `DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS` applies to every Computer command that omits a caller timeout, and `DSH_EDGE_MAX_COMMAND_TIMEOUT_MS` limits caller-selected values. Both default to 120,000 ms, must be positive integers no greater than 2,147,483,647, and the default cannot exceed the maximum.
182
+ Invalid deployment configuration fails before session lookup or SSE response creation. Edge mounts upstream `web_search` with a 30-second tool-call timeout and structured results. `web_fetch` remains disabled because the runtime has no arbitrary-URL network policy.
141
183
 
142
- `DSH_EDGE_ACCESS_KEY` is the deployment's single-owner boundary. It must contain 32–512 UTF-8 bytes without surrounding whitespace or control characters; generate a random value rather than reusing a human password. A successful form login creates a signed 30-day HttpOnly `SameSite=Strict` cookie. HTTPS deployments use the host-only `__Host-dsh_edge_owner` name and `Secure`; local HTTP development uses an unprefixed cookie because browsers reject `__Host-` cookies without HTTPS. The cookie carries no user data, is not forwarded to the Durable Object, and becomes invalid when the access key rotates. Unauthenticated API and WebSocket requests return 401. Owner-authentication API failures also carry `WWW-Authenticate: DshEdgeOwner`; only that exact same-origin 401 makes the Edge-assembled shell navigate to `/login`, so provider or configuration 401 diagnostics remain visible while an expired browser session still escapes the upstream reconnect loop. Authenticated browser API and WebSocket requests from a different origin return 403 even when they carry a same-site cookie. The Cloudflare asset policy prevents the shell from being embedded in a frame whether it is reached through `/`, `/index.html`, or an SPA fallback alias. `/` redirects to `/login`; `/api/health` and immutable asset files remain public. This deliberately is not an account system or a multi-tenant boundary.
184
+ ### Owner authentication
185
+
186
+ - `DSH_EDGE_ACCESS_KEY` is the single-owner boundary. It must contain 32–512 UTF-8 bytes without surrounding whitespace or control characters; generate a random value instead of reusing a human password.
187
+ - Login creates a signed 30-day HttpOnly `SameSite=Strict` cookie. HTTPS uses the host-only `__Host-dsh_edge_owner` name with `Secure`; local HTTP uses an unprefixed cookie.
188
+ - The cookie carries no user data, is never forwarded to the Durable Object, and becomes invalid when the access key rotates.
189
+ - Unauthenticated API and WebSocket requests return 401. Only an owner-authentication 401 carrying `WWW-Authenticate: DshEdgeOwner` makes the same-origin shell navigate to `/login`; provider/configuration 401 diagnostics remain visible.
190
+ - Authenticated browser API and WebSocket requests from another origin return 403 even with a same-site cookie.
191
+ - The asset policy prevents framing through `/`, `/index.html`, or an SPA fallback. `/` redirects to `/login`; `/api/health` and immutable assets remain public.
192
+
193
+ This deliberately is not an account system or multi-tenant boundary.
143
194
 
144
195
  ## Install on Cloudflare
145
196
 
146
- The top level of the committed `wrangler.jsonc` is the default direct target and does not require a Worker Loader. Direct shell code executes in the same Durable Object isolate as the agent and VFS, so just-bash's hardened execution limits, explicit command timeout, bounded output, explicit environment, and disabled network command are the primary command boundary. This is a lighter isolation model than a separate Worker; do not expose the single-owner deployment to untrusted users.
197
+ | Target | Cloudflare requirement | Command boundary | Health identifier |
198
+ | --- | --- | --- | --- |
199
+ | Direct (default top level) | Workers Free; no Loader binding | Hardened just-bash in the agent/VFS Durable Object, with explicit timeouts, bounded output/environment, and no network command | `just-bash-direct` |
200
+ | `env.isolated` | Workers Paid with `LOADER` | Computer Worker Shell in a separate Dynamic Worker | `just-bash-isolated` |
147
201
 
148
- The same file also defines `env.isolated`, a complete Workers Paid target with the `LOADER` binding. The application code sees `LOADER` and chooses Computer's Worker Shell backend, so `/api/health` reports `just-bash-isolated` instead of `just-bash-direct`. Workers Paid is a Workers subscription starting at $5 per month, not the Cloudflare Pro website plan. Each Worker name has independent Durable Object storage and secrets, so install both modes under different names when both should remain live.
202
+ Direct mode is lighter isolation than a separate Worker; do not expose the single-owner deployment to untrusted users. Workers Paid is a Workers subscription starting at $5 per month, not the Cloudflare Pro website plan. Worker names have independent Durable Object storage and secrets, so use different names when both modes should remain live.
149
203
 
150
- `wrangler.jsonc` remains the single canonical configuration for both modes. Release packaging builds one tested, minified Worker artifact per mode from the workspace sources. Direct mode replaces only Computer's unreachable Dynamic Worker shell-core module at build time; the Computer workspace adapter and command exports remain the upstream implementations. Isolated mode preserves that shell core but replaces the unreachable Direct backend with a fail-closed module, so each artifact carries only its selected command runtime. The published installer generates a private mode-specific configuration that points at the selected artifact and asks Wrangler to upload it with `no_bundle`; the user's machine does not rebuild dsh-edge or resolve the upstream Harness packages into a new Worker. CI starts the Direct artifact from an installed tarball and rejects it above a 900 KiB compressed budget, leaving headroom below the 1 MiB limit enforced by Cloudflare's anonymous temporary-account upload path.
204
+ `wrangler.jsonc` remains the canonical source for both modes:
205
+
206
+ - Release packaging builds one tested, minified artifact per mode.
207
+ - Direct replaces only Computer's unreachable Dynamic Worker shell-core module; its Workspace adapter and command exports remain upstream.
208
+ - Isolated preserves that shell core and replaces the unreachable Direct backend with a fail-closed module. Each artifact therefore carries only its selected command runtime.
209
+ - The installer generates a private mode-specific config, points it at the selected artifact, and uploads with `no_bundle`. The user's machine does not rebuild dsh-edge or resolve Harness packages into a new Worker.
210
+ - CI starts the Direct artifact from an installed tarball and rejects gzip output above 900 KiB, preserving headroom below the 1 MiB anonymous temporary-account limit.
211
+
212
+ ### Install and upgrade
151
213
 
152
214
  Run the stable installer without cloning this repository:
153
215
 
@@ -155,7 +217,7 @@ Run the stable installer without cloning this repository:
155
217
  npx dsh-edge install
156
218
  ```
157
219
 
158
- This resolves through npm's `latest` channel. Use `npx dsh-edge@next install` to test the current 0.3 prerelease with upstream model selection and image prompts.
220
+ This resolves through npm's `latest` channel. Use `npx dsh-edge@next install` only to opt into a newer prerelease when one is available.
159
221
 
160
222
  Upgrade an existing named Worker with the same runtime choice. The deployment keeps its Durable Object data; because Cloudflare secrets are write-only, the upgrade asks for the owner access key and DeepSeek API key again and replaces their active values:
161
223
 
@@ -165,13 +227,32 @@ For a stable deployment, run:
165
227
  npx dsh-edge upgrade
166
228
  ```
167
229
 
168
- If the installed version is a 0.2 alpha, promote it to the stable channel once with `npx dsh-edge@latest upgrade`; prerelease deployments otherwise remain on `next`. The Edge settings page derives the channel from the installed version and copies the matching command.
169
-
170
- The installer asks for the runtime before the account. The recommended `Free — Direct Shell` mode works on Workers Free and can use a detected Cloudflare account, open Cloudflare sign-in or registration, or create a temporary account without login. `Isolated — Dynamic Worker` requires Workers Paid and therefore offers only a detected or newly authenticated account. Cloudflare does not expose a reliable local entitlement check for Worker Loader, so an isolated install lets Cloudflare authorize the upload and turns a rejection into a choice between enabling Workers Paid and using direct mode. For a new permanent account installation, the installer creates or reuses a private `<worker-name>-attachments` R2 bucket and writes only its binding to the generated private Wrangler config. It never deletes the bucket on deployment failure. R2 Standard has an included monthly free tier, but Cloudflare requires the selected account to enable its separate usage-based R2 subscription through the Dashboard checkout. The installer checks R2 before collecting Worker secrets. Cloudflare error `10042` opens an account-specific recovery choice: retry after activation, cancel, or safely switch an unmarked pre-attachment Worker to DO storage. A new or already R2-pinned deployment cannot switch backends because doing so could violate the documented storage decision or strand references. Temporary accounts use a 64 MiB Durable Object attachment backend and support the same upstream image UI. Claiming preserves that backend and its existing image history; automatic migration to R2 is not implemented. Each new deployment records an explicit attachment-storage marker. Before updating an existing Worker, the installer inspects every active version and preserves a marked or bound R2-or-DO choice. A Worker from before image support has neither marker nor attachment binding and cannot contain image references, so its first 0.3 upgrade asks once between no-setup 64 MiB DO storage and private R2. The chosen backend is then pinned. Mixed active rollouts are refused rather than guessed.
171
-
172
- The remaining prompts select a Worker name, generate or accept the owner access key, collect the DeepSeek API key through hidden input, and show a final cost summary. A temporary-account install also asks the user to accept Cloudflare's Terms of Service and Privacy Policy explicitly. An existing Worker is never overwritten without confirmation. The installer passes both credentials through a mode-`0600` temporary secrets file and gives Wrangler only an allowlisted runtime environment plus the Cloudflare authentication selected for that command; unrelated ambient keys, tokens, passwords, secrets, and Node injection options do not reach the child. It removes the secret file after the command and discovers the resulting URL from Wrangler's structured output. Deployment output is hidden behind one progress indicator by default; add `--verbose` to either command to inspect Wrangler diagnostics.
173
-
174
- After an accepted upload, a second progress indicator observes the public `/api/health` route for at most 45 seconds without sending either credential or following redirects. It accepts only the exact packaged version and selected runtime. A matching response produces a ready card. Cloudflare propagation, challenge, placeholder, transport, and older-release responses remain pending; expiry still exits successfully and tells the owner to wait briefly and refresh. This observation does not call DeepSeek or touch Durable Object state. The final card prints the URL, owner access key, and concrete next steps; a temporary account also receives a bearer claim URL that must be claimed within 60 minutes to retain the Worker and its data. A rejected upload is reported as not installed and, when Wrangler created a temporary account first, still prints its claim URL without presenting the unused owner key as active. If upload succeeds but output parsing, claim-URL extraction, interruption handling, activation interruption, or local cleanup prevents a normal handoff, a recovery card still prints the active owner key and any known URLs before the command exits unsuccessfully. The installation uploads directly through Wrangler and does not create or bind a GitHub repository, Cloudflare Builds project, or source-build pipeline.
230
+ If the installed version contains `-alpha` or `-rc`, promote it to the stable channel once with `npx dsh-edge@latest upgrade`. The Edge settings page derives its command from the installed version; without that explicit `@latest` command, an existing prerelease remains on `next`.
231
+
232
+ ### Accounts and attachment storage
233
+
234
+ - The installer asks for the runtime before the account.
235
+ - Recommended `Free — Direct Shell` works on Workers Free with a detected account, a new sign-in/registration, or a temporary account without login.
236
+ - `Isolated Dynamic Worker` requires Workers Paid and offers only a detected or newly authenticated account. Cloudflare authorizes the Loader upload; rejection becomes a choice between enabling Workers Paid and switching to Direct mode.
237
+ - New permanent installs create or reuse a private `<worker-name>-attachments` R2 bucket and place only its binding in the generated private Wrangler config. Deployment failure never deletes the bucket.
238
+ - R2 Standard has an included monthly free tier, but the account must enable its separate usage-based subscription. The installer checks R2 before collecting Worker secrets.
239
+ - Cloudflare error `10042` offers account-specific activation, retry, and cancellation. Only an unmarked pre-attachment Worker may safely switch to DO storage; a new or R2-pinned deployment cannot switch and strand references.
240
+ - Temporary accounts use the same image UI with a 64 MiB DO backend. Claiming preserves that backend and history; automatic R2 migration is not implemented.
241
+ - Every new deployment records its attachment-storage marker. Upgrades inspect every active version and preserve the marked or bound backend.
242
+ - A pre-image Worker has no marker, binding, or image references, so its first 0.3 upgrade asks once between 64 MiB DO storage and private R2, then pins the choice. Mixed active rollouts are refused rather than guessed.
243
+
244
+ ### Credential handoff and activation
245
+
246
+ - The remaining prompts select a Worker name, generate or accept the owner access key, collect the DeepSeek key through hidden input, and show a final cost summary. Temporary installs also require explicit acceptance of Cloudflare's terms and privacy policy.
247
+ - Existing Workers are never overwritten without confirmation.
248
+ - Both credentials travel through a mode-`0600` temporary secrets file. Wrangler receives only an allowlisted runtime environment and the selected Cloudflare authentication; unrelated ambient secrets and Node injection options do not reach the child.
249
+ - The secret file is removed after the command. Wrangler's structured output supplies the deployed URL. Add `--verbose` to inspect full deployment diagnostics.
250
+ - After upload, the installer observes public `/api/health` for up to 45 seconds without credentials or redirects. Only the exact package version and selected runtime produce a ready card; propagation, challenge, placeholder, transport, and older-release responses remain pending.
251
+ - Observation expiry exits successfully and asks the owner to refresh shortly. It never calls DeepSeek or touches Durable Object state.
252
+ - The final card prints the URL, active owner key, and next steps. Temporary accounts also receive a bearer claim URL that must be claimed within 60 minutes.
253
+ - A rejected upload is reported as not installed. If Wrangler created a temporary account, its claim URL is still shown without presenting the unused owner key as active.
254
+ - If upload succeeds but handoff fails, a recovery card prints the active owner key and all known URLs before the command exits unsuccessfully.
255
+ - Installation uploads directly through Wrangler; it does not create or bind a GitHub repository, Cloudflare Builds project, or source-build pipeline.
175
256
 
176
257
  Contributors working from a checkout can reproduce the two release artifacts locally with `pnpm --filter dsh-edge bundle:direct` and `pnpm --filter dsh-edge bundle:isolated`. The first command also enforces the compressed-size budget.
177
258
 
@@ -183,11 +264,27 @@ pnpm --filter dsh-edge example:install
183
264
 
184
265
  ## Edge API
185
266
 
186
- - `POST /api/<upstream-method>` accepts the upstream `ClientRequest` envelope for the supported `ApiProxy` methods. The Web client currently uses session list/search/create/history/models/select/prompt/updateQueue/rename/fork/cancel, host description, workspace list/create/rename/delete/reorder/archive, skills, agent presets, settings and credential descriptions, and LLM catalogs. `agentPreset.read` renders the programmatic Edge composition through the upstream read-only viewer, and `credentials.describe` returns credential state without a value. Search projects canonical current-message surfaces and returns only bounded upstream result values. Fork copies a completed-turn prefix through the canonical session seed format and retains parent lineage; Edge refuses a seed above 8,192 events or 8 MiB rather than materializing an unbounded Durable Object history. Queue mutations edit, remove, or promote an item through the live upstream Agent inbox; the synchronous inbox mutation is the upstream acceptance point, while the persistence coordinator owns later write-behind and retirement retry. Workspace mutations persist the upstream workspace-domain global and record shapes through the Durable Object backend. Archive preserves the session log and workspace slot; unary responses and Host frames carry the same full snapshots as upstream.
187
- - `GET /login` renders the Edge-owned owner form; `POST /api/auth/login` exchanges the configured access key for a signed cookie, `GET /api/auth/session` reports cookie validity, and `POST /api/auth/logout` clears it.
188
- - `GET /api/events.mux` and `GET /api/events.host` upgrade to the upstream downlink WebSockets. The Durable Object serializes each socket's channel and verified owner-session expiry as its hibernation attachment, closes it at that expiry through an alarm, and reconstructs canonical sessions plus retained blank headers from Durable Object SQL. The mux stream publishes a complete `session/queue` snapshot after each committed inbox splice and sends pending live inbox baselines when a client reconnects.
189
- - `POST /api/commands/list` implements the upstream generated-Remote envelope with an empty catalog because the Edge preset registers no human commands.
190
- - `GET /api/health` returns the public package-and-mode release identifier and configured attachment default (`private-r2` or `temporary-do`), and validates owner authentication, the deployment-scoped DeepSeek credential, model and transport choices, and the command-timeout policy before reporting the runtime components as ready. It does not call the provider, Durable Object, R2, VFS, or shell. The authenticated agent-preset projection reports the actual backend pinned by the owner Durable Object, the temporary storage cap, the deployment-default model, and the runtime-derived upstream model catalog with session selection scope.
267
+ ### Upstream RPC carrier
268
+
269
+ - `POST /api/<upstream-method>` accepts the upstream `ClientRequest` envelope for supported `ApiProxy` methods.
270
+ - The Web client uses session list/search/create/history/models/select/prompt/updateQueue/rename/fork/cancel; host description; Workspace list/create/rename/delete/reorder/archive; skills; agent presets; settings and credential descriptions; and LLM catalogs.
271
+ - `agentPreset.read` renders the programmatic Edge composition through the upstream read-only viewer. `credentials.describe` returns credential state without a value.
272
+ - Search projects canonical current-message surfaces and returns bounded upstream result values.
273
+ - Fork copies a completed-turn prefix through the canonical session seed format and retains parent lineage. Edge refuses seeds above 8,192 events or 8 MiB instead of materializing unbounded history.
274
+ - Queue mutations edit, remove, or promote an item through the live upstream Agent inbox. The synchronous mutation is the acceptance point; the persistence coordinator owns later write-behind and retirement retry.
275
+ - Workspace mutations persist upstream workspace-domain global and record shapes through the Durable Object backend. Archive preserves the session log and Workspace slot; unary responses and Host frames carry the same full snapshots as upstream.
276
+
277
+ ### Authentication and downlinks
278
+
279
+ - `GET /login` renders the owner form. `POST /api/auth/login` exchanges the configured key for a signed cookie; `GET /api/auth/session` reports validity; `POST /api/auth/logout` clears it.
280
+ - `GET /api/events.mux` and `GET /api/events.host` upgrade to upstream downlink WebSockets. The Durable Object serializes each socket's channel and verified owner-session expiry as a hibernation attachment, closes it at expiry through an alarm, and reconstructs canonical sessions plus retained blank headers from SQL.
281
+ - After each committed inbox splice, mux publishes a complete `session/queue` snapshot. Reconnecting clients receive pending live-inbox baselines.
282
+ - `POST /api/commands/list` uses the upstream generated-Remote envelope with an empty catalog because the Edge preset registers no human commands.
283
+ - `GET /api/health` returns the public release/mode identifier and configured attachment default (`private-r2` or `temporary-do`). It validates owner authentication, deployment-scoped DeepSeek credentials, model/transport choices, and command timeouts before reporting ready.
284
+ - Health does not call the provider, Durable Object, R2, VFS, or shell. The authenticated agent-preset projection reports the pinned backend, temporary cap, deployment-default model, and runtime-derived upstream catalog with session selection scope.
285
+
286
+ ### Diagnostic REST routes
287
+
191
288
  - `PUT /api/workspace/file?path=/workspace/...` writes a UTF-8 file.
192
289
  - `GET /api/workspace/file?path=/workspace/...` reads a UTF-8 file.
193
290
  - `DELETE /api/workspace/file?path=/workspace/...` removes a file.
@@ -198,6 +295,49 @@ pnpm --filter dsh-edge example:install
198
295
  - `GET /api/sessions/:sessionId/events?after=...&limit=...` replays a bounded event page and returns continuation headers.
199
296
  - `POST /api/sessions/:sessionId/cancel` aborts the active turn owned by the current Durable Object process.
200
297
 
201
- Upstream session creation and fork return `workspace-attach-failed` with the published session and Workspace ids when publication succeeds but Workspace attachment fails; the diagnostic creation route returns the same code plus its complete created session. Prompt and queue-edit text share the same 64 KiB semantic limit. Their RPC carrier accepts up to 10 MiB so a projected 7 MiB raw-image batch still fits after base64 and envelope overhead. Because the Edge composition has no directory-flow provider, the upstream browser hides Delete on its sole Workspace and exposes it again whenever restoration remains possible.
202
-
203
- The API limits text files to 1 MiB, commands to 16 KiB, user messages to 64 KiB, and retained shell stdout plus stderr to 64 KiB; these are UTF-8 byte limits. Both attachment backends accept PNG and JPEG only, at most 4 images per message, 3.5 MiB per image, 7 MiB total, 40 million pixels, and 2,000 pixels per side; admission fully decodes the declared raster format before writing. Request bodies are consumed incrementally before parsing or forwarding: session creation accepts at most 8 KiB of JSON, workspace execution 128 KiB, and message-bearing turn or queue-update RPCs 10 MiB, while file uploads enforce their 1 MiB bound during consumption and reject malformed UTF-8. Once a body exceeds its route limit, later chunks are drained without being retained and the route returns 413. File reads first check VFS metadata, then collect the opened raw byte stream through the same 1 MiB cap, closing the growth race between `stat()` and `readFile()` without retaining an unbounded value. The runtime requests interruption when combined shell output crosses the retention bound and does not accumulate later output. Command status reports cancellation only when the adapter requested interruption, independently of the shell exit code; `timedOut` separately records deadline expiry. Failed initial session persistence discards the retained unmaterialized batch before disposing the newly published upstream agent handle, so teardown cannot later commit a session whose create request returned an error. A lazy blank session retains only its upstream header until the first canonical event; that materialization removes the retained header in the same SQL transaction. Each turn owns one upstream handle and disposes it after the stream completes, so previously accessed conversations do not remain resident for the Durable Object lifetime. Deployment settings resolve before the process-local owner claim. An upstream protocol prompt returns accepted and publishes running state only after its inbox event crosses `SessionStore.flush()`; later streamed events cross the same barrier before WebSocket or SSE delivery. Queue edits, removals, and steering promotion use the synchronous live-inbox mutation as their acceptance point; `PersistenceCoordinator` owns subsequent write-behind or retirement retry, so a later storage attempt cannot turn an accepted mutation into a rejected response. Session rename follows the same upstream metadata contract: the synchronous title append is its acceptance point for both active and cold sessions. Workspace global state and records use the upstream logical schemas under Edge-specific physical keys; DO transactions atomically pair record and registry-order changes, while a process-local chain serializes workspace mutations. Committed rename, delete, recreation, session reorder, attachment, and archive changes publish the matching upstream Host frames, and `workspace.list` restores their complete baseline after restart. A process-local owner rejects a concurrent turn, and cancel calls the native agent cancellation path. On the next cold resume, upstream interrupted-turn repair closes an open persisted tail and canonical `session/end-seed` markers preserve lifecycle boundaries. Replay checks session absence separately so persistence corruption or SQL failures are not collapsed into 404, reads only one bounded SQL page rather than the full suffix, and caps the encoded response. `PersistenceCoordinator.readValidatedPage()` performs identity, format, legacy-shape, and event-vocabulary validation on every page without adding Edge pagination to the public persistence service. If legacy normalization needs earlier messages, it rereads only one prefix through the same byte-bounded loader and refuses the page when that required prefix does not fit. Cold browser history selects its message boundary in SQL and loads only the resulting contiguous range under fixed event and stored-byte ceilings. Session listing queries one bounded canonical header/title summary page; detail reads its durable canonical point summary or retained blank header, while turn existence checks use point queries instead of listing headers or projecting a complete log. Effective model, system prompt, adapter defaults, and tools are recorded in standard `request/header` events. The request-scoped adapter uses the validated deployment reasoning and output policies. Workspace paths must stay below `/workspace/`.
298
+ ### Session and Workspace behavior
299
+
300
+ - Session creation and fork return `workspace-attach-failed` with the published session and Workspace ids when publication succeeds but Workspace attachment fails. The diagnostic route returns the same code plus the complete created session.
301
+ - Prompt and queue-edit text share a 64 KiB semantic limit. Their 10 MiB RPC carrier leaves room for a 7 MiB raw-image batch after base64 and envelope overhead.
302
+ - Because Edge has no directory-flow provider, the upstream browser hides Delete on its sole Workspace and exposes it again whenever restoration remains possible.
303
+
304
+ ### Limits and request admission
305
+
306
+ | Surface | Limit |
307
+ | --- | --- |
308
+ | UTF-8 text file | 1 MiB |
309
+ | Shell command | 16 KiB |
310
+ | User message or queue-edit text | 64 KiB |
311
+ | Retained shell stdout + stderr | 64 KiB |
312
+ | Session-create JSON body | 8 KiB |
313
+ | Workspace-exec JSON body | 128 KiB |
314
+ | Message-bearing turn or queue-update RPC | 10 MiB |
315
+ | Images | PNG/JPEG; 4 per message; 3.5 MiB each; 7 MiB total; 40 million pixels; 2,000 px per side |
316
+
317
+ - Request bodies are consumed incrementally. Once a route limit is crossed, later chunks are drained without being retained and the route returns 413. File uploads also reject malformed UTF-8.
318
+ - File reads check VFS metadata, then collect the opened byte stream through the same 1 MiB cap. This closes the growth race between `stat()` and `readFile()` without retaining an unbounded value.
319
+ - Image admission fully decodes the declared raster format before writing.
320
+ - When combined shell output crosses its retention bound, the runtime requests interruption and stops accumulating later output. `cancelled` reflects an adapter-requested interruption; `timedOut` independently records deadline expiry.
321
+
322
+ ### Durability and concurrency
323
+
324
+ - Failed initial session persistence discards the retained unmaterialized batch before disposing the new upstream agent handle, so teardown cannot commit a session whose create request returned an error.
325
+ - A lazy blank session retains only its upstream header. The first canonical event removes that header in the same SQL transaction.
326
+ - Each turn owns one upstream handle and disposes it after streaming, so previously accessed conversations do not remain resident for the Durable Object lifetime.
327
+ - Deployment settings resolve before the process-local owner claim. One owner process rejects concurrent turns; cancellation uses the native agent path.
328
+ - A prompt is accepted and running state is published only after its inbox event crosses `SessionStore.flush()`. Streamed events cross the same durability barrier before WebSocket or SSE delivery.
329
+ - Queue edits, removals, and steering promotion use the synchronous live-inbox mutation as their acceptance point. `PersistenceCoordinator` owns later write-behind and retirement retries, so a later storage attempt cannot reverse an accepted mutation.
330
+ - Session rename uses the synchronous title append as its acceptance point for both active and cold sessions.
331
+ - Workspace global state and records keep upstream logical schemas under Edge-specific physical keys. DO transactions atomically pair record and registry-order changes; a process-local chain serializes Workspace mutations.
332
+ - Committed rename, delete, recreation, session reorder, attachment, and archive changes publish matching upstream Host frames. `workspace.list` restores the complete baseline after restart.
333
+ - Cold resume uses upstream interrupted-turn repair to close an open persisted tail. Canonical `session/end-seed` markers preserve lifecycle boundaries.
334
+
335
+ ### Bounded reads and canonical history
336
+
337
+ - Replay checks session absence separately, so persistence corruption and SQL failures do not collapse into 404. It reads one bounded SQL page and caps the encoded response.
338
+ - `PersistenceCoordinator.readValidatedPage()` validates identity, format, legacy shape, and event vocabulary on every page without adding Edge pagination to the public persistence service.
339
+ - If legacy normalization needs earlier messages, it rereads one prefix through the same byte-bounded loader and refuses the page when that prefix does not fit.
340
+ - Cold browser history selects its message boundary in SQL and loads only the resulting contiguous range under fixed event and stored-byte ceilings.
341
+ - Session listing queries one bounded canonical header/title summary page. Detail reads a canonical point summary or retained blank header; turn existence checks use point queries instead of projecting a complete log.
342
+ - Effective model, system prompt, adapter defaults, and tools remain standard `request/header` events. The request-scoped adapter applies validated deployment reasoning and output policies.
343
+ - Workspace paths must stay below `/workspace/`.
package/README.zh.md CHANGED
@@ -8,9 +8,29 @@
8
8
 
9
9
  仓库提交的 Wrangler 配置从同一套应用 graph 暴露两个部署目标。默认目标是面向 Workers Free 的 direct 模式,不包含 Worker Loader binding。命名的 `isolated` 目标会添加 `LOADER` binding,并且需要 Workers Paid,但不会 fork DSH protocol、storage、UI 或 tool implementation。
10
10
 
11
- 该运行时通过上游 Cordis 组合的 `ReactLoopAgent`、`AgentRegistry`、`LlmRuntime`、`ToolRuntime`、`SystemPrompt`、`SessionStore` 和 `SessionPersistence` 运行持久对话。Edge 代码只绑定请求作用域的 DeepSeek 适配器,并把一个原生 DSH `bash` 工具定义映射到 Cloudflare Computer。Durable Object SQLite 实现上游持久化后端约定,write-behind、revision、恢复准备和崩溃恢复仍由 `PersistenceCoordinator` 负责。模型历史从 canonical 事件投影,不再单独持久化。
11
+ 运行时保持清晰的上游责任边界:
12
12
 
13
- 浏览器直接使用上游 Web shell 和上游客户端插件包。构建期 assembler 根据上游 base 与 Web 组合包配置推导浏览器 roster,注入标准 `window.__DSH_BOOT__` graph,并把结果发布为 Cloudflare 静态资源。Durable Object 通过标准 HTTP carrier 实现受支持的上游 `ApiProxy` 方法,并以支持休眠的 WebSocket 提供两条上游 downlink。上游图片 composer、gallery、lightbox、attachment wire contract 与 DeepSeek serializer 保持原样复用;storage seam 会为新的永久部署选择私有 R2,为临时部署选择有界 Durable Object storage,并让 0.3 之前的 Worker 在升级时由 owner 做一次选择。Edge 会排除缺少对应 host domain 的客户端插件,而不会 fork 其 UI 代码;在服务端 endpoint 可用前,session log export 也属于排除项。一个很小的 Edge 登录外壳会保护上游 UI 与协议,不修改两者本身。可选的本地 host 插件仍不可用。
13
+ - `ReactLoopAgent`、`AgentRegistry`、`LlmRuntime`、`ToolRuntime`、`SystemPrompt`、`SessionStore` `SessionPersistence` 通过上游 Cordis 组合运行。
14
+ - Edge 绑定请求作用域的 DeepSeek 适配器,并把原生 DSH `bash` 工具映射到 Cloudflare Computer。
15
+ - Durable Object SQLite 实现上游持久化后端约定;write-behind、revision、恢复准备与崩溃恢复仍由 `PersistenceCoordinator` 负责。
16
+ - 模型历史从 canonical 事件投影,不在 Edge 中建立第二套 schema。
17
+
18
+ 浏览器也保持上游所有权:
19
+
20
+ - 构建期 assembler 从上游配置推导 Web roster,注入标准 `window.__DSH_BOOT__` graph,并输出 Cloudflare 静态资源。
21
+ - Durable Object 通过标准 HTTP carrier 实现受支持的上游 `ApiProxy` 方法,并以支持休眠的 WebSocket 提供两条 downlink。
22
+ - Image composer、gallery、lightbox、attachment wire contract 与 DeepSeek serializer 全部原样复用。
23
+ - Storage seam 为新的永久部署选择私有 R2,为临时部署选择有界 Durable Object storage,并让 0.3 之前的 Worker 在首次升级时由 owner 做一次选择。
24
+ - 缺少对应 host domain 的客户端插件会被排除,而不会 fork UI 代码。Session log export 与可选的本地 host 插件目前仍不可用。
25
+ - 一个小型 Edge 登录外壳在不修改上游 UI 和协议的前提下保护它们。
26
+
27
+ ## 快速导航
28
+
29
+ - [在 Cloudflare 上安装或升级](#安装到-cloudflare)
30
+ - [对比原生复用、已适配与未支持能力](#cloudflare-兼容矩阵)
31
+ - [配置 DeepSeek 凭据、模型、超时与 owner 认证](#api-key-边界)
32
+ - [在本地运行发布 runtime](#本地运行)
33
+ - [查阅路由、限制与持久化行为](#edge-api)
14
34
 
15
35
  ## 本地运行
16
36
 
@@ -70,15 +90,17 @@ curl -b /tmp/dsh-edge-cookie -N -X POST -H 'content-type: application/json' \
70
90
  http://localhost:8787/api/sessions/SESSION_ID/turn
71
91
  ```
72
92
 
73
- Session turn 直接把上游 `SessionEvent` 作为 SSE data 返回,包括 `agent/inbox/spliced`、`assistant/chunk`、`assistant/message`、`tool/call`、`tool/result` 及 turn/step 边界。Live stream 最多为客户端排队 1 MiB;读取更慢的客户端会断线,但 turn 及其持久化不会取消。`GET /api/sessions/SESSION_ID` 只返回有界的 session metadata;客户端通过 `GET /api/sessions/SESSION_ID/events?after=SEQ&limit=COUNT` 获取历史,该接口按上游 `seq` 重放一个有界 page。Replay 默认为 128 个 events,最多接受 256 个;它会先检查持久 payload 的字节数再加载 rows,并最多保留 1 MiB 编码后的 SSE。后续请求由 `x-dsh-edge-has-more` 与 `x-dsh-edge-next-after` 驱动。
74
-
75
- Session listing 同样有界:`GET /api/sessions?after=SESSION_ID&limit=COUNT` 默认返回 50 个 summaries,最多接受 100 个,并在 JSON body 中返回 `hasMore` 与 `nextAfter`。Durable Object 直接从 canonical rows 推导标题和最近时间,不会加载每个 session log。上游 Web session list 还会包含尚无 canonical event 的 retained blank header。
76
-
77
- 上游浏览器的 `session.history` RPC 会在 live/cold 路径分流前统一执行 Edge 准入预算:每次请求最多使用浏览器的 50 条消息 page size。Cold log 会先在 Durable Object SQL 中应用该边界,再解码 payload,并在 8,192 个事件和 8 MiB 存储 payload 的上限内校验选中的连续窗口。Live log 不会先复制完整内存 window,而是先定位同一边界,再执行相同的事件上限与 8 MiB 编码响应上限。超出预算的窗口会被拒绝,而不会被截断。模型目录、模型选择与 turn admission 的 session 存在性检查只读取 header point query;只有真正需要恢复 agent 的 turn 才会解码 canonical history。
93
+ 诊断型 session API 保留上游 event,同时为每次读取设置边界:
78
94
 
79
- 上游侧边栏的 `session.search` RPC 直接扫描 canonical current user/assistant message,不引入第二套 Edge 索引或 wire format。每个请求最多检查最近发生过人工活动的 32 个 session,并且只搜索事件数不超过 512 的完整 session log;cold log 还必须能放入 256 KiB 的 stored-payload 上限。响应沿用上游最多 20 条、带长度限制的 snippet;当结果上限或工作预算使答案无法穷尽时,`hasMore` 为 true。
95
+ - Turn 直接把上游 `SessionEvent` 作为 SSE 返回,包括 inbox splice、assistant chunk/message、tool call/result turn/step 边界。
96
+ - Live stream 每个客户端最多排队 1 MiB。读取过慢的客户端会断线,但不会取消 turn 或持久化。
97
+ - Session detail 返回有界 metadata。Event replay 默认 128 条、最多 256 条,会预检持久字节,最多保留 1 MiB 编码后的 SSE,并返回 continuation header。
98
+ - Session listing 默认 50 条、最多 100 条。Durable Object 从 canonical row 推导标题与时间,不加载每个 log;上游 Web 还会收到 retained blank header。
99
+ - Browser history 最多 50 条消息,并拒绝而非截断超过 8,192 个 event 或 8 MiB 的 window。Cold 路径在 SQL 应用边界;live 路径不复制完整内存 log 就定位边界。
100
+ - 侧边栏搜索直接使用 canonical current user/assistant message,不引入第二套索引或 wire format。它最多检查 32 个最近 session,要求完整 log 不超过 512 个 event,cold 时不超过 256 KiB,并最多返回 20 个 snippet;达到边界时返回 `hasMore`。
101
+ - 模型查找与选择只做 header point read。只有恢复 agent 的 turn 才解码 canonical history。
80
102
 
81
- 每个经过认证的请求都会使用该部署固定的 `owner` Durable Object。旧的 `x-dsh-edge-instance` 请求头与 `instance` 查询参数会被拒绝,不会被当作 identity。`/api/sessions/SESSION_ID/turn` 会延续已保存的 canonical history。
103
+ 每个已认证请求都使用该部署固定的 `owner` Durable Object。旧 `x-dsh-edge-instance` 请求头与 `instance` 查询参数会被拒绝,不会被当作 identity。`/api/sessions/SESSION_ID/turn` 会延续已保存的 canonical history。
82
104
 
83
105
  ## Cloudflare 兼容矩阵
84
106
 
@@ -131,23 +153,63 @@ Cloudflare static assets -> upstream Web shell + client plugin graph
131
153
  -> upstream Web runtime reconciles and renders the canonical events
132
154
  ```
133
155
 
134
- 本地集成检查使用 SSE stand-in 以及真实的 Wrangler、Durable Object SQLite、本地 R2、默认 direct Computer workspace backend、静态资源服务、HTTP carrier 和 WebSocket。Direct 模式会覆盖临时 DO attachment backend,Isolated 模式则覆盖私有 R2。它验证 owner 登录、API 与 WebSocket cookie enforcement、拒绝旧 instance selector、direct shell 网络被禁用、上游 session create/list/history/search/prompt/rename/fork;经上游 composer/协议/provider 路径完成图片 prompt;已授权附件读取、跨 session 拒绝、fork 复用,以及重启后的附件持久性;queue edit、remove 与提升为 steering;workspace create/list/rename/delete/session reorder/archive;对应的实时与重连 baseline 和 Host frame;真实浏览器启动及由 UI 发起的 workspace rename、图片 turn、内容搜索、branch 与 archive 操作;浏览器 session 过期后自动返回登录页;跨 turn 对话连续性、event 重放、两步 bash 与 Web Search tool 交互,以及 Wrangler 重启后的恢复。一项聚焦的故障测试证明,入队后的持久化失败会阻止模型调用,同时不会把已经唤醒 Agent 的 prompt 报告为拒绝。提交到仓库的 model-visible 与 ARIA golden 会固定 tool transcript 以及组装后的上游 Web client 通过 Edge HTTP/WebSocket 协议呈现的结果。真实 DeepSeek 调用需要开发者自己的 key,因此不会纳入仓库测试套件。
156
+ 本地集成套件使用 SSE stand-in,并运行真实 Wrangler、Durable Object SQLite、本地 R2、Direct Computer workspace backend、静态资源、HTTP carrier 和 WebSocket。Direct 模式覆盖 DO attachment storage,Isolated 模式覆盖私有 R2。它们共同验证:
157
+
158
+ - owner 登录、API/WebSocket cookie enforcement、旧 selector 拒绝和 Direct shell 禁止联网;
159
+ - 上游 session create/list/history/search/prompt/rename/fork 以及 queue edit/remove/steering 流程;
160
+ - 图片经上游 composer、协议、provider 完成准入,以及授权、fork 复用与重启持久性;
161
+ - Workspace create/list/rename/delete/reorder/archive、实时/重连 baseline 和 Host frame;
162
+ - 真实浏览器启动、UI 发起的 Workspace rename、图片 turn、内容搜索、branch、archive 和 session 过期后的登录恢复;
163
+ - 对话连续性、event 重放、两步 bash 与 Web Search tool 交互,以及 Wrangler 重启后恢复。
164
+
165
+ 一项聚焦故障测试证明,入队后的持久化失败会阻止模型调用,不会把已唤醒 Agent 的 prompt 报告为拒绝。仓库中的 model-visible 与 ARIA golden 会固定 tool transcript 和组装后的上游 Web client。真实 DeepSeek 调用需要开发者的 key,故不纳入仓库测试套件。
135
166
 
136
167
  ## API key 边界
137
168
 
138
- `.dev.vars` 中的 `DEEPSEEK_API_KEY` 是本地 credential source。只读 Edge provider 会通过上游 `ctx.credentials` service 为每次 chat 或 search 操作提供该 Worker secret,但不会将它写入 Durable Object storage、VFS、session event 或 response。Provider 会移除首尾空白,并把空白值视为未配置。`DEEPSEEK_BASE_URL` 控制 chat,必须是不含 URL userinfo 的 HTTP(S) URL;它的只读 browser 投影会省略可能携带 gateway credential 的 query 与 fragment。`DEEPSEEK_SEARCH_BASE_URL` 独立控制 DeepSeek native search 使用的 Anthropic-compatible Messages endpoint,默认为 `https://api.deepseek.com/anthropic/v1`,且必须是不含 userinfo、query 与 fragment 的 HTTP(S) URL。Edge 会挂载上游 `web_search` tool、它的 30 秒 tool-call timeout policy 与结构化 Web result presentation;由于 runtime 尚无 arbitrary-URL network policy,`web_fetch` 保持禁用。Search request 不会跟随 redirect。`DEEPSEEK_MODEL` 选择经过校验的部署默认模型,默认为 `deepseek-v4-flash`;每个 session 可以从上游 provider catalog 选择其他条目。`DEEPSEEK_REASONING_EFFORT` 接受 `off`、`low`、`high` 或 `max`,默认为 `off`。`DEEPSEEK_MAX_OUTPUT_TOKENS` 可以覆盖默认的 8,192-token chat 上限,且必须是正安全整数。`DEEPSEEK_STREAM_IDLE_TIMEOUT_MS` 可以覆盖默认的 120,000 ms chat 超时,且必须是小于等于 2,147,483,647 的正整数。部署配置无效时,会在查询 session 或打开 SSE response 前失败。
169
+ `.dev.vars` 中的 `DEEPSEEK_API_KEY` 是本地 credential source。只读 Edge provider 通过上游 `ctx.credentials` 为每次 chat 或 search 提供它,但不会把具体值写入 Durable Object storage、VFS、session event 或 response。首尾空白会被移除;空白值视为未配置。
170
+
171
+ | 变量 | 用途与校验 |
172
+ | --- | --- |
173
+ | `DEEPSEEK_BASE_URL` | Chat endpoint。必须是不含 URL userinfo 的 HTTP(S) URL。Browser 投影会省略可能携带 gateway credential 的 query 与 fragment。 |
174
+ | `DEEPSEEK_SEARCH_BASE_URL` | Native Web Search 的 Anthropic-compatible Messages endpoint。默认为 `https://api.deepseek.com/anthropic/v1`;必须是不含 userinfo、query 与 fragment 的 HTTP(S) URL。Search 不跟随 redirect。 |
175
+ | `DEEPSEEK_MODEL` | 已校验的部署默认模型;默认 `deepseek-v4-flash`。每个 session 可选择其他上游 catalog 条目。 |
176
+ | `DEEPSEEK_REASONING_EFFORT` | `off`、`low`、`high` 或 `max`;默认 `off`。 |
177
+ | `DEEPSEEK_MAX_OUTPUT_TOKENS` | 可选正安全整数,用于覆盖默认的 8,192-token chat 上限。 |
178
+ | `DEEPSEEK_STREAM_IDLE_TIMEOUT_MS` | 可选正整数,上限 2,147,483,647;默认 120,000 ms。 |
179
+ | `DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS` | Computer 命令默认 timeout;默认 120,000 ms。 |
180
+ | `DSH_EDGE_MAX_COMMAND_TIMEOUT_MS` | 调用方可选 timeout 上限;默认 120,000 ms,且不能低于默认 timeout。 |
139
181
 
140
- `DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS` 会应用到每个未指定调用方 timeout Computer 命令,`DSH_EDGE_MAX_COMMAND_TIMEOUT_MS` 则限制调用方选择的值。两者都默认为 120,000 ms,必须是小于等于 2,147,483,647 的正整数,且默认值不能超过最大值。
182
+ 部署配置无效时,会在查询 session 或创建 SSE response 前失败。Edge 挂载上游 `web_search`,使用 30 秒 tool-call timeout 和结构化 result。Runtime 尚无 arbitrary-URL network policy,因此 `web_fetch` 保持禁用。
141
183
 
142
- `DSH_EDGE_ACCESS_KEY` 是部署的单 owner 边界。它必须包含 32–512 个 UTF-8 字节,不得带首尾空白或控制字符;应生成随机值,而不是复用人工密码。Form 登录成功后会创建一个带签名、有效期 30 天的 HttpOnly `SameSite=Strict` cookie。HTTPS 部署使用仅限当前 host 的 `__Host-dsh_edge_owner` 名称并带 `Secure`;本地 HTTP 开发使用不带前缀的 cookie,因为浏览器会拒绝没有 HTTPS 的 `__Host-` cookie。Cookie 不包含用户数据,不会转发给 Durable Object,并会在 access key 轮换后失效。未认证的 API 与 WebSocket 请求返回 401。Owner authentication API failure 还会携带 `WWW-Authenticate: DshEdgeOwner`;只有这一精确的同 origin 401 才会让 Edge 组装的 shell 导航到 `/login`,因此 provider 或配置产生的 401 诊断仍然可见,而已过期的浏览器 session 仍能退出上游重连循环。来自不同 origin 的已认证浏览器 API 与 WebSocket 请求即使携带 same-site cookie 也会返回 403。Cloudflare asset policy 会阻止通过 `/`、`/index.html` 或 SPA fallback alias 到达的 shell 被嵌入 frame。`/` 重定向到 `/login`,`/api/health` 与 immutable asset 文件保持公开。它刻意不是 account system 或多租户边界。
184
+ ### Owner 认证
185
+
186
+ - `DSH_EDGE_ACCESS_KEY` 是 single-owner 边界。它必须包含 32–512 个 UTF-8 字节,不得带首尾空白或控制字符;应生成随机值,而不是复用人工密码。
187
+ - 登录会创建带签名、有效期 30 天的 HttpOnly `SameSite=Strict` cookie。HTTPS 使用仅限当前 host 的 `__Host-dsh_edge_owner` 名称并带 `Secure`;本地 HTTP 使用无前缀 cookie。
188
+ - Cookie 不包含用户数据,不会转发给 Durable Object,并在 access key 轮换后失效。
189
+ - 未认证的 API 与 WebSocket 请求返回 401。只有携带 `WWW-Authenticate: DshEdgeOwner` 的 owner-authentication 401 才会让同 origin shell 导航到 `/login`;provider/配置的 401 诊断仍然可见。
190
+ - 来自其他 origin 的已认证浏览器 API 与 WebSocket 请求,即使携带 same-site cookie 也会返回 403。
191
+ - Asset policy 会阻止通过 `/`、`/index.html` 或 SPA fallback 进行 frame 嵌入。`/` 重定向到 `/login`;`/api/health` 与 immutable asset 保持公开。
192
+
193
+ 这里刻意不是 account system 或多租户边界。
143
194
 
144
195
  ## 安装到 Cloudflare
145
196
 
146
- 仓库提交的 `wrangler.jsonc` 顶层是默认 direct 目标,不要求 Worker Loader。Direct shell 代码与 agent、VFS 运行在同一个 Durable Object isolate 内,因此 just-bash 的 hardened execution limits、明确 command timeout、有界输出、显式环境变量和禁用网络命令共同构成主要命令边界。这比独立 Worker 的隔离更轻;不要把这个单 owner 部署暴露给不受信任的用户。
197
+ | 目标 | Cloudflare 要求 | 命令边界 | Health identifier |
198
+ | --- | --- | --- | --- |
199
+ | Direct(默认顶层) | Workers Free;无 Loader binding | 在 agent/VFS Durable Object 中运行加固 just-bash,带明确 timeout、有界输出/环境,并禁止网络命令 | `just-bash-direct` |
200
+ | `env.isolated` | Workers Paid 与 `LOADER` | 在独立 Dynamic Worker 中运行 Computer Worker Shell | `just-bash-isolated` |
147
201
 
148
- 同一文件还定义了 `env.isolated`,这是包含 `LOADER` binding 的完整 Workers Paid 目标。应用代码会发现 `LOADER` 并选择 Computer 的 Worker Shell backend,因此 `/api/health` 会报告 `just-bash-isolated`,而不是 `just-bash-direct`。Workers Paid 是每月 5 美元起的 Workers 订阅,并非 Cloudflare Pro 网站套餐。不同 Worker 名称分别拥有独立的 Durable Object storage 与 secret;如果需要让两种模式同时在线,请使用不同名称分别安装。
202
+ Direct 模式比独立 Worker 的隔离更轻;不要把 single-owner 部署暴露给不受信任的用户。Workers Paid 是每月 5 美元起的 Workers 订阅,并非 Cloudflare Pro 网站套餐。Worker 名称拥有独立的 Durable Object storage 与 secret;两种模式同时在线时请使用不同名称。
149
203
 
150
- `wrangler.jsonc` 仍然是两种模式唯一的 canonical configuration。发布打包会从 workspace 源码为每种模式构建一个经过测试、已 minify 的 Worker artifact。Direct 模式只在构建时替换 Computer 中不可达的 Dynamic Worker shell-core module;Computer workspace adapter 与 command export 仍使用上游实现。Isolated 模式保留该 shell core,但把不可达的 Direct backend 替换成 fail-closed module,因此每个 artifact 都只携带所选 command runtime。发布的安装器会生成私有的 mode-specific configuration,指向所选 artifact,并要求 Wrangler 使用 `no_bundle` 上传;用户机器不会重新构建 dsh-edge,也不会把上游 Harness package 解析进一个新的 Worker。CI 会从已安装的 tarball 启动 Direct artifact,并拒绝压缩后超过 900 KiB 的产物,从而在 Cloudflare 匿名临时账户上传路径强制执行的 1 MiB 上限下保留余量。
204
+ `wrangler.jsonc` 仍是两种模式的 canonical source:
205
+
206
+ - 发布打包为每种模式构建一个经过测试、已 minify 的 artifact。
207
+ - Direct 只替换 Computer 中不可达的 Dynamic Worker shell-core module;Workspace adapter 与 command export 仍使用上游实现。
208
+ - Isolated 保留该 shell core,并把不可达的 Direct backend 替换成 fail-closed module。因此每个 artifact 只携带所选 command runtime。
209
+ - 安装器生成私有 mode-specific config,指向所选 artifact,并通过 `no_bundle` 上传。用户机器不会重新构建 dsh-edge,也不会把 Harness package 解析进新 Worker。
210
+ - CI 从已安装 tarball 启动 Direct artifact,并拒绝 gzip 后超过 900 KiB 的产物,为 Cloudflare 匿名临时账户的 1 MiB 上限保留余量。
211
+
212
+ ### 安装与升级
151
213
 
152
214
  无需克隆仓库,即可运行稳定版安装器:
153
215
 
@@ -155,7 +217,7 @@ Cloudflare static assets -> upstream Web shell + client plugin graph
155
217
  npx dsh-edge install
156
218
  ```
157
219
 
158
- 该命令通过 npm `latest` 渠道解析。使用 `npx dsh-edge@next install` 可以测试当前包含上游模型选择与图片 prompt 的 0.3 预发布版本。
220
+ 该命令通过 npm `latest` 渠道解析。只有在存在更新的预发布版且你想主动试用时,才使用 `npx dsh-edge@next install`。
159
221
 
160
222
  选择相同 runtime 并输入现有 Worker 名称即可升级。部署会保留 Durable Object 数据;由于 Cloudflare secret 只能写入而不能读取,升级会再次要求 owner access key 与 DeepSeek API key,并用输入值替换当前生效值:
161
223
 
@@ -165,13 +227,32 @@ npx dsh-edge install
165
227
  npx dsh-edge upgrade
166
228
  ```
167
229
 
168
- 如果当前安装的是 0.2 alpha,需要执行一次 `npx dsh-edge@latest upgrade` 晋级到稳定渠道;其他预发布部署仍跟随 `next`。Edge 设置页会根据已安装版本推导渠道,并复制匹配的命令。
169
-
170
- 安装器会先询问运行时,再询问账户。推荐的 `Free — Direct Shell` 模式可在 Workers Free 上运行,并可使用检测到的 Cloudflare 账户、打开 Cloudflare 登录或注册,也可在不登录的情况下创建临时账户。`Isolated — Dynamic Worker` 需要 Workers Paid,因此只提供已检测到或新认证的账户。Cloudflare 没有提供可靠的本地 Worker Loader entitlement 检查;isolated 安装会由 Cloudflare 对上传进行授权,并在被拒绝时提示启用 Workers Paid 或改用 direct 模式。对于新的永久账户安装,安装器会创建或复用私有 `<worker-name>-attachments` R2 bucket,并只把 binding 写入生成的私有 Wrangler 配置;部署失败时绝不会删除 bucket。R2 Standard 提供月度免费额度,但 Cloudflare 要求所选账户先在 Dashboard checkout 中启用独立的按量 R2 subscription。安装器会在收集 Worker secret 前检查 R2;Cloudflare 返回 `10042` 时,会提供当前账户专属的恢复选择:启用后重试、取消,或者把无 marker 的 pre-attachment Worker 安全切换到 DO storage。新的部署或已固定为 R2 的部署不能切换 backend,因为这会违背已确认的 storage 决策或导致引用失联。临时账户使用 64 MiB Durable Object attachment backend,并支持相同的上游图片 UI。认领会保留这个 backend 与已有图片历史;自动迁移到 R2 尚未实现。每个新部署都会记录明确的 attachment-storage marker。在更新已有 Worker 前,安装器会检查所有 active version,并保留 marker 或 binding 指定的 R2/DO 选择。图片功能出现前创建的 Worker 既没有 marker、也没有 attachment binding,不可能包含图片引用,因此首次升级到 0.3 时会询问一次:选择无需额外开通的 64 MiB DO storage,或选择私有 R2。此后固定所选 backend。若 active rollout 混用两种 backend,则会拒绝猜测并要求先完成 rollout。
171
-
172
- 后续提示会选择 Worker 名称、生成或接收 owner access key、通过隐藏输入收集 DeepSeek API key,并显示最终费用摘要。临时账户安装还会要求用户明确接受 Cloudflare 服务条款与隐私政策。安装器绝不会在未经确认时覆盖现有 Worker。两项 credential 会通过权限模式为 `0600` 的临时 secret 文件传给 Wrangler;Wrangler 子进程只会收到 allowlist 内的运行时环境变量和当前命令选中的 Cloudflare authentication,其他 ambient key、token、password、secret 与 Node 注入选项不会进入子进程。命令结束后临时 secret 文件会被删除,安装器从 Wrangler 结构化输出中取得最终 URL。默认情况下,部署输出会收敛到一个进度提示;在任一命令后添加 `--verbose` 可以查看 Wrangler 诊断。
173
-
174
- 上传被接受后,第二个进度提示会在不发送任一 credential 且不跟随重定向的前提下,最多观察公开 `/api/health` 路由 45 秒。它只接受当前 package 的精确版本和所选 runtime。匹配的 response 会产生 ready 卡片;Cloudflare propagation、challenge、占位页、传输错误与旧 release response 都保持 pending,观察到期仍以成功退出,并提示 owner 稍后刷新。该观察不会调用 DeepSeek,也不会访问 Durable Object 状态。最终卡片会输出 URL、owner access key 与明确的下一步;临时账户还会收到一个 bearer claim URL,必须在 60 分钟内认领才能保留 Worker 及其数据。上传被拒绝时,安装器会明确报告未安装;如果 Wrangler 已经创建临时账户,仍会输出其 claim URL,但不会把尚未生效的 owner key 显示为 active。如果上传成功,但输出解析、claim URL 提取、中断处理、激活观察中断或本地清理导致正常交接无法完成,命令仍会在按失败退出前通过恢复卡片输出已生效的 owner key 与当时已知的 URL。安装过程直接通过 Wrangler 上传,不会创建或绑定 GitHub 仓库、Cloudflare Builds 项目或源码构建流水线。
230
+ 如果当前安装版本包含 `-alpha` 或 `-rc`,请执行一次 `npx dsh-edge@latest upgrade` 切换到稳定渠道。Edge 设置页会根据已安装版本推导命令;如果不明确使用这条 `@latest` 命令,现有预发布部署会继续跟随 `next`。
231
+
232
+ ### 账户与 attachment storage
233
+
234
+ - 安装器会先询问 runtime,再询问账户。
235
+ - 推荐的 `Free — Direct Shell` 可在 Workers Free 上运行,支持已检测账户、新登录/注册,以及无需登录的临时账户。
236
+ - `Isolated Dynamic Worker` 需要 Workers Paid,只提供已检测或新认证账户。Cloudflare 会对 Loader 上传进行授权;被拒绝后可选择启用 Workers Paid 或改用 Direct 模式。
237
+ - 新的永久安装会创建或复用私有 `<worker-name>-attachments` R2 bucket,并只把 binding 写入生成的私有 Wrangler 配置。部署失败绝不删除 bucket。
238
+ - R2 Standard 提供月度免费额度,但账户必须先启用其独立的按量 subscription。安装器会在收集 Worker secret 前检查 R2。
239
+ - Cloudflare 错误 `10042` 会提供账户专属的启用、重试与取消选项。只有无 marker 的 pre-attachment Worker 可安全切换到 DO storage;新部署或已固定 R2 的部署不能切换并导致引用失联。
240
+ - 临时账户使用相同图片 UI 和 64 MiB DO backend。认领会保留 backend 与历史;自动迁移到 R2 尚未实现。
241
+ - 每个新部署都会记录 attachment-storage marker。升级时会检查每个 active version,并保留 marker 或 binding 指定的 backend。
242
+ - 图片功能之前的 Worker 没有 marker、binding 或图片引用,因此首次升级到 0.3 时会在 64 MiB DO storage 与私有 R2 之间选择一次,随后固定。Active rollout 混用 backend 时会拒绝猜测。
243
+
244
+ ### Credential 交接与激活
245
+
246
+ - 后续 prompt 会选择 Worker 名称、生成或接收 owner access key、通过隐藏输入收集 DeepSeek key,并显示最终费用摘要。临时安装还要求明确接受 Cloudflare 条款与隐私政策。
247
+ - 现有 Worker 绝不会在未经确认时被覆盖。
248
+ - 两项 credential 通过权限模式为 `0600` 的临时 secret 文件传递。Wrangler 只收到 allowlist 内的 runtime 环境与当前选中的 Cloudflare authentication;其他 ambient secret 与 Node 注入选项不会进入子进程。
249
+ - 命令后会删除 secret 文件。部署 URL 来自 Wrangler 的结构化输出。添加 `--verbose` 可查看完整部署诊断。
250
+ - 上传后,安装器会在不携带 credential、不跟随重定向的前提下,最多观察公开 `/api/health` 45 秒。只有精确 package 版本与所选 runtime 会产生 ready 卡片;propagation、challenge、占位页、传输错误与旧 release response 均保持 pending。
251
+ - 观察到期仍以成功退出,并请 owner 稍后刷新。该观察不调用 DeepSeek,也不触碰 Durable Object 状态。
252
+ - 最终卡片输出 URL、已生效 owner key 与下一步。临时账户还会收到必须在 60 分钟内认领的 bearer claim URL。
253
+ - 上传被拒绝时会明确报告未安装。Wrangler 如果已创建临时账户,仍显示其 claim URL,但不把未使用的 owner key 显示为 active。
254
+ - 上传成功但交接失败时,恢复卡片会在命令按失败退出前输出已生效 owner key 与所有已知 URL。
255
+ - 安装直接通过 Wrangler 上传;不会创建或绑定 GitHub 仓库、Cloudflare Builds 项目或源码构建流水线。
175
256
 
176
257
  从 checkout 开发的贡献者可以用 `pnpm --filter dsh-edge bundle:direct` 和 `pnpm --filter dsh-edge bundle:isolated` 在本地复现两种 release artifact。第一条命令还会执行压缩体积预算检查。
177
258
 
@@ -183,11 +264,27 @@ pnpm --filter dsh-edge example:install
183
264
 
184
265
  ## Edge API
185
266
 
186
- - `POST /api/<upstream-method>` 接受受支持 `ApiProxy` 方法的上游 `ClientRequest` envelope。Web client 当前使用 session list/search/create/history/models/select/prompt/updateQueue/rename/fork/cancel、host description、workspace list/create/rename/delete/reorder/archive、skills、agent presets、settings 与 credential description,以及 LLM catalog。`agentPreset.read` 会通过上游只读 viewer 渲染程序化 Edge composition,`credentials.describe` 则返回不含 value 的 credential state。Search 会投影 canonical current-message surface,并且只返回有界的上游 result value。Fork 会通过 canonical session seed format 复制 completed-turn prefix,并保留 parent lineage;超过 8,192 个事件或 8 MiB 的 seed 会被 Edge 拒绝,而不会在 Durable Object 中物化无界 history。Queue mutation 通过 live upstream Agent inbox 编辑、移除或把一项提升为 steering;同步 inbox mutation 是上游接纳点,后续 write-behind 与 retirement retry 由 persistence coordinator 负责。Workspace mutation 通过 Durable Object backend 持久化上游 workspace-domain global 与 record shape。Archive 保留 session log 与 workspace slot;unary response 与 Host frame 携带和上游一致的完整 snapshot。
187
- - `GET /login` 渲染 Edge 持有的 owner form;`POST /api/auth/login` 用已配置的 access key 换取 signed cookie,`GET /api/auth/session` 报告 cookie 是否有效,`POST /api/auth/logout` 清除 cookie。
188
- - `GET /api/events.mux` `GET /api/events.host` 会升级为上游 downlink WebSocket。Durable Object 会把每个 socket 的 channel 与已验证 owner session 过期时间序列化为 hibernation attachment,通过 alarm 在该时间关闭连接,并从 Durable Object SQL 重建 canonical session 与 retained blank header。每次 inbox splice 提交后,mux stream 都会发布完整的 `session/queue` snapshot;客户端重连时还会发送 live inbox 的待处理 baseline
267
+ ### 上游 RPC carrier
268
+
269
+ - `POST /api/<upstream-method>` 接受受支持 `ApiProxy` 方法的上游 `ClientRequest` envelope
270
+ - Web client 使用 session list/search/create/history/models/select/prompt/updateQueue/rename/fork/cancel;host description;Workspace list/create/rename/delete/reorder/archive;skills;agent presets;settings 与 credential description;以及 LLM catalog。
271
+ - `agentPreset.read` 通过上游只读 viewer 渲染程序化 Edge composition。`credentials.describe` 返回不含 value 的 credential state。
272
+ - Search 投影 canonical current-message surface,并返回有界的上游 result value。
273
+ - Fork 通过 canonical session seed format 复制 completed-turn prefix,并保留 parent lineage。Edge 拒绝超过 8,192 个事件或 8 MiB 的 seed,不会物化无界 history。
274
+ - Queue mutation 通过 live upstream Agent inbox 编辑、移除或提升条目。同步 mutation 是接纳点;后续 write-behind 与 retirement retry 由 persistence coordinator 负责。
275
+ - Workspace mutation 通过 Durable Object backend 持久化上游 workspace-domain global 与 record shape。Archive 保留 session log 与 Workspace slot;unary response 与 Host frame 携带和上游一致的完整 snapshot。
276
+
277
+ ### 认证与 downlink
278
+
279
+ - `GET /login` 渲染 owner form。`POST /api/auth/login` 用已配置 key 换取 signed cookie;`GET /api/auth/session` 报告有效性;`POST /api/auth/logout` 清除 cookie。
280
+ - `GET /api/events.mux` 和 `GET /api/events.host` 升级为上游 downlink WebSocket。Durable Object 会把每个 socket 的 channel 与已验证 owner-session 过期时间序列化为 hibernation attachment,通过 alarm 在过期时关闭,并从 SQL 重建 canonical session 与 retained blank header。
281
+ - 每次 inbox splice 提交后,mux 都发布完整的 `session/queue` snapshot。客户端重连时会收到待处理的 live-inbox baseline。
189
282
  - `POST /api/commands/list` 使用上游 generated-Remote envelope 返回空 catalog,因为 Edge preset 没有注册 human command。
190
- - `GET /api/health` 会返回公开的 package-and-mode release identifier 与配置的附件默认值(`private-r2` 或 `temporary-do`),并先验证 owner authentication、部署级 DeepSeek 凭据、模型与传输配置,以及命令超时策略,再报告运行时组件已就绪。它不会调用提供方、Durable Object、R2、VFS 或 shell。认证后的 agent-preset projection 会报告 owner Durable Object 实际固定的 backend、临时存储上限、部署默认模型,以及 runtime 实际读取的上游 model catalog 与 session 选择范围。
283
+ - `GET /api/health` 返回公开 release/mode identifier 与配置的 attachment 默认值(`private-r2` 或 `temporary-do`)。它先验证 owner authentication、部署级 DeepSeek 凭据、模型/传输选择与命令 timeout,再报告 ready。
284
+ - Health 不调用 provider、Durable Object、R2、VFS 或 shell。认证后的 agent-preset projection 会报告固定 backend、临时存储上限、部署默认模型,以及 runtime 实际读取的上游 catalog 与 session 选择范围。
285
+
286
+ ### 诊断 REST 路由
287
+
191
288
  - `PUT /api/workspace/file?path=/workspace/...` 写入 UTF-8 文件。
192
289
  - `GET /api/workspace/file?path=/workspace/...` 读取 UTF-8 文件。
193
290
  - `DELETE /api/workspace/file?path=/workspace/...` 删除文件。
@@ -198,6 +295,49 @@ pnpm --filter dsh-edge example:install
198
295
  - `GET /api/sessions/:sessionId/events?after=...&limit=...` 重放一个有界 event page,并返回 continuation headers。
199
296
  - `POST /api/sessions/:sessionId/cancel` 终止当前 Durable Object 进程持有的 active turn。
200
297
 
201
- 上游 Session 创建与 fork 在发布成功但 Workspace attachment 失败时返回 `workspace-attach-failed`,并携带已发布的 session 与 Workspace id;诊断创建路由会返回相同 code 及完整的已创建 session。Prompt 和 queue-edit 文本共用 64 KiB 语义上限。其 RPC 载体最多接受 10 MiB,从而让 7 MiB 原始图片批次在 base64 与 envelope 膨胀后仍可装入。Edge 组合没有目录流 provider,因此上游浏览器会在仅剩一个 Workspace 时隐藏 Delete,并在仍有恢复路径时重新显示。
202
-
203
- API 将文本文件限制为 1 MiB、命令限制为 16 KiB、用户消息限制为 64 KiB,并将保留的 shell stdout 与 stderr 总量限制为 64 KiB;这些均为 UTF-8 字节限制。两种 attachment backend 都只接受 PNG 与 JPEG:每条消息最多 4 张、每张最多 3.5 MiB、合计最多 7 MiB、最多 4,000 万像素,且单边不超过 2,000 像素;写入前会完整解码声明的 raster 格式。Request body 会在解析或转发前增量消费:创建 session 的 JSON 上限为 8 KiB、workspace execution 为 128 KiB、承载消息的 turn 或 queue-update RPC 为 10 MiB,文件上传也会在消费过程中执行其 1 MiB 上限,并拒绝非法 UTF-8。Body 一旦越过路由上限,后续 chunk 只会排空而不会继续保留,路由最终返回 413。读取文件时会先检查 VFS metadata,再通过相同的 1 MiB 上限收集实际打开的原始 byte stream,从而关闭 `stat()` `readFile()` 之间的增长竞态,且不会保留无界值。组合输出越界时,runtime 会请求中断 shell execution,并停止累积后续输出。只有 adapter 实际请求过中断时,命令状态才会报告 cancellation;这一状态与 shell exit code 独立,`timedOut` 则单独记录 deadline expiry。首次 session 持久化失败时,会先丢弃保留但尚未物化的 batch,再 dispose 新发布的上游 agent handle,因此 teardown 无法在创建请求返回错误后又提交该 sessionLazy blank session 在首个 canonical event 前只保留其上游 header;物化该 event 的同一个 SQL transaction 会删除 retained header。每个 turn 持有一个上游 handle,并在 stream 完成后 dispose,避免曾访问的对话在 Durable Object 整个生命周期内常驻内存。部署 settings 会在声明进程内 owner 前解析。上游 protocol prompt 只有在其 inbox event 跨过 `SessionStore.flush()` 后才返回 accepted 并发布 running state;后续 streamed event 也会先跨过同一个 barrier,再通过 WebSocket 或 SSE 发送。Queue edit、remove 与 steering promotion 以同步 live-inbox mutation 作为接纳点;后续 write-behind 或 retirement retry 由 `PersistenceCoordinator` 负责,因此后续存储尝试不能把已接纳的 mutation 变成被拒绝的响应。Session rename 遵循相同的上游 metadata contract:对于 active 与 cold session,同步追加 title 即为接纳点。Workspace global state 与 record 在 Edge-specific physical key 下使用上游逻辑 schema;DO transaction 原子组合 record 与 registry order 变更,进程内 chain 则串行化 workspace mutation。已提交的 rename、delete、recreate、session reorder、attachment 和 archive 变更会发布对应的上游 Host frame,`workspace.list` 会在重启后恢复完整 baseline。进程内 owner 会拒绝并发 turn,cancel 调用原生 agent cancellation path。下次冷恢复时,上游 interrupted-turn repair 会关闭开放的持久 event tail,canonical `session/end-seed` marker 会保留生命周期边界。Replay 会独立确认 session 是否不存在,因此 persistence corruption 或 SQL failure 不会被折叠成 404;它只读取一个有界 SQL page,而不是完整 suffix,并限制编码后的 response。`PersistenceCoordinator.readValidatedPage()` 会对每个 page 执行 identity、format、legacy-shape 和 event-vocabulary 校验,而不把 Edge pagination 加入公共 persistence service。如果 legacy normalization 需要更早的 message,它只会通过同一个受字节约束的 loader 重读一个 prefix;必要 prefix 无法装入预算时会拒绝该 page。冷浏览器 history 会在 SQL 中选择消息边界,并仅在固定事件数与存储字节上限内加载所得连续区间。Session listing 查询一个有界的 canonical header/title summary page;detail 读取持久化的 canonical point summary 或 retained blank header,turn existence check 则使用 point query,不会列出全部 headers 或投影完整 log。实际 model、system prompt、adapter defaults 和 tools 写入标准 `request/header` 事件。Request-scoped adapter 使用已校验的部署级 reasoning 与输出策略。workspace 路径必须位于 `/workspace/` 下。
298
+ ### Session 与 Workspace 行为
299
+
300
+ - Session 创建与 fork 在发布成功但 Workspace attachment 失败时返回 `workspace-attach-failed`,并携带已发布的 sessionWorkspace id。诊断路由返回相同 code 及完整的已创建 session。
301
+ - Prompt 和 queue-edit 文本共用 64 KiB 语义上限。10 MiB RPC 载体为 7 MiB 原始图片在 base64 与 envelope 膨胀后留出空间。
302
+ - Edge 没有目录流 provider,因此上游浏览器会在仅剩一个 Workspace 时隐藏 Delete,并在仍有恢复路径时重新显示。
303
+
304
+ ### 限制与请求准入
305
+
306
+ | 表面 | 上限 |
307
+ | --- | --- |
308
+ | UTF-8 文本文件 | 1 MiB |
309
+ | Shell 命令 | 16 KiB |
310
+ | 用户消息或 queue-edit 文本 | 64 KiB |
311
+ | 保留的 shell stdout + stderr | 64 KiB |
312
+ | Session-create JSON body | 8 KiB |
313
+ | Workspace-exec JSON body | 128 KiB |
314
+ | 承载消息的 turn 或 queue-update RPC | 10 MiB |
315
+ | 图片 | PNG/JPEG;每条消息 4 张;每张 3.5 MiB;合计 7 MiB;4,000 万像素;单边 2,000 px |
316
+
317
+ - Request body 会增量消费。一旦越过路由上限,后续 chunk 只会排空而不会保留,路由返回 413。文件上传也会拒绝非法 UTF-8。
318
+ - 读取文件时先检查 VFS metadata,再通过相同的 1 MiB 上限收集已打开的 byte stream,从而关闭 `stat()` 与 `readFile()` 之间的增长竞态,且不保留无界值。
319
+ - 写入前,图片准入会完整解码声明的 raster 格式。
320
+ - 组合 shell 输出越界时,runtime 会请求中断并停止累积后续输出。`cancelled` 反映 adapter 请求的中断;`timedOut` 独立记录 deadline expiry。
321
+
322
+ ### 持久性与并发
323
+
324
+ - 首次 session 持久化失败时,会先丢弃保留但尚未物化的 batch,再 dispose 新上游 agent handle,因此 teardown 无法提交一个创建请求已经报错的 session。
325
+ - Lazy blank session 只保留上游 header;首个 canonical event 会在同一 SQL transaction 中删除该 header。
326
+ - 每个 turn 持有一个上游 handle,并在 stream 完成后 dispose,避免曾访问的对话在 Durable Object 整个生命周期内常驻。
327
+ - 部署 settings 会在声明进程内 owner 前解析。一个 owner 进程会拒绝并发 turn;cancel 使用原生 agent path。
328
+ - Prompt 只有在 inbox event 跨过 `SessionStore.flush()` 后才会被接纳并发布 running state。Streamed event 也会先跨过同一 durability barrier,再通过 WebSocket 或 SSE 发送。
329
+ - Queue edit、remove 与 steering promotion 以同步 live-inbox mutation 作为接纳点。后续 write-behind 与 retirement retry 由 `PersistenceCoordinator` 负责,后来的存储尝试不能反转已接纳的 mutation。
330
+ - Session rename 对 active 与 cold session 都以同步 title append 作为接纳点。
331
+ - Workspace global state 与 record 在 Edge-specific physical key 下保留上游逻辑 schema。DO transaction 原子组合 record 与 registry-order 变更;进程内 chain 串行化 Workspace mutation。
332
+ - 已提交的 rename、delete、recreate、session reorder、attachment 和 archive 变更会发布对应上游 Host frame。`workspace.list` 会在重启后恢复完整 baseline。
333
+ - 冷恢复使用上游 interrupted-turn repair 关闭开放的持久 event tail;canonical `session/end-seed` marker 保留生命周期边界。
334
+
335
+ ### 有界读取与 canonical history
336
+
337
+ - Replay 会独立确认 session 是否不存在,因此 persistence corruption 与 SQL failure 不会折叠成 404。它只读取一个有界 SQL page,并限制编码后的 response。
338
+ - `PersistenceCoordinator.readValidatedPage()` 对每个 page 执行 identity、format、legacy shape 和 event vocabulary 校验,不把 Edge pagination 加入公共 persistence service。
339
+ - Legacy normalization 如果需要更早的 message,只会通过同一受字节约束的 loader 重读一个 prefix;必要 prefix 无法装入预算时会拒绝该 page。
340
+ - 冷浏览器 history 在 SQL 中选择消息边界,并仅在固定事件数与存储字节上限内加载所得连续区间。
341
+ - Session listing 查询一个有界 canonical header/title summary page。Detail 读取 canonical point summary 或 retained blank header;turn existence check 使用 point query,不投影完整 log。
342
+ - 实际 model、system prompt、adapter defaults 和 tools 仍使用标准 `request/header` 事件。Request-scoped adapter 应用已校验的部署级 reasoning 与输出策略。
343
+ - Workspace 路径必须位于 `/workspace/` 下。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edge",
3
- "version": "0.3.0-alpha.2",
3
+ "version": "0.3.0",
4
4
  "description": "Run DeepSeek Harness on Cloudflare Workers as an independent community project",
5
5
  "author": "pawaca",
6
6
  "license": "MIT",
@@ -707,7 +707,7 @@ ${n}`:""}`}});function SN(e){if(e.url.trim().length===0)throw new Error("url mus
707
707
  button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
708
708
  .secondary { background: #29314b; color: #edf2ff; }
709
709
  .error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
710
- `}l(SR,"pageStyles");var fk={name:"dsh-edge",version:"0.3.0-alpha.2",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.1-rc.1"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.1-rc.1","@deepseek-ai/dsh-agent-loop":"0.1.1-rc.1","@deepseek-ai/dsh-anonymous-user-id":"0.1.1-rc.1","@deepseek-ai/dsh-attachment":"0.1.1-rc.1","@deepseek-ai/dsh-brand":"0.1.1-rc.1","@deepseek-ai/dsh-credentials":"0.1.1-rc.1","@deepseek-ai/dsh-host-apiproxy":"0.1.1-rc.1","@deepseek-ai/dsh-launch-environment":"0.1.1-rc.1","@deepseek-ai/dsh-llm":"0.1.1-rc.1","@deepseek-ai/dsh-llm-deepseek":"0.1.1-rc.1","@deepseek-ai/dsh-session":"0.1.1-rc.1","@deepseek-ai/dsh-session-persistence":"0.1.1-rc.1","@deepseek-ai/dsh-session-query":"0.1.1-rc.1","@deepseek-ai/dsh-session-title":"0.1.1-rc.1","@deepseek-ai/dsh-settings":"0.1.1-rc.1","@deepseek-ai/dsh-system-prompt":"0.1.1-rc.1","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.1-rc.1","@deepseek-ai/dsh-tool-web":"0.1.1-rc.1","@deepseek-ai/dsh-tools":"0.1.1-rc.1","@deepseek-ai/dsh-web":"0.1.1-rc.1","@deepseek-ai/dsh-web-search-deepseek":"0.1.1-rc.1","just-bash":"3.3.0","fast-png":"8.0.0","jpeg-js":"0.4.4",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var Pg=fk.version,kR=fk.dshEdge.upstreamVersion;function Fce(){return"dsh-edge@0.3.0-alpha.2/direct"}l(Fce,"resolveEdgeDeploymentId");function Dg(e){return lR(e.DEEPSEEK_API_KEY),{baseURL:t6(e.DEEPSEEK_BASE_URL),maxTokens:i6(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Ud(e.DEEPSEEK_MODEL),reasoningEffort:r6(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:wg(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:n6(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Qd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Dg,"resolveEdgeDeploymentConfig");function Uce(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(Uce,"edgeDeploymentApiKeyConfigured");function jce(e){let t=t6(e),r=new URL(t);return r.search.length===0&&r.hash.length===0?t:(r.search="",r.hash="",r.href)}l(jce,"projectedEdgeBaseURL");function pk(e,t){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:Fce(),apiKeyConfigured:Uce(e),baseURL:jce(e.DEEPSEEK_BASE_URL),maxTokens:i6(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Ud(e.DEEPSEEK_MODEL),reasoningEffort:r6(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:wg(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:n6(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Qd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(pk,"resolveEdgeDeploymentProfile");function AR(e){Dg(e);let t=pk(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:Pg,upstreamVersion:kR,status:"ready"}}l(AR,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as JDe}from"cloudflare:workers";var El=ly(IR());var hk=l((e,t,r)=>{let n=e instanceof RegExp?$R(e,r):e,i=t instanceof RegExp?$R(t,r):t,s=n!==null&&i!=null&&zce(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},"balanced"),$R=l((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),zce=l((e,t,r)=>{let n,i,s,o,a,c=r.indexOf(e),u=r.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(n=[],s=r.length;d>=0&&!a;){if(d===c)n.push(d),c=r.indexOf(e,d+1);else if(n.length===1){let f=n.pop();f!==void 0&&(a=[f,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=r.indexOf(t,d+1);d=c<u&&c>=0?c:u}n.length&&o!==void 0&&(a=[s,o])}return a},"range");var _R="\0SLASH"+Math.random()+"\0",TR="\0OPEN"+Math.random()+"\0",yk="\0CLOSE"+Math.random()+"\0",CR="\0COMMA"+Math.random()+"\0",OR="\0PERIOD"+Math.random()+"\0",Bce=new RegExp(_R,"g"),Wce=new RegExp(TR,"g"),qce=new RegExp(yk,"g"),Hce=new RegExp(CR,"g"),Gce=new RegExp(OR,"g"),Vce=/\\\\/g,Zce=/\\{/g,Kce=/\\}/g,Yce=/\\,/g,Xce=/\\\./g,Jce=1e5,Qce=4e6;function mk(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(mk,"numeric");function eue(e){return e.replace(Vce,_R).replace(Zce,TR).replace(Kce,yk).replace(Yce,CR).replace(Xce,OR)}l(eue,"escapeBraces");function tue(e){return e.replace(Bce,"\\").replace(Wce,"{").replace(qce,"}").replace(Hce,",").replace(Gce,".")}l(tue,"unescapeBraces");function NR(e){if(!e)return[""];let t=[],r=hk("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=NR(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}l(NR,"parseCommaParts");function RR(e,t={}){if(!e)return[];let{max:r=Jce,maxLength:n=Qce}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),gk(eue(e),r,n,!0).map(tue)}l(RR,"expand");function rue(e){return"{"+e+"}"}l(rue,"embrace");function nue(e){return/^-?0\d/.test(e)}l(nue,"isPadded");function iue(e,t){return e<=t}l(iue,"lte");function sue(e,t){return e>=t}l(sue,"gte");function nf(e,t,r,n,i,s){let o=[],a=0;for(let c=0;c<e.length;c++)for(let u=0;u<r.length;u++){if(o.length>=n)return o;let d=e[c]+t+r[u];if(!(s&&!d)){if(a+d.length>i)return o;o.push(d),a+=d.length}}return o}l(nf,"combine");function oue(e,t,r,n){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=mk(i[0]),a=mk(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(mk(i[2])),1):1,d=iue;a<o&&(u*=-1,d=sue);let p=i.some(nue),h=0;for(let m=o;d(m,a)&&s.length<r;m+=u){let g;if(t)g=String.fromCharCode(m),g==="\\"&&(g="");else if(g=String(m),p){let y=c-g.length;if(y>0){let x=new Array(y+1).join("0");m<0?g="-"+x+g.slice(1):g=x+g}}if(h+g.length>n)break;s.push(g),h+=g.length}return s}l(oue,"expandSequence");function gk(e,t,r,n){let i=[""],s=!1,o=!0;for(;;){let a=hk("{","}",e);if(!a)return nf(i,e,[""],t,r,s);let c=a.pre;if(/\$$/.test(c)){if(i=nf(i,c+"{"+a.body+"}",[""],t,r,s&&!a.post.length),o=!1,!a.post.length)break;e=a.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),f=u||d,p=a.body.indexOf(",")>=0;if(!f&&!p){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+yk+a.post,n=!0;continue}return nf(i,c+"{"+a.body+"}"+a.post,[""],t,r,s)}o&&(s=n&&!f,o=!1);let h;if(f)h=oue(a.body,d,t,r);else{let m=NR(a.body);if(m.length===1&&m[0]!==void 0&&(m=gk(m[0],t,r,!1).map(rue),m.length===1)){if(i=nf(i,c+m[0],[""],t,r,s&&!a.post.length),!a.post.length)break;e=a.post;continue}let g=s&&!a.post.length&&!c;for(let x=0;g&&x<i.length;x++)i[x]&&(g=!1);h=[];let y=0;e:for(let x=0;x<m.length;x++){let w=gk(m[x],t,r,!1);for(let b=0;b<w.length;b++){let k=w[b];if(!(g&&!k)){if(h.length>=t||y+k.length>r)break e;h.push(k),y+=k.length}}}}if(i=nf(i,c,h,t,r,s&&!a.post.length),!a.post.length)break;e=a.post}return i}l(gk,"expand_");var sf=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var aue={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},of=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),lue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),PR=l(e=>e.join(""),"rangesToString"),DR=l((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,u=!1,d=r,f="";e:for(;s<e.length;){let g=e.charAt(s);if((g==="!"||g==="^")&&s===r+1){u=!0,s++;continue}if(g==="]"&&o&&!c){d=s+1;break}if(o=!0,g==="\\"&&!c){c=!0,s++;continue}if(g==="["&&!c){for(let[y,[x,w,b]]of Object.entries(aue))if(e.startsWith(y,s)){if(f)return["$.",!1,e.length-r,!0];s+=y.length,b?i.push(x):n.push(x),a=a||w;continue e}}if(c=!1,f){g>f?n.push(of(f)+"-"+of(g)):g===f&&n.push(of(g)),f="",s++;continue}if(e.startsWith("-]",s+1)){n.push(of(g+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=g,s+=2;continue}n.push(of(g)),s++}if(d<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let g=n[0].length===2?n[0].slice(-1):n[0];return[lue(g),!1,d-r,!1]}let p="["+(u?"^":"")+PR(n)+"]",h="["+(u?"":"^")+PR(i)+"]";return[n.length&&i.length?"("+p+"|"+h+")":n.length?p:h,a,d-r,!0]},"parseClass");var Ko=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Wn,cue=new Set(["!","?","+","*","@"]),vk=l(e=>cue.has(e),"isExtglobType"),LR=l(e=>vk(e.type),"isExtglobAST"),uue=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),due=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fue=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),MR=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),pue="(?!(?:^|/)\\.\\.?(?:$|/))",Mg="(?!\\.)",hue=new Set(["[","."]),mue=new Set(["..","."]),gue=new Set("().*{}+?[]^$\\!"),yue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),wk="[^/]",FR=wk+"*?",UR=wk+"+?",vue=0,Ha=class{static{l(this,"AST")}type;#e;#r;#n=!1;#t=[];#i;#s;#a;#u=!1;#l;#o;#c=!1;id=++vue;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?n:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#u&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let i=r.#s+1;!n.type&&i<n.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof Wn&&r.#i===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let t=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let r=0;r<this.#s;r++){let n=t.#t[r];if(!(n instanceof Wn&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new Wn(this.type,t);for(let n of this.#t)r.copyIn(n);return r}static#h(t,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,u=-1,d=!1;if(r.type===null){let g=n,y="";for(;g<t.length;){let x=t.charAt(g++);if(a||x==="\\"){a=!a,y+=x;continue}if(c){g===u+1?(x==="^"||x==="!")&&(d=!0):x==="]"&&!(g===u+2&&d)&&(c=!1),y+=x;continue}else if(x==="["){c=!0,u=g,d=!1,y+=x;continue}if(!i.noext&&vk(x)&&t.charAt(g)==="("&&s<=o){r.push(y),y="";let b=new Wn(x,r);g=Wn.#h(t,b,g,i,s+1),r.push(b);continue}y+=x}return r.push(y),g}let f=n+1,p=new Wn(null,r),h=[],m="";for(;f<t.length;){let g=t.charAt(f++);if(a||g==="\\"){a=!a,m+=g;continue}if(c){f===u+1?(g==="^"||g==="!")&&(d=!0):g==="]"&&!(f===u+2&&d)&&(c=!1),m+=g;continue}else if(g==="["){c=!0,u=f,d=!1,m+=g;continue}if(!i.noext&&vk(g)&&t.charAt(f)==="("&&(s<=o||r&&r.#g(g))){let x=r&&r.#g(g)?0:1;p.push(m),m="";let w=new Wn(g,p);p.push(w),f=Wn.#h(t,w,f,i,s+x);continue}if(g==="|"){p.push(m),m="",h.push(p),p=new Wn(null,r);continue}if(g===")")return m===""&&r.#t.length===0&&(r.#c=!0),p.push(m),m="",r.push(...h,p),f;m+=g}return r.type=null,r.#r=void 0,r.#t=[t.substring(n-1)],f}#C(t){return this.#m(t,due)}#m(t,r=uue){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(t,r=fue){return!!r.get(this.type)?.includes(t)}#f(t,r){let n=t.#t[0],i=new Wn(null,n,this.options);i.#t.push(""),n.push(i),this.#E(t,r)}#E(t,r){let n=t.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#S(t){return!!MR.get(this.type)?.has(t)}#O(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#S(r.type)}#y(t){let r=MR.get(this.type),n=t.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,r={}){let n=new Wn(null,void 0,r);return Wn.#h(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#l}toRegExpSource(t){let r=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!LR(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[m,g,y,x]=typeof h=="string"?Wn.#k(h,this.#r,c):h.toRegExpSource(t);return this.#r=this.#r||y,this.#n=this.#n||x,m}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mue.has(this.#t[0]))){let m=hue,g=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),y=!r&&!t&&m.has(u.charAt(0));d=g?pue:y?Mg:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,Ko(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#r=void 0,[c,Ko(this.toString()),!1,!1]}let o=!n||t||r||!Mg?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!r?Mg:"")+UR;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Mg:"")+FR+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Ko(s),this.#r=!!this.#r,this.#n]}#p(){if(LR(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#p(),this.#m(i)?(r=!1,this.#E(i,n)):this.#C(i)?(r=!1,this.#f(i,n)):this.#O(i)&&(r=!1,this.#y(i)))}}while(!r&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#o=void 0}#v(t){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(t);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#k(t,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(gue.has(u)?"\\":"")+u;continue}if(u==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(t)?UR:FR,r=!0;continue}else a=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,f,p,h]=DR(t,c);if(p){s+=d,o=o||f,c+=p-1,r=r||h;continue}}if(u==="?"){s+=wk,r=!0;continue}s+=yue(u)}return[s,Ko(t),!!r,o]}};Wn=Ha;var bk=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Jr=l((e,t,r={})=>(sf(t),!r.nocomment&&t.charAt(0)==="#"?!1:new Sc(t,r).match(e)),"minimatch"),wue=/^\*+([^+@!?*[(]*)$/,bue=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),xue=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Eue=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Sue=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),kue=/^\*+\.\*+$/,Aue=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),Iue=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),$ue=/^\.\*+$/,_ue=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),Tue=/^\*+$/,Cue=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),Oue=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),Nue=/^\?+([^+@!?*[(]*)?$/,Rue=l(([e,t=""])=>{let r=BR([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),Pue=l(([e,t=""])=>{let r=WR([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),Due=l(([e,t=""])=>{let r=WR([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTestDot"),Lue=l(([e,t=""])=>{let r=BR([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTest"),BR=l(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),WR=l(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),qR=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jR={win32:{sep:"\\"},posix:{sep:"/"}},Mue=qR==="win32"?jR.win32.sep:jR.posix.sep;Jr.sep=Mue;var yn=Symbol("globstar **");Jr.GLOBSTAR=yn;var Fue="[^/]",Uue=Fue+"*?",jue="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zue="(?:(?!(?:\\/|^)\\.).)*?",Bue=l((e,t={})=>r=>Jr(r,e,t),"filter");Jr.filter=Bue;var wi=l((e,t={})=>Object.assign({},e,t),"ext"),Wue=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Jr;let t=Jr;return Object.assign(l((n,i,s={})=>t(n,i,wi(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(i,s={}){super(i,wi(e,s))}static defaults(i){return t.defaults(wi(e,i)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(i,s,o={}){super(i,s,wi(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,wi(e,s))}},unescape:l((n,i={})=>t.unescape(n,wi(e,i)),"unescape"),escape:l((n,i={})=>t.escape(n,wi(e,i)),"escape"),filter:l((n,i={})=>t.filter(n,wi(e,i)),"filter"),defaults:l(n=>t.defaults(wi(e,n)),"defaults"),makeRe:l((n,i={})=>t.makeRe(n,wi(e,i)),"makeRe"),braceExpand:l((n,i={})=>t.braceExpand(n,wi(e,i)),"braceExpand"),match:l((n,i,s={})=>t.match(n,i,wi(e,s)),"match"),sep:t.sep,GLOBSTAR:yn})},"defaults");Jr.defaults=Wue;var HR=l((e,t={})=>(sf(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:RR(e,{max:t.braceExpandMax})),"braceExpand");Jr.braceExpand=HR;var que=l((e,t={})=>new Sc(e,t).makeRe(),"makeRe");Jr.makeRe=que;var Hue=l((e,t,r={})=>{let n=new Sc(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e},"match");Jr.match=Hue;var zR=/[?*]|[+@!]\(.*?\)|\[|\]/,Gue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Sc=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){sf(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||qR,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!zR.test(s[2]))&&!zR.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],u=n[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let d=n.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,s=0,o=[],a="";for(;i<t.length&&s<r.length;)if(t[i]===r[s])o.push(a==="b"?r[s]:t[i]),i++,s++;else if(n&&t[i]==="**"&&r[s]===t[i+1])o.push(t[i]),i++;else if(n&&r[s]==="**"&&t[i]===r[s+1])o.push(r[s]),s++;else if(t[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,s++}else if(r[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return t.length===r.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),f=c?3:a?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,m]=[t[f],r[p]];h.toLowerCase()===m.toLowerCase()&&(r[p]=h,s=p,i=f)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(yn)?this.#e(t,r,n,i,s):this.#n(t,r,n,i,s)}#e(t,r,n,i,s){let o=r.indexOf(yn,s),a=r.lastIndexOf(yn),[c,u,d]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let w=t.slice(i,i+c.length);if(!this.#n(w,c,n,0,0))return!1;i+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+i>t.length)return!1;let w=t.length-d.length;if(this.#n(t,d,n,w,0))f=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(w--,!this.#n(t,d,n,w,0)))return!1;f=d.length+1}}if(!u.length){let w=!!f;for(let b=i;b<t.length-f;b++){let k=String(t[b]);if(w=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return n||w}let p=[[[],0]],h=p[0],m=0,g=[0];for(let w of u)w===yn?(g.push(m),h=[[],0],p.push(h)):(h[0].push(w),m++);let y=p.length-1,x=t.length-f;for(let w of p)w[1]=x-(g[y--]+w[0].length);return!!this.#r(t,p,i,0,n,0,!!f)}#r(t,r,n,i,s,o,a){let c=r[i];if(!c){for(let f=n;f<t.length;f++){a=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[u,d]=c;for(;n<=d;){if(this.#n(t.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(t,r,n+u.length,i+1,s,o+1,a);if(h!==!1)return h}let p=t[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return s||null}#n(t,r,n,i,s){let o,a,c,u;for(o=i,a=s,u=t.length,c=r.length;o<u&&a<c;o++,a++){this.debug("matchOne loop");let d=r[a],f=t[o];if(this.debug(r,d,f),d===!1||d===yn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(o===u&&a===c)return!0;if(o===u)return n;if(a===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return HR(this.pattern,this.options)}parse(t){sf(t);let r=this.options;if(t==="**")return yn;if(t==="")return"";let n,i=null;(n=t.match(Tue))?i=r.dot?Oue:Cue:(n=t.match(wue))?i=(r.nocase?r.dot?Sue:Eue:r.dot?xue:bue)(n[1]):(n=t.match(Nue))?i=(r.nocase?r.dot?Pue:Rue:r.dot?Due:Lue)(n):(n=t.match(kue))?i=r.dot?Iue:Aue:(n=t.match($ue))&&(i=_ue);let s=Ha.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?Uue:r.dot?jue:zue,i=new Set(r.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))i.add(p);return typeof f=="string"?Gue(f):f===yn?yn:f._src});u.forEach((f,p)=>{let h=u[p+1],m=u[p-1];f!==yn||m===yn||(m===void 0?h!==void 0&&h!==yn?u[p+1]="(?:\\/|"+n+"\\/)?"+h:u[p]=n:h===void 0?u[p-1]=m+"(?:\\/|\\/"+n+")?":h!==yn&&(u[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,u[p+1]=yn))});let d=u.filter(f=>f!==yn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Jr.defaults(t).Minimatch}};Jr.AST=Ha;Jr.Minimatch=Sc;Jr.escape=bk;Jr.unescape=Ko;import{gunzipSync as Gfe}from"node:zlib";var af=class{static{l(this,"Diff")}diff(t,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(t,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(t,r,n,i){var s;let o=l(w=>{if(w=this.postProcess(w,n),i){setTimeout(function(){i(w)},0);return}else return w},"done"),a=r.length,c=t.length,u=1,d=a+c;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,t,0,n);if(h[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(h[0].lastComponent,r,t));let g=-1/0,y=1/0,x=l(()=>{for(let w=Math.max(g,-u);w<=Math.min(y,u);w+=2){let b,k=h[w-1],S=h[w+1];k&&(h[w-1]=void 0);let A=!1;if(S){let O=S.oldPos-w;A=S&&0<=O&&O<a}let $=k&&k.oldPos+1<c;if(!A&&!$){h[w]=void 0;continue}if(!$||A&&k.oldPos<S.oldPos?b=this.addToPath(S,!0,!1,0,n):b=this.addToPath(k,!1,!0,1,n),m=this.extractCommon(b,r,t,w,n),b.oldPos+1>=c&&m+1>=a)return o(this.buildValues(b.lastComponent,r,t))||!0;h[w]=b,b.oldPos+1>=c&&(y=Math.min(y,w-1)),m+1>=a&&(g=Math.max(g,w+1))}u++},"execEditLength");if(i)l(function w(){setTimeout(function(){if(u>d||Date.now()>p)return i(void 0);x()||w()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let w=x();if(w)return w}}addToPath(t,r,n,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(t,r,n,i,s){let o=r.length,a=n.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<a&&this.equals(n[c+1],r[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,r,n){return n.comparator?n.comparator(t,r):t===r||!!n.ignoreCase&&t.toLowerCase()===r.toLowerCase()}removeEmpty(t){let r=[];for(let n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r}castInput(t,r){return t}tokenize(t,r){return Array.from(t)}join(t){return t.join("")}postProcess(t,r){return t}get useLongestToken(){return!1}buildValues(t,r,n){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,a=0,c=0,u=0;for(;a<o;a++){let d=i[a];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=r.slice(c,c+d.count);f=f.map(function(p,h){let m=n[u+h];return m.length>p.length?m:p}),d.value=this.join(f)}else d.value=this.join(r.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var xk=class extends af{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Zue}equals(t,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
710
+ `}l(SR,"pageStyles");var fk={name:"dsh-edge",version:"0.3.0",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.1-rc.1"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.1-rc.1","@deepseek-ai/dsh-agent-loop":"0.1.1-rc.1","@deepseek-ai/dsh-anonymous-user-id":"0.1.1-rc.1","@deepseek-ai/dsh-attachment":"0.1.1-rc.1","@deepseek-ai/dsh-brand":"0.1.1-rc.1","@deepseek-ai/dsh-credentials":"0.1.1-rc.1","@deepseek-ai/dsh-host-apiproxy":"0.1.1-rc.1","@deepseek-ai/dsh-launch-environment":"0.1.1-rc.1","@deepseek-ai/dsh-llm":"0.1.1-rc.1","@deepseek-ai/dsh-llm-deepseek":"0.1.1-rc.1","@deepseek-ai/dsh-session":"0.1.1-rc.1","@deepseek-ai/dsh-session-persistence":"0.1.1-rc.1","@deepseek-ai/dsh-session-query":"0.1.1-rc.1","@deepseek-ai/dsh-session-title":"0.1.1-rc.1","@deepseek-ai/dsh-settings":"0.1.1-rc.1","@deepseek-ai/dsh-system-prompt":"0.1.1-rc.1","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.1-rc.1","@deepseek-ai/dsh-tool-web":"0.1.1-rc.1","@deepseek-ai/dsh-tools":"0.1.1-rc.1","@deepseek-ai/dsh-web":"0.1.1-rc.1","@deepseek-ai/dsh-web-search-deepseek":"0.1.1-rc.1","just-bash":"3.3.0","fast-png":"8.0.0","jpeg-js":"0.4.4",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var Pg=fk.version,kR=fk.dshEdge.upstreamVersion;function Fce(){return"dsh-edge@0.3.0/direct"}l(Fce,"resolveEdgeDeploymentId");function Dg(e){return lR(e.DEEPSEEK_API_KEY),{baseURL:t6(e.DEEPSEEK_BASE_URL),maxTokens:i6(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Ud(e.DEEPSEEK_MODEL),reasoningEffort:r6(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:wg(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:n6(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Qd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Dg,"resolveEdgeDeploymentConfig");function Uce(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(Uce,"edgeDeploymentApiKeyConfigured");function jce(e){let t=t6(e),r=new URL(t);return r.search.length===0&&r.hash.length===0?t:(r.search="",r.hash="",r.href)}l(jce,"projectedEdgeBaseURL");function pk(e,t){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:Fce(),apiKeyConfigured:Uce(e),baseURL:jce(e.DEEPSEEK_BASE_URL),maxTokens:i6(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Ud(e.DEEPSEEK_MODEL),reasoningEffort:r6(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:wg(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:n6(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:Qd(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(pk,"resolveEdgeDeploymentProfile");function AR(e){Dg(e);let t=pk(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:Pg,upstreamVersion:kR,status:"ready"}}l(AR,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as JDe}from"cloudflare:workers";var El=ly(IR(),1);var hk=l((e,t,r)=>{let n=e instanceof RegExp?$R(e,r):e,i=t instanceof RegExp?$R(t,r):t,s=n!==null&&i!=null&&zce(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},"balanced"),$R=l((e,t)=>{let r=t.match(e);return r?r[0]:null},"maybeMatch"),zce=l((e,t,r)=>{let n,i,s,o,a,c=r.indexOf(e),u=r.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(n=[],s=r.length;d>=0&&!a;){if(d===c)n.push(d),c=r.indexOf(e,d+1);else if(n.length===1){let f=n.pop();f!==void 0&&(a=[f,u])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=u),u=r.indexOf(t,d+1);d=c<u&&c>=0?c:u}n.length&&o!==void 0&&(a=[s,o])}return a},"range");var _R="\0SLASH"+Math.random()+"\0",TR="\0OPEN"+Math.random()+"\0",yk="\0CLOSE"+Math.random()+"\0",CR="\0COMMA"+Math.random()+"\0",OR="\0PERIOD"+Math.random()+"\0",Bce=new RegExp(_R,"g"),Wce=new RegExp(TR,"g"),qce=new RegExp(yk,"g"),Hce=new RegExp(CR,"g"),Gce=new RegExp(OR,"g"),Vce=/\\\\/g,Zce=/\\{/g,Kce=/\\}/g,Yce=/\\,/g,Xce=/\\\./g,Jce=1e5,Qce=4e6;function mk(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(mk,"numeric");function eue(e){return e.replace(Vce,_R).replace(Zce,TR).replace(Kce,yk).replace(Yce,CR).replace(Xce,OR)}l(eue,"escapeBraces");function tue(e){return e.replace(Bce,"\\").replace(Wce,"{").replace(qce,"}").replace(Hce,",").replace(Gce,".")}l(tue,"unescapeBraces");function NR(e){if(!e)return[""];let t=[],r=hk("{","}",e);if(!r)return e.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=NR(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),t.push.apply(t,o),t}l(NR,"parseCommaParts");function RR(e,t={}){if(!e)return[];let{max:r=Jce,maxLength:n=Qce}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),gk(eue(e),r,n,!0).map(tue)}l(RR,"expand");function rue(e){return"{"+e+"}"}l(rue,"embrace");function nue(e){return/^-?0\d/.test(e)}l(nue,"isPadded");function iue(e,t){return e<=t}l(iue,"lte");function sue(e,t){return e>=t}l(sue,"gte");function nf(e,t,r,n,i,s){let o=[],a=0;for(let c=0;c<e.length;c++)for(let u=0;u<r.length;u++){if(o.length>=n)return o;let d=e[c]+t+r[u];if(!(s&&!d)){if(a+d.length>i)return o;o.push(d),a+=d.length}}return o}l(nf,"combine");function oue(e,t,r,n){let i=e.split(/\.\./),s=[];if(i[0]===void 0||i[1]===void 0)return s;let o=mk(i[0]),a=mk(i[1]),c=Math.max(i[0].length,i[1].length),u=i.length===3&&i[2]!==void 0?Math.max(Math.abs(mk(i[2])),1):1,d=iue;a<o&&(u*=-1,d=sue);let p=i.some(nue),h=0;for(let m=o;d(m,a)&&s.length<r;m+=u){let g;if(t)g=String.fromCharCode(m),g==="\\"&&(g="");else if(g=String(m),p){let y=c-g.length;if(y>0){let x=new Array(y+1).join("0");m<0?g="-"+x+g.slice(1):g=x+g}}if(h+g.length>n)break;s.push(g),h+=g.length}return s}l(oue,"expandSequence");function gk(e,t,r,n){let i=[""],s=!1,o=!0;for(;;){let a=hk("{","}",e);if(!a)return nf(i,e,[""],t,r,s);let c=a.pre;if(/\$$/.test(c)){if(i=nf(i,c+"{"+a.body+"}",[""],t,r,s&&!a.post.length),o=!1,!a.post.length)break;e=a.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(a.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(a.body),f=u||d,p=a.body.indexOf(",")>=0;if(!f&&!p){if(a.post.match(/,(?!,).*\}/)){e=a.pre+"{"+a.body+yk+a.post,n=!0;continue}return nf(i,c+"{"+a.body+"}"+a.post,[""],t,r,s)}o&&(s=n&&!f,o=!1);let h;if(f)h=oue(a.body,d,t,r);else{let m=NR(a.body);if(m.length===1&&m[0]!==void 0&&(m=gk(m[0],t,r,!1).map(rue),m.length===1)){if(i=nf(i,c+m[0],[""],t,r,s&&!a.post.length),!a.post.length)break;e=a.post;continue}let g=s&&!a.post.length&&!c;for(let x=0;g&&x<i.length;x++)i[x]&&(g=!1);h=[];let y=0;e:for(let x=0;x<m.length;x++){let w=gk(m[x],t,r,!1);for(let b=0;b<w.length;b++){let k=w[b];if(!(g&&!k)){if(h.length>=t||y+k.length>r)break e;h.push(k),y+=k.length}}}}if(i=nf(i,c,h,t,r,s&&!a.post.length),!a.post.length)break;e=a.post}return i}l(gk,"expand_");var sf=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var aue={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},of=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),lue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),PR=l(e=>e.join(""),"rangesToString"),DR=l((e,t)=>{let r=t;if(e.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,u=!1,d=r,f="";e:for(;s<e.length;){let g=e.charAt(s);if((g==="!"||g==="^")&&s===r+1){u=!0,s++;continue}if(g==="]"&&o&&!c){d=s+1;break}if(o=!0,g==="\\"&&!c){c=!0,s++;continue}if(g==="["&&!c){for(let[y,[x,w,b]]of Object.entries(aue))if(e.startsWith(y,s)){if(f)return["$.",!1,e.length-r,!0];s+=y.length,b?i.push(x):n.push(x),a=a||w;continue e}}if(c=!1,f){g>f?n.push(of(f)+"-"+of(g)):g===f&&n.push(of(g)),f="",s++;continue}if(e.startsWith("-]",s+1)){n.push(of(g+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=g,s+=2;continue}n.push(of(g)),s++}if(d<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,e.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!u){let g=n[0].length===2?n[0].slice(-1):n[0];return[lue(g),!1,d-r,!1]}let p="["+(u?"^":"")+PR(n)+"]",h="["+(u?"":"^")+PR(i)+"]";return[n.length&&i.length?"("+p+"|"+h+")":n.length?p:h,a,d-r,!0]},"parseClass");var Ko=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!0}={})=>r?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var Wn,cue=new Set(["!","?","+","*","@"]),vk=l(e=>cue.has(e),"isExtglobType"),LR=l(e=>vk(e.type),"isExtglobAST"),uue=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),due=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),fue=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),MR=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),pue="(?!(?:^|/)\\.\\.?(?:$|/))",Mg="(?!\\.)",hue=new Set(["[","."]),mue=new Set(["..","."]),gue=new Set("().*{}+?[]^$\\!"),yue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),wk="[^/]",FR=wk+"*?",UR=wk+"+?",vue=0,Ha=class{static{l(this,"AST")}type;#e;#r;#n=!1;#t=[];#i;#s;#a;#u=!1;#l;#o;#c=!1;id=++vue;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,r,n={}){this.type=t,t&&(this.#r=!0),this.#i=r,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?n:this.#e.#l,this.#a=this.#e===this?[]:this.#e.#a,t==="!"&&!this.#e.#u&&this.#a.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#r!==void 0)return this.#r;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#r=!0;return this.#r}toString(){return this.#o!==void 0?this.#o:this.type?this.#o=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#o=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#a.pop();){if(t.type!=="!")continue;let r=t,n=r.#i;for(;n;){for(let i=r.#s+1;!n.type&&i<n.#t.length;i++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#t[i])}r=n,n=r.#i}}return this}push(...t){for(let r of t)if(r!==""){if(typeof r!="string"&&!(r instanceof Wn&&r.#i===this))throw new Error("invalid part: "+r);this.#t.push(r)}}toJSON(){let t=this.type===null?this.#t.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#t.map(r=>r.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let r=0;r<this.#s;r++){let n=t.#t[r];if(!(n instanceof Wn&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let r=new Wn(this.type,t);for(let n of this.#t)r.copyIn(n);return r}static#h(t,r,n,i,s){let o=i.maxExtglobRecursion??2,a=!1,c=!1,u=-1,d=!1;if(r.type===null){let g=n,y="";for(;g<t.length;){let x=t.charAt(g++);if(a||x==="\\"){a=!a,y+=x;continue}if(c){g===u+1?(x==="^"||x==="!")&&(d=!0):x==="]"&&!(g===u+2&&d)&&(c=!1),y+=x;continue}else if(x==="["){c=!0,u=g,d=!1,y+=x;continue}if(!i.noext&&vk(x)&&t.charAt(g)==="("&&s<=o){r.push(y),y="";let b=new Wn(x,r);g=Wn.#h(t,b,g,i,s+1),r.push(b);continue}y+=x}return r.push(y),g}let f=n+1,p=new Wn(null,r),h=[],m="";for(;f<t.length;){let g=t.charAt(f++);if(a||g==="\\"){a=!a,m+=g;continue}if(c){f===u+1?(g==="^"||g==="!")&&(d=!0):g==="]"&&!(f===u+2&&d)&&(c=!1),m+=g;continue}else if(g==="["){c=!0,u=f,d=!1,m+=g;continue}if(!i.noext&&vk(g)&&t.charAt(f)==="("&&(s<=o||r&&r.#g(g))){let x=r&&r.#g(g)?0:1;p.push(m),m="";let w=new Wn(g,p);p.push(w),f=Wn.#h(t,w,f,i,s+x);continue}if(g==="|"){p.push(m),m="",h.push(p),p=new Wn(null,r);continue}if(g===")")return m===""&&r.#t.length===0&&(r.#c=!0),p.push(m),m="",r.push(...h,p),f;m+=g}return r.type=null,r.#r=void 0,r.#t=[t.substring(n-1)],f}#C(t){return this.#m(t,due)}#m(t,r=uue){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#g(n.type,r)}#g(t,r=fue){return!!r.get(this.type)?.includes(t)}#f(t,r){let n=t.#t[0],i=new Wn(null,n,this.options);i.#t.push(""),n.push(i),this.#E(t,r)}#E(t,r){let n=t.#t[0];this.#t.splice(r,1,...n.#t);for(let i of n.#t)typeof i=="object"&&(i.#i=this);this.#o=void 0}#S(t){return!!MR.get(this.type)?.has(t)}#O(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let r=t.#t[0];return!r||typeof r!="object"||r.type===null?!1:this.#S(r.type)}#y(t){let r=MR.get(this.type),n=t.#t[0],i=r?.get(n.type);if(!i)return!1;this.#t=n.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=i,this.#o=void 0,this.#c=!1}static fromGlob(t,r={}){let n=new Wn(null,void 0,r);return Wn.#h(t,n,0,r,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#r||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return n;let a=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:t})}get options(){return this.#l}toRegExpSource(t){let r=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!LR(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[m,g,y,x]=typeof h=="string"?Wn.#k(h,this.#r,c):h.toRegExpSource(t);return this.#r=this.#r||y,this.#n=this.#n||x,m}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&mue.has(this.#t[0]))){let m=hue,g=r&&m.has(u.charAt(0))||u.startsWith("\\.")&&m.has(u.charAt(2))||u.startsWith("\\.\\.")&&m.has(u.charAt(4)),y=!r&&!t&&m.has(u.charAt(0));d=g?pue:y?Mg:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,Ko(u),this.#r=!!this.#r,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#r=void 0,[c,Ko(this.toString()),!1,!1]}let o=!n||t||r||!Mg?"":this.#v(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#c)a=(this.isStart()&&!r?Mg:"")+UR;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!t?Mg:"")+FR+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Ko(s),this.#r=!!this.#r,this.#n]}#p(){if(LR(this)){let t=0,r=!1;do{r=!0;for(let n=0;n<this.#t.length;n++){let i=this.#t[n];typeof i=="object"&&(i.#p(),this.#m(i)?(r=!1,this.#E(i,n)):this.#C(i)?(r=!1,this.#f(i,n)):this.#O(i)&&(r=!1,this.#y(i)))}}while(!r&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#o=void 0}#v(t){return this.#t.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(t);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#k(t,r,n=!1){let i=!1,s="",o=!1,a=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(i){i=!1,s+=(gue.has(u)?"\\":"")+u;continue}if(u==="*"){if(a)continue;a=!0,s+=n&&/^[*]+$/.test(t)?UR:FR,r=!0;continue}else a=!1;if(u==="\\"){c===t.length-1?s+="\\\\":i=!0;continue}if(u==="["){let[d,f,p,h]=DR(t,c);if(p){s+=d,o=o||f,c+=p-1,r=r||h;continue}}if(u==="?"){s+=wk,r=!0;continue}s+=yue(u)}return[s,Ko(t),!!r,o]}};Wn=Ha;var bk=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:r=!1}={})=>r?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Jr=l((e,t,r={})=>(sf(t),!r.nocomment&&t.charAt(0)==="#"?!1:new Sc(t,r).match(e)),"minimatch"),wue=/^\*+([^+@!?*[(]*)$/,bue=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),xue=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Eue=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Sue=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),kue=/^\*+\.\*+$/,Aue=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),Iue=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),$ue=/^\.\*+$/,_ue=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),Tue=/^\*+$/,Cue=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),Oue=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),Nue=/^\?+([^+@!?*[(]*)?$/,Rue=l(([e,t=""])=>{let r=BR([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocase"),Pue=l(([e,t=""])=>{let r=WR([e]);return t?(t=t.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(t)):r},"qmarksTestNocaseDot"),Due=l(([e,t=""])=>{let r=WR([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTestDot"),Lue=l(([e,t=""])=>{let r=BR([e]);return t?n=>r(n)&&n.endsWith(t):r},"qmarksTest"),BR=l(([e])=>{let t=e.length;return r=>r.length===t&&!r.startsWith(".")},"qmarksTestNoExt"),WR=l(([e])=>{let t=e.length;return r=>r.length===t&&r!=="."&&r!==".."},"qmarksTestNoExtDot"),qR=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",jR={win32:{sep:"\\"},posix:{sep:"/"}},Mue=qR==="win32"?jR.win32.sep:jR.posix.sep;Jr.sep=Mue;var yn=Symbol("globstar **");Jr.GLOBSTAR=yn;var Fue="[^/]",Uue=Fue+"*?",jue="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",zue="(?:(?!(?:\\/|^)\\.).)*?",Bue=l((e,t={})=>r=>Jr(r,e,t),"filter");Jr.filter=Bue;var wi=l((e,t={})=>Object.assign({},e,t),"ext"),Wue=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Jr;let t=Jr;return Object.assign(l((n,i,s={})=>t(n,i,wi(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(i,s={}){super(i,wi(e,s))}static defaults(i){return t.defaults(wi(e,i)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(i,s,o={}){super(i,s,wi(e,o))}static fromGlob(i,s={}){return t.AST.fromGlob(i,wi(e,s))}},unescape:l((n,i={})=>t.unescape(n,wi(e,i)),"unescape"),escape:l((n,i={})=>t.escape(n,wi(e,i)),"escape"),filter:l((n,i={})=>t.filter(n,wi(e,i)),"filter"),defaults:l(n=>t.defaults(wi(e,n)),"defaults"),makeRe:l((n,i={})=>t.makeRe(n,wi(e,i)),"makeRe"),braceExpand:l((n,i={})=>t.braceExpand(n,wi(e,i)),"braceExpand"),match:l((n,i,s={})=>t.match(n,i,wi(e,s)),"match"),sep:t.sep,GLOBSTAR:yn})},"defaults");Jr.defaults=Wue;var HR=l((e,t={})=>(sf(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:RR(e,{max:t.braceExpandMax})),"braceExpand");Jr.braceExpand=HR;var que=l((e,t={})=>new Sc(e,t).makeRe(),"makeRe");Jr.makeRe=que;var Hue=l((e,t,r={})=>{let n=new Sc(t,r);return e=e.filter(i=>n.match(i)),n.options.nonull&&!e.length&&e.push(t),e},"match");Jr.match=Hue;var zR=/[?*]|[+@!]\(.*?\)|\[|\]/,Gue=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Sc=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,r={}){sf(t),r=r||{},this.options=r,this.maxGlobstarRecursion=r.maxGlobstarRecursion??200,this.pattern=t,this.platform=r.platform||qR,this.isWindows=this.platform==="win32";let n="allowWindowsEscape";this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r[n]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let r of t)if(typeof r!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,r=this.options;if(!r.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!zR.test(s[2]))&&!zR.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let n of t)for(let i=0;i<n.length;i++)n[i]==="**"&&(n[i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):r>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(t){return t.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<t.length-1;i++){let s=t[i];i===1&&s===""&&t[0]===""||(s==="."||s==="")&&(r=!0,t.splice(i,1),i--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(r=!0,t.pop())}let n=0;for(;(n=t.indexOf("..",n+1))!==-1;){let i=t[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(i))&&(r=!0,t.splice(n-1,2),n-=2)}}while(r);return t.length===0?[""]:t}firstPhasePreProcess(t){let r=!1;do{r=!1;for(let n of t){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],u=n[i+3];if(a!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;r=!0,n.splice(i,1);let d=n.slice(0);d[i]="**",t.push(d),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return t}secondPhasePreProcess(t){for(let r=0;r<t.length-1;r++)for(let n=r+1;n<t.length;n++){let i=this.partsMatch(t[r],t[n],!this.preserveMultipleSlashes);if(i){t[r]=[],t[n]=i;break}}return t.filter(r=>r.length)}partsMatch(t,r,n=!1){let i=0,s=0,o=[],a="";for(;i<t.length&&s<r.length;)if(t[i]===r[s])o.push(a==="b"?r[s]:t[i]),i++,s++;else if(n&&t[i]==="**"&&r[s]===t[i+1])o.push(t[i]),i++;else if(n&&r[s]==="**"&&t[i]===r[s+1])o.push(r[s]),s++;else if(t[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(t[i]),i++,s++}else if(r[s]==="*"&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&t[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return t.length===r.length&&o}parseNegate(){if(this.nonegate)return;let t=this.pattern,r=!1,n=0;for(let i=0;i<t.length&&t.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=t.slice(n)),this.negate=r}matchOne(t,r,n=!1){let i=0,s=0;if(this.isWindows){let a=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!a&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),d=!u&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),f=c?3:a?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,m]=[t[f],r[p]];h.toLowerCase()===m.toLowerCase()&&(r[p]=h,s=p,i=f)}}let{optimizationLevel:o=1}=this.options;return o>=2&&(t=this.levelTwoFileOptimize(t)),r.includes(yn)?this.#e(t,r,n,i,s):this.#n(t,r,n,i,s)}#e(t,r,n,i,s){let o=r.indexOf(yn,s),a=r.lastIndexOf(yn),[c,u,d]=n?[r.slice(s,o),r.slice(o+1),[]]:[r.slice(s,o),r.slice(o+1,a),r.slice(a+1)];if(c.length){let w=t.slice(i,i+c.length);if(!this.#n(w,c,n,0,0))return!1;i+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+i>t.length)return!1;let w=t.length-d.length;if(this.#n(t,d,n,w,0))f=d.length;else{if(t[t.length-1]!==""||i+d.length===t.length||(w--,!this.#n(t,d,n,w,0)))return!1;f=d.length+1}}if(!u.length){let w=!!f;for(let b=i;b<t.length-f;b++){let k=String(t[b]);if(w=!0,k==="."||k===".."||!this.options.dot&&k.startsWith("."))return!1}return n||w}let p=[[[],0]],h=p[0],m=0,g=[0];for(let w of u)w===yn?(g.push(m),h=[[],0],p.push(h)):(h[0].push(w),m++);let y=p.length-1,x=t.length-f;for(let w of p)w[1]=x-(g[y--]+w[0].length);return!!this.#r(t,p,i,0,n,0,!!f)}#r(t,r,n,i,s,o,a){let c=r[i];if(!c){for(let f=n;f<t.length;f++){a=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return a}let[u,d]=c;for(;n<=d;){if(this.#n(t.slice(0,n+u.length),u,s,n,0)&&o<this.maxGlobstarRecursion){let h=this.#r(t,r,n+u.length,i+1,s,o+1,a);if(h!==!1)return h}let p=t[n];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;n++}return s||null}#n(t,r,n,i,s){let o,a,c,u;for(o=i,a=s,u=t.length,c=r.length;o<u&&a<c;o++,a++){this.debug("matchOne loop");let d=r[a],f=t[o];if(this.debug(r,d,f),d===!1||d===yn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(o===u&&a===c)return!0;if(o===u)return n;if(a===c)return o===u-1&&t[o]==="";throw new Error("wtf?")}braceExpand(){return HR(this.pattern,this.options)}parse(t){sf(t);let r=this.options;if(t==="**")return yn;if(t==="")return"";let n,i=null;(n=t.match(Tue))?i=r.dot?Oue:Cue:(n=t.match(wue))?i=(r.nocase?r.dot?Sue:Eue:r.dot?xue:bue)(n[1]):(n=t.match(Nue))?i=(r.nocase?r.dot?Pue:Rue:r.dot?Due:Lue)(n):(n=t.match(kue))?i=r.dot?Iue:Aue:(n=t.match($ue))&&(i=_ue);let s=Ha.fromGlob(t,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?Uue:r.dot?jue:zue,i=new Set(r.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))i.add(p);return typeof f=="string"?Gue(f):f===yn?yn:f._src});u.forEach((f,p)=>{let h=u[p+1],m=u[p-1];f!==yn||m===yn||(m===void 0?h!==void 0&&h!==yn?u[p+1]="(?:\\/|"+n+"\\/)?"+h:u[p]=n:h===void 0?u[p-1]=m+"(?:\\/|\\/"+n+")?":h!==yn&&(u[p-1]=m+"(?:\\/|\\/"+n+"\\/)"+h,u[p+1]=yn))});let d=u.filter(f=>f!==yn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[o,a]=t.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,r=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&r)return!0;let n=this.options;this.isWindows&&(t=t.split("\\").join("/"));let i=this.slashSplit(t);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a of s){let c=i;if(n.matchBase&&a.length===1&&(c=[o]),this.matchOne(c,a,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(t){return Jr.defaults(t).Minimatch}};Jr.AST=Ha;Jr.Minimatch=Sc;Jr.escape=bk;Jr.unescape=Ko;import{gunzipSync as Gfe}from"node:zlib";var af=class{static{l(this,"Diff")}diff(t,r,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(t,n),o=this.castInput(r,n),a=this.removeEmpty(this.tokenize(s,n)),c=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,c,n,i)}diffWithOptionsObj(t,r,n,i){var s;let o=l(w=>{if(w=this.postProcess(w,n),i){setTimeout(function(){i(w)},0);return}else return w},"done"),a=r.length,c=t.length,u=1,d=a+c;n.maxEditLength!=null&&(d=Math.min(d,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],m=this.extractCommon(h[0],r,t,0,n);if(h[0].oldPos+1>=c&&m+1>=a)return o(this.buildValues(h[0].lastComponent,r,t));let g=-1/0,y=1/0,x=l(()=>{for(let w=Math.max(g,-u);w<=Math.min(y,u);w+=2){let b,k=h[w-1],S=h[w+1];k&&(h[w-1]=void 0);let A=!1;if(S){let O=S.oldPos-w;A=S&&0<=O&&O<a}let $=k&&k.oldPos+1<c;if(!A&&!$){h[w]=void 0;continue}if(!$||A&&k.oldPos<S.oldPos?b=this.addToPath(S,!0,!1,0,n):b=this.addToPath(k,!1,!0,1,n),m=this.extractCommon(b,r,t,w,n),b.oldPos+1>=c&&m+1>=a)return o(this.buildValues(b.lastComponent,r,t))||!0;h[w]=b,b.oldPos+1>=c&&(y=Math.min(y,w-1)),m+1>=a&&(g=Math.max(g,w+1))}u++},"execEditLength");if(i)l(function w(){setTimeout(function(){if(u>d||Date.now()>p)return i(void 0);x()||w()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let w=x();if(w)return w}}addToPath(t,r,n,i,s){let o=t.lastComponent;return o&&!s.oneChangePerToken&&o.added===r&&o.removed===n?{oldPos:t.oldPos+i,lastComponent:{count:o.count+1,added:r,removed:n,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+i,lastComponent:{count:1,added:r,removed:n,previousComponent:o}}}extractCommon(t,r,n,i,s){let o=r.length,a=n.length,c=t.oldPos,u=c-i,d=0;for(;u+1<o&&c+1<a&&this.equals(n[c+1],r[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,r,n){return n.comparator?n.comparator(t,r):t===r||!!n.ignoreCase&&t.toLowerCase()===r.toLowerCase()}removeEmpty(t){let r=[];for(let n=0;n<t.length;n++)t[n]&&r.push(t[n]);return r}castInput(t,r){return t}tokenize(t,r){return Array.from(t)}join(t){return t.join("")}postProcess(t,r){return t}get useLongestToken(){return!1}buildValues(t,r,n){let i=[],s;for(;t;)i.push(t),s=t.previousComponent,delete t.previousComponent,t=s;i.reverse();let o=i.length,a=0,c=0,u=0;for(;a<o;a++){let d=i[a];if(d.removed)d.value=this.join(n.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=r.slice(c,c+d.count);f=f.map(function(p,h){let m=n[u+h];return m.length>p.length?m:p}),d.value=this.join(f)}else d.value=this.join(r.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return i}};var xk=class extends af{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Zue}equals(t,r,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
711
711
  `))&&(t=t.trim()),(!n.newlineIsToken||!r.includes(`
712
712
  `))&&(r=r.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(t.endsWith(`
713
713
  `)&&(t=t.slice(0,-1)),r.endsWith(`
@@ -707,7 +707,7 @@ ${i}`:""}`}});function xI(e){if(e.url.trim().length===0)throw new Error("url mus
707
707
  button, .button { display: inline-block; box-sizing: border-box; margin-top: 1rem; padding: .75rem 1rem; border: 0; border-radius: .6rem; background: #5a87ff; color: #071022; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
708
708
  .secondary { background: #29314b; color: #edf2ff; }
709
709
  .error { padding: .75rem; border-radius: .5rem; background: #461d2b; color: #ffd6df; }
710
- `}l(x$,"pageStyles");var Zb={name:"dsh-edge",version:"0.3.0-alpha.2",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.1-rc.1"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.1-rc.1","@deepseek-ai/dsh-agent-loop":"0.1.1-rc.1","@deepseek-ai/dsh-anonymous-user-id":"0.1.1-rc.1","@deepseek-ai/dsh-attachment":"0.1.1-rc.1","@deepseek-ai/dsh-brand":"0.1.1-rc.1","@deepseek-ai/dsh-credentials":"0.1.1-rc.1","@deepseek-ai/dsh-host-apiproxy":"0.1.1-rc.1","@deepseek-ai/dsh-launch-environment":"0.1.1-rc.1","@deepseek-ai/dsh-llm":"0.1.1-rc.1","@deepseek-ai/dsh-llm-deepseek":"0.1.1-rc.1","@deepseek-ai/dsh-session":"0.1.1-rc.1","@deepseek-ai/dsh-session-persistence":"0.1.1-rc.1","@deepseek-ai/dsh-session-query":"0.1.1-rc.1","@deepseek-ai/dsh-session-title":"0.1.1-rc.1","@deepseek-ai/dsh-settings":"0.1.1-rc.1","@deepseek-ai/dsh-system-prompt":"0.1.1-rc.1","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.1-rc.1","@deepseek-ai/dsh-tool-web":"0.1.1-rc.1","@deepseek-ai/dsh-tools":"0.1.1-rc.1","@deepseek-ai/dsh-web":"0.1.1-rc.1","@deepseek-ai/dsh-web-search-deepseek":"0.1.1-rc.1","just-bash":"3.3.0","fast-png":"8.0.0","jpeg-js":"0.4.4",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var sh=Zb.version,E$=Zb.dshEdge.upstreamVersion;function pee(){return"dsh-edge@0.3.0-alpha.2/isolated"}l(pee,"resolveEdgeDeploymentId");function ah(e){return a$(e.DEEPSEEK_API_KEY),{baseURL:Mw(e.DEEPSEEK_BASE_URL),maxTokens:Uw(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Tc(e.DEEPSEEK_MODEL),reasoningEffort:jw(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:qp(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Fw(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:qc(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(ah,"resolveEdgeDeploymentConfig");function hee(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(hee,"edgeDeploymentApiKeyConfigured");function mee(e){let t=Mw(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}l(mee,"projectedEdgeBaseURL");function Kb(e,t){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:pee(),apiKeyConfigured:hee(e),baseURL:mee(e.DEEPSEEK_BASE_URL),maxTokens:Uw(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Tc(e.DEEPSEEK_MODEL),reasoningEffort:jw(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:qp(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Fw(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:qc(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Kb,"resolveEdgeDeploymentProfile");function S$(e){ah(e);let t=Kb(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:sh,upstreamVersion:E$,status:"ready"}}l(S$,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as YSe}from"cloudflare:workers";var La=Wm(k$(),1);var Xb=l((e,t,n)=>{let i=e instanceof RegExp?A$(e,n):e,r=t instanceof RegExp?A$(t,n):t,s=i!==null&&r!=null&&gee(i,r,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+i.length,s[1]),post:n.slice(s[1]+r.length)}},"balanced"),A$=l((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),gee=l((e,t,n)=>{let i,r,s,a,o,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(i=[],s=n.length;d>=0&&!o;){if(d===c)i.push(d),c=n.indexOf(e,d+1);else if(i.length===1){let f=i.pop();f!==void 0&&(o=[f,u])}else r=i.pop(),r!==void 0&&r<s&&(s=r,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}i.length&&a!==void 0&&(o=[s,a])}return o},"range");var _$="\0SLASH"+Math.random()+"\0",I$="\0OPEN"+Math.random()+"\0",Yb="\0CLOSE"+Math.random()+"\0",$$="\0COMMA"+Math.random()+"\0",C$="\0PERIOD"+Math.random()+"\0",yee=new RegExp(_$,"g"),vee=new RegExp(I$,"g"),wee=new RegExp(Yb,"g"),bee=new RegExp($$,"g"),xee=new RegExp(C$,"g"),Eee=/\\\\/g,See=/\\{/g,kee=/\\}/g,Aee=/\\,/g,_ee=/\\\./g,Iee=1e5,$ee=4e6;function Jb(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(Jb,"numeric");function Cee(e){return e.replace(Eee,_$).replace(See,I$).replace(kee,Yb).replace(Aee,$$).replace(_ee,C$)}l(Cee,"escapeBraces");function Tee(e){return e.replace(yee,"\\").replace(vee,"{").replace(wee,"}").replace(bee,",").replace(xee,".")}l(Tee,"unescapeBraces");function T$(e){if(!e)return[""];let t=[],n=Xb("{","}",e);if(!n)return e.split(",");let{pre:i,body:r,post:s}=n,a=i.split(",");a[a.length-1]+="{"+r+"}";let o=T$(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}l(T$,"parseCommaParts");function N$(e,t={}){if(!e)return[];let{max:n=Iee,maxLength:i=$ee}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Qb(Cee(e),n,i,!0).map(Tee)}l(N$,"expand");function Nee(e){return"{"+e+"}"}l(Nee,"embrace");function Ree(e){return/^-?0\d/.test(e)}l(Ree,"isPadded");function Oee(e,t){return e<=t}l(Oee,"lte");function Pee(e,t){return e>=t}l(Pee,"gte");function Zc(e,t,n,i,r,s){let a=[],o=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=i)return a;let d=e[c]+t+n[u];if(!(s&&!d)){if(o+d.length>r)return a;a.push(d),o+=d.length}}return a}l(Zc,"combine");function Dee(e,t,n,i){let r=e.split(/\.\./),s=[];if(r[0]===void 0||r[1]===void 0)return s;let a=Jb(r[0]),o=Jb(r[1]),c=Math.max(r[0].length,r[1].length),u=r.length===3&&r[2]!==void 0?Math.max(Math.abs(Jb(r[2])),1):1,d=Oee;o<a&&(u*=-1,d=Pee);let p=r.some(Ree),h=0;for(let g=a;d(g,o)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),p){let w=c-y.length;if(w>0){let x=new Array(w+1).join("0");g<0?y="-"+x+y.slice(1):y=x+y}}if(h+y.length>i)break;s.push(y),h+=y.length}return s}l(Dee,"expandSequence");function Qb(e,t,n,i){let r=[""],s=!1,a=!0;for(;;){let o=Xb("{","}",e);if(!o)return Zc(r,e,[""],t,n,s);let c=o.pre;if(/\$$/.test(c)){if(r=Zc(r,c+"{"+o.body+"}",[""],t,n,s&&!o.post.length),a=!1,!o.post.length)break;e=o.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),f=u||d,p=o.body.indexOf(",")>=0;if(!f&&!p){if(o.post.match(/,(?!,).*\}/)){e=o.pre+"{"+o.body+Yb+o.post,i=!0;continue}return Zc(r,c+"{"+o.body+"}"+o.post,[""],t,n,s)}a&&(s=i&&!f,a=!1);let h;if(f)h=Dee(o.body,d,t,n);else{let g=T$(o.body);if(g.length===1&&g[0]!==void 0&&(g=Qb(g[0],t,n,!1).map(Nee),g.length===1)){if(r=Zc(r,c+g[0],[""],t,n,s&&!o.post.length),!o.post.length)break;e=o.post;continue}let y=s&&!o.post.length&&!c;for(let x=0;y&&x<r.length;x++)r[x]&&(y=!1);h=[];let w=0;e:for(let x=0;x<g.length;x++){let k=Qb(g[x],t,n,!1);for(let E=0;E<k.length;E++){let A=k[E];if(!(y&&!A)){if(h.length>=t||w+A.length>n)break e;h.push(A),w+=A.length}}}}if(r=Zc(r,c,h,t,n,s&&!o.post.length),!o.post.length)break;e=o.post}return r}l(Qb,"expand_");var Kc=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Lee={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Xc=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Mee=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),R$=l(e=>e.join(""),"rangesToString"),O$=l((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let i=[],r=[],s=n+1,a=!1,o=!1,c=!1,u=!1,d=n,f="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&a&&!c){d=s+1;break}if(a=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[w,[x,k,E]]of Object.entries(Lee))if(e.startsWith(w,s)){if(f)return["$.",!1,e.length-n,!0];s+=w.length,E?r.push(x):i.push(x),o=o||k;continue e}}if(c=!1,f){y>f?i.push(Xc(f)+"-"+Xc(y)):y===f&&i.push(Xc(y)),f="",s++;continue}if(e.startsWith("-]",s+1)){i.push(Xc(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=y,s+=2;continue}i.push(Xc(y)),s++}if(d<s)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-n,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let y=i[0].length===2?i[0].slice(-1):i[0];return[Mee(y),!1,d-n,!1]}let p="["+(u?"^":"")+R$(i)+"]",h="["+(u?"":"^")+R$(r)+"]";return[i.length&&r.length?"("+p+"|"+h+")":i.length?p:h,o,d-n,!0]},"parseClass");var Cs=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var lr,jee=new Set(["!","?","+","*","@"]),ex=l(e=>jee.has(e),"isExtglobType"),P$=l(e=>ex(e.type),"isExtglobAST"),Fee=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Uee=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),zee=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),D$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Bee="(?!(?:^|/)\\.\\.?(?:$|/))",lh="(?!\\.)",Wee=new Set(["[","."]),qee=new Set(["..","."]),Hee=new Set("().*{}+?[]^$\\!"),Gee=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),tx="[^/]",L$=tx+"*?",M$=tx+"+?",Vee=0,wa=class{static{l(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#o;#u=!1;#l;#a;#c=!1;id=++Vee;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,i={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?i:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#u&&this.#o.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,i=n.#i;for(;i;){for(let r=n.#s+1;!i.type&&r<i.#t.length;r++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(i.#t[r])}n=i,i=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof lr&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let i=t.#t[n];if(!(i instanceof lr&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new lr(this.type,t);for(let i of this.#t)n.copyIn(i);return n}static#h(t,n,i,r,s){let a=r.maxExtglobRecursion??2,o=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=i,w="";for(;y<t.length;){let x=t.charAt(y++);if(o||x==="\\"){o=!o,w+=x;continue}if(c){y===u+1?(x==="^"||x==="!")&&(d=!0):x==="]"&&!(y===u+2&&d)&&(c=!1),w+=x;continue}else if(x==="["){c=!0,u=y,d=!1,w+=x;continue}if(!r.noext&&ex(x)&&t.charAt(y)==="("&&s<=a){n.push(w),w="";let E=new lr(x,n);y=lr.#h(t,E,y,r,s+1),n.push(E);continue}w+=x}return n.push(w),y}let f=i+1,p=new lr(null,n),h=[],g="";for(;f<t.length;){let y=t.charAt(f++);if(o||y==="\\"){o=!o,g+=y;continue}if(c){f===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(f===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=f,d=!1,g+=y;continue}if(!r.noext&&ex(y)&&t.charAt(f)==="("&&(s<=a||n&&n.#g(y))){let x=n&&n.#g(y)?0:1;p.push(g),g="";let k=new lr(y,p);p.push(k),f=lr.#h(t,k,f,r,s+x);continue}if(y==="|"){p.push(g),g="",h.push(p),p=new lr(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),p.push(g),g="",n.push(...h,p),f;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(i-1)],f}#T(t){return this.#m(t,Uee)}#m(t,n=Fee){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let i=t.#t[0];return!i||typeof i!="object"||i.type===null?!1:this.#g(i.type,n)}#g(t,n=zee){return!!n.get(this.type)?.includes(t)}#f(t,n){let i=t.#t[0],r=new lr(null,i,this.options);r.#t.push(""),i.push(r),this.#E(t,n)}#E(t,n){let i=t.#t[0];this.#t.splice(n,1,...i.#t);for(let r of i.#t)typeof r=="object"&&(r.#i=this);this.#a=void 0}#S(t){return!!D$.get(this.type)?.has(t)}#N(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#S(n.type)}#y(t){let n=D$.get(this.type),i=t.#t[0],r=n?.get(i.type);if(!r)return!1;this.#t=i.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=r,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let i=new lr(null,void 0,n);return lr.#h(t,i,0,n,0),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,i,r,s]=this.toRegExpSource();if(!(r||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let o=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,o),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!P$(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,w,x]=typeof h=="string"?lr.#k(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||w,this.#r=this.#r||x,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&qee.has(this.#t[0]))){let g=Wee,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),w=!n&&!t&&g.has(u.charAt(0));d=y?Bee:w?lh:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,Cs(u),this.#n=!!this.#n,this.#r]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,Cs(this.toString()),!1,!1]}let a=!i||t||n||!lh?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#c)o=(this.isStart()&&!n?lh:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?lh:"")+L$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=r+s+c}return[o,Cs(s),this.#n=!!this.#n,this.#r]}#p(){if(P$(this)){let t=0,n=!1;do{n=!0;for(let i=0;i<this.#t.length;i++){let r=this.#t[i];typeof r=="object"&&(r.#p(),this.#m(r)?(n=!1,this.#E(r,i)):this.#T(r)?(n=!1,this.#f(r,i)):this.#N(r)&&(n=!1,this.#y(r)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#a=void 0}#v(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[i,r,s,a]=n.toRegExpSource(t);return this.#r=this.#r||a,i}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#k(t,n,i=!1){let r=!1,s="",a=!1,o=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(r){r=!1,s+=(Hee.has(u)?"\\":"")+u;continue}if(u==="*"){if(o)continue;o=!0,s+=i&&/^[*]+$/.test(t)?M$:L$,n=!0;continue}else o=!1;if(u==="\\"){c===t.length-1?s+="\\\\":r=!0;continue}if(u==="["){let[d,f,p,h]=O$(t,c);if(p){s+=d,a=a||f,c+=p-1,n=n||h;continue}}if(u==="?"){s+=tx,n=!0;continue}s+=Gee(u)}return[s,Cs(t),!!n,a]}};lr=wa;var nx=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Sn=l((e,t,n={})=>(Kc(t),!n.nocomment&&t.charAt(0)==="#"?!1:new Fo(t,n).match(e)),"minimatch"),Zee=/^\*+([^+@!?*[(]*)$/,Kee=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),Xee=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Jee=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Qee=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),Yee=/^\*+\.\*+$/,ete=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),tte=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),nte=/^\.\*+$/,rte=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),ite=/^\*+$/,ste=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),ate=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),ote=/^\?+([^+@!?*[(]*)?$/,lte=l(([e,t=""])=>{let n=U$([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),cte=l(([e,t=""])=>{let n=z$([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),ute=l(([e,t=""])=>{let n=z$([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTestDot"),dte=l(([e,t=""])=>{let n=U$([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTest"),U$=l(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),z$=l(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),B$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",j$={win32:{sep:"\\"},posix:{sep:"/"}},fte=B$==="win32"?j$.win32.sep:j$.posix.sep;Sn.sep=fte;var jn=Symbol("globstar **");Sn.GLOBSTAR=jn;var pte="[^/]",hte=pte+"*?",mte="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gte="(?:(?!(?:\\/|^)\\.).)*?",yte=l((e,t={})=>n=>Sn(n,e,t),"filter");Sn.filter=yte;var Cr=l((e,t={})=>Object.assign({},e,t),"ext"),vte=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Sn;let t=Sn;return Object.assign(l((i,r,s={})=>t(i,r,Cr(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(r,s={}){super(r,Cr(e,s))}static defaults(r){return t.defaults(Cr(e,r)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(r,s,a={}){super(r,s,Cr(e,a))}static fromGlob(r,s={}){return t.AST.fromGlob(r,Cr(e,s))}},unescape:l((i,r={})=>t.unescape(i,Cr(e,r)),"unescape"),escape:l((i,r={})=>t.escape(i,Cr(e,r)),"escape"),filter:l((i,r={})=>t.filter(i,Cr(e,r)),"filter"),defaults:l(i=>t.defaults(Cr(e,i)),"defaults"),makeRe:l((i,r={})=>t.makeRe(i,Cr(e,r)),"makeRe"),braceExpand:l((i,r={})=>t.braceExpand(i,Cr(e,r)),"braceExpand"),match:l((i,r,s={})=>t.match(i,r,Cr(e,s)),"match"),sep:t.sep,GLOBSTAR:jn})},"defaults");Sn.defaults=vte;var W$=l((e,t={})=>(Kc(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:N$(e,{max:t.braceExpandMax})),"braceExpand");Sn.braceExpand=W$;var wte=l((e,t={})=>new Fo(e,t).makeRe(),"makeRe");Sn.makeRe=wte;var bte=l((e,t,n={})=>{let i=new Fo(t,n);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e},"match");Sn.match=bte;var F$=/[?*]|[+@!]\(.*?\)|\[|\]/,xte=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Fo=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){Kc(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||B$,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!F$.test(s[2]))&&!F$.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,r),this.set=r.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let r=0;r<i.length;r++)i[r]==="**"&&(i[r]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let r=i;for(;n[r+1]==="**";)r++;r!==i&&n.splice(i,r-i)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((i,r)=>{let s=i[i.length-1];return r==="**"&&s==="**"?i:r===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(i.pop(),i):(i.push(r),i)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let s=t[r];r===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(n=!0,t.splice(i-1,2),i-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let a=r;for(;i[a+1]==="**";)a++;a>r&&i.splice(r+1,a-r);let o=i[r+1],c=i[r+2],u=i[r+3];if(o!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,i.splice(r,1);let d=i.slice(0);d[r]="**",t.push(d),r--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(n=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(n=!0,i.pop())}let s=0;for(;(s=i.indexOf("..",s+1))!==-1;){let a=i[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=s===1&&i[s+1]==="**"?["."]:[];i.splice(s-1,2,...c),i.length===0&&i.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let i=n+1;i<t.length;i++){let r=this.partsMatch(t[n],t[i],!this.preserveMultipleSlashes);if(r){t[n]=[],t[i]=r;break}}return t.filter(n=>n.length)}partsMatch(t,n,i=!1){let r=0,s=0,a=[],o="";for(;r<t.length&&s<n.length;)if(t[r]===n[s])a.push(o==="b"?n[s]:t[r]),r++,s++;else if(i&&t[r]==="**"&&n[s]===t[r+1])a.push(t[r]),r++;else if(i&&n[s]==="**"&&t[r]===n[s+1])a.push(n[s]),s++;else if(t[r]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(o==="b")return!1;o="a",a.push(t[r]),r++,s++}else if(n[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(o==="a")return!1;o="b",a.push(n[s]),r++,s++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let r=0,s=0;if(this.isWindows){let o=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!o&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),f=c?3:o?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,g]=[t[f],n[p]];h.toLowerCase()===g.toLowerCase()&&(n[p]=h,s=p,r=f)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(jn)?this.#e(t,n,i,r,s):this.#r(t,n,i,r,s)}#e(t,n,i,r,s){let a=n.indexOf(jn,s),o=n.lastIndexOf(jn),[c,u,d]=i?[n.slice(s,a),n.slice(a+1),[]]:[n.slice(s,a),n.slice(a+1,o),n.slice(o+1)];if(c.length){let k=t.slice(r,r+c.length);if(!this.#r(k,c,i,0,0))return!1;r+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+r>t.length)return!1;let k=t.length-d.length;if(this.#r(t,d,i,k,0))f=d.length;else{if(t[t.length-1]!==""||r+d.length===t.length||(k--,!this.#r(t,d,i,k,0)))return!1;f=d.length+1}}if(!u.length){let k=!!f;for(let E=r;E<t.length-f;E++){let A=String(t[E]);if(k=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return i||k}let p=[[[],0]],h=p[0],g=0,y=[0];for(let k of u)k===jn?(y.push(g),h=[[],0],p.push(h)):(h[0].push(k),g++);let w=p.length-1,x=t.length-f;for(let k of p)k[1]=x-(y[w--]+k[0].length);return!!this.#n(t,p,r,0,i,0,!!f)}#n(t,n,i,r,s,a,o){let c=n[r];if(!c){for(let f=i;f<t.length;f++){o=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return o}let[u,d]=c;for(;i<=d;){if(this.#r(t.slice(0,i+u.length),u,s,i,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,i+u.length,r+1,s,a+1,o);if(h!==!1)return h}let p=t[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return s||null}#r(t,n,i,r,s){let a,o,c,u;for(a=r,o=s,u=t.length,c=n.length;a<u&&o<c;a++,o++){this.debug("matchOne loop");let d=n[o],f=t[a];if(this.debug(n,d,f),d===!1||d===jn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(a===u&&o===c)return!0;if(a===u)return i;if(o===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return W$(this.pattern,this.options)}parse(t){Kc(t);let n=this.options;if(t==="**")return jn;if(t==="")return"";let i,r=null;(i=t.match(ite))?r=n.dot?ate:ste:(i=t.match(Zee))?r=(n.nocase?n.dot?Qee:Jee:n.dot?Xee:Kee)(i[1]):(i=t.match(ote))?r=(n.nocase?n.dot?cte:lte:n.dot?ute:dte)(i):(i=t.match(Yee))?r=n.dot?tte:ete:(i=t.match(nte))&&(r=rte);let s=wa.fromGlob(t,this.options).toMMPattern();return r&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:r}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?hte:n.dot?mte:gte,r=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?xte(f):f===jn?jn:f._src});u.forEach((f,p)=>{let h=u[p+1],g=u[p-1];f!==jn||g===jn||(g===void 0?h!==void 0&&h!==jn?u[p+1]="(?:\\/|"+i+"\\/)?"+h:u[p]=i:h===void 0?u[p-1]=g+"(?:\\/|\\/"+i+")?":h!==jn&&(u[p-1]=g+"(?:\\/|\\/"+i+"\\/)"+h,u[p+1]=jn))});let d=u.filter(f=>f!==jn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.partial&&(s="^(?:\\/|"+a+s.slice(1,-1)+o+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let s=this.set;this.debug(this.pattern,"set",s);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o of s){let c=r;if(i.matchBase&&o.length===1&&(c=[a]),this.matchOne(c,o,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return Sn.defaults(t).Minimatch}};Sn.AST=wa;Sn.Minimatch=Fo;Sn.escape=nx;Sn.unescape=Cs;import{gunzipSync as Ure}from"node:zlib";var Jc=class{static{l(this,"Diff")}diff(t,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);let s=this.castInput(t,i),a=this.castInput(n,i),o=this.removeEmpty(this.tokenize(s,i)),c=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,c,i,r)}diffWithOptionsObj(t,n,i,r){var s;let a=l(k=>{if(k=this.postProcess(k,i),r){setTimeout(function(){r(k)},0);return}else return k},"done"),o=n.length,c=t.length,u=1,d=o+c;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,i);if(h[0].oldPos+1>=c&&g+1>=o)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,w=1/0,x=l(()=>{for(let k=Math.max(y,-u);k<=Math.min(w,u);k+=2){let E,A=h[k-1],S=h[k+1];A&&(h[k-1]=void 0);let _=!1;if(S){let L=S.oldPos-k;_=S&&0<=L&&L<o}let T=A&&A.oldPos+1<c;if(!_&&!T){h[k]=void 0;continue}if(!T||_&&A.oldPos<S.oldPos?E=this.addToPath(S,!0,!1,0,i):E=this.addToPath(A,!1,!0,1,i),g=this.extractCommon(E,n,t,k,i),E.oldPos+1>=c&&g+1>=o)return a(this.buildValues(E.lastComponent,n,t))||!0;h[k]=E,E.oldPos+1>=c&&(w=Math.min(w,k-1)),g+1>=o&&(y=Math.max(y,k+1))}u++},"execEditLength");if(r)l(function k(){setTimeout(function(){if(u>d||Date.now()>p)return r(void 0);x()||k()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let k=x();if(k)return k}}addToPath(t,n,i,r,s){let a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===i?{oldPos:t.oldPos+r,lastComponent:{count:a.count+1,added:n,removed:i,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:a}}}extractCommon(t,n,i,r,s){let a=n.length,o=i.length,c=t.oldPos,u=c-r,d=0;for(;u+1<a&&c+1<o&&this.equals(i[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){let r=[],s;for(;t;)r.push(t),s=t.previousComponent,delete t.previousComponent,t=s;r.reverse();let a=r.length,o=0,c=0,u=0;for(;o<a;o++){let d=r[o];if(d.removed)d.value=this.join(i.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(p,h){let g=i[u+h];return g.length>p.length?g:p}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return r}};var rx=class extends Jc{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Ste}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
710
+ `}l(x$,"pageStyles");var Zb={name:"dsh-edge",version:"0.3.0",description:"Run DeepSeek Harness on Cloudflare Workers as an independent community project",author:"pawaca",license:"MIT",type:"module",bin:{"dsh-edge":"scripts/cli.mjs"},files:["dist","worker","scripts/*.d.mts","scripts/*.mjs","wrangler.jsonc","README.md","README.zh.md","LICENSE","THIRD_PARTY_NOTICES.md"],repository:{type:"git",url:"git+https://github.com/pawaca/dsh-edge.git",directory:"apps/dsh-edge"},homepage:"https://github.com/pawaca/dsh-edge/tree/master/apps/dsh-edge#readme",bugs:{url:"https://github.com/pawaca/dsh-edge/issues"},keywords:["deepseek","agent","cloudflare-workers","durable-objects"],engines:{node:">=22.14.0"},publishConfig:{access:"public"},dshEdge:{upstreamVersion:"0.1.1-rc.1"},scripts:{"bundle:direct":"pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct","bundle:isolated":"pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated","bundle:workers":"pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",dev:"pnpm run bundle:direct && node scripts/dev.mjs direct","dev:isolated":"pnpm run bundle:isolated && node scripts/dev.mjs isolated","dsh-edge":"node scripts/cli.mjs","example:install":"node examples/install-keyless.mjs","install:cloudflare":"pnpm run bundle:workers && node scripts/cli.mjs install","legal:write":"node scripts/legal-files.mjs write","pack:verify":"node scripts/verify-packed.mjs",prepack:"node scripts/legal-files.mjs verify && pnpm run bundle:workers","web:build":"pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",test:"vitest run --root ../.. --project edge-runtime","test:integration":"pnpm run bundle:workers && node tests/run-session-integration.mjs","test:snapshot":"vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"1.7.0","compare-versions":"6.1.1",execa:"^10.0.0","jsonc-parser":"^3.3.1",wrangler:"4.123.0"},devDependencies:{"@cloudflare/computer":"0.2.0","@cloudflare/workers-types":"5.20260812.1","@deepseek-ai/cordis":"4.0.1","@deepseek-ai/dsh-agent":"0.1.1-rc.1","@deepseek-ai/dsh-agent-loop":"0.1.1-rc.1","@deepseek-ai/dsh-anonymous-user-id":"0.1.1-rc.1","@deepseek-ai/dsh-attachment":"0.1.1-rc.1","@deepseek-ai/dsh-brand":"0.1.1-rc.1","@deepseek-ai/dsh-credentials":"0.1.1-rc.1","@deepseek-ai/dsh-host-apiproxy":"0.1.1-rc.1","@deepseek-ai/dsh-launch-environment":"0.1.1-rc.1","@deepseek-ai/dsh-llm":"0.1.1-rc.1","@deepseek-ai/dsh-llm-deepseek":"0.1.1-rc.1","@deepseek-ai/dsh-session":"0.1.1-rc.1","@deepseek-ai/dsh-session-persistence":"0.1.1-rc.1","@deepseek-ai/dsh-session-query":"0.1.1-rc.1","@deepseek-ai/dsh-session-title":"0.1.1-rc.1","@deepseek-ai/dsh-settings":"0.1.1-rc.1","@deepseek-ai/dsh-system-prompt":"0.1.1-rc.1","@deepseek-ai/dsh-tool-call-timeout-policy":"0.1.1-rc.1","@deepseek-ai/dsh-tool-web":"0.1.1-rc.1","@deepseek-ai/dsh-tools":"0.1.1-rc.1","@deepseek-ai/dsh-web":"0.1.1-rc.1","@deepseek-ai/dsh-web-search-deepseek":"0.1.1-rc.1","just-bash":"3.3.0","fast-png":"8.0.0","jpeg-js":"0.4.4",playwright:"^1.49.0",typescript:"^6.0.3",vitest:"^4.1.8",ws:"^8.21.0"}};var sh=Zb.version,E$=Zb.dshEdge.upstreamVersion;function pee(){return"dsh-edge@0.3.0/isolated"}l(pee,"resolveEdgeDeploymentId");function ah(e){return a$(e.DEEPSEEK_API_KEY),{baseURL:Mw(e.DEEPSEEK_BASE_URL),maxTokens:Uw(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Tc(e.DEEPSEEK_MODEL),reasoningEffort:jw(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:qp(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Fw(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:qc(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(ah,"resolveEdgeDeploymentConfig");function hee(e){return typeof e.DEEPSEEK_API_KEY=="string"&&e.DEEPSEEK_API_KEY.trim().length>0}l(hee,"edgeDeploymentApiKeyConfigured");function mee(e){let t=Mw(e),n=new URL(t);return n.search.length===0&&n.hash.length===0?t:(n.search="",n.hash="",n.href)}l(mee,"projectedEdgeBaseURL");function Kb(e,t){return{shell:e.LOADER===void 0?"just-bash-direct":"just-bash-isolated",storage:"durable-object-sqlite-vfs",attachmentStorage:t??(e.DSH_EDGE_ATTACHMENTS===void 0?"temporary-do":"private-r2"),deploymentId:pee(),apiKeyConfigured:hee(e),baseURL:mee(e.DEEPSEEK_BASE_URL),maxTokens:Uw(e.DEEPSEEK_MAX_OUTPUT_TOKENS),model:Tc(e.DEEPSEEK_MODEL),reasoningEffort:jw(e.DEEPSEEK_REASONING_EFFORT),searchBaseURL:qp(e.DEEPSEEK_SEARCH_BASE_URL),streamIdleTimeoutMs:Fw(e.DEEPSEEK_STREAM_IDLE_TIMEOUT_MS),commandTimeoutPolicy:qc(e.DSH_EDGE_DEFAULT_COMMAND_TIMEOUT_MS,e.DSH_EDGE_MAX_COMMAND_TIMEOUT_MS)}}l(Kb,"resolveEdgeDeploymentProfile");function S$(e){ah(e);let t=Kb(e);return{ok:!0,service:"dsh-edge",storage:t.storage,attachmentStorage:t.attachmentStorage,shell:t.shell,agent:"upstream-react-loop-agent",access:"single-owner-cookie",deploymentId:t.deploymentId,version:sh,upstreamVersion:E$,status:"ready"}}l(S$,"resolveEdgeDeploymentHealth");import{WorkerEntrypoint as YSe}from"cloudflare:workers";var La=Wm(k$(),1);var Xb=l((e,t,n)=>{let i=e instanceof RegExp?A$(e,n):e,r=t instanceof RegExp?A$(t,n):t,s=i!==null&&r!=null&&gee(i,r,n);return s&&{start:s[0],end:s[1],pre:n.slice(0,s[0]),body:n.slice(s[0]+i.length,s[1]),post:n.slice(s[1]+r.length)}},"balanced"),A$=l((e,t)=>{let n=t.match(e);return n?n[0]:null},"maybeMatch"),gee=l((e,t,n)=>{let i,r,s,a,o,c=n.indexOf(e),u=n.indexOf(t,c+1),d=c;if(c>=0&&u>0){if(e===t)return[c,u];for(i=[],s=n.length;d>=0&&!o;){if(d===c)i.push(d),c=n.indexOf(e,d+1);else if(i.length===1){let f=i.pop();f!==void 0&&(o=[f,u])}else r=i.pop(),r!==void 0&&r<s&&(s=r,a=u),u=n.indexOf(t,d+1);d=c<u&&c>=0?c:u}i.length&&a!==void 0&&(o=[s,a])}return o},"range");var _$="\0SLASH"+Math.random()+"\0",I$="\0OPEN"+Math.random()+"\0",Yb="\0CLOSE"+Math.random()+"\0",$$="\0COMMA"+Math.random()+"\0",C$="\0PERIOD"+Math.random()+"\0",yee=new RegExp(_$,"g"),vee=new RegExp(I$,"g"),wee=new RegExp(Yb,"g"),bee=new RegExp($$,"g"),xee=new RegExp(C$,"g"),Eee=/\\\\/g,See=/\\{/g,kee=/\\}/g,Aee=/\\,/g,_ee=/\\\./g,Iee=1e5,$ee=4e6;function Jb(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}l(Jb,"numeric");function Cee(e){return e.replace(Eee,_$).replace(See,I$).replace(kee,Yb).replace(Aee,$$).replace(_ee,C$)}l(Cee,"escapeBraces");function Tee(e){return e.replace(yee,"\\").replace(vee,"{").replace(wee,"}").replace(bee,",").replace(xee,".")}l(Tee,"unescapeBraces");function T$(e){if(!e)return[""];let t=[],n=Xb("{","}",e);if(!n)return e.split(",");let{pre:i,body:r,post:s}=n,a=i.split(",");a[a.length-1]+="{"+r+"}";let o=T$(s);return s.length&&(a[a.length-1]+=o.shift(),a.push.apply(a,o)),t.push.apply(t,a),t}l(T$,"parseCommaParts");function N$(e,t={}){if(!e)return[];let{max:n=Iee,maxLength:i=$ee}=t;return e.slice(0,2)==="{}"&&(e="\\{\\}"+e.slice(2)),Qb(Cee(e),n,i,!0).map(Tee)}l(N$,"expand");function Nee(e){return"{"+e+"}"}l(Nee,"embrace");function Ree(e){return/^-?0\d/.test(e)}l(Ree,"isPadded");function Oee(e,t){return e<=t}l(Oee,"lte");function Pee(e,t){return e>=t}l(Pee,"gte");function Zc(e,t,n,i,r,s){let a=[],o=0;for(let c=0;c<e.length;c++)for(let u=0;u<n.length;u++){if(a.length>=i)return a;let d=e[c]+t+n[u];if(!(s&&!d)){if(o+d.length>r)return a;a.push(d),o+=d.length}}return a}l(Zc,"combine");function Dee(e,t,n,i){let r=e.split(/\.\./),s=[];if(r[0]===void 0||r[1]===void 0)return s;let a=Jb(r[0]),o=Jb(r[1]),c=Math.max(r[0].length,r[1].length),u=r.length===3&&r[2]!==void 0?Math.max(Math.abs(Jb(r[2])),1):1,d=Oee;o<a&&(u*=-1,d=Pee);let p=r.some(Ree),h=0;for(let g=a;d(g,o)&&s.length<n;g+=u){let y;if(t)y=String.fromCharCode(g),y==="\\"&&(y="");else if(y=String(g),p){let w=c-y.length;if(w>0){let x=new Array(w+1).join("0");g<0?y="-"+x+y.slice(1):y=x+y}}if(h+y.length>i)break;s.push(y),h+=y.length}return s}l(Dee,"expandSequence");function Qb(e,t,n,i){let r=[""],s=!1,a=!0;for(;;){let o=Xb("{","}",e);if(!o)return Zc(r,e,[""],t,n,s);let c=o.pre;if(/\$$/.test(c)){if(r=Zc(r,c+"{"+o.body+"}",[""],t,n,s&&!o.post.length),a=!1,!o.post.length)break;e=o.post;continue}let u=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(o.body),d=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(o.body),f=u||d,p=o.body.indexOf(",")>=0;if(!f&&!p){if(o.post.match(/,(?!,).*\}/)){e=o.pre+"{"+o.body+Yb+o.post,i=!0;continue}return Zc(r,c+"{"+o.body+"}"+o.post,[""],t,n,s)}a&&(s=i&&!f,a=!1);let h;if(f)h=Dee(o.body,d,t,n);else{let g=T$(o.body);if(g.length===1&&g[0]!==void 0&&(g=Qb(g[0],t,n,!1).map(Nee),g.length===1)){if(r=Zc(r,c+g[0],[""],t,n,s&&!o.post.length),!o.post.length)break;e=o.post;continue}let y=s&&!o.post.length&&!c;for(let x=0;y&&x<r.length;x++)r[x]&&(y=!1);h=[];let w=0;e:for(let x=0;x<g.length;x++){let k=Qb(g[x],t,n,!1);for(let E=0;E<k.length;E++){let A=k[E];if(!(y&&!A)){if(h.length>=t||w+A.length>n)break e;h.push(A),w+=A.length}}}}if(r=Zc(r,c,h,t,n,s&&!o.post.length),!o.post.length)break;e=o.post}return r}l(Qb,"expand_");var Kc=l(e=>{if(typeof e!="string")throw new TypeError("invalid pattern");if(e.length>65536)throw new TypeError("pattern is too long")},"assertValidPattern");var Lee={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},Xc=l(e=>e.replace(/[[\]\\-]/g,"\\$&"),"braceEscape"),Mee=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regexpEscape"),R$=l(e=>e.join(""),"rangesToString"),O$=l((e,t)=>{let n=t;if(e.charAt(n)!=="[")throw new Error("not in a brace expression");let i=[],r=[],s=n+1,a=!1,o=!1,c=!1,u=!1,d=n,f="";e:for(;s<e.length;){let y=e.charAt(s);if((y==="!"||y==="^")&&s===n+1){u=!0,s++;continue}if(y==="]"&&a&&!c){d=s+1;break}if(a=!0,y==="\\"&&!c){c=!0,s++;continue}if(y==="["&&!c){for(let[w,[x,k,E]]of Object.entries(Lee))if(e.startsWith(w,s)){if(f)return["$.",!1,e.length-n,!0];s+=w.length,E?r.push(x):i.push(x),o=o||k;continue e}}if(c=!1,f){y>f?i.push(Xc(f)+"-"+Xc(y)):y===f&&i.push(Xc(y)),f="",s++;continue}if(e.startsWith("-]",s+1)){i.push(Xc(y+"-")),s+=2;continue}if(e.startsWith("-",s+1)){f=y,s+=2;continue}i.push(Xc(y)),s++}if(d<s)return["",!1,0,!1];if(!i.length&&!r.length)return["$.",!1,e.length-n,!0];if(r.length===0&&i.length===1&&/^\\?.$/.test(i[0])&&!u){let y=i[0].length===2?i[0].slice(-1):i[0];return[Mee(y),!1,d-n,!1]}let p="["+(u?"^":"")+R$(i)+"]",h="["+(u?"":"^")+R$(r)+"]";return[i.length&&r.length?"("+p+"|"+h+")":i.length?p:h,o,d-n,!0]},"parseClass");var Cs=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\])\]/g,"$1$2").replace(/\\([^/])/g,"$1"):t?e.replace(/\[([^/\\{}])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,"$1$2").replace(/\\([^/{}])/g,"$1"),"unescape");var lr,jee=new Set(["!","?","+","*","@"]),ex=l(e=>jee.has(e),"isExtglobType"),P$=l(e=>ex(e.type),"isExtglobAST"),Fee=new Map([["!",["@"]],["?",["?","@"]],["@",["@"]],["*",["*","+","?","@"]],["+",["+","@"]]]),Uee=new Map([["!",["?"]],["@",["?"]],["+",["?","*"]]]),zee=new Map([["!",["?","@"]],["?",["?","@"]],["@",["?","@"]],["*",["*","+","?","@"]],["+",["+","@","?","*"]]]),D$=new Map([["!",new Map([["!","@"]])],["?",new Map([["*","*"],["+","*"]])],["@",new Map([["!","!"],["?","?"],["@","@"],["*","*"],["+","+"]])],["+",new Map([["?","*"],["*","*"]])]]),Bee="(?!(?:^|/)\\.\\.?(?:$|/))",lh="(?!\\.)",Wee=new Set(["[","."]),qee=new Set(["..","."]),Hee=new Set("().*{}+?[]^$\\!"),Gee=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),tx="[^/]",L$=tx+"*?",M$=tx+"+?",Vee=0,wa=class{static{l(this,"AST")}type;#e;#n;#r=!1;#t=[];#i;#s;#o;#u=!1;#l;#a;#c=!1;id=++Vee;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for("nodejs.util.inspect.custom")](){return{"@@type":"AST",id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#t.length,parts:this.#t}}constructor(t,n,i={}){this.type=t,t&&(this.#n=!0),this.#i=n,this.#e=this.#i?this.#i.#e:this,this.#l=this.#e===this?i:this.#e.#l,this.#o=this.#e===this?[]:this.#e.#o,t==="!"&&!this.#e.#u&&this.#o.push(this),this.#s=this.#i?this.#i.#t.length:0}get hasMagic(){if(this.#n!==void 0)return this.#n;for(let t of this.#t)if(typeof t!="string"&&(t.type||t.hasMagic))return this.#n=!0;return this.#n}toString(){return this.#a!==void 0?this.#a:this.type?this.#a=this.type+"("+this.#t.map(t=>String(t)).join("|")+")":this.#a=this.#t.map(t=>String(t)).join("")}#x(){if(this!==this.#e)throw new Error("should only call on root");if(this.#u)return this;this.toString(),this.#u=!0;let t;for(;t=this.#o.pop();){if(t.type!=="!")continue;let n=t,i=n.#i;for(;i;){for(let r=n.#s+1;!i.type&&r<i.#t.length;r++)for(let s of t.#t){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(i.#t[r])}n=i,i=n.#i}}return this}push(...t){for(let n of t)if(n!==""){if(typeof n!="string"&&!(n instanceof lr&&n.#i===this))throw new Error("invalid part: "+n);this.#t.push(n)}}toJSON(){let t=this.type===null?this.#t.slice().map(n=>typeof n=="string"?n:n.toJSON()):[this.type,...this.#t.map(n=>n.toJSON())];return this.isStart()&&!this.type&&t.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#u&&this.#i?.type==="!")&&t.push({}),t}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#s===0)return!0;let t=this.#i;for(let n=0;n<this.#s;n++){let i=t.#t[n];if(!(i instanceof lr&&i.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type==="!")return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let t=this.#i?this.#i.#t.length:0;return this.#s===t-1}copyIn(t){typeof t=="string"?this.push(t):this.push(t.clone(this))}clone(t){let n=new lr(this.type,t);for(let i of this.#t)n.copyIn(i);return n}static#h(t,n,i,r,s){let a=r.maxExtglobRecursion??2,o=!1,c=!1,u=-1,d=!1;if(n.type===null){let y=i,w="";for(;y<t.length;){let x=t.charAt(y++);if(o||x==="\\"){o=!o,w+=x;continue}if(c){y===u+1?(x==="^"||x==="!")&&(d=!0):x==="]"&&!(y===u+2&&d)&&(c=!1),w+=x;continue}else if(x==="["){c=!0,u=y,d=!1,w+=x;continue}if(!r.noext&&ex(x)&&t.charAt(y)==="("&&s<=a){n.push(w),w="";let E=new lr(x,n);y=lr.#h(t,E,y,r,s+1),n.push(E);continue}w+=x}return n.push(w),y}let f=i+1,p=new lr(null,n),h=[],g="";for(;f<t.length;){let y=t.charAt(f++);if(o||y==="\\"){o=!o,g+=y;continue}if(c){f===u+1?(y==="^"||y==="!")&&(d=!0):y==="]"&&!(f===u+2&&d)&&(c=!1),g+=y;continue}else if(y==="["){c=!0,u=f,d=!1,g+=y;continue}if(!r.noext&&ex(y)&&t.charAt(f)==="("&&(s<=a||n&&n.#g(y))){let x=n&&n.#g(y)?0:1;p.push(g),g="";let k=new lr(y,p);p.push(k),f=lr.#h(t,k,f,r,s+x);continue}if(y==="|"){p.push(g),g="",h.push(p),p=new lr(null,n);continue}if(y===")")return g===""&&n.#t.length===0&&(n.#c=!0),p.push(g),g="",n.push(...h,p),f;g+=y}return n.type=null,n.#n=void 0,n.#t=[t.substring(i-1)],f}#T(t){return this.#m(t,Uee)}#m(t,n=Fee){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null)return!1;let i=t.#t[0];return!i||typeof i!="object"||i.type===null?!1:this.#g(i.type,n)}#g(t,n=zee){return!!n.get(this.type)?.includes(t)}#f(t,n){let i=t.#t[0],r=new lr(null,i,this.options);r.#t.push(""),i.push(r),this.#E(t,n)}#E(t,n){let i=t.#t[0];this.#t.splice(n,1,...i.#t);for(let r of i.#t)typeof r=="object"&&(r.#i=this);this.#a=void 0}#S(t){return!!D$.get(this.type)?.has(t)}#N(t){if(!t||typeof t!="object"||t.type!==null||t.#t.length!==1||this.type===null||this.#t.length!==1)return!1;let n=t.#t[0];return!n||typeof n!="object"||n.type===null?!1:this.#S(n.type)}#y(t){let n=D$.get(this.type),i=t.#t[0],r=n?.get(i.type);if(!r)return!1;this.#t=i.#t;for(let s of this.#t)typeof s=="object"&&(s.#i=this);this.type=r,this.#a=void 0,this.#c=!1}static fromGlob(t,n={}){let i=new lr(null,void 0,n);return lr.#h(t,i,0,n,0),i}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let t=this.toString(),[n,i,r,s]=this.toRegExpSource();if(!(r||this.#n||this.#l.nocase&&!this.#l.nocaseMagicOnly&&t.toUpperCase()!==t.toLowerCase()))return i;let o=(this.#l.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${n}$`,o),{_src:n,_glob:t})}get options(){return this.#l}toRegExpSource(t){let n=t??!!this.#l.dot;if(this.#e===this&&(this.#p(),this.#x()),!P$(this)){let c=this.isStart()&&this.isEnd()&&!this.#t.some(h=>typeof h!="string"),u=this.#t.map(h=>{let[g,y,w,x]=typeof h=="string"?lr.#k(h,this.#n,c):h.toRegExpSource(t);return this.#n=this.#n||w,this.#r=this.#r||x,g}).join(""),d="";if(this.isStart()&&typeof this.#t[0]=="string"&&!(this.#t.length===1&&qee.has(this.#t[0]))){let g=Wee,y=n&&g.has(u.charAt(0))||u.startsWith("\\.")&&g.has(u.charAt(2))||u.startsWith("\\.\\.")&&g.has(u.charAt(4)),w=!n&&!t&&g.has(u.charAt(0));d=y?Bee:w?lh:""}let f="";return this.isEnd()&&this.#e.#u&&this.#i?.type==="!"&&(f="(?:$|\\/)"),[d+u+f,Cs(u),this.#n=!!this.#n,this.#r]}let i=this.type==="*"||this.type==="+",r=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#v(n);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString(),u=this;return u.#t=[c],u.type=null,u.#n=void 0,[c,Cs(this.toString()),!1,!1]}let a=!i||t||n||!lh?"":this.#v(!0);a===s&&(a=""),a&&(s=`(?:${s})(?:${a})*?`);let o="";if(this.type==="!"&&this.#c)o=(this.isStart()&&!n?lh:"")+M$;else{let c=this.type==="!"?"))"+(this.isStart()&&!n&&!t?lh:"")+L$+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&a?")":this.type==="*"&&a?")?":`)${this.type}`;o=r+s+c}return[o,Cs(s),this.#n=!!this.#n,this.#r]}#p(){if(P$(this)){let t=0,n=!1;do{n=!0;for(let i=0;i<this.#t.length;i++){let r=this.#t[i];typeof r=="object"&&(r.#p(),this.#m(r)?(n=!1,this.#E(r,i)):this.#T(r)?(n=!1,this.#f(r,i)):this.#N(r)&&(n=!1,this.#y(r)))}}while(!n&&++t<10)}else for(let t of this.#t)typeof t=="object"&&t.#p();this.#a=void 0}#v(t){return this.#t.map(n=>{if(typeof n=="string")throw new Error("string type in extglob ast??");let[i,r,s,a]=n.toRegExpSource(t);return this.#r=this.#r||a,i}).filter(n=>!(this.isStart()&&this.isEnd())||!!n).join("|")}static#k(t,n,i=!1){let r=!1,s="",a=!1,o=!1;for(let c=0;c<t.length;c++){let u=t.charAt(c);if(r){r=!1,s+=(Hee.has(u)?"\\":"")+u;continue}if(u==="*"){if(o)continue;o=!0,s+=i&&/^[*]+$/.test(t)?M$:L$,n=!0;continue}else o=!1;if(u==="\\"){c===t.length-1?s+="\\\\":r=!0;continue}if(u==="["){let[d,f,p,h]=O$(t,c);if(p){s+=d,a=a||f,c+=p-1,n=n||h;continue}}if(u==="?"){s+=tx,n=!0;continue}s+=Gee(u)}return[s,Cs(t),!!n,a]}};lr=wa;var nx=l((e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,"[$&]"):e.replace(/[?*()[\]\\{}]/g,"\\$&"):t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),"escape");var Sn=l((e,t,n={})=>(Kc(t),!n.nocomment&&t.charAt(0)==="#"?!1:new Fo(t,n).match(e)),"minimatch"),Zee=/^\*+([^+@!?*[(]*)$/,Kee=l(e=>t=>!t.startsWith(".")&&t.endsWith(e),"starDotExtTest"),Xee=l(e=>t=>t.endsWith(e),"starDotExtTestDot"),Jee=l(e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),"starDotExtTestNocase"),Qee=l(e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),"starDotExtTestNocaseDot"),Yee=/^\*+\.\*+$/,ete=l(e=>!e.startsWith(".")&&e.includes("."),"starDotStarTest"),tte=l(e=>e!=="."&&e!==".."&&e.includes("."),"starDotStarTestDot"),nte=/^\.\*+$/,rte=l(e=>e!=="."&&e!==".."&&e.startsWith("."),"dotStarTest"),ite=/^\*+$/,ste=l(e=>e.length!==0&&!e.startsWith("."),"starTest"),ate=l(e=>e.length!==0&&e!=="."&&e!=="..","starTestDot"),ote=/^\?+([^+@!?*[(]*)?$/,lte=l(([e,t=""])=>{let n=U$([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocase"),cte=l(([e,t=""])=>{let n=z$([e]);return t?(t=t.toLowerCase(),i=>n(i)&&i.toLowerCase().endsWith(t)):n},"qmarksTestNocaseDot"),ute=l(([e,t=""])=>{let n=z$([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTestDot"),dte=l(([e,t=""])=>{let n=U$([e]);return t?i=>n(i)&&i.endsWith(t):n},"qmarksTest"),U$=l(([e])=>{let t=e.length;return n=>n.length===t&&!n.startsWith(".")},"qmarksTestNoExt"),z$=l(([e])=>{let t=e.length;return n=>n.length===t&&n!=="."&&n!==".."},"qmarksTestNoExtDot"),B$=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",j$={win32:{sep:"\\"},posix:{sep:"/"}},fte=B$==="win32"?j$.win32.sep:j$.posix.sep;Sn.sep=fte;var jn=Symbol("globstar **");Sn.GLOBSTAR=jn;var pte="[^/]",hte=pte+"*?",mte="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",gte="(?:(?!(?:\\/|^)\\.).)*?",yte=l((e,t={})=>n=>Sn(n,e,t),"filter");Sn.filter=yte;var Cr=l((e,t={})=>Object.assign({},e,t),"ext"),vte=l(e=>{if(!e||typeof e!="object"||!Object.keys(e).length)return Sn;let t=Sn;return Object.assign(l((i,r,s={})=>t(i,r,Cr(e,s)),"m"),{Minimatch:class extends t.Minimatch{static{l(this,"Minimatch")}constructor(r,s={}){super(r,Cr(e,s))}static defaults(r){return t.defaults(Cr(e,r)).Minimatch}},AST:class extends t.AST{static{l(this,"AST")}constructor(r,s,a={}){super(r,s,Cr(e,a))}static fromGlob(r,s={}){return t.AST.fromGlob(r,Cr(e,s))}},unescape:l((i,r={})=>t.unescape(i,Cr(e,r)),"unescape"),escape:l((i,r={})=>t.escape(i,Cr(e,r)),"escape"),filter:l((i,r={})=>t.filter(i,Cr(e,r)),"filter"),defaults:l(i=>t.defaults(Cr(e,i)),"defaults"),makeRe:l((i,r={})=>t.makeRe(i,Cr(e,r)),"makeRe"),braceExpand:l((i,r={})=>t.braceExpand(i,Cr(e,r)),"braceExpand"),match:l((i,r,s={})=>t.match(i,r,Cr(e,s)),"match"),sep:t.sep,GLOBSTAR:jn})},"defaults");Sn.defaults=vte;var W$=l((e,t={})=>(Kc(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:N$(e,{max:t.braceExpandMax})),"braceExpand");Sn.braceExpand=W$;var wte=l((e,t={})=>new Fo(e,t).makeRe(),"makeRe");Sn.makeRe=wte;var bte=l((e,t,n={})=>{let i=new Fo(t,n);return e=e.filter(r=>i.match(r)),i.options.nonull&&!e.length&&e.push(t),e},"match");Sn.match=bte;var F$=/[?*]|[+@!]\(.*?\)|\[|\]/,xte=l(e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"regExpEscape"),Fo=class{static{l(this,"Minimatch")}options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(t,n={}){Kc(t),n=n||{},this.options=n,this.maxGlobstarRecursion=n.maxGlobstarRecursion??200,this.pattern=t,this.platform=n.platform||B$,this.isWindows=this.platform==="win32";let i="allowWindowsEscape";this.windowsPathsNoEscape=!!n.windowsPathsNoEscape||n[i]===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!n.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!n.nonegate,this.comment=!1,this.empty=!1,this.partial=!!n.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=n.windowsNoMagicRoot!==void 0?n.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let t of this.set)for(let n of t)if(typeof n!="string")return!0;return!1}debug(...t){}make(){let t=this.pattern,n=this.options;if(!n.nocomment&&t.charAt(0)==="#"){this.comment=!0;return}if(!t){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],n.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let r=this.globParts.map((s,a,o)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!F$.test(s[2]))&&!F$.test(s[3]),u=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(d=>this.parse(d))];if(u)return[s[0],...s.slice(1).map(d=>this.parse(d))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,r),this.set=r.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let a=this.set[s];a[0]===""&&a[1]===""&&this.globParts[s][2]==="?"&&typeof a[3]=="string"&&/^[a-z]:$/i.test(a[3])&&(a[2]="?")}this.debug(this.pattern,this.set)}preprocess(t){if(this.options.noglobstar)for(let i of t)for(let r=0;r<i.length;r++)i[r]==="**"&&(i[r]="*");let{optimizationLevel:n=1}=this.options;return n>=2?(t=this.firstPhasePreProcess(t),t=this.secondPhasePreProcess(t)):n>=1?t=this.levelOneOptimize(t):t=this.adjascentGlobstarOptimize(t),t}adjascentGlobstarOptimize(t){return t.map(n=>{let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let r=i;for(;n[r+1]==="**";)r++;r!==i&&n.splice(i,r-i)}return n})}levelOneOptimize(t){return t.map(n=>(n=n.reduce((i,r)=>{let s=i[i.length-1];return r==="**"&&s==="**"?i:r===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(i.pop(),i):(i.push(r),i)},[]),n.length===0?[""]:n))}levelTwoFileOptimize(t){Array.isArray(t)||(t=this.slashSplit(t));let n=!1;do{if(n=!1,!this.preserveMultipleSlashes){for(let r=1;r<t.length-1;r++){let s=t[r];r===1&&s===""&&t[0]===""||(s==="."||s==="")&&(n=!0,t.splice(r,1),r--)}t[0]==="."&&t.length===2&&(t[1]==="."||t[1]==="")&&(n=!0,t.pop())}let i=0;for(;(i=t.indexOf("..",i+1))!==-1;){let r=t[i-1];r&&r!=="."&&r!==".."&&r!=="**"&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(n=!0,t.splice(i-1,2),i-=2)}}while(n);return t.length===0?[""]:t}firstPhasePreProcess(t){let n=!1;do{n=!1;for(let i of t){let r=-1;for(;(r=i.indexOf("**",r+1))!==-1;){let a=r;for(;i[a+1]==="**";)a++;a>r&&i.splice(r+1,a-r);let o=i[r+1],c=i[r+2],u=i[r+3];if(o!==".."||!c||c==="."||c===".."||!u||u==="."||u==="..")continue;n=!0,i.splice(r,1);let d=i.slice(0);d[r]="**",t.push(d),r--}if(!this.preserveMultipleSlashes){for(let a=1;a<i.length-1;a++){let o=i[a];a===1&&o===""&&i[0]===""||(o==="."||o==="")&&(n=!0,i.splice(a,1),a--)}i[0]==="."&&i.length===2&&(i[1]==="."||i[1]==="")&&(n=!0,i.pop())}let s=0;for(;(s=i.indexOf("..",s+1))!==-1;){let a=i[s-1];if(a&&a!=="."&&a!==".."&&a!=="**"){n=!0;let c=s===1&&i[s+1]==="**"?["."]:[];i.splice(s-1,2,...c),i.length===0&&i.push(""),s-=2}}}}while(n);return t}secondPhasePreProcess(t){for(let n=0;n<t.length-1;n++)for(let i=n+1;i<t.length;i++){let r=this.partsMatch(t[n],t[i],!this.preserveMultipleSlashes);if(r){t[n]=[],t[i]=r;break}}return t.filter(n=>n.length)}partsMatch(t,n,i=!1){let r=0,s=0,a=[],o="";for(;r<t.length&&s<n.length;)if(t[r]===n[s])a.push(o==="b"?n[s]:t[r]),r++,s++;else if(i&&t[r]==="**"&&n[s]===t[r+1])a.push(t[r]),r++;else if(i&&n[s]==="**"&&t[r]===n[s+1])a.push(n[s]),s++;else if(t[r]==="*"&&n[s]&&(this.options.dot||!n[s].startsWith("."))&&n[s]!=="**"){if(o==="b")return!1;o="a",a.push(t[r]),r++,s++}else if(n[s]==="*"&&t[r]&&(this.options.dot||!t[r].startsWith("."))&&t[r]!=="**"){if(o==="a")return!1;o="b",a.push(n[s]),r++,s++}else return!1;return t.length===n.length&&a}parseNegate(){if(this.nonegate)return;let t=this.pattern,n=!1,i=0;for(let r=0;r<t.length&&t.charAt(r)==="!";r++)n=!n,i++;i&&(this.pattern=t.slice(i)),this.negate=n}matchOne(t,n,i=!1){let r=0,s=0;if(this.isWindows){let o=typeof t[0]=="string"&&/^[a-z]:$/i.test(t[0]),c=!o&&t[0]===""&&t[1]===""&&t[2]==="?"&&/^[a-z]:$/i.test(t[3]),u=typeof n[0]=="string"&&/^[a-z]:$/i.test(n[0]),d=!u&&n[0]===""&&n[1]===""&&n[2]==="?"&&typeof n[3]=="string"&&/^[a-z]:$/i.test(n[3]),f=c?3:o?0:void 0,p=d?3:u?0:void 0;if(typeof f=="number"&&typeof p=="number"){let[h,g]=[t[f],n[p]];h.toLowerCase()===g.toLowerCase()&&(n[p]=h,s=p,r=f)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(t=this.levelTwoFileOptimize(t)),n.includes(jn)?this.#e(t,n,i,r,s):this.#r(t,n,i,r,s)}#e(t,n,i,r,s){let a=n.indexOf(jn,s),o=n.lastIndexOf(jn),[c,u,d]=i?[n.slice(s,a),n.slice(a+1),[]]:[n.slice(s,a),n.slice(a+1,o),n.slice(o+1)];if(c.length){let k=t.slice(r,r+c.length);if(!this.#r(k,c,i,0,0))return!1;r+=c.length,s+=c.length}let f=0;if(d.length){if(d.length+r>t.length)return!1;let k=t.length-d.length;if(this.#r(t,d,i,k,0))f=d.length;else{if(t[t.length-1]!==""||r+d.length===t.length||(k--,!this.#r(t,d,i,k,0)))return!1;f=d.length+1}}if(!u.length){let k=!!f;for(let E=r;E<t.length-f;E++){let A=String(t[E]);if(k=!0,A==="."||A===".."||!this.options.dot&&A.startsWith("."))return!1}return i||k}let p=[[[],0]],h=p[0],g=0,y=[0];for(let k of u)k===jn?(y.push(g),h=[[],0],p.push(h)):(h[0].push(k),g++);let w=p.length-1,x=t.length-f;for(let k of p)k[1]=x-(y[w--]+k[0].length);return!!this.#n(t,p,r,0,i,0,!!f)}#n(t,n,i,r,s,a,o){let c=n[r];if(!c){for(let f=i;f<t.length;f++){o=!0;let p=t[f];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1}return o}let[u,d]=c;for(;i<=d;){if(this.#r(t.slice(0,i+u.length),u,s,i,0)&&a<this.maxGlobstarRecursion){let h=this.#n(t,n,i+u.length,r+1,s,a+1,o);if(h!==!1)return h}let p=t[i];if(p==="."||p===".."||!this.options.dot&&p.startsWith("."))return!1;i++}return s||null}#r(t,n,i,r,s){let a,o,c,u;for(a=r,o=s,u=t.length,c=n.length;a<u&&o<c;a++,o++){this.debug("matchOne loop");let d=n[o],f=t[a];if(this.debug(n,d,f),d===!1||d===jn)return!1;let p;if(typeof d=="string"?(p=f===d,this.debug("string match",d,f,p)):(p=d.test(f),this.debug("pattern match",d,f,p)),!p)return!1}if(a===u&&o===c)return!0;if(a===u)return i;if(o===c)return a===u-1&&t[a]==="";throw new Error("wtf?")}braceExpand(){return W$(this.pattern,this.options)}parse(t){Kc(t);let n=this.options;if(t==="**")return jn;if(t==="")return"";let i,r=null;(i=t.match(ite))?r=n.dot?ate:ste:(i=t.match(Zee))?r=(n.nocase?n.dot?Qee:Jee:n.dot?Xee:Kee)(i[1]):(i=t.match(ote))?r=(n.nocase?n.dot?cte:lte:n.dot?ute:dte)(i):(i=t.match(Yee))?r=n.dot?tte:ete:(i=t.match(nte))&&(r=rte);let s=wa.fromGlob(t,this.options).toMMPattern();return r&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:r}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let t=this.set;if(!t.length)return this.regexp=!1,this.regexp;let n=this.options,i=n.noglobstar?hte:n.dot?mte:gte,r=new Set(n.nocase?["i"]:[]),s=t.map(c=>{let u=c.map(f=>{if(f instanceof RegExp)for(let p of f.flags.split(""))r.add(p);return typeof f=="string"?xte(f):f===jn?jn:f._src});u.forEach((f,p)=>{let h=u[p+1],g=u[p-1];f!==jn||g===jn||(g===void 0?h!==void 0&&h!==jn?u[p+1]="(?:\\/|"+i+"\\/)?"+h:u[p]=i:h===void 0?u[p-1]=g+"(?:\\/|\\/"+i+")?":h!==jn&&(u[p-1]=g+"(?:\\/|\\/"+i+"\\/)"+h,u[p+1]=jn))});let d=u.filter(f=>f!==jn);if(this.partial&&d.length>=1){let f=[];for(let p=1;p<=d.length;p++)f.push(d.slice(0,p).join("/"));return"(?:"+f.join("|")+")"}return d.join("/")}).join("|"),[a,o]=t.length>1?["(?:",")"]:["",""];s="^"+a+s+o+"$",this.partial&&(s="^(?:\\/|"+a+s.slice(1,-1)+o+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...r].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(t){return this.preserveMultipleSlashes?t.split("/"):this.isWindows&&/^\/\/[^/]+/.test(t)?["",...t.split(/\/+/)]:t.split(/\/+/)}match(t,n=this.partial){if(this.debug("match",t,this.pattern),this.comment)return!1;if(this.empty)return t==="";if(t==="/"&&n)return!0;let i=this.options;this.isWindows&&(t=t.split("\\").join("/"));let r=this.slashSplit(t);this.debug(this.pattern,"split",r);let s=this.set;this.debug(this.pattern,"set",s);let a=r[r.length-1];if(!a)for(let o=r.length-2;!a&&o>=0;o--)a=r[o];for(let o of s){let c=r;if(i.matchBase&&o.length===1&&(c=[a]),this.matchOne(c,o,n))return i.flipNegate?!0:!this.negate}return i.flipNegate?!1:this.negate}static defaults(t){return Sn.defaults(t).Minimatch}};Sn.AST=wa;Sn.Minimatch=Fo;Sn.escape=nx;Sn.unescape=Cs;import{gunzipSync as Ure}from"node:zlib";var Jc=class{static{l(this,"Diff")}diff(t,n,i={}){let r;typeof i=="function"?(r=i,i={}):"callback"in i&&(r=i.callback);let s=this.castInput(t,i),a=this.castInput(n,i),o=this.removeEmpty(this.tokenize(s,i)),c=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,c,i,r)}diffWithOptionsObj(t,n,i,r){var s;let a=l(k=>{if(k=this.postProcess(k,i),r){setTimeout(function(){r(k)},0);return}else return k},"done"),o=n.length,c=t.length,u=1,d=o+c;i.maxEditLength!=null&&(d=Math.min(d,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(h[0],n,t,0,i);if(h[0].oldPos+1>=c&&g+1>=o)return a(this.buildValues(h[0].lastComponent,n,t));let y=-1/0,w=1/0,x=l(()=>{for(let k=Math.max(y,-u);k<=Math.min(w,u);k+=2){let E,A=h[k-1],S=h[k+1];A&&(h[k-1]=void 0);let _=!1;if(S){let L=S.oldPos-k;_=S&&0<=L&&L<o}let T=A&&A.oldPos+1<c;if(!_&&!T){h[k]=void 0;continue}if(!T||_&&A.oldPos<S.oldPos?E=this.addToPath(S,!0,!1,0,i):E=this.addToPath(A,!1,!0,1,i),g=this.extractCommon(E,n,t,k,i),E.oldPos+1>=c&&g+1>=o)return a(this.buildValues(E.lastComponent,n,t))||!0;h[k]=E,E.oldPos+1>=c&&(w=Math.min(w,k-1)),g+1>=o&&(y=Math.max(y,k+1))}u++},"execEditLength");if(r)l(function k(){setTimeout(function(){if(u>d||Date.now()>p)return r(void 0);x()||k()},0)},"exec")();else for(;u<=d&&Date.now()<=p;){let k=x();if(k)return k}}addToPath(t,n,i,r,s){let a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===i?{oldPos:t.oldPos+r,lastComponent:{count:a.count+1,added:n,removed:i,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+r,lastComponent:{count:1,added:n,removed:i,previousComponent:a}}}extractCommon(t,n,i,r,s){let a=n.length,o=i.length,c=t.oldPos,u=c-r,d=0;for(;u+1<a&&c+1<o&&this.equals(i[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,i){return i.comparator?i.comparator(t,n):t===n||!!i.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){let n=[];for(let i=0;i<t.length;i++)t[i]&&n.push(t[i]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,i){let r=[],s;for(;t;)r.push(t),s=t.previousComponent,delete t.previousComponent,t=s;r.reverse();let a=r.length,o=0,c=0,u=0;for(;o<a;o++){let d=r[o];if(d.removed)d.value=this.join(i.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(p,h){let g=i[u+h];return g.length>p.length?g:p}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return r}};var rx=class extends Jc{static{l(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=Ste}equals(t,n,i){return i.ignoreWhitespace?((!i.newlineIsToken||!t.includes(`
711
711
  `))&&(t=t.trim()),(!i.newlineIsToken||!n.includes(`
712
712
  `))&&(n=n.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(t.endsWith(`
713
713
  `)&&(t=t.slice(0,-1)),n.endsWith(`