@cortexkit/anthropic-auth-core 1.22.0 → 2.0.0
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.md +2 -0
- package/dist/accounts.d.ts +52 -8
- package/dist/cachekeep.d.ts +27 -1
- package/dist/cch.d.ts +11 -1
- package/dist/claude-code.d.ts +23 -1
- package/dist/claustrum-enrollment.d.ts +72 -0
- package/dist/claustrum-scoped-roster.d.ts +27 -0
- package/dist/claustrum-scoped-runtime.d.ts +31 -0
- package/dist/claustrum-scoped.d.ts +53 -0
- package/dist/claustrum.d.ts +16 -82
- package/dist/commands/account.d.ts +38 -11
- package/dist/constants.d.ts +3 -2
- package/dist/custom-headers.d.ts +3 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +29700 -31
- package/dist/internal-types/LICENSE +21 -0
- package/dist/internal-types/commands/builtins.d.ts +71 -0
- package/dist/internal-types/commands/index.d.ts +10 -0
- package/dist/internal-types/commands/menu.d.ts +61 -0
- package/dist/internal-types/commands/model.d.ts +238 -0
- package/dist/internal-types/commands/pi.d.ts +23 -0
- package/dist/internal-types/commands/seam.d.ts +72 -0
- package/dist/internal-types/fs/refresh-file-lock.d.ts +33 -0
- package/dist/internal-types/logger/capture-sink.d.ts +14 -0
- package/dist/internal-types/logger/engine.d.ts +100 -0
- package/dist/internal-types/logger/index.d.ts +6 -0
- package/dist/internal-types/logger/redact.d.ts +11 -0
- package/dist/internal-types/pi-slot/index.d.ts +3 -0
- package/dist/internal-types/pi-slot/slot.d.ts +49 -0
- package/dist/internal-types/quota/codec.d.ts +11 -0
- package/dist/internal-types/quota/format.d.ts +46 -0
- package/dist/internal-types/quota/index.d.ts +10 -0
- package/dist/internal-types/quota/map.d.ts +63 -0
- package/dist/internal-types/quota/merge.d.ts +48 -0
- package/dist/internal-types/quota/projection.d.ts +64 -0
- package/dist/internal-types/store/attribution.d.ts +28 -0
- package/dist/internal-types/store/errors.d.ts +55 -0
- package/dist/internal-types/store/hooks.d.ts +12 -0
- package/dist/internal-types/store/identity.d.ts +39 -0
- package/dist/internal-types/store/index.d.ts +21 -0
- package/dist/internal-types/store/mutate.d.ts +189 -0
- package/dist/internal-types/store/pool.d.ts +196 -0
- package/dist/internal-types/store/provider-state.d.ts +131 -0
- package/dist/internal-types/store/publication.d.ts +47 -0
- package/dist/internal-types/store/pull.d.ts +36 -0
- package/dist/internal-types/store/refresh-lock.d.ts +63 -0
- package/dist/internal-types/store/refresh.d.ts +72 -0
- package/dist/internal-types/store/rows.d.ts +313 -0
- package/dist/internal-types/store/runtime.d.ts +36 -0
- package/dist/internal-types/store/schema.d.ts +443 -0
- package/dist/internal-types/store/settings.d.ts +63 -0
- package/dist/internal-types/store/torn.d.ts +78 -0
- package/dist/migration-source.d.ts +33 -0
- package/dist/model-remap.d.ts +27 -0
- package/dist/models.d.ts +60 -0
- package/dist/native-account-runtime.d.ts +121 -0
- package/dist/native-account-view.d.ts +126 -0
- package/dist/native-command-effects.d.ts +59 -0
- package/dist/native-credential-validation.d.ts +42 -0
- package/dist/native-custody-activation.d.ts +45 -0
- package/dist/native-custody.d.ts +114 -0
- package/dist/native-enrollment-authority.d.ts +2 -0
- package/dist/native-host-auth-read.d.ts +3 -0
- package/dist/native-host-auth-write.d.ts +51 -0
- package/dist/native-host-auth.d.ts +12 -0
- package/dist/native-local-credential-service.d.ts +76 -0
- package/dist/native-local-runtime-readers.d.ts +22 -0
- package/dist/native-lock-observer.d.ts +12 -0
- package/dist/native-menu-executor.d.ts +243 -0
- package/dist/native-menu-model.d.ts +142 -0
- package/dist/native-migration-proof.d.ts +28 -0
- package/dist/native-migration-source.d.ts +47 -0
- package/dist/native-migration.d.ts +66 -0
- package/dist/native-quota-codec.d.ts +32 -0
- package/dist/native-refresh-coordinator.d.ts +240 -0
- package/dist/native-roster-seed.d.ts +115 -0
- package/dist/native-runtime-registry.d.ts +19 -0
- package/dist/native-runtime.d.ts +204 -0
- package/dist/native-transient-account.d.ts +38 -0
- package/dist/native-ui.d.ts +45 -0
- package/dist/native-usage-publication.d.ts +11 -0
- package/dist/native-vault-admission.d.ts +8 -0
- package/dist/native-vault-connection.d.ts +33 -0
- package/dist/native-vault-paths.d.ts +13 -0
- package/dist/native-vault-runtime.d.ts +102 -0
- package/dist/native-vault-seed.d.ts +16 -0
- package/dist/oauth-profile.d.ts +2 -1
- package/dist/pool-authority.d.ts +159 -0
- package/dist/pool-binding.d.ts +32 -0
- package/dist/pool-paths.d.ts +21 -0
- package/dist/pool-store.d.ts +32 -0
- package/dist/prime.d.ts +11 -3
- package/dist/provider-error.d.ts +139 -0
- package/dist/quota-header-feed.d.ts +13 -0
- package/dist/quota-manager.d.ts +30 -5
- package/dist/relay.d.ts +22 -1
- package/dist/request-history.d.ts +34 -0
- package/dist/sse.d.ts +81 -0
- package/dist/sticky-routing.d.ts +29 -0
- package/package.json +9 -3
- package/dist/accounts.js +0 -3330
- package/dist/auth.js +0 -182
- package/dist/cache1h.js +0 -97
- package/dist/cachekeep-registry.js +0 -124
- package/dist/cachekeep.js +0 -578
- package/dist/cch.js +0 -127
- package/dist/claude-code.js +0 -388
- package/dist/claustrum.js +0 -529
- package/dist/commands/account.js +0 -239
- package/dist/constants.js +0 -82
- package/dist/dump.js +0 -616
- package/dist/fast.js +0 -66
- package/dist/json.js +0 -10
- package/dist/killswitch.js +0 -132
- package/dist/logger.js +0 -286
- package/dist/logging.js +0 -59
- package/dist/mid-conversation-output-config.js +0 -89
- package/dist/models.js +0 -141
- package/dist/network-errors.js +0 -27
- package/dist/oauth-profile.js +0 -54
- package/dist/pkce.js +0 -17
- package/dist/prime.js +0 -823
- package/dist/provider.js +0 -0
- package/dist/quota-header-feed.js +0 -279
- package/dist/quota-headers.js +0 -121
- package/dist/quota-manager.js +0 -805
- package/dist/quotas.js +0 -141
- package/dist/relay.js +0 -1243
- package/dist/routing.js +0 -94
- package/dist/start.js +0 -29
- package/dist/sticky-routing.js +0 -523
- package/dist/thinking-binding.js +0 -54
- package/dist/token-fingerprint.js +0 -8
package/dist/commands/account.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { isClaustrumEnabledForAccount } from '../accounts.js';
|
|
2
|
-
import { formatOAuthAccountTier } from '../oauth-profile.js';
|
|
3
|
-
export const CLAUDE_ACCOUNT_COMMAND_NAME = 'claude-account';
|
|
4
|
-
export function parseAccountCommandAction(argumentsText) {
|
|
5
|
-
const parts = argumentsText.trim().split(/\s+/).filter(Boolean);
|
|
6
|
-
if (parts.length === 0)
|
|
7
|
-
return { type: 'status' };
|
|
8
|
-
const action = parts[0];
|
|
9
|
-
const rest = parts.slice(1).join(' ');
|
|
10
|
-
if (action === 'enable' && rest)
|
|
11
|
-
return { type: 'enable', id: rest };
|
|
12
|
-
if (action === 'disable' && rest)
|
|
13
|
-
return { type: 'disable', id: rest };
|
|
14
|
-
if (action === 'remove' && rest)
|
|
15
|
-
return { type: 'remove', id: rest };
|
|
16
|
-
if (action === 'move-up' && rest)
|
|
17
|
-
return { type: 'move-up', id: rest };
|
|
18
|
-
if (action === 'move-down' && rest)
|
|
19
|
-
return { type: 'move-down', id: rest };
|
|
20
|
-
if (action === 'reset-backoff' && !rest)
|
|
21
|
-
return { type: 'reset-backoff' };
|
|
22
|
-
if (action === 'add-apikey' && rest) {
|
|
23
|
-
let remaining = rest;
|
|
24
|
-
let baseURL;
|
|
25
|
-
let authHeader;
|
|
26
|
-
// Parse --base-url flag
|
|
27
|
-
const baseUrlMatch = remaining.match(/--base-url\s+(\S+)/);
|
|
28
|
-
if (baseUrlMatch) {
|
|
29
|
-
baseURL = baseUrlMatch[1];
|
|
30
|
-
remaining = remaining.replace(baseUrlMatch[0], '').trim();
|
|
31
|
-
}
|
|
32
|
-
// Parse --auth-header flag
|
|
33
|
-
const authMatch = remaining.match(/--auth-header\s+(authorization-bearer|x-api-key)/);
|
|
34
|
-
if (authMatch) {
|
|
35
|
-
authHeader = authMatch[1];
|
|
36
|
-
remaining = remaining.replace(authMatch[0], '').trim();
|
|
37
|
-
}
|
|
38
|
-
// Parse --label flag
|
|
39
|
-
let label;
|
|
40
|
-
const labelMatch = remaining.match(/--label\s+(.+)/);
|
|
41
|
-
if (labelMatch) {
|
|
42
|
-
label = labelMatch[1]?.trim() || undefined;
|
|
43
|
-
remaining = remaining.replace(labelMatch[0], '').trim();
|
|
44
|
-
}
|
|
45
|
-
// First remaining token is the API key; rest (if any) is label
|
|
46
|
-
const firstSpace = remaining.indexOf(' ');
|
|
47
|
-
if (firstSpace === -1) {
|
|
48
|
-
if (!remaining)
|
|
49
|
-
return { type: 'usage' };
|
|
50
|
-
return {
|
|
51
|
-
type: 'add-apikey',
|
|
52
|
-
apiKey: remaining,
|
|
53
|
-
baseURL,
|
|
54
|
-
authHeader,
|
|
55
|
-
label,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const apiKey = remaining.slice(0, firstSpace);
|
|
59
|
-
const tail = remaining.slice(firstSpace + 1).trim();
|
|
60
|
-
return {
|
|
61
|
-
type: 'add-apikey',
|
|
62
|
-
apiKey,
|
|
63
|
-
label: label ?? (tail || undefined),
|
|
64
|
-
baseURL,
|
|
65
|
-
authHeader,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
if (action === 'add-oauth-start')
|
|
69
|
-
return { type: 'add-oauth-start' };
|
|
70
|
-
if (action === 'add-oauth-finish' && rest) {
|
|
71
|
-
let remaining = rest;
|
|
72
|
-
// Parse --label flag (mirrors add-apikey). The OAuth code is opaque (may
|
|
73
|
-
// contain a #state segment) so the label is collected via the flag, never
|
|
74
|
-
// positionally.
|
|
75
|
-
let label;
|
|
76
|
-
const labelMatch = remaining.match(/--label\s+(.+)/);
|
|
77
|
-
if (labelMatch) {
|
|
78
|
-
label = labelMatch[1]?.trim() || undefined;
|
|
79
|
-
remaining = remaining.replace(labelMatch[0], '').trim();
|
|
80
|
-
}
|
|
81
|
-
if (!remaining)
|
|
82
|
-
return { type: 'usage' };
|
|
83
|
-
return { type: 'add-oauth-finish', code: remaining, label };
|
|
84
|
-
}
|
|
85
|
-
return { type: 'usage' };
|
|
86
|
-
}
|
|
87
|
-
export function buildAccountList(storage) {
|
|
88
|
-
const list = [];
|
|
89
|
-
const fiveHour = storage.quota?.mainQuota?.five_hour;
|
|
90
|
-
list.push({
|
|
91
|
-
id: 'main',
|
|
92
|
-
label: storage.main?.provider === 'anthropic' ? 'OpenCode anthropic' : 'Main',
|
|
93
|
-
role: 'main',
|
|
94
|
-
enabled: true,
|
|
95
|
-
quotaPercent: fiveHour?.usedPercent ?? null,
|
|
96
|
-
tierLabel: formatOAuthAccountTier(storage.main?.profile),
|
|
97
|
-
});
|
|
98
|
-
for (const account of storage.accounts) {
|
|
99
|
-
const fiveHourQuota = account.quota?.five_hour;
|
|
100
|
-
list.push({
|
|
101
|
-
id: account.id,
|
|
102
|
-
label: account.label ?? account.id,
|
|
103
|
-
role: 'fallback',
|
|
104
|
-
enabled: account.enabled !== false,
|
|
105
|
-
quotaPercent: fiveHourQuota?.usedPercent ?? null,
|
|
106
|
-
tierLabel: account.type === 'oauth'
|
|
107
|
-
? formatOAuthAccountTier(account.profile)
|
|
108
|
-
: undefined,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return list;
|
|
112
|
-
}
|
|
113
|
-
const USAGE_TEXT = [
|
|
114
|
-
'Usage:',
|
|
115
|
-
' /claude-account Show account list',
|
|
116
|
-
' /claude-account enable <id> Enable a fallback account',
|
|
117
|
-
' /claude-account disable <id> Disable a fallback account',
|
|
118
|
-
' /claude-account remove <id> Remove a fallback account',
|
|
119
|
-
' /claude-account move-up <id> Move a fallback account up',
|
|
120
|
-
' /claude-account move-down <id> Move a fallback account down',
|
|
121
|
-
' /claude-account reset-backoff Clear main OAuth refresh and quota backoff',
|
|
122
|
-
' /claude-account add-apikey <key> Add an API key fallback account',
|
|
123
|
-
' /claude-account add-oauth-start Start OAuth device flow',
|
|
124
|
-
' /claude-account add-oauth-finish <code> Complete OAuth flow',
|
|
125
|
-
].join('\n');
|
|
126
|
-
export function executeAccountCommand(input) {
|
|
127
|
-
const action = parseAccountCommandAction(input.argumentsText);
|
|
128
|
-
const accounts = input.storage.accounts;
|
|
129
|
-
const mainId = 'main';
|
|
130
|
-
if (action.type === 'status') {
|
|
131
|
-
const list = buildAccountList(input.storage);
|
|
132
|
-
const detection = input.claustrum?.status ?? 'unknown';
|
|
133
|
-
const lines = ['## Claude Accounts', '', `- Claustrum: ${detection}`, ''];
|
|
134
|
-
for (const a of list) {
|
|
135
|
-
const pct = a.quotaPercent != null ? ` ${Math.round(a.quotaPercent)}%` : '';
|
|
136
|
-
const status = !a.enabled ? ' (disabled)' : '';
|
|
137
|
-
const tier = a.tierLabel ? ` · ${a.tierLabel}` : '';
|
|
138
|
-
const gate = a.id === mainId
|
|
139
|
-
? ' · gate n/a (OpenCode managed)'
|
|
140
|
-
: ` · gate ${isClaustrumEnabledForAccount(input.storage, a.id) ? 'on' : 'off'}`;
|
|
141
|
-
lines.push(`- **${a.label}** [${a.role}]${tier}${status}${pct}${gate}`);
|
|
142
|
-
}
|
|
143
|
-
lines.push('', USAGE_TEXT);
|
|
144
|
-
return { text: lines.join('\n') };
|
|
145
|
-
}
|
|
146
|
-
if (action.type === 'usage') {
|
|
147
|
-
return { text: USAGE_TEXT };
|
|
148
|
-
}
|
|
149
|
-
if (action.type === 'add-apikey') {
|
|
150
|
-
return { text: 'add-apikey' };
|
|
151
|
-
}
|
|
152
|
-
if (action.type === 'add-oauth-start') {
|
|
153
|
-
return { text: 'add-oauth-start' };
|
|
154
|
-
}
|
|
155
|
-
if (action.type === 'add-oauth-finish') {
|
|
156
|
-
return { text: 'add-oauth-finish' };
|
|
157
|
-
}
|
|
158
|
-
if (action.type === 'reset-backoff') {
|
|
159
|
-
return {
|
|
160
|
-
text: 'Main OAuth refresh and quota backoff cleared.',
|
|
161
|
-
updated: { id: 'main', action: 'reset-backoff' },
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
const id = action.id;
|
|
165
|
-
if (id === mainId) {
|
|
166
|
-
return {
|
|
167
|
-
text: `Cannot ${action.type} the main account (OpenCode managed).`,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
if (action.type === 'enable' || action.type === 'disable') {
|
|
171
|
-
const target = accounts.find((a) => a.id === id);
|
|
172
|
-
if (!target) {
|
|
173
|
-
return { text: `Account "${id}" not found.` };
|
|
174
|
-
}
|
|
175
|
-
return {
|
|
176
|
-
text: `Account "${target.label ?? id}" ${action.type}d.`,
|
|
177
|
-
updated: {
|
|
178
|
-
id,
|
|
179
|
-
action: action.type,
|
|
180
|
-
enabled: action.type === 'enable',
|
|
181
|
-
},
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
if (action.type === 'remove') {
|
|
185
|
-
const target = accounts.find((a) => a.id === id);
|
|
186
|
-
if (!target) {
|
|
187
|
-
return { text: `Account "${id}" not found.` };
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
text: `Account "${target.label ?? id}" removed.`,
|
|
191
|
-
updated: { id, action: 'remove' },
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
if (action.type === 'move-up') {
|
|
195
|
-
const idx = accounts.findIndex((a) => a.id === id);
|
|
196
|
-
if (idx < 0) {
|
|
197
|
-
return { text: `Account "${id}" not found.` };
|
|
198
|
-
}
|
|
199
|
-
if (idx === 0) {
|
|
200
|
-
return {
|
|
201
|
-
text: `Account "${accounts[idx]?.label ?? id}" is already first.`,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
const previousOrder = accounts.map((a) => a.id);
|
|
205
|
-
const newAccounts = [...accounts];
|
|
206
|
-
[newAccounts[idx - 1], newAccounts[idx]] = [
|
|
207
|
-
newAccounts[idx],
|
|
208
|
-
newAccounts[idx - 1],
|
|
209
|
-
];
|
|
210
|
-
const newOrder = newAccounts.map((a) => a.id);
|
|
211
|
-
return {
|
|
212
|
-
text: `Account "${accounts[idx]?.label ?? id}" moved up.`,
|
|
213
|
-
updated: { id, action: 'reorder', previousOrder, newOrder },
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (action.type === 'move-down') {
|
|
217
|
-
const idx = accounts.findIndex((a) => a.id === id);
|
|
218
|
-
if (idx < 0) {
|
|
219
|
-
return { text: `Account "${id}" not found.` };
|
|
220
|
-
}
|
|
221
|
-
if (idx === accounts.length - 1) {
|
|
222
|
-
return {
|
|
223
|
-
text: `Account "${accounts[idx]?.label ?? id}" is already last.`,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
const previousOrder = accounts.map((a) => a.id);
|
|
227
|
-
const newAccounts = [...accounts];
|
|
228
|
-
[newAccounts[idx], newAccounts[idx + 1]] = [
|
|
229
|
-
newAccounts[idx + 1],
|
|
230
|
-
newAccounts[idx],
|
|
231
|
-
];
|
|
232
|
-
const newOrder = newAccounts.map((a) => a.id);
|
|
233
|
-
return {
|
|
234
|
-
text: `Account "${accounts[idx]?.label ?? id}" moved down.`,
|
|
235
|
-
updated: { id, action: 'reorder', previousOrder, newOrder },
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
return { text: USAGE_TEXT };
|
|
239
|
-
}
|
package/dist/constants.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
export const CLIENT_ID = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
|
|
2
|
-
export const AUTHORIZE_URLS = {
|
|
3
|
-
console: 'https://platform.claude.com/oauth/authorize',
|
|
4
|
-
max: 'https://claude.com/cai/oauth/authorize',
|
|
5
|
-
};
|
|
6
|
-
export const CODE_CALLBACK_URL = 'https://platform.claude.com/oauth/code/callback';
|
|
7
|
-
export const TOKEN_URL = 'https://platform.claude.com/v1/oauth/token';
|
|
8
|
-
export const AXIOS_USER_AGENT = 'axios/1.15.2';
|
|
9
|
-
export const OAUTH_SCOPES = [
|
|
10
|
-
'org:create_api_key',
|
|
11
|
-
'user:profile',
|
|
12
|
-
'user:inference',
|
|
13
|
-
'user:sessions:claude_code',
|
|
14
|
-
'user:mcp_servers',
|
|
15
|
-
'user:file_upload',
|
|
16
|
-
];
|
|
17
|
-
export const REFRESH_SCOPE = 'user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload';
|
|
18
|
-
export const TOOL_PREFIX = 'mcp_';
|
|
19
|
-
export const REQUIRED_BETAS = [
|
|
20
|
-
'oauth-2025-04-20',
|
|
21
|
-
'interleaved-thinking-2025-05-14',
|
|
22
|
-
];
|
|
23
|
-
export const FAST_MODE_BETA = 'fast-mode-2026-02-01';
|
|
24
|
-
export function mergeAnthropicBetas(existing, betas) {
|
|
25
|
-
const incoming = (existing ?? '')
|
|
26
|
-
.split(',')
|
|
27
|
-
.map((beta) => beta.trim())
|
|
28
|
-
.filter(Boolean);
|
|
29
|
-
return [...new Set([...incoming, ...betas])].join(',');
|
|
30
|
-
}
|
|
31
|
-
export function isFastModeSupportedModel(model) {
|
|
32
|
-
return (typeof model === 'string' &&
|
|
33
|
-
(model.startsWith('claude-opus-4-6') ||
|
|
34
|
-
model.startsWith('claude-opus-4-7') ||
|
|
35
|
-
model.startsWith('claude-opus-4-8') ||
|
|
36
|
-
model.startsWith('claude-opus-5')));
|
|
37
|
-
}
|
|
38
|
-
export const OPENCODE_IDENTITY_PREFIX = 'You are OpenCode';
|
|
39
|
-
export const CLAUDE_CODE_IDENTITY = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
40
|
-
export const PARALLEL_TOOL_CALLS_SYSTEM_PROMPT = [
|
|
41
|
-
'<use_parallel_tool_calls>',
|
|
42
|
-
'For maximum efficiency, whenever you perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially. Prioritize calling independent tools in parallel whenever possible. For example, when reading 3 known files, run 3 tool calls in parallel to read all 3 files into context at the same time. When running multiple independent read-only commands like `ls` or `list_dir`, run all of those commands in parallel. Err on the side of maximizing parallel tool calls for independent work rather than running too many tools sequentially.',
|
|
43
|
-
'',
|
|
44
|
-
'Do not parallelize tool calls when one call depends on the output of another call. If a tool call needs an ID, filename, search result, or any other value returned by a previous tool call, run the first call, wait for its result, then run the dependent call using the real returned value. Never invent placeholder IDs, guessed task IDs, or other guessed values for dependent tool calls just to place them in the same parallel block.',
|
|
45
|
-
'</use_parallel_tool_calls>',
|
|
46
|
-
].join('\n');
|
|
47
|
-
export const CCH_SALT = '59cf53e54c78';
|
|
48
|
-
export const CCH_POSITIONS = [4, 7, 20];
|
|
49
|
-
export const CLAUDE_CODE_VERSION = '2.1.258';
|
|
50
|
-
export const CLAUDE_CODE_ENTRYPOINT = 'cli';
|
|
51
|
-
export const CLAUDE_CODE_STAINLESS_PACKAGE_VERSION = '0.112.1';
|
|
52
|
-
export const CLAUDE_CODE_STAINLESS_RUNTIME_VERSION = 'v26.3.0';
|
|
53
|
-
export const USER_AGENT = 'claude-cli/2.1.258 (external, cli)';
|
|
54
|
-
export const CACHE_1H_MODES = ['explicit', 'automatic', 'hybrid'];
|
|
55
|
-
export const DEFAULT_CACHE_1H_MODE = 'explicit';
|
|
56
|
-
/**
|
|
57
|
-
* Anchors that identify paragraphs to remove from the system prompt.
|
|
58
|
-
* Any paragraph (text between blank lines) containing one of these
|
|
59
|
-
* strings is removed entirely.
|
|
60
|
-
*
|
|
61
|
-
* This is resilient to upstream rewording — as long as the anchor
|
|
62
|
-
* string (typically a URL) still appears somewhere in the paragraph,
|
|
63
|
-
* the removal works regardless of how the surrounding text changes.
|
|
64
|
-
*/
|
|
65
|
-
export const PARAGRAPH_REMOVAL_ANCHORS = [
|
|
66
|
-
// Help/feedback block — references the OpenCode GitHub repo
|
|
67
|
-
'github.com/anomalyco/opencode',
|
|
68
|
-
// OpenCode docs guidance — references the OpenCode docs URL
|
|
69
|
-
'opencode.ai/docs',
|
|
70
|
-
];
|
|
71
|
-
/**
|
|
72
|
-
* Inline text replacements applied after paragraph removal.
|
|
73
|
-
* These handle cases where "OpenCode" appears inside a paragraph
|
|
74
|
-
* we want to keep (so we can't remove the whole paragraph).
|
|
75
|
-
*/
|
|
76
|
-
export const TEXT_REPLACEMENTS = [
|
|
77
|
-
{ match: 'if OpenCode honestly', replacement: 'if the assistant honestly' },
|
|
78
|
-
{
|
|
79
|
-
match: 'Here is some useful information about the environment you are running in:',
|
|
80
|
-
replacement: 'Environment context you are running in:',
|
|
81
|
-
},
|
|
82
|
-
];
|