@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.
- package/bin/skc.js +4 -0
- package/dist/types/cli/mcp-cli.d.ts +25 -0
- package/dist/types/cli/plugin-cli.d.ts +2 -0
- package/dist/types/cli.d.ts +6 -0
- package/dist/types/commands/mcp.d.ts +70 -0
- package/dist/types/commands/plugin.d.ts +6 -0
- package/dist/types/commands/session.d.ts +6 -0
- package/dist/types/config/keybindings.d.ts +2 -2
- package/dist/types/config/model-profile-activation.d.ts +8 -1
- package/dist/types/config/settings-schema.d.ts +1 -59
- package/dist/types/deep-interview/plaintext-gate-guard.d.ts +11 -0
- package/dist/types/extensibility/skc-plugins/compiler.d.ts +19 -0
- package/dist/types/extensibility/skc-plugins/constrained-hooks.d.ts +29 -0
- package/dist/types/extensibility/skc-plugins/index.d.ts +9 -0
- package/dist/types/extensibility/skc-plugins/injection.d.ts +9 -0
- package/dist/types/extensibility/skc-plugins/installer.d.ts +13 -0
- package/dist/types/extensibility/skc-plugins/mcp-policy.d.ts +26 -0
- package/dist/types/extensibility/skc-plugins/observability.d.ts +27 -0
- package/dist/types/extensibility/skc-plugins/prompt-appendix.d.ts +16 -0
- package/dist/types/extensibility/skc-plugins/registry.d.ts +32 -0
- package/dist/types/extensibility/skc-plugins/runtime-adapters.d.ts +64 -0
- package/dist/types/extensibility/skc-plugins/session-validation.d.ts +42 -0
- package/dist/types/extensibility/skc-plugins/types.d.ts +158 -2
- package/dist/types/extensibility/skc-plugins/validation.d.ts +8 -1
- package/dist/types/i18n/messages/en.d.ts +0 -1
- package/dist/types/main.d.ts +2 -0
- package/dist/types/modes/components/custom-editor.d.ts +1 -1
- package/dist/types/modes/components/model-selector.d.ts +8 -0
- package/dist/types/modes/components/settings-defs.d.ts +0 -1
- package/dist/types/modes/components/status-line/git-utils.d.ts +6 -0
- package/dist/types/modes/theme/defaults/index.d.ts +99 -0
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/notifications/html-format.d.ts +11 -0
- package/dist/types/notifications/index.d.ts +149 -1
- package/dist/types/notifications/lifecycle-commands.d.ts +60 -0
- package/dist/types/notifications/lifecycle-control-runtime.d.ts +98 -0
- package/dist/types/notifications/lifecycle-orchestrator.d.ts +144 -0
- package/dist/types/notifications/operator-runtime.d.ts +52 -0
- package/dist/types/notifications/rate-limit-pool.d.ts +2 -0
- package/dist/types/notifications/recent-activity.d.ts +35 -0
- package/dist/types/notifications/telegram-daemon.d.ts +114 -16
- package/dist/types/notifications/telegram-reference.d.ts +3 -1
- package/dist/types/notifications/topic-registry.d.ts +12 -9
- package/dist/types/runtime-mcp/types.d.ts +7 -0
- package/dist/types/sdk.d.ts +2 -0
- package/dist/types/session/agent-session.d.ts +14 -4
- package/dist/types/session/blob-store.d.ts +25 -0
- package/dist/types/session/session-manager.d.ts +57 -0
- package/dist/types/skc-runtime/launch-tmux.d.ts +1 -0
- package/dist/types/skc-runtime/psmux-detect.d.ts +78 -0
- package/dist/types/skc-runtime/team-runtime.d.ts +2 -0
- package/dist/types/skc-runtime/tmux-common.d.ts +30 -2
- package/dist/types/skc-runtime/tmux-sessions.d.ts +18 -0
- package/dist/types/slash-commands/helpers/fast-status-report.d.ts +6 -0
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +9 -1
- package/dist/types/tools/composer-bash-policy.d.ts +14 -0
- package/dist/types/tools/index.d.ts +3 -1
- package/dist/types/utils/changelog.d.ts +1 -0
- package/dist/types/web/insane/url-guard.d.ts +6 -3
- package/dist/types/web/scrapers/types.d.ts +5 -0
- package/dist/types/web/scrapers/utils.d.ts +7 -1
- package/package.json +11 -9
- package/scripts/g004-tmux-smoke.ts +100 -0
- package/scripts/g005-daemon-smoke.ts +180 -0
- package/scripts/g011-daemon-path-smoke.ts +153 -0
- package/src/cli/fast-help.ts +29 -1
- package/src/cli/mcp-cli.ts +272 -0
- package/src/cli/plugin-cli.ts +66 -3
- package/src/cli.ts +30 -12
- package/src/commands/mcp.ts +117 -0
- package/src/commands/plugin.ts +4 -0
- package/src/commands/session.ts +18 -0
- package/src/config/keybindings.ts +2 -2
- package/src/config/model-profile-activation.ts +55 -7
- package/src/config/settings-schema.ts +8 -93
- package/src/deep-interview/plaintext-gate-guard.ts +94 -0
- package/src/defaults/skc/extensions/grok-cli-vendor/biome.json +1 -1
- package/src/defaults/skc/skills/deep-interview/SKILL.md +7 -6
- package/src/defaults/skc/skills/team/SKILL.md +5 -3
- package/src/defaults/skc/skills/ultragoal/SKILL.md +41 -13
- package/src/export/html/index.ts +2 -2
- package/src/extensibility/extensions/runner.ts +1 -0
- package/src/extensibility/skc-plugins/compiler.ts +351 -0
- package/src/extensibility/skc-plugins/constrained-hooks.ts +170 -0
- package/src/extensibility/skc-plugins/index.ts +9 -0
- package/src/extensibility/skc-plugins/injection.ts +109 -0
- package/src/extensibility/skc-plugins/installer.ts +434 -0
- package/src/extensibility/skc-plugins/loader.ts +3 -1
- package/src/extensibility/skc-plugins/mcp-policy.ts +239 -0
- package/src/extensibility/skc-plugins/observability.ts +84 -0
- package/src/extensibility/skc-plugins/paths.ts +1 -1
- package/src/extensibility/skc-plugins/prompt-appendix.ts +109 -0
- package/src/extensibility/skc-plugins/registry.ts +180 -0
- package/src/extensibility/skc-plugins/runtime-adapters.ts +234 -0
- package/src/extensibility/skc-plugins/schema.ts +250 -20
- package/src/extensibility/skc-plugins/session-validation.ts +147 -0
- package/src/extensibility/skc-plugins/types.ts +199 -3
- package/src/extensibility/skc-plugins/validation.ts +80 -0
- package/src/extensibility/skills.ts +15 -0
- package/src/hooks/skill-state.ts +57 -0
- package/src/i18n/messages/de.ts +0 -1
- package/src/i18n/messages/en.ts +0 -1
- package/src/i18n/messages/es.ts +0 -1
- package/src/i18n/messages/fr.ts +0 -1
- package/src/i18n/messages/ja.ts +0 -1
- package/src/i18n/messages/ko.ts +0 -1
- package/src/i18n/messages/zh.ts +0 -1
- package/src/internal-urls/docs-index.generated.ts +12 -8
- package/src/main.ts +14 -3
- package/src/modes/bridge/bridge-mode.ts +11 -0
- package/src/modes/components/assistant-message.ts +49 -1
- package/src/modes/components/custom-editor.ts +2 -0
- package/src/modes/components/footer.ts +2 -3
- package/src/modes/components/hook-editor.ts +1 -1
- package/src/modes/components/hook-selector.ts +67 -43
- package/src/modes/components/model-selector.ts +56 -11
- package/src/modes/components/settings-defs.ts +1 -2
- package/src/modes/components/settings-selector.ts +2 -7
- package/src/modes/components/status-line/git-utils.ts +25 -0
- package/src/modes/components/status-line.ts +10 -11
- package/src/modes/components/welcome.ts +2 -3
- package/src/modes/controllers/extension-ui-controller.ts +0 -27
- package/src/modes/controllers/selector-controller.ts +53 -11
- package/src/modes/interactive-mode.ts +4 -1
- package/src/modes/shared/agent-wire/scopes.ts +1 -1
- package/src/modes/theme/defaults/gruvbox-dark.json +99 -0
- package/src/modes/theme/defaults/index.ts +2 -0
- package/src/modes/theme/theme.ts +0 -4
- package/src/modes/utils/hotkeys-markdown.ts +1 -1
- package/src/notifications/html-format.ts +38 -0
- package/src/notifications/index.ts +242 -12
- package/src/notifications/lifecycle-commands.ts +238 -0
- package/src/notifications/lifecycle-control-runtime.ts +405 -0
- package/src/notifications/lifecycle-orchestrator.ts +358 -0
- package/src/notifications/operator-runtime.ts +171 -0
- package/src/notifications/rate-limit-pool.ts +19 -0
- package/src/notifications/recent-activity.ts +132 -0
- package/src/notifications/telegram-daemon.ts +778 -257
- package/src/notifications/telegram-reference.ts +25 -7
- package/src/notifications/topic-registry.ts +23 -9
- package/src/prompts/agents/executor.md +2 -2
- package/src/runtime-mcp/transports/stdio.ts +38 -4
- package/src/runtime-mcp/types.ts +7 -0
- package/src/sdk.ts +157 -10
- package/src/session/agent-session.ts +166 -74
- package/src/session/blob-store.ts +196 -8
- package/src/session/session-manager.ts +762 -12
- package/src/skc-runtime/launch-tmux.ts +68 -19
- package/src/skc-runtime/psmux-detect.ts +239 -0
- package/src/skc-runtime/team-runtime.ts +56 -23
- package/src/skc-runtime/tmux-common.ts +88 -4
- package/src/skc-runtime/tmux-sessions.ts +111 -9
- package/src/skc-runtime/ultragoal-guard.ts +25 -8
- package/src/skc-runtime/ultragoal-runtime.ts +75 -15
- package/src/slash-commands/builtin-registry.ts +23 -3
- package/src/slash-commands/helpers/fast-status-report.ts +13 -3
- package/src/slash-commands/helpers/parse.ts +2 -1
- package/src/system-prompt.ts +9 -0
- package/src/task/executor.ts +31 -7
- package/src/task/index.ts +2 -0
- package/src/tools/ask.ts +5 -1
- package/src/tools/bash.ts +9 -0
- package/src/tools/composer-bash-policy.ts +96 -0
- package/src/tools/fetch.ts +18 -2
- package/src/tools/index.ts +3 -1
- package/src/utils/changelog.ts +8 -0
- package/src/web/insane/url-guard.ts +18 -14
- package/src/web/scrapers/types.ts +143 -45
- package/src/web/scrapers/utils.ts +70 -19
|
@@ -7,12 +7,56 @@ export declare const SKC_SUBSKILL_PARENT_AGENTS: readonly ["executor", "architec
|
|
|
7
7
|
export type SkcSubskillParentAgent = (typeof SKC_SUBSKILL_PARENT_AGENTS)[number];
|
|
8
8
|
export type SkcSubskillParent = SkcSubskillParentSkill | SkcSubskillParentAgent;
|
|
9
9
|
export declare const SKC_AGENT_SUBSKILL_PHASES: Record<SkcSubskillParentAgent, string[]>;
|
|
10
|
+
export interface SkcPluginToolManifestEntry {
|
|
11
|
+
name: string;
|
|
12
|
+
path: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
sha256?: string;
|
|
15
|
+
/**
|
|
16
|
+
* "always-on" object entries are activated for the whole session; legacy
|
|
17
|
+
* string shorthand stays "subskill"-scoped and is only attached to subskill
|
|
18
|
+
* bindings (never registered as an always-on tool surface).
|
|
19
|
+
*/
|
|
20
|
+
surface: "subskill" | "always-on";
|
|
21
|
+
}
|
|
22
|
+
export interface SkcPluginHookManifestEntry {
|
|
23
|
+
name: string;
|
|
24
|
+
event: string;
|
|
25
|
+
target?: string;
|
|
26
|
+
phase?: "before" | "after";
|
|
27
|
+
path: string;
|
|
28
|
+
sha256?: string;
|
|
29
|
+
}
|
|
30
|
+
export type SkcPluginMcpTransport = "stdio" | "http" | "sse";
|
|
31
|
+
export interface SkcPluginMcpManifestEntry {
|
|
32
|
+
name: string;
|
|
33
|
+
transport: SkcPluginMcpTransport;
|
|
34
|
+
command?: string;
|
|
35
|
+
args?: string[];
|
|
36
|
+
cwd?: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
sha256?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface SkcPluginAppendixManifestEntry {
|
|
42
|
+
name: string;
|
|
43
|
+
path?: string;
|
|
44
|
+
content?: string;
|
|
45
|
+
sha256?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface SkcPluginAgentAppendixManifestEntry extends SkcPluginAppendixManifestEntry {
|
|
48
|
+
agent: SkcSubskillParentAgent;
|
|
49
|
+
}
|
|
10
50
|
export interface SkcPluginManifest {
|
|
11
51
|
name: string;
|
|
12
52
|
version: string;
|
|
13
53
|
kind: "sayknow-cli-plugin";
|
|
14
54
|
subskills: string[];
|
|
15
|
-
tools:
|
|
55
|
+
tools: SkcPluginToolManifestEntry[];
|
|
56
|
+
hooks: SkcPluginHookManifestEntry[];
|
|
57
|
+
mcps: SkcPluginMcpManifestEntry[];
|
|
58
|
+
systemAppendix: SkcPluginAppendixManifestEntry[];
|
|
59
|
+
agentAppendix: SkcPluginAgentAppendixManifestEntry[];
|
|
16
60
|
}
|
|
17
61
|
export interface SubskillFrontmatter {
|
|
18
62
|
name: string;
|
|
@@ -57,8 +101,120 @@ export interface LoadedSkcPlugin {
|
|
|
57
101
|
bindings: LoadedSubskillBinding[];
|
|
58
102
|
toolBindings: PhaseScopedToolBinding[];
|
|
59
103
|
}
|
|
60
|
-
export type SkcPluginLoadErrorCode = "forbidden_surface" | "invalid_manifest" | "invalid_frontmatter" | "invalid_parent" | "invalid_phase" | "duplicate_arg" | "duplicate_parent_phase" | "
|
|
104
|
+
export type SkcPluginLoadErrorCode = "forbidden_surface" | "invalid_manifest" | "invalid_kind" | "unsupported_surface" | "invalid_frontmatter" | "invalid_parent" | "invalid_phase" | "missing_file" | "hash_mismatch" | "invalid_appendix" | "invalid_hook" | "invalid_mcp" | "duplicate_arg" | "duplicate_parent_phase" | "duplicate_tool" | "duplicate_hook" | "duplicate_mcp" | "duplicate_appendix" | "security_policy" | "install_conflict" | "session_collision" | "runtime_mismatch" | "quarantined_surface";
|
|
61
105
|
export declare class SkcPluginLoadError extends Error {
|
|
62
106
|
readonly code: SkcPluginLoadErrorCode;
|
|
63
107
|
constructor(code: SkcPluginLoadErrorCode, message: string, options?: ErrorOptions);
|
|
64
108
|
}
|
|
109
|
+
export type SkcPluginScope = "user" | "project";
|
|
110
|
+
export type SkcPluginSourceKind = "path" | "git" | "tarball";
|
|
111
|
+
export interface SkcPluginCopiedFile {
|
|
112
|
+
relativePath: string;
|
|
113
|
+
sha256: string;
|
|
114
|
+
bytes: number;
|
|
115
|
+
}
|
|
116
|
+
export interface NormalizedSubskillSurface {
|
|
117
|
+
extensionId: string;
|
|
118
|
+
name: string;
|
|
119
|
+
description: string;
|
|
120
|
+
parent: string;
|
|
121
|
+
phase: string;
|
|
122
|
+
activationArg: string;
|
|
123
|
+
relativePath: string;
|
|
124
|
+
sha256: string;
|
|
125
|
+
}
|
|
126
|
+
export interface NormalizedToolSurface {
|
|
127
|
+
extensionId: string;
|
|
128
|
+
name: string;
|
|
129
|
+
relativePath: string;
|
|
130
|
+
sha256: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
}
|
|
133
|
+
export interface NormalizedHookSurface {
|
|
134
|
+
extensionId: string;
|
|
135
|
+
name: string;
|
|
136
|
+
event: string;
|
|
137
|
+
target?: string;
|
|
138
|
+
phase?: "before" | "after";
|
|
139
|
+
relativePath: string;
|
|
140
|
+
sha256: string;
|
|
141
|
+
}
|
|
142
|
+
export interface NormalizedMcpSurface {
|
|
143
|
+
extensionId: string;
|
|
144
|
+
name: string;
|
|
145
|
+
transport: SkcPluginMcpTransport;
|
|
146
|
+
configHash: string;
|
|
147
|
+
config: SkcPluginMcpManifestEntry;
|
|
148
|
+
}
|
|
149
|
+
export interface NormalizedAppendixSurface {
|
|
150
|
+
extensionId: string;
|
|
151
|
+
name: string;
|
|
152
|
+
relativePath?: string;
|
|
153
|
+
/** Inline appendix body (when the manifest used `content` instead of `path`). */
|
|
154
|
+
content?: string;
|
|
155
|
+
contentHash: string;
|
|
156
|
+
bytes: number;
|
|
157
|
+
}
|
|
158
|
+
export interface NormalizedAgentAppendixSurface extends NormalizedAppendixSurface {
|
|
159
|
+
agent: SkcSubskillParentAgent;
|
|
160
|
+
}
|
|
161
|
+
export interface NormalizedSkcPluginSurfaces {
|
|
162
|
+
subskills: NormalizedSubskillSurface[];
|
|
163
|
+
tools: NormalizedToolSurface[];
|
|
164
|
+
hooks: NormalizedHookSurface[];
|
|
165
|
+
mcps: NormalizedMcpSurface[];
|
|
166
|
+
systemAppendices: NormalizedAppendixSurface[];
|
|
167
|
+
agentAppendices: NormalizedAgentAppendixSurface[];
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Result of the pure compile step. Computed from manifest, frontmatter, and
|
|
171
|
+
* declared files read as bytes only — never by importing plugin code.
|
|
172
|
+
*/
|
|
173
|
+
export interface NormalizedSkcPluginBundle {
|
|
174
|
+
name: string;
|
|
175
|
+
version: string;
|
|
176
|
+
root: string;
|
|
177
|
+
manifestPath: string;
|
|
178
|
+
manifestHash: string;
|
|
179
|
+
surfaces: NormalizedSkcPluginSurfaces;
|
|
180
|
+
files: SkcPluginCopiedFile[];
|
|
181
|
+
}
|
|
182
|
+
export interface SkcPluginQuarantineEntry {
|
|
183
|
+
surfaceId: string;
|
|
184
|
+
code: SkcPluginLoadErrorCode;
|
|
185
|
+
message: string;
|
|
186
|
+
detectedAt: string;
|
|
187
|
+
}
|
|
188
|
+
export interface SkcPluginRegistrySource {
|
|
189
|
+
kind: SkcPluginSourceKind;
|
|
190
|
+
uri: string;
|
|
191
|
+
ref?: string;
|
|
192
|
+
sha?: string;
|
|
193
|
+
resolvedAt: string;
|
|
194
|
+
}
|
|
195
|
+
export interface SkcPluginRegistryEntry {
|
|
196
|
+
name: string;
|
|
197
|
+
version: string;
|
|
198
|
+
scope: SkcPluginScope;
|
|
199
|
+
enabled: boolean;
|
|
200
|
+
pluginRoot: string;
|
|
201
|
+
manifestPath: string;
|
|
202
|
+
manifestHash: string;
|
|
203
|
+
source: SkcPluginRegistrySource;
|
|
204
|
+
installedAt: string;
|
|
205
|
+
updatedAt: string;
|
|
206
|
+
copiedFiles: SkcPluginCopiedFile[];
|
|
207
|
+
surfaces: NormalizedSkcPluginSurfaces;
|
|
208
|
+
disabledSurfaceIds: string[];
|
|
209
|
+
quarantine?: SkcPluginQuarantineEntry[];
|
|
210
|
+
}
|
|
211
|
+
export interface SkcPluginRegistry {
|
|
212
|
+
version: 1;
|
|
213
|
+
scope: SkcPluginScope;
|
|
214
|
+
plugins: SkcPluginRegistryEntry[];
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Stable identifiers for plugin-contributed surfaces used by observability,
|
|
218
|
+
* disabledSurfaceIds, and quarantine bookkeeping.
|
|
219
|
+
*/
|
|
220
|
+
export type SkcPluginSurfaceExtensionId = string;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import { type LoadedSubskillBinding, type SubskillFrontmatter } from "./types";
|
|
1
|
+
import { type LoadedSubskillBinding, type NormalizedSkcPluginBundle, type SkcPluginRegistryEntry, type SubskillFrontmatter } from "./types";
|
|
2
2
|
export declare function validateBinding(fm: SubskillFrontmatter): void;
|
|
3
3
|
export declare function buildParentArgMap(bindings: readonly LoadedSubskillBinding[]): Map<string, Map<string, LoadedSubskillBinding>>;
|
|
4
4
|
export declare function buildParentPhaseSet(bindings: readonly LoadedSubskillBinding[]): Set<string>;
|
|
5
|
+
/**
|
|
6
|
+
* Hard install-time collision + security validation for a compiled bundle
|
|
7
|
+
* against the effective installed registry (other plugins in the target scope
|
|
8
|
+
* universe). Collisions are hard errors; the registry is the collision
|
|
9
|
+
* authority, never capability first-wins.
|
|
10
|
+
*/
|
|
11
|
+
export declare function validateInstallPlan(bundle: NormalizedSkcPluginBundle, effectiveEntries: readonly SkcPluginRegistryEntry[]): void;
|
|
@@ -30,7 +30,6 @@ export declare const en: {
|
|
|
30
30
|
readonly "settings.tab.appearance": "Appearance";
|
|
31
31
|
readonly "settings.tab.model": "Model";
|
|
32
32
|
readonly "settings.tab.interaction": "Interaction";
|
|
33
|
-
readonly "settings.tab.notifications": "Notifications";
|
|
34
33
|
readonly "settings.tab.context": "Context";
|
|
35
34
|
readonly "settings.tab.memory": "Memory";
|
|
36
35
|
readonly "settings.tab.editing": "Editing";
|
package/dist/types/main.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type { SubmittedUserInput } from "./modes/types";
|
|
|
12
12
|
import { type CreateAgentSessionOptions, type CreateAgentSessionResult, createAgentSession, discoverAuthStorage } from "./sdk";
|
|
13
13
|
import type { AgentSession } from "./session/agent-session";
|
|
14
14
|
import type { AuthStorage } from "./session/auth-storage";
|
|
15
|
+
import { SessionManager } from "./session/session-manager";
|
|
15
16
|
export interface InteractiveModeNotify {
|
|
16
17
|
kind: "warn" | "error" | "info";
|
|
17
18
|
message: string;
|
|
@@ -48,6 +49,7 @@ export declare function applyStartupModelProfilesOrExit(args: Parameters<typeof
|
|
|
48
49
|
* tool registry and shadow the client-supplied servers (issue #1234).
|
|
49
50
|
*/
|
|
50
51
|
export declare function createAcpSessionFactory(args: AcpSessionFactoryOptions): AcpSessionFactory;
|
|
52
|
+
export declare function createSessionManager(parsed: Args, cwd: string, activeSettings?: Settings): Promise<SessionManager | undefined>;
|
|
51
53
|
/**
|
|
52
54
|
* Research-mode (RLM) preset hook. Lets `skc rlm` augment the session options
|
|
53
55
|
* (system prompt, restricted toolset, custom python tool) and assert the tool
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Editor, type KeyId } from "@sayknow-cli/tui";
|
|
2
2
|
import { type AppKeybinding } from "../../config/keybindings";
|
|
3
|
-
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.message.queue" | "app.clipboard.pasteImage" | "app.clipboard.copyPrompt">;
|
|
3
|
+
type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.message.followUp" | "app.message.queue" | "app.clipboard.pasteImage" | "app.clipboard.copyPrompt">;
|
|
4
4
|
type PastePendingClearReason = "timeout" | "queue-limit";
|
|
5
5
|
/**
|
|
6
6
|
* Custom editor that handles configurable app-level shortcuts for coding-agent.
|
|
@@ -38,7 +38,15 @@ export declare class ModelSelectorComponent extends Container {
|
|
|
38
38
|
sessionId?: string;
|
|
39
39
|
isFastForProvider?: (provider?: string) => boolean;
|
|
40
40
|
isFastForSubagentProvider?: (provider?: string) => boolean;
|
|
41
|
+
isCurrentModelFastModeActive?: () => boolean;
|
|
42
|
+
currentThinkingLevel?: ThinkingLevel;
|
|
43
|
+
activeModelProfile?: string;
|
|
41
44
|
});
|
|
45
|
+
refreshRoleAssignments(options?: {
|
|
46
|
+
currentModel?: Model;
|
|
47
|
+
currentThinkingLevel?: ThinkingLevel;
|
|
48
|
+
activeModelProfile?: string;
|
|
49
|
+
}): void;
|
|
42
50
|
handleInput(keyData: string): void;
|
|
43
51
|
getSearchInput(): Input;
|
|
44
52
|
__testSelectProfile(profileName: string, setDefault: boolean): Promise<void>;
|
|
@@ -37,7 +37,6 @@ export interface SubmenuSettingDef extends BaseSettingDef {
|
|
|
37
37
|
}
|
|
38
38
|
export interface TextInputSettingDef extends BaseSettingDef {
|
|
39
39
|
type: "text";
|
|
40
|
-
secret?: boolean;
|
|
41
40
|
}
|
|
42
41
|
export type SettingDef = BooleanSettingDef | EnumSettingDef | SubmenuSettingDef | TextInputSettingDef;
|
|
43
42
|
/** Get all setting definitions with UI */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GitHeadState } from "../../../utils/git";
|
|
1
2
|
/**
|
|
2
3
|
* Extract "owner/repo" from a GitHub remote URL.
|
|
3
4
|
* Handles HTTPS, SSH (scp-style), and git:// protocols.
|
|
@@ -20,3 +21,8 @@ export declare function canReuseCachedPr(cachedPr: {
|
|
|
20
21
|
number: number;
|
|
21
22
|
url: string;
|
|
22
23
|
} | null | undefined, cachedContext: PrCacheContext | undefined, currentContext: PrCacheContext | null): boolean;
|
|
24
|
+
export interface CurrentBranchState {
|
|
25
|
+
readonly branch: string | null;
|
|
26
|
+
readonly repoId: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function resolveCurrentBranch(cwd: string, resolveHead?: (cwd: string) => GitHeadState | null): CurrentBranchState;
|
|
@@ -325,6 +325,105 @@ export declare const defaultThemes: {
|
|
|
325
325
|
"preset": string;
|
|
326
326
|
};
|
|
327
327
|
};
|
|
328
|
+
"gruvbox-dark": {
|
|
329
|
+
$schema: string;
|
|
330
|
+
name: string;
|
|
331
|
+
vars: {
|
|
332
|
+
"bgHard": string;
|
|
333
|
+
"surface": string;
|
|
334
|
+
"surfaceBright": string;
|
|
335
|
+
"borderNeutral": string;
|
|
336
|
+
"borderSubtle": string;
|
|
337
|
+
"fg": string;
|
|
338
|
+
"muted": string;
|
|
339
|
+
"dim": string;
|
|
340
|
+
"gray": string;
|
|
341
|
+
"red": string;
|
|
342
|
+
"green": string;
|
|
343
|
+
"yellow": string;
|
|
344
|
+
"blue": string;
|
|
345
|
+
"purple": string;
|
|
346
|
+
"aqua": string;
|
|
347
|
+
"orange": string;
|
|
348
|
+
"diffRemovalRed": string;
|
|
349
|
+
};
|
|
350
|
+
colors: {
|
|
351
|
+
"accent": string;
|
|
352
|
+
"border": string;
|
|
353
|
+
"borderAccent": string;
|
|
354
|
+
"borderMuted": string;
|
|
355
|
+
"success": string;
|
|
356
|
+
"error": string;
|
|
357
|
+
"warning": string;
|
|
358
|
+
"muted": string;
|
|
359
|
+
"dim": string;
|
|
360
|
+
"text": string;
|
|
361
|
+
"thinkingText": string;
|
|
362
|
+
"selectedBg": string;
|
|
363
|
+
"userMessageBg": string;
|
|
364
|
+
"userMessageText": string;
|
|
365
|
+
"customMessageBg": string;
|
|
366
|
+
"customMessageText": string;
|
|
367
|
+
"customMessageLabel": string;
|
|
368
|
+
"toolPendingBg": string;
|
|
369
|
+
"toolSuccessBg": string;
|
|
370
|
+
"toolErrorBg": string;
|
|
371
|
+
"toolTitle": string;
|
|
372
|
+
"toolOutput": string;
|
|
373
|
+
"mdHeading": string;
|
|
374
|
+
"mdLink": string;
|
|
375
|
+
"mdLinkUrl": string;
|
|
376
|
+
"mdCode": string;
|
|
377
|
+
"mdCodeBlock": string;
|
|
378
|
+
"mdCodeBlockBorder": string;
|
|
379
|
+
"mdQuote": string;
|
|
380
|
+
"mdQuoteBorder": string;
|
|
381
|
+
"mdHr": string;
|
|
382
|
+
"mdListBullet": string;
|
|
383
|
+
"toolDiffAdded": string;
|
|
384
|
+
"toolDiffRemoved": string;
|
|
385
|
+
"toolDiffContext": string;
|
|
386
|
+
"syntaxComment": string;
|
|
387
|
+
"syntaxKeyword": string;
|
|
388
|
+
"syntaxFunction": string;
|
|
389
|
+
"syntaxVariable": string;
|
|
390
|
+
"syntaxString": string;
|
|
391
|
+
"syntaxNumber": string;
|
|
392
|
+
"syntaxType": string;
|
|
393
|
+
"syntaxOperator": string;
|
|
394
|
+
"syntaxPunctuation": string;
|
|
395
|
+
"thinkingOff": string;
|
|
396
|
+
"thinkingMinimal": string;
|
|
397
|
+
"thinkingLow": string;
|
|
398
|
+
"thinkingMedium": string;
|
|
399
|
+
"thinkingHigh": string;
|
|
400
|
+
"thinkingXhigh": string;
|
|
401
|
+
"bashMode": string;
|
|
402
|
+
"pythonMode": string;
|
|
403
|
+
"statusLineBg": string;
|
|
404
|
+
"statusLineSep": string;
|
|
405
|
+
"statusLineModel": string;
|
|
406
|
+
"statusLinePath": string;
|
|
407
|
+
"statusLineGitClean": string;
|
|
408
|
+
"statusLineGitDirty": string;
|
|
409
|
+
"statusLineContext": string;
|
|
410
|
+
"statusLineSpend": string;
|
|
411
|
+
"statusLineStaged": string;
|
|
412
|
+
"statusLineDirty": string;
|
|
413
|
+
"statusLineUntracked": string;
|
|
414
|
+
"statusLineOutput": string;
|
|
415
|
+
"statusLineCost": string;
|
|
416
|
+
"statusLineSubagents": string;
|
|
417
|
+
};
|
|
418
|
+
export: {
|
|
419
|
+
"pageBg": string;
|
|
420
|
+
"cardBg": string;
|
|
421
|
+
"infoBg": string;
|
|
422
|
+
};
|
|
423
|
+
symbols: {
|
|
424
|
+
"preset": string;
|
|
425
|
+
};
|
|
426
|
+
};
|
|
328
427
|
opencode: {
|
|
329
428
|
$schema: string;
|
|
330
429
|
name: string;
|
|
@@ -6,7 +6,7 @@ export type SymbolPreset = "unicode" | "nerd" | "ascii";
|
|
|
6
6
|
/**
|
|
7
7
|
* All available symbol keys organized by category.
|
|
8
8
|
*/
|
|
9
|
-
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.folder" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.agents" | "icon.cache" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.max" | "checkbox.checked" | "checkbox.unchecked" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.
|
|
9
|
+
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.folder" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.agents" | "icon.cache" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.max" | "checkbox.checked" | "checkbox.unchecked" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.editing" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers";
|
|
10
10
|
export type SpinnerType = "status" | "activity";
|
|
11
11
|
export declare const THEME_COLOR_KEYS: readonly ["accent", "border", "borderAccent", "borderMuted", "success", "error", "warning", "muted", "dim", "text", "thinkingText", "selectedBg", "userMessageBg", "userMessageText", "customMessageBg", "customMessageText", "customMessageLabel", "toolPendingBg", "toolSuccessBg", "toolErrorBg", "toolTitle", "toolOutput", "mdHeading", "mdLink", "mdLinkUrl", "mdCode", "mdCodeBlock", "mdCodeBlockBorder", "mdQuote", "mdQuoteBorder", "mdHr", "mdListBullet", "toolDiffAdded", "toolDiffRemoved", "toolDiffContext", "syntaxComment", "syntaxKeyword", "syntaxFunction", "syntaxVariable", "syntaxString", "syntaxNumber", "syntaxType", "syntaxOperator", "syntaxPunctuation", "thinkingOff", "thinkingMinimal", "thinkingLow", "thinkingMedium", "thinkingHigh", "thinkingXhigh", "bashMode", "pythonMode", "statusLineBg", "statusLineSep", "statusLineModel", "statusLinePath", "statusLineGitClean", "statusLineGitDirty", "statusLineContext", "statusLineSpend", "statusLineStaged", "statusLineDirty", "statusLineUntracked", "statusLineOutput", "statusLineCost", "statusLineSubagents"];
|
|
12
12
|
export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "bashMode" | "pythonMode" | "statusLineSep" | "statusLineModel" | "statusLinePath" | "statusLineGitClean" | "statusLineGitDirty" | "statusLineContext" | "statusLineSpend" | "statusLineStaged" | "statusLineDirty" | "statusLineUntracked" | "statusLineOutput" | "statusLineCost" | "statusLineSubagents";
|
|
@@ -49,10 +49,21 @@ export declare function finalizeTelegramHtml(message?: string): string | undefin
|
|
|
49
49
|
* `1. 1. …` and keeps the displayed number aligned with the button's real index.
|
|
50
50
|
*/
|
|
51
51
|
export declare function buttonLabel(label: string, index: number): string;
|
|
52
|
+
/** Numbered, escaped option list for the Telegram message body. */
|
|
53
|
+
export declare function numberedOptionList(labels: string[]): string;
|
|
54
|
+
/** Compact numeric button label; full option text belongs in the message body. */
|
|
55
|
+
export declare function choiceButtonLabel(index: number): string;
|
|
52
56
|
export interface InlineButton {
|
|
53
57
|
text: string;
|
|
54
58
|
callback_data: string;
|
|
55
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Lay out option callbacks as compact numeric buttons. Telegram mobile clients
|
|
62
|
+
* ellipsize long inline-keyboard labels and tall keyboards can be obscured by
|
|
63
|
+
* the composer, so the full choice text is rendered in the message body while
|
|
64
|
+
* the keyboard keeps only stable one-based tap targets.
|
|
65
|
+
*/
|
|
66
|
+
export declare function buildCompactChoiceGrid(labels: string[], callbackForIndex: (index: number) => string): InlineButton[][];
|
|
56
67
|
/**
|
|
57
68
|
* Lay out option labels as a numbered button grid. Long buttons take a
|
|
58
69
|
* full-width row; runs of short buttons are packed into rows of up to 3. The
|
|
@@ -12,12 +12,160 @@
|
|
|
12
12
|
* - `ask` (unattended/RPC): observes emitted workflow gates and resolves the real
|
|
13
13
|
* gate on a remote reply via `ctx.workflowGate`.
|
|
14
14
|
* - `turn_end` -> `action_needed` (kind `idle`, deduped per turn).
|
|
15
|
-
* - `session_shutdown` -> stop
|
|
15
|
+
* - `session_shutdown` -> `session_closed` frame, stop server, deregister answer source.
|
|
16
16
|
*
|
|
17
17
|
* Enable with Settings notifications config, `SKC_NOTIFICATIONS=1` (a token is
|
|
18
18
|
* generated), or `SKC_NOTIFICATIONS_TOKEN`.
|
|
19
19
|
*/
|
|
20
20
|
import type { ExtensionFactory } from "../extensibility/extensions";
|
|
21
|
+
/** Where a `session_create` should run. Discriminated by `kind`. */
|
|
22
|
+
export type SessionCreateTarget = {
|
|
23
|
+
kind: "existing_path";
|
|
24
|
+
path: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "worktree";
|
|
27
|
+
repo: string;
|
|
28
|
+
branch: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: "plain_dir";
|
|
31
|
+
path: string;
|
|
32
|
+
};
|
|
33
|
+
/** Identifies the session a `session_close` targets. */
|
|
34
|
+
export interface SessionCloseTarget {
|
|
35
|
+
sessionId: string;
|
|
36
|
+
/** Expected SKC-managed tmux session name (defense-in-depth match). */
|
|
37
|
+
tmuxSession?: string;
|
|
38
|
+
/** Expected `@skc-session-state-file` tag (defense-in-depth match). */
|
|
39
|
+
sessionStateFile?: string;
|
|
40
|
+
}
|
|
41
|
+
/** Identifies the session a `session_resume` targets. */
|
|
42
|
+
export interface SessionResumeTarget {
|
|
43
|
+
sessionIdOrPrefix: string;
|
|
44
|
+
/** Optional repo/working-dir hint to disambiguate matches. */
|
|
45
|
+
path?: string;
|
|
46
|
+
}
|
|
47
|
+
/** Create a new session. */
|
|
48
|
+
export interface SessionCreateFrame {
|
|
49
|
+
type: "session_create";
|
|
50
|
+
requestId: string;
|
|
51
|
+
/** Deterministic lifecycle marker preallocated by the daemon before spawn. */
|
|
52
|
+
lifecycleRequestId: string;
|
|
53
|
+
/** Session id the daemon preallocated and propagates to the child. */
|
|
54
|
+
intendedSessionId: string;
|
|
55
|
+
/** Telegram update id (idempotency key on the daemon side). */
|
|
56
|
+
updateId: number;
|
|
57
|
+
chatId: string;
|
|
58
|
+
/** Control-endpoint token authorizing this frame. */
|
|
59
|
+
token: string;
|
|
60
|
+
target: SessionCreateTarget;
|
|
61
|
+
/** Reference to the daemon-written, once-consumed startup-prompt file. */
|
|
62
|
+
startupPromptRef?: string;
|
|
63
|
+
}
|
|
64
|
+
/** Close (hard-kill, history preserved) a session. */
|
|
65
|
+
export interface SessionCloseFrame {
|
|
66
|
+
type: "session_close";
|
|
67
|
+
requestId: string;
|
|
68
|
+
updateId: number;
|
|
69
|
+
chatId: string;
|
|
70
|
+
token: string;
|
|
71
|
+
target: SessionCloseTarget;
|
|
72
|
+
/** Hard-kill even if a live pane is attached (SKC-managed only). */
|
|
73
|
+
force?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** Resume a session (reattach if alive, else cold-restart from history). */
|
|
76
|
+
export interface SessionResumeFrame {
|
|
77
|
+
type: "session_resume";
|
|
78
|
+
requestId: string;
|
|
79
|
+
updateId: number;
|
|
80
|
+
chatId: string;
|
|
81
|
+
token: string;
|
|
82
|
+
target: SessionResumeTarget;
|
|
83
|
+
startupPromptRef?: string;
|
|
84
|
+
}
|
|
85
|
+
/** Any client -> ingress lifecycle request frame. */
|
|
86
|
+
export type SessionLifecycleRequest = SessionCreateFrame | SessionCloseFrame | SessionResumeFrame;
|
|
87
|
+
/** Terminal status of a lifecycle request. */
|
|
88
|
+
export type LifecycleStatus = "ok" | "error";
|
|
89
|
+
/** A connected session's per-session endpoint, returned to the control client. */
|
|
90
|
+
export interface LifecycleEndpoint {
|
|
91
|
+
url: string;
|
|
92
|
+
token: string;
|
|
93
|
+
}
|
|
94
|
+
/** The Telegram topic/thread a session is surfaced in. */
|
|
95
|
+
export interface LifecycleTopic {
|
|
96
|
+
chatId: string;
|
|
97
|
+
threadId: string;
|
|
98
|
+
}
|
|
99
|
+
/** How a create request was correlated to its spawned session. */
|
|
100
|
+
export type MatchedBy = "spawn_marker" | "session_ready";
|
|
101
|
+
/** Response to a successful `session_create`. */
|
|
102
|
+
export interface SessionCreateResponseFrame {
|
|
103
|
+
type: "session_create_response";
|
|
104
|
+
requestId: string;
|
|
105
|
+
status: LifecycleStatus;
|
|
106
|
+
lifecycleRequestId: string;
|
|
107
|
+
sessionId: string;
|
|
108
|
+
matchedBy: MatchedBy;
|
|
109
|
+
endpoint: LifecycleEndpoint;
|
|
110
|
+
topic: LifecycleTopic;
|
|
111
|
+
target: SessionCreateTarget;
|
|
112
|
+
}
|
|
113
|
+
/** Response to a successful `session_close`. */
|
|
114
|
+
export interface SessionCloseResponseFrame {
|
|
115
|
+
type: "session_close_response";
|
|
116
|
+
requestId: string;
|
|
117
|
+
status: LifecycleStatus;
|
|
118
|
+
sessionId: string;
|
|
119
|
+
processGone: boolean;
|
|
120
|
+
historyPreserved: boolean;
|
|
121
|
+
endpointStale: boolean;
|
|
122
|
+
}
|
|
123
|
+
/** Whether a resume reattached to a live session or cold-restarted a dead one. */
|
|
124
|
+
export type ResumeMode = "reattached" | "cold_restarted";
|
|
125
|
+
/** Response to a successful `session_resume`. */
|
|
126
|
+
export interface SessionResumeResponseFrame {
|
|
127
|
+
type: "session_resume_response";
|
|
128
|
+
requestId: string;
|
|
129
|
+
status: LifecycleStatus;
|
|
130
|
+
sessionId: string;
|
|
131
|
+
mode: ResumeMode;
|
|
132
|
+
endpoint: LifecycleEndpoint;
|
|
133
|
+
topic: LifecycleTopic;
|
|
134
|
+
}
|
|
135
|
+
/** Machine-readable reason a lifecycle request failed. */
|
|
136
|
+
export type LifecycleErrorReason = "unauthorized" | "rate_limited" | "duplicate_conflict" | "invalid_target" | "ambiguous_target" | "spawn_failed" | "discovery_timeout" | "readiness_timeout" | "close_refused" | "not_found" | "terminal_uncertain";
|
|
137
|
+
/** A candidate returned with an `ambiguous_target` resume error. */
|
|
138
|
+
export interface ResumeCandidate {
|
|
139
|
+
sessionId: string;
|
|
140
|
+
path?: string;
|
|
141
|
+
/** Last-activity epoch-millis (session history file mtime), if known. */
|
|
142
|
+
mtimeMs?: number;
|
|
143
|
+
}
|
|
144
|
+
/** A structured lifecycle error frame. */
|
|
145
|
+
export interface SessionLifecycleErrorFrame {
|
|
146
|
+
type: "session_lifecycle_error";
|
|
147
|
+
requestId: string;
|
|
148
|
+
status: LifecycleStatus;
|
|
149
|
+
reason: LifecycleErrorReason;
|
|
150
|
+
message: string;
|
|
151
|
+
candidates?: ResumeCandidate[];
|
|
152
|
+
}
|
|
153
|
+
/** Any ingress -> client lifecycle response frame. */
|
|
154
|
+
export type SessionLifecycleResponse = SessionCreateResponseFrame | SessionCloseResponseFrame | SessionResumeResponseFrame | SessionLifecycleErrorFrame;
|
|
155
|
+
/**
|
|
156
|
+
* Replayable per-session readiness signal (mirror of the Rust `session_ready`
|
|
157
|
+
* frame). Buffered and replayed to late clients so WS-open alone never implies
|
|
158
|
+
* the session is live and surfaced.
|
|
159
|
+
*/
|
|
160
|
+
export interface SessionReadyFrame {
|
|
161
|
+
type: "session_ready";
|
|
162
|
+
sessionId: string;
|
|
163
|
+
lifecycleRequestId?: string;
|
|
164
|
+
startupPromptRef?: string;
|
|
165
|
+
repo?: string;
|
|
166
|
+
branch?: string;
|
|
167
|
+
title?: string;
|
|
168
|
+
}
|
|
21
169
|
/**
|
|
22
170
|
* Best-effort real repository name (no git spawn): resolves the main worktree
|
|
23
171
|
* root directory so linked worktrees report the repo (e.g. `sayknow-cli`)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { SessionCloseTarget, SessionCreateTarget, SessionLifecycleResponse, SessionResumeTarget } from "./index";
|
|
2
|
+
export type LifecycleCommandVerb = "session_create" | "session_close" | "session_resume";
|
|
3
|
+
/** A parsed, validated lifecycle command (transport identity added by caller). */
|
|
4
|
+
export type ParsedLifecycleCommand = {
|
|
5
|
+
kind: "create";
|
|
6
|
+
target: SessionCreateTarget;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "close";
|
|
9
|
+
target: SessionCloseTarget;
|
|
10
|
+
} | {
|
|
11
|
+
kind: "resume";
|
|
12
|
+
target: SessionResumeTarget;
|
|
13
|
+
} | {
|
|
14
|
+
kind: "recent";
|
|
15
|
+
which: "create" | "resume" | "all";
|
|
16
|
+
} | {
|
|
17
|
+
kind: "usage";
|
|
18
|
+
message: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "reject";
|
|
21
|
+
reason: "invalid_target" | "prompt_unsupported";
|
|
22
|
+
message: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "none";
|
|
25
|
+
};
|
|
26
|
+
/** True when the text begins a /session_* command (cheap pre-gate). */
|
|
27
|
+
export declare function isLifecycleCommandText(text: string | undefined): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Parse a paired-chat message into a lifecycle command. Returns `none` for
|
|
30
|
+
* non-lifecycle text, `usage`/`reject` for malformed input (no side effect), or
|
|
31
|
+
* a validated `create`/`close`/`resume`/`recent` intent.
|
|
32
|
+
*
|
|
33
|
+
* The caller MUST have already enforced paired-chat authorization; this function
|
|
34
|
+
* performs grammar + target validation only.
|
|
35
|
+
*/
|
|
36
|
+
export declare function parseLifecycleCommand(text: string | undefined): ParsedLifecycleCommand;
|
|
37
|
+
/** The canonical usage text (exported for the daemon's help replies). */
|
|
38
|
+
export declare function lifecycleUsage(): string;
|
|
39
|
+
/**
|
|
40
|
+
* Shared target validator reused at the policy/effect boundary (after paired-chat
|
|
41
|
+
* auth, before any side effect). Returns null when valid, or an `invalid_target`
|
|
42
|
+
* reason. The orchestrator remains authoritative; this is a defensive pre-check
|
|
43
|
+
* the parser and any other entry point share.
|
|
44
|
+
*/
|
|
45
|
+
export declare function validateLifecycleTarget(verb: LifecycleCommandVerb, target: SessionCreateTarget | SessionCloseTarget | SessionResumeTarget): {
|
|
46
|
+
ok: true;
|
|
47
|
+
} | {
|
|
48
|
+
ok: false;
|
|
49
|
+
reason: "invalid_target";
|
|
50
|
+
message: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function normalizeLifecyclePath(value: string): string | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Map a lifecycle response/error to a user-facing Telegram message (G010).
|
|
55
|
+
*
|
|
56
|
+
* Only derives text from sessionId, mode, reason, a safe message, and candidate
|
|
57
|
+
* {sessionId,path} — never a token or prompt. Each error reason gets tailored,
|
|
58
|
+
* actionable copy; an "in progress" pending response is surfaced distinctly.
|
|
59
|
+
*/
|
|
60
|
+
export declare function formatLifecycleOutcome(r: SessionLifecycleResponse): string;
|