@dsh-cc/subagent-task 0.6.0 → 0.6.2

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.i18n.yaml CHANGED
@@ -1,6 +1,6 @@
1
1
  # Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
- # pnpm run verify-translation-pairing --write packages/subagent/task/README.md
5
- README.md: 2f41225a5a429d06b1c499a0f764797183ce6ab4
6
- README.zh.md: 5388f67d88f9e8bec717ab5cb353e35e962de8b1
4
+ # pnpm check:readme --write
5
+ README.md: d141a9d39756bd366011bb44f00436931504b194
6
+ README.zh.md: 5592ec30d340dc25f2c158f36fb1782c0da4b9c4
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';
@@ -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;AAQ5E,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,YAAY,EACZ,aAAa,GACd,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EACL,+BAA+B,EAC/B,WAAW,EACX,mBAAmB,GACpB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,eAAe,EAAE,YA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
  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;AAEzE,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,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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,104 @@
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
+ /** Legacy event array (removed at the harness 0.1.2-rc.1 line — probed last). */
59
+ events?: readonly {
60
+ type?: string;
61
+ data?: {
62
+ label?: unknown;
63
+ mode?: unknown;
64
+ };
65
+ }[];
66
+ /** Preferred probe: the session's own (non-inherited) event log. */
67
+ ownEvents?: () => readonly unknown[];
68
+ /** Fallback probe: the full snapshot event log. */
69
+ snapshotEvents?: () => readonly unknown[];
70
+ };
71
+ }
72
+ /** Duck-typed `ctx.agents` accessor for child-session parentage probes. */
73
+ export interface LedgerAgents {
74
+ get?(id: string): LedgerChildSnapshot | undefined;
75
+ }
76
+ /** Duck-typed event bus (cordis `ctx.on`) the lifecycle events arrive on. */
77
+ export interface LedgerEventBus {
78
+ on(event: string, listener: (info: Record<string, unknown>) => void): (() => void) | void;
79
+ }
80
+ export interface OneShotLedgerDeps {
81
+ /** The bus the shared listener pair subscribes to. */
82
+ bus: LedgerEventBus;
83
+ /** The live agent registry (`ctx.agents`) used for parentage/label probes. */
84
+ agents?: LedgerAgents | undefined;
85
+ /** Wall clock; defaults to `Date.now`. */
86
+ now?: () => number;
87
+ /** How long an ended row stays queryable. Default 5 minutes. */
88
+ endedTtlMs?: number;
89
+ /** How long a never-ended (active) row stays queryable. Default 60 minutes. */
90
+ activeTtlMs?: number;
91
+ }
92
+ export declare const DEFAULT_ENDED_TTL_MS: number;
93
+ export declare const DEFAULT_ACTIVE_TTL_MS: number;
94
+ /**
95
+ * Create the ledger and attach its shared `subagent/start` / `subagent/end`
96
+ * listener pair to the bus (mirrors `epoch-collector`'s shared-watcher
97
+ * wiring). The returned handle prunes lazily on every read.
98
+ */
99
+ export declare function createOneShotLedger(deps: OneShotLedgerDeps): {
100
+ rows(): readonly OneShotLedgerRow[];
101
+ activeFor(parentId: string): readonly OneShotLedgerRow[];
102
+ dispose(): void;
103
+ };
104
+ //# 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,EAA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CAAA;CACrB;AAED,eAAO,MAAM,oBAAoB,QAAa,CAAA;AAC9C,eAAO,MAAM,qBAAqB,QAAc,CAAA;AAkChD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB,GAAG;IAC5D,IAAI,IAAI,SAAS,gBAAgB,EAAE,CAAA;IACnC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAAA;IACxD,OAAO,IAAI,IAAI,CAAA;CAChB,CA4EA"}
@@ -0,0 +1,152 @@
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 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
+ /**
40
+ * Read the child session's event log through the live harness API:
41
+ * prefer `ownEvents()`, fall back to `snapshotEvents()`, then to the legacy
42
+ * `events` array (removed at the harness 0.1.2-rc.1 line — the old probe
43
+ * read only that dead field, so descriptors NEVER resolved).
44
+ */
45
+ function sessionEvents(session) {
46
+ if (typeof session?.ownEvents === 'function')
47
+ return session.ownEvents();
48
+ if (typeof session?.snapshotEvents === 'function')
49
+ return session.snapshotEvents();
50
+ return session?.events ?? [];
51
+ }
52
+ function resolveDescriptor(child) {
53
+ const event = sessionEvents(child?.session)
54
+ .find(e => e.type === 'subagent/descriptor');
55
+ if (event === undefined)
56
+ return {};
57
+ return {
58
+ ...event.data?.label !== undefined ? { label: String(event.data.label) } : {},
59
+ ...event.data?.mode !== undefined ? { mode: String(event.data.mode) } : {},
60
+ };
61
+ }
62
+ function resolveParentId(child) {
63
+ const parent = child?.session?.header?.parentSession;
64
+ return parent === undefined || parent === null || parent === '' ? undefined : String(parent);
65
+ }
66
+ /**
67
+ * Create the ledger and attach its shared `subagent/start` / `subagent/end`
68
+ * listener pair to the bus (mirrors `epoch-collector`'s shared-watcher
69
+ * wiring). The returned handle prunes lazily on every read.
70
+ */
71
+ export function createOneShotLedger(deps) {
72
+ const now = deps.now ?? Date.now;
73
+ const endedTtlMs = deps.endedTtlMs ?? DEFAULT_ENDED_TTL_MS;
74
+ const activeTtlMs = deps.activeTtlMs ?? DEFAULT_ACTIVE_TTL_MS;
75
+ // Rows the ledger keeps, keyed by runId (one row per epoch).
76
+ const rowsByRunId = new Map();
77
+ const offStart = deps.bus.on('subagent/start', info => {
78
+ const id = String(info.id);
79
+ const child = deps.agents?.get?.(id);
80
+ const descriptor = resolveDescriptor(child);
81
+ const label = descriptor.label;
82
+ const parentId = resolveParentId(child);
83
+ rowsByRunId.set(String(info.runId), {
84
+ runId: String(info.runId),
85
+ id,
86
+ provider: String(info.provider),
87
+ ...label !== undefined ? { label } : {},
88
+ ...parentId !== undefined ? { parentId } : {},
89
+ startedAt: now(),
90
+ internal: label !== undefined && INTERNAL_LABELS.includes(label),
91
+ ...descriptor.mode !== undefined ? { mode: descriptor.mode } : {},
92
+ });
93
+ });
94
+ const offEnd = deps.bus.on('subagent/end', info => {
95
+ const runId = String(info.runId);
96
+ const row = rowsByRunId.get(runId);
97
+ if (row === undefined)
98
+ return; // pruned or never started: a no-op
99
+ row.endedAt = now();
100
+ row.stopReason = String(info.stopReason);
101
+ });
102
+ const prune = () => {
103
+ const t = now();
104
+ for (const [runId, row] of rowsByRunId) {
105
+ if (row.endedAt !== undefined ? t - row.endedAt > endedTtlMs : t - row.startedAt > activeTtlMs) {
106
+ rowsByRunId.delete(runId);
107
+ }
108
+ }
109
+ };
110
+ /**
111
+ * Lazy per-row re-resolution: the in-process driver appends the
112
+ * `subagent/descriptor` inside the child's FIRST pre-step — after
113
+ * `subagent/start` fires — so an insert-time probe legitimately sees
114
+ * nothing. For any row still label-less, re-probe once via `agents.get`;
115
+ * resolved rows are cached (never probed again). A gone child stays
116
+ * unlabeled without error.
117
+ */
118
+ const reResolve = () => {
119
+ if (deps.agents?.get === undefined)
120
+ return;
121
+ for (const row of rowsByRunId.values()) {
122
+ if (row.label !== undefined)
123
+ continue;
124
+ const descriptor = resolveDescriptor(deps.agents.get(row.id));
125
+ if (descriptor.label === undefined)
126
+ continue;
127
+ row.label = descriptor.label;
128
+ if (descriptor.mode !== undefined)
129
+ row.mode = descriptor.mode;
130
+ row.internal = INTERNAL_LABELS.includes(descriptor.label);
131
+ }
132
+ };
133
+ return {
134
+ rows() {
135
+ prune();
136
+ reResolve();
137
+ return [...rowsByRunId.values()];
138
+ },
139
+ activeFor(parentId) {
140
+ prune();
141
+ reResolve();
142
+ return [...rowsByRunId.values()].filter(row => row.parentId === parentId && row.endedAt === undefined
143
+ // Unresolvable parentage is never scoped to any session.
144
+ && row.parentId !== undefined);
145
+ },
146
+ dispose() {
147
+ offStart?.();
148
+ offEnd?.();
149
+ },
150
+ };
151
+ }
152
+ //# 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,eAAe;IACf,gFAAgF;IAChF,kBAAkB;IAClB,sBAAsB;IACtB,0EAA0E;IAC1E,aAAa;IACb,YAAY;CACb,CAAA;AA+DD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAG,MAAM,CAAA;AAC9C,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,GAAG,MAAM,CAAA;AAIhD;;;;;GAKG;AACH,SAAS,aAAa,CAAC,OAAuC;IAC5D,IAAI,OAAO,OAAO,EAAE,SAAS,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC,SAAS,EAAE,CAAA;IACxE,IAAI,OAAO,OAAO,EAAE,cAAc,KAAK,UAAU;QAAE,OAAO,OAAO,CAAC,cAAc,EAAE,CAAA;IAClF,OAAO,OAAO,EAAE,MAAM,IAAI,EAAE,CAAA;AAC9B,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAsC;IAI/D,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC;SACxC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAE,CAAqB,CAAC,IAAI,KAAK,qBAAqB,CAAgC,CAAA;IAClG,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAClC,OAAO;QACL,GAAG,KAAK,CAAC,IAAI,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,SAAS,EAAE,CAAA;YACX,OAAO,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAC5C,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS;gBACtD,yDAAyD;mBACtD,GAAG,CAAC,QAAQ,KAAK,SAAS,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,54 @@
1
+ /**
2
+ * Parent-scoped subagent-child notice (memory-recall hardening follow-ups
3
+ * W2c; addendum 2026-09-10): on `agent/pre-step`, ONLY the agent whose
4
+ * `session.id` matches a ledger row's `parentId` gets one folded
5
+ * observe-only line, contributed by REWRITING the enter decision's message
6
+ * batch (`{...decision, messages: [...decision.messages, notice]}`). The
7
+ * previous `agent.inject()` delivery was wrong twice over: inject queues a
8
+ * DURABLE pending inbox message, and the harness loop re-opens a turn
9
+ * whenever the inbox has pending work at turn end — an idle session woke
10
+ * forever with nothing to do (the phantom-loop bug). A batch append enriches
11
+ * only the current step (pinned by tests/mechanism-pins.spec.ts T1).
12
+ *
13
+ * Dedupe is per agent OBJECT: a WeakMap stores the last appended fold text;
14
+ * an identical fold appends nothing, a changed fold appends again.
15
+ *
16
+ * Registration follows `strip-instructions.ts` / `suppress-settled.ts`: a
17
+ * plain `agent/pre-step` waterfall listener that delegates to `next()`
18
+ * unchanged (observe-only).
19
+ *
20
+ * @module @dsh-cc/subagent-task/one-shot-notice
21
+ */
22
+ import type { Context } from '@deepseek-ai/cordis';
23
+ import type { OneShotLedgerRow } from './one-shot-ledger.ts';
24
+ declare module '@deepseek-ai/dsh-llm' {
25
+ interface MessageSourceMap {
26
+ ccSubagentChild: {
27
+ kind: 'cc-subagent-children';
28
+ };
29
+ }
30
+ }
31
+ /** MessageSourceMap kind for the observe-only child notice. */
32
+ export declare const CHILD_NOTICE_SOURCE_KIND = "cc-subagent-children";
33
+ /**
34
+ * Fold the active children of one parent into the single observe-only line.
35
+ * Non-internal children surface their labels; internal children fold into a
36
+ * bare count (`… +N internal`), and internal-only activity yields a count
37
+ * line with no per-child rows at all.
38
+ */
39
+ export declare function foldChildNotice(rows: readonly {
40
+ label?: string;
41
+ internal: boolean;
42
+ }[]): string;
43
+ /** The ledger surface the notice listener reads. */
44
+ export interface ChildNoticeLedger {
45
+ activeFor(parentId: string): readonly OneShotLedgerRow[];
46
+ }
47
+ /**
48
+ * Mount the `agent/pre-step` child-notice listener.
49
+ * @param ctx - the plug context.
50
+ * @param ledger - the ledger to read.
51
+ * @returns an unmount callback.
52
+ */
53
+ export declare function mountSubagentChildNotice(ctx: Context, ledger: ChildNoticeLedger): () => void;
54
+ //# 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;;;;;;;;;;;;;;;;;;;;GAoBG;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,CA8B5F"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Parent-scoped subagent-child notice (memory-recall hardening follow-ups
3
+ * W2c; addendum 2026-09-10): on `agent/pre-step`, ONLY the agent whose
4
+ * `session.id` matches a ledger row's `parentId` gets one folded
5
+ * observe-only line, contributed by REWRITING the enter decision's message
6
+ * batch (`{...decision, messages: [...decision.messages, notice]}`). The
7
+ * previous `agent.inject()` delivery was wrong twice over: inject queues a
8
+ * DURABLE pending inbox message, and the harness loop re-opens a turn
9
+ * whenever the inbox has pending work at turn end — an idle session woke
10
+ * forever with nothing to do (the phantom-loop bug). A batch append enriches
11
+ * only the current step (pinned by tests/mechanism-pins.spec.ts T1).
12
+ *
13
+ * Dedupe is per agent OBJECT: a WeakMap stores the last appended fold text;
14
+ * an identical fold appends nothing, a changed fold appends again.
15
+ *
16
+ * Registration follows `strip-instructions.ts` / `suppress-settled.ts`: a
17
+ * plain `agent/pre-step` waterfall listener that delegates to `next()`
18
+ * unchanged (observe-only).
19
+ *
20
+ * @module @dsh-cc/subagent-task/one-shot-notice
21
+ */
22
+ import { createUserMessage } from '@deepseek-ai/dsh-llm';
23
+ /** MessageSourceMap kind for the observe-only child notice. */
24
+ export const CHILD_NOTICE_SOURCE_KIND = 'cc-subagent-children';
25
+ /**
26
+ * Fold the active children of one parent into the single observe-only line.
27
+ * Non-internal children surface their labels; internal children fold into a
28
+ * bare count (`… +N internal`), and internal-only activity yields a count
29
+ * line with no per-child rows at all.
30
+ */
31
+ export function foldChildNotice(rows) {
32
+ const visible = rows.filter(row => !row.internal);
33
+ const internalCount = rows.length - visible.length;
34
+ if (visible.length === 0 && internalCount === 0)
35
+ return '';
36
+ const parts = [];
37
+ if (visible.length > 0) {
38
+ const labels = visible.map(row => row.label ?? 'unlabeled');
39
+ parts.push(`${visible.length} active subagent child${visible.length === 1 ? '' : 'ren'}: ${labels.join(', ')}`);
40
+ }
41
+ if (internalCount > 0)
42
+ parts.push(`+${internalCount} internal`);
43
+ return `[observe] ${parts.join(' ')}`.trim();
44
+ }
45
+ /**
46
+ * Mount the `agent/pre-step` child-notice listener.
47
+ * @param ctx - the plug context.
48
+ * @param ledger - the ledger to read.
49
+ * @returns an unmount callback.
50
+ */
51
+ export function mountSubagentChildNotice(ctx, ledger) {
52
+ // Last appended fold text per agent object (dedupe across pre-steps).
53
+ const lastNotice = new WeakMap();
54
+ return ctx.on('agent/pre-step', async ({ agent }, next) => {
55
+ const decision = await next();
56
+ // Fire-and-forget: the notice is model-visible enrichment, never worth
57
+ // an unhandled rejection in the host.
58
+ try {
59
+ const sid = agent.session?.id;
60
+ if (sid === undefined)
61
+ return decision;
62
+ const active = ledger.activeFor(String(sid));
63
+ const text = foldChildNotice(active);
64
+ // Never append an empty fold; never re-append an unchanged fold. The
65
+ // memo updates only on an actual append, so a fold skipped by a
66
+ // non-enter decision is retried on the next enter.
67
+ if (text === '' || lastNotice.get(agent) === text)
68
+ return decision;
69
+ if (decision.kind !== 'enter')
70
+ return decision;
71
+ lastNotice.set(agent, text);
72
+ return {
73
+ ...decision,
74
+ messages: [...decision.messages, createUserMessage({
75
+ content: [{ type: 'text', text }],
76
+ source: { kind: 'cc-subagent-children' },
77
+ })],
78
+ };
79
+ }
80
+ catch {
81
+ // Absent llm seam or decision surface: skip quietly.
82
+ }
83
+ return decision;
84
+ });
85
+ }
86
+ //# sourceMappingURL=one-shot-notice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"one-shot-notice.js","sourceRoot":"","sources":["../src/one-shot-notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AASxD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,wBAAwB,GAAG,s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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,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;YACpC,qEAAqE;YACrE,gEAAgE;YAChE,mDAAmD;YACnD,IAAI,IAAI,KAAK,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI;gBAAE,OAAO,QAAQ,CAAA;YAClE,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO;gBAAE,OAAO,QAAQ,CAAA;YAC9C,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAC3B,OAAO;gBACL,GAAG,QAAQ;gBACX,QAAQ,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;wBACjD,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;wBACjC,MAAM,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE;qBACzC,CAAC,CAAC;aACJ,CAAA;QACH,CAAC;QAAC,MAAM,CAAC;YACP,qDAAqD;QACvD,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.0",
4
+ "version": "0.6.2",
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/claude-code-agents": "^0.6.0",
45
- "@dsh-cc/model-aliases": "^0.6.0",
46
- "@dsh-cc/memory": "^0.6.0",
47
- "@dsh-cc/subagent-resume-pins": "^0.6.0",
48
- "@dsh-cc/tools": "^0.6.0"
44
+ "@dsh-cc/claude-code-agents": "^0.6.2",
45
+ "@dsh-cc/memory": "^0.6.2",
46
+ "@dsh-cc/model-aliases": "^0.6.2",
47
+ "@dsh-cc/subagent-resume-pins": "^0.6.2",
48
+ "@dsh-cc/tools": "^0.6.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@deepseek-ai/dsh-agent-loop": "link:../../../../deepseek-harness/packages/core/agent-loop",
@@ -65,13 +65,13 @@
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
67
  "@dsh-cc/agent-loop-mock": "^0.1.0",
68
- "@dsh-cc/claude-code-agents": "^0.6.0",
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"
68
+ "@dsh-cc/memory": "^0.6.2",
69
+ "@dsh-cc/model-aliases": "^0.6.2",
70
+ "@dsh-cc/claude-code-agents": "^0.6.2",
71
+ "@dsh-cc/subagent-resume-pins": "^0.6.2",
72
+ "@dsh-cc/tools": "^0.6.2",
73
+ "@dsh-cc/plugin-loader": "^0.6.2",
74
+ "@dsh-cc/tool-search": "0.6.2"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"