Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/after-preflight-handoff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'cargo-hauler': patch
---

Hand the `tool/after` preflight's session-completed answer to the route as `preflight` data so the after-shell hook does not query the daemon a second time, and pin `agent-bundle` and `@agent-bundle/runtime` to the preview of main `9197015b9` (agent-bundle #661/#664).
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ ships no preview harness of its own.

agent-bundle does not yet have an npm release; this repository pins the
[pkg.pr.new](https://pkg.pr.new) preview of main commit
[`d30d9acb6`](https://github.com/ScriptedAlchemy/agent-bundle/commit/d30d9acb6bd106762bb975ac58d6bf437c176091)
[`9197015b9`](https://github.com/ScriptedAlchemy/agent-bundle/commit/9197015b9ae5088eee75c7d2d11a40890b37b367)
for both `agent-bundle` and `@agent-bundle/runtime`. `inspect` reports the
`agent` component kind as unavailable on every host (agent-bundle G5
deferral); this plugin defines no agents.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"release:version": "changeset version"
},
"devDependencies": {
"@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@75c5f46f947f8a4cc90ac5d843d53d421dec8a44",
"@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@9197015b9ae5088eee75c7d2d11a40890b37b367",
"@changesets/cli": "3.0.1",
"@effect/atom-react": "4.0.0-rc.112",
"@effect/platform-node": "4.0.0-rc.112",
Expand All @@ -69,7 +69,7 @@
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.5",
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
"agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@75c5f46f947f8a4cc90ac5d843d53d421dec8a44",
"agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@9197015b9ae5088eee75c7d2d11a40890b37b367",
"bashjsast": "github:woolkingx/bashjsast#131f4b677d1906774fc49cfceab0ccb7b370b2e6",
"effect": "4.0.0-rc.112",
"effect-rstest": "https://pkg.pr.new/ScriptedAlchemy/effect-rstest@e5f8d5f",
Expand Down
142 changes: 21 additions & 121 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions src/events/tool/after.preflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { EventPreflight } from 'agent-bundle';
import { readCursor } from '../../hooks/hook-state.js';
import { pingSessionCompleted } from '../../hooks/session-ping.js';
import { commandMentionsHauler, hiddenCargoRun } from '../../hooks/tokens.js';
import { documentValue } from '../../lib/json.js';
import { extractShellCommand, extractShellOutput } from '../../lib/tool-input.js';

/**
Expand All @@ -14,10 +15,8 @@ import { extractShellCommand, extractShellOutput } from '../../lib/tool-input.js
* the command itself names cargo or hauler, or the command's output carries
* cargo's status lines without the command naming cargo (a wrapper script
* ran it past the hook and the shim); a daemon that is down or slow
* answers `unavailable`, which is `continue` here. The gate's result does not
* reach the route, so `after-shell.ts` asks the daemon once more with the
* same cursor and advances it only after announcing — a second answer that
* fails leaves the tickets for the next call rather than losing them.
* answers `unavailable`, which is `continue` here. A finished-ticket answer
* is returned as `data` so the route can announce it without asking again.
*/
export default (async ({ canonical }) => {
const command = extractShellCommand(canonical.payload.toolInput?.value);
Expand All @@ -28,6 +27,9 @@ export default (async ({ canonical }) => {
if (session === undefined || session.length === 0) {
return { outcome: 'continue' };
}
const asOfMs = Date.now();
const pinged = await pingSessionCompleted(session, readCursor(session));
return pinged.kind === 'finished' && pinged.tickets.length > 0 ? 'execute' : { outcome: 'continue' };
return pinged.kind === 'finished' && pinged.tickets.length > 0
? { outcome: 'execute', data: documentValue({ ...pinged, asOfMs }) }
: { outcome: 'continue' };
}) satisfies EventPreflight<'tool/after'>;
Loading