@sayknow-cli/coding-agent 0.5.25 → 0.6.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 (61) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/types/config/settings-schema.d.ts +51 -5
  3. package/dist/types/config/task-model-specialties.d.ts +55 -0
  4. package/dist/types/decisions/keyword-learning.d.ts +61 -0
  5. package/dist/types/decisions/llm-backend.d.ts +13 -1
  6. package/dist/types/decisions/prompt-triage.d.ts +42 -0
  7. package/dist/types/decisions/skill-routing.d.ts +41 -6
  8. package/dist/types/decisions/task-routing.d.ts +96 -11
  9. package/dist/types/hooks/native-prompt-routing.d.ts +21 -0
  10. package/dist/types/hooks/native-skill-hook.d.ts +3 -0
  11. package/dist/types/hooks/skill-keywords.d.ts +9 -0
  12. package/dist/types/hooks/skill-state.d.ts +20 -3
  13. package/dist/types/hooks/ui-skill-keywords.d.ts +15 -0
  14. package/dist/types/i18n/messages/en.d.ts +15 -0
  15. package/dist/types/lsp/index.d.ts +1 -1
  16. package/dist/types/lsp/types.d.ts +1 -1
  17. package/dist/types/modes/components/model-selector.d.ts +11 -0
  18. package/dist/types/sdk/session.d.ts +3 -13
  19. package/dist/types/session/agent-session.d.ts +8 -0
  20. package/dist/types/session/auth-storage-discovery.d.ts +13 -0
  21. package/dist/types/task/index.d.ts +1 -1
  22. package/dist/types/task/receipt.d.ts +2 -0
  23. package/dist/types/task/types.d.ts +114 -18
  24. package/dist/types/tools/browser.d.ts +2 -2
  25. package/dist/types/tools/subagent.d.ts +2 -2
  26. package/package.json +7 -7
  27. package/scripts/eval-skill-routing.ts +37 -12
  28. package/src/config/settings-schema.ts +64 -12
  29. package/src/config/task-model-specialties.ts +131 -0
  30. package/src/decisions/index.ts +8 -2
  31. package/src/decisions/keyword-learning.ts +678 -0
  32. package/src/decisions/llm-backend.ts +213 -67
  33. package/src/decisions/prompt-triage.ts +163 -0
  34. package/src/decisions/skill-routing.ts +39 -56
  35. package/src/decisions/task-routing.ts +382 -66
  36. package/src/decisions/typesafe-backend.ts +3 -0
  37. package/src/hooks/native-prompt-routing.ts +190 -0
  38. package/src/hooks/native-skill-hook.ts +21 -12
  39. package/src/hooks/skill-keywords.ts +9 -0
  40. package/src/hooks/skill-state.ts +41 -10
  41. package/src/hooks/ui-skill-keywords.ts +67 -10
  42. package/src/i18n/messages/de.ts +16 -0
  43. package/src/i18n/messages/en.ts +16 -0
  44. package/src/i18n/messages/es.ts +16 -0
  45. package/src/i18n/messages/fr.ts +16 -0
  46. package/src/i18n/messages/ja.ts +16 -0
  47. package/src/i18n/messages/ko.ts +16 -0
  48. package/src/i18n/messages/zh.ts +16 -0
  49. package/src/internal-urls/docs-index.generated.ts +1 -1
  50. package/src/main.ts +1 -1
  51. package/src/modes/components/model-selector.ts +275 -34
  52. package/src/modes/controllers/selector-controller.ts +50 -2
  53. package/src/modes/shared/agent-wire/command-dispatch.ts +1 -1
  54. package/src/prompts/tools/task.md +1 -0
  55. package/src/sdk/session.ts +5 -82
  56. package/src/session/agent-session.ts +137 -37
  57. package/src/session/auth-storage-discovery.ts +83 -0
  58. package/src/slash-commands/builtin-registry.ts +11 -9
  59. package/src/task/index.ts +98 -40
  60. package/src/task/receipt.ts +3 -0
  61. package/src/task/types.ts +44 -0
package/src/task/types.ts CHANGED
@@ -2,6 +2,12 @@ import type { ThinkingLevel } from "@sayknow-cli/agent-core";
2
2
  import type { Usage } from "@sayknow-cli/ai";
3
3
  import { $env } from "@sayknow-cli/utils";
4
4
  import * as z from "zod/v4";
