@nylorun/runtime 0.5.0-beta → 0.6.0-beta

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +29 -61
  3. package/dist/config.d.ts +1 -1
  4. package/dist/configuration.d.ts +3 -0
  5. package/dist/configuration.js +3 -0
  6. package/dist/contracts.d.ts +4 -2
  7. package/dist/core/main.js +40 -0
  8. package/dist/core/provider.d.ts +12 -0
  9. package/dist/core/provider.js +60 -0
  10. package/dist/core/runtime.d.ts +50 -0
  11. package/dist/core/runtime.js +877 -0
  12. package/dist/core/store.d.ts +16 -0
  13. package/dist/core/store.js +101 -0
  14. package/dist/index.d.ts +6 -11
  15. package/dist/index.js +4 -6
  16. package/dist/model/defaults.d.ts +1 -1
  17. package/dist/model/http-model.d.ts +1 -1
  18. package/dist/node/local-sessions.js +17 -0
  19. package/dist/server/host.d.ts +42 -4
  20. package/dist/server/host.js +69 -3
  21. package/dist/session/api.d.ts +10 -0
  22. package/dist/session/api.js +15 -0
  23. package/dist/session/default.d.ts +5 -0
  24. package/dist/session/default.js +30 -0
  25. package/dist/session/handle.d.ts +27 -0
  26. package/dist/session/handle.js +199 -0
  27. package/dist/session/index.d.ts +2 -0
  28. package/dist/session/index.js +2 -0
  29. package/dist/sessions/host.d.ts +11 -1
  30. package/dist/sessions/host.js +75 -7
  31. package/dist/sessions/store.d.ts +1 -0
  32. package/dist/sessions/store.js +3 -0
  33. package/package.json +16 -11
  34. package/dist/cli.d.ts +0 -2
  35. package/dist/cli.js +0 -100
  36. package/dist/dev-entry.js +0 -2
  37. package/dist/dev.d.ts +0 -2
  38. package/dist/dev.js +0 -126
  39. package/dist/environment.d.ts +0 -2
  40. package/dist/environment.js +0 -64
  41. package/dist/launcher.d.ts +0 -1
  42. package/dist/launcher.js +0 -33
  43. package/dist/model/configure.d.ts +0 -12
  44. package/dist/model/configure.js +0 -155
  45. /package/dist/{dev-entry.d.ts → core/main.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0-beta
4
+
5
+ ### Major Changes
6
+
7
+ - 2898d02: Extract shared definitions and contracts into core and local orchestration into
8
+ CLI. Harness becomes execution-only; the SDK no longer installs the engine and
9
+ Runtime no longer depends on the SDK. Author applications through agents and
10
+ install cli for the unchanged nylorun commands. See the package architecture and
11
+ migration guide. Cloud installs published packages from npm independently.
12
+
13
+ ### Minor Changes
14
+
15
+ - 41e613c: Ship the local SDK registry workflow with an independent SQLite Runtime, connected tool executor, authenticated Studio proxy, and a text-and-tool starter. Replace the legacy Hono starter and AG-UI transport. Require Node 24 and include the SDK in exact release compatibility pins.
16
+
17
+ Break the Harness execution import from `/engine` to `/run` and rename hosted execution APIs to durable execution APIs, including RunBinding, BoundRunOptions, and createRunState. Update all consumers without compatibility aliases; retain persisted checkpoint fields and version pins.
18
+
19
+ ### Patch Changes
20
+
21
+ - Pin core to the tested release.
22
+ - Pin harness to the tested release.
23
+ - Updated dependencies [41e613c]
24
+ - Updated dependencies [2898d02]
25
+ - Updated dependencies
26
+ - @nylorun/core@0.1.1-beta
27
+ - @nylorun/harness@0.15.0-beta
28
+
3
29
  ## 0.5.0-beta
4
30
 
5
31
  ### Minor Changes
@@ -18,6 +44,10 @@
18
44
 
19
45
  ### Patch Changes
20
46
 
47
+ - Remove the experimental Cloud Agents API destination client and related
48
+ `RuntimeConfig.cloud` / `NYLORUN_*` Cloud-mode wiring from OSS Runtime.
49
+ Local `openSession` remains the only destination. Cloud upgrades published
50
+ packages from npm independently.
21
51
  - Ignore Hono Node `context.env` stream bindings (`incoming`/`outgoing`) when
22
52
  resolving model environment so Node `nylorun dev` uses process `.env` /
23
53
  `piModel` instead of an empty portable HTTP adapter.
package/README.md CHANGED
@@ -1,79 +1,47 @@
1
1
  # @nylorun/runtime
2
2
 
3
- Optional hosting for stateless Harness agents: session coordination, replaceable storage, Hono routes, model adapters, and the Node CLI. Runtime depends directly on canonical Harness types; Harness does not depend on Runtime.
3
+ The independent OSS HTTP execution host consumes `@nylorun/harness/run` and `@nylorun/core/contracts`. Cloud installs published `@nylorun/harness` from npm and does not import this Runtime package. Client authoring, sessions and connected executors belong to `@nylorun/agents`.
4
4
 
5
- ```ts
6
- import { Hono } from "hono";
7
- import { Runtime, serveAgents } from "@nylorun/runtime";
8
- const runtime = new Runtime();
9
- const app = new Hono();
10
- app.route("/agents", serveAgents({ agents, runtime }));
11
- export default app;
12
- ```
13
-
14
- The default is `memorySessions()` and no file observer. Portable imports do not initialize the filesystem. `httpModel()` supports text/tool/structured-output requests to OpenAI-compatible and Anthropic HTTP endpoints using injected environment values or process variables where available. It requires API keys; media inputs require a supplied media-aware adapter. The Node CLI installs `piModel()` for its broader provider catalog, local credential fallback, OAuth, and media support. Direct portable imports do not load dotenv or local credentials.
5
+ Requires Node 24+. Build from the repository root:
15
6
 
16
- ## Storage and coordination
17
-
18
- ```ts
19
- import { localSessions, piModel } from "@nylorun/runtime/node";
20
- const runtime = new Runtime({
21
- sessions: localSessions({ root: ".data/sessions" }),
22
- onModelCall: piModel(),
23
- });
7
+ ```sh
8
+ npm install
9
+ npm run build --workspace @nylorun/core
10
+ npm run build --workspace @nylorun/harness
11
+ npm run build --workspace @nylorun/runtime
12
+ NYLORUN_SERVER_KEY='<separate-secret-at-least-16-characters>' npm start --workspace @nylorun/runtime
24
13
  ```
25
14
 
26
- A `SessionStore` provides `get(agentId, sessionId)`, atomic `put(agentId, sessionId, document)`, and `list(agentId)`. StoredSession includes Runtime metadata, Harness state, an active marker, and committed event history. Stores implement data operations only. The built-in SessionHost serializes inputs, cancels and awaits active work before replacement, persists accepted inputs before execution, and commits terminal state before reporting success. It restores completed and explicitly paused sessions; active markers found after a crash require reconciliation. Legacy event-only records remain archived history.
27
-
28
- `localSessions` exclusively owns its root through `.owner.lock`. Multiple owners are rejected, including adapters in the same process. Writes use temporary files and atomic replacement; lost ownership stops writes. Orderly `runtime.close()` releases the matching lock. Locks are never stolen by age or PID: after a crash, confirm the owner stopped before manually removing the lock. No shared-filesystem or multi-replica guarantee is made.
29
-
30
- The host's scheduling scope is one process. A shared store is not a distributed scheduler. Advanced applications can use `SessionHost` without Hono, reuse `agUiEvents()` protocol translation, or compose Harness with their own host. Managed Cloud Runtime remains future work.
31
-
32
- ## Info, delivery, and resources
15
+ Default address: `http://127.0.0.1:8787`. `HOST`, `PORT`, and `NYLORUN_SQLITE_PATH` configure binding and storage. Missing server credentials fail startup. The default model is a credential-free scripted development response. It does not simulate conversations, tools or provider compatibility.
33
16
 
34
- Application middleware authorizes every route. `getInfo(context)` supplies extra application data for each invocation; Runtime adds `sessionId`. `getEnvironment(context)` can supply per-request provider bindings without changing process globals. Neither info nor live resources are implicitly model-visible. `getActor` remains a convenience for userId; use `getInfo` for typed application identity.
17
+ `NYLORUN_EXECUTORS_JSON` is an array of `{token, agentId, manifestHash, implementationVersion}`. Each secret must differ from the application server key and every other executor token. The manifest hash is available from `@nylorun/core/compatibility` or saved definition registration. SDK clients use `NYLORUN_RUNTIME_URL`, `NYLORUN_SERVER_KEY`, and `NYLORUN_EXECUTOR_KEY`; runtime executor scope is configured explicitly, never broadened by client input.
35
18
 
36
- Runtime delivers ordered observations incrementally, separately from committed history. `tokens: true` enables provisional text previews on compatible model adapters; the default is off. `createModel({ environment, media, onPreview })` supplies preview support for custom adapters. Studio shows drafts separately and discards them on settlement; accepted output remains authoritative. Partial tool arguments never dispatch tools.
19
+ For a model gateway, set `NYLORUN_MODEL_GATEWAY_URL`, `NYLORUN_MODEL_GATEWAY_KEY`, and `NYLORUN_MODEL`. The gateway receives `{model, call, context}` and returns a harness ModelCandidate or string. Provider credentials remain host configuration. The generic gateway requires an implementation of this envelope; it does not claim arbitrary provider wire compatibility. Alternatively supply a `ModelProvider` to `startRuntime`.
37
20
 
38
- Delivery limits default to 64 KiB of preview data per model invocation (also bounding queued previews), and 256 events or 1 MiB of queued execution/control data. Configure them with `delivery: { previewBytes, eventCount, eventBytes }`. Preview overflow suppresses further previews for that model invocation and emits an incomplete marker. Authoritative overflow closes the subscription. Neither path blocks model consumption; request-attached execution is cooperatively cancelled on disconnect. Independent execution/reconnection belongs to a custom host.
39
-
40
- Runtime owns controllers and its store lifecycle. It does not close application tools, databases, browsers, or subprocesses. The Node launcher drains registered Runtime hosts during orderly shutdown; application resource cleanup remains explicit. Imports never open a listening socket. Root-relative discovery supports ordinary Hono mounts; use `basePath` for a rewriting proxy. Production authentication, CORS, ingress timeouts, and TLS belong to the application and infrastructure.
41
-
42
- ## Commands
43
-
44
- - `nylorun configure`
45
- - `nylorun dev [--no-studio] [--no-open]`
46
- - `nylorun start [entry]` (default: `dist/src/index.js`)
47
- - `nylorun studio --agent-url http://localhost:3000/agents [--port 4161] [--no-open]`
48
-
49
- Export your Hono application with `export default app`. The CLI supplies the Node server adapter. `nylorun dev` watches `src/index.ts`, waits for `/agents/v1/agents`, and starts project-local Studio. `PORT` defaults to 3000. `--no-studio` runs only the application; `--no-open` keeps the browser closed. Ctrl-C stops both processes. `nylorun start` serves the built app without Studio or development CORS.
50
-
51
- ### Environment configuration
52
-
53
- Copy `.env.example` to `.env` and fill it in, or run `nylorun configure` before your agent graph is importable:
54
-
55
- ```dotenv
56
- MODEL_PROVIDER=custom
57
- MODEL=your-model-id
58
- MODEL_PROVIDER_API_KEY=your-key
59
- MODEL_PROVIDER_BASE_URL=https://your-provider.example/v1
21
+ ```ts
22
+ import { startRuntime } from '@nylorun/runtime/core';
23
+ const runtime = await startRuntime({
24
+ sqlitePath: './nylorun.sqlite',
25
+ serverToken: process.env.NYLORUN_SERVER_KEY!,
26
+ executors: [], // Configure exact scoped executor credentials before customer actions.
27
+ port: 8787,
28
+ });
29
+ // Application owns lifecycle.
30
+ await runtime.close();
60
31
  ```
61
32
 
62
- `MODEL_PROVIDER_BASE_URL` is required only for `MODEL_PROVIDER=custom`; omit it for built-in providers. `configure`, `dev`, and `start` load `.env` before importing the app. Existing process variables win; a missing `.env` is valid. `.env.local` is ignored by Git but is not automatically loaded. Direct imports of Runtime do not load dotenv files.
33
+ The session-first `/v1` API is specified in [HOST_CONTRACT.md](../harness/HOST_CONTRACT.md). `/health` confirms HTTP liveness; `/ready` checks SQLite and scheduler availability. Readiness is not a provider connectivity probe or functional correctness claim. Application tokens authorize definition/session APIs, while exact scoped executor credentials authorize authenticated SSE `/v1/executors/connect`, action discovery, claims, renewal and results. Session observers cannot claim actions.
63
34
 
64
- Explicit `piModel({ selection })` options take precedence over environment selection. Environment selection takes precedence over legacy files; incomplete selection produces an error. `MODEL_PROVIDER_API_KEY` overrides provider-native variables such as `OPENAI_API_KEY` and `ANTHROPIC_API_KEY`, which override stored credentials. API-key deployments require no credential files. Supply the same variables through your hosting provider's environment settings.
35
+ SQLite transactions persist session checkpoints, command receipts, individual effects/actions, waits and canonical history. Actions are committed before notifications. Accepted execution is detached from HTTP request lifetime. Restart schedules persisted runnable sessions; model intents lacking recorded outcomes become uncertain. Expired customer claims become uncertain and are not automatically repeated. `GET /v1/sessions/:id` exposes waits, outstanding actions and uncertain effect summaries. Cancellation ends the current turn; a later message can start another turn from the state preceding the cancelled turn. Canonical events and uncertain external work remain inspectable. Reconciliation operations are not implemented in this pass.
65
36
 
66
- The optional wizard writes selection and entered API keys to `.env`, preserving unrelated configuration. It reuses environment credentials without copying them into the file. OAuth is an alternative where supported; its credentials and refresh state live in ignored `.nylorun/auth.json`. Keep `.env` and `.nylorun/` private.
37
+ One process owns each SQLite database. A local PID lock rejects concurrent owners and recovers only when the recorded process no longer exists. Shared/network filesystems and multiple replicas are unsupported. Keep the database and its WAL/journal together; do not delete persisted effects separately from checkpoints. Invalid lock contents or PID reuse fail closed and require operator inspection. TLS and external ingress belong to deployment infrastructure.
67
38
 
68
- ### Upgrading an existing starter
39
+ ## Local project workflow
69
40
 
70
- Migration is manual; the CLI will not replace a legacy `.env` directory.
41
+ Install `@nylorun/cli` (generated projects already include it). Use `npm run configure`, then `nylorun dev` in a generated project. It loads the exported `agents` registry from `agents/index.ts`, starts this Runtime in a separate process, registers manifests, connects scoped SDK executors, and opens Studio. Use `--no-studio` or `--no-open` as needed. Runtime binds loopback on port 8787 (`PORT` override). The CLI creates separate server and executor credentials with mode 0600 in `.nylorun/local-credentials.json`; SQLite defaults to `.nylorun/runtime.sqlite`.
71
42
 
72
- 1. Back up the existing `.env/` directory to a private location outside the project before replacing it with a file. Preserve any `config/model.json` too.
73
- 2. Translate `model.json` fields `provider`, `model`, and `custom.baseUrl` into `MODEL_PROVIDER`, `MODEL`, and `MODEL_PROVIDER_BASE_URL`. Copy API keys into `MODEL_PROVIDER_API_KEY` or provider-native variables. Replace the old `NYLO_CUSTOM_API_KEY` variable with `MODEL_PROVIDER_API_KEY`.
74
- 3. Merge `integrations.env` variables into `.env`. Move OAuth records into `.nylorun/auth.json`. Add `.env`, `.env.local`, and `.nylorun/` to `.gitignore`; remove the old `.env/` exceptions.
75
- 4. Replace the entrypoint's `serve(...)` call and Node adapter import with `export default app`. Set scripts to `"dev": "nylorun dev"` and `"start": "nylorun start"`. Remove the application's `@hono/node-server` dependency if unused elsewhere. Keep your build and asset-copy steps.
43
+ `nylorun start [entry]` loads `dist/agents/index.js` by default and runs without Studio/watch. `nylorun studio --runtime-url http://127.0.0.1:8787` attaches using the project's local server credential (or `NYLORUN_SERVER_KEY`). Provider selection uses the existing `MODEL_PROVIDER`, `MODEL`, `MODEL_PROVIDER_API_KEY`, and optional `MODEL_PROVIDER_BASE_URL` configuration. No provider request occurs during configuration.
76
44
 
77
- Runtime retains legacy `.env/model.json`, `config/model.json`, and `.env/auth.json` reads for existing applications using their own launcher. It does not automatically move or delete these files. Use the matching Runtime release pinned by the new creator; older releases cannot launch an exported app.
45
+ Definitions have no `agent.run()`; applications use `@nylorun/agents`. Remove old Hono `src/index.ts`, `Runtime`, `serveAgents`, and `openSession` usage from supported starters. Historical implementations remain internal for regression coverage and advanced examples; they are not root exports or supported hosting alternatives.
78
46
 
79
- The exported app follows Hono composition conventions. See [deployment verification and limits](../DEPLOYMENT.md) and the [breaking migration guide](../MIGRATION.md). Node-only `projectAsset()` resolves bundled assets from source or compiled deployments.
47
+ Source changes restart the local stack. Start a new session after definition or implementation edits; live upgrades are deferred. `GET /v1/agents` and `GET /v1/sessions?agentId=...` are server-authenticated local discovery conveniences. See the repository handoff for verification and remaining scope.
package/dist/config.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ModelAdapter } from "@nylorun/harness";
1
+ import type { ModelAdapter } from "@nylorun/core/define";
2
2
  import type { SessionStore } from "./sessions/store.js";
3
3
  import type { RuntimeMedia } from "./media.js";
4
4
  import type { ModelEnvironment } from "./model/http-model.js";
@@ -0,0 +1,3 @@
1
+ export { modelsFor, type Selection } from "./model/models.js";
2
+ export { modelSelection, projectSecrets } from "./model/settings.js";
3
+ export { ProjectCredentialStore } from "./model/auth-store.js";
@@ -0,0 +1,3 @@
1
+ export { modelsFor } from "./model/models.js";
2
+ export { modelSelection, projectSecrets } from "./model/settings.js";
3
+ export { ProjectCredentialStore } from "./model/auth-store.js";
@@ -1,3 +1,5 @@
1
1
  /** Execution contracts are owned by Harness. */
2
- export type { JsonValue, JsonObject, MessageInput, UserContentPart, PromptContentPart, PromptItem, ModelCall as RuntimeModelCall, ModelCandidate as RuntimeModelCandidate, ModelAdapter as RuntimeModelAdapter, ModelAdapterContext as RuntimeModelContext, ExecutionInput as RuntimeInput, InputEvent as RuntimeInputEvent, RunResult as RuntimeCompletion, ExecutionEvent as RuntimeEvent, } from "@nylorun/harness";
3
- export type RuntimeAgent = import("@nylorun/harness").BuiltAgent<any, any>;
2
+ export type { JsonValue, JsonObject, MessageInput, UserContentPart, PromptContentPart, PromptItem, ModelCall as RuntimeModelCall, ModelCandidate as RuntimeModelCandidate, ModelAdapter as RuntimeModelAdapter, ModelAdapterContext as RuntimeModelContext, InputEvent as RuntimeInputEvent } from "@nylorun/core/define";
3
+ export type { ExecutionInput as RuntimeInput, RunResult as RuntimeCompletion, ExecutionEvent as RuntimeEvent, Session, Turn, Event, Result, InputAccepted, AgentIdentity } from "@nylorun/harness";
4
+ export type { RunBinding, BoundRunOptions, } from "@nylorun/harness/run";
5
+ export type RuntimeAgent = import("@nylorun/core/define").BuiltAgent<any, any>;
@@ -0,0 +1,40 @@
1
+ import { piModel } from "../model/pi-model.js";
2
+ import { startRuntime } from "./runtime.js";
3
+ import { gatewayModel, scriptedModel, toolFixtureModel } from "./provider.js";
4
+ const serverToken = process.env.NYLORUN_SERVER_KEY;
5
+ if (!serverToken)
6
+ throw new Error("Set NYLORUN_SERVER_KEY (at least 16 characters)");
7
+ const executors = JSON.parse(process.env.NYLORUN_EXECUTORS_JSON ?? "[]");
8
+ const configured = piModel();
9
+ const projectModel = (effect, signal) => configured(effect.input, {
10
+ request: effect.context.request,
11
+ invocationId: String(effect.context.invocationId),
12
+ signal,
13
+ reportPreparedCall() { },
14
+ });
15
+ const model = process.env.NYLORUN_DEV_MODEL === "fixture"
16
+ ? toolFixtureModel()
17
+ : process.env.NYLORUN_PROJECT_PROVIDER === "1"
18
+ ? projectModel
19
+ : process.env.NYLORUN_MODEL_GATEWAY_URL
20
+ ? gatewayModel({
21
+ url: process.env.NYLORUN_MODEL_GATEWAY_URL,
22
+ token: process.env.NYLORUN_MODEL_GATEWAY_KEY ?? "",
23
+ model: process.env.NYLORUN_MODEL ?? "",
24
+ })
25
+ : scriptedModel(process.env.NYLORUN_SCRIPTED_OUTPUT);
26
+ const runtime = await startRuntime({
27
+ sqlitePath: process.env.NYLORUN_SQLITE_PATH ?? "./nylorun.sqlite",
28
+ serverToken,
29
+ executors,
30
+ model,
31
+ port: Number(process.env.PORT ?? 8787),
32
+ hostname: process.env.HOST ?? "127.0.0.1",
33
+ });
34
+ console.log(`Nylorun Runtime listening at ${runtime.url}`);
35
+ process.send?.({ type: "ready", url: runtime.url });
36
+ let closing;
37
+ for (const signal of ["SIGINT", "SIGTERM"])
38
+ process.on(signal, () => {
39
+ closing ??= runtime.close().then(() => { process.exit(0); });
40
+ });
@@ -0,0 +1,12 @@
1
+ import type { HostEffect } from "@nylorun/harness/run";
2
+ /** Providers are runtime-owned; neither credentials nor model selection enter manifests. */
3
+ export type ModelProvider = (effect: HostEffect, signal: AbortSignal) => Promise<unknown>;
4
+ export declare function scriptedModel(output?: string): ModelProvider;
5
+ /** A configured gateway receives the complete harness model call, including history and schemas. */
6
+ export declare function gatewayModel(options: {
7
+ url: string;
8
+ token: string;
9
+ model: string;
10
+ }): ModelProvider;
11
+ /** Deterministic release fixture; still uses the real engine and remote customer tool. */
12
+ export declare function toolFixtureModel(): ModelProvider;
@@ -0,0 +1,60 @@
1
+ export function scriptedModel(output = "Scripted development response") {
2
+ return async () => ({ output: [{ type: "text", text: output }] });
3
+ }
4
+ /** A configured gateway receives the complete harness model call, including history and schemas. */
5
+ export function gatewayModel(options) {
6
+ return async (effect, signal) => {
7
+ const response = await fetch(options.url, {
8
+ method: "POST",
9
+ signal,
10
+ headers: {
11
+ authorization: `Bearer ${options.token}`,
12
+ "content-type": "application/json",
13
+ },
14
+ body: JSON.stringify({
15
+ model: options.model,
16
+ call: effect.input,
17
+ context: effect.context,
18
+ }),
19
+ });
20
+ if (!response.ok)
21
+ throw new Error(`Model gateway returned ${response.status}`);
22
+ return response.json();
23
+ };
24
+ }
25
+ /** Deterministic release fixture; still uses the real engine and remote customer tool. */
26
+ export function toolFixtureModel() {
27
+ return async (effect) => {
28
+ const call = effect.input;
29
+ const last = call.prompt.at(-1);
30
+ if (last?.kind === "tool-result")
31
+ return {
32
+ output: [
33
+ {
34
+ type: "text",
35
+ text: `Order lookup complete: ${last.content.map((part) => (part.type === "text" ? part.text : JSON.stringify(part))).join(" ")}`,
36
+ },
37
+ ],
38
+ };
39
+ const users = call.prompt.filter((p) => p.kind === "message" && p.role === "user");
40
+ if (users.length > 1)
41
+ return {
42
+ output: [
43
+ {
44
+ type: "text",
45
+ text: `I remember: ${users[0].content.map((part) => (part.type === "text" ? part.text : "")).join(" ")}`,
46
+ },
47
+ ],
48
+ };
49
+ return {
50
+ output: [
51
+ {
52
+ type: "tool-call",
53
+ id: "fixture_lookup",
54
+ name: "lookup_order",
55
+ args: { orderId: "demo-123" },
56
+ },
57
+ ],
58
+ };
59
+ };
60
+ }
@@ -0,0 +1,50 @@
1
+ import { type ExecutorScope } from "@nylorun/core/contracts";
2
+ import { type ModelProvider } from "./provider.js";
3
+ export interface RuntimeOptions {
4
+ sqlitePath: string;
5
+ serverToken: string;
6
+ executors: readonly (ExecutorScope & {
7
+ token: string;
8
+ })[];
9
+ model?: ModelProvider;
10
+ leaseMs?: number;
11
+ }
12
+ export declare class CoreRuntime {
13
+ private readonly options;
14
+ private readonly store;
15
+ private readonly running;
16
+ private readonly pending;
17
+ private readonly observers;
18
+ private readonly executors;
19
+ private server?;
20
+ private closing;
21
+ private readonly lockPath?;
22
+ private readonly timer;
23
+ constructor(options: RuntimeOptions);
24
+ private session;
25
+ private publish;
26
+ private send;
27
+ private notify;
28
+ private expireClaims;
29
+ private schedule;
30
+ private execute;
31
+ private resolveEffect;
32
+ private scope;
33
+ private scoped;
34
+ private body;
35
+ private command;
36
+ private sse;
37
+ private handle;
38
+ private view;
39
+ listen(port?: number, hostname?: string): Promise<{
40
+ url: string;
41
+ }>;
42
+ close(): Promise<void>;
43
+ }
44
+ export declare function createRuntime(options: RuntimeOptions): CoreRuntime;
45
+ export declare function startRuntime(options: RuntimeOptions & {
46
+ port?: number;
47
+ hostname?: string;
48
+ }): Promise<CoreRuntime & {
49
+ url: string;
50
+ }>;