@dexto/orchestration 1.6.0 → 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.
- package/dist/index.d.cts +615 -9
- package/dist/tools/check-task.cjs +7 -1
- package/dist/tools/check-task.d.ts.map +1 -1
- package/dist/tools/check-task.js +7 -1
- package/dist/tools/list-tasks.cjs +13 -1
- package/dist/tools/list-tasks.d.ts.map +1 -1
- package/dist/tools/list-tasks.js +13 -1
- package/dist/tools/wait-for.cjs +10 -1
- package/dist/tools/wait-for.d.ts.map +1 -1
- package/dist/tools/wait-for.js +10 -1
- package/package.json +3 -3
- package/dist/condition-engine.d.cts +0 -87
- package/dist/signal-bus.d.cts +0 -78
- package/dist/task-registry.d.cts +0 -124
- package/dist/tools/check-task.d.cts +0 -55
- package/dist/tools/index.d.cts +0 -9
- package/dist/tools/list-tasks.d.cts +0 -63
- package/dist/tools/wait-for.d.cts +0 -74
- package/dist/types.d.cts +0 -165
|
@@ -1 +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;
|
|
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"}
|
package/dist/tools/list-tasks.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
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"),
|
|
@@ -8,9 +9,20 @@ const ListTasksInputSchema = z.object({
|
|
|
8
9
|
function createListTasksTool(taskRegistry) {
|
|
9
10
|
return {
|
|
10
11
|
id: "list_tasks",
|
|
11
|
-
displayName: "List Tasks",
|
|
12
12
|
description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
|
|
13
13
|
inputSchema: ListTasksInputSchema,
|
|
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
|
+
},
|
|
14
26
|
execute: async (input, _context) => {
|
|
15
27
|
const filter = {};
|
|
16
28
|
if (input.status && input.status !== "all") {
|
package/dist/tools/wait-for.cjs
CHANGED
|
@@ -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"),
|
|
@@ -99,9 +100,17 @@ function formatOutput(signal, allSignals) {
|
|
|
99
100
|
function createWaitForTool(conditionEngine) {
|
|
100
101
|
return {
|
|
101
102
|
id: "wait_for",
|
|
102
|
-
displayName: "Wait",
|
|
103
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.",
|
|
104
104
|
inputSchema: WaitForInputSchema,
|
|
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
|
+
},
|
|
105
114
|
execute: async (input, _context) => {
|
|
106
115
|
const condition = buildCondition(input);
|
|
107
116
|
const { signal, allSignals } = await conditionEngine.wait(condition);
|
|
@@ -1 +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;
|
|
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"}
|
package/dist/tools/wait-for.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { randomUUID } from "crypto";
|
|
3
3
|
import { ConditionEngine } from "../condition-engine.js";
|
|
4
|
+
import { createLocalToolCallHeader, truncateForHeader } from "@dexto/core";
|
|
4
5
|
const WaitForInputSchema = z.object({
|
|
5
6
|
/** Wait for a single task */
|
|
6
7
|
taskId: z.string().optional().describe("Task ID to wait for"),
|
|
@@ -75,9 +76,17 @@ function formatOutput(signal, allSignals) {
|
|
|
75
76
|
function createWaitForTool(conditionEngine) {
|
|
76
77
|
return {
|
|
77
78
|
id: "wait_for",
|
|
78
|
-
displayName: "Wait",
|
|
79
79
|
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.",
|
|
80
80
|
inputSchema: WaitForInputSchema,
|
|
81
|
+
presentation: {
|
|
82
|
+
describeHeader: (input) => {
|
|
83
|
+
const argsText = input.taskId ? truncateForHeader(input.taskId, 80) : input.taskIds && input.taskIds.length > 0 ? truncateForHeader(`${input.taskIds.length} tasks`, 80) : void 0;
|
|
84
|
+
return createLocalToolCallHeader({
|
|
85
|
+
title: "Wait",
|
|
86
|
+
...argsText ? { argsText } : {}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
},
|
|
81
90
|
execute: async (input, _context) => {
|
|
82
91
|
const condition = buildCondition(input);
|
|
83
92
|
const { signal, allSignals } = await conditionEngine.wait(condition);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexto/orchestration",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Agent orchestration layer for background task management, event-driven completion handling, and async workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"zod": "^3.25.0",
|
|
24
|
-
"@dexto/core": "1.6.
|
|
24
|
+
"@dexto/core": "1.6.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsup": "^8.0.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"README.md"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"build": "tsup",
|
|
35
|
+
"build": "tsup && node ../../scripts/clean-tsbuildinfo.mjs && tsc -b tsconfig.json --emitDeclarationOnly",
|
|
36
36
|
"typecheck": "tsc --noEmit",
|
|
37
37
|
"clean": "rm -rf dist"
|
|
38
38
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { WaitCondition, WaitResult } from './types.cjs';
|
|
2
|
-
import { SignalBus } from './signal-bus.cjs';
|
|
3
|
-
import { TaskRegistry } from './task-registry.cjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ConditionEngine
|
|
7
|
-
*
|
|
8
|
-
* Evaluates wait conditions and resolves when met.
|
|
9
|
-
* Supports single task, any/all of multiple tasks, timeouts, and races.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
type LoggerLike = {
|
|
13
|
-
debug: (message: string) => void;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* ConditionEngine - Evaluates composable wait conditions
|
|
17
|
-
*/
|
|
18
|
-
declare class ConditionEngine {
|
|
19
|
-
private taskRegistry;
|
|
20
|
-
private signalBus;
|
|
21
|
-
private logger?;
|
|
22
|
-
constructor(taskRegistry: TaskRegistry, signalBus: SignalBus, logger?: LoggerLike | undefined);
|
|
23
|
-
/**
|
|
24
|
-
* Wait for a condition to be met
|
|
25
|
-
* @param condition Wait condition to evaluate
|
|
26
|
-
* @returns Promise resolving to the signal(s) that satisfied the condition
|
|
27
|
-
*/
|
|
28
|
-
wait(condition: WaitCondition): Promise<WaitResult>;
|
|
29
|
-
/**
|
|
30
|
-
* Check if a condition is already satisfied (non-blocking)
|
|
31
|
-
* @returns WaitResult if satisfied, null if not
|
|
32
|
-
*/
|
|
33
|
-
check(condition: WaitCondition): WaitResult | null;
|
|
34
|
-
/**
|
|
35
|
-
* Check if a single task is completed
|
|
36
|
-
*/
|
|
37
|
-
private checkTask;
|
|
38
|
-
/**
|
|
39
|
-
* Check if any of the conditions is satisfied
|
|
40
|
-
*/
|
|
41
|
-
private checkAny;
|
|
42
|
-
/**
|
|
43
|
-
* Check if all conditions are satisfied
|
|
44
|
-
*/
|
|
45
|
-
private checkAll;
|
|
46
|
-
/**
|
|
47
|
-
* Evaluate a condition asynchronously
|
|
48
|
-
*/
|
|
49
|
-
private evaluate;
|
|
50
|
-
/**
|
|
51
|
-
* Wait for a single task to complete
|
|
52
|
-
*
|
|
53
|
-
* Uses subscribe-then-check pattern to avoid race conditions where
|
|
54
|
-
* the task completes between checking and subscribing.
|
|
55
|
-
*/
|
|
56
|
-
private evaluateTask;
|
|
57
|
-
/**
|
|
58
|
-
* Wait for any of the conditions to be satisfied
|
|
59
|
-
*/
|
|
60
|
-
private evaluateAny;
|
|
61
|
-
/**
|
|
62
|
-
* Wait for all conditions to be satisfied
|
|
63
|
-
*/
|
|
64
|
-
private evaluateAll;
|
|
65
|
-
/**
|
|
66
|
-
* Wait for a timeout
|
|
67
|
-
*/
|
|
68
|
-
private evaluateTimeout;
|
|
69
|
-
/**
|
|
70
|
-
* Race a task condition against a timeout
|
|
71
|
-
*/
|
|
72
|
-
private evaluateRace;
|
|
73
|
-
/**
|
|
74
|
-
* Helper to create a race condition with timeout
|
|
75
|
-
*/
|
|
76
|
-
static createRaceWithTimeout(taskId: string, timeoutMs: number): WaitCondition;
|
|
77
|
-
/**
|
|
78
|
-
* Helper to create an 'any' condition from task IDs
|
|
79
|
-
*/
|
|
80
|
-
static createAnyTask(taskIds: string[]): WaitCondition;
|
|
81
|
-
/**
|
|
82
|
-
* Helper to create an 'all' condition from task IDs
|
|
83
|
-
*/
|
|
84
|
-
static createAllTasks(taskIds: string[]): WaitCondition;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { ConditionEngine };
|
package/dist/signal-bus.d.cts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Signal, SignalType } from './types.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* SignalBus
|
|
5
|
-
*
|
|
6
|
-
* Event emitter for routing orchestration signals.
|
|
7
|
-
* Supports typed subscriptions and promise-based waiting.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Handler function for signal subscriptions
|
|
12
|
-
*/
|
|
13
|
-
type SignalHandler<T extends Signal = Signal> = (signal: T) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Predicate function for filtering signals
|
|
16
|
-
*/
|
|
17
|
-
type SignalPredicate = (signal: Signal) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* SignalBus - Routes signals between orchestration components
|
|
20
|
-
*/
|
|
21
|
-
declare class SignalBus {
|
|
22
|
-
private emitter;
|
|
23
|
-
constructor();
|
|
24
|
-
/**
|
|
25
|
-
* Emit a signal to all subscribers
|
|
26
|
-
*/
|
|
27
|
-
emit(signal: Signal): void;
|
|
28
|
-
/**
|
|
29
|
-
* Subscribe to signals of a specific type
|
|
30
|
-
* @returns Unsubscribe function
|
|
31
|
-
*/
|
|
32
|
-
on<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
|
|
33
|
-
type: T;
|
|
34
|
-
}>>): () => void;
|
|
35
|
-
/**
|
|
36
|
-
* Subscribe to all signals
|
|
37
|
-
* @returns Unsubscribe function
|
|
38
|
-
*/
|
|
39
|
-
onAny(handler: SignalHandler): () => void;
|
|
40
|
-
/**
|
|
41
|
-
* Subscribe to a signal type once
|
|
42
|
-
*/
|
|
43
|
-
once<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
|
|
44
|
-
type: T;
|
|
45
|
-
}>>): void;
|
|
46
|
-
/**
|
|
47
|
-
* Remove a specific handler
|
|
48
|
-
*/
|
|
49
|
-
off<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
|
|
50
|
-
type: T;
|
|
51
|
-
}>>): void;
|
|
52
|
-
/**
|
|
53
|
-
* Wait for a signal matching the predicate
|
|
54
|
-
* @param predicate Function to test signals
|
|
55
|
-
* @param timeout Optional timeout in milliseconds
|
|
56
|
-
* @returns Promise that resolves with the matching signal
|
|
57
|
-
*/
|
|
58
|
-
waitFor(predicate: SignalPredicate, timeout?: number): Promise<Signal>;
|
|
59
|
-
/**
|
|
60
|
-
* Wait for a signal for a specific task
|
|
61
|
-
*/
|
|
62
|
-
waitForTask(taskId: string, timeout?: number): Promise<Signal>;
|
|
63
|
-
/**
|
|
64
|
-
* Wait for any of multiple tasks to complete
|
|
65
|
-
*/
|
|
66
|
-
waitForAnyTask(taskIds: string[], timeout?: number): Promise<Signal>;
|
|
67
|
-
/**
|
|
68
|
-
* Wait for all tasks to complete
|
|
69
|
-
* @returns Promise that resolves with all signals
|
|
70
|
-
*/
|
|
71
|
-
waitForAllTasks(taskIds: string[], timeout?: number, resolveInitial?: (taskId: string) => Signal | undefined): Promise<Signal[]>;
|
|
72
|
-
/**
|
|
73
|
-
* Remove all listeners
|
|
74
|
-
*/
|
|
75
|
-
clear(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export { SignalBus, type SignalHandler, type SignalPredicate };
|
package/dist/task-registry.d.cts
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { Task, RegisterTaskOptions, TaskEntry, TaskStatus, TaskInfo, TaskFilter } from './types.cjs';
|
|
2
|
-
import { SignalBus } from './signal-bus.cjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* TaskRegistry
|
|
6
|
-
*
|
|
7
|
-
* Tracks all background tasks and their results.
|
|
8
|
-
* Emits signals on task completion for the ConditionEngine.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Configuration for TaskRegistry
|
|
13
|
-
*/
|
|
14
|
-
interface TaskRegistryConfig {
|
|
15
|
-
/** Maximum number of concurrent tasks (default: 20) */
|
|
16
|
-
maxTasks?: number;
|
|
17
|
-
/** TTL for completed task results in ms (default: 5 minutes) */
|
|
18
|
-
resultTTL?: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* TaskRegistry - Manages background task lifecycle
|
|
22
|
-
*/
|
|
23
|
-
declare class TaskRegistry {
|
|
24
|
-
private tasks;
|
|
25
|
-
private signalBus;
|
|
26
|
-
private config;
|
|
27
|
-
constructor(signalBus: SignalBus, config?: TaskRegistryConfig);
|
|
28
|
-
/**
|
|
29
|
-
* Generate a unique task ID
|
|
30
|
-
*/
|
|
31
|
-
private generateTaskId;
|
|
32
|
-
/**
|
|
33
|
-
* Get description from task for display
|
|
34
|
-
*/
|
|
35
|
-
private getTaskDescription;
|
|
36
|
-
/**
|
|
37
|
-
* Register a new task and start tracking it
|
|
38
|
-
* @param task Task to register (must include promise)
|
|
39
|
-
* @param options Registration options
|
|
40
|
-
* @returns Task ID
|
|
41
|
-
*/
|
|
42
|
-
register(task: Task, options?: RegisterTaskOptions): string;
|
|
43
|
-
/**
|
|
44
|
-
* Create and register an agent task
|
|
45
|
-
*
|
|
46
|
-
* Note: Uses agentId as the taskId so the caller can use the same ID
|
|
47
|
-
* for wait_for/check_task operations.
|
|
48
|
-
*/
|
|
49
|
-
registerAgentTask(agentId: string, taskDescription: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
|
|
50
|
-
/**
|
|
51
|
-
* Create and register a process task
|
|
52
|
-
*/
|
|
53
|
-
registerProcessTask(processId: string, command: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
|
|
54
|
-
/**
|
|
55
|
-
* Create and register a generic task
|
|
56
|
-
*/
|
|
57
|
-
registerGenericTask(description: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
|
|
58
|
-
/**
|
|
59
|
-
* Called when a task completes successfully
|
|
60
|
-
*/
|
|
61
|
-
private onTaskComplete;
|
|
62
|
-
/**
|
|
63
|
-
* Called when a task fails
|
|
64
|
-
*/
|
|
65
|
-
private onTaskFailed;
|
|
66
|
-
/**
|
|
67
|
-
* Cancel a running task
|
|
68
|
-
*/
|
|
69
|
-
cancel(taskId: string): void;
|
|
70
|
-
/**
|
|
71
|
-
* Get task entry by ID
|
|
72
|
-
*/
|
|
73
|
-
get(taskId: string): TaskEntry | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Get task status
|
|
76
|
-
*/
|
|
77
|
-
getStatus(taskId: string): TaskStatus | undefined;
|
|
78
|
-
/**
|
|
79
|
-
* Get task result (if completed)
|
|
80
|
-
*/
|
|
81
|
-
getResult(taskId: string): {
|
|
82
|
-
status: TaskStatus;
|
|
83
|
-
result?: unknown;
|
|
84
|
-
error?: string;
|
|
85
|
-
} | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* Get task info (safe for serialization - no promise)
|
|
88
|
-
*/
|
|
89
|
-
getInfo(taskId: string): TaskInfo | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* List tasks matching filter
|
|
92
|
-
*/
|
|
93
|
-
list(filter?: TaskFilter): TaskInfo[];
|
|
94
|
-
/**
|
|
95
|
-
* Get count of running tasks
|
|
96
|
-
*/
|
|
97
|
-
getRunningCount(): number;
|
|
98
|
-
/**
|
|
99
|
-
* Get tasks that completed with notify=true and haven't been acknowledged
|
|
100
|
-
*/
|
|
101
|
-
getNotifyPending(): TaskInfo[];
|
|
102
|
-
/**
|
|
103
|
-
* Mark notify tasks as acknowledged (clear notify flag)
|
|
104
|
-
*/
|
|
105
|
-
acknowledgeNotify(taskIds: string[]): void;
|
|
106
|
-
/**
|
|
107
|
-
* Clean up old completed tasks
|
|
108
|
-
*/
|
|
109
|
-
cleanup(olderThan?: Date): number;
|
|
110
|
-
/**
|
|
111
|
-
* Clear all tasks
|
|
112
|
-
*/
|
|
113
|
-
clear(): void;
|
|
114
|
-
/**
|
|
115
|
-
* Check if a task exists
|
|
116
|
-
*/
|
|
117
|
-
has(taskId: string): boolean;
|
|
118
|
-
/**
|
|
119
|
-
* Get total task count
|
|
120
|
-
*/
|
|
121
|
-
get size(): number;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export { TaskRegistry, type TaskRegistryConfig };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { Tool } from '@dexto/core';
|
|
3
|
-
import { TaskRegistry } from '../task-registry.cjs';
|
|
4
|
-
import '../types.cjs';
|
|
5
|
-
import '../signal-bus.cjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* check_task Tool
|
|
9
|
-
*
|
|
10
|
-
* Non-blocking status check for a background task.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Input schema for check_task tool
|
|
15
|
-
*/
|
|
16
|
-
declare const CheckTaskInputSchema: z.ZodObject<{
|
|
17
|
-
/** Task ID to check */
|
|
18
|
-
taskId: z.ZodString;
|
|
19
|
-
}, "strict", z.ZodTypeAny, {
|
|
20
|
-
taskId: string;
|
|
21
|
-
}, {
|
|
22
|
-
taskId: string;
|
|
23
|
-
}>;
|
|
24
|
-
type CheckTaskInput = z.output<typeof CheckTaskInputSchema>;
|
|
25
|
-
/**
|
|
26
|
-
* Output from check_task tool
|
|
27
|
-
*/
|
|
28
|
-
interface CheckTaskOutput {
|
|
29
|
-
/** Task ID */
|
|
30
|
-
taskId: string;
|
|
31
|
-
/** Whether task was found */
|
|
32
|
-
found: boolean;
|
|
33
|
-
/** Task type */
|
|
34
|
-
type?: 'agent' | 'process' | 'generic';
|
|
35
|
-
/** Current status */
|
|
36
|
-
status?: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
37
|
-
/** Description of what the task is doing */
|
|
38
|
-
description?: string;
|
|
39
|
-
/** When the task started */
|
|
40
|
-
startedAt?: string;
|
|
41
|
-
/** When the task completed (if done) */
|
|
42
|
-
completedAt?: string;
|
|
43
|
-
/** Duration in milliseconds (if completed) */
|
|
44
|
-
duration?: number;
|
|
45
|
-
/** Result (if completed successfully) */
|
|
46
|
-
result?: unknown;
|
|
47
|
-
/** Error message (if failed) */
|
|
48
|
-
error?: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Create the check_task tool
|
|
52
|
-
*/
|
|
53
|
-
declare function createCheckTaskTool(taskRegistry: TaskRegistry): Tool<typeof CheckTaskInputSchema>;
|
|
54
|
-
|
|
55
|
-
export { type CheckTaskInput, CheckTaskInputSchema, type CheckTaskOutput, createCheckTaskTool };
|
package/dist/tools/index.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { WaitForInput, WaitForInputSchema, WaitForOutput, createWaitForTool } from './wait-for.cjs';
|
|
2
|
-
export { CheckTaskInput, CheckTaskInputSchema, CheckTaskOutput, createCheckTaskTool } from './check-task.cjs';
|
|
3
|
-
export { ListTasksInput, ListTasksInputSchema, ListTasksOutput, TaskListItem, createListTasksTool } from './list-tasks.cjs';
|
|
4
|
-
import '../signal-bus.cjs';
|
|
5
|
-
import '../task-registry.cjs';
|
|
6
|
-
import '../condition-engine.cjs';
|
|
7
|
-
import '../types.cjs';
|
|
8
|
-
import 'zod';
|
|
9
|
-
import '@dexto/core';
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { TaskStatus } from '../types.cjs';
|
|
3
|
-
import { Tool } from '@dexto/core';
|
|
4
|
-
import { TaskRegistry } from '../task-registry.cjs';
|
|
5
|
-
import '../signal-bus.cjs';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* list_tasks Tool
|
|
9
|
-
*
|
|
10
|
-
* List all tracked background tasks with optional filtering.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Input schema for list_tasks tool
|
|
15
|
-
*/
|
|
16
|
-
declare const ListTasksInputSchema: z.ZodObject<{
|
|
17
|
-
/** Filter by status */
|
|
18
|
-
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "running", "completed", "failed", "cancelled", "all"]>>>;
|
|
19
|
-
/** Filter by type */
|
|
20
|
-
type: z.ZodOptional<z.ZodEnum<["agent", "process", "generic"]>>;
|
|
21
|
-
}, "strict", z.ZodTypeAny, {
|
|
22
|
-
status: "pending" | "running" | "completed" | "failed" | "cancelled" | "all";
|
|
23
|
-
type?: "agent" | "process" | "generic" | undefined;
|
|
24
|
-
}, {
|
|
25
|
-
type?: "agent" | "process" | "generic" | undefined;
|
|
26
|
-
status?: "pending" | "running" | "completed" | "failed" | "cancelled" | "all" | undefined;
|
|
27
|
-
}>;
|
|
28
|
-
type ListTasksInput = z.output<typeof ListTasksInputSchema>;
|
|
29
|
-
/**
|
|
30
|
-
* Task info in list output
|
|
31
|
-
*/
|
|
32
|
-
interface TaskListItem {
|
|
33
|
-
taskId: string;
|
|
34
|
-
type: 'agent' | 'process' | 'generic';
|
|
35
|
-
status: TaskStatus;
|
|
36
|
-
description?: string;
|
|
37
|
-
startedAt: string;
|
|
38
|
-
completedAt?: string;
|
|
39
|
-
duration?: number;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Output from list_tasks tool
|
|
43
|
-
*/
|
|
44
|
-
interface ListTasksOutput {
|
|
45
|
-
/** List of tasks matching filter */
|
|
46
|
-
tasks: TaskListItem[];
|
|
47
|
-
/** Total count */
|
|
48
|
-
count: number;
|
|
49
|
-
/** Counts by status */
|
|
50
|
-
counts: {
|
|
51
|
-
running: number;
|
|
52
|
-
completed: number;
|
|
53
|
-
failed: number;
|
|
54
|
-
cancelled: number;
|
|
55
|
-
pending: number;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Create the list_tasks tool
|
|
60
|
-
*/
|
|
61
|
-
declare function createListTasksTool(taskRegistry: TaskRegistry): Tool<typeof ListTasksInputSchema>;
|
|
62
|
-
|
|
63
|
-
export { type ListTasksInput, ListTasksInputSchema, type ListTasksOutput, type TaskListItem, createListTasksTool };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { ConditionEngine } from '../condition-engine.cjs';
|
|
3
|
-
import { Tool } from '@dexto/core';
|
|
4
|
-
import '../types.cjs';
|
|
5
|
-
import '../signal-bus.cjs';
|
|
6
|
-
import '../task-registry.cjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* wait_for Tool
|
|
10
|
-
*
|
|
11
|
-
* Suspends agent execution until condition is met using a blocking promise.
|
|
12
|
-
* TurnExecutor naturally awaits tool execution, so this works seamlessly.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Input schema for wait_for tool
|
|
17
|
-
*/
|
|
18
|
-
declare const WaitForInputSchema: z.ZodEffects<z.ZodObject<{
|
|
19
|
-
/** Wait for a single task */
|
|
20
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
21
|
-
/** Wait for multiple tasks */
|
|
22
|
-
taskIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
-
/** Mode for multiple tasks: any = first to complete, all = wait for all */
|
|
24
|
-
mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "all"]>>>;
|
|
25
|
-
/** Timeout in milliseconds */
|
|
26
|
-
timeout: z.ZodOptional<z.ZodNumber>;
|
|
27
|
-
}, "strict", z.ZodTypeAny, {
|
|
28
|
-
mode: "any" | "all";
|
|
29
|
-
timeout?: number | undefined;
|
|
30
|
-
taskId?: string | undefined;
|
|
31
|
-
taskIds?: string[] | undefined;
|
|
32
|
-
}, {
|
|
33
|
-
timeout?: number | undefined;
|
|
34
|
-
taskId?: string | undefined;
|
|
35
|
-
taskIds?: string[] | undefined;
|
|
36
|
-
mode?: "any" | "all" | undefined;
|
|
37
|
-
}>, {
|
|
38
|
-
mode: "any" | "all";
|
|
39
|
-
timeout?: number | undefined;
|
|
40
|
-
taskId?: string | undefined;
|
|
41
|
-
taskIds?: string[] | undefined;
|
|
42
|
-
}, {
|
|
43
|
-
timeout?: number | undefined;
|
|
44
|
-
taskId?: string | undefined;
|
|
45
|
-
taskIds?: string[] | undefined;
|
|
46
|
-
mode?: "any" | "all" | undefined;
|
|
47
|
-
}>;
|
|
48
|
-
type WaitForInput = z.output<typeof WaitForInputSchema>;
|
|
49
|
-
/**
|
|
50
|
-
* Output from wait_for tool
|
|
51
|
-
*/
|
|
52
|
-
interface WaitForOutput {
|
|
53
|
-
/** Task ID that triggered the return (for 'any' mode) */
|
|
54
|
-
taskId: string;
|
|
55
|
-
/** Final status */
|
|
56
|
-
status: 'completed' | 'failed' | 'cancelled' | 'timeout';
|
|
57
|
-
/** Result if completed */
|
|
58
|
-
result?: unknown;
|
|
59
|
-
/** Error if failed */
|
|
60
|
-
error?: string;
|
|
61
|
-
/** All results for 'all' mode */
|
|
62
|
-
allResults?: Array<{
|
|
63
|
-
taskId: string;
|
|
64
|
-
status: 'completed' | 'failed' | 'cancelled';
|
|
65
|
-
result?: unknown;
|
|
66
|
-
error?: string;
|
|
67
|
-
}>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Create the wait_for tool
|
|
71
|
-
*/
|
|
72
|
-
declare function createWaitForTool(conditionEngine: ConditionEngine): Tool<typeof WaitForInputSchema>;
|
|
73
|
-
|
|
74
|
-
export { type WaitForInput, WaitForInputSchema, type WaitForOutput, createWaitForTool };
|