@dotdrelle/wiki-manager 0.15.42 → 0.15.48

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 (46) hide show
  1. package/README.md +139 -27
  2. package/mcp.endpoints.example.json +1 -1
  3. package/package.json +2 -2
  4. package/src/agent/graph.js +290 -29
  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/profile.js +19 -0
  18. package/src/core/runtimeLog.js +15 -0
  19. package/src/core/runtimeLog.test.js +15 -1
  20. package/src/core/skillChainView.js +84 -0
  21. package/src/core/skillChainView.test.js +50 -0
  22. package/src/core/skillCompiler.js +135 -0
  23. package/src/core/skillCompiler.test.js +91 -0
  24. package/src/core/skillInvocation.js +79 -0
  25. package/src/core/skillInvocation.test.js +73 -0
  26. package/src/core/skills.js +81 -19
  27. package/src/core/wikiWorkspace.test.js +34 -0
  28. package/src/core/workspaceProfile.test.js +55 -0
  29. package/src/runtime/client.js +45 -4
  30. package/src/runtime/controlCancellation.js +33 -0
  31. package/src/runtime/controlCancellation.test.js +49 -0
  32. package/src/runtime/controlDrain.js +50 -0
  33. package/src/runtime/controlDrain.test.js +38 -0
  34. package/src/runtime/server.js +341 -20
  35. package/src/runtime/server.test.js +344 -2
  36. package/src/runtime/skillChain.e2e.test.js +394 -0
  37. package/src/runtime/skillRun.js +104 -0
  38. package/src/runtime/skillRun.test.js +84 -0
  39. package/src/runtime/store.js +69 -0
  40. package/src/runtime/store.test.js +11 -0
  41. package/src/runtime/workspaceIsolation.test.js +178 -0
  42. package/src/shell/RightPane.tsx +3 -2
  43. package/src/shell/repl.js +51 -6
  44. package/src/shell/repl.test.js +41 -0
  45. package/src/shell/useSession.ts +43 -9
  46. package/wiki-workspace +137 -1
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, diagnose, status, wiki-sync
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
 
@@ -273,7 +273,7 @@ just reopens the web page.)*
273
273
  The scaffold ships **ready-to-use examples**. In the shell, explore them:
274
274
 
275
275
  ```text
276
- /skills list the bundled examples (diagnose, pipeline, status, wiki-sync…)
276
+ /skills list the bundled examples (pipeline, wiki-sync, wiki-build, deliver, diagnose, status…)
277
277
  /skills show <name> see what an example does
278
278
  /skills run <name> run it to see the result
279
279
  ```
@@ -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/`.
@@ -329,8 +332,12 @@ At each step, either you **ask for it in plain language**, or you **run the skil
329
332
  rendering.
330
333
  → *"Export and polish the deliverables"*
331
334
 
332
- > 💡 Even simpler: `/skills run wiki-sync` chains export + ingestion, and
333
- > `/skills run pipeline` runs the whole chain end to end.
335
+ > 💡 Even simpler: `/skills run wiki-sync` chains export + ingestion,
336
+ > `/skills run wiki-build` regenerates the deliverables, `/skills run deliver`
337
+ > publishes them (add `polish` to refine the rendering), and
338
+ > `/skills run pipeline` runs the whole chain end to end. The three step skills
339
+ > take an optional argument — a source name, or a template with or without its
340
+ > `.md` extension.
334
341
 
335
342
  ### Entry point B — from a simple PDF (the fastest)
336
343
 
@@ -556,6 +563,14 @@ including under `"*"`. Multi-step work belongs to `/agent`.
556
563
  An `allowActions` key written by an older manager is folded into `allow` on
557
564
  read and removed on the next `agents up`.
558
565
 
566
+ `chatAccess` is not how workspace context reaches chat. The workspace profile
567
+ (`.wiki/profile.md`) is read from disk and injected into the system prompt of
568
+ both modes, so durable preferences — tone, formatting, notification recipient —
569
+ shape every reply without a tool call and without an allow-list entry. Adding
570
+ `profile_read` here would help no existing install anyway: the scaffold's
571
+ additive merge only fills missing top-level keys and never edits an allow-list
572
+ you already have.
573
+
559
574
  ### Adding a connector from the served chat UI
560
575
 
561
576
  `mcp.endpoints.json` stays hand-editable, but the Connectors panel of
@@ -619,22 +634,25 @@ Each recovery is emitted as `run_replanned` and appears in runtime state as
619
634
  `replans`. Limit attempts with `WIKI_MANAGER_REPLANNER_MAX_REPLANS` or per run
620
635
  with `"replans": 1` in the `/run` body.
621
636
 
622
- Runtime approvals support two levels. For run-level approval, post `/run` with
623
- `"requireApproval": true`; the runtime emits `run_pending_approval` before the
624
- first action and waits for `POST /approve?runId=...`. For tool-level approval,
625
- set `requireApproval` on an external endpoint, or set
626
- `WIKI_MANAGER_REQUIRE_APPROVAL_TOOLS=production.production_start_job` for
627
- workspace-native MCP tools. Pending tool approvals appear in the queue with
628
- status `pending_approval` and can be approved with `POST /approve?itemId=...`
629
- 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
630
652
  minutes and can be changed with `WIKI_MANAGER_APPROVAL_TIMEOUT_MS` or
631
- `approvalTimeoutMs` in the `/run` body.
632
-
633
- Directly-launched capability runs (ingest, pipeline) now **wait for approval by
634
- default** before their mutating tasks: reply "valide tout", run `/approve`, or
635
- click Approve in either UI (Shell right-pane banner, or the `serve` banner above
636
- the composer). Auto-approval only happens when the run is started with
637
- `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`).
638
656
 
639
657
  ### Parallelism & throughput
640
658
 
@@ -844,6 +862,38 @@ wiki-workspace wiki my-project build --plan
844
862
  wiki-workspace wiki my-project build
845
863
  ```
846
864
 
865
+ ### Resetting a workspace
866
+
867
+ ```bash
868
+ wiki-workspace wiki my-project down # the services must be stopped
869
+ wiki-workspace wiki my-project reset --dry-run # what would go, what stays
870
+ wiki-workspace wiki my-project reset
871
+ ```
872
+
873
+ `reset` empties a workspace while keeping the **method**: `.wikirc*` (provider,
874
+ model, retrieval, per-profile variants), `templates/` and `build-context/` —
875
+ plus `.env`, which holds the workspace's ports and MCP tokens and without which
876
+ nothing could be restarted.
877
+ Everything the workspace produced, cached or logged goes — `wiki/`,
878
+ `deliverables/`, `raw/untracked/`, `raw/ingested/`, `.wiki/` (vector index,
879
+ cache, logs, tmp, build state, skills, profile, system prompt), `CLAUDE.md`,
880
+ `.gitignore` — then `wiki init` puts the empty structure back.
881
+
882
+ Three things worth knowing:
883
+
884
+ - `.git/` is kept when present, so the state from before the reset stays
885
+ reachable through `wiki restore`. It is the only undo there is.
886
+ - The command refuses to run while workspace services are up: a container
887
+ writing into the bind mount would recreate part of what was erased and leave
888
+ files owned by another UID behind.
889
+ - It stops there. Nothing is re-synced and nothing is rebuilt — refilling the
890
+ workspace is a decision, not a side effect of emptying it.
891
+
892
+ It is available **only** here: there is no `wiki reset` CLI subcommand, no
893
+ production job type, no MCP tool and no skill for it. Nothing Donna can call
894
+ may erase a workspace. Confirmation is interactive (retype the workspace name)
895
+ unless you pass `--yes`.
896
+
847
897
  ## Services
848
898
 
849
899
  The shared `docker-compose.yml` starts one workspace stack:
@@ -991,6 +1041,61 @@ Useful primitives:
991
1041
  Skills are loaded only from the active workspace. The manager itself has no root
992
1042
  `SKILL.md` and no root `skills/` directory.
993
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
+
994
1099
  Workspace switching is isolated. When you run `/use my-project`, the shell
995
1100
  switches both the displayed conversation and the LLM history to `my-project`.
996
1101
  Returning to another workspace restores that workspace's in-memory conversation
@@ -1073,9 +1178,16 @@ node ./bin/wiki-manager.js --headless --workspace my-project --prompt "check pro
1073
1178
 
1074
1179
  Headless mode creates a normal session, runs `/use`, and writes a log under
1075
1180
  `.wiki/logs/` by default. `--prompt` runs one agent turn unless `--wait` is passed.
1076
- `--skill` uses the agentic loop by default: agent turn, wait for active MCP jobs
1077
- declared through `_activity.poll`, then re-invoke the agent with the completed job
1078
- 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.
1079
1191
 
1080
1192
  Useful headless controls:
1081
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.42",
3
+ "version": "0.15.48",
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/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/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/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",