aptly 0.1.12 → 0.1.14

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 (53) hide show
  1. package/dist/bin/aptly.js +21 -4
  2. package/dist/src/automatic-hook.d.ts +7 -0
  3. package/dist/src/automatic-hook.js +33 -15
  4. package/dist/src/cli-help.js +7 -6
  5. package/dist/src/context-retry.d.ts +10 -0
  6. package/dist/src/context-retry.js +16 -3
  7. package/dist/src/core.d.ts +2 -0
  8. package/dist/src/core.js +39 -35
  9. package/dist/src/doctor.d.ts +87 -0
  10. package/dist/src/doctor.js +182 -0
  11. package/dist/src/files.js +2 -2
  12. package/dist/src/host-paths.d.ts +10 -0
  13. package/dist/src/host-paths.js +15 -0
  14. package/dist/src/query-snapshot.d.ts +17 -0
  15. package/dist/src/query-snapshot.js +112 -0
  16. package/dist/src/server.js +2 -0
  17. package/dist/src/setup.d.ts +8 -5
  18. package/dist/src/setup.js +248 -60
  19. package/dist/src/stable-runtime.d.ts +61 -0
  20. package/dist/src/stable-runtime.js +694 -0
  21. package/dist/src/statistics.d.ts +48 -2
  22. package/dist/src/statistics.js +87 -6
  23. package/dist/src/version.d.ts +1 -1
  24. package/dist/src/version.js +1 -1
  25. package/docs/guide/en/advanced.md +6 -0
  26. package/docs/guide/en/configuration.md +27 -1
  27. package/docs/guide/en/installation.md +2 -2
  28. package/docs/guide/en/statistics.md +4 -0
  29. package/docs/guide/en/transmission.md +7 -5
  30. package/docs/guide/en/troubleshooting.md +4 -2
  31. package/docs/guide/en.md +2 -0
  32. package/docs/guide/ja/advanced.md +6 -0
  33. package/docs/guide/ja/configuration.md +27 -1
  34. package/docs/guide/ja/installation.md +2 -2
  35. package/docs/guide/ja/statistics.md +4 -0
  36. package/docs/guide/ja/transmission.md +7 -5
  37. package/docs/guide/ja/troubleshooting.md +4 -2
  38. package/docs/guide/ja.md +2 -0
  39. package/docs/guide/ko/advanced.md +6 -0
  40. package/docs/guide/ko/configuration.md +27 -1
  41. package/docs/guide/ko/installation.md +2 -2
  42. package/docs/guide/ko/statistics.md +4 -0
  43. package/docs/guide/ko/transmission.md +7 -5
  44. package/docs/guide/ko/troubleshooting.md +4 -2
  45. package/docs/guide/ko.md +2 -0
  46. package/docs/guide/zh-CN/advanced.md +6 -0
  47. package/docs/guide/zh-CN/configuration.md +27 -1
  48. package/docs/guide/zh-CN/installation.md +2 -2
  49. package/docs/guide/zh-CN/statistics.md +4 -0
  50. package/docs/guide/zh-CN/transmission.md +7 -5
  51. package/docs/guide/zh-CN/troubleshooting.md +4 -2
  52. package/docs/guide/zh-CN.md +2 -0
  53. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { type Client } from './types.ts';
2
+ import { QuerySnapshot } from './query-snapshot.ts';
2
3
  export declare const STATISTICS_CONFIG_FILE = "stats-config.json";
3
4
  export declare const STATISTICS_KEY_FILE = "stats-key";
4
5
  export declare const STATISTICS_DATABASE_FILE = "stats.sqlite";
@@ -43,16 +44,20 @@ export declare function serializeStatisticsConfig(value: StatisticsConfig): stri
43
44
  export declare function loadStatisticsConfig(options: StatisticsOptions): StatisticsConfig | null;
44
45
  export declare function statisticsHash(key: string, domain: Parameters<StatisticsHash>[0], client: Client, value: string): string;
45
46
  export declare function loadStatisticsHash(options: StatisticsOptions): StatisticsHash | null;
47
+ /** Explicit enable-time initialization only; read queries and observers retain their own paths. */
48
+ export declare function initializeStatisticsStore(options: StatisticsOptions): void;
46
49
  export declare function recordStatisticsRecommendation(options: StatisticsOptions, input: StatisticsRecommendation): StatisticsResult;
47
50
  export declare function observeStatistics(options: StatisticsOptions, input: {
48
51
  client: Client;
49
52
  event: unknown;
50
53
  }, bridge?: StatisticsBridge): StatisticsResult;
51
54
  export type ModelState = 'model_match' | 'model_mismatch' | 'model_changed' | 'unknown' | 'pending' | 'expired_pending' | 'application_unconfirmed';
52
- export declare function readStatistics(options: StatisticsOptions, filter?: {
55
+ type StatisticsFilter = {
53
56
  client?: Client | 'all';
54
57
  today?: boolean;
55
- }): {
58
+ };
59
+ /** Existing best-effort projection, including its historical status semantics. */
60
+ export declare function readStatistics(options: StatisticsOptions, filter?: StatisticsFilter): {
56
61
  status: string;
57
62
  scope: string;
58
63
  semantics: string;
@@ -88,3 +93,44 @@ export declare function readStatistics(options: StatisticsOptions, filter?: {
88
93
  model_alias_scope: string;
89
94
  counts_are_lifetime: boolean;
90
95
  };
96
+ /** Read the same projection while reporting query failures separately. */
97
+ export declare function readStatisticsQuery(options: StatisticsOptions, filter?: StatisticsFilter, snapshot?: QuerySnapshot, configurationExpected?: boolean): {
98
+ result: {
99
+ status: string;
100
+ scope: string;
101
+ semantics: string;
102
+ observation_completeness: string;
103
+ today_basis: string;
104
+ filter: {
105
+ client: "all" | Client;
106
+ today: boolean;
107
+ };
108
+ collection: {
109
+ codex: boolean;
110
+ claude: boolean;
111
+ };
112
+ capacity: {
113
+ delegations: number;
114
+ children: number;
115
+ reached: boolean;
116
+ };
117
+ delegations: number;
118
+ auto: Record<ModelState, number>;
119
+ advisory: Record<ModelState, number>;
120
+ blocked: number;
121
+ explicit_preserved: number;
122
+ unbound: number;
123
+ effort_actual_unknown: number;
124
+ application_confirmed: number;
125
+ unknown_alias_count: number;
126
+ model_observed: number;
127
+ model_comparable: number;
128
+ model_match_denominator: number;
129
+ observation_denominator: number;
130
+ usage_scope: string;
131
+ model_alias_scope: string;
132
+ counts_are_lifetime: boolean;
133
+ };
134
+ failed: boolean;
135
+ };
136
+ export {};
@@ -4,6 +4,7 @@ import { createRequire } from 'node:module';
4
4
  import { isAbsolute, join } from 'node:path';
5
5
  import { assertPrivateStatePath, readRegularFile } from './files.js';
6
6
  import { isRecord } from './types.js';
7
+ import { QuerySnapshot } from './query-snapshot.js';
7
8
  export const STATISTICS_CONFIG_FILE = 'stats-config.json';
8
9
  export const STATISTICS_KEY_FILE = 'stats-key';
9
10
  export const STATISTICS_DATABASE_FILE = 'stats.sqlite';
@@ -147,6 +148,19 @@ function connection(options, write) {
147
148
  throw error;
148
149
  }
149
150
  }
151
+ /** Explicit enable-time initialization only; read queries and observers retain their own paths. */
152
+ export function initializeStatisticsStore(options) {
153
+ const path = join(options.stateDirectory, STATISTICS_DATABASE_FILE);
154
+ assertPrivateStatePath(path);
155
+ checkSidecars(path);
156
+ if (!existsSync(path))
157
+ initialize(path);
158
+ // Validate an existing store without replacing it or opening a write transaction.
159
+ const db = connection(options, false);
160
+ if (!db)
161
+ throw new Error('statistics_database_invalid');
162
+ db.close();
163
+ }
150
164
  function rows(db, table) {
151
165
  return db.prepare(`SELECT * FROM ${table} ORDER BY created,id`).all().map(row => ({ ...row, data: JSON.parse(String(row.data)) }));
152
166
  }
@@ -356,21 +370,70 @@ function modelState(d, c, ambiguous, created, now) {
356
370
  return 'unknown';
357
371
  return expected === actual ? 'model_match' : 'model_mismatch';
358
372
  }
359
- export function readStatistics(options, filter = {}) {
373
+ function readStatisticsInternal(options, filter, snapshot, configurationExpected = false) {
360
374
  const now = (options.now ?? Date.now)();
361
375
  const output = { status: 'ok', scope: 'retained_records', semantics: 'retained_routing_records_not_user_acceptance_or_execution_total', observation_completeness: 'best_effort_not_full_execution_history', today_basis: 'UTC_binding_creation', filter: { client: filter.client ?? 'all', today: filter.today === true },
362
376
  collection: { codex: false, claude: false }, capacity: { delegations: limit(options.maxDelegations), children: limit(options.maxChildren), reached: false },
363
377
  delegations: 0, auto: emptyCounts(), advisory: emptyCounts(), blocked: 0, explicit_preserved: 0, unbound: 0,
364
378
  effort_actual_unknown: 0, application_confirmed: 0, unknown_alias_count: 0, model_observed: 0, model_comparable: 0, model_match_denominator: 0, observation_denominator: 0,
365
379
  usage_scope: 'not_collected', model_alias_scope: 'exact_canonical_model_ids_only', counts_are_lifetime: false };
366
- const config = loadStatisticsConfig(options);
380
+ let failed = false;
381
+ let config = null;
382
+ let configAbsent = false;
383
+ if (snapshot) {
384
+ try {
385
+ const bytes = snapshot.read(join(options.stateDirectory, STATISTICS_CONFIG_FILE), { privateFile: true, maxBytes: 8192, singleLink: true });
386
+ if (bytes === null)
387
+ configAbsent = true;
388
+ else {
389
+ config = parseStatisticsConfig(JSON.parse(bytes.toString('utf8')));
390
+ if (!config)
391
+ failed = true;
392
+ }
393
+ }
394
+ catch {
395
+ failed = true;
396
+ }
397
+ }
398
+ else
399
+ config = loadStatisticsConfig(options);
367
400
  for (const client of config?.enabled_clients ?? [])
368
401
  output.collection[client] = true;
402
+ if (snapshot && configAbsent && configurationExpected)
403
+ failed = true;
404
+ if (snapshot && configAbsent)
405
+ try {
406
+ if (snapshot.track(join(options.stateDirectory, STATISTICS_KEY_FILE), { privateFile: true, singleLink: true, identityOnly: true }))
407
+ failed = true;
408
+ }
409
+ catch {
410
+ failed = true;
411
+ }
412
+ const collectionExpected = !!config?.enabled_clients.some(client => !filter.client || filter.client === 'all' || filter.client === client);
369
413
  let db = null;
370
414
  try {
415
+ if (snapshot) {
416
+ let present;
417
+ try {
418
+ present = snapshot.track(join(options.stateDirectory, STATISTICS_DATABASE_FILE), { privateFile: true, singleLink: true, identityOnly: true });
419
+ }
420
+ catch {
421
+ failed = true;
422
+ }
423
+ if (present === false) {
424
+ if (collectionExpected)
425
+ failed = true;
426
+ return { result: output, failed };
427
+ }
428
+ if (present && configAbsent)
429
+ failed = true;
430
+ }
371
431
  db = connection(options, false);
372
- if (!db)
373
- return output;
432
+ if (!db) {
433
+ if (snapshot && collectionExpected)
434
+ failed = true;
435
+ return { result: output, failed };
436
+ }
374
437
  // All projection inputs must come from one SQLite snapshot. Separate implicit
375
438
  // SELECT transactions can otherwise combine old bindings with new child facts.
376
439
  db.exec('BEGIN');
@@ -453,11 +516,11 @@ export function readStatistics(options, filter = {}) {
453
516
  }
454
517
  }
455
518
  }
456
- return output;
519
+ return { result: output, failed };
457
520
  }
458
521
  catch {
459
522
  output.status = 'unavailable';
460
- return output;
523
+ return { result: output, failed: true };
461
524
  }
462
525
  finally {
463
526
  try {
@@ -470,3 +533,21 @@ export function readStatistics(options, filter = {}) {
470
533
  catch { }
471
534
  }
472
535
  }
536
+ /** Existing best-effort projection, including its historical status semantics. */
537
+ export function readStatistics(options, filter = {}) {
538
+ return readStatisticsInternal(options, filter).result;
539
+ }
540
+ /** Read the same projection while reporting query failures separately. */
541
+ export function readStatisticsQuery(options, filter = {}, snapshot, configurationExpected = false) {
542
+ const owned = snapshot === undefined;
543
+ const view = snapshot ?? new QuerySnapshot();
544
+ const outcome = readStatisticsInternal(options, filter, view, configurationExpected);
545
+ if (owned)
546
+ try {
547
+ view.verify();
548
+ }
549
+ catch {
550
+ outcome.failed = true;
551
+ }
552
+ return outcome;
553
+ }
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.12";
1
+ export declare const VERSION = "0.1.14";
@@ -1 +1 @@
1
- export const VERSION = '0.1.12';
1
+ export const VERSION = '0.1.14';
@@ -185,6 +185,12 @@ The current automatic Hook has no field for passing a URL separately as plaintex
185
185
 
186
186
  ## Diagnostics and development
187
187
 
188
+ `aptly doctor [--client codex|claude|all]` reads local registration, policy, registered package versions and ledger metadata using a separate JSON schema (`kind: aptly-doctor`, `schema_version: 1`). `complete`/exit 0 means the query completed; `partial`/exit 1 means an observation failed. Neither certifies host readiness. Connected MCP version, Hook trust/execution, restart need and ticket usage remain `unknown` locally. It never executes registered launchers, queries credential stores, calls APIs/networks, creates/modifies state or shows update notifications.
189
+
190
+ The ledger size is checked first through a safe path. At most 4 MiB is validated using the existing storage schema before reporting `total`, `complete` and `unknown` counts. Larger files return `scan_skipped_size_limit` without reading the body. A missing first-use ledger means unobserved history, not zero records. Changes during observation discard counts with `changed_during_observation`. Diagnostic timing includes validation/rechecks; write timing is `not_measured`. Output excludes keys, paths, environment values, request IDs and task bodies. Only numeric release versions are shown; arbitrary version suffixes produce `unsupported_version_metadata`.
191
+
192
+ The connected MCP's `get_routing_capabilities.runtime_diagnostics` adds the responding process version, policy source kind and process-local recovery slot `capacity`, `used`, `remaining`, `expired_retained` and `in_flight`. Expired tickets still occupy slots. Observation neither renews/prunes tickets nor checks retry eligibility (`retry_eligibility: not_checked`). Existing `credential_status` is a startup snapshot. Matching versions prove neither settings reload nor that all writers stopped. Strict MCP consumers must allow this additive object. The existing `aptly report` schema and file exports remain unchanged.
193
+
188
194
  ```sh
189
195
  aptly report --format both --output-dir reports
190
196
  ```
@@ -16,6 +16,7 @@ For manual MCP configuration, see [Advanced integration](advanced.md#guide-manua
16
16
  - [Configure with the CLI](#guide-cli-configuration)
17
17
  - [Keys and restarting](#guide-keys-and-restart)
18
18
  - [Models and environment variables](#guide-models-and-environment)
19
+ - [Node-version-independent launcher](#guide-stable-launcher)
19
20
 
20
21
  <a id="guide-host-config-locations"></a>
21
22
 
@@ -32,7 +33,7 @@ Claude Code stores Hooks in `~/.claude/settings.json` by default, or `$CLAUDE_CO
32
33
 
33
34
  ## Configure with the CLI
34
35
 
35
- In unreleased source, the first normal interactive `aptly set default` groups pending transmission reviews by client home. The recommendation is `excerpt`; Enter preserves an existing scope or selects `none` if unselected. See [transmission review](transmission.md#guide-transmission-scope). This review is not in published 0.1.10.
36
+ From 0.1.11, the first normal interactive `aptly set default` groups pending transmission reviews by client home. The recommendation is `excerpt`; Enter preserves an existing scope or selects `none` if unselected. See [transmission review](transmission.md#guide-transmission-scope). This review flow is not supported in 0.1.10, so update first.
36
37
 
37
38
  The `set` commands require 0.1.1 or later. Commands do not automatically switch existing launch paths. API-key setup accepts only the current package’s standard Node/server registration with a verified OS-source-compatible runtime. Custom wrappers, older versions, and other installation prefixes are rejected with `credential_launcher_unverified`; explicitly switch the registration or upgrade it before trying again.
38
39
 
@@ -66,6 +67,29 @@ A store timeout or malformed acknowledgement may occur after the OS has written
66
67
 
67
68
  Restart MCP, then inspect `provider`, candidates, and `credential_status` with `get_routing_capabilities`. `os_store` means a key was loaded, not that the API authenticated it. Default and public-variable setup continue to preserve custom wrappers. API-key setup does not change host settings for an unverified launch path and restores that host's previous key where possible if storage was already attempted. Do not assume a new key automatically takes effect through an existing wrapper. These commands do not bypass Codex `/hooks` trust or host permissions.
68
69
 
70
+ <a id="guide-stable-launcher"></a>
71
+
72
+ ## Node-version-independent launcher
73
+
74
+ This option is available starting with 0.1.14. Explicit `--launcher stable` on POSIX (macOS/Linux) preserves an executable and Aptly runtime dependencies in private storage outside versioned Node directories. It does not copy Node: an installed supported Node.js 24+ is still required. After the original Node and npm package directory disappear, the preserved launcher can locate another supported installation. Bare `node` cannot offer that guarantee when a GUI host lacks it in PATH.
75
+
76
+ Default/automatic and existing registrations keep direct Node paths. Use `aptly setup --client all --launcher stable` only for new registrations. For existing ones, inspect then migrate explicitly as below. Use `--client claude` for Claude and select the intended `CODEX_HOME` for each Codex account.
77
+
78
+ ```sh
79
+ aptly setup --client codex --migrate-launcher --launcher stable --dry-run
80
+ aptly setup --client codex --migrate-launcher --launcher stable
81
+ ```
82
+
83
+ Add `--include-existing` only after reviewing an eligible preserved standard launcher. Modified/custom launchers and statistics Hooks are never adopted automatically. Migration updates owned MCP and observer targets together, preserving collection state, native metadata consent, keys, policies, ledgers and statistics history. Review new Codex Hooks with `/hooks`; trust is never approved automatically.
84
+
85
+ Resolution tries the installer Node, standard locations, numeric release directories in the default `~/.nvm/versions/node`, then safe absolute PATH entries. It does not promise the newest Node; symlink/shim-based managers may be rejected even with PATH; only qualified real executable paths are supported. No shell profile, npm or network download runs at startup. Stable mode deliberately removes `NODE_OPTIONS`, `NODE_PATH` and `NODE_REPL_EXTERNAL_MODULE` to avoid inheriting common Node startup overrides; use separate certificate settings such as `NODE_EXTRA_CA_CERTS` when needed. Runtime closures requiring native addons are refused. Missing runtime or failed integrity stops MCP with a fixed error; observers stay silent and best-effort.
86
+
87
+ Normal global npm installations are the primary supported source. Redirected/writable ancestors and dependencies hoisted outside a local package cannot be verified and are refused. Windows retains direct mode and rejects the stable option. Stable mode remains sticky across later setup/migration without the flag. Run `aptly update` from the actual global npm CLI; explicitly migrate to select a new Aptly snapshot. Remove retains old/shared snapshots because other homes or running processes may still use them. Doctor observes snapshot metadata, not full execution, authentication or reload readiness.
88
+
89
+ Plain setup does not silently replace an existing snapshot. Older selected versions report `stable_snapshot_outdated` and explicit migration guidance. An exact-owned stable reference can explicitly migrate from a missing, damaged or older-format snapshot to verified source from the current CLI. A corrupt same-generation directory or incomplete lock is never overwritten/deleted automatically: inspect only that state after checking writers and other homes. Modified/custom registration is not adopted as product-owned.
90
+
91
+ Stable migration updates owned observers together; legacy direct-to-direct migration may still need separate observer refresh (`statistics_observer_migration_required`). Full snapshot checks during setup and startup add I/O overhead. Bounded runtime probes do not provide a hard wall-clock bound for all filesystem operations. This is not a sandbox against same-user programs or worker threads.
92
+
69
93
  <a id="guide-keys-and-restart"></a>
70
94
 
71
95
  ## Keys and restarting
@@ -97,6 +121,8 @@ MCP `env` values are strings, so candidate arrays must also be passed as JSON st
97
121
 
98
122
  When unset, the defaults above apply; `[]` disables recommendations for that client. Empty strings, duplicates, unsupported models, and malformed JSON are errors. `CLAUDE_MODELS` and `CODEX_MODELS` are supported aliases, but setting both the primary name and its alias for the same provider is an error. Candidate configuration does not override existing choices or certify model access for an account.
99
123
 
124
+ `aptly set default` preserves candidates and aliases already in MCP `env`, Codex `env_vars` declarations, and inherited candidates visible to the current CLI for Claude. It adds default candidates only for a model family with neither name configured. A Codex passthrough is preserved even when its value is unavailable in the current terminal; inherited values are not copied into configuration files. The CLI gives a static `env` value precedence over an inherited value with the same name when validating effective settings. Catalog validation remains in place, so conflicting aliases or malformed values reject the configuration change. Check the final candidates in the restarted MCP separately.
125
+
100
126
  ## Related topics
101
127
 
102
128
  [Installation and updates](installation.md) · [Automatic recommendations](routing.md) · [Decisions API transmission](transmission.md) · [Advanced MCP integration and development](advanced.md) · [Troubleshooting](troubleshooting.md)
@@ -48,11 +48,11 @@ npm install -g aptly@latest --ignore-scripts
48
48
  aptly setup --client all
49
49
  ```
50
50
 
51
- In unreleased source, npm lifecycle installation does not ask for transmission review. After upgrading to a release containing the feature, run interactive `aptly setup`, `aptly set default`, or `aptly set transmission --review` with the same account environment. The 0.1.10 updater cannot ask the new question during that update; see [transmission review](transmission.md#guide-transmission-scope).
51
+ Transmission review is available from 0.1.11 and does not prompt during npm lifecycle installation. When upgrading from 0.1.10, update the package first, then run interactive `aptly setup`, `aptly set default`, or `aptly set transmission --review` with the same account environment. The update process does not perform the new review or imply consent; see [transmission review](transmission.md#guide-transmission-scope).
52
52
 
53
53
  Explicit `setup` works regardless of lifecycle execution. It preserves existing launchers; use the [launcher recovery steps](troubleshooting.md#guide-launcher-recovery) for stale paths. Key setup, MCP restart, and Codex `/hooks` trust review remain separate steps.
54
54
 
55
- The unreleased installer writes only a stderr instruction to run `aptly set transmission --review` when registrations need review; it does not ask a question or record a choice.
55
+ The 0.1.11 or later installer writes only a stderr instruction to run `aptly set transmission --review` when setup completes successfully and registered clients have reviews pending; it does not ask a question or record a choice.
56
56
 
57
57
  <a id="guide-package-updates"></a>
58
58
 
@@ -22,8 +22,12 @@ aptly stats enable --client codex --codex-native-metadata
22
22
  aptly stats disable --client codex
23
23
  ```
24
24
 
25
+ The top-level `status` in `aptly stats` reads, including `--today`, is `complete` (exit 0) when the query completes and `partial` (exit 1) for unsupported statistics requests or corrupt, read, or store errors. Disabled collection and genuinely unconfigured clients are completed queries. Successful client results remain available when another client fails. Existing client JSON fields and values are retained; strict full-object consumers must accept the additive `status`. `complete` does not certify host routing, model, or trust readiness. Unexpected statistics failures report `statistics_failed`; raw paths, input, keys, and stacks are not printed. Reads do not repair setup, obtain consent, or call a provider.
26
+
25
27
  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
28
 
29
+ `stats enable` initializes an empty statistics database before the first event and validates existing stores without replacing them. Initialization failure returns `partial` with `statistics_store_initialization_failed`; applied registration may remain. If an older version enabled collection but no event has created its database, rerun `stats enable`. Queries never create or repair the database.
30
+
27
31
  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
32
 
29
33
  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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  [Guide home](../en.md)
6
6
 
7
- The transmission review described below is an **unreleased source feature**; it is not included in the published Aptly 0.1.10 package.
7
+ The transmission review and `--review` command described below are **available from Aptly 0.1.11**. If you use 0.1.10, update the package first.
8
8
 
9
9
  ## On this page
10
10
 
@@ -19,11 +19,11 @@ The transmission commands in this section are supported from Aptly 0.1.7.
19
19
 
20
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
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.
22
+ For upgrades from 0.1.10: in that version, interactive `aptly set default` asks only for unselected hosts; Enter selects `none`. Noninteractive runs and postinstall do not prompt or imply consent.
23
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.
24
+ From 0.1.11, 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
25
 
26
- The new command below always asks again by explicit request; it is not available in published 0.1.10:
26
+ The command below is supported from 0.1.11 and always asks again by explicit request. If you use 0.1.10, update first:
27
27
 
28
28
  ```sh
29
29
  aptly set transmission --review
@@ -31,7 +31,7 @@ aptly set transmission --review
31
31
 
32
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
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.
34
+ The 0.1.10 update process cannot immediately load the updated CLI’s new question. After updating to 0.1.11 or later, run interactive `aptly setup`, `aptly set default`, or `aptly set transmission --review` with the same account environment. `aptly update` in 0.1.11 or later also prints the next setup command without spawning a new process.
35
35
 
36
36
  ```sh
37
37
  aptly set transmission --show
@@ -40,6 +40,8 @@ aptly set transmission description
40
40
  aptly set transmission excerpt
41
41
  ```
42
42
 
43
+ The top-level `status` in `--show` is `complete` (exit 0) when the query completes and `partial` (exit 1) for incomplete expected setup or corrupt or unreadable state. `none`, `unselected`, and genuinely unconfigured clients, including manual direct-only MCP without an expected automatic policy, are completed queries. Successful client results remain available when another client fails. Existing client JSON fields and values are retained; strict full-object consumers must accept the additive `status`. Some legacy client statuses conflate unconfigured and error states, so the aggregate also reflects checked query health. `complete` does not certify host routing, model, or trust readiness. Reads do not repair setup, obtain consent, or call a provider, and do not print raw paths, input, keys, or stacks.
44
+
43
45
  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
46
 
45
47
  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.
@@ -31,7 +31,7 @@ After the setup check succeeds, follow [statistics activation](statistics.md). `
31
31
 
32
32
  ### Policy paths revert in managed accounts
33
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.
34
+ This policy-source migration is available from 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
35
 
36
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
37
 
@@ -42,7 +42,7 @@ CODEX_HOME="$HOME/.codex" aptly setup --check --client codex
42
42
  CODEX_HOME="$HOME/.codex" aptly stats --client codex
43
43
  ```
44
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).
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. From 0.1.12, the CLI validates its already selected standard `~/.codex` when the variable is absent. CLI default-home selection is separate from environment forwarding at MCP startup; 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
46
 
47
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
48
 
@@ -84,6 +84,8 @@ A successful Codex configuration needs no reset. Retry only the affected host an
84
84
 
85
85
  ## Interrupted processes and ledger locks
86
86
 
87
+ Ledger PREFLIGHT reads do not change file permissions or contents. On POSIX, owner-only permissions such as `0600` and `0400` are accepted; `0644` or an incorrect owner is refused through existing failure paths (for example, `ledger_error`), without automatic `chmod` or retry. Before explicitly repairing permissions, confirm the exact intended local file and its owner, and stop relevant writers. Never delete or reset the ledger, `unknown` records, reservations, cache, locks, or journals as a fix. Subsequent legitimate writes still occur under the existing writer lock and may normalize permissions to `0600`. Windows ownership and private-access guards remain unchanged; POSIX mode bits do not guarantee Windows ACLs.
88
+
87
89
  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
90
 
89
91
  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.
package/docs/guide/en.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Aptly user guide
2
2
 
3
+ This guide targets Aptly 0.1.13. Each topic preserves feature-specific minimum versions and recovery instructions for older releases.
4
+
3
5
  [한국어](ko.md) · **English** · [简体中文](zh-CN.md) · [日本語](ja.md)
4
6
 
5
7
  [Back to README](../../README.en.md)
@@ -185,6 +185,12 @@ Codex が子エージェントの `message` を暗号文として Hook に渡す
185
185
 
186
186
  ## 診断と開発
187
187
 
188
+ `aptly doctor [--client codex|claude|all]` は独立した JSON スキーマ(`kind: aptly-doctor`、`schema_version: 1`)でローカル登録、ポリシー、登録先パッケージのバージョン、台帳メタデータを読み取ります。`complete`/終了コード 0 は照会完了、`partial`/終了コード 1 は観測失敗を示し、ホストの動作を保証しません。接続中の MCP バージョン、Hook の信頼・実行、再起動の必要性、チケット使用量はローカルでは `unknown` です。登録ランチャーの実行、資格情報ストアの照会、API・ネットワーク呼び出し、状態の作成・変更、更新通知は行いません。
189
+
190
+ 安全なパスから台帳サイズを先に確認し、4 MiB 以下のみ既存の保存スキーマで検証して `total`・`complete`・`unknown` 件数を表示します。超過時は本文を読まず `scan_skipped_size_limit` を返します。初回使用で台帳がない場合、履歴は未観測であり 0 件とは断定しません。観測中の変更では `changed_during_observation` として集計を破棄します。診断時間には検証と再確認を含み、書き込み時間は `not_measured` です。キー・パス・環境値・リクエスト ID・タスク本文は出力しません。数字のみのリリース版を表示し、任意のバージョン接尾辞は `unsupported_version_metadata` とします。
191
+
192
+ 接続中の MCP の `get_routing_capabilities.runtime_diagnostics` は応答プロセスのバージョン、ポリシーソースの種類、プロセス内の復旧スロット数 `capacity`・`used`・`remaining`・`expired_retained`・`in_flight` を追加します。期限切れのチケットもスロットを占有し、照会は更新・削除や再試行資格の確認を行いません(`retry_eligibility: not_checked`)。既存の `credential_status` は起動時のスナップショットです。同じバージョンでも設定の再読み込みや全書き込みプロセスの停止は証明できません。厳格な MCP 消費側はこの追加オブジェクトを許容してください。既存の `aptly report` スキーマとファイル出力は維持します。
193
+
188
194
  ```sh
189
195
  aptly report --format both --output-dir reports
190
196
  ```
@@ -16,6 +16,7 @@ MCP の手動設定は[高度な連携](advanced.md#guide-manual-mcp-setup)を
16
16
  - [CLI による設定](#guide-cli-configuration)
17
17
  - [キーと再起動](#guide-keys-and-restart)
18
18
  - [モデルと環境変数](#guide-models-and-environment)
19
+ - [Node のバージョンディレクトリに依存しないランチャー](#guide-stable-launcher)
19
20
 
20
21
  <a id="guide-host-config-locations"></a>
21
22
 
@@ -32,7 +33,7 @@ Claude Code の Hook ファイルは通常 `~/.claude/settings.json` ですが
32
33
 
33
34
  ## CLI による設定
34
35
 
35
- 未リリースのソースでは、最初の通常の対話形式 `aptly set default` がクライアントホームごとのレビュー待ち項目をまとめて質問します。`excerpt` を推奨し、Enter は既存の範囲を保持するか、未選択なら `none` を選びます。[送信レビュー](transmission.md#guide-transmission-scope)を参照してください。このレビューは公開済み 0.1.10 にはありません。
36
+ 0.1.11 以降、最初の通常の対話形式 `aptly set default` がクライアントホームごとのレビュー待ち項目をまとめて質問します。`excerpt` を推奨し、Enter は既存の範囲を保持するか、未選択なら `none` を選びます。[送信レビュー](transmission.md#guide-transmission-scope)を参照してください。この再レビューの流れは 0.1.10 ではサポートされないため、先に更新してください。
36
37
 
37
38
  `set` コマンドは 0.1.1 以降で利用できます。既存の起動パスは自動で切り替えません。API キー設定は、現在のパッケージの標準 Node/サーバー登録で、OS 資格情報の参照に対応する実行環境だと確認できた場合にのみ使用できます。独自ラッパー、旧バージョン、別のインストール先は `credential_launcher_unverified` で拒否します。登録を明示的に切り替えるかアップグレードしてから、再度実行してください。
38
39
 
@@ -66,6 +67,29 @@ API キーは macOS Keychain、インストール済みの Linux `secret-tool`
66
67
 
67
68
  変更後は MCP を再起動し、`get_routing_capabilities` の `provider`、候補、`credential_status` を確認してください。`os_store` はキーを読み込めたことを示し、API 認証の成功を示すものではありません。デフォルト設定と公開変数の設定では、引き続き独自ラッパーを保持します。API キー設定は未確認の起動パスのホスト設定を変更せず、保存を試みていた場合は可能な限りそのホストの旧キーを復元します。既存のラッパーにも新しいキーが自動で適用されるとは想定しないでください。Codex の `/hooks` 信頼承認やホスト権限は迂回しません。
68
69
 
70
+ <a id="guide-stable-launcher"></a>
71
+
72
+ ## Node のバージョンディレクトリに依存しないランチャー
73
+
74
+ このオプションは 0.1.14 以降で使用できます。POSIX(macOS/Linux)で `--launcher stable` を明示すると、Node のバージョンディレクトリ外の非公開領域にランチャーと Aptly の実行時依存を保存します。Node 自体はコピーしないため、対応する Node.js 24 以上のインストールが必要です。元の Node と npm パッケージが削除されても、保存済みランチャーは別の対応 Node を探せます。GUI ホストの PATH に `node` がない場合、コマンド名だけでは同じ保証は得られません。
75
+
76
+ 既定・自動登録と既存登録は直接 Node パスを使います。新規登録には `aptly setup --client all --launcher stable` を使えます。既存登録は次のとおり確認後に明示して移行してください。Claude は `--client claude`、各 Codex アカウントは対象の `CODEX_HOME` で実行します。
77
+
78
+ ```sh
79
+ aptly setup --client codex --migrate-launcher --launcher stable --dry-run
80
+ aptly setup --client codex --migrate-launcher --launcher stable
81
+ ```
82
+
83
+ 保持済みの標準ランチャーを含める場合は、確認後に `--include-existing` を追加してください。独自・変更済みランチャーや統計 Hook は自動で引き取りません。所有する MCP と観測器の実行先を同時に更新し、収集状態・native メタデータへの同意・キー・ポリシー・台帳・統計履歴を保持します。Codex の新 Hook は `/hooks` で再確認し、信頼を承認してください。自動承認は行いません。
84
+
85
+ インストール時 Node、標準パス、既定の `~/.nvm/versions/node` 内の正式版、安全な絶対 PATHを順に試します。最新 Node の選択は保証せず、シンボリックリンクや shim を使う管理方式は PATH 内でも拒否される場合があり、検証できる実際の実行ファイルパスのみ対応します。起動時にシェル設定・npm・ネットワークダウンロードは実行しません。stable モードは一般的な Node 起動設定の継承を抑えるため `NODE_OPTIONS`・`NODE_PATH`・`NODE_REPL_EXTERNAL_MODULE` を継承しません。追加 CA が必要な場合は `NODE_EXTRA_CA_CERTS` など別の証明書設定を利用してください。ネイティブアドオンが必要な依存は拒否します。対応ランタイム不在・整合性エラー時の MCP は固定エラーで停止し、観測器は既存の静かな best-effort 動作を維持します。
86
+
87
+ 通常の npm グローバルインストールを主に対象とします。リダイレクト・書き込み可能な上位パスや、ローカルパッケージ外に hoist された依存などは検証できないため拒否します。Windows は直接モードを維持し stable は未対応です。stable 登録は後続のオプションなし setup/migration でも維持します。`aptly update` は実際の npm グローバル CLI で実行し、明示的な移行で新しい Aptly 副本を選択してください。他のホームや実行中プロセスのため、`remove` は古い共有副本を削除しません。`doctor` の副本メタデータ観測は、実行・認証・再読み込み完了の証明ではありません。
88
+
89
+ 通常の setup は既存副本を暗黙に置き換えません。CLI より古い副本は `stable_snapshot_outdated` と明示的な移行案内を返します。所有権が完全に一致する stable 参照なら、副本の欠落・破損・旧形式から現在の CLI の検証済みソースへ明示的に移行できます。同じ generation の破損や未完了 lock は自動で上書き・削除しません。書き込みプロセスと他ホームの参照を確認し、その状態だけを手動で見直してください。独自・変更済み登録を製品所有として引き取りません。
90
+
91
+ stable 移行は所有観測器も同時に更新しますが、従来の直接モード間の移行では別途統計観測器の更新が必要な場合があります(`statistics_observer_migration_required`)。setup と起動の整合性確認には I/O 負荷があり、探索制限は全ファイルシステム操作の経過時間上限を保証しません。同じユーザーのプログラムやワーカースレッドを隔離する sandbox ではありません。
92
+
69
93
  <a id="guide-keys-and-restart"></a>
70
94
 
71
95
  ## キーと再起動
@@ -97,6 +121,8 @@ MCP の `env` の値は文字列なので、候補配列も JSON 文字列とし
97
121
 
98
122
  未指定の場合は上記のデフォルト値を使い、`[]` の場合はその client の推薦を無効にします。空の文字列・重複・未対応のモデル・不正な JSON はエラーです。`CLAUDE_MODELS`・`CODEX_MODELS` も別名として利用できますが、同じプロバイダーの標準名と別名を同時に設定するとエラーになります。候補設定は、既存の選択を上書きしたり、アカウントのモデルへのアクセス権限を認証したりするものではありません。
99
123
 
124
+ `aptly set default` は、MCP `env` の既存候補と別名、Codex `env_vars` の転送宣言、および現在の CLI で確認できる Claude の継承候補を保持します。同じモデル系列の両方の変数名が未設定の場合だけ既定候補を追加します。Codex の転送変数は現在の端末で値を確認できなくても既定値に置き換えず、継承値を設定ファイルにコピーしません。CLI は同名の静的な `env` 値を優先して有効な設定を検証します。カタログの検証は維持されるため、別名の競合や不正な値があれば設定変更を拒否します。再起動した MCP の最終候補は別途確認してください。
125
+
100
126
  ## 関連文書
101
127
 
102
128
  [インストールと更新](installation.md) · [自動推薦](routing.md) · [Decisions API の送信範囲](transmission.md) · [高度な MCP 連携と開発参考](advanced.md) · [トラブルシューティング](troubleshooting.md)
@@ -48,11 +48,11 @@ npm install -g aptly@latest --ignore-scripts
48
48
  aptly setup --client all
49
49
  ```
50
50
 
51
- 未リリースのソースでも npm lifecycle インストールは送信レビューを質問しません。機能を含むリリースへ更新後、同じアカウント環境で対話形式の `aptly setup`、`aptly set default` または `aptly set transmission --review` を実行してください。0.1.10 の更新プロセスは更新中に新しい質問をできません。[送信レビュー](transmission.md#guide-transmission-scope)を参照してください。
51
+ 送信レビューは 0.1.11 以降で提供され、npm lifecycle インストールでは質問しません。0.1.10 からアップグレードする場合は、先にパッケージを更新し、同じアカウント環境で対話形式の `aptly setup`、`aptly set default` または `aptly set transmission --review` を実行してください。更新プロセスが新しいレビューを代行したり、同意したものとして扱ったりすることはありません。[送信レビュー](transmission.md#guide-transmission-scope)を参照してください。
52
52
 
53
53
  スクリプトの実行にかかわらず、明示的な `setup` を利用できます。既存の起動パスは保持するため、旧パスのエラーは[実行パスの復旧手順](troubleshooting.md#guide-launcher-recovery)に従ってください。キー設定・MCP の再起動と Codex の `/hooks` 信頼確認は別途必要です。
54
54
 
55
- 未リリースのインストールスクリプトは、確認待ちの登録がある場合に `aptly set transmission --review` の実行案内だけを stderr に表示し、質問や選択の記録は行いません。
55
+ 0.1.11 以降のインストールスクリプトは、設定が正常に完了し、登録済みクライアントにレビュー待ちがある場合に `aptly set transmission --review` の実行案内だけを stderr に表示し、質問や選択の記録は行いません。
56
56
 
57
57
  <a id="guide-package-updates"></a>
58
58
 
@@ -22,8 +22,12 @@ aptly stats enable --client codex --codex-native-metadata
22
22
  aptly stats disable --client codex
23
23
  ```
24
24
 
25
+ `aptly stats` の読み取り(`--today` を含む)のトップレベル `status` は、照会が完了すると `complete`(終了コード 0)、未対応の統計要求や破損・読み取り・ストアのエラーがあると `partial`(終了コード 1)です。収集が無効な場合や実際に未設定のクライアントも照会完了です。一部のクライアントが失敗しても成功した結果は保持します。既存のクライアント JSON フィールドと値は維持するため、オブジェクト全体を厳密に検査する利用側は追加された `status` を受け入れてください。`complete` はホストのルーティング・モデル・信頼の準備を保証しません。予期しない統計エラーは `statistics_failed` で報告し、生のパス・入力・キー・スタックは出力しません。読み取りは自動修復・同意取得・プロバイダー呼び出しを行いません。
26
+
25
27
  形式は `aptly stats [--today] [--client codex|claude|all]`、`aptly stats enable [--client] [--codex-native-metadata]`、`aptly stats disable [--client]` です。収集は既定で無効で、postinstall でも自動有効化しません。enable は Aptly 所有のコマンド観測器を設置し、別の `stats-ownership.json` に記録します。既存の receipt・MCP・launcher・キー・予算・送信設定は保持します。有効化後は MCP とホストを再起動し、Codex では `/hooks` で native Hook の信頼を確認してください。
26
28
 
29
+ `stats enable` は最初のイベント前に空の統計 DB を初期化し、既存 DB は検証して保持します。初期化に失敗すると `partial` と `statistics_store_initialization_failed` を返し、適用済みの登録設定が残る場合があります。旧バージョンで有効化後、イベントがなく DB が未作成の場合は `stats enable` を再実行してください。照会は DB の作成や修復を行いません。
30
+
27
31
  disable は収集を無効にし、変更されていない所有観測器だけを削除します。変更済みやカスタムの観測器は警告して保持し、データとキーも残します。`remove` は統計所有の定義を検証・削除しますが、データは保持します。個別に管理される収集器やカスタム Hook は自動的に取り込みません。
28
32
 
29
33
  非公開の状態は予算台帳とは別の `stats.sqlite`、`stats-config.json`、`stats-key`(HMAC 秘密鍵)を使用します。鍵を共有しないでください。記録にタスク原文・会話記録・生 ID・パス・エラー・資格情報は含まれません。統計の読み取りは API・キー・資格情報ストアにアクセスせず、初期化や通知も行いません。
@@ -4,7 +4,7 @@
4
4
 
5
5
  [ガイド目次](../ja.md)
6
6
 
7
- 以下の送信レビューは**未リリースのソース機能**で、公開済みの Aptly 0.1.10 パッケージには含まれません。
7
+ 以下の送信レビューと `--review` コマンドは **Aptly 0.1.11 以降で提供されます**。0.1.10 を使用している場合は、先にパッケージを更新してください。
8
8
 
9
9
  ## このページの目次
10
10
 
@@ -19,11 +19,11 @@
19
19
 
20
20
  ここでの送信は、**ローカルのタスク情報を OpenAI Decisions API に送ること**であり、Aptly の開発者にタスクを提供する機能ではありません。適用モード `defaults/advisory` と送信範囲は別の設定です。新規登録は v2 ポリシーの `unselected` となり、自動送信しません。
21
21
 
22
- 公開済み 0.1.10 の対話形式 `aptly set default` は未選択のホストだけに質問し、Enter で `none` を選びます。非対話実行と postinstall は質問せず、同意したものとして扱いません。
22
+ 0.1.10 からアップグレードする際の参考: このバージョンの対話形式 `aptly set default` は未選択のホストだけに質問し、Enter で `none` を選びます。非対話実行と postinstall は質問せず、同意したものとして扱いません。
23
23
 
24
- 未リリースのソースでは、最初の通常の対話形式 `aptly setup` または `aptly set default` で、レビュー待ちのクライアントをまとめて一度に質問し、各現在値・出所・既定または上書きされたホームを表示します。推奨は選択肢 3 の `excerpt` です。Enter または維持を選ぶと既存の明示的な範囲・legacy 範囲と `none` を保持し、未選択の場合は `none` になります。明示的な `setup --transmission` または `set transmission <scope>` は実際の選択をレビュー済みとして記録します。クライアントホームごとの非公開 revision 1 マーカーはパッケージバージョン・モード・統計とは独立しており、通常のパッチ更新や再起動では再質問しません。
24
+ 0.1.11 以降、最初の通常の対話形式 `aptly setup` または `aptly set default` で、レビュー待ちのクライアントをまとめて一度に質問し、各現在値・出所・既定または上書きされたホームを表示します。推奨は選択肢 3 の `excerpt` です。Enter または維持を選ぶと既存の明示的な範囲・legacy 範囲と `none` を保持し、未選択の場合は `none` になります。明示的な `setup --transmission` または `set transmission <scope>` は実際の選択をレビュー済みとして記録します。クライアントホームごとの非公開 revision 1 マーカーはパッケージバージョン・モード・統計とは独立しており、通常のパッチ更新や再起動では再質問しません。
25
25
 
26
- 以下の新しいコマンドは明示的な要求により毎回質問します。公開済みの 0.1.10 では利用できません:
26
+ 以下のコマンドは 0.1.11 以降でサポートされ、明示的な要求により毎回質問します。0.1.10 では先に更新してください:
27
27
 
28
28
  ```sh
29
29
  aptly set transmission --review
@@ -31,7 +31,7 @@ aptly set transmission --review
31
31
 
32
32
  キャンセルすると範囲とレビューマーカーは変わりません。通常の setup または default では送信以外の既定設定が既に適用されている場合があります。自動 setup、check、migrate、送信範囲を明示した setup、CI、非 TTY、setup のスキップ、npm lifecycle スクリプト、MCP、Hook、help、show、統計の読み取りでは質問しません。質問は stderr に出力し、JSON stdout は維持します。既存の無効化ポリシー・モード・ランチャー・キー・台帳・統計・信頼設定を保持します。
33
33
 
34
- 0.1.10 の更新プロセスは新しい質問を直ちに読み込めません。初回の提供時は機能を含むリリースへ更新後、対話形式の `aptly setup`、`aptly set default` または `aptly set transmission --review` を実行してください。この機能を含む将来の更新は、新しいプロセスを起動せず次の手順を表示します。
34
+ 0.1.10 の更新プロセスは、更新された CLI の新しい質問を直ちに読み込みません。0.1.11 以降に更新した後、同じアカウント環境で対話形式の `aptly setup`、`aptly set default` または `aptly set transmission --review` を実行してください。0.1.11 以降の `aptly update` も新しいプロセスを起動せず、後続の設定コマンドを案内します。
35
35
 
36
36
  ```sh
37
37
  aptly set transmission --show
@@ -40,6 +40,8 @@ aptly set transmission description
40
40
  aptly set transmission excerpt
41
41
  ```
42
42
 
43
+ `--show` 結果のトップレベル `status` は、照会が完了すると `complete`(終了コード 0)、期待される設定が不完全な場合や状態が破損・読み取り不能な場合は `partial`(終了コード 1)です。`none`・`unselected` や実際に未設定のクライアント(自動ポリシーが期待されない手動の直接呼び出し専用 MCP を含む)も照会完了です。一部のクライアントが失敗しても成功した結果は保持します。既存のクライアント JSON フィールドと値は維持するため、オブジェクト全体を厳密に検査する利用側は追加された `status` を受け入れてください。一部の従来のクライアント状態は未設定とエラーを区別しないため、集約状態には確認した照会の健全性も反映します。`complete` はホストのルーティング・モデル・信頼の準備を保証しません。読み取りは自動修復・同意取得・プロバイダー呼び出しを行わず、生のパス・入力・キー・スタックを出力しません。
44
+
43
45
  変更コマンドは選択肢を示しています。希望する一つだけを実行してください。`--client codex|claude|all` で対象を選べます。`none` は自動送信を停止し、元の呼び出しを保持します。`description` は親エージェントが提供した説明だけを許可します。説明がなければ API 呼び出し前に文脈補足を求め、native 本文やラベルには自動で切り替えません。`defaults` は未解決の spawn を拒否し、`advisory` は案内のみを返します。`excerpt` は既存の native 抜粋と明示的な説明を許可します。出所・サイズ・既知の秘密パターンの検査は、非機密性やユーザーの同意を証明しません。
44
46
 
45
47
  既存の v1 ポリシーはバイト単位で保持され、出所 `legacy` の `excerpt` と表示されます。明示的な変更時だけ v2 に移行し、所有権記録も同時に更新します。変更済みポリシーや独自ランチャーを自動で引き継がず、競合時は保持します。キー・台帳・不明な記録は削除しません。変更後は MCP を再起動してください。開始済みの送信は回収できず、ポリシー変更前の処理中結果・retry・fresh 準備は適用されません。既存の結合競合を新しい有料 ID で回避しないでください。明示的な `recommend_agent` と `aptly recommend` は別の要求であり、この自動送信設定では禁止しません。