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
Implement session-based API endpoints for creating, managing, and interacting with pre-funded sessions, including deposit and top-up invoice generation, macaroon authentication, and per-request debiting of compute costs.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 2dc3847e-7186-4a22-9c7e-16cd31bca8d9
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/9f85e954-647c-46a5-90a7-396e495a805a/418bf6f8-212b-4bb0-a7a5-8231a061da4e/sPDHkg8
Replit-Helium-Checkpoint-Created: true
Integrate a new testkit endpoint and update package.json scripts to enable automated testing via `pnpm test` and `pnpm test:prod`, including a new test case for request body size limits.
Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 418bf6f8-212b-4bb0-a7a5-8231a061da4e
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: 60472e18-59b7-4877-a9a2-16381573ab68
Replit-Helium-Checkpoint-Created: true