@hdwebsoft/hdcode-agent-team 0.1.1 → 0.1.2

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 +19 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -314,16 +314,19 @@ function createTeamTools(directory) {
314
314
  import { join as join5 } from "node:path";
315
315
  import { tool as tool2 } from "@opencode-ai/plugin";
316
316
  function parseStringArray(raw, label) {
317
+ if (!raw.trimStart().startsWith("[")) {
318
+ return raw.split(",").map((s) => s.trim()).filter(Boolean);
319
+ }
317
320
  let parsed;
318
321
  try {
319
322
  parsed = JSON.parse(raw);
320
323
  } catch {
321
- return `Error: Invalid ${label} JSON`;
324
+ return `Error: Invalid ${label} — use comma-separated IDs (e.g. "1,2") or JSON array (e.g. ["1","2"])`;
322
325
  }
323
- if (!Array.isArray(parsed) || !parsed.every((v) => typeof v === "string")) {
324
- return `Error: ${label} must be a JSON array of strings, e.g. ["1","2"]`;
326
+ if (!Array.isArray(parsed) || !parsed.every((v) => typeof v === "string" || typeof v === "number")) {
327
+ return `Error: ${label} must be comma-separated IDs (e.g. "1,2") or a JSON array (e.g. ["1","2"])`;
325
328
  }
326
- return parsed;
329
+ return parsed.map((v) => String(v));
327
330
  }
328
331
  function createTaskTools(directory) {
329
332
  return {
@@ -415,7 +418,7 @@ function createTaskTools(directory) {
415
418
  }
416
419
  }),
417
420
  task_update: tool2({
418
- description: "Update task fields, manage dependencies, auto-unblock. Status transitions: pending→in_progress, pending→completed, in_progress→completed. On completion: auto-unblocks dependents. Returns {task, unblocked[]}.",
421
+ description: "Update task fields, manage dependencies, auto-unblock. Status transitions: pending→in_progress, in_progress→completed. On completion: auto-unblocks dependents. Returns {task, unblocked[]}.",
419
422
  args: {
420
423
  teamName: tool2.schema.string().describe("Team name"),
421
424
  taskId: tool2.schema.string().describe("Task ID (integer string)"),
@@ -443,7 +446,7 @@ function createTaskTools(directory) {
443
446
  const task = await readJson(tPath);
444
447
  if (args.status) {
445
448
  const validTransitions = {
446
- pending: ["in_progress", "completed"],
449
+ pending: ["in_progress"],
447
450
  in_progress: ["completed"],
448
451
  completed: []
449
452
  };
@@ -600,8 +603,8 @@ function createMessageTools(directory) {
600
603
  timestamp: new Date().toISOString(),
601
604
  read: false
602
605
  };
606
+ const config = await readJson(configPath);
603
607
  if (args.type === "broadcast") {
604
- const config = await readJson(configPath);
605
608
  const recipients = [];
606
609
  return withLock(inboxesLockPath, async () => {
607
610
  for (const member of config.members) {
@@ -617,10 +620,15 @@ function createMessageTools(directory) {
617
620
  if (!args.recipient) {
618
621
  return "Error: recipient is required for non-broadcast messages";
619
622
  }
623
+ const recipientName = args.recipient.includes("@") ? args.recipient.split("@")[0] : args.recipient;
624
+ const member = config.members.find((m) => m.name === recipientName || m.agentId === args.recipient);
625
+ if (!member) {
626
+ return `Error: Recipient "${args.recipient}" not found in team "${args.teamName}"`;
627
+ }
620
628
  return withLock(inboxesLockPath, async () => {
621
- const inboxPath = join6(inboxesDir, `${args.recipient}.json`);
629
+ const inboxPath = join6(inboxesDir, `${member.name}.json`);
622
630
  await appendToInbox(inboxPath, message);
623
- return JSON.stringify({ sent: true, recipients: [args.recipient] }, null, 2);
631
+ return JSON.stringify({ sent: true, recipients: [member.name] }, null, 2);
624
632
  });
625
633
  }
626
634
  }
@@ -638,7 +646,8 @@ function createMessageTools(directory) {
638
646
  if (!await exists(join6(dir, "config.json"))) {
639
647
  return `Error: Team "${args.teamName}" not found`;
640
648
  }
641
- const inboxPath = join6(dir, "inboxes", `${args.agent}.json`);
649
+ const agentName = args.agent.includes("@") ? args.agent.split("@")[0] : args.agent;
650
+ const inboxPath = join6(dir, "inboxes", `${agentName}.json`);
642
651
  let messages = await readInbox(inboxPath);
643
652
  if (args.since) {
644
653
  const sinceDate = new Date(args.since);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hdwebsoft/hdcode-agent-team",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "OpenCode plugin for multi-agent team coordination — per-agent inboxes, task management with dependency tracking, and file locking.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",