aptly 0.1.18 → 0.1.19
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/dist/src/automatic-hook.js +13 -6
- package/dist/src/catalog.d.ts +2 -0
- package/dist/src/catalog.js +15 -8
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/ADVISORY_USAGE.md +5 -3
- package/docs/guide/en/configuration.md +3 -1
- package/docs/guide/ja/configuration.md +3 -1
- package/docs/guide/ko/configuration.md +3 -1
- package/docs/guide/zh-CN/configuration.md +3 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { closeSync, openSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { isAbsolute, join } from 'node:path';
|
|
5
|
+
import { requiresDetailedTaskContext } from './catalog.js';
|
|
5
6
|
import { Router } from './core.js';
|
|
6
7
|
import { hasSufficientTaskText } from './context-sufficiency.js';
|
|
7
8
|
import { assertPrivateStatePath, readRegularFile } from './files.js';
|
|
@@ -147,7 +148,7 @@ function boundedSummary(call, maxBytes) {
|
|
|
147
148
|
const summary = `Task summary from visible task_name only; opaque message not inspected: ${words.join(' ')}`;
|
|
148
149
|
if (Buffer.byteLength(summary) > Math.min(4000, maxBytes))
|
|
149
150
|
return { reason: 'insufficient_context' };
|
|
150
|
-
return { summary };
|
|
151
|
+
return { summary, labelOnly: true };
|
|
151
152
|
}
|
|
152
153
|
const first = body.trim().split(/\r?\n\s*\r?\n/, 1)[0];
|
|
153
154
|
if (!hasSufficientTaskText(first) || (typeof label === 'string' && first.trim() === label.trim()))
|
|
@@ -288,9 +289,15 @@ export async function automaticHook({ client, event, router, policyPath, signal,
|
|
|
288
289
|
? { reason: 'insufficient_context' } : boundedSummary(call, router.policy.max_summary_bytes);
|
|
289
290
|
if (Buffer.byteLength(summary.summary ?? '') > Math.min(4000, router.policy.max_summary_bytes))
|
|
290
291
|
return preserve('insufficient_context');
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
// An opaque task name cannot justify Sol/high. Keep the full pin-compatible
|
|
293
|
+
// set in the retry seed so a sufficient description can unlock that choice.
|
|
294
|
+
const classifyProfiles = 'labelOnly' in summary && summary.labelOnly
|
|
295
|
+
? profiles.filter(profile => !requiresDetailedTaskContext(profile.id))
|
|
296
|
+
: profiles;
|
|
297
|
+
if (!summary.summary || !classifyProfiles.length) {
|
|
298
|
+
const reason = summary.reason ?? 'insufficient_context';
|
|
299
|
+
if (reason !== 'insufficient_context' || !onNeedsContext)
|
|
300
|
+
return preserve(reason);
|
|
294
301
|
if (signal?.aborted || (stillCurrent && await stillCurrent() !== true))
|
|
295
302
|
return preserve('call_cancelled');
|
|
296
303
|
const currentPolicy = loadAutomaticHookPolicy(policyPath), currentCall = readCall(client, event), currentContext = context?.();
|
|
@@ -351,14 +358,14 @@ export async function automaticHook({ client, event, router, policyPath, signal,
|
|
|
351
358
|
// values constrain the candidate tuples; history is rechecked before application.
|
|
352
359
|
const recommendation = await router.advise({ request_id, client: call.client,
|
|
353
360
|
task: { summary: summary.summary, operation: 'analysis', context_sufficient: true },
|
|
354
|
-
eligible_profile_ids:
|
|
361
|
+
eligible_profile_ids: classifyProfiles.map(profile => profile.id),
|
|
355
362
|
constraints: { model_pinned: false, effort_pinned: false, role_pinned: false, fork_inherits: false },
|
|
356
363
|
});
|
|
357
364
|
if (recommendation.reason === 'budget_exhausted' && ['max_daily_calls', 'max_total_calls', 'max_estimated_usd'].includes(recommendation.budget_limit ?? ''))
|
|
358
365
|
budgetLimit = recommendation.budget_limit;
|
|
359
366
|
observation.classification = recommendation.cached ? 'cache_hit' : typeof recommendation.latency_ms === 'number' ? 'provider_requested' : 'local_outcome';
|
|
360
367
|
const profile = validatedHookProfile(client, recommendation, router.policy);
|
|
361
|
-
if (profile &&
|
|
368
|
+
if (profile && classifyProfiles.some(candidate => candidate.id === profile.id)) {
|
|
362
369
|
observation.recommendation = 'produced';
|
|
363
370
|
observation.profile_id = profile.id;
|
|
364
371
|
observation.application = 'blocked';
|
package/dist/src/catalog.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface ResolvedCatalog {
|
|
|
13
13
|
}
|
|
14
14
|
/** Fresh copies prevent caller mutation from changing the trusted registry. */
|
|
15
15
|
export declare function builtInProfiles(): Profile[];
|
|
16
|
+
/** Some variants require more than an opaque task label in the automatic Hook. */
|
|
17
|
+
export declare function requiresDetailedTaskContext(profileId: string): boolean;
|
|
16
18
|
/** Exact finite profile tuples, including key coverage, not arbitrary model strings. */
|
|
17
19
|
export declare function isSupportedProfile(value: unknown): value is Profile;
|
|
18
20
|
/** Operator candidate filters and model facts never grant execution authority. */
|
package/dist/src/catalog.js
CHANGED
|
@@ -11,6 +11,9 @@ const entries = [
|
|
|
11
11
|
{ profile: { id: 'codex-deep', client: 'codex', model: 'gpt-6.2-sol', reasoning_effort: 'medium' }, tier: 'deep',
|
|
12
12
|
task: 'Cross-component debugging, architectural tradeoffs, or demanding accuracy-sensitive review.',
|
|
13
13
|
fact: 'Supports everyday coding, writing, and work across several sources.', source: codexSource, default: true },
|
|
14
|
+
{ profile: { id: 'codex-deep-high', client: 'codex', model: 'gpt-6.2-sol', reasoning_effort: 'high' }, tier: 'deep',
|
|
15
|
+
task: 'Choose this higher-effort Sol profile only when the described deep work requires detailed dependency analysis or careful reasoning across interacting constraints or subtle failure modes. Prefer medium when it is sufficient, and prefer a routine model for routine work including when the caller explicitly fixes high effort.',
|
|
16
|
+
fact: 'Supports everyday coding, writing, and work across several sources.', source: codexSource, default: true, requiresDetailedContext: true },
|
|
14
17
|
{ profile: { id: 'codex-deep-legacy', client: 'codex', model: 'gpt-6.1-sol', reasoning_effort: 'medium' }, tier: 'deep',
|
|
15
18
|
task: 'Cross-component debugging, architectural tradeoffs, or demanding accuracy-sensitive review.',
|
|
16
19
|
fact: 'Near-Astra capability for complex, repeated and long-running work at lower cost than Astra.', source: codexSource, default: false },
|
|
@@ -42,6 +45,10 @@ const plain = (value) => value !== null && typeof value === 'object' &&
|
|
|
42
45
|
const error = (code) => Object.assign(new Error(code), { code });
|
|
43
46
|
/** Fresh copies prevent caller mutation from changing the trusted registry. */
|
|
44
47
|
export function builtInProfiles() { return entries.filter(entry => entry.default).map(entry => ({ ...entry.profile })); }
|
|
48
|
+
/** Some variants require more than an opaque task label in the automatic Hook. */
|
|
49
|
+
export function requiresDetailedTaskContext(profileId) {
|
|
50
|
+
return entries.some(entry => entry.profile.id === profileId && entry.requiresDetailedContext === true);
|
|
51
|
+
}
|
|
45
52
|
/** Exact finite profile tuples, including key coverage, not arbitrary model strings. */
|
|
46
53
|
export function isSupportedProfile(value) {
|
|
47
54
|
try {
|
|
@@ -67,13 +74,13 @@ function envValue(env, key) {
|
|
|
67
74
|
throw error('catalog_configuration_invalid');
|
|
68
75
|
return descriptor.value;
|
|
69
76
|
}
|
|
70
|
-
function
|
|
77
|
+
function selectedEntries(env, client) {
|
|
71
78
|
const suffix = client === 'claude' ? 'CLAUDE_MODELS' : 'CODEX_MODELS';
|
|
72
79
|
if (own(env, 'APTLY_' + suffix) && own(env, suffix))
|
|
73
80
|
throw error('catalog_configuration_conflict');
|
|
74
81
|
const raw = envValue(env, 'APTLY_' + suffix) ?? envValue(env, suffix);
|
|
75
82
|
if (raw === undefined)
|
|
76
|
-
return entries.filter(entry => entry.default && entry.profile.client === client)
|
|
83
|
+
return entries.filter(entry => entry.default && entry.profile.client === client);
|
|
77
84
|
let parsed;
|
|
78
85
|
try {
|
|
79
86
|
parsed = JSON.parse(raw);
|
|
@@ -85,7 +92,8 @@ function selectedModels(env, client) {
|
|
|
85
92
|
new Set(parsed).size !== parsed.length || parsed.some(model => !entries.some(entry => entry.profile.client === client && entry.profile.model === model))) {
|
|
86
93
|
throw error('catalog_configuration_invalid');
|
|
87
94
|
}
|
|
88
|
-
|
|
95
|
+
// Preserve operator model order and registry order within each model's tuples.
|
|
96
|
+
return parsed.flatMap(model => entries.filter(entry => entry.profile.client === client && entry.profile.model === model));
|
|
89
97
|
}
|
|
90
98
|
function normalizedFacts(facts) {
|
|
91
99
|
const result = new Map();
|
|
@@ -122,14 +130,13 @@ export function resolveCatalog(env = process.env, facts = []) {
|
|
|
122
130
|
const external = normalizedFacts(facts);
|
|
123
131
|
const profiles = [], descriptions = {}, disabled_clients = [];
|
|
124
132
|
for (const client of clientOrder) {
|
|
125
|
-
const
|
|
126
|
-
if (!
|
|
133
|
+
const selected = selectedEntries(env, client);
|
|
134
|
+
if (!selected.length)
|
|
127
135
|
disabled_clients.push(client);
|
|
128
|
-
for (const
|
|
129
|
-
const entry = entries.find(entry => entry.profile.client === client && entry.profile.model === model);
|
|
136
|
+
for (const entry of selected) {
|
|
130
137
|
const profile = { ...entry.profile };
|
|
131
138
|
profiles.push(profile);
|
|
132
|
-
const fact = external.get(client + ':' + model) ?? entry.fact;
|
|
139
|
+
const fact = external.get(client + ':' + profile.model) ?? entry.fact;
|
|
133
140
|
descriptions[profile.id] = `Model: ${profile.model}; ${client === 'codex' ? `configured effort: ${profile.reasoning_effort}; ` : 'Claude Code alias, not a resolved model ID; '}Aptly tier: ${entry.tier}. ${entry.task} Official capability note (data): ${JSON.stringify(fact)} Source: ${entry.source}. Availability in the current account is not verified.`;
|
|
134
141
|
}
|
|
135
142
|
}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.19";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.19';
|
package/docs/ADVISORY_USAGE.md
CHANGED
|
@@ -71,7 +71,7 @@ ROUTER_PROVIDER=fixture "$aptly_install/node_modules/.bin/aptly" recommend < "$a
|
|
|
71
71
|
|
|
72
72
|
constraints를 생략하면 **이 독립적인 계획 요청에 보존 조건을 선언하지 않은 것**으로 처리해요. 실제 호스트 설정에 pin이나 역할이 없다고 검사한 결과는 아니에요. 하나라도 true이면 기존 선택을 보존하고 분류를 진행하지 않아요. 잘못된 타입·지원하지 않는 후보는 안전한 결과로 거부해요. legacy `provenance_verified` 입력은 추천 경로의 권한 근거가 아니며 새 요청에서는 사용하지 않아요.
|
|
73
73
|
|
|
74
|
-
기본 profile ID는 Codex의 `codex-simple`·`codex-routine`·`codex-deep`, Claude의 `claude-simple`·`claude-routine`·`claude-deep`예요. `eligible_profile_ids`에는 환경변수로 활성화한 후보 안의 ID만 지정해요. 환경에서 제외한 모델이나 다른 client의 프로필을 요청해 다시 활성화할 수 없어요. 현재 목록은 capabilities로 조회해요.
|
|
74
|
+
기본 profile ID는 Codex의 `codex-simple`·`codex-routine`·`codex-deep`·`codex-deep-high`, Claude의 `claude-simple`·`claude-routine`·`claude-deep`예요. `eligible_profile_ids`에는 환경변수로 활성화한 후보 안의 ID만 지정해요. 환경에서 제외한 모델이나 다른 client의 프로필을 요청해 다시 활성화할 수 없어요. 현재 목록은 capabilities로 조회해요.
|
|
75
75
|
|
|
76
76
|
```sh
|
|
77
77
|
node bin/aptly.ts capabilities
|
|
@@ -83,7 +83,9 @@ node bin/aptly.ts capabilities
|
|
|
83
83
|
|---|---|---|
|
|
84
84
|
| simple | `claude-simple`: haiku | `codex-simple`: gpt-6-luna / max |
|
|
85
85
|
| routine | `claude-routine`: sonnet | `codex-routine`: gpt-6.1-terra / high |
|
|
86
|
-
| deep | `claude-deep`: opus | `codex-deep`: gpt-6.2-sol / medium |
|
|
86
|
+
| deep | `claude-deep`: opus | `codex-deep`: gpt-6.2-sol / medium, `codex-deep-high`: gpt-6.2-sol / high |
|
|
87
|
+
|
|
88
|
+
`gpt-6.2-sol`을 포함하면 분류 기준은 일반 심층 작업에 `codex-deep` / medium을 우선하고, 상세한 의존성 분석 등 추가 추론이 필요한 작업에는 `codex-deep-high` / high를 고려해요. Hook이 불투명한 본문에서 작업명만 전달할 때는 이 high 후보를 제외해요. 충분한 설명으로 재시도하면 high가 다시 후보에 들어갈 수 있어요. 자동 Hook이 처리하는 Codex 스폰 호출에 effort가 이미 지정돼 있으면 그 값과 일치하는 모델만 후보에 남아요.
|
|
87
89
|
|
|
88
90
|
`gpt-6.1-sol`은 선택 후보 `codex-deep-legacy` / medium으로 유지합니다. 기존 후보 설정은 자동으로 바꾸지 않습니다.
|
|
89
91
|
|
|
@@ -103,7 +105,7 @@ MCP 설정 JSON의 `env` 값에는 위 배열을 JSON 문자열로 넣어요.
|
|
|
103
105
|
|
|
104
106
|
선택적으로 `gpt-6-astra`를 넣으면 `codex-frontier` / high, `fable`을 넣으면 `claude-frontier`가 후보에 들어가요. 이 둘은 기본 목록에는 없어요. 다른 모델을 문서에서 찾았다는 사실만으로 초안의 유한한 지원 목록이 확장되지는 않아요.
|
|
105
107
|
|
|
106
|
-
이 설정은 추천 후보만 바꿔요. 기존 모델·effort·역할·fork·resume·조직 권한을 덮어쓰는 설정은 아니에요. Claude effort는 이 프리셋에서 지정하지 않아요. Codex effort는
|
|
108
|
+
이 설정은 추천 후보만 바꿔요. 기존 모델·effort·역할·fork·resume·조직 권한을 덮어쓰는 설정은 아니에요. Claude effort는 이 프리셋에서 지정하지 않아요. Codex effort는 프로필별로 정해져 있으며 모델 배열에는 모델명만 적어요. 높은 effort와 저렴한 모델의 조합이 항상 최소 토큰·최저 비용이라는 주장은 하지 않아요.
|
|
107
109
|
|
|
108
110
|
## 공식 모델 정보와 캐시
|
|
109
111
|
|
|
@@ -97,7 +97,9 @@ Tiers are task presets and do not imply equivalent model performance across prov
|
|
|
97
97
|
|---|---|---|---|
|
|
98
98
|
| simple | `haiku` | `gpt-6-luna` / `max` | Extraction, format conversion, small mechanical edits |
|
|
99
99
|
| routine | `sonnet` | `gpt-6.1-terra` / `high` | Context-aware writing, translation, scoped implementation |
|
|
100
|
-
| deep | `opus` | `gpt-6.2-sol` / `medium` | Complex debugging, design decisions, deep review |
|
|
100
|
+
| deep | `opus` | `gpt-6.2-sol` / `medium`, `high` | Complex debugging, design decisions, deep review |
|
|
101
|
+
|
|
102
|
+
With `gpt-6.2-sol` enabled, the selection guidance favors `codex-deep` / `medium` for ordinary deep tasks and considers `codex-deep-high` / `high` when detailed dependency analysis or interacting failure modes warrant more reasoning. The automatic Hook excludes the high option when it only has an opaque task label. If no candidates remain, it asks for context before classification. A sufficient retry description makes high eligible again when it matches explicit choices. An explicit effort in an automatic Hook call limits candidates to models with that effort.
|
|
101
103
|
|
|
102
104
|
The new default applies when candidate configuration is missing or fresh; existing candidate lists are preserved. `gpt-6.1-sol` remains available as the optional `codex-deep-legacy` / `medium` profile. Both models can be selected with unique IDs.
|
|
103
105
|
|
|
@@ -97,7 +97,9 @@ aptly setup --client codex --migrate-launcher --launcher stable
|
|
|
97
97
|
|---|---|---|---|
|
|
98
98
|
| simple | `haiku` | `gpt-6-luna` / `max` | 抽出・形式変換・小さな機械的修正 |
|
|
99
99
|
| routine | `sonnet` | `gpt-6.1-terra` / `high` | 文脈を考慮した作成・翻訳・範囲が明確な実装 |
|
|
100
|
-
| deep | `opus` | `gpt-6.2-sol` / `medium` | 複合的なデバッグ・設計判断・詳細レビュー |
|
|
100
|
+
| deep | `opus` | `gpt-6.2-sol` / `medium`, `high` | 複合的なデバッグ・設計判断・詳細レビュー |
|
|
101
|
+
|
|
102
|
+
`gpt-6.2-sol` が候補にある場合、通常の深い検討には `codex-deep` / `medium` を優先するよう分類基準を示します。詳細な依存関係の分析や複数の障害条件の検討で追加の推論が必要な場合は、`codex-deep-high` / `high` を検討します。自動 Hook は本文を参照できずタスク名だけで判断する場合、high 候補を除外します。候補がなくなれば分類前に説明を求め、再試行で十分な説明が得られ、明示された値と一致する場合は high を再び候補にできます。自動 Hook の呼び出しで推論強度を明示した場合は、その値に対応するモデルだけが候補になります。
|
|
101
103
|
|
|
102
104
|
新しいデフォルトは候補設定がない場合や新規設定に適用され、既存の候補リストは保持されます。`gpt-6.1-sol` は任意の `codex-deep-legacy` / `medium` プロファイルとして引き続き利用できます。両モデルは異なる ID で同時に選択できます。
|
|
103
105
|
|
|
@@ -97,7 +97,9 @@ aptly setup --client codex --migrate-launcher --launcher stable
|
|
|
97
97
|
|---|---|---|---|
|
|
98
98
|
| simple | `haiku` | `gpt-6-luna` / `max` | 추출·형식 변환·작은 기계적 수정 |
|
|
99
99
|
| routine | `sonnet` | `gpt-6.1-terra` / `high` | 문맥을 고려한 작성·번역·범위가 명확한 구현 |
|
|
100
|
-
| deep | `opus` | `gpt-6.2-sol` / `medium` | 복합 디버깅·설계 판단·심층 검토 |
|
|
100
|
+
| deep | `opus` | `gpt-6.2-sol` / `medium`, `high` | 복합 디버깅·설계 판단·심층 검토 |
|
|
101
|
+
|
|
102
|
+
`gpt-6.2-sol`이 후보에 있으면 일반 심층 작업에는 `codex-deep` / `medium`을 우선하도록 분류 기준을 제시합니다. 상세한 의존성 분석이나 복합 실패 조건에 더 많은 추론이 필요한 경우에는 `codex-deep-high` / `high`를 고려합니다. 자동 Hook은 불투명한 본문에서 작업명만 사용할 때 이 high 후보를 제외합니다. 후보가 남지 않으면 분류 전에 설명을 요청하고, 충분한 설명으로 재시도하면 명시한 값과 호환되는 경우 high를 다시 평가할 수 있습니다. 자동 Hook 호출에 effort가 명시돼 있으면 그 값과 일치하는 모델만 후보에 남습니다.
|
|
101
103
|
|
|
102
104
|
새 기본값은 후보 설정이 없거나 새로 설정할 때 적용되며, 기존 후보 목록은 유지됩니다. `gpt-6.1-sol`은 선택 후보 `codex-deep-legacy` / `medium`으로 사용할 수 있습니다. 두 모델은 서로 다른 ID로 함께 선택할 수 있습니다.
|
|
103
105
|
|
|
@@ -97,7 +97,9 @@ aptly setup --client codex --migrate-launcher --launcher stable
|
|
|
97
97
|
|---|---|---|---|
|
|
98
98
|
| simple | `haiku` | `gpt-6-luna` / `max` | 提取、格式转换、小型机械修改 |
|
|
99
99
|
| routine | `sonnet` | `gpt-6.1-terra` / `high` | 考虑上下文的写作、翻译、范围明确的实现 |
|
|
100
|
-
| deep | `opus` | `gpt-6.2-sol` / `medium` | 复杂调试、设计判断、深入审阅 |
|
|
100
|
+
| deep | `opus` | `gpt-6.2-sol` / `medium`, `high` | 复杂调试、设计判断、深入审阅 |
|
|
101
|
+
|
|
102
|
+
启用 `gpt-6.2-sol` 后,分类指引建议常规深度任务优先选择 `codex-deep` / `medium`,在详细分析依赖关系或多个故障条件的相互作用需要更多推理时考虑 `codex-deep-high` / `high`。自动 Hook 只能使用任务名称时会排除 high 候选。如果没有剩余候选,它会先请求补充说明再分类。重试时提供充分说明,且 high 与显式选择相符时,可以重新考虑该候选。自动 Hook 调用中显式指定推理强度后,候选仅包括匹配该强度的模型。
|
|
101
103
|
|
|
102
104
|
新默认值适用于候选配置缺失或新建的情况;现有候选列表会保留。`gpt-6.1-sol` 仍可作为可选的 `codex-deep-legacy` / `medium` 配置使用。两个模型可使用不同的 ID 同时选择。
|
|
103
105
|
|