@knightcodeai/cli 0.20.0 → 0.21.1
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.
- package/CHANGELOG.md +70 -0
- package/dist/bundle/chunks/anthropic-messages-EY2CGNFR.js +6 -0
- package/dist/bundle/chunks/azure-openai-responses-KGI5F27P.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +8 -5
- package/dist/bundle/chunks/chunk-424HQSAU.js +10 -0
- package/dist/bundle/chunks/{chunk-DFRYMT3C.js → chunk-5O4LFJS7.js} +3 -3
- package/dist/bundle/chunks/chunk-BLHRVYHG.js +9 -0
- package/dist/bundle/chunks/{chunk-B7A4GIBK.js → chunk-EJS73Z3L.js} +1 -1
- package/dist/bundle/chunks/chunk-F22TYE3W.js +7 -0
- package/dist/bundle/chunks/{chunk-L6QGGIZG.js → chunk-FSAHEI7P.js} +4 -4
- package/dist/bundle/chunks/chunk-K6AEXKBA.js +30 -0
- package/dist/bundle/chunks/chunk-O2HKRIDR.js +16 -0
- package/dist/bundle/chunks/{chunk-JMJS643J.js → chunk-OLW2IS5G.js} +2 -2
- package/dist/bundle/chunks/chunk-QEVQ7EIS.js +2 -0
- package/dist/bundle/chunks/chunk-RRNUW65U.js +4 -0
- package/dist/bundle/chunks/{chunk-MZ5UVOTP.js → chunk-TOEFTX4C.js} +1 -1
- package/dist/bundle/chunks/{chunk-6KWPS3LA.js → chunk-TOGJI36I.js} +141 -129
- package/dist/bundle/chunks/{chunk-N5M3XNPN.js → chunk-VLP4ZJF6.js} +1 -1
- package/dist/bundle/chunks/chunk-XDEOVQPJ.js +108 -0
- package/dist/bundle/chunks/chunk-YDO6TXKD.js +2 -0
- package/dist/bundle/chunks/{cli-72YA573P.js → cli-CIRIEG66.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-AWHNPEAT.js → cloudflare-workers-ai-system-one-H3D4RYQQ.js} +1 -1
- package/dist/bundle/chunks/{easter-egg-3d-XXPCDCZV.js → easter-egg-3d-YLN6ACWS.js} +1 -1
- package/dist/bundle/chunks/{execute-KWIUMPDE.js → execute-P6HIB6ET.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-HPLZ2ABU.js → google-generative-ai-C3FLXY47.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-E3UTTTIG.js → google-vertex-AXIPR47C.js} +1 -1
- package/dist/bundle/chunks/knightcode-messages-LTLKDRGW.js +8 -0
- package/dist/bundle/chunks/{llama-cpp-classify-FEWC5ZIH.js → llama-cpp-classify-J2EJVDIZ.js} +1 -1
- package/dist/bundle/chunks/mistral-conversations-N2UBIKKR.js +5 -0
- package/dist/bundle/chunks/{openai-codex-responses-BCLSSOJ6.js → openai-codex-responses-REOHLPAA.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-GTNAEXX6.js → openai-completions-XONAGXPC.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-CSQTW3S4.js → openai-decisions-ACB7F6SS.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-ILFXLMJW.js → openai-responses-OHJS7C73.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-J66HXAMB.js → openrouter-images-SMNBEOPV.js} +1 -1
- package/dist/bundle/chunks/{runtime-OW5JKWBE.js → runtime-WNZGA67H.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-QA5VXBEZ.js → typesafe-system-one-KB2F2YGV.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-5DLTLPP7.js → virtual-modules-EU3BUTGN.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/docs/app-server.md +102 -6
- package/docs/app-server.schema.json +493 -0
- package/docs/cli.md +3 -3
- package/docs/custom-provider.md +2 -0
- package/docs/desktop.md +83 -4
- package/docs/environment-variables.md +1 -0
- package/docs/extensions.md +3 -1
- package/docs/keybindings.md +1 -0
- package/docs/mcp.md +16 -2
- package/docs/message-types.md +1 -1
- package/docs/packages.md +2 -0
- package/docs/plan-mode.md +4 -0
- package/docs/settings.md +3 -3
- package/docs/slash-commands.md +2 -0
- package/docs/usage.md +23 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +27 -31
- package/examples/extensions/todo.ts +3 -0
- package/examples/mcp-app/server.mjs +177 -0
- package/package.json +1 -1
- package/dist/bundle/chunks/anthropic-messages-5ZM7Z2XQ.js +0 -6
- package/dist/bundle/chunks/azure-openai-responses-OUS4VJNA.js +0 -2
- package/dist/bundle/chunks/chunk-4CRI7BMY.js +0 -2
- package/dist/bundle/chunks/chunk-6GRVIFTN.js +0 -11
- package/dist/bundle/chunks/chunk-6X7IXVQH.js +0 -30
- package/dist/bundle/chunks/chunk-BWGDAXFH.js +0 -108
- package/dist/bundle/chunks/chunk-FA32X2UJ.js +0 -7
- package/dist/bundle/chunks/chunk-IIWY7U5S.js +0 -7
- package/dist/bundle/chunks/chunk-J63X3FRT.js +0 -16
- package/dist/bundle/chunks/chunk-RKNFSQUG.js +0 -2
- package/dist/bundle/chunks/chunk-UU4A4NV5.js +0 -2
- package/dist/bundle/chunks/knightcode-messages-57CV36UV.js +0 -8
- package/dist/bundle/chunks/mistral-conversations-KT4C4XTZ.js +0 -5
package/docs/app-server.md
CHANGED
|
@@ -372,8 +372,12 @@ file as `{path, additions, deletions}`: the net line totals between the working
|
|
|
372
372
|
tree before and after the turn. A read-back turn carries the same list as
|
|
373
373
|
`Turn.files`. This
|
|
374
374
|
means "changed while the turn ran", not "changed by the turn": an edit another
|
|
375
|
-
local thread or an editor made meanwhile is in the list too. A worktree
|
|
376
|
-
is
|
|
375
|
+
local thread or an editor made meanwhile is in the list too. A worktree
|
|
376
|
+
thread's list is its own unless another thread runs in the same worktree (a
|
|
377
|
+
start whose `cwd` is inside it), whose edits it can include. Untracked files
|
|
378
|
+
count up to 500; past that, those under a folder holding 200 or more untracked
|
|
379
|
+
files are left out, and if more than 500 still remain before or after the
|
|
380
|
+
turn, only tracked files count.
|
|
377
381
|
|
|
378
382
|
Review comments are drafts the client keeps. They travel with the next
|
|
379
383
|
`turn/start` or `turn/queue/add` as `comments`; the server quotes the commented
|
|
@@ -502,6 +506,36 @@ Connections, sign-in and status belong to the MCP extension in each thread
|
|
|
502
506
|
{"id":28,"method":"mcp/add","params":{"scope":"global","name":"docs","config":{"url":"https://example.com/mcp"}}}
|
|
503
507
|
```
|
|
504
508
|
|
|
509
|
+
### `mcp/app/readResource` and `mcp/app/callTool`
|
|
510
|
+
|
|
511
|
+
MCP Apps ([MCP](mcp.md#mcp-apps)): a client that draws apps sends `desktop` as
|
|
512
|
+
its mode; the thread's MCP servers then hear the client supports
|
|
513
|
+
`io.modelcontextprotocol/ui`. A call to a tool with an app carries
|
|
514
|
+
`mcpApp: {server, resourceUri, result?, resultOmitted?}` on its `toolCall`
|
|
515
|
+
item, live and read back: `result` is the server's whole `CallToolResult`
|
|
516
|
+
(with `_meta` and `structuredContent`), or `resultOmitted: true` past 256 KiB
|
|
517
|
+
serialized, when the app gets the item's text output instead.
|
|
518
|
+
|
|
519
|
+
`mcp/app/readResource {threadId, server, uri}` returns the server's
|
|
520
|
+
`ReadResourceResult` `{contents, _meta?}`, the app's HTML first.
|
|
521
|
+
`mcp/app/callTool {threadId, server, name, arguments?, confirmed?}` returns its
|
|
522
|
+
`CallToolResult` `{content, structuredContent?, isError?, _meta?}`. Both reach
|
|
523
|
+
only the named server, through the thread's MCP extension, and only while it is
|
|
524
|
+
connected (`mcpUnavailable` otherwise); a call reaches only a tool whose
|
|
525
|
+
`_meta.ui.visibility` includes `"app"` and that the configuration does not hide
|
|
526
|
+
(`invalidParams` otherwise). Outside `fullAccess`, a tool not annotated
|
|
527
|
+
`readOnlyHint` answers `approvalRequired` (`data: {server, tool}`) until sent
|
|
528
|
+
again with `confirmed: true` after the user agreed. Arguments over 1 MiB and a
|
|
529
|
+
resource over 4 MiB, serialized, answer `invalidParams`; a tool's result over
|
|
530
|
+
4 MiB is left out of an answer whose text says the tool ran, since it did. A call
|
|
531
|
+
during a turn runs
|
|
532
|
+
at once; the server gives the MCP extension 60 seconds to answer a resource read
|
|
533
|
+
(`internal` after that), and a tool call as long as the server's own `timeout`.
|
|
534
|
+
|
|
535
|
+
```json
|
|
536
|
+
{"id":29,"method":"mcp/app/callTool","params":{"threadId":"THREAD_ID","server":"counter","name":"increment","arguments":{"by":1},"confirmed":true}}
|
|
537
|
+
```
|
|
538
|
+
|
|
505
539
|
### `resource/list` and `resource/set`
|
|
506
540
|
|
|
507
541
|
Extensions, skills, prompt templates and themes as `knightcode config` lists them.
|
|
@@ -628,7 +662,7 @@ Diagnostics observe the shared server, not only this connection.
|
|
|
628
662
|
### `thread/diff/read`
|
|
629
663
|
|
|
630
664
|
Params: `{threadId, scope?, against?, commit?, context?, ignoreWhitespace?}`.
|
|
631
|
-
Result: `{scope, root, files, filesOmitted?, untrackedSkipped?, turnId?, stale?, against?}`.
|
|
665
|
+
Result: `{scope, root, files, filesOmitted?, untrackedSkipped?, turnId?, stale?, against?, fromTree?, toTree?}`.
|
|
632
666
|
`files` are `{path, oldPath?, status, binary, additions, deletions, tooLarge?, hunks}`,
|
|
633
667
|
their paths relative to the repository's `root` (not the thread's cwd, which can
|
|
634
668
|
be a subdirectory of it); each hunk keeps its lines with their `" "`, `"+"`, `"-"` or
|
|
@@ -640,7 +674,9 @@ counted (`filesOmitted`). A hunk id hashes the file's header (its blob ids) and
|
|
|
640
674
|
the hunk at the read's `context`: an action must pass the same `context` (a
|
|
641
675
|
`context: 0` id matches no action), and after an action changes a file, read it
|
|
642
676
|
again, as its other hunks' ids change too. A hunk id from an `ignoreWhitespace` read matches no
|
|
643
|
-
action. Reads take no lock and never write the user's index.
|
|
677
|
+
action. Reads take no lock and never write the user's index. Unless
|
|
678
|
+
`ignoreWhitespace` is set, the result also names the two trees it compared,
|
|
679
|
+
`fromTree` and `toTree`, for `thread/diff/file`.
|
|
644
680
|
Errors: `threadNotFound`, `notGitRepo`; `invalidParams` for a missing `commit`
|
|
645
681
|
or no branch to compare with.
|
|
646
682
|
|
|
@@ -648,6 +684,60 @@ or no branch to compare with.
|
|
|
648
684
|
{"id":20,"method":"thread/diff/read","params":{"threadId":"THREAD_ID","scope":"uncommitted","context":3}}
|
|
649
685
|
```
|
|
650
686
|
|
|
687
|
+
### `thread/diff/file`
|
|
688
|
+
|
|
689
|
+
Params: `{threadId, fromTree, toTree, path, oldPath?}`. Result:
|
|
690
|
+
`{old?, new?, binary, tooLarge}`. Both sides of one file from a
|
|
691
|
+
`thread/diff/read` result, by the trees it named, so a client can show the
|
|
692
|
+
unchanged lines between its hunks. `old` is the file in `fromTree` at `oldPath`
|
|
693
|
+
(else `path`), `new` the file in `toTree` at `path`; a side the file is absent
|
|
694
|
+
from is left out. Neither side comes when the file is binary (a NUL in its first
|
|
695
|
+
8 KiB) or either side is larger than 2 MiB. The trees stay readable after the
|
|
696
|
+
working tree moves on, so the sides always match the read's hunks.
|
|
697
|
+
Errors: `threadNotFound`, `notGitRepo`; `invalidParams` when a tree is not a
|
|
698
|
+
full object id of a tree in the repository, or the file is in neither tree.
|
|
699
|
+
|
|
700
|
+
```json
|
|
701
|
+
{"id":24,"method":"thread/diff/file","params":{"threadId":"THREAD_ID","fromTree":"FROM_TREE","toTree":"TO_TREE","path":"src/a.ts"}}
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
### `file/read`
|
|
705
|
+
|
|
706
|
+
Params: `{threadId, path, maxBytes?}`. Result: `{path, size, binary, tooLarge,
|
|
707
|
+
text?, mtimeMs}`. A file's text, `path` resolved against the thread's cwd like a
|
|
708
|
+
tool's path. `maxBytes` is 1 byte to 8 MiB (default 2 MiB). `text` comes only
|
|
709
|
+
when the file is neither binary (a NUL in its first 8 KiB, or bytes that are not
|
|
710
|
+
UTF-8, which decoded and saved would be replaced) nor larger than
|
|
711
|
+
`maxBytes`; `size` is its length in bytes; `mtimeMs` its modification time when
|
|
712
|
+
read, for `file/write`.
|
|
713
|
+
Errors: `threadNotFound`; `invalidParams` when there is no such file or the path
|
|
714
|
+
is not a file.
|
|
715
|
+
|
|
716
|
+
```json
|
|
717
|
+
{"id":25,"method":"file/read","params":{"threadId":"THREAD_ID","path":"src/a.ts"}}
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### `file/list`
|
|
721
|
+
|
|
722
|
+
Params: `{threadId, path?}`. Result: `{root, entries, truncated}`. One folder's
|
|
723
|
+
entries for a file tree: `path` resolved like `file/read`'s, the thread's cwd
|
|
724
|
+
when absent; `root` is the cwd and each entry `{path, type}` is relative to it,
|
|
725
|
+
`/`-separated, `type` `file` or `directory` (a link to a folder is a folder).
|
|
726
|
+
Hidden entries are included. Past 5,000 entries the rest are left out and
|
|
727
|
+
`truncated` is true.
|
|
728
|
+
Errors: `threadNotFound`; `invalidParams` when the path is not a folder or
|
|
729
|
+
cannot be read.
|
|
730
|
+
|
|
731
|
+
### `file/write`
|
|
732
|
+
|
|
733
|
+
Params: `{threadId, path, text, expectedMtimeMs?}`. Result: `{mtimeMs}`. Writes
|
|
734
|
+
`text` (UTF-8, at most 8 MiB) to the file in place, so it keeps its mode and
|
|
735
|
+
links; a missing file is created. With `expectedMtimeMs` (the `mtimeMs` of the
|
|
736
|
+
read the text came from), a file modified since is refused with `fileChanged`
|
|
737
|
+
and left as it is.
|
|
738
|
+
Errors: `threadNotFound`; `fileChanged`; `invalidParams` when the path is a
|
|
739
|
+
folder or cannot be written.
|
|
740
|
+
|
|
651
741
|
### `thread/diff/revert`
|
|
652
742
|
|
|
653
743
|
Params: `{threadId, scope?, against?, commit?, path?, hunkId?, context?, reapply?, turnId?}`.
|
|
@@ -669,7 +759,7 @@ path outside the diff; `gitConflict` with `diffChanged` or `patchFailed`.
|
|
|
669
759
|
|
|
670
760
|
### `thread/handoff`
|
|
671
761
|
|
|
672
|
-
Params: `{threadId, to: "local" | "worktree", branch?, environment?}`. Result:
|
|
762
|
+
Params: `{threadId, to: "local" | "worktree", branch?, environment?, dryRun?}`. Result:
|
|
673
763
|
`{thread, branch?, warnings}`. To the main checkout: the worktree's `HEAD`
|
|
674
764
|
becomes a branch checked out there (the worktree's own branch, else `branch`,
|
|
675
765
|
else the previous handoff's branch fast-forwarded, else
|
|
@@ -680,6 +770,10 @@ checkout gets a worktree. The changes are saved under `<agentDir>/handoff/`
|
|
|
680
770
|
before anything moves and leave the source only after they landed. The thread
|
|
681
771
|
is reloaded where it now runs: subscribers receive `thread/replaced` with the
|
|
682
772
|
same id, and queued inputs follow it.
|
|
773
|
+
With `dryRun`, the server runs every check the handoff would and answers with
|
|
774
|
+
the same refusal, or with the unchanged thread and the branch the main checkout
|
|
775
|
+
would get; it writes nothing, creates no worktree, and never holds up a real
|
|
776
|
+
handoff.
|
|
683
777
|
Errors: `turnInProgress`; `invalidParams` for a thread with no message yet or
|
|
684
778
|
already on that side; `gitConflict` with `localChanges`,
|
|
685
779
|
`operationInProgress`, `branchExists`, `recoveryRequired` (with `data.patch`)
|
|
@@ -734,7 +828,9 @@ it (names unique, at most 50). An untrusted project's scripts never run. See
|
|
|
734
828
|
|
|
735
829
|
Each acts on the thread's own checkout: its worktree, or the user's checkout.
|
|
736
830
|
`git/status` → branch, upstream, ahead/behind, staged/unstaged/untracked/
|
|
737
|
-
conflicted counts and an operation in progress. `git/
|
|
831
|
+
conflicted counts and an operation in progress. `git/origin` → the checkout's
|
|
832
|
+
`root`, the `url` of its origin remote (else its first remote) and the `branch`
|
|
833
|
+
checked out, each absent when there is none. `git/stage` and `git/unstage`
|
|
738
834
|
take `{threadId, path?, hunkId?, context?}`: no path is everything; paths are
|
|
739
835
|
literal. `git/commit {threadId, message?, includeUnstaged?}` stages everything
|
|
740
836
|
first unless `includeUnstaged: false`; an empty message is written by the
|