Skip to content

Align cargo-hauler with Agent Bundle meta-framework architecture (#592) and delete framework workarounds as upstream lands #107

Description

@ScriptedAlchemy

Goal

Use cargo-hauler as a reference consumer of Agent Bundle's #592 architecture rather than preserving workarounds that exist only because current framework surfaces are split.

This is an umbrella migration issue. Do not rewrite working behavior before the relevant upstream capability lands.

1. Composite plugin root / distribution

Blocked on ScriptedAlchemy/agent-bundle#555.

Current cargo-hauler still encodes the old per-target artifact model in:

  • agent-bundle.config.ts comments (artifact/<target>);
  • README.md and docs/install.md (artifact/<host>);
  • AGENTS.md;
  • src/cli/dashboard.ts path heuristics;
  • tests/version-consistency.test.ts;
  • packed/route tests that open artifact/cursor, etc.;
  • package files/installation prose.

After #555:

  • one artifact/ root should contain selected Claude/Codex/Cursor/portable projections;
  • install/doctor should point at the root, not artifact/<host>;
  • tests should inspect agent-bundle.manifest.json / host manifest pointers instead of hard-coded partition paths;
  • npm/Git/local delivery should describe the same plugin root.

Do not preserve compatibility path logic in cargo-hauler itself; Agent Bundle owns any legacy artifact probing.

2. Delete duplicated CLI schema contracts

Blocked on ScriptedAlchemy/agent-bundle#593.

src/cli/status.tsx re-declares statusInputSchema inline because static argv extraction cannot follow the canonical imported schema. tests/schema-compat.test.ts then pins the copy to src/lib/protocol-schemas.ts.

Once #593 lands:

import { statusInputSchema, statusResultSchema } from '../lib/protocol-schemas.js';
export const inputSchema = statusInputSchema;
export const resultSchema = statusResultSchema;

Delete compatibility tests whose only purpose is preventing framework-forced schema drift.

Audit the remaining CLI/MCP pairs (request, result, await, kill, last, log) for the same duplication and share contracts/domain execution wherever the presentation semantics permit it.

3. Delete the hand-written MCP App transport/protocol layer

Blocked on ScriptedAlchemy/agent-bundle#594.

src/mcp/hauler/apps/dashboard.tsx currently owns a local JSON-RPC client over window.parent.postMessage('*'), request ids/timeouts, tools/call envelopes, structured-result unwrapping, and many unknown protocol interfaces that duplicate the route result schemas.

Once #594 lands, the App should consume the generated typed route client and keep only dashboard state/view logic.

Desired shape:

const status = await client.tools.hauler.hauler_status({ limit: 40 });
const detail = await client.tools.hauler.hauler_result({ ticket });

No local knowledge of JSON-RPC ids, structuredContent envelope shape, parent bridge semantics, or manually mirrored server protocol types.

4. Replace checkout-only hauler dashboard

Blocked on ScriptedAlchemy/agent-bundle#564 and #594.

src/cli/dashboard.ts is ~framework integration glue:

  • locate checkout/artifact by relative paths;
  • crawl node_modules for Agent Bundle's package manifest;
  • spawn agent-bundle serve-app;
  • parse its human stdout with a regex to recover the URL;
  • manually relay abort to SIGTERM;
  • cannot run from the npm package or installed plugin.

After #564, delete this implementation and use the framework-generated production browser command/host. hauler dashboard should work from the same installed composite plugin root as the MCP server and routed CLI, with no Agent Bundle checkout dependency.

The application should configure/expose hauler/dashboard; Agent Bundle owns serving, browser opening, lifecycle and URL/result protocol.

5. Bring fast shell hooks back into the canonical event model

Blocked on ScriptedAlchemy/agent-bundle#595.

cargo-hauler #90 correctly moved high-frequency shell hooks to hooks.beforeTool.handler / hooks.afterTool.handler: rendered event routes cost ~0.2 s per shell command pair before they could reject unrelated commands.

This workaround should remain until #595 can emit a physically cheap preflight gate.

Afterward:

6. Provider cost

src/providers/hauler-daemon.ts probes daemon health on every non-event route request. This is acceptable today but should be revisited once #595 supports lazy provider materialization/declared provider needs.

Routes that only need static/help/render information should not probe the daemon merely because the provider exists globally. Keep the probe where domain semantics require a fresh health snapshot.

7. Keep domain/runtime boundaries

Do not move cargo orchestration into Agent Bundle. cargo-hauler should continue to own:

  • daemon/broker scheduling;
  • lane/admission/folding semantics;
  • ledger/protocol domain schemas;
  • Cargo parsing/rewrite policy;
  • metrics/savings calculations;
  • dashboard domain view models.

Agent Bundle should own:

  • route discovery/contracts;
  • host projection;
  • execution context;
  • event envelope/projection;
  • App transport;
  • browser serving;
  • artifact/package/install mechanics.

Acceptance

  • No documentation/tests assume artifact/<host> after #555 adoption.
  • No CLI route duplicates a canonical schema solely for static extraction after #593.
  • Dashboard contains no raw MCP Apps JSON-RPC/postMessage client after #594.
  • hauler dashboard works from the installed/npm plugin root without a framework checkout after #564.
  • Fast shell hooks use the canonical event graph without regressing Hook overhead: ~100 ms per PreToolUse and per PostToolUse on every Bash call #90 after #595.
  • Provider health probing is paid only where required once lazy provider support exists.
  • cargo-hauler remains a useful end-to-end reference fixture for Agent Bundle's Application IR -> Projection IR -> Artifact IR architecture.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions