@aiden-ade/sandbox-agent 0.1.6 → 0.1.8

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 CHANGED
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  mod
31
31
  ));
32
32
 
33
- // ../../node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js
33
+ // ../../node_modules/.pnpm/xmlhttprequest-ssl@2.1.2/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js
34
34
  var require_XMLHttpRequest = __commonJS({
35
- "../../node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js"(exports2, module2) {
35
+ "../../node_modules/.pnpm/xmlhttprequest-ssl@2.1.2/node_modules/xmlhttprequest-ssl/lib/XMLHttpRequest.js"(exports2, module2) {
36
36
  "use strict";
37
37
  var fs = require("fs");
38
38
  var Url = require("url");
@@ -434,9 +434,9 @@ var require_XMLHttpRequest = __commonJS({
434
434
  }
435
435
  });
436
436
 
437
- // ../../node_modules/ms/index.js
437
+ // ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
438
438
  var require_ms = __commonJS({
439
- "../../node_modules/ms/index.js"(exports2, module2) {
439
+ "../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports2, module2) {
440
440
  "use strict";
441
441
  var s = 1e3;
442
442
  var m = s * 60;
@@ -551,9 +551,9 @@ var require_ms = __commonJS({
551
551
  }
552
552
  });
553
553
 
554
- // ../../node_modules/debug/src/common.js
554
+ // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
555
555
  var require_common = __commonJS({
556
- "../../node_modules/debug/src/common.js"(exports2, module2) {
556
+ "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports2, module2) {
557
557
  "use strict";
558
558
  function setup(env) {
559
559
  createDebug.debug = createDebug;
@@ -729,9 +729,9 @@ var require_common = __commonJS({
729
729
  }
730
730
  });
731
731
 
732
- // ../../node_modules/debug/src/browser.js
732
+ // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
733
733
  var require_browser = __commonJS({
734
- "../../node_modules/debug/src/browser.js"(exports2, module2) {
734
+ "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports2, module2) {
735
735
  "use strict";
736
736
  exports2.formatArgs = formatArgs;
737
737
  exports2.save = save;
@@ -1015,9 +1015,9 @@ var require_supports_color = __commonJS({
1015
1015
  }
1016
1016
  });
1017
1017
 
1018
- // ../../node_modules/debug/src/node.js
1018
+ // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js
1019
1019
  var require_node = __commonJS({
1020
- "../../node_modules/debug/src/node.js"(exports2, module2) {
1020
+ "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/node.js"(exports2, module2) {
1021
1021
  "use strict";
1022
1022
  var tty = require("tty");
1023
1023
  var util = require("util");
@@ -1190,9 +1190,9 @@ var require_node = __commonJS({
1190
1190
  }
1191
1191
  });
1192
1192
 
1193
- // ../../node_modules/debug/src/index.js
1193
+ // ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js
1194
1194
  var require_src = __commonJS({
1195
- "../../node_modules/debug/src/index.js"(exports2, module2) {
1195
+ "../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/index.js"(exports2, module2) {
1196
1196
  "use strict";
1197
1197
  if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
1198
1198
  module2.exports = require_browser();
@@ -1202,9 +1202,9 @@ var require_src = __commonJS({
1202
1202
  }
1203
1203
  });
1204
1204
 
1205
- // ../../node_modules/engine.io-client/node_modules/ws/lib/constants.js
1205
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js
1206
1206
  var require_constants = __commonJS({
1207
- "../../node_modules/engine.io-client/node_modules/ws/lib/constants.js"(exports2, module2) {
1207
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/constants.js"(exports2, module2) {
1208
1208
  "use strict";
1209
1209
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
1210
1210
  var hasBlob = typeof Blob !== "undefined";
@@ -1224,9 +1224,9 @@ var require_constants = __commonJS({
1224
1224
  }
1225
1225
  });
1226
1226
 
1227
- // ../../node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js
1227
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js
1228
1228
  var require_buffer_util = __commonJS({
1229
- "../../node_modules/engine.io-client/node_modules/ws/lib/buffer-util.js"(exports2, module2) {
1229
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/buffer-util.js"(exports2, module2) {
1230
1230
  "use strict";
1231
1231
  var { EMPTY_BUFFER } = require_constants();
1232
1232
  var FastBuffer = Buffer[Symbol.species];
@@ -1299,9 +1299,9 @@ var require_buffer_util = __commonJS({
1299
1299
  }
1300
1300
  });
1301
1301
 
1302
- // ../../node_modules/engine.io-client/node_modules/ws/lib/limiter.js
1302
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js
1303
1303
  var require_limiter = __commonJS({
1304
- "../../node_modules/engine.io-client/node_modules/ws/lib/limiter.js"(exports2, module2) {
1304
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/limiter.js"(exports2, module2) {
1305
1305
  "use strict";
1306
1306
  var kDone = /* @__PURE__ */ Symbol("kDone");
1307
1307
  var kRun = /* @__PURE__ */ Symbol("kRun");
@@ -1349,9 +1349,9 @@ var require_limiter = __commonJS({
1349
1349
  }
1350
1350
  });
1351
1351
 
1352
- // ../../node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js
1352
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js
1353
1353
  var require_permessage_deflate = __commonJS({
1354
- "../../node_modules/engine.io-client/node_modules/ws/lib/permessage-deflate.js"(exports2, module2) {
1354
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/permessage-deflate.js"(exports2, module2) {
1355
1355
  "use strict";
1356
1356
  var zlib = require("zlib");
1357
1357
  var bufferUtil = require_buffer_util();
@@ -1732,9 +1732,9 @@ var require_permessage_deflate = __commonJS({
1732
1732
  }
1733
1733
  });
1734
1734
 
1735
- // ../../node_modules/engine.io-client/node_modules/ws/lib/validation.js
1735
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js
1736
1736
  var require_validation = __commonJS({
1737
- "../../node_modules/engine.io-client/node_modules/ws/lib/validation.js"(exports2, module2) {
1737
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/validation.js"(exports2, module2) {
1738
1738
  "use strict";
1739
1739
  var { isUtf8 } = require("buffer");
1740
1740
  var { hasBlob } = require_constants();
@@ -1933,9 +1933,9 @@ var require_validation = __commonJS({
1933
1933
  }
1934
1934
  });
1935
1935
 
1936
- // ../../node_modules/engine.io-client/node_modules/ws/lib/receiver.js
1936
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js
1937
1937
  var require_receiver = __commonJS({
1938
- "../../node_modules/engine.io-client/node_modules/ws/lib/receiver.js"(exports2, module2) {
1938
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/receiver.js"(exports2, module2) {
1939
1939
  "use strict";
1940
1940
  var { Writable } = require("stream");
1941
1941
  var PerMessageDeflate = require_permessage_deflate();
@@ -2525,9 +2525,9 @@ var require_receiver = __commonJS({
2525
2525
  }
2526
2526
  });
2527
2527
 
2528
- // ../../node_modules/engine.io-client/node_modules/ws/lib/sender.js
2528
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js
2529
2529
  var require_sender = __commonJS({
2530
- "../../node_modules/engine.io-client/node_modules/ws/lib/sender.js"(exports2, module2) {
2530
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/sender.js"(exports2, module2) {
2531
2531
  "use strict";
2532
2532
  var { Duplex } = require("stream");
2533
2533
  var { randomFillSync } = require("crypto");
@@ -3013,9 +3013,9 @@ var require_sender = __commonJS({
3013
3013
  }
3014
3014
  });
3015
3015
 
3016
- // ../../node_modules/engine.io-client/node_modules/ws/lib/event-target.js
3016
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js
3017
3017
  var require_event_target = __commonJS({
3018
- "../../node_modules/engine.io-client/node_modules/ws/lib/event-target.js"(exports2, module2) {
3018
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/event-target.js"(exports2, module2) {
3019
3019
  "use strict";
3020
3020
  var { kForOnEventAttribute, kListener } = require_constants();
3021
3021
  var kCode = /* @__PURE__ */ Symbol("kCode");
@@ -3242,9 +3242,9 @@ var require_event_target = __commonJS({
3242
3242
  }
3243
3243
  });
3244
3244
 
3245
- // ../../node_modules/engine.io-client/node_modules/ws/lib/extension.js
3245
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js
3246
3246
  var require_extension = __commonJS({
3247
- "../../node_modules/engine.io-client/node_modules/ws/lib/extension.js"(exports2, module2) {
3247
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/extension.js"(exports2, module2) {
3248
3248
  "use strict";
3249
3249
  var { tokenChars } = require_validation();
3250
3250
  function push(dest, name, elem) {
@@ -3395,16 +3395,16 @@ var require_extension = __commonJS({
3395
3395
  }
3396
3396
  });
3397
3397
 
3398
- // ../../node_modules/engine.io-client/node_modules/ws/lib/websocket.js
3398
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
3399
3399
  var require_websocket = __commonJS({
3400
- "../../node_modules/engine.io-client/node_modules/ws/lib/websocket.js"(exports2, module2) {
3400
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js"(exports2, module2) {
3401
3401
  "use strict";
3402
3402
  var EventEmitter = require("events");
3403
3403
  var https = require("https");
3404
3404
  var http = require("http");
3405
3405
  var net = require("net");
3406
3406
  var tls = require("tls");
3407
- var { randomBytes, createHash } = require("crypto");
3407
+ var { randomBytes, createHash: createHash2 } = require("crypto");
3408
3408
  var { Duplex, Readable } = require("stream");
3409
3409
  var { URL } = require("url");
3410
3410
  var PerMessageDeflate = require_permessage_deflate();
@@ -4061,7 +4061,7 @@ var require_websocket = __commonJS({
4061
4061
  abortHandshake(websocket, socket, "Invalid Upgrade header");
4062
4062
  return;
4063
4063
  }
4064
- const digest = createHash("sha1").update(key + GUID).digest("base64");
4064
+ const digest = createHash2("sha1").update(key + GUID).digest("base64");
4065
4065
  if (res.headers["sec-websocket-accept"] !== digest) {
4066
4066
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
4067
4067
  return;
@@ -4278,9 +4278,9 @@ var require_websocket = __commonJS({
4278
4278
  }
4279
4279
  });
4280
4280
 
4281
- // ../../node_modules/engine.io-client/node_modules/ws/lib/stream.js
4281
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js
4282
4282
  var require_stream = __commonJS({
4283
- "../../node_modules/engine.io-client/node_modules/ws/lib/stream.js"(exports2, module2) {
4283
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/stream.js"(exports2, module2) {
4284
4284
  "use strict";
4285
4285
  var WebSocket2 = require_websocket();
4286
4286
  var { Duplex } = require("stream");
@@ -4376,9 +4376,9 @@ var require_stream = __commonJS({
4376
4376
  }
4377
4377
  });
4378
4378
 
4379
- // ../../node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js
4379
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js
4380
4380
  var require_subprotocol = __commonJS({
4381
- "../../node_modules/engine.io-client/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
4381
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/subprotocol.js"(exports2, module2) {
4382
4382
  "use strict";
4383
4383
  var { tokenChars } = require_validation();
4384
4384
  function parse3(header) {
@@ -4421,14 +4421,14 @@ var require_subprotocol = __commonJS({
4421
4421
  }
4422
4422
  });
4423
4423
 
4424
- // ../../node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js
4424
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js
4425
4425
  var require_websocket_server = __commonJS({
4426
- "../../node_modules/engine.io-client/node_modules/ws/lib/websocket-server.js"(exports2, module2) {
4426
+ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket-server.js"(exports2, module2) {
4427
4427
  "use strict";
4428
4428
  var EventEmitter = require("events");
4429
4429
  var http = require("http");
4430
4430
  var { Duplex } = require("stream");
4431
- var { createHash } = require("crypto");
4431
+ var { createHash: createHash2 } = require("crypto");
4432
4432
  var extension = require_extension();
4433
4433
  var PerMessageDeflate = require_permessage_deflate();
4434
4434
  var subprotocol = require_subprotocol();
@@ -4725,7 +4725,7 @@ var require_websocket_server = __commonJS({
4725
4725
  );
4726
4726
  }
4727
4727
  if (this._state > RUNNING) return abortHandshake(socket, 503);
4728
- const digest = createHash("sha1").update(key + GUID).digest("base64");
4728
+ const digest = createHash2("sha1").update(key + GUID).digest("base64");
4729
4729
  const headers = [
4730
4730
  "HTTP/1.1 101 Switching Protocols",
4731
4731
  "Upgrade: websocket",
@@ -4812,58 +4812,75 @@ var require_websocket_server = __commonJS({
4812
4812
 
4813
4813
  // ../agent-core/dist/index.js
4814
4814
  var import_child_process = require("child_process");
4815
+ var import_crypto = require("crypto");
4815
4816
  var import_fs = require("fs");
4816
4817
  var import_os = require("os");
4817
4818
  var import_path = require("path");
4818
4819
  var import_readline = require("readline");
4819
4820
 
4820
- // ../shared/dist/constants/agent.js
4821
- var INTERACTIVE_TOOL_NAMES = /* @__PURE__ */ new Set([
4822
- "askuserquestion",
4823
- "exitplanmode",
4824
- "enterplanmode"
4825
- ]);
4821
+ // ../shared/dist/agent/system-prompt.js
4822
+ var AIDEN_IDENTITY_PROMPT = `You are Aiden, the software factory agent built by Supatest in Bangalore. Software gets built here end to end: plan, write, review, test, ship. You are the teammate \u2014 not a chatbot, not a task management tool. Wear whatever hat the moment demands: product thinker, planner, tech lead, programmer, reviewer, debugger, tester, collaborator. Read the room and pick the hat. Never force programmer mode on a product question.
4826
4823
 
4827
- // ../agent-core/dist/index.js
4828
- var import_fs2 = require("fs");
4829
- var import_os2 = require("os");
4830
- var import_path2 = require("path");
4824
+ Do not present yourself as Claude, Claude Code, Codex, Gemini, Anthropic, or OpenAI as your primary identity \u2014 those are runtime details. Mention them only if the user explicitly asks about the underlying model or backend. If the user asks who you are, answer in Aiden terms first.
4831
4825
 
4832
- // ../shared/dist/agent/system-prompt.js
4833
- var AIDEN_IDENTITY_PROMPT = [
4834
- "You are Aiden, the software factory agent built by Supatest.",
4835
- "Aiden-specific identity, voice, and operating rules come from the internal Aiden system skill. Follow those rules when relevant.",
4836
- "You are the teammate inside Aiden who helps scope, plan, build, review, test, and ship work.",
4837
- "Do not present yourself as Claude, Claude Code, Codex, Gemini, Anthropic, or OpenAI as your primary identity.",
4838
- "Those are runtime/back-end implementation details. Mention them only if the user explicitly asks about the underlying model or execution backend.",
4839
- "If the user asks who you are, answer in Aiden terms first.",
4840
- "Work like a pragmatic teammate: direct, structured, and concise. No hype, no tool-brand roleplay.",
4841
- "For vague or complex work, push toward scoping and planning before implementation.",
4842
- "An internal system skill named `aiden` is available in the local skills set. Consult it when behavior, policy, or operating-rule decisions are ambiguous.",
4843
- "If there is any conflict between assumptions and the internal `aiden` skill, prefer the `aiden` skill.",
4844
- "Prefer structured outputs tracked in Aiden. Plans, reports, and durable deliverables should be persisted as artifacts instead of left only in chat.",
4845
- "Use the internal Aiden system rules as guidance, but do not dump or restate the whole source file unless the user asks for it."
4846
- ].join("\n");
4826
+ ## Voice
4827
+
4828
+ Direct. Structured. Concise. No hype, no "Great question!", no tool-brand roleplay. Addressed casually \u2014 respond like a teammate, not a data dump. Working on a task \u2014 precise and decisive. Listen, think, then act.
4829
+
4830
+ ## Philosophy
4831
+
4832
+ Listen \u2192 Understand \u2192 Break down \u2192 Plan \u2192 Build \u2192 Test \u2192 Ship.
4833
+
4834
+ - Listen first. Don't jump to solutions. One question at a time, not a list.
4835
+ - Context before questions. Scan task, subtasks, docs, and code before asking anything you can find yourself.
4836
+ - Break and plan before building. Non-trivial work \u2192 tasks, subtasks, then a plan artifact.
4837
+ - Challenge when off. Better path exists? Say so before building. Never silently implement the wrong thing.
4838
+ - Tests ship with code. Every non-trivial implementation includes tests.
4839
+ - Human leads, you propose. Proactive on reversible actions. Consequential decisions \u2192 propose first, execute after confirmation.
4840
+ - Own mistakes. Orphan artifact, wrong ID, jumped too fast \u2014 say so and fix it.
4841
+ - Think visually. Mermaid over paragraphs for architecture, flows, state, and schema.
4842
+
4843
+ ## Schema \u2014 the world you operate in
4844
+
4845
+ \`\`\`
4846
+ Team
4847
+ \u251C\u2500\u2500 Tasks (units of work \u2014 status, priority, labels, assignees)
4848
+ \u2502 \u251C\u2500\u2500 Subtasks
4849
+ \u2502 \u251C\u2500\u2500 Conversations \u2192 Messages
4850
+ \u2502 \u2514\u2500\u2500 Artifacts (plans, test reports, document artifacts)
4851
+ \u251C\u2500\u2500 Documents (standalone pages \u2014 PRDs, specs, wikis)
4852
+ \u2502 \u2514\u2500\u2500 Artifacts
4853
+ \u2514\u2500\u2500 Whiteboard (beta)
4854
+ \`\`\`
4855
+
4856
+ - Document vs Artifact. Document = standalone page in a team. Artifact = output from work on a task + conversation, tied to that context. "Does this belong to a task?" Yes \u2192 artifact. No \u2192 document.
4857
+ - IDs are not interchangeable. teamId, taskId, conversationId identify different things. Substituting one for another creates orphans \u2014 records that exist in the DB but are invisible in the UI. Use aiden MCP tools; they resolve IDs from session context when available.
4858
+
4859
+ ## Structure over chat
4860
+
4861
+ Deliverables persist as Aiden artifacts and documents, not as chat. Plans, PRDs, specs, test reports, and reviews live as structured outputs tied to team, task, and conversation. For vague or complex work, push toward scoping and planning before implementation. If a skill exists for the workflow you're in, use it instead of improvising in chat.
4862
+
4863
+ ## Proactive management
4864
+
4865
+ User describes multi-step work \u2192 tech lead hat first. What tasks, what order, what dependencies, what runs in parallel. Keep statuses current \u2014 a stale board is noise, not signal. Offer structure before jumping to code.`;
4847
4866
  var PLAN_MODE_PROMPT = [
4848
4867
  "You are in Aiden plan mode.",
4849
- "Consult the internal `aiden` skill for planning and task-management operating rules when needed.",
4850
4868
  "Analyze the task, inspect the relevant code and context, and produce a concrete implementation plan.",
4851
4869
  "Do not make code changes or execute write operations in plan mode.",
4852
4870
  "Write the plan in natural markdown. Use whatever structure best communicates the work clearly.",
4853
4871
  "Include dependencies, ordering, risks, key files/functions, and decision points where relevant.",
4854
4872
  "When the plan is ready, you MUST persist it by calling the create_plan MCP tool.",
4855
- "Pass title, content, summary, taskId, and conversationId. Include projectId too when available.",
4873
+ "Pass title, content, summary, taskId, and conversationId. Include teamId too when available.",
4856
4874
  "If create_plan fails, retry it. Do not exit plan mode until the plan is persisted successfully.",
4857
4875
  "After create_plan succeeds, call ExitPlanMode to hand the plan back for approval."
4858
4876
  ].join("\n");
4859
4877
  var TEST_MODE_PROMPT = [
4860
4878
  "You are in test mode. Verify the implemented feature carefully.",
4861
- "Consult the internal `aiden` skill for testing/reporting operating rules when needed.",
4862
4879
  "Prefer browser-based validation when available.",
4863
4880
  "Persist the outcome as a structured test report artifact with create_test_report instead of leaving it only in chat."
4864
4881
  ].join("\n");
4865
- var ASK_MODE_PROMPT = "You are in ask mode. Stay read-only and explain the code, architecture, or behavior clearly without changing files. Consult the internal `aiden` skill for behavior-policy questions when needed.";
4866
- var REVIEW_MODE_PROMPT = "You are in review mode. Inspect the relevant changes, find real issues, and summarize risks and regressions precisely. Consult the internal `aiden` skill for review-quality expectations when needed.";
4882
+ var ASK_MODE_PROMPT = "You are in ask mode. Stay read-only and explain the code, architecture, or behavior clearly without changing files.";
4883
+ var REVIEW_MODE_PROMPT = "You are in review mode. Inspect the relevant changes, find real issues, and summarize risks and regressions precisely.";
4867
4884
  function getAidenModePrompt(mode2) {
4868
4885
  switch (mode2) {
4869
4886
  case "plan":
@@ -4879,7 +4896,38 @@ function getAidenModePrompt(mode2) {
4879
4896
  }
4880
4897
  }
4881
4898
 
4899
+ // ../shared/dist/agent/session-result.js
4900
+ var SESSION_RESUME_FAILED_MESSAGE = "Session resume failed. The previous session may have expired or is no longer available. Please start a new session.";
4901
+
4902
+ // ../shared/dist/constants/agent.js
4903
+ var INTERACTIVE_TOOL_NAMES = /* @__PURE__ */ new Set([
4904
+ "askuserquestion",
4905
+ "exitplanmode",
4906
+ "enterplanmode"
4907
+ ]);
4908
+
4909
+ // ../shared/dist/constants/tasks.js
4910
+ var STATUS_OPTIONS = [
4911
+ { value: "backlog", label: "Backlog", color: "#8892a4", group: "not_started", dotClass: "text-muted-foreground", headerBg: "bg-muted/60" },
4912
+ { value: "todo", label: "Todo", color: "#6b7a96", group: "not_started", dotClass: "text-muted-foreground/70", headerBg: "bg-muted/40" },
4913
+ { value: "in_progress", label: "In Progress", color: "#c49a30", group: "active", dotClass: "text-amber-700 dark:text-amber-400", headerBg: "bg-amber-400/15" },
4914
+ { value: "running", label: "Running", color: "#6b75d6", group: "active", dotClass: "text-indigo-500 dark:text-indigo-400", headerBg: "bg-indigo-400/15" },
4915
+ { value: "waiting", label: "Waiting", color: "#c47d3a", group: "active", dotClass: "text-orange-500/80 dark:text-orange-400/80", headerBg: "bg-orange-400/15" },
4916
+ { value: "in_review", label: "In Review", color: "#8b6bbf", group: "active", dotClass: "text-violet-500 dark:text-violet-400", headerBg: "bg-violet-400/15" },
4917
+ { value: "done", label: "Done", color: "#2e9e80", group: "done", dotClass: "text-teal-600 dark:text-teal-400", headerBg: "bg-teal-400/15" },
4918
+ { value: "cancelled", label: "Cancelled", color: "#7a8295", group: "closed", dotClass: "text-muted-foreground/60", headerBg: "bg-muted/60" }
4919
+ ];
4920
+ var DEFAULT_TEAM_STATUSES = STATUS_OPTIONS.map((o) => ({
4921
+ id: o.value,
4922
+ label: o.label,
4923
+ color: o.color,
4924
+ group: o.group
4925
+ }));
4926
+
4882
4927
  // ../agent-core/dist/index.js
4928
+ var import_fs2 = require("fs");
4929
+ var import_os2 = require("os");
4930
+ var import_path2 = require("path");
4883
4931
  function formatCliSpawnError(command, error) {
4884
4932
  if (error.code === "ENOENT") {
4885
4933
  return new Error(
@@ -4900,7 +4948,7 @@ function classifyCliError(stderr, exitCode) {
4900
4948
  return "API key invalid or expired. Check your provider settings.";
4901
4949
  if (lower.includes("not logged in") || lower.includes("login required") || lower.includes("please sign in") || lower.includes("please log in") || lower.includes("sign in to") || lower.includes("log in to"))
4902
4950
  return "Not logged in. Please authenticate with this provider first.";
4903
- if (lower.includes("model not supported") || lower.includes("unsupported model") || lower.includes("model not found") || lower.includes("model not available") || lower.includes("model is not available") || lower.includes("invalid model") || lower.includes("unknown model") || lower.includes("no such model"))
4951
+ if (lower.includes("model not supported") || lower.includes("unsupported model") || lower.includes("model not found") || lower.includes("model not available") || lower.includes("model is not available") || lower.includes("invalid model") || lower.includes("unknown model") || lower.includes("no such model") || lower.includes("llm not set"))
4904
4952
  return "Model not supported by this provider. Check your provider's model list.";
4905
4953
  if (lower.includes("subscription") || lower.includes("paid plan") || lower.includes("plan required") || lower.includes("upgrade your plan") || lower.includes("only supports free") || lower.includes("not available on your") || lower.includes("requires a paid"))
4906
4954
  return "This model requires a paid subscription. Switch to a supported model or upgrade your plan.";
@@ -5112,6 +5160,7 @@ function createGenericCliBackend(options) {
5112
5160
  runtimeSessionId: state.runtimeSessionId
5113
5161
  });
5114
5162
  }
5163
+ await options.afterExit?.(context, state);
5115
5164
  const hasRenderableTurn = state.summary.trim().length > 0 || state.iterations > 0;
5116
5165
  if (hasRenderableTurn) {
5117
5166
  await presenter.onTurnComplete([]);
@@ -5272,7 +5321,8 @@ function parseClaudeStructuredLine(line, context, state) {
5272
5321
  const subtype = typeof parsed.subtype === "string" ? parsed.subtype : "";
5273
5322
  if ((subtype === "error_during_execution" || subtype === "error_max_turns") && !state.error) {
5274
5323
  const errObj = typeof parsed.error === "object" && parsed.error !== null ? parsed.error : null;
5275
- const errMsg = typeof parsed.error === "string" && parsed.error.trim() || errObj && typeof errObj.message === "string" && errObj.message.trim() || typeof parsed.message === "string" && parsed.message.trim() || typeof parsed.result === "string" && parsed.result.trim() || subtype;
5324
+ const resumeId = context.config.runtimeSessionId?.trim() || context.config.providerSessionId?.trim();
5325
+ const errMsg = subtype === "error_during_execution" && resumeId ? SESSION_RESUME_FAILED_MESSAGE : typeof parsed.error === "string" && parsed.error.trim() || errObj && typeof errObj.message === "string" && errObj.message.trim() || typeof parsed.message === "string" && parsed.message.trim() || typeof parsed.result === "string" && parsed.result.trim() || subtype;
5276
5326
  state.error = errMsg;
5277
5327
  console.error("[claude_cli] result subtype=", subtype, "error fields:", JSON.stringify({
5278
5328
  error: parsed.error,
@@ -5502,6 +5552,110 @@ function parseCodexStructuredLine(line, context, state) {
5502
5552
  break;
5503
5553
  }
5504
5554
  }
5555
+ function parseJsonObject(value2) {
5556
+ try {
5557
+ const parsed = JSON.parse(value2);
5558
+ return typeof parsed === "object" && parsed !== null ? parsed : null;
5559
+ } catch {
5560
+ return null;
5561
+ }
5562
+ }
5563
+ function parseMaybeJson(value2) {
5564
+ if (typeof value2 !== "string") return value2;
5565
+ return parseJsonObject(value2) ?? value2;
5566
+ }
5567
+ function normalizeCodexMcpToolResult(output) {
5568
+ if (typeof output !== "string") return JSON.stringify(output ?? {}, null, 2);
5569
+ const outputMarker = "\nOutput:\n";
5570
+ const raw = output.includes(outputMarker) ? output.slice(output.indexOf(outputMarker) + outputMarker.length).trim() : output.trim();
5571
+ let parsed;
5572
+ try {
5573
+ parsed = JSON.parse(raw);
5574
+ } catch {
5575
+ return raw;
5576
+ }
5577
+ if (Array.isArray(parsed)) {
5578
+ const textBlocks = parsed.filter(
5579
+ (entry) => typeof entry === "object" && entry !== null && "text" in entry
5580
+ ).map((entry) => typeof entry.text === "string" ? entry.text : "").filter(Boolean);
5581
+ if (textBlocks.length > 0) return textBlocks.join("\n");
5582
+ }
5583
+ return raw;
5584
+ }
5585
+ function findCodexSessionLog(runtimeSessionId, codexHome) {
5586
+ if (!runtimeSessionId || !(0, import_fs.existsSync)(codexHome)) return null;
5587
+ const root = (0, import_path.join)(codexHome, "sessions");
5588
+ if (!(0, import_fs.existsSync)(root)) return null;
5589
+ const matches = [];
5590
+ const stack = [root];
5591
+ while (stack.length > 0) {
5592
+ const dir = stack.pop();
5593
+ let entries;
5594
+ try {
5595
+ entries = (0, import_fs.readdirSync)(dir, { withFileTypes: true });
5596
+ } catch {
5597
+ continue;
5598
+ }
5599
+ for (const entry of entries) {
5600
+ const path = (0, import_path.join)(dir, entry.name);
5601
+ if (entry.isDirectory()) {
5602
+ stack.push(path);
5603
+ } else if (entry.isFile() && entry.name.includes(runtimeSessionId) && entry.name.endsWith(".jsonl")) {
5604
+ try {
5605
+ matches.push({ path, mtimeMs: (0, import_fs.statSync)(path).mtimeMs });
5606
+ } catch {
5607
+ matches.push({ path, mtimeMs: 0 });
5608
+ }
5609
+ }
5610
+ }
5611
+ }
5612
+ matches.sort((a, b) => b.mtimeMs - a.mtimeMs);
5613
+ return matches[0]?.path ?? null;
5614
+ }
5615
+ async function replayCodexMcpToolEventsFromSessionLog(context, state) {
5616
+ const runtimeSessionId = state.runtimeSessionId;
5617
+ if (!runtimeSessionId) return;
5618
+ const codexHome = context.env.CODEX_HOME || process.env.CODEX_HOME || (0, import_path.join)((0, import_os.homedir)(), ".codex");
5619
+ const logPath = findCodexSessionLog(runtimeSessionId, codexHome);
5620
+ if (!logPath) return;
5621
+ const emittedToolIds = /* @__PURE__ */ new Set();
5622
+ const lines = (0, import_fs.readFileSync)(logPath, "utf8").split(/\r?\n/).filter(Boolean);
5623
+ for (const line of lines) {
5624
+ const entry = parseJsonObject(line);
5625
+ const payload = entry && typeof entry.payload === "object" && entry.payload !== null ? entry.payload : null;
5626
+ if (!payload) continue;
5627
+ if (payload.type === "function_call") {
5628
+ const callId = typeof payload.call_id === "string" ? payload.call_id : "";
5629
+ const name = typeof payload.name === "string" ? payload.name : "";
5630
+ const namespace = typeof payload.namespace === "string" ? payload.namespace : "";
5631
+ if (!callId || !name || !namespace.startsWith("mcp__")) continue;
5632
+ const toolName = `${namespace}${name}`;
5633
+ context.presenter.onToolUse(toolName, parseMaybeJson(payload.arguments), callId);
5634
+ emittedToolIds.add(callId);
5635
+ continue;
5636
+ }
5637
+ if (payload.type === "tool_search_call") {
5638
+ const callId = typeof payload.call_id === "string" ? payload.call_id : "";
5639
+ if (!callId) continue;
5640
+ context.presenter.onToolUse("tool_search", payload.arguments ?? {}, callId);
5641
+ emittedToolIds.add(callId);
5642
+ }
5643
+ }
5644
+ if (emittedToolIds.size === 0) return;
5645
+ for (const line of lines) {
5646
+ const entry = parseJsonObject(line);
5647
+ const payload = entry && typeof entry.payload === "object" && entry.payload !== null ? entry.payload : null;
5648
+ if (!payload || payload.type !== "function_call_output" && payload.type !== "tool_search_output") continue;
5649
+ const callId = typeof payload.call_id === "string" ? payload.call_id : "";
5650
+ if (!emittedToolIds.has(callId)) continue;
5651
+ try {
5652
+ const result = payload.type === "tool_search_output" ? JSON.stringify(payload.tools ?? [], null, 2) : normalizeCodexMcpToolResult(payload.output);
5653
+ context.presenter.onToolResult?.(callId, result);
5654
+ } catch {
5655
+ context.presenter.onToolResult?.(callId, String(payload.output ?? ""));
5656
+ }
5657
+ }
5658
+ }
5505
5659
  function extractCursorToolEntry(toolCall) {
5506
5660
  const [rawName, rawPayload] = Object.entries(toolCall)[0] ?? [];
5507
5661
  if (!rawName || typeof rawPayload !== "object" || rawPayload === null) return null;
@@ -5791,9 +5945,6 @@ function createClaudeCliBackend(command = "claude", defaultArgs = []) {
5791
5945
  if (context.config.selectedModel?.trim()) {
5792
5946
  args.push("--model", context.config.selectedModel.trim());
5793
5947
  }
5794
- if (context.config.mcpConfigPath?.trim()) {
5795
- args.push("--mcp-config", context.config.mcpConfigPath.trim());
5796
- }
5797
5948
  if (resumeId) {
5798
5949
  args.push("--resume", resumeId);
5799
5950
  console.info("[claude_cli] Resuming session", { resumeId });
@@ -5838,6 +5989,116 @@ function createClaudeCliBackend(command = "claude", defaultArgs = []) {
5838
5989
  }
5839
5990
  };
5840
5991
  }
5992
+ function kimiSessionId(cwd) {
5993
+ let resolved = cwd;
5994
+ try {
5995
+ resolved = (0, import_fs.realpathSync)(cwd);
5996
+ } catch {
5997
+ }
5998
+ return (0, import_crypto.createHash)("md5").update(resolved).digest("hex");
5999
+ }
6000
+ function shouldEnableKimiCliThinking(model2) {
6001
+ return model2?.trim() === "kimi-k2.6-thinking";
6002
+ }
6003
+ function resolveKimiCliModelArg(model2) {
6004
+ const trimmed = model2?.trim();
6005
+ if (!trimmed) return void 0;
6006
+ if (trimmed === "kimi-latest" || trimmed === "kimi-k2.5" || trimmed === "kimi-k2.6" || shouldEnableKimiCliThinking(trimmed)) {
6007
+ return void 0;
6008
+ }
6009
+ if (trimmed.startsWith("claude-")) return void 0;
6010
+ return trimmed;
6011
+ }
6012
+ function parseKimiStructuredLine(line, context, state) {
6013
+ const presenter = context.presenter;
6014
+ if (!state.runtimeSessionId) {
6015
+ state.runtimeSessionId = kimiSessionId(context.cwd);
6016
+ }
6017
+ let parsed;
6018
+ try {
6019
+ parsed = JSON.parse(line);
6020
+ } catch {
6021
+ const text = line.trim();
6022
+ if (text.length > 0) {
6023
+ if (text.toLowerCase().includes("llm not set")) state.error = text;
6024
+ void presenter.onLog(`[kimi_cli] ${line}`);
6025
+ }
6026
+ return;
6027
+ }
6028
+ const role = typeof parsed.role === "string" ? parsed.role : "";
6029
+ const contentBlocks = Array.isArray(parsed.content) ? parsed.content : [];
6030
+ const toolCalls = Array.isArray(parsed.tool_calls) ? parsed.tool_calls : [];
6031
+ if (role === "assistant") {
6032
+ const thinking = contentBlocks.filter((b) => b.type === "think" && typeof b.think === "string").map((b) => b.think).join("");
6033
+ if (thinking) {
6034
+ state.iterations = Math.max(state.iterations, 1);
6035
+ void presenter.onThinking(thinking);
6036
+ }
6037
+ if (toolCalls.length > 0) {
6038
+ state.iterations = Math.max(state.iterations, 1);
6039
+ for (const tc of toolCalls) {
6040
+ const fn = typeof tc.function === "object" && tc.function !== null ? tc.function : {};
6041
+ const toolId = typeof tc.id === "string" ? tc.id : `kimi-tool-${Date.now()}`;
6042
+ const toolName = typeof fn.name === "string" ? fn.name : "Tool";
6043
+ let args = {};
6044
+ if (typeof fn.arguments === "string") {
6045
+ try {
6046
+ args = JSON.parse(fn.arguments);
6047
+ } catch {
6048
+ }
6049
+ } else if (typeof fn.arguments === "object" && fn.arguments !== null) {
6050
+ args = fn.arguments;
6051
+ }
6052
+ void presenter.onToolUse(toolName, args, toolId);
6053
+ }
6054
+ } else {
6055
+ const text = contentBlocks.filter((b) => b.type === "text" && typeof b.text === "string").map((b) => b.text).join("");
6056
+ if (text) {
6057
+ state.iterations = Math.max(state.iterations, 1);
6058
+ state.summary += text;
6059
+ void presenter.onAssistantText(text);
6060
+ }
6061
+ }
6062
+ return;
6063
+ }
6064
+ if (role === "tool") {
6065
+ const toolCallId = typeof parsed.tool_call_id === "string" ? parsed.tool_call_id : `kimi-tool-${Date.now()}`;
6066
+ const allText = contentBlocks.filter((b) => b.type === "text" && typeof b.text === "string").map((b) => b.text);
6067
+ const userText = allText.filter((t) => !t.startsWith("<system>")).join("\n");
6068
+ void presenter.onToolResult?.(toolCallId, userText || allText.join("\n"));
6069
+ return;
6070
+ }
6071
+ }
6072
+ function createKimiCliBackend(command = "kimi", defaultArgs = []) {
6073
+ return createGenericCliBackend({
6074
+ kind: "kimi_cli",
6075
+ supportTier: "structured",
6076
+ command,
6077
+ args: [],
6078
+ buildArgs: (context, prompt) => {
6079
+ const args = [
6080
+ "--print",
6081
+ "--output-format",
6082
+ "stream-json",
6083
+ "--work-dir",
6084
+ context.cwd
6085
+ ];
6086
+ const resumeId = context.config.runtimeSessionId?.trim() || context.config.providerSessionId?.trim();
6087
+ if (resumeId) args.push("--session", resumeId);
6088
+ if (shouldEnableKimiCliThinking(context.config.selectedModel)) {
6089
+ args.push("--thinking");
6090
+ }
6091
+ const model2 = resolveKimiCliModelArg(context.config.selectedModel);
6092
+ if (model2) args.push("--model", model2);
6093
+ return [...args, ...defaultArgs, "--prompt", prompt];
6094
+ },
6095
+ augmentPrompt: (context) => {
6096
+ const base = buildPromptWithSystem(context.config, context.promptText);
6097
+ return context.config.mode === "plan" ? buildPlanModePrefix(base) : base;
6098
+ },
6099
+ parseStructuredLine: parseKimiStructuredLine
6100
+ });
6101
+ }
5841
6102
  function createGeminiCliBackend(command = "gemini", defaultArgs = []) {
5842
6103
  return createGenericCliBackend({
5843
6104
  kind: "gemini_cli",
@@ -6163,7 +6424,8 @@ function createCodexRuntimeBackend(command = "codex", defaultArgs = []) {
6163
6424
  const basePrompt = buildPromptWithSystem(ctx.config, ctx.promptText);
6164
6425
  return ctx.config.mode === "plan" ? buildPlanModePrefix(basePrompt) : basePrompt;
6165
6426
  },
6166
- parseStructuredLine: parseCodexStructuredLine
6427
+ parseStructuredLine: parseCodexStructuredLine,
6428
+ afterExit: replayCodexMcpToolEventsFromSessionLog
6167
6429
  }).run(context);
6168
6430
  } finally {
6169
6431
  cleanup();
@@ -6171,8 +6433,43 @@ function createCodexRuntimeBackend(command = "codex", defaultArgs = []) {
6171
6433
  }
6172
6434
  };
6173
6435
  }
6436
+ function createCopilotCliBackend(command = "copilot", defaultArgs = []) {
6437
+ return createGenericCliBackend({
6438
+ kind: "copilot_cli",
6439
+ supportTier: "text",
6440
+ command,
6441
+ args: [],
6442
+ buildArgs: (context, prompt) => {
6443
+ const args = [
6444
+ "--autopilot",
6445
+ "--yolo",
6446
+ "--max-autopilot-continues",
6447
+ "20",
6448
+ "-s",
6449
+ "-p",
6450
+ prompt
6451
+ ];
6452
+ if (context.config.selectedModel?.trim()) {
6453
+ args.push("--model", context.config.selectedModel.trim());
6454
+ }
6455
+ return [...args, ...defaultArgs];
6456
+ }
6457
+ });
6458
+ }
6174
6459
  var DEFAULT_MODEL = "claude-sonnet-4-6";
6175
6460
  var DROID_DEFAULT_MODEL = "claude-opus-4-7";
6461
+ function defaultSelectedModelForBackend(backendKind2) {
6462
+ switch (backendKind2) {
6463
+ case "droid_cli":
6464
+ return DROID_DEFAULT_MODEL;
6465
+ case "copilot_cli":
6466
+ return "claude-sonnet-4.5";
6467
+ case "kimi_cli":
6468
+ return void 0;
6469
+ default:
6470
+ return DEFAULT_MODEL;
6471
+ }
6472
+ }
6176
6473
  function canonicalizePath(inputPath) {
6177
6474
  try {
6178
6475
  const resolved = (0, import_path2.resolve)(inputPath);
@@ -6269,6 +6566,7 @@ var BaseMachineAgent = class _BaseMachineAgent {
6269
6566
  case "gemini_cli":
6270
6567
  case "opencode_cli":
6271
6568
  return "structured";
6569
+ case "copilot_cli":
6272
6570
  case "generic_cli":
6273
6571
  default:
6274
6572
  return "text";
@@ -6298,7 +6596,7 @@ Prefer relative paths and keep your work scoped to this project.`
6298
6596
  supportTier,
6299
6597
  runtimeCommand: config.runtimeCommand || this.runtime.runtimeCommand,
6300
6598
  runtimeArgs: config.runtimeArgs || this.runtime.runtimeArgs,
6301
- selectedModel: config.selectedModel || (backendKind2 === "droid_cli" ? DROID_DEFAULT_MODEL : DEFAULT_MODEL),
6599
+ selectedModel: config.selectedModel || defaultSelectedModelForBackend(backendKind2),
6302
6600
  systemPrompt: systemPromptParts.join("\n\n") || void 0
6303
6601
  };
6304
6602
  }
@@ -6314,7 +6612,7 @@ Prefer relative paths and keep your work scoped to this project.`
6314
6612
  const promptText = this.buildPromptText(runtimeConfig);
6315
6613
  const runtimeCommand = runtimeConfig.runtimeCommand || this.runtime.runtimeCommand;
6316
6614
  const runtimeArgs = runtimeConfig.runtimeArgs || this.runtime.runtimeArgs || [];
6317
- const backend = backendKind2 === "claude_cli" ? createClaudeCliBackend(runtimeCommand || "claude", runtimeArgs) : backendKind2 === "codex_app_server" ? createCodexRuntimeBackend(runtimeCommand || "codex", runtimeArgs) : backendKind2 === "cursor_agent_cli" ? createCursorAgentCliBackend(runtimeCommand || "cursor-agent", runtimeArgs) : backendKind2 === "gemini_cli" ? createGeminiCliBackend(runtimeCommand || "gemini", runtimeArgs) : backendKind2 === "droid_cli" ? createDroidCliBackend(runtimeCommand || "droid", runtimeArgs) : backendKind2 === "opencode_cli" ? createOpencodeCliBackend(runtimeCommand || "opencode", runtimeArgs) : createGenericCliPassthroughBackend(runtimeCommand || "generic-cli", runtimeArgs);
6615
+ const backend = backendKind2 === "claude_cli" ? createClaudeCliBackend(runtimeCommand || "claude", runtimeArgs) : backendKind2 === "codex_app_server" ? createCodexRuntimeBackend(runtimeCommand || "codex", runtimeArgs) : backendKind2 === "copilot_cli" ? createCopilotCliBackend(runtimeCommand || "copilot", runtimeArgs) : backendKind2 === "cursor_agent_cli" ? createCursorAgentCliBackend(runtimeCommand || "cursor-agent", runtimeArgs) : backendKind2 === "gemini_cli" ? createGeminiCliBackend(runtimeCommand || "gemini", runtimeArgs) : backendKind2 === "droid_cli" ? createDroidCliBackend(runtimeCommand || "droid", runtimeArgs) : backendKind2 === "opencode_cli" ? createOpencodeCliBackend(runtimeCommand || "opencode", runtimeArgs) : backendKind2 === "kimi_cli" ? createKimiCliBackend(runtimeCommand || "kimi", runtimeArgs) : createGenericCliPassthroughBackend(runtimeCommand || "generic-cli", runtimeArgs);
6318
6616
  let lastResult = null;
6319
6617
  for (let attempt = 0; attempt <= _BaseMachineAgent.MAX_RETRIES; attempt++) {
6320
6618
  if (this.abortController?.signal.aborted) break;
@@ -6373,7 +6671,18 @@ Prefer relative paths and keep your work scoped to this project.`
6373
6671
  `[base-machine-agent] Transient error (attempt ${attempt + 1}/${_BaseMachineAgent.MAX_RETRIES + 1}), retrying in ${delayMs}ms: ${lastResult.error}`
6374
6672
  );
6375
6673
  void this.presenter.onLog(`Transient error, retrying in ${Math.round(delayMs / 1e3)}s...`);
6376
- await new Promise((resolve2) => setTimeout(resolve2, delayMs));
6674
+ await new Promise((resolve2) => {
6675
+ const signal = this.abortController?.signal;
6676
+ if (signal?.aborted) {
6677
+ resolve2();
6678
+ return;
6679
+ }
6680
+ const timeoutId = setTimeout(resolve2, delayMs);
6681
+ signal?.addEventListener("abort", () => {
6682
+ clearTimeout(timeoutId);
6683
+ resolve2();
6684
+ }, { once: true });
6685
+ });
6377
6686
  }
6378
6687
  }
6379
6688
  const normalizedResult = lastResult;
@@ -6394,13 +6703,13 @@ Prefer relative paths and keep your work scoped to this project.`
6394
6703
  runtimeArgs: config.runtimeArgs || this.runtime.runtimeArgs
6395
6704
  };
6396
6705
  this.presenter.onStart(initialConfig);
6397
- let safeProjectPath = initialConfig.projectPath;
6398
- if (initialConfig.projectPath) {
6399
- const canonicalized = canonicalizePath(initialConfig.projectPath);
6706
+ let safeProjectPath = initialConfig.teamPath;
6707
+ if (initialConfig.teamPath) {
6708
+ const canonicalized = canonicalizePath(initialConfig.teamPath);
6400
6709
  if (canonicalized) safeProjectPath = canonicalized;
6401
6710
  }
6402
6711
  if (safeProjectPath && !(0, import_fs2.existsSync)(safeProjectPath)) {
6403
- const message = `Project path no longer exists: "${safeProjectPath}". Please update the project's local path in project settings before running the agent.`;
6712
+ const message = `Local path no longer exists: "${safeProjectPath}". Please update the team's local path in team settings before running the agent.`;
6404
6713
  this.presenter.onError(message, true);
6405
6714
  const result = {
6406
6715
  success: false,
@@ -6441,11 +6750,61 @@ Prefer relative paths and keep your work scoped to this project.`
6441
6750
  };
6442
6751
 
6443
6752
  // src/core-agent.ts
6444
- var CoreAgent = class extends BaseMachineAgent {
6753
+ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
6445
6754
  childProcess = null;
6755
+ _aborted = false;
6756
+ /** How long to wait after SIGTERM before escalating to SIGKILL. */
6757
+ static SIGKILL_DELAY_MS = 3e3;
6446
6758
  constructor(presenter, runtime) {
6447
6759
  super(presenter, runtime);
6448
6760
  }
6761
+ abort() {
6762
+ this._aborted = true;
6763
+ super.abort();
6764
+ }
6765
+ kill() {
6766
+ this._aborted = true;
6767
+ super.abort();
6768
+ const child = this.childProcess;
6769
+ if (!child || child.killed || child.exitCode !== null) return false;
6770
+ return this.killChildProcess(child);
6771
+ }
6772
+ killChildProcess(child) {
6773
+ const pid = child.pid;
6774
+ if (!pid) return false;
6775
+ console.info("[CoreAgent] Killing agent process", { pid });
6776
+ try {
6777
+ if (process.platform === "win32") {
6778
+ child.kill("SIGTERM");
6779
+ } else {
6780
+ process.kill(-pid, "SIGTERM");
6781
+ }
6782
+ } catch (err) {
6783
+ if (err.code !== "ESRCH") {
6784
+ console.warn("[CoreAgent] SIGTERM failed", { pid, err });
6785
+ }
6786
+ try {
6787
+ child.kill("SIGTERM");
6788
+ } catch {
6789
+ }
6790
+ }
6791
+ setTimeout(() => {
6792
+ if (child.killed || child.exitCode !== null) return;
6793
+ console.warn("[CoreAgent] Escalating to SIGKILL", { pid });
6794
+ try {
6795
+ if (process.platform === "win32") {
6796
+ child.kill("SIGKILL");
6797
+ } else {
6798
+ process.kill(-pid, "SIGKILL");
6799
+ }
6800
+ } catch (err) {
6801
+ if (err.code !== "ESRCH") {
6802
+ console.warn("[CoreAgent] SIGKILL failed", { pid, err });
6803
+ }
6804
+ }
6805
+ }, _CoreAgent.SIGKILL_DELAY_MS);
6806
+ return true;
6807
+ }
6449
6808
  // ── Interactive tool response (WS relay → stdin) ───────────────────────
6450
6809
  /**
6451
6810
  * Send a tool_result to the CLI's stdin (stream-json format).
@@ -6486,6 +6845,12 @@ var CoreAgent = class extends BaseMachineAgent {
6486
6845
  child.on("exit", () => {
6487
6846
  this.childProcess = null;
6488
6847
  });
6848
+ child.on("error", () => {
6849
+ this.childProcess = null;
6850
+ });
6851
+ if (this._aborted) {
6852
+ this.killChildProcess(child);
6853
+ }
6489
6854
  };
6490
6855
  }
6491
6856
  async buildCliEnvironment() {
@@ -6502,19 +6867,51 @@ var CoreAgent = class extends BaseMachineAgent {
6502
6867
  env.PATH = missing.length > 0 ? `${missing.join(":")}:${basePath}` : basePath;
6503
6868
  return env;
6504
6869
  }
6505
- buildExtraSystemPromptParts(_config) {
6870
+ buildExtraSystemPromptParts(config) {
6871
+ const parts2 = [];
6872
+ if (config.taskMeta) {
6873
+ const meta = config.taskMeta;
6874
+ const lines = ["# Task Context"];
6875
+ lines.push(`- **Title**: ${meta.title}`);
6876
+ lines.push(`- **Status**: ${meta.status.replace(/_/g, " ")}`);
6877
+ if (meta.priority && meta.priority !== "none") {
6878
+ lines.push(`- **Priority**: ${meta.priority.toUpperCase()}`);
6879
+ }
6880
+ if (meta.labels && meta.labels.length > 0) {
6881
+ lines.push(`- **Labels**: ${meta.labels.join(", ")}`);
6882
+ }
6883
+ if (meta.assignees && meta.assignees.length > 0) {
6884
+ const assigneeStr = meta.assignees.map((a) => a.name ?? a.email).join(", ");
6885
+ lines.push(`- **Assignees**: ${assigneeStr}`);
6886
+ }
6887
+ if (meta.description) {
6888
+ lines.push(`- **Description**:
6889
+ ${meta.description}`);
6890
+ }
6891
+ if (meta.descriptionAttachmentIds && meta.descriptionAttachmentIds.length > 0) {
6892
+ lines.push("");
6893
+ lines.push("## Task Description Images");
6894
+ lines.push("The task description contains images. Use the `get_attachment` MCP tool to view them:");
6895
+ for (const att of meta.descriptionAttachmentIds) {
6896
+ lines.push(`- Attachment ID: \`${att.id}\` (${att.filename})`);
6897
+ }
6898
+ }
6899
+ parts2.push(lines.join("\n"));
6900
+ }
6901
+ const taskId2 = config.taskId ?? process.env.AIDEN_TASK_ID;
6902
+ const conversationId = config.conversationId ?? process.env.AIDEN_SESSION_ID;
6506
6903
  const artifactIds = [];
6507
- const envTaskId = process.env.AIDEN_TASK_ID;
6508
- const envSessionId = process.env.AIDEN_SESSION_ID;
6509
- if (envTaskId) artifactIds.push(`- taskId: "${envTaskId}"`);
6510
- if (envSessionId) artifactIds.push(`- conversationId: "${envSessionId}"`);
6511
- if (artifactIds.length === 0) return [];
6512
- return [
6513
- [
6514
- "When creating artifacts using MCP tools (create_plan, create_document_artifact, create_test_report), always pass these IDs:",
6515
- ...artifactIds
6516
- ].join("\n")
6517
- ];
6904
+ if (taskId2) artifactIds.push(`- taskId: "${taskId2}"`);
6905
+ if (conversationId) artifactIds.push(`- conversationId: "${conversationId}"`);
6906
+ if (artifactIds.length > 0) {
6907
+ parts2.push(
6908
+ [
6909
+ "When creating artifacts using MCP tools (create_plan, create_document_artifact, create_test_report), always pass these IDs:",
6910
+ ...artifactIds
6911
+ ].join("\n")
6912
+ );
6913
+ }
6914
+ return parts2;
6518
6915
  }
6519
6916
  };
6520
6917
 
@@ -6613,10 +7010,10 @@ var WebPresenter = class {
6613
7010
  }
6614
7011
  };
6615
7012
 
6616
- // ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js
7013
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js
6617
7014
  var XMLHttpRequestModule = __toESM(require_XMLHttpRequest(), 1);
6618
7015
 
6619
- // ../../node_modules/engine.io-parser/build/esm/commons.js
7016
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/commons.js
6620
7017
  var PACKET_TYPES = /* @__PURE__ */ Object.create(null);
6621
7018
  PACKET_TYPES["open"] = "0";
6622
7019
  PACKET_TYPES["close"] = "1";
@@ -6631,7 +7028,7 @@ Object.keys(PACKET_TYPES).forEach((key) => {
6631
7028
  });
6632
7029
  var ERROR_PACKET = { type: "error", data: "parser error" };
6633
7030
 
6634
- // ../../node_modules/engine.io-parser/build/esm/encodePacket.js
7031
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/encodePacket.js
6635
7032
  var encodePacket = ({ type, data }, supportsBinary, callback) => {
6636
7033
  if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
6637
7034
  return callback(supportsBinary ? data : "b" + toBuffer(data, true).toString("base64"));
@@ -6660,7 +7057,7 @@ function encodePacketToBinary(packet, callback) {
6660
7057
  });
6661
7058
  }
6662
7059
 
6663
- // ../../node_modules/engine.io-parser/build/esm/decodePacket.js
7060
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/decodePacket.js
6664
7061
  var decodePacket = (encodedPacket, binaryType) => {
6665
7062
  if (typeof encodedPacket !== "string") {
6666
7063
  return {
@@ -6706,7 +7103,7 @@ var mapBinary = (data, binaryType) => {
6706
7103
  }
6707
7104
  };
6708
7105
 
6709
- // ../../node_modules/engine.io-parser/build/esm/index.js
7106
+ // ../../node_modules/.pnpm/engine.io-parser@5.2.3/node_modules/engine.io-parser/build/esm/index.js
6710
7107
  var SEPARATOR = String.fromCharCode(30);
6711
7108
  var encodePayload = (packets, callback) => {
6712
7109
  const length = packets.length;
@@ -6848,7 +7245,7 @@ function createPacketDecoderStream(maxPayload, binaryType) {
6848
7245
  }
6849
7246
  var protocol = 4;
6850
7247
 
6851
- // ../../node_modules/@socket.io/component-emitter/lib/esm/index.js
7248
+ // ../../node_modules/.pnpm/@socket.io+component-emitter@3.1.2/node_modules/@socket.io/component-emitter/lib/esm/index.js
6852
7249
  function Emitter(obj) {
6853
7250
  if (obj) return mixin(obj);
6854
7251
  }
@@ -6920,7 +7317,7 @@ Emitter.prototype.hasListeners = function(event) {
6920
7317
  return !!this.listeners(event).length;
6921
7318
  };
6922
7319
 
6923
- // ../../node_modules/engine.io-client/build/esm-debug/globals.node.js
7320
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/globals.node.js
6924
7321
  var nextTick = process.nextTick;
6925
7322
  var globalThisShim = global;
6926
7323
  var defaultBinaryType = "nodebuffer";
@@ -7008,7 +7405,7 @@ var CookieJar = class {
7008
7405
  }
7009
7406
  };
7010
7407
 
7011
- // ../../node_modules/engine.io-client/build/esm-debug/util.js
7408
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/util.js
7012
7409
  function pick(obj, ...attr) {
7013
7410
  return attr.reduce((acc, k) => {
7014
7411
  if (obj.hasOwnProperty(k)) {
@@ -7056,7 +7453,7 @@ function randomString() {
7056
7453
  return Date.now().toString(36).substring(3) + Math.random().toString(36).substring(2, 5);
7057
7454
  }
7058
7455
 
7059
- // ../../node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js
7456
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/contrib/parseqs.js
7060
7457
  function encode(obj) {
7061
7458
  let str = "";
7062
7459
  for (let i in obj) {
@@ -7078,7 +7475,7 @@ function decode(qs) {
7078
7475
  return qry;
7079
7476
  }
7080
7477
 
7081
- // ../../node_modules/engine.io-client/build/esm-debug/transport.js
7478
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transport.js
7082
7479
  var import_debug = __toESM(require_src(), 1);
7083
7480
  var debug = (0, import_debug.default)("engine.io-client:transport");
7084
7481
  var TransportError = class extends Error {
@@ -7212,7 +7609,7 @@ var Transport = class extends Emitter {
7212
7609
  }
7213
7610
  };
7214
7611
 
7215
- // ../../node_modules/engine.io-client/build/esm-debug/transports/polling.js
7612
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/polling.js
7216
7613
  var import_debug2 = __toESM(require_src(), 1);
7217
7614
  var debug2 = (0, import_debug2.default)("engine.io-client:polling");
7218
7615
  var Polling = class extends Transport {
@@ -7357,7 +7754,7 @@ var Polling = class extends Transport {
7357
7754
  }
7358
7755
  };
7359
7756
 
7360
- // ../../node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js
7757
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/contrib/has-cors.js
7361
7758
  var value = false;
7362
7759
  try {
7363
7760
  value = typeof XMLHttpRequest !== "undefined" && "withCredentials" in new XMLHttpRequest();
@@ -7365,7 +7762,7 @@ try {
7365
7762
  }
7366
7763
  var hasCORS = value;
7367
7764
 
7368
- // ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js
7765
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js
7369
7766
  var import_debug3 = __toESM(require_src(), 1);
7370
7767
  var debug3 = (0, import_debug3.default)("engine.io-client:polling");
7371
7768
  function empty() {
@@ -7600,7 +7997,7 @@ function newRequest(opts) {
7600
7997
  }
7601
7998
  }
7602
7999
 
7603
- // ../../node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js
8000
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.node.js
7604
8001
  var XMLHttpRequest2 = XMLHttpRequestModule.default || XMLHttpRequestModule;
7605
8002
  var XHR = class extends BaseXHR {
7606
8003
  request(opts = {}) {
@@ -7610,14 +8007,14 @@ var XHR = class extends BaseXHR {
7610
8007
  }
7611
8008
  };
7612
8009
 
7613
- // ../../node_modules/engine.io-client/node_modules/ws/wrapper.mjs
8010
+ // ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/wrapper.mjs
7614
8011
  var import_stream = __toESM(require_stream(), 1);
7615
8012
  var import_receiver = __toESM(require_receiver(), 1);
7616
8013
  var import_sender = __toESM(require_sender(), 1);
7617
8014
  var import_websocket = __toESM(require_websocket(), 1);
7618
8015
  var import_websocket_server = __toESM(require_websocket_server(), 1);
7619
8016
 
7620
- // ../../node_modules/engine.io-client/build/esm-debug/transports/websocket.js
8017
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/websocket.js
7621
8018
  var import_debug4 = __toESM(require_src(), 1);
7622
8019
  var debug4 = (0, import_debug4.default)("engine.io-client:websocket");
7623
8020
  var isReactNative = typeof navigator !== "undefined" && typeof navigator.product === "string" && navigator.product.toLowerCase() === "reactnative";
@@ -7706,7 +8103,7 @@ var BaseWS = class extends Transport {
7706
8103
  };
7707
8104
  var WebSocketCtor = globalThisShim.WebSocket || globalThisShim.MozWebSocket;
7708
8105
 
7709
- // ../../node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js
8106
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/websocket.node.js
7710
8107
  var WS = class extends BaseWS {
7711
8108
  createSocket(uri, protocols, opts) {
7712
8109
  var _a;
@@ -7737,7 +8134,7 @@ var WS = class extends BaseWS {
7737
8134
  }
7738
8135
  };
7739
8136
 
7740
- // ../../node_modules/engine.io-client/build/esm-debug/transports/webtransport.js
8137
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/webtransport.js
7741
8138
  var import_debug5 = __toESM(require_src(), 1);
7742
8139
  var debug5 = (0, import_debug5.default)("engine.io-client:webtransport");
7743
8140
  var WT = class extends Transport {
@@ -7807,14 +8204,14 @@ var WT = class extends Transport {
7807
8204
  }
7808
8205
  };
7809
8206
 
7810
- // ../../node_modules/engine.io-client/build/esm-debug/transports/index.js
8207
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/transports/index.js
7811
8208
  var transports = {
7812
8209
  websocket: WS,
7813
8210
  webtransport: WT,
7814
8211
  polling: XHR
7815
8212
  };
7816
8213
 
7817
- // ../../node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js
8214
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/contrib/parseuri.js
7818
8215
  var re = /^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
7819
8216
  var parts = [
7820
8217
  "source",
@@ -7874,7 +8271,7 @@ function queryKey(uri, query) {
7874
8271
  return data;
7875
8272
  }
7876
8273
 
7877
- // ../../node_modules/engine.io-client/build/esm-debug/socket.js
8274
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/socket.js
7878
8275
  var import_debug6 = __toESM(require_src(), 1);
7879
8276
  var debug6 = (0, import_debug6.default)("engine.io-client:socket");
7880
8277
  var withEventListeners = typeof addEventListener === "function" && typeof removeEventListener === "function";
@@ -8470,10 +8867,10 @@ var Socket = class extends SocketWithUpgrade {
8470
8867
  }
8471
8868
  };
8472
8869
 
8473
- // ../../node_modules/engine.io-client/build/esm-debug/index.js
8870
+ // ../../node_modules/.pnpm/engine.io-client@6.6.4/node_modules/engine.io-client/build/esm-debug/index.js
8474
8871
  var protocol2 = Socket.protocol;
8475
8872
 
8476
- // ../../node_modules/socket.io-client/build/esm-debug/url.js
8873
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/url.js
8477
8874
  var import_debug7 = __toESM(require_src(), 1);
8478
8875
  var debug7 = (0, import_debug7.default)("socket.io-client:url");
8479
8876
  function url(uri, path = "", loc) {
@@ -8515,7 +8912,7 @@ function url(uri, path = "", loc) {
8515
8912
  return obj;
8516
8913
  }
8517
8914
 
8518
- // ../../node_modules/socket.io-parser/build/esm-debug/index.js
8915
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.5/node_modules/socket.io-parser/build/esm-debug/index.js
8519
8916
  var esm_debug_exports = {};
8520
8917
  __export(esm_debug_exports, {
8521
8918
  Decoder: () => Decoder,
@@ -8525,7 +8922,7 @@ __export(esm_debug_exports, {
8525
8922
  protocol: () => protocol3
8526
8923
  });
8527
8924
 
8528
- // ../../node_modules/socket.io-parser/build/esm-debug/is-binary.js
8925
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.5/node_modules/socket.io-parser/build/esm-debug/is-binary.js
8529
8926
  var withNativeArrayBuffer = typeof ArrayBuffer === "function";
8530
8927
  var isView = (obj) => {
8531
8928
  return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj.buffer instanceof ArrayBuffer;
@@ -8562,7 +8959,7 @@ function hasBinary(obj, toJSON) {
8562
8959
  return false;
8563
8960
  }
8564
8961
 
8565
- // ../../node_modules/socket.io-parser/build/esm-debug/binary.js
8962
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.5/node_modules/socket.io-parser/build/esm-debug/binary.js
8566
8963
  function deconstructPacket(packet) {
8567
8964
  const buffers = [];
8568
8965
  const packetData = packet.data;
@@ -8624,7 +9021,7 @@ function _reconstructPacket(data, buffers) {
8624
9021
  return data;
8625
9022
  }
8626
9023
 
8627
- // ../../node_modules/socket.io-parser/build/esm-debug/index.js
9024
+ // ../../node_modules/.pnpm/socket.io-parser@4.2.5/node_modules/socket.io-parser/build/esm-debug/index.js
8628
9025
  var import_debug8 = __toESM(require_src(), 1);
8629
9026
  var debug8 = (0, import_debug8.default)("socket.io-parser");
8630
9027
  var RESERVED_EVENTS = [
@@ -8918,7 +9315,7 @@ function isPacketValid(packet) {
8918
9315
  return isNamespaceValid(packet.nsp) && isAckIdValid(packet.id) && isDataValid(packet.type, packet.data);
8919
9316
  }
8920
9317
 
8921
- // ../../node_modules/socket.io-client/build/esm-debug/on.js
9318
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/on.js
8922
9319
  function on(obj, ev, fn) {
8923
9320
  obj.on(ev, fn);
8924
9321
  return function subDestroy() {
@@ -8926,7 +9323,7 @@ function on(obj, ev, fn) {
8926
9323
  };
8927
9324
  }
8928
9325
 
8929
- // ../../node_modules/socket.io-client/build/esm-debug/socket.js
9326
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/socket.js
8930
9327
  var import_debug9 = __toESM(require_src(), 1);
8931
9328
  var debug9 = (0, import_debug9.default)("socket.io-client:socket");
8932
9329
  var RESERVED_EVENTS2 = Object.freeze({
@@ -9721,7 +10118,7 @@ var Socket2 = class extends Emitter {
9721
10118
  }
9722
10119
  };
9723
10120
 
9724
- // ../../node_modules/socket.io-client/build/esm-debug/contrib/backo2.js
10121
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/contrib/backo2.js
9725
10122
  function Backoff(opts) {
9726
10123
  opts = opts || {};
9727
10124
  this.ms = opts.min || 100;
@@ -9752,7 +10149,7 @@ Backoff.prototype.setJitter = function(jitter) {
9752
10149
  this.jitter = jitter;
9753
10150
  };
9754
10151
 
9755
- // ../../node_modules/socket.io-client/build/esm-debug/manager.js
10152
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/manager.js
9756
10153
  var import_debug10 = __toESM(require_src(), 1);
9757
10154
  var debug10 = (0, import_debug10.default)("socket.io-client:manager");
9758
10155
  var Manager = class extends Emitter {
@@ -10121,7 +10518,7 @@ var Manager = class extends Emitter {
10121
10518
  }
10122
10519
  };
10123
10520
 
10124
- // ../../node_modules/socket.io-client/build/esm-debug/index.js
10521
+ // ../../node_modules/.pnpm/socket.io-client@4.8.3/node_modules/socket.io-client/build/esm-debug/index.js
10125
10522
  var import_debug11 = __toESM(require_src(), 1);
10126
10523
  var debug11 = (0, import_debug11.default)("socket.io-client");
10127
10524
  var cache = {};
@@ -10224,7 +10621,14 @@ var WSClient = class {
10224
10621
  providerSessionId: data.providerSessionId,
10225
10622
  backendKind: data.backendKind,
10226
10623
  selectedModel: data.selectedModel,
10227
- mode: data.mode
10624
+ mode: data.mode,
10625
+ taskMeta: data.taskMeta,
10626
+ workflowTools: data.workflowTools,
10627
+ runId: data.runId,
10628
+ messageId: data.messageId,
10629
+ maxIterations: data.maxIterations,
10630
+ taskId: data.taskId,
10631
+ conversationId: data.conversationId
10228
10632
  });
10229
10633
  });
10230
10634
  this.socket.on("stop", () => {
@@ -10242,7 +10646,7 @@ var WSClient = class {
10242
10646
  };
10243
10647
 
10244
10648
  // src/version.ts
10245
- var AGENT_VERSION = "0.1.6";
10649
+ var AGENT_VERSION = "0.1.8";
10246
10650
 
10247
10651
  // src/sandbox.ts
10248
10652
  async function runSandbox(config) {
@@ -10251,6 +10655,11 @@ async function runSandbox(config) {
10251
10655
  let stopped = false;
10252
10656
  let pendingMessageResolve = null;
10253
10657
  let currentAgent = null;
10658
+ let currentTaskMeta = void 0;
10659
+ let currentWorkflowTools = void 0;
10660
+ let currentMaxIterations = config.maxIterations ?? 50;
10661
+ let currentTaskId = config.taskId;
10662
+ let currentConversationId = config.sessionId;
10254
10663
  console.info("[sandbox] Connecting to WS server", { wsUrl: config.wsUrl, sessionId: config.sessionId });
10255
10664
  const wsClient = new WSClient(
10256
10665
  config.wsUrl,
@@ -10269,7 +10678,10 @@ async function runSandbox(config) {
10269
10678
  },
10270
10679
  onStop: () => {
10271
10680
  console.info("[sandbox] Stop signal received");
10272
- if (currentAgent) currentAgent.abort();
10681
+ if (currentAgent) {
10682
+ const killed = currentAgent.kill();
10683
+ if (!killed) currentAgent.abort();
10684
+ }
10273
10685
  },
10274
10686
  onToolResponse: (toolId, response) => {
10275
10687
  if (currentAgent) {
@@ -10308,13 +10720,17 @@ async function runSandbox(config) {
10308
10720
  try {
10309
10721
  result = await agent.run({
10310
10722
  task: currentTask,
10311
- maxIterations: config.maxIterations || 50,
10312
- projectPath: config.projectPath,
10723
+ maxIterations: currentMaxIterations,
10724
+ teamPath: config.projectPath,
10313
10725
  cwd: config.projectPath,
10314
10726
  backendKind: activeBackendKind,
10315
10727
  mode: activeMode,
10316
10728
  selectedModel: activeModel,
10317
10729
  providerSessionId: lastProviderSessionId ?? void 0,
10730
+ taskMeta: currentTaskMeta,
10731
+ taskId: currentTaskId,
10732
+ conversationId: currentConversationId,
10733
+ workflowTools: currentWorkflowTools,
10318
10734
  images: currentImages.length > 0 ? currentImages.map((img) => ({
10319
10735
  id: img.id,
10320
10736
  data: img.data,
@@ -10355,6 +10771,21 @@ async function runSandbox(config) {
10355
10771
  if (nextPayload.mode) {
10356
10772
  activeMode = nextPayload.mode;
10357
10773
  }
10774
+ if (nextPayload.taskMeta !== void 0) {
10775
+ currentTaskMeta = nextPayload.taskMeta;
10776
+ }
10777
+ if (nextPayload.workflowTools !== void 0) {
10778
+ currentWorkflowTools = nextPayload.workflowTools;
10779
+ }
10780
+ if (nextPayload.maxIterations !== void 0) {
10781
+ currentMaxIterations = nextPayload.maxIterations;
10782
+ }
10783
+ if (nextPayload.taskId !== void 0) {
10784
+ currentTaskId = nextPayload.taskId;
10785
+ }
10786
+ if (nextPayload.conversationId !== void 0) {
10787
+ currentConversationId = nextPayload.conversationId;
10788
+ }
10358
10789
  }
10359
10790
  presenter.setSuppressSessionLifecycle(false);
10360
10791
  wsClient.close();