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/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. */ 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 ──────────────────────────────────────────────────────────