Skip to content

feat: run on hlang runtime 2.1 - #94

Merged
qddegtya merged 5 commits into
devfrom
feat/hlang-runtime-2
Nov 1, 2026
Merged

qddegtya merged 5 commits into
devfrom
feat/hlang-runtime-2

Conversation

@qddegtya

@qddegtya qddegtya commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Closes #86.

What changes

hlang runtime 2.1 is typed without any and keeps messages unknown by design ("a graph is wired at run time, so a node narrows what it receives"). AStack adopts that model instead of claiming payload types that nothing checks.

core (minor, breaking in beta)

  • @hlang-org/runtime ^1.1.1 → ^2.1.0.
  • Port.receive callbacks get unknown; Pipeline.run() resolves with unknown. The unchecked receive<T> / run<T> generics and the last no-unnecessary-type-parameters disable are gone.
  • Bug fix: a component that throws, or returns a rejected promise from a receive callback, used to leave Pipeline.run() pending forever (1.x rethrew the error asynchronously). The pipeline now listens on each component's error port (@node/error) and rejects the run: the run whose input is being delivered for a synchronous failure, otherwise the oldest run still waiting.
  • Bug fix: all triggers shared one START node, so once a pipeline had been run through two trigger ports, every run sent its input to both (for a model, messages was also sent to the API as a prompt). Each trigger now has its own START node.

components (minor): Agent, StreamingAgent, RLMAgent and ToolInvoker narrow their in value with type guards and reject the run with a TypeError on the wrong type. Handlers return their promise. ToolInvoker no longer turns invalid input into an empty result.

integrations (patch): the prompt and messages ports check their input before calling the API.

Docs (EN/ZH with source hashes), examples, generated API pages, the core README and the home page's live stack are updated.

hlang 2.1 features, and what AStack takes

Feature Taken? Why
Error port routing Yes Fixes runs that never settle.
Promise-returning handlers Yes Async failures reach the error port.
freezeMessages Verified only Ran every package suite with it on: no component mutates a message. No API added.
Back-pressure, dispose/teardown, FlowObserver, slice, onError Not now New features without a current need; onError only covers Writable/teardown failures, and AStack's END nodes only resolve. Add them when rate limiting, cancellation or tracing is asked for.
End of stream (close, flow.done) No Flow-scoped; AStack keeps one long-lived flow per pipeline and reuses components across runs.

hlang 2.x does not provide typed ports, so Component<In, Out> and compile-time connection checks from #86 are out of its scope.

Tests written first

rejects the run when a component throws, rejects the run when a component fails asynchronously, rejects only the run whose input failed, keeps running after a failed run, sends each run only to its own trigger, and one rejects ... input test per component and provider port.

Checks

  • pnpm verify passes (core 24, components 110, integrations 39, tools 13 tests; coverage thresholds met).
  • Website: lint, types, 36 tests, build.
  • Offline examples run; e2e on the real API is triggered on this branch.

🤖 Generated with Claude Code

qddegtya and others added 5 commits November 2, 2026 03:25
- Upgrade @hlang-org/runtime to ^2.1.0.
- A failure on a component's error port rejects the run it belongs to, instead of
  leaving it pending forever.
- Each trigger port gets its own START component, so a run reaches only the port
  it names.
- Port.receive passes unknown and Pipeline.run resolves with unknown: ports are
  connected at run time, so the caller narrows what it gets.

Failing tests first: "rejects the run when a component throws", "rejects the run
when a component fails asynchronously", "rejects only the run whose input failed",
"keeps running after a failed run", "sends each run only to its own trigger".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent, StreamingAgent, RLMAgent and ToolInvoker narrow the unknown value on their
in port with type guards and reject the run with a TypeError when it does not
match. Handlers return their promise, so an asynchronous failure reaches the
component's error port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Update the docs (English and Chinese, with source hashes), the examples and the
generated example and API pages for the hlang runtime 2.1 API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astack Ready Ready Preview Nov 1, 2026 7:26pm UTC

Request Review

@qddegtya
qddegtya merged commit fa49daf into dev Nov 1, 2026
9 checks passed
@qddegtya
qddegtya deleted the feat/hlang-runtime-2 branch November 1, 2026 19:28

This branch was successfully deployed

1 active deployment
Preview — ff76b076 Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant