@dexto/orchestration 1.5.8 → 1.6.1

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/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 +615 -11
  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 +10 -4
  13. package/dist/tools/check-task.d.ts +8 -14
  14. package/dist/tools/check-task.d.ts.map +1 -0
  15. package/dist/tools/check-task.js +10 -4
  16. package/dist/tools/index.cjs +0 -8
  17. package/dist/tools/index.d.ts +15 -10
  18. package/dist/tools/index.d.ts.map +1 -0
  19. package/dist/tools/index.js +0 -5
  20. package/dist/tools/list-tasks.cjs +17 -5
  21. package/dist/tools/list-tasks.d.ts +10 -15
  22. package/dist/tools/list-tasks.d.ts.map +1 -0
  23. package/dist/tools/list-tasks.js +17 -5
  24. package/dist/tools/wait-for.cjs +13 -4
  25. package/dist/tools/wait-for.d.ts +8 -14
  26. package/dist/tools/wait-for.d.ts.map +1 -0
  27. package/dist/tools/wait-for.js +13 -4
  28. package/dist/types.d.ts +14 -15
  29. package/dist/types.d.ts.map +1 -0
  30. package/package.json +4 -3
  31. package/dist/agent-controller.cjs +0 -265
  32. package/dist/agent-controller.d.cts +0 -116
  33. package/dist/agent-controller.d.ts +0 -116
  34. package/dist/agent-controller.js +0 -241
  35. package/dist/condition-engine.d.cts +0 -87
  36. package/dist/signal-bus.d.cts +0 -78
  37. package/dist/task-registry.d.cts +0 -124
  38. package/dist/tools/check-task.d.cts +0 -56
  39. package/dist/tools/index.d.cts +0 -10
  40. package/dist/tools/list-tasks.d.cts +0 -64
  41. package/dist/tools/start-task.cjs +0 -149
  42. package/dist/tools/start-task.d.cts +0 -102
  43. package/dist/tools/start-task.d.ts +0 -102
  44. package/dist/tools/start-task.js +0 -123
  45. package/dist/tools/types.cjs +0 -16
  46. package/dist/tools/types.d.cts +0 -30
  47. package/dist/tools/types.d.ts +0 -30
  48. package/dist/tools/types.js +0 -0
  49. package/dist/tools/wait-for.d.cts +0 -74
  50. package/dist/types.d.cts +0 -165
package/dist/index.d.ts CHANGED
@@ -1,11 +1,42 @@
1
- export { AgentController, AgentControllerConfig } from './agent-controller.js';
2
- export { SignalBus, SignalHandler, SignalPredicate } from './signal-bus.js';
3
- export { TaskRegistry, TaskRegistryConfig } from './task-registry.js';
1
+ /**
2
+ * @dexto/orchestration
3
+ *
4
+ * Agent orchestration layer for background task management,
5
+ * event-driven completion handling, and async workflows.
6
+ *
7
+ * Key components:
8
+ * - TaskRegistry: Tracks background tasks and their results
9
+ * - SignalBus: Routes completion signals between components
10
+ * - ConditionEngine: Evaluates composable wait conditions
11
+ *
12
+ * Example usage:
13
+ * ```typescript
14
+ * import { ConditionEngine, SignalBus, TaskRegistry } from '@dexto/orchestration';
15
+ *
16
+ * const signalBus = new SignalBus();
17
+ * const taskRegistry = new TaskRegistry(signalBus);
18
+ * const conditionEngine = new ConditionEngine(taskRegistry, signalBus);
19
+ *
20
+ * // Start a background task
21
+ * taskRegistry.register({
22
+ * type: 'generic',
23
+ * taskId: 'my-task',
24
+ * description: 'My task',
25
+ * promise: someAsyncOperation(),
26
+ * });
27
+ *
28
+ * // Wait for completion
29
+ * const { signal } = await conditionEngine.wait({
30
+ * type: 'task',
31
+ * taskId: 'my-task',
32
+ * });
33
+ * ```
34
+ */
35
+ export { SignalBus, type SignalHandler, type SignalPredicate } from './signal-bus.js';
36
+ export { TaskRegistry, type TaskRegistryConfig } from './task-registry.js';
4
37
  export { ConditionEngine } from './condition-engine.js';
