@tangle-network/agent-app 0.60.148 → 0.60.150

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.
@@ -15,14 +15,21 @@
15
15
  * turns the cache off for a context with any route. In 0.60.141 a route that
16
16
  * aborted the speculation rules did that, and every page reload re-downloaded
17
17
  * every asset (creative production smoke: 1900 requests, busiest 10 s 373);
18
- * - count every request a context makes and wait before a navigation whenever
19
- * the last 10 s already holds `REQUEST_BUDGET_PER_10S`;
18
+ * - count only requests that reach the network: Playwright's `request` event
19
+ * also fires for responses served from the browser's own cache, so 0.60.148
20
+ * counted a cached bundle as an edge request and its totals never moved when
21
+ * the cache worked (creative smoke: ~1900 before and after immutable assets).
22
+ * `meterPage` reads Chromium's `Network.responseReceived` and skips
23
+ * disk-cache, prefetch-cache and service-worker responses; a 304 still counts,
24
+ * because a revalidation does reach the edge;
25
+ * - wait before a navigation whenever the last 10 s already holds
26
+ * `REQUEST_BUDGET_PER_10S`;
20
27
  * - report the total and the busiest 10 s, and exit `NETWORK_OVER_BUDGET_EXIT`
21
28
  * when the busiest 10 s went over the budget, so an over-budget run fails
22
29
  * instead of passing with a note. One page load can't be paced from outside
23
30
  * the page, so the exit code is the enforcement.
24
31
  */
25
- import type { BrowserContext } from 'playwright';
32
+ import type { Page } from 'playwright';
26
33
  /** Chromium flags that stop prerender and speculative prefetch of linked pages. */
27
34
  export declare const QUIET_CHROMIUM_ARGS: readonly string[];
28
35
  /** Requests per 10 s a check may send; a quarter of the shared zone limit. */
@@ -41,8 +48,20 @@ export interface RequestMeter {
41
48
  count(): NetworkCount;
42
49
  }
43
50
  export declare function createRequestMeter(budget?: number, sleep?: (ms: number) => Promise<void>): RequestMeter;
44
- /** Count every request the context sends. Never add a route here: it would turn off the HTTP cache. */
45
- export declare function meterContext(context: BrowserContext, meter: RequestMeter): Promise<void>;
51
+ /** The fields of Chromium's `Network.responseReceived` that say where a response came from. */
52
+ export interface CdpResponseSource {
53
+ readonly fromDiskCache?: boolean;
54
+ readonly fromPrefetchCache?: boolean;
55
+ readonly fromServiceWorker?: boolean;
56
+ }
57
+ /** True when a response was fetched over the network, so the edge saw the request. */
58
+ export declare function reachedNetwork(response: CdpResponseSource): boolean;
59
+ /**
60
+ * Count the requests a page sends to the network (Chromium only). Call it before
61
+ * the page's first navigation. Never add a route instead: Playwright turns the
62
+ * HTTP cache off for any context with a route.
63
+ */
64
+ export declare function meterPage(page: Page, meter: RequestMeter): Promise<void>;
46
65
  /** Exit code of a check whose pages passed but whose busiest 10 s went over the budget. */
47
66
  export declare const NETWORK_OVER_BUDGET_EXIT = 3;
48
67
  export declare function isOverBudget(count: NetworkCount, budget?: number): boolean;
@@ -6,7 +6,7 @@ import {
6
6
  runSignoff,
7
7
  runSurfaceLadderCli,
8
8
  runWorkspaceSurfaceCli
9
- } from "../chunk-WXS2VQMQ.js";
9
+ } from "../chunk-KDPTXXOQ.js";
10
10
  import {
11
11
  invokedAsScript
12
12
  } from "../chunk-C3CAYGGQ.js";
@@ -59,6 +59,6 @@ export { checkSurfaceLadder, collectSurfaceLadder, composite, contrastRatio, for
59
59
  export { parseSurfaceLadderArgs, runSurfaceLadderCli } from './surface-ladder-cli';
60
60
  export { checkWorkspaceSurface, collectWorkspaceSurface, formatWorkspaceSurfaceReport, judgeWorkspaceSurface, HEADER_TOP_TOLERANCE_PX, type WorkspaceSurfaceFinding, type WorkspaceSurfaceOptions, type WorkspaceSurfaceReport, type WorkspaceSurfaceSample, } from './workspace-surface';
61
61
  export { runWorkspaceSurfaceCli } from './workspace-surface-cli';
62
- export { createRequestMeter, formatNetworkCount, isOverBudget, meterContext, NETWORK_OVER_BUDGET_EXIT, networkExitCode, QUIET_CHROMIUM_ARGS, REQUEST_BUDGET_PER_10S, type NetworkCount, type RequestMeter, } from './browser-budget';
62
+ export { createRequestMeter, formatNetworkCount, isOverBudget, meterPage, reachedNetwork, NETWORK_OVER_BUDGET_EXIT, networkExitCode, QUIET_CHROMIUM_ARGS, REQUEST_BUDGET_PER_10S, type CdpResponseSource, type NetworkCount, type RequestMeter, } from './browser-budget';
63
63
  export { checkWorkerDefaults, formatWorkerDefaults, WORKER_COMPATIBILITY_DATE_FLOOR, type WorkerDefaultsFinding, type WorkerDefaultsResult, } from './worker-defaults';
64
64
  export type { LoadedSignoffConfig, SignoffAttempt, SignoffConfig, SignoffConfigOrigin, SignoffEvent, SignoffHostFacts, SignoffInstallResult, SignoffInstallSpec, SignoffRepoFacts, SignoffReport, SignoffShuffleSpec, SignoffSource, SignoffStepResult, SignoffStepSpec, SignoffStepStatus, } from './types';
@@ -29,18 +29,19 @@ import {
29
29
  judgeSurfaceLadder,
30
30
  judgeWorkspaceSurface,
31
31
  loadSignoffConfig,
32
- meterContext,
32
+ meterPage,
33
33
  networkExitCode,
34
34
  oklchL,
35
35
  parseShellAlignmentArgs,
36
36
  parseSurfaceLadderArgs,
37
+ reachedNetwork,
37
38
  runShellAlignmentCli,
38
39
  runSignoff,
39
40
  runSurfaceLadderCli,
40
41
  runWorkspaceSurfaceCli,
41
42
  summarizeSurfacePage,
42
43
  surfaceDeltaL
43
- } from "../chunk-WXS2VQMQ.js";
44
+ } from "../chunk-KDPTXXOQ.js";
44
45
  export {
45
46
  HEADER_TOP_TOLERANCE_PX,
46
47
  NETWORK_OVER_BUDGET_EXIT,
@@ -72,11 +73,12 @@ export {
72
73
  judgeSurfaceLadder,
73
74
  judgeWorkspaceSurface,
74
75
  loadSignoffConfig,
75
- meterContext,
76
+ meterPage,
76
77
  networkExitCode,
77
78
  oklchL,
78
79
  parseShellAlignmentArgs,
79
80
  parseSurfaceLadderArgs,
81
+ reachedNetwork,
80
82
  runShellAlignmentCli,
81
83
  runSignoff,
82
84
  runSurfaceLadderCli,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.60.148",
3
+ "version": "0.60.150",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [