@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 CHANGED
@@ -1,9 +1,615 @@
1
- export { SignalBus, SignalHandler, SignalPredicate } from './signal-bus.cjs';
2
- export { TaskRegistry, TaskRegistryConfig } from './task-registry.cjs';
3
- export { ConditionEngine } from './condition-engine.cjs';
4
- export { AgentState, ProcessResult, RegisterTaskOptions, Signal, SignalType, Task, TaskEntry, TaskFilter, TaskInfo, TaskResult, TaskStatus, WaitCondition, WaitResult } from './types.cjs';
5
- export { WaitForInput, WaitForInputSchema, WaitForOutput, createWaitForTool } from './tools/wait-for.cjs';
6
- export { CheckTaskInput, CheckTaskInputSchema, CheckTaskOutput, createCheckTaskTool } from './tools/check-task.cjs';
7
- export { ListTasksInput, ListTasksInputSchema, ListTasksOutput, TaskListItem, createListTasksTool } from './tools/list-tasks.cjs';
8
- import 'zod';
9
- import '@dexto/core';
1
+ import { z } from 'zod';
2
+ import { Tool } from '@dexto/core';
3
+
4
+ /**
5
+ * Orchestration Types
6
+ *
7
+ * Core type definitions for the agent orchestration layer.
8
+ * Defines tasks, signals, wait conditions, and agent states.
9
+ */
10
+ /**
11
+ * Task result from agent or process execution
12
+ */
13
+ interface TaskResult {
14
+ success: boolean;
15
+ response?: string;
16
+ error?: string;
17
+ agentId?: string;
18
+ tokenUsage?: {
19
+ input: number;
20
+ output: number;
21
+ total: number;
22
+ };
23
+ }
24
+ /**
25
+ * Process result from shell command execution
26
+ */
27
+ interface ProcessResult {
28
+ stdout: string;
29
+ stderr: string;
30
+ exitCode: number;
31
+ duration?: number;
32
+ }
33
+ /**
34
+ * Task types - discriminated union of different background task kinds
35
+ */
36
+ type Task = {
37
+ type: 'agent';
38
+ taskId: string;
39
+ agentId: string;
40
+ taskDescription: string;
41
+ promise: Promise<TaskResult>;
42
+ } | {
43
+ type: 'process';
44
+ taskId: string;
45
+ processId: string;
46
+ command: string;
47
+ promise: Promise<ProcessResult>;
48
+ } | {
49
+ type: 'generic';
50
+ taskId: string;
51
+ description: string;
52
+ promise: Promise<unknown>;
53
+ };
54
+ /**
55
+ * Task lifecycle status
56
+ */
57
+ type TaskStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
58
+ /**
59
+ * Entry in the task registry tracking a background task
60
+ */
61
+ interface TaskEntry {
62
+ task: Task;
63
+ status: TaskStatus;
64
+ startedAt: Date;
65
+ completedAt?: Date;
66
+ result?: unknown;
67
+ error?: string;
68
+ /** If true, auto-trigger agent turn on completion */
69
+ notify?: boolean;
70
+ /** Timeout handle for this task (if set) */
71
+ timeoutHandle: ReturnType<typeof setTimeout> | undefined;
72
+ }
73
+ /**
74
+ * Signal types - events that trigger state transitions
75
+ */
76
+ type Signal = {
77
+ type: 'task:completed';
78
+ taskId: string;
79
+ result: unknown;
80
+ } | {
81
+ type: 'task:failed';
82
+ taskId: string;
83
+ error: string;
84
+ } | {
85
+ type: 'task:cancelled';
86
+ taskId: string;
87
+ } | {
88
+ type: 'timeout';
89
+ conditionId: string;
90
+ } | {
91
+ type: 'user:input';
92
+ content: string;
93
+ sessionId: string;
94
+ } | {
95
+ type: 'external';
96
+ source: string;
97
+ data: unknown;
98
+ };
99
+ /**
100
+ * Extract signal type string
101
+ */
102
+ type SignalType = Signal['type'];
103
+ /**
104
+ * Wait conditions - composable conditions for suspension
105
+ */
106
+ type WaitCondition = {
107
+ type: 'task';
108
+ taskId: string;
109
+ } | {
110
+ type: 'any';
111
+ conditions: WaitCondition[];
112
+ } | {
113
+ type: 'all';
114
+ conditions: WaitCondition[];
115
+ } | {
116
+ type: 'timeout';
117
+ ms: number;
118
+ conditionId: string;
119
+ } | {
120
+ type: 'race';
121
+ task: WaitCondition;
122
+ timeout: WaitCondition;
123
+ };
124
+ /**
125
+ * Agent loop states
126
+ */
127
+ type AgentState = 'idle' | 'processing' | 'waiting';
128
+ /**
129
+ * Task info returned by list/check operations (without internal promise)
130
+ */
131
+ interface TaskInfo {
132
+ taskId: string;
133
+ type: Task['type'];
134
+ status: TaskStatus;
135
+ startedAt: Date;
136
+ completedAt?: Date;
137
+ duration?: number;
138
+ description?: string;
139
+ result?: unknown;
140
+ error?: string;
141
+ cancelReason?: string;
142
+ }
143
+ /**
144
+ * Filter options for listing tasks
145
+ */
146
+ interface TaskFilter {
147
+ status?: TaskStatus | TaskStatus[];
148
+ type?: Task['type'];
149
+ }
150
+ /**
151
+ * Result from waiting on a condition
152
+ */
153
+ interface WaitResult {
154
+ signal: Signal;
155
+ /** For 'all' conditions, contains all signals */
156
+ allSignals?: Signal[];
157
+ }
158
+ /**
159
+ * Options for registering a task
160
+ */
161
+ interface RegisterTaskOptions {
162
+ /** Auto-trigger agent turn on completion */
163
+ notify?: boolean;
164
+ /** Timeout in milliseconds */
165
+ timeout?: number;
166
+ }
167
+
168
+ /**
169
+ * SignalBus
170
+ *
171
+ * Event emitter for routing orchestration signals.
172
+ * Supports typed subscriptions and promise-based waiting.
173
+ */
174
+
175
+ /**
176
+ * Handler function for signal subscriptions
177
+ */
178
+ type SignalHandler<T extends Signal = Signal> = (signal: T) => void;
179
+ /**
180
+ * Predicate function for filtering signals
181
+ */
182
+ type SignalPredicate = (signal: Signal) => boolean;
183
+ /**
184
+ * SignalBus - Routes signals between orchestration components
185
+ */
186
+ declare class SignalBus {
187
+ private emitter;
188
+ constructor();
189
+ /**
190
+ * Emit a signal to all subscribers
191
+ */
192
+ emit(signal: Signal): void;
193
+ /**
194
+ * Subscribe to signals of a specific type
195
+ * @returns Unsubscribe function
196
+ */
197
+ on<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
198
+ type: T;
199
+ }>>): () => void;
200
+ /**
201
+ * Subscribe to all signals
202
+ * @returns Unsubscribe function
203
+ */
204
+ onAny(handler: SignalHandler): () => void;
205
+ /**
206
+ * Subscribe to a signal type once
207
+ */
208
+ once<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
209
+ type: T;
210
+ }>>): void;
211
+ /**
212
+ * Remove a specific handler
213
+ */
214
+ off<T extends SignalType>(type: T, handler: SignalHandler<Extract<Signal, {
215
+ type: T;
216
+ }>>): void;
217
+ /**
218
+ * Wait for a signal matching the predicate
219
+ * @param predicate Function to test signals
220
+ * @param timeout Optional timeout in milliseconds
221
+ * @returns Promise that resolves with the matching signal
222
+ */
223
+ waitFor(predicate: SignalPredicate, timeout?: number): Promise<Signal>;
224
+ /**
225
+ * Wait for a signal for a specific task
226
+ */
227
+ waitForTask(taskId: string, timeout?: number): Promise<Signal>;
228
+ /**
229
+ * Wait for any of multiple tasks to complete
230
+ */
231
+ waitForAnyTask(taskIds: string[], timeout?: number): Promise<Signal>;
232
+ /**
233
+ * Wait for all tasks to complete
234
+ * @returns Promise that resolves with all signals
235
+ */
236
+ waitForAllTasks(taskIds: string[], timeout?: number, resolveInitial?: (taskId: string) => Signal | undefined): Promise<Signal[]>;
237
+ /**
238
+ * Remove all listeners
239
+ */
240
+ clear(): void;
241
+ }
242
+
243
+ /**
244
+ * TaskRegistry
245
+ *
246
+ * Tracks all background tasks and their results.
247
+ * Emits signals on task completion for the ConditionEngine.
248
+ */
249
+
250
+ /**
251
+ * Configuration for TaskRegistry
252
+ */
253
+ interface TaskRegistryConfig {
254
+ /** Maximum number of concurrent tasks (default: 20) */
255
+ maxTasks?: number;
256
+ /** TTL for completed task results in ms (default: 5 minutes) */
257
+ resultTTL?: number;
258
+ }
259
+ /**
260
+ * TaskRegistry - Manages background task lifecycle
261
+ */
262
+ declare class TaskRegistry {
263
+ private tasks;
264
+ private signalBus;
265
+ private config;
266
+ constructor(signalBus: SignalBus, config?: TaskRegistryConfig);
267
+ /**
268
+ * Generate a unique task ID
269
+ */
270
+ private generateTaskId;
271
+ /**
272
+ * Get description from task for display
273
+ */
274
+ private getTaskDescription;
275
+ /**
276
+ * Register a new task and start tracking it
277
+ * @param task Task to register (must include promise)
278
+ * @param options Registration options
279
+ * @returns Task ID
280
+ */
281
+ register(task: Task, options?: RegisterTaskOptions): string;
282
+ /**
283
+ * Create and register an agent task
284
+ *
285
+ * Note: Uses agentId as the taskId so the caller can use the same ID
286
+ * for wait_for/check_task operations.
287
+ */
288
+ registerAgentTask(agentId: string, taskDescription: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
289
+ /**
290
+ * Create and register a process task
291
+ */
292
+ registerProcessTask(processId: string, command: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
293
+ /**
294
+ * Create and register a generic task
295
+ */
296
+ registerGenericTask(description: string, promise: Promise<unknown>, options?: RegisterTaskOptions): string;
297
+ /**
298
+ * Called when a task completes successfully
299
+ */
300
+ private onTaskComplete;
301
+ /**
302
+ * Called when a task fails
303
+ */
304
+ private onTaskFailed;
305
+ /**
306
+ * Cancel a running task
307
+ */
308
+ cancel(taskId: string): void;
309
+ /**
310
+ * Get task entry by ID
311
+ */
312
+ get(taskId: string): TaskEntry | undefined;
313
+ /**
314
+ * Get task status
315
+ */
316
+ getStatus(taskId: string): TaskStatus | undefined;
317
+ /**
318
+ * Get task result (if completed)
319
+ */
320
+ getResult(taskId: string): {
321
+ status: TaskStatus;
322
+ result?: unknown;
323
+ error?: string;
324
+ } | undefined;
325
+ /**
326
+ * Get task info (safe for serialization - no promise)
327
+ */
328
+ getInfo(taskId: string): TaskInfo | undefined;
329
+ /**
330
+ * List tasks matching filter
331
+ */
332
+ list(filter?: TaskFilter): TaskInfo[];
333
+ /**
334
+ * Get count of running tasks
335
+ */
336
+ getRunningCount(): number;
337
+ /**
338
+ * Get tasks that completed with notify=true and haven't been acknowledged
339
+ */
340
+ getNotifyPending(): TaskInfo[];
341
+ /**
342
+ * Mark notify tasks as acknowledged (clear notify flag)
343
+ */
344
+ acknowledgeNotify(taskIds: string[]): void;
345
+ /**
346
+ * Clean up old completed tasks
347
+ */
348
+ cleanup(olderThan?: Date): number;
349
+ /**
350
+ * Clear all tasks
351
+ */
352
+ clear(): void;
353
+ /**
354
+ * Check if a task exists
355
+ */
356
+ has(taskId: string): boolean;
357
+ /**
358
+ * Get total task count
359
+ */
360
+ get size(): number;
361
+ }
362
+
363
+ /**
364
+ * ConditionEngine
365
+ *
366
+ * Evaluates wait conditions and resolves when met.
367
+ * Supports single task, any/all of multiple tasks, timeouts, and races.
368
+ */
369
+
370
+ type LoggerLike = {
371
+ debug: (message: string) => void;
372
+ };
373
+ /**
374
+ * ConditionEngine - Evaluates composable wait conditions
375
+ */
376
+ declare class ConditionEngine {
377
+ private taskRegistry;
378
+ private signalBus;
379
+ private logger?;
380
+ constructor(taskRegistry: TaskRegistry, signalBus: SignalBus, logger?: LoggerLike | undefined);
381
+ /**
382
+ * Wait for a condition to be met
383
+ * @param condition Wait condition to evaluate
384
+ * @returns Promise resolving to the signal(s) that satisfied the condition
385
+ */
386
+ wait(condition: WaitCondition): Promise<WaitResult>;
387
+ /**
388
+ * Check if a condition is already satisfied (non-blocking)
389
+ * @returns WaitResult if satisfied, null if not
390
+ */
391
+ check(condition: WaitCondition): WaitResult | null;
392
+ /**
393
+ * Check if a single task is completed
394
+ */
395
+ private checkTask;
396
+ /**
397
+ * Check if any of the conditions is satisfied
398
+ */
399
+ private checkAny;
400
+ /**
401
+ * Check if all conditions are satisfied
402
+ */
403
+ private checkAll;
404
+ /**
405
+ * Evaluate a condition asynchronously
406
+ */
407
+ private evaluate;
408
+ /**
409
+ * Wait for a single task to complete
410
+ *
411
+ * Uses subscribe-then-check pattern to avoid race conditions where
412
+ * the task completes between checking and subscribing.
413
+ */
414
+ private evaluateTask;
415
+ /**
416
+ * Wait for any of the conditions to be satisfied
417
+ */
418
+ private evaluateAny;
419
+ /**
420
+ * Wait for all conditions to be satisfied
421
+ */
422
+ private evaluateAll;
423
+ /**
424
+ * Wait for a timeout
425
+ */
426
+ private evaluateTimeout;
427
+ /**
428
+ * Race a task condition against a timeout
429
+ */
430
+ private evaluateRace;
431
+ /**
432
+ * Helper to create a race condition with timeout
433
+ */
434
+ static createRaceWithTimeout(taskId: string, timeoutMs: number): WaitCondition;
435
+ /**
436
+ * Helper to create an 'any' condition from task IDs
437
+ */
438
+ static createAnyTask(taskIds: string[]): WaitCondition;
439
+ /**
440
+ * Helper to create an 'all' condition from task IDs
441
+ */
442
+ static createAllTasks(taskIds: string[]): WaitCondition;
443
+ }
444
+
445
+ /**
446
+ * wait_for Tool
447
+ *
448
+ * Suspends agent execution until condition is met using a blocking promise.
449
+ * TurnExecutor naturally awaits tool execution, so this works seamlessly.
450
+ */
451
+
452
+ /**
453
+ * Input schema for wait_for tool
454
+ */
455
+ declare const WaitForInputSchema: z.ZodEffects<z.ZodObject<{
456
+ /** Wait for a single task */
457
+ taskId: z.ZodOptional<z.ZodString>;
458
+ /** Wait for multiple tasks */
459
+ taskIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
460
+ /** Mode for multiple tasks: any = first to complete, all = wait for all */
461
+ mode: z.ZodDefault<z.ZodOptional<z.ZodEnum<["any", "all"]>>>;
462
+ /** Timeout in milliseconds */
463
+ timeout: z.ZodOptional<z.ZodNumber>;
464
+ }, "strict", z.ZodTypeAny, {
465
+ mode: "any" | "all";
466
+ timeout?: number | undefined;
467
+ taskId?: string | undefined;
468
+ taskIds?: string[] | undefined;
469
+ }, {
470
+ timeout?: number | undefined;
471
+ taskId?: string | undefined;
472
+ taskIds?: string[] | undefined;
473
+ mode?: "any" | "all" | undefined;
474
+ }>, {
475
+ mode: "any" | "all";
476
+ timeout?: number | undefined;
477
+ taskId?: string | undefined;
478
+ taskIds?: string[] | undefined;
479
+ }, {
480
+ timeout?: number | undefined;
481
+ taskId?: string | undefined;
482
+ taskIds?: string[] | undefined;
483
+ mode?: "any" | "all" | undefined;
484
+ }>;
485
+ type WaitForInput = z.output<typeof WaitForInputSchema>;
486
+ /**
487
+ * Output from wait_for tool
488
+ */
489
+ interface WaitForOutput {
490
+ /** Task ID that triggered the return (for 'any' mode) */
491
+ taskId: string;
492
+ /** Final status */
493
+ status: 'completed' | 'failed' | 'cancelled' | 'timeout';
494
+ /** Result if completed */
495
+ result?: unknown;
496
+ /** Error if failed */
497
+ error?: string;
498
+ /** All results for 'all' mode */
499
+ allResults?: Array<{
500
+ taskId: string;
501
+ status: 'completed' | 'failed' | 'cancelled';
502
+ result?: unknown;
503
+ error?: string;
504
+ }>;
505
+ }
506
+ /**
507
+ * Create the wait_for tool
508
+ */
509
+ declare function createWaitForTool(conditionEngine: ConditionEngine): Tool<typeof WaitForInputSchema>;
510
+
511
+ /**
512
+ * check_task Tool
513
+ *
514
+ * Non-blocking status check for a background task.
515
+ */
516
+
517
+ /**
518
+ * Input schema for check_task tool
519
+ */
520
+ declare const CheckTaskInputSchema: z.ZodObject<{
521
+ /** Task ID to check */
522
+ taskId: z.ZodString;
523
+ }, "strict", z.ZodTypeAny, {
524
+ taskId: string;
525
+ }, {
526
+ taskId: string;
527
+ }>;
528
+ type CheckTaskInput = z.output<typeof CheckTaskInputSchema>;
529
+ /**
530
+ * Output from check_task tool
531
+ */
532
+ interface CheckTaskOutput {
533
+ /** Task ID */
534
+ taskId: string;
535
+ /** Whether task was found */
536
+ found: boolean;
537
+ /** Task type */
538
+ type?: 'agent' | 'process' | 'generic';
539
+ /** Current status */
540
+ status?: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
541
+ /** Description of what the task is doing */
542
+ description?: string;
543
+ /** When the task started */
544
+ startedAt?: string;
545
+ /** When the task completed (if done) */
546
+ completedAt?: string;
547
+ /** Duration in milliseconds (if completed) */
548
+ duration?: number;
549
+ /** Result (if completed successfully) */
550
+ result?: unknown;
551
+ /** Error message (if failed) */
552
+ error?: string;
553
+ }
554
+ /**
555
+ * Create the check_task tool
556
+ */
557
+ declare function createCheckTaskTool(taskRegistry: TaskRegistry): Tool<typeof CheckTaskInputSchema>;
558
+
559
+ /**
560
+ * list_tasks Tool
561
+ *
562
+ * List all tracked background tasks with optional filtering.
563
+ */
564
+
565
+ /**
566
+ * Input schema for list_tasks tool
567
+ */
568
+ declare const ListTasksInputSchema: z.ZodObject<{
569
+ /** Filter by status */
570
+ status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "running", "completed", "failed", "cancelled", "all"]>>>;
571
+ /** Filter by type */
572
+ type: z.ZodOptional<z.ZodEnum<["agent", "process", "generic"]>>;
573
+ }, "strict", z.ZodTypeAny, {
574
+ status: "pending" | "running" | "completed" | "failed" | "cancelled" | "all";
575
+ type?: "agent" | "process" | "generic" | undefined;
576
+ }, {
577
+ type?: "agent" | "process" | "generic" | undefined;
578
+ status?: "pending" | "running" | "completed" | "failed" | "cancelled" | "all" | undefined;
579
+ }>;
580
+ type ListTasksInput = z.output<typeof ListTasksInputSchema>;
581
+ /**
582
+ * Task info in list output
583
+ */
584
+ interface TaskListItem {
585
+ taskId: string;
586
+ type: 'agent' | 'process' | 'generic';
587
+ status: TaskStatus;
588
+ description?: string;
589
+ startedAt: string;
590
+ completedAt?: string;
591
+ duration?: number;
592
+ }
593
+ /**
594
+ * Output from list_tasks tool
595
+ */
596
+ interface ListTasksOutput {
597
+ /** List of tasks matching filter */
598
+ tasks: TaskListItem[];
599
+ /** Total count */
600
+ count: number;
601
+ /** Counts by status */
602
+ counts: {
603
+ running: number;
604
+ completed: number;
605
+ failed: number;
606
+ cancelled: number;
607
+ pending: number;
608
+ };
609
+ }
610
+ /**
611
+ * Create the list_tasks tool
612
+ */
613
+ declare function createListTasksTool(taskRegistry: TaskRegistry): Tool<typeof ListTasksInputSchema>;
614
+
615
+ export { type AgentState, type CheckTaskInput, CheckTaskInputSchema, type CheckTaskOutput, ConditionEngine, type ListTasksInput, ListTasksInputSchema, type ListTasksOutput, type ProcessResult, type RegisterTaskOptions, type Signal, SignalBus, type SignalHandler, type SignalPredicate, type SignalType, type Task, type TaskEntry, type TaskFilter, type TaskInfo, type TaskListItem, TaskRegistry, type TaskRegistryConfig, type TaskResult, type TaskStatus, type WaitCondition, type WaitForInput, WaitForInputSchema, type WaitForOutput, type WaitResult, createCheckTaskTool, createListTasksTool, createWaitForTool };
@@ -23,6 +23,7 @@ __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")
@@ -30,9 +31,14 @@ const CheckTaskInputSchema = import_zod.z.object({
30
31
  function createCheckTaskTool(taskRegistry) {
31
32
  return {
32
33
  id: "check_task",
33
- displayName: "Check Task",
34
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.",
35
35
  inputSchema: CheckTaskInputSchema,
36
+ presentation: {
37
+ describeHeader: (input) => (0, import_core.createLocalToolCallHeader)({
38
+ title: "Check Task",
39
+ argsText: (0, import_core.truncateForHeader)(input.taskId, 80)
40
+ })
41
+ },
36
42
  execute: async (input, _context) => {
37
43
  const info = taskRegistry.getInfo(input.taskId);
38
44
  if (!info) {
@@ -1 +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;AACxB,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,CAmCjG"}
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,4 +1,5 @@
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")
@@ -6,9 +7,14 @@ const CheckTaskInputSchema = z.object({
6
7
  function createCheckTaskTool(taskRegistry) {
7
8
  return {
8
9
  id: "check_task",
9
- displayName: "Check Task",
10
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.",
11
11
  inputSchema: CheckTaskInputSchema,
12
+ presentation: {
13
+ describeHeader: (input) => createLocalToolCallHeader({
14
+ title: "Check Task",
15
+ argsText: truncateForHeader(input.taskId, 80)
16
+ })
17
+ },
12
18
  execute: async (input, _context) => {
13
19
  const info = taskRegistry.getInfo(input.taskId);
14
20
  if (!info) {
@@ -23,6 +23,7 @@ __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"),
@@ -32,9 +33,20 @@ const ListTasksInputSchema = import_zod.z.object({
32
33
  function createListTasksTool(taskRegistry) {
33
34
  return {
34
35
  id: "list_tasks",
35
- displayName: "List Tasks",
36
36
  description: "List all background tasks with optional filtering by status or type. Returns task information and counts.",
37
37
  inputSchema: ListTasksInputSchema,
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
+ },
38
50
  execute: async (input, _context) => {
39
51
  const filter = {};
40
52
  if (input.status && input.status !== "all") {