@aiden-ade/sandbox-agent 0.1.8 → 0.1.10

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.
@@ -14,17 +14,13 @@ import type { ChildProcessWithoutNullStreams } from "node:child_process";
14
14
  import type { AgentConfig } from "./types.js";
15
15
  export declare class CoreAgent extends BaseMachineAgent {
16
16
  private childProcess;
17
+ private _aborted;
18
+ /** How long to wait after SIGTERM before escalating to SIGKILL. */
19
+ private static readonly SIGKILL_DELAY_MS;
17
20
  constructor(presenter: ConstructorParameters<typeof BaseMachineAgent>[0], runtime: AgentRuntimeConfig);
18
- /**
19
- * Send a new user message to the CLI's stdin (stream-json format).
20
- * Used during continuation mode when the CLI process is still alive after
21
- * completing a turn — the message is processed as the next conversation turn
22
- * without spawning a new subprocess.
23
- */
24
- sendUserMessage(text: string, images?: Array<{
25
- data: string;
26
- mimeType: string;
27
- }>): boolean;
21
+ abort(): void;
22
+ kill(): boolean;
23
+ private killChildProcess;
28
24
  /**
29
25
  * Send a tool_result to the CLI's stdin (stream-json format).
30
26
  * Used for interactive tools like AskUserQuestion.
@@ -32,6 +28,6 @@ export declare class CoreAgent extends BaseMachineAgent {
32
28
  sendToolResponse(toolId: string, response: string): boolean;
33
29
  protected getOnProcessSpawned(): ((child: ChildProcessWithoutNullStreams) => void) | undefined;
34
30
  protected buildCliEnvironment(): Promise<Record<string, string>>;
35
- protected buildExtraSystemPromptParts(_config: AgentConfig): string[];
31
+ protected buildExtraSystemPromptParts(config: AgentConfig): string[];
36
32
  }
37
33
  //# sourceMappingURL=core-agent.d.ts.map
@@ -1 +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;AAE9E,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBA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qB,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"}
@@ -10,51 +10,69 @@
10
10
  * in BaseMachineAgent.
11
11
  */
12
12
  import { BaseMachineAgent } from "@aiden/agent-core";
13
- import { accessSync, chmodSync, constants as fsConstants, statSync } from "node:fs";
14
13
  export class CoreAgent extends BaseMachineAgent {
15
14
  childProcess = null;
15
+ _aborted = false;
16
+ /** How long to wait after SIGTERM before escalating to SIGKILL. */
17
+ static SIGKILL_DELAY_MS = 3000;
16
18
  constructor(presenter, runtime) {
17
19
  super(presenter, runtime);
18
20
  }
19
- // ── Interactive tool response / continuation user message (WS relay → stdin) ──
20
- /**
21
- * Send a new user message to the CLI's stdin (stream-json format).
22
- * Used during continuation mode when the CLI process is still alive after
23
- * completing a turn — the message is processed as the next conversation turn
24
- * without spawning a new subprocess.
25
- */
26
- sendUserMessage(text, images) {
27
- if (!this.childProcess)
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)
28
30
  return false;
29
- const stdin = this.childProcess.stdin;
30
- if (!stdin || stdin.destroyed)
31
+ return this.killChildProcess(child);
32
+ }
33
+ killChildProcess(child) {
34
+ const pid = child.pid;
35
+ if (!pid)
31
36
  return false;
37
+ console.info("[CoreAgent] Killing agent process", { pid });
32
38
  try {
33
- const contentBlocks = [];
34
- if (images && images.length > 0) {
35
- for (const img of images) {
36
- contentBlocks.push({
37
- type: "image",
38
- source: { type: "base64", media_type: img.mimeType, data: img.data },
39
- });
40
- }
39
+ if (process.platform === "win32") {
40
+ child.kill("SIGTERM");
41
+ }
42
+ else {
43
+ process.kill(-pid, "SIGTERM");
41
44
  }
42
- contentBlocks.push({ type: "text", text });
43
- const message = JSON.stringify({
44
- type: "user",
45
- message: { role: "user", content: contentBlocks },
46
- session_id: "default",
47
- parent_tool_use_id: null,
48
- });
49
- stdin.write(message + "\n");
50
- console.info("[CoreAgent] Sent user message to CLI stdin (continuation mode)");
51
- return true;
52
45
  }
53
46
  catch (err) {
54
- console.error("[CoreAgent] Failed to write user message to stdin", err);
55
- return false;
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 */ }
56
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;
57
74
  }
75
+ // ── Interactive tool response (WS relay → stdin) ───────────────────────
58
76
  /**
59
77
  * Send a tool_result to the CLI's stdin (stream-json format).
60
78
  * Used for interactive tools like AskUserQuestion.
@@ -95,6 +113,10 @@ export class CoreAgent extends BaseMachineAgent {
95
113
  return (child) => {
96
114
  this.childProcess = child;
97
115
  child.on("exit", () => { this.childProcess = null; });
116
+ child.on("error", () => { this.childProcess = null; });
117
+ if (this._aborted) {
118
+ this.killChildProcess(child);
119
+ }
98
120
  };
99
121
  }
100
122
  async buildCliEnvironment() {
@@ -113,47 +135,84 @@ export class CoreAgent extends BaseMachineAgent {
113
135
  const existingSegments = new Set(basePath.split(":").filter(Boolean));
114
136
  const missing = extraPaths.filter((p) => !existingSegments.has(p));
115
137
  env.PATH = missing.length > 0 ? `${missing.join(":")}:${basePath}` : basePath;
116
- // Guard: ensure the CLI runtime binary has its execute bit set.
117
- // On long-lived sandboxes the file can lose +x (e.g. npm overwrote it
118
- // without preserving permissions, or a stray chmod was run during setup).
119
- // We attempt to fix it silently so the agent can always start.
120
- for (const dir of extraPaths) {
121
- for (const bin of ["claude", "codex", "gemini"]) {
122
- const binPath = `${dir}/${bin}`;
123
- try {
124
- const stat = statSync(binPath);
125
- // Check owner-execute bit (0o100). If missing, add +x for owner/group/other.
126
- if (!(stat.mode & 0o100)) {
127
- chmodSync(binPath, stat.mode | 0o111);
128
- console.info(`[CoreAgent] Restored execute permission on ${binPath}`);
129
- }
130
- // Verify we can actually execute it now
131
- accessSync(binPath, fsConstants.X_OK);
132
- }
133
- catch {
134
- // File doesn't exist or chmod failed — not a fatal error, let the
135
- // backend surface a clear message if this binary is actually needed.
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})`);
136
180
  }
137
181
  }
182
+ parts.push(lines.join("\n"));
138
183
  }
139
- return env;
140
- }
141
- buildExtraSystemPromptParts(_config) {
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;
142
189
  const artifactIds = [];
143
- const envTaskId = process.env.AIDEN_TASK_ID;
144
- const envSessionId = process.env.AIDEN_SESSION_ID;
145
- if (envTaskId)
146
- artifactIds.push(`- taskId: "${envTaskId}"`);
147
- if (envSessionId)
148
- artifactIds.push(`- conversationId: "${envSessionId}"`);
149
- if (artifactIds.length === 0)
150
- return [];
151
- return [
152
- [
153
- "When creating artifacts using MCP tools (create_plan, create_document_artifact, create_test_report), always pass these IDs:",
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:",
154
199
  ...artifactIds,
155
- ].join("\n"),
156
- ];
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;
157
216
  }
158
217
  }
159
218
  //# sourceMappingURL=core-agent.js.map
@@ -1 +1 @@
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;AAC9E,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,IAAI,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAIpF,MAAM,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