aptly 0.1.6 → 0.1.7

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 CHANGED
@@ -24,12 +24,12 @@ Requires Node.js **24 or later** and Claude Code or Codex. For first-time instal
24
24
 
25
25
  ```sh
26
26
  npm install -g aptly@latest --allow-scripts=aptly
27
- aptly setup --client all --mode defaults
27
+ aptly set default
28
28
  aptly set env OPENAI_API_KEY
29
29
  aptly --version
30
30
  ```
31
31
 
32
- Check the installed version with `aptly --version`. On supported npm versions, `--allow-scripts=aptly` allows Aptly’s installation script. If your npm does not support this option, follow the explicit installation and setup steps in the [installation guide](docs/guide/en.md#installation).
32
+ Check the installed version with `aptly --version`. On supported npm versions, `--allow-scripts=aptly` allows Aptly’s installation script. If your npm does not support this option, follow the explicit installation and setup steps in the [installation guide](docs/guide/en.md#installation). From Aptly 0.1.7, new registrations make no automatic transmission until you select an OpenAI Decisions API transmission scope with `aptly set default`.
33
33
 
34
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
35
 
@@ -41,7 +41,7 @@ To update an existing global npm installation running Aptly 0.1.3 or later, stop
41
41
 
42
42
  ```sh
43
43
  aptly update
44
- aptly setup --client all --mode defaults
44
+ aptly setup --client all
45
45
  ```
46
46
 
47
47
  ## Usage modes
package/README.ja.md CHANGED
@@ -24,12 +24,12 @@ Node.js **24 以上**と Claude Code または Codex が必要です。初めて
24
24
 
25
25
  ```sh
26
26
  npm install -g aptly@latest --allow-scripts=aptly
27
- aptly setup --client all --mode defaults
27
+ aptly set default
28
28
  aptly set env OPENAI_API_KEY
29
29
  aptly --version
30
30
  ```
31
31
 
32
- `aptly --version` でインストール済みのバージョンを確認してください。対応する npm では、`--allow-scripts=aptly` で Aptly のインストールスクリプトを許可します。このオプションに対応していない npm では、[インストール案内](docs/guide/ja.md#インストール)の明示的なインストール・設定手順に従ってください。
32
+ `aptly --version` でインストール済みのバージョンを確認してください。対応する npm では、`--allow-scripts=aptly` で Aptly のインストールスクリプトを許可します。このオプションに対応していない npm では、[インストール案内](docs/guide/ja.md#インストール)の明示的なインストール・設定手順に従ってください。 Aptly 0.1.7 以降、新規登録は自動送信せず、`aptly set default` で OpenAI Decisions API への送信範囲を選択します。
33
33
 
34
34
  インストール時の `postinstall` は、既存のホスト設定ディレクトリに MCP と `PreToolUse` Hook を登録します。自動登録をスキップした場合や、ホストに設定ディレクトリがまだない場合も、`setup` を明示的に実行して登録できます。他の既存設定・Hook と、既存の Aptly の実行コマンド・環境は保持します。
35
35
 
@@ -41,7 +41,7 @@ npm でグローバルインストール済みの Aptly 0.1.3 以降を更新す
41
41
 
42
42
  ```sh
43
43
  aptly update
44
- aptly setup --client all --mode defaults
44
+ aptly setup --client all
45
45
  ```
46
46
 
47
47
  ## 使用方法
package/README.md CHANGED
@@ -24,12 +24,12 @@ Node.js **24 이상**과 Claude Code 또는 Codex가 필요합니다. 처음 설
24
24
 
25
25
  ```sh
26
26
  npm install -g aptly@latest --allow-scripts=aptly
27
- aptly setup --client all --mode defaults
27
+ aptly set default
28
28
  aptly set env OPENAI_API_KEY
29
29
  aptly --version
30
30
  ```
31
31
 
32
- `aptly --version`으로 설치된 버전을 확인하십시오. `--allow-scripts=aptly`는 지원하는 npm에서 Aptly의 설치 스크립트를 허용합니다. 이 옵션을 지원하지 않는 npm은 [설치 안내](docs/guide/ko.md#설치)의 명시적 설치·설정 절차를 따르십시오.
32
+ `aptly --version`으로 설치된 버전을 확인하십시오. `--allow-scripts=aptly`는 지원하는 npm에서 Aptly의 설치 스크립트를 허용합니다. 이 옵션을 지원하지 않는 npm은 [설치 안내](docs/guide/ko.md#설치)의 명시적 설치·설정 절차를 따르십시오. Aptly 0.1.7부터 신규 등록의 자동 전송을 보류하며 `aptly set default`에서 OpenAI Decisions API 전송 범위를 선택합니다.
33
33
 
34
34
  설치 시 `postinstall`은 기존 호스트 설정 디렉터리에 MCP와 `PreToolUse` Hook을 등록합니다. 명시적인 `setup`은 자동 등록을 건너뛰었거나 아직 설정 디렉터리가 없는 호스트에도 사용할 수 있습니다. 기존 다른 설정·Hook과 기존 Aptly 실행 명령·환경은 보존합니다.
35
35
 
@@ -41,7 +41,7 @@ aptly --version
41
41
 
42
42
  ```sh
43
43
  aptly update
44
- aptly setup --client all --mode defaults
44
+ aptly setup --client all
45
45
  ```
46
46
 
47
47
  ## 사용 방식
package/README.zh-CN.md CHANGED
@@ -24,12 +24,12 @@ Aptly 使用 OpenAI Decisions API 对简要任务摘要进行分类,并推荐
24
24
 
25
25
  ```sh
26
26
  npm install -g aptly@latest --allow-scripts=aptly
27
- aptly setup --client all --mode defaults
27
+ aptly set default
28
28
  aptly set env OPENAI_API_KEY
29
29
  aptly --version
30
30
  ```
31
31
 
32
- 请使用 `aptly --version` 确认已安装的版本。在支持此选项的 npm 中,`--allow-scripts=aptly` 允许执行 Aptly 的安装脚本。如果 npm 不支持此选项,请按照[安装指南](docs/guide/zh-CN.md#安装)中的显式安装与配置步骤操作。
32
+ 请使用 `aptly --version` 确认已安装的版本。在支持此选项的 npm 中,`--allow-scripts=aptly` 允许执行 Aptly 的安装脚本。如果 npm 不支持此选项,请按照[安装指南](docs/guide/zh-CN.md#安装)中的显式安装与配置步骤操作。 从 Aptly 0.1.7 起,新注册不会自动传输;请通过 `aptly set default` 选择向 OpenAI Decisions API 传输的范围。
33
33
 
34
34
  安装时的 `postinstall` 会在现有宿主配置目录中注册 MCP 和 `PreToolUse` Hook。如果跳过了自动注册,或宿主尚无配置目录,也可以显式运行 `setup`。其他现有配置与 Hook,以及 Aptly 原有的启动命令和环境均会保留。
35
35
 
@@ -41,7 +41,7 @@ aptly --version
41
41
 
42
42
  ```sh
43
43
  aptly update
44
- aptly setup --client all --mode defaults
44
+ aptly setup --client all
45
45
  ```
46
46
 
47
47
  ## 使用方式
package/dist/bin/aptly.js CHANGED
@@ -9,8 +9,8 @@ import { collectDiagnostics } from '../src/diagnostics.js';
9
9
  import { exportDiagnosticReport } from '../src/report.js';
10
10
  import { fetchModelInfo, saveModelInfo } from '../src/model-info.js';
11
11
  import { errorCode } from '../src/types.js';
12
- import { setupHosts, removeSetup, setDefaults, setEnvironment, configurableEnvironmentKeys, migrateLauncher } from '../src/setup.js';
13
- import { readEnvironmentValue } from '../src/cli-input.js';
12
+ import { setupHosts, removeSetup, setDefaults, setEnvironment, configurableEnvironmentKeys, migrateLauncher, setTransmission, showTransmission } from '../src/setup.js';
13
+ import { readEnvironmentValue, readTransmissionChoice } from '../src/cli-input.js';
14
14
  import { prepareApiKey } from '../src/credential-setup.js';
15
15
  import { updateGlobalInstallation } from '../src/update.js';
16
16
  import { updateNotification } from '../src/update-notifier.js';
@@ -18,7 +18,7 @@ const [command = 'serve', ...args] = process.argv.slice(2);
18
18
  const output = (value) => process.stdout.write(JSON.stringify(value, null, 2) + '\n');
19
19
  try {
20
20
  if (['--help', '-h', 'help'].includes(command)) {
21
- process.stdout.write('Aptly (preview)\n\nCommands:\n serve Start the stdio MCP server (default: fixture/shadow).\n capabilities Print the active catalog; no API call.\n catalog Print the active catalog; no API call.\n catalog refresh --output ABS_PATH Fetch official model descriptions to a private cache.\n recommend Recommend for a task JSON on stdin; no host evidence required.\n inspect CLIENT FILE Inspect an explicit JSON settings inventory; no API call.\n config CLIENT Print an MCP registration fragment; does not edit settings.\n set default Add missing default MCP environment settings.\n set env ENV_KEY Prompt for an MCP environment value.\n setup Register MCP and automatic PreToolUse Hooks.\n remove Remove only unchanged Aptly-owned registration.\n update Update this verified global npm installation.\n report Write redacted local diagnostic attachments (default: md + json).\n --format md|json|both Select report formats.\n --output-dir DIR Private output directory (default: reports).\n --version Print the package version.\n\nUse aptly set env OPENAI_API_KEY for OS storage, or pass it through the MCP environment.\nPaid mode additionally requires\nROUTER_PROVIDER=decisions and an absolute ROUTER_LEDGER_PATH in a private directory.\nROUTER_CONFIG_PATH is an optional private operator configuration file.\n');
21
+ process.stdout.write('Aptly (preview)\n\nCommands:\n serve Start the stdio MCP server (default: fixture/shadow).\n capabilities Print the active catalog; no API call.\n catalog Print the active catalog; no API call.\n catalog refresh --output ABS_PATH Fetch official model descriptions to a private cache.\n recommend Recommend for a task JSON on stdin; no host evidence required.\n inspect CLIENT FILE Inspect an explicit JSON settings inventory; no API call.\n config CLIENT Print an MCP registration fragment; does not edit settings.\n set default Add defaults; select API transmission scope interactively.\n set transmission Set/show OpenAI Decisions API transmission scope.\n set env ENV_KEY Prompt for an MCP environment value.\n setup Register MCP and automatic PreToolUse Hooks.\n remove Remove only unchanged Aptly-owned registration.\n update Update this verified global npm installation.\n report Write redacted local diagnostic attachments (default: md + json).\n --format md|json|both Select report formats.\n --output-dir DIR Private output directory (default: reports).\n --version Print the package version.\n\nUse aptly set env OPENAI_API_KEY for OS storage, or pass it through the MCP environment.\nPaid mode additionally requires\nROUTER_PROVIDER=decisions and an absolute ROUTER_LEDGER_PATH in a private directory.\nROUTER_CONFIG_PATH is an optional private operator configuration file.\n');
22
22
  }
23
23
  else if (command === 'update') {
24
24
  if (args.length === 1 && args[0] === '--help')
@@ -54,7 +54,27 @@ try {
54
54
  }
55
55
  else if (command === 'set') {
56
56
  if (args.length === 1 && args[0] === '--help')
57
- process.stdout.write('Usage: aptly set default [--client codex|claude|all]\n aptly set env ENV_KEY [--client codex|claude|all] [--stdin | --check]\n--check diagnoses OPENAI_API_KEY registration without reading or storing a key.\nValues are entered interactively with hidden input; --stdin explicitly reads a value from standard input. Existing defaults and launchers are preserved. OPENAI_API_KEY is stored in the OS credential store; host files contain references only. Restart MCP after changes.\n');
57
+ process.stdout.write('Usage: aptly set default [--client codex|claude|all]\n aptly set transmission none|description|excerpt [--client codex|claude|all]\n aptly set transmission --show [--client codex|claude|all]\n aptly set env ENV_KEY [--client codex|claude|all] [--stdin | --check]\n--check diagnoses OPENAI_API_KEY registration without reading or storing a key.\nValues are entered interactively with hidden input; --stdin explicitly reads a value from standard input. Existing defaults and launchers are preserved. OPENAI_API_KEY is stored in the OS credential store; host files contain references only. Restart MCP after changes.\n');
58
+ else if (args[0] === 'transmission') {
59
+ if (args[1] === '--help' && args.length === 2)
60
+ process.stdout.write('Usage: aptly set transmission none|description|excerpt [--client codex|claude|all]\n aptly set transmission --show [--client codex|claude|all]\nControls automatic transmission to OpenAI Decisions, not developer telemetry. Direct recommendations are separate explicit requests. Restart MCP after changes.\n');
61
+ else {
62
+ const scope = args[1];
63
+ if (!['none', 'description', 'excerpt', '--show'].includes(scope))
64
+ throw new Error('set_invalid_options');
65
+ let clients = ['codex', 'claude'];
66
+ if (args.length !== 2) {
67
+ if (args.length !== 4 || args[2] !== '--client' || !['codex', 'claude', 'all'].includes(args[3]))
68
+ throw new Error('set_invalid_options');
69
+ clients = args[3] === 'all' ? ['codex', 'claude'] : [args[3]];
70
+ }
71
+ const packageRoot = fileURLToPath(new URL(import.meta.url.endsWith('.ts') ? '../' : '../../', import.meta.url));
72
+ const result = scope === '--show' ? showTransmission({ clients }) : setTransmission(scope, { clients, packageRoot });
73
+ output(result);
74
+ if ('status' in result && result.status === 'partial')
75
+ process.exitCode = 1;
76
+ }
77
+ }
58
78
  else {
59
79
  const action = args[0];
60
80
  let key;
@@ -105,7 +125,15 @@ try {
105
125
  try {
106
126
  if (action === 'env')
107
127
  value = await readEnvironmentValue({ key: key, fromStdin });
108
- const result = action === 'default' ? setDefaults({ clients, packageRoot }) : key === 'OPENAI_API_KEY' ? credential.apply(value) : setEnvironment(key, value, { clients, packageRoot });
128
+ let result = action === 'default' ? setDefaults({ clients, packageRoot }) : key === 'OPENAI_API_KEY' ? credential.apply(value) : setEnvironment(key, value, { clients, packageRoot });
129
+ if (action === 'default' && result.status === 'complete' && process.stdin.isTTY && process.stdout.isTTY) {
130
+ const pending = result.clients.filter(client => client.transmission === 'unselected').map(client => client.client);
131
+ if (pending.length) {
132
+ const scope = await readTransmissionChoice();
133
+ const selected = setTransmission(scope, { clients: pending, packageRoot, selectUnselectedOnly: true });
134
+ result = { status: selected.status, clients: result.clients.map(client => selected.clients.find(item => item.client === client.client) ?? client) };
135
+ }
136
+ }
109
137
  output(result);
110
138
  if (result.status === 'partial')
111
139
  process.exitCode = 1;
@@ -117,10 +145,11 @@ try {
117
145
  }
118
146
  else if (['setup', 'remove'].includes(command)) {
119
147
  if (args.length === 1 && args[0] === '--help')
120
- process.stdout.write('Usage: aptly setup [--client codex|claude|all] [--mode defaults|advisory] [--automatic]\n aptly setup --client codex|claude --migrate-launcher [--include-existing] [--dry-run]\n aptly remove [--client codex|claude|all]\nSetup merges MCP and PreToolUse registration. Codex requires native /hooks trust review.\nAutomatic setup skips CI, APTLY_SKIP_SETUP=1, and absent host directories. No keys are stored.\n');
148
+ process.stdout.write('Usage: aptly setup [--client codex|claude|all] [--mode defaults|advisory] [--transmission none|description|excerpt] [--automatic]\n aptly setup --client codex|claude --migrate-launcher [--include-existing] [--dry-run]\n aptly remove [--client codex|claude|all]\nSetup merges MCP and PreToolUse registration. Codex requires native /hooks trust review.\nAutomatic setup skips CI, APTLY_SKIP_SETUP=1, and absent host directories. No keys are stored.\n');
121
149
  else {
122
150
  let clients = ['codex', 'claude'];
123
- let mode = 'defaults';
151
+ let mode;
152
+ let transmission;
124
153
  let automatic = false;
125
154
  let migrate = false;
126
155
  let dryRun = false;
@@ -150,15 +179,17 @@ try {
150
179
  const value = args[++i];
151
180
  if (flag === '--client' && ['codex', 'claude', 'all'].includes(value))
152
181
  clients = value === 'all' ? ['codex', 'claude'] : [value];
182
+ else if (flag === '--transmission' && command === 'setup' && ['none', 'description', 'excerpt'].includes(value))
183
+ transmission = value;
153
184
  else if (flag === '--mode' && command === 'setup' && ['defaults', 'advisory'].includes(value))
154
185
  mode = value;
155
186
  else
156
187
  throw new Error('setup_invalid_options');
157
188
  }
158
189
  const packageRoot = fileURLToPath(new URL(import.meta.url.endsWith('.ts') ? '../' : '../../', import.meta.url));
159
- if ((migrate && (clients.length !== 1 || automatic || seen.has('--mode'))) || ((dryRun || includeExisting) && !migrate))
190
+ if ((migrate && (clients.length !== 1 || automatic || seen.has('--mode') || seen.has('--transmission'))) || ((dryRun || includeExisting) && !migrate))
160
191
  throw new Error('setup_invalid_options');
161
- const result = migrate ? migrateLauncher({ clients, packageRoot }, dryRun, includeExisting) : command === 'setup' ? setupHosts({ clients, mode, automatic, packageRoot }) : removeSetup({ clients });
192
+ const result = migrate ? migrateLauncher({ clients, packageRoot }, dryRun, includeExisting) : command === 'setup' ? setupHosts({ clients, mode, automatic, packageRoot, transmission }) : removeSetup({ clients });
162
193
  output(result);
163
194
  if (result.status === 'partial' && !automatic)
164
195
  process.exitCode = 1;
@@ -1,14 +1,21 @@
1
1
  import { Router } from './core.ts';
2
2
  import type { HookOutput } from './hook.ts';
3
3
  import type { Client } from './types.ts';
4
- export interface AutoPolicy {
5
- schema_version: 1;
4
+ interface AutoPolicyBase {
6
5
  kind: 'aptly-auto-hook';
7
6
  mode: 'defaults' | 'advisory';
8
7
  issuer: 'operator_installation';
9
8
  enabled: boolean;
10
9
  state_directory: string;
11
10
  }
11
+ export type Transmission = 'none' | 'description' | 'excerpt' | 'unselected';
12
+ export type AutoPolicy = AutoPolicyBase & ({
13
+ schema_version: 1;
14
+ } | {
15
+ schema_version: 2;
16
+ transmission: Transmission;
17
+ });
18
+ export declare function effectiveTransmission(policy: AutoPolicy): Transmission;
12
19
  export interface AutomaticHookObservation {
13
20
  status: 'arguments_updated' | 'advisory' | 'preserved' | 'pending' | 'awaiting_context' | 'blocked';
14
21
  preflight: 'observed';
@@ -110,3 +117,4 @@ export declare function automaticCallId(client: unknown, event: unknown): string
110
117
  export declare function initialHookObservation(client: unknown, event: unknown): AutomaticHookObservation;
111
118
  /** Operator default selection only. No provenance_verified/evidence_verified host claim. */
112
119
  export declare function automaticHook({ client, event, router, policyPath, signal, context, stillCurrent, onObservation, onNeedsContext, onBlockedAdvice }: AutomaticHookOptions): Promise<AutomaticHookResult>;
120
+ export {};
@@ -7,6 +7,9 @@ import { hasSufficientTaskText } from './context-sufficiency.js';
7
7
  import { assertPrivateStatePath, readRegularFile } from './files.js';
8
8
  import { hookInput, hookOutput, validatedHookProfile, profilePreservesChoices, effortKeys } from './hook.js';
9
9
  import { digestToolInput } from './provenance.js';
10
+ export function effectiveTransmission(policy) {
11
+ return policy.schema_version === 1 ? 'excerpt' : policy.transmission;
12
+ }
10
13
  const own = (object, key) => Object.hasOwn(object, key);
11
14
  const plain = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) &&
12
15
  [Object.prototype, null].includes(Object.getPrototypeOf(value));
@@ -20,14 +23,17 @@ export function loadAutomaticHookPolicy(path) {
20
23
  try {
21
24
  assertPrivateStatePath(path);
22
25
  const value = JSON.parse(readRegularFile(path, { privateFile: true, maxBytes: 4096 }).toString('utf8'));
23
- if (!plain(value) || Object.keys(value).length !== policyKeys.length || Object.keys(value).some(key => !policyKeys.includes(key)) ||
24
- value.schema_version !== 1 || value.kind !== 'aptly-auto-hook' || (typeof value.mode !== 'string' || !['defaults', 'advisory'].includes(value.mode)) ||
26
+ if (!plain(value))
27
+ throw new Error('invalid_policy');
28
+ const keys = value.schema_version === 2 ? [...policyKeys, 'transmission'] : policyKeys;
29
+ if (Object.keys(value).length !== keys.length || Object.keys(value).some(key => !keys.includes(key)) ||
30
+ ![1, 2].includes(value.schema_version) || (value.schema_version === 2 && !['none', 'description', 'excerpt', 'unselected'].includes(value.transmission)) || value.kind !== 'aptly-auto-hook' || (typeof value.mode !== 'string' || !['defaults', 'advisory'].includes(value.mode)) ||
25
31
  value.issuer !== 'operator_installation' || typeof value.enabled !== 'boolean' ||
26
32
  typeof value.state_directory !== 'string' || !isAbsolute(value.state_directory))
27
33
  throw new Error('invalid_policy');
28
34
  // Validate an existing private state directory, without creating a path from untrusted event data.
29
35
  assertPrivateStatePath(join(value.state_directory, '.aptly-state-check'));
30
- const policy = Object.fromEntries(policyKeys.map(key => [key, value[key]]));
36
+ const policy = Object.fromEntries(keys.map(key => [key, value[key]]));
31
37
  return { policy, fingerprint: hash(policy), reason: policy.enabled ? 'automatic_policy_enabled' : 'automatic_policy_disabled' };
32
38
  }
33
39
  catch {
@@ -189,6 +195,10 @@ export async function automaticHook({ client, event, router, policyPath, signal,
189
195
  const currentPolicy = loadAutomaticHookPolicy(policyPath).policy;
190
196
  if (!currentPolicy?.enabled)
191
197
  return result;
198
+ if (['none', 'unselected'].includes(effectiveTransmission(currentPolicy))) {
199
+ result.output = { hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: `Aptly automatic routing is inactive (${effectiveTransmission(currentPolicy)}). Original arguments are preserved.` } };
200
+ return result;
201
+ }
192
202
  const message = `Aptly could not select compatible subagent defaults (${reason}). Original arguments and execution constraints are preserved; no child execution is observed. Report this outcome. Do not repeat an uncertain paid request with a new ID or change history, explicit choices, roles or permissions to bypass this result.`;
193
203
  result.output = { hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: message,
194
204
  ...(currentPolicy.mode === 'defaults' ? { permissionDecision: 'deny', permissionDecisionReason: message } : {}) } };
@@ -199,6 +209,10 @@ export async function automaticHook({ client, event, router, policyPath, signal,
199
209
  const loaded = loadAutomaticHookPolicy(policyPath);
200
210
  if (!loaded.policy || !loaded.policy.enabled || !loaded.fingerprint)
201
211
  return preserve(loaded.reason);
212
+ if (['none', 'unselected'].includes(effectiveTransmission(loaded.policy))) {
213
+ activeMode = loaded.policy.mode;
214
+ return preserve(`transmission_${effectiveTransmission(loaded.policy)}`);
215
+ }
202
216
  const call = readCall(client, event);
203
217
  if (!call)
204
218
  return preserve('invalid_event');
@@ -251,7 +265,8 @@ export async function automaticHook({ client, event, router, policyPath, signal,
251
265
  const supplied = context?.();
252
266
  if (supplied?.reason)
253
267
  return preserve(supplied.reason);
254
- const summary = supplied?.summary ? supplied : boundedSummary(call, router.policy.max_summary_bytes);
268
+ const summary = supplied?.summary ? supplied : effectiveTransmission(loaded.policy) === 'description'
269
+ ? { reason: 'insufficient_context' } : boundedSummary(call, router.policy.max_summary_bytes);
255
270
  if (Buffer.byteLength(summary.summary ?? '') > Math.min(4000, router.policy.max_summary_bytes))
256
271
  return preserve('insufficient_context');
257
272
  if (!summary.summary) {
@@ -259,6 +274,13 @@ export async function automaticHook({ client, event, router, policyPath, signal,
259
274
  return preserve(summary.reason ?? 'insufficient_context');
260
275
  if (signal?.aborted || (stillCurrent && await stillCurrent() !== true))
261
276
  return preserve('call_cancelled');
277
+ const currentPolicy = loadAutomaticHookPolicy(policyPath), currentCall = readCall(client, event), currentContext = context?.();
278
+ if (!currentPolicy.policy?.enabled || currentPolicy.fingerprint !== loaded.fingerprint)
279
+ return preserve('automatic_policy_changed');
280
+ if (!currentCall || currentCall.callKey !== call.callKey || currentCall.payloadDigest !== call.payloadDigest)
281
+ return preserve('call_changed');
282
+ if (currentContext?.reason || currentContext?.fingerprint !== supplied?.fingerprint)
283
+ return preserve(currentContext?.reason ?? 'context_changed');
262
284
  const legacyId = hookInput({ client, event, policy: router.policy })?.request_id ?? hash([call.client, call.event.session_id, call.event.tool_use_id ?? call.event.tool_call_id]);
263
285
  try {
264
286
  router.load();
@@ -3,3 +3,5 @@ export declare function readEnvironmentValue({ key, fromStdin }: {
3
3
  key: string;
4
4
  fromStdin?: boolean;
5
5
  }): Promise<string>;
6
+ /** Operator choice of external transmission scope; Enter selects no automatic transmission. */
7
+ export declare function readTransmissionChoice(): Promise<'none' | 'description' | 'excerpt'>;
@@ -47,3 +47,36 @@ export async function readEnvironmentValue({ key, fromStdin = false }) {
47
47
  process.stdout.write('\n');
48
48
  }
49
49
  }
50
+ /** Operator choice of external transmission scope; Enter selects no automatic transmission. */
51
+ export async function readTransmissionChoice() {
52
+ if (!process.stdin.isTTY || !process.stdout.isTTY)
53
+ throw fail('set_interactive_input_required');
54
+ process.stdout.write('Select task information sent to the OpenAI Decisions API (not Aptly developers).\nDescriptions and excerpts may contain sensitive information; this is not anonymization.\n 1. No automatic transmission (default)\n 2. Caller-provided descriptions only\n 3. Allow native task excerpts\n');
55
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
56
+ try {
57
+ return await new Promise((resolve, reject) => {
58
+ let settled = false;
59
+ const cancel = () => { if (!settled) {
60
+ settled = true;
61
+ reject(fail('set_input_cancelled'));
62
+ } };
63
+ rl.once('SIGINT', () => { cancel(); rl.close(); });
64
+ rl.once('close', cancel);
65
+ const ask = () => rl.question('Transmission scope [1]: ', value => {
66
+ const choices = { '': 'none', '1': 'none', '2': 'description', '3': 'excerpt', none: 'none', description: 'description', excerpt: 'excerpt' };
67
+ const scope = Object.hasOwn(choices, value.trim()) ? choices[value.trim()] : undefined;
68
+ if (!scope) {
69
+ process.stdout.write('Choose 1, 2 or 3.\n');
70
+ ask();
71
+ return;
72
+ }
73
+ settled = true;
74
+ resolve(scope);
75
+ });
76
+ ask();
77
+ });
78
+ }
79
+ finally {
80
+ rl.close();
81
+ }
82
+ }
@@ -1,7 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { closeSync, openSync, writeFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
- import { loadAutomaticHookPolicy } from './automatic-hook.js';
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
7
  const hash = (value) => createHash('sha256').update(JSON.stringify(value)).digest('hex');
@@ -30,11 +30,16 @@ export class ContextRetries {
30
30
  return loaded.reason;
31
31
  if (loaded.fingerprint !== entry.seed.policy_fingerprint)
32
32
  return 'automatic_policy_changed';
33
+ if (['none', 'unselected'].includes(effectiveTransmission(loaded.policy)))
34
+ return 'automatic_transmission_disabled';
33
35
  if (hash(this.router.policy) !== entry.catalog)
34
36
  return 'catalog_changed';
35
37
  return undefined;
36
38
  }
37
39
  register(seed, current) {
40
+ const policy = loadAutomaticHookPolicy(this.policyPath);
41
+ if (!policy.policy?.enabled || policy.fingerprint !== seed.policy_fingerprint || ['none', 'unselected'].includes(effectiveTransmission(policy.policy)))
42
+ return { reason: 'automatic_policy_changed' };
38
43
  try {
39
44
  this.router.load();
40
45
  const original = this.router.state.requests[seed.request_id];
@@ -54,6 +59,9 @@ export class ContextRetries {
54
59
  return { retry_id };
55
60
  }
56
61
  registerAdvice(seed, current) {
62
+ const policy = loadAutomaticHookPolicy(this.policyPath);
63
+ if (!policy.policy?.enabled || policy.fingerprint !== seed.policy_fingerprint || ['none', 'unselected'].includes(effectiveTransmission(policy.policy)))
64
+ return { reason: 'automatic_policy_changed' };
57
65
  if (!seed.fresh_eligible || seed.application_blocked !== 'inherited_context_application_unverified')
58
66
  return { reason: 'fresh_delegation_unsupported' };
59
67
  try {
@@ -7,7 +7,7 @@ import { VERSION } from './version.js';
7
7
  import { hookInput, hookOutput } from './hook.js';
8
8
  import { resolveProvenance } from './provenance.js';
9
9
  import { loadConfiguration, loadHostContext } from './config.js';
10
- import { automaticHook, loadAutomaticHookPolicy, initialHookObservation } from './automatic-hook.js';
10
+ import { automaticHook, effectiveTransmission, loadAutomaticHookPolicy, initialHookObservation } from './automatic-hook.js';
11
11
  import { SpawnContexts } from './spawn-context.js';
12
12
  import { RoutingObservations } from './routing-observations.js';
13
13
  import { ContextRetries } from './context-retry.js';
@@ -33,15 +33,18 @@ export function createServer({ env = process.env } = {}) {
33
33
  const precedence = resolveProvenance({ client, event, context: loaded.context });
34
34
  return { config, loaded, precedence };
35
35
  };
36
- server.registerTool('get_routing_capabilities', { description: 'Advisory profile catalog, provider and local budget limits. No paid call.', annotations, inputSchema: {} }, async () => content({
37
- ...router.capabilities(), provider: mode, hook_mode: loadConfiguration(env).mode,
38
- precedence: 'per_call_effective_host_evidence_required', automatic_settings_discovery: false,
39
- recommendation: { application: 'advisory_only', host_evidence_required: false, constraints: 'caller_declared_pins' },
40
- model_information: { status: modelInfo.status, refresh: 'explicit_only', account_access_verified: false }, disabled_clients: disabledClients,
41
- credential_status: credentialStatus,
42
- automatic_hook: { status: loadAutomaticHookPolicy(env.APTLY_HOOK_POLICY_PATH).reason, mode: loadAutomaticHookPolicy(env.APTLY_HOOK_POLICY_PATH).policy?.mode ?? 'disabled', host_settings_verified: false, context_tool: 'prepare_spawn_context', context_scope: 'this_process_exact_event_5_minutes', context_retry_tool: 'retry_spawn_recommendation', context_retry_limit: 1, fresh_delegation_tool: 'prepare_fresh_delegation', fresh_delegation_intent: 'caller_declared_not_verified', observation_tool: 'get_spawn_routing_observation', observation_scope: 'this_process_recent_calls', execution_observation: 'not_supported',
43
- guarantee: { scope: 'enabled_trusted_connected_supported_hook_only', missing_hook_detectable: false, unavailable_host_hook: 'host_controls_fallback', eligible_defaults_failure: 'deny', inherited_application: 'defaults_deny_advisory_feedback', caller_recovery: 'model_driven_not_guaranteed' } },
44
- }));
36
+ server.registerTool('get_routing_capabilities', { description: 'Advisory profile catalog, provider and local budget limits. No paid call.', annotations, inputSchema: {} }, async () => {
37
+ const automatic = loadAutomaticHookPolicy(env.APTLY_HOOK_POLICY_PATH);
38
+ return content({
39
+ ...router.capabilities(), provider: mode, hook_mode: loadConfiguration(env).mode,
40
+ precedence: 'per_call_effective_host_evidence_required', automatic_settings_discovery: false,
41
+ recommendation: { application: 'advisory_only', host_evidence_required: false, constraints: 'caller_declared_pins' },
42
+ model_information: { status: modelInfo.status, refresh: 'explicit_only', account_access_verified: false }, disabled_clients: disabledClients,
43
+ credential_status: credentialStatus,
44
+ automatic_hook: { status: automatic.reason, mode: automatic.policy?.mode ?? 'disabled', transmission: automatic.policy ? effectiveTransmission(automatic.policy) : null, transmission_provenance: automatic.policy ? (automatic.policy.schema_version === 1 ? 'legacy_v1_default' : 'operator_policy_v2') : 'unavailable', host_settings_verified: false, context_tool: 'prepare_spawn_context', context_scope: 'this_process_exact_event_5_minutes', context_retry_tool: 'retry_spawn_recommendation', context_retry_limit: 1, fresh_delegation_tool: 'prepare_fresh_delegation', fresh_delegation_intent: 'caller_declared_not_verified', observation_tool: 'get_spawn_routing_observation', observation_scope: 'this_process_recent_calls', execution_observation: 'not_supported',
45
+ guarantee: { scope: 'enabled_trusted_connected_supported_hook_only', missing_hook_detectable: false, unavailable_host_hook: 'host_controls_fallback', eligible_defaults_failure: 'deny_when_transmission_enabled', inherited_application: 'defaults_deny_advisory_feedback', caller_recovery: 'model_driven_not_guaranteed' } },
46
+ });
47
+ });
45
48
  server.registerTool('get_spawn_routing_observation', {
46
49
  description: 'Look up an exact spawn event OR a Hook-issued retry_id in this MCP process (128 calls, 10 minutes). Supply only {client,event} or only {retry_id}. Original preflight and context_retry outcome are separate; no provider call. Missing records never prove bypass; execution remains not_observed.',
47
50
  annotations: { ...annotations, openWorldHint: false }, inputSchema: observationSchema
@@ -54,6 +57,8 @@ export function createServer({ env = process.env } = {}) {
54
57
  const policy = loadAutomaticHookPolicy(env.APTLY_HOOK_POLICY_PATH);
55
58
  if (!policy.policy?.enabled)
56
59
  return content({ status: 'rejected', reason: policy.reason });
60
+ if (['none', 'unselected'].includes(effectiveTransmission(policy.policy)))
61
+ return content({ status: 'rejected', reason: 'automatic_transmission_disabled' });
57
62
  if (extra.signal.aborted)
58
63
  return content({ status: 'rejected', reason: 'context_cancelled' });
59
64
  return content(contexts.register(client, event, description, router.policy.max_summary_bytes));
@@ -6,13 +6,18 @@ export interface SetupOptions {
6
6
  automatic?: boolean;
7
7
  clients?: Client[];
8
8
  mode?: 'defaults' | 'advisory';
9
+ transmission?: TransmissionScope;
10
+ selectUnselectedOnly?: boolean;
9
11
  }
12
+ export type TransmissionScope = 'none' | 'description' | 'excerpt';
10
13
  export interface SetupClientResult {
11
14
  client: Client;
12
15
  status: 'configured' | 'unchanged' | 'removed' | 'skipped' | 'error';
13
16
  codes: string[];
14
17
  requires_hook_review?: boolean;
15
18
  recovery?: string[];
19
+ transmission?: string;
20
+ transmission_source?: 'explicit' | 'legacy' | 'unselected';
16
21
  }
17
22
  export interface SetupResult {
18
23
  status: 'complete' | 'partial' | 'skipped';
@@ -33,4 +38,26 @@ export declare function prepareCredentialReference(options: SetupOptions, client
33
38
  };
34
39
  /** Preserved standard registrations require a separate explicit opt-in; ownership stays unchanged. */
35
40
  export declare function migrateLauncher(options: SetupOptions, dryRun?: boolean, includeExisting?: boolean): SetupResult;
41
+ /** Explicit operator change; updates policy and its receipt through normal guarded staging. */
42
+ export declare function setTransmission(scope: TransmissionScope, options?: SetupOptions): SetupResult;
43
+ /** Read-only redacted policy state. Does not create host directories or contact a provider. */
44
+ export declare function showTransmission(options?: SetupOptions): {
45
+ clients: ({
46
+ client: Client;
47
+ status: string;
48
+ code: string;
49
+ application_mode?: undefined;
50
+ enabled?: undefined;
51
+ transmission?: undefined;
52
+ transmission_source?: undefined;
53
+ } | {
54
+ code?: undefined;
55
+ client: Client;
56
+ status: string;
57
+ application_mode: "advisory" | "defaults";
58
+ enabled: boolean;
59
+ transmission: import("./automatic-hook.ts").Transmission;
60
+ transmission_source: string;
61
+ })[];
62
+ };
36
63
  export {};
package/dist/src/setup.js CHANGED
@@ -6,6 +6,7 @@ import { randomUUID } from 'node:crypto';
6
6
  import { isDeepStrictEqual } from 'node:util';
7
7
  import { parse } from 'smol-toml';
8
8
  import { resolveCatalog } from './catalog.js';
9
+ import { loadAutomaticHookPolicy, effectiveTransmission } from './automatic-hook.js';
9
10
  import { assertPrivateStatePath } from './files.js';
10
11
  import { assertWindowsPrivatePath, protectNewWindowsPrivateDirectory, copyWindowsFilePermissions } from './windows-private.js';
11
12
  const object = (value) => !!value && typeof value === 'object' && !Array.isArray(value);
@@ -188,7 +189,7 @@ function editEnvironment(current, edit, client) {
188
189
  updates.APTLY_SECRET_BACKEND = 'os';
189
190
  updates.APTLY_SECRET_CLIENT = client;
190
191
  }
191
- else if (!('migrate' in edit)) {
192
+ else if (!('migrate' in edit) && !('transmission' in edit)) {
192
193
  validateEnvironmentValue(edit.key, edit.value);
193
194
  updates[edit.key] = edit.value;
194
195
  }
@@ -442,12 +443,35 @@ function prepare(options, client, removing, edit) {
442
443
  if (existingRoute.length === 0)
443
444
  entries.push(hookValue);
444
445
  hooks.after = edit && 'migrate' in edit ? hooks.before : stringify(hooksObject);
445
- const preservedMode = edit && policy.before !== null ? json(policy.before).mode : undefined;
446
- const policyValue = { schema_version: 1, kind: 'aptly-auto-hook', mode: options.mode ?? (['defaults', 'advisory'].includes(preservedMode) ? preservedMode : 'defaults'), issuer: 'operator_installation', enabled: true, state_directory: stateDir };
446
+ const currentPolicy = policy.before === null ? undefined : loadAutomaticHookPolicy(policyPath).policy;
447
+ if (policy.before !== null && !currentPolicy)
448
+ fail('policy_conflict');
449
+ const requestedScope = options.transmission ?? (edit && 'transmission' in edit ? edit.transmission : undefined);
450
+ if (requestedScope !== undefined && !['none', 'description', 'excerpt'].includes(requestedScope))
451
+ fail('transmission_invalid_scope');
452
+ const preservedMode = edit && currentPolicy ? currentPolicy.mode : undefined;
453
+ const desiredMode = options.mode ?? preservedMode ?? currentPolicy?.mode ?? 'defaults';
454
+ // Existing v1 settings retain their original scope and byte representation.
455
+ // Only an explicit operator scope selection migrates them to v2.
456
+ let policyValue = currentPolicy ? { ...currentPolicy, mode: desiredMode } : {
457
+ schema_version: 2, kind: 'aptly-auto-hook', mode: desiredMode,
458
+ issuer: 'operator_installation', enabled: true, state_directory: stateDir, transmission: 'unselected',
459
+ };
460
+ if (requestedScope !== undefined) {
461
+ if (options.selectUnselectedOnly && (!currentPolicy || effectiveTransmission(currentPolicy) !== 'unselected'))
462
+ fail('transmission_selection_changed');
463
+ if (currentPolicy && (!oldOwner || !isDeepStrictEqual(currentPolicy, oldOwner.policy)))
464
+ fail('managed_policy_changed');
465
+ policyValue = { ...policyValue, schema_version: 2, transmission: requestedScope };
466
+ }
447
467
  if (policy.before !== null) {
448
- const p = json(policy.before);
449
- if (!isDeepStrictEqual(p, policyValue))
468
+ if (requestedScope === undefined && !isDeepStrictEqual(currentPolicy, policyValue))
469
+ fail('policy_conflict');
470
+ // An unrelated setup/env operation must never adopt externally modified policy.
471
+ if (oldOwner && !isDeepStrictEqual(currentPolicy, oldOwner.policy))
450
472
  fail('policy_conflict');
473
+ if (requestedScope !== undefined)
474
+ policy.after = stringify(policyValue);
451
475
  }
452
476
  else
453
477
  policy.after = stringify(policyValue);
@@ -488,10 +512,14 @@ function prepare(options, client, removing, edit) {
488
512
  if (priorEnv[key] === undefined)
489
513
  owner.env_added[key] = value;
490
514
  }
515
+ if (requestedScope !== undefined)
516
+ owner.policy = structuredClone(policyValue);
517
+ result.transmission = effectiveTransmission(policyValue);
518
+ result.transmission_source = policyValue.schema_version === 1 ? 'legacy' : policyValue.transmission === 'unselected' ? 'unselected' : 'explicit';
491
519
  manifest.after = stringify(owner);
492
520
  if (client === 'codex')
493
521
  result.requires_hook_review = true;
494
- result.codes = client === 'codex' ? ['requires_hook_review'] : [];
522
+ result.codes = [...(client === 'codex' ? ['requires_hook_review'] : []), ...(result.transmission === 'unselected' ? ['transmission_selection_required'] : result.transmission_source === 'legacy' ? ['legacy_transmission_excerpt'] : []), ...(requestedScope !== undefined ? ['mcp_restart_required'] : [])];
495
523
  dirs.push(dir, privateDir, stateDir);
496
524
  }
497
525
  // Validate complete desired data before any host file is changed.
@@ -558,6 +586,8 @@ function execute(options, removing, edit, captured) {
558
586
  if (clients.some(client => client !== 'codex' && client !== 'claude'))
559
587
  return { status: 'partial', clients: [] };
560
588
  const env = options.env ?? process.env;
589
+ if (options.transmission !== undefined && !['none', 'description', 'excerpt'].includes(options.transmission))
590
+ return { status: 'partial', clients: clients.map(client => ({ client, status: 'error', codes: ['transmission_invalid_scope'] })) };
561
591
  if (!removing && options.automatic && (env.APTLY_SKIP_SETUP === '1' || !!env.CI))
562
592
  return { status: 'skipped', clients: clients.map(client => ({ client, status: 'skipped', codes: [env.APTLY_SKIP_SETUP === '1' ? 'setup_disabled' : 'ci_environment'] })) };
563
593
  const prepared = captured ?? clients.map(client => {
@@ -632,7 +662,7 @@ function execute(options, removing, edit, captured) {
632
662
  }
633
663
  return { status: results.some(result => result.status === 'error') ? 'partial' : results.every(result => result.status === 'skipped') ? 'skipped' : 'complete', clients: results };
634
664
  }
635
- const codes = new Set(['launcher_migration_not_owned', 'launcher_migration_not_standard', 'credential_launcher_unverified', 'environment_invalid_value', 'environment_sensitive_value', 'environment_key_unsupported', 'environment_secret_key_unsupported', 'unsafe_directory', 'unsafe_symlink', 'unsafe_configuration_file', 'invalid_json', 'invalid_json_object', 'configuration_shape_conflict', 'hook_shape_conflict', 'invalid_toml', 'unsupported_toml_layout', 'relative_configuration_directory', 'invalid_ownership', 'managed_hook_changed', 'managed_mcp_changed', 'managed_entry_changed', 'managed_policy_changed', 'mcp_entry_conflict', 'mcp_environment_conflict', 'existing_routing_hook_conflict', 'policy_conflict', 'existing_hook_not_owned', 'concurrent_configuration_change', 'private_directory_permissions', 'private_file_permissions']);
665
+ const codes = new Set(['transmission_selection_changed', 'transmission_invalid_scope', 'launcher_migration_not_owned', 'launcher_migration_not_standard', 'credential_launcher_unverified', 'environment_invalid_value', 'environment_sensitive_value', 'environment_key_unsupported', 'environment_secret_key_unsupported', 'unsafe_directory', 'unsafe_symlink', 'unsafe_configuration_file', 'invalid_json', 'invalid_json_object', 'configuration_shape_conflict', 'hook_shape_conflict', 'invalid_toml', 'unsupported_toml_layout', 'relative_configuration_directory', 'invalid_ownership', 'managed_hook_changed', 'managed_mcp_changed', 'managed_entry_changed', 'managed_policy_changed', 'mcp_entry_conflict', 'mcp_environment_conflict', 'existing_routing_hook_conflict', 'policy_conflict', 'existing_hook_not_owned', 'concurrent_configuration_change', 'private_directory_permissions', 'private_file_permissions']);
636
666
  function safeCode(error) { return error instanceof Error && codes.has(error.message) ? error.message : 'configuration_io_error'; }
637
667
  export function setupHosts(options = {}) { return execute(options, false); }
638
668
  export function removeSetup(options = {}) { return execute(options, true); }
@@ -718,3 +748,26 @@ export function migrateLauncher(options, dryRun = false, includeExisting = false
718
748
  return { status: 'partial', clients: [{ client, status: 'error', codes: [safeCode(error)] }] };
719
749
  }
720
750
  }
751
+ /** Explicit operator change; updates policy and its receipt through normal guarded staging. */
752
+ export function setTransmission(scope, options = {}) {
753
+ if (!['none', 'description', 'excerpt'].includes(scope))
754
+ return { status: 'partial', clients: (options.clients ?? ['codex', 'claude']).map(client => ({ client, status: 'error', codes: ['transmission_invalid_scope'] })) };
755
+ return execute(options, false, { transmission: scope });
756
+ }
757
+ /** Read-only redacted policy state. Does not create host directories or contact a provider. */
758
+ export function showTransmission(options = {}) {
759
+ return { clients: (options.clients ?? ['codex', 'claude']).map(client => {
760
+ try {
761
+ const { privateDir } = resolved(options, client);
762
+ noSymlinks(privateDir);
763
+ const loaded = loadAutomaticHookPolicy(join(privateDir, 'auto-policy.json'));
764
+ if (!loaded.policy)
765
+ return { client, status: 'unavailable', code: loaded.reason };
766
+ return { client, status: 'configured', application_mode: loaded.policy.mode, enabled: loaded.policy.enabled,
767
+ transmission: effectiveTransmission(loaded.policy), transmission_source: loaded.policy.schema_version === 1 ? 'legacy' : effectiveTransmission(loaded.policy) === 'unselected' ? 'unselected' : 'explicit' };
768
+ }
769
+ catch (error) {
770
+ return { client, status: 'error', code: safeCode(error) };
771
+ }
772
+ }) };
773
+ }
@@ -23,7 +23,7 @@ function newer(candidate, current) {
23
23
  }
24
24
  function eligible(o) {
25
25
  return o.stdinIsTTY && o.stderrIsTTY && o.stdoutIsTTY !== false && !o.env.CI && o.env.APTLY_NO_UPDATE_NOTIFIER !== '1' && !!version(o.currentVersion) &&
26
- ['help', '--help', '-h', '--version', 'config', 'setup', 'remove', 'set', 'report'].includes(o.command) && !o.args.includes('--automatic');
26
+ ['help', '--help', '-h', '--version', 'config', 'setup', 'remove', 'set', 'report'].includes(o.command) && !o.args.includes('--automatic') && !(o.command === 'set' && o.args[0] === 'transmission' && o.args.includes('--show'));
27
27
  }
28
28
  function directory(path) {
29
29
  if (!isAbsolute(path))
@@ -1 +1 @@
1
- export declare const VERSION = "0.1.6";
1
+ export declare const VERSION = "0.1.7";
@@ -1 +1 @@
1
- export const VERSION = '0.1.6';
1
+ export const VERSION = '0.1.7';
package/docs/guide/en.md CHANGED
@@ -14,7 +14,7 @@ Requires Node.js 24 or later and Claude Code or Codex. Install the latest stable
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ For npm versions without this option, or to configure explicitly instead of auto
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  Explicit `setup` works regardless of lifecycle execution. It preserves existing launchers; use the recovery steps below for stale paths. Key setup, MCP restart, and Codex `/hooks` trust review remain separate steps.
@@ -47,7 +47,7 @@ Stop other host, MCP, and CLI processes using the ledger before updating, follow
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -227,15 +227,42 @@ For genuinely independent work, the caller can intentionally choose a fresh chil
227
227
  | `retry_spawn_recommendation` | Accepts one task-description supplement using a Hook-issued retry_id |
228
228
  | `prepare_fresh_delegation` | Prepares a separate independent Codex call from completed inherited advice; never executes it |
229
229
 
230
- ### Outbound data and disabling automatic sharing
230
+ ### Confidence and abstention
231
+
232
+ `confidence` is metadata and has not been validated here as a calibrated probability of correctness. It is not currently used as an automatic-application threshold. Zero and low values are currently allowed when other application conditions hold. A missing value in a live Decisions response is rejected as an error; it remains optional in generic Router and stored results. `keep_current` and `needs_context` are separate outcomes with existing abstention and context-recovery rules. Explicit model, effort, history and permissions are preserved. A small classification pilot does not establish improved child-task quality or total cost.
233
+
234
+ <a id="outbound-data-and-disabling-automatic-sharing"></a>
235
+
236
+ ### Decisions API transmission scope
231
237
 
232
- For 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.
238
+ The transmission commands in this section are supported from Aptly 0.1.7.
239
+
240
+ 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. Interactive `aptly set default` asks only for unselected hosts; Enter selects `none`. Noninteractive runs and postinstall neither prompt nor count as consent.
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
248
+
249
+ 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.
250
+
251
+ 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.
252
+
253
+ 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.
254
+
255
+ ### Outbound content and filtering limits
256
+
257
+ 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.
258
+
259
+ 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.
233
260
 
234
261
  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.
235
262
 
236
263
  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.
237
264
 
238
- `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.
265
+ 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.
239
266
 
240
267
  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.
241
268
 
@@ -255,6 +282,8 @@ One supplement is allowed per original call. Duplicate input reuses the cache; c
255
282
 
256
283
  The retry response includes `next_call.set_if_unspecified` with concrete fields for the next native call. It excludes already specified model/effort fields and never adds Claude effort. Blocked history/application results omit `next_call`. These fields are neither execution evidence nor permission approval.
257
284
 
285
+ Cache reuse requires a completed first result. An unknown outcome remains `outcome_unknown`; do not repeat a paid call with a new ID.
286
+
258
287
  `context_retry_allowed: false` ends further context supplementation. For a compatible recommendation, `caller_review_required` means the parent reviews arguments; it does not request new user approval. Existing delegation authorization and host permission checks still apply.
259
288
 
260
289
  ### Automatic routing guarantees and blocked outcomes (0.1.5+)
package/docs/guide/ja.md CHANGED
@@ -14,7 +14,7 @@ Node.js 24 以上と Claude Code または Codex が必要です。npm の最新
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ aptly --version
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  スクリプトの実行にかかわらず、明示的な `setup` を利用できます。既存の起動パスは保持するため、旧パスのエラーは以下の復旧手順に従ってください。キー設定・MCP の再起動と Codex の `/hooks` 信頼確認は別途必要です。
@@ -47,7 +47,7 @@ aptly setup --client all --mode defaults
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -227,15 +227,42 @@ Codex の本文が不透明な場合、`cleanup_merged_worktrees` のような
227
227
  | `retry_spawn_recommendation` | Hook が返す retry_id を使い、タスク説明を一度補って再推薦します |
228
228
  | `prepare_fresh_delegation` | 完了済みの継承推薦から別の独立 Codex 呼び出し引数を準備し、実行はしません |
229
229
 
230
- ### 外部送信と自動共有の無効化
230
+ ### confidence と推薦の保留
231
+
232
+ `confidence` はメタデータであり、校正された正解確率としては検証されていません。現在、自動適用の閾値としては使用しません。現在は他の適用条件を満たせば、0 や低い値も許容します。実際の Decisions 応答で値が欠けている場合はエラーとして拒否しますが、汎用 Router と保存結果では任意項目です。`keep_current` と `needs_context` は数値とは別の結果であり、既存の保留・文脈補足規則に従います。明示されたモデル・effort・履歴・権限は保持します。小規模な分類評価だけで、子タスクの品質や総費用の改善を主張しません。
233
+
234
+ <a id="外部送信と自動共有の無効化"></a>
235
+
236
+ ### Decisions API への送信範囲
231
237
 
232
- 自動分類の `summary` は、有効なタスクラベルと本文の**最初の段落を切り詰めて組み合わせた抜粋**です。意味を再要約したものでも、匿名化したものでもありません。UTF-8 のサイズは `min(4000, max_summary_bytes)` 以下ですが、HTTP リクエスト全体の上限ではありません。Codex の opaque メッセージへのフォールバックでは、本文を復号・送信せず、十分に具体的な `task_name` だけを使用します。ラベルにも機密情報が含まれる可能性があります。
238
+ この節の送信範囲コマンドは Aptly 0.1.7 以降で利用できます。
239
+
240
+ ここでの送信は、**ローカルのタスク情報を OpenAI Decisions API に送ること**であり、Aptly の開発者にタスクを提供する機能ではありません。適用モード `defaults/advisory` と送信範囲は別の設定です。新規登録は v2 ポリシーの `unselected` となり、自動送信しません。対話形式の `aptly set default` は未選択のホストだけに範囲を尋ね、Enter では `none` を選択します。非対話実行と postinstall は質問せず、同意したものとして扱いません。
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
248
+
249
+ 変更コマンドは選択肢を示しています。希望する一つだけを実行してください。`--client codex|claude|all` で対象を選べます。`none` は自動送信を停止し、元の呼び出しを保持します。`description` は親エージェントが提供した説明だけを許可します。説明がなければ API 呼び出し前に文脈補足を求め、native 本文やラベルには自動で切り替えません。`defaults` は未解決の spawn を拒否し、`advisory` は案内のみを返します。`excerpt` は既存の native 抜粋と明示的な説明を許可します。出所・サイズ・既知の秘密パターンの検査は、非機密性やユーザーの同意を証明しません。
250
+
251
+ 既存の v1 ポリシーはバイト単位で保持され、出所 `legacy` の `excerpt` と表示されます。明示的な変更時だけ v2 に移行し、所有権記録も同時に更新します。変更済みポリシーや独自ランチャーを自動で引き継がず、競合時は保持します。キー・台帳・不明な記録は削除しません。変更後は MCP を再起動してください。開始済みの送信は回収できず、ポリシー変更前の処理中結果・retry・fresh 準備は適用されません。既存の結合競合を新しい有料 ID で回避しないでください。明示的な `recommend_agent` と `aptly recommend` は別の要求であり、この自動送信設定では禁止しません。
252
+
253
+ 手動の `enabled: false` は緊急停止として有効ですが、所有権記録と競合する場合があります。通常の変更には上記コマンドを使い、検査を回避するために所有権記録を編集しないでください。
254
+
255
+ ### 送信内容とフィルターの限界
256
+
257
+ `excerpt` の範囲では、事前登録された説明がない場合、自動分類の `summary` は、有効なタスクラベルと本文の**最初の段落を切り詰めて組み合わせた抜粋**です。意味を再要約したものでも、匿名化したものでもありません。UTF-8 のサイズは `min(4000, max_summary_bytes)` 以下ですが、HTTP リクエスト全体の上限ではありません。Codex の opaque メッセージへのフォールバックでは、本文を復号・送信せず、十分に具体的な `task_name` だけを使用します。ラベルにも機密情報が含まれる可能性があります。
258
+
259
+ 有効な `prepare_spawn_context` の説明は、固定の接頭辞とともに native の抜粋に代わって分類に使用されます。登録自体は API を呼び出しません。文脈不足の応答後、`retry_spawn_recommendation` は以前の本文を付け加えず、固定の接頭辞と新しい補足説明で一度だけ再推薦できます。両経路とも説明原文は `min(3800, max_summary_bytes - 96)` バイト以下、接頭辞を含む説明は `min(4000, max_summary_bytes)` バイト以下です。`prepare_fresh_delegation` 自体は完了済みの推薦を再利用し、追加の分類を呼び出さず、独立した指示をローカルの次回呼び出し引数として返します。返されたモデルと effort をそのまま明示した Codex 呼び出しは、現在の Hook で `explicit_model` として分類せずに保持されます。後続の呼び出しを検査することは、追加の分類を意味しません。どの経路も、説明に機密情報が含まれないことや自動的な匿名化を保証しません。
233
260
 
234
261
  Decisions には `client`、`task.summary`、`task.operation`、`task.context_sufficient` と、候補プロファイル ID・モデルと effort の説明・設定したモデル特性を送信します。分類用 API キーは `Authorization` ヘッダー、リクエスト ID は `X-Client-Request-Id` ヘッダーで送信します。自動経路の ID はハッシュで、直接推薦の ID は呼び出し元が指定します。ID や候補の説明にも秘密情報を含めないでください。
235
262
 
236
263
  自動共有を無効にするには、`APTLY_HOOK_POLICY_PATH` が指す既存の非公開ポリシーファイルで、**`enabled` だけを `false` に変更**してください。他のフィールドと所有権の記録は保持してください。その後の自動 Hook 呼び出しは、分類や呼び出しバインディングファイルの作成前に元の呼び出しを保持します。開始済みの送信を取り消したり、サーバーが受信した情報を回収したりすることはできません。生成済みのポリシーを変更すると、登録・設定・削除コマンドの所有権検査で競合する場合があり、それらのコマンドは無効化したポリシーを上書きしません。検査を回避するために所有権の記録を編集しないでください。
237
264
 
238
- `mode: advisory` でも分類データは送信されるため、プライバシー上の共有停止にはなりません。`APTLY_HOOK_POLICY_PATH` を削除すると従来の strict 経路が有効になる場合があるため、共有停止の代わりにしないでください。`enabled: false` は、明示的な `recommend_agent` や `aptly recommend` のリクエストを止めるものではありません。
265
+ 送信範囲で許可されていれば `mode: advisory` でも分類データは送信されるため、プライバシー上の共有停止にはなりません。`APTLY_HOOK_POLICY_PATH` を削除すると従来の strict 経路が有効になる場合があるため、共有停止の代わりにしないでください。`enabled: false` は、明示的な `recommend_agent` や `aptly recommend` のリクエストを止めるものではありません。
239
266
 
240
267
  共有する要約を自分で選ぶ場合は、自動共有を無効にしてから直接推薦に必要な情報だけを記述してください。Aptly は要約中の URL の文書や、言及されたソースファイルを自動取得・添付しません。既知のキーや Bearer のパターン検査は、完全な秘密情報の検出や送信の安全性を保証しません。
241
268
 
@@ -255,6 +282,8 @@ Decisions には `client`、`task.summary`、`task.operation`、`task.context_su
255
282
 
256
283
  再推薦の応答は `next_call.set_if_unspecified` に次の native 呼び出しで補う具体的な未指定フィールドを返します。明示済みのモデル・effort は含めず、Claude に effort を追加しません。履歴などで適用できない結果には `next_call` を返しません。実行証拠や権限承認ではありません。
257
284
 
285
+ キャッシュを再利用できるのは最初の結果が完了した場合です。結果が不明なら `outcome_unknown` を保持し、新しい ID で有料呼び出しを繰り返さないでください。
286
+
258
287
  `context_retry_allowed: false` は追加の文脈補足を終了する意味です。互換性のある推薦の `caller_review_required` は親が引数を確認する意味であり、新しいユーザー承認の要求ではありません。既存の委任権限とホストの権限確認は引き続き適用されます。
259
288
 
260
289
  ### 自動ルーティングの保証範囲と拒否結果(0.1.5 以降)
package/docs/guide/ko.md CHANGED
@@ -14,7 +14,7 @@ Node.js 24 이상과 Claude Code 또는 Codex가 필요합니다. npm의 최신
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ aptly --version
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  명시적 `setup`은 설치 스크립트 실행 여부와 관계없이 사용할 수 있습니다. 기존 실행 경로는 보존하므로 구버전 경로 오류는 아래 복구 절차를 따르십시오. 키 설정·MCP 재시작과 Codex의 `/hooks` 신뢰 승인은 별도로 필요합니다.
@@ -47,7 +47,7 @@ aptly setup --client all --mode defaults
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -227,15 +227,42 @@ Codex 본문이 불투명할 때 `cleanup_merged_worktrees`처럼 구체적인
227
227
  | `retry_spawn_recommendation` | Hook의 `retry_id`로 작업 설명을 한 번 보충해 재추천합니다 |
228
228
  | `prepare_fresh_delegation` | 완료된 상속 추천으로 별도의 독립 Codex 호출 인자를 준비하며 실행하지 않습니다 |
229
229
 
230
- ### 외부 전송과 자동 공유 끄기
230
+ ### confidence와 추천 보류
231
+
232
+ `confidence`는 메타데이터이며 보정된 정답 확률로 검증되지 않았습니다. 현재 자동 적용 임계값으로 사용하지 않습니다. 현재 0과 낮은 값도 다른 적용 조건을 만족하면 허용합니다. 실제 Decisions 응답에서 값이 누락되면 오류로 거절하지만, 일반 Router·저장 결과에서는 선택 항목입니다. `keep_current`·`needs_context`는 숫자와 별개의 결과이며 기존 보류·문맥 보충 규칙을 따릅니다. 명시한 모델·effort·이력·권한은 보존합니다. 소규모 분류 평가만으로 자식 작업의 품질·총비용 개선을 주장하지 않습니다.
233
+
234
+ <a id="외부-전송과-자동-공유-끄기"></a>
235
+
236
+ ### Decisions API 전송 범위
231
237
 
232
- 자동 분류의 `summary`는 허용된 작업 라벨과 본문의 **첫 문단을 잘라 붙인 발췌문**입니다. 의미를 새로 요약하거나 익명화하지 않습니다. UTF-8 크기는 `min(4000, max_summary_bytes)` 이하이며 전체 HTTP 요청의 크기 제한은 아닙니다. Codex의 opaque 메시지 fallback은 본문을 해독·전송하지 않고 충분히 구체적인 `task_name`만 사용합니다. 라벨에도 민감한 정보가 들어갈 수 있습니다.
238
+ 이 절의 전송 범위 명령은 Aptly 0.1.7부터 지원합니다.
239
+
240
+ 여기서 전송은 **로컬 작업 정보를 OpenAI Decisions API에 보내는 것**이며 Aptly 개발자에게 작업을 제공하는 기능이 아닙니다. 적용 모드 `defaults/advisory`와 전송 범위는 별개입니다. 신규 등록은 v2 정책의 `unselected` 상태이며 자동 전송하지 않습니다. 대화형 `aptly set default`는 미선택 호스트에만 범위를 묻고 Enter의 기본 선택은 `none`입니다. 비대화형 실행·postinstall은 묻거나 동의한 것으로 처리하지 않습니다.
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
248
+
249
+ 위 변경 명령은 세 가지 대안을 보여 줍니다. 원하는 하나만 실행하십시오. `--client codex|claude|all`로 대상을 고를 수 있습니다. `none`은 자동 전송을 끄고 원래 호출을 보존합니다. `description`은 부모 에이전트가 제공한 설명만 허용합니다. 설명이 없으면 API 호출 전에 문맥 보충을 요청하며 native 본문·라벨로 자동 대체하지 않습니다. `defaults`는 해결 전 스폰을 차단하고 `advisory`는 안내만 제공합니다. `excerpt`는 기존 native 발췌와 명시 설명을 허용합니다. 설명의 출처·크기·민감 패턴 검사는 비민감성이나 사용자 동의를 인증하지 않습니다.
250
+
251
+ 기존 v1은 `legacy` 출처의 `excerpt`로 표시하고 바이트 그대로 유지합니다. 명시 변경은 정책을 v2로 전환하고 소유권 기록을 함께 갱신합니다. 운영자가 수정한 정책·다른 실행 래퍼는 자동으로 인수하지 않으며 충돌 시 보존합니다. 키·원장·불명 기록은 삭제하지 않습니다. 변경 후 MCP를 재시작하십시오. 이미 시작된 전송을 회수하지 못하며 진행 중 결과·retry·fresh는 변경된 정책으로 적용되지 않습니다. 이전 호출 ID의 결합 충돌은 새 유료 ID로 우회하지 마십시오. 명시적 `recommend_agent`·`aptly recommend`는 별도 요청이며 이 자동 전송 설정으로 금지하지 않습니다.
252
+
253
+ 수동으로 `enabled: false`를 편집하는 기존 긴급 중단도 유효하지만 소유권 충돌이 생길 수 있습니다. 일반 변경에는 위 명령을 사용하고 소유권 기록을 직접 편집하지 마십시오.
254
+
255
+ ### 전송 내용과 필터 한계
256
+
257
+ `excerpt` 범위에서 사전 등록 설명이 없는 자동 분류의 `summary`는 허용된 작업 라벨과 본문의 **첫 문단을 잘라 붙인 발췌문**입니다. 의미를 새로 요약하거나 익명화하지 않습니다. UTF-8 크기는 `min(4000, max_summary_bytes)` 이하이며 전체 HTTP 요청의 크기 제한은 아닙니다. Codex의 opaque 메시지 fallback은 본문을 해독·전송하지 않고 충분히 구체적인 `task_name`만 사용합니다. 라벨에도 민감한 정보가 들어갈 수 있습니다.
258
+
259
+ `prepare_spawn_context`에 유효한 설명을 등록하면 고정 접두사와 그 설명이 native 발췌 대신 분류에 사용됩니다. 등록 자체는 API를 호출하지 않습니다. `retry_spawn_recommendation`은 문맥 부족 응답 이후 고정 접두사와 새 보충 설명으로 한 번 재추천하며, 이전 본문을 덧붙이지 않습니다. 두 경로 모두 원시 설명은 `min(3800, max_summary_bytes - 96)` 바이트 이하이고 접두사 포함 설명은 `min(4000, max_summary_bytes)` 바이트 이하입니다. `prepare_fresh_delegation` 자체는 완료된 추천을 재사용해 추가 분류를 호출하지 않으며, 독립 지시를 로컬의 다음 호출 인자로 반환합니다. 반환된 모델·effort를 그대로 명시한 Codex 호출은 현재 Hook에서 `explicit_model`로 분류 없이 보존됩니다. 이후 호출의 경유 검사가 추가 분류를 뜻하지는 않습니다. 어느 경로도 설명의 비민감성이나 자동 익명화를 보장하지 않습니다.
233
260
 
234
261
  Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_sufficient`와 후보 프로필 ID·모델·effort 설명 및 설정된 모델 특성이 전달됩니다. 분류용 API 키는 `Authorization` 헤더로, 요청 ID는 `X-Client-Request-Id` 헤더로 전송됩니다. 자동 경로의 ID는 해시이며 직접 추천의 ID는 호출자가 지정합니다. ID나 후보 설명에도 비밀을 넣지 마십시오.
235
262
 
236
263
  자동 공유를 끄려면 `APTLY_HOOK_POLICY_PATH`가 가리키는 기존 비공개 정책 파일에서 **`enabled`만 `false`로 변경**하십시오. 나머지 필드와 소유권 기록은 유지하십시오. 이후 자동 Hook 호출은 분류 API나 호출 바인딩 파일을 만들기 전에 원래 호출을 보존합니다. 이미 시작한 전송을 되돌리거나 서버가 받은 내용을 회수하지는 못합니다. 생성된 정책을 바꾸면 설치·설정·제거 명령의 소유권 검사에서 충돌할 수 있으며, 해당 명령은 끄기 설정을 덮어쓰지 않습니다. 소유권 기록을 수정해 검사를 우회하지 마십시오.
237
264
 
238
- `mode: advisory`도 분류 정보를 전송하므로 개인정보 보호용 비활성화가 아닙니다. `APTLY_HOOK_POLICY_PATH`를 지우면 기존 strict 경로로 전환될 수 있으므로 공유 끄기의 대안으로 사용하지 마십시오. `enabled: false`는 명시적인 `recommend_agent`·`aptly recommend` 요청까지 차단하지 않습니다.
265
+ 전송 범위가 허용하면 `mode: advisory`도 분류 정보를 전송하므로 개인정보 보호용 비활성화가 아닙니다. `APTLY_HOOK_POLICY_PATH`를 지우면 기존 strict 경로로 전환될 수 있으므로 공유 끄기의 대안으로 사용하지 마십시오. `enabled: false`는 명시적인 `recommend_agent`·`aptly recommend` 요청까지 차단하지 않습니다.
239
266
 
240
267
  공유할 요약을 직접 선택하려면 자동 공유를 끈 뒤 직접 추천에 필요한 정보만 작성하십시오. Aptly는 요약에 적은 URL의 문서나 소스 파일을 자동으로 읽어 첨부하지 않습니다. 알려진 키·Bearer 패턴을 거르는 검사는 완전한 비밀 탐지나 전송 안전성 보장이 아닙니다.
241
268
 
@@ -255,6 +282,8 @@ Decisions에는 `client`, `task.summary`, `task.operation`, `task.context_suffic
255
282
 
256
283
  재추천 응답의 `next_call.set_if_unspecified`는 다음 native 호출에 넣을 미지정 필드만 제공합니다. 명시한 모델·effort는 포함하지 않으며 Claude에는 effort를 추가하지 않습니다. 이력 등으로 적용이 막히면 `next_call`을 제공하지 않습니다. 이 값은 실행 결과나 권한 승인이 아닙니다.
257
284
 
285
+ 캐시 재사용은 첫 결과가 완료된 경우에 한합니다. 결과가 불명이면 `outcome_unknown`으로 유지하며 새 ID로 유료 호출을 반복하지 마십시오.
286
+
258
287
  `context_retry_allowed: false`는 추가 설명 보충을 더 허용하지 않는다는 뜻입니다. 호환 가능한 추천에서 `caller_review_required`는 부모가 인자를 검토한다는 의미이며 새 사용자 승인을 요구하지 않습니다. 기존 위임 권한과 호스트 권한 검사는 그대로 유지됩니다.
259
288
 
260
289
  ### 자동 경유의 보장 범위와 차단 결과 (0.1.5부터)
@@ -14,7 +14,7 @@
14
14
 
15
15
  ```sh
16
16
  npm install -g aptly@latest --allow-scripts=aptly
17
- aptly setup --client all --mode defaults
17
+ aptly set default
18
18
  aptly --version
19
19
  ```
20
20
 
@@ -34,7 +34,7 @@ aptly --version
34
34
 
35
35
  ```sh
36
36
  npm install -g aptly@latest --ignore-scripts
37
- aptly setup --client all --mode defaults
37
+ aptly setup --client all
38
38
  ```
39
39
 
40
40
  无论安装脚本是否运行,都可以显式执行 `setup`。它会保留已有启动路径;旧路径错误请按下文恢复步骤处理。密钥配置、MCP 重启和 Codex `/hooks` 信任审核仍需单独完成。
@@ -47,7 +47,7 @@ aptly setup --client all --mode defaults
47
47
 
48
48
  ```sh
49
49
  aptly update
50
- aptly setup --client all --mode defaults
50
+ aptly setup --client all
51
51
  aptly --version
52
52
  ```
53
53
 
@@ -227,15 +227,42 @@ Codex 正文不透明时,`cleanup_merged_worktrees` 等具体的短任务名
227
227
  | `retry_spawn_recommendation` | 使用 Hook 返回的 retry_id 补充一次任务说明并重新推荐 |
228
228
  | `prepare_fresh_delegation` | 根据已完成的继承调用推荐准备独立 Codex 调用参数,不执行调用 |
229
229
 
230
- ### 对外传输与关闭自动共享
230
+ ### confidence 与推荐保留
231
+
232
+ `confidence` 是元数据,尚未验证其为经过校准的正确概率。目前不将其用作自动应用的阈值。目前,只要满足其他应用条件,0 和较低值也可被接受。实际 Decisions 响应缺少该值时会被作为错误拒绝;通用 Router 与已保存结果中的该字段仍为可选项。`keep_current` 与 `needs_context` 是独立于数值的结果,遵循既有的保留与上下文补充规则。显式指定的模型、effort、历史和权限均会保留。小规模分类评估不能证明子任务质量或总成本有所改善。
233
+
234
+ <a id="对外传输与关闭自动共享"></a>
235
+
236
+ ### Decisions API 传输范围
231
237
 
232
- 自动分类的 `summary` 是由有效任务标签与正文**截取后的首段拼接成的摘录**,并不是重新进行语义摘要或匿名化。其 UTF-8 大小不超过 `min(4000, max_summary_bytes)`;这不是整个 HTTP 请求的大小限制。Codex 的 opaque 消息回退仅使用足够具体的 `task_name`,不会解码或传输该正文。标签也可能包含敏感信息。
238
+ 本节传输范围命令从 Aptly 0.1.7 起提供。
239
+
240
+ 这里的传输是指**将本地任务信息发送至 OpenAI Decisions API**,不是向 Aptly 开发者提供任务的功能。应用模式 `defaults/advisory` 与传输范围相互独立。新注册使用 v2 策略的 `unselected` 状态,不自动传输。交互式 `aptly set default` 仅为尚未选择的宿主询问范围,按 Enter 默认选择 `none`。非交互运行和 postinstall 不询问,也不视为同意。
241
+
242
+ ```sh
243
+ aptly set transmission --show
244
+ aptly set transmission none
245
+ aptly set transmission description
246
+ aptly set transmission excerpt
247
+ ```
248
+
249
+ 以上修改命令展示不同选项;请只执行所需的一项。可用 `--client codex|claude|all` 选择宿主。`none` 停止自动传输并保留原调用。`description` 仅允许父代理提供的说明。没有说明时,会在调用 API 前请求补充上下文,不自动回退到 native 正文或标签。`defaults` 阻止尚未解决的 spawn;`advisory` 仅提供提示。`excerpt` 允许既有 native 摘录和显式说明。来源、大小及已知秘密模式检查不能证明内容不敏感,也不代表用户同意。
250
+
251
+ 既有 v1 策略保持原始字节不变,并显示来源为 `legacy` 的 `excerpt`。只有显式修改才迁移为 v2,并同时更新所有权记录。不会自动接管已修改的策略或自定义启动器,冲突时予以保留。不删除密钥、账本或未知结果记录。修改后请重启 MCP。无法撤回已开始的传输;策略变化会阻止之前的处理中结果、retry 和 fresh 准备被应用。请勿使用新的付费 ID 绕过旧调用的绑定冲突。显式的 `recommend_agent` 和 `aptly recommend` 属于独立请求,不受此自动传输设置禁止。
252
+
253
+ 手动设置 `enabled: false` 仍可作为紧急停止方式,但可能引发所有权冲突。常规修改请使用以上命令,不要编辑所有权记录以绕过检查。
254
+
255
+ ### 传输内容与过滤限制
256
+
257
+ 在 `excerpt` 范围内,没有预先注册的说明时,自动分类的 `summary` 是由有效任务标签与正文**截取后的首段拼接成的摘录**,并不是重新进行语义摘要或匿名化。其 UTF-8 大小不超过 `min(4000, max_summary_bytes)`;这不是整个 HTTP 请求的大小限制。Codex 的 opaque 消息回退仅使用足够具体的 `task_name`,不会解码或传输该正文。标签也可能包含敏感信息。
258
+
259
+ 有效的 `prepare_spawn_context` 说明会加上固定前缀,替代 native 摘录用于分类;注册本身不调用 API。收到上下文不足的响应后,`retry_spawn_recommendation` 可使用固定前缀与新的补充说明重新推荐一次,不附加先前正文。两条路径均将原始说明限制在 `min(3800, max_summary_bytes - 96)` 字节以内,含前缀的说明限制在 `min(4000, max_summary_bytes)` 字节以内。`prepare_fresh_delegation` 本身复用已完成的推荐,不再调用分类,并将独立指令作为本地下一次调用的参数返回。按返回参数明确指定模型与 effort 的 Codex 调用,目前会由 Hook 以 `explicit_model` 保留,不进行分类。检查后续调用并不意味着再次分类。这些路径均不保证说明不含敏感信息,也不保证自动匿名化。
233
260
 
234
261
  Decisions 会收到 `client`、`task.summary`、`task.operation`、`task.context_sufficient`,以及候选配置 ID、模型与 effort 说明、已配置的模型特性。分类 API 密钥通过 `Authorization` 请求头发送,请求 ID 通过 `X-Client-Request-Id` 发送。自动路径使用哈希 ID,直接推荐的 ID 由调用方提供。请勿在 ID 或候选说明中放入秘密信息。
235
262
 
236
263
  如需关闭自动共享,请在 `APTLY_HOOK_POLICY_PATH` 指向的现有私有策略文件中,**仅将 `enabled` 改为 `false`**,保留其他字段和所有权记录。之后的自动 Hook 调用会在分类或创建调用绑定文件之前保留原始调用。这无法撤销已开始的传输,也无法收回服务器已收到的信息。修改生成的策略后,安装、配置或移除命令的所有权检查可能报告冲突;这些命令不会覆盖已关闭的策略。请勿修改所有权记录来绕过检查。
237
264
 
238
- `mode: advisory` 仍会传输分类数据,不是隐私共享的关闭方式。删除 `APTLY_HOOK_POLICY_PATH` 可能启用既有 strict 路径,请勿以此代替关闭共享。`enabled: false` 不会阻止显式发起的 `recommend_agent` 或 `aptly recommend` 请求。
265
+ 传输范围允许时,`mode: advisory` 仍会传输分类数据,不是隐私共享的关闭方式。删除 `APTLY_HOOK_POLICY_PATH` 可能启用既有 strict 路径,请勿以此代替关闭共享。`enabled: false` 不会阻止显式发起的 `recommend_agent` 或 `aptly recommend` 请求。
239
266
 
240
267
  如需自行控制共享摘要,请先关闭自动共享,再为直接推荐编写必要的信息。Aptly 不会自动获取摘要中 URL 的文档,也不会附加提到的源文件。已知密钥和 Bearer 模式检查不能完整检测所有秘密,也不能保证文本适合对外传输。
241
268
 
@@ -255,6 +282,8 @@ Decisions 会收到 `client`、`task.summary`、`task.operation`、`task.context
255
282
 
256
283
  重新推荐的响应通过 `next_call.set_if_unspecified` 提供下一次 native 调用所需的未指定字段;不包含已显式指定的模型或 effort,也不会为 Claude 添加 effort。因历史等约束无法应用时,不提供 `next_call`。这些字段不是执行结果或权限批准。
257
284
 
285
+ 只有首次结果已完成时才能复用缓存。结果未知时保持 `outcome_unknown`;请勿使用新 ID 重复付费调用。
286
+
258
287
  `context_retry_allowed: false` 仅表示不再接受上下文补充。对于兼容的推荐,`caller_review_required` 表示父代理检查参数,并非要求用户重新批准。现有委派授权和宿主权限检查仍然有效。
259
288
 
260
289
  ### 自动路由的保证范围与阻止结果(0.1.5 起)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptly",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {