@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.
- package/README.md +46 -0
- package/dist/agent/runner.d.ts +117 -0
- package/dist/agent/runner.js +486 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +2 -0
- package/dist/chat-options.d.ts +37 -0
- package/dist/chat-options.js +42 -0
- package/dist/config.d.ts +66 -0
- package/dist/config.js +201 -0
- package/dist/conversation/index.d.ts +17 -0
- package/dist/conversation/index.js +54 -0
- package/dist/engine/agent-engine.d.ts +38 -0
- package/dist/engine/agent-engine.js +146 -0
- package/dist/engine/index.d.ts +50 -0
- package/dist/engine/index.js +26 -0
- package/dist/engine/services.d.ts +20 -0
- package/dist/engine/services.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/profile.d.ts +57 -0
- package/dist/profile.js +211 -0
- package/dist/runtime/index.d.ts +23 -0
- package/dist/runtime/index.js +177 -0
- package/dist/update.d.ts +16 -0
- package/dist/update.js +74 -0
- package/dist/workbench/auth-controller.d.ts +43 -0
- package/dist/workbench/auth-controller.js +84 -0
- package/dist/workbench/auth-gate-controller.d.ts +62 -0
- package/dist/workbench/auth-gate-controller.js +231 -0
- package/dist/workbench/command-controller.d.ts +29 -0
- package/dist/workbench/command-controller.js +426 -0
- package/dist/workbench/conversation-controller.d.ts +32 -0
- package/dist/workbench/conversation-controller.js +53 -0
- package/dist/workbench/engine.d.ts +66 -0
- package/dist/workbench/engine.js +291 -0
- package/dist/workbench/input-controller.d.ts +44 -0
- package/dist/workbench/input-controller.js +71 -0
- package/dist/workbench/isolator-installer.d.ts +29 -0
- package/dist/workbench/isolator-installer.js +208 -0
- package/dist/workbench/lifecycle-controller.d.ts +30 -0
- package/dist/workbench/lifecycle-controller.js +75 -0
- package/dist/workbench/local-controller.d.ts +21 -0
- package/dist/workbench/local-controller.js +94 -0
- package/dist/workbench/render-model.d.ts +46 -0
- package/dist/workbench/render-model.js +61 -0
- package/dist/workbench/runtime-controller.d.ts +12 -0
- package/dist/workbench/runtime-controller.js +57 -0
- package/dist/workbench/session.d.ts +29 -0
- package/dist/workbench/session.js +42 -0
- package/dist/workbench/settings-controller.d.ts +80 -0
- package/dist/workbench/settings-controller.js +309 -0
- package/dist/workbench/shell-isolation.d.ts +20 -0
- package/dist/workbench/shell-isolation.js +13 -0
- package/dist/workbench/state.d.ts +187 -0
- package/dist/workbench/state.js +392 -0
- package/dist/workbench/turn-controller.d.ts +25 -0
- package/dist/workbench/turn-controller.js +164 -0
- package/dist/workbench/view-model.d.ts +34 -0
- package/dist/workbench/view-model.js +121 -0
- package/dist/workdir/index.d.ts +22 -0
- package/dist/workdir/index.js +46 -0
- package/package.json +50 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { deleteProfile, formatDeviceUserCode, getAuthStatus, loginWithAPIKey, openBrowserURL, refreshActiveProfileIfNeeded, saveBrowserProfile, startBrowserAuthChallenge, waitForBrowserAuthChallenge, } from "../profile.js";
|
|
2
|
+
export function createWorkbenchAuthController(options = {}) {
|
|
3
|
+
const refreshActiveProfileIfNeededImpl = options.refreshActiveProfileIfNeededImpl ?? refreshActiveProfileIfNeeded;
|
|
4
|
+
const loginWithAPIKeyImpl = options.loginWithAPIKeyImpl ?? loginWithAPIKey;
|
|
5
|
+
const startBrowserAuthChallengeImpl = options.startBrowserAuthChallengeImpl ?? startBrowserAuthChallenge;
|
|
6
|
+
const openBrowserURLImpl = options.openBrowserURLImpl ?? openBrowserURL;
|
|
7
|
+
const waitForBrowserAuthChallengeImpl = options.waitForBrowserAuthChallengeImpl ?? waitForBrowserAuthChallenge;
|
|
8
|
+
const saveBrowserProfileImpl = options.saveBrowserProfileImpl ?? saveBrowserProfile;
|
|
9
|
+
const deleteProfileImpl = options.deleteProfileImpl ?? deleteProfile;
|
|
10
|
+
const getAuthStatusImpl = options.getAuthStatusImpl ?? getAuthStatus;
|
|
11
|
+
return {
|
|
12
|
+
async check(profile, refreshWindowMs = 5 * 60_000) {
|
|
13
|
+
const result = await refreshActiveProfileIfNeededImpl(profile, refreshWindowMs);
|
|
14
|
+
return { profileName: result.profile.name, refreshed: result.refreshed };
|
|
15
|
+
},
|
|
16
|
+
async loginAPIKey(input) {
|
|
17
|
+
const saved = await loginWithAPIKeyImpl(input);
|
|
18
|
+
return { profileName: saved.name };
|
|
19
|
+
},
|
|
20
|
+
async loginBrowser(input) {
|
|
21
|
+
const challenge = await startBrowserAuthChallengeImpl({
|
|
22
|
+
baseURL: input.baseURL,
|
|
23
|
+
clientName: input.clientName || "Agent API TUI",
|
|
24
|
+
});
|
|
25
|
+
input.onChallenge?.({
|
|
26
|
+
url: challenge.verification_uri_complete,
|
|
27
|
+
code: formatDeviceUserCode(challenge.user_code),
|
|
28
|
+
});
|
|
29
|
+
await openBrowserURLImpl(challenge.verification_uri_complete).catch(() => undefined);
|
|
30
|
+
const session = await waitForBrowserAuthChallengeImpl({
|
|
31
|
+
baseURL: input.baseURL,
|
|
32
|
+
challenge,
|
|
33
|
+
on_poll(result) {
|
|
34
|
+
if (result.status && result.status !== "pending") {
|
|
35
|
+
input.onStatus?.(result.status);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const saved = await saveBrowserProfileImpl(input.profile, input.baseURL, session);
|
|
40
|
+
return { profileName: saved.name };
|
|
41
|
+
},
|
|
42
|
+
async deleteProfile(name) {
|
|
43
|
+
await deleteProfileImpl(name);
|
|
44
|
+
},
|
|
45
|
+
async statusText(profile) {
|
|
46
|
+
return authStatusText(await getAuthStatusImpl(profile));
|
|
47
|
+
},
|
|
48
|
+
async refresh(profile, refreshWindowMs = 5 * 60_000) {
|
|
49
|
+
const result = await refreshActiveProfileIfNeededImpl(profile, refreshWindowMs);
|
|
50
|
+
return { refreshed: result.refreshed };
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function authStatusText(status) {
|
|
55
|
+
return [
|
|
56
|
+
`Profile: ${status.profile}`,
|
|
57
|
+
`Endpoint: ${status.baseURL}`,
|
|
58
|
+
`Auth: ${status.authType === "api_key" ? "API key" : "Browser session"}`,
|
|
59
|
+
`Account: ${summarizeMe(status.me)}`,
|
|
60
|
+
].join("\n");
|
|
61
|
+
}
|
|
62
|
+
function summarizeMe(me) {
|
|
63
|
+
if (!me || typeof me !== "object")
|
|
64
|
+
return "available";
|
|
65
|
+
const obj = me;
|
|
66
|
+
const candidates = [
|
|
67
|
+
obj.email,
|
|
68
|
+
obj.name,
|
|
69
|
+
obj.username,
|
|
70
|
+
obj.user_id,
|
|
71
|
+
obj.id,
|
|
72
|
+
nestedString(obj.user, "email"),
|
|
73
|
+
nestedString(obj.user, "name"),
|
|
74
|
+
nestedString(obj.user, "id"),
|
|
75
|
+
];
|
|
76
|
+
const picked = candidates.find((value) => typeof value === "string" && value.trim() !== "");
|
|
77
|
+
return picked || "available";
|
|
78
|
+
}
|
|
79
|
+
function nestedString(value, key) {
|
|
80
|
+
if (!value || typeof value !== "object")
|
|
81
|
+
return undefined;
|
|
82
|
+
const nested = value[key];
|
|
83
|
+
return typeof nested === "string" ? nested : undefined;
|
|
84
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type WorkbenchAuthController } from "./auth-controller.js";
|
|
2
|
+
export type AuthMethod = "browser" | "api_key" | "exit";
|
|
3
|
+
export type AuthGateState = {
|
|
4
|
+
status: "checking" | "select" | "api_profile" | "api_base_url" | "api_key" | "browser_profile" | "browser_base_url" | "browser_waiting" | "ready";
|
|
5
|
+
selectedMethod: number;
|
|
6
|
+
profile: string;
|
|
7
|
+
baseURL: string;
|
|
8
|
+
apiKey: string;
|
|
9
|
+
message: string;
|
|
10
|
+
error: string;
|
|
11
|
+
browserURL: string;
|
|
12
|
+
browserCode: string;
|
|
13
|
+
};
|
|
14
|
+
export interface AuthGateInputKey {
|
|
15
|
+
backspace?: boolean;
|
|
16
|
+
ctrl?: boolean;
|
|
17
|
+
delete?: boolean;
|
|
18
|
+
downArrow?: boolean;
|
|
19
|
+
meta?: boolean;
|
|
20
|
+
return?: boolean;
|
|
21
|
+
upArrow?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type AuthGateInputEffect = {
|
|
24
|
+
type: "exit";
|
|
25
|
+
} | {
|
|
26
|
+
type: "submit";
|
|
27
|
+
};
|
|
28
|
+
export interface AuthGateInputResult {
|
|
29
|
+
state: AuthGateState;
|
|
30
|
+
effects: AuthGateInputEffect[];
|
|
31
|
+
}
|
|
32
|
+
export interface AuthGateSubmitResult {
|
|
33
|
+
state: AuthGateState;
|
|
34
|
+
profileName?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WorkbenchAuthGateController {
|
|
37
|
+
authMethods: typeof authMethods;
|
|
38
|
+
initialState(input: {
|
|
39
|
+
profile?: string;
|
|
40
|
+
baseURL?: string;
|
|
41
|
+
apiKey?: string;
|
|
42
|
+
}): AuthGateState;
|
|
43
|
+
check(profile?: string): Promise<AuthGateSubmitResult>;
|
|
44
|
+
handleInput(input: string, key: AuthGateInputKey, state: AuthGateState): AuthGateInputResult;
|
|
45
|
+
submit(state: AuthGateState, options?: {
|
|
46
|
+
onState?: (state: AuthGateState) => void;
|
|
47
|
+
}): Promise<AuthGateSubmitResult>;
|
|
48
|
+
requestLogin(state: AuthGateState, profileName: string): AuthGateState;
|
|
49
|
+
requestLogout(state: AuthGateState, profileName: string): AuthGateState;
|
|
50
|
+
requestSwitchProfile(state: AuthGateState, currentProfile: string, nextProfile?: string): AuthGateState;
|
|
51
|
+
deletedProfile(state: AuthGateState, profileName: string): AuthGateState;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkbenchAuthGateControllerOptions {
|
|
54
|
+
authController?: WorkbenchAuthController;
|
|
55
|
+
formatError?: (error: unknown) => string;
|
|
56
|
+
}
|
|
57
|
+
export declare const authMethods: Array<{
|
|
58
|
+
method: AuthMethod;
|
|
59
|
+
label: string;
|
|
60
|
+
description: string;
|
|
61
|
+
}>;
|
|
62
|
+
export declare function createWorkbenchAuthGateController(options?: WorkbenchAuthGateControllerOptions): WorkbenchAuthGateController;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { defaultBaseURL } from "../config.js";
|
|
2
|
+
import { createWorkbenchAuthController, } from "./auth-controller.js";
|
|
3
|
+
export const authMethods = [
|
|
4
|
+
{ method: "browser", label: "Browser session", description: "Interactive login with refreshable local session." },
|
|
5
|
+
{ method: "api_key", label: "API key", description: "Paste a static API key for shell-only environments." },
|
|
6
|
+
{ method: "exit", label: "Exit", description: "Leave without signing in." },
|
|
7
|
+
];
|
|
8
|
+
export function createWorkbenchAuthGateController(options = {}) {
|
|
9
|
+
const authController = options.authController ?? createWorkbenchAuthController();
|
|
10
|
+
const formatError = options.formatError ?? userFacingError;
|
|
11
|
+
return {
|
|
12
|
+
authMethods,
|
|
13
|
+
initialState(input) {
|
|
14
|
+
return {
|
|
15
|
+
status: "checking",
|
|
16
|
+
selectedMethod: 0,
|
|
17
|
+
profile: input.profile || "default",
|
|
18
|
+
baseURL: input.baseURL || process.env.AGENT_API_BASE_URL || defaultBaseURL,
|
|
19
|
+
apiKey: input.apiKey || process.env.AGENT_API_KEY || "",
|
|
20
|
+
message: "Checking local auth profile...",
|
|
21
|
+
error: "",
|
|
22
|
+
browserURL: "",
|
|
23
|
+
browserCode: "",
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
async check(profile) {
|
|
27
|
+
try {
|
|
28
|
+
const result = await authController.check(profile);
|
|
29
|
+
return {
|
|
30
|
+
profileName: result.profileName,
|
|
31
|
+
state: readyState(profile || result.profileName, `Authenticated.`),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return {
|
|
36
|
+
state: selectState(profile || "default", "Choose an auth method to continue into the workbench.", formatError(error)),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
handleInput(input, key, state) {
|
|
41
|
+
if (key.ctrl && input === "c")
|
|
42
|
+
return inputResult(state, { type: "exit" });
|
|
43
|
+
if (state.status === "ready" || state.status === "checking" || state.status === "browser_waiting")
|
|
44
|
+
return inputResult(state);
|
|
45
|
+
if (state.status === "select")
|
|
46
|
+
return handleSelectInput(key, state);
|
|
47
|
+
if (key.return)
|
|
48
|
+
return inputResult(state, { type: "submit" });
|
|
49
|
+
if (key.backspace || key.delete)
|
|
50
|
+
return inputResult(editAuthField(state, (value) => value.slice(0, -1)));
|
|
51
|
+
if (input && !key.ctrl && !key.meta)
|
|
52
|
+
return inputResult(editAuthField(state, (value) => value + input));
|
|
53
|
+
return inputResult(state);
|
|
54
|
+
},
|
|
55
|
+
async submit(state, submitOptions = {}) {
|
|
56
|
+
const profile = state.profile.trim() || "default";
|
|
57
|
+
const baseURL = state.baseURL.trim() || defaultBaseURL;
|
|
58
|
+
switch (state.status) {
|
|
59
|
+
case "api_profile":
|
|
60
|
+
return { state: { ...state, profile, status: "api_base_url", error: "" } };
|
|
61
|
+
case "api_base_url":
|
|
62
|
+
return { state: { ...state, baseURL, status: "api_key", error: "" } };
|
|
63
|
+
case "api_key":
|
|
64
|
+
return loginWithAPIKey(authController, state, { baseURL, formatError, profile });
|
|
65
|
+
case "browser_profile":
|
|
66
|
+
return { state: { ...state, profile, status: "browser_base_url", error: "" } };
|
|
67
|
+
case "browser_base_url":
|
|
68
|
+
return loginWithBrowser(authController, state, { baseURL, formatError, onState: submitOptions.onState, profile });
|
|
69
|
+
default:
|
|
70
|
+
return { state };
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
requestLogin(state, profileName) {
|
|
74
|
+
return {
|
|
75
|
+
...state,
|
|
76
|
+
profile: profileName,
|
|
77
|
+
status: "select",
|
|
78
|
+
message: "Choose an auth method to continue into the workbench.",
|
|
79
|
+
error: "",
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
requestLogout(state, profileName) {
|
|
83
|
+
return {
|
|
84
|
+
...state,
|
|
85
|
+
profile: profileName,
|
|
86
|
+
status: "select",
|
|
87
|
+
message: `Logged out of profile "${profileName}" for this app session. Choose an auth method to continue.`,
|
|
88
|
+
error: "",
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
requestSwitchProfile(state, currentProfile, nextProfile) {
|
|
92
|
+
return {
|
|
93
|
+
...state,
|
|
94
|
+
profile: nextProfile || currentProfile,
|
|
95
|
+
status: "select",
|
|
96
|
+
message: nextProfile ? `Choose an auth method for profile "${nextProfile}".` : "Choose an auth method for another profile.",
|
|
97
|
+
error: "",
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
deletedProfile(state, profileName) {
|
|
101
|
+
return {
|
|
102
|
+
...state,
|
|
103
|
+
status: "select",
|
|
104
|
+
message: `Deleted profile "${profileName}". Choose an auth method to continue.`,
|
|
105
|
+
error: "",
|
|
106
|
+
};
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function handleSelectInput(key, state) {
|
|
111
|
+
if (key.upArrow) {
|
|
112
|
+
return inputResult({ ...state, selectedMethod: Math.max(0, state.selectedMethod - 1) });
|
|
113
|
+
}
|
|
114
|
+
if (key.downArrow) {
|
|
115
|
+
return inputResult({ ...state, selectedMethod: Math.min(authMethods.length - 1, state.selectedMethod + 1) });
|
|
116
|
+
}
|
|
117
|
+
if (key.return) {
|
|
118
|
+
const method = authMethods[state.selectedMethod]?.method;
|
|
119
|
+
if (method === "exit")
|
|
120
|
+
return inputResult(state, { type: "exit" });
|
|
121
|
+
return inputResult({
|
|
122
|
+
...state,
|
|
123
|
+
status: method === "api_key" ? "api_profile" : "browser_profile",
|
|
124
|
+
message: method === "api_key" ? "Save an API key profile." : "Create a browser session profile.",
|
|
125
|
+
error: "",
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return inputResult(state);
|
|
129
|
+
}
|
|
130
|
+
async function loginWithAPIKey(authController, state, input) {
|
|
131
|
+
const apiKey = state.apiKey.trim();
|
|
132
|
+
if (!apiKey)
|
|
133
|
+
return { state: { ...state, error: "API key is required." } };
|
|
134
|
+
const saving = { ...state, message: "Saving API key profile...", error: "" };
|
|
135
|
+
try {
|
|
136
|
+
const saved = await authController.loginAPIKey({ profile: input.profile, baseURL: input.baseURL, apiKey });
|
|
137
|
+
return {
|
|
138
|
+
profileName: saved.profileName,
|
|
139
|
+
state: { ...saving, status: "ready", message: `Signed in as profile "${input.profile}".`, error: "" },
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
return { state: { ...saving, error: input.formatError(error) } };
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async function loginWithBrowser(authController, state, input) {
|
|
147
|
+
const waiting = {
|
|
148
|
+
...state,
|
|
149
|
+
profile: input.profile,
|
|
150
|
+
baseURL: input.baseURL,
|
|
151
|
+
status: "browser_waiting",
|
|
152
|
+
message: "Starting browser auth challenge...",
|
|
153
|
+
error: "",
|
|
154
|
+
browserURL: "",
|
|
155
|
+
browserCode: "",
|
|
156
|
+
};
|
|
157
|
+
input.onState?.(waiting);
|
|
158
|
+
try {
|
|
159
|
+
const saved = await authController.loginBrowser({
|
|
160
|
+
profile: input.profile,
|
|
161
|
+
baseURL: input.baseURL,
|
|
162
|
+
onChallenge(challenge) {
|
|
163
|
+
input.onState?.({
|
|
164
|
+
...waiting,
|
|
165
|
+
message: "Open the URL to approve this terminal session.",
|
|
166
|
+
browserURL: challenge.url,
|
|
167
|
+
browserCode: challenge.code,
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
onStatus(status) {
|
|
171
|
+
input.onState?.({ ...waiting, message: `Browser auth status: ${status}` });
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
return {
|
|
175
|
+
profileName: saved.profileName,
|
|
176
|
+
state: { ...waiting, status: "ready", message: `Signed in as profile "${input.profile}".`, error: "" },
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return {
|
|
181
|
+
state: {
|
|
182
|
+
...waiting,
|
|
183
|
+
status: "select",
|
|
184
|
+
message: "Browser auth did not complete. Choose an auth method to continue.",
|
|
185
|
+
error: input.formatError(error),
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function editAuthField(state, update) {
|
|
191
|
+
switch (state.status) {
|
|
192
|
+
case "api_profile":
|
|
193
|
+
case "browser_profile":
|
|
194
|
+
return { ...state, profile: update(state.profile), error: "" };
|
|
195
|
+
case "api_base_url":
|
|
196
|
+
case "browser_base_url":
|
|
197
|
+
return { ...state, baseURL: update(state.baseURL), error: "" };
|
|
198
|
+
case "api_key":
|
|
199
|
+
return { ...state, apiKey: update(state.apiKey), error: "" };
|
|
200
|
+
default:
|
|
201
|
+
return state;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function readyState(profile, message) {
|
|
205
|
+
return {
|
|
206
|
+
status: "ready",
|
|
207
|
+
selectedMethod: 0,
|
|
208
|
+
profile,
|
|
209
|
+
baseURL: process.env.AGENT_API_BASE_URL || defaultBaseURL,
|
|
210
|
+
apiKey: process.env.AGENT_API_KEY || "",
|
|
211
|
+
message,
|
|
212
|
+
error: "",
|
|
213
|
+
browserURL: "",
|
|
214
|
+
browserCode: "",
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function selectState(profile, message, error = "") {
|
|
218
|
+
return {
|
|
219
|
+
...readyState(profile, message),
|
|
220
|
+
status: "select",
|
|
221
|
+
error,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function inputResult(state, ...effects) {
|
|
225
|
+
return { state, effects };
|
|
226
|
+
}
|
|
227
|
+
function userFacingError(error) {
|
|
228
|
+
if (error instanceof Error)
|
|
229
|
+
return error.message;
|
|
230
|
+
return String(error);
|
|
231
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentRunOptions } from "../agent.js";
|
|
2
|
+
import type { WorkbenchCommand } from "./state.js";
|
|
3
|
+
import type { WorkbenchAuthController } from "./auth-controller.js";
|
|
4
|
+
import type { WorkbenchConversationController } from "./conversation-controller.js";
|
|
5
|
+
import type { WorkbenchEffect, WorkbenchEngine } from "./engine.js";
|
|
6
|
+
import type { WorkbenchLocalController } from "./local-controller.js";
|
|
7
|
+
import type { WorkbenchSettingsController } from "./settings-controller.js";
|
|
8
|
+
import type { WorkbenchTurnController } from "./turn-controller.js";
|
|
9
|
+
export interface WorkbenchCommandController {
|
|
10
|
+
run(command: WorkbenchCommand): Promise<void>;
|
|
11
|
+
runEffects(effects: WorkbenchEffect[]): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkbenchCommandControllerOptions {
|
|
14
|
+
authController: WorkbenchAuthController;
|
|
15
|
+
conversationController: WorkbenchConversationController;
|
|
16
|
+
engine: WorkbenchEngine;
|
|
17
|
+
localController: WorkbenchLocalController;
|
|
18
|
+
options: AgentRunOptions;
|
|
19
|
+
profileName: string;
|
|
20
|
+
settingsController: WorkbenchSettingsController;
|
|
21
|
+
turnController: WorkbenchTurnController;
|
|
22
|
+
onDeleteProfile(): Promise<void>;
|
|
23
|
+
onExit(): void;
|
|
24
|
+
onLogin(): void;
|
|
25
|
+
onLogout(): void;
|
|
26
|
+
onSwitchProfile(name?: string): void;
|
|
27
|
+
}
|
|
28
|
+
export declare function createWorkbenchCommandController(options: WorkbenchCommandControllerOptions): WorkbenchCommandController;
|
|
29
|
+
export declare function normalizeOptionalSetting(value: string, clearValues: string[]): string | undefined;
|