From e76bacd065ba58affcf5a13a1815841003d8bea9 Mon Sep 17 00:00:00 2001 From: "Joshua J. Bouw" Date: Wed, 27 May 2026 15:44:49 +0400 Subject: [PATCH 1/2] feat(contracts): regenerate bundle with hook-event-request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Submodule bump + sync-contracts-wit.sh regeneration. The hook.wit record was added in unicity-astrid/wit#TBD to back the @unicity-astrid/wit/hook/hook-event-request reference in astrid-capsule-hook-bridge/Capsule.toml. With this commit, the bundled astrid-contracts.wit (consumed by codegenWitEvents in the JS SDK) carries the record, so any consumer that switches from hand-coded types to generated types gets the correct shape. Depends on unicity-astrid/wit#TBD landing first — once that merges, this PR's submodule pointer becomes reachable from main. --- contracts | 2 +- .../wit-contracts/astrid-contracts.wit | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/contracts b/contracts index 467240d..d8f4f31 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 467240deeba2cf7ff28ba32d12b5a88485be5b3d +Subproject commit d8f4f31db267873913a0fef094a224ace2a080a6 diff --git a/packages/astrid-sdk/wit-contracts/astrid-contracts.wit b/packages/astrid-sdk/wit-contracts/astrid-contracts.wit index edd5b0e..4765184 100644 --- a/packages/astrid-sdk/wit-contracts/astrid-contracts.wit +++ b/packages/astrid-sdk/wit-contracts/astrid-contracts.wit @@ -303,6 +303,27 @@ interface hook { /// Merged data from interceptor responses (opaque JSON). data: option, } + + /// Payload of `hook.v1.event.` envelopes published by the + /// hook bridge during fan-out to subscriber capsules. + /// + /// Subscribers wishing to influence the outcome (merge strategies + /// `ToolCallBefore` / `LastNonNull`) reply on the per-request + /// scoped topic `hook.v1.response..`. + /// When `correlation_id` is absent, the dispatch is fire-and-forget + /// (merge semantics `None`) and no reply topic exists. + record hook-event-request { + /// Semantic hook name (e.g. `before_tool_call`, `session_start`, + /// `on_compaction_started`). Matches the mapping table in + /// `astrid-capsule-hook-bridge`. + hook: string, + /// Original lifecycle event payload, serialized as JSON. Opaque + /// to the bus — subscribers parse based on the hook name. + payload: string, + /// Per-request correlation id for scoped replies. `none` for + /// fire-and-forget hooks. + correlation-id: option, + } } // ── llm ────────────────────────────────────────────────────────── From f4a45309f44b3fc89fc560c4f0e767f065b7a5b0 Mon Sep 17 00:00:00 2001 From: "Joshua J. Bouw" Date: Sat, 6 Jun 2026 06:25:06 +0400 Subject: [PATCH 2/2] fix(contracts): regenerate contracts.ts with HookEventRequest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prior commit bumped the WIT (hook-event-request record) and the contracts submodule pointer but never re-ran the generator, leaving src/contracts.ts stale. Regenerated via the package prebuild step (node scripts/generate-contracts.mjs); purely additive — adds the HookEventRequest interface (type count 99 -> 100). tsc -b is clean. --- packages/astrid-sdk/src/contracts.ts | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/packages/astrid-sdk/src/contracts.ts b/packages/astrid-sdk/src/contracts.ts index 3e581a9..576540e 100644 --- a/packages/astrid-sdk/src/contracts.ts +++ b/packages/astrid-sdk/src/contracts.ts @@ -225,6 +225,35 @@ export namespace hook { data?: string; } + /** + * Payload of `hook.v1.event.` envelopes published by the + * hook bridge during fan-out to subscriber capsules. + * + * Subscribers wishing to influence the outcome (merge strategies + * `ToolCallBefore` / `LastNonNull`) reply on the per-request + * scoped topic `hook.v1.response..`. + * When `correlation_id` is absent, the dispatch is fire-and-forget + * (merge semantics `None`) and no reply topic exists. + */ + export interface HookEventRequest { + /** + * Semantic hook name (e.g. `before_tool_call`, `session_start`, + * `on_compaction_started`). Matches the mapping table in + * `astrid-capsule-hook-bridge`. + */ + hook: string; + /** + * Original lifecycle event payload, serialized as JSON. Opaque + * to the bus — subscribers parse based on the hook name. + */ + payload: string; + /** + * Per-request correlation id for scoped replies. `none` for + * fire-and-forget hooks. + */ + correlation_id?: string; + } + } /** Types generated from the `llm` WIT interface. */