5
- export { AgentState, ProcessResult, RegisterTaskOptions, Signal, SignalType, Task, TaskEntry, TaskFilter, TaskInfo, TaskResult, TaskStatus, WaitCondition, WaitResult } from './types.js';
6
- export { StartTaskInput, StartTaskInputSchema, StartTaskOutput, TaskStarter, createGenericTaskStarter, createStartTaskTool } from './tools/start-task.js';
7
- export { WaitForInput, WaitForInputSchema, WaitForOutput, createWaitForTool } from './tools/wait-for.js';
8
- export { CheckTaskInput, CheckTaskInputSchema, CheckTaskOutput, createCheckTaskTool } from './tools/check-task.js';
9
- export { ListTasksInput, ListTasksInputSchema, ListTasksOutput, TaskListItem, createListTasksTool } from './tools/list-tasks.js';
10
- export { OrchestrationTool, OrchestrationToolContext } from './tools/types.js';
11
- import 'zod';
38
+ export type { Task, TaskStatus, TaskEntry, TaskResult, ProcessResult, Signal, SignalType, WaitCondition, WaitResult, AgentState, TaskInfo, TaskFilter, RegisterTaskOptions, } from './types.js';
39
+ export { createWaitForTool, createCheckTaskTool, createListTasksTool } from './tools/index.js';
40
+ export type { WaitForInput, WaitForOutput, CheckTaskInput, CheckTaskOutput, ListTasksInput, ListTasksOutput, TaskListItem, } from './tools/index.js';
41
+ export { WaitForInputSchema, CheckTaskInputSchema, ListTasksInputSchema } from './tools/index.js';
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,EAAE,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,YAAY,EACR,IAAI,EACJ,UAAU,EACV,SAAS,EACT,UAAU,EACV,aAAa,EACb,MAAM,EACN,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,GACtB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE/F,YAAY,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,32 +1,16 @@
1
- import { AgentController } from "./agent-controller.js";
2
1
  import { SignalBus } from "./signal-bus.js";
3
2
  import { TaskRegistry } from "./task-registry.js";
4
3
  import { ConditionEngine } from "./condition-engine.js";
5
- import {
6
- createStartTaskTool,
7
- createWaitForTool,
8
- createCheckTaskTool,
9
- createListTasksTool,
10
- createGenericTaskStarter
11
- } from "./tools/index.js";
12
- import {
13
- StartTaskInputSchema,
14
- WaitForInputSchema,
15
- CheckTaskInputSchema,
16
- ListTasksInputSchema
17
- } from "./tools/index.js";
4
+ import { createWaitForTool, createCheckTaskTool, createListTasksTool } from "./tools/index.js";
5
+ import { WaitForInputSchema, CheckTaskInputSchema, ListTasksInputSchema } from "./tools/index.js";
18
6
  export {
19
- AgentController,
20
7
  CheckTaskInputSchema,
21
8
  ConditionEngine,
22
9
  ListTasksInputSchema,
23
10
  SignalBus,
24
- StartTaskInputSchema,
25
11
  TaskRegistry,
26
12
  WaitForInputSchema,
27
13
  createCheckTaskTool,
28
- createGenericTaskStarter,
29
14
  createListTasksTool,
30
- createStartTaskTool,
31
15
  createWaitForTool
32
16
  };
@@ -1,24 +1,22 @@
1
- import { Signal, SignalType } from './types.js';
2
-
3
1
  /**
4
2
  * SignalBus
5
3
  *
6
4
  * Event emitter for routing orchestration signals.
7
5
  * Supports typed subscriptions and promise-based waiting.
8
6
  */
9
-
7
+ import type { Signal, SignalType } from './types.js';
10
8
  /**
11
9
  * Handler function for signal subscriptions
12
10
  */
13
- type SignalHandler<T extends Signal = Signal> = (signal: T) => void;
11
+ export type SignalHandler<T extends Signal = Signal> = (signal: T) => void;
14
12
  /**
15
13
  * Predicate function for filtering signals
16
14
  */
17
- type SignalPredicate = (signal: Signal) => boolean;
15
+ export type SignalPredicate = (signal: Signal) => boolean;
18
16
  /**
19
17
  * SignalBus - Routes signals between orchestration components
20
18
  */
21
- declare class SignalBus {
19
+ export declare class SignalBus {
22
20
  private emitter;
23
21
  constructor();
24
22
  /**
@@ -74,5 +72,4 @@ declare class SignalBus {
74
72
  */
75
73
  clear(): void;
76
74
  }
77
-
78
- export { SignalBus, type SignalHandler, type SignalPredicate };
75
+ //# sourceMappingURL=signal-bus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal-bus.d.ts","sourceRoot":"","sources":["../src/signal-bus.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD;;GAEG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAE3E;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;AAE1D;;GAEG;AACH,qBAAa,SAAS;IAClB,OAAO,CAAC,OAAO,CAAsB;;IAOrC;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAO1B;;;OAGG;IACH,EAAE,CAAC,CAAC,SAAS,UAAU,EACnB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,GACrD,MAAM,IAAI;IAKb;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,IAAI;IAKzC;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,UAAU,EACrB,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,GACrD,IAAI;IAIP;;OAEG;IACH,GAAG,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,CAAC,CAAA;KAAE,CAAC,CAAC,GAAG,IAAI;IAI9F;;;;;OAKG;IACH,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgCtE;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9D;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAepE;;;OAGG;IACG,eAAe,CACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,CAAC,EAAE,MAAM,EAChB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GACxD,OAAO,CAAC,MAAM,EAAE,CAAC;IAmEpB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGhB"}
@@ -1,17 +1,15 @@
1
- import { Task, RegisterTaskOptions, TaskEntry, TaskStatus, TaskInfo, TaskFilter } from './types.js';
2
- import { SignalBus } from './signal-bus.js';
3
-
4
1
  /**
5
2
  * TaskRegistry
6
3
  *
7
4
  * Tracks all background tasks and their results.
8
5
  * Emits signals on task completion for the ConditionEngine.
9
6
  */
10
-
7
+ import type { Task, TaskEntry, TaskStatus, TaskInfo, TaskFilter, RegisterTaskOptions } from './types.js';
8
+ import type { SignalBus } from './signal-bus.js';
11
9
  /**
12
10
  * Configuration for TaskRegistry
13
11
  */
14
- interface TaskRegistryConfig {
12
+ export interface TaskRegistryConfig {
15
13
  /** Maximum number of concurrent tasks (default: 20) */
16
14
  maxTasks?: number;
17
15
  /** TTL for completed task results in ms (default: 5 minutes) */
@@ -20,7 +18,7 @@ interface TaskRegistryConfig {
20
18
  /**
21
19
  * TaskRegistry - Manages background task lifecycle
22
20
  */
23
- declare class TaskRegistry {
21
+ export declare class TaskRegistry {
24
22
  private tasks;
25
23
  private signalBus;
26
24
  private config;
@@ -120,5 +118,4 @@ declare class TaskRegistry {
120
118
  */
121
119
  get size(): number;
122
120
  }
123
-
124
- export { TaskRegistry, type TaskRegistryConfig };
121
+ //# sourceMappingURL=task-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-registry.d.ts","sourceRoot":"","sources":["../src/task-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,IAAI,EACJ,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,YAAY;IACrB,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,MAAM,CAA+B;gBAEjC,SAAS,EAAE,SAAS,EAAE,MAAM,GAAE,kBAAuB;IAQjE;;OAEG;IACH,OAAO,CAAC,cAAc;IAItB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAW1B;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM;IA4C/D;;;;;OAKG;IACH,iBAAiB,CACb,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EACzB,OAAO,GAAE,mBAAwB,GAClC,MAAM;IAgBT;;OAEG;IACH,mBAAmB,CACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EACzB,OAAO,GAAE,mBAAwB,GAClC,MAAM;IAYT;;OAEG;IACH,mBAAmB,CACf,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EACzB,OAAO,GAAE,mBAAwB,GAClC,MAAM;IAWT;;OAEG;IACH,OAAO,CAAC,cAAc;IAuBtB;;OAEG;IACH,OAAO,CAAC,YAAY;IAuBpB;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IA0B5B;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI1C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIjD;;OAEG;IACH,SAAS,CACL,MAAM,EAAE,MAAM,GACf;QAAE,MAAM,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS;IAavE;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IA2B7C;;OAEG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,EAAE;IA2BrC;;OAEG;IACH,eAAe,IAAI,MAAM;IAUzB;;OAEG;IACH,gBAAgB,IAAI,QAAQ,EAAE;IAO9B;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI;IAS1C;;OAEG;IACH,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM;IAcjC;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI5B;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACJ"}
@@ -23,18 +23,24 @@ __export(check_task_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(check_task_exports);
25
25
  var import_zod = require("zod");
26
+ var import_core = require("@dexto/core");
26
27
  const CheckTaskInputSchema = import_zod.z.object({
27
28
  /** Task ID to check */
28
29
  taskId: import_zod.z.string().describe("Task ID to check status of")
29
30
  }).strict();
30
- function createCheckTaskTool() {
31
+ function createCheckTaskTool(taskRegistry) {
31
32
  return {
32
33
  id: "check_task",
33
34
  description: "Check the status of a background task. Returns immediately without waiting. Use this to poll task status or check if a task is done.",
34
35
  inputSchema: CheckTaskInputSchema,
35
- execute: async (rawInput, context) => {
36
- const input = CheckTaskInputSchema.parse(rawInput);
37
- const info = context.taskRegistry.getInfo(input.taskId);
36
+ presentation: {
37
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
38
+ title: "Check Task",
39
+ argsText: (0, import_core.truncateForHeader)(input.taskId, 80)
40
+ })
41
+ },
42
+ execute: async (input, _context) => {
43
+ const info = taskRegistry.getInfo(input.taskId);
38
44
  if (!info) {
39
45
  return {
40
46
  taskId: input.taskId,
@@ -1,20 +1,15 @@
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
1
  /**
9
2
  * check_task Tool
10
3
  *
11
4
  * Non-blocking status check for a background task.
12
5
  */
13
-
6
+ import { z } from 'zod';
7
+ import type { Tool } from '@dexto/core';
8
+ import type { TaskRegistry } from '../task-registry.js';
14
9
  /**
15
10
  * Input schema for check_task tool
16
11
  */
17
- declare const CheckTaskInputSchema: z.ZodObject<{
12
+ export declare const CheckTaskInputSchema: z.ZodObject<{
18
13
  /** Task ID to check */
19
14
  taskId: z.ZodString;
20
15
  }, "strict", z.ZodTypeAny, {
@@ -22,11 +17,11 @@ declare const CheckTaskInputSchema: z.ZodObject<{
22
17
  }, {
23
18
  taskId: string;
24
19
  }>;
25
- type CheckTaskInput = z.output<typeof CheckTaskInputSchema>;
20
+ export type CheckTaskInput = z.output<typeof CheckTaskInputSchema>;
26
21
  /**
27
22
  * Output from check_task tool
28
23
  */
29
- interface CheckTaskOutput {
24
+ export interface CheckTaskOutput {
30
25
  /** Task ID */
31
26
  taskId: string;
32
27
  /** Whether task was found */
@@ -51,6 +46,5 @@ interface CheckTaskOutput {
51
46
  /**
52
47
  * Create the check_task tool
53
48
  */
54
- declare function createCheckTaskTool(): OrchestrationTool;
55
-
56
- export { type CheckTaskInput, CheckTaskInputSchema, type CheckTaskOutput, createCheckTaskTool };
49
+ export declare function createCheckTaskTool(taskRegistry: TaskRegistry): Tool<typeof CheckTaskInputSchema>;
50
+ //# sourceMappingURL=check-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-task.d.ts","sourceRoot":"","sources":["../../src/tools/check-task.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAEzB,uBAAuB;;;;;;EAGlB,CAAC;AAEd,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB;IAChB,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,qBAAqB;IACrB,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IACtE,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAyCjG"}
@@ -1,16 +1,22 @@
1
1
  import { z } from "zod";
2
+ import { createLocalToolCallHeader, truncateForHeader } from "@dexto/core";
2
3
  const CheckTaskInputSchema = z.object({
3
4
  /** Task ID to check */
4
5
  taskId: z.string().describe("Task ID to check status of")
5
6
  }).strict();
6
- function createCheckTaskTool() {
7
+ function createCheckTaskTool(taskRegistry) {
7
8
  return {
8
9
  id: "check_task",
9
10
  description: "Check the status of a background task. Returns immediately without waiting. Use this to poll task status or check if a task is done.",
10
11
  inputSchema: CheckTaskInputSchema,
11
- execute: async (rawInput, context) => {
12
- const input = CheckTaskInputSchema.parse(rawInput);
13
- const info = context.taskRegistry.getInfo(input.taskId);
12
+ presentation: {
13
+ describeHeader: (input) => createLocalToolCallHeader({
14
+ title: "Check Task",
15
+ argsText: truncateForHeader(input.taskId, 80)
16
+ })
17
+ },
18
+ execute: async (input, _context) => {
19
+ const info = taskRegistry.getInfo(input.taskId);
14
20
  if (!info) {
15
21
  return {
16
22
  taskId: input.taskId,
@@ -20,17 +20,12 @@ var tools_exports = {};
20
20
  __export(tools_exports, {
21
21
  CheckTaskInputSchema: () => import_check_task2.CheckTaskInputSchema,
22
22
  ListTasksInputSchema: () => import_list_tasks2.ListTasksInputSchema,
23
- StartTaskInputSchema: () => import_start_task2.StartTaskInputSchema,
24
23
  WaitForInputSchema: () => import_wait_for2.WaitForInputSchema,
25
24
  createCheckTaskTool: () => import_check_task.createCheckTaskTool,
26
- createGenericTaskStarter: () => import_start_task.createGenericTaskStarter,
27
25
  createListTasksTool: () => import_list_tasks.createListTasksTool,
28
- createStartTaskTool: () => import_start_task.createStartTaskTool,
29
26
  createWaitForTool: () => import_wait_for.createWaitForTool
30
27
  });
31
28
  module.exports = __toCommonJS(tools_exports);
32
- var import_start_task = require("./start-task.js");
33
- var import_start_task2 = require("./start-task.js");
34
29
  var import_wait_for = require("./wait-for.js");
35
30
  var import_wait_for2 = require("./wait-for.js");
36
31
  var import_check_task = require("./check-task.js");
@@ -41,11 +36,8 @@ var import_list_tasks2 = require("./list-tasks.js");
41
36
  0 && (module.exports = {
42
37
  CheckTaskInputSchema,
43
38
  ListTasksInputSchema,
44
- StartTaskInputSchema,
45
39
  WaitForInputSchema,
46
40
  createCheckTaskTool,
47
- createGenericTaskStarter,
48
41
  createListTasksTool,
49
- createStartTaskTool,
50
42
  createWaitForTool
51
43
  });
@@ -1,10 +1,15 @@
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';
1
+ /**
2
+ * Orchestration Tools
3
+ *
4
+ * Tools for managing background tasks in agent workflows.
5
+ */
6
+ export { createWaitForTool } from './wait-for.js';
7
+ export type { WaitForInput, WaitForOutput } from './wait-for.js';
8
+ export { WaitForInputSchema } from './wait-for.js';
9
+ export { createCheckTaskTool } from './check-task.js';
10
+ export type { CheckTaskInput, CheckTaskOutput } from './check-task.js';
11
+ export { CheckTaskInputSchema } from './check-task.js';
12
+ export { createListTasksTool } from './list-tasks.js';
13
+ export type { ListTasksInput, ListTasksOutput, TaskListItem } from './list-tasks.js';
14
+ export { ListTasksInputSchema } from './list-tasks.js';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,5 +1,3 @@
1
- import { createStartTaskTool, createGenericTaskStarter } from "./start-task.js";
2
- import { StartTaskInputSchema } from "./start-task.js";
3
1
  import { createWaitForTool } from "./wait-for.js";
4
2
  import { WaitForInputSchema } from "./wait-for.js";
5
3
  import { createCheckTaskTool } from "./check-task.js";
@@ -9,11 +7,8 @@ import { ListTasksInputSchema } from "./list-tasks.js";
9
7
  export {
10
8
  CheckTaskInputSchema,
11
9
  ListTasksInputSchema,
12
- StartTaskInputSchema,
13
10
  WaitForInputSchema,
14
11
  createCheckTaskTool,
15
- createGenericTaskStarter,
16
12
  createListTasksTool,
17
- createStartTaskTool,
18
13
  createWaitForTool
19
14
  };
@@ -23,19 +23,31 @@ __export(list_tasks_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(list_tasks_exports);
25
25
  var import_zod = require("zod");
26
+ var import_core = require("@dexto/core");
26
27
  const ListTasksInputSchema = import_zod.z.object({
27
28
  /** Filter by status */
28
29
  status: import_zod.z.enum(["pending", "running", "completed", "failed", "cancelled", "all"]).optional().default("all").describe("Filter tasks by status"),
29
30
  /** Filter by type */
30
31
  type: import_zod.z.enum(["agent", "process", "generic"]).optional().describe("Filter tasks by type")
31
32
  }).strict();
32
- function createListTasksTool() {
33
+ function createListTasksTool(taskRegistry) {
33
34
  return {
34
35
  id: "list_tasks",
35
36
  description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
36
37
  inputSchema: ListTasksInputSchema,
37
- execute: async (rawInput, context) => {
38
- const input = ListTasksInputSchema.parse(rawInput);
38
+ presentation: {
39
+ describeHeader: (input) => {
40
+ const bits = [];
41
+ if (input.status && input.status !== "all") bits.push(`status=${input.status}`);
42
+ if (input.type) bits.push(`type=${input.type}`);
43
+ const argsText = bits.length > 0 ? (0, import_core.truncateForHeader)(bits.join(", "), 120) : void 0;
44
+ return (0, import_core.createLocalToolCallHeader)({
45
+ title: "List Tasks",
46
+ ...argsText ? { argsText } : {}
47
+ });
48
+ }
49
+ },
50
+ execute: async (input, _context) => {
39
51
  const filter = {};
40
52
  if (input.status && input.status !== "all") {
41
53
  filter.status = input.status;
@@ -43,8 +55,8 @@ function createListTasksTool() {
43
55
  if (input.type) {
44
56
  filter.type = input.type;
45
57
  }
46
- const tasks = context.taskRegistry.list(filter);
47
- const allTasks = context.taskRegistry.list();
58
+ const tasks = taskRegistry.list(filter);
59
+ const allTasks = taskRegistry.list();
48
60
  const counts = {
49
61
  running: 0,
50
62
  completed: 0,
@@ -1,20 +1,16 @@
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
1
  /**
9
2
  * list_tasks Tool
10
3
  *
11
4
  * List all tracked background tasks with optional filtering.
12
5
  */
13
-
6
+ import { z } from 'zod';
7
+ import type { TaskStatus } from '../types.js';
8
+ import type { Tool } from '@dexto/core';
9
+ import type { TaskRegistry } from '../task-registry.js';
14
10
  /**
15
11
  * Input schema for list_tasks tool
16
12
  */
17
- declare const ListTasksInputSchema: z.ZodObject<{
13
+ export declare const ListTasksInputSchema: z.ZodObject<{
18
14
  /** Filter by status */
19
15
  status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "running", "completed", "failed", "cancelled", "all"]>>>;
20
16
  /** Filter by type */
@@ -26,11 +22,11 @@ declare const ListTasksInputSchema: z.ZodObject<{
26
22
  type?: "agent" | "process" | "generic" | undefined;
27
23
  status?: "pending" | "running" | "completed" | "failed" | "cancelled" | "all" | undefined;
28
24
  }>;
29
- type ListTasksInput = z.output<typeof ListTasksInputSchema>;
25
+ export type ListTasksInput = z.output<typeof ListTasksInputSchema>;
30
26
  /**
31
27
  * Task info in list output
32
28
  */
33
- interface TaskListItem {
29
+ export interface TaskListItem {
34
30
  taskId: string;
35
31
  type: 'agent' | 'process' | 'generic';
36
32
  status: TaskStatus;
@@ -42,7 +38,7 @@ interface TaskListItem {
42
38
  /**
43
39
  * Output from list_tasks tool
44
40
  */
45
- interface ListTasksOutput {
41
+ export interface ListTasksOutput {
46
42
  /** List of tasks matching filter */
47
43
  tasks: TaskListItem[];
48
44
  /** Total count */
@@ -59,6 +55,5 @@ interface ListTasksOutput {
59
55
  /**
60
56
  * Create the list_tasks tool
61
57
  */
62
- declare function createListTasksTool(): OrchestrationTool;
63
-
64
- export { type ListTasksInput, ListTasksInputSchema, type ListTasksOutput, type TaskListItem, createListTasksTool };
58
+ export declare function createListTasksTool(taskRegistry: TaskRegistry): Tool<typeof ListTasksInputSchema>;
59
+ //# sourceMappingURL=list-tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-tasks.d.ts","sourceRoot":"","sources":["../../src/tools/list-tasks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,oBAAoB;IAEzB,uBAAuB;;IAOvB,qBAAqB;;;;;;;;EAGhB,CAAC;AAEd,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,oCAAoC;IACpC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAC;CACL;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC,OAAO,oBAAoB,CAAC,CAyEjG"}
@@ -1,17 +1,29 @@
1
1
  import { z } from "zod";
2
+ import { createLocalToolCallHeader, truncateForHeader } from "@dexto/core";
2
3
  const ListTasksInputSchema = z.object({
3
4
  /** Filter by status */
4
5
  status: z.enum(["pending", "running", "completed", "failed", "cancelled", "all"]).optional().default("all").describe("Filter tasks by status"),
5
6
  /** Filter by type */
6
7
  type: z.enum(["agent", "process", "generic"]).optional().describe("Filter tasks by type")
7
8
  }).strict();
8
- function createListTasksTool() {
9
+ function createListTasksTool(taskRegistry) {
9
10
  return {
10
11
  id: "list_tasks",
11
12
  description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
12
13
  inputSchema: ListTasksInputSchema,
13
- execute: async (rawInput, context) => {
14
- const input = ListTasksInputSchema.parse(rawInput);
14
+ presentation: {
15
+ describeHeader: (input) => {
16
+ const bits = [];
17
+ if (input.status && input.status !== "all") bits.push(`status=${input.status}`);
18
+ if (input.type) bits.push(`type=${input.type}`);
19
+ const argsText = bits.length > 0 ? truncateForHeader(bits.join(", "), 120) : void 0;
20
+ return createLocalToolCallHeader({
21
+ title: "List Tasks",
22
+ ...argsText ? { argsText } : {}
23
+ });
24
+ }
25
+ },
26
+ execute: async (input, _context) => {
15
27
  const filter = {};
16
28
  if (input.status && input.status !== "all") {
17
29
  filter.status = input.status;
@@ -19,8 +31,8 @@ function createListTasksTool() {
19
31
  if (input.type) {
20
32
  filter.type = input.type;
21
33
  }
22
- const tasks = context.taskRegistry.list(filter);
23
- const allTasks = context.taskRegistry.list();
34
+ const tasks = taskRegistry.list(filter);
35
+ const allTasks = taskRegistry.list();
24
36
  const counts = {
25
37
  running: 0,
26
38
  completed: 0,
@@ -25,6 +25,7 @@ module.exports = __toCommonJS(wait_for_exports);
25
25
  var import_zod = require("zod");
26
26
  var import_crypto = require("crypto");
27
27
  var import_condition_engine = require("../condition-engine.js");
28
+ var import_core = require("@dexto/core");
28
29
  const WaitForInputSchema = import_zod.z.object({
29
30
  /** Wait for a single task */
30
31
  taskId: import_zod.z.string().optional().describe("Task ID to wait for"),
@@ -96,15 +97,23 @@ function formatOutput(signal, allSignals) {
96
97
  }
97
98
  return baseOutput;
98
99
  }
99
- function createWaitForTool() {
100
+ function createWaitForTool(conditionEngine) {
100
101
  return {
101
102
  id: "wait_for",
102
103
  description: "Wait for background task(s) to complete. Blocks execution until the condition is met. Use taskId for a single task, or taskIds with mode for multiple tasks.",
103
104
  inputSchema: WaitForInputSchema,
104
- execute: async (rawInput, context) => {
105
- const input = WaitForInputSchema.parse(rawInput);
105
+ presentation: {
106
+ describeHeader: (input) => {
107
+ const argsText = input.taskId ? (0, import_core.truncateForHeader)(input.taskId, 80) : input.taskIds && input.taskIds.length > 0 ? (0, import_core.truncateForHeader)(`${input.taskIds.length} tasks`, 80) : void 0;
108
+ return (0, import_core.createLocalToolCallHeader)({
109
+ title: "Wait",
110
+ ...argsText ? { argsText } : {}
111
+ });
112
+ }
113
+ },
114
+ execute: async (input, _context) => {
106
115
  const condition = buildCondition(input);
107
- const { signal, allSignals } = await context.conditionEngine.wait(condition);
116
+ const { signal, allSignals } = await conditionEngine.wait(condition);
108
117
  return formatOutput(signal, allSignals);
109
118
  }
110
119
  };
@@ -1,21 +1,16 @@
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
1
  /**
9
2
  * wait_for Tool
10
3
  *
11
4
  * Suspends agent execution until condition is met using a blocking promise.
12
5
  * TurnExecutor naturally awaits tool execution, so this works seamlessly.
13
6
  */
14
-
7
+ import { z } from 'zod';
8
+ import { ConditionEngine } from '../condition-engine.js';
9
+ import type { Tool } from '@dexto/core';
15
10
  /**
16
11
  * Input schema for wait_for tool
17
12
  */
18
- declare const WaitForInputSchema: z.ZodEffects<z.ZodObject<{
13
+ export declare const WaitForInputSchema: z.ZodEffects<z.ZodObject<{
19
14
  /** Wait for a single task */
20
15
  taskId: z.ZodOptional<z.ZodString>;
21
16
  /** Wait for multiple tasks */
@@ -45,11 +40,11 @@ declare const WaitForInputSchema: z.ZodEffects<z.ZodObject<{
45
40
  taskIds?: string[] | undefined;
46
41
  mode?: "any" | "all" | undefined;
47
42
  }>;
48
- type WaitForInput = z.infer<typeof WaitForInputSchema>;
43
+ export type WaitForInput = z.output<typeof WaitForInputSchema>;
49
44
  /**
50
45
  * Output from wait_for tool
51
46
  */
52
- interface WaitForOutput {
47
+ export interface WaitForOutput {
53
48
  /** Task ID that triggered the return (for 'any' mode) */
54
49
  taskId: string;
55
50
  /** Final status */
@@ -69,6 +64,5 @@ interface WaitForOutput {
69
64
  /**
70
65
  * Create the wait_for tool
71
66
  */
72
- declare function createWaitForTool(): OrchestrationTool;
73
-
74
- export { type WaitForInput, WaitForInputSchema, type WaitForOutput, createWaitForTool };
67
+ export declare function createWaitForTool(conditionEngine: ConditionEngine): Tool<typeof WaitForInputSchema>;
68
+ //# sourceMappingURL=wait-for.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wait-for.d.ts","sourceRoot":"","sources":["../../src/tools/wait-for.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,kBAAkB;IAEvB,6BAA6B;;IAG7B,8BAA8B;;IAG9B,2EAA2E;;IAO3E,8BAA8B;;;;;;;;;;;;;;;;;;;;;;EAQjC,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,yDAAyD;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACzD,0BAA0B;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,UAAU,CAAC,EAAE,KAAK,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;QAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACN;AAoFD;;GAEG;AACH,wBAAgB,iBAAiB,CAC7B,eAAe,EAAE,eAAe,GACjC,IAAI,CAAC,OAAO,kBAAkB,CAAC,CA+BjC"}