kward 0.76.0 → 0.78.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 (106) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +8 -1
  3. data/CHANGELOG.md +62 -0
  4. data/Gemfile.lock +2 -2
  5. data/README.md +13 -4
  6. data/doc/agent-tools.md +0 -3
  7. data/doc/api.md +4 -0
  8. data/doc/code-search.md +9 -6
  9. data/doc/composer.md +219 -0
  10. data/doc/configuration.md +114 -27
  11. data/doc/editor.md +18 -2
  12. data/doc/files.md +1 -1
  13. data/doc/getting-started.md +4 -0
  14. data/doc/git.md +2 -2
  15. data/doc/lifecycle-hooks.md +2 -14
  16. data/doc/pan.md +167 -0
  17. data/doc/permissions.md +179 -0
  18. data/doc/plugins.md +58 -0
  19. data/doc/rpc.md +61 -22
  20. data/doc/security.md +184 -0
  21. data/doc/tabs.md +4 -3
  22. data/doc/usage.md +15 -32
  23. data/doc/web-search.md +4 -2
  24. data/lib/kward/ansi.rb +2 -2
  25. data/lib/kward/auth/anthropic_oauth.rb +2 -2
  26. data/lib/kward/auth/github_oauth.rb +3 -3
  27. data/lib/kward/auth/oauth_helpers.rb +4 -2
  28. data/lib/kward/auth/openai_oauth.rb +2 -1
  29. data/lib/kward/cancellation.rb +2 -2
  30. data/lib/kward/cli/commands.rb +1 -3
  31. data/lib/kward/cli/interactive_turn.rb +0 -17
  32. data/lib/kward/cli/plugins.rb +24 -7
  33. data/lib/kward/cli/prompt_interface.rb +1 -0
  34. data/lib/kward/cli/rendering.rb +7 -1
  35. data/lib/kward/cli/runtime_helpers.rb +11 -35
  36. data/lib/kward/cli/sessions.rb +14 -5
  37. data/lib/kward/cli/settings.rb +22 -0
  38. data/lib/kward/cli/slash_commands.rb +1 -561
  39. data/lib/kward/cli/tabs.rb +154 -36
  40. data/lib/kward/cli.rb +30 -26
  41. data/lib/kward/compactor.rb +3 -3
  42. data/lib/kward/config_files.rb +28 -0
  43. data/lib/kward/ekwsh.rb +0 -4
  44. data/lib/kward/hooks/catalog.rb +0 -5
  45. data/lib/kward/hooks/http_handler.rb +2 -1
  46. data/lib/kward/http.rb +18 -0
  47. data/lib/kward/image_attachments.rb +1 -1
  48. data/lib/kward/model/client.rb +33 -11
  49. data/lib/kward/model/payloads.rb +6 -1
  50. data/lib/kward/openrouter_model_cache.rb +2 -1
  51. data/lib/kward/pan/index.html.erb +459 -64
  52. data/lib/kward/pan/kward_logo.png +0 -0
  53. data/lib/kward/pan/server.rb +248 -23
  54. data/lib/kward/permissions/policy.rb +171 -0
  55. data/lib/kward/plugin_registry.rb +71 -1
  56. data/lib/kward/prompt_interface/approval_prompt.rb +62 -0
  57. data/lib/kward/prompt_interface/editor/auto_indent.rb +31 -23
  58. data/lib/kward/prompt_interface/editor/modes/vibe.rb +72 -3
  59. data/lib/kward/prompt_interface/layout.rb +0 -4
  60. data/lib/kward/prompt_interface/project_browser.rb +40 -1
  61. data/lib/kward/prompt_interface/question_prompt.rb +12 -3
  62. data/lib/kward/prompt_interface/runtime_state.rb +4 -0
  63. data/lib/kward/prompt_interface/selection_prompt.rb +0 -1
  64. data/lib/kward/prompt_interface/transcript_renderer.rb +0 -12
  65. data/lib/kward/prompt_interface.rb +20 -1
  66. data/lib/kward/prompts/commands.rb +1 -3
  67. data/lib/kward/prompts.rb +20 -0
  68. data/lib/kward/rpc/plugin_chat_manager.rb +299 -0
  69. data/lib/kward/rpc/server.rb +48 -41
  70. data/lib/kward/rpc/session_manager.rb +76 -25
  71. data/lib/kward/rpc/tool_event_normalizer.rb +2 -0
  72. data/lib/kward/rpc/tool_metadata.rb +23 -0
  73. data/lib/kward/rpc/transcript_normalizer.rb +18 -5
  74. data/lib/kward/session_store.rb +55 -16
  75. data/lib/kward/skills/registry.rb +21 -1
  76. data/lib/kward/starter_pack_installer.rb +3 -1
  77. data/lib/kward/tab_driver.rb +87 -0
  78. data/lib/kward/tab_store.rb +74 -12
  79. data/lib/kward/tools/base.rb +14 -0
  80. data/lib/kward/tools/code_search.rb +8 -2
  81. data/lib/kward/tools/fetch_content.rb +4 -2
  82. data/lib/kward/tools/fetch_raw.rb +3 -1
  83. data/lib/kward/tools/registry.rb +45 -17
  84. data/lib/kward/tools/search/code.rb +47 -13
  85. data/lib/kward/tools/search/web.rb +61 -18
  86. data/lib/kward/tools/search/web_fetch.rb +206 -38
  87. data/lib/kward/tools/tool_call.rb +0 -4
  88. data/lib/kward/tools/web_search.rb +3 -1
  89. data/lib/kward/transcript_export.rb +1 -1
  90. data/lib/kward/update_check.rb +2 -1
  91. data/lib/kward/version.rb +1 -1
  92. data/templates/default/kward_navigation.rb +7 -2
  93. data/templates/default/layout/html/layout.erb +2 -2
  94. data/templates/default/layout/html/setup.rb +1 -0
  95. metadata +11 -12
  96. data/lib/kward/workers/git_guard.rb +0 -93
  97. data/lib/kward/workers/job.rb +0 -99
  98. data/lib/kward/workers/live_view.rb +0 -49
  99. data/lib/kward/workers/manager.rb +0 -328
  100. data/lib/kward/workers/queue_runner.rb +0 -166
  101. data/lib/kward/workers/queue_store.rb +0 -112
  102. data/lib/kward/workers/store.rb +0 -72
  103. data/lib/kward/workers/tool_policy.rb +0 -23
  104. data/lib/kward/workers/worker.rb +0 -82
  105. data/lib/kward/workers/write_lock.rb +0 -38
  106. data/lib/kward/workers.rb +0 -10
