aptly 0.1.10 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.en.md +10 -10
  2. package/README.ja.md +10 -10
  3. package/README.md +10 -10
  4. package/README.zh-CN.md +10 -10
  5. package/dist/bin/aptly.js +21 -16
  6. package/dist/src/cli-help.js +12 -10
  7. package/dist/src/cli-input.d.ts +19 -1
  8. package/dist/src/cli-input.js +23 -11
  9. package/dist/src/policy-source.d.ts +3 -0
  10. package/dist/src/policy-source.js +11 -0
  11. package/dist/src/server.d.ts +1 -1
  12. package/dist/src/server.js +10 -1
  13. package/dist/src/setup.d.ts +21 -0
  14. package/dist/src/setup.js +349 -5
  15. package/dist/src/transmission-review-cli.d.ts +11 -0
  16. package/dist/src/transmission-review-cli.js +35 -0
  17. package/dist/src/update-notifier.js +1 -1
  18. package/dist/src/version.d.ts +1 -1
  19. package/dist/src/version.js +1 -1
  20. package/docs/ADVISORY_USAGE.md +1 -1
  21. package/docs/DRAFT_0_1_0.md +1 -1
  22. package/docs/guide/en/advanced.md +217 -0
  23. package/docs/guide/en/benchmarks.md +32 -0
  24. package/docs/guide/en/budget.md +45 -0
  25. package/docs/guide/en/configuration.md +104 -0
  26. package/docs/guide/en/installation.md +114 -0
  27. package/docs/guide/en/routing.md +61 -0
  28. package/docs/guide/en/statistics.md +43 -0
  29. package/docs/guide/en/transmission.md +71 -0
  30. package/docs/guide/en/troubleshooting.md +99 -0
  31. package/docs/guide/en.md +80 -505
  32. package/docs/guide/ja/advanced.md +217 -0
  33. package/docs/guide/ja/benchmarks.md +32 -0
  34. package/docs/guide/ja/budget.md +45 -0
  35. package/docs/guide/ja/configuration.md +104 -0
  36. package/docs/guide/ja/installation.md +114 -0
  37. package/docs/guide/ja/routing.md +61 -0
  38. package/docs/guide/ja/statistics.md +43 -0
  39. package/docs/guide/ja/transmission.md +71 -0
  40. package/docs/guide/ja/troubleshooting.md +99 -0
  41. package/docs/guide/ja.md +80 -505
  42. package/docs/guide/ko/advanced.md +217 -0
  43. package/docs/guide/ko/benchmarks.md +32 -0
  44. package/docs/guide/ko/budget.md +45 -0
  45. package/docs/guide/ko/configuration.md +104 -0
  46. package/docs/guide/ko/installation.md +114 -0
  47. package/docs/guide/ko/routing.md +61 -0
  48. package/docs/guide/ko/statistics.md +43 -0
  49. package/docs/guide/ko/transmission.md +71 -0
  50. package/docs/guide/ko/troubleshooting.md +99 -0
  51. package/docs/guide/ko.md +80 -505
  52. package/docs/guide/zh-CN/advanced.md +217 -0
  53. package/docs/guide/zh-CN/benchmarks.md +32 -0
  54. package/docs/guide/zh-CN/budget.md +45 -0
  55. package/docs/guide/zh-CN/configuration.md +104 -0
  56. package/docs/guide/zh-CN/installation.md +114 -0
  57. package/docs/guide/zh-CN/routing.md +61 -0
  58. package/docs/guide/zh-CN/statistics.md +43 -0
  59. package/docs/guide/zh-CN/transmission.md +71 -0
  60. package/docs/guide/zh-CN/troubleshooting.md +99 -0
  61. package/docs/guide/zh-CN.md +80 -505
  62. package/package.json +2 -1
