@femtomc/mu-agent 26.2.71 → 26.2.73
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 +27 -37
- package/dist/extensions/branding.d.ts +1 -1
- package/dist/extensions/branding.js +1 -1
- package/dist/extensions/index.d.ts +5 -13
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +7 -15
- package/dist/extensions/mu-operator.d.ts +2 -2
- package/dist/extensions/mu-operator.js +4 -4
- package/dist/extensions/mu-serve.d.ts +2 -2
- package/dist/extensions/mu-serve.d.ts.map +1 -1
- package/dist/extensions/mu-serve.js +6 -14
- package/dist/extensions/mu-tools.d.ts +9 -0
- package/dist/extensions/mu-tools.d.ts.map +1 -0
- package/dist/extensions/mu-tools.js +12 -0
- package/dist/extensions/operator-command.d.ts +3 -4
- package/dist/extensions/operator-command.d.ts.map +1 -1
- package/dist/extensions/operator-command.js +58 -115
- package/dist/extensions/query.d.ts +4 -0
- package/dist/extensions/query.d.ts.map +1 -0
- package/dist/extensions/query.js +402 -0
- package/dist/operator.d.ts +15 -0
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +130 -10
- package/dist/session_factory.d.ts +7 -0
- package/dist/session_factory.d.ts.map +1 -1
- package/dist/session_factory.js +21 -2
- package/package.json +2 -2
- package/prompts/roles/operator.md +22 -40
- package/prompts/roles/orchestrator.md +18 -12
- package/prompts/roles/reviewer.md +8 -7
- package/prompts/roles/worker.md +8 -11
- package/dist/extensions/activities.d.ts +0 -7
- package/dist/extensions/activities.d.ts.map +0 -1
- package/dist/extensions/activities.js +0 -236
- package/dist/extensions/cron.d.ts +0 -7
- package/dist/extensions/cron.d.ts.map +0 -1
- package/dist/extensions/cron.js +0 -247
- package/dist/extensions/heartbeats.d.ts +0 -7
- package/dist/extensions/heartbeats.d.ts.map +0 -1
- package/dist/extensions/heartbeats.js +0 -192
- package/dist/extensions/messaging-setup/actions.d.ts +0 -22
- package/dist/extensions/messaging-setup/actions.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/actions.js +0 -229
- package/dist/extensions/messaging-setup/adapters.d.ts +0 -24
- package/dist/extensions/messaging-setup/adapters.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/adapters.js +0 -170
- package/dist/extensions/messaging-setup/index.d.ts +0 -17
- package/dist/extensions/messaging-setup/index.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/index.js +0 -261
- package/dist/extensions/messaging-setup/parser.d.ts +0 -33
- package/dist/extensions/messaging-setup/parser.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/parser.js +0 -240
- package/dist/extensions/messaging-setup/runtime.d.ts +0 -16
- package/dist/extensions/messaging-setup/runtime.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/runtime.js +0 -110
- package/dist/extensions/messaging-setup/types.d.ts +0 -157
- package/dist/extensions/messaging-setup/types.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/types.js +0 -4
- package/dist/extensions/messaging-setup/ui.d.ts +0 -15
- package/dist/extensions/messaging-setup/ui.d.ts.map +0 -1
- package/dist/extensions/messaging-setup/ui.js +0 -173
- package/dist/extensions/messaging-setup.d.ts +0 -3
- package/dist/extensions/messaging-setup.d.ts.map +0 -1
- package/dist/extensions/messaging-setup.js +0 -2
- package/dist/extensions/mu-full-tools.d.ts +0 -10
- package/dist/extensions/mu-full-tools.d.ts.map +0 -1
- package/dist/extensions/mu-full-tools.js +0 -25
- package/dist/extensions/mu-query-tools.d.ts +0 -10
- package/dist/extensions/mu-query-tools.d.ts.map +0 -1
- package/dist/extensions/mu-query-tools.js +0 -11
- package/dist/extensions/orchestration-runs-readonly.d.ts +0 -4
- package/dist/extensions/orchestration-runs-readonly.d.ts.map +0 -1
- package/dist/extensions/orchestration-runs-readonly.js +0 -226
- package/dist/extensions/orchestration-runs.d.ts +0 -4
- package/dist/extensions/orchestration-runs.d.ts.map +0 -1
- package/dist/extensions/orchestration-runs.js +0 -315
- package/dist/extensions/server-tools-readonly.d.ts +0 -4
- package/dist/extensions/server-tools-readonly.d.ts.map +0 -1
- package/dist/extensions/server-tools-readonly.js +0 -5
- package/dist/extensions/server-tools.d.ts +0 -25
- package/dist/extensions/server-tools.d.ts.map +0 -1
- package/dist/extensions/server-tools.js +0 -833
- package/prompts/skills/messaging-setup-brief.md +0 -25
package/README.md
CHANGED
|
@@ -46,9 +46,9 @@ not anonymous inline factories).
|
|
|
46
46
|
Current stack:
|
|
47
47
|
|
|
48
48
|
- `brandingExtension` — mu compact header/footer branding + default theme
|
|
49
|
-
- `
|
|
49
|
+
- `queryExtension` — read-only retrieval (`query` tool)
|
|
50
|
+
- `operatorCommandExtension` — approved mutation pathway (`command` tool)
|
|
50
51
|
- `eventLogExtension` — event tail + watch widget
|
|
51
|
-
- `messagingSetupExtension` — adapter diagnostics and setup guidance
|
|
52
52
|
|
|
53
53
|
`mu serve` sets `MU_SERVER_URL` automatically for these extensions.
|
|
54
54
|
|
|
@@ -56,53 +56,43 @@ Default operator UI theme is `mu-gruvbox-dark`.
|
|
|
56
56
|
|
|
57
57
|
## Slash commands (operator-facing)
|
|
58
58
|
|
|
59
|
-
- `/mu status` — concise server status
|
|
60
|
-
- `/mu control` — active control-plane adapters and webhook routes
|
|
61
|
-
- `/mu setup` — adapter preflight
|
|
62
|
-
- `/mu setup plan <adapter>` — actionable wiring plan
|
|
63
|
-
- `/mu setup apply <adapter>` — guided config apply + control-plane reload
|
|
64
|
-
- `/mu setup verify [adapter]` — runtime verification for mounted routes
|
|
65
|
-
- `/mu setup <adapter>` — sends adapter setup brief to mu agent (`--no-agent` prints local guide)
|
|
66
59
|
- `/mu events [n]` / `/mu events tail [n]` — event log tail
|
|
67
60
|
- `/mu events watch on|off` — toggle event watch widget
|
|
68
61
|
- `/mu brand on|off|toggle` — enable/disable UI branding
|
|
62
|
+
- `/mu help` — dispatcher catalog of registered `/mu` subcommands
|
|
69
63
|
|
|
70
64
|
## Tools (agent/operator-facing)
|
|
71
65
|
|
|
72
|
-
- `
|
|
73
|
-
-
|
|
74
|
-
- `
|
|
75
|
-
- `action
|
|
76
|
-
- `
|
|
77
|
-
-
|
|
78
|
-
- `
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
- `query({ action, resource?, ... })`
|
|
67
|
+
- Read-only pathway.
|
|
68
|
+
- `action`: `describe | get | list | search | timeline | stats | trace`
|
|
69
|
+
- Use `action="describe"` for machine-readable capability discovery.
|
|
70
|
+
- `command({ kind, ... })`
|
|
71
|
+
- Approved mutation pathway through `/api/commands/submit`.
|
|
72
|
+
- `kind` includes run lifecycle (`run_start|run_resume|run_interrupt`),
|
|
73
|
+
control-plane lifecycle (`reload|update`), issue lifecycle/dependency edits
|
|
74
|
+
(`issue_create|issue_update|issue_claim|issue_open|issue_close|issue_dep|issue_undep`),
|
|
75
|
+
forum posting (`forum_post`), heartbeat program lifecycle
|
|
76
|
+
(`heartbeat_create|heartbeat_update|heartbeat_delete|heartbeat_trigger|heartbeat_enable|heartbeat_disable`),
|
|
77
|
+
and cron program lifecycle
|
|
78
|
+
(`cron_create|cron_update|cron_delete|cron_trigger|cron_enable|cron_disable`).
|
|
85
79
|
|
|
86
80
|
### Query contract (context-safe by default)
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
The `query` tool is designed to be programmable + narrow-by-default:
|
|
89
83
|
|
|
90
|
-
- `limit`
|
|
91
|
-
- `
|
|
92
|
-
-
|
|
84
|
+
- `limit` bounds result size (default typically `20`).
|
|
85
|
+
- `fields` (comma-separated paths) enables selective projection.
|
|
86
|
+
- domain filters (`status`, `tag`, `source`, `issue_id`, `run_id`, `conversation_key`, etc.) avoid broad scans.
|
|
93
87
|
|
|
94
88
|
Recommended flow:
|
|
95
89
|
|
|
96
|
-
1.
|
|
97
|
-
2.
|
|
98
|
-
3.
|
|
90
|
+
1. `query(action="describe")` to discover capabilities.
|
|
91
|
+
2. bounded `list`/`search` with focused filters.
|
|
92
|
+
3. targeted `get`/`trace` with `fields` as needed.
|
|
99
93
|
|
|
100
|
-
|
|
101
|
-
kept compact to reduce context pollution.
|
|
94
|
+
## Control-plane config notes
|
|
102
95
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
- `slack`, `discord`, `telegram` are currently modeled as available adapters.
|
|
107
|
-
- `mu_messaging_setup(action=preflight)` is the quickest health check during
|
|
108
|
-
onboarding.
|
|
96
|
+
- Runtime config source of truth is `.mu/config.json`.
|
|
97
|
+
- Inspect runtime state via `query(action="get", resource="status")` and related `query` reads.
|
|
98
|
+
- Apply control-plane lifecycle mutations via `command(kind="reload")` / `command(kind="update")`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* mu-branding — Custom serve-mode TUI chrome for mu.
|
|
3
3
|
*
|
|
4
|
-
* Defaults to a
|
|
4
|
+
* Defaults to a compact, information-dense layout:
|
|
5
5
|
* - Compact header + footer
|
|
6
6
|
* - Terminal title and working message branding
|
|
7
7
|
* - Lightweight periodic status refresh (open/ready/control-plane)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* mu-branding — Custom serve-mode TUI chrome for mu.
|
|
3
3
|
*
|
|
4
|
-
* Defaults to a
|
|
4
|
+
* Defaults to a compact, information-dense layout:
|
|
5
5
|
* - Compact header + footer
|
|
6
6
|
* - Terminal title and working message branding
|
|
7
7
|
* - Lightweight periodic status refresh (open/ready/control-plane)
|
|
@@ -1,33 +1,25 @@
|
|
|
1
|
-
export { activitiesExtension } from "./activities.js";
|
|
2
1
|
export { brandingExtension } from "./branding.js";
|
|
3
|
-
export { cronExtension } from "./cron.js";
|
|
4
2
|
export { eventLogExtension } from "./event-log.js";
|
|
5
|
-
export {
|
|
6
|
-
export { messagingSetupExtension } from "./messaging-setup.js";
|
|
7
|
-
export { muFullToolsExtension } from "./mu-full-tools.js";
|
|
3
|
+
export { muToolsExtension } from "./mu-tools.js";
|
|
8
4
|
export { muOperatorExtension } from "./mu-operator.js";
|
|
9
|
-
export { muQueryToolsExtension } from "./mu-query-tools.js";
|
|
10
5
|
export { muServeExtension } from "./mu-serve.js";
|
|
11
6
|
export { operatorCommandExtension } from "./operator-command.js";
|
|
12
|
-
export {
|
|
13
|
-
export { orchestrationRunsReadOnlyExtension } from "./orchestration-runs-readonly.js";
|
|
14
|
-
export { serverToolsExtension, serverToolsIssueForumExtension, serverToolsReadOnlyExtension } from "./server-tools.js";
|
|
15
|
-
export { serverToolsReadonlyExtension } from "./server-tools-readonly.js";
|
|
7
|
+
export { queryExtension } from "./query.js";
|
|
16
8
|
/**
|
|
17
9
|
* Serve-mode extension — single facade that bundles all serve extensions.
|
|
18
10
|
*/
|
|
19
11
|
export declare const serveExtensionPaths: string[];
|
|
20
12
|
/**
|
|
21
13
|
* Operator-mode extension — single facade that bundles operator UI +
|
|
22
|
-
*
|
|
14
|
+
* query/command tool pathways.
|
|
23
15
|
*/
|
|
24
16
|
export declare const operatorExtensionPaths: string[];
|
|
25
17
|
/**
|
|
26
|
-
* Tool-only extension bundle for orchestrator sessions
|
|
18
|
+
* Tool-only extension bundle for orchestrator sessions.
|
|
27
19
|
*/
|
|
28
20
|
export declare const orchestratorToolExtensionPaths: string[];
|
|
29
21
|
/**
|
|
30
|
-
* Tool-only extension bundle for worker sessions
|
|
22
|
+
* Tool-only extension bundle for worker sessions.
|
|
31
23
|
*/
|
|
32
24
|
export declare const workerToolExtensionPaths: string[];
|
|
33
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQ5C;;GAEG;AACH,eAAO,MAAM,mBAAmB,UAA4C,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,sBAAsB,UAA+C,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,8BAA8B,UAA4C,CAAC;AAExF;;GAEG;AACH,eAAO,MAAM,wBAAwB,UAA4C,CAAC"}
|
package/dist/extensions/index.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
export { activitiesExtension } from "./activities.js";
|
|
2
1
|
export { brandingExtension } from "./branding.js";
|
|
3
|
-
export { cronExtension } from "./cron.js";
|
|
4
2
|
export { eventLogExtension } from "./event-log.js";
|
|
5
|
-
export {
|
|
6
|
-
export { messagingSetupExtension } from "./messaging-setup.js";
|
|
7
|
-
export { muFullToolsExtension } from "./mu-full-tools.js";
|
|
3
|
+
export { muToolsExtension } from "./mu-tools.js";
|
|
8
4
|
export { muOperatorExtension } from "./mu-operator.js";
|
|
9
|
-
export { muQueryToolsExtension } from "./mu-query-tools.js";
|
|
10
5
|
export { muServeExtension } from "./mu-serve.js";
|
|
11
6
|
export { operatorCommandExtension } from "./operator-command.js";
|
|
12
|
-
export {
|
|
13
|
-
export { orchestrationRunsReadOnlyExtension } from "./orchestration-runs-readonly.js";
|
|
14
|
-
export { serverToolsExtension, serverToolsIssueForumExtension, serverToolsReadOnlyExtension } from "./server-tools.js";
|
|
15
|
-
export { serverToolsReadonlyExtension } from "./server-tools-readonly.js";
|
|
7
|
+
export { queryExtension } from "./query.js";
|
|
16
8
|
const RUNTIME_EXTENSION = import.meta.url.endsWith(".ts") ? "ts" : "js";
|
|
17
9
|
function resolveBundledExtensionPath(moduleBasename) {
|
|
18
10
|
return new URL(`./${moduleBasename}.${RUNTIME_EXTENSION}`, import.meta.url).pathname;
|
|
@@ -23,14 +15,14 @@ function resolveBundledExtensionPath(moduleBasename) {
|
|
|
23
15
|
export const serveExtensionPaths = [resolveBundledExtensionPath("mu-serve")];
|
|
24
16
|
/**
|
|
25
17
|
* Operator-mode extension — single facade that bundles operator UI +
|
|
26
|
-
*
|
|
18
|
+
* query/command tool pathways.
|
|
27
19
|
*/
|
|
28
20
|
export const operatorExtensionPaths = [resolveBundledExtensionPath("mu-operator")];
|
|
29
21
|
/**
|
|
30
|
-
* Tool-only extension bundle for orchestrator sessions
|
|
22
|
+
* Tool-only extension bundle for orchestrator sessions.
|
|
31
23
|
*/
|
|
32
|
-
export const orchestratorToolExtensionPaths = [resolveBundledExtensionPath("mu-
|
|
24
|
+
export const orchestratorToolExtensionPaths = [resolveBundledExtensionPath("mu-tools")];
|
|
33
25
|
/**
|
|
34
|
-
* Tool-only extension bundle for worker sessions
|
|
26
|
+
* Tool-only extension bundle for worker sessions.
|
|
35
27
|
*/
|
|
36
|
-
export const workerToolExtensionPaths = [resolveBundledExtensionPath("mu-
|
|
28
|
+
export const workerToolExtensionPaths = [resolveBundledExtensionPath("mu-tools")];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mu-operator —
|
|
2
|
+
* mu-operator — Operator-mode extension facade.
|
|
3
3
|
*
|
|
4
|
-
* Bundles
|
|
4
|
+
* Bundles operator extensions behind a single extension entry so
|
|
5
5
|
* pi-coding-agent shows one "[Extensions] mu-operator" line instead of many.
|
|
6
6
|
*/
|
|
7
7
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mu-operator —
|
|
2
|
+
* mu-operator — Operator-mode extension facade.
|
|
3
3
|
*
|
|
4
|
-
* Bundles
|
|
4
|
+
* Bundles operator extensions behind a single extension entry so
|
|
5
5
|
* pi-coding-agent shows one "[Extensions] mu-operator" line instead of many.
|
|
6
6
|
*/
|
|
7
7
|
import { brandingExtension } from "./branding.js";
|
|
8
8
|
import { eventLogExtension } from "./event-log.js";
|
|
9
|
-
import { muFullToolsExtension } from "./mu-full-tools.js";
|
|
10
9
|
import { operatorCommandExtension } from "./operator-command.js";
|
|
10
|
+
import { queryExtension } from "./query.js";
|
|
11
11
|
export function muOperatorExtension(pi) {
|
|
12
12
|
brandingExtension(pi);
|
|
13
|
-
|
|
13
|
+
queryExtension(pi);
|
|
14
14
|
eventLogExtension(pi);
|
|
15
15
|
operatorCommandExtension(pi);
|
|
16
16
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mu-serve —
|
|
2
|
+
* mu-serve — Serve-mode extension facade.
|
|
3
3
|
*
|
|
4
|
-
* Bundles
|
|
4
|
+
* Bundles serve extensions behind a single extension entry so
|
|
5
5
|
* pi-coding-agent shows one "[Extensions] mu-serve" line instead of many.
|
|
6
6
|
*/
|
|
7
7
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mu-serve.d.ts","sourceRoot":"","sources":["../../src/extensions/mu-serve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"mu-serve.d.ts","sourceRoot":"","sources":["../../src/extensions/mu-serve.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAMlE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,QAKhD;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* mu-serve —
|
|
2
|
+
* mu-serve — Serve-mode extension facade.
|
|
3
3
|
*
|
|
4
|
-
* Bundles
|
|
4
|
+
* Bundles serve extensions behind a single extension entry so
|
|
5
5
|
* pi-coding-agent shows one "[Extensions] mu-serve" line instead of many.
|
|
6
6
|
*/
|
|
7
7
|
import { brandingExtension } from "./branding.js";
|
|
8
|
-
import { serverToolsExtension } from "./server-tools.js";
|
|
9
8
|
import { eventLogExtension } from "./event-log.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { activitiesExtension } from "./activities.js";
|
|
13
|
-
import { heartbeatsExtension } from "./heartbeats.js";
|
|
14
|
-
import { cronExtension } from "./cron.js";
|
|
9
|
+
import { operatorCommandExtension } from "./operator-command.js";
|
|
10
|
+
import { queryExtension } from "./query.js";
|
|
15
11
|
export function muServeExtension(pi) {
|
|
16
12
|
brandingExtension(pi);
|
|
17
|
-
|
|
13
|
+
queryExtension(pi);
|
|
18
14
|
eventLogExtension(pi);
|
|
19
|
-
|
|
20
|
-
orchestrationRunsExtension(pi);
|
|
21
|
-
activitiesExtension(pi);
|
|
22
|
-
heartbeatsExtension(pi);
|
|
23
|
-
cronExtension(pi);
|
|
15
|
+
operatorCommandExtension(pi);
|
|
24
16
|
}
|
|
25
17
|
export default muServeExtension;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mu-tools — Tool-only extension bundle for non-interactive roles.
|
|
3
|
+
*
|
|
4
|
+
* Registers `query` (read) and `command` (mutation).
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
export declare function muToolsExtension(pi: ExtensionAPI): void;
|
|
8
|
+
export default muToolsExtension;
|
|
9
|
+
//# sourceMappingURL=mu-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mu-tools.d.ts","sourceRoot":"","sources":["../../src/extensions/mu-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAIlE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,QAGhD;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mu-tools — Tool-only extension bundle for non-interactive roles.
|
|
3
|
+
*
|
|
4
|
+
* Registers `query` (read) and `command` (mutation).
|
|
5
|
+
*/
|
|
6
|
+
import { operatorCommandExtension } from "./operator-command.js";
|
|
7
|
+
import { queryExtension } from "./query.js";
|
|
8
|
+
export function muToolsExtension(pi) {
|
|
9
|
+
queryExtension(pi);
|
|
10
|
+
operatorCommandExtension(pi);
|
|
11
|
+
}
|
|
12
|
+
export default muToolsExtension;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* command — Approved mutation tool.
|
|
3
3
|
*
|
|
4
4
|
* Single execution path:
|
|
5
5
|
* - Requires MU_SERVER_URL.
|
|
6
6
|
* - Always POSTs to /api/commands/submit.
|
|
7
|
-
*
|
|
8
|
-
* All command validation/execution must route through the server command pipeline.
|
|
7
|
+
* - Supports mutation-capable command kinds only.
|
|
9
8
|
*/
|
|
10
9
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
11
|
-
export declare const
|
|
10
|
+
export declare const COMMAND_TOOL_NAME = "command";
|
|
12
11
|
export declare function operatorCommandExtension(pi: ExtensionAPI): void;
|
|
13
12
|
export default operatorCommandExtension;
|
|
14
13
|
//# sourceMappingURL=operator-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator-command.d.ts","sourceRoot":"","sources":["../../src/extensions/operator-command.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"operator-command.d.ts","sourceRoot":"","sources":["../../src/extensions/operator-command.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,eAAO,MAAM,iBAAiB,YAAY,CAAC;AA2H3C,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,YAAY,QA6FxD;AAED,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,102 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* command — Approved mutation tool.
|
|
3
3
|
*
|
|
4
4
|
* Single execution path:
|
|
5
5
|
* - Requires MU_SERVER_URL.
|
|
6
6
|
* - Always POSTs to /api/commands/submit.
|
|
7
|
-
*
|
|
8
|
-
* All command validation/execution must route through the server command pipeline.
|
|
7
|
+
* - Supports mutation-capable command kinds only.
|
|
9
8
|
*/
|
|
10
9
|
import { StringEnum } from "@mariozechner/pi-ai";
|
|
11
10
|
import { Type } from "@sinclair/typebox";
|
|
12
|
-
export const
|
|
13
|
-
const READONLY_COMMAND_KINDS = new Set([
|
|
14
|
-
"status",
|
|
15
|
-
"ready",
|
|
16
|
-
"issue_list",
|
|
17
|
-
"issue_get",
|
|
18
|
-
"forum_read",
|
|
19
|
-
"run_list",
|
|
20
|
-
"run_status",
|
|
21
|
-
]);
|
|
22
|
-
function trimOrNull(value) {
|
|
23
|
-
if (value == null)
|
|
24
|
-
return null;
|
|
25
|
-
const trimmed = value.trim();
|
|
26
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
27
|
-
}
|
|
28
|
-
function normalizedLimit(value, fallback, min, max) {
|
|
29
|
-
if (value == null || !Number.isFinite(value)) {
|
|
30
|
-
return fallback;
|
|
31
|
-
}
|
|
32
|
-
return Math.max(min, Math.min(max, Math.trunc(value)));
|
|
33
|
-
}
|
|
34
|
-
async function fetchReadOnlyMirror(serverUrl, params) {
|
|
35
|
-
if (!READONLY_COMMAND_KINDS.has(params.kind)) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const base = serverUrl.replace(/\/+$/, "");
|
|
39
|
-
const limit = normalizedLimit(params.limit, 20, 1, 200);
|
|
40
|
-
let path = null;
|
|
41
|
-
switch (params.kind) {
|
|
42
|
-
case "status":
|
|
43
|
-
path = "/api/status";
|
|
44
|
-
break;
|
|
45
|
-
case "ready":
|
|
46
|
-
path = `/api/issues/ready?limit=${limit}`;
|
|
47
|
-
break;
|
|
48
|
-
case "issue_list":
|
|
49
|
-
path = `/api/issues?status=open&limit=${limit}`;
|
|
50
|
-
break;
|
|
51
|
-
case "issue_get": {
|
|
52
|
-
const issueId = trimOrNull(params.issue_id);
|
|
53
|
-
if (!issueId)
|
|
54
|
-
return { error: "issue_id is required for issue_get mirror fetch" };
|
|
55
|
-
path = `/api/issues/${encodeURIComponent(issueId)}`;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case "forum_read": {
|
|
59
|
-
const topic = trimOrNull(params.topic);
|
|
60
|
-
if (!topic)
|
|
61
|
-
return { error: "topic is required for forum_read mirror fetch" };
|
|
62
|
-
path = `/api/forum/read?topic=${encodeURIComponent(topic)}&limit=${limit}`;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case "run_list":
|
|
66
|
-
path = `/api/runs?limit=${limit}`;
|
|
67
|
-
break;
|
|
68
|
-
case "run_status": {
|
|
69
|
-
const rootIssueId = trimOrNull(params.root_issue_id);
|
|
70
|
-
if (!rootIssueId)
|
|
71
|
-
return { error: "root_issue_id is required for run_status mirror fetch" };
|
|
72
|
-
path = `/api/runs/${encodeURIComponent(rootIssueId)}`;
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
default:
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
if (!path) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
try {
|
|
82
|
-
const response = await fetch(`${base}${path}`);
|
|
83
|
-
const raw = await response.text();
|
|
84
|
-
let payload;
|
|
85
|
-
try {
|
|
86
|
-
payload = JSON.parse(raw);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
payload = raw;
|
|
90
|
-
}
|
|
91
|
-
if (!response.ok) {
|
|
92
|
-
return { error: `mirror fetch failed (${response.status})`, path, payload };
|
|
93
|
-
}
|
|
94
|
-
return payload;
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
return { error: err instanceof Error ? err.message : String(err), path };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
11
|
+
export const COMMAND_TOOL_NAME = "command";
|
|
100
12
|
async function executeViaServer(serverUrl, params) {
|
|
101
13
|
const url = `${serverUrl.replace(/\/+$/, "")}/api/commands/submit`;
|
|
102
14
|
const response = await fetch(url, {
|
|
@@ -149,7 +61,6 @@ async function executeViaServer(serverUrl, params) {
|
|
|
149
61
|
const result = body.result;
|
|
150
62
|
const resultKind = typeof result?.kind === "string" ? result.kind : "unknown";
|
|
151
63
|
let summary;
|
|
152
|
-
let readResult = null;
|
|
153
64
|
if (resultKind === "completed" || resultKind === "awaiting_confirmation") {
|
|
154
65
|
const command = result?.command;
|
|
155
66
|
summary = `Command ${resultKind}: ${params.kind}`;
|
|
@@ -159,12 +70,6 @@ async function executeViaServer(serverUrl, params) {
|
|
|
159
70
|
if (resultKind === "completed" && command?.result) {
|
|
160
71
|
summary += `\n${JSON.stringify(command.result, null, 2)}`;
|
|
161
72
|
}
|
|
162
|
-
if (resultKind === "completed" && READONLY_COMMAND_KINDS.has(params.kind)) {
|
|
163
|
-
readResult = await fetchReadOnlyMirror(serverUrl, params);
|
|
164
|
-
if (readResult != null) {
|
|
165
|
-
summary += `\n${JSON.stringify({ query_result: readResult }, null, 2)}`;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
73
|
}
|
|
169
74
|
else if (resultKind === "denied" || resultKind === "invalid" || resultKind === "failed") {
|
|
170
75
|
const reason = result?.reason ?? "unknown";
|
|
@@ -175,40 +80,78 @@ async function executeViaServer(serverUrl, params) {
|
|
|
175
80
|
}
|
|
176
81
|
return {
|
|
177
82
|
content: [{ type: "text", text: summary }],
|
|
178
|
-
details: { kind: params.kind, pipeline_result: result
|
|
83
|
+
details: { kind: params.kind, pipeline_result: result },
|
|
179
84
|
};
|
|
180
85
|
}
|
|
181
86
|
export function operatorCommandExtension(pi) {
|
|
182
87
|
const CommandParams = Type.Object({
|
|
183
88
|
kind: StringEnum([
|
|
184
|
-
"status",
|
|
185
|
-
"ready",
|
|
186
|
-
"issue_list",
|
|
187
|
-
"issue_get",
|
|
188
|
-
"forum_read",
|
|
189
|
-
"run_list",
|
|
190
|
-
"run_status",
|
|
191
89
|
"run_start",
|
|
192
90
|
"run_resume",
|
|
193
91
|
"run_interrupt",
|
|
194
92
|
"reload",
|
|
195
93
|
"update",
|
|
94
|
+
"issue_create",
|
|
95
|
+
"issue_update",
|
|
96
|
+
"issue_claim",
|
|
97
|
+
"issue_open",
|
|
98
|
+
"issue_close",
|
|
99
|
+
"issue_dep",
|
|
100
|
+
"issue_undep",
|
|
101
|
+
"forum_post",
|
|
102
|
+
"heartbeat_create",
|
|
103
|
+
"heartbeat_update",
|
|
104
|
+
"heartbeat_delete",
|
|
105
|
+
"heartbeat_trigger",
|
|
106
|
+
"heartbeat_enable",
|
|
107
|
+
"heartbeat_disable",
|
|
108
|
+
"cron_create",
|
|
109
|
+
"cron_update",
|
|
110
|
+
"cron_delete",
|
|
111
|
+
"cron_trigger",
|
|
112
|
+
"cron_enable",
|
|
113
|
+
"cron_disable",
|
|
196
114
|
]),
|
|
197
115
|
prompt: Type.Optional(Type.String({ description: "Prompt for run_start" })),
|
|
198
|
-
|
|
199
|
-
topic: Type.Optional(Type.String({ description: "Topic for forum_read" })),
|
|
200
|
-
limit: Type.Optional(Type.Number({ description: "Limit for forum_read / run_resume" })),
|
|
201
|
-
root_issue_id: Type.Optional(Type.String({ description: "Root issue ID for run_status / run_resume / run_interrupt" })),
|
|
116
|
+
root_issue_id: Type.Optional(Type.String({ description: "Root issue ID for run_resume / run_interrupt" })),
|
|
202
117
|
max_steps: Type.Optional(Type.Number({ description: "Max steps for run_start / run_resume" })),
|
|
118
|
+
id: Type.Optional(Type.String({ description: "Issue ID for issue_update/issue_claim/issue_open/issue_close" })),
|
|
119
|
+
title: Type.Optional(Type.String({ description: "Issue title for issue_create" })),
|
|
120
|
+
body: Type.Optional(Type.String({ description: "Issue/forum body text (issue_create, issue_update, forum_post)" })),
|
|
121
|
+
topic: Type.Optional(Type.String({ description: "Forum topic for forum_post" })),
|
|
122
|
+
author: Type.Optional(Type.String({ description: "Forum author for forum_post (default: operator)" })),
|
|
123
|
+
tags: Type.Optional(Type.String({ description: "Comma-separated tags for issue_create/issue_update" })),
|
|
124
|
+
add_tags: Type.Optional(Type.String({ description: "Comma-separated tags to add for issue_update" })),
|
|
125
|
+
remove_tags: Type.Optional(Type.String({ description: "Comma-separated tags to remove for issue_update" })),
|
|
126
|
+
priority: Type.Optional(Type.Number({ description: "Issue priority for issue_create/issue_update" })),
|
|
127
|
+
status: Type.Optional(Type.String({ description: "Issue status for issue_update" })),
|
|
128
|
+
outcome: Type.Optional(Type.String({ description: "Outcome for issue_update/issue_close" })),
|
|
129
|
+
parent_id: Type.Optional(Type.String({ description: "Optional parent issue id for issue_create" })),
|
|
130
|
+
src_id: Type.Optional(Type.String({ description: "Source issue id for issue_dep/issue_undep" })),
|
|
131
|
+
dst_id: Type.Optional(Type.String({ description: "Destination issue id for issue_dep/issue_undep" })),
|
|
132
|
+
dep_type: Type.Optional(Type.String({ description: "Dependency type: blocks|parent" })),
|
|
133
|
+
program_id: Type.Optional(Type.String({ description: "Program ID for heartbeat/cron update|delete|trigger|enable|disable" })),
|
|
134
|
+
target_kind: Type.Optional(Type.String({ description: "Program target kind: run|activity" })),
|
|
135
|
+
run_job_id: Type.Optional(Type.String({ description: "Run target job ID for heartbeat/cron program mutations" })),
|
|
136
|
+
run_root_issue_id: Type.Optional(Type.String({ description: "Run target root issue ID for heartbeat/cron program mutations" })),
|
|
137
|
+
activity_id: Type.Optional(Type.String({ description: "Activity target ID for heartbeat/cron program mutations" })),
|
|
138
|
+
every_ms: Type.Optional(Type.Number({ description: "Heartbeat interval ms, or cron every schedule interval ms" })),
|
|
139
|
+
reason: Type.Optional(Type.String({ description: "Heartbeat/cron execution reason" })),
|
|
140
|
+
wake_mode: Type.Optional(Type.String({ description: "Wake mode for run targets: immediate|next_heartbeat" })),
|
|
141
|
+
enabled: Type.Optional(Type.Boolean({ description: "Program enabled state" })),
|
|
142
|
+
schedule_kind: Type.Optional(Type.String({ description: "Cron schedule kind: at|every|cron" })),
|
|
143
|
+
at_ms: Type.Optional(Type.Number({ description: "Cron one-shot timestamp epoch ms" })),
|
|
144
|
+
at: Type.Optional(Type.String({ description: "Cron one-shot timestamp ISO-8601" })),
|
|
145
|
+
anchor_ms: Type.Optional(Type.Number({ description: "Cron every schedule anchor epoch ms" })),
|
|
146
|
+
expr: Type.Optional(Type.String({ description: "Cron expression (5-field)" })),
|
|
147
|
+
tz: Type.Optional(Type.String({ description: "Cron expression timezone (IANA)" })),
|
|
203
148
|
});
|
|
204
149
|
pi.registerTool({
|
|
205
|
-
name:
|
|
150
|
+
name: COMMAND_TOOL_NAME,
|
|
206
151
|
label: "Command",
|
|
207
152
|
description: [
|
|
208
|
-
"
|
|
209
|
-
"
|
|
210
|
-
"Read-only queries (status, issue_list, etc.) can also be proposed here.",
|
|
211
|
-
"The command will be validated and executed through the control-plane pipeline.",
|
|
153
|
+
"Execute approved mutation commands through the command API.",
|
|
154
|
+
"Supports run lifecycle, control-plane lifecycle, issue/forum mutations, and heartbeat/cron program management.",
|
|
212
155
|
].join(" "),
|
|
213
156
|
parameters: CommandParams,
|
|
214
157
|
async execute(_toolCallId, params) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/extensions/query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA8GlE,wBAAgB,cAAc,CAAC,EAAE,EAAE,YAAY,QAiT9C;AAED,eAAe,cAAc,CAAC"}
|