@questionbase/deskfree 0.1.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/README.md +129 -0
- package/dist/channel.d.ts +3 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.js +503 -0
- package/dist/channel.js.map +1 -0
- package/dist/client.d.ts +148 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +255 -0
- package/dist/client.js.map +1 -0
- package/dist/deliver.d.ts +22 -0
- package/dist/deliver.d.ts.map +1 -0
- package/dist/deliver.js +350 -0
- package/dist/deliver.js.map +1 -0
- package/dist/gateway.d.ts +13 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +687 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-definitions.d.ts +116 -0
- package/dist/llm-definitions.d.ts.map +1 -0
- package/dist/llm-definitions.js +148 -0
- package/dist/llm-definitions.js.map +1 -0
- package/dist/offline-queue.d.ts +45 -0
- package/dist/offline-queue.d.ts.map +1 -0
- package/dist/offline-queue.js +109 -0
- package/dist/offline-queue.js.map +1 -0
- package/dist/paths.d.ts +10 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -0
- package/dist/runtime.d.ts +17 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +24 -0
- package/dist/runtime.js.map +1 -0
- package/dist/tools.d.ts +35 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +527 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +389 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/workspace.d.ts +18 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +83 -0
- package/dist/workspace.js.map +1 -0
- package/openclaw.plugin.json +8 -0
- package/package.json +63 -0
- package/skills/deskfree/SKILL.md +271 -0
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AnyAgentTool, OpenClawPluginApi } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Type-safe parameter validation helpers
|
|
4
|
+
*
|
|
5
|
+
* These functions provide runtime validation of tool parameters with TypeScript
|
|
6
|
+
* type safety. They throw descriptive errors for invalid parameters, which are
|
|
7
|
+
* caught by the tool execution framework and converted to user-friendly messages.
|
|
8
|
+
*/
|
|
9
|
+
export declare function validateStringParam(params: Record<string, unknown>, key: string, required: true): string;
|
|
10
|
+
export declare function validateStringParam(params: Record<string, unknown>, key: string, required: false): string | undefined;
|
|
11
|
+
export declare function validateEnumParam<T extends string>(params: Record<string, unknown>, key: string, allowedValues: readonly T[], required: true): T;
|
|
12
|
+
export declare function validateEnumParam<T extends string>(params: Record<string, unknown>, key: string, allowedValues: readonly T[], required: false): T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Creates all DeskFree agent tools for integration with the DeskFree task management system.
|
|
15
|
+
*
|
|
16
|
+
* This function dynamically creates agent tools based on the DeskFree configuration
|
|
17
|
+
* in the OpenClaw config file. Tools enable agents to:
|
|
18
|
+
* - Claim and release tasks
|
|
19
|
+
* - Update task deliverables and request reviews
|
|
20
|
+
* - Send messages to humans
|
|
21
|
+
* - List and retrieve task information
|
|
22
|
+
*
|
|
23
|
+
* @param api - OpenClaw plugin API for accessing configuration and runtime
|
|
24
|
+
* @returns Array of agent tools, or null if DeskFree is not configured
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // In config.yaml:
|
|
28
|
+
* channels:
|
|
29
|
+
* deskfree:
|
|
30
|
+
* botToken: "your-bot-token"
|
|
31
|
+
* apiUrl: "https://api.deskfree.ai"
|
|
32
|
+
* enabled: true
|
|
33
|
+
*/
|
|
34
|
+
export declare function createDeskFreeTools(api: OpenClawPluginApi): AnyAgentTool[] | null;
|
|
35
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EAGlB,MAAM,SAAS,CAAC;AAyMjB;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,IAAI,GACb,MAAM,CAAC;AACV,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,KAAK,GACd,MAAM,GAAG,SAAS,CAAC;AA0BtB,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,QAAQ,EAAE,IAAI,GACb,CAAC,CAAC;AACL,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAChD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,SAAS,CAAC,EAAE,EAC3B,QAAQ,EAAE,KAAK,GACd,CAAC,GAAG,SAAS,CAAC;AAiCjB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,iBAAiB,GACrB,YAAY,EAAE,GAAG,IAAI,CAuZvB"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeskFree Agent Tools Implementation
|
|
3
|
+
*
|
|
4
|
+
* This module implements the DeskFree integration for OpenClaw agents,
|
|
5
|
+
* providing tools for task management, message sending, and bot collaboration.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Tools are created based on the channel configuration in config.yaml
|
|
9
|
+
* - Each tool validates parameters, calls the DeskFree API, and returns formatted responses
|
|
10
|
+
* - Error handling provides user-friendly messages with suggestions
|
|
11
|
+
* - All responses follow a consistent JSON structure for agent consumption
|
|
12
|
+
*
|
|
13
|
+
* Configuration:
|
|
14
|
+
* Tools are only available when DeskFree is properly configured in channels.deskfree
|
|
15
|
+
* with botToken and apiUrl. Supports both single account and multi-account setups.
|
|
16
|
+
*/
|
|
17
|
+
import { DeskFreeClient } from './client';
|
|
18
|
+
import { setActiveTaskId } from './gateway';
|
|
19
|
+
import { TOOLS } from './llm-definitions';
|
|
20
|
+
/**
|
|
21
|
+
* Valid task status values for filtering in the DeskFree state machine.
|
|
22
|
+
* These match the task lifecycle defined in the DeskFree backend:
|
|
23
|
+
* - ready_for_bot: Available for any bot to claim
|
|
24
|
+
* - working_on_it: Currently being worked on by a bot
|
|
25
|
+
* - waiting_for_human: Submitted for human review/approval
|
|
26
|
+
* - done: Completed and approved by human
|
|
27
|
+
*/
|
|
28
|
+
const VALID_TASK_STATUSES = [
|
|
29
|
+
'ready_for_bot',
|
|
30
|
+
'working_on_it',
|
|
31
|
+
'waiting_for_human',
|
|
32
|
+
'done',
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Resolve the DeskFree account from the plugin config.
|
|
36
|
+
* Supports both single account mode (direct config) and multi-account mode (accounts object).
|
|
37
|
+
* Multi-account mode allows connecting to multiple DeskFree instances with different credentials.
|
|
38
|
+
* Shared logic with channel.ts — reads channels.deskfree from config.
|
|
39
|
+
*/
|
|
40
|
+
function resolveAccountFromConfig(api) {
|
|
41
|
+
const cfg = api.runtime.config.loadConfig();
|
|
42
|
+
const ch = cfg?.channels?.deskfree;
|
|
43
|
+
if (!ch)
|
|
44
|
+
return null;
|
|
45
|
+
// Use first explicit account, or fall back to top-level config
|
|
46
|
+
if (ch.accounts && Object.keys(ch.accounts).length > 0) {
|
|
47
|
+
const [accountId, acct] = Object.entries(ch.accounts)[0];
|
|
48
|
+
if (!acct.botToken || !acct.apiUrl)
|
|
49
|
+
return null;
|
|
50
|
+
return {
|
|
51
|
+
accountId,
|
|
52
|
+
botToken: acct.botToken,
|
|
53
|
+
apiUrl: acct.apiUrl,
|
|
54
|
+
wsUrl: acct.wsUrl ?? '',
|
|
55
|
+
userId: acct.userId ?? '',
|
|
56
|
+
enabled: acct.enabled !== false,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (!ch.botToken || !ch.apiUrl)
|
|
60
|
+
return null;
|
|
61
|
+
return {
|
|
62
|
+
accountId: 'default',
|
|
63
|
+
botToken: ch.botToken,
|
|
64
|
+
apiUrl: ch.apiUrl,
|
|
65
|
+
wsUrl: ch.wsUrl ?? '',
|
|
66
|
+
userId: ch.userId ?? '',
|
|
67
|
+
enabled: ch.enabled !== false,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function textResult(data) {
|
|
71
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
72
|
+
}
|
|
73
|
+
function formatTaskResponse(task, summary, nextActions) {
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: JSON.stringify({
|
|
79
|
+
summary,
|
|
80
|
+
nextActions,
|
|
81
|
+
task,
|
|
82
|
+
}, null, 2),
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function formatListResponse(tasks, summary, nextActions) {
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'text',
|
|
92
|
+
text: JSON.stringify({
|
|
93
|
+
summary,
|
|
94
|
+
nextActions,
|
|
95
|
+
tasks,
|
|
96
|
+
}, null, 2),
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function formatConfirmation(summary, nextActions, data) {
|
|
102
|
+
return {
|
|
103
|
+
content: [
|
|
104
|
+
{
|
|
105
|
+
type: 'text',
|
|
106
|
+
text: JSON.stringify({
|
|
107
|
+
summary,
|
|
108
|
+
nextActions,
|
|
109
|
+
...(data ? { data } : {}),
|
|
110
|
+
}, null, 2),
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function errorResult(err) {
|
|
116
|
+
const rawMessage = err instanceof Error ? err.message : String(err);
|
|
117
|
+
// Parse common HTTP error patterns and provide user-friendly messages
|
|
118
|
+
// This transforms technical errors into actionable advice for the agent
|
|
119
|
+
let userMessage = rawMessage;
|
|
120
|
+
let suggestion = '';
|
|
121
|
+
// Map common error patterns to user-friendly messages with actionable next steps
|
|
122
|
+
// These patterns match the DeskFreeError messages from client.ts
|
|
123
|
+
if (rawMessage.includes('DeskFree API error: 409')) {
|
|
124
|
+
// Conflict error - typically happens when multiple bots try to claim the same task
|
|
125
|
+
userMessage =
|
|
126
|
+
'Task is already claimed by another bot. Use deskfree_list_tasks to find available tasks.';
|
|
127
|
+
suggestion =
|
|
128
|
+
'Try listing tasks with status="ready_for_bot" to find unclaimed tasks.';
|
|
129
|
+
}
|
|
130
|
+
else if (rawMessage.includes('DeskFree API error: 404')) {
|
|
131
|
+
// Not found - task doesn't exist or isn't in expected state
|
|
132
|
+
userMessage = 'Task not found. Verify the taskId is correct.';
|
|
133
|
+
suggestion =
|
|
134
|
+
'Use deskfree_list_tasks to see all available tasks and verify the taskId.';
|
|
135
|
+
}
|
|
136
|
+
else if (rawMessage.includes('authentication failed') ||
|
|
137
|
+
rawMessage.includes('401') ||
|
|
138
|
+
rawMessage.includes('403')) {
|
|
139
|
+
// Authentication/authorization failures - usually configuration issues
|
|
140
|
+
userMessage = 'Authentication failed. Check your bot token configuration.';
|
|
141
|
+
suggestion =
|
|
142
|
+
'Verify the bot token in your OpenClaw configuration is correct and has not expired.';
|
|
143
|
+
}
|
|
144
|
+
else if (rawMessage.includes('server error') || /5\d\d/.test(rawMessage)) {
|
|
145
|
+
// Server-side errors - agent should retry after a delay
|
|
146
|
+
userMessage = 'DeskFree server error. Try again in a moment.';
|
|
147
|
+
suggestion =
|
|
148
|
+
'The server encountered an error. Wait a few moments and retry your request.';
|
|
149
|
+
}
|
|
150
|
+
else if (rawMessage.includes('timed out')) {
|
|
151
|
+
// Network timeouts - suggest retry with patience
|
|
152
|
+
userMessage = 'Request timed out. The server may be busy.';
|
|
153
|
+
suggestion =
|
|
154
|
+
'Wait a moment and try again. If the problem persists, check your network connection.';
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
content: [
|
|
158
|
+
{
|
|
159
|
+
type: 'text',
|
|
160
|
+
text: JSON.stringify({
|
|
161
|
+
error: true,
|
|
162
|
+
message: userMessage,
|
|
163
|
+
...(suggestion ? { suggestion } : {}),
|
|
164
|
+
originalError: rawMessage,
|
|
165
|
+
}, null, 2),
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
isError: true,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
export function validateStringParam(params, key, required) {
|
|
172
|
+
const value = params[key];
|
|
173
|
+
if (value == null) {
|
|
174
|
+
if (required) {
|
|
175
|
+
throw new Error(`Required parameter '${key}' is missing`);
|
|
176
|
+
}
|
|
177
|
+
return undefined;
|
|
178
|
+
}
|
|
179
|
+
if (typeof value !== 'string') {
|
|
180
|
+
throw new Error(`Parameter '${key}' must be a string, got ${typeof value}`);
|
|
181
|
+
}
|
|
182
|
+
if (required && value.trim() === '') {
|
|
183
|
+
throw new Error(`Required parameter '${key}' cannot be empty`);
|
|
184
|
+
}
|
|
185
|
+
return value;
|
|
186
|
+
}
|
|
187
|
+
export function validateEnumParam(params, key, allowedValues, required) {
|
|
188
|
+
const value = params[key];
|
|
189
|
+
if (value == null) {
|
|
190
|
+
if (required) {
|
|
191
|
+
throw new Error(`Required parameter '${key}' is missing`);
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
if (typeof value !== 'string') {
|
|
196
|
+
throw new Error(`Parameter '${key}' must be a string, got ${typeof value}`);
|
|
197
|
+
}
|
|
198
|
+
if (required && value.trim() === '') {
|
|
199
|
+
throw new Error(`Required parameter '${key}' cannot be empty`);
|
|
200
|
+
}
|
|
201
|
+
if (!allowedValues.includes(value)) {
|
|
202
|
+
throw new Error(`Parameter '${key}' must be one of: ${allowedValues.join(', ')}, got: ${value}`);
|
|
203
|
+
}
|
|
204
|
+
return value;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Creates all DeskFree agent tools for integration with the DeskFree task management system.
|
|
208
|
+
*
|
|
209
|
+
* This function dynamically creates agent tools based on the DeskFree configuration
|
|
210
|
+
* in the OpenClaw config file. Tools enable agents to:
|
|
211
|
+
* - Claim and release tasks
|
|
212
|
+
* - Update task deliverables and request reviews
|
|
213
|
+
* - Send messages to humans
|
|
214
|
+
* - List and retrieve task information
|
|
215
|
+
*
|
|
216
|
+
* @param api - OpenClaw plugin API for accessing configuration and runtime
|
|
217
|
+
* @returns Array of agent tools, or null if DeskFree is not configured
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* // In config.yaml:
|
|
221
|
+
* channels:
|
|
222
|
+
* deskfree:
|
|
223
|
+
* botToken: "your-bot-token"
|
|
224
|
+
* apiUrl: "https://api.deskfree.ai"
|
|
225
|
+
* enabled: true
|
|
226
|
+
*/
|
|
227
|
+
export function createDeskFreeTools(api) {
|
|
228
|
+
const account = resolveAccountFromConfig(api);
|
|
229
|
+
if (!account)
|
|
230
|
+
return null;
|
|
231
|
+
// Initialize the DeskFree HTTP client with bot credentials
|
|
232
|
+
// This client handles authentication, error parsing, and request formatting
|
|
233
|
+
const client = new DeskFreeClient(account.botToken, account.apiUrl);
|
|
234
|
+
return [
|
|
235
|
+
{
|
|
236
|
+
...TOOLS.GET_TASK,
|
|
237
|
+
async execute(_id, params) {
|
|
238
|
+
try {
|
|
239
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
240
|
+
const result = await client.getTask({ taskId });
|
|
241
|
+
const nextActions = [];
|
|
242
|
+
if (result.status === 'ready_for_bot') {
|
|
243
|
+
nextActions.push('You can claim this task with deskfree_claim_task');
|
|
244
|
+
}
|
|
245
|
+
else if (result.status === 'working_on_it' && result.botId) {
|
|
246
|
+
nextActions.push('Update deliverable with deskfree_update_deliverable');
|
|
247
|
+
nextActions.push('Request review when ready with deskfree_request_review');
|
|
248
|
+
}
|
|
249
|
+
else if (result.status === 'waiting_for_human') {
|
|
250
|
+
nextActions.push('Wait for human review or send a message with deskfree_send_message');
|
|
251
|
+
}
|
|
252
|
+
return formatTaskResponse(result, `Task "${result.title}" is ${result.status}`, nextActions);
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
return errorResult(err);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
...TOOLS.CLAIM_TASK,
|
|
261
|
+
async execute(_id, params) {
|
|
262
|
+
try {
|
|
263
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
264
|
+
const result = await client.claimTask({ taskId });
|
|
265
|
+
setActiveTaskId(taskId);
|
|
266
|
+
return formatTaskResponse(result, `Successfully claimed task "${result.title}"`, [
|
|
267
|
+
'Use deskfree_get_task to get full task context',
|
|
268
|
+
'Work on the task and update deliverable with deskfree_update_deliverable',
|
|
269
|
+
'Request review when done with deskfree_request_review',
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
return errorResult(err);
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
...TOOLS.RELEASE_TASK,
|
|
279
|
+
async execute(_id, params) {
|
|
280
|
+
try {
|
|
281
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
282
|
+
const result = await client.releaseTask({ taskId });
|
|
283
|
+
setActiveTaskId(null);
|
|
284
|
+
return formatTaskResponse(result, `Released task "${result.title}"`, [
|
|
285
|
+
'Task is now available for other bots to claim',
|
|
286
|
+
'Use deskfree_list_tasks to find other tasks',
|
|
287
|
+
]);
|
|
288
|
+
}
|
|
289
|
+
catch (err) {
|
|
290
|
+
return errorResult(err);
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
...TOOLS.SEND_MESSAGE,
|
|
296
|
+
async execute(_id, params) {
|
|
297
|
+
try {
|
|
298
|
+
const content = validateStringParam(params, 'content', true);
|
|
299
|
+
const taskId = validateStringParam(params, 'taskId', false);
|
|
300
|
+
await client.sendMessage({ content, taskId });
|
|
301
|
+
return formatConfirmation(`Message sent${taskId ? ` to task ${taskId}` : ''}`, [
|
|
302
|
+
'Message delivered to the human',
|
|
303
|
+
taskId
|
|
304
|
+
? 'Continue working on the task or wait for response'
|
|
305
|
+
: 'Check for response with task messages',
|
|
306
|
+
]);
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
return errorResult(err);
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
...TOOLS.UPDATE_DELIVERABLE,
|
|
315
|
+
async execute(_id, params) {
|
|
316
|
+
try {
|
|
317
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
318
|
+
const deliverable = validateStringParam(params, 'deliverable', true);
|
|
319
|
+
await client.updateDeliverable({ taskId, deliverable });
|
|
320
|
+
return formatConfirmation(`Updated deliverable for task ${taskId}`, [
|
|
321
|
+
'Deliverable has been saved',
|
|
322
|
+
'Continue working or request review with deskfree_request_review when ready',
|
|
323
|
+
]);
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
return errorResult(err);
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
...TOOLS.REQUEST_REVIEW,
|
|
332
|
+
async execute(_id, params) {
|
|
333
|
+
try {
|
|
334
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
335
|
+
const comment = validateStringParam(params, 'comment', false);
|
|
336
|
+
const result = await client.requestReview({ taskId, comment });
|
|
337
|
+
setActiveTaskId(null);
|
|
338
|
+
return formatTaskResponse(result, `Submitted task "${result.title}" for review`, [
|
|
339
|
+
'Task is now waiting for human review',
|
|
340
|
+
'Remember to terminate any sub-agents working on this task',
|
|
341
|
+
'You can send additional messages with deskfree_send_message',
|
|
342
|
+
]);
|
|
343
|
+
}
|
|
344
|
+
catch (err) {
|
|
345
|
+
return errorResult(err);
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
...TOOLS.LIST_TASKS,
|
|
351
|
+
async execute(_id, params) {
|
|
352
|
+
try {
|
|
353
|
+
const status = validateEnumParam(params, 'status', VALID_TASK_STATUSES, false);
|
|
354
|
+
const result = await client.listTasks({ status });
|
|
355
|
+
const readyForBot = result.tasks.filter((t) => t.status === 'ready_for_bot');
|
|
356
|
+
const nextActions = [];
|
|
357
|
+
if (readyForBot.length > 0) {
|
|
358
|
+
nextActions.push(`${readyForBot.length} task(s) ready for bot - claim one with deskfree_claim_task`);
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
nextActions.push('No tasks ready for bot. Create a new task with deskfree_create_task if needed');
|
|
362
|
+
}
|
|
363
|
+
return formatListResponse(result.tasks, `Found ${result.tasks.length} task(s)${status ? ` with status "${status}"` : ''} (${readyForBot.length} ready for bot)`, nextActions);
|
|
364
|
+
}
|
|
365
|
+
catch (err) {
|
|
366
|
+
return errorResult(err);
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
...TOOLS.CREATE_TASK,
|
|
372
|
+
async execute(_id, params) {
|
|
373
|
+
try {
|
|
374
|
+
const title = validateStringParam(params, 'title', true);
|
|
375
|
+
const instructions = validateStringParam(params, 'instructions', false);
|
|
376
|
+
// Validate isRecurring
|
|
377
|
+
const rawIsRecurring = params.isRecurring;
|
|
378
|
+
let isRecurring;
|
|
379
|
+
if (rawIsRecurring != null) {
|
|
380
|
+
if (typeof rawIsRecurring !== 'boolean') {
|
|
381
|
+
throw new Error(`Parameter 'isRecurring' must be a boolean, got ${typeof rawIsRecurring}`);
|
|
382
|
+
}
|
|
383
|
+
isRecurring = rawIsRecurring;
|
|
384
|
+
}
|
|
385
|
+
// Validate recurringSchedule
|
|
386
|
+
const VALID_FREQUENCIES = [
|
|
387
|
+
'daily',
|
|
388
|
+
'weekly',
|
|
389
|
+
'biweekly',
|
|
390
|
+
'monthly',
|
|
391
|
+
];
|
|
392
|
+
let recurringSchedule;
|
|
393
|
+
const rawSchedule = params.recurringSchedule;
|
|
394
|
+
if (rawSchedule != null) {
|
|
395
|
+
if (typeof rawSchedule !== 'object' || Array.isArray(rawSchedule)) {
|
|
396
|
+
throw new Error("Parameter 'recurringSchedule' must be an object");
|
|
397
|
+
}
|
|
398
|
+
const sched = rawSchedule;
|
|
399
|
+
// frequency (required)
|
|
400
|
+
if (!sched.frequency || typeof sched.frequency !== 'string') {
|
|
401
|
+
throw new Error('recurringSchedule.frequency is required and must be a string');
|
|
402
|
+
}
|
|
403
|
+
if (!VALID_FREQUENCIES.includes(sched.frequency)) {
|
|
404
|
+
throw new Error(`recurringSchedule.frequency must be one of: ${VALID_FREQUENCIES.join(', ')}`);
|
|
405
|
+
}
|
|
406
|
+
// time (required)
|
|
407
|
+
if (!sched.time || typeof sched.time !== 'string') {
|
|
408
|
+
throw new Error("recurringSchedule.time is required (e.g., '09:00')");
|
|
409
|
+
}
|
|
410
|
+
if (!/^\d{2}:\d{2}$/.test(sched.time)) {
|
|
411
|
+
throw new Error("recurringSchedule.time must be in HH:mm format (e.g., '09:00')");
|
|
412
|
+
}
|
|
413
|
+
// dayOfWeek (optional, 0-6)
|
|
414
|
+
if (sched.dayOfWeek != null) {
|
|
415
|
+
if (typeof sched.dayOfWeek !== 'number' ||
|
|
416
|
+
!Number.isInteger(sched.dayOfWeek) ||
|
|
417
|
+
sched.dayOfWeek < 0 ||
|
|
418
|
+
sched.dayOfWeek > 6) {
|
|
419
|
+
throw new Error('recurringSchedule.dayOfWeek must be an integer 0-6 (0=Sun, 6=Sat)');
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// dayOfMonth (optional, 1-31)
|
|
423
|
+
if (sched.dayOfMonth != null) {
|
|
424
|
+
if (typeof sched.dayOfMonth !== 'number' ||
|
|
425
|
+
!Number.isInteger(sched.dayOfMonth) ||
|
|
426
|
+
sched.dayOfMonth < 1 ||
|
|
427
|
+
sched.dayOfMonth > 31) {
|
|
428
|
+
throw new Error('recurringSchedule.dayOfMonth must be an integer 1-31');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
// timezone (optional string)
|
|
432
|
+
if (sched.timezone != null && typeof sched.timezone !== 'string') {
|
|
433
|
+
throw new Error('recurringSchedule.timezone must be a string');
|
|
434
|
+
}
|
|
435
|
+
recurringSchedule = {
|
|
436
|
+
frequency: sched.frequency,
|
|
437
|
+
time: sched.time,
|
|
438
|
+
...(sched.dayOfWeek != null
|
|
439
|
+
? { dayOfWeek: sched.dayOfWeek }
|
|
440
|
+
: {}),
|
|
441
|
+
...(sched.dayOfMonth != null
|
|
442
|
+
? { dayOfMonth: sched.dayOfMonth }
|
|
443
|
+
: {}),
|
|
444
|
+
...(sched.timezone ? { timezone: sched.timezone } : {}),
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
if (isRecurring && !recurringSchedule) {
|
|
448
|
+
throw new Error('recurringSchedule is required when isRecurring is true');
|
|
449
|
+
}
|
|
450
|
+
const result = await client.createTask({
|
|
451
|
+
title,
|
|
452
|
+
instructions,
|
|
453
|
+
isRecurring,
|
|
454
|
+
recurringSchedule,
|
|
455
|
+
});
|
|
456
|
+
const nextActions = [
|
|
457
|
+
'Claim this task with deskfree_claim_task to start working on it',
|
|
458
|
+
'Or list all tasks with deskfree_list_tasks',
|
|
459
|
+
];
|
|
460
|
+
if (isRecurring) {
|
|
461
|
+
nextActions.push('This is a recurring task — it will auto-clone when approved');
|
|
462
|
+
}
|
|
463
|
+
return formatTaskResponse(result.task, `Created ${isRecurring ? 'recurring ' : ''}task "${result.task.title}" with ID ${result.task.taskId}`, nextActions);
|
|
464
|
+
}
|
|
465
|
+
catch (err) {
|
|
466
|
+
return errorResult(err);
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
...TOOLS.SNOOZE_TASK,
|
|
472
|
+
async execute(_id, params) {
|
|
473
|
+
try {
|
|
474
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
475
|
+
const snoozedUntil = validateStringParam(params, 'snoozedUntil', true);
|
|
476
|
+
// Validate it's a future date
|
|
477
|
+
const snoozeDate = new Date(snoozedUntil);
|
|
478
|
+
if (isNaN(snoozeDate.getTime())) {
|
|
479
|
+
throw new Error('snoozedUntil must be a valid ISO 8601 timestamp');
|
|
480
|
+
}
|
|
481
|
+
if (snoozeDate <= new Date()) {
|
|
482
|
+
throw new Error('snoozedUntil must be in the future');
|
|
483
|
+
}
|
|
484
|
+
const result = await client.snoozeTask({ taskId, snoozedUntil });
|
|
485
|
+
return formatTaskResponse(result, `Task "${result.title}" snoozed until ${snoozeDate.toLocaleString()}`, [
|
|
486
|
+
'Task is hidden from active views until the snooze expires',
|
|
487
|
+
'Use deskfree_unsnooze_task to make it visible immediately',
|
|
488
|
+
]);
|
|
489
|
+
}
|
|
490
|
+
catch (err) {
|
|
491
|
+
return errorResult(err);
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
...TOOLS.UNSNOOZE_TASK,
|
|
497
|
+
async execute(_id, params) {
|
|
498
|
+
try {
|
|
499
|
+
const taskId = validateStringParam(params, 'taskId', true);
|
|
500
|
+
const result = await client.unsnoozeTask({ taskId });
|
|
501
|
+
return formatTaskResponse(result, `Task "${result.title}" unsnoozed and visible again`, [
|
|
502
|
+
'Task is now visible in active views',
|
|
503
|
+
result.status === 'ready_for_bot'
|
|
504
|
+
? 'Claim it with deskfree_claim_task'
|
|
505
|
+
: `Task status is ${result.status}`,
|
|
506
|
+
]);
|
|
507
|
+
}
|
|
508
|
+
catch (err) {
|
|
509
|
+
return errorResult(err);
|
|
510
|
+
}
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
...TOOLS.SETUP,
|
|
515
|
+
async execute() {
|
|
516
|
+
const directive = `## DeskFree
|
|
517
|
+
<!-- deskfree-directive -->
|
|
518
|
+
Always read the deskfree skill (SKILL.md) at startup. Follow its workflow for task tracking and messaging.`;
|
|
519
|
+
return textResult({
|
|
520
|
+
directive,
|
|
521
|
+
instructions: 'Read your AGENTS.md file. If it does not contain the marker <!-- deskfree-directive -->, append the directive block above to the end of the file. If the marker already exists, no changes are needed.',
|
|
522
|
+
});
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
];
|
|
526
|
+
}
|
|
527
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAQ1C;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAG;IAC1B,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,MAAM;CACE,CAAC;AACX;;;;;GAKG;AACH,SAAS,wBAAwB,CAC/B,GAAsB;IAEtB,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAA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