@cortexkit/opencode-anthropic-auth 1.23.0 → 2.0.1
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 +239 -195
- package/dist/cli-failure.d.ts +69 -0
- package/dist/cli.d.ts +14 -9
- package/dist/cli.js +103 -80
- package/dist/custody-dimensions.d.ts +7 -24
- package/dist/custody-mode.d.ts +29 -169
- package/dist/effort-history.d.ts +6 -1
- package/dist/{index-xzbhzz0a.js → index-04syas8a.js} +2 -2
- package/dist/index-1jkyhgyr.js +2 -0
- package/dist/{index-8y2t4mwz.js → index-2arfb1y3.js} +1 -1
- package/dist/index-3xqv3rw3.js +2 -0
- package/dist/{index-0jfsxyn9.js → index-52r2e1h9.js} +1 -1
- package/dist/index-b3mxpp4w.js +2 -0
- package/dist/index-p4wvcwhh.js +3 -0
- package/dist/{index-1gr8v4fn.js → index-rqync0pc.js} +1 -1
- package/dist/index-ynq181e8.js +42 -0
- package/dist/index-yxtdke11.js +449 -0
- package/dist/index-zdgceztz.js +1 -0
- package/dist/index.js +1 -38
- package/dist/native-command.d.ts +19 -0
- package/dist/rpc/notifications.d.ts +2 -1
- package/dist/rpc/port-file.js +1 -1
- package/dist/rpc/protocol.d.ts +8 -4
- package/dist/rpc/protocol.js +1 -1
- package/dist/rpc/rpc-client.d.ts +2 -0
- package/dist/rpc/rpc-client.js +1 -1
- package/dist/rpc/rpc-dir.js +1 -1
- package/dist/rpc/rpc-server.d.ts +5 -1
- package/dist/setup/command.d.ts +12 -0
- package/dist/setup/command.test.d.ts +1 -0
- package/dist/setup/detect.d.ts +7 -4
- package/dist/setup/host-executable.d.ts +3 -0
- package/dist/setup/native-activation.d.ts +29 -0
- package/dist/setup/native-enrollment.d.ts +26 -0
- package/dist/setup/native-enrollment.test.d.ts +1 -0
- package/dist/setup/native-local.d.ts +20 -0
- package/dist/setup/native-login.d.ts +3 -0
- package/dist/setup/native-paths.d.ts +15 -0
- package/dist/setup/native-paths.test.d.ts +1 -0
- package/dist/setup/paths.d.ts +3 -2
- package/dist/setup/pi.d.ts +14 -4
- package/dist/setup/process-fence.d.ts +7 -1
- package/dist/setup/process-fence.test.d.ts +1 -0
- package/dist/sidebar-state.js +1 -1
- package/dist/tui/command-dialogs.d.ts +5 -0
- package/dist/tui-preferences.js +2 -2
- package/dist/v2/activation.d.ts +7 -0
- package/dist/v2/adapter.d.ts +276 -0
- package/dist/v2/install.d.ts +13 -0
- package/dist/v2/lifecycle.d.ts +8 -0
- package/dist/v2/menu-contract.d.ts +8 -0
- package/dist/v2/menu.d.ts +10 -0
- package/dist/v2/models.d.ts +6 -0
- package/dist/v2/ownership.d.ts +11 -0
- package/dist/v2/prime.d.ts +12 -0
- package/dist/v2/rpc.d.ts +50 -0
- package/dist/v2/server.d.ts +8 -0
- package/dist/v2/server.js +4 -0
- package/dist/v2/setup.d.ts +58 -0
- package/dist/v2/source.d.ts +41 -0
- package/dist/v2/tui.d.ts +13 -0
- package/dist/v2/tui.js +2 -0
- package/dist/v2/wire.d.ts +36 -0
- package/package.json +20 -5
- package/src/rpc/notifications.ts +9 -2
- package/src/rpc/protocol.ts +8 -7
- package/src/rpc/rpc-client.ts +17 -0
- package/src/rpc/rpc-server.ts +20 -3
- package/src/tui/command-dialogs.tsx +264 -0
- package/src/tui/entry.mjs +44 -18
- package/src/tui-compiled/rpc/protocol.ts +8 -7
- package/src/tui-compiled/rpc/rpc-client.ts +17 -0
- package/src/tui-compiled/tui/command-dialogs.tsx +315 -76
- package/src/tui-compiled/tui.tsx +24 -7
- package/src/tui.tsx +37 -9
- package/dist/claustrum-enrollment-registry.d.ts +0 -4
- package/dist/custody-enrollment.d.ts +0 -14
- package/dist/custody-live.d.ts +0 -111
- package/dist/custody-manifest-watcher.d.ts +0 -16
- package/dist/index-1fq7h6yd.js +0 -430
- package/dist/index-797pmamn.js +0 -2
- package/dist/index-a5d6v3ba.js +0 -5
- package/dist/index-n96q8pks.js +0 -2
- package/dist/index-xxhyhp98.js +0 -2
- package/dist/index-z7gfdyv3.js +0 -1
- package/dist/local-login.d.ts +0 -64
- package/dist/logger-kk9vyem9.js +0 -1
- package/dist/setup/claustrum.d.ts +0 -26
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { type ProviderErrorRedactor } from '@cortexkit/anthropic-auth-core';
|
|
2
|
+
declare const STAGE_LABELS: {
|
|
3
|
+
readonly 'setup-activation': 'Vault custody setup';
|
|
4
|
+
readonly 'setup-opencode-config': 'OpenCode configuration';
|
|
5
|
+
readonly 'setup-pi-install': 'Pi extension installation';
|
|
6
|
+
readonly 'setup-pi': 'Pi setup';
|
|
7
|
+
readonly 'setup-process-check': 'Host process check';
|
|
8
|
+
readonly 'cli-setup': 'Setup';
|
|
9
|
+
readonly 'cli-login': 'Login';
|
|
10
|
+
readonly 'cli-api-add': 'API route setup';
|
|
11
|
+
readonly 'cli-list': 'Account listing';
|
|
12
|
+
readonly 'cli-relay-setup': 'Relay setup';
|
|
13
|
+
readonly 'cli-relay-workers-dev': 'Workers.dev enablement';
|
|
14
|
+
readonly 'cli-command': 'Command';
|
|
15
|
+
};
|
|
16
|
+
export type CliFailureStage = keyof typeof STAGE_LABELS;
|
|
17
|
+
/** UTF-8 bytes of redacted detail kept per diagnostics file. */
|
|
18
|
+
export declare const CLI_FAILURE_DETAIL_MAX_BYTES: number;
|
|
19
|
+
export declare const CLI_FAILURE_OMITTED = "[output beyond the diagnostic limit omitted]";
|
|
20
|
+
export declare const CLI_FAILURE_WITHHELD = "[output withheld: no line break within the inspected window]";
|
|
21
|
+
export declare const CLI_FAILURE_SECRETS_UNREADABLE = "[detail withheld: the known credentials could not be read safely]";
|
|
22
|
+
/**
|
|
23
|
+
* The text to show for a known failure, or undefined when the thrown value is
|
|
24
|
+
* not one. A message counts only when it equals a text in CLOSED_MESSAGES,
|
|
25
|
+
* equals "OAuth metadata read failed: <status>" for its own integer HTTP
|
|
26
|
+
* `status`, or equals what `new ProcessFenceViolationError(activeHosts)`
|
|
27
|
+
* produces from its own validated `activeHosts`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function knownFailureMessage(error: unknown): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Exact credentials a failing command may echo: the strings in `submitted`
|
|
32
|
+
* (the API key, OAuth code and tokens, or Cloudflare and relay tokens the CLI
|
|
33
|
+
* command handled) plus every environment value whose name Core's
|
|
34
|
+
* `isSecretKey` treats as secret (for example `*_TOKEN`, `*_API_KEY`,
|
|
35
|
+
* `*_SECRET`), since child processes receive that environment. Empty values are
|
|
36
|
+
* skipped; every other value counts, however short. Returns undefined when
|
|
37
|
+
* either input is a proxy, has accessors or non-string credentials, or is too
|
|
38
|
+
* large to inspect, so the caller can withhold detail instead of logging it
|
|
39
|
+
* with a credential left out.
|
|
40
|
+
*/
|
|
41
|
+
export declare function collectKnownSecrets(env: unknown, submitted?: unknown): string[] | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Redact first, bound second. Raw text is only ever cut at a line break and
|
|
44
|
+
* the partial line is dropped, so a credential is never split before the
|
|
45
|
+
* redactor sees it whole. The redacted lines are then kept up to the byte
|
|
46
|
+
* limit; cutting already-redacted text cannot reveal anything new.
|
|
47
|
+
*/
|
|
48
|
+
export declare function boundRedactedDetail(text: string, redactor: Pick<ProviderErrorRedactor, 'redactText'>, keep: 'head' | 'tail'): string[];
|
|
49
|
+
/**
|
|
50
|
+
* Private per-user directory for failure details:
|
|
51
|
+
* `$XDG_STATE_HOME/cortexkit/anthropic-auth/diagnostics`, falling back to
|
|
52
|
+
* `~/.local/state`, which also holds host enrollment files. Undefined when
|
|
53
|
+
* reading the environment would invoke caller code.
|
|
54
|
+
*/
|
|
55
|
+
export declare function cliDiagnosticsDirectory(env: unknown): string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Screen text for a thrown failure. A known failure is returned word for word
|
|
58
|
+
* and not recorded; anything else is recorded in a private diagnostics file
|
|
59
|
+
* and replaced by a fixed line naming that file. `env` supplies both the
|
|
60
|
+
* secret-named values to scrub and the diagnostics location; `submitted`
|
|
61
|
+
* holds the credentials the failing command handled.
|
|
62
|
+
*/
|
|
63
|
+
export declare function reportThrownFailure(stage: CliFailureStage, error: unknown, env: unknown, submitted?: unknown): Promise<string>;
|
|
64
|
+
/** Screen text for a child process that exited unsuccessfully; its stderr tail goes to the diagnostics file. */
|
|
65
|
+
export declare function reportInstallerFailure(stage: CliFailureStage, result: {
|
|
66
|
+
exitCode: number;
|
|
67
|
+
stderr: string;
|
|
68
|
+
}, env: unknown): Promise<string>;
|
|
69
|
+
export {};
|
package/dist/cli.d.ts
CHANGED
|
@@ -15,29 +15,34 @@ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<
|
|
|
15
15
|
export interface RelaySetupDeps {
|
|
16
16
|
fetchImpl?: FetchLike;
|
|
17
17
|
prompt?: (message: string) => Promise<string>;
|
|
18
|
+
/** Receives each credential this command handles, for redacting failure detail. */
|
|
19
|
+
secrets?: string[];
|
|
20
|
+
/** Prints a non-fatal warning; defaults to console.warn. */
|
|
21
|
+
warn?: (message: string) => void;
|
|
18
22
|
}
|
|
19
23
|
export declare function relaySetup(deps?: RelaySetupDeps): Promise<void>;
|
|
20
24
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* unchanged; tests inject deterministic stubs to exercise the full login flow
|
|
25
|
-
* in-process without a subprocess, real network, or stdin.
|
|
25
|
+
* Tests can supply prompts and OAuth responses without opening a browser.
|
|
26
|
+
* Login stores exchanged tokens in the shared account pool after validating
|
|
27
|
+
* the account identity. It never writes OpenCode's auth.json or old sidecars.
|
|
26
28
|
*/
|
|
27
29
|
export interface LoginDeps {
|
|
28
30
|
prompt?: (message: string) => Promise<string>;
|
|
29
31
|
authorize?: typeof authorize;
|
|
30
32
|
exchange?: typeof exchange;
|
|
33
|
+
/** Receives each credential this command handles, for redacting failure detail. */
|
|
34
|
+
secrets?: string[];
|
|
31
35
|
}
|
|
32
36
|
export declare function login(labelArg?: string, deps?: LoginDeps): Promise<void>;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* full route-add flow in-process without a subprocess or stdin.
|
|
38
|
+
* Tests can supply prompts to check API keys and proxy route settings.
|
|
39
|
+
* New keys go to the shared account pool after migration has committed;
|
|
40
|
+
* OpenCode's auth.json and the old sidecar files remain unchanged.
|
|
38
41
|
*/
|
|
39
42
|
export interface ApiAddDeps {
|
|
40
43
|
prompt?: (message: string) => Promise<string>;
|
|
44
|
+
/** Receives each credential this command handles, for redacting failure detail. */
|
|
45
|
+
secrets?: string[];
|
|
41
46
|
}
|
|
42
47
|
export declare function addApiRoute(labelArg?: string, deps?: ApiAddDeps): Promise<void>;
|
|
43
48
|
import { runSetupCommand } from './setup/command.ts';
|