@agent-api/app-engine 0.0.1

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 (62) hide show
  1. package/README.md +46 -0
  2. package/dist/agent/runner.d.ts +117 -0
  3. package/dist/agent/runner.js +486 -0
  4. package/dist/agent.d.ts +2 -0
  5. package/dist/agent.js +2 -0
  6. package/dist/chat-options.d.ts +37 -0
  7. package/dist/chat-options.js +42 -0
  8. package/dist/config.d.ts +66 -0
  9. package/dist/config.js +201 -0
  10. package/dist/conversation/index.d.ts +17 -0
  11. package/dist/conversation/index.js +54 -0
  12. package/dist/engine/agent-engine.d.ts +38 -0
  13. package/dist/engine/agent-engine.js +146 -0
  14. package/dist/engine/index.d.ts +50 -0
  15. package/dist/engine/index.js +26 -0
  16. package/dist/engine/services.d.ts +20 -0
  17. package/dist/engine/services.js +1 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +1 -0
  20. package/dist/profile.d.ts +57 -0
  21. package/dist/profile.js +211 -0
  22. package/dist/runtime/index.d.ts +23 -0
  23. package/dist/runtime/index.js +177 -0
  24. package/dist/update.d.ts +16 -0
  25. package/dist/update.js +74 -0
  26. package/dist/workbench/auth-controller.d.ts +43 -0
  27. package/dist/workbench/auth-controller.js +84 -0
  28. package/dist/workbench/auth-gate-controller.d.ts +62 -0
  29. package/dist/workbench/auth-gate-controller.js +231 -0
  30. package/dist/workbench/command-controller.d.ts +29 -0
  31. package/dist/workbench/command-controller.js +426 -0
  32. package/dist/workbench/conversation-controller.d.ts +32 -0
  33. package/dist/workbench/conversation-controller.js +53 -0
  34. package/dist/workbench/engine.d.ts +66 -0
  35. package/dist/workbench/engine.js +291 -0
  36. package/dist/workbench/input-controller.d.ts +44 -0
  37. package/dist/workbench/input-controller.js +71 -0
  38. package/dist/workbench/isolator-installer.d.ts +29 -0
  39. package/dist/workbench/isolator-installer.js +208 -0
  40. package/dist/workbench/lifecycle-controller.d.ts +30 -0
  41. package/dist/workbench/lifecycle-controller.js +75 -0
  42. package/dist/workbench/local-controller.d.ts +21 -0
  43. package/dist/workbench/local-controller.js +94 -0
  44. package/dist/workbench/render-model.d.ts +46 -0
  45. package/dist/workbench/render-model.js +61 -0
  46. package/dist/workbench/runtime-controller.d.ts +12 -0
  47. package/dist/workbench/runtime-controller.js +57 -0
  48. package/dist/workbench/session.d.ts +29 -0
  49. package/dist/workbench/session.js +42 -0
  50. package/dist/workbench/settings-controller.d.ts +80 -0
  51. package/dist/workbench/settings-controller.js +309 -0
  52. package/dist/workbench/shell-isolation.d.ts +20 -0
  53. package/dist/workbench/shell-isolation.js +13 -0
  54. package/dist/workbench/state.d.ts +187 -0
  55. package/dist/workbench/state.js +392 -0
  56. package/dist/workbench/turn-controller.d.ts +25 -0
  57. package/dist/workbench/turn-controller.js +164 -0
  58. package/dist/workbench/view-model.d.ts +34 -0
  59. package/dist/workbench/view-model.js +121 -0
  60. package/dist/workdir/index.d.ts +22 -0
  61. package/dist/workdir/index.js +46 -0
  62. package/package.json +50 -0
@@ -0,0 +1,309 @@
1
+ import { clearPresetToolCatalogCache, isAvailablePreset, listAvailablePresets, } from "../agent.js";
2
+ import { loadWorkbenchPreferences, updateWorkbenchPreferences, } from "../config.js";
3
+ import { ensureConfiguredIsolator, installConfiguredIsolator, normalizeSourceURL, relocateInstalledIsolator, validateInstalledIsolator, } from "./isolator-installer.js";
4
+ export function createWorkbenchSettingsController(options = {}) {
5
+ const loadWorkbenchPreferencesImpl = options.loadWorkbenchPreferencesImpl ?? loadWorkbenchPreferences;
6
+ const updateWorkbenchPreferencesImpl = options.updateWorkbenchPreferencesImpl ?? updateWorkbenchPreferences;
7
+ const isAvailablePresetImpl = options.isAvailablePresetImpl ?? isAvailablePreset;
8
+ const listAvailablePresetsImpl = options.listAvailablePresetsImpl ?? listAvailablePresets;
9
+ const clearPresetToolCatalogCacheImpl = options.clearPresetToolCatalogCacheImpl ?? clearPresetToolCatalogCache;
10
+ const isolatorInstallOptions = options.isolatorInstallOptions ?? {};
11
+ const formatError = options.formatError ?? userFacingError;
12
+ return {
13
+ async loadInitial(agentOptions) {
14
+ const loadedPreferences = await loadWorkbenchPreferencesImpl();
15
+ const { preferences, activity, warning } = await reconcileConfiguredIsolator(loadedPreferences, updateWorkbenchPreferencesImpl, isolatorInstallOptions, formatError);
16
+ return {
17
+ defaultPreset: preferences.defaultPreset,
18
+ ...(preferences.isolation ? { shellIsolation: preferences.isolation } : {}),
19
+ ...(activity ? { activity } : {}),
20
+ ...(isolatorSetupNotice(preferences.isolation) ? { notice: isolatorSetupNotice(preferences.isolation) } : {}),
21
+ ...(warning ? { warning } : {}),
22
+ runPreset: shouldApplyDefaultPreset(agentOptions)
23
+ ? effectiveDefaultPreset(preferences, agentOptions.preset)
24
+ : undefined,
25
+ };
26
+ },
27
+ async saveShellIsolationMode(value) {
28
+ const mode = normalizeShellIsolationMode(value);
29
+ const preferences = await updateWorkbenchPreferencesImpl({
30
+ isolation: {
31
+ mode,
32
+ installSkipped: mode === "none" ? true : false,
33
+ },
34
+ });
35
+ return {
36
+ ...settingsSnapshot(preferences),
37
+ message: `Saved shell isolation mode: ${formatShellIsolation(preferences.isolation)}.`,
38
+ activity: `Shell isolation mode saved: ${preferences.isolation?.mode ?? "auto"}`,
39
+ };
40
+ },
41
+ async saveIsolatorPath(value) {
42
+ const executablePath = normalizeIsolatorPath(value);
43
+ if (!executablePath) {
44
+ const preferences = await updateWorkbenchPreferencesImpl({ isolation: { executablePath } });
45
+ return {
46
+ ...settingsSnapshot(preferences),
47
+ message: `Saved isolator path: ${formatIsolatorPath(preferences.isolation)}.`,
48
+ activity: "Isolator path cleared",
49
+ };
50
+ }
51
+ const current = (await loadWorkbenchPreferencesImpl()).isolation;
52
+ if (current?.sourceURL) {
53
+ const result = await installConfiguredIsolator({
54
+ sourceURL: current.sourceURL,
55
+ executablePath,
56
+ sha256: current.sha256,
57
+ }, isolatorInstallOptions);
58
+ const preferences = await updateWorkbenchPreferencesImpl({
59
+ isolation: { executablePath: result.executablePath, sourceURL: result.sourceURL, sha256: result.sha256, installSkipped: false },
60
+ });
61
+ return {
62
+ ...settingsSnapshot(preferences),
63
+ message: `Installed isolator to ${result.executablePath}.`,
64
+ activity: result.replaced ? "Isolator refreshed" : "Isolator installed",
65
+ };
66
+ }
67
+ const validatedPath = current?.executablePath
68
+ ? await relocateInstalledIsolator(current.executablePath, executablePath, isolatorInstallOptions)
69
+ : await validateInstalledIsolator(executablePath, isolatorInstallOptions);
70
+ const preferences = await updateWorkbenchPreferencesImpl({ isolation: { executablePath: validatedPath, installSkipped: false } });
71
+ return {
72
+ ...settingsSnapshot(preferences),
73
+ message: `Saved verified isolator path: ${formatIsolatorPath(preferences.isolation)}.`,
74
+ activity: "Isolator path verified",
75
+ };
76
+ },
77
+ async saveIsolatorSource(value) {
78
+ const sourceURL = normalizeIsolatorSource(value);
79
+ const current = (await loadWorkbenchPreferencesImpl()).isolation;
80
+ if (!sourceURL) {
81
+ const preferences = await updateWorkbenchPreferencesImpl({ isolation: { sourceURL, sha256: null } });
82
+ return {
83
+ ...settingsSnapshot(preferences),
84
+ message: "Cleared isolator source URL.",
85
+ activity: "Isolator source cleared",
86
+ };
87
+ }
88
+ if (!current?.executablePath) {
89
+ throw new Error("Set a verified isolator path before saving a source URL.");
90
+ }
91
+ const result = await installConfiguredIsolator({
92
+ sourceURL,
93
+ executablePath: current.executablePath,
94
+ sha256: current.sha256,
95
+ }, isolatorInstallOptions);
96
+ const preferences = await updateWorkbenchPreferencesImpl({
97
+ isolation: { sourceURL: result.sourceURL, executablePath: result.executablePath, sha256: result.sha256, installSkipped: false },
98
+ });
99
+ return {
100
+ ...settingsSnapshot(preferences),
101
+ message: `Installed isolator from ${result.sourceURL}.`,
102
+ activity: result.replaced ? "Isolator refreshed from source" : "Isolator installed from source",
103
+ };
104
+ },
105
+ async saveDefaultPreset(input) {
106
+ const normalized = normalizeDefaultPreset(input.value);
107
+ if (typeof normalized === "string" && !(await isAvailablePresetImpl(input.profileName, normalized))) {
108
+ throw new UnknownPresetError(normalized);
109
+ }
110
+ const preferences = await updateWorkbenchPreferencesImpl({ defaultPreset: normalized });
111
+ return {
112
+ defaultPreset: preferences.defaultPreset,
113
+ ...(preferences.isolation ? { shellIsolation: preferences.isolation } : {}),
114
+ runPreset: shouldApplyDefaultPreset(input.options)
115
+ ? effectiveDefaultPreset(preferences, input.options.preset)
116
+ : undefined,
117
+ message: `Saved default preset: ${formatDefaultPreset(preferences.defaultPreset)}.`,
118
+ activity: `Default preset saved: ${formatDefaultPreset(preferences.defaultPreset)}`,
119
+ };
120
+ },
121
+ async validatePreset(profileName, preset) {
122
+ return isAvailablePresetImpl(profileName, preset);
123
+ },
124
+ async presetListText(input) {
125
+ try {
126
+ const presets = await listAvailablePresetsImpl(input.profileName);
127
+ return [
128
+ input.prefix,
129
+ "",
130
+ "Available presets:",
131
+ ...formatPresetList(presets, input.currentPreset),
132
+ ].join("\n");
133
+ }
134
+ catch (error) {
135
+ return [
136
+ input.prefix,
137
+ "",
138
+ `Available presets could not be loaded: ${formatError(error)}`,
139
+ ].join("\n");
140
+ }
141
+ },
142
+ configText: runConfigText,
143
+ defaultPresetHelp(defaultPreset) {
144
+ return `Default preset: ${formatDefaultPreset(defaultPreset)}. Use /config preset <name>, /config preset none, or /config preset reset.`;
145
+ },
146
+ shellIsolationHelp(shellIsolation) {
147
+ return `Shell isolation: ${formatShellIsolation(shellIsolation)}. Use /config isolation none, /config isolation auto, or /config isolation required.`;
148
+ },
149
+ isolatorPathHelp(shellIsolation) {
150
+ return [
151
+ `Isolator path: ${formatIsolatorPath(shellIsolation)}`,
152
+ `Isolator source: ${formatIsolatorSource(shellIsolation)}`,
153
+ "Use /config isolator path <absolute-path>, /config isolator source <https-url>, or /config isolator none to clear the path.",
154
+ ].join("\n");
155
+ },
156
+ clearPresetToolCatalogCache(baseURL) {
157
+ clearPresetToolCatalogCacheImpl(baseURL);
158
+ },
159
+ };
160
+ }
161
+ export class UnknownPresetError extends Error {
162
+ preset;
163
+ constructor(preset) {
164
+ super(`Unknown preset: ${preset}`);
165
+ this.preset = preset;
166
+ this.name = "UnknownPresetError";
167
+ }
168
+ }
169
+ export function normalizeDefaultPreset(value) {
170
+ const trimmed = value.trim();
171
+ const lowered = trimmed.toLowerCase();
172
+ if (!trimmed || lowered === "reset" || lowered === "default" || lowered === "builtin")
173
+ return undefined;
174
+ if (["none", "off", "disable", "disabled"].includes(lowered))
175
+ return null;
176
+ return trimmed;
177
+ }
178
+ export function formatDefaultPreset(value) {
179
+ if (value === undefined)
180
+ return "built-in (pro-search)";
181
+ return value ?? "none";
182
+ }
183
+ function settingsSnapshot(preferences) {
184
+ return {
185
+ ...("defaultPreset" in preferences ? { defaultPreset: preferences.defaultPreset } : {}),
186
+ ...(preferences.isolation ? { shellIsolation: preferences.isolation } : {}),
187
+ };
188
+ }
189
+ export function normalizeShellIsolationMode(value) {
190
+ const lowered = value.trim().toLowerCase();
191
+ if (lowered === "none" || lowered === "off" || lowered === "disable" || lowered === "disabled")
192
+ return "none";
193
+ if (lowered === "auto" || lowered === "default")
194
+ return "auto";
195
+ if (lowered === "required" || lowered === "require" || lowered === "strict")
196
+ return "required";
197
+ throw new Error("Unknown shell isolation mode. Use none, auto, or required.");
198
+ }
199
+ export function normalizeIsolatorPath(value) {
200
+ const trimmed = value.trim();
201
+ if (!trimmed)
202
+ throw new Error("Usage: /config isolator <path>, or /config isolator none.");
203
+ const lowered = trimmed.toLowerCase();
204
+ if (["none", "off", "disable", "disabled", "clear", "reset"].includes(lowered))
205
+ return null;
206
+ return trimmed;
207
+ }
208
+ export function normalizeIsolatorSource(value) {
209
+ const trimmed = value.trim();
210
+ if (!trimmed)
211
+ throw new Error("Usage: /config isolator source <https-url>, or /config isolator source none.");
212
+ const lowered = trimmed.toLowerCase();
213
+ if (["none", "off", "disable", "disabled", "clear", "reset"].includes(lowered))
214
+ return null;
215
+ return normalizeSourceURL(trimmed);
216
+ }
217
+ export function formatShellIsolation(value) {
218
+ return value?.mode ?? "auto";
219
+ }
220
+ export function formatIsolatorPath(value) {
221
+ return value?.executablePath || process.env.AGENT_ISOLATOR_PATH || "not configured";
222
+ }
223
+ export function formatIsolatorSource(value) {
224
+ return value?.sourceURL || "not configured";
225
+ }
226
+ export function effectiveDefaultPreset(preferences, builtInPreset) {
227
+ if ("defaultPreset" in preferences)
228
+ return preferences.defaultPreset ?? undefined;
229
+ return builtInPreset;
230
+ }
231
+ export function formatPresetList(presets, currentPreset) {
232
+ if (presets.length === 0)
233
+ return ["- none returned by this endpoint"];
234
+ return presets.map((preset) => {
235
+ const description = preset.description ? ` - ${preset.description}` : "";
236
+ const current = currentPreset && preset.preset === currentPreset;
237
+ return `${current ? "*" : "-"} ${preset.preset}${current ? " (current)" : ""}${description}`;
238
+ });
239
+ }
240
+ function shouldApplyDefaultPreset(options) {
241
+ return !options.presetExplicit && !options.modelExplicit;
242
+ }
243
+ function runConfigText({ accessMode, contextEnabled, defaultPreset, profileName, runModel, runPreset, renderMode, shellIsolation, }) {
244
+ return [
245
+ `Profile: ${profileName}`,
246
+ `Preset: ${runPreset || "none"}`,
247
+ `Default preset: ${formatDefaultPreset(defaultPreset)}`,
248
+ `Model: ${runModel || "auto"}`,
249
+ `Render mode: ${renderMode}`,
250
+ `Shell isolation: ${formatShellIsolation(shellIsolation)}`,
251
+ `Isolator path: ${formatIsolatorPath(shellIsolation)}`,
252
+ `Isolator source: ${formatIsolatorSource(shellIsolation)}`,
253
+ `local_workdir tool: ${contextEnabled ? "on" : "off"}`,
254
+ `local_shell tool: ${contextEnabled ? "on" : "off"}`,
255
+ `Local access: ${accessMode}`,
256
+ ].join("\n");
257
+ }
258
+ function userFacingError(error) {
259
+ if (error instanceof Error)
260
+ return error.message;
261
+ return String(error);
262
+ }
263
+ function isolatorSetupNotice(shellIsolation) {
264
+ if (process.env.AGENT_ISOLATOR_PATH)
265
+ return "";
266
+ if (shellIsolation?.installSkipped || shellIsolation?.mode === "none" || shellIsolation?.executablePath)
267
+ return "";
268
+ return [
269
+ "Local shell isolation is not configured yet.",
270
+ "",
271
+ "To enable it, set a verified target path and downloadable source URL:",
272
+ "/config isolator path <absolute-path>",
273
+ "/config isolator source <https-url>",
274
+ "",
275
+ "To skip this setup for future starts, use /config isolation none.",
276
+ ].join("\n");
277
+ }
278
+ async function reconcileConfiguredIsolator(preferences, updatePreferences, installOptions, formatError) {
279
+ const isolation = preferences.isolation;
280
+ if (!isolation?.sourceURL || !isolation.executablePath)
281
+ return { preferences };
282
+ try {
283
+ const result = await ensureConfiguredIsolator({
284
+ sourceURL: isolation.sourceURL,
285
+ executablePath: isolation.executablePath,
286
+ sha256: isolation.sha256,
287
+ }, installOptions);
288
+ if (!result.repaired)
289
+ return { preferences };
290
+ const updated = await updatePreferences({
291
+ isolation: {
292
+ sourceURL: result.sourceURL,
293
+ executablePath: result.executablePath,
294
+ sha256: result.sha256,
295
+ installSkipped: false,
296
+ },
297
+ });
298
+ return {
299
+ preferences: updated,
300
+ activity: `Reinstalled isolator: ${result.executablePath}`,
301
+ };
302
+ }
303
+ catch (error) {
304
+ return {
305
+ preferences,
306
+ warning: `Configured isolator is unavailable: ${formatError(error)}`,
307
+ };
308
+ }
309
+ }
@@ -0,0 +1,20 @@
1
+ export type ShellIsolationMode = "none" | "auto" | "required";
2
+ export interface ShellIsolationPreferences {
3
+ mode?: ShellIsolationMode;
4
+ executablePath?: string | null;
5
+ version?: string | null;
6
+ sourceURL?: string | null;
7
+ sha256?: string | null;
8
+ installSkipped?: boolean | null;
9
+ }
10
+ export declare function localShellIsolationOptions(preferences?: ShellIsolationPreferences): {
11
+ readonly isolator?: {
12
+ executablePath: string;
13
+ } | undefined;
14
+ readonly isolation: ShellIsolationMode;
15
+ readonly isolationOptions: {
16
+ readonly filesystem: "workdir-readwrite";
17
+ readonly network: "allowed";
18
+ readonly env: "inherit";
19
+ };
20
+ };
@@ -0,0 +1,13 @@
1
+ export function localShellIsolationOptions(preferences = {}) {
2
+ const executablePath = preferences.executablePath?.trim() || process.env.AGENT_ISOLATOR_PATH?.trim();
3
+ const isolation = preferences.mode ?? "auto";
4
+ return {
5
+ isolation,
6
+ isolationOptions: {
7
+ filesystem: "workdir-readwrite",
8
+ network: "allowed",
9
+ env: "inherit",
10
+ },
11
+ ...(executablePath ? { isolator: { executablePath } } : {}),
12
+ };
13
+ }
@@ -0,0 +1,187 @@
1
+ import type { LocalToolApprovalRequest, WorkdirAccessMode } from "../agent.js";
2
+ import type { ShellIsolationPreferences } from "../workbench/shell-isolation.js";
3
+ export type WorkbenchRole = "user" | "assistant" | "system";
4
+ export interface WorkbenchMessage {
5
+ id: string;
6
+ role: WorkbenchRole;
7
+ text: string;
8
+ }
9
+ export type ActivityLevel = "info" | "success" | "warning" | "error";
10
+ export interface WorkbenchActivity {
11
+ id: string;
12
+ level: ActivityLevel;
13
+ text: string;
14
+ timestamp: number;
15
+ }
16
+ export interface WorkbenchWorkdirStatus {
17
+ root: string;
18
+ name: string;
19
+ fileCount: number;
20
+ totalBytes: number;
21
+ scanTruncated: boolean;
22
+ }
23
+ export interface LocalToolApproval extends LocalToolApprovalRequest {
24
+ id: string;
25
+ createdAt: number;
26
+ }
27
+ export type RenderMode = "markdown" | "raw";
28
+ export interface WorkbenchState {
29
+ messages: WorkbenchMessage[];
30
+ activities: WorkbenchActivity[];
31
+ busy: boolean;
32
+ contextEnabled: boolean;
33
+ workdir: WorkbenchWorkdirStatus | null;
34
+ activeAssistantMessageId: string | null;
35
+ pendingLocalTool: LocalToolApproval | null;
36
+ accessMode: WorkdirAccessMode;
37
+ currentConversation: string;
38
+ runPreset?: string;
39
+ runModel?: string;
40
+ renderMode: RenderMode;
41
+ defaultPreset?: string | null;
42
+ shellIsolation?: ShellIsolationPreferences;
43
+ }
44
+ export interface InputHistory {
45
+ record(value: string): void;
46
+ previous(currentDraft: string): string;
47
+ next(currentDraft: string): string;
48
+ reset(): void;
49
+ values(): string[];
50
+ }
51
+ export type WorkbenchAction = {
52
+ type: "message.add";
53
+ role: WorkbenchRole;
54
+ text: string;
55
+ id?: string;
56
+ } | {
57
+ type: "message.append";
58
+ id: string;
59
+ delta: string;
60
+ } | {
61
+ type: "messages.clear";
62
+ } | {
63
+ type: "activity.add";
64
+ level?: ActivityLevel;
65
+ text: string;
66
+ } | {
67
+ type: "busy.set";
68
+ busy: boolean;
69
+ } | {
70
+ type: "context.toggle";
71
+ } | {
72
+ type: "context.set";
73
+ enabled: boolean;
74
+ } | {
75
+ type: "workdir.set";
76
+ workdir: WorkbenchWorkdirStatus;
77
+ } | {
78
+ type: "assistant.active";
79
+ id: string | null;
80
+ } | {
81
+ type: "local_tool.pending.set";
82
+ approval: LocalToolApprovalRequest;
83
+ } | {
84
+ type: "local_tool.pending.clear";
85
+ } | {
86
+ type: "access.set";
87
+ mode: WorkdirAccessMode;
88
+ } | {
89
+ type: "conversation.set";
90
+ name: string;
91
+ } | {
92
+ type: "settings.set";
93
+ settings: Partial<Pick<WorkbenchState, "runPreset" | "runModel" | "renderMode" | "defaultPreset" | "shellIsolation">>;
94
+ };
95
+ export type WorkbenchCommand = {
96
+ kind: "invalid";
97
+ command: string;
98
+ } | {
99
+ kind: "abort";
100
+ } | {
101
+ kind: "quit";
102
+ } | {
103
+ kind: "help";
104
+ } | {
105
+ kind: "clear";
106
+ } | {
107
+ kind: "login";
108
+ } | {
109
+ kind: "logout";
110
+ } | {
111
+ kind: "delete_profile";
112
+ } | {
113
+ kind: "switch_profile";
114
+ name?: string;
115
+ } | {
116
+ kind: "auth_status";
117
+ } | {
118
+ kind: "config";
119
+ field?: "preset" | "isolation" | "isolator";
120
+ value?: string;
121
+ } | {
122
+ kind: "render";
123
+ mode?: RenderMode;
124
+ } | {
125
+ kind: "transcript";
126
+ } | {
127
+ kind: "export";
128
+ path?: string;
129
+ } | {
130
+ kind: "context";
131
+ enabled?: boolean;
132
+ } | {
133
+ kind: "workdir";
134
+ enabled?: boolean;
135
+ } | {
136
+ kind: "access";
137
+ mode?: WorkdirAccessMode;
138
+ } | {
139
+ kind: "preset";
140
+ value?: string;
141
+ } | {
142
+ kind: "model";
143
+ value?: string;
144
+ } | {
145
+ kind: "summary";
146
+ } | {
147
+ kind: "search";
148
+ query: string;
149
+ } | {
150
+ kind: "new_conversation";
151
+ name?: string;
152
+ } | {
153
+ kind: "switch_conversation";
154
+ name: string;
155
+ } | {
156
+ kind: "list_conversations";
157
+ } | {
158
+ kind: "refresh_catalog";
159
+ } | {
160
+ kind: "preview";
161
+ } | {
162
+ kind: "apply";
163
+ } | {
164
+ kind: "apply_all";
165
+ } | {
166
+ kind: "reject";
167
+ };
168
+ export declare function createInitialWorkbenchState(options: {
169
+ contextEnabled: boolean;
170
+ accessMode?: WorkdirAccessMode;
171
+ conversation?: string;
172
+ preset?: string;
173
+ model?: string;
174
+ renderMode?: RenderMode;
175
+ defaultPreset?: string | null;
176
+ shellIsolation?: ShellIsolationPreferences;
177
+ }): WorkbenchState;
178
+ export declare function createInputHistory(limit?: number): InputHistory;
179
+ export declare function workbenchReducer(state: WorkbenchState, action: WorkbenchAction): WorkbenchState;
180
+ export declare function parseWorkbenchCommand(input: string): WorkbenchCommand | null;
181
+ export declare function parsePendingApprovalCommand(input: string): WorkbenchCommand | null;
182
+ export declare function helpText(): string;
183
+ export declare function formatTranscript(messages: WorkbenchMessage[]): string;
184
+ export declare function formatTranscriptPreview(messages: WorkbenchMessage[], maxLines?: number): string;
185
+ export declare function workdirText(status: WorkbenchWorkdirStatus | null): string;
186
+ export declare function formatBytes(bytes: number): string;
187
+ export declare function activityColor(level: ActivityLevel): "green" | "yellow" | "red" | "gray";