@shigar/muaz 0.2.0 → 0.4.0

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
@@ -32,10 +32,8 @@ the installer.
32
32
  npm install -g @shigar/muaz
33
33
  ```
34
34
 
35
- **From source**
35
+ **From source** (from a checkout of this repository)
36
36
  ```bash
37
- git clone https://github.com/shigar-dev/muaz
38
- cd muaz
39
37
  cargo build --release -p muaz
40
38
  cp target/release/muaz ~/.local/bin/ # or anywhere on $PATH
41
39
  ```
@@ -48,7 +46,7 @@ On first run, `muaz` bootstraps `~/.muaz/` with sensible defaults.
48
46
  export OPENAI_API_KEY=sk-...
49
47
 
50
48
  muaz chat # open the default (starter) agent
51
- muaz chat --agent coding # open the auto-sde coding agent
49
+ muaz chat --agent starter # pick an agent explicitly
52
50
  muaz chat --incognito # don't save the session to disk
53
51
  muaz chat --session <id> # resume a previous session
54
52
  ```
@@ -63,12 +61,13 @@ read-only defaults under `builtins/`:
63
61
 
64
62
  ```
65
63
  ~/.muaz/
66
- ├── config.yaml # global settings (default agent + provider, approval, telemetry)
67
- ├── providers.yaml # named provider profiles (model connections)
64
+ ├── config.yaml # global settings (default agent, tool access, web tools, telemetry)
65
+ ├── models.yaml # provider profiles + global default + per-agent bindings (one file)
68
66
  ├── plugins.yaml # per-plugin state (enabled / priority / trusted / source)
69
67
  ├── mcp.json # global MCP server registry
68
+ ├── secrets.json # chmod-600 API-key store (only when no OS keychain is available)
70
69
  ├── builtins/
71
- │ └── default/ # embedded read-only `default` agent (refreshed each start)
70
+ │ └── preset/ # embedded read-only `starter` agent + preset pipelines (refreshed each start)
72
71
  ├── plugins/
73
72
  │ ├── local/ # YOUR workspace
74
73
  │ │ ├── agents/ # agents you create
@@ -76,11 +75,11 @@ read-only defaults under `builtins/`:
76
75
  │ │ ├── pipelines/ # multi-agent pipeline definitions
77
76
  │ │ ├── prompts/
78
77
  │ │ └── commands/ # custom slash commands
79
- │ ├── coding/ # seeded example plugin (editable)
80
- │ └── <installed>/ # plugins you install
78
+ │ └── <installed>/ # plugins you install (e.g. auto-sde, the `coding` agent)
81
79
  ├── sessions/ # saved sessions + index.json
82
- ├── runtimes/ # on-demand Node.js / uv runtimes for MCP servers
83
- └── memory/ # reserved for future memory backends
80
+ ├── memory/ # cross-session notebooks: global.md, agents/, projects/
81
+ ├── audit/ # append-only security audit log (audit.jsonl)
82
+ └── runtimes/ # on-demand Node.js / uv runtimes for MCP servers
84
83
  ```
85
84
 
86
85
  ## Configuration
@@ -91,48 +90,77 @@ read-only defaults under `builtins/`:
91
90
  # The agent used when no --agent flag is passed
92
91
  default_agent: starter
93
92
 
