@dexto/orchestration 1.5.8

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 (50) hide show
  1. package/LICENSE +44 -0
  2. package/dist/agent-controller.cjs +265 -0
  3. package/dist/agent-controller.d.cts +116 -0
  4. package/dist/agent-controller.d.ts +116 -0
  5. package/dist/agent-controller.js +241 -0
  6. package/dist/condition-engine.cjs +276 -0
  7. package/dist/condition-engine.d.cts +87 -0
  8. package/dist/condition-engine.d.ts +87 -0
  9. package/dist/condition-engine.js +252 -0
  10. package/dist/index.cjs +57 -0
  11. package/dist/index.d.cts +11 -0
  12. package/dist/index.d.ts +11 -0
  13. package/dist/index.js +32 -0
  14. package/dist/signal-bus.cjs +186 -0
  15. package/dist/signal-bus.d.cts +78 -0
  16. package/dist/signal-bus.d.ts +78 -0
  17. package/dist/signal-bus.js +162 -0
  18. package/dist/task-registry.cjs +345 -0
  19. package/dist/task-registry.d.cts +124 -0
  20. package/dist/task-registry.d.ts +124 -0
  21. package/dist/task-registry.js +321 -0
  22. package/dist/tools/check-task.cjs +65 -0
  23. package/dist/tools/check-task.d.cts +56 -0
  24. package/dist/tools/check-task.d.ts +56 -0
  25. package/dist/tools/check-task.js +40 -0
  26. package/dist/tools/index.cjs +51 -0
  27. package/dist/tools/index.d.cts +10 -0
  28. package/dist/tools/index.d.ts +10 -0
  29. package/dist/tools/index.js +19 -0
  30. package/dist/tools/list-tasks.cjs +80 -0
  31. package/dist/tools/list-tasks.d.cts +64 -0
  32. package/dist/tools/list-tasks.d.ts +64 -0
  33. package/dist/tools/list-tasks.js +55 -0
  34. package/dist/tools/start-task.cjs +149 -0
  35. package/dist/tools/start-task.d.cts +102 -0
  36. package/dist/tools/start-task.d.ts +102 -0
  37. package/dist/tools/start-task.js +123 -0
  38. package/dist/tools/types.cjs +16 -0
  39. package/dist/tools/types.d.cts +30 -0
  40. package/dist/tools/types.d.ts +30 -0
  41. package/dist/tools/types.js +0 -0
  42. package/dist/tools/wait-for.cjs +116 -0
  43. package/dist/tools/wait-for.d.cts +74 -0
  44. package/dist/tools/wait-for.d.ts +74 -0
  45. package/dist/tools/wait-for.js +91 -0
  46. package/dist/types.cjs +16 -0
  47. package/dist/types.d.cts +165 -0
  48. package/dist/types.d.ts +165 -0
  49. package/dist/types.js +0 -0
  50. package/package.json +38 -0
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var tools_exports = {};
20
+ __export(tools_exports, {
21
+ CheckTaskInputSchema: () => import_check_task2.CheckTaskInputSchema,
22
+ ListTasksInputSchema: () => import_list_tasks2.ListTasksInputSchema,
23
+ StartTaskInputSchema: () => import_start_task2.StartTaskInputSchema,
24
+ WaitForInputSchema: () => import_wait_for2.WaitForInputSchema,
25
+ createCheckTaskTool: () => import_check_task.createCheckTaskTool,
26
+ createGenericTaskStarter: () => import_start_task.createGenericTaskStarter,
27
+ createListTasksTool: () => import_list_tasks.createListTasksTool,
28
+ createStartTaskTool: () => import_start_task.createStartTaskTool,
29
+ createWaitForTool: () => import_wait_for.createWaitForTool
30
+ });
31
+ module.exports = __toCommonJS(tools_exports);
32
+ var import_start_task = require("./start-task.js");
33
+ var import_start_task2 = require("./start-task.js");
34
+ var import_wait_for = require("./wait-for.js");
35
+ var import_wait_for2 = require("./wait-for.js");
36
+ var import_check_task = require("./check-task.js");
37
+ var import_check_task2 = require("./check-task.js");
38
+ var import_list_tasks = require("./list-tasks.js");
39
+ var import_list_tasks2 = require("./list-tasks.js");
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ CheckTaskInputSchema,
43
+ ListTasksInputSchema,
44
+ StartTaskInputSchema,
45
+ WaitForInputSchema,
46
+ createCheckTaskTool,
47
+ createGenericTaskStarter,
48
+ createListTasksTool,
49
+ createStartTaskTool,
50
+ createWaitForTool
51
+ });
@@ -0,0 +1,10 @@
1
+ export { StartTaskInput, StartTaskInputSchema, StartTaskOutput, TaskStarter, createGenericTaskStarter, createStartTaskTool } from './start-task.cjs';
2
+ export { WaitForInput, WaitForInputSchema, WaitForOutput, createWaitForTool } from './wait-for.cjs';
3
+ export { CheckTaskInput, CheckTaskInputSchema, CheckTaskOutput, createCheckTaskTool } from './check-task.cjs';
4
+ export { ListTasksInput, ListTasksInputSchema, ListTasksOutput, TaskListItem, createListTasksTool } from './list-tasks.cjs';
5
+ export { OrchestrationTool, OrchestrationToolContext } from './types.cjs';
6
+ import 'zod';
7
+ import '../types.cjs';
8
+ import '../task-registry.cjs';
9
+ import '../signal-bus.cjs';
10
+ import '../condition-engine.cjs';
@@ -0,0 +1,10 @@
1
+ export { StartTaskInput, StartTaskInputSchema, StartTaskOutput, TaskStarter, createGenericTaskStarter, createStartTaskTool } from './start-task.js';
2
+ export { WaitForInput, WaitForInputSchema, WaitForOutput, createWaitForTool } from './wait-for.js';
3
+ export { CheckTaskInput, CheckTaskInputSchema, CheckTaskOutput, createCheckTaskTool } from './check-task.js';
4
+ export { ListTasksInput, ListTasksInputSchema, ListTasksOutput, TaskListItem, createListTasksTool } from './list-tasks.js';
5
+ export { OrchestrationTool, OrchestrationToolContext } from './types.js';
6
+ import 'zod';
7
+ import '../types.js';
8
+ import '../task-registry.js';
9
+ import '../signal-bus.js';
10
+ import '../condition-engine.js';
@@ -0,0 +1,19 @@
1
+ import { createStartTaskTool, createGenericTaskStarter } from "./start-task.js";
2
+ import { StartTaskInputSchema } from "./start-task.js";
3
+ import { createWaitForTool } from "./wait-for.js";
4
+ import { WaitForInputSchema } from "./wait-for.js";
5
+ import { createCheckTaskTool } from "./check-task.js";
6
+ import { CheckTaskInputSchema } from "./check-task.js";
7
+ import { createListTasksTool } from "./list-tasks.js";
8
+ import { ListTasksInputSchema } from "./list-tasks.js";
9
+ export {
10
+ CheckTaskInputSchema,
11
+ ListTasksInputSchema,
12
+ StartTaskInputSchema,
13
+ WaitForInputSchema,
14
+ createCheckTaskTool,
15
+ createGenericTaskStarter,
16
+ createListTasksTool,
17
+ createStartTaskTool,
18
+ createWaitForTool
19
+ };
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var list_tasks_exports = {};
20
+ __export(list_tasks_exports, {
21
+ ListTasksInputSchema: () => ListTasksInputSchema,
22
+ createListTasksTool: () => createListTasksTool
23
+ });
24
+ module.exports = __toCommonJS(list_tasks_exports);
25
+ var import_zod = require("zod");
26
+ const ListTasksInputSchema = import_zod.z.object({
27
+ /** Filter by status */
28
+ status: import_zod.z.enum(["pending", "running", "completed", "failed", "cancelled", "all"]).optional().default("all").describe("Filter tasks by status"),
29
+ /** Filter by type */
30
+ type: import_zod.z.enum(["agent", "process", "generic"]).optional().describe("Filter tasks by type")
31
+ }).strict();
32
+ function createListTasksTool() {
33
+ return {
34
+ id: "list_tasks",
35
+ description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
36
+ inputSchema: ListTasksInputSchema,
37
+ execute: async (rawInput, context) => {
38
+ const input = ListTasksInputSchema.parse(rawInput);
39
+ const filter = {};
40
+ if (input.status && input.status !== "all") {
41
+ filter.status = input.status;
42
+ }
43
+ if (input.type) {
44
+ filter.type = input.type;
45
+ }
46
+ const tasks = context.taskRegistry.list(filter);
47
+ const allTasks = context.taskRegistry.list();
48
+ const counts = {
49
+ running: 0,
50
+ completed: 0,
51
+ failed: 0,
52
+ cancelled: 0,
53
+ pending: 0
54
+ };
55
+ for (const task of allTasks) {
56
+ counts[task.status]++;
57
+ }
58
+ return {
59
+ tasks: tasks.map((t) => ({
60
+ taskId: t.taskId,
61
+ type: t.type,
62
+ status: t.status,
63
+ startedAt: t.startedAt.toISOString(),
64
+ ...t.description !== void 0 && { description: t.description },
65
+ ...t.completedAt !== void 0 && {
66
+ completedAt: t.completedAt.toISOString()
67
+ },
68
+ ...t.duration !== void 0 && { duration: t.duration }
69
+ })),
70
+ count: tasks.length,
71
+ counts
72
+ };
73
+ }
74
+ };
75
+ }
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ ListTasksInputSchema,
79
+ createListTasksTool
80
+ });
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { TaskStatus } from '../types.cjs';
3
+ import { OrchestrationTool } from './types.cjs';
4
+ import '../task-registry.cjs';
5
+ import '../signal-bus.cjs';
6
+ import '../condition-engine.cjs';
7
+
8
+ /**
9
+ * list_tasks Tool
10
+ *
11
+ * List all tracked background tasks with optional filtering.
12
+ */
13
+
14
+ /**
15
+ * Input schema for list_tasks tool
16
+ */
17
+ declare const ListTasksInputSchema: z.ZodObject<{
18
+ /** Filter by status */
19
+ status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "running", "completed", "failed", "cancelled", "all"]>>>;
20
+ /** Filter by type */
21
+ type: z.ZodOptional<z.ZodEnum<["agent", "process", "generic"]>>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ status: "pending" | "running" | "completed" | "failed" | "cancelled" | "all";
24
+ type?: "agent" | "process" | "generic" | undefined;
25
+ }, {
26
+ type?: "agent" | "process" | "generic" | undefined;
27
+ status?: "pending" | "running" | "completed" | "failed" | "cancelled" | "all" | undefined;
28
+ }>;
29
+ type ListTasksInput = z.output<typeof ListTasksInputSchema>;
30
+ /**
31
+ * Task info in list output
32
+ */
33
+ interface TaskListItem {
34
+ taskId: string;
35
+ type: 'agent' | 'process' | 'generic';
36
+ status: TaskStatus;
37
+ description?: string;
38
+ startedAt: string;
39
+ completedAt?: string;
40
+ duration?: number;
41
+ }
42
+ /**
43
+ * Output from list_tasks tool
44
+ */
45
+ interface ListTasksOutput {
46
+ /** List of tasks matching filter */
47
+ tasks: TaskListItem[];
48
+ /** Total count */
49
+ count: number;
50
+ /** Counts by status */
51
+ counts: {
52
+ running: number;
53
+ completed: number;
54
+ failed: number;
55
+ cancelled: number;
56
+ pending: number;
57
+ };
58
+ }
59
+ /**
60
+ * Create the list_tasks tool
61
+ */
62
+ declare function createListTasksTool(): OrchestrationTool;
63
+
64
+ export { type ListTasksInput, ListTasksInputSchema, type ListTasksOutput, type TaskListItem, createListTasksTool };
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { TaskStatus } from '../types.js';
3
+ import { OrchestrationTool } from './types.js';
4
+ import '../task-registry.js';
5
+ import '../signal-bus.js';
6
+ import '../condition-engine.js';
7
+
8
+ /**
9
+ * list_tasks Tool
10
+ *
11
+ * List all tracked background tasks with optional filtering.
12
+ */
13
+
14
+ /**
15
+ * Input schema for list_tasks tool
16
+ */
17
+ declare const ListTasksInputSchema: z.ZodObject<{
18
+ /** Filter by status */
19
+ status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "running", "completed", "failed", "cancelled", "all"]>>>;
20
+ /** Filter by type */
21
+ type: z.ZodOptional<z.ZodEnum<["agent", "process", "generic"]>>;
22
+ }, "strict", z.ZodTypeAny, {
23
+ status: "pending" | "running" | "completed" | "failed" | "cancelled" | "all";
24
+ type?: "agent" | "process" | "generic" | undefined;
25
+ }, {
26
+ type?: "agent" | "process" | "generic" | undefined;
27
+ status?: "pending" | "running" | "completed" | "failed" | "cancelled" | "all" | undefined;
28
+ }>;
29
+ type ListTasksInput = z.output<typeof ListTasksInputSchema>;
30
+ /**
31
+ * Task info in list output
32
+ */
33
+ interface TaskListItem {
34
+ taskId: string;
35
+ type: 'agent' | 'process' | 'generic';
36
+ status: TaskStatus;
37
+ description?: string;
38
+ startedAt: string;
39
+ completedAt?: string;
40
+ duration?: number;
41
+ }
42
+ /**
43
+ * Output from list_tasks tool
44
+ */
45
+ interface ListTasksOutput {
46
+ /** List of tasks matching filter */
47
+ tasks: TaskListItem[];
48
+ /** Total count */
49
+ count: number;
50
+ /** Counts by status */
51
+ counts: {
52
+ running: number;
53
+ completed: number;
54
+ failed: number;
55
+ cancelled: number;
56
+ pending: number;
57
+ };
58
+ }
59
+ /**
60
+ * Create the list_tasks tool
61
+ */
62
+ declare function createListTasksTool(): OrchestrationTool;
63
+
64
+ export { type ListTasksInput, ListTasksInputSchema, type ListTasksOutput, type TaskListItem, createListTasksTool };
@@ -0,0 +1,55 @@
1
+ import { z } from "zod";
2
+ const ListTasksInputSchema = z.object({
3
+ /** Filter by status */
4
+ status: z.enum(["pending", "running", "completed", "failed", "cancelled", "all"]).optional().default("all").describe("Filter tasks by status"),
5
+ /** Filter by type */
6
+ type: z.enum(["agent", "process", "generic"]).optional().describe("Filter tasks by type")
7
+ }).strict();
8
+ function createListTasksTool() {
9
+ return {
10
+ id: "list_tasks",
11
+ description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
12
+ inputSchema: ListTasksInputSchema,
13
+ execute: async (rawInput, context) => {
14
+ const input = ListTasksInputSchema.parse(rawInput);
15
+ const filter = {};
16
+ if (input.status && input.status !== "all") {
17
+ filter.status = input.status;
18
+ }
19
+ if (input.type) {
20
+ filter.type = input.type;
21
+ }
22
+ const tasks = context.taskRegistry.list(filter);
23
+ const allTasks = context.taskRegistry.list();
24
+ const counts = {
25
+ running: 0,
26
+ completed: 0,
27
+ failed: 0,
28
+ cancelled: 0,
29
+ pending: 0
30
+ };
31
+ for (const task of allTasks) {
32
+ counts[task.status]++;
33
+ }
34
+ return {
35
+ tasks: tasks.map((t) => ({
36
+ taskId: t.taskId,
37
+ type: t.type,
38
+ status: t.status,
39
+ startedAt: t.startedAt.toISOString(),
40
+ ...t.description !== void 0 && { description: t.description },
41
+ ...t.completedAt !== void 0 && {
42
+ completedAt: t.completedAt.toISOString()
43
+ },
44
+ ...t.duration !== void 0 && { duration: t.duration }
45
+ })),
46
+ count: tasks.length,
47
+ counts
48
+ };
49
+ }
50
+ };
51
+ }
52
+ export {
53
+ ListTasksInputSchema,
54
+ createListTasksTool
55
+ };
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var start_task_exports = {};
20
+ __export(start_task_exports, {
21
+ StartTaskInputSchema: () => StartTaskInputSchema,
22
+ createGenericTaskStarter: () => createGenericTaskStarter,
23
+ createStartTaskTool: () => createStartTaskTool
24
+ });
25
+ module.exports = __toCommonJS(start_task_exports);
26
+ var import_zod = require("zod");
27
+ const StartTaskInputSchema = import_zod.z.object({
28
+ /** Task type to start */
29
+ type: import_zod.z.enum(["agent", "process", "generic"]).describe("Type of task to start"),
30
+ // Agent task options
31
+ /** Task description for agent (required for type='agent') */
32
+ task: import_zod.z.string().optional().describe("Task description for agent execution"),
33
+ /** Custom system prompt for agent */
34
+ systemPrompt: import_zod.z.string().optional().describe("Custom system prompt for the agent"),
35
+ // Process task options
36
+ /** Command to run (required for type='process') */
37
+ command: import_zod.z.string().optional().describe("Shell command to execute"),
38
+ // Generic task options
39
+ /** Description for generic task */
40
+ description: import_zod.z.string().optional().describe("Description of the task"),
41
+ // Common options
42
+ /** Timeout in milliseconds */
43
+ timeout: import_zod.z.number().positive().optional().describe("Task timeout in milliseconds"),
44
+ /** Auto-notify when complete (triggers agent turn) */
45
+ notify: import_zod.z.boolean().default(false).describe("Auto-notify when task completes")
46
+ }).strict().superRefine((data, ctx) => {
47
+ if (data.type === "agent" && !data.task) {
48
+ ctx.addIssue({
49
+ code: import_zod.z.ZodIssueCode.custom,
50
+ message: 'task is required when type is "agent"',
51
+ path: ["task"]
52
+ });
53
+ }
54
+ if (data.type === "process" && !data.command) {
55
+ ctx.addIssue({
56
+ code: import_zod.z.ZodIssueCode.custom,
57
+ message: 'command is required when type is "process"',
58
+ path: ["command"]
59
+ });
60
+ }
61
+ });
62
+ function createStartTaskTool(starters) {
63
+ return {
64
+ id: "start_task",
65
+ description: "Start a background task without waiting for completion. Returns immediately with a task ID. Use wait_for or check_task to monitor progress.",
66
+ inputSchema: StartTaskInputSchema,
67
+ execute: async (rawInput, context) => {
68
+ const input = StartTaskInputSchema.parse(rawInput);
69
+ const starter = starters.get(input.type);
70
+ if (!starter) {
71
+ return {
72
+ success: false,
73
+ error: `No task starter registered for type '${input.type}'. Available types: ${Array.from(starters.keys()).join(", ") || "none"}`
74
+ };
75
+ }
76
+ try {
77
+ const { taskId, promise } = await starter.start(input);
78
+ const registerOptions = {
79
+ notify: input.notify,
80
+ ...input.timeout !== void 0 && { timeout: input.timeout }
81
+ };
82
+ if (input.type === "agent") {
83
+ context.taskRegistry.register(
84
+ {
85
+ type: "agent",
86
+ taskId,
87
+ agentId: taskId,
88
+ // Using taskId as agentId for now
89
+ taskDescription: input.task ?? "",
90
+ promise
91
+ },
92
+ registerOptions
93
+ );
94
+ } else if (input.type === "process") {
95
+ context.taskRegistry.register(
96
+ {
97
+ type: "process",
98
+ taskId,
99
+ processId: taskId,
100
+ command: input.command ?? "",
101
+ promise
102
+ },
103
+ registerOptions
104
+ );
105
+ } else {
106
+ context.taskRegistry.register(
107
+ {
108
+ type: "generic",
109
+ taskId,
110
+ description: input.description ?? "Generic task",
111
+ promise
112
+ },
113
+ registerOptions
114
+ );
115
+ }
116
+ return {
117
+ success: true,
118
+ taskId,
119
+ status: "running"
120
+ };
121
+ } catch (error) {
122
+ return {
123
+ success: false,
124
+ error: error instanceof Error ? error.message : String(error)
125
+ };
126
+ }
127
+ }
128
+ };
129
+ }
130
+ function createGenericTaskStarter() {
131
+ let taskCounter = 0;
132
+ return {
133
+ async start(input) {
134
+ const taskId = `generic-${++taskCounter}`;
135
+ const promise = new Promise((resolve) => {
136
+ setTimeout(() => {
137
+ resolve({ completed: true, description: input.description });
138
+ }, 1e3);
139
+ });
140
+ return { taskId, promise };
141
+ }
142
+ };
143
+ }
144
+ // Annotate the CommonJS export names for ESM import in node:
145
+ 0 && (module.exports = {
146
+ StartTaskInputSchema,
147
+ createGenericTaskStarter,
148
+ createStartTaskTool
149
+ });
@@ -0,0 +1,102 @@
1
+ import { z } from 'zod';
2
+ import { OrchestrationTool } from './types.cjs';
3
+ import '../task-registry.cjs';
4
+ import '../types.cjs';
5
+ import '../signal-bus.cjs';
6
+ import '../condition-engine.cjs';
7
+
8
+ /**
9
+ * start_task Tool
10
+ *
11
+ * Starts a background task without blocking.
12
+ * This is a higher-level tool that delegates to task-specific providers.
13
+ */
14
+
15
+ /**
16
+ * Input schema for start_task tool
17
+ */
18
+ declare const StartTaskInputSchema: z.ZodEffects<z.ZodObject<{
19
+ /** Task type to start */
20
+ type: z.ZodEnum<["agent", "process", "generic"]>;
21
+ /** Task description for agent (required for type='agent') */
22
+ task: z.ZodOptional<z.ZodString>;
23
+ /** Custom system prompt for agent */
24
+ systemPrompt: z.ZodOptional<z.ZodString>;
25
+ /** Command to run (required for type='process') */
26
+ command: z.ZodOptional<z.ZodString>;
27
+ /** Description for generic task */
28
+ description: z.ZodOptional<z.ZodString>;
29
+ /** Timeout in milliseconds */
30
+ timeout: z.ZodOptional<z.ZodNumber>;
31
+ /** Auto-notify when complete (triggers agent turn) */
32
+ notify: z.ZodDefault<z.ZodBoolean>;
33
+ }, "strict", z.ZodTypeAny, {
34
+ type: "agent" | "process" | "generic";
35
+ notify: boolean;
36
+ timeout?: number | undefined;
37
+ task?: string | undefined;
38
+ command?: string | undefined;
39
+ description?: string | undefined;
40
+ systemPrompt?: string | undefined;
41
+ }, {
42
+ type: "agent" | "process" | "generic";
43
+ timeout?: number | undefined;
44
+ task?: string | undefined;
45
+ command?: string | undefined;
46
+ description?: string | undefined;
47
+ systemPrompt?: string | undefined;
48
+ notify?: boolean | undefined;
49
+ }>, {
50
+ type: "agent" | "process" | "generic";
51
+ notify: boolean;
52
+ timeout?: number | undefined;
53
+ task?: string | undefined;
54
+ command?: string | undefined;
55
+ description?: string | undefined;
56
+ systemPrompt?: string | undefined;
57
+ }, {
58
+ type: "agent" | "process" | "generic";
59
+ timeout?: number | undefined;
60
+ task?: string | undefined;
61
+ command?: string | undefined;
62
+ description?: string | undefined;
63
+ systemPrompt?: string | undefined;
64
+ notify?: boolean | undefined;
65
+ }>;
66
+ type StartTaskInput = z.infer<typeof StartTaskInputSchema>;
67
+ /**
68
+ * Output from start_task tool
69
+ */
70
+ interface StartTaskOutput {
71
+ /** Whether task was started successfully */
72
+ success: boolean;
73
+ /** Task ID for tracking */
74
+ taskId?: string;
75
+ /** Error message if failed to start */
76
+ error?: string;
77
+ /** Status */
78
+ status?: 'running';
79
+ }
80
+ /**
81
+ * Task starter interface - implemented by agent-spawner, process-tools, etc.
82
+ */
83
+ interface TaskStarter {
84
+ /** Start a task and return the promise */
85
+ start(input: StartTaskInput): Promise<{
86
+ taskId: string;
87
+ promise: Promise<unknown>;
88
+ }>;
89
+ }
90
+ /**
91
+ * Create the start_task tool
92
+ *
93
+ * Note: This tool requires task starters to be registered for each task type.
94
+ * Use `registerTaskStarter` to add support for agent/process/generic tasks.
95
+ */
96
+ declare function createStartTaskTool(starters: Map<string, TaskStarter>): OrchestrationTool;
97
+ /**
98
+ * Create a simple generic task starter for testing
99
+ */
100
+ declare function createGenericTaskStarter(): TaskStarter;
101
+
102
+ export { type StartTaskInput, StartTaskInputSchema, type StartTaskOutput, type TaskStarter, createGenericTaskStarter, createStartTaskTool };