@@ -0,0 +1,43 @@
1
+ # Execution statistics
2
+
3
+ [한국어](../ko/statistics.md) · [English](../en/statistics.md) · [简体中文](../zh-CN/statistics.md) · [日本語](../ja/statistics.md)
4
+
5
+ [Guide home](../en.md)
6
+
7
+ ## On this page
8
+
9
+ - [Execution statistics (0.1.10 or later)](#guide-execution-statistics)
10
+
11
+ <a id="guide-execution-statistics"></a>
12
+
13
+ ## Execution statistics (0.1.10 or later)
14
+
15
+ Execution statistics require Aptly 0.1.10 or later. Install a supported version or upgrade following [package updates](installation.md#guide-package-updates), then use the examples below. An existing Aptly setup is required. Collection is initially POSIX-only; Windows collection is unsupported and normal Aptly use on Windows is unaffected.
16
+
17
+ ```sh
18
+ aptly stats
19
+ aptly stats --today --client codex
20
+ aptly stats enable --client codex
21
+ aptly stats enable --client codex --codex-native-metadata
22
+ aptly stats disable --client codex
23
+ ```
24
+
25
+ The command forms are `aptly stats [--today] [--client codex|claude|all]`, `aptly stats enable [--client] [--codex-native-metadata]` and `aptly stats disable [--client]`. Collection is off by default and postinstall does not enable it. Enable installs Aptly-owned command observers recorded separately in `stats-ownership.json`; it leaves the legacy receipt, MCP, launchers, keys, budget and transmission settings intact. Restart MCP and the host after enabling; for Codex, review native Hook trust in `/hooks`.
26
+
27
+ Disable turns collection off and removes only unchanged owned observers. Modified or custom observers are preserved with a warning; data and the key remain. `remove` validates and removes stats-owned definitions but keeps the data. Independently managed collectors and custom Hooks are not adopted automatically.
28
+
29
+ Private state uses `stats.sqlite`, `stats-config.json` and `stats-key` (an HMAC secret), separately from the budget ledger. Do not share the key. Records contain no task text, transcripts, raw IDs, paths, errors or credentials. Reading stats makes no API, key or credential-store calls, initializes nothing and runs no notifier.
30
+
31
+ The projection reports `model_match`, `model_mismatch`, `model_changed`, `unknown`, `pending`, `expired_pending` and `application_unconfirmed`; advisory is separate. `blocked`, `explicit_preserved` and `unbound` are excluded from denominators. Effective effort is never measured; configured effort is not actual effort. Claude aliases `haiku`, `sonnet`, `opus` and `fable` cannot be resolved to an actual canonical model and are `unknown`; only exact canonical models are supported, and observing a model does not guarantee all aliases match. These figures do not establish user acceptance or quality.
32
+
33
+ Direct advisory, retries and fresh unbound calls without native continuity are not joined by approximate timing. `--today` uses the UTC date when the binding was first created. Capacity is fixed at 10,000 delegations and 10,000 children, with no automatic pruning. Counts cover retained records, not lifetime totals; at capacity, new identities are dropped and the reached flag is set. Missing callbacks do not prove bypass. There are no token or cost rollups, live quota or savings figures.
34
+
35
+ Codex native metadata is off unless explicitly enabled. It reads SQLite native metadata by exact child ID only: no transcripts, repairs or app-server launch. Relocated `sqlite_home`, unsupported schemas or paths, and ambiguous joins yield unknown. A SQL read may update existing SHM read marks; it writes no rows or schema and does not intentionally create sidecars.
36
+
37
+ Collection is best effort: lost, delayed or capacity-dropped events can leave an incomplete model history. `model_match` means the retained evidence matches, not that every request used that model. Disabling Codex collection, removing setup or enabling without `--codex-native-metadata` revokes native metadata access. After changing the Node or package path, disable and re-enable collection to register current commands. An unavailable or corrupt store is preserved; review it locally rather than deleting the key or assuming zero usage.
38
+
39
+ ## Related topics
40
+
41
+ [Automatic recommendations](routing.md) · [Decisions API transmission](transmission.md) · [Troubleshooting](troubleshooting.md)
42
+
43
+ [Guide home](../en.md)
@@ -0,0 +1,71 @@
1
+ # Decisions API transmission
2
+
3
+ [한국어](../ko/transmission.md) · [English](../en/transmission.md) · [简体中文](../zh-CN/transmission.md) · [日本語](../ja/transmission.md)
4
+
5
+ [Guide home](../en.md)
6
+
7
+ The transmission review described below is an **unreleased source feature**; it is not included in the published Aptly 0.1.10 package.
8
+
9
+ ## On this page
10
+
11
+ - [Decisions API transmission scope](#guide-transmission-scope)
12
+ - [Outbound content and filtering limits](#guide-transmission-limits)
13
+
14
+ <a id="guide-transmission-scope"></a>
15
+
16
+ ## Decisions API transmission scope
17
+
18
+ The transmission commands in this section are supported from Aptly 0.1.7.
19
+
20
+ Transmission means **sending local task information to the OpenAI Decisions API**, not providing tasks to Aptly developers. Application mode `defaults/advisory` and transmission scope are independent. New registrations use v2 policy with `unselected` scope and make no automatic transmission.
21
+
22
+ In published 0.1.10, interactive `aptly set default` asks only for unselected hosts; Enter selects `none`. Noninteractive runs and postinstall do not prompt or imply consent.
23
+
24
+ In the unreleased source, the first normal interactive `aptly setup` or `aptly set default` presents one grouped review for clients awaiting review, showing each current value, provenance, and default or overridden home. `excerpt` is recommended as option 3. Enter or keep preserves an existing explicit or legacy scope, including `none`; an unselected scope becomes `none`. Explicit `setup --transmission` or `set transmission <scope>` records the actual choice as reviewed. A private revision 1 marker is stored per client home, independent of package version, mode, and statistics, so ordinary patch updates and restarts do not repeat the review.
25
+
26
+ The new command below always asks again by explicit request; it is not available in published 0.1.10:
27
+
28
+ ```sh
29
+ aptly set transmission --review
30
+ ```
31
+
32
+ Canceling leaves scopes and review markers unchanged; normal setup or default configuration may already have applied non-transmission defaults. Automatic setup, check, migrate, explicit-transmission setup, CI, non-TTY execution, skipped setup, npm lifecycle scripts, MCP, Hooks, help, show, and statistics reads do not prompt. Prompts use stderr and leave JSON stdout clean. Existing disabled policies, modes, launchers, keys, ledgers, statistics, and trust settings are preserved.
33
+
34
+ The 0.1.10 update process cannot load the new question immediately. For the first rollout, run interactive `aptly setup`, `aptly set default`, or `aptly set transmission --review` after upgrading to a release that contains it. Future updates containing this feature print the next step without spawning a new process.
35
+
36
+ ```sh
37
+ aptly set transmission --show
38
+ aptly set transmission none
39
+ aptly set transmission description
40
+ aptly set transmission excerpt
41
+ ```
42
+
43
+ The change commands above show alternatives; run only the one you want. Use `--client codex|claude|all` to select hosts. `none` disables automatic transmission and preserves the original call. `description` permits only a parent-supplied description. Without one, it requests context before calling the API and never falls back to native body or label. `defaults` denies the unresolved spawn; `advisory` supplies feedback only. `excerpt` permits existing native excerpts and explicit descriptions. Source, size and known-secret checks establish neither non-sensitive content nor user consent.
44
+
45
+ Existing v1 policies remain byte-identical and report `excerpt` with `legacy` provenance. An explicit change migrates the policy to v2 and updates its ownership receipt together. Modified policies and custom launchers are not silently adopted; conflicts preserve them. Keys, ledgers and unknown records are not deleted. Restart MCP after changes. Already-started transmission cannot be recalled; changed policy prevents in-flight results, retry and fresh preparation from applying. Do not bypass an old call-binding conflict with a new paid identity. Explicit `recommend_agent` and `aptly recommend` requests remain separate and are not prohibited by this automatic-transmission setting.
46
+
47
+ Manually setting `enabled: false` remains an emergency stop, but can conflict with ownership records. Use the commands above for normal changes and never edit ownership receipts to bypass checks.
48
+
49
+ <a id="guide-transmission-limits"></a>
50
+
51
+ ## Outbound content and filtering limits
52
+
53
+ Under `excerpt` scope, Without prepared context, automatic classification `summary` is an **excerpt assembled from an accepted task label and the clipped first paragraph** of the body. It is not a semantic rewrite or anonymization. Its UTF-8 size is at most `min(4000, max_summary_bytes)`; this is not a limit on the whole HTTP request. The opaque-message fallback in Codex uses only a sufficiently descriptive `task_name`, without decoding or transmitting that body. Labels can also contain sensitive information.
54
+
55
+ A valid `prepare_spawn_context` description and fixed prefix replace the native excerpt for classification; registration itself makes no API call. After a needs-context response, `retry_spawn_recommendation` can classify one new supplement with a fixed prefix, without appending the earlier body. Both paths limit the raw description to `min(3800, max_summary_bytes - 96)` bytes and the prefixed summary to `min(4000, max_summary_bytes)` bytes. `prepare_fresh_delegation` itself reuses completed advice without another classification and returns standalone instructions as local next-call arguments. A Codex call submitted with the returned explicit model and effort is currently preserved by the Hook as `explicit_model`, without classification. Checking a later call does not imply another classification. None of these paths establishes that descriptions are non-sensitive or automatically anonymized.
56
+
57
+ Decisions receives `client`, `task.summary`, `task.operation`, `task.context_sufficient`, candidate profile IDs, model/effort descriptions, and configured model facts. The classification API key is sent in `Authorization`; the request ID is sent in `X-Client-Request-Id`. Automatic IDs are hashes; direct recommendation IDs are caller-supplied. Do not put secrets in IDs or candidate descriptions.
58
+
59
+ To disable automatic sharing, change **only `enabled` to `false`** in the existing private policy file referenced by `APTLY_HOOK_POLICY_PATH`. Preserve the other fields and ownership record. Subsequent automatic Hook calls preserve the original call before classification or creation of a call-binding file. This cannot undo a transmission already started or recall information received by the server. Editing a generated policy can cause ownership conflicts in setup, configuration, or removal commands; those commands do not overwrite the disabled policy. Do not edit ownership records to bypass the checks.
60
+
61
+ When the transmission scope permits it, `mode: advisory` still transmits classification data; it is not a privacy opt-out. Removing `APTLY_HOOK_POLICY_PATH` can activate the older strict path, so do not use removal as an alternative. `enabled: false` does not block explicit `recommend_agent` or `aptly recommend` requests.
62
+
63
+ For control over the shared summary, disable automatic sharing and write only the information needed for a direct recommendation. Aptly does not automatically fetch documents at URLs or attach source files mentioned in the summary. Checks for known key and Bearer patterns do not provide complete secret detection or establish that text is safe to transmit.
64
+
65
+ The ledger and Hook bindings store request metadata, hashes, and cached results, not task excerpts. Aptly diagnostics also exclude raw task text. The local Hook's `updatedInput` retains the original task so the host can continue execution. Aptly does not control the host's own transcript or log retention.
66
+
67
+ ## Related topics
68
+
69
+ [Automatic recommendations](routing.md) · [Budget limits](budget.md) · [Execution statistics](statistics.md)
70
+
71
+ [Guide home](../en.md)
@@ -0,0 +1,99 @@
1
+ # Troubleshooting
2
+
3
+ [한국어](../ko/troubleshooting.md) · [English](../en/troubleshooting.md) · [简体中文](../zh-CN/troubleshooting.md) · [日本語](../ja/troubleshooting.md)
4
+
5
+ [Guide home](../en.md)
6
+
7
+ ## On this page
8
+
9
+ - [Account home and Hook registration](#guide-account-home-recovery)
10
+ - [Recover an incompatible launcher](#guide-launcher-recovery)
11
+ - [Interrupted processes and ledger locks](#guide-ledger-lock-recovery)
12
+
13
+ <a id="guide-account-home-recovery"></a>
14
+
15
+ ## Account home and Hook registration
16
+
17
+ First compare `CODEX_HOME` in the environment launching Codex with the home selected by the CLI. Editing a policy path in `config.toml` does not create the target policy file or ownership record. These queries do not reset keys or state.
18
+
19
+ ```sh
20
+ aptly setup --check --client codex
21
+ aptly stats --client codex
22
+ ```
23
+
24
+ | Result | What to check |
25
+ |---|---|
26
+ | `hook_policy_path_conflict` / `statistics_policy_conflict` | Compare the selected account home, MCP policy reference and actual policy location. Do not copy state across homes or blindly overwrite an existing reference. |
27
+ | `statistics_requires_setup` | Check MCP registration, the policy file and setup record in the selected home. Establish that normal setup is valid for that home first. |
28
+ | `existing_hook_not_owned` | An Aptly Hook exists without valid setup ownership. Back up and review its definition before explicit recovery; do not edit or copy ownership records to bypass validation. |
29
+
30
+ After the setup check succeeds, follow [statistics activation](statistics.md). `collection.codex: true` describes collection configuration, not proof that the running host loaded or trusted the Hook. Restart Codex for the intended account and inspect the actual entries in `/hooks`.
31
+
32
+ ### Policy paths revert in managed accounts
33
+
34
+ Planned for 0.1.11. A manager such as Orca can mirror a same-name MCP registration from the canonical home and overwrite an account-only absolute policy path. Hooks can remain intact while MCP and statistics reference different policies.
35
+
36
+ Upgrade every registered Aptly backend first and stop the affected hosts/MCP processes. For an existing Codex setup with intact ownership, explicitly migrate the canonical/default registration first, then repeat in each intended account environment with its selected `CODEX_HOME`. An account-only edit can still be overwritten by synchronization.
37
+
38
+ ```sh
39
+ CODEX_HOME="$HOME/.codex" aptly setup --client codex --policy-source codex-home --dry-run
40
+ CODEX_HOME="$HOME/.codex" aptly setup --client codex --policy-source codex-home
41
+ CODEX_HOME="$HOME/.codex" aptly setup --check --client codex
42
+ CODEX_HOME="$HOME/.codex" aptly stats --client codex
43
+ ```
44
+
45
+ Migration registers `APTLY_HOOK_POLICY_PATH = "@codex-home"` and forwards `CODEX_HOME` through `env_vars`. At startup, the server selects that home's `aptly/auto-policy.json`. Missing, empty or relative values are rejected without selecting another home. MCP startup still requires an explicit forwarded home, including `CODEX_HOME="$HOME/.codex"` for the default home. If the 0.1.11 CLI reports `policy_source_home_invalid` in an ordinary terminal without the variable, use the explicit default home as above. The 0.1.12 CLI fix validates its already selected standard `~/.codex` when the variable is absent; explicit account selection and invalid-value rejection remain intact. The example uses the default home; substitute the intended absolute account home for account-specific commands. This is an operator-declared source selection, not complete host provenance. See [Codex MCP environment forwarding](https://learn.chatgpt.com/docs/extend/mcp#stdio-servers).
46
+
47
+ Migration does not move or reset policy contents, transmission consent, ledger paths, statistics history or Hook trust. Existing fixed/shared policies remain fixed unless explicitly migrated. Custom launchers, unrelated registration changes and ownership mismatches require local review; do not edit or copy receipts to bypass errors. Restart the server and check again in the intended account. A successful dry-run or file check does not prove the running MCP updated or a model was observed.
48
+
49
+ <a id="guide-launcher-recovery"></a>
50
+
51
+ ## Recover an incompatible launcher
52
+
53
+ These options require Aptly 0.1.2 or later and are not in npm 0.1.1. To test from source, run `npm ci --ignore-scripts` and `npm run build`, then replace `aptly` below with `node bin/aptly.ts`.
54
+
55
+ Key setup diagnoses selected hosts before input or storage. If any host fails, it does not prompt or change any host. `--check` does not access keys or the credential store.
56
+
57
+ From Aptly 0.1.9, on Linux, `--check` also checks for an executable `secret-tool` and, when a safe explicit session-bus address and `gdbus` are available, reads bus metadata without activating or accessing the credential service. Confirmed failures report `secure_store_unavailable` with `secure_store_secret_tool_missing`, `secure_store_bus_missing`, or `secure_store_service_missing` before input. `secure_store_bus_unverified`, `secure_store_probe_unavailable`, and service-present or activatable unverified codes mean readiness is unknown; a running or activatable service does not prove it is unlocked or writable. Install `secret-tool` and a Secret Service provider, and run from the intended desktop session when needed. The actual store operation can still fail. For SSH or headless sessions, supply `OPENAI_API_KEY` securely to the host MCP process when `APTLY_SECRET_BACKEND` is absent; preserve an existing authentication wrapper or environment. `credential_node_mismatch`, `credential_server_mismatch`, and `credential_runtime_unsupported` identify incompatible Node paths, server paths, and OS-store support respectively.
58
+
59
+ If only Claude failed, diagnose that host and review migration only when `launcher_migration_available` is returned:
60
+
61
+ ```sh
62
+ aptly set env OPENAI_API_KEY --client claude --check
63
+ aptly setup --client claude --migrate-launcher --dry-run
64
+ aptly setup --client claude --migrate-launcher
65
+ aptly set env OPENAI_API_KEY --client claude
66
+ ```
67
+
68
+ `--dry-run` makes no changes. Migration replaces the Node/server paths of a receipt-matching, Aptly-owned standard registration with the current build. It preserves environment settings, Hooks, policy and other hosts, accesses no credentials, and never executes the old launcher. Custom wrappers and missing or modified ownership records are rejected. Review such registrations locally; use the wrapper's secure environment or a separately reviewed standard registration. Do not edit or delete ownership records to bypass validation.
69
+
70
+ From Aptly 0.1.9, `aptly setup --check --client codex|claude|all` reads the normal setup plan without writing files or creating directories. It is a snapshot, not a check of the running host. Only `--client` can be combined with `--check`. If `hook_policy_path_conflict` appears, review the selected host configuration directory and existing policy reference locally, then select the intended host directory before retrying. Setup preserves the existing configuration and does not move or copy the policy; launcher migration does not resolve this mismatch.
71
+
72
+ If `launcher_migration_not_owned` refers to a preserved registration (`mcp_created: false`), **Aptly 0.1.3 or later** offers the explicit `--include-existing` opt-in. Install 0.1.3 or later, then run:
73
+
74
+ ```sh
75
+ aptly setup --client claude --migrate-launcher --include-existing --dry-run
76
+ aptly setup --client claude --migrate-launcher --include-existing
77
+ ```
78
+
79
+ Review the local registration first. A valid existing Aptly ownership receipt and matching managed environment additions, Hook, and policy are required. Only an absolute Node path with a single standard server path is accepted; wrappers and registrations without a receipt remain unsupported. This does not make the entire MCP registration Aptly-owned: later removal preserves the migrated launcher and original user settings. The option applies only to explicit single-client migration, never automatic installation.
80
+
81
+ A successful Codex configuration needs no reset. Retry only the affected host and restart MCP. Codex still requires `/hooks` trust review. Changes after diagnosis stop with `concurrent_configuration_change`. If recovery observes another key or cannot read the current key, it leaves the store unchanged and reports `credential_rollback_failed`. Files and the OS store do not form an atomic transaction; avoid concurrent configuration operations.
82
+
83
+ <a id="guide-ledger-lock-recovery"></a>
84
+
85
+ ## Interrupted processes and ledger locks
86
+
87
+ This locking design requires Aptly `0.1.2` or later and is not included in npm `0.1.1`. The JSON ledger keeps its request IDs, `unknown` records, completed cache, call counts, and reserved costs. Only persistent ledgers use Node.js 24's built-in SQLite. The adjacent `ledger.json.lock` remains after a normal exit; its presence alone does not mean an active lock. With the new design, process exit releases the OS lock so a later request can use the same ledger. It does not retry an existing uncertain ID or refund reserved costs.
88
+
89
+ Keep the ledger and lock in a private directory on a local filesystem that supports hard links, and use one canonical path for each ledger. Network shares, cloud-synced directories, and path aliases are outside the supported scope. Do not delete or replace the new lock or SQLite journal, or open them with another database tool while in use. Age and PID alone do not establish that an owner has exited.
90
+
91
+ An old empty `.lock` cannot establish whether its owner is still alive, so it is never initialized or removed automatically. Stop every relevant host, MCP process, and ledger-accessing process, including older versions, and upgrade all writers. Only after confirming that the file belongs to the legacy locking design may you quarantine that file and restart against the same JSON ledger path. Do not reset or delete the ledger, `unknown` records, costs, or completed results. If ownership or format is uncertain, leave access blocked and investigate.
92
+
93
+ See [Diagnostics and development](advanced.md#guide-diagnostics-and-development) for diagnostic reports.
94
+
95
+ ## Related topics
96
+
97
+ [Configuration and model candidates](configuration.md) · [Installation and updates](installation.md) · [Advanced MCP integration and development](advanced.md)
98
+
99
+ [Guide home](../en.md)