@dotdrelle/wiki-manager 0.15.43 → 0.15.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +92 -24
  2. package/mcp.endpoints.example.json +1 -1
  3. package/package.json +2 -2
  4. package/src/agent/graph.js +288 -22
  5. package/src/agent/graph.test.js +551 -1
  6. package/src/agent/skillRecursion.test.js +98 -0
  7. package/src/cli/wiki-manager.js +209 -7
  8. package/src/cli/wiki-manager.test.js +89 -0
  9. package/src/commands/slash.js +28 -10
  10. package/src/contracts/schemas.js +1 -1
  11. package/src/core/agentEvents.js +50 -0
  12. package/src/core/agentEvents.test.js +52 -0
  13. package/src/core/buildInfo.json +2 -2
  14. package/src/core/env.js +20 -1
  15. package/src/core/env.test.js +34 -0
  16. package/src/core/mcp.js +1 -1
  17. package/src/core/runtimeLog.js +15 -0
  18. package/src/core/runtimeLog.test.js +15 -1
  19. package/src/core/skillChainView.js +84 -0
  20. package/src/core/skillChainView.test.js +50 -0
  21. package/src/core/skillCompiler.js +135 -0
  22. package/src/core/skillCompiler.test.js +91 -0
  23. package/src/core/skillInvocation.js +79 -0
  24. package/src/core/skillInvocation.test.js +73 -0
  25. package/src/core/skills.js +81 -19
  26. package/src/runtime/approvals.js +13 -1
  27. package/src/runtime/approvals.test.js +44 -0
  28. package/src/runtime/client.js +45 -4
  29. package/src/runtime/controlCancellation.js +33 -0
  30. package/src/runtime/controlCancellation.test.js +49 -0
  31. package/src/runtime/controlDrain.js +50 -0
  32. package/src/runtime/controlDrain.test.js +38 -0
  33. package/src/runtime/server.js +333 -15
  34. package/src/runtime/server.test.js +392 -0
  35. package/src/runtime/skillChain.e2e.test.js +394 -0
  36. package/src/runtime/skillRun.js +104 -0
  37. package/src/runtime/skillRun.test.js +84 -0
  38. package/src/runtime/store.js +69 -0
  39. package/src/runtime/store.test.js +11 -0
  40. package/src/shell/RightPane.tsx +3 -2
  41. package/src/shell/repl.js +40 -5
  42. package/src/shell/repl.test.js +41 -0
  43. package/src/shell/useSession.ts +43 -9
package/README.md CHANGED
@@ -8,7 +8,7 @@ endpoints, and provides the `donna` shell: an agent-first terminal UI that can
8
8
  inspect workspaces, run safe manager commands, call MCP tools, guide production
9
9
  jobs, and run one-shot headless tasks.
10
10
 
11
- Current coordinated release: **0.14.11**. Managed `llm-wiki` services expose
11
+ Current coordinated release: **0.15.48**. Managed `llm-wiki` services expose
12
12
  the Wiki Graph v2 browser and APIs; rebuild the `llm-wiki` image when deploying
13
13
  this release through Docker.
14
14
 
@@ -198,7 +198,7 @@ Then send a one-line prompt to confirm the **LLM answers**, e.g.
198
198
  > separate `baseUrl`/`apiKey`, and reranking) used for retrieval-grounded answers.
199
199
 
200
200
  **7 — Try a few commands & prompts.**
201
- Plain-language prompts (web chat **or** `donna` shell):
201
+ Plain-language prompts (the web **Agent/Donna** mode or the `donna` shell):
202
202
 
203
203
  ```text
204
204
  "Summarize wiki/index.md and list the pages it links to."
@@ -210,7 +210,7 @@ Slash primitives (shell):
210
210
 
211
211
  ```text
212
212
  /wiki # inspect the wiki
213
- /skills # bundled examples: pipeline, wiki-sync, wiki-build, deliver, diagnose, status
213
+ /skills # bundled workflows: pipeline, wiki-sync, wiki-build, deliver, new-template, diagnose, status
214
214
  /skills run pipeline # run the shipped end-to-end example
215
215
  ```
216
216
 
@@ -307,12 +307,15 @@ the rules in the **build-context**.
307
307
  The process always follows the same chain. Two entry points depending on your
308
308
  starting source.
309
309
 
310
- Everything is driven **in plain language** (the web interface chat or the `donna`
311
- shell), or by running a ready-made **skill**. No command line needed.
310
+ Everything is driven **in plain language** from Agent/Donna mode, or by running
311
+ a ready-made **skill**. Direct Chat is deliberately read-only with respect to
312
+ production orchestration: it can answer and inspect allowed data, but it does
313
+ not start a skill or a production job. No command line is needed.
312
314
 
313
315
  ### Entry point A — from a wiki / Confluence export
314
316
 
315
- At each step, either you **ask for it in plain language**, or you **run the skill**.
317
+ At each step, either you **ask Donna for the action in Agent mode**, or you
318
+ **run the skill explicitly**.
316
319
 
317
320
  1. **Export** Confluence (via the CME agent) → the markdown lands in
318
321
  `raw/untracked/`.
@@ -631,22 +634,25 @@ Each recovery is emitted as `run_replanned` and appears in runtime state as
631
634
  `replans`. Limit attempts with `WIKI_MANAGER_REPLANNER_MAX_REPLANS` or per run
632
635
  with `"replans": 1` in the `/run` body.
633
636
 
634
- Runtime approvals support two levels. For run-level approval, post `/run` with
635
- `"requireApproval": true`; the runtime emits `run_pending_approval` before the
636
- first action and waits for `POST /approve?runId=...`. For tool-level approval,
637
- set `requireApproval` on an external endpoint, or set
638
- `WIKI_MANAGER_REQUIRE_APPROVAL_TOOLS=production.production_start_job` for
639
- workspace-native MCP tools. Pending tool approvals appear in the queue with
640
- status `pending_approval` and can be approved with `POST /approve?itemId=...`
641
- or the shell command `/approve item <id>`. The approval timeout defaults to 10
637
+ Runtime approvals are bounded to a run, plan revision and approval class.
638
+ Mutating orchestrated tasks **wait for approval by default**, including tasks
639
+ created by a skill or a directly selected capability such as ingest or
640
+ pipeline. Approve them by replying "valide tout", running `/approve`, or
641
+ clicking Approve in either UI (Shell right-pane banner, or the `serve` banner
642
+ above the composer). `POST /approve` also accepts an explicit run scope.
643
+
644
+ An explicitly launched skill is also approval-gated. For an orchestrated skill,
645
+ the scheduler blocks each uncovered mutating task; for a `direct` skill, the
646
+ run-level gate blocks its first direct mutation. Declaring `execution: direct`
647
+ changes routing and available tools—it does not grant automatic approval.
648
+
649
+ External direct MCP tools may additionally declare a per-tool `requireApproval`
650
+ policy. Their pending entries can be approved with
651
+ `POST /approve?itemId=...` or `/approve item <id>`. The timeout defaults to ten
642
652
  minutes and can be changed with `WIKI_MANAGER_APPROVAL_TIMEOUT_MS` or
643
- `approvalTimeoutMs` in the `/run` body.
644
-
645
- Directly-launched capability runs (ingest, pipeline) now **wait for approval by
646
- default** before their mutating tasks: reply "valide tout", run `/approve`, or
647
- click Approve in either UI (Shell right-pane banner, or the `serve` banner above
648
- the composer). Auto-approval only happens when the run is started with
649
- `autoApprove: true` (headless/CI).
653
+ `approvalTimeoutMs` in the `/run` body. Auto-approval is never inferred from a
654
+ skill or an interactive UI: it requires the caller to pass
655
+ `autoApprove: true`, intended for headless/CI (`--auto-approve`).
650
656
 
651
657
  ### Parallelism & throughput
652
658
 
@@ -1035,6 +1041,61 @@ Useful primitives:
1035
1041
  Skills are loaded only from the active workspace. The manager itself has no root
1036
1042
  `SKILL.md` and no root `skills/` directory.
1037
1043
 
1044
+ Executable skills are resolved by the runtime, not expanded into a private LLM
1045
+ prompt by each UI. `/skills run <name>` and `/<name>` therefore use the same
1046
+ path in the Shell and in `llm-wiki serve`; headless `--skill` posts the same
1047
+ invocation to `/run`. Built-in commands keep priority (`/status` remains the
1048
+ Shell status primitive), while `/skills run status` explicitly selects a skill
1049
+ with the same name.
1050
+
1051
+ Donna receives only the sanitized skill catalogue (name, description and
1052
+ parameters) when selecting a skill from natural language. The runtime rereads
1053
+ and compiles the body after selection. Conversation, queue, audit, SSE and run
1054
+ records expose only the public invocation, for example
1055
+ `/wiki-build template="overview"`; the compiled objective remains private
1056
+ execution material. An informational question about a skill therefore remains
1057
+ a question—it does not launch that skill. A natural-language action launches a
1058
+ skill only when Donna finds one strong, unique match and all required parameters
1059
+ are present; an explicit command always wins.
1060
+
1061
+ Every skill may declare its execution policy in front matter:
1062
+
1063
+ ```yaml
1064
+ ---
1065
+ name: new-template
1066
+ description: Create one reusable deliverable template
1067
+ execution: direct
1068
+ params:
1069
+ - family
1070
+ - intent
1071
+ ---
1072
+ ```
1073
+
1074
+ `execution: orchestrated` is the default. It gives the compiled run read tools
1075
+ plus capability delegation, but no direct mutating MCP tools. Use it for
1076
+ production workflows whose agents provide a plan, locks, progress and bounded
1077
+ approvals. `execution: direct` gives the compiled run its ordinary direct tools
1078
+ and removes runtime delegation; use it for a focused operation such as writing
1079
+ one template file. The policy is snapshotted when the chain is created, so an
1080
+ edited skill cannot change permissions halfway through an existing chain.
1081
+
1082
+ The runtime compiles a skill into natural-language objectives. Paragraphs alone
1083
+ do not split work: an existing complex capability such as `knowledge.pipeline`
1084
+ stays one objective, one capability resolution and one run. Strong workflow
1085
+ boundaries create a sequential execution chain instead. In the shipped
1086
+ scaffold, `pipeline`, `wiki-ingest`, `wiki-build`, `deliver`, `diagnose`,
1087
+ `status` and `new-template` each compile to one run; `wiki-sync` compiles to an
1088
+ export run followed by an ingest run. Chain items contain `chainId`, sequence,
1089
+ optionality and continuation policy, but never a precomputed `capabilityPlan`.
1090
+ Each item is resolved only when its run starts.
1091
+
1092
+ `/run cancel` cancels the current run and skips only the remaining required
1093
+ items of the same chain. It leaves standalone requests and other chains intact.
1094
+ `/run kill` deliberately keeps its broader workspace scope and purges every
1095
+ queued control request. `/queue cancel <id>` remains item-scoped. The Activity
1096
+ views in both UIs derive their Chain section from the event-sourced control
1097
+ queue, including `skipped` and `skipReason`; no separate chain state exists.
1098
+
1038
1099
  Workspace switching is isolated. When you run `/use my-project`, the shell
1039
1100
  switches both the displayed conversation and the LLM history to `my-project`.
1040
1101
  Returning to another workspace restores that workspace's in-memory conversation
@@ -1117,9 +1178,16 @@ node ./bin/wiki-manager.js --headless --workspace my-project --prompt "check pro
1117
1178
 
1118
1179
  Headless mode creates a normal session, runs `/use`, and writes a log under
1119
1180
  `.wiki/logs/` by default. `--prompt` runs one agent turn unless `--wait` is passed.
1120
- `--skill` uses the agentic loop by default: agent turn, wait for active MCP jobs
1121
- declared through `_activity.poll`, then re-invoke the agent with the completed job
1122
- summary so it can start the next required step.
1181
+ `--skill "<name> [arguments...]"` submits `/<name> <arguments...>` to the same
1182
+ runtime resolver used by the Shell and Serve. It waits for the complete
1183
+ `chainId`, not only the first run: every control item must become terminal, and
1184
+ any failed item yields exit code 1. A chain waiting for approval returns
1185
+ immediately with guidance unless `--auto-approve` was requested. Combining
1186
+ `--prompt` with runtime `--skill` ignores the prompt and reports that fact in
1187
+ the headless log. `--no-runtime` keeps the legacy local execution path as an
1188
+ explicit compatibility mode, but it still enforces the skill's declared
1189
+ `execution` policy. A direct legacy skill requires the explicit
1190
+ `--auto-approve` opt-in before receiving direct tools.
1123
1191
 
1124
1192
  Useful headless controls:
1125
1193
 
@@ -29,7 +29,7 @@
29
29
  "chatAccess": {
30
30
  "maxToolIterations": 8,
31
31
  "servers": {
32
- "llm-wiki": { "allow": ["help_list", "help_read", "help_search", "wiki_workspace_status", "wiki_list_pages", "wiki_read_page", "wiki_read_pages", "wiki_search_context", "wiki_collect_context", "wiki_read_ingested_source"] },
32
+ "llm-wiki": { "allow": ["help_list", "help_read", "help_search", "wiki_workspace_status", "wiki_list_pages", "wiki_read_page", "wiki_read_pages", "wiki_search_context", "wiki_collect_context", "wiki_read_ingested_source", "wiki_outline", "template_read", "template_write", "build_context_write"] },
33
33
  "wiki-production": { "allow": ["production_job_status", "production_jobs_list"] },
34
34
  "cme": { "allow": ["cme_status", "cme_sources_list", "cme_export_status"] }
35
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdrelle/wiki-manager",
3
- "version": "0.15.43",
3
+ "version": "0.15.49",
4
4
  "description": "Agentic shell and orchestration cockpit for llm-wiki workspaces.",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "dotrelle",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "start": "bun ./bin/wiki-manager.js",
14
- "test": "node --test src/cli/runtimeStartup.test.js src/cli/wiki-manager.test.js src/agent/graph.test.js src/contracts/schemas.test.js src/core/activity.test.js src/core/env.test.js src/core/agentsCompose.test.js src/core/profileServiceStatus.test.js src/core/workspaceProfile.test.js src/core/buildInfo.test.js src/core/agentEvents.test.js src/core/runtimeLog.test.js src/activity/activityAggregator.test.js src/graph/runGraphProjector.test.js src/core/workflow.test.js src/core/planPatch.test.js src/core/agentLoop.test.js src/core/plan.test.js src/core/mcp.test.js src/core/toolLoop.test.js src/core/documentIntake.test.js src/core/dockerCompose.test.js src/core/otherWorkspacesRunning.test.js src/core/wikiSetup.test.js src/core/wikiWorkspace.test.js src/core/wikirc.test.js src/core/workspaceInherit.test.js src/core/cacert.test.js src/core/composeOverrides.test.js src/core/setEnvValue.test.js src/core/commandFailure.test.js src/core/googleGrants.test.js src/core/modelFetch.test.js src/core/startupCheck.test.js src/core/queueStore.test.js src/orchestrator/agentRegistry.test.js src/orchestrator/capabilityRegistry.test.js src/orchestrator/capabilityResolver.test.js src/orchestrator/planValidator.test.js src/orchestrator/planIntegrator.test.js src/orchestrator/taskStatuses.test.js src/orchestrator/scheduler.test.js src/orchestrator/attemptManager.test.js src/orchestrator/resultAggregator.test.js src/orchestrator/approvalPolicy.test.js src/orchestrator/dispatcher.test.js src/orchestrator/objectiveResolver.test.js src/commands/slash.test.js src/shell/repl.test.js src/shell/setupWizardModality.test.js src/shell/setupWizardPlaceholders.test.js src/shell/setupWizardSuggestions.test.js src/shell/setupWizardDiscovery.test.js src/shell/wrapText.test.js src/runtime/lifecycle.test.js src/runtime/store.test.js src/runtime/workspaceIsolation.test.js src/runtime/controlMessages.test.js src/runtime/recoveryManager.test.js src/runtime/server.test.js src/runtime/supervisor.test.js src/runtime/delegation.test.js src/runtime/runner.test.js src/runtime/runner.e2e.test.js src/runtime/donna-contract.test.js src/runtime/auth.test.js",
14
+ "test": "node --test src/core/skillInvocation.test.js src/core/skillCompiler.test.js src/runtime/skillRun.test.js src/runtime/controlDrain.test.js src/runtime/controlCancellation.test.js src/cli/runtimeStartup.test.js src/cli/wiki-manager.test.js src/agent/graph.test.js src/agent/skillRecursion.test.js src/contracts/schemas.test.js src/core/activity.test.js src/core/env.test.js src/core/agentsCompose.test.js src/core/profileServiceStatus.test.js src/core/workspaceProfile.test.js src/core/buildInfo.test.js src/core/agentEvents.test.js src/core/skillChainView.test.js src/core/runtimeLog.test.js src/activity/activityAggregator.test.js src/graph/runGraphProjector.test.js src/core/workflow.test.js src/core/planPatch.test.js src/core/agentLoop.test.js src/core/plan.test.js src/core/mcp.test.js src/core/toolLoop.test.js src/core/documentIntake.test.js src/core/dockerCompose.test.js src/core/otherWorkspacesRunning.test.js src/core/wikiSetup.test.js src/core/wikiWorkspace.test.js src/core/wikirc.test.js src/core/workspaceInherit.test.js src/core/cacert.test.js src/core/composeOverrides.test.js src/core/setEnvValue.test.js src/core/commandFailure.test.js src/core/googleGrants.test.js src/core/modelFetch.test.js src/core/startupCheck.test.js src/core/queueStore.test.js src/orchestrator/agentRegistry.test.js src/orchestrator/capabilityRegistry.test.js src/orchestrator/capabilityResolver.test.js src/orchestrator/planValidator.test.js src/orchestrator/planIntegrator.test.js src/orchestrator/taskStatuses.test.js src/orchestrator/scheduler.test.js src/orchestrator/attemptManager.test.js src/orchestrator/resultAggregator.test.js src/orchestrator/approvalPolicy.test.js src/orchestrator/dispatcher.test.js src/orchestrator/objectiveResolver.test.js src/commands/slash.test.js src/shell/repl.test.js src/shell/setupWizardModality.test.js src/shell/setupWizardPlaceholders.test.js src/shell/setupWizardSuggestions.test.js src/shell/setupWizardDiscovery.test.js src/shell/wrapText.test.js src/runtime/lifecycle.test.js src/runtime/store.test.js src/runtime/workspaceIsolation.test.js src/runtime/controlMessages.test.js src/runtime/recoveryManager.test.js src/runtime/server.test.js src/runtime/supervisor.test.js src/runtime/delegation.test.js src/runtime/runner.test.js src/runtime/runner.e2e.test.js src/runtime/skillChain.e2e.test.js src/runtime/donna-contract.test.js src/runtime/approvals.test.js src/runtime/auth.test.js",
15
15
  "check-versions": "node scripts/check-versions.js",
16
16
  "prepack": "node scripts/check-versions.js",
17
17
  "prepublishOnly": "node scripts/check-versions.js",