@company-semantics/contracts 0.141.0 → 0.142.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/timeouts.ts +27 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/timeouts.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeout ladder (PRD-00491).
|
|
3
|
+
*
|
|
4
|
+
* Per-tier hard timeout ceilings shared by every enforcement layer:
|
|
5
|
+
* client fetch, scheduler, backend handler, DB query. Backend and app
|
|
6
|
+
* import from here so the ladder cannot drift between layers.
|
|
7
|
+
*
|
|
8
|
+
* Extends PRD-00486 (backend query timeouts) and PRD-00487 (client fetch
|
|
9
|
+
* timeouts) into a single coherent ladder. Per-intent DB budgets in
|
|
10
|
+
* `company-semantics-backend/src/db/query-intent.ts` are derived from
|
|
11
|
+
* these ceilings (feedback_derive_dont_duplicate).
|
|
12
|
+
*
|
|
13
|
+
* Tiers: P0 = user-blocking, P1 = interactive, P2 = background,
|
|
14
|
+
* P3 = bulk. See `./requests#Tier` for the canonical tier definition.
|
|
15
|
+
*/
|
|
16
|
+
import type { Tier } from './requests';
|
|
17
|
+
|
|
18
|
+
export const TIMEOUT_LADDER_MS: Record<Tier, number> = {
|
|
19
|
+
P0: 2_000,
|
|
20
|
+
P1: 5_000,
|
|
21
|
+
P2: 8_000,
|
|
22
|
+
P3: 15_000,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export function getTimeoutForTier(tier: Tier): number {
|
|
26
|
+
return TIMEOUT_LADDER_MS[tier];
|
|
27
|
+
}
|