@aiden-ade/sandbox-agent 0.1.15 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/aiden-system-prompt.d.ts +6 -0
  2. package/dist/aiden-system-prompt.d.ts.map +1 -0
  3. package/dist/aiden-system-prompt.js +6 -0
  4. package/dist/aiden-system-prompt.js.map +1 -0
  5. package/dist/core-agent.d.ts +33 -0
  6. package/dist/core-agent.d.ts.map +1 -0
  7. package/dist/core-agent.js +218 -0
  8. package/dist/core-agent.js.map +1 -0
  9. package/dist/index.cjs +332 -42
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +53 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/runtime-backends.d.ts +2 -0
  15. package/dist/runtime-backends.d.ts.map +1 -0
  16. package/dist/runtime-backends.js +2 -0
  17. package/dist/runtime-backends.js.map +1 -0
  18. package/dist/sandbox.d.ts +25 -0
  19. package/dist/sandbox.d.ts.map +1 -0
  20. package/dist/sandbox.js +185 -0
  21. package/dist/sandbox.js.map +1 -0
  22. package/dist/types.d.ts +6 -0
  23. package/dist/types.d.ts.map +1 -0
  24. package/dist/types.js +6 -0
  25. package/dist/types.js.map +1 -0
  26. package/dist/updater.d.ts +15 -0
  27. package/dist/updater.d.ts.map +1 -0
  28. package/dist/updater.js +50 -0
  29. package/dist/updater.js.map +1 -0
  30. package/dist/version.d.ts +2 -0
  31. package/dist/version.d.ts.map +1 -0
  32. package/dist/version.js +2 -0
  33. package/dist/version.js.map +1 -0
  34. package/dist/web-presenter.d.ts +33 -0
  35. package/dist/web-presenter.d.ts.map +1 -0
  36. package/dist/web-presenter.js +100 -0
  37. package/dist/web-presenter.js.map +1 -0
  38. package/dist/ws-client.d.ts +79 -0
  39. package/dist/ws-client.d.ts.map +1 -0
  40. package/dist/ws-client.js +74 -0
  41. package/dist/ws-client.js.map +1 -0
  42. package/package.json +11 -12
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Re-exports from the canonical shared system prompt.
3
+ * Single source of truth: packages/shared/src/agent/system-prompt.ts
4
+ */
5
+ export * from "@aiden/shared/agent";
6
+ //# sourceMappingURL=aiden-system-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiden-system-prompt.d.ts","sourceRoot":"","sources":["../src/aiden-system-prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Re-exports from the canonical shared system prompt.
3
+ * Single source of truth: packages/shared/src/agent/system-prompt.ts
4
+ */
5
+ export * from "@aiden/shared/agent";
6
+ //# sourceMappingURL=aiden-system-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aiden-system-prompt.js","sourceRoot":"","sources":["../src/aiden-system-prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,33 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,218 @@
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;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