@contractspec/example.agent-console
v3.8.25
Published
Agent Console example - AI agent orchestration with tools, runs, and logs
Readme
@contractspec/example.agent-console
Website: https://contractspec.io
Agent Console example - AI agent orchestration with tools, runs, and logs.
What This Demonstrates
- Agent entity with lifecycle (create, configure, execute).
- Canonical
agentexample exports plus business-orientedharness-scenarioandharness-suiteproof coverage. - Run tracking with status enums and event-driven state transitions.
- Tool registry with typed schemas and operation handlers.
- Presentation layer with React UI components, hooks, modals, overlays, and a server-mode shared
DataTablefor run history. - Shared
AgentConsolePreviewcomponent rendered by both the web inline preview and the Expo mobile demo through the UI kit alias layer. - Shared table capabilities including sorting, pagination, column visibility toggles, and expandable run diagnostics.
- Contract-backed visualization surfaces for run status, activity, and duration-vs-token analysis.
- One deterministic demo runtime shared across React hooks, markdown renderers, and the sandbox runtime.
- Markdown and React renderers for multi-surface output.
- Seeded local data and harness replay proof for offline-safe demo scenarios.
Canonical Demo Path
- Default sandbox route:
/sandbox - Explicit sandbox route:
/sandbox?template=agent-console - Proof artifact:
packages/examples/agent-console/proofs/agent-console-meetup.replay.json
The canonical walkthrough is deterministic and local-first:
- Load the agent-console sandbox.
- Inspect seeded agents, tools, runs, and metrics.
- Create an agent.
- Activate or pause it.
- Execute a run.
- Confirm the run and metrics update.
- Export or inspect the generated replay proof.
Runtime Boundaries
- React hooks and the sandbox use
createAgentConsoleDemoHandlers(...)for the meetup path. - Markdown renderers prefer runtime-fetched data and fall back to the same deterministic demo handlers.
- The demo runtime is intentionally mocked and offline-safe by default.
- Database-backed
createAgentHandlers(db)remains available for non-demo runtime wiring.
Running Locally
From packages/examples/agent-console:
bun run devbun run buildbun run testbun run proofbun run typecheckbun run preflight
From the repository root:
bun run meetup:agent-console:policybun run meetup:agent-console:proofbun run meetup:agent-console:preflight
Usage
Use @contractspec/example.agent-console as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
Architecture
src/agentis part of the package's public or composition surface.src/agent.capability.tsdefines a capability surface.src/agent.feature.tsdefines a feature entrypoint.src/docs/contains docblocks and documentation-facing exports.src/example.tsis the runnable example entrypoint.src/handlers/contains handlers or demo adapters wired to contract surfaces.src/index.tsis the root public barrel and package entrypoint.src/proof/contains the exported meetup proof scenario and suite.src/ui/AgentConsolePreview.tsxis the cross-platform preview component used by web and mobile example surfaces.
Public Entry Points
- Export
.resolves through./src/index.ts. - Export
./agentresolves through./src/agent/index.ts. - Export
./agent.capabilityresolves through./src/agent.capability.ts. - Export
./agent.featureresolves through./src/agent.feature.ts. - Export
./agent/agent.entityresolves through./src/agent/agent.entity.ts. - Export
./agent/agent.enumresolves through./src/agent/agent.enum.ts. - Export
./agent/agent.eventresolves through./src/agent/agent.event.ts. - Export
./agent/agent.handlerresolves through./src/agent/agent.handler.ts. - Export
./agent/agent.operationresolves through./src/agent/agent.operation.ts. - Export
./agent/agent.presentationresolves through./src/agent/agent.presentation.ts. - Export
./proofresolves through./src/proof/index.ts. - Export
./proof/meetup-proof.scenarioresolves through./src/proof/meetup-proof.scenario.ts. - Export
./proof/meetup-proof.suiteresolves through./src/proof/meetup-proof.suite.ts. - The package publishes 72 total export subpaths; keep docs aligned with
package.json.
Local Commands
bun run dev— contractspec-bun-build devbun run build— bun run prebuild && bun run build:bundle && bun run build:typesbun run test— bun testbun run proof— bun ../../../scripts/generate-agent-console-meetup-proof.tsbun run preflight— bun run build && bun run typecheck && bun run test && bun ../../../scripts/check-agent-console-meetup-policy.ts && bun run proofbun run lint— bun lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsc --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rimraf dist .turbobun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Unified the meetup demo around a single seeded runtime.
- Added focused handler tests, a sandbox smoke test, and a harness replay proof.
- Added a slice-scoped meetup preflight instead of relying on the repo-wide policy backlog.
Notes
- Works alongside
@contractspec/lib.contracts-spec,@contractspec/lib.design-system,@contractspec/lib.example-shared-ui,@contractspec/lib.runtime-sandbox,@contractspec/lib.schema, ...
