@plurnk/plurnk 0.74.0 → 0.76.0

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 (96) hide show
  1. package/.env.defaults +3 -4
  2. package/README.md +60 -23
  3. package/completions/_plurnk +13 -0
  4. package/completions/plurnk.bash +14 -0
  5. package/completions/plurnk.fish +37 -0
  6. package/conformance/agui-client.json +863 -0
  7. package/dist/agents.d.ts +11 -0
  8. package/dist/agents.d.ts.map +1 -0
  9. package/dist/agents.js +170 -0
  10. package/dist/agents.js.map +1 -0
  11. package/dist/agui.d.ts +1 -0
  12. package/dist/agui.d.ts.map +1 -1
  13. package/dist/agui.js +45 -5
  14. package/dist/agui.js.map +1 -1
  15. package/dist/agui_cli.d.ts +1 -4
  16. package/dist/agui_cli.d.ts.map +1 -1
  17. package/dist/agui_cli.js +29 -9
  18. package/dist/agui_cli.js.map +1 -1
  19. package/dist/build-info.json +1 -1
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/cli.js +12 -7
  22. package/dist/cli.js.map +1 -1
  23. package/dist/color.d.ts +2 -0
  24. package/dist/color.d.ts.map +1 -0
  25. package/dist/color.js +5 -0
  26. package/dist/color.js.map +1 -0
  27. package/dist/completion.js +4 -4
  28. package/dist/completion.js.map +1 -1
  29. package/dist/diagnostics.d.ts +1 -1
  30. package/dist/diagnostics.d.ts.map +1 -1
  31. package/dist/diagnostics.js +4 -2
  32. package/dist/diagnostics.js.map +1 -1
  33. package/dist/dispatcher.d.ts +8 -8
  34. package/dist/dispatcher.d.ts.map +1 -1
  35. package/dist/dispatcher.js +196 -104
  36. package/dist/dispatcher.js.map +1 -1
  37. package/dist/envdefaults.d.ts.map +1 -1
  38. package/dist/envdefaults.js +4 -6
  39. package/dist/envdefaults.js.map +1 -1
  40. package/dist/markdown.d.ts +17 -0
  41. package/dist/markdown.d.ts.map +1 -0
  42. package/dist/markdown.js +234 -0
  43. package/dist/markdown.js.map +1 -0
  44. package/dist/mcp.d.ts +11 -1
  45. package/dist/mcp.d.ts.map +1 -1
  46. package/dist/mcp.js +213 -69
  47. package/dist/mcp.js.map +1 -1
  48. package/dist/paste.d.ts +1 -0
  49. package/dist/paste.d.ts.map +1 -1
  50. package/dist/paste.js +5 -0
  51. package/dist/paste.js.map +1 -1
  52. package/dist/paths.d.ts +2 -0
  53. package/dist/paths.d.ts.map +1 -0
  54. package/dist/paths.js +12 -0
  55. package/dist/paths.js.map +1 -0
  56. package/dist/plan.d.ts +12 -0
  57. package/dist/plan.d.ts.map +1 -0
  58. package/dist/plan.js +30 -0
  59. package/dist/plan.js.map +1 -0
  60. package/dist/proposal.d.ts +3 -5
  61. package/dist/proposal.d.ts.map +1 -1
  62. package/dist/proposal.js +54 -34
  63. package/dist/proposal.js.map +1 -1
  64. package/dist/reasoning-events.d.ts +23 -0
  65. package/dist/reasoning-events.d.ts.map +1 -0
  66. package/dist/reasoning-events.js +40 -0
  67. package/dist/reasoning-events.js.map +1 -0
  68. package/dist/reasoning.d.ts +11 -0
  69. package/dist/reasoning.d.ts.map +1 -0
  70. package/dist/reasoning.js +10 -0
  71. package/dist/reasoning.js.map +1 -0
  72. package/dist/render.d.ts +4 -0
  73. package/dist/render.d.ts.map +1 -1
  74. package/dist/render.js +93 -50
  75. package/dist/render.js.map +1 -1
  76. package/dist/skills.d.ts +7 -0
  77. package/dist/skills.d.ts.map +1 -0
  78. package/dist/skills.js +152 -0
  79. package/dist/skills.js.map +1 -0
  80. package/dist/stream.d.ts.map +1 -1
  81. package/dist/stream.js +11 -11
  82. package/dist/stream.js.map +1 -1
  83. package/dist/subcommands.d.ts +3 -0
  84. package/dist/subcommands.d.ts.map +1 -1
  85. package/dist/subcommands.js +32 -11
  86. package/dist/subcommands.js.map +1 -1
  87. package/dist/transport.d.ts +12 -4
  88. package/dist/transport.d.ts.map +1 -1
  89. package/dist/transport.js +77 -21
  90. package/dist/transport.js.map +1 -1
  91. package/dist/tui.d.ts +23 -13
  92. package/dist/tui.d.ts.map +1 -1
  93. package/dist/tui.js +335 -92
  94. package/dist/tui.js.map +1 -1
  95. package/man/plurnk.1 +153 -0
  96. package/package.json +16 -9
