@dan-ai-studio/dshopencodego 0.1.26 → 0.1.28

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/lib/client.js CHANGED
@@ -159,6 +159,7 @@ function parseUpdateStatus(value) {
159
159
  if (typeof row["current"] !== "string") throw new Error("invalid update reading");
160
160
  if (row["latest"] !== void 0 && typeof row["latest"] !== "string") throw new Error("invalid update reading");
161
161
  if (typeof row["available"] !== "boolean") throw new Error("invalid update reading");
162
+ if (typeof row["checked"] !== "boolean") throw new Error("invalid update reading");
162
163
  if (typeof row["checkedAt"] !== "number" || !Number.isFinite(row["checkedAt"])) {
163
164
  throw new Error("invalid update reading");
164
165
  }
@@ -166,7 +167,8 @@ function parseUpdateStatus(value) {
166
167
  current: row["current"],
167
168
  latest: typeof row["latest"] === "string" ? row["latest"] : void 0,
168
169
  available: row["available"],
169
- checkedAt: row["checkedAt"]
170
+ checkedAt: row["checkedAt"],
171
+ checked: row["checked"]
170
172
  };
171
173
  }
172
174
  var codec2 = (typeSymbol, parse) => ({
@@ -366,6 +368,8 @@ var en = {
366
368
  updateRestart: "Restart DSH to finish applying the update.",
367
369
  updateFailed: "Update failed:",
368
370
  updateRemoteMissing: "The update service is not ready yet; choose Check again to retry.",
371
+ updateNoManager: "This composition has no plugin manager, so the update cannot be applied from here; update the package from the plugin manager page.",
372
+ updateUnreachable: "Could not reach the npm registry, so no version information was read; choose Check again to retry.",
369
373
  updateStopProfile: "The running version cannot be removed without a restart; restart DSH first, then retry.",
370
374
  updateIncompatible: "The new version is incompatible with this DSH build; finish the update from the plugin manager page (a version exemption needs your explicit approval).",
371
375
  updatePendingBuilds: "Installation needs build-script approval; approve it on the plugin manager page, then retry."
@@ -452,6 +456,8 @@ var zh = {
452
456
  updateRestart: "\u8BF7\u91CD\u542F DSH \u4EE5\u5B8C\u6210\u66F4\u65B0\u3002",
453
457
  updateFailed: "\u66F4\u65B0\u5931\u8D25\uFF1A",
454
458
  updateRemoteMissing: "\u66F4\u65B0\u670D\u52A1\u5C1A\u672A\u5C31\u7EEA\uFF1B\u8BF7\u70B9\u51FB\u201C\u91CD\u65B0\u68C0\u67E5\u201D\u91CD\u8BD5\u3002",
459
+ updateNoManager: "\u5F53\u524D\u7EC4\u5408\u6CA1\u6709\u63D2\u4EF6\u7BA1\u7406\u5668\uFF0C\u65E0\u6CD5\u5728\u6B64\u5E94\u7528\u66F4\u65B0\uFF1B\u8BF7\u524D\u5F80\u63D2\u4EF6\u7BA1\u7406\u9875\u66F4\u65B0\u3002",
460
+ updateUnreachable: "\u65E0\u6CD5\u8BBF\u95EE npm registry\uFF0C\u672A\u83B7\u53D6\u5230\u7248\u672C\u4FE1\u606F\uFF1B\u8BF7\u70B9\u51FB\u201C\u91CD\u65B0\u68C0\u67E5\u201D\u91CD\u8BD5\u3002",
455
461
  updateStopProfile: "\u8FD0\u884C\u4E2D\u7684\u7248\u672C\u9700\u91CD\u542F\u540E\u624D\u80FD\u79FB\u9664\uFF1B\u8BF7\u5148\u91CD\u542F DSH \u518D\u91CD\u8BD5\u3002",
456
462
  updateIncompatible: "\u65B0\u7248\u672C\u4E0E\u5F53\u524D DSH \u4E0D\u517C\u5BB9\uFF0C\u8BF7\u524D\u5F80\u63D2\u4EF6\u7BA1\u7406\u9875\u5B8C\u6210\u66F4\u65B0\uFF08\u7248\u672C\u8C41\u514D\u9700\u660E\u786E\u6279\u51C6\uFF09\u3002",
457
463
  updatePendingBuilds: "\u5B89\u88C5\u9700\u8981\u6279\u51C6\u6784\u5EFA\u811A\u672C\uFF1B\u8BF7\u524D\u5F80\u63D2\u4EF6\u7BA1\u7406\u9875\u6279\u51C6\u540E\u518D\u91CD\u8BD5\u3002"
@@ -552,14 +558,12 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")
552
558
  style.textContent = ".d7lz0W_root{color:var(--dsw-alias-label-primary);flex-direction:column;gap:1.25rem;display:flex}.d7lz0W_title{margin:0;font-size:1.05rem}.d7lz0W_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.8rem}.d7lz0W_warn{color:var(--dsw-alias-state-warn-primary);margin:0;font-size:.8rem}.d7lz0W_ok{color:var(--dsw-alias-state-success-primary);font-size:.8rem}.d7lz0W_block{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);border-radius:.6rem;flex-direction:column;gap:.5rem;padding:.85rem;display:flex}.d7lz0W_row{flex-wrap:wrap;align-items:center;gap:.5rem;display:flex}.d7lz0W_row>strong{margin-right:auto}.d7lz0W_input{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);min-width:10rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;flex:14rem;padding:.35rem .5rem;font-size:.85rem}.d7lz0W_button{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;padding:.35rem .7rem;font-size:.8rem}.d7lz0W_button:disabled{color:var(--dsw-alias-state-idle-primary);cursor:default}.d7lz0W_number{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:5rem;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_select{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-base);width:auto;max-width:100%;color:var(--dsw-alias-label-primary);font:inherit;border-radius:.35rem;padding:.25rem .4rem;font-size:.8rem}.d7lz0W_list{flex-direction:column;display:flex}.d7lz0W_item{border-top:1px solid var(--dsw-alias-border-l1);align-items:flex-start;gap:.5rem;padding:.45rem .15rem;display:flex}.d7lz0W_item input[type=checkbox]{accent-color:var(--dsw-alias-brand-primary);margin-top:.15rem}.d7lz0W_itemBody{flex-direction:column;gap:.15rem;min-width:0;display:flex}.d7lz0W_itemMain{flex-wrap:wrap;align-items:baseline;gap:.6rem;display:flex}.d7lz0W_itemMeta{color:var(--dsw-alias-label-secondary);flex-wrap:wrap;gap:.75rem;font-size:.75rem;display:flex}.d7lz0W_itemModalities{color:var(--dsw-alias-label-secondary);font-size:.75rem}.d7lz0W_name{color:var(--dsw-alias-label-primary)}.d7lz0W_mono{color:var(--dsw-alias-label-secondary);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.d7lz0W_badge{color:var(--dsw-alias-brand-primary)}";
553
559
  document.head.appendChild(style);
554
560
  }
555
- var section_default = { "itemMain": "d7lz0W_itemMain", "title": "d7lz0W_title", "hint": "d7lz0W_hint", "itemBody": "d7lz0W_itemBody", "button": "d7lz0W_button", "block": "d7lz0W_block", "itemMeta": "d7lz0W_itemMeta", "name": "d7lz0W_name", "input": "d7lz0W_input", "itemModalities": "d7lz0W_itemModalities", "item": "d7lz0W_item", "ok": "d7lz0W_ok", "number": "d7lz0W_number", "warn": "d7lz0W_warn", "root": "d7lz0W_root", "list": "d7lz0W_list", "row": "d7lz0W_row", "badge": "d7lz0W_badge", "select": "d7lz0W_select", "mono": "d7lz0W_mono" };
561
+ var section_default = { "itemBody": "d7lz0W_itemBody", "name": "d7lz0W_name", "itemMeta": "d7lz0W_itemMeta", "hint": "d7lz0W_hint", "row": "d7lz0W_row", "ok": "d7lz0W_ok", "input": "d7lz0W_input", "mono": "d7lz0W_mono", "badge": "d7lz0W_badge", "list": "d7lz0W_list", "item": "d7lz0W_item", "itemMain": "d7lz0W_itemMain", "number": "d7lz0W_number", "block": "d7lz0W_block", "itemModalities": "d7lz0W_itemModalities", "title": "d7lz0W_title", "root": "d7lz0W_root", "warn": "d7lz0W_warn", "button": "d7lz0W_button", "select": "d7lz0W_select" };
556
562
 
557
563
  // src/client/Section.tsx
558
564
  var import_jsx_runtime = require("react/jsx-runtime");
559
565
  var API_KEY_REF = "OPENCODE_GO_API_KEY";
560
566
  var VISIBILITY_WRITE_DELAY_MS = 250;
561
- var UPDATE_MOUNT_WAIT_MS = 2e3;
562
- var UPDATE_MOUNT_POLL_MS = 50;
563
567
  var INITIAL = {
564
568
  loading: true,
565
569
  reading: void 0,
@@ -651,27 +655,21 @@ var SectionController = class _SectionController {
651
655
  }
652
656
  }
653
657
  /**
654
- * The update Remote, waiting for its namespace to finish mounting.
658
+ * The update Remote.
655
659
  *
656
- * The settings section is constructed as soon as the catalog and credentials
657
- * are visible, which can precede the rest of this package's own Remote
658
- * contribution. Reading `opencodeGoUpdate` too early made the first check
659
- * throw a TypeError into the page's catch, which returned the panel to
660
- * `idle` — a permanently blank panel with no retry. This is the defect a
661
- * live run reported, so the race is waited out here instead of hidden.
660
+ * `client/index.ts` declares `remote.opencodeGoUpdate` in its inject list,
661
+ * so by the time this controller exists the namespace is mounted. The guard
662
+ * below is therefore a defensive assertion, not a wait: Cordis throws
663
+ * `cannot get property "…" without inject` on an undeclared read rather
664
+ * than returning undefined, which is how an omitted dependency once turned
665
+ * this panel into a permanently blank row.
662
666
  * @returns the mounted update Remote.
663
- * @throws {Error} `remote-not-mounted` when it never appears.
667
+ * @throws {Error} `remote-not-mounted` when the namespace is absent.
664
668
  */
665
- async updateRemote() {
666
- const deadline = Date.now() + UPDATE_MOUNT_WAIT_MS;
667
- for (; ; ) {
668
- const remote = this.services.remote.opencodeGoUpdate;
669
- if (remote !== void 0) return remote;
670
- if (Date.now() >= deadline) throw new Error("remote-not-mounted");
671
- await new Promise((resolve) => {
672
- setTimeout(resolve, UPDATE_MOUNT_POLL_MS);
673
- });
674
- }
669
+ updateRemote() {
670
+ const remote = this.services.remote.opencodeGoUpdate;
671
+ if (remote === void 0) throw new Error("remote-not-mounted");
672
+ return remote;
675
673
  }
676
674
  /**
677
675
  * Ask the Host whether a newer release is published.
@@ -689,15 +687,18 @@ var SectionController = class _SectionController {
689
687
  const previous = this.state.update;
690
688
  this.set({ update: { ...previous, phase: "checking", message: void 0 } });
691
689
  try {
692
- const remote = await this.updateRemote();
690
+ const remote = this.updateRemote();
693
691
  const result = force ? await remote.refreshUpdate() : await remote.readUpdate();
694
692
  if (!result.ok) throw result.error;
695
693
  const status = result.value;
696
694
  this.set({
697
695
  update: {
698
- phase: status.available && status.latest !== void 0 ? "ready" : "current",
696
+ // An unanswered lookup is not "up to date": rendering the two alike
697
+ // would report an unreachable registry as a current version, which
698
+ // is the same silent lie that once hid this panel entirely.
699
+ phase: !status.checked ? "failed" : status.available && status.latest !== void 0 ? "ready" : "current",
699
700
  status,
700
- message: void 0
701
+ message: status.checked ? void 0 : "registry-unreachable"
701
702
  }
702
703
  });
703
704
  } catch (error) {
@@ -740,7 +741,11 @@ var SectionController = class _SectionController {
740
741
  const status = this.state.update.status;
741
742
  const latest = status?.latest;
742
743
  if (this.state.update.phase !== "confirming" || latest === void 0) return;
743
- const manager = this.services.remote.pluginManager;
744
+ const manager = this.services.pluginManager;
745
+ if (manager === void 0) {
746
+ this.set({ update: { phase: "failed", status, message: "no-plugin-manager" } });
747
+ return;
748
+ }
744
749
  const spec = `${PACKAGE_NAME}@${latest}`;
745
750
  this.set({ update: { phase: "updating", status, message: void 0 } });
746
751
  const fail = (message) => {
@@ -1042,6 +1047,8 @@ function UpdateBanner({ controller, t, busy, act, update }) {
1042
1047
  function updateFailureText(message, t) {
1043
1048
  if (message === void 0 || message.length === 0) return "";
1044
1049
  if (message === "remote-not-mounted") return t("updateRemoteMissing");
1050
+ if (message === "no-plugin-manager") return t("updateNoManager");
1051
+ if (message === "registry-unreachable") return t("updateUnreachable");
1045
1052
  if (message === "stop-profile") return t("updateStopProfile");
1046
1053
  if (message === "incompatible-version") return t("updateIncompatible");
1047
1054
  if (message === "pending-builds") return t("updatePendingBuilds");
@@ -1314,7 +1321,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
1314
1321
  style.textContent = ".mMNkkW_root{align-items:center;display:inline-flex;position:relative}.mMNkkW_trigger{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);font:inherit;cursor:pointer;white-space:nowrap;border-radius:999px;padding:.35rem .6rem;font-size:.8rem;line-height:1}.mMNkkW_trigger:hover{color:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-border-l2)}.mMNkkW_panel{z-index:20;border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-overlay);width:18rem;color:var(--dsw-alias-label-primary);border-radius:.6rem;flex-direction:column;gap:.6rem;padding:.75rem .85rem;display:flex;position:absolute;bottom:calc(100% + .5rem);right:0;box-shadow:0 8px 24px #0000002e}.mMNkkW_window{flex-direction:column;gap:.25rem;display:flex}.mMNkkW_row{justify-content:space-between;gap:.5rem;font-size:.85rem;display:flex}.mMNkkW_hint{color:var(--dsw-alias-label-secondary);margin:0;font-size:.75rem}.mMNkkW_progress{width:100%;height:.35rem;accent-color:var(--dsw-alias-brand-primary)}.mMNkkW_limited{color:var(--dsw-alias-state-warn-primary);font-size:.75rem}.mMNkkW_warning{border:1px solid var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-label-primary);border-radius:.4rem;padding:.4rem .5rem;font-size:.75rem}.mMNkkW_retry{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;cursor:pointer;border-radius:.35rem;align-self:flex-start;padding:.25rem .5rem;font-size:.75rem}.mMNkkW_local{border-top:1px solid var(--dsw-alias-border-l1);flex-direction:column;gap:.2rem;padding-top:.5rem;display:flex}";
1315
1322
  document.head.appendChild(style);
1316
1323
  }
1317
- var pill_default = { "root": "mMNkkW_root", "panel": "mMNkkW_panel", "warning": "mMNkkW_warning", "progress": "mMNkkW_progress", "hint": "mMNkkW_hint", "limited": "mMNkkW_limited", "row": "mMNkkW_row", "local": "mMNkkW_local", "retry": "mMNkkW_retry", "trigger": "mMNkkW_trigger", "window": "mMNkkW_window" };
1324
+ var pill_default = { "limited": "mMNkkW_limited", "panel": "mMNkkW_panel", "retry": "mMNkkW_retry", "warning": "mMNkkW_warning", "root": "mMNkkW_root", "window": "mMNkkW_window", "trigger": "mMNkkW_trigger", "progress": "mMNkkW_progress", "row": "mMNkkW_row", "hint": "mMNkkW_hint", "local": "mMNkkW_local" };
1318
1325
 
1319
1326
  // src/client/UsagePill.tsx
1320
1327
  var import_jsx_runtime2 = require("react/jsx-runtime");
@@ -1484,10 +1491,14 @@ function apply(ctx) {
1484
1491
  void dispose?.();
1485
1492
  };
1486
1493
  }, "dshopencodego: usage Remote");
1487
- ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.credentials"], (scope) => {
1494
+ ctx.inject(["configForms", "remote.opencodeGoCatalog", "remote.opencodeGoUpdate", "remote.credentials"], (scope) => {
1488
1495
  const forms = scope.get("configForms");
1489
1496
  const controller = new SectionController({
1490
1497
  remote: scope.remote,
1498
+ // Lenient lookup on purpose: the plugin manager is a separate host
1499
+ // plugin a composition may omit, and declaring it as a required
1500
+ // dependency would withdraw this whole settings section when absent.
1501
+ pluginManager: scope.get("remote.pluginManager"),
1491
1502
  scope: forms?.get("dshopencodego")
1492
1503
  });
1493
1504
  const translate = scope.locale.bind(NS);
package/lib/index.js CHANGED
@@ -1774,6 +1774,7 @@ function parseUpdateStatus(value) {
1774
1774
  if (typeof row["current"] !== "string") throw new Error("invalid update reading");
1775
1775
  if (row["latest"] !== void 0 && typeof row["latest"] !== "string") throw new Error("invalid update reading");
1776
1776
  if (typeof row["available"] !== "boolean") throw new Error("invalid update reading");
1777
+ if (typeof row["checked"] !== "boolean") throw new Error("invalid update reading");
1777
1778
  if (typeof row["checkedAt"] !== "number" || !Number.isFinite(row["checkedAt"])) {
1778
1779
  throw new Error("invalid update reading");
1779
1780
  }
@@ -1781,7 +1782,8 @@ function parseUpdateStatus(value) {
1781
1782
  current: row["current"],
1782
1783
  latest: typeof row["latest"] === "string" ? row["latest"] : void 0,
1783
1784
  available: row["available"],
1784
- checkedAt: row["checkedAt"]
1785
+ checkedAt: row["checkedAt"],
1786
+ checked: row["checked"]
1785
1787
  };
1786
1788
  }
1787
1789
  var codec2 = (typeSymbol, parse) => ({
@@ -2059,10 +2061,11 @@ function createUpdateChecker(deps) {
2059
2061
  current: deps.currentVersion,
2060
2062
  latest,
2061
2063
  available: isUpdateAvailable(deps.currentVersion, latest),
2062
- checkedAt
2064
+ checkedAt,
2065
+ checked: true
2063
2066
  };
2064
2067
  } catch {
2065
- return { current: deps.currentVersion, latest: void 0, available: false, checkedAt };
2068
+ return { current: deps.currentVersion, latest: void 0, available: false, checkedAt, checked: false };
2066
2069
  }
2067
2070
  }
2068
2071
  return {
@@ -2079,7 +2082,7 @@ function createUpdateChecker(deps) {
2079
2082
  }
2080
2083
 
2081
2084
  // src/update/version.ts
2082
- var PLUGIN_VERSION = true ? "0.1.26" : "0.0.0-dev";
2085
+ var PLUGIN_VERSION = true ? "0.1.28" : "0.0.0-dev";
2083
2086
 
2084
2087
  // src/update/service.ts
2085
2088
  import { TypertRemoteService as TypertRemoteService2 } from "@deepseek-ai/dsh-typert-protocol";
@@ -33,6 +33,15 @@ export interface UpdateStatus {
33
33
  readonly available: boolean;
34
34
  /** Milliseconds since the epoch of the lookup backing this reading. */
35
35
  readonly checkedAt: number;
36
+ /**
37
+ * Whether the registry actually answered.
38
+ *
39
+ * `false` means the reading is a placeholder for a failed lookup: "no update
40
+ * known", which is not the same fact as "up to date". The page must not
41
+ * render the two alike — reporting an unreachable registry as a current
42
+ * version is a silent lie of exactly the kind that hid the update panel.
43
+ */
44
+ readonly checked: boolean;
36
45
  }
37
46
  interface ParsedVersion {
38
47
  readonly core: readonly number[];
@@ -111,10 +111,13 @@ export function createUpdateChecker(deps) {
111
111
  latest,
112
112
  available: isUpdateAvailable(deps.currentVersion, latest),
113
113
  checkedAt,
114
+ checked: true,
114
115
  };
115
116
  }
116
117
  catch {
117
- return { current: deps.currentVersion, latest: undefined, available: false, checkedAt };
118
+ // The lookup failed, so no version is known. `checked: false` keeps that
119
+ // distinguishable from a confirmed "already latest" reading.
120
+ return { current: deps.currentVersion, latest: undefined, available: false, checkedAt, checked: false };
118
121
  }
119
122
  }
120
123
  return {
@@ -18,6 +18,8 @@ export function parseUpdateStatus(value) {
18
18
  throw new Error('invalid update reading');
19
19
  if (typeof row['available'] !== 'boolean')
20
20
  throw new Error('invalid update reading');
21
+ if (typeof row['checked'] !== 'boolean')
22
+ throw new Error('invalid update reading');
21
23
  if (typeof row['checkedAt'] !== 'number' || !Number.isFinite(row['checkedAt'])) {
22
24
  throw new Error('invalid update reading');
23
25
  }
@@ -26,6 +28,7 @@ export function parseUpdateStatus(value) {
26
28
  latest: typeof row['latest'] === 'string' ? row['latest'] : undefined,
27
29
  available: row['available'],
28
30
  checkedAt: row['checkedAt'],
31
+ checked: row['checked'],
29
32
  };
30
33
  }
31
34
  /** Codec shape accepted by both released and source DSH builds. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dan-ai-studio/dshopencodego",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "OpenCode Go provider for DeepSeek Harness: live gateway catalog, per-conversation session header, usage",
5
5
  "type": "module",
6
6
  "license": "MIT",