@dexto/orchestration 1.5.8 → 1.6.0

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 (46) hide show
  1. package/dist/condition-engine.d.ts +6 -8
  2. package/dist/condition-engine.d.ts.map +1 -0
  3. package/dist/index.cjs +0 -9
  4. package/dist/index.d.cts +1 -3
  5. package/dist/index.d.ts +41 -10
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +2 -18
  8. package/dist/signal-bus.d.ts +5 -8
  9. package/dist/signal-bus.d.ts.map +1 -0
  10. package/dist/task-registry.d.ts +5 -8
  11. package/dist/task-registry.d.ts.map +1 -0
  12. package/dist/tools/check-task.cjs +4 -4
  13. package/dist/tools/check-task.d.cts +3 -4
  14. package/dist/tools/check-task.d.ts +8 -14
  15. package/dist/tools/check-task.d.ts.map +1 -0
  16. package/dist/tools/check-task.js +4 -4
  17. package/dist/tools/index.cjs +0 -8
  18. package/dist/tools/index.d.cts +4 -5
  19. package/dist/tools/index.d.ts +15 -10
  20. package/dist/tools/index.d.ts.map +1 -0
  21. package/dist/tools/index.js +0 -5
  22. package/dist/tools/list-tasks.cjs +5 -5
  23. package/dist/tools/list-tasks.d.cts +3 -4
  24. package/dist/tools/list-tasks.d.ts +10 -15
  25. package/dist/tools/list-tasks.d.ts.map +1 -0
  26. package/dist/tools/list-tasks.js +5 -5
  27. package/dist/tools/wait-for.cjs +4 -4
  28. package/dist/tools/wait-for.d.cts +5 -5
  29. package/dist/tools/wait-for.d.ts +8 -14
  30. package/dist/tools/wait-for.d.ts.map +1 -0
  31. package/dist/tools/wait-for.js +4 -4
  32. package/dist/types.d.ts +14 -15
  33. package/dist/types.d.ts.map +1 -0
  34. package/package.json +3 -2
  35. package/dist/agent-controller.cjs +0 -265
  36. package/dist/agent-controller.d.cts +0 -116
  37. package/dist/agent-controller.d.ts +0 -116
  38. package/dist/agent-controller.js +0 -241
  39. package/dist/tools/start-task.cjs +0 -149
  40. package/dist/tools/start-task.d.cts +0 -102
  41. package/dist/tools/start-task.d.ts +0 -102
  42. package/dist/tools/start-task.js +0 -123
  43. package/dist/tools/types.cjs +0 -16
  44. package/dist/tools/types.d.cts +0 -30
  45. package/dist/tools/types.d.ts +0 -30
  46. package/dist/tools/types.js +0 -0
