@alexkroman1/aai 0.12.3 → 1.0.2
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 +20 -0
- package/CHANGELOG.md +174 -0
- package/dist/constants-VTFoymJ-.js +47 -0
- package/dist/host/_run-code.d.ts +1 -1
- package/dist/host/_runtime-conformance.d.ts +4 -5
- package/dist/host/builtin-tools.d.ts +11 -9
- package/dist/host/runtime-barrel.d.ts +15 -0
- package/dist/{direct-executor-DRRrZUp0.js → host/runtime-barrel.js} +453 -348
- package/dist/host/runtime-config.d.ts +42 -0
- package/dist/host/runtime.d.ts +119 -35
- package/dist/host/s2s.d.ts +14 -38
- package/dist/host/server.d.ts +16 -8
- package/dist/host/session-ctx.d.ts +55 -0
- package/dist/host/session.d.ts +20 -70
- package/dist/host/tool-executor.d.ts +20 -0
- package/dist/host/unstorage-kv.d.ts +1 -1
- package/dist/host/ws-handler.d.ts +4 -2
- package/dist/index.d.ts +9 -20
- package/dist/index.js +63 -2
- package/dist/{isolate → sdk}/_internal-types.d.ts +5 -9
- package/dist/{isolate → sdk}/constants.d.ts +6 -4
- package/dist/sdk/define.d.ts +66 -0
- package/dist/{isolate → sdk}/kv.d.ts +1 -49
- package/dist/sdk/manifest-barrel.d.ts +8 -0
- package/dist/sdk/manifest-barrel.js +52 -0
- package/dist/sdk/manifest.d.ts +50 -0
- package/dist/{isolate → sdk}/protocol.d.ts +59 -36
- package/dist/sdk/protocol.js +163 -0
- package/dist/{isolate → sdk}/system-prompt.d.ts +2 -2
- package/dist/sdk/types.d.ts +201 -0
- package/dist/sdk/ws-upgrade.d.ts +5 -0
- package/dist/{system-prompt-DYAYFW99.js → system-prompt-nik_iavo.js} +10 -10
- package/dist/types-Cfx_4QDK.js +39 -0
- package/dist/ws-upgrade-BeOQ7fXL.js +30 -0
- package/exports-no-dev-deps.test.ts +62 -0
- package/host/_mock-ws.ts +185 -0
- package/host/_run-code.ts +217 -0
- package/host/_runtime-conformance.ts +143 -0
- package/host/_test-utils.ts +276 -0
- package/host/builtin-tools.test.ts +774 -0
- package/host/builtin-tools.ts +255 -0
- package/host/cleanup.test.ts +422 -0
- package/host/fixture-replay.test.ts +463 -0
- package/host/fixtures/README.md +40 -0
- package/host/fixtures/greeting-session-sequence.json +40 -0
- package/host/fixtures/reply-audio-samples.json +42 -0
- package/host/fixtures/reply-lifecycle.json +21 -0
- package/host/fixtures/session-ready.json +48 -0
- package/host/fixtures/session-updated.json +45 -0
- package/host/fixtures/simple-question-sequence.json +73 -0
- package/host/fixtures/tool-call-sequence.json +114 -0
- package/host/fixtures/tool-calls.json +11 -0
- package/host/fixtures/tool-config-session-sequence.json +51 -0
- package/host/fixtures/user-speech-recognition.json +30 -0
- package/host/fixtures/web-search-sequence.json +122 -0
- package/host/integration.test.ts +222 -0
- package/host/runtime-barrel.ts +25 -0
- package/host/runtime-config.test.ts +71 -0
- package/host/runtime-config.ts +99 -0
- package/host/runtime.test.ts +641 -0
- package/host/runtime.ts +308 -0
- package/host/s2s-fixtures.test.ts +237 -0
- package/host/s2s.test.ts +562 -0
- package/host/s2s.ts +310 -0
- package/host/server-shutdown.test.ts +76 -0
- package/host/server.test.ts +116 -0
- package/host/server.ts +223 -0
- package/host/session-ctx.ts +107 -0
- package/host/session-fixture-replay.test.ts +136 -0
- package/host/session-prompt.test.ts +77 -0
- package/host/session.test.ts +590 -0
- package/host/session.ts +370 -0
- package/host/tool-executor.test.ts +124 -0
- package/host/tool-executor.ts +80 -0
- package/host/unstorage-kv.test.ts +99 -0
- package/host/unstorage-kv.ts +69 -0
- package/host/ws-handler.test.ts +739 -0
- package/host/ws-handler.ts +255 -0
- package/index.ts +16 -0
- package/package.json +24 -72
- package/sdk/_internal-types.test.ts +34 -0
- package/sdk/_internal-types.ts +115 -0
- package/sdk/compat-fixtures/README.md +26 -0
- package/sdk/compat-fixtures/v1.json +68 -0
- package/sdk/constants.ts +77 -0
- package/sdk/define.test.ts +57 -0
- package/sdk/define.ts +88 -0
- package/sdk/kv.ts +60 -0
- package/sdk/manifest-barrel.ts +12 -0
- package/sdk/manifest.test.ts +56 -0
- package/sdk/manifest.ts +89 -0
- package/sdk/protocol-compat.test.ts +187 -0
- package/sdk/protocol-snapshot.test.ts +199 -0
- package/sdk/protocol.test.ts +170 -0
- package/sdk/protocol.ts +223 -0
- package/sdk/schema-alignment.test.ts +191 -0
- package/sdk/system-prompt.test.ts +111 -0
- package/sdk/system-prompt.ts +74 -0
- package/sdk/tsconfig.json +12 -0
- package/sdk/types-inference.test.ts +122 -0
- package/sdk/types.test.ts +14 -0
- package/sdk/types.ts +226 -0
- package/sdk/utils.test.ts +52 -0
- package/sdk/utils.ts +20 -0
- package/sdk/ws-upgrade.test.ts +48 -0
- package/sdk/ws-upgrade.ts +13 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +10 -0
- package/tsdown.config.ts +26 -0
- package/vitest.config.ts +17 -0
- package/dist/host/_test-utils.d.ts +0 -73
- package/dist/host/direct-executor.d.ts +0 -130
- package/dist/host/index.d.ts +0 -19
- package/dist/host/index.js +0 -165
- package/dist/host/matchers.d.ts +0 -20
- package/dist/host/matchers.js +0 -41
- package/dist/host/server.js +0 -164
- package/dist/host/testing.d.ts +0 -294
- package/dist/host/testing.js +0 -2
- package/dist/host/vite-plugin.d.ts +0 -15
- package/dist/host/vite-plugin.js +0 -83
- package/dist/isolate/_kv-utils.d.ts +0 -10
- package/dist/isolate/_utils.js +0 -17
- package/dist/isolate/hooks.d.ts +0 -44
- package/dist/isolate/hooks.js +0 -58
- package/dist/isolate/index.d.ts +0 -18
- package/dist/isolate/index.js +0 -6
- package/dist/isolate/kv.js +0 -1
- package/dist/isolate/protocol.js +0 -2
- package/dist/isolate/types.d.ts +0 -418
- package/dist/isolate/types.js +0 -175
- package/dist/protocol-rcOrz7T3.js +0 -183
- package/dist/testing-BreLdpq-.js +0 -513
- package/dist/types.test-d.d.ts +0 -7
- /package/dist/{isolate/_utils.d.ts → sdk/utils.d.ts} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
> @alexkroman1/aai@1.0.2 build /home/runner/work/agent/agent/packages/aai
|
|
3
|
+
> tsdown && tsc -p tsconfig.build.json
|
|
4
|
+
|
|
5
|
+
[34mℹ[39m [34mtsdown v0.21.7[39m powered by [38;2;255;126;23mrolldown v1.0.0-rc.12[39m
|
|
6
|
+
[34mℹ[39m config file: [4m/home/runner/work/agent/agent/packages/aai/tsdown.config.ts[24m
|
|
7
|
+
[34mℹ[39m entry: [34mindex.ts, sdk/protocol.ts, host/runtime-barrel.ts, sdk/manifest-barrel.ts[39m
|
|
8
|
+
[34mℹ[39m target: [34mnode22[39m
|
|
9
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
|
+
[34mℹ[39m Build start
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mhost/runtime-barrel.js[22m [2m47.10 kB[22m [2m│ gzip: 14.49 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1msdk/protocol.js[22m [2m 4.83 kB[22m [2m│ gzip: 1.77 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m 2.49 kB[22m [2m│ gzip: 1.04 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1msdk/manifest-barrel.js[22m [2m 2.19 kB[22m [2m│ gzip: 0.99 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22msystem-prompt-nik_iavo.js [2m 4.77 kB[22m [2m│ gzip: 2.09 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22mconstants-VTFoymJ-.js [2m 2.75 kB[22m [2m│ gzip: 1.23 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22mtypes-Cfx_4QDK.js [2m 1.74 kB[22m [2m│ gzip: 0.93 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22mws-upgrade-BeOQ7fXL.js [2m 1.14 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
19
|
+
[34mℹ[39m 8 files, total: 67.02 kB
|
|
20
|
+
[32m✔[39m Build complete in [32m36ms[39m
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# @alexkroman1/aai
|
|
2
|
+
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 76d25d4: Stop re-exporting test-only conformance suite from runtime barrel; this previously pulled `vitest` into the production bundle and crashed the deployed server with ERR_MODULE_NOT_FOUND.
|
|
8
|
+
- a3d3835: Force all libraries and the server to publish/deploy after the 1.0.1
|
|
9
|
+
release failure. Restores the `@alexkroman1/` scope on publishable
|
|
10
|
+
packages so npm accepts the publish, and bumps `aai-server` to trigger
|
|
11
|
+
the Fly.io deploy job in the release workflow.
|
|
12
|
+
|
|
13
|
+
## 1.0.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 5517333: Simplify codebase: fix SSRF bypass in sandbox builtins, deduplicate utilities, strengthen types
|
|
18
|
+
- 5d55c12: Remove unnecessary comments that restate obvious code
|
|
19
|
+
- b4ff42e: Redeploy aai-server and refresh client/CLI/SDK releases
|
|
20
|
+
|
|
21
|
+
## 1.0.0
|
|
22
|
+
|
|
23
|
+
### Major Changes
|
|
24
|
+
|
|
25
|
+
- 837e34f: Remove self-hosted ./server API. Platform sandbox now uses Deno guest runtime with NDJSON transport.
|
|
26
|
+
- 7669733: Migrate aai-ui from Preact to React 19 with simplified API: useSession, useTheme, useToolResult hooks + two-tier defineClient
|
|
27
|
+
|
|
28
|
+
### Minor Changes
|
|
29
|
+
|
|
30
|
+
- 8ecb7d1: Add protocol compat fixtures and harden wire format for rolling upgrades
|
|
31
|
+
- befca9a: Simplify agent surface area: directory-based agent format with agent.json, tools/_.ts, hooks/_.ts replacing defineAgent/Zod
|
|
32
|
+
- ab98c61: Remove unused SDK features: `tool` alias, `ctx.fetch`, `onError` hook, `toolChoice: "none"` and `toolChoice: { type: "tool" }` variants. Add `ToolResultMap` typing to solo-rpg template.
|
|
33
|
+
- 14d0653: Remove kv.list() and kv.keys() from KV API — use explicit index keys instead
|
|
34
|
+
- 5fd5cb3: Zod-based agent.ts authoring with agent() and tool() helpers, rename aai-core to aai
|
|
35
|
+
|
|
36
|
+
### Patch Changes
|
|
37
|
+
|
|
38
|
+
- 3bd18a9: Fix security vulnerabilities: run_code sandbox escape, SSRF wiring, credential key enforcement, DNS rebinding, path traversal, harness auth bypass, timing-safe hash comparison
|
|
39
|
+
- 9211c65: Add default aai-ui client served by the server when no custom client is deployed. Remove zod externalization from the worker bundler — zod 4 works natively in Deno sandboxes. Update S2S API endpoint and fix load test event handling.
|
|
40
|
+
- b9b5c02: Deduplicate shared utilities, fix N+1 KV list, async static serving, and race timer leak
|
|
41
|
+
- 99db30d: Simplify protocol, security boundaries, and SDK structure
|
|
42
|
+
- 5cc9550: Security hardening: deploy ownership check, SSRF DNS fail-closed + hostname blocking, timing-safe auth tokens, run_code timer cleanup, WebSocket payload limits, message buffer cap, clientFiles size limits, HTML escape completeness, KV error sanitization
|
|
43
|
+
- 4c1cd20: Remove duplicate startSession patterns and dead resumeFrom plumbing
|
|
44
|
+
- f6e7a5c: BREAKING: Align SDK naming with S2S API
|
|
45
|
+
|
|
46
|
+
- `instructions` → `systemPrompt` in AgentOptions/AgentDef
|
|
47
|
+
- `DEFAULT_INSTRUCTIONS` → `DEFAULT_SYSTEM_PROMPT`
|
|
48
|
+
- `onTurn` → `onUserTranscript` hook
|
|
49
|
+
- Protocol events renamed: `transcript` → `user_transcript_delta`, `turn` → `user_transcript`, `chat` → `agent_transcript`, `chat_delta` → `agent_transcript_delta`, `tts_done` → `reply_done`, `tool_call_start` → `tool_call`
|
|
50
|
+
|
|
51
|
+
- 9d2141b: Simplify and refactor: eliminate duplicated code, fix leaky abstractions, improve hot-path efficiency
|
|
52
|
+
- 05f8759: Replace hand-rolled utilities with dependencies: dotenv for .env parsing, mime-types and escape-html in dev server, p-debounce for file watcher
|
|
53
|
+
- 1678546: Simplify codebase: use p-timeout for shutdown, html-to-text for HTML conversion, deduplicate secret key validation
|
|
54
|
+
- 64d83b6: Add Zod validation to NDJSON guest-to-host responses, fix session state memory leak
|
|
55
|
+
- 6d3ec72: Improve S2S load test concurrency: quiet mode, staggered ramp-up, zero-copy audio buffers
|
|
56
|
+
|
|
57
|
+
## 0.12.3
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- 4ebd7b6: Standardize file and directory naming to idiomatic kebab-case conventions
|
|
62
|
+
|
|
63
|
+
- Add ls-lint for file naming enforcement
|
|
64
|
+
- Drop underscore prefix from internal files in aai-server (e.g. `_schemas.ts` → `schemas.ts`)
|
|
65
|
+
- Rename `_components` → `components` and `__fixtures__` → `fixtures` in aai-ui
|
|
66
|
+
- Rename `__fixtures__` → `fixtures` in aai/host
|
|
67
|
+
- Flatten aai-server by removing `src/` directory
|
|
68
|
+
|
|
69
|
+
- 68f4d84: Make more cross platform
|
|
70
|
+
|
|
71
|
+
## 0.12.2
|
|
72
|
+
|
|
73
|
+
## 0.12.1
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- f4762a1: Externalize zod from agent bundles, remove storage cache, improve CI reliability
|
|
78
|
+
|
|
79
|
+
## 0.12.0
|
|
80
|
+
|
|
81
|
+
### Minor Changes
|
|
82
|
+
|
|
83
|
+
- 99e62c3: Remove `memoryTools()` and the `"memory"` builtin tool. Users who need KV-backed memory tools should define them directly in their agent's `tools` record.
|
|
84
|
+
|
|
85
|
+
## 0.11.1
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- c25ee7e: Trigger deploy for SDK and server
|
|
90
|
+
|
|
91
|
+
## 0.11.0
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- 491ec37: CLI overhaul: remove generate command, unify output style, template descriptions
|
|
96
|
+
|
|
97
|
+
- Remove `generate` and `run` commands and AI SDK dependencies
|
|
98
|
+
- Unify CLI output to use @clack/prompts style consistently
|
|
99
|
+
- Add template descriptions shown as hints in `aai init` select prompt
|
|
100
|
+
- Fix deploy slug mismatch between bundle and deploy steps
|
|
101
|
+
- Clean deploy error messages (no stack traces)
|
|
102
|
+
- Add `@alexkroman1/aai-cli` to scaffold devDependencies
|
|
103
|
+
- Remove fly.toml from scaffold
|
|
104
|
+
- Use cyanBright for all URLs in CLI output
|
|
105
|
+
- Remove eventsource-parser patch
|
|
106
|
+
- Add link-workspace-packages to .npmrc
|
|
107
|
+
- Fix Dockerfile: run esbuild install script, remove patches references
|
|
108
|
+
|
|
109
|
+
## 0.10.4
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- 6f6a43e: Harden platform security and refactor to @hono/zod-validator
|
|
114
|
+
|
|
115
|
+
- Fix crash in sandbox-network when host.internal hit without handler
|
|
116
|
+
- Add Zod validation to KV bridge (isolate→host) replacing raw JSON.parse
|
|
117
|
+
- Refactor deploy, secret, and KV handlers to use @hono/zod-validator middleware
|
|
118
|
+
- Fix type errors in \_harness-runtime.ts and sandbox.ts
|
|
119
|
+
- Remove factory.ts, inline into orchestrator
|
|
120
|
+
- Add 185 new security tests for cross-agent isolation, SSRF, and trust boundaries
|
|
121
|
+
|
|
122
|
+
## 0.10.3
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- 8d5f616: Use Hono builtins for WebSocket, security headers, and HTML escaping
|
|
127
|
+
|
|
128
|
+
- Replace manual WebSocketServer + upgrade handling with @hono/node-ws
|
|
129
|
+
- Replace custom escapeHtml() with Hono's html tagged template
|
|
130
|
+
- Replace manual CSP string with secureHeaders middleware
|
|
131
|
+
- Fix aai rag to use local dev server in dev mode
|
|
132
|
+
- Fix vector upsert model loading in local dev mode
|
|
133
|
+
- Add missing aws4fetch dependency for unstorage S3 driver
|
|
134
|
+
|
|
135
|
+
## 0.10.2
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- 9de059e: Add repository.url for npm provenance, fix circular dependency, bump CI actions
|
|
140
|
+
- 1397f37: Fix Fly deploy config path and CI improvements
|
|
141
|
+
|
|
142
|
+
## 0.10.1
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- aa23a1c: Add repository.url for npm provenance, fix circular dependency, bump CI actions
|
|
147
|
+
|
|
148
|
+
## 0.10.0
|
|
149
|
+
|
|
150
|
+
### Minor Changes
|
|
151
|
+
|
|
152
|
+
- Replace LanceDB with sqlite-vec for vector storage, add `generate` CLI command, extract templates to giget, local dev mode improvements, auth cleanup, and graceful shutdown fixes
|
|
153
|
+
|
|
154
|
+
## 0.9.4
|
|
155
|
+
|
|
156
|
+
### Patch Changes
|
|
157
|
+
|
|
158
|
+
- Release all packages with version increment
|
|
159
|
+
|
|
160
|
+
## 0.9.3
|
|
161
|
+
|
|
162
|
+
## 0.9.2
|
|
163
|
+
|
|
164
|
+
## 0.9.1
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- Update
|
|
169
|
+
|
|
170
|
+
## 0.9.0
|
|
171
|
+
|
|
172
|
+
### Minor Changes
|
|
173
|
+
|
|
174
|
+
- Updated toolchain
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region sdk/constants.ts
|
|
2
|
+
/**
|
|
3
|
+
* Centralised numeric constants — timeouts, size limits, sample rates.
|
|
4
|
+
*
|
|
5
|
+
* Every magic number that controls a timeout, buffer size, or threshold
|
|
6
|
+
* lives here so the values are discoverable in one place.
|
|
7
|
+
*/
|
|
8
|
+
/** Default sample rate for speech-to-text audio in Hz (AssemblyAI). */
|
|
9
|
+
const DEFAULT_STT_SAMPLE_RATE = 16e3;
|
|
10
|
+
/** Default sample rate for text-to-speech audio in Hz. */
|
|
11
|
+
const DEFAULT_TTS_SAMPLE_RATE = 24e3;
|
|
12
|
+
/** Default timeout for tool execution in the worker. */
|
|
13
|
+
const TOOL_EXECUTION_TIMEOUT_MS = 3e4;
|
|
14
|
+
/** Timeout for session.start() (S2S connection setup). */
|
|
15
|
+
const DEFAULT_SESSION_START_TIMEOUT_MS = 1e4;
|
|
16
|
+
/** S2S session idle timeout before auto-close. */
|
|
17
|
+
const DEFAULT_IDLE_TIMEOUT_MS = 3e5;
|
|
18
|
+
/** Per-fetch timeout for network tools (web_search, visit_webpage, fetch_json). */
|
|
19
|
+
const FETCH_TIMEOUT_MS = 15e3;
|
|
20
|
+
/** Timeout for sandboxed run_code execution. */
|
|
21
|
+
const RUN_CODE_TIMEOUT_MS = 5e3;
|
|
22
|
+
/** Maximum time to wait for sessions to stop during graceful shutdown. */
|
|
23
|
+
const DEFAULT_SHUTDOWN_TIMEOUT_MS = 3e4;
|
|
24
|
+
/** Maximum length for tool result strings sent to clients. */
|
|
25
|
+
const MAX_TOOL_RESULT_CHARS = 4e3;
|
|
26
|
+
/** Maximum chars for webpage text after HTML-to-text conversion. */
|
|
27
|
+
const MAX_PAGE_CHARS = 1e4;
|
|
28
|
+
/** Maximum bytes to fetch from an HTML page before conversion. */
|
|
29
|
+
const MAX_HTML_BYTES = 2e5;
|
|
30
|
+
/** Maximum value size for KV store entries (bytes). */
|
|
31
|
+
const MAX_VALUE_SIZE = 65536;
|
|
32
|
+
/** Maximum conversation messages to retain (sliding window). */
|
|
33
|
+
const DEFAULT_MAX_HISTORY = 200;
|
|
34
|
+
/** Maximum WebSocket message payload size (bytes, 1 MiB). */
|
|
35
|
+
const MAX_WS_PAYLOAD_BYTES = 1 * 1024 * 1024;
|
|
36
|
+
/** Maximum messages buffered while session.start() is pending. */
|
|
37
|
+
const MAX_MESSAGE_BUFFER_SIZE = 100;
|
|
38
|
+
/** WebSocket readyState value indicating the connection is open. */
|
|
39
|
+
const WS_OPEN = 1;
|
|
40
|
+
/**
|
|
41
|
+
* Content-Security-Policy applied to agent UI pages (both self-hosted and
|
|
42
|
+
* platform). Single source of truth — used by `secureHeaders` middleware
|
|
43
|
+
* and per-response CSP headers.
|
|
44
|
+
*/
|
|
45
|
+
const AGENT_CSP = "default-src 'self'; script-src 'self' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src 'self' wss: ws:; img-src 'self' data:; font-src 'self' https://fonts.gstatic.com; object-src 'none'; base-uri 'self'";
|
|
46
|
+
//#endregion
|
|
47
|
+
export { WS_OPEN as _, DEFAULT_SHUTDOWN_TIMEOUT_MS as a, FETCH_TIMEOUT_MS as c, MAX_PAGE_CHARS as d, MAX_TOOL_RESULT_CHARS as f, TOOL_EXECUTION_TIMEOUT_MS as g, RUN_CODE_TIMEOUT_MS as h, DEFAULT_SESSION_START_TIMEOUT_MS as i, MAX_HTML_BYTES as l, MAX_WS_PAYLOAD_BYTES as m, DEFAULT_IDLE_TIMEOUT_MS as n, DEFAULT_STT_SAMPLE_RATE as o, MAX_VALUE_SIZE as p, DEFAULT_MAX_HISTORY as r, DEFAULT_TTS_SAMPLE_RATE as s, AGENT_CSP as t, MAX_MESSAGE_BUFFER_SIZE as u };
|
package/dist/host/_run-code.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* context with no network, filesystem, or process access.
|
|
4
4
|
*/
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
import type { ToolDef } from "../
|
|
6
|
+
import type { ToolDef } from "../sdk/types.ts";
|
|
7
7
|
declare const runCodeParams: z.ZodObject<{
|
|
8
8
|
code: z.ZodString;
|
|
9
9
|
}, z.core.$strip>;
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
*
|
|
20
20
|
* @example Sandbox (integration test in aai-server)
|
|
21
21
|
* ```ts
|
|
22
|
-
* import
|
|
22
|
+
* // Internal module — import the .ts source directly from this package.
|
|
23
|
+
* import { testRuntime } from "../../aai/host/_runtime-conformance.ts";
|
|
23
24
|
*
|
|
24
25
|
* testRuntime("sandbox", async () => {
|
|
25
26
|
* // ... start isolate with a bundled agent
|
|
@@ -27,9 +28,8 @@
|
|
|
27
28
|
* });
|
|
28
29
|
* ```
|
|
29
30
|
*/
|
|
30
|
-
import type { ExecuteTool } from "../
|
|
31
|
-
import type {
|
|
32
|
-
import { type AgentDef } from "../isolate/types.ts";
|
|
31
|
+
import type { ExecuteTool } from "../sdk/_internal-types.ts";
|
|
32
|
+
import type { AgentDef } from "../sdk/types.ts";
|
|
33
33
|
/**
|
|
34
34
|
* Minimal runtime surface needed for conformance tests.
|
|
35
35
|
*
|
|
@@ -38,7 +38,6 @@ import { type AgentDef } from "../isolate/types.ts";
|
|
|
38
38
|
*/
|
|
39
39
|
export type RuntimeTestContext = {
|
|
40
40
|
executeTool: ExecuteTool;
|
|
41
|
-
hooks: AgentHooks;
|
|
42
41
|
};
|
|
43
42
|
/** Agent definition used by the conformance suite (direct executor path). */
|
|
44
43
|
export declare const CONFORMANCE_AGENT: AgentDef;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Network requests go through the host's fetch proxy (with SSRF protection).
|
|
7
7
|
*/
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { type ToolSchema } from "../
|
|
10
|
-
import type { ToolDef } from "../
|
|
9
|
+
import { type ToolSchema } from "../sdk/_internal-types.ts";
|
|
10
|
+
import type { ToolDef } from "../sdk/types.ts";
|
|
11
11
|
export { executeInIsolate } from "./_run-code.ts";
|
|
12
12
|
/** Options for creating built-in tool definitions. */
|
|
13
13
|
export type BuiltinToolOptions = {
|
|
@@ -15,12 +15,14 @@ export type BuiltinToolOptions = {
|
|
|
15
15
|
fetch?: typeof globalThis.fetch;
|
|
16
16
|
};
|
|
17
17
|
type ToolDefRecord = Record<string, ToolDef<z.ZodObject<z.ZodRawShape>>>;
|
|
18
|
+
/** Resolved builtins with defs, schemas, and guidance computed in a single pass. */
|
|
19
|
+
export type ResolvedBuiltins = {
|
|
20
|
+
defs: ToolDefRecord;
|
|
21
|
+
schemas: ToolSchema[];
|
|
22
|
+
guidance: string[];
|
|
23
|
+
};
|
|
18
24
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
25
|
+
* Resolve all builtin tools in one pass, returning defs, schemas, and guidance.
|
|
26
|
+
* Avoids redundant calls to `resolveBuiltin` and `z.toJSONSchema`.
|
|
21
27
|
*/
|
|
22
|
-
export declare function
|
|
23
|
-
/** Returns system prompt guidance strings for the specified builtin tools. */
|
|
24
|
-
export declare function getBuiltinToolGuidance(names: readonly string[]): string[];
|
|
25
|
-
/** Returns JSON tool schemas for the specified builtin tools. */
|
|
26
|
-
export declare function getBuiltinToolSchemas(names: readonly string[]): ToolSchema[];
|
|
28
|
+
export declare function resolveAllBuiltins(names: readonly string[], opts?: BuiltinToolOptions): ResolvedBuiltins;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime barrel — the full Node.js runtime engine for running agents.
|
|
3
|
+
*
|
|
4
|
+
* Used by aai-server (sandbox) and aai-cli (dev server).
|
|
5
|
+
*/
|
|
6
|
+
export * from "./builtin-tools.ts";
|
|
7
|
+
export * from "./runtime.ts";
|
|
8
|
+
export * from "./runtime-config.ts";
|
|
9
|
+
export * from "./s2s.ts";
|
|
10
|
+
export * from "./server.ts";
|
|
11
|
+
export * from "./session.ts";
|
|
12
|
+
export * from "./session-ctx.ts";
|
|
13
|
+
export * from "./tool-executor.ts";
|
|
14
|
+
export * from "./unstorage-kv.ts";
|
|
15
|
+
export * from "./ws-handler.ts";
|