Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "bun run --cwd packages/tauri-release build && bun run --cwd packages/auth build && bun run --cwd packages/brand build && bun run --cwd packages/flags build && bun run --cwd packages/billing build && bun run --cwd packages/edge-shared build && bun run --cwd packages/sync build",
"test": "vitest run",
"test:supabase": "supabase test db supabase/tests/database --local && bun run supabase/tests/welcome-credits-concurrency.ts && bun test packages/billing/test/checkout-lifecycle.contract.test.ts && bun test packages/sync/test/lww.contract.test.ts",
"test:supabase": "supabase test db supabase/tests/database --local && bun run supabase/tests/welcome-credits-concurrency.ts && bun test packages/billing/test/checkout-lifecycle.contract.test.ts && bun test packages/sync/test/lww.contract.test.ts && bun test packages/edge-shared/test/router-attempt.contract.test.ts",
"test:coverage": "vitest run --coverage",
"typecheck": "tsc -p tsconfig.json --noEmit",
"check": "bun run typecheck && bun run test && bun run test:coverage && bun run build"
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pickforge/auth",
"version": "0.11.0",
"version": "0.12.0",
"description": "UI-free Supabase Auth and entitlements wrapper for Pickforge apps.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/billing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pickforge/billing",
"version": "0.11.0",
"version": "0.12.0",
"description": "UI-free Stripe billing and credit-ledger helpers for Pickforge apps.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/brand/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pickforge/brand",
"version": "0.11.0",
"version": "0.12.0",
"description": "Pickforge CSS tokens, fonts, reset, and primitives.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/edge-shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Deno-compatible helpers for Pickforge Edge Functions. Clients are injected struc

`assertRouteRequest` accepts only the hosted-router wire shape: `commandText` plus optional `context.projectName`, `context.chatNames`, and `context.widgetLabels`. Command text is user-authored and passed through unchanged; attached context is guarded against paths, host identifiers, tailnet IPs, and long serial-like tokens with `boundary_violation`.

`createOperatorRouterHandler` composes bearer-token authentication, request boundary validation, idempotent credit debiting, and an injected chat completion. A replayed idempotency key returns its stored proposal without another model call.
`createOperatorRouterHandler` composes bearer-token authentication, request boundary validation, a durable pre-provider claim, idempotent credit debiting, and an injected chat completion. Router work is durably claimed (`claimRouteAttempt`) BEFORE the provider is invoked, so at most one caller ever calls the provider and debits for a given idempotency key; `completeRouteAttempt`/`failRouteAttempt` record the outcome, and a stale (lease-expired) claim is recoverable by a later caller. A replayed, already-debited idempotency key returns its stored proposal (`findDebitedRouteResult`, honoring rows written before the durable claim table existed) without another model call.

Hosted routing is limited to 10 uncached attempts per user in each 10-second window. Its responses are `200` with a proposal, `402` for insufficient credits, `429` for `rate_limited`, boundary/auth `4xx`, and `5xx` for server or provider failures.
Hosted routing is limited to 10 uncached attempts per user in each 10-second window. Its responses are `200` with a proposal, `402` for insufficient credits, `409` for `attempt_in_progress` (another live claim owns this key right now; retry), `429` for `rate_limited`, boundary/auth `4xx`, and `5xx` for server or provider failures.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion packages/edge-shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pickforge/edge-shared",
"version": "0.11.0",
"version": "0.12.0",
"description": "Deno-compatible shared helpers for Pickforge Edge Functions.",
"license": "MIT",
"repository": {
Expand Down
Loading