@questionbase/deskfree 0.3.0-alpha.8 → 0.4.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/bin.d.ts +1 -0
  2. package/dist/bin.js +14115 -0
  3. package/dist/bin.js.map +1 -0
  4. package/dist/cli/install.d.ts +3 -0
  5. package/dist/cli/install.js +53 -0
  6. package/dist/cli/install.js.map +1 -0
  7. package/dist/cli/uninstall.d.ts +3 -0
  8. package/dist/cli/uninstall.js +36 -0
  9. package/dist/cli/uninstall.js.map +1 -0
  10. package/dist/index.d.ts +419 -12
  11. package/dist/index.js +13801 -23
  12. package/dist/index.js.map +1 -1
  13. package/package.json +37 -46
  14. package/README.md +0 -137
  15. package/dist/channel.d.ts +0 -3
  16. package/dist/channel.d.ts.map +0 -1
  17. package/dist/channel.js +0 -529
  18. package/dist/channel.js.map +0 -1
  19. package/dist/client.d.ts +0 -184
  20. package/dist/client.d.ts.map +0 -1
  21. package/dist/client.js +0 -264
  22. package/dist/client.js.map +0 -1
  23. package/dist/context.d.ts +0 -15
  24. package/dist/context.d.ts.map +0 -1
  25. package/dist/context.js +0 -31
  26. package/dist/context.js.map +0 -1
  27. package/dist/deliver.d.ts +0 -22
  28. package/dist/deliver.d.ts.map +0 -1
  29. package/dist/deliver.js +0 -432
  30. package/dist/deliver.js.map +0 -1
  31. package/dist/error-reporter.d.ts +0 -39
  32. package/dist/error-reporter.d.ts.map +0 -1
  33. package/dist/error-reporter.js +0 -94
  34. package/dist/error-reporter.js.map +0 -1
  35. package/dist/gateway.d.ts +0 -13
  36. package/dist/gateway.d.ts.map +0 -1
  37. package/dist/gateway.js +0 -770
  38. package/dist/gateway.js.map +0 -1
  39. package/dist/index.d.ts.map +0 -1
  40. package/dist/llm-definitions.d.ts +0 -117
  41. package/dist/llm-definitions.d.ts.map +0 -1
  42. package/dist/llm-definitions.js +0 -121
  43. package/dist/llm-definitions.js.map +0 -1
  44. package/dist/offline-queue.d.ts +0 -45
  45. package/dist/offline-queue.d.ts.map +0 -1
  46. package/dist/offline-queue.js +0 -109
  47. package/dist/offline-queue.js.map +0 -1
  48. package/dist/paths.d.ts +0 -10
  49. package/dist/paths.d.ts.map +0 -1
  50. package/dist/paths.js +0 -29
  51. package/dist/paths.js.map +0 -1
  52. package/dist/runtime.d.ts +0 -17
  53. package/dist/runtime.d.ts.map +0 -1
  54. package/dist/runtime.js +0 -24
  55. package/dist/runtime.js.map +0 -1
  56. package/dist/streaming.d.ts +0 -44
  57. package/dist/streaming.d.ts.map +0 -1
  58. package/dist/streaming.js +0 -125
  59. package/dist/streaming.js.map +0 -1
  60. package/dist/tools.d.ts +0 -23
  61. package/dist/tools.d.ts.map +0 -1
  62. package/dist/tools.js +0 -437
  63. package/dist/tools.js.map +0 -1
  64. package/dist/types.d.ts +0 -484
  65. package/dist/types.d.ts.map +0 -1
  66. package/dist/types.js +0 -2
  67. package/dist/types.js.map +0 -1
  68. package/dist/version.d.ts +0 -2
  69. package/dist/version.d.ts.map +0 -1
  70. package/dist/version.js +0 -4
  71. package/dist/version.js.map +0 -1
  72. package/dist/workspace.d.ts +0 -18
  73. package/dist/workspace.d.ts.map +0 -1
  74. package/dist/workspace.js +0 -83
  75. package/dist/workspace.js.map +0 -1
  76. package/openclaw.plugin.json +0 -8
  77. package/skills/deskfree/SKILL.md +0 -243
  78. package/skills/deskfree/references/tools.md +0 -102
