Commit Graph
8485 Commits
Author SHA1 Message Date
imccyu 9d77a50c23 test(cli): include list_agents in shipped catalog 2026-08-02 12:51:09 +08:00
imccyu b8be3583e0 test(cordis): refresh session origin API snapshot 2026-08-02 12:51:09 +08:00
imccyu 5113b831e8 test(client): align card fixtures with subagent session state 2026-08-02 12:51:09 +08:00
Dudu-0223 8a518e353b feat(web): rewrite subagent conversations for FIFO activation 2026-08-02 12:51:09 +08:00
Dudu-0223 f0ab04273d fix(web): deduplicate subagent navigation 2026-08-02 12:51:09 +08:00
Dudu-0223 16ffd63115 feat(web): add nested subagent conversations 2026-08-02 12:51:09 +08:00
Dudu-0223 a27492507d feat(web): add subagent conversation transport 2026-08-02 12:51:09 +08:00
imccyu 9adfc576da chore(knip): include subagent settlement fixture 2026-08-02 12:51:09 +08:00
Dudu-0223 a977ef30ee fix(subagent): preserve published run failures 2026-08-02 12:51:09 +08:00
Dudu-0223 8b0a7a5d8d fix(subagent): close stacked catalog integration gaps 2026-08-02 12:51:09 +08:00
Dudu-0223 a967f5174a test(snapshot): update unlabeled workflow children 2026-08-02 12:51:09 +08:00
Dudu-0223 03d95d0d84 fix(subagent): keep one-shot labels optional 2026-08-02 12:51:09 +08:00
Dudu-0223 774ee34b9a feat(subagent): catalog one-shot child sessions 2026-08-02 12:51:09 +08:00
Dudu-0223 de6e572e51 fix(subagent): make session query peer optional 2026-08-02 12:51:09 +08:00
Dudu-0223 2e5c439ecf fix(subagent): decouple child listing runtime 2026-08-02 12:51:09 +08:00
Dudu-0223 30b9d0464a fix: address codex review round 3
Recheck the listing cancellation signal after each child inspection settles:
a per-child read failing with a diagnostic-mapped code during an abort
previously bypassed the inspection's own checkpoints, letting a cancelled
single-child scan return a successful result.
2026-08-02 12:51:09 +08:00
Dudu-0223 13631134aa fix: address codex review round 2
- listChildren() checks its cancellation signal before starting the corpus
  trace and immediately after it resolves, so a pre-aborted or trace-time
  abort fails CANCELLED instead of returning a successful empty result.
- Corrected the persistence-repair claims: session query resolves persisted
  candidates through the non-mutating inspect() read, so listing is
  storage-read-only and a torn child tail is surfaced (shorter valid prefix)
  rather than repaired; the Agent Note, README, and JSDoc now state that,
  and the zh pair is re-recorded.
2026-08-02 12:51:09 +08:00
Dudu-0223 4bd98407a9 fix: address codex review round 1
- listChildren() takes an optional AbortSignal and rechecks it after every
  un-signalled session-query await (the cold-resume cooperative-cancellation
  boundary); list_agents forwards exec.signal so the registry's drain of
  started tool bodies cannot block on a slow or large catalog.
- The list_agents description now presents running/complete as a stored-record
  snapshot and defers deliverability to send_message, matching the ownership-
  conflict semantics the service tests pin.
