@morlay/dsh-subagent 0.0.1-alpha.2 → 0.0.1
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 +33 -25
- package/dist/index.d.mts +50 -46
- package/dist/index.mjs +120 -226
- package/dist/rows.d.mts +35 -0
- package/dist/rows.mjs +12 -0
- package/package.json +24 -59
- package/cordis.patch.yml +0 -17
- package/dist/client.cjs +0 -265
- package/dist/client.d.cts +0 -78
- package/dist/client.d.mts +0 -78
- package/dist/index.d.cts +0 -2197
package/dist/index.mjs
CHANGED
|
@@ -5874,6 +5874,19 @@ function appendDelegatedPolicyOverrides(childSession, overrides) {
|
|
|
5874
5874
|
//#endregion
|
|
5875
5875
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/continuation-messages.ts
|
|
5876
5876
|
/**
|
|
5877
|
+
* Append adjacent-Agent return guidance to a continuable child's initial task.
|
|
5878
|
+
* @param parentId - durable parent session id named in the guidance.
|
|
5879
|
+
* @param prompt - initial model-visible task blocks.
|
|
5880
|
+
* @returns task blocks followed by the continuable return guidance.
|
|
5881
|
+
*/
|
|
5882
|
+
function withContinuableReturnGuidance$1(parentId, prompt) {
|
|
5883
|
+
const encodedParentId = JSON.stringify(parentId);
|
|
5884
|
+
return [...prompt, {
|
|
5885
|
+
type: "text",
|
|
5886
|
+
text: `Your parent agent id is ${encodedParentId}. Before you finish, send your result to that agent with send_message({ agent_id: ${encodedParentId}, message: "<self-contained result>" }). The parent shares your workspace but does not automatically receive your transcript, tool output, or reasoning. Send earlier messages as well when a finding changes what the parent should do next; sending a message does not end your turn.`
|
|
5887
|
+
}];
|
|
5888
|
+
}
|
|
5889
|
+
/**
|
|
5877
5890
|
* One line telling a parent that a background child is finished and why, in
|
|
5878
5891
|
* the parent's own task vocabulary.
|
|
5879
5892
|
* @param childId - the durable child the parent knows by id.
|
|
@@ -6557,6 +6570,20 @@ function createAgentMessage(sender, content) {
|
|
|
6557
6570
|
});
|
|
6558
6571
|
}
|
|
6559
6572
|
/**
|
|
6573
|
+
* Whether this session's return guidance takes this package's Chinese wording.
|
|
6574
|
+
*
|
|
6575
|
+
* 判据是**会话挂着的 preset**:文案是模型可见的东西,跟着 preset 走;名单由装配给(本行的
|
|
6576
|
+
* `config.localizedReturnGuidancePresets`),默认空——没配、或会话没挂 preset(不装 registry 的部署、还没绑的
|
|
6577
|
+
* agent)一律走上游英文,官方 shipped preset 的会话因此不会被换文案。
|
|
6578
|
+
*
|
|
6579
|
+
* @param composedPreset - the preset id the session is mounted on, if any.
|
|
6580
|
+
* @param configured - preset ids this deployment asked to localize.
|
|
6581
|
+
* @returns whether the Chinese guidance applies to this session.
|
|
6582
|
+
*/
|
|
6583
|
+
function localizedReturnGuidance(composedPreset, configured) {
|
|
6584
|
+
return composedPreset !== void 0 && configured.includes(composedPreset);
|
|
6585
|
+
}
|
|
6586
|
+
/**
|
|
6560
6587
|
* Append adjacent-Agent return guidance to a continuable child's initial task.
|
|
6561
6588
|
* @param parentId - durable parent session id named in the guidance.
|
|
6562
6589
|
* @param prompt - initial model-visible task blocks.
|
|
@@ -7081,10 +7108,12 @@ const deliverSubagentPrompt = Symbol.for("dsh.subagent.deliverPrompt");
|
|
|
7081
7108
|
var SubagentContinuationManager = class {
|
|
7082
7109
|
ctx;
|
|
7083
7110
|
host;
|
|
7111
|
+
localizedGuidancePresets;
|
|
7084
7112
|
activations;
|
|
7085
|
-
constructor(ctx, host, maxActiveSubagents) {
|
|
7113
|
+
constructor(ctx, host, maxActiveSubagents, localizedGuidancePresets) {
|
|
7086
7114
|
this.ctx = ctx;
|
|
7087
7115
|
this.host = host;
|
|
7116
|
+
this.localizedGuidancePresets = localizedGuidancePresets;
|
|
7088
7117
|
this.activations = new ContinuableActivationRegistry(ctx, (provider, childId, parent) => host.observeActivation(provider, childId, parent), maxActiveSubagents);
|
|
7089
7118
|
}
|
|
7090
7119
|
/**
|
|
@@ -7161,7 +7190,7 @@ var SubagentContinuationManager = class {
|
|
|
7161
7190
|
signal: spec.signal
|
|
7162
7191
|
});
|
|
7163
7192
|
const childHeader = activation.handle.agent.session.header;
|
|
7164
|
-
return await this.submitMaterialized(activation, isAdjacentAgentSendMessageTool(this.ctx.get("tools")?.get("send_message", activation.handle.agent)) ?
|
|
7193
|
+
return await this.submitMaterialized(activation, isAdjacentAgentSendMessageTool(this.ctx.get("tools")?.get("send_message", activation.handle.agent)) ? this.continuableReturnGuidance(parent, request.prompt) : request.prompt, {
|
|
7165
7194
|
source: { kind: "user" },
|
|
7166
7195
|
signal: spec.signal,
|
|
7167
7196
|
delivery: "queue"
|
|
@@ -7176,6 +7205,21 @@ var SubagentContinuationManager = class {
|
|
|
7176
7205
|
}
|
|
7177
7206
|
}
|
|
7178
7207
|
/**
|
|
7208
|
+
* Return guidance for a continuable child's initial task, per session.
|
|
7209
|
+
*
|
|
7210
|
+
* 会话挂着本部署名单里的 preset 时用本包的中文文案,其余(官方 shipped preset、还没绑 preset 的会话、
|
|
7211
|
+
* 不装 registry 的部署)保持上游英文。文案是模型可见的东西,跟着 preset 走;但 `subagents` 是**进程单例**
|
|
7212
|
+
* (跨会话查询面由 host 的 api-proxy 服务、provider 名全局唯一),realm 内的服务 realm 外读不到,所以这一行
|
|
7213
|
+
* 不能搬进 preset realm——只能在 host 平面按会话判。
|
|
7214
|
+
* @param parent - the exact live parent whose session owns the child.
|
|
7215
|
+
* @param prompt - initial model-visible task blocks.
|
|
7216
|
+
* @returns task blocks followed by the guidance this session asked for.
|
|
7217
|
+
*/
|
|
7218
|
+
continuableReturnGuidance(parent, prompt) {
|
|
7219
|
+
const composed = this.ctx.get("agentPresets")?.composedPreset(parent.ctx);
|
|
7220
|
+
return localizedReturnGuidance(composed, this.localizedGuidancePresets()) ? withContinuableReturnGuidance(parent.id, prompt) : withContinuableReturnGuidance$1(parent.id, prompt);
|
|
7221
|
+
}
|
|
7222
|
+
/**
|
|
7179
7223
|
* Deliver one model-authored message to a direct continuable child or to the
|
|
7180
7224
|
* sender's direct parent. A missing direct child cold-resumes through the
|
|
7181
7225
|
* ordinary continuation lifecycle.
|
|
@@ -7413,12 +7457,6 @@ var SubagentContinuationManager = class {
|
|
|
7413
7457
|
//#endregion
|
|
7414
7458
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/list-children.ts
|
|
7415
7459
|
/**
|
|
7416
|
-
* Concurrent cold observations per explicit catalog listing. Current Session
|
|
7417
|
-
* persistence providers are local; a networked provider must promote this to
|
|
7418
|
-
* a validated deployment setting.
|
|
7419
|
-
*/
|
|
7420
|
-
const COLD_READ_CONCURRENCY = 4;
|
|
7421
|
-
/**
|
|
7422
7460
|
* Read one parent's durable catalog through a live-preferred Session observation.
|
|
7423
7461
|
* @param ctx - context carrying the Session query service.
|
|
7424
7462
|
* @param parentSessionId - parent whose direct children are requested.
|
|
@@ -7435,229 +7473,84 @@ async function listChildren(ctx, parentSessionId, signal) {
|
|
|
7435
7473
|
return entries;
|
|
7436
7474
|
}
|
|
7437
7475
|
/**
|
|
7438
|
-
*
|
|
7439
|
-
*
|
|
7440
|
-
*
|
|
7441
|
-
*
|
|
7442
|
-
* @
|
|
7443
|
-
* @
|
|
7444
|
-
* @param rootSessionId - session whose complete descendant tree is listed.
|
|
7445
|
-
* @param signal - caller-owned cancellation observed around every persistence read.
|
|
7446
|
-
* @returns interpreted subagents with durable direct-parent and root-relative depth.
|
|
7447
|
-
* @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
|
|
7476
|
+
* Walk reachable parent catalogs in stable pre-order without loading Agents.
|
|
7477
|
+
* @see SubagentRuntime.listDescendants for failure and cancellation semantics.
|
|
7478
|
+
* @param ctx - context carrying the Session store and query service.
|
|
7479
|
+
* @param rootSessionId - parent whose catalog starts the traversal.
|
|
7480
|
+
* @param signal - cancellation checked around each catalog read.
|
|
7481
|
+
* @returns children and branch diagnostics with catalog parent and depth.
|
|
7448
7482
|
*/
|
|
7449
7483
|
async function listDescendants(ctx, rootSessionId, signal) {
|
|
7450
|
-
const listing = await prepareListing(ctx, signal);
|
|
7451
|
-
const positioned = descendantCandidates(listing.corpus, rootSessionId);
|
|
7452
|
-
const rows = await resolveCandidateRows(positioned.map((candidate) => candidate.record), listing, signal);
|
|
7453
|
-
const entries = [];
|
|
7454
|
-
positioned.forEach((position, index) => {
|
|
7455
|
-
const row = rows[index];
|
|
7456
|
-
if (row !== void 0) entries.push({
|
|
7457
|
-
...row,
|
|
7458
|
-
parentId: position.parentId,
|
|
7459
|
-
depth: position.depth
|
|
7460
|
-
});
|
|
7461
|
-
});
|
|
7462
|
-
return entries;
|
|
7463
|
-
}
|
|
7464
|
-
/** Resolve listing services once and build one live-preferred session corpus. */
|
|
7465
|
-
async function prepareListing(ctx, signal) {
|
|
7466
|
-
const projections = ctx.get("sessionProjections");
|
|
7467
|
-
if (projections === void 0) throw new SubagentError("listing subagents requires the sessionProjections registry (load @deepseek-ai/dsh-session-projection)", "SUBAGENT_CONTROL_PROJECTIONS_UNAVAILABLE");
|
|
7468
7484
|
const sessions = ctx.get("sessions");
|
|
7469
7485
|
if (sessions === void 0) throw new SubagentError("listing subagents requires the session store (load @deepseek-ai/dsh-session)", "SUBAGENT_CONTROL_SESSION_STORE_UNAVAILABLE");
|
|
7470
|
-
|
|
7471
|
-
const query = ctx.get("sessionQuery");
|
|
7472
|
-
if (query === void 0) throw new SubagentError("listing subagents requires the sessionQuery service (load @deepseek-ai/dsh-session-query)", "SUBAGENT_CONTROL_QUERY_UNAVAILABLE");
|
|
7473
|
-
const cache = ctx.get("sessionProjectionCache");
|
|
7474
|
-
let records;
|
|
7475
|
-
try {
|
|
7476
|
-
records = await query.listSessions(signal);
|
|
7477
|
-
} catch (error) {
|
|
7486
|
+
const readChildren = async (id) => {
|
|
7478
7487
|
assertListingNotCancelled(signal);
|
|
7479
|
-
|
|
7480
|
-
}
|
|
7481
|
-
assertListingNotCancelled(signal);
|
|
7482
|
-
const corpus = /* @__PURE__ */ new Map();
|
|
7483
|
-
for (const record of records) {
|
|
7484
|
-
const live = sessions.get(record.header.id);
|
|
7485
|
-
corpus.set(record.header.id, {
|
|
7486
|
-
header: live?.header ?? record.header,
|
|
7487
|
-
live
|
|
7488
|
-
});
|
|
7489
|
-
}
|
|
7490
|
-
const subagentParents = /* @__PURE__ */ new Set();
|
|
7491
|
-
for (const record of corpus.values()) if (record.header.origin === "subagent" && record.header.parentSession !== void 0) subagentParents.add(record.header.parentSession);
|
|
7492
|
-
return {
|
|
7493
|
-
projections,
|
|
7494
|
-
query,
|
|
7495
|
-
cache,
|
|
7496
|
-
corpus,
|
|
7497
|
-
subagentParents
|
|
7498
|
-
};
|
|
7499
|
-
}
|
|
7500
|
-
/** Resolve projection-backed rows for aligned candidates with bounded cold reads. */
|
|
7501
|
-
async function resolveCandidateRows(candidates, listing, signal) {
|
|
7502
|
-
const { projections, query, cache, subagentParents } = listing;
|
|
7503
|
-
const rows = Array.from({ length: candidates.length });
|
|
7504
|
-
const coldReads = [];
|
|
7505
|
-
candidates.forEach((candidate, index) => {
|
|
7506
|
-
const childId = candidate.header.id;
|
|
7507
|
-
if (candidate.live === void 0) {
|
|
7508
|
-
coldReads.push({
|
|
7509
|
-
index,
|
|
7510
|
-
header: candidate.header
|
|
7511
|
-
});
|
|
7512
|
-
return;
|
|
7513
|
-
}
|
|
7514
|
-
let identity;
|
|
7488
|
+
let children;
|
|
7515
7489
|
try {
|
|
7516
|
-
|
|
7517
|
-
} catch {
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
id: childId,
|
|
7521
|
-
reason: "corrupt"
|
|
7522
|
-
};
|
|
7523
|
-
return;
|
|
7490
|
+
children = await listChildren(ctx, id, signal);
|
|
7491
|
+
} catch (error) {
|
|
7492
|
+
assertListingNotCancelled(signal);
|
|
7493
|
+
throw error;
|
|
7524
7494
|
}
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
}
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
await Promise.all(Array.from({ length: Math.min(COLD_READ_CONCURRENCY, queue.length) }, async () => {
|
|
7531
|
-
for (let job = queue.shift(); job !== void 0; job = queue.shift()) rows[job.index] = await resolveColdIdentity(query, cache, job.header, subagentParents.has(job.header.id), signal);
|
|
7532
|
-
}));
|
|
7533
|
-
}
|
|
7534
|
-
assertListingNotCancelled(signal);
|
|
7535
|
-
return rows;
|
|
7536
|
-
}
|
|
7537
|
-
/** Build origin-classified candidates from the complete tree without recursion. */
|
|
7538
|
-
function descendantCandidates(corpus, rootSessionId) {
|
|
7539
|
-
const children = /* @__PURE__ */ new Map();
|
|
7540
|
-
for (const record of corpus.values()) {
|
|
7541
|
-
const parentId = record.header.parentSession;
|
|
7542
|
-
if (parentId === void 0) continue;
|
|
7543
|
-
const siblings = children.get(parentId);
|
|
7544
|
-
if (siblings === void 0) children.set(parentId, [record]);
|
|
7545
|
-
else siblings.push(record);
|
|
7546
|
-
}
|
|
7547
|
-
for (const siblings of children.values()) siblings.sort(compareCorpusRecords);
|
|
7548
|
-
const positioned = [];
|
|
7549
|
-
const stack = (children.get(rootSessionId) ?? []).map((record) => ({
|
|
7550
|
-
record,
|
|
7495
|
+
assertListingNotCancelled(signal);
|
|
7496
|
+
return children;
|
|
7497
|
+
};
|
|
7498
|
+
const stack = (await readChildren(rootSessionId)).map((entry) => ({
|
|
7499
|
+
entry,
|
|
7551
7500
|
parentId: rootSessionId,
|
|
7552
7501
|
depth: 1
|
|
7553
7502
|
})).reverse();
|
|
7554
7503
|
const visited = /* @__PURE__ */ new Set([rootSessionId]);
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
const
|
|
7558
|
-
if (visited.has(id)) continue;
|
|
7559
|
-
visited.add(id);
|
|
7560
|
-
|
|
7561
|
-
const descendants = children.get(id) ?? [];
|
|
7562
|
-
for (const record of [...descendants].reverse()) stack.push({
|
|
7563
|
-
record,
|
|
7564
|
-
parentId: id,
|
|
7565
|
-
depth: position.depth + 1
|
|
7566
|
-
});
|
|
7567
|
-
}
|
|
7568
|
-
return positioned;
|
|
7569
|
-
}
|
|
7570
|
-
/** Compare siblings by durable creation time, then id. */
|
|
7571
|
-
function compareCorpusRecords(a, b) {
|
|
7572
|
-
return a.header.createdAt - b.header.createdAt || a.header.id.localeCompare(b.header.id);
|
|
7573
|
-
}
|
|
7574
|
-
/**
|
|
7575
|
-
* Resolve one cold candidate down the remaining ladder: an unseeded durable
|
|
7576
|
-
* projection-cache row, otherwise one shared Session observation. An absent or transiently failed
|
|
7577
|
-
* observation is one `unavailable` row retried on the next listing; an observation
|
|
7578
|
-
* source naming another lifecycle, and a
|
|
7579
|
-
* settled log the fold cannot identify — or that makes any registered unit
|
|
7580
|
-
* throw — are final, so they report `corrupt`.
|
|
7581
|
-
*/
|
|
7582
|
-
async function resolveColdIdentity(query, cache, header, hasChildren, signal) {
|
|
7583
|
-
const childId = header.id;
|
|
7584
|
-
if (cache !== void 0 && !header.isSeeded) {
|
|
7585
|
-
let cached;
|
|
7504
|
+
const result = [];
|
|
7505
|
+
for (let position = stack.pop(); position !== void 0; position = stack.pop()) {
|
|
7506
|
+
const { entry, parentId, depth } = position;
|
|
7507
|
+
if (visited.has(entry.id)) continue;
|
|
7508
|
+
visited.add(entry.id);
|
|
7509
|
+
let children;
|
|
7586
7510
|
try {
|
|
7587
|
-
|
|
7588
|
-
} catch {
|
|
7589
|
-
|
|
7511
|
+
children = await readChildren(entry.id);
|
|
7512
|
+
} catch (error) {
|
|
7513
|
+
if (error instanceof SubagentError) throw error;
|
|
7514
|
+
const code = error instanceof Error && "code" in error ? error.code : void 0;
|
|
7515
|
+
result.push({
|
|
7516
|
+
kind: "diagnostic",
|
|
7517
|
+
id: entry.id,
|
|
7518
|
+
parentId,
|
|
7519
|
+
depth,
|
|
7520
|
+
reason: code === "SESSION_QUERY_CORRUPT_SESSION" || code === "SESSION_QUERY_SOURCE_CONFLICT" ? "corrupt" : "unavailable"
|
|
7521
|
+
});
|
|
7522
|
+
continue;
|
|
7590
7523
|
}
|
|
7591
|
-
if (
|
|
7592
|
-
}
|
|
7593
|
-
assertListingNotCancelled(signal);
|
|
7594
|
-
let observation;
|
|
7595
|
-
try {
|
|
7596
|
-
observation = await query.observeSession(childId, { ...signal === void 0 ? {} : { signal } });
|
|
7597
|
-
} catch (error) {
|
|
7598
|
-
assertListingNotCancelled(signal);
|
|
7599
|
-
return {
|
|
7524
|
+
if (entry.mode === "unknown") result.push({
|
|
7600
7525
|
kind: "diagnostic",
|
|
7601
|
-
id:
|
|
7602
|
-
|
|
7603
|
-
|
|
7526
|
+
id: entry.id,
|
|
7527
|
+
parentId,
|
|
7528
|
+
depth,
|
|
7529
|
+
reason: "unsupported"
|
|
7530
|
+
});
|
|
7531
|
+
else {
|
|
7532
|
+
const { createdAt: _createdAt, ...identity } = entry;
|
|
7533
|
+
result.push({
|
|
7534
|
+
...identity,
|
|
7535
|
+
kind: "child",
|
|
7536
|
+
parentId,
|
|
7537
|
+
depth,
|
|
7538
|
+
activity: sessions.get(entry.id) === void 0 ? "inactive" : "running",
|
|
7539
|
+
hasChildren: children.length > 0
|
|
7540
|
+
});
|
|
7541
|
+
}
|
|
7542
|
+
for (const child of [...children].reverse()) stack.push({
|
|
7543
|
+
entry: child,
|
|
7544
|
+
parentId: entry.id,
|
|
7545
|
+
depth: depth + 1
|
|
7546
|
+
});
|
|
7604
7547
|
}
|
|
7605
|
-
|
|
7606
|
-
assertListingNotCancelled(signal);
|
|
7607
|
-
if (!sameLifecycle(ownedObservation.header, header)) return {
|
|
7608
|
-
kind: "diagnostic",
|
|
7609
|
-
id: childId,
|
|
7610
|
-
reason: "corrupt"
|
|
7611
|
-
};
|
|
7612
|
-
const identity = ownedObservation.projections?.values.subagent;
|
|
7613
|
-
if (identity === void 0 || identity === null || identity.seq < ownedObservation.inheritedEventCount) return {
|
|
7614
|
-
kind: "diagnostic",
|
|
7615
|
-
id: childId,
|
|
7616
|
-
reason: "corrupt"
|
|
7617
|
-
};
|
|
7618
|
-
return childRow(childId, identity, "inactive", hasChildren);
|
|
7619
|
-
}
|
|
7620
|
-
/** Materialize one served identity as its child row. */
|
|
7621
|
-
function childRow(id, identity, activity, hasChildren) {
|
|
7622
|
-
return identity.mode === "one-shot" ? {
|
|
7623
|
-
kind: "child",
|
|
7624
|
-
id,
|
|
7625
|
-
mode: "one-shot",
|
|
7626
|
-
...identity.label !== void 0 ? { label: identity.label } : {},
|
|
7627
|
-
activity,
|
|
7628
|
-
hasChildren
|
|
7629
|
-
} : {
|
|
7630
|
-
kind: "child",
|
|
7631
|
-
id,
|
|
7632
|
-
mode: "continuable",
|
|
7633
|
-
label: identity.label,
|
|
7634
|
-
activity,
|
|
7635
|
-
hasChildren
|
|
7636
|
-
};
|
|
7637
|
-
}
|
|
7638
|
-
/** Immutable header fields that distinguish one session lifecycle from another under the same id. */
|
|
7639
|
-
const LIFECYCLE_WITNESS_KEYS = [
|
|
7640
|
-
"version",
|
|
7641
|
-
"id",
|
|
7642
|
-
"createdAt",
|
|
7643
|
-
"cwd",
|
|
7644
|
-
"parentSession",
|
|
7645
|
-
"isSeeded",
|
|
7646
|
-
"delegationDepth",
|
|
7647
|
-
"origin",
|
|
7648
|
-
"agentPreset"
|
|
7649
|
-
];
|
|
7650
|
-
/** Whether an inspected log still belongs to the enumerated lifecycle. */
|
|
7651
|
-
function sameLifecycle(meta, expected) {
|
|
7652
|
-
return LIFECYCLE_WITNESS_KEYS.every((key) => meta[key] === expected[key]);
|
|
7548
|
+
return result;
|
|
7653
7549
|
}
|
|
7654
|
-
/** Stop
|
|
7550
|
+
/** Stop the complete traversal when its caller cancels. */
|
|
7655
7551
|
function assertListingNotCancelled(signal) {
|
|
7656
7552
|
if (signal?.aborted) throw new SubagentError("subagent listing was cancelled", "CANCELLED");
|
|
7657
7553
|
}
|
|
7658
|
-
function sessionQueryCode(error) {
|
|
7659
|
-
return error instanceof Error && "code" in error ? error.code : void 0;
|
|
7660
|
-
}
|
|
7661
7554
|
//#endregion
|
|
7662
7555
|
//#region ../../../vendor/deepseek-harness/packages/subagent/subagent/src/archive-admission.ts
|
|
7663
7556
|
/**
|
|
@@ -8252,7 +8145,7 @@ var SubagentRuntime = class extends (_b = TypertRemoteService) {
|
|
|
8252
8145
|
const manager = new SubagentContinuationManager(childCtx, {
|
|
8253
8146
|
prepareContinuable: (name, request) => this.prepareContinuable(name, request),
|
|
8254
8147
|
observeActivation: (provider, childId, parent) => this.observeActivation(provider, childId, parent)
|
|
8255
|
-
}, () => this.config.maxActiveSubagents.get());
|
|
8148
|
+
}, () => this.config.maxActiveSubagents.get(), () => this.config.localizedReturnGuidancePresets);
|
|
8256
8149
|
this.continuations = manager;
|
|
8257
8150
|
childCtx.effect(() => () => {
|
|
8258
8151
|
if (this.continuations === manager) this.continuations = void 0;
|
|
@@ -8386,19 +8279,19 @@ var SubagentRuntime = class extends (_b = TypertRemoteService) {
|
|
|
8386
8279
|
return listChildren(this.ctx, parentSessionId, signal);
|
|
8387
8280
|
}
|
|
8388
8281
|
/**
|
|
8389
|
-
*
|
|
8390
|
-
*
|
|
8391
|
-
*
|
|
8392
|
-
*
|
|
8393
|
-
*
|
|
8394
|
-
*
|
|
8395
|
-
*
|
|
8396
|
-
*
|
|
8397
|
-
* @param
|
|
8398
|
-
*
|
|
8399
|
-
* @returns children and
|
|
8400
|
-
* stable pre-order.
|
|
8282
|
+
* Recursively list reachable parent catalogs in stable pre-order, preserving
|
|
8283
|
+
* each catalog's event order. Each row carries its catalog parent and depth;
|
|
8284
|
+
* one-shot and unknown-mode children remain traversal nodes. Unknown modes
|
|
8285
|
+
* produce unsupported diagnostics. Unreadable child catalogs produce corrupt
|
|
8286
|
+
* or unavailable diagnostics and stop only that branch. Root read failures,
|
|
8287
|
+
* missing services or projections, and cancellation reject the whole listing.
|
|
8288
|
+
* Each catalog is observed once and released before the next read. No Agent
|
|
8289
|
+
* is loaded or resumed; Sessions absent from reachable catalogs are omitted.
|
|
8290
|
+
* @param rootSessionId - session whose catalog starts descendant discovery.
|
|
8291
|
+
* @param signal - cancellation forwarded to and checked around each catalog read.
|
|
8292
|
+
* @returns children and branch diagnostics in parent-catalog pre-order.
|
|
8401
8293
|
* @throws {@link SubagentError} when listing dependencies are unavailable or the caller cancels.
|
|
8294
|
+
* @throws SessionQueryError when the root catalog cannot be read.
|
|
8402
8295
|
*/
|
|
8403
8296
|
listDescendants(rootSessionId, signal) {
|
|
8404
8297
|
return listDescendants(this.ctx, rootSessionId, signal);
|
|
@@ -8584,7 +8477,8 @@ __decorateElement(_init, 1, "interruptByParent", _interruptByParent_dec, Subagen
|
|
|
8584
8477
|
__decoratorMetadata(_init, SubagentRuntime);
|
|
8585
8478
|
__publicField(SubagentRuntime, "Config", z.object({
|
|
8586
8479
|
maxDepth: z.number().step(1).min(0).max(Number.MAX_SAFE_INTEGER).default(1).volatile(),
|
|
8587
|
-
maxActiveSubagents: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(8).volatile()
|
|
8480
|
+
maxActiveSubagents: z.number().step(1).min(1).max(Number.MAX_SAFE_INTEGER).default(8).volatile(),
|
|
8481
|
+
localizedReturnGuidancePresets: z.array(z.string()).default([]).hidden()
|
|
8588
8482
|
}));
|
|
8589
8483
|
//#endregion
|
|
8590
8484
|
export { AssistantOutputFold, NO_START_CAPABILITIES, SUBAGENT_DESCRIPTOR_VERSION, SubagentDepthError, SubagentError, SubagentRunId, SubagentRuntime, SubagentRuntime as default, appendDelegatedPolicyOverrides, applyChildComposition, assertPositiveFinite, assertSubagentMaxDepth, assertUsableCwd, captureDelegatedPolicyOverrides, childSessionMeta, delegationDepthOf, finalAssistantOutput, foldSubagentDescriptor, parentAgentOptionsForDelegation, resolveChildAgentOptions, resolveChildCwd, resolveChildDepth, settleRun, settleRunResult, snapshotSubagentDescriptor, subprocessRunHandle, validateConfiguredCwd };
|
package/dist/rows.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/rows.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 本包作为能力包发布的**装配数据**:行本身在部署那一层装
|
|
4
|
+
* (`packages/bundles/session-mode-profile` 引用它渲染 patch)。
|
|
5
|
+
*
|
|
6
|
+
* 接管方式是**按官方行 id 复用**,不是"禁掉官方行再插一行自己的":Loader 对同 id 的条目复用同一个 Entry、
|
|
7
|
+
* 后者替换入口 options(`EntryGroup.create` 的 `create: true`),所以行 id 与 settings namespace(namespace
|
|
8
|
+
* 就是行 id)都还是 `subagent`——官方设置卡 `ui-settings-subagent` 读得到那两个 namespace,照常可用;换掉的
|
|
9
|
+
* 只是实现包。顺序前提:本包排在 `@deepseek-ai/dsh-base` 之后(app 的 `dsh.profile.bundles` 已如此)。
|
|
10
|
+
*
|
|
11
|
+
* 模型白名单服务行(`subagent-model-selection-settings`)留给官方卡片第二段,本包不动它。
|
|
12
|
+
*/
|
|
13
|
+
/** 一行装配条目:与 `cordis.patch.yml` 的顶层结构同形。 */
|
|
14
|
+
interface PatchRow {
|
|
15
|
+
readonly id?: string;
|
|
16
|
+
readonly disabled?: boolean;
|
|
17
|
+
readonly insert?: readonly RowEntry[];
|
|
18
|
+
}
|
|
19
|
+
/** `insert` 里的一个条目。 */
|
|
20
|
+
interface RowEntry {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly config?: Readonly<Record<string, unknown>>;
|
|
24
|
+
}
|
|
25
|
+
interface SubagentRowsOptions {
|
|
26
|
+
/**
|
|
27
|
+
* 哪些 preset 的会话用本包的中文回报指引(本行 `config.localizedReturnGuidancePresets`)。
|
|
28
|
+
* 由装配给:它才知道自己注册的那份 preset 叫什么;不传即一律上游英文。
|
|
29
|
+
*/
|
|
30
|
+
readonly localizedReturnGuidancePresets?: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
/** 服务接管的装配行:占官方 `subagent` 那个行 id。 */
|
|
33
|
+
declare function subagentRows(options?: SubagentRowsOptions): readonly PatchRow[];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { PatchRow, RowEntry, SubagentRowsOptions, subagentRows };
|
package/dist/rows.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/rows.ts
|
|
2
|
+
/** 服务接管的装配行:占官方 `subagent` 那个行 id。 */
|
|
3
|
+
function subagentRows(options = {}) {
|
|
4
|
+
const presets = options.localizedReturnGuidancePresets;
|
|
5
|
+
return [{ insert: [{
|
|
6
|
+
id: "subagent",
|
|
7
|
+
name: "@morlay/dsh-subagent",
|
|
8
|
+
...presets === void 0 ? {} : { config: { localizedReturnGuidancePresets: [...presets] } }
|
|
9
|
+
}] }];
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { subagentRows };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morlay/dsh-subagent",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "Thin-shell fork of @deepseek-ai/dsh-subagent: takes over the `subagent` row only to replace the continuable-child return guidance with Chinese wording; everything not intentionally changed is imported from the vendored upstream source",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -16,66 +16,46 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"locale/*.json",
|
|
18
18
|
"dist",
|
|
19
|
-
"cordis.patch.yml",
|
|
20
19
|
"!**/__tests__"
|
|
21
20
|
],
|
|
22
21
|
"type": "module",
|
|
23
22
|
"exports": {
|
|
24
23
|
".": "./dist/index.mjs",
|
|
25
|
-
"./
|
|
26
|
-
"types": "./dist/client.d.cts",
|
|
27
|
-
"default": "./dist/client.cjs"
|
|
28
|
-
},
|
|
24
|
+
"./rows": "./dist/rows.mjs",
|
|
29
25
|
"./package.json": "./package.json",
|
|
30
|
-
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
31
26
|
"./locale/*.json": "./locale/*.json"
|
|
32
27
|
},
|
|
33
28
|
"dependencies": {
|
|
34
|
-
"@deepseek-ai/dsh-brand": "0.1.7-rc.
|
|
29
|
+
"@deepseek-ai/dsh-brand": "^0.1.7-rc.2",
|
|
35
30
|
"@deepseek-ai/schemastery": "~3.18.4"
|
|
36
31
|
},
|
|
37
32
|
"devDependencies": {
|
|
38
|
-
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.
|
|
39
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.
|
|
40
|
-
"@deepseek-ai/dsh-chunked-list": "0.1.7-rc.
|
|
41
|
-
"@deepseek-ai/dsh-
|
|
42
|
-
"@deepseek-ai/dsh-
|
|
43
|
-
"@deepseek-ai/dsh-
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-invariants": "0.1.7-rc.1",
|
|
48
|
-
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.1",
|
|
49
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.1",
|
|
50
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.7-rc.1",
|
|
51
|
-
"@deepseek-ai/dsh-tool-subagent-control": "0.1.7-rc.1",
|
|
52
|
-
"@deepseek-ai/dsh-util-values": "0.1.7-rc.1",
|
|
33
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.7-rc.2",
|
|
34
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.1.7-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-chunked-list": "0.1.7-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-invariants": "0.1.7-rc.2",
|
|
37
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.7-rc.2",
|
|
38
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "0.1.7-rc.2",
|
|
39
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.7-rc.2",
|
|
40
|
+
"@deepseek-ai/dsh-tool-subagent-control": "0.1.7-rc.2",
|
|
41
|
+
"@deepseek-ai/dsh-util-values": "0.1.7-rc.2",
|
|
53
42
|
"@deepseek-ai/schemastery": "~3.18.4",
|
|
54
|
-
"@morlay/dsh-client-ui-primitives": "0.0.2-alpha.8",
|
|
55
|
-
"@types/react": "~18.3.1",
|
|
56
|
-
"react": "^18.2.0",
|
|
57
43
|
"zod": "^4.4.3"
|
|
58
44
|
},
|
|
59
45
|
"peerDependencies": {
|
|
60
46
|
"@deepseek-ai/cordis": "~4.0.4",
|
|
61
|
-
"@deepseek-ai/dsh-agent": "0.1.7-rc.
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
67
|
-
"@deepseek-ai/dsh-
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"@deepseek-ai/dsh-
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-session-query": "0.1.7-rc.1",
|
|
74
|
-
"@deepseek-ai/dsh-subagent": "0.1.7-rc.1",
|
|
75
|
-
"@deepseek-ai/dsh-tools": "0.1.7-rc.1",
|
|
76
|
-
"@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.1",
|
|
77
|
-
"@deepseek-ai/dsh-util-time": "0.1.7-rc.1",
|
|
78
|
-
"@morlay/dsh-client-ui-primitives": "0.0.2-alpha.8"
|
|
47
|
+
"@deepseek-ai/dsh-agent": "^0.1.7-rc.2",
|
|
48
|
+
"@deepseek-ai/dsh-agent-preset-registry": "^0.1.7-rc.2",
|
|
49
|
+
"@deepseek-ai/dsh-attachment": "^0.1.7-rc.2",
|
|
50
|
+
"@deepseek-ai/dsh-llm": "^0.1.7-rc.2",
|
|
51
|
+
"@deepseek-ai/dsh-scope": "^0.1.7-rc.2",
|
|
52
|
+
"@deepseek-ai/dsh-session": "^0.1.7-rc.2",
|
|
53
|
+
"@deepseek-ai/dsh-session-persistence": "^0.1.7-rc.2",
|
|
54
|
+
"@deepseek-ai/dsh-session-query": "^0.1.7-rc.2",
|
|
55
|
+
"@deepseek-ai/dsh-subagent": "^0.1.7-rc.2",
|
|
56
|
+
"@deepseek-ai/dsh-tools": "^0.1.7-rc.2",
|
|
57
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.7-rc.2",
|
|
58
|
+
"@deepseek-ai/dsh-util-time": "^0.1.7-rc.2"
|
|
79
59
|
},
|
|
80
60
|
"peerDependenciesMeta": {
|
|
81
61
|
"@deepseek-ai/dsh-session-persistence": {
|
|
@@ -85,21 +65,6 @@
|
|
|
85
65
|
"optional": true
|
|
86
66
|
}
|
|
87
67
|
},
|
|
88
|
-
"dsh": {
|
|
89
|
-
"bundle": {
|
|
90
|
-
"patch": "./cordis.patch.yml"
|
|
91
|
-
},
|
|
92
|
-
"client": {
|
|
93
|
-
"platform": "web",
|
|
94
|
-
"inject": [
|
|
95
|
-
"@deepseek-ai/dsh-client-locale",
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-plugin-manager",
|
|
97
|
-
"@deepseek-ai/dsh-client-ui-settings",
|
|
98
|
-
"@deepseek-ai/dsh-client-ui-slots",
|
|
99
|
-
"@morlay/dsh-client-ui-primitives"
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
68
|
"scripts": {
|
|
104
69
|
"build": "pnpm exec tsdown"
|
|
105
70
|
}
|
package/cordis.patch.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# 上游 base bundle 的 `subagent` 行(`ctx.subagents` 服务定义)由本包接管:薄壳 fork 只改 continuable
|
|
2
|
-
# 子代理的回报文案,服务名、providers、其余子路径(./internal 等)与装配位置都不变。
|
|
3
|
-
- id: subagent
|
|
4
|
-
disabled: true
|
|
5
|
-
|
|
6
|
-
# 设置页那张「Subagent」卡片换成本包自己的 client 半(`src/client/` 读 `subagent-fork` 这个 namespace),
|
|
7
|
-
# 所以官方卡片行与它带的「模型白名单」服务行一起停掉:官方卡片读的是官方 `subagent` 行 id,本部署已没有
|
|
8
|
-
# 那个 namespace;模型白名单那套也不要——子代理模型统一由 session mode 的顶层 `models`(各模式的默认模型)决定。
|
|
9
|
-
- id: ui-settings-subagent
|
|
10
|
-
disabled: true
|
|
11
|
-
|
|
12
|
-
- id: subagent-model-selection-settings
|
|
13
|
-
disabled: true
|
|
14
|
-
|
|
15
|
-
- insert:
|
|
16
|
-
- id: subagent-fork
|
|
17
|
-
name: "@morlay/dsh-subagent"
|