@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @poncho-ai/sdk@0.6.0 build /Users/cesar/Dev/latitude/poncho-ai/packages/sdk
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
  CLI Building entry: src/index.ts
@@ -7,8 +7,8 @@
7
7
  CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
- ESM dist/index.js 6.16 KB
11
- ESM ⚡️ Build success in 64ms
10
+ ESM dist/index.js 7.48 KB
11
+ ESM ⚡️ Build success in 18ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 947ms
14
- DTS dist/index.d.ts 12.51 KB
13
+ DTS ⚡️ Build success in 1173ms
14
+ DTS dist/index.d.ts 14.79 KB
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "0.6.0",
3
+ "version": "1.0.1",
4
4
  "description": "Core types and utilities for building Poncho skills",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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 {
@@ -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
-  RUN  v1.6.1 /Users/cesar/Dev/latitude/agentl/packages/sdk
7
-
8
- ✓ test/sdk.test.ts  (1 test) 2ms
9
-
10
-  Test Files  1 passed (1)
11
-  Tests  1 passed (1)
12
-  Start at  12:05:57
13
-  Duration  475ms (transform 97ms, setup 0ms, collect 90ms, tests 2ms, environment 0ms, prepare 102ms)
14
-