@agimon-ai/doompi 0.0.1-alpha.28 → 0.0.1-alpha.29

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.
Files changed (48) hide show
  1. package/README.md +186 -79
  2. package/dist/bin/doomRunner.cjs +1 -1
  3. package/dist/bin/doomRunner.cjs.map +1 -1
  4. package/dist/bin/doomRunner.d.cts +13 -1
  5. package/dist/bin/doomRunner.d.cts.map +1 -0
  6. package/dist/bin/doomRunner.d.mts +13 -1
  7. package/dist/bin/doomRunner.d.mts.map +1 -0
  8. package/dist/bin/doomRunner.mjs +1 -1
  9. package/dist/bin/doomRunner.mjs.map +1 -1
  10. package/dist/src/adapters/composer.cjs +1 -1
  11. package/dist/src/adapters/composer.mjs +1 -1
  12. package/dist/src/adapters/harnessContext.cjs +1 -1
  13. package/dist/src/adapters/harnessContext.cjs.map +1 -1
  14. package/dist/src/adapters/harnessContext.mjs +1 -1
  15. package/dist/src/adapters/harnessContext.mjs.map +1 -1
  16. package/dist/src/commands/buildCommand.cjs +2 -2
  17. package/dist/src/commands/buildCommand.mjs +2 -2
  18. package/dist/src/commands/cli/cliApp.cjs +1 -1
  19. package/dist/src/commands/cli/cliApp.cjs.map +1 -1
  20. package/dist/src/commands/cli/cliApp.d.cts.map +1 -1
  21. package/dist/src/commands/cli/cliApp.d.mts.map +1 -1
  22. package/dist/src/commands/cli/cliApp.mjs +1 -1
  23. package/dist/src/commands/cli/cliApp.mjs.map +1 -1
  24. package/dist/src/commands/syncCommand.cjs +6 -5
  25. package/dist/src/commands/syncCommand.cjs.map +1 -1
  26. package/dist/src/commands/syncCommand.d.cts.map +1 -1
  27. package/dist/src/commands/syncCommand.d.mts.map +1 -1
  28. package/dist/src/commands/syncCommand.mjs +5 -4
  29. package/dist/src/commands/syncCommand.mjs.map +1 -1
  30. package/dist/src/extensions/entries/modeCatalog.cjs +1 -1
  31. package/dist/src/extensions/entries/modeCatalog.cjs.map +1 -1
  32. package/dist/src/extensions/entries/modeCatalog.d.cts.map +1 -1
  33. package/dist/src/extensions/entries/modeCatalog.d.mts.map +1 -1
  34. package/dist/src/extensions/entries/modeCatalog.mjs +1 -1
  35. package/dist/src/extensions/entries/modeCatalog.mjs.map +1 -1
  36. package/dist/src/services/extensionAssembler.cjs +1 -1
  37. package/dist/src/services/extensionAssembler.cjs.map +1 -1
  38. package/dist/src/services/extensionAssembler.d.cts +4 -1
  39. package/dist/src/services/extensionAssembler.d.cts.map +1 -1
  40. package/dist/src/services/extensionAssembler.d.mts +4 -1
  41. package/dist/src/services/extensionAssembler.d.mts.map +1 -1
  42. package/dist/src/services/extensionAssembler.mjs +1 -1
  43. package/dist/src/services/extensionAssembler.mjs.map +1 -1
  44. package/llms.txt +12 -0
  45. package/package.json +16 -28
  46. package/src/prompts/doompi-author-extension/SKILL.md +32 -0
  47. package/src/prompts/doompi-author-extension/references/extension-contract.md +180 -0
  48. package/docs/architecture.md +0 -162
package/README.md CHANGED
@@ -6,23 +6,32 @@
6
6
  > wakes up with database tools, browser controls, and their small novel of schemas. This
7
7
  > is our config.
8
8
 
