@dsh-cc/subagent-task 0.6.0 → 0.6.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/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +23 -0
- package/lib/index.js.map +1 -1
- package/lib/one-shot-ledger.d.ts +99 -0
- package/lib/one-shot-ledger.d.ts.map +1 -0
- package/lib/one-shot-ledger.js +113 -0
- package/lib/one-shot-ledger.js.map +1 -0
- package/lib/one-shot-notice.d.ts +51 -0
- package/lib/one-shot-notice.d.ts.map +1 -0
- package/lib/one-shot-notice.js +71 -0
- package/lib/one-shot-notice.js.map +1 -0
- package/package.json +13 -13
package/lib/index.d.ts
CHANGED
|
@@ -23,6 +23,19 @@ export { registerTaskTool, TASK_TOOL, MAX_LIVE_CONTINUABLE_CHILDREN, CLAUDE_CODE
|
|
|
23
23
|
export { collectFirstEpoch, collectorFor, collectorKey, registerCollector, unregisterCollector, collectorsForSession, registeredCollectorCount, markCollectedForSuppression, releaseCollectedForSuppression, isCollectedForSuppression, } from './epoch-collector.ts';
|
|
24
24
|
export type { CollectorRegistration, EpochOutcome, EpochTerminal, } from './epoch-collector.ts';
|
|
25
25
|
export { mountAgentCatalog } from './catalog.ts';
|
|
26
|
+
export { createOneShotLedger, DEFAULT_ACTIVE_TTL_MS, DEFAULT_ENDED_TTL_MS, INTERNAL_LABELS } from './one-shot-ledger.ts';
|
|
27
|
+
export type { OneShotLedgerRow } from './one-shot-ledger.ts';
|
|
28
|
+
export { mountSubagentChildNotice, foldChildNotice, CHILD_NOTICE_SOURCE_KIND } from './one-shot-notice.ts';
|
|
29
|
+
/**
|
|
30
|
+
* One-shot subagent visibility (memory-recall hardening follow-ups W2a/c):
|
|
31
|
+
* the shared `subagent/start`/`subagent/end` ledger plus the parent-scoped
|
|
32
|
+
* `agent/pre-step` notice, mounted on ONE context. Safe on a context without
|
|
33
|
+
* an `agents` service — parentage then stays unresolvable and nothing is
|
|
34
|
+
* ever injected.
|
|
35
|
+
* @param ctx - the plug context.
|
|
36
|
+
* @returns an unmount callback.
|
|
37
|
+
*/
|
|
38
|
+
export declare function mountOneShotVisibility(ctx: Context): () => void;
|
|
26
39
|
export { mountStripWorkspaceInstructions, isDelegated, isAgentInstructions, } from './strip-instructions.ts';
|
|
27
40
|
export { isSubagentSettledNotice, mountSettledNoticeSuppression, } from './suppress-settled.ts';
|
|
28
41
|
export type { ResumePinsConfig, CaptureInput } from './resume-capture.ts';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAOlD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAOlD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAU5E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,6BAA6B,EAC7B,oCAAoC,EACpC,uBAAuB,GACxB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EACV,qBAAqB,EACrB,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 @@ import { PluginAgentIndex } from "./plugin-agents.js";
|
|
|
23
23
|
import { registerTaskTool } from "./tool.js";
|
|
24
24
|
import { mountSettledNoticeSuppression } from "./suppress-settled.js";
|
|
25
25
|
import { mountAgentCatalog } from "./catalog.js";
|
|
26
|
+
import { createOneShotLedger } from "./one-shot-ledger.js";
|
|
27
|
+
import { mountSubagentChildNotice } from "./one-shot-notice.js";
|
|
26
28
|
import { mountStripWorkspaceInstructions } from "./strip-instructions.js";
|
|
27
29
|
export { AgentRegistry } from "./registry.js";
|
|
28
30
|
export { PluginAgentIndex } from "./plugin-agents.js";
|
|
29
31
|
export { registerTaskTool, TASK_TOOL, MAX_LIVE_CONTINUABLE_CHILDREN, CLAUDE_CODE_DISABLE_BACKGROUND_TASKS, backgroundTasksDisabled, } from "./tool.js";
|
|
30
32
|
export { collectFirstEpoch, collectorFor, collectorKey, registerCollector, unregisterCollector, collectorsForSession, registeredCollectorCount, markCollectedForSuppression, releaseCollectedForSuppression, isCollectedForSuppression, } from "./epoch-collector.js";
|
|
31
33
|
export { mountAgentCatalog } from "./catalog.js";
|
|
34
|
+
export { createOneShotLedger, DEFAULT_ACTIVE_TTL_MS, DEFAULT_ENDED_TTL_MS, INTERNAL_LABELS } from "./one-shot-ledger.js";
|
|
35
|
+
export { mountSubagentChildNotice, foldChildNotice, CHILD_NOTICE_SOURCE_KIND } from "./one-shot-notice.js";
|
|
36
|
+
/**
|
|
37
|
+
* One-shot subagent visibility (memory-recall hardening follow-ups W2a/c):
|
|
38
|
+
* the shared `subagent/start`/`subagent/end` ledger plus the parent-scoped
|
|
39
|
+
* `agent/pre-step` notice, mounted on ONE context. Safe on a context without
|
|
40
|
+
* an `agents` service — parentage then stays unresolvable and nothing is
|
|
41
|
+
* ever injected.
|
|
42
|
+
* @param ctx - the plug context.
|
|
43
|
+
* @returns an unmount callback.
|
|
44
|
+
*/
|
|
45
|
+
export function mountOneShotVisibility(ctx) {
|
|
46
|
+
const agents = ctx.get('agents');
|
|
47
|
+
const ledger = createOneShotLedger({ bus: ctx, agents });
|
|
48
|
+
const offNotice = mountSubagentChildNotice(ctx, ledger);
|
|
49
|
+
return () => {
|
|
50
|
+
ledger.dispose();
|
|
51
|
+
offNotice();
|
|
52
|
+
};
|
|
53
|
+
}
|
|
32
54
|
export { mountStripWorkspaceInstructions, isDelegated, isAgentInstructions, } from "./strip-instructions.js";
|
|
33
55
|
export { isSubagentSettledNotice, mountSettledNoticeSuppression, } from "./suppress-settled.js";
|
|
34
56
|
export { SpawnPinCapture, overlayRoute, probeWorkspace } from "./resume-capture.js";
|
|
@@ -120,6 +142,7 @@ export function apply(ctx, config = {}) {
|
|
|
120
142
|
mountBackgroundSection(ctx);
|
|
121
143
|
mountStripWorkspaceInstructions(ctx);
|
|
122
144
|
mountSettledNoticeSuppression(ctx);
|
|
145
|
+
mountOneShotVisibility(ctx);
|
|
123
146
|
publishCollectorRegistry(ctx);
|
|
124
147
|
}
|
|
125
148
|
/**
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AACvD,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,eAAe,EAAyB,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAA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C,CAAA;IAClC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAC3B,wBAAwB,CAAC,GAAG,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,wBAAwB,CAAC,GAAY;IAC5C,MAAM,IAAI,GAAG,GAAG,CAAC,IAIhB,CAAA;IACD,MAAM,eAAe,GAAG;QACtB,YAAY;QACZ,oBAAoB;QACpB,wBAAwB;KACzB,CAAA;IACD,IAAI,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,KAAK,SAAS,EAAE,CAAC;QACzD,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAA;IACtD,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAA;IAClD,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE;QACpB,IAAI,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,KAAK,eAAe;YAAE,IAAI,CAAC,GAAG,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;IAC5G,CAAC,EAAE,8EAA8E,CAAC,CAAA;AACpF,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-level one-shot subagent ledger (memory-recall hardening follow-ups
|
|
3
|
+
* W2a, `docs/plans/2026-09-09-memory-recall-hardening-followups.md` §2 W2):
|
|
4
|
+
* one shared `subagent/start` + `subagent/end` listener pair (mirroring
|
|
5
|
+
* `epoch-collector.ts` wiring) folds every run the process observes into
|
|
6
|
+
* rows keyed by runId.
|
|
7
|
+
*
|
|
8
|
+
* Pairing is BY RUN ID, never by child id: a cold-resumed child gets a new
|
|
9
|
+
* runId and must not satisfy a stale watcher (epoch-collector's documented
|
|
10
|
+
* lesson). Parentage resolves from the child's session header
|
|
11
|
+
* `parentSession` via the `agents` seam (`ctx.agents.get(id)`), the same
|
|
12
|
+
* probe the TUI driver uses; unresolvable parentage is kept but treated as
|
|
13
|
+
* unscoped and never injected into any session's context.
|
|
14
|
+
*
|
|
15
|
+
* Internal (infra-fork) classification prefers the child's session
|
|
16
|
+
* descriptor metadata — the `subagent/descriptor` event's `label` — falling
|
|
17
|
+
* back to nothing (a child with no descriptor label is never internal on
|
|
18
|
+
* label grounds). {@link INTERNAL_LABELS} lists the production labels that
|
|
19
|
+
* must always classify as internal; a completeness test pins it.
|
|
20
|
+
*
|
|
21
|
+
* Rows prune by TTL both after ending AND while active (a crashed child may
|
|
22
|
+
* never emit `end`); an `end` arriving after its row was pruned is a no-op.
|
|
23
|
+
*
|
|
24
|
+
* @module @dsh-cc/subagent-task/one-shot-ledger
|
|
25
|
+
*/
|
|
26
|
+
/** Production labels that mark a child as internal dsh-cc infrastructure. */
|
|
27
|
+
export declare const INTERNAL_LABELS: readonly string[];
|
|
28
|
+
/** One observed subagent run. */
|
|
29
|
+
export interface OneShotLedgerRow {
|
|
30
|
+
/** Unique identity shared by the paired start/end events. */
|
|
31
|
+
runId: string;
|
|
32
|
+
/** The child agent's (session) id. */
|
|
33
|
+
id: string;
|
|
34
|
+
/** Provider name snapshot from the events. */
|
|
35
|
+
provider: string;
|
|
36
|
+
/** Creation label from the child's session descriptor, when enumerable. */
|
|
37
|
+
label?: string;
|
|
38
|
+
/** Parent session id resolved from the child's session header, when resolvable. */
|
|
39
|
+
parentId?: string;
|
|
40
|
+
/** Wall-clock ms when the start event arrived. */
|
|
41
|
+
startedAt: number;
|
|
42
|
+
/** Wall-clock ms when the paired end event arrived. */
|
|
43
|
+
endedAt?: number;
|
|
44
|
+
/** Terminal stop reason from the end event. */
|
|
45
|
+
stopReason?: string;
|
|
46
|
+
/** True when the child is internal dsh-cc infrastructure (descriptor label ∈ {@link INTERNAL_LABELS}). */
|
|
47
|
+
internal: boolean;
|
|
48
|
+
/** Descriptor mode snapshot when enumerable (`one-shot` / `continuable`). */
|
|
49
|
+
mode?: string;
|
|
50
|
+
}
|
|
51
|
+
/** The duck-typed child-agent snapshot probed for parentage/label metadata. */
|
|
52
|
+
export interface LedgerChildSnapshot {
|
|
53
|
+
session?: {
|
|
54
|
+
id?: unknown;
|
|
55
|
+
header?: {
|
|
56
|
+
parentSession?: unknown;
|
|
57
|
+
};
|
|
58
|
+
events?: readonly {
|
|
59
|
+
type?: string;
|
|
60
|
+
data?: {
|
|
61
|
+
label?: unknown;
|
|
62
|
+
mode?: unknown;
|
|
63
|
+
};
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Duck-typed `ctx.agents` accessor for child-session parentage probes. */
|
|
68
|
+
export interface LedgerAgents {
|
|
69
|
+
get?(id: string): LedgerChildSnapshot | undefined;
|
|
70
|
+
}
|
|
71
|
+
/** Duck-typed event bus (cordis `ctx.on`) the lifecycle events arrive on. */
|
|
72
|
+
export interface LedgerEventBus {
|
|
73
|
+
on(event: string, listener: (info: Record<string, unknown>) => void): (() => void) | void;
|
|
74
|
+
}
|
|
75
|
+
export interface OneShotLedgerDeps {
|
|
76
|
+
/** The bus the shared listener pair subscribes to. */
|
|
77
|
+
bus: LedgerEventBus;
|
|
78
|
+
/** The live agent registry (`ctx.agents`) used for parentage/label probes. */
|
|
79
|
+
agents?: LedgerAgents | undefined;
|
|
80
|
+
/** Wall clock; defaults to `Date.now`. */
|
|
81
|
+
now?: () => number;
|
|
82
|
+
/** How long an ended row stays queryable. Default 5 minutes. */
|
|
83
|
+
endedTtlMs?: number;
|
|
84
|
+
/** How long a never-ended (active) row stays queryable. Default 60 minutes. */
|
|
85
|
+
activeTtlMs?: number;
|
|
86
|
+
}
|
|
87
|
+
export declare const DEFAULT_ENDED_TTL_MS: number;
|
|
88
|
+
export declare const DEFAULT_ACTIVE_TTL_MS: number;
|
|
89
|
+
/**
|
|
90
|
+
* Create the ledger and attach its shared `subagent/start` / `subagent/end`
|
|
91
|
+
* listener pair to the bus (mirrors `epoch-collector`'s shared-watcher
|
|
92
|
+
* wiring). The returned handle prunes lazily on every read.
|
|
93
|
+
*/
|
|
94
|
+
export declare function createOneShotLedger(deps: OneShotLedgerDeps): {
|
|
95
|
+
rows(): readonly OneShotLedgerRow[];
|
|
96
|
+
activeFor(parentId: string): readonly OneShotLedgerRow[];
|
|
97
|
+
dispose(): void;
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=one-shot-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-shot-ledger.d.ts","sourceRoot":"","sources":["../src/one-shot-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAS5C,CAAA;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAA;IACb,sCAAsC;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAA;IAChB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,0GAA0G;IAC1G,QAAQ,EAAE,OAAO,CAAA;IACjB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE;QACR,EAAE,CAAC,EAAE,OAAO,CAAA;QACZ,MAAM,CAAC,EAAE;YAAE,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;QACpC,MAAM,CAAC,EAAE,SAAS;YAAE,IAA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plans/2026-09-09-memory-recall-hardening-followups.md` §2 W2):
|
|
4
|
+
* one shared `subagent/start` + `subagent/end` listener pair (mirroring
|
|
5
|
+
* `epoch-collector.ts` wiring) folds every run the process observes into
|
|
6
|
+
* rows keyed by runId.
|
|
7
|
+
*
|
|
8
|
+
* Pairing is BY RUN ID, never by child id: a cold-resumed child gets a new
|
|
9
|
+
* runId and must not satisfy a stale watcher (epoch-collector's documented
|
|
10
|
+
* lesson). Parentage resolves from the child's session header
|
|
11
|
+
* `parentSession` via the `agents` seam (`ctx.agents.get(id)`), the same
|
|
12
|
+
* probe the TUI driver uses; unresolvable parentage is kept but treated as
|
|
13
|
+
* unscoped and never injected into any session's context.
|
|
14
|
+
*
|
|
15
|
+
* Internal (infra-fork) classification prefers the child's session
|
|
16
|
+
* descriptor metadata — the `subagent/descriptor` event's `label` — falling
|
|
17
|
+
* back to nothing (a child with no descriptor label is never internal on
|
|
18
|
+
* label grounds). {@link INTERNAL_LABELS} lists the production labels that
|
|
19
|
+
* must always classify as internal; a completeness test pins it.
|
|
20
|
+
*
|
|
21
|
+
* Rows prune by TTL both after ending AND while active (a crashed child may
|
|
22
|
+
* never emit `end`); an `end` arriving after its row was pruned is a no-op.
|
|
23
|
+
*
|
|
24
|
+
* @module @dsh-cc/subagent-task/one-shot-ledger
|
|
25
|
+
*/
|
|
26
|
+
/** Production labels that mark a child as internal dsh-cc infrastructure. */
|
|
27
|
+
export const INTERNAL_LABELS = [
|
|
28
|
+
// packages/memory/memory/src/recall.ts (the recall selector)
|
|
29
|
+
'memory-recall',
|
|
30
|
+
// packages/memory/memory-consolidation/src/index.ts (startMemoryJob call sites)
|
|
31
|
+
'extract-memories',
|
|
32
|
+
'memory-consolidation',
|
|
33
|
+
// packages/hooks/hooks-claude-code/src/dispatch.ts (CC hook bridge forks)
|
|
34
|
+
'hook-prompt',
|
|
35
|
+
'hook-agent',
|
|
36
|
+
];
|
|
37
|
+
export const DEFAULT_ENDED_TTL_MS = 5 * 60_000;
|
|
38
|
+
export const DEFAULT_ACTIVE_TTL_MS = 60 * 60_000;
|
|
39
|
+
function resolveDescriptor(child) {
|
|
40
|
+
const event = child?.session?.events?.find(e => e.type === 'subagent/descriptor');
|
|
41
|
+
if (event === undefined)
|
|
42
|
+
return {};
|
|
43
|
+
return {
|
|
44
|
+
...event.data?.label !== undefined ? { label: String(event.data.label) } : {},
|
|
45
|
+
...event.data?.mode !== undefined ? { mode: String(event.data.mode) } : {},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function resolveParentId(child) {
|
|
49
|
+
const parent = child?.session?.header?.parentSession;
|
|
50
|
+
return parent === undefined || parent === null || parent === '' ? undefined : String(parent);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create the ledger and attach its shared `subagent/start` / `subagent/end`
|
|
54
|
+
* listener pair to the bus (mirrors `epoch-collector`'s shared-watcher
|
|
55
|
+
* wiring). The returned handle prunes lazily on every read.
|
|
56
|
+
*/
|
|
57
|
+
export function createOneShotLedger(deps) {
|
|
58
|
+
const now = deps.now ?? Date.now;
|
|
59
|
+
const endedTtlMs = deps.endedTtlMs ?? DEFAULT_ENDED_TTL_MS;
|
|
60
|
+
const activeTtlMs = deps.activeTtlMs ?? DEFAULT_ACTIVE_TTL_MS;
|
|
61
|
+
// Rows the ledger keeps, keyed by runId (one row per epoch).
|
|
62
|
+
const rowsByRunId = new Map();
|
|
63
|
+
const offStart = deps.bus.on('subagent/start', info => {
|
|
64
|
+
const id = String(info.id);
|
|
65
|
+
const child = deps.agents?.get?.(id);
|
|
66
|
+
const descriptor = resolveDescriptor(child);
|
|
67
|
+
const label = descriptor.label;
|
|
68
|
+
const parentId = resolveParentId(child);
|
|
69
|
+
rowsByRunId.set(String(info.runId), {
|
|
70
|
+
runId: String(info.runId),
|
|
71
|
+
id,
|
|
72
|
+
provider: String(info.provider),
|
|
73
|
+
...label !== undefined ? { label } : {},
|
|
74
|
+
...parentId !== undefined ? { parentId } : {},
|
|
75
|
+
startedAt: now(),
|
|
76
|
+
internal: label !== undefined && INTERNAL_LABELS.includes(label),
|
|
77
|
+
...descriptor.mode !== undefined ? { mode: descriptor.mode } : {},
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
const offEnd = deps.bus.on('subagent/end', info => {
|
|
81
|
+
const runId = String(info.runId);
|
|
82
|
+
const row = rowsByRunId.get(runId);
|
|
83
|
+
if (row === undefined)
|
|
84
|
+
return; // pruned or never started: a no-op
|
|
85
|
+
row.endedAt = now();
|
|
86
|
+
row.stopReason = String(info.stopReason);
|
|
87
|
+
});
|
|
88
|
+
const prune = () => {
|
|
89
|
+
const t = now();
|
|
90
|
+
for (const [runId, row] of rowsByRunId) {
|
|
91
|
+
if (row.endedAt !== undefined ? t - row.endedAt > endedTtlMs : t - row.startedAt > activeTtlMs) {
|
|
92
|
+
rowsByRunId.delete(runId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
rows() {
|
|
98
|
+
prune();
|
|
99
|
+
return [...rowsByRunId.values()];
|
|
100
|
+
},
|
|
101
|
+
activeFor(parentId) {
|
|
102
|
+
prune();
|
|
103
|
+
return [...rowsByRunId.values()].filter(row => row.parentId === parentId && row.endedAt === undefined
|
|
104
|
+
// Unresolvable parentage is never scoped to any session.
|
|
105
|
+
&& row.parentId !== undefined);
|
|
106
|
+
},
|
|
107
|
+
dispose() {
|
|
108
|
+
offStart?.();
|
|
109
|
+
offEnd?.();
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=one-shot-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-shot-ledger.js","sourceRoot":"","sources":["../src/one-shot-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAsB;IAChD,6DAA6D;IAC7D,eAA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,CAAC,CAAA;QAClC,CAAC;QACD,OAAO;YACL,QAAQ,EAAE,EAAE,CAAA;YACZ,MAAM,EAAE,EAAE,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parent-scoped subagent-child notice (memory-recall hardening follow-ups
|
|
3
|
+
* W2c): on `agent/pre-step`, ONLY the agent whose `session.id` matches a
|
|
4
|
+
* ledger row's `parentId` gets one folded observe-only line — contributed
|
|
5
|
+
* via `agent.inject()` + `createUserMessage` with a dedicated
|
|
6
|
+
* `MessageSourceMap` kind, mirroring `packages/memory/memory/src/recall.ts`'s
|
|
7
|
+
* contribution shape — when that session has ≥1 active non-internal
|
|
8
|
+
* one-shot child. Zero emission otherwise: sessions with no children see
|
|
9
|
+
* nothing; internal-only activity yields at most a folded count, never
|
|
10
|
+
* per-child rows.
|
|
11
|
+
*
|
|
12
|
+
* Registration follows `strip-instructions.ts` / `suppress-settled.ts`: a
|
|
13
|
+
* plain `agent/pre-step` waterfall listener that delegates to `next()`
|
|
14
|
+
* unchanged (observe-only). No `prepend` — unlike the strip, this listener
|
|
15
|
+
* reads only the ledger and its own agent, so ordering is irrelevant.
|
|
16
|
+
*
|
|
17
|
+
* @module @dsh-cc/subagent-task/one-shot-notice
|
|
18
|
+
*/
|
|
19
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
20
|
+
import type { OneShotLedgerRow } from './one-shot-ledger.ts';
|
|
21
|
+
declare module '@deepseek-ai/dsh-llm' {
|
|
22
|
+
interface MessageSourceMap {
|
|
23
|
+
ccSubagentChild: {
|
|
24
|
+
kind: 'cc-subagent-children';
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** MessageSourceMap kind for the observe-only child notice. */
|
|
29
|
+
export declare const CHILD_NOTICE_SOURCE_KIND = "cc-subagent-children";
|
|
30
|
+
/**
|
|
31
|
+
* Fold the active children of one parent into the single observe-only line.
|
|
32
|
+
* Non-internal children surface their labels; internal children fold into a
|
|
33
|
+
* bare count (`… +N internal`), and internal-only activity yields a count
|
|
34
|
+
* line with no per-child rows at all.
|
|
35
|
+
*/
|
|
36
|
+
export declare function foldChildNotice(rows: readonly {
|
|
37
|
+
label?: string;
|
|
38
|
+
internal: boolean;
|
|
39
|
+
}[]): string;
|
|
40
|
+
/** The ledger surface the notice listener reads. */
|
|
41
|
+
export interface ChildNoticeLedger {
|
|
42
|
+
activeFor(parentId: string): readonly OneShotLedgerRow[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Mount the `agent/pre-step` child-notice listener.
|
|
46
|
+
* @param ctx - the plug context.
|
|
47
|
+
* @param ledger - the ledger to read.
|
|
48
|
+
* @returns an unmount callback.
|
|
49
|
+
*/
|
|
50
|
+
export declare function mountSubagentChildNotice(ctx: Context, ledger: ChildNoticeLedger): () => void;
|
|
51
|
+
//# sourceMappingURL=one-shot-notice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"one-shot-notice.d.ts","sourceRoot":"","sources":["../src/one-shot-notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAGlD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,gBAAgB;QACxB,eAAe,EAAE;YAAE,IAAI,EAAE,sBAAsB,CAAA;SAAE,CAAA;KAClD;CACF;AAED,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,yBAAyB,CAAA;AAE9D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG,MAAM,CAW9F;AAED,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAAA;CACzD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,GAAG,MAAM,IAAI,CAmB5F"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parent-scoped subagent-child notice (memory-recall hardening follow-ups
|
|
3
|
+
* W2c): on `agent/pre-step`, ONLY the agent whose `session.id` matches a
|
|
4
|
+
* ledger row's `parentId` gets one folded observe-only line — contributed
|
|
5
|
+
* via `agent.inject()` + `createUserMessage` with a dedicated
|
|
6
|
+
* `MessageSourceMap` kind, mirroring `packages/memory/memory/src/recall.ts`'s
|
|
7
|
+
* contribution shape — when that session has ≥1 active non-internal
|
|
8
|
+
* one-shot child. Zero emission otherwise: sessions with no children see
|
|
9
|
+
* nothing; internal-only activity yields at most a folded count, never
|
|
10
|
+
* per-child rows.
|
|
11
|
+
*
|
|
12
|
+
* Registration follows `strip-instructions.ts` / `suppress-settled.ts`: a
|
|
13
|
+
* plain `agent/pre-step` waterfall listener that delegates to `next()`
|
|
14
|
+
* unchanged (observe-only). No `prepend` — unlike the strip, this listener
|
|
15
|
+
* reads only the ledger and its own agent, so ordering is irrelevant.
|
|
16
|
+
*
|
|
17
|
+
* @module @dsh-cc/subagent-task/one-shot-notice
|
|
18
|
+
*/
|
|
19
|
+
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
20
|
+
/** MessageSourceMap kind for the observe-only child notice. */
|
|
21
|
+
export const CHILD_NOTICE_SOURCE_KIND = 'cc-subagent-children';
|
|
22
|
+
/**
|
|
23
|
+
* Fold the active children of one parent into the single observe-only line.
|
|
24
|
+
* Non-internal children surface their labels; internal children fold into a
|
|
25
|
+
* bare count (`… +N internal`), and internal-only activity yields a count
|
|
26
|
+
* line with no per-child rows at all.
|
|
27
|
+
*/
|
|
28
|
+
export function foldChildNotice(rows) {
|
|
29
|
+
const visible = rows.filter(row => !row.internal);
|
|
30
|
+
const internalCount = rows.length - visible.length;
|
|
31
|
+
if (visible.length === 0 && internalCount === 0)
|
|
32
|
+
return '';
|
|
33
|
+
const parts = [];
|
|
34
|
+
if (visible.length > 0) {
|
|
35
|
+
const labels = visible.map(row => row.label ?? 'unlabeled');
|
|
36
|
+
parts.push(`${visible.length} active subagent child${visible.length === 1 ? '' : 'ren'}: ${labels.join(', ')}`);
|
|
37
|
+
}
|
|
38
|
+
if (internalCount > 0)
|
|
39
|
+
parts.push(`+${internalCount} internal`);
|
|
40
|
+
return `[observe] ${parts.join(' ')}`.trim();
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Mount the `agent/pre-step` child-notice listener.
|
|
44
|
+
* @param ctx - the plug context.
|
|
45
|
+
* @param ledger - the ledger to read.
|
|
46
|
+
* @returns an unmount callback.
|
|
47
|
+
*/
|
|
48
|
+
export function mountSubagentChildNotice(ctx, ledger) {
|
|
49
|
+
return ctx.on('agent/pre-step', async ({ agent }, next) => {
|
|
50
|
+
const decision = await next();
|
|
51
|
+
// Fire-and-forget: the notice is model-visible enrichment, never worth
|
|
52
|
+
// an unhandled rejection in the host.
|
|
53
|
+
try {
|
|
54
|
+
const sid = agent.session?.id;
|
|
55
|
+
if (sid === undefined)
|
|
56
|
+
return decision;
|
|
57
|
+
const active = ledger.activeFor(String(sid));
|
|
58
|
+
if (active.length === 0)
|
|
59
|
+
return decision;
|
|
60
|
+
agent.inject(createUserMessage({
|
|
61
|
+
content: [{ type: 'text', text: foldChildNotice(active) }],
|
|
62
|
+
source: { kind: 'cc-subagent-children' },
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Absent llm seam or inject surface: skip quietly.
|
|
67
|
+
}
|
|
68
|
+
return decision;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=one-shot-notice.js.map
|
|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B,CAAC,GAAY,EAAE,MAAyB;IAC9E,OAAO,GAAG,CAAC,EAAE,CAAC,gBAAgB,EAAE,KAAK,EAAE,EAAE,KAAK,EAAoB,EAAE,IAAI,EAA4B,EAAE;QACpG,MAAM,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAA;QAC7B,uEAAuE;QACvE,sCAAsC;QACtC,IAAI,CAAC;YACH,MAAM,GAAG,GAAI,KAAK,CAAC,OAAwC,EAAE,EAAE,CAAA;YAC/D,IAAI,GAAG,KAAK,SAAS;gBAAE,OAAO,QAAQ,CAAA;YACtC,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;YAC5C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,QAAQ,CAAA;YACxC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC;gBAC7B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1D,MAAM,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;aACzC,CAAC,CAAC,CAAA;QACL,CAAC;QAAC,MAAM,CAAC;YACP,mDAAmD;QACrD,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-cc/subagent-task",
|
|
3
3
|
"description": "Claude Code-compatible Task tool: subagent_type dispatch over per-workspace .claude/agents definitions for the DeepSeek Harness",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/dsh-cc/dsh-cc.git",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@dsh-cc/
|
|
45
|
-
"@dsh-cc/
|
|
46
|
-
"@dsh-cc/
|
|
47
|
-
"@dsh-cc/
|
|
48
|
-
"@dsh-cc/
|
|
44
|
+
"@dsh-cc/model-aliases": "^0.6.1",
|
|
45
|
+
"@dsh-cc/subagent-resume-pins": "^0.6.1",
|
|
46
|
+
"@dsh-cc/tools": "^0.6.1",
|
|
47
|
+
"@dsh-cc/memory": "^0.6.1",
|
|
48
|
+
"@dsh-cc/claude-code-agents": "^0.6.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@deepseek-ai/dsh-agent-loop": "link:../../../../deepseek-harness/packages/core/agent-loop",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"@deepseek-ai/dsh-scope": "link:../../../../deepseek-harness/packages/core/scope",
|
|
65
65
|
"@deepseek-ai/dsh-subagent": "link:../../../../deepseek-harness/packages/subagent/subagent",
|
|
66
66
|
"@deepseek-ai/dsh-system-prompt": "link:../../../../deepseek-harness/packages/core/system-prompt",
|
|
67
|
+
"@dsh-cc/claude-code-agents": "^0.6.1",
|
|
68
|
+
"@dsh-cc/memory": "^0.6.1",
|
|
69
|
+
"@dsh-cc/model-aliases": "^0.6.1",
|
|
70
|
+
"@dsh-cc/subagent-resume-pins": "^0.6.1",
|
|
71
|
+
"@dsh-cc/plugin-loader": "^0.6.1",
|
|
72
|
+
"@dsh-cc/tools": "^0.6.1",
|
|
67
73
|
"@dsh-cc/agent-loop-mock": "^0.1.0",
|
|
68
|
-
"@dsh-cc/
|
|
69
|
-
"@dsh-cc/model-aliases": "^0.6.0",
|
|
70
|
-
"@dsh-cc/subagent-resume-pins": "^0.6.0",
|
|
71
|
-
"@dsh-cc/tools": "^0.6.0",
|
|
72
|
-
"@dsh-cc/memory": "^0.6.0",
|
|
73
|
-
"@dsh-cc/tool-search": "0.6.0",
|
|
74
|
-
"@dsh-cc/plugin-loader": "^0.6.0"
|
|
74
|
+
"@dsh-cc/tool-search": "0.6.1"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|