Skip to content

Simplify tool and event authoring while preserving JSX - #782

Merged
ScriptedAlchemy merged 4 commits into
mainfrom
codex/unified-event-authoring
Sep 11, 2026
Merged

Simplify tool and event authoring while preserving JSX#782
ScriptedAlchemy merged 4 commits into
mainfrom
codex/unified-event-authoring

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 11, 2026

Copy link
Copy Markdown
Owner

This replaces overlapping authoring APIs with defineTool and one conventional event system. Events keep JSX: .ts handlers return decisions, .tsx handlers render directly, and ctx.render('./name.view.js', data) loads an explicit sibling view. Providers resolve lazily with the complete request context and trace observations; process identity is exposed as context.process.

Inspection now reads literal metadata instead of reconstructing application behavior. config.inputJsonSchema supplies forms and named CLI flags; commands without it accept --input JSON. Compiled executables validate through the original schema, preserving defaults and transforms. Handlers and mapInput accept sync or async functions. Runtime compiler imports are rejected by the bundler, including aliases, while type-only imports remain legal.

Removes the before/preflight closure extractor, Zod source interpreter, shared alias resolver, routine AB4834 TypeScript Program, semantic import walker, deep function-shape scanner, and obsolete runtime application/operation APIs. Updates both documentation locales, examples, and the single breaking changeset; manifest version 6 records event handlers and CLI JSON mode. The optional source-only unit-render loader remains because its isolation is distinct from normal Workbench execution through generated artifacts. Installation-script dependency policy remains outside this change.

Review follow-ups are fixed: lightweight events mount state/notices and native identities with the user-data state anchor; one deadline covers provider initialization, the handler, deferred child startup, and rendering; native receipts carry resolved lineage plus bounded aggregate provider count/span evidence, while per-provider observations remain in Workbench invocation results. Direct JSX events no longer return the obsolete execute marker, so Workbench renders their documents.

Validation:

  • pnpm build, pnpm typecheck, and pnpm lint pass.
  • Unit: 4,411 passed / 6 skipped; route-unit: 91 passed; projection: 197 passed.
  • Full integration pool: 1,175 passed / 4 skipped.
  • Full packed pool: 44 passed / 1 skipped.
  • Focused deadline, provider-trace, receipt-limit, privacy, and lineage regressions: 39 passed.
  • pnpm docs:site:build passes: locale parity and 0 broken links across 35,933 internal links.
  • Independent non-Grok review found no merge blocker after follow-up.

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cb4930

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

This PR includes changesets to release 3 packages
Name Type
agent-bundle Minor
@agent-bundle/runtime Minor
create-agent-bundle 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

@ScriptedAlchemy
ScriptedAlchemy marked this pull request as ready for review September 11, 2026 02:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-11T02:28:34.821131Z 964dcf9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@782
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@782
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@782
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@782

commit: 97be7ce

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 964dcf957f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/agent-bundle/src/adapters/hook-contract.ts Outdated
Comment thread packages/agent-bundle/src/adapters/hook-contract.ts Outdated
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

Disposition of the three confirmed findings (fixed in 2cb4930037):

  1. P1 deadline handoff — the generated lightweight wrapper now passes the combined AbortSignal.any([controller.signal, AbortSignal.timeout(timeoutMs)]) signal to runExecutor, so provider initialization, handler execution, deferred child startup, and rendering consume one budget. RED: a 1,000 ms route with a 350 ms handler and 1,200 ms view completed late with exit 0. GREEN: it aborts with exit 1 within the asserted 700–1,800 ms window, emits no late output/marker, and the recorded child PID is no longer alive after source deletion.
  2. P2 provider timing / receipt limit — overlapping starts are reference-counted into one aggregate phase. The deterministic A(0) / B(10) / B-finish(20) / A-finish(30) case now emits one finish with count: 2 and durationMs: 30 (previously A reported 20). Native receipts compact provider observations to first-start/last-finish plus total count; 16 concurrent providers post and decode successfully, and a 16-provider sequential unit case compacts 34 raw events to four receipt events. Receipts contain no provider value, key, or filesystem path.
  3. P2 native lineage — the normal generated lightweight wrapper records native identity and the already-resolved lineage before running the gate, so both completed and failed receipts carry the same lineage visible to the handler instead of not-provided.

Qualification (fresh): pnpm build, pnpm typecheck, pnpm lint; unit 4,411 pass / 6 skip; route-unit 91 pass; projection 197 pass; full integration 1,175 pass / 4 skip; packed 44 pass / 1 skip; docs site 0 broken links across 35,933 internal links. Independent Fable review and follow-up found no merge blocker. The prior PR-body claim is narrowed: native receipts carry aggregate provider count/span evidence; per-provider observations stay in Workbench invocation results.

@ScriptedAlchemy
ScriptedAlchemy merged commit 12b7d88 into main Sep 11, 2026
5 checks passed
@ScriptedAlchemy
ScriptedAlchemy deleted the codex/unified-event-authoring branch September 11, 2026 23:17
ScriptedAlchemy added a commit that referenced this pull request Sep 12, 2026
* Fix cli-tool scaffold to declare config.inputJsonSchema

The greet starter still compiled argv from Zod inputSchema plus
config.positionals, which AB4814 rejects after #782. Project name/shout
from literal inputJsonSchema so create-agent-bundle ships a compiling
CLI starter.

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>

* Name the changeset after PR 785

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
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