@eddyskywalker/dsh-chatgpt-subscription 0.1.17 → 0.1.19
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/CHANGELOG.md +3 -1
- package/README.md +3 -2
- package/lib/client.js +376 -82
- package/lib/client.js.map +1 -1
- package/lib/index.js +231 -22
- package/lib/types/client/CodexSubscriptionSection.d.ts +1 -0
- package/lib/types/client/CodexSubscriptionSection.d.ts.map +1 -1
- package/lib/types/client/SubagentSettingsSection.d.ts +9 -0
- package/lib/types/client/SubagentSettingsSection.d.ts.map +1 -0
- package/lib/types/client/api.d.ts +2 -1
- package/lib/types/client/api.d.ts.map +1 -1
- package/lib/types/client/index.d.ts.map +1 -1
- package/lib/types/client/locales.d.ts +39 -5
- package/lib/types/client/locales.d.ts.map +1 -1
- package/lib/types/client/styles.d.ts.map +1 -1
- package/lib/types/host/preferences.d.ts.map +1 -1
- package/lib/types/host/routes.d.ts.map +1 -1
- package/lib/types/host/subagent-context-adapter.d.ts +24 -0
- package/lib/types/host/subagent-context-adapter.d.ts.map +1 -0
- package/lib/types/host/subagent-model-preference.d.ts +1 -4
- package/lib/types/host/subagent-model-preference.d.ts.map +1 -1
- package/lib/types/host/subagent-policy.d.ts +17 -0
- package/lib/types/host/subagent-policy.d.ts.map +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/contracts.d.ts +36 -2
- package/lib/types/shared/contracts.d.ts.map +1 -1
- package/lib/types/shared/preferences.d.ts +1 -0
- package/lib/types/shared/preferences.d.ts.map +1 -1
- package/package.json +3 -1
package/lib/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { constants } from "node:fs";
|
|
|
11
11
|
import { chmod, lstat, mkdir, open, rename, stat, unlink } from "node:fs/promises";
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import { dirname, join } from "node:path";
|
|
14
|
+
import { delegationDepthOf } from "@deepseek-ai/dsh-subagent";
|
|
14
15
|
//#region src/compat.ts
|
|
15
16
|
/**
|
|
16
17
|
* Compatibility constants for the ChatGPT-backed Codex flow. The backend and
|
|
@@ -124,15 +125,6 @@ const GPT_56_REASONING_EFFORTS = [...STANDARD_REASONING_EFFORTS, "max"];
|
|
|
124
125
|
function reasoningEffortsForModel(model) {
|
|
125
126
|
return resolveCodexCatalogEntry(model).reasoningProfile === "gpt-5.6" ? GPT_56_REASONING_EFFORTS : STANDARD_REASONING_EFFORTS;
|
|
126
127
|
}
|
|
127
|
-
function isCodexReasoningEffort(value) {
|
|
128
|
-
return typeof value === "string" && GPT_56_REASONING_EFFORTS.some((effort) => effort === value);
|
|
129
|
-
}
|
|
130
|
-
function modelSupportsReasoningEffort(model, effort) {
|
|
131
|
-
return isCodexReasoningEffort(effort) && reasoningEffortsForModel(model).some((candidate) => candidate === effort);
|
|
132
|
-
}
|
|
133
|
-
function isCodexModelId(model) {
|
|
134
|
-
return typeof model === "string" && CODEX_MODEL_CATALOG.some((entry) => entry.id === model);
|
|
135
|
-
}
|
|
136
128
|
function isConfigurableContextModelId(model) {
|
|
137
129
|
return typeof model === "string" && CONFIGURABLE_CONTEXT_MODEL_IDS.some((id) => id === model);
|
|
138
130
|
}
|
|
@@ -1071,8 +1063,12 @@ const PREFERENCES_NAMESPACE = "dsh-chatgpt-subscription";
|
|
|
1071
1063
|
const DEFAULT_PREFERENCES = {
|
|
1072
1064
|
quickQuotaVisible: false,
|
|
1073
1065
|
searchProvider: "dsh",
|
|
1066
|
+
subagentProvider: "codex-chatgpt",
|
|
1074
1067
|
subagentModel: "gpt-5.6-sol",
|
|
1075
1068
|
subagentReasoningEffort: "medium",
|
|
1069
|
+
subagentContextWindow: 272e3,
|
|
1070
|
+
subagentMaxDepth: 3,
|
|
1071
|
+
subagentMaxAgents: 8,
|
|
1076
1072
|
contextWindowOverrides: {
|
|
1077
1073
|
"gpt-5.6-sol": 272e3,
|
|
1078
1074
|
"gpt-5.6-terra": 272e3,
|
|
@@ -1089,8 +1085,12 @@ function registerPreferenceStore(settings) {
|
|
|
1089
1085
|
return new SettingsPreferenceStore(settings.register(settingsNamespace(PREFERENCES_NAMESPACE), z.object({
|
|
1090
1086
|
quickQuotaVisible: z.boolean().default(DEFAULT_PREFERENCES.quickQuotaVisible),
|
|
1091
1087
|
searchProvider: z.union([z.const("dsh"), z.const(SEARCH_PROVIDER_CODEX)]).default(DEFAULT_PREFERENCES.searchProvider),
|
|
1088
|
+
subagentProvider: z.string().default(DEFAULT_PREFERENCES.subagentProvider),
|
|
1092
1089
|
subagentModel: z.string().default(DEFAULT_PREFERENCES.subagentModel),
|
|
1093
|
-
subagentReasoningEffort: z.string().default(DEFAULT_PREFERENCES.subagentReasoningEffort),
|
|
1090
|
+
subagentReasoningEffort: z.union([z.string(), z.const(null)]).default(DEFAULT_PREFERENCES.subagentReasoningEffort),
|
|
1091
|
+
subagentContextWindow: z.number().step(1).min(1).default(DEFAULT_PREFERENCES.subagentContextWindow),
|
|
1092
|
+
subagentMaxDepth: z.number().step(1).min(0).max(3).default(DEFAULT_PREFERENCES.subagentMaxDepth),
|
|
1093
|
+
subagentMaxAgents: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(DEFAULT_PREFERENCES.subagentMaxAgents),
|
|
1094
1094
|
contextWindowOverrides: z.object({
|
|
1095
1095
|
"gpt-5.6-sol": z.number().step(1).min(1).max(GPT_56_MAX_CONTEXT_WINDOW).default(DEFAULT_PREFERENCES.contextWindowOverrides["gpt-5.6-sol"]),
|
|
1096
1096
|
"gpt-5.6-terra": z.number().step(1).min(1).max(GPT_56_MAX_CONTEXT_WINDOW).default(DEFAULT_PREFERENCES.contextWindowOverrides["gpt-5.6-terra"]),
|
|
@@ -1113,8 +1113,12 @@ var SettingsPreferenceStore = class {
|
|
|
1113
1113
|
if (!isSearchProviderPreference(patch.searchProvider)) throw new PreferenceError("Unsupported search provider preference.");
|
|
1114
1114
|
normalized.searchProvider = patch.searchProvider;
|
|
1115
1115
|
}
|
|
1116
|
+
if (patch.subagentProvider !== void 0) normalized.subagentProvider = patch.subagentProvider;
|
|
1116
1117
|
if (patch.subagentModel !== void 0) normalized.subagentModel = patch.subagentModel;
|
|
1117
1118
|
if (patch.subagentReasoningEffort !== void 0) normalized.subagentReasoningEffort = patch.subagentReasoningEffort;
|
|
1119
|
+
if (patch.subagentContextWindow !== void 0) normalized.subagentContextWindow = patch.subagentContextWindow;
|
|
1120
|
+
if (patch.subagentMaxDepth !== void 0) normalized.subagentMaxDepth = patch.subagentMaxDepth;
|
|
1121
|
+
if (patch.subagentMaxAgents !== void 0) normalized.subagentMaxAgents = patch.subagentMaxAgents;
|
|
1118
1122
|
if (patch.contextWindowOverrides !== void 0) normalized.contextWindowOverrides = {
|
|
1119
1123
|
...this.scope.get().contextWindowOverrides,
|
|
1120
1124
|
...patch.contextWindowOverrides
|
|
@@ -2170,11 +2174,66 @@ function identityKey(credentials) {
|
|
|
2170
2174
|
return credentials.accountId ?? credentials.email ?? credentials.planType ?? "signed-in";
|
|
2171
2175
|
}
|
|
2172
2176
|
//#endregion
|
|
2177
|
+
//#region src/host/subagent-context-adapter.ts
|
|
2178
|
+
/**
|
|
2179
|
+
* A private provider route that delegates streaming to a selected registered
|
|
2180
|
+
* provider while exposing a user-selected effective context window to DSH.
|
|
2181
|
+
*/
|
|
2182
|
+
var SubagentContextAdapter = class SubagentContextAdapter extends LlmAdapter {
|
|
2183
|
+
llm;
|
|
2184
|
+
selection;
|
|
2185
|
+
static provider = "dsh-subagent-model-override";
|
|
2186
|
+
constructor(llm, selection) {
|
|
2187
|
+
super();
|
|
2188
|
+
this.llm = llm;
|
|
2189
|
+
this.selection = selection;
|
|
2190
|
+
}
|
|
2191
|
+
providerInfo() {
|
|
2192
|
+
return {
|
|
2193
|
+
id: SubagentContextAdapter.provider,
|
|
2194
|
+
name: "Subagent model override"
|
|
2195
|
+
};
|
|
2196
|
+
}
|
|
2197
|
+
async listModels() {
|
|
2198
|
+
const selected = this.selection();
|
|
2199
|
+
return [{
|
|
2200
|
+
provider: SubagentContextAdapter.provider,
|
|
2201
|
+
id: selected.model,
|
|
2202
|
+
name: selected.model
|
|
2203
|
+
}];
|
|
2204
|
+
}
|
|
2205
|
+
async resolveModel(_provider, _model, signal) {
|
|
2206
|
+
const selected = this.selection();
|
|
2207
|
+
return {
|
|
2208
|
+
...await this.llm.resolveModelInfo(selected.provider, selected.model, signal),
|
|
2209
|
+
provider: SubagentContextAdapter.provider,
|
|
2210
|
+
id: selected.model,
|
|
2211
|
+
context: { contextWindow: selected.contextWindow }
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
stream(options) {
|
|
2215
|
+
const selected = this.selection();
|
|
2216
|
+
const { preparedCall: _preparedCall, ...forwarded } = options;
|
|
2217
|
+
return this.llm.stream({
|
|
2218
|
+
...forwarded,
|
|
2219
|
+
provider: selected.provider,
|
|
2220
|
+
model: selected.model
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
};
|
|
2224
|
+
//#endregion
|
|
2173
2225
|
//#region src/host/routes.ts
|
|
2174
2226
|
const MAX_BODY_BYTES = 64 * 1024;
|
|
2175
2227
|
function registerRoutes(ctx, oauth, usage, preferences) {
|
|
2176
2228
|
const handler = async (request, response) => {
|
|
2177
2229
|
const url = new URL(request.url ?? "/", "http://dsh.local");
|
|
2230
|
+
if (request.method === "GET" && url.pathname === `/api/dsh-chatgpt-subscription/models`) {
|
|
2231
|
+
json(response, {
|
|
2232
|
+
ok: true,
|
|
2233
|
+
value: await subagentModelCatalog(ctx)
|
|
2234
|
+
});
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2178
2237
|
if (request.method === "GET" && url.pathname === `/api/dsh-chatgpt-subscription/status`) {
|
|
2179
2238
|
const oauthStatus = await oauth.status();
|
|
2180
2239
|
json(response, {
|
|
@@ -2396,15 +2455,30 @@ function readPreferencesUpdate(value, current) {
|
|
|
2396
2455
|
if (value.searchProvider !== "dsh" && value.searchProvider !== "codex") throw new PreferenceError("searchProvider must be dsh or codex.");
|
|
2397
2456
|
patch.searchProvider = value.searchProvider;
|
|
2398
2457
|
}
|
|
2458
|
+
if ("subagentProvider" in value) {
|
|
2459
|
+
if (typeof value.subagentProvider !== "string" || value.subagentProvider === "") throw new PreferenceError("subagentProvider must be a non-empty string.");
|
|
2460
|
+
patch.subagentProvider = value.subagentProvider;
|
|
2461
|
+
}
|
|
2399
2462
|
if ("subagentModel" in value) {
|
|
2400
|
-
if (
|
|
2463
|
+
if (typeof value.subagentModel !== "string" || value.subagentModel === "") throw new PreferenceError("subagentModel must be a non-empty string.");
|
|
2401
2464
|
patch.subagentModel = value.subagentModel;
|
|
2402
2465
|
}
|
|
2403
|
-
const selectedSubagentModel = patch.subagentModel ?? current.subagentModel;
|
|
2404
2466
|
if ("subagentReasoningEffort" in value) {
|
|
2405
|
-
if (
|
|
2467
|
+
if (value.subagentReasoningEffort !== null && (typeof value.subagentReasoningEffort !== "string" || value.subagentReasoningEffort === "")) throw new PreferenceError("subagentReasoningEffort must be null or a non-empty string.");
|
|
2406
2468
|
patch.subagentReasoningEffort = value.subagentReasoningEffort;
|
|
2407
|
-
}
|
|
2469
|
+
}
|
|
2470
|
+
if ("subagentContextWindow" in value) {
|
|
2471
|
+
if (!Number.isSafeInteger(value.subagentContextWindow) || value.subagentContextWindow < 1) throw new PreferenceError("subagentContextWindow must be a positive integer.");
|
|
2472
|
+
patch.subagentContextWindow = value.subagentContextWindow;
|
|
2473
|
+
}
|
|
2474
|
+
if ("subagentMaxDepth" in value) {
|
|
2475
|
+
if (!Number.isSafeInteger(value.subagentMaxDepth) || value.subagentMaxDepth < 0 || value.subagentMaxDepth > 3) throw new PreferenceError(`subagentMaxDepth must be an integer from 0 to 3.`);
|
|
2476
|
+
patch.subagentMaxDepth = value.subagentMaxDepth;
|
|
2477
|
+
}
|
|
2478
|
+
if ("subagentMaxAgents" in value) {
|
|
2479
|
+
if (!Number.isSafeInteger(value.subagentMaxAgents) || value.subagentMaxAgents < 1) throw new PreferenceError("subagentMaxAgents must be a positive integer.");
|
|
2480
|
+
patch.subagentMaxAgents = value.subagentMaxAgents;
|
|
2481
|
+
}
|
|
2408
2482
|
if ("contextWindowOverrides" in value) {
|
|
2409
2483
|
if (!isRecord(value.contextWindowOverrides)) throw new PreferenceError("contextWindowOverrides must be an object.");
|
|
2410
2484
|
const overrides = {};
|
|
@@ -2417,6 +2491,53 @@ function readPreferencesUpdate(value, current) {
|
|
|
2417
2491
|
}
|
|
2418
2492
|
return patch;
|
|
2419
2493
|
}
|
|
2494
|
+
async function subagentModelCatalog(ctx) {
|
|
2495
|
+
const results = await Promise.all(ctx.llm.listProviders().filter((provider) => provider.id !== SubagentContextAdapter.provider).map(async (provider) => {
|
|
2496
|
+
try {
|
|
2497
|
+
const models = await ctx.llm.listModels(provider.id);
|
|
2498
|
+
return {
|
|
2499
|
+
kind: "provider",
|
|
2500
|
+
provider: {
|
|
2501
|
+
id: provider.id,
|
|
2502
|
+
name: provider.name,
|
|
2503
|
+
models: await Promise.all(models.map(async (model) => {
|
|
2504
|
+
const resolved = await ctx.llm.resolveModelInfo(provider.id, model.id);
|
|
2505
|
+
return {
|
|
2506
|
+
id: model.id,
|
|
2507
|
+
name: model.name,
|
|
2508
|
+
...model.description === void 0 ? {} : { description: model.description },
|
|
2509
|
+
...resolved.context === void 0 ? {} : {
|
|
2510
|
+
contextWindow: resolved.context.contextWindow,
|
|
2511
|
+
maxContextWindow: provider.id === "codex-chatgpt" && isConfigurableContextModelId(model.id) ? GPT_56_MAX_CONTEXT_WINDOW : resolved.context.contextWindow
|
|
2512
|
+
},
|
|
2513
|
+
...resolved.reasoning === void 0 ? {} : { reasoning: {
|
|
2514
|
+
efforts: resolved.reasoning.efforts.map((effort) => ({
|
|
2515
|
+
id: effort.id,
|
|
2516
|
+
name: effort.name,
|
|
2517
|
+
...effort.description === void 0 ? {} : { description: effort.description }
|
|
2518
|
+
})),
|
|
2519
|
+
...resolved.reasoning.defaultEffort === void 0 ? {} : { defaultEffort: resolved.reasoning.defaultEffort }
|
|
2520
|
+
} }
|
|
2521
|
+
};
|
|
2522
|
+
}))
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
} catch (error) {
|
|
2526
|
+
return {
|
|
2527
|
+
kind: "failure",
|
|
2528
|
+
failure: {
|
|
2529
|
+
id: provider.id,
|
|
2530
|
+
name: provider.name,
|
|
2531
|
+
message: error instanceof Error ? error.message : String(error)
|
|
2532
|
+
}
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
}));
|
|
2536
|
+
return {
|
|
2537
|
+
providers: results.filter((result) => result.kind === "provider").map((result) => result.provider),
|
|
2538
|
+
failures: results.filter((result) => result.kind === "failure").map((result) => result.failure)
|
|
2539
|
+
};
|
|
2540
|
+
}
|
|
2420
2541
|
function json(response, envelope, status = 200) {
|
|
2421
2542
|
response.writeHead(status, {
|
|
2422
2543
|
"content-type": "application/json; charset=utf-8",
|
|
@@ -2812,24 +2933,99 @@ function currentConfig(entry) {
|
|
|
2812
2933
|
}
|
|
2813
2934
|
//#endregion
|
|
2814
2935
|
//#region src/host/subagent-model-preference.ts
|
|
2815
|
-
/**
|
|
2816
|
-
* Refine in-process delegated agents that already inherit the ChatGPT subscription
|
|
2817
|
-
* provider. Non-Codex parents keep DSH's native child model inheritance unchanged.
|
|
2818
|
-
*/
|
|
2936
|
+
/** Apply the configured provider/model/reasoning route to every delegated Agent. */
|
|
2819
2937
|
function installSubagentModelPreference(ctx, preferences) {
|
|
2820
2938
|
return ctx.on("agent/request", async (payload, next) => {
|
|
2821
2939
|
const resolved = await next();
|
|
2822
|
-
if (payload.agent.session.header.origin !== "subagent"
|
|
2940
|
+
if (payload.agent.session.header.origin !== "subagent") return resolved;
|
|
2823
2941
|
const selection = preferences.status();
|
|
2824
2942
|
return {
|
|
2825
2943
|
...resolved,
|
|
2826
|
-
provider:
|
|
2944
|
+
provider: SubagentContextAdapter.provider,
|
|
2827
2945
|
model: selection.subagentModel,
|
|
2828
|
-
reasoningEffort: ReasoningEffortId(selection.subagentReasoningEffort)
|
|
2946
|
+
...selection.subagentReasoningEffort === null ? { reasoningEffort: void 0 } : { reasoningEffort: ReasoningEffortId(selection.subagentReasoningEffort) }
|
|
2829
2947
|
};
|
|
2830
2948
|
});
|
|
2831
2949
|
}
|
|
2832
2950
|
//#endregion
|
|
2951
|
+
//#region src/host/subagent-policy.ts
|
|
2952
|
+
const MANAGED_DELEGATION_TOOLS = /* @__PURE__ */ new Set(["subagent", "subagent_fork"]);
|
|
2953
|
+
/**
|
|
2954
|
+
* Enforce global limits with a user-facing preflight on built-in delegation
|
|
2955
|
+
* tools and an authoritative synchronous Agent-publication gate. The latter
|
|
2956
|
+
* also covers workflows, Ralph, and nested subagents without depending on the
|
|
2957
|
+
* parent's provider or model. Throwing from `agent/created` vetoes and rolls
|
|
2958
|
+
* back the new child before its loop starts; already-running children remain.
|
|
2959
|
+
*/
|
|
2960
|
+
function installSubagentPolicy(ctx, preferences) {
|
|
2961
|
+
const disposePreflight = ctx.on("tools/pre-execute", async (exec, next) => {
|
|
2962
|
+
const parent = exec.agent;
|
|
2963
|
+
if (parent === void 0 || !MANAGED_DELEGATION_TOOLS.has(exec.name)) return next();
|
|
2964
|
+
const { subagentMaxDepth, subagentMaxAgents } = preferences.status();
|
|
2965
|
+
const attemptedDepth = delegationDepthOf(parent) + 1;
|
|
2966
|
+
if (attemptedDepth > subagentMaxDepth) return {
|
|
2967
|
+
kind: "deny",
|
|
2968
|
+
reason: `Subagent nesting depth limit reached: attempted depth ${attemptedDepth}, configured maximum ${subagentMaxDepth}.`
|
|
2969
|
+
};
|
|
2970
|
+
const activeAgents = activeDescendantCount(ctx, subagentTreeRoot(ctx, parent).id);
|
|
2971
|
+
if (activeAgents >= subagentMaxAgents) return {
|
|
2972
|
+
kind: "deny",
|
|
2973
|
+
reason: `Subagent limit reached: ${activeAgents} active descendants in the Agent tree, configured maximum ${subagentMaxAgents}. Wait for one to finish or raise the global limit in Subagents settings.`
|
|
2974
|
+
};
|
|
2975
|
+
return next();
|
|
2976
|
+
});
|
|
2977
|
+
const disposePublicationGate = ctx.on("agent/created", ({ agent }) => {
|
|
2978
|
+
if (agent.session.header.origin !== "subagent") return;
|
|
2979
|
+
const { subagentMaxDepth, subagentMaxAgents } = preferences.status();
|
|
2980
|
+
const depth = delegationDepthOf(agent);
|
|
2981
|
+
if (depth > subagentMaxDepth) throw new Error(`Subagent nesting depth limit reached: attempted depth ${depth}, configured maximum ${subagentMaxDepth}.`);
|
|
2982
|
+
const activeAgents = activeDescendantCount(ctx, subagentTreeRoot(ctx, agent).id);
|
|
2983
|
+
if (activeAgents > subagentMaxAgents) throw new Error(`Subagent limit reached: attempted ${activeAgents} active descendants in the Agent tree, configured maximum ${subagentMaxAgents}. Wait for one to finish or raise the global limit in Subagents settings.`);
|
|
2984
|
+
});
|
|
2985
|
+
return () => {
|
|
2986
|
+
disposePublicationGate();
|
|
2987
|
+
disposePreflight();
|
|
2988
|
+
};
|
|
2989
|
+
}
|
|
2990
|
+
/** Return the highest currently live ancestor that owns this subagent tree. */
|
|
2991
|
+
function subagentTreeRoot(ctx, agent) {
|
|
2992
|
+
let current = agent;
|
|
2993
|
+
const visited = /* @__PURE__ */ new Set([agent.id]);
|
|
2994
|
+
while (current.session.header.origin === "subagent") {
|
|
2995
|
+
const parentId = current.session.header.parentSession;
|
|
2996
|
+
if (parentId === void 0 || visited.has(parentId)) break;
|
|
2997
|
+
const parent = ctx.agents.get(parentId);
|
|
2998
|
+
if (parent === void 0) break;
|
|
2999
|
+
visited.add(parent.id);
|
|
3000
|
+
current = parent;
|
|
3001
|
+
}
|
|
3002
|
+
return current;
|
|
3003
|
+
}
|
|
3004
|
+
/** Return currently live descendants in one caller's subagent tree. */
|
|
3005
|
+
function activeDescendantIds(ctx, parentId) {
|
|
3006
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
3007
|
+
for (const agent of ctx.agents.list()) {
|
|
3008
|
+
if (agent.session.header.origin !== "subagent") continue;
|
|
3009
|
+
const directParent = agent.session.header.parentSession;
|
|
3010
|
+
if (directParent === void 0) continue;
|
|
3011
|
+
const children = childrenByParent.get(directParent) ?? [];
|
|
3012
|
+
children.push(agent.id);
|
|
3013
|
+
childrenByParent.set(directParent, children);
|
|
3014
|
+
}
|
|
3015
|
+
const descendants = /* @__PURE__ */ new Set();
|
|
3016
|
+
const pending = [...childrenByParent.get(parentId) ?? []];
|
|
3017
|
+
while (pending.length > 0) {
|
|
3018
|
+
const id = pending.pop();
|
|
3019
|
+
if (descendants.has(id)) continue;
|
|
3020
|
+
descendants.add(id);
|
|
3021
|
+
pending.push(...childrenByParent.get(id) ?? []);
|
|
3022
|
+
}
|
|
3023
|
+
return descendants;
|
|
3024
|
+
}
|
|
3025
|
+
function activeDescendantCount(ctx, parentId) {
|
|
3026
|
+
return activeDescendantIds(ctx, parentId).size;
|
|
3027
|
+
}
|
|
3028
|
+
//#endregion
|
|
2833
3029
|
//#region src/index.ts
|
|
2834
3030
|
const inject = [
|
|
2835
3031
|
"webServer",
|
|
@@ -2838,7 +3034,8 @@ const inject = [
|
|
|
2838
3034
|
"tools",
|
|
2839
3035
|
"web",
|
|
2840
3036
|
"settings",
|
|
2841
|
-
"loader"
|
|
3037
|
+
"loader",
|
|
3038
|
+
"agents"
|
|
2842
3039
|
];
|
|
2843
3040
|
function apply(ctx) {
|
|
2844
3041
|
const oauth = new OAuthService(createPlatformTokenStore(), { logger: ctx.logger });
|
|
@@ -2857,16 +3054,28 @@ function apply(ctx) {
|
|
|
2857
3054
|
};
|
|
2858
3055
|
const disposeRoutes = registerRoutes(ctx, oauth, usage, preferences);
|
|
2859
3056
|
const disposeAdapter = ctx.llm.registerAdapter([PROVIDER_ID], adapter);
|
|
3057
|
+
const subagentContextAdapter = new SubagentContextAdapter(ctx.llm, () => {
|
|
3058
|
+
const selected = preferences.status();
|
|
3059
|
+
return {
|
|
3060
|
+
provider: selected.subagentProvider,
|
|
3061
|
+
model: selected.subagentModel,
|
|
3062
|
+
contextWindow: selected.subagentContextWindow
|
|
3063
|
+
};
|
|
3064
|
+
});
|
|
3065
|
+
const disposeSubagentContextAdapter = ctx.llm.registerAdapter([SubagentContextAdapter.provider], subagentContextAdapter);
|
|
2860
3066
|
const disposeSubagentModelPreference = installSubagentModelPreference(ctx, preferences);
|
|
3067
|
+
const disposeSubagentPolicy = installSubagentPolicy(ctx, preferences);
|
|
2861
3068
|
const disposeImageTool = ctx.tools.register(createCodexImageTool(oauth, ctx.attachments));
|
|
2862
3069
|
const disposeSearchProvider = ctx.web.registerSearchProvider(createCodexSearchProvider(oauth));
|
|
2863
3070
|
const disposePreferenceWatch = preferences.watch((next) => applySearchPreference(next.searchProvider));
|
|
2864
3071
|
applySearchPreference();
|
|
2865
3072
|
return () => {
|
|
2866
3073
|
disposePreferenceWatch();
|
|
3074
|
+
disposeSubagentPolicy();
|
|
2867
3075
|
disposeSubagentModelPreference();
|
|
2868
3076
|
disposeSearchProvider();
|
|
2869
3077
|
disposeImageTool();
|
|
3078
|
+
disposeSubagentContextAdapter();
|
|
2870
3079
|
disposeAdapter();
|
|
2871
3080
|
disposeRoutes();
|
|
2872
3081
|
oauth.dispose();
|
|
@@ -12,6 +12,7 @@ export declare function QuotaBar({ label, window, t }: {
|
|
|
12
12
|
t: Translate;
|
|
13
13
|
}): React.JSX.Element;
|
|
14
14
|
export declare function windowLabel(minutes: number | null, t: Translate): string;
|
|
15
|
+
export declare function parsePositiveCapacity(value: string): number | null;
|
|
15
16
|
export declare function parseCapacity(value: string): number | null;
|
|
16
17
|
export declare function formatReset(seconds: number): string;
|
|
17
18
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodexSubscriptionSection.d.ts","sourceRoot":"","sources":["../../../src/client/CodexSubscriptionSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAmC,cAAc,EAAoC,MAAM,wBAAwB,CAAA;AAGrJ,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAGjC,KAAK,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,CAAA;AAEtE,KAAK,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;AAE3B,wBAAgB,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"CodexSubscriptionSection.d.ts","sourceRoot":"","sources":["../../../src/client/CodexSubscriptionSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,KAAK,EAAE,oBAAoB,EAAmC,cAAc,EAAoC,MAAM,wBAAwB,CAAA;AAGrJ,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAGjC,KAAK,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,CAAA;AAEtE,KAAK,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;AAE3B,wBAAgB,wBAAwB,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAgRxE;AAiBD,wBAAgB,YAAY,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAO5F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAO7F;AAcD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,cAAc,CAAC;IAAC,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAczH;AAMD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAQxE;AAcD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOlE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AA0BD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUnD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
|
|
2
|
+
import { NS } from './locales.ts';
|
|
3
|
+
type Props = PropsRuntime<'settings.section'> & PropsLocale<typeof NS>;
|
|
4
|
+
export declare function SubagentSettingsSection({ t }: Props): React.JSX.Element;
|
|
5
|
+
export declare function parseNonNegativeInteger(value: string): number | null;
|
|
6
|
+
export declare function parsePositiveInteger(value: string): number | null;
|
|
7
|
+
export declare function parseCapacity(value: string): number | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=SubagentSettingsSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubagentSettingsSection.d.ts","sourceRoot":"","sources":["../../../src/client/SubagentSettingsSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAIjF,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAA;AAEjC,KAAK,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,CAAA;AAEtE,wBAAgB,uBAAuB,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAmJvE;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIpE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM1D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { LoginEventDto, LoginStartDto, PluginStatusDto, QuotaStatusDto, ConnectionTestDto, SubscriptionPreferencesDto, SubscriptionPreferencesUpdateDto } from '../shared/contracts.ts';
|
|
1
|
+
import type { LoginEventDto, LoginStartDto, PluginStatusDto, QuotaStatusDto, SubagentModelCatalogDto, ConnectionTestDto, SubscriptionPreferencesDto, SubscriptionPreferencesUpdateDto } from '../shared/contracts.ts';
|
|
2
2
|
export declare class SubscriptionApi {
|
|
3
3
|
status(): Promise<PluginStatusDto>;
|
|
4
|
+
models(): Promise<SubagentModelCatalogDto>;
|
|
4
5
|
startLogin(): Promise<LoginStartDto>;
|
|
5
6
|
cancelLogin(loginId: string): Promise<{
|
|
6
7
|
cancelled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/client/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,wBAAwB,CAAA;AAE/B,qBAAa,eAAe;IAC1B,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC;IAIlC,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAIpC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAI7D,MAAM,IAAI,OAAO,CAAC;QAAE,aAAa,EAAE,KAAK,CAAA;KAAE,CAAC;IAI3C,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAInC,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC;IAIvC,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAI5C,iBAAiB,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAI/F,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;CAGrC;AAmBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,aAAa,GAAG,IAAI,CAOjF"}
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/client/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,wBAAwB,CAAA;AAE/B,qBAAa,eAAe;IAC1B,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC;IAIlC,MAAM,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAI1C,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;IAIpC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAI7D,MAAM,IAAI,OAAO,CAAC;QAAE,aAAa,EAAE,KAAK,CAAA;KAAE,CAAC;IAI3C,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;IAInC,YAAY,IAAI,OAAO,CAAC,cAAc,CAAC;IAIvC,cAAc,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAI5C,iBAAiB,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAI/F,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW;CAGrC;AAmBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,aAAa,GAAG,IAAI,CAOjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAA;AAc3E,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAG/D,OAAO,QAAQ,kCAAkC,CAAC;IAChD,UAAU,kBAAkB;QAC1B,0BAA0B,EAAE,SAAS,CAAA;KACtC;CACF;AAED,eAAO,MAAM,MAAM,UAA0D,CAAA;AAE7E,wBAAgB,KAAK,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CA0C9C"}
|
|
@@ -38,14 +38,31 @@ export declare const zh: {
|
|
|
38
38
|
readonly latency: "最近延迟";
|
|
39
39
|
readonly models: "可用模型";
|
|
40
40
|
readonly enhancements: "增强功能";
|
|
41
|
+
readonly subagentSettingsNav: "子代理";
|
|
42
|
+
readonly subagentSettingsTitle: "子代理设置";
|
|
43
|
+
readonly subagentSettingsIntro: "全局配置 DSH 内置子代理。模型、思考深度、上下文预算和运行限制适用于所有父 Agent,不受父 Agent 当前 Provider 或模型影响。";
|
|
44
|
+
readonly subagentModelGroup: "模型与上下文";
|
|
45
|
+
readonly subagentLimitsGroup: "运行限制";
|
|
46
|
+
readonly subagentMaxDepth: "最大嵌套深度";
|
|
47
|
+
readonly subagentMaxDepthHint: "限制从顶层 Agent 开始的子代理层级(0–3);0 禁止创建子代理,1 仅允许直接子代理。";
|
|
48
|
+
readonly subagentMaxAgents: "子代理数量上限";
|
|
49
|
+
readonly subagentMaxAgentsHint: "限制每个父 Agent 子树中同时处于活动或启动中的子代理总数。";
|
|
50
|
+
readonly subagentLimitsNotice: "限制会立即应用于新的委派,不会中断已经运行的子代理。数量上限统计当前父 Agent 的全部活动后代。";
|
|
51
|
+
readonly levels: "层";
|
|
52
|
+
readonly agents: "个";
|
|
41
53
|
readonly searchProvider: "搜索来源";
|
|
42
54
|
readonly searchProviderHint: "选择 DSH Web 搜索工具使用默认来源,或改用当前 ChatGPT 订阅的 Codex 搜索来源。";
|
|
43
55
|
readonly searchProviderDsh: "DSH 默认";
|
|
44
56
|
readonly searchProviderCodex: "Codex 订阅";
|
|
57
|
+
readonly subagentProvider: "子代理 Provider";
|
|
58
|
+
readonly subagentProviderHint: "选择 DSH 当前已接入且可用的模型提供方。";
|
|
45
59
|
readonly subagentModel: "子代理模型";
|
|
46
|
-
readonly subagentModelHint: "
|
|
60
|
+
readonly subagentModelHint: "全局应用于所有 DSH 内置子代理;模型可来自任意已接入 Provider。";
|
|
47
61
|
readonly subagentReasoningEffort: "子代理思考深度";
|
|
48
|
-
readonly subagentReasoningEffortHint: "
|
|
62
|
+
readonly subagentReasoningEffortHint: "选项来自所选模型实际公开的 reasoning effort 能力。";
|
|
63
|
+
readonly providerDefault: "使用 Provider 默认值";
|
|
64
|
+
readonly effectiveContextWindow: "有效上下文窗口";
|
|
65
|
+
readonly selectedModelContextHint: "选择模型后展开;该值仅用于子 Agent 的 DSH 上下文预算与压缩判断。";
|
|
49
66
|
readonly reasoningNone: "无";
|
|
50
67
|
readonly reasoningLow: "低";
|
|
51
68
|
readonly reasoningMedium: "中";
|
|
@@ -141,14 +158,31 @@ export declare const dictionaries: {
|
|
|
141
158
|
readonly latency: "最近延迟";
|
|
142
159
|
readonly models: "可用模型";
|
|
143
160
|
readonly enhancements: "增强功能";
|
|
161
|
+
readonly subagentSettingsNav: "子代理";
|
|
162
|
+
readonly subagentSettingsTitle: "子代理设置";
|
|
163
|
+
readonly subagentSettingsIntro: "全局配置 DSH 内置子代理。模型、思考深度、上下文预算和运行限制适用于所有父 Agent,不受父 Agent 当前 Provider 或模型影响。";
|
|
164
|
+
readonly subagentModelGroup: "模型与上下文";
|
|
165
|
+
readonly subagentLimitsGroup: "运行限制";
|
|
166
|
+
readonly subagentMaxDepth: "最大嵌套深度";
|
|
167
|
+
readonly subagentMaxDepthHint: "限制从顶层 Agent 开始的子代理层级(0–3);0 禁止创建子代理,1 仅允许直接子代理。";
|
|
168
|
+
readonly subagentMaxAgents: "子代理数量上限";
|
|
169
|
+
readonly subagentMaxAgentsHint: "限制每个父 Agent 子树中同时处于活动或启动中的子代理总数。";
|
|
170
|
+
readonly subagentLimitsNotice: "限制会立即应用于新的委派,不会中断已经运行的子代理。数量上限统计当前父 Agent 的全部活动后代。";
|
|
171
|
+
readonly levels: "层";
|
|
172
|
+
readonly agents: "个";
|
|
144
173
|
readonly searchProvider: "搜索来源";
|
|
145
174
|
readonly searchProviderHint: "选择 DSH Web 搜索工具使用默认来源,或改用当前 ChatGPT 订阅的 Codex 搜索来源。";
|
|
146
175
|
readonly searchProviderDsh: "DSH 默认";
|
|
147
176
|
readonly searchProviderCodex: "Codex 订阅";
|
|
177
|
+
readonly subagentProvider: "子代理 Provider";
|
|
178
|
+
readonly subagentProviderHint: "选择 DSH 当前已接入且可用的模型提供方。";
|
|
148
179
|
readonly subagentModel: "子代理模型";
|
|
149
|
-
readonly subagentModelHint: "
|
|
180
|
+
readonly subagentModelHint: "全局应用于所有 DSH 内置子代理;模型可来自任意已接入 Provider。";
|
|
150
181
|
readonly subagentReasoningEffort: "子代理思考深度";
|
|
151
|
-
readonly subagentReasoningEffortHint: "
|
|
182
|
+
readonly subagentReasoningEffortHint: "选项来自所选模型实际公开的 reasoning effort 能力。";
|
|
183
|
+
readonly providerDefault: "使用 Provider 默认值";
|
|
184
|
+
readonly effectiveContextWindow: "有效上下文窗口";
|
|
185
|
+
readonly selectedModelContextHint: "选择模型后展开;该值仅用于子 Agent 的 DSH 上下文预算与压缩判断。";
|
|
152
186
|
readonly reasoningNone: "无";
|
|
153
187
|
readonly reasoningLow: "低";
|
|
154
188
|
readonly reasoningMedium: "中";
|
|
@@ -202,6 +236,6 @@ export declare const dictionaries: {
|
|
|
202
236
|
readonly retry: "重试";
|
|
203
237
|
readonly unknown: "未知";
|
|
204
238
|
};
|
|
205
|
-
en: Record<"tokens" | "title" | "intro" | "account" | "signedOut" | "signedIn" | "plan" | "accountId" | "expires" | "storage" | "storageWindows" | "storageMacKeychain" | "storageLinuxFile" | "storageMemory" | "storageUnavailable" | "securityWindows" | "securityMacKeychain" | "securityLinuxFile" | "securityMemory" | "securityUnavailable" | "signIn" | "signInAgain" | "cancel" | "signOut" | "refreshToken" | "pending" | "popupBlocked" | "continueLogin" | "loading" | "connection" | "provider" | "connectionState" | "connected" | "untested" | "testConnection" | "testing" | "latency" | "models" | "enhancements" | "searchProvider" | "searchProviderHint" | "searchProviderDsh" | "searchProviderCodex" | "subagentModel" | "subagentModelHint" | "subagentReasoningEffort" | "subagentReasoningEffortHint" | "reasoningNone" | "reasoningLow" | "reasoningMedium" | "reasoningHigh" | "reasoningXhigh" | "reasoningMax" | "contextWindows" | "contextWindowsHint" | "contextWindow" | "contextWindowInvalid" | "saveContextWindow" | "save" | "quickQuota" | "quickQuotaHint" | "quota" | "quotaIntro" | "refreshQuota" | "refreshing" | "noQuota" | "quotaSignedOut" | "stale" | "updated" | "primary" | "secondary" | "limitWindow" | "used" | "remaining" | "available" | "unavailable" | "unlimited" | "credits" | "monthlySpend" | "resetCredits" | "spendControlReached" | "limit" | "exhausted" | "resets" | "quickQuotaLabel" | "quickQuotaLoading" | "imageToolRunning" | "imageToolDone" | "imageToolFailed" | "image" | "openImage" | "openNamedImage" | "imageLoading" | "imageLoadFailed" | "imagePreviewClose" | "imagePreviewOpenOriginal" | "retry" | "unknown", string>;
|
|
239
|
+
en: Record<"tokens" | "title" | "intro" | "account" | "signedOut" | "signedIn" | "plan" | "accountId" | "expires" | "storage" | "storageWindows" | "storageMacKeychain" | "storageLinuxFile" | "storageMemory" | "storageUnavailable" | "securityWindows" | "securityMacKeychain" | "securityLinuxFile" | "securityMemory" | "securityUnavailable" | "signIn" | "signInAgain" | "cancel" | "signOut" | "refreshToken" | "pending" | "popupBlocked" | "continueLogin" | "loading" | "connection" | "provider" | "connectionState" | "connected" | "untested" | "testConnection" | "testing" | "latency" | "models" | "enhancements" | "subagentSettingsNav" | "subagentSettingsTitle" | "subagentSettingsIntro" | "subagentModelGroup" | "subagentLimitsGroup" | "subagentMaxDepth" | "subagentMaxDepthHint" | "subagentMaxAgents" | "subagentMaxAgentsHint" | "subagentLimitsNotice" | "levels" | "agents" | "searchProvider" | "searchProviderHint" | "searchProviderDsh" | "searchProviderCodex" | "subagentProvider" | "subagentProviderHint" | "subagentModel" | "subagentModelHint" | "subagentReasoningEffort" | "subagentReasoningEffortHint" | "providerDefault" | "effectiveContextWindow" | "selectedModelContextHint" | "reasoningNone" | "reasoningLow" | "reasoningMedium" | "reasoningHigh" | "reasoningXhigh" | "reasoningMax" | "contextWindows" | "contextWindowsHint" | "contextWindow" | "contextWindowInvalid" | "saveContextWindow" | "save" | "quickQuota" | "quickQuotaHint" | "quota" | "quotaIntro" | "refreshQuota" | "refreshing" | "noQuota" | "quotaSignedOut" | "stale" | "updated" | "primary" | "secondary" | "limitWindow" | "used" | "remaining" | "available" | "unavailable" | "unlimited" | "credits" | "monthlySpend" | "resetCredits" | "spendControlReached" | "limit" | "exhausted" | "resets" | "quickQuotaLabel" | "quickQuotaLoading" | "imageToolRunning" | "imageToolDone" | "imageToolFailed" | "image" | "openImage" | "openNamedImage" | "imageLoading" | "imageLoadFailed" | "imagePreviewClose" | "imagePreviewOpenOriginal" | "retry" | "unknown", string>;
|
|
206
240
|
};
|
|
207
241
|
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE,EAAG,0BAAmC,CAAA;AAErD,eAAO,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../../src/client/locales.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,EAAE,EAAG,0BAAmC,CAAA;AAErD,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoHL,CAAA;AAEV,eAAO,MAAM,EAAE,EAAE,MAAM,CAAC,MAAM,OAAO,EAAE,EAAE,MAAM,CAoH9C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,EAAE,CAAA;AACvC,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/client/styles.ts"],"names":[],"mappings":"AA2FA,wBAAgB,aAAa,IAAI,MAAM,IAAI,CAQ1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../../src/host/preferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAsB,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"preferences.d.ts","sourceRoot":"","sources":["../../../src/host/preferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAsB,MAAM,2BAA2B,CAAA;AAWxG,OAAO,KAAK,EACV,0BAA0B,EAC1B,gCAAgC,EACjC,MAAM,wBAAwB,CAAA;AAE/B,MAAM,WAAW,2BAA2B;IAC1C,MAAM,IAAI,0BAA0B,CAAA;IACpC,MAAM,CAAC,KAAK,EAAE,gCAAgC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAA;IACpF,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,0BAA0B,EAAE,IAAI,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,IAAI,CAAA;CAC1H;AAID,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,2BAA2B,CAoB/F;AAqCD,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/host/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/host/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAMlD,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAmB,KAAK,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AACpF,OAAO,EAAE,YAAY,EAAqB,MAAM,oBAAoB,CAAA;AAKpE,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,2BAA2B,GAAG,MAAM,IAAI,CAmJ3I"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import { LlmAdapter, type GenerateOptions, type LlmModelInfo, type LlmResolvedModelInfo, type StreamChunk } from '@deepseek-ai/dsh-llm';
|
|
3
|
+
/**
|
|
4
|
+
* A private provider route that delegates streaming to a selected registered
|
|
5
|
+
* provider while exposing a user-selected effective context window to DSH.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SubagentContextAdapter extends LlmAdapter {
|
|
8
|
+
private readonly llm;
|
|
9
|
+
private readonly selection;
|
|
10
|
+
static readonly provider = "dsh-subagent-model-override";
|
|
11
|
+
constructor(llm: Context['llm'], selection: () => {
|
|
12
|
+
provider: string;
|
|
13
|
+
model: string;
|
|
14
|
+
contextWindow: number;
|
|
15
|
+
});
|
|
16
|
+
providerInfo(): {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
};
|
|
20
|
+
listModels(): Promise<readonly LlmModelInfo[]>;
|
|
21
|
+
resolveModel(_provider: string, _model: string, signal?: AbortSignal): Promise<LlmResolvedModelInfo>;
|
|
22
|
+
stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=subagent-context-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-context-adapter.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-context-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,oBAAoB,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvI;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IAIlD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAJ5B,MAAM,CAAC,QAAQ,CAAC,QAAQ,iCAAgC;gBAGrC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,EACnB,SAAS,EAAE,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE;IAK9F,YAAY,IAAI;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE;IAItC,UAAU,IAAI,OAAO,CAAC,SAAS,YAAY,EAAE,CAAC;IAK9C,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAW1G,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;CAK7D"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import type { SubscriptionPreferenceStore } from './preferences.ts';
|
|
3
|
-
/**
|
|
4
|
-
* Refine in-process delegated agents that already inherit the ChatGPT subscription
|
|
5
|
-
* provider. Non-Codex parents keep DSH's native child model inheritance unchanged.
|
|
6
|
-
*/
|
|
3
|
+
/** Apply the configured provider/model/reasoning route to every delegated Agent. */
|
|
7
4
|
export declare function installSubagentModelPreference(ctx: Context, preferences: SubscriptionPreferenceStore): () => void;
|
|
8
5
|
//# sourceMappingURL=subagent-model-preference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subagent-model-preference.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-model-preference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"subagent-model-preference.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-model-preference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAGnE,oFAAoF;AACpF,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,2BAA2B,GAAG,MAAM,IAAI,CAYjH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { SubscriptionPreferenceStore } from './preferences.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Enforce global limits with a user-facing preflight on built-in delegation
|
|
6
|
+
* tools and an authoritative synchronous Agent-publication gate. The latter
|
|
7
|
+
* also covers workflows, Ralph, and nested subagents without depending on the
|
|
8
|
+
* parent's provider or model. Throwing from `agent/created` vetoes and rolls
|
|
9
|
+
* back the new child before its loop starts; already-running children remain.
|
|
10
|
+
*/
|
|
11
|
+
export declare function installSubagentPolicy(ctx: Context, preferences: SubscriptionPreferenceStore): () => void;
|
|
12
|
+
/** Return the highest currently live ancestor that owns this subagent tree. */
|
|
13
|
+
export declare function subagentTreeRoot(ctx: Pick<Context, 'agents'>, agent: Agent): Agent;
|
|
14
|
+
/** Return currently live descendants in one caller's subagent tree. */
|
|
15
|
+
export declare function activeDescendantIds(ctx: Pick<Context, 'agents'>, parentId: string): Set<string>;
|
|
16
|
+
export declare function activeDescendantCount(ctx: Pick<Context, 'agents'>, parentId: string): number;
|
|
17
|
+
//# sourceMappingURL=subagent-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-policy.d.ts","sourceRoot":"","sources":["../../../src/host/subagent-policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAInE;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,2BAA2B,GAAG,MAAM,IAAI,CAqCxG;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,CAYlF;AAED,uEAAuE;AACvE,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAoB/F;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5F"}
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAuBlD,eAAO,MAAM,MAAM,UAAsF,CAAA;AAEzG,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CA0CxC;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAClF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA"}
|