Skip to content

SEP Phase 2 (SDK + spec): hook handlers + observe bus#147

Merged
brentrager merged 1 commit into
mainfrom
sep-phase2-spec-sdk
Jul 3, 2026
Merged

SEP Phase 2 (SDK + spec): hook handlers + observe bus#147
brentrager merged 1 commit into
mainfrom
sep-phase2-spec-sdk

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Phase 2 of SEP — the SDK + spec side, paired with smooth-operator-core's engine PR. Builds on Phase 0 (#142) + Phase 1 (#145).

What ships

  • Hook handlers in @smooai/smooth-extension-sdk: smooth.on(name, handler) now covers intercept hooks — return { block, reason? } to veto or { patch } to rewrite the input. The extension folds its own handlers (first block short-circuits; patches shallow-merge and thread to the next), matching pi's on(...) signature; the host chains outcomes across extensions. Hook names are kept out of the reported event subscriptions.
  • createTestHost gains callHook(hook, input); new permission-gate demo blocks dangerous bash via a fail-closed tool_call hook.
  • spec/extension: event schema gains optional seq (absent on the events_lost marker) + model_select → AgentEvent::ModelResolved parity note; fixtures add a seq'd event, the events_lost marker (drop-N → count), tool_execution_start, and the tool_result hook pair.

Tests

extension-sdk: 19 tests green (incl. new hook.test.ts: block/patch/short-circuit/subscription-filtering + permission-gate). extension-conformance (fixtures↔schema) green. SDK typecheck + build clean.

🤖 Generated with Claude Code

extension-sdk: smooth.on(name, handler) now covers intercept hooks — return
{block,reason} to veto or {patch} to rewrite input; the extension folds its own
handlers (first block wins, patches shallow-merge and thread) and the host
chains across extensions. Hook names stay out of event subscriptions.
createTestHost gains callHook(). New permission-gate demo blocks dangerous bash
via a fail-closed tool_call hook.

spec/extension: event schema gains optional seq (absent on the events_lost
marker) + model_select->ModelResolved parity note; fixtures add a seq'd event,
the events_lost marker, tool_execution_start, and the tool_result hook pair.
Rust + TS conformance green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d20e78a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@smooai/smooth-extension-sdk Minor
@smooai/smooth-operator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager brentrager merged commit 1c8f26f into main Jul 3, 2026
6 checks passed
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