@@ -1,102 +0,0 @@
1
- import { z } from 'zod';
2
- import { OrchestrationTool } from './types.js';
3
- import '../task-registry.js';
4
- import '../types.js';
5
- import '../signal-bus.js';
6
- import '../condition-engine.js';
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 };
@@ -1,123 +0,0 @@
1
- import { z } from "zod";
2
- const StartTaskInputSchema = z.object({
3
- /** Task type to start */
4
- type: z.enum(["agent", "process", "generic"]).describe("Type of task to start"),
5
- // Agent task options
6
- /** Task description for agent (required for type='agent') */
7
- task: z.string().optional().describe("Task description for agent execution"),
8
- /** Custom system prompt for agent */
9
- systemPrompt: z.string().optional().describe("Custom system prompt for the agent"),
10
- // Process task options
11
- /** Command to run (required for type='process') */
12
- command: z.string().optional().describe("Shell command to execute"),
13
- // Generic task options
14
- /** Description for generic task */
15
- description: z.string().optional().describe("Description of the task"),
16
- // Common options
17
- /** Timeout in milliseconds */
18
- timeout: z.number().positive().optional().describe("Task timeout in milliseconds"),
19
- /** Auto-notify when complete (triggers agent turn) */
20
- notify: z.boolean().default(false).describe("Auto-notify when task completes")
21
- }).strict().superRefine((data, ctx) => {
22
- if (data.type === "agent" && !data.task) {
23
- ctx.addIssue({
24
- code: z.ZodIssueCode.custom,
25
- message: 'task is required when type is "agent"',
26
- path: ["task"]
27
- });
28
- }
29
- if (data.type === "process" && !data.command) {
30
- ctx.addIssue({
31
- code: z.ZodIssueCode.custom,
32
- message: 'command is required when type is "process"',
33
- path: ["command"]
34
- });
35
- }
36
- });
37
- function createStartTaskTool(starters) {
38
- return {
39
- id: "start_task",
40
- description: "Start a background task without waiting for completion. Returns immediately with a task ID. Use wait_for or check_task to monitor progress.",
41
- inputSchema: StartTaskInputSchema,
42
- execute: async (rawInput, context) => {
43
- const input = StartTaskInputSchema.parse(rawInput);
44
- const starter = starters.get(input.type);
45
- if (!starter) {
46
- return {
47
- success: false,
48
- error: `No task starter registered for type '${input.type}'. Available types: ${Array.from(starters.keys()).join(", ") || "none"}`
49
- };
50
- }
51
- try {
52
- const { taskId, promise } = await starter.start(input);
53
- const registerOptions = {
54
- notify: input.notify,
55
- ...input.timeout !== void 0 && { timeout: input.timeout }
56
- };
57
- if (input.type === "agent") {
58
- context.taskRegistry.register(
59
- {
60
- type: "agent",
61
- taskId,
62
- agentId: taskId,
63
- // Using taskId as agentId for now
64
- taskDescription: input.task ?? "",
65
- promise
66
- },
67
- registerOptions
68
- );
69
- } else if (input.type === "process") {
70
- context.taskRegistry.register(
71
- {
72
- type: "process",
73
- taskId,
74
- processId: taskId,
75
- command: input.command ?? "",
76
- promise
77
- },
78
- registerOptions
79
- );
80
- } else {
81
- context.taskRegistry.register(
82
- {
83
- type: "generic",
84
- taskId,
85
- description: input.description ?? "Generic task",
86
- promise
87
- },
88
- registerOptions
89
- );
90
- }
91
- return {
92
- success: true,
93
- taskId,
94
- status: "running"
95
- };
96
- } catch (error) {
97
- return {
98
- success: false,
99
- error: error instanceof Error ? error.message : String(error)
100
- };
101
- }
102
- }
103
- };
104
- }
105
- function createGenericTaskStarter() {
106
- let taskCounter = 0;
107
- return {
108
- async start(input) {
109
- const taskId = `generic-${++taskCounter}`;
110
- const promise = new Promise((resolve) => {
111
- setTimeout(() => {
112
- resolve({ completed: true, description: input.description });
113
- }, 1e3);
114
- });
115
- return { taskId, promise };
116
- }
117
- };
118
- }
119
- export {
120
- StartTaskInputSchema,
121
- createGenericTaskStarter,
122
- createStartTaskTool
123
- };
@@ -1,16 +0,0 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
- var types_exports = {};
16
- module.exports = __toCommonJS(types_exports);
@@ -1,30 +0,0 @@
1
- import { TaskRegistry } from '../task-registry.cjs';
2
- import { ConditionEngine } from '../condition-engine.cjs';
3
- import { SignalBus } from '../signal-bus.cjs';
4
- import '../types.cjs';
5
-
6
- /**
7
- * Tool Types
8
- *
9
- * Shared types for orchestration tools.
10
- */
11
-
12
- /**
13
- * Context provided to orchestration tools
14
- */
15
- interface OrchestrationToolContext {
16
- taskRegistry: TaskRegistry;
17
- conditionEngine: ConditionEngine;
18
- signalBus: SignalBus;
19
- }
20
- /**
21
- * Base tool interface matching @dexto/core InternalTool
22
- */
23
- interface OrchestrationTool {
24
- id: string;
25
- description: string;
26
- inputSchema: unknown;
27
- execute: (input: unknown, context: OrchestrationToolContext) => Promise<unknown>;
28
- }
29
-
30
- export type { OrchestrationTool, OrchestrationToolContext };
@@ -1,30 +0,0 @@
1
- import { TaskRegistry } from '../task-registry.js';
2
- import { ConditionEngine } from '../condition-engine.js';
3
- import { SignalBus } from '../signal-bus.js';
4
- import '../types.js';
5
-
6
- /**
7
- * Tool Types
8
- *
9
- * Shared types for orchestration tools.
10
- */
11
-
12
- /**
13
- * Context provided to orchestration tools
14
- */
15
- interface OrchestrationToolContext {
16
- taskRegistry: TaskRegistry;
17
- conditionEngine: ConditionEngine;
18
- signalBus: SignalBus;
19
- }
20
- /**
21
- * Base tool interface matching @dexto/core InternalTool
22
- */
23
- interface OrchestrationTool {
24
- id: string;
25
- description: string;
26
- inputSchema: unknown;
27
- execute: (input: unknown, context: OrchestrationToolContext) => Promise<unknown>;
28
- }
29
-
30
- export type { OrchestrationTool, OrchestrationToolContext };
File without changes