package/dist/client.d.ts DELETED
@@ -1,184 +0,0 @@
1
- import type { ChannelProbeResult, CompleteTaskInput, CreateTaskResponse, Goal, MessagesResponse, Task, TaskWithContext, WorkspaceState, 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
- clear?: boolean;
35
- }): Promise<void>;
36
- /**
37
- * Update an existing bot message content (for streaming).
38
- *
39
- * @param input - messageId, new content, and streaming flag
40
- */
41
- updateMessage(input: {
42
- messageId: string;
43
- content: string;
44
- streaming?: boolean;
45
- }): Promise<{
46
- messageId: string;
47
- content: string;
48
- }>;
49
- /**
50
- * Send a text message (with optional attachments) to a DeskFree conversation.
51
- *
52
- * @param input - Message content, optional userId, taskId, and attachments
53
- */
54
- sendMessage(input: {
55
- userId?: string;
56
- content: string;
57
- taskId?: string;
58
- attachments?: Array<{
59
- s3Key: string;
60
- name: string;
61
- contentType: string;
62
- size: number;
63
- }>;
64
- }): Promise<{
65
- messageId: string;
66
- content: string;
67
- }>;
68
- /** Fetch paginated message history for a conversation. */
69
- listMessages(input: {
70
- userId?: string;
71
- cursor?: string | null;
72
- limit?: number;
73
- }): Promise<MessagesResponse>;
74
- /** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
75
- getWsTicket(): Promise<WsTicketResponse>;
76
- /** Create a new goal. */
77
- createGoal(input: {
78
- title: string;
79
- description?: string;
80
- }): Promise<{
81
- goal: Goal;
82
- }>;
83
- /** Update a goal's status, title, or description. */
84
- updateGoal(input: {
85
- goalId: string;
86
- title?: string;
87
- description?: string;
88
- status?: string;
89
- }): Promise<Goal>;
90
- /** Create a new task, optionally with a recurring schedule. */
91
- createTask(input: {
92
- title: string;
93
- instructions?: string;
94
- goalId?: string;
95
- isRecurring?: boolean;
96
- recurringSchedule?: {
97
- frequency: 'daily' | 'weekly' | 'biweekly' | 'monthly';
98
- dayOfWeek?: number;
99
- dayOfMonth?: number;
100
- time: string;
101
- timezone?: string;
102
- };
103
- }): Promise<CreateTaskResponse>;
104
- /** Claim a task so the bot can begin working on it. Returns enriched context. */
105
- claimTask(input: {
106
- taskId: string;
107
- }): Promise<TaskWithContext>;
108
- /** Update the deliverable (markdown content) for a task. */
109
- updateDeliverable(input: {
110
- taskId: string;
111
- deliverable: string;
112
- }): Promise<void>;
113
- /** Send an agent status update to DeskFree. */
114
- statusUpdate(input: {
115
- status: 'idle' | 'working' | 'responding';
116
- activeSubAgents: Array<{
117
- label: string;
118
- status: 'running' | 'completed' | 'failed';
119
- startedAt: string;
120
- completedAt?: string;
121
- tokenUsage?: number;
122
- task?: string;
123
- }>;
124
- model?: string;
125
- lastActivity?: string;
126
- pluginVersion?: string;
127
- openclawVersion?: string;
128
- }): Promise<{
129
- success: boolean;
130
- }>;
131
- /** Report error log entries to the backend for CloudWatch/Slack visibility. */
132
- reportError(input: {
133
- errors: Array<{
134
- message: string;
135
- level: 'warn' | 'error' | 'fatal';
136
- timestamp: string;
137
- metadata?: Record<string, unknown>;
138
- }>;
139
- }): Promise<{
140
- accepted: number;
141
- }>;
142
- /** Get short-lived AWS credentials for S3 workspace access. */
143
- workspaceCredentials(): Promise<{
144
- accessKeyId: string;
145
- secretAccessKey: string;
146
- sessionToken: string;
147
- expiration: Date;
148
- s3Uri: string;
149
- region: string;
150
- }>;
151
- /** Notify DeskFree that workspace files have changed locally. */
152
- workspaceRead(input: {
153
- path: string;
154
- }): Promise<{
155
- path: string;
156
- content: string;
157
- lastModified: string;
158
- }>;
159
- /** Get full workspace snapshot — goals with tasks, unlinked tasks, recently done. */
160
- getState(): Promise<WorkspaceState>;
161
- /** Report token usage for a task. Atomically increments rollup columns. */
162
- reportUsage(input: {
163
- taskId: string;
164
- inputTokens: number;
165
- outputTokens: number;
166
- thinkingTokens: number;
167
- model: string;
168
- estimatedCost: number;
169
- }): Promise<{
170
- success: boolean;
171
- }>;
172
- /** Complete a task with an outcome. Moves task to waiting_for_human. */
173
- completeTask(input: CompleteTaskInput): Promise<Task & {
174
- outcome: 'done' | 'blocked';
175
- }>;
176
- /**
177
- * Lightweight health check that verifies connectivity and authentication.
178
- *
179
- * @param timeoutMs - Maximum time to wait for the probe response
180
- * @returns Probe result indicating success or a descriptive error
181
- */
182
- probe(timeoutMs: number): Promise<ChannelProbeResult>;
183
- }
184
- //# sourceMappingURL=client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,eAAe,EACf,cAAc,EACd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AASjB,+EAA+E;AAC/E,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAgB,IAAI,EAChB,SAAS,GACT,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,kBAAkB,CAAC;IACvB,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,WAAW,EAAE,MAAM,CAAC;IACpC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAGhC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM;IAUrB,MAAM,CAAC,YAAY,CACjB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,YAAY,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,IAAI,OAAO,CAAC;QACpC,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,IAAI,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAIF,iEAAiE;IAC3D,aAAa,CAAC,KAAK,EAAE;QACzB,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IAIpE,qFAAqF;IAC/E,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAIzC,2EAA2E;IACrE,WAAW,CAAC,KAAK,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,aAAa,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAMjC,wEAAwE;IAClE,YAAY,CAChB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,IAAI,GAAG;QAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAKlD;;;;;OAKG;IACG,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAmD5D"}
package/dist/client.js DELETED
@@ -1,264 +0,0 @@
1
- /**
2
- * HTTP client for the DeskFree bot API.
3
- * All endpoints use tRPC via HTTP POST/GET.
4
- */
5
- /** Default timeout for API requests (30 seconds). */
6
- const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
7
- /** Enhanced error class for DeskFree API errors with user-friendly messages */
8
- export class DeskFreeError extends Error {
9
- type;
10
- statusCode;
11
- userMessage;
12
- procedure;
13
- constructor(type, procedure, message, userMessage, statusCode) {
14
- super(message);
15
- this.name = 'DeskFreeError';
16
- this.type = type;
17
- this.procedure = procedure;
18
- this.userMessage = userMessage;
19
- this.statusCode = statusCode;
20
- }
21
- static fromResponse(response, procedure, responseText) {
22
- const status = response.status;
23
- const statusText = response.statusText;
24
- if (status === 401) {
25
- return new DeskFreeError('auth', procedure, `Authentication failed: ${status} ${statusText} — ${responseText}`, 'Your bot token is invalid or has expired. Please check your authentication credentials.', status);
26
- }
27
- if (status === 403) {
28
- return new DeskFreeError('auth', procedure, `Authorization failed: ${status} ${statusText} — ${responseText}`, 'Your bot does not have permission to perform this action. Contact your administrator.', status);
29
- }
30
- if (status >= 500) {
31
- return new DeskFreeError('server', procedure, `Server error: ${status} ${statusText} — ${responseText}`, 'DeskFree service is temporarily unavailable. Please try again in a few minutes.', status);
32
- }
33
- if (status === 429) {
34
- return new DeskFreeError('client', procedure, `Rate limit exceeded: ${status} ${statusText} — ${responseText}`, 'Too many requests. Please wait a moment before trying again.', status);
35
- }
36
- if (status === 400) {
37
- return new DeskFreeError('client', procedure, `Bad request: ${status} ${statusText} — ${responseText}`, 'The request was invalid. Please check your input and try again.', status);
38
- }
39
- return new DeskFreeError('client', procedure, `HTTP error: ${status} ${statusText} — ${responseText}`, `Request failed with error ${status}. Please try again or contact support if the problem persists.`, status);
40
- }
41
- static timeout(procedure, timeoutMs) {
42
- return new DeskFreeError('timeout', procedure, `Request to ${procedure} timed out after ${timeoutMs}ms`, 'The request took too long to complete. Please check your network connection and try again.');
43
- }
44
- static invalidResponse(procedure) {
45
- return new DeskFreeError('invalid_response', procedure, `Invalid tRPC response structure for ${procedure}`, 'Received an unexpected response from the server. Please try again or contact support.');
46
- }
47
- static network(procedure, originalError) {
48
- return new DeskFreeError('network', procedure, `Network error for ${procedure}: ${originalError.message}`, 'Unable to connect to DeskFree. Please check your internet connection and try again.');
49
- }
50
- }
51
- export class DeskFreeClient {
52
- botToken;
53
- apiUrl;
54
- requestTimeoutMs;
55
- constructor(botToken, apiUrl, options) {
56
- this.botToken = botToken;
57
- this.apiUrl = apiUrl.replace(/\/$/, '');
58
- this.requestTimeoutMs =
59
- options?.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
60
- }
61
- async request(method, procedure, input) {
62
- const url = method === 'GET' && input
63
- ? `${this.apiUrl}/${procedure}?input=${encodeURIComponent(JSON.stringify(input))}`
64
- : `${this.apiUrl}/${procedure}`;
65
- const controller = new AbortController();
66
- const timer = setTimeout(() => controller.abort(), this.requestTimeoutMs);
67
- try {
68
- const response = await fetch(url, {
69
- method,
70
- headers: {
71
- Authorization: `Bot ${this.botToken}`,
72
- 'Content-Type': 'application/json',
73
- },
74
- body: method === 'POST' ? JSON.stringify(input) : undefined,
75
- signal: controller.signal,
76
- });
77
- if (!response.ok) {
78
- const text = await response.text().catch((err) => {
79
- const errMsg = err instanceof Error ? err.message : String(err);
80
- return `(failed to read response body: ${errMsg})`;
81
- });
82
- throw DeskFreeError.fromResponse(response, procedure, text);
83
- }
84
- const json = (await response.json());
85
- // Validate tRPC response structure
86
- if (!json.result || json.result.data === undefined) {
87
- throw DeskFreeError.invalidResponse(procedure);
88
- }
89
- return json.result.data;
90
- }
91
- catch (err) {
92
- if (err instanceof DeskFreeError) {
93
- throw err;
94
- }
95
- if (err instanceof Error && err.name === 'AbortError') {
96
- throw DeskFreeError.timeout(procedure, this.requestTimeoutMs);
97
- }
98
- if (err instanceof Error) {
99
- // Network or other fetch errors
100
- throw DeskFreeError.network(procedure, err);
101
- }
102
- throw err;
103
- }
104
- finally {
105
- clearTimeout(timer);
106
- }
107
- }
108
- /**
109
- * Validates that a string parameter is non-empty.
110
- * Catches invalid inputs before they hit the network.
111
- */
112
- requireNonEmpty(value, name) {
113
- if (!value || value.trim() === '') {
114
- throw new DeskFreeError('client', name, `${name} is required and cannot be empty`, `Missing required parameter: ${name}. Please provide a valid value.`);
115
- }
116
- }
117
- /**
118
- * Send a typing indicator to the DeskFree conversation.
119
- *
120
- * @param input - Optional parameters including taskId to scope the indicator
121
- */
122
- async typing(input) {
123
- return this.request('POST', 'messages.typing', input ?? {});
124
- }
125
- /**
126
- * Update an existing bot message content (for streaming).
127
- *
128
- * @param input - messageId, new content, and streaming flag
129
- */
130
- async updateMessage(input) {
131
- return this.request('POST', 'messages.update', input);
132
- }
133
- /**
134
- * Send a text message (with optional attachments) to a DeskFree conversation.
135
- *
136
- * @param input - Message content, optional userId, taskId, and attachments
137
- */
138
- async sendMessage(input) {
139
- this.requireNonEmpty(input.content, 'content');
140
- return this.request('POST', 'messages.send', input);
141
- }
142
- /** Fetch paginated message history for a conversation. */
143
- async listMessages(input) {
144
- if (input.limit !== undefined && (input.limit < 1 || input.limit > 100)) {
145
- throw new DeskFreeError('client', 'limit', 'limit must be between 1 and 100', 'The limit parameter must be between 1 and 100.');
146
- }
147
- return this.request('GET', 'messages.list', input);
148
- }
149
- /** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
150
- async getWsTicket() {
151
- return this.request('POST', 'messages.wsTicket', {});
152
- }
153
- // ── Goals ─────────────────────────────────────────────────
154
- /** Create a new goal. */
155
- async createGoal(input) {
156
- this.requireNonEmpty(input.title, 'title');
157
- return this.request('POST', 'goals.create', input);
158
- }
159
- /** Update a goal's status, title, or description. */
160
- async updateGoal(input) {
161
- this.requireNonEmpty(input.goalId, 'goalId');
162
- return this.request('POST', 'goals.update', input);
163
- }
164
- // ── Tasks ─────────────────────────────────────────────────
165
- /** Create a new task, optionally with a recurring schedule. */
166
- async createTask(input) {
167
- this.requireNonEmpty(input.title, 'title');
168
- return this.request('POST', 'tasks.create', input);
169
- }
170
- /** Claim a task so the bot can begin working on it. Returns enriched context. */
171
- async claimTask(input) {
172
- this.requireNonEmpty(input.taskId, 'taskId');
173
- return this.request('POST', 'tasks.claim', input);
174
- }
175
- /** Update the deliverable (markdown content) for a task. */
176
- async updateDeliverable(input) {
177
- this.requireNonEmpty(input.taskId, 'taskId');
178
- this.requireNonEmpty(input.deliverable, 'deliverable');
179
- return this.request('POST', 'tasks.updateDeliverable', input);
180
- }
181
- /** Send an agent status update to DeskFree. */
182
- async statusUpdate(input) {
183
- return this.request('POST', 'agent.statusUpdate', input);
184
- }
185
- /** Report error log entries to the backend for CloudWatch/Slack visibility. */
186
- async reportError(input) {
187
- return this.request('POST', 'agent.reportError', input);
188
- }
189
- /** Get short-lived AWS credentials for S3 workspace access. */
190
- async workspaceCredentials() {
191
- return this.request('POST', 'workspace.credentials', {});
192
- }
193
- /** Notify DeskFree that workspace files have changed locally. */
194
- async workspaceRead(input) {
195
- return this.request('GET', 'workspace.read', input);
196
- }
197
- /** Get full workspace snapshot — goals with tasks, unlinked tasks, recently done. */
198
- async getState() {
199
- return this.request('GET', 'state.get', {});
200
- }
201
- /** Report token usage for a task. Atomically increments rollup columns. */
202
- async reportUsage(input) {
203
- this.requireNonEmpty(input.taskId, 'taskId');
204
- this.requireNonEmpty(input.model, 'model');
205
- return this.request('POST', 'tasks.reportUsage', input);
206
- }
207
- /** Complete a task with an outcome. Moves task to waiting_for_human. */
208
- async completeTask(input) {
209
- this.requireNonEmpty(input.taskId, 'taskId');
210
- return this.request('POST', 'tasks.complete', input);
211
- }
212
- /**
213
- * Lightweight health check that verifies connectivity and authentication.
214
- *
215
- * @param timeoutMs - Maximum time to wait for the probe response
216
- * @returns Probe result indicating success or a descriptive error
217
- */
218
- async probe(timeoutMs) {
219
- const controller = new AbortController();
220
- const timer = setTimeout(() => controller.abort(), timeoutMs);
221
- try {
222
- const response = await fetch(`${this.apiUrl}/state.get?input=${encodeURIComponent(JSON.stringify({}))}`, {
223
- method: 'GET',
224
- headers: {
225
- Authorization: `Bot ${this.botToken}`,
226
- 'Content-Type': 'application/json',
227
- },
228
- signal: controller.signal,
229
- });
230
- if (!response.ok) {
231
- // Provide more user-friendly probe error messages
232
- if (response.status === 401 || response.status === 403) {
233
- return {
234
- ok: false,
235
- error: 'Authentication failed - check bot token',
236
- };
237
- }
238
- if (response.status >= 500) {
239
- return { ok: false, error: 'DeskFree server unavailable' };
240
- }
241
- return {
242
- ok: false,
243
- error: `HTTP ${response.status} - ${response.statusText}`,
244
- };
245
- }
246
- return { ok: true };
247
- }
248
- catch (err) {
249
- if (err instanceof Error && err.name === 'AbortError') {
250
- return { ok: false, error: `Connection timeout after ${timeoutMs}ms` };
251
- }
252
- const message = err instanceof Error ? err.message : String(err);
253
- // Simplify network errors for probe results
254
- if (message.includes('fetch')) {
255
- return { ok: false, error: 'Network connection failed' };
256
- }
257
- return { ok: false, error: message };
258
- }
259
- finally {
260
- clearTimeout(timer);
261
- }
262
- }
263
- }
264
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,qDAAqD;AACrD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C,+EAA+E;AAC/E,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtB,IAAI,CAMG;IACP,UAAU,CAAU;IACpB,WAAW,CAAS;IACpB,SAAS,CAAS;IAElC,YACE,IAA2B,EAC3B,SAAiB,EACjB,OAAe,EACf,WAAmB,EACnB,UAAmB;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,MAAM,CAAC,YAAY,CACjB,QAAkB,EAClB,SAAiB,EACjB,YAAoB;QAEpB,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QAEvC,IAAI,MAAM,KA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AAC;gBAC7D,CAAC;gBACD,OAAO;oBACL,EAAE,EAAE,KAAK;oBACT,KAAK,EAAE,QAAQ,QAAQ,CAAC,MAAM,MAAM,QAAQ,CAAC,UAAU,EAAE;iBAC1D,CAAC;YACJ,CAAC;YAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBACtD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,4BAA4B,SAAS,IAAI,EAAE,CAAC;YACzE,CAAC;YAED,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,4CAA4C;YAC5C,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC;YAC3D,CAAC;YAED,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
package/dist/context.d.ts DELETED
@@ -1,15 +0,0 @@
1
- /**
2
- * DeskFree directive injected into agent context via before_agent_start hook.
3
- * This replaces the old AGENTS.md file injection approach, ensuring the directive
4
- * is always present from the first turn (no race condition with file writes).
5
- */
6
- export declare const DESKFREE_AGENT_DIRECTIVE = "## DeskFree\nAlways read the deskfree skill (SKILL.md) at startup. Follow its workflow for task tracking and messaging.\n1. ALL work requires a task \u2014 use `deskfree_create_task` then `deskfree_start_task`.\n2. Goals before tasks \u2014 use `deskfree_create_goal` for multi-step objectives.\n3. Build deliverables incrementally \u2014 use `deskfree_update_deliverable` from the start.\n4. Always complete tasks \u2014 use `deskfree_complete_task` with outcome \"done\" or \"blocked\".\n5. Auto-threading works \u2014 messages sent while a task is active are threaded automatically.\n6. One task per sub-agent \u2014 sub-agents only get 3 tools: update_deliverable, complete_task, send_message.";
7
- /**
8
- * DeskFree heartbeat checklist injected into agent context for heartbeat turns.
9
- */
10
- export declare const DESKFREE_HEARTBEAT_DIRECTIVE = "## DeskFree Heartbeat\nOn each heartbeat, run through this checklist:\n1. Run `deskfree_state` to get full workspace snapshot.\n2. Any active goals without pending tasks? Create the next task.\n3. Any `ready_for_bot` tasks? Check capacity, then `deskfree_start_task` and spawn sub-agents.\n4. Any goals with no activity in 48h? Create a task or nudge the human.\n5. Any `working_on_it` tasks with no active sub-agent? Complete as blocked or resume.";
11
- /**
12
- * Returns the full context to prepend to every agent turn.
13
- */
14
- export declare function getDeskFreeContext(): string;
15
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,8rBAOqE,CAAC;AAE3G;;GAEG;AACH,eAAO,MAAM,4BAA4B,qcAM+C,CAAC;AAEzF;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
package/dist/context.js DELETED
@@ -1,31 +0,0 @@
1
- import { PLUGIN_VERSION } from './version';
2
- /**
3
- * DeskFree directive injected into agent context via before_agent_start hook.
4
- * This replaces the old AGENTS.md file injection approach, ensuring the directive
5
- * is always present from the first turn (no race condition with file writes).
6
- */
7
- export const DESKFREE_AGENT_DIRECTIVE = `## DeskFree
8
- Always read the deskfree skill (SKILL.md) at startup. Follow its workflow for task tracking and messaging.
9
- 1. ALL work requires a task — use \`deskfree_create_task\` then \`deskfree_start_task\`.
10
- 2. Goals before tasks — use \`deskfree_create_goal\` for multi-step objectives.
11
- 3. Build deliverables incrementally — use \`deskfree_update_deliverable\` from the start.
12
- 4. Always complete tasks — use \`deskfree_complete_task\` with outcome "done" or "blocked".
13
- 5. Auto-threading works — messages sent while a task is active are threaded automatically.
14
- 6. One task per sub-agent — sub-agents only get 3 tools: update_deliverable, complete_task, send_message.`;
15
- /**
16
- * DeskFree heartbeat checklist injected into agent context for heartbeat turns.
17
- */
18
- export const DESKFREE_HEARTBEAT_DIRECTIVE = `## DeskFree Heartbeat
19
- On each heartbeat, run through this checklist:
20
- 1. Run \`deskfree_state\` to get full workspace snapshot.
21
- 2. Any active goals without pending tasks? Create the next task.
22
- 3. Any \`ready_for_bot\` tasks? Check capacity, then \`deskfree_start_task\` and spawn sub-agents.
23
- 4. Any goals with no activity in 48h? Create a task or nudge the human.
24
- 5. Any \`working_on_it\` tasks with no active sub-agent? Complete as blocked or resume.`;
25
- /**
26
- * Returns the full context to prepend to every agent turn.
27
- */
28
- export function getDeskFreeContext() {
29
- return `${DESKFREE_AGENT_DIRECTIVE}\n\n<!-- deskfree-plugin:${PLUGIN_VERSION} -->`;
30
- }
31
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;0GAOkE,CAAC;AAE3G;;GAEG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;wFAM4C,CAAC;AAEzF;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,GAAG,wBAAwB,4BAA4B,cAAc,MAAM,CAAC;AACrF,CAAC"}
package/dist/deliver.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import { DeskFreeClient } from './client';
2
- import type { ChannelGatewayContext, ChatMessage } from './types';
3
- /**
4
- * Validates if a content type is safe to download.
5
- */
6
- export declare function isContentTypeAllowed(contentType: string): boolean;
7
- /**
8
- * Sanitizes a filename to prevent directory traversal and other security issues.
9
- */
10
- export declare function sanitizeFileName(fileName: string): string;
11
- /**
12
- * Validates a URL to ensure it's a proper HTTPS URL.
13
- */
14
- export declare function validateDownloadUrl(url: string): void;
15
- /**
16
- * Delivers a DeskFree chat message to the OpenClaw agent pipeline.
17
- *
18
- * Each message produces a single inbound message.
19
- * If the message has a taskId, it's set as ThreadId for conversation threading.
20
- */
21
- export declare function deliverMessageToAgent(ctx: ChannelGatewayContext, message: ChatMessage, client: DeskFreeClient): Promise<void>;
22
- //# sourceMappingURL=deliver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deliver.d.ts","sourceRoot":"","sources":["../src/deliver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAM1C,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EAGZ,MAAM,SAAS,CAAC;AAuCjB;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAKjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CA+DrD;AAyKD;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,qBAAqB,EAC1B,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CA2Nf"}