@questionbase/deskfree 0.2.0-alpha.7 → 0.3.0-alpha.10
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 +25 -14
- package/dist/index.d.ts +742 -6
- package/dist/index.js +9181 -18
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/skills/deskfree/SKILL.md +201 -203
- package/skills/deskfree/references/tools.md +141 -0
- package/dist/channel.d.ts +0 -3
- package/dist/channel.d.ts.map +0 -1
- package/dist/channel.js +0 -505
- package/dist/channel.js.map +0 -1
- package/dist/client.d.ts +0 -150
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -255
- package/dist/client.js.map +0 -1
- package/dist/deliver.d.ts +0 -22
- package/dist/deliver.d.ts.map +0 -1
- package/dist/deliver.js +0 -350
- package/dist/deliver.js.map +0 -1
- package/dist/gateway.d.ts +0 -13
- package/dist/gateway.d.ts.map +0 -1
- package/dist/gateway.js +0 -777
- package/dist/gateway.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/llm-definitions.d.ts +0 -111
- package/dist/llm-definitions.d.ts.map +0 -1
- package/dist/llm-definitions.js +0 -143
- package/dist/llm-definitions.js.map +0 -1
- package/dist/offline-queue.d.ts +0 -45
- package/dist/offline-queue.d.ts.map +0 -1
- package/dist/offline-queue.js +0 -109
- package/dist/offline-queue.js.map +0 -1
- package/dist/paths.d.ts +0 -10
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -29
- package/dist/paths.js.map +0 -1
- package/dist/runtime.d.ts +0 -17
- package/dist/runtime.d.ts.map +0 -1
- package/dist/runtime.js +0 -24
- package/dist/runtime.js.map +0 -1
- package/dist/tools.d.ts +0 -35
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -523
- package/dist/tools.js.map +0 -1
- package/dist/types.d.ts +0 -393
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/workspace.d.ts +0 -18
- package/dist/workspace.d.ts.map +0 -1
- package/dist/workspace.js +0 -83
- package/dist/workspace.js.map +0 -1
package/dist/channel.js
DELETED
|
@@ -1,505 +0,0 @@
|
|
|
1
|
-
import { DeskFreeClient } from './client';
|
|
2
|
-
import { getActiveTaskId, startDeskFreeConnection } from './gateway';
|
|
3
|
-
import { CHANNEL_HINTS, CHANNEL_META, STATUS_MESSAGES, } from './llm-definitions';
|
|
4
|
-
import { getDeskFreeRuntime } from './runtime';
|
|
5
|
-
function getChannelConfig(cfg) {
|
|
6
|
-
return cfg?.channels?.deskfree ?? null;
|
|
7
|
-
}
|
|
8
|
-
export const deskFreePlugin = {
|
|
9
|
-
id: 'deskfree',
|
|
10
|
-
meta: CHANNEL_META,
|
|
11
|
-
capabilities: {
|
|
12
|
-
text: true,
|
|
13
|
-
media: false,
|
|
14
|
-
reactions: false,
|
|
15
|
-
threads: true,
|
|
16
|
-
editing: false,
|
|
17
|
-
},
|
|
18
|
-
config: {
|
|
19
|
-
listAccountIds(cfg) {
|
|
20
|
-
const ch = getChannelConfig(cfg);
|
|
21
|
-
if (!ch)
|
|
22
|
-
return [];
|
|
23
|
-
if (ch.accounts && Object.keys(ch.accounts).length > 0) {
|
|
24
|
-
return Object.keys(ch.accounts);
|
|
25
|
-
}
|
|
26
|
-
return ['default'];
|
|
27
|
-
},
|
|
28
|
-
resolveAccount(cfg, accountId) {
|
|
29
|
-
const ch = getChannelConfig(cfg);
|
|
30
|
-
if (!ch) {
|
|
31
|
-
return {
|
|
32
|
-
accountId: accountId ?? 'default',
|
|
33
|
-
botToken: '',
|
|
34
|
-
apiUrl: '',
|
|
35
|
-
wsUrl: '',
|
|
36
|
-
userId: '',
|
|
37
|
-
enabled: false,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const id = accountId ?? 'default';
|
|
41
|
-
const acct = id !== 'default' && ch.accounts?.[id] ? ch.accounts[id] : ch;
|
|
42
|
-
return {
|
|
43
|
-
accountId: id,
|
|
44
|
-
botToken: acct.botToken ?? '',
|
|
45
|
-
apiUrl: acct.apiUrl ?? '',
|
|
46
|
-
wsUrl: acct.wsUrl ?? '',
|
|
47
|
-
userId: acct.userId ?? '',
|
|
48
|
-
enabled: acct.enabled !== false,
|
|
49
|
-
botName: acct.botName,
|
|
50
|
-
humanName: acct.humanName,
|
|
51
|
-
};
|
|
52
|
-
},
|
|
53
|
-
isConfigured(account) {
|
|
54
|
-
return Boolean(account.botToken && account.apiUrl);
|
|
55
|
-
},
|
|
56
|
-
isEnabled(account) {
|
|
57
|
-
return account.enabled;
|
|
58
|
-
},
|
|
59
|
-
describeAccount(account) {
|
|
60
|
-
const isConfigured = Boolean(account.botToken && account.apiUrl);
|
|
61
|
-
return {
|
|
62
|
-
accountId: account.accountId,
|
|
63
|
-
enabled: account.enabled,
|
|
64
|
-
configured: isConfigured,
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
outbound: {
|
|
69
|
-
deliveryMode: 'direct',
|
|
70
|
-
chunkerMode: 'markdown',
|
|
71
|
-
textChunkLimit: 2000,
|
|
72
|
-
resolveTarget(_target, { cfg, accountId }) {
|
|
73
|
-
// Resolve to the userId configured for this account
|
|
74
|
-
const acct = deskFreePlugin.config.resolveAccount(cfg, accountId);
|
|
75
|
-
if (!acct.userId)
|
|
76
|
-
return null;
|
|
77
|
-
return { to: acct.userId };
|
|
78
|
-
},
|
|
79
|
-
async sendText(ctx) {
|
|
80
|
-
const runtime = getDeskFreeRuntime();
|
|
81
|
-
const cfg = runtime.config.loadConfig();
|
|
82
|
-
const ch = getChannelConfig(cfg);
|
|
83
|
-
if (!ch) {
|
|
84
|
-
return { channel: 'deskfree', success: false };
|
|
85
|
-
}
|
|
86
|
-
const acct = deskFreePlugin.config.resolveAccount(cfg, ctx.accountId);
|
|
87
|
-
const client = new DeskFreeClient(acct.botToken, acct.apiUrl);
|
|
88
|
-
const log = runtime.logging.createLogger('deskfree');
|
|
89
|
-
try {
|
|
90
|
-
// Use explicit threadId if present, otherwise auto-thread
|
|
91
|
-
// into the active task
|
|
92
|
-
const taskId = ctx.threadId
|
|
93
|
-
? String(ctx.threadId)
|
|
94
|
-
: (getActiveTaskId() ?? undefined);
|
|
95
|
-
await client.sendMessage({
|
|
96
|
-
content: ctx.text,
|
|
97
|
-
taskId,
|
|
98
|
-
});
|
|
99
|
-
return {
|
|
100
|
-
channel: 'deskfree',
|
|
101
|
-
success: true,
|
|
102
|
-
threadId: taskId,
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
catch (err) {
|
|
106
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
107
|
-
log.error(`Failed to send message: ${message}`);
|
|
108
|
-
return {
|
|
109
|
-
channel: 'deskfree',
|
|
110
|
-
success: false,
|
|
111
|
-
error: message,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
gateway: {
|
|
117
|
-
async startAccount(ctx) {
|
|
118
|
-
return startDeskFreeConnection(ctx);
|
|
119
|
-
},
|
|
120
|
-
async stopAccount(ctx) {
|
|
121
|
-
const log = ctx.log ?? getDeskFreeRuntime().logging.createLogger('deskfree');
|
|
122
|
-
log.info(`Stopping DeskFree account ${ctx.accountId}`);
|
|
123
|
-
ctx.setStatus({ running: false, lastStopAt: Date.now() });
|
|
124
|
-
},
|
|
125
|
-
async logoutAccount(ctx) {
|
|
126
|
-
const log = ctx.log ?? getDeskFreeRuntime().logging.createLogger('deskfree');
|
|
127
|
-
const runtime = ctx.runtime;
|
|
128
|
-
// Clone config immutably
|
|
129
|
-
const config = JSON.parse(JSON.stringify(ctx.cfg));
|
|
130
|
-
const channels = (config.channels ?? {});
|
|
131
|
-
const deskfree = (channels.deskfree ?? {});
|
|
132
|
-
if (ctx.accountId === 'default') {
|
|
133
|
-
delete deskfree.botToken;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
const accounts = (deskfree.accounts ?? {});
|
|
137
|
-
if (accounts[ctx.accountId]) {
|
|
138
|
-
delete accounts[ctx.accountId].botToken;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
channels.deskfree = deskfree;
|
|
142
|
-
config.channels = channels;
|
|
143
|
-
await runtime.config.writeConfigFile(config);
|
|
144
|
-
log.info(`Cleared bot token for account ${ctx.accountId}`);
|
|
145
|
-
return { cleared: true, loggedOut: true };
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
setup: {
|
|
149
|
-
applyAccountConfig(params) {
|
|
150
|
-
const { cfg, accountId, input } = params;
|
|
151
|
-
const config = cfg;
|
|
152
|
-
const channels = (config.channels ?? {});
|
|
153
|
-
const deskfree = (channels.deskfree ?? {});
|
|
154
|
-
if (accountId === 'default') {
|
|
155
|
-
deskfree.botToken = input.botToken;
|
|
156
|
-
deskfree.apiUrl = input.apiUrl;
|
|
157
|
-
deskfree.wsUrl = input.wsUrl;
|
|
158
|
-
deskfree.userId = input.userId;
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
const accounts = (deskfree.accounts ?? {});
|
|
162
|
-
accounts[accountId] = {
|
|
163
|
-
botToken: input.botToken,
|
|
164
|
-
apiUrl: input.apiUrl,
|
|
165
|
-
wsUrl: input.wsUrl,
|
|
166
|
-
userId: input.userId,
|
|
167
|
-
enabled: true,
|
|
168
|
-
};
|
|
169
|
-
deskfree.accounts = accounts;
|
|
170
|
-
}
|
|
171
|
-
// Always set top-level channel enabled
|
|
172
|
-
deskfree.enabled = true;
|
|
173
|
-
channels.deskfree = deskfree;
|
|
174
|
-
config.channels = channels;
|
|
175
|
-
// Register plugin entry with channel ID to prevent auto-enable
|
|
176
|
-
// from creating a phantom disabled entry under the NPM package ID
|
|
177
|
-
const plugins = (config.plugins ?? {});
|
|
178
|
-
const entries = (plugins.entries ?? {});
|
|
179
|
-
const existing = (entries.deskfree ?? {});
|
|
180
|
-
entries.deskfree = { ...existing, enabled: true };
|
|
181
|
-
plugins.entries = entries;
|
|
182
|
-
config.plugins = plugins;
|
|
183
|
-
return config;
|
|
184
|
-
},
|
|
185
|
-
validateInput(params) {
|
|
186
|
-
const { input } = params;
|
|
187
|
-
// Validate bot token
|
|
188
|
-
if (!input.botToken) {
|
|
189
|
-
return 'Bot token is required';
|
|
190
|
-
}
|
|
191
|
-
if (typeof input.botToken !== 'string') {
|
|
192
|
-
return 'Bot token must be a string';
|
|
193
|
-
}
|
|
194
|
-
const botTokenTrimmed = input.botToken.trim();
|
|
195
|
-
if (botTokenTrimmed !== input.botToken) {
|
|
196
|
-
return 'Bot token must not have leading or trailing whitespace';
|
|
197
|
-
}
|
|
198
|
-
if (!botTokenTrimmed.startsWith('bot_')) {
|
|
199
|
-
return 'Bot token must start with "bot_"';
|
|
200
|
-
}
|
|
201
|
-
if (botTokenTrimmed.length < 10) {
|
|
202
|
-
return 'Bot token appears to be too short (minimum 10 characters)';
|
|
203
|
-
}
|
|
204
|
-
if (botTokenTrimmed.length > 100) {
|
|
205
|
-
return 'Bot token appears to be too long (maximum 100 characters)';
|
|
206
|
-
}
|
|
207
|
-
if (!/^bot_[a-zA-Z0-9_-]+$/.test(botTokenTrimmed)) {
|
|
208
|
-
return 'Bot token contains invalid characters (only alphanumeric, underscore, and dash allowed after "bot_")';
|
|
209
|
-
}
|
|
210
|
-
// Validate API URL
|
|
211
|
-
if (!input.apiUrl) {
|
|
212
|
-
return 'API URL is required';
|
|
213
|
-
}
|
|
214
|
-
if (typeof input.apiUrl !== 'string') {
|
|
215
|
-
return 'API URL must be a string';
|
|
216
|
-
}
|
|
217
|
-
const apiUrlTrimmed = input.apiUrl.trim();
|
|
218
|
-
if (apiUrlTrimmed !== input.apiUrl) {
|
|
219
|
-
return 'API URL must not have leading or trailing whitespace';
|
|
220
|
-
}
|
|
221
|
-
try {
|
|
222
|
-
const apiUrl = new URL(apiUrlTrimmed);
|
|
223
|
-
if (apiUrl.protocol !== 'https:') {
|
|
224
|
-
return 'API URL must use HTTPS protocol for security';
|
|
225
|
-
}
|
|
226
|
-
if (!apiUrl.hostname) {
|
|
227
|
-
return 'API URL must have a valid hostname';
|
|
228
|
-
}
|
|
229
|
-
if (apiUrl.hostname === 'localhost' ||
|
|
230
|
-
apiUrl.hostname === '127.0.0.1') {
|
|
231
|
-
return 'API URL cannot use localhost (use a publicly accessible URL)';
|
|
232
|
-
}
|
|
233
|
-
if (apiUrl.pathname && !apiUrl.pathname.endsWith('/')) {
|
|
234
|
-
// Warn if path doesn't end with slash but don't fail validation
|
|
235
|
-
// since the client will normalize this
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
catch (err) {
|
|
239
|
-
const message = err instanceof Error ? err.message : 'Invalid URL format';
|
|
240
|
-
return `API URL must be a valid URL: ${message}`;
|
|
241
|
-
}
|
|
242
|
-
// Validate WebSocket URL
|
|
243
|
-
if (!input.wsUrl) {
|
|
244
|
-
return 'WebSocket URL is required';
|
|
245
|
-
}
|
|
246
|
-
if (typeof input.wsUrl !== 'string') {
|
|
247
|
-
return 'WebSocket URL must be a string';
|
|
248
|
-
}
|
|
249
|
-
const wsUrlTrimmed = input.wsUrl.trim();
|
|
250
|
-
if (wsUrlTrimmed !== input.wsUrl) {
|
|
251
|
-
return 'WebSocket URL must not have leading or trailing whitespace';
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
const wsUrl = new URL(wsUrlTrimmed);
|
|
255
|
-
if (!['ws:', 'wss:'].includes(wsUrl.protocol)) {
|
|
256
|
-
return 'WebSocket URL must use ws:// or wss:// protocol';
|
|
257
|
-
}
|
|
258
|
-
if (!wsUrl.hostname) {
|
|
259
|
-
return 'WebSocket URL must have a valid hostname';
|
|
260
|
-
}
|
|
261
|
-
if (wsUrl.hostname === 'localhost' || wsUrl.hostname === '127.0.0.1') {
|
|
262
|
-
return 'WebSocket URL cannot use localhost (use a publicly accessible URL)';
|
|
263
|
-
}
|
|
264
|
-
// Recommend wss:// for security if using ws://
|
|
265
|
-
if (wsUrl.protocol === 'ws:' && wsUrl.hostname !== 'localhost') {
|
|
266
|
-
// This is just a recommendation, not a hard failure
|
|
267
|
-
// Most production deployments should use wss://
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
catch (err) {
|
|
271
|
-
const message = err instanceof Error ? err.message : 'Invalid URL format';
|
|
272
|
-
return `WebSocket URL must be a valid URL: ${message}`;
|
|
273
|
-
}
|
|
274
|
-
// Validate User ID
|
|
275
|
-
if (!input.userId) {
|
|
276
|
-
return 'User ID is required';
|
|
277
|
-
}
|
|
278
|
-
if (typeof input.userId !== 'string') {
|
|
279
|
-
return 'User ID must be a string';
|
|
280
|
-
}
|
|
281
|
-
const userIdTrimmed = input.userId.trim().toUpperCase();
|
|
282
|
-
if (userIdTrimmed !== input.userId.toUpperCase()) {
|
|
283
|
-
return 'User ID must not have leading or trailing whitespace and should be uppercase';
|
|
284
|
-
}
|
|
285
|
-
if (!/^[UBPT][A-Z0-9]{10}$/.test(userIdTrimmed)) {
|
|
286
|
-
const prefix = userIdTrimmed.charAt(0);
|
|
287
|
-
if (!'UBPT'.includes(prefix)) {
|
|
288
|
-
return 'User ID must start with U, B, P, or T (got: ' + prefix + ')';
|
|
289
|
-
}
|
|
290
|
-
if (userIdTrimmed.length !== 11) {
|
|
291
|
-
return `User ID must be exactly 11 characters long (got: ${userIdTrimmed.length})`;
|
|
292
|
-
}
|
|
293
|
-
return 'User ID must be a valid DeskFree ID format: one letter (U/B/P/T) + 10 alphanumeric characters (e.g. U9QF3C6X1A)';
|
|
294
|
-
}
|
|
295
|
-
return null;
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
messaging: {
|
|
299
|
-
normalizeTarget(raw) {
|
|
300
|
-
const trimmed = raw.trim();
|
|
301
|
-
if (/^[UBPT][A-Z0-9]{10}$/i.test(trimmed))
|
|
302
|
-
return `user:${trimmed}`;
|
|
303
|
-
return undefined;
|
|
304
|
-
},
|
|
305
|
-
targetResolver: {
|
|
306
|
-
hint: CHANNEL_HINTS.targetResolver,
|
|
307
|
-
looksLikeId(raw) {
|
|
308
|
-
const t = raw.trim();
|
|
309
|
-
return /^[UBPT][A-Z0-9]{10}$/i.test(t) || /^user:/i.test(t);
|
|
310
|
-
},
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
security: {
|
|
314
|
-
resolveDmPolicy({ accountId }) {
|
|
315
|
-
const basePath = accountId && accountId !== 'default'
|
|
316
|
-
? `channels.deskfree.accounts.${accountId}.dm.`
|
|
317
|
-
: 'channels.deskfree.dm.';
|
|
318
|
-
return {
|
|
319
|
-
policy: 'open',
|
|
320
|
-
allowFrom: ['*'],
|
|
321
|
-
allowFromPath: basePath,
|
|
322
|
-
approveHint: 'DeskFree uses bot token auth — no pairing needed.',
|
|
323
|
-
};
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
onboarding: {
|
|
327
|
-
channel: 'deskfree',
|
|
328
|
-
async getStatus(ctx) {
|
|
329
|
-
const ch = getChannelConfig(ctx.cfg);
|
|
330
|
-
const hasBotToken = Boolean(ch?.botToken);
|
|
331
|
-
const hasApiUrl = Boolean(ch?.apiUrl);
|
|
332
|
-
const hasUserId = Boolean(ch?.userId);
|
|
333
|
-
const configured = hasBotToken && hasApiUrl && hasUserId;
|
|
334
|
-
const statusLines = [];
|
|
335
|
-
if (configured) {
|
|
336
|
-
statusLines.push('Bot token: configured');
|
|
337
|
-
statusLines.push(`API URL: ${ch.apiUrl}`);
|
|
338
|
-
if (ch.wsUrl)
|
|
339
|
-
statusLines.push(`WS URL: ${ch.wsUrl}`);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
statusLines.push('Not configured');
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
channel: 'deskfree',
|
|
346
|
-
configured,
|
|
347
|
-
statusLines,
|
|
348
|
-
selectionHint: CHANNEL_HINTS.onboardingSelection,
|
|
349
|
-
quickstartScore: configured ? 0 : 50,
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
async configure(ctx) {
|
|
353
|
-
const ch = getChannelConfig(ctx.cfg);
|
|
354
|
-
const accountId = ctx.accountOverrides.accountId ?? 'default';
|
|
355
|
-
const botToken = await ctx.prompter.text({
|
|
356
|
-
message: 'Bot token',
|
|
357
|
-
initialValue: ch?.botToken ?? '',
|
|
358
|
-
placeholder: 'bot_xxxxxxxxxxxxxxxx',
|
|
359
|
-
validate: (v) => {
|
|
360
|
-
if (!v)
|
|
361
|
-
return 'Bot token is required';
|
|
362
|
-
if (!v.startsWith('bot_'))
|
|
363
|
-
return 'Must start with "bot_"';
|
|
364
|
-
if (v.length < 10)
|
|
365
|
-
return 'Bot token appears to be too short';
|
|
366
|
-
return undefined;
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
const apiUrl = await ctx.prompter.text({
|
|
370
|
-
message: 'API URL',
|
|
371
|
-
initialValue: ch?.apiUrl ?? '',
|
|
372
|
-
placeholder: 'https://app.deskfree.ai/v1/bot',
|
|
373
|
-
validate: (v) => {
|
|
374
|
-
if (!v)
|
|
375
|
-
return 'API URL is required';
|
|
376
|
-
try {
|
|
377
|
-
const url = new URL(v);
|
|
378
|
-
if (url.protocol !== 'https:')
|
|
379
|
-
return 'Must use HTTPS protocol for security';
|
|
380
|
-
return undefined;
|
|
381
|
-
}
|
|
382
|
-
catch {
|
|
383
|
-
return 'Must be a valid HTTPS URL';
|
|
384
|
-
}
|
|
385
|
-
},
|
|
386
|
-
});
|
|
387
|
-
const wsUrl = await ctx.prompter.text({
|
|
388
|
-
message: 'WebSocket URL',
|
|
389
|
-
initialValue: ch?.wsUrl ?? '',
|
|
390
|
-
placeholder: 'wss://ws.deskfree.ai',
|
|
391
|
-
validate: (v) => {
|
|
392
|
-
if (!v)
|
|
393
|
-
return 'WebSocket URL is required';
|
|
394
|
-
try {
|
|
395
|
-
const url = new URL(v);
|
|
396
|
-
if (!['ws:', 'wss:'].includes(url.protocol)) {
|
|
397
|
-
return 'Must use ws:// or wss:// protocol';
|
|
398
|
-
}
|
|
399
|
-
return undefined;
|
|
400
|
-
}
|
|
401
|
-
catch {
|
|
402
|
-
return 'Must be a valid WebSocket URL';
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
});
|
|
406
|
-
const userId = await ctx.prompter.text({
|
|
407
|
-
message: 'Your DeskFree User ID (shown in install instructions)',
|
|
408
|
-
initialValue: ch?.userId ?? '',
|
|
409
|
-
placeholder: 'U9QF3C6X1A',
|
|
410
|
-
validate: (v) => {
|
|
411
|
-
if (!v)
|
|
412
|
-
return 'User ID is required';
|
|
413
|
-
if (!/^[UBPT][A-Z0-9]{10}$/i.test(v)) {
|
|
414
|
-
return 'Must be a valid DeskFree ID (e.g. U9QF3C6X1A)';
|
|
415
|
-
}
|
|
416
|
-
return undefined;
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
const updatedCfg = deskFreePlugin.setup.applyAccountConfig({
|
|
420
|
-
cfg: ctx.cfg,
|
|
421
|
-
accountId,
|
|
422
|
-
input: { botToken, apiUrl, wsUrl, userId },
|
|
423
|
-
});
|
|
424
|
-
await ctx.prompter.note('DeskFree channel configured.', 'Done');
|
|
425
|
-
return { cfg: updatedCfg, accountId };
|
|
426
|
-
},
|
|
427
|
-
disable(cfg) {
|
|
428
|
-
const config = JSON.parse(JSON.stringify(cfg));
|
|
429
|
-
const channels = (config.channels ?? {});
|
|
430
|
-
const deskfree = (channels.deskfree ?? {});
|
|
431
|
-
deskfree.enabled = false;
|
|
432
|
-
channels.deskfree = deskfree;
|
|
433
|
-
config.channels = channels;
|
|
434
|
-
return config;
|
|
435
|
-
},
|
|
436
|
-
},
|
|
437
|
-
status: {
|
|
438
|
-
async probeAccount(params) {
|
|
439
|
-
const isConfigured = Boolean(params.account.botToken && params.account.apiUrl);
|
|
440
|
-
if (!isConfigured) {
|
|
441
|
-
return { ok: false, error: STATUS_MESSAGES.probeNotConfigured };
|
|
442
|
-
}
|
|
443
|
-
const client = new DeskFreeClient(params.account.botToken, params.account.apiUrl);
|
|
444
|
-
return client.probe(params.timeoutMs);
|
|
445
|
-
},
|
|
446
|
-
buildAccountSnapshot(params) {
|
|
447
|
-
const isConfigured = Boolean(params.account.botToken && params.account.apiUrl);
|
|
448
|
-
return {
|
|
449
|
-
accountId: params.account.accountId,
|
|
450
|
-
enabled: params.account.enabled,
|
|
451
|
-
configured: isConfigured,
|
|
452
|
-
running: params.runtime?.running,
|
|
453
|
-
lastStartAt: params.runtime?.lastStartAt,
|
|
454
|
-
lastStopAt: params.runtime?.lastStopAt,
|
|
455
|
-
lastError: params.runtime?.lastError,
|
|
456
|
-
probe: params.probe,
|
|
457
|
-
};
|
|
458
|
-
},
|
|
459
|
-
collectStatusIssues(accounts) {
|
|
460
|
-
const issues = [];
|
|
461
|
-
for (const snap of accounts) {
|
|
462
|
-
const id = snap.accountId ?? 'unknown';
|
|
463
|
-
if (!snap.configured) {
|
|
464
|
-
issues.push({
|
|
465
|
-
channel: 'deskfree',
|
|
466
|
-
accountId: id,
|
|
467
|
-
kind: 'config',
|
|
468
|
-
message: STATUS_MESSAGES.notConfigured.message,
|
|
469
|
-
fix: STATUS_MESSAGES.notConfigured.fix,
|
|
470
|
-
});
|
|
471
|
-
continue;
|
|
472
|
-
}
|
|
473
|
-
if (!snap.enabled) {
|
|
474
|
-
issues.push({
|
|
475
|
-
channel: 'deskfree',
|
|
476
|
-
accountId: id,
|
|
477
|
-
kind: 'config',
|
|
478
|
-
message: STATUS_MESSAGES.disabled.message,
|
|
479
|
-
fix: STATUS_MESSAGES.disabled.fix,
|
|
480
|
-
});
|
|
481
|
-
continue;
|
|
482
|
-
}
|
|
483
|
-
if (!snap.running) {
|
|
484
|
-
issues.push({
|
|
485
|
-
channel: 'deskfree',
|
|
486
|
-
accountId: id,
|
|
487
|
-
kind: 'runtime',
|
|
488
|
-
message: STATUS_MESSAGES.notRunning.message,
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
if (snap.probe && !snap.probe.ok) {
|
|
492
|
-
issues.push({
|
|
493
|
-
channel: 'deskfree',
|
|
494
|
-
accountId: id,
|
|
495
|
-
kind: 'auth',
|
|
496
|
-
message: `Probe failed: ${snap.probe.error ?? 'unknown error'}`,
|
|
497
|
-
fix: STATUS_MESSAGES.probeFailed.fix,
|
|
498
|
-
});
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
return issues;
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
//# sourceMappingURL=channel.js.map
|
package/dist/channel.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EACL,aAAa,EACb,YAAY,EACZ,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAU/C,SAAS,gBAAgB,CAAC,GAAmB;IAC3C,OAAO,GAAG,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC;AACzC,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAkB;IAC3C,EAAE,EAAE,UAAU;IAEd,IAAI,EAAE,YAAY;IAElB,YAAY,EAAE;QACZ,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK;KACf;IAED,MAAM,EAAE;QACN,cAAc,CAAC,GAAmB;YAChC,MAAM,EAAE,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,EAAE;gBAAE,OAAO,EAAE,CAAC;YACnB,IAAI,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;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UAAU;wBACnB,SAAS,EAAE,EAAE;wBACb,IAAI,EAAE,SAAS;wBACf,OAAO,EAAE,eAAe,CAAC,UAAU,CAAC,OAAO;qBAC5C,CAAC,CAAC;gBACL,CAAC;gBAED,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;oBACjC,MAAM,CAAC,IAAI,CAAC;wBACV,OAAO,EAAE,UAAU;wBACnB,SAAS,EAAE,EAAE;wBACb,IAAI,EAAE,MAAM;wBACZ,OAAO,EAAE,iBAAiB,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,eAAe,EAAE;wBAC/D,GAAG,EAAE,eAAe,CAAC,WAAW,CAAC,GAAG;qBACrC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KACF;CACF,CAAC"}
|
package/dist/client.d.ts
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import type { ChannelProbeResult, CreateTaskResponse, MessagesResponse, Task, TasksListResponse, WsTicketResponse } from './types';
|
|
2
|
-
/** Enhanced error class for DeskFree API errors with user-friendly messages */
|
|
3
|
-
export declare class DeskFreeError extends Error {
|
|
4
|
-
readonly type: 'network' | 'auth' | 'server' | 'client' | 'timeout' | 'invalid_response';
|
|
5
|
-
readonly statusCode?: number;
|
|
6
|
-
readonly userMessage: string;
|
|
7
|
-
readonly procedure: string;
|
|
8
|
-
constructor(type: DeskFreeError['type'], procedure: string, message: string, userMessage: string, statusCode?: number);
|
|
9
|
-
static fromResponse(response: Response, procedure: string, responseText: string): DeskFreeError;
|
|
10
|
-
static timeout(procedure: string, timeoutMs: number): DeskFreeError;
|
|
11
|
-
static invalidResponse(procedure: string): DeskFreeError;
|
|
12
|
-
static network(procedure: string, originalError: Error): DeskFreeError;
|
|
13
|
-
}
|
|
14
|
-
export declare class DeskFreeClient {
|
|
15
|
-
private botToken;
|
|
16
|
-
private apiUrl;
|
|
17
|
-
private requestTimeoutMs;
|
|
18
|
-
constructor(botToken: string, apiUrl: string, options?: {
|
|
19
|
-
requestTimeoutMs?: number;
|
|
20
|
-
});
|
|
21
|
-
private request;
|
|
22
|
-
/**
|
|
23
|
-
* Validates that a string parameter is non-empty.
|
|
24
|
-
* Catches invalid inputs before they hit the network.
|
|
25
|
-
*/
|
|
26
|
-
private requireNonEmpty;
|
|
27
|
-
/**
|
|
28
|
-
* Send a typing indicator to the DeskFree conversation.
|
|
29
|
-
*
|
|
30
|
-
* @param input - Optional parameters including taskId to scope the indicator
|
|
31
|
-
*/
|
|
32
|
-
typing(input?: {
|
|
33
|
-
taskId?: string;
|
|
34
|
-
}): Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Send a text message (with optional attachments) to a DeskFree conversation.
|
|
37
|
-
*
|
|
38
|
-
* @param input - Message content, optional userId, taskId, and attachments
|
|
39
|
-
*/
|
|
40
|
-
sendMessage(input: {
|
|
41
|
-
userId?: string;
|
|
42
|
-
content: string;
|
|
43
|
-
taskId?: string;
|
|
44
|
-
attachments?: Array<{
|
|
45
|
-
s3Key: string;
|
|
46
|
-
name: string;
|
|
47
|
-
contentType: string;
|
|
48
|
-
size: number;
|
|
49
|
-
}>;
|
|
50
|
-
}): Promise<void>;
|
|
51
|
-
/** Fetch paginated message history for a conversation. */
|
|
52
|
-
listMessages(input: {
|
|
53
|
-
userId?: string;
|
|
54
|
-
cursor?: string | null;
|
|
55
|
-
limit?: number;
|
|
56
|
-
}): Promise<MessagesResponse>;
|
|
57
|
-
/** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
|
|
58
|
-
getWsTicket(): Promise<WsTicketResponse>;
|
|
59
|
-
/** Create a new task, optionally with a recurring schedule. */
|
|
60
|
-
createTask(input: {
|
|
61
|
-
title: string;
|
|
62
|
-
instructions?: string;
|
|
63
|
-
isRecurring?: boolean;
|
|
64
|
-
recurringSchedule?: {
|
|
65
|
-
frequency: 'daily' | 'weekly' | 'biweekly' | 'monthly';
|
|
66
|
-
dayOfWeek?: number;
|
|
67
|
-
dayOfMonth?: number;
|
|
68
|
-
time: string;
|
|
69
|
-
timezone?: string;
|
|
70
|
-
};
|
|
71
|
-
}): Promise<CreateTaskResponse>;
|
|
72
|
-
/** Snooze a task until a given ISO-8601 datetime. */
|
|
73
|
-
snoozeTask(input: {
|
|
74
|
-
taskId: string;
|
|
75
|
-
snoozedUntil: string;
|
|
76
|
-
}): Promise<Task>;
|
|
77
|
-
/** Unsnooze a previously snoozed task, making it active again. */
|
|
78
|
-
unsnoozeTask(input: {
|
|
79
|
-
taskId: string;
|
|
80
|
-
}): Promise<Task>;
|
|
81
|
-
/** List tasks, optionally filtered by status. */
|
|
82
|
-
listTasks(input?: {
|
|
83
|
-
status?: string;
|
|
84
|
-
}): Promise<TasksListResponse>;
|
|
85
|
-
/** Claim a task so the bot can begin working on it. */
|
|
86
|
-
claimTask(input: {
|
|
87
|
-
taskId: string;
|
|
88
|
-
}): Promise<Task>;
|
|
89
|
-
/** Release a previously claimed task back to the queue. */
|
|
90
|
-
releaseTask(input: {
|
|
91
|
-
taskId: string;
|
|
92
|
-
}): Promise<Task>;
|
|
93
|
-
/** Submit a task for human review, optionally with a comment. */
|
|
94
|
-
requestReview(input: {
|
|
95
|
-
taskId: string;
|
|
96
|
-
comment?: string;
|
|
97
|
-
}): Promise<Task>;
|
|
98
|
-
/** Update the deliverable (markdown content) for a task. */
|
|
99
|
-
updateDeliverable(input: {
|
|
100
|
-
taskId: string;
|
|
101
|
-
deliverable: string;
|
|
102
|
-
}): Promise<void>;
|
|
103
|
-
/** Fetch a single task by ID. */
|
|
104
|
-
getTask(input: {
|
|
105
|
-
taskId: string;
|
|
106
|
-
}): Promise<Task>;
|
|
107
|
-
/** Send an agent status update to DeskFree. */
|
|
108
|
-
statusUpdate(input: {
|
|
109
|
-
status: 'idle' | 'working' | 'responding';
|
|
110
|
-
activeSubAgents: Array<{
|
|
111
|
-
label: string;
|
|
112
|
-
status: 'running' | 'completed' | 'failed';
|
|
113
|
-
startedAt: string;
|
|
114
|
-
completedAt?: string;
|
|
115
|
-
tokenUsage?: number;
|
|
116
|
-
task?: string;
|
|
117
|
-
}>;
|
|
118
|
-
model?: string;
|
|
119
|
-
lastActivity?: string;
|
|
120
|
-
pluginVersion?: string;
|
|
121
|
-
openclawVersion?: string;
|
|
122
|
-
}): Promise<{
|
|
123
|
-
success: boolean;
|
|
124
|
-
}>;
|
|
125
|
-
/** Get short-lived AWS credentials for S3 workspace access. */
|
|
126
|
-
workspaceCredentials(): Promise<{
|
|
127
|
-
accessKeyId: string;
|
|
128
|
-
secretAccessKey: string;
|
|
129
|
-
sessionToken: string;
|
|
130
|
-
expiration: Date;
|
|
131
|
-
s3Uri: string;
|
|
132
|
-
region: string;
|
|
133
|
-
}>;
|
|
134
|
-
/** Notify DeskFree that workspace files have changed locally. */
|
|
135
|
-
workspaceRead(input: {
|
|
136
|
-
path: string;
|
|
137
|
-
}): Promise<{
|
|
138
|
-
path: string;
|
|
139
|
-
content: string;
|
|
140
|
-
lastModified: string;
|
|
141
|
-
}>;
|
|
142
|
-
/**
|
|
143
|
-
* Lightweight health check that verifies connectivity and authentication.
|
|
144
|
-
*
|
|
145
|
-
* @param timeoutMs - Maximum time to wait for the probe response
|
|
146
|
-
* @returns Probe result indicating success or a descriptive error
|
|
147
|
-
*/
|
|
148
|
-
probe(timeoutMs: number): Promise<ChannelProbeResult>;
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=client.d.ts.map
|