Skip to content

Commit 621a432

Browse files
Merge pull request #113 from engineeredsoftware/v37/gate-3-conversation-stream-ui-event-contracts
V37 Gate 3: Conversation Stream UI And Event Contracts
2 parents faa76c2 + e2eae0f commit 621a432

31 files changed

Lines changed: 2533 additions & 57 deletions

.bitcode/v37-conversation-stream-event-contract.json

Lines changed: 708 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/bitcode-canon-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ jobs:
112112
if [ -f scripts/check-v37-gate2-conversation-session-route-history-contracts.mjs ]; then
113113
node scripts/check-v37-gate2-conversation-session-route-history-contracts.mjs --skip-branch-check
114114
fi
115+
if [ -f scripts/check-v37-gate3-conversation-stream-event-contracts.mjs ]; then
116+
node scripts/check-v37-gate3-conversation-stream-event-contracts.mjs --skip-branch-check
117+
fi
115118
fi
116119
else
117120
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2

.github/workflows/bitcode-gate-quality.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ jobs:
2121
gate-quality:
2222
name: Gate Quality
2323
runs-on: ubuntu-latest
24+
timeout-minutes: 20
2425

2526
steps:
2627
- name: Checkout repository
@@ -240,6 +241,9 @@ jobs:
240241
if [ -f scripts/check-v37-gate2-conversation-session-route-history-contracts.mjs ]; then
241242
node scripts/check-v37-gate2-conversation-session-route-history-contracts.mjs --skip-branch-check
242243
fi
244+
if [ -f scripts/check-v37-gate3-conversation-stream-event-contracts.mjs ]; then
245+
node scripts/check-v37-gate3-conversation-stream-event-contracts.mjs --skip-branch-check
246+
fi
243247
fi
244248
else
245249
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2
@@ -263,7 +267,6 @@ jobs:
263267
264268
- name: Test gate packages
265269
run: |
266-
pnpm --filter @bitcode/btd exec jest --config jest.config.cjs --runInBand --forceExit
267270
pnpm --filter @bitcode/btd exec jest --config jest.config.cjs --runTestsByPath __tests__/btc-fee-operation.test.ts --runInBand --forceExit
268271
pnpm --filter @bitcode/btd exec jest --config jest.config.cjs --runTestsByPath __tests__/btd.test.ts --runInBand --forceExit
269272
pnpm --filter @bitcode/btd exec jest --config jest.config.cjs --runTestsByPath __tests__/v32-ledger-btd-settlement-failure-states.test.ts --runInBand --forceExit
@@ -311,10 +314,9 @@ jobs:
311314
pnpm --dir packages/chatgptapp exec jest --runTestsByPath src/__tests__/chatgpt-action-contract.test.ts src/__tests__/tools.test.ts --runInBand --forceExit
312315
pnpm --filter @bitcode/pipeline-hosts exec jest --config jest.config.cjs --runTestsByPath src/__tests__/asset-pack-harness.test.ts --runInBand --forceExit
313316
pnpm --filter @bitcode/pipeline-hosts exec jest --config jest.config.cjs --runTestsByPath src/__tests__/distributed-execution-runtime-receipt.test.ts --runInBand --forceExit
314-
pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --passWithNoTests --forceExit
315317
pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --runTestsByPath src/__tests__/reading-pipeline-observability.test.ts src/__tests__/reading-pipeline-contract.test.ts src/__tests__/v32-reading-pipeline-proof-coverage.test.ts --runInBand --forceExit
316318
pnpm --filter @bitcode/pipeline-asset-pack exec jest --config jest.config.cjs --runTestsByPath src/__tests__/asset-pack-disclosure.test.ts src/__tests__/postprocess.test.ts src/__tests__/read-need.test.ts --runInBand --forceExit
317-
pnpm --filter @bitcode/pipeline-hosts exec jest --config jest.config.cjs --passWithNoTests --forceExit
319+
pnpm --filter @bitcode/api exec jest --config jest.config.cjs --runTestsByPath src/conversations/__tests__/stream-events.test.ts --runInBand --forceExit
318320
pnpm --filter @bitcode/protocol test
319321
320322
- name: Test staged Reading route and Terminal harness contracts
@@ -329,6 +331,8 @@ jobs:
329331
tests/api/vcsRoutes.test.ts \
330332
tests/api/conversationSessionRouteHistory.test.ts \
331333
tests/api/conversationSessionRouteHistoryContract.test.ts \
334+
tests/api/conversationStreamEventContract.test.ts \
335+
tests/conversationStreamPipelineLog.test.tsx \
332336
tests/auxillariesExternalsPane.test.tsx \
333337
tests/profileStep.test.tsx \
334338
tests/api/readReviewRoute.test.ts \

BITCODE_SPEC_V37.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
## Status
44

55
- Version: `V37`
6-
- V37 state: draft implementation; Gate 2 closes ConversationSession route-local history contracts over active V36 Exchange canon
6+
- V37 state: draft implementation; Gate 3 closes ConversationStreamEvent stream UI and event contracts over active V36 Exchange canon
77
- Current canonical/latest target: `V36`
88
- Prior canonical anchor: `BITCODE_SPEC_V36.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V36_PROVEN.md`
10-
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, and `.bitcode/v37-conversation-session-route-history.json`
11-
- Source parity state: V37 source parity includes Gate 1 spec family, roadmap, docs, workflow, and checker posture plus Gate 2 package-owned ConversationSession route-history contracts
10+
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, `.bitcode/v37-conversation-session-route-history.json`, and `.bitcode/v37-conversation-stream-event-contract.json`
11+
- Source parity state: V37 source parity includes Gate 1 spec family, roadmap, docs, workflow, and checker posture, Gate 2 package-owned ConversationSession route-history contracts, and Gate 3 package-owned ConversationStreamEvent stream UI/event contracts
1212
- Active canonical pointer during draft opening: `BITCODE_SPEC.txt` -> `V36`
1313
- Notes companion: `BITCODE_SPEC_V37_NOTES.md`
1414
- Delta companion: `BITCODE_SPEC_V37_DELTA.md`
@@ -31,7 +31,7 @@ V37 adds Website Conversations product contracts over inherited V36 canon:
3131

3232
- `ConversationSession`: route-local conversation identity, route-local history, user/account posture, source context, policy decision, stream state, and proof-rooted history references.
3333
- `ConversationMessage`: user, assistant, system, tool, and handoff message records with source-safe disclosure classification, redaction posture, retry state, and telemetry event ids.
34-
- `ConversationStreamEvent`: readable streaming rows for model deltas, tool calls, retrieval summaries, proof roots, error states, and completion decisions.
34+
- `ConversationStreamEvent`: readable streaming rows for model deltas, tool calls, retrieval summaries, proof roots, retry states, completion decisions, and error rows.
3535
- `ConversationWritingWorkspace`: fullscreen writing mode for drafting Read Requests, Need feedback, AssetPack review notes, and Terminal handoff summaries without source leakage.
3636
- `ConversationSourceSelector`: repository, branch, commit, deposit, BTD range, AssetPack preview, and document source selectors governed by policy, rights, and disclosure posture.
3737
- `ConversationTerminalHandoff`: source-safe handoff from conversation context into `/terminal` transactions for Depositing, Reading, Finding Fits, Exchange, settlement, and delivery workflows.
@@ -81,6 +81,32 @@ source, or any claim that route-local Conversations are global ledger truth.
8181
package tests, route tests, docs, workflow wiring, source safety, proof roots,
8282
event ids, route ids, history operations, and persistence boundaries.
8383

