@arizeai/phoenix-cli 1.8.1 → 1.9.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 +88 -7
- package/build/authFetch.d.ts +24 -0
- package/build/authFetch.d.ts.map +1 -0
- package/build/authFetch.js +44 -0
- package/build/authFetch.js.map +1 -0
- package/build/cli.d.ts.map +1 -1
- package/build/cli.js +2 -1
- package/build/cli.js.map +1 -1
- package/build/client.d.ts +5 -1
- package/build/client.d.ts.map +1 -1
- package/build/client.js +6 -1
- package/build/client.js.map +1 -1
- package/build/commands/annotationConfig.d.ts.map +1 -1
- package/build/commands/annotationConfig.js.map +1 -1
- package/build/commands/{annotationMutationUtils.d.ts → annotationMutations.d.ts} +1 -1
- package/build/commands/annotationMutations.d.ts.map +1 -0
- package/build/commands/{annotationMutationUtils.js → annotationMutations.js} +1 -1
- package/build/commands/annotationMutations.js.map +1 -0
- package/build/commands/api.d.ts.map +1 -1
- package/build/commands/api.js +12 -1
- package/build/commands/api.js.map +1 -1
- package/build/commands/auth.d.ts +5 -2
- package/build/commands/auth.d.ts.map +1 -1
- package/build/commands/auth.js +332 -25
- package/build/commands/auth.js.map +1 -1
- package/build/commands/dataset.d.ts.map +1 -1
- package/build/commands/dataset.js.map +1 -1
- package/build/commands/docs.d.ts +51 -0
- package/build/commands/docs.d.ts.map +1 -1
- package/build/commands/docs.js +86 -37
- package/build/commands/docs.js.map +1 -1
- package/build/commands/experiment.d.ts.map +1 -1
- package/build/commands/experiment.js.map +1 -1
- package/build/commands/fetchSpanAnnotations.d.ts +14 -0
- package/build/commands/fetchSpanAnnotations.d.ts.map +1 -0
- package/build/commands/fetchSpanAnnotations.js +57 -0
- package/build/commands/fetchSpanAnnotations.js.map +1 -0
- package/build/commands/fetchTraceAnnotations.d.ts +14 -0
- package/build/commands/fetchTraceAnnotations.d.ts.map +1 -0
- package/build/commands/fetchTraceAnnotations.js +57 -0
- package/build/commands/fetchTraceAnnotations.js.map +1 -0
- package/build/commands/formatAnnotationMutation.d.ts +1 -1
- package/build/commands/formatAnnotationMutation.d.ts.map +1 -1
- package/build/commands/formatNoteMutation.d.ts +1 -1
- package/build/commands/formatNoteMutation.d.ts.map +1 -1
- package/build/commands/formatSetup.d.ts +56 -0
- package/build/commands/formatSetup.d.ts.map +1 -0
- package/build/commands/formatSetup.js +73 -0
- package/build/commands/formatSetup.js.map +1 -0
- package/build/commands/index.d.ts +4 -3
- package/build/commands/index.d.ts.map +1 -1
- package/build/commands/index.js +4 -3
- package/build/commands/index.js.map +1 -1
- package/build/commands/{noteMutationUtils.d.ts → noteMutations.d.ts} +1 -1
- package/build/commands/noteMutations.d.ts.map +1 -0
- package/build/commands/{noteMutationUtils.js → noteMutations.js} +1 -1
- package/build/commands/noteMutations.js.map +1 -0
- package/build/commands/options.d.ts +248 -0
- package/build/commands/options.d.ts.map +1 -0
- package/build/commands/options.js +16 -0
- package/build/commands/options.js.map +1 -0
- package/build/commands/profile.d.ts.map +1 -1
- package/build/commands/profile.js +3 -11
- package/build/commands/profile.js.map +1 -1
- package/build/commands/project.d.ts.map +1 -1
- package/build/commands/project.js +0 -1
- package/build/commands/project.js.map +1 -1
- package/build/commands/prompt.d.ts.map +1 -1
- package/build/commands/prompt.js.map +1 -1
- package/build/commands/self.d.ts.map +1 -1
- package/build/commands/self.js.map +1 -1
- package/build/commands/session.d.ts.map +1 -1
- package/build/commands/session.js +4 -4
- package/build/commands/session.js.map +1 -1
- package/build/commands/{sessionAnnotationsCommand.d.ts → sessionAnnotations.d.ts} +1 -1
- package/build/commands/sessionAnnotations.d.ts.map +1 -0
- package/build/commands/{sessionAnnotationsCommand.js → sessionAnnotations.js} +1 -1
- package/build/commands/sessionAnnotations.js.map +1 -0
- package/build/commands/setup.d.ts +19 -0
- package/build/commands/setup.d.ts.map +1 -0
- package/build/commands/setup.js +249 -0
- package/build/commands/setup.js.map +1 -0
- package/build/commands/span.d.ts.map +1 -1
- package/build/commands/span.js +5 -5
- package/build/commands/span.js.map +1 -1
- package/build/commands/spanAnnotations.d.ts +6 -13
- package/build/commands/spanAnnotations.d.ts.map +1 -1
- package/build/commands/spanAnnotations.js +154 -47
- package/build/commands/spanAnnotations.js.map +1 -1
- package/build/commands/trace.d.ts.map +1 -1
- package/build/commands/trace.js +6 -6
- package/build/commands/trace.js.map +1 -1
- package/build/commands/traceAnnotations.d.ts +6 -13
- package/build/commands/traceAnnotations.d.ts.map +1 -1
- package/build/commands/traceAnnotations.js +157 -47
- package/build/commands/traceAnnotations.js.map +1 -1
- package/build/config.d.ts +15 -0
- package/build/config.d.ts.map +1 -1
- package/build/config.js +54 -7
- package/build/config.js.map +1 -1
- package/build/curl.d.ts +17 -0
- package/build/curl.d.ts.map +1 -1
- package/build/curl.js.map +1 -1
- package/build/exitCodes.d.ts +6 -0
- package/build/exitCodes.d.ts.map +1 -1
- package/build/exitCodes.js +18 -0
- package/build/exitCodes.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/oauth.d.ts +138 -0
- package/build/oauth.d.ts.map +1 -0
- package/build/oauth.js +465 -0
- package/build/oauth.js.map +1 -0
- package/build/oauthCallbackPage.d.ts +9 -0
- package/build/oauthCallbackPage.d.ts.map +1 -0
- package/build/oauthCallbackPage.js +111 -0
- package/build/oauthCallbackPage.js.map +1 -0
- package/build/optionParsers.d.ts +12 -0
- package/build/optionParsers.d.ts.map +1 -1
- package/build/optionParsers.js +15 -0
- package/build/optionParsers.js.map +1 -1
- package/build/pxi/App.d.ts.map +1 -1
- package/build/pxi/App.js +4 -0
- package/build/pxi/App.js.map +1 -1
- package/build/pxi/client.d.ts.map +1 -1
- package/build/pxi/client.js +11 -2
- package/build/pxi/client.js.map +1 -1
- package/build/pxi/options.d.ts +98 -0
- package/build/pxi/options.d.ts.map +1 -1
- package/build/pxi/options.js.map +1 -1
- package/build/settings.d.ts +19 -0
- package/build/settings.d.ts.map +1 -1
- package/build/settings.js +25 -0
- package/build/settings.js.map +1 -1
- package/build/setup/agents/registry.d.ts +135 -0
- package/build/setup/agents/registry.d.ts.map +1 -0
- package/build/setup/agents/registry.js +174 -0
- package/build/setup/agents/registry.js.map +1 -0
- package/build/setup/copy.d.ts +199 -0
- package/build/setup/copy.d.ts.map +1 -0
- package/build/setup/copy.js +334 -0
- package/build/setup/copy.js.map +1 -0
- package/build/setup/deps/buildDefaultDeps.d.ts +13 -0
- package/build/setup/deps/buildDefaultDeps.d.ts.map +1 -0
- package/build/setup/deps/buildDefaultDeps.js +31 -0
- package/build/setup/deps/buildDefaultDeps.js.map +1 -0
- package/build/setup/deps/clipboard.d.ts +12 -0
- package/build/setup/deps/clipboard.d.ts.map +1 -0
- package/build/setup/deps/clipboard.js +30 -0
- package/build/setup/deps/clipboard.js.map +1 -0
- package/build/setup/deps/clock.d.ts +10 -0
- package/build/setup/deps/clock.d.ts.map +1 -0
- package/build/setup/deps/clock.js +11 -0
- package/build/setup/deps/clock.js.map +1 -0
- package/build/setup/deps/context.d.ts +28 -0
- package/build/setup/deps/context.d.ts.map +1 -0
- package/build/setup/deps/context.js +24 -0
- package/build/setup/deps/context.js.map +1 -0
- package/build/setup/deps/docs.d.ts +41 -0
- package/build/setup/deps/docs.d.ts.map +1 -0
- package/build/setup/deps/docs.js +33 -0
- package/build/setup/deps/docs.js.map +1 -0
- package/build/setup/deps/index.d.ts +46 -0
- package/build/setup/deps/index.d.ts.map +1 -0
- package/build/setup/deps/index.js +16 -0
- package/build/setup/deps/index.js.map +1 -0
- package/build/setup/deps/oauthLogin.d.ts +64 -0
- package/build/setup/deps/oauthLogin.d.ts.map +1 -0
- package/build/setup/deps/oauthLogin.js +82 -0
- package/build/setup/deps/oauthLogin.js.map +1 -0
- package/build/setup/deps/phoenixClient.d.ts +22 -0
- package/build/setup/deps/phoenixClient.d.ts.map +1 -0
- package/build/setup/deps/phoenixClient.js +17 -0
- package/build/setup/deps/phoenixClient.js.map +1 -0
- package/build/setup/deps/processes.d.ts +28 -0
- package/build/setup/deps/processes.d.ts.map +1 -0
- package/build/setup/deps/processes.js +58 -0
- package/build/setup/deps/processes.js.map +1 -0
- package/build/setup/deps/prompter.d.ts +49 -0
- package/build/setup/deps/prompter.d.ts.map +1 -0
- package/build/setup/deps/prompter.js +10 -0
- package/build/setup/deps/prompter.js.map +1 -0
- package/build/setup/errors.d.ts +27 -0
- package/build/setup/errors.d.ts.map +1 -0
- package/build/setup/errors.js +36 -0
- package/build/setup/errors.js.map +1 -0
- package/build/setup/options.d.ts +124 -0
- package/build/setup/options.d.ts.map +1 -0
- package/build/setup/options.js +64 -0
- package/build/setup/options.js.map +1 -0
- package/build/setup/prompts/instrumentationPrompt.d.ts +48 -0
- package/build/setup/prompts/instrumentationPrompt.d.ts.map +1 -0
- package/build/setup/prompts/instrumentationPrompt.js +68 -0
- package/build/setup/prompts/instrumentationPrompt.js.map +1 -0
- package/build/setup/runSetup.d.ts +48 -0
- package/build/setup/runSetup.d.ts.map +1 -0
- package/build/setup/runSetup.js +213 -0
- package/build/setup/runSetup.js.map +1 -0
- package/build/setup/steps/chooseEndpoint.d.ts +36 -0
- package/build/setup/steps/chooseEndpoint.d.ts.map +1 -0
- package/build/setup/steps/chooseEndpoint.js +125 -0
- package/build/setup/steps/chooseEndpoint.js.map +1 -0
- package/build/setup/steps/confirmGitSafety.d.ts +17 -0
- package/build/setup/steps/confirmGitSafety.d.ts.map +1 -0
- package/build/setup/steps/confirmGitSafety.js +73 -0
- package/build/setup/steps/confirmGitSafety.js.map +1 -0
- package/build/setup/steps/establishConnection.d.ts +32 -0
- package/build/setup/steps/establishConnection.d.ts.map +1 -0
- package/build/setup/steps/establishConnection.js +252 -0
- package/build/setup/steps/establishConnection.js.map +1 -0
- package/build/setup/steps/installTooling.d.ts +28 -0
- package/build/setup/steps/installTooling.d.ts.map +1 -0
- package/build/setup/steps/installTooling.js +79 -0
- package/build/setup/steps/installTooling.js.map +1 -0
- package/build/setup/steps/instrumentApp.d.ts +60 -0
- package/build/setup/steps/instrumentApp.d.ts.map +1 -0
- package/build/setup/steps/instrumentApp.js +179 -0
- package/build/setup/steps/instrumentApp.js.map +1 -0
- package/build/setup/steps/offerDocsMcp.d.ts +48 -0
- package/build/setup/steps/offerDocsMcp.d.ts.map +1 -0
- package/build/setup/steps/offerDocsMcp.js +133 -0
- package/build/setup/steps/offerDocsMcp.js.map +1 -0
- package/build/setup/steps/offerPxProfile.d.ts +20 -0
- package/build/setup/steps/offerPxProfile.d.ts.map +1 -0
- package/build/setup/steps/offerPxProfile.js +95 -0
- package/build/setup/steps/offerPxProfile.js.map +1 -0
- package/build/setup/steps/prefetchDocs.d.ts +24 -0
- package/build/setup/steps/prefetchDocs.d.ts.map +1 -0
- package/build/setup/steps/prefetchDocs.js +49 -0
- package/build/setup/steps/prefetchDocs.js.map +1 -0
- package/build/setup/steps/verifyTraces.d.ts +44 -0
- package/build/setup/steps/verifyTraces.d.ts.map +1 -0
- package/build/setup/steps/verifyTraces.js +119 -0
- package/build/setup/steps/verifyTraces.js.map +1 -0
- package/build/setup/steps/writeEnvFile.d.ts +19 -0
- package/build/setup/steps/writeEnvFile.d.ts.map +1 -0
- package/build/setup/steps/writeEnvFile.js +50 -0
- package/build/setup/steps/writeEnvFile.js.map +1 -0
- package/build/setup/ui/clackPrompter.d.ts +11 -0
- package/build/setup/ui/clackPrompter.d.ts.map +1 -0
- package/build/setup/ui/clackPrompter.js +122 -0
- package/build/setup/ui/clackPrompter.js.map +1 -0
- package/build/setup/ui/selectBoolean.d.ts +18 -0
- package/build/setup/ui/selectBoolean.d.ts.map +1 -0
- package/build/setup/ui/selectBoolean.js +14 -0
- package/build/setup/ui/selectBoolean.js.map +1 -0
- package/build/setup/util/gitignoreCoverage.d.ts +24 -0
- package/build/setup/util/gitignoreCoverage.d.ts.map +1 -0
- package/build/setup/util/gitignoreCoverage.js +43 -0
- package/build/setup/util/gitignoreCoverage.js.map +1 -0
- package/build/setup/util/mcpConfig.d.ts +31 -0
- package/build/setup/util/mcpConfig.d.ts.map +1 -0
- package/build/setup/util/mcpConfig.js +62 -0
- package/build/setup/util/mcpConfig.js.map +1 -0
- package/build/setup/util/paths.d.ts +6 -0
- package/build/setup/util/paths.d.ts.map +1 -0
- package/build/setup/util/paths.js +23 -0
- package/build/setup/util/paths.js.map +1 -0
- package/build/setup/util/redact.d.ts +12 -0
- package/build/setup/util/redact.d.ts.map +1 -0
- package/build/setup/util/redact.js +31 -0
- package/build/setup/util/redact.js.map +1 -0
- package/build/validation/endpoint.d.ts +19 -0
- package/build/validation/endpoint.d.ts.map +1 -0
- package/build/validation/endpoint.js +39 -0
- package/build/validation/endpoint.js.map +1 -0
- package/package.json +15 -12
- package/build/commands/annotationMutationUtils.d.ts.map +0 -1
- package/build/commands/annotationMutationUtils.js.map +0 -1
- package/build/commands/noteMutationUtils.d.ts.map +0 -1
- package/build/commands/noteMutationUtils.js.map +0 -1
- package/build/commands/sessionAnnotationsCommand.d.ts.map +0 -1
- package/build/commands/sessionAnnotationsCommand.js.map +0 -1
- package/build/commands/spanAnnotationsCommand.d.ts +0 -7
- package/build/commands/spanAnnotationsCommand.d.ts.map +0 -1
- package/build/commands/spanAnnotationsCommand.js +0 -164
- package/build/commands/spanAnnotationsCommand.js.map +0 -1
- package/build/commands/traceAnnotationsCommand.d.ts +0 -7
- package/build/commands/traceAnnotationsCommand.d.ts.map +0 -1
- package/build/commands/traceAnnotationsCommand.js +0 -167
- package/build/commands/traceAnnotationsCommand.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/setup/deps/docs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,6EAA6E;AAC7E,6EAA6E;AAC7E,6CAA6C;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAqC7D;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAA4B;IAE5B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,iBAAiB,CAAC,MAAM,cAAc,EAAE,EAAE,SAAS,CAAC,CAAC;IACrE,MAAM,SAAS,GAAG,kBAAkB,CAAC;IACrC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE;QACxD,SAAS;QACT,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,eAAe;QAC3C,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IACH,OAAO;QACL,SAAS;QACT,SAAS;QACT,OAAO,EAAE,SAAS,CAAC,MAAM;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,gBAAgB,EAAE,OAAO;QACzB,cAAc,EAAE,UAAU,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC;KAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency seam for setup.
|
|
3
|
+
*
|
|
4
|
+
* Every side effect setup performs — env access, network, subprocesses,
|
|
5
|
+
* clipboard, time — goes through `SetupDeps`. No other module under `setup/`
|
|
6
|
+
* may touch `process.env`, `fetch`, `child_process`, or the clipboard
|
|
7
|
+
* directly. This is what makes setup unit-testable with fakes.
|
|
8
|
+
*
|
|
9
|
+
* Each capability's contract (and, where it is a few lines of system glue,
|
|
10
|
+
* its real implementation) lives in its own module in this directory. This
|
|
11
|
+
* barrel re-exports the contracts so consumers address the seam as one
|
|
12
|
+
* module; it exports types only, so importing it can never form a runtime
|
|
13
|
+
* cycle. The wiring lives in `buildDefaultDeps.ts`.
|
|
14
|
+
*/
|
|
15
|
+
import type { ClipboardWriter } from "./clipboard.js";
|
|
16
|
+
import type { Clock } from "./clock.js";
|
|
17
|
+
import type { RunContext } from "./context.js";
|
|
18
|
+
import type { DocsFetcher } from "./docs.js";
|
|
19
|
+
import type { OAuthLogin } from "./oauthLogin.js";
|
|
20
|
+
import type { PhoenixClientFactory } from "./phoenixClient.js";
|
|
21
|
+
import type { ProcessRunner } from "./processes.js";
|
|
22
|
+
import type { Prompter } from "./prompter.js";
|
|
23
|
+
export interface SetupDeps {
|
|
24
|
+
/** Ambient facts of the run — data steps read, never call. */
|
|
25
|
+
context: RunContext;
|
|
26
|
+
/** Real: clack-backed ui/clackPrompter.ts; tests: scripted answers. */
|
|
27
|
+
prompter: Prompter;
|
|
28
|
+
processes: ProcessRunner;
|
|
29
|
+
clock: Clock;
|
|
30
|
+
writeClipboard: ClipboardWriter;
|
|
31
|
+
/** Typed Phoenix client; tests inject a fake transport beneath it. */
|
|
32
|
+
createClient: PhoenixClientFactory;
|
|
33
|
+
fetchDocs: DocsFetcher;
|
|
34
|
+
/** Browser OAuth login for minting an API key; tests script outcomes. */
|
|
35
|
+
oauthLogin: OAuthLogin;
|
|
36
|
+
}
|
|
37
|
+
export type { ClipboardWriter } from "./clipboard.js";
|
|
38
|
+
export type { Clock } from "./clock.js";
|
|
39
|
+
export type { RunContext } from "./context.js";
|
|
40
|
+
export { unknownWorkflowWarning } from "./docs.js";
|
|
41
|
+
export type { DocsFetcher, DocsPrefetchOptions, DocsPrefetchResult, } from "./docs.js";
|
|
42
|
+
export type { OAuthLogin, OAuthLoginArgs, OAuthLoginOutcome, } from "./oauthLogin.js";
|
|
43
|
+
export type { PhoenixClientArgs, PhoenixClientFactory } from "./phoenixClient.js";
|
|
44
|
+
export type { CommandSpec, ExecResult, ProcessRunner } from "./processes.js";
|
|
45
|
+
export type { Prompter, SelectOption } from "./prompter.js";
|
|
46
|
+
//# sourceMappingURL=index.d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AAiB,GAClB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC1E,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency seam for setup.
|
|
3
|
+
*
|
|
4
|
+
* Every side effect setup performs — env access, network, subprocesses,
|
|
5
|
+
* clipboard, time — goes through `SetupDeps`. No other module under `setup/`
|
|
6
|
+
* may touch `process.env`, `fetch`, `child_process`, or the clipboard
|
|
7
|
+
* directly. This is what makes setup unit-testable with fakes.
|
|
8
|
+
*
|
|
9
|
+
* Each capability's contract (and, where it is a few lines of system glue,
|
|
10
|
+
* its real implementation) lives in its own module in this directory. This
|
|
11
|
+
* barrel re-exports the contracts so consumers address the seam as one
|
|
12
|
+
* module; it exports types only, so importing it can never form a runtime
|
|
13
|
+
* cycle. The wiring lives in `buildDefaultDeps.ts`.
|
|
14
|
+
*/
|
|
15
|
+
export { unknownWorkflowWarning } from "./docs.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/setup/deps/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AA6BH,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser-login capability: an ephemeral OAuth2 Authorization Code +
|
|
3
|
+
* PKCE flow, used by setup to obtain a short-lived access token so it can
|
|
4
|
+
* mint an API key on the user's behalf instead of asking them to paste one.
|
|
5
|
+
*
|
|
6
|
+
* Contract plus the real, system-backed implementation (the flow is system
|
|
7
|
+
* glue: an HTTP callback server, a browser launch, and token exchange —
|
|
8
|
+
* exactly the effects the seam exists to keep out of steps). Tests script
|
|
9
|
+
* outcomes through a fake.
|
|
10
|
+
*/
|
|
11
|
+
export interface OAuthLoginArgs {
|
|
12
|
+
/** Normalized origin, no trailing slash. */
|
|
13
|
+
endpoint: string;
|
|
14
|
+
/**
|
|
15
|
+
* Called with the authorization URL before the browser opens, so the user
|
|
16
|
+
* can complete the login by hand when the launch fails or goes unnoticed.
|
|
17
|
+
*/
|
|
18
|
+
onAuthorizationUrl: (url: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The browser could not be launched (no `xdg-open`, a headless container).
|
|
21
|
+
* The URL was already narrated, so this is a nudge, not a failure.
|
|
22
|
+
*/
|
|
23
|
+
onBrowserOpenFailed: (detail: string) => void;
|
|
24
|
+
/** Abandons an unanswered login, yielding a `cancelled` outcome. */
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
export type OAuthLoginOutcome = {
|
|
28
|
+
status: "success";
|
|
29
|
+
accessToken: string;
|
|
30
|
+
/**
|
|
31
|
+
* End the grant this login just created, once its token has served its
|
|
32
|
+
* purpose. Scoped to that grant alone — an existing `px auth login`
|
|
33
|
+
* session is a separate grant and survives. Best-effort: the tokens
|
|
34
|
+
* expire on their own regardless.
|
|
35
|
+
*/
|
|
36
|
+
revoke: () => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
/** The user declined the consent screen — a choice, not a failure. */
|
|
39
|
+
| {
|
|
40
|
+
status: "cancelled";
|
|
41
|
+
} | {
|
|
42
|
+
status: "error";
|
|
43
|
+
detail: string;
|
|
44
|
+
};
|
|
45
|
+
export interface OAuthLogin {
|
|
46
|
+
/**
|
|
47
|
+
* Whether the instance runs the OAuth2 authorization server. False on any
|
|
48
|
+
* failure — an unreachable or older server simply keeps the paste lane.
|
|
49
|
+
*/
|
|
50
|
+
isSupported(endpoint: string): Promise<boolean>;
|
|
51
|
+
login(args: OAuthLoginArgs): Promise<OAuthLoginOutcome>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `apiUrl` is the hidden `--api-url` dev override. It must reach every hop of
|
|
55
|
+
* the flow: the token this mints is spent against the same override by the
|
|
56
|
+
* client factory, so an authorization server at a different host would issue a
|
|
57
|
+
* token the key-minting server rejects. `fetchImpl` is the same transport seam
|
|
58
|
+
* the Phoenix client takes, so the probe is injectable rather than global.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createSystemOAuthLogin({ apiUrl, fetchImpl, }?: {
|
|
61
|
+
apiUrl?: string;
|
|
62
|
+
fetchImpl?: typeof fetch;
|
|
63
|
+
}): OAuthLogin;
|
|
64
|
+
//# sourceMappingURL=oauthLogin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthLogin.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/oauthLogin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AACH,sEAAsE;GACpE;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAChD,KAAK,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACzD;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,SAAiB,GAClB,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CACrB,GAAG,UAAU,CAsElB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser-login capability: an ephemeral OAuth2 Authorization Code +
|
|
3
|
+
* PKCE flow, used by setup to obtain a short-lived access token so it can
|
|
4
|
+
* mint an API key on the user's behalf instead of asking them to paste one.
|
|
5
|
+
*
|
|
6
|
+
* Contract plus the real, system-backed implementation (the flow is system
|
|
7
|
+
* glue: an HTTP callback server, a browser launch, and token exchange —
|
|
8
|
+
* exactly the effects the seam exists to keep out of steps). Tests script
|
|
9
|
+
* outcomes through a fake.
|
|
10
|
+
*/
|
|
11
|
+
import { OAuthAuthorizationServerMetadataSchema, normalizeEndpoint, revokeOAuthToken, runBrowserLoginFlow, } from "../../oauth.js";
|
|
12
|
+
const SUPPORT_PROBE_TIMEOUT_MS = 5_000;
|
|
13
|
+
/**
|
|
14
|
+
* `apiUrl` is the hidden `--api-url` dev override. It must reach every hop of
|
|
15
|
+
* the flow: the token this mints is spent against the same override by the
|
|
16
|
+
* client factory, so an authorization server at a different host would issue a
|
|
17
|
+
* token the key-minting server rejects. `fetchImpl` is the same transport seam
|
|
18
|
+
* the Phoenix client takes, so the probe is injectable rather than global.
|
|
19
|
+
*/
|
|
20
|
+
export function createSystemOAuthLogin({ apiUrl, fetchImpl = fetch, } = {}) {
|
|
21
|
+
// Resolved once: the probe and the flow must agree on which host they talk
|
|
22
|
+
// to, and two `??` expressions are two chances to disagree.
|
|
23
|
+
const apiOrigin = (endpoint) => apiUrl ?? endpoint;
|
|
24
|
+
return {
|
|
25
|
+
async isSupported(endpoint) {
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetchImpl(new URL(".well-known/oauth-authorization-server", normalizeEndpoint(apiOrigin(endpoint))), { signal: AbortSignal.timeout(SUPPORT_PROBE_TIMEOUT_MS) });
|
|
28
|
+
if (!response.ok) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const document = await response.json();
|
|
32
|
+
return OAuthAuthorizationServerMetadataSchema.safeParse(document)
|
|
33
|
+
.success;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async login({ endpoint, onAuthorizationUrl, onBrowserOpenFailed, signal }) {
|
|
40
|
+
const origin = apiOrigin(endpoint);
|
|
41
|
+
try {
|
|
42
|
+
const result = await runBrowserLoginFlow({
|
|
43
|
+
endpoint: origin,
|
|
44
|
+
onAuthorizationUrl,
|
|
45
|
+
onBrowserOpenFailed: (error) => onBrowserOpenFailed(error instanceof Error ? error.message : String(error)),
|
|
46
|
+
// No pasted-redirect lane here, unlike `px auth login`. It reads a
|
|
47
|
+
// raw readline off stdin, which would both land unannounced in the
|
|
48
|
+
// middle of the clack wizard and — because readline in terminal mode
|
|
49
|
+
// intercepts Ctrl-C itself — kill the interrupt this login promises
|
|
50
|
+
// as its way out. Setup's fallback is pasting an API key, which the
|
|
51
|
+
// prompter asks for properly.
|
|
52
|
+
allowPastedRedirect: false,
|
|
53
|
+
signal,
|
|
54
|
+
});
|
|
55
|
+
if (result.status === "cancelled") {
|
|
56
|
+
return { status: "cancelled" };
|
|
57
|
+
}
|
|
58
|
+
if (result.status === "invalid") {
|
|
59
|
+
return { status: "error", detail: result.message };
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
status: "success",
|
|
63
|
+
accessToken: result.tokens.access_token,
|
|
64
|
+
revoke: () => revokeOAuthToken({
|
|
65
|
+
endpoint: origin,
|
|
66
|
+
refreshToken: result.tokens.refresh_token,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
// Every failure — a loopback port that will not bind, a token endpoint
|
|
72
|
+
// that never answers — is an outcome the wizard falls back from, never
|
|
73
|
+
// an exception that ends setup.
|
|
74
|
+
return {
|
|
75
|
+
status: "error",
|
|
76
|
+
detail: error instanceof Error ? error.message : String(error),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=oauthLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthLogin.js","sourceRoot":"","sources":["../../../src/setup/deps/oauthLogin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,sCAAsC,EACtC,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,aAAa,CAAC;AAErB,MAAM,wBAAwB,GAAG,KAAK,CAAC;AA4CvC;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,EACrC,MAAM,EACN,SAAS,GAAG,KAAK,GAClB,GAGG,EAAE;IACJ,2EAA2E;IAC3E,4DAA4D;IAC5D,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC3D,OAAO;QACL,KAAK,CAAC,WAAW,CAAC,QAAQ;YACxB,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,SAAS,CAC9B,IAAI,GAAG,CACL,wCAAwC,EACxC,iBAAiB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CACvC,EACD,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,wBAAwB,CAAC,EAAE,CAC1D,CAAC;gBACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,OAAO,KAAK,CAAC;gBACf,CAAC;gBACD,MAAM,QAAQ,G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AAC,aAAa;qBAC1C,CAAC;iBACL,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,uEAAuE;gBACvE,uEAAuE;gBACvE,gCAAgC;gBAChC,OAAO;oBACL,MAAM,EAAE,OAAO;oBACf,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC/D,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Phoenix API capability: a factory for typed clients, so steps never
|
|
3
|
+
* construct one from ambient config. Tests inject a fake transport beneath
|
|
4
|
+
* the same real client.
|
|
5
|
+
*/
|
|
6
|
+
import type { PhoenixClient } from "@arizeai/phoenix-client";
|
|
7
|
+
export interface PhoenixClientArgs {
|
|
8
|
+
/** Normalized origin, no trailing slash. */
|
|
9
|
+
endpoint: string;
|
|
10
|
+
/** Omitted for the unauthenticated auth probe. */
|
|
11
|
+
apiKey?: string;
|
|
12
|
+
}
|
|
13
|
+
export type PhoenixClientFactory = (args: PhoenixClientArgs) => PhoenixClient;
|
|
14
|
+
/**
|
|
15
|
+
* `apiUrl` is the hidden `--api-url` dev override: it reroutes setup's own
|
|
16
|
+
* API traffic while user-facing values — hand-off files, px profile, traces
|
|
17
|
+
* URLs — keep the endpoint the user chose.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createPhoenixClientFactory({ apiUrl, }?: {
|
|
20
|
+
apiUrl?: string;
|
|
21
|
+
}): PhoenixClientFactory;
|
|
22
|
+
//# sourceMappingURL=phoenixClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoenixClient.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/phoenixClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,aAAa,CAAC;AAE9E;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;CACZ,GAAG,oBAAoB,CAK5B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Phoenix API capability: a factory for typed clients, so steps never
|
|
3
|
+
* construct one from ambient config. Tests inject a fake transport beneath
|
|
4
|
+
* the same real client.
|
|
5
|
+
*/
|
|
6
|
+
import { createPhoenixClient } from "../../client.js";
|
|
7
|
+
/**
|
|
8
|
+
* `apiUrl` is the hidden `--api-url` dev override: it reroutes setup's own
|
|
9
|
+
* API traffic while user-facing values — hand-off files, px profile, traces
|
|
10
|
+
* URLs — keep the endpoint the user chose.
|
|
11
|
+
*/
|
|
12
|
+
export function createPhoenixClientFactory({ apiUrl, } = {}) {
|
|
13
|
+
return ({ endpoint, apiKey }) => createPhoenixClient({
|
|
14
|
+
config: { endpoint: apiUrl ?? endpoint, apiKey },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=phoenixClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoenixClient.js","sourceRoot":"","sources":["../../../src/setup/deps/phoenixClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAWnD;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,MAAM,GACP,GAEG,EAAE;IACJ,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAC9B,mBAAmB,CAAC;QAClB,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,EAAE;KACjD,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subprocess capability: one-shot probes (git checks, agent detection)
|
|
3
|
+
* and the interactive agent hand-off share these contracts and this runner.
|
|
4
|
+
*/
|
|
5
|
+
export interface CommandSpec {
|
|
6
|
+
command: string;
|
|
7
|
+
args: string[];
|
|
8
|
+
stdin?: string;
|
|
9
|
+
env?: Record<string, string>;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
/** Kill the child and resolve non-zero once this many ms elapse. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ExecResult {
|
|
15
|
+
exitCode: number;
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ProcessRunner {
|
|
20
|
+
/** One-shot subprocess (git, probes). Never throws on non-zero exit. */
|
|
21
|
+
exec(spec: CommandSpec): Promise<ExecResult>;
|
|
22
|
+
/** Interactive subprocess with inherited stdio (agent hand-off). */
|
|
23
|
+
spawnInteractive(spec: CommandSpec): Promise<{
|
|
24
|
+
exitCode: number;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
export declare function createSystemProcessRunner(): ProcessRunner;
|
|
28
|
+
//# sourceMappingURL=processes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,oEAAoE;IACpE,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AAiDD,wBAAgB,yBAAyB,IAAI,aAAa,CAKzD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subprocess capability: one-shot probes (git checks, agent detection)
|
|
3
|
+
* and the interactive agent hand-off share these contracts and this runner.
|
|
4
|
+
*/
|
|
5
|
+
import * as process from "node:process";
|
|
6
|
+
// cross-spawn resolves .cmd/.bat shims on Windows (npm, npx, agent CLIs),
|
|
7
|
+
// where node's bare spawn fails with ENOENT unless given a shell.
|
|
8
|
+
import spawn from "cross-spawn";
|
|
9
|
+
function execOnce(spec) {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
const child = spawn(spec.command, spec.args, {
|
|
12
|
+
cwd: spec.cwd,
|
|
13
|
+
env: spec.env ? { ...process.env, ...spec.env } : process.env,
|
|
14
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
15
|
+
// Kills the child on expiry — a hung probe must not leave an orphaned
|
|
16
|
+
// subprocess behind. Surfaces as a non-zero exit via `close`.
|
|
17
|
+
timeout: spec.timeoutMs,
|
|
18
|
+
});
|
|
19
|
+
let stdout = "";
|
|
20
|
+
let stderr = "";
|
|
21
|
+
child.stdout?.on("data", (chunk) => {
|
|
22
|
+
stdout += chunk.toString("utf-8");
|
|
23
|
+
});
|
|
24
|
+
child.stderr?.on("data", (chunk) => {
|
|
25
|
+
stderr += chunk.toString("utf-8");
|
|
26
|
+
});
|
|
27
|
+
child.on("error", (error) => {
|
|
28
|
+
// Command not found and similar spawn failures surface as a non-zero
|
|
29
|
+
// exit with the message on stderr rather than a throw.
|
|
30
|
+
resolve({ exitCode: 127, stdout, stderr: String(error) });
|
|
31
|
+
});
|
|
32
|
+
child.on("close", (code) => {
|
|
33
|
+
resolve({ exitCode: code ?? 1, stdout, stderr });
|
|
34
|
+
});
|
|
35
|
+
if (spec.stdin !== undefined) {
|
|
36
|
+
child.stdin?.write(spec.stdin);
|
|
37
|
+
}
|
|
38
|
+
child.stdin?.end();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function spawnInteractiveChild(spec) {
|
|
42
|
+
return new Promise((resolve) => {
|
|
43
|
+
const child = spawn(spec.command, spec.args, {
|
|
44
|
+
cwd: spec.cwd,
|
|
45
|
+
env: spec.env ? { ...process.env, ...spec.env } : process.env,
|
|
46
|
+
stdio: "inherit",
|
|
47
|
+
});
|
|
48
|
+
child.on("error", () => resolve({ exitCode: 127 }));
|
|
49
|
+
child.on("close", (code) => resolve({ exitCode: code ?? 1 }));
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function createSystemProcessRunner() {
|
|
53
|
+
return {
|
|
54
|
+
exec: execOnce,
|
|
55
|
+
spawnInteractive: spawnInteractiveChild,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=processes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processes.js","sourceRoot":"","sources":["../../../src/setup/deps/processes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,0EAA0E;AAC1E,kEAAkE;AAClE,OAAO,KAAK,MAAM,aAAa,CAAC;AAyBhC,SAAS,QAAQ,CAAC,IAAiB;IACjC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,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC7B,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAiB;IAG9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE;YAC3C,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG;YAC7D,KAAK,EAAE,SAAS;SACjB,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QACpD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,qBAAqB;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompting capability: every question setup asks — selects, text,
|
|
3
|
+
* masked secrets — and every line it narrates between them.
|
|
4
|
+
*
|
|
5
|
+
* Contract only. The real terminal implementation is `ui/clackPrompter.ts`
|
|
6
|
+
* (kept with the rest of the UI, since rendering rules live there); tests
|
|
7
|
+
* script answers through `scriptedPrompter`.
|
|
8
|
+
*/
|
|
9
|
+
export interface SelectOption<T> {
|
|
10
|
+
value: T;
|
|
11
|
+
label: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
/** Rendered unselectable with the reason appended to the label. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface Prompter {
|
|
17
|
+
/** Throws SetupCancelledError on Ctrl-C / Escape. */
|
|
18
|
+
select<T>(args: {
|
|
19
|
+
message: string;
|
|
20
|
+
options: Array<SelectOption<T>>;
|
|
21
|
+
}): Promise<T>;
|
|
22
|
+
/** Throws SetupCancelledError on Ctrl-C / Escape. */
|
|
23
|
+
textInput(args: {
|
|
24
|
+
message: string;
|
|
25
|
+
defaultValue?: string;
|
|
26
|
+
validate?: (value: string) => string | undefined;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
/** Masked input for secrets. Throws SetupCancelledError on Ctrl-C / Escape. */
|
|
29
|
+
passwordInput(args: {
|
|
30
|
+
message: string;
|
|
31
|
+
validate?: (value: string) => string | undefined;
|
|
32
|
+
}): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Run `work` with a signal that aborts on Ctrl-C rather than raising
|
|
35
|
+
* SetupCancelledError. For the waits that have no prompt on screen to
|
|
36
|
+
* cancel — a browser login, say: this seam owns the terminal, so it owns the
|
|
37
|
+
* signal, and `work` decides what an interruption means.
|
|
38
|
+
*/
|
|
39
|
+
runInterruptible<T>(work: (signal: AbortSignal) => Promise<T>): Promise<T>;
|
|
40
|
+
/** Non-interactive display of a block of text between prompts. */
|
|
41
|
+
note(message: string, title?: string): void;
|
|
42
|
+
/** One-line status/warning between prompts (stderr). */
|
|
43
|
+
line(message: string): void;
|
|
44
|
+
/** Open the setup session frame. */
|
|
45
|
+
intro(message: string): void;
|
|
46
|
+
/** Close the setup session frame. */
|
|
47
|
+
outro(message: string): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=prompter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompter.d.ts","sourceRoot":"","sources":["../../../src/setup/deps/prompter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,qDAAqD;IACrD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;KACjC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACf,qDAAqD;IACrD,SAAS,CAAC,IAAI,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;KAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB,+EAA+E;IAC/E,aAAa,CAAC,IAAI,EAAE;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;KAClD,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpB;;;;;OAKG;IACH,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3E,kEAAkE;IAClE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,wDAAwD;IACxD,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,oCAAoC;IACpC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,qCAAqC;IACrC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompting capability: every question setup asks — selects, text,
|
|
3
|
+
* masked secrets — and every line it narrates between them.
|
|
4
|
+
*
|
|
5
|
+
* Contract only. The real terminal implementation is `ui/clackPrompter.ts`
|
|
6
|
+
* (kept with the rest of the UI, since rendering rules live there); tests
|
|
7
|
+
* script answers through `scriptedPrompter`.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=prompter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompter.js","sourceRoot":"","sources":["../../../src/setup/deps/prompter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed errors for setup.
|
|
3
|
+
*
|
|
4
|
+
* `SetupCancelledError` is thrown by the prompter whenever the user cancels
|
|
5
|
+
* (Ctrl-C / Escape on any prompt) and unwinds the whole of setup to a single
|
|
6
|
+
* catch site in the command handler, which prints the support outro and
|
|
7
|
+
* exits with `ExitCode.CANCELLED`.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SetupCancelledError extends Error {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Thrown when input supplied via flags or environment variables is missing
|
|
14
|
+
* (headless mode) or invalid (any mode). Carries the exact remediation text
|
|
15
|
+
* so the command handler can print it and exit `INVALID_ARGUMENT`.
|
|
16
|
+
*/
|
|
17
|
+
export declare class HeadlessInputError extends Error {
|
|
18
|
+
constructor(message: string);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Thrown when a step fails in a way setup cannot recover from
|
|
22
|
+
* (e.g. headless dirty git tree). Exits `FAILURE`.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SetupFatalError extends Error {
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/setup/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,cAGC;CACF;AAED;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed errors for setup.
|
|
3
|
+
*
|
|
4
|
+
* `SetupCancelledError` is thrown by the prompter whenever the user cancels
|
|
5
|
+
* (Ctrl-C / Escape on any prompt) and unwinds the whole of setup to a single
|
|
6
|
+
* catch site in the command handler, which prints the support outro and
|
|
7
|
+
* exits with `ExitCode.CANCELLED`.
|
|
8
|
+
*/
|
|
9
|
+
export class SetupCancelledError extends Error {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("Setup cancelled by user");
|
|
12
|
+
this.name = "SetupCancelledError";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Thrown when input supplied via flags or environment variables is missing
|
|
17
|
+
* (headless mode) or invalid (any mode). Carries the exact remediation text
|
|
18
|
+
* so the command handler can print it and exit `INVALID_ARGUMENT`.
|
|
19
|
+
*/
|
|
20
|
+
export class HeadlessInputError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "HeadlessInputError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown when a step fails in a way setup cannot recover from
|
|
28
|
+
* (e.g. headless dirty git tree). Exits `FAILURE`.
|
|
29
|
+
*/
|
|
30
|
+
export class SetupFatalError extends Error {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = "SetupFatalError";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/setup/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C;QACE,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAC3C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|