@clawroom/openclaw 0.0.15 → 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 +1 -1
- package/package.json +3 -3
- package/src/channel.ts +2 -2
- package/src/task-executor.ts +14 -16
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ OpenClaw channel plugin for the ClawRoom task marketplace. Connects your OpenCla
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
openclaw plugins install clawroom
|
|
8
|
+
openclaw plugins install @clawroom/openclaw
|
|
9
9
|
openclaw config set channels.clawroom.token "YOUR_TOKEN"
|
|
10
10
|
openclaw gateway restart
|
|
11
11
|
```
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawroom/openclaw",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "OpenClaw channel plugin for the Claw Room task marketplace",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/clawroom/clawroom.git"
|
|
10
10
|
},
|
|
11
11
|
"keywords": [
|
|
12
12
|
"openclaw",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"openclaw.plugin.json"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@clawroom/sdk": "
|
|
23
|
+
"@clawroom/sdk": ">=0.0.1"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"openclaw": "*"
|
package/src/channel.ts
CHANGED
|
@@ -109,9 +109,9 @@ export const clawroomPlugin: ChannelPlugin<ResolvedClawroomAccount> = {
|
|
|
109
109
|
// to deliver a reply through the channel outbound path.
|
|
110
110
|
if (activeClient) {
|
|
111
111
|
activeClient.send({
|
|
112
|
-
type: "agent.
|
|
112
|
+
type: "agent.complete",
|
|
113
113
|
taskId: to,
|
|
114
|
-
|
|
114
|
+
output: text,
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
return { channel: "clawroom", messageId: to, to };
|
package/src/task-executor.ts
CHANGED
|
@@ -143,10 +143,10 @@ async function executeTask(opts: {
|
|
|
143
143
|
const filesFromTools = extractWrittenFiles(messages);
|
|
144
144
|
const filesFromOutput = extractOutputFileMarkers(rawOutput);
|
|
145
145
|
const allFiles = [...new Set([...filesFromTools, ...filesFromOutput])];
|
|
146
|
-
const
|
|
146
|
+
const files = readAllFiles(allFiles, log);
|
|
147
147
|
|
|
148
148
|
// Strip OUTPUT_FILE markers and internal paths from the user-facing output
|
|
149
|
-
const
|
|
149
|
+
const output = rawOutput
|
|
150
150
|
.split("\n")
|
|
151
151
|
.filter((line) => !line.match(/OUTPUT_FILE:\s*/))
|
|
152
152
|
.join("\n")
|
|
@@ -154,12 +154,12 @@ async function executeTask(opts: {
|
|
|
154
154
|
.replace(/\n{3,}/g, "\n\n") // collapse extra newlines
|
|
155
155
|
.trim();
|
|
156
156
|
|
|
157
|
-
log?.info?.(`[clawroom:executor] task ${task.taskId} completed${
|
|
157
|
+
log?.info?.(`[clawroom:executor] task ${task.taskId} completed${files.length > 0 ? ` (with ${files.length} file(s))` : ""}`);
|
|
158
158
|
ws.send({
|
|
159
|
-
type: "agent.
|
|
159
|
+
type: "agent.complete",
|
|
160
160
|
taskId: task.taskId,
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
output,
|
|
162
|
+
attachments: files.length > 0 ? files : undefined,
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
await runtime.subagent.deleteSession({
|
|
@@ -274,32 +274,30 @@ function tryParse(s: string): unknown {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
/**
|
|
277
|
-
* Read
|
|
277
|
+
* Read all valid files from disk and encode them as base64.
|
|
278
278
|
* Skips missing files and files > MAX_FILE_SIZE.
|
|
279
279
|
*/
|
|
280
|
-
function
|
|
280
|
+
function readAllFiles(
|
|
281
281
|
paths: string[],
|
|
282
282
|
log?: { info?: (...args: unknown[]) => void; warn?: (...args: unknown[]) => void },
|
|
283
|
-
): AgentResultFile
|
|
284
|
-
|
|
283
|
+
): AgentResultFile[] {
|
|
284
|
+
const results: AgentResultFile[] = [];
|
|
285
|
+
for (const fp of paths) {
|
|
285
286
|
try {
|
|
286
287
|
if (!fs.existsSync(fp)) { log?.warn?.(`[clawroom:executor] file not found: ${fp}`); continue; }
|
|
287
288
|
const stat = fs.statSync(fp);
|
|
288
289
|
if (stat.size > MAX_FILE_SIZE) { log?.warn?.(`[clawroom:executor] file too large: ${fp} (${stat.size})`); continue; }
|
|
289
290
|
const data = fs.readFileSync(fp);
|
|
290
291
|
const ext = path.extname(fp).toLowerCase();
|
|
291
|
-
if (index > 0) {
|
|
292
|
-
log?.warn?.(`[clawroom:executor] multiple output files detected; only reporting the first usable file`);
|
|
293
|
-
}
|
|
294
292
|
log?.info?.(`[clawroom:executor] attached: ${path.basename(fp)} (${data.length} bytes)`);
|
|
295
|
-
|
|
293
|
+
results.push({
|
|
296
294
|
filename: path.basename(fp),
|
|
297
295
|
mimeType: MIME_MAP[ext] ?? "application/octet-stream",
|
|
298
296
|
data: data.toString("base64"),
|
|
299
|
-
};
|
|
297
|
+
});
|
|
300
298
|
} catch (err) {
|
|
301
299
|
log?.warn?.(`[clawroom:executor] failed to read ${fp}: ${err}`);
|
|
302
300
|
}
|
|
303
301
|
}
|
|
304
|
-
return
|
|
302
|
+
return results;
|
|
305
303
|
}
|