@@ -5,25 +5,12 @@ import type { BackendHandle, WorkspaceBackend } from "./backend.js";
55import { createGitClient } from "./git/index.js" ;
66import type { WorkspaceModuleBackend } from "./runtime/types.js" ;
77import { WorkspaceTransportError } from "./transport-failure.js" ;
8- import { type ThinkWorkspaceCompatibility , Workspace } from "./workspace.js" ;
8+ import { Workspace } from "./workspace.js" ;
99
1010function makeStorage ( ) : SQLiteTestStorage {
1111 return new SQLiteTestStorage ( ) ;
1212}
1313
14- function expectThinkWorkspace (
15- ws : Workspace ,
16- ) : asserts ws is Workspace & ThinkWorkspaceCompatibility {
17- expect ( ws ) . toHaveProperty ( "readFile" ) ;
18- expect ( ws ) . toHaveProperty ( "readFileBytes" ) ;
19- expect ( ws ) . toHaveProperty ( "writeFile" ) ;
20- expect ( ws ) . toHaveProperty ( "readDir" ) ;
21- expect ( ws ) . toHaveProperty ( "glob" ) ;
22- expect ( ws ) . toHaveProperty ( "mkdir" ) ;
23- expect ( ws ) . toHaveProperty ( "rm" ) ;
24- expect ( ws ) . toHaveProperty ( "stat" ) ;
25- }
26-
2714// In-process fakes. We never spawn anything from the package
2815// code; the backend's only contract is "produce a SyncRPC
2916// stub that computerd would speak". A plain object is enough.
@@ -1463,49 +1450,15 @@ describe("Workspace transport-failure invalidation", () => {
14631450 ] ) ;
14641451 } ) ;
14651452} ) ;
1466- describe ( "Workspace Think compatibility" , ( ) => {
1467- it ( "adds Think-compatible filesystem methods when useThink is true" , async ( ) => {
1453+ describe ( "Workspace compatibility surface " , ( ) => {
1454+ it ( "does not accept useThink or add root-level filesystem methods" , ( ) => {
14681455 const ws = new Workspace ( {
14691456 storage : makeStorage ( ) ,
1457+ // @ts -expect-error useThink was removed with the compatibility layer.
14701458 useThink : true ,
1471- now : ( ) => 1_700_000_000_000 ,
1472- } ) ;
1473-
1474- expectThinkWorkspace ( ws ) ;
1475-
1476- await ws . mkdir ( "/workspace/notes" , { recursive : true } ) ;
1477- await ws . writeFile ( "/workspace/notes/a.txt" , "hello" ) ;
1478- await ws . writeFile ( "/workspace/notes/b.md" , "# title" ) ;
1479-
1480- expect ( await ws . readFile ( "/workspace/notes/a.txt" ) ) . toBe ( "hello" ) ;
1481- expect ( await ws . readFile ( "/workspace/missing.txt" ) ) . toBeNull ( ) ;
1482- expect ( new TextDecoder ( ) . decode ( await ws . readFileBytes ( "/workspace/notes/a.txt" ) ) ) . toBe (
1483- "hello" ,
1484- ) ;
1485- expect ( await ws . readFileBytes ( "/workspace/missing.txt" ) ) . toBeNull ( ) ;
1486-
1487- await expect ( ws . stat ( "/workspace/notes/a.txt" ) ) . resolves . toMatchObject ( {
1488- path : "/workspace/notes/a.txt" ,
1489- name : "a.txt" ,
1490- type : "file" ,
1491- size : 5 ,
14921459 } ) ;
1493- await expect ( ws . stat ( "/workspace/missing.txt" ) ) . resolves . toBeNull ( ) ;
1494-
1495- await expect ( ws . readDir ( "/workspace/notes" , { limit : 1 , offset : 1 } ) ) . resolves . toEqual ( [
1496- expect . objectContaining ( { path : "/workspace/notes/b.md" , name : "b.md" , type : "file" } ) ,
1497- ] ) ;
1498- await expect ( ws . glob ( "/workspace/notes/**/*.txt" ) ) . resolves . toEqual ( [
1499- expect . objectContaining ( { path : "/workspace/notes/a.txt" , name : "a.txt" , type : "file" } ) ,
1500- ] ) ;
1501-
1502- await ws . rm ( "/workspace/notes/a.txt" , { force : true } ) ;
1503- expect ( await ws . readFile ( "/workspace/notes/a.txt" ) ) . toBeNull ( ) ;
1504- } ) ;
1505-
1506- it ( "does not add Think compatibility methods by default" , ( ) => {
1507- const ws = new Workspace ( { storage : makeStorage ( ) } ) ;
15081460
1461+ expect ( ws ) . not . toHaveProperty ( "useThink" ) ;
15091462 expect ( ws ) . not . toHaveProperty ( "readFile" ) ;
15101463 expect ( ws ) . not . toHaveProperty ( "readFileBytes" ) ;
15111464 expect ( ws ) . not . toHaveProperty ( "writeFile" ) ;
@@ -1514,5 +1467,6 @@ describe("Workspace Think compatibility", () => {
15141467 expect ( ws ) . not . toHaveProperty ( "mkdir" ) ;
15151468 expect ( ws ) . not . toHaveProperty ( "rm" ) ;
15161469 expect ( ws ) . not . toHaveProperty ( "stat" ) ;
1470+ expect ( ws . stub ( ) ) . not . toHaveProperty ( "useThink" ) ;
15171471 } ) ;
15181472} ) ;
0 commit comments