data/doc/configuration.md CHANGED
@@ -1,10 +1,25 @@
1
1
  # Configuration
2
2
 
3
- Kward reads user configuration from `~/.kward/config.json` by default. Most users do not need to edit this file by hand at first: use `/login`, `/model`, `/reasoning`, and `/settings` from inside Kward when possible.
3
+ Kward reads user configuration from `~/.kward/config.json` by default. Most users should start with `/settings`, `/login`, `/model`, or `/reasoning` inside Kward. Edit JSON directly when you need an advanced setting, an integration, or a reproducible configuration.
4
4
 
5
- On first start, if the file does not exist, Kward creates a starter config with an active Kward persona, explicit disabled memory settings, and the default composer busy-help setting so you can inspect and edit them. Provider-specific model defaults are added only when you choose a provider/model. See [Personas](personas.md) for configuring persona selection by workspace, model, or reasoning effort. If `KWARD_CONFIG_PATH` is set, Kward uses that file instead and treats that file's directory as the config directory for prompts, skills, memory, logs, and caches.
5
+ On first start, Kward creates the file when it does not exist. The starter config records defaults for personas, memory, the composer, editor, overlays, web search, update checks, sessions, skills, MCP, and workspace guardrails. Provider-specific model defaults are added only when you choose a provider or model.
6
6
 
7
- Small examples:
7
+ If `KWARD_CONFIG_PATH` is set, Kward uses that file and treats its directory as the config directory for prompts, skills, memory, logs, and caches.
8
+
9
+ ## Common changes
10
+
11
+ | Goal | Recommended path |
12
+ | --- | --- |
13
+ | Sign in or change accounts | `/settings` → Accounts, or `/login` |
14
+ | Choose a provider, model, or reasoning effort | `/settings` → Model & Reasoning, `/model`, or `/reasoning` |
15
+ | Change editor, diff, overlay, or session UI behavior | `/settings` → Interface |
16
+ | Enable memory | `/settings` → Memory |
17
+ | Configure web search or trust project skills | `/settings` → Tools & Search |
18
+ | Tune compaction | `/settings` → Context & Compaction |
19
+ | Configure personas | `/settings` → Personalization; see [Personas](personas.md) |
20
+ | Add MCP servers, lifecycle hooks, or environment-specific paths | Edit `config.json` directly |
21
+
22
+ Here is a minimal direct provider configuration:
8
23
 
9
24
  ```json
10
25
  {
@@ -13,6 +28,10 @@ Small examples:
13
28
  }
14
29
  ```
15
30
 
31
+ ### MCP servers
32
+
33
+ Add trusted local Model Context Protocol servers under `mcpServers`:
34
+
16
35
  ```json
17
36
  {
18
37
  "mcpServers": {
@@ -24,7 +43,11 @@ Small examples:
24
43
  }
25
44
  ```
