feat(invariants): require package-owned companions

This commit is contained in:
Tianyi Cui
2026-07-19 22:13:50 +08:00
parent 2c7822ddee
commit 433670a754
316 changed files with 5348 additions and 646 deletions
+1 -1
View File
@@ -396,7 +396,7 @@ export interface Config {
} }
``` ```
Source: [`packages/support/invariants/src/index.ts:15`](../packages/support/invariants/src/index.ts) Source: [`packages/support/invariants/src/index.ts:16`](../packages/support/invariants/src/index.ts)
## `@deepseek-ai/dsh-jsonrpc` ## `@deepseek-ai/dsh-jsonrpc`
+1 -1
View File
@@ -495,7 +495,7 @@ Package-owned invariant registry with global and regex-based selection.
register(packageName: string, installer: InvariantInstaller): () => void register(packageName: string, installer: InvariantInstaller): () => void
``` ```
Source: [`packages/support/invariants/src/index.ts:94`](../../packages/support/invariants/src/index.ts) Source: [`packages/support/invariants/src/index.ts:95`](../../packages/support/invariants/src/index.ts)
## `ctx.llm` — `LlmService` ## `ctx.llm` — `LlmService`
+1 -1
View File
@@ -502,7 +502,7 @@ interface TurnEndReasonMap {
## The turn-enclosure invariant ## The turn-enclosure invariant
Every session event lives **inside** a turn (between a `turn/start` and its `turn/end`). The loop appends queued `user/message` events *after* `turn/start`, and an idle `agent.inject()` wraps its `context/message` in a one-shot `injection` turn. This makes the turn the single durability/replay boundary: a backend can treat anything after the last `turn/end` as an interrupted-crash tail without risking the loss of legitimately-recorded between-turn context. The optional `dsh-session/invariant` companion enforces it in dev through `ctx.invariants` (a message event outside an open turn throws). See [the turn-enclosure invariant RFC](../rfc/implemented/architecture/2026-06-15-turn-enclosure-invariant.md). Every session event lives **inside** a turn (between a `turn/start` and its `turn/end`). The loop appends queued `user/message` events *after* `turn/start`, and an idle `agent.inject()` wraps its `context/message` in a one-shot `injection` turn. This makes the turn the single durability/replay boundary: a backend can treat anything after the last `turn/end` as an interrupted-crash tail without risking the loss of legitimately-recorded between-turn context. The `dsh-session/invariant` companion enforces it when selected through `ctx.invariants` (a message event outside an open turn throws). See [the turn-enclosure invariant RFC](../rfc/implemented/architecture/2026-06-15-turn-enclosure-invariant.md).
## Plugin-contributed log-only events ## Plugin-contributed log-only events
+167 -84
View File
@@ -150,23 +150,46 @@ flowchart TD
pkg_workflow["workflow"] pkg_workflow["workflow"]
pkg_workflow_workerthread["workflow-workerthread"] pkg_workflow_workerthread["workflow-workerthread"]
end end
pkg_llm --> pkg_brand pkg_brand --> pkg_invariants
pkg_home --> pkg_invariants
pkg_paths --> pkg_invariants
pkg_retention --> pkg_invariants
pkg_timeout --> pkg_invariants
pkg_scope --> pkg_invariants pkg_scope --> pkg_invariants
pkg_skill --> pkg_invariants
pkg_subagent_subprocess --> pkg_invariants
pkg_acp_snapshot --> pkg_invariants
pkg_loader_smoke --> pkg_invariants
pkg_app_boot --> pkg_invariants
pkg_code_runtime --> pkg_invariants
pkg_jsonrpc_demo --> pkg_invariants
pkg_llm --> pkg_brand
pkg_llm --> pkg_invariants
pkg_code_runtime_worker --> pkg_code_runtime pkg_code_runtime_worker --> pkg_code_runtime
pkg_code_runtime_worker --> pkg_invariants
pkg_helper --> pkg_brand pkg_helper --> pkg_brand
pkg_helper --> pkg_invariants
pkg_scripts --> pkg_app_boot pkg_scripts --> pkg_app_boot
pkg_scripts --> pkg_invariants
pkg_llm_deepseek --> pkg_invariants
pkg_llm_deepseek --> pkg_llm pkg_llm_deepseek --> pkg_llm
pkg_llm_pi_ai --> pkg_invariants
pkg_llm_pi_ai --> pkg_llm pkg_llm_pi_ai --> pkg_llm
pkg_session --> pkg_brand pkg_session --> pkg_brand
pkg_session --> pkg_invariants pkg_session --> pkg_invariants
pkg_session --> pkg_llm pkg_session --> pkg_llm
pkg_session --> pkg_scope pkg_session --> pkg_scope
pkg_system_prompt --> pkg_invariants
pkg_system_prompt --> pkg_llm pkg_system_prompt --> pkg_llm
pkg_system_prompt --> pkg_scope pkg_system_prompt --> pkg_scope
pkg_fs --> pkg_brand pkg_fs --> pkg_brand
pkg_fs --> pkg_invariants
pkg_fs --> pkg_llm pkg_fs --> pkg_llm
pkg_web --> pkg_invariants
pkg_web --> pkg_llm pkg_web --> pkg_llm
pkg_sandbox --> pkg_invariants
pkg_sandbox --> pkg_llm pkg_sandbox --> pkg_llm
pkg_token_meter --> pkg_invariants
pkg_token_meter --> pkg_llm pkg_token_meter --> pkg_llm
pkg_token_meter --> pkg_session pkg_token_meter --> pkg_session
pkg_agent --> pkg_brand pkg_agent --> pkg_brand
@@ -175,64 +198,90 @@ flowchart TD
pkg_agent --> pkg_scope pkg_agent --> pkg_scope
pkg_agent --> pkg_session pkg_agent --> pkg_session
pkg_agent --> pkg_system_prompt pkg_agent --> pkg_system_prompt
pkg_bash --> pkg_invariants
pkg_bash --> pkg_sandbox pkg_bash --> pkg_sandbox
pkg_bash --> pkg_session pkg_bash --> pkg_session
pkg_fs_local --> pkg_fs pkg_fs_local --> pkg_fs
pkg_fs_local --> pkg_invariants
pkg_fs_policy --> pkg_fs pkg_fs_policy --> pkg_fs
pkg_fs_policy --> pkg_invariants
pkg_skill_local --> pkg_fs pkg_skill_local --> pkg_fs
pkg_skill_local --> pkg_home pkg_skill_local --> pkg_home
pkg_skill_local --> pkg_invariants
pkg_skill_local --> pkg_skill pkg_skill_local --> pkg_skill
pkg_compact --> pkg_invariants
pkg_compact --> pkg_llm pkg_compact --> pkg_llm
pkg_compact --> pkg_session pkg_compact --> pkg_session
pkg_web_fetch_local --> pkg_invariants
pkg_web_fetch_local --> pkg_timeout pkg_web_fetch_local --> pkg_timeout
pkg_web_fetch_local --> pkg_web pkg_web_fetch_local --> pkg_web
pkg_web_search_deepseek --> pkg_invariants
pkg_web_search_deepseek --> pkg_web pkg_web_search_deepseek --> pkg_web
pkg_web_search_exa --> pkg_invariants
pkg_web_search_exa --> pkg_web pkg_web_search_exa --> pkg_web
pkg_web_search_perplexity --> pkg_invariants
pkg_web_search_perplexity --> pkg_web pkg_web_search_perplexity --> pkg_web
pkg_spill --> pkg_brand pkg_spill --> pkg_brand
pkg_spill --> pkg_invariants
pkg_spill --> pkg_llm pkg_spill --> pkg_llm
pkg_spill --> pkg_session pkg_spill --> pkg_session
pkg_session_persistence --> pkg_invariants
pkg_session_persistence --> pkg_session pkg_session_persistence --> pkg_session
pkg_llm_replay --> pkg_invariants
pkg_llm_replay --> pkg_llm pkg_llm_replay --> pkg_llm
pkg_llm_replay --> pkg_session pkg_llm_replay --> pkg_session
pkg_sandbox_local --> pkg_invariants
pkg_sandbox_local --> pkg_llm pkg_sandbox_local --> pkg_llm
pkg_sandbox_local --> pkg_sandbox pkg_sandbox_local --> pkg_sandbox
pkg_bash_local --> pkg_bash pkg_bash_local --> pkg_bash
pkg_bash_local --> pkg_invariants
pkg_bash_local --> pkg_timeout pkg_bash_local --> pkg_timeout
pkg_compact_basic --> pkg_agent pkg_compact_basic --> pkg_agent
pkg_compact_basic --> pkg_compact pkg_compact_basic --> pkg_compact
pkg_compact_basic --> pkg_invariants
pkg_compact_basic --> pkg_llm pkg_compact_basic --> pkg_llm
pkg_compact_basic --> pkg_session pkg_compact_basic --> pkg_session
pkg_compact_basic --> pkg_token_meter pkg_compact_basic --> pkg_token_meter
pkg_spill_local --> pkg_invariants
pkg_spill_local --> pkg_spill pkg_spill_local --> pkg_spill
pkg_hook_protocol --> pkg_bash pkg_hook_protocol --> pkg_bash
pkg_hook_protocol --> pkg_invariants
pkg_hook_protocol --> pkg_session pkg_hook_protocol --> pkg_session
pkg_session_persistence_jsonl --> pkg_invariants
pkg_session_persistence_jsonl --> pkg_session pkg_session_persistence_jsonl --> pkg_session
pkg_session_persistence_jsonl --> pkg_session_persistence pkg_session_persistence_jsonl --> pkg_session_persistence
pkg_session_persistence_sqlite --> pkg_invariants
pkg_session_persistence_sqlite --> pkg_session pkg_session_persistence_sqlite --> pkg_session
pkg_session_persistence_sqlite --> pkg_session_persistence pkg_session_persistence_sqlite --> pkg_session_persistence
pkg_session_query --> pkg_invariants
pkg_session_query --> pkg_llm pkg_session_query --> pkg_llm
pkg_session_query --> pkg_session pkg_session_query --> pkg_session
pkg_session_query --> pkg_session_persistence pkg_session_query --> pkg_session_persistence
pkg_user_approval --> pkg_agent pkg_user_approval --> pkg_agent
pkg_user_approval --> pkg_brand pkg_user_approval --> pkg_brand
pkg_user_approval --> pkg_invariants
pkg_user_approval --> pkg_llm pkg_user_approval --> pkg_llm
pkg_user_approval --> pkg_scope pkg_user_approval --> pkg_scope
pkg_user_approval --> pkg_session pkg_user_approval --> pkg_session
pkg_user_approval --> pkg_system_prompt pkg_user_approval --> pkg_system_prompt
pkg_user_interaction --> pkg_agent pkg_user_interaction --> pkg_agent
pkg_user_interaction --> pkg_invariants
pkg_user_interaction --> pkg_llm pkg_user_interaction --> pkg_llm
pkg_time_context --> pkg_agent pkg_time_context --> pkg_agent
pkg_time_context --> pkg_invariants
pkg_tasks --> pkg_agent pkg_tasks --> pkg_agent
pkg_tasks --> pkg_brand pkg_tasks --> pkg_brand
pkg_tasks --> pkg_invariants
pkg_tasks --> pkg_session pkg_tasks --> pkg_session
pkg_tasks --> pkg_timeout pkg_tasks --> pkg_timeout
pkg_workflow --> pkg_agent pkg_workflow --> pkg_agent
pkg_workflow --> pkg_brand pkg_workflow --> pkg_brand
pkg_workflow --> pkg_invariants
pkg_workflow --> pkg_llm pkg_workflow --> pkg_llm
pkg_workflow --> pkg_session pkg_workflow --> pkg_session
pkg_tools --> pkg_agent pkg_tools --> pkg_agent
pkg_tools --> pkg_code_runtime pkg_tools --> pkg_code_runtime
pkg_tools --> pkg_invariants
pkg_tools --> pkg_llm pkg_tools --> pkg_llm
pkg_tools --> pkg_scope pkg_tools --> pkg_scope
pkg_tools --> pkg_session pkg_tools --> pkg_session
@@ -240,8 +289,10 @@ flowchart TD
pkg_tools --> pkg_user_approval pkg_tools --> pkg_user_approval
pkg_bash_sandbox --> pkg_bash pkg_bash_sandbox --> pkg_bash
pkg_bash_sandbox --> pkg_bash_local pkg_bash_sandbox --> pkg_bash_local
pkg_bash_sandbox --> pkg_invariants
pkg_bash_sandbox --> pkg_sandbox pkg_bash_sandbox --> pkg_sandbox
pkg_permission --> pkg_bash pkg_permission --> pkg_bash
pkg_permission --> pkg_invariants
pkg_permission --> pkg_sandbox pkg_permission --> pkg_sandbox
pkg_permission --> pkg_session pkg_permission --> pkg_session
pkg_permission --> pkg_user_approval pkg_permission --> pkg_user_approval
@@ -256,6 +307,7 @@ flowchart TD
pkg_tool_bash --> pkg_agent pkg_tool_bash --> pkg_agent
pkg_tool_bash --> pkg_bash pkg_tool_bash --> pkg_bash
pkg_tool_bash --> pkg_home pkg_tool_bash --> pkg_home
pkg_tool_bash --> pkg_invariants
pkg_tool_bash --> pkg_llm pkg_tool_bash --> pkg_llm
pkg_tool_bash --> pkg_sandbox pkg_tool_bash --> pkg_sandbox
pkg_tool_bash --> pkg_session_persistence pkg_tool_bash --> pkg_session_persistence
@@ -264,11 +316,13 @@ flowchart TD
pkg_tool_bash --> pkg_tools pkg_tool_bash --> pkg_tools
pkg_tool_bash --> pkg_user_approval pkg_tool_bash --> pkg_user_approval
pkg_tool_fs --> pkg_fs pkg_tool_fs --> pkg_fs
pkg_tool_fs --> pkg_invariants
pkg_tool_fs --> pkg_llm pkg_tool_fs --> pkg_llm
pkg_tool_fs --> pkg_session pkg_tool_fs --> pkg_session
pkg_tool_fs --> pkg_system_prompt pkg_tool_fs --> pkg_system_prompt
pkg_tool_fs --> pkg_tools pkg_tool_fs --> pkg_tools
pkg_tool_fs_search --> pkg_bash pkg_tool_fs_search --> pkg_bash
pkg_tool_fs_search --> pkg_invariants
pkg_tool_fs_search --> pkg_llm pkg_tool_fs_search --> pkg_llm
pkg_tool_fs_search --> pkg_retention pkg_tool_fs_search --> pkg_retention
pkg_tool_fs_search --> pkg_session pkg_tool_fs_search --> pkg_session
@@ -276,45 +330,55 @@ flowchart TD
pkg_tool_fs_search --> pkg_system_prompt pkg_tool_fs_search --> pkg_system_prompt
pkg_tool_fs_search --> pkg_tools pkg_tool_fs_search --> pkg_tools
pkg_tool_skill --> pkg_agent pkg_tool_skill --> pkg_agent
pkg_tool_skill --> pkg_invariants
pkg_tool_skill --> pkg_llm pkg_tool_skill --> pkg_llm
pkg_tool_skill --> pkg_skill pkg_tool_skill --> pkg_skill
pkg_tool_skill --> pkg_tools pkg_tool_skill --> pkg_tools
pkg_subagent --> pkg_agent pkg_subagent --> pkg_agent
pkg_subagent --> pkg_brand pkg_subagent --> pkg_brand
pkg_subagent --> pkg_invariants
pkg_subagent --> pkg_llm pkg_subagent --> pkg_llm
pkg_subagent --> pkg_scope pkg_subagent --> pkg_scope
pkg_subagent --> pkg_session pkg_subagent --> pkg_session
pkg_subagent --> pkg_tools pkg_subagent --> pkg_tools
pkg_tool_web --> pkg_invariants
pkg_tool_web --> pkg_llm pkg_tool_web --> pkg_llm
pkg_tool_web --> pkg_system_prompt pkg_tool_web --> pkg_system_prompt
pkg_tool_web --> pkg_tools pkg_tool_web --> pkg_tools
pkg_tool_web --> pkg_web pkg_tool_web --> pkg_web
pkg_spill_policy --> pkg_invariants
pkg_spill_policy --> pkg_llm pkg_spill_policy --> pkg_llm
pkg_spill_policy --> pkg_retention pkg_spill_policy --> pkg_retention
pkg_spill_policy --> pkg_session pkg_spill_policy --> pkg_session
pkg_spill_policy --> pkg_spill pkg_spill_policy --> pkg_spill
pkg_spill_policy --> pkg_tools pkg_spill_policy --> pkg_tools
pkg_timeout_policy --> pkg_invariants
pkg_timeout_policy --> pkg_llm pkg_timeout_policy --> pkg_llm
pkg_timeout_policy --> pkg_timeout pkg_timeout_policy --> pkg_timeout
pkg_timeout_policy --> pkg_tools pkg_timeout_policy --> pkg_tools
pkg_tool_todo --> pkg_agent pkg_tool_todo --> pkg_agent
pkg_tool_todo --> pkg_invariants
pkg_tool_todo --> pkg_session pkg_tool_todo --> pkg_session
pkg_tool_todo --> pkg_tools pkg_tool_todo --> pkg_tools
pkg_tool_cordis --> pkg_invariants
pkg_tool_cordis --> pkg_scope pkg_tool_cordis --> pkg_scope
pkg_tool_cordis --> pkg_tools pkg_tool_cordis --> pkg_tools
pkg_hooks_codex --> pkg_agent pkg_hooks_codex --> pkg_agent
pkg_hooks_codex --> pkg_hook_protocol pkg_hooks_codex --> pkg_hook_protocol
pkg_hooks_codex --> pkg_invariants
pkg_hooks_codex --> pkg_llm pkg_hooks_codex --> pkg_llm
pkg_hooks_codex --> pkg_session pkg_hooks_codex --> pkg_session
pkg_hooks_codex --> pkg_session_persistence pkg_hooks_codex --> pkg_session_persistence
pkg_hooks_codex --> pkg_tools pkg_hooks_codex --> pkg_tools
pkg_agent_loop_testkit --> pkg_agent pkg_agent_loop_testkit --> pkg_agent
pkg_agent_loop_testkit --> pkg_invariants
pkg_agent_loop_testkit --> pkg_llm pkg_agent_loop_testkit --> pkg_llm
pkg_agent_loop_testkit --> pkg_session pkg_agent_loop_testkit --> pkg_session
pkg_agent_loop_testkit --> pkg_system_prompt pkg_agent_loop_testkit --> pkg_system_prompt
pkg_agent_loop_testkit --> pkg_tools pkg_agent_loop_testkit --> pkg_tools
pkg_acp --> pkg_agent pkg_acp --> pkg_agent
pkg_acp --> pkg_bash pkg_acp --> pkg_bash
pkg_acp --> pkg_invariants
pkg_acp --> pkg_llm pkg_acp --> pkg_llm
pkg_acp --> pkg_permission pkg_acp --> pkg_permission
pkg_acp --> pkg_sandbox pkg_acp --> pkg_sandbox
@@ -325,51 +389,62 @@ flowchart TD
pkg_acp --> pkg_user_approval pkg_acp --> pkg_user_approval
pkg_acp --> pkg_user_interaction pkg_acp --> pkg_user_interaction
pkg_tool_ask_user --> pkg_agent pkg_tool_ask_user --> pkg_agent
pkg_tool_ask_user --> pkg_invariants
pkg_tool_ask_user --> pkg_tools pkg_tool_ask_user --> pkg_tools
pkg_tool_ask_user --> pkg_user_interaction pkg_tool_ask_user --> pkg_user_interaction
pkg_workspace_context --> pkg_agent pkg_workspace_context --> pkg_agent
pkg_workspace_context --> pkg_fs pkg_workspace_context --> pkg_fs
pkg_workspace_context --> pkg_invariants
pkg_workspace_context --> pkg_llm pkg_workspace_context --> pkg_llm
pkg_workspace_context --> pkg_paths pkg_workspace_context --> pkg_paths
pkg_workspace_context --> pkg_session pkg_workspace_context --> pkg_session
pkg_workspace_context --> pkg_tools pkg_workspace_context --> pkg_tools
pkg_repeat_tool_guard --> pkg_agent pkg_repeat_tool_guard --> pkg_agent
pkg_repeat_tool_guard --> pkg_invariants
pkg_repeat_tool_guard --> pkg_tools pkg_repeat_tool_guard --> pkg_tools
pkg_mcp_client --> pkg_invariants
pkg_mcp_client --> pkg_llm pkg_mcp_client --> pkg_llm
pkg_mcp_client --> pkg_tools pkg_mcp_client --> pkg_tools
pkg_tool_tasks --> pkg_agent pkg_tool_tasks --> pkg_agent
pkg_tool_tasks --> pkg_invariants
pkg_tool_tasks --> pkg_system_prompt pkg_tool_tasks --> pkg_system_prompt
pkg_tool_tasks --> pkg_tasks pkg_tool_tasks --> pkg_tasks
pkg_tool_tasks --> pkg_tools pkg_tool_tasks --> pkg_tools
pkg_tool_workflow --> pkg_agent pkg_tool_workflow --> pkg_agent
pkg_tool_workflow --> pkg_invariants
pkg_tool_workflow --> pkg_llm pkg_tool_workflow --> pkg_llm
pkg_tool_workflow --> pkg_system_prompt pkg_tool_workflow --> pkg_system_prompt
pkg_tool_workflow --> pkg_tools pkg_tool_workflow --> pkg_tools
pkg_tool_workflow --> pkg_workflow pkg_tool_workflow --> pkg_workflow
pkg_subagent_acp --> pkg_agent pkg_subagent_acp --> pkg_agent
pkg_subagent_acp --> pkg_invariants
pkg_subagent_acp --> pkg_llm pkg_subagent_acp --> pkg_llm
pkg_subagent_acp --> pkg_session pkg_subagent_acp --> pkg_session
pkg_subagent_acp --> pkg_subagent pkg_subagent_acp --> pkg_subagent
pkg_subagent_acp --> pkg_subagent_subprocess pkg_subagent_acp --> pkg_subagent_subprocess
pkg_subagent_inprocess --> pkg_agent pkg_subagent_inprocess --> pkg_agent
pkg_subagent_inprocess --> pkg_invariants
pkg_subagent_inprocess --> pkg_llm pkg_subagent_inprocess --> pkg_llm
pkg_subagent_inprocess --> pkg_session pkg_subagent_inprocess --> pkg_session
pkg_subagent_inprocess --> pkg_subagent pkg_subagent_inprocess --> pkg_subagent
pkg_subagent_inprocess --> pkg_system_prompt pkg_subagent_inprocess --> pkg_system_prompt
pkg_subagent_inprocess --> pkg_tools pkg_subagent_inprocess --> pkg_tools
pkg_tool_subagent --> pkg_agent pkg_tool_subagent --> pkg_agent
pkg_tool_subagent --> pkg_invariants
pkg_tool_subagent --> pkg_llm pkg_tool_subagent --> pkg_llm
pkg_tool_subagent --> pkg_subagent pkg_tool_subagent --> pkg_subagent
pkg_tool_subagent --> pkg_tasks pkg_tool_subagent --> pkg_tasks
pkg_tool_subagent --> pkg_tools pkg_tool_subagent --> pkg_tools
pkg_hooks_claude --> pkg_agent pkg_hooks_claude --> pkg_agent
pkg_hooks_claude --> pkg_hook_protocol pkg_hooks_claude --> pkg_hook_protocol
pkg_hooks_claude --> pkg_invariants
pkg_hooks_claude --> pkg_llm pkg_hooks_claude --> pkg_llm
pkg_hooks_claude --> pkg_session pkg_hooks_claude --> pkg_session
pkg_hooks_claude --> pkg_session_persistence pkg_hooks_claude --> pkg_session_persistence
pkg_hooks_claude --> pkg_subagent pkg_hooks_claude --> pkg_subagent
pkg_hooks_claude --> pkg_tools pkg_hooks_claude --> pkg_tools
pkg_jsonrpc --> pkg_agent pkg_jsonrpc --> pkg_agent
pkg_jsonrpc --> pkg_invariants
pkg_jsonrpc --> pkg_llm pkg_jsonrpc --> pkg_llm
pkg_jsonrpc --> pkg_llm_deepseek pkg_jsonrpc --> pkg_llm_deepseek
pkg_jsonrpc --> pkg_scope pkg_jsonrpc --> pkg_scope
@@ -377,11 +452,13 @@ flowchart TD
pkg_jsonrpc --> pkg_subagent pkg_jsonrpc --> pkg_subagent
pkg_stdio --> pkg_agent pkg_stdio --> pkg_agent
pkg_stdio --> pkg_agent_loop pkg_stdio --> pkg_agent_loop
pkg_stdio --> pkg_invariants
pkg_stdio --> pkg_llm pkg_stdio --> pkg_llm
pkg_stdio --> pkg_session pkg_stdio --> pkg_session
pkg_stdio --> pkg_user_interaction pkg_stdio --> pkg_user_interaction
pkg_tui --> pkg_agent pkg_tui --> pkg_agent
pkg_tui --> pkg_agent_loop pkg_tui --> pkg_agent_loop
pkg_tui --> pkg_invariants
pkg_tui --> pkg_llm pkg_tui --> pkg_llm
pkg_tui --> pkg_session pkg_tui --> pkg_session
pkg_tui --> pkg_tools pkg_tui --> pkg_tools
@@ -404,20 +481,24 @@ flowchart TD
pkg_agent_spine_demo --> pkg_workspace_context pkg_agent_spine_demo --> pkg_workspace_context
pkg_workflow_workerthread --> pkg_agent pkg_workflow_workerthread --> pkg_agent
pkg_workflow_workerthread --> pkg_brand pkg_workflow_workerthread --> pkg_brand
pkg_workflow_workerthread --> pkg_invariants
pkg_workflow_workerthread --> pkg_llm pkg_workflow_workerthread --> pkg_llm
pkg_workflow_workerthread --> pkg_session pkg_workflow_workerthread --> pkg_session
pkg_workflow_workerthread --> pkg_subagent pkg_workflow_workerthread --> pkg_subagent
pkg_workflow_workerthread --> pkg_tools pkg_workflow_workerthread --> pkg_tools
pkg_workflow_workerthread --> pkg_workflow pkg_workflow_workerthread --> pkg_workflow
pkg_subagent_fork --> pkg_agent pkg_subagent_fork --> pkg_agent
pkg_subagent_fork --> pkg_invariants
pkg_subagent_fork --> pkg_session pkg_subagent_fork --> pkg_session
pkg_subagent_fork --> pkg_subagent pkg_subagent_fork --> pkg_subagent
pkg_subagent_fork --> pkg_subagent_inprocess pkg_subagent_fork --> pkg_subagent_inprocess
pkg_subagent_spawn --> pkg_invariants
pkg_subagent_spawn --> pkg_subagent pkg_subagent_spawn --> pkg_subagent
pkg_subagent_spawn --> pkg_subagent_inprocess pkg_subagent_spawn --> pkg_subagent_inprocess
pkg_acp_demo --> pkg_acp pkg_acp_demo --> pkg_acp
pkg_acp_demo --> pkg_agent_spine_demo pkg_acp_demo --> pkg_agent_spine_demo
pkg_acp_demo --> pkg_app_boot pkg_acp_demo --> pkg_app_boot
pkg_acp_demo --> pkg_invariants
pkg_acp_demo --> pkg_session_persistence_jsonl pkg_acp_demo --> pkg_session_persistence_jsonl
pkg_acp_demo --> pkg_tools pkg_acp_demo --> pkg_tools
pkg_acp_demo --> pkg_user_interaction pkg_acp_demo --> pkg_user_interaction
@@ -425,6 +506,7 @@ flowchart TD
pkg_cli_demo --> pkg_agent pkg_cli_demo --> pkg_agent
pkg_cli_demo --> pkg_agent_spine_demo pkg_cli_demo --> pkg_agent_spine_demo
pkg_cli_demo --> pkg_app_boot pkg_cli_demo --> pkg_app_boot
pkg_cli_demo --> pkg_invariants
pkg_cli_demo --> pkg_llm pkg_cli_demo --> pkg_llm
pkg_cli_demo --> pkg_session pkg_cli_demo --> pkg_session
pkg_cli_demo --> pkg_session_persistence_jsonl pkg_cli_demo --> pkg_session_persistence_jsonl
@@ -434,6 +516,7 @@ flowchart TD
pkg_stdio_demo --> pkg_agent_loop pkg_stdio_demo --> pkg_agent_loop
pkg_stdio_demo --> pkg_agent_spine_demo pkg_stdio_demo --> pkg_agent_spine_demo
pkg_stdio_demo --> pkg_app_boot pkg_stdio_demo --> pkg_app_boot
pkg_stdio_demo --> pkg_invariants
pkg_stdio_demo --> pkg_llm pkg_stdio_demo --> pkg_llm
pkg_stdio_demo --> pkg_session pkg_stdio_demo --> pkg_session
pkg_stdio_demo --> pkg_session_persistence_jsonl pkg_stdio_demo --> pkg_session_persistence_jsonl
@@ -447,92 +530,92 @@ flowchart TD
| Package | Group | Depends on | | Package | Group | Depends on |
| --- | --- | --- | | --- | --- | --- |
| [`brand`](../packages/util/brand) | `util` | — |
| [`home`](../packages/util/home) | `util` | — |
| [`paths`](../packages/util/paths) | `util` | — |
| [`retention`](../packages/util/retention) | `util` | — |
| [`timeout`](../packages/util/timeout) | `util` | — |
| [`skill`](../packages/skill/skill) | `skill` | — |
| [`subagent-subprocess`](../packages/subagent/subagent-subprocess) | `subagent` | — |
| [`acp-snapshot`](../packages/support/acp-snapshot) | `support` | — |
| [`invariants`](../packages/support/invariants) | `support` | — | | [`invariants`](../packages/support/invariants) | `support` | — |
| [`loader-smoke`](../packages/support/loader-smoke) | `support` | — | | [`brand`](../packages/util/brand) | `util` | [`invariants`](../packages/support/invariants) |
| [`app-boot`](../packages/ui/app-boot) | `ui` | | | [`home`](../packages/util/home) | `util` | [`invariants`](../packages/support/invariants) |
| [`code-runtime`](../packages/code-runtime/code-runtime) | `code-runtime` | — | | [`paths`](../packages/util/paths) | `util` | [`invariants`](../packages/support/invariants) |
| [`jsonrpc-demo`](../packages/examples/jsonrpc-demo) | `examples` | — | | [`retention`](../packages/util/retention) | `util` | [`invariants`](../packages/support/invariants) |
| [`llm`](../packages/llm/llm) | `llm` | [`brand`](../packages/util/brand) | | [`timeout`](../packages/util/timeout) | `util` | [`invariants`](../packages/support/invariants) |
| [`scope`](../packages/core/scope) | `core` | [`invariants`](../packages/support/invariants) | | [`scope`](../packages/core/scope) | `core` | [`invariants`](../packages/support/invariants) |
| [`code-runtime-worker`](../packages/code-runtime/code-runtime-worker) | `code-runtime` | [`code-runtime`](../packages/code-runtime/code-runtime) | | [`skill`](../packages/skill/skill) | `skill` | [`invariants`](../packages/support/invariants) |
| [`helper`](../packages/sdk/helper) | `sdk` | [`brand`](../packages/util/brand) | | [`subagent-subprocess`](../packages/subagent/subagent-subprocess) | `subagent` | [`invariants`](../packages/support/invariants) |
| [`scripts`](../packages/sdk/scripts) | `sdk` | [`app-boot`](../packages/ui/app-boot) | | [`acp-snapshot`](../packages/support/acp-snapshot) | `support` | [`invariants`](../packages/support/invariants) |
| [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`llm`](../packages/llm/llm) | | [`loader-smoke`](../packages/support/loader-smoke) | `support` | [`invariants`](../packages/support/invariants) |
| [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`llm`](../packages/llm/llm) | | [`app-boot`](../packages/ui/app-boot) | `ui` | [`invariants`](../packages/support/invariants) |
| [`code-runtime`](../packages/code-runtime/code-runtime) | `code-runtime` | [`invariants`](../packages/support/invariants) |
| [`jsonrpc-demo`](../packages/examples/jsonrpc-demo) | `examples` | [`invariants`](../packages/support/invariants) |
| [`llm`](../packages/llm/llm) | `llm` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants) |
| [`code-runtime-worker`](../packages/code-runtime/code-runtime-worker) | `code-runtime` | [`code-runtime`](../packages/code-runtime/code-runtime), [`invariants`](../packages/support/invariants) |
| [`helper`](../packages/sdk/helper) | `sdk` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants) |
| [`scripts`](../packages/sdk/scripts) | `sdk` | [`app-boot`](../packages/ui/app-boot), [`invariants`](../packages/support/invariants) |
| [`llm-deepseek`](../packages/llm/llm-deepseek) | `llm` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`llm-pi-ai`](../packages/llm/llm-pi-ai) | `llm` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`session`](../packages/core/session) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) | | [`session`](../packages/core/session) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
| [`system-prompt`](../packages/core/system-prompt) | `core` | [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) | | [`system-prompt`](../packages/core/system-prompt) | `core` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope) |
| [`fs`](../packages/fs/fs) | `fs` | [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm) | | [`fs`](../packages/fs/fs) | `fs` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`web`](../packages/web/web) | `web` | [`llm`](../packages/llm/llm) | | [`web`](../packages/web/web) | `web` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`sandbox`](../packages/sandbox/sandbox) | `sandbox` | [`llm`](../packages/llm/llm) | | [`sandbox`](../packages/sandbox/sandbox) | `sandbox` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`token-meter`](../packages/llm/token-meter) | `llm` | [`llm`](../packages/llm/llm), [`session`](../packages/core/session) | | [`token-meter`](../packages/llm/token-meter) | `llm` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) |
| [`agent`](../packages/core/agent) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) | | [`agent`](../packages/core/agent) | `core` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) |
| [`bash`](../packages/bash/bash) | `bash` | [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session) | | [`bash`](../packages/bash/bash) | `bash` | [`invariants`](../packages/support/invariants), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session) |
| [`fs-local`](../packages/fs/fs-local) | `fs` | [`fs`](../packages/fs/fs) | | [`fs-local`](../packages/fs/fs-local) | `fs` | [`fs`](../packages/fs/fs), [`invariants`](../packages/support/invariants) |
| [`fs-policy`](../packages/fs/fs-policy) | `fs` | [`fs`](../packages/fs/fs) | | [`fs-policy`](../packages/fs/fs-policy) | `fs` | [`fs`](../packages/fs/fs), [`invariants`](../packages/support/invariants) |
| [`skill-local`](../packages/skill/skill-local) | `skill` | [`fs`](../packages/fs/fs), [`home`](../packages/util/home), [`skill`](../packages/skill/skill) | | [`skill-local`](../packages/skill/skill-local) | `skill` | [`fs`](../packages/fs/fs), [`home`](../packages/util/home), [`invariants`](../packages/support/invariants), [`skill`](../packages/skill/skill) |
| [`compact`](../packages/compact/compact) | `compact` | [`llm`](../packages/llm/llm), [`session`](../packages/core/session) | | [`compact`](../packages/compact/compact) | `compact` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) |
| [`web-fetch-local`](../packages/web/web-fetch-local) | `web` | [`timeout`](../packages/util/timeout), [`web`](../packages/web/web) | | [`web-fetch-local`](../packages/web/web-fetch-local) | `web` | [`invariants`](../packages/support/invariants), [`timeout`](../packages/util/timeout), [`web`](../packages/web/web) |
| [`web-search-deepseek`](../packages/web/web-search-deepseek) | `web` | [`web`](../packages/web/web) | | [`web-search-deepseek`](../packages/web/web-search-deepseek) | `web` | [`invariants`](../packages/support/invariants), [`web`](../packages/web/web) |
| [`web-search-exa`](../packages/web/web-search-exa) | `web` | [`web`](../packages/web/web) | | [`web-search-exa`](../packages/web/web-search-exa) | `web` | [`invariants`](../packages/support/invariants), [`web`](../packages/web/web) |
| [`web-search-perplexity`](../packages/web/web-search-perplexity) | `web` | [`web`](../packages/web/web) | | [`web-search-perplexity`](../packages/web/web-search-perplexity) | `web` | [`invariants`](../packages/support/invariants), [`web`](../packages/web/web) |
| [`spill`](../packages/spill/spill) | `spill` | [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) | | [`spill`](../packages/spill/spill) | `spill` | [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) |
| [`session-persistence`](../packages/session-persistence/session-persistence) | `session-persistence` | [`session`](../packages/core/session) | | [`session-persistence`](../packages/session-persistence/session-persistence) | `session-persistence` | [`invariants`](../packages/support/invariants), [`session`](../packages/core/session) |
| [`llm-replay`](../packages/support/llm-replay) | `support` | [`llm`](../packages/llm/llm), [`session`](../packages/core/session) | | [`llm-replay`](../packages/support/llm-replay) | `support` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) |
| [`sandbox-local`](../packages/sandbox/sandbox-local) | `sandbox` | [`llm`](../packages/llm/llm), [`sandbox`](../packages/sandbox/sandbox) | | [`sandbox-local`](../packages/sandbox/sandbox-local) | `sandbox` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`sandbox`](../packages/sandbox/sandbox) |
| [`bash-local`](../packages/bash/bash-local) | `bash` | [`bash`](../packages/bash/bash), [`timeout`](../packages/util/timeout) | | [`bash-local`](../packages/bash/bash-local) | `bash` | [`bash`](../packages/bash/bash), [`invariants`](../packages/support/invariants), [`timeout`](../packages/util/timeout) |
| [`compact-basic`](../packages/compact/compact-basic) | `compact` | [`agent`](../packages/core/agent), [`compact`](../packages/compact/compact), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) | | [`compact-basic`](../packages/compact/compact-basic) | `compact` | [`agent`](../packages/core/agent), [`compact`](../packages/compact/compact), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`token-meter`](../packages/llm/token-meter) |
| [`spill-local`](../packages/spill/spill-local) | `spill` | [`spill`](../packages/spill/spill) | | [`spill-local`](../packages/spill/spill-local) | `spill` | [`invariants`](../packages/support/invariants), [`spill`](../packages/spill/spill) |
| [`hook-protocol`](../packages/hooks/hook-protocol) | `hooks` | [`bash`](../packages/bash/bash), [`session`](../packages/core/session) | | [`hook-protocol`](../packages/hooks/hook-protocol) | `hooks` | [`bash`](../packages/bash/bash), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session) |
| [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl) | `session-persistence` | [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) | | [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl) | `session-persistence` | [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) |
| [`session-persistence-sqlite`](../packages/session-persistence/session-persistence-sqlite) | `session-persistence` | [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) | | [`session-persistence-sqlite`](../packages/session-persistence/session-persistence-sqlite) | `session-persistence` | [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) |
| [`session-query`](../packages/session-query/session-query) | `session-query` | [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) | | [`session-query`](../packages/session-query/session-query) | `session-query` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence) |
| [`user-approval`](../packages/ui/user-approval) | `ui` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) | | [`user-approval`](../packages/ui/user-approval) | `ui` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt) |
| [`user-interaction`](../packages/ui/user-interaction) | `ui` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm) | | [`user-interaction`](../packages/ui/user-interaction) | `ui` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm) |
| [`time-context`](../packages/context/time-context) | `context` | [`agent`](../packages/core/agent) | | [`time-context`](../packages/context/time-context) | `context` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants) |
| [`tasks`](../packages/tasks/tasks) | `tasks` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`session`](../packages/core/session), [`timeout`](../packages/util/timeout) | | [`tasks`](../packages/tasks/tasks) | `tasks` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`timeout`](../packages/util/timeout) |
| [`workflow`](../packages/workflow/workflow) | `workflow` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) | | [`workflow`](../packages/workflow/workflow) | `workflow` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session) |
| [`tools`](../packages/core/tools) | `core` | [`agent`](../packages/core/agent), [`code-runtime`](../packages/code-runtime/code-runtime), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`user-approval`](../packages/ui/user-approval) | | [`tools`](../packages/core/tools) | `core` | [`agent`](../packages/core/agent), [`code-runtime`](../packages/code-runtime/code-runtime), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`user-approval`](../packages/ui/user-approval) |
| [`bash-sandbox`](../packages/bash/bash-sandbox) | `bash` | [`bash`](../packages/bash/bash), [`bash-local`](../packages/bash/bash-local), [`sandbox`](../packages/sandbox/sandbox) | | [`bash-sandbox`](../packages/bash/bash-sandbox) | `bash` | [`bash`](../packages/bash/bash), [`bash-local`](../packages/bash/bash-local), [`invariants`](../packages/support/invariants), [`sandbox`](../packages/sandbox/sandbox) |
| [`permission`](../packages/ui/permission) | `ui` | [`bash`](../packages/bash/bash), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`user-approval`](../packages/ui/user-approval) | | [`permission`](../packages/ui/permission) | `ui` | [`bash`](../packages/bash/bash), [`invariants`](../packages/support/invariants), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`user-approval`](../packages/ui/user-approval) |
| [`agent-loop`](../packages/core/agent-loop) | `core` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) | | [`agent-loop`](../packages/core/agent-loop) | `core` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-bash`](../packages/bash/tool-bash) | `bash` | [`agent`](../packages/core/agent), [`bash`](../packages/bash/bash), [`home`](../packages/util/home), [`llm`](../packages/llm/llm), [`sandbox`](../packages/sandbox/sandbox), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools), [`user-approval`](../packages/ui/user-approval) | | [`tool-bash`](../packages/bash/tool-bash) | `bash` | [`agent`](../packages/core/agent), [`bash`](../packages/bash/bash), [`home`](../packages/util/home), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`sandbox`](../packages/sandbox/sandbox), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools), [`user-approval`](../packages/ui/user-approval) |
| [`tool-fs`](../packages/fs/tool-fs) | `fs` | [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) | | [`tool-fs`](../packages/fs/tool-fs) | `fs` | [`fs`](../packages/fs/fs), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-fs-search`](../packages/fs/tool-fs-search) | `fs` | [`bash`](../packages/bash/bash), [`llm`](../packages/llm/llm), [`retention`](../packages/util/retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) | | [`tool-fs-search`](../packages/fs/tool-fs-search) | `fs` | [`bash`](../packages/bash/bash), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`retention`](../packages/util/retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-skill`](../packages/skill/tool-skill) | `skill` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`skill`](../packages/skill/skill), [`tools`](../packages/core/tools) | | [`tool-skill`](../packages/skill/tool-skill) | `skill` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`skill`](../packages/skill/skill), [`tools`](../packages/core/tools) |
| [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`tools`](../packages/core/tools) | | [`subagent`](../packages/subagent/subagent) | `subagent` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`tools`](../packages/core/tools) |
| [`tool-web`](../packages/web/tool-web) | `web` | [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`web`](../packages/web/web) | | [`tool-web`](../packages/web/tool-web) | `web` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`web`](../packages/web/web) |
| [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`llm`](../packages/llm/llm), [`retention`](../packages/util/retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`tools`](../packages/core/tools) | | [`spill-policy`](../packages/spill/spill-policy) | `spill` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`retention`](../packages/util/retention), [`session`](../packages/core/session), [`spill`](../packages/spill/spill), [`tools`](../packages/core/tools) |
| [`timeout-policy`](../packages/timeout/timeout-policy) | `timeout` | [`llm`](../packages/llm/llm), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) | | [`timeout-policy`](../packages/timeout/timeout-policy) | `timeout` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`timeout`](../packages/util/timeout), [`tools`](../packages/core/tools) |
| [`tool-todo`](../packages/todo/tool-todo) | `todo` | [`agent`](../packages/core/agent), [`session`](../packages/core/session), [`tools`](../packages/core/tools) | | [`tool-todo`](../packages/todo/tool-todo) | `todo` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`tools`](../packages/core/tools) |
| [`tool-cordis`](../packages/cordis/tool-cordis) | `cordis` | [`scope`](../packages/core/scope), [`tools`](../packages/core/tools) | | [`tool-cordis`](../packages/cordis/tool-cordis) | `cordis` | [`invariants`](../packages/support/invariants), [`scope`](../packages/core/scope), [`tools`](../packages/core/tools) |
| [`hooks-codex`](../packages/hooks/hooks-codex) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`tools`](../packages/core/tools) | | [`hooks-codex`](../packages/hooks/hooks-codex) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`tools`](../packages/core/tools) |
| [`agent-loop-testkit`](../packages/support/agent-loop-testkit) | `support` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) | | [`agent-loop-testkit`](../packages/support/agent-loop-testkit) | `support` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`acp`](../packages/ui/acp) | `ui` | [`agent`](../packages/core/agent), [`bash`](../packages/bash/bash), [`llm`](../packages/llm/llm), [`permission`](../packages/ui/permission), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`user-approval`](../packages/ui/user-approval), [`user-interaction`](../packages/ui/user-interaction) | | [`acp`](../packages/ui/acp) | `ui` | [`agent`](../packages/core/agent), [`bash`](../packages/bash/bash), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`permission`](../packages/ui/permission), [`sandbox`](../packages/sandbox/sandbox), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`user-approval`](../packages/ui/user-approval), [`user-interaction`](../packages/ui/user-interaction) |
| [`tool-ask-user`](../packages/ui/tool-ask-user) | `ui` | [`agent`](../packages/core/agent), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction) | | [`tool-ask-user`](../packages/ui/tool-ask-user) | `ui` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction) |
| [`workspace-context`](../packages/context/workspace-context) | `context` | [`agent`](../packages/core/agent), [`fs`](../packages/fs/fs), [`llm`](../packages/llm/llm), [`paths`](../packages/util/paths), [`session`](../packages/core/session), [`tools`](../packages/core/tools) | | [`workspace-context`](../packages/context/workspace-context) | `context` | [`agent`](../packages/core/agent), [`fs`](../packages/fs/fs), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`paths`](../packages/util/paths), [`session`](../packages/core/session), [`tools`](../packages/core/tools) |
| [`repeat-tool-guard`](../packages/guard/repeat-tool-guard) | `guard` | [`agent`](../packages/core/agent), [`tools`](../packages/core/tools) | | [`repeat-tool-guard`](../packages/guard/repeat-tool-guard) | `guard` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`tools`](../packages/core/tools) |
| [`mcp-client`](../packages/mcp/mcp-client) | `mcp` | [`llm`](../packages/llm/llm), [`tools`](../packages/core/tools) | | [`mcp-client`](../packages/mcp/mcp-client) | `mcp` | [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`tools`](../packages/core/tools) |
| [`tool-tasks`](../packages/tasks/tool-tasks) | `tasks` | [`agent`](../packages/core/agent), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools) | | [`tool-tasks`](../packages/tasks/tool-tasks) | `tasks` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools) |
| [`tool-workflow`](../packages/workflow/tool-workflow) | `workflow` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow) | | [`tool-workflow`](../packages/workflow/tool-workflow) | `workflow` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow) |
| [`subagent-acp`](../packages/subagent/subagent-acp) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subagent-subprocess`](../packages/subagent/subagent-subprocess) | | [`subagent-acp`](../packages/subagent/subagent-acp) | `subagent` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subagent-subprocess`](../packages/subagent/subagent-subprocess) |
| [`subagent-inprocess`](../packages/subagent/subagent-inprocess) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) | | [`subagent-inprocess`](../packages/subagent/subagent-inprocess) | `subagent` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`system-prompt`](../packages/core/system-prompt), [`tools`](../packages/core/tools) |
| [`tool-subagent`](../packages/subagent/tool-subagent) | `subagent` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`subagent`](../packages/subagent/subagent), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools) | | [`tool-subagent`](../packages/subagent/tool-subagent) | `subagent` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`subagent`](../packages/subagent/subagent), [`tasks`](../packages/tasks/tasks), [`tools`](../packages/core/tools) |
| [`hooks-claude`](../packages/hooks/hooks-claude) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) | | [`hooks-claude`](../packages/hooks/hooks-claude) | `hooks` | [`agent`](../packages/core/agent), [`hook-protocol`](../packages/hooks/hook-protocol), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session-persistence/session-persistence), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools) |
| [`jsonrpc`](../packages/ui/jsonrpc) | `ui` | [`agent`](../packages/core/agent), [`llm`](../packages/llm/llm), [`llm-deepseek`](../packages/llm/llm-deepseek), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent) | | [`jsonrpc`](../packages/ui/jsonrpc) | `ui` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`llm-deepseek`](../packages/llm/llm-deepseek), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent) |
| [`stdio`](../packages/ui/stdio) | `ui` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`user-interaction`](../packages/ui/user-interaction) | | [`stdio`](../packages/ui/stdio) | `ui` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`user-interaction`](../packages/ui/user-interaction) |
| [`tui`](../packages/ui/tui) | `ui` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction) | | [`tui`](../packages/ui/tui) | `ui` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction) |
| [`agent-spine-demo`](../packages/examples/agent-spine-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`home`](../packages/util/home), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`skill`](../packages/skill/skill), [`skill-local`](../packages/skill/skill-local), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tool-bash`](../packages/bash/tool-bash), [`tool-skill`](../packages/skill/tool-skill), [`tool-tasks`](../packages/tasks/tool-tasks), [`tools`](../packages/core/tools), [`workspace-context`](../packages/context/workspace-context) | | [`agent-spine-demo`](../packages/examples/agent-spine-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`home`](../packages/util/home), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`scope`](../packages/core/scope), [`session`](../packages/core/session), [`skill`](../packages/skill/skill), [`skill-local`](../packages/skill/skill-local), [`system-prompt`](../packages/core/system-prompt), [`tasks`](../packages/tasks/tasks), [`tool-bash`](../packages/bash/tool-bash), [`tool-skill`](../packages/skill/tool-skill), [`tool-tasks`](../packages/tasks/tool-tasks), [`tools`](../packages/core/tools), [`workspace-context`](../packages/context/workspace-context) |
| [`workflow-workerthread`](../packages/workflow/workflow-workerthread) | `workflow` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow) | | [`workflow-workerthread`](../packages/workflow/workflow-workerthread) | `workflow` | [`agent`](../packages/core/agent), [`brand`](../packages/util/brand), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`tools`](../packages/core/tools), [`workflow`](../packages/workflow/workflow) |
| [`subagent-fork`](../packages/subagent/subagent-fork) | `subagent` | [`agent`](../packages/core/agent), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subagent-inprocess`](../packages/subagent/subagent-inprocess) | | [`subagent-fork`](../packages/subagent/subagent-fork) | `subagent` | [`agent`](../packages/core/agent), [`invariants`](../packages/support/invariants), [`session`](../packages/core/session), [`subagent`](../packages/subagent/subagent), [`subagent-inprocess`](../packages/subagent/subagent-inprocess) |
| [`subagent-spawn`](../packages/subagent/subagent-spawn) | `subagent` | [`subagent`](../packages/subagent/subagent), [`subagent-inprocess`](../packages/subagent/subagent-inprocess) | | [`subagent-spawn`](../packages/subagent/subagent-spawn) | `subagent` | [`invariants`](../packages/support/invariants), [`subagent`](../packages/subagent/subagent), [`subagent-inprocess`](../packages/subagent/subagent-inprocess) |
| [`acp-demo`](../packages/examples/acp-demo) | `examples` | [`acp`](../packages/ui/acp), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction), [`workspace-context`](../packages/context/workspace-context) | | [`acp-demo`](../packages/examples/acp-demo) | `examples` | [`acp`](../packages/ui/acp), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`invariants`](../packages/support/invariants), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`tools`](../packages/core/tools), [`user-interaction`](../packages/ui/user-interaction), [`workspace-context`](../packages/context/workspace-context) |
| [`cli-demo`](../packages/examples/cli-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`tools`](../packages/core/tools), [`workspace-context`](../packages/context/workspace-context) | | [`cli-demo`](../packages/examples/cli-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`tools`](../packages/core/tools), [`workspace-context`](../packages/context/workspace-context) |
| [`stdio-demo`](../packages/examples/stdio-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`stdio`](../packages/ui/stdio), [`tool-ask-user`](../packages/ui/tool-ask-user), [`tools`](../packages/core/tools), [`tui`](../packages/ui/tui), [`user-interaction`](../packages/ui/user-interaction), [`workspace-context`](../packages/context/workspace-context) | | [`stdio-demo`](../packages/examples/stdio-demo) | `examples` | [`agent`](../packages/core/agent), [`agent-loop`](../packages/core/agent-loop), [`agent-spine-demo`](../packages/examples/agent-spine-demo), [`app-boot`](../packages/ui/app-boot), [`invariants`](../packages/support/invariants), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence-jsonl`](../packages/session-persistence/session-persistence-jsonl), [`stdio`](../packages/ui/stdio), [`tool-ask-user`](../packages/ui/tool-ask-user), [`tools`](../packages/core/tools), [`tui`](../packages/ui/tui), [`user-interaction`](../packages/ui/user-interaction), [`workspace-context`](../packages/context/workspace-context) |
@@ -30,7 +30,7 @@ This guarantee belongs in `Session`, not in an optional listener, because every
### Package-owned invariant companions check relationships ### Package-owned invariant companions check relationships
`dsh-invariants` registers the configurable `ctx.invariants` service and contains no product checks. Optional `./invariant` companions from `dsh-session`, `dsh-agent`, `dsh-scope`, and `dsh-agent-loop` own the rules that require trace state or observation of another seam: monotonic sequence numbers, turn and step nesting, tool-call/result pairing, legal agent-status transitions, subject-correct scoped dispatch, and equality between a loop-built request and the request reconstructed from its session-log prefix. Global enablement and package-name regex filters belong to the service ([package-owned invariant service](2026-07-19-package-owned-invariant-service.md)). `dsh-invariants` registers the configurable `ctx.invariants` service and contains no product checks. Every package publishes a `./invariant` ownership companion; `dsh-session`, `dsh-agent`, `dsh-scope`, and `dsh-agent-loop` currently add the rules that require trace state or observation of another seam: monotonic sequence numbers, turn and step nesting, tool-call/result pairing, legal agent-status transitions, subject-correct scoped dispatch, and equality between a loop-built request and the request reconstructed from its session-log prefix. Global enablement and package-name regex filters belong to the service ([package-owned invariant service](2026-07-19-package-owned-invariant-service.md)).
When the session companion attaches to an existing or seeded session, it replays the immutable log to rebuild trace state. The service gives each contribution a disposable child fiber, so hot reload is safe in the middle of a turn without giving diagnostics ownership of session storage. When the session companion attaches to an existing or seeded session, it replays the immutable log to rebuild trace state. The service gives each contribution a disposable child fiber, so hot reload is safe in the middle of a turn without giving diagnostics ownership of session storage.
@@ -21,7 +21,7 @@ In case 2, if the injected `context/message` is the last event before a flush/di
- An `agent.inject()` made while the agent is **running** joins the already-open turn. While the current step executes assistant tool calls, accepted context waits in arrival order until that batch settles, then appends after every recorded result and before the turn closes even when execution is interrupted. - An `agent.inject()` made while the agent is **running** joins the already-open turn. While the current step executes assistant tool calls, accepted context waits in arrival order until that batch settles, then appends after every recorded result and before the turn closes even when execution is interrupted.
- An `agent.inject()` made while **idle** wraps its `context/message` in a one-shot turn: `turn/start{trigger:{kind:'injection'}}``context/message``turn/end{completed}`. A new `injection` variant joins the merge-extensible `TurnTriggerMap`. - An `agent.inject()` made while **idle** wraps its `context/message` in a one-shot turn: `turn/start{trigger:{kind:'injection'}}``context/message``turn/end{completed}`. A new `injection` variant joins the merge-extensible `TurnTriggerMap`.
- The loop derives the next turn number from the log each iteration (`lastTurnNumber(session) + 1`) instead of keeping a private counter, so an idle injection's one-shot turn cannot collide with the next real turn's number. - The loop derives the next turn number from the log each iteration (`lastTurnNumber(session) + 1`) instead of keeping a private counter, so an idle injection's one-shot turn cannot collide with the next real turn's number.
- The optional `dsh-session/invariant` companion registers the dev check with `ctx.invariants`: a `user/message` / `context/message` / `steering/message` appended while no turn is open throws an `InvariantError` attributed to `@deepseek-ai/dsh-session`. - The `dsh-session/invariant` companion registers the check with `ctx.invariants`: when selected, a `user/message` / `context/message` / `steering/message` appended while no turn is open throws an `InvariantError` attributed to `@deepseek-ai/dsh-session`.
The serializability invariant is enforced at the same source boundary (`Session.append` throws on non-JSON-serializable data), so "what may enter the log" is now governed in one place rather than discovered downstream by whichever backend happens to be watching. The serializability invariant is enforced at the same source boundary (`Session.append` throws on non-JSON-serializable data), so "what may enter the log" is now governed in one place rather than discovered downstream by whichever backend happens to be watching.
@@ -26,7 +26,7 @@ Each step rebuilds prompt assembly. On the instance's first step, `agent/session
**`step/start` is the reconstruction boundary.** A step derives messages from events before that sequence. Injection after the snapshot joins the next request, and reentrant appends are rejected during event publication. `agent/pre-step(agent, turn, step, signal)` remains the generic seam for content needed by the current request. Header reconstruction selects the step's `request/header`, or carries the prior snapshot when no new header is written. **`step/start` is the reconstruction boundary.** A step derives messages from events before that sequence. Injection after the snapshot joins the next request, and reentrant appends are rejected during event publication. `agent/pre-step(agent, turn, step, signal)` remains the generic seam for content needed by the current request. Header reconstruction selects the step's `request/header`, or carries the prior snapshot when no new header is written.
**Enforcement.** In development, the optional `dsh-agent-loop/invariant` companion registers with `ctx.invariants` and independently rebuilds each loop request through a fresh `Session`, so the live cache cannot vouch for itself, then compares messages and folded header fields at `llm/stream`. Loop requests are identified by their frozen shape and session id; direct one-shots are excluded. Correctness depends on sequence-bounded reconstruction rather than listener order. A with-key e2e requires positive cache-read tokens after the first request; per-step usage is the production signal, and a header change or compaction appears as a cache-read drop on the next step. **Enforcement.** The `dsh-agent-loop/invariant` companion registers with `ctx.invariants` and, when selected, independently rebuilds each loop request through a fresh `Session`, so the live cache cannot vouch for itself, then compares messages and folded header fields at `llm/stream`. Loop requests are identified by their frozen shape and session id; direct one-shots are excluded. Correctness depends on sequence-bounded reconstruction rather than listener order. A with-key e2e requires positive cache-read tokens after the first request; per-step usage is the production signal, and a header change or compaction appears as a cache-read drop on the next step.
### The MiniCode shape: adopted, with the provenance arrow inverted ### The MiniCode shape: adopted, with the provenance arrow inverted
@@ -322,7 +322,7 @@ TypeScript cannot govern JavaScript casts, direct Cordis dispatch, process messa
### Runtime invariants cover cross-service facts ### Runtime invariants cover cross-service facts
The optional `dsh-scope/invariant` companion verifies that every declared scoped event uses a marked carrier and that event families exposing a subject use the matching key. The separate `dsh-session/invariant` contribution stages trace validation before append commit and advances after the same event commits; both register through `ctx.invariants`. The `dsh-scope/invariant` companion verifies, when selected, that every declared scoped event uses a marked carrier and that event families exposing a subject use the matching key. The separate `dsh-session/invariant` contribution stages trace validation before append commit and advances after the same event commits; both register through `ctx.invariants`.
The plugin does not police trusted setup by scanning registries or reject prompt assembly objects fabricated through casts. Those checks would turn composition contracts into speculative runtime machinery without protecting a real external boundary. The plugin does not police trusted setup by scanning registries or reject prompt assembly objects fabricated through casts. Those checks would turn composition contracts into speculative runtime machinery without protecting a real external boundary.
@@ -2,5 +2,5 @@
# side as of the last confirmed-consistent state. Both languages carry equal authority; # side as of the last confirmed-consistent state. Both languages carry equal authority;
# after editing either side, bring the other along and re-record with: # after editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write # pnpm run verify-translation-pairing --write
2026-07-19-package-owned-invariant-service.md: f147cd91134509e17df39d1acbb28ae8b521c2f8 2026-07-19-package-owned-invariant-service.md: bf27bb4e951988bc124509b49dea9b5509f8e6f3
2026-07-19-package-owned-invariant-service.zh.md: a106b57137c36009d0d4b4d39f109b7abf857f42 2026-07-19-package-owned-invariant-service.zh.md: c9dfbb65bf4fd497f2f592f7741923dcef3e51fb
@@ -10,13 +10,15 @@ Runtime invariant checks span session traces, agent state, scoped dispatch, and
Deployments also need more than presence or absence of one plugin. A standard composition should carry the known invariant contributions while permitting a global off switch and package-selective diagnostics. Selection must remain stable when a package loads later or reloads under HMR, and disabled contributions must not allow two plugins to claim the same package name silently. Deployments also need more than presence or absence of one plugin. A standard composition should carry the known invariant contributions while permitting a global off switch and package-selective diagnostics. Selection must remain stable when a package loads later or reloads under HMR, and disabled contributions must not allow two plugins to claim the same package name silently.
Package ownership must also be exhaustive. Without a mechanical repository rule, a new package can omit the companion, dependency, or publication wiring and remain invisible to diagnostics until a maintainer notices the gap.
## Decision ## Decision
### One registry service, package-owned contributions ### One registry service, package-owned contributions
`@deepseek-ai/dsh-invariants` is a product-independent Cordis service plugin that registers `ctx.invariants`. It owns configuration, registration uniqueness, child-fiber lifecycle, and package-attributed failures. It imports no session, agent, scope, or agent-loop package and contains none of their checks. `@deepseek-ai/dsh-invariants` is a product-independent Cordis service plugin that registers `ctx.invariants`. It owns configuration, registration uniqueness, child-fiber lifecycle, and package-attributed failures. It imports no session, agent, scope, or agent-loop package and contains none of their checks.
Packages expose diagnostics through optional `./invariant` companion plugins. Their root entrypoints do not import or register diagnostics implicitly, so loading a product package does not change runtime checking or require the invariant service. Every workspace package publishes a `./invariant` companion plugin that registers its exact full npm name. A package with no relational check uses a generated ownership-only installer: it reserves the name through the real service boundary but installs no listeners. Package root entrypoints do not import or register diagnostics implicitly, so loading a root package does not change runtime checking or require the invariant service.
### Configuration and selection ### Configuration and selection
@@ -53,7 +55,7 @@ Registration setup is transactional. If an installer fails after registering lis
The former functional-plugin entrypoint and one-argument `InvariantError` constructor are not retained as compatibility surfaces. The repository is pre-release and all call sites move to the service and package-attributed error together. The former functional-plugin entrypoint and one-argument `InvariantError` constructor are not retained as compatibility surfaces. The repository is pre-release and all call sites move to the service and package-attributed error together.
### Shipped companions ### Stateful companions and exhaustive ownership
| Companion entry | Registration name | Owned checks | | Companion entry | Registration name | Owned checks |
|---|---|---| |---|---|---|
@@ -62,7 +64,9 @@ The former functional-plugin entrypoint and one-argument `InvariantError` constr
| `@deepseek-ai/dsh-scope/invariant` | `@deepseek-ai/dsh-scope` | scoped-event carrier presence and subject consistency | | `@deepseek-ai/dsh-scope/invariant` | `@deepseek-ai/dsh-scope` | scoped-event carrier presence and subject consistency |
| `@deepseek-ai/dsh-agent-loop/invariant` | `@deepseek-ai/dsh-agent-loop` | model-request reconstruction | | `@deepseek-ai/dsh-agent-loop/invariant` | `@deepseek-ai/dsh-agent-loop` | model-request reconstruction |
Each owner contains its source and focused tests. Every companion is a separately bundled `./invariant` export with its own declarations and Loader-safe namespace plugin shape. The service package retains only registry tests. These four owners contain stateful checks and focused tests. Every other package carries a generated baseline companion until it gains a relational assertion. Every companion is a separately bundled `./invariant` export with its own declarations and Loader-safe namespace plugin shape; the service package's own companion imports its local service type to avoid a self-dependency.
`verify-package-invariants` discovers every workspace package and rejects missing or stale companion source, foreign or unresolved registration names, missing `./invariant` exports or published files, missing invariant peer/development dependencies and project references, and bundle overrides that omit the companion entry. The generator writes only missing or marked ownership baselines, so a package-owned implementation is never replaced.
### Scoped-event semantic map ### Scoped-event semantic map
@@ -70,7 +74,7 @@ The generated scoped-event subject resolver lives in `dsh-scope`, beside the con
### Standard composition and SDK output ### Standard composition and SDK output
The standard agent spine mounts the service and all four companion subpaths, forwarding `enabled`, `package_allowlist`, and `package_blocklist` to the service. Generated SDK Cordis composition emits the same entries. A subpath entry adds its installable root npm package rather than treating the subpath as a package name. The standard agent spine mounts the service and all four stateful companion subpaths, forwarding `enabled`, `package_allowlist`, and `package_blocklist` to the service. Generated SDK Cordis composition emits the same entries. A subpath entry adds its installable root npm package rather than treating the subpath as a package name.
Workspace constraints recognize the separate invariant bundle, and package exports, project references, build configuration, dependency declarations, and the lockfile describe the same publication surface. Generated config catalogs, module graphs, and API documentation derive from those sources. Workspace constraints recognize the separate invariant bundle, and package exports, project references, build configuration, dependency declarations, and the lockfile describe the same publication surface. Generated config catalogs, module graphs, and API documentation derive from those sources.
@@ -80,18 +84,22 @@ Service tests cover defaults, global disablement, allow/block selection, blockli
Composition tests cover standard-spine forwarding and generated SDK entries. Loader tests preserve each companion namespace, while built plain-Node smokes exercise the compiled subpath exports. The scoped-event freshness gate reruns its semantic Program analysis. Composition tests cover standard-spine forwarding and generated SDK entries. Loader tests preserve each companion namespace, while built plain-Node smokes exercise the compiled subpath exports. The scoped-event freshness gate reruns its semantic Program analysis.
Every Vitest configuration loads a test host that mounts an explicitly enabled service and all package companions before an ordinary Cordis root's first plugin. Focused service and owner tests construct their own invariant topology so they can exercise disablement, filtering, rollback, and reload without duplicate ownership. Gate tests also execute every companion's `apply` function and verify that it calls `register` with its manifest name, rather than accepting source text alone.
## Alternatives considered ## Alternatives considered
- **Keep all checks in `dsh-invariants`.** Rejected because the registry would continue importing every checked product domain, owner changes would require central edits, and package tests would remain detached from the contracts they protect. - **Keep all checks in `dsh-invariants`.** Rejected because the registry would continue importing every checked product domain, owner changes would require central edits, and package tests would remain detached from the contracts they protect.
- **Let root package entrypoints register checks implicitly when `ctx.invariants` happens to exist.** Rejected because root behavior would depend on composition order and optional service presence, diagnostics could not be selected independently, and package loading would hide a registration effect outside an explicit companion. - **Let root package entrypoints register checks implicitly when `ctx.invariants` happens to exist.** Rejected because root behavior would depend on composition order and optional service presence, diagnostics could not be selected independently, and package loading would hide a registration effect outside an explicit companion.
- **Discover every `invariant.ts` file automatically.** Rejected because filesystem/package discovery is not a runtime ownership contract, makes bundled publication ambiguous, and cannot express explicit Cordis load order or dependency installation. - **Discover every `invariant.ts` file automatically at runtime.** Rejected because filesystem/package discovery is not a runtime ownership contract, makes bundled publication ambiguous, and cannot express explicit Cordis load order or dependency installation. Build-time generation, verification, and the test host may enumerate the source tree because they validate repository completeness rather than composing a shipped deployment.
- **Validate allow/block entries against the currently loaded package set.** Rejected because a zero-match pattern can intentionally target a later or HMR-loaded contribution; current load order must not determine config validity. - **Validate allow/block entries against the currently loaded package set.** Rejected because a zero-match pattern can intentionally target a later or HMR-loaded contribution; current load order must not determine config validity.
## Consequences ## Consequences
- Product packages own and test their relational assertions while the service stays product-independent. - Product packages own and test their relational assertions while the service stays product-independent.
- Every package pays the small publication and dependency cost of an invariant companion, including packages whose generated baseline currently installs no listeners.
- Standard compositions can disable all checks or select package names without changing their plugin tree. - Standard compositions can disable all checks or select package names without changing their plugin tree.
- Explicit companion entries make diagnostic cost and ownership visible in Cordis config and package exports. - Explicit companion entries make diagnostic cost and ownership visible in Cordis config and package exports.
- One selected contribution adds one child fiber and its listener/state cost; filtered registrations retain only name ownership. - One selected contribution adds one child fiber and its listener/state cost; filtered registrations retain only name ownership.
- Regex sources are deployment configuration and remain fixed until the service reloads. - Regex sources are deployment configuration and remain fixed until the service reloads.
- Ordinary Vitest roots install every selected companion, trading extra child fibers during tests for repository-wide invariant coverage and immediate fixture failures.
- Session storage validation, snapshotting, freezing, provenance, and surface acceptance remain always on and are not affected by invariant selection. - Session storage validation, snapshotting, freezing, provenance, and surface acceptance remain always on and are not affected by invariant selection.
@@ -10,13 +10,15 @@ Status: implemented
部署还需要比“是否加载一个插件”更细的控制。标准组合应携带已知的不变式贡献,同时允许全局关闭或按包选择诊断。包稍后加载或在 HMR 下重载时,选择结果必须保持稳定;被过滤的贡献也不能让两个插件静默占用同一个包名。 部署还需要比“是否加载一个插件”更细的控制。标准组合应携带已知的不变式贡献,同时允许全局关闭或按包选择诊断。包稍后加载或在 HMR 下重载时,选择结果必须保持稳定;被过滤的贡献也不能让两个插件静默占用同一个包名。
包所有权还必须覆盖完整。若没有机械化的仓库规则,新包可能遗漏伴随插件、依赖或发布配置,并一直不会进入诊断范围,直到维护者发现这一缺口。
## 决策 ## 决策
### 一个注册服务,贡献归包所有 ### 一个注册服务,贡献归包所有
`@deepseek-ai/dsh-invariants` 是与产品无关的 Cordis 服务插件,注册 `ctx.invariants`。它只负责配置、注册唯一性、子 fiber 生命周期和带包归属的失败;不导入 session、agent、scope 或 agent-loop 包,也不包含这些包的检查。 `@deepseek-ai/dsh-invariants` 是与产品无关的 Cordis 服务插件,注册 `ctx.invariants`。它只负责配置、注册唯一性、子 fiber 生命周期和带包归属的失败;不导入 session、agent、scope 或 agent-loop 包,也不包含这些包的检查。
各包通过可选的 `./invariant` 伴随插件公开诊断。根入口不会隐式导入或注册诊断,因此加载产品包本身不会改变运行时检查,也不要求不变式服务存在。 工作区内的每个包都发布 `./invariant` 伴随插件,并注册自己完整且准确的 npm 包名。没有关系检查的包使用生成的仅声明所有权 installer:它通过真实服务边界占用包名,但不安装监听器。包的根入口不会隐式导入或注册诊断,因此加载根包不会改变运行时检查,也不要求不变式服务存在。
### 配置与选择 ### 配置与选择
@@ -53,7 +55,7 @@ blocklist 匹配优先于 allowlist 匹配。每个条目都是区分大小写
原有函数式插件入口与单参数 `InvariantError` 构造函数不作为兼容表面保留。仓库尚未发布,所有调用方会一起迁移到服务和带包归属的错误。 原有函数式插件入口与单参数 `InvariantError` 构造函数不作为兼容表面保留。仓库尚未发布,所有调用方会一起迁移到服务和带包归属的错误。
### 已提供的伴随插件 ### 有状态伴随插件与完整所有权
| 伴随入口 | 注册名 | 所属检查 | | 伴随入口 | 注册名 | 所属检查 |
|---|---|---| |---|---|---|
@@ -62,7 +64,9 @@ blocklist 匹配优先于 allowlist 匹配。每个条目都是区分大小写
| `@deepseek-ai/dsh-scope/invariant` | `@deepseek-ai/dsh-scope` | scoped event carrier 存在性与主体一致性 | | `@deepseek-ai/dsh-scope/invariant` | `@deepseek-ai/dsh-scope` | scoped event carrier 存在性与主体一致性 |
| `@deepseek-ai/dsh-agent-loop/invariant` | `@deepseek-ai/dsh-agent-loop` | 模型请求重建 | | `@deepseek-ai/dsh-agent-loop/invariant` | `@deepseek-ai/dsh-agent-loop` | 模型请求重建 |
个所有者保存自己的源码与聚焦测试。每个伴随入口都是单独打包的 `./invariant` export,具有独立声明和对 Loader 安全的命名空间插件形态服务包只保留注册服务测试 这四个所有者保存有状态检查与聚焦测试。其他每个包在获得关系断言之前,都带有生成的基线伴随插件。每个伴随入口都是单独打包的 `./invariant` export,具有独立声明和对 Loader 安全的命名空间插件形态服务包自身的伴随插件导入本地服务类型,避免形成自依赖
`verify-package-invariants` 会发现每个工作区包,并拒绝缺失或陈旧的伴随插件源码、外部或无法解析的注册名、缺失的 `./invariant` export 或发布文件、缺失的不变式对等依赖(peer dependency)、开发依赖及项目引用,以及遗漏伴随入口的自定义构建配置。生成器只写入缺失或带生成标记的所有权基线,因此绝不会替换包自行维护的实现。
### Scoped event 语义映射 ### Scoped event 语义映射
@@ -70,7 +74,7 @@ blocklist 匹配优先于 allowlist 匹配。每个条目都是区分大小写
### 标准组合与 SDK 输出 ### 标准组合与 SDK 输出
标准 agent spine 会挂载服务和四个伴随子路径,并把 `enabled``package_allowlist``package_blocklist` 转发给服务。生成的 SDK Cordis 组合输出相同条目。子路径条目添加可安装的根 npm 包,而不会把子路径误当成包名。 标准 agent spine 会挂载服务和四个有状态伴随子路径,并把 `enabled``package_allowlist``package_blocklist` 转发给服务。生成的 SDK Cordis 组合输出相同条目。子路径条目添加可安装的根 npm 包,而不会把子路径误当成包名。
Workspace 约束识别独立的不变式 bundle;包 exports、项目引用、构建配置、依赖声明和 lockfile 描述同一发布表面。生成的配置目录、模块图和 API 文档都从这些源派生。 Workspace 约束识别独立的不变式 bundle;包 exports、项目引用、构建配置、依赖声明和 lockfile 描述同一发布表面。生成的配置目录、模块图和 API 文档都从这些源派生。
@@ -80,18 +84,22 @@ Workspace 约束识别独立的不变式 bundle;包 exports、项目引用、
组合测试覆盖标准 spine 转发和生成的 SDK 条目。Loader 测试固定每个伴随命名空间,构建后的纯 Node smoke 覆盖编译子路径 export。scoped event 新鲜度门禁会重新执行语义 Program 分析。 组合测试覆盖标准 spine 转发和生成的 SDK 条目。Loader 测试固定每个伴随命名空间,构建后的纯 Node smoke 覆盖编译子路径 export。scoped event 新鲜度门禁会重新执行语义 Program 分析。
每个 Vitest 配置都会加载测试宿主;在普通 Cordis 根上下文启动第一个插件之前,宿主会挂载显式启用的服务以及所有包的伴随插件。服务与所有者的聚焦测试自行构建不变式拓扑,从而在不发生重复所有权冲突的前提下覆盖关闭、过滤、回滚与重载。门禁测试还会执行每个伴随插件的 `apply` 函数,并验证它调用 `register` 时使用包清单中的包名,而不是只检查源码文本。
## 考虑过的替代方案 ## 考虑过的替代方案
- **把所有检查保留在 `dsh-invariants`。** 不予采纳,因为注册包仍要导入所有被检查的产品领域,所有者变更仍需中央编辑,测试也继续远离被保护的契约。 - **把所有检查保留在 `dsh-invariants`。** 不予采纳,因为注册包仍要导入所有被检查的产品领域,所有者变更仍需中央编辑,测试也继续远离被保护的契约。
- **当 `ctx.invariants` 恰好存在时,让根包入口隐式注册检查。** 不予采纳,因为根入口行为会依赖组合顺序与可选服务是否存在,诊断无法独立选择,而且包加载会隐藏一个不在显式伴随插件中的注册 effect。 - **当 `ctx.invariants` 恰好存在时,让根包入口隐式注册检查。** 不予采纳,因为根入口行为会依赖组合顺序与可选服务是否存在,诊断无法独立选择,而且包加载会隐藏一个不在显式伴随插件中的注册 effect。
- **自动发现所有 `invariant.ts` 文件。** 不予采纳,因为文件系统或包发现不是运行时所有权契约,会让 bundle 发布含义不清,也无法表达显式 Cordis 加载顺序或依赖安装。 - **在运行时自动发现所有 `invariant.ts` 文件。** 不予采纳,因为文件系统或包发现不是运行时所有权契约,会让 bundle 发布含义不清,也无法表达显式 Cordis 加载顺序或依赖安装。构建期生成与校验以及测试 host 可以枚举源码树,因为它们验证的是仓库完整性,而不是组合已发布的部署。
- **根据当前已加载包集合验证 allow/block 条目。** 不予采纳,因为零匹配模式可能有意指向稍后加载或 HMR 加载的贡献;当前加载顺序不能决定配置有效性。 - **根据当前已加载包集合验证 allow/block 条目。** 不予采纳,因为零匹配模式可能有意指向稍后加载或 HMR 加载的贡献;当前加载顺序不能决定配置有效性。
## 后果 ## 后果
- 产品包拥有并测试自己的关系断言,服务保持与产品无关。 - 产品包拥有并测试自己的关系断言,服务保持与产品无关。
- 每个包都要承担不变式伴随插件带来的少量发布与依赖成本,包括目前只安装生成基线、不添加监听器的包。
- 标准组合无需改变插件树即可关闭全部检查或按包名选择。 - 标准组合无需改变插件树即可关闭全部检查或按包名选择。
- 显式伴随条目让诊断成本和所有权在 Cordis 配置与包 export 中可见。 - 显式伴随条目让诊断成本和所有权在 Cordis 配置与包 export 中可见。
- 每个选中贡献增加一个子 fiber 及其监听器和状态成本;被过滤注册只保留包名占用。 - 每个选中贡献增加一个子 fiber 及其监听器和状态成本;被过滤注册只保留包名占用。
- 正则表达式源属于部署配置,在服务重载前保持固定。 - 正则表达式源属于部署配置,在服务重载前保持固定。
- 普通 Vitest 根上下文会安装每个被选中的伴随插件,以增加测试期间的子 fiber 为代价,换取覆盖整个仓库的不变式检查和对 fixture(测试前置数据)错误的即时反馈。
- 会话存储验证、快照、冻结、provenance 与 surface 接受规则始终启用,不受不变式选择影响。 - 会话存储验证、快照、冻结、provenance 与 surface 接受规则始终启用,不受不变式选择影响。
@@ -28,7 +28,7 @@ A migration of the event/vocabulary surface to runtime schemas touches, at minim
- **Six merge-extensible maps** (~370 LOC of core types): `ContentBlockMap`, `MessageSourceMap`, `FinishReasonMap` (in `dsh-llm`); `TurnTriggerMap`, `TurnEndReasonMap`, `SessionEventMap` (in `dsh-session`). - **Six merge-extensible maps** (~370 LOC of core types): `ContentBlockMap`, `MessageSourceMap`, `FinishReasonMap` (in `dsh-llm`); `TurnTriggerMap`, `TurnEndReasonMap`, `SessionEventMap` (in `dsh-session`).
- **~10 `declare module` augmentation sites** across `dsh-agent`, `dsh-agent-loop`, `dsh-bash`, `dsh-llm`, `dsh-session`, `dsh-session-persistence`, `dsh-system-prompt`, `dsh-tools` — each would move from declaration merging to a runtime `register()` call. - **~10 `declare module` augmentation sites** across `dsh-agent`, `dsh-agent-loop`, `dsh-bash`, `dsh-llm`, `dsh-session`, `dsh-session-persistence`, `dsh-system-prompt`, `dsh-tools` — each would move from declaration merging to a runtime `register()` call.
- **The event producers** — 16 `session.append(...)` call sites in the loop — unchanged in shape but now validated at the boundary. - **The event producers** — 16 `session.append(...)` call sites in the loop — unchanged in shape but now validated at the boundary.
- **~7 switch-consumers** that branch on these unions: `deriveMessages` and the optional invariant companion (`dsh-session`), `BlockAssembler` (`dsh-llm`), both LLM adapters (`dsh-llm-deepseek`, `dsh-llm-pi-ai`), and the tool schema layer (`dsh-tools`). The `assertNever`-on-closed-unions vs fall-through-on-extensible-unions convention (a documented lint rule) would need rethinking — runtime variants are not statically exhaustive. - **~7 switch-consumers** that branch on these unions: `deriveMessages` and the package-owned invariant companion (`dsh-session`), `BlockAssembler` (`dsh-llm`), both LLM adapters (`dsh-llm-deepseek`, `dsh-llm-pi-ai`), and the tool schema layer (`dsh-tools`). The `assertNever`-on-closed-unions vs fall-through-on-extensible-unions convention (a documented lint rule) would need rethinking — runtime variants are not statically exhaustive.
- **The `defineTool` `InferArgs` DSL** (`dsh-tools`), which derives zero-cast `execute` arg types from a compile-time schema spec — the showcase of the current approach. - **The `defineTool` `InferArgs` DSL** (`dsh-tools`), which derives zero-cast `execute` arg types from a compile-time schema spec — the showcase of the current approach.
- **Docs**: architecture.md (the pattern is described as foundational), [dev-mode invariants](../../implemented/architecture/2026-06-11-dev-invariants-over-deep-readonly.md), and any RFC that references the pattern. - **Docs**: architecture.md (the pattern is described as foundational), [dev-mode invariants](../../implemented/architecture/2026-06-11-dev-invariants-over-deep-readonly.md), and any RFC that references the pattern.
@@ -37,7 +37,7 @@ This is a repository-wide vocabulary redesign, not a persistence implementation
## Alternatives considered ## Alternatives considered
### A. Status quo — merge-extensible types + `isJsonValue` at the durable boundary ### A. Status quo — merge-extensible types + `isJsonValue` at the durable boundary
Keep the compile-time pattern. Persistence stays opaque-JSON + serializability guard. Plugins extend via declaration merging; correctness of event *shape* is the producer's responsibility and is enforced by TypeScript at compile time. Package-owned invariant companions check selected cross-record relationships in dev but do not provide general runtime shape schemas. Keep the compile-time pattern. Persistence stays opaque-JSON + serializability guard. Plugins extend via declaration merging; correctness of event *shape* is the producer's responsibility and is enforced by TypeScript at compile time. Package-owned invariant companions check selected cross-record relationships when enabled but do not provide general runtime shape schemas.
- **Pros**: zero churn; plugin extension is a one-line `interface` augmentation with full type inference and no runtime registration ceremony; no new runtime dependency; the `defineTool` DSL and `assertNever` exhaustiveness keep working. - **Pros**: zero churn; plugin extension is a one-line `interface` augmentation with full type inference and no runtime registration ceremony; no new runtime dependency; the `defineTool` DSL and `assertNever` exhaustiveness keep working.
- **Cons**: no runtime structural validation at the persistence boundary or at plugin seams; a malformed-but-JSON datum is caught late. - **Cons**: no runtime structural validation at the persistence boundary or at plugin seams; a malformed-but-JSON datum is caught late.
@@ -72,4 +72,4 @@ Defer. If runtime validation is wanted at the durable boundary, **Option B** (sc
- If a registry is adopted, is the library **schemastery** (already in the tree, already the config schema lib) or **Zod** (richer ecosystem, currently only transitive)? Adopting two schema libraries is a cost in itself. - If a registry is adopted, is the library **schemastery** (already in the tree, already the config schema lib) or **Zod** (richer ecosystem, currently only transitive)? Adopting two schema libraries is a cost in itself.
- Can a hybrid keep compile-time inference (so `defineTool` and plugin DX survive) while adding an *optional* runtime schema per variant, validated only at the persistence/wire boundary rather than on every in-process append? - Can a hybrid keep compile-time inference (so `defineTool` and plugin DX survive) while adding an *optional* runtime schema per variant, validated only at the persistence/wire boundary rather than on every in-process append?
- Does the `dsh-invariants` plugin already cover enough of the runtime-shape gap in dev that boundary validation is only needed for genuinely untrusted input (reload of an externally-modified log)? - Does the `ctx.invariants` service already cover enough of the runtime-shape gap when enabled that boundary validation is only needed for genuinely untrusted input (reload of an externally-modified log)?
+2
View File
@@ -9,6 +9,8 @@ How this repo tests, tier by tier, and the rules that keep a green suite meaning
- **Real-API e2e** (`pnpm run test:e2e`): with-key tests against live provider APIs — the DeepSeek model plus provider-specific smokes that gate on their own keys (`EXA_API_KEY`, `PERPLEXITY_API_KEY`, …); each suite self-skips without its key so keyless CI stays green ([real-API e2e RFC](rfc/implemented/testing/2026-06-19-real-api-e2e-ci.md)). - **Real-API e2e** (`pnpm run test:e2e`): with-key tests against live provider APIs — the DeepSeek model plus provider-specific smokes that gate on their own keys (`EXA_API_KEY`, `PERPLEXITY_API_KEY`, …); each suite self-skips without its key so keyless CI stays green ([real-API e2e RFC](rfc/implemented/testing/2026-06-19-real-api-e2e-ci.md)).
- **Snapshot** (`pnpm run test:snapshot`): transport-specific keyless goldens cover external presentation. ACP suites boot the real example subprocess, replay a recorded session, and diff normalized JSON-RPC plus the re-persisted log ([ACP snapshot RFC](rfc/implemented/testing/2026-06-19-acp-snapshot-tests.md)); the headless suite independently pins `stream-json` through its real one-shot subprocess. TUI completed journeys replay recorded primary/child JSONL through the real agent loop and tools before projecting ANSI into semantic terminal-state goldens; package-local snapshots retain transient renderer states, and a real PTY conversation covers the process boundary ([TUI snapshot RFC](rfc/implemented/testing/2026-07-18-tui-terminal-state-snapshots.md)). Use `pnpm run test:snapshot:record` when a model transcript must change and `pnpm run test:snapshot:refresh` when committed replay input remains correct; review every JSONL and golden diff. System-prompt/tool-schema content is pinned by one ACP scenario (`text-turn`) and tokenized in every other fixture, so a prompt or schema edit churns one committed line ([pinned-header RFC](rfc/implemented/testing/2026-07-06-pin-request-header-content-in-one-scenario.md)). - **Snapshot** (`pnpm run test:snapshot`): transport-specific keyless goldens cover external presentation. ACP suites boot the real example subprocess, replay a recorded session, and diff normalized JSON-RPC plus the re-persisted log ([ACP snapshot RFC](rfc/implemented/testing/2026-06-19-acp-snapshot-tests.md)); the headless suite independently pins `stream-json` through its real one-shot subprocess. TUI completed journeys replay recorded primary/child JSONL through the real agent loop and tools before projecting ANSI into semantic terminal-state goldens; package-local snapshots retain transient renderer states, and a real PTY conversation covers the process boundary ([TUI snapshot RFC](rfc/implemented/testing/2026-07-18-tui-terminal-state-snapshots.md)). Use `pnpm run test:snapshot:record` when a model transcript must change and `pnpm run test:snapshot:refresh` when committed replay input remains correct; review every JSONL and golden diff. System-prompt/tool-schema content is pinned by one ACP scenario (`text-turn`) and tokenized in every other fixture, so a prompt or schema edit churns one committed line ([pinned-header RFC](rfc/implemented/testing/2026-07-06-pin-request-header-content-in-one-scenario.md)).
All Vitest configurations mount enabled `ctx.invariants` and every package companion before ordinary Cordis roots start. Focused invariant topology tests compose enabled or deliberately disabled services explicitly, without competing global registrations.
## The with-key policy: inference is cheap here ## The with-key policy: inference is cheap here
We are DeepSeek — do not ration real-API tests. A no-key test proves plumbing; only a with-key run proves the agent works against a real model. Write many: file-writing prompts, multi-turn conversations, tool use, cancellation mid-stream. Highest-value are **smoke tests** that boot the real example, send one real prompt, and check the world — they catch the "green unit tests, broken product" class that mocks structurally cannot ([postmortem 0001](postmortem/0001-acp-default-export-drops-inject.md)). The self-skip exists only so secretless CI and keyless contributors aren't blocked; it is not a cost signal. Every example ships a keyless smoke and — unless keyless-by-nature — a with-key smoke ([examples/AGENTS.md](../examples/AGENTS.md)). We are DeepSeek — do not ration real-API tests. A no-key test proves plumbing; only a with-key run proves the agent works against a real model. Write many: file-writing prompts, multi-turn conversations, tool use, cancellation mid-stream. Highest-value are **smoke tests** that boot the real example, send one real prompt, and check the world — they catch the "green unit tests, broken product" class that mocks structurally cannot ([postmortem 0001](postmortem/0001-acp-default-export-drops-inject.md)). The self-skip exists only so secretless CI and keyless contributors aren't blocked; it is not a cost signal. Every example ships a keyless smoke and — unless keyless-by-nature — a with-key smoke ([examples/AGENTS.md](../examples/AGENTS.md)).
+7 -14
View File
@@ -35,23 +35,19 @@
"project": ["src/**/*.ts", "tests/**/*.ts"] "project": ["src/**/*.ts", "tests/**/*.ts"]
}, },
"packages/util/brand": { "packages/util/brand": {
"project": ["src/**/*.ts"], "project": ["src/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/util/home": { "packages/util/home": {
"entry": ["tests/**/*.spec.ts"], "entry": ["tests/**/*.spec.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/util/timeout": { "packages/util/timeout": {
"entry": ["tests/**/*.spec.ts"], "entry": ["tests/**/*.spec.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/util/retention": { "packages/util/retention": {
"entry": ["tests/**/*.spec.ts"], "entry": ["tests/**/*.spec.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/support/acp-snapshot": { "packages/support/acp-snapshot": {
"entry": ["tests/**/*.spec.ts", "tests/fixtures/fake-acp-agent.ts"], "entry": ["tests/**/*.spec.ts", "tests/fixtures/fake-acp-agent.ts"],
@@ -59,8 +55,7 @@
}, },
"packages/support/loader-smoke": { "packages/support/loader-smoke": {
"entry": ["tests/**/*.spec.ts", "tests/fixtures/*.ts"], "entry": ["tests/**/*.spec.ts", "tests/fixtures/*.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/core/agent-loop": { "packages/core/agent-loop": {
"entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"], "entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"],
@@ -84,8 +79,7 @@
}, },
"packages/util/paths": { "packages/util/paths": {
"entry": ["tests/**/*.spec.ts"], "entry": ["tests/**/*.spec.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/web/web-search-exa": { "packages/web/web-search-exa": {
"entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"], "entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"],
@@ -149,8 +143,7 @@
}, },
"packages/subagent/subagent-subprocess": { "packages/subagent/subagent-subprocess": {
"entry": ["tests/**/*.spec.ts"], "entry": ["tests/**/*.spec.ts"],
"project": ["src/**/*.ts", "tests/**/*.ts"], "project": ["src/**/*.ts", "tests/**/*.ts"]
"ignoreDependencies": ["cordis"]
}, },
"packages/fs/tool-fs": { "packages/fs/tool-fs": {
"entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"], "entry": ["tests/**/*.spec.ts", "tests/**/*.e2e.ts"],
+3 -1
View File
@@ -40,6 +40,8 @@
"verify-md-links": "tsx scripts/verify-md-links.ts", "verify-md-links": "tsx scripts/verify-md-links.ts",
"verify-doc-refs": "tsx scripts/verify-doc-refs.ts", "verify-doc-refs": "tsx scripts/verify-doc-refs.ts",
"verify-package-paths": "tsx scripts/verify-package-paths.ts", "verify-package-paths": "tsx scripts/verify-package-paths.ts",
"gen-package-invariants": "tsx scripts/gen-package-invariants.ts",
"verify-package-invariants": "tsx scripts/gen-package-invariants.ts --check",
"verify-package-readme-model-experience": "tsx scripts/verify-package-readme-model-experience.ts", "verify-package-readme-model-experience": "tsx scripts/verify-package-readme-model-experience.ts",
"verify-mermaid": "tsx scripts/verify-mermaid.ts", "verify-mermaid": "tsx scripts/verify-mermaid.ts",
"verify-rfc-classification": "tsx scripts/verify-rfc-classification.ts", "verify-rfc-classification": "tsx scripts/verify-rfc-classification.ts",
@@ -77,7 +79,7 @@
"website:build": "pnpm --filter @deepseek-ai/website run build", "website:build": "pnpm --filter @deepseek-ai/website run build",
"constraints": "tsx scripts/check-workspace-constraints.ts", "constraints": "tsx scripts/check-workspace-constraints.ts",
"doc-sync": "pnpm run doc-typecheck && pnpm run verify-cordis-catalog && pnpm run verify-cordis-api && pnpm run verify-export-jsdoc && pnpm run verify-tool-catalog && pnpm run verify-config-catalog && pnpm run verify-persistence-catalog && pnpm run verify-doc-graphs && pnpm run verify-scoped-events && pnpm run verify-website-api && pnpm run verify-md-wrap && pnpm run verify-md-links && pnpm run verify-doc-refs && pnpm run verify-package-paths && pnpm run verify-package-readme-model-experience && pnpm run verify-mermaid && pnpm run verify-rfc-classification && pnpm run verify-rfc-format && pnpm run verify-type-equiv && pnpm run verify-translation-prompt && pnpm run verify-translation-pairing && pnpm run verify-doc-budgets && pnpm run verify-package-readme-limitations && pnpm run verify-website-yaml", "doc-sync": "pnpm run doc-typecheck && pnpm run verify-cordis-catalog && pnpm run verify-cordis-api && pnpm run verify-export-jsdoc && pnpm run verify-tool-catalog && pnpm run verify-config-catalog && pnpm run verify-persistence-catalog && pnpm run verify-doc-graphs && pnpm run verify-scoped-events && pnpm run verify-website-api && pnpm run verify-md-wrap && pnpm run verify-md-links && pnpm run verify-doc-refs && pnpm run verify-package-paths && pnpm run verify-package-readme-model-experience && pnpm run verify-mermaid && pnpm run verify-rfc-classification && pnpm run verify-rfc-format && pnpm run verify-type-equiv && pnpm run verify-translation-prompt && pnpm run verify-translation-pairing && pnpm run verify-doc-budgets && pnpm run verify-package-readme-limitations && pnpm run verify-website-yaml",
"hygiene": "pnpm run knip && pnpm run publint && pnpm run constraints && pnpm run verify-cordis-config && pnpm run verify-node-next-types && pnpm run verify-runtime-closure", "hygiene": "pnpm run knip && pnpm run publint && pnpm run constraints && pnpm run verify-package-invariants && pnpm run verify-cordis-config && pnpm run verify-node-next-types && pnpm run verify-runtime-closure",
"demo:echo": "node --expose-internals --import tsx packages/examples/stdio-demo/src/bin.ts examples/echo-agent/cordis.yml", "demo:echo": "node --expose-internals --import tsx packages/examples/stdio-demo/src/bin.ts examples/echo-agent/cordis.yml",
"demo:repl": "node --expose-internals --import tsx packages/examples/stdio-demo/src/bin.ts examples/repl-agent/cordis.yml", "demo:repl": "node --expose-internals --import tsx packages/examples/stdio-demo/src/bin.ts examples/repl-agent/cordis.yml",
"demo:headless": "node --expose-internals --import tsx packages/examples/cli-demo/src/bin.ts --config examples/headless-agent/cordis.yml", "demo:headless": "node --expose-internals --import tsx packages/examples/cli-demo/src/bin.ts --config examples/headless-agent/cordis.yml",
+1
View File
@@ -16,6 +16,7 @@ These package-specific rules supplement the repo-wide [conventions](../AGENTS.md
- **Publish state only at its commit point.** Emit each notification and update derived state only after the success boundary that makes it true; derive caches, prompts, UI echoes, replay, and query views from one authoritative source. - **Publish state only at its commit point.** Emit each notification and update derived state only after the success boundary that makes it true; derive caches, prompts, UI echoes, replay, and query views from one authoritative source.
- **Apply bounds to the complete result.** Enforce byte, token, item, and time limits where the complete emitted or retained value, including wrappers and metadata, is known; test tiny and exact limits, oversized single chunks, and multibyte byte limits. - **Apply bounds to the complete result.** Enforce byte, token, item, and time limits where the complete emitted or retained value, including wrappers and metadata, is known; test tiny and exact limits, oversized single chunks, and multibyte byte limits.
- **Registry contributions prove disposal.** Add the HMR-safety test required by the [testing policy](../docs/testing.md): dispose the contributing fiber and observe removal. - **Registry contributions prove disposal.** Add the HMR-safety test required by the [testing policy](../docs/testing.md): dispose the contributing fiber and observe removal.
- **Every package owns an invariant companion.** Publish `./invariant`, register the manifest's exact npm name, and keep the generated ownership baseline until relational checks exist. `verify-package-invariants` gates source and publication wiring ([rationale](../docs/rfc/implemented/architecture/2026-07-19-package-owned-invariant-service.md)).
Naming notes: Naming notes:
+7
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,6 +28,7 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-bash": "^0.0.1", "@deepseek-ai/dsh-bash": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-timeout": "^0.0.1", "@deepseek-ai/dsh-timeout": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
@@ -31,6 +37,7 @@
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-bash": "workspace:^", "@deepseek-ai/dsh-bash": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-timeout": "workspace:^", "@deepseek-ai/dsh-timeout": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-bash-local`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-bash-local/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-bash-local'
/** Cordis companion plugin name. */
export const name = 'bash-local-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -25,6 +25,9 @@
}, },
{ {
"path": "../../bash/bash" "path": "../../bash/bash"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+9 -2
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -24,6 +29,7 @@
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-bash": "^0.0.1", "@deepseek-ai/dsh-bash": "^0.0.1",
"@deepseek-ai/dsh-bash-local": "^0.0.1", "@deepseek-ai/dsh-bash-local": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-sandbox": "^0.0.1", "@deepseek-ai/dsh-sandbox": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
@@ -33,9 +39,10 @@
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-bash": "workspace:^", "@deepseek-ai/dsh-bash": "workspace:^",
"@deepseek-ai/dsh-bash-local": "workspace:^", "@deepseek-ai/dsh-bash-local": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-sandbox": "workspace:^", "@deepseek-ai/dsh-sandbox": "workspace:^",
"@deepseek-ai/dsh-sandbox-local": "workspace:^", "@deepseek-ai/dsh-sandbox-local": "workspace:^",
"node-addon-landlock-run": "0.0.0-test.0", "cordis": "^4.0.0-rc.7",
"cordis": "^4.0.0-rc.7" "node-addon-landlock-run": "0.0.0-test.0"
} }
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-bash-sandbox`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-bash-sandbox/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-bash-sandbox'
/** Cordis companion plugin name. */
export const name = 'bash-sandbox-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -31,6 +31,9 @@
}, },
{ {
"path": "../../bash/bash-local" "path": "../../bash/bash-local"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+7
View File
@@ -11,22 +11,29 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
], ],
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-sandbox": "^0.0.1", "@deepseek-ai/dsh-sandbox": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-sandbox": "workspace:^", "@deepseek-ai/dsh-sandbox": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-bash`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-bash/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-bash'
/** Cordis companion plugin name. */
export const name = 'bash-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -19,6 +19,9 @@
}, },
{ {
"path": "../../core/session" "path": "../../core/session"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+10 -3
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,15 +28,16 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-user-approval": "^0.0.1",
"@deepseek-ai/dsh-bash": "^0.0.1", "@deepseek-ai/dsh-bash": "^0.0.1",
"@deepseek-ai/dsh-home": "^0.0.1", "@deepseek-ai/dsh-home": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session-persistence": "^0.0.1",
"@deepseek-ai/dsh-sandbox": "^0.0.1", "@deepseek-ai/dsh-sandbox": "^0.0.1",
"@deepseek-ai/dsh-session-persistence": "^0.0.1",
"@deepseek-ai/dsh-system-prompt": "^0.0.1", "@deepseek-ai/dsh-system-prompt": "^0.0.1",
"@deepseek-ai/dsh-tasks": "^0.0.1", "@deepseek-ai/dsh-tasks": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"@deepseek-ai/dsh-user-approval": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"dependencies": { "dependencies": {
@@ -41,10 +47,10 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-agent-loop-testkit": "workspace:^", "@deepseek-ai/dsh-agent-loop-testkit": "workspace:^",
"@deepseek-ai/dsh-user-approval": "workspace:^",
"@deepseek-ai/dsh-bash": "workspace:^", "@deepseek-ai/dsh-bash": "workspace:^",
"@deepseek-ai/dsh-bash-local": "workspace:^", "@deepseek-ai/dsh-bash-local": "workspace:^",
"@deepseek-ai/dsh-home": "workspace:^", "@deepseek-ai/dsh-home": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-sandbox": "workspace:^", "@deepseek-ai/dsh-sandbox": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
@@ -54,6 +60,7 @@
"@deepseek-ai/dsh-tasks": "workspace:^", "@deepseek-ai/dsh-tasks": "workspace:^",
"@deepseek-ai/dsh-tool-tasks": "workspace:^", "@deepseek-ai/dsh-tool-tasks": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^",
"@deepseek-ai/dsh-user-approval": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-tool-bash`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-tool-bash/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-tool-bash'
/** Cordis companion plugin name. */
export const name = 'tool-bash-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -46,6 +46,9 @@
}, },
{ {
"path": "../../sandbox/sandbox" "path": "../../sandbox/sandbox"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -11,6 +11,10 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./worker": { "./worker": {
"types": "./lib/types/worker.d.ts", "types": "./lib/types/worker.d.ts",
"default": "./lib/worker.cjs" "default": "./lib/worker.cjs"
@@ -19,6 +23,7 @@
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/worker.cjs", "lib/worker.cjs",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
@@ -27,6 +32,7 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-code-runtime": "^0.0.1", "@deepseek-ai/dsh-code-runtime": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"dependencies": { "dependencies": {
@@ -34,6 +40,7 @@
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-code-runtime": "workspace:^", "@deepseek-ai/dsh-code-runtime": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-code-runtime-worker`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-code-runtime-worker/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-code-runtime-worker'
/** Cordis companion plugin name. */
export const name = 'code-runtime-worker-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -19,6 +19,9 @@
}, },
{ {
"path": "../code-runtime" "path": "../code-runtime"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -7,7 +7,7 @@ import { defineConfig } from 'tsdown'
*/ */
export default defineConfig([ export default defineConfig([
{ {
entry: ['lib/types/index.js'], entry: ['lib/types/index.js', 'lib/types/invariant.js'],
outDir: 'lib', outDir: 'lib',
format: ['esm'], format: ['esm'],
platform: 'node', platform: 'node',
@@ -11,20 +11,27 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
], ],
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-invariants": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-code-runtime`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-code-runtime/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-code-runtime'
/** Cordis companion plugin name. */
export const name = 'code-runtime-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -13,6 +13,9 @@
}, },
{ {
"path": "../../../vendor/cordis" "path": "../../../vendor/cordis"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -24,6 +29,7 @@
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-compact": "^0.0.1", "@deepseek-ai/dsh-compact": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-token-meter": "^0.0.1", "@deepseek-ai/dsh-token-meter": "^0.0.1",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-compact-basic`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-compact-basic/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-compact-basic'
/** Cordis companion plugin name. */
export const name = 'compact-basic-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -10,7 +10,7 @@ import LlmService, { CallId, CONTEXT_WINDOW_EXCEEDED_CODE, LlmAdapter } from '@d
import type { ContentBlock, GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm' import type { ContentBlock, GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
import { Session, SessionId } from '@deepseek-ai/dsh-session' import { Session, SessionId } from '@deepseek-ai/dsh-session'
import TokenMeterService from '@deepseek-ai/dsh-token-meter' import TokenMeterService from '@deepseek-ai/dsh-token-meter'
import type { Agent } from '@deepseek-ai/dsh-agent' import { agentEvents, type Agent } from '@deepseek-ai/dsh-agent'
const SIGNAL = new AbortController().signal const SIGNAL = new AbortController().signal
const MODEL = 'test-model' const MODEL = 'test-model'
@@ -791,7 +791,7 @@ describe('default one-shot summarizer', () => {
describe('automatic listener and loader composition', () => { describe('automatic listener and loader composition', () => {
function postStep(ctx: Context, owner: Agent, signal = SIGNAL): Promise<unknown> { function postStep(ctx: Context, owner: Agent, signal = SIGNAL): Promise<unknown> {
return ctx.serial('agent/post-step', owner, 1, 1, signal) return agentEvents(ctx, owner).serial('agent/post-step', 1, 1, signal)
} }
function recover( function recover(
@@ -802,7 +802,9 @@ describe('automatic listener and loader composition', () => {
signal = SIGNAL, signal = SIGNAL,
next: () => Promise<{ action: 'fail' | 'retry' }> = () => Promise.resolve({ action: 'fail' }), next: () => Promise<{ action: 'fail' | 'retry' }> = () => Promise.resolve({ action: 'fail' }),
): Promise<{ action: 'fail' | 'retry' }> { ): Promise<{ action: 'fail' | 'retry' }> {
return ctx.waterfall('agent/request-error', owner, 1, 1, error, retryAttempt, signal, next) return agentEvents(ctx, owner).waterfall(
'agent/request-error', 1, 1, error, retryAttempt, signal, next,
)
} }
function overflow(message = 'provider overflow'): Error & { code: string } { function overflow(message = 'provider overflow'): Error & { code: string } {
+27 -8
View File
@@ -6,13 +6,32 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../../vendor/schemastery" }, },
{ "path": "../../llm/llm" }, {
{ "path": "../../llm/token-meter" }, "path": "../../../vendor/cordis"
{ "path": "../../core/session" }, },
{ "path": "../../core/agent" }, {
{ "path": "../compact" } "path": "../../../vendor/schemastery"
},
{
"path": "../../llm/llm"
},
{
"path": "../../llm/token-meter"
},
{
"path": "../../core/session"
},
{
"path": "../../core/agent"
},
{
"path": "../compact"
},
{
"path": "../../support/invariants"
}
] ]
} }
+7
View File
@@ -11,22 +11,29 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
], ],
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-compact`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-compact/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-compact'
/** Cordis companion plugin name. */
export const name = 'compact-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -19,6 +19,9 @@
}, },
{ {
"path": "../../core/session" "path": "../../core/session"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -26,12 +31,14 @@
}, },
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-agent-loop-testkit": "workspace:^", "@deepseek-ai/dsh-agent-loop-testkit": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-loader-smoke": "workspace:^", "@deepseek-ai/dsh-loader-smoke": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-time-context`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-time-context/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-time-context'
/** Cordis companion plugin name. */
export const name = 'time-context-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -4,8 +4,7 @@ import Loader from '@cordisjs/plugin-loader'
import { CallId, LlmAdapter } from '@deepseek-ai/dsh-llm' import { CallId, LlmAdapter } from '@deepseek-ai/dsh-llm'
import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm' import type { GenerateOptions, StreamChunk } from '@deepseek-ai/dsh-llm'
import { Session, SessionId } from '@deepseek-ai/dsh-session' import { Session, SessionId } from '@deepseek-ai/dsh-session'
import AgentRegistry from '@deepseek-ai/dsh-agent' import AgentRegistry, { agentEvents, type Agent } from '@deepseek-ai/dsh-agent'
import type { Agent } from '@deepseek-ai/dsh-agent'
import { defineTool } from '@deepseek-ai/dsh-tools' import { defineTool } from '@deepseek-ai/dsh-tools'
import AgentLoop from '@deepseek-ai/dsh-agent-loop' import AgentLoop from '@deepseek-ai/dsh-agent-loop'
import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit' import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit'
@@ -83,7 +82,7 @@ async function fire(
step: number, step: number,
signal: AbortSignal = SIGNAL, signal: AbortSignal = SIGNAL,
): Promise<void> { ): Promise<void> {
await ctx.serial('agent/pre-step', agent, turn, step, signal) await agentEvents(ctx, agent).serial('agent/pre-step', turn, step, signal)
} }
function textResponse(text: string): StreamChunk[] { function textResponse(text: string): StreamChunk[] {
+27 -8
View File
@@ -6,13 +6,32 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../../vendor/schemastery" }, },
{ "path": "../../llm/llm" }, {
{ "path": "../../core/agent" }, "path": "../../../vendor/cordis"
{ "path": "../../core/system-prompt" }, },
{ "path": "../../core/agent" }, {
{ "path": "../../support/loader-smoke" } "path": "../../../vendor/schemastery"
},
{
"path": "../../llm/llm"
},
{
"path": "../../core/agent"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../../core/agent"
},
{
"path": "../../support/loader-smoke"
},
{
"path": "../../support/invariants"
}
] ]
} }
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -24,6 +29,7 @@
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-fs": "^0.0.1", "@deepseek-ai/dsh-fs": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-paths": "^0.0.1", "@deepseek-ai/dsh-paths": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
@@ -39,6 +45,7 @@
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-fs": "workspace:^", "@deepseek-ai/dsh-fs": "workspace:^",
"@deepseek-ai/dsh-fs-local": "workspace:^", "@deepseek-ai/dsh-fs-local": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-llm-deepseek": "workspace:^", "@deepseek-ai/dsh-llm-deepseek": "workspace:^",
"@deepseek-ai/dsh-paths": "workspace:^", "@deepseek-ai/dsh-paths": "workspace:^",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-workspace-context`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-workspace-context/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-workspace-context'
/** Cordis companion plugin name. */
export const name = 'workspace-context-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -7,8 +7,9 @@ import Loader from '@cordisjs/plugin-loader'
import * as workspaceContext from '@deepseek-ai/dsh-workspace-context' import * as workspaceContext from '@deepseek-ai/dsh-workspace-context'
import LlmService, { CallId, type Message, type StreamChunk } from '@deepseek-ai/dsh-llm' import LlmService, { CallId, type Message, type StreamChunk } from '@deepseek-ai/dsh-llm'
import SessionStore, { Session, SessionId, SESSION_FORMAT_VERSION, type SessionEvent } from '@deepseek-ai/dsh-session' import SessionStore, { Session, SessionId, SESSION_FORMAT_VERSION, type SessionEvent } from '@deepseek-ai/dsh-session'
import AgentRegistry, { type Agent, type HookContext } from '@deepseek-ai/dsh-agent' import AgentRegistry, { agentEvents, type Agent, type HookContext } from '@deepseek-ai/dsh-agent'
import AgentLoop from '@deepseek-ai/dsh-agent-loop' import AgentLoop from '@deepseek-ai/dsh-agent-loop'
import { scopeTarget } from '@deepseek-ai/dsh-scope'
import { FileSystem, FsTargetKey, FsVersion } from '@deepseek-ai/dsh-fs' import { FileSystem, FsTargetKey, FsVersion } from '@deepseek-ai/dsh-fs'
import type { import type {
FsDirEntry, FsDirEntry,
@@ -23,7 +24,12 @@ import type {
import LocalFileSystem from '@deepseek-ai/dsh-fs-local' import LocalFileSystem from '@deepseek-ai/dsh-fs-local'
import SystemPrompt from '@deepseek-ai/dsh-system-prompt' import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
import ToolRegistry, { defineTool } from '@deepseek-ai/dsh-tools' import ToolRegistry, { defineTool } from '@deepseek-ai/dsh-tools'
import type { ToolExecution, ToolExecutionToken } from '@deepseek-ai/dsh-tools' import type {
PostToolDecision,
ToolExecution,
ToolExecutionResult,
ToolExecutionToken,
} from '@deepseek-ai/dsh-tools'
import * as ToolFs from '@deepseek-ai/dsh-tool-fs' import * as ToolFs from '@deepseek-ai/dsh-tool-fs'
import { import {
discoverBaselineInstructionFiles, discoverBaselineInstructionFiles,
@@ -228,14 +234,31 @@ const composedPrefixes = new WeakMap<object, Message[]>()
async function composeBaselinePrefix(ctx: Context, agent: Agent): Promise<Message[]> { async function composeBaselinePrefix(ctx: Context, agent: Agent): Promise<Message[]> {
const empty: Message[] = [] const empty: Message[] = []
const prefix = await ctx.waterfall( const prefix = await agentEvents(ctx, agent).waterfall(
'agent/session-prefix', agent, empty, AbortSignal.timeout(1000), 'agent/session-prefix', empty, AbortSignal.timeout(1000),
() => Promise.resolve(empty), () => Promise.resolve(empty),
) )
composedPrefixes.set(agent, prefix) composedPrefixes.set(agent, prefix)
return prefix return prefix
} }
function toolEventCarrier(ctx: Context, exec: ToolExecution) {
return scopeTarget(ctx.get('tools') ?? ctx as unknown as ToolRegistry, exec.agent)
}
function postExecute(
ctx: Context,
exec: ToolExecution,
result: Readonly<ToolExecutionResult>,
next: () => Promise<PostToolDecision>,
): Promise<PostToolDecision> {
return ctx.waterfall(toolEventCarrier(ctx, exec), 'tools/post-execute', exec, result, next)
}
function emitToolResult(ctx: Context, exec: ToolExecution, result: Readonly<ToolExecutionResult>): void {
ctx.emit(toolEventCarrier(ctx, exec), 'tools/result', exec, result)
}
function derivedText(agent: Agent): string { function derivedText(agent: Agent): string {
return blocksText(composedPrefixes.get(agent)?.[0]?.content) return blocksText(composedPrefixes.get(agent)?.[0]?.content)
} }
@@ -796,7 +819,7 @@ describe('workspace context request injection', () => {
try { try {
await ctx.plugin(workspaceContext, { maxBytes: 65536 }) await ctx.plugin(workspaceContext, { maxBytes: 65536 })
const decision = await ctx.waterfall('tools/post-execute', stubToolExecution({ const decision = await postExecute(ctx, stubToolExecution({
callId: CallId('no-fs-post-execute'), callId: CallId('no-fs-post-execute'),
name: 'read', name: 'read',
arguments: { file_path: 'pkg/file.txt' }, arguments: { file_path: 'pkg/file.txt' },
@@ -843,7 +866,7 @@ describe('workspace context request injection', () => {
} }
// A later PostToolUse-style policy blocks this otherwise-successful read. // A later PostToolUse-style policy blocks this otherwise-successful read.
const blocked = await ctx.waterfall('tools/post-execute', exec, result, async () => ({ const blocked = await postExecute(ctx, exec, result, async () => ({
kind: 'block' as const, kind: 'block' as const,
feedback: [{ type: 'text' as const, text: 'blocked by policy' }], feedback: [{ type: 'text' as const, text: 'blocked by policy' }],
})) }))
@@ -857,7 +880,7 @@ describe('workspace context request injection', () => {
// The same read, when the downstream accepts, DOES surface the nested // The same read, when the downstream accepts, DOES surface the nested
// instructions — proving the block branch above is what suppressed them, // instructions — proving the block branch above is what suppressed them,
// and that the block did not consume the pending nested change. // and that the block did not consume the pending nested change.
const accepted = await ctx.waterfall('tools/post-execute', exec, result, async () => ({ const accepted = await postExecute(ctx, exec, result, async () => ({
kind: 'accept' as const, kind: 'accept' as const,
})) }))
expect(accepted.kind).toBe('accept') expect(accepted.kind).toBe('accept')
@@ -1169,8 +1192,9 @@ describe('workspace context request injection', () => {
const controller = new AbortController() const controller = new AbortController()
const reason = new Error('cancel prefix') const reason = new Error('cancel prefix')
const empty: Message[] = [] const empty: Message[] = []
const pending = ctx.waterfall( const agent = stubAgent(root)
'agent/session-prefix', stubAgent(root), empty, controller.signal, const pending = agentEvents(ctx, agent).waterfall(
'agent/session-prefix', empty, controller.signal,
() => Promise.resolve(empty), () => Promise.resolve(empty),
) )
@@ -1660,7 +1684,7 @@ describe('dynamic nested workspace context injection', () => {
signal: controller.signal, signal: controller.signal,
}) })
const pending = ctx.waterfall('tools/post-execute', exec, { const pending = postExecute(ctx, exec, {
content: [{ type: 'text', text: 'ok' }], content: [{ type: 'text', text: 'ok' }],
isError: false, isError: false,
}, () => Promise.resolve({ kind: 'accept' as const })) }, () => Promise.resolve({ kind: 'accept' as const }))
@@ -2387,12 +2411,12 @@ describe('dynamic nested workspace context injection', () => {
isError: false, isError: false,
} }
const failedStat = await ctx.waterfall('tools/post-execute', stubToolExecution({ const failedStat = await postExecute(ctx, stubToolExecution({
callId: CallId('provider-stat-failure'), name: 'read', arguments: { file_path: 'pkg/file.txt' }, agent, callId: CallId('provider-stat-failure'), name: 'read', arguments: { file_path: 'pkg/file.txt' }, agent,
}), result, async () => ({ kind: 'accept' as const })) }), result, async () => ({ kind: 'accept' as const }))
fs.throwOnStat.clear() fs.throwOnStat.clear()
fs.entries.set(join(root, 'pkg/AGENTS.md'), { type: 'directory' }) fs.entries.set(join(root, 'pkg/AGENTS.md'), { type: 'directory' })
const mismatchedStat = await ctx.waterfall('tools/post-execute', stubToolExecution({ const mismatchedStat = await postExecute(ctx, stubToolExecution({
callId: CallId('provider-stat-mismatch'), name: 'read', arguments: { file_path: 'pkg/file.txt' }, agent, callId: CallId('provider-stat-mismatch'), name: 'read', arguments: { file_path: 'pkg/file.txt' }, agent,
}), result, async () => ({ kind: 'accept' as const })) }), result, async () => ({ kind: 'accept' as const }))
@@ -2626,19 +2650,19 @@ describe('dynamic nested workspace context injection', () => {
const parent = Symbol('parent') as ToolExecutionToken const parent = Symbol('parent') as ToolExecutionToken
const plainResult = { callId: CallId('plain'), content: [], isError: false } const plainResult = { callId: CallId('plain'), content: [], isError: false }
ctx.emit('tools/result', stubToolExecution({ emitToolResult(ctx, stubToolExecution({
callId: CallId('agentless-child'), name: 'read', arguments: {}, parent, callId: CallId('agentless-child'), name: 'read', arguments: {}, parent,
}), plainResult) }), plainResult)
ctx.emit('tools/result', stubToolExecution({ emitToolResult(ctx, stubToolExecution({
callId: CallId('contextless-child'), name: 'read', arguments: {}, agent, parent, callId: CallId('contextless-child'), name: 'read', arguments: {}, agent, parent,
}), { ...plainResult, additionalContexts: [{ content: [], source: { kind: 'plugin', plugin: 'workspace-context' } }] }) }), { ...plainResult, additionalContexts: [{ content: [], source: { kind: 'plugin', plugin: 'workspace-context' } }] })
ctx.emit('tools/result', stubToolExecution({ emitToolResult(ctx, stubToolExecution({
callId: CallId('first-child'), name: 'read', arguments: {}, agent, parent, callId: CallId('first-child'), name: 'read', arguments: {}, agent, parent,
}), { ...plainResult, additionalContexts: [workspaceChangeContext('first', 'one')] }) }), { ...plainResult, additionalContexts: [workspaceChangeContext('first', 'one')] })
ctx.emit('tools/result', stubToolExecution({ emitToolResult(ctx, stubToolExecution({
callId: CallId('second-child'), name: 'read', arguments: {}, agent, parent, callId: CallId('second-child'), name: 'read', arguments: {}, agent, parent,
}), { ...plainResult, additionalContexts: [workspaceChangeContext('second', 'two')] }) }), { ...plainResult, additionalContexts: [workspaceChangeContext('second', 'two')] })
ctx.emit('tools/result', { emitToolResult(ctx, {
...stubToolExecution({ callId: CallId('agentless-parent'), name: 'composite', arguments: {} }), ...stubToolExecution({ callId: CallId('agentless-parent'), name: 'composite', arguments: {} }),
token: parent, token: parent,
}, plainResult) }, plainResult)
@@ -2674,7 +2698,7 @@ describe('dynamic nested workspace context injection', () => {
] ]
for (const item of cases) { for (const item of cases) {
const decision = await ctx.waterfall('tools/post-execute', stubToolExecution({ const decision = await postExecute(ctx, stubToolExecution({
callId: CallId(`manual-${item.name}-${cases.indexOf(item)}`), callId: CallId(`manual-${item.name}-${cases.indexOf(item)}`),
name: item.name, name: item.name,
arguments: item.arguments, arguments: item.arguments,
@@ -31,6 +31,9 @@
}, },
{ {
"path": "../../util/paths" "path": "../../util/paths"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+11 -4
View File
@@ -11,17 +11,23 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
], ],
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-scope": "^0.0.1", "@deepseek-ai/dsh-scope": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
@@ -30,16 +36,17 @@
"schemastery": "^3.18.0" "schemastery": "^3.18.0"
}, },
"devDependencies": { "devDependencies": {
"@cordisjs/plugin-loader": "^1.0.0-rc.5",
"@cordisjs/plugin-timer": "workspace:^",
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-agent-loop-testkit": "workspace:^", "@deepseek-ai/dsh-agent-loop-testkit": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^", "@deepseek-ai/dsh-system-prompt": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^",
"@cordisjs/plugin-loader": "^1.0.0-rc.5", "cordis": "^4.0.0-rc.7"
"cordis": "^4.0.0-rc.7",
"@cordisjs/plugin-timer": "workspace:^"
} }
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-tool-cordis`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-tool-cordis/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-tool-cordis'
/** Cordis companion plugin name. */
export const name = 'tool-cordis-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -25,6 +25,9 @@
}, },
{ {
"path": "../../core/tools" "path": "../../core/tools"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+3 -3
View File
@@ -12,8 +12,8 @@ const PACKAGE_NAME = '@deepseek-ai/dsh-agent-loop'
/** Cordis companion plugin name. */ /** Cordis companion plugin name. */
export const name = 'agent-loop-invariant' export const name = 'agent-loop-invariant'
/** Services required before the companion can register. */ /** Service required before the companion can reserve package ownership. */
export const inject = ['invariants', 'sessions'] export const inject = ['invariants']
/** Install the request-reconstruction contribution into its child registration fiber. */ /** Install the request-reconstruction contribution into its child registration fiber. */
const install: InvariantInstaller = Object.assign((ctx: Context, fail: InvariantFailure) => { const install: InvariantInstaller = Object.assign((ctx: Context, fail: InvariantFailure) => {
@@ -66,7 +66,7 @@ const install: InvariantInstaller = Object.assign((ctx: Context, fail: Invariant
/** /**
* Register the agent-loop invariant companion. * Register the agent-loop invariant companion.
* @param ctx - Cordis context carrying the invariant and session services. * @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds. * @returns the installed registration's disposer after setup succeeds.
*/ */
export const apply = (ctx: Context): Promise<() => void> => export const apply = (ctx: Context): Promise<() => void> =>
@@ -425,7 +425,7 @@ describe('the session-persistence RFC: AgentLoop factory create/resume', () => {
seed, seed,
meta: { cwd: '/w', parentSession: SessionId('parent-sess'), seedLength: seed.length }, meta: { cwd: '/w', parentSession: SessionId('parent-sess'), seedLength: seed.length },
}) })
await ctx1.parallel('session/flush', forked) await ctx1.sessions.flush(forked)
await ctx1.fiber.dispose() await ctx1.fiber.dispose()
// Lifecycle 2: resume it; the parentSession + seedLength header survives the // Lifecycle 2: resume it; the parentSession + seedLength header survives the
@@ -482,7 +482,7 @@ describe('the session-persistence RFC: AgentLoop factory create/resume', () => {
a1.send([{ type: 'text', text: 'q' }], { source: { kind: 'user' } }) a1.send([{ type: 'text', text: 'q' }], { source: { kind: 'user' } })
await waitForIdle(ctx1, a1) await waitForIdle(ctx1, a1)
a1.inject([{ type: 'text', text: 'background task 42 finished' }], { source: { kind: 'plugin', plugin: 'tool-bash' } }) a1.inject([{ type: 'text', text: 'background task 42 finished' }], { source: { kind: 'plugin', plugin: 'tool-bash' } })
await ctx1.parallel('session/flush', a1.session) await ctx1.sessions.flush(a1.session)
await ctx1.fiber.dispose() await ctx1.fiber.dispose()
// Lifecycle 2: resume; the injected context is still in the derived history. // Lifecycle 2: resume; the injected context is still in the derived history.
+3 -3
View File
@@ -15,8 +15,8 @@ const PACKAGE_NAME = '@deepseek-ai/dsh-session'
/** Cordis companion plugin name. */ /** Cordis companion plugin name. */
export const name = 'session-invariant' export const name = 'session-invariant'
/** Services required before the companion can register. */ /** Service required before the companion can reserve package ownership. */
export const inject = ['invariants', 'sessions'] export const inject = ['invariants']
/** Per-session bookkeeping for relational log checks. */ /** Per-session bookkeeping for relational log checks. */
interface SessionTrace { interface SessionTrace {
@@ -223,7 +223,7 @@ const install: InvariantInstaller = Object.assign((ctx: Context, fail: Invariant
/** /**
* Register the session invariant companion. * Register the session invariant companion.
* @param ctx - Cordis context carrying the invariant and session services. * @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds. * @returns the installed registration's disposer after setup succeeds.
*/ */
export const apply = (ctx: Context): Promise<() => void> => export const apply = (ctx: Context): Promise<() => void> =>
+14 -9
View File
@@ -718,10 +718,11 @@ describe('SessionStore', () => {
// may create an unrelated property with the old implementation's name, // may create an unrelated property with the old implementation's name,
// but cannot suppress the durable event feed. // but cannot suppress the durable event feed.
expect(Reflect.set(session, 'onAppend', undefined)).toBe(true) expect(Reflect.set(session, 'onAppend', undefined)).toBe(true)
session.append('turn/start', { turn: 1, trigger: { kind: 'message', source: { kind: 'user' } } })
session.append('user/message', { content: [{ type: 'text', text: 'x' }], source: { kind: 'user' } }, { surfaceOp: 'append' }) session.append('user/message', { content: [{ type: 'text', text: 'x' }], source: { kind: 'user' } }, { surfaceOp: 'append' })
expect(events).toHaveLength(1) expect(events).toHaveLength(2)
expect(events[0]![0]).toBe(session) expect(events[1]![0]).toBe(session)
expect(events[0]![1].type).toBe('user/message') expect(events[1]![1].type).toBe('user/message')
expect(ctx.sessions.get(session.id)).toBe(session) expect(ctx.sessions.get(session.id)).toBe(session)
expect(ctx.sessions.list()).toEqual([session]) expect(ctx.sessions.list()).toEqual([session])
@@ -733,6 +734,7 @@ describe('SessionStore', () => {
const a = ctx.sessions.create(SessionId('fixed')) const a = ctx.sessions.create(SessionId('fixed'))
expect(() => ctx.sessions.create(SessionId('fixed'))).toThrow('already exists') expect(() => ctx.sessions.create(SessionId('fixed'))).toThrow('already exists')
a.append('turn/start', { turn: 1, trigger: { kind: 'message', source: { kind: 'user' } } })
a.append('user/message', { content: [{ type: 'text', text: 'q' }], source: { kind: 'user' } }, { surfaceOp: 'append' }) a.append('user/message', { content: [{ type: 'text', text: 'q' }], source: { kind: 'user' } }, { surfaceOp: 'append' })
const forked = ctx.sessions.create(SessionId('fork'), { seed: [...a.events] }) const forked = ctx.sessions.create(SessionId('fork'), { seed: [...a.events] })
expect(forked.deriveMessages()).toEqual(a.deriveMessages()) expect(forked.deriveMessages()).toEqual(a.deriveMessages())
@@ -958,8 +960,9 @@ describe('SessionStore', () => {
ctx.on('session/event', (_session, event) => void events.push(event)) ctx.on('session/event', (_session, event) => void events.push(event))
const session = ctx.sessions.create(SessionId('fixed')) const session = ctx.sessions.create(SessionId('fixed'))
expect(ctx.sessions.get(SessionId('fixed'))).toBe(session) expect(ctx.sessions.get(SessionId('fixed'))).toBe(session)
session.append('turn/start', { turn: 1, trigger: { kind: 'message', source: { kind: 'user' } } })
session.append('user/message', { content: [{ type: 'text', text: 'hi' }], source: { kind: 'user' } }, { surfaceOp: 'append' }) session.append('user/message', { content: [{ type: 'text', text: 'hi' }], source: { kind: 'user' } }, { surfaceOp: 'append' })
expect(events).toHaveLength(1) expect(events.at(-1)?.type).toBe('user/message')
}) })
it('contains session/event observer failures after the append commit point', async () => { it('contains session/event observer failures after the append commit point', async () => {
@@ -1043,6 +1046,8 @@ describe('SessionStore', () => {
const ctx = new Context() const ctx = new Context()
await ctx.plugin(SessionStore) await ctx.plugin(SessionStore)
const session = ctx.sessions.create(SessionId('surface-dispatch-veto')) const session = ctx.sessions.create(SessionId('surface-dispatch-veto'))
session.append('turn/start', { turn: 1, trigger: { kind: 'message', source: { kind: 'user' } } })
session.append('step/start', { turn: 1, step: 1 })
session.append('user/message', { session.append('user/message', {
content: [{ type: 'text', text: 'source' }], content: [{ type: 'text', text: 'source' }],
source: { kind: 'user' }, source: { kind: 'user' },
@@ -1062,19 +1067,19 @@ describe('SessionStore', () => {
step: 1, step: 1,
content: [{ type: 'text', text: 'replacement' }], content: [{ type: 'text', text: 'replacement' }],
}, { }, {
surfaceOp: { op: 'replace', start: 0, end: 0 }, surfaceOp: { op: 'replace', start: 2, end: 2 },
sourceEventSeqs: [0], sourceEventSeqs: [2],
})).toThrow('reject surface candidate') })).toThrow('reject surface candidate')
expect(session.events).toHaveLength(1) expect(session.events).toHaveLength(3)
expect(surface.nodes).toEqual([0]) expect(surface.nodes).toEqual([2])
expect(surface.replaceGeneration).toBe(0) expect(surface.replaceGeneration).toBe(0)
session.append('user/message', { session.append('user/message', {
content: [{ type: 'text', text: 'next' }], content: [{ type: 'text', text: 'next' }],
source: { kind: 'user' }, source: { kind: 'user' },
}, { surfaceOp: 'append' }) }, { surfaceOp: 'append' })
expect(surface.nodes).toEqual([0, 1]) expect(surface.nodes).toEqual([2, 3])
expect(surface.replaceGeneration).toBe(0) expect(surface.replaceGeneration).toBe(0)
}) })
+7
View File
@@ -11,17 +11,23 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
], ],
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-scope": "^0.0.1", "@deepseek-ai/dsh-scope": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
@@ -30,6 +36,7 @@
"schemastery": "^3.18.0" "schemastery": "^3.18.0"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^", "@deepseek-ai/dsh-scope": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-system-prompt`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-system-prompt/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-system-prompt'
/** Cordis companion plugin name. */
export const name = 'system-prompt-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -22,6 +22,9 @@
}, },
{ {
"path": "../../core/scope" "path": "../../core/scope"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+9 -2
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,12 +28,13 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-user-approval": "^0.0.1",
"@deepseek-ai/dsh-code-runtime": "^0.0.1", "@deepseek-ai/dsh-code-runtime": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-scope": "^0.0.1", "@deepseek-ai/dsh-scope": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-system-prompt": "^0.0.1", "@deepseek-ai/dsh-system-prompt": "^0.0.1",
"@deepseek-ai/dsh-user-approval": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"dependencies": { "dependencies": {
@@ -36,12 +42,13 @@
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-user-approval": "workspace:^",
"@deepseek-ai/dsh-code-runtime": "workspace:^", "@deepseek-ai/dsh-code-runtime": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^", "@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^", "@deepseek-ai/dsh-system-prompt": "workspace:^",
"@deepseek-ai/dsh-user-approval": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-tools`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-tools/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-tools'
/** Cordis companion plugin name. */
export const name = 'tools-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -34,6 +34,9 @@
}, },
{ {
"path": "../../ui/user-approval" "path": "../../ui/user-approval"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+13 -6
View File
@@ -14,6 +14,10 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./bin": { "./bin": {
"types": "./lib/types/bin.d.ts", "types": "./lib/types/bin.d.ts",
"default": "./lib/bin.js" "default": "./lib/bin.js"
@@ -23,6 +27,7 @@
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/bin.js", "lib/bin.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
@@ -32,28 +37,30 @@
"peerDependencies": { "peerDependencies": {
"@cordisjs/plugin-include": "^1.0.4", "@cordisjs/plugin-include": "^1.0.4",
"@cordisjs/plugin-loader": "^1.0.0-rc.5", "@cordisjs/plugin-loader": "^1.0.0-rc.5",
"@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-acp": "^0.0.1", "@deepseek-ai/dsh-acp": "^0.0.1",
"@deepseek-ai/dsh-agent-spine-demo": "^0.0.1", "@deepseek-ai/dsh-agent-spine-demo": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1", "@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1", "@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"@deepseek-ai/dsh-user-interaction": "^0.0.1", "@deepseek-ai/dsh-user-interaction": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1",
"cordis": "^4.0.0-rc.7", "cordis": "^4.0.0-rc.7",
"schemastery": "^3.17.0" "schemastery": "^3.17.0"
}, },
"devDependencies": { "devDependencies": {
"@cordisjs/plugin-include": "workspace:^", "@cordisjs/plugin-include": "workspace:^",
"@cordisjs/plugin-loader": "workspace:^", "@cordisjs/plugin-loader": "workspace:^",
"@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-acp": "workspace:^", "@deepseek-ai/dsh-acp": "workspace:^",
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-spine-demo": "workspace:^", "@deepseek-ai/dsh-agent-spine-demo": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^", "@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^", "@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^",
"@deepseek-ai/dsh-user-interaction": "workspace:^", "@deepseek-ai/dsh-user-interaction": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"cordis": "^4.0.0-rc.7", "cordis": "^4.0.0-rc.7",
"schemastery": "^3.17.0" "schemastery": "^3.17.0"
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-acp-demo`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-acp-demo/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-acp-demo'
/** Cordis companion plugin name. */
export const name = 'acp-demo-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+3
View File
@@ -40,6 +40,9 @@
}, },
{ {
"path": "../../session-persistence/session-persistence-jsonl" "path": "../../session-persistence/session-persistence-jsonl"
},
{
"path": "../../support/invariants"
} }
] ]
} }
+1 -1
View File
@@ -8,7 +8,7 @@ import { defineConfig } from 'tsdown'
* matching every package. * matching every package.
*/ */
export default defineConfig({ export default defineConfig({
entry: ['lib/types/index.js', 'lib/types/bin.js'], entry: ['lib/types/index.js', 'lib/types/invariant.js', 'lib/types/bin.js'],
outDir: 'lib', outDir: 'lib',
format: ['esm'], format: ['esm'],
platform: 'node', platform: 'node',
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -25,12 +30,11 @@
"@cordisjs/plugin-timer": "^1.1.2", "@cordisjs/plugin-timer": "^1.1.2",
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-agent-loop": "^0.0.1", "@deepseek-ai/dsh-agent-loop": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-home": "^0.0.1", "@deepseek-ai/dsh-home": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-scope": "^0.0.1", "@deepseek-ai/dsh-scope": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-skill": "^0.0.1", "@deepseek-ai/dsh-skill": "^0.0.1",
"@deepseek-ai/dsh-skill-local": "^0.0.1", "@deepseek-ai/dsh-skill-local": "^0.0.1",
"@deepseek-ai/dsh-system-prompt": "^0.0.1", "@deepseek-ai/dsh-system-prompt": "^0.0.1",
@@ -39,6 +43,7 @@
"@deepseek-ai/dsh-tool-skill": "^0.0.1", "@deepseek-ai/dsh-tool-skill": "^0.0.1",
"@deepseek-ai/dsh-tool-tasks": "^0.0.1", "@deepseek-ai/dsh-tool-tasks": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
@@ -46,12 +51,11 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-fs-local": "workspace:^", "@deepseek-ai/dsh-fs-local": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-home": "workspace:^", "@deepseek-ai/dsh-home": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-scope": "workspace:^", "@deepseek-ai/dsh-scope": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-skill": "workspace:^", "@deepseek-ai/dsh-skill": "workspace:^",
"@deepseek-ai/dsh-skill-local": "workspace:^", "@deepseek-ai/dsh-skill-local": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^", "@deepseek-ai/dsh-system-prompt": "workspace:^",
@@ -60,6 +64,7 @@
"@deepseek-ai/dsh-tool-skill": "workspace:^", "@deepseek-ai/dsh-tool-skill": "workspace:^",
"@deepseek-ai/dsh-tool-tasks": "workspace:^", "@deepseek-ai/dsh-tool-tasks": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"dependencies": { "dependencies": {
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-agent-spine-demo`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-agent-spine-demo/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-agent-spine-demo'
/** Cordis companion plugin name. */
export const name = 'agent-spine-demo-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+7
View File
@@ -14,6 +14,10 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./bin": { "./bin": {
"types": "./lib/types/bin.d.ts", "types": "./lib/types/bin.d.ts",
"default": "./lib/bin.js" "default": "./lib/bin.js"
@@ -23,6 +27,7 @@
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/bin.js", "lib/bin.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
@@ -35,6 +40,7 @@
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-agent-spine-demo": "^0.0.1", "@deepseek-ai/dsh-agent-spine-demo": "^0.0.1",
"@deepseek-ai/dsh-app-boot": "^0.0.1", "@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1", "@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1",
@@ -49,6 +55,7 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-spine-demo": "workspace:^", "@deepseek-ai/dsh-agent-spine-demo": "workspace:^",
"@deepseek-ai/dsh-app-boot": "workspace:^", "@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^", "@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-cli-demo`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-cli-demo/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-cli-demo'
/** Cordis companion plugin name. */
export const name = 'cli-demo-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+33 -10
View File
@@ -8,15 +8,38 @@
}, },
"include": ["src/**/*.ts"], "include": ["src/**/*.ts"],
"references": [ "references": [
{ "path": "../../../vendor/schemastery" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/schemastery"
{ "path": "../../llm/llm" }, },
{ "path": "../../core/session" }, {
{ "path": "../../core/agent" }, "path": "../../../vendor/cordis"
{ "path": "../../core/system-prompt" }, },
{ "path": "../../core/tools" }, {
{ "path": "../agent-spine-demo" }, "path": "../../llm/llm"
{ "path": "../../session-persistence/session-persistence-jsonl" }, },
{ "path": "../../ui/app-boot" } {
"path": "../../core/session"
},
{
"path": "../../core/agent"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../../core/tools"
},
{
"path": "../agent-spine-demo"
},
{
"path": "../../session-persistence/session-persistence-jsonl"
},
{
"path": "../../ui/app-boot"
},
{
"path": "../../support/invariants"
}
] ]
} }
+1 -1
View File
@@ -2,7 +2,7 @@ import { defineConfig } from 'tsdown'
/** Builds the plugin and executable entries from declarations emitted by `tsc -b`. */ /** Builds the plugin and executable entries from declarations emitted by `tsc -b`. */
export default defineConfig({ export default defineConfig({
entry: ['lib/types/index.js', 'lib/types/bin.js'], entry: ['lib/types/index.js', 'lib/types/invariant.js', 'lib/types/bin.js'],
outDir: 'lib', outDir: 'lib',
format: ['esm'], format: ['esm'],
platform: 'node', platform: 'node',
@@ -14,6 +14,10 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./bin": { "./bin": {
"types": "./lib/types/bin.d.ts", "types": "./lib/types/bin.d.ts",
"default": "./lib/bin.js" "default": "./lib/bin.js"
@@ -23,6 +27,7 @@
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/bin.js", "lib/bin.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
@@ -33,9 +38,11 @@
"@deepseek-ai/dsh-app-boot": "workspace:^" "@deepseek-ai/dsh-app-boot": "workspace:^"
}, },
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-invariants": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-jsonrpc-demo`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-jsonrpc-demo/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-jsonrpc-demo'
/** Cordis companion plugin name. */
export const name = 'jsonrpc-demo-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -16,6 +16,9 @@
}, },
{ {
"path": "../../ui/app-boot" "path": "../../ui/app-boot"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -4,7 +4,7 @@ import { defineConfig } from 'tsdown'
* Build the doc-only module and CLI entry; `tsc -b` supplies declarations. * Build the doc-only module and CLI entry; `tsc -b` supplies declarations.
*/ */
export default defineConfig({ export default defineConfig({
entry: ['lib/types/index.js', 'lib/types/bin.js'], entry: ['lib/types/index.js', 'lib/types/invariant.js', 'lib/types/bin.js'],
outDir: 'lib', outDir: 'lib',
format: ['esm'], format: ['esm'],
platform: 'node', platform: 'node',
+16 -9
View File
@@ -14,6 +14,10 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./bin": { "./bin": {
"types": "./lib/types/bin.d.ts", "types": "./lib/types/bin.d.ts",
"default": "./lib/bin.js" "default": "./lib/bin.js"
@@ -23,6 +27,7 @@
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/bin.js", "lib/bin.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
@@ -33,19 +38,20 @@
"@cordisjs/plugin-include": "^1.0.4", "@cordisjs/plugin-include": "^1.0.4",
"@cordisjs/plugin-loader": "^1.0.0-rc.5", "@cordisjs/plugin-loader": "^1.0.0-rc.5",
"@cordisjs/plugin-logger-console": "^1.0.0", "@cordisjs/plugin-logger-console": "^1.0.0",
"@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-agent-loop": "^0.0.1", "@deepseek-ai/dsh-agent-loop": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-agent-spine-demo": "^0.0.1", "@deepseek-ai/dsh-agent-spine-demo": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1", "@deepseek-ai/dsh-app-boot": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1", "@deepseek-ai/dsh-session-persistence-jsonl": "^0.0.1",
"@deepseek-ai/dsh-stdio": "^0.0.1", "@deepseek-ai/dsh-stdio": "^0.0.1",
"@deepseek-ai/dsh-tui": "^0.0.1",
"@deepseek-ai/dsh-tool-ask-user": "^0.0.1", "@deepseek-ai/dsh-tool-ask-user": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"@deepseek-ai/dsh-tui": "^0.0.1",
"@deepseek-ai/dsh-user-interaction": "^0.0.1", "@deepseek-ai/dsh-user-interaction": "^0.0.1",
"@deepseek-ai/dsh-workspace-context": "^0.0.1",
"cordis": "^4.0.0-rc.7", "cordis": "^4.0.0-rc.7",
"schemastery": "^3.17.0" "schemastery": "^3.17.0"
}, },
@@ -53,20 +59,21 @@
"@cordisjs/plugin-include": "workspace:^", "@cordisjs/plugin-include": "workspace:^",
"@cordisjs/plugin-loader": "workspace:^", "@cordisjs/plugin-loader": "workspace:^",
"@cordisjs/plugin-logger-console": "workspace:^", "@cordisjs/plugin-logger-console": "workspace:^",
"@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-agent-spine-demo": "workspace:^", "@deepseek-ai/dsh-agent-spine-demo": "workspace:^",
"@deepseek-ai/dsh-system-prompt": "workspace:^", "@deepseek-ai/dsh-app-boot": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^", "@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^", "@deepseek-ai/dsh-session-persistence-jsonl": "workspace:^",
"@deepseek-ai/dsh-stdio": "workspace:^", "@deepseek-ai/dsh-stdio": "workspace:^",
"@deepseek-ai/dsh-tui": "workspace:^", "@deepseek-ai/dsh-system-prompt": "workspace:^",
"@deepseek-ai/dsh-tool-ask-user": "workspace:^", "@deepseek-ai/dsh-tool-ask-user": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^",
"@deepseek-ai/dsh-tui": "workspace:^",
"@deepseek-ai/dsh-user-interaction": "workspace:^", "@deepseek-ai/dsh-user-interaction": "workspace:^",
"@deepseek-ai/dsh-workspace-context": "workspace:^",
"cordis": "^4.0.0-rc.7", "cordis": "^4.0.0-rc.7",
"schemastery": "^3.17.0" "schemastery": "^3.17.0"
} }
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-stdio-demo`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-stdio-demo/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-stdio-demo'
/** Cordis companion plugin name. */
export const name = 'stdio-demo-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -49,6 +49,9 @@
}, },
{ {
"path": "../../session-persistence/session-persistence-jsonl" "path": "../../session-persistence/session-persistence-jsonl"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -8,7 +8,7 @@ import { defineConfig } from 'tsdown'
* matching every package. * matching every package.
*/ */
export default defineConfig({ export default defineConfig({
entry: ['lib/types/index.js', 'lib/types/bin.js'], entry: ['lib/types/index.js', 'lib/types/invariant.js', 'lib/types/bin.js'],
outDir: 'lib', outDir: 'lib',
format: ['esm'], format: ['esm'],
platform: 'node', platform: 'node',
+7
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,6 +28,7 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-fs": "^0.0.1", "@deepseek-ai/dsh-fs": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"dependencies": { "dependencies": {
@@ -30,6 +36,7 @@
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-fs": "workspace:^", "@deepseek-ai/dsh-fs": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-fs-local`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-fs-local/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-fs-local'
/** Cordis companion plugin name. */
export const name = 'fs-local-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+18 -5
View File
@@ -6,10 +6,23 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../../vendor/schemastery" }, },
{ "path": "../../llm/llm" }, {
{ "path": "../fs" } "path": "../../../vendor/cordis"
},
{
"path": "../../../vendor/schemastery"
},
{
"path": "../../llm/llm"
},
{
"path": "../fs"
},
{
"path": "../../support/invariants"
}
] ]
} }
+7
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,10 +28,12 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-fs": "^0.0.1", "@deepseek-ai/dsh-fs": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-fs": "workspace:^", "@deepseek-ai/dsh-fs": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-fs-policy`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-fs-policy/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-fs-policy'
/** Cordis companion plugin name. */
export const name = 'fs-policy-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+15 -4
View File
@@ -6,9 +6,20 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../llm/llm" }, },
{ "path": "../fs" } {
"path": "../../../vendor/cordis"
},
{
"path": "../../llm/llm"
},
{
"path": "../fs"
},
{
"path": "../../support/invariants"
}
] ]
} }
+7
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,11 +28,13 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-brand": "^0.0.1", "@deepseek-ai/dsh-brand": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-brand": "workspace:^", "@deepseek-ai/dsh-brand": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-fs`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-fs/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-fs'
/** Cordis companion plugin name. */
export const name = 'fs-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+15 -4
View File
@@ -6,9 +6,20 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../util/brand" }, },
{ "path": "../../llm/llm" } {
"path": "../../../vendor/cordis"
},
{
"path": "../../util/brand"
},
{
"path": "../../llm/llm"
},
{
"path": "../../support/invariants"
}
] ]
} }
+7
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -26,6 +31,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-bash": "^0.0.1", "@deepseek-ai/dsh-bash": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-retention": "^0.0.1", "@deepseek-ai/dsh-retention": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
@@ -38,6 +44,7 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-bash": "workspace:^", "@deepseek-ai/dsh-bash": "workspace:^",
"@deepseek-ai/dsh-bash-local": "workspace:^", "@deepseek-ai/dsh-bash-local": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-retention": "workspace:^", "@deepseek-ai/dsh-retention": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-tool-fs-search`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-tool-fs-search/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-tool-fs-search'
/** Cordis companion plugin name. */
export const name = 'tool-fs-search-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+33 -10
View File
@@ -6,15 +6,38 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../../vendor/schemastery" }, },
{ "path": "../../util/retention" }, {
{ "path": "../../llm/llm" }, "path": "../../../vendor/cordis"
{ "path": "../../core/session" }, },
{ "path": "../../core/tools" }, {
{ "path": "../../core/system-prompt" }, "path": "../../../vendor/schemastery"
{ "path": "../../bash/bash" }, },
{ "path": "../../spill/spill" } {
"path": "../../util/retention"
},
{
"path": "../../llm/llm"
},
{
"path": "../../core/session"
},
{
"path": "../../core/tools"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../../bash/bash"
},
{
"path": "../../spill/spill"
},
{
"path": "../../support/invariants"
}
] ]
} }
+8 -1
View File
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -27,6 +32,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-fs": "^0.0.1", "@deepseek-ai/dsh-fs": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-llm": "^0.0.1", "@deepseek-ai/dsh-llm": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"@deepseek-ai/dsh-system-prompt": "^0.0.1", "@deepseek-ai/dsh-system-prompt": "^0.0.1",
@@ -37,9 +43,10 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-agent-loop-testkit": "workspace:^", "@deepseek-ai/dsh-agent-loop-testkit": "workspace:^",
"@deepseek-ai/dsh-fs-policy": "workspace:^",
"@deepseek-ai/dsh-fs": "workspace:^", "@deepseek-ai/dsh-fs": "workspace:^",
"@deepseek-ai/dsh-fs-local": "workspace:^", "@deepseek-ai/dsh-fs-local": "workspace:^",
"@deepseek-ai/dsh-fs-policy": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-llm-deepseek": "workspace:^", "@deepseek-ai/dsh-llm-deepseek": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
+30
View File
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-tool-fs`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-tool-fs/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-tool-fs'
/** Cordis companion plugin name. */
export const name = 'tool-fs-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
+27 -8
View File
@@ -6,13 +6,32 @@
}, },
"include": ["src"], "include": ["src"],
"references": [ "references": [
{ "path": "../../../vendor/cosmokit" }, {
{ "path": "../../../vendor/cordis" }, "path": "../../../vendor/cosmokit"
{ "path": "../../../vendor/schemastery" }, },
{ "path": "../../llm/llm" }, {
{ "path": "../../core/tools" }, "path": "../../../vendor/cordis"
{ "path": "../../core/system-prompt" }, },
{ "path": "../fs" }, {
{ "path": "../fs-policy" } "path": "../../../vendor/schemastery"
},
{
"path": "../../llm/llm"
},
{
"path": "../../core/tools"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../fs"
},
{
"path": "../fs-policy"
},
{
"path": "../../support/invariants"
}
] ]
} }
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -26,6 +31,7 @@
}, },
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-agent": "^0.0.1", "@deepseek-ai/dsh-agent": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-tools": "^0.0.1", "@deepseek-ai/dsh-tools": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
@@ -33,6 +39,7 @@
"@deepseek-ai/dsh-agent": "workspace:^", "@deepseek-ai/dsh-agent": "workspace:^",
"@deepseek-ai/dsh-agent-loop": "workspace:^", "@deepseek-ai/dsh-agent-loop": "workspace:^",
"@deepseek-ai/dsh-agent-loop-testkit": "workspace:^", "@deepseek-ai/dsh-agent-loop-testkit": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-llm": "workspace:^", "@deepseek-ai/dsh-llm": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"@deepseek-ai/dsh-tools": "workspace:^", "@deepseek-ai/dsh-tools": "workspace:^",
@@ -0,0 +1,30 @@
/**
* Generated invariant ownership companion for `@deepseek-ai/dsh-repeat-tool-guard`.
* Replace this file with package-owned checks while preserving its registration.
*
* @generated scripts/gen-package-invariants.ts
* @module @deepseek-ai/dsh-repeat-tool-guard/invariant
*/
/* jscpd:ignore-start */
import type { Context } from 'cordis'
import type { InvariantInstaller } from '@deepseek-ai/dsh-invariants'
const PACKAGE_NAME = '@deepseek-ai/dsh-repeat-tool-guard'
/** Cordis companion plugin name. */
export const name = 'repeat-tool-guard-invariant'
/** Services required before the companion can register. */
export const inject = ['invariants']
/** Reserve this package's invariant ownership until it adds relational checks. */
const install: InvariantInstaller = () => {}
/**
* Register this package's invariant companion.
* @param ctx - Cordis context carrying the invariant service.
* @returns the installed registration's disposer after setup succeeds.
*/
export const apply = (ctx: Context): Promise<() => void> =>
Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install))
/* jscpd:ignore-end */
@@ -25,6 +25,9 @@
}, },
{ {
"path": "../../llm/llm" "path": "../../llm/llm"
},
{
"path": "../../support/invariants"
} }
] ]
} }
@@ -11,11 +11,16 @@
"types": "./lib/types/index.d.ts", "types": "./lib/types/index.d.ts",
"default": "./lib/index.js" "default": "./lib/index.js"
}, },
"./invariant": {
"types": "./lib/types/invariant.d.ts",
"default": "./lib/invariant.js"
},
"./src/*": "./src/*", "./src/*": "./src/*",
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"files": [ "files": [
"lib/index.js", "lib/index.js",
"lib/invariant.js",
"lib/types/**/*.d.ts", "lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map", "lib/types/**/*.d.ts.map",
"src" "src"
@@ -23,11 +28,13 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"peerDependencies": { "peerDependencies": {
"@deepseek-ai/dsh-bash": "^0.0.1", "@deepseek-ai/dsh-bash": "^0.0.1",
"@deepseek-ai/dsh-invariants": "^0.0.1",
"@deepseek-ai/dsh-session": "^0.0.1", "@deepseek-ai/dsh-session": "^0.0.1",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
}, },
"devDependencies": { "devDependencies": {
"@deepseek-ai/dsh-bash": "workspace:^", "@deepseek-ai/dsh-bash": "workspace:^",
"@deepseek-ai/dsh-invariants": "workspace:^",
"@deepseek-ai/dsh-session": "workspace:^", "@deepseek-ai/dsh-session": "workspace:^",
"cordis": "^4.0.0-rc.7" "cordis": "^4.0.0-rc.7"
} }

Some files were not shown because too many files have changed in this diff Show More