@poncho-ai/sdk 1.7.1 → 1.8.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@1.7.1 build /home/runner/work/poncho-ai/poncho-ai/packages/sdk
2
+ > @poncho-ai/sdk@1.8.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
@@ -8,7 +8,7 @@
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
10
  ESM dist/index.js 12.46 KB
11
- ESM ⚡️ Build success in 19ms
11
+ ESM ⚡️ Build success in 16ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1298ms
14
- DTS dist/index.d.ts 23.88 KB
13
+ DTS ⚡️ Build success in 1193ms
14
+ DTS dist/index.d.ts 24.92 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @poncho-ai/sdk
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add VfsAccess interface and expand ToolContext with optional `vfs` field for tenant-scoped virtual filesystem access in tool handlers.
8
+
9
+ ## 1.8.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`83d3c5f`](https://github.com/cesr/poncho-ai/commit/83d3c5f841fe84965d1f9fec6dfc5d8832e4489a) Thanks [@cesr](https://github.com/cesr)! - feat: add multi-tenancy with JWT-based tenant scoping
14
+
15
+ Deploy one agent, serve many tenants with fully isolated conversations, memory, reminders, and secrets. Tenancy activates automatically when a valid JWT is received — no config changes needed.
16
+ - **Auth**: `createTenantToken()` in client SDK, `poncho auth create-token` CLI, or any HS256 JWT library.
17
+ - **Isolation**: conversations, memory, reminders, and todos scoped per tenant.
18
+ - **Per-tenant secrets**: encrypted secret overrides for MCP auth tokens, manageable via CLI (`poncho secrets`), API, and web UI settings panel.
19
+ - **MCP**: per-tenant token resolution with deferred discovery for servers without a default env var.
20
+ - **Web UI**: `?token=` tenant access, settings cog for secret management, dark mode support.
21
+ - **Backward compatible**: existing single-user deployments work unchanged.
22
+
3
23
  ## 1.7.1
4
24
 
5
25
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -570,6 +570,27 @@ interface Message {
570
570
  }
571
571
  /** Extract the text content from a message, regardless of content format. */
572
572
  declare const getTextContent: (message: Message) => string;
573
+ /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
574
+ interface VfsAccess {
575
+ readFile(path: string): Promise<Uint8Array>;
576
+ readText(path: string): Promise<string>;
577
+ writeFile(path: string, content: Uint8Array, mimeType?: string): Promise<void>;
578
+ writeText(path: string, content: string): Promise<void>;
579
+ exists(path: string): Promise<boolean>;
580
+ stat(path: string): Promise<{
581
+ size: number;
582
+ isDirectory: boolean;
583
+ mimeType?: string;
584
+ updatedAt: number;
585
+ }>;
586
+ readdir(path: string): Promise<string[]>;
587
+ mkdir(path: string, options?: {
588
+ recursive?: boolean;
589
+ }): Promise<void>;
590
+ rm(path: string, options?: {
591
+ recursive?: boolean;
592
+ }): Promise<void>;
593
+ }
573
594
  interface ToolContext {
574
595
  runId: string;
575
596
  agentId: string;
@@ -578,6 +599,10 @@ interface ToolContext {
578
599
  parameters: Record<string, unknown>;
579
600
  abortSignal?: AbortSignal;
580
601
  conversationId?: string;
602
+ /** The tenant ID when running in multi-tenant mode. */
603
+ tenantId?: string;
604
+ /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
605
+ vfs?: VfsAccess;
581
606
  }
582
607
  type ToolHandler<TInput extends Record<string, unknown>, TOutput> = (input: TInput, context: ToolContext) => Promise<TOutput> | TOutput;
583
608
  interface ToolDefinition<TInput extends Record<string, unknown> = Record<string, unknown>, TOutput = unknown> {
@@ -608,6 +633,8 @@ interface RunInput {
608
633
  conversationId?: string;
609
634
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
610
635
  disableSoftDeadline?: boolean;
636
+ /** Scope this run to a specific tenant. */
637
+ tenantId?: string;
611
638
  }
612
639
  interface TokenUsage {
613
640
  input: number;
@@ -681,6 +708,7 @@ type AgentEvent = {
681
708
  } | {
682
709
  type: "tool:completed";
683
710
  tool: string;
711
+ input?: unknown;
684
712
  output: unknown;
685
713
  duration: number;
686
714
  outputTokenEstimate?: number;
@@ -767,4 +795,4 @@ type AgentEvent = {
767
795
  reason: string;
768
796
  };
769
797
 
770
- 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 };
798
+ 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, type VfsAccess, defineTool, fieldsForScope, getTextContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poncho-ai/sdk",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "Core types and utilities for building Poncho skills",
5
5
  "repository": {
6
6
  "type": "git",
package/src/index.ts CHANGED
@@ -50,6 +50,24 @@ export const getTextContent = (message: Message): string => {
50
50
  .join("");
51
51
  };
52
52
 
53
+ /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
54
+ export interface VfsAccess {
55
+ readFile(path: string): Promise<Uint8Array>;
56
+ readText(path: string): Promise<string>;
57
+ writeFile(path: string, content: Uint8Array, mimeType?: string): Promise<void>;
58
+ writeText(path: string, content: string): Promise<void>;
59
+ exists(path: string): Promise<boolean>;
60
+ stat(path: string): Promise<{
61
+ size: number;
62
+ isDirectory: boolean;
63
+ mimeType?: string;
64
+ updatedAt: number;
65
+ }>;
66
+ readdir(path: string): Promise<string[]>;
67
+ mkdir(path: string, options?: { recursive?: boolean }): Promise<void>;
68
+ rm(path: string, options?: { recursive?: boolean }): Promise<void>;
69
+ }
70
+
53
71
  export interface ToolContext {
54
72
  runId: string;
55
73
  agentId: string;
@@ -58,6 +76,10 @@ export interface ToolContext {
58
76
  parameters: Record<string, unknown>;
59
77
  abortSignal?: AbortSignal;
60
78
  conversationId?: string;
79
+ /** The tenant ID when running in multi-tenant mode. */
80
+ tenantId?: string;
81
+ /** Virtual filesystem scoped to the current tenant. Available when VFS is enabled. */
82
+ vfs?: VfsAccess;
61
83
  }
62
84
 
63
85
  export type ToolHandler<TInput extends Record<string, unknown>, TOutput> = (
@@ -105,6 +127,8 @@ export interface RunInput {
105
127
  conversationId?: string;
106
128
  /** When true, ignores PONCHO_MAX_DURATION soft deadline (used for background subagent runs). */
107
129
  disableSoftDeadline?: boolean;
130
+ /** Scope this run to a specific tenant. */
131
+ tenantId?: string;
108
132
  }
109
133
 
110
134
  export interface TokenUsage {
@@ -150,7 +174,7 @@ export type AgentEvent =
150
174
  | { type: "model:response"; usage: TokenUsage }
151
175
  | { type: "tool:generating"; tool: string; toolCallId: string }
152
176
  | { type: "tool:started"; tool: string; input: unknown }
153
- | { type: "tool:completed"; tool: string; output: unknown; duration: number; outputTokenEstimate?: number }
177
+ | { type: "tool:completed"; tool: string; input?: unknown; output: unknown; duration: number; outputTokenEstimate?: number }
154
178
  | { type: "tool:error"; tool: string; error: string; recoverable: boolean }
155
179
  | {
156
180
  type: "tool:approval:required";