lobstah-openclaw-plugin 0.1.0 → 0.5.7

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