zeitlich 0.2.18 → 0.2.20
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/adapters/sandbox/daytona/index.cjs +25 -10
- package/dist/adapters/sandbox/daytona/index.cjs.map +1 -1
- package/dist/adapters/sandbox/daytona/index.d.cts +4 -1
- package/dist/adapters/sandbox/daytona/index.d.ts +4 -1
- package/dist/adapters/sandbox/daytona/index.js +25 -10
- package/dist/adapters/sandbox/daytona/index.js.map +1 -1
- package/dist/adapters/sandbox/virtual/index.d.cts +4 -3
- package/dist/adapters/sandbox/virtual/index.d.ts +4 -3
- package/dist/adapters/thread/google-genai/index.cjs +0 -2
- package/dist/adapters/thread/google-genai/index.cjs.map +1 -1
- package/dist/adapters/thread/google-genai/index.d.cts +2 -2
- package/dist/adapters/thread/google-genai/index.d.ts +2 -2
- package/dist/adapters/thread/google-genai/index.js +0 -2
- package/dist/adapters/thread/google-genai/index.js.map +1 -1
- package/dist/adapters/thread/langchain/index.cjs +3 -1
- package/dist/adapters/thread/langchain/index.cjs.map +1 -1
- package/dist/adapters/thread/langchain/index.d.cts +3 -3
- package/dist/adapters/thread/langchain/index.d.ts +3 -3
- package/dist/adapters/thread/langchain/index.js +3 -1
- package/dist/adapters/thread/langchain/index.js.map +1 -1
- package/dist/index.cjs +153 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.js +153 -123
- package/dist/index.js.map +1 -1
- package/dist/{queries-TwukRZ8b.d.ts → queries-KHj5Otv7.d.ts} +1 -1
- package/dist/{queries-DnX72m_Y.d.cts → queries-nIdzTCDS.d.cts} +1 -1
- package/dist/{types-CdB2D5Sq.d.ts → types-By80IE1x.d.ts} +3 -3
- package/dist/{types-CmOSypVk.d.ts → types-Ct2igz9y.d.cts} +6 -4
- package/dist/{types-CmOSypVk.d.cts → types-Ct2igz9y.d.ts} +6 -4
- package/dist/{types-DRvq2miV.d.cts → types-DZ7BkA3-.d.cts} +3 -3
- package/dist/workflow.cjs +70 -40
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +16 -12
- package/dist/workflow.d.ts +16 -12
- package/dist/workflow.js +70 -40
- package/dist/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/sandbox/daytona/filesystem.ts +21 -12
- package/src/adapters/sandbox/daytona/index.ts +24 -23
- package/src/adapters/thread/langchain/thread-manager.ts +11 -7
- package/src/lib/session/session-edge-cases.integration.test.ts +20 -2
- package/src/lib/session/session.integration.test.ts +16 -2
- package/src/lib/session/session.ts +2 -1
- package/src/lib/session/types.ts +2 -1
- package/src/lib/subagent/handler.ts +1 -1
- package/src/lib/subagent/register.ts +3 -9
- package/src/lib/subagent/subagent.integration.test.ts +10 -9
- package/src/lib/subagent/tool.ts +1 -1
- package/src/lib/thread/index.ts +0 -1
- package/src/lib/tool-router/router-edge-cases.integration.test.ts +8 -3
- package/src/lib/tool-router/router.integration.test.ts +8 -3
- package/src/lib/tool-router/router.ts +61 -31
- package/src/lib/tool-router/types.ts +14 -9
- package/src/lib/workflow.test.ts +18 -6
- package/src/lib/workflow.ts +13 -3
- package/src/tools/task-create/handler.ts +3 -6
- package/src/workflow.ts +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.js';
|
|
2
|
-
import { R as RouterContext } from './types-
|
|
2
|
+
import { R as RouterContext } from './types-Ct2igz9y.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Ephemeral {@link SandboxFileSystem} backed by a {@link FileResolver}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as SandboxFileSystem, F as FileStat, D as DirentEntry, S as Sandbox, d as SandboxCreateOptions } from './types-BMRzfELQ.cjs';
|
|
2
|
-
import { R as RouterContext } from './types-
|
|
2
|
+
import { R as RouterContext } from './types-Ct2igz9y.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Ephemeral {@link SandboxFileSystem} backed by a {@link FileResolver}.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration } from '@temporalio/common';
|
|
2
|
-
import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-
|
|
2
|
+
import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-Ct2igz9y.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { g as SandboxOps } from './types-BMRzfELQ.js';
|
|
5
|
-
import { QueryDefinition } from '@temporalio/workflow';
|
|
5
|
+
import { QueryDefinition, ActivityInterfaceFor } from '@temporalio/workflow';
|
|
6
6
|
import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -367,7 +367,7 @@ interface SessionConfig<T extends ToolMap, M = unknown> {
|
|
|
367
367
|
/** Workflow-specific runAgent activity (with tools pre-bound) */
|
|
368
368
|
runAgent: RunAgentActivity<M>;
|
|
369
369
|
/** Thread operations (initialize, append messages, parse tool calls) */
|
|
370
|
-
threadOps?: ThreadOps
|
|
370
|
+
threadOps?: ActivityInterfaceFor<ThreadOps>;
|
|
371
371
|
/** Tool router for processing tool calls (optional if agent has no tools) */
|
|
372
372
|
tools?: T;
|
|
373
373
|
/** Subagent configurations */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ActivityFunctionWithOptions } from '@temporalio/workflow';
|
|
2
3
|
|
|
3
4
|
/** A single content part within a structured message (text, image, etc.) */
|
|
4
5
|
type ContentPart = {
|
|
@@ -162,8 +163,8 @@ interface ToolWithHandler<TName extends string = string, TSchema extends z.ZodTy
|
|
|
162
163
|
*/
|
|
163
164
|
type ToolMap = Record<string, {
|
|
164
165
|
name: string;
|
|
165
|
-
description: string;
|
|
166
|
-
schema: z.ZodType;
|
|
166
|
+
description: string | (() => string);
|
|
167
|
+
schema: z.ZodType | (() => z.ZodType);
|
|
167
168
|
handler: ToolHandler<any, any, any>;
|
|
168
169
|
strict?: boolean;
|
|
169
170
|
max_uses?: number;
|
|
@@ -199,7 +200,7 @@ type ParsedToolCallUnion<T extends ToolMap> = {
|
|
|
199
200
|
/**
|
|
200
201
|
* Function signature for appending tool results to a thread.
|
|
201
202
|
*/
|
|
202
|
-
type AppendToolResultFn = (config: ToolResultConfig) => Promise<void
|
|
203
|
+
type AppendToolResultFn = ActivityFunctionWithOptions<(config: ToolResultConfig) => Promise<void>>;
|
|
203
204
|
/**
|
|
204
205
|
* The response from a tool handler.
|
|
205
206
|
* Contains the content for the tool message and the result to return from processToolCalls.
|
|
@@ -415,7 +416,8 @@ interface ToolRouterOptions<T extends ToolMap> {
|
|
|
415
416
|
tools: T;
|
|
416
417
|
/** Thread ID for appending tool results */
|
|
417
418
|
threadId: string;
|
|
418
|
-
/** Function to append tool results to the thread (called automatically after each handler)
|
|
419
|
+
/** Function to append tool results to the thread (called automatically after each handler).
|
|
420
|
+
* Accepts a Temporal activity proxy with {@link ActivityFunctionWithOptions}. */
|
|
419
421
|
appendToolResult: AppendToolResultFn;
|
|
420
422
|
/** Whether to process tools in parallel (default: true) */
|
|
421
423
|
parallel?: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { ActivityFunctionWithOptions } from '@temporalio/workflow';
|
|
2
3
|
|
|
3
4
|
/** A single content part within a structured message (text, image, etc.) */
|
|
4
5
|
type ContentPart = {
|
|
@@ -162,8 +163,8 @@ interface ToolWithHandler<TName extends string = string, TSchema extends z.ZodTy
|
|
|
162
163
|
*/
|
|
163
164
|
type ToolMap = Record<string, {
|
|
164
165
|
name: string;
|
|
165
|
-
description: string;
|
|
166
|
-
schema: z.ZodType;
|
|
166
|
+
description: string | (() => string);
|
|
167
|
+
schema: z.ZodType | (() => z.ZodType);
|
|
167
168
|
handler: ToolHandler<any, any, any>;
|
|
168
169
|
strict?: boolean;
|
|
169
170
|
max_uses?: number;
|
|
@@ -199,7 +200,7 @@ type ParsedToolCallUnion<T extends ToolMap> = {
|
|
|
199
200
|
/**
|
|
200
201
|
* Function signature for appending tool results to a thread.
|
|
201
202
|
*/
|
|
202
|
-
type AppendToolResultFn = (config: ToolResultConfig) => Promise<void
|
|
203
|
+
type AppendToolResultFn = ActivityFunctionWithOptions<(config: ToolResultConfig) => Promise<void>>;
|
|
203
204
|
/**
|
|
204
205
|
* The response from a tool handler.
|
|
205
206
|
* Contains the content for the tool message and the result to return from processToolCalls.
|
|
@@ -415,7 +416,8 @@ interface ToolRouterOptions<T extends ToolMap> {
|
|
|
415
416
|
tools: T;
|
|
416
417
|
/** Thread ID for appending tool results */
|
|
417
418
|
threadId: string;
|
|
418
|
-
/** Function to append tool results to the thread (called automatically after each handler)
|
|
419
|
+
/** Function to append tool results to the thread (called automatically after each handler).
|
|
420
|
+
* Accepts a Temporal activity proxy with {@link ActivityFunctionWithOptions}. */
|
|
419
421
|
appendToolResult: AppendToolResultFn;
|
|
420
422
|
/** Whether to process tools in parallel (default: true) */
|
|
421
423
|
parallel?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration } from '@temporalio/common';
|
|
2
|
-
import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-
|
|
2
|
+
import { a as ToolMap, b as ToolRouterHooks, M as MessageContent, S as SessionExitReason, c as ToolHandlerResponse, P as PreToolUseHookResult, d as PostToolUseFailureHookResult, e as RawToolCall, f as TokenUsage, B as BaseAgentState, g as RunAgentConfig, h as AgentStatus, W as WorkflowTask, i as ToolDefinition, j as ToolResultConfig, k as ToolCallResultUnion, I as InferToolResults } from './types-Ct2igz9y.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { g as SandboxOps } from './types-BMRzfELQ.cjs';
|
|
5
|
-
import { QueryDefinition } from '@temporalio/workflow';
|
|
5
|
+
import { QueryDefinition, ActivityInterfaceFor } from '@temporalio/workflow';
|
|
6
6
|
import { UpdateDefinition } from '@temporalio/common/lib/interfaces';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -367,7 +367,7 @@ interface SessionConfig<T extends ToolMap, M = unknown> {
|
|
|
367
367
|
/** Workflow-specific runAgent activity (with tools pre-bound) */
|
|
368
368
|
runAgent: RunAgentActivity<M>;
|
|
369
369
|
/** Thread operations (initialize, append messages, parse tool calls) */
|
|
370
|
-
threadOps?: ThreadOps
|
|
370
|
+
threadOps?: ActivityInterfaceFor<ThreadOps>;
|
|
371
371
|
/** Tool router for processing tool calls (optional if agent has no tools) */
|
|
372
372
|
tools?: T;
|
|
373
373
|
/** Subagent configurations */
|
package/dist/workflow.cjs
CHANGED
|
@@ -15,7 +15,8 @@ function createToolRouter(options) {
|
|
|
15
15
|
for (const [_key, tool] of Object.entries(options.tools)) {
|
|
16
16
|
toolMap.set(tool.name, tool);
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const resolve = (v) => typeof v === "function" ? v() : v;
|
|
19
|
+
const isEnabled = (tool) => resolve(tool.enabled) ?? true;
|
|
19
20
|
if (options.plugins) {
|
|
20
21
|
for (const plugin of options.plugins) {
|
|
21
22
|
toolMap.set(plugin.name, plugin);
|
|
@@ -56,7 +57,10 @@ function createToolRouter(options) {
|
|
|
56
57
|
turn
|
|
57
58
|
});
|
|
58
59
|
if (r?.fallbackContent !== void 0)
|
|
59
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
content: r.fallbackContent,
|
|
62
|
+
result: { error: errorStr, recovered: true }
|
|
63
|
+
};
|
|
60
64
|
if (r?.suppress)
|
|
61
65
|
return {
|
|
62
66
|
content: JSON.stringify({ error: errorStr, suppressed: true }),
|
|
@@ -71,7 +75,10 @@ function createToolRouter(options) {
|
|
|
71
75
|
turn
|
|
72
76
|
});
|
|
73
77
|
if (r?.fallbackContent !== void 0)
|
|
74
|
-
return {
|
|
78
|
+
return {
|
|
79
|
+
content: r.fallbackContent,
|
|
80
|
+
result: { error: errorStr, recovered: true }
|
|
81
|
+
};
|
|
75
82
|
if (r?.suppress)
|
|
76
83
|
return {
|
|
77
84
|
content: JSON.stringify({ error: errorStr, suppressed: true }),
|
|
@@ -109,7 +116,10 @@ function createToolRouter(options) {
|
|
|
109
116
|
threadId: options.threadId,
|
|
110
117
|
toolCallId: toolCall.id,
|
|
111
118
|
toolName: toolCall.name,
|
|
112
|
-
content: JSON.stringify({
|
|
119
|
+
content: JSON.stringify({
|
|
120
|
+
skipped: true,
|
|
121
|
+
reason: "Skipped by PreToolUse hook"
|
|
122
|
+
})
|
|
113
123
|
});
|
|
114
124
|
return null;
|
|
115
125
|
}
|
|
@@ -137,24 +147,43 @@ function createToolRouter(options) {
|
|
|
137
147
|
content = JSON.stringify(result, null, 2);
|
|
138
148
|
}
|
|
139
149
|
} catch (error) {
|
|
140
|
-
const recovery = await runFailureHooks(
|
|
150
|
+
const recovery = await runFailureHooks(
|
|
151
|
+
toolCall,
|
|
152
|
+
tool,
|
|
153
|
+
error,
|
|
154
|
+
effectiveArgs,
|
|
155
|
+
turn
|
|
156
|
+
);
|
|
141
157
|
result = recovery.result;
|
|
142
158
|
content = recovery.content;
|
|
143
159
|
}
|
|
144
160
|
if (!resultAppended) {
|
|
145
|
-
|
|
161
|
+
const config = {
|
|
146
162
|
threadId: options.threadId,
|
|
147
163
|
toolCallId: toolCall.id,
|
|
148
164
|
toolName: toolCall.name,
|
|
149
165
|
content
|
|
150
|
-
}
|
|
166
|
+
};
|
|
167
|
+
await appendToolResult.executeWithOptions(
|
|
168
|
+
{
|
|
169
|
+
summary: `Append ${toolCall.name} result`
|
|
170
|
+
},
|
|
171
|
+
[config]
|
|
172
|
+
);
|
|
151
173
|
}
|
|
152
174
|
const toolResult = {
|
|
153
175
|
toolCallId: toolCall.id,
|
|
154
176
|
name: toolCall.name,
|
|
155
177
|
data: result
|
|
156
178
|
};
|
|
157
|
-
await runPostHooks(
|
|
179
|
+
await runPostHooks(
|
|
180
|
+
toolCall,
|
|
181
|
+
tool,
|
|
182
|
+
toolResult,
|
|
183
|
+
effectiveArgs,
|
|
184
|
+
turn,
|
|
185
|
+
Date.now() - startTime
|
|
186
|
+
);
|
|
158
187
|
return toolResult;
|
|
159
188
|
}
|
|
160
189
|
return {
|
|
@@ -166,7 +195,7 @@ function createToolRouter(options) {
|
|
|
166
195
|
if (!tool || !isEnabled(tool)) {
|
|
167
196
|
throw new Error(`Tool ${toolCall.name} not found`);
|
|
168
197
|
}
|
|
169
|
-
const parsedArgs = tool.schema.parse(toolCall.args);
|
|
198
|
+
const parsedArgs = resolve(tool.schema).parse(toolCall.args);
|
|
170
199
|
return {
|
|
171
200
|
id: toolCall.id ?? "",
|
|
172
201
|
name: toolCall.name,
|
|
@@ -183,8 +212,8 @@ function createToolRouter(options) {
|
|
|
183
212
|
getToolDefinitions() {
|
|
184
213
|
return Array.from(toolMap).filter(([, tool]) => isEnabled(tool)).map(([name, tool]) => ({
|
|
185
214
|
name,
|
|
186
|
-
description: tool.description,
|
|
187
|
-
schema: tool.schema,
|
|
215
|
+
description: resolve(tool.description),
|
|
216
|
+
schema: resolve(tool.schema),
|
|
188
217
|
strict: tool.strict,
|
|
189
218
|
max_uses: tool.max_uses
|
|
190
219
|
}));
|
|
@@ -197,9 +226,7 @@ function createToolRouter(options) {
|
|
|
197
226
|
const sandboxId = context?.sandboxId;
|
|
198
227
|
if (options.parallel) {
|
|
199
228
|
const results2 = await Promise.all(
|
|
200
|
-
toolCalls.map(
|
|
201
|
-
(tc) => processToolCall(tc, turn, sandboxId)
|
|
202
|
-
)
|
|
229
|
+
toolCalls.map((tc) => processToolCall(tc, turn, sandboxId))
|
|
203
230
|
);
|
|
204
231
|
return results2.filter(
|
|
205
232
|
(r) => r !== null
|
|
@@ -207,11 +234,7 @@ function createToolRouter(options) {
|
|
|
207
234
|
}
|
|
208
235
|
const results = [];
|
|
209
236
|
for (const toolCall of toolCalls) {
|
|
210
|
-
const result = await processToolCall(
|
|
211
|
-
toolCall,
|
|
212
|
-
turn,
|
|
213
|
-
sandboxId
|
|
214
|
-
);
|
|
237
|
+
const result = await processToolCall(toolCall, turn, sandboxId);
|
|
215
238
|
if (result !== null) {
|
|
216
239
|
results.push(result);
|
|
217
240
|
}
|
|
@@ -228,19 +251,28 @@ function createToolRouter(options) {
|
|
|
228
251
|
threadId: options.threadId,
|
|
229
252
|
toolCallId: toolCall.id,
|
|
230
253
|
toolName: toolCall.name,
|
|
231
|
-
...context?.sandboxId !== void 0 && {
|
|
254
|
+
...context?.sandboxId !== void 0 && {
|
|
255
|
+
sandboxId: context.sandboxId
|
|
256
|
+
}
|
|
232
257
|
};
|
|
233
258
|
const response = await handler(
|
|
234
259
|
toolCall.args,
|
|
235
260
|
routerContext
|
|
236
261
|
);
|
|
237
262
|
if (!response.resultAppended) {
|
|
238
|
-
await appendToolResult(
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
263
|
+
await appendToolResult.executeWithOptions(
|
|
264
|
+
{
|
|
265
|
+
summary: `Append ${toolCall.name} result`
|
|
266
|
+
},
|
|
267
|
+
[
|
|
268
|
+
{
|
|
269
|
+
threadId: options.threadId,
|
|
270
|
+
toolCallId: toolCall.id,
|
|
271
|
+
toolName: toolCall.name,
|
|
272
|
+
content: response.toolResponse
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
);
|
|
244
276
|
}
|
|
245
277
|
return {
|
|
246
278
|
toolCallId: toolCall.id,
|
|
@@ -315,7 +347,7 @@ function createSubagentTool(subagents) {
|
|
|
315
347
|
const schema = hasThreadContinuation ? z14__default.default.object({
|
|
316
348
|
...baseFields,
|
|
317
349
|
threadId: z14__default.default.string().nullable().describe(
|
|
318
|
-
"Thread ID to continue an existing conversation, or null to start a new one"
|
|
350
|
+
"Thread ID to continue an existing conversation from the same subagent, or null to start a new one"
|
|
319
351
|
)
|
|
320
352
|
}) : z14__default.default.object(baseFields);
|
|
321
353
|
return {
|
|
@@ -372,7 +404,7 @@ function createSubagentHandler(subagents) {
|
|
|
372
404
|
if (config.allowThreadContinuation && childThreadId) {
|
|
373
405
|
finalToolResponse = typeof toolResponse === "string" ? `${toolResponse}
|
|
374
406
|
|
|
375
|
-
[Thread ID: ${childThreadId}]` : toolResponse;
|
|
407
|
+
[${config.agentName} Thread ID: ${childThreadId}]` : toolResponse;
|
|
376
408
|
}
|
|
377
409
|
return {
|
|
378
410
|
toolResponse: finalToolResponse,
|
|
@@ -395,15 +427,9 @@ function buildSubagentRegistration(subagents) {
|
|
|
395
427
|
const resolveSubagentName = (args) => args.subagent;
|
|
396
428
|
return {
|
|
397
429
|
name: SUBAGENT_TOOL_NAME,
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
get description() {
|
|
402
|
-
return createSubagentTool(getEnabled()).description;
|
|
403
|
-
},
|
|
404
|
-
get schema() {
|
|
405
|
-
return createSubagentTool(getEnabled()).schema;
|
|
406
|
-
},
|
|
430
|
+
enabled: () => getEnabled().length > 0,
|
|
431
|
+
description: () => createSubagentTool(getEnabled()).description,
|
|
432
|
+
schema: () => createSubagentTool(getEnabled()).schema,
|
|
407
433
|
handler: createSubagentHandler(subagents),
|
|
408
434
|
...subagentHooksMap.size > 0 && {
|
|
409
435
|
hooks: {
|
|
@@ -701,8 +727,8 @@ function proxySandboxOps(options) {
|
|
|
701
727
|
}
|
|
702
728
|
|
|
703
729
|
// src/lib/workflow.ts
|
|
704
|
-
function defineWorkflow(fn) {
|
|
705
|
-
|
|
730
|
+
function defineWorkflow(config, fn) {
|
|
731
|
+
const workflow = async (input, workflowInput = {}) => {
|
|
706
732
|
const sessionInput = {
|
|
707
733
|
...workflowInput.previousThreadId && {
|
|
708
734
|
threadId: workflowInput.previousThreadId,
|
|
@@ -712,6 +738,8 @@ function defineWorkflow(fn) {
|
|
|
712
738
|
};
|
|
713
739
|
return fn(input, sessionInput);
|
|
714
740
|
};
|
|
741
|
+
Object.defineProperty(workflow, "name", { value: config.name });
|
|
742
|
+
return workflow;
|
|
715
743
|
}
|
|
716
744
|
|
|
717
745
|
// src/lib/types.ts
|
|
@@ -1278,10 +1306,12 @@ var taskCreateTool = {
|
|
|
1278
1306
|
metadata: z14__default.default.record(z14__default.default.string(), z14__default.default.string()).describe("Arbitrary key-value pairs for tracking")
|
|
1279
1307
|
})
|
|
1280
1308
|
};
|
|
1309
|
+
|
|
1310
|
+
// src/tools/task-create/handler.ts
|
|
1281
1311
|
function createTaskCreateHandler(stateManager) {
|
|
1282
1312
|
return (args) => {
|
|
1283
1313
|
const task = {
|
|
1284
|
-
id:
|
|
1314
|
+
id: getShortId(),
|
|
1285
1315
|
subject: args.subject,
|
|
1286
1316
|
description: args.description,
|
|
1287
1317
|
activeForm: args.activeForm,
|