@openclaw/lobster 2026.7.1 → 2026.7.2-beta.2
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 +7 -145
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +1 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,136 +1,18 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
1
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
3
2
|
import { optionalNonNegativeIntegerSchema, optionalPositiveIntegerSchema } from "openclaw/plugin-sdk/channel-actions";
|
|
4
3
|
import { readNonNegativeIntegerParam, readPositiveIntegerParam } from "openclaw/plugin-sdk/param-readers";
|
|
5
4
|
import { jsonResult } from "openclaw/plugin-sdk/tool-results";
|
|
6
5
|
import { Type } from "typebox";
|
|
7
|
-
import { readFileSync } from "node:fs";
|
|
8
6
|
import { stat } from "node:fs/promises";
|
|
9
7
|
import path from "node:path";
|
|
10
8
|
import { Readable, Writable } from "node:stream";
|
|
11
|
-
import { pathToFileURL } from "node:url";
|
|
12
|
-
import { createHash } from "node:crypto";
|
|
13
|
-
//#region extensions/lobster/src/lobster-ajv-cache.ts
|
|
14
|
-
const installedSymbol = Symbol.for("openclaw.lobster.ajv-compile-cache.installed");
|
|
15
|
-
const cacheSymbol = Symbol.for("openclaw.lobster.ajv-compile-cache.entries");
|
|
16
|
-
const maxEntries = 512;
|
|
17
|
-
function stableJsonStringify(value, seen = /* @__PURE__ */ new WeakSet()) {
|
|
18
|
-
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
19
|
-
if (seen.has(value)) throw new TypeError("Cannot cache cyclic JSON schema");
|
|
20
|
-
seen.add(value);
|
|
21
|
-
if (Array.isArray(value)) {
|
|
22
|
-
const items = value.map((entry) => stableJsonStringify(entry, seen));
|
|
23
|
-
seen.delete(value);
|
|
24
|
-
return `[${items.join(",")}]`;
|
|
25
|
-
}
|
|
26
|
-
const record = value;
|
|
27
|
-
const properties = Object.keys(record).toSorted().filter((key) => record[key] !== void 0).map((key) => `${JSON.stringify(key)}:${stableJsonStringify(record[key], seen)}`);
|
|
28
|
-
seen.delete(value);
|
|
29
|
-
return `{${properties.join(",")}}`;
|
|
30
|
-
}
|
|
31
|
-
function compileCacheKey(schema) {
|
|
32
|
-
try {
|
|
33
|
-
return createHash("sha256").update(stableJsonStringify(schema)).digest("hex");
|
|
34
|
-
} catch {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function readCompileCache(instance) {
|
|
39
|
-
let cache = instance[cacheSymbol];
|
|
40
|
-
if (!cache) {
|
|
41
|
-
cache = /* @__PURE__ */ new Map();
|
|
42
|
-
Object.defineProperty(instance, cacheSymbol, {
|
|
43
|
-
value: cache,
|
|
44
|
-
configurable: true
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
return cache;
|
|
48
|
-
}
|
|
49
|
-
function rememberCompiledValidator(params) {
|
|
50
|
-
const { cache, instance, key, removeSchema, schema, validate } = params;
|
|
51
|
-
if (!cache.has(key) && cache.size >= maxEntries) {
|
|
52
|
-
const oldest = cache.keys().next().value;
|
|
53
|
-
if (oldest !== void 0) {
|
|
54
|
-
const evicted = cache.get(oldest);
|
|
55
|
-
cache.delete(oldest);
|
|
56
|
-
if (evicted) removeSchema.call(instance, evicted.schema);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
cache.set(key, {
|
|
60
|
-
schema,
|
|
61
|
-
validate
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
async function resolveLobsterAjvConstructor(packageEntryPath) {
|
|
65
|
-
const ajvModule = await import(pathToFileURL(createRequire(packageEntryPath).resolve("ajv")).href);
|
|
66
|
-
return ajvModule.default ?? ajvModule;
|
|
67
|
-
}
|
|
68
|
-
async function installLobsterAjvCompileCache(packageEntryPath) {
|
|
69
|
-
let AjvCtor;
|
|
70
|
-
try {
|
|
71
|
-
AjvCtor = await resolveLobsterAjvConstructor(packageEntryPath);
|
|
72
|
-
} catch {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
const proto = AjvCtor.prototype;
|
|
76
|
-
if (proto[installedSymbol]) return;
|
|
77
|
-
const originalCompile = proto.compile;
|
|
78
|
-
const originalRemoveSchema = proto.removeSchema;
|
|
79
|
-
Object.defineProperty(proto, installedSymbol, {
|
|
80
|
-
value: true,
|
|
81
|
-
configurable: true
|
|
82
|
-
});
|
|
83
|
-
proto.compile = function compileWithContentCache(schema) {
|
|
84
|
-
const key = compileCacheKey(schema);
|
|
85
|
-
if (!key) return originalCompile.call(this, schema);
|
|
86
|
-
const cache = readCompileCache(this);
|
|
87
|
-
const cached = cache.get(key);
|
|
88
|
-
if (cached) return cached.validate;
|
|
89
|
-
const validate = originalCompile.call(this, schema);
|
|
90
|
-
rememberCompiledValidator({
|
|
91
|
-
cache,
|
|
92
|
-
instance: this,
|
|
93
|
-
key,
|
|
94
|
-
removeSchema: originalRemoveSchema,
|
|
95
|
-
schema,
|
|
96
|
-
validate
|
|
97
|
-
});
|
|
98
|
-
return validate;
|
|
99
|
-
};
|
|
100
|
-
proto.removeSchema = function removeSchemaAndClearContentCache(schemaKeyRef) {
|
|
101
|
-
this[cacheSymbol]?.clear();
|
|
102
|
-
return originalRemoveSchema.call(this, schemaKeyRef);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
9
|
//#region extensions/lobster/src/lobster-runner.ts
|
|
107
|
-
const lobsterRequire = createRequire(import.meta.url);
|
|
108
10
|
const workflowExts = /* @__PURE__ */ new Set([
|
|
109
11
|
".lobster",
|
|
110
12
|
".yaml",
|
|
111
13
|
".yml",
|
|
112
14
|
".json"
|
|
113
15
|
]);
|
|
114
|
-
function toEmbeddedToolRuntime(moduleExports, source) {
|
|
115
|
-
const { runToolRequest, resumeToolRequest } = moduleExports;
|
|
116
|
-
if (typeof runToolRequest === "function" && typeof resumeToolRequest === "function") return {
|
|
117
|
-
runToolRequest,
|
|
118
|
-
resumeToolRequest
|
|
119
|
-
};
|
|
120
|
-
throw new Error(`${source} does not export Lobster embedded runtime functions`);
|
|
121
|
-
}
|
|
122
|
-
function findLobsterPackageRoot(resolvedEntryPath) {
|
|
123
|
-
let dir = path.dirname(resolvedEntryPath);
|
|
124
|
-
while (true) {
|
|
125
|
-
const packageJsonPath = path.join(dir, "package.json");
|
|
126
|
-
try {
|
|
127
|
-
if (JSON.parse(readFileSync(packageJsonPath, "utf8")).name === "@clawdbot/lobster") return dir;
|
|
128
|
-
} catch {}
|
|
129
|
-
const parent = path.dirname(dir);
|
|
130
|
-
if (parent === dir) throw new Error(`Could not locate @clawdbot/lobster package root from ${resolvedEntryPath}`);
|
|
131
|
-
dir = parent;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
16
|
function normalizeForCwdSandbox(p) {
|
|
135
17
|
const normalized = path.normalize(p);
|
|
136
18
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
@@ -249,29 +131,12 @@ async function withTimeout(timeoutMs, fn) {
|
|
|
249
131
|
});
|
|
250
132
|
});
|
|
251
133
|
}
|
|
252
|
-
async function loadEmbeddedToolRuntimeFromPackage(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return toEmbeddedToolRuntime(await importModule([
|
|
259
|
-
"@clawdbot",
|
|
260
|
-
"lobster",
|
|
261
|
-
"core"
|
|
262
|
-
].join("/")), "@clawdbot/lobster/core");
|
|
263
|
-
} catch (error) {
|
|
264
|
-
coreLoadError = error;
|
|
265
|
-
}
|
|
266
|
-
let fallbackLoadError;
|
|
267
|
-
try {
|
|
268
|
-
const packageRoot = findLobsterPackageRoot(packageEntryPath);
|
|
269
|
-
const coreRuntimeUrl = pathToFileURL(path.join(packageRoot, "dist/src/core/index.js")).href;
|
|
270
|
-
return toEmbeddedToolRuntime(await importModule(coreRuntimeUrl), coreRuntimeUrl);
|
|
271
|
-
} catch (error) {
|
|
272
|
-
fallbackLoadError = error;
|
|
273
|
-
}
|
|
274
|
-
throw new Error("Failed to load the Lobster embedded runtime", { cause: new AggregateError([coreLoadError, fallbackLoadError], "Both Lobster embedded runtime load paths failed") });
|
|
134
|
+
async function loadEmbeddedToolRuntimeFromPackage() {
|
|
135
|
+
return await import([
|
|
136
|
+
"@clawdbot",
|
|
137
|
+
"lobster",
|
|
138
|
+
"core"
|
|
139
|
+
].join("/"));
|
|
275
140
|
}
|
|
276
141
|
function createEmbeddedLobsterRunner(options) {
|
|
277
142
|
const loadRuntime = options?.loadRuntime ?? loadEmbeddedToolRuntimeFromPackage;
|
|
@@ -591,10 +456,7 @@ function createLobsterTool(api, options) {
|
|
|
591
456
|
label: "Lobster Workflow",
|
|
592
457
|
description: "Run Lobster pipelines as a local-first workflow runtime (typed JSON envelope + resumable approvals).",
|
|
593
458
|
parameters: Type.Object({
|
|
594
|
-
action: Type.
|
|
595
|
-
type: "string",
|
|
596
|
-
enum: ["run", "resume"]
|
|
597
|
-
}),
|
|
459
|
+
action: Type.Enum(["run", "resume"], { type: "string" }),
|
|
598
460
|
pipeline: Type.Optional(Type.String()),
|
|
599
461
|
argsJson: Type.Optional(Type.String()),
|
|
600
462
|
token: Type.Optional(Type.String()),
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/lobster",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/lobster",
|
|
9
|
-
"version": "2026.7.
|
|
9
|
+
"version": "2026.7.2-beta.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@clawdbot/lobster": "2026.6.11",
|
|
12
12
|
"typebox": "1.3.3"
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/lobster",
|
|
3
|
-
"version": "2026.7.
|
|
3
|
+
"version": "2026.7.2-beta.2",
|
|
4
4
|
"description": "Lobster workflow tool plugin for typed pipelines and resumable approvals.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"minHostVersion": ">=2026.4.25"
|
|
22
22
|
},
|
|
23
23
|
"compat": {
|
|
24
|
-
"pluginApi": ">=2026.7.
|
|
24
|
+
"pluginApi": ">=2026.7.2-beta.2"
|
|
25
25
|
},
|
|
26
26
|
"build": {
|
|
27
|
-
"openclawVersion": "2026.7.
|
|
27
|
+
"openclawVersion": "2026.7.2-beta.2"
|
|
28
28
|
},
|
|
29
29
|
"release": {
|
|
30
30
|
"publishToClawHub": true,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"SKILL.md"
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"openclaw": ">=2026.7.
|
|
45
|
+
"openclaw": ">=2026.7.2-beta.2"
|
|
46
46
|
},
|
|
47
47
|
"peerDependenciesMeta": {
|
|
48
48
|
"openclaw": {
|