feat(sdk): add capabilities.enumerate for sys enumerate-capabilities#16
Conversation
Wraps astrid:sys/host.enumerate-capabilities (astrid-runtime/wit#13) as the infallible list dual of capabilities.check: returns the calling capsule's own held capability names — the categories declared in its [capabilities] manifest block (host_process, net_connect, fs_read, …), not the scoped arguments within them. Argument-free, returns string[] with no error path (an empty array is the valid no-capabilities answer). Hand-adds the ambient host type in wit-imports.d.ts and bumps the contracts submodule so astrid-build's host WIT declares the import. The astrid:contracts events bundle is unchanged.
There was a problem hiding this comment.
Code Review
This pull request introduces the capabilities.enumerate function to the SDK, allowing a capsule to list its own held capability names by calling enumerateCapabilities from the host. The contracts submodule has been bumped and the CHANGELOG updated accordingly. The reviewer suggested caching the result of enumerate() to avoid redundant guest-host boundary crossings, as a capsule's capabilities are static and do not change during its lifetime.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
What
Adds
capabilities.enumerate()to@unicity-astrid/sdk— the ergonomic wrapper forastrid:sys/host.enumerate-capabilities(astrid-runtime/wit#13, merged), mirroring the Rust SDKcapabilities::enumerate.It is the infallible list dual of
capabilities.check: returns the calling capsule's own held capability names — the categories declared in its[capabilities]manifest block (host_process,net_connect,fs_read, …), not the scoped arguments within them. Argument-free, returnsstring[]with no error path (an empty array is the valid "no capabilities" answer).Hand-adds the ambient
enumerateCapabilities(): string[]host declaration inwit-imports.d.tsand bumps thecontractssubmodule to the merged9742f80soastrid-build'sCANONICAL_WIT_DIR(contracts/host) declares the import for downstream componentization. Theastrid:contractsevents bundle is unchanged.Stacking
Stacked on
feat/process-persistent-sdk(#14) — base is that branch, so the diff shows only the enumerate delta. Rebase ontomainand retarget once #14 lands.Verify
tsc -btypecheck green;capabilities.enumerateis exported viaexport * as capabilities.