Running executor generate against an instance writes one self-contained TypeScript file: a dependency-free Proxy-based runtime client plus full input/output types for every visible tool, so client.github.org.main.issues.create({ title }) is typed end to end and executes through the server's /api/executions endpoint (auth, policies, approvals included). New pieces: - tools.export SDK surface + GET /tools/export: the bulk schema-bearing catalog read (schemas + trimmed shared $defs, grouped per connection, policy-filtered), one request regardless of catalog size. - compileToolChunkTypeScript: compiles many tools per compiler pass. Per-tool passes pay fixed overhead thousands of times and one whole-catalog pass is super-linear (30s+ at 10k tools); 200-tool chunks generate a 10k-tool catalog in ~400ms. - generateToolProxySource: assembles the generated file (type-only namespaces per connection, ExecutorTools path tree, embedded runtime). - executor generate CLI command with --output/--integration/--connection/ --include-static, reusing the server-target and auth machinery. Tested down to the wire: generated source is typechecked with the real compiler (valid calls accept, invalid reject), the transpiled runtime is imported and run against a fake fetch (completed/paused/injection paths), and a scale test ingests a 10,000-operation OpenAPI spec through addSpec and proves export + generate + strict typecheck hold up with regression tripwires on time.
Showing the changes to apps/docs (1 of 14 files). Show all
Unified · Split
| @@ -109,3 +109,28 @@ resume it: · 108 unmodified lines | |||
| 109 | ```bash | 109 | ```bash |
| 110 | executor resume --execution-id exec_123 | 110 | executor resume --execution-id exec_123 |
| 111 | ``` | 111 | ``` |
| 112 | |||
| 113 | ## Generate a typed client | ||
| 114 | |||
| 115 | `executor generate` writes a single self-contained TypeScript file with full | ||
| 116 | input/output types for every tool in your catalog, plus a dependency-free | ||
| 117 | runtime client. Drop it into any TypeScript project and every call is typed | ||
| 118 | end to end, while still executing through Executor (auth, policies, and | ||
| 119 | approvals included): | ||
| 120 | |||
| 121 | ```bash | ||
| 122 | executor generate # writes executor.gen.ts | ||
| 123 | executor generate -o src/executor.ts # custom output path | ||
| 124 | executor generate --integration github # only one integration | ||
| 125 | ``` | ||
| 126 | |||
| 127 | ```ts | ||
| 128 | import { createExecutorClient } from "./executor.gen"; | ||
| 129 | |||
| 130 | const executor = createExecutorClient(); // EXECUTOR_API_KEY / EXECUTOR_AUTH_TOKEN | ||
| 131 | const created = await executor.github.org.main.issues.create({ title: "Hi" }); | ||
| 132 | if (created.ok) console.log(created.data.number); | ||
| 133 | ``` | ||
| 134 | |||
| 135 | Calls that pause for approval throw `ExecutorPausedError` with the approval | ||
| 136 | URL. Re-run `executor generate` whenever your catalog changes. | ||