lobstah-openclaw-plugin 0.1.0 → 0.5.5
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/dist/index.js +66 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,6 +36,9 @@ function ensureLayout() {
|
|
|
36
36
|
fs.mkdirSync(dir, { recursive: true });
|
|
37
37
|
}
|
|
38
38
|
fs.mkdirSync(path.join(lobstahHome(), "worktrees"), { recursive: true });
|
|
39
|
+
fs.mkdirSync(path.join(lobstahHome(), "watches"), { recursive: true });
|
|
40
|
+
fs.mkdirSync(path.join(lobstahHome(), "soaking"), { recursive: true });
|
|
41
|
+
fs.mkdirSync(path.join(lobstahHome(), "helm", ".relieved"), { recursive: true });
|
|
39
42
|
}
|
|
40
43
|
function statusPath(id, lane) {
|
|
41
44
|
return path.join(laneDirs(lane).state, `${id}.status`);
|
|
@@ -45,33 +48,19 @@ function eventsPath(id, lane) {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
// packages/core/dist/queue.js
|
|
48
|
-
import * as
|
|
51
|
+
import * as fs3 from "node:fs";
|
|
49
52
|
import * as path2 from "node:path";
|
|
50
|
-
function atomicWrite(file, content) {
|
|
51
|
-
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
52
|
-
fs2.writeFileSync(tmp, content);
|
|
53
|
-
fs2.renameSync(tmp, file);
|
|
54
|
-
}
|
|
55
|
-
function enqueue(d, lane = "work") {
|
|
56
|
-
if (!d.id || !d.repo || !d.brief) {
|
|
57
|
-
throw new Error("descriptor requires id, repo, and brief");
|
|
58
|
-
}
|
|
59
|
-
atomicWrite(path2.join(laneDirs(lane).queue, `${d.id}.json`), JSON.stringify(d, null, 2));
|
|
60
|
-
}
|
|
61
|
-
function requestCancel(id, lane) {
|
|
62
|
-
fs2.writeFileSync(path2.join(laneDirs(lane).active, id, "cancel"), (/* @__PURE__ */ new Date()).toISOString());
|
|
63
|
-
}
|
|
64
53
|
|
|
65
54
|
// packages/core/dist/status.js
|
|
66
|
-
import * as
|
|
55
|
+
import * as fs2 from "node:fs";
|
|
67
56
|
function isVerb(v) {
|
|
68
57
|
return VERBS.includes(v);
|
|
69
58
|
}
|
|
70
59
|
function readStatusLog(id, lane) {
|
|
71
60
|
const file = statusPath(id, lane);
|
|
72
|
-
if (!
|
|
61
|
+
if (!fs2.existsSync(file))
|
|
73
62
|
return [];
|
|
74
|
-
return
|
|
63
|
+
return fs2.readFileSync(file, "utf8").split("\n").filter(Boolean).flatMap((line) => {
|
|
75
64
|
try {
|
|
76
65
|
const parsed = JSON.parse(line);
|
|
77
66
|
return isVerb(parsed.verb) ? [parsed] : [];
|
|
@@ -92,6 +81,38 @@ function reconcile({ log, lastEventAt: lastEventAt2, now = Date.now(), busyThres
|
|
|
92
81
|
return "unknown";
|
|
93
82
|
}
|
|
94
83
|
|
|
84
|
+
// packages/core/dist/queue.js
|
|
85
|
+
function atomicWrite(file, content) {
|
|
86
|
+
const tmp = `${file}.tmp-${process.pid}-${Date.now()}`;
|
|
87
|
+
fs3.writeFileSync(tmp, content);
|
|
88
|
+
fs3.renameSync(tmp, file);
|
|
89
|
+
}
|
|
90
|
+
function enqueue(d, lane = "work") {
|
|
91
|
+
if (!d.id || !d.repo || !d.brief) {
|
|
92
|
+
throw new Error("descriptor requires id, repo, and brief");
|
|
93
|
+
}
|
|
94
|
+
const inherited = d.followUp && d.attachments === void 0 ? storedDescriptor(d.followUp, "work")?.attachments ?? storedDescriptor(d.followUp, "chore")?.attachments : void 0;
|
|
95
|
+
const descriptor = inherited?.length ? { ...d, attachments: inherited } : d;
|
|
96
|
+
atomicWrite(path2.join(laneDirs(lane).queue, `${d.id}.json`), JSON.stringify(descriptor, null, 2));
|
|
97
|
+
}
|
|
98
|
+
function storedDescriptor(id, lane) {
|
|
99
|
+
const dirs = laneDirs(lane);
|
|
100
|
+
for (const file of [
|
|
101
|
+
path2.join(dirs.queue, `${id}.json`),
|
|
102
|
+
path2.join(dirs.active, id, "descriptor.json"),
|
|
103
|
+
path2.join(dirs.done, id, "descriptor.json")
|
|
104
|
+
]) {
|
|
105
|
+
try {
|
|
106
|
+
return JSON.parse(fs3.readFileSync(file, "utf8"));
|
|
107
|
+
} catch {
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return void 0;
|
|
111
|
+
}
|
|
112
|
+
function requestCancel(id, lane) {
|
|
113
|
+
fs3.writeFileSync(path2.join(laneDirs(lane).active, id, "cancel"), (/* @__PURE__ */ new Date()).toISOString());
|
|
114
|
+
}
|
|
115
|
+
|
|
95
116
|
// packages/core/dist/events.js
|
|
96
117
|
import * as fs4 from "node:fs";
|
|
97
118
|
function lastEventAt(id, lane) {
|
|
@@ -105,21 +126,39 @@ function lastEventAt(id, lane) {
|
|
|
105
126
|
// packages/core/dist/inbox.js
|
|
106
127
|
import * as fs5 from "node:fs";
|
|
107
128
|
import * as path3 from "node:path";
|
|
129
|
+
var metaName = (file) => file.replace(/\.msg$/, ".meta.json");
|
|
108
130
|
function inboxDir(id, lane) {
|
|
109
131
|
return path3.join(laneDirs(lane).inbox, id);
|
|
110
132
|
}
|
|
111
|
-
function sendMessage(id, lane, text2) {
|
|
133
|
+
function sendMessage(id, lane, text2, from, attachments = []) {
|
|
112
134
|
const dir = inboxDir(id, lane);
|
|
113
135
|
fs5.mkdirSync(path3.join(dir, "handled"), { recursive: true });
|
|
114
136
|
const existing = fs5.readdirSync(dir).filter((f) => f.endsWith(".msg")).length;
|
|
115
|
-
const handled = fs5.readdirSync(path3.join(dir, "handled")).length;
|
|
137
|
+
const handled = fs5.readdirSync(path3.join(dir, "handled")).filter((f) => f.endsWith(".msg")).length;
|
|
116
138
|
const name = `${String(existing + handled + 1).padStart(3, "0")}.msg`;
|
|
117
139
|
const tmp = path3.join(dir, `.tmp-${process.pid}-${Date.now()}`);
|
|
140
|
+
if (from !== void 0 || attachments.length > 0) {
|
|
141
|
+
const meta = { from: from ?? "unknown", at: (/* @__PURE__ */ new Date()).toISOString(), ...attachments.length ? { attachments } : {} };
|
|
142
|
+
const metaTmp = `${tmp}.meta`;
|
|
143
|
+
fs5.writeFileSync(metaTmp, JSON.stringify(meta, null, 2));
|
|
144
|
+
fs5.renameSync(metaTmp, path3.join(dir, metaName(name)));
|
|
145
|
+
}
|
|
118
146
|
fs5.writeFileSync(tmp, text2);
|
|
119
147
|
fs5.renameSync(tmp, path3.join(dir, name));
|
|
120
148
|
return name;
|
|
121
149
|
}
|
|
122
150
|
|
|
151
|
+
// packages/core/dist/config.js
|
|
152
|
+
var DEFAULT_LIMITS = {
|
|
153
|
+
maxConcurrent: 2,
|
|
154
|
+
choreConcurrent: 1,
|
|
155
|
+
wedgeThresholdSecs: 600,
|
|
156
|
+
maxRestartAttempts: 2,
|
|
157
|
+
wallClockSecs: 3600,
|
|
158
|
+
choreRetentionDays: 7,
|
|
159
|
+
attachmentMaxBytes: 25 * 1024 * 1024
|
|
160
|
+
};
|
|
161
|
+
|
|
123
162
|
// packages/core/dist/toon.js
|
|
124
163
|
function cell(v) {
|
|
125
164
|
if (v === void 0 || v === null)
|
|
@@ -137,6 +176,12 @@ function toonTable(name, rows, cols) {
|
|
|
137
176
|
return [header, ...rows.map((r) => ` ${cols.map((c) => cell(r[c])).join(",")}`)].join("\n");
|
|
138
177
|
}
|
|
139
178
|
|
|
179
|
+
// packages/core/dist/compiled.js
|
|
180
|
+
var COMPILED_BINARY = (() => {
|
|
181
|
+
const bun = globalThis.Bun;
|
|
182
|
+
return bun !== void 0 && String(bun.main ?? "").includes("$bunfs");
|
|
183
|
+
})();
|
|
184
|
+
|
|
140
185
|
// apps/node/src/tools.ts
|
|
141
186
|
function text(payload, details = {}) {
|
|
142
187
|
return { content: [{ type: "text", text: payload }], details };
|
|
@@ -235,7 +280,7 @@ function sendTool() {
|
|
|
235
280
|
const id = param(params, "id");
|
|
236
281
|
const message = param(params, "message");
|
|
237
282
|
if (!id || !message) throw new Error("lobstah_send requires id and message");
|
|
238
|
-
const name = sendMessage(id, findLane(id), message);
|
|
283
|
+
const name = sendMessage(id, findLane(id), message, "node");
|
|
239
284
|
return text(toonKV({ id, queued: name }), { id });
|
|
240
285
|
}
|
|
241
286
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lobstah-openclaw-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "OpenClaw plugin for lobstah: gives fleet agents dispatch/status/send/cancel tools and operators a /lobstah command.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "aequitas labs LLC",
|