@toren-run/core 0.1.0 → 0.1.1
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 +9 -0
- package/dist/providers/echo.d.ts +0 -4
- package/dist/providers/echo.js +5 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# @toren-run/core
|
|
2
|
+
|
|
3
|
+
The engine of [Toren](https://toren.run), the open-source runtime for long-running, durable AI agents. This package is the durability itself: the append-only Postgres event log, the agent task loop, the orchestrator with parallel waves, workers, leases, guardians, approvals, schedules, and sessions. A resumed run never re-pays for a completed model call; a CI kill matrix crashes the stack after every database write and asserts exactly-once billing.
|
|
4
|
+
|
|
5
|
+
Most people want the CLI instead: `npm install toren-run` gives you `toren init`, `toren dev`, the HTTP API, and the web console, all built on this package. Reach for `@toren-run/core` directly when you embed the runtime in your own host process: `startRun`, `tick`, `LocalWorkerRuntime`, `defineTool`, and friends.
|
|
6
|
+
|
|
7
|
+
Zero model SDKs in here. The core depends on `pg` and `zod`, nothing environment-specific; providers, queues, and sandboxes plug in behind interfaces.
|
|
8
|
+
|
|
9
|
+
**Docs:** [toren.run/docs](https://toren.run/docs) (durability and architecture live under Concepts). Apache-2.0.
|
package/dist/providers/echo.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import type { ModelProvider, ModelRequest, ModelResponse } from "../model.js";
|
|
2
|
-
/**
|
|
3
|
-
* Deterministic offline provider for demos, scaffolds, and tests: replies
|
|
4
|
-
* `echo(<first user text>)`. Lets `toren init` output run with zero API keys.
|
|
5
|
-
*/
|
|
6
2
|
export declare class EchoProvider implements ModelProvider {
|
|
7
3
|
calls: Map<string, number>;
|
|
8
4
|
complete(req: ModelRequest): Promise<ModelResponse>;
|
package/dist/providers/echo.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deterministic offline provider for demos, scaffolds, and tests: replies
|
|
3
3
|
* `echo(<first user text>)`. Lets `toren init` output run with zero API keys.
|
|
4
|
+
* `mock/slow` is the same echo at three seconds per call, so the quickstart's
|
|
5
|
+
* kill test has something to murder without an API key.
|
|
4
6
|
*/
|
|
7
|
+
const SLOW_CALL_MS = 3_000;
|
|
5
8
|
export class EchoProvider {
|
|
6
9
|
calls = new Map();
|
|
7
10
|
async complete(req) {
|
|
11
|
+
if (req.model.endsWith("/slow"))
|
|
12
|
+
await new Promise((r) => setTimeout(r, SLOW_CALL_MS));
|
|
8
13
|
const first = req.messages[0]?.content.find((b) => b.type === "text");
|
|
9
14
|
const input = first && first.type === "text" ? first.text : "";
|
|
10
15
|
this.calls.set(input, (this.calls.get(input) ?? 0) + 1);
|