agestra 4.12.0 → 4.12.1
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.gemini/commands/agestra/design.toml +1 -1
- package/README.ja.md +25 -6
- package/README.ko.md +14 -10
- package/README.md +14 -10
- package/README.zh.md +25 -6
- package/agents/agestra-team-lead.md +4 -0
- package/commands/design.md +50 -40
- package/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/skills/design.md +49 -37
|
@@ -9,7 +9,7 @@ Use the shared workflow spec below as the source of truth and adapt it to the cu
|
|
|
9
9
|
@{commands/design.md}
|
|
10
10
|
|
|
11
11
|
Gemini-specific rules:
|
|
12
|
-
- Start with `environment_check` and `provider_list`.
|
|
12
|
+
- Start with `setup_status`, then `environment_check` and `provider_list`.
|
|
13
13
|
- Prefer Agestra MCP tools, workspace documents, and debate flows over free-form brainstorming.
|
|
14
14
|
- Translate Claude-specific wording into leader-host wording when Gemini is the active host.
|
|
15
15
|
- Keep the final answer in the user's language.
|
package/README.ja.md
CHANGED
|
@@ -24,22 +24,37 @@ Claude では既存のプラグイン UX をそのまま維持します。Agestr
|
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
npm run bundle
|
|
27
|
-
npm run install:codex
|
|
27
|
+
npm run install:codex:assets
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
グローバル npm パッケージから使う場合:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm install -g agestra
|
|
34
|
+
agestra-install codex --assets
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Codex ではリポジトリ直下の [AGENTS.md](AGENTS.md) と、登録済みの `agestra` MCP サーバーを一緒に使います。`--assets` は `.codex/agents/` に生成済み Codex custom agent もインストールし、Agestra host-asset manifest に記録します。MCP 登録だけでよい場合は `npm run install:codex` または `agestra-install codex` を使ってください。
|
|
31
38
|
|
|
32
39
|
### Gemini CLI
|
|
33
40
|
|
|
34
41
|
```
|
|
35
42
|
npm run bundle
|
|
36
|
-
npm run install:gemini
|
|
43
|
+
npm run install:gemini:assets
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
グローバル npm パッケージから使う場合:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm install -g agestra
|
|
50
|
+
agestra-install gemini --assets --scope user
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Gemini ではリポジトリ直下の [GEMINI.md](GEMINI.md) と、[`.gemini/commands/agestra/`](.gemini/commands/agestra) のプロジェクトコマンドを一緒に使います。user scope の `--assets` は Agestra Gemini native extension をインストールします。MCP 登録だけでよい場合は `npm run install:gemini` または `agestra-install gemini` を使ってください。
|
|
40
54
|
|
|
41
55
|
セットアップ後に利用できる Gemini コマンド:
|
|
42
56
|
|
|
57
|
+
- `/agestra:setup`
|
|
43
58
|
- `/agestra:review`
|
|
44
59
|
- `/agestra:design`
|
|
45
60
|
- `/agestra:idea`
|
|
@@ -329,8 +344,8 @@ agestra/
|
|
|
329
344
|
│ └── bundle.js # 単一ファイル MCP サーバーバンドル
|
|
330
345
|
├── scripts/
|
|
331
346
|
│ ├── bundle.mjs # esbuild バンドルスクリプト
|
|
332
|
-
│ ├── install-host-mcp.mjs # Codex/Gemini
|
|
333
|
-
│ └── uninstall-host-mcp.mjs #
|
|
347
|
+
│ ├── install-host-mcp.mjs # Claude/Codex/Gemini の MCP + host assets を登録
|
|
348
|
+
│ └── uninstall-host-mcp.mjs # ホスト登録と管理対象 assets を削除
|
|
334
349
|
├── packages/
|
|
335
350
|
│ ├── core/ # AIProvider、レジストリ、セキュリティ、ワーカー
|
|
336
351
|
│ ├── provider-ollama/ # Ollama HTTP アダプター
|
|
@@ -363,14 +378,18 @@ Codex CLI:
|
|
|
363
378
|
|
|
364
379
|
```
|
|
365
380
|
npm run uninstall:codex
|
|
381
|
+
npm run uninstall:codex:assets
|
|
366
382
|
```
|
|
367
383
|
|
|
368
384
|
Gemini CLI:
|
|
369
385
|
|
|
370
386
|
```
|
|
371
387
|
npm run uninstall:gemini
|
|
388
|
+
npm run uninstall:gemini:assets
|
|
372
389
|
```
|
|
373
390
|
|
|
391
|
+
`*:assets` のアンインストールは、ホスト登録と未変更の生成済みホスト資産を一緒に削除します。ユーザーが生成済み資産を編集していた場合、Agestra はそのファイルを残して報告します。グローバル npm インストールでは `agestra-uninstall codex --assets` または `agestra-uninstall gemini --assets --scope user` を使ってください。
|
|
392
|
+
|
|
374
393
|
生成済みのプロジェクトデータも削除したい場合は、`.agestra/` ディレクトリを手動で削除してください。
|
|
375
394
|
|
|
376
395
|
---
|
package/README.ko.md
CHANGED
|
@@ -26,23 +26,23 @@ Claude는 기존 플러그인 설치 UX를 그대로 유지합니다. Agestra가
|
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
npm run bundle
|
|
29
|
-
npm run install:codex
|
|
29
|
+
npm run install:codex:assets
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
전역 npm 패키지 기준:
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
npm install -g agestra
|
|
36
|
-
agestra-install codex
|
|
36
|
+
agestra-install codex --assets
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
저장소에서 작업 중이지만
|
|
39
|
+
저장소에서 작업 중이지만 전역 npm 패키지를 MCP만 등록하고 싶다면:
|
|
40
40
|
|
|
41
41
|
```
|
|
42
42
|
npm run install:codex:global
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Codex는 저장소 루트의 [AGENTS.md](AGENTS.md)와 등록된 `agestra` MCP 서버를 함께 사용합니다.
|
|
45
|
+
Codex는 저장소 루트의 [AGENTS.md](AGENTS.md)와 등록된 `agestra` MCP 서버를 함께 사용합니다. `--assets` 경로는 `.codex/agents/` 아래에 생성형 Codex custom agent도 설치하고 Agestra host-asset manifest에 기록합니다. MCP만 등록하려면 `npm run install:codex` 또는 `agestra-install codex`를 사용하세요.
|
|
46
46
|
|
|
47
47
|
### Gemini CLI
|
|
48
48
|
|
|
@@ -50,23 +50,23 @@ Codex는 저장소 루트의 [AGENTS.md](AGENTS.md)와 등록된 `agestra` MCP
|
|
|
50
50
|
|
|
51
51
|
```
|
|
52
52
|
npm run bundle
|
|
53
|
-
npm run install:gemini
|
|
53
|
+
npm run install:gemini:assets
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
전역 npm 패키지 기준:
|
|
57
57
|
|
|
58
58
|
```
|
|
59
59
|
npm install -g agestra
|
|
60
|
-
agestra-install gemini
|
|
60
|
+
agestra-install gemini --assets --scope user
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
저장소에서 작업 중이지만
|
|
63
|
+
저장소에서 작업 중이지만 전역 npm 패키지를 MCP만 등록하고 싶다면:
|
|
64
64
|
|
|
65
65
|
```
|
|
66
66
|
npm run install:gemini:global
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Gemini는 저장소 루트의 [GEMINI.md](GEMINI.md)와 [`.gemini/commands/agestra/`](.gemini/commands/agestra) 프로젝트 커맨드를 함께 사용합니다.
|
|
69
|
+
Gemini는 저장소 루트의 [GEMINI.md](GEMINI.md)와 [`.gemini/commands/agestra/`](.gemini/commands/agestra) 프로젝트 커맨드를 함께 사용합니다. user scope의 `--assets` 경로는 Agestra Gemini native extension을 설치합니다. MCP만 등록하려면 `npm run install:gemini` 또는 `agestra-install gemini`를 사용하세요.
|
|
70
70
|
|
|
71
71
|
설치 후 Gemini에서 사용할 수 있는 명령:
|
|
72
72
|
|
|
@@ -372,8 +372,8 @@ agestra/
|
|
|
372
372
|
│ └── bundle.js # 단일 파일 MCP 서버 번들
|
|
373
373
|
├── scripts/
|
|
374
374
|
│ ├── bundle.mjs # esbuild 번들 스크립트
|
|
375
|
-
│ ├── install-host-mcp.mjs # Codex/Gemini
|
|
376
|
-
│ └── uninstall-host-mcp.mjs #
|
|
375
|
+
│ ├── install-host-mcp.mjs # Claude/Codex/Gemini MCP + host assets 등록
|
|
376
|
+
│ └── uninstall-host-mcp.mjs # 호스트 등록과 관리 자산 제거
|
|
377
377
|
├── packages/
|
|
378
378
|
│ ├── core/ # AIProvider 인터페이스, 레지스트리, 보안, 워커
|
|
379
379
|
│ ├── provider-ollama/ # Ollama HTTP 어댑터
|
|
@@ -406,14 +406,18 @@ Codex CLI:
|
|
|
406
406
|
|
|
407
407
|
```
|
|
408
408
|
npm run uninstall:codex
|
|
409
|
+
npm run uninstall:codex:assets
|
|
409
410
|
```
|
|
410
411
|
|
|
411
412
|
Gemini CLI:
|
|
412
413
|
|
|
413
414
|
```
|
|
414
415
|
npm run uninstall:gemini
|
|
416
|
+
npm run uninstall:gemini:assets
|
|
415
417
|
```
|
|
416
418
|
|
|
419
|
+
`*:assets` 제거 명령은 호스트 등록과 변경되지 않은 생성형 호스트 자산을 함께 제거합니다. 사용자가 생성된 자산을 수정했다면 Agestra는 삭제하지 않고 남겨둔 파일을 보고합니다. 전역 npm 설치에서는 `agestra-uninstall codex --assets` 또는 `agestra-uninstall gemini --assets --scope user`를 사용하세요.
|
|
420
|
+
|
|
417
421
|
프로젝트에 생성된 데이터까지 지우려면 `.agestra/` 디렉터리를 수동으로 삭제하세요.
|
|
418
422
|
|
|
419
423
|
---
|
package/README.md
CHANGED
|
@@ -26,23 +26,23 @@ Repository checkout:
|
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
npm run bundle
|
|
29
|
-
npm run install:codex
|
|
29
|
+
npm run install:codex:assets
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Global npm package:
|
|
33
33
|
|
|
34
34
|
```
|
|
35
35
|
npm install -g agestra
|
|
36
|
-
agestra-install codex
|
|
36
|
+
agestra-install codex --assets
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
If you want
|
|
39
|
+
If you want MCP-only registration of the global package while working from a repo checkout, use:
|
|
40
40
|
|
|
41
41
|
```
|
|
42
42
|
npm run install:codex:global
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Codex uses the repository-level [AGENTS.md](AGENTS.md) instructions plus the registered `agestra` MCP server.
|
|
45
|
+
Codex uses the repository-level [AGENTS.md](AGENTS.md) instructions plus the registered `agestra` MCP server. The `--assets` path also installs generated Codex custom agents under `.codex/agents/` and tracks them in the Agestra host-asset manifest. For MCP-only registration, use `npm run install:codex` or `agestra-install codex`.
|
|
46
46
|
|
|
47
47
|
### Gemini CLI
|
|
48
48
|
|
|
@@ -50,23 +50,23 @@ Repository checkout:
|
|
|
50
50
|
|
|
51
51
|
```
|
|
52
52
|
npm run bundle
|
|
53
|
-
npm run install:gemini
|
|
53
|
+
npm run install:gemini:assets
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
Global npm package:
|
|
57
57
|
|
|
58
58
|
```
|
|
59
59
|
npm install -g agestra
|
|
60
|
-
agestra-install gemini
|
|
60
|
+
agestra-install gemini --assets --scope user
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
If you want
|
|
63
|
+
If you want MCP-only registration of the global package while working from a repo checkout, use:
|
|
64
64
|
|
|
65
65
|
```
|
|
66
66
|
npm run install:gemini:global
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
Gemini uses the repository-level [GEMINI.md](GEMINI.md) context file plus project commands under [`.gemini/commands/agestra/`](.gemini/commands/agestra).
|
|
69
|
+
Gemini uses the repository-level [GEMINI.md](GEMINI.md) context file plus project commands under [`.gemini/commands/agestra/`](.gemini/commands/agestra). The user-scope `--assets` path installs the Agestra Gemini native extension. For MCP-only registration, use `npm run install:gemini` or `agestra-install gemini`.
|
|
70
70
|
|
|
71
71
|
Available Gemini commands after setup:
|
|
72
72
|
|
|
@@ -374,8 +374,8 @@ agestra/
|
|
|
374
374
|
│ └── bundle.js # Single-file MCP server bundle
|
|
375
375
|
├── scripts/
|
|
376
376
|
│ ├── bundle.mjs # esbuild bundle script
|
|
377
|
-
│ ├── install-host-mcp.mjs # Register
|
|
378
|
-
│ └── uninstall-host-mcp.mjs # Remove
|
|
377
|
+
│ ├── install-host-mcp.mjs # Register Claude/Codex/Gemini MCP + host assets
|
|
378
|
+
│ └── uninstall-host-mcp.mjs # Remove host registrations and managed assets
|
|
379
379
|
├── packages/
|
|
380
380
|
│ ├── core/ # AIProvider interface, registry, security, workers
|
|
381
381
|
│ ├── provider-ollama/ # Ollama HTTP adapter
|
|
@@ -408,14 +408,18 @@ Codex CLI:
|
|
|
408
408
|
|
|
409
409
|
```
|
|
410
410
|
npm run uninstall:codex
|
|
411
|
+
npm run uninstall:codex:assets
|
|
411
412
|
```
|
|
412
413
|
|
|
413
414
|
Gemini CLI:
|
|
414
415
|
|
|
415
416
|
```
|
|
416
417
|
npm run uninstall:gemini
|
|
418
|
+
npm run uninstall:gemini:assets
|
|
417
419
|
```
|
|
418
420
|
|
|
421
|
+
The `*:assets` uninstall commands remove both the host registration and unchanged generated host assets. If a generated asset was edited by the user, Agestra leaves it in place and reports it. For a global npm install, use `agestra-uninstall codex --assets` or `agestra-uninstall gemini --assets --scope user`.
|
|
422
|
+
|
|
419
423
|
If you also want to delete generated project data, remove the `.agestra/` directory manually.
|
|
420
424
|
|
|
421
425
|
---
|
package/README.zh.md
CHANGED
|
@@ -24,22 +24,37 @@ Claude 保持现有插件安装体验不变。Agestra 会在首次使用时通
|
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
npm run bundle
|
|
27
|
-
npm run install:codex
|
|
27
|
+
npm run install:codex:assets
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
使用全局 npm 包时:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npm install -g agestra
|
|
34
|
+
agestra-install codex --assets
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Codex 会结合仓库根目录下的 [AGENTS.md](AGENTS.md) 与已注册的 `agestra` MCP 服务一起工作。`--assets` 还会在 `.codex/agents/` 下安装生成的 Codex custom agent,并写入 Agestra host-asset manifest。只注册 MCP 时,请使用 `npm run install:codex` 或 `agestra-install codex`。
|
|
31
38
|
|
|
32
39
|
### Gemini CLI
|
|
33
40
|
|
|
34
41
|
```
|
|
35
42
|
npm run bundle
|
|
36
|
-
npm run install:gemini
|
|
43
|
+
npm run install:gemini:assets
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
使用全局 npm 包时:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm install -g agestra
|
|
50
|
+
agestra-install gemini --assets --scope user
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Gemini 会结合仓库根目录下的 [GEMINI.md](GEMINI.md) 与 [`.gemini/commands/agestra/`](.gemini/commands/agestra) 项目命令一起工作。user scope 的 `--assets` 会安装 Agestra Gemini native extension。只注册 MCP 时,请使用 `npm run install:gemini` 或 `agestra-install gemini`。
|
|
40
54
|
|
|
41
55
|
安装后可用的 Gemini 命令:
|
|
42
56
|
|
|
57
|
+
- `/agestra:setup`
|
|
43
58
|
- `/agestra:review`
|
|
44
59
|
- `/agestra:design`
|
|
45
60
|
- `/agestra:idea`
|
|
@@ -329,8 +344,8 @@ agestra/
|
|
|
329
344
|
│ └── bundle.js # 单文件 MCP Server bundle
|
|
330
345
|
├── scripts/
|
|
331
346
|
│ ├── bundle.mjs # esbuild bundle 脚本
|
|
332
|
-
│ ├── install-host-mcp.mjs #
|
|
333
|
-
│ └── uninstall-host-mcp.mjs #
|
|
347
|
+
│ ├── install-host-mcp.mjs # 注册 Claude/Codex/Gemini MCP + host assets
|
|
348
|
+
│ └── uninstall-host-mcp.mjs # 移除宿主注册和受管理资产
|
|
334
349
|
├── packages/
|
|
335
350
|
│ ├── core/ # AIProvider 接口、注册表、安全、worker
|
|
336
351
|
│ ├── provider-ollama/ # Ollama HTTP 适配器
|
|
@@ -363,14 +378,18 @@ Codex CLI:
|
|
|
363
378
|
|
|
364
379
|
```
|
|
365
380
|
npm run uninstall:codex
|
|
381
|
+
npm run uninstall:codex:assets
|
|
366
382
|
```
|
|
367
383
|
|
|
368
384
|
Gemini CLI:
|
|
369
385
|
|
|
370
386
|
```
|
|
371
387
|
npm run uninstall:gemini
|
|
388
|
+
npm run uninstall:gemini:assets
|
|
372
389
|
```
|
|
373
390
|
|
|
391
|
+
`*:assets` 卸载命令会同时移除宿主注册和未修改的生成宿主资产。如果用户编辑过生成资产,Agestra 会保留该文件并报告。使用全局 npm 安装时,请运行 `agestra-uninstall codex --assets` 或 `agestra-uninstall gemini --assets --scope user`。
|
|
392
|
+
|
|
374
393
|
如果还想删除生成的项目数据,请手动删除 `.agestra/` 目录。
|
|
375
394
|
|
|
376
395
|
---
|
|
@@ -46,6 +46,10 @@ In autonomous mode, all phases still execute in order, but user approval gates a
|
|
|
46
46
|
|
|
47
47
|
<Workflow>
|
|
48
48
|
|
|
49
|
+
### Domain Dispatch
|
|
50
|
+
|
|
51
|
+
If invoked with **Domain: design**, do not enter implementation decomposition, worker routing, or code-changing phases. Execute the structured consensus design workflow in `commands/design.md`, then report the resulting design artifacts.
|
|
52
|
+
|
|
49
53
|
### Phase 0: Clarity Gate
|
|
50
54
|
|
|
51
55
|
If the user's request is vague (no file paths, no concrete acceptance criteria, ambiguous scope):
|
package/commands/design.md
CHANGED
|
@@ -9,12 +9,12 @@ You are executing the `/agestra design` command.
|
|
|
9
9
|
|
|
10
10
|
## Step 0: Setup preflight (MANDATORY)
|
|
11
11
|
|
|
12
|
-
Before anything else, call `setup_status`. If it reports `Current config: not found
|
|
12
|
+
Before anything else, call `setup_status`. If it reports `Current config: not found` (or the path exists but `setup_status` shows 0 detected providers with a missing-config note), **stop this command and run setup first**:
|
|
13
13
|
|
|
14
14
|
1. Invoke the `agestra:setup` skill (or `/agestra setup` inline) — provider detection, selection, locale, `setup_apply`.
|
|
15
15
|
2. After the config is written, resume this `/agestra design` command **from Step 1**, preserving `$ARGUMENTS`. Do not ask the user to retype.
|
|
16
16
|
|
|
17
|
-
Agestra uses a single plugin-scoped `providers.config.json
|
|
17
|
+
Agestra uses a single plugin-scoped `providers.config.json` (`$CLAUDE_PLUGIN_ROOT/providers.config.json` or `~/.agestra/providers.config.json`). No config → no sanctioned provider set → setup is the only correct starting point. Auto-detect without explicit setup can silently include disabled providers.
|
|
18
18
|
|
|
19
19
|
## Step 1: Determine design subject
|
|
20
20
|
|
|
@@ -34,47 +34,57 @@ If `$ARGUMENTS` is provided, use it directly as the subject.
|
|
|
34
34
|
|
|
35
35
|
## Step 2: Check environment and select mode
|
|
36
36
|
|
|
37
|
-
Call `environment_check` to determine which providers and modes are available.
|
|
37
|
+
Call `environment_check` and `provider_list` to determine which providers and modes are available.
|
|
38
38
|
|
|
39
39
|
- If **no providers are available**: run the `agestra:agestra-designer` host specialist directly (Leader-host only) with the subject as context. The designer will ask questions to understand intent, explore the codebase for existing patterns, propose 2-3 approaches with trade-offs, refine based on feedback, and produce a design document in `docs/plans/`. Skip to presenting the result.
|
|
40
40
|
- If **1+ providers are available**: proceed to consensus debate execution below.
|
|
41
41
|
|
|
42
|
+
Respect the providers list verbatim. A provider marked `Not found`, unavailable in `environment_check`, or disabled by setup MUST NOT be invoked. Do not probe disabled providers.
|
|
43
|
+
|
|
42
44
|
## Step 3: Execute consensus debate
|
|
43
45
|
|
|
44
|
-
**팀 구성:** `agestra:agestra-moderator` (조율) + `agestra:agestra-designer` (현재 호스트의 설계 전문 에이전트) +
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
3.
|
|
79
|
-
-
|
|
80
|
-
|
|
46
|
+
**팀 구성:** `agestra:agestra-moderator` (조율) + `agestra:agestra-designer` (현재 호스트의 설계 전문 에이전트) + `environment_check`가 Available로 보고한 외부 AI.
|
|
47
|
+
|
|
48
|
+
Follow the structured consensus document model from `docs/superpowers/specs/2026-04-25-structured-consensus-documents-design.md`:
|
|
49
|
+
|
|
50
|
+
| Artifact | Folder | Role |
|
|
51
|
+
|----------|--------|------|
|
|
52
|
+
| Individual design documents | `.agestra/workspace/individual/` | Raw first-pass source material from each participant |
|
|
53
|
+
| Consensus ledger JSON | `.agestra/workspace/debates/` | Authoritative system state |
|
|
54
|
+
| Aggregated debate Markdown | `.agestra/workspace/debates/` | Generated readable mirror of the JSON ledger |
|
|
55
|
+
| Synthesis document | `.agestra/workspace/synthesis/` | Self-contained final design decision document |
|
|
56
|
+
|
|
57
|
+
The JSON consensus ledger is the source of truth. Generated Markdown must not be parsed or hand-edited to change provider stances, item status, or consensus state.
|
|
58
|
+
|
|
59
|
+
1. Start an approval-gated structured debate with `agent_debate_structured`.
|
|
60
|
+
- **topic:** the design subject.
|
|
61
|
+
- **participants:** only providers reported available by `environment_check` / `provider_list`, plus the host design specialist when the engine supports it.
|
|
62
|
+
- **scope:** the design subject plus any user-provided constraints, relevant existing design docs, and code areas that should anchor the design.
|
|
63
|
+
- **leader:** the current leader identity when known.
|
|
64
|
+
- **locale:** the setup locale when known.
|
|
65
|
+
- **individual_review_prompt:** ask each participant to create a complete design document with:
|
|
66
|
+
1. Problem definition — what exactly is being solved and why.
|
|
67
|
+
2. Constraints and requirements — technical limits, compatibility needs, performance targets.
|
|
68
|
+
3. 2-3 architecture approaches — each with pros/cons, component boundaries, data flow, and effort estimate.
|
|
69
|
+
4. Recommended approach — one choice with justification.
|
|
70
|
+
5. Implementation plan — step-by-step build sequence with dependencies.
|
|
71
|
+
6. Risks and mitigations.
|
|
72
|
+
|
|
73
|
+
2. Let the MCP moderator engine own the consensus flow.
|
|
74
|
+
- The engine writes individual first-pass documents under `individual/`.
|
|
75
|
+
- The engine owns provider turn order, JSON turn packets, response validation, ledger updates, aggregated debate Markdown rendering, synthesis rendering, and the final terminal table.
|
|
76
|
+
- Participants submit explicit JSON stances through the MCP consensus turn packet.
|
|
77
|
+
- The leader/moderator must not infer agreement from prose and must not edit provider stances manually.
|
|
78
|
+
- There must be one generated aggregated debate Markdown document per run, not one Markdown document per provider turn or round.
|
|
79
|
+
|
|
80
|
+
3. Use the approval gate.
|
|
81
|
+
- If the terminal report says the session is `ready-for-approval`, inspect the report and call exactly one of:
|
|
82
|
+
- `agent_debate_approve` to write the synthesis document.
|
|
83
|
+
- `agent_debate_continue` to run 3, 5, or 10 more rounds.
|
|
84
|
+
- `agent_debate_reject` to close without synthesis.
|
|
85
|
+
- If the result is `error`, do not approve; report the orchestration failure.
|
|
86
|
+
|
|
87
|
+
4. Present the final result.
|
|
88
|
+
- Name the debate Markdown path, consensus JSON ledger path, approval snapshot path if surfaced, and synthesis document path if approved.
|
|
89
|
+
- Summarize accepted design decisions, excluded options, and unresolved/disputed items.
|
|
90
|
+
- Preserve each provider's rationale for disputed positions.
|
package/dist/bundle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as ___cr } from 'module';import { fileURLToPath as ___fu } from 'url';import { dirname as ___dn } from 'path';const __filename = ___fu(import.meta.url);const __dirname = ___dn(__filename);const require = ___cr(import.meta.url);
|
|
3
|
-
var l$=Object.create;var Uc=Object.defineProperty;var d$=Object.getOwnPropertyDescriptor;var p$=Object.getOwnPropertyNames;var f$=Object.getPrototypeOf,m$=Object.prototype.hasOwnProperty;var Rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),We=(t,e)=>{for(var r in e)Uc(t,r,{get:e[r],enumerable:!0})},h$=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p$(e))!m$.call(t,o)&&o!==r&&Uc(t,o,{get:()=>e[o],enumerable:!(n=d$(e,o))||n.enumerable});return t};var _f=(t,e,r)=>(r=t!=null?l$(f$(t)):{},h$(e||!t||!t.__esModule?Uc(r,"default",{value:t,enumerable:!0}):r,t));var bf,So,wf,xf,Sf,$f,kf,$o,Pf,_n,Tf,Ef,Rf,If,Af,Cf,Xs,qc,Vc,UL,Df,bn,Bc,zf,Of,Qs,Ir,Wc,Mf,Nf,wn,Wt=Rr(()=>{"use strict";bf="4.12.
|
|
3
|
+
var l$=Object.create;var Uc=Object.defineProperty;var d$=Object.getOwnPropertyDescriptor;var p$=Object.getOwnPropertyNames;var f$=Object.getPrototypeOf,m$=Object.prototype.hasOwnProperty;var Rr=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),We=(t,e)=>{for(var r in e)Uc(t,r,{get:e[r],enumerable:!0})},h$=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p$(e))!m$.call(t,o)&&o!==r&&Uc(t,o,{get:()=>e[o],enumerable:!(n=d$(e,o))||n.enumerable});return t};var _f=(t,e,r)=>(r=t!=null?l$(f$(t)):{},h$(e||!t||!t.__esModule?Uc(r,"default",{value:t,enumerable:!0}):r,t));var bf,So,wf,xf,Sf,$f,kf,$o,Pf,_n,Tf,Ef,Rf,If,Af,Cf,Xs,qc,Vc,UL,Df,bn,Bc,zf,Of,Qs,Ir,Wc,Mf,Nf,wn,Wt=Rr(()=>{"use strict";bf="4.12.1",So="http://localhost:11434",wf="llama3",xf=".agestra/.jobs",Sf=".agestra/traces",$f=".agestra/worktrees",kf=".agestra/sessions",$o=".agestra/workspace",Pf="individual",_n="debates",Tf="synthesis",Ef="issue",Rf=".agestra/workers",If=Object.freeze(["PATH","HOME","USER","USERPROFILE","APPDATA","LOCALAPPDATA","TEMP","TMP","TMPDIR","SHELL","LANG","LC_ALL","NODE_PATH","SystemRoot","SystemDrive","COMSPEC","ComSpec","windir"]),Af=2,Cf=6e4,Xs=20,qc=5e4,Vc=10,UL=Object.freeze([3,5,10]),Df=Object.freeze(["agree","disagree","abstain","revise"]),bn="votes",Bc=2,zf=1440*60*1e3,Of=3600*1e3,Qs=Object.freeze(["ko","zh","ja","en"]),Ir="ko",Wc="en",Mf="[REDACTED]",Nf=["","--- REQUIRED RESPONSE FORMAT ---","Respond with JSON only, matching exactly this shape:",'{ "agrees": true | false, "feedback": "specific issues or why you agree", "suggestions": "concrete changes if you disagree (optional, may be omitted)" }',"No prose, markdown, or explanation outside the JSON object. The JSON must be the entire response or wrapped in a single ```json code fence.","-------------------------------"].join(`
|
|
4
4
|
`),wn=Object.freeze({auto:Object.freeze({name:"auto",description:"Auto-detect build profile from project structure (package.json scripts, tsconfig, vitest config, etc.).",command:"npx",args:Object.freeze([])}),tsc:Object.freeze({name:"tsc",description:"TypeScript project-references build via `npx tsc -b --noEmit`.",command:"npx",args:Object.freeze(["tsc","-b","--noEmit"])}),vitest:Object.freeze({name:"vitest",description:"Run the Vitest unit-test suite in CI mode.",command:"npx",args:Object.freeze(["vitest","run","--reporter=dot"])}),"npm-build":Object.freeze({name:"npm-build",description:"Run the project's `npm run build` script.",command:"npm",args:Object.freeze(["run","build"])}),"npm-test":Object.freeze({name:"npm-test",description:"Run the project's `npm test` script.",command:"npm",args:Object.freeze(["test","--","--run"])})})});import{execFileSync as g$}from"child_process";function xn(t){if(!Number.isFinite(t)||t<=0)return{delivered:!1};if(process.platform==="win32")try{return g$("taskkill",["/PID",String(t),"/T","/F"],{stdio:"ignore",windowsHide:!0}),{delivered:!0}}catch{try{return process.kill(t),{delivered:!0}}catch{return{delivered:!1}}}try{return process.kill(-t,"SIGTERM"),{delivered:!0}}catch{try{return process.kill(t,"SIGTERM"),{delivered:!0}}catch{return{delivered:!1}}}}function Ct(t,e=3e3){let r=t.pid;if(r)xn(r);else try{t.kill("SIGTERM")}catch{}setTimeout(()=>{try{t.kill("SIGKILL")}catch{}},e).unref?.()}var ko=Rr(()=>{"use strict"});import{execFileSync as y$,spawn as v$}from"child_process";import{existsSync as _$}from"fs";function w$(t){return process.platform!=="win32"||t.includes("/")||t.includes("\\")?!1:b$.has(t.toLowerCase())}function x$(t){if(t.includes("\0"))throw new Error(`Windows shim arg contains null byte: ${JSON.stringify(t)}`);if(t.includes("%"))throw new Error(`Windows shim arg contains '%' which would trigger cmd.exe env expansion: ${JSON.stringify(t)}`);return/[\s"&^<>|()!]/.test(t)?`"${t.replace(/"/g,'""')}"`:t}function S$(t){let e=t.toLowerCase();if(Sn.has(e))return Sn.get(e)??null;try{let n=y$("where.exe",[t],{encoding:"utf-8",stdio:["ignore","pipe","ignore"],windowsHide:!0,timeout:5e3}).split(/\r?\n/).map(a=>a.trim()).filter(Boolean);if(n.length===0)return Sn.set(e,null),null;let o=n.find(a=>/\.(cmd|bat)$/i.test(a));if(o){let a={type:"cmd",path:o};return Sn.set(e,a),a}let i=`${n[0]}.ps1`;if(_$(i)){let a={type:"powershell",path:i};return Sn.set(e,a),a}}catch{}return Sn.set(e,null),null}function Ht(t,e){if(!w$(t))return{command:t,args:e};let r=S$(t);return r?r.type==="cmd"?{command:"cmd.exe",args:["/d","/s","/c",r.path,...e.map(n=>x$(n))]}:{command:"powershell.exe",args:["-NoProfile","-ExecutionPolicy","RemoteSigned","-File",r.path,...e]}:{command:t,args:e}}function je(t){let{command:e,args:r,timeout:n=12e4,cwd:o,env:s,stdin:i,maxBuffer:a=10485760,onStderrChunk:c,signal:u}=t;return new Promise((l,d)=>{if(u?.aborted){d(new ct(u.reason));return}let p=Ht(e,r),f=v$(p.command,p.args,{cwd:o,env:s?{...process.env,...s}:void 0,stdio:[i?"pipe":"ignore","pipe","pipe"],windowsHide:!0}),m="",g="",y=0,v=0,x=!1,b=null,P=!1,T=null,W=()=>{T&&u&&u.removeEventListener("abort",T)},$=!1,j=()=>{!$&&y+v>a&&(x=!0,$=!0,Ct(f))},Z=()=>{P||(Ct(f),P=!0,W(),d(new Error(`CLI timeout after ${n}ms of inactivity: ${e} ${r.join(" ")}`)))},L=setTimeout(Z,n);u&&(T=()=>{P||(P=!0,clearTimeout(L),Ct(f),W(),d(new ct(u.reason)))},u.addEventListener("abort",T));let Te=()=>{$||(clearTimeout(L),L=setTimeout(Z,n))};if(f.stdout.on("data",Ee=>{y+=Ee.length,y<=a&&(m+=Ee.toString()),j(),Te()}),f.stderr.on("data",Ee=>{v+=Ee.length;let It=Ee.toString();if(v<=a&&(g+=It),j(),!$&&c){let gn=c(It);gn&&(b=gn,$=!0,Ct(f))}Te()}),i&&f.stdin){f.stdin.on("error",()=>{});try{f.stdin.write(i),f.stdin.end()}catch{}}f.on("close",Ee=>{if(clearTimeout(L),!P){if(b){P=!0,W(),d(b);return}P=!0,W(),l({stdout:m,stderr:g,exitCode:Ee??1,truncated:x})}}),f.on("error",Ee=>{clearTimeout(L),!P&&(P=!0,W(),d(new Error(`CLI spawn error: ${Ee.message}`)))})})}var ct,b$,Sn,$n=Rr(()=>{"use strict";ko();ct=class extends Error{constructor(e){let r=e instanceof Error?`: ${e.message}`:typeof e=="string"&&e?`: ${e}`:"";super(`CLI aborted${r}`),this.name="CliAbortedError"}},b$=new Set(["codex","gemini","npm","npx"]),Sn=new Map});import{writeFileSync as Wk,mkdirSync as Io,openSync as Yc,writeSync as Xc,fsyncSync as nm,closeSync as Qc,renameSync as Hk,unlinkSync as rm,appendFileSync as Kk,copyFileSync as Jk}from"fs";import{dirname as Ao,join as Gk}from"path";import{randomUUID as Yk}from"crypto";function oe(t,e){let r=Ao(t);Io(r,{recursive:!0});let n=Gk(r,`.tmp-${Yk().slice(0,8)}`);try{Wk(n,e,"utf-8");try{Hk(n,t)}catch(o){if(o.code!=="EXDEV")throw o;Jk(n,t),rm(n)}}catch(o){try{rm(n)}catch{}throw o}}function Re(t,e){oe(t,JSON.stringify(e,null,2))}function di(t,e){let r=Ao(t);Io(r,{recursive:!0});let n=Yc(t,"a");try{Xc(n,e),nm(n)}finally{Qc(n)}}var li,pi=Rr(()=>{"use strict";li=class{buffer=new Map;flushTimer=null;flushIntervalMs;maxBufferSize;auditFsync;destroyed=!1;constructor(e){this.flushIntervalMs=e?.flushIntervalMs??2e3,this.maxBufferSize=e?.maxBufferSize??100,this.auditFsync=e?.auditFsync??!0,this.flushIntervalMs>0&&(this.flushTimer=setInterval(()=>this.flush(),this.flushIntervalMs),this.flushTimer&&typeof this.flushTimer.unref=="function"&&this.flushTimer.unref())}append(e,r,n){if(this.destroyed)throw new Error("DurableAppendWriter has been destroyed");if(n==="audit"){if(this.auditFsync)di(e,r);else{let s=Ao(e);Io(s,{recursive:!0}),Kk(e,r)}return}let o=this.buffer.get(e);o||(o=[],this.buffer.set(e,o)),o.push(r),o.length>=this.maxBufferSize&&this.flushFile(e),this.flushIntervalMs===0&&this.flushFile(e)}flush(){for(let e of this.buffer.keys())this.flushFile(e)}panicFlush(){for(let[e,r]of this.buffer)if(r.length!==0)try{let n=Ao(e);Io(n,{recursive:!0});let o=Yc(e,"a");try{Xc(o,r.join("")),nm(o)}finally{Qc(o)}}catch{}this.buffer.clear()}destroy(){this.destroyed||(this.destroyed=!0,this.flushTimer!==null&&(clearInterval(this.flushTimer),this.flushTimer=null),this.flush())}flushFile(e){let r=this.buffer.get(e);if(!r||r.length===0)return;let n=Ao(e);Io(n,{recursive:!0});let o=Yc(e,"a");try{Xc(o,r.join(""))}finally{Qc(o)}this.buffer.delete(e)}}});import{openSync as Xk,writeSync as Qk,closeSync as e0,unlinkSync as om,statSync as t0,mkdirSync as r0}from"fs";import{dirname as n0}from"path";function a0(t){if(t<=0)return;let e=new SharedArrayBuffer(4),r=new Int32Array(e);Atomics.wait(r,0,0,t)}function Kr(t,e,r={}){let n=r.staleMs??o0,o=r.acquireTimeoutMs??s0,s=r.pollMs??i0;r0(n0(t),{recursive:!0});let i=Date.now(),a=null;for(;a===null;)try{a=Xk(t,"wx")}catch(c){if(c.code!=="EEXIST")throw c;let l=!1;try{let p=t0(t);l=Date.now()-p.mtimeMs>n}catch{continue}if(l){try{om(t)}catch{}continue}let d=Date.now()-i;if(d>=o)throw new eu(t,d);a0(s)}try{try{Qk(a,`${process.pid}@${Date.now()}
|
|
5
5
|
`)}catch{}return e()}finally{try{e0(a)}catch{}try{om(t)}catch{}}}var o0,s0,i0,eu,tu=Rr(()=>{"use strict";o0=3e4,s0=5e3,i0=10,eu=class extends Error{constructor(e,r){super(`withFileLock: timed out after ${r}ms waiting for ${e}`),this.name="FileLockTimeoutError"}}});import{existsSync as sm,realpathSync as c0}from"fs";import{basename as u0,dirname as l0,isAbsolute as nu,join as d0,normalize as am,resolve as ou,relative as p0}from"path";function f0(t){return t===""||!t.startsWith("..")&&!nu(t)}function ru(t){let e=[],r=ou(t);for(;!sm(r);){let o=l0(r);if(o===r)break;e.unshift(u0(r)),r=o}let n=sm(r)?c0(r):r;return e.reduce((o,s)=>d0(o,s),n)}function cm(t,e){let r=ru(e),n=ru(t),o=p0(r,n);return f0(o)}function su(t,e){let r=ou(e,t);return cm(r,e)}function pt(t,e){let r=ou(e,t);if(!cm(r,e))throw new Error(`Path traversal blocked: ${t} escapes ${e}`);return r}function Fe(t,e){if(t.length===0)throw new Error("Filename must not be empty");if(t.includes("\0"))throw new Error(`Filename contains null byte: ${JSON.stringify(t)}`);if(t.includes("/")||t.includes("\\"))throw new Error(`Filename must not contain path separators: ${JSON.stringify(t)}`);if(t.includes(".."))throw new Error(`Filename must not contain '..': ${JSON.stringify(t)}`);return pt(t,e)}function Qt(t,e){if(nu(t)){let r=am(t);if(!su(r,e))throw new Error(`Read path outside base directory: ${t} is not within ${e}`);return r}return pt(t,e)}function iu(t,e){return nu(t)?ru(am(t)):pt(t,e)}function fr(t){return m0.test(t)}function fi(t,e){if(!t||typeof t!="string")throw new st(String(t),"command must be a non-empty string");if(t.includes("\0"))throw new st(t,"command contains null byte");if(t.includes("/")||t.includes("\\"))throw new st(t,"command must not contain path separators");if(!im.has(t))throw new st(t,`command is not in the allowlist (${[...im].join(", ")})`);for(let r of e){if(typeof r!="string")throw new st(t,`args contain a non-string entry: ${JSON.stringify(r)}`);if(r.includes("\0"))throw new st(t,`arg contains null byte: ${JSON.stringify(r)}`);if(h0.has(r))throw new st(t,`arg ${JSON.stringify(r)} is a code-execution flag and is not permitted`)}}var m0,im,h0,st,Co=Rr(()=>{"use strict";m0=/^[a-zA-Z0-9_-]+-\d+-[a-f0-9]{6}$/;im=new Set(["gemini","codex","claude","npx","node","npm","tsc"]),h0=new Set(["-e","--eval","-c","--command","-E","--execute","--exec"]),st=class extends Error{command;reason;constructor(e,r){super(`CLI command rejected: ${e} \u2014 ${r}`),this.command=e,this.reason=r,this.name="CliCommandRejectedError"}}});var dm={};We(dm,{CLI_PROVIDERS:()=>um,resolveCliConfig:()=>lm});import{readFileSync as au}from"fs";import{join as it}from"path";import{spawn as g0}from"child_process";function lm(t){let e=y0[t.provider]??t.provider;return um[e]??null}function Jr(t,e){let r=it(t,"status.json"),n=`${r}.lock`;Kr(n,()=>{let o=JSON.parse(au(r,"utf-8"));Re(r,{...o,...e})})}async function v0(){let t=process.argv[2];t||process.exit(1);let e;try{e=JSON.parse(au(it(t,"job.json"),"utf-8"))}catch{try{Re(it(t,"status.json"),{id:"unknown",state:"error",provider:"unknown",completedAt:new Date().toISOString()}),oe(it(t,"error.txt"),"Failed to read job.json")}catch{}process.exit(1)}let r=lm(e);r||(Jr(t,{state:"missing_cli",completedAt:new Date().toISOString()}),oe(it(t,"error.txt"),`No CLI mapping for provider: ${e.provider}`),process.exit(1));let{command:n,buildArgs:o}=r;Jr(t,{state:"running",startedAt:new Date().toISOString()});let s=au(it(t,"prompt.txt"),"utf-8"),i=o(s);try{fi(n,i)}catch(c){let u=c instanceof st?c.message:`Argv rejected: ${c.message}`;Jr(t,{state:"error",completedAt:new Date().toISOString()}),oe(it(t,"error.txt"),u);return}let a;if(e.cwd)try{a=pt(e.cwd,process.cwd())}catch(c){Jr(t,{state:"error",completedAt:new Date().toISOString()}),oe(it(t,"error.txt"),`Rejected descriptor.cwd: ${c.message}`);return}return new Promise(c=>{let u=Ht(n,i),l=g0(u.command,u.args,{cwd:a,stdio:["ignore","pipe","pipe"],windowsHide:!0}),d="",p="",f=0,m=0;l.stdout.on("data",y=>{f+=y.length,f<=10485760&&(d+=y.toString())}),l.stderr.on("data",y=>{m+=y.length,m<=10485760&&(p+=y.toString())});let g=setTimeout(()=>{Ct(l),oe(it(t,"output.txt"),d),oe(it(t,"error.txt"),p),Jr(t,{state:"timed_out",completedAt:new Date().toISOString()}),c()},e.timeout);l.on("close",y=>{clearTimeout(g),oe(it(t,"output.txt"),d),oe(it(t,"error.txt"),p);let v=d.trim().length>0;Jr(t,{state:y===0||v?"completed":"error",exitCode:y??1,completedAt:new Date().toISOString()}),c()}),l.on("error",y=>{clearTimeout(g);let v=y.code==="ENOENT"?"missing_cli":"error";oe(it(t,"error.txt"),y.message),Jr(t,{state:v,completedAt:new Date().toISOString()}),c()})})}var y0,um,_0,pm=Rr(()=>{"use strict";pi();tu();ko();Co();$n();y0={"gemini-cli":"gemini","codex-cli":"codex","claude-cli":"claude"},um={gemini:{command:"gemini",buildArgs:t=>["-p",t]},codex:{command:"codex",buildArgs:t=>["exec","--skip-git-repo-check","--full-auto","--ephemeral",t]},claude:{command:"claude",buildArgs:t=>["-p",t]}};_0=process.argv[1]?.endsWith("job-worker.js")||process.argv[1]?.endsWith("job-worker.ts");_0&&v0().catch(()=>process.exit(1))});var _s=R(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.regexpCode=ie.getEsmExportName=ie.getProperty=ie.safeStringify=ie.stringify=ie.strConcat=ie.addCodeArg=ie.str=ie._=ie.nil=ie._Code=ie.Name=ie.IDENTIFIER=ie._CodeOrName=void 0;var ys=class{};ie._CodeOrName=ys;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var on=class extends ys{constructor(e){if(super(),!ie.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ie.Name=on;var gt=class extends ys{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof on&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=gt;ie.nil=new gt("");function p_(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Ul(r,e[n]),r.push(t[++n]);return new gt(r)}ie._=p_;var Zl=new gt("+");function f_(t,...e){let r=[vs(t[0])],n=0;for(;n<e.length;)r.push(Zl),Ul(r,e[n]),r.push(Zl,vs(t[++n]));return yI(r),new gt(r)}ie.str=f_;function Ul(t,e){e instanceof gt?t.push(...e._items):e instanceof on?t.push(e):t.push(bI(e))}ie.addCodeArg=Ul;function yI(t){let e=1;for(;e<t.length-1;){if(t[e]===Zl){let r=vI(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function vI(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof on||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof on))return`"${t}${e.slice(1)}`}function _I(t,e){return e.emptyStr()?t:t.emptyStr()?e:f_`${t}${e}`}ie.strConcat=_I;function bI(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:vs(Array.isArray(t)?t.join(","):t)}function wI(t){return new gt(vs(t))}ie.stringify=wI;function vs(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=vs;function xI(t){return typeof t=="string"&&ie.IDENTIFIER.test(t)?new gt(`.${t}`):p_`[${t}]`}ie.getProperty=xI;function SI(t){if(typeof t=="string"&&ie.IDENTIFIER.test(t))return new gt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ie.getEsmExportName=SI;function $I(t){return new gt(t.toString())}ie.regexpCode=$I});var Bl=R(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.ValueScope=rt.ValueScopeName=rt.Scope=rt.varKinds=rt.UsedValueState=void 0;var tt=_s(),ql=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},_a;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(_a||(rt.UsedValueState=_a={}));rt.varKinds={const:new tt.Name("const"),let:new tt.Name("let"),var:new tt.Name("var")};var ba=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof tt.Name?e:this.name(e)}name(e){return new tt.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};rt.Scope=ba;var wa=class extends tt.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,tt._)`.${new tt.Name(r)}[${n}]`}};rt.ValueScopeName=wa;var kI=(0,tt._)`\n`,Vl=class extends ba{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?kI:tt.nil}}get(){return this._scope}name(e){return new wa(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,tt._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=tt.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,_a.Started);let l=r(u);if(l){let d=this.opts.es5?rt.varKinds.var:rt.varKinds.const;s=(0,tt._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,tt._)`${s}${l}${this.opts._n}`;else throw new ql(u);c.set(u,_a.Completed)})}return s}};rt.ValueScope=Vl});var J=R(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.or=G.and=G.not=G.CodeGen=G.operators=G.varKinds=G.ValueScopeName=G.ValueScope=G.Scope=G.Name=G.regexpCode=G.stringify=G.getProperty=G.nil=G.strConcat=G.str=G._=void 0;var ne=_s(),$t=Bl(),br=_s();Object.defineProperty(G,"_",{enumerable:!0,get:function(){return br._}});Object.defineProperty(G,"str",{enumerable:!0,get:function(){return br.str}});Object.defineProperty(G,"strConcat",{enumerable:!0,get:function(){return br.strConcat}});Object.defineProperty(G,"nil",{enumerable:!0,get:function(){return br.nil}});Object.defineProperty(G,"getProperty",{enumerable:!0,get:function(){return br.getProperty}});Object.defineProperty(G,"stringify",{enumerable:!0,get:function(){return br.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:!0,get:function(){return br.regexpCode}});Object.defineProperty(G,"Name",{enumerable:!0,get:function(){return br.Name}});var ka=Bl();Object.defineProperty(G,"Scope",{enumerable:!0,get:function(){return ka.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:!0,get:function(){return ka.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:!0,get:function(){return ka.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:!0,get:function(){return ka.varKinds}});G.operators={GT:new ne._Code(">"),GTE:new ne._Code(">="),LT:new ne._Code("<"),LTE:new ne._Code("<="),EQ:new ne._Code("==="),NEQ:new ne._Code("!=="),NOT:new ne._Code("!"),OR:new ne._Code("||"),AND:new ne._Code("&&"),ADD:new ne._Code("+")};var rr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Wl=class extends rr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?$t.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Yn(this.rhs,e,r)),this}get names(){return this.rhs instanceof ne._CodeOrName?this.rhs.names:{}}},xa=class extends rr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ne.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Yn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ne.Name?{}:{...this.lhs.names};return $a(e,this.rhs)}},Hl=class extends xa{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Kl=class extends rr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Jl=class extends rr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Gl=class extends rr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Yl=class extends rr{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Yn(this.code,e,r),this}get names(){return this.code instanceof ne._CodeOrName?this.code.names:{}}},bs=class extends rr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(PI(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>cn(e,r.names),{})}},nr=class extends bs{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Xl=class extends bs{},Gn=class extends nr{};Gn.kind="else";var sn=class t extends nr{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Gn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(m_(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Yn(this.condition,e,r),this}get names(){let e=super.names;return $a(e,this.condition),this.else&&cn(e,this.else.names),e}};sn.kind="if";var an=class extends nr{};an.kind="for";var Ql=class extends an{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Yn(this.iteration,e,r),this}get names(){return cn(super.names,this.iteration.names)}},ed=class extends an{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?$t.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=$a(super.names,this.from);return $a(e,this.to)}},Sa=class extends an{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Yn(this.iterable,e,r),this}get names(){return cn(super.names,this.iterable.names)}},ws=class extends nr{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};ws.kind="func";var xs=class extends bs{render(e){return"return "+super.render(e)}};xs.kind="return";var td=class extends nr{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&cn(e,this.catch.names),this.finally&&cn(e,this.finally.names),e}},Ss=class extends nr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Ss.kind="catch";var $s=class extends nr{render(e){return"finally"+super.render(e)}};$s.kind="finally";var rd=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
6
6
|
`:""},this._extScope=e,this._scope=new $t.Scope({parent:e}),this._nodes=[new Xl]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Wl(e,s,n)),s}const(e,r,n){return this._def($t.varKinds.const,e,r,n)}let(e,r,n){return this._def($t.varKinds.let,e,r,n)}var(e,r,n){return this._def($t.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new xa(e,r,n))}add(e,r){return this._leafNode(new Hl(e,G.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ne.nil&&this._leafNode(new Yl(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,ne.addCodeArg)(r,o));return r.push("}"),new ne._Code(r)}if(e,r,n){if(this._blockNode(new sn(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new sn(e))}else(){return this._elseNode(new Gn)}endIf(){return this._endBlockNode(sn,Gn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Ql(e),r)}forRange(e,r,n,o,s=this.opts.es5?$t.varKinds.var:$t.varKinds.let){let i=this._scope.toName(e);return this._for(new ed(s,i,r,n),()=>o(i))}forOf(e,r,n,o=$t.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof ne.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ne._)`${i}.length`,a=>{this.var(s,(0,ne._)`${i}[${a}]`),n(s)})}return this._for(new Sa("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?$t.varKinds.var:$t.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ne._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Sa("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(an)}label(e){return this._leafNode(new Kl(e))}break(e){return this._leafNode(new Jl(e))}return(e){let r=new xs;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(xs)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new td;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new Ss(s),r(s)}return n&&(this._currNode=o.finally=new $s,this.code(n)),this._endBlockNode(Ss,$s)}throw(e){return this._leafNode(new Gl(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ne.nil,n,o){return this._blockNode(new ws(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ws)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof sn))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};G.CodeGen=rd;function cn(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function $a(t,e){return e instanceof ne._CodeOrName?cn(t,e.names):t}function Yn(t,e,r){if(t instanceof ne.Name)return n(t);if(!o(t))return t;return new ne._Code(t._items.reduce((s,i)=>(i instanceof ne.Name&&(i=n(i)),i instanceof ne._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof ne._Code&&s._items.some(i=>i instanceof ne.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function PI(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function m_(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ne._)`!${nd(t)}`}G.not=m_;var TI=h_(G.operators.AND);function EI(...t){return t.reduce(TI)}G.and=EI;var RI=h_(G.operators.OR);function II(...t){return t.reduce(RI)}G.or=II;function h_(t){return(e,r)=>e===ne.nil?r:r===ne.nil?e:(0,ne._)`${nd(e)} ${t} ${nd(r)}`}function nd(t){return t instanceof ne.Name?t:(0,ne._)`(${t})`}});var ae=R(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.checkStrictMode=Y.getErrorPath=Y.Type=Y.useFunc=Y.setEvaluated=Y.evaluatedPropsToName=Y.mergeEvaluated=Y.eachItem=Y.unescapeJsonPointer=Y.escapeJsonPointer=Y.escapeFragment=Y.unescapeFragment=Y.schemaRefOrVal=Y.schemaHasRulesButRef=Y.schemaHasRules=Y.checkUnknownRules=Y.alwaysValidSchema=Y.toHash=void 0;var de=J(),AI=_s();function CI(t){let e={};for(let r of t)e[r]=!0;return e}Y.toHash=CI;function DI(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(v_(t,e),!__(e,t.self.RULES.all))}Y.alwaysValidSchema=DI;function v_(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||x_(t,`unknown keyword: "${s}"`)}Y.checkUnknownRules=v_;function __(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Y.schemaHasRules=__;function zI(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Y.schemaHasRulesButRef=zI;function OI({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,de._)`${r}`}return(0,de._)`${t}${e}${(0,de.getProperty)(n)}`}Y.schemaRefOrVal=OI;function MI(t){return b_(decodeURIComponent(t))}Y.unescapeFragment=MI;function NI(t){return encodeURIComponent(sd(t))}Y.escapeFragment=NI;function sd(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Y.escapeJsonPointer=sd;function b_(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Y.unescapeJsonPointer=b_;function jI(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Y.eachItem=jI;function g_({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof de.Name?(s instanceof de.Name?t(o,s,i):e(o,s,i),i):s instanceof de.Name?(e(o,i,s),s):r(s,i);return a===de.Name&&!(c instanceof de.Name)?n(o,c):c}}Y.mergeEvaluated={props:g_({mergeNames:(t,e,r)=>t.if((0,de._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,de._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,de._)`${r} || {}`).code((0,de._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,de._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,de._)`${r} || {}`),id(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:w_}),items:g_({mergeNames:(t,e,r)=>t.if((0,de._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,de._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,de._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,de._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function w_(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,de._)`{}`);return e!==void 0&&id(t,r,e),r}Y.evaluatedPropsToName=w_;function id(t,e,r){Object.keys(r).forEach(n=>t.assign((0,de._)`${e}${(0,de.getProperty)(n)}`,!0))}Y.setEvaluated=id;var y_={};function LI(t,e){return t.scopeValue("func",{ref:e,code:y_[e.code]||(y_[e.code]=new AI._Code(e.code))})}Y.useFunc=LI;var od;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(od||(Y.Type=od={}));function FI(t,e,r){if(t instanceof de.Name){let n=e===od.Num;return r?n?(0,de._)`"[" + ${t} + "]"`:(0,de._)`"['" + ${t} + "']"`:n?(0,de._)`"/" + ${t}`:(0,de._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,de.getProperty)(t).toString():"/"+sd(t)}Y.getErrorPath=FI;function x_(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Y.checkStrictMode=x_});var or=R(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var qe=J(),ZI={data:new qe.Name("data"),valCxt:new qe.Name("valCxt"),instancePath:new qe.Name("instancePath"),parentData:new qe.Name("parentData"),parentDataProperty:new qe.Name("parentDataProperty"),rootData:new qe.Name("rootData"),dynamicAnchors:new qe.Name("dynamicAnchors"),vErrors:new qe.Name("vErrors"),errors:new qe.Name("errors"),this:new qe.Name("this"),self:new qe.Name("self"),scope:new qe.Name("scope"),json:new qe.Name("json"),jsonPos:new qe.Name("jsonPos"),jsonLen:new qe.Name("jsonLen"),jsonPart:new qe.Name("jsonPart")};ad.default=ZI});var ks=R(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.extendErrors=Ve.resetErrorsCount=Ve.reportExtraError=Ve.reportError=Ve.keyword$DataError=Ve.keywordError=void 0;var se=J(),Pa=ae(),Ge=or();Ve.keywordError={message:({keyword:t})=>(0,se.str)`must pass "${t}" keyword validation`};Ve.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,se.str)`"${t}" keyword must be ${e} ($data)`:(0,se.str)`"${t}" keyword is invalid ($data)`};function UI(t,e=Ve.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=k_(t,e,r);n??(i||a)?S_(s,c):$_(o,(0,se._)`[${c}]`)}Ve.reportError=UI;function qI(t,e=Ve.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=k_(t,e,r);S_(o,a),s||i||$_(n,Ge.default.vErrors)}Ve.reportExtraError=qI;function VI(t,e){t.assign(Ge.default.errors,e),t.if((0,se._)`${Ge.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,se._)`${Ge.default.vErrors}.length`,e),()=>t.assign(Ge.default.vErrors,null)))}Ve.resetErrorsCount=VI;function BI({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Ge.default.errors,a=>{t.const(i,(0,se._)`${Ge.default.vErrors}[${a}]`),t.if((0,se._)`${i}.instancePath === undefined`,()=>t.assign((0,se._)`${i}.instancePath`,(0,se.strConcat)(Ge.default.instancePath,s.errorPath))),t.assign((0,se._)`${i}.schemaPath`,(0,se.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,se._)`${i}.schema`,r),t.assign((0,se._)`${i}.data`,n))})}Ve.extendErrors=BI;function S_(t,e){let r=t.const("err",e);t.if((0,se._)`${Ge.default.vErrors} === null`,()=>t.assign(Ge.default.vErrors,(0,se._)`[${r}]`),(0,se._)`${Ge.default.vErrors}.push(${r})`),t.code((0,se._)`${Ge.default.errors}++`)}function $_(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,se._)`new ${t.ValidationError}(${e})`):(r.assign((0,se._)`${n}.errors`,e),r.return(!1))}var un={keyword:new se.Name("keyword"),schemaPath:new se.Name("schemaPath"),params:new se.Name("params"),propertyName:new se.Name("propertyName"),message:new se.Name("message"),schema:new se.Name("schema"),parentSchema:new se.Name("parentSchema")};function k_(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,se._)`{}`:WI(t,e,r)}function WI(t,e,r={}){let{gen:n,it:o}=t,s=[HI(o,r),KI(t,r)];return JI(t,e,s),n.object(...s)}function HI({errorPath:t},{instancePath:e}){let r=e?(0,se.str)`${t}${(0,Pa.getErrorPath)(e,Pa.Type.Str)}`:t;return[Ge.default.instancePath,(0,se.strConcat)(Ge.default.instancePath,r)]}function KI({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,se.str)`${e}/${t}`;return r&&(o=(0,se.str)`${o}${(0,Pa.getErrorPath)(r,Pa.Type.Str)}`),[un.schemaPath,o]}function JI(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([un.keyword,o],[un.params,typeof e=="function"?e(t):e||(0,se._)`{}`]),c.messages&&n.push([un.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([un.schema,i],[un.parentSchema,(0,se._)`${l}${d}`],[Ge.default.data,s]),u&&n.push([un.propertyName,u])}});var T_=R(Xn=>{"use strict";Object.defineProperty(Xn,"__esModule",{value:!0});Xn.boolOrEmptySchema=Xn.topBoolOrEmptySchema=void 0;var GI=ks(),YI=J(),XI=or(),QI={message:"boolean schema is false"};function eA(t){let{gen:e,schema:r,validateName:n}=t;r===!1?P_(t,!1):typeof r=="object"&&r.$async===!0?e.return(XI.default.data):(e.assign((0,YI._)`${n}.errors`,null),e.return(!0))}Xn.topBoolOrEmptySchema=eA;function tA(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),P_(t)):r.var(e,!0)}Xn.boolOrEmptySchema=tA;function P_(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,GI.reportError)(o,QI,void 0,e)}});var cd=R(Qn=>{"use strict";Object.defineProperty(Qn,"__esModule",{value:!0});Qn.getRules=Qn.isJSONType=void 0;var rA=["string","number","integer","boolean","null","object","array"],nA=new Set(rA);function oA(t){return typeof t=="string"&&nA.has(t)}Qn.isJSONType=oA;function sA(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Qn.getRules=sA});var ud=R(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.shouldUseRule=wr.shouldUseGroup=wr.schemaHasRulesForType=void 0;function iA({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&E_(t,n)}wr.schemaHasRulesForType=iA;function E_(t,e){return e.rules.some(r=>R_(t,r))}wr.shouldUseGroup=E_;function R_(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}wr.shouldUseRule=R_});var Ps=R(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.reportTypeError=Be.checkDataTypes=Be.checkDataType=Be.coerceAndCheckDataType=Be.getJSONTypes=Be.getSchemaTypes=Be.DataType=void 0;var aA=cd(),cA=ud(),uA=ks(),V=J(),I_=ae(),eo;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(eo||(Be.DataType=eo={}));function lA(t){let e=A_(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Be.getSchemaTypes=lA;function A_(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(aA.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Be.getJSONTypes=A_;function dA(t,e){let{gen:r,data:n,opts:o}=t,s=pA(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,cA.schemaHasRulesForType)(t,e[0]));if(i){let a=dd(e,n,o.strictNumbers,eo.Wrong);r.if(a,()=>{s.length?fA(t,e,s):pd(t)})}return i}Be.coerceAndCheckDataType=dA;var C_=new Set(["string","number","integer","boolean","null"]);function pA(t,e){return e?t.filter(r=>C_.has(r)||e==="array"&&r==="array"):[]}function fA(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,V._)`typeof ${o}`),a=n.let("coerced",(0,V._)`undefined`);s.coerceTypes==="array"&&n.if((0,V._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,V._)`${o}[0]`).assign(i,(0,V._)`typeof ${o}`).if(dd(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,V._)`${a} !== undefined`);for(let u of r)(C_.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),pd(t),n.endIf(),n.if((0,V._)`${a} !== undefined`,()=>{n.assign(o,a),mA(t,a)});function c(u){switch(u){case"string":n.elseIf((0,V._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,V._)`"" + ${o}`).elseIf((0,V._)`${o} === null`).assign(a,(0,V._)`""`);return;case"number":n.elseIf((0,V._)`${i} == "boolean" || ${o} === null
|
package/package.json
CHANGED
package/skills/design.md
CHANGED
|
@@ -74,49 +74,61 @@ Brownfield: modifying or extending existing code.
|
|
|
74
74
|
|
|
75
75
|
### Phase 2: Check environment and select mode
|
|
76
76
|
|
|
77
|
-
Call `environment_check` to determine available providers.
|
|
77
|
+
Call `environment_check` and `provider_list` to determine available providers.
|
|
78
78
|
|
|
79
79
|
- If **no providers are available**: proceed to Phase 3 (Explore → Propose → Refine → Document) directly using `agestra:agestra-designer` host specialist (Leader-host only).
|
|
80
80
|
- If **1+ providers are available**: proceed to consensus debate execution below.
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
**팀 구성:** `agestra:agestra-moderator` (조율) + `agestra:agestra-designer` (현재 호스트의 설계 전문 에이전트) + 사용 가능한 외부 AI (gemini, codex 등)
|
|
85
|
-
|
|
86
|
-
1. Independent work + initial aggregation:
|
|
87
|
-
|
|
88
|
-
a. In parallel:
|
|
89
|
-
- Spawn the `agestra:agestra-designer` agent for host-local independent architecture exploration.
|
|
90
|
-
After the agent completes, save the host designer's result as a document via `workspace_create_document`:
|
|
91
|
-
- **title:** `Architecture Design — host/designer`
|
|
92
|
-
- **metadata:** `{ "Provider": "host/designer", "Task": "{subject}", "Mode": "Independent" }`
|
|
93
|
-
- **content:** The designer agent's full output.
|
|
94
|
-
- For each available provider, call `ai_chat` with `save_as_document`:
|
|
95
|
-
- **save_as_document.title:** `Architecture Design — {provider}`
|
|
96
|
-
- **save_as_document.metadata:** `{ "Task": "{subject}", "Mode": "Independent" }`
|
|
97
|
-
- **prompt:** Create a complete design document for [subject]. Include: 1) Problem definition — what exactly we're solving and why. 2) Constraints and requirements — technical limits, compatibility needs, performance targets. 3) 2-3 architecture approaches — each with detailed pros/cons, component diagrams, data flow, and effort estimates. 4) Recommended approach — pick one and justify the choice. 5) Implementation plan — step-by-step build sequence with dependencies. 6) Risks and mitigations. Be thorough and detailed — this document will be debated and refined.
|
|
98
|
-
|
|
99
|
-
b. Collect all document IDs.
|
|
82
|
+
**Hard rule:** Only providers reported `Available` by `environment_check` and allowed by setup may be invoked. A provider marked `Not found`, unavailable, or disabled is an explicit opt-out. Do not probe or fall back to disabled providers.
|
|
100
83
|
|
|
101
|
-
|
|
102
|
-
- Pass the document ID list.
|
|
103
|
-
- Moderator reads each document, classifies consensus/unique/disputed approaches.
|
|
104
|
-
- Moderator creates an aggregated document. This becomes the starting document.
|
|
105
|
-
|
|
106
|
-
2. Start a turn-based debate session with `agent_debate_create`.
|
|
107
|
-
|
|
108
|
-
3. Document review rounds (no max — until all agree):
|
|
109
|
-
a. Moderator sends the current document to each AI for review.
|
|
110
|
-
b. Moderator collects all feedback and updates the working document.
|
|
111
|
-
c. If all providers agree on all sections → consensus reached.
|
|
112
|
-
d. If not → next round with the revised document.
|
|
113
|
-
e. **Every 10 rounds:** Ask the user whether to continue or stop with current state.
|
|
114
|
-
|
|
115
|
-
4. When consensus is reached, record the final synthesis with `agent_debate_conclude`.
|
|
84
|
+
### Phase 3: Execute consensus debate
|
|
116
85
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
86
|
+
**팀 구성:** `agestra:agestra-moderator` (조율) + `agestra:agestra-designer` (현재 호스트의 설계 전문 에이전트) + `environment_check`가 Available로 보고한 외부 AI (gemini, codex 등)
|
|
87
|
+
|
|
88
|
+
This workflow follows `docs/superpowers/specs/2026-04-25-structured-consensus-documents-design.md` and the command/prompt alignment rules from `docs/superpowers/plans/2026-04-25-json-ledger-consensus-implementation-plan.md`.
|
|
89
|
+
|
|
90
|
+
Every generated artifact has a fixed role:
|
|
91
|
+
|
|
92
|
+
| Phase | `kind` | Folder | Role |
|
|
93
|
+
|-------|--------|--------|------|
|
|
94
|
+
| Individual design exploration | `"individual"` | `individual/` | Raw first-pass source material from each provider |
|
|
95
|
+
| Consensus ledger + debate mirror | `"debate"` | `debates/` | JSON consensus ledger is authoritative; debate Markdown is generated from it |
|
|
96
|
+
| Final design decision | `"synthesis"` | `synthesis/` | Self-contained final design document, written after leader approval |
|
|
97
|
+
|
|
98
|
+
The JSON consensus ledger is the source of truth. Markdown is a readable artifact only. Do not parse generated Markdown as state and do not hand-edit it to change provider stances, item status, or consensus state.
|
|
99
|
+
|
|
100
|
+
1. Start an approval-gated structured debate with `agent_debate_structured`.
|
|
101
|
+
- **topic:** the design subject.
|
|
102
|
+
- **participants:** only providers reported available by `environment_check` / `provider_list`, plus the host design specialist when the engine supports it.
|
|
103
|
+
- **scope:** the design subject, user constraints, relevant code areas, and any related existing design docs.
|
|
104
|
+
- **leader:** the current leader identity when known.
|
|
105
|
+
- **locale:** the setup locale when known.
|
|
106
|
+
- **individual_review_prompt:** ask every participant to produce a complete design document covering:
|
|
107
|
+
1. Problem definition — what exactly is being solved and why.
|
|
108
|
+
2. Constraints and requirements — technical limits, compatibility needs, performance targets.
|
|
109
|
+
3. 2-3 architecture approaches — pros/cons, component boundaries, data flow, and effort estimate.
|
|
110
|
+
4. Recommended approach — one choice with justification.
|
|
111
|
+
5. Implementation plan — step-by-step build sequence with dependencies.
|
|
112
|
+
6. Risks and mitigations.
|
|
113
|
+
|
|
114
|
+
2. Let the MCP moderator engine own the consensus flow.
|
|
115
|
+
- The engine creates one individual first-pass document per participant under `individual/`.
|
|
116
|
+
- The engine owns provider turn order, JSON turn packets, response validation, ledger updates, aggregated debate Markdown rendering, synthesis rendering, and the final terminal table.
|
|
117
|
+
- Participants submit explicit JSON stances through the MCP consensus turn packet.
|
|
118
|
+
- The leader/moderator must not infer agreement from prose, must not vote, and must not edit provider stances manually.
|
|
119
|
+
- There must be exactly one generated aggregated debate Markdown document per workflow run, not one Markdown document per provider turn or round.
|
|
120
|
+
|
|
121
|
+
3. Use the approval gate.
|
|
122
|
+
- If the result is `ready-for-approval`, inspect the terminal report and call exactly one:
|
|
123
|
+
- `agent_debate_approve` to write the synthesis document.
|
|
124
|
+
- `agent_debate_continue` to run 3, 5, or 10 additional rounds.
|
|
125
|
+
- `agent_debate_reject` to close without synthesis.
|
|
126
|
+
- If the result is `error`, report the orchestration failure and do not approve.
|
|
127
|
+
|
|
128
|
+
4. Present the result to the user.
|
|
129
|
+
- Name the individual document paths when surfaced, debate Markdown path, consensus JSON ledger path, approval snapshot path if surfaced, and synthesis path if approved.
|
|
130
|
+
- Summarize accepted design decisions, excluded options, and unresolved/disputed items.
|
|
131
|
+
- Preserve each provider's rationale for disputed positions.
|
|
120
132
|
|
|
121
133
|
### Phase 4: Design process (Leader-host-only mode)
|
|
122
134
|
|