@poncho-ai/sdk 0.5.0 → 1.0.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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +12 -0
- package/dist/index.d.ts +25 -2
- package/dist/index.js +6 -1
- package/package.json +1 -1
- package/src/index.ts +35 -1
- package/.turbo/turbo-test.log +0 -14
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/sdk@0.
|
|
2
|
+
> @poncho-ai/sdk@1.0.0 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
|
|
3
3
|
> tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mESM[39m [1mdist/index.js [22m[32m6.
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m6.37 KB[39m
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 20ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
14
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1218ms
|
|
14
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m13.27 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @poncho-ai/sdk
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`035e8b3`](https://github.com/cesr/poncho-ai/commit/035e8b300ac4de6e7cbc4e2ab6bd06cdfd0e1ae3) Thanks [@cesr](https://github.com/cesr)! - Add multimodal file support for agents — images, PDFs, and text files can be uploaded via the web UI, HTTP API, and terminal CLI. Includes pluggable upload storage (local, Vercel Blob, S3), write-behind caching, build-time dependency injection, and graceful handling of unsupported formats.
|
|
8
|
+
|
|
9
|
+
## 0.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`a1df23f`](https://github.com/cesr/poncho-ai/commit/a1df23f339d815c30948ebcd275209366a3d2a72) Thanks [@cesr](https://github.com/cesr)! - Add cooperative run cancellation: stop active runs via Ctrl+C (CLI), stop button (Web UI), or the /stop API endpoint. Partial output is preserved and empty assistant messages are skipped to prevent conversation corruption.
|
|
14
|
+
|
|
3
15
|
## 0.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -302,9 +302,21 @@ type JsonSchema = {
|
|
|
302
302
|
[key: string]: unknown;
|
|
303
303
|
};
|
|
304
304
|
type Role = "system" | "user" | "assistant" | "tool";
|
|
305
|
+
interface TextContentPart {
|
|
306
|
+
type: "text";
|
|
307
|
+
text: string;
|
|
308
|
+
}
|
|
309
|
+
interface FileContentPart {
|
|
310
|
+
type: "file";
|
|
311
|
+
/** base64 data, data: URI, https:// URL, or poncho-upload:// reference */
|
|
312
|
+
data: string;
|
|
313
|
+
mediaType: string;
|
|
314
|
+
filename?: string;
|
|
315
|
+
}
|
|
316
|
+
type ContentPart = TextContentPart | FileContentPart;
|
|
305
317
|
interface Message {
|
|
306
318
|
role: Role;
|
|
307
|
-
content: string;
|
|
319
|
+
content: string | ContentPart[];
|
|
308
320
|
metadata?: {
|
|
309
321
|
id?: string;
|
|
310
322
|
timestamp?: number;
|
|
@@ -317,6 +329,8 @@ interface Message {
|
|
|
317
329
|
}>;
|
|
318
330
|
};
|
|
319
331
|
}
|
|
332
|
+
/** Extract the text content from a message, regardless of content format. */
|
|
333
|
+
declare const getTextContent: (message: Message) => string;
|
|
320
334
|
interface ToolContext {
|
|
321
335
|
runId: string;
|
|
322
336
|
agentId: string;
|
|
@@ -338,10 +352,17 @@ interface ToolDefinition<TInput extends Record<string, unknown> = Record<string,
|
|
|
338
352
|
}
|
|
339
353
|
declare const defineTool: <TInput extends Record<string, unknown>, TOutput = unknown>(definition: ToolDefinition<TInput, TOutput>) => ToolDefinition<TInput, TOutput>;
|
|
340
354
|
|
|
355
|
+
interface FileInput {
|
|
356
|
+
/** base64 data, data: URI, or https:// URL */
|
|
357
|
+
data: string;
|
|
358
|
+
mediaType: string;
|
|
359
|
+
filename?: string;
|
|
360
|
+
}
|
|
341
361
|
interface RunInput {
|
|
342
362
|
task: string;
|
|
343
363
|
parameters?: Record<string, unknown>;
|
|
344
364
|
messages?: Message[];
|
|
365
|
+
files?: FileInput[];
|
|
345
366
|
abortSignal?: AbortSignal;
|
|
346
367
|
}
|
|
347
368
|
interface TokenUsage {
|
|
@@ -355,6 +376,8 @@ interface RunResult {
|
|
|
355
376
|
steps: number;
|
|
356
377
|
tokens: TokenUsage;
|
|
357
378
|
duration: number;
|
|
379
|
+
continuation?: boolean;
|
|
380
|
+
maxSteps?: number;
|
|
358
381
|
}
|
|
359
382
|
interface AgentFailure {
|
|
360
383
|
code: string;
|
|
@@ -420,4 +443,4 @@ type AgentEvent = {
|
|
|
420
443
|
reason?: string;
|
|
421
444
|
};
|
|
422
445
|
|
|
423
|
-
export { type AgentEvent, type AgentFailure, FEATURE_DOMAIN_ORDER, type FeatureDomain, type JsonSchema, type Message, ONBOARDING_FIELDS, type OnboardingField, type OnboardingFieldCondition, type OnboardingFieldKind, type OnboardingFieldTarget, type OnboardingOption, type OnboardingScope, type Role, type RunInput, type RunResult, type TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, defineTool, fieldsForScope };
|
|
446
|
+
export { type AgentEvent, type AgentFailure, type ContentPart, FEATURE_DOMAIN_ORDER, type FeatureDomain, type FileContentPart, type FileInput, type JsonSchema, type Message, ONBOARDING_FIELDS, type OnboardingField, type OnboardingFieldCondition, type OnboardingFieldKind, type OnboardingFieldTarget, type OnboardingOption, type OnboardingScope, type Role, type RunInput, type RunResult, type TextContentPart, type TokenUsage, type ToolContext, type ToolDefinition, type ToolHandler, defineTool, fieldsForScope, getTextContent };
|
package/dist/index.js
CHANGED
|
@@ -236,10 +236,15 @@ var fieldsForScope = (scope) => ONBOARDING_FIELDS.filter(
|
|
|
236
236
|
);
|
|
237
237
|
|
|
238
238
|
// src/index.ts
|
|
239
|
+
var getTextContent = (message) => {
|
|
240
|
+
if (typeof message.content === "string") return message.content;
|
|
241
|
+
return message.content.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
242
|
+
};
|
|
239
243
|
var defineTool = (definition) => definition;
|
|
240
244
|
export {
|
|
241
245
|
FEATURE_DOMAIN_ORDER,
|
|
242
246
|
ONBOARDING_FIELDS,
|
|
243
247
|
defineTool,
|
|
244
|
-
fieldsForScope
|
|
248
|
+
fieldsForScope,
|
|
249
|
+
getTextContent
|
|
245
250
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -11,9 +11,24 @@ export type JsonSchema = {
|
|
|
11
11
|
|
|
12
12
|
export type Role = "system" | "user" | "assistant" | "tool";
|
|
13
13
|
|
|
14
|
+
export interface TextContentPart {
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface FileContentPart {
|
|
20
|
+
type: "file";
|
|
21
|
+
/** base64 data, data: URI, https:// URL, or poncho-upload:// reference */
|
|
22
|
+
data: string;
|
|
23
|
+
mediaType: string;
|
|
24
|
+
filename?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ContentPart = TextContentPart | FileContentPart;
|
|
28
|
+
|
|
14
29
|
export interface Message {
|
|
15
30
|
role: Role;
|
|
16
|
-
content: string;
|
|
31
|
+
content: string | ContentPart[];
|
|
17
32
|
metadata?: {
|
|
18
33
|
id?: string;
|
|
19
34
|
timestamp?: number;
|
|
@@ -24,6 +39,15 @@ export interface Message {
|
|
|
24
39
|
};
|
|
25
40
|
}
|
|
26
41
|
|
|
42
|
+
/** Extract the text content from a message, regardless of content format. */
|
|
43
|
+
export const getTextContent = (message: Message): string => {
|
|
44
|
+
if (typeof message.content === "string") return message.content;
|
|
45
|
+
return message.content
|
|
46
|
+
.filter((p): p is TextContentPart => p.type === "text")
|
|
47
|
+
.map((p) => p.text)
|
|
48
|
+
.join("");
|
|
49
|
+
};
|
|
50
|
+
|
|
27
51
|
export interface ToolContext {
|
|
28
52
|
runId: string;
|
|
29
53
|
agentId: string;
|
|
@@ -61,10 +85,18 @@ export const defineTool = <
|
|
|
61
85
|
|
|
62
86
|
export * from "./config-registry.js";
|
|
63
87
|
|
|
88
|
+
export interface FileInput {
|
|
89
|
+
/** base64 data, data: URI, or https:// URL */
|
|
90
|
+
data: string;
|
|
91
|
+
mediaType: string;
|
|
92
|
+
filename?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
64
95
|
export interface RunInput {
|
|
65
96
|
task: string;
|
|
66
97
|
parameters?: Record<string, unknown>;
|
|
67
98
|
messages?: Message[];
|
|
99
|
+
files?: FileInput[];
|
|
68
100
|
abortSignal?: AbortSignal;
|
|
69
101
|
}
|
|
70
102
|
|
|
@@ -80,6 +112,8 @@ export interface RunResult {
|
|
|
80
112
|
steps: number;
|
|
81
113
|
tokens: TokenUsage;
|
|
82
114
|
duration: number;
|
|
115
|
+
continuation?: boolean;
|
|
116
|
+
maxSteps?: number;
|
|
83
117
|
}
|
|
84
118
|
|
|
85
119
|
export interface AgentFailure {
|
package/.turbo/turbo-test.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @poncho-ai/sdk@0.1.0 test /Users/cesar/Dev/latitude/agentl/packages/sdk
|
|
3
|
-
> vitest
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[7m[1m[36m RUN [39m[22m[27m [36mv1.6.1[39m [90m/Users/cesar/Dev/latitude/agentl/packages/sdk[39m
|
|
7
|
-
|
|
8
|
-
[32m✓[39m test/sdk.test.ts [2m ([22m[2m1 test[22m[2m)[22m[90m 2[2mms[22m[39m
|
|
9
|
-
|
|
10
|
-
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
11
|
-
[2m Tests [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
|
-
[2m Start at [22m 12:05:57
|
|
13
|
-
[2m Duration [22m 475ms[2m (transform 97ms, setup 0ms, collect 90ms, tests 2ms, environment 0ms, prepare 102ms)[22m
|
|
14
|
-
|