dsh-edge 0.1.3 → 0.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.i18n.yaml +6 -6
  2. package/README.md +25 -10
  3. package/README.zh.md +25 -10
  4. package/THIRD_PARTY_NOTICES.md +10019 -187
  5. package/dist/index.html +1 -1
  6. package/dist/plugins/@deepseek-ai/dsh-client-locale/client.js +7 -7
  7. package/dist/plugins/@deepseek-ai/dsh-client-ui-agent-preset/client.js +61 -61
  8. package/dist/plugins/@deepseek-ai/dsh-client-ui-commands/client.js +14 -14
  9. package/dist/plugins/@deepseek-ai/dsh-client-ui-conversation/client.js +287 -287
  10. package/dist/plugins/@deepseek-ai/dsh-client-ui-deliverables/client.js +10 -10
  11. package/dist/plugins/@deepseek-ai/dsh-client-ui-input-trigger/client.js +11 -11
  12. package/dist/plugins/@deepseek-ai/dsh-client-ui-jobs/client.js +15 -15
  13. package/dist/plugins/@deepseek-ai/dsh-client-ui-layout/client.js +8 -8
  14. package/dist/plugins/@deepseek-ai/dsh-client-ui-model-selection/client.js +27 -27
  15. package/dist/plugins/@deepseek-ai/dsh-client-ui-permission-presets/client.js +8 -8
  16. package/dist/plugins/@deepseek-ai/dsh-client-ui-settings-general/client.js +31 -31
  17. package/dist/plugins/@deepseek-ai/dsh-client-ui-sidebar/client.js +23 -23
  18. package/dist/plugins/@deepseek-ai/dsh-client-ui-skill/client.js +19 -19
  19. package/dist/plugins/@deepseek-ai/dsh-client-ui-subagent/client.js +29 -29
  20. package/dist/plugins/@deepseek-ai/dsh-client-ui-theme/client.js +7 -7
  21. package/dist/plugins/@deepseek-ai/dsh-client-ui-tool/client.js +64 -64
  22. package/dist/plugins/@deepseek-ai/dsh-client-ui-trajectory/client.js +183 -183
  23. package/dist/plugins/@deepseek-ai/dsh-client-ui-user-questions/client.js +44 -44
  24. package/dist/plugins/@deepseek-ai/dsh-client-ui-workflow-run/client.js +24 -24
  25. package/dist/plugins/@deepseek-ai/dsh-client-ui-workspace/client.js +79 -79
  26. package/dist/plugins/dsh-edge-client-ui/client.js +68 -53
  27. package/package.json +22 -22
  28. package/scripts/activation.d.mts +34 -0
  29. package/scripts/activation.mjs +133 -0
  30. package/scripts/cli.d.mts +9 -0
  31. package/scripts/cli.mjs +66 -3
  32. package/scripts/dev.mjs +38 -0
  33. package/scripts/install.d.mts +8 -0
  34. package/scripts/install.mjs +95 -4
  35. package/scripts/legal-files.d.mts +23 -0
  36. package/scripts/legal-files.mjs +222 -40
  37. package/scripts/pnpm-invocation.d.mts +14 -0
  38. package/scripts/pnpm-invocation.mjs +25 -0
  39. package/scripts/publish.d.mts +25 -0
  40. package/scripts/publish.mjs +145 -0
  41. package/scripts/smoke-installed.mjs +27 -22
  42. package/scripts/verify-packed.mjs +8 -0
  43. package/scripts/wrangler-config-core.mjs +107 -0
  44. package/scripts/wrangler-config.d.mts +2 -0
  45. package/scripts/wrangler-config.mjs +9 -78
  46. package/worker/direct/index.js +1136 -1139
  47. package/worker/isolated/index.js +872 -875
  48. package/scripts/assemble-web.mjs +0 -230
  49. package/scripts/bundle.mjs +0 -86
@@ -8,11 +8,11 @@ window.__ModuleLoader__.load({
8
8
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
9
9
  //#endregion
10
10
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
11
- let react_jsx_runtime = require("react/jsx-runtime");
12
11
  let react = require("react");
13
12
  let _deepseek_ai_dsh_client_runtime_client = require("@deepseek-ai/dsh-client-runtime/client");
13
+ let react_jsx_runtime = require("react/jsx-runtime");
14
14
  //#endregion
15
- //#region lib/types/client/store.js
15
+ //#region ../../../packages/client/ui-edge/src/client/store.ts
16
16
  var import_umd = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
17
17
  (function(global, factory) {
18
18
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.compareVersions = {}));
@@ -180,10 +180,16 @@ window.__ModuleLoader__.load({
180
180
  exports$1.validateStrict = validateStrict;
181
181
  }));
182
182
  })))();
183
- /** Repeatable command for upgrading an existing Edge deployment. */
184
- const DSH_EDGE_UPGRADE_COMMAND = "pnpm dlx dsh-edge@latest upgrade";
185
183
  /** Public release history for the Edge distribution. */
186
184
  const DSH_EDGE_RELEASES_URL = "https://github.com/pawaca/dsh-edge/releases";
185
+ /** Stable deployments follow latest; prerelease deployments stay on next. */
186
+ function releaseChannel(version) {
187
+ return (0, import_umd.validate)(version) && version.includes("-") ? "next" : "latest";
188
+ }
189
+ /** Repeatable command for upgrading without crossing release channels. */
190
+ function upgradeCommand(version) {
191
+ return `npx dsh-edge@${releaseChannel(version)} upgrade`;
192
+ }
187
193
  function releaseStatus(current, latest) {
188
194
  if (!(0, import_umd.validate)(current) || current === "0.0.0") return "development";
189
195
  if (latest === void 0 || !(0, import_umd.validate)(latest)) return "unavailable";
@@ -223,16 +229,18 @@ window.__ModuleLoader__.load({
223
229
  const health = await healthResponse.json();
224
230
  if (!isHealth(health)) throw new Error("Invalid Edge health response");
225
231
  if (generation !== this.loadGeneration) return;
232
+ const channel = releaseChannel(health.version);
226
233
  this.store.update((state) => {
227
234
  state.status = "ready";
228
235
  state.health = health;
236
+ state.releaseChannel = channel;
229
237
  state.releaseStatus = releaseStatus(health.version);
230
238
  delete state.latestVersion;
231
239
  delete state.error;
232
240
  });
233
241
  let latestVersion;
234
242
  try {
235
- const releaseResponse = await this.io.fetch("https://registry.npmjs.org/dsh-edge/latest", { signal: AbortSignal.timeout(5e3) });
243
+ const releaseResponse = await this.io.fetch(`https://registry.npmjs.org/dsh-edge/${channel}`, { signal: AbortSignal.timeout(5e3) });
236
244
  if (releaseResponse.ok) {
237
245
  const release = await releaseResponse.json();
238
246
  if (release !== null && typeof release === "object" && typeof release.version === "string") latestVersion = release.version;
@@ -252,10 +260,11 @@ window.__ModuleLoader__.load({
252
260
  });
253
261
  }
254
262
  }
255
- /** Copy the stable upgrade command without affecting health or owner-session state. */
263
+ /** Copy the matching channel upgrade command without affecting deployment state. */
256
264
  async copyUpgrade() {
257
265
  try {
258
- await this.io.copy(DSH_EDGE_UPGRADE_COMMAND);
266
+ const version = this.store.getSnapshot().health?.version ?? "0.0.0";
267
+ await this.io.copy(upgradeCommand(version));
259
268
  this.store.update((state) => {
260
269
  state.copied = true;
261
270
  delete state.copyError;
@@ -290,9 +299,9 @@ window.__ModuleLoader__.load({
290
299
  }
291
300
  };
292
301
  //#endregion
293
- //#region \0dsh-css:D:\a\dsh-edge\dsh-edge\packages\client\ui-edge\src\client\EdgeSettingsSection.module.css.mjs
294
- const css = ".B8bxQq_section{gap:20px;max-width:720px;display:grid}.B8bxQq_section header h2,.B8bxQq_card h3{color:var(--dsw-alias-text-primary);margin:0}.B8bxQq_section header p,.B8bxQq_card p{color:var(--dsw-alias-label-secondary)}.B8bxQq_card{border:1px solid var(--dsw-alias-border-subtle);border-radius:12px;padding:18px}.B8bxQq_card dl{margin:12px 0}.B8bxQq_row{border-bottom:1px solid var(--dsw-alias-border-secondary);grid-template-columns:minmax(150px,1fr) minmax(0,2fr);gap:16px;padding:8px 0;display:grid}.B8bxQq_row:last-child{border-bottom:0}.B8bxQq_row dt{color:var(--dsw-alias-label-secondary)}.B8bxQq_row dd{overflow-wrap:anywhere;color:var(--dsw-alias-text-primary);margin:0}.B8bxQq_actions{flex-wrap:wrap;align-items:center;gap:12px;display:flex}.B8bxQq_actions a{color:var(--dsw-alias-brand-primary)}.B8bxQq_status{align-items:center;gap:8px;display:flex}.B8bxQq_notice{color:var(--dsw-alias-label-secondary)}.B8bxQq_error{color:var(--dsw-alias-state-error-primary)!important}@media (width<=560px){.B8bxQq_row{grid-template-columns:1fr;gap:4px}}";
295
- const tagId = "dsh-edge-client-ui/EdgeSettingsSection.module.css";
302
+ //#region \0dsh-edge-css:src/client/EdgeSettingsSection.module.css.mjs
303
+ const css = "._68Y4qa_section{gap:20px;max-width:720px;display:grid}._68Y4qa_section header h2,._68Y4qa_card h3{color:var(--dsw-alias-text-primary);margin:0}._68Y4qa_section header p,._68Y4qa_card p{color:var(--dsw-alias-label-secondary)}._68Y4qa_card{border:1px solid var(--dsw-alias-border-subtle);border-radius:12px;padding:18px}._68Y4qa_card dl{margin:12px 0}._68Y4qa_row{border-bottom:1px solid var(--dsw-alias-border-secondary);grid-template-columns:minmax(150px,1fr) minmax(0,2fr);gap:16px;padding:8px 0;display:grid}._68Y4qa_row:last-child{border-bottom:0}._68Y4qa_row dt{color:var(--dsw-alias-label-secondary)}._68Y4qa_row dd{overflow-wrap:anywhere;color:var(--dsw-alias-text-primary);margin:0}._68Y4qa_actions{flex-wrap:wrap;align-items:center;gap:12px;display:flex}._68Y4qa_actions a{color:var(--dsw-alias-brand-primary)}._68Y4qa_status{align-items:center;gap:8px;display:flex}._68Y4qa_notice{color:var(--dsw-alias-label-secondary)}._68Y4qa_error{color:var(--dsw-alias-state-error-primary)!important}@media (width<=560px){._68Y4qa_row{grid-template-columns:1fr;gap:4px}}";
304
+ const tagId = "dsh-edge-client-ui/src/client/EdgeSettingsSection.module.css";
296
305
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
297
306
  const tag = document.createElement("style");
298
307
  tag.dataset.plugin = "dsh-edge-client-ui";
@@ -301,20 +310,20 @@ window.__ModuleLoader__.load({
301
310
  document.head.appendChild(tag);
302
311
  }
303
312
  var EdgeSettingsSection_module_css_default = {
304
- "actions": "B8bxQq_actions",
305
- "status": "B8bxQq_status",
306
- "card": "B8bxQq_card",
307
- "row": "B8bxQq_row",
308
- "error": "B8bxQq_error",
309
- "notice": "B8bxQq_notice",
310
- "section": "B8bxQq_section"
313
+ "actions": "_68Y4qa_actions",
314
+ "card": "_68Y4qa_card",
315
+ "error": "_68Y4qa_error",
316
+ "notice": "_68Y4qa_notice",
317
+ "row": "_68Y4qa_row",
318
+ "section": "_68Y4qa_section",
319
+ "status": "_68Y4qa_status"
311
320
  };
312
321
  //#endregion
313
- //#region lib/types/client/EdgeSettingsSection.js
322
+ //#region ../../../packages/client/ui-edge/src/client/EdgeSettingsSection.tsx
314
323
  function Row({ label, value }) {
315
- return (0, react_jsx_runtime.jsxs)("div", {
324
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
316
325
  className: EdgeSettingsSection_module_css_default.row,
317
- children: [(0, react_jsx_runtime.jsx)("dt", { children: label }), (0, react_jsx_runtime.jsx)("dd", { children: value })]
326
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", { children: label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", { children: value })]
318
327
  });
319
328
  }
320
329
  function EdgeSettingsSection(props) {
@@ -323,13 +332,13 @@ window.__ModuleLoader__.load({
323
332
  load();
324
333
  }, [load]);
325
334
  const state = useEdgeSettings((snapshot) => snapshot);
326
- const deploymentDetails = state.status === "idle" || state.status === "loading" ? (0, react_jsx_runtime.jsx)("p", {
335
+ const deploymentDetails = state.status === "idle" || state.status === "loading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
327
336
  className: EdgeSettingsSection_module_css_default.notice,
328
337
  children: t("loading")
329
- }) : state.status === "error" || state.health === void 0 ? (0, react_jsx_runtime.jsxs)("div", {
338
+ }) : state.status === "error" || state.health === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
330
339
  className: EdgeSettingsSection_module_css_default.notice,
331
340
  role: "alert",
332
- children: [(0, react_jsx_runtime.jsx)("p", { children: t("loadFailed") }), (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
341
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("loadFailed") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
333
342
  variant: "outline",
334
343
  size: "sm",
335
344
  onClick: () => {
@@ -337,95 +346,99 @@ window.__ModuleLoader__.load({
337
346
  },
338
347
  children: t("retry")
339
348
  })]
340
- }) : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsxs)("section", {
349
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
341
350
  className: EdgeSettingsSection_module_css_default.card,
342
351
  "aria-labelledby": "edge-release-title",
343
352
  children: [
344
- (0, react_jsx_runtime.jsx)("h3", {
353
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
345
354
  id: "edge-release-title",
346
355
  children: t("release")
347
356
  }),
348
- (0, react_jsx_runtime.jsxs)("dl", { children: [
349
- (0, react_jsx_runtime.jsx)(Row, {
357
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", { children: [
358
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
350
359
  label: t("currentVersion"),
351
360
  value: state.health.version
352
361
  }),
353
- (0, react_jsx_runtime.jsx)(Row, {
362
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
363
+ label: t("updateChannel"),
364
+ value: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: state.releaseChannel ?? "—" })
365
+ }),
366
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
354
367
  label: t("latestVersion"),
355
368
  value: state.latestVersion ?? "—"
356
369
  }),
357
- (0, react_jsx_runtime.jsx)(Row, {
370
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
358
371
  label: t("upstreamVersion"),
359
372
  value: state.health.upstreamVersion
360
373
  })
361
374
  ] }),
362
- (0, react_jsx_runtime.jsxs)("p", {
375
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
363
376
  className: EdgeSettingsSection_module_css_default.status,
364
- children: [state.releaseStatus === void 0 || state.releaseStatus === "unavailable" ? null : (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: state.releaseStatus === "update-available" ? "warning" : "done" }), state.releaseStatus === "latest" ? t("latest") : state.releaseStatus === "update-available" ? t("updateAvailable") : state.releaseStatus === "development" ? t("development") : t("unavailable")]
377
+ children: [state.releaseStatus === void 0 || state.releaseStatus === "unavailable" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.StateDot, { state: state.releaseStatus === "update-available" ? "warning" : "done" }), state.releaseStatus === "latest" ? t("latest") : state.releaseStatus === "update-available" ? t("updateAvailable") : state.releaseStatus === "development" ? t("development") : t("unavailable")]
365
378
  }),
366
- (0, react_jsx_runtime.jsxs)("div", {
379
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
367
380
  className: EdgeSettingsSection_module_css_default.actions,
368
- children: [state.releaseStatus === "update-available" ? (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
381
+ children: [state.releaseStatus === "update-available" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
369
382
  variant: "outline",
370
383
  size: "sm",
371
384
  onClick: () => {
372
385
  copyUpgrade();
373
386
  },
374
387
  children: state.copied ? t("copied") : t("copyUpgrade")
375
- }) : null, (0, react_jsx_runtime.jsx)("a", {
388
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
376
389
  href: DSH_EDGE_RELEASES_URL,
377
390
  target: "_blank",
378
391
  rel: "noreferrer",
379
392
  children: t("releaseNotes")
380
393
  })]
381
394
  }),
382
- state.copyError === void 0 ? null : (0, react_jsx_runtime.jsx)("p", {
395
+ state.copyError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
383
396
  className: EdgeSettingsSection_module_css_default.error,
384
397
  role: "alert",
385
398
  children: t("copyFailed")
386
399
  })
387
400
  ]
388
- }), (0, react_jsx_runtime.jsxs)("section", {
401
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
389
402
  className: EdgeSettingsSection_module_css_default.card,
390
403
  "aria-labelledby": "edge-runtime-title",
391
- children: [(0, react_jsx_runtime.jsx)("h3", {
404
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
392
405
  id: "edge-runtime-title",
393
406
  children: t("runtime")
394
- }), (0, react_jsx_runtime.jsxs)("dl", { children: [
395
- (0, react_jsx_runtime.jsx)(Row, {
407
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", { children: [
408
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
396
409
  label: t("runtime"),
397
410
  value: state.health.shell === "just-bash-direct" ? t("direct") : t("isolated")
398
411
  }),
399
- (0, react_jsx_runtime.jsx)(Row, {
412
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
400
413
  label: t("storage"),
401
414
  value: t("durableStorage")
402
415
  }),
403
- (0, react_jsx_runtime.jsx)(Row, {
416
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Row, {
404
417
  label: t("deploymentId"),
405
- value: (0, react_jsx_runtime.jsx)("code", { children: state.health.deploymentId })
418
+ value: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: state.health.deploymentId })
406
419
  })
407
420
  ] })]
408
421
  })] });
