@poncho-ai/sdk 0.6.0 → 1.0.1
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 +74 -3
- package/dist/index.js +50 -2
- package/package.json +1 -1
- package/src/config-registry.ts +45 -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.1 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[
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m7.48 KB[39m
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 18ms
|
|
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 1173ms
|
|
14
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m14.79 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @poncho-ai/sdk
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#10](https://github.com/cesr/poncho-ai/pull/10) [`d5bce7b`](https://github.com/cesr/poncho-ai/commit/d5bce7be5890c657bea915eb0926feb6de66b218) Thanks [@cesr](https://github.com/cesr)! - Add generic messaging layer with Slack as the first adapter. Agents can now respond to @mentions in Slack by adding `messaging: [{ platform: 'slack' }]` to `poncho.config.js`. Includes signature verification, threaded conversations, processing indicators, and Vercel `waitUntil` support.
|
|
8
|
+
|
|
9
|
+
## 1.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [`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.
|
|
14
|
+
|
|
3
15
|
## 0.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type OnboardingScope = "light" | "full";
|
|
2
|
-
type FeatureDomain = "model" | "deploy" | "storage" | "memory" | "auth" | "telemetry" | "mcp";
|
|
2
|
+
type FeatureDomain = "model" | "deploy" | "storage" | "memory" | "auth" | "telemetry" | "mcp" | "messaging";
|
|
3
3
|
type OnboardingFieldTarget = "agent" | "config" | "env";
|
|
4
4
|
type OnboardingFieldKind = "select" | "boolean" | "string" | "number";
|
|
5
5
|
type OnboardingFieldCondition = {
|
|
@@ -287,6 +287,54 @@ declare const ONBOARDING_FIELDS: readonly [{
|
|
|
287
287
|
readonly fieldId: "telemetry.enabled";
|
|
288
288
|
readonly equals: true;
|
|
289
289
|
};
|
|
290
|
+
}, {
|
|
291
|
+
readonly id: "messaging.platform";
|
|
292
|
+
readonly domain: "messaging";
|
|
293
|
+
readonly target: "agent";
|
|
294
|
+
readonly path: "messaging.platform";
|
|
295
|
+
readonly kind: "select";
|
|
296
|
+
readonly scopes: ["full"];
|
|
297
|
+
readonly label: "Messaging platform";
|
|
298
|
+
readonly prompt: "Connect to a messaging platform? (optional)";
|
|
299
|
+
readonly defaultValue: "none";
|
|
300
|
+
readonly options: [{
|
|
301
|
+
readonly value: "none";
|
|
302
|
+
readonly label: "None";
|
|
303
|
+
}, {
|
|
304
|
+
readonly value: "slack";
|
|
305
|
+
readonly label: "Slack";
|
|
306
|
+
}];
|
|
307
|
+
}, {
|
|
308
|
+
readonly id: "env.SLACK_BOT_TOKEN";
|
|
309
|
+
readonly domain: "messaging";
|
|
310
|
+
readonly target: "env";
|
|
311
|
+
readonly path: "SLACK_BOT_TOKEN";
|
|
312
|
+
readonly kind: "string";
|
|
313
|
+
readonly scopes: ["full"];
|
|
314
|
+
readonly label: "Slack Bot Token";
|
|
315
|
+
readonly prompt: "Slack Bot Token (from OAuth & Permissions)";
|
|
316
|
+
readonly defaultValue: "";
|
|
317
|
+
readonly placeholder: "xoxb-...";
|
|
318
|
+
readonly secret: true;
|
|
319
|
+
readonly dependsOn: {
|
|
320
|
+
readonly fieldId: "messaging.platform";
|
|
321
|
+
readonly equals: "slack";
|
|
322
|
+
};
|
|
323
|
+
}, {
|
|
324
|
+
readonly id: "env.SLACK_SIGNING_SECRET";
|
|
325
|
+
readonly domain: "messaging";
|
|
326
|
+
readonly target: "env";
|
|
327
|
+
readonly path: "SLACK_SIGNING_SECRET";
|
|
328
|
+
readonly kind: "string";
|
|
329
|
+
readonly scopes: ["full"];
|
|
330
|
+
readonly label: "Slack Signing Secret";
|
|
331
|
+
readonly prompt: "Slack Signing Secret (from Basic Information)";
|
|
332
|
+
readonly defaultValue: "";
|
|
333
|
+
readonly secret: true;
|
|
334
|
+
readonly dependsOn: {
|
|
335
|
+
readonly fieldId: "messaging.platform";
|
|
336
|
+
readonly equals: "slack";
|
|
337
|
+
};
|
|
290
338
|
}];
|
|
291
339
|
declare const FEATURE_DOMAIN_ORDER: readonly FeatureDomain[];
|
|
292
340
|
declare const fieldsForScope: (scope: OnboardingScope) => OnboardingField[];
|
|
@@ -302,9 +350,21 @@ type JsonSchema = {
|
|
|
302
350
|
[key: string]: unknown;
|
|
303
351
|
};
|
|
304
352
|
type Role = "system" | "user" | "assistant" | "tool";
|
|
353
|
+
interface TextContentPart {
|
|
354
|
+
type: "text";
|
|
355
|
+
text: string;
|
|
356
|
+
}
|
|
357
|
+
interface FileContentPart {
|
|
358
|
+
type: "file";
|
|
359
|
+
/** base64 data, data: URI, https:// URL, or poncho-upload:// reference */
|
|
360
|
+
data: string;
|
|
361
|
+
mediaType: string;
|
|
362
|
+
filename?: string;
|
|
363
|
+
}
|
|
364
|
+
type ContentPart = TextContentPart | FileContentPart;
|
|
305
365
|
interface Message {
|
|
306
366
|
role: Role;
|
|
307
|
-
content: string;
|
|
367
|
+
content: string | ContentPart[];
|
|
308
368
|
metadata?: {
|
|
309
369
|
id?: string;
|
|
310
370
|
timestamp?: number;
|
|
@@ -317,6 +377,8 @@ interface Message {
|
|
|
317
377
|
}>;
|
|
318
378
|
};
|
|
319
379
|
}
|
|
380
|
+
/** Extract the text content from a message, regardless of content format. */
|
|
381
|
+
declare const getTextContent: (message: Message) => string;
|
|
320
382
|
interface ToolContext {
|
|
321
383
|
runId: string;
|
|
322
384
|
agentId: string;
|
|
@@ -338,10 +400,17 @@ interface ToolDefinition<TInput extends Record<string, unknown> = Record<string,
|
|
|
338
400
|
}
|
|
339
401
|
declare const defineTool: <TInput extends Record<string, unknown>, TOutput = unknown>(definition: ToolDefinition<TInput, TOutput>) => ToolDefinition<TInput, TOutput>;
|
|
340
402
|
|
|
403
|
+
interface FileInput {
|
|
404
|
+
/** base64 data, data: URI, or https:// URL */
|
|
405
|
+
data: string;
|
|
406
|
+
mediaType: string;
|
|
407
|
+
filename?: string;
|
|
408
|
+
}
|
|
341
409
|
interface RunInput {
|
|
342
410
|
task: string;
|
|
343
411
|
parameters?: Record<string, unknown>;
|
|
344
412
|
messages?: Message[];
|
|
413
|
+
files?: FileInput[];
|
|
345
414
|
abortSignal?: AbortSignal;
|
|
346
415
|
}
|
|
347
416
|
interface TokenUsage {
|
|
@@ -355,6 +424,8 @@ interface RunResult {
|
|
|
355
424
|
steps: number;
|
|
356
425
|
tokens: TokenUsage;
|
|
357
426
|
duration: number;
|
|
427
|
+
continuation?: boolean;
|
|
428
|
+
maxSteps?: number;
|
|
358
429
|
}
|
|
359
430
|
interface AgentFailure {
|
|
360
431
|
code: string;
|
|
@@ -420,4 +491,4 @@ type AgentEvent = {
|
|
|
420
491
|
reason?: string;
|
|
421
492
|
};
|
|
422
493
|
|
|
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 };
|
|
494
|
+
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
|
@@ -220,6 +220,48 @@ var ONBOARDING_FIELDS = [
|
|
|
220
220
|
prompt: "OTLP endpoint (optional)",
|
|
221
221
|
defaultValue: "",
|
|
222
222
|
dependsOn: { fieldId: "telemetry.enabled", equals: true }
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: "messaging.platform",
|
|
226
|
+
domain: "messaging",
|
|
227
|
+
target: "agent",
|
|
228
|
+
path: "messaging.platform",
|
|
229
|
+
kind: "select",
|
|
230
|
+
scopes: ["full"],
|
|
231
|
+
label: "Messaging platform",
|
|
232
|
+
prompt: "Connect to a messaging platform? (optional)",
|
|
233
|
+
defaultValue: "none",
|
|
234
|
+
options: [
|
|
235
|
+
{ value: "none", label: "None" },
|
|
236
|
+
{ value: "slack", label: "Slack" }
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "env.SLACK_BOT_TOKEN",
|
|
241
|
+
domain: "messaging",
|
|
242
|
+
target: "env",
|
|
243
|
+
path: "SLACK_BOT_TOKEN",
|
|
244
|
+
kind: "string",
|
|
245
|
+
scopes: ["full"],
|
|
246
|
+
label: "Slack Bot Token",
|
|
247
|
+
prompt: "Slack Bot Token (from OAuth & Permissions)",
|
|
248
|
+
defaultValue: "",
|
|
249
|
+
placeholder: "xoxb-...",
|
|
250
|
+
secret: true,
|
|
251
|
+
dependsOn: { fieldId: "messaging.platform", equals: "slack" }
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: "env.SLACK_SIGNING_SECRET",
|
|
255
|
+
domain: "messaging",
|
|
256
|
+
target: "env",
|
|
257
|
+
path: "SLACK_SIGNING_SECRET",
|
|
258
|
+
kind: "string",
|
|
259
|
+
scopes: ["full"],
|
|
260
|
+
label: "Slack Signing Secret",
|
|
261
|
+
prompt: "Slack Signing Secret (from Basic Information)",
|
|
262
|
+
defaultValue: "",
|
|
263
|
+
secret: true,
|
|
264
|
+
dependsOn: { fieldId: "messaging.platform", equals: "slack" }
|
|
223
265
|
}
|
|
224
266
|
];
|
|
225
267
|
var FEATURE_DOMAIN_ORDER = [
|
|
@@ -229,17 +271,23 @@ var FEATURE_DOMAIN_ORDER = [
|
|
|
229
271
|
"memory",
|
|
230
272
|
"auth",
|
|
231
273
|
"telemetry",
|
|
232
|
-
"mcp"
|
|
274
|
+
"mcp",
|
|
275
|
+
"messaging"
|
|
233
276
|
];
|
|
234
277
|
var fieldsForScope = (scope) => ONBOARDING_FIELDS.filter(
|
|
235
278
|
(field) => field.scopes.includes(scope)
|
|
236
279
|
);
|
|
237
280
|
|
|
238
281
|
// src/index.ts
|
|
282
|
+
var getTextContent = (message) => {
|
|
283
|
+
if (typeof message.content === "string") return message.content;
|
|
284
|
+
return message.content.filter((p) => p.type === "text").map((p) => p.text).join("");
|
|
285
|
+
};
|
|
239
286
|
var defineTool = (definition) => definition;
|
|
240
287
|
export {
|
|
241
288
|
FEATURE_DOMAIN_ORDER,
|
|
242
289
|
ONBOARDING_FIELDS,
|
|
243
290
|
defineTool,
|
|
244
|
-
fieldsForScope
|
|
291
|
+
fieldsForScope,
|
|
292
|
+
getTextContent
|
|
245
293
|
};
|
package/package.json
CHANGED
package/src/config-registry.ts
CHANGED
|
@@ -7,7 +7,8 @@ export type FeatureDomain =
|
|
|
7
7
|
| "memory"
|
|
8
8
|
| "auth"
|
|
9
9
|
| "telemetry"
|
|
10
|
-
| "mcp"
|
|
10
|
+
| "mcp"
|
|
11
|
+
| "messaging";
|
|
11
12
|
|
|
12
13
|
export type OnboardingFieldTarget = "agent" | "config" | "env";
|
|
13
14
|
|
|
@@ -265,6 +266,48 @@ export const ONBOARDING_FIELDS = [
|
|
|
265
266
|
defaultValue: "",
|
|
266
267
|
dependsOn: { fieldId: "telemetry.enabled", equals: true },
|
|
267
268
|
},
|
|
269
|
+
{
|
|
270
|
+
id: "messaging.platform",
|
|
271
|
+
domain: "messaging",
|
|
272
|
+
target: "agent",
|
|
273
|
+
path: "messaging.platform",
|
|
274
|
+
kind: "select",
|
|
275
|
+
scopes: ["full"],
|
|
276
|
+
label: "Messaging platform",
|
|
277
|
+
prompt: "Connect to a messaging platform? (optional)",
|
|
278
|
+
defaultValue: "none",
|
|
279
|
+
options: [
|
|
280
|
+
{ value: "none", label: "None" },
|
|
281
|
+
{ value: "slack", label: "Slack" },
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: "env.SLACK_BOT_TOKEN",
|
|
286
|
+
domain: "messaging",
|
|
287
|
+
target: "env",
|
|
288
|
+
path: "SLACK_BOT_TOKEN",
|
|
289
|
+
kind: "string",
|
|
290
|
+
scopes: ["full"],
|
|
291
|
+
label: "Slack Bot Token",
|
|
292
|
+
prompt: "Slack Bot Token (from OAuth & Permissions)",
|
|
293
|
+
defaultValue: "",
|
|
294
|
+
placeholder: "xoxb-...",
|
|
295
|
+
secret: true,
|
|
296
|
+
dependsOn: { fieldId: "messaging.platform", equals: "slack" },
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
id: "env.SLACK_SIGNING_SECRET",
|
|
300
|
+
domain: "messaging",
|
|
301
|
+
target: "env",
|
|
302
|
+
path: "SLACK_SIGNING_SECRET",
|
|
303
|
+
kind: "string",
|
|
304
|
+
scopes: ["full"],
|
|
305
|
+
label: "Slack Signing Secret",
|
|
306
|
+
prompt: "Slack Signing Secret (from Basic Information)",
|
|
307
|
+
defaultValue: "",
|
|
308
|
+
secret: true,
|
|
309
|
+
dependsOn: { fieldId: "messaging.platform", equals: "slack" },
|
|
310
|
+
},
|
|
268
311
|
] as const satisfies readonly OnboardingField[];
|
|
269
312
|
|
|
270
313
|
export const FEATURE_DOMAIN_ORDER: readonly FeatureDomain[] = [
|
|
@@ -275,6 +318,7 @@ export const FEATURE_DOMAIN_ORDER: readonly FeatureDomain[] = [
|
|
|
275
318
|
"auth",
|
|
276
319
|
"telemetry",
|
|
277
320
|
"mcp",
|
|
321
|
+
"messaging",
|
|
278
322
|
] as const;
|
|
279
323
|
|
|
280
324
|
export const fieldsForScope = (scope: OnboardingScope): OnboardingField[] =>
|
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
|
-
|