@elizaos/plugin-agent-orchestrator 0.3.18 → 0.3.19

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.
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Handler logic for the START_CODING_TASK action.
3
3
  *
4
- * - handleMultiAgent() -- Multi-agent mode (pipe-delimited `agents` param)
5
- * - handleSingleAgent() -- Single-agent mode (standard handler path)
4
+ * handleMultiAgent() handles both multi-agent and single-agent modes.
5
+ * A single-agent call is just a length-1 agent spec.
6
6
  *
7
7
  * @module actions/coding-task-handlers
8
8
  */
@@ -37,10 +37,4 @@ export interface CodingTaskContext {
37
37
  * workspace clone (or scratch directory).
38
38
  */
39
39
  export declare function handleMultiAgent(ctx: CodingTaskContext, agentsParam: string): Promise<ActionResult | undefined>;
40
- /**
41
- * Single-agent mode handler.
42
- *
43
- * Provisions a workspace (clone or scratch) and spawns a single coding agent.
44
- */
45
- export declare function handleSingleAgent(ctx: CodingTaskContext, task: string | undefined): Promise<ActionResult | undefined>;
46
40
  //# sourceMappingURL=coding-task-handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coding-task-handlers.d.ts","sourceRoot":"","sources":["../../src/actions/coding-task-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,KAAK,MAAM,EAEX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAgI7E,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC9C,WAAW,EAAE,gBAAgB,CAAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IACtD,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,gBAAgB,EAAE,eAAe,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,iBAAiB,EACtB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAyRnC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,iBAAiB,EACtB,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAgNnC"}
1
+ {"version":3,"file":"coding-task-handlers.d.ts","sourceRoot":"","sources":["../../src/actions/coding-task-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,KAAK,MAAM,EAEX,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAkB,MAAM,uBAAuB,CAAC;AAC9E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}
1
+ {"version":3,"file":"spawn-agent.d.ts","sourceRoot":"","sources":["../../src/actions/spawn-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EACL,KAAK,MAAM,EAQZ,MAAM,eAAe,CAAC;AAavB,eAAO,MAAM,gBAAgB,EAAE,MA+U9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"start-coding-task.d.ts","sourceRoot":"","sources":["../../src/actions/start-coding-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAYvB,eAAO,MAAM,qBAAqB,EAAE,MAgPnC,CAAC"}
1
+ {"version":3,"file":"start-coding-task.d.ts","sourceRoot":"","sources":["../../src/actions/start-coding-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EACV,MAAM,EAOP,MAAM,eAAe,CAAC;AAWvB,eAAO,MAAM,qBAAqB,EAAE,MAkPnC,CAAC"}
package/dist/index.js CHANGED
@@ -5190,7 +5190,8 @@ ${taskList}
5190
5190
  try {
5191
5191
  const result = await withTrajectoryContext(runtime, { source: "orchestrator", decisionType: "swarm-context-generation" }, () => runtime.useModel(ModelType5.TEXT_SMALL, {
5192
5192
  prompt,
5193
- temperature: 0.3
5193
+ temperature: 0.3,
5194
+ stream: false
5194
5195
  }));
5195
5196
  return result?.trim() || "";
5196
5197
  } catch (err) {
@@ -5217,12 +5218,7 @@ async function handleMultiAgent(ctx, agentsParam) {
5217
5218
  } = ctx;
5218
5219
  const agentSpecs = agentsParam.split("|").map((s) => s.trim()).filter(Boolean);
5219
5220
  if (agentSpecs.length === 0) {
5220
- if (callback) {
5221
- await callback({
5222
- text: "No agent tasks provided in agents parameter."
5223
- });
5224
- }
5225
- return { success: false, error: "EMPTY_AGENTS_PARAM" };
5221
+ agentSpecs.push("");
5226
5222
  }
5227
5223
  if (agentSpecs.length > MAX_CONCURRENT_AGENTS) {
5228
5224
  if (callback) {
@@ -5397,169 +5393,6 @@ ${swarmContext}
5397
5393
  data: { agents: results }
5398
5394
  };
5399
5395
  }
5400
- async function handleSingleAgent(ctx, task) {
5401
- logger6.debug(`[START_CODING_TASK] handleSingleAgent called, agentType=${ctx.defaultAgentType}, task=${task ? "yes" : "none"}, repo=${ctx.repo ?? "none"}`);
5402
- const {
5403
- runtime,
5404
- ptyService,
5405
- wsService,
5406
- credentials,
5407
- customCredentials,
5408
- callback,
5409
- message,
5410
- state,
5411
- repo,
5412
- defaultAgentType: agentType,
5413
- rawAgentType,
5414
- memoryContent,
5415
- approvalPreset,
5416
- explicitLabel
5417
- } = ctx;
5418
- const label = explicitLabel || generateLabel(repo, task);
5419
- let workdir;
5420
- let workspaceId;
5421
- let branch;
5422
- if (repo) {
5423
- if (!wsService) {
5424
- if (callback) {
5425
- await callback({
5426
- text: "Workspace Service is not available. Cannot clone repository."
5427
- });
5428
- }
5429
- return { success: false, error: "WORKSPACE_SERVICE_UNAVAILABLE" };
5430
- }
5431
- try {
5432
- if (callback) {
5433
- await callback({ text: `Cloning ${repo}...` });
5434
- }
5435
- const workspace = await wsService.provisionWorkspace({ repo });
5436
- workdir = workspace.path;
5437
- workspaceId = workspace.id;
5438
- branch = workspace.branch;
5439
- wsService.setLabel(workspace.id, label);
5440
- if (state) {
5441
- state.codingWorkspace = {
5442
- id: workspace.id,
5443
- path: workspace.path,
5444
- branch: workspace.branch,
5445
- isWorktree: workspace.isWorktree,
5446
- label
5447
- };
5448
- }
5449
- } catch (error) {
5450
- const errorMessage = error instanceof Error ? error.message : String(error);
5451
- if (callback) {
5452
- await callback({
5453
- text: `Failed to clone repository: ${errorMessage}`
5454
- });
5455
- }
5456
- return { success: false, error: errorMessage };
5457
- }
5458
- } else {
5459
- workdir = createScratchDir();
5460
- }
5461
- logger6.debug(`[START_CODING_TASK] Spawning ${agentType} agent, task: ${task ? `"${task.slice(0, 80)}..."` : "(none)"}, workdir: ${workdir}`);
5462
- try {
5463
- if (agentType !== "shell" && agentType !== "pi") {
5464
- const [preflight] = await ptyService.checkAvailableAgents([
5465
- agentType
5466
- ]);
5467
- if (preflight && !preflight.installed) {
5468
- logger6.warn(`[START_CODING_TASK] ${preflight.adapter} CLI not installed`);
5469
- if (callback) {
5470
- await callback({
5471
- text: `${preflight.adapter} CLI is not installed.
5472
- Install with: ${preflight.installCommand}
5473
- Docs: ${preflight.docsUrl}`
5474
- });
5475
- }
5476
- return { success: false, error: "AGENT_NOT_INSTALLED" };
5477
- }
5478
- logger6.debug(`[START_CODING_TASK] Preflight OK: ${preflight?.adapter} installed`);
5479
- }
5480
- const piRequested = isPiAgentType(rawAgentType);
5481
- const initialTask = piRequested ? toPiCommand(task) : task;
5482
- const displayType = piRequested ? "pi" : agentType;
5483
- const pastExperience = await queryPastExperience(runtime, {
5484
- taskDescription: task,
5485
- lookbackHours: 48,
5486
- maxEntries: 6,
5487
- repo
5488
- });
5489
- const pastExperienceBlock = formatPastExperience(pastExperience);
5490
- const agentMemory = [memoryContent, pastExperienceBlock].filter(Boolean).join(`
5491
-
5492
- `) || undefined;
5493
- const coordinator = getCoordinator(runtime);
5494
- logger6.debug(`[START_CODING_TASK] Calling spawnSession (${agentType}, coordinator=${!!coordinator})`);
5495
- const session = await ptyService.spawnSession({
5496
- name: `coding-${Date.now()}`,
5497
- agentType,
5498
- workdir,
5499
- initialTask,
5500
- memoryContent: agentMemory,
5501
- credentials,
5502
- approvalPreset: approvalPreset ?? ptyService.defaultApprovalPreset,
5503
- customCredentials,
5504
- ...coordinator ? { skipAdapterAutoResponse: true } : {},
5505
- metadata: {
5506
- requestedType: rawAgentType,
5507
- messageId: message.id,
5508
- userId: message.userId,
5509
- workspaceId,
5510
- label
5511
- }
5512
- });
5513
- logger6.debug(`[START_CODING_TASK] Session spawned: ${session.id} (${session.status})`);
5514
- const isScratchWorkspace = !repo;
5515
- const scratchDir = isScratchWorkspace ? workdir : null;
5516
- registerSessionEvents(ptyService, runtime, session.id, label, scratchDir, callback, !!coordinator);
5517
- if (coordinator && task) {
5518
- coordinator.registerTask(session.id, {
5519
- agentType,
5520
- label,
5521
- originalTask: task,
5522
- workdir,
5523
- repo
5524
- });
5525
- }
5526
- if (state) {
5527
- state.codingSession = {
5528
- id: session.id,
5529
- agentType: session.agentType,
5530
- workdir: session.workdir,
5531
- status: session.status
5532
- };
5533
- }
5534
- const summary = repo ? `Cloned ${repo} and started ${displayType} agent as "${label}"${task ? ` with task: "${task}"` : ""}` : `Started ${displayType} agent as "${label}" in scratch workspace${task ? ` with task: "${task}"` : ""}`;
5535
- if (callback) {
5536
- await callback({ text: `${summary}
5537
- Session ID: ${session.id}` });
5538
- }
5539
- return {
5540
- success: true,
5541
- text: summary,
5542
- data: {
5543
- sessionId: session.id,
5544
- agentType: displayType,
5545
- workdir: session.workdir,
5546
- workspaceId,
5547
- branch,
5548
- label,
5549
- status: session.status
5550
- }
5551
- };
5552
- } catch (error) {
5553
- const errorMessage = error instanceof Error ? error.message : String(error);
5554
- logger6.error("[START_CODING_TASK] Failed to spawn agent:", errorMessage);
5555
- if (callback) {
5556
- await callback({
5557
- text: `Failed to start coding agent: ${errorMessage}`
5558
- });
5559
- }
5560
- return { success: false, error: errorMessage };
5561
- }
5562
- }
5563
5396
 
5564
5397
  // src/actions/start-coding-task.ts
5565
5398
  var startCodingTaskAction = {
@@ -5679,7 +5512,8 @@ var startCodingTaskAction = {
5679
5512
  return handleMultiAgent(ctx, agentsParam);
5680
5513
  }
5681
5514
  const task = params?.task ?? content.task;
5682
- return handleSingleAgent(ctx, task);
5515
+ const singleAgentSpec = task || "";
5516
+ return handleMultiAgent(ctx, singleAgentSpec);
5683
5517
  },
5684
5518
  parameters: [
5685
5519
  {
@@ -7960,5 +7794,5 @@ export {
7960
7794
  CodingWorkspaceService
7961
7795
  };
7962
7796
 
7963
- //# debugId=6CDD8C39345EE4DA64756E2164756E21
7797
+ //# debugId=62DE82DAFB3D448A64756E2164756E21
7964
7798
  //# sourceMappingURL=index.js.map