@knightcodeai/cli 0.17.3 → 0.18.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 (281) hide show
  1. package/CHANGELOG.md +1293 -0
  2. package/README.md +2 -2
  3. package/dist/bundle/chunks/anthropic-messages-A2IH2IY3.js +6 -0
  4. package/dist/bundle/chunks/anthropic.js +101 -0
  5. package/dist/bundle/chunks/azure-openai-responses-XZILQZOG.js +2 -0
  6. package/dist/bundle/chunks/bedrock-converse-stream.js +89 -0
  7. package/dist/bundle/chunks/chunk-4CRI7BMY.js +2 -0
  8. package/dist/bundle/chunks/chunk-57BPR4HF.js +2 -0
  9. package/dist/bundle/chunks/chunk-A5LJINMT.js +2 -0
  10. package/dist/bundle/chunks/chunk-AANBXVWQ.js +2 -0
  11. package/dist/bundle/chunks/chunk-ACHHEROF.js +7 -0
  12. package/dist/bundle/chunks/chunk-AFR2OW6S.js +108 -0
  13. package/dist/bundle/chunks/chunk-AHB7JV5B.js +2 -0
  14. package/dist/bundle/chunks/chunk-B2FT7RH5.js +2 -0
  15. package/dist/bundle/chunks/chunk-BRKUE2MD.js +2 -0
  16. package/dist/bundle/chunks/chunk-DKOURXGU.js +2 -0
  17. package/dist/bundle/chunks/chunk-DVFCXHT4.js +2 -0
  18. package/dist/bundle/chunks/chunk-EPYT326Y.js +30 -0
  19. package/dist/bundle/chunks/chunk-ETOMYYZC.js +2 -0
  20. package/dist/bundle/chunks/chunk-FA32X2UJ.js +7 -0
  21. package/dist/bundle/chunks/chunk-FHM6KUY3.js +44 -0
  22. package/dist/bundle/chunks/chunk-FO7CEQB3.js +11 -0
  23. package/dist/bundle/chunks/chunk-GHVXUCGU.js +130 -0
  24. package/dist/bundle/chunks/chunk-HHWP56PR.js +2 -0
  25. package/dist/bundle/chunks/chunk-HSL72VZI.js +2 -0
  26. package/dist/bundle/chunks/chunk-HUQB436V.js +2 -0
  27. package/dist/bundle/chunks/chunk-HWXGL4YB.js +2 -0
  28. package/dist/bundle/chunks/chunk-KQKUEQJA.js +6 -0
  29. package/dist/bundle/chunks/chunk-M5GCRGV6.js +1333 -0
  30. package/dist/bundle/chunks/chunk-MB4QRS7Y.js +9 -0
  31. package/dist/bundle/chunks/chunk-MXIWLMNT.js +8 -0
  32. package/dist/bundle/chunks/chunk-N6VDWLND.js +2 -0
  33. package/dist/bundle/chunks/chunk-NCIBB66G.js +2 -0
  34. package/dist/bundle/chunks/chunk-NDQ5OW6U.js +2 -0
  35. package/dist/bundle/chunks/chunk-NNCIIYD6.js +2 -0
  36. package/dist/bundle/chunks/chunk-O6JSP6YG.js +6 -0
  37. package/dist/bundle/chunks/chunk-OFST7FDG.js +2 -0
  38. package/dist/bundle/chunks/chunk-SPAUY3RD.js +12 -0
  39. package/dist/bundle/chunks/chunk-U5XE4RWR.js +2 -0
  40. package/dist/bundle/chunks/chunk-UZWP3NHW.js +2 -0
  41. package/dist/bundle/chunks/chunk-V5ANFNKF.js +11 -0
  42. package/dist/bundle/chunks/chunk-VJJ6J35N.js +20 -0
  43. package/dist/bundle/chunks/chunk-XIRAUXOE.js +58 -0
  44. package/dist/bundle/chunks/chunk-ZW7FVRHT.js +31 -0
  45. package/dist/bundle/chunks/cli-6ZTWO6GL.js +51 -0
  46. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-6E2UM7IG.js +2 -0
  47. package/dist/bundle/chunks/codemode-worker.js +478 -0
  48. package/dist/bundle/chunks/dist-DKI7Q6GY.js +13 -0
  49. package/dist/bundle/chunks/easter-egg-3d-FDCGDUF3.js +2 -0
  50. package/dist/bundle/chunks/execute-VSDU5VSN.js +499 -0
  51. package/dist/bundle/chunks/github-copilot.js +2 -0
  52. package/dist/bundle/chunks/google-generative-ai-CSWR3ORZ.js +2 -0
  53. package/dist/bundle/chunks/google-vertex-QIDRFOFB.js +2 -0
  54. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  55. package/dist/bundle/chunks/jiti-loader-BXVX3Y2R.js +21 -0
  56. package/dist/bundle/chunks/jiti-static-loader-NNBCFAO5.js +2 -0
  57. package/dist/bundle/chunks/kimi-coding.js +2 -0
  58. package/dist/bundle/chunks/knightcode-messages-3GNOTMSI.js +8 -0
  59. package/dist/bundle/chunks/lib-IHWMWJDR.js +9 -0
  60. package/dist/bundle/chunks/llama-cpp-classify-HRPRKOZA.js +22 -0
  61. package/dist/bundle/chunks/meta.js +2 -0
  62. package/dist/bundle/chunks/mistral-conversations-46TK5OBA.js +5 -0
  63. package/dist/bundle/chunks/multipart-parser-VTTMF2EO.js +3 -0
  64. package/dist/bundle/chunks/node-7S3GFMOZ.js +16 -0
  65. package/dist/bundle/chunks/node-MAEICQNS.js +2 -0
  66. package/dist/bundle/chunks/openai-chatgpt.js +101 -0
  67. package/dist/bundle/chunks/openai-codex-responses-IT7VEKUU.js +10 -0
  68. package/dist/bundle/chunks/openai-codex.js +101 -0
  69. package/dist/bundle/chunks/openai-completions-LOKIW33V.js +7 -0
  70. package/dist/bundle/chunks/openai-decisions-4F3LWHMG.js +5 -0
  71. package/dist/bundle/chunks/openai-responses-OK36GJXP.js +3 -0
  72. package/dist/bundle/chunks/openrouter-images-ZI7LLZ4Y.js +2 -0
  73. package/dist/bundle/chunks/openrouter.js +101 -0
  74. package/dist/bundle/chunks/radius.js +101 -0
  75. package/dist/bundle/chunks/runtime-RMPIV5AR.js +2 -0
  76. package/dist/bundle/chunks/src-ETRMT73D.js +4 -0
  77. package/dist/bundle/chunks/typesafe-system-one-J2CJBWEH.js +2 -0
  78. package/dist/bundle/chunks/virtual-modules-EGJP3AJA.js +2 -0
  79. package/dist/bundle/chunks/xai.js +2 -0
  80. package/dist/bundle/cli-runtime.js +3 -0
  81. package/dist/bundle/cli.js +5 -0
  82. package/dist/bundle/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  83. package/dist/bundle/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  84. package/dist/bundle/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  85. package/dist/bundle/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  86. package/dist/bundle/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  87. package/dist/bundle/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  88. package/dist/core/export-html/template.css +1015 -0
  89. package/dist/core/export-html/template.html +55 -0
  90. package/dist/core/export-html/template.js +1929 -0
  91. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  92. package/dist/core/export-html/vendor/marked.min.js +78 -0
  93. package/dist/modes/interactive/theme/dark.json +74 -0
  94. package/dist/modes/interactive/theme/light.json +74 -0
  95. package/dist/modes/interactive/theme/system-theme.ts +579 -0
  96. package/dist/modes/interactive/theme/theme-controller.ts +253 -0
  97. package/dist/modes/interactive/theme/theme-schema.ts +145 -0
  98. package/dist/modes/interactive/theme/theme-tokens.ts +145 -0
  99. package/dist/modes/interactive/theme/theme.ts +1076 -0
  100. package/docs/app-server.md +479 -0
  101. package/docs/app-server.schema.json +8128 -0
  102. package/docs/cli-integration.md +106 -0
  103. package/docs/cli.md +393 -0
  104. package/docs/codemode.md +230 -0
  105. package/docs/compaction.md +463 -0
  106. package/docs/configuration.md +48 -0
  107. package/docs/containerization.md +143 -0
  108. package/docs/custom-provider.md +173 -0
  109. package/docs/desktop.md +73 -0
  110. package/docs/docs.json +236 -0
  111. package/docs/environment-variables.md +138 -0
  112. package/docs/extensions.md +314 -0
  113. package/docs/how-knightcode-works.md +49 -0
  114. package/docs/images/doom-extension.png +0 -0
  115. package/docs/images/interactive-mode.png +0 -0
  116. package/docs/images/tree-view.png +0 -0
  117. package/docs/index.md +39 -0
  118. package/docs/json.md +226 -0
  119. package/docs/keybindings.md +197 -0
  120. package/docs/llama-cpp.md +121 -0
  121. package/docs/mcp.md +272 -0
  122. package/docs/message-types.md +279 -0
  123. package/docs/models-configuration.md +187 -0
  124. package/docs/models.md +221 -0
  125. package/docs/nvidia-rtx-llama-cpp.md +96 -0
  126. package/docs/packages.md +129 -0
  127. package/docs/plan-mode.md +121 -0
  128. package/docs/prompt-templates.md +59 -0
  129. package/docs/providers.md +282 -0
  130. package/docs/quickstart.md +128 -0
  131. package/docs/remote.md +87 -0
  132. package/docs/rpc-commands.md +860 -0
  133. package/docs/rpc-extension-ui.md +214 -0
  134. package/docs/rpc.md +193 -0
  135. package/docs/sdk.md +197 -0
  136. package/docs/security.md +99 -0
  137. package/docs/session-format.md +358 -0
  138. package/docs/sessions.md +135 -0
  139. package/docs/settings.md +220 -0
  140. package/docs/shell-aliases.md +93 -0
  141. package/docs/skills.md +93 -0
  142. package/docs/slash-commands.md +78 -0
  143. package/docs/terminal-setup.md +242 -0
  144. package/docs/termux.md +117 -0
  145. package/docs/themes.md +140 -0
  146. package/docs/tmux.md +55 -0
  147. package/docs/tui.md +125 -0
  148. package/docs/usage.md +167 -0
  149. package/docs/virtual-models.md +114 -0
  150. package/docs/windows.md +67 -0
  151. package/examples/README.md +36 -0
  152. package/examples/extensions/README.md +214 -0
  153. package/examples/extensions/auto-commit-on-exit.ts +55 -0
  154. package/examples/extensions/bash-spawn-hook.ts +30 -0
  155. package/examples/extensions/bookmark.ts +50 -0
  156. package/examples/extensions/border-status-editor.ts +151 -0
  157. package/examples/extensions/built-in-tool-renderer.ts +225 -0
  158. package/examples/extensions/claude-rules.ts +89 -0
  159. package/examples/extensions/commands.ts +72 -0
  160. package/examples/extensions/confirm-destructive.ts +60 -0
  161. package/examples/extensions/custom-compaction.ts +118 -0
  162. package/examples/extensions/custom-footer.ts +66 -0
  163. package/examples/extensions/custom-header.ts +73 -0
  164. package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
  165. package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
  166. package/examples/extensions/custom-provider-anthropic/package.json +19 -0
  167. package/examples/extensions/custom-provider-gitlab-duo/index.ts +399 -0
  168. package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
  169. package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
  170. package/examples/extensions/debug-provider.ts +90 -0
  171. package/examples/extensions/dirty-repo-guard.ts +56 -0
  172. package/examples/extensions/doom-overlay/README.md +46 -0
  173. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  174. package/examples/extensions/doom-overlay/doom/doomgeneric_knightcode.c +72 -0
  175. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  176. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  177. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  178. package/examples/extensions/doom-overlay/index.ts +74 -0
  179. package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
  180. package/examples/extensions/dynamic-resources/SKILL.md +8 -0
  181. package/examples/extensions/dynamic-resources/dynamic.json +75 -0
  182. package/examples/extensions/dynamic-resources/dynamic.md +5 -0
  183. package/examples/extensions/dynamic-resources/index.ts +15 -0
  184. package/examples/extensions/dynamic-tools.ts +74 -0
  185. package/examples/extensions/entry-renderer.ts +41 -0
  186. package/examples/extensions/event-bus.ts +43 -0
  187. package/examples/extensions/file-trigger.ts +41 -0
  188. package/examples/extensions/git-checkpoint.ts +53 -0
  189. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  190. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  191. package/examples/extensions/gondolin/index.ts +531 -0
  192. package/examples/extensions/gondolin/package-lock.json +185 -0
  193. package/examples/extensions/gondolin/package.json +19 -0
  194. package/examples/extensions/handoff.ts +190 -0
  195. package/examples/extensions/hello.ts +26 -0
  196. package/examples/extensions/hidden-thinking-label.ts +53 -0
  197. package/examples/extensions/inline-bash.ts +94 -0
  198. package/examples/extensions/input-transform-streaming.ts +39 -0
  199. package/examples/extensions/input-transform.ts +43 -0
  200. package/examples/extensions/interactive-shell.ts +196 -0
  201. package/examples/extensions/jev-router.ts +113 -0
  202. package/examples/extensions/mac-system-theme.ts +47 -0
  203. package/examples/extensions/message-renderer.ts +59 -0
  204. package/examples/extensions/minimal-mode.ts +353 -0
  205. package/examples/extensions/modal-editor.ts +85 -0
  206. package/examples/extensions/model-status.ts +31 -0
  207. package/examples/extensions/notify.ts +57 -0
  208. package/examples/extensions/overlay-qa-tests.ts +1450 -0
  209. package/examples/extensions/overlay-test.ts +153 -0
  210. package/examples/extensions/permission-gate.ts +34 -0
  211. package/examples/extensions/pirate.ts +47 -0
  212. package/examples/extensions/plan-mode/README.md +66 -0
  213. package/examples/extensions/plan-mode/index.ts +387 -0
  214. package/examples/extensions/plan-mode/utils.ts +168 -0
  215. package/examples/extensions/preset.ts +436 -0
  216. package/examples/extensions/project-trust.ts +64 -0
  217. package/examples/extensions/prompt-customizer.ts +49 -0
  218. package/examples/extensions/protected-paths.ts +30 -0
  219. package/examples/extensions/provider-payload.ts +18 -0
  220. package/examples/extensions/qna.ts +118 -0
  221. package/examples/extensions/question.ts +278 -0
  222. package/examples/extensions/questionnaire.ts +440 -0
  223. package/examples/extensions/rainbow-editor.ts +88 -0
  224. package/examples/extensions/reload-runtime.ts +37 -0
  225. package/examples/extensions/rpc-demo.ts +118 -0
  226. package/examples/extensions/sandbox/index.ts +321 -0
  227. package/examples/extensions/sandbox/package-lock.json +92 -0
  228. package/examples/extensions/sandbox/package.json +19 -0
  229. package/examples/extensions/send-user-message.ts +97 -0
  230. package/examples/extensions/session-name.ts +27 -0
  231. package/examples/extensions/shutdown-command.ts +63 -0
  232. package/examples/extensions/snake.ts +343 -0
  233. package/examples/extensions/space-invaders.ts +560 -0
  234. package/examples/extensions/ssh.ts +220 -0
  235. package/examples/extensions/status-line.ts +32 -0
  236. package/examples/extensions/structured-output.ts +65 -0
  237. package/examples/extensions/subagent/README.md +177 -0
  238. package/examples/extensions/subagent/agents/planner.md +37 -0
  239. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  240. package/examples/extensions/subagent/agents/scout.md +50 -0
  241. package/examples/extensions/subagent/agents/worker.md +24 -0
  242. package/examples/extensions/subagent/agents.ts +157 -0
  243. package/examples/extensions/subagent/index.ts +1010 -0
  244. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  245. package/examples/extensions/subagent/prompts/implement.md +10 -0
  246. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  247. package/examples/extensions/summarize.ts +199 -0
  248. package/examples/extensions/system-prompt-header.ts +17 -0
  249. package/examples/extensions/tic-tac-toe.ts +1004 -0
  250. package/examples/extensions/timed-confirm.ts +70 -0
  251. package/examples/extensions/titlebar-spinner.ts +58 -0
  252. package/examples/extensions/todo.ts +294 -0
  253. package/examples/extensions/tool-override.ts +144 -0
  254. package/examples/extensions/tools.ts +146 -0
  255. package/examples/extensions/trigger-compact.ts +50 -0
  256. package/examples/extensions/truncated-tool.ts +195 -0
  257. package/examples/extensions/widget-placement.ts +9 -0
  258. package/examples/extensions/with-deps/index.ts +32 -0
  259. package/examples/extensions/with-deps/package-lock.json +31 -0
  260. package/examples/extensions/with-deps/package.json +22 -0
  261. package/examples/extensions/working-indicator.ts +121 -0
  262. package/examples/extensions/working-message-test.ts +25 -0
  263. package/examples/rpc-client.ts +35 -0
  264. package/examples/rpc-extension-ui.ts +661 -0
  265. package/examples/sdk/01-minimal.ts +26 -0
  266. package/examples/sdk/02-custom-model.ts +49 -0
  267. package/examples/sdk/03-custom-prompt.ts +70 -0
  268. package/examples/sdk/04-skills.ts +55 -0
  269. package/examples/sdk/05-tools.ts +48 -0
  270. package/examples/sdk/06-extensions.ts +94 -0
  271. package/examples/sdk/07-context-files.ts +42 -0
  272. package/examples/sdk/08-prompt-templates.ts +51 -0
  273. package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
  274. package/examples/sdk/10-settings.ts +53 -0
  275. package/examples/sdk/11-sessions.ts +52 -0
  276. package/examples/sdk/12-full-control.ts +74 -0
  277. package/examples/sdk/13-session-runtime.ts +67 -0
  278. package/examples/sdk/14-codemode-mcp.ts +61 -0
  279. package/examples/sdk/README.md +141 -0
  280. package/package.json +15 -15
  281. package/bin/knightcode +0 -62
@@ -0,0 +1,173 @@
1
+ # Custom Providers
2
+
3
+ A provider extension connects KnightCode to a model service that needs custom authentication, model discovery, request handling, or streaming. If the service already speaks a supported API, configure it in `models.json` instead.
4
+
5
+ Provider extensions run inside KnightCode and can inspect credentials, prompts, tool definitions, model responses, and usage. Treat them as trusted code and avoid logging secrets or provider payloads.
6
+
7
+ ## Choose the smallest integration
8
+
9
+ | Requirement | Use |
10
+ |---|---|
11
+ | Add models behind a supported API | [`models.json`](models.md#configure-a-compatible-endpoint) |
12
+ | Change an existing provider endpoint or headers | `models.json` or a small provider extension |
13
+ | Discover models dynamically | A provider with `refreshModels` |
14
+ | Add a `/login` flow | A provider with native or legacy OAuth configuration |
15
+ | Implement an unsupported wire protocol | A provider with `stream` or `streamSimple` |
16
+
17
+ A provider extension is an [extension](extensions.md), so it follows the same loading, trust, reload, and error behavior.
18
+
19
+ ## Register a provider
20
+
21
+ Call `knightcode.registerProvider()` from the extension factory. KnightCode waits for asynchronous factories before startup continues, so providers registered there are available to startup model selection and `knightcode --list-models`.
22
+
23
+ There are two registration forms:
24
+
25
+ - Register a complete `Provider` from `@knightcode/ai` for native authentication, filtering, discovery, refresh, and streaming behavior.
26
+ - Register a provider name with `ProviderConfig` for the legacy configuration form used by existing extensions.
27
+
28
+ Prefer a complete provider for new integrations that own more than static endpoint and model metadata. KnightCode composes `models.json` overrides above a registered native provider.
29
+
30
+ Registering only `baseUrl` or `headers` for an existing provider preserves its built-in models. Supplying `models` in the legacy form replaces that provider's models across chat, image, and classifier operations. An omitted `type` means `"chat"`; image and classifier models require explicit discriminants and implementations keyed by their `api` values through the `images` and `classifiers` fields.
31
+
32
+ For example, a mixed-operation provider can register non-chat models and their implementations together:
33
+
34
+ ```typescript
35
+ knightcode.registerProvider("media-tools", {
36
+ apiKey: "$MEDIA_TOOLS_API_KEY",
37
+ models: [
38
+ {
39
+ type: "image",
40
+ id: "image-v1",
41
+ name: "Image V1",
42
+ api: "media-images",
43
+ baseUrl: "https://media.example.com/v1",
44
+ input: ["text"],
45
+ output: ["image"],
46
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
47
+ },
48
+ {
49
+ type: "classifier",
50
+ id: "classifier-v1",
51
+ name: "Classifier V1",
52
+ api: "media-classifier",
53
+ baseUrl: "https://media.example.com/v1",
54
+ input: ["text"],
55
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
56
+ contextWindow: 64000,
57
+ },
58
+ ],
59
+ images: {
60
+ "media-images": { generateImages: async (model, context, options) => result },
61
+ },
62
+ classifiers: {
63
+ "media-classifier": { classify: async (model, context, options) => result },
64
+ },
65
+ });
66
+ ```
67
+
68
+ Model-level `baseUrl` values take precedence over the provider endpoint. If no `models` list is supplied, built-in models of every operation remain registered. Equal model IDs in different operations remain distinct, including their model-specific headers.
69
+
70
+ Calls made after initial extension loading take effect immediately. Use `knightcode.unregisterProvider()` to remove the dynamic provider and restore built-in behavior that it replaced.
71
+
72
+ See the checked [GitLab Duo provider](../examples/extensions/custom-provider-gitlab-duo/) for a complete registration that delegates streaming to built-in API implementations.
73
+
74
+ ## Provide authentication
75
+
76
+ Static providers can resolve an API key from a literal, environment interpolation, or a command. These values use the same syntax as `models.json`:
77
+
78
+ - `$NAME` and `${NAME}` read environment variables.
79
+ - A leading `!command` uses command output.
80
+ - `$$` emits a literal `$`.
81
+ - `$!` emits a literal leading `!`.
82
+
83
+ Use native provider authentication when the integration needs stored credentials, custom resolution, provider-scoped environment, or multiple login methods.
84
+
85
+ An OAuth provider supplies a display name, login flow, token refresh, and access-token resolution. After registration it appears in `/login`, and KnightCode stores returned credentials in `~/.knightcode/agent/auth.json`.
86
+
87
+ OAuth callbacks are UI-neutral. They can open an authorization URL, show a device code, report progress, request input, or ask the user to choose a login method. Honor cancellation and the supplied abort signal during network requests.
88
+
89
+ Never write access tokens, refresh tokens, authorization headers, or complete provider responses to ordinary logs.
90
+
91
+ ## Supply and refresh models
92
+
93
+ Every model needs an ID, display name, input capabilities, and cost metadata. Chat and classifier models also need a context window; chat models need an output limit and reasoning support; image models declare their output modalities. Choose the API implementation at the provider level unless one model requires an override.
94
+
95
+ Set `promptCache.short` or `promptCache.long` to the provider's best-effort cache lifetime in seconds when KnightCode should keep an idle prompt cache warm. Leave them unset to disable cache warming for that retention tier.
96
+
97
+ Compatibility flags describe verified differences in an otherwise supported API. Do not enable them based only on an endpoint claiming compatibility.
98
+
99
+ Confirm the request fields and response behavior against the actual server.
100
+
101
+ Use `refreshModels` when the available catalog comes from a live service. Pass `context.signal` to blocking I/O so callers can cancel refreshes.
102
+
103
+ The two registration forms have different refresh contracts:
104
+
105
+ - A complete `Provider` returns nothing. It calls `context.publish({ update })` to install provider-owned model state, after which its synchronous `getModels()` exposes the latest list.
106
+ - Legacy `ProviderConfig.refreshModels` returns mixed-operation model definitions. KnightCode replaces that registration’s live models with the returned list and applies any requested persistence.
107
+
108
+ Publish persisted catalog data only when it should survive across runs. A live service such as llama.cpp can update its in-memory list without persisting it; a remote catalog can retain a snapshot for offline startup.
109
+
110
+ ## Reuse a supported streaming API
111
+
112
+ Use one of KnightCode AI’s API implementations whenever the provider protocol matches it.
113
+
114
+ Supported implementations cover Anthropic Messages, OpenAI Chat Completions and Responses, Google Generative AI and Vertex, Azure OpenAI Responses, Mistral Conversations, and Bedrock Converse.
115
+
116
+ The provider can still customize authentication, base URLs, headers, model filtering, and discovery while delegating request conversion and streaming to an existing API implementation.
117
+
118
+ This is safer than copying a stream implementation because it preserves KnightCode’s message conversion, tool handling, usage accounting, cancellation, and compatibility behavior.
119
+
120
+ ## Implement custom streaming
121
+
122
+ Implement `streamSimple` only when no existing API implementation can represent the service. Study the implementations under [`packages/ai/src/api`](https://github.com/KnightCodeAI/knightcode/tree/main/packages/ai/src/api) first.
123
+
124
+ The stream receives a normalized `TranscriptContext`. System prompts and tool declarations live in transcript system messages, so read them with `getCurrentSystemPrompt(context.messages)` and `getCurrentTools(context.messages)` rather than expecting `context.systemPrompt` or `context.tools`. A model that supports mid-conversation system messages can receive them in place; otherwise call `collapseSystemMessages(context)` to fold later system messages into the leading one.
125
+
126
+ A custom stream must:
127
+
128
+ 1. Create an assistant message with provider, model, timestamp, pending stop reason, content, and zeroed usage.
129
+ 2. After request setup succeeds, emit one `start` event before content events.
130
+ 3. Update the message while emitting balanced text, thinking, and tool-call events.
131
+ 4. Finalize usage, cost, content, and stop reason.
132
+ 5. Emit exactly one terminal `done` or `error` event and close the stream.
133
+ 6. Convert cancellation into an aborted result.
134
+
135
+ Request setup can fail before `start`; in that case the stream can terminate directly with `error`. Missing request authentication may also throw synchronously before a stream is returned.
136
+
137
+ Content indexes refer to blocks in the assistant message. Update each block before emitting the event whose `partial` field exposes that state. Tool-call arguments must contain valid parsed input by `toolcall_end`.
138
+
139
+ The stream must also honor request instrumentation supplied through `SimpleStreamOptions`:
140
+
141
+ - Call `options.onPayload` before sending the provider request and use any replacement payload it returns.
142
+ - Call `options.onResponse` after receiving the response but before consuming its body.
143
+ - Await `options.onProviderStreamEvent?.(providerEvent, model)` for each parsed provider event before normalizing it.
144
+ - Pass through the abort signal and provider-scoped environment.
145
+
146
+ These hooks power extension request inspection, response-header events, and provider-stream observation. Omitting them makes the provider behave differently from KnightCode’s built-in providers.
147
+
148
+ ## Report failures and usage
149
+
150
+ Set a concrete terminal stop reason. Error and aborted messages need an `errorMessage`; successful messages need accurate input, output, cache, total-token, and cost values.
151
+
152
+ KnightCode can compact and retry after recognized context-overflow errors. If the service uses an unknown message, normalize only that provider’s overflow response to `context_length_exceeded` in a guarded `message_end` handler.
153
+
154
+ Do not rewrite rate limits or transient provider failures as context overflow. Those failures use KnightCode’s normal retry behavior instead.
155
+
156
+ ## Test the integration
157
+
158
+ Test at least:
159
+
160
+ - ordinary and empty text responses
161
+ - tool calls and tool results
162
+ - image input and image tool results when supported
163
+ - usage and cost accounting
164
+ - abort behavior
165
+ - context overflow
166
+ - malformed or partial streams
167
+ - Unicode boundaries
168
+ - cross-provider session handoff
169
+ - authentication refresh and cancellation
170
+
171
+ The provider tests under [`packages/ai/test`](https://github.com/KnightCodeAI/knightcode/tree/main/packages/ai/test) define the behavior expected from built-in providers. Adapt the relevant suites rather than relying only on manual prompts.
172
+
173
+ Run the extension directly while developing, then move it to a discovered extension location or distribute it through a [KnightCode package](packages.md). Use `/reload` after changing a discovered provider extension in an active session.
@@ -0,0 +1,73 @@
1
+ # Desktop App
2
+
3
+ The KnightCode desktop app is an Electron window over the [app server](app-server.md). It
4
+ runs one `knightcode app-server` process and every window talks to it, so the desktop and
5
+ the terminal share sessions, settings, credentials and extensions. Nothing about the agent
6
+ is configured in the app itself: models, approval defaults and extensions come from your
7
+ `settings.json`, the same file the terminal reads.
8
+
9
+ The app is in development and not yet published. Phase S1 (threads, transcript, composer,
10
+ approvals) is usable from a source checkout.
11
+
12
+ ## Running from source
13
+
14
+ ```sh
15
+ bun install
16
+ cd apps/desktop
17
+ bun run start
18
+ ```
19
+
20
+ In a source checkout the app starts the server with `bun packages/cli/src/bun/cli.ts
21
+ app-server`. Set `KNIGHTCODE_DESKTOP_SERVER` to run a different command (for example an
22
+ installed `knightcode`); `app-server` is appended. The value is split on whitespace with no
23
+ quoting, so a path containing spaces (`C:\Program Files\...`) cannot be named; put its folder
24
+ on `PATH` and give the bare name. A packaged build ignores it and runs only its bundled binary.
25
+
26
+ Server output goes to `app-server.log` in the app's logs folder (`%APPDATA%\KnightCode\logs`
27
+ on Windows, `~/Library/Logs/KnightCode` on macOS, `~/.config/KnightCode/logs` on Linux).
28
+
29
+ ## What works
30
+
31
+ - Projects: add folders to the sidebar; their threads list under them. Threads from other
32
+ folders appear under Recents. Pin threads to keep them at the top. The project list and
33
+ pins are desktop-only state in `desktop-state.json`; removing a project leaves its threads
34
+ on disk.
35
+ - Threads: open any saved thread, including ones started in the terminal. A thread open in
36
+ a terminal session is locked there; the app says so and offers to fork it. The thread
37
+ menu renames, pins, forks, compacts, copies the transcript, and archives. Long threads
38
+ load older messages on request.
39
+ - Composer: Enter sends, Shift+Enter adds a line (or the reverse, in Settings). While a turn
40
+ runs, Send queues the message to start its own turn when this one ends, and Ctrl+Enter
41
+ (Cmd+Enter on macOS) steers the running turn instead; Settings can swap the two. Queued
42
+ messages can be removed until they start. Escape on an empty composer stops the turn.
43
+ `@` finds files in the project, `/` lists commands, prompt templates and skills, and
44
+ images can be pasted or added from the `+` menu.
45
+ - Model and thinking level per thread, from the models you are signed in to. A new thread
46
+ uses your default model, which Settings can change for the terminal too.
47
+ - Approval modes: Ask for approval, Auto-edit and Full access. In Ask mode a request shows
48
+ a card with the decisions the server offers; Enter allows once, Escape denies, and Deny
49
+ can tell KnightCode why. Full access asks once per thread, and Settings can hide it.
50
+ - Settings: send key, queue or steer, theme (System, Light, Dark), default model, signing
51
+ in to and out of providers, keyboard shortcuts, versions and logs.
52
+ - Archived threads: search, unarchive, or delete for good.
53
+ - Command palette (Ctrl+K): actions and threads in one search.
54
+ - Quitting while threads run asks first.
55
+
56
+ ## Keyboard shortcuts
57
+
58
+ | Action | Default |
59
+ | --- | --- |
60
+ | Command palette | Ctrl+K, Ctrl+Shift+P |
61
+ | New thread | Ctrl+N |
62
+ | Add a project folder | Ctrl+O |
63
+ | Settings | Ctrl+, |
64
+ | Toggle the sidebar | Ctrl+B |
65
+ | Back / forward | Alt+Left / Alt+Right |
66
+ | Archive the thread | Ctrl+Shift+A |
67
+ | Send | Enter |
68
+ | New line | Shift+Enter |
69
+ | Steer the running turn | Ctrl+Enter |
70
+ | Stop the running turn | Escape (empty composer) |
71
+ | Allow / deny an approval | Enter / Escape (card focused) |
72
+
73
+ On macOS, Ctrl is Cmd. Settings › Keyboard shortcuts lists every binding.
package/docs/docs.json ADDED
@@ -0,0 +1,236 @@
1
+ {
2
+ "navigation": [
3
+ {
4
+ "title": "Get Started",
5
+ "items": [
6
+ {
7
+ "title": "Overview",
8
+ "path": "index.md"
9
+ },
10
+ {
11
+ "title": "Quickstart",
12
+ "path": "quickstart.md"
13
+ },
14
+ {
15
+ "title": "How KnightCode Works",
16
+ "path": "how-knightcode-works.md"
17
+ }
18
+ ]
19
+ },
20
+ {
21
+ "title": "Guides",
22
+ "items": [
23
+ {
24
+ "title": "Run KnightCode",
25
+ "items": [
26
+ {
27
+ "title": "Use KnightCode in the Terminal",
28
+ "path": "usage.md"
29
+ },
30
+ {
31
+ "title": "Use the Desktop App",
32
+ "path": "desktop.md"
33
+ },
34
+ {
35
+ "title": "Plan Before Implementing",
36
+ "path": "plan-mode.md"
37
+ },
38
+ {
39
+ "title": "Choose a Model",
40
+ "path": "models.md"
41
+ },
42
+ {
43
+ "title": "Manage Sessions and Context",
44
+ "path": "sessions.md"
45
+ },
46
+ {
47
+ "title": "Use Remote Sessions",
48
+ "path": "remote.md"
49
+ },
50
+ {
51
+ "title": "Run KnightCode Safely",
52
+ "path": "security.md"
53
+ },
54
+ {
55
+ "title": "Isolate KnightCode",
56
+ "path": "containerization.md"
57
+ },
58
+ {
59
+ "title": "Run Local Models",
60
+ "path": "llama-cpp.md"
61
+ },
62
+ {
63
+ "title": "Run Local Models on NVIDIA RTX",
64
+ "path": "nvidia-rtx-llama-cpp.md"
65
+ },
66
+ {
67
+ "title": "Configure Your Terminal",
68
+ "path": "terminal-setup.md"
69
+ },
70
+ {
71
+ "title": "Configure Shell Commands",
72
+ "path": "shell-aliases.md"
73
+ },
74
+ {
75
+ "title": "Run KnightCode in tmux",
76
+ "path": "tmux.md"
77
+ },
78
+ {
79
+ "title": "Run KnightCode on Windows",
80
+ "path": "windows.md"
81
+ },
82
+ {
83
+ "title": "Run KnightCode on Android",
84
+ "path": "termux.md"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "title": "Customize KnightCode",
90
+ "items": [
91
+ {
92
+ "title": "Configure KnightCode",
93
+ "path": "configuration.md"
94
+ },
95
+ {
96
+ "title": "Create Prompt Templates",
97
+ "path": "prompt-templates.md"
98
+ },
99
+ {
100
+ "title": "Add Skills",
101
+ "path": "skills.md"
102
+ },
103
+ {
104
+ "title": "Create Themes",
105
+ "path": "themes.md"
106
+ },
107
+ {
108
+ "title": "Use KnightCode Packages",
109
+ "path": "packages.md"
110
+ },
111
+ {
112
+ "title": "Connect MCP Servers",
113
+ "path": "mcp.md"
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "title": "Build on KnightCode",
119
+ "items": [
120
+ {
121
+ "title": "Build Extensions",
122
+ "path": "extensions.md"
123
+ },
124
+ {
125
+ "title": "Add Custom Providers",
126
+ "path": "custom-provider.md"
127
+ },
128
+ {
129
+ "title": "Route with Virtual Models",
130
+ "path": "virtual-models.md"
131
+ },
132
+ {
133
+ "title": "Build Terminal UI Components",
134
+ "path": "tui.md"
135
+ },
136
+ {
137
+ "title": "Integrate with the CLI",
138
+ "path": "cli-integration.md"
139
+ },
140
+ {
141
+ "title": "Use the SDK",
142
+ "path": "sdk.md"
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ {
149
+ "title": "Reference",
150
+ "items": [
151
+ {
152
+ "title": "CLI",
153
+ "path": "cli.md"
154
+ },
155
+ {
156
+ "title": "Codemode",
157
+ "path": "codemode.md"
158
+ },
159
+ {
160
+ "title": "Slash Commands",
161
+ "path": "slash-commands.md"
162
+ },
163
+ {
164
+ "title": "Settings",
165
+ "path": "settings.md"
166
+ },
167
+ {
168
+ "title": "Models Configuration",
169
+ "path": "models-configuration.md"
170
+ },
171
+ {
172
+ "title": "Environment Variables",
173
+ "path": "environment-variables.md"
174
+ },
175
+ {
176
+ "title": "Keybindings",
177
+ "path": "keybindings.md"
178
+ },
179
+ {
180
+ "title": "Providers",
181
+ "path": "providers.md"
182
+ },
183
+ {
184
+ "title": "Session File Format",
185
+ "path": "session-format.md"
186
+ },
187
+ {
188
+ "title": "Compaction and Branch Summaries",
189
+ "path": "compaction.md"
190
+ },
191
+ {
192
+ "title": "JSON Event Stream",
193
+ "path": "json.md"
194
+ },
195
+ {
196
+ "title": "RPC Protocol",
197
+ "path": "rpc.md"
198
+ },
199
+ {
200
+ "title": "RPC Commands",
201
+ "path": "rpc-commands.md"
202
+ },
203
+ {
204
+ "title": "RPC Extension UI",
205
+ "path": "rpc-extension-ui.md"
206
+ },
207
+ {
208
+ "title": "App Server Protocol",
209
+ "path": "app-server.md"
210
+ },
211
+ {
212
+ "title": "Message Types",
213
+ "path": "message-types.md"
214
+ }
215
+ ]
216
+ }
217
+ ],
218
+ "redirects": [
219
+ {
220
+ "from": "development.md",
221
+ "to": "index.md"
222
+ },
223
+ {
224
+ "from": "session.md",
225
+ "to": "session-format.md"
226
+ },
227
+ {
228
+ "from": "tree.md",
229
+ "to": "sessions.md"
230
+ },
231
+ {
232
+ "from": "process-integration.md",
233
+ "to": "cli-integration.md"
234
+ }
235
+ ]
236
+ }
@@ -0,0 +1,138 @@
1
+ # Environment Variables
2
+
3
+ KnightCode uses environment variables in three ways:
4
+
5
+ - Variables such as `KNIGHTCODE_OFFLINE` configure the KnightCode process.
6
+ - KnightCode sets process markers so child processes can identify KnightCode as the launching agent.
7
+ - Commands run by the LLM-callable shell tools receive `KNIGHTCODE_*` variables describing the current session.
8
+
9
+ Provider API-key variables are documented separately in [Providers](providers.md#use-an-api-key-from-the-environment).
10
+
11
+ ## Process Marker
12
+
13
+ The CLI and RPC entry points set two process markers:
14
+
15
+ - `AI_AGENT=knightcode` is a generic marker that lets tooling identify KnightCode as the agent that launched the process.
16
+ - `KNIGHTCODE_CODING_AGENT=true` is KnightCode-specific and lets child processes detect that they run inside KnightCode.
17
+
18
+ Child processes inherit both markers. They are not session-specific and are not set automatically when KnightCode is embedded through the SDK.
19
+
20
+ ## Shell Tool Session Environment
21
+
22
+ Commands run by the `bash` and `powershell` tools receive the current KnightCode session state:
23
+
24
+ | Variable | Description |
25
+ |----------|-------------|
26
+ | `KNIGHTCODE_SESSION_ID` | Current session ID |
27
+ | `KNIGHTCODE_SESSION_FILE` | Absolute path to the current session JSONL file; unset for ephemeral sessions |
28
+ | `KNIGHTCODE_PROVIDER` | Currently selected model provider |
29
+ | `KNIGHTCODE_MODEL` | Currently selected model ID |
30
+ | `KNIGHTCODE_REASONING_LEVEL` | Current effective reasoning level: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max` |
31
+
32
+ The values are resolved when each command starts. Switching models or changing the reasoning level therefore affects the next shell command without restarting KnightCode. `KNIGHTCODE_PROVIDER` and `KNIGHTCODE_MODEL` identify the selected KnightCode model, not a different upstream model that a router may choose internally.
33
+
34
+ When asked which model or provider is running, inspect these variables instead of inferring the answer from the system prompt:
35
+
36
+ ```bash
37
+ printf '%s/%s\n' "$KNIGHTCODE_PROVIDER" "$KNIGHTCODE_MODEL"
38
+ printf 'reasoning=%s session=%s\n' "$KNIGHTCODE_REASONING_LEVEL" "$KNIGHTCODE_SESSION_ID"
39
+ ```
40
+
41
+ The session file can be inspected directly when the session is persistent:
42
+
43
+ ```bash
44
+ if [ -n "$KNIGHTCODE_SESSION_FILE" ]; then
45
+ tail -n 1 "$KNIGHTCODE_SESSION_FILE"
46
+ fi
47
+ ```
48
+
49
+ These variables are injected into the LLM-callable `bash` and `powershell` tools. They are not injected into user-entered `!` or `!!` commands.
50
+
51
+ ### Custom Shell Tools
52
+
53
+ Tools created with `createBashTool()` or `createPowerShellTool()` expose the session environment by default when registered with KnightCode. Injection happens before `spawnHook`, so a hook receives the variables in `ctx.env`:
54
+
55
+ ```typescript
56
+ const bashTool = createBashTool(cwd, {
57
+ spawnHook: (ctx) => ({
58
+ ...ctx,
59
+ env: { ...ctx.env, CI: "1" },
60
+ }),
61
+ });
62
+ ```
63
+
64
+ Disable session metadata independently of the spawn hook:
65
+
66
+ ```typescript
67
+ const powershellTool = createPowerShellTool(cwd, {
68
+ exposeSessionEnvironment: false,
69
+ spawnHook: (ctx) => ctx,
70
+ });
71
+ ```
72
+
73
+ When disabled, KnightCode removes inherited values for these variables so nested KnightCode processes do not expose stale parent-session metadata.
74
+
75
+ ## KnightCode Process Configuration
76
+
77
+ These variables are read by KnightCode itself:
78
+
79
+ | Variable | Description |
80
+ |----------|-------------|
81
+ | `KNIGHTCODE_CODING_AGENT_DIR` | Override the config directory; default is `~/.knightcode/agent` |
82
+ | `KNIGHTCODE_CODING_AGENT_SESSION_DIR` | Override session storage; overridden by `--session-dir` |
83
+ | `KNIGHTCODE_PACKAGE_DIR` | Override the package directory, useful for Nix/Guix store paths |
84
+ | `KNIGHTCODE_OFFLINE` | Disable automatic network activity, including model catalog refreshes |
85
+ | `KNIGHTCODE_DISABLE_FILE_CHECKPOINTS` | Set to `1`, `true`, or `yes` to stop backing up files before edits; `/undo` then rewinds the conversation only. See [Sessions](sessions.md#file-restore) |
86
+ | `KNIGHTCODE_SKIP_VERSION_CHECK` | Disable automatic version checks and downloads; explicit `knightcode update` still works |
87
+ | `KNIGHTCODE_DISABLE_AUTO_UPDATE` | Set to `1` to disable automatic update downloads while retaining update notices, overriding the user-level [`autoUpdate` setting](settings.md#disable-automatic-updates); explicit `knightcode update` still works |
88
+ | `KNIGHTCODE_TELEMETRY` | Override install/update telemetry and provider attribution headers: `1`/`true`/`yes` or `0`/`false`/`no` |
89
+ | `KNIGHTCODE_CACHE_RETENTION` | Set to `long` for extended provider prompt caching where supported |
90
+ | `KNIGHTCODE_SHARE_VIEWER_URL` | Override the base URL used by `/share` |
91
+ | `KNIGHTCODE_BUG_ENDPOINT` | Override the origin `/bug` uploads go to; default is `https://remote.knightcode.dev` |
92
+ | `KNIGHTCODE_HARDWARE_CURSOR` | Set to `1` to show the hardware cursor; see [Terminal setup](terminal-setup.md) |
93
+ | `KNIGHTCODE_CLIPBOARD_OSC52` | Set to `1` to also send copied text to the terminal with OSC 52 after the local clipboard write, as KnightCode does over SSH. Use it when a remote client reaches KnightCode without SSH variables, such as a multiplexer attached from another machine or a remote IDE daemon |
94
+ | `KNIGHTCODE_HYPERLINKS` | Override OSC 8 hyperlink detection with `1`, `0`, or `auto` |
95
+ | `KNIGHTCODE_PROGRAM_STATUS` | Override OSC 7501 program status detection: `1` always reports, `0` never reports; otherwise KnightCode reports only after the terminal confirms support. See [Terminal setup](terminal-setup.md#program-status) |
96
+ | `KNIGHTCODE_IMAGE_PROTOCOL` | Override inline image detection with `kitty`, `iterm2`, `none`, or `auto` |
97
+ | `KNIGHTCODE_TRUE_COLOR` | Override truecolor detection with `1`, `0`, or `auto` |
98
+ | `KNIGHTCODE_TUI_ESC_TIMEOUT` | How long to wait after a lone ESC before treating it as Escape, in milliseconds; defaults to `100` over SSH and `10` otherwise. Increase if Alt-key input is misread as Escape |
99
+ | `BRAVE_API_KEY` | Brave Search key for `websearch` when none is stored with `/tools`; see [Web tools](usage.md#web-tools) |
100
+ | `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
101
+ | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
102
+
103
+ ### Update controls
104
+
105
+ Automatic updates are on by default. For a persistent preference without
106
+ environment variables, open `/settings` and set **Automatic updates** to `false`,
107
+ or set `"autoUpdate": false` in your user-level `settings.json`; see
108
+ [Disable automatic updates](settings.md#disable-automatic-updates) for file locations
109
+ and an example.
110
+
111
+ To use an environment variable instead, set it before launching KnightCode.
112
+ For the current PowerShell terminal:
113
+
114
+ ```powershell
115
+ $env:KNIGHTCODE_DISABLE_AUTO_UPDATE = "1"
116
+ knightcode
117
+ ```
118
+
119
+ To persist it for your Windows user:
120
+
121
+ ```powershell
122
+ [Environment]::SetEnvironmentVariable("KNIGHTCODE_DISABLE_AUTO_UPDATE", "1", "User")
123
+ ```
124
+
125
+ Then restart your terminal app or IDE so new KnightCode processes inherit it.
126
+ On macOS or Linux, add this line to your shell profile (`~/.zshrc` or `~/.bashrc`),
127
+ then open a new terminal:
128
+
129
+ ```bash
130
+ export KNIGHTCODE_DISABLE_AUTO_UPDATE=1
131
+ ```
132
+
133
+ This variable overrides `autoUpdate: true`. Any non-empty value disables automatic
134
+ downloads, including `0`; unset it to return control to `settings.json`. To suppress
135
+ update notices and checks too, use `KNIGHTCODE_SKIP_VERSION_CHECK=1` instead.
136
+ Explicit `knightcode update` remains available with either variable.
137
+
138
+ Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and provider-specific configuration are listed in [Providers](providers.md#use-an-api-key-from-the-environment).