@pie-players/pie-calculator-cortex 0.3.73 → 0.3.75
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/dist/assets/{evaluation-worker-DWuBeWOk.js → evaluation-worker-CORp9m0K.js} +104152 -64216
- package/dist/chunks/{runtime-DWXykAg0.js → compute-engine--6mXOR7C.js} +116217 -123945
- package/dist/chunks/mathlive-RSoc75Wx.js +42666 -0
- package/dist/chunks/runtime-wcU7KOFU.js +5169 -0
- package/dist/chunks/{src-D05hiMPJ.js → src-BcptuNS5.js} +3691 -5876
- package/dist/index.js +1 -1
- package/dist/src/evaluation-client.d.ts +11 -1
- package/dist/src/module-worker.d.ts +11 -0
- package/dist/src/settings.d.ts +0 -1
- package/dist/src/worker-protocol.d.ts +5 -0
- package/package.json +13 -13
- package/dist/src/CalculatorView.svelte.d.ts +0 -1
- package/dist/src/GraphView.svelte.d.ts +0 -1
- package/dist/src/Icon.svelte.d.ts +0 -1
- package/dist/src/Keypad.svelte.d.ts +0 -1
- package/dist/src/MathFieldInput.svelte.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var h = class {
|
|
|
26
26
|
async createCalculator(e, r, s = {}) {
|
|
27
27
|
if (this.initialized || await this.initialize(), !this.supportsType(e)) throw new t("unsupported-expression", `Cortex does not support calculator type: ${e}.`);
|
|
28
28
|
if (!(r instanceof HTMLElement)) throw new t("invalid-state", "A valid HTML container is required.");
|
|
29
|
-
const o = l(e, s), { createCortexCalculator: a } = await import("./chunks/runtime-
|
|
29
|
+
const o = l(e, s), { createCortexCalculator: a } = await import("./chunks/runtime-wcU7KOFU.js"), i = a(this, r, o, this.onTelemetry, (n) => this.instances.delete(n));
|
|
30
30
|
return this.instances.add(i), i;
|
|
31
31
|
}
|
|
32
32
|
supportsType(e) {
|
|
@@ -3,19 +3,29 @@ import { CortexGraphViewport } from './types.js';
|
|
|
3
3
|
import { EvaluationResult, SampledSeries } from './worker-protocol.js';
|
|
4
4
|
export declare class EvaluationClient {
|
|
5
5
|
private settings;
|
|
6
|
+
private readonly startupLimitMs;
|
|
6
7
|
private worker;
|
|
8
|
+
private workerReady;
|
|
9
|
+
private startupTimer;
|
|
7
10
|
private readonly pending;
|
|
8
11
|
private readonly instanceId;
|
|
9
12
|
private nextRequestId;
|
|
10
13
|
private generation;
|
|
11
14
|
private destroyed;
|
|
12
|
-
constructor(settings: ResolvedCortexSettings);
|
|
15
|
+
constructor(settings: ResolvedCortexSettings, startupLimitMs?: number);
|
|
13
16
|
updateSettings(settings: ResolvedCortexSettings): void;
|
|
14
17
|
private workerSettings;
|
|
15
18
|
private ensureWorker;
|
|
16
19
|
private readonly handleMessage;
|
|
20
|
+
private handleReady;
|
|
21
|
+
private startRequestTimer;
|
|
17
22
|
private readonly handleWorkerError;
|
|
18
23
|
private resetWorker;
|
|
24
|
+
/**
|
|
25
|
+
* Starts the worker ahead of the first request, so the learner's typing covers
|
|
26
|
+
* its cold start. A worker that cannot be created is reported by that request.
|
|
27
|
+
*/
|
|
28
|
+
start(): void;
|
|
19
29
|
private request;
|
|
20
30
|
evaluate(latex: string): Promise<EvaluationResult>;
|
|
21
31
|
sample(expressions: Array<{
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type ModuleWorkerConstructor = new (url: URL, options: WorkerOptions) => Worker;
|
|
2
|
+
/**
|
|
3
|
+
* Builds a module worker with the page-origin handling above.
|
|
4
|
+
*
|
|
5
|
+
* `construct` receives the constructor as a parameter named `Worker`, and
|
|
6
|
+
* the name has to stay: Vite finds a worker to bundle by the text
|
|
7
|
+
* `new Worker(new URL("./file", import.meta.url)`, so renaming it ships the
|
|
8
|
+
* worker's TypeScript source as an asset.
|
|
9
|
+
*/
|
|
10
|
+
export declare function startModuleWorker(construct: (Worker: ModuleWorkerConstructor) => Worker): Worker;
|
|
11
|
+
export {};
|
package/dist/src/settings.d.ts
CHANGED
|
@@ -26,4 +26,3 @@ export interface ResolvedCortexSettings {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
export declare function resolveCortexSettings(type: CalculatorType, config?: CortexCalculatorProviderConfig): ResolvedCortexSettings;
|
|
29
|
-
export declare function isCortexFunctionId(value: unknown): value is CortexFunctionId;
|
|
@@ -55,4 +55,9 @@ export type WorkerResponse = (WorkerEnvelope & {
|
|
|
55
55
|
kind: "error";
|
|
56
56
|
error: SerializedCortexError;
|
|
57
57
|
});
|
|
58
|
+
/** Posted once, when the worker's module has run and it takes requests. */
|
|
59
|
+
export interface WorkerReadyMessage {
|
|
60
|
+
protocolVersion: typeof CORTEX_WORKER_PROTOCOL_VERSION;
|
|
61
|
+
kind: "ready";
|
|
62
|
+
}
|
|
58
63
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-calculator-cortex",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.75",
|
|
4
4
|
"description": "Fully bundled open-source calculator provider for PIE assessment tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"test": "bun test tests",
|
|
23
23
|
"test:corpus": "bun scripts/build-expression-corpus.mjs --full --out .corpus/gsm8k-arithmetic.json && CORTEX_CORPUS=.corpus/gsm8k-arithmetic.json bun test tests/calculator-cortex-corpus.test.ts",
|
|
24
24
|
"test:e2e": "bun run build && bunx playwright test --config playwright.config.ts",
|
|
25
|
-
"typecheck": "tsc --noEmit && tsc -p tsconfig.demo.json",
|
|
25
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.demo.json && tsc -p tsconfig.tests.json",
|
|
26
26
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
27
|
-
"lint": "biome
|
|
27
|
+
"lint": "biome lint ."
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"pie",
|
|
@@ -47,21 +47,21 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@pie-players/pie-calculator": "0.3.73",
|
|
52
|
-
"jsxgraph": "1.13.2",
|
|
53
|
-
"mathlive": "0.110.0"
|
|
50
|
+
"@pie-players/pie-calculator": "0.3.75"
|
|
54
51
|
},
|
|
55
52
|
"devDependencies": {
|
|
56
53
|
"@axe-core/playwright": "^4.13.0",
|
|
57
|
-
"@biomejs/biome": "^2.5.
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"svelte": "^
|
|
54
|
+
"@biomejs/biome": "^2.5.15",
|
|
55
|
+
"@cortex-js/compute-engine": "0.147.0",
|
|
56
|
+
"@playwright/test": "^1.63.0",
|
|
57
|
+
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
58
|
+
"jsxgraph": "1.13.3",
|
|
59
|
+
"mathlive": "0.111.0",
|
|
60
|
+
"svelte": "^5.57.1",
|
|
61
61
|
"svelte-check": "^4.7.6",
|
|
62
62
|
"typescript": "^5.9.3",
|
|
63
|
-
"vite": "^8.
|
|
64
|
-
"vite-plugin-dts": "^5.
|
|
63
|
+
"vite": "^8.3.2",
|
|
64
|
+
"vite-plugin-dts": "^5.1.2"
|
|
65
65
|
},
|
|
66
66
|
"sideEffects": false,
|
|
67
67
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/calculator-cortex#readme",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { SvelteComponent as default } from 'svelte';
|