anyray-connect 0.3.0 → 0.5.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/dist/cli.js +88 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/hook.js +233 -0
- package/dist/commands/hook.js.map +1 -0
- package/dist/target.js +11 -1
- package/dist/target.js.map +1 -1
- package/dist/tools/claudeCode.js +71 -2
- package/dist/tools/claudeCode.js.map +1 -1
- package/dist/tools/codex.js +3 -3
- package/dist/tools/codex.js.map +1 -1
- package/dist/tools/shellEnv.js +40 -8
- package/dist/tools/shellEnv.js.map +1 -1
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -1
- package/dist/util/seatState.js +79 -0
- package/dist/util/seatState.js.map +1 -0
- package/dist/util/trimOutput.js +120 -0
- package/dist/util/trimOutput.js.map +1 -0
- package/dist/util/verify.js +192 -0
- package/dist/util/verify.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claudeCode.js","sourceRoot":"","sources":["../../src/tools/claudeCode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAQtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"claudeCode.js","sourceRoot":"","sources":["../../src/tools/claudeCode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,U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AC;QACtD,IAAI,WAAW;YAAE,QAAQ,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;QACvE,wEAAwE;QACxE,kEAAkE;QAClE,IAAI,MAAM,UAAU,CAAC,GAAG,IAAI,aAAa,CAAC,EAAE,CAAC;YAC3C,QAAQ,CAAC,IAAI,CAAC,wBAAwB,IAAI,0CAA0C,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;IAChE,CAAC;CACF,CAAC"}
|
package/dist/tools/codex.js
CHANGED
|
@@ -40,7 +40,7 @@ import { join } from 'node:path';
|
|
|
40
40
|
import { writeFile, rm } from 'node:fs/promises';
|
|
41
41
|
import { fileExists } from '../util/jsonFile.js';
|
|
42
42
|
import { removeProfileBlock } from '../util/profile.js';
|
|
43
|
-
import { metadataHeaderValue } from '../types.js';
|
|
43
|
+
import { effectiveSubscription, metadataHeaderValue } from '../types.js';
|
|
44
44
|
/** Model Codex sends when ANYRAY_CODEX_MODEL is unset; the gateway's default
|
|
45
45
|
* routing decides the real model/provider, so this is just a required token. */
|
|
46
46
|
const DEFAULT_MODEL = 'anyray-default';
|
|
@@ -92,7 +92,7 @@ const resolveModel = (subscription) => {
|
|
|
92
92
|
/** Full contents of the standalone profile file (flat top-level keys). */
|
|
93
93
|
const profileFile = (target) => {
|
|
94
94
|
const meta = codexMetadata(target);
|
|
95
|
-
const subscription = target
|
|
95
|
+
const subscription = effectiveSubscription(target, 'openai');
|
|
96
96
|
// Subscription traffic is ChatGPT-backend-only — the provider pin is not
|
|
97
97
|
// the operator's call there, so ANYRAY_CODEX_PROVIDER applies only to
|
|
98
98
|
// placeholder mode.
|
|
@@ -152,7 +152,7 @@ export const codex = {
|
|
|
152
152
|
async apply(target, opts) {
|
|
153
153
|
const path = profilePath();
|
|
154
154
|
const meta = codexMetadata(target);
|
|
155
|
-
const subscription = target
|
|
155
|
+
const subscription = effectiveSubscription(target, 'openai');
|
|
156
156
|
const model = resolveModel(subscription);
|
|
157
157
|
const messages = [
|
|
158
158
|
`${path} ← standalone Codex profile (model_provider = anyray)`,
|
package/dist/tools/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/tools/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/tools/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzE;iFACiF;AACjF,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAEvC;;uBAEuB;AACvB,MAAM,cAAc,GAAG,OAAO,CAAC;AAC/B,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAEzC;iEACiE;AAC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F,CAAC"}
|
package/dist/tools/shellEnv.js
CHANGED
|
@@ -7,20 +7,34 @@
|
|
|
7
7
|
* headers, so per-request `x-anyray-metadata` attribution isn't set here —
|
|
8
8
|
* attribution for these falls back to the gateway's defaults. Tools that DO
|
|
9
9
|
* support headers (Claude Code) have their own adapter.
|
|
10
|
+
*
|
|
11
|
+
* SEATS — export keys PER FAMILY: a placeholder `OPENAI_API_KEY` /
|
|
12
|
+
* `ANTHROPIC_AUTH_TOKEN` exported here is not just useless against a seat, it is
|
|
13
|
+
* actively harmful — the seat-based tools (Claude Code, Codex) read these
|
|
14
|
+
* process-env vars with HIGHER precedence than their own config, so the
|
|
15
|
+
* placeholder silently overrides the seat sign-in and forces the request off the
|
|
16
|
+
* subscription onto the org's default provider. So we export a family's key only
|
|
17
|
+
* when that family is NOT on a seat (resolved via `effectiveSubscription`). Base
|
|
18
|
+
* URLs are always safe (they only redirect to the gateway; a seat tool still
|
|
19
|
+
* supplies its own token). Raw SDK/script callers on a seat must bring their own
|
|
20
|
+
* credential for that family.
|
|
10
21
|
*/
|
|
11
22
|
import { detectProfilePath, removeProfileBlock, upsertProfileBlock } from '../util/profile.js';
|
|
12
23
|
import { fileExists } from '../util/jsonFile.js';
|
|
13
24
|
import { maskKey } from '../util/redeem.js';
|
|
25
|
+
import { effectiveSubscription } from '../types.js';
|
|
14
26
|
// Single-quote the values: shells treat single-quoted strings literally, so a
|
|
15
27
|
// `$`, backtick, or double-quote in a URL/key can't trigger expansion or break
|
|
16
28
|
// out of the assignment. (Single quotes themselves can't appear in these.)
|
|
17
29
|
// The exported key is the dev's personal gateway key (from an invite) when
|
|
18
|
-
// present, else the shared placeholder.
|
|
19
|
-
|
|
30
|
+
// present, else the shared placeholder. A family on a seat exports its base URL
|
|
31
|
+
// only and NO key (see the module comment — a placeholder token here hijacks
|
|
32
|
+
// that tool's own sign-in).
|
|
33
|
+
const envLines = (target, key, openaiSeat, anthropicSeat) => [
|
|
20
34
|
`export OPENAI_BASE_URL='${target.openaiBaseUrl}'`,
|
|
21
|
-
`export OPENAI_API_KEY='${key}'
|
|
35
|
+
...(openaiSeat ? [] : [`export OPENAI_API_KEY='${key}'`]),
|
|
22
36
|
`export ANTHROPIC_BASE_URL='${target.anthropicBaseUrl}'`,
|
|
23
|
-
`export ANTHROPIC_AUTH_TOKEN='${key}'
|
|
37
|
+
...(anthropicSeat ? [] : [`export ANTHROPIC_AUTH_TOKEN='${key}'`]),
|
|
24
38
|
];
|
|
25
39
|
export const shellEnv = {
|
|
26
40
|
id: 'shell-env',
|
|
@@ -35,19 +49,37 @@ export const shellEnv = {
|
|
|
35
49
|
},
|
|
36
50
|
async apply(target, opts) {
|
|
37
51
|
const path = detectProfilePath();
|
|
52
|
+
// Per family: a detected/forced seat means the tool owns its own auth, so we
|
|
53
|
+
// must NOT export that family's key (it would override the seat sign-in).
|
|
54
|
+
const openaiSeat = effectiveSubscription(target, 'openai');
|
|
55
|
+
const anthropicSeat = effectiveSubscription(target, 'anthropic');
|
|
56
|
+
const anySeat = openaiSeat || anthropicSeat;
|
|
38
57
|
const key = target.clientKey ?? target.placeholderKey;
|
|
39
|
-
const lines = envLines(target, key);
|
|
58
|
+
const lines = envLines(target, key, openaiSeat, anthropicSeat);
|
|
40
59
|
// Console output masks a personal key (the file gets the real one) — a
|
|
41
60
|
// terminal/scrollback should never show the full credential.
|
|
42
61
|
const shownLines = target.clientKey
|
|
43
|
-
? envLines(target, maskKey(target.clientKey))
|
|
62
|
+
? envLines(target, maskKey(target.clientKey), openaiSeat, anthropicSeat)
|
|
44
63
|
: lines;
|
|
64
|
+
const seatLabel = openaiSeat && anthropicSeat
|
|
65
|
+
? 'either family'
|
|
66
|
+
: openaiSeat
|
|
67
|
+
? 'OpenAI'
|
|
68
|
+
: 'Anthropic';
|
|
45
69
|
const messages = [
|
|
46
70
|
`${path} ← managed Anyray block`,
|
|
47
71
|
...shownLines.map((l) => ` ${l}`),
|
|
48
72
|
`Run \`source ${path}\` or open a new terminal to apply.`,
|
|
49
|
-
|
|
50
|
-
|
|
73
|
+
...(anySeat
|
|
74
|
+
? [
|
|
75
|
+
`No auth token exported for ${seatLabel} — your seat-based tool keeps`,
|
|
76
|
+
'its own sign-in (a placeholder here would override it). Raw SDK/script',
|
|
77
|
+
'calls on a seat need your own key.',
|
|
78
|
+
]
|
|
79
|
+
: [
|
|
80
|
+
'Note: standard SDK env vars carry no per-user header, so attribution',
|
|
81
|
+
'for these falls back to the gateway default.',
|
|
82
|
+
]),
|
|
51
83
|
];
|
|
52
84
|
if (opts.dryRun)
|
|
53
85
|
return { status: 'configured', messages };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shellEnv.js","sourceRoot":"","sources":["../../src/tools/shellEnv.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"shellEnv.js","sourceRoot":"","sources":["../../src/tools/shellEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AASpD,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,gFAAgF;AAChF,6EAA6E;AAC7E,4BAA4B;AAC5B,MAAM,QAAQ,GAAG,CACf,MAAqB,EACrB,GAAW,EACX,UAAmB,EACnB,aAAsB,EACZ,EAAE,CAAC;IACb,2BAA2B,MAAM,CAAC,aAAa,GAAG;IAClD,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,0BAA0B,GAAG,GAAG,CAAC,CAAC;IACzD,8BAA8B,MAAM,CAAC,gBAAgB,GAAG;IACxD,GAAG,C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AC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC3C,CAAC;IACJ,CAAC;CACF,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -12,6 +12,19 @@
|
|
|
12
12
|
* grouping only (user/team/intent/session), matching the gateway's
|
|
13
13
|
* `x-anyray-metadata` contract.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* Resolve whether a given provider family should use subscription pass-through
|
|
17
|
+
* for this target. The single place that interprets `authMode` so adapters
|
|
18
|
+
* don't each re-derive it: forced modes win; `auto` defers to the detected
|
|
19
|
+
* `seat` state (absent → org key, the safe fallback).
|
|
20
|
+
*/
|
|
21
|
+
export const effectiveSubscription = (target, family) => {
|
|
22
|
+
if (target.authMode === 'subscription')
|
|
23
|
+
return true;
|
|
24
|
+
if (target.authMode === 'placeholder')
|
|
25
|
+
return false;
|
|
26
|
+
return target.seat?.[family] ?? false;
|
|
27
|
+
};
|
|
15
28
|
/** Build the `x-anyray-metadata` header value, or undefined when empty. */
|
|
16
29
|
export const metadataHeaderValue = (metadata) => {
|
|
17
30
|
const entries = Object.entries(metadata).filter(([, v]) => v);
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqFH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,MAAqB,EACrB,MAAuB,EACd,EAAE;IACX,IAAI,MAAM,CAAC,QAAQ,KAAK,cAAc;QAAE,OAAO,IAAI,CAAC;IACpD,IAAI,MAAM,CAAC,QAAQ,KAAK,aAAa;QAAE,OAAO,KAAK,CAAC;IACpD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC;AACxC,CAAC,CAAC;AAoDF,2EAA2E;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,QAA6B,EACT,EAAE;IACtB,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC3C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AACrD,CAAC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seat-state detection — does this machine already have a subscription sign-in
|
|
3
|
+
* for each provider family? This is what makes the one-command flow autonomous:
|
|
4
|
+
* `authMode: 'auto'` reads it and rides the dev's own seat when present, falling
|
|
5
|
+
* back to the org key when not. No human input, no flags.
|
|
6
|
+
*
|
|
7
|
+
* Best-effort and SILENT: every probe is wrapped so a missing file, a denied
|
|
8
|
+
* keychain, or a slow `security` call resolves to "not signed in" rather than
|
|
9
|
+
* throwing — a detection miss just means we fall back to the org key, which
|
|
10
|
+
* always works. We read only whether a credential EXISTS, never its value: a
|
|
11
|
+
* keychain *metadata* lookup (no `-w`) doesn't prompt and doesn't expose the
|
|
12
|
+
* secret, and credential files are probed with `fileExists`, not read. The seat
|
|
13
|
+
* token itself stays in the tool; connect never holds it.
|
|
14
|
+
*
|
|
15
|
+
* Signals (macOS-first, since that's where coding tools mostly run):
|
|
16
|
+
* - Anthropic (Claude Code): `CLAUDE_CODE_OAUTH_TOKEN` env, `~/.claude/.oauth_token`,
|
|
17
|
+
* `~/.claude/.credentials.json` (Linux), or the macOS Keychain item
|
|
18
|
+
* `Claude Code-credentials`.
|
|
19
|
+
* - OpenAI (Codex): `~/.codex/auth.json` carrying a ChatGPT `tokens.access_token`
|
|
20
|
+
* (an API-key-only `auth.json` is NOT a subscription seat).
|
|
21
|
+
*/
|
|
22
|
+
import { homedir, platform } from 'node:os';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
import { execFile } from 'node:child_process';
|
|
25
|
+
import { readFile } from 'node:fs/promises';
|
|
26
|
+
import { fileExists } from './jsonFile.js';
|
|
27
|
+
const KEYCHAIN_TIMEOUT_MS = 3000;
|
|
28
|
+
const CLAUDE_KEYCHAIN_SERVICE = 'Claude Code-credentials';
|
|
29
|
+
/** True if a Keychain generic-password item exists for `service`. Metadata-only
|
|
30
|
+
* lookup (no `-w`) so macOS does NOT prompt and the secret is never read. */
|
|
31
|
+
const keychainHasItem = (service) => new Promise((resolve) => {
|
|
32
|
+
try {
|
|
33
|
+
const child = execFile('security', ['find-generic-password', '-s', service], { timeout: KEYCHAIN_TIMEOUT_MS }, (err) => resolve(!err));
|
|
34
|
+
child.on('error', () => resolve(false));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
resolve(false);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
/** Detect an Anthropic subscription seat (Claude Code). */
|
|
41
|
+
export const detectAnthropicSeat = async () => {
|
|
42
|
+
if (process.env.CLAUDE_CODE_OAUTH_TOKEN?.trim())
|
|
43
|
+
return true;
|
|
44
|
+
const claudeDir = join(homedir(), '.claude');
|
|
45
|
+
if (await fileExists(join(claudeDir, '.oauth_token')))
|
|
46
|
+
return true;
|
|
47
|
+
if (await fileExists(join(claudeDir, '.credentials.json')))
|
|
48
|
+
return true;
|
|
49
|
+
if (platform() === 'darwin' && (await keychainHasItem(CLAUDE_KEYCHAIN_SERVICE))) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
};
|
|
54
|
+
/** Detect a ChatGPT subscription seat (Codex) — a `tokens.access_token` in
|
|
55
|
+
* `~/.codex/auth.json`. An API-key-only file is a keyed login, not a seat. */
|
|
56
|
+
export const detectOpenAiSeat = async () => {
|
|
57
|
+
const authPath = join(process.env.CODEX_HOME?.trim() || join(homedir(), '.codex'), 'auth.json');
|
|
58
|
+
if (!(await fileExists(authPath)))
|
|
59
|
+
return false;
|
|
60
|
+
try {
|
|
61
|
+
const parsed = JSON.parse(await readFile(authPath, 'utf-8'));
|
|
62
|
+
return typeof parsed.tokens?.access_token === 'string' &&
|
|
63
|
+
parsed.tokens.access_token.trim() !== ''
|
|
64
|
+
? true
|
|
65
|
+
: false;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/** Detect seat sign-in for every provider family in parallel. Never throws. */
|
|
72
|
+
export const detectSeatState = async () => {
|
|
73
|
+
const [anthropic, openai] = await Promise.all([
|
|
74
|
+
detectAnthropicSeat(),
|
|
75
|
+
detectOpenAiSeat(),
|
|
76
|
+
]);
|
|
77
|
+
return { anthropic, openai };
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=seatState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seatState.js","sourceRoot":"","sources":["../../src/util/seatState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAE1D;8EAC8E;AAC9E,MAAM,eAAe,GAAG,CAAC,OAAe,EAAoB,EAAE,CAC5D,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,IAAI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D,WAAW,CACZ,CAAC;IACF,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAChD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAE1D,CAAC;QACF,OAAO,OAAO,MAAM,CAAC,MAAM,EAAE,YAAY,KAAK,QAAQ;YACpD,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE;YACxC,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,IAAwB,EAAE;IAC5D,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC5C,mBAAmB,EAAE;QACrB,gBAAgB,EAAE;KACnB,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local, deterministic trimming of oversized tool outputs.
|
|
3
|
+
*
|
|
4
|
+
* This is the cache-SAFE half of Anyray's optimization: it runs inside Claude
|
|
5
|
+
* Code (a `PostToolUse` hook) and caps a bulky tool result the moment it's
|
|
6
|
+
* produced — BEFORE it enters the conversation and gets a `cache_control`
|
|
7
|
+
* prefix. Trimming here keeps the cached prefix coherent (the trimmed text is
|
|
8
|
+
* what gets cached and re-sent every later turn), unlike a gateway rewrite that
|
|
9
|
+
* mutates already-cached content and busts Anthropic's prefix cache.
|
|
10
|
+
*
|
|
11
|
+
* The trim is lossy-but-bounded by design: we keep the head (orientation) and
|
|
12
|
+
* the tail (the result/conclusion — where the signal usually is for logs, shell
|
|
13
|
+
* output, and search dumps) and elide the middle behind a CONTENT-FREE marker.
|
|
14
|
+
* No network, no model call, no stash — a `connect` hook can't reach the
|
|
15
|
+
* gateway's `/v1/retrieve`, so this trades reversibility for cache-safety and
|
|
16
|
+
* zero data exposure. Char-based (a ~4 chars/token heuristic) to stay
|
|
17
|
+
* dependency-free and fast on the hot path.
|
|
18
|
+
*
|
|
19
|
+
* PRIVACY: nothing here logs or transmits the content; the marker carries only
|
|
20
|
+
* counts. The trimmed text is handed straight back to Claude Code.
|
|
21
|
+
*/
|
|
22
|
+
/** ~4 chars per token — the standard rough heuristic; good enough for a metric. */
|
|
23
|
+
const CHARS_PER_TOKEN = 4;
|
|
24
|
+
export const DEFAULT_TRIM = {
|
|
25
|
+
maxChars: 12_000,
|
|
26
|
+
headChars: 6_000,
|
|
27
|
+
tailChars: 4_000,
|
|
28
|
+
};
|
|
29
|
+
const passthrough = (text) => ({
|
|
30
|
+
text,
|
|
31
|
+
trimmed: false,
|
|
32
|
+
originalChars: text.length,
|
|
33
|
+
trimmedChars: text.length,
|
|
34
|
+
estTokensSaved: 0,
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Trim a single string. Keeps `headChars` + a content-free marker + `tailChars`
|
|
38
|
+
* when the input exceeds `maxChars`; otherwise returns it untouched. Clamps the
|
|
39
|
+
* head/tail budget so the result is always strictly shorter than the original.
|
|
40
|
+
*/
|
|
41
|
+
export const trimText = (input, opts = {}) => {
|
|
42
|
+
if (typeof input !== 'string')
|
|
43
|
+
return passthrough(String(input ?? ''));
|
|
44
|
+
const maxChars = Math.max(1, opts.maxChars ?? DEFAULT_TRIM.maxChars);
|
|
45
|
+
if (input.length <= maxChars)
|
|
46
|
+
return passthrough(input);
|
|
47
|
+
let headChars = Math.max(0, opts.headChars ?? DEFAULT_TRIM.headChars);
|
|
48
|
+
let tailChars = Math.max(0, opts.tailChars ?? DEFAULT_TRIM.tailChars);
|
|
49
|
+
// Never keep so much that we fail to shrink: cap the kept budget under maxChars
|
|
50
|
+
// (leave room for the marker), preferring to shave the head first.
|
|
51
|
+
const keepBudget = maxChars - 1;
|
|
52
|
+
if (headChars + tailChars > keepBudget) {
|
|
53
|
+
tailChars = Math.min(tailChars, keepBudget);
|
|
54
|
+
headChars = Math.max(0, keepBudget - tailChars);
|
|
55
|
+
}
|
|
56
|
+
const head = input.slice(0, headChars);
|
|
57
|
+
const tail = tailChars > 0 ? input.slice(input.length - tailChars) : '';
|
|
58
|
+
const elided = input.length - head.length - tail.length;
|
|
59
|
+
const estTokensSaved = Math.round(elided / CHARS_PER_TOKEN);
|
|
60
|
+
const marker = `\n\n…[anyray-hook trimmed ${elided} chars (~${estTokensSaved} tokens) — full output elided locally, cache-safe]…\n\n`;
|
|
61
|
+
const text = head + marker + tail;
|
|
62
|
+
// Degenerate guard: if the marker made it longer (tiny maxChars), don't trim.
|
|
63
|
+
if (text.length >= input.length)
|
|
64
|
+
return passthrough(input);
|
|
65
|
+
return {
|
|
66
|
+
text,
|
|
67
|
+
trimmed: true,
|
|
68
|
+
originalChars: input.length,
|
|
69
|
+
trimmedChars: text.length,
|
|
70
|
+
estTokensSaved,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/** Keys whose string value is treated as the trimmable body of a tool output. */
|
|
74
|
+
const BODY_KEYS = ['stdout', 'content', 'output', 'text', 'result'];
|
|
75
|
+
/**
|
|
76
|
+
* Locate the trimmable text inside a tool output whose shape varies by tool
|
|
77
|
+
* (Bash `{stdout,stderr,exit_code}`, Read `{content}`, a bare string for some
|
|
78
|
+
* tools/MCP, …). Returns the body string plus a `rebuild` that puts a
|
|
79
|
+
* (possibly optimized) string back in the SAME field, preserving the structure
|
|
80
|
+
* Claude Code expects. Defensive about field names: first known body key, else
|
|
81
|
+
* the longest string-valued field. Returns null when there's nothing to trim.
|
|
82
|
+
*/
|
|
83
|
+
export const extractToolOutputBody = (output) => {
|
|
84
|
+
if (typeof output === 'string') {
|
|
85
|
+
return { body: output, rebuild: (s) => s };
|
|
86
|
+
}
|
|
87
|
+
if (!output || typeof output !== 'object' || Array.isArray(output)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const obj = output;
|
|
91
|
+
let key = BODY_KEYS.find((k) => typeof obj[k] === 'string');
|
|
92
|
+
if (!key) {
|
|
93
|
+
let bestLen = -1;
|
|
94
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
95
|
+
if (typeof v === 'string' && v.length > bestLen) {
|
|
96
|
+
key = k;
|
|
97
|
+
bestLen = v.length;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!key)
|
|
102
|
+
return null;
|
|
103
|
+
const field = key;
|
|
104
|
+
return { body: obj[field], rebuild: (s) => ({ ...obj, [field]: s }) };
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Trim the body of a tool output locally (the fail-open fallback when the
|
|
108
|
+
* gateway/optimizer is unreachable — the smart strategies run server-side, see
|
|
109
|
+
* commands/hook.ts). Returns the rebuilt value plus the trim metrics.
|
|
110
|
+
*/
|
|
111
|
+
export const trimToolOutput = (output, opts = {}) => {
|
|
112
|
+
const found = extractToolOutputBody(output);
|
|
113
|
+
if (!found)
|
|
114
|
+
return { value: output, result: passthrough('') };
|
|
115
|
+
const result = trimText(found.body, opts);
|
|
116
|
+
if (!result.trimmed)
|
|
117
|
+
return { value: output, result };
|
|
118
|
+
return { value: found.rebuild(result.text), result };
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=trimOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimOutput.js","sourceRoot":"","sources":["../../src/util/trimOutput.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAsBH,mFAAmF;AACnF,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,YAAY,GAA0B;IACjD,QAAQ,EAAE,MAAM;IAChB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IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACtD,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;AACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-apply smoke test — confirm the connection actually works, with the same
|
|
3
|
+
* shape of request the configured tool will send, and turn any failure into one
|
|
4
|
+
* specific next step instead of a cryptic 4xx on the dev's first real request.
|
|
5
|
+
*
|
|
6
|
+
* Two paths, because the two modes authenticate differently:
|
|
7
|
+
* - org key (placeholder): the gateway key is the bearer; we probe the
|
|
8
|
+
* OpenAI-compatible `/v1/chat/completions`. A 2xx means the gateway accepted
|
|
9
|
+
* the key and routed upstream end-to-end.
|
|
10
|
+
* - seat (subscription): the seat OAuth token lives in the *tool*, not connect,
|
|
11
|
+
* so we DON'T need (or want) the secret. We send a sentinel bearer with the
|
|
12
|
+
* pass-through headers to `/v1/messages` and read where it lands: if the
|
|
13
|
+
* gateway forwards it to Anthropic (which rejects the sentinel as an invalid
|
|
14
|
+
* bearer), pass-through is wired and the dev's real seat will work; if it
|
|
15
|
+
* comes back a Bedrock/org-provider error, pass-through ISN'T honored. This
|
|
16
|
+
* verifies the part connect owns — the gateway routing — without a keychain
|
|
17
|
+
* prompt and without ever false-alarming on a stale token (the tool itself
|
|
18
|
+
* tells the dev to re-`/login` if their seat lapsed).
|
|
19
|
+
*
|
|
20
|
+
* PRIVACY: probe bodies are fixed synthetic "ping"s — no user content; the
|
|
21
|
+
* sentinel is a literal non-secret string. Responses are read only to classify
|
|
22
|
+
* status + error type, never logged as content.
|
|
23
|
+
*/
|
|
24
|
+
import { effectiveSubscription, metadataHeaderValue } from '../types.js';
|
|
25
|
+
const VERIFY_TIMEOUT_MS = 12_000;
|
|
26
|
+
/** A deliberately-invalid bearer for the seat-wiring probe. Not a secret; its
|
|
27
|
+
* only job is to be rejected by whatever upstream the gateway forwards it to,
|
|
28
|
+
* so we can tell Anthropic-passthrough from org-provider routing. */
|
|
29
|
+
const WIRING_SENTINEL = 'anyray-wiring-probe-not-a-real-token';
|
|
30
|
+
/** Smallest valid OpenAI-style body; `anyray-default` lets gateway routing pick
|
|
31
|
+
* the real model/provider. `max_tokens: 1` keeps the probe a fraction of a cent. */
|
|
32
|
+
const PLACEHOLDER_PROBE_BODY = {
|
|
33
|
+
model: 'anyray-default',
|
|
34
|
+
messages: [{ role: 'user', content: 'ping' }],
|
|
35
|
+
max_tokens: 1,
|
|
36
|
+
};
|
|
37
|
+
/** Smallest valid Anthropic-style body for the seat-wiring probe. */
|
|
38
|
+
const WIRING_PROBE_BODY = {
|
|
39
|
+
model: 'claude-3-5-haiku-20241022',
|
|
40
|
+
max_tokens: 1,
|
|
41
|
+
messages: [{ role: 'user', content: 'ping' }],
|
|
42
|
+
};
|
|
43
|
+
/** A short, content-free snippet of an error body for the status line. */
|
|
44
|
+
const snippet = (bodyText) => {
|
|
45
|
+
const oneLine = bodyText.replace(/\s+/g, ' ').trim();
|
|
46
|
+
return oneLine.length > 160 ? `${oneLine.slice(0, 157)}…` : oneLine;
|
|
47
|
+
};
|
|
48
|
+
/** True when the body looks like the org's Bedrock path answered instead of the
|
|
49
|
+
* intended provider — the tell that pass-through didn't happen. */
|
|
50
|
+
const looksLikeOrgProvider = (bodyText) => {
|
|
51
|
+
const lower = bodyText.toLowerCase();
|
|
52
|
+
return lower.includes('bedrock') || lower.includes('unsupported model');
|
|
53
|
+
};
|
|
54
|
+
/** Classify the org-key probe (OpenAI-compatible completion). */
|
|
55
|
+
export const classifyPlaceholder = (status, bodyText) => {
|
|
56
|
+
if (status >= 200 && status < 300) {
|
|
57
|
+
return {
|
|
58
|
+
kind: 'ok',
|
|
59
|
+
detail: 'gateway served a completion with the org key — traffic flows.',
|
|
60
|
+
remedy: [],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (status === 401 || status === 403) {
|
|
64
|
+
if (looksLikeOrgProvider(bodyText)) {
|
|
65
|
+
return {
|
|
66
|
+
kind: 'routed-elsewhere',
|
|
67
|
+
detail: `gateway routed to the org provider and it rejected the request: ${snippet(bodyText)}`,
|
|
68
|
+
remedy: [
|
|
69
|
+
'The org provider rejected the request — check the gateway’s provider',
|
|
70
|
+
'key/config (e.g. the model is enabled for that account).',
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
kind: 'key-rejected',
|
|
76
|
+
detail: `gateway rejected the key (HTTP ${status}).`,
|
|
77
|
+
remedy: [
|
|
78
|
+
'The key was refused — the setup link may be expired; ask your admin for a fresh one.',
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
kind: 'unknown',
|
|
84
|
+
detail: `gateway responded HTTP ${status}: ${snippet(bodyText)}`,
|
|
85
|
+
remedy: [],
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
/** Classify the seat-wiring probe (sentinel bearer through the gateway). */
|
|
89
|
+
export const classifySeatWiring = (status, bodyText) => {
|
|
90
|
+
if (looksLikeOrgProvider(bodyText)) {
|
|
91
|
+
return {
|
|
92
|
+
kind: 'routed-elsewhere',
|
|
93
|
+
detail: 'gateway sent the request to the org provider, not your subscription.',
|
|
94
|
+
remedy: [
|
|
95
|
+
'Pass-through isn’t being honored for this gateway — your seat token would',
|
|
96
|
+
'not be used. Check the gateway is current (subscription pass-through support).',
|
|
97
|
+
],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const lower = bodyText.toLowerCase();
|
|
101
|
+
// The sentinel reaching Anthropic and being rejected as a bad bearer is the
|
|
102
|
+
// SUCCESS signal: it proves the gateway forwards seat auth to Anthropic, so
|
|
103
|
+
// the dev's real (valid) seat token will be honored.
|
|
104
|
+
if (status === 401 ||
|
|
105
|
+
lower.includes('authentication_error') ||
|
|
106
|
+
lower.includes('invalid bearer') ||
|
|
107
|
+
lower.includes('"provider":"anthropic"')) {
|
|
108
|
+
return {
|
|
109
|
+
kind: 'ok',
|
|
110
|
+
detail: 'gateway passes your sign-in through to Anthropic — your Claude seat will be used.',
|
|
111
|
+
remedy: [],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (status >= 200 && status < 300) {
|
|
115
|
+
return {
|
|
116
|
+
kind: 'ok',
|
|
117
|
+
detail: 'gateway pass-through reached the provider — your seat will be used.',
|
|
118
|
+
remedy: [],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
kind: 'unknown',
|
|
123
|
+
detail: `seat-wiring probe got HTTP ${status}: ${snippet(bodyText)}`,
|
|
124
|
+
remedy: [],
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
const probe = async (url, headers, body, timeoutMs) => {
|
|
128
|
+
const controller = new AbortController();
|
|
129
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
130
|
+
try {
|
|
131
|
+
const res = await fetch(url, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: { 'content-type': 'application/json', ...headers },
|
|
134
|
+
body: JSON.stringify(body),
|
|
135
|
+
signal: controller.signal,
|
|
136
|
+
});
|
|
137
|
+
return { status: res.status, bodyText: await res.text() };
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
clearTimeout(timer);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const unreachable = (timeoutMs, error) => {
|
|
144
|
+
const reason = error instanceof Error && error.name === 'AbortError'
|
|
145
|
+
? `no response within ${timeoutMs}ms`
|
|
146
|
+
: error instanceof Error
|
|
147
|
+
? error.message
|
|
148
|
+
: String(error);
|
|
149
|
+
return {
|
|
150
|
+
kind: 'unreachable',
|
|
151
|
+
detail: `could not reach the gateway to verify (${reason}).`,
|
|
152
|
+
remedy: [
|
|
153
|
+
'Your config was still written — re-run the curl below once the gateway is reachable.',
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Probe the gateway with the auth the Anthropic-family tool will use and return
|
|
159
|
+
* a classified verdict. Never throws — a transport failure becomes `unreachable`
|
|
160
|
+
* (the config was still written; the dev can re-test by hand). Anthropic is the
|
|
161
|
+
* representative family: its org path and its seat-passthrough path are exactly
|
|
162
|
+
* what this smoke test distinguishes.
|
|
163
|
+
*/
|
|
164
|
+
export const verifyConnection = async (target, opts = {}) => {
|
|
165
|
+
const timeoutMs = opts.timeoutMs ?? VERIFY_TIMEOUT_MS;
|
|
166
|
+
const meta = metadataHeaderValue(target.metadata);
|
|
167
|
+
try {
|
|
168
|
+
if (effectiveSubscription(target, 'anthropic')) {
|
|
169
|
+
const headers = {
|
|
170
|
+
Authorization: `Bearer ${WIRING_SENTINEL}`,
|
|
171
|
+
'anthropic-version': '2023-06-01',
|
|
172
|
+
'anthropic-beta': 'oauth-2025-04-20',
|
|
173
|
+
'x-anyray-auth-mode': 'passthrough',
|
|
174
|
+
'x-anyray-provider': 'anthropic',
|
|
175
|
+
};
|
|
176
|
+
if (meta)
|
|
177
|
+
headers['x-anyray-metadata'] = meta;
|
|
178
|
+
const { status, bodyText } = await probe(`${target.anthropicBaseUrl}/v1/messages`, headers, WIRING_PROBE_BODY, timeoutMs);
|
|
179
|
+
return classifySeatWiring(status, bodyText);
|
|
180
|
+
}
|
|
181
|
+
const key = target.clientKey ?? target.placeholderKey;
|
|
182
|
+
const headers = { Authorization: `Bearer ${key}` };
|
|
183
|
+
if (meta)
|
|
184
|
+
headers['x-anyray-metadata'] = meta;
|
|
185
|
+
const { status, bodyText } = await probe(`${target.openaiBaseUrl}/chat/completions`, headers, PLACEHOLDER_PROBE_BODY, timeoutMs);
|
|
186
|
+
return classifyPlaceholder(status, bodyText);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return unreachable(timeoutMs, error);
|
|
190
|
+
}
|
|
191
|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GAAG,MAAM,CAAC,gBAAgB,cAAc,EACxC,OAAO,EACP,iBAAiB,EACjB,SAAS,CACV,CAAC;YACF,OAAO,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC9C,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC;QACtD,MAAM,OAAO,GAA2B,EAAE,aAAa,EAAE,UAAU,GAAG,EAAE,EAAE,CAAC;QAC3E,IAAI,IAAI;YAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI,CAAC;QAC9C,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,KAAK,CACtC,GAAG,MAAM,CAAC,aAAa,mBAAmB,EAC1C,OAAO,EACP,sBAAsB,EACtB,SAAS,CACV,CAAC;QACF,OAAO,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "anyray-connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Anyray connect — points local coding tools (Claude Code, Cursor, Windsurf, SDKs) at the Anyray gateway by writing their base URL + a placeholder key. The gateway stays the brain; this is just the on-ramp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|