@questionbase/deskfree 0.3.0-alpha.4 → 0.3.0-alpha.41
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 +39 -20
- package/dist/index.d.ts +785 -6
- package/dist/index.js +9880 -25
- package/dist/index.js.map +1 -1
- package/package.json +10 -11
- package/skills/deskfree/SKILL.md +118 -165
- package/skills/deskfree/references/tools.md +85 -42
- 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 -156
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -252
- package/dist/client.js.map +0 -1
- package/dist/context.d.ts +0 -15
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -31
- package/dist/context.js.map +0 -1
- package/dist/deliver.d.ts +0 -22
- package/dist/deliver.d.ts.map +0 -1
- package/dist/deliver.js +0 -379
- 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 -727
- package/dist/gateway.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/llm-definitions.d.ts +0 -117
- package/dist/llm-definitions.d.ts.map +0 -1
- package/dist/llm-definitions.js +0 -121
- 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 -23
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -437
- package/dist/tools.js.map +0 -1
- package/dist/types.d.ts +0 -484
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -4
- package/dist/version.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/client.d.ts
DELETED
|
@@ -1,156 +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
|
-
}): 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 goal. */
|
|
60
|
-
createGoal(input: {
|
|
61
|
-
title: string;
|
|
62
|
-
description?: string;
|
|
63
|
-
}): Promise<{
|
|
64
|
-
goal: Goal;
|
|
65
|
-
}>;
|
|
66
|
-
/** Update a goal's status, title, or description. */
|
|
67
|
-
updateGoal(input: {
|
|
68
|
-
goalId: string;
|
|
69
|
-
title?: string;
|
|
70
|
-
description?: string;
|
|
71
|
-
status?: string;
|
|
72
|
-
}): Promise<Goal>;
|
|
73
|
-
/** Create a new task, optionally with a recurring schedule. */
|
|
74
|
-
createTask(input: {
|
|
75
|
-
title: string;
|
|
76
|
-
instructions?: string;
|
|
77
|
-
goalId?: string;
|
|
78
|
-
isRecurring?: boolean;
|
|
79
|
-
recurringSchedule?: {
|
|
80
|
-
frequency: 'daily' | 'weekly' | 'biweekly' | 'monthly';
|
|
81
|
-
dayOfWeek?: number;
|
|
82
|
-
dayOfMonth?: number;
|
|
83
|
-
time: string;
|
|
84
|
-
timezone?: string;
|
|
85
|
-
};
|
|
86
|
-
}): Promise<CreateTaskResponse>;
|
|
87
|
-
/** Claim a task so the bot can begin working on it. Returns enriched context. */
|
|
88
|
-
claimTask(input: {
|
|
89
|
-
taskId: string;
|
|
90
|
-
}): Promise<TaskWithContext>;
|
|
91
|
-
/** Update the deliverable (markdown content) for a task. */
|
|
92
|
-
updateDeliverable(input: {
|
|
93
|
-
taskId: string;
|
|
94
|
-
deliverable: string;
|
|
95
|
-
}): Promise<void>;
|
|
96
|
-
/** Send an agent status update to DeskFree. */
|
|
97
|
-
statusUpdate(input: {
|
|
98
|
-
status: 'idle' | 'working' | 'responding';
|
|
99
|
-
activeSubAgents: Array<{
|
|
100
|
-
label: string;
|
|
101
|
-
status: 'running' | 'completed' | 'failed';
|
|
102
|
-
startedAt: string;
|
|
103
|
-
completedAt?: string;
|
|
104
|
-
tokenUsage?: number;
|
|
105
|
-
task?: string;
|
|
106
|
-
}>;
|
|
107
|
-
model?: string;
|
|
108
|
-
lastActivity?: string;
|
|
109
|
-
pluginVersion?: string;
|
|
110
|
-
openclawVersion?: string;
|
|
111
|
-
}): Promise<{
|
|
112
|
-
success: boolean;
|
|
113
|
-
}>;
|
|
114
|
-
/** Get short-lived AWS credentials for S3 workspace access. */
|
|
115
|
-
workspaceCredentials(): Promise<{
|
|
116
|
-
accessKeyId: string;
|
|
117
|
-
secretAccessKey: string;
|
|
118
|
-
sessionToken: string;
|
|
119
|
-
expiration: Date;
|
|
120
|
-
s3Uri: string;
|
|
121
|
-
region: string;
|
|
122
|
-
}>;
|
|
123
|
-
/** Notify DeskFree that workspace files have changed locally. */
|
|
124
|
-
workspaceRead(input: {
|
|
125
|
-
path: string;
|
|
126
|
-
}): Promise<{
|
|
127
|
-
path: string;
|
|
128
|
-
content: string;
|
|
129
|
-
lastModified: string;
|
|
130
|
-
}>;
|
|
131
|
-
/** Get full workspace snapshot — goals with tasks, unlinked tasks, recently done. */
|
|
132
|
-
getState(): Promise<WorkspaceState>;
|
|
133
|
-
/** Report token usage for a task. Atomically increments rollup columns. */
|
|
134
|
-
reportUsage(input: {
|
|
135
|
-
taskId: string;
|
|
136
|
-
inputTokens: number;
|
|
137
|
-
outputTokens: number;
|
|
138
|
-
thinkingTokens: number;
|
|
139
|
-
model: string;
|
|
140
|
-
estimatedCost: number;
|
|
141
|
-
}): Promise<{
|
|
142
|
-
success: boolean;
|
|
143
|
-
}>;
|
|
144
|
-
/** Complete a task with an outcome. Moves task to waiting_for_human. */
|
|
145
|
-
completeTask(input: CompleteTaskInput): Promise<Task & {
|
|
146
|
-
outcome: 'done' | 'blocked';
|
|
147
|
-
}>;
|
|
148
|
-
/**
|
|
149
|
-
* Lightweight health check that verifies connectivity and authentication.
|
|
150
|
-
*
|
|
151
|
-
* @param timeoutMs - Maximum time to wait for the probe response
|
|
152
|
-
* @returns Probe result indicating success or a descriptive error
|
|
153
|
-
*/
|
|
154
|
-
probe(timeoutMs: number): Promise<ChannelProbeResult>;
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -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,UAA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AAC,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,252 +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
|
-
* Send a text message (with optional attachments) to a DeskFree conversation.
|
|
127
|
-
*
|
|
128
|
-
* @param input - Message content, optional userId, taskId, and attachments
|
|
129
|
-
*/
|
|
130
|
-
async sendMessage(input) {
|
|
131
|
-
this.requireNonEmpty(input.content, 'content');
|
|
132
|
-
return this.request('POST', 'messages.send', input);
|
|
133
|
-
}
|
|
134
|
-
/** Fetch paginated message history for a conversation. */
|
|
135
|
-
async listMessages(input) {
|
|
136
|
-
if (input.limit !== undefined && (input.limit < 1 || input.limit > 100)) {
|
|
137
|
-
throw new DeskFreeError('client', 'limit', 'limit must be between 1 and 100', 'The limit parameter must be between 1 and 100.');
|
|
138
|
-
}
|
|
139
|
-
return this.request('GET', 'messages.list', input);
|
|
140
|
-
}
|
|
141
|
-
/** Obtain a one-time WebSocket authentication ticket for real-time notifications. */
|
|
142
|
-
async getWsTicket() {
|
|
143
|
-
return this.request('POST', 'messages.wsTicket', {});
|
|
144
|
-
}
|
|
145
|
-
// ── Goals ─────────────────────────────────────────────────
|
|
146
|
-
/** Create a new goal. */
|
|
147
|
-
async createGoal(input) {
|
|
148
|
-
this.requireNonEmpty(input.title, 'title');
|
|
149
|
-
return this.request('POST', 'goals.create', input);
|
|
150
|
-
}
|
|
151
|
-
/** Update a goal's status, title, or description. */
|
|
152
|
-
async updateGoal(input) {
|
|
153
|
-
this.requireNonEmpty(input.goalId, 'goalId');
|
|
154
|
-
return this.request('POST', 'goals.update', input);
|
|
155
|
-
}
|
|
156
|
-
// ── Tasks ─────────────────────────────────────────────────
|
|
157
|
-
/** Create a new task, optionally with a recurring schedule. */
|
|
158
|
-
async createTask(input) {
|
|
159
|
-
this.requireNonEmpty(input.title, 'title');
|
|
160
|
-
return this.request('POST', 'tasks.create', input);
|
|
161
|
-
}
|
|
162
|
-
/** Claim a task so the bot can begin working on it. Returns enriched context. */
|
|
163
|
-
async claimTask(input) {
|
|
164
|
-
this.requireNonEmpty(input.taskId, 'taskId');
|
|
165
|
-
return this.request('POST', 'tasks.claim', input);
|
|
166
|
-
}
|
|
167
|
-
/** Update the deliverable (markdown content) for a task. */
|
|
168
|
-
async updateDeliverable(input) {
|
|
169
|
-
this.requireNonEmpty(input.taskId, 'taskId');
|
|
170
|
-
this.requireNonEmpty(input.deliverable, 'deliverable');
|
|
171
|
-
return this.request('POST', 'tasks.updateDeliverable', input);
|
|
172
|
-
}
|
|
173
|
-
/** Send an agent status update to DeskFree. */
|
|
174
|
-
async statusUpdate(input) {
|
|
175
|
-
return this.request('POST', 'agent.statusUpdate', input);
|
|
176
|
-
}
|
|
177
|
-
/** Get short-lived AWS credentials for S3 workspace access. */
|
|
178
|
-
async workspaceCredentials() {
|
|
179
|
-
return this.request('POST', 'workspace.credentials', {});
|
|
180
|
-
}
|
|
181
|
-
/** Notify DeskFree that workspace files have changed locally. */
|
|
182
|
-
async workspaceRead(input) {
|
|
183
|
-
return this.request('GET', 'workspace.read', input);
|
|
184
|
-
}
|
|
185
|
-
/** Get full workspace snapshot — goals with tasks, unlinked tasks, recently done. */
|
|
186
|
-
async getState() {
|
|
187
|
-
return this.request('GET', 'state.get', {});
|
|
188
|
-
}
|
|
189
|
-
/** Report token usage for a task. Atomically increments rollup columns. */
|
|
190
|
-
async reportUsage(input) {
|
|
191
|
-
this.requireNonEmpty(input.taskId, 'taskId');
|
|
192
|
-
this.requireNonEmpty(input.model, 'model');
|
|
193
|
-
return this.request('POST', 'tasks.reportUsage', input);
|
|
194
|
-
}
|
|
195
|
-
/** Complete a task with an outcome. Moves task to waiting_for_human. */
|
|
196
|
-
async completeTask(input) {
|
|
197
|
-
this.requireNonEmpty(input.taskId, 'taskId');
|
|
198
|
-
return this.request('POST', 'tasks.complete', input);
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Lightweight health check that verifies connectivity and authentication.
|
|
202
|
-
*
|
|
203
|
-
* @param timeoutMs - Maximum time to wait for the probe response
|
|
204
|
-
* @returns Probe result indicating success or a descriptive error
|
|
205
|
-
*/
|
|
206
|
-
async probe(timeoutMs) {
|
|
207
|
-
const controller = new AbortController();
|
|
208
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
209
|
-
try {
|
|
210
|
-
const response = await fetch(`${this.apiUrl}/state.get?input=${encodeURIComponent(JSON.stringify({}))}`, {
|
|
211
|
-
method: 'GET',
|
|
212
|
-
headers: {
|
|
213
|
-
Authorization: `Bot ${this.botToken}`,
|
|
214
|
-
'Content-Type': 'application/json',
|
|
215
|
-
},
|
|
216
|
-
signal: controller.signal,
|
|
217
|
-
});
|
|
218
|
-
if (!response.ok) {
|
|
219
|
-
// Provide more user-friendly probe error messages
|
|
220
|
-
if (response.status === 401 || response.status === 403) {
|
|
221
|
-
return {
|
|
222
|
-
ok: false,
|
|
223
|
-
error: 'Authentication failed - check bot token',
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
if (response.status >= 500) {
|
|
227
|
-
return { ok: false, error: 'DeskFree server unavailable' };
|
|
228
|
-
}
|
|
229
|
-
return {
|
|
230
|
-
ok: false,
|
|
231
|
-
error: `HTTP ${response.status} - ${response.statusText}`,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
return { ok: true };
|
|
235
|
-
}
|
|
236
|
-
catch (err) {
|
|
237
|
-
if (err instanceof Error && err.name === 'AbortError') {
|
|
238
|
-
return { ok: false, error: `Connection timeout after ${timeoutMs}ms` };
|
|
239
|
-
}
|
|
240
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
241
|
-
// Simplify network errors for probe results
|
|
242
|
-
if (message.includes('fetch')) {
|
|
243
|
-
return { ok: false, error: 'Network connection failed' };
|
|
244
|
-
}
|
|
245
|
-
return { ok: false, error: message };
|
|
246
|
-
}
|
|
247
|
-
finally {
|
|
248
|
-
clearTimeout(timer);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
DELETED
|
@@ -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,IAA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AC,MAAM,IAAI,GAAG,EAAE,CAAC;oBAC3B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,6BAA6B,EAAE,CAAC;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
|
package/dist/context.d.ts.map
DELETED
|
@@ -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
|
package/dist/context.js.map
DELETED
|
@@ -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
|
package/dist/deliver.d.ts.map
DELETED
|
@@ -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;AAI1C,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,CAgKf"}
|