@arizeai/phoenix-cli 1.8.1 → 1.9.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 +34 -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 +2 -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.map +1 -1
- package/build/commands/auth.d.ts +1 -1
- package/build/commands/auth.d.ts.map +1 -1
- package/build/commands/auth.js +6 -12
- 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 +50 -0
- package/build/commands/formatSetup.d.ts.map +1 -0
- package/build/commands/formatSetup.js +64 -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 +245 -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/curl.d.ts +17 -0
- package/build/curl.d.ts.map +1 -1
- package/build/curl.js.map +1 -1
- 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/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.map +1 -1
- package/build/settings.js +4 -0
- package/build/settings.js.map +1 -1
- package/build/setup/agents/registry.d.ts +78 -0
- package/build/setup/agents/registry.d.ts.map +1 -0
- package/build/setup/agents/registry.js +129 -0
- package/build/setup/agents/registry.js.map +1 -0
- package/build/setup/copy.d.ts +167 -0
- package/build/setup/copy.d.ts.map +1 -0
- package/build/setup/copy.js +290 -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 +29 -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 +42 -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/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 +42 -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 +113 -0
- package/build/setup/options.d.ts.map +1 -0
- package/build/setup/options.js +63 -0
- package/build/setup/options.js.map +1 -0
- package/build/setup/prompts/instrumentationPrompt.d.ts +42 -0
- package/build/setup/prompts/instrumentationPrompt.d.ts.map +1 -0
- package/build/setup/prompts/instrumentationPrompt.js +64 -0
- package/build/setup/prompts/instrumentationPrompt.js.map +1 -0
- package/build/setup/runSetup.d.ts +45 -0
- package/build/setup/runSetup.d.ts.map +1 -0
- package/build/setup/runSetup.js +212 -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 +29 -0
- package/build/setup/steps/establishConnection.d.ts.map +1 -0
- package/build/setup/steps/establishConnection.js +143 -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 +41 -0
- package/build/setup/steps/instrumentApp.d.ts.map +1 -0
- package/build/setup/steps/instrumentApp.js +131 -0
- package/build/setup/steps/instrumentApp.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 +107 -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/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,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input resolution for setup.
|
|
3
|
+
*
|
|
4
|
+
* Follows px's `resolveConfig()` precedence — flags, then env, then
|
|
5
|
+
* defaults — additionally accepting `PHOENIX_COLLECTOR_ENDPOINT` and
|
|
6
|
+
* `PHOENIX_PROJECT_NAME` as endpoint/project aliases (#14131). There are no
|
|
7
|
+
* setup-specific env vars. Reads env only through `RunContext.env`.
|
|
8
|
+
*
|
|
9
|
+
* Note the `--no-input` flag (or a non-TTY stdin) — not the presence of env
|
|
10
|
+
* vars — is what opts into headless behavior: an ambient `PHOENIX_API_KEY`
|
|
11
|
+
* in a dev shell never silently short-circuits the interactive flow.
|
|
12
|
+
*/
|
|
13
|
+
import { type CodingAgentId } from "./agents/registry.js";
|
|
14
|
+
import type { DocsPrefetchOptions, RunContext } from "./deps/index.js";
|
|
15
|
+
/**
|
|
16
|
+
* The parsed `px setup` flags, as the command layer hands them over. Every
|
|
17
|
+
* choice setup would prompt for has a field here, which is what lets an
|
|
18
|
+
* unattended caller — CI, or a coding agent — run the same flow a human
|
|
19
|
+
* clicks through. Raw material for {@link resolveSetupInputs}; steps only
|
|
20
|
+
* ever see the resolved {@link SetupInputs}.
|
|
21
|
+
*/
|
|
22
|
+
export interface SetupOptions {
|
|
23
|
+
/** --endpoint: pre-answer the endpoint question */
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
/** --project: name or Relay Global ID */
|
|
26
|
+
project?: string;
|
|
27
|
+
/** --no-input: headless mode (also auto-on when !stdin.isTTY, per px convention) */
|
|
28
|
+
noInput?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Hidden --api-url: base URL for setup's own API calls (dev).
|
|
31
|
+
* User-facing values — hand-off files, px profile, traces URLs — keep the
|
|
32
|
+
* endpoint the user chose.
|
|
33
|
+
*/
|
|
34
|
+
apiUrl?: string;
|
|
35
|
+
/**
|
|
36
|
+
* --agent: pre-answer the instrumentation lane with a coding agent id.
|
|
37
|
+
* Validated against the registry at the command layer. Headless
|
|
38
|
+
* instrumentation requires it — there is no prompt to fall back to.
|
|
39
|
+
*/
|
|
40
|
+
agent?: CodingAgentId;
|
|
41
|
+
/**
|
|
42
|
+
* --language: languages to instrument. Passed to the agent so it skips its
|
|
43
|
+
* own detection; empty means "detect it yourself".
|
|
44
|
+
*/
|
|
45
|
+
languages?: string[];
|
|
46
|
+
/**
|
|
47
|
+
* --instrument / --no-instrument: run the instrumentation hand-off.
|
|
48
|
+
* Undefined means "decide by lane" — interactive asks, headless skips
|
|
49
|
+
* (registration-only stays the default for an unattended run, so `px setup
|
|
50
|
+
* --no-input` in CI never edits source that nobody asked it to touch).
|
|
51
|
+
*/
|
|
52
|
+
instrument?: boolean;
|
|
53
|
+
/** --skills / --no-skills: offer the coding-agent skills install. */
|
|
54
|
+
skills?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* --yolo: let the agent run without its own permission prompts. Required in
|
|
57
|
+
* practice for a background run, which has no terminal to approve on.
|
|
58
|
+
*/
|
|
59
|
+
bypassPermissions?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* --background: run the agent to completion without its TUI. Implied when
|
|
62
|
+
* setup itself is headless — there is no terminal to hand over.
|
|
63
|
+
*/
|
|
64
|
+
background?: boolean;
|
|
65
|
+
/** Docs prefetch, so the agent instruments against local docs. */
|
|
66
|
+
docs?: DocsPrefetchOptions;
|
|
67
|
+
}
|
|
68
|
+
export interface SetupInputs {
|
|
69
|
+
/** Pre-answered endpoint (flag, else env), if any. */
|
|
70
|
+
endpoint?: string;
|
|
71
|
+
/** Pre-answered project name or Relay Global ID (flag, else env), if any. */
|
|
72
|
+
project?: string;
|
|
73
|
+
/** API key from env — used by the headless auth-on lane only. */
|
|
74
|
+
apiKey?: string;
|
|
75
|
+
/** True when --no-input was passed or stdin is not a TTY. */
|
|
76
|
+
headless: boolean;
|
|
77
|
+
/** Pre-answered instrumentation lane, if `--agent` named one. */
|
|
78
|
+
agent?: CodingAgentId;
|
|
79
|
+
/** Languages to instrument; empty means the agent detects them itself. */
|
|
80
|
+
languages: string[];
|
|
81
|
+
/**
|
|
82
|
+
* Whether to run the instrumentation hand-off. Interactive defaults to
|
|
83
|
+
* true (it is the point of setup); headless defaults to false, so an
|
|
84
|
+
* unattended run registers without ever editing source unless asked.
|
|
85
|
+
*/
|
|
86
|
+
instrument: boolean;
|
|
87
|
+
/** Whether to offer/install the coding-agent skills; undefined means ask. */
|
|
88
|
+
skills?: boolean;
|
|
89
|
+
/** Run the agent without its TUI. Always true when setup is headless. */
|
|
90
|
+
background: boolean;
|
|
91
|
+
/** Run the agent without its own permission prompts (`--yolo`). */
|
|
92
|
+
bypassPermissions: boolean;
|
|
93
|
+
/** Docs prefetch; only consulted when `instrument` is true. */
|
|
94
|
+
docs: DocsPrefetchOptions;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A headless run that instruments must name its agent: there is no prompt to
|
|
98
|
+
* pick a lane from, and silently falling back to one would be a coin flip over
|
|
99
|
+
* which agent edits the caller's source.
|
|
100
|
+
*
|
|
101
|
+
* `px setup instrument` calls this directly — its lane is instrumentation by
|
|
102
|
+
* definition, so it never passes `--instrument` for `resolveSetupInputs` to
|
|
103
|
+
* catch.
|
|
104
|
+
*/
|
|
105
|
+
export declare function assertAgentForHeadlessInstrument({ headless, agent, }: {
|
|
106
|
+
headless: boolean;
|
|
107
|
+
agent?: CodingAgentId;
|
|
108
|
+
}): void;
|
|
109
|
+
export declare function resolveSetupInputs({ options, context, }: {
|
|
110
|
+
options: SetupOptions;
|
|
111
|
+
context: Pick<RunContext, "env" | "stdinIsTTY">;
|
|
112
|
+
}): SetupInputs;
|
|
113
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/setup/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEzE,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG9D;;;;;;GAMG;AACH,MAAM,WAAW,YAAY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ACD,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,GAAG,IAAI,CAIP;AAED,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,YAAY,CAAC,CAAC;CACjD,GAAG,WAAW,CAqCd"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input resolution for setup.
|
|
3
|
+
*
|
|
4
|
+
* Follows px's `resolveConfig()` precedence — flags, then env, then
|
|
5
|
+
* defaults — additionally accepting `PHOENIX_COLLECTOR_ENDPOINT` and
|
|
6
|
+
* `PHOENIX_PROJECT_NAME` as endpoint/project aliases (#14131). There are no
|
|
7
|
+
* setup-specific env vars. Reads env only through `RunContext.env`.
|
|
8
|
+
*
|
|
9
|
+
* Note the `--no-input` flag (or a non-TTY stdin) — not the presence of env
|
|
10
|
+
* vars — is what opts into headless behavior: an ambient `PHOENIX_API_KEY`
|
|
11
|
+
* in a dev shell never silently short-circuits the interactive flow.
|
|
12
|
+
*/
|
|
13
|
+
import { CODING_AGENT_IDS } from "./agents/registry.js";
|
|
14
|
+
import * as COPY from "./copy.js";
|
|
15
|
+
import { HeadlessInputError } from "./errors.js";
|
|
16
|
+
/**
|
|
17
|
+
* A headless run that instruments must name its agent: there is no prompt to
|
|
18
|
+
* pick a lane from, and silently falling back to one would be a coin flip over
|
|
19
|
+
* which agent edits the caller's source.
|
|
20
|
+
*
|
|
21
|
+
* `px setup instrument` calls this directly — its lane is instrumentation by
|
|
22
|
+
* definition, so it never passes `--instrument` for `resolveSetupInputs` to
|
|
23
|
+
* catch.
|
|
24
|
+
*/
|
|
25
|
+
export function assertAgentForHeadlessInstrument({ headless, agent, }) {
|
|
26
|
+
if (headless && agent === undefined) {
|
|
27
|
+
throw new HeadlessInputError(COPY.HEADLESS.agentRequired(CODING_AGENT_IDS));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function resolveSetupInputs({ options, context, }) {
|
|
31
|
+
const { env } = context;
|
|
32
|
+
const endpoint = options.endpoint ??
|
|
33
|
+
env.PHOENIX_HOST ??
|
|
34
|
+
env.PHOENIX_COLLECTOR_ENDPOINT ??
|
|
35
|
+
undefined;
|
|
36
|
+
const project = options.project ??
|
|
37
|
+
env.PHOENIX_PROJECT ??
|
|
38
|
+
env.PHOENIX_PROJECT_NAME ??
|
|
39
|
+
undefined;
|
|
40
|
+
const apiKey = env.PHOENIX_API_KEY ?? undefined;
|
|
41
|
+
const headless = Boolean(options.noInput) || !context.stdinIsTTY;
|
|
42
|
+
// Interactive setup exists to instrument; an unattended run does not
|
|
43
|
+
// touch source unless the caller asked for it by name.
|
|
44
|
+
const instrument = options.instrument ?? !headless;
|
|
45
|
+
if (instrument) {
|
|
46
|
+
assertAgentForHeadlessInstrument({ headless, agent: options.agent });
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
endpoint: endpoint?.trim() || undefined,
|
|
50
|
+
project: project?.trim() || undefined,
|
|
51
|
+
apiKey: apiKey?.trim() || undefined,
|
|
52
|
+
headless,
|
|
53
|
+
agent: options.agent,
|
|
54
|
+
languages: options.languages ?? [],
|
|
55
|
+
instrument,
|
|
56
|
+
skills: options.skills,
|
|
57
|
+
// A headless run has no terminal to hand to the agent's TUI.
|
|
58
|
+
background: options.background ?? headless,
|
|
59
|
+
bypassPermissions: Boolean(options.bypassPermissions),
|
|
60
|
+
docs: options.docs ?? { enabled: true },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/setup/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAsB,MAAM,mBAAmB,CAAC;AACzE,OAA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S;QACnC,QAAQ;QACR,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,EAAE;QAClC,UAAU;QACV,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,6DAA6D;QAC7D,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ;QAC1C,iBAAiB,EAAE,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC;QACrD,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE;KACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The instrumentation prompt handed to a coding agent.
|
|
3
|
+
*
|
|
4
|
+
* One shared template serves the launched-agent and copy-to-clipboard lanes.
|
|
5
|
+
* Every rule is load-bearing — do not trim a rule without replacing the
|
|
6
|
+
* protection it provides. The prompt leans
|
|
7
|
+
* on the docs for package names and APIs (language-scoped quickstarts plus
|
|
8
|
+
* the integrations index) rather than inlining instructions that go stale.
|
|
9
|
+
* Setup independently verifies traces against the Phoenix API after the
|
|
10
|
+
* agent finishes, so the agent's job ends with an emitted trace, not a
|
|
11
|
+
* self-report.
|
|
12
|
+
*/
|
|
13
|
+
export interface InstrumentationPromptDocs {
|
|
14
|
+
/** Python quickstart (arize-phoenix-otel). */
|
|
15
|
+
quickstartPython: string;
|
|
16
|
+
/** TypeScript quickstart (@arizeai/phoenix-otel). */
|
|
17
|
+
quickstartTypeScript: string;
|
|
18
|
+
/** phoenix.otel register() reference. */
|
|
19
|
+
phoenixOtelSetup: string;
|
|
20
|
+
/** Per-framework/provider auto-instrumentation guides. */
|
|
21
|
+
integrationsIndex: string;
|
|
22
|
+
}
|
|
23
|
+
export interface InstrumentationPromptArgs {
|
|
24
|
+
projectName: string;
|
|
25
|
+
endpoint: string;
|
|
26
|
+
isDefaultEndpoint: boolean;
|
|
27
|
+
docs: InstrumentationPromptDocs;
|
|
28
|
+
tracesUrl: string;
|
|
29
|
+
authEnabled: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* `--language` values. Non-empty replaces the agent's own language
|
|
32
|
+
* detection, which is the slowest and least reliable thing it does.
|
|
33
|
+
*/
|
|
34
|
+
languages?: string[];
|
|
35
|
+
/**
|
|
36
|
+
* Directory the docs prefetch wrote, when it ran. The agent reads those
|
|
37
|
+
* pages from disk instead of fetching the URLs mid-run.
|
|
38
|
+
*/
|
|
39
|
+
localDocsDir?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function buildInstrumentationPrompt({ projectName, endpoint, isDefaultEndpoint, docs, tracesUrl, authEnabled, languages, localDocsDir, }: InstrumentationPromptArgs): string;
|
|
42
|
+
//# sourceMappingURL=instrumentationPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentationPrompt.d.ts","sourceRoot":"","sources":["../../../src/setup/prompts/instrumentationPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,yBAAyB;IACxC,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,gBAAgB,EAAE,MAAM,CAAC;IACzB,0DAA0D;IAC1D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,IAAI,EAAE,yBAAyB,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,SAAc,EACd,YAAY,GACb,EAAE,yBAAyB,GAAG,MAAM,CAoDpC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The instrumentation prompt handed to a coding agent.
|
|
3
|
+
*
|
|
4
|
+
* One shared template serves the launched-agent and copy-to-clipboard lanes.
|
|
5
|
+
* Every rule is load-bearing — do not trim a rule without replacing the
|
|
6
|
+
* protection it provides. The prompt leans
|
|
7
|
+
* on the docs for package names and APIs (language-scoped quickstarts plus
|
|
8
|
+
* the integrations index) rather than inlining instructions that go stale.
|
|
9
|
+
* Setup independently verifies traces against the Phoenix API after the
|
|
10
|
+
* agent finishes, so the agent's job ends with an emitted trace, not a
|
|
11
|
+
* self-report.
|
|
12
|
+
*/
|
|
13
|
+
export function buildInstrumentationPrompt({ projectName, endpoint, isDefaultEndpoint, docs, tracesUrl, authEnabled, languages = [], localDocsDir, }) {
|
|
14
|
+
const credentialVars = authEnabled
|
|
15
|
+
? "PHOENIX_COLLECTOR_ENDPOINT and PHOENIX_API_KEY"
|
|
16
|
+
: "PHOENIX_COLLECTOR_ENDPOINT";
|
|
17
|
+
const endpointRule = isDefaultEndpoint
|
|
18
|
+
? ""
|
|
19
|
+
: `\n Also set the collector endpoint in code only if the quickstart says to; it is ${endpoint}.`;
|
|
20
|
+
const languageRule = languages.length > 0
|
|
21
|
+
? `The app's language is ${languages.join(" and ")} — do not spend time detecting it.`
|
|
22
|
+
: "Detect the app's language, follow the matching quickstart, and use the integration guide\nfor the app's LLM framework or provider.";
|
|
23
|
+
const localDocsRule = localDocsDir
|
|
24
|
+
? `\nThese pages are already downloaded to ${localDocsDir} — read them from disk first, and only\nfetch a URL if the page you need is missing there.`
|
|
25
|
+
: "";
|
|
26
|
+
return `You are running as part of the Phoenix setup script. Your ONLY task is to add Phoenix
|
|
27
|
+
tracing to the application in the current working directory and emit one verification
|
|
28
|
+
trace. Do not run setup tools, onboarding scripts, or "px setup" again.
|
|
29
|
+
|
|
30
|
+
Work from the official docs — do not guess package names or APIs from memory:
|
|
31
|
+
- Python quickstart (arize-phoenix-otel): ${docs.quickstartPython}
|
|
32
|
+
- TypeScript quickstart (@arizeai/phoenix-otel): ${docs.quickstartTypeScript}
|
|
33
|
+
- register() reference: ${docs.phoenixOtelSetup}
|
|
34
|
+
- Auto-instrumentation guides by framework/provider: ${docs.integrationsIndex}${localDocsRule}
|
|
35
|
+
${languageRule}
|
|
36
|
+
|
|
37
|
+
Rules:
|
|
38
|
+
1. Tracing only. Do not add evals, datasets, prompts, dashboards, or any other feature.
|
|
39
|
+
2. Credentials are provided via environment variables (${credentialVars}), which Phoenix SDKs read
|
|
40
|
+
automatically. If they are not set in your shell, apply them with
|
|
41
|
+
\`set -a; source .env.phoenix; set +a\` before the verification run. NEVER print the
|
|
42
|
+
contents of \`.env.phoenix\`, never print the API key, and never
|
|
43
|
+
write the API key or any secret into source code, config files, or command arguments.
|
|
44
|
+
3. Configure the Phoenix project name in code: use the SDK's register call with the
|
|
45
|
+
project name "${projectName}".${endpointRule}
|
|
46
|
+
4. Prefer auto-instrumentation packages over hand-written span wrappers. Make the smallest
|
|
47
|
+
correct change.
|
|
48
|
+
5. Verify your work by emitting exactly one trace: run the app briefly, or a minimal
|
|
49
|
+
throwaway script that makes one real LLM call through the instrumented path, then
|
|
50
|
+
delete any throwaway script. Do not run the full test suite or the build.
|
|
51
|
+
6. Install SDK packages with the project's existing package manager, pinned to the latest
|
|
52
|
+
stable version you can verify. If this is a monorepo, note the root but only modify
|
|
53
|
+
files at or below the current working directory.
|
|
54
|
+
7. Keep changes concise and readable. Do not restructure, reformat, or meaningfully modify
|
|
55
|
+
existing application code.
|
|
56
|
+
8. Do not use the \`px\` CLI.
|
|
57
|
+
|
|
58
|
+
When finished, end your final message with a one-line summary of the changes you made and
|
|
59
|
+
this link to the project's traces: ${tracesUrl}
|
|
60
|
+
If you could not complete the task or could not emit a verification trace, say so plainly
|
|
61
|
+
with a one-paragraph reason instead.
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=instrumentationPrompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentationPrompt.js","sourceRoot":"","sources":["../../../src/setup/prompts/instrumentationPrompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAgCH,MAAM,UAAU,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,SAAS,GAAG,EAAE,EACd,YAAY,GACc;IAC1B,MAAM,cAAc,GAAG,WAAW;QAChC,CAAC,CAAC,gDAAgD;QAClD,CAAC,CAAC,4BAA4B,CAAC;IACjC,MAAM,YAAY,GAAG,iBAAiB;QACpC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,sFAAsF,QAAQ,GAAG,CAAC;IACtG,MAAM,YAAY,GAChB,SAAS,CAAC,MAAM,GAAG,CAAC;QAClB,CAAC,CAAC,yBAAyB,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,oCAAoC;QACtF,CAAC,CAAC,oIAAoI,CAAC;IAC3I,MAAM,aAAa,GAAG,YAAY;QAChC,CAAC,CAAC,2CAA2C,YAAY,4FAA4F;QACrJ,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO;;;;;4CAKmC,IAAI,CAAC,gBAAgB;mDACd,IAAI,CAAC,oBAAoB;0BAClD,IAAI,CAAC,gBAAgB;uDACQ,IAAI,CAAC,iBAAiB,GAAG,aAAa;EAC3F,YAAY;;;;yDAI2C,cAAc;;;;;;mBAMpD,WAAW,KAAK,YAAY;;;;;;;;;;;;;;qCAcV,SAAS;;;CAG7C,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The setup step sequence, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* All effects flow through `SetupDeps`; all strings live in `copy.ts`;
|
|
5
|
+
* cancellation unwinds via `SetupCancelledError` to the command handler.
|
|
6
|
+
*
|
|
7
|
+
* Three entry points, composed from the same steps:
|
|
8
|
+
* - `runSetup` — the whole flow (`px setup`)
|
|
9
|
+
* - `runInstrument` — register, then instrument and verify (`px setup instrument`)
|
|
10
|
+
* - `runSkills` — the tooling installs alone (`px setup skills`)
|
|
11
|
+
* Each returns a {@link SetupReport}, which the command layer renders in the
|
|
12
|
+
* requested `--format`.
|
|
13
|
+
*/
|
|
14
|
+
import type { DocsPrefetchResult, SetupDeps } from "./deps/index.js";
|
|
15
|
+
import type { SetupInputs } from "./options.js";
|
|
16
|
+
import type { Connection } from "./steps/establishConnection.js";
|
|
17
|
+
import { type ToolingResult } from "./steps/installTooling.js";
|
|
18
|
+
import { type InstrumentationLane } from "./steps/instrumentApp.js";
|
|
19
|
+
/** Everything a run did, in the shape the summary and `--format json` print. */
|
|
20
|
+
export interface SetupReport {
|
|
21
|
+
connection: Connection;
|
|
22
|
+
authEnabled: boolean;
|
|
23
|
+
headless: boolean;
|
|
24
|
+
/** Files setup wrote into the repo. */
|
|
25
|
+
files: string[];
|
|
26
|
+
/** Paths appended to a .gitignore. */
|
|
27
|
+
gitignored: string[];
|
|
28
|
+
docs?: DocsPrefetchResult;
|
|
29
|
+
instrumentation?: InstrumentationLane;
|
|
30
|
+
/** True once the API confirmed a trace arrived after this run started. */
|
|
31
|
+
tracesVerified?: boolean;
|
|
32
|
+
tooling?: ToolingResult;
|
|
33
|
+
tracesUrl: string;
|
|
34
|
+
}
|
|
35
|
+
/** `px setup` — the whole flow. */
|
|
36
|
+
export declare function runSetup(deps: SetupDeps, inputs: SetupInputs): Promise<SetupReport>;
|
|
37
|
+
/**
|
|
38
|
+
* `px setup instrument` — the instrumentation slice, re-runnable on a repo that
|
|
39
|
+
* is already registered. Registration still runs: it is idempotent, and it is
|
|
40
|
+
* what produces the connection the agent and the verification step need.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runInstrument(deps: SetupDeps, resolved: SetupInputs): Promise<SetupReport>;
|
|
43
|
+
/** `px setup skills` — the tooling installs alone; no connection needed. */
|
|
44
|
+
export declare function runSkills(deps: SetupDeps, inputs: SetupInputs): Promise<ToolingResult>;
|
|
45
|
+
//# sourceMappingURL=runSetup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runSetup.d.ts","sourceRoot":"","sources":["../../src/setup/runSetup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH,OAAO,KAAK,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAUhF,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,sCAAsC;IACtC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAeD,mCAAmC;AACnC,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CA8CtB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,WAAW,CAAC,CAetB;AAED,4EAA4E;AAC5E,wBAAsB,SAAS,CAC7B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The setup step sequence, and nothing else.
|
|
3
|
+
*
|
|
4
|
+
* All effects flow through `SetupDeps`; all strings live in `copy.ts`;
|
|
5
|
+
* cancellation unwinds via `SetupCancelledError` to the command handler.
|
|
6
|
+
*
|
|
7
|
+
* Three entry points, composed from the same steps:
|
|
8
|
+
* - `runSetup` — the whole flow (`px setup`)
|
|
9
|
+
* - `runInstrument` — register, then instrument and verify (`px setup instrument`)
|
|
10
|
+
* - `runSkills` — the tooling installs alone (`px setup skills`)
|
|
11
|
+
* Each returns a {@link SetupReport}, which the command layer renders in the
|
|
12
|
+
* requested `--format`.
|
|
13
|
+
*/
|
|
14
|
+
import { detectCodingAgents, probeGlobalBinary, } from "./agents/registry.js";
|
|
15
|
+
import * as COPY from "./copy.js";
|
|
16
|
+
import { SetupCancelledError } from "./errors.js";
|
|
17
|
+
import { assertAgentForHeadlessInstrument } from "./options.js";
|
|
18
|
+
import { chooseEndpoint } from "./steps/chooseEndpoint.js";
|
|
19
|
+
import { confirmGitSafety } from "./steps/confirmGitSafety.js";
|
|
20
|
+
import { establishConnection } from "./steps/establishConnection.js";
|
|
21
|
+
import { offerToolingInstalls, } from "./steps/installTooling.js";
|
|
22
|
+
import { instrumentApp } from "./steps/instrumentApp.js";
|
|
23
|
+
import { offerPxProfile } from "./steps/offerPxProfile.js";
|
|
24
|
+
import { prefetchDocs } from "./steps/prefetchDocs.js";
|
|
25
|
+
import { hasSpansInSkewWindow, waitForFirstTrace, tracesUrl, } from "./steps/verifyTraces.js";
|
|
26
|
+
import { ENV_FILE_NAME, writeEnvFile } from "./steps/writeEnvFile.js";
|
|
27
|
+
/**
|
|
28
|
+
* Detect the installed agents — but only when the lane is still open. `--agent`
|
|
29
|
+
* pins it, and the pinned agent probes its own binary, so the sweep's four
|
|
30
|
+
* subprocess spawns would be thrown away. Every headless instrumentation run
|
|
31
|
+
* names an agent, so that is exactly where the waste would land.
|
|
32
|
+
*/
|
|
33
|
+
function detectAgentsUnlessPinned(deps, inputs) {
|
|
34
|
+
return inputs.agent ? Promise.resolve([]) : detectCodingAgents(deps);
|
|
35
|
+
}
|
|
36
|
+
/** `px setup` — the whole flow. */
|
|
37
|
+
export async function runSetup(deps, inputs) {
|
|
38
|
+
// Started before the first prompt so the probes finish behind it; awaited
|
|
39
|
+
// by the instrumentation and tooling steps.
|
|
40
|
+
const agentDetection = detectAgentsUnlessPinned(deps, inputs);
|
|
41
|
+
// Probed with package-runner bin dirs stripped from PATH — under
|
|
42
|
+
// `npx @arizeai/phoenix-cli setup`, the package's own `px` shim must not
|
|
43
|
+
// masquerade as a global install and suppress the CLI-install offer.
|
|
44
|
+
const pxOnPath = probeGlobalBinary(deps, "px");
|
|
45
|
+
if (!inputs.headless) {
|
|
46
|
+
deps.prompter.intro(COPY.INTRO);
|
|
47
|
+
}
|
|
48
|
+
const report = await registerAndInstrument(deps, inputs, { agentDetection });
|
|
49
|
+
// A headless run stops here: the tooling offers are prompts, and its stdout
|
|
50
|
+
// belongs to the summary.
|
|
51
|
+
if (inputs.headless) {
|
|
52
|
+
return report;
|
|
53
|
+
}
|
|
54
|
+
// Tooling opt-ins come after the verified-trace moment so nothing stands
|
|
55
|
+
// between launch and first trace: point px at this project, then install the
|
|
56
|
+
// CLI and skills so the user (and their coding agent) can look at the traces
|
|
57
|
+
// now flowing.
|
|
58
|
+
await offerPxProfile(deps, {
|
|
59
|
+
connection: report.connection,
|
|
60
|
+
settingsPath: deps.context.settingsPath,
|
|
61
|
+
});
|
|
62
|
+
const tooling = await offerToolingInstalls(deps, {
|
|
63
|
+
pxOnPath,
|
|
64
|
+
skills: inputs.skills,
|
|
65
|
+
canPrompt: true,
|
|
66
|
+
});
|
|
67
|
+
deps.prompter.note(report.authEnabled
|
|
68
|
+
? COPY.PRODUCTION.bodyAuthOn
|
|
69
|
+
: COPY.PRODUCTION.bodyAuthOff, COPY.PRODUCTION.title);
|
|
70
|
+
// Untitled: the outro below already says it, and closes the rail.
|
|
71
|
+
deps.prompter.note(COPY.OUTRO_BODY);
|
|
72
|
+
deps.prompter.outro(COPY.OUTRO_TITLE);
|
|
73
|
+
return { ...report, tooling };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* `px setup instrument` — the instrumentation slice, re-runnable on a repo that
|
|
77
|
+
* is already registered. Registration still runs: it is idempotent, and it is
|
|
78
|
+
* what produces the connection the agent and the verification step need.
|
|
79
|
+
*/
|
|
80
|
+
export async function runInstrument(deps, resolved) {
|
|
81
|
+
// This lane instruments by definition, so it never passes `--instrument` for
|
|
82
|
+
// `resolveSetupInputs` to have guarded — check the headless rule here.
|
|
83
|
+
assertAgentForHeadlessInstrument(resolved);
|
|
84
|
+
const inputs = { ...resolved, instrument: true };
|
|
85
|
+
const agentDetection = detectAgentsUnlessPinned(deps, inputs);
|
|
86
|
+
if (!inputs.headless) {
|
|
87
|
+
deps.prompter.intro(COPY.INTRO_INSTRUMENT);
|
|
88
|
+
}
|
|
89
|
+
const report = await registerAndInstrument(deps, inputs, { agentDetection });
|
|
90
|
+
if (!inputs.headless) {
|
|
91
|
+
deps.prompter.outro(COPY.OUTRO_TITLE);
|
|
92
|
+
}
|
|
93
|
+
return report;
|
|
94
|
+
}
|
|
95
|
+
/** `px setup skills` — the tooling installs alone; no connection needed. */
|
|
96
|
+
export async function runSkills(deps, inputs) {
|
|
97
|
+
const pxOnPath = probeGlobalBinary(deps, "px");
|
|
98
|
+
if (!inputs.headless) {
|
|
99
|
+
deps.prompter.intro(COPY.INTRO_SKILLS);
|
|
100
|
+
}
|
|
101
|
+
const tooling = await offerToolingInstalls(deps, {
|
|
102
|
+
pxOnPath,
|
|
103
|
+
skills: inputs.skills,
|
|
104
|
+
canPrompt: !inputs.headless,
|
|
105
|
+
});
|
|
106
|
+
if (!inputs.headless) {
|
|
107
|
+
deps.prompter.outro(COPY.OUTRO_TITLE);
|
|
108
|
+
}
|
|
109
|
+
return tooling;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Register, then — when asked — prefetch docs, hand off to the agent, and
|
|
113
|
+
* verify traces. The shared spine of `px setup` and `px setup instrument`.
|
|
114
|
+
*/
|
|
115
|
+
async function registerAndInstrument(deps, inputs, { agentDetection }) {
|
|
116
|
+
const registration = await register(deps, inputs);
|
|
117
|
+
const { connection, authEnabled, gitignoreAppended } = registration;
|
|
118
|
+
const base = {
|
|
119
|
+
connection,
|
|
120
|
+
authEnabled,
|
|
121
|
+
headless: inputs.headless,
|
|
122
|
+
files: [ENV_FILE_NAME],
|
|
123
|
+
gitignored: gitignoreAppended,
|
|
124
|
+
tracesUrl: tracesUrl(connection),
|
|
125
|
+
};
|
|
126
|
+
if (!inputs.instrument) {
|
|
127
|
+
return base;
|
|
128
|
+
}
|
|
129
|
+
// Only after registration's git-safety gate: the docs fetch writes into
|
|
130
|
+
// `.px/`, which an earlier download can make look like a pre-existing dirty
|
|
131
|
+
// tree in a fast or cached headless run.
|
|
132
|
+
const docs = await prefetchDocs(deps, {
|
|
133
|
+
docs: inputs.docs,
|
|
134
|
+
isGitRepository: registration.isGitRepository,
|
|
135
|
+
});
|
|
136
|
+
const startedAt = deps.clock.now();
|
|
137
|
+
// Any span already visible inside the clock-skew window predates this run —
|
|
138
|
+
// verification must then require spans strictly after the start time, or a
|
|
139
|
+
// pre-existing trace would falsely verify the hand-off.
|
|
140
|
+
const hadRecentSpans = await hasSpansInSkewWindow(deps, connection, {
|
|
141
|
+
sinceMs: startedAt,
|
|
142
|
+
});
|
|
143
|
+
const instrumentation = await instrumentApp(deps, connection, {
|
|
144
|
+
authEnabled,
|
|
145
|
+
agentDetection,
|
|
146
|
+
agent: inputs.agent,
|
|
147
|
+
languages: inputs.languages,
|
|
148
|
+
mode: {
|
|
149
|
+
background: inputs.background,
|
|
150
|
+
bypassPermissions: inputs.bypassPermissions,
|
|
151
|
+
},
|
|
152
|
+
...(docs ? { docs } : {}),
|
|
153
|
+
});
|
|
154
|
+
// The return value is setup's definition of done — a trace the API confirmed
|
|
155
|
+
// arriving, not the agent's own claim that it finished. It is reported, not
|
|
156
|
+
// thrown on: the connection and hand-off files are real work worth keeping
|
|
157
|
+
// even when no trace showed up.
|
|
158
|
+
const tracesVerified = await waitForFirstTrace(deps, connection, {
|
|
159
|
+
sinceMs: startedAt,
|
|
160
|
+
allowClockSkew: !hadRecentSpans,
|
|
161
|
+
headless: inputs.headless,
|
|
162
|
+
});
|
|
163
|
+
return {
|
|
164
|
+
...base,
|
|
165
|
+
...(docs ? { docs } : {}),
|
|
166
|
+
// The docs step gitignores its own output dir, so the report has to fold
|
|
167
|
+
// those appends in or it under-states what setup touched.
|
|
168
|
+
gitignored: [...base.gitignored, ...(docs?.gitignoreAppended ?? [])],
|
|
169
|
+
instrumentation,
|
|
170
|
+
tracesVerified,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Git safety, endpoint, connection, env file — the part every lane shares, and
|
|
175
|
+
* all a registration-only run performs.
|
|
176
|
+
*/
|
|
177
|
+
async function register(deps, inputs) {
|
|
178
|
+
const { headless } = inputs;
|
|
179
|
+
const git = await confirmGitSafety(deps, { headless });
|
|
180
|
+
if (!git.proceed) {
|
|
181
|
+
throw new SetupCancelledError();
|
|
182
|
+
}
|
|
183
|
+
// The hidden --api-url dev flag never reaches this endpoint — it is applied
|
|
184
|
+
// as the client's base URL in buildDefaultDeps, so API traffic is rerouted
|
|
185
|
+
// while hand-off files, the px profile, and traces URLs keep the endpoint
|
|
186
|
+
// resolved here.
|
|
187
|
+
const endpointChoice = await chooseEndpoint(deps, {
|
|
188
|
+
presetEndpoint: inputs.endpoint,
|
|
189
|
+
headless,
|
|
190
|
+
});
|
|
191
|
+
const connection = await establishConnection(deps, {
|
|
192
|
+
endpoint: endpointChoice.endpoint,
|
|
193
|
+
authEnabled: endpointChoice.authEnabled,
|
|
194
|
+
inputs,
|
|
195
|
+
});
|
|
196
|
+
const envFile = writeEnvFile(deps, connection, {
|
|
197
|
+
isGitRepository: git.isGitRepository,
|
|
198
|
+
});
|
|
199
|
+
if (!headless) {
|
|
200
|
+
deps.prompter.line(COPY.ENV_FILE.wrote([ENV_FILE_NAME]));
|
|
201
|
+
if (envFile.gitignoreAppended.length > 0) {
|
|
202
|
+
deps.prompter.line(COPY.ENV_FILE.gitignored(envFile.gitignoreAppended));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
connection,
|
|
207
|
+
authEnabled: endpointChoice.authEnabled,
|
|
208
|
+
gitignoreAppended: envFile.gitignoreAppended,
|
|
209
|
+
isGitRepository: git.isGitRepository,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=runSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runSetup.js","sourceRoot":"","sources":["../../src/setup/runSetup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,gCAAgC,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EACL,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,aAAa,EAA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,CAAC;QAC1E,CAAC;IACH,CAAC;IAED,OAAO;QACL,UAAU;QACV,WAAW,EAAE,cAAc,CAAC,WAAW;QACvC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,eAAe,EAAE,GAAG,CAAC,eAAe;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Choose the endpoint: where Phoenix is, and whether it wants an API key.
|
|
3
|
+
*
|
|
4
|
+
* Two options — Local or Remote ("paste your instance URL"). The probe is
|
|
5
|
+
* an unauthenticated
|
|
6
|
+
* `GET /v1/projects?limit=1`: 200 → auth off, 401/403 → auth on, anything
|
|
7
|
+
* else → troubleshoot copy and re-ask (max 3 attempts).
|
|
8
|
+
*/
|
|
9
|
+
import type { SetupDeps } from "../deps/index.js";
|
|
10
|
+
export interface EndpointChoice {
|
|
11
|
+
/** Normalized origin, no trailing slash. */
|
|
12
|
+
endpoint: string;
|
|
13
|
+
authEnabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
export type ProbeOutcome = {
|
|
16
|
+
kind: "authOff";
|
|
17
|
+
} | {
|
|
18
|
+
kind: "authOn";
|
|
19
|
+
} | {
|
|
20
|
+
kind: "unreachable";
|
|
21
|
+
detail: string;
|
|
22
|
+
} | {
|
|
23
|
+
kind: "notPhoenix";
|
|
24
|
+
detail: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Probe an endpoint to determine reachability and whether auth is enabled.
|
|
28
|
+
*/
|
|
29
|
+
export declare function probeEndpoint(deps: Pick<SetupDeps, "createClient">, endpoint: string): Promise<ProbeOutcome>;
|
|
30
|
+
export interface ChooseEndpointArgs {
|
|
31
|
+
/** Pre-answered endpoint from --endpoint / env (skips the select). */
|
|
32
|
+
presetEndpoint?: string;
|
|
33
|
+
headless: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function chooseEndpoint(deps: Pick<SetupDeps, "createClient" | "prompter">, { presetEndpoint, headless }: ChooseEndpointArgs): Promise<EndpointChoice>;
|
|
36
|
+
//# sourceMappingURL=chooseEndpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chooseEndpoint.d.ts","sourceRoot":"","sources":["../../../src/setup/steps/chooseEndpoint.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAQzC,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAMD,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACvC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EACrC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,YAAY,CAAC,CAsBvB;AA+BD,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,cAAc,GAAG,UAAU,CAAC,EAClD,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAC/C,OAAO,CAAC,cAAc,CAAC,CA+DzB"}
|