package/.env.defaults CHANGED
@@ -1,9 +1,8 @@
1
1
  # @plurnk/plurnk — the CLI/TUI client. Owned prefix: PLURNK_CLIENT_* (ecosystem
2
2
  # standard: every package ships its knobs; this file IS the documentation).
3
- # The client loads this itself, set-if-unset, BENEATH the operator's env the
4
- # shared ~/.plurnk cascade and shell exports always win. The daemon's address
5
- # (PLURNK_HOST/PLURNK_PORT) and model aliases (PLURNK_MODEL*) are the daemon
6
- # family's keys, documented in ITS floor catalog (~/.plurnk/.env.defaults).
3
+ # The client loads this itself, set-if-unset, beneath project/user env files and
4
+ # shell exports. The daemon owns its address, model, and provider keys; inspect
5
+ # their complete owner-labelled catalog with `plurnk-service config defaults`.
7
6
 
8
7
  # Resume a workspace by name, or create it (rooted at cwd) if none exists.
9
8
  # Unset = a fresh auto-named workspace per invocation ("cli" one-shot / "tui" REPL).
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # plurnk
2
2
 
3
- Terminal client for [plurnk-service](https://github.com/plurnk/plurnk-service) type a prompt, drive a real model loop through the plurnk DSL. CLI one-shot, interactive TUI, and read-only subcommands over ONE wire: AG-UI+ (the daemon's sole client surface).
3
+ A terminal client for [plurnk-service](https://github.com/plurnk/plurnk-service). Type a prompt, drive a real model loop through the plurnk DSL — a compact grammar where the model emits operations, the daemon executes them against real workspaces, and the client renders the trace. CLI one-shot, interactive TUI, and state commands share ONE wire: AG-UI+ (the daemon's sole client surface).
4
+
5
+ Plurnk gets its power from structure, not raw model capability: the grammar forces disciplined multi-turn loops, real receipts for every operation, and a budget the model can actually see and manage. Fancy agent behavior on weak models.
4
6
 
5
7
  ## install
6
8
 
7
9
  Try it instantly — zero install, npx fetches both (always latest):
8
10
 
9
11
  ```
10
- export PLURNK_API_KEY="…" # your plurnk key
12
+ export PLURNK_API_KEY="…" # your plurnk key (optional! works with everything.)
11
13
  npx @plurnk/plurnk-service start # daemon — terminal 1
12
14
  npx @plurnk/plurnk "what is 2+2?" # client — terminal 2
13
15
  ```
@@ -20,59 +22,94 @@ npm install -g @plurnk/plurnk-service # the daemon — its own (lean) install
20
22
  plurnk-service # start the background daemon
21
23
  ```
22
24
 
23
- The client is a pure AG-UI+ consumer: it POSTs runs/actions to the daemon's module at `http://PLURNK_HOST:PLURNK_PORT` (default `127.0.0.1:3044`) and never starts one — the daemon is installed and run separately. All engine config — models, turns, providers — lives in the daemon's environment.
25
+ The client never starts a daemon. It POSTs runs/actions to the daemon's module at `http://PLURNK_HOST:PLURNK_PORT` (default `127.0.0.1:3044`). All engine config — models, providers, turns — lives in the daemon's environment.
24
26
 
25
27
  ## use
26
28
 
27
29
  ```
30
+ plurnk # interactive TUI (no args, a TTY)
28
31
  plurnk "what is the capital of France?" # one-shot — bare answer on stdout
29
- plurnk --json "…" | jq -r .response # json mode: ONE complete record document
30
- plurnk read 3/1/2 --json # drill into one op by L/T/S coordinate
31
- cat notes.md | plurnk "summarize this" # piped stdin (appended)
32
- plurnk # interactive TUI (no args, a TTY)
33
- plurnk models | session list | log read … # read-only subcommands
34
- plurnk --help # full flag list
32
+ plurnk --json "…" | jq -r .response # json mode: ONE complete record document
33
+ plurnk --workspace project mcp enable gitea # activate project-specialized config
34
+ cat notes.md | plurnk "summarize this" # piped stdin (appended)
35
+ plurnk models | workspace list | log read … # inspect daemon state
36
+ plurnk reasoning high --workspace my-work # persist worker reasoning policy
37
+ plurnk --help # full flag list
35
38
  ```
36
39
 
37
40
  **Two output modes.** Default: stdout is the bare answer, stderr the trace — `plurnk "X" > a.txt` captures just the answer. `--json` (or `PLURNK_CLIENT_JSON`): one complete structured document on stdout (`response` + `turns[].ops` + `notices` + the daemon's exact `usage.accounting` envelope), stderr silent, failures as RFC 9457 Problems under `{"problem":…}`. Op *content* isn't inlined — fetch it on demand with `plurnk read <coord>`. The CLI is the integration layer: shell out, parse — no protocol client to build.
38
41
 
42
+ Readable provider reasoning appears as a distinct `💭` trace before the paired
43
+ SEND. It comes from AG-UI's standard reasoning events; PLAN remains the model's
44
+ durable public work inventory.
45
+
39
46
  **Line language** (converged across the TUI, the CLI prefixes, and plurnk.nvim's `:AI`):
40
47
 
41
48
  | | |
42
49
  |---|---|
43
50
  | `text` | a prompt (`?`=ask / `:`=act prefix) |
44
- | `/verb` | `/models /workspaces /workers /log /model /child /yolo /workspace [name] /worker [name] /rename <name> /stop /quit`, membership `/pick /hide /view /drop /members`, `/import <path>`, workspace MCP `/mcp [definition.json]` |
45
- | `# PLAN0` / `## OP0` | raw PLURNK (`op.parse`) |
51
+ | `/verb` | `/models /workspaces /workers /log /model /child /reasoning /yolo /workspace [name] /worker [name] /rename <name> /stop /quit`, membership `/pick /hide /view /drop /members`, `/import <path>`, workspace MCP `/mcp`, and universal Agent Skills `/skills` |
46
52
  | `! cmd` | exec via the daemon |
47
- | `... text` | inject into the running loop (or just type — a mid-loop prompt steers) |
48
-
49
- Tab completes verbs, model aliases, file paths (`/pick`, `@file`), and PLURNK headings (`## RE`→`## READ0`). Multi-line paste folds to one prompt.
50
-
51
- **Key flags:** `--model <alias>` · `--yolo` (client auto-accept) · `--auto` (loop authority) · `--json` · `--workspace/--worker <name>` · `--project-root <p>` · `--max-turns <n>` · `--timeout <s>` · membership `--pick/--hide/--view <glob>` · `--files-items <n>` · `--md NAME=path`.
52
53
 
53
- **Env:** `PLURNK_HOST`/`PLURNK_PORT` (the daemon's one client surface, default `127.0.0.1:3044`; `PLURNK_AGUI_URL` overrides for a remote portal) · `PLURNK_CLIENT_WORKSPACE` / `PLURNK_CLIENT_WORKER` · `PLURNK_MODEL` / `PLURNK_MODEL_CHILD` · `PLURNK_CLIENT_YOLO` · `PLURNK_AUTO` · `PLURNK_CLIENT_PROJECT_ROOT`. Shared **`~/.plurnk`** cascade with the daemon: `~/.plurnk/.env.defaults` < `~/.plurnk/.env` < `./.env` < `--env-file`/`--env-file-if-exists` < shell.
54
+ **Key flags:** `--model <selector>` · `--reasoning <policy>` · `--yolo` (client auto-accept) · `--auto` (loop authority) · `--json` · `--workspace/--worker <name>` · `--project-root <p>` · `--max-turns <n>` · `--timeout <s>` · membership `--pick/--hide/--view <glob>` · `--files-items <n>` · `--md NAME=path`.
54
55
 
55
56
  ## what plurnk is
56
57
 
58
+ From the model's perspective, plurnk is an operating environment, not a bag of tools: the log is its address space, the materialized packet is its working set, and the OPs are a small, stable system-call vocabulary over heterogeneous resources.
59
+
57
60
  The model emits operations in a compact grammar; the daemon executes them, persists state, and the client renders the trace:
58
61
 
59
62
  ```
60
63
  # PLAN0
61
- Update the known capital, then answer.
64
+ {"entries":[{"content":"Update the capital, then answer.","status":"in_progress"}]}
62
65
 
63
- ## EDIT0 [+france,+europe] (known://countries/france/capital)
66
+ ## EDIT0 [+france,+europe] (worker:///countries/france/capital)
64
67
  Paris
65
68
 
66
69
  ## SEND0 [200]
67
70
  Paris
68
71
  ```
69
72
 
70
- Multi-turn loops emerge from the structure — `## SEND0 [102]` continues, `## SEND0 [200]` terminates fancy agent behavior on weak models via grammar rather than raw capability. See [plurnk-service](https://github.com/plurnk/plurnk-service).
73
+ Multi-turn loops emerge from the structure — `## SEND0 [102]` continues, `## SEND0 [200]` terminates. Every operation returns a real receipt; the model reads them and plans the next turn. The full grammar and its rationale live in [plurnk-service](https://github.com/plurnk/plurnk-service) (`plurnk-contracts/plurnk.md` — the model-facing contract).
74
+
75
+ What the daemon brings to those turns:
76
+
77
+ - **Private by default** — the embedding model and the per-model tokenizer vocabularies are bundled and offline. No network, no vendor sees your files.
78
+ - **One language, not a tool catalog** — explore and transform the environment with globs, regex, jsonpath, xpath, and cosine similarity, all in the same grammar. The model learns one interface instead of dozens of schemas.
79
+ - **A real environment** — a filesystem jail per project (configurable to any security posture, including none); `~phrase` FIND runs semantic search against the embedded model; the packet shows the model exactly what every row costs, from token-accurate budgets.
80
+ - **Curation, not compaction** — no context-compaction algorithms, no garbage collection. The model `FOLD`s and `OPEN`s (or `KILL`s) log items by address, usually in bulk patterns: no helper model knows what's relevant better than the model itself.
81
+ - **Topology on demand** — the model forks sister subagents, spawns children, or fires bare one-shot requests, shaping its own graph; parent and child endpoints can be different models, for cheap orchestrator-driven workflows.
82
+ - **Rails & recovery** — GBNF grammar constraints keep low-end models reliable; the model-managed context optimizes tiny KV footprints; structured failure recovery keeps extended runs alive on modest models.
83
+ - **Interop** — universal Agent Skills, and MCP hosting (stdio, remote HTTP, interactive OAuth, client credentials); attached tools materialize in the model's discovery surface like native ones.
84
+ - **Forensics** — every run is reproducible: per-op receipts, structured notices, and the daemon's digest with full packet capture.
85
+
86
+ ## configuration
87
+
88
+ **Env cascade** (the client's side): packaged `.env.defaults` floor < `${XDG_CONFIG_HOME:-$HOME/.config}/plurnk/.env` < project `./.env` < repeated `--env-file` flags (last wins) < shell. `plurnk-service config defaults` prints the complete owner-labelled catalog on demand.
89
+
90
+ **Client env:** `PLURNK_HOST`/`PLURNK_PORT` (the daemon's one client surface, default `127.0.0.1:3044`; `PLURNK_AGUI_URL` overrides for a remote portal) · `PLURNK_CLIENT_WORKSPACE` / `PLURNK_CLIENT_WORKER` · `PLURNK_CLIENT_YOLO` · `PLURNK_AUTO` · `PLURNK_CLIENT_PROJECT_ROOT`.
91
+
92
+ **Models** are daemon-side. A worker durably owns its selected route; `--model` and `/model` accept either a declared alias or an exact `provider/model` selector and persist it without adding model policy to subsequent loops. `plurnk models [search]` and `/models [search]` query the daemon's bounded catalog only when requested. Provider credentials and the `PLURNK_MODEL` default live in the daemon's environment — the client never holds a key or guesses readiness.
93
+
94
+ **Agents:** `/agents` lists this Worker's outbound A2A agents; `/agents discover <url>|add <alias> <url> [options.json]|enable|disable|remove` are the daemon's common Functionality actions; an enabled agent is `a2a://<alias>` to the model.
95
+
96
+ **Skills:** `/skills` lists this Worker's Agent Skills; `/skills discover|add <name> <source> [--global]|enable|disable|remove` are the daemon's common Functionality actions — the client runs no package manager. Project skills live in `.agents/skills`; global skills live in `~/.agents/skills`.
97
+
98
+ **MCP:** project-local `PLURNK_MCP_*` declarations accompany `/mcp` and `plurnk mcp enable`; the daemon remains their sole parser and activation owner. See the plurnk-mcp docs in plurnk-service for the declaration shapes (npx servers, remote endpoints, `_TOOLS`/`_READ` policies).
99
+
100
+ ## troubleshooting & forensics
101
+
102
+ - `plurnk read <loop>/<turn>/<seq> --json` — inspect the exact operation result at a log coordinate.
103
+ - `--json` mode carries `notices` and `usage.accounting` — cost and diagnostics without a UI.
104
+ - Exit codes: `0` success (`## SEND0 [200]`) · `1` runtime error · `2` maxTurns cap · `3` cancelled (`## SEND0 [499]` / `--timeout`) · `4` loop failed (4xx/5xx final) · `64` usage error.
105
+ - Deeper forensics (per-turn packet capture, the budget grinder's records, edit receipts) live in the daemon's digest — see plurnk-service's README.
71
106
 
72
- ## exit codes (CLI mode)
107
+ ## related
73
108
 
74
- `0` success (`## SEND0 [200]`) · `1` runtime error · `2` maxTurns cap · `3` cancelled (`## SEND0 [499]` / `--timeout`) · `4` loop failed (4xx/5xx final) · `64` usage error.
109
+ - [plurnk-service](https://github.com/plurnk/plurnk-service) the daemon, contracts, and grammar authority
110
+ - [plurnk.nvim](https://github.com/plurnk/plurnk.nvim) — Neovim-integrated Plurnk client (`:AI`)
111
+ - [SPEC.md](SPEC.md) — the client's behavioral contract; [TUI.md](TUI.md) — terminal design rationale
75
112
 
76
113
  ## license
77
114
 
78
- MIT.
115
+ MIT. Standards-oriented, not lock-in: the client speaks AG-UI, the tooling surface is MCP2, and the whole stack is open source.
@@ -0,0 +1,13 @@
1
+ #compdef plurnk
2
+ # zsh completion for plurnk (generated by scripts/generate-posix.mjs)
3
+ local -a flags subs
4
+ flags=(--help --version --json --workspace --worker --model --reasoning --project-root --yolo --auto --flags --request_user_input --env-file --env-file-if-exists --max-turns --timeout --pick --hide --view --files-items --md --max-commands --no-git --loop --turn --since --limit --provider --all --offset)
5
+ subs=(models workspace log reasoning mcp script)
6
+ if [[ $words[CURRENT] == -* ]]; then
7
+ compadd -- $flags
8
+ elif (( CURRENT == 2 )); then
9
+ compadd -- $subs
10
+ _files
11
+ else
12
+ _files
13
+ fi
@@ -0,0 +1,14 @@
1
+ # bash completion for plurnk (generated by scripts/generate-posix.mjs)
2
+ _plurnk() {
3
+ local cur=${COMP_WORDS[COMP_CWORD]}
4
+ local flags="--help --version --json --workspace --worker --model --reasoning --project-root --yolo --auto --flags --request_user_input --env-file --env-file-if-exists --max-turns --timeout --pick --hide --view --files-items --md --max-commands --no-git --loop --turn --since --limit --provider --all --offset"
5
+ local subs="models workspace log reasoning mcp script"
6
+ if [[ $cur == -* ]]; then
7
+ COMPREPLY=($(compgen -W "$flags" -- "$cur"))
8
+ elif [[ $COMP_CWORD -eq 1 ]]; then
9
+ COMPREPLY=($(compgen -W "$subs" -- "$cur") $(compgen -f -- "$cur"))
10
+ else
11
+ COMPREPLY=($(compgen -f -- "$cur"))
12
+ fi
13
+ }
14
+ complete -F _plurnk plurnk
@@ -0,0 +1,37 @@
1
+ # fish completion for plurnk (generated by scripts/generate-posix.mjs)
2
+ complete -c plurnk -n __fish_use_subcommand -a models
3
+ complete -c plurnk -n __fish_use_subcommand -a workspace
4
+ complete -c plurnk -n __fish_use_subcommand -a log
5
+ complete -c plurnk -n __fish_use_subcommand -a reasoning
6
+ complete -c plurnk -n __fish_use_subcommand -a mcp
7
+ complete -c plurnk -n __fish_use_subcommand -a script
8
+ complete -c plurnk -l help
9
+ complete -c plurnk -l version
10
+ complete -c plurnk -l json
11
+ complete -c plurnk -l workspace
12
+ complete -c plurnk -l worker
13
+ complete -c plurnk -l model
14
+ complete -c plurnk -l reasoning
15
+ complete -c plurnk -l project-root
16
+ complete -c plurnk -l yolo
17
+ complete -c plurnk -l auto
18
+ complete -c plurnk -l flags
19
+ complete -c plurnk -l request_user_input
20
+ complete -c plurnk -l env-file
21
+ complete -c plurnk -l env-file-if-exists
22
+ complete -c plurnk -l max-turns
23
+ complete -c plurnk -l timeout
24
+ complete -c plurnk -l pick
25
+ complete -c plurnk -l hide
26
+ complete -c plurnk -l view
27
+ complete -c plurnk -l files-items
28
+ complete -c plurnk -l md
29
+ complete -c plurnk -l max-commands
30
+ complete -c plurnk -l no-git
31
+ complete -c plurnk -l loop
32
+ complete -c plurnk -l turn
33
+ complete -c plurnk -l since
34
+ complete -c plurnk -l limit
35
+ complete -c plurnk -l provider
36
+ complete -c plurnk -l all
37
+ complete -c plurnk -l offset