@fairfox/polly 0.12.0 → 0.12.2
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.
|
@@ -1,5 +1,85 @@
|
|
|
1
|
+
import type { Signal } from "@preact/signals-core";
|
|
2
|
+
import { Elysia } from "elysia";
|
|
1
3
|
import type { PollyConfig } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Broadcast message sent to connected clients
|
|
6
|
+
*/
|
|
7
|
+
interface BroadcastMessage {
|
|
8
|
+
type: "effect";
|
|
9
|
+
path: string;
|
|
10
|
+
method: string;
|
|
11
|
+
result: unknown;
|
|
12
|
+
clock: {
|
|
13
|
+
tick: number;
|
|
14
|
+
contextId: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Minimal WebSocket interface for broadcasting
|
|
19
|
+
*/
|
|
20
|
+
interface MinimalWebSocket {
|
|
21
|
+
readyState: number;
|
|
22
|
+
send(data: string): void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* WebSocket broadcast manager
|
|
26
|
+
*/
|
|
27
|
+
declare class BroadcastManager {
|
|
28
|
+
private connections;
|
|
29
|
+
register(clientId: string, ws: MinimalWebSocket): void;
|
|
30
|
+
unregister(clientId: string): void;
|
|
31
|
+
broadcast(message: BroadcastMessage, filter?: (clientId: string) => boolean): void;
|
|
32
|
+
}
|
|
2
33
|
/**
|
|
3
34
|
* Main Polly Elysia plugin
|
|
4
35
|
*/
|
|
5
|
-
export declare function polly(config?: PollyConfig):
|
|
36
|
+
export declare function polly(config?: PollyConfig): Elysia<"", {
|
|
37
|
+
decorator: {
|
|
38
|
+
pollyState: {
|
|
39
|
+
client: Record<string, Signal<unknown>>;
|
|
40
|
+
server: Record<string, Signal<unknown>>;
|
|
41
|
+
};
|
|
42
|
+
} & {
|
|
43
|
+
pollyClock: import("../core/clock").LamportClockOps;
|
|
44
|
+
} & {
|
|
45
|
+
pollyBroadcast: BroadcastManager;
|
|
46
|
+
};
|
|
47
|
+
store: {};
|
|
48
|
+
derive: {};
|
|
49
|
+
resolve: {};
|
|
50
|
+
}, {
|
|
51
|
+
typebox: {};
|
|
52
|
+
error: {};
|
|
53
|
+
}, {
|
|
54
|
+
schema: {};
|
|
55
|
+
standaloneSchema: {};
|
|
56
|
+
macro: {};
|
|
57
|
+
macroFn: {};
|
|
58
|
+
parser: {};
|
|
59
|
+
response: {};
|
|
60
|
+
}, {
|
|
61
|
+
[x: string]: {
|
|
62
|
+
subscribe: {
|
|
63
|
+
body: unknown;
|
|
64
|
+
params: {};
|
|
65
|
+
query: unknown;
|
|
66
|
+
headers: unknown;
|
|
67
|
+
response: {};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
derive: {};
|
|
72
|
+
resolve: {};
|
|
73
|
+
schema: {};
|
|
74
|
+
standaloneSchema: {};
|
|
75
|
+
response: {};
|
|
76
|
+
}, {
|
|
77
|
+
derive: {};
|
|
78
|
+
resolve: {};
|
|
79
|
+
schema: {};
|
|
80
|
+
standaloneSchema: {};
|
|
81
|
+
response: {
|
|
82
|
+
200: Response;
|
|
83
|
+
};
|
|
84
|
+
}>;
|
|
85
|
+
export {};
|
|
@@ -1948,7 +1948,7 @@ class DockerRunner {
|
|
|
1948
1948
|
`${specName}.tla`
|
|
1949
1949
|
];
|
|
1950
1950
|
const result = await this.runCommand("docker", args, {
|
|
1951
|
-
timeout: options?.timeout
|
|
1951
|
+
timeout: options?.timeout
|
|
1952
1952
|
});
|
|
1953
1953
|
return this.parseTLCOutput(result);
|
|
1954
1954
|
}
|
|
@@ -2029,7 +2029,7 @@ class DockerRunner {
|
|
|
2029
2029
|
const timeoutValue = options?.timeout ?? 0;
|
|
2030
2030
|
const timeout = timeoutValue > 0 ? setTimeout(() => {
|
|
2031
2031
|
proc.kill();
|
|
2032
|
-
reject(new Error(`Command timed out after ${Math.floor(timeoutValue / 1000)}s. TLC was still making progress. Consider increasing the timeout or
|
|
2032
|
+
reject(new Error(`Command timed out after ${Math.floor(timeoutValue / 1000)}s. TLC was still making progress. Consider increasing the timeout or setting timeout: 0 for no timeout.`));
|
|
2033
2033
|
}, timeoutValue) : null;
|
|
2034
2034
|
proc.on("close", (exitCode) => {
|
|
2035
2035
|
if (timeout)
|
|
@@ -2457,22 +2457,6 @@ class ConfigGenerator {
|
|
|
2457
2457
|
this.line("//");
|
|
2458
2458
|
this.line("onRelease: 'error',");
|
|
2459
2459
|
this.line("");
|
|
2460
|
-
this.line("// Verification options (optional)");
|
|
2461
|
-
this.line("// ─────────────────────");
|
|
2462
|
-
this.line("//");
|
|
2463
|
-
this.line("// Presets provide quick configuration:");
|
|
2464
|
-
this.line("// • 'quick': 1 minute timeout, 1 worker");
|
|
2465
|
-
this.line("// • 'balanced': 5 minutes timeout, 2 workers (default)");
|
|
2466
|
-
this.line("// • 'thorough': No timeout, 4 workers");
|
|
2467
|
-
this.line("//");
|
|
2468
|
-
this.line("// Or customize with verification options:");
|
|
2469
|
-
this.line("// verification: {");
|
|
2470
|
-
this.line("// timeout: 300, // Timeout in seconds (0 = no timeout)");
|
|
2471
|
-
this.line("// workers: 2, // Number of TLC workers");
|
|
2472
|
-
this.line("// }");
|
|
2473
|
-
this.line("//");
|
|
2474
|
-
this.line("// preset: 'balanced',");
|
|
2475
|
-
this.line("");
|
|
2476
2460
|
this.line("// ─────────────────────────────────────────────────────────");
|
|
2477
2461
|
this.line("// Tier 2 Optimizations (controlled approximations) - ADVANCED");
|
|
2478
2462
|
this.line("// ─────────────────────────────────────────────────────────");
|
|
@@ -5068,36 +5052,10 @@ Stack trace:`, COLORS.gray));
|
|
|
5068
5052
|
}
|
|
5069
5053
|
}
|
|
5070
5054
|
function getTimeout(config) {
|
|
5071
|
-
|
|
5072
|
-
return config.verification.timeout;
|
|
5073
|
-
}
|
|
5074
|
-
const preset = config.preset || "balanced";
|
|
5075
|
-
switch (preset) {
|
|
5076
|
-
case "quick":
|
|
5077
|
-
return 300;
|
|
5078
|
-
case "balanced":
|
|
5079
|
-
return 900;
|
|
5080
|
-
case "thorough":
|
|
5081
|
-
return 0;
|
|
5082
|
-
default:
|
|
5083
|
-
return 900;
|
|
5084
|
-
}
|
|
5055
|
+
return config.verification?.timeout ?? 0;
|
|
5085
5056
|
}
|
|
5086
5057
|
function getWorkers(config) {
|
|
5087
|
-
|
|
5088
|
-
return config.verification.workers;
|
|
5089
|
-
}
|
|
5090
|
-
const preset = config.preset || "balanced";
|
|
5091
|
-
switch (preset) {
|
|
5092
|
-
case "quick":
|
|
5093
|
-
return 1;
|
|
5094
|
-
case "balanced":
|
|
5095
|
-
return 2;
|
|
5096
|
-
case "thorough":
|
|
5097
|
-
return 4;
|
|
5098
|
-
default:
|
|
5099
|
-
return 2;
|
|
5100
|
-
}
|
|
5058
|
+
return config.verification?.workers ?? 1;
|
|
5101
5059
|
}
|
|
5102
5060
|
async function runFullVerification(configPath) {
|
|
5103
5061
|
const config = await loadVerificationConfig(configPath);
|
|
@@ -5338,4 +5296,4 @@ main().catch((error) => {
|
|
|
5338
5296
|
process.exit(1);
|
|
5339
5297
|
});
|
|
5340
5298
|
|
|
5341
|
-
//# debugId=
|
|
5299
|
+
//# debugId=1B51E02C2E7CEC9764756E2164756E21
|