Skip to content

Commit c068a49

Browse files
committed
sync(bfmono): fix(gambit): restore simulator-ui dnt react typecheck (+19 more) (bfmono@3a995b3ba)
This PR is an automated gambitmono sync of bfmono Gambit packages. - Source: `packages/gambit/` - Core: `packages/gambit/packages/gambit-core/` - bfmono rev: 3a995b3ba Changes: - 3a995b3ba fix(gambit): restore simulator-ui dnt react typecheck - 715b43ad5 fix(gambit-publish): pin JSX runtime specifier for JSR canary publish - ecfc74407 fix(gambit-ci): rewrite core imports for isolated publish parity dry-run - 4cfe995c4 fix(gambit-ci): run publish dry-run in isolated package copy - 20313b751 fix(ci): restore gambit mirror auto-merge and gate binary dispatch by new tags - 5aa44451e ci(gambit): add publish dry-run to downstream parity suite - 48acb857f fix(gambit): include simulator-ui in JSR publish scope - ad689b6e3 fix(gambit): align parity check with in-repo gambit-core and load lint plugin - a11118b73 fix(gambit): isolate gambit-core parity checks from bfmono workspace context - 9924f0252 pin nix v - 2f7f91c35 fix(gambit): run downstream CI parity checks in bfmono - 9a2fff377 refactor(gambit-demo): reuse shared tab flows in full demo - 30c59197f docs(gambit): add verify-tab migration docs and parity checklist - 1bf42993d test(gambit): add verify demo and stabilize full demo flow - 8452a0505 feat(gambit): add Isograph Verify tab UI and typed client artifacts - 422f98b10 feat(gambit): add verify GraphQL schema and server operations - fcbcb09d9 test(gambit-demo): exercise grade flag toggle and reason edit flow - b8c0081bc refactor(simulator-ui): share legacy grade runner and center panels across legacy and isograph - a11973125 refactor(simulator-ui): reuse legacy grade runs header across legacy and isograph - 7cd05dfc2 chore(simulator-ui): remove unused grade tab view extension prop Do not edit this repo directly; make changes in bfmono and re-run the sync.
1 parent a954536 commit c068a49

10 files changed

Lines changed: 75 additions & 68 deletions

File tree

deno.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build_npm.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ try {
270270
}
271271
if (
272272
diagnostic.code === 2686 &&
273-
fileName.includes("/simulator-ui/src/")
273+
fileName.includes("/simulator-ui/")
274274
) {
275275
return false;
276276
}

simulator-ui/isograph/components/Query/SimulatorAppShell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { iso } from "@iso-gambit-sim";
2-
import type React from "react";
2+
import React from "react";
33
import { AppShell } from "../../../src/AppShell.tsx";
44

55
function WorkbenchUnavailable(_: { open: boolean }) {

simulator-ui/isograph/components/Query/SimulatorBuildContentShell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { iso } from "@iso-gambit-sim";
2-
import type React from "react";
2+
import React from "react";
33
import { AppShell } from "../../../src/AppShell.tsx";
44

55
function WorkbenchUnavailable(_: { open: boolean }) {

simulator-ui/src/ActivityTranscriptRows.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// deno-lint-ignore-file
22
import { assert, assertEquals } from "@std/assert";
3-
import type React from "react";
3+
import React from "react";
44
import TestRenderer, { act } from "npm:react-test-renderer@19.2.0";
55
import type { ReactTestInstance } from "npm:react-test-renderer@19.2.0";
66

simulator-ui/src/CopyBadge.tsx

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import { useCallback, useEffect, useRef, useState } from "react";
2+
import { classNames } from "./utils.ts";
3+
4+
type CopyBadgeProps = {
5+
label: string;
6+
displayValue?: string | null;
7+
copyValue?: string | null;
8+
className?: string;
9+
};
10+
11+
export function CopyBadge(props: CopyBadgeProps) {
12+
const { label, displayValue, copyValue, className } = props;
13+
const [copied, setCopied] = useState(false);
14+
const timeoutRef = useRef<
15+
ReturnType<typeof globalThis.setTimeout> | undefined
16+
>(
17+
undefined,
18+
);
19+
20+
useEffect(() => {
21+
return () => {
22+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
23+
};
24+
}, []);
25+
26+
const copyTarget = copyValue ?? displayValue;
27+
if (!copyTarget) return null;
28+
const text = displayValue ?? copyTarget;
29+
30+
const handleCopy = useCallback(async () => {
31+
try {
32+
if (navigator.clipboard?.writeText) {
33+
await navigator.clipboard.writeText(copyTarget);
34+
} else {
35+
const temp = document.createElement("textarea");
36+
temp.value = copyTarget;
37+
temp.style.position = "fixed";
38+
temp.style.opacity = "0";
39+
document.body.appendChild(temp);
40+
temp.select();
41+
document.execCommand("copy");
42+
document.body.removeChild(temp);
43+
}
44+
setCopied(true);
45+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
46+
timeoutRef.current = globalThis.setTimeout(() => setCopied(false), 1500);
47+
} catch {
48+
// ignore copy failures silently
49+
}
50+
}, [copyTarget]);
51+
52+
return (
53+
<button
54+
type="button"
55+
className={classNames("copy-badge", className, copied && "copied")}
56+
onClick={handleCopy}
57+
title={copied ? "Copied!" : `Click to copy ${label}`}
58+
>
59+
<span className="copy-label">{label}:</span>
60+
<code>{text}</code>
61+
{copied && <span className="copy-feedback">Copied</span>}
62+
</button>
63+
);
64+
}

simulator-ui/src/WorkspaceContext.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,10 @@ export function WorkspaceProvider(
292292
>(null);
293293
const pendingBuildTracesRef = useRef<Array<TraceEvent>>([]);
294294
const pendingBuildTraceRunIdRef = useRef<string | null>(null);
295-
const buildTraceFlushHandleRef = useRef<number | null>(null);
295+
const buildTraceFlushHandleRef = useRef<
296+
number | ReturnType<typeof globalThis.setTimeout> | null
297+
>(null);
296298
const buildTraceFlushModeRef = useRef<"raf" | "timeout" | null>(null);
297-
298299
const [testRun, setTestRun] = useState<TestBotRun>(() => normalizeTestRun());
299300
const [activeTestRunId, setActiveTestRunId] = useState<string | null>(null);
300301
const [activeGradeRunId, setActiveGradeRunId] = useState<string | null>(null);
@@ -343,7 +344,6 @@ export function WorkspaceProvider(
343344
toolInserts: Array.isArray(run.toolInserts) ? run.toolInserts : [],
344345
};
345346
}, []);
346-
347347
const mergeBuildRunSnapshot = useCallback(
348348
(prev: BuildRun, incomingRun: BuildRun): BuildRun => {
349349
const incoming = normalizeBuildRun(incomingRun);
@@ -354,7 +354,6 @@ export function WorkspaceProvider(
354354
const incomingMessages = incoming.messages ?? [];
355355
const incomingTraces = incoming.traces ?? [];
356356
const incomingToolInserts = incoming.toolInserts ?? [];
357-
358357
const nextRun: BuildRun = {
359358
...incoming,
360359
messages: preserveStreamingArrays &&
@@ -383,7 +382,7 @@ export function WorkspaceProvider(
383382
mode === "raf" && typeof window !== "undefined" &&
384383
typeof globalThis.cancelAnimationFrame === "function"
385384
) {
386-
globalThis.cancelAnimationFrame(handle);
385+
globalThis.cancelAnimationFrame(handle as number);
387386
} else if (mode === "timeout") {
388387
clearTimeout(handle);
389388
}

simulator-ui/src/gds/__tests__/Badge.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// deno-lint-ignore-file
22
import { assert, assertEquals } from "@std/assert";
3-
import type React from "react";
3+
import React from "react";
44
import TestRenderer, { act } from "npm:react-test-renderer@19.2.0";
55
import type { ReactTestInstance } from "npm:react-test-renderer@19.2.0";
66

simulator-ui/src/gds/__tests__/Tooltip.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// deno-lint-ignore-file
22
import { assert, assertEquals } from "@std/assert";
3-
import type React from "react";
3+
import React from "react";
44
import TestRenderer, { act } from "npm:react-test-renderer@19.2.0";
55

66
const globals = globalThis as unknown as {

simulator-ui/src/shared.tsx

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
setPathValue,
1111
} from "./utils.ts";
1212
import Badge from "./gds/Badge.tsx";
13+
export { CopyBadge } from "./CopyBadge.tsx";
1314
import Panel from "./gds/Panel.tsx";
1415
import Tabs from "./gds/Tabs.tsx";
1516
import type {
@@ -62,62 +63,6 @@ export function useHttpSchema(opts?: { workspaceId?: string | null }) {
6263
return { schemaResponse, loading, error, refresh };
6364
}
6465

65-
export function CopyBadge(props: {
66-
label: string;
67-
displayValue?: string | null;
68-
copyValue?: string | null;
69-
className?: string;
70-
}) {
71-
const { label, displayValue, copyValue, className } = props;
72-
const [copied, setCopied] = useState(false);
73-
const timeoutRef = useRef<number | undefined>(undefined);
74-
75-
useEffect(() => {
76-
return () => {
77-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
78-
};
79-
}, []);
80-
81-
const copyTarget = copyValue ?? displayValue;
82-
if (!copyTarget) return null;
83-
const text = displayValue ?? copyTarget;
84-
85-
const handleCopy = useCallback(async () => {
86-
try {
87-
if (navigator.clipboard?.writeText) {
88-
await navigator.clipboard.writeText(copyTarget);
89-
} else {
90-
const temp = document.createElement("textarea");
91-
temp.value = copyTarget;
92-
temp.style.position = "fixed";
93-
temp.style.opacity = "0";
94-
document.body.appendChild(temp);
95-
temp.select();
96-
document.execCommand("copy");
97-
document.body.removeChild(temp);
98-
}
99-
setCopied(true);
100-
if (timeoutRef.current) clearTimeout(timeoutRef.current);
101-
timeoutRef.current = globalThis.setTimeout(() => setCopied(false), 1500);
102-
} catch {
103-
// ignore copy failures silently
104-
}
105-
}, [copyTarget]);
106-
107-
return (
108-
<button
109-
type="button"
110-
className={classNames("copy-badge", className, copied && "copied")}
111-
onClick={handleCopy}
112-
title={copied ? "Copied!" : `Click to copy ${label}`}
113-
>
114-
<span className="copy-label">{label}:</span>
115-
<code>{text}</code>
116-
{copied && <span className="copy-feedback">Copied</span>}
117-
</button>
118-
);
119-
}
120-
12166
export function ConversationView(props: {
12267
messages: Array<ConversationMessage>;
12368
header?: React.ReactNode;

0 commit comments

Comments
 (0)