aptly 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +9 -34
- package/README.ja.md +9 -34
- package/README.md +9 -34
- package/README.zh-CN.md +9 -34
- package/dist/src/context-retry.js +19 -7
- package/dist/src/recovery-application.d.ts +96 -0
- package/dist/src/recovery-application.js +59 -0
- package/dist/src/server.js +2 -2
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/SPAWN_CONTEXT.md +24 -0
- package/docs/guide/en/advanced.md +4 -0
- package/docs/guide/en/configuration.md +43 -58
- package/docs/guide/en/installation.md +30 -42
- package/docs/guide/en/transmission.md +31 -36
- package/docs/guide/en.md +17 -20
- package/docs/guide/ja/advanced.md +4 -0
- package/docs/guide/ja/configuration.md +41 -56
- package/docs/guide/ja/installation.md +25 -37
- package/docs/guide/ja/transmission.md +28 -33
- package/docs/guide/ja.md +17 -20
- package/docs/guide/ko/advanced.md +4 -0
- package/docs/guide/ko/configuration.md +34 -49
- package/docs/guide/ko/installation.md +23 -35
- package/docs/guide/ko/transmission.md +24 -29
- package/docs/guide/ko.md +17 -20
- package/docs/guide/zh-CN/advanced.md +4 -0
- package/docs/guide/zh-CN/configuration.md +41 -56
- package/docs/guide/zh-CN/installation.md +24 -36
- package/docs/guide/zh-CN/transmission.md +28 -33
- package/docs/guide/zh-CN.md +17 -20
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -10,61 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
[한국어](README.md) · **English** · [简体中文](README.zh-CN.md) · [日本語](README.ja.md)
|
|
12
12
|
|
|
13
|
-
**A local MCP server that selects Claude Code and Codex subagent models and reasoning effort to suit the task.**
|
|
14
|
-
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
|
-
Aptly
|
|
18
|
-
|
|
19
|
-
Our own tests showed **about 52–58% lower API-equivalent costs**. See the [test conditions and detailed results](docs/guide/en/benchmarks.md#guide-cost-benchmarks).
|
|
15
|
+
Aptly recommends models and reasoning effort for Claude Code and Codex subagents. It sends a task summary to the OpenAI Decisions API and preserves explicitly selected models, reasoning effort, and execution permissions.
|
|
20
16
|
|
|
21
17
|
## Quick start
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
You need Node.js **24 or later**, Claude Code or Codex, and an OpenAI API key.
|
|
24
20
|
|
|
25
21
|
```sh
|
|
26
22
|
npm install -g aptly@latest --allow-scripts=aptly
|
|
27
23
|
aptly set default
|
|
28
24
|
aptly set env OPENAI_API_KEY
|
|
29
|
-
aptly --version
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
During installation, `postinstall` registers the MCP server and a `PreToolUse` Hook in existing host configuration directories. Run `setup` explicitly if automatic registration was skipped or a host has no configuration directory yet. Other settings and Hooks, and any existing Aptly launch command and environment, are preserved.
|
|
35
|
-
|
|
36
|
-
Store the classification key, `OPENAI_API_KEY`, in the OS credential store using the hidden prompt in `aptly set env OPENAI_API_KEY`, or pass it to the MCP process through a secure execution environment. Do not put it in command arguments, requests, configuration JSON, or the repository. Restart the host or MCP server, then **review and trust the new Hook through `/hooks` in Codex**. See [installation, keys, and registration](docs/guide/en/installation.md#guide-installation).
|
|
27
|
+
Choose the transmission scope in `set default` and enter your API key through the hidden prompt. Restart the host, then **review and approve the new Hook in `/hooks` for Codex**. See [installation and key setup](docs/guide/en/installation.md) for npm compatibility and account-specific configuration.
|
|
37
28
|
|
|
38
29
|
## Update
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
Stop the relevant hosts, MCP servers, and CLI processes before running these commands.
|
|
41
32
|
|
|
42
33
|
```sh
|
|
43
34
|
aptly update
|
|
44
35
|
aptly setup --client all
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| Mode | Behavior |
|
|
50
|
-
|---|---|
|
|
51
|
-
| Automatic Hook | Checks constraints and recommends unspecified defaults for new calls |
|
|
52
|
-
| Direct recommendation | Returns a profile through `recommend_agent` or `aptly recommend`; review it and decide separately whether to run it in the host |
|
|
53
|
-
| fixture | Tests recommendations generated by local rules without a key or network access; these are not actual Decisions results |
|
|
54
|
-
|
|
55
|
-
From Aptly 0.1.4, inherited calls also reach recommendation. Application still requires explicit `fork_turns: "none"` in Codex or a general-purpose Claude Code call without history constraints; specified fields are preserved. Recommendation, Hook argument updates and child execution are separate facts. See the [guide](docs/guide/en/routing.md#guide-automatic-routing) for application conditions.
|
|
38
|
+
Restart the host. You do not need to re-enter the key. If migrating a stable launcher or an older version, see [updates](docs/guide/en/installation.md#guide-package-updates).
|
|
56
39
|
|
|
57
40
|
## Documentation
|
|
58
41
|
|
|
59
|
-
- [User guide](docs/guide/en.md):
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [Cost benchmark](docs/guide/en/benchmarks.md#guide-cost-benchmarks): tokens, converted costs, and measurement scope for a README translation review
|
|
64
|
-
- [Diagnostics and development](docs/guide/en/advanced.md#guide-diagnostics-and-development): local reports and checks without paid API calls
|
|
65
|
-
|
|
66
|
-
Korean is the canonical documentation. The English, Simplified Chinese, and Japanese documents cover the same usage scope. Choosing a documentation language does not change the language of CLI or MCP output.
|
|
67
|
-
|
|
68
|
-
## License
|
|
69
|
-
|
|
70
|
-
[MIT](LICENSE).
|
|
42
|
+
- [User guide](docs/guide/en.md): configuration, automatic recommendations, budgets, statistics, and troubleshooting
|
|
43
|
+
- [Model candidates](docs/guide/en/configuration.md#guide-models-and-environment)
|
|
44
|
+
- [Transmission scope](docs/guide/en/transmission.md): information sent to the Decisions API
|
|
45
|
+
- [Measured costs](docs/guide/en/benchmarks.md): approximately 52–58% lower API-equivalent child review and classification costs in a small README review test. This is not a reduction in total task costs or subscription charges.
|
package/README.ja.md
CHANGED
|
@@ -10,61 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
[한국어](README.md) · [English](README.en.md) · [简体中文](README.zh-CN.md) · **日本語**
|
|
12
12
|
|
|
13
|
-
**タスクに適した Claude Code・Codex のサブエージェント用モデルと effort を選ぶローカル MCP です。**
|
|
14
|
-
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
独自テストでは、**API 換算コストが約 52~58% 減少しました**。[測定条件と詳細結果](docs/guide/ja/benchmarks.md#guide-cost-benchmarks)をご覧ください。
|
|
15
|
+
Claude Code・Codex のサブエージェントにモデルと推論強度を推薦します。タスクの要約を OpenAI Decisions API に送信し、明示されたモデル・推論強度・実行権限は保持します。
|
|
20
16
|
|
|
21
17
|
## クイックスタート
|
|
22
18
|
|
|
23
|
-
Node.js **24
|
|
19
|
+
Node.js **24 以上**、Claude Code または Codex、OpenAI API キーが必要です。
|
|
24
20
|
|
|
25
21
|
```sh
|
|
26
22
|
npm install -g aptly@latest --allow-scripts=aptly
|
|
27
23
|
aptly set default
|
|
28
24
|
aptly set env OPENAI_API_KEY
|
|
29
|
-
aptly --version
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
インストール時の `postinstall` は、既存のホスト設定ディレクトリに MCP と `PreToolUse` Hook を登録します。自動登録をスキップした場合や、ホストに設定ディレクトリがまだない場合も、`setup` を明示的に実行して登録できます。他の既存設定・Hook と、既存の Aptly の実行コマンド・環境は保持します。
|
|
35
|
-
|
|
36
|
-
分類用の `OPENAI_API_KEY` は、`aptly set env OPENAI_API_KEY` の非表示入力で OS の資格情報ストアに保存するか、安全な実行環境から MCP プロセスに渡してください。キーをコマンドライン・リクエスト・設定 JSON・リポジトリに記載しないでください。ホストまたは MCP を再起動した後、**Codex では `/hooks` で新しい Hook を確認し、信頼を承認**してください。[インストール・キー・登録の詳細](docs/guide/ja/installation.md#guide-installation)を確認してください。
|
|
27
|
+
`set default` で送信範囲を選び、API キーは非表示入力で登録します。ホストを再起動した後、**Codex では `/hooks` で新しい Hook を確認・承認**してください。[インストール・キー設定](docs/guide/ja/installation.md)で npm の互換オプションとアカウント別の設定を確認できます。
|
|
37
28
|
|
|
38
29
|
## 更新
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
実行前に、関連するホスト・MCP サーバー・CLI プロセスを停止してください。
|
|
41
32
|
|
|
42
33
|
```sh
|
|
43
34
|
aptly update
|
|
44
35
|
aptly setup --client all
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| 方法 | 動作 |
|
|
50
|
-
|---|---|
|
|
51
|
-
| 自動 Hook | 新しい呼び出しの制約を確認し、未指定のデフォルト値を推薦します |
|
|
52
|
-
| 直接推薦 | `recommend_agent` または `aptly recommend` でプロファイルを受け取り、実行するかどうかをホストで明示的に判断します |
|
|
53
|
-
| fixture | キーやネットワークを使わず、ローカルで生成した試験用の推薦を確認できます。実際の Decisions の結果ではありません |
|
|
54
|
-
|
|
55
|
-
Aptly 0.1.4 以降では継承呼び出しも推薦を評価します。適用には Codex の明示的な `fork_turns: "none"`、または履歴制約のない Claude Code の汎用呼び出しが必要で、指定済みフィールドは保持します。推薦・Hook 引数更新・実際の子の実行は別です。適用条件は[ガイド](docs/guide/ja/routing.md#guide-automatic-routing)を参照してください。
|
|
38
|
+
ホストを再起動してください。キーの再入力は不要です。stable ランチャーや以前のバージョンから移行する場合は、[更新案内](docs/guide/ja/installation.md#guide-package-updates)を確認してください。
|
|
56
39
|
|
|
57
40
|
## ドキュメント
|
|
58
41
|
|
|
59
|
-
- [使用ガイド](docs/guide/ja.md):
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [費用実測](docs/guide/ja/benchmarks.md#guide-cost-benchmarks): README 翻訳レビューのトークン・換算費用と測定範囲
|
|
64
|
-
- [診断・開発](docs/guide/ja/advanced.md#guide-diagnostics-and-development): ローカル report と無料の検証コマンド
|
|
65
|
-
|
|
66
|
-
韓国語版が正本です。英語・簡体字中国語・日本語のドキュメントは同じ使用範囲を説明しており、ドキュメントの言語を選んでも CLI・MCP の出力言語は変わりません。
|
|
67
|
-
|
|
68
|
-
## ライセンス
|
|
69
|
-
|
|
70
|
-
[MIT](LICENSE)。
|
|
42
|
+
- [使用ガイド](docs/guide/ja.md): 設定・自動推薦・予算・統計・トラブルシューティング
|
|
43
|
+
- [候補モデルの設定](docs/guide/ja/configuration.md#guide-models-and-environment)
|
|
44
|
+
- [送信範囲](docs/guide/ja/transmission.md): Decisions API に送る情報
|
|
45
|
+
- [費用実測](docs/guide/ja/benchmarks.md): 小規模な README レビュー試験で子レビュー・分類費の API 換算額が約 52~58% 減少。タスク全体の費用やサブスクリプションの実請求額の削減率ではありません。
|
package/README.md
CHANGED
|
@@ -10,61 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
**한국어** · [English](README.en.md) · [简体中文](README.zh-CN.md) · [日本語](README.ja.md)
|
|
12
12
|
|
|
13
|
-
**작업에 맞는 Claude Code·Codex 서브에이전트 모델과 effort를 선택하는 로컬 MCP입니다.**
|
|
14
|
-
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
자체 테스트에서 **API 환산 비용이 약 52~58% 감소했습니다**. [측정 조건과 상세 결과](docs/guide/ko/benchmarks.md#guide-cost-benchmarks)를 확인하세요.
|
|
15
|
+
Claude Code·Codex 서브에이전트의 모델과 추론 강도를 추천합니다. 작업 요약을 OpenAI Decisions API로 보내며, 명시한 모델·추론 강도·실행 권한은 보존합니다.
|
|
20
16
|
|
|
21
17
|
## 빠른 시작
|
|
22
18
|
|
|
23
|
-
Node.js **24
|
|
19
|
+
Node.js **24 이상**, Claude Code 또는 Codex, OpenAI API 키가 필요합니다.
|
|
24
20
|
|
|
25
21
|
```sh
|
|
26
22
|
npm install -g aptly@latest --allow-scripts=aptly
|
|
27
23
|
aptly set default
|
|
28
24
|
aptly set env OPENAI_API_KEY
|
|
29
|
-
aptly --version
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
`
|
|
33
|
-
|
|
34
|
-
설치 시 `postinstall`은 기존 호스트 설정 디렉터리에 MCP와 `PreToolUse` Hook을 등록합니다. 명시적인 `setup`은 자동 등록을 건너뛰었거나 아직 설정 디렉터리가 없는 호스트에도 사용할 수 있습니다. 기존 다른 설정·Hook과 기존 Aptly 실행 명령·환경은 보존합니다.
|
|
35
|
-
|
|
36
|
-
분류용 `OPENAI_API_KEY`는 `aptly set env OPENAI_API_KEY`의 숨김 입력으로 OS 자격 저장소에 보관하거나 안전한 실행 환경에서 MCP 프로세스에 전달하십시오. 키를 명령행·요청·설정 JSON·저장소에 기록하지 마십시오. 호스트 또는 MCP를 재시작한 뒤, **Codex에서는 `/hooks`에서 새 Hook을 검토하고 신뢰를 승인하십시오.** [설치·키·등록 상세](docs/guide/ko/installation.md#guide-installation)를 참고하십시오.
|
|
27
|
+
`set default`에서 전송 범위를 선택하고 API 키는 숨김 입력으로 등록합니다. 호스트를 재시작한 뒤 **Codex는 `/hooks`에서 새 Hook을 검토·승인**하십시오. [설치·키 설정](docs/guide/ko/installation.md)에서 npm 호환 옵션과 계정별 설정을 확인할 수 있습니다.
|
|
37
28
|
|
|
38
29
|
## 업데이트
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
관련 호스트·MCP 서버·CLI 프로세스를 중지한 뒤 실행하십시오.
|
|
41
32
|
|
|
42
33
|
```sh
|
|
43
34
|
aptly update
|
|
44
35
|
aptly setup --client all
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| 방식 | 동작 |
|
|
50
|
-
|---|---|
|
|
51
|
-
| 자동 Hook | 새 호출의 제약을 검사하고 미지정 기본값을 추천합니다 |
|
|
52
|
-
| 직접 추천 | `recommend_agent` 또는 `aptly recommend`로 프로필을 받고 호스트에서 명시적으로 실행합니다 |
|
|
53
|
-
| fixture | 키·네트워크 없이 시험용 추천을 확인합니다. 실제 Decisions 결과가 아닙니다 |
|
|
54
|
-
|
|
55
|
-
Aptly 0.1.4부터 상속 호출도 추천을 평가합니다. Codex의 적용은 명시적인 `fork_turns: "none"`, Claude Code는 이력 제약 없는 일반 호출로 제한하며 명시한 필드는 보존합니다. 추천·Hook 인자 변경·실제 자식 실행은 별개입니다. 적용 조건은 [가이드](docs/guide/ko/routing.md#guide-automatic-routing)에서 확인하십시오.
|
|
38
|
+
호스트를 재시작하십시오. 키를 다시 입력할 필요는 없습니다. stable 실행기나 이전 버전에서 전환하는 경우 [업데이트 안내](docs/guide/ko/installation.md#guide-package-updates)를 확인하십시오.
|
|
56
39
|
|
|
57
40
|
## 문서
|
|
58
41
|
|
|
59
|
-
- [사용 가이드](docs/guide/ko.md):
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [비용 실측](docs/guide/ko/benchmarks.md#guide-cost-benchmarks): README 번역 검토의 토큰·환산 비용과 측정 범위
|
|
64
|
-
- [진단·개발](docs/guide/ko/advanced.md#guide-diagnostics-and-development): 로컬 진단 보고서와 무료 검증 명령
|
|
65
|
-
|
|
66
|
-
한국어가 정본입니다. 영어·중국어 간체·일본어 문서는 같은 사용 범위를 설명하며, 문서 언어가 CLI·MCP 출력 언어를 바꾸지는 않습니다.
|
|
67
|
-
|
|
68
|
-
## 라이선스
|
|
69
|
-
|
|
70
|
-
[MIT](LICENSE).
|
|
42
|
+
- [사용 가이드](docs/guide/ko.md): 설정·자동 추천·예산·통계·문제 해결
|
|
43
|
+
- [모델 후보 설정](docs/guide/ko/configuration.md#guide-models-and-environment)
|
|
44
|
+
- [전송 범위](docs/guide/ko/transmission.md): Decisions API에 보내는 정보
|
|
45
|
+
- [비용 실측](docs/guide/ko/benchmarks.md): 소규모 README 검토 시험에서 자식 검토·분류비의 API 환산액 약 52~58% 감소. 전체 작업 비용이나 구독 실청구 절감률은 아닙니다.
|
package/README.zh-CN.md
CHANGED
|
@@ -10,61 +10,36 @@
|
|
|
10
10
|
|
|
11
11
|
[한국어](README.md) · [English](README.en.md) · **简体中文** · [日本語](README.ja.md)
|
|
12
12
|
|
|
13
|
-
**用于为 Claude Code 和 Codex 子代理选择合适模型与推理强度(effort)的本地 MCP 服务器。**
|
|
14
|
-
|
|
15
13
|
</div>
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
在我们的测试中,**API 折算成本降低了约 52%~58%**。详见[测试条件与详细结果](docs/guide/zh-CN/benchmarks.md#guide-cost-benchmarks)。
|
|
15
|
+
为 Claude Code 和 Codex 子代理推荐模型与推理强度。Aptly 将任务摘要发送给 OpenAI Decisions API,并保留明确指定的模型、推理强度和执行权限。
|
|
20
16
|
|
|
21
17
|
## 快速开始
|
|
22
18
|
|
|
23
|
-
需要 Node.js **24
|
|
19
|
+
需要 Node.js **24 或更高版本**、Claude Code 或 Codex 以及 OpenAI API 密钥。
|
|
24
20
|
|
|
25
21
|
```sh
|
|
26
22
|
npm install -g aptly@latest --allow-scripts=aptly
|
|
27
23
|
aptly set default
|
|
28
24
|
aptly set env OPENAI_API_KEY
|
|
29
|
-
aptly --version
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
安装时的 `postinstall` 会在现有宿主配置目录中注册 MCP 和 `PreToolUse` Hook。如果跳过了自动注册,或宿主尚无配置目录,也可以显式运行 `setup`。其他现有配置与 Hook,以及 Aptly 原有的启动命令和环境均会保留。
|
|
35
|
-
|
|
36
|
-
请通过 `aptly set env OPENAI_API_KEY` 的隐藏输入,将分类用的 `OPENAI_API_KEY` 存入系统凭据存储,或通过安全的运行环境传递给 MCP 进程。不要将密钥写入命令行、请求、配置 JSON 或代码仓库。重启宿主或 MCP 后,**请在 Codex 的 `/hooks` 中审核新 Hook 并批准信任**。详见[安装、密钥与注册](docs/guide/zh-CN/installation.md#guide-installation)。
|
|
27
|
+
请在 `set default` 中选择传输范围,并通过隐藏输入注册 API 密钥。重启宿主后,**请在 Codex 的 `/hooks` 中审核并批准新 Hook**。有关 npm 兼容选项和各账户设置,请参阅[安装与密钥设置](docs/guide/zh-CN/installation.md)。
|
|
37
28
|
|
|
38
29
|
## 更新
|
|
39
30
|
|
|
40
|
-
|
|
31
|
+
执行前,请停止相关宿主、MCP 服务器和 CLI 进程。
|
|
41
32
|
|
|
42
33
|
```sh
|
|
43
34
|
aptly update
|
|
44
35
|
aptly setup --client all
|
|
45
36
|
```
|
|
46
37
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
| 方式 | 行为 |
|
|
50
|
-
|---|---|
|
|
51
|
-
| 自动 Hook | 检查新调用的约束,并推荐未指定的默认值 |
|
|
52
|
-
| 直接推荐 | 通过 `recommend_agent` 或 `aptly recommend` 获取执行配置,再在宿主中明确选择并执行 |
|
|
53
|
-
| fixture | 无需密钥或网络即可测试本地模拟推荐;结果并非实际 Decisions 判断 |
|
|
54
|
-
|
|
55
|
-
Aptly 0.1.4 起也会为继承调用评估推荐。应用仍要求 Codex 显式指定 `fork_turns: "none"`,或 Claude Code 使用无历史约束的通用调用;已指定字段会保留。推荐、Hook 参数更新与实际子代理执行是不同事实。应用条件详见[指南](docs/guide/zh-CN/routing.md#guide-automatic-routing)。
|
|
38
|
+
请重启宿主,无需重新输入密钥。如果从 stable 启动器或旧版本迁移,请参阅[更新指南](docs/guide/zh-CN/installation.md#guide-package-updates)。
|
|
56
39
|
|
|
57
40
|
## 文档
|
|
58
41
|
|
|
59
|
-
- [使用指南](docs/guide/zh-CN.md)
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [成本实测](docs/guide/zh-CN/benchmarks.md#guide-cost-benchmarks):README 翻译审阅的 token、换算成本与测量范围
|
|
64
|
-
- [诊断与开发](docs/guide/zh-CN/advanced.md#guide-diagnostics-and-development):本地诊断报告与免费验证命令
|
|
65
|
-
|
|
66
|
-
韩语文档为正本,英语、简体中文和日语文档与其保持相同的使用范围。选择文档语言不会改变 CLI 或 MCP 的输出语言。
|
|
67
|
-
|
|
68
|
-
## 许可证
|
|
69
|
-
|
|
70
|
-
[MIT](LICENSE)。
|
|
42
|
+
- [使用指南](docs/guide/zh-CN.md):设置、自动推荐、预算、统计与问题排查
|
|
43
|
+
- [候选模型设置](docs/guide/zh-CN/configuration.md#guide-models-and-environment)
|
|
44
|
+
- [传输范围](docs/guide/zh-CN/transmission.md):发送给 Decisions API 的信息
|
|
45
|
+
- [成本实测](docs/guide/zh-CN/benchmarks.md):在小规模 README 审阅测试中,子代理审阅与分类费用的 API 折算额降低约 52%~58%;这不是整体任务成本或订阅实际账单的降幅。
|
|
@@ -4,6 +4,7 @@ import { join } from 'node:path';
|
|
|
4
4
|
import { effectiveTransmission, loadAutomaticHookPolicy } from './automatic-hook.js';
|
|
5
5
|
import { assertPrivateStatePath, readRegularFile } from './files.js';
|
|
6
6
|
import { hasSufficientTaskText } from './context-sufficiency.js';
|
|
7
|
+
import { validRecoveryApplication } from './recovery-application.js';
|
|
7
8
|
const hash = (value) => createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
8
9
|
/** One caller-supplied supplement, never an automatic native spawn or a retry chain. */
|
|
9
10
|
export class ContextRetries {
|
|
@@ -162,14 +163,21 @@ export class ContextRetries {
|
|
|
162
163
|
...(entry.seed.fill_model !== false ? { model: result.profile.model } : {}),
|
|
163
164
|
...(entry.seed.client === 'codex' && entry.seed.fill_effort !== false && result.profile.reasoning_effort ? { reasoning_effort: result.profile.reasoning_effort } : {})
|
|
164
165
|
} : undefined;
|
|
165
|
-
|
|
166
|
+
const response = { ...result, retry_id, request_id, context_retry_allowed: false,
|
|
166
167
|
spawn_application: { status: entry.seed.application_blocked ? 'blocked' : 'caller_review_required',
|
|
167
|
-
reason: entry.seed.application_blocked ?? 'native_execution_not_observed' },
|
|
168
|
+
reason: entry.seed.application_blocked ?? 'native_execution_not_observed', ...(defaults ? { required_fields: Object.keys(defaults), on_unavailable: 'stop_and_report', next_action: 'apply_returned_defaults' } : {}) },
|
|
168
169
|
...(defaults ? { next_call: { tool: entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent', set_if_unspecified: defaults, preserve: 'all_other_arguments_and_history' } } : {}),
|
|
169
170
|
next_step: result.status === 'recommended'
|
|
170
171
|
? entry.seed.application_blocked ? `Report the application constraint and preserve original history and arguments for the ORIGINAL invocation. This profile is advice only. ${entry.seed.fresh_eligible ? 'This is the SAME task but a NEW invocation, not a retry of the original call. Use only the separate caller-declared preparation protocol offered below. Only after the host reports the original tool call blocked, if you can declare that this is the same independent task, the user does not require inherited history, and you can supply complete standalone instructions, call prepare_fresh_delegation with this retry_id, task_name, standalone_task and declaration {independent_task:true,same_task:true,original_call_outcome:"blocked",history_requirement:"not_required",standalone_context_complete:true}. It prepares a separate fresh invocation without a new classification. Never use it when history is required or unknown, or when original execution is unknown.' : ''}`
|
|
171
|
-
: `Context supplementation is complete; do not call retry_spawn_recommendation again. Caller review means the parent checks arguments, not a request for new user approval. To perform the already requested delegation, on the next native ${entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent'} call, include these previously unspecified fields: ${JSON.stringify(defaults)}. Do not submit another model/effort-omitted call: it will be blocked again. Preserve all other arguments, explicit choices, history, roles and permissions. This response does not execute a child.`
|
|
172
|
+
: `Context supplementation is complete; do not call retry_spawn_recommendation again. Apply only the returned unspecified fields under existing delegation and host permissions. If user choices or higher-priority host rules prohibit these fields, or applicability is unclear, stop and report the limitation. Caller review means the parent checks arguments, not a request for new user approval. To perform the already requested delegation, on the next native ${entry.seed.client === 'claude' ? 'Agent' : 'spawn_agent'} call, include these previously unspecified fields: ${JSON.stringify(defaults)}. Do not submit another model/effort-omitted call: it will be blocked again. Preserve all other arguments, explicit choices, history, roles and permissions. This response does not execute a child.`
|
|
172
173
|
: 'Stop this recovery attempt. Report the outcome; do not create another retry ID or spawn with an unresolved recommendation.' };
|
|
174
|
+
response.next_step += ' Existing-agent reuse is an alternative path, not evidence that this recommendation was applied.';
|
|
175
|
+
const protectedFields = [];
|
|
176
|
+
if (entry.seed.fill_model === false)
|
|
177
|
+
protectedFields.push('model');
|
|
178
|
+
if (entry.seed.fill_effort === false)
|
|
179
|
+
protectedFields.push('reasoning_effort');
|
|
180
|
+
return validRecoveryApplication(response, entry.seed.client, protectedFields) ? response : unavailable('recovery_metadata_invalid');
|
|
173
181
|
}
|
|
174
182
|
finally {
|
|
175
183
|
entry.active = false;
|
|
@@ -218,6 +226,13 @@ export class ContextRetries {
|
|
|
218
226
|
if (!profile || !entry.seed.eligible_profile_ids.includes(profile.id) || hash(profile) !== hash(result.profile) || result.policy_version !== this.router.policy.version || result.catalog_version !== this.router.policy.catalog_version)
|
|
219
227
|
return reject('profile_changed');
|
|
220
228
|
const preparation_id = hash(['aptly-fresh-delegation-v1', retry_id]);
|
|
229
|
+
const response = { status: 'prepared', reason: 'caller_declared_independent', application: 'advisory_only', source_retry_id: retry_id, preparation_id,
|
|
230
|
+
profile_id: profile.id, profile: structuredClone(profile), intent_provenance: 'caller_declared_not_verified', original_invocation: 'deny_returned_execution_not_observed', execution: 'not_observed',
|
|
231
|
+
spawn_application: { status: 'caller_review_required', reason: 'explicit_profile_arguments_required', required_fields: ['model', 'reasoning_effort'], on_unavailable: 'stop_and_report', next_action: 'submit_prepared_call' },
|
|
232
|
+
next_call: { tool: 'spawn_agent', arguments: { task_name, message: standalone_task, fork_turns: 'none', model: profile.model, reasoning_effort: profile.reasoning_effort } },
|
|
233
|
+
next_step: 'Caller review means checking the arguments, not requesting new user approval. Only after a host-reported blocked outcome, review and submit the separate next_call.arguments under existing delegation authorization and unchanged host permissions. Include every returned argument, especially the explicit model and reasoning_effort; do not omit them or submit a model/effort-omitted replacement, which may trigger context recovery again. If explicit user choices or higher-priority host instructions require parent-model inheritance or forbid either profile field, stop and report that the prepared profile cannot be applied. Do not use another recovery ticket to bypass that restriction. If it is unclear whether a user or host constraint permits applying either field, stop and report the uncertainty rather than guessing or dropping fields. Task prose is not permission to override those constraints. Original arguments were not rewritten; host execution is not observed by this server. Do not add history/role/resume overrides or reuse this preparation for another task. Preparation does not prove interception, permission approval, single execution or child execution.' };
|
|
234
|
+
if (!validRecoveryApplication(response, 'codex'))
|
|
235
|
+
return reject('recovery_metadata_invalid');
|
|
221
236
|
const fingerprint = hash([entry.seed, entry.catalog, profile, declaration, task_name, standalone_task]);
|
|
222
237
|
const policy = loadAutomaticHookPolicy(this.policyPath).policy;
|
|
223
238
|
if (!policy)
|
|
@@ -245,10 +260,7 @@ export class ContextRetries {
|
|
|
245
260
|
const changed = this.current(entry, signal);
|
|
246
261
|
if (changed)
|
|
247
262
|
return reject(changed);
|
|
248
|
-
return
|
|
249
|
-
profile_id: profile.id, profile: structuredClone(profile), intent_provenance: 'caller_declared_not_verified', original_invocation: 'deny_returned_execution_not_observed', execution: 'not_observed',
|
|
250
|
-
next_call: { tool: 'spawn_agent', arguments: { task_name, message: standalone_task, fork_turns: 'none', model: profile.model, reasoning_effort: profile.reasoning_effort } },
|
|
251
|
-
next_step: 'Review and submit this separate native invocation only after a host-reported blocked outcome, under existing delegation authorization and unchanged host permissions. Original arguments were not rewritten; host execution is not observed by this server. Do not add history/role/resume overrides or reuse this preparation for another task. Preparation does not prove interception, permission approval, single execution or child execution.' };
|
|
263
|
+
return response;
|
|
252
264
|
}
|
|
253
265
|
catch {
|
|
254
266
|
return reject('fresh_delegation_unavailable');
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Client } from './types.ts';
|
|
3
|
+
/** Output coherence only: not host authorization, dispatch or profile availability. */
|
|
4
|
+
export declare const recoveryApplicationSchema: z.ZodObject<{
|
|
5
|
+
client: z.ZodEnum<{
|
|
6
|
+
claude: "claude";
|
|
7
|
+
codex: "codex";
|
|
8
|
+
}>;
|
|
9
|
+
status: z.ZodEnum<{
|
|
10
|
+
keep_current: "keep_current";
|
|
11
|
+
needs_context: "needs_context";
|
|
12
|
+
prepared: "prepared";
|
|
13
|
+
recommended: "recommended";
|
|
14
|
+
unavailable: "unavailable";
|
|
15
|
+
}>;
|
|
16
|
+
application: z.ZodLiteral<"advisory_only">;
|
|
17
|
+
execution: z.ZodOptional<z.ZodLiteral<"not_observed">>;
|
|
18
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
id: z.ZodString;
|
|
20
|
+
client: z.ZodEnum<{
|
|
21
|
+
claude: "claude";
|
|
22
|
+
codex: "codex";
|
|
23
|
+
}>;
|
|
24
|
+
model: z.ZodString;
|
|
25
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
high: "high";
|
|
27
|
+
low: "low";
|
|
28
|
+
max: "max";
|
|
29
|
+
medium: "medium";
|
|
30
|
+
minimal: "minimal";
|
|
31
|
+
xhigh: "xhigh";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
spawn_application: z.ZodUnion<readonly [z.ZodObject<{
|
|
35
|
+
status: z.ZodLiteral<"caller_review_required">;
|
|
36
|
+
reason: z.ZodEnum<{
|
|
37
|
+
explicit_profile_arguments_required: "explicit_profile_arguments_required";
|
|
38
|
+
native_execution_not_observed: "native_execution_not_observed";
|
|
39
|
+
}>;
|
|
40
|
+
required_fields: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
41
|
+
model: "model";
|
|
42
|
+
reasoning_effort: "reasoning_effort";
|
|
43
|
+
}>>>;
|
|
44
|
+
on_unavailable: z.ZodOptional<z.ZodLiteral<"stop_and_report">>;
|
|
45
|
+
next_action: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
apply_returned_defaults: "apply_returned_defaults";
|
|
47
|
+
submit_prepared_call: "submit_prepared_call";
|
|
48
|
+
}>>;
|
|
49
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
50
|
+
status: z.ZodLiteral<"blocked">;
|
|
51
|
+
reason: z.ZodEnum<{
|
|
52
|
+
effort_argument_unsupported: "effort_argument_unsupported";
|
|
53
|
+
history_semantics_unverified: "history_semantics_unverified";
|
|
54
|
+
inherited_context_application_unverified: "inherited_context_application_unverified";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strict>]>;
|
|
57
|
+
next_call: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
58
|
+
tool: z.ZodEnum<{
|
|
59
|
+
Agent: "Agent";
|
|
60
|
+
spawn_agent: "spawn_agent";
|
|
61
|
+
}>;
|
|
62
|
+
set_if_unspecified: z.ZodObject<{
|
|
63
|
+
model: z.ZodOptional<z.ZodString>;
|
|
64
|
+
reasoning_effort: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
high: "high";
|
|
66
|
+
low: "low";
|
|
67
|
+
max: "max";
|
|
68
|
+
medium: "medium";
|
|
69
|
+
minimal: "minimal";
|
|
70
|
+
xhigh: "xhigh";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
preserve: z.ZodLiteral<"all_other_arguments_and_history">;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
tool: z.ZodLiteral<"spawn_agent">;
|
|
76
|
+
arguments: z.ZodObject<{
|
|
77
|
+
task_name: z.ZodString;
|
|
78
|
+
message: z.ZodString;
|
|
79
|
+
fork_turns: z.ZodLiteral<"none">;
|
|
80
|
+
model: z.ZodString;
|
|
81
|
+
reasoning_effort: z.ZodEnum<{
|
|
82
|
+
high: "high";
|
|
83
|
+
low: "low";
|
|
84
|
+
max: "max";
|
|
85
|
+
medium: "medium";
|
|
86
|
+
minimal: "minimal";
|
|
87
|
+
xhigh: "xhigh";
|
|
88
|
+
}>;
|
|
89
|
+
}, z.core.$strict>;
|
|
90
|
+
}, z.core.$strict>]>>;
|
|
91
|
+
protected_fields: z.ZodArray<z.ZodEnum<{
|
|
92
|
+
model: "model";
|
|
93
|
+
reasoning_effort: "reasoning_effort";
|
|
94
|
+
}>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export declare function validRecoveryApplication(result: Record<string, unknown>, client: Client, protectedFields?: ('model' | 'reasoning_effort')[]): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const field = z.enum(['model', 'reasoning_effort']);
|
|
3
|
+
const effort = z.enum(['minimal', 'low', 'medium', 'high', 'xhigh', 'max']);
|
|
4
|
+
const defaults = z.strictObject({ model: z.string().min(1).max(256).optional(), reasoning_effort: effort.optional() });
|
|
5
|
+
const review = z.strictObject({ status: z.literal('caller_review_required'), reason: z.enum(['native_execution_not_observed', 'explicit_profile_arguments_required']),
|
|
6
|
+
required_fields: z.array(field).min(1).max(2).optional(), on_unavailable: z.literal('stop_and_report').optional(),
|
|
7
|
+
next_action: z.enum(['apply_returned_defaults', 'submit_prepared_call']).optional() });
|
|
8
|
+
const blocked = z.strictObject({ status: z.literal('blocked'), reason: z.enum(['inherited_context_application_unverified', 'history_semantics_unverified', 'effort_argument_unsupported']) });
|
|
9
|
+
const retryCall = z.strictObject({ tool: z.enum(['spawn_agent', 'Agent']), set_if_unspecified: defaults, preserve: z.literal('all_other_arguments_and_history') });
|
|
10
|
+
const freshCall = z.strictObject({ tool: z.literal('spawn_agent'), arguments: z.strictObject({ task_name: z.string().min(1).max(128), message: z.string().min(1).max(12000), fork_turns: z.literal('none'), model: z.string().min(1).max(256), reasoning_effort: effort }) });
|
|
11
|
+
/** Output coherence only: not host authorization, dispatch or profile availability. */
|
|
12
|
+
export const recoveryApplicationSchema = z.strictObject({
|
|
13
|
+
client: z.enum(['codex', 'claude']), status: z.enum(['recommended', 'prepared', 'keep_current', 'needs_context', 'unavailable']), application: z.literal('advisory_only'),
|
|
14
|
+
execution: z.literal('not_observed').optional(),
|
|
15
|
+
profile: z.strictObject({ id: z.string(), client: z.enum(['codex', 'claude']), model: z.string(), reasoning_effort: effort.optional() }).optional(),
|
|
16
|
+
spawn_application: z.union([review, blocked]), next_call: z.union([retryCall, freshCall]).optional(),
|
|
17
|
+
protected_fields: z.array(field),
|
|
18
|
+
}).superRefine((value, ctx) => {
|
|
19
|
+
const issue = () => ctx.addIssue({ code: 'custom', message: 'invalid_recovery_application' });
|
|
20
|
+
const app = value.spawn_application, call = value.next_call;
|
|
21
|
+
if (app.status === 'blocked') {
|
|
22
|
+
if (call || value.status === 'prepared')
|
|
23
|
+
issue();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!['recommended', 'prepared'].includes(value.status)) {
|
|
27
|
+
if (call || app.reason !== 'native_execution_not_observed' || app.required_fields || app.on_unavailable || app.next_action)
|
|
28
|
+
issue();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!call || !value.profile || value.profile.client !== value.client) {
|
|
32
|
+
issue();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const fresh = 'arguments' in call;
|
|
36
|
+
if (fresh !== (value.status === 'prepared') || call.tool !== (value.client === 'codex' ? 'spawn_agent' : 'Agent'))
|
|
37
|
+
issue();
|
|
38
|
+
if (app.reason !== (fresh ? 'explicit_profile_arguments_required' : 'native_execution_not_observed') || app.next_action !== (fresh ? 'submit_prepared_call' : 'apply_returned_defaults') || app.on_unavailable !== 'stop_and_report')
|
|
39
|
+
issue();
|
|
40
|
+
const args = fresh ? call.arguments : call.set_if_unspecified;
|
|
41
|
+
const keys = ['model', 'reasoning_effort'].filter(key => Object.hasOwn(args, key));
|
|
42
|
+
const required = app.required_fields ?? [];
|
|
43
|
+
if (!keys.length || new Set(required).size !== required.length || keys.length !== required.length || keys.some(key => !required.includes(key)))
|
|
44
|
+
issue();
|
|
45
|
+
if (value.client === 'claude' && Object.hasOwn(args, 'reasoning_effort'))
|
|
46
|
+
issue();
|
|
47
|
+
for (const key of keys) {
|
|
48
|
+
if (args[key] === undefined || args[key] !== value.profile[key])
|
|
49
|
+
issue();
|
|
50
|
+
if (!fresh && value.protected_fields.includes(key))
|
|
51
|
+
issue();
|
|
52
|
+
}
|
|
53
|
+
if (fresh && value.execution !== 'not_observed')
|
|
54
|
+
issue();
|
|
55
|
+
});
|
|
56
|
+
export function validRecoveryApplication(result, client, protectedFields = []) {
|
|
57
|
+
return recoveryApplicationSchema.safeParse({ client, status: result.status, application: result.application, execution: result.execution, profile: result.profile,
|
|
58
|
+
spawn_application: result.spawn_application, next_call: result.next_call, protected_fields: protectedFields }).success;
|
|
59
|
+
}
|
package/dist/src/server.js
CHANGED
|
@@ -107,7 +107,7 @@ export function createServer({ env: inputEnv = process.env } = {}) {
|
|
|
107
107
|
inputSchema: { request_id: z.string().min(1).max(96), client: z.enum(['codex', 'claude']), task: taskSchema, eligible_profile_ids: z.array(z.string()).min(1).max(20).optional(), constraints: constraintsSchema.optional() }
|
|
108
108
|
}, async (input) => { const result = await router.advise(input); await trackStatistics(input.client, { requestId: input.request_id, recommendation: result }); return content({ ...result, provider: mode }); });
|
|
109
109
|
server.registerTool('retry_spawn_recommendation', {
|
|
110
|
-
description: 'Supply one bounded task description after an Aptly Hook returns needs_context and a retry_id. Use the same MCP process within five minutes; no native call IDs are needed. May make one paid classification; duplicate input reuses its request identity, changed input conflicts. Never spawns or changes history. If still needs_context/unavailable, stop; do not create another ID. A blocked spawn_application remains advisory.',
|
|
110
|
+
description: 'Supply one bounded task description after an Aptly Hook returns needs_context and a retry_id. Use the same MCP process within five minutes; no native call IDs are needed. May make one paid classification; duplicate input reuses its request identity, changed input conflicts. Never spawns or changes history. If still needs_context/unavailable, stop; do not create another ID. A blocked spawn_application remains advisory. When next_call is supplied, required_fields and next_action describe only missing profile arguments. Apply them only under existing user/host permissions; if forbidden or unclear, stop and report. Existing-agent reuse is an alternative, not proof of applying this recommendation.',
|
|
111
111
|
annotations, inputSchema: { retry_id: z.string().regex(/^[a-f0-9]{64}$/), description: z.string().max(4000) }
|
|
112
112
|
}, async ({ retry_id, description }, extra) => {
|
|
113
113
|
let result;
|
|
@@ -124,7 +124,7 @@ export function createServer({ env: inputEnv = process.env } = {}) {
|
|
|
124
124
|
return content(result);
|
|
125
125
|
});
|
|
126
126
|
server.registerTool('prepare_fresh_delegation', {
|
|
127
|
-
description: 'Prepare a SEPARATE intentional Codex fresh-child call from a completed inherited recommendation. No classification or spawn. Use the original Hook retry_id on this process within five minutes. Only when the caller can declare independent work, no user-required inherited history, and complete standalone instructions. Never use for required/unknown history or to bypass permissions. Explicit choices and the original blocked invocation remain intact. Same task is idempotent; changed task conflicts.',
|
|
127
|
+
description: 'Prepare a SEPARATE intentional Codex fresh-child call from a completed inherited recommendation. No classification or spawn. Use the original Hook retry_id on this process within five minutes. Only when the caller can declare independent work, no user-required inherited history, and complete standalone instructions. Submit all returned next_call.arguments, including model and reasoning_effort, after caller review. Caller review checks arguments, not new user approval. If explicit user choices or higher-priority host instructions forbid either field, require parent-model inheritance, or their applicability is unclear, stop and report; do not submit a profile-omitted call or create another recovery ticket to bypass it. Never use for required/unknown history or to bypass permissions. Explicit choices and the original blocked invocation remain intact. Same task is idempotent; changed task conflicts.',
|
|
128
128
|
annotations: { ...annotations, openWorldHint: false }, inputSchema: { retry_id: z.string().regex(/^[a-f0-9]{64}$/), task_name: z.string().min(1).max(128), standalone_task: z.string().min(1).max(12000),
|
|
129
129
|
declaration: z.object({ independent_task: z.boolean(), same_task: z.boolean(), original_call_outcome: z.enum(['blocked', 'executed', 'unknown']), history_requirement: z.enum(['not_required', 'required', 'unknown']), standalone_context_complete: z.boolean() }).strict() }
|
|
130
130
|
}, async ({ retry_id, task_name, standalone_task, declaration }, extra) => {
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.17";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.17';
|
package/docs/SPAWN_CONTEXT.md
CHANGED
|
@@ -173,6 +173,16 @@ requires the parent to review and explicitly supply only unspecified model/effor
|
|
|
173
173
|
fields to a new compatible native call. Caller review means argument review,
|
|
174
174
|
not a request for new user approval. Existing delegation authorization and host
|
|
175
175
|
permission checks still apply; this advisory result grants neither.
|
|
176
|
+
Starting with 0.1.17, application-bearing retry/fresh outputs are checked by a shared Zod contract.
|
|
177
|
+
For an applicable retry, `required_fields` matches only returned missing fields,
|
|
178
|
+
`next_action` is `apply_returned_defaults`, and `on_unavailable` is
|
|
179
|
+
`stop_and_report`; fresh calls use `submit_prepared_call`. Blocked and
|
|
180
|
+
non-recommended outputs have no apply arguments. Internal inconsistency returns
|
|
181
|
+
`recovery_metadata_invalid` without validation data or a new provider call;
|
|
182
|
+
completed ledger results remain intact. Strict consumers must allow the additive
|
|
183
|
+
metadata. This validates output coherence, not caller compliance or permission.
|
|
184
|
+
If user/host restrictions prohibit application or are unclear, stop and report.
|
|
185
|
+
Existing-agent reuse is an alternative path, not evidence of applying advice.
|
|
176
186
|
The response supplies concrete fields in
|
|
177
187
|
`next_call.set_if_unspecified`, excluding original explicit choices. Claude
|
|
178
188
|
receives model only, never an effort field. Blocked results omit `next_call`. `blocked` requires reporting the original
|
|
@@ -365,6 +375,20 @@ new native call under unchanged host permissions and existing delegation
|
|
|
365
375
|
authorization. Neither preparation nor argument output proves dispatch/execution.
|
|
366
376
|
The process does not own native spawn or guarantee caller compliance.
|
|
367
377
|
|
|
378
|
+
Starting with 0.1.16, `spawn_application.required_fields` identifies the explicit `model` and
|
|
379
|
+
`reasoning_effort` that must accompany the separate call. Copy all returned
|
|
380
|
+
`next_call.arguments`; omitting the profile can trigger a new context-recovery
|
|
381
|
+
attempt when the native body is opaque. `caller_review_required` means argument
|
|
382
|
+
review, not a new user approval. If user choices or higher-priority host rules
|
|
383
|
+
forbid either field (including required parent-model inheritance), stop and
|
|
384
|
+
report that the profile cannot be applied. Do not use another recovery ticket
|
|
385
|
+
to bypass the restriction. If applicability of a user/host constraint is unclear,
|
|
386
|
+
stop and report the uncertainty instead of guessing or dropping fields. The Hook
|
|
387
|
+
preserves explicit fields; it does not verify that a new call matches a preparation.
|
|
388
|
+
Strict whole-response consumers must allow this additive object.
|
|
389
|
+
This metadata is caller guidance, not enforcement,
|
|
390
|
+
permission or native execution evidence; task prose grants no override authority.
|
|
391
|
+
|
|
368
392
|
The original five-minute lifetime and process/capacity boundaries apply. One
|
|
369
393
|
immutable preparation digest binds task, declaration, profile and original
|
|
370
394
|
reference; text/history are not persisted. Duplicate identical preparation is
|