@oxgeneral/orch 1.0.19 → 1.0.21
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/{App-Q7J4JGDF.js → App-63TC4QG3.js} +1 -1
- package/dist/{chunk-WM64PSY4.js → chunk-FGQJYB6G.js} +18 -2
- package/dist/chunk-FGQJYB6G.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/container-PKAEIRCI.js +4 -0
- package/dist/index.d.ts +20 -5
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/orchestrator-AVJ23Q5T.js +17 -0
- package/dist/orchestrator-KV3VVGZR.js +6 -0
- package/dist/{orchestrator-53KIAROT.js.map → orchestrator-KV3VVGZR.js.map} +1 -1
- package/dist/{task-IVKKK22G.js → task-M2FY3SU7.js} +5 -5
- package/dist/tui-DCZOKDPG.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-WM64PSY4.js.map +0 -1
- package/dist/container-4VRJ7G6U.js +0 -4
- package/dist/orchestrator-53KIAROT.js +0 -6
- package/dist/orchestrator-Z6C5OE4A.js +0 -17
- package/dist/tui-IWCCSBDD.js +0 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Paths } from './chunk-6JQDY3PP.js';
|
|
2
|
-
import { canTransition, isTerminal } from './chunk-
|
|
3
|
-
export { Orchestrator, canTransition, isBlocked, isDispatchable, isTerminal, resolveFailureStatus } from './chunk-
|
|
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
|
|
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
|
}
|
|
@@ -2160,7 +2184,7 @@ var MessageService = class {
|
|
|
2160
2184
|
};
|
|
2161
2185
|
var VALID_TRANSITIONS = {
|
|
2162
2186
|
active: ["paused", "achieved", "abandoned"],
|
|
2163
|
-
paused: ["active", "abandoned"],
|
|
2187
|
+
paused: ["active", "achieved", "abandoned"],
|
|
2164
2188
|
achieved: [],
|
|
2165
2189
|
abandoned: []
|
|
2166
2190
|
};
|
|
@@ -2211,7 +2235,9 @@ var GoalService = class {
|
|
|
2211
2235
|
}
|
|
2212
2236
|
if (newStatus === "achieved" && this.taskService) {
|
|
2213
2237
|
const childTasks = await this.taskService.list({ goalId: id });
|
|
2214
|
-
const pending = childTasks.filter(
|
|
2238
|
+
const pending = childTasks.filter(
|
|
2239
|
+
(t) => !isTerminal(t.status) && !t.labels?.includes(AUTONOMOUS_LABEL)
|
|
2240
|
+
);
|
|
2215
2241
|
if (pending.length > 0) {
|
|
2216
2242
|
if (opts?.force) {
|
|
2217
2243
|
const cancellable = pending.filter((t) => t.status !== "in_progress");
|
|
@@ -2470,7 +2496,7 @@ async function buildLightContainer(context) {
|
|
|
2470
2496
|
const goalStore = new GoalStore(paths);
|
|
2471
2497
|
const teamStore = new TeamStore(paths);
|
|
2472
2498
|
const eventBus = new EventBus();
|
|
2473
|
-
const taskService = new TaskService(taskStore, eventBus, config, paths);
|
|
2499
|
+
const taskService = new TaskService(taskStore, eventBus, config, paths, agentStore);
|
|
2474
2500
|
const agentService = new AgentService(agentStore, stateStore, eventBus, config);
|
|
2475
2501
|
const runService = new RunService(runStore, eventBus);
|
|
2476
2502
|
const messageService = new MessageService(messageStore, agentStore, teamStore, eventBus);
|
|
@@ -2528,7 +2554,7 @@ async function buildFullContainer(context) {
|
|
|
2528
2554
|
import('./workspace-manager-QH27FF55.js'),
|
|
2529
2555
|
import('./template-engine-XOH3FZPU.js'),
|
|
2530
2556
|
import('./skill-loader-RHCFIK74.js'),
|
|
2531
|
-
import('./orchestrator-
|
|
2557
|
+
import('./orchestrator-KV3VVGZR.js'),
|
|
2532
2558
|
import('./doctor-service-F2SXDWHS.js')
|
|
2533
2559
|
]);
|
|
2534
2560
|
const processManager = new ProcessManager();
|