@dan-ai-studio/dshopencodego 0.1.24 → 0.1.26
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 +51 -8
- package/lib/index.js +24 -4
- package/lib/types/update/contract.d.ts +2 -1
- package/lib/types/update/contract.js +9 -0
- package/lib/types/update/service.d.ts +11 -2
- package/lib/types/update/service.js +14 -3
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -186,6 +186,15 @@ var updateRemote = {
|
|
|
186
186
|
invocation: { kind: "direct" },
|
|
187
187
|
parameters: [],
|
|
188
188
|
result: codec2("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: "@dan-ai-studio/dshopencodego#opencodeGoUpdate/refreshUpdate",
|
|
192
|
+
service: "opencodeGoUpdate",
|
|
193
|
+
namespace: "opencodeGoUpdate",
|
|
194
|
+
method: "refreshUpdate",
|
|
195
|
+
invocation: { kind: "direct" },
|
|
196
|
+
parameters: [],
|
|
197
|
+
result: codec2("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
189
198
|
}
|
|
190
199
|
]
|
|
191
200
|
};
|
|
@@ -356,6 +365,7 @@ var en = {
|
|
|
356
365
|
updateDone: "Updated to",
|
|
357
366
|
updateRestart: "Restart DSH to finish applying the update.",
|
|
358
367
|
updateFailed: "Update failed:",
|
|
368
|
+
updateRemoteMissing: "The update service is not ready yet; choose Check again to retry.",
|
|
359
369
|
updateStopProfile: "The running version cannot be removed without a restart; restart DSH first, then retry.",
|
|
360
370
|
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).",
|
|
361
371
|
updatePendingBuilds: "Installation needs build-script approval; approve it on the plugin manager page, then retry."
|
|
@@ -441,6 +451,7 @@ var zh = {
|
|
|
441
451
|
updateDone: "\u5DF2\u66F4\u65B0\u5230",
|
|
442
452
|
updateRestart: "\u8BF7\u91CD\u542F DSH \u4EE5\u5B8C\u6210\u66F4\u65B0\u3002",
|
|
443
453
|
updateFailed: "\u66F4\u65B0\u5931\u8D25\uFF1A",
|
|
454
|
+
updateRemoteMissing: "\u66F4\u65B0\u670D\u52A1\u5C1A\u672A\u5C31\u7EEA\uFF1B\u8BF7\u70B9\u51FB\u201C\u91CD\u65B0\u68C0\u67E5\u201D\u91CD\u8BD5\u3002",
|
|
444
455
|
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",
|
|
445
456
|
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",
|
|
446
457
|
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"
|
|
@@ -541,12 +552,14 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id) + "]")
|
|
|
541
552
|
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)}";
|
|
542
553
|
document.head.appendChild(style);
|
|
543
554
|
}
|
|
544
|
-
var section_default = { "
|
|
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" };
|
|
545
556
|
|
|
546
557
|
// src/client/Section.tsx
|
|
547
558
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
548
559
|
var API_KEY_REF = "OPENCODE_GO_API_KEY";
|
|
549
560
|
var VISIBILITY_WRITE_DELAY_MS = 250;
|
|
561
|
+
var UPDATE_MOUNT_WAIT_MS = 2e3;
|
|
562
|
+
var UPDATE_MOUNT_POLL_MS = 50;
|
|
550
563
|
var INITIAL = {
|
|
551
564
|
loading: true,
|
|
552
565
|
reading: void 0,
|
|
@@ -637,18 +650,47 @@ var SectionController = class _SectionController {
|
|
|
637
650
|
this.set({ keyConfigured: void 0 });
|
|
638
651
|
}
|
|
639
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* The update Remote, waiting for its namespace to finish mounting.
|
|
655
|
+
*
|
|
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.
|
|
662
|
+
* @returns the mounted update Remote.
|
|
663
|
+
* @throws {Error} `remote-not-mounted` when it never appears.
|
|
664
|
+
*/
|
|
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
|
+
}
|
|
675
|
+
}
|
|
640
676
|
/**
|
|
641
677
|
* Ask the Host whether a newer release is published.
|
|
642
678
|
*
|
|
643
679
|
* The Host answers from a cached registry reading and fails silent, so an
|
|
644
|
-
* unreachable registry
|
|
645
|
-
* once with the page and again only on explicit refresh.
|
|
680
|
+
* unreachable registry still answers "no update known" rather than erroring
|
|
681
|
+
* the page. Runs once with the page and again only on explicit refresh.
|
|
682
|
+
*
|
|
683
|
+
* Both wire methods take zero arguments: the gateway client rejects any
|
|
684
|
+
* call whose positional arity differs from the descriptor's `parameters`,
|
|
685
|
+
* so the cached read and the forced refresh are two methods (`readUpdate`
|
|
686
|
+
* / `refreshUpdate`), never one method with a flag.
|
|
646
687
|
*/
|
|
647
688
|
async checkUpdate(force) {
|
|
648
689
|
const previous = this.state.update;
|
|
649
690
|
this.set({ update: { ...previous, phase: "checking", message: void 0 } });
|
|
650
691
|
try {
|
|
651
|
-
const
|
|
692
|
+
const remote = await this.updateRemote();
|
|
693
|
+
const result = force ? await remote.refreshUpdate() : await remote.readUpdate();
|
|
652
694
|
if (!result.ok) throw result.error;
|
|
653
695
|
const status = result.value;
|
|
654
696
|
this.set({
|
|
@@ -661,9 +703,9 @@ var SectionController = class _SectionController {
|
|
|
661
703
|
} catch (error) {
|
|
662
704
|
this.set({
|
|
663
705
|
update: {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
message: error instanceof Error ? error.message :
|
|
706
|
+
phase: "failed",
|
|
707
|
+
status: previous.status,
|
|
708
|
+
message: error instanceof Error ? error.message : "the update check failed"
|
|
667
709
|
}
|
|
668
710
|
});
|
|
669
711
|
}
|
|
@@ -999,6 +1041,7 @@ function UpdateBanner({ controller, t, busy, act, update }) {
|
|
|
999
1041
|
}
|
|
1000
1042
|
function updateFailureText(message, t) {
|
|
1001
1043
|
if (message === void 0 || message.length === 0) return "";
|
|
1044
|
+
if (message === "remote-not-mounted") return t("updateRemoteMissing");
|
|
1002
1045
|
if (message === "stop-profile") return t("updateStopProfile");
|
|
1003
1046
|
if (message === "incompatible-version") return t("updateIncompatible");
|
|
1004
1047
|
if (message === "pending-builds") return t("updatePendingBuilds");
|
|
@@ -1271,7 +1314,7 @@ if (!document.querySelector("style[data-plugin-css=" + JSON.stringify(id2) + "]"
|
|
|
1271
1314
|
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}";
|
|
1272
1315
|
document.head.appendChild(style);
|
|
1273
1316
|
}
|
|
1274
|
-
var pill_default = { "
|
|
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" };
|
|
1275
1318
|
|
|
1276
1319
|
// src/client/UsagePill.tsx
|
|
1277
1320
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
package/lib/index.js
CHANGED
|
@@ -1801,6 +1801,15 @@ var updateRemote = {
|
|
|
1801
1801
|
invocation: { kind: "direct" },
|
|
1802
1802
|
parameters: [],
|
|
1803
1803
|
result: codec2("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
id: "@dan-ai-studio/dshopencodego#opencodeGoUpdate/refreshUpdate",
|
|
1807
|
+
service: "opencodeGoUpdate",
|
|
1808
|
+
namespace: "opencodeGoUpdate",
|
|
1809
|
+
method: "refreshUpdate",
|
|
1810
|
+
invocation: { kind: "direct" },
|
|
1811
|
+
parameters: [],
|
|
1812
|
+
result: codec2("@dan-ai-studio/dshopencodego#UpdateStatus", parseUpdateStatus)
|
|
1804
1813
|
}
|
|
1805
1814
|
]
|
|
1806
1815
|
};
|
|
@@ -2070,7 +2079,7 @@ function createUpdateChecker(deps) {
|
|
|
2070
2079
|
}
|
|
2071
2080
|
|
|
2072
2081
|
// src/update/version.ts
|
|
2073
|
-
var PLUGIN_VERSION = true ? "0.1.
|
|
2082
|
+
var PLUGIN_VERSION = true ? "0.1.26" : "0.0.0-dev";
|
|
2074
2083
|
|
|
2075
2084
|
// src/update/service.ts
|
|
2076
2085
|
import { TypertRemoteService as TypertRemoteService2 } from "@deepseek-ai/dsh-typert-protocol";
|
|
@@ -2081,9 +2090,20 @@ var OpencodeGoUpdateService = class extends TypertRemoteService2 {
|
|
|
2081
2090
|
const checker = createUpdateChecker({ currentVersion: options.currentVersion });
|
|
2082
2091
|
this.check = (force) => checker.check(force);
|
|
2083
2092
|
}
|
|
2084
|
-
/**
|
|
2085
|
-
|
|
2086
|
-
|
|
2093
|
+
/**
|
|
2094
|
+
* Whether a newer release is published (cached reading).
|
|
2095
|
+
*
|
|
2096
|
+
* The wire method takes no arguments — the gateway client rejects any call
|
|
2097
|
+
* whose positional arity differs from the descriptor's `parameters`, so a
|
|
2098
|
+
* `force` flag cannot ride this call. Forced revalidation is the separate
|
|
2099
|
+
* `refreshUpdate` method below, mirroring the catalog's read/refresh pair.
|
|
2100
|
+
*/
|
|
2101
|
+
readUpdate() {
|
|
2102
|
+
return this.check(false);
|
|
2103
|
+
}
|
|
2104
|
+
/** Revalidate against the registry, bypassing the cache. */
|
|
2105
|
+
refreshUpdate() {
|
|
2106
|
+
return this.check(true);
|
|
2087
2107
|
}
|
|
2088
2108
|
};
|
|
2089
2109
|
|
|
@@ -15,7 +15,8 @@ export declare function parseUpdateStatus(value: unknown): UpdateStatus;
|
|
|
15
15
|
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
16
16
|
interface TypertRemoteNamespaceMap {
|
|
17
17
|
opencodeGoUpdate: {
|
|
18
|
-
readUpdate(
|
|
18
|
+
readUpdate(): Promise<RemoteResult<UpdateStatus>>;
|
|
19
|
+
refreshUpdate(): Promise<RemoteResult<UpdateStatus>>;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -48,5 +48,14 @@ export const updateRemote = {
|
|
|
48
48
|
parameters: [],
|
|
49
49
|
result: codec('@dan-ai-studio/dshopencodego#UpdateStatus', parseUpdateStatus),
|
|
50
50
|
},
|
|
51
|
+
{
|
|
52
|
+
id: '@dan-ai-studio/dshopencodego#opencodeGoUpdate/refreshUpdate',
|
|
53
|
+
service: 'opencodeGoUpdate',
|
|
54
|
+
namespace: 'opencodeGoUpdate',
|
|
55
|
+
method: 'refreshUpdate',
|
|
56
|
+
invocation: { kind: 'direct' },
|
|
57
|
+
parameters: [],
|
|
58
|
+
result: codec('@dan-ai-studio/dshopencodego#UpdateStatus', parseUpdateStatus),
|
|
59
|
+
},
|
|
51
60
|
],
|
|
52
61
|
};
|
|
@@ -23,6 +23,15 @@ export interface UpdateServiceOptions {
|
|
|
23
23
|
export declare class OpencodeGoUpdateService extends TypertRemoteService {
|
|
24
24
|
private readonly check;
|
|
25
25
|
constructor(ctx: Context, options: UpdateServiceOptions);
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Whether a newer release is published (cached reading).
|
|
28
|
+
*
|
|
29
|
+
* The wire method takes no arguments — the gateway client rejects any call
|
|
30
|
+
* whose positional arity differs from the descriptor's `parameters`, so a
|
|
31
|
+
* `force` flag cannot ride this call. Forced revalidation is the separate
|
|
32
|
+
* `refreshUpdate` method below, mirroring the catalog's read/refresh pair.
|
|
33
|
+
*/
|
|
34
|
+
readUpdate(): Promise<UpdateStatus>;
|
|
35
|
+
/** Revalidate against the registry, bypassing the cache. */
|
|
36
|
+
refreshUpdate(): Promise<UpdateStatus>;
|
|
28
37
|
}
|
|
@@ -21,8 +21,19 @@ export class OpencodeGoUpdateService extends TypertRemoteService {
|
|
|
21
21
|
const checker = createUpdateChecker({ currentVersion: options.currentVersion });
|
|
22
22
|
this.check = (force) => checker.check(force);
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Whether a newer release is published (cached reading).
|
|
26
|
+
*
|
|
27
|
+
* The wire method takes no arguments — the gateway client rejects any call
|
|
28
|
+
* whose positional arity differs from the descriptor's `parameters`, so a
|
|
29
|
+
* `force` flag cannot ride this call. Forced revalidation is the separate
|
|
30
|
+
* `refreshUpdate` method below, mirroring the catalog's read/refresh pair.
|
|
31
|
+
*/
|
|
32
|
+
readUpdate() {
|
|
33
|
+
return this.check(false);
|
|
34
|
+
}
|
|
35
|
+
/** Revalidate against the registry, bypassing the cache. */
|
|
36
|
+
refreshUpdate() {
|
|
37
|
+
return this.check(true);
|
|
27
38
|
}
|
|
28
39
|
}
|
package/package.json
CHANGED