@sayknow-cli/coding-agent 0.3.1 → 0.3.2

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 (170) hide show
  1. package/bin/skc.js +4 -0
  2. package/dist/types/cli/mcp-cli.d.ts +25 -0
  3. package/dist/types/cli/plugin-cli.d.ts +2 -0
  4. package/dist/types/cli.d.ts +6 -0
  5. package/dist/types/commands/mcp.d.ts +70 -0
  6. package/dist/types/commands/plugin.d.ts +6 -0
  7. package/dist/types/commands/session.d.ts +6 -0
  8. package/dist/types/config/keybindings.d.ts +2 -2
  9. package/dist/types/config/model-profile-activation.d.ts +8 -1
  10. package/dist/types/config/settings-schema.d.ts +1 -59
  11. package/dist/types/deep-interview/plaintext-gate-guard.d.ts +11 -0
  12. package/dist/types/extensibility/skc-plugins/compiler.d.ts +19 -0
  13. package/dist/types/extensibility/skc-plugins/constrained-hooks.d.ts +29 -0
  14. package/dist/types/extensibility/skc-plugins/index.d.ts +9 -0
  15. package/dist/types/extensibility/skc-plugins/injection.d.ts +9 -0
  16. package/dist/types/extensibility/skc-plugins/installer.d.ts +13 -0
  17. package/dist/types/extensibility/skc-plugins/mcp-policy.d.ts +26 -0
  18. package/dist/types/extensibility/skc-plugins/observability.d.ts +27 -0
  19. package/dist/types/extensibility/skc-plugins/prompt-appendix.d.ts +16 -0
  20. package/dist/types/extensibility/skc-plugins/registry.d.ts +32 -0
  21. package/dist/types/extensibility/skc-plugins/runtime-adapters.d.ts +64 -0
  22. package/dist/types/extensibility/skc-plugins/session-validation.d.ts +42 -0
  23. package/dist/types/extensibility/skc-plugins/types.d.ts +158 -2
  24. package/dist/types/extensibility/skc-plugins/validation.d.ts +8 -1
  25. package/dist/types/i18n/messages/en.d.ts +0 -1
  26. package/dist/types/main.d.ts +2 -0
  27. package/dist/types/modes/components/custom-editor.d.ts +1 -1
  28. package/dist/types/modes/components/model-selector.d.ts +8 -0
  29. package/dist/types/modes/components/settings-defs.d.ts +0 -1
  30. package/dist/types/modes/components/status-line/git-utils.d.ts +6 -0
  31. package/dist/types/modes/theme/defaults/index.d.ts +99 -0
  32. package/dist/types/modes/theme/theme.d.ts +1 -1
  33. package/dist/types/notifications/html-format.d.ts +11 -0
  34. package/dist/types/notifications/index.d.ts +149 -1
  35. package/dist/types/notifications/lifecycle-commands.d.ts +60 -0
  36. package/dist/types/notifications/lifecycle-control-runtime.d.ts +98 -0
  37. package/dist/types/notifications/lifecycle-orchestrator.d.ts +144 -0
  38. package/dist/types/notifications/operator-runtime.d.ts +52 -0
  39. package/dist/types/notifications/rate-limit-pool.d.ts +2 -0
  40. package/dist/types/notifications/recent-activity.d.ts +35 -0
  41. package/dist/types/notifications/telegram-daemon.d.ts +114 -16
  42. package/dist/types/notifications/telegram-reference.d.ts +3 -1
  43. package/dist/types/notifications/topic-registry.d.ts +12 -9
  44. package/dist/types/runtime-mcp/types.d.ts +7 -0
  45. package/dist/types/sdk.d.ts +2 -0
  46. package/dist/types/session/agent-session.d.ts +14 -4
  47. package/dist/types/session/blob-store.d.ts +25 -0
  48. package/dist/types/session/session-manager.d.ts +57 -0
  49. package/dist/types/skc-runtime/launch-tmux.d.ts +1 -0
  50. package/dist/types/skc-runtime/psmux-detect.d.ts +78 -0
  51. package/dist/types/skc-runtime/team-runtime.d.ts +2 -0
  52. package/dist/types/skc-runtime/tmux-common.d.ts +30 -2
  53. package/dist/types/skc-runtime/tmux-sessions.d.ts +18 -0
  54. package/dist/types/slash-commands/helpers/fast-status-report.d.ts +6 -0
  55. package/dist/types/system-prompt.d.ts +2 -0
  56. package/dist/types/task/executor.d.ts +9 -1
  57. package/dist/types/tools/composer-bash-policy.d.ts +14 -0
  58. package/dist/types/tools/index.d.ts +3 -1
  59. package/dist/types/utils/changelog.d.ts +1 -0
  60. package/dist/types/web/insane/url-guard.d.ts +6 -3
  61. package/dist/types/web/scrapers/types.d.ts +5 -0
  62. package/dist/types/web/scrapers/utils.d.ts +7 -1
  63. package/package.json +11 -9
  64. package/scripts/g004-tmux-smoke.ts +100 -0
  65. package/scripts/g005-daemon-smoke.ts +180 -0
  66. package/scripts/g011-daemon-path-smoke.ts +153 -0
  67. package/src/cli/fast-help.ts +29 -1
  68. package/src/cli/mcp-cli.ts +272 -0
  69. package/src/cli/plugin-cli.ts +66 -3
  70. package/src/cli.ts +30 -12
  71. package/src/commands/mcp.ts +117 -0
  72. package/src/commands/plugin.ts +4 -0
  73. package/src/commands/session.ts +18 -0
  74. package/src/config/keybindings.ts +2 -2
  75. package/src/config/model-profile-activation.ts +55 -7
  76. package/src/config/settings-schema.ts +8 -93
  77. package/src/deep-interview/plaintext-gate-guard.ts +94 -0
  78. package/src/defaults/skc/extensions/grok-cli-vendor/biome.json +1 -1
  79. package/src/defaults/skc/skills/deep-interview/SKILL.md +7 -6
  80. package/src/defaults/skc/skills/team/SKILL.md +5 -3
  81. package/src/defaults/skc/skills/ultragoal/SKILL.md +41 -13
  82. package/src/export/html/index.ts +2 -2
  83. package/src/extensibility/extensions/runner.ts +1 -0
  84. package/src/extensibility/skc-plugins/compiler.ts +351 -0
  85. package/src/extensibility/skc-plugins/constrained-hooks.ts +170 -0
  86. package/src/extensibility/skc-plugins/index.ts +9 -0
  87. package/src/extensibility/skc-plugins/injection.ts +109 -0
  88. package/src/extensibility/skc-plugins/installer.ts +434 -0
  89. package/src/extensibility/skc-plugins/loader.ts +3 -1
  90. package/src/extensibility/skc-plugins/mcp-policy.ts +239 -0
  91. package/src/extensibility/skc-plugins/observability.ts +84 -0
  92. package/src/extensibility/skc-plugins/paths.ts +1 -1
  93. package/src/extensibility/skc-plugins/prompt-appendix.ts +109 -0
  94. package/src/extensibility/skc-plugins/registry.ts +180 -0
  95. package/src/extensibility/skc-plugins/runtime-adapters.ts +234 -0
  96. package/src/extensibility/skc-plugins/schema.ts +250 -20
  97. package/src/extensibility/skc-plugins/session-validation.ts +147 -0
  98. package/src/extensibility/skc-plugins/types.ts +199 -3
  99. package/src/extensibility/skc-plugins/validation.ts +80 -0
  100. package/src/extensibility/skills.ts +15 -0
  101. package/src/hooks/skill-state.ts +57 -0
  102. package/src/i18n/messages/de.ts +0 -1
  103. package/src/i18n/messages/en.ts +0 -1
  104. package/src/i18n/messages/es.ts +0 -1
  105. package/src/i18n/messages/fr.ts +0 -1
  106. package/src/i18n/messages/ja.ts +0 -1
  107. package/src/i18n/messages/ko.ts +0 -1
  108. package/src/i18n/messages/zh.ts +0 -1
  109. package/src/internal-urls/docs-index.generated.ts +12 -8
  110. package/src/main.ts +14 -3
  111. package/src/modes/bridge/bridge-mode.ts +11 -0
  112. package/src/modes/components/assistant-message.ts +49 -1
  113. package/src/modes/components/custom-editor.ts +2 -0
  114. package/src/modes/components/footer.ts +2 -3
  115. package/src/modes/components/hook-editor.ts +1 -1
  116. package/src/modes/components/hook-selector.ts +67 -43
  117. package/src/modes/components/model-selector.ts +56 -11
  118. package/src/modes/components/settings-defs.ts +1 -2
  119. package/src/modes/components/settings-selector.ts +2 -7
  120. package/src/modes/components/status-line/git-utils.ts +25 -0
  121. package/src/modes/components/status-line.ts +10 -11
  122. package/src/modes/components/welcome.ts +2 -3
  123. package/src/modes/controllers/extension-ui-controller.ts +0 -27
  124. package/src/modes/controllers/selector-controller.ts +53 -11
  125. package/src/modes/interactive-mode.ts +4 -1
  126. package/src/modes/shared/agent-wire/scopes.ts +1 -1
  127. package/src/modes/theme/defaults/gruvbox-dark.json +99 -0
  128. package/src/modes/theme/defaults/index.ts +2 -0
  129. package/src/modes/theme/theme.ts +0 -4
  130. package/src/modes/utils/hotkeys-markdown.ts +1 -1
  131. package/src/notifications/html-format.ts +38 -0
  132. package/src/notifications/index.ts +242 -12
  133. package/src/notifications/lifecycle-commands.ts +238 -0
  134. package/src/notifications/lifecycle-control-runtime.ts +405 -0
  135. package/src/notifications/lifecycle-orchestrator.ts +358 -0
  136. package/src/notifications/operator-runtime.ts +171 -0
  137. package/src/notifications/rate-limit-pool.ts +19 -0
  138. package/src/notifications/recent-activity.ts +132 -0
  139. package/src/notifications/telegram-daemon.ts +778 -257
  140. package/src/notifications/telegram-reference.ts +25 -7
  141. package/src/notifications/topic-registry.ts +23 -9
  142. package/src/prompts/agents/executor.md +2 -2
  143. package/src/runtime-mcp/transports/stdio.ts +38 -4
  144. package/src/runtime-mcp/types.ts +7 -0
  145. package/src/sdk.ts +157 -10
  146. package/src/session/agent-session.ts +166 -74
  147. package/src/session/blob-store.ts +196 -8
  148. package/src/session/session-manager.ts +762 -12
  149. package/src/skc-runtime/launch-tmux.ts +68 -19
  150. package/src/skc-runtime/psmux-detect.ts +239 -0
  151. package/src/skc-runtime/team-runtime.ts +56 -23
  152. package/src/skc-runtime/tmux-common.ts +88 -4
  153. package/src/skc-runtime/tmux-sessions.ts +111 -9
  154. package/src/skc-runtime/ultragoal-guard.ts +25 -8
  155. package/src/skc-runtime/ultragoal-runtime.ts +75 -15
  156. package/src/slash-commands/builtin-registry.ts +23 -3
  157. package/src/slash-commands/helpers/fast-status-report.ts +13 -3
  158. package/src/slash-commands/helpers/parse.ts +2 -1
  159. package/src/system-prompt.ts +9 -0
  160. package/src/task/executor.ts +31 -7
  161. package/src/task/index.ts +2 -0
  162. package/src/tools/ask.ts +5 -1
  163. package/src/tools/bash.ts +9 -0
  164. package/src/tools/composer-bash-policy.ts +96 -0
  165. package/src/tools/fetch.ts +18 -2
  166. package/src/tools/index.ts +3 -1
  167. package/src/utils/changelog.ts +8 -0
  168. package/src/web/insane/url-guard.ts +18 -14
  169. package/src/web/scrapers/types.ts +143 -45
  170. package/src/web/scrapers/utils.ts +70 -19
@@ -69,6 +69,7 @@ import type { WorkflowGateEmitter } from "../modes/shared/agent-wire/unattended-
69
69
  import type { PlanModeState } from "../plan-mode/state";
70
70
  import { type AgentRegistry } from "../registry/agent-registry";
71
71
  import { type DiscoverableMCPSearchIndex, type DiscoverableMCPTool } from "../runtime-mcp/discoverable-tool-metadata";
72
+ import { MCPManager } from "../runtime-mcp/manager";
72
73
  import { type SecretObfuscator } from "../secrets/obfuscator";
73
74
  import { type DiscoverableTool, type DiscoverableToolSearchIndex } from "../tool-discovery/tool-index";
74
75
  import type { AskAnswerSource, ToolSession } from "../tools";
@@ -77,7 +78,7 @@ import { type TodoItem, type TodoPhase } from "../tools/todo-write";
77
78
  import type { ClientBridge } from "./client-bridge";
78
79
  import { type ContributionPrepOptions, type ContributionPrepResult } from "./contribution-prep";
79
80
  import { type CustomMessage } from "./messages";
80
- import type { BranchSummaryEntry, NewSessionOptions, SessionContext, SessionManager } from "./session-manager";
81
+ import type { BranchSummaryEntry, CompactionEntry, NewSessionOptions, SessionContext, SessionManager } from "./session-manager";
81
82
  import { ToolChoiceQueue } from "./tool-choice-queue";
82
83
  import { YieldQueue } from "./yield-queue";
83
84
  /** Session-specific events that extend the core AgentEvent */
@@ -233,6 +234,13 @@ export interface AgentSessionConfig {
233
234
  * **MUST NOT** dispose it on their own teardown.
234
235
  */
235
236
  ownedAsyncJobManager?: AsyncJobManager;
237
+ /**
238
+ * MCPManager whose lifecycle this session owns (top-level sessions that
239
+ * connected plugin-bundle MCP servers). Only the owned manager is
240
+ * disconnected on dispose; subagents and callers that merely observe the
241
+ * process-global manager **MUST NOT** dispose it on their own teardown.
242
+ */
243
+ ownedMcpManager?: MCPManager;
236
244
  /** Optional fork-context seed used to initialize a child session before its first prompt. */
237
245
  forkContextSeed?: ForkContextSeed;
238
246
  /** Optional provider state override. Fork-context children should omit this by default. */
@@ -676,6 +684,7 @@ export declare class AgentSession {
676
684
  get skillWarnings(): readonly SkillWarning[];
677
685
  getTodoPhases(): TodoPhase[];
678
686
  setTodoPhases(phases: TodoPhase[]): void;
687
+ applyCompactionPostAppendForTests(compactionEntryId: string, firstKeptEntryId: string, fromExtension?: boolean): Promise<CompactionEntry | undefined>;
679
688
  /**
680
689
  * Abort current operation and wait for agent to become idle.
681
690
  */
@@ -807,9 +816,10 @@ export declare class AgentSession {
807
816
  isFastForSubagentProvider(provider?: string): boolean;
808
817
  /**
809
818
  * True when the configured `serviceTier` resolves to `"priority"` for the
810
- * *currently selected model's provider*. Returns false for scoped tiers
811
- * that don't match (e.g. `"openai-only"` on an anthropic model) and when
812
- * no model is selected.
819
+ * *currently selected model's provider* AND fast mode was not auto-disabled
820
+ * for that provider this session. This is the current-model EFFECTIVE
821
+ * predicate (what the next request actually does); use {@link isFastForProvider}
822
+ * for pure configured intent (e.g. subagent/`modelRoles` display rows).
813
823
  */
814
824
  isFastModeActive(): boolean;
815
825
  setServiceTier(serviceTier: ServiceTier | undefined): void;
@@ -3,6 +3,14 @@ export interface BlobPutResult {
3
3
  path: string;
4
4
  get ref(): string;
5
5
  }
6
+ export interface CheckedBlobPutResult extends BlobPutResult {
7
+ bytes: number;
8
+ }
9
+ export declare class BlobCorruptError extends Error {
10
+ readonly hash: string;
11
+ readonly path: string;
12
+ constructor(hash: string, path: string);
13
+ }
6
14
  /**
7
15
  * Content-addressed blob store for externalizing large binary data (images) from session JSONL files.
8
16
  *
@@ -24,10 +32,22 @@ export declare class BlobStore {
24
32
  * Returns once the bytes are in the kernel page cache.
25
33
  */
26
34
  putSync(data: Buffer): BlobPutResult;
35
+ /**
36
+ * Durably install binary data as an immutable content-addressed blob.
37
+ *
38
+ * Callers that persist references to this blob must mutate canonical session entries only
39
+ * after this method returns successfully. A corrupt pre-existing target is reported with
40
+ * {@link BlobCorruptError}; it is never silently overwritten or trusted.
41
+ */
42
+ putImmutableSync(data: Buffer): CheckedBlobPutResult;
27
43
  /** Read blob by hash, returns Buffer or null if not found. */
28
44
  get(hash: string): Promise<Buffer | null>;
29
45
  /** Synchronously read blob by hash, returns Buffer or null if not found. */
30
46
  getSync(hash: string): Buffer | null;
47
+ /** Read blob by hash and verify its content hash; returns null if not found. */
48
+ getChecked(hash: string): Promise<Buffer | null>;
49
+ /** Synchronously read blob by hash and verify its content hash; returns null if not found. */
50
+ getCheckedSync(hash: string): Buffer | null;
31
51
  /** Check if a blob exists. */
32
52
  has(hash: string): Promise<boolean>;
33
53
  }
@@ -35,7 +55,9 @@ export declare class EphemeralBlobStore extends BlobStore {
35
55
  #private;
36
56
  constructor(dir: string);
37
57
  putSync(data: Buffer): BlobPutResult;
58
+ putImmutableSync(data: Buffer): CheckedBlobPutResult;
38
59
  getSync(hash: string): Buffer | null;
60
+ getCheckedSync(hash: string): Buffer | null;
39
61
  clear(): void;
40
62
  dispose(): void;
41
63
  }
@@ -44,8 +66,11 @@ export declare class MemoryBlobStore extends BlobStore {
44
66
  constructor();
45
67
  put(data: Buffer): Promise<BlobPutResult>;
46
68
  putSync(data: Buffer): BlobPutResult;
69
+ putImmutableSync(data: Buffer): CheckedBlobPutResult;
47
70
  get(hash: string): Promise<Buffer | null>;
48
71
  getSync(hash: string): Buffer | null;
72
+ getChecked(hash: string): Promise<Buffer | null>;
73
+ getCheckedSync(hash: string): Buffer | null;
49
74
  has(hash: string): Promise<boolean>;
50
75
  }
51
76
  export declare class ResidentBlobMissingError extends Error {
@@ -26,9 +26,51 @@ export interface SessionEntryBase {
26
26
  parentId: string | null;
27
27
  timestamp: string;
28
28
  }
29
+ export interface ColdSpillRef {
30
+ kind: "cold_spill";
31
+ ref: string;
32
+ encoding: "utf8" | "json";
33
+ originalChars: number;
34
+ sha256: string;
35
+ bytes: number;
36
+ }
37
+ export interface EvictedContentMarker {
38
+ evictedAt: number;
39
+ reason: "compacted_history";
40
+ compactionEntryId: string;
41
+ firstKeptEntryId: string;
42
+ payloads: Record<string, ColdSpillRef>;
43
+ }
44
+ export interface EvictCompactedContentResult {
45
+ evictedEntries: number;
46
+ hotCharsRemoved: number;
47
+ coldBlobBytes: number;
48
+ payloadRefs: number;
49
+ alreadyEvictedEntries: number;
50
+ coldSpillWriteCount: number;
51
+ coldSpillReadCount: number;
52
+ residentTextReadCount: number;
53
+ residentImageReadCount: number;
54
+ }
55
+ export interface SessionManagerObservabilityStats {
56
+ coldSpillWriteCount: number;
57
+ coldSpillReadCount: number;
58
+ residentTextReadCount: number;
59
+ residentImageReadCount: number;
60
+ publicMaterializerCallCount: number;
61
+ getEntryMaterializerCallCount: number;
62
+ getBranchMaterializerCallCount: number;
63
+ getEntriesMaterializerCallCount: number;
64
+ materializedEntriesCachePopulateCount: number;
65
+ pathOnlyContextBuildCount: number;
66
+ }
29
67
  export interface SessionMessageEntry extends SessionEntryBase {
30
68
  type: "message";
31
69
  message: AgentMessage;
70
+ /** Cold-spill marker: when present, heavy message content was moved to durable
71
+ * content-addressed blobs after compaction. The marker is entry-level session
72
+ * metadata (not a message field) so strict message types stay intact. */
73
+ evictedContent?: EvictedContentMarker;
32
74
  }
33
75
  export interface ThinkingLevelChangeEntry extends SessionEntryBase {
34
76
  type: "thinking_level_change";
@@ -148,6 +190,8 @@ export interface CustomMessageEntry<T = unknown> extends SessionEntryBase {
148
190
  display: boolean;
149
191
  /** Who initiated this message for billing/attribution semantics. */
150
192
  attribution?: MessageAttribution;
193
+ /** Cold-spill marker for custom-message content evicted after compaction. */
194
+ evictedContent?: EvictedContentMarker;
151
195
  }
152
196
  /** Session entry - has id/parentId for tree structure (returned by "read" methods in SessionManager) */
153
197
  export type SessionEntry = SessionMessageEntry | ThinkingLevelChangeEntry | ModelChangeEntry | ServiceTierChangeEntry | CompactionEntry | BranchSummaryEntry | CustomEntry | CustomMessageEntry | LabelEntry | TtsrInjectionEntry | MCPToolSelectionEntry | SessionInitEntry | ModeChangeEntry;
@@ -480,6 +524,19 @@ export declare class SessionManager {
480
524
  * Returns undefined if no model change has been recorded.
481
525
  */
482
526
  getLastModelChangeRole(): string | undefined;
527
+ evictCompactedContent(firstKeptEntryId: string, compactionEntryId: string): EvictCompactedContentResult;
528
+ getObservabilityStatsForTests(): SessionManagerObservabilityStats;
529
+ hotRetainedMessageCharsForTests(): number;
530
+ getCanonicalEntryForTests(id: string): SessionEntry | undefined;
531
+ getEntryForFidelity(id: string): SessionEntry | undefined;
532
+ getBranchForFidelity(fromId?: string): SessionEntry[];
533
+ /**
534
+ * Walk the active branch without materializing resident blobs or rehydrating
535
+ * cold-spill payloads. Intended for metadata-only scans such as todo-phase
536
+ * sync; callers must not mutate returned entries.
537
+ */
538
+ getActivePathEntriesCanonical(fromId?: string): SessionEntry[];
539
+ getEntriesForExport(): SessionEntry[];
483
540
  getEntry(id: string): SessionEntry | undefined;
484
541
  /**
485
542
  * Get all direct children of an entry.
@@ -4,6 +4,7 @@ export { buildSkcTmuxProfileCommands, SKC_DEFAULT_TMUX_SESSION, SKC_TMUX_COMMAND
4
4
  export declare const SKC_TMUX_LAUNCHED_ENV = "SKC_TMUX_LAUNCHED";
5
5
  export declare const SKC_LAUNCH_POLICY_ENV = "SKC_LAUNCH_POLICY";
6
6
  export declare const SKC_TMUX_WINDOW_LABEL_MAX_WIDTH = 48;
7
+ export declare const SKC_PSMUX_PROFILE_FORCE_ENV = "SKC_PSMUX_PROFILE_FORCE";
7
8
  interface TtyState {
8
9
  stdin: boolean;
9
10
  stdout: boolean;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Windows psmux detection and tmux-binary resolution.
3
+ *
4
+ * Recent psmux releases (see docs/compatibility.md in the psmux repo) close
5
+ * the round-trip gap for set-option / show-options user options and the
6
+ * set-window-option profile values skc emits, which is what unblocks the
7
+ * native Windows skc --tmux path. This module detects that capability so skc
8
+ * can pick psmux when tmux is missing on Windows, and so callers can decide
9
+ * whether to treat a given tmux binary as psmux (affecting e.g. the untagged
10
+ * diagnostic wording and namespace handling).
11
+ *
12
+ * The probe is intentionally lightweight: it runs a single tmux -V (or
13
+ * --version) once per process and caches the verdict. Cache invalidation
14
+ * knobs:
15
+ * - force: true re-probes on every call (used by tests).
16
+ * - SKC_PSMUX_FORCE_DETECT=1 re-probes each call.
17
+ * - SKC_PSMUX_DETECTION=off skips probing entirely.
18
+ */
19
+ export declare const SKC_PSMUX_COMMAND_ENV = "SKC_PSMUX_COMMAND";
20
+ export declare const SKC_PSMUX_DETECTION_ENV = "SKC_PSMUX_DETECTION";
21
+ export declare const SKC_PSMUX_FORCE_DETECT_ENV = "SKC_PSMUX_FORCE_DETECT";
22
+ /** Names that psmux installs as the canonical executable / alias. */
23
+ export declare const PSMUX_BINARY_NAMES: readonly ["psmux", "pmux", "tmux"];
24
+ export type PsmuxSpawnRunner = (command: string, args: string[]) => {
25
+ exitCode: number | null;
26
+ stdout?: string;
27
+ stderr?: string;
28
+ };
29
+ /**
30
+ * Resolves a tmux-class binary name (e.g. "psmux", "tmux") to an absolute
31
+ * filesystem path or returns null when the binary cannot be located. The
32
+ * default implementation uses `Bun.which`; production callers leave it
33
+ * alone and unit tests inject a stub via `__setBinaryResolverForTests`
34
+ * so the version-banner probe can be exercised hermetically.
35
+ */
36
+ export type BinaryResolver = (candidate: string) => string | null;
37
+ /** @internal Test-only seam; production code never calls this. */
38
+ export declare function __setBinaryResolverForTests(resolver: BinaryResolver | null): void;
39
+ export declare function envDisabled(value: string | undefined): boolean;
40
+ /**
41
+ * Decide whether command resolves to a psmux binary by probing its version
42
+ * output. The result is cached per process unless force is set or
43
+ * SKC_PSMUX_FORCE_DETECT=1.
44
+ */
45
+ export declare function detectPsmux(command: string, options?: {
46
+ force?: boolean;
47
+ env?: NodeJS.ProcessEnv;
48
+ runner?: PsmuxSpawnRunner;
49
+ }): boolean;
50
+ export interface ResolveSkcTmuxBinaryOptions {
51
+ platform?: NodeJS.Platform;
52
+ env?: NodeJS.ProcessEnv;
53
+ runner?: PsmuxSpawnRunner;
54
+ }
55
+ export interface ResolvedTmuxBinary {
56
+ command: string;
57
+ isPsmux: boolean;
58
+ viaExplicitOverride: boolean;
59
+ }
60
+ /**
61
+ * Resolve the tmux command SKC should invoke. Honors the existing
62
+ * SKC_TMUX_COMMAND / SKC_TEAM_TMUX_COMMAND overrides; on Windows when no
63
+ * override is set, psmux (installed as psmux, pmux, or tmux) is picked
64
+ * automatically so the default skc --tmux flow lands on a real multiplexer.
65
+ */
66
+ export declare function resolveSkcTmuxBinary(options?: ResolveSkcTmuxBinaryOptions): ResolvedTmuxBinary;
67
+ /** Test-only helper: drop the in-process detection cache. */
68
+ export declare function clearPsmuxDetectionCache(): void;
69
+ export interface PsmuxProbe {
70
+ command: string;
71
+ versionOutput: string;
72
+ isPsmux: boolean;
73
+ }
74
+ export declare function probePsmux(command: string, options?: {
75
+ env?: NodeJS.ProcessEnv;
76
+ runner?: PsmuxSpawnRunner;
77
+ force?: boolean;
78
+ }): PsmuxProbe;
@@ -281,6 +281,8 @@ export declare function persistSkcTeamModeStateSummary(snapshot: SkcTeamSnapshot
281
281
  export declare function recoverSkcTeamStaleClaims(teamName: string, cwd?: string, env?: NodeJS.ProcessEnv): Promise<SkcTeamLivenessRecoveryResult>;
282
282
  type SkcTeamTaskMetadataInput = Partial<Pick<SkcTeamTask, "owner" | "lane" | "required_role" | "allowed_roles" | "depends_on" | "blocked_by">>;
283
283
  export declare function resolveSkcWorkerCommand(cwd?: string, env?: NodeJS.ProcessEnv): string;
284
+ /** @internal Exported for unit tests. */
285
+ export declare function buildWorkerCommand(config: SkcTeamConfig, worker: SkcTeamWorker, platform?: NodeJS.Platform): string;
284
286
  export type SkcWorkerCheckpointClassification = {
285
287
  kind: "clean";
286
288
  files: string[];
@@ -1,3 +1,4 @@
1
+ import type { ResolvedTmuxBinary } from "./psmux-detect";
1
2
  export declare const SKC_DEFAULT_TMUX_SESSION = "sayknow_cli";
2
3
  export declare const SKC_TMUX_SESSION_PREFIX = "sayknow_cli_";
3
4
  export declare const SKC_TMUX_COMMAND_ENV = "SKC_TMUX_COMMAND";
@@ -11,6 +12,7 @@ export declare const SKC_TMUX_PROJECT_OPTION = "@skc-project";
11
12
  export declare const SKC_TMUX_SESSION_ID_OPTION = "@skc-session-id";
12
13
  export declare const SKC_TMUX_SESSION_STATE_FILE_OPTION = "@skc-session-state-file";
13
14
  export declare const SKC_TMUX_VERSION_OPTION = "@skc-version";
15
+ export declare const SKC_PSMUX_PROFILE_FORCE_ENV = "SKC_PSMUX_PROFILE_FORCE";
14
16
  export interface SkcTmuxProfileCommand {
15
17
  description: string;
16
18
  args: string[];
@@ -23,7 +25,26 @@ export interface TmuxCommandResult {
23
25
  }
24
26
  export type TmuxCommandRunner = (args: string[]) => TmuxCommandResult;
25
27
  export declare function envDisabled(value: string | undefined): boolean;
26
- export declare function resolveSkcTmuxCommand(env?: NodeJS.ProcessEnv): string;
28
+ /**
29
+ * Resolve the tmux (or tmux-compatible multiplexer) command SKC should invoke.
30
+ *
31
+ * This is the shared entry point used by every SKC code path that needs to talk
32
+ * to a multiplexer: `skc --tmux` planning, `skc session ...`, `skc team ...`,
33
+ * the lifecycle controller, and the harness resident owner. Routing all of
34
+ * them through the same resolver means a single `SKC_TMUX_COMMAND` override or
35
+ * a single Windows psmux / pmux detection wins for the whole process — the
36
+ * failure mode where `skc --tmux` creates a psmux-backed session and then
37
+ * `skc session status` fails because it queries literal `tmux` is closed off.
38
+ *
39
+ * Explicit `SKC_TMUX_COMMAND` / `SKC_TEAM_TMUX_COMMAND` overrides are honored on
40
+ * every platform. On native Windows without an override the resolver walks
41
+ * `psmux`, then `pmux`, then `tmux` and uses the first binary present on PATH.
42
+ * On POSIX the resolver returns `tmux` (the historical default) and only
43
+ * falls through to the platform-aware walker if the caller opts in.
44
+ */
45
+ export declare function resolveSkcTmuxCommand(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): string;
46
+ export type { PsmuxProbe, ResolvedTmuxBinary, ResolveSkcTmuxBinaryOptions } from "./psmux-detect";
47
+ export { clearPsmuxDetectionCache, detectPsmux, probePsmux, resolveSkcTmuxBinary } from "./psmux-detect";
27
48
  /**
28
49
  * Build the exact-session target for tmux *option* commands
29
50
  * (`show-options` / `set-option`) and `display-message -t`.
@@ -34,7 +55,11 @@ export declare function resolveSkcTmuxCommand(env?: NodeJS.ProcessEnv): string;
34
55
  * keeps the exact-session match while giving tmux the window-qualified target
35
56
  * those commands require. See sayknow-cli#580.
36
57
  */
37
- export declare function buildSkcTmuxExactOptionTarget(sessionName: string): string;
58
+ export declare function buildSkcTmuxExactOptionTarget(sessionName: string, opts?: {
59
+ env?: NodeJS.ProcessEnv;
60
+ platform?: NodeJS.Platform;
61
+ binary?: ResolvedTmuxBinary;
62
+ }): string;
38
63
  export declare const SKC_TMUX_UNTAGGED_REASON = "skc_tmux_session_untagged";
39
64
  export declare function buildSkcTmuxUntaggedSessionHint(tmuxCommand: string): string;
40
65
  export declare function buildSkcTmuxUntaggedSessionError(sessionName: string, tmuxCommand: string): string;
@@ -60,5 +85,8 @@ export declare function buildSkcTmuxProfileCommands(target: string, env?: NodeJS
60
85
  sessionId?: string | null;
61
86
  sessionStateFile?: string | null;
62
87
  version?: string | null;
88
+ }, opts?: {
89
+ platform?: NodeJS.Platform;
90
+ tmuxCommand?: string;
63
91
  }): SkcTmuxProfileCommand[];
64
92
  export declare function normalizeTmuxCreatedAt(raw: string): string;
@@ -41,4 +41,22 @@ export declare function createSkcTmuxSession(env?: NodeJS.ProcessEnv): SkcTmuxSe
41
41
  /** @internal */
42
42
  export declare function readTmuxSessionTagsForGc(sessionName: string, env?: NodeJS.ProcessEnv): SkcTmuxSessionTagsForGc;
43
43
  export declare function removeSkcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): SkcTmuxSessionStatus;
44
+ /**
45
+ * Force-close a SKC-managed tmux session, even if a live pane is attached.
46
+ *
47
+ * This is the lifecycle-control counterpart to {@link removeSkcTmuxSession}: it
48
+ * intentionally does NOT refuse live/attached panes (hard-kill is the contract),
49
+ * but it keeps every safety check so it can only ever kill a genuinely
50
+ * SKC-managed session:
51
+ * - re-reads the exact tmux profile immediately before kill (never a non-SKC
52
+ * session, even one that collides by name);
53
+ * - when `expectedSessionId` is given, requires the `@skc-session-id` tag match;
54
+ * - when `expectedStateFile` is given, requires the `@skc-session-state-file`
55
+ * tag match.
56
+ *
57
+ * Returns the prior status (for audit). Throws a tagged error otherwise:
58
+ * `skc_tmux_session_not_found`, `skc_tmux_session_not_managed`,
59
+ * `skc_tmux_session_id_mismatch`, or `skc_tmux_session_state_file_mismatch`.
60
+ */
61
+ export declare function forceCloseSkcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv, expectedSessionId?: string, expectedStateFile?: string): SkcTmuxSessionStatus;
44
62
  export declare function attachSkcTmuxSession(sessionName: string, env?: NodeJS.ProcessEnv): never;
@@ -37,6 +37,12 @@ export interface FastStatusSessionLike {
37
37
  readonly model?: Model;
38
38
  /** Fast predicate against the main session tier (current model + `modelRoles`). */
39
39
  isFastForProvider(provider?: string): boolean;
40
+ /**
41
+ * Current-model EFFECTIVE fast state (intent minus any provider auto-disable).
42
+ * Used for the current-model row so it matches what the next request does.
43
+ * Optional so lightweight fakes can omit it; falls back to `isFastForProvider`.
44
+ */
45
+ isFastModeActive?(): boolean;
40
46
  /** Fast predicate against the effective subagent tier (`task.agentModelOverrides` roles). */
41
47
  isFastForSubagentProvider(provider?: string): boolean;
42
48
  resolveRoleModelWithThinking(role: string): {
@@ -47,6 +47,8 @@ export interface BuildSystemPromptOptions {
47
47
  toolNames?: string[];
48
48
  /** Text to append to system prompt. */
49
49
  appendSystemPrompt?: string;
50
+ /** Rendered SKC plugin system-appendix blocks (lower-authority, appended last). */
51
+ pluginAppendices?: string;
50
52
  /** Repeat full tool descriptions in system prompt. Default: false */
51
53
  repeatToolDescriptions?: boolean;
52
54
  /** Skills settings for discovery. */
@@ -4,6 +4,7 @@
4
4
  * Runs each subagent on the main thread and forwards AgentEvents for progress tracking.
5
5
  */
6
6
  import type { AgentTelemetryConfig, ThinkingLevel } from "@sayknow-cli/agent-core";
7
+ import type { ServiceTier } from "@sayknow-cli/ai";
7
8
  import { ModelRegistry } from "../config/model-registry";
8
9
  import type { PromptTemplate } from "../config/prompt-templates";
9
10
  import { Settings } from "../config/settings";
@@ -58,6 +59,13 @@ export interface ExecutorOptions {
58
59
  authStorage?: AuthStorage;
59
60
  modelRegistry?: ModelRegistry;
60
61
  settings?: Settings;
62
+ /**
63
+ * Live service-tier intent of the parent session (`AgentSession.serviceTier`),
64
+ * used as the inherited tier when `task.serviceTier === "inherit"`. Passing the
65
+ * live value (not the stale settings snapshot) lets a runtime `/fast on` reach
66
+ * subagents, and a main-model fast-mode auto-disable does not clobber it.
67
+ */
68
+ inheritedServiceTier?: ServiceTier;
61
69
  /** Override local:// protocol options so subagent shares parent's local:// root */
62
70
  localProtocolOptions?: LocalProtocolOptions;
63
71
  /**
@@ -105,7 +113,7 @@ interface FinalizeSubprocessOutputResult {
105
113
  export declare const SUBAGENT_WARNING_NULL_YIELD = "SYSTEM WARNING: Subagent called yield with null data.";
106
114
  export declare const SUBAGENT_WARNING_MISSING_YIELD = "SYSTEM WARNING: Subagent exited without calling yield tool after 3 reminders.";
107
115
  export declare function finalizeSubprocessOutput(args: FinalizeSubprocessOutputArgs): FinalizeSubprocessOutputResult;
108
- export declare function createSubagentSettings(baseSettings: Settings): Settings;
116
+ export declare function createSubagentSettings(baseSettings: Settings, inheritedServiceTier?: ServiceTier): Settings;
109
117
  /**
110
118
  * Run a single agent in-process.
111
119
  */
@@ -0,0 +1,14 @@
1
+ export declare const COMPOSER_BASH_POLICY_ERROR = "Composer bash policy blocked repository file I/O. Use find, search, read, and edit tools for file discovery, file inspection, and file mutation.";
2
+ type ComposerBashPolicyResult = {
3
+ allowed: true;
4
+ } | {
5
+ allowed: false;
6
+ reason: string;
7
+ message: string;
8
+ };
9
+ export declare function isComposerBashPolicyModel(modelId: string | undefined): boolean;
10
+ export declare function checkComposerBashPolicy(input: {
11
+ modelId?: string;
12
+ commands: readonly string[];
13
+ }): ComposerBashPolicyResult;
14
+ export {};
@@ -1,5 +1,5 @@
1
1
  import type { AgentTelemetryConfig, AgentTool } from "@sayknow-cli/agent-core";
2
- import type { Model, ToolChoice } from "@sayknow-cli/ai";
2
+ import type { Model, ServiceTier, ToolChoice } from "@sayknow-cli/ai";
3
3
  import type { PromptTemplate } from "../config/prompt-templates";
4
4
  import type { Settings } from "../config/settings";
5
5
  import type { Skill } from "../extensibility/skills";
@@ -173,6 +173,8 @@ export interface ToolSession {
173
173
  agentOutputManager?: AgentOutputManager;
174
174
  /** Settings instance for passing to subagents */
175
175
  settings: Settings;
176
+ /** Live service-tier intent of the parent session, inherited by `inherit` subagents. */
177
+ serviceTier?: ServiceTier;
176
178
  /** Plan mode state (if active) */
177
179
  getPlanModeState?: () => PlanModeState | undefined;
178
180
  /** Goal mode state (if active or paused) */
@@ -25,6 +25,7 @@ export declare function parseChangelog(changelogPath: string): Promise<Changelog
25
25
  * binary-identity changelog).
26
26
  */
27
27
  export declare function getDisplayChangelogEntries(): ChangelogEntry[];
28
+ export declare function getInstalledVersionChangelogEntry(entries: readonly ChangelogEntry[], installedVersion: string): ChangelogEntry | undefined;
28
29
  /**
29
30
  * Compare versions. Returns: -1 if v1 < v2, 0 if v1 === v2, 1 if v1 > v2
30
31
  */
@@ -13,10 +13,13 @@ export type AddressResolver = (hostname: string) => Promise<string[]>;
13
13
  /** True for any address that is not a routable public unicast address. */
14
14
  export declare function isPrivateOrSpecialAddress(address: string): boolean;
15
15
  /**
16
- * Validate that `rawUrl` is a public http/https target safe to hand to the
17
- * insane-search engine. Resolves DNS names and rejects any that map to a
18
- * private/special address. Never throws; returns a discriminated result.
16
+ * Validate that `rawUrl` is a public http/https target. Resolves DNS names and
17
+ * rejects any that map to a private/special address. Never throws; returns a
18
+ * discriminated result.
19
19
  */
20
+ export declare function validatePublicHttpUrl(rawUrl: string, options?: {
21
+ resolver?: AddressResolver;
22
+ }): Promise<PublicUrlResult>;
20
23
  export declare function validatePublicHttpUrlForInsane(rawUrl: string, options?: {
21
24
  resolver?: AddressResolver;
22
25
  }): Promise<PublicUrlResult>;
@@ -1,4 +1,5 @@
1
1
  import type { AgentStorage } from "../../session/agent-storage";
2
+ import type { AddressResolver } from "../insane/url-guard";
2
3
  export { formatNumber } from "@sayknow-cli/utils";
3
4
  export interface RenderResult {
4
5
  url: string;
@@ -27,6 +28,9 @@ export interface LoadPageOptions {
27
28
  body?: string;
28
29
  maxBytes?: number;
29
30
  signal?: AbortSignal;
31
+ publicUrlGuard?: boolean;
32
+ resolver?: AddressResolver;
33
+ maxRedirects?: number;
30
34
  }
31
35
  export interface LoadPageResult {
32
36
  content: string;
@@ -34,6 +38,7 @@ export interface LoadPageResult {
34
38
  finalUrl: string;
35
39
  ok: boolean;
36
40
  status?: number;
41
+ error?: string;
37
42
  }
38
43
  /**
39
44
  * Fetch a page with timeout and size limit
@@ -1,5 +1,6 @@
1
1
  import { isRecord } from "@sayknow-cli/utils";
2
2
  export { isRecord };
3
+ import type { AddressResolver } from "../insane/url-guard";
3
4
  export declare function asRecord(value: unknown): Record<string, unknown> | null;
4
5
  export declare function asString(value: unknown): string | null;
5
6
  export declare function asNumber(value: unknown): number | null;
@@ -12,10 +13,15 @@ export type BinaryFetchResult = BinaryFetchSuccess | {
12
13
  ok: false;
13
14
  error?: string;
14
15
  };
16
+ export interface FetchBinaryOptions {
17
+ publicUrlGuard?: boolean;
18
+ resolver?: AddressResolver;
19
+ maxRedirects?: number;
20
+ }
15
21
  /**
16
22
  * Fetch binary content from a URL
17
23
  */
18
- export declare function fetchBinary(url: string, timeout?: number, signal?: AbortSignal): Promise<BinaryFetchResult>;
24
+ export declare function fetchBinary(url: string, timeout?: number, signal?: AbortSignal, options?: FetchBinaryOptions): Promise<BinaryFetchResult>;
19
25
  /**
20
26
  * Convert binary content to markdown using markit.
21
27
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@sayknow-cli/coding-agent",
4
- "version": "0.3.1",
4
+ "version": "0.3.2",
5
5
  "description": "Sayknow-CLI CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/jaybeyond/Sayknow_CLI",
7
7
  "author": "jaybeyond",
@@ -28,7 +28,7 @@
28
28
  "main": "./src/index.ts",
29
29
  "types": "./dist/types/index.d.ts",
30
30
  "bin": {
31
- "skc": "src/cli.ts"
31
+ "skc": "bin/skc.js"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "bun scripts/build-binary.ts",
@@ -52,12 +52,12 @@
52
52
  "@agentclientprotocol/sdk": "0.21.0",
53
53
  "@babel/parser": "^7.29.3",
54
54
  "@mozilla/readability": "^0.6.0",
55
- "@sayknow-cli/stats": "0.3.1",
56
- "@sayknow-cli/agent-core": "0.3.1",
57
- "@sayknow-cli/ai": "0.3.1",
58
- "@sayknow-cli/natives": "0.3.1",
59
- "@sayknow-cli/tui": "0.3.1",
60
- "@sayknow-cli/utils": "0.3.1",
55
+ "@sayknow-cli/stats": "0.3.2",
56
+ "@sayknow-cli/agent-core": "0.3.2",
57
+ "@sayknow-cli/ai": "0.3.2",
58
+ "@sayknow-cli/natives": "0.3.2",
59
+ "@sayknow-cli/tui": "0.3.2",
60
+ "@sayknow-cli/utils": "0.3.2",
61
61
  "@puppeteer/browsers": "^2.13.0",
62
62
  "@types/turndown": "5.0.6",
63
63
  "@xterm/headless": "^6.0.0",
@@ -74,13 +74,15 @@
74
74
  "zod": "4.4.3"
75
75
  },
76
76
  "devDependencies": {
77
- "@types/bun": "^1.3.14"
77
+ "@types/bun": "^1.3.14",
78
+ "@types/ws": "^8.5.13"
78
79
  },
79
80
  "engines": {
80
81
  "bun": ">=1.3.14"
81
82
  },
82
83
  "files": [
83
84
  "src",
85
+ "bin",
84
86
  "scripts",
85
87
  "examples",
86
88
  "README.md",