@denizokcu/haze 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -7
- package/README.md +81 -34
- package/dist/cli/chat/TaskBar.d.ts +9 -0
- package/dist/cli/chat/TaskBar.js +40 -0
- package/dist/cli/chat/chatMetrics.d.ts +11 -0
- package/dist/cli/chat/chatMetrics.js +50 -0
- package/dist/cli/chat/inputSuggestions.d.ts +16 -0
- package/dist/cli/chat/inputSuggestions.js +55 -0
- package/dist/cli/chat/messages.d.ts +9 -0
- package/dist/cli/chat/messages.js +76 -0
- package/dist/cli/chat/sessionRecorder.d.ts +12 -0
- package/dist/cli/chat/sessionRecorder.js +21 -0
- package/dist/cli/chat/startupInfo.d.ts +4 -0
- package/dist/cli/chat/startupInfo.js +53 -0
- package/dist/cli/chat/turnState.d.ts +5 -0
- package/dist/cli/chat/turnState.js +20 -0
- package/dist/cli/commands/chat.d.ts +0 -1
- package/dist/cli/commands/chat.js +331 -906
- package/dist/cli/commands/chatModes.d.ts +8 -0
- package/dist/cli/commands/chatModes.js +44 -0
- package/dist/cli/commands/commandHelp.d.ts +6 -0
- package/dist/cli/commands/commandHelp.js +25 -0
- package/dist/cli/commands/commands.d.ts +1 -1
- package/dist/cli/commands/commands.js +41 -267
- package/dist/cli/commands/formatters.d.ts +6 -0
- package/dist/cli/commands/formatters.js +50 -4
- package/dist/cli/commands/initCommand.d.ts +2 -0
- package/dist/cli/commands/initCommand.js +19 -0
- package/dist/cli/commands/logsCommand.d.ts +2 -0
- package/dist/cli/commands/logsCommand.js +63 -0
- package/dist/cli/commands/lspWizard.d.ts +14 -0
- package/dist/cli/commands/lspWizard.js +44 -0
- package/dist/cli/commands/mcpWizard.d.ts +15 -0
- package/dist/cli/commands/mcpWizard.js +69 -0
- package/dist/cli/commands/modelCommand.d.ts +2 -0
- package/dist/cli/commands/modelCommand.js +36 -0
- package/dist/cli/commands/providerWizard.d.ts +30 -0
- package/dist/cli/commands/providerWizard.js +114 -0
- package/dist/cli/commands/runCommand.d.ts +16 -0
- package/dist/cli/commands/runCommand.js +170 -0
- package/dist/cli/commands/settingsSummary.d.ts +3 -0
- package/dist/cli/commands/settingsSummary.js +40 -0
- package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
- package/dist/cli/commands/skillConfirmRemove.js +19 -0
- package/dist/cli/commands/skillCreation.d.ts +12 -0
- package/dist/cli/commands/skillCreation.js +14 -0
- package/dist/cli/commands/skillWizard.d.ts +15 -0
- package/dist/cli/commands/skillWizard.js +38 -0
- package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
- package/dist/cli/commands/streaming/assistantText.js +115 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
- package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
- package/dist/cli/commands/streaming/toolResultState.js +25 -0
- package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
- package/dist/cli/commands/streaming/turnRuntime.js +86 -0
- package/dist/cli/commands/streaming.d.ts +9 -25
- package/dist/cli/commands/streaming.js +109 -363
- package/dist/cli/commands/wizardActions.d.ts +40 -0
- package/dist/cli/commands/wizardActions.js +40 -0
- package/dist/cli/commands/wizardInput.d.ts +4 -0
- package/dist/cli/commands/wizardInput.js +19 -0
- package/dist/cli/commands/wizardPrompts.d.ts +22 -0
- package/dist/cli/commands/wizardPrompts.js +52 -0
- package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
- package/dist/cli/commands/wizardSuggestions.js +139 -0
- package/dist/cli/index.js +62 -4
- package/dist/config/contextFiles.d.ts +8 -1
- package/dist/config/contextFiles.js +25 -12
- package/dist/config/lspSettings.js +3 -6
- package/dist/config/mcpSettings.js +5 -5
- package/dist/config/providers.js +8 -12
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +54 -2
- package/dist/config/skillSettings.js +4 -3
- package/dist/core/agent/budgets.d.ts +6 -0
- package/dist/core/agent/budgets.js +6 -0
- package/dist/core/agent/compaction.js +3 -3
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/requestAssembly.d.ts +1 -7
- package/dist/core/agent/requestAssembly.js +40 -5
- package/dist/core/agent/toolOutputStore.js +5 -4
- package/dist/core/agent/toolResults.d.ts +31 -0
- package/dist/core/agent/toolResults.js +42 -0
- package/dist/core/agent/turnPolicy.d.ts +8 -0
- package/dist/core/agent/turnPolicy.js +23 -0
- package/dist/core/agent/workState.d.ts +18 -5
- package/dist/core/agent/workState.js +39 -20
- package/dist/core/bashOutput/reducers/content.d.ts +1 -0
- package/dist/core/bashOutput/reducers/content.js +1 -1
- package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
- package/dist/core/bashOutput/reducers/gh.js +77 -0
- package/dist/core/bashOutput/registry.js +18 -8
- package/dist/core/goal/completionPolicy.js +1 -1
- package/dist/core/goal/sessionGoal.d.ts +6 -30
- package/dist/core/goal/sessionGoal.js +3 -68
- package/dist/core/safety/bashClassifier.js +30 -0
- package/dist/core/safety/urlGuard.d.ts +1 -0
- package/dist/core/safety/urlGuard.js +6 -1
- package/dist/core/session/sessionSlimming.d.ts +5 -0
- package/dist/core/session/sessionSlimming.js +78 -0
- package/dist/core/session/sessionStore.d.ts +23 -3
- package/dist/core/session/sessionStore.js +30 -10
- package/dist/core/subagent/subagentRunner.d.ts +258 -5
- package/dist/core/subagent/subagentRunner.js +14 -18
- package/dist/core/toolOutput/reduction.d.ts +2 -0
- package/dist/core/toolOutput/reduction.js +12 -0
- package/dist/core/validation/outputParser.js +5 -3
- package/dist/llm/capabilities.d.ts +12 -0
- package/dist/llm/capabilities.js +10 -0
- package/dist/llm/client.d.ts +3 -2
- package/dist/llm/client.js +26 -4
- package/dist/llm/hazeTools.d.ts +7710 -366
- package/dist/llm/hazeTools.js +46 -567
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp.d.ts +46 -1
- package/dist/llm/lsp.js +19 -10
- package/dist/llm/lspTools.d.ts +2310 -119
- package/dist/llm/mcp.js +9 -0
- package/dist/llm/requestContext.js +7 -22
- package/dist/llm/systemPrompt.d.ts +1 -0
- package/dist/llm/systemPrompt.js +3 -3
- package/dist/llm/tools/bashTool.d.ts +251 -0
- package/dist/llm/tools/bashTool.js +82 -0
- package/dist/llm/tools/editMatch.d.ts +55 -0
- package/dist/llm/tools/editMatch.js +99 -0
- package/dist/llm/tools/failures.d.ts +36 -0
- package/dist/llm/tools/failures.js +38 -0
- package/dist/llm/tools/fetchTool.d.ts +1201 -0
- package/dist/llm/tools/fetchTool.js +46 -0
- package/dist/llm/tools/fileToolShared.d.ts +10 -0
- package/dist/llm/tools/fileToolShared.js +43 -0
- package/dist/llm/tools/grepParse.d.ts +13 -0
- package/dist/llm/tools/grepParse.js +67 -0
- package/dist/llm/tools/outputCap.d.ts +53 -0
- package/dist/llm/tools/outputCap.js +67 -0
- package/dist/llm/tools/storedOutputTool.d.ts +351 -0
- package/dist/llm/tools/storedOutputTool.js +17 -0
- package/dist/llm/tools/taskTool.d.ts +629 -0
- package/dist/llm/tools/taskTool.js +41 -0
- package/dist/llm/tools/toolContext.d.ts +74 -0
- package/dist/llm/tools/toolContext.js +196 -0
- package/dist/llm/tools/workspaceFile.d.ts +33 -0
- package/dist/llm/tools/workspaceFile.js +27 -0
- package/dist/llm/webFetch.d.ts +13 -1
- package/dist/llm/webFetch.js +122 -28
- package/dist/skills/builder/SkillBuilder.d.ts +3 -0
- package/dist/skills/builder/SkillBuilder.js +8 -8
- package/dist/ui/components/TextInput.d.ts +7 -0
- package/dist/ui/components/TextInput.js +10 -98
- package/dist/ui/inputBuffer.d.ts +28 -0
- package/dist/ui/inputBuffer.js +99 -0
- package/dist/utils/collections.d.ts +6 -0
- package/dist/utils/collections.js +9 -0
- package/dist/utils/modelName.d.ts +2 -0
- package/dist/utils/modelName.js +15 -0
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +40 -0
- package/examples/skills/files/SKILL.md +1 -1
- package/package.json +14 -15
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
export declare const writeTasksTool: ({
|
|
2
|
+
title?: string;
|
|
3
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
4
|
+
metadata?: import("@ai-sdk/provider").JSONObject;
|
|
5
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
6
|
+
tasks: {
|
|
7
|
+
title: string;
|
|
8
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
9
|
+
}[];
|
|
10
|
+
}>;
|
|
11
|
+
contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
|
|
12
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
13
|
+
tasks: {
|
|
14
|
+
title: string;
|
|
15
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>> | undefined;
|
|
18
|
+
onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
19
|
+
onInputDelta?: ((options: {
|
|
20
|
+
inputTextDelta: string;
|
|
21
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
22
|
+
onInputAvailable?: ((options: {
|
|
23
|
+
input: {
|
|
24
|
+
tasks: {
|
|
25
|
+
title: string;
|
|
26
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
30
|
+
toModelOutput?: ((options: {
|
|
31
|
+
toolCallId: string;
|
|
32
|
+
input: {
|
|
33
|
+
tasks: {
|
|
34
|
+
title: string;
|
|
35
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
output: NoInfer<{
|
|
39
|
+
ok: boolean;
|
|
40
|
+
error: string;
|
|
41
|
+
taskCount?: undefined;
|
|
42
|
+
summary?: undefined;
|
|
43
|
+
counts?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
ok: boolean;
|
|
46
|
+
taskCount: number;
|
|
47
|
+
summary: string;
|
|
48
|
+
error?: undefined;
|
|
49
|
+
counts?: undefined;
|
|
50
|
+
} | {
|
|
51
|
+
ok: boolean;
|
|
52
|
+
taskCount: number;
|
|
53
|
+
counts: {
|
|
54
|
+
pending: number;
|
|
55
|
+
in_progress: number;
|
|
56
|
+
completed: number;
|
|
57
|
+
};
|
|
58
|
+
summary: string;
|
|
59
|
+
error?: undefined;
|
|
60
|
+
}>;
|
|
61
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
62
|
+
} & {
|
|
63
|
+
outputSchema?: import("ai").FlexibleSchema<{
|
|
64
|
+
ok: boolean;
|
|
65
|
+
error: string;
|
|
66
|
+
taskCount?: undefined;
|
|
67
|
+
summary?: undefined;
|
|
68
|
+
counts?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
taskCount: number;
|
|
72
|
+
summary: string;
|
|
73
|
+
error?: undefined;
|
|
74
|
+
counts?: undefined;
|
|
75
|
+
} | {
|
|
76
|
+
ok: boolean;
|
|
77
|
+
taskCount: number;
|
|
78
|
+
counts: {
|
|
79
|
+
pending: number;
|
|
80
|
+
in_progress: number;
|
|
81
|
+
completed: number;
|
|
82
|
+
};
|
|
83
|
+
summary: string;
|
|
84
|
+
error?: undefined;
|
|
85
|
+
}> | undefined;
|
|
86
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
87
|
+
tasks: {
|
|
88
|
+
title: string;
|
|
89
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
90
|
+
}[];
|
|
91
|
+
}, {
|
|
92
|
+
ok: boolean;
|
|
93
|
+
error: string;
|
|
94
|
+
taskCount?: undefined;
|
|
95
|
+
summary?: undefined;
|
|
96
|
+
counts?: undefined;
|
|
97
|
+
} | {
|
|
98
|
+
ok: boolean;
|
|
99
|
+
taskCount: number;
|
|
100
|
+
summary: string;
|
|
101
|
+
error?: undefined;
|
|
102
|
+
counts?: undefined;
|
|
103
|
+
} | {
|
|
104
|
+
ok: boolean;
|
|
105
|
+
taskCount: number;
|
|
106
|
+
counts: {
|
|
107
|
+
pending: number;
|
|
108
|
+
in_progress: number;
|
|
109
|
+
completed: number;
|
|
110
|
+
};
|
|
111
|
+
summary: string;
|
|
112
|
+
error?: undefined;
|
|
113
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
114
|
+
} & {
|
|
115
|
+
description?: string | ((options: {
|
|
116
|
+
context: NoInfer<import("@ai-sdk/provider-utils").Context>;
|
|
117
|
+
experimental_sandbox?: import("ai").Experimental_SandboxSession;
|
|
118
|
+
}) => string) | undefined;
|
|
119
|
+
strict?: boolean;
|
|
120
|
+
inputExamples?: {
|
|
121
|
+
input: NoInfer<{
|
|
122
|
+
tasks: {
|
|
123
|
+
title: string;
|
|
124
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
125
|
+
}[];
|
|
126
|
+
}>;
|
|
127
|
+
}[] | undefined;
|
|
128
|
+
id?: never;
|
|
129
|
+
isProviderExecuted?: never;
|
|
130
|
+
args?: never;
|
|
131
|
+
supportsDeferredResults?: never;
|
|
132
|
+
} & {
|
|
133
|
+
type?: undefined | "function";
|
|
134
|
+
} & {
|
|
135
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
136
|
+
tasks: {
|
|
137
|
+
title: string;
|
|
138
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
139
|
+
}[];
|
|
140
|
+
}, {
|
|
141
|
+
ok: boolean;
|
|
142
|
+
error: string;
|
|
143
|
+
taskCount?: undefined;
|
|
144
|
+
summary?: undefined;
|
|
145
|
+
counts?: undefined;
|
|
146
|
+
} | {
|
|
147
|
+
ok: boolean;
|
|
148
|
+
taskCount: number;
|
|
149
|
+
summary: string;
|
|
150
|
+
error?: undefined;
|
|
151
|
+
counts?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
ok: boolean;
|
|
154
|
+
taskCount: number;
|
|
155
|
+
counts: {
|
|
156
|
+
pending: number;
|
|
157
|
+
in_progress: number;
|
|
158
|
+
completed: number;
|
|
159
|
+
};
|
|
160
|
+
summary: string;
|
|
161
|
+
error?: undefined;
|
|
162
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
163
|
+
}) | ({
|
|
164
|
+
title?: string;
|
|
165
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
166
|
+
metadata?: import("@ai-sdk/provider").JSONObject;
|
|
167
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
168
|
+
tasks: {
|
|
169
|
+
title: string;
|
|
170
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
171
|
+
}[];
|
|
172
|
+
}>;
|
|
173
|
+
contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
|
|
174
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
175
|
+
tasks: {
|
|
176
|
+
title: string;
|
|
177
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
178
|
+
}[];
|
|
179
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>> | undefined;
|
|
180
|
+
onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
181
|
+
onInputDelta?: ((options: {
|
|
182
|
+
inputTextDelta: string;
|
|
183
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
184
|
+
onInputAvailable?: ((options: {
|
|
185
|
+
input: {
|
|
186
|
+
tasks: {
|
|
187
|
+
title: string;
|
|
188
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
189
|
+
}[];
|
|
190
|
+
};
|
|
191
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
192
|
+
toModelOutput?: ((options: {
|
|
193
|
+
toolCallId: string;
|
|
194
|
+
input: {
|
|
195
|
+
tasks: {
|
|
196
|
+
title: string;
|
|
197
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
198
|
+
}[];
|
|
199
|
+
};
|
|
200
|
+
output: NoInfer<{
|
|
201
|
+
ok: boolean;
|
|
202
|
+
error: string;
|
|
203
|
+
taskCount?: undefined;
|
|
204
|
+
summary?: undefined;
|
|
205
|
+
counts?: undefined;
|
|
206
|
+
} | {
|
|
207
|
+
ok: boolean;
|
|
208
|
+
taskCount: number;
|
|
209
|
+
summary: string;
|
|
210
|
+
error?: undefined;
|
|
211
|
+
counts?: undefined;
|
|
212
|
+
} | {
|
|
213
|
+
ok: boolean;
|
|
214
|
+
taskCount: number;
|
|
215
|
+
counts: {
|
|
216
|
+
pending: number;
|
|
217
|
+
in_progress: number;
|
|
218
|
+
completed: number;
|
|
219
|
+
};
|
|
220
|
+
summary: string;
|
|
221
|
+
error?: undefined;
|
|
222
|
+
}>;
|
|
223
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
224
|
+
} & {
|
|
225
|
+
outputSchema?: import("ai").FlexibleSchema<{
|
|
226
|
+
ok: boolean;
|
|
227
|
+
error: string;
|
|
228
|
+
taskCount?: undefined;
|
|
229
|
+
summary?: undefined;
|
|
230
|
+
counts?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
ok: boolean;
|
|
233
|
+
taskCount: number;
|
|
234
|
+
summary: string;
|
|
235
|
+
error?: undefined;
|
|
236
|
+
counts?: undefined;
|
|
237
|
+
} | {
|
|
238
|
+
ok: boolean;
|
|
239
|
+
taskCount: number;
|
|
240
|
+
counts: {
|
|
241
|
+
pending: number;
|
|
242
|
+
in_progress: number;
|
|
243
|
+
completed: number;
|
|
244
|
+
};
|
|
245
|
+
summary: string;
|
|
246
|
+
error?: undefined;
|
|
247
|
+
}> | undefined;
|
|
248
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
249
|
+
tasks: {
|
|
250
|
+
title: string;
|
|
251
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
}, {
|
|
254
|
+
ok: boolean;
|
|
255
|
+
error: string;
|
|
256
|
+
taskCount?: undefined;
|
|
257
|
+
summary?: undefined;
|
|
258
|
+
counts?: undefined;
|
|
259
|
+
} | {
|
|
260
|
+
ok: boolean;
|
|
261
|
+
taskCount: number;
|
|
262
|
+
summary: string;
|
|
263
|
+
error?: undefined;
|
|
264
|
+
counts?: undefined;
|
|
265
|
+
} | {
|
|
266
|
+
ok: boolean;
|
|
267
|
+
taskCount: number;
|
|
268
|
+
counts: {
|
|
269
|
+
pending: number;
|
|
270
|
+
in_progress: number;
|
|
271
|
+
completed: number;
|
|
272
|
+
};
|
|
273
|
+
summary: string;
|
|
274
|
+
error?: undefined;
|
|
275
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
276
|
+
} & {
|
|
277
|
+
description?: string | ((options: {
|
|
278
|
+
context: NoInfer<import("@ai-sdk/provider-utils").Context>;
|
|
279
|
+
experimental_sandbox?: import("ai").Experimental_SandboxSession;
|
|
280
|
+
}) => string) | undefined;
|
|
281
|
+
strict?: boolean;
|
|
282
|
+
inputExamples?: {
|
|
283
|
+
input: NoInfer<{
|
|
284
|
+
tasks: {
|
|
285
|
+
title: string;
|
|
286
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
287
|
+
}[];
|
|
288
|
+
}>;
|
|
289
|
+
}[] | undefined;
|
|
290
|
+
id?: never;
|
|
291
|
+
isProviderExecuted?: never;
|
|
292
|
+
args?: never;
|
|
293
|
+
supportsDeferredResults?: never;
|
|
294
|
+
} & {
|
|
295
|
+
type: "dynamic";
|
|
296
|
+
} & {
|
|
297
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
298
|
+
tasks: {
|
|
299
|
+
title: string;
|
|
300
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
301
|
+
}[];
|
|
302
|
+
}, {
|
|
303
|
+
ok: boolean;
|
|
304
|
+
error: string;
|
|
305
|
+
taskCount?: undefined;
|
|
306
|
+
summary?: undefined;
|
|
307
|
+
counts?: undefined;
|
|
308
|
+
} | {
|
|
309
|
+
ok: boolean;
|
|
310
|
+
taskCount: number;
|
|
311
|
+
summary: string;
|
|
312
|
+
error?: undefined;
|
|
313
|
+
counts?: undefined;
|
|
314
|
+
} | {
|
|
315
|
+
ok: boolean;
|
|
316
|
+
taskCount: number;
|
|
317
|
+
counts: {
|
|
318
|
+
pending: number;
|
|
319
|
+
in_progress: number;
|
|
320
|
+
completed: number;
|
|
321
|
+
};
|
|
322
|
+
summary: string;
|
|
323
|
+
error?: undefined;
|
|
324
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
325
|
+
}) | ({
|
|
326
|
+
title?: string;
|
|
327
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
328
|
+
metadata?: import("@ai-sdk/provider").JSONObject;
|
|
329
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
330
|
+
tasks: {
|
|
331
|
+
title: string;
|
|
332
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
333
|
+
}[];
|
|
334
|
+
}>;
|
|
335
|
+
contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
|
|
336
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
337
|
+
tasks: {
|
|
338
|
+
title: string;
|
|
339
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
340
|
+
}[];
|
|
341
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>> | undefined;
|
|
342
|
+
onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
343
|
+
onInputDelta?: ((options: {
|
|
344
|
+
inputTextDelta: string;
|
|
345
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
346
|
+
onInputAvailable?: ((options: {
|
|
347
|
+
input: {
|
|
348
|
+
tasks: {
|
|
349
|
+
title: string;
|
|
350
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
351
|
+
}[];
|
|
352
|
+
};
|
|
353
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
354
|
+
toModelOutput?: ((options: {
|
|
355
|
+
toolCallId: string;
|
|
356
|
+
input: {
|
|
357
|
+
tasks: {
|
|
358
|
+
title: string;
|
|
359
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
360
|
+
}[];
|
|
361
|
+
};
|
|
362
|
+
output: NoInfer<{
|
|
363
|
+
ok: boolean;
|
|
364
|
+
error: string;
|
|
365
|
+
taskCount?: undefined;
|
|
366
|
+
summary?: undefined;
|
|
367
|
+
counts?: undefined;
|
|
368
|
+
} | {
|
|
369
|
+
ok: boolean;
|
|
370
|
+
taskCount: number;
|
|
371
|
+
summary: string;
|
|
372
|
+
error?: undefined;
|
|
373
|
+
counts?: undefined;
|
|
374
|
+
} | {
|
|
375
|
+
ok: boolean;
|
|
376
|
+
taskCount: number;
|
|
377
|
+
counts: {
|
|
378
|
+
pending: number;
|
|
379
|
+
in_progress: number;
|
|
380
|
+
completed: number;
|
|
381
|
+
};
|
|
382
|
+
summary: string;
|
|
383
|
+
error?: undefined;
|
|
384
|
+
}>;
|
|
385
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
386
|
+
} & {
|
|
387
|
+
outputSchema?: import("ai").FlexibleSchema<{
|
|
388
|
+
ok: boolean;
|
|
389
|
+
error: string;
|
|
390
|
+
taskCount?: undefined;
|
|
391
|
+
summary?: undefined;
|
|
392
|
+
counts?: undefined;
|
|
393
|
+
} | {
|
|
394
|
+
ok: boolean;
|
|
395
|
+
taskCount: number;
|
|
396
|
+
summary: string;
|
|
397
|
+
error?: undefined;
|
|
398
|
+
counts?: undefined;
|
|
399
|
+
} | {
|
|
400
|
+
ok: boolean;
|
|
401
|
+
taskCount: number;
|
|
402
|
+
counts: {
|
|
403
|
+
pending: number;
|
|
404
|
+
in_progress: number;
|
|
405
|
+
completed: number;
|
|
406
|
+
};
|
|
407
|
+
summary: string;
|
|
408
|
+
error?: undefined;
|
|
409
|
+
}> | undefined;
|
|
410
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
411
|
+
tasks: {
|
|
412
|
+
title: string;
|
|
413
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
414
|
+
}[];
|
|
415
|
+
}, {
|
|
416
|
+
ok: boolean;
|
|
417
|
+
error: string;
|
|
418
|
+
taskCount?: undefined;
|
|
419
|
+
summary?: undefined;
|
|
420
|
+
counts?: undefined;
|
|
421
|
+
} | {
|
|
422
|
+
ok: boolean;
|
|
423
|
+
taskCount: number;
|
|
424
|
+
summary: string;
|
|
425
|
+
error?: undefined;
|
|
426
|
+
counts?: undefined;
|
|
427
|
+
} | {
|
|
428
|
+
ok: boolean;
|
|
429
|
+
taskCount: number;
|
|
430
|
+
counts: {
|
|
431
|
+
pending: number;
|
|
432
|
+
in_progress: number;
|
|
433
|
+
completed: number;
|
|
434
|
+
};
|
|
435
|
+
summary: string;
|
|
436
|
+
error?: undefined;
|
|
437
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
438
|
+
} & {
|
|
439
|
+
type: "provider";
|
|
440
|
+
id: `${string}.${string}`;
|
|
441
|
+
args: Record<string, unknown>;
|
|
442
|
+
description?: never;
|
|
443
|
+
strict?: never;
|
|
444
|
+
inputExamples?: never;
|
|
445
|
+
} & {
|
|
446
|
+
isProviderExecuted: false;
|
|
447
|
+
supportsDeferredResults?: never;
|
|
448
|
+
} & {
|
|
449
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
450
|
+
tasks: {
|
|
451
|
+
title: string;
|
|
452
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
453
|
+
}[];
|
|
454
|
+
}, {
|
|
455
|
+
ok: boolean;
|
|
456
|
+
error: string;
|
|
457
|
+
taskCount?: undefined;
|
|
458
|
+
summary?: undefined;
|
|
459
|
+
counts?: undefined;
|
|
460
|
+
} | {
|
|
461
|
+
ok: boolean;
|
|
462
|
+
taskCount: number;
|
|
463
|
+
summary: string;
|
|
464
|
+
error?: undefined;
|
|
465
|
+
counts?: undefined;
|
|
466
|
+
} | {
|
|
467
|
+
ok: boolean;
|
|
468
|
+
taskCount: number;
|
|
469
|
+
counts: {
|
|
470
|
+
pending: number;
|
|
471
|
+
in_progress: number;
|
|
472
|
+
completed: number;
|
|
473
|
+
};
|
|
474
|
+
summary: string;
|
|
475
|
+
error?: undefined;
|
|
476
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
477
|
+
}) | ({
|
|
478
|
+
title?: string;
|
|
479
|
+
providerOptions?: import("@ai-sdk/provider-utils").ProviderOptions;
|
|
480
|
+
metadata?: import("@ai-sdk/provider").JSONObject;
|
|
481
|
+
inputSchema: import("ai").FlexibleSchema<{
|
|
482
|
+
tasks: {
|
|
483
|
+
title: string;
|
|
484
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
485
|
+
}[];
|
|
486
|
+
}>;
|
|
487
|
+
contextSchema?: import("ai").FlexibleSchema<import("@ai-sdk/provider-utils").Context> | undefined;
|
|
488
|
+
needsApproval?: boolean | import("@ai-sdk/provider-utils").ToolNeedsApprovalFunction<{
|
|
489
|
+
tasks: {
|
|
490
|
+
title: string;
|
|
491
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
492
|
+
}[];
|
|
493
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>> | undefined;
|
|
494
|
+
onInputStart?: ((options: import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
495
|
+
onInputDelta?: ((options: {
|
|
496
|
+
inputTextDelta: string;
|
|
497
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
498
|
+
onInputAvailable?: ((options: {
|
|
499
|
+
input: {
|
|
500
|
+
tasks: {
|
|
501
|
+
title: string;
|
|
502
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
503
|
+
}[];
|
|
504
|
+
};
|
|
505
|
+
} & import("ai").ToolExecutionOptions<NoInfer<import("@ai-sdk/provider-utils").Context>>) => void | PromiseLike<void>) | undefined;
|
|
506
|
+
toModelOutput?: ((options: {
|
|
507
|
+
toolCallId: string;
|
|
508
|
+
input: {
|
|
509
|
+
tasks: {
|
|
510
|
+
title: string;
|
|
511
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
512
|
+
}[];
|
|
513
|
+
};
|
|
514
|
+
output: NoInfer<{
|
|
515
|
+
ok: boolean;
|
|
516
|
+
error: string;
|
|
517
|
+
taskCount?: undefined;
|
|
518
|
+
summary?: undefined;
|
|
519
|
+
counts?: undefined;
|
|
520
|
+
} | {
|
|
521
|
+
ok: boolean;
|
|
522
|
+
taskCount: number;
|
|
523
|
+
summary: string;
|
|
524
|
+
error?: undefined;
|
|
525
|
+
counts?: undefined;
|
|
526
|
+
} | {
|
|
527
|
+
ok: boolean;
|
|
528
|
+
taskCount: number;
|
|
529
|
+
counts: {
|
|
530
|
+
pending: number;
|
|
531
|
+
in_progress: number;
|
|
532
|
+
completed: number;
|
|
533
|
+
};
|
|
534
|
+
summary: string;
|
|
535
|
+
error?: undefined;
|
|
536
|
+
}>;
|
|
537
|
+
}) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
|
|
538
|
+
} & {
|
|
539
|
+
outputSchema?: import("ai").FlexibleSchema<{
|
|
540
|
+
ok: boolean;
|
|
541
|
+
error: string;
|
|
542
|
+
taskCount?: undefined;
|
|
543
|
+
summary?: undefined;
|
|
544
|
+
counts?: undefined;
|
|
545
|
+
} | {
|
|
546
|
+
ok: boolean;
|
|
547
|
+
taskCount: number;
|
|
548
|
+
summary: string;
|
|
549
|
+
error?: undefined;
|
|
550
|
+
counts?: undefined;
|
|
551
|
+
} | {
|
|
552
|
+
ok: boolean;
|
|
553
|
+
taskCount: number;
|
|
554
|
+
counts: {
|
|
555
|
+
pending: number;
|
|
556
|
+
in_progress: number;
|
|
557
|
+
completed: number;
|
|
558
|
+
};
|
|
559
|
+
summary: string;
|
|
560
|
+
error?: undefined;
|
|
561
|
+
}> | undefined;
|
|
562
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
563
|
+
tasks: {
|
|
564
|
+
title: string;
|
|
565
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
566
|
+
}[];
|
|
567
|
+
}, {
|
|
568
|
+
ok: boolean;
|
|
569
|
+
error: string;
|
|
570
|
+
taskCount?: undefined;
|
|
571
|
+
summary?: undefined;
|
|
572
|
+
counts?: undefined;
|
|
573
|
+
} | {
|
|
574
|
+
ok: boolean;
|
|
575
|
+
taskCount: number;
|
|
576
|
+
summary: string;
|
|
577
|
+
error?: undefined;
|
|
578
|
+
counts?: undefined;
|
|
579
|
+
} | {
|
|
580
|
+
ok: boolean;
|
|
581
|
+
taskCount: number;
|
|
582
|
+
counts: {
|
|
583
|
+
pending: number;
|
|
584
|
+
in_progress: number;
|
|
585
|
+
completed: number;
|
|
586
|
+
};
|
|
587
|
+
summary: string;
|
|
588
|
+
error?: undefined;
|
|
589
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
590
|
+
} & {
|
|
591
|
+
type: "provider";
|
|
592
|
+
id: `${string}.${string}`;
|
|
593
|
+
args: Record<string, unknown>;
|
|
594
|
+
description?: never;
|
|
595
|
+
strict?: never;
|
|
596
|
+
inputExamples?: never;
|
|
597
|
+
} & {
|
|
598
|
+
isProviderExecuted: true;
|
|
599
|
+
supportsDeferredResults?: boolean;
|
|
600
|
+
} & {
|
|
601
|
+
execute: import("ai").ToolExecuteFunction<{
|
|
602
|
+
tasks: {
|
|
603
|
+
title: string;
|
|
604
|
+
status?: "pending" | "in_progress" | "completed" | undefined;
|
|
605
|
+
}[];
|
|
606
|
+
}, {
|
|
607
|
+
ok: boolean;
|
|
608
|
+
error: string;
|
|
609
|
+
taskCount?: undefined;
|
|
610
|
+
summary?: undefined;
|
|
611
|
+
counts?: undefined;
|
|
612
|
+
} | {
|
|
613
|
+
ok: boolean;
|
|
614
|
+
taskCount: number;
|
|
615
|
+
summary: string;
|
|
616
|
+
error?: undefined;
|
|
617
|
+
counts?: undefined;
|
|
618
|
+
} | {
|
|
619
|
+
ok: boolean;
|
|
620
|
+
taskCount: number;
|
|
621
|
+
counts: {
|
|
622
|
+
pending: number;
|
|
623
|
+
in_progress: number;
|
|
624
|
+
completed: number;
|
|
625
|
+
};
|
|
626
|
+
summary: string;
|
|
627
|
+
error?: undefined;
|
|
628
|
+
}, NoInfer<import("@ai-sdk/provider-utils").Context>>;
|
|
629
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { tool } from 'ai';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { generateTaskId, saveTasks } from '../../core/tasks/taskStorage.js';
|
|
4
|
+
export const writeTasksTool = tool({
|
|
5
|
+
description: 'Replace the task list for substantial work. Update at meaningful phase changes, blockers, and completion; pass the complete list.',
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
tasks: z.array(z.object({
|
|
8
|
+
title: z.string().max(200).describe('Short task description'),
|
|
9
|
+
status: z.enum(['pending', 'in_progress', 'completed']).optional().describe('Task status (defaults to pending)'),
|
|
10
|
+
})).describe('Complete task list. Replaces any existing tasks. Pass an empty array to clear.'),
|
|
11
|
+
}),
|
|
12
|
+
execute: async ({ tasks: inputTasks }) => {
|
|
13
|
+
if (!Array.isArray(inputTasks)) {
|
|
14
|
+
return { ok: false, error: 'Tasks must be an array. Pass an empty array to clear the list.' };
|
|
15
|
+
}
|
|
16
|
+
for (let i = 0; i < inputTasks.length; i++) {
|
|
17
|
+
const title = inputTasks[i]?.title?.trim();
|
|
18
|
+
if (!title)
|
|
19
|
+
return { ok: false, error: `Task ${i + 1}: title cannot be empty.` };
|
|
20
|
+
if (title.length > 200)
|
|
21
|
+
return { ok: false, error: `Task ${i + 1}: title is too long (max 200 characters).` };
|
|
22
|
+
}
|
|
23
|
+
const now = new Date().toISOString();
|
|
24
|
+
const tasks = inputTasks.map((input) => ({
|
|
25
|
+
id: generateTaskId(),
|
|
26
|
+
title: input.title.trim(),
|
|
27
|
+
status: input.status ?? 'pending',
|
|
28
|
+
createdAt: now,
|
|
29
|
+
updatedAt: now,
|
|
30
|
+
}));
|
|
31
|
+
await saveTasks(tasks);
|
|
32
|
+
if (tasks.length === 0)
|
|
33
|
+
return { ok: true, taskCount: 0, summary: 'Task list cleared.' };
|
|
34
|
+
const counts = {
|
|
35
|
+
pending: tasks.filter(t => t.status === 'pending').length,
|
|
36
|
+
in_progress: tasks.filter(t => t.status === 'in_progress').length,
|
|
37
|
+
completed: tasks.filter(t => t.status === 'completed').length,
|
|
38
|
+
};
|
|
39
|
+
return { ok: true, taskCount: tasks.length, counts, summary: `Tasks: ${counts.pending} pending, ${counts.in_progress} in progress, ${counts.completed} completed.` };
|
|
40
|
+
},
|
|
41
|
+
});
|