Repository navigation
feat(agents)!: write the agent core once in Tish, for JavaScript and native - #38
Merged
Merged
Conversation
…native
The agent core (loop, runtime of agents, orchestration tools, profiles, supervisor, plans, stores, persistent runs,
the Hypery model call) is now Tish (tish/agents), compiled into the package with its TypeScript declarations by
`npm run build:core` (@tishlang/tish 4.2.2). Dune's cloud agents run the same source natively: the `./agents` export
has a `tish` condition pointing at it. `npm run test:tish` runs tish/agents/smoke.tish on Tish's VM and as the
shipped JavaScript and checks they agree (in CI); the same program builds and matches natively.
What JavaScript hosts add stays TypeScript: indexedDbStore, fileStore, the React hooks, the platform fetch for
createHyperyModel, and real AbortSignals for each child (createSignal → AbortController), so a child's tools can
pass ctx.signal to fetch and stopping it cancels its requests.
BREAKING CHANGE: no classes. `new AgentRuntime(host)` is `createAgentRuntime(host)`, `new TodoList(…)` is
`createTodoList(…)`, and model errors are values `{ name: "AgentModelError", message, code, status }` (check with
`isAgentModelError`, make with `agentModelError`) — `instanceof AgentModelError` no longer works. Absent values are
`null`: `runtime.get(id)` / `wait` return null for an unknown id. A host model call's `signal` is anything with
`aborted`; with a host-supplied createSignal it may be a plain flag rather than an AbortSignal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The agent core (loop, runtime of agents, orchestration tools, profiles, supervisor, plans, stores, persistent runs, Hypery model call) is now written once in Tish in
tish/agents/. Dune's cloud agents run it natively; this package ships it compiled to JavaScript with generated TypeScript declarations.npm run build:corecompiles it (@tishlang/tish4.2.2), thentscbuilds the TypeScript adapters around it../agentsgets atishexport condition, so Dune imports the Tish source.npm run test:tish(in CI) runstish/agents/smoke.tishon Tish's VM and as the shipped JS and checks they agree. Verified locally that the same program builds and matches natively.indexedDbStore,fileStore, the React hooks, the platformfetchdefault forcreateHyperyModel, and realAbortSignals per child (createSignal), so a child's tools can passctx.signaltofetchand stopping a child cancels its requests.Breaking (major release)
createAgentRuntime(host)replacesnew AgentRuntime(host), andcreateTodoList(…)replacesnew TodoList(…).isAgentModelError/agentModelError).null.Upstream fixes this needed: tishlang/tish #768, #769, #770 (JS lowering of
Promise.spawn,delay,utf8Complete,--types, and the native compiler fixes).Tests: 100 SDK tests pass (one new: a child's
ctx.signalis a realAbortSignalthat aborts on stop). Examples type-check. VM, native and JS smoke runs agree. Docs:docs/AGENTS.md.Note: if CI's
npm cireturns 404 for@tishlang/tish-4.2.2.tgz, npm hasn't started serving the new tarball yet (it was published minutes ago). It needs a re-run once npm serves it.