agentic-engineering-harness 0.6.0 → 0.6.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/README.md +8 -3
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/assets.d.ts +13 -0
- package/dist/core/assets.js +115 -0
- package/dist/core/assets.js.map +1 -0
- package/dist/core/init.js +4 -10
- package/dist/core/init.js.map +1 -1
- package/dist/entry.js +33 -1
- package/dist/entry.js.map +1 -1
- package/dist/paseo/runtime.d.ts +31 -0
- package/dist/paseo/runtime.js +158 -0
- package/dist/paseo/runtime.js.map +1 -0
- package/dist/paseo/sdk.d.ts +79 -0
- package/dist/paseo/sdk.js +161 -0
- package/dist/paseo/sdk.js.map +1 -0
- package/dist/paseo/sdkResolve.d.ts +17 -0
- package/dist/paseo/sdkResolve.js +70 -0
- package/dist/paseo/sdkResolve.js.map +1 -0
- package/dist/paseo/start.d.ts +7 -1
- package/dist/paseo/start.js +40 -42
- package/dist/paseo/start.js.map +1 -1
- package/dist/toolchain/setup.js +2 -0
- package/dist/toolchain/setup.js.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/workers/agentPrompt.js +24 -29
- package/dist/workers/agentPrompt.js.map +1 -1
- package/dist/workers/paseo.d.ts +0 -1
- package/dist/workers/paseo.js +39 -27
- package/dist/workers/paseo.js.map +1 -1
- package/docs/PASEO.md +53 -20
- package/docs/PUBLISHING.md +53 -44
- package/package.json +86 -11
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { buildPaseoBackgroundRunCommand, detectPaseoCapabilities, extractPaseoAgentId } from "./capabilities.js";
|
|
3
|
+
import { PaseoSdkUnavailableError, createPaseoSdkAgent, inspectPaseoSdkAgent, listPaseoSdkAgents, probePaseoSdkAgent, runPaseoSdkAgent } from "./sdk.js";
|
|
4
|
+
import { runProcess } from "../utils/process.js";
|
|
5
|
+
const DEFAULT_DEPS = {
|
|
6
|
+
run: runProcess,
|
|
7
|
+
detectCapabilities: detectPaseoCapabilities,
|
|
8
|
+
sdk: { create: createPaseoSdkAgent, run: runPaseoSdkAgent, probe: probePaseoSdkAgent, inspect: inspectPaseoSdkAgent, list: listPaseoSdkAgents }
|
|
9
|
+
};
|
|
10
|
+
export async function launchManagedPaseoAgent(root, options, deps = DEFAULT_DEPS) {
|
|
11
|
+
if (preferSdk(options)) {
|
|
12
|
+
try {
|
|
13
|
+
const result = await deps.sdk.create(root, { ...options, timeoutMs: options.timeoutMs ?? timeoutMs(options.timeoutSeconds) });
|
|
14
|
+
return fromSdk(result);
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (!sdkCanFallback(error))
|
|
18
|
+
throw error;
|
|
19
|
+
return launchCli(root, options, deps, `SDK unavailable: ${error instanceof Error ? error.message : String(error)}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return launchCli(root, options, deps, "SDK skipped because no explicit provider/model was available or AEH_PASEO_FORCE_CLI=1.");
|
|
23
|
+
}
|
|
24
|
+
export async function continueManagedPaseoAgent(root, agentId, prompt, timeoutSeconds, deps = DEFAULT_DEPS) {
|
|
25
|
+
if (!forceCli()) {
|
|
26
|
+
try {
|
|
27
|
+
return fromSdk(await deps.sdk.run(root, agentId, prompt, timeoutMs(timeoutSeconds)));
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
if (!sdkCanFallback(error))
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const timeout = timeoutSeconds ?? 1800;
|
|
35
|
+
const send = await deps.run(`paseo send ${quote(agentId)} --no-wait ${quote(prompt)}`, { cwd: root, timeoutMs: 60_000 });
|
|
36
|
+
if (send.exitCode !== 0)
|
|
37
|
+
return { id: agentId, exitCode: send.exitCode, stdout: send.stdout, stderr: send.stderr, transport: "cli" };
|
|
38
|
+
const wait = await deps.run(`paseo wait ${quote(agentId)} --timeout ${timeout}`, { cwd: root, timeoutMs: (timeout + 30) * 1000 });
|
|
39
|
+
const logs = await deps.run(`paseo logs ${quote(agentId)} --tail 200`, { cwd: root, timeoutMs: 60_000 });
|
|
40
|
+
return { id: agentId, exitCode: wait.exitCode, stdout: logs.stdout || wait.stdout, stderr: [send.stderr, wait.stderr, logs.stderr].filter(Boolean).join("\n"), transport: "cli" };
|
|
41
|
+
}
|
|
42
|
+
export async function probeManagedPaseoAgent(root, agentId, deps = DEFAULT_DEPS) {
|
|
43
|
+
if (!forceCli()) {
|
|
44
|
+
try {
|
|
45
|
+
return await deps.sdk.probe(root, agentId);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (!sdkCanFallback(error))
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const probe = await deps.run(`paseo logs ${quote(agentId)} --tail 1`, { cwd: root, timeoutMs: 30_000 });
|
|
53
|
+
return probe.exitCode === 0;
|
|
54
|
+
}
|
|
55
|
+
export async function inspectManagedPaseoAgent(root, agentId, deps = DEFAULT_DEPS) {
|
|
56
|
+
if (!forceCli()) {
|
|
57
|
+
try {
|
|
58
|
+
return await deps.sdk.inspect(root, agentId);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (!sdkCanFallback(error))
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return (await listCliAgents(root, deps)).find((agent) => agent.id === agentId);
|
|
66
|
+
}
|
|
67
|
+
export async function listManagedPaseoAgents(root, labels = {}, deps = DEFAULT_DEPS) {
|
|
68
|
+
if (!forceCli()) {
|
|
69
|
+
try {
|
|
70
|
+
return await deps.sdk.list(root, labels);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (!sdkCanFallback(error))
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return (await listCliAgents(root, deps)).filter((agent) => Object.entries(labels).every(([key, value]) => agent.labels?.[key] === value));
|
|
78
|
+
}
|
|
79
|
+
async function launchCli(root, options, deps, fallbackReason) {
|
|
80
|
+
if (options.prompt === undefined && options.systemPrompt !== undefined) {
|
|
81
|
+
throw new PaseoSdkUnavailableError(`Paseo SDK is required to create an idle systemPrompt-only agent. Refusing CLI fallback because it would expose session instructions as a user turn. ${fallbackReason}`);
|
|
82
|
+
}
|
|
83
|
+
const capabilities = await deps.detectCapabilities(root, deps.run);
|
|
84
|
+
const prompt = options.prompt;
|
|
85
|
+
if (prompt === undefined)
|
|
86
|
+
throw new Error("Paseo CLI fallback requires a prompt.");
|
|
87
|
+
const timeout = options.timeoutSeconds ?? Math.max(1, Math.ceil((options.timeoutMs ?? 1_800_000) / 1000));
|
|
88
|
+
if (options.outputSchema) {
|
|
89
|
+
if (!capabilities.outputSchema)
|
|
90
|
+
throw new Error(`Installed Paseo${capabilities.version ? ` ${capabilities.version}` : ""} does not advertise --output-schema required by this agent.`);
|
|
91
|
+
const parts = ["paseo run --quiet", `--title ${quote(options.title)}`, `--provider ${quote(options.provider)}`];
|
|
92
|
+
if (options.workspaceId)
|
|
93
|
+
parts.push(`--workspace ${quote(options.workspaceId)}`);
|
|
94
|
+
if (options.model)
|
|
95
|
+
parts.push(`--model ${quote(options.model)}`);
|
|
96
|
+
parts.push(`--output-schema ${quote(JSON.stringify(options.outputSchema))}`, quote(prompt));
|
|
97
|
+
const result = await deps.run(parts.join(" "), { cwd: root, timeoutMs: timeout * 1000 });
|
|
98
|
+
return { exitCode: result.exitCode, stdout: result.stdout, stderr: [fallbackReason, result.stderr].filter(Boolean).join("\n"), transport: "cli" };
|
|
99
|
+
}
|
|
100
|
+
const command = buildPaseoBackgroundRunCommand({ title: options.title, provider: options.provider, model: options.model, workspaceId: options.workspaceId, prompt }, capabilities);
|
|
101
|
+
const launch = await deps.run(command, { cwd: root, timeoutMs: 60_000 });
|
|
102
|
+
if (launch.exitCode !== 0)
|
|
103
|
+
return { exitCode: launch.exitCode, stdout: launch.stdout, stderr: [fallbackReason, launch.stderr].filter(Boolean).join("\n"), transport: "cli" };
|
|
104
|
+
const id = extractPaseoAgentId(launch.stdout);
|
|
105
|
+
if (!id)
|
|
106
|
+
return { exitCode: 1, stdout: launch.stdout, stderr: [fallbackReason, "Paseo returned no parseable agent id."].join("\n"), transport: "cli" };
|
|
107
|
+
const wait = await deps.run(`paseo wait ${quote(id)} --timeout ${timeout}`, { cwd: root, timeoutMs: (timeout + 30) * 1000 });
|
|
108
|
+
const logs = await deps.run(`paseo logs ${quote(id)} --tail 200`, { cwd: root, timeoutMs: 60_000 });
|
|
109
|
+
return { id, exitCode: wait.exitCode, stdout: logs.stdout || wait.stdout || launch.stdout, stderr: [fallbackReason, launch.stderr, wait.stderr, logs.stderr].filter(Boolean).join("\n"), transport: "cli" };
|
|
110
|
+
}
|
|
111
|
+
async function listCliAgents(root, deps) {
|
|
112
|
+
const result = await deps.run("paseo ls -a -g --json", { cwd: root, timeoutMs: 30_000 });
|
|
113
|
+
if (result.exitCode !== 0 || !result.stdout.trim())
|
|
114
|
+
return [];
|
|
115
|
+
try {
|
|
116
|
+
const records = new Map();
|
|
117
|
+
collectCliAgents(JSON.parse(result.stdout), records);
|
|
118
|
+
return [...records.values()];
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function collectCliAgents(value, out) {
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
for (const child of value)
|
|
127
|
+
collectCliAgents(child, out);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
if (!value || typeof value !== "object")
|
|
131
|
+
return;
|
|
132
|
+
const record = value;
|
|
133
|
+
const id = firstString(record, ["id", "agentId", "agent_id"]);
|
|
134
|
+
if (id && ("status" in record || "title" in record || "labels" in record)) {
|
|
135
|
+
out.set(id, { id, title: firstString(record, ["title", "name"]), status: statusText(record.status), workspaceId: firstString(record, ["workspaceId", "workspace_id"]), labels: stringRecord(record.labels), raw: record });
|
|
136
|
+
}
|
|
137
|
+
for (const child of Object.values(record))
|
|
138
|
+
collectCliAgents(child, out);
|
|
139
|
+
}
|
|
140
|
+
function preferSdk(options) { return !forceCli() && (Boolean(options.model) || options.provider.includes("/")); }
|
|
141
|
+
function forceCli() { return process.env.AEH_PASEO_FORCE_CLI === "1"; }
|
|
142
|
+
function sdkCanFallback(error) { return error instanceof PaseoSdkUnavailableError || (error instanceof Error && error.name === "PaseoSdkUnavailableError"); }
|
|
143
|
+
function timeoutMs(seconds) { return (seconds ?? 1800) * 1000; }
|
|
144
|
+
function fromSdk(result) { return { id: result.id, exitCode: sdkExitCode(result.status, result.error), stdout: result.lastMessage ?? "", stderr: result.error ?? "", status: result.status, transport: "sdk" }; }
|
|
145
|
+
function sdkExitCode(status, error) { if (error)
|
|
146
|
+
return 1; return !status || status === "idle" ? 0 : status === "timeout" ? 124 : 1; }
|
|
147
|
+
function firstString(record, keys) { for (const key of keys)
|
|
148
|
+
if (typeof record[key] === "string" && record[key])
|
|
149
|
+
return record[key]; return undefined; }
|
|
150
|
+
function stringRecord(value) { if (!value || typeof value !== "object" || Array.isArray(value))
|
|
151
|
+
return undefined; const result = {}; for (const [key, item] of Object.entries(value))
|
|
152
|
+
if (typeof item === "string")
|
|
153
|
+
result[key] = item; return Object.keys(result).length ? result : undefined; }
|
|
154
|
+
function statusText(value) { if (typeof value === "string")
|
|
155
|
+
return value; if (value && typeof value === "object" && typeof value.status === "string")
|
|
156
|
+
return value.status; return undefined; }
|
|
157
|
+
function quote(value) { return `'${value.replaceAll("'", "'\\''")}'`; }
|
|
158
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/paseo/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,8BAA8B,E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|
|
8
|
+
prompt?: string;
|
|
9
|
+
outputSchema?: Record<string, unknown>;
|
|
10
|
+
labels?: Record<string, string>;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
waitForFinish?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface PaseoSdkAgentResult {
|
|
15
|
+
id: string;
|
|
16
|
+
workspaceId?: string;
|
|
17
|
+
status?: string;
|
|
18
|
+
lastMessage?: string;
|
|
19
|
+
error?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PaseoSdkAgentRecord {
|
|
22
|
+
id: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
status?: string;
|
|
25
|
+
workspaceId?: string;
|
|
26
|
+
labels?: Record<string, string>;
|
|
27
|
+
raw: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
interface PaseoSdkTurnResult {
|
|
30
|
+
status: string;
|
|
31
|
+
lastMessage?: string;
|
|
32
|
+
error?: string;
|
|
33
|
+
}
|
|
34
|
+
interface PaseoSdkAgentHandle {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
readonly workspaceId: string | null;
|
|
37
|
+
readonly status: unknown;
|
|
38
|
+
refresh(requestId?: string): Promise<{
|
|
39
|
+
agent: Record<string, unknown>;
|
|
40
|
+
project: unknown;
|
|
41
|
+
} | null>;
|
|
42
|
+
run(text: string, options?: {
|
|
43
|
+
timeoutMs?: number;
|
|
44
|
+
}): Promise<PaseoSdkTurnResult>;
|
|
45
|
+
waitForFinish(timeoutMs?: number): Promise<PaseoSdkTurnResult>;
|
|
46
|
+
}
|
|
47
|
+
interface PaseoSdkWorkspaceHandle {
|
|
48
|
+
readonly agents: {
|
|
49
|
+
create(options: Record<string, unknown>): Promise<PaseoSdkAgentHandle>;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
interface PaseoSdkClient {
|
|
53
|
+
readonly agents: {
|
|
54
|
+
create(options: Record<string, unknown>): Promise<PaseoSdkAgentHandle>;
|
|
55
|
+
ref(agentId: string): PaseoSdkAgentHandle;
|
|
56
|
+
list(options?: Record<string, unknown>): Promise<{
|
|
57
|
+
entries: Array<{
|
|
58
|
+
agent: Record<string, unknown>;
|
|
59
|
+
}>;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
readonly workspaces: {
|
|
63
|
+
ref(workspaceId: string): PaseoSdkWorkspaceHandle;
|
|
64
|
+
};
|
|
65
|
+
connect(): Promise<void>;
|
|
66
|
+
close(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
export declare class PaseoSdkUnavailableError extends Error {
|
|
69
|
+
constructor(message: string, options?: {
|
|
70
|
+
cause?: unknown;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
export declare function createPaseoSdkAgent(root: string, options: PaseoSdkAgentOptions): Promise<PaseoSdkAgentResult>;
|
|
74
|
+
export declare function createPaseoSdkAgentWithClient(client: PaseoSdkClient, options: PaseoSdkAgentOptions): Promise<PaseoSdkAgentResult>;
|
|
75
|
+
export declare function runPaseoSdkAgent(root: string, agentId: string, prompt: string, timeoutMs?: number): Promise<PaseoSdkAgentResult>;
|
|
76
|
+
export declare function inspectPaseoSdkAgent(root: string, agentId: string): Promise<PaseoSdkAgentRecord | undefined>;
|
|
77
|
+
export declare function probePaseoSdkAgent(root: string, agentId: string): Promise<boolean>;
|
|
78
|
+
export declare function listPaseoSdkAgents(root: string, labels?: Record<string, string>): Promise<PaseoSdkAgentRecord[]>;
|
|
79
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
3
|
+
import { resolvePaseoSdkFromCli } from "./sdkResolve.js";
|
|
4
|
+
export class PaseoSdkUnavailableError extends Error {
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message, options);
|
|
7
|
+
this.name = "PaseoSdkUnavailableError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export async function createPaseoSdkAgent(root, options) {
|
|
11
|
+
return withPaseoClient(root, async (client) => createPaseoSdkAgentWithClient(client, options));
|
|
12
|
+
}
|
|
13
|
+
export async function createPaseoSdkAgentWithClient(client, options) {
|
|
14
|
+
const config = { provider: providerModel(options.provider, options.model) };
|
|
15
|
+
if (options.systemPrompt)
|
|
16
|
+
config.systemPrompt = options.systemPrompt;
|
|
17
|
+
const createOptions = { config, title: options.title };
|
|
18
|
+
if (options.prompt !== undefined)
|
|
19
|
+
createOptions.prompt = options.prompt;
|
|
20
|
+
if (options.outputSchema)
|
|
21
|
+
createOptions.outputSchema = options.outputSchema;
|
|
22
|
+
if (options.labels && Object.keys(options.labels).length)
|
|
23
|
+
createOptions.labels = options.labels;
|
|
24
|
+
// Intentionally omit `parent`: AEH run/task labels own lifecycle relationships.
|
|
25
|
+
// Workspace placement does not imply parentage in the Paseo SDK.
|
|
26
|
+
const handle = options.workspaceId
|
|
27
|
+
? await client.workspaces.ref(options.workspaceId).agents.create(createOptions)
|
|
28
|
+
: await client.agents.create({ ...createOptions, cwd: options.cwd });
|
|
29
|
+
if (options.prompt !== undefined && options.waitForFinish !== false) {
|
|
30
|
+
const turn = await handle.waitForFinish(options.timeoutMs);
|
|
31
|
+
return {
|
|
32
|
+
id: handle.id,
|
|
33
|
+
workspaceId: handle.workspaceId ?? undefined,
|
|
34
|
+
status: turn.status,
|
|
35
|
+
lastMessage: turn.lastMessage,
|
|
36
|
+
error: turn.error
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
id: handle.id,
|
|
41
|
+
workspaceId: handle.workspaceId ?? undefined,
|
|
42
|
+
status: statusText(handle.status)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export async function runPaseoSdkAgent(root, agentId, prompt, timeoutMs) {
|
|
46
|
+
return withPaseoClient(root, async (client) => {
|
|
47
|
+
const handle = client.agents.ref(agentId);
|
|
48
|
+
const turn = await handle.run(prompt, { timeoutMs });
|
|
49
|
+
return { id: agentId, workspaceId: handle.workspaceId ?? undefined, status: turn.status, lastMessage: turn.lastMessage, error: turn.error };
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export async function inspectPaseoSdkAgent(root, agentId) {
|
|
53
|
+
return withPaseoClient(root, async (client) => {
|
|
54
|
+
const refreshed = await client.agents.ref(agentId).refresh();
|
|
55
|
+
return refreshed ? normalizeRecord(refreshed.agent) : undefined;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export async function probePaseoSdkAgent(root, agentId) {
|
|
59
|
+
return Boolean(await inspectPaseoSdkAgent(root, agentId));
|
|
60
|
+
}
|
|
61
|
+
export async function listPaseoSdkAgents(root, labels = {}) {
|
|
62
|
+
return withPaseoClient(root, async (client) => {
|
|
63
|
+
const filter = { includeArchived: false };
|
|
64
|
+
if (Object.keys(labels).length)
|
|
65
|
+
filter.labels = labels;
|
|
66
|
+
const page = await client.agents.list({ filter });
|
|
67
|
+
return page.entries.map((entry) => normalizeRecord(entry.agent)).filter((agent) => labelsMatch(agent.labels, labels));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async function withPaseoClient(root, action) {
|
|
71
|
+
const sdk = await loadPaseoSdk(root);
|
|
72
|
+
const client = sdk.createPaseoClient({
|
|
73
|
+
url: process.env.PASEO_DAEMON_URL?.trim() || "ws://127.0.0.1:6767/ws",
|
|
74
|
+
clientId: `aeh-${process.pid}`,
|
|
75
|
+
password: process.env.PASEO_DAEMON_PASSWORD?.trim() || undefined
|
|
76
|
+
});
|
|
77
|
+
try {
|
|
78
|
+
try {
|
|
79
|
+
await client.connect();
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new PaseoSdkUnavailableError(`Unable to connect to the Paseo daemon through @getpaseo/client: ${String(error)}`, { cause: error });
|
|
83
|
+
}
|
|
84
|
+
return await action(client);
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
await client.close().catch(() => undefined);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function loadPaseoSdk(root) {
|
|
91
|
+
// Prefer the client bundled with the active Paseo CLI. Paseo currently ships
|
|
92
|
+
// @getpaseo/client as an exact-version dependency of @getpaseo/cli, while the
|
|
93
|
+
// client SDK is explicitly not API-stable yet. Loading the co-installed copy
|
|
94
|
+
// therefore avoids protocol/API drift between an independently resolved SDK
|
|
95
|
+
// and the daemon that the active CLI starts.
|
|
96
|
+
const bundled = await resolvePaseoSdkFromCli(root);
|
|
97
|
+
if (bundled.resolved) {
|
|
98
|
+
try {
|
|
99
|
+
const sdk = await import(pathToFileURL(bundled.resolved).href);
|
|
100
|
+
if (typeof sdk.createPaseoClient === "function")
|
|
101
|
+
return sdk;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
bundled.diagnostics.push(`bundled import: ${String(error)}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Compatibility fallback for installations that intentionally provide the
|
|
108
|
+
// SDK directly alongside AEH instead of through the Paseo CLI package. Keep
|
|
109
|
+
// the package specifier non-literal so TypeScript does not require this
|
|
110
|
+
// optional runtime package to be installed while compiling AEH.
|
|
111
|
+
const packageName = "@getpaseo/client";
|
|
112
|
+
let directError;
|
|
113
|
+
try {
|
|
114
|
+
const direct = await import(packageName);
|
|
115
|
+
if (typeof direct.createPaseoClient === "function")
|
|
116
|
+
return direct;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
directError = error;
|
|
120
|
+
}
|
|
121
|
+
const detail = bundled.diagnostics.length ? ` Resolution diagnostics: ${bundled.diagnostics.join("; ")}.` : "";
|
|
122
|
+
throw new PaseoSdkUnavailableError(`@getpaseo/client could not be resolved from the active Paseo CLI installation or directly.${detail}${directError ? ` Direct import: ${String(directError)}` : ""}`, { cause: directError });
|
|
123
|
+
}
|
|
124
|
+
function providerModel(provider, model) {
|
|
125
|
+
if (provider.includes("/"))
|
|
126
|
+
return provider;
|
|
127
|
+
if (!model)
|
|
128
|
+
throw new Error(`Paseo SDK requires an explicit model for provider '${provider}'.`);
|
|
129
|
+
return `${provider}/${model}`;
|
|
130
|
+
}
|
|
131
|
+
function normalizeRecord(raw) {
|
|
132
|
+
const id = stringField(raw, ["id", "agentId", "agent_id"]);
|
|
133
|
+
if (!id)
|
|
134
|
+
throw new Error("Paseo SDK returned an agent without an id.");
|
|
135
|
+
const labels = recordOfStrings(raw.labels);
|
|
136
|
+
return {
|
|
137
|
+
id,
|
|
138
|
+
title: stringField(raw, ["title", "name"]),
|
|
139
|
+
status: statusText(raw.status),
|
|
140
|
+
workspaceId: stringField(raw, ["workspaceId", "workspace_id"]),
|
|
141
|
+
labels,
|
|
142
|
+
raw
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function labelsMatch(actual, expected) {
|
|
146
|
+
return Object.entries(expected).every(([key, value]) => actual?.[key] === value);
|
|
147
|
+
}
|
|
148
|
+
function stringField(record, keys) { for (const key of keys)
|
|
149
|
+
if (typeof record[key] === "string" && record[key])
|
|
150
|
+
return record[key]; return undefined; }
|
|
151
|
+
function recordOfStrings(value) { if (!value || typeof value !== "object" || Array.isArray(value))
|
|
152
|
+
return undefined; const result = {}; for (const [key, item] of Object.entries(value))
|
|
153
|
+
if (typeof item === "string")
|
|
154
|
+
result[key] = item; return Object.keys(result).length ? result : undefined; }
|
|
155
|
+
function statusText(value) { if (typeof value === "string")
|
|
156
|
+
return value; if (value && typeof value === "object") {
|
|
157
|
+
const nested = value.status;
|
|
158
|
+
if (typeof nested === "string")
|
|
159
|
+
return nested;
|
|
160
|
+
} return undefined; }
|
|
161
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/paseo/sdk.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAmEzD,MAAM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,IAAI,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;IAAE,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACpY,SAAS,UAAU,CAAC,KAAc,IAAwB,IAAI,OAAO,KAAK,KAAK,QAAQ;IAAE,OAAO,KAAK,CAAC,CAAC,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;IAAC,MAAM,MAAM,GAAI,KAAiC,CAAC,MAAM,CAAC;IAAC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;AAAC,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { runProcess, type ProcessResult } from "../utils/process.js";
|
|
2
|
+
type ProcessRunner = (command: string, options: Parameters<typeof runProcess>[1]) => Promise<ProcessResult>;
|
|
3
|
+
export interface PaseoSdkResolution {
|
|
4
|
+
resolved?: string;
|
|
5
|
+
diagnostics: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the Paseo client that belongs to the active Paseo CLI installation.
|
|
9
|
+
*
|
|
10
|
+
* mise's npm backend installs tools into a synthetic project and may expose a
|
|
11
|
+
* shim on PATH instead of the real package binary. Resolving relative to that
|
|
12
|
+
* shim cannot see the CLI's node_modules. `mise which` and `mise where` expose
|
|
13
|
+
* the actual binary/install root, which lets Node resolve the exact client
|
|
14
|
+
* version shipped with that CLI.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolvePaseoSdkFromCli(root: string, runner?: ProcessRunner): Promise<PaseoSdkResolution>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { runProcess } from "../utils/process.js";
|
|
5
|
+
const PASEO_CLIENT_PACKAGE = "@getpaseo/client";
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the Paseo client that belongs to the active Paseo CLI installation.
|
|
8
|
+
*
|
|
9
|
+
* mise's npm backend installs tools into a synthetic project and may expose a
|
|
10
|
+
* shim on PATH instead of the real package binary. Resolving relative to that
|
|
11
|
+
* shim cannot see the CLI's node_modules. `mise which` and `mise where` expose
|
|
12
|
+
* the actual binary/install root, which lets Node resolve the exact client
|
|
13
|
+
* version shipped with that CLI.
|
|
14
|
+
*/
|
|
15
|
+
export async function resolvePaseoSdkFromCli(root, runner = runProcess) {
|
|
16
|
+
const diagnostics = [];
|
|
17
|
+
const starts = new Set();
|
|
18
|
+
const commandPath = await capturePath(runner, "command -v paseo", root, "command -v paseo", diagnostics);
|
|
19
|
+
if (commandPath)
|
|
20
|
+
await addExecutableStarts(starts, commandPath);
|
|
21
|
+
const misePath = await capturePath(runner, "mise which paseo", root, "mise which paseo", diagnostics);
|
|
22
|
+
if (misePath)
|
|
23
|
+
await addExecutableStarts(starts, misePath);
|
|
24
|
+
const miseRoot = await capturePath(runner, "mise where 'npm:@getpaseo/cli'", root, "mise where npm:@getpaseo/cli", diagnostics);
|
|
25
|
+
if (miseRoot)
|
|
26
|
+
starts.add(path.resolve(miseRoot));
|
|
27
|
+
for (const start of starts) {
|
|
28
|
+
const resolved = resolvePackageWalkingUp(start, PASEO_CLIENT_PACKAGE);
|
|
29
|
+
if (resolved)
|
|
30
|
+
return { resolved, diagnostics };
|
|
31
|
+
}
|
|
32
|
+
return { diagnostics };
|
|
33
|
+
}
|
|
34
|
+
async function capturePath(runner, command, root, label, diagnostics) {
|
|
35
|
+
try {
|
|
36
|
+
const result = await runner(command, { cwd: root, timeoutMs: 15_000 });
|
|
37
|
+
const value = result.exitCode === 0 ? lastNonEmptyLine(result.stdout) : undefined;
|
|
38
|
+
diagnostics.push(`${label}: ${value ?? `unavailable (exit ${result.exitCode})`}`);
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
diagnostics.push(`${label}: ${String(error)}`);
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function addExecutableStarts(starts, executable) {
|
|
47
|
+
const absolute = path.resolve(executable);
|
|
48
|
+
starts.add(path.dirname(absolute));
|
|
49
|
+
const real = await fs.realpath(absolute).catch(() => absolute);
|
|
50
|
+
starts.add(path.dirname(real));
|
|
51
|
+
}
|
|
52
|
+
function resolvePackageWalkingUp(start, packageName) {
|
|
53
|
+
let current = path.resolve(start);
|
|
54
|
+
for (let depth = 0; depth < 12; depth += 1) {
|
|
55
|
+
try {
|
|
56
|
+
const resolver = createRequire(path.join(current, "__aeh_paseo_sdk_loader__.cjs"));
|
|
57
|
+
return resolver.resolve(packageName);
|
|
58
|
+
}
|
|
59
|
+
catch { /* keep walking toward the npm synthetic-project root */ }
|
|
60
|
+
const parent = path.dirname(current);
|
|
61
|
+
if (parent === current)
|
|
62
|
+
break;
|
|
63
|
+
current = parent;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
function lastNonEmptyLine(value) {
|
|
68
|
+
return value.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).at(-1);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=sdkResolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdkResolve.js","sourceRoot":"","sources":["../../src/paseo/sdkResolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAsB,MAAM,qBAAqB,CAAC;AAErE,M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C,CAAC;YACnF,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC,CAAC,wDAAwD,CAAC,CAAC;QACpE,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrC,IAAI,MAAM,KAAK,OAAO;YAAE,MAAM;QAC9B,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
package/dist/paseo/start.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { ResolvedAgentTopology } from "../agents/types.js";
|
|
2
2
|
import { loadResolvedAgentTopology } from "../agents/config.js";
|
|
3
|
+
import { reconcileHarnessAssets } from "../core/assets.js";
|
|
3
4
|
import type { HarnessProjectConfig } from "../core/types.js";
|
|
4
5
|
import { setupToolchain } from "../toolchain/setup.js";
|
|
5
6
|
import { commandExists, runProcess } from "../utils/process.js";
|
|
6
7
|
import { detectPaseoCapabilities } from "./capabilities.js";
|
|
7
|
-
|
|
8
|
+
import { launchManagedPaseoAgent, probeManagedPaseoAgent } from "./runtime.js";
|
|
9
|
+
export declare const PASEO_BOOTSTRAP_VERSION = 4;
|
|
8
10
|
export type PaseoSessionPolicy = "fresh-on-start" | "reuse-compatible" | "resume-explicit";
|
|
9
11
|
export interface PaseoStartOptions {
|
|
10
12
|
autoSetup?: boolean;
|
|
@@ -41,6 +43,7 @@ export interface PaseoStartResult {
|
|
|
41
43
|
stateFile: string;
|
|
42
44
|
bootstrapFile: string;
|
|
43
45
|
paseoVersion?: string;
|
|
46
|
+
transport?: "sdk" | "cli";
|
|
44
47
|
}
|
|
45
48
|
interface PaseoStartDeps {
|
|
46
49
|
run: typeof runProcess;
|
|
@@ -48,6 +51,9 @@ interface PaseoStartDeps {
|
|
|
48
51
|
setupToolchain: typeof setupToolchain;
|
|
49
52
|
loadTopology: typeof loadResolvedAgentTopology;
|
|
50
53
|
detectCapabilities: typeof detectPaseoCapabilities;
|
|
54
|
+
launchAgent: typeof launchManagedPaseoAgent;
|
|
55
|
+
probeAgent: typeof probeManagedPaseoAgent;
|
|
56
|
+
reconcileAssets?: typeof reconcileHarnessAssets;
|
|
51
57
|
}
|
|
52
58
|
export declare function startPaseoHarness(root: string, config: HarnessProjectConfig, options?: PaseoStartOptions, deps?: PaseoStartDeps): Promise<PaseoStartResult>;
|
|
53
59
|
export declare function buildPaseoLeadBootstrap(projectName: string, projectRoot: string, aehCommand: string, preferPaseoTools?: boolean, handoffPath?: string): string;
|