2026-08-02 12:51:09 +08:00
Dudu-0223 8bbae77ae6 docs: regenerate module graph; drop unused devDep 2026-08-02 12:51:09 +08:00
Dudu-0223 4240c7dd7b feat(subagent): durable child catalog and list_agents
Implements the durable-subagent-catalog RFC: SubagentControlService.listChildren()
enumerates a parent's direct continuable children from one sessionQuery trace,
validates each child's sole subagent/descriptor event (now carrying the durable
creation label), and returns one ordered SubagentListEntry[] with per-child
corrupt/unsupported/unavailable diagnostics. The list_agents tool ships as a
separately loadable plugin of dsh-tool-subagent-control requiring sessionQuery
at load; send_message stays usable without it.
2026-08-02 12:51:09 +08:00
Dudu-0223 c7acc8fc6c docs: finalize list_agents RFC contract 2026-08-02 12:51:09 +08:00
Dudu-0223 e63f22f2f1 temp commit 2026-08-02 12:51:09 +08:00
Dudu-0223 ceaef2c3d0 Clarify durable subagent catalog and list_agents behavior 2026-08-02 12:51:09 +08:00
Dudu-0223 fc59b63c8c docs: propose durable subagent catalog 2026-08-02 12:51:09 +08:00
imccyu 7b3920801b fix(subagent): deduplicate activation teardown 2026-08-02 12:51:08 +08:00
imccyu 4d0a24d8ed test(subagent): preserve durability failure after rebase 2026-08-02 12:51:08 +08:00
imccyu 9cd3c57b75 test(subagent): align continuation fixtures with session API 2026-08-02 12:51:08 +08:00
Dudu-0223 f4a65a34e6 cleanup(subagent): hide manager-wide continuation drain 2026-08-02 12:51:08 +08:00
Dudu-0223 191c8cd640 fix(acp): scope connection-owned continuation drain 2026-08-02 12:51:08 +08:00
Dudu-0223 8f3613c4b7 fix(subagent): close final continuation races 2026-08-02 12:51:08 +08:00
Dudu-0223 a91b20f6be fix(subagent): close continuation lifecycle gaps 2026-08-02 12:51:08 +08:00
Dudu-0223 853f4d5cfb refactor(subagent): drop host-user authority and split lifecycle publication
Remove the host-user continuation capability and the public residency query,
then separate the seam's public event payloads from its internal lifecycle
control interfaces.

`followup()` now takes the exact live direct parent `Agent` instead of a
`SubagentAuthority` union. No production adapter ever supplied user authority,
so the `UserAuthorityGrant` brand token existed only to stop a forged
discriminant from bypassing the direct-parent check — deleting the branch
retires the token, its mint method, and that attack surface together.

Narrowing `parent` from `Agent | undefined` to `Agent` removes three special
cases, including the path where a parentless epoch dispatched its lifecycle
events unscoped. Scoped-versus-global dispatch is now decided by the event, not
by whether a caller happened to have a parent.

`activationState()` had no caller; `ActivationState`, `ActivationObserver`, and
`ContinuationHost` are package-private.

New `src/lifecycle.ts` owns the contained emitter, the one-shot run observer,
and the Activation observer, while `SubagentRunInfo`/`SubagentRunEndInfo` move
to `src/types.ts` beside the other consumer-facing contracts. Those payloads are
public API — dsh-jsonrpc, hooks-claude, and the package invariant all consume
them — whereas the observer is a contract between two in-package collaborators,
so they no longer share a home merely for both being lifecycle-shaped. The
service keeps ownership of the scope carrier: `scopeTarget()` composes the
service's own context filter, so a narrowed stand-in would silently change
scope filtering.

Also drops now-unused dsh-tasks-local and dsh-tool-tasks dev dependencies, and
corrects the README claim that a pre-residency failure emits a terminal edge —
that path only ever rethrew.
2026-08-02 12:51:08 +08:00
Dudu-0223 7428cdf41e fix(subagent): address codex review round 3
- Make host-user authority unforgeable. `{ kind: 'user' }` was a bare
  discriminant, so any plugin holding `ctx.subagents` — including
  model-generated cordis_mount code, which the advanced ACP composition ships
  alongside continuable subagents — could construct it and skip the
  direct-parent check for any known child id. It now carries an opaque grant
  that only SubagentService.userAuthority() mints, which composition hands to
  trusted host adapters; a model-facing tool uses parent authority from its own
  execution context.
- Reconcile a delivery discarded inside its own admission window. An enqueue
  listener that cancels fires the discard before followup() returns, so the
  discard listener could not clear an id it had not seen; submit() retained it
  and residency stayed `running` until an explicit drain.
- Recheck the caller signal after materialization. An abort landing between
  publication and inbox acceptance still submitted the prompt and returned both
  ids; it now rolls the child back.
- Stop promising the model transcript access that no shipped continuable config
  mounts. The tools now state only that a background child does not report back.
- Restate the implemented note as shipped state rather than a proposal, so it
  works as current authority.
2026-08-02 12:51:08 +08:00
Dudu-0223 cbaceb73a9 fix(subagent): address codex review round 2
Round 1 traded one teardown ordering problem for another. The observer now
splits capture from emission, which satisfies both consumers at once:

- Terminal facts are captured while the child is still registered, so consumers
  that resolve it for the child's log and scope still work.
