@liyang8246/dsh-accounts 0.1.13 → 0.1.15
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/index.js +3 -56
- package/package.json +1 -2
package/lib/index.js
CHANGED
|
@@ -7356,7 +7356,7 @@ var ModelAccountsService = class {
|
|
|
7356
7356
|
await consumeCodexResetCredit(await this.accounts.resolve(view.channel, signal, id), signal);
|
|
7357
7357
|
await this.refreshQuota(id, signal);
|
|
7358
7358
|
}
|
|
7359
|
-
async dispatch(raw,
|
|
7359
|
+
async dispatch(raw, signal) {
|
|
7360
7360
|
if (this.controller.signal.aborted) throw new Error("Plugin is unloading");
|
|
7361
7361
|
const args = record(raw);
|
|
7362
7362
|
const action = text(args.action, "action");
|
|
@@ -7364,7 +7364,7 @@ var ModelAccountsService = class {
|
|
|
7364
7364
|
case "list": {
|
|
7365
7365
|
const snapshot = await this.snapshot();
|
|
7366
7366
|
const login = this.logins.pending;
|
|
7367
|
-
return
|
|
7367
|
+
return login ? {
|
|
7368
7368
|
...snapshot,
|
|
7369
7369
|
login
|
|
7370
7370
|
} : snapshot;
|
|
@@ -7388,11 +7388,9 @@ var ModelAccountsService = class {
|
|
|
7388
7388
|
break;
|
|
7389
7389
|
}
|
|
7390
7390
|
case "reset_credit":
|
|
7391
|
-
if (origin !== "ui") throw new Error("Resetting quota is user-only; open Settings → Model Accounts");
|
|
7392
7391
|
await this.resetCredit(text(args.id, "account id"), signal);
|
|
7393
7392
|
break;
|
|
7394
7393
|
case "set_filter":
|
|
7395
|
-
if (origin !== "ui") throw new Error("The model filter is user-only; open Settings → Model Accounts");
|
|
7396
7394
|
await this.accounts.saveFilter(filterText(args.filter));
|
|
7397
7395
|
break;
|
|
7398
7396
|
case "refresh_quota": {
|
|
@@ -7403,7 +7401,6 @@ var ModelAccountsService = class {
|
|
|
7403
7401
|
break;
|
|
7404
7402
|
}
|
|
7405
7403
|
default:
|
|
7406
|
-
if (origin !== "ui") throw new Error("Authentication is user-only; open Settings → Model Accounts");
|
|
7407
7404
|
if (action !== "add_key") return this.logins.dispatch(action, args);
|
|
7408
7405
|
await this.accounts.add(channelFor(args.channel).id, text(args.label, "account label"), {
|
|
7409
7406
|
kind: "api-key",
|
|
@@ -29371,57 +29368,8 @@ const inject = [
|
|
|
29371
29368
|
"llm",
|
|
29372
29369
|
"credentials",
|
|
29373
29370
|
"connection",
|
|
29374
|
-
"tools",
|
|
29375
29371
|
"attachments"
|
|
29376
29372
|
];
|
|
29377
|
-
function accountTool(service) {
|
|
29378
|
-
return {
|
|
29379
|
-
name: "zephyr_accounts",
|
|
29380
|
-
description: "List model-channel accounts, select one active account per channel, rename/remove a saved login, or refresh quota. Removal does not revoke upstream access. Login and API-key entry are user-only in Settings → Model Accounts. Never returns tokens.",
|
|
29381
|
-
parameters: {
|
|
29382
|
-
type: "object",
|
|
29383
|
-
properties: {
|
|
29384
|
-
action: {
|
|
29385
|
-
type: "string",
|
|
29386
|
-
enum: [
|
|
29387
|
-
"list",
|
|
29388
|
-
"activate",
|
|
29389
|
-
"deactivate",
|
|
29390
|
-
"rename",
|
|
29391
|
-
"remove",
|
|
29392
|
-
"refresh_quota"
|
|
29393
|
-
]
|
|
29394
|
-
},
|
|
29395
|
-
channel: {
|
|
29396
|
-
type: "string",
|
|
29397
|
-
enum: channels.map((channel) => channel.id),
|
|
29398
|
-
description: "Required for activate/deactivate."
|
|
29399
|
-
},
|
|
29400
|
-
id: {
|
|
29401
|
-
type: "string",
|
|
29402
|
-
description: "Account id returned by list. Required for activate/rename/remove; omit to refresh all quotas."
|
|
29403
|
-
},
|
|
29404
|
-
label: {
|
|
29405
|
-
type: "string",
|
|
29406
|
-
description: "New display label, required for rename."
|
|
29407
|
-
}
|
|
29408
|
-
},
|
|
29409
|
-
required: ["action"],
|
|
29410
|
-
additionalProperties: false
|
|
29411
|
-
},
|
|
29412
|
-
output: {
|
|
29413
|
-
schema: {
|
|
29414
|
-
type: "object",
|
|
29415
|
-
additionalProperties: true
|
|
29416
|
-
},
|
|
29417
|
-
render: (_args, value) => [{
|
|
29418
|
-
type: "text",
|
|
29419
|
-
text: JSON.stringify(value)
|
|
29420
|
-
}]
|
|
29421
|
-
},
|
|
29422
|
-
execute: (args, exec) => service.dispatch(args, "agent", exec.signal)
|
|
29423
|
-
};
|
|
29424
|
-
}
|
|
29425
29373
|
function apply(ctx) {
|
|
29426
29374
|
const service = new ModelAccountsService(ctx);
|
|
29427
29375
|
const transport = createTransport(ctx, (channel, signal) => service.accounts.resolve(channel, signal), service.catalog, (channel, signal) => service.refreshCatalog(channel, signal));
|
|
@@ -29449,7 +29397,6 @@ function apply(ctx) {
|
|
|
29449
29397
|
registration?.();
|
|
29450
29398
|
};
|
|
29451
29399
|
});
|
|
29452
|
-
ctx.effect(() => ctx.tools.register(accountTool(service)));
|
|
29453
29400
|
ctx.effect(() => ctx.connection.fetch.register({
|
|
29454
29401
|
path: "/api/zephyr-models",
|
|
29455
29402
|
methods: ["POST"],
|
|
@@ -29457,7 +29404,7 @@ function apply(ctx) {
|
|
|
29457
29404
|
async fetch(request) {
|
|
29458
29405
|
try {
|
|
29459
29406
|
const args = await jsonResponse(new Response(request.body), 65536);
|
|
29460
|
-
const value = await service.dispatch(args,
|
|
29407
|
+
const value = await service.dispatch(args, request.signal);
|
|
29461
29408
|
return Response.json(value, { headers: { "Cache-Control": "no-store" } });
|
|
29462
29409
|
} catch (error) {
|
|
29463
29410
|
return Response.json({ error: safeError(error) }, {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liyang8246/dsh-accounts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.15",
|
|
5
5
|
"description": "Independent multi-account Codex, OpenCode Go and CommandCode Go plugin for DeepSeek Harness.",
|
|
6
6
|
"repository": { "type": "git", "url": "https://github.com/liyang8246/dsh-zolin.git", "directory": "packages/dsh-accounts" },
|
|
7
7
|
"exports": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.5",
|
|
34
34
|
"@deepseek-ai/dsh-credentials": "0.2.1-rc.5",
|
|
35
35
|
"@deepseek-ai/dsh-llm": "0.2.1-rc.5",
|
|
36
|
-
"@deepseek-ai/dsh-tools": "0.2.1-rc.5",
|
|
37
36
|
"@earendil-works/pi-ai": "1.1.0"
|
|
38
37
|
},
|
|
39
38
|
"dsh": {
|