Skip to content

feat: add cljs transcription restart policy#20

Merged
meekmachine merged 1 commit into
mainfrom
codex/polyester-cljs-transcription-policy
May 28, 2026
Merged

feat: add cljs transcription restart policy#20
meekmachine merged 1 commit into
mainfrom
codex/polyester-cljs-transcription-policy

Conversation

@meekmachine

Copy link
Copy Markdown
Owner

Summary

  • add CLJS transcription restart, stop, and cleanup recommendations as serializable agency outputs
  • route transcription recommendations through the runtime host callback and public typings
  • extend CLJS smoke coverage for restart, cleanup, and max-restart stop behavior

Validation

  • npm run test:cljs
  • npm run typecheck
  • npm test
  • npm run build

Refs #13
Refs #15

@meekmachine meekmachine merged commit e5befac into main May 28, 2026
4 checks passed
@meekmachine meekmachine deleted the codex/polyester-cljs-transcription-policy branch May 28, 2026 04:17
@meekmachine

Copy link
Copy Markdown
Owner Author

Architecture follow-up: CLJS transcription restart/cleanup policy

This PR is part of the Polyester CLJS transition, but it is not a full replacement of the browser transcription service by itself. The important change is that transcription restart and cleanup decisions now live in the CLJS agency as serializable data instead of being hidden in an imperative service/timer path.

What is written in CLJS here

  • src-cljs/latticework/transcription.cljs

    • Adds autoRestart, restartDelayMs, and maxRestartCount to the CLJS transcription config.
    • Adds reducer-owned state for restartCount, lastRestartReason, pendingRestart, lastRecommendation, and error.
    • Emits explicit transcriptionRecommendation outputs for:
      • RESTART after recoverable transcription failure.
      • STOP when the restart limit is reached or restart policy is disabled.
      • CLEANUP when the host should clear pending browser resources / cancel restart work.
    • Keeps transcript normalization, echo filtering, interruption latch/release, and final interrupted transcript routing inside the CLJS planner.
  • src-cljs/latticework/runtime.cljs

    • Routes the new transcriptionRecommendation output to host.onTranscriptionRecommendation.
    • This keeps browser effects at the host edge while the planner emits plain data.
  • types/cljs.d.ts

    • Documents the JS-facing CLJS contract for transcription recommendations and the expanded state snapshot.

Why this matters architecturally

The browser still owns SpeechRecognition, microphone streams, AudioContext, analyser nodes, and restart timers. That is intentional: those are host/browser effects and should not be inside worker-safe CLJS state.

The CLJS agency now owns the policy decision: whether the host should restart, stop, or clean up. That moves the decision into the serializable planner layer, which is the direction we want for Polyester.

What this does not solve yet

This PR does not create the final Most/Effect stream architecture. The output still flows through outputs arrays and runtime host callbacks. A later runtime-bus PR should expose those same CLJS outputs as streams such as output$, state$, and agencyState$("transcription"), then LoomLarge can bridge those into Effect-managed app/profile state.

Validation added

  • CLJS smoke covers normal interruption/final transcript flow.
  • CLJS smoke covers restart recommendation after failure.
  • CLJS smoke covers cleanup recommendation on stop.
  • CLJS smoke covers max-restart stop recommendation.
  • Full validation at merge: npm run test:cljs, npm run typecheck, npm test, npm run build.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant