@sayknow-cli/coding-agent 0.3.7 → 0.3.9

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 (272) hide show
  1. package/dist/types/append-only-mode.d.ts +31 -0
  2. package/dist/types/capability/rule.d.ts +8 -0
  3. package/dist/types/cli/completion-cli.d.ts +41 -0
  4. package/dist/types/cli/config-cli.d.ts +1 -0
  5. package/dist/types/cli/fixture-report.d.ts +20 -0
  6. package/dist/types/cli/fixture-report.test.d.ts +1 -0
  7. package/dist/types/cli/nofile-limit.d.ts +11 -0
  8. package/dist/types/cli/notify-cli.d.ts +7 -0
  9. package/dist/types/cli/update-cli.d.ts +22 -0
  10. package/dist/types/cli.d.ts +124 -1
  11. package/dist/types/commands/completion.d.ts +29 -0
  12. package/dist/types/commands/config.d.ts +3 -0
  13. package/dist/types/commands/deep-interview.d.ts +3 -0
  14. package/dist/types/config/file-lock.d.ts +7 -6
  15. package/dist/types/config/keybindings.d.ts +2 -2
  16. package/dist/types/config/model-profile-activation.d.ts +6 -0
  17. package/dist/types/config/model-profiles.d.ts +1 -0
  18. package/dist/types/config/settings-schema.d.ts +119 -1
  19. package/dist/types/config/settings.d.ts +8 -0
  20. package/dist/types/discovery/index.d.ts +1 -0
  21. package/dist/types/export/html/template.generated.d.ts +1 -1
  22. package/dist/types/export/ttsr.d.ts +14 -3
  23. package/dist/types/extensibility/extensions/runner.d.ts +2 -1
  24. package/dist/types/extensibility/extensions/types.d.ts +8 -0
  25. package/dist/types/goals/runtime.d.ts +1 -0
  26. package/dist/types/hooks/native-skill-hook.d.ts +12 -0
  27. package/dist/types/main.d.ts +4 -1
  28. package/dist/types/modes/components/assistant-message.d.ts +5 -1
  29. package/dist/types/modes/components/model-selector.d.ts +4 -0
  30. package/dist/types/modes/components/queued-message-selector.d.ts +12 -0
  31. package/dist/types/modes/components/settings-selector.d.ts +2 -0
  32. package/dist/types/modes/components/status-line.d.ts +9 -0
  33. package/dist/types/modes/components/thinking-selector.d.ts +2 -2
  34. package/dist/types/modes/controllers/command-controller.d.ts +1 -0
  35. package/dist/types/modes/controllers/event-controller.d.ts +5 -0
  36. package/dist/types/modes/controllers/input-controller.d.ts +1 -3
  37. package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
  38. package/dist/types/modes/interactive-mode.d.ts +4 -0
  39. package/dist/types/modes/print-mode.d.ts +13 -1
  40. package/dist/types/modes/prompt-action-autocomplete.d.ts +1 -1
  41. package/dist/types/modes/rpc/rpc-mode.d.ts +1 -3
  42. package/dist/types/modes/rpc/rpc-socket-security.d.ts +3 -0
  43. package/dist/types/modes/rpc/rpc-types.d.ts +14 -0
  44. package/dist/types/modes/shared/agent-wire/event-contract.d.ts +19 -0
  45. package/dist/types/modes/shared/agent-wire/event-envelope.d.ts +23 -1
  46. package/dist/types/modes/types.d.ts +3 -0
  47. package/dist/types/modes/utils/injected-user-submission.d.ts +52 -0
  48. package/dist/types/modes/utils/ui-helpers.d.ts +1 -0
  49. package/dist/types/notifications/config-commands.d.ts +9 -0
  50. package/dist/types/notifications/config.d.ts +30 -1
  51. package/dist/types/notifications/daemon-paths.d.ts +1 -0
  52. package/dist/types/notifications/index.d.ts +8 -3
  53. package/dist/types/notifications/lifecycle-commands.d.ts +12 -3
  54. package/dist/types/notifications/lifecycle-control-runtime.d.ts +2 -1
  55. package/dist/types/notifications/reply-sent-store.d.ts +53 -0
  56. package/dist/types/notifications/rich-draft.d.ts +68 -0
  57. package/dist/types/notifications/rich-render.d.ts +90 -0
  58. package/dist/types/notifications/telegram-daemon.d.ts +45 -3
  59. package/dist/types/notifications/telegram-reference.d.ts +7 -5
  60. package/dist/types/notifications/threaded-render.d.ts +14 -0
  61. package/dist/types/runtime-api-key.d.ts +7 -0
  62. package/dist/types/sdk.d.ts +3 -0
  63. package/dist/types/session/agent-session.d.ts +61 -6
  64. package/dist/types/session/agent-storage.d.ts +1 -0
  65. package/dist/types/session/file-mention-pruning.d.ts +8 -0
  66. package/dist/types/session/messages.d.ts +4 -0
  67. package/dist/types/session/session-manager.d.ts +17 -1
  68. package/dist/types/skc-runtime/deep-interview-ambiguity.d.ts +39 -0
  69. package/dist/types/skc-runtime/deep-interview-recorder.d.ts +10 -1
  70. package/dist/types/skc-runtime/deep-interview-state.d.ts +17 -2
  71. package/dist/types/skc-runtime/session-state-sidecar.d.ts +7 -0
  72. package/dist/types/skc-runtime/state-writer.d.ts +3 -0
  73. package/dist/types/skc-runtime/tmux-common.d.ts +1 -0
  74. package/dist/types/skc-runtime/ultragoal-receipt-freshness.d.ts +42 -0
  75. package/dist/types/skc-runtime/ultragoal-runtime.d.ts +120 -13
  76. package/dist/types/skill-state/active-state.d.ts +18 -1
  77. package/dist/types/system-prompt.d.ts +18 -2
  78. package/dist/types/task/executor.d.ts +3 -0
  79. package/dist/types/task/fork-context-budget.d.ts +7 -0
  80. package/dist/types/task/token-log.d.ts +30 -0
  81. package/dist/types/task/token-log.test.d.ts +1 -0
  82. package/dist/types/tools/bisect.d.ts +81 -0
  83. package/dist/types/tools/computer.d.ts +2 -2
  84. package/dist/types/tools/index.d.ts +1 -0
  85. package/dist/types/tools/search.d.ts +2 -2
  86. package/dist/types/tools/ultragoal-ask-guard.d.ts +9 -2
  87. package/dist/types/utils/file-mentions.d.ts +14 -0
  88. package/dist/types/utils/git.d.ts +32 -0
  89. package/dist/types/utils/pasted-image-path.d.ts +30 -0
  90. package/dist/types/web/scrapers/youtube.d.ts +8 -0
  91. package/dist/types/workflow/workflow-intent-diff.d.ts +8 -2
  92. package/dist/types/workflow/workflow-intent-report-consumer.d.ts +50 -0
  93. package/dist/types/workflow/workflow-intent-report-schema.d.ts +2 -0
  94. package/dist/types/workflow/workflow-intent-report.d.ts +48 -0
  95. package/package.json +8 -8
  96. package/src/append-only-mode.ts +58 -0
  97. package/src/autoresearch/prompt.md +1 -1
  98. package/src/autoresearch/tools/log-experiment.ts +1 -1
  99. package/src/capability/rule.ts +9 -0
  100. package/src/cli/completion-cli.ts +234 -0
  101. package/src/cli/config-cli.ts +61 -9
  102. package/src/cli/fast-help.ts +1 -0
  103. package/src/cli/fixture-report.test.ts +230 -0
  104. package/src/cli/fixture-report.ts +171 -0
  105. package/src/cli/nofile-limit.ts +48 -0
  106. package/src/cli/notify-cli.ts +103 -17
  107. package/src/cli/telegram-cli.ts +1 -1
  108. package/src/cli/update-cli.ts +148 -33
  109. package/src/cli.ts +29 -1
  110. package/src/commands/completion.ts +84 -0
  111. package/src/commands/config.ts +2 -0
  112. package/src/commands/contribution-prep.ts +1 -1
  113. package/src/commands/deep-interview.ts +2 -1
  114. package/src/config/file-lock.ts +73 -34
  115. package/src/config/keybindings.ts +3 -3
  116. package/src/config/model-profile-activation.ts +65 -0
  117. package/src/config/model-profiles.ts +31 -2
  118. package/src/config/settings-schema.ts +76 -1
  119. package/src/config/settings.ts +22 -0
  120. package/src/defaults/skc/skills/team/SKILL.md +17 -14
  121. package/src/defaults/skc/skills/ultragoal/SKILL.md +59 -4
  122. package/src/defaults/skc/skills/ultragoal/pipeline-validation-contracts.md +30 -0
  123. package/src/defaults/skc-defaults.ts +9 -0
  124. package/src/discovery/helpers.ts +10 -0
  125. package/src/discovery/index.ts +1 -0
  126. package/src/export/html/template.generated.ts +1 -1
  127. package/src/export/html/template.js +60 -2
  128. package/src/export/ttsr.ts +96 -18
  129. package/src/extensibility/extensions/runner.ts +183 -219
  130. package/src/extensibility/extensions/types.ts +9 -0
  131. package/src/extensibility/skc-plugins/runtime-adapters.ts +156 -44
  132. package/src/goals/runtime.ts +10 -2
  133. package/src/hindsight/backend.ts +1 -3
  134. package/src/hooks/native-skill-hook.ts +124 -4
  135. package/src/internal-urls/docs-index.generated.ts +17 -8
  136. package/src/lsp/client.ts +1 -0
  137. package/src/main.ts +95 -43
  138. package/src/memories/index.ts +12 -1
  139. package/src/modes/components/assistant-message.ts +241 -82
  140. package/src/modes/components/custom-editor.ts +1 -0
  141. package/src/modes/components/footer.ts +7 -2
  142. package/src/modes/components/model-selector.ts +54 -11
  143. package/src/modes/components/queued-message-selector.ts +92 -0
  144. package/src/modes/components/settings-selector.ts +4 -0
  145. package/src/modes/components/status-line.ts +167 -54
  146. package/src/modes/components/thinking-selector.ts +10 -8
  147. package/src/modes/components/tool-execution.ts +44 -19
  148. package/src/modes/components/welcome.ts +181 -44
  149. package/src/modes/controllers/command-controller.ts +40 -4
  150. package/src/modes/controllers/event-controller.ts +77 -49
  151. package/src/modes/controllers/extension-ui-controller.ts +12 -11
  152. package/src/modes/controllers/input-controller.ts +192 -35
  153. package/src/modes/controllers/selector-controller.ts +168 -24
  154. package/src/modes/interactive-mode.ts +56 -16
  155. package/src/modes/print-mode.ts +43 -4
  156. package/src/modes/prompt-action-autocomplete.ts +21 -20
  157. package/src/modes/rpc/rpc-mode.ts +32 -12
  158. package/src/modes/rpc/rpc-socket-security.ts +13 -1
  159. package/src/modes/rpc/rpc-types.ts +9 -0
  160. package/src/modes/shared/agent-wire/command-validation.ts +4 -0
  161. package/src/modes/shared/agent-wire/event-contract.ts +22 -0
  162. package/src/modes/shared/agent-wire/event-envelope.ts +82 -0
  163. package/src/modes/shared/agent-wire/scopes.ts +1 -0
  164. package/src/modes/types.ts +3 -0
  165. package/src/modes/utils/hotkeys-markdown.ts +1 -0
  166. package/src/modes/utils/injected-user-submission.ts +94 -0
  167. package/src/modes/utils/ui-helpers.ts +20 -7
  168. package/src/notifications/config-commands.ts +20 -0
  169. package/src/notifications/config.ts +52 -5
  170. package/src/notifications/daemon-paths.ts +2 -0
  171. package/src/notifications/index.ts +144 -18
  172. package/src/notifications/lifecycle-commands.ts +74 -23
  173. package/src/notifications/lifecycle-control-runtime.ts +8 -3
  174. package/src/notifications/lifecycle-orchestrator.ts +19 -6
  175. package/src/notifications/reply-sent-store.ts +134 -0
  176. package/src/notifications/rich-draft.ts +107 -0
  177. package/src/notifications/rich-render.ts +142 -0
  178. package/src/notifications/telegram-daemon-control.ts +5 -3
  179. package/src/notifications/telegram-daemon.ts +606 -98
  180. package/src/notifications/telegram-reference.ts +17 -16
  181. package/src/notifications/threaded-render.ts +45 -2
  182. package/src/prompts/agents/architect.md +19 -10
  183. package/src/prompts/agents/critic.md +16 -18
  184. package/src/prompts/agents/executor.md +14 -11
  185. package/src/prompts/agents/planner.md +18 -13
  186. package/src/prompts/ci-green-request.md +3 -8
  187. package/src/prompts/goals/goal-continuation.md +0 -5
  188. package/src/prompts/goals/goal-mode-active.md +0 -5
  189. package/src/prompts/system/agent-creation-architect.md +2 -2
  190. package/src/prompts/system/plan-mode-active.md +1 -1
  191. package/src/prompts/system/plan-mode-subagent.md +3 -3
  192. package/src/prompts/system/project-prompt.md +0 -13
  193. package/src/prompts/system/subagent-system-prompt.md +3 -2
  194. package/src/prompts/system/system-prompt.md +29 -17
  195. package/src/prompts/system/volatile-project-context.md +10 -0
  196. package/src/prompts/system/web-search.md +4 -7
  197. package/src/prompts/tools/apply-patch.md +6 -0
  198. package/src/prompts/tools/ast-edit.md +1 -0
  199. package/src/prompts/tools/bash.md +1 -1
  200. package/src/prompts/tools/bisect.md +22 -0
  201. package/src/prompts/tools/browser.md +1 -1
  202. package/src/prompts/tools/computer.md +2 -2
  203. package/src/prompts/tools/cron.md +0 -2
  204. package/src/prompts/tools/eval.md +2 -2
  205. package/src/prompts/tools/find.md +1 -1
  206. package/src/prompts/tools/github.md +6 -6
  207. package/src/prompts/tools/goal.md +1 -3
  208. package/src/prompts/tools/image-gen.md +12 -5
  209. package/src/prompts/tools/irc.md +5 -4
  210. package/src/prompts/tools/job.md +2 -2
  211. package/src/prompts/tools/lsp.md +1 -1
  212. package/src/prompts/tools/monitor.md +2 -2
  213. package/src/prompts/tools/patch.md +2 -2
  214. package/src/prompts/tools/replace.md +2 -21
  215. package/src/prompts/tools/rewind.md +1 -1
  216. package/src/prompts/tools/search-tool-bm25.md +6 -11
  217. package/src/prompts/tools/search.md +1 -1
  218. package/src/prompts/tools/skill.md +3 -2
  219. package/src/prompts/tools/ssh.md +2 -1
  220. package/src/prompts/tools/subagent.md +2 -2
  221. package/src/prompts/tools/task.md +4 -5
  222. package/src/prompts/tools/todo-write.md +1 -1
  223. package/src/prompts/tools/vim.md +1 -0
  224. package/src/prompts/tools/web-search.md +2 -0
  225. package/src/prompts/tools/write.md +8 -2
  226. package/src/runtime-api-key.ts +16 -0
  227. package/src/sdk.ts +88 -36
  228. package/src/session/agent-session.ts +1013 -141
  229. package/src/session/agent-storage.ts +4 -0
  230. package/src/session/file-mention-pruning.ts +64 -0
  231. package/src/session/messages.ts +4 -0
  232. package/src/session/session-manager.ts +103 -4
  233. package/src/skc-runtime/deep-interview-ambiguity.ts +206 -0
  234. package/src/skc-runtime/deep-interview-recorder.ts +62 -8
  235. package/src/skc-runtime/deep-interview-state.ts +44 -2
  236. package/src/skc-runtime/session-state-sidecar.ts +263 -20
  237. package/src/skc-runtime/state-runtime.ts +12 -2
  238. package/src/skc-runtime/state-writer.ts +15 -0
  239. package/src/skc-runtime/tmux-common.ts +1 -0
  240. package/src/skc-runtime/ultragoal-guard.ts +55 -66
  241. package/src/skc-runtime/ultragoal-receipt-freshness.ts +315 -0
  242. package/src/skc-runtime/ultragoal-runtime.ts +1672 -159
  243. package/src/skc-runtime/workflow-manifest.generated.json +113 -2
  244. package/src/skc-runtime/workflow-manifest.ts +74 -1
  245. package/src/skill-state/active-state.ts +141 -5
  246. package/src/skill-state/deep-interview-mutation-guard.ts +67 -3
  247. package/src/slash-commands/builtin-registry.ts +296 -72
  248. package/src/system-prompt.ts +57 -16
  249. package/src/task/executor.ts +132 -24
  250. package/src/task/fork-context-advisory.ts +2 -7
  251. package/src/task/fork-context-budget.ts +9 -0
  252. package/src/task/index.ts +13 -6
  253. package/src/task/output-manager.ts +20 -8
  254. package/src/task/receipt.ts +26 -7
  255. package/src/task/token-log.test.ts +188 -0
  256. package/src/task/token-log.ts +179 -0
  257. package/src/tools/bisect.ts +367 -0
  258. package/src/tools/computer.ts +246 -43
  259. package/src/tools/index.ts +3 -0
  260. package/src/tools/output-meta.ts +116 -4
  261. package/src/tools/search.ts +8 -2
  262. package/src/tools/skill.ts +15 -0
  263. package/src/tools/telegram-send.ts +6 -0
  264. package/src/tools/ultragoal-ask-guard.ts +39 -5
  265. package/src/utils/file-mentions.ts +39 -7
  266. package/src/utils/git.ts +73 -0
  267. package/src/utils/pasted-image-path.ts +170 -0
  268. package/src/web/scrapers/youtube.ts +24 -12
  269. package/src/workflow/workflow-intent-diff.ts +29 -6
  270. package/src/workflow/workflow-intent-report-consumer.ts +221 -0
  271. package/src/workflow/workflow-intent-report-schema.ts +129 -0
  272. package/src/workflow/workflow-intent-report.ts +135 -0
@@ -129,6 +129,10 @@ export interface FileMentionMessage {
129
129
  /** Why the file contents were omitted from auto-read. */
130
130
  skippedReason?: "tooLarge";
131
131
  image?: ImageContent;
132
+ /** Set when this mention duplicated a recently shown path (compact note, no full body). */
133
+ duplicate?: boolean;
134
+ /** Set when a stale entry was pruned to a digest notice (never silently deleted). */
135
+ pruned?: boolean;
132
136
  }>;
133
137
  timestamp: number;
134
138
  }
@@ -1,5 +1,6 @@
1
1
  import type { AgentMessage } from "@sayknow-cli/agent-core";
2
2
  import type { ImageContent, Message, MessageAttribution, ServiceTier, TextContent } from "@sayknow-cli/ai";
3
+ import type { TtsrInjectionRecord } from "../export/ttsr";
3
4
  import { ArtifactManager } from "./artifacts";
4
5
  import { type BlobPutResult, BlobStore } from "./blob-store";
5
6
  import { type BashExecutionMessage, type CustomMessage, type FileMentionMessage, type HookMessage, type PythonExecutionMessage } from "./messages";
@@ -141,6 +142,10 @@ export interface TtsrInjectionEntry extends SessionEntryBase {
141
142
  type: "ttsr_injection";
142
143
  /** Names of rules that were injected */
143
144
  injectedRules: string[];
145
+ /** Rich rule injection records with repeat state. */
146
+ injectedRuleRecords?: TtsrInjectionRecord[];
147
+ /** TTSR manager message count when this injection was recorded. */
148
+ ttsrMessageCount?: number;
144
149
  }
145
150
  /** Persisted MCP discovery selection state for a session branch. */
146
151
  export interface MCPToolSelectionEntry extends SessionEntryBase {
@@ -212,6 +217,10 @@ export interface SessionContext {
212
217
  models: Record<string, string>;
213
218
  /** Names of TTSR rules that have been injected this session */
214
219
  injectedTtsrRules: string[];
220
+ /** Rich TTSR rule injection records for repeat resume. */
221
+ injectedTtsrRuleRecords?: TtsrInjectionRecord[];
222
+ /** TTSR manager message count for repeat resume. */
223
+ ttsrMessageCount?: number;
215
224
  /** MCP tool names selected through discovery for this session branch. */
216
225
  selectedMCPToolNames: string[];
217
226
  /** Whether this branch contains an explicit persisted MCP selection entry. */
@@ -477,6 +486,13 @@ export declare class SessionManager {
477
486
  appendCompaction<T = unknown>(summary: string, shortSummary: string | undefined, firstKeptEntryId: string, tokensBefore: number, details?: T, fromExtension?: boolean, preserveData?: Record<string, unknown>): string;
478
487
  /** Append a custom entry (for extensions) as child of current leaf, then advance leaf. Returns entry id. */
479
488
  appendCustomEntry(customType: string, data?: unknown): string;
489
+ /**
490
+ * Append a root marker that starts a fresh active branch without changing the
491
+ * session id or deleting earlier durable entries. Subsequent messages descend
492
+ * from this marker, so provider context is clear while history remains
493
+ * available for diagnostics/export.
494
+ */
495
+ appendContextClearEntry(data?: Record<string, unknown>): string;
480
496
  /**
481
497
  * Write mutated message entries back into the canonical entry store by id.
482
498
  *
@@ -511,7 +527,7 @@ export declare class SessionManager {
511
527
  * @param ruleNames Names of rules that were injected
512
528
  * @returns Entry id
513
529
  */
514
- appendTtsrInjection(ruleNames: string[]): string;
530
+ appendTtsrInjection(ruleNames: string[], records?: TtsrInjectionRecord[], ttsrMessageCount?: number): string;
515
531
  /**
516
532
  * Get all unique TTSR rule names that have been injected in the current branch.
517
533
  * Scans from root to current leaf for ttsr_injection entries.
@@ -0,0 +1,39 @@
1
+ import { type DeepInterviewStateEnvelope } from "./deep-interview-state";
2
+ export interface AmbiguityFloorBreakdown {
3
+ floor: number;
4
+ disputed_fact_count: number;
5
+ unscored_active_component_count: number;
6
+ auto_answer_ratio: number;
7
+ }
8
+ export interface AmbiguityClampResult {
9
+ effective: number;
10
+ clamped: boolean;
11
+ }
12
+ /** Compute the deterministic floor from the inner deep-interview `state` object. */
13
+ export declare function computeAmbiguityFloor(inner: unknown): AmbiguityFloorBreakdown;
14
+ /** Clamp an LLM-reported ambiguity to the deterministic floor: `max(reported, floor)`. */
15
+ export declare function clampReportedAmbiguity(reported: number, floor: number): AmbiguityClampResult;
16
+ /**
17
+ * Mark every established fact recorded in `retractedRound` as disputed. This is the
18
+ * mechanical contradiction signal for answer retraction: when the user replaces an
19
+ * already-scored answer (A -> B pivot), the facts that answer established can no
20
+ * longer be trusted, so they raise the floor until re-confirmed or superseded.
21
+ * Returns new arrays/objects; never mutates the input.
22
+ */
23
+ export declare function disputeFactsFromRetractedRound(facts: readonly unknown[], retractedRound: number): {
24
+ facts: Record<string, unknown>[];
25
+ disputedIds: string[];
26
+ };
27
+ export interface AppliedAmbiguityFloor {
28
+ envelope: DeepInterviewStateEnvelope;
29
+ breakdown: AmbiguityFloorBreakdown;
30
+ clamped: boolean;
31
+ }
32
+ /**
33
+ * Enforce the floor invariant on a full deep-interview envelope: recompute the floor
34
+ * from persisted evidence, clamp `state.current_ambiguity`, and clamp the latest
35
+ * scored round (preserving the original value as `reported_ambiguity` for audit).
36
+ * Historical rounds are never rewritten. Idempotent and non-mutating; every writer
37
+ * (state CLI write/reconcile, recorder) applies this immediately before persisting.
38
+ */
39
+ export declare function applyAmbiguityFloorToEnvelope(value: unknown): AppliedAmbiguityFloor;
@@ -1,4 +1,5 @@
1
1
  import { type DeepInterviewEstablishedFact, type DeepInterviewRoundRecord, type DeepInterviewStateEnvelope, type DeepInterviewTriggerMetadata } from "./deep-interview-state";
2
+ export * from "./deep-interview-ambiguity";
2
3
  export * from "./deep-interview-state";
3
4
  /**
4
5
  * Runtime-owned deep-interview round recorder (conflict-aware scoring support).
@@ -86,12 +87,20 @@ export declare function projectCompactState(value: unknown, options?: {
86
87
  }): DeepInterviewCompactState;
87
88
  /** Refresh the best-effort HUD cache from persisted deep-interview state. */
88
89
  export declare function syncDeepInterviewRecorderHud(cwd: string, statePath: string, sessionId: string | undefined): Promise<void>;
89
- /** Record an `answered` shell for one round (append-or-merge by durable key). */
90
+ /**
91
+ * Record an `answered` shell for one round (append-or-merge by durable key).
92
+ *
93
+ * Retraction dynamics: replacing an already-`scored` answer is a mechanical
94
+ * contradiction signal (the user pivoted). The facts that round established are
95
+ * marked disputed, which raises the deterministic ambiguity floor immediately —
96
+ * without waiting for the LLM scorer to self-report a trigger.
97
+ */
90
98
  export declare function appendOrMergeDeepInterviewRound(cwd: string, statePath: string, input: DeepInterviewAnswerInput, options?: {
91
99
  sessionId?: string;
92
100
  }): Promise<{
93
101
  action: AppendOrMergeAction;
94
102
  record: DeepInterviewRoundRecord;
103
+ disputedFactIds?: string[];
95
104
  }>;
96
105
  /** Merge scoring output into the same round record, transitioning to `scored`. */
97
106
  export declare function enrichDeepInterviewRoundScoring(cwd: string, statePath: string, input: DeepInterviewScoringInput, options?: {
@@ -21,6 +21,13 @@ export interface DeepInterviewEstablishedFact {
21
21
  dimension?: string;
22
22
  evidence?: string;
23
23
  disputed: boolean;
24
+ /**
25
+ * Resolution pointer for a disputed fact: the id of the fact that replaced it
26
+ * after the user confirmed a pivot. A disputed fact without `superseded_by`
27
+ * keeps the deterministic ambiguity floor elevated; setting it releases the
28
+ * pressure while preserving the contradicted fact for audit.
29
+ */
30
+ superseded_by?: string;
24
31
  }
25
32
  export interface DeepInterviewTriggerMetadata {
26
33
  kind: DeepInterviewTriggerKind;
@@ -54,7 +61,12 @@ export interface DeepInterviewRoundRecord {
54
61
  answered_at: string;
55
62
  scored_at?: string;
56
63
  scores?: Record<string, number>;
64
+ /** Effective ambiguity after the deterministic floor clamp (`max(reported, floor)`). */
57
65
  ambiguity?: number;
66
+ /** Original LLM-reported ambiguity, preserved for audit when the floor clamped it. */
67
+ reported_ambiguity?: number;
68
+ /** Deterministic floor in effect when this round was scored, when it clamped. */
69
+ ambiguity_floor?: number;
58
70
  triggers?: DeepInterviewTriggerMetadata[];
59
71
  }
60
72
  export interface DeepInterviewStateEnvelope {
@@ -80,8 +92,11 @@ export declare function deriveRoundKey(interviewId: string | undefined, input: {
80
92
  * legacy flattened fields hoisted in losslessly, transcript duplicates removed
81
93
  * from the top level, and `rounds`/`established_facts` guaranteed to be arrays.
82
94
  *
83
- * Idempotent: a canonical envelope is returned unchanged in shape. Never deletes
84
- * unknown envelope or nested fields, and never mutates the input.
95
+ * Idempotent: a canonical envelope is returned unchanged in shape. Preserves all
96
+ * unknown envelope and nested fields except the envelope-reserved keys that leak
97
+ * into `state` (see `ENVELOPE_RESERVED_STATE_KEYS`), which are stripped so a
98
+ * malformed envelope-in-state write cannot permanently nest state. Never mutates
99
+ * the input.
85
100
  */
86
101
  export declare function normalizeDeepInterviewEnvelope(value: unknown): DeepInterviewStateEnvelope;
87
102
  /**
@@ -3,6 +3,11 @@ export declare const SKC_COORDINATOR_SESSION_STATE_FILE_ENV = "SKC_COORDINATOR_S
3
3
  export declare const SKC_COORDINATOR_SESSION_ID_ENV = "SKC_COORDINATOR_SESSION_ID";
4
4
  export declare const SKC_COORDINATOR_SESSION_BRANCH_ENV = "SKC_COORDINATOR_SESSION_BRANCH";
5
5
  export type RuntimeState = "ready_for_input" | "running" | "needs_user_input" | "completed" | "errored";
6
+ /** Test-only counters for runtime sidecar hot-path assertions. */
7
+ export declare const __sessionStateSidecarPerfCounters: {
8
+ persistFromEventCalls: number;
9
+ reset(): void;
10
+ };
6
11
  interface RuntimeStateEvent {
7
12
  type: string;
8
13
  messages?: unknown[];
@@ -26,6 +31,8 @@ export declare function readTerminalRuntimeStateMarker(input: {
26
31
  cwd?: string | null;
27
32
  sessionFile?: string | null;
28
33
  }): Promise<TerminalRuntimeStateStatus>;
34
+ export declare function stateForEvent(event: RuntimeStateEvent): RuntimeState | null;
35
+ export declare function eventAffectsCoordinatorRuntimeState(event: RuntimeStateEvent): boolean;
29
36
  export declare function persistCoordinatorRuntimeStateFromEvent(event: RuntimeStateEvent, context: RuntimeStateContext): Promise<void>;
30
37
  export declare function persistCoordinatorRuntimeStateFromPostmortem(reason: postmortem.Reason, context: RuntimeStateContext): void;
31
38
  export declare function registerCoordinatorRuntimeStateFinalizer(context: RuntimeStateContext): () => void;
@@ -142,6 +142,8 @@ export declare function readExistingStateForMutation(filePath: string): Promise<
142
142
  export declare function workflowEnvelopeContentSha256(value: unknown): string;
143
143
  export declare function stampWorkflowEnvelopeChecksum<T>(value: T, filePath: string, computedAt?: string): T;
144
144
  export declare function detectWorkflowEnvelopeIntegrityMismatch(filePath: string): Promise<WorkflowEnvelopeIntegrityMismatch | undefined>;
145
+ type ActiveStateCacheInvalidator = (cwd?: string, sessionId?: string) => void;
146
+ export declare function setActiveStateCacheInvalidator(invalidator: ActiveStateCacheInvalidator): void;
145
147
  export declare function persistedStateRevision(value: unknown): number;
146
148
  export declare function writeGuardedJsonAtomic(targetPath: string, value: unknown, options: GuardedStateWriterOptions): Promise<GuardedWriteResult>;
147
149
  export declare function writeGuardedWorkflowEnvelopeAtomic(targetPath: string, value: unknown, options: GuardedStateWriterOptions): Promise<GuardedWriteResult>;
@@ -239,3 +241,4 @@ export declare function beginWorkflowTransactionJournal(input: {
239
241
  }): Promise<string>;
240
242
  export declare function updateWorkflowTransactionJournal(cwd: string, sessionId: string, mutationId: string, patch: Partial<WorkflowTransactionJournal>): Promise<string>;
241
243
  export declare function completeWorkflowTransactionJournal(cwd: string, sessionId: string, mutationId: string): Promise<void>;
244
+ export {};
@@ -2,6 +2,7 @@ import type { ResolvedTmuxBinary } from "./psmux-detect";
2
2
  export declare const SKC_DEFAULT_TMUX_SESSION = "sayknow_cli";
3
3
  export declare const SKC_TMUX_SESSION_PREFIX = "sayknow_cli_";
4
4
  export declare const SKC_TMUX_COMMAND_ENV = "SKC_TMUX_COMMAND";
5
+ export declare const SKC_TMUX_ACTIVE_SESSION_ENV = "SKC_TMUX_ACTIVE_SESSION";
5
6
  export declare const SKC_TMUX_PROFILE_ENV = "SKC_TMUX_PROFILE";
6
7
  export declare const SKC_TMUX_MOUSE_ENV = "SKC_MOUSE";
7
8
  export declare const SKC_TMUX_PROFILE_OPTION = "@skc-profile";
@@ -0,0 +1,42 @@
1
+ import type { UltragoalCompletionVerification, UltragoalGoal, UltragoalGoalStatus, UltragoalLedgerEvent, UltragoalPlan, UltragoalReceiptKind } from "./ultragoal-runtime";
2
+ export type UltragoalReceiptFreshnessDiagnostic = {
3
+ state: "inactive" | "unrelated_goal" | "active_verified_complete" | "active_missing_receipt" | "active_stale_receipt" | "active_missing_final_receipt" | "active_dirty_quality_gate" | "active_review_blocked_unrecorded" | "active_review_blocked_recorded" | "unreadable_fail_closed";
4
+ message: string;
5
+ goalId?: string;
6
+ };
7
+ export declare function requiredUltragoalGoals(plan: UltragoalPlan): UltragoalGoal[];
8
+ export declare function receiptRelevantGoals(plan: UltragoalPlan, goal: UltragoalGoal, receiptKind: UltragoalReceiptKind): UltragoalGoal[];
9
+ export declare function computeUltragoalPlanGeneration(input: {
10
+ plan: UltragoalPlan;
11
+ ledger: readonly UltragoalLedgerEvent[];
12
+ goal: UltragoalGoal;
13
+ receiptKind: UltragoalReceiptKind;
14
+ beforeStatus: UltragoalGoalStatus;
15
+ excludeEventId?: string;
16
+ targetGoalUpdatedAt?: string;
17
+ }): {
18
+ planGeneration: string;
19
+ basis: UltragoalCompletionVerification["basis"];
20
+ };
21
+ export declare function findLedgerReceiptEvent(ledger: readonly UltragoalLedgerEvent[], receipt: UltragoalCompletionVerification): UltragoalLedgerEvent | null;
22
+ export declare function validateReceiptFreshBase(input: {
23
+ plan: UltragoalPlan;
24
+ ledger: readonly UltragoalLedgerEvent[];
25
+ goal: UltragoalGoal;
26
+ receipt: UltragoalCompletionVerification;
27
+ receiptKind: UltragoalReceiptKind;
28
+ }): UltragoalReceiptFreshnessDiagnostic | null;
29
+ export declare function findFreshBatchCloseReceipt(input: {
30
+ plan: UltragoalPlan;
31
+ ledger: readonly UltragoalLedgerEvent[];
32
+ deferredGoal: UltragoalGoal;
33
+ deferredReceipt: UltragoalCompletionVerification;
34
+ }): UltragoalCompletionVerification | null;
35
+ export declare function validateDeferredMemberReceiptFresh(input: {
36
+ plan: UltragoalPlan;
37
+ ledger: readonly UltragoalLedgerEvent[];
38
+ goal: UltragoalGoal;
39
+ receipt: UltragoalCompletionVerification;
40
+ receiptKind: UltragoalReceiptKind;
41
+ requireClose: boolean;
42
+ }): UltragoalReceiptFreshnessDiagnostic;
@@ -1,6 +1,77 @@
1
1
  import type { WorkflowHudSummary } from "../skill-state/active-state";
2
+ export { computeUltragoalPlanGeneration, receiptRelevantGoals } from "./ultragoal-receipt-freshness";
2
3
  export type UltragoalSkcGoalMode = "aggregate" | "per-story";
3
4
  export type UltragoalGoalStatus = "pending" | "active" | "complete" | "failed" | "blocked" | "review_blocked" | "superseded";
5
+ export type UltragoalPipelineMetadataSource = "original_plan_graph" | "legacy_brief_only" | "steering";
6
+ export type UltragoalPipelineOverlapState = "none" | "open" | "joined_clean" | "blocked_disjoint_continue" | "quarantine_required" | "rebaseline_complete";
7
+ export interface UltragoalPipelineTargets extends JsonObject {
8
+ files: string[];
9
+ surfaces: string[];
10
+ }
11
+ export interface UltragoalPipelineMetadata extends JsonObject {
12
+ schemaVersion: 1;
13
+ goalId: string;
14
+ source: UltragoalPipelineMetadataSource;
15
+ eligible: boolean;
16
+ dependsOn: string[];
17
+ independentOf: string[];
18
+ targets: UltragoalPipelineTargets;
19
+ metadataHash: string;
20
+ overlap: UltragoalPipelineOverlapState;
21
+ overlapId?: string;
22
+ priorGoalId?: string;
23
+ nextGoalId?: string;
24
+ blockerFootprints?: UltragoalPipelineTargets[];
25
+ invalidationReason?: string;
26
+ invalidatedAt?: string;
27
+ }
28
+ export interface UltragoalGoalMetadataInput {
29
+ schemaVersion: 1;
30
+ goalId: string;
31
+ source: UltragoalPipelineMetadataSource;
32
+ dependsOn?: string[];
33
+ independentOf?: string[];
34
+ targets?: Partial<UltragoalPipelineTargets>;
35
+ }
36
+ export interface UltragoalValidationBatchMetadata extends JsonObject {
37
+ schemaVersion: 1;
38
+ batchId: string;
39
+ memberIds: string[];
40
+ finalGoalId: string;
41
+ mode: "aggregate-only";
42
+ metadataHash: string;
43
+ }
44
+ export interface UltragoalValidationBatchInput {
45
+ schemaVersion: 1;
46
+ batchId: string;
47
+ memberIds: string[];
48
+ finalGoalId: string;
49
+ }
50
+ export interface UltragoalPipelineOverlapHandles extends JsonObject {
51
+ review: JsonObject;
52
+ qa: JsonObject;
53
+ implementation: JsonObject;
54
+ }
55
+ export interface UltragoalPipelineOverlapReceipt extends JsonObject {
56
+ ok: true;
57
+ event: string;
58
+ overlap_id: string;
59
+ prior_goal_id: string;
60
+ next_goal_id?: string;
61
+ goal_id?: string;
62
+ status?: UltragoalPipelineOverlapState;
63
+ next_goal_status?: UltragoalGoalStatus;
64
+ goals_path: string;
65
+ ledger_path: string;
66
+ }
67
+ export type UltragoalPipelineLedgerEventName = "pipeline_overlap_started" | "pipeline_overlap_joined" | "pipeline_overlap_blocked" | "pipeline_overlap_quarantined" | "pipeline_overlap_rebaselined";
68
+ export interface UltragoalPipelineLedgerEvent extends UltragoalLedgerEvent {
69
+ event: UltragoalPipelineLedgerEventName;
70
+ schemaVersion: 1;
71
+ overlapId: string;
72
+ priorGoalId: string;
73
+ nextGoalId: string;
74
+ }
4
75
  export interface UltragoalGoal {
5
76
  id: string;
6
77
  title: string;
@@ -13,6 +84,8 @@ export interface UltragoalGoal {
13
84
  evidence?: string;
14
85
  steering?: Record<string, unknown>;
15
86
  completionVerification?: UltragoalCompletionVerification;
87
+ pipelineMetadata?: UltragoalPipelineMetadata;
88
+ validationBatch?: UltragoalValidationBatchMetadata;
16
89
  }
17
90
  export interface UltragoalPlan {
18
91
  version: 1;
@@ -45,6 +118,26 @@ export interface UltragoalCompletionVerification {
45
118
  requiredGoalSetHashBeforeCheckpoint: string;
46
119
  };
47
120
  checkpointLedgerEventId: string;
121
+ validationBatch?: {
122
+ schemaVersion: 1;
123
+ role: "deferred-member";
124
+ batchId: string;
125
+ memberIds: string[];
126
+ finalGoalId: string;
127
+ metadataHash: string;
128
+ changeSetHash: string;
129
+ } | {
130
+ schemaVersion: 1;
131
+ role: "batch-close";
132
+ batchId: string;
133
+ memberIds: string[];
134
+ finalGoalId: string;
135
+ memberMetadataHashes: Record<string, string>;
136
+ memberReceiptIds: Record<string, string>;
137
+ memberCheckpointLedgerEventIds: Record<string, string>;
138
+ memberChangeSetHashes: Record<string, string>;
139
+ unionHash: string;
140
+ };
48
141
  }
49
142
  export interface UltragoalLedgerEvent extends JsonObject {
50
143
  eventId?: string;
@@ -106,6 +199,7 @@ export interface UltragoalStatusSummary {
106
199
  nudgeRemaining?: number;
107
200
  nudgeGoalId?: string;
108
201
  nudgeTargetKind?: UltragoalNudgeTargetKind;
202
+ pipelineOverlap?: JsonObject;
109
203
  }
110
204
  export interface UltragoalCommandResult {
111
205
  reviewBlockerGoalIds?: string[];
@@ -161,18 +255,6 @@ export declare function recordUltragoalNudgeIfBudgetRemaining(input: {
161
255
  reason: string;
162
256
  currentGoalObjective?: string;
163
257
  }): Promise<UltragoalNudgeOutcome>;
164
- export declare function computeUltragoalPlanGeneration(input: {
165
- plan: UltragoalPlan;
166
- ledger: readonly UltragoalLedgerEvent[];
167
- goal: UltragoalGoal;
168
- receiptKind: UltragoalReceiptKind;
169
- beforeStatus: UltragoalGoalStatus;
170
- excludeEventId?: string;
171
- targetGoalUpdatedAt?: string;
172
- }): {
173
- planGeneration: string;
174
- basis: UltragoalCompletionVerification["basis"];
175
- };
176
258
  export declare function readUltragoalPlan(cwd: string, sessionId?: string | null): Promise<UltragoalPlan | null>;
177
259
  export declare function getUltragoalStatus(cwd: string, sessionId?: string | null): Promise<UltragoalStatusSummary>;
178
260
  export declare function buildUltragoalHudSummary(summary: UltragoalStatusSummary, latestLedger?: UltragoalLedgerEvent): WorkflowHudSummary;
@@ -181,6 +263,10 @@ export declare function createUltragoalPlan(input: {
181
263
  brief: string;
182
264
  skcGoalMode?: UltragoalSkcGoalMode;
183
265
  sessionId?: string | null;
266
+ goalMetadata?: UltragoalGoalMetadataInput[];
267
+ goalMetadataJson?: string;
268
+ validationBatches?: UltragoalValidationBatchInput[];
269
+ validationBatchJson?: string;
184
270
  }): Promise<UltragoalPlan>;
185
271
  export interface UltragoalRunCompletionState {
186
272
  requiredGoals: UltragoalGoal[];
@@ -190,6 +276,27 @@ export interface UltragoalRunCompletionState {
190
276
  hasBlockers: boolean;
191
277
  needsFinalAggregateReceipt: boolean;
192
278
  }
279
+ export declare function startUltragoalPipelineOverlap(input: {
280
+ cwd: string;
281
+ priorGoalId: string;
282
+ nextGoalId: string;
283
+ reviewHandles: JsonObject | JsonObject[];
284
+ qaHandles: JsonObject | JsonObject[];
285
+ implementationHandle: JsonObject;
286
+ }): Promise<UltragoalPipelineOverlapReceipt>;
287
+ export declare function joinUltragoalPipelineOverlap(input: {
288
+ cwd: string;
289
+ overlapId: string;
290
+ reviewResult: JsonObject;
291
+ qaResult: JsonObject;
292
+ }): Promise<UltragoalPipelineOverlapReceipt>;
293
+ export declare function rebaselineUltragoalPipelineOverlap(input: {
294
+ cwd: string;
295
+ overlapId: string;
296
+ goalId: string;
297
+ evidence: string;
298
+ targetState: JsonObject;
299
+ }): Promise<UltragoalPipelineOverlapReceipt>;
193
300
  export declare function getUltragoalRunCompletionState(plan: UltragoalPlan, options?: {
194
301
  retryFailed?: boolean;
195
302
  }): UltragoalRunCompletionState;
@@ -218,6 +325,7 @@ interface UltragoalChangeSet extends JsonObject {
218
325
  mergeBase?: string;
219
326
  paths: UltragoalChangeSetPath[];
220
327
  rawDiffStat?: string;
328
+ rawDiff?: string;
221
329
  trusted: true;
222
330
  }
223
331
  export declare function normalizeSurfaceToken(value: string): string;
@@ -300,4 +408,3 @@ interface UltragoalReviewResult extends JsonObject {
300
408
  export declare function resolveGitBase(cwd: string, branch?: string): Promise<string>;
301
409
  export declare function runUltragoalReview(cwd: string, args: readonly string[]): Promise<UltragoalReviewResult>;
302
410
  export declare function runNativeUltragoalCommand(args: string[], cwd?: string): Promise<UltragoalCommandResult>;
303
- export {};
@@ -92,7 +92,24 @@ export declare function listActiveSkills(raw: unknown): SkillActiveEntry[];
92
92
  export declare function normalizeSkillActiveState(raw: unknown): SkillActiveState | null;
93
93
  export declare function getSkillActiveStatePaths(cwd: string, sessionId?: string): SkillActiveStatePaths;
94
94
  export declare function collapsePlanningPipeline(entries: readonly SkillActiveEntry[]): SkillActiveEntry[];
95
- export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string): Promise<SkillActiveState | null>;
95
+ export type VisibleSkillActiveStateCacheTier = "security" | "hud";
96
+ export interface ReadVisibleSkillActiveStateOptions {
97
+ tier?: VisibleSkillActiveStateCacheTier;
98
+ }
99
+ interface ActiveStateStatSignature {
100
+ path: string;
101
+ mtimeMs: number;
102
+ size: number;
103
+ }
104
+ interface ActiveStateSignature {
105
+ sessionPath: ActiveStateStatSignature | null;
106
+ activeDir: ActiveStateStatSignature | null;
107
+ activeEntries: ActiveStateStatSignature[];
108
+ ralplanModeState: ActiveStateStatSignature | null;
109
+ }
110
+ export declare function computeActiveStateSignature(cwd: string, sessionId: string): Promise<ActiveStateSignature>;
111
+ export declare function invalidateVisibleSkillActiveStateCache(cwd?: string, sessionId?: string): void;
112
+ export declare function readVisibleSkillActiveState(cwd: string, sessionId?: string, opts?: ReadVisibleSkillActiveStateOptions): Promise<SkillActiveState | null>;
96
113
  export declare function syncSkillActiveState(options: SyncSkillActiveStateOptions): Promise<void>;
97
114
  export interface ApplyHandoffOptions {
98
115
  cwd: string;
@@ -17,9 +17,12 @@ export interface LoadContextFilesOptions {
17
17
  cwd?: string;
18
18
  }
19
19
  /**
20
- * Load all project context files using the capability API.
20
+ * Load all context files using the capability API.
21
21
  * Returns {path, content, depth} entries for all discovered context files.
22
- * Files are sorted by depth (descending) so files closer to cwd appear last/more prominent.
22
+ * Native user-global files (`~/.skc/agent/AGENTS.md`) come first, then project
23
+ * files sorted by depth (descending) so files closer to cwd appear last/more
24
+ * prominent. User-home files from foreign providers (`~/.claude/CLAUDE.md`,
25
+ * `~/.codex/AGENTS.md`, …) stay excluded — only skc's own user config applies.
23
26
  */
24
27
  export declare function loadProjectContextFiles(options?: LoadContextFilesOptions): Promise<Array<{
25
28
  path: string;
@@ -91,12 +94,25 @@ export interface BuildSystemPromptOptions {
91
94
  secretsEnabled?: boolean;
92
95
  /** Pre-loaded workspace tree (skips discovery if provided). May be a Promise to allow early kick-off. */
93
96
  workspaceTree?: WorkspaceTree | Promise<WorkspaceTree>;
97
+ /**
98
+ * Render a trimmed role-agent base prompt for subagent sessions: omits the
99
+ * workflow-surface/routing/self-awareness (`<skc-runtime>`) and `<soul>` blocks
100
+ * that only apply to the top-level interactive/print agent. Tool safety, repo
101
+ * safety, and the completion contract are retained. Default: false.
102
+ */
103
+ subagent?: boolean;
94
104
  }
95
105
  /** Result of building provider-facing system prompt messages. */
96
106
  export interface BuildSystemPromptResult {
97
107
  /** Ordered system prompt blocks. Providers should preserve entries as distinct messages/blocks. */
98
108
  systemPrompt: string[];
99
109
  }
110
+ export interface BuildVolatileProjectContextOptions {
111
+ cwd?: string;
112
+ date?: string;
113
+ workspaceTree?: WorkspaceTree;
114
+ }
115
+ export declare function buildVolatileProjectContext(options?: BuildVolatileProjectContextOptions): string;
100
116
  /** Build the system prompt with tools, guidelines, and context */
101
117
  export declare function buildSystemPrompt(options?: BuildSystemPromptOptions): Promise<BuildSystemPromptResult>;
102
118
  export {};
@@ -51,6 +51,8 @@ export interface ExecutorOptions {
51
51
  artifactsDir?: string;
52
52
  /** Path to parent conversation context file */
53
53
  contextFile?: string;
54
+ /** Whether the parent runtime actually exposes IRC coordination. */
55
+ ircAvailable?: boolean;
54
56
  eventBus?: EventBus;
55
57
  contextFiles?: ContextFileEntry[];
56
58
  skills?: Skill[];
@@ -112,6 +114,7 @@ interface FinalizeSubprocessOutputResult {
112
114
  }
113
115
  export declare const SUBAGENT_WARNING_NULL_YIELD = "SYSTEM WARNING: Subagent called yield with null data.";
114
116
  export declare const SUBAGENT_WARNING_MISSING_YIELD = "SYSTEM WARNING: Subagent exited without calling yield tool after 3 reminders.";
117
+ export declare const SUBAGENT_WARNING_PLACEHOLDER_YIELD = "SYSTEM WARNING: Subagent yield data contains a placeholder instead of the actual result.";
115
118
  export declare function finalizeSubprocessOutput(args: FinalizeSubprocessOutputArgs): FinalizeSubprocessOutputResult;
116
119
  export declare function createSubagentSettings(baseSettings: Settings, inheritedServiceTier?: ServiceTier): Settings;
117
120
  /**
@@ -0,0 +1,7 @@
1
+ export declare const FORK_CONTEXT_TOKEN_BUDGET_BY_MODE: {
2
+ readonly none: 0;
3
+ readonly receipt: 2000;
4
+ readonly "last-turn": 4000;
5
+ readonly bounded: 8000;
6
+ readonly full: 15000;
7
+ };
@@ -0,0 +1,30 @@
1
+ import type { ChatUsageSnapshot, CostEstimate } from "@sayknow-cli/agent-core";
2
+ import type { TaskTokenLog, TaskTokenMetrics } from "./types";
3
+ export interface TaskTokenLogChatBuckets {
4
+ readonly inputTokens: number;
5
+ readonly outputTokens: number;
6
+ readonly cachedInputTokens: number;
7
+ readonly cacheWriteTokens: number;
8
+ readonly costUsd?: number;
9
+ }
10
+ export interface TaskTokenLogSessionManager {
11
+ getSessionId(): string;
12
+ }
13
+ export interface TaskTokenLogContext {
14
+ readonly subagentId: string;
15
+ readonly agent?: string;
16
+ readonly turn: number;
17
+ readonly at: string;
18
+ readonly model?: string;
19
+ }
20
+ export declare function taskTokenLogFromChat(chat: TaskTokenLogChatBuckets, ctx: TaskTokenLogContext): TaskTokenLog;
21
+ export declare function taskTokenLogFromUsage(usage: ChatUsageSnapshot, ctx: TaskTokenLogContext & {
22
+ readonly cost?: CostEstimate;
23
+ }): TaskTokenLog;
24
+ export declare function resolveTaskTokenLogDir(cwd: string, sessionManager: TaskTokenLogSessionManager | undefined, envSessionId?: string | undefined): Promise<string | undefined>;
25
+ export declare function persistTaskTokenLog(entry: TaskTokenLog, opts: {
26
+ dir: string;
27
+ }): Promise<void>;
28
+ export declare function readTaskTokenLogs(dir: string): Promise<TaskTokenLog[]>;
29
+ export declare function computeTaskTokenMetrics(logs: readonly TaskTokenLog[]): TaskTokenMetrics;
30
+ export declare function computeCacheHitRate(input: number, cacheRead: number): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,81 @@
1
+ import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@sayknow-cli/agent-core";
2
+ import * as z from "zod/v4";
3
+ import type { ToolSession } from ".";
4
+ import type { OutputMeta } from "./output-meta";
5
+ declare const bisectSchema: z.ZodObject<{
6
+ good: z.ZodString;
7
+ bad: z.ZodDefault<z.ZodString>;
8
+ run: z.ZodString;
9
+ invert: z.ZodDefault<z.ZodBoolean>;
10
+ maxSteps: z.ZodDefault<z.ZodNumber>;
11
+ stepTimeoutMs: z.ZodDefault<z.ZodNumber>;
12
+ }, z.core.$strip>;
13
+ type BisectParams = z.infer<typeof bisectSchema>;
14
+ export type BisectVerdict = "good" | "bad" | "skip";
15
+ export interface BisectStep {
16
+ rev: string;
17
+ verdict: BisectVerdict;
18
+ }
19
+ export interface BisectMarkResult {
20
+ exitCode: number;
21
+ output: string;
22
+ }
23
+ export interface BisectControllerDeps {
24
+ maxSteps: number;
25
+ /** SHA of the revision git currently has checked out. */
26
+ currentRev: () => Promise<string>;
27
+ /** Evaluate the predicate at the checked-out revision. */
28
+ evaluate: (rev: string) => Promise<BisectVerdict>;
29
+ /** Apply the verdict via `git bisect good|bad|skip` and return the raw result. */
30
+ mark: (verdict: BisectVerdict) => Promise<BisectMarkResult>;
31
+ }
32
+ export interface BisectOutcome {
33
+ culprit: string | null;
34
+ steps: BisectStep[];
35
+ concluded: boolean;
36
+ reason?: string;
37
+ }
38
+ export interface BisectToolDetails {
39
+ meta?: OutputMeta;
40
+ culprit: string | null;
41
+ invert: boolean;
42
+ concluded: boolean;
43
+ steps: BisectStep[];
44
+ author?: string;
45
+ date?: string;
46
+ subject?: string;
47
+ reason?: string;
48
+ }
49
+ /** Parse the culprit SHA from `git bisect good|bad` output, or null when not yet converged. */
50
+ export declare function parseFirstBadCommit(output: string): string | null;
51
+ /**
52
+ * Map a predicate exit code to a bisect verdict. `invert` swaps the good/bad
53
+ * mapping (to hunt for a fixing commit) but never reinterprets a skip.
54
+ */
55
+ export declare function classifyExit(exitCode: number, invert: boolean): BisectVerdict;
56
+ /**
57
+ * Drive the bisect loop. Pure orchestration — every git/predicate effect is
58
+ * injected — so it can be exercised deterministically without a real repo.
59
+ */
60
+ export declare function runBisectController(deps: BisectControllerDeps, signal?: AbortSignal): Promise<BisectOutcome>;
61
+ export declare class BisectTool implements AgentTool<typeof bisectSchema, BisectToolDetails> {
62
+ private readonly session;
63
+ readonly name = "bisect";
64
+ readonly label = "Bisect";
65
+ readonly summary = "Find the commit that introduced a regression by driving git bisect with a shell predicate";
66
+ readonly description: string;
67
+ readonly parameters: z.ZodObject<{
68
+ good: z.ZodString;
69
+ bad: z.ZodDefault<z.ZodString>;
70
+ run: z.ZodString;
71
+ invert: z.ZodDefault<z.ZodBoolean>;
72
+ maxSteps: z.ZodDefault<z.ZodNumber>;
73
+ stepTimeoutMs: z.ZodDefault<z.ZodNumber>;
74
+ }, z.core.$strip>;
75
+ readonly strict = true;
76
+ readonly loadMode = "discoverable";
77
+ readonly intent: (args: Partial<BisectParams>) => string;
78
+ constructor(session: ToolSession);
79
+ execute(_toolCallId: string, params: BisectParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<BisectToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<BisectToolDetails>>;
80
+ }
81
+ export {};