This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
token-gated-economy/artifacts/api-server
alexpaynex 6f059daa8c fix(#14,#16): stub mode for executeWorkStreaming + SSE race condition
Fix #14 — AgentService stub mode for executeWorkStreaming:
- Remove static import of @workspace/integrations-anthropic-ai (throws on
  module load when env vars absent)
- Add STUB_MODE detection at startup using AI_INTEGRATIONS_ANTHROPIC_API_KEY
  and AI_INTEGRATIONS_ANTHROPIC_BASE_URL presence
- Lazy getClient() uses dynamic import, only called in live mode
- stub executeWork() and executeWorkStreaming() return canned responses;
  streaming stub emits word-by-word with 40 ms delay to exercise SSE path
- Define local AnthropicLike interface — no dependency on @anthropic-ai/sdk
  types or unbuilt integrations-anthropic-ai dist

Fix #16 — SSE stream registry race condition:
- After bus-listener wait, refresh BOTH stream registry AND job state from DB
- If job completed while waiting (stream already gone), replay full result
  immediately instead of emitting 'Stream not available' error
- Increase wait timeout from 60 s to 90 s for mainnet payment latency
- Cleaner event bus filter: any jobId event resolves the wait (not just
  job:state and job:paid) so job:completed also unblocks waiting clients
- Named branches with comments for each resolution path

Fix pre-existing typecheck errors (bonus):
- event-bus.ts: EventEmitter overload uses any[] not unknown[]
- testkit.ts: escape bash ${ELAPSED_T14} in TS template literal
2026-03-18 22:32:53 +00:00
..
2026-03-13 23:21:55 +00:00