@poncho-ai/harness 0.34.1 → 0.36.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 +12 -11
- package/.turbo/turbo-lint.log +6 -0
- package/.turbo/turbo-test.log +27100 -0
- package/CHANGELOG.md +37 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/dist-3KMQR4IO.js +27092 -0
- package/dist/index.d.ts +553 -29
- package/dist/index.js +3132 -1902
- package/dist/isolate-5MISBSUK.js +733 -0
- package/dist/isolate-5R6762YA.js +605 -0
- package/dist/isolate-KUZ5NOPG.js +727 -0
- package/dist/isolate-LOL3T7RA.js +729 -0
- package/dist/isolate-N22X4TCE.js +740 -0
- package/dist/isolate-T7WXM7IL.js +1490 -0
- package/dist/isolate-TCWTUVG4.js +1532 -0
- package/dist/isolate-WFOLANOB.js +768 -0
- package/package.json +24 -4
- package/scripts/migrate-to-engine.mjs +556 -0
- package/src/config.ts +112 -1
- package/src/harness.ts +282 -91
- package/src/index.ts +7 -0
- package/src/isolate/bindings.ts +206 -0
- package/src/isolate/bundler.ts +179 -0
- package/src/isolate/index.ts +10 -0
- package/src/isolate/polyfills.ts +796 -0
- package/src/isolate/run-code-tool.ts +220 -0
- package/src/isolate/runtime.ts +286 -0
- package/src/isolate/type-stubs.ts +196 -0
- package/src/mcp.ts +140 -9
- package/src/memory.ts +142 -191
- package/src/reminder-store.ts +7 -235
- package/src/reminder-tools.ts +15 -2
- package/src/secrets-store.ts +163 -0
- package/src/state.ts +22 -1291
- package/src/storage/engine.ts +106 -0
- package/src/storage/index.ts +59 -0
- package/src/storage/memory-engine.ts +588 -0
- package/src/storage/postgres-engine.ts +139 -0
- package/src/storage/schema.ts +145 -0
- package/src/storage/sql-dialect.ts +963 -0
- package/src/storage/sqlite-engine.ts +99 -0
- package/src/storage/store-adapters.ts +100 -0
- package/src/subagent-manager.ts +1 -0
- package/src/subagent-tools.ts +1 -0
- package/src/telemetry.ts +5 -1
- package/src/tenant-token.ts +42 -0
- package/src/todo-tools.ts +1 -136
- package/src/upload-store.ts +1 -0
- package/src/vfs/bash-manager.ts +120 -0
- package/src/vfs/bash-tool.ts +59 -0
- package/src/vfs/create-bash-fs.ts +32 -0
- package/src/vfs/edit-file-tool.ts +72 -0
- package/src/vfs/index.ts +5 -0
- package/src/vfs/poncho-fs-adapter.ts +267 -0
- package/src/vfs/protected-fs.ts +177 -0
- package/src/vfs/read-file-tool.ts +103 -0
- package/src/vfs/write-file-tool.ts +49 -0
- package/test/harness.test.ts +30 -36
- package/test/isolate-vfs.test.ts +453 -0
- package/test/isolate.test.ts +252 -0
- package/test/state.test.ts +4 -27
- package/test/storage-engine.test.ts +250 -0
- package/test/vfs.test.ts +242 -0
- package/src/kv-store.ts +0 -216
package/src/config.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { access } from "node:fs/promises";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { createJiti } from "jiti";
|
|
4
|
+
import type { JsonSchema } from "@poncho-ai/sdk";
|
|
4
5
|
import type { MemoryConfig } from "./memory.js";
|
|
5
6
|
import type { McpConfig } from "./mcp.js";
|
|
6
7
|
import type { StateConfig } from "./state.js";
|
|
7
8
|
|
|
8
9
|
export interface StorageConfig {
|
|
9
|
-
provider?: "local" | "memory" | "redis" | "upstash" | "dynamodb";
|
|
10
|
+
provider?: "local" | "memory" | "sqlite" | "postgresql" | "redis" | "upstash" | "dynamodb";
|
|
10
11
|
urlEnv?: string;
|
|
11
12
|
tokenEnv?: string;
|
|
12
13
|
table?: string;
|
|
@@ -21,6 +22,10 @@ export interface StorageConfig {
|
|
|
21
22
|
enabled?: boolean;
|
|
22
23
|
maxRecallConversations?: number;
|
|
23
24
|
};
|
|
25
|
+
limits?: {
|
|
26
|
+
maxFileSize?: number;
|
|
27
|
+
maxTotalStorage?: number;
|
|
28
|
+
};
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
export interface UploadsConfig {
|
|
@@ -68,6 +73,97 @@ export interface MessagingChannelConfig {
|
|
|
68
73
|
allowedUserIds?: number[];
|
|
69
74
|
}
|
|
70
75
|
|
|
76
|
+
export interface IsolateBinding {
|
|
77
|
+
description: string;
|
|
78
|
+
inputSchema: JsonSchema;
|
|
79
|
+
handler: (input: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Network access configuration for the bash sandbox (curl, wget).
|
|
84
|
+
* Network access is disabled by default — you must explicitly allow URLs.
|
|
85
|
+
*/
|
|
86
|
+
export interface NetworkConfig {
|
|
87
|
+
/**
|
|
88
|
+
* List of allowed URL prefixes. Each entry must be a full origin (scheme + host),
|
|
89
|
+
* optionally followed by a path prefix.
|
|
90
|
+
*
|
|
91
|
+
* Examples:
|
|
92
|
+
* - `"https://api.example.com"` — allows all paths on this origin
|
|
93
|
+
* - `"https://api.example.com/v1/"` — allows only paths starting with /v1/
|
|
94
|
+
*
|
|
95
|
+
* Entries can be plain strings or objects with header transforms for credentials brokering:
|
|
96
|
+
* ```
|
|
97
|
+
* { url: "https://api.example.com", transform: [{ headers: { "Authorization": "Bearer ..." } }] }
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
allowedUrls?: (string | { url: string; transform?: { headers: Record<string, string> }[] })[];
|
|
101
|
+
/** Allowed HTTP methods. Defaults to `["GET", "HEAD"]`. */
|
|
102
|
+
allowedMethods?: ("GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "PATCH" | "OPTIONS")[];
|
|
103
|
+
/** Bypass the allow-list and permit all URLs and methods. Only use in trusted environments. */
|
|
104
|
+
dangerouslyAllowAll?: boolean;
|
|
105
|
+
/** Maximum number of redirects to follow. Default: 20. */
|
|
106
|
+
maxRedirects?: number;
|
|
107
|
+
/** Request timeout in milliseconds. Default: 30000. */
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
/** Maximum response body size in bytes. Default: 10MB. */
|
|
110
|
+
maxResponseSize?: number;
|
|
111
|
+
/** Reject URLs resolving to private/loopback IPs (SSRF protection). Default: false. */
|
|
112
|
+
denyPrivateRanges?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface BashExecutionLimits {
|
|
116
|
+
/** Maximum function call/recursion depth. Default: 100. */
|
|
117
|
+
maxCallDepth?: number;
|
|
118
|
+
/** Maximum number of commands to execute. Default: 10000. */
|
|
119
|
+
maxCommandCount?: number;
|
|
120
|
+
/** Maximum loop iterations for while/for/until. Default: 10000. */
|
|
121
|
+
maxLoopIterations?: number;
|
|
122
|
+
/** Maximum total output size (stdout + stderr) in bytes. Default: 10MB. */
|
|
123
|
+
maxOutputSize?: number;
|
|
124
|
+
/** Maximum string length in bytes. Default: 10MB. */
|
|
125
|
+
maxStringLength?: number;
|
|
126
|
+
/** Maximum array elements. Default: 100000. */
|
|
127
|
+
maxArrayElements?: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface BashConfig {
|
|
131
|
+
/**
|
|
132
|
+
* Whitelist of allowed commands. When set, only these commands are available.
|
|
133
|
+
* Omit to allow all built-in commands.
|
|
134
|
+
*
|
|
135
|
+
* @example ["cat", "grep", "jq", "echo", "ls", "head", "tail", "wc", "sort"]
|
|
136
|
+
*/
|
|
137
|
+
commands?: string[];
|
|
138
|
+
/** Execution limits to prevent runaway scripts. */
|
|
139
|
+
executionLimits?: BashExecutionLimits;
|
|
140
|
+
/** Enable python3/python commands in the sandbox. Default: false. */
|
|
141
|
+
python?: boolean;
|
|
142
|
+
/** Enable js-exec/node commands via QuickJS in the sandbox. Default: false. */
|
|
143
|
+
javascript?: boolean;
|
|
144
|
+
/** Environment variables injected into every bash session. */
|
|
145
|
+
env?: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface IsolateConfig {
|
|
149
|
+
/** V8 isolate memory limit in MB. Default: 128 */
|
|
150
|
+
memoryLimit?: number;
|
|
151
|
+
/** Execution timeout in ms. Default: 10000 */
|
|
152
|
+
timeLimit?: number;
|
|
153
|
+
/** Max combined stdout+stderr in bytes. Default: 65536 */
|
|
154
|
+
outputLimit?: number;
|
|
155
|
+
/** Max code input size in bytes. Default: 102400 (100KB) */
|
|
156
|
+
codeLimit?: number;
|
|
157
|
+
/** npm packages to bundle and make available via require() */
|
|
158
|
+
libraries?: string[];
|
|
159
|
+
/** External API access */
|
|
160
|
+
apis?: {
|
|
161
|
+
fetch?: { allowedDomains: string[] };
|
|
162
|
+
};
|
|
163
|
+
/** Builder-defined custom bindings injected into the isolate */
|
|
164
|
+
bindings?: Record<string, IsolateBinding>;
|
|
165
|
+
}
|
|
166
|
+
|
|
71
167
|
export interface PonchoConfig extends McpConfig {
|
|
72
168
|
harness?: string;
|
|
73
169
|
messaging?: MessagingChannelConfig[];
|
|
@@ -134,8 +230,23 @@ export interface PonchoConfig extends McpConfig {
|
|
|
134
230
|
/** Cron expression controlling how often the reminder poll runs (local and serverless). Default: every 10 minutes. */
|
|
135
231
|
pollSchedule?: string;
|
|
136
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* Declare env var names that tenants can self-manage via the web UI or API.
|
|
235
|
+
* Key = env var name, value = human-readable label shown in the settings panel.
|
|
236
|
+
* Example: { LINEAR_API_KEY: "Linear API Key", STRIPE_KEY: "Stripe Secret Key" }
|
|
237
|
+
*/
|
|
238
|
+
tenantSecrets?: Record<string, string>;
|
|
137
239
|
/** Set to `false` to disable the built-in web UI (headless / API-only mode). */
|
|
138
240
|
webUi?: false;
|
|
241
|
+
/** Enable sandboxed V8 isolate code execution. */
|
|
242
|
+
isolate?: IsolateConfig;
|
|
243
|
+
/**
|
|
244
|
+
* Network access for sandboxed tools (bash curl/wget, isolate fetch).
|
|
245
|
+
* Disabled by default — you must explicitly allow URLs.
|
|
246
|
+
*/
|
|
247
|
+
network?: NetworkConfig;
|
|
248
|
+
/** Bash sandbox configuration. */
|
|
249
|
+
bash?: BashConfig;
|
|
139
250
|
/** Enable browser automation tools. Set `true` for defaults, or provide config. */
|
|
140
251
|
browser?:
|
|
141
252
|
| boolean
|