@arizeai/phoenix-client 6.9.3 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/__generated__/api/v1.d.ts +72 -20
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.d.ts +3 -0
- package/dist/esm/constants/serverRequirements.d.ts.map +1 -1
- package/dist/esm/constants/serverRequirements.js +24 -0
- package/dist/esm/constants/serverRequirements.js.map +1 -1
- package/dist/esm/sessions/addSessionNote.d.ts +11 -2
- package/dist/esm/sessions/addSessionNote.d.ts.map +1 -1
- package/dist/esm/sessions/addSessionNote.js +12 -3
- package/dist/esm/sessions/addSessionNote.js.map +1 -1
- package/dist/esm/spans/addSpanNote.d.ts +11 -5
- package/dist/esm/spans/addSpanNote.d.ts.map +1 -1
- package/dist/esm/spans/addSpanNote.js +13 -5
- package/dist/esm/spans/addSpanNote.js.map +1 -1
- package/dist/esm/spans/getSpanAnnotations.d.ts +1 -1
- package/dist/esm/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/esm/traces/addTraceNote.d.ts +11 -5
- package/dist/esm/traces/addTraceNote.d.ts.map +1 -1
- package/dist/esm/traces/addTraceNote.js +12 -6
- package/dist/esm/traces/addTraceNote.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +72 -20
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.d.ts +3 -0
- package/dist/src/constants/serverRequirements.d.ts.map +1 -1
- package/dist/src/constants/serverRequirements.js +25 -1
- package/dist/src/constants/serverRequirements.js.map +1 -1
- package/dist/src/sessions/addSessionNote.d.ts +11 -2
- package/dist/src/sessions/addSessionNote.d.ts.map +1 -1
- package/dist/src/sessions/addSessionNote.js +11 -2
- package/dist/src/sessions/addSessionNote.js.map +1 -1
- package/dist/src/spans/addSpanNote.d.ts +11 -5
- package/dist/src/spans/addSpanNote.d.ts.map +1 -1
- package/dist/src/spans/addSpanNote.js +13 -5
- package/dist/src/spans/addSpanNote.js.map +1 -1
- package/dist/src/spans/getSpanAnnotations.d.ts +1 -1
- package/dist/src/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/src/traces/addTraceNote.d.ts +11 -5
- package/dist/src/traces/addTraceNote.d.ts.map +1 -1
- package/dist/src/traces/addTraceNote.js +11 -5
- package/dist/src/traces/addTraceNote.js.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/__generated__/api/v1.ts +72 -20
- package/src/constants/serverRequirements.ts +27 -0
- package/src/sessions/addSessionNote.ts +22 -3
- package/src/spans/addSpanNote.ts +20 -5
- package/src/spans/getSpanAnnotations.ts +1 -1
- package/src/traces/addTraceNote.ts +22 -6
package/package.json
CHANGED
|
@@ -573,7 +573,7 @@ export interface paths {
|
|
|
573
573
|
put?: never;
|
|
574
574
|
/**
|
|
575
575
|
* Create a trace note
|
|
576
|
-
* @description Add a note annotation to a trace.
|
|
576
|
+
* @description Add a note annotation to a trace. By default each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same trace. Callers may supply a non-empty `identifier` to upsert on (trace_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note, matching the semantics of structured annotations.
|
|
577
577
|
*/
|
|
578
578
|
post: operations["createTraceNote"];
|
|
579
579
|
delete?: never;
|
|
@@ -678,7 +678,7 @@ export interface paths {
|
|
|
678
678
|
put?: never;
|
|
679
679
|
/**
|
|
680
680
|
* Create a span note
|
|
681
|
-
* @description Add a note annotation to a span.
|
|
681
|
+
* @description Add a note annotation to a span. By default each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same span. Callers may supply a non-empty `identifier` to upsert on (span_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note, matching the semantics of structured annotations.
|
|
682
682
|
*/
|
|
683
683
|
post: operations["createSpanNote"];
|
|
684
684
|
delete?: never;
|
|
@@ -1029,7 +1029,7 @@ export interface paths {
|
|
|
1029
1029
|
put?: never;
|
|
1030
1030
|
/**
|
|
1031
1031
|
* Create a session note
|
|
1032
|
-
* @description Add a note annotation to a session.
|
|
1032
|
+
* @description Add a note annotation to a session. By default each call appends a new note with an auto-generated UUIDv4 identifier, so multiple notes accumulate on the same session. Callers may supply a non-empty `identifier` to upsert on (session_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note, matching the semantics of structured annotations.
|
|
1033
1033
|
*/
|
|
1034
1034
|
post: operations["createSessionNote"];
|
|
1035
1035
|
delete?: never;
|
|
@@ -1558,6 +1558,31 @@ export interface components {
|
|
|
1558
1558
|
/** Parts */
|
|
1559
1559
|
parts: (components["schemas"]["TextUIPart"] | components["schemas"]["ReasoningUIPart"] | components["schemas"]["ToolInputStreamingPart"] | components["schemas"]["ToolInputAvailablePart"] | components["schemas"]["ToolOutputAvailablePart"] | components["schemas"]["ToolOutputErrorPart"] | components["schemas"]["ToolApprovalRequestedPart"] | components["schemas"]["ToolApprovalRespondedPart"] | components["schemas"]["ToolOutputDeniedPart"] | components["schemas"]["DynamicToolInputStreamingPart"] | components["schemas"]["DynamicToolInputAvailablePart"] | components["schemas"]["DynamicToolOutputAvailablePart"] | components["schemas"]["DynamicToolOutputErrorPart"] | components["schemas"]["DynamicToolApprovalRequestedPart"] | components["schemas"]["DynamicToolApprovalRespondedPart"] | components["schemas"]["DynamicToolOutputDeniedPart"] | components["schemas"]["SourceUrlUIPart"] | components["schemas"]["SourceDocumentUIPart"] | components["schemas"]["FileUIPart"] | components["schemas"]["DataUIPart"] | components["schemas"]["StepStartUIPart"])[];
|
|
1560
1560
|
};
|
|
1561
|
+
/**
|
|
1562
|
+
* BuiltInProviderModelSelection
|
|
1563
|
+
* @description Chat against a Phoenix built-in provider.
|
|
1564
|
+
*
|
|
1565
|
+
* Credentials and connection details (base URL, Azure endpoint, AWS
|
|
1566
|
+
* region) are resolved from the secret store first and the process
|
|
1567
|
+
* environment second. ``openai_api_type`` is honoured by the OpenAI and
|
|
1568
|
+
* Azure OpenAI branches; other providers ignore it.
|
|
1569
|
+
*/
|
|
1570
|
+
BuiltInProviderModelSelection: {
|
|
1571
|
+
/**
|
|
1572
|
+
* @description discriminator enum property added by openapi-typescript
|
|
1573
|
+
* @enum {string}
|
|
1574
|
+
*/
|
|
1575
|
+
providerType: "builtin";
|
|
1576
|
+
provider: components["schemas"]["ModelProvider"];
|
|
1577
|
+
/** Modelname */
|
|
1578
|
+
modelName: string;
|
|
1579
|
+
/**
|
|
1580
|
+
* Openaiapitype
|
|
1581
|
+
* @default responses
|
|
1582
|
+
* @enum {string}
|
|
1583
|
+
*/
|
|
1584
|
+
openaiApiType?: "chat_completions" | "responses";
|
|
1585
|
+
};
|
|
1561
1586
|
/** CategoricalAnnotationConfig */
|
|
1562
1587
|
CategoricalAnnotationConfig: {
|
|
1563
1588
|
/** Name */
|
|
@@ -1635,6 +1660,8 @@ export interface components {
|
|
|
1635
1660
|
/** Contexts */
|
|
1636
1661
|
contexts?: components["schemas"]["ChatContext"][];
|
|
1637
1662
|
capabilities?: components["schemas"]["AgentCapabilities"];
|
|
1663
|
+
/** Model */
|
|
1664
|
+
model: components["schemas"]["CustomProviderModelSelection"] | components["schemas"]["BuiltInProviderModelSelection"];
|
|
1638
1665
|
} & {
|
|
1639
1666
|
[key: string]: unknown;
|
|
1640
1667
|
};
|
|
@@ -1670,6 +1697,8 @@ export interface components {
|
|
|
1670
1697
|
/** Contexts */
|
|
1671
1698
|
contexts?: components["schemas"]["ChatContext"][];
|
|
1672
1699
|
capabilities?: components["schemas"]["AgentCapabilities"];
|
|
1700
|
+
/** Model */
|
|
1701
|
+
model: components["schemas"]["CustomProviderModelSelection"] | components["schemas"]["BuiltInProviderModelSelection"];
|
|
1673
1702
|
} & {
|
|
1674
1703
|
[key: string]: unknown;
|
|
1675
1704
|
};
|
|
@@ -1888,6 +1917,21 @@ export interface components {
|
|
|
1888
1917
|
/** Data */
|
|
1889
1918
|
data: components["schemas"]["LocalUser"] | components["schemas"]["OAuth2User"] | components["schemas"]["LDAPUser"];
|
|
1890
1919
|
};
|
|
1920
|
+
/**
|
|
1921
|
+
* CustomProviderModelSelection
|
|
1922
|
+
* @description Chat against a stored custom provider record.
|
|
1923
|
+
*/
|
|
1924
|
+
CustomProviderModelSelection: {
|
|
1925
|
+
/**
|
|
1926
|
+
* @description discriminator enum property added by openapi-typescript
|
|
1927
|
+
* @enum {string}
|
|
1928
|
+
*/
|
|
1929
|
+
providerType: "custom";
|
|
1930
|
+
/** Providerid */
|
|
1931
|
+
providerId: string;
|
|
1932
|
+
/** Modelname */
|
|
1933
|
+
modelName: string;
|
|
1934
|
+
};
|
|
1891
1935
|
/**
|
|
1892
1936
|
* DataUIPart
|
|
1893
1937
|
* @description Data part with dynamic type based on data name.
|
|
@@ -3984,6 +4028,12 @@ export interface components {
|
|
|
3984
4028
|
* @description The note text to add to the session
|
|
3985
4029
|
*/
|
|
3986
4030
|
note: string;
|
|
4031
|
+
/**
|
|
4032
|
+
* Identifier
|
|
4033
|
+
* @description Optional caller-supplied identifier. When non-empty, the note is upserted on (session_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note. When omitted or empty, the server stamps a unique 'px-session-note:<uuid>' identifier so each call appends a new note.
|
|
4034
|
+
* @default
|
|
4035
|
+
*/
|
|
4036
|
+
identifier?: string;
|
|
3987
4037
|
};
|
|
3988
4038
|
/** SessionTraceData */
|
|
3989
4039
|
SessionTraceData: {
|
|
@@ -4327,6 +4377,12 @@ export interface components {
|
|
|
4327
4377
|
* @description The note text to add to the span
|
|
4328
4378
|
*/
|
|
4329
4379
|
note: string;
|
|
4380
|
+
/**
|
|
4381
|
+
* Identifier
|
|
4382
|
+
* @description Optional caller-supplied identifier. When non-empty, the note is upserted on (span_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note. When omitted or empty, the server stamps a unique 'px-span-note:<uuid>' identifier so each call appends a new note.
|
|
4383
|
+
* @default
|
|
4384
|
+
*/
|
|
4385
|
+
identifier?: string;
|
|
4330
4386
|
};
|
|
4331
4387
|
/** SpansResponseBody */
|
|
4332
4388
|
SpansResponseBody: {
|
|
@@ -4798,6 +4854,12 @@ export interface components {
|
|
|
4798
4854
|
* @description The note text to add to the trace
|
|
4799
4855
|
*/
|
|
4800
4856
|
note: string;
|
|
4857
|
+
/**
|
|
4858
|
+
* Identifier
|
|
4859
|
+
* @description Optional caller-supplied identifier. When non-empty, the note is upserted on (trace_id, name='note', identifier) — repeated calls with the same identifier overwrite the existing note. When omitted or empty, the server stamps a unique 'px-trace-note:<uuid>' identifier so each call appends a new note.
|
|
4860
|
+
* @default
|
|
4861
|
+
*/
|
|
4862
|
+
identifier?: string;
|
|
4801
4863
|
};
|
|
4802
4864
|
/** TraceSpanData */
|
|
4803
4865
|
TraceSpanData: {
|
|
@@ -4985,6 +5047,8 @@ export interface components {
|
|
|
4985
5047
|
exportRemoteTraces?: boolean;
|
|
4986
5048
|
/** Messages */
|
|
4987
5049
|
messages: components["schemas"]["UIMessage"][];
|
|
5050
|
+
/** Model */
|
|
5051
|
+
model: components["schemas"]["CustomProviderModelSelection"] | components["schemas"]["BuiltInProviderModelSelection"];
|
|
4988
5052
|
};
|
|
4989
5053
|
/** _SummarizeResponse */
|
|
4990
5054
|
_SummarizeResponse: {
|
|
@@ -5219,7 +5283,7 @@ export interface operations {
|
|
|
5219
5283
|
span_ids?: string[] | null;
|
|
5220
5284
|
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `span_ids` must be supplied. When combined with `span_ids`, results are the AND-intersection of both filters. */
|
|
5221
5285
|
identifier?: string[] | null;
|
|
5222
|
-
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned.
|
|
5286
|
+
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned (allowlist). When omitted, the response includes every matching row regardless of name (no annotation names are excluded by default). */
|
|
5223
5287
|
include_annotation_names?: string[] | null;
|
|
5224
5288
|
/** @description Optional list of annotation names to exclude from results. */
|
|
5225
5289
|
exclude_annotation_names?: string[] | null;
|
|
@@ -5343,7 +5407,7 @@ export interface operations {
|
|
|
5343
5407
|
trace_ids?: string[] | null;
|
|
5344
5408
|
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `trace_ids` must be supplied. When combined with `trace_ids`, results are the AND-intersection of both filters. */
|
|
5345
5409
|
identifier?: string[] | null;
|
|
5346
|
-
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned.
|
|
5410
|
+
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned (allowlist). When omitted, the response includes every matching row regardless of name (no annotation names are excluded by default). */
|
|
5347
5411
|
include_annotation_names?: string[] | null;
|
|
5348
5412
|
/** @description Optional list of annotation names to exclude from results. */
|
|
5349
5413
|
exclude_annotation_names?: string[] | null;
|
|
@@ -5467,7 +5531,7 @@ export interface operations {
|
|
|
5467
5531
|
session_ids?: string[] | null;
|
|
5468
5532
|
/** @description Optional list of annotation identifiers to filter by. Each value must be non-empty. If omitted, `session_ids` must be supplied. When combined with `session_ids`, results are the AND-intersection of both filters. */
|
|
5469
5533
|
identifier?: string[] | null;
|
|
5470
|
-
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned.
|
|
5534
|
+
/** @description Optional list of annotation names to include. If provided, only annotations with these names will be returned (allowlist). When omitted, the response includes every matching row regardless of name (no annotation names are excluded by default). */
|
|
5471
5535
|
include_annotation_names?: string[] | null;
|
|
5472
5536
|
/** @description Optional list of annotation names to exclude from results. */
|
|
5473
5537
|
exclude_annotation_names?: string[] | null;
|
|
@@ -8802,13 +8866,7 @@ export interface operations {
|
|
|
8802
8866
|
};
|
|
8803
8867
|
chat_agents__agent_id__sessions__session_id__chat_post: {
|
|
8804
8868
|
parameters: {
|
|
8805
|
-
query
|
|
8806
|
-
provider_type: "custom" | "builtin";
|
|
8807
|
-
model_name: string;
|
|
8808
|
-
provider_id?: string | null;
|
|
8809
|
-
provider?: components["schemas"]["ModelProvider"] | null;
|
|
8810
|
-
openai_api_type?: "chat_completions" | "responses";
|
|
8811
|
-
};
|
|
8869
|
+
query?: never;
|
|
8812
8870
|
header?: never;
|
|
8813
8871
|
path: {
|
|
8814
8872
|
agent_id: string;
|
|
@@ -8844,13 +8902,7 @@ export interface operations {
|
|
|
8844
8902
|
};
|
|
8845
8903
|
summarize_endpoint_agents__agent_id__sessions__session_id__summary_post: {
|
|
8846
8904
|
parameters: {
|
|
8847
|
-
query
|
|
8848
|
-
provider_type: "custom" | "builtin";
|
|
8849
|
-
model_name: string;
|
|
8850
|
-
provider_id?: string | null;
|
|
8851
|
-
provider?: components["schemas"]["ModelProvider"] | null;
|
|
8852
|
-
openai_api_type?: "chat_completions" | "responses";
|
|
8853
|
-
};
|
|
8905
|
+
query?: never;
|
|
8854
8906
|
header?: never;
|
|
8855
8907
|
path: {
|
|
8856
8908
|
agent_id: string;
|
|
@@ -106,6 +106,30 @@ export const DATASET_UPLOAD_EXAMPLE_IDS: ParameterRequirement = {
|
|
|
106
106
|
minServerVersion: [15, 0, 0],
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
+
export const ADD_TRACE_NOTE_IDENTIFIER: ParameterRequirement = {
|
|
110
|
+
kind: "parameter",
|
|
111
|
+
parameterName: "identifier",
|
|
112
|
+
parameterLocation: "body",
|
|
113
|
+
route: "POST /v1/trace_notes",
|
|
114
|
+
minServerVersion: [15, 5, 0],
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const ADD_SPAN_NOTE_IDENTIFIER: ParameterRequirement = {
|
|
118
|
+
kind: "parameter",
|
|
119
|
+
parameterName: "identifier",
|
|
120
|
+
parameterLocation: "body",
|
|
121
|
+
route: "POST /v1/span_notes",
|
|
122
|
+
minServerVersion: [15, 5, 0],
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const ADD_SESSION_NOTE_IDENTIFIER: ParameterRequirement = {
|
|
126
|
+
kind: "parameter",
|
|
127
|
+
parameterName: "identifier",
|
|
128
|
+
parameterLocation: "body",
|
|
129
|
+
route: "POST /v1/session_notes",
|
|
130
|
+
minServerVersion: [15, 5, 0],
|
|
131
|
+
};
|
|
132
|
+
|
|
109
133
|
/**
|
|
110
134
|
* Aggregate list of every known capability requirement.
|
|
111
135
|
*
|
|
@@ -125,4 +149,7 @@ export const ALL_REQUIREMENTS: readonly CapabilityRequirement[] = [
|
|
|
125
149
|
GET_SPANS_BY_ATTRIBUTE,
|
|
126
150
|
LIST_PROJECT_TRACES,
|
|
127
151
|
DATASET_UPLOAD_EXAMPLE_IDS,
|
|
152
|
+
ADD_TRACE_NOTE_IDENTIFIER,
|
|
153
|
+
ADD_SPAN_NOTE_IDENTIFIER,
|
|
154
|
+
ADD_SESSION_NOTE_IDENTIFIER,
|
|
128
155
|
] as const;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createClient } from "../client";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ADD_SESSION_NOTE,
|
|
4
|
+
ADD_SESSION_NOTE_IDENTIFIER,
|
|
5
|
+
} from "../constants/serverRequirements";
|
|
3
6
|
import type { ClientFn } from "../types/core";
|
|
4
7
|
import { formatApiError } from "../utils/apiErrorUtils";
|
|
5
8
|
import { ensureServerCapability } from "../utils/serverVersionUtils";
|
|
@@ -16,6 +19,13 @@ export interface SessionNote {
|
|
|
16
19
|
* The note text to add to the session.
|
|
17
20
|
*/
|
|
18
21
|
note: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional caller-supplied identifier. When non-empty, the note is upserted
|
|
24
|
+
* on `(sessionId, name='note', identifier)` — repeated calls with the same
|
|
25
|
+
* identifier overwrite the existing note. When omitted, the server stamps a
|
|
26
|
+
* unique `px-session-note:<uuid>` identifier so each call appends a new note.
|
|
27
|
+
*/
|
|
28
|
+
identifier?: string;
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
/**
|
|
@@ -28,8 +38,10 @@ export interface AddSessionNoteParams extends ClientFn {
|
|
|
28
38
|
/**
|
|
29
39
|
* Add a note to a session.
|
|
30
40
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
41
|
+
* When `sessionNote.identifier` is omitted, each call appends a new note with
|
|
42
|
+
* an auto-generated identifier. When `identifier` is non-empty, repeated calls
|
|
43
|
+
* with the same `(sessionId, name='note', identifier)` overwrite the existing
|
|
44
|
+
* note.
|
|
33
45
|
*
|
|
34
46
|
* @param params - The parameters to add a session note.
|
|
35
47
|
* @returns The ID of the created note annotation.
|
|
@@ -52,12 +64,19 @@ export async function addSessionNote({
|
|
|
52
64
|
}: AddSessionNoteParams): Promise<{ id: string }> {
|
|
53
65
|
const client = _client ?? createClient();
|
|
54
66
|
await ensureServerCapability({ client, requirement: ADD_SESSION_NOTE });
|
|
67
|
+
if (sessionNote.identifier) {
|
|
68
|
+
await ensureServerCapability({
|
|
69
|
+
client,
|
|
70
|
+
requirement: ADD_SESSION_NOTE_IDENTIFIER,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
55
73
|
|
|
56
74
|
const { data, error } = await client.POST("/v1/session_notes", {
|
|
57
75
|
body: {
|
|
58
76
|
data: {
|
|
59
77
|
session_id: sessionNote.sessionId.trim(),
|
|
60
78
|
note: sessionNote.note,
|
|
79
|
+
identifier: sessionNote.identifier,
|
|
61
80
|
},
|
|
62
81
|
},
|
|
63
82
|
});
|
package/src/spans/addSpanNote.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createClient } from "../client";
|
|
2
|
+
import { ADD_SPAN_NOTE_IDENTIFIER } from "../constants/serverRequirements";
|
|
2
3
|
import type { ClientFn } from "../types/core";
|
|
3
4
|
import { formatApiError } from "../utils/apiErrorUtils";
|
|
5
|
+
import { ensureServerCapability } from "../utils/serverVersionUtils";
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Parameters for a single span note
|
|
@@ -14,6 +16,13 @@ export interface SpanNote {
|
|
|
14
16
|
* The note text to add to the span
|
|
15
17
|
*/
|
|
16
18
|
note: string;
|
|
19
|
+
/**
|
|
20
|
+
* Optional caller-supplied identifier. When non-empty, the note is upserted
|
|
21
|
+
* on `(spanId, name='note', identifier)` — repeated calls with the same
|
|
22
|
+
* identifier overwrite the existing note. When omitted, the server stamps a
|
|
23
|
+
* unique `px-span-note:<uuid>` identifier so each call appends a new note.
|
|
24
|
+
*/
|
|
25
|
+
identifier?: string;
|
|
17
26
|
}
|
|
18
27
|
|
|
19
28
|
/**
|
|
@@ -26,11 +35,10 @@ export interface AddSpanNoteParams extends ClientFn {
|
|
|
26
35
|
/**
|
|
27
36
|
* Add a note to a span.
|
|
28
37
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* identifiers; otherwise re-writing the same name overwrites the existing one.
|
|
38
|
+
* When `spanNote.identifier` is omitted, each call appends a new note with an
|
|
39
|
+
* auto-generated identifier. When `identifier` is non-empty, repeated calls
|
|
40
|
+
* with the same `(spanId, name='note', identifier)` overwrite the existing
|
|
41
|
+
* note.
|
|
34
42
|
*
|
|
35
43
|
* @param params - The parameters to add a span note
|
|
36
44
|
* @returns The ID of the created note annotation
|
|
@@ -50,12 +58,19 @@ export async function addSpanNote({
|
|
|
50
58
|
spanNote,
|
|
51
59
|
}: AddSpanNoteParams): Promise<{ id: string }> {
|
|
52
60
|
const client = _client ?? createClient();
|
|
61
|
+
if (spanNote.identifier) {
|
|
62
|
+
await ensureServerCapability({
|
|
63
|
+
client,
|
|
64
|
+
requirement: ADD_SPAN_NOTE_IDENTIFIER,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
53
67
|
|
|
54
68
|
const { data, error } = await client.POST("/v1/span_notes", {
|
|
55
69
|
body: {
|
|
56
70
|
data: {
|
|
57
71
|
span_id: spanNote.spanId.trim(),
|
|
58
72
|
note: spanNote.note,
|
|
73
|
+
identifier: spanNote.identifier,
|
|
59
74
|
},
|
|
60
75
|
},
|
|
61
76
|
});
|
|
@@ -12,7 +12,7 @@ export interface GetSpanAnnotationsParams extends ClientFn {
|
|
|
12
12
|
project: ProjectIdentifier;
|
|
13
13
|
/** One or more span IDs to fetch annotations for */
|
|
14
14
|
spanIds: string[];
|
|
15
|
-
/** Optional list of annotation names to include. If provided, only annotations with these names will be returned.
|
|
15
|
+
/** Optional list of annotation names to include. If provided, only annotations with these names will be returned (allowlist). When omitted, the response includes every matching row regardless of name (no annotation names are excluded by default). */
|
|
16
16
|
includeAnnotationNames?: string[];
|
|
17
17
|
/** Optional list of annotation names to exclude from results. */
|
|
18
18
|
excludeAnnotationNames?: string[];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createClient } from "../client";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ADD_TRACE_NOTE,
|
|
4
|
+
ADD_TRACE_NOTE_IDENTIFIER,
|
|
5
|
+
} from "../constants/serverRequirements";
|
|
3
6
|
import type { ClientFn } from "../types/core";
|
|
4
7
|
import { formatApiError } from "../utils/apiErrorUtils";
|
|
5
8
|
import { ensureServerCapability } from "../utils/serverVersionUtils";
|
|
@@ -16,6 +19,13 @@ export interface TraceNote {
|
|
|
16
19
|
* The note text to add to the trace.
|
|
17
20
|
*/
|
|
18
21
|
note: string;
|
|
22
|
+
/**
|
|
23
|
+
* Optional caller-supplied identifier. When non-empty, the note is upserted
|
|
24
|
+
* on `(traceId, name='note', identifier)` — repeated calls with the same
|
|
25
|
+
* identifier overwrite the existing note. When omitted, the server stamps a
|
|
26
|
+
* unique `px-trace-note:<uuid>` identifier so each call appends a new note.
|
|
27
|
+
*/
|
|
28
|
+
identifier?: string;
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
/**
|
|
@@ -28,11 +38,10 @@ export interface AddTraceNoteParams extends ClientFn {
|
|
|
28
38
|
/**
|
|
29
39
|
* Add a note to a trace.
|
|
30
40
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* identifiers; otherwise re-writing the same name overwrites the existing one.
|
|
41
|
+
* When `traceNote.identifier` is omitted, each call appends a new note with an
|
|
42
|
+
* auto-generated identifier. When `identifier` is non-empty, repeated calls
|
|
43
|
+
* with the same `(traceId, name='note', identifier)` overwrite the existing
|
|
44
|
+
* note.
|
|
36
45
|
*
|
|
37
46
|
* @param params - The parameters to add a trace note.
|
|
38
47
|
* @returns The ID of the created note annotation.
|
|
@@ -53,12 +62,19 @@ export async function addTraceNote({
|
|
|
53
62
|
}: AddTraceNoteParams): Promise<{ id: string }> {
|
|
54
63
|
const client = _client ?? createClient();
|
|
55
64
|
await ensureServerCapability({ client, requirement: ADD_TRACE_NOTE });
|
|
65
|
+
if (traceNote.identifier) {
|
|
66
|
+
await ensureServerCapability({
|
|
67
|
+
client,
|
|
68
|
+
requirement: ADD_TRACE_NOTE_IDENTIFIER,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
56
71
|
|
|
57
72
|
const { data, error } = await client.POST("/v1/trace_notes", {
|
|
58
73
|
body: {
|
|
59
74
|
data: {
|
|
60
75
|
trace_id: traceNote.traceId.trim(),
|
|
61
76
|
note: traceNote.note,
|
|
77
|
+
identifier: traceNote.identifier,
|
|
62
78
|
},
|
|
63
79
|
},
|
|
64
80
|
});
|