9
- DoomPi is an opinionated, composable distribution of [Pi](https://github.com/earendil-works/pi). It is closer
10
- in spirit to Spacemacs, Doom Emacs, or a curated Neovim setup than to a single plugin. It is tailored
11
- for people whose agent has one MCP server too many. It turns extensions, skills,
12
- MCP servers, and system prompts into config instead of background noise.
9
+ DoomPi is an opinionated, composable distribution of
10
+ [Pi](https://github.com/earendil-works/pi). It is closer in spirit to Spacemacs, Doom Emacs, or a
11
+ curated Neovim setup than to a single plugin. It is tailored for people whose agent has one MCP
12
+ server too many. It turns extensions, skills, MCP servers, and system prompts into config instead
13
+ of background noise.
13
14
 
14
15
  ![DoomPi terminal interface showing tasks, Plan mode, and the Leader menu](https://cdn.jsdelivr.net/npm/@agimon-ai/doompi@latest/assets/doompi-tui.png)
15
16
 
16
- Plugin systems scope what an agent knows. Nothing scopes what it can reach. Claude Code's
17
- `enableAllProjectMcpServers` and static denylist are repository-wide. DoomPi draws that
18
- boundary around the session. Pick a major mode and some domains; add a profile if you want
19
- one. Four YAML files decide what loads; `doompi --explain` tells you what got in, why, and
20
- what it costs before launch.
17
+ Plugin systems scope what an agent knows. They do less to scope which configured plugins and MCP
18
+ servers a particular session can load. Claude Code's `enableAllProjectMcpServers` and static
19
+ denylist are repository-wide. DoomPi draws that loading boundary around the session. Pick a major
20
+ mode and some domains; add a profile if you want one. Four YAML files decide what loads;
21
+ `doompi --explain` tells you what got in, why, and what it costs before launch.
21
22
 
22
23
  It borrows its shape from [Doom Emacs Core](https://github.com/doomemacs/core): quick to
23
24
  start, close to Pi, opinionated where defaults help, and easy to pull apart when they do
24
25
  not. Use it as-is, build your own config on top, or raid it for parts.
25
26
 
27
+ ## Contents
28
+
29
+ [Install](#install) · [Try DoomPi](#try-doompi-without-replacing-your-pi-setup) ·
30
+ [Philosophy](#philosophy) · [What this buys you](#what-this-buys-you) · [Features](#features) ·
31
+ [Configuration](#configuration) · [Trust and data boundaries](#trust-and-data-boundaries) ·
32
+ [CLI reference](#cli-reference) · [Troubleshooting](#troubleshooting-and-direct-use) ·
33
+ [Architecture](#architecture) · [Development](#development)
34
+
26
35
  ## Install
27
36
 
28
37
  ```bash
@@ -31,9 +40,13 @@ npm install -g @agimon-ai/doompi
31
40
 
32
41
  The package pins and installs the upstream Pi version used by `dpi`.
33
42
 
43
+ The root package contains the fixed host foundation only. Feature packages are selected by
44
+ `.doom/modes.yaml` and installed into the consumer repository when they are first needed.
45
+
34
46
  ## Status and requirements
35
47
 
36
- DoomPi is alpha software. Configuration and package boundaries may still change between alpha releases.
48
+ DoomPi is alpha software. Configuration and package boundaries may still change between alpha
49
+ releases.
37
50
 
38
51
  - Node.js 22.19.0 or newer
39
52
  - macOS or Linux on arm64 or x64 for the bundled Runner backend
@@ -55,8 +68,10 @@ pi # run your existing Pi setup for comp
55
68
  `.doom/profiles.yaml` in the current repository. It preserves existing files unless you pass
56
69
  `--force` and does not create or change `.pi/settings.json`.
57
70
 
58
- `dpi sync` writes DoomPi's generated state, package alias, and theme resource, but it does
59
- not register DoomPi in either normal Pi settings file.
71
+ `dpi sync` installs missing configured feature packages, writes DoomPi's generated state,
72
+ package alias, and theme resource, but it does not register DoomPi in either normal Pi
73
+ settings file. It prepares every declared layer so switching modes does not depend on the
74
+ root package's dependency closure.
60
75
 
61
76
  ### Sync storage and worktrees
62
77
 
@@ -78,12 +93,12 @@ doompi sync # register DoomPi in normal Pi sett
78
93
  pi # DoomPi now starts through the regular Pi command
79
94
  ```
80
95
 
81
- `doompi` remains available as an explicit harness when you want one-run matrix flags:
96
+ `doompi` remains available as an explicit harness when you want per-run matrix flags:
82
97
 
83
98
  ```bash
84
- doompi --major-mode dev --domains development
85
- doompi --domains marketing --profile marketing
86
- doompi --domains analytics --explain
99
+ doompi --major-mode copilot --no-domains
100
+ doompi --major-mode minimal --no-domains
101
+ doompi --major-mode copilot --no-domains --explain
87
102
  ```
88
103
 
89
104
  ## Philosophy
@@ -98,7 +113,7 @@ A major mode is the base config. It names the extension layers for development,
98
113
  or whatever else you do. Define as many as you like; only one is active at a time, and you
99
114
  can switch it without leaving the session.
100
115
 
101
- Minor modes are battery-included switches inside that base. They start off, stack freely,
116
+ Minor modes are batteries-included switches inside that base. They start off, stack freely,
102
117
  and keep their model tools and skills out of context until turned on. DoomPi ships six:
103
118
 
104
119
  - **Help mode:** expose package-owned guidance only while you need it.
@@ -110,10 +125,10 @@ and keep their model tools and skills out of context until turned on. DoomPi shi
110
125
 
111
126
  ### Domains
112
127
 
113
- A domain is a named group of Pi plugins. It carries the skills and MCP servers for one
128
+ A domain is a named group of agent plugins. It carries the skills and MCP servers for one
114
129
  kind of work, and `/domains` switches it while the session is running.
115
130
 
116
- Plugins are catalogued once and domains refer to their names. A configured root may be a
131
+ Plugins are cataloged once and domains refer to their names. A configured root may be a
117
132
  Codex-compatible marketplace or a folder whose direct children are plugins, so a repository
118
133
  with many plugins does not need one entry per directory:
119
134
 
@@ -194,8 +209,8 @@ Together they can dispatch structured jobs from one live session.
194
209
  #### Workflows
195
210
 
196
211
  GitHub Actions already has a decent vocabulary for long jobs, so DoomPi reuses it. Each job
197
- declares the DoomPi session it wants. Here, implementation gets coding tools; the release
198
- note waits for it and gets marketing context plus a brand voice:
212
+ declares the DoomPi session it wants. Here, implementation gets development tools; an
213
+ article waits for it and gets focused blog-writing context:
199
214
 
200
215
  ```yaml
201
216
  on:
@@ -209,22 +224,77 @@ jobs:
209
224
  timeout-minutes: 180
210
225
  interactiveRun:
211
226
  default: |
212
- doompi --major-mode dev --domains development --auto-stop \
227
+ doompi --major-mode examples --domains development --auto-stop \
213
228
  --cwd "$PWD" "$JOB_SYSTEM_PROMPT"
214
229
 
215
- release-note:
230
+ article:
216
231
  runs-on: ubuntu-latest
217
232
  needs: implement
218
233
  steps:
219
- - name: Write the release note
234
+ - name: Write the article
220
235
  timeout-minutes: 30
221
236
  interactiveRun:
222
237
  default: |
223
- doompi --major-mode marketing --domains marketing \
224
- --profile brand-voice --auto-stop \
238
+ doompi --major-mode examples --domains blog --auto-stop \
225
239
  --cwd "$PWD" "$JOB_SYSTEM_PROMPT"
226
240
  ```
227
241
 
242
+ #### Native plugin and workflow examples
243
+
244
+ This source repository includes a complete, deliberately small example stack:
245
+
246
+ ```text
247
+ plugins/
248
+ development/ implementation skill and developer agent
249
+ testing/ testing and review skills, tester and reviewer agents
250
+ blog-writing/ research, outline, drafting, and editorial skills and agents
251
+ automations/workflows/
252
+ dev-feature.workflow.yml
253
+ dev-fix.workflow.yml
254
+ blog-writing.workflow.yml
255
+ ```
256
+
257
+ Each plugin has both `.codex-plugin/plugin.json` and `.claude-plugin/plugin.json`, while its
258
+ `skills/` and `agents/` content is shared. `.doom/domains.yaml` exposes the `development`,
259
+ `testing`, and `blog` domains plus the `engineering` alias. `.doom/modes.yaml` mirrors the
260
+ standalone package set with workspace-local paths, keeps its canonical modes, and adds a layer-free
261
+ `examples` base mode for the tracked workflows. Inspect the exact session before launch:
262
+
263
+ ```bash
264
+ doompi --major-mode examples --domains engineering --explain
265
+ doompi --major-mode examples --domains blog --explain
266
+ ```
267
+
268
+ The same bundles can be installed directly through either native marketplace:
269
+
270
+ ```bash
271
+ # Codex
272
+ codex plugin marketplace add .
273
+ codex plugin add development@doompi-examples
274
+
275
+ # Claude Code
276
+ claude plugin marketplace add ./ --scope user
277
+ claude plugin install development@doompi-examples --scope user
278
+ ```
279
+
280
+ Substitute `testing` or `blog-writing` to install another bundle. No DoomPi-specific plugin
281
+ schema is involved.
282
+
283
+ List and dry-run the tracked workflows before spending a model call:
284
+
285
+ ```bash
286
+ pnpm exec workflow-mcp list-workflows automations/workflows
287
+ pnpm exec workflow-mcp run-workflow automations/workflows/dev-feature.workflow.yml \
288
+ --dry-run --skip-launch --prompt "Add a health check"
289
+ pnpm exec workflow-mcp run-workflow automations/workflows/blog-writing.workflow.yml \
290
+ --dry-run --skip-launch --prompt "Write a practical guide to scoped agent tooling"
291
+ ```
292
+
293
+ Real runs delegate to tmux by default and accept `WORKFLOW_LAUNCHER=cmux`. Development runs do
294
+ not create branches, commits, or pushes. Blog runs leave review-ready Markdown, sources, and a
295
+ publication checklist in the workflow run directory without writing into a site or calling a CMS.
296
+ These examples live in the source repository and are not part of the published npm tarball.
297
+
228
298
  #### Loop
229
299
 
230
300
  Workflow definitions are exposed like skills, so the agent can choose one for the job. A
@@ -233,24 +303,32 @@ it. One session becomes the dispatcher instead of the place every job has to fit
233
303
 
234
304
  ## Features
235
305
 
236
- DoomPi is a distribution, not one giant extension. Each package owns one job; shared TUI
237
- and session contracts make them behave like one. Use the generated `default.packages` list
238
- together, or replace its entries one at a time.
306
+ DoomPi is a distribution, not one giant extension. Each package owns one job; shared TUI,
307
+ Cordis services, and session contracts make them behave like one. Use the generated
308
+ `default.packages` list together, remove packages you do not want, or replace its entries one
309
+ at a time. Selectable packages are not runtime dependencies of the root package or of one another.
239
310
 
240
311
  ### Foundation and interface
241
312
 
242
313
  #### Configuration and composition
243
314
 
244
- [`@agimon-ai/doompi`][pkg-doompi] is both an extension and the command-line config compiler. `dpi init`
245
- creates repository config for an isolated experiment, while `doompi init` creates the personal
246
- config and registers the permanent Pi integration. The sync commands resolve every major mode and domain into a distribution Pi can load quickly.
315
+ [`@agimon-ai/doompi`][pkg-doompi] is both an extension and the command-line config compiler.
316
+ `dpi init` creates repository config for an isolated experiment, while `doompi init` creates the
317
+ personal config and registers the permanent Pi integration. The sync commands resolve every major
318
+ mode and domain into a distribution Pi can load quickly.
247
319
 
248
320
  #### Supporting packages
249
321
 
250
322
  [`@agimon-ai/doompi-config`][pkg-doompi-config] resolves the four YAML files and exposes the
251
323
  configuration API. [`@agimon-ai/doompi-domain`][pkg-doompi-domain] owns domain selection, plugin
252
- materialization, resource staging, and MCP scoping. [`@agimon-ai/doompi-extension-contracts`][pkg-doompi-extension-contracts]
253
- contains the shared Cordis service and event contracts used by extension authors.
324
+ materialization, resource staging, and MCP scoping.
325
+ [`@agimon-ai/doompi-extension-contracts`][pkg-doompi-extension-contracts] contains the shared
326
+ Cordis service and event contracts used by extension authors.
327
+ [`@agimon-ai/doompi-hashline`][pkg-doompi-hashline] provides the shared snapshot tags and line-anchor
328
+ protocol. [`@agimon-ai/doompi-read`][pkg-doompi-read] and [`@agimon-ai/doompi-grep`][pkg-doompi-grep]
329
+ produce editable anchors for writable files while preserving Pi's native output for non-writable files.
330
+ [`@agimon-ai/doompi-edit`][pkg-doompi-edit] replaces Pi's search-and-replace `edit` tool with
331
+ stale-safe ranges anchored to the file content the model read or searched.
254
332
  [`@agimon-ai/doompi-file-edit`][pkg-doompi-file-edit] opens files in the configured editor and
255
333
  keeps the edit timeline. [`@agimon-ai/doompi-log`][pkg-doompi-log] collects session events, while
256
334
  [`@agimon-ai/doompi-telemetry`][pkg-doompi-telemetry] is the library-level telemetry adapter.
@@ -312,26 +390,29 @@ being embedded as special snapshots in the compact summary.
312
390
 
313
391
  #### Help mode
314
392
 
315
- [`@agimon-ai/doompi-help`][pkg-doompi-help] keeps package guidance out of the default prompt. A fresh parent
316
- session performs no Help retrieval and exposes no Help skills. Use `SPC h e`, or the existing
317
- `minor_mode` client in headless sessions, to activate the package indexes; use the same action
318
- to deactivate them before the next interaction. The initial contributors expose
319
- `doompi-help`, `workflow-help`, and `doompi-config-help`. Parent and detached-child sessions both
320
- include the Help runtime, while its guidance stays withdrawn until Help mode is activated.
393
+ [`@agimon-ai/doompi-help`][pkg-doompi-help] keeps package guidance out of the default prompt. A
394
+ fresh parent session performs no Help retrieval and exposes no Help skills. Use `SPC h e`, or the
395
+ existing `minor_mode` client in headless sessions, to activate the package indexes; use the same
396
+ action to deactivate them before the next interaction. Help names state their intent: authoring
397
+ guides use `doompi-author-*`, while operational guides use `doompi-use-*`. Core authoring guidance
398
+ covers extensions, runtime config, major modes, domains, profiles, hooks, workflows, and skills.
399
+ Parent and detached-child sessions both include the Help runtime, while root and axis authoring
400
+ guides remain parent-owned and all guidance stays withdrawn until Help mode is activated.
321
401
 
322
402
  #### MCP
323
403
 
324
- [`@agimon-ai/doompi-mcp`][pkg-doompi-mcp] is the gate between a session and its servers. It reads repository
325
- and legacy plugin `.mcp.json` plus Agent Plugins v1 `mcp.json`, then exposes only the servers and
326
- proxy upstreams allowed by the selected domains. A domain switch persists an immutable projection;
327
- after Pi replaces the factories, Config publishes it through the session Cordis registry and MCP
328
- starts a fresh in-memory `mcp-proxy` container. No Hono server or localhost proxy sits in this path.
404
+ [`@agimon-ai/doompi-mcp`][pkg-doompi-mcp] is the gate between a session and its servers. It reads
405
+ repository and legacy plugin `.mcp.json` plus Agent Plugins v1 `mcp.json`, then exposes only the
406
+ servers and proxy upstreams allowed by the selected domains. A domain switch persists an immutable
407
+ projection; after Pi replaces the factories, Config publishes it through the session Cordis
408
+ registry and MCP starts a fresh in-memory `mcp-proxy` container. No Hono server or localhost proxy
409
+ sits in this path.
329
410
 
330
411
  #### Ask user question
331
412
 
332
- [`@agimon-ai/doompi-user-feedback`][pkg-doompi-user-feedback] gives the agent a structured question that actually
333
- waits for an answer. In autonomous Voice mode it skips the modal, narrates the choices,
334
- and accepts the next spoken response as an ordinary user message.
413
+ [`@agimon-ai/doompi-user-feedback`][pkg-doompi-user-feedback] gives the agent a structured question
414
+ that actually waits for an answer. In autonomous Voice mode it skips the modal, narrates the
415
+ choices, and accepts the next spoken response as an ordinary user message.
335
416
 
336
417
  #### Logging and telemetry
337
418
 
@@ -346,39 +427,39 @@ configured.
346
427
 
347
428
  A promise to "only plan" is not a permission boundary. [`@agimon-ai/doompi-plan`][pkg-doompi-plan]
348
429
  removes Pi's `edit` and `write` tools while the agent explores, persists the plan, and hands it back
349
- for approval. It does not sandbox Bash, external tools, or the operating system. Use `SPC p p` for normal planning, `SPC p d` for debug planning, `SPC p f` for
350
- the Fable flow, and `SPC p e` to exit. Turn it on when the approach should be settled
351
- before the files move.
430
+ for approval. It does not sandbox Bash, external tools, or the operating system. Use `SPC p p` for
431
+ normal planning, `SPC p d` for debug planning, `SPC p f` for the Fable flow, and `SPC p e` to exit.
432
+ Turn it on when the approach should be settled before the files move.
352
433
 
353
434
  #### Loop mode
354
435
 
355
- [`@agimon-ai/doompi-loop`][pkg-doompi-loop] is an in-session scheduler. It runs a prompt immediately and then
356
- repeats it on an interval; several loops can coexist. Use `SPC l s` to start one and
357
- `SPC l l` to list or stop them. It is for recurring checks and prompts that belong to the
358
- current session.
436
+ [`@agimon-ai/doompi-loop`][pkg-doompi-loop] is an in-session scheduler. It runs a prompt immediately
437
+ and then repeats it on an interval; several loops can coexist. Use `SPC l s` to start one and
438
+ `SPC l l` to list or stop them. It is for recurring checks and prompts that belong to the current
439
+ session.
359
440
 
360
441
  #### Goal mode
361
442
 
362
- [`@agimon-ai/doompi-goal`][pkg-doompi-goal] pins one objective to the session until it completes or you end
363
- it. Use `SPC g g` for status, `SPC g s` to start, `SPC g e` to end, and `SPC g p` for
364
- history. Finished goals leave the prompt and tools behind but remain in history when you
365
- want to restart one.
443
+ [`@agimon-ai/doompi-goal`][pkg-doompi-goal] pins one objective to the session until it completes or
444
+ you end it. Use `SPC g g` for status, `SPC g s` to start, `SPC g e` to end, and `SPC g p` for
445
+ history. Finished goals stop contributing active instructions and tools but remain in history when
446
+ you want to restart one.
366
447
 
367
448
  #### Workflow mode
368
449
 
369
- [`@agimon-ai/doompi-workflow`][pkg-doompi-workflow] runs GitHub Actions-style job graphs with dependencies,
370
- timeouts, artifacts, and a separate DoomPi session for each step. Use `SPC w w` to launch,
371
- `SPC w l` to manage, `SPC w r` to recover a failed run, and `SPC w e` to give the agent
372
- workflow tools or take them back. It is for work that needs hard job boundaries and
373
- explicit handoffs rather than one long conversation.
450
+ [`@agimon-ai/doompi-workflow`][pkg-doompi-workflow] runs GitHub Actions-style job graphs with
451
+ dependencies, timeouts, artifacts, and a separate DoomPi session for each step. Use `SPC w w` to
452
+ launch, `SPC w l` to manage, `SPC w r` to recover a failed run, and `SPC w e` to give the agent
453
+ workflow tools or take them back. It is for work that needs hard job boundaries and explicit
454
+ handoffs rather than one long conversation.
374
455
 
375
456
  #### Voice mode
376
457
 
377
- [`@agimon-ai/doompi-voice`][pkg-doompi-voice] captures PCM audio through the local platform helper and
378
- can transcribe it locally. Transcript text, session state, and model requests may still cross process
379
- or provider boundaries according to the configured engines. `SPC v v` is one-shot manual dictation and never enables Voice tools. `SPC v a`
380
- toggles autonomous capture; only its exact-active TUI session receives the two Voice
381
- façades plus the standalone `narrate` tool.
458
+ [`@agimon-ai/doompi-voice`][pkg-doompi-voice] captures PCM audio through the local platform helper
459
+ and can transcribe it locally. Transcript text, session state, and model requests may still cross
460
+ process or provider boundaries according to the configured engines. `SPC v v` is one-shot manual
461
+ dictation and never enables Voice tools. `SPC v a` toggles autonomous capture; only its exact-active
462
+ TUI session receives the two Voice façades plus the standalone `narrate` tool.
382
463
 
383
464
  While `narrate` is available, the primary agent calls it before every user-facing final
384
465
  response. One concise spoken answer is enough for a short conversation or clarification;
@@ -420,6 +501,12 @@ DoomPi adds no default feature packages. Use `default.packages: []` for an expli
420
501
  baseline. The fixed host core remains active independently of this setting, and named layers
421
502
  keep their existing behavior.
422
503
 
504
+ Launch installs missing required packages from the defaults and selected layers. `doompi sync`
505
+ installs missing required packages from the defaults and every declared layer, then builds the
506
+ synchronized matrix. `doompi sync --check` reports missing packages without modifying the
507
+ repository. Optional packages and local paths are not installed automatically. Removing an
508
+ entry stops activating it but leaves Pi's package cache available for later reuse.
509
+
423
510
  Packages in `default` and named layers may be bare strings, or mappings when the package accepts
424
511
  configuration:
425
512
 
@@ -431,6 +518,9 @@ default:
431
518
  - '@agimon-ai/doompi-goal'
432
519
  - '@agimon-ai/doompi-voice'
433
520
  - '@agimon-ai/doompi-runner'
521
+ - '@agimon-ai/doompi-read'
522
+ - '@agimon-ai/doompi-grep'
523
+ - '@agimon-ai/doompi-edit'
434
524
  - '@agimon-ai/doompi-file-edit'
435
525
  - '@agimon-ai/doompi-autocompact'
436
526
  - '@agimon-ai/doompi-loop'
@@ -468,12 +558,16 @@ composition, not a mystery bag of shared configuration. Home and repository `lay
468
558
  sources declare `default`, the repository block replaces the personal block as one whole package
469
559
  list.
470
560
 
561
+ Configurations created before the hashline tools were split may contain only `doompi-edit`.
562
+ Replace that entry with the ordered `doompi-read`, `doompi-grep`, and `doompi-edit` trio. Init
563
+ preserves existing configuration unless it is run with `--force`.
564
+
471
565
  Choose a mode with `--major-mode copilot`, switch it with `/mode`, or change
472
566
  `defaultMajorMode` when one mode should be the ordinary starting point.
473
567
 
474
568
  ### `domains.yaml`: choose content and access
475
569
 
476
- Plugins are catalogued once, then domains refer to their names. A root can be a marketplace,
570
+ Plugins are cataloged once, then domains refer to their names. A root can be a marketplace,
477
571
  a single plugin, or a container whose direct-child folders are plugins. Discovery is
478
572
  intentionally nonrecursive: a tool buried five directories down should not load by accident.
479
573
 
@@ -598,26 +692,34 @@ its owning package's controls; values supplied by callers are not automatically
598
692
 
599
693
  ## Troubleshooting and direct use
600
694
 
601
- - Run `doompi sync --check` to detect drift and `doompi sync` to rebuild synchronized state.
695
+ - Run `doompi sync --check` to detect drift or missing configured packages, and `doompi sync`
696
+ to install them and rebuild synchronized state.
602
697
  - If RMUX is unavailable on a supported target, Runner reports the fallback it uses. Linux native
603
698
  artifacts require a compatible loader and libc environment.
604
699
  - Leader menus and overlays require Pi's interactive TUI. Commands and tools remain the interface
605
700
  for JSON, RPC, and other headless sessions where the owning package supports them.
606
701
  - Install a directly loaded Pi subsystem with `pi install npm:@agimon-ai/<package>`. Library consumers
607
702
  use `npm install`; native RMUX artifacts are selected by Runner and should not be installed directly.
608
- The distribution remains the supported way to get the coordinated defaults.
703
+ The root `doom-runner` command delegates to Runner from the active repository and asks you to add
704
+ Runner to `modes.yaml` when it is absent. The distribution remains the supported way to get the
705
+ coordinated defaults.
609
706
 
610
707
  ## Architecture
611
708
 
612
- See [Architecture](docs/architecture.md) for standard Pi package composition, canonical fingerprints, transition classification, synchronized bundles, shared-host Cordis lifecycle ownership, and parent/child isolation.
709
+ See [Architecture](https://github.com/AgiFlow/doompi/blob/main/docs/architecture.md) for standard Pi
710
+ package composition, canonical fingerprints, transition classification, synchronized bundles,
711
+ shared-host Cordis lifecycle ownership, and parent/child isolation.
613
712
 
614
713
  ## Development
615
714
 
616
715
  ```bash
617
- nx build @agimon-ai/doompi
618
- nx test @agimon-ai/doompi
619
- nx typecheck @agimon-ai/doompi
620
- nx lint @agimon-ai/doompi
716
+ pnpm install
717
+ pnpm build
718
+ pnpm examples:check
719
+ pnpm nx build @agimon-ai/doompi
720
+ pnpm nx test @agimon-ai/doompi
721
+ pnpm nx typecheck @agimon-ai/doompi
722
+ pnpm nx lint @agimon-ai/doompi
621
723
  ```
622
724
 
623
725
  DoomPi is maintained by [Agimon](https://agimon.ai/about).
@@ -626,9 +728,10 @@ DoomPi is maintained by [Agimon](https://agimon.ai/about).
626
728
 
627
729
  MIT
628
730
 
629
- ## Package release order
731
+ ## Maintainer release order
630
732
 
631
- Publish [`@agimon-ai/doompi-extension-contracts`][pkg-doompi-extension-contracts] first, then
733
+ Publish [`@agimon-ai/doompi-extension-contracts`][pkg-doompi-extension-contracts] and
734
+ [`@agimon-ai/doompi-hashline`][pkg-doompi-hashline] first, then
632
735
  [`@agimon-ai/doompi-help`][pkg-doompi-help], and only then the
633
736
  [`@agimon-ai/doompi`][pkg-doompi] runtime that consumes them. Generated changelogs remain owned
634
737
  by the release tooling.
@@ -641,6 +744,10 @@ loaded extension graph inside the same release boundary as the packages that con
641
744
  [pkg-doompi-ui]: https://www.npmjs.com/package/@agimon-ai/doompi-ui
642
745
  [pkg-doompi-config]: https://www.npmjs.com/package/@agimon-ai/doompi-config
643
746
  [pkg-doompi-domain]: https://www.npmjs.com/package/@agimon-ai/doompi-domain
747
+ [pkg-doompi-hashline]: https://www.npmjs.com/package/@agimon-ai/doompi-hashline
748
+ [pkg-doompi-read]: https://www.npmjs.com/package/@agimon-ai/doompi-read
749
+ [pkg-doompi-grep]: https://www.npmjs.com/package/@agimon-ai/doompi-grep
750
+ [pkg-doompi-edit]: https://www.npmjs.com/package/@agimon-ai/doompi-edit
644
751
  [pkg-doompi-file-edit]: https://www.npmjs.com/package/@agimon-ai/doompi-file-edit
645
752
  [pkg-doompi-log]: https://www.npmjs.com/package/@agimon-ai/doompi-log
646
753
  [pkg-doompi-telemetry]: https://www.npmjs.com/package/@agimon-ai/doompi-telemetry
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- (0,require("@agimon-ai/doompi-runner/bin/cli").main)(process.argv.slice(2)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doom-runner] ${t}\n`),process.exitCode=1});
2
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../src/adapters/repository/repository.cjs"),t=require("../src/adapters/modules/moduleResolution.cjs");let n=require("node:url");const r=`@agimon-ai/doompi-runner/bin/cli`;async function i(i=process.argv.slice(2)){let a;try{a=e.findRepositoryRoot(process.cwd())}catch(e){throw Error(`doom-runner must be invoked inside a configured repository.`,{cause:e})}let o=t.consumerPackageEntry(r,a);if(!o)throw Error(`Doom Runner is not installed for this repository. Add @agimon-ai/doompi-runner to .doom/modes.yaml and run doompi sync.`);let s=await import((0,n.pathToFileURL)(o).href);if(typeof s.main!=`function`)throw Error(`${r} does not export a callable main function.`);return s.main(i)}process.argv[1]&&require("url").pathToFileURL(__filename).href===(0,n.pathToFileURL)(process.argv[1]).href&&i().then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doom-runner] ${t}\n`),process.exitCode=1}),exports.main=i;
3
3
  //# sourceMappingURL=doomRunner.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"doomRunner.cjs","names":["main"],"sources":["../../src/bin/doomRunner.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-runner\n *\n * The `doom-runner` binary lives in @agimon-ai/doompi-runner, but npm only\n * links a package's own bins. Installing doompi would therefore leave\n * doom-runner off PATH even though doompi depends on it and the packaged\n * doom-runner skill tells agents to call it by name. Re-declaring the bin here\n * is what makes `npm i -g @agimon-ai/doompi` install both executables.\n *\n * The runner's own entry only self-invokes when it is argv[1], which it is not\n * once this shim is the entry point, so main() is called explicitly.\n */\n\nimport { main } from '@agimon-ai/doompi-runner/bin/cli';\n\nmain(process.argv.slice(2)).then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doom-runner] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";CAiBAA,4CAAAA,CAAAA,CAAAA,KAAAA,CAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,KACzB,GAAa,CACZ,QAAQ,SAAW,CACrB,EACC,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACrE,QAAQ,OAAO,MAAM,iBAAiB,EAAQ,GAAG,EACjD,QAAQ,SAAW,CACrB,CACF"}
1
+ {"version":3,"file":"doomRunner.cjs","names":["findRepositoryRoot","consumerPackageEntry","pathToFileURL"],"sources":["../../src/bin/doomRunner.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-runner\n *\n * The Runner package is selectable, so this compatibility executable resolves\n * it from the active repository instead of retaining it in DoomPi's dependency\n * closure. The Runner package's own entry only self-invokes when it is argv[1],\n * which it is not once this shim imports it by absolute path.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { consumerPackageEntry } from '../adapters/modules/moduleResolution.ts';\nimport { findRepositoryRoot } from '../adapters/repository/repository.ts';\n\nconst RUNNER_CLI_EXPORT = '@agimon-ai/doompi-runner/bin/cli';\n\ninterface RunnerCliModule {\n readonly main?: unknown;\n}\n\nexport async function main(argv: readonly string[] = process.argv.slice(2)): Promise<number> {\n let repoRoot: string;\n try {\n repoRoot = findRepositoryRoot(process.cwd());\n } catch (error) {\n throw new Error('doom-runner must be invoked inside a configured repository.', { cause: error });\n }\n const entry = consumerPackageEntry(RUNNER_CLI_EXPORT, repoRoot);\n if (!entry) {\n throw new Error(\n 'Doom Runner is not installed for this repository. Add @agimon-ai/doompi-runner to .doom/modes.yaml and run doompi sync.',\n );\n }\n const loaded = (await import(pathToFileURL(entry).href)) as RunnerCliModule;\n if (typeof loaded.main !== 'function') {\n throw new Error(`${RUNNER_CLI_EXPORT} does not export a callable main function.`);\n }\n return (loaded.main as (args: readonly string[]) => Promise<number>)(argv);\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n main().then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doom-runner] ${message}\\n`);\n process.exitCode = 1;\n },\n );\n}\n"],"mappings":";oNAeA,MAAM,EAAoB,mCAM1B,eAAsB,EAAK,EAA0B,QAAQ,KAAK,MAAM,CAAC,EAAoB,CAC3F,IAAI,EACJ,GAAI,CACF,EAAWA,EAAAA,mBAAmB,QAAQ,IAAI,CAAC,CAC7C,OAAS,EAAO,CACd,MAAU,MAAM,8DAA+D,CAAE,MAAO,CAAM,CAAC,CACjG,CACA,IAAM,EAAQC,EAAAA,qBAAqB,EAAmB,CAAQ,EAC9D,GAAI,CAAC,EACH,MAAU,MACR,yHACF,EAEF,IAAM,EAAU,MAAM,QAAA,EAAOC,EAAAA,cAAAA,CAAc,CAAK,CAAC,CAAC,MAClD,GAAI,OAAO,EAAO,MAAS,WACzB,MAAU,MAAM,GAAG,EAAkB,2CAA2C,EAElF,OAAQ,EAAO,KAAsD,CAAI,CAC3E,CAEI,QAAQ,KAAK,IAAA,QAAA,KAAA,CAAA,CAAA,cAAA,UAAA,CAAA,CAAA,QAAA,EAA0BA,EAAAA,cAAAA,CAAc,QAAQ,KAAK,EAAE,CAAC,CAAC,MACxE,EAAK,CAAC,CAAC,KACJ,GAAa,CACZ,QAAQ,SAAW,CACrB,EACC,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACrE,QAAQ,OAAO,MAAM,iBAAiB,EAAQ,GAAG,EACjD,QAAQ,SAAW,CACrB,CACF"}
@@ -1 +1,13 @@
1
- export {}
1
+ //#region src/bin/doomRunner.d.ts
2
+ /**
3
+ * CLI Entry Point for doom-runner
4
+ *
5
+ * The Runner package is selectable, so this compatibility executable resolves
6
+ * it from the active repository instead of retaining it in DoomPi's dependency
7
+ * closure. The Runner package's own entry only self-invokes when it is argv[1],
8
+ * which it is not once this shim imports it by absolute path.
9
+ */
10
+ declare function main(argv?: readonly string[]): Promise<number>;
11
+ //#endregion
12
+ export { main };
13
+ //# sourceMappingURL=doomRunner.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doomRunner.d.cts","names":[],"sources":["../../src/bin/doomRunner.ts"],"mappings":";;;;;;;;;iBAqBsB,KAAK,2BAAkD"}
@@ -1 +1,13 @@
1
- export {}
1
+ //#region src/bin/doomRunner.d.ts
2
+ /**
3
+ * CLI Entry Point for doom-runner
4
+ *
5
+ * The Runner package is selectable, so this compatibility executable resolves
6
+ * it from the active repository instead of retaining it in DoomPi's dependency
7
+ * closure. The Runner package's own entry only self-invokes when it is argv[1],
8
+ * which it is not once this shim imports it by absolute path.
9
+ */
10
+ declare function main(argv?: readonly string[]): Promise<number>;
11
+ //#endregion
12
+ export { main };
13
+ //# sourceMappingURL=doomRunner.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doomRunner.d.mts","names":[],"sources":["../../src/bin/doomRunner.ts"],"mappings":";;;;;;;;;iBAqBsB,KAAK,2BAAkD"}
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{main as e}from"@agimon-ai/doompi-runner/bin/cli";e(process.argv.slice(2)).then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doom-runner] ${t}\n`),process.exitCode=1});export{};
2
+ import{findRepositoryRoot as e}from"../src/adapters/repository/repository.mjs";import{consumerPackageEntry as t}from"../src/adapters/modules/moduleResolution.mjs";import{pathToFileURL as n}from"node:url";const r=`@agimon-ai/doompi-runner/bin/cli`;async function i(i=process.argv.slice(2)){let a;try{a=e(process.cwd())}catch(e){throw Error(`doom-runner must be invoked inside a configured repository.`,{cause:e})}let o=t(r,a);if(!o)throw Error(`Doom Runner is not installed for this repository. Add @agimon-ai/doompi-runner to .doom/modes.yaml and run doompi sync.`);let s=await import(n(o).href);if(typeof s.main!=`function`)throw Error(`${r} does not export a callable main function.`);return s.main(i)}process.argv[1]&&import.meta.url===n(process.argv[1]).href&&i().then(e=>{process.exitCode=e},e=>{let t=e instanceof Error?e.message:String(e);process.stderr.write(`[doom-runner] ${t}\n`),process.exitCode=1});export{i as main};
3
3
  //# sourceMappingURL=doomRunner.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"doomRunner.mjs","names":[],"sources":["../../src/bin/doomRunner.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-runner\n *\n * The `doom-runner` binary lives in @agimon-ai/doompi-runner, but npm only\n * links a package's own bins. Installing doompi would therefore leave\n * doom-runner off PATH even though doompi depends on it and the packaged\n * doom-runner skill tells agents to call it by name. Re-declaring the bin here\n * is what makes `npm i -g @agimon-ai/doompi` install both executables.\n *\n * The runner's own entry only self-invokes when it is argv[1], which it is not\n * once this shim is the entry point, so main() is called explicitly.\n */\n\nimport { main } from '@agimon-ai/doompi-runner/bin/cli';\n\nmain(process.argv.slice(2)).then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doom-runner] ${message}\\n`);\n process.exitCode = 1;\n },\n);\n"],"mappings":";wDAiBA,EAAK,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,KACzB,GAAa,CACZ,QAAQ,SAAW,CACrB,EACC,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACrE,QAAQ,OAAO,MAAM,iBAAiB,EAAQ,GAAG,EACjD,QAAQ,SAAW,CACrB,CACF"}
1
+ {"version":3,"file":"doomRunner.mjs","names":[],"sources":["../../src/bin/doomRunner.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * CLI Entry Point for doom-runner\n *\n * The Runner package is selectable, so this compatibility executable resolves\n * it from the active repository instead of retaining it in DoomPi's dependency\n * closure. The Runner package's own entry only self-invokes when it is argv[1],\n * which it is not once this shim imports it by absolute path.\n */\n\nimport { pathToFileURL } from 'node:url';\nimport { consumerPackageEntry } from '../adapters/modules/moduleResolution.ts';\nimport { findRepositoryRoot } from '../adapters/repository/repository.ts';\n\nconst RUNNER_CLI_EXPORT = '@agimon-ai/doompi-runner/bin/cli';\n\ninterface RunnerCliModule {\n readonly main?: unknown;\n}\n\nexport async function main(argv: readonly string[] = process.argv.slice(2)): Promise<number> {\n let repoRoot: string;\n try {\n repoRoot = findRepositoryRoot(process.cwd());\n } catch (error) {\n throw new Error('doom-runner must be invoked inside a configured repository.', { cause: error });\n }\n const entry = consumerPackageEntry(RUNNER_CLI_EXPORT, repoRoot);\n if (!entry) {\n throw new Error(\n 'Doom Runner is not installed for this repository. Add @agimon-ai/doompi-runner to .doom/modes.yaml and run doompi sync.',\n );\n }\n const loaded = (await import(pathToFileURL(entry).href)) as RunnerCliModule;\n if (typeof loaded.main !== 'function') {\n throw new Error(`${RUNNER_CLI_EXPORT} does not export a callable main function.`);\n }\n return (loaded.main as (args: readonly string[]) => Promise<number>)(argv);\n}\n\nif (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {\n main().then(\n (exitCode) => {\n process.exitCode = exitCode;\n },\n (error: unknown) => {\n const message = error instanceof Error ? error.message : String(error);\n process.stderr.write(`[doom-runner] ${message}\\n`);\n process.exitCode = 1;\n },\n );\n}\n"],"mappings":";4MAeA,MAAM,EAAoB,mCAM1B,eAAsB,EAAK,EAA0B,QAAQ,KAAK,MAAM,CAAC,EAAoB,CAC3F,IAAI,EACJ,GAAI,CACF,EAAW,EAAmB,QAAQ,IAAI,CAAC,CAC7C,OAAS,EAAO,CACd,MAAU,MAAM,8DAA+D,CAAE,MAAO,CAAM,CAAC,CACjG,CACA,IAAM,EAAQ,EAAqB,EAAmB,CAAQ,EAC9D,GAAI,CAAC,EACH,MAAU,MACR,yHACF,EAEF,IAAM,EAAU,MAAM,OAAO,EAAc,CAAK,CAAC,CAAC,MAClD,GAAI,OAAO,EAAO,MAAS,WACzB,MAAU,MAAM,GAAG,EAAkB,2CAA2C,EAElF,OAAQ,EAAO,KAAsD,CAAI,CAC3E,CAEI,QAAQ,KAAK,IAAM,YAAY,MAAQ,EAAc,QAAQ,KAAK,EAAE,CAAC,CAAC,MACxE,EAAK,CAAC,CAAC,KACJ,GAAa,CACZ,QAAQ,SAAW,CACrB,EACC,GAAmB,CAClB,IAAM,EAAU,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACrE,QAAQ,OAAO,MAAM,iBAAiB,EAAQ,GAAG,EACjD,QAAQ,SAAW,CACrB,CACF"}
@@ -1,2 +1,2 @@
1
- const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../services/extensionAssembler.cjs"),n=require("./syncState.cjs"),r=require("./bootstrapLocator.cjs"),i=require("./config/harnessState.cjs"),a=require("./harnessContext.cjs"),o=require("./compositionState.cjs");let s=require("node:url"),c=require("@agimon-ai/doompi-extension-contracts/child-process"),l=require("node:path");l=e.__toESM(l,1);let u=require("node:fs");u=e.__toESM(u,1);let d=require("node:os");d=e.__toESM(d,1);let f=require("@agimon-ai/doompi-config/majorModes"),p=require("@agimon-ai/doompi-extension-contracts/cordis-host"),m=require("@agimon-ai/doompi-ui/extensionName"),h=require("@earendil-works/pi-coding-agent"),g=require("@agimon-ai/doompi-config/harnessStore");const _=`@agimon-ai/doompi-config/selectionSwitch`,v=`doompi is configured for Pi but this repository was never synced. Run doompi sync.`,y=`doompi could not read its synchronized state. Run doompi sync.`,b=process.env.DOOMPI_TIMING===`1`||process.env.PI_TIMING===`1`,x={majorMode:`major-mode`,domains:`domains`,profile:`profile`,mute:`mute`},S=`layer`;function C(e){return e instanceof Error?e.message:String(e)}function w(e){try{return u.default.realpathSync(e)}catch{return l.default.resolve(e)}}function T(e,t){let{extensions:n}=(0,h.parseArgs)(e);if(!n||n.length===0)return!1;let r=new Set(Object.values(t).map(w));return n.some(e=>r.has(w(e)))}async function E(e,t,n=process.env){let r=await A(t,n),a={...i.readHarnessState({...e.env,...n}),...e.fileState,mcpProjection:{...e.fileState.mcpProjection,stagingDirectory:r},temporaryDirectory:r};(0,g.createHarnessSession)(a,{directory:r,environment:n});for(let[e,t]of Object.entries(a.profileEnvironment))n[e]===void 0&&(n[e]=t);return a}function D(e){let{unknownFlags:t}=(0,h.parseArgs)(e),n=e=>{let n=t.get(e);return typeof n==`string`&&n.trim()?n.trim():void 0},r=n(x.domains);return{majorMode:n(x.majorMode),domains:r?.split(`,`).map(e=>e.trim()).filter(Boolean),profile:n(x.profile),mute:t.get(x.mute)!==void 0,removedLayer:t.get(S)!==void 0}}function O(e){e.registerFlag(x.majorMode,{type:`string`,description:`Named major mode from .doom/modes.yaml`}),e.registerFlag(x.domains,{type:`string`,description:`Comma-separated content domains`}),e.registerFlag(x.profile,{type:`string`,description:`Persona and env from .doom/profiles.yaml`}),e.registerFlag(x.mute,{type:`boolean`,description:`Disable the notification extension`})}async function k(e,t,n,r){if(e.removedLayer&&r.push(`--${S} was replaced by --${x.majorMode}`),e.majorMode)try{let{applyMajorMode:n}=await import(_);n(t,e.majorMode,i.getHarnessState())}catch(t){r.push(`--${x.majorMode} ${e.majorMode}: ${C(t)}`)}if(e.domains&&e.domains.length>0)try{let{applyDomains:t}=await import(`@agimon-ai/doompi-domain/apply`);await t(e.domains,i.getHarnessState())}catch(t){r.push(`--domains ${e.domains.join(`,`)}: ${C(t)}`)}if(e.profile)try{let[{applyProfile:t},{resolveProfile:r}]=await Promise.all([import(_),import(`@agimon-ai/doompi-config/profiles`)]);await t(r(n,e.profile),i.getHarnessState())}catch(t){r.push(`--profile ${e.profile}: ${C(t)}`)}}async function A(e,t=process.env){let r=n.runDirectory(e,process.pid,t.HOME??d.default.homedir());return await u.default.promises.mkdir(r,{mode:448,recursive:!0}),i.updateHarnessState({temporaryDirectory:r},t),r}async function j(e,t=process.env){await u.default.promises.rm(n.runDirectory(e,process.pid,t.HOME??d.default.homedir()),{recursive:!0,force:!0})}async function M(e,r=i.getHarnessState(),a=process.env){let s=r.root??e.root,c=n.createMapResolvers(e.resolved,e.compiled),u={agents:r.agents,autoStop:!1,preset:e.selection.preset,personaEntry:c.packageEntry(t.PERSONA_ENTRY),majorMode:r.majorMode,layers:[...r.layers],majorModesConfig:(0,f.loadMajorModesConfig)(s),resolvers:c},d=t.resolveExtensionComposition({...u,mute:a[o.MUTE_ENV]===`1`});a[p.DOOM_CORDIS_HOST_REQUIRED_ENV]=`1`,i.updateHarnessState({childExtensions:[...d.childActivation],compositionFingerprint:d.fingerprint},a),r.agents&&(a.PI_SUBAGENT_EXTRA_AGENT_DIRS=r.agentDirectories.join(l.default.delimiter),a.PI_SUBAGENT_EXTRA_SKILL_DIRS=r.skillDirectories.join(l.default.delimiter));let m=[...d.parentActivation],h=e.bundles?.[d.fingerprint];return{entries:h?[h]:m,fingerprint:d.fingerprint}}async function N(e,t=i.getHarnessState(),n=process.env){return(await M(e,t,n)).entries}async function P(e,t,n){let r=[];for(let i of t){let t=performance.now(),a;try{a=await import((0,s.pathToFileURL)(i).href),b&&process.stderr.write(`[doompi:timing] import ${(performance.now()-t).toFixed(1)}ms ${i}\n`)}catch(e){n.push(`${i}: ${C(e)}`);continue}if(typeof a.default!=`function`){n.push(`${i}: does not export an extension factory`);continue}let o=performance.now();try{await a.default((0,m.withExtensionSource)(e,i)),b&&process.stderr.write(`[doompi:timing] factory ${(performance.now()-o).toFixed(1)}ms ${i}\n`),r.push(i)}catch(e){n.push(`${i}: ${C(e)}`)}}return r}async function F(e,t={}){let i=t.environment??process.env,s=[],l=i.HOME??d.default.homedir(),u=r.findSyncedRoot(t.cwd??process.cwd(),l);if(!u)return{problems:[v],stale:!1,loaded:[]};let p;try{p=n.readSyncState(u,l)}catch(e){return{problems:[C(e)],stale:!1,loaded:[]}}if(!p)return{problems:[v],stale:!1,loaded:[]};let m=t.argv??process.argv.slice(2);if(i[o.EXTERNAL_EXTENSIONS_ENV]===`1`||T(m,{...p.resolved,...p.bundles}))return{problems:[],stale:!1,loaded:[]};if(a.configurePreset({preset:p.selection.preset,piArgs:[]},i),!(0,c.alreadyComposed)(i)){i[o.COMPOSED_ENV]=`1`,await E(p,u,i);let e=D(m);e.mute&&(i[o.MUTE_ENV]=`1`),await k(e,(0,f.loadMajorModesConfig)(u),u,s)}let h;try{h=await M(p,(0,g.loadHarnessState)(i).state,i)}catch(e){return{problems:[...s,C(e)],stale:!1,loaded:[]}}let _=p.bundles?.[h.fingerprint];if(_)try{let e=r.readBundleStatus(u,h.fingerprint,l);if(!e.fresh||e.bundle!==_)return{problems:[...s,y],stale:!1,loaded:[]}}catch{return{problems:[...s,y],stale:!1,loaded:[]}}let b=await P(e,h.entries,s);return{problems:s,stale:n.computeInputsHash(u,p.selection,l)!==p.inputsHash||(0,g.loadHarnessState)(i).state.majorMode===p.selection.majorMode&&h.fingerprint!==p.compositionFingerprint,loaded:b}}exports.COMPOSED_ENV=o.COMPOSED_ENV,exports.DOOM_FLAGS=x,exports.EXTERNAL_EXTENSIONS_ENV=o.EXTERNAL_EXTENSIONS_ENV,exports.MUTE_ENV=o.MUTE_ENV,exports.REMOVED_LAYER_FLAG=S,Object.defineProperty(exports,"alreadyComposed",{enumerable:!0,get:function(){return c.alreadyComposed}}),exports.applyStartupFlags=k,exports.cleanupRunDirectory=j,exports.composeDoomSession=F,exports.composeLoadOrder=N,exports.composeRuntimeLoadPlan=M,exports.extensionsProvidedExternally=T,exports.findSyncedRoot=r.findSyncedRoot,exports.loadComposedExtensions=P,exports.prepareRunDirectory=A,exports.readStartupFlags=D,exports.registerDoomFlags=O,exports.startSyncedSession=E;
1
+ const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../services/extensionAssembler.cjs"),n=require("./syncState.cjs"),r=require("./bootstrapLocator.cjs"),i=require("./config/harnessState.cjs"),a=require("./harnessContext.cjs"),o=require("./compositionState.cjs");let s=require("node:url"),c=require("@agimon-ai/doompi-extension-contracts/child-process"),l=require("node:path");l=e.__toESM(l,1);let u=require("node:fs");u=e.__toESM(u,1);let d=require("node:os");d=e.__toESM(d,1);let f=require("@agimon-ai/doompi-config/majorModes"),p=require("@agimon-ai/doompi-extension-contracts/cordis-host"),m=require("@earendil-works/pi-coding-agent"),h=require("@agimon-ai/doompi-ui/extensionName"),g=require("@agimon-ai/doompi-config/harnessStore");const _=`@agimon-ai/doompi-config/selectionSwitch`,v=`doompi is configured for Pi but this repository was never synced. Run doompi sync.`,y=`doompi could not read its synchronized state. Run doompi sync.`,b=process.env.DOOMPI_TIMING===`1`||process.env.PI_TIMING===`1`,x={majorMode:`major-mode`,domains:`domains`,profile:`profile`,mute:`mute`},S=`layer`;function C(e){return e instanceof Error?e.message:String(e)}function w(e){try{return u.default.realpathSync(e)}catch{return l.default.resolve(e)}}function T(e,t){let{extensions:n}=(0,m.parseArgs)(e);if(!n||n.length===0)return!1;let r=new Set(Object.values(t).map(w));return n.some(e=>r.has(w(e)))}async function E(e,t,n=process.env){let r=await A(t,n),a={...i.readHarnessState({...e.env,...n}),...e.fileState,mcpProjection:{...e.fileState.mcpProjection,stagingDirectory:r},temporaryDirectory:r};(0,g.createHarnessSession)(a,{directory:r,environment:n});for(let[e,t]of Object.entries(a.profileEnvironment))n[e]===void 0&&(n[e]=t);return a}function D(e){let{unknownFlags:t}=(0,m.parseArgs)(e),n=e=>{let n=t.get(e);return typeof n==`string`&&n.trim()?n.trim():void 0},r=n(x.domains);return{majorMode:n(x.majorMode),domains:r?.split(`,`).map(e=>e.trim()).filter(Boolean),profile:n(x.profile),mute:t.get(x.mute)!==void 0,removedLayer:t.get(S)!==void 0}}function O(e){e.registerFlag(x.majorMode,{type:`string`,description:`Named major mode from .doom/modes.yaml`}),e.registerFlag(x.domains,{type:`string`,description:`Comma-separated content domains`}),e.registerFlag(x.profile,{type:`string`,description:`Persona and env from .doom/profiles.yaml`}),e.registerFlag(x.mute,{type:`boolean`,description:`Disable the notification extension`})}async function k(e,t,n,r){if(e.removedLayer&&r.push(`--${S} was replaced by --${x.majorMode}`),e.majorMode)try{let{applyMajorMode:n}=await import(_);n(t,e.majorMode,i.getHarnessState())}catch(t){r.push(`--${x.majorMode} ${e.majorMode}: ${C(t)}`)}if(e.domains&&e.domains.length>0)try{let{applyDomains:t}=await import(`@agimon-ai/doompi-domain/apply`);await t(e.domains,i.getHarnessState())}catch(t){r.push(`--domains ${e.domains.join(`,`)}: ${C(t)}`)}if(e.profile)try{let[{applyProfile:t},{resolveProfile:r}]=await Promise.all([import(_),import(`@agimon-ai/doompi-config/profiles`)]);await t(r(n,e.profile),i.getHarnessState())}catch(t){r.push(`--profile ${e.profile}: ${C(t)}`)}}async function A(e,t=process.env){let r=n.runDirectory(e,process.pid,t.HOME??d.default.homedir());return await u.default.promises.mkdir(r,{mode:448,recursive:!0}),i.updateHarnessState({temporaryDirectory:r},t),r}async function j(e,t=process.env){await u.default.promises.rm(n.runDirectory(e,process.pid,t.HOME??d.default.homedir()),{recursive:!0,force:!0})}async function M(e,r=i.getHarnessState(),a=process.env){let s=r.root??e.root,c=n.createMapResolvers(e.resolved,e.compiled),u={agents:r.agents,autoStop:!1,preset:e.selection.preset,personaEntry:c.packageEntry(t.PERSONA_ENTRY),majorMode:r.majorMode,layers:[...r.layers],majorModesConfig:(0,f.loadMajorModesConfig)(s),resolvers:c},d=t.resolveExtensionComposition({...u,mute:a[o.MUTE_ENV]===`1`});a[p.DOOM_CORDIS_HOST_REQUIRED_ENV]=`1`,i.updateHarnessState({childExtensions:[...d.childActivation],compositionFingerprint:d.fingerprint},a),r.agents&&(a.PI_SUBAGENT_EXTRA_AGENT_DIRS=r.agentDirectories.join(l.default.delimiter),a.PI_SUBAGENT_EXTRA_SKILL_DIRS=r.skillDirectories.join(l.default.delimiter));let m=[...d.parentActivation],h=e.bundles?.[d.fingerprint];return{entries:h?[h]:m,fingerprint:d.fingerprint}}async function N(e,t=i.getHarnessState(),n=process.env){return(await M(e,t,n)).entries}async function P(e,t,n){let r=[];for(let i of t){let t=performance.now(),a;try{a=await import((0,s.pathToFileURL)(i).href),b&&process.stderr.write(`[doompi:timing] import ${(performance.now()-t).toFixed(1)}ms ${i}\n`)}catch(e){n.push(`${i}: ${C(e)}`);continue}if(typeof a.default!=`function`){n.push(`${i}: does not export an extension factory`);continue}let o=performance.now();try{await a.default((0,h.withExtensionSource)(e,i)),b&&process.stderr.write(`[doompi:timing] factory ${(performance.now()-o).toFixed(1)}ms ${i}\n`),r.push(i)}catch(e){n.push(`${i}: ${C(e)}`)}}return r}async function F(e,t={}){let i=t.environment??process.env,s=[],l=i.HOME??d.default.homedir(),u=r.findSyncedRoot(t.cwd??process.cwd(),l);if(!u)return{problems:[v],stale:!1,loaded:[]};let p;try{p=n.readSyncState(u,l)}catch(e){return{problems:[C(e)],stale:!1,loaded:[]}}if(!p)return{problems:[v],stale:!1,loaded:[]};let m=t.argv??process.argv.slice(2);if(i[o.EXTERNAL_EXTENSIONS_ENV]===`1`||T(m,{...p.resolved,...p.bundles}))return{problems:[],stale:!1,loaded:[]};if(a.configurePreset({preset:p.selection.preset,piArgs:[]},i),!(0,c.alreadyComposed)(i)){i[o.COMPOSED_ENV]=`1`,await E(p,u,i);let e=D(m);e.mute&&(i[o.MUTE_ENV]=`1`),await k(e,(0,f.loadMajorModesConfig)(u),u,s)}let h;try{h=await M(p,(0,g.loadHarnessState)(i).state,i)}catch(e){return{problems:[...s,C(e)],stale:!1,loaded:[]}}let _=p.bundles?.[h.fingerprint];if(_)try{let e=r.readBundleStatus(u,h.fingerprint,l);if(!e.fresh||e.bundle!==_)return{problems:[...s,y],stale:!1,loaded:[]}}catch{return{problems:[...s,y],stale:!1,loaded:[]}}let b=await P(e,h.entries,s);return{problems:s,stale:n.computeInputsHash(u,p.selection,l)!==p.inputsHash||(0,g.loadHarnessState)(i).state.majorMode===p.selection.majorMode&&h.fingerprint!==p.compositionFingerprint,loaded:b}}exports.COMPOSED_ENV=o.COMPOSED_ENV,exports.DOOM_FLAGS=x,exports.EXTERNAL_EXTENSIONS_ENV=o.EXTERNAL_EXTENSIONS_ENV,exports.MUTE_ENV=o.MUTE_ENV,exports.REMOVED_LAYER_FLAG=S,Object.defineProperty(exports,"alreadyComposed",{enumerable:!0,get:function(){return c.alreadyComposed}}),exports.applyStartupFlags=k,exports.cleanupRunDirectory=j,exports.composeDoomSession=F,exports.composeLoadOrder=N,exports.composeRuntimeLoadPlan=M,exports.extensionsProvidedExternally=T,exports.findSyncedRoot=r.findSyncedRoot,exports.loadComposedExtensions=P,exports.prepareRunDirectory=A,exports.readStartupFlags=D,exports.registerDoomFlags=O,exports.startSyncedSession=E;
2
2
  //# sourceMappingURL=composer.cjs.map
@@ -1,2 +1,2 @@
1
- import{PERSONA_ENTRY as e,resolveExtensionComposition as t}from"../services/extensionAssembler.mjs";import{computeInputsHash as n,createMapResolvers as r,readSyncState as i,runDirectory as a}from"./syncState.mjs";import{findSyncedRoot as o,readBundleStatus as s}from"./bootstrapLocator.mjs";import{createHarnessSession as c,getHarnessState as l,loadHarnessState as u,readHarnessState as d,updateHarnessState as f}from"./config/harnessState.mjs";import{configurePreset as p}from"./harnessContext.mjs";import{COMPOSED_ENV as m,EXTERNAL_EXTENSIONS_ENV as h,MUTE_ENV as g}from"./compositionState.mjs";import{pathToFileURL as _}from"node:url";import{alreadyComposed as v,alreadyComposed as y}from"@agimon-ai/doompi-extension-contracts/child-process";import b from"node:path";import x from"node:fs";import S from"node:os";import{loadMajorModesConfig as C}from"@agimon-ai/doompi-config/majorModes";import{DOOM_CORDIS_HOST_REQUIRED_ENV as w}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{withExtensionSource as T}from"@agimon-ai/doompi-ui/extensionName";import{parseArgs as E}from"@earendil-works/pi-coding-agent";const D=`@agimon-ai/doompi-config/selectionSwitch`,O=`doompi is configured for Pi but this repository was never synced. Run doompi sync.`,k=`doompi could not read its synchronized state. Run doompi sync.`,A=process.env.DOOMPI_TIMING===`1`||process.env.PI_TIMING===`1`,j={majorMode:`major-mode`,domains:`domains`,profile:`profile`,mute:`mute`},M=`layer`;function N(e){return e instanceof Error?e.message:String(e)}function P(e){try{return x.realpathSync(e)}catch{return b.resolve(e)}}function F(e,t){let{extensions:n}=E(e);if(!n||n.length===0)return!1;let r=new Set(Object.values(t).map(P));return n.some(e=>r.has(P(e)))}async function I(e,t,n=process.env){let r=await B(t,n),i={...d({...e.env,...n}),...e.fileState,mcpProjection:{...e.fileState.mcpProjection,stagingDirectory:r},temporaryDirectory:r};c(i,{directory:r,environment:n});for(let[e,t]of Object.entries(i.profileEnvironment))n[e]===void 0&&(n[e]=t);return i}function L(e){let{unknownFlags:t}=E(e),n=e=>{let n=t.get(e);return typeof n==`string`&&n.trim()?n.trim():void 0},r=n(j.domains);return{majorMode:n(j.majorMode),domains:r?.split(`,`).map(e=>e.trim()).filter(Boolean),profile:n(j.profile),mute:t.get(j.mute)!==void 0,removedLayer:t.get(M)!==void 0}}function R(e){e.registerFlag(j.majorMode,{type:`string`,description:`Named major mode from .doom/modes.yaml`}),e.registerFlag(j.domains,{type:`string`,description:`Comma-separated content domains`}),e.registerFlag(j.profile,{type:`string`,description:`Persona and env from .doom/profiles.yaml`}),e.registerFlag(j.mute,{type:`boolean`,description:`Disable the notification extension`})}async function z(e,t,n,r){if(e.removedLayer&&r.push(`--${M} was replaced by --${j.majorMode}`),e.majorMode)try{let{applyMajorMode:n}=await import(D);n(t,e.majorMode,l())}catch(t){r.push(`--${j.majorMode} ${e.majorMode}: ${N(t)}`)}if(e.domains&&e.domains.length>0)try{let{applyDomains:t}=await import(`@agimon-ai/doompi-domain/apply`);await t(e.domains,l())}catch(t){r.push(`--domains ${e.domains.join(`,`)}: ${N(t)}`)}if(e.profile)try{let[{applyProfile:t},{resolveProfile:r}]=await Promise.all([import(D),import(`@agimon-ai/doompi-config/profiles`)]);await t(r(n,e.profile),l())}catch(t){r.push(`--profile ${e.profile}: ${N(t)}`)}}async function B(e,t=process.env){let n=a(e,process.pid,t.HOME??S.homedir());return await x.promises.mkdir(n,{mode:448,recursive:!0}),f({temporaryDirectory:n},t),n}async function V(e,t=process.env){await x.promises.rm(a(e,process.pid,t.HOME??S.homedir()),{recursive:!0,force:!0})}async function H(n,i=l(),a=process.env){let o=i.root??n.root,s=r(n.resolved,n.compiled),c={agents:i.agents,autoStop:!1,preset:n.selection.preset,personaEntry:s.packageEntry(e),majorMode:i.majorMode,layers:[...i.layers],majorModesConfig:C(o),resolvers:s},u=t({...c,mute:a[g]===`1`});a[w]=`1`,f({childExtensions:[...u.childActivation],compositionFingerprint:u.fingerprint},a),i.agents&&(a.PI_SUBAGENT_EXTRA_AGENT_DIRS=i.agentDirectories.join(b.delimiter),a.PI_SUBAGENT_EXTRA_SKILL_DIRS=i.skillDirectories.join(b.delimiter));let d=[...u.parentActivation],p=n.bundles?.[u.fingerprint];return{entries:p?[p]:d,fingerprint:u.fingerprint}}async function U(e,t=l(),n=process.env){return(await H(e,t,n)).entries}async function W(e,t,n){let r=[];for(let i of t){let t=performance.now(),a;try{a=await import(_(i).href),A&&process.stderr.write(`[doompi:timing] import ${(performance.now()-t).toFixed(1)}ms ${i}\n`)}catch(e){n.push(`${i}: ${N(e)}`);continue}if(typeof a.default!=`function`){n.push(`${i}: does not export an extension factory`);continue}let o=performance.now();try{await a.default(T(e,i)),A&&process.stderr.write(`[doompi:timing] factory ${(performance.now()-o).toFixed(1)}ms ${i}\n`),r.push(i)}catch(e){n.push(`${i}: ${N(e)}`)}}return r}async function G(e,t={}){let r=t.environment??process.env,a=[],c=r.HOME??S.homedir(),l=o(t.cwd??process.cwd(),c);if(!l)return{problems:[O],stale:!1,loaded:[]};let d;try{d=i(l,c)}catch(e){return{problems:[N(e)],stale:!1,loaded:[]}}if(!d)return{problems:[O],stale:!1,loaded:[]};let f=t.argv??process.argv.slice(2);if(r[h]===`1`||F(f,{...d.resolved,...d.bundles}))return{problems:[],stale:!1,loaded:[]};if(p({preset:d.selection.preset,piArgs:[]},r),!v(r)){r[m]=`1`,await I(d,l,r);let e=L(f);e.mute&&(r[g]=`1`),await z(e,C(l),l,a)}let _;try{_=await H(d,u(r).state,r)}catch(e){return{problems:[...a,N(e)],stale:!1,loaded:[]}}let y=d.bundles?.[_.fingerprint];if(y)try{let e=s(l,_.fingerprint,c);if(!e.fresh||e.bundle!==y)return{problems:[...a,k],stale:!1,loaded:[]}}catch{return{problems:[...a,k],stale:!1,loaded:[]}}let b=await W(e,_.entries,a);return{problems:a,stale:n(l,d.selection,c)!==d.inputsHash||u(r).state.majorMode===d.selection.majorMode&&_.fingerprint!==d.compositionFingerprint,loaded:b}}export{m as COMPOSED_ENV,j as DOOM_FLAGS,h as EXTERNAL_EXTENSIONS_ENV,g as MUTE_ENV,M as REMOVED_LAYER_FLAG,y as alreadyComposed,z as applyStartupFlags,V as cleanupRunDirectory,G as composeDoomSession,U as composeLoadOrder,H as composeRuntimeLoadPlan,F as extensionsProvidedExternally,o as findSyncedRoot,W as loadComposedExtensions,B as prepareRunDirectory,L as readStartupFlags,R as registerDoomFlags,I as startSyncedSession};
1
+ import{PERSONA_ENTRY as e,resolveExtensionComposition as t}from"../services/extensionAssembler.mjs";import{computeInputsHash as n,createMapResolvers as r,readSyncState as i,runDirectory as a}from"./syncState.mjs";import{findSyncedRoot as o,readBundleStatus as s}from"./bootstrapLocator.mjs";import{createHarnessSession as c,getHarnessState as l,loadHarnessState as u,readHarnessState as d,updateHarnessState as f}from"./config/harnessState.mjs";import{configurePreset as p}from"./harnessContext.mjs";import{COMPOSED_ENV as m,EXTERNAL_EXTENSIONS_ENV as h,MUTE_ENV as g}from"./compositionState.mjs";import{pathToFileURL as _}from"node:url";import{alreadyComposed as v,alreadyComposed as y}from"@agimon-ai/doompi-extension-contracts/child-process";import b from"node:path";import x from"node:fs";import S from"node:os";import{loadMajorModesConfig as C}from"@agimon-ai/doompi-config/majorModes";import{DOOM_CORDIS_HOST_REQUIRED_ENV as w}from"@agimon-ai/doompi-extension-contracts/cordis-host";import{parseArgs as T}from"@earendil-works/pi-coding-agent";import{withExtensionSource as E}from"@agimon-ai/doompi-ui/extensionName";const D=`@agimon-ai/doompi-config/selectionSwitch`,O=`doompi is configured for Pi but this repository was never synced. Run doompi sync.`,k=`doompi could not read its synchronized state. Run doompi sync.`,A=process.env.DOOMPI_TIMING===`1`||process.env.PI_TIMING===`1`,j={majorMode:`major-mode`,domains:`domains`,profile:`profile`,mute:`mute`},M=`layer`;function N(e){return e instanceof Error?e.message:String(e)}function P(e){try{return x.realpathSync(e)}catch{return b.resolve(e)}}function F(e,t){let{extensions:n}=T(e);if(!n||n.length===0)return!1;let r=new Set(Object.values(t).map(P));return n.some(e=>r.has(P(e)))}async function I(e,t,n=process.env){let r=await B(t,n),i={...d({...e.env,...n}),...e.fileState,mcpProjection:{...e.fileState.mcpProjection,stagingDirectory:r},temporaryDirectory:r};c(i,{directory:r,environment:n});for(let[e,t]of Object.entries(i.profileEnvironment))n[e]===void 0&&(n[e]=t);return i}function L(e){let{unknownFlags:t}=T(e),n=e=>{let n=t.get(e);return typeof n==`string`&&n.trim()?n.trim():void 0},r=n(j.domains);return{majorMode:n(j.majorMode),domains:r?.split(`,`).map(e=>e.trim()).filter(Boolean),profile:n(j.profile),mute:t.get(j.mute)!==void 0,removedLayer:t.get(M)!==void 0}}function R(e){e.registerFlag(j.majorMode,{type:`string`,description:`Named major mode from .doom/modes.yaml`}),e.registerFlag(j.domains,{type:`string`,description:`Comma-separated content domains`}),e.registerFlag(j.profile,{type:`string`,description:`Persona and env from .doom/profiles.yaml`}),e.registerFlag(j.mute,{type:`boolean`,description:`Disable the notification extension`})}async function z(e,t,n,r){if(e.removedLayer&&r.push(`--${M} was replaced by --${j.majorMode}`),e.majorMode)try{let{applyMajorMode:n}=await import(D);n(t,e.majorMode,l())}catch(t){r.push(`--${j.majorMode} ${e.majorMode}: ${N(t)}`)}if(e.domains&&e.domains.length>0)try{let{applyDomains:t}=await import(`@agimon-ai/doompi-domain/apply`);await t(e.domains,l())}catch(t){r.push(`--domains ${e.domains.join(`,`)}: ${N(t)}`)}if(e.profile)try{let[{applyProfile:t},{resolveProfile:r}]=await Promise.all([import(D),import(`@agimon-ai/doompi-config/profiles`)]);await t(r(n,e.profile),l())}catch(t){r.push(`--profile ${e.profile}: ${N(t)}`)}}async function B(e,t=process.env){let n=a(e,process.pid,t.HOME??S.homedir());return await x.promises.mkdir(n,{mode:448,recursive:!0}),f({temporaryDirectory:n},t),n}async function V(e,t=process.env){await x.promises.rm(a(e,process.pid,t.HOME??S.homedir()),{recursive:!0,force:!0})}async function H(n,i=l(),a=process.env){let o=i.root??n.root,s=r(n.resolved,n.compiled),c={agents:i.agents,autoStop:!1,preset:n.selection.preset,personaEntry:s.packageEntry(e),majorMode:i.majorMode,layers:[...i.layers],majorModesConfig:C(o),resolvers:s},u=t({...c,mute:a[g]===`1`});a[w]=`1`,f({childExtensions:[...u.childActivation],compositionFingerprint:u.fingerprint},a),i.agents&&(a.PI_SUBAGENT_EXTRA_AGENT_DIRS=i.agentDirectories.join(b.delimiter),a.PI_SUBAGENT_EXTRA_SKILL_DIRS=i.skillDirectories.join(b.delimiter));let d=[...u.parentActivation],p=n.bundles?.[u.fingerprint];return{entries:p?[p]:d,fingerprint:u.fingerprint}}async function U(e,t=l(),n=process.env){return(await H(e,t,n)).entries}async function W(e,t,n){let r=[];for(let i of t){let t=performance.now(),a;try{a=await import(_(i).href),A&&process.stderr.write(`[doompi:timing] import ${(performance.now()-t).toFixed(1)}ms ${i}\n`)}catch(e){n.push(`${i}: ${N(e)}`);continue}if(typeof a.default!=`function`){n.push(`${i}: does not export an extension factory`);continue}let o=performance.now();try{await a.default(E(e,i)),A&&process.stderr.write(`[doompi:timing] factory ${(performance.now()-o).toFixed(1)}ms ${i}\n`),r.push(i)}catch(e){n.push(`${i}: ${N(e)}`)}}return r}async function G(e,t={}){let r=t.environment??process.env,a=[],c=r.HOME??S.homedir(),l=o(t.cwd??process.cwd(),c);if(!l)return{problems:[O],stale:!1,loaded:[]};let d;try{d=i(l,c)}catch(e){return{problems:[N(e)],stale:!1,loaded:[]}}if(!d)return{problems:[O],stale:!1,loaded:[]};let f=t.argv??process.argv.slice(2);if(r[h]===`1`||F(f,{...d.resolved,...d.bundles}))return{problems:[],stale:!1,loaded:[]};if(p({preset:d.selection.preset,piArgs:[]},r),!v(r)){r[m]=`1`,await I(d,l,r);let e=L(f);e.mute&&(r[g]=`1`),await z(e,C(l),l,a)}let _;try{_=await H(d,u(r).state,r)}catch(e){return{problems:[...a,N(e)],stale:!1,loaded:[]}}let y=d.bundles?.[_.fingerprint];if(y)try{let e=s(l,_.fingerprint,c);if(!e.fresh||e.bundle!==y)return{problems:[...a,k],stale:!1,loaded:[]}}catch{return{problems:[...a,k],stale:!1,loaded:[]}}let b=await W(e,_.entries,a);return{problems:a,stale:n(l,d.selection,c)!==d.inputsHash||u(r).state.majorMode===d.selection.majorMode&&_.fingerprint!==d.compositionFingerprint,loaded:b}}export{m as COMPOSED_ENV,j as DOOM_FLAGS,h as EXTERNAL_EXTENSIONS_ENV,g as MUTE_ENV,M as REMOVED_LAYER_FLAG,y as alreadyComposed,z as applyStartupFlags,V as cleanupRunDirectory,G as composeDoomSession,U as composeLoadOrder,H as composeRuntimeLoadPlan,F as extensionsProvidedExternally,o as findSyncedRoot,W as loadComposedExtensions,B as prepareRunDirectory,L as readStartupFlags,R as registerDoomFlags,I as startSyncedSession};
2
2
  //# sourceMappingURL=composer.mjs.map