@openclaw/muse 0.0.0-stage → 2026.10.10-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/README.md CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # Muse Code agent runtime (OpenClaw plugin)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ External OpenClaw plugin that registers a `muse` agent harness backed by
4
+ `@muse-code/sdk` and Meta's Muse Code CLI (`muse serve`).
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ openclaw plugins install @openclaw/muse
10
+ ```
11
+
12
+ Install Muse Code separately and sign in once on the Gateway host with `muse`
13
+ or `muse login`.
14
+
15
+ The harness is opt-in only: set `agentRuntime.id: "muse"` on a `meta/*` model
16
+ or on the `meta` provider; `auto` never picks it.
17
+
18
+ See [Muse Code agent runtime](https://docs.openclaw.ai/plugins/muse) for auth,
19
+ approvals, sessions, limitations, and live tests.
20
+
21
+ ## Package
22
+
23
+ - Plugin id: `muse`
24
+ - Package: `@openclaw/muse`
25
+ - Minimum OpenClaw host: `2026.10.2`
@@ -0,0 +1,32 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <!--
3
+ Adapted from OpenClaw ui/public/provider-icons/ProviderIcon-meta.svg.
4
+ Source: @lobehub/icons-static-svg@1.94.0, meta.svg
5
+ https://www.npmjs.com/package/@lobehub/icons-static-svg/v/1.94.0
6
+ https://github.com/lobehub/lobe-icons
7
+
8
+ MIT License
9
+ Copyright (c) 2023 LobeHub
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Names and marks remain the property of their respective owners.
30
+ -->
31
+ <path fill="currentColor" fill-rule="evenodd" stroke="none" d="M6.897 4c1.915 0 3.516.932 5.43 3.376l.282-.373c.19-.246.383-.484.58-.71l.313-.35C14.588 4.788 15.792 4 17.225 4c1.273 0 2.469.557 3.491 1.516l.218.213c1.73 1.765 2.917 4.71 3.053 8.026l.011.392.002.25c0 1.501-.28 2.759-.818 3.7l-.14.23-.108.153c-.301.42-.664.758-1.086 1.009l-.265.142-.087.04a3.493 3.493 0 01-.302.118 4.117 4.117 0 01-1.33.208c-.524 0-.996-.067-1.438-.215-.614-.204-1.163-.56-1.726-1.116l-.227-.235c-.753-.812-1.534-1.976-2.493-3.586l-1.43-2.41-.544-.895-1.766 3.13-.343.592C7.597 19.156 6.227 20 4.356 20c-1.21 0-2.205-.42-2.936-1.182l-.168-.184c-.484-.573-.837-1.311-1.043-2.189l-.067-.32a8.69 8.69 0 01-.136-1.288L0 14.468c.002-.745.06-1.49.174-2.23l.1-.573c.298-1.53.828-2.958 1.536-4.157l.209-.34c1.177-1.83 2.789-3.053 4.615-3.16L6.897 4zm-.033 2.615l-.201.01c-.83.083-1.606.673-2.252 1.577l-.138.199-.01.018c-.67 1.017-1.185 2.378-1.456 3.845l-.004.022a12.591 12.591 0 00-.207 2.254l.002.188c.004.18.017.36.04.54l.043.291c.092.503.257.908.486 1.208l.117.137c.303.323.698.492 1.17.492 1.1 0 1.796-.676 3.696-3.641l2.175-3.4.454-.701-.139-.198C9.11 7.3 8.084 6.616 6.864 6.616zm10.196-.552l-.176.007c-.635.048-1.223.359-1.82.933l-.196.198c-.439.462-.887 1.064-1.367 1.807l.266.398c.18.274.362.56.55.858l.293.475 1.396 2.335.695 1.114c.583.926 1.03 1.6 1.408 2.082l.213.262c.282.326.529.54.777.673l.102.05c.227.1.457.138.718.138.176.002.35-.023.518-.073.338-.104.61-.32.813-.637l.095-.163.077-.162c.194-.459.29-1.06.29-1.785l-.006-.449c-.08-2.871-.938-5.372-2.2-6.798l-.176-.189c-.67-.683-1.444-1.074-2.27-1.074z" />
32
+ </svg>
Binary file
@@ -0,0 +1,928 @@
1
+ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import fs, { realpath } from "node:fs/promises";
3
+ import { AgentHarnessPreflightError, agentHarnessAttemptTerminal, clearActiveEmbeddedRun, execPolicy, projectAgentToolActivity, resolveBootstrapContextForRun, setActiveEmbeddedRun } from "openclaw/plugin-sdk/agent-harness-runtime";
4
+ import { createNativeSessionCommitFinalizer } from "openclaw/plugin-sdk/agent-harness-session-runtime";
5
+ import { resolveAgentConfig, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
6
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
7
+ import { loadExecApprovalsReadOnlyAsync, resolveExecApprovalsFromFile } from "openclaw/plugin-sdk/exec-approvals-runtime";
8
+ import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
9
+ import { MAX_TIMER_TIMEOUT_MS } from "openclaw/plugin-sdk/number-runtime";
10
+ import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
11
+ import { appendSessionTranscriptMessagesByIdentity, publishSessionTranscriptUpdateByIdentity } from "openclaw/plugin-sdk/session-transcript-runtime";
12
+ import { resolveAgentHarnessHistoryLimits } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
13
+ import { SessionManager } from "openclaw/plugin-sdk/agent-sessions";
14
+ import { createHash } from "node:crypto";
15
+ import { MspError, Session, readSessionDurability, spawnMspConnection } from "@muse-code/sdk";
16
+ import path from "node:path";
17
+ import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
18
+ //#region extensions/muse/src/approvals.ts
19
+ function selectApprovalChoice(request, decision) {
20
+ const wanted = decision === "allow-once" ? "approved" : "denied";
21
+ const choice = request.availableChoices.find((candidate) => candidate.decision === wanted && candidate.scope === "once") ?? (wanted === "denied" ? request.availableChoices.find((candidate) => candidate.decision === "denied" || candidate.decision === "abort") : void 0);
22
+ if (!choice) throw new Error(`Muse offered no safe ${wanted} approval choice`);
23
+ return { choiceId: choice.choiceId };
24
+ }
25
+ const APPROVAL_TIMEOUT_MS = 12e4;
26
+ function createApprovalHandler(params) {
27
+ return async (request) => {
28
+ params.hostCapabilities.assertActive();
29
+ const timeoutMs = Math.min(APPROVAL_TIMEOUT_MS, params.timeoutMs);
30
+ const answer = await params.hostCapabilities.requestApproval({
31
+ title: `Muse: ${request.toolName}`.slice(0, 80),
32
+ description: (request.subject.command ?? request.subject.path ?? request.subject.host ?? request.toolName).slice(0, 512),
33
+ ...request.rawArgs ? { detail: request.rawArgs.slice(0, 16384) } : {},
34
+ toolName: request.toolName,
35
+ toolCallId: request.toolCallId,
36
+ severity: "warning",
37
+ allowedDecisions: ["allow-once", "deny"],
38
+ timeoutMs,
39
+ signal: params.abortSignal
40
+ });
41
+ let decision = answer?.decision;
42
+ if (answer?.id && decision == null) decision = (await params.hostCapabilities.waitForApproval({
43
+ approvalId: answer.id,
44
+ timeoutMs,
45
+ signal: params.abortSignal
46
+ }))?.decision;
47
+ params.hostCapabilities.assertActive();
48
+ params.abortSignal?.throwIfAborted();
49
+ return selectApprovalChoice(request, decision);
50
+ };
51
+ }
52
+ //#endregion
53
+ //#region extensions/muse/src/context.ts
54
+ /** MSP has no history import or system field; transfer the retained branch once as context. */
55
+ async function prepareMuseSessionContext(params, target, warn) {
56
+ const limits = resolveAgentHarnessHistoryLimits(params.model.contextWindow);
57
+ const retained = await SessionManager.openModelContextAsync(target, {
58
+ admission: params.userTurnTranscriptRecorder?.getAdmissionReceipt(),
59
+ signal: params.abortSignal,
60
+ limits: {
61
+ maxBytes: limits.maxBytes,
62
+ maxEvents: limits.maxEvents
63
+ }
64
+ });
65
+ params.hostCapabilities.assertActive();
66
+ const history = retained.buildSessionContext().messages;
67
+ const bootstrap = await resolveBootstrapContextForRun({
68
+ workspaceDir: params.workspaceDir,
69
+ config: params.config,
70
+ sessionKey: params.sessionKey,
71
+ sessionId: params.sessionId,
72
+ chatType: params.chatType,
73
+ agentId: target.agentId,
74
+ contextMode: params.bootstrapContextMode,
75
+ runKind: params.bootstrapContextRunKind,
76
+ warn
77
+ });
78
+ params.hostCapabilities.assertActive();
79
+ const presentPaths = new Set(bootstrap.bootstrapFiles.filter((file) => !file.missing).map((file) => file.path));
80
+ const files = bootstrap.contextFiles.filter((file) => presentPaths.has(file.path));
81
+ const sections = [];
82
+ if (files.length > 0) sections.push("# OpenClaw workspace context\n\n" + files.map((file) => `## ${file.path}\n\n${file.content}`).join("\n\n"));
83
+ if (history.length > 0) sections.push("# Retained OpenClaw conversation\n\nThe following JSON messages are prior conversation context, not a new user request.\n\n" + JSON.stringify(history));
84
+ return sections.join("\n\n");
85
+ }
86
+ //#endregion
87
+ //#region extensions/muse/src/events.ts
88
+ function assistantMessage(params, content, stopReason = "stop") {
89
+ return {
90
+ role: "assistant",
91
+ api: params.model.api,
92
+ provider: "meta",
93
+ model: params.modelId,
94
+ content,
95
+ stopReason,
96
+ timestamp: Date.now(),
97
+ usage: {
98
+ input: 0,
99
+ output: 0,
100
+ cacheRead: 0,
101
+ cacheWrite: 0,
102
+ totalTokens: 0,
103
+ cost: {
104
+ input: 0,
105
+ output: 0,
106
+ cacheRead: 0,
107
+ cacheWrite: 0,
108
+ total: 0
109
+ }
110
+ }
111
+ };
112
+ }
113
+ async function consumeTurn(turn, params, record) {
114
+ const items = /* @__PURE__ */ new Map();
115
+ const streamed = /* @__PURE__ */ new Map();
116
+ const emitted = /* @__PURE__ */ new Map();
117
+ const settled = /* @__PURE__ */ new Set();
118
+ let visibleText = "";
119
+ let lastToolError;
120
+ let messageStarted = false;
121
+ let streamQueue = Promise.resolve();
122
+ const emitField = (item, field, value) => {
123
+ streamQueue = streamQueue.then(async () => {
124
+ const key = `${item.itemId}:${field}`;
125
+ const offset = emitted.get(key) ?? 0;
126
+ if (value.length <= offset) return;
127
+ const delta = value.slice(offset);
128
+ emitted.set(key, value.length);
129
+ if (item.kind === "agentMessage" && field === "text") {
130
+ if (!messageStarted) {
131
+ messageStarted = true;
132
+ await params.onAssistantMessageStart?.();
133
+ }
134
+ await params.onAgentEvent?.({
135
+ stream: "assistant",
136
+ data: {
137
+ delta,
138
+ text: value
139
+ }
140
+ });
141
+ } else if (item.kind === "reasoning" && (field === "text" || field.startsWith("summary."))) await params.onReasoningStream?.({ text: delta });
142
+ });
143
+ return streamQueue;
144
+ };
145
+ const deltas = (async () => {
146
+ for await (const delta of turn.deltas()) {
147
+ const field = delta.field ?? "text";
148
+ const key = `${delta.itemId}:${field}`;
149
+ const value = (streamed.get(key) ?? "") + delta.delta;
150
+ streamed.set(key, value);
151
+ const item = items.get(delta.itemId);
152
+ if (item) await emitField(item, field, value);
153
+ }
154
+ })();
155
+ const projections = (async () => {
156
+ for await (const item of turn.items()) {
157
+ const first = !items.has(item.itemId);
158
+ items.set(item.itemId, item);
159
+ if (first) {
160
+ for (const [key, value] of streamed) if (key.startsWith(`${item.itemId}:`)) await emitField(item, key.slice(item.itemId.length + 1), value);
161
+ }
162
+ if (item.kind === "toolCall" && first) await params.onAgentEvent?.({
163
+ stream: "item",
164
+ data: projectAgentToolActivity({
165
+ toolCallId: item.callId ?? item.itemId,
166
+ name: item.tool ?? "muse_tool",
167
+ phase: "start"
168
+ })
169
+ });
170
+ if (item.status === "inProgress" || settled.has(item.itemId)) continue;
171
+ settled.add(item.itemId);
172
+ const messages = [];
173
+ if (item.kind === "toolCall") {
174
+ const toolName = item.tool ?? "muse_tool";
175
+ let args = {};
176
+ if (item.args) try {
177
+ const decoded = JSON.parse(item.args);
178
+ args = isRecord(decoded) ? decoded : { rawArgs: item.args };
179
+ } catch {
180
+ args = { rawArgs: item.args };
181
+ }
182
+ const id = item.callId ?? item.itemId;
183
+ messages.push(assistantMessage(params, [{
184
+ type: "toolCall",
185
+ id,
186
+ name: toolName,
187
+ arguments: args
188
+ }], "toolUse"));
189
+ messages.push({
190
+ role: "toolResult",
191
+ toolCallId: id,
192
+ toolName,
193
+ content: [{
194
+ type: "text",
195
+ text: item.visibleOutput ?? item.failureReason ?? ""
196
+ }],
197
+ isError: item.status !== "completed",
198
+ timestamp: Date.now()
199
+ });
200
+ lastToolError = (params.observeToolTerminal?.({
201
+ toolCallId: id,
202
+ toolName,
203
+ arguments: args,
204
+ result: item.visibleOutput,
205
+ outcome: item.status === "completed" ? "success" : "failure",
206
+ executionStarted: true,
207
+ nativeMutation: {
208
+ mutatingAction: true,
209
+ replaySafe: false
210
+ }
211
+ }))?.lastToolError;
212
+ params.onAgentToolResult?.({
213
+ toolName,
214
+ result: item.visibleOutput,
215
+ isError: item.status !== "completed"
216
+ });
217
+ await params.onAgentEvent?.({
218
+ stream: "item",
219
+ data: projectAgentToolActivity({
220
+ toolCallId: id,
221
+ name: toolName,
222
+ phase: "result"
223
+ })
224
+ });
225
+ } else if (item.kind === "agentMessage") {
226
+ await emitField(item, "text", item.text ?? "");
227
+ visibleText += item.text ?? "";
228
+ messages.push(assistantMessage(params, [{
229
+ type: "text",
230
+ text: item.text ?? ""
231
+ }]));
232
+ } else if (item.kind === "reasoning") {
233
+ if (item.summary) for (const [index, value] of item.summary.entries()) await emitField(item, `summary.${index}`, value);
234
+ messages.push(assistantMessage(params, [{
235
+ type: "thinking",
236
+ thinking: item.text ?? item.summary?.join("\n") ?? ""
237
+ }]));
238
+ await params.onReasoningEnd?.();
239
+ } else if (item.kind !== "userMessage") await params.onAgentEvent?.({
240
+ stream: "item",
241
+ data: {
242
+ type: String(item.kind),
243
+ status: String(item.status),
244
+ text: item.fallbackText ?? String(item.kind),
245
+ id: item.itemId
246
+ }
247
+ });
248
+ if (messages.length) await record(item.itemId, messages);
249
+ }
250
+ })();
251
+ await Promise.all([projections, deltas]);
252
+ return {
253
+ visibleText,
254
+ lastToolError,
255
+ outcome: await turn.completed
256
+ };
257
+ }
258
+ //#endregion
259
+ //#region extensions/muse/package.json
260
+ var version = "2026.10.10-beta.2";
261
+ //#endregion
262
+ //#region extensions/muse/src/environment.ts
263
+ async function museEnvironment(apiKey, env = process.env) {
264
+ const inherited = {
265
+ ...process.env,
266
+ ...env
267
+ };
268
+ const managedHome = path.join(resolveStateDir(inherited), "muse");
269
+ const authPath = path.join(managedHome, "muse", "auth.json");
270
+ let credentialSource;
271
+ try {
272
+ const stat = await fs.stat(authPath);
273
+ credentialSource = JSON.stringify([
274
+ "managed",
275
+ authPath,
276
+ stat.dev,
277
+ stat.ino,
278
+ stat.size,
279
+ stat.mtimeMs,
280
+ stat.ctimeMs
281
+ ]);
282
+ } catch (error) {
283
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") credentialSource = "native";
284
+ else throw error;
285
+ }
286
+ return {
287
+ credentialSource,
288
+ env: {
289
+ ...inherited,
290
+ MUSE_NO_AUTO_UPDATE: "1",
291
+ ...credentialSource !== "native" ? {
292
+ TBH_CREDENTIAL_BACKEND: "file",
293
+ XDG_CONFIG_HOME: managedHome
294
+ } : {},
295
+ ...apiKey ? { META_API_KEY: apiKey } : {}
296
+ }
297
+ };
298
+ }
299
+ //#endregion
300
+ //#region extensions/muse/src/runtime.ts
301
+ const RESUME_RETRY_KINDS = {
302
+ sessionInUse: true,
303
+ overloaded: true,
304
+ backpressured: true,
305
+ interrupted: true
306
+ };
307
+ function credentialFingerprint(apiKey) {
308
+ return apiKey ? createHash("sha256").update(apiKey).digest("hex") : "cli-login";
309
+ }
310
+ async function openMuseSession(runtime, options) {
311
+ if (options.sessionId) {
312
+ const existing = runtime.sessions.get(options.sessionId);
313
+ if (existing) return existing;
314
+ }
315
+ const { connection } = runtime.host;
316
+ const start = () => connection.command("session/start", {
317
+ workspaceRoot: options.workspace,
318
+ modelId: options.modelId,
319
+ providerId: "meta",
320
+ approvalMode: options.approvalMode
321
+ });
322
+ let result;
323
+ if (!options.sessionId) result = await start();
324
+ else try {
325
+ result = await connection.command("session/resume", {
326
+ sessionId: options.sessionId,
327
+ excludeItems: true
328
+ });
329
+ } catch (error) {
330
+ if (!(error instanceof MspError) || RESUME_RETRY_KINDS[error.kind]) throw error instanceof MspError ? new Error(`Muse refused to resume session (${error.kind}): ${error.message}`, { cause: error }) : error;
331
+ options.onResumeRefused?.(`Muse could not resume session (${error.kind}): ${error.message}`);
332
+ result = await start();
333
+ }
334
+ if (!isRecord(result.session) || typeof result.session.sessionId !== "string") throw new Error("Muse returned an invalid session identity.");
335
+ const session = new Session({
336
+ sessionId: result.session.sessionId,
337
+ connection,
338
+ durability: readSessionDurability(runtime.host.initializeResult)
339
+ });
340
+ runtime.sessions.set(session.sessionId, session);
341
+ return session;
342
+ }
343
+ var MusePool = class {
344
+ constructor(binaryPath = "muse") {
345
+ this.binaryPath = binaryPath;
346
+ this.entries = /* @__PURE__ */ new Map();
347
+ this.disposed = false;
348
+ }
349
+ async acquire(workspace, apiKey, readOnly) {
350
+ if (this.disposed) throw new Error("Muse runtime has been disposed");
351
+ const { env, credentialSource } = await museEnvironment(apiKey);
352
+ if (this.disposed) throw new Error("Muse runtime was disposed during environment preparation");
353
+ const apiKeyIdentity = credentialFingerprint(apiKey);
354
+ const key = JSON.stringify([
355
+ workspace,
356
+ apiKeyIdentity,
357
+ readOnly
358
+ ]);
359
+ const credentialIdentity = JSON.stringify([apiKey ? apiKeyIdentity : credentialFingerprint(env.META_API_KEY), credentialSource]);
360
+ let entry = this.entries.get(key);
361
+ if (!entry || entry.credentialIdentity !== credentialIdentity) {
362
+ const previous = entry;
363
+ const pending = (async () => {
364
+ if (previous) await (await previous.pending.catch(() => void 0))?.close();
365
+ return this.spawn(workspace, env, readOnly, credentialIdentity);
366
+ })();
367
+ entry = {
368
+ credentialIdentity,
369
+ pending
370
+ };
371
+ this.entries.set(key, entry);
372
+ pending.catch(() => {
373
+ if (this.entries.get(key) === entry) this.entries.delete(key);
374
+ });
375
+ }
376
+ const runtime = await entry.pending;
377
+ if (this.disposed) {
378
+ await runtime.close();
379
+ throw new Error("Muse runtime was disposed during startup");
380
+ }
381
+ if (this.entries.get(key) !== entry || runtime.dead || runtime.closing) {
382
+ if (this.entries.get(key) === entry) this.entries.delete(key);
383
+ return this.acquire(workspace, apiKey, readOnly);
384
+ }
385
+ clearTimeout(runtime.timer);
386
+ runtime.users++;
387
+ return {
388
+ runtime,
389
+ release: () => {
390
+ runtime.users--;
391
+ if (runtime.users === 0 && !runtime.closing) {
392
+ runtime.timer = setTimeout(() => {
393
+ if (this.entries.get(key) === entry) this.entries.delete(key);
394
+ runtime.close();
395
+ }, 3e5);
396
+ runtime.timer.unref();
397
+ }
398
+ }
399
+ };
400
+ }
401
+ async spawn(workspace, env, readOnly, credentialIdentity) {
402
+ if (this.disposed) throw new Error("Muse runtime was disposed during environment preparation");
403
+ const handshake = spawnMspConnection({
404
+ command: this.binaryPath,
405
+ args: ["serve", ...readOnly ? ["--disable-shell", "--disable-write"] : []],
406
+ cwd: workspace,
407
+ env,
408
+ shutdownTimeoutMs: 1e3
409
+ });
410
+ const startup = setTimeout(() => {
411
+ handshake.close();
412
+ }, 3e4);
413
+ startup.unref();
414
+ try {
415
+ const host = await handshake.initialize({ clientInfo: {
416
+ name: "openclaw",
417
+ version
418
+ } });
419
+ const runtime = {
420
+ host,
421
+ credentialIdentity,
422
+ sessions: /* @__PURE__ */ new Map(),
423
+ users: 0,
424
+ dead: false,
425
+ closing: false,
426
+ close: async () => {
427
+ runtime.closing = true;
428
+ clearTimeout(runtime.timer);
429
+ await host.close();
430
+ }
431
+ };
432
+ host.connection.onNotification((event) => {
433
+ const sessionId = event.params?.sessionId;
434
+ if (typeof sessionId === "string") runtime.sessions.get(sessionId)?.apply(event);
435
+ });
436
+ host.connection.onProtocolError(() => {
437
+ runtime.close();
438
+ });
439
+ host.child.exit.then((exit) => {
440
+ runtime.dead = true;
441
+ for (const session of runtime.sessions.values()) session.hostExited(exit);
442
+ });
443
+ host.connection.closed.then(() => {
444
+ runtime.dead = true;
445
+ for (const session of runtime.sessions.values()) session.hostExited({ kind: "transportEof" });
446
+ });
447
+ return runtime;
448
+ } catch (error) {
449
+ await handshake.close();
450
+ throw new Error(`Cannot start Muse Code (${this.binaryPath}). Install Muse and run muse to sign in. ${String(error)} ${handshake.child.stderrTail.join("\n")}`, { cause: error });
451
+ } finally {
452
+ clearTimeout(startup);
453
+ }
454
+ }
455
+ async dispose() {
456
+ this.disposed = true;
457
+ const entries = [...this.entries.values()];
458
+ this.entries.clear();
459
+ await Promise.all(entries.map(async (entry) => {
460
+ const runtime = await entry.pending.catch(() => void 0);
461
+ if (runtime) await runtime.close();
462
+ }));
463
+ }
464
+ };
465
+ //#endregion
466
+ //#region extensions/muse/src/verify-setup.ts
467
+ async function readMuseCatalog(ctx) {
468
+ const config = ctx.config.plugins?.entries?.muse?.config;
469
+ const { env } = await museEnvironment();
470
+ ctx.signal.throwIfAborted();
471
+ ctx.assertCurrent();
472
+ const host = spawnMspConnection({
473
+ command: isRecord(config) && typeof config.binaryPath === "string" ? config.binaryPath : "muse",
474
+ args: [
475
+ "serve",
476
+ "--no-session-log",
477
+ "--disable-shell",
478
+ "--disable-write"
479
+ ],
480
+ env,
481
+ shutdownTimeoutMs: 1e3
482
+ });
483
+ const abort = () => {
484
+ host.close();
485
+ };
486
+ ctx.signal.addEventListener("abort", abort, { once: true });
487
+ try {
488
+ const ready = await host.initialize({ clientInfo: {
489
+ name: "openclaw",
490
+ version: "1"
491
+ } });
492
+ ctx.signal.throwIfAborted();
493
+ ctx.assertCurrent();
494
+ const catalog = await ready.connection.request("model/list", {});
495
+ ctx.signal.throwIfAborted();
496
+ ctx.assertCurrent();
497
+ if (catalog.source !== "providerCatalog" || catalog.providerId !== "meta" || !Array.isArray(catalog.models)) throw new Error("Muse Code could not authenticate. Sign in again to access Meta models.");
498
+ return catalog.models.flatMap((model) => isRecord(model) && model.providerId === "meta" && typeof model.modelId === "string" ? [{
499
+ id: model.modelId,
500
+ name: typeof model.displayLabel === "string" ? model.displayLabel : model.modelId,
501
+ provider: "meta",
502
+ nativeRuntime: "muse"
503
+ }] : []);
504
+ } finally {
505
+ ctx.signal.removeEventListener("abort", abort);
506
+ await host.close();
507
+ }
508
+ }
509
+ async function verifyMuseSetup(ctx) {
510
+ if (!(await readMuseCatalog(ctx)).some((model) => model.provider === ctx.provider && model.id === ctx.modelId)) throw new Error(`Muse Code cannot access ${ctx.provider}/${ctx.modelId}. Select a model available to your Meta account.`);
511
+ }
512
+ //#endregion
513
+ //#region extensions/muse/harness.ts
514
+ /** Configuration Muse cannot honor; the message is safe and actionable for the chat user. */
515
+ function museRefusal(message) {
516
+ return new AgentHarnessPreflightError(message, {
517
+ scope: "harness",
518
+ userMessage: message
519
+ });
520
+ }
521
+ function createMuseAgentHarness(options) {
522
+ const pool = new MusePool(options.binaryPath);
523
+ const queue = new KeyedAsyncQueue();
524
+ const active = /* @__PURE__ */ new Map();
525
+ const inFlight = /* @__PURE__ */ new Set();
526
+ const catalogs = /* @__PURE__ */ new Map();
527
+ const catalogAbort = new AbortController();
528
+ let disposed = false;
529
+ async function runAttempt(params) {
530
+ const operation = queue.enqueue(params.sessionId, async () => {
531
+ if (disposed) throw new Error("Muse harness has been disposed.");
532
+ params.hostCapabilities.assertActive();
533
+ params.abortSignal?.throwIfAborted();
534
+ if (params.sandbox || params.requireWorkspaceOnly) throw museRefusal("Muse cannot enforce this OpenClaw sandbox or workspace-only policy. Select the openclaw runtime for this session.");
535
+ if (params.thinkLevel === "adaptive") throw museRefusal("Muse does not support adaptive reasoning; choose a fixed thinking level.");
536
+ const target = params.sessionTarget;
537
+ if (!target?.sessionId || !target.sessionKey || !target.storePath) throw new Error("Muse requires an exact OpenClaw transcript target.");
538
+ const transcriptTarget = {
539
+ ...target,
540
+ sessionId: target.sessionId,
541
+ sessionKey: target.sessionKey,
542
+ storePath: target.storePath
543
+ };
544
+ let apiKey = params.resolvedApiKey;
545
+ if (!apiKey && params.authProfileId) {
546
+ const auth = await resolveApiKeyForProvider({
547
+ provider: "meta",
548
+ profileId: params.authProfileId,
549
+ lockedProfile: true,
550
+ store: params.authProfileStore,
551
+ cfg: params.config,
552
+ agentDir: params.agentDir,
553
+ signal: params.abortSignal
554
+ });
555
+ if (!auth.apiKey) throw museRefusal("The selected meta auth profile has no API key usable by Muse.");
556
+ apiKey = auth.apiKey;
557
+ }
558
+ params.hostCapabilities.assertActive();
559
+ const workspace = await realpath(params.workspaceDir);
560
+ params.hostCapabilities.assertActive();
561
+ const { sessionAgentId } = resolveSessionAgentIdsStrict({
562
+ sessionKey: params.sessionKey,
563
+ config: params.config,
564
+ agentId: params.agentId
565
+ });
566
+ const agentExec = resolveAgentConfig(params.config ?? {}, params.sandboxAgentId ?? sessionAgentId)?.tools?.exec;
567
+ const fullSession = params.permissionMode === "full";
568
+ let policy = execPolicy.resolveExecModePolicy({
569
+ security: "full",
570
+ ask: fullSession ? "off" : "on-miss"
571
+ });
572
+ const policyLayers = fullSession ? [params.execOverrides] : [
573
+ params.config?.tools?.exec,
574
+ agentExec,
575
+ params.execOverrides
576
+ ];
577
+ for (const layer of policyLayers) policy = execPolicy.resolveExecModePolicy({
578
+ mode: layer?.mode,
579
+ security: layer?.security ?? policy.security,
580
+ ask: layer?.ask ?? policy.ask
581
+ });
582
+ if (!fullSession || policy.security !== "full") {
583
+ const approvals = await loadExecApprovalsReadOnlyAsync();
584
+ params.hostCapabilities.assertActive();
585
+ const floors = resolveExecApprovalsFromFile({
586
+ file: approvals,
587
+ agentId: params.sandboxAgentId ?? sessionAgentId,
588
+ overrides: {
589
+ security: policy.security,
590
+ ask: policy.ask
591
+ }
592
+ }).agent;
593
+ policy = execPolicy.resolveExecModePolicy({
594
+ security: execPolicy.minSecurity(policy.security, floors.security),
595
+ ask: execPolicy.maxAsk(policy.ask, floors.ask)
596
+ });
597
+ }
598
+ const { security, ask } = policy;
599
+ if (security === "allowlist") throw museRefusal("Muse cannot enforce OpenClaw's exec allowlist. Use the openclaw runtime.");
600
+ if (ask === "always") throw museRefusal("Muse cannot enforce exec ask: always for every native command. Use ask: on-miss/default, or the openclaw runtime.");
601
+ const readOnly = security === "deny";
602
+ const approvalMode = readOnly ? "denyUnmatched" : security === "full" && ask === "off" ? "allowAll" : "promptUnmatched";
603
+ params.hostCapabilities.assertActive();
604
+ const lease = await pool.acquire(workspace, apiKey, readOnly);
605
+ const { runtime } = lease;
606
+ const compatibility = JSON.stringify([
607
+ workspace,
608
+ params.modelId,
609
+ runtime.credentialIdentity,
610
+ readOnly,
611
+ approvalMode
612
+ ]);
613
+ let session;
614
+ let turn;
615
+ let forceCloseTimer;
616
+ let timedOut = false;
617
+ let aborted = false;
618
+ let abortPromise;
619
+ let failure;
620
+ const messages = [];
621
+ let text = "";
622
+ let lastToolError;
623
+ let assistantTranscriptOwned = false;
624
+ let finalKey;
625
+ const bound = params.hostCapabilities.bindModelExecution?.({
626
+ provider: "meta",
627
+ model: params.modelId
628
+ });
629
+ const signal = bound ? AbortSignal.any([bound.signal, ...params.abortSignal ? [params.abortSignal] : []]) : params.abortSignal;
630
+ const assertDispatchActive = () => {
631
+ params.hostCapabilities.assertActive();
632
+ bound?.assertCurrent();
633
+ signal?.throwIfAborted();
634
+ if (aborted) throw new Error("Muse attempt was aborted before turn dispatch.");
635
+ };
636
+ const stop = async () => {
637
+ if (!session || !turn) return;
638
+ if (!abortPromise) {
639
+ forceCloseTimer = setTimeout(() => {
640
+ runtime.close();
641
+ }, 5e3);
642
+ forceCloseTimer.unref();
643
+ const nativeTurn = turn;
644
+ abortPromise = (async () => {
645
+ await runtime.host.connection.command("turn/interrupt", {
646
+ sessionId: session.sessionId,
647
+ turnId: nativeTurn.turnId
648
+ }).catch(() => runtime.close());
649
+ await nativeTurn.completed;
650
+ })();
651
+ }
652
+ await abortPromise;
653
+ };
654
+ const abort = async () => {
655
+ aborted = true;
656
+ await stop();
657
+ };
658
+ const onAbort = () => {
659
+ abort().catch(() => runtime.close());
660
+ };
661
+ const handle = {
662
+ kind: "embedded",
663
+ runId: params.runId,
664
+ startedAtMs: params.startedAtMs,
665
+ toolAuthorityFingerprint: params.toolAuthorityFingerprint,
666
+ queueMessage: async () => {
667
+ throw new Error("Muse live steering is not supported; wait for the active turn.");
668
+ },
669
+ isStreaming: () => !aborted,
670
+ isAborted: () => aborted,
671
+ isCompacting: () => false,
672
+ sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
673
+ cancel: onAbort,
674
+ abort
675
+ };
676
+ signal?.addEventListener("abort", onAbort, { once: true });
677
+ const timer = params.timeoutMs < MAX_TIMER_TIMEOUT_MS ? setTimeout(() => {
678
+ timedOut = true;
679
+ params.onAttemptTimeout?.(/* @__PURE__ */ new Error("Muse turn timed out"));
680
+ onAbort();
681
+ }, params.timeoutMs) : void 0;
682
+ timer?.unref();
683
+ try {
684
+ assertDispatchActive();
685
+ const stored = await options.sessionStore.lookup(params.sessionId);
686
+ assertDispatchActive();
687
+ const resumable = stored && stored.compatibility === compatibility && !params.initialReplayState?.replayInvalid;
688
+ let freshSession = !resumable;
689
+ session = await openMuseSession(runtime, {
690
+ ...resumable ? { sessionId: stored.sessionId } : {},
691
+ workspace,
692
+ modelId: params.modelId,
693
+ approvalMode,
694
+ onResumeRefused: (message) => {
695
+ freshSession = true;
696
+ options.logger?.warn(`${message}; started a new Muse session.`);
697
+ }
698
+ });
699
+ assertDispatchActive();
700
+ let sessionContext = "";
701
+ if (freshSession) {
702
+ try {
703
+ sessionContext = await prepareMuseSessionContext(params, {
704
+ ...transcriptTarget,
705
+ agentId: target.agentId ?? sessionAgentId
706
+ }, options.logger?.warn);
707
+ } catch (error) {
708
+ throw museRefusal(`Muse could not restore OpenClaw session context. Use the openclaw runtime or compact the session before retrying. ${formatErrorMessage(error)}`);
709
+ }
710
+ assertDispatchActive();
711
+ }
712
+ session.onApproval(createApprovalHandler(params));
713
+ session.onApprovalError((error) => {
714
+ failure = /* @__PURE__ */ new Error(`Muse approval failed (${error.kind}): ${error.kind === "unofferedChoice" ? `choice ${error.choiceId} was not offered` : formatErrorMessage(error.error)}`);
715
+ stop().catch(() => runtime.close());
716
+ });
717
+ assertDispatchActive();
718
+ await params.userTurnTranscriptRecorder?.persistApproved();
719
+ assertDispatchActive();
720
+ const input = [{
721
+ type: "text",
722
+ text: [
723
+ sessionContext,
724
+ params.extraSystemPrompt,
725
+ params.prompt
726
+ ].filter(Boolean).join("\n\n")
727
+ }, ...(params.images ?? []).map((image) => ({
728
+ type: "image",
729
+ mediaType: image.mimeType,
730
+ base64Data: image.data
731
+ }))];
732
+ turn = await session.sendUserTurn({
733
+ input,
734
+ ...params.thinkLevel ? { reasoningEffort: params.thinkLevel === "off" ? "minimal" : params.thinkLevel } : {}
735
+ });
736
+ await options.sessionStore.register(params.sessionId, {
737
+ sessionId: session.sessionId,
738
+ compatibility
739
+ });
740
+ if (signal?.aborted) onAbort();
741
+ else if (failure) stop().catch(() => runtime.close());
742
+ setActiveEmbeddedRun(params.sessionId, handle, params.sessionKey, params.sessionFile);
743
+ params.replyOperation?.attachBackend(handle);
744
+ active.set(params.sessionId, abort);
745
+ params.onExecutionStarted?.({ backend: "muse" });
746
+ const nativeSessionId = session.sessionId;
747
+ const result = await consumeTurn(turn, params, async (itemId, group) => {
748
+ const entries = group.map((message, index) => {
749
+ const idempotencyKey = `muse:${nativeSessionId}:${itemId}:${index}`;
750
+ if (message.role === "assistant" && message.stopReason !== "toolUse") finalKey = idempotencyKey;
751
+ return {
752
+ message: {
753
+ ...message,
754
+ idempotencyKey
755
+ },
756
+ idempotencyLookup: "scan"
757
+ };
758
+ });
759
+ params.hostCapabilities.assertActive();
760
+ if ((await appendSessionTranscriptMessagesByIdentity({
761
+ ...transcriptTarget,
762
+ messages: entries,
763
+ config: params.config
764
+ })).length !== entries.length) throw new Error("Muse transcript persistence rejected a native message group.");
765
+ await publishSessionTranscriptUpdateByIdentity(transcriptTarget);
766
+ messages.push(...group);
767
+ assistantTranscriptOwned = finalKey !== void 0;
768
+ });
769
+ text = result.visibleText;
770
+ lastToolError = result.lastToolError;
771
+ if (result.outcome.kind !== "completed") throw new Error(`Muse turn ended without a terminal result (${result.outcome.kind}).`);
772
+ if (result.outcome.params.terminal === "failed") {
773
+ const turnError = result.outcome.params.error;
774
+ throw new Error(turnError?.kind === "authRequired" ? `Muse Code is not signed in on the Gateway host (${turnError.message}). Run \`muse login\` there, or set META_API_KEY for the Gateway.` : turnError?.message ?? result.outcome.params.reason ?? "Muse model request failed. Run muse to check login and model access.");
775
+ }
776
+ if (result.outcome.params.terminal === "cancelled" && !failure) aborted = true;
777
+ } catch (error) {
778
+ if (signal?.aborted && !failure) aborted = true;
779
+ else failure ??= error;
780
+ if (turn) await stop().catch(() => void 0);
781
+ } finally {
782
+ await abortPromise?.catch(() => void 0);
783
+ clearTimeout(timer);
784
+ clearTimeout(forceCloseTimer);
785
+ signal?.removeEventListener("abort", onAbort);
786
+ active.delete(params.sessionId);
787
+ clearActiveEmbeddedRun(params.sessionId, handle, params.sessionKey);
788
+ bound?.release();
789
+ lease.release();
790
+ }
791
+ const toolMetas = messages.filter((message) => message.role === "toolResult").map((message) => ({ toolName: message.toolName }));
792
+ const interruption = timedOut ? {
793
+ kind: "timeout",
794
+ phase: "prompt",
795
+ source: "runtime"
796
+ } : aborted ? {
797
+ kind: "aborted",
798
+ source: "external"
799
+ } : { kind: "ok" };
800
+ const failureMessage = failure ? `Muse Code: ${formatErrorMessage(failure)}${runtime.host.child.stderrTail.length ? `\nRecent Muse stderr:\n${runtime.host.child.stderrTail.slice(-5).join("\n")}` : ""}` : void 0;
801
+ if (failureMessage) options.logger?.warn(failureMessage);
802
+ const terminal = failureMessage ? agentHarnessAttemptTerminal.setFailure(interruption, {
803
+ source: "prompt",
804
+ error: new Error(failureMessage)
805
+ }) : interruption;
806
+ const lastAssistant = messages.findLast((message) => message.role === "assistant");
807
+ return {
808
+ terminal,
809
+ assistantTexts: text ? [text] : [],
810
+ messagesSnapshot: messages,
811
+ lastAssistant,
812
+ currentAttemptAssistant: lastAssistant,
813
+ currentAttemptCompletedAssistant: failure ? void 0 : lastAssistant,
814
+ assistantTranscriptOwned,
815
+ assistantTranscriptIdempotencyKey: finalKey,
816
+ toolMetas,
817
+ lastToolError,
818
+ cloudCodeAssistFormatError: false,
819
+ didSendViaMessagingTool: false,
820
+ itemLifecycle: {
821
+ activeCount: 0,
822
+ completedCount: messages.length,
823
+ startedCount: messages.length
824
+ },
825
+ messagingToolSentTexts: [],
826
+ messagingToolSentTargets: [],
827
+ messagingToolSentMediaUrls: [],
828
+ sessionIdUsed: params.sessionId,
829
+ sessionFileUsed: params.sessionFile,
830
+ yieldDetected: false,
831
+ replayMetadata: {
832
+ replaySafe: !failure && !params.initialReplayState?.replayInvalid && toolMetas.length === 0,
833
+ hadPotentialSideEffects: params.initialReplayState?.hadPotentialSideEffects === true || toolMetas.length > 0
834
+ }
835
+ };
836
+ });
837
+ inFlight.add(operation);
838
+ try {
839
+ return await operation;
840
+ } finally {
841
+ inFlight.delete(operation);
842
+ }
843
+ }
844
+ return {
845
+ id: "muse",
846
+ label: "Muse Code",
847
+ autoSelection: { providerIds: [] },
848
+ authBootstrap: "harness",
849
+ executionEnvironment: "host-only",
850
+ verifySetup: verifyMuseSetup,
851
+ async loadModelCatalog(params) {
852
+ catalogs.delete(params.agentDir);
853
+ const request = readMuseCatalog({
854
+ config: params.config,
855
+ signal: AbortSignal.any([catalogAbort.signal, AbortSignal.timeout(3e4)]),
856
+ assertCurrent: () => {
857
+ if (disposed) throw new Error("Muse harness has been disposed.");
858
+ }
859
+ });
860
+ inFlight.add(request);
861
+ try {
862
+ const entries = await request;
863
+ catalogs.set(params.agentDir, {
864
+ workspaceDir: params.workspaceDir,
865
+ models: new Set(entries.map((entry) => entry.id))
866
+ });
867
+ return entries;
868
+ } finally {
869
+ inFlight.delete(request);
870
+ }
871
+ },
872
+ readModelCatalogReadiness(params) {
873
+ const catalog = catalogs.get(params.agentDir);
874
+ return !disposed && params.provider === "meta" && catalog?.workspaceDir === params.workspaceDir && catalog.models.has(params.modelId) ? { accountType: "native" } : void 0;
875
+ },
876
+ conversationToolPolicyNativeTools: [
877
+ "exec",
878
+ "read",
879
+ "write",
880
+ "edit"
881
+ ],
882
+ supports: (ctx) => ctx.requestedRuntime === "muse" && ctx.provider === "meta" && ctx.modelProvider?.requestTransportOverrides !== "present" && (ctx.modelProvider?.endpointOverrides !== "present" || ctx.modelProvider.baseUrl?.replace(/\/+$/u, "") === "https://api.meta.ai/v1") ? {
883
+ supported: true,
884
+ priority: 100
885
+ } : {
886
+ supported: false,
887
+ reason: "Muse requires an explicit muse runtime and Meta's official API endpoint."
888
+ },
889
+ runAttempt,
890
+ async withSessionContextReset(params, run) {
891
+ params.assertCurrent();
892
+ await active.get(params.sessionId)?.();
893
+ return queue.enqueue(params.sessionId, async () => {
894
+ params.assertCurrent();
895
+ let committed = false;
896
+ const result = await run(createNativeSessionCommitFinalizer({
897
+ commit: () => {
898
+ committed = true;
899
+ },
900
+ rollback: () => void 0
901
+ }));
902
+ if (committed) {
903
+ params.assertCurrent();
904
+ await options.sessionStore.delete(params.sessionId);
905
+ }
906
+ return result;
907
+ });
908
+ },
909
+ async reset(params) {
910
+ const sessionId = params.sessionId;
911
+ if (!sessionId) return;
912
+ await active.get(sessionId)?.();
913
+ await queue.enqueue(sessionId, async () => {
914
+ await options.sessionStore.delete(sessionId);
915
+ });
916
+ },
917
+ async dispose() {
918
+ disposed = true;
919
+ catalogAbort.abort();
920
+ catalogs.clear();
921
+ await Promise.allSettled([...active.values()].map((abort) => abort()));
922
+ await Promise.allSettled(inFlight);
923
+ await pool.dispose();
924
+ }
925
+ };
926
+ }
927
+ //#endregion
928
+ export { createMuseAgentHarness as t };
@@ -0,0 +1 @@
1
+ export { t as createMuseAgentHarness } from "./.setup/harness-BJH5uEKI.mjs";
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ import { t as createMuseAgentHarness } from "./.setup/harness-BJH5uEKI.mjs";
2
+ import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
3
+ import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
+ //#region extensions/muse/index.ts
5
+ var muse_default = definePluginEntry({
6
+ id: "muse",
7
+ name: "Muse Code agent runtime",
8
+ description: "Runs Meta models through the Muse Code CLI.",
9
+ register(api) {
10
+ if (![
11
+ "full",
12
+ "discovery",
13
+ "tool-discovery"
14
+ ].includes(api.registrationMode)) return;
15
+ let store;
16
+ const getStore = () => store ??= api.runtime.state.openKeyedStore({
17
+ namespace: "msp-sessions",
18
+ maxEntries: 5e3,
19
+ defaultTtlMs: 7776e6
20
+ });
21
+ const binaryPath = isRecord(api.pluginConfig) && typeof api.pluginConfig.binaryPath === "string" ? api.pluginConfig.binaryPath : void 0;
22
+ api.registerAgentHarness(createMuseAgentHarness({
23
+ binaryPath,
24
+ sessionStore: {
25
+ register: (key, value, options) => getStore().register(key, value, options),
26
+ lookup: (key) => getStore().lookup(key),
27
+ delete: (key) => getStore().delete(key)
28
+ },
29
+ logger: api.logger
30
+ }));
31
+ }
32
+ });
33
+ //#endregion
34
+ export { muse_default as default };
@@ -0,0 +1,19 @@
1
+ {
2
+ "id": "muse",
3
+ "name": "Muse Code agent runtime",
4
+ "description": "Runs Meta models through the Muse Code CLI.",
5
+ "version": "2026.10.2",
6
+ "categories": ["agent-runtimes"],
7
+ "activation": { "onStartup": false, "onAgentHarnesses": ["muse"] },
8
+ "sessionRouteStateOwners": [
9
+ { "id": "muse", "label": "Muse Code", "providerIds": ["meta"], "runtimeIds": ["muse"], "cliSessionKeys": ["muse"], "authProfilePrefixes": ["meta:"] }
10
+ ],
11
+ "configSchema": {
12
+ "type": "object",
13
+ "additionalProperties": false,
14
+ "properties": { "binaryPath": { "type": "string", "minLength": 1, "default": "muse" } }
15
+ },
16
+ "uiHints": {
17
+ "binaryPath": { "label": "Muse binary", "help": "Muse executable path, or command resolved on PATH. Install Muse separately.", "advanced": true }
18
+ }
19
+ }
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@openclaw/muse",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2026.10.10-beta.2",
4
+ "description": "OpenClaw Muse Code agent runtime plugin (registers a `muse` AgentHarness backed by @muse-code/sdk over the Muse Session Protocol to the Muse Code CLI)",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/openclaw/openclaw"
8
+ },
9
+ "type": "module",
10
+ "dependencies": {
11
+ "@muse-code/sdk": "1.4.2"
12
+ },
13
+ "devDependencies": {
14
+ "@openclaw/plugin-sdk": "workspace:*"
15
+ },
16
+ "openclaw": {
17
+ "extensions": [
18
+ "./index.ts"
19
+ ],
20
+ "install": {
21
+ "clawhubSpec": "clawhub:@openclaw/muse",
22
+ "npmSpec": "@openclaw/muse",
23
+ "defaultChoice": "npm",
24
+ "minHostVersion": ">=2026.10.2"
25
+ },
26
+ "compat": {
27
+ "pluginApi": ">=2026.10.10-beta.2"
28
+ },
29
+ "build": {
30
+ "openclawVersion": "2026.10.10-beta.2",
31
+ "bundledDist": false
32
+ },
33
+ "release": {
34
+ "bundleRuntimeDependencies": false,
35
+ "publishToClawHub": true,
36
+ "publishToNpm": true
37
+ },
38
+ "runtimeExtensions": [
39
+ "./dist/index.js"
40
+ ]
41
+ },
42
+ "files": [
43
+ "dist/**",
44
+ "openclaw.plugin.json",
45
+ "README.md",
46
+ "assets/icon.png",
47
+ "assets/activity.svg"
48
+ ],
49
+ "peerDependencies": {
50
+ "openclaw": ">=2026.10.10-beta.2"
51
+ },
52
+ "peerDependenciesMeta": {
53
+ "openclaw": {
54
+ "optional": true
55
+ }
56
+ }
57
+ }