@voicethere/agent 0.1.0 → 0.1.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/README.md +32 -35
- package/dist/build-bundle.d.ts +14 -0
- package/dist/build-bundle.d.ts.map +1 -0
- package/dist/build-bundle.js +25 -0
- package/dist/build-bundle.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -0
- package/dist/cli.js.map +1 -0
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.js +1 -1
- package/package.json +7 -4
- package/templates/README.md +4 -3
- package/templates/agent.ts +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @voicethere/agent
|
|
2
2
|
|
|
3
|
-
VoiceThere **customer agent SDK** — TypeScript types and runtime helpers for sandboxed child bundles running inside
|
|
3
|
+
VoiceThere **customer agent SDK** — TypeScript types and runtime helpers for sandboxed child bundles running inside the **VoiceThere agent runner** (session worker).
|
|
4
4
|
|
|
5
5
|
**npm:** `@voicethere/agent`
|
|
6
6
|
**Repo:** [`voicethere/agent`](https://github.com/voicethere/agent)
|
|
@@ -9,7 +9,7 @@ VoiceThere **customer agent SDK** — TypeScript types and runtime helpers for s
|
|
|
9
9
|
|
|
10
10
|
| Layer | Package | Runs in |
|
|
11
11
|
| --------- | ----------------------------------------------------------- | ------------------------------------ |
|
|
12
|
-
| Parent |
|
|
12
|
+
| Parent | VoiceThere agent runner | Trusted Node + WebRTC + speech stack |
|
|
13
13
|
| **Child** | **`@voicethere/agent`** | Sandboxed customer `agent.js` bundle |
|
|
14
14
|
|
|
15
15
|
The child receives speech lifecycle events over IPC (same shapes as `@node-webrtc-rust/sdk/voice`) and calls `speak()` to request TTS from the parent.
|
|
@@ -23,11 +23,10 @@ npm install
|
|
|
23
23
|
npm run build
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
**Voice E2E:** deploy to the VoiceThere platform or run against your organization's internal agent runner. With a local runner checkout, point it at your bundle:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
|
|
30
|
-
AGENT_BUNDLE_PATH=../agent/dist/agent.js npm run start
|
|
29
|
+
AGENT_BUNDLE_PATH=/path/to/dist/agent.js npm run start
|
|
31
30
|
```
|
|
32
31
|
|
|
33
32
|
Open the runner URL in a browser, connect, and speak.
|
|
@@ -45,9 +44,9 @@ npm run verify:local
|
|
|
45
44
|
| `npm run verify:local` | **Default** — `npm run build`, then fork `dist/agent.js` in the sandbox and assert a `speak` reply to `user_speech_final` |
|
|
46
45
|
| `npm run verify:local:only` | Re-run smoke after build; optional `AGENT_BUNDLE_PATH=./dist/agent.js` or `--bundle <path>` |
|
|
47
46
|
|
|
48
|
-
This checks bundle load, IPC, and Node permission flags. It does **not** replace a voice roundtrip — use
|
|
47
|
+
This checks bundle load, IPC, and Node permission flags. It does **not** replace a voice roundtrip — use the VoiceThere agent runner (platform or internal deployment) for mic/WebRTC E2E.
|
|
49
48
|
|
|
50
|
-
Harness: [`scripts/sandbox/`](./scripts/sandbox/) (aligned with
|
|
49
|
+
Harness: [`scripts/sandbox/`](./scripts/sandbox/) (aligned with the agent runner child launcher).
|
|
51
50
|
|
|
52
51
|
## API
|
|
53
52
|
|
|
@@ -82,7 +81,7 @@ defineAgent({
|
|
|
82
81
|
| `SPEECH_EVENT_TYPE` | Import from `@node-webrtc-rust/sdk/voice` (runtime constants; not bundled into child) |
|
|
83
82
|
| `speak` | Request parent TTS |
|
|
84
83
|
| `agentLog` | Forward structured logs to parent |
|
|
85
|
-
| `ParentToChildMessage` / `ChildToParentMessage` | IPC contract shared with
|
|
84
|
+
| `ParentToChildMessage` / `ChildToParentMessage` | IPC contract shared with the VoiceThere agent runner |
|
|
86
85
|
|
|
87
86
|
### Speech events (parent → child)
|
|
88
87
|
|
|
@@ -102,31 +101,29 @@ Copy [`templates/agent.ts`](./templates/agent.ts) as a starting point — exhaus
|
|
|
102
101
|
|
|
103
102
|
## Building your agent bundle
|
|
104
103
|
|
|
105
|
-
**Recommended:**
|
|
104
|
+
**Recommended:** bundle with the package CLI (same esbuild settings VoiceThere uses in production):
|
|
106
105
|
|
|
107
106
|
```bash
|
|
108
|
-
npm install @voicethere/agent
|
|
109
|
-
npx
|
|
107
|
+
npm install @voicethere/agent
|
|
108
|
+
npx @voicethere/agent build
|
|
109
|
+
# or: npx @voicethere/agent build --entry src/agent.ts --outfile dist/agent.js
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
Defaults: entry `agent.ts`, output `dist/agent.js`. Upload the bundle (or point `AGENT_BUNDLE_PATH` at it locally). Inlining dependencies avoids runtime `node_modules` resolution inside the sandbox.
|
|
113
113
|
|
|
114
114
|
## Sandbox and security model
|
|
115
115
|
|
|
116
|
-
Customer code runs in a **forked child process**, separate from the trusted runner parent (
|
|
116
|
+
Customer code runs in a **forked child process**, separate from the trusted agent runner parent (WebRTC, speech stack, TTS). Security is layered:
|
|
117
117
|
|
|
118
118
|
```text
|
|
119
119
|
┌──────────────────────────────────────────────────────────────┐
|
|
120
|
-
│
|
|
120
|
+
│ Agent runner parent (trusted) — WebRTC, speech stack, TTS │
|
|
121
121
|
│ fork(loader-entry.js, execArgv: [--permission, …]) │
|
|
122
122
|
│ │ IPC (process.send / on('message')) │
|
|
123
123
|
│ ▼ │
|
|
124
124
|
│ Customer child — Node Permission Model + stripped env │
|
|
125
125
|
│ loader-entry.js → import(your agent.js) │
|
|
126
126
|
└──────────────────────────────────────────────────────────────┘
|
|
127
|
-
│ same pod network namespace (K8s)
|
|
128
|
-
▼
|
|
129
|
-
Cilium NetworkPolicy on runner pod (egress rules)
|
|
130
127
|
```
|
|
131
128
|
|
|
132
129
|
### Layer 1 — Process isolation
|
|
@@ -134,9 +131,9 @@ Customer code runs in a **forked child process**, separate from the trusted runn
|
|
|
134
131
|
| Mechanism | What it means for your bundle |
|
|
135
132
|
| --------- | ----------------------------- |
|
|
136
133
|
| **Separate process** | Crash or `process.exit` in your bundle does not take down the parent voice stack |
|
|
137
|
-
| **IPC only** |
|
|
138
|
-
| **Stripped `process.env`** | Child receives only `NODE_ENV`, internal loader path, and allowlisted keys (`SESSION_ID`, `PROJECT_ID`, `BUILD_ID`) — not parent
|
|
139
|
-
| **Console redirection** | `console.log` / `warn` / `error` → IPC logs
|
|
134
|
+
| **IPC only for media** | WebRTC, mic, STT, and TTS go through the parent — use `defineAgent`, `speak`, and speech events |
|
|
135
|
+
| **Stripped `process.env`** | Child receives only `NODE_ENV`, internal loader path, and allowlisted keys (`SESSION_ID`, `PROJECT_ID`, `BUILD_ID`) — not parent secrets |
|
|
136
|
+
| **Console redirection** | `console.log` / `warn` / `error` → IPC logs |
|
|
140
137
|
|
|
141
138
|
### Layer 2 — Node `--permission` (runtime-enforced)
|
|
142
139
|
|
|
@@ -147,7 +144,7 @@ The parent starts the child with Node’s [Permission Model](https://nodejs.org/
|
|
|
147
144
|
| Flag | Effect |
|
|
148
145
|
| ---- | ------ |
|
|
149
146
|
| `--permission` | Enables restriction mode |
|
|
150
|
-
| `--allow-fs-read=<loaderDir>` | Read files under the
|
|
147
|
+
| `--allow-fs-read=<loaderDir>` | Read files under the child loader directory |
|
|
151
148
|
| `--allow-fs-read=<bundleParentDir>` | Read files under the **directory containing your `agent.js`** (see below) |
|
|
152
149
|
|
|
153
150
|
**Not granted → blocked at runtime:**
|
|
@@ -163,6 +160,8 @@ The parent starts the child with Node’s [Permission Model](https://nodejs.org/
|
|
|
163
160
|
|
|
164
161
|
This is **not** an import allowlist — Node gates **capability classes**, not package names. Using `node:fs` inside the allowed read tree can work; using it on `/etc/passwd` does not.
|
|
165
162
|
|
|
163
|
+
**Network is not gated by `--permission`.** `fetch`, `http`, `https`, and other outbound calls use the same network namespace as the parent. On VoiceThere-hosted sessions, **public internet egress is allowed** (e.g. calling your LLM or tool APIs). **Private cluster / internal platform addresses are not reachable** from the child — use the parent IPC surface for voice, not in-cluster services.
|
|
164
|
+
|
|
166
165
|
### Bundle directory vs single file
|
|
167
166
|
|
|
168
167
|
`--allow-fs-read` is applied to **`dirname(bundlePath)`**, not only the `.js` file:
|
|
@@ -185,26 +184,21 @@ This is **not** an import allowlist — Node gates **capability classes**, not p
|
|
|
185
184
|
|
|
186
185
|
Prefer **one esbuild bundle** so production behavior matches `npm run verify:local`.
|
|
187
186
|
|
|
188
|
-
### Layer 3 — Platform policy
|
|
189
|
-
|
|
190
|
-
These are **unsupported** in customer bundles even if Node might not block them today:
|
|
187
|
+
### Layer 3 — Platform policy
|
|
191
188
|
|
|
192
|
-
| Capability |
|
|
193
|
-
| ---------- |
|
|
194
|
-
| **Outbound network** (`fetch`, `http`, `
|
|
189
|
+
| Capability | Behavior |
|
|
190
|
+
| ---------- | -------- |
|
|
191
|
+
| **Outbound network** (`fetch`, `http`, `https`) | **Public internet:** allowed — typical for LLM/tool calls from your agent code. **Internal platform / private network:** blocked on hosted sessions. |
|
|
195
192
|
| **`process.exit`** | Not blocked — kills your agent leg; parent may play crash TTS |
|
|
196
193
|
| **Direct WebRTC / mic / STT / TTS** | Parent only — use `speak()` and speech event handlers |
|
|
197
194
|
|
|
198
|
-
### Layer 4 — Kubernetes (runner pod)
|
|
199
|
-
|
|
200
|
-
On cluster deploy, the runner pod also has Helm hardening (non-root, read-only rootfs, dropped caps) and **NetworkPolicy** for egress. That applies to the whole pod (parent + child).
|
|
201
|
-
|
|
202
195
|
### What you should use in agent code
|
|
203
196
|
|
|
204
197
|
**Supported**
|
|
205
198
|
|
|
206
199
|
- `@voicethere/agent` (`defineAgent`, `speak`, `agentLog`, `onSpeechEvent`, …)
|
|
207
200
|
- Pure TypeScript/JavaScript logic and in-memory state
|
|
201
|
+
- **`fetch` / HTTP(S) to public APIs** (LLMs, tools, your backends on the internet)
|
|
208
202
|
- Allowlisted env from `onSessionStart` (`SESSION_ID`, `PROJECT_ID`, `BUILD_ID`)
|
|
209
203
|
- `SPEECH_EVENT_TYPE` from `@node-webrtc-rust/sdk/voice` at build time (avoid bundling the full SDK runtime into the child when possible)
|
|
210
204
|
|
|
@@ -215,13 +209,14 @@ On cluster deploy, the runner pod also has Helm hardening (non-root, read-only r
|
|
|
215
209
|
- File writes
|
|
216
210
|
- Native Node addons (`.node`)
|
|
217
211
|
- `worker_threads` (not allowed)
|
|
218
|
-
- Direct
|
|
212
|
+
- Direct WebRTC / mic / STT / TTS (use parent IPC)
|
|
213
|
+
- Reachability to internal platform addresses from hosted sessions
|
|
219
214
|
|
|
220
215
|
**Pre-publish checklist**
|
|
221
216
|
|
|
222
217
|
1. `npm run build` — produce `dist/agent.js`
|
|
223
218
|
2. `npm run verify:local` — sandbox + IPC smoke (same flags as production child)
|
|
224
|
-
3. Optional: voice E2E with
|
|
219
|
+
3. Optional: voice E2E with the VoiceThere agent runner (platform or internal deployment)
|
|
225
220
|
|
|
226
221
|
## Build outputs
|
|
227
222
|
|
|
@@ -233,7 +228,9 @@ On cluster deploy, the runner pod also has Helm hardening (non-root, read-only r
|
|
|
233
228
|
## Scripts
|
|
234
229
|
|
|
235
230
|
```bash
|
|
236
|
-
npm run build #
|
|
231
|
+
npm run build # compile SDK + example bundle (repo dev)
|
|
232
|
+
npm run build:lib # compile SDK only (tsc → dist/)
|
|
233
|
+
npx @voicethere/agent build # customer project: bundle agent.ts → dist/agent.js
|
|
237
234
|
npm run verify:local # sandbox smoke (build + fork bundle)
|
|
238
235
|
npm run test:ci # typecheck + vitest
|
|
239
236
|
```
|
|
@@ -246,6 +243,6 @@ See [`scripts/RELEASE.md`](./scripts/RELEASE.md) — tag `release/X.Y.Z` trigger
|
|
|
246
243
|
|
|
247
244
|
| Repo | Purpose |
|
|
248
245
|
| ----------------------------------------------------------------------------- | ------------------------------------------------------------- |
|
|
249
|
-
|
|
|
246
|
+
| VoiceThere agent runner (internal session worker) | Hosts your `agent.js` bundle in production and local E2E |
|
|
250
247
|
| [`voicethere/cli`](https://github.com/voicethere/cli) | CLI for the VoiceThere platform (projects, deploys, sessions) |
|
|
251
248
|
| [`akirilyuk/node-webrtc-rust`](https://github.com/akirilyuk/node-webrtc-rust) | WebRTC + voice SDK (`SpeechEvent` types) |
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as esbuild from "esbuild";
|
|
2
|
+
export interface BuildAgentBundleOptions {
|
|
3
|
+
/** Agent source entry (TypeScript or JavaScript). */
|
|
4
|
+
entry: string;
|
|
5
|
+
/** Output bundle path (typically `dist/agent.js`). */
|
|
6
|
+
outfile: string;
|
|
7
|
+
/** Working directory for relative paths. Defaults to `process.cwd()`. */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Bundle customer agent source into a single ESM file for the sandboxed child.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildAgentBundle(options: BuildAgentBundleOptions): Promise<esbuild.BuildResult>;
|
|
14
|
+
//# sourceMappingURL=build-bundle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-bundle.d.ts","sourceRoot":"","sources":["../src/build-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAoB9B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import * as esbuild from "esbuild";
|
|
4
|
+
/**
|
|
5
|
+
* Bundle customer agent source into a single ESM file for the sandboxed child.
|
|
6
|
+
*/
|
|
7
|
+
export async function buildAgentBundle(options) {
|
|
8
|
+
const cwd = options.cwd ?? process.cwd();
|
|
9
|
+
const entry = resolve(cwd, options.entry);
|
|
10
|
+
const outfile = resolve(cwd, options.outfile);
|
|
11
|
+
if (!existsSync(entry)) {
|
|
12
|
+
throw new Error(`Entry not found: ${entry}`);
|
|
13
|
+
}
|
|
14
|
+
mkdirSync(dirname(outfile), { recursive: true });
|
|
15
|
+
return esbuild.build({
|
|
16
|
+
entryPoints: [entry],
|
|
17
|
+
bundle: true,
|
|
18
|
+
platform: "node",
|
|
19
|
+
format: "esm",
|
|
20
|
+
outfile,
|
|
21
|
+
target: "node22",
|
|
22
|
+
logLevel: "warning",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=build-bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-bundle.js","sourceRoot":"","sources":["../src/build-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAWnC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC;IAEhC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjD,OAAO,OAAO,CAAC,KAAK,CAAC;QACnB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,MAAM;QAChB,MAAM,EAAE,KAAK;QACb,OAAO;QACP,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Customer-facing CLI — bundle agent source for the VoiceThere sandbox.
|
|
4
|
+
*
|
|
5
|
+
* npx @voicethere/agent build
|
|
6
|
+
* npx @voicethere/agent build --entry agent.ts --outfile dist/agent.js
|
|
7
|
+
*/
|
|
8
|
+
import { buildAgentBundle } from "./build-bundle.js";
|
|
9
|
+
const DEFAULT_ENTRY = "agent.ts";
|
|
10
|
+
const DEFAULT_OUTFILE = "dist/agent.js";
|
|
11
|
+
function printHelp() {
|
|
12
|
+
process.stdout.write(`@voicethere/agent — bundle your voice agent for VoiceThere
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
npx @voicethere/agent build [options]
|
|
16
|
+
npx @voicethere/agent [options] (build is the default command)
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
--entry, -e <path> Agent entry file (default: ${DEFAULT_ENTRY})
|
|
20
|
+
--outfile, -o <path> Output bundle (default: ${DEFAULT_OUTFILE})
|
|
21
|
+
--help, -h Show this help
|
|
22
|
+
|
|
23
|
+
Example:
|
|
24
|
+
npm install @voicethere/agent
|
|
25
|
+
npx @voicethere/agent build --entry src/agent.ts --outfile dist/agent.js
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
function parseBuildArgs(argv) {
|
|
29
|
+
let entry = DEFAULT_ENTRY;
|
|
30
|
+
let outfile = DEFAULT_OUTFILE;
|
|
31
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
32
|
+
const arg = argv[i];
|
|
33
|
+
if (arg === "--help" || arg === "-h") {
|
|
34
|
+
printHelp();
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
if (arg === "--entry" || arg === "-e") {
|
|
38
|
+
const value = argv[i + 1];
|
|
39
|
+
if (!value) {
|
|
40
|
+
throw new Error(`${arg} requires a path`);
|
|
41
|
+
}
|
|
42
|
+
entry = value;
|
|
43
|
+
i += 1;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (arg === "--outfile" || arg === "-o") {
|
|
47
|
+
const value = argv[i + 1];
|
|
48
|
+
if (!value) {
|
|
49
|
+
throw new Error(`${arg} requires a path`);
|
|
50
|
+
}
|
|
51
|
+
outfile = value;
|
|
52
|
+
i += 1;
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
56
|
+
}
|
|
57
|
+
return { entry, outfile };
|
|
58
|
+
}
|
|
59
|
+
async function runBuild(argv) {
|
|
60
|
+
const { entry, outfile } = parseBuildArgs(argv);
|
|
61
|
+
await buildAgentBundle({ entry, outfile });
|
|
62
|
+
process.stdout.write(`Built ${outfile} from ${entry}\n`);
|
|
63
|
+
}
|
|
64
|
+
async function main() {
|
|
65
|
+
const args = process.argv.slice(2);
|
|
66
|
+
if (args.length === 0) {
|
|
67
|
+
await runBuild([]);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (args[0] === "help" || args[0] === "--help" || args[0] === "-h") {
|
|
71
|
+
printHelp();
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (args[0] === "build") {
|
|
75
|
+
await runBuild(args.slice(1));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (args[0]?.startsWith("-")) {
|
|
79
|
+
await runBuild(args);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
process.stderr.write(`Unknown command: ${args[0]}\n\n`);
|
|
83
|
+
printHelp();
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
main().catch((error) => {
|
|
87
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
88
|
+
process.stderr.write(`agent build failed: ${message}\n`);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,aAAa,GAAG,UAAU,CAAC;AACjC,MAAM,eAAe,GAAG,eAAe,CAAC;AAExC,SAAS,SAAS;IAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;;;;;;;sDAO+B,aAAa;mDAChB,eAAe;;;;;;CAMjE,CAAC,CAAC;AACH,CAAC;AAOD,SAAS,cAAc,CAAC,IAAc;IACpC,IAAI,KAAK,GAAG,aAAa,CAAC;IAC1B,IAAI,OAAO,GAAG,eAAe,CAAC;IAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACrC,SAAS,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACtC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,kBAAkB,CAAC,CAAC;YAC5C,CAAC;YACD,KAAK,GAAG,KAAK,CAAC;YACd,CAAC,IAAI,CAAC,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,WAAW,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACxC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,kBAAkB,CAAC,CAAC;YAC5C,CAAC;YACD,OAAO,GAAG,KAAK,CAAC;YAChB,CAAC,IAAI,CAAC,CAAC;YACP,SAAS;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,IAAc;IACpC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IAChD,MAAM,gBAAgB,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,OAAO,SAAS,KAAK,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAEnC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnB,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACnE,SAAS,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;QACxB,MAAM,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO;IACT,CAAC;IAED,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrB,OAAO;IACT,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxD,SAAS,EAAE,CAAC;IACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uBAAuB,OAAO,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Transport: Node.js `process.send` / `process.on('message')` on a forked child.
|
|
5
5
|
* Speech payloads use {@link SpeechEvent} from `@node-webrtc-rust/sdk/voice` unchanged.
|
|
6
6
|
*
|
|
7
|
-
* IPC shapes are shared with
|
|
7
|
+
* IPC shapes are shared with the VoiceThere agent runner (session worker parent).
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
package/dist/protocol.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Transport: Node.js `process.send` / `process.on('message')` on a forked child.
|
|
5
5
|
* Speech payloads use {@link SpeechEvent} from `@node-webrtc-rust/sdk/voice` unchanged.
|
|
6
6
|
*
|
|
7
|
-
* IPC shapes are shared with
|
|
7
|
+
* IPC shapes are shared with the VoiceThere agent runner (session worker parent).
|
|
8
8
|
*
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voicethere/agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "VoiceThere customer agent SDK — IPC types and runtime helpers for sandboxed child bundles",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
"import": "./dist/index.js"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
+
"bin": "./dist/cli.js",
|
|
12
13
|
"files": [
|
|
13
14
|
"dist",
|
|
14
15
|
"templates",
|
|
15
16
|
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
|
-
"build": "tsc -p tsconfig.json
|
|
19
|
+
"build:lib": "tsc -p tsconfig.json",
|
|
20
|
+
"build:example": "node dist/cli.js build --entry examples/agent.ts --outfile dist/agent.js",
|
|
21
|
+
"build": "npm run build:lib && npm run build:example",
|
|
19
22
|
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.test.json",
|
|
20
23
|
"test": "vitest run",
|
|
21
24
|
"test:ci": "npm run typecheck && npm run build && npm run test",
|
|
@@ -45,14 +48,14 @@
|
|
|
45
48
|
},
|
|
46
49
|
"license": "UNLICENSED",
|
|
47
50
|
"dependencies": {
|
|
48
|
-
"@node-webrtc-rust/sdk": "0.5.2"
|
|
51
|
+
"@node-webrtc-rust/sdk": "0.5.2",
|
|
52
|
+
"esbuild": "^0.25.12"
|
|
49
53
|
},
|
|
50
54
|
"peerDependencies": {
|
|
51
55
|
"@node-webrtc-rust/sdk": ">=0.5.2"
|
|
52
56
|
},
|
|
53
57
|
"devDependencies": {
|
|
54
58
|
"@types/node": "^22.10.0",
|
|
55
|
-
"esbuild": "^0.25.12",
|
|
56
59
|
"tsx": "^4.19.2",
|
|
57
60
|
"typescript": "^5.7.0",
|
|
58
61
|
"vitest": "^2.1.8"
|
package/templates/README.md
CHANGED
|
@@ -17,10 +17,11 @@ Full starter bundle covering every speech event from `@node-webrtc-rust/sdk/voic
|
|
|
17
17
|
**Build:**
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install @voicethere/agent
|
|
21
|
-
npx
|
|
20
|
+
npm install @voicethere/agent
|
|
21
|
+
npx @voicethere/agent build
|
|
22
|
+
# optional: --entry agent.ts --outfile dist/agent.js
|
|
22
23
|
```
|
|
23
24
|
|
|
24
25
|
**Verify sandbox (no WebRTC):** from the agent repo, `npm run verify:local` after building your bundle.
|
|
25
26
|
|
|
26
|
-
**Voice E2E:** host with
|
|
27
|
+
**Voice E2E:** host with the VoiceThere agent runner (platform or internal deployment) — set `AGENT_BUNDLE_PATH` to your built `dist/agent.js`.
|
package/templates/agent.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Build:
|
|
8
8
|
* npm install @voicethere/agent
|
|
9
|
-
* npx
|
|
9
|
+
* npx @voicethere/agent build
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Voice E2E (VoiceThere agent runner — platform or internal deployment):
|
|
12
12
|
* AGENT_BUNDLE_PATH=./dist/agent.js npm run start
|
|
13
13
|
*/
|
|
14
14
|
|