glove-foundry 0.6.1 → 0.8.0

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,6 +1,5 @@
1
1
  import * as station_signal from 'station-signal';
2
2
 
3
- /** Private execution-backend entrypoint; application modules remain definitions. */
4
3
  declare const _default: station_signal.AnySignal;
5
4
 
6
5
  export { _default as default };
@@ -1,19 +1,9 @@
1
- import {
2
- compileAgentModule
3
- } from "./chunk-TFGETZYH.js";
4
- import "./chunk-RSU7NEDK.js";
5
- import {
6
- bindAgentLocalDefinitions
7
- } from "./chunk-OBTOFA7W.js";
8
- import "./chunk-B36BGF5R.js";
9
1
  import {
10
2
  FOUNDRY_AGENT_FILE_ENV,
11
3
  FOUNDRY_AGENT_ROUTE_ENV
12
- } from "./chunk-K2EU63MB.js";
4
+ } from "./chunk-CYOIHSUX.js";
13
5
 
14
6
  // src/execution-agent.ts
15
- import { pathToFileURL } from "node:url";
16
- import { dirname } from "node:path";
17
7
  var route = process.env[FOUNDRY_AGENT_ROUTE_ENV];
18
8
  var file = process.env[FOUNDRY_AGENT_FILE_ENV];
19
9
  if (!route || !file) {
@@ -21,9 +11,8 @@ if (!route || !file) {
21
11
  "The Foundry execution entrypoint requires GLOVE_FOUNDRY_AGENT_ROUTE and GLOVE_FOUNDRY_AGENT_FILE."
22
12
  );
23
13
  }
24
- var module = await import(pathToFileURL(file).href);
25
- await bindAgentLocalDefinitions(dirname(file));
26
- var execution_agent_default = compileAgentModule(route, module);
14
+ var { loadExecutionAgent } = await import("./execution-loader.js");
15
+ var execution_agent_default = await loadExecutionAgent(route, file);
27
16
  export {
28
17
  execution_agent_default as default
29
18
  };
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  FOUNDRY_APPLICATION_ENV,
6
6
  internalAgentName
7
- } from "./chunk-K2EU63MB.js";
7
+ } from "./chunk-CYOIHSUX.js";
8
8
 
9
9
  // src/execution-daemon.ts
10
10
  import { randomBytes } from "node:crypto";
@@ -26,8 +26,12 @@ var schedules = new ScheduleMemoryAdapter();
26
26
  var definitions = /* @__PURE__ */ new Map();
27
27
  var stopping;
28
28
  var resources;
29
- function send(message) {
30
- if (process.connected) process.send?.(message);
29
+ function send(message, then) {
30
+ if (!process.connected || !process.send) {
31
+ then?.();
32
+ return;
33
+ }
34
+ process.send(message, void 0, {}, () => then?.());
31
35
  }
32
36
  async function stop() {
33
37
  return stopping ??= (async () => {
@@ -178,8 +182,9 @@ export default await loadExecutionAgent(${JSON.stringify(agent.route)}, ${JSON.s
178
182
  value = null;
179
183
  break;
180
184
  }
181
- send({ id: message.id, value });
182
- if (command.method === "stop") process.disconnect?.();
185
+ send({ id: message.id, value }, command.method === "stop" ? () => {
186
+ if (process.connected) process.disconnect?.();
187
+ } : void 0);
183
188
  })().catch(() => {
184
189
  send({ id: message.id, error: `Execution daemon ${message.command.method} failed. Inspect daemon health before repeating mutations.` });
185
190
  });