hy-sde/dsh-graph--packages-tool-graph ↗★ 0
@hy-sde-org/dsh-tool-graph
Agent Graph supervisor tools: view_agent_graph, update_agent_graph, yield_agent_graph over a host-provided graph controller, with the orchestration:graph prompt section. 适合需要让根会话模型查看、更新和让渡智能体图状态的复杂多智能体编排任务。
インストール
検証済み bundle がないか、互換性チェックに失敗しています。先にリポジトリの説明を読んでください。 README 全文を読む ↗
ドキュメント
README 全文を読む ↗@hy-sde-org/dsh-tool-graph
English | 中文
Summary
dsh-tool-graph is the model-facing tool layer of the Agent Graph (modeled on Maka's stream-graph-supervisor-tools). It contributes exactly three tools — view_agent_graph, update_agent_graph, yield_agent_graph — plus the orchestration:graph prompt section, and the host-side controller they run on. The tools are root-only and direct-only: only the graph's root session may call them, and they address the graph by id instead of delegating work generation to the model.
The host composes the control-store and stream-layer packages, constructs one AgentGraphController, and provides it under the agentGraphController service. The plugin resolves that service with ctx.get; when it is absent the tools still mount (an agent preset never breaks session creation over an optional host assembly) and every graph tool call fails loud with [agent-graph-unavailable] until the host provides the controller. All durable decisions flow through the controller's coordinator, so a tool call commits exactly one store update and never re-runs a provider.
Every model-visible list is bounded with explicit omitted counts, and every update_agent_graph payload is cleaned by Maka's discriminator-tolerant preprocessors before it reaches the store. Source-triple idempotency makes a replayed or retried call a no-op: the same graph/session/key payload commits once and returns the existing row.
Table of Contents
- Use this package
- Understand the implementation
- Further Exploration
- Model Experience
- Known Limitations and Deferred Work
Use this package
import toolGraph, { createAgentGraphController } from '@hy-sde-org/dsh-tool-graph'
import { GraphControlStore } from '@hy-sde-org/dsh-graph-control'
const store = await GraphControlStore.open(unit)
const controller = createAgentGraphController({
store,
rootSessionId: session.id,
newId,
options: { executor, recordSource, maxNewActivations: 4 },
})
ctx.provide('agentGraphController', controller)
await ctx.plugin(toolGraph, {})
Construct exactly one controller per graph root session. The plugin's apply registers the three tools and the prompt section; composing the seed session's agent with the preset that mounts tool-graph makes the tools resolve.
Understand the implementation
- Root-only enforcement: DSH has no
direct_only/nestingtool flag, so the guard lives in the tool body —call.sessionIdmust equal the controller'srootSessionId, otherwisenot_root_session. The identity comes from the live execution context (agent.session.idplus theturnBoundaryprojection'slastTurn). - Run/turn mapping: DSH has no Maka run list, so one tool call maps to the agent-loop turn boundary:
runId = graph_run_andturnId = graph_turn_fromlastTurn, withtoolCallIdfrom the call id. The mapping is documented, not claimed to be Maka-identical. - Idempotency:
graphUpdateIdhashes(graphId, sessionId, runId, turnId, toolCallId); an explicitidempotencyKeyreplaces all three of run/turn/call so a retried identical update in any later turn commits once (created: false, same revision, one store row). - Preprocessors:
cleanUpdateInput/cleanAddWorkInputpick fields by discriminator —targetKindkeeps exactly one ofagentId/subagentId/operatorId,replacementMode: 'none'dropsreplaces, instructions are trimmed. Bounds match Maka: 32 addWork items, 64 input ids, 64 selected results, 60 000 instruction chars, 20 stop targets, 64 finish result ids, 4000 reason chars. - View bounding: live (requested) work pages through an opaque
work:cursor (64 per page); terminal work, stopped targets, records (truncated summaries), and readiness intents are tailed to 64 each with explicitomittedcounts.view_agent_graphis total: an unknown graph returns an empty snapshot. - Wake semantics: the tools never poll —
yield_agent_graphcallsclaimSupervisorWakewhen requested work, live claims, or readiness intents exist, and returnsnothing_to_yieldotherwise. The host drives reconciliation and wakes the root session from the durable wake row.
Further Exploration
- Maka reference:
stream-graph-supervisor-tools.ts.
Model Experience
The model sees three tools and one prompt section (nothing else in this package is model-visible):
view_agent_graph— bounded snapshot of one graph: work statuses, truncated record summaries, readiness intents,omittedcounts, and an opaquenextCursorfor paging live state.update_agent_graph— one durable decision per call: add work (one identity field per item viatargetKind,replacesan existing work id), stop targets, or finish the graph with committed result ids.idempotencyKeymakes retries safe.yield_agent_graph— ends the supervisor turn cooperatively while graph work continues; the host wakes the root session at the next durable checkpoint.orchestration:graphprompt section — instructs the supervisor to yield instead of poll, report outcomes per wave, and never invent work ids.
Known Limitations and Deferred Work
- No graph registry: the store has no create/list graph operations, so
view_agent_graphon an unknown graph returns an empty snapshot rather thanunknown_graph(the error code exists for a future graph registry). - Completed work stays
requested(the stream-layer status model has no terminal work state), soyield_agent_graph.pendingWorkCountcounts requested schedule rows — activity (claims/intents) is reflected by the wake gate, not the count. - The tools accept an explicit
workIdper addWork item (an extension over Maka) so an update can reference its own new work deterministically; deterministically derived ids remain the default. - The plugin is exercised through a hand-built test composition; a Loader-booted cordis.yml composition test is deferred. The intended mount is shown in the dsh-graph-host README: the host row provides the controller and this package mounts as a preset row of the graph root session.