oh-my-opencode 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +44 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24239,14 +24239,17 @@ function createBackgroundTask(manager) {
24239
24239
  args: {
24240
24240
  description: tool.schema.string().describe("Short task description (shown in status)"),
24241
24241
  prompt: tool.schema.string().describe("Full detailed prompt for the agent"),
24242
- agent: tool.schema.string().describe("Agent type to use (any agent allowed)")
24242
+ agent: tool.schema.string().describe("Agent type to use (any registered agent)")
24243
24243
  },
24244
24244
  async execute(args, toolContext) {
24245
+ if (!args.agent || args.agent.trim() === "") {
24246
+ return `\u274C Agent parameter is required. Please specify which agent to use (e.g., "explore", "librarian", "build", etc.)`;
24247
+ }
24245
24248
  try {
24246
24249
  const task = await manager.launch({
24247
24250
  description: args.description,
24248
24251
  prompt: args.prompt,
24249
- agent: args.agent,
24252
+ agent: args.agent.trim(),
24250
24253
  parentSessionID: toolContext.sessionID,
24251
24254
  parentMessageID: toolContext.messageID
24252
24255
  });
@@ -24565,17 +24568,34 @@ async function executeSync(args, toolContext, ctx) {
24565
24568
  }
24566
24569
  log(`[call_omo_agent] Sending prompt to session ${sessionID}`);
24567
24570
  log(`[call_omo_agent] Prompt text:`, args.prompt.substring(0, 100));
24568
- await ctx.client.session.prompt({
24569
- path: { id: sessionID },
24570
- body: {
24571
- agent: args.subagent_type,
24572
- tools: {
24573
- task: false,
24574
- call_omo_agent: false
24575
- },
24576
- parts: [{ type: "text", text: args.prompt }]
24571
+ try {
24572
+ await ctx.client.session.prompt({
24573
+ path: { id: sessionID },
24574
+ body: {
24575
+ agent: args.subagent_type,
24576
+ tools: {
24577
+ task: false,
24578
+ call_omo_agent: false
24579
+ },
24580
+ parts: [{ type: "text", text: args.prompt }]
24581
+ }
24582
+ });
24583
+ } catch (error45) {
24584
+ const errorMessage = error45 instanceof Error ? error45.message : String(error45);
24585
+ log(`[call_omo_agent] Prompt error:`, errorMessage);
24586
+ if (errorMessage.includes("agent.name") || errorMessage.includes("undefined")) {
24587
+ return `Error: Agent "${args.subagent_type}" not found. Make sure the agent is registered in your opencode.json or provided by a plugin.
24588
+
24589
+ <task_metadata>
24590
+ session_id: ${sessionID}
24591
+ </task_metadata>`;
24577
24592
  }
24578
- });
24593
+ return `Error: Failed to send prompt: ${errorMessage}
24594
+
24595
+ <task_metadata>
24596
+ session_id: ${sessionID}
24597
+ </task_metadata>`;
24598
+ }
24579
24599
  log(`[call_omo_agent] Prompt sent, fetching messages...`);
24580
24600
  const messagesResult = await ctx.client.session.messages({
24581
24601
  path: { id: sessionID }
@@ -24739,6 +24759,9 @@ class BackgroundManager {
24739
24759
  this.directory = ctx.directory;
24740
24760
  }
24741
24761
  async launch(input) {
24762
+ if (!input.agent || input.agent.trim() === "") {
24763
+ throw new Error("Agent parameter is required");
24764
+ }
24742
24765
  const createResult = await this.client.session.create({
24743
24766
  body: {
24744
24767
  parentID: input.parentSessionID,
@@ -24766,7 +24789,7 @@ class BackgroundManager {
24766
24789
  };
24767
24790
  this.tasks.set(task.id, task);
24768
24791
  this.startPolling();
24769
- log("[background-agent] Launching task:", { taskId: task.id, sessionID });
24792
+ log("[background-agent] Launching task:", { taskId: task.id, sessionID, agent: input.agent });
24770
24793
  this.client.session.promptAsync({
24771
24794
  path: { id: sessionID },
24772
24795
  body: {
@@ -24784,8 +24807,15 @@ class BackgroundManager {
24784
24807
  const existingTask = this.findBySession(sessionID);
24785
24808
  if (existingTask) {
24786
24809
  existingTask.status = "error";
24787
- existingTask.error = String(error45);
24810
+ const errorMessage = error45 instanceof Error ? error45.message : String(error45);
24811
+ if (errorMessage.includes("agent.name") || errorMessage.includes("undefined")) {
24812
+ existingTask.error = `Agent "${input.agent}" not found. Make sure the agent is registered in your opencode.json or provided by a plugin.`;
24813
+ } else {
24814
+ existingTask.error = errorMessage;
24815
+ }
24788
24816
  existingTask.completedAt = new Date;
24817
+ this.markForNotification(existingTask);
24818
+ this.notifyParentSession(existingTask);
24789
24819
  }
24790
24820
  });
24791
24821
  return task;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode",
3
- "version": "1.1.6",
3
+ "version": "1.1.7",
4
4
  "description": "OpenCode plugin - custom agents (oracle, librarian) and enhanced features",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",