dsh-opendesign-corouter 0.1.11 → 0.1.13
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.md +2 -2
- package/SECURITY.md +1 -0
- package/lib/adapter.d.ts +2 -0
- package/lib/catalog.d.ts +8 -6
- package/lib/claude-capabilities.d.ts +8 -0
- package/lib/claude-parameters.d.ts +3 -0
- package/lib/client.d.ts +7 -1
- package/lib/client.js +248 -45
- package/lib/device-auth.d.ts +1 -1
- package/lib/generated/typert.host.js +12 -1
- package/lib/generated/typert.remote-client.js +12 -1
- package/lib/index.js +453 -118
- package/lib/index.js.map +4 -4
- package/lib/model-settings.d.ts +4 -3
- package/lib/protocols/messages.d.ts +5 -7
- package/lib/protocols/types.d.ts +10 -1
- package/lib/remote.d.ts +2 -0
- package/lib/replay-key.d.ts +13 -0
- package/package.json +1 -1
package/lib/device-auth.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface DeviceTokens {
|
|
|
3
3
|
runtimeKey: string;
|
|
4
4
|
}
|
|
5
5
|
export declare const DEVICE_AUTH_ENDPOINT = "https://amr-api.open-design.ai/api/v1/cli/device-authorizations";
|
|
6
|
-
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.
|
|
6
|
+
export declare const DEVICE_AUTH_PLUGIN_VERSION = "0.1.13";
|
|
7
7
|
export declare const DEVICE_REQUEST_TIMEOUT_MS = 20000;
|
|
8
8
|
/** One bounded launch step of the temporary activation window. */
|
|
9
9
|
export declare const DEVICE_OPEN_TIMEOUT_MS = 30000;
|
|
@@ -43,7 +43,7 @@ function parseModelSettingsMap(value) {
|
|
|
43
43
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
44
|
const keys = Object.keys(value);
|
|
45
45
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
46
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
46
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
47
47
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
48
48
|
const out = {};
|
|
49
49
|
for (const id of keys) {
|
|
@@ -60,6 +60,10 @@ function parseModelSettingsMap(value) {
|
|
|
60
60
|
if (typeof settings.enabled !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
61
61
|
parsed.enabled = settings.enabled;
|
|
62
62
|
}
|
|
63
|
+
if (settings.imageInput !== void 0) {
|
|
64
|
+
if (typeof settings.imageInput !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 imageInput \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
65
|
+
parsed.imageInput = settings.imageInput;
|
|
66
|
+
}
|
|
63
67
|
for (const [field, max] of [["temperature", 2], ["topP", 1]]) {
|
|
64
68
|
const item = settings[field];
|
|
65
69
|
if (item === void 0) continue;
|
|
@@ -131,6 +135,12 @@ function parseEfforts(value) {
|
|
|
131
135
|
if (!Array.isArray(value) || value.length > 16) throw new Error("\u6A21\u578B\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
132
136
|
return value.map((item) => text(item, "\u601D\u8003\u6863\u4F4D", 32));
|
|
133
137
|
}
|
|
138
|
+
function parseModalities(value) {
|
|
139
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 2) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
140
|
+
const modes = value.map((item) => member(item, ["text", "image"], "\u6A21\u578B\u8F93\u5165\u6A21\u6001"));
|
|
141
|
+
if (!modes.includes("text") || new Set(modes).size !== modes.length) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
142
|
+
return modes;
|
|
143
|
+
}
|
|
134
144
|
function member(value, allowed, label) {
|
|
135
145
|
const hit = allowed.find((candidate) => candidate === value);
|
|
136
146
|
if (hit === void 0) throw new Error(`${label} \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185`);
|
|
@@ -245,6 +255,7 @@ function parseStatusModel(value) {
|
|
|
245
255
|
name: text(value.name, "\u6A21\u578B\u540D", 128),
|
|
246
256
|
group: member(value.group, MODEL_GROUPS, "\u6A21\u578B\u5206\u7EC4"),
|
|
247
257
|
...value.enabled === void 0 ? {} : { enabled: flag(value.enabled, "\u6A21\u578B\u542F\u7528\u72B6\u6001") },
|
|
258
|
+
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
248
259
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
249
260
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
250
261
|
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|
|
@@ -43,7 +43,7 @@ function parseModelSettingsMap(value) {
|
|
|
43
43
|
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u5FC5\u987B\u662F\u5BF9\u8C61");
|
|
44
44
|
const keys = Object.keys(value);
|
|
45
45
|
if (keys.length > 512) throw new Error("\u6A21\u578B\u8BBE\u7F6E\u6700\u591A\u5141\u8BB8 512 \u4E2A\u6A21\u578B");
|
|
46
|
-
const fields = /* @__PURE__ */ new Set(["enabled", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
46
|
+
const fields = /* @__PURE__ */ new Set(["enabled", "imageInput", "temperature", "topP", "maxTokens", "contextWindow", "reasoningEffort"]);
|
|
47
47
|
const efforts = ["none", "minimal", "low", "medium", "high", "xhigh", "ultra", "max"];
|
|
48
48
|
const out = {};
|
|
49
49
|
for (const id of keys) {
|
|
@@ -60,6 +60,10 @@ function parseModelSettingsMap(value) {
|
|
|
60
60
|
if (typeof settings.enabled !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 enabled \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
61
61
|
parsed.enabled = settings.enabled;
|
|
62
62
|
}
|
|
63
|
+
if (settings.imageInput !== void 0) {
|
|
64
|
+
if (typeof settings.imageInput !== "boolean") throw new Error("\u6A21\u578B\u8BBE\u7F6E\u7684 imageInput \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
|
|
65
|
+
parsed.imageInput = settings.imageInput;
|
|
66
|
+
}
|
|
63
67
|
for (const [field, max] of [["temperature", 2], ["topP", 1]]) {
|
|
64
68
|
const item = settings[field];
|
|
65
69
|
if (item === void 0) continue;
|
|
@@ -131,6 +135,12 @@ function parseEfforts(value) {
|
|
|
131
135
|
if (!Array.isArray(value) || value.length > 16) throw new Error("\u6A21\u578B\u601D\u8003\u6863\u4F4D\u683C\u5F0F\u65E0\u6548");
|
|
132
136
|
return value.map((item) => text(item, "\u601D\u8003\u6863\u4F4D", 32));
|
|
133
137
|
}
|
|
138
|
+
function parseModalities(value) {
|
|
139
|
+
if (!Array.isArray(value) || value.length < 1 || value.length > 2) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
140
|
+
const modes = value.map((item) => member(item, ["text", "image"], "\u6A21\u578B\u8F93\u5165\u6A21\u6001"));
|
|
141
|
+
if (!modes.includes("text") || new Set(modes).size !== modes.length) throw new Error("\u6A21\u578B\u8F93\u5165\u6A21\u6001\u683C\u5F0F\u65E0\u6548");
|
|
142
|
+
return modes;
|
|
143
|
+
}
|
|
134
144
|
function member(value, allowed, label) {
|
|
135
145
|
const hit = allowed.find((candidate) => candidate === value);
|
|
136
146
|
if (hit === void 0) throw new Error(`${label} \u4E0D\u5728\u5141\u8BB8\u7684\u53D6\u503C\u5185`);
|
|
@@ -245,6 +255,7 @@ function parseStatusModel(value) {
|
|
|
245
255
|
name: text(value.name, "\u6A21\u578B\u540D", 128),
|
|
246
256
|
group: member(value.group, MODEL_GROUPS, "\u6A21\u578B\u5206\u7EC4"),
|
|
247
257
|
...value.enabled === void 0 ? {} : { enabled: flag(value.enabled, "\u6A21\u578B\u542F\u7528\u72B6\u6001") },
|
|
258
|
+
...value.inputModalities === void 0 ? {} : { inputModalities: parseModalities(value.inputModalities) },
|
|
248
259
|
...value.contextWindow === void 0 ? {} : { contextWindow: positiveInteger(value.contextWindow, "\u4E0A\u4E0B\u6587\u9884\u7B97", 1e8) },
|
|
249
260
|
...value.maxOutputTokens === void 0 ? {} : { maxOutputTokens: positiveInteger(value.maxOutputTokens, "\u6700\u5927\u8F93\u51FA", 1e7) },
|
|
250
261
|
...value.reasoningEfforts === void 0 ? {} : { reasoningEfforts: parseEfforts(value.reasoningEfforts) }
|