5
+ import {
6
+ TASK_MODEL_SPECIALTY_IDS,
7
+ type TaskModelSpecialty,
8
+ type TaskRoutingSource,
9
+ } from "../config/task-model-specialties";
10
+ import type { TaskTier } from "../decisions/task-routing";
5
11
  import { isValidTaskId, TASK_ID_DESCRIPTION } from "./id";
6
12
  import type { TaskResultReceipt } from "./receipt";
7
13
  import type { SpawnRoiReconciliation } from "./roi-reconciliation";
@@ -103,6 +109,12 @@ const createTaskItemSchema = (_contextEnabled: boolean) =>
103
109
  .describe(
104
110
  "typed executor mode: default keeps ordinary executor behavior; ultragoal-red-team injects the Ultragoal QA/red-team prompt fragment. Prefer this over free-form assignment text (#2698).",
105
111
  ),
112
+ specialty: z
113
+ .enum(TASK_MODEL_SPECIALTY_IDS)
114
+ .optional()
115
+ .describe(
116
+ "kind of work, so the model the user assigned to it under /model runs this child: backendArchitecture, frontendDesign, implementation, testing, or review. Declaring it is deterministic — no classifier, no routing switch; the child only leaves that model if it errors (429, 5xx, auth, quota). Omit to keep the agent's role model, or to let auto-detection decide when task.modelRouting.enabled is on.",
117
+ ),
106
118
  inheritContext: z
107
119
  .enum(["none", "receipt", "last-turn", "bounded", "full"])
108
120
  .optional()
@@ -250,6 +262,34 @@ export interface ModelSubstitutionWarning {
250
262
  reason: "auth_unavailable" | "assistant_model_mismatch";
251
263
  }
252
264
 
265
+ /**
266
+ * What the model router *asked for* on one child — deliberately not what it ran on.
267
+ *
268
+ * The dispatched value is a fallback chain, so the head can lose to a later
269
+ * candidate when it fails to authenticate. Recording the request separately is
270
+ * what keeps a receipt from claiming a specialty model was used when the spawn
271
+ * actually fell through to the role's baseline. `ModelSubstitutionWarning`
272
+ * covers the disagreement; this covers the intent.
273
+ */
274
+ export interface TaskRoutingAttribution {
275
+ /** Axis the head came from. `baseline` means the router declined to move. */
276
+ source: TaskRoutingSource;
277
+ /** Bounded specialty id, present only when the specialty axis won. */
278
+ specialty?: TaskModelSpecialty;
279
+ /** Tier the classifier settled on. Null for a specialty swap, which has no ladder. */
280
+ tier?: TaskTier;
281
+ /** True when the caller declared the specialty on the spawn; no classifier ran. */
282
+ declared: boolean;
283
+ /** False for ordinary LLM backends, which return no probabilities at all. */
284
+ calibrated: boolean;
285
+ /** Probability. Present only when `calibrated` is true — never synthesised. */
286
+ confidence?: number;
287
+ /** Ordinal clarity in [0,1], recorded in place of a probability when uncalibrated. */
288
+ ordinalStrength?: number;
289
+ /** Router's own explanation, surfaced verbatim on the receipt. */
290
+ reason: string;
291
+ }
292
+
253
293
  /** Progress tracking for a single agent */
254
294
  export interface AgentProgress {
255
295
  index: number;
@@ -283,6 +323,8 @@ export interface AgentProgress {
283
323
  durationMs: number;
284
324
  modelOverride?: string | string[];
285
325
  modelSubstitutionWarning?: ModelSubstitutionWarning;
326
+ /** What the router asked for on this child. See {@link TaskRoutingAttribution}. */
327
+ routing?: TaskRoutingAttribution;
286
328
  /** Data extracted by registered subprocess tool handlers (keyed by tool name) */
287
329
  extractedToolData?: Record<string, unknown[]>;
288
330
  /**
@@ -345,6 +387,8 @@ export interface SingleResult {
345
387
  /** Model's context window in tokens, when known. */
346
388
  contextWindow?: number;
347
389
  modelOverride?: string | string[];
390
+ /** What the router asked for on this child. See {@link TaskRoutingAttribution}. */
391
+ routing?: TaskRoutingAttribution;
348
392
  modelSubstitutionWarning?: ModelSubstitutionWarning;
349
393
  error?: string;
350
394
  aborted?: boolean;