@kvman/kvcoder 0.1.11 → 0.1.12

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 (235) hide show
  1. package/dist/api.d.ts +45 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/calls/call-name.d.ts.map +1 -1
  4. package/dist/calls/call-name.js +10 -1
  5. package/dist/calls/call-name.js.map +1 -1
  6. package/dist/calls/run-tool.d.ts.map +1 -1
  7. package/dist/calls/run-tool.js +2 -0
  8. package/dist/calls/run-tool.js.map +1 -1
  9. package/dist/connector-call.d.ts +2 -2
  10. package/dist/connector-call.d.ts.map +1 -1
  11. package/dist/connector-call.js +5 -3
  12. package/dist/connector-call.js.map +1 -1
  13. package/dist/connectors/artifact.d.ts +1 -0
  14. package/dist/connectors/artifact.d.ts.map +1 -1
  15. package/dist/connectors/background.d.ts.map +1 -1
  16. package/dist/connectors/background.js +8 -4
  17. package/dist/connectors/background.js.map +1 -1
  18. package/dist/connectors/builtin-connectors.d.ts +38 -0
  19. package/dist/connectors/builtin-connectors.d.ts.map +1 -1
  20. package/dist/connectors/builtin-connectors.js +4 -1
  21. package/dist/connectors/builtin-connectors.js.map +1 -1
  22. package/dist/connectors/delegate.d.ts.map +1 -1
  23. package/dist/connectors/delegate.js +3 -0
  24. package/dist/connectors/delegate.js.map +1 -1
  25. package/dist/connectors/execution-map.d.ts +1 -1
  26. package/dist/connectors/execution-map.d.ts.map +1 -1
  27. package/dist/connectors/execution-map.js +1 -1
  28. package/dist/connectors/execution-map.js.map +1 -1
  29. package/dist/connectors/fs.d.ts +29 -1
  30. package/dist/connectors/fs.d.ts.map +1 -1
  31. package/dist/connectors/fs.js +46 -9
  32. package/dist/connectors/fs.js.map +1 -1
  33. package/dist/connectors/payload-fields.d.ts +3 -0
  34. package/dist/connectors/payload-fields.d.ts.map +1 -1
  35. package/dist/connectors/payload-fields.js +8 -2
  36. package/dist/connectors/payload-fields.js.map +1 -1
  37. package/dist/connectors/web.d.ts +16 -0
  38. package/dist/connectors/web.d.ts.map +1 -0
  39. package/dist/connectors/web.js +22 -0
  40. package/dist/connectors/web.js.map +1 -0
  41. package/dist/delegate/permission.d.ts +6 -0
  42. package/dist/delegate/permission.d.ts.map +1 -1
  43. package/dist/files/change-diff.d.ts +17 -0
  44. package/dist/files/change-diff.d.ts.map +1 -0
  45. package/dist/files/change-diff.js +59 -0
  46. package/dist/files/change-diff.js.map +1 -0
  47. package/dist/files/edit-places.d.ts +11 -0
  48. package/dist/files/edit-places.d.ts.map +1 -0
  49. package/dist/files/edit-places.js +105 -0
  50. package/dist/files/edit-places.js.map +1 -0
  51. package/dist/files/edit-text.d.ts +1 -0
  52. package/dist/files/edit-text.d.ts.map +1 -1
  53. package/dist/files/edit-text.js +22 -10
  54. package/dist/files/edit-text.js.map +1 -1
  55. package/dist/files/file-change.d.ts.map +1 -1
  56. package/dist/files/file-change.js +12 -0
  57. package/dist/files/file-change.js.map +1 -1
  58. package/dist/files/find-paths.d.ts +9 -0
  59. package/dist/files/find-paths.d.ts.map +1 -0
  60. package/dist/files/find-paths.js +38 -0
  61. package/dist/files/find-paths.js.map +1 -0
  62. package/dist/files/read-file.d.ts +3 -1
  63. package/dist/files/read-file.d.ts.map +1 -1
  64. package/dist/files/read-file.js +7 -6
  65. package/dist/files/read-file.js.map +1 -1
  66. package/dist/files/read-files.d.ts +11 -0
  67. package/dist/files/read-files.d.ts.map +1 -0
  68. package/dist/files/read-files.js +35 -0
  69. package/dist/files/read-files.js.map +1 -0
  70. package/dist/files/read-text.d.ts +63 -0
  71. package/dist/files/read-text.d.ts.map +1 -0
  72. package/dist/files/read-text.js +67 -0
  73. package/dist/files/read-text.js.map +1 -0
  74. package/dist/files/register-changes.d.ts +3 -0
  75. package/dist/files/register-changes.d.ts.map +1 -0
  76. package/dist/files/register-changes.js +78 -0
  77. package/dist/files/register-changes.js.map +1 -0
  78. package/dist/files/search-text.d.ts +10 -1
  79. package/dist/files/search-text.d.ts.map +1 -1
  80. package/dist/files/search-text.js +32 -57
  81. package/dist/files/search-text.js.map +1 -1
  82. package/dist/files/workspace-files.d.ts +5 -0
  83. package/dist/files/workspace-files.d.ts.map +1 -0
  84. package/dist/files/workspace-files.js +66 -0
  85. package/dist/files/workspace-files.js.map +1 -0
  86. package/dist/index.d.ts.map +1 -1
  87. package/dist/index.js +4 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/prompt/build-prompt.d.ts +4 -0
  90. package/dist/prompt/build-prompt.d.ts.map +1 -1
  91. package/dist/prompt/build-prompt.js +6 -2
  92. package/dist/prompt/build-prompt.js.map +1 -1
  93. package/dist/prompt/person-preferences.d.ts +5 -0
  94. package/dist/prompt/person-preferences.d.ts.map +1 -0
  95. package/dist/prompt/person-preferences.js +14 -0
  96. package/dist/prompt/person-preferences.js.map +1 -0
  97. package/dist/prompt/session-grants.d.ts +4 -0
  98. package/dist/prompt/session-grants.d.ts.map +1 -1
  99. package/dist/prompt/session-grants.js +3 -2
  100. package/dist/prompt/session-grants.js.map +1 -1
  101. package/dist/prompt/session-prompt.d.ts.map +1 -1
  102. package/dist/prompt/session-prompt.js +15 -6
  103. package/dist/prompt/session-prompt.js.map +1 -1
  104. package/dist/prompt/working-method.d.ts +2 -2
  105. package/dist/prompt/working-method.d.ts.map +1 -1
  106. package/dist/prompt/working-method.js +49 -43
  107. package/dist/prompt/working-method.js.map +1 -1
  108. package/dist/register-settings.d.ts +23 -0
  109. package/dist/register-settings.d.ts.map +1 -1
  110. package/dist/register-settings.js +13 -0
  111. package/dist/register-settings.js.map +1 -1
  112. package/dist/schemas/approval-rule.d.ts +9 -0
  113. package/dist/schemas/approval-rule.d.ts.map +1 -0
  114. package/dist/schemas/approval-rule.js +7 -0
  115. package/dist/schemas/approval-rule.js.map +1 -0
  116. package/dist/schemas/check.d.ts +7 -0
  117. package/dist/schemas/check.d.ts.map +1 -0
  118. package/dist/schemas/check.js +9 -0
  119. package/dist/schemas/check.js.map +1 -0
  120. package/dist/schemas/records.d.ts +10 -0
  121. package/dist/schemas/records.d.ts.map +1 -1
  122. package/dist/schemas/records.js +8 -0
  123. package/dist/schemas/records.js.map +1 -1
  124. package/dist/sessions/new-session.d.ts.map +1 -1
  125. package/dist/sessions/new-session.js +4 -1
  126. package/dist/sessions/new-session.js.map +1 -1
  127. package/dist/sessions/register-fork-export.d.ts.map +1 -1
  128. package/dist/sessions/register-fork-export.js +3 -2
  129. package/dist/sessions/register-fork-export.js.map +1 -1
  130. package/dist/sessions/register-sessions.d.ts.map +1 -1
  131. package/dist/sessions/register-sessions.js +17 -9
  132. package/dist/sessions/register-sessions.js.map +1 -1
  133. package/dist/sessions/session-view.d.ts +8 -1
  134. package/dist/sessions/session-view.d.ts.map +1 -1
  135. package/dist/sessions/session-view.js +6 -1
  136. package/dist/sessions/session-view.js.map +1 -1
  137. package/dist/sessions/waiting-on.d.ts +7 -0
  138. package/dist/sessions/waiting-on.d.ts.map +1 -0
  139. package/dist/sessions/waiting-on.js +20 -0
  140. package/dist/sessions/waiting-on.js.map +1 -0
  141. package/dist/store/collections.d.ts +18 -0
  142. package/dist/store/collections.d.ts.map +1 -1
  143. package/dist/store/collections.js +3 -1
  144. package/dist/store/collections.js.map +1 -1
  145. package/dist/turns/answer-extras.d.ts +21 -0
  146. package/dist/turns/answer-extras.d.ts.map +1 -0
  147. package/dist/turns/answer-extras.js +43 -0
  148. package/dist/turns/answer-extras.js.map +1 -0
  149. package/dist/turns/answer-fingerprint.d.ts +6 -2
  150. package/dist/turns/answer-fingerprint.d.ts.map +1 -1
  151. package/dist/turns/answer-fingerprint.js +9 -3
  152. package/dist/turns/answer-fingerprint.js.map +1 -1
  153. package/dist/turns/apply-answer.d.ts +2 -1
  154. package/dist/turns/apply-answer.d.ts.map +1 -1
  155. package/dist/turns/apply-answer.js +10 -4
  156. package/dist/turns/apply-answer.js.map +1 -1
  157. package/dist/turns/approval-rules.d.ts +13 -0
  158. package/dist/turns/approval-rules.d.ts.map +1 -0
  159. package/dist/turns/approval-rules.js +65 -0
  160. package/dist/turns/approval-rules.js.map +1 -0
  161. package/dist/turns/check-after-edits.d.ts +8 -0
  162. package/dist/turns/check-after-edits.d.ts.map +1 -0
  163. package/dist/turns/check-after-edits.js +23 -0
  164. package/dist/turns/check-after-edits.js.map +1 -0
  165. package/dist/turns/clear-results.d.ts +15 -0
  166. package/dist/turns/clear-results.d.ts.map +1 -0
  167. package/dist/turns/clear-results.js +58 -0
  168. package/dist/turns/clear-results.js.map +1 -0
  169. package/dist/turns/cleared-results.d.ts +17 -0
  170. package/dist/turns/cleared-results.d.ts.map +1 -0
  171. package/dist/turns/cleared-results.js +46 -0
  172. package/dist/turns/cleared-results.js.map +1 -0
  173. package/dist/turns/compaction.js +6 -6
  174. package/dist/turns/compaction.js.map +1 -1
  175. package/dist/turns/file-results.d.ts +15 -0
  176. package/dist/turns/file-results.d.ts.map +1 -0
  177. package/dist/turns/file-results.js +39 -0
  178. package/dist/turns/file-results.js.map +1 -0
  179. package/dist/turns/lost-reply.js +2 -2
  180. package/dist/turns/lost-reply.js.map +1 -1
  181. package/dist/turns/model-context.d.ts +2 -0
  182. package/dist/turns/model-context.d.ts.map +1 -1
  183. package/dist/turns/model-context.js +28 -5
  184. package/dist/turns/model-context.js.map +1 -1
  185. package/dist/turns/read-again.d.ts +11 -5
  186. package/dist/turns/read-again.d.ts.map +1 -1
  187. package/dist/turns/read-again.js +39 -10
  188. package/dist/turns/read-again.js.map +1 -1
  189. package/dist/turns/register-turns.d.ts.map +1 -1
  190. package/dist/turns/register-turns.js +12 -4
  191. package/dist/turns/register-turns.js.map +1 -1
  192. package/dist/turns/run-calls.d.ts +4 -0
  193. package/dist/turns/run-calls.d.ts.map +1 -1
  194. package/dist/turns/run-calls.js +35 -5
  195. package/dist/turns/run-calls.js.map +1 -1
  196. package/dist/turns/run-command.d.ts.map +1 -1
  197. package/dist/turns/run-command.js +4 -4
  198. package/dist/turns/run-command.js.map +1 -1
  199. package/dist/turns/step.d.ts.map +1 -1
  200. package/dist/turns/step.js +43 -8
  201. package/dist/turns/step.js.map +1 -1
  202. package/dist/ui/register-ui.js +2 -2
  203. package/dist/ui/register-ui.js.map +1 -1
  204. package/dist/web/components/approval.css +1 -1
  205. package/dist/web/components/approval.js +122 -89
  206. package/dist/web/components/call.css +1 -1
  207. package/dist/web/components/call.js +400 -302
  208. package/dist/web/components/connectors.css +1 -1
  209. package/dist/web/components/connectors.js +440 -427
  210. package/dist/web/components/conversation.css +1 -1
  211. package/dist/web/components/conversation.js +2509 -1500
  212. package/dist/web/components/mcp-sign-in.css +1 -1
  213. package/dist/web/components/model.css +1 -1
  214. package/dist/web/components/model.js +138 -126
  215. package/dist/web/components/preferences.css +2 -0
  216. package/dist/web/components/preferences.js +151 -0
  217. package/dist/web/components/question.css +1 -1
  218. package/dist/web/components/sessions.css +1 -1
  219. package/dist/web/components/sessions.js +44 -21
  220. package/dist/web-fetch/fetch-page.d.ts +28 -0
  221. package/dist/web-fetch/fetch-page.d.ts.map +1 -0
  222. package/dist/web-fetch/fetch-page.js +108 -0
  223. package/dist/web-fetch/fetch-page.js.map +1 -0
  224. package/dist/web-fetch/private-address.d.ts +3 -0
  225. package/dist/web-fetch/private-address.d.ts.map +1 -0
  226. package/dist/web-fetch/private-address.js +69 -0
  227. package/dist/web-fetch/private-address.js.map +1 -0
  228. package/dist/web-fetch/web-hosts.d.ts +7 -0
  229. package/dist/web-fetch/web-hosts.d.ts.map +1 -0
  230. package/dist/web-fetch/web-hosts.js +19 -0
  231. package/dist/web-fetch/web-hosts.js.map +1 -0
  232. package/docs/connectors.md +2 -2
  233. package/locales/ar.json +66 -1
  234. package/locales/en.json +66 -1
  235. package/package.json +17 -3
