@arizeai/phoenix-cli 1.5.2 → 1.6.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/build/pxi/App.d.ts +22 -0
- package/build/pxi/App.d.ts.map +1 -0
- package/build/pxi/App.js +268 -0
- package/build/pxi/App.js.map +1 -0
- package/build/pxi/client.d.ts +77 -0
- package/build/pxi/client.d.ts.map +1 -0
- package/build/pxi/client.js +170 -0
- package/build/pxi/client.js.map +1 -0
- package/build/pxi/index.d.ts +14 -0
- package/build/pxi/index.d.ts.map +1 -0
- package/build/pxi/index.js +36 -0
- package/build/pxi/index.js.map +1 -0
- package/build/pxi/inkMarkdown.d.ts +17 -0
- package/build/pxi/inkMarkdown.d.ts.map +1 -0
- package/build/pxi/inkMarkdown.js +22 -0
- package/build/pxi/inkMarkdown.js.map +1 -0
- package/build/pxi/markdown.d.ts +24 -0
- package/build/pxi/markdown.d.ts.map +1 -0
- package/build/pxi/markdown.js +115 -0
- package/build/pxi/markdown.js.map +1 -0
- package/build/pxi/options.d.ts +64 -0
- package/build/pxi/options.d.ts.map +1 -0
- package/build/pxi/options.js +148 -0
- package/build/pxi/options.js.map +1 -0
- package/build/pxi/preflight.d.ts +88 -0
- package/build/pxi/preflight.d.ts.map +1 -0
- package/build/pxi/preflight.js +215 -0
- package/build/pxi/preflight.js.map +1 -0
- package/build/pxi/toolProgress.d.ts +37 -0
- package/build/pxi/toolProgress.d.ts.map +1 -0
- package/build/pxi/toolProgress.js +71 -0
- package/build/pxi/toolProgress.js.map +1 -0
- package/build/pxi/types.d.ts +123 -0
- package/build/pxi/types.d.ts.map +1 -0
- package/build/pxi/types.js +2 -0
- package/build/pxi/types.js.map +1 -0
- package/package.json +13 -4
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { buildGraphqlRequest } from "../commands/api.js";
|
|
2
|
+
import { InvalidArgumentError } from "../exitCodes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pre-launch validation of the selected model.
|
|
5
|
+
*
|
|
6
|
+
* Before the chat UI opens, PXI asks the Phoenix server which providers and
|
|
7
|
+
* models are actually installed and credentialed, then checks the user's
|
|
8
|
+
* `--provider`/`--model` selection against that catalog. Catching a bad or
|
|
9
|
+
* unconfigured model here turns what would be a cryptic mid-stream failure into
|
|
10
|
+
* a clear, actionable startup error. The whole check can be skipped with
|
|
11
|
+
* `--skip-model-preflight`.
|
|
12
|
+
*/
|
|
13
|
+
/** GraphQL query fetching the server's provider catalog, credential state, and known models. */
|
|
14
|
+
export const PXI_MODEL_PREFLIGHT_QUERY = /* GraphQL */ `
|
|
15
|
+
query PxiModelPreflightQuery {
|
|
16
|
+
modelProviders {
|
|
17
|
+
key
|
|
18
|
+
name
|
|
19
|
+
dependenciesInstalled
|
|
20
|
+
credentialsSet
|
|
21
|
+
credentialRequirements {
|
|
22
|
+
envVarName
|
|
23
|
+
isRequired
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
playgroundModels {
|
|
27
|
+
providerKey
|
|
28
|
+
name
|
|
29
|
+
}
|
|
30
|
+
generativeModelCustomProviders(first: 50) {
|
|
31
|
+
edges {
|
|
32
|
+
node {
|
|
33
|
+
id
|
|
34
|
+
name
|
|
35
|
+
sdk
|
|
36
|
+
modelNames
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
/**
|
|
43
|
+
* Render a list of values for an error message, capping it at `limit` and
|
|
44
|
+
* summarizing the overflow as "…, and N more" so messages stay readable when a
|
|
45
|
+
* provider exposes many models.
|
|
46
|
+
*/
|
|
47
|
+
function formatList({ values, limit = 8, }) {
|
|
48
|
+
if (values.length === 0) {
|
|
49
|
+
return "none";
|
|
50
|
+
}
|
|
51
|
+
const visibleValues = values.slice(0, limit);
|
|
52
|
+
const remainingCount = values.length - visibleValues.length;
|
|
53
|
+
if (remainingCount <= 0) {
|
|
54
|
+
return visibleValues.join(", ");
|
|
55
|
+
}
|
|
56
|
+
return `${visibleValues.join(", ")}, and ${remainingCount} more`;
|
|
57
|
+
}
|
|
58
|
+
function getModelLabel({ modelSelection, }) {
|
|
59
|
+
if (modelSelection.providerType === "custom") {
|
|
60
|
+
return `custom:${modelSelection.providerId}/${modelSelection.modelName}`;
|
|
61
|
+
}
|
|
62
|
+
return `${modelSelection.provider}/${modelSelection.modelName}`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Compose the "missing credentials" error for a provider, listing the required
|
|
66
|
+
* environment variables (falling back to all known ones if none are flagged
|
|
67
|
+
* required) and clarifying that these are server-side provider credentials, not
|
|
68
|
+
* the PXI CLI `--api-key`.
|
|
69
|
+
*/
|
|
70
|
+
function buildServerCredentialMessage({ provider, }) {
|
|
71
|
+
const requiredEnvVars = provider.credentialRequirements
|
|
72
|
+
.filter((requirement) => requirement.isRequired)
|
|
73
|
+
.map((requirement) => requirement.envVarName);
|
|
74
|
+
const envVars = requiredEnvVars.length > 0
|
|
75
|
+
? requiredEnvVars
|
|
76
|
+
: provider.credentialRequirements.map((requirement) => requirement.envVarName);
|
|
77
|
+
return [
|
|
78
|
+
`Missing credentials for ${provider.name} (${provider.key}).`,
|
|
79
|
+
`Required server credential variables/secrets: ${formatList({
|
|
80
|
+
values: envVars,
|
|
81
|
+
})}.`,
|
|
82
|
+
"Configure credentials in Phoenix Settings > AI Providers, or set the required environment variables on the Phoenix server.",
|
|
83
|
+
"These are Phoenix server-side provider credentials, not the PXI CLI --api-key.",
|
|
84
|
+
].join(" ");
|
|
85
|
+
}
|
|
86
|
+
function getCustomProviders({ data, }) {
|
|
87
|
+
return data.generativeModelCustomProviders.edges.map((edge) => edge.node);
|
|
88
|
+
}
|
|
89
|
+
async function readResponseText({ response, }) {
|
|
90
|
+
try {
|
|
91
|
+
return await response.text();
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return "";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Unwrap a GraphQL response into its `data`, throwing a descriptive error if the
|
|
99
|
+
* server returned GraphQL errors or no data at all. Error messages point at
|
|
100
|
+
* `--skip-model-preflight` as the escape hatch.
|
|
101
|
+
*/
|
|
102
|
+
function assertPreflightData({ payload, }) {
|
|
103
|
+
const errors = payload.errors
|
|
104
|
+
?.map((error) => error.message)
|
|
105
|
+
.filter((message) => Boolean(message));
|
|
106
|
+
if (errors && errors.length > 0) {
|
|
107
|
+
throw new Error(`Could not validate PXI model selection because Phoenix returned GraphQL errors: ${errors.join("; ")}. Use --skip-model-preflight to bypass this startup check.`);
|
|
108
|
+
}
|
|
109
|
+
if (!payload.data) {
|
|
110
|
+
throw new Error("Could not validate PXI model selection because Phoenix returned no GraphQL data. Use --skip-model-preflight to bypass this startup check.");
|
|
111
|
+
}
|
|
112
|
+
return payload.data;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Fetch the provider/model catalog from Phoenix via GraphQL. Requires a
|
|
116
|
+
* configured endpoint and turns non-2xx responses into errors that include the
|
|
117
|
+
* HTTP status and any response body. `fetchImpl` is injectable for testing.
|
|
118
|
+
*/
|
|
119
|
+
export async function fetchPxiModelPreflight({ config, fetchImpl = globalThis.fetch, }) {
|
|
120
|
+
if (!config.endpoint) {
|
|
121
|
+
throw new InvalidArgumentError("Phoenix endpoint not configured. Set PHOENIX_HOST or pass --endpoint.");
|
|
122
|
+
}
|
|
123
|
+
const request = buildGraphqlRequest({
|
|
124
|
+
query: PXI_MODEL_PREFLIGHT_QUERY,
|
|
125
|
+
config,
|
|
126
|
+
});
|
|
127
|
+
const response = await fetchImpl(request.url, {
|
|
128
|
+
method: request.method,
|
|
129
|
+
headers: request.headers,
|
|
130
|
+
body: request.body,
|
|
131
|
+
});
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
const detail = await readResponseText({ response });
|
|
134
|
+
const detailText = detail ? `: ${detail}` : "";
|
|
135
|
+
throw new Error(`Could not validate PXI model selection: HTTP ${response.status} ${response.statusText} from ${request.url}${detailText}. Use --skip-model-preflight to bypass this startup check.`);
|
|
136
|
+
}
|
|
137
|
+
const payload = (await response.json());
|
|
138
|
+
return assertPreflightData({ payload });
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Check a model selection against the fetched catalog, throwing
|
|
142
|
+
* {@link InvalidArgumentError} with a helpful message on the first problem.
|
|
143
|
+
*
|
|
144
|
+
* For custom providers: the provider id must exist, and the model must be one of
|
|
145
|
+
* its configured names (when it advertises any). For built-in providers: the
|
|
146
|
+
* provider must be available, have its dependencies installed and credentials
|
|
147
|
+
* set, and — if the server publishes a model catalog for it — the model must be
|
|
148
|
+
* in that catalog. A provider with no published catalog accepts any model name.
|
|
149
|
+
*/
|
|
150
|
+
export function validatePxiModelSelection({ data, modelSelection, }) {
|
|
151
|
+
if (modelSelection.providerType === "custom") {
|
|
152
|
+
const customProviders = getCustomProviders({ data });
|
|
153
|
+
const provider = customProviders.find((candidate) => candidate.id === modelSelection.providerId);
|
|
154
|
+
if (!provider) {
|
|
155
|
+
throw new InvalidArgumentError(`Custom provider ${modelSelection.providerId} was not found on this Phoenix server. Configure it in Phoenix Settings > AI Providers or pass --skip-model-preflight. Available custom provider IDs: ${formatList({ values: customProviders.map((candidate) => candidate.id) })}.`);
|
|
156
|
+
}
|
|
157
|
+
if (provider.modelNames.length > 0 &&
|
|
158
|
+
!provider.modelNames.includes(modelSelection.modelName)) {
|
|
159
|
+
throw new InvalidArgumentError(`Invalid model for custom provider ${provider.name} (${provider.id}): ${modelSelection.modelName}. Configured model names: ${formatList({ values: provider.modelNames })}.`);
|
|
160
|
+
}
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const provider = data.modelProviders.find((candidate) => candidate.key === modelSelection.provider);
|
|
164
|
+
const availableProviderKeys = data.modelProviders.map((candidate) => candidate.key);
|
|
165
|
+
if (!provider) {
|
|
166
|
+
throw new InvalidArgumentError(`Provider ${modelSelection.provider} is not available on this Phoenix server. Available providers: ${formatList({ values: availableProviderKeys })}.`);
|
|
167
|
+
}
|
|
168
|
+
if (!provider.dependenciesInstalled) {
|
|
169
|
+
throw new InvalidArgumentError(`${provider.name} (${provider.key}) is unavailable because the Phoenix server does not have that provider installed. Install the provider dependencies on the Phoenix server or choose another provider.`);
|
|
170
|
+
}
|
|
171
|
+
if (provider.credentialRequirements.length > 0 && !provider.credentialsSet) {
|
|
172
|
+
throw new InvalidArgumentError(buildServerCredentialMessage({ provider }));
|
|
173
|
+
}
|
|
174
|
+
const providerModels = data.playgroundModels
|
|
175
|
+
.filter((model) => model.providerKey === modelSelection.provider)
|
|
176
|
+
.map((model) => model.name);
|
|
177
|
+
const hasProviderCatalog = providerModels.length > 0;
|
|
178
|
+
const isKnownModel = providerModels.includes(modelSelection.modelName);
|
|
179
|
+
if (hasProviderCatalog && !isKnownModel) {
|
|
180
|
+
throw new InvalidArgumentError(`Invalid model for ${provider.name} (${provider.key}): ${modelSelection.modelName}. Available models for this provider include: ${formatList({ values: providerModels })}.`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Run the full preflight for a session: fetch the catalog and validate the
|
|
185
|
+
* selected model, unless `--skip-model-preflight` was passed. This is the single
|
|
186
|
+
* call the entry point makes before rendering the UI.
|
|
187
|
+
*/
|
|
188
|
+
export async function runPxiModelPreflight({ options, fetchImpl = globalThis.fetch, }) {
|
|
189
|
+
if (options.skipModelPreflight) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const data = await fetchPxiModelPreflight({
|
|
193
|
+
config: options.config,
|
|
194
|
+
fetchImpl,
|
|
195
|
+
});
|
|
196
|
+
validatePxiModelSelection({
|
|
197
|
+
data,
|
|
198
|
+
modelSelection: options.modelSelection,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Wrap an error thrown while talking to PXI into a single message that names the
|
|
203
|
+
* model and appends a tailored next step — pointing custom providers at their
|
|
204
|
+
* Phoenix settings and built-in providers at credential configuration or
|
|
205
|
+
* choosing a different model. Used for failures that surface after the preflight
|
|
206
|
+
* has already passed.
|
|
207
|
+
*/
|
|
208
|
+
export function formatPxiRuntimeError({ error, modelSelection, }) {
|
|
209
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
210
|
+
const nextAction = modelSelection.providerType === "custom"
|
|
211
|
+
? "Check the custom provider configuration in Phoenix Settings > AI Providers."
|
|
212
|
+
: `Configure ${modelSelection.provider} credentials in Phoenix Settings > AI Providers, set the required environment variables on the Phoenix server, or choose a different model.`;
|
|
213
|
+
return new Error(`PXI request failed for ${getModelLabel({ modelSelection })}: ${message} ${nextAction}`);
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/pxi/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD;;;;;;;;;GASG;AAEH,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAG,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BtD,CAAC;AA4CF;;;;GAIG;AACH,SAAS,UAAU,CAAC,EAClB,MAAM,EACN,KAAK,GAAG,CAAC,GAIV;IACC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC7C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;IAC5D,IAAI,cAAc,IAAI,CAAC,EAAE,CAAC;QACxB,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IACD,OAA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OAAO,IAAI,KAAK,CACd,0BAA0B,aAAa,CAAC,EAAE,cAAc,EAAE,CAAC,KAAK,OAAO,IAAI,UAAU,EAAE,CACxF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { UIDataTypes, UIMessagePart, UITools } from "ai";
|
|
2
|
+
import type { PxiMessage } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Distills the AI SDK's tool-call message parts into a small, display-ready
|
|
5
|
+
* {@link ToolProgress} shape the UI can render directly. The SDK models a tool
|
|
6
|
+
* call as a sequence of parts moving through lifecycle states; this module reads
|
|
7
|
+
* the current state and produces a human-readable status line plus an optional
|
|
8
|
+
* one-line summary of the tool's input or output.
|
|
9
|
+
*/
|
|
10
|
+
/** Lifecycle state of a single tool call, mirroring the AI SDK's part states. */
|
|
11
|
+
export type ToolProgressState = "input-streaming" | "input-available" | "approval-requested" | "approval-responded" | "output-available" | "output-error" | "output-denied";
|
|
12
|
+
/** A display-ready summary of one tool call's current progress. */
|
|
13
|
+
export type ToolProgress = {
|
|
14
|
+
toolCallId: string;
|
|
15
|
+
toolName: string;
|
|
16
|
+
state: ToolProgressState;
|
|
17
|
+
statusText: string;
|
|
18
|
+
errorText?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Collect the progress of every tool call across a list of messages, in order,
|
|
22
|
+
* skipping non-tool parts.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getToolProgressFromMessages(messages: readonly PxiMessage[]): ToolProgress[];
|
|
25
|
+
/**
|
|
26
|
+
* Convert a single message part into a {@link ToolProgress}, or `null` if the
|
|
27
|
+
* part isn't a tool call. This is the core mapping that derives the tool name,
|
|
28
|
+
* status label, detail summary, and any error text from the raw SDK part.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getToolProgressFromPart({ part, }: {
|
|
31
|
+
part: UIMessagePart<UIDataTypes, UITools>;
|
|
32
|
+
}): ToolProgress | null;
|
|
33
|
+
/** Concatenate the text of all text parts in a message, ignoring tool parts. */
|
|
34
|
+
export declare function getMessageText({ message }: {
|
|
35
|
+
message: PxiMessage;
|
|
36
|
+
}): string;
|
|
37
|
+
//# sourceMappingURL=toolProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolProgress.d.ts","sourceRoot":"","sources":["../../src/pxi/toolProgress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAE9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;GAMG;AAEH,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GACzB,iBAAiB,GACjB,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,iBAAiB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAoDF;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAC9B,YAAY,EAAE,CAOhB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,GACL,EAAE;IACD,IAAI,EAAE,aAAa,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C,GAAG,YAAY,GAAG,IAAI,CAatB;AAED,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,CAK3E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type guard recognizing the message parts that represent a tool call — both
|
|
3
|
+
* statically-typed (`tool-*`) and dynamic tools — so non-tool parts (like text)
|
|
4
|
+
* are skipped.
|
|
5
|
+
*/
|
|
6
|
+
function isPxiToolPart(part) {
|
|
7
|
+
return ("toolCallId" in part &&
|
|
8
|
+
"state" in part &&
|
|
9
|
+
(part.type === "dynamic-tool" || part.type.startsWith("tool-")));
|
|
10
|
+
}
|
|
11
|
+
function getToolName(part) {
|
|
12
|
+
return part.type === "dynamic-tool"
|
|
13
|
+
? (part.toolName ?? "dynamic-tool")
|
|
14
|
+
: part.type.replace(/^tool-/, "");
|
|
15
|
+
}
|
|
16
|
+
/** Map a lifecycle state to the short human-readable label shown to the user. */
|
|
17
|
+
function getStatusText(state) {
|
|
18
|
+
switch (state) {
|
|
19
|
+
case "input-streaming":
|
|
20
|
+
return "Preparing";
|
|
21
|
+
case "input-available":
|
|
22
|
+
return "Running";
|
|
23
|
+
case "approval-requested":
|
|
24
|
+
return "Awaiting approval";
|
|
25
|
+
case "approval-responded":
|
|
26
|
+
return "Approval recorded";
|
|
27
|
+
case "output-available":
|
|
28
|
+
return "Complete";
|
|
29
|
+
case "output-error":
|
|
30
|
+
return "Failed";
|
|
31
|
+
case "output-denied":
|
|
32
|
+
return "Denied";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Collect the progress of every tool call across a list of messages, in order,
|
|
37
|
+
* skipping non-tool parts.
|
|
38
|
+
*/
|
|
39
|
+
export function getToolProgressFromMessages(messages) {
|
|
40
|
+
return messages.flatMap((message) => message.parts.flatMap((part) => {
|
|
41
|
+
const toolProgress = getToolProgressFromPart({ part });
|
|
42
|
+
return toolProgress ? [toolProgress] : [];
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Convert a single message part into a {@link ToolProgress}, or `null` if the
|
|
47
|
+
* part isn't a tool call. This is the core mapping that derives the tool name,
|
|
48
|
+
* status label, detail summary, and any error text from the raw SDK part.
|
|
49
|
+
*/
|
|
50
|
+
export function getToolProgressFromPart({ part, }) {
|
|
51
|
+
if (!isPxiToolPart(part)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const toolName = getToolName(part);
|
|
55
|
+
const state = part.state;
|
|
56
|
+
return {
|
|
57
|
+
toolCallId: part.toolCallId,
|
|
58
|
+
toolName,
|
|
59
|
+
state,
|
|
60
|
+
statusText: getStatusText(state),
|
|
61
|
+
errorText: "errorText" in part ? part.errorText : undefined,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Concatenate the text of all text parts in a message, ignoring tool parts. */
|
|
65
|
+
export function getMessageText({ message }) {
|
|
66
|
+
return message.parts
|
|
67
|
+
.filter((part) => part.type === "text")
|
|
68
|
+
.map((part) => part.text)
|
|
69
|
+
.join("");
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=toolProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolProgress.js","sourceRoot":"","sources":["../../src/pxi/toolProgress.ts"],"names":[],"mappings":"AAwCA;;;;GAIG;AACH,SAAS,aAAa,CACpB,IAAyC;IAEzC,OAAO,CACL,YAAY,IAAI,IAAI;QACpB,OAAO,IAAI,IAAI;QACf,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAChE,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,IAAiB;IACpC,OAAO,IAAI,CAAC,IAAI,KAAK,cAAc;QACjC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,cAAc,CAAC;QACnC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,iFAAiF;AACjF,SAAS,aAAa,CAAC,KAAwB;IAC7C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,iBAAiB;YACpB,OAAO,WAAW,CAA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AAO,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC;SACtC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;SACxB,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import type { ChatTransport, UIMessage } from "ai";
|
|
2
|
+
import type { PhoenixConfig } from "../config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Shared types for the PXI terminal chat.
|
|
5
|
+
*
|
|
6
|
+
* These mirror the wire contract of the Phoenix server-agent chat endpoint so
|
|
7
|
+
* the CLI and the server stay in lockstep: the CLI sends a {@link PxiChatRequest}
|
|
8
|
+
* and renders the streamed {@link PxiMessage}s it gets back.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Extra metadata the server attaches to each assistant message — the session it
|
|
12
|
+
* belongs to, the Phoenix trace it produced (so the UI can link back to it), and
|
|
13
|
+
* token usage. Fields are nullable because tracing and usage reporting are
|
|
14
|
+
* optional and may be disabled server-side.
|
|
15
|
+
*/
|
|
16
|
+
export type AssistantMessageMetadata = {
|
|
17
|
+
sessionId: string;
|
|
18
|
+
trace?: {
|
|
19
|
+
traceId: string;
|
|
20
|
+
rootSpanId: string;
|
|
21
|
+
} | null;
|
|
22
|
+
usage?: {
|
|
23
|
+
tokens: {
|
|
24
|
+
prompt: number;
|
|
25
|
+
completion: number;
|
|
26
|
+
total: number;
|
|
27
|
+
};
|
|
28
|
+
promptDetails?: {
|
|
29
|
+
cacheRead: number;
|
|
30
|
+
cacheWrite: number;
|
|
31
|
+
} | null;
|
|
32
|
+
} | null;
|
|
33
|
+
};
|
|
34
|
+
/** A chat message (user or assistant) carrying PXI-specific metadata. */
|
|
35
|
+
export type PxiMessage = UIMessage<AssistantMessageMetadata>;
|
|
36
|
+
export type BuiltInProvider = "ANTHROPIC" | "AWS" | "AZURE_OPENAI" | "CEREBRAS" | "DEEPSEEK" | "FIREWORKS" | "GOOGLE" | "GROQ" | "MOONSHOT" | "OLLAMA" | "OPENAI" | "PERPLEXITY" | "TOGETHER" | "XAI";
|
|
37
|
+
/**
|
|
38
|
+
* Which model PXI should talk to. Either a built-in provider keyed by name
|
|
39
|
+
* (e.g. `ANTHROPIC` + `claude-opus-4-6`) or a custom provider configured in
|
|
40
|
+
* Phoenix and addressed by its server-side id.
|
|
41
|
+
*/
|
|
42
|
+
export type ModelSelection = {
|
|
43
|
+
providerType: "builtin";
|
|
44
|
+
provider: BuiltInProvider;
|
|
45
|
+
modelName: string;
|
|
46
|
+
} | {
|
|
47
|
+
providerType: "custom";
|
|
48
|
+
providerId: string;
|
|
49
|
+
modelName: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* A capability/environment hint sent alongside the conversation so the server
|
|
53
|
+
* agent knows what it is allowed to do and the world it is operating in — the
|
|
54
|
+
* caller's local clock and time zone, whether GraphQL mutations are permitted,
|
|
55
|
+
* and whether web access and subagents are enabled for this run.
|
|
56
|
+
*/
|
|
57
|
+
export type PxiContext = {
|
|
58
|
+
type: "app";
|
|
59
|
+
currentDateTime: string;
|
|
60
|
+
timeZone: string;
|
|
61
|
+
} | {
|
|
62
|
+
type: "graphql";
|
|
63
|
+
mutationsEnabled: boolean;
|
|
64
|
+
} | {
|
|
65
|
+
type: "web_access";
|
|
66
|
+
enabled: boolean;
|
|
67
|
+
} | {
|
|
68
|
+
type: "subagents";
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* How edit-style tool calls are gated: `"manual"` requires the user to approve
|
|
73
|
+
* each one, `"bypass"` lets them run unattended (where the server supports it).
|
|
74
|
+
*/
|
|
75
|
+
export type PxiEditPermission = "manual" | "bypass";
|
|
76
|
+
/** The request body POSTed to the Phoenix server-agent chat endpoint. */
|
|
77
|
+
export type PxiChatRequest = {
|
|
78
|
+
id: string;
|
|
79
|
+
messages: PxiMessage[];
|
|
80
|
+
trigger: "submit-message";
|
|
81
|
+
ingestTraces: boolean;
|
|
82
|
+
exportRemoteTraces: boolean;
|
|
83
|
+
attachUserId: boolean;
|
|
84
|
+
editPermission: PxiEditPermission;
|
|
85
|
+
contexts: PxiContext[];
|
|
86
|
+
model: ModelSelection;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* The fully-resolved configuration for a single PXI session, produced by
|
|
90
|
+
* merging CLI flags, the active profile, and defaults. Everything the UI and
|
|
91
|
+
* client need to run is captured here, so the rest of the code can treat it as
|
|
92
|
+
* the single source of truth rather than re-reading flags or config.
|
|
93
|
+
*/
|
|
94
|
+
export type PxiRuntimeOptions = {
|
|
95
|
+
sessionId: string;
|
|
96
|
+
config: PhoenixConfig;
|
|
97
|
+
modelSelection: ModelSelection;
|
|
98
|
+
skipModelPreflight: boolean;
|
|
99
|
+
enableWebAccess: boolean;
|
|
100
|
+
enableSubagents: boolean;
|
|
101
|
+
enableGraphqlMutations: boolean;
|
|
102
|
+
editPermission: PxiEditPermission;
|
|
103
|
+
ingestTraces: boolean;
|
|
104
|
+
exportRemoteTraces: boolean;
|
|
105
|
+
attachUserId: boolean;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The interface the UI uses to talk to PXI. `sendMessage` streams an assistant
|
|
109
|
+
* reply: `onAssistantMessage` fires on every incremental update so the UI can
|
|
110
|
+
* re-render mid-stream, and the promise resolves with the final message (or
|
|
111
|
+
* `null` if nothing was produced). Defining this as an interface lets tests
|
|
112
|
+
* swap in a fake client without a real network transport.
|
|
113
|
+
*/
|
|
114
|
+
export type PxiChatClient = {
|
|
115
|
+
sendMessage: (options: {
|
|
116
|
+
messages: PxiMessage[];
|
|
117
|
+
abortSignal?: AbortSignal;
|
|
118
|
+
onAssistantMessage: (message: PxiMessage) => void;
|
|
119
|
+
}) => Promise<PxiMessage | null>;
|
|
120
|
+
};
|
|
121
|
+
/** The AI SDK chat transport specialized to {@link PxiMessage}. */
|
|
122
|
+
export type PxiTransport = ChatTransport<PxiMessage>;
|
|
123
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pxi/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI,CAAC;IACT,KAAK,CAAC,EAAE;QACN,MAAM,EAAE;YACN,MAAM,EAAE,MAAM,CAAC;YACf,UAAU,EAAE,MAAM,CAAC;YACnB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;QACF,aAAa,CAAC,EAAE;YACd,SAAS,EAAE,MAAM,CAAC;YAClB,UAAU,EAAE,MAAM,CAAC;SACpB,GAAG,IAAI,CAAC;KACV,GAAG,IAAI,CAAC;CACV,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAE7D,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,KAAK,GACL,cAAc,GACd,UAAU,GACV,UAAU,GACV,WAAW,GACX,QAAQ,GACR,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,KAAK,CAAC;AAEV;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB;IACE,YAAY,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;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EAAE,OAAO,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,CAAC,OAAO,EAAE;QACrB,QAAQ,EAAE,UAAU,EAAE,CAAC;QACvB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,kBAAkB,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;KACnD,KAAK,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CAClC,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/pxi/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arizeai/phoenix-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A command-line interface for Phoenix",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arize",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
22
|
"phoenix-cli": "build/index.js",
|
|
23
|
-
"px": "build/index.js"
|
|
23
|
+
"px": "build/index.js",
|
|
24
|
+
"pxi": "build/pxi/index.js"
|
|
24
25
|
},
|
|
25
26
|
"files": [
|
|
26
27
|
"build",
|
|
@@ -32,13 +33,20 @@
|
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@arizeai/openinference-semantic-conventions": "^2.5.0",
|
|
34
35
|
"@clack/prompts": "^1.5.1",
|
|
36
|
+
"ai": "^6.0.208",
|
|
35
37
|
"commander": "^15.0.0",
|
|
38
|
+
"ink": "^6.8.0",
|
|
39
|
+
"marked": "^12.0.2",
|
|
40
|
+
"marked-terminal": "^7.3.0",
|
|
41
|
+
"react": "19.2.7",
|
|
36
42
|
"zod": "^4.4.3",
|
|
37
|
-
"@arizeai/phoenix-client": "6.11.
|
|
43
|
+
"@arizeai/phoenix-client": "6.11.1",
|
|
38
44
|
"@arizeai/phoenix-config": "0.1.4"
|
|
39
45
|
},
|
|
40
46
|
"devDependencies": {
|
|
41
47
|
"@types/node": "^25.9.4",
|
|
48
|
+
"@types/react": "19.2.17",
|
|
49
|
+
"ink-testing-library": "^4.0.0",
|
|
42
50
|
"rimraf": "^6.1.3",
|
|
43
51
|
"tsc-alias": "^1.8.17",
|
|
44
52
|
"tsx": "^4.22.4",
|
|
@@ -48,10 +56,11 @@
|
|
|
48
56
|
"node": ">=20"
|
|
49
57
|
},
|
|
50
58
|
"scripts": {
|
|
51
|
-
"build": "pnpm run build:schema && tsc && tsc-alias && chmod 755 build/index.js",
|
|
59
|
+
"build": "pnpm run build:schema && tsc && tsc-alias && chmod 755 build/index.js build/pxi/index.js",
|
|
52
60
|
"build:schema": "tsx scripts/build-schema.ts && cd ../../.. && js/node_modules/.bin/oxfmt --config .oxfmtrc.jsonc schemas/phoenix-cli-settings.json",
|
|
53
61
|
"clean": "rimraf build",
|
|
54
62
|
"dev": "tsx src/index.ts",
|
|
63
|
+
"dev:pxi": "tsx src/pxi/index.tsx",
|
|
55
64
|
"prebuild": "pnpm run clean",
|
|
56
65
|
"test": "vitest run",
|
|
57
66
|
"test:watch": "vitest watch",
|