84+
## V37 Gate 3 ConversationStreamEvent stream UI canon
85+
86+
Gate 3 implements `ConversationStreamEvent` as the package-owned stream event
87+
contract for Website Conversations. `ConversationStreamEvent` owns model
88+
deltas, tool calls, retrieval summaries, proof roots, retry states, completion
89+
decisions, and error rows. It emits
90+
`.bitcode/v37-conversation-stream-event-contract.json` with
91+
`source-safe-conversation-stream-event-metadata`, deterministic row roots,
92+
deterministic detail roots, event kind ids, required telemetry fields, source
93+
evidence roots, and source-safe disclosure limits.
94+
95+
Conversation stream events are carried on the unversioned conversation SSE
96+
routes as metadata attached to legacy-compatible rows. The stream UI uses the
97+
shared rich execution log surface: collapsed rows show readable stream status,
98+
and expanded accordions show event ids, proof roots, redaction posture,
99+
prompt-disclosure posture, result-disclosure posture, fail-closed states, and
100+
source-safe expanded metadata. Raw protected prompts, protected source,
101+
provider tokens, private wallet material, raw provider responses, settlement
102+
private payloads, unpaid AssetPack source, and global ledger authority claims
103+
are never valid stream UI payloads.
104+
105+
`check:v37-gate3` validates package source, generated artifact freshness,
106+
package tests, route/UI tests, telemetry binding, docs, workflow wiring,
107+
source safety, event kind coverage, proof roots, disclosure posture, and
108+
fail-closed states.
109+
84110
## Inherited V36 Exchange canon
85111

86112
The promoted V36 sections below remain inherited canonical law for Exchange.

BITCODE_SPEC_V37_DELTA.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
## Status
44

55
- Version: `V37`
6-
- V37 state: draft implementation; this delta records the V36-to-V37 Website Conversations opening and Gate 2 ConversationSession contract set
6+
- V37 state: draft implementation; this delta records the V36-to-V37 Website Conversations opening through Gate 3 ConversationStreamEvent stream UI/event contracts
77
- Current canonical/latest target: `V36`
88
- Prior canonical anchor: `BITCODE_SPEC_V36.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V36_PROVEN.md`
10-
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, and `.bitcode/v37-conversation-session-route-history.json`
11-
- Source parity state: V37 source parity begins at Gate 1 with spec family, roadmap, docs, workflow, and checker posture; Gate 2 adds package-owned ConversationSession route-history contracts
10+
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, `.bitcode/v37-conversation-session-route-history.json`, and `.bitcode/v37-conversation-stream-event-contract.json`
11+
- Source parity state: V37 source parity begins at Gate 1 with spec family, roadmap, docs, workflow, and checker posture; Gate 2 adds package-owned ConversationSession route-history contracts; Gate 3 adds package-owned ConversationStreamEvent contracts and stream UI binding
1212
- Spec companion: `BITCODE_SPEC_V37.md`
1313
- Notes companion: `BITCODE_SPEC_V37_NOTES.md`
1414
- Parity companion: `BITCODE_SPEC_V37_PARITY_MATRIX.md`
@@ -92,6 +92,12 @@ Closure acceptance:
9292
- telemetry carries event ids, proof roots, redaction posture, prompt/result disclosure posture, and fail-closed states;
9393
- `pnpm run check:v37-gate3` validates stream contracts, route tests, UI tests, telemetry binding, source-safety, and workflow wiring.
9494

95+
Gate 3 closure adds package-backed `ConversationStreamEvent` source,
96+
`.bitcode/v37-conversation-stream-event-contract.json`,
97+
`source-safe-conversation-stream-event-metadata`, route-attached SSE event
98+
metadata, rich execution log collapsed/expanded UI binding, package tests,
99+
route tests, UI tests, workflow wiring, and `check:v37-gate3`.
100+
95101
### Gate 4: Fullscreen Writing Mode And Composer Workspace
96102

97103
Gate 4 defines the writing workspace.

BITCODE_SPEC_V37_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ Gate 2 adds `.bitcode/v37-conversation-session-route-history.json`, `buildConver
5555
The required operations are create, restore, branch, retry, redact, and stream.
5656
Restore, branch, retry, and redaction preserve route-local history and proof roots without exposing protected source, raw protected prompts, protected model responses with source, wallet private material, provider tokens, secrets, settlement private payloads, unpaid AssetPack source, or any global ledger authority claim.
5757

58+
## Gate 3 implementation notes
59+
60+
ConversationStreamEvent stream contracts are source-safe SSE metadata
61+
contracts, not a transcript of raw model or tool payloads. Gate 3 adds
62+
`.bitcode/v37-conversation-stream-event-contract.json`,
63+
`buildConversationStreamEventContract`, the route-facing stream event adapter,
64+
package tests, route tests, UI tests, and `check:v37-gate3`.
65+
The required event rows are model deltas, tool calls, retrieval summaries,
66+
proof roots, retry states, completion decisions, and error rows.
67+
The shared execution log is the canonical stream UI: collapsed rows show a
68+
readable status, expanded rows show source-safe metadata, and the header can
69+
surface event id, proof root, redaction posture, prompt/result disclosure
70+
posture, and fail-closed state.
71+
Gate 3 keeps gate-quality CI greenable by bounding the workflow runtime and
72+
running maintained targeted package tests inside the gate job.
73+
5874
## V37 gate plan
5975

6076
- Gate 1: V37 Conversations Roadmap And Spec Opening

BITCODE_SPEC_V37_PARITY_MATRIX.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
## Status
44

55
- Version: `V37`
6-
- V37 state: draft implementation; V37 parity includes Website Conversations spec family, roadmap, docs, workflow, checker posture, and Gate 2 ConversationSession route-history contracts
6+
- V37 state: draft implementation; V37 parity includes Website Conversations spec family, roadmap, docs, workflow, checker posture, Gate 2 ConversationSession route-history contracts, and Gate 3 ConversationStreamEvent stream UI/event contracts
77
- Current canonical/latest target: `V36`
88
- Prior canonical anchor: `BITCODE_SPEC_V36.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V36_PROVEN.md`
10-
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, and `.bitcode/v37-conversation-session-route-history.json`
11-
- Source parity state: V37 source parity begins at Gate 1 with spec family, roadmap, docs, workflow, and checker posture; Gate 2 adds package-owned ConversationSession route-history contracts
10+
- Generated structured artifact inventory: draft `.bitcode/v37-spec-family-report.json`, `.bitcode/v37-canonical-input-report.json`, `.bitcode/v37-canon-posture-drift-report.json`, `.bitcode/v37-conversation-session-route-history.json`, and `.bitcode/v37-conversation-stream-event-contract.json`
11+
- Source parity state: V37 source parity begins at Gate 1 with spec family, roadmap, docs, workflow, and checker posture; Gate 2 adds package-owned ConversationSession route-history contracts; Gate 3 adds package-owned ConversationStreamEvent contracts and stream UI binding
1212
- Spec companion: `BITCODE_SPEC_V37.md`
1313
- Notes companion: `BITCODE_SPEC_V37_NOTES.md`
1414
- Delta companion: `BITCODE_SPEC_V37_DELTA.md`
@@ -23,7 +23,7 @@ Every V37 gate must name package-owned conversation objects, source-safe payload
2323

2424
## Audit basis
2525

26-
Gate 1 and Gate 2 audit basis:
26+
Gate 1, Gate 2, and Gate 3 audit basis:
2727

2828
- `BITCODE_SPEC.txt`
2929
- `BITCODE_SPEC_V36.md`
@@ -53,6 +53,19 @@ Gate 1 and Gate 2 audit basis:
5353
- `uapi/app/conversations/conversation-session-route-history.ts`
5454
- `uapi/tests/api/conversationSessionRouteHistory.test.ts`
5555
- `uapi/tests/api/conversationSessionRouteHistoryContract.test.ts`
56+
- `packages/protocol/src/canonical/conversation-stream-event-contract.js`
57+
- `packages/protocol/test/conversation-stream-event-contract.test.js`
58+
- `packages/api/src/conversations/stream-events.ts`
59+
- `packages/api/src/conversations/__tests__/stream-events.test.ts`
60+
- `scripts/generate-v37-conversation-stream-event-contract.mjs`
61+
- `scripts/check-v37-gate3-conversation-stream-event-contracts.mjs`
62+
- `.bitcode/v37-conversation-stream-event-contract.json`
63+
- `uapi/hooks/useConversationStream.ts`
64+
- `uapi/app/conversations/components/hooks/usePipelineState.ts`
65+
- `uapi/components/base/bitcode/execution/pipeline-execution-log.tsx`
66+
- `uapi/components/base/bitcode/execution/pipeline-execution-log-header.tsx`
67+
- `uapi/tests/api/conversationStreamEventContract.test.ts`
68+
- `uapi/tests/conversationStreamPipelineLog.test.tsx`
5669

5770
No `_legacy/` source is active source truth.
5871

@@ -63,7 +76,7 @@ No `_legacy/` source is active source truth.
6376
| Draft family and branch posture | Gate 1 | `BITCODE_SPEC_V37.md`, DELTA, NOTES, PARITY, `BITCODE_SPEC.txt`, branch `v37/gate-1-conversations-roadmap-opening` | drafted | V37 family validates in draft mode over active V36 and `check:v37-gate1` passes. |
6477
| Roadmap truth | Gate 1 | `SPECIFICATIONS_ROADMAP.md`, README, PR template, workflow posture | drafted | Roadmap states V36 active, V37 draft, and coherent post-V37 responsibility. |
6578
| Conversation session and route history | Gate 2 | `ConversationSession`, `.bitcode/v37-conversation-session-route-history.json`, package source, route contracts, tests, and `check:v37-gate2` | closed | Route-local identity, route-local history, restore, branch, retry, redaction, stream, and proof roots are typed and source-safe. |
66-
| Conversation stream events | Gate 3 | future `ConversationStreamEvent`, stream UI tests, telemetry hooks, and `check:v37-gate3` | pending | Model deltas, tool calls, retrieval summaries, completion decisions, retry/error states, proof roots, and expanded metadata are source-safe. |
79+
| Conversation stream events | Gate 3 | `ConversationStreamEvent`, `.bitcode/v37-conversation-stream-event-contract.json`, route-attached SSE metadata, stream UI tests, telemetry hooks, and `check:v37-gate3` | closed | Model deltas, tool calls, retrieval summaries, completion decisions, retry/error states, proof roots, collapsed readable status, expanded metadata, and disclosure posture are source-safe. |
6780
| Writing workspace | Gate 4 | future `ConversationWritingWorkspace`, fullscreen route tests, accessibility proof, and `check:v37-gate4` | pending | Read Request, Need feedback, AssetPack review notes, and Terminal handoff writing flows are accessible, restorable, and source-safe. |
6881
| Source selectors | Gate 5 | future `ConversationSourceSelector`, policy tests, rights checks, and `check:v37-gate5` | pending | Repository, branch, commit, deposit, BTD range, AssetPack preview, document, and prior conversation selectors are policy-gated. |
6982
| Terminal handoff | Gate 6 | future `ConversationTerminalHandoff`, Terminal integration tests, and `check:v37-gate6` | pending | Conversations can hand source-safe transaction intent to Terminal without becoming a parallel ledger/wallet authority. |
@@ -85,6 +98,8 @@ No `_legacy/` source is active source truth.
8598
| Package docs | README, protocol package README, demonstration README, and PR template state V36 active / V37 draft workflow | drafted |
8699
| Conversations vocabulary | V37 spec family names `ConversationSession`, `ConversationMessage`, `ConversationStreamEvent`, `ConversationWritingWorkspace`, `ConversationSourceSelector`, and `ConversationTerminalHandoff` | drafted |
87100
| ConversationSession route-history artifact | `ConversationSession` source emits `.bitcode/v37-conversation-session-route-history.json` and `check:v37-gate2` validates it | closed |
101+
| ConversationStreamEvent artifact | `ConversationStreamEvent` source emits `.bitcode/v37-conversation-stream-event-contract.json` and `check:v37-gate3` validates it | closed |
102+
| ConversationStreamEvent event coverage | `source-safe-conversation-stream-event-metadata` covers model deltas, tool calls, retrieval summaries, proof roots, retry states, completion decisions, and error rows | closed |
88103
| Disclosure boundary | Conversations expose source-safe stream, selector, proof, handoff, and policy metadata, not protected source, secrets, wallet private material, or unpaid AssetPack contents | drafted |
89104
| Terminal handoff boundary | Terminal remains the transaction cockpit and ledger/wallet authority; Conversations prepare and hand off source-safe intent | drafted |
90105
| Privacy posture | Conversation persistence, export, delete, retention, replay, and repair paths preserve disclosure classes and redaction policy | drafted |

0 commit comments

Comments
 (0)