@aiden-ade/sandbox-agent 0.1.30 → 0.1.31
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/index.cjs +45 -6
- package/package.json +1 -1
- package/dist/core-agent.d.ts +0 -33
- package/dist/core-agent.d.ts.map +0 -1
- package/dist/core-agent.js +0 -218
- package/dist/core-agent.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -53
- package/dist/index.js.map +0 -1
- package/dist/runtime-backends.d.ts +0 -2
- package/dist/runtime-backends.d.ts.map +0 -1
- package/dist/runtime-backends.js +0 -2
- package/dist/runtime-backends.js.map +0 -1
- package/dist/sandbox.d.ts +0 -25
- package/dist/sandbox.d.ts.map +0 -1
- package/dist/sandbox.js +0 -185
- package/dist/sandbox.js.map +0 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/updater.d.ts +0 -15
- package/dist/updater.d.ts.map +0 -1
- package/dist/updater.js +0 -54
- package/dist/updater.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -2
- package/dist/version.js.map +0 -1
- package/dist/web-presenter.d.ts +0 -33
- package/dist/web-presenter.d.ts.map +0 -1
- package/dist/web-presenter.js +0 -100
- package/dist/web-presenter.js.map +0 -1
- package/dist/ws-client.d.ts +0 -79
- package/dist/ws-client.d.ts.map +0 -1
- package/dist/ws-client.js +0 -74
- package/dist/ws-client.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -9307,7 +9307,7 @@ function countNonStaleActiveRuns(activeRuns, nowMs = Date.now(), graceMs = RUNNE
|
|
|
9307
9307
|
return { activeRunCount, staleRunCount };
|
|
9308
9308
|
}
|
|
9309
9309
|
function deriveAcceptingRuns(input) {
|
|
9310
|
-
return input.connected && input.computerReady
|
|
9310
|
+
return input.connected && input.computerReady;
|
|
9311
9311
|
}
|
|
9312
9312
|
|
|
9313
9313
|
// ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js
|
|
@@ -16600,6 +16600,16 @@ function parseCursorStructuredLine(line2, context, state) {
|
|
|
16600
16600
|
switch (type) {
|
|
16601
16601
|
case "system":
|
|
16602
16602
|
break;
|
|
16603
|
+
case "thinking":
|
|
16604
|
+
case "reasoning": {
|
|
16605
|
+
const subtype = typeof parsed.subtype === "string" ? parsed.subtype : "";
|
|
16606
|
+
if (subtype === "completed") break;
|
|
16607
|
+
const text2 = typeof parsed.text === "string" ? parsed.text : "";
|
|
16608
|
+
if (!text2) break;
|
|
16609
|
+
state.iterations = Math.max(state.iterations, 1);
|
|
16610
|
+
void presenter.onThinking(text2);
|
|
16611
|
+
break;
|
|
16612
|
+
}
|
|
16603
16613
|
case "assistant": {
|
|
16604
16614
|
const message = typeof parsed.message === "object" && parsed.message !== null ? parsed.message : null;
|
|
16605
16615
|
const content = Array.isArray(message?.content) ? message.content : [];
|
|
@@ -16831,6 +16841,15 @@ function parseDroidStructuredLine(line2, context, state) {
|
|
|
16831
16841
|
void presenter.onAssistantText(text2);
|
|
16832
16842
|
break;
|
|
16833
16843
|
}
|
|
16844
|
+
case "thinking_text_delta": {
|
|
16845
|
+
const text2 = typeof parsed.text === "string" ? parsed.text : "";
|
|
16846
|
+
if (!text2) break;
|
|
16847
|
+
state.iterations = Math.max(state.iterations, 1);
|
|
16848
|
+
void presenter.onThinking(text2);
|
|
16849
|
+
break;
|
|
16850
|
+
}
|
|
16851
|
+
case "thinking_text_complete":
|
|
16852
|
+
break;
|
|
16834
16853
|
case "tool_call": {
|
|
16835
16854
|
const toolId = typeof parsed.id === "string" ? parsed.id : `droid-tool-${Date.now()}`;
|
|
16836
16855
|
const toolName = typeof parsed.toolName === "string" ? parsed.toolName : "Tool";
|
|
@@ -17336,14 +17355,21 @@ function isOpenCodeToolError(parsed, part) {
|
|
|
17336
17355
|
function getOpenCodePartId(parsed, part) {
|
|
17337
17356
|
return getString(part?.id) || getString(parsed.id) || getString(parsed.partID);
|
|
17338
17357
|
}
|
|
17339
|
-
function
|
|
17358
|
+
function resolveOpenCodePartSnapshotDelta(text2, partId, snapshots) {
|
|
17340
17359
|
if (!partId) return text2;
|
|
17341
|
-
|
|
17342
|
-
|
|
17343
|
-
state.opencodeTextByPartId.set(partId, text2);
|
|
17360
|
+
const previous = snapshots.get(partId) ?? "";
|
|
17361
|
+
snapshots.set(partId, text2);
|
|
17344
17362
|
if (!previous || !text2.startsWith(previous)) return text2;
|
|
17345
17363
|
return text2.slice(previous.length);
|
|
17346
17364
|
}
|
|
17365
|
+
function resolveOpenCodeTextDelta(text2, partId, state) {
|
|
17366
|
+
state.opencodeTextByPartId ??= /* @__PURE__ */ new Map();
|
|
17367
|
+
return resolveOpenCodePartSnapshotDelta(text2, partId, state.opencodeTextByPartId);
|
|
17368
|
+
}
|
|
17369
|
+
function resolveOpenCodeReasoningDelta(text2, partId, state) {
|
|
17370
|
+
state.opencodeReasoningByPartId ??= /* @__PURE__ */ new Map();
|
|
17371
|
+
return resolveOpenCodePartSnapshotDelta(text2, partId, state.opencodeReasoningByPartId);
|
|
17372
|
+
}
|
|
17347
17373
|
function parseOpencodeStructuredLine(line2, context, state) {
|
|
17348
17374
|
const presenter = context.presenter;
|
|
17349
17375
|
let parsed = null;
|
|
@@ -17374,6 +17400,16 @@ function parseOpencodeStructuredLine(line2, context, state) {
|
|
|
17374
17400
|
}
|
|
17375
17401
|
break;
|
|
17376
17402
|
}
|
|
17403
|
+
case "reasoning":
|
|
17404
|
+
case "thinking": {
|
|
17405
|
+
const text2 = part && typeof part.text === "string" ? part.text : "";
|
|
17406
|
+
if (!text2) break;
|
|
17407
|
+
const delta = resolveOpenCodeReasoningDelta(text2, getOpenCodePartId(parsed, part), state);
|
|
17408
|
+
if (!delta) break;
|
|
17409
|
+
state.iterations = Math.max(state.iterations, 1);
|
|
17410
|
+
void presenter.onThinking(delta);
|
|
17411
|
+
break;
|
|
17412
|
+
}
|
|
17377
17413
|
case "tool_use":
|
|
17378
17414
|
case "tool.execute": {
|
|
17379
17415
|
const toolName = getString(parsed.tool) || (part && typeof part.name === "string" ? part.name : "") || getString(parsed.name) || (part && typeof part.tool === "string" ? part.tool : "") || "Tool";
|
|
@@ -21673,6 +21709,7 @@ var tasks = pgTable("tasks", {
|
|
|
21673
21709
|
repoIds: uuid("repo_ids").array(),
|
|
21674
21710
|
repoSelections: jsonb("repo_selections").$type(),
|
|
21675
21711
|
sourceMetadata: jsonb("source_metadata").$type(),
|
|
21712
|
+
dueDate: timestamp("due_date", { withTimezone: true }),
|
|
21676
21713
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
21677
21714
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date()),
|
|
21678
21715
|
deletedAt: timestamp("deleted_at", { withTimezone: true })
|
|
@@ -24712,6 +24749,7 @@ var taskRepoSelectionSchema = external_exports.object({
|
|
|
24712
24749
|
repoId: external_exports.string().uuid(),
|
|
24713
24750
|
branch: external_exports.string().trim().min(1).max(255)
|
|
24714
24751
|
});
|
|
24752
|
+
var dateStringSchema3 = external_exports.string().datetime();
|
|
24715
24753
|
var createTaskSchema = external_exports.object({
|
|
24716
24754
|
teamId: external_exports.string().uuid().optional(),
|
|
24717
24755
|
cycleId: external_exports.string().uuid().nullable().optional(),
|
|
@@ -24722,6 +24760,7 @@ var createTaskSchema = external_exports.object({
|
|
|
24722
24760
|
priority: external_exports.enum(taskPriorityEnum).default("none"),
|
|
24723
24761
|
assigneeIds: external_exports.array(external_exports.string().uuid()).max(1).optional(),
|
|
24724
24762
|
labels: external_exports.array(external_exports.string().max(50)).max(20).optional(),
|
|
24763
|
+
dueDate: dateStringSchema3.nullable().optional(),
|
|
24725
24764
|
useWorktree: external_exports.boolean().optional(),
|
|
24726
24765
|
localWorkspaceMode: external_exports.enum(taskLocalWorkspaceModeEnum).optional(),
|
|
24727
24766
|
attachments: external_exports.array(taskAttachmentSchema).optional(),
|
|
@@ -25091,7 +25130,7 @@ async function discoverProviderModels(provider, executable, env) {
|
|
|
25091
25130
|
}
|
|
25092
25131
|
|
|
25093
25132
|
// src/version.ts
|
|
25094
|
-
var AGENT_VERSION = "0.1.
|
|
25133
|
+
var AGENT_VERSION = "0.1.31";
|
|
25095
25134
|
|
|
25096
25135
|
// src/daemon.ts
|
|
25097
25136
|
var STAGING_API_URL = process.env.AIDEN_STAGING_API_URL ?? "https://api.staging.aiden-platform.com";
|
package/package.json
CHANGED
package/dist/core-agent.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox CoreAgent — E2B-specific subclass of BaseMachineAgent.
|
|
3
|
-
*
|
|
4
|
-
* Platform responsibilities:
|
|
5
|
-
* - buildCliEnvironment: extend process.env + inject E2B node bin path
|
|
6
|
-
* - buildExtraSystemPromptParts: inject artifact IDs from AIDEN_* env vars
|
|
7
|
-
* - submitAnswer / submitPlanApproval: resolve interactive-tool prompts relayed via WS
|
|
8
|
-
*
|
|
9
|
-
* Everything else (retry loop, system-prompt assembly, backend selection) lives
|
|
10
|
-
* in BaseMachineAgent.
|
|
11
|
-
*/
|
|
12
|
-
import { BaseMachineAgent, type AgentRuntimeConfig } from "@aiden/agent-core";
|
|
13
|
-
import type { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
14
|
-
import type { AgentConfig } from "./types.js";
|
|
15
|
-
export declare class CoreAgent extends BaseMachineAgent {
|
|
16
|
-
private childProcess;
|
|
17
|
-
private _aborted;
|
|
18
|
-
/** How long to wait after SIGTERM before escalating to SIGKILL. */
|
|
19
|
-
private static readonly SIGKILL_DELAY_MS;
|
|
20
|
-
constructor(presenter: ConstructorParameters<typeof BaseMachineAgent>[0], runtime: AgentRuntimeConfig);
|
|
21
|
-
abort(): void;
|
|
22
|
-
kill(): boolean;
|
|
23
|
-
private killChildProcess;
|
|
24
|
-
/**
|
|
25
|
-
* Send a tool_result to the CLI's stdin (stream-json format).
|
|
26
|
-
* Used for interactive tools like AskUserQuestion.
|
|
27
|
-
*/
|
|
28
|
-
sendToolResponse(toolId: string, response: string): boolean;
|
|
29
|
-
protected getOnProcessSpawned(): ((child: ChildProcessWithoutNullStreams) => void) | undefined;
|
|
30
|
-
protected buildCliEnvironment(): Promise<Record<string, string>>;
|
|
31
|
-
protected buildExtraSystemPromptParts(config: AgentConfig): string[];
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=core-agent.d.ts.map
|
package/dist/core-agent.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core-agent.d.ts","sourceRoot":"","sources":["../src/core-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,qBAAa,SAAU,SAAQ,gBAAgB;IAC7C,OAAO,CAAC,YAAY,CAA+C;IACnE,OAAO,CAAC,QAAQ,CAAS;IAEzB,mEAAmE;IACnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAQ;gBAEpC,SAAS,EAAE,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,kBAAkB;IAI9F,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,OAAO;IAStB,OAAO,CAAC,gBAAgB;IAyCxB;;;OAGG;IACI,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO;IAgClE,SAAS,CAAC,mBAAmB,IAAI,CAAC,CAAC,KAAK,EAAE,8BAA8B,KAAK,IAAI,CAAC,GAAG,SAAS;cAW9E,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAkBtE,SAAS,CAAC,2BAA2B,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE;CAuFrE"}
|
package/dist/core-agent.js
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox CoreAgent — E2B-specific subclass of BaseMachineAgent.
|
|
3
|
-
*
|
|
4
|
-
* Platform responsibilities:
|
|
5
|
-
* - buildCliEnvironment: extend process.env + inject E2B node bin path
|
|
6
|
-
* - buildExtraSystemPromptParts: inject artifact IDs from AIDEN_* env vars
|
|
7
|
-
* - submitAnswer / submitPlanApproval: resolve interactive-tool prompts relayed via WS
|
|
8
|
-
*
|
|
9
|
-
* Everything else (retry loop, system-prompt assembly, backend selection) lives
|
|
10
|
-
* in BaseMachineAgent.
|
|
11
|
-
*/
|
|
12
|
-
import { BaseMachineAgent } from "@aiden/agent-core";
|
|
13
|
-
export class CoreAgent extends BaseMachineAgent {
|
|
14
|
-
childProcess = null;
|
|
15
|
-
_aborted = false;
|
|
16
|
-
/** How long to wait after SIGTERM before escalating to SIGKILL. */
|
|
17
|
-
static SIGKILL_DELAY_MS = 3000;
|
|
18
|
-
constructor(presenter, runtime) {
|
|
19
|
-
super(presenter, runtime);
|
|
20
|
-
}
|
|
21
|
-
abort() {
|
|
22
|
-
this._aborted = true;
|
|
23
|
-
super.abort();
|
|
24
|
-
}
|
|
25
|
-
kill() {
|
|
26
|
-
this._aborted = true;
|
|
27
|
-
super.abort();
|
|
28
|
-
const child = this.childProcess;
|
|
29
|
-
if (!child || child.killed || child.exitCode !== null)
|
|
30
|
-
return false;
|
|
31
|
-
return this.killChildProcess(child);
|
|
32
|
-
}
|
|
33
|
-
killChildProcess(child) {
|
|
34
|
-
const pid = child.pid;
|
|
35
|
-
if (!pid)
|
|
36
|
-
return false;
|
|
37
|
-
console.info("[CoreAgent] Killing agent process", { pid });
|
|
38
|
-
try {
|
|
39
|
-
if (process.platform === "win32") {
|
|
40
|
-
child.kill("SIGTERM");
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
process.kill(-pid, "SIGTERM");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
catch (err) {
|
|
47
|
-
if (err.code !== "ESRCH") {
|
|
48
|
-
console.warn("[CoreAgent] SIGTERM failed", { pid, err });
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
child.kill("SIGTERM");
|
|
52
|
-
}
|
|
53
|
-
catch { /* already dead */ }
|
|
54
|
-
}
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
if (child.killed || child.exitCode !== null)
|
|
57
|
-
return;
|
|
58
|
-
console.warn("[CoreAgent] Escalating to SIGKILL", { pid });
|
|
59
|
-
try {
|
|
60
|
-
if (process.platform === "win32") {
|
|
61
|
-
child.kill("SIGKILL");
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
process.kill(-pid, "SIGKILL");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
if (err.code !== "ESRCH") {
|
|
69
|
-
console.warn("[CoreAgent] SIGKILL failed", { pid, err });
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}, CoreAgent.SIGKILL_DELAY_MS);
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
// ── Interactive tool response (WS relay → stdin) ───────────────────────
|
|
76
|
-
/**
|
|
77
|
-
* Send a tool_result to the CLI's stdin (stream-json format).
|
|
78
|
-
* Used for interactive tools like AskUserQuestion.
|
|
79
|
-
*/
|
|
80
|
-
sendToolResponse(toolId, response) {
|
|
81
|
-
if (!this.childProcess)
|
|
82
|
-
return false;
|
|
83
|
-
const stdin = this.childProcess.stdin;
|
|
84
|
-
if (!stdin || stdin.destroyed)
|
|
85
|
-
return false;
|
|
86
|
-
try {
|
|
87
|
-
const message = JSON.stringify({
|
|
88
|
-
type: "user",
|
|
89
|
-
message: {
|
|
90
|
-
role: "user",
|
|
91
|
-
content: [
|
|
92
|
-
{
|
|
93
|
-
type: "tool_result",
|
|
94
|
-
tool_use_id: toolId,
|
|
95
|
-
content: response,
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
},
|
|
99
|
-
session_id: "default",
|
|
100
|
-
parent_tool_use_id: null,
|
|
101
|
-
});
|
|
102
|
-
stdin.write(message + "\n");
|
|
103
|
-
console.info(`[CoreAgent] Sent tool_response for tool ${toolId}`);
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
console.error("[CoreAgent] Failed to write tool_response to stdin", err);
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// ── BaseMachineAgent hooks ─────────────────────────────────────────────
|
|
112
|
-
getOnProcessSpawned() {
|
|
113
|
-
return (child) => {
|
|
114
|
-
this.childProcess = child;
|
|
115
|
-
child.on("exit", () => { this.childProcess = null; });
|
|
116
|
-
child.on("error", () => { this.childProcess = null; });
|
|
117
|
-
if (this._aborted) {
|
|
118
|
-
this.killChildProcess(child);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
async buildCliEnvironment() {
|
|
123
|
-
const loginEnv = process.env;
|
|
124
|
-
const env = {};
|
|
125
|
-
for (const [key, value] of Object.entries(loginEnv)) {
|
|
126
|
-
if (value !== undefined)
|
|
127
|
-
env[key] = value;
|
|
128
|
-
}
|
|
129
|
-
// Guarantee CLI runtime bin dirs are in PATH regardless of how the agent
|
|
130
|
-
// was launched. Uses HOME from the inherited env so this works for both
|
|
131
|
-
// E2B (/home/user) and Daytona (/home/daytona) without hardcoding.
|
|
132
|
-
const home = env.HOME ?? "/home/user";
|
|
133
|
-
const extraPaths = [`${home}/.local/node/bin`, `${home}/.local/bin`];
|
|
134
|
-
const basePath = env.PATH ?? "";
|
|
135
|
-
const existingSegments = new Set(basePath.split(":").filter(Boolean));
|
|
136
|
-
const missing = extraPaths.filter((p) => !existingSegments.has(p));
|
|
137
|
-
env.PATH = missing.length > 0 ? `${missing.join(":")}:${basePath}` : basePath;
|
|
138
|
-
return env;
|
|
139
|
-
}
|
|
140
|
-
buildExtraSystemPromptParts(config) {
|
|
141
|
-
const parts = [];
|
|
142
|
-
// Inject current user identity so the agent knows who initiated the session.
|
|
143
|
-
if (config.currentUser) {
|
|
144
|
-
const u = config.currentUser;
|
|
145
|
-
const lines = ["# Current User"];
|
|
146
|
-
if (u.name)
|
|
147
|
-
lines.push(`- **Name**: ${u.name}`);
|
|
148
|
-
lines.push(`- **Email**: ${u.email}`);
|
|
149
|
-
lines.push(`- **User ID**: ${u.id}`);
|
|
150
|
-
lines.push("");
|
|
151
|
-
lines.push("This is the person who initiated this conversation. When creating tasks or assigning work, default to assigning to this user unless explicitly instructed otherwise.");
|
|
152
|
-
parts.push(lines.join("\n"));
|
|
153
|
-
}
|
|
154
|
-
// Inject task metadata so the agent has full context about the task it's working on.
|
|
155
|
-
// Prefer config.taskMeta (sent by the dispatch pipeline); fall back to env vars.
|
|
156
|
-
if (config.taskMeta) {
|
|
157
|
-
const meta = config.taskMeta;
|
|
158
|
-
const lines = ["# Task Context"];
|
|
159
|
-
lines.push(`- **Title**: ${meta.title}`);
|
|
160
|
-
lines.push(`- **Status**: ${meta.status.replace(/_/g, " ")}`);
|
|
161
|
-
if (meta.priority && meta.priority !== "none") {
|
|
162
|
-
lines.push(`- **Priority**: ${meta.priority.toUpperCase()}`);
|
|
163
|
-
}
|
|
164
|
-
if (meta.labels && meta.labels.length > 0) {
|
|
165
|
-
lines.push(`- **Labels**: ${meta.labels.join(", ")}`);
|
|
166
|
-
}
|
|
167
|
-
if (meta.assignees && meta.assignees.length > 0) {
|
|
168
|
-
const assigneeStr = meta.assignees.map((a) => a.name ?? a.email).join(", ");
|
|
169
|
-
lines.push(`- **Assignees**: ${assigneeStr}`);
|
|
170
|
-
}
|
|
171
|
-
if (meta.description) {
|
|
172
|
-
lines.push(`- **Description**:\n${meta.description}`);
|
|
173
|
-
}
|
|
174
|
-
if (meta.descriptionAttachmentIds && meta.descriptionAttachmentIds.length > 0) {
|
|
175
|
-
lines.push("");
|
|
176
|
-
lines.push("## Task Description Images");
|
|
177
|
-
lines.push("The task description contains images. Use the `attachment` MCP tool with op=\"get\" to view them:");
|
|
178
|
-
for (const att of meta.descriptionAttachmentIds) {
|
|
179
|
-
lines.push(`- Attachment ID: \`${att.id}\` (${att.filename})`);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
parts.push(lines.join("\n"));
|
|
183
|
-
}
|
|
184
|
-
// Inject artifact context so the agent associates MCP artifacts with the right task.
|
|
185
|
-
// Prefer config fields (sent by dispatch pipeline); fall back to AIDEN_* env vars.
|
|
186
|
-
const taskId = config.taskId ?? process.env.AIDEN_TASK_ID;
|
|
187
|
-
const conversationId = config.conversationId ?? process.env.AIDEN_SESSION_ID;
|
|
188
|
-
const teamId = config.teamId;
|
|
189
|
-
const artifactIds = [];
|
|
190
|
-
if (teamId)
|
|
191
|
-
artifactIds.push(`- teamId: "${teamId}"`);
|
|
192
|
-
if (taskId)
|
|
193
|
-
artifactIds.push(`- taskId: "${taskId}"`);
|
|
194
|
-
if (conversationId)
|
|
195
|
-
artifactIds.push(`- conversationId: "${conversationId}"`);
|
|
196
|
-
if (artifactIds.length > 0) {
|
|
197
|
-
parts.push([
|
|
198
|
-
"When creating artifacts using MCP tools (create_plan, create_document_artifact, create_test_report, upsert_prototype_version), always pass these IDs:",
|
|
199
|
-
...artifactIds,
|
|
200
|
-
].join("\n"));
|
|
201
|
-
}
|
|
202
|
-
if (taskId && conversationId && teamId) {
|
|
203
|
-
parts.push([
|
|
204
|
-
"## Prototype Artifacts",
|
|
205
|
-
"When the user asks to create, build, modify, or iterate on a prototype, do not create local prototype files such as prototype/index.html.",
|
|
206
|
-
"Instead, generate a Vite React TypeScript source snapshot and call the Aiden MCP tool upsert_prototype_version with teamId, taskId, conversationId, title, sourceSnapshot, and packageJson.",
|
|
207
|
-
"For follow-up changes to the same prototype, call list_prototypes or get_prototype if needed, then call upsert_prototype_version again with the existing prototypeId and parentVersionId so the task Prototypes panel renders the new version.",
|
|
208
|
-
].join("\n"));
|
|
209
|
-
}
|
|
210
|
-
// Inject team context so the agent uses the active team as default for all MCP calls
|
|
211
|
-
// (list_tasks, search, start_task_session, etc.) without needing list_teams.
|
|
212
|
-
if (teamId) {
|
|
213
|
-
parts.push(`You are operating within team \`${teamId}\`. Always use this as the \`teamId\` for all MCP tool calls that accept it (list_tasks, search, start_task_session, etc.). Do not call list_teams.`);
|
|
214
|
-
}
|
|
215
|
-
return parts;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
//# sourceMappingURL=core-agent.js.map
|
package/dist/core-agent.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core-agent.js","sourceRoot":"","sources":["../src/core-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,gBAAgB,EAA2B,MAAM,mBAAmB,CAAC;AAI9E,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IACrC,YAAY,GAA0C,IAAI,CAAC;IAC3D,QAAQ,GAAG,KAAK,CAAC;IAEzB,mEAAmE;IAC3D,MAAM,CAAU,gBAAgB,GAAG,IAAI,CAAC;IAEhD,YAAY,SAA4D,EAAE,OAA2B;QACnG,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,KAAK,EAAE,CAAC;QAEd,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;QAChC,IAAI,CAAC,KAAK,IAAI,KAAK,CAA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AAK,CAAC,IAAI,CACR,mCAAmC,MAAM,qJAAqJ,CAC/L,CAAC;QACJ,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Aiden Sandbox Agent
|
|
3
|
-
* Runs inside E2B sandbox, connects to WS server, executes CoreAgent.
|
|
4
|
-
*/
|
|
5
|
-
import { runSandbox } from "./sandbox.js";
|
|
6
|
-
import { AGENT_VERSION } from "./version.js";
|
|
7
|
-
// Support `aiden-agent --version` for version detection without starting the agent
|
|
8
|
-
if (process.argv.includes("--version")) {
|
|
9
|
-
process.stdout.write(`${AGENT_VERSION}\n`);
|
|
10
|
-
process.exit(0);
|
|
11
|
-
}
|
|
12
|
-
const wsUrl = process.env.AIDEN_WS_URL;
|
|
13
|
-
const sessionId = process.env.AIDEN_SESSION_ID;
|
|
14
|
-
const taskId = process.env.AIDEN_TASK_ID;
|
|
15
|
-
const sessionToken = process.env.AIDEN_SESSION_TOKEN;
|
|
16
|
-
const task = process.env.AIDEN_TASK;
|
|
17
|
-
const teamId = process.env.AIDEN_TEAM_ID || undefined;
|
|
18
|
-
const projectPath = process.env.AIDEN_PROJECT_PATH || "/home/user/workspace";
|
|
19
|
-
const backendKind = process.env.AIDEN_BACKEND_KIND || "claude_cli";
|
|
20
|
-
const agentId = process.env.AIDEN_AGENT_ID || undefined;
|
|
21
|
-
const agentPrompt = process.env.AIDEN_AGENT_PROMPT || undefined;
|
|
22
|
-
const mode = process.env.AIDEN_MODE || "agent";
|
|
23
|
-
const model = process.env.AIDEN_MODEL;
|
|
24
|
-
const contextWindow = process.env.AIDEN_CONTEXT_WINDOW || undefined;
|
|
25
|
-
const effortLevel = process.env.AIDEN_EFFORT_LEVEL || undefined;
|
|
26
|
-
const providerSessionId = process.env.AIDEN_PROVIDER_SESSION_ID || undefined;
|
|
27
|
-
if (!wsUrl || !sessionId || !taskId || !sessionToken || task == null) {
|
|
28
|
-
console.error("[aiden-agent] Missing required env vars: AIDEN_WS_URL, AIDEN_SESSION_ID, AIDEN_TASK_ID, AIDEN_SESSION_TOKEN, AIDEN_TASK");
|
|
29
|
-
process.exit(1);
|
|
30
|
-
}
|
|
31
|
-
console.info("[aiden-agent] Starting", { sessionId, taskId, projectPath, backendKind, agentId, mode, model, version: AGENT_VERSION });
|
|
32
|
-
runSandbox({
|
|
33
|
-
wsUrl,
|
|
34
|
-
sessionId,
|
|
35
|
-
taskId,
|
|
36
|
-
sessionToken,
|
|
37
|
-
task,
|
|
38
|
-
teamId,
|
|
39
|
-
projectPath,
|
|
40
|
-
backendKind,
|
|
41
|
-
agentId,
|
|
42
|
-
agentPrompt,
|
|
43
|
-
mode,
|
|
44
|
-
model,
|
|
45
|
-
contextWindow,
|
|
46
|
-
effortLevel,
|
|
47
|
-
providerSessionId,
|
|
48
|
-
maxIterations: 50,
|
|
49
|
-
}).catch((error) => {
|
|
50
|
-
console.error("[aiden-agent] Fatal error:", error);
|
|
51
|
-
process.exit(1);
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,mFAAmF;AACnF,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC;IAC3C,OAAO,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HAAyH,CAAC,CAAC;IACzI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC,CAAC;AAEtI,UAAU,CAAC;IACT,KAAK;IACL,SAAS;IACT,MAAM;IACN,YAAY;IACZ,IAAI;IACJ,MAAM;IACN,WAAW;IACX,WAAW;IACX,OAAO;IACP,WAAW;IACX,IAAI;IACJ,KAAK;IACL,aAAa;IACb,WAAW;IACX,iBAAiB;IACjB,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-backends.d.ts","sourceRoot":"","sources":["../src/runtime-backends.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
package/dist/runtime-backends.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-backends.js","sourceRoot":"","sources":["../src/runtime-backends.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
package/dist/sandbox.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export interface SandboxConfig {
|
|
2
|
-
wsUrl: string;
|
|
3
|
-
sessionId: string;
|
|
4
|
-
taskId: string;
|
|
5
|
-
teamId?: string;
|
|
6
|
-
sessionToken: string;
|
|
7
|
-
task: string;
|
|
8
|
-
projectPath: string;
|
|
9
|
-
backendKind?: string;
|
|
10
|
-
agentId?: string;
|
|
11
|
-
agentPrompt?: string;
|
|
12
|
-
mode?: string;
|
|
13
|
-
model?: string;
|
|
14
|
-
contextWindow?: string | null;
|
|
15
|
-
effortLevel?: string | null;
|
|
16
|
-
providerSessionId?: string;
|
|
17
|
-
currentUser?: {
|
|
18
|
-
id: string;
|
|
19
|
-
name: string | null;
|
|
20
|
-
email: string;
|
|
21
|
-
};
|
|
22
|
-
maxIterations?: number;
|
|
23
|
-
}
|
|
24
|
-
export declare function runSandbox(config: SandboxConfig): Promise<void>;
|
|
25
|
-
//# sourceMappingURL=sandbox.d.ts.map
|
package/dist/sandbox.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA4LrE"}
|
package/dist/sandbox.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox mode: connects to WS server, runs CoreAgent in a multi-turn loop.
|
|
3
|
-
* Runs INSIDE the E2B sandbox.
|
|
4
|
-
*/
|
|
5
|
-
import { CoreAgent } from "./core-agent.js";
|
|
6
|
-
import { WebPresenter } from "./web-presenter.js";
|
|
7
|
-
import { WSClient } from "./ws-client.js";
|
|
8
|
-
import { AGENT_VERSION } from "./version.js";
|
|
9
|
-
export async function runSandbox(config) {
|
|
10
|
-
let currentTask = config.task;
|
|
11
|
-
let currentImages = [];
|
|
12
|
-
let stopped = false;
|
|
13
|
-
let pendingMessageResolve = null;
|
|
14
|
-
let currentAgent = null;
|
|
15
|
-
// Per-turn enrichment state — updated from each incoming WS payload.
|
|
16
|
-
// Seeded from config for the first turn; overwritten on every subsequent turn.
|
|
17
|
-
let currentTaskMeta = undefined;
|
|
18
|
-
let currentWorkflowTools = undefined;
|
|
19
|
-
let currentMaxIterations = config.maxIterations ?? 50;
|
|
20
|
-
let currentTaskId = config.taskId;
|
|
21
|
-
let currentConversationId = config.sessionId;
|
|
22
|
-
let currentTeamId = config.teamId;
|
|
23
|
-
let currentUser = config.currentUser;
|
|
24
|
-
console.info("[sandbox] Connecting to WS server", { wsUrl: config.wsUrl, sessionId: config.sessionId });
|
|
25
|
-
const wsClient = new WSClient(config.wsUrl, config.sessionId, config.taskId, config.sessionToken, {
|
|
26
|
-
onUserMessage: (payload) => {
|
|
27
|
-
if (pendingMessageResolve) {
|
|
28
|
-
const resolve = pendingMessageResolve;
|
|
29
|
-
pendingMessageResolve = null;
|
|
30
|
-
resolve(payload);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
console.warn("[sandbox] No handler for user message — dropped");
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
onStop: () => {
|
|
37
|
-
console.info("[sandbox] Stop signal received");
|
|
38
|
-
if (currentAgent) {
|
|
39
|
-
const killed = currentAgent.kill();
|
|
40
|
-
if (!killed)
|
|
41
|
-
currentAgent.abort();
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
onToolResponse: (toolId, response) => {
|
|
45
|
-
if (currentAgent) {
|
|
46
|
-
const sent = currentAgent.sendToolResponse(toolId, response);
|
|
47
|
-
if (!sent) {
|
|
48
|
-
console.warn("[sandbox] Failed to deliver tool_response to agent stdin", { toolId });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
console.warn("[sandbox] No active agent for tool_response", { toolId });
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
onConnect: () => console.info("[sandbox] WS connected"),
|
|
56
|
-
onDisconnect: (reason) => console.info(`[sandbox] WS disconnected: ${reason}`),
|
|
57
|
-
}, AGENT_VERSION);
|
|
58
|
-
try {
|
|
59
|
-
await wsClient.waitForConnection();
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
console.error("[sandbox] Failed to connect to WS server:", error.message);
|
|
63
|
-
process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
const presenter = new WebPresenter(wsClient, config.sessionId);
|
|
66
|
-
presenter.setSuppressSessionLifecycle(true);
|
|
67
|
-
let lastProviderSessionId = config.providerSessionId;
|
|
68
|
-
let activeBackendKind = config.backendKind || "claude_cli";
|
|
69
|
-
let activeAgentId = config.agentId;
|
|
70
|
-
let activeAgentPrompt = config.agentPrompt;
|
|
71
|
-
let activeModel = config.model;
|
|
72
|
-
let activeContextWindow = config.contextWindow;
|
|
73
|
-
let activeEffortLevel = config.effortLevel;
|
|
74
|
-
let activeMode = config.mode || "agent";
|
|
75
|
-
while (!stopped) {
|
|
76
|
-
if (currentTask?.trim()) {
|
|
77
|
-
const agent = new CoreAgent(presenter, {
|
|
78
|
-
backendKind: activeBackendKind,
|
|
79
|
-
});
|
|
80
|
-
currentAgent = agent;
|
|
81
|
-
let result;
|
|
82
|
-
try {
|
|
83
|
-
result = await agent.run({
|
|
84
|
-
task: currentTask,
|
|
85
|
-
maxIterations: currentMaxIterations,
|
|
86
|
-
teamPath: config.projectPath,
|
|
87
|
-
cwd: config.projectPath,
|
|
88
|
-
backendKind: activeBackendKind,
|
|
89
|
-
agentId: activeAgentId,
|
|
90
|
-
agentPrompt: activeAgentPrompt,
|
|
91
|
-
mode: activeMode,
|
|
92
|
-
selectedModel: activeModel,
|
|
93
|
-
selectedContextWindow: activeContextWindow ?? null,
|
|
94
|
-
selectedEffortLevel: activeEffortLevel ?? null,
|
|
95
|
-
providerSessionId: lastProviderSessionId ?? undefined,
|
|
96
|
-
taskMeta: currentTaskMeta,
|
|
97
|
-
taskId: currentTaskId,
|
|
98
|
-
conversationId: currentConversationId,
|
|
99
|
-
teamId: currentTeamId,
|
|
100
|
-
currentUser,
|
|
101
|
-
workflowTools: currentWorkflowTools,
|
|
102
|
-
images: currentImages.length > 0
|
|
103
|
-
? currentImages.map((img) => ({
|
|
104
|
-
id: img.id,
|
|
105
|
-
data: img.data,
|
|
106
|
-
mimeType: img.mimeType,
|
|
107
|
-
filename: img.filename,
|
|
108
|
-
width: 0,
|
|
109
|
-
height: 0,
|
|
110
|
-
}))
|
|
111
|
-
: undefined,
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
116
|
-
console.error("[sandbox] Agent run failed:", errorMessage);
|
|
117
|
-
result = { success: false, summary: "Agent run failed", filesModified: [], planFilesCreated: [], iterations: 0, error: errorMessage };
|
|
118
|
-
}
|
|
119
|
-
currentAgent = null;
|
|
120
|
-
if (result?.providerSessionId) {
|
|
121
|
-
lastProviderSessionId = result.providerSessionId;
|
|
122
|
-
}
|
|
123
|
-
if (stopped)
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
// Wait for next user message
|
|
127
|
-
const nextPayload = await new Promise((resolve) => {
|
|
128
|
-
pendingMessageResolve = resolve;
|
|
129
|
-
});
|
|
130
|
-
if (nextPayload === null || stopped) {
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
currentTask = nextPayload.text;
|
|
134
|
-
currentImages = nextPayload.images ?? [];
|
|
135
|
-
if (nextPayload.providerSessionId) {
|
|
136
|
-
lastProviderSessionId = nextPayload.providerSessionId;
|
|
137
|
-
}
|
|
138
|
-
if (nextPayload.backendKind) {
|
|
139
|
-
activeBackendKind = nextPayload.backendKind;
|
|
140
|
-
}
|
|
141
|
-
if (nextPayload.agentId !== undefined) {
|
|
142
|
-
activeAgentId = nextPayload.agentId;
|
|
143
|
-
}
|
|
144
|
-
if (nextPayload.agentPrompt !== undefined) {
|
|
145
|
-
activeAgentPrompt = nextPayload.agentPrompt;
|
|
146
|
-
}
|
|
147
|
-
if (nextPayload.selectedModel) {
|
|
148
|
-
activeModel = nextPayload.selectedModel;
|
|
149
|
-
}
|
|
150
|
-
if (nextPayload.selectedContextWindow !== undefined) {
|
|
151
|
-
activeContextWindow = nextPayload.selectedContextWindow;
|
|
152
|
-
}
|
|
153
|
-
if (nextPayload.selectedEffortLevel !== undefined) {
|
|
154
|
-
activeEffortLevel = nextPayload.selectedEffortLevel;
|
|
155
|
-
}
|
|
156
|
-
if (nextPayload.mode) {
|
|
157
|
-
activeMode = nextPayload.mode;
|
|
158
|
-
}
|
|
159
|
-
// Update per-turn enrichment fields from the incoming payload
|
|
160
|
-
if (nextPayload.taskMeta !== undefined) {
|
|
161
|
-
currentTaskMeta = nextPayload.taskMeta;
|
|
162
|
-
}
|
|
163
|
-
if (nextPayload.workflowTools !== undefined) {
|
|
164
|
-
currentWorkflowTools = nextPayload.workflowTools;
|
|
165
|
-
}
|
|
166
|
-
if (nextPayload.maxIterations !== undefined) {
|
|
167
|
-
currentMaxIterations = nextPayload.maxIterations;
|
|
168
|
-
}
|
|
169
|
-
if (nextPayload.taskId !== undefined) {
|
|
170
|
-
currentTaskId = nextPayload.taskId;
|
|
171
|
-
}
|
|
172
|
-
if (nextPayload.conversationId !== undefined) {
|
|
173
|
-
currentConversationId = nextPayload.conversationId;
|
|
174
|
-
}
|
|
175
|
-
if (nextPayload.currentUser !== undefined) {
|
|
176
|
-
currentUser = nextPayload.currentUser;
|
|
177
|
-
}
|
|
178
|
-
if (nextPayload.teamId !== undefined) {
|
|
179
|
-
currentTeamId = nextPayload.teamId;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
presenter.setSuppressSessionLifecycle(false);
|
|
183
|
-
wsClient.close();
|
|
184
|
-
}
|
|
185
|
-
//# sourceMappingURL=sandbox.js.map
|
package/dist/sandbox.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAA+C,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAsB7C,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAqB;IACpD,IAAI,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;IAC9B,IAAI,aAAa,GAAoB,EAAE,CAAC;IACxC,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,qBAAqB,GAA0D,IAAI,CAAC;IACxF,IAAI,YAAY,GAAqB,IAAI,CAAC;IAE1C,qEAAqE;IACrE,+EAA+E;IAC/E,IAAI,eAAe,GAA+C,SAAS,CAAC;IAC5E,IAAI,oBAAoB,GAAoD,SAAS,CAAC;IACtF,IAAI,oBAAoB,GAAW,MAAM,CAAC,aAAa,IAAI,EAAE,CAAC;IAC9D,IAAI,aAAa,GAAuB,MAAM,CAAC,MAAM,CAAC;IACtD,IAAI,qBA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AED,SAAS,CAAC,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
package/dist/types.d.ts
DELETED
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qBAAqB,CAAC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qBAAqB,CAAC"}
|
package/dist/updater.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface UpdatePayload {
|
|
2
|
-
devMode: boolean;
|
|
3
|
-
version?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Install the new agent version via npm.
|
|
7
|
-
* Returns true if the install succeeded.
|
|
8
|
-
*/
|
|
9
|
-
export declare function installUpdate(payload: UpdatePayload): Promise<boolean>;
|
|
10
|
-
/**
|
|
11
|
-
* Spawn a new agent process with the same env vars, then exit this process.
|
|
12
|
-
* Preserves the provider session ID so the new agent can resume Claude context.
|
|
13
|
-
*/
|
|
14
|
-
export declare function respawnAgent(lastProviderSessionId?: string): void;
|
|
15
|
-
//# sourceMappingURL=updater.d.ts.map
|
package/dist/updater.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAmB5E;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAmBjE"}
|
package/dist/updater.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Self-update logic for the sandbox agent.
|
|
3
|
-
* In prod/staging, installs the new version from npm.
|
|
4
|
-
*/
|
|
5
|
-
import { execSync, spawn } from "node:child_process";
|
|
6
|
-
const DEFAULT_PATH = "/home/user/.local/node/bin:/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
|
7
|
-
/**
|
|
8
|
-
* Install the new agent version via npm.
|
|
9
|
-
* Returns true if the install succeeded.
|
|
10
|
-
*/
|
|
11
|
-
export async function installUpdate(payload) {
|
|
12
|
-
const version = payload.version ?? "latest";
|
|
13
|
-
if (!/^[\w.\-+]+$/.test(version)) {
|
|
14
|
-
console.error(`[updater] Refusing to install: invalid version string "${version}"`);
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
console.info(`[updater] Installing @aiden-ade/sandbox-agent@${version} via npm`);
|
|
19
|
-
execSync(`npm install -g @aiden-ade/sandbox-agent@${version}`, {
|
|
20
|
-
timeout: 60_000,
|
|
21
|
-
env: { ...process.env, PATH: DEFAULT_PATH },
|
|
22
|
-
stdio: "pipe",
|
|
23
|
-
});
|
|
24
|
-
console.info("[updater] npm install complete");
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error("[updater] npm install failed:", error.message);
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Spawn a new agent process with the same env vars, then exit this process.
|
|
34
|
-
* Preserves the provider session ID so the new agent can resume Claude context.
|
|
35
|
-
*/
|
|
36
|
-
export function respawnAgent(lastProviderSessionId) {
|
|
37
|
-
const env = { ...process.env };
|
|
38
|
-
if (lastProviderSessionId) {
|
|
39
|
-
env.AIDEN_PROVIDER_SESSION_ID = lastProviderSessionId;
|
|
40
|
-
}
|
|
41
|
-
console.info("[updater] Spawning new agent process");
|
|
42
|
-
const child = spawn("aiden-agent", [], {
|
|
43
|
-
detached: true,
|
|
44
|
-
stdio: "ignore",
|
|
45
|
-
env: { ...env, PATH: DEFAULT_PATH },
|
|
46
|
-
});
|
|
47
|
-
child.unref();
|
|
48
|
-
// Give the new process a moment to start before we exit
|
|
49
|
-
setTimeout(() => {
|
|
50
|
-
console.info("[updater] Old agent exiting after respawn");
|
|
51
|
-
process.exit(0);
|
|
52
|
-
}, 500);
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=updater.js.map
|
package/dist/updater.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updater.js","sourceRoot":"","sources":["../src/updater.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,YAAY,GAAG,+GAA+G,CAAC;AAOrI;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC;IAC5C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,KAAK,CAAC,0DAA0D,OAAO,GAAG,CAAC,CAAC;QACpF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,iDAAiD,OAAO,UAAU,CAAC,CAAC;QACjF,QAAQ,CAAC,2CAA2C,OAAO,EAAE,EAAE;YAC7D,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE;YAC3C,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,qBAA8B;IACzD,MAAM,GAAG,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,IAAI,qBAAqB,EAAE,CAAC;QAC1B,GAAG,CAAC,yBAAyB,GAAG,qBAAqB,CAAC;IACxD,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE;QACrC,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,QAAQ;QACf,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE;KACpC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE,CAAC;IAEd,wDAAwD;IACxD,UAAU,CAAC,GAAG,EAAE;QACd,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,EAAE,GAAG,CAAC,CAAC;AACV,CAAC"}
|
package/dist/version.d.ts
DELETED
package/dist/version.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,UAAU,CAAC"}
|
package/dist/version.js
DELETED
package/dist/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC"}
|
package/dist/web-presenter.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { WSClient } from "./ws-client.js";
|
|
2
|
-
import type { AgentConfig, AgentResult, ExitPlanModeInput, UsageUpdate } from "./types.js";
|
|
3
|
-
import type { AgentPresenter } from "./types.js";
|
|
4
|
-
export declare class WebPresenter implements AgentPresenter {
|
|
5
|
-
private wsClient;
|
|
6
|
-
private conversationId;
|
|
7
|
-
private suppressSessionLifecycle;
|
|
8
|
-
constructor(wsClient: WSClient, conversationId: string);
|
|
9
|
-
setSuppressSessionLifecycle(suppress: boolean): void;
|
|
10
|
-
onStart(config: AgentConfig): void;
|
|
11
|
-
onLog(message: string): void;
|
|
12
|
-
onAssistantText(text: string): void;
|
|
13
|
-
onThinking(text: string): void;
|
|
14
|
-
onToolUse(tool: string, input: unknown, toolId: string): void;
|
|
15
|
-
onToolResult(toolId: string, content: string, isError?: boolean): void;
|
|
16
|
-
onTurnComplete(content: unknown[]): void;
|
|
17
|
-
onUsageUpdate(usage: UsageUpdate): void;
|
|
18
|
-
onAskUser(id: string, questions: unknown[]): void;
|
|
19
|
-
onTodoWrite(todos: unknown[]): void;
|
|
20
|
-
onExitPlanMode(id: string, input: ExitPlanModeInput, planFilePath?: string): void;
|
|
21
|
-
onCheckpoint(id: string): void;
|
|
22
|
-
onActivity(status: string): void;
|
|
23
|
-
onOpenBrowserTab(browserId: string, url?: string): void;
|
|
24
|
-
recordRawTranscript(): void;
|
|
25
|
-
onError(message: string, _isAgentError?: boolean): void;
|
|
26
|
-
onComplete(result: AgentResult): void;
|
|
27
|
-
/**
|
|
28
|
-
* Manually emit session lifecycle events and close.
|
|
29
|
-
* Called after the multi-turn loop exits.
|
|
30
|
-
*/
|
|
31
|
-
emitSessionEnd(result: AgentResult): Promise<void>;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=web-presenter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
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AAC,EAAE,MAAM,GAAG,IAAI;IAIjF,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI9B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIhC,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAIvD,mBAAmB,IAAI,IAAI;IAI3B,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI;IAQvD,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAkBrC;;;OAGG;IACG,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAQzD"}
|
package/dist/web-presenter.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export class WebPresenter {
|
|
2
|
-
wsClient;
|
|
3
|
-
conversationId;
|
|
4
|
-
suppressSessionLifecycle = false;
|
|
5
|
-
constructor(wsClient, conversationId) {
|
|
6
|
-
this.wsClient = wsClient;
|
|
7
|
-
this.conversationId = conversationId;
|
|
8
|
-
}
|
|
9
|
-
setSuppressSessionLifecycle(suppress) {
|
|
10
|
-
this.suppressSessionLifecycle = suppress;
|
|
11
|
-
}
|
|
12
|
-
onStart(config) {
|
|
13
|
-
this.wsClient.emitEvent({ type: "start", task: config.task, ts: Date.now() });
|
|
14
|
-
}
|
|
15
|
-
onLog(message) {
|
|
16
|
-
console.error(message);
|
|
17
|
-
}
|
|
18
|
-
onAssistantText(text) {
|
|
19
|
-
this.wsClient.emitEvent({ type: "text", text, ts: Date.now() });
|
|
20
|
-
}
|
|
21
|
-
onThinking(text) {
|
|
22
|
-
this.wsClient.emitEvent({ type: "thinking", text, ts: Date.now() });
|
|
23
|
-
}
|
|
24
|
-
onToolUse(tool, input, toolId) {
|
|
25
|
-
this.wsClient.emitEvent({ type: "tool_use", id: toolId, name: tool, input, ts: Date.now() });
|
|
26
|
-
}
|
|
27
|
-
onToolResult(toolId, content, isError) {
|
|
28
|
-
this.wsClient.emitEvent({
|
|
29
|
-
type: "tool_result",
|
|
30
|
-
id: toolId,
|
|
31
|
-
content,
|
|
32
|
-
ts: Date.now(),
|
|
33
|
-
...(isError ? { is_error: true } : {}),
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
onTurnComplete(content) {
|
|
37
|
-
this.wsClient.emitEvent({ type: "turn_complete", content, ts: Date.now() });
|
|
38
|
-
}
|
|
39
|
-
onUsageUpdate(usage) {
|
|
40
|
-
this.wsClient.emitEvent({ type: "usage", usage });
|
|
41
|
-
}
|
|
42
|
-
onAskUser(id, questions) {
|
|
43
|
-
this.wsClient.emitEvent({ type: "ask_user", id, questions });
|
|
44
|
-
}
|
|
45
|
-
onTodoWrite(todos) {
|
|
46
|
-
this.wsClient.emitEvent({ type: "todo_write", todos });
|
|
47
|
-
}
|
|
48
|
-
onExitPlanMode(id, input, planFilePath) {
|
|
49
|
-
this.wsClient.emitEvent({ type: "exit_plan_mode", id, input, ...(planFilePath ? { planFilePath } : {}) });
|
|
50
|
-
}
|
|
51
|
-
onCheckpoint(id) {
|
|
52
|
-
this.wsClient.emitEvent({ type: "checkpoint", id });
|
|
53
|
-
}
|
|
54
|
-
onActivity(status) {
|
|
55
|
-
this.wsClient.emitEvent({ type: "activity", status, ts: Date.now() });
|
|
56
|
-
}
|
|
57
|
-
onOpenBrowserTab(browserId, url) {
|
|
58
|
-
this.wsClient.emitEvent({ type: "open_browser_tab", browserId, ...(url ? { url } : {}) });
|
|
59
|
-
}
|
|
60
|
-
recordRawTranscript() {
|
|
61
|
-
// No-op for sandbox — raw transcripts stay in the container
|
|
62
|
-
}
|
|
63
|
-
onError(message, _isAgentError) {
|
|
64
|
-
this.wsClient.emitEvent({ type: "error", message });
|
|
65
|
-
if (!this.suppressSessionLifecycle) {
|
|
66
|
-
this.wsClient.emitEvent({ type: "session_error", error: message });
|
|
67
|
-
this.wsClient.close();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
onComplete(result) {
|
|
71
|
-
// Always send query_complete so the server persists query content
|
|
72
|
-
this.wsClient.emitEvent({ type: "query_complete", result, ts: Date.now() });
|
|
73
|
-
// In multi-turn mode (suppressSessionLifecycle=true), skip session lifecycle
|
|
74
|
-
if (this.suppressSessionLifecycle) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
// Single-turn mode: also send session lifecycle event and close
|
|
78
|
-
if (result.success) {
|
|
79
|
-
this.wsClient.emitEvent({ type: "session_complete", result });
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.wsClient.emitEvent({ type: "session_error", error: result.error || "Unknown error" });
|
|
83
|
-
}
|
|
84
|
-
this.wsClient.close();
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Manually emit session lifecycle events and close.
|
|
88
|
-
* Called after the multi-turn loop exits.
|
|
89
|
-
*/
|
|
90
|
-
async emitSessionEnd(result) {
|
|
91
|
-
if (result.success) {
|
|
92
|
-
this.wsClient.emitEvent({ type: "session_complete", result });
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
this.wsClient.emitEvent({ type: "session_error", error: result.error || "Unknown error" });
|
|
96
|
-
}
|
|
97
|
-
this.wsClient.close();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=web-presenter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-presenter.js","sourceRoot":"","sources":["../src/web-presenter.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,YAAY;IACf,QAAQ,CAAW;IACnB,cAAc,CAAS;IACvB,wBAAwB,GAAG,KAAK,CAAC;IAEzC,YAAY,QAAkB,EAAE,cAAsB;QACpD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,2BAA2B,CAAC,QAAiB;QAC3C,IAAI,CAAC,wBAAwB,GA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CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc,CAAC,MAAmB;QACtC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;QAChE,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;CACF"}
|
package/dist/ws-client.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import type { AgentEvent } from "./types.js";
|
|
2
|
-
export interface ResolvedImage {
|
|
3
|
-
id: string;
|
|
4
|
-
data: string;
|
|
5
|
-
mimeType: string;
|
|
6
|
-
filename: string;
|
|
7
|
-
}
|
|
8
|
-
export interface UserMessagePayload {
|
|
9
|
-
text: string;
|
|
10
|
-
images?: ResolvedImage[];
|
|
11
|
-
providerSessionId?: string;
|
|
12
|
-
backendKind?: string;
|
|
13
|
-
agentId?: string;
|
|
14
|
-
agentPrompt?: string;
|
|
15
|
-
selectedModel?: string;
|
|
16
|
-
selectedContextWindow?: string | null;
|
|
17
|
-
selectedEffortLevel?: string | null;
|
|
18
|
-
mode?: string;
|
|
19
|
-
/** Structured task metadata for system prompt injection. */
|
|
20
|
-
taskMeta?: {
|
|
21
|
-
id: string;
|
|
22
|
-
title: string;
|
|
23
|
-
description: string | null;
|
|
24
|
-
status: string;
|
|
25
|
-
priority: string;
|
|
26
|
-
labels: string[] | null;
|
|
27
|
-
assignees: Array<{
|
|
28
|
-
name: string | null;
|
|
29
|
-
email: string;
|
|
30
|
-
}>;
|
|
31
|
-
descriptionAttachmentIds?: Array<{
|
|
32
|
-
id: string;
|
|
33
|
-
filename: string;
|
|
34
|
-
}>;
|
|
35
|
-
};
|
|
36
|
-
/** Workflow tool allowlist (present when triggered from a workflow). */
|
|
37
|
-
workflowTools?: Array<{
|
|
38
|
-
type: string;
|
|
39
|
-
id: string;
|
|
40
|
-
}>;
|
|
41
|
-
/** Agent run ID for status tracking. */
|
|
42
|
-
runId?: string;
|
|
43
|
-
/** Message ID that triggered this run. */
|
|
44
|
-
messageId?: string;
|
|
45
|
-
/** Maximum number of agent iterations. */
|
|
46
|
-
maxIterations?: number;
|
|
47
|
-
/** Task ID for MCP artifact creation. */
|
|
48
|
-
taskId?: string;
|
|
49
|
-
/** Conversation ID for MCP artifact creation. */
|
|
50
|
-
conversationId?: string;
|
|
51
|
-
/** Role attached to this conversation. */
|
|
52
|
-
/** Team ID of the active team context — injected into system prompt for MCP calls. */
|
|
53
|
-
teamId?: string;
|
|
54
|
-
/** User who initiated the run. */
|
|
55
|
-
currentUser?: {
|
|
56
|
-
id: string;
|
|
57
|
-
name: string | null;
|
|
58
|
-
email: string;
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
export interface WSClientCallbacks {
|
|
62
|
-
onUserMessage: (payload: UserMessagePayload) => void;
|
|
63
|
-
onStop: () => void;
|
|
64
|
-
onToolResponse?: (toolId: string, response: string) => void;
|
|
65
|
-
onConnect?: () => void;
|
|
66
|
-
onDisconnect?: (reason: string) => void;
|
|
67
|
-
}
|
|
68
|
-
export declare class WSClient {
|
|
69
|
-
private socket;
|
|
70
|
-
constructor(wsUrl: string, sessionId: string, // conversationId
|
|
71
|
-
taskId: string, token: string, // sandboxSessionToken
|
|
72
|
-
callbacks: WSClientCallbacks, agentVersion?: string);
|
|
73
|
-
emitEvent(event: AgentEvent): void;
|
|
74
|
-
waitForConnection(timeoutMs?: number): Promise<void>;
|
|
75
|
-
get connected(): boolean;
|
|
76
|
-
close(): void;
|
|
77
|
-
private setupListeners;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=ws-client.d.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,GAAG,IAAI;IAIlC,iBAAiB,CAAC,SAAS,SAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD,IAAI,SAAS,IAAI,OAAO,CAAkC;IAC1D,KAAK,IAAI,IAAI;IAEb,OAAO,CAAC,cAAc;CAoCvB"}
|
package/dist/ws-client.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { io } from "socket.io-client";
|
|
2
|
-
export class WSClient {
|
|
3
|
-
socket;
|
|
4
|
-
constructor(wsUrl, sessionId, // conversationId
|
|
5
|
-
taskId, token, // sandboxSessionToken
|
|
6
|
-
callbacks, agentVersion) {
|
|
7
|
-
this.socket = io(wsUrl, {
|
|
8
|
-
query: { type: "agent", sessionId, taskId, agentVersion: agentVersion ?? "" },
|
|
9
|
-
auth: { token },
|
|
10
|
-
transports: ["websocket"],
|
|
11
|
-
reconnection: true,
|
|
12
|
-
reconnectionAttempts: Infinity,
|
|
13
|
-
reconnectionDelay: 1000,
|
|
14
|
-
reconnectionDelayMax: 5000,
|
|
15
|
-
timeout: 20_000,
|
|
16
|
-
upgrade: false,
|
|
17
|
-
extraHeaders: { "ngrok-skip-browser-warning": "1" },
|
|
18
|
-
});
|
|
19
|
-
this.setupListeners(callbacks);
|
|
20
|
-
}
|
|
21
|
-
emitEvent(event) {
|
|
22
|
-
this.socket.emit("agent_event", event);
|
|
23
|
-
}
|
|
24
|
-
waitForConnection(timeoutMs = 15000) {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
if (this.socket.connected) {
|
|
27
|
-
resolve();
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const timeout = setTimeout(() => reject(new Error(`WSClient connection timeout after ${timeoutMs}ms`)), timeoutMs);
|
|
31
|
-
this.socket.once("connect", () => { clearTimeout(timeout); resolve(); });
|
|
32
|
-
this.socket.once("connect_error", (err) => { clearTimeout(timeout); reject(new Error(`WSClient connection failed: ${err.message}`)); });
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
get connected() { return this.socket.connected; }
|
|
36
|
-
close() { this.socket.disconnect(); }
|
|
37
|
-
setupListeners(callbacks) {
|
|
38
|
-
this.socket.on("connect", () => { console.debug("[WSClient] Connected to WS server"); callbacks.onConnect?.(); });
|
|
39
|
-
this.socket.on("disconnect", (reason) => { console.debug(`[WSClient] Disconnected: ${reason}`); callbacks.onDisconnect?.(reason); });
|
|
40
|
-
this.socket.on("connect_error", (error) => { console.warn(`[WSClient] Connection error: ${error.message}`); });
|
|
41
|
-
this.socket.on("user_message", (data, ack) => {
|
|
42
|
-
ack?.({ ok: true });
|
|
43
|
-
callbacks.onUserMessage({
|
|
44
|
-
text: data.text,
|
|
45
|
-
images: data.images,
|
|
46
|
-
providerSessionId: data.providerSessionId,
|
|
47
|
-
backendKind: data.backendKind,
|
|
48
|
-
agentId: data.agentId,
|
|
49
|
-
agentPrompt: data.agentPrompt,
|
|
50
|
-
selectedModel: data.selectedModel,
|
|
51
|
-
selectedContextWindow: data.selectedContextWindow,
|
|
52
|
-
selectedEffortLevel: data.selectedEffortLevel,
|
|
53
|
-
mode: data.mode,
|
|
54
|
-
taskMeta: data.taskMeta,
|
|
55
|
-
workflowTools: data.workflowTools,
|
|
56
|
-
runId: data.runId,
|
|
57
|
-
messageId: data.messageId,
|
|
58
|
-
maxIterations: data.maxIterations,
|
|
59
|
-
taskId: data.taskId,
|
|
60
|
-
conversationId: data.conversationId,
|
|
61
|
-
teamId: data.teamId,
|
|
62
|
-
currentUser: data.currentUser,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
this.socket.on("stop", () => { callbacks.onStop(); });
|
|
66
|
-
this.socket.on("tool_response", (data) => {
|
|
67
|
-
if (data?.toolId && typeof data.response === "string") {
|
|
68
|
-
callbacks.onToolResponse?.(data.toolId, data.response);
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
this.socket.on("error", (data) => { console.error(`[WSClient] Server error: ${data.message} (${data.code})`); });
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
//# sourceMappingURL=ws-client.js.map
|
package/dist/ws-client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ws-client.js","sourceRoot":"","sources":["../src/ws-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAe,MAAM,kBAAkB,CAAC;AA2DnD,MAAM,OAAO,QAAQ;IACX,MAAM,CAAS;IAEvB,YACE,KAAa,EACb,SAAiB,EAAK,iBAAiB;IACvC,MAAc,EACd,KAAa,EAAS,sBAAsB;IAC5C,SAA4B,EAC5B,YAAqB;QAErB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,EAAE;YACtB,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,IAAI,EAAE,EAAE;YAC7E,IAAI,EAAE,EAAE,KAAK,EAAE;YACf,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,YAAY,EAAE,IAAI;YAClB,oBAAoB,EAAE,QAAQ;YAC9B,iBAAiB,EAAE,IAAI;YACvB,oBAAoB,EAAE,IAAI;YAC1B,OAAO,EAAE,MAAM;YACf,OAAO,EAAE,KAAK;YACd,YAAY,EAAE,EAAE,4BAA4B,EAAE,GAAG,EAAE;SACpD,CAAC,CAAC;QACH,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,SAAS,CAAC,KAAiB;QACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB,CAAC,SAAS,GAAG,KAAK;QACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;gBAAC,OAAO,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YACjD,MAAM,OAAO,GAAG,UAAU,C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