Releases: unicity-astrid/sdk-js
Releases · unicity-astrid/sdk-js
v0.1.0
First non-prerelease. 0.1.0-alpha.0 was the test version; this is the
first release intended for capsule consumers. The contract surface is
the per-domain WIT host ABI introduced alongside the merged
unicity-astrid/wit 1.0.0 packages.
Breaking
- Per-domain WIT host ABI. The monolithic
astrid:capsule@0.1.0world has
been split into per-domain frozen packages at@1.0.0:
astrid:fs/host,astrid:ipc/host,astrid:kv/host,astrid:net/host,
astrid:http/host,astrid:sys/host,astrid:process/host,
astrid:uplink/host,astrid:elicit/host,astrid:approval/host,
astrid:identity/host. Foundation I/O is Astrid-owned (nowasi:io
dependency) and lives inastrid:io/{error,poll,streams}@1.0.0. Guest
exports are split into per-export worlds underastrid:guest@1.0.0. - Resource-backed handles. Previously-opaque
u64handles
(Subscription,FileHandle,TcpStream,UnixListener,ProcessHandle,
HttpStream,Pollable,InputStream,OutputStream,Error) are now
Component Model resources. SDK wrappers expose them as TypeScript classes
implementingSymbol.disposesousing sub = ipc.subscribe(...)releases
the resource on scope exit. An explicit.close()remains available for
codebases not yet on the explicit-resource-management proposal. - Typed
ErrorCodeenums per domain. Every host fn now returns
result<T, error-code>whereerror-codeis a domain-specific variant
(astrid:fs/host.error-code,astrid:net/host.error-code, …).SysError
now carries the WIT variant tag oncode— downstream code can branch
if (err.code === "quota") ...without losing the typed kind. The legacy
origin classification moved toSysError.kind. fsmodule gained the full POSIX surface.openreturns a
FileHandleresource withreadAt/writeAt/syncData/syncAll/stat/
setLen. New top-level helpers:mkdirAll,appendFile,copy,rename,
removeDirAll,canonicalize,readLink,hardLink,lstat.Stats
now exposeskind,mode,birthtimeMs,atimeMs,isSymbolicLink().netmodule split intoUnixListener/TcpListener/TcpStream/
UdpSocketresources. New surface:bindTcp,udpBind,lookupHost,
TcpStream.{setHopLimit, setKeepalive, setLinger, setReuseaddr, readStream, writeStream},UdpSocket.{sendTo, recvFrom, connect, send, recv}.StreamHandle/ListenerHandlesurvive as aliases for source
compatibility.http.HttpStreamHandleis now a resource handle withsubscribeReadable
andbodyStreamfor splice-based body forwarding.HttpMethodis now a
variant tag at the WIT layer; the SDK still accepts uppercase strings.process.BackgroundProcessHandlegained the full lifecycle surface:
writeStdin,closeStdin,signal,wait,waitWithOutput,osPid,
subscribeExit,subscribeLogs.ProcessResult.exitCodeis now
number | undefined(a Unix-signal kill returnsundefinedexit code and
populates the newsignalfield).identitymodule returns typedPlatformLink[]directly rather than
a JSON-encodedlinksJsonblob.IdentityOkResponseis removed; errors
surface asSysErrorwith the WIT variant oncode.approvalmodule returns the typedApprovalDecision(one-shot /
session / always / allowance-hit / denied). NewrequestDecisionsurfaces
the full decision;requestcontinues to collapse to a boolean.uplink.UplinkProfileis now an enum ("chat" | "interactive" | "notify" | "bridge"); profile strings outside that set return
invalid-profilefrom the host.hooksmodule removed. Thesys::trigger-hookhost fn no longer
exists in the per-domain WIT. Hook fan-out is now performed via
ipc.requestResponse. Callers that previously usedhooks.trigger(json)
should publish on the hook's IPC topic and await the typed response.SysError.codesemantics changed. The legacycode: "HostError" | "JsonError" | "ApiError"field moved toSysError.kind;codenow
carries the typed WIT variant (e.g."capability-denied","quota",
"timeout").SysErrorCodeis renamed toSysErrorKind.
Added
ipc.requestResponse<Req, Resp>(requestTopic, responseNamespace, request, timeoutMs)— mirrors the Rust SDK'sastrid_sdk::ipc::request_response.
Pre-subscribes to<responseNamespace>.<correlationId>before publishing,
injects a UUIDv4correlation_idinto the request payload, races against
timeoutMs, and always tears down the subscription. Rejects non-object
payloads synchronously withSysError.api.ipc.publishAs(topic, payload, principal)and
ipc.publishJsonAs(topic, value, principal)for uplinks asserting an
end-user principal. Subscribers see the principal asclaimed, not
verified.ipc.IpcMessage.principalis now a typedPrincipalAttribution
variant (verified/claimed/system) rather than a bare
string | undefined.kv.cas(key, expected, newValue)for atomic compare-and-swap on
shared keys, andkv.listKeysPage(prefix, cursor, limit)for paginated
enumeration of unbounded stores.fs.open(path, mode)+FileHandleresource for streaming /
random-access I/O without buffering the whole file.net.bindTcp,net.udpBind,net.lookupHostfor outbound /
inbound TCP listeners, UDP sockets, and DNS resolution.runtime.randomBytes(length)wrapping the host CSPRNG (audited
viasys::random-bytes).time.sleepMs,time.sleepNs,time.monotonicNswrapping the
host clock / sleep primitives.env.tryGet(key)returnsstring | undefinedso callers can
distinguish "not set" from "set to empty string".
Changed
- Build orchestrator (
@unicity-astrid/build) synthesises a capsule world
in<projectDir>/gen/wit/capsule.witmirroring the Rust SDK's
astrid-syssynthetic world. Capsules no longer need to declare their
own world for the common case. - Contracts submodule (
unicity-astrid/wit) bumped to commit
324d4ab, which introduces the Astrid-ownedastrid:io@1.0.0
foundation primitives.
With many thanks from the following Astrinauts 🚀
- Joshua J. Bouw