@volter/browser-godot 0.1.5 → 0.1.6

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.
@@ -21,7 +21,7 @@
21
21
  * project.
22
22
  */
23
23
  export interface EmbedWorkspaceSource {
24
- readFileSync(path: string): Uint8Array;
24
+ readFile(path: string): Promise<Uint8Array>;
25
25
  readdirSync(path: string): string[];
26
26
  statSync(path: string): {
27
27
  isDirectory(): boolean;
@@ -47,7 +47,7 @@ export interface GodotEditorEmbedOptions {
47
47
  /**
48
48
  * Called with a fresh handle after the editor is reopened because the
49
49
  * device pixel ratio changed. Consumers must rebind anything holding the
50
- * previous editor filesystem, such as `GodotEditorBridge`.
50
+ * previous editor filesystem, such as the runtime's `EmscriptenBridge`.
51
51
  */
52
52
  onReopen?(handle: GodotEditorHandle): void;
53
53
  onError?(cause: unknown): void;
@@ -55,7 +55,7 @@ export interface GodotEditorEmbedOptions {
55
55
  export interface GodotEditorHandle {
56
56
  /** The editor engine, once initialized. */
57
57
  engine: EmbedEngine;
58
- /** The editor's Emscripten filesystem, for `GodotEditorBridge`. */
58
+ /** The editor's Emscripten filesystem, for the runtime's `EmscriptenBridge`. */
59
59
  filesystem: unknown;
60
60
  }
61
61
  export declare class GodotEditorEmbed {
@@ -84,6 +84,8 @@ export declare class GodotEditorEmbed {
84
84
  * workspace project materialized into it.
85
85
  */
86
86
  open(): Promise<GodotEditorHandle>;
87
+ /** The workspace's files, read from the store before the engine asks for them. */
88
+ private collectWorkspace;
87
89
  private materialize;
88
90
  }
89
91
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"editor-embed.d.ts","sourceRoot":"","sources":["../src/editor-embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,oBAAoB;IACnC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IACvC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,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AAgB;IA0Bf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAzBpC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoB;IACpD,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,eAAe,CAA4C;IACnE;;;;;OAKG;IACH,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAarC;gBAE2B,OAAO,EAAE,uBAAuB;IAI7D,OAAO,IAAI,IAAI;IAOf;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAOvB;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAiDxC,kFAAkF;YACpE,gBAAgB;IAqB9B,OAAO,CAAC,WAAW;CAGpB"}
@@ -104,11 +104,12 @@ export class GodotEditorEmbed {
104
104
  });
105
105
  embedWindow.__volterBrowserEphemeralFS = true;
106
106
  embedWindow.__volterBrowserEditorArgs = ["--editor", "--path", this.options.editorRoot, "--single-window"];
107
+ const collected = await this.collectWorkspace();
107
108
  embedWindow.__volterBrowserMaterialize = (engine) => {
108
109
  if (stale())
109
110
  return;
110
111
  try {
111
- this.materialize(engine);
112
+ this.materialize(engine, collected);
112
113
  // The editor engine initializes first; the game engine reuses this
113
114
  // same callback when the user runs the project.
114
115
  if (engine === embedWindow.__volterBrowserGodotEngine) {
@@ -124,25 +125,32 @@ export class GodotEditorEmbed {
124
125
  embedWindow.startEditor();
125
126
  return handle;
126
127
  }
127
- materialize(engine) {
128
+ /** The workspace's files, read from the store before the engine asks for them. */
129
+ async collectWorkspace() {
128
130
  const root = this.options.workspaceRoot;
129
131
  const workspace = this.options.workspace;
132
+ const files = [];
130
133
  if (!workspace.existsSync(root))
131
- return;
132
- const walk = (workspacePath, relative) => {
134
+ return files;
135
+ const walk = async (workspacePath, relative) => {
133
136
  for (const prefix of this.excludePrefixes) {
134
137
  if (relative === prefix || relative.startsWith(`${prefix}/`))
135
138
  return;
136
139
  }
137
140
  if (workspace.statSync(workspacePath).isDirectory()) {
138
141
  for (const name of workspace.readdirSync(workspacePath)) {
139
- walk(`${workspacePath}/${name}`, relative === "" ? name : `${relative}/${name}`);
142
+ await walk(`${workspacePath}/${name}`, relative === "" ? name : `${relative}/${name}`);
140
143
  }
141
144
  return;
142
145
  }
143
- engine.copyToFS(`${this.options.editorRoot}/${relative}`, workspace.readFileSync(workspacePath));
146
+ files.push([relative, await workspace.readFile(workspacePath)]);
144
147
  };
145
- walk(root, "");
148
+ await walk(root, "");
149
+ return files;
150
+ }
151
+ materialize(engine, files) {
152
+ for (const [relative, bytes] of files)
153
+ engine.copyToFS(`${this.options.editorRoot}/${relative}`, bytes);
146
154
  }
147
155
  }
148
156
  //# sourceMappingURL=editor-embed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-embed.js","sourceRoot":"","sources":["../src/editor-embed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AA4CH,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AASvD,MAAM,OAAO,gBAAgB;IA0BE;IAzBZ,eAAe,CAAoB;IAC5C,eAAe,CAA6B;IAC5C,eAAe,CAA4C;IACnE;;;;;OAKG;IACK,cAAc,GAAG,CAAC,CAAC;IACV,sBAAsB,GAAG,GAAS,EAAE;QACnD,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS;YAAE,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3E,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC,GAAG,EAAE;YACrC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;YACjC,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC;YAC3C,KAAK,IAAI,CAAC,IAAI,EAAE;iBACb,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;gBACf,IAAI,UAAU,KAAK,IAAI,CAAC,cAAc;oB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.js";
2
+ export declare const GODOT_PROFILE: EmscriptenProgramProfile;
3
+ //# sourceMappingURL=godot-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"godot-profile.d.ts","sourceRoot":"","sources":["../src/godot-profile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAwB,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAMnH,eAAO,MAAM,aAAa,EAAE,wBAgB1B,CAAC"}
@@ -0,0 +1,22 @@
1
+ const SCAN_REQUEST_RELATIVE = ".agent/scan_request";
2
+ /** Godot writes `<final>-XXXXXX` then renames it over `<final>`: a six-character mkstemp-style suffix. */
3
+ const TEMPORARY_NAME = /-[A-Za-z0-9]{6}$/u;
4
+ export const GODOT_PROFILE = Object.freeze({
5
+ name: "godot",
6
+ /** `.godot` is the editor's derived cache; `.agent` is the bridge's channel to the in-project addon. */
7
+ exclude: [".godot", ".agent"],
8
+ isTemporary: (relative) => TEMPORARY_NAME.test(relative),
9
+ /** A rename into a final path is Godot's atomic per-file commit. */
10
+ renameCommits: true,
11
+ /**
12
+ * The web editor does not rescan on focus; a write to `.agent/scan_request`
13
+ * asks the in-project agent_bridge addon (`packages/godot/addon`) to.
14
+ */
15
+ notify: (filesystem, root) => {
16
+ const channel = `${root}/.agent`;
17
+ if (!filesystem.analyzePath(channel).exists)
18
+ filesystem.mkdir(channel);
19
+ filesystem.writeFile(`${root}/${SCAN_REQUEST_RELATIVE}`, new Uint8Array([49]));
20
+ },
21
+ });
22
+ //# sourceMappingURL=godot-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"godot-profile.js","sourceRoot":"","sources":["../src/godot-profile.ts"],"names":[],"mappings":"AAKA,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AACpD,0GAA0G;AAC1G,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C,MAAM,CAAC,MAAM,aAAa,GAA6B,MAAM,CAAC,MAAM,CAAC;IACnE,IAAI,EAAE,OAAO;IACb,wGAAwG;IACxG,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC7B,WAAW,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC;IAChE,oEAAoE;IACpE,aAAa,EAAE,IAAI;IACnB;;;OAGG;IACH,MAAM,EAAE,CAAC,UAAgC,EAAE,IAAY,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,GAAG,IAAI,SAAS,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvE,UAAU,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,qBAAqB,EAAE,EAAE,IAAI,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;CACF,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./editor-bridge.js";
1
+ export * from "./godot-profile.js";
2
2
  export * from "./editor-embed.js";
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./editor-bridge.js";
1
+ export * from "./godot-profile.js";
2
2
  export * from "./editor-embed.js";
3
3
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@volter/browser-godot",
3
- "version": "0.1.5",
4
- "description": "Bidirectional bridge between a browser workspace and the Godot web editor",
3
+ "version": "0.1.6",
4
+ "description": "The Godot web editor over the runtime's Emscripten bridge: its embed, its build, and its profile",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -9,12 +9,27 @@
9
9
  "directory": "packages/godot"
10
10
  },
11
11
  "type": "module",
12
- "files": ["dist", "addon", "README.md", "LICENSE"],
12
+ "files": [
13
+ "dist",
14
+ "addon",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
13
18
  "types": "./dist/index.d.ts",
14
19
  "exports": {
15
- ".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
16
- "./*.js": { "types": "./dist/*.d.ts", "import": "./dist/*.js" }
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ },
24
+ "./*.js": {
25
+ "types": "./dist/*.d.ts",
26
+ "import": "./dist/*.js"
27
+ }
17
28
  },
18
- "scripts": { "build": "tsc -p tsconfig.build.json" },
19
- "publishConfig": { "access": "public" }
29
+ "scripts": {
30
+ "build": "tsc -p tsconfig.build.json"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ }
20
35
  }
@@ -1,105 +0,0 @@
1
- /**
2
- * Bidirectional file bridge between the workbench's live virtual filesystem
3
- * and a running FS-exposed Godot web editor (built by
4
- * scripts/build-godot-web-editor.sh).
5
- *
6
- * Both directions use the same method the chassis uses for AlmostNode→OPFS
7
- * persistence: wrap the filesystem's mutation functions, keep the originals,
8
- * filter by root, restore on dispose. The workspace side mirrors the
9
- * VirtualFS method names structurally so a consumer can pass the live
10
- * filesystem directly; this package deliberately imports nothing from the
11
- * chassis or any execution engine.
12
- *
13
- * Outbound (editor → workspace): Godot commits files as write-to-temp then
14
- * atomic rename, so a rename into a final path is a per-file commit point.
15
- * Direct writes without a rename are flushed on a short debounce.
16
- *
17
- * Inbound (workspace → editor): bytes are applied to the editor's Emscripten
18
- * FS immediately; a debounced `.agent/scan_request` write asks the in-project
19
- * agent_bridge addon to rescan, because the web editor does not rescan on
20
- * focus.
21
- */
22
- export interface BridgeWorkspace {
23
- readFileSync(path: string): Uint8Array;
24
- writeFileSync(path: string, data: Uint8Array): void;
25
- mkdirSync(path: string, options?: {
26
- recursive?: boolean;
27
- }): void;
28
- unlinkSync(path: string): void;
29
- rmdirSync(path: string): void;
30
- renameSync(from: string, to: string): void;
31
- existsSync(path: string): boolean;
32
- }
33
- interface EmscriptenStream {
34
- path?: string;
35
- }
36
- export interface EditorFilesystem {
37
- readFile(path: string, options: {
38
- encoding: "binary";
39
- }): Uint8Array;
40
- writeFile(path: string, data: Uint8Array): void;
41
- write(stream: EmscriptenStream, ...rest: unknown[]): number;
42
- mkdir(path: string, mode?: number): void;
43
- unlink(path: string): void;
44
- rmdir(path: string): void;
45
- rename(from: string, to: string): void;
46
- analyzePath(path: string): {
47
- exists: boolean;
48
- };
49
- }
50
- export interface GodotEditorBridgeOptions {
51
- workspace: BridgeWorkspace;
52
- /** Workspace-side project root, e.g. "/workspace". */
53
- workspaceRoot: string;
54
- editorFilesystem: EditorFilesystem;
55
- /** Editor-side project root, e.g. "/home/web_user/new-game-project". */
56
- editorRoot: string;
57
- /**
58
- * Path prefixes (relative to the project root) excluded from both
59
- * directions. `.agent` is the bridge's own channel; `.godot` is the
60
- * editor's derived cache tree.
61
- */
62
- excludePrefixes?: readonly string[];
63
- /** Called after inbound changes are applied and the scan is requested. */
64
- onInboundApplied?(relativePaths: readonly string[]): void;
65
- /** Called after an outbound editor commit reaches the workspace. */
66
- onOutboundApplied?(relativePaths: readonly string[]): void;
67
- onError?(cause: unknown): void;
68
- /** Milliseconds before a direct editor write without a rename is flushed. */
69
- outboundDebounceMilliseconds?: number;
70
- /** Milliseconds before batched inbound changes request one editor scan. */
71
- scanDebounceMilliseconds?: number;
72
- }
73
- export declare class GodotEditorBridge {
74
- private readonly workspace;
75
- private readonly workspaceRoot;
76
- private readonly editor;
77
- private readonly editorRoot;
78
- private readonly excludePrefixes;
79
- private readonly workspaceOriginals;
80
- private readonly editorOriginals;
81
- private readonly options;
82
- private readonly applyingInbound;
83
- private readonly applyingOutbound;
84
- private readonly pendingOutboundWrites;
85
- private readonly pendingScanPaths;
86
- private outboundTimer;
87
- private scanTimer;
88
- private disposed;
89
- constructor(options: GodotEditorBridgeOptions);
90
- dispose(): void;
91
- private relativeOf;
92
- private fail;
93
- private installWorkspaceHooks;
94
- private forwardInbound;
95
- private ensureEditorParents;
96
- private ensureEditorDirectory;
97
- private queueScan;
98
- private installEditorHooks;
99
- private forwardOutbound;
100
- private scheduleOutboundFlush;
101
- private syncOutboundFile;
102
- private ensureWorkspaceParents;
103
- }
104
- export {};
105
- //# sourceMappingURL=editor-bridge.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-bridge.d.ts","sourceRoot":"","sources":["../src/editor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IACvC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACpD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACjE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAED,UAAU,gBAAgB;IAAG,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE,GAAG,UAAU,CAAC;IACpE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAChD,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC5D,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,M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,CAAkB;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;IACtD,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAqB;IAC3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAgB;IACjD,OAAO,CAAC,aAAa,CAA4C;IACjE,OAAO,CAAC,SAAS,CAA4C;IAC7D,OAAO,CAAC,QAAQ,CAAS;gBAEb,OAAO,EAAE,wBAAwB;IAyB7C,OAAO,IAAI,IAAI;IAiBf,OAAO,CAAC,UAAU;IAWlB,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,qBAAqB;IAwD7B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,qBAAqB;IAM7B,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,kBAAkB;IAkD1B,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,sBAAsB;CAQ/B"}
@@ -1,334 +0,0 @@
1
- /**
2
- * Bidirectional file bridge between the workbench's live virtual filesystem
3
- * and a running FS-exposed Godot web editor (built by
4
- * scripts/build-godot-web-editor.sh).
5
- *
6
- * Both directions use the same method the chassis uses for AlmostNode→OPFS
7
- * persistence: wrap the filesystem's mutation functions, keep the originals,
8
- * filter by root, restore on dispose. The workspace side mirrors the
9
- * VirtualFS method names structurally so a consumer can pass the live
10
- * filesystem directly; this package deliberately imports nothing from the
11
- * chassis or any execution engine.
12
- *
13
- * Outbound (editor → workspace): Godot commits files as write-to-temp then
14
- * atomic rename, so a rename into a final path is a per-file commit point.
15
- * Direct writes without a rename are flushed on a short debounce.
16
- *
17
- * Inbound (workspace → editor): bytes are applied to the editor's Emscripten
18
- * FS immediately; a debounced `.agent/scan_request` write asks the in-project
19
- * agent_bridge addon to rescan, because the web editor does not rescan on
20
- * focus.
21
- */
22
- const DEFAULT_EXCLUDES = [".agent", ".godot"];
23
- const SCAN_REQUEST_RELATIVE = ".agent/scan_request";
24
- /**
25
- * Godot writes a file as `<final>-XXXXXX` then renames it over `<final>`.
26
- * The temp name must never reach the workspace: the rename is the commit,
27
- * and it syncs the final path. Matches a six-character mkstemp-style suffix.
28
- */
29
- const EDITOR_TEMPORARY_NAME = /-[A-Za-z0-9]{6}$/;
30
- function isEditorTemporary(relative) {
31
- return EDITOR_TEMPORARY_NAME.test(relative);
32
- }
33
- function normalize(path) {
34
- const collapsed = path.replace(/\/+/g, "/");
35
- return collapsed.length > 1 && collapsed.endsWith("/") ? collapsed.slice(0, -1) : collapsed;
36
- }
37
- export class GodotEditorBridge {
38
- workspace;
39
- workspaceRoot;
40
- editor;
41
- editorRoot;
42
- excludePrefixes;
43
- workspaceOriginals;
44
- editorOriginals;
45
- options;
46
- applyingInbound = new Set();
47
- applyingOutbound = new Set();
48
- pendingOutboundWrites = new Set();
49
- pendingScanPaths = [];
50
- outboundTimer;
51
- scanTimer;
52
- disposed = false;
53
- constructor(options) {
54
- this.options = options;
55
- this.workspace = options.workspace;
56
- this.workspaceRoot = normalize(options.workspaceRoot);
57
- this.editor = options.editorFilesystem;
58
- this.editorRoot = normalize(options.editorRoot);
59
- this.excludePrefixes = options.excludePrefixes ?? DEFAULT_EXCLUDES;
60
- this.workspaceOriginals = {
61
- writeFileSync: this.workspace.writeFileSync.bind(this.workspace),
62
- mkdirSync: this.workspace.mkdirSync.bind(this.workspace),
63
- unlinkSync: this.workspace.unlinkSync.bind(this.workspace),
64
- rmdirSync: this.workspace.rmdirSync.bind(this.workspace),
65
- renameSync: this.workspace.renameSync.bind(this.workspace),
66
- };
67
- this.editorOriginals = {
68
- write: this.editor.write.bind(this.editor),
69
- mkdir: this.editor.mkdir.bind(this.editor),
70
- unlink: this.editor.unlink.bind(this.editor),
71
- rmdir: this.editor.rmdir.bind(this.editor),
72
- rename: this.editor.rename.bind(this.editor),
73
- };
74
- this.installWorkspaceHooks();
75
- this.installEditorHooks();
76
- }
77
- dispose() {
78
- if (this.disposed)
79
- return;
80
- this.disposed = true;
81
- if (this.outboundTimer !== undefined)
82
- clearTimeout(this.outboundTimer);
83
- if (this.scanTimer !== undefined)
84
- clearTimeout(this.scanTimer);
85
- this.workspace.writeFileSync = this.workspaceOriginals.writeFileSync;
86
- this.workspace.mkdirSync = this.workspaceOriginals.mkdirSync;
87
- this.workspace.unlinkSync = this.workspaceOriginals.unlinkSync;
88
- this.workspace.rmdirSync = this.workspaceOriginals.rmdirSync;
89
- this.workspace.renameSync = this.workspaceOriginals.renameSync;
90
- this.editor.write = this.editorOriginals.write;
91
- this.editor.mkdir = this.editorOriginals.mkdir;
92
- this.editor.unlink = this.editorOriginals.unlink;
93
- this.editor.rmdir = this.editorOriginals.rmdir;
94
- this.editor.rename = this.editorOriginals.rename;
95
- }
96
- relativeOf(root, path) {
97
- const normalized = normalize(path);
98
- if (normalized === root)
99
- return "";
100
- if (!normalized.startsWith(root + "/"))
101
- return undefined;
102
- const relative = normalized.slice(root.length + 1);
103
- for (const prefix of this.excludePrefixes) {
104
- if (relative === prefix || relative.startsWith(prefix + "/"))
105
- return undefined;
106
- }
107
- return relative;
108
- }
109
- fail(cause) {
110
- this.options.onError?.(cause);
111
- }
112
- // ---- Inbound: workspace mutations flow into the editor filesystem. ----
113
- installWorkspaceHooks() {
114
- this.workspace.writeFileSync = (path, data) => {
115
- this.workspaceOriginals.writeFileSync(path, data);
116
- this.forwardInbound(path, (editorPath) => {
117
- this.ensureEditorParents(editorPath);
118
- this.editor.writeFile(editorPath, this.workspace.readFileSync(normalize(path)));
119
- });
120
- };
121
- this.workspace.mkdirSync = (path, options) => {
122
- this.workspaceOriginals.mkdirSync(path, options);
123
- this.forwardInbound(path, (editorPath) => this.ensureEditorDirectory(editorPath));
124
- };
125
- this.workspace.unlinkSync = (path) => {
126
- this.workspaceOriginals.unlinkSync(path);
127
- this.forwardInbound(path, (editorPath) => {
128
- if (this.editor.analyzePath(editorPath).exists)
129
- this.editor.unlink(editorPath);
130
- });
131
- };
132
- this.workspace.rmdirSync = (path) => {
133
- this.workspaceOriginals.rmdirSync(path);
134
- this.forwardInbound(path, (editorPath) => {
135
- if (this.editor.analyzePath(editorPath).exists)
136
- this.editor.rmdir(editorPath);
137
- });
138
- };
139
- this.workspace.renameSync = (from, to) => {
140
- this.workspaceOriginals.renameSync(from, to);
141
- const fromRelative = this.relativeOf(this.workspaceRoot, from);
142
- const toRelative = this.relativeOf(this.workspaceRoot, to);
143
- if (fromRelative === undefined && toRelative === undefined)
144
- return;
145
- try {
146
- if (fromRelative !== undefined && toRelative !== undefined) {
147
- this.applyingInbound.add(fromRelative);
148
- this.applyingInbound.add(toRelative);
149
- try {
150
- this.editor.rename(`${this.editorRoot}/${fromRelative}`, `${this.editorRoot}/${toRelative}`);
151
- }
152
- finally {
153
- this.applyingInbound.delete(fromRelative);
154
- this.applyingInbound.delete(toRelative);
155
- }
156
- this.queueScan([fromRelative, toRelative]);
157
- }
158
- else if (toRelative !== undefined) {
159
- this.forwardInbound(to, (editorPath) => {
160
- this.ensureEditorParents(editorPath);
161
- this.editor.writeFile(editorPath, this.workspace.readFileSync(normalize(to)));
162
- });
163
- }
164
- else if (fromRelative !== undefined) {
165
- this.forwardInbound(from, (editorPath) => {
166
- if (this.editor.analyzePath(editorPath).exists)
167
- this.editor.unlink(editorPath);
168
- });
169
- }
170
- }
171
- catch (cause) {
172
- this.fail(cause);
173
- }
174
- };
175
- }
176
- forwardInbound(workspacePath, apply) {
177
- const relative = this.relativeOf(this.workspaceRoot, workspacePath);
178
- if (relative === undefined || relative === "" || this.applyingOutbound.has(relative))
179
- return;
180
- this.applyingInbound.add(relative);
181
- try {
182
- apply(`${this.editorRoot}/${relative}`);
183
- this.queueScan([relative]);
184
- }
185
- catch (cause) {
186
- this.fail(cause);
187
- }
188
- finally {
189
- this.applyingInbound.delete(relative);
190
- }
191
- }
192
- ensureEditorParents(editorPath) {
193
- const parent = editorPath.slice(0, editorPath.lastIndexOf("/"));
194
- if (parent.length > this.editorRoot.length)
195
- this.ensureEditorDirectory(parent);
196
- }
197
- ensureEditorDirectory(editorPath) {
198
- if (this.editor.analyzePath(editorPath).exists)
199
- return;
200
- this.ensureEditorParents(editorPath);
201
- this.editorOriginals.mkdir(editorPath);
202
- }
203
- queueScan(relativePaths) {
204
- this.pendingScanPaths.push(...relativePaths);
205
- if (this.scanTimer !== undefined)
206
- clearTimeout(this.scanTimer);
207
- this.scanTimer = setTimeout(() => {
208
- this.scanTimer = undefined;
209
- const applied = this.pendingScanPaths.splice(0);
210
- try {
211
- this.ensureEditorDirectory(`${this.editorRoot}/.agent`);
212
- this.editor.writeFile(`${this.editorRoot}/${SCAN_REQUEST_RELATIVE}`, new Uint8Array([49]));
213
- this.options.onInboundApplied?.(applied);
214
- }
215
- catch (cause) {
216
- this.fail(cause);
217
- }
218
- }, this.options.scanDebounceMilliseconds ?? 100);
219
- }
220
- // ---- Outbound: editor commits flow into the workspace filesystem. ----
221
- installEditorHooks() {
222
- this.editor.write = (stream, ...rest) => {
223
- const result = this.editorOriginals.write(stream, ...rest);
224
- const relative = stream.path === undefined ? undefined : this.relativeOf(this.editorRoot, stream.path);
225
- if (relative !== undefined && relative !== "" && !this.applyingInbound.has(relative) && !isEditorTemporary(relative)) {
226
- this.pendingOutboundWrites.add(relative);
227
- this.scheduleOutboundFlush();
228
- }
229
- return result;
230
- };
231
- this.editor.mkdir = (path, mode) => {
232
- this.editorOriginals.mkdir(path, mode);
233
- this.forwardOutbound(path, (workspacePath) => {
234
- if (!this.workspace.existsSync(workspacePath)) {
235
- this.workspaceOriginals.mkdirSync(workspacePath, { recursive: true });
236
- }
237
- });
238
- };
239
- this.editor.unlink = (path) => {
240
- this.editorOriginals.unlink(path);
241
- const relative = path === undefined ? undefined : this.relativeOf(this.editorRoot, path);
242
- if (relative !== undefined)
243
- this.pendingOutboundWrites.delete(relative);
244
- this.forwardOutbound(path, (workspacePath) => {
245
- if (this.workspace.existsSync(workspacePath))
246
- this.workspaceOriginals.unlinkSync(workspacePath);
247
- });
248
- };
249
- this.editor.rmdir = (path) => {
250
- this.editorOriginals.rmdir(path);
251
- this.forwardOutbound(path, (workspacePath) => {
252
- if (this.workspace.existsSync(workspacePath))
253
- this.workspaceOriginals.rmdirSync(workspacePath);
254
- });
255
- };
256
- this.editor.rename = (from, to) => {
257
- this.editorOriginals.rename(from, to);
258
- const fromRelative = this.relativeOf(this.editorRoot, from);
259
- const toRelative = this.relativeOf(this.editorRoot, to);
260
- if (fromRelative !== undefined)
261
- this.pendingOutboundWrites.delete(fromRelative);
262
- if (toRelative === undefined || this.applyingInbound.has(toRelative))
263
- return;
264
- // A rename into a final path is Godot's atomic per-file commit point:
265
- // sync the destination bytes now instead of waiting for the debounce.
266
- this.pendingOutboundWrites.delete(toRelative);
267
- this.syncOutboundFile(toRelative);
268
- if (fromRelative !== undefined) {
269
- this.forwardOutbound(from, (workspacePath) => {
270
- if (this.workspace.existsSync(workspacePath))
271
- this.workspaceOriginals.unlinkSync(workspacePath);
272
- });
273
- }
274
- };
275
- }
276
- forwardOutbound(editorPath, apply) {
277
- const relative = this.relativeOf(this.editorRoot, editorPath);
278
- if (relative === undefined || relative === "" || this.applyingInbound.has(relative))
279
- return;
280
- // A temporary never reached the workspace, so its removal is not an event.
281
- if (isEditorTemporary(relative))
282
- return;
283
- this.applyingOutbound.add(relative);
284
- try {
285
- apply(`${this.workspaceRoot}/${relative}`);
286
- this.options.onOutboundApplied?.([relative]);
287
- }
288
- catch (cause) {
289
- this.fail(cause);
290
- }
291
- finally {
292
- this.applyingOutbound.delete(relative);
293
- }
294
- }
295
- scheduleOutboundFlush() {
296
- if (this.outboundTimer !== undefined)
297
- return;
298
- this.outboundTimer = setTimeout(() => {
299
- this.outboundTimer = undefined;
300
- const pending = [...this.pendingOutboundWrites];
301
- this.pendingOutboundWrites.clear();
302
- for (const relative of pending)
303
- this.syncOutboundFile(relative);
304
- }, this.options.outboundDebounceMilliseconds ?? 150);
305
- }
306
- syncOutboundFile(relative) {
307
- this.applyingOutbound.add(relative);
308
- try {
309
- const editorPath = `${this.editorRoot}/${relative}`;
310
- if (!this.editor.analyzePath(editorPath).exists)
311
- return;
312
- const bytes = this.editor.readFile(editorPath, { encoding: "binary" });
313
- this.ensureWorkspaceParents(relative);
314
- this.workspaceOriginals.writeFileSync(`${this.workspaceRoot}/${relative}`, bytes);
315
- this.options.onOutboundApplied?.([relative]);
316
- }
317
- catch (cause) {
318
- this.fail(cause);
319
- }
320
- finally {
321
- this.applyingOutbound.delete(relative);
322
- }
323
- }
324
- ensureWorkspaceParents(relative) {
325
- const lastSlash = relative.lastIndexOf("/");
326
- if (lastSlash <= 0)
327
- return;
328
- const parent = `${this.workspaceRoot}/${relative.slice(0, lastSlash)}`;
329
- if (!this.workspace.existsSync(parent)) {
330
- this.workspaceOriginals.mkdirSync(parent, { recursive: true });
331
- }
332
- }
333
- }
334
- //# sourceMappingURL=editor-bridge.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-bridge.js","sourceRoot":"","sources":["../src/editor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAiDH,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAU,CAAC;AACvD,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AACpD;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAkBD,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5C,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,QAAQ,CAA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