@femtomc/mu-agent 26.2.65 → 26.2.67

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.
@@ -7,5 +7,6 @@ export type MuSubcommandRegistration = {
7
7
  aliases?: string[];
8
8
  handler: MuSubcommandHandler;
9
9
  };
10
+ export declare function resetMuCommandDispatcher(): void;
10
11
  export declare function registerMuSubcommand(pi: ExtensionAPI, registration: MuSubcommandRegistration): void;
11
12
  //# sourceMappingURL=mu-command-dispatcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mu-command-dispatcher.d.ts","sourceRoot":"","sources":["../../src/extensions/mu-command-dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvG,MAAM,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAgIF,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,wBAAwB,GAAG,IAAI,CAsDnG"}
1
+ {"version":3,"file":"mu-command-dispatcher.d.ts","sourceRoot":"","sources":["../../src/extensions/mu-command-dispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,MAAM,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEvG,MAAM,MAAM,wBAAwB,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAcF,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAoHD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,wBAAwB,GAAG,IAAI,CAsDnG"}
@@ -1,4 +1,7 @@
1
1
  let singletonState = null;
2
+ export function resetMuCommandDispatcher() {
3
+ singletonState = null;
4
+ }
2
5
  const RESERVED_SUBCOMMANDS = new Set(["help", "?"]);
3
6
  function normalizeSubcommand(value) {
4
7
  return value.trim().toLowerCase();
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * mu_command — Operator mutation tool.
3
3
  *
4
- * Registered only in operator sessions. The LLM calls this tool with a
5
- * structured command proposal instead of emitting fragile text directives.
6
- * The tool itself does nothing except confirm receipt the actual command
7
- * is captured by the PiMessagingOperatorBackend subscriber on
8
- * tool_execution_start and routed through the existing broker/audit pipeline.
4
+ * Tri-modal execution:
5
+ * - Mode 1 (Messaging): MU_OPERATOR_MESSAGING_MODE=1. Returns stub "accepted".
6
+ * The actual command is captured by PiMessagingOperatorBackend via event subscription.
7
+ * - Mode 2 (TUI with server): MU_SERVER_URL set. POSTs to /api/commands/submit.
8
+ * - Mode 3 (No server): Returns error directing user to start `mu serve`.
9
9
  */
10
10
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
11
11
  export declare const MU_COMMAND_TOOL_NAME = "mu_command";
@@ -1 +1 @@
1
- {"version":3,"file":"operator-command.d.ts","sourceRoot":"","sources":["../../src/extensions/operator-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,YAAY,QAuCxD;AAED,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"operator-command.d.ts","sourceRoot":"","sources":["../../src/extensions/operator-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAyFjD,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,YAAY,QA2DxD;AAED,eAAe,wBAAwB,CAAC"}
@@ -1,15 +1,85 @@
1
1
  /**
2
2
  * mu_command — Operator mutation tool.
3
3
  *
4
- * Registered only in operator sessions. The LLM calls this tool with a
5
- * structured command proposal instead of emitting fragile text directives.
6
- * The tool itself does nothing except confirm receipt the actual command
7
- * is captured by the PiMessagingOperatorBackend subscriber on
8
- * tool_execution_start and routed through the existing broker/audit pipeline.
4
+ * Tri-modal execution:
5
+ * - Mode 1 (Messaging): MU_OPERATOR_MESSAGING_MODE=1. Returns stub "accepted".
6
+ * The actual command is captured by PiMessagingOperatorBackend via event subscription.
7
+ * - Mode 2 (TUI with server): MU_SERVER_URL set. POSTs to /api/commands/submit.
8
+ * - Mode 3 (No server): Returns error directing user to start `mu serve`.
9
9
  */
10
10
  import { StringEnum } from "@mariozechner/pi-ai";
11
11
  import { Type } from "@sinclair/typebox";
12
12
  export const MU_COMMAND_TOOL_NAME = "mu_command";
13
+ async function executeViaServer(serverUrl, params) {
14
+ const url = `${serverUrl.replace(/\/+$/, "")}/api/commands/submit`;
15
+ const response = await fetch(url, {
16
+ method: "POST",
17
+ headers: { "Content-Type": "application/json" },
18
+ body: JSON.stringify(params),
19
+ });
20
+ const contentType = response.headers.get("content-type") ?? "";
21
+ const raw = await response.text();
22
+ let body = null;
23
+ try {
24
+ body = JSON.parse(raw);
25
+ }
26
+ catch {
27
+ body = null;
28
+ }
29
+ if (!body) {
30
+ const preview = raw.slice(0, 200).replaceAll(/\s+/g, " ").trim();
31
+ return {
32
+ content: [{
33
+ type: "text",
34
+ text: [
35
+ `Command API mismatch at ${url}.`,
36
+ `Expected JSON response, got content-type ${contentType || "unknown"} (status ${response.status}).`,
37
+ preview ? `Body preview: ${preview}` : "",
38
+ "This usually means MU_SERVER_URL points at an outdated server or wrong base URL.",
39
+ ].filter(Boolean).join("\n"),
40
+ }],
41
+ details: {
42
+ kind: params.kind,
43
+ error: "command_api_mismatch",
44
+ status: response.status,
45
+ content_type: contentType,
46
+ body_preview: preview,
47
+ url,
48
+ },
49
+ };
50
+ }
51
+ if (!response.ok) {
52
+ const error = typeof body.error === "string" ? body.error : `HTTP ${response.status}`;
53
+ return {
54
+ content: [{ type: "text", text: `Command failed: ${error}` }],
55
+ details: { kind: params.kind, error, status: response.status },
56
+ };
57
+ }
58
+ const result = body.result;
59
+ const resultKind = typeof result?.kind === "string" ? result.kind : "unknown";
60
+ let summary;
61
+ if (resultKind === "completed" || resultKind === "awaiting_confirmation") {
62
+ const command = result?.command;
63
+ summary = `Command ${resultKind}: ${params.kind}`;
64
+ if (command?.target_type) {
65
+ summary += ` (${command.target_type})`;
66
+ }
67
+ if (resultKind === "completed" && command?.result) {
68
+ summary += `\n${JSON.stringify(command.result, null, 2)}`;
69
+ }
70
+ }
71
+ else if (resultKind === "denied" || resultKind === "invalid" || resultKind === "failed") {
72
+ const reason = result?.reason ?? "unknown";
73
+ summary = `Command ${resultKind}: ${reason}`;
74
+ }
75
+ else {
76
+ summary = `Command result: ${resultKind}`;
77
+ }
78
+ return {
79
+ content: [{ type: "text", text: summary }],
80
+ details: { kind: params.kind, pipeline_result: result },
81
+ };
82
+ }
13
83
  export function operatorCommandExtension(pi) {
14
84
  const CommandParams = Type.Object({
15
85
  kind: StringEnum([
@@ -23,6 +93,8 @@ export function operatorCommandExtension(pi) {
23
93
  "run_start",
24
94
  "run_resume",
25
95
  "run_interrupt",
96
+ "reload",
97
+ "update",
26
98
  ]),
27
99
  prompt: Type.Optional(Type.String({ description: "Prompt for run_start" })),
28
100
  issue_id: Type.Optional(Type.String({ description: "Issue ID for issue_get" })),
@@ -42,9 +114,25 @@ export function operatorCommandExtension(pi) {
42
114
  ].join(" "),
43
115
  parameters: CommandParams,
44
116
  async execute(_toolCallId, params) {
117
+ // Mode 1: Messaging backend captures the tool call via event subscription.
118
+ if (process.env.MU_OPERATOR_MESSAGING_MODE === "1") {
119
+ return {
120
+ content: [{ type: "text", text: `Command proposal accepted: ${params.kind}` }],
121
+ details: { kind: params.kind },
122
+ };
123
+ }
124
+ // Mode 2: TUI with server — POST to /api/commands/submit.
125
+ const serverUrl = process.env.MU_SERVER_URL;
126
+ if (serverUrl) {
127
+ return await executeViaServer(serverUrl, params);
128
+ }
129
+ // Mode 3: No server available.
45
130
  return {
46
- content: [{ type: "text", text: `Command proposal accepted: ${params.kind}` }],
47
- details: { kind: params.kind },
131
+ content: [{
132
+ type: "text",
133
+ text: "No server running. Start with `mu serve` for command execution, or use messaging adapters.",
134
+ }],
135
+ details: { kind: params.kind, error: "no_server" },
48
136
  };
49
137
  },
50
138
  });
@@ -44,6 +44,10 @@ export declare const OperatorApprovedCommandSchema: z.ZodDiscriminatedUnion<[z.Z
44
44
  }, z.core.$strip>, z.ZodObject<{
45
45
  kind: z.ZodLiteral<"run_interrupt">;
46
46
  root_issue_id: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>, z.ZodObject<{
48
+ kind: z.ZodLiteral<"reload">;
49
+ }, z.core.$strip>, z.ZodObject<{
50
+ kind: z.ZodLiteral<"update">;
47
51
  }, z.core.$strip>, z.ZodObject<{
48
52
  kind: z.ZodLiteral<"run_start">;
49
53
  prompt: z.ZodString;
@@ -80,6 +84,10 @@ export declare const OperatorBackendTurnResultSchema: z.ZodDiscriminatedUnion<[z
80
84
  }, z.core.$strip>, z.ZodObject<{
81
85
  kind: z.ZodLiteral<"run_interrupt">;
82
86
  root_issue_id: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strip>, z.ZodObject<{
88
+ kind: z.ZodLiteral<"reload">;
89
+ }, z.core.$strip>, z.ZodObject<{
90
+ kind: z.ZodLiteral<"update">;
83
91
  }, z.core.$strip>, z.ZodObject<{
84
92
  kind: z.ZodLiteral<"run_start">;
85
93
  prompt: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAmB,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AAEtE,MAAM,MAAM,gCAAgC,GAAG;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,eAAe,GAAG,gCAAgC,CAAC;AACxD,KAAK,eAAe,GAAG,gCAAgC,CAAC;AAIxD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA6BxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC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,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;IACnE,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC;AAoC1C,qBAAa,0BAA2B,YAAW,wBAAwB;;gBAcvD,IAAI,GAAE,8BAAmC;IAgI/C,OAAO,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmFlF,OAAO,IAAI,IAAI;CAKtB"}
package/dist/operator.js CHANGED
@@ -29,6 +29,8 @@ export const OperatorApprovedCommandSchema = z.discriminatedUnion("kind", [
29
29
  kind: z.literal("run_interrupt"),
30
30
  root_issue_id: z.string().trim().min(1).optional(),
31
31
  }),
32
+ z.object({ kind: z.literal("reload") }),
33
+ z.object({ kind: z.literal("update") }),
32
34
  z.object({
33
35
  kind: z.literal("run_start"),
34
36
  prompt: z.string().trim().min(1),
@@ -122,6 +124,16 @@ export class ApprovedCommandBroker {
122
124
  }
123
125
  break;
124
126
  }
127
+ case "reload": {
128
+ commandKey = "reload";
129
+ args = [];
130
+ break;
131
+ }
132
+ case "update": {
133
+ commandKey = "update";
134
+ args = [];
135
+ break;
136
+ }
125
137
  case "run_start": {
126
138
  if (!this.#runTriggersEnabled) {
127
139
  return { kind: "reject", reason: "operator_action_disallowed", details: "run triggers disabled" };
@@ -311,6 +323,9 @@ export class PiMessagingOperatorBackend {
311
323
  this.#sessionIdleTtlMs = Math.max(60_000, Math.trunc(opts.sessionIdleTtlMs ?? 30 * 60 * 1_000));
312
324
  this.#maxSessions = Math.max(1, Math.trunc(opts.maxSessions ?? 32));
313
325
  this.#auditTurns = opts.auditTurns ?? true;
326
+ // Signal to mu_command tool that commands are captured via event subscription,
327
+ // not executed directly. The tool returns a stub in this mode.
328
+ process.env.MU_OPERATOR_MESSAGING_MODE = "1";
314
329
  }
315
330
  #disposeSession(sessionId) {
316
331
  const entry = this.#sessions.get(sessionId);
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "@femtomc/mu-agent",
3
- "version": "26.2.65",
4
- "description": "Shared agent runtime for mu chat, orchestration roles, and serve extensions.",
5
- "keywords": [
6
- "mu",
7
- "agent",
8
- "runtime",
9
- "chat",
10
- "extensions"
11
- ],
12
- "type": "module",
13
- "main": "./dist/index.js",
14
- "types": "./dist/index.d.ts",
15
- "exports": {
16
- ".": {
17
- "types": "./dist/index.d.ts",
18
- "default": "./dist/index.js"
19
- }
20
- },
21
- "files": [
22
- "dist/**",
23
- "prompts/**"
24
- ],
25
- "dependencies": {
26
- "@femtomc/mu-core": "26.2.65",
27
- "@mariozechner/pi-agent-core": "^0.53.0",
28
- "@mariozechner/pi-ai": "^0.53.0",
29
- "@mariozechner/pi-coding-agent": "^0.53.0",
30
- "@sinclair/typebox": "^0.34.0",
31
- "zod": "^4.1.9"
32
- }
2
+ "name": "@femtomc/mu-agent",
3
+ "version": "26.2.67",
4
+ "description": "Shared agent runtime for mu chat, orchestration roles, and serve extensions.",
5
+ "keywords": [
6
+ "mu",
7
+ "agent",
8
+ "runtime",
9
+ "chat",
10
+ "extensions"
11
+ ],
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist/**",
23
+ "prompts/**"
24
+ ],
25
+ "dependencies": {
26
+ "@femtomc/mu-core": "26.2.67",
27
+ "@mariozechner/pi-agent-core": "^0.53.0",
28
+ "@mariozechner/pi-ai": "^0.53.0",
29
+ "@mariozechner/pi-coding-agent": "^0.53.0",
30
+ "@sinclair/typebox": "^0.34.0",
31
+ "zod": "^4.1.9"
32
+ }
33
33
  }