26
45
 
27
- See [MCP servers](mcp.md) for connecting local Model Context Protocol servers such as Safari's browser automation server.
46
+ See [MCP servers](mcp.md) for setup, supported fields, and security notes.
47
+
48
+ ### Project skills
49
+
50
+ Kward loads user-level skills but skips project-level skills by default. Enable them only for repositories you trust, either through `/settings` → Tools & Search → Trust project skills or with:
28
51
 
29
52
  ```json
30
53
  {
@@ -34,40 +57,42 @@ See [MCP servers](mcp.md) for connecting local Model Context Protocol servers su
34
57
  }
35
58
  ```
36
59
 
37
- By default, Kward loads user-level skills but skips project-level skills from the workspace. Set `skills.trust_project` to `true`, or use `/settings` → `Tools & Search` → `Trust project skills`, when you trust the repository's `.kward/skills` or `.agents/skills` directories. See [Skills](skills.md) for skill locations and examples.
60
+ See [Skills](skills.md) for skill locations, precedence, examples, and trust behavior.
38
61
 
39
- ```json
40
- {
41
- "updates": {
42
- "check": true
43
- }
44
- }
45
- ```
62
+ ### Update checks
46
63
 
47
- Kward checks RubyGems for newer `kward` versions on the interactive startup screen. Results are cached under `~/.kward/cache/update_check.json` so startup does not hit RubyGems every time. Set `updates.check` to `false`, or set `KWARD_DISABLE_UPDATE_CHECK=1`, to disable the check.
64
+ Kward checks RubyGems for newer versions on the interactive startup screen. Results are cached so startup does not contact RubyGems every time. Disable this automatic network request with:
48
65
 
49
66
  ```json
50
67
  {
51
- "memory": {
52
- "enabled": true
68
+ "updates": {
69
+ "check": false
53
70
  }
54
71
  }
55
72
  ```
56
73
 
74
+ You can also set `KWARD_DISABLE_UPDATE_CHECK=1` for one run. The cache lives at `<config-dir>/cache/update_check.json`.
75
+
57
76
  ## Config directory
58
77
 
59
- By default, Kward stores user data under `~/.kward`:
78
+ By default, Kward stores user data under `~/.kward`. Common files and directories include:
60
79
 
61
80
  ```text
62
81
  ~/.kward/config.json
63
82
  ~/.kward/auth.json
64
83
  ~/.kward/anthropic_auth.json
65
84
  ~/.kward/github_auth.json
85
+ ~/.kward/PRINCIPLES.md
86
+ ~/.kward/ekwsh.yml
87
+ ~/.kward/prompts/
88
+ ~/.kward/skills/
89
+ ~/.kward/plugins/
66
90
  ~/.kward/sessions/
91
+ ~/.kward/history/
67
92
  ~/.kward/memory/
68
93
  ~/.kward/logs/
69
94
  ~/.kward/cache/
70
- ~/.kward/plugins/
95
+ ~/.kward/trusted_workspace_hooks.json
71
96
  ```
72
97
 
73
98
  When `KWARD_CONFIG_PATH=/path/to/config.json` is set, most config-related files live beside that file instead. User plugins are the exception: they are loaded only from `~/.kward/plugins`. See [Plugins](plugins.md) for writing and loading user plugins.
@@ -159,6 +184,8 @@ Model settings:
159
184
 
160
185
  Set `codex_show_raw_reasoning` to `true` to display raw Codex `reasoning_text` when the API does not provide reasoning summary text. It defaults to `false`; raw reasoning can include internal or unstable model output, so enable it only when you explicitly want to inspect that stream.
161
186
 
187
+ `stream_idle_timeout_seconds` limits how long a streamed Codex or Anthropic response may go without receiving data. It defaults to `120`; set a positive value to override it. When the provider is silent longer than this limit, Kward closes the request and applies its normal transient-network retry behavior.
188
+
162
189
  Defaults:
163
190
 
164
191
  - OpenAI/Codex: `gpt-5.6-sol`
@@ -234,21 +261,20 @@ Overlay settings control terminal picker/card layout. New default configs includ
234
261
 
235
262
  You can change these interactively with `/settings`.
236
263
 
237
- ## Web search settings
264
+ <a id="project-browser-icons"></a>
265
+ ## Project browser icons
238
266
 
239
- New default configs enable web search with the automatic provider order:
267
+ `/files` uses text-only rows by default so it remains legible in terminals without a patched icon font. To enable Nerd Font icons explicitly:
240
268
 
241
269
  ```json
242
270
  {
243
- "web_search": {
244
- "enabled": true,
245
- "provider": "auto",
246
- "allow_model_providers": false
271
+ "project_browser": {
272
+ "icons": "nerd-font"
247
273
  }
248
274
  }
249
275
  ```
250
276
 
251
- Existing configs without `web_search` keep the same behavior: web search is enabled, the provider is `auto`, and model-provider fallbacks are disabled unless explicitly enabled.
277
+ `icons` defaults to `off`; the supported values are `off` and `nerd-font`. Kward does not detect terminal fonts. Enable `nerd-font` only after configuring a compatible Nerd Font, such as Hack Nerd Font, in your terminal. You can also select **File icons** under the Interface section of `/settings`.
252
278
 
253
279
  ## Composer settings
254
280
 
@@ -290,7 +316,19 @@ The built-in TUI file editor supports three keybinding modes. Modern is the defa
290
316
  }
291
317
  ```
292
318
 
293
- `mode` can be `modern`, `emacs`, or `vibe`. The old `default` value is still accepted as an alias for `modern`. You can change this from `/settings` > Interface > Editor mode; newly opened editor buffers pick up the setting immediately.
319
+ `mode` can be `modern`, `emacs`, or `vibe`. The old `default` value is still accepted as an alias for `modern`. You can change this from `/settings` Interface Editor mode; newly opened editor buffers pick up the setting immediately.
320
+
321
+ The integrated Git and session diff viewers support unified and side-by-side layouts:
322
+
323
+ ```json
324
+ {
325
+ "editor": {
326
+ "diff_view": "auto"
327
+ }
328
+ }
329
+ ```
330
+
331
+ `diff_view` can be `auto`, `unified`, or `side_by_side`. In `auto` mode, Kward uses side-by-side output when the terminal is at least 120 columns wide and unified output in narrower terminals. Change it with `/settings` → Interface → Diff view.
294
332
 
295
333
  The editor automatically highlights Ruby, Crystal, Elixir, Julia, JavaScript, TypeScript, JSON, Markdown, YAML, Shell, Makefile, HTML, CSS, SCSS, Python, Go, Rust, Java, C#, C, C++, Swift, Kotlin, Lua, and SQL files when terminal color is enabled. Unknown file types and color-disabled terminals render plain text.
296
334
 
@@ -415,11 +453,23 @@ Manual `/compact [instructions]` works even when auto-compaction is disabled.
415
453
 
416
454
  `host` defaults to `0.0.0.0` and `port` defaults to `8765`. Kward fails to start pan mode unless `username` and `password` are configured.
417
455
 
418
- These credentials are stored in plaintext config. Use a private, user-specific password and do not share the config file. Pan mode exposes the agent's file, shell, and web tools to anyone on the LAN who has the credentials, so use it only on trusted networks.
456
+ These credentials are stored in plaintext config. Use a private, user-specific password and do not share the config file. Pan mode exposes the agent's file, shell, web, and configured extension tools to anyone on the LAN who has the credentials, so use it only on trusted networks. See [Pan mode](pan.md) for the full browser workflow, session behavior, security guidance, and limitations.
419
457
 
420
458
  ## Web search
421
459
 
422
- Web search works without an API key through Exa's public MCP endpoint and is advertised to the model by default. To hide the tool:
460
+ Web search is enabled by default with automatic provider selection. Model-backed fallback providers remain disabled unless you explicitly allow them:
461
+
462
+ ```json
463
+ {
464
+ "web_search": {
465
+ "enabled": true,
466
+ "provider": "auto",
467
+ "allow_model_providers": false
468
+ }
469
+ }
470
+ ```
471
+
472
+ Existing configs without a `web_search` object use those same defaults. Web search works without an API key through Exa's public MCP endpoint and is advertised to the model by default. To hide the tool:
423
473
 
424
474
  ```json
425
475
  {
@@ -480,6 +530,43 @@ Workspace guardrails are enabled by default. File tools such as `read_file`, `wr
480
530
 
481
531
  This is not a sandbox setting. Shell commands already run as your OS user from the workspace directory and can access anything that user can access.
482
532
 
533
+ ## Permissions
534
+
535
+ Permissions are off by default. When enabled, Kward evaluates model-requested tools before execution. This is a permission policy, not an operating-system sandbox: permitted shell commands still run with your user account's access.
536
+
537
+ ```json
538
+ {
539
+ "permissions": {
540
+ "enabled": true,
541
+ "mode": "ask"
542
+ }
543
+ }
544
+ ```
545
+
546
+ Available modes are:
547
+
548
+ | Mode | Behavior |
549
+ | --- | --- |
550
+ | `ask` | Read-only tools run normally; file changes, shell commands, web tools, and MCP tools need approval. |
551
+ | `workspace-write` | File changes within `write_scopes` run without approval; shell and network tools still need approval. |
552
+ | `read-only` | Denies file changes, shell commands, web tools, and MCP tools. |
553
+ | `deny-by-default` | Denies risky tools unless an `allow` rule matches. |
554
+
555
+ `allow`, `ask`, and `deny` rules are arrays of objects matching `tool`, `path`, `host`, `command`, or `source`. Deny rules always take precedence, then ask, then allow. Use `write_scopes` to restrict writes in `workspace-write` mode:
556
+
557
+ ```json
558
+ {
559
+ "permissions": {
560
+ "enabled": true,
561
+ "mode": "workspace-write",
562
+ "write_scopes": ["lib/**", "test/**"],
563
+ "deny": [{ "tool": "run_shell_command", "command": "git push*" }]
564
+ }
565
+ }
566
+ ```
567
+
568
+ The interactive CLI presents an approval overlay for an `ask` decision. RPC clients can use their existing `approvalMode: "ask"` bridge. Frontends without an approval bridge, including Pan, fail closed for policy approvals.
569
+
483
570
  ## Logging and stats
484
571
 
485
572
  Local telemetry logs are off by default. Enable logging with the master flag and each category you want:
data/doc/editor.md CHANGED
@@ -16,7 +16,20 @@ The editor is scoped to the current workspace. It only opens files inside that d
16
16
 
17
17
  ## Quick start
18
18
 
19
- Open the file picker by typing `$` as the first character in the composer:
19
+ Open a file directly from your shell:
20
+
21
+ ```bash
22
+ cd ~/code/my-project
23
+ kward edit lib/kward/agent.rb
24
+ ```
25
+
26
+ Kward uses the current directory as the workspace, opens the file in the integrated editor, and exits when you close the editor. Use `--working-directory` when the file belongs to another workspace:
27
+
28
+ ```bash
29
+ kward --working-directory ~/code/my-project edit lib/kward/agent.rb
30
+ ```
31
+
32
+ From an interactive Kward session, open the file picker by typing `$` as the first character in the composer:
20
33
 
21
34
  ```text
22
35
  $lib/kward/agent.rb
@@ -297,6 +310,8 @@ Use normal mode for movement, operators, marks, registers, macros, search, and c
297
310
  | `dir` / `cir` / `yir` | Delete / change / yank inside a Ruby block |
298
311
  | `dar` / `car` / `yar` | Delete / change / yank around a Ruby block |
299
312
  | `yy` | Yank line |
313
+ | `==` | Reindent current line |
314
+ | `={motion}` | Reindent lines covered by a motion or text object |
300
315
  | `"ayy` / `"ap` | Yank / paste with named registers |
301
316
  | `p` | Paste after cursor |
302
317
  | `P` | Paste before cursor |
@@ -338,6 +353,7 @@ Visual mode uses the same motion language as normal mode where practical. Start
338
353
  | `%`, `f`/`F`/`t`/`T` | Extend visual selection with advanced motions |
339
354
  | `iw` / `a(` / `ip` | Select visual text objects |
340
355
  | `>` / `<` | Indent / outdent selected lines |
356
+ | `=` | Reindent selected lines |
341
357
  | `I` / `A` | Insert / append text across visual block lines |
342
358
  | `J` | Join selected lines |
343
359
  | `~` / `u` / `U` | Swapcase / lowercase / uppercase selection |
@@ -408,7 +424,7 @@ Vibe mode is not trying to be Vim. It is a focused subset designed for quick edi
408
424
  - **Counts work with commands and motions**: `3dd` deletes three lines, `2w` moves two words, `5x` deletes five characters.
409
425
  - **`.` repeats the last change**: after `cw word Esc`, pressing `.` changes the next word the same way. Insert-mode keystrokes are recorded as part of the change.
410
426
  - **`/` and `?` search forward and backward**: `n` and `N` repeat the last search. `*` and `#` search for the word under the cursor.
411
- - **Operators with motions**: `d`, `y`, and `c` work with `w` (word), `e` (end of word), `b` (back word), `$` (end of line), `0` (start of line), and `^` (first non-blank).
427
+ - **Operators with motions**: `d`, `y`, `c`, and `=` work with `w` (word), `e` (end of word), `b` (back word), `$` (end of line), `0` (start of line), and `^` (first non-blank). `=` uses Kward's built-in language-aware auto-indent rules.
412
428
  - **Yanks copy to the terminal clipboard**: when OSC 52 is supported, yanked text is also sent to the system clipboard, so you can paste into other applications.
413
429
  - **Registers and macros are supported**: named registers work with yank/delete/paste flows, and `q`/`@` record and replay simple macros for repeated edits.
414
430
  - **Viewport commands**: `zz`, `zt`, and `zb` reposition the cursor line to the center, top, or bottom of the viewport without moving the cursor itself — the same as Vim.
data/doc/files.md CHANGED
@@ -42,7 +42,7 @@ Outside Git, Kward scans the workspace directory and skips common noisy director
42
42
  | `Esc` | Leave search; press again to close the browser |
43
43
  | `@` | Insert the selected file as an `@path` mention |
44
44
 
45
- Directories use `▸` and `▾` markers to show collapsed and expanded state. Files are shown under their containing directory with indentation.
45
+ Directories use `▸` and `▾` markers to show collapsed and expanded state. Files are shown under their containing directory with indentation. File-type icons are off by default; users with a compatible Nerd Font can enable them under Interface in `/settings`. See [Configuration](configuration.md#project-browser-icons).
46
46
 
47
47
  ## Search files
48
48
 
@@ -34,6 +34,8 @@ kward doctor
34
34
 
35
35
  This checks your config, auth, writable directories, and workspace. Run `kward help` to see all available commands and examples.
36
36
 
37
+ Interactive startup also performs a cached RubyGems version check by default. It does not contact RubyGems on every start; disable it with `KWARD_DISABLE_UPDATE_CHECK=1` or the `updates.check` configuration setting. See [Configuration](configuration.md#Update_checks).
38
+
37
39
  If you are working from a checkout instead:
38
40
 
39
41
  ```bash
@@ -128,5 +130,7 @@ Inside interactive Kward:
128
130
  ## Next steps
129
131
 
130
132
  - Read [Usage](usage.md) for day-to-day workflows.
133
+ - Read [Interactive composer](composer.md) for completion, history, file mentions, keyboard shortcuts, busy input, and images.
131
134
  - Read [Configuration](configuration.md) when you want to change providers, models, memory, or web search.
135
+ - Read [Security and trust](security.md) before using Kward with sensitive data, untrusted repositories, or third-party extensions.
132
136
  - Read [Extensibility](extensibility.md) when you want reusable prompts, skills, or project rules.
data/doc/git.md CHANGED
@@ -44,7 +44,7 @@ Use `Shift+Enter` to insert a newline if you need a multi-line commit message.
44
44
 
45
45
  Highlight a file in the `/git` overlay and press `Enter`.
46
46
 
47
- Kward opens a read-only diff viewer in the composer area. It shows classic Git diff output with added and removed lines colorized when terminal color is enabled.
47
+ Kward opens a read-only diff viewer in the composer area. Added and removed lines are colorized when terminal color is enabled. The viewer supports unified and side-by-side layouts; its default `auto` mode uses side-by-side output at 120 columns or wider and unified output in narrower terminals. Choose a fixed layout with `/settings` → Interface → Diff view. See [Configuration](configuration.md#Editor_settings) for the JSON setting.
48
48
 
49
49
  Useful keys in the diff viewer:
50
50
 
@@ -61,7 +61,7 @@ Useful keys in the diff viewer:
61
61
 
62
62
  After you close the viewer, Kward returns to the Git overlay with the file list refreshed.
63
63
 
64
- The diff viewer is read-only. It is meant for checking what changed, not editing. If you spot something you want to fix, close the viewer, return to chat, and ask Kward to make the change or open the file with the built-in editor using `$path/to/file` (see [Configuration](configuration.md) for editor modes and settings).
64
+ The diff viewer is read-only. It is meant for checking what changed, not editing. If you spot something you want to fix, close the viewer, return to chat, and ask Kward to make the change or open the file with the built-in editor using `$path/to/file`. See [Integrated Editor](editor.md) for editor workflows and keybindings.
65
65
 
66
66
  ## Example workflow
67
67
 
@@ -302,18 +302,6 @@ MCP events are emitted in addition to generic `tool_call_*` events for tools pro
302
302
  | `shell_command_before` | `command`, `timeout_seconds`, `cwd` | `command`, `timeout_seconds` |
303
303
  | `shell_command_after` | shell metadata plus `content` | none |
304
304
 
305
- ### Worker events
306
-
307
- | Event | Payload highlights | Supported modifications |
308
- | --- | --- | --- |
309
- | `worker_job_create` | `worker_id`, `role`, `title`, `status`, `session_path` | none |
310
- | `worker_job_start_before` | worker metadata | none |
311
- | `worker_job_start_after` | worker metadata | none |
312
- | `worker_job_ready_for_review` | worker metadata | none |
313
- | `worker_job_failed` | worker metadata plus `error` | none |
314
-
315
- Worker hooks are observe-and-warn hooks for background worker automation and audit trails. They do not control worker scheduling.
316
-
317
305
  ### Git events
318
306
 
319
307
  | Event | Payload highlights | Supported modifications |
@@ -337,9 +325,9 @@ Worker hooks are observe-and-warn hooks for background worker automation and aud
337
325
 
338
326
  `file_change_before` fires before `write_file` or `edit_file` mutates the workspace and can deny or ask for approval. `file_change_after` fires only after successful `write_file` or `edit_file` results.
339
327
 
340
- ### MCP events
328
+ ### Matching MCP tools
341
329
 
342
- MCP tools are surfaced through generic tool events with:
330
+ In addition to the dedicated MCP events above, MCP tools are surfaced through generic tool events with:
343
331
 
344
332
  - `source: "mcp"`
345
333
  - `server_name`
data/doc/pan.md ADDED
@@ -0,0 +1,167 @@
1
+ # Pan mode
2
+
3
+ Pan mode is Kward's browser interface for a workspace. It gives you a mobile-friendly transcript, prompt composer, live tool activity, and access to recent sessions while Kward continues running on your development machine.
4
+
5
+ Use it when you want to work from another browser or device on a trusted network without running the full terminal UI there.
6
+
7
+ ## Before you start
8
+
9
+ Pan is a small local HTTP server, not a hosted service. The machine running Kward performs model requests, reads and edits workspace files, runs tools, and stores sessions.
10
+
11
+ Pan requires HTTP Basic Auth. Add credentials to `~/.kward/config.json`:
12
+
13
+ ```json
14
+ {
15
+ "pan_mode": {
16
+ "host": "0.0.0.0",
17
+ "port": 8765,
18
+ "username": "kward",
19
+ "password": "choose-a-long-private-password"
20
+ }
21
+ }
22
+ ```
23
+
24
+ The defaults are:
25
+
26
+ - `host`: `0.0.0.0`, which listens on all network interfaces.
27
+ - `port`: `8765`.
28
+
29
+ Kward refuses to start Pan unless both `username` and `password` are configured. The password is stored as plaintext in your config file, so do not reuse an important password or share the file.
30
+
31
+ For access from the same machine only, bind to loopback instead:
32
+
33
+ ```json
34
+ {
35
+ "pan_mode": {
36
+ "host": "127.0.0.1",
37
+ "port": 8765,
38
+ "username": "kward",
39
+ "password": "choose-a-long-private-password"
40
+ }
41
+ }
42
+ ```
43
+
44
+ ## Start Pan
45
+
46
+ Run Pan from the project it should control:
47
+
48
+ ```bash
49
+ cd ~/code/my-project
50
+ kward pan
51
+ ```
52
+
53
+ Or select the workspace explicitly:
54
+
55
+ ```bash
56
+ kward --working-directory ~/code/my-project pan
57
+ ```
58
+
59
+ Kward prints the listening URL, workspace, and initial session path. With the default LAN binding, it detects and prints the machine's routed LAN address when available. Open port `8765` at that address, for example:
60
+
61
+ ```text
62
+ http://192.168.1.25:8765/
63
+ ```
64
+
65
+ Your browser asks for the configured Basic Auth username and password.
66
+
67
+ Press `Ctrl+C` in the server terminal to stop Pan. Closing a browser tab does not stop the server or an active turn.
68
+
69
+ ## A normal workflow
70
+
71
+ 1. Start Pan in the workspace you want to use.
72
+ 2. Open the printed address in a browser and sign in.
73
+ 3. Enter a concrete request in the composer:
74
+
75
+ ```text
76
+ Review the current changes, inspect the affected files, and run the focused tests.
77
+ ```
78
+
79
+ 4. Watch reasoning, tool calls, tool output, retries, and the answer stream into the transcript.
80
+ 5. Continue in the same session, or use the session sidebar to switch work.
81
+
82
+ Press Return to send. Use Shift+Return for a new line. The composer grows with multiline input up to its display limit.
83
+
84
+ Prompts are accepted while another turn is running. Pan puts them into a single queue and executes them sequentially. The status below the composer shows whether Kward is working and how many prompts remain queued.
85
+
86
+ ## Work with sessions
87
+
88
+ Pan saves conversations through the same workspace-scoped session store as the interactive CLI. The session sidebar shows up to 50 recent sessions with their title, modified time, and message count.
89
+
90
+ From the sidebar you can:
91
+
92
+ - select a session to resume it,
93
+ - create a new session,
94
+ - rename the active session,
95
+ - delete the active session.
96
+
97
+ On smaller screens, use the menu button to open the session drawer. Selecting a session closes the drawer and loads its transcript.
98
+
99
+ A few details matter:
100
+
101
+ - Pan starts with a new session when the server launches.
102
+ - Creating or resuming a session rebuilds the active conversation and agent around it.
103
+ - You cannot create, resume, rename, or delete sessions while a turn is active or prompts are queued. Wait for the queue to finish.
104
+ - Deleting the active session creates and activates a replacement session first.
105
+ - Pan asks for confirmation before deletion. The interface does not provide an undo action.
106
+ - Sessions remain available to the terminal CLI through `/session` because both frontends use the same session files.
107
+
108
+ See [Sessions](session-management.md) for storage, exports, forks, compaction, and other session operations that remain CLI-oriented.
109
+
110
+ ## Tools and live output
111
+
112
+ Pan creates the normal Kward agent tool registry for the selected workspace. Depending on configuration, the model can use file, shell, web, code-search, skill, and MCP tools just as it can in a normal agent turn.
113
+
114
+ The transcript displays:
115
+
116
+ - user prompts,
117
+ - streamed reasoning and assistant text,
118
+ - tool names and arguments,
119
+ - tool results,
120
+ - retries and errors,
121
+ - restored compaction summaries and prior session content.
122
+
123
+ Assistant and reasoning entries use a built-in, dependency-free Markdown renderer. It supports headings, paragraphs, fenced code blocks, blockquotes, ordered and unordered lists (including task lists), inline code, emphasis, strikethrough, and HTTP(S) or `mailto:` links. Message content remains text-based; unsupported Markdown stays readable as plain text.
124
+
125
+ Structured clarification questions are disabled in Pan because it does not have the interactive question picker. Ask the model to state uncertainties in the transcript when a task needs your decision.
126
+
127
+ Pan does not reproduce terminal-only interfaces such as `/git`, `/files`, `/shell`, the integrated editor, settings pickers, tabs, or clipboard commands. Use natural-language requests for agent work and return to the CLI for those local UI workflows.
128
+
129
+ ## Hooks and plugins
130
+
131
+ Pan runs configured command hooks and trusted plugin lifecycle hooks. Hook events and messages can appear in the browser's live event stream.
132
+
133
+ Pan does not provide a dedicated approval interface for hook `ask` decisions. An approval request without a bridge fails closed, so use deterministic `deny` or non-blocking `warn` policies for Pan-facing hooks.
134
+
135
+ Other plugin UI features, such as custom terminal commands, footers, or interactive canvas commands, are designed for the CLI or RPC clients and do not become controls in the Pan page.
136
+
137
+ See [Lifecycle hooks](lifecycle-hooks.md#Frontend_support) and [Plugins](plugins.md) for the supported extension surfaces.
138
+
139
+ ## Network and security
140
+
141
+ Pan exposes powerful agent tools through ordinary HTTP. Basic Auth protects every page and endpoint, but Pan does not provide TLS.
142
+
143
+ Use these precautions:
144
+
145
+ - Run it only on a network and machine you trust.
146
+ - Prefer `127.0.0.1` when remote access is unnecessary.
147
+ - Do not expose the port directly to the public internet.
148
+ - Do not put Pan behind a public tunnel unless you provide a properly secured TLS/authentication boundary and understand the risk.
149
+ - Use a unique password and protect `config.json`.
150
+ - Remember that anyone with the credentials can submit prompts that cause file reads, edits, shell commands, web requests, or MCP calls with your account's permissions.
151
+ - Stop the server when you are finished.
152
+
153
+ Multiple authenticated browser tabs connect to the same Pan process, active session, prompt queue, and workspace. They are not isolated users. A session change or prompt submitted in one connected browser is visible to the others.
154
+
155
+ Read [Security and trust](security.md) before using Pan with sensitive data or an unfamiliar repository.
156
+
157
+ ## Notes and limitations
158
+
159
+ - Pan serves one configured workspace per process.
160
+ - Turns run one at a time; queued prompts cannot be reordered or cancelled from the page.
161
+ - Session changes are blocked until all active and queued work finishes.
162
+ - There is no model or reasoning picker in the page; Pan uses the configured client defaults when it creates a conversation.
163
+ - There is no dedicated tool-approval UI or structured-question UI.
164
+ - The browser reconnects its event stream after a connection interruption, but events emitted while disconnected are not replayed through that stream. Reloading restores the persisted transcript.
165
+ - Request bodies are limited to 64 KB.
166
+ - Pan displays image entries from restored transcripts as text placeholders rather than rendering attached image data.
167
+ - The server is intentionally small and does not replace the richer CLI or the integration-oriented [RPC protocol](rpc.md).