@oxgeneral/orch 1.0.20 → 1.0.22

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.d.ts CHANGED
@@ -852,7 +852,8 @@ declare class TaskService {
852
852
  private readonly eventBus;
853
853
  private readonly config;
854
854
  private readonly paths?;
855
- constructor(taskStore: ITaskStore, eventBus: EventBus, config: OrchestratorConfig, paths?: Paths | undefined);
855
+ private readonly agentStore?;
856
+ constructor(taskStore: ITaskStore, eventBus: EventBus, config: OrchestratorConfig, paths?: Paths | undefined, agentStore?: IAgentStore | undefined);
856
857
  create(input: CreateTaskInput): Promise<Task>;
857
858
  list(filter?: {
858
859
  status?: TaskStatus;
@@ -875,6 +876,13 @@ declare class TaskService {
875
876
  getAttachmentPath(taskId: string, filename: string): string;
876
877
  private copyAttachments;
877
878
  incrementAttempts(id: string): Promise<Task>;
879
+ /**
880
+ * Resolve an assignee value to an agent ID.
881
+ * Accepts: agent ID (agt_xxx), agent name, or undefined.
882
+ * Returns the agent ID if found, or undefined if input is undefined.
883
+ * Throws InvalidArgumentsError if non-empty value matches no agent.
884
+ */
885
+ private resolveAssignee;
878
886
  }
879
887
 
880
888
  /**
@@ -1221,6 +1229,13 @@ declare class Orchestrator {
1221
1229
  private taskCreatedUnsub;
1222
1230
  private tickInProgress;
1223
1231
  private stoppedResolvers;
1232
+ /**
1233
+ * Track taskIds with an active collectEvents() background promise.
1234
+ * Reconcile skips PID-liveness and stall checks for these tasks because
1235
+ * the process may have exited cleanly but handleRunSuccess hasn't acquired
1236
+ * the mutex yet — false-positive "crash" / "stall" detection.
1237
+ */
1238
+ private readonly activeCollectors;
1224
1239
  /** When true, `tick()` skips `seedAutonomousTasks()`. Set via `startWatch()` options. */
1225
1240
  private skipAutonomousSeeding;
1226
1241
  /** Cooldown: track last auto-seed time per agent to prevent re-seed spam. */
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Paths } from './chunk-6JQDY3PP.js';
2
- import { canTransition, isTerminal } from './chunk-WM64PSY4.js';
3
- export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus } from './chunk-WM64PSY4.js';
2
+ import { canTransition, isTerminal } from './chunk-FGQJYB6G.js';
3
+ export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus } from './chunk-FGQJYB6G.js';
4
4
  import { AUTONOMOUS_LABEL } from './chunk-XUZZJCKG.js';
5
5
  export { AdapterRegistry } from './chunk-6DWHQPTE.js';
6
6
  export { SkillLoader } from './chunk-U2JVMD2G.js';
@@ -667,11 +667,12 @@ function templateToAgentInput(template, adapter) {
667
667
  };
668
668
  }
669
669
  var TaskService = class {
670
- constructor(taskStore, eventBus, config, paths) {
670
+ constructor(taskStore, eventBus, config, paths, agentStore) {
671
671
  this.taskStore = taskStore;
672
672
  this.eventBus = eventBus;
673
673
  this.config = config;
674
674
  this.paths = paths;
675
+ this.agentStore = agentStore;
675
676
  }
676
677
  async create(input) {
677
678
  if (!input.title.trim()) {
@@ -692,6 +693,7 @@ var TaskService = class {
692
693
  );
693
694
  }
694
695
  }
696
+ const assignee = await this.resolveAssignee(input.assignee);
695
697
  const now = (/* @__PURE__ */ new Date()).toISOString();
696
698
  const task = {
697
699
  id: `tsk_${nanoid(7)}`,
@@ -699,7 +701,7 @@ var TaskService = class {
699
701
  description: input.description?.trim() ?? "",
700
702
  status: "todo",
701
703
  priority,
702
- assignee: input.assignee,
704
+ assignee,
703
705
  labels: input.labels ?? [],
704
706
  depends_on: input.depends_on ?? [],
705
707
  created_at: now,
@@ -746,7 +748,7 @@ var TaskService = class {
746
748
  }
747
749
  async assign(taskId, agentId) {
748
750
  const task = await this.get(taskId);
749
- task.assignee = agentId;
751
+ task.assignee = await this.resolveAssignee(agentId);
750
752
  task.updated_at = (/* @__PURE__ */ new Date()).toISOString();
751
753
  await this.taskStore.save(task);
752
754
  this.eventBus.emit({
@@ -868,6 +870,28 @@ var TaskService = class {
868
870
  await this.taskStore.save(task);
869
871
  return task;
870
872
  }
873
+ /**
874
+ * Resolve an assignee value to an agent ID.
875
+ * Accepts: agent ID (agt_xxx), agent name, or undefined.
876
+ * Returns the agent ID if found, or undefined if input is undefined.
877
+ * Throws InvalidArgumentsError if non-empty value matches no agent.
878
+ */
879
+ async resolveAssignee(assignee) {
880
+ if (!assignee) return void 0;
881
+ if (!this.agentStore) return assignee;
882
+ if (assignee.startsWith("agt_")) {
883
+ const agent = await this.agentStore.get(assignee);
884
+ if (agent) return agent.id;
885
+ throw new InvalidArgumentsError(
886
+ `Unknown agent ID: "${assignee}". No agent with this ID exists.`
887
+ );
888
+ }
889
+ const byName = await this.agentStore.getByName(assignee);
890
+ if (byName) return byName.id;
891
+ throw new InvalidArgumentsError(
892
+ `Unknown agent: "${assignee}". Use an agent ID (agt_xxx) or an exact agent name.`
893
+ );
894
+ }
871
895
  };
872
896
  var AgentService = class {
873
897
  constructor(agentStore, stateStore, eventBus, config) {
@@ -993,7 +1017,7 @@ var AgentService = class {
993
1017
  );
994
1018
  if (available.length === 0) return null;
995
1019
  if (task.assignee) {
996
- const assigned = agents.find((a) => a.id === task.assignee);
1020
+ const assigned = agents.find((a) => a.id === task.assignee || a.name === task.assignee);
997
1021
  if (assigned && assigned.status === "idle") return assigned;
998
1022
  return null;
999
1023
  }
@@ -2472,7 +2496,7 @@ async function buildLightContainer(context) {
2472
2496
  const goalStore = new GoalStore(paths);
2473
2497
  const teamStore = new TeamStore(paths);
2474
2498
  const eventBus = new EventBus();
2475
- const taskService = new TaskService(taskStore, eventBus, config, paths);
2499
+ const taskService = new TaskService(taskStore, eventBus, config, paths, agentStore);
2476
2500
  const agentService = new AgentService(agentStore, stateStore, eventBus, config);
2477
2501
  const runService = new RunService(runStore, eventBus);
2478
2502
  const messageService = new MessageService(messageStore, agentStore, teamStore, eventBus);
@@ -2530,7 +2554,7 @@ async function buildFullContainer(context) {
2530
2554
  import('./workspace-manager-QH27FF55.js'),
2531
2555
  import('./template-engine-XOH3FZPU.js'),
2532
2556
  import('./skill-loader-RHCFIK74.js'),
2533
- import('./orchestrator-53KIAROT.js'),
2557
+ import('./orchestrator-KV3VVGZR.js'),
2534
2558
  import('./doctor-service-F2SXDWHS.js')
2535
2559
  ]);
2536
2560
  const processManager = new ProcessManager();