tracia 0.3.9 → 0.3.10
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/index.d.mts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,12 @@ interface RunOptions {
|
|
|
11
11
|
tags?: string[];
|
|
12
12
|
userId?: string;
|
|
13
13
|
sessionId?: string;
|
|
14
|
+
/** Trace ID to group related spans together */
|
|
15
|
+
traceId?: string;
|
|
16
|
+
/** Parent span ID for chaining spans in a sequence */
|
|
17
|
+
parentSpanId?: string;
|
|
18
|
+
/** Full conversation messages for multi-turn (skips template rendering) */
|
|
19
|
+
messages?: LocalPromptMessage[];
|
|
14
20
|
}
|
|
15
21
|
interface TokenUsage {
|
|
16
22
|
inputTokens: number;
|
|
@@ -33,6 +39,8 @@ interface RunResult {
|
|
|
33
39
|
toolCalls?: ToolCall[];
|
|
34
40
|
/** Parsed JSON when the prompt has an output schema configured */
|
|
35
41
|
structuredOutput?: Record<string, unknown>;
|
|
42
|
+
/** Full conversation messages for multi-turn continuation */
|
|
43
|
+
messages?: LocalPromptMessage[];
|
|
36
44
|
}
|
|
37
45
|
declare enum TraciaErrorCode {
|
|
38
46
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
@@ -66,6 +74,7 @@ interface ApiSuccessResponse {
|
|
|
66
74
|
finishReason?: FinishReason;
|
|
67
75
|
toolCalls?: ToolCall[];
|
|
68
76
|
structuredOutput?: Record<string, unknown>;
|
|
77
|
+
messages?: LocalPromptMessage[];
|
|
69
78
|
}
|
|
70
79
|
type MessageRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool';
|
|
71
80
|
interface PromptMessage {
|
|
@@ -112,7 +121,7 @@ type SpanStatus = 'SUCCESS' | 'ERROR';
|
|
|
112
121
|
interface SpanListItem {
|
|
113
122
|
id: string;
|
|
114
123
|
spanId: string;
|
|
115
|
-
traceId: string;
|
|
124
|
+
traceId: string | null;
|
|
116
125
|
parentSpanId: string | null;
|
|
117
126
|
promptSlug: string;
|
|
118
127
|
model: string;
|
|
@@ -127,7 +136,7 @@ interface SpanListItem {
|
|
|
127
136
|
interface Span {
|
|
128
137
|
id: string;
|
|
129
138
|
spanId: string;
|
|
130
|
-
traceId: string;
|
|
139
|
+
traceId: string | null;
|
|
131
140
|
parentSpanId: string | null;
|
|
132
141
|
promptSlug: string;
|
|
133
142
|
promptVersion: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ interface RunOptions {
|
|
|
11
11
|
tags?: string[];
|
|
12
12
|
userId?: string;
|
|
13
13
|
sessionId?: string;
|
|
14
|
+
/** Trace ID to group related spans together */
|
|
15
|
+
traceId?: string;
|
|
16
|
+
/** Parent span ID for chaining spans in a sequence */
|
|
17
|
+
parentSpanId?: string;
|
|
18
|
+
/** Full conversation messages for multi-turn (skips template rendering) */
|
|
19
|
+
messages?: LocalPromptMessage[];
|
|
14
20
|
}
|
|
15
21
|
interface TokenUsage {
|
|
16
22
|
inputTokens: number;
|
|
@@ -33,6 +39,8 @@ interface RunResult {
|
|
|
33
39
|
toolCalls?: ToolCall[];
|
|
34
40
|
/** Parsed JSON when the prompt has an output schema configured */
|
|
35
41
|
structuredOutput?: Record<string, unknown>;
|
|
42
|
+
/** Full conversation messages for multi-turn continuation */
|
|
43
|
+
messages?: LocalPromptMessage[];
|
|
36
44
|
}
|
|
37
45
|
declare enum TraciaErrorCode {
|
|
38
46
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
@@ -66,6 +74,7 @@ interface ApiSuccessResponse {
|
|
|
66
74
|
finishReason?: FinishReason;
|
|
67
75
|
toolCalls?: ToolCall[];
|
|
68
76
|
structuredOutput?: Record<string, unknown>;
|
|
77
|
+
messages?: LocalPromptMessage[];
|
|
69
78
|
}
|
|
70
79
|
type MessageRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool';
|
|
71
80
|
interface PromptMessage {
|
|
@@ -112,7 +121,7 @@ type SpanStatus = 'SUCCESS' | 'ERROR';
|
|
|
112
121
|
interface SpanListItem {
|
|
113
122
|
id: string;
|
|
114
123
|
spanId: string;
|
|
115
|
-
traceId: string;
|
|
124
|
+
traceId: string | null;
|
|
116
125
|
parentSpanId: string | null;
|
|
117
126
|
promptSlug: string;
|
|
118
127
|
model: string;
|
|
@@ -127,7 +136,7 @@ interface SpanListItem {
|
|
|
127
136
|
interface Span {
|
|
128
137
|
id: string;
|
|
129
138
|
spanId: string;
|
|
130
|
-
traceId: string;
|
|
139
|
+
traceId: string | null;
|
|
131
140
|
parentSpanId: string | null;
|
|
132
141
|
promptSlug: string;
|
|
133
142
|
promptVersion: number;
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var LLMProvider = /* @__PURE__ */ ((LLMProvider2) => {
|
|
|
76
76
|
})(LLMProvider || {});
|
|
77
77
|
|
|
78
78
|
// src/client.ts
|
|
79
|
-
var SDK_VERSION = "0.3.
|
|
79
|
+
var SDK_VERSION = "0.3.10";
|
|
80
80
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
81
81
|
function mapApiErrorCodeToTraciaErrorCode(apiCode) {
|
|
82
82
|
const codeMap = {
|
|
@@ -210,6 +210,15 @@ var Prompts = class {
|
|
|
210
210
|
if (options?.sessionId) {
|
|
211
211
|
requestBody.sessionId = options.sessionId;
|
|
212
212
|
}
|
|
213
|
+
if (options?.traceId) {
|
|
214
|
+
requestBody.traceId = options.traceId;
|
|
215
|
+
}
|
|
216
|
+
if (options?.parentSpanId) {
|
|
217
|
+
requestBody.parentSpanId = options.parentSpanId;
|
|
218
|
+
}
|
|
219
|
+
if (options?.messages && options.messages.length > 0) {
|
|
220
|
+
requestBody.messages = options.messages;
|
|
221
|
+
}
|
|
213
222
|
const response = await this.client.post(
|
|
214
223
|
`/api/v1/prompts/${encodeURIComponent(slug)}/run`,
|
|
215
224
|
requestBody
|
|
@@ -224,7 +233,8 @@ var Prompts = class {
|
|
|
224
233
|
cost: response.cost,
|
|
225
234
|
finishReason: response.finishReason,
|
|
226
235
|
toolCalls: response.toolCalls,
|
|
227
|
-
structuredOutput: response.structuredOutput
|
|
236
|
+
structuredOutput: response.structuredOutput,
|
|
237
|
+
messages: response.messages
|
|
228
238
|
};
|
|
229
239
|
}
|
|
230
240
|
};
|