@agent-api/app-engine 0.0.1 → 0.0.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/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/workbench/isolator-installer.d.ts +2 -0
- package/dist/workbench/isolator-installer.js +22 -0
- package/dist/workbench/settings-controller.js +8 -5
- package/package.json +1 -1
package/dist/engine/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { createWorkbenchEngine } from "../workbench/engine.js";
|
|
|
28
28
|
export type { WorkbenchInputController } from "../workbench/input-controller.js";
|
|
29
29
|
export { createWorkbenchInputController } from "../workbench/input-controller.js";
|
|
30
30
|
export type { IsolatorInstallConfig, IsolatorInstallOptions, IsolatorInstallResult, } from "../workbench/isolator-installer.js";
|
|
31
|
-
export { defaultIsolatorInstallPath, ensureConfiguredIsolator, installConfiguredIsolator, normalizeInstallPath, normalizeSourceURL, relocateInstalledIsolator, validateInstalledIsolator, } from "../workbench/isolator-installer.js";
|
|
31
|
+
export { defaultIsolatorInstallPath, ensureConfiguredIsolator, installConfiguredIsolator, normalizeInstallTargetPath, normalizeInstallPath, normalizeSourceURL, relocateInstalledIsolator, validateIsolatorInstallTarget, validateInstalledIsolator, } from "../workbench/isolator-installer.js";
|
|
32
32
|
export type { WorkbenchLifecycleController, WorkbenchLifecycleEffect, } from "../workbench/lifecycle-controller.js";
|
|
33
33
|
export { createWorkbenchLifecycleController, updateNoticeEffects, } from "../workbench/lifecycle-controller.js";
|
|
34
34
|
export type { WorkbenchLocalController } from "../workbench/local-controller.js";
|
package/dist/engine/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export { createWorkbenchCommandController } from "../workbench/command-controlle
|
|
|
13
13
|
export { createConversationName, createWorkbenchConversationController, defaultTranscriptExportPath, } from "../workbench/conversation-controller.js";
|
|
14
14
|
export { createWorkbenchEngine } from "../workbench/engine.js";
|
|
15
15
|
export { createWorkbenchInputController } from "../workbench/input-controller.js";
|
|
16
|
-
export { defaultIsolatorInstallPath, ensureConfiguredIsolator, installConfiguredIsolator, normalizeInstallPath, normalizeSourceURL, relocateInstalledIsolator, validateInstalledIsolator, } from "../workbench/isolator-installer.js";
|
|
16
|
+
export { defaultIsolatorInstallPath, ensureConfiguredIsolator, installConfiguredIsolator, normalizeInstallTargetPath, normalizeInstallPath, normalizeSourceURL, relocateInstalledIsolator, validateIsolatorInstallTarget, validateInstalledIsolator, } from "../workbench/isolator-installer.js";
|
|
17
17
|
export { createWorkbenchLifecycleController, updateNoticeEffects, } from "../workbench/lifecycle-controller.js";
|
|
18
18
|
export { createWorkbenchLocalController } from "../workbench/local-controller.js";
|
|
19
19
|
export { buildWorkbenchRenderModel, busySpinner, pendingLocalLabel, } from "../workbench/render-model.js";
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LocalRuntime, LocalRuntimeOptions } from "@agent-api/sdk/local";
|
|
2
2
|
export declare const defaultAppName = "agent-tui";
|
|
3
3
|
export declare const defaultAppAuthor = "AgentsWay";
|
|
4
|
-
export declare const defaultAppVersion = "0.3.
|
|
4
|
+
export declare const defaultAppVersion = "0.3.1";
|
|
5
5
|
export interface AgentAppRuntimeOptions extends Omit<LocalRuntimeOptions, "appName" | "appAuthor"> {
|
|
6
6
|
appName?: string;
|
|
7
7
|
appAuthor?: string;
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cp, mkdir, readFile, rename, rm, stat, writeFile } from "node:fs/promis
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
export const defaultAppName = "agent-tui";
|
|
5
5
|
export const defaultAppAuthor = "AgentsWay";
|
|
6
|
-
export const defaultAppVersion = "0.3.
|
|
6
|
+
export const defaultAppVersion = "0.3.1";
|
|
7
7
|
const defaultLegacyAppName = "agent-api-cli";
|
|
8
8
|
let migrationPromise = null;
|
|
9
9
|
let runtimeContext = createRuntimeContext();
|
|
@@ -22,8 +22,10 @@ export interface IsolatorInstallOptions {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function installConfiguredIsolator(config: IsolatorInstallConfig, options?: IsolatorInstallOptions): Promise<IsolatorInstallResult>;
|
|
24
24
|
export declare function validateInstalledIsolator(executablePath: string, options?: Pick<IsolatorInstallOptions, "probeTimeoutMs">): Promise<string>;
|
|
25
|
+
export declare function validateIsolatorInstallTarget(value: string): Promise<string>;
|
|
25
26
|
export declare function ensureConfiguredIsolator(config: IsolatorInstallConfig, options?: IsolatorInstallOptions): Promise<IsolatorEnsureResult>;
|
|
26
27
|
export declare function relocateInstalledIsolator(fromPath: string, toPath: string, options?: Pick<IsolatorInstallOptions, "probeTimeoutMs">): Promise<string>;
|
|
27
28
|
export declare function defaultIsolatorInstallPath(): string;
|
|
29
|
+
export declare function normalizeInstallTargetPath(value: string | null | undefined): Promise<string>;
|
|
28
30
|
export declare function normalizeSourceURL(value: string | null | undefined): string;
|
|
29
31
|
export declare function normalizeInstallPath(value: string | null | undefined): string;
|
|
@@ -55,6 +55,14 @@ export async function validateInstalledIsolator(executablePath, options = {}) {
|
|
|
55
55
|
await probeIsolator(normalized, options.probeTimeoutMs ?? 10_000);
|
|
56
56
|
return normalized;
|
|
57
57
|
}
|
|
58
|
+
export async function validateIsolatorInstallTarget(value) {
|
|
59
|
+
const normalized = await normalizeInstallTargetPath(value);
|
|
60
|
+
const targetDir = path.dirname(normalized);
|
|
61
|
+
await mkdir(targetDir, { recursive: true });
|
|
62
|
+
await ensureWritableDirectory(targetDir);
|
|
63
|
+
await existingTargetState(normalized);
|
|
64
|
+
return normalized;
|
|
65
|
+
}
|
|
58
66
|
export async function ensureConfiguredIsolator(config, options = {}) {
|
|
59
67
|
const sourceURL = normalizeSourceURL(config.sourceURL);
|
|
60
68
|
const executablePath = normalizeInstallPath(config.executablePath);
|
|
@@ -104,6 +112,20 @@ export async function relocateInstalledIsolator(fromPath, toPath, options = {})
|
|
|
104
112
|
export function defaultIsolatorInstallPath() {
|
|
105
113
|
return path.join(runtime.dirs.data, "bin", process.platform === "win32" ? "agent-isolator.exe" : "agent-isolator");
|
|
106
114
|
}
|
|
115
|
+
export async function normalizeInstallTargetPath(value) {
|
|
116
|
+
const normalized = normalizeInstallPath(value);
|
|
117
|
+
try {
|
|
118
|
+
const info = await stat(normalized);
|
|
119
|
+
if (info.isDirectory()) {
|
|
120
|
+
return path.join(normalized, process.platform === "win32" ? "agent-isolator.exe" : "agent-isolator");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
if (error?.code !== "ENOENT")
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
return normalized;
|
|
128
|
+
}
|
|
107
129
|
export function normalizeSourceURL(value) {
|
|
108
130
|
const trimmed = value?.trim();
|
|
109
131
|
if (!trimmed)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { clearPresetToolCatalogCache, isAvailablePreset, listAvailablePresets, } from "../agent.js";
|
|
2
2
|
import { loadWorkbenchPreferences, updateWorkbenchPreferences, } from "../config.js";
|
|
3
|
-
import { ensureConfiguredIsolator, installConfiguredIsolator, normalizeSourceURL, relocateInstalledIsolator,
|
|
3
|
+
import { ensureConfiguredIsolator, installConfiguredIsolator, normalizeSourceURL, relocateInstalledIsolator, validateIsolatorInstallTarget, } from "./isolator-installer.js";
|
|
4
4
|
export function createWorkbenchSettingsController(options = {}) {
|
|
5
5
|
const loadWorkbenchPreferencesImpl = options.loadWorkbenchPreferencesImpl ?? loadWorkbenchPreferences;
|
|
6
6
|
const updateWorkbenchPreferencesImpl = options.updateWorkbenchPreferencesImpl ?? updateWorkbenchPreferences;
|
|
@@ -39,7 +39,10 @@ export function createWorkbenchSettingsController(options = {}) {
|
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
41
|
async saveIsolatorPath(value) {
|
|
42
|
-
const
|
|
42
|
+
const rawExecutablePath = normalizeIsolatorPath(value);
|
|
43
|
+
const executablePath = rawExecutablePath
|
|
44
|
+
? await validateIsolatorInstallTarget(rawExecutablePath)
|
|
45
|
+
: null;
|
|
43
46
|
if (!executablePath) {
|
|
44
47
|
const preferences = await updateWorkbenchPreferencesImpl({ isolation: { executablePath } });
|
|
45
48
|
return {
|
|
@@ -66,12 +69,12 @@ export function createWorkbenchSettingsController(options = {}) {
|
|
|
66
69
|
}
|
|
67
70
|
const validatedPath = current?.executablePath
|
|
68
71
|
? await relocateInstalledIsolator(current.executablePath, executablePath, isolatorInstallOptions)
|
|
69
|
-
:
|
|
72
|
+
: executablePath;
|
|
70
73
|
const preferences = await updateWorkbenchPreferencesImpl({ isolation: { executablePath: validatedPath, installSkipped: false } });
|
|
71
74
|
return {
|
|
72
75
|
...settingsSnapshot(preferences),
|
|
73
|
-
message: `Saved
|
|
74
|
-
activity: "Isolator
|
|
76
|
+
message: `Saved isolator install target: ${formatIsolatorPath(preferences.isolation)}.`,
|
|
77
|
+
activity: "Isolator install target saved",
|
|
75
78
|
};
|
|
76
79
|
},
|
|
77
80
|
async saveIsolatorSource(value) {
|
package/package.json
CHANGED