409
- return (0, react_jsx_runtime.jsxs)("div", {
422
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
410
423
  className: EdgeSettingsSection_module_css_default.section,
411
424
  children: [
412
- (0, react_jsx_runtime.jsxs)("header", { children: [(0, react_jsx_runtime.jsx)("h2", { children: t("title") }), (0, react_jsx_runtime.jsx)("p", { children: t("intro") })] }),
425
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", { children: t("title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("intro") })] }),
413
426
  deploymentDetails,
414
- (0, react_jsx_runtime.jsxs)("section", {
427
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
415
428
  className: EdgeSettingsSection_module_css_default.card,
416
429
  "aria-labelledby": "edge-owner-title",
417
430
  children: [
418
- (0, react_jsx_runtime.jsx)("h3", {
431
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
419
432
  id: "edge-owner-title",
420
433
  children: t("ownerSession")
421
434
  }),
422
- (0, react_jsx_runtime.jsx)("p", { children: t("ownerIntro") }),
423
- state.signOutError === void 0 ? null : (0, react_jsx_runtime.jsx)("p", {
435
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("ownerIntro") }),
436
+ state.signOutError === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
424
437
  className: EdgeSettingsSection_module_css_default.error,
425
438
  role: "alert",
426
439
  children: t("signOutFailed")
427
440
  }),
428
- (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
441
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
429
442
  variant: "outline",
430
443
  size: "sm",
431
444
  disabled: state.signingOut,
@@ -440,7 +453,7 @@ window.__ModuleLoader__.load({
440
453
  });
441
454
  }
442
455
  //#endregion
443
- //#region lib/types/client/locales.js
456
+ //#region ../../../packages/client/ui-edge/src/client/locales.ts
444
457
  /** English copy is the key-set source of truth for the Edge settings page. */
445
458
  const en = {
446
459
  nav: "DSH Edge",
@@ -448,7 +461,8 @@ window.__ModuleLoader__.load({
448
461
  intro: "Deployment details and updates for this Cloudflare Worker.",
449
462
  release: "Release",
450
463
  currentVersion: "Installed version",
451
- latestVersion: "Latest version",
464
+ updateChannel: "Update channel",
465
+ latestVersion: "Channel version",
452
466
  upstreamVersion: "DeepSeek Harness base",
453
467
  latest: "Up to date",
454
468
  updateAvailable: "Update available",
@@ -481,7 +495,8 @@ window.__ModuleLoader__.load({
481
495
  intro: "查看此 Cloudflare Worker 的部署信息和更新。",
482
496
  release: "版本",
483
497
  currentVersion: "当前版本",
484
- latestVersion: "最新版本",
498
+ updateChannel: "更新渠道",
499
+ latestVersion: "渠道版本",
485
500
  upstreamVersion: "DeepSeek Harness 基础版本",
486
501
  latest: "已是最新版本",
487
502
  updateAvailable: "有可用更新",
@@ -508,7 +523,7 @@ window.__ModuleLoader__.load({
508
523
  signOutFailed: "退出失败,请重试。"
509
524
  };
510
525
  //#endregion
511
- //#region lib/types/client/index.js
526
+ //#region ../../../packages/client/ui-edge/src/client/index.ts
512
527
  const inject = ["slots", "locale"];
513
528
  function apply(ctx) {
514
529
  ctx.effect(() => ctx.locale.register("settings.edge", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-edge",
3
- "version": "0.1.3",
3
+ "version": "0.2.0-alpha.2",
4
4
  "description": "Run DeepSeek Harness on Cloudflare Workers as an independent community project",
5
5
  "author": "pawaca",
6
6
  "license": "MIT",
@@ -45,6 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@clack/prompts": "1.7.0",
48
+ "compare-versions": "6.1.1",
48
49
  "execa": "^10.0.0",
49
50
  "jsonc-parser": "^3.3.1",
50
51
  "wrangler": "4.123.0"
@@ -52,49 +53,48 @@
52
53
  "devDependencies": {
53
54
  "@cloudflare/computer": "0.2.0",
54
55
  "@cloudflare/workers-types": "5.20260812.1",
55
- "just-bash": "3.3.0",
56
- "playwright": "^1.49.0",
57
- "typescript": "^6.0.3",
58
- "vitest": "^4.1.8",
59
- "ws": "^8.21.0",
60
- "@deepseek-ai/dsh-brand": "0.1.0-rc.7",
61
56
  "@deepseek-ai/cordis": "4.0.1",
62
57
  "@deepseek-ai/dsh-agent": "0.1.0-rc.7",
63
58
  "@deepseek-ai/dsh-agent-loop": "0.1.0-rc.7",
59
+ "@deepseek-ai/dsh-anonymous-user-id": "0.1.0-rc.7",
60
+ "@deepseek-ai/dsh-brand": "0.1.0-rc.7",
64
61
  "@deepseek-ai/dsh-credentials": "0.1.0-rc.7",
65
62
  "@deepseek-ai/dsh-host-apiproxy": "0.1.0-rc.7",
66
- "@deepseek-ai/dsh-anonymous-user-id": "0.1.0-rc.7",
67
63
  "@deepseek-ai/dsh-launch-environment": "0.1.0-rc.7",
68
64
  "@deepseek-ai/dsh-llm": "0.1.0-rc.7",
69
65
  "@deepseek-ai/dsh-llm-deepseek": "0.1.0-rc.7",
70
66
  "@deepseek-ai/dsh-session": "0.1.0-rc.7",
71
67
  "@deepseek-ai/dsh-session-persistence": "0.1.0-rc.7",
72
68
  "@deepseek-ai/dsh-session-query": "0.1.0-rc.7",
69
+ "@deepseek-ai/dsh-session-title": "0.1.0-rc.7",
73
70
  "@deepseek-ai/dsh-settings": "0.1.0-rc.7",
74
71
  "@deepseek-ai/dsh-system-prompt": "0.1.0-rc.7",
75
- "@deepseek-ai/dsh-session-title": "0.1.0-rc.7",
76
- "@deepseek-ai/dsh-tool-web": "0.1.0-rc.7",
77
72
  "@deepseek-ai/dsh-tool-call-timeout-policy": "0.1.0-rc.7",
73
+ "@deepseek-ai/dsh-tool-web": "0.1.0-rc.7",
78
74
  "@deepseek-ai/dsh-tools": "0.1.0-rc.7",
79
75
  "@deepseek-ai/dsh-web": "0.1.0-rc.7",
80
- "@deepseek-ai/dsh-web-search-deepseek": "0.1.0-rc.7"
76
+ "@deepseek-ai/dsh-web-search-deepseek": "0.1.0-rc.7",
77
+ "just-bash": "3.3.0",
78
+ "playwright": "^1.49.0",
79
+ "typescript": "^6.0.3",
80
+ "vitest": "^4.1.8",
81
+ "ws": "^8.21.0"
81
82
  },
82
83
  "scripts": {
83
- "bundle:direct": "pnpm run web:build && node scripts/bundle.mjs direct",
84
- "bundle:isolated": "pnpm run web:build && node scripts/bundle.mjs isolated",
85
- "bundle:workers": "node scripts/bundle.mjs direct && node scripts/bundle.mjs isolated",
86
- "dev": "pnpm run web:build && wrangler dev --env=\"\"",
87
- "dev:isolated": "pnpm run web:build && wrangler dev --env isolated",
84
+ "bundle:direct": "pnpm run web:build && pnpm --dir standalone run build:worker:direct && node standalone/scripts/promote.mjs direct",
85
+ "bundle:isolated": "pnpm run web:build && pnpm --dir standalone run build:worker:isolated && node standalone/scripts/promote.mjs isolated",
86
+ "bundle:workers": "pnpm --dir standalone run build && pnpm --dir standalone run verify && node standalone/scripts/promote.mjs all",
87
+ "dev": "pnpm run bundle:direct && node scripts/dev.mjs direct",
88
+ "dev:isolated": "pnpm run bundle:isolated && node scripts/dev.mjs isolated",
88
89
  "dsh-edge": "node scripts/cli.mjs",
89
90
  "example:install": "node examples/install-keyless.mjs",
90
- "install:cloudflare": "pnpm run web:build && pnpm run bundle:workers && node scripts/cli.mjs install",
91
+ "install:cloudflare": "pnpm run bundle:workers && node scripts/cli.mjs install",
91
92
  "legal:write": "node scripts/legal-files.mjs write",
92
93
  "pack:verify": "node scripts/verify-packed.mjs",
93
- "web:assemble": "node scripts/assemble-web.mjs",
94
- "web:build": "pnpm --workspace-root run build:lib:host && pnpm --workspace-root run build:lib:client && pnpm --workspace-root run build:web && pnpm run web:assemble",
95
- "test": "vitest run --root ../.. apps/dsh-edge/tests/agent.spec.ts apps/dsh-edge/tests/auth.spec.ts apps/dsh-edge/tests/cli.spec.ts apps/dsh-edge/tests/deployment-health.spec.ts apps/dsh-edge/tests/deployment.spec.ts apps/dsh-edge/tests/direct-shell.spec.ts apps/dsh-edge/tests/do-session-persistence.spec.ts apps/dsh-edge/tests/edge-api.spec.ts apps/dsh-edge/tests/edge-credentials.spec.ts apps/dsh-edge/tests/edge-remotes.spec.ts apps/dsh-edge/tests/installer.spec.ts apps/dsh-edge/tests/sse.spec.ts apps/dsh-edge/tests/verify-packed.spec.ts apps/dsh-edge/tests/web-search.spec.ts apps/dsh-edge/tests/workspace.spec.ts",
96
- "test:integration": "pnpm run web:build && node tests/session.integration.mjs",
97
- "test:snapshot": "vitest run --config vitest.snapshot.config.ts",
94
+ "web:build": "pnpm --dir standalone run build:web && node standalone/scripts/promote.mjs web",
95
+ "test": "vitest run --root ../.. --project edge-runtime",
96
+ "test:integration": "pnpm run bundle:workers && node tests/run-session-integration.mjs",
97
+ "test:snapshot": "vitest run --root ../.. --config apps/dsh-edge/vitest.snapshot.config.ts",
98
98
  "typecheck": "tsc --noEmit"
99
99
  }
100
100
  }
@@ -0,0 +1,34 @@
1
+ import type { RuntimeMode } from './install.mjs'
2
+
3
+ export interface ActivationObservation {
4
+ attempts: number
5
+ elapsedMs: number
6
+ status: 'pending' | 'ready'
7
+ }
8
+
9
+ export interface ExpectedHealth {
10
+ deploymentId: string
11
+ shell: 'just-bash-direct' | 'just-bash-isolated'
12
+ }
13
+
14
+ export const ACTIVATION_WAIT_MS: number
15
+ export const ACTIVATION_REQUEST_TIMEOUT_MS: number
16
+ export const ACTIVATION_RETRY_MS: number
17
+
18
+ export function observePublicActivation(options: {
19
+ publicUrl: string
20
+ mode: RuntimeMode
21
+ fetchImpl?: typeof fetch
22
+ now?: () => number
23
+ requestTimeoutMs?: number
24
+ retryMs?: number
25
+ signal?: AbortSignal
26
+ sleepImpl?: (
27
+ delay: number,
28
+ value?: undefined,
29
+ options?: { signal?: AbortSignal },
30
+ ) => Promise<unknown>
31
+ waitMs?: number
32
+ }): Promise<ActivationObservation>
33
+
34
+ export function isExpectedHealth(value: unknown, expected: ExpectedHealth): boolean
@@ -0,0 +1,133 @@
1
+ import { setTimeout as sleep } from 'node:timers/promises'
2
+ import edgePackage from '../package.json' with { type: 'json' }
3
+
4
+ export const ACTIVATION_WAIT_MS = 45_000
5
+ export const ACTIVATION_REQUEST_TIMEOUT_MS = 4_000
6
+ export const ACTIVATION_RETRY_MS = 1_500
7
+
8
+ const MAX_HEALTH_BYTES = 64 * 1024
9
+
10
+ /** Observe when Cloudflare serves the exact Worker release without making it an install gate. */
11
+ export async function observePublicActivation({
12
+ publicUrl,
13
+ mode,
14
+ fetchImpl = globalThis.fetch,
15
+ now = Date.now,
16
+ requestTimeoutMs = ACTIVATION_REQUEST_TIMEOUT_MS,
17
+ retryMs = ACTIVATION_RETRY_MS,
18
+ signal,
19
+ sleepImpl = sleep,
20
+ waitMs = ACTIVATION_WAIT_MS,
21
+ } = {}) {
22
+ if (mode !== 'direct' && mode !== 'isolated') throw new Error('A runtime mode is required.')
23
+ if (!Number.isFinite(waitMs) || waitMs < 0) throw new Error('Activation wait must be non-negative.')
24
+ if (!Number.isFinite(requestTimeoutMs) || requestTimeoutMs <= 0) {
25
+ throw new Error('Activation request timeout must be positive.')
26
+ }
27
+ if (!Number.isFinite(retryMs) || retryMs <= 0) throw new Error('Activation retry must be positive.')
28
+ if (typeof fetchImpl !== 'function') throw new Error('Activation observation requires fetch.')
29
+
30
+ const healthUrl = publicHealthUrl(publicUrl)
31
+ const expected = {
32
+ deploymentId: `dsh-edge@${edgePackage.version}/${mode}`,
33
+ shell: mode === 'direct' ? 'just-bash-direct' : 'just-bash-isolated',
34
+ }
35
+ const startedAt = now()
36
+ const deadline = startedAt + waitMs
37
+ let attempts = 0
38
+
39
+ while (true) {
40
+ signal?.throwIfAborted()
41
+ const requestBudget = deadline - now()
42
+ if (requestBudget <= 0) {
43
+ return activationResult('pending', attempts, startedAt, now())
44
+ }
45
+ attempts += 1
46
+ const requestTimeout = AbortSignal.timeout(Math.min(requestTimeoutMs, requestBudget))
47
+ const requestSignal = signal === undefined
48
+ ? requestTimeout
49
+ : AbortSignal.any([signal, requestTimeout])
50
+ try {
51
+ const response = await fetchImpl(healthUrl, {
52
+ headers: {
53
+ accept: 'application/json',
54
+ 'cache-control': 'no-cache',
55
+ },
56
+ redirect: 'manual',
57
+ signal: requestSignal,
58
+ })
59
+ if (response.ok) {
60
+ const health = await readBoundedJson(response, MAX_HEALTH_BYTES)
61
+ if (isExpectedHealth(health, expected)) {
62
+ return activationResult('ready', attempts, startedAt, now())
63
+ }
64
+ } else {
65
+ await response.body?.cancel()
66
+ }
67
+ } catch {
68
+ if (signal?.aborted) signal.throwIfAborted()
69
+ // DNS, routing, challenge, timeout, and placeholder responses are all
70
+ // transient observations until the bounded wait expires.
71
+ }
72
+
73
+ const remaining = deadline - now()
74
+ if (remaining <= 0) return activationResult('pending', attempts, startedAt, now())
75
+ await sleepImpl(Math.min(retryMs, remaining), undefined, { signal })
76
+ }
77
+ }
78
+
79
+ export function isExpectedHealth(value, expected) {
80
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) return false
81
+ return value.ok === true
82
+ && value.service === 'dsh-edge'
83
+ && value.status === 'ready'
84
+ && value.storage === 'durable-object-sqlite-vfs'
85
+ && value.deploymentId === expected.deploymentId
86
+ && value.shell === expected.shell
87
+ && value.version === edgePackage.version
88
+ }
89
+
90
+ function publicHealthUrl(publicUrl) {
91
+ const url = new URL(publicUrl)
92
+ if (url.protocol !== 'https:' || url.username !== '' || url.password !== ''
93
+ || !url.hostname.endsWith('.workers.dev')
94
+ || url.pathname !== '/' || url.search !== '' || url.hash !== '') {
95
+ throw new Error('Activation observation requires a public workers.dev origin.')
96
+ }
97
+ url.pathname = '/api/health'
98
+ return url.href
99
+ }
100
+
101
+ async function readBoundedJson(response, maxBytes) {
102
+ if (response.body === null) return undefined
103
+ const reader = response.body.getReader()
104
+ const decoder = new TextDecoder('utf-8', { fatal: true })
105
+ let bytes = 0
106
+ let source = ''
107
+ try {
108
+ while (true) {
109
+ const { done, value } = await reader.read()
110
+ if (done) break
111
+ bytes += value.byteLength
112
+ if (bytes > maxBytes) {
113
+ await reader.cancel()
114
+ return undefined
115
+ }
116
+ source += decoder.decode(value, { stream: true })
117
+ }
118
+ source += decoder.decode()
119
+ return JSON.parse(source)
120
+ } catch {
121
+ return undefined
122
+ } finally {
123
+ reader.releaseLock()
124
+ }
125
+ }
126
+
127
+ function activationResult(status, attempts, startedAt, finishedAt) {
128
+ return {
129
+ attempts,
130
+ elapsedMs: Math.max(0, finishedAt - startedAt),
131
+ status,
132
+ }
133
+ }
package/scripts/cli.d.mts CHANGED
@@ -10,6 +10,15 @@ export class InstallInterruptedError extends Error {
10
10
 
11
11
  export type InstallerCommand = 'install' | 'upgrade'
12
12
  export function parseCommand(args: string[]): InstallerCommand | 'help' | 'version'
13
+ export function renderInstallerIntro(
14
+ command: InstallerCommand,
15
+ options?: {
16
+ columns?: number
17
+ isTTY?: boolean
18
+ upstreamVersion?: string
19
+ version?: string
20
+ },
21
+ ): string
13
22
  export function createInstallerUi(
14
23
  clack?: typeof import('@clack/prompts'),
15
24
  signal?: AbortSignal,