- The edge is emitted only after handle disposal settles, so a rejecting scoped
  cleanup is reported as a failed epoch instead of a successful one.

Also:

- Keep the Activation in the map until disposal settles. Removing it first let a
  racing followup() see no Activation and cold-resume into the still-registered
  agent, and let a concurrent forest drain skip a still-disposing child and
  release its parent first.
- Derive terminal telemetry from this epoch's event suffix rather than the whole
  session, so a cold resume whose prompt is blocked no longer reports the
  previous epoch's answer and turn reason.
- Cancel the ACP bridge's own prompts before awaiting the descendant drain: a
  drain can block on persistence, and the top-level agents must not keep running
  model and tool work for its whole duration.
2026-08-02 12:51:08 +08:00
Dudu-0223 c485b6136d fix(subagent): address codex review round 1
All five findings were real:

- The terminal lifecycle edge derived its stop reason from teardown success, so a
  child that errored, hit its token ceiling, or was cancelled reported as
  completed once its checkpoint and disposal succeeded. It now reads the child's
  own last message turn/end, which is authoritative.
- Live delivery never rechecked the caller signal after authorization yielded, so
  an abort that won before acceptance still enqueued the message and returned an
  id. Admission now re-checks at the boundary that owns the decision.
- Drain flushed before cancelling, letting a running turn keep appending events
  the checkpoint could not cover and letting model work continue through a slow
  flush. It now cancels to quiescence first.
- subagent/end fired after AgentHandle.dispose() unregistered the child, so the
  hooks bridge could not resolve it for the child's cwd and scope. The edge now
  publishes while the child is still registered.
- activationState() read Agent.status alone, which stays idle between an accepted
  waking send and the microtask that admits it, so a synchronous inbox observer
  could see settled with a queued turn. Residency now also counts messages this
  manager admitted but has not seen leave the inbox.
2026-08-02 12:51:08 +08:00
Dudu-0223 19d034169e docs: regenerate the config catalog source line
The ACP bridge's new structural teardown type shifts its Config declaration.
2026-08-02 12:51:08 +08:00
Dudu-0223 542a01c407 test(acp): cover the continuable drain ordering and its failure path
Pins that the bridge releases the Activation forest before its own sessions, and
that a failed drain is reported without stranding that teardown. Reads the one
teardown method structurally so the bridge keeps no dependency on the subagent
seam.
2026-08-02 12:51:08 +08:00
Dudu-0223 03973cb074 test(acp-agent): refresh header pins for the new subagent tool wording
Every scenario compares its live tool schemas and system prompt against the
shared header pins, so the Task-free subagent and send_message descriptions
change all 14 pin sidecars. The diff is only that wording plus the tools'
output-type shapes.
2026-08-02 12:51:08 +08:00
Dudu-0223 4435616a04 test(acp-agent): rewrite the continuable snapshot for the Task-free surface
The authored transcript drove task_output, which no longer exists for a
continuable child and is not registered in this config, so the scenario hung.
It now demonstrates the RFC criteria directly: a delegation returning only the
durable subagent id, two send_message follow-ups queueing as later FIFO turns on
one inbox, an unknown id failing without delivery, and child-first disposal
despite a failed final durability checkpoint.

The snapshot-only overlay remaps the transcript's placeholder child id onto the
randomly minted live child, since the scripted model cannot know that id.

Also drops probe logging accidentally committed in cf0138258.
2026-08-02 12:51:08 +08:00
Dudu-0223 c8fbc111db fix(acp): drain continuable subagents before disposing top-level agents
A continuable Activation outlives the turn that started it and owns descendant
teardown, so the bridge must drain that forest child-first before releasing the
top-level agents whose runtime the descendants depend on.

Also rewrites the authored continuable snapshot transcript for the Task-free
tool surface; the scenario's keyless replay is still under diagnosis.
2026-08-02 12:51:08 +08:00
Dudu-0223 3911b7117e test(subagent): reach full continuable coverage and simplify unreachable paths
Adds coverage for the fork-seeded descriptor turn numbering, omitted and declared
descriptor composition fields, a routeless cold resume, and the drain no-op.

Splits materialize's create-versus-resume inputs so the impossible
create-without-meta case disappears, drops the observer's unreachable
pre-residency guard, and annotates the three remaining paths that only a
non-deterministic send-versus-dispose race can reach.
2026-08-02 12:51:08 +08:00
Dudu-0223 bc504195df test(subagent): close continuable coverage and drop unreachable guards
Restores the one-shot settleRun coverage in its own file beside the helper,
covers fork's seed contribution, the post-transfer rollback, the descriptor
model route on cold resume, manager-unload drain, and a failing teardown branch.

Removes three redundant checks the surrounding contracts already own: the
duplicate-Activation and live-id pre-checks (AgentRegistry.enter is the
authoritative collision boundary) and a rollback lifecycle edge that could never
publish because the epoch had no start edge.
2026-08-02 12:51:08 +08:00
Dudu-0223 55f86367ad test(subagent): update in-process specs and pin both durability failure modes
Deletes the in-process durability, resume, and steering tests whose premises the
seam no longer has, keeping a one-shot analogue for agent-option resolution, and
covers both a false and a rejecting final checkpoint in the manager spec.
2026-08-02 12:51:08 +08:00
Dudu-0223 694b078365 docs(subagent): update package READMEs for the activation lifecycle
Rewrites the service API table, authority-versus-provenance contract, residency
routing, and deferred-work list; scopes the in-process driver README to one-shot
runs; and restates both model-facing tools' outputs, which no longer carry a
task id.
2026-08-02 12:51:08 +08:00
Dudu-0223 ae6976cbbd docs(subagent): regenerate catalogs for the activation-based seam
Adds the new continuable types to the cordis-catalog type-link map and
regenerates the cordis api/service/event catalogs, tool catalog, config
catalog, and doc graphs.
2026-08-02 12:51:08 +08:00
Dudu-0223 72f8f47335 docs(subagent): land the continuable-subagents note and supersede its predecessors
Moves the RFC to implemented/, restates it as current-state prose under the
implemented note format, and records what the Task-backed continuable-subagents
note and the two subagent-service simplification notes retain versus what this
record replaces.
2026-08-02 12:51:08 +08:00
Dudu-0223 4e7a5f19cf docs(subagent): rewrite the subagent data-structure doc for activations
wip: Chinese pair and remaining generated catalogs follow.
2026-08-02 12:51:08 +08:00
Dudu-0223 357f317b4c test(subagent): update service, send_message, and delegation specs
The continuable path has no Task, so send_message reports a queued next turn
and continuable delegation returns only the durable child id. Pins that a
follow-up queues behind an open turn rather than steering it, and that a
non-parent caller is rejected.

Also makes startContinuable/followup reject rather than throw synchronously
when continuation services are absent, so callers have one failure mode.
2026-08-02 12:51:08 +08:00
Dudu-0223 1c30548068 test(subagent): rewrite continuation spec for activation lifecycle
Covers the inbox-acceptance return boundary, pre-acceptance rollback,
caller-signal ownership on both sides of acceptance, residency-only routing,
single-inbox FIFO ordering across parent and user origins, waiting wakeup with
a retained handle, cold resume without the historical parent, ownership
registration and release, child-first disposal, send-versus-dispose races,
durability failure without an ownership leak, per-epoch lifecycle pairing, and
the absence of cancellation, steering, and report surfaces.
2026-08-02 12:51:08 +08:00
Dudu-0223 26a117f842 feat(subagent): activation-based continuable subagents (source)
Replace the Task-backed continuation manager with one durable Session plus at
most one process-local Activation — a residency epoch for a reconstructed child
Agent, not a request, result, cancellation, or Task boundary. The manager owns
activation admission, authority, the live ownership graph, cold resume, and
child-first disposal; the Agent inbox is the only turn FIFO.

- startContinuable() is async and returns { childId, messageId } at inbox
  acceptance; followup() takes a SubagentAuthority and returns AgentMessageId.
- SubagentProvider.resume?(), SubagentProviderResumeRequest, SubagentRun.steer?(),
  SubagentProviderStartRequest and SubagentContinuation are deleted;
  prepareContinuable?() is the continuable-creation capability.
- Cold resume calls ctx.agents.resume() from the manager through a private
  activation-owner scope, never dispatching through a provider.
- Extract shared child composition, descriptor seeding, depth accounting, and
  one-shot run settlement so the manager and one-shot driver keep one home
  per fact.

Tests and docs follow in subsequent commits.
2026-08-02 12:51:08 +08:00