Skip to content

Commit cf3f94f

Browse files
bloveclaude
andcommitted
fix(invoicing): name the B4 function agent so index.html serves the SPA root
A Build Output function named index is also served at /, shadowing the static index.html. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent cfa1f72 commit cf3f94f

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

‎docs/superpowers/plans/2026-09-16-invoicing-vercel-deployment.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,3 +1505,11 @@ Co-Authored-By: Claude Fable 5.1 <[email protected]>"
15051505
### Task 13: Upstream B4 gaps
15061506
15071507
- [ ] With the user's go-ahead, open issues in `cacheplane/b4run` for the six items in the spec's "B4 gaps" section, each referencing this example and the concrete workaround (`assemble.mjs`, committed `vercel.json`), so the assembler can be retired once the target supports static assets and app functions natively.
1508+
1509+
---
1510+
1511+
## Amendments applied during execution
1512+
1513+
- In the Build Output API a function named `index` is served at `/` as well as `/index`, so B4's `index.func` shadowed the SPA's `index.html` on the preview. The assembler manifest copies it as `agent.func` and routes `/agui`, `/threads`, and `/healthz` to `/agent`.
1514+
- B4's Vercel function default-exports a Hono app (`{ fetch }`), which Vercel's Node launcher accepts; the artifact test asserts that shape rather than a Node handler.
1515+
- `vercel integration add neon …` provisions and connects the store non-interactively once the marketplace terms have been accepted in a browser; the bootstrap keeps reporting `env DATABASE_URL missing` until then.

‎examples/invoicing/e2e/deployment-artifact.e2e.test.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,20 @@ test('assembled output has the B4 function, the api function, and the SPA', asyn
1414
assert.deepEqual(config.routes.at(-1), { src: '/(.*)', dest: '/index.html' });
1515
const b4 = JSON.parse(
1616
await readFile(
17-
new URL('functions/index.func/.vc-config.json', output),
17+
new URL('functions/agent.func/.vc-config.json', output),
1818
'utf8',
1919
),
2020
);
2121
assert.equal(b4.runtime, 'nodejs24.x');
2222
assert.equal(b4.maxDuration, 300);
2323
assert.equal(b4.supportsResponseStreaming, true);
24-
await stat(new URL('functions/index.func/index.mjs', output));
24+
await stat(new URL('functions/agent.func/index.mjs', output));
2525
await stat(new URL('static/index.html', output));
2626
});
2727

2828
test('the B4 function exports a web fetch app', async () => {
2929
const { default: app } = await import(
30-
new URL('functions/index.func/index.mjs', output)
30+
new URL('functions/agent.func/index.mjs', output)
3131
);
3232
assert.equal(typeof app.fetch, 'function');
3333
});

‎examples/invoicing/vercel.assembly.json‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
"spaFallback": "index.html"
77
},
88
"functions": {
9-
"index": {
9+
"agent": {
1010
"from": "server/.vercel/output/functions/index.func",
11-
"config": { "maxDuration": 300, "supportsResponseStreaming": true }
11+
"config": {
12+
"maxDuration": 300,
13+
"supportsResponseStreaming": true
14+
}
1215
},
1316
"api": {
1417
"entry": "server/src/api.ts",
@@ -17,8 +20,17 @@
1720
}
1821
},
1922
"routes": [
20-
{ "src": "/api/(.*)", "dest": "/api" },
21-
{ "src": "/(agui|threads)(/.*)?", "dest": "/index" },
22-
{ "src": "/healthz", "dest": "/index" }
23+
{
24+
"src": "/api/(.*)",
25+
"dest": "/api"
26+
},
27+
{
28+
"src": "/(agui|threads)(/.*)?",
29+
"dest": "/agent"
30+
},
31+
{
32+
"src": "/healthz",
33+
"dest": "/agent"
34+
}
2335
]
2436
}

0 commit comments

Comments
 (0)