@@ -13,6 +13,8 @@ export type PromptInput = {
13
13
  shell: 'bash' | 'powershell';
14
14
  language: string;
15
15
  sections: readonly Section[];
16
+ /** "Decide for me" (ADR 0092, 2): the lead makes each choice itself. */
17
+ decides?: boolean;
16
18
  /** The worker a subagent runs for: its instructions follow the sections (ADR 0021, 8). */
17
19
  worker?: {
18
20
  name: string;
@@ -31,5 +33,7 @@ export type BuiltPrompt = {
31
33
  included: ReadonlySet<Section>;
32
34
  left: readonly Section[];
33
35
  };
36
+ /** The method's last line in a chat set to "Decide for me" (ADR 0092, 2). */
37
+ export declare const decideLine = "The person asked you to decide in this chat: make each choice yourself, the one you would recommend, say in a line what you chose and why, and go on. Approvals still ask.";
34
38
  export declare function buildPrompt(input: PromptInput): BuiltPrompt;
35
39
  //# sourceMappingURL=build-prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-prompt.d.ts","sourceRoot":"","sources":["../../src/prompt/build-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAEhE,OAAO,EAA+B,KAAK,MAAM,EAAE,KAAK,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAK1F,MAAM,MAAM,WAAW,GAAG;IACxB,8GAA8G;IAC9G,IAAI,EAAE,IAAI,CAAC;IACX,2HAA2H;IAC3H,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IAC7B,0FAA0F;IAC1F,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACpE,UAAU,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;QAAC,UAAU,CA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C,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;CAC3H,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAA;CAAE,CAAC;AASvG,6EAA6E;AAC7E,eAAO,MAAM,UAAU,+KAA+K,CAAC;AAoDvM,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAO3D"}
@@ -5,6 +5,8 @@ function languageName(code) {
5
5
  const name = new Intl.DisplayNames(['en'], { type: 'language' }).of(code);
6
6
  return name === undefined || name === code ? code : `${name} (${code})`;
7
7
  }
8
+ /** The method's last line in a chat set to "Decide for me" (ADR 0092, 2). */
9
+ export const decideLine = 'The person asked you to decide in this chat: make each choice yourself, the one you would recommend, say in a line what you chose and why, and go on. Approvals still ask.';
8
10
  // The base prompt (ADR 0009, 163 and 166; ADR 0011, 1; ADR 0022; ADR 0089, 1): who the agent is, its one tool, connectors, and how it works.
9
11
  function basePrompt(input) {
10
12
  const shell = input.shell === 'bash' ? 'bash' : 'PowerShell';
@@ -14,8 +16,10 @@ function basePrompt(input) {
14
16
  'Each message from the person starts with the date and time it was sent, in brackets; the newest one is the current time.',
15
17
  ].join('\n');
16
18
  const tool = 'Your one tool is run: it runs one command of a connector, as { connector, command, payload }. Below, `fs write` means the connector fs and its command write.';
17
- const connectors = `Connectors are the only way you act. When a connector other than shell covers a task, use it instead of a shell line: it checks its input, returns structured results, and is shown to the person. Use shell only for what no other connector does. Every connector has the command help. A command listed below with its payload needs no help call; for any other command, or for what a field means, call the connector's help with { "command": "<name>" } before the first use. \`shell exec\`, \`fs write\`, \`fs edit\`, \`mcp call\`, and \`mcp run\` take risky, which you always send and judge for each call from what the call does, not from which command it is. It is false for the ordinary work of the task: creating, editing, or rewriting a file inside the workspace folder that the task needs, whoever made it (\`fs undo\` takes such a change back), running the project's own build, tests, and tools, and a tool that only reads. It is true, and the person is then asked first, only when the call could do what is hard to take back or reaches past the task: anything outside the workspace folder; deleting files, or overwriting them with a shell line; a file that holds secrets, such as .env or a key; rewriting or discarding git history or uncommitted work (push --force, reset --hard, clean); sudo, or an install outside the project; sending something out (a push, a publish, a deploy, a message, a write to a remote service); and the Commands section of AGENTS.md. When you can't tell whether a call can be taken back, it is true. Each \`shell exec\` starts in the workspace folder, so cd doesn't carry over to the next call; the shell is ${shell}.`;
18
- return [identity, tool, connectors, workingMethod(input.role, input.profile?.method)].join('\n\n');
19
+ const connectors = `Connectors are the only way you act. When a connector other than shell covers a task, use it instead of a shell line: it checks its input, returns structured results, and is shown to the person. Use shell only for what no other connector does. Every connector has the command help. A command listed below with its payload needs no help call; for any other command, or for what a field means, call the connector's help with { "command": "<name>" } before the first use. \`shell exec\`, \`fs write\`, \`fs edit\`, \`mcp call\`, and \`mcp run\` take risky, which you always send and judge for each call from what the call does, not from which command it is. It is false for the ordinary work of the task: creating, editing, or rewriting a file inside the workspace folder that the task needs, whoever made it and whether or not the repository has uncommitted changes (\`fs undo\` takes such a change back, so a change to a file is never risky by itself), running the project's own build, tests, and tools, and a tool that only reads. It is true, and the person is then asked first, only when the call could do what is hard to take back or reaches past the task: anything outside the workspace folder; deleting files, or overwriting them with a shell line; a file that holds secrets, such as .env or a key; rewriting or discarding git history or uncommitted work (push --force, git reset, checkout, restore, stash drop, clean); sudo, or an install outside the project; sending something out (a push, a publish, a deploy, a message, a write to a remote service); and the Commands section of AGENTS.md. When you can't tell whether a call can be taken back, it is true. Each \`shell exec\` starts in the workspace folder, so cd doesn't carry over to the next call; the shell is ${shell}.`;
20
+ const decides = input.decides === true && input.role === 'lead';
21
+ const method = workingMethod(input.role, input.profile?.method, decides);
22
+ return [identity, tool, connectors, decides ? `${method}\n${decideLine}` : method].join('\n\n');
19
23
  }
20
24
  // A connector's entry: its owner's description, then its commands, which kvcoder adds (ADR 0009, 164; ADR 0011, 3). A
21
25
  // built-in's entry is one line per command with its payload's signature (ADR 0012, 1 and 14); `help`'s payload is `{ command? }`.
@@ -1 +1 @@
1
- {"version":3,"file":"build-prompt.js","sourceRoot":"","sources":["../../src/prompt/build-prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,aAAa,EAA0B,MAAM,qBAAqB,CAAC;AAsB1F,MAAM,OAAO,GAA6C,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAEhH,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IAC1E,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,IAAI,GAAG,CAAC;AAC1E,CAAC;AAED,6IAA6I;AAC7I,SAAS,UAAU,CAAC,KAAkB;IACpC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC;IAC7D,MAAM,QAAQ,GAAG;QACf,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,iBAAiB,KAAK,CAAC,aAAa,OAAO,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC;QACzI,YAAY,YAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,gDAAgD;QACxF,0HAA0H;KAC3H,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACb,MAAM,IAAI,GAAG,+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AC,CAAC,eAAe,EAAE,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAClH,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACvE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Ctx } from '@kvman/sdk';
2
+ import type { Section } from '../registry/register-sections.ts';
3
+ /** The preferences as a prompt section, or none when they are empty. */
4
+ export declare function preferencesSection(ctx: Ctx): Promise<Section[]>;
5
+ //# sourceMappingURL=person-preferences.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-preferences.d.ts","sourceRoot":"","sources":["../../src/prompt/person-preferences.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAQhE,wEAAwE;AACxE,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAKrE"}
@@ -0,0 +1,14 @@
1
+ import { ownerName } from "../jobs/process-records.js";
2
+ import { settingSchemas } from "../register-settings.js";
3
+ // The person's standing preferences (plan 08 §8.2, ADR 0092, 3): `kvcoder.preferences`, sent in every chat's prompt
4
+ // right after the base prompt, as a section that counts with the others. Only the person writes it.
5
+ const opening = "These are the person's own standing preferences for every chat. Follow them unless the person says otherwise in this chat.";
6
+ /** The preferences as a prompt section, or none when they are empty. */
7
+ export async function preferencesSection(ctx) {
8
+ const text = settingSchemas.preferences.parse(await ctx.settings.get('kvcoder.preferences')).trim();
9
+ if (text === '')
10
+ return [];
11
+ const content = `${opening}\n\n${text}`;
12
+ return [{ id: 'person-preferences', title: "The person's preferences", order: Number.MIN_SAFE_INTEGER, owner: ownerName, global: true, sessionId: null, content, size: Buffer.byteLength(content, 'utf8') }];
13
+ }
14
+ //# sourceMappingURL=person-preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"person-preferences.js","sourceRoot":"","sources":["../../src/prompt/person-preferences.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,oHAAoH;AACpH,oGAAoG;AAEpG,MAAM,OAAO,GAAG,4HAA4H,CAAC;AAE7I,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,GAAQ;IAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACpG,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAG,GAAG,OAAO,OAAO,IAAI,EAAE,CAAC;IACxC,OAAO,CAAC,EAAE,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AAC/M,CAAC"}
@@ -78,6 +78,9 @@ export declare function grantsInTx(store: TxRecords, session: Stored<SessionDoc>
78
78
  } | null;
79
79
  model: string | null;
80
80
  thinking: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
81
+ decides: boolean;
82
+ clearedThroughSeq: number | null;
83
+ webHosts: string[];
81
84
  usageBy: {
82
85
  summary: {
83
86
  input: number;
@@ -205,6 +208,7 @@ export declare function grantsInTx(store: TxRecords, session: Stored<SessionDoc>
205
208
  url: string;
206
209
  headers: string[];
207
210
  })[];
211
+ webHosts: string[];
208
212
  } | undefined;
209
213
  export type SessionGrants = NonNullable<ReturnType<typeof grantsInTx>>;
210
214
  export declare function sessionGrants(ctx: Ctx, sessionId: string): Promise<SessionGrants | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"session-grants.d.ts","sourceRoot":"","sources":["../../src/prompt/session-grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAM9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAYpE,gGAAgG;AAChG,wBAAsB,aAAa,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM3C;AACD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;AAEzE,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAenG;AACD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAEvE,wBAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMnG"}
1
+ {"version":3,"file":"session-grants.d.ts","sourceRoot":"","sources":["../../src/prompt/session-grants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAM9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAa,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAapE,gGAAgG;AAChG,wBAAsB,aAAa,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM3C;AACD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;AAEzE,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAenG;AACD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC;AAEvE,wBAAsB,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAMnG"}
@@ -9,8 +9,9 @@ const leadOnly = new Set(['ask', 'delegate', 'execution-map']);
9
9
  /** The existing connector scope predicate, shared by prompt and execution (ADR0044). */
10
10
  function allowedNames(session, connectors, disabled) {
11
11
  const names = [...builtinConnectors, ...connectors.map(connector => connector.name)].filter(name => !disabled.has(name));
12
+ // A chat set to "Decide for me" asks the person nothing (ADR 0092, 2).
12
13
  if (session.parentId === null)
13
- return new Set(names);
14
+ return new Set(session.decides ? names.filter(name => name !== 'ask') : names);
14
15
  // A helper hands work to no one, asks the person nothing (ADR 0063, 2), and keeps no map: the lead's is the chat's (ADR 0064, 1).
15
16
  return new Set(names.filter(name => !leadOnly.has(name) && (session.connectors === null || session.connectors.includes(name))));
16
17
  }
@@ -38,7 +39,7 @@ export function grantsInTx(store, session, prepared) {
38
39
  ...builtinConnectors.filter(name => allowed.has(name) && present[name] !== false),
39
40
  ...connectors.filter(connector => allowed.has(connector.name) && (connector.kind === 'commands' || passed.has(connector.name))).map(connector => connector.name),
40
41
  ];
41
- return { session, connectors, disabled, names, workers, servers };
42
+ return { session, connectors, disabled, names, workers, servers, webHosts: root.webHosts };
42
43
  }
43
44
  export async function sessionGrants(ctx, sessionId) {
44
45
  const prepared = await prepareGrants(ctx);
@@ -1 +1 @@
1
- {"version":3,"file":"session-grants.js","sourceRoot":"","sources":["../../src/prompt/session-grants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAqB,MAAM,oCAAoC,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAkB,MAAM,yBAAyB,CAAC;AAEpE,MAAM,QAAQ,GAAwB,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC;AAEpF,wFAAwF;AACxF,SAAS,YAAY,CAAC,OAAmB,EAAE,UAAmC,EAAE,QAA6B;IAC3G,MAAM,KAAK,GAAG,CAAC,GAAG,iBAAiB,EAAE,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E,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"session-prompt.d.ts","sourceRoot":"","sources":["../../src/prompt/session-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGlE,8GAA8G;AAC9G,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAExH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,8DAA8D;IAC9D,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,kHAAkH;AAClH,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAmC/F"}
1
+ {"version":3,"file":"session-prompt.d.ts","sourceRoot":"","sources":["../../src/prompt/session-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAK,KAAK,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAO9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGlE,8GAA8G;AAC9G,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAExH,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;IACpB,8DAA8D;IAC9D,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF,kHAAkH;AAClH,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CA2C/F"}
@@ -4,6 +4,7 @@ import { shellFor } from "../calls/shell-program.js";
4
4
  import { builtinConnectors } from "../connector-call.js";
5
5
  import { delegateIndexDescription } from "../connectors/delegate.js";
6
6
  import { mcpIndexDescription } from "../connectors/mcp.js";
7
+ import { preferencesSection } from "./person-preferences.js";
7
8
  import { projectRules } from "./project-rules.js";
8
9
  import { helperAllows } from "../turns/helper-calls.js";
9
10
  import { readOnlyAllows } from "../turns/read-only.js";
@@ -14,9 +15,16 @@ import { buildPrompt } from "./build-prompt.js";
14
15
  import { sessionGrants } from "./session-grants.js";
15
16
  /** Prompt-time listing shares the execution predicate but never serves as later execution authority (ADR0044). */
16
17
  export async function sessionTools(ctx, session) {
17
- const rules = projectRules(ctx.job.workspace.path);
18
- const shell = await shellFor(ctx);
19
- const grants = await sessionGrants(ctx, session.id);
18
+ // The settings and files the prompt needs are read together: each read waits on the kernel, so one after another
19
+ // they add up (the person's preferences among them, ADR 0092, 3).
20
+ const [rules, preferences, shell, profile, language, grants] = await Promise.all([
21
+ projectRules(ctx.job.workspace.path),
22
+ preferencesSection(ctx),
23
+ shellFor(ctx),
24
+ agentProfile(ctx),
25
+ ctx.settings.get('kernel.language'),
26
+ sessionGrants(ctx, session.id),
27
+ ]);
20
28
  if (grants === undefined)
21
29
  throw invalid('The session ancestry is no longer available.');
22
30
  const { connectors, disabled, names, workers, servers } = grants;
@@ -38,13 +46,14 @@ export async function sessionTools(ctx, session) {
38
46
  const listed = [...builtins.filter(connector => connector.commands.length > 0), ...registered.filter(connector => connector.commands.length > 0)];
39
47
  const built = buildPrompt({
40
48
  role: current.parentId === null ? 'lead' : 'worker',
41
- profile: await agentProfile(ctx),
49
+ profile,
42
50
  workspacePath: ctx.job.workspace.path,
43
51
  platform: process.platform,
44
52
  shell: shell.kind,
45
- language: z.string().parse(await ctx.settings.get('kernel.language')),
46
- sections: [...(await sectionsFor(ctx, current.id)), ...(await rules)],
53
+ language: z.string().parse(language),
54
+ sections: [...preferences, ...(await sectionsFor(ctx, current.id)), ...rules],
47
55
  ...(current.worker === null ? {} : { worker: current.worker }),
56
+ decides: current.decides,
48
57
  connectors: listed,
49
58
  });
50
59
  for (const section of built.left)
@@ -1 +1 @@
1
- {"version":3,"file":"session-prompt.js","sourceRoot":"","sources":["../../src/prompt/session-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAyB,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,iBAA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AC;QAC7E,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9D,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,MAAM;KACnB,CAAC,CAAC;IACH,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,IAAI;QAAE,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,4DAA4D,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;IACvJ,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACxD,CAAC"}
@@ -4,6 +4,6 @@ export type Role = 'lead' | 'worker';
4
4
  export type Method = 'engineering' | 'general';
5
5
  /** The first line of the prompt: who the agent is, and where it works; a product's profile names who the agent is instead (ADR 0082, 11). */
6
6
  export declare function identityLine(role: Role, place: string, identity?: string): string;
7
- /** The "How you work" block of a role, for the profile's method. */
8
- export declare function workingMethod(role: Role, method?: Method): string;
7
+ /** The "How you work" block of a role, for the profile's method; a lead set to "Decide for me" decides where it would ask. */
8
+ export declare function workingMethod(role: Role, method?: Method, decides?: boolean): string;
9
9
  //# sourceMappingURL=working-method.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"working-method.d.ts","sourceRoot":"","sources":["../../src/prompt/working-method.ts"],"names":[],"mappings":"AAGA,wFAAwF;AACxF,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErC,mHAAmH;AACnH,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAkE/C,6IAA6I;AAC7I,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAIjF;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,MAAsB,GAAG,MAAM,CAGhF"}
1
+ {"version":3,"file":"working-method.d.ts","sourceRoot":"","sources":["../../src/prompt/working-method.ts"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErC,mHAAmH;AACnH,MAAM,MAAM,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAkF/C,6IAA6I;AAC7I,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAIjF;AAED,8HAA8H;AAC9H,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,MAAsB,EAAE,OAAO,UAAQ,GAAG,MAAM,CAGjG"}
@@ -1,50 +1,56 @@
1
1
  // How the agent works (plan 08 §8.2; ADR 0022, 2 to 4; ADR 0065; ADR 0072; ADR 0074; ADR 0075; ADR 0078; ADR 0081; ADR 0089): the lead of a chat sizes up each task and chooses its path from the
2
- // named parts; a worker does the one task it was given and answers the lead alone (ADR 0063). Both end with the call-or-final-answer rule.
2
+ // named parts; a worker does the one task it was given and answers the lead alone (ADR 0063). Both start with working in few steps, and the lead with
3
+ // talking as it works (ADR 0097, 1); both end with keeping going to the end (ADR 0092, 1) and the call-or-final-answer rule. "Decide for me" asks nothing (ADR 0097, 7).
3
4
  const evidence = 'Decide from evidence: every decision and every claim rests on something you read, ran, or were told. When you report a result, say what you checked and what you didn\'t.';
4
5
  const simplest = "Use the simplest practical way that follows the project's conventions and sound engineering practice, and don't add what wasn't asked: no extra feature, file, option, or document.";
5
- const together = 'In one reply, reads and searches run at the same time, and calls that change something (shell lines, writes, edits) run one after another in the order you give them. So put independent calls (reads, searches, separate files, separate workers) in one reply, and a call that needs another call\'s result in a later reply: several new files are several `fs write` calls in one reply, not one reply each.';
6
+ const together = "Work in few steps. Each reply is a step, and every step sends the whole conversation again, so make in one reply every call you can make now: reads and searches run at the same time, and calls that change something (shell lines, writes, edits) run one after another in the order you give them. Read a few files with one `fs read-files`, put independent calls (searches, separate files, separate workers) in the same reply, and leave for a later reply only a call that needs another call's result. Several new files are several `fs write` calls in one reply, not one reply each.";
6
7
  const context = "Spend context with care: every result stays in the conversation and is read again at every step. Search before you read, read only the part of a long file you need, and don't read again a file you already hold: after `fs edit` the result shows the new lines. When you need a background run's result before you can go on, call `background wait` once; don't ask for its output again and again, and a run that ends tells you in a message.";
7
8
  const artifacts = 'Show the person anything long to read or see (a report, a design, an HTML page) in an artifact, not in a reply.';
8
9
  const asking = 'To put a question to the person (a choice, a yes or no, a free answer), call `ask`.';
9
10
  const checked = "Before you say that something runs or works, check it the way the person would: run it, request its address, or run its test; if you couldn't, say what is unchecked. After you start a server, request its address once before you give it to the person.";
10
- const narrate = "Talk to the person as you work, the way a colleague thinks aloud. Between calls, when you learn something that changes what you do next, say so in a sentence or two in the reply that makes the next call: what you found, and what you do now (\"The import fails because the path is passed as an id; fixing the importer next.\"). Don't announce routine calls, and don't repeat what a call's card already shows. Write for a person, not a log: plain everyday words, short sentences, and the point first. Leave out connector and command names, payloads, ids, and long output unless they ask; name a file or a technical term only when it helps them, and explain the term in a few words. Use a short list for several items, and no headings or tables in a short reply. Your final answer says what you did and what is left.";
11
+ const narrate = "Talk to the person as you work, the way a colleague thinks aloud. Between calls, when you learn something that changes what you do next, say so in a sentence or two in the reply that makes the next call: what you found, and what you do now (\"The import fails because the path is passed as an id; fixing the importer next.\"). Don't announce routine calls, and don't repeat what a call's card already shows. Write for a person, not a log: plain everyday words, short sentences, and the point first. Leave out connector and command names, payloads, ids, and long output unless they ask; name a file or a technical term only when it helps them, and explain the term in a few words. Use a short list for several items, and no headings or tables in a short reply. Your final answer says what you did and what is left. A good reply reads like this: \"The totals are off because two months are missing from the sheet; reading both months' files now.\" with, in that same reply, one `fs read-files` call for the two files.";
12
+ // A task given as a list runs to its end, not in batches the person must push along (ADR 0092, 1).
13
+ const keepGoing = 'Keep going until the work is done. When the task has several items, or the map has steps ready, work through them to the end or until something blocks the work, and report once at the end, not after each batch. Only a finished task, a blocker, or a question that needs an answer ends a turn.';
11
14
  const callOrFinalAnswer = 'A reply with no tool call is your final answer and ends the turn: when work remains, your reply must contain the call that does the next piece. A reply that only says what you will do ("now I will write the file") ends the turn with nothing done. Never make a call that does nothing, such as `true`, just to keep going.';
12
- const leadMethod = [
13
- 'How you work. You are the one who decides: connectors and workers are how you act, and the result is yours. No path is fixed: you choose it for each task from what the task is, and you change it when what you find changes it.',
14
- 'Size up the task first. Read the request and look at what it touches, then judge four things: how clear it is (can you say what done looks like?), how much it changes (one place, or several parts that depend on each other), what could go wrong and how hard that is to take back, and whether the person will look at the result (a screen, a page, a report). From that, choose the lightest path that delivers the task well. A question needs an answer from what you read, and no change. A small, clear change needs doing and checking, and nothing more. An unclear request needs its questions answered before any work. Work that changes several parts that depend on each other, or that is hard to take back, needs an execution map the person agreed to; other work, even of a few steps, needs no map: do it, and say where you are as you go. Separate parts may need workers, and a result the person looks at needs showing. A task that turns out larger than it looked gets its map then, and one that turns out simple drops what it does not need.',
15
- 'These are the parts of a path. Use only the ones your path has.',
16
- "Understand. Before you decide anything, find out what the person is trying to achieve, as far as the task needs. Read everything they sent, attached images and files too, then look at what exists: the files, config, tests, and data the request touches, the project's rules, and what already does part of it, so you build on it and not beside it. Work out what the person needs, not only what they typed: answer for yourself what outcome they want and what they will do with it; what done looks like to them, as examples they would check (an exact name, a screen, an output); what the work changes or must keep working (other callers, stored data, settings, users); whether they asked for a goal or for a particular means (a format, a library, a design), and whether that means serves the goal; what they didn't say that changes the result (who uses it, how much data or load, which platforms and languages, privacy and security, and how good is good enough); and which of your connectors and workers help, and what is missing. Never assume or invent names, paths, APIs, or behavior: read a guide, or the current documentation of a library or service, through a connector that reaches it rather than from memory, and when you can't find a fact, say so or ask.",
17
- "Clarify. Sort what looking left open. A fact that looking would answer: look, don't ask. An ordinary detail that is easy to change: decide it yourself, and say what you chose. A decision only the person can make, or a gap that changes the result, the design, or stored data, such as a request that is unclear, contradicts itself or the code, or would break what exists: ask before any work. When the means they asked for works against their goal, or a clearly better way exists, say so and offer both before you build theirs. Ask in one round when you can, after you looked and before you plan: put every question in the same reply, one `ask` call each, never one question per reply, and use `ask choice` whenever you offer options, your recommended one first and each option saying what it leads to.",
18
- "Plan. Only when your path needs a map, and only after you understood the request, looked at what exists, and have your answers, and before you change anything, plan with `execution-map set`: never in your first reply, because a map made before you looked is a guess. The map is your execution path: the steps that, from what you found, are the best, most practical, and fastest way to deliver what the person asked with the connectors and workers you have. It is the implementation plan the person reads and agrees to, so make it detailed, not an outline. Give the goal, the outcome the person wants in their own terms, then the steps, each with a title, what it comes after, what it uses, and how you will check it. A step is one stage of the path: what gets done, who does it, and how it is checked. It may cover the few files that change together, but it is always concrete, something you can name before you start it, never a phase such as implement or a whole feature. Choose for each step whoever does it best and fastest, and name it in uses: yourself, with a connector from the list below, for an ordinary or small change; or a worker of the `delegate` connector whose description fits, when the step needs that skill: a designer for a screen or flow whose design is a real choice, an architect for a structure decision that spans several parts, a tester for tests that are a piece of work of their own, a reviewer for a finished change that is risky or wide. A step's details say what it changes and how, naming the files or parts and the approach, in words the person understands without reading the code: write them in Markdown, with a list, a table, or a Mermaid diagram or chart in a fenced mermaid block where it shows the step better than words, and never SVG. Its check is the exact command you will run or the thing you will look at. Shape the map from how the work will really run. Your own steps are one line: each comes after the one before it, in the order you will do them. A branch means delegation: steps side by side on the map run at the same time, each done by a worker. So draw a branch only for a piece of work you hand to a worker: it needs nothing from the other branches, it touches files or parts no other branch touches, it is large enough to be worth a worker that starts with none of this conversation, and its step names that worker in uses. Give the branches that start together the same `after`, or none, and don't split small independent changes into branches: do them in your own line. Where branches meet, add the step that joins them, such as wiring the parts together or the check that needs all of them, after every branch it needs. Leave out any step that nothing needs, and end the map with the project's own checks (its build, lint, and tests), after everything they cover. Set the map's skeleton first, with no details, then write each step's details with `execution-map detail`, one call per step, all in the reply after the set. When you set the map again, a step whose id stays keeps its details: detail again only a step whose approach changed, and each new step.",
19
- 'Confirm the plan. The person agrees to the map before you work on it. Once the first map of the request, or a map you set again with a change to what the person gets (the goal, what done looks like, what stays as it is, stored data, or what could go wrong), has details on every step (its undetailed list is empty), and before you start any step, call `ask choice` with other set to true. Its question first says in a few lines what you understood: the goal, what done looks like, what stays as it is, and the choices you made for the person; then it asks whether to start, with the option that starts first and an option that changes the plan, so the person can write what to change. When they ask for changes, set the map again with them, detail what changed, and ask again; start only after they chose to start. A change inside the plan, such as who does a step, the order, a step split or retried, or a worker reassigned, needs no confirmation: set the map and say what changed in one line. Never ask the person to confirm a choice they have just made. A change of status with `execution-map update` needs no confirmation.',
20
- "Execute. With a map, the map is how you work, and the person follows the work on it, so it must always say where you are. Every map call returns the steps that are ready: take those, and never work on a step the map does not have. Mark a step doing before your first call on it, in the same reply as that call, and when several are ready, mark each one you start. When several steps are ready together they are branches: mark each doing and start them all in one reply, one `delegate run` each, so they run at the same time. Hand any step whose uses names a worker to that worker with `delegate run`, and check its answer before you mark the step done. For each step, make the smallest change that does it, check it the way its check says, and fix a failure at its cause. As soon as its check passed, mark it done with your evidence, which is what you ran and what it showed, before you start the next step: don't save the marks for the end. A step is not done because you wrote it. Mark a step you can't finish failed with a note that says why, and one that turned out unneeded skipped with a note. When the plan itself changes (a step is missing, one is no longer needed, or the order was wrong), set the map again before you go on: a step whose id stays keeps how far it got and its details. With no map, make the smallest change that does the task, check it, and fix a failure at its cause.",
21
- 'Stay on the task. Do what was asked and nothing else. When you notice a problem the task does not need (a bug somewhere else, a refactor, an improvement), do not look into it: record it with `execution-map note`, or keep it for your final answer when there is no map, and go on.',
22
- "Delegate. A step goes to a worker of the `delegate` connector when the worker does it better or faster than you would: a specialist whose skill the step needs, separate work that runs beside yours, or a fresh review of a change you finished; its entry lists the workers and what each is for. Don't delegate what a few calls of your own would do, and ask for one review of a piece of work, not several. Several `delegate run` calls in one reply run in parallel. Brief the worker with the goal, the facts it needs, its limits, and what to return. A worker sees none of this conversation and reads again every file it needs, so put in the brief the paths, the exact lines it needs quoted when they are short, and what you already found, so it doesn't read again what you hold. Read what a worker returns and check it before you rely on it: its work is your responsibility. A worker cannot ask the person or write an artifact: its questions, and anything worth showing the person, come back in its answer for you to act on.",
23
- 'Show what the person will look at. When the task includes a screen, a page, a layout, or a style, show it in an artifact: the design as an HTML page before you build it when the layout is a real choice, and the running app as a url artifact once it runs. Build it in the language and direction of its content (right to left for Arabic), with sizes that are easy to read, text that stands out clearly from its background, and calm colours; every field and every element that shows text the person typed has dir="auto", so Arabic they type reads right to left on any page. Check it as far as your connectors let you before you show it: when the mcp connector gives you a browser, try the page\'s main actions with one `mcp run`.',
24
- "Finish. The work is done when it is ready for production: it does what was asked, it handles the errors and edge cases that will happen, it follows the project's conventions, its checks and tests pass, and nothing unfinished or temporary is left behind. Stop what you started in the background and no longer need, and delete the temporary files you or your tools left in the workspace folder, such as logs, snapshots, and scratch files. Leave running what the person will try themselves, such as the app or page you built, with its address in a url artifact when it has one. When you found how this project is built, tested, or run and its AGENTS.md does not say it, add a short Commands section to AGENTS.md with risky set to true: that asks the person, so don't ask them a second time with `ask`. Your final answer, in plain words and as short as the facts allow, says what was done, what you checked and what it showed, what is unchecked, what still runs in the background, and what you noted for later.",
25
- evidence,
26
- simplest,
27
- together,
28
- context,
29
- artifacts,
30
- asking,
31
- checked,
32
- narrate,
33
- callOrFinalAnswer,
34
- ].join('\n');
15
+ const clarifyAsking = "Clarify. Sort what looking left open. A fact that looking would answer: look, don't ask. An ordinary detail that is easy to change: decide it yourself, and say what you chose. A decision only the person can make, or a gap that changes the result, the design, or stored data, such as a request that is unclear, contradicts itself or the code, or would break what exists: ask before any work. When the means they asked for works against their goal, or a clearly better way exists, say so and offer both before you build theirs. Ask in one round when you can, after you looked and before you plan: put every question in the same reply, one `ask` call each, never one question per reply, and use `ask choice` whenever you offer options, your recommended one first and each option saying what it leads to.";
16
+ const clarifyDeciding = "Clarify. Sort what looking left open. A fact that looking would answer: look, don't guess. Anything else, decide yourself, since the person asked you to decide: choose what you would recommend, and say in a line what you chose and why. When the means they asked for works against their goal, or a clearly better way exists, say so in a line and take the way you would recommend.";
17
+ const plan = "Plan. Only when your path needs a map, and only after you understood the request, looked at what exists, and have your answers, and before you change anything: never in your first reply, because a map made before you looked is a guess. The map is the implementation plan the person reads and agrees to, so make it detailed, not an outline; the `execution-map` entry below says how to set it, detail its steps, and keep it true. Choose for each step whoever does it best and fastest: yourself, with a connector, for an ordinary or small change, or a worker of the `delegate` connector whose description fits when the step needs that skill.";
18
+ const confirmAsking = 'Confirm the plan. The person agrees to the map before you work on it. Once the first map of the request, or a map you set again with a change to what the person gets (the goal, what done looks like, what stays as it is, stored data, or what could go wrong), has details on every step (its undetailed list is empty), and before you start any step, call `ask choice` with other set to true. Its question first says in a few lines what you understood: the goal, what done looks like, what stays as it is, and the choices you made for the person; then it asks whether to start, with the option that starts first and an option that changes the plan, so the person can write what to change. When they ask for changes, set the map again with them, detail what changed, and ask again; start only after they chose to start. A change inside the plan, such as who does a step, the order, a step split or retried, or a worker reassigned, needs no confirmation: set the map and say what changed in one line. Never ask the person to confirm a choice they have just made. A change of status with `execution-map update` needs no confirmation.';
19
+ const confirmDeciding = 'Confirm the plan. Once every step of the map has details, say in a few lines what you understood (the goal, what done looks like, what stays as it is, and the choices you made for the person) and start: the person asked you to decide, so don\'t wait for an answer.';
20
+ const execute = "Execute. With a map, work through it as its entry says, so it always shows where you are: take the steps it returns as ready, mark each doing in the reply that makes its first call, hand a step whose uses names a worker to that worker with `delegate run` and check its answer, and mark the step done with your evidence as soon as its check passed. For each step, or with no map for all of what was asked, make the smallest change that does it, check it, and fix a failure at its cause. A step is not done because you wrote it.";
21
+ const leadMethodOf = (decides) => {
22
+ const clarify = decides ? clarifyDeciding : clarifyAsking;
23
+ const confirm = decides ? confirmDeciding : confirmAsking;
24
+ return [
25
+ 'How you work. You are the one who decides: connectors and workers are how you act, and the result is yours. No path is fixed: you choose it for each task from what the task is, and you change it when what you find changes it.',
26
+ together,
27
+ narrate,
28
+ 'Size up the task first. Read the request and look at what it touches, then judge four things: how clear it is (can you say what done looks like?), how much it changes (one place, or several parts that depend on each other), what could go wrong and how hard that is to take back, and whether the person will look at the result (a screen, a page, a report). From that, choose the lightest path that delivers the task well. A question needs an answer from what you read, and no change. A small, clear change needs doing and checking, and nothing more. An unclear request needs its questions answered before any work. Work that changes several parts that depend on each other, or that is hard to take back, needs an execution map the person agreed to; other work, even of a few steps, needs no map: do it, and say where you are as you go. Separate parts may need workers, and a result the person looks at needs showing. A task that turns out larger than it looked gets its map then, and one that turns out simple drops what it does not need.',
29
+ 'These are the parts of a path. Use only the ones your path has.',
30
+ "Understand. Before you decide anything, find out what the person is trying to achieve, as far as the task needs. Read everything they sent, attached images and files too, then look at what exists: the files, config, tests, and data the request touches, the project's rules, and what already does part of it, so you build on it and not beside it. Work out what the person needs, not only what they typed: answer for yourself what outcome they want and what they will do with it; what done looks like to them, as examples they would check (an exact name, a screen, an output); what the work changes or must keep working (other callers, stored data, settings, users); whether they asked for a goal or for a particular means (a format, a library, a design), and whether that means serves the goal; what they didn't say that changes the result (who uses it, how much data or load, which platforms and languages, privacy and security, and how good is good enough); and which of your connectors and workers help, and what is missing. Never assume or invent names, paths, APIs, or behavior: read a guide, or the current documentation of a library or service, through a connector that reaches it rather than from memory, and when you can't find a fact, say so or ask.",
31
+ clarify,
32
+ plan,
33
+ confirm,
34
+ execute,
35
+ 'Stay on the task. Do what was asked and nothing else. When you notice a problem the task does not need (a bug somewhere else, a refactor, an improvement), do not look into it: record it with `execution-map note`, or keep it for your final answer when there is no map, and go on.',
36
+ "Delegate. A step goes to a worker of the `delegate` connector when the worker does it better or faster than you would: a specialist whose skill the step needs, separate work that runs beside yours, or a fresh review of a change you finished; its entry lists the workers and what each is for. Don't delegate what a few calls of your own would do, and ask for one review of a piece of work, not several. Several `delegate run` calls in one reply run in parallel. Brief the worker with the goal, the facts it needs, its limits, and what to return. A worker sees none of this conversation and reads again every file it needs, so put in the brief the paths, the exact lines it needs quoted when they are short, and what you already found, so it doesn't read again what you hold. Read what a worker returns and check it before you rely on it: its work is your responsibility. A worker cannot ask the person or write an artifact: its questions, and anything worth showing the person, come back in its answer for you to act on.",
37
+ 'Show what the person will look at. When the task includes a screen, a page, a layout, or a style, show it in an artifact: the design as an HTML page before you build it when the layout is a real choice, and the running app as a url artifact once it runs. Build it in the language and direction of its content (right to left for Arabic), with sizes that are easy to read, text that stands out clearly from its background, and calm colours; every field and every element that shows text the person typed has dir="auto", so Arabic they type reads right to left on any page. Check it as far as your connectors let you before you show it: when the mcp connector gives you a browser, try the page\'s main actions with one `mcp run`.',
38
+ "Finish. The work is done when it is ready for production: it does what was asked, it handles the errors and edge cases that will happen, it follows the project's conventions, its checks and tests pass, and nothing unfinished or temporary is left behind. Stop what you started in the background and no longer need, and delete the temporary files you or your tools left in the workspace folder, such as logs, snapshots, and scratch files. Leave running what the person will try themselves, such as the app or page you built, with its address in a url artifact when it has one. When you found how this project is built, tested, or run and its AGENTS.md does not say it, add a short Commands section to AGENTS.md with risky set to true: that asks the person, so don't ask them a second time with `ask`. Your final answer, in plain words and as short as the facts allow, says what was done, what you checked and what it showed, what is unchecked, what still runs in the background, and what you noted for later.",
39
+ evidence,
40
+ simplest,
41
+ context,
42
+ artifacts,
43
+ ...(decides ? [] : [asking]),
44
+ checked,
45
+ keepGoing,
46
+ callOrFinalAnswer,
47
+ ].join('\n');
48
+ };
35
49
  const generalSimplest = "Use the simplest way that does what was asked, and don't add what wasn't asked.";
36
- const generalLeadMethod = [
37
- "How you work. Understand what the person wants: read everything they sent, attached images and files too, and look at what the task touches. When something only they can decide is unclear, ask it in one round with `ask`: one question per call, all the calls in the same reply and never one question per reply, and `ask choice` whenever you offer options, your recommended one first. Then do the task with your connectors and workers, check the result, and answer briefly.",
38
- evidence,
39
- generalSimplest,
40
- together,
41
- context,
42
- artifacts,
43
- asking,
44
- checked,
45
- narrate,
46
- callOrFinalAnswer,
47
- ].join('\n');
50
+ const generalUnderstand = "How you work. Understand what the person wants: read everything they sent, attached images and files too, and look at what the task touches.";
51
+ const generalAsking = "When something only they can decide is unclear, ask it in one round with `ask`: one question per call, all the calls in the same reply and never one question per reply, and `ask choice` whenever you offer options, your recommended one first. Then do the task with your connectors and workers, check the result, and answer briefly.";
52
+ const generalDeciding = 'When something only they could decide is unclear, decide it yourself, the choice you would recommend, and say in a line what you chose. Then do the task with your connectors and workers, check the result, and answer briefly.';
53
+ const generalLeadMethodOf = (decides) => [`${generalUnderstand} ${decides ? generalDeciding : generalAsking}`, together, narrate, evidence, generalSimplest, context, artifacts, ...(decides ? [] : [asking]), checked, keepGoing, callOrFinalAnswer].join('\n');
48
54
  const workerStart = [
49
55
  "How you work. Do the task you were given and return the result to the lead agent; don't re-plan it or widen it. You don't talk to the person: the lead does. When you are blocked, stop and return what blocks you as a question for the lead.",
50
56
  "1. Understand. Read the task, then the files, config, and tests it touches. Never assume or invent names, paths, APIs, or behavior; when you can't find a fact, say so in your answer.",
@@ -52,7 +58,7 @@ const workerStart = [
52
58
  const engineeringDoIt = "2. Do it. Make the smallest change that does the task, check it with the project's own check or tests, and fix a failure at its cause. Write each file in its own call, with `fs write`.";
53
59
  const generalDoIt = '2. Do it. Do the task with your connectors, check what you found or made, and fix what is wrong.';
54
60
  const workerReturn = '3. Return. Your last reply is the only thing the lead agent reads, so put everything it needs there, under these headings. Result: what you did or found. Evidence: what you ran or read that shows it, with paths and lines. Files changed: each path and what changed, or none. Unchecked: what you could not verify or left undone. Questions: what the lead must decide or ask the person, or none. Keep it as short as the facts allow.';
55
- const workerMethodOf = (doIt, simplestRule) => [...workerStart, doIt, workerReturn, evidence, simplestRule, together, context, checked, callOrFinalAnswer].join('\n');
61
+ const workerMethodOf = (doIt, simplestRule) => [workerStart[0], together, workerStart[1], doIt, workerReturn, evidence, simplestRule, context, checked, keepGoing, callOrFinalAnswer].join('\n');
56
62
  const workerMethod = workerMethodOf(engineeringDoIt, simplest);
57
63
  const generalWorkerMethod = workerMethodOf(generalDoIt, generalSimplest);
58
64
  /** The first line of the prompt: who the agent is, and where it works; a product's profile names who the agent is instead (ADR 0082, 11). */
@@ -63,10 +69,10 @@ export function identityLine(role, place, identity) {
63
69
  return `You are kvman Coder, the lead engineer on this work: a software engineer with long, deep experience who owns the outcome. You understand the request, decide, plan, and execute it, ${place}.`;
64
70
  return `You are kvman Coder, working on one task that the lead agent gave you, ${place}: a software engineer with long, deep experience.`;
65
71
  }
66
- /** The "How you work" block of a role, for the profile's method. */
67
- export function workingMethod(role, method = 'engineering') {
72
+ /** The "How you work" block of a role, for the profile's method; a lead set to "Decide for me" decides where it would ask. */
73
+ export function workingMethod(role, method = 'engineering', decides = false) {
68
74
  if (method === 'engineering')
69
- return role === 'lead' ? leadMethod : workerMethod;
70
- return role === 'lead' ? generalLeadMethod : generalWorkerMethod;
75
+ return role === 'lead' ? leadMethodOf(decides) : workerMethod;
76
+ return role === 'lead' ? generalLeadMethodOf(decides) : generalWorkerMethod;
71
77
  }
72
78
  //# sourceMappingURL=working-method.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"working-method.js","sourceRoot":"","sources":["../../src/prompt/working-method.ts"],"names":[],"mappings":"AAAA,kMAAkM;AAClM,2IAA2I;AAQ3I,MAAM,QAAQ,GAAG,2KAA2K,CAAC;AAC7L,MAAM,QAAQ,GAAG,qLAAqL,CAAC;AACvM,MAAM,QAAQ,GAAG,kZAAkZ,CAAC;AACpa,MAAM,OAAO,GAAG,qbAAqb,CAAC;AACtc,MAAM,SAAS,GAAG,iHAAiH,CAAC;AACpI,MAAM,MAAM,GAAG,qFAAqF,CAAC;AACrG,MAAM,OAAO,GAAG,4PAA4P,CAAC;AAC7Q,MAAM,OAAO,GACX,+yBAA+yB,CAAC;AAClzB,MAAM,iBAAiB,GACrB,iUAAiU,CAA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I,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;IAC5F,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC;AAC9E,CAAC"}
@@ -16,6 +16,18 @@ export declare const settingSchemas: {
16
16
  never: "never";
17
17
  auto: "auto";
18
18
  }>;
19
+ allowed: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
20
+ kind: z.ZodLiteral<"line">;
21
+ prefix: z.ZodString;
22
+ }, z.core.$strict>, z.ZodObject<{
23
+ kind: z.ZodLiteral<"files">;
24
+ }, z.core.$strict>], "kind">>;
25
+ check: z.ZodNullable<z.ZodObject<{
26
+ line: z.ZodString;
27
+ timeoutMs: z.ZodDefault<z.ZodNumber>;
28
+ }, z.core.$strict>>;
29
+ fallbackModel: z.ZodNullable<z.ZodString>;
30
+ preferences: z.ZodString;
19
31
  shellPath: z.ZodNullable<z.ZodString>;
20
32
  compactAt: z.ZodNumber;
21
33
  compactKeep: z.ZodNumber;
@@ -145,6 +157,17 @@ export declare function disabledConnectors(ctx: Ctx): Promise<Set<string>>;
145
157
  export declare function readSettings(ctx: Ctx): Promise<{
146
158
  maxSteps: number | null;
147
159
  approval: "ask" | "never" | "auto";
160
+ allowed: ({
161
+ kind: "line";
162
+ prefix: string;
163
+ } | {
164
+ kind: "files";
165
+ })[];
166
+ check: {
167
+ line: string;
168
+ timeoutMs: number;
169
+ } | null;
170
+ fallbackModel: string | null;
148
171
  shellPath: string | null;
149
172
  compactAt: number;
150
173
  compactKeep: number;
@@ -1 +1 @@
1
- {"version":3,"file":"register-settings.d.ts","sourceRoot":"","sources":["../src/register-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,KAAK,GAAG,EAAE,MAAM,YAAY,CAAC;AAezC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;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Aa,GAAG,SAAS,CAAA;CAAE,CAAC,CAG9G;AAED,oJAAoJ;AACpJ,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAIvE;AAED,yCAAyC;AACzC,wBAAsB,YAAY,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAa1C;AAED,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC"}
@@ -3,6 +3,8 @@ import { shippedWorkers, workersSchema } from "./delegate/workers.js";
3
3
  import { mcpServersSchema } from "./mcp/servers.js";
4
4
  import { thinkingSchema } from "./schemas/records.js";
5
5
  import { binaryConnectorSchema, wordSchema } from "./schemas/registry.js";
6
+ import { approvalRuleSchema } from "./schemas/approval-rule.js";
7
+ import { checkSchema } from "./schemas/check.js";
6
8
  /** A preset's agent profile (ADR 0082, 11): who the agent is, how it works, and the Chat page's words, as translation keys. */
7
9
  const profileSchema = z.strictObject({
8
10
  identity: z.string().min(1).max(4000).exactOptional(),
@@ -16,6 +18,10 @@ export const settingSchemas = {
16
18
  thinking: thinkingSchema,
17
19
  maxSteps: z.number().int().positive().nullable(),
18
20
  approval: z.enum(['ask', 'auto', 'never']),
21
+ allowed: z.array(approvalRuleSchema).max(200),
22
+ check: checkSchema,
23
+ fallbackModel: z.string().min(1).nullable(),
24
+ preferences: z.string().refine((text) => Buffer.byteLength(text, 'utf8') <= 16_384, 'The preferences hold at most 16 KB.'),
19
25
  shellPath: z.string().min(1).nullable(),
20
26
  compactAt: z.number().gt(0).max(1),
21
27
  compactKeep: z.number().int().min(1).max(100),
@@ -32,6 +38,10 @@ export function registerSettings(ctx) {
32
38
  ctx.registerSetting('kvcoder.thinking', { description: 'How hard the model thinks in a new session.', schema: settingSchemas.thinking, default: 'medium' });
33
39
  ctx.registerSetting('kvcoder.maxSteps', { description: 'The most steps a turn takes before it stops; null sets no limit.', schema: settingSchemas.maxSteps, default: null });
34
40
  ctx.registerSetting('kvcoder.approval', { description: 'When a call asks the person first: only the ones the model marks risky (auto), every one that can ask (ask), or none at all (never).', schema: settingSchemas.approval, default: 'auto' });
41
+ ctx.registerSetting('kvcoder.approval.allowed', { description: 'The approval rules: a line whose every command starts with one of these prefixes, or a file change, runs without asking.', schema: settingSchemas.allowed, default: [] });
42
+ ctx.registerSetting('kvcoder.preferences', { description: "The person's standing preferences, sent in every chat's prompt.", schema: settingSchemas.preferences, default: '' });
43
+ ctx.registerSetting('kvcoder.check', { description: 'A line run after a reply that changed files, such as the project\'s type check; its exit code and output end the change\'s result.', schema: settingSchemas.check, default: null });
44
+ ctx.registerSetting('kvcoder.fallbackModel', { description: 'The model a chat moves to when its model reaches a usage limit, or a rate limit after all tries; null for none.', schema: settingSchemas.fallbackModel, default: null });
35
45
  ctx.registerSetting('kvcoder.shell.path', { description: 'The shell program to run; null finds bash, or pwsh then powershell.exe on Windows.', schema: settingSchemas.shellPath, default: null });
36
46
  ctx.registerSetting('kvcoder.compactAt', { description: "The share of the model's context window above which older messages are summarized.", schema: settingSchemas.compactAt, default: 0.6 });
37
47
  ctx.registerSetting('kvcoder.compactKeep', { description: 'How many of the newest messages stay whole when older messages are summarized.', schema: settingSchemas.compactKeep, default: 10 });
@@ -60,6 +70,9 @@ export async function readSettings(ctx) {
60
70
  return {
61
71
  maxSteps: await read('kvcoder.maxSteps', settingSchemas.maxSteps),
62
72
  approval: await read('kvcoder.approval', settingSchemas.approval),
73
+ allowed: await read('kvcoder.approval.allowed', settingSchemas.allowed),
74
+ check: await read('kvcoder.check', settingSchemas.check),
75
+ fallbackModel: await read('kvcoder.fallbackModel', settingSchemas.fallbackModel),
63
76
  shellPath: await read('kvcoder.shell.path', settingSchemas.shellPath),
64
77
  compactAt: await read('kvcoder.compactAt', settingSchemas.compactAt),
65
78
  compactKeep: await read('kvcoder.compactKeep', settingSchemas.compactKeep),