94
- # Provider/model selection. default_provider names a profile from providers.yaml;
95
- # agent_providers overrides specific agents. See "Providers" below.
96
- default_provider: gemini-main
97
- agent_providers:
93
+ # Provider/model selection lives in models.yaml (see below), not here.
94
+
95
+ # Plugin registries for `muaz plugins install <name>` / `search`, consulted in
96
+ # order (first hit wins). Omit the block to use the official muaz registry.
97
+ # Each registry carries its OWN signing keys, so an internal one is trusted for
98
+ # its own plugins only.
99
+ # plugin_registries:
100
+ # - name: acme-internal
101
+ # index_url: "https://plugins.acme.internal/index.json"
102
+ # trusted_keys: ["RW<your minisign public key>"]
103
+ # require_signed: true # an invalid signature is always fatal
104
+ # # allow_plaintext: true # only for an http:// intranet host you control
105
+
106
+ # Global tool access — one level per tool (off | ask | auto). Per-agent `tools:`
107
+ # blocks override these; `blocked` forces a tool Off everywhere.
108
+ tools:
109
+ default: ask
110
+ built_in:
111
+ read_file: auto
112
+ list_dir: auto
113
+ search: auto
114
+ edit_file: ask
115
+ write_file: ask
116
+ patch_file: ask
117
+ shell: ask
118
+ fetch_webpage: ask
119
+ web_search: ask
120
+ blocked: []
121
+ ```
122
+
123
+ ### Models (`~/.muaz/models.yaml`)
124
+
125
+ Everything about model routing lives in one file: named connection `profiles`, the
126
+ global `default`, and per-agent `agents` overrides. Agents are provider-agnostic,
127
+ so this is the single place models are chosen. It is re-read on every resolution,
128
+ so edits take effect without a restart.
129
+
130
+ ```yaml
131
+ profiles:
132
+ gemini-main:
133
+ type: gemini
134
+ default_model: gemini-2.5-pro
135
+ api_key: ${GEMINI_API_KEY}
136
+ bedrock-work:
137
+ type: bedrock
138
+ region: us-east-1
139
+ default_model: anthropic.claude-3-5-sonnet-20241022-v2:0
140
+ profile: work
141
+
142
+ # Global default: every agent that isn't bound below uses this profile.
143
+ default: gemini-main
144
+
145
+ # Per-agent overrides (agent name, or @plugin/agent), with an optional model swap.
146
+ agents:
98
147
  coding:
99
148
  profile: bedrock-work
100
-
101
- # Override the remote plugin registry index (else $MUAZ_PLUGIN_REGISTRY, else default)
102
- # plugin_registry: "https://example.com/muaz-plugins/index.json"
103
-
104
- # Global tool approval policy (per-agent settings override these)
105
- tool_approval:
106
- auto_approve:
107
- - "fetch_webpage:*" # always approve without prompting
108
- auto_deny:
109
- - "shell:rm -rf *" # always deny without prompting
110
- prompt:
111
- - "shell:*" # ask the user every time
112
- - "edit_file:*"
113
- - "patch_file:*"
114
149
  ```
115
150
 
116
- ### Provider profiles (`~/.muaz/providers.yaml`)
117
-
118
- Agents are model-agnostic. Define named provider profiles once and bind them via
119
- `default_provider` / `agent_providers` above:
120
-
121
- ```yaml
122
- gemini-main:
123
- type: gemini
124
- model: gemini-2.5-pro
125
- api_key: ${GEMINI_API_KEY}
126
-
127
- bedrock-work:
128
- type: bedrock
129
- region: us-east-1
130
- model: anthropic.claude-3-5-sonnet-20241022-v2:0
131
- profile: work
132
- ```
151
+ Effective provider for an agent resolves as: per-agent binding under `agents:` →
152
+ the global `default:` → error. Manage it with `muaz models list/set/default/bind`
153
+ or by editing the file.
133
154
 
134
- Effective provider for an agent resolves as: per-agent override → `default_provider`
135
- → the agent's own inline `provider:` block → error.
155
+ Keep the `api_key: ${OPENAI_API_KEY}` reference and store the actual key with muaz
156
+ instead of exporting it: run `muaz auth [profile]` (hidden input) — or `/auth
157
+ [profile]` inside a chat session — or use the browser UI's **Providers** page.
158
+ Use `muaz auth` for the first-run case: when a profile's key is unset the REPL
159
+ can't start (provider resolution fails on the missing `${VAR}`), so authenticate
160
+ from the CLI first. Keys go to your OS keychain (chmod-600 `~/.muaz/secrets.json`
161
+ fallback); `${VAR}` resolves from the store first, then the environment. If a
162
+ turn fails auth (401/403), the REPL prints a `/auth` hint and the UI shows an
163
+ inline "set your API key" banner.
136
164
 
137
165
  ### MCP registry (`~/.muaz/mcp.json`)
138
166
 
@@ -159,12 +187,8 @@ MCP server definitions live in their own JSON file. Use `muaz mcp install` to ma
159
187
  name: coding
160
188
  description: "An expert coding assistant"
161
189
 
162
- # Provider is OPTIONAL — omit it to stay model-agnostic and use the global
163
- # default profile. Include it only to pin a model for this agent:
164
- # provider:
165
- # type: openai-compatible
166
- # model: gpt-4o
167
- # api_key: "${OPENAI_API_KEY}" # ${ENV_VAR} interpolation supported
190
+ # No provider/model here — agents are provider-agnostic. The model is chosen in
191
+ # ~/.muaz/models.yaml (global `default` plus optional per-agent overrides).
168
192
 
169
193
  # system_prompt: path (~/…, /…, ./…, ../…) OR inline text. Co-locate and use a
170
194
  # relative path so the agent is portable across namespaces.
@@ -196,39 +220,38 @@ compaction_summary_prompt: ~
196
220
  # allow: [] # allowlist by name
197
221
  # deny: [] # denylist by name
198
222
 
199
- # Restrict to a subset of built-in tools
200
- built_in_tools:
201
- include_tools:
202
- - edit_file
203
- - shell
204
- - fetch_webpage
205
-
206
- # MCP server filter for this agent
207
- mcp_servers:
208
- - name: filesystem
209
-
210
- # Per-agent tool approval (evaluated before global policy)
211
- tool_approval:
212
- auto_approve:
213
- - "fetch_webpage:*"
214
- - "shell:git *"
215
- - "shell:cargo *"
216
- prompt:
217
- - "shell:*"
218
- - "edit_file:*"
219
- auto_deny:
220
- - "shell:rm *"
221
- ```
222
-
223
- **Approval pattern format:** `"tool_name:glob"` where the glob is matched against the JSON-serialised args. `*` matches everything. Examples:
224
-
225
- | Pattern | Matches |
226
- |---|---|
227
- | `fetch_webpage:*` | any `fetch_webpage` call |
228
- | `shell:*git*` | shell commands containing `git` |
229
- | `shell:rm -rf *` | exact prefix match |
230
-
231
- **Resolution order:** session-approved → agent auto_approve → agent auto_deny → global auto_approve → global auto_deny → interactive prompt.
223
+ # Hard local-egress lock: `none` strips web tools + drops HTTP MCP (default: full)
224
+ network: full
225
+
226
+ # Tool access: one level per tool (off | ask | auto). Overrides the global
227
+ # config.yaml `tools:` defaults; the most specific setting wins. Setting a tool
228
+ # `off` removes it from the agent's toolset.
229
+ tools:
230
+ default: ask
231
+ built_in:
232
+ edit_file: ask
233
+ fetch_webpage: auto
234
+ shell: # stay at ask, but auto-approve read-only git/cargo
235
+ level: ask
236
+ allow_when:
237
+ - "program=git"
238
+ - "program=cargo"
239
+ # MCP servers are opt-in: an agent attaches one by listing it here.
240
+ servers:
241
+ filesystem:
242
+ default: ask
243
+ ```
244
+
245
+ **Access levels:** `off` (removed from the toolset), `ask` (every call prompts),
246
+ `auto` (runs without prompting). A tool value is a bare level or
247
+ `{ level, allow_when }`, where `allow_when` auto-approves specific calls:
248
+ `program=NAME` (first shell token), `dir=PATH` (path containment), or a glob over
249
+ the primary argument.
250
+
251
+ **Resolution order (most specific wins):** global `tools.blocked` → agent per-tool
252
+ → agent per-server default → agent `tools.default` → global `tools.built_in.<tool>`
253
+ → global `tools.default`. A session grant or a matching `allow_when` lets an
254
+ otherwise-`ask` call through without re-prompting.
232
255
 
233
256
  At the interactive prompt:
234
257
  - `a` — approve once
@@ -295,14 +318,19 @@ Commands:
295
318
  agents Manage agents
296
319
  skills Manage Agent Skills
297
320
  plugins Install and manage plugins (agents, skills, pipelines, prompts)
321
+ models Provider profiles, the global default, and per-agent bindings
322
+ auth Store a provider profile's API key securely (hidden prompt)
298
323
  config View and edit global configuration
299
324
  mcp Manage MCP server registrations
300
325
  runtime Manage bundled MCP runtimes (Node.js, uv)
326
+ audit Inspect the append-only security audit log
301
327
  gateway Start the web server with browser UI
302
328
  doctor Diagnose config, runtimes, and MCP server health
303
329
  ```
304
330
 
305
- Running bare `muaz` (no subcommand) starts interactive chat with the default agent.
331
+ Running bare `muaz` (no subcommand) starts the gateway on `127.0.0.1:7878` and
332
+ opens the browser UI — the primary surface. Over SSH or without a tty it prints
333
+ the URL instead. `muaz chat` is the terminal surface.
306
334
 
307
335
  ### `muaz chat`
308
336
 
@@ -400,7 +428,7 @@ Commands:
400
428
 
401
429
  ### `muaz plugins`
402
430
 
403
- Install and manage [plugins](https://shigar.co.uk/muaz/docs/concepts/plugins/) —
431
+ Install and manage [plugins](https://shigar.dev/muaz/docs/concepts/plugins/) —
404
432
  bundles of agents, skills, pipelines, and prompts.
405
433
 
406
434
  ```
@@ -408,19 +436,43 @@ muaz plugins <COMMAND>
408
436
 
409
437
  Commands:
410
438
  install <target> Install from a local .zip path, or by registry name (name@version)
411
- search <query> Search the remote registry
439
+ search <query> Search the configured registries
440
+ update [id] Apply available updates (--check to only report them)
412
441
  list List installed plugins (enabled/disabled, trusted) + built-ins
413
442
  show <id> Show a plugin's manifest and contents
414
443
  enable <id> Enable a disabled plugin
415
444
  disable <id> Disable a plugin without uninstalling it
445
+ trust <id> Honour its skill tool pre-approvals and run its hooks
446
+ untrust <id> Revoke that, without uninstalling
416
447
  uninstall <id> Uninstall a plugin (deletes its directory)
417
448
 
449
+ Authoring:
450
+ pack <dir> Build the reproducible .zip a registry publishes (--json for CI)
451
+ verify <zip> Check a .zip the way an install will: sha256, manifest, signature
452
+
453
+ Registries:
454
+ registries What muaz has recorded per registry (index serial, signing)
455
+ forget-registry <name>
456
+ Reset that record, so a lower serial is accepted again
457
+
418
458
  Options (install):
419
459
  --force Overwrite an existing plugin with the same id
460
+ --registry <name> Install only from this configured registry
461
+ --allow-unsigned Take a plugin the registry serves unsigned (CLI only —
462
+ the browser UI never offers it)
420
463
  ```
421
464
 
422
- Provider profiles have no dedicated subcommand — edit `~/.muaz/providers.yaml` and
423
- `muaz config edit`, or use the browser UI's Providers page.
465
+ A plugin from a registry is verified against **that registry's** trusted keys.
466
+ An unsigned one is refused under the default `require_signed: true`, and an
467
+ invalid signature is always fatal — `--allow-unsigned` says "unsigned is
468
+ acceptable here", never "forgeries are". Updates are re-fetched only from the
469
+ registry a plugin was installed from, and trust does not survive an update that
470
+ adds capabilities: the digest recorded when you trusted it is re-checked, and a
471
+ mismatch revokes trust rather than running the new `post_update` hook.
472
+
473
+ Manage provider profiles and bindings with `muaz models`
474
+ (`list`/`set`/`set-model`/`default`/`bind`/`unbind`/`remove`), by editing
475
+ `~/.muaz/models.yaml` directly, or from the browser UI's Providers + Agents pages.
424
476
 
425
477
  ### `muaz config`
426
478
 
@@ -463,6 +515,21 @@ Commands:
463
515
  clean Remove all downloaded runtimes
464
516
  ```
465
517
 
518
+ ### `muaz audit`
519
+
520
+ The append-only security log at `~/.muaz/audit/audit.jsonl` (chmod 600): tool
521
+ executions, secret changes, plugin/config/connector changes, plugin hook runs,
522
+ and gateway auth failures. It records *what happened*, never values — tool
523
+ arguments are stored as a SHA-256 hash and secret events carry only the name.
524
+
525
+ ```
526
+ muaz audit <COMMAND>
527
+
528
+ Commands:
529
+ tail [--count N] [--json] Show the most recent events
530
+ export Print the whole log (raw JSON Lines) to stdout
531
+ ```
532
+
466
533
  ## Slash commands
467
534
 
468
535
  | Command | Description |
@@ -478,13 +545,15 @@ Commands:
478
545
  | `/pipelines` | List pipelines in your local workspace |
479
546
  | `/skills` | List available Agent Skills |
480
547
  | `/skill <name>` | Show the body of a skill's SKILL.md |
548
+ | `/auth [profile]` | Store a provider profile's API key (hidden input) |
481
549
  | `/incognito` | Toggle incognito mode (session not saved) |
482
550
  | `/compact` | Summarize and compact conversation history now |
483
551
  | `/usage` | Show token and latency stats for this session |
484
552
  | `/clear` | Start a fresh session (old transcript stays saved) |
485
553
  | `/exit` | Exit muaz |
486
554
 
487
- Custom commands defined in `~/.muaz/commands/<name>.yaml` also appear in `/help`.
555
+ Custom commands defined in `~/.muaz/plugins/local/commands/<name>.yaml` also
556
+ appear in `/help`.
488
557
 
489
558
  ## Built-in tools
490
559
 
@@ -550,62 +619,75 @@ From within the REPL:
550
619
 
551
620
  ## Pipelines
552
621
 
553
- Pipelines wire multiple agents together for complex workflows. Define them as YAML files in `~/.muaz/plugins/local/pipelines/` and run with `/run <name> [input]`.
622
+ Pipelines wire multiple agents together for complex workflows. Define them as YAML files in `~/.muaz/plugins/local/pipelines/`, then run them with `/run <name> [input]` in the REPL or `muaz pipeline run <name> [input]` from the shell.
623
+
624
+ A pipeline is a single ordered list of **`steps`**. There is no `pattern` field — sequential, parallel, and router flows are all expressed with steps.
554
625
 
555
- ### Sequential pipeline
626
+ ### Sequential
556
627
 
557
- Each agent's output becomes the next agent's input.
628
+ Each step names itself, so later steps can read its output.
558
629
 
559
630
  ```yaml
560
- # ~/.muaz/plugins/local/pipelines/research-and-write.yaml
561
- name: research-and-write
562
- pattern: sequential
631
+ # ~/.muaz/plugins/local/pipelines/research-write.yaml
632
+ name: research-write
563
633
  steps:
564
- - agent: researcher # resolved across namespaces (local, plugins, built-ins)
565
- pass: last_message # pass only the last output (default)
566
- - agent: writer
567
- pass: full_history # prepend all prior step I/O as context
634
+ - name: research
635
+ agent: researcher # resolved across namespaces; @plugin/name disambiguates
636
+ input: "Research this topic:\n\n${input}"
637
+ retry: { max: 1, backoff_secs: 2 }
638
+ - name: write
639
+ agent: writer
640
+ input: |
641
+ Write the piece requested below from these notes.
642
+
643
+ Request: ${input}
644
+ Notes: ${steps.research.output}
568
645
  ```
569
646
 
570
- `pass` modes:
571
- - `last_message` — the previous agent's response becomes the next agent's input (default)
572
- - `full_history` — all prior step inputs and outputs are prepended as context
647
+ Templates resolve `${input}`, `${vars.<name>}`, `${steps.<name>.output}`, and `${steps.<name>.<field>}`. An unknown placeholder is a hard error, so a typo fails at load rather than silently interpolating nothing.
573
648
 
574
- ### Parallel pipeline
649
+ ### Parallel
575
650
 
576
- All agents run concurrently with the same input. Results are merged with per-agent section headers.
651
+ A step may be a `parallel:` group whose members run concurrently:
577
652
 
578
653
  ```yaml
579
- name: multi-review
580
- pattern: parallel
581
- agents:
582
- - reviewer-a
583
- - reviewer-b
584
- - reviewer-c
585
- merge: concat # default; 'summary' will be added in a future release
654
+ steps:
655
+ - name: reviews
656
+ parallel:
657
+ - name: security
658
+ agent: security-reviewer
659
+ input: "${input}"
660
+ - name: style
661
+ agent: style-reviewer
662
+ input: "${input}"
663
+ - name: summary
664
+ agent: editor
665
+ input: "Security:\n${steps.security.output}\n\nStyle:\n${steps.style.output}"
586
666
  ```
587
667
 
588
- ### Router pipeline
668
+ ### Router
589
669
 
590
- A router agent reads the input and returns a JSON routing decision. The message is then forwarded to the selected downstream agent.
670
+ A router is a step whose `output_schema` carries a `route` field; specialists gate on it with `when:`. The route is typed structured output, not free text scanned out of a reply.
591
671
 
592
672
  ```yaml
593
- name: smart-dispatch
594
- pattern: router
595
- router_agent: dispatcher # must be a fast, cheap model (e.g. gpt-4o-mini)
596
- routes:
597
- coding: coding-agent # key → agent name
598
- research: research-agent
599
- default: default-agent # fallback if no route matches
600
- ```
601
-
602
- The router agent automatically receives routing instructions appended to its system prompt and is expected to reply with:
603
-
604
- ```json
605
- {"route": "coding", "message": "Fix the authentication bug"}
606
- ```
607
-
608
- If the response cannot be parsed, the input is forwarded to the `default` route.
673
+ name: triage
674
+ steps:
675
+ - name: route
676
+ agent: triage-router
677
+ output_schema:
678
+ type: object
679
+ properties:
680
+ route: { type: string, enum: [write, analyze] }
681
+ message: { type: string }
682
+ required: [route, message]
683
+ additionalProperties: false
684
+ - name: write
685
+ agent: writer
686
+ when: { value: "${steps.route.route}", equals: write }
687
+ input: "${steps.route.message}"
688
+ ```
689
+
690
+ Steps also take `on_error: fail | continue | fallback` and a `budget:` (`max_cost_usd`, `max_tokens`, `max_seconds`), which the pipeline as a whole accepts too.
609
691
 
610
692
  ## Custom slash commands
611
693
 
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "hasInstallScript": true,
20
20
  "name": "@shigar/muaz",
21
- "version": "0.2.0"
21
+ "version": "0.4.0"
22
22
  },
23
23
  "node_modules/detect-libc": {
24
24
  "engines": {
@@ -47,5 +47,5 @@
47
47
  }
48
48
  },
49
49
  "requires": true,
50
- "version": "0.2.0"
50
+ "version": "0.4.0"
51
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "artifactDownloadUrls": [
3
- "https://github.com/shigar-dev/releases-muaz/releases/download/v0.2.0"
3
+ "https://github.com/shigar-dev/releases-muaz/releases/download/v0.4.0"
4
4
  ],
5
5
  "author": "shigar ltd",
6
6
  "bin": {
@@ -81,7 +81,7 @@
81
81
  "zipExt": ".tar.xz"
82
82
  }
83
83
  },
84
- "version": "0.2.0",
84
+ "version": "0.4.0",
85
85
  "volta": {
86
86
  "node": "18.14.1",
87
87
  "npm": "9.5.0"