@nathanstephenson/flow 0.1.6 → 0.1.7

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.
@@ -43,7 +43,7 @@ export function runWorker() {
43
43
  if (creating || closing)
44
44
  throw new Error("Backend worker already initialized");
45
45
  creating = true;
46
- const { mcpTools, workflowEnabled, workflowBuilderInstructions, backendModule, backend: backendName = "pi", ...options } = args[0];
46
+ const { mcpTools, mcpConnectionIds, workflowEnabled, workflowBuilderInstructions, backendModule, backend: backendName = "pi", ...options } = args[0];
47
47
  const workflowBuilder = workflowBuilderInstructions === undefined ? undefined : {
48
48
  instructions: workflowBuilderInstructions,
49
49
  read: (path) => rpc.call("workflowBuilder.read", [path]),
@@ -72,7 +72,7 @@ export function runWorker() {
72
72
  session = await backend.create({
73
73
  ...options,
74
74
  ...(workflowBuilder ? { workflowBuilder } : {
75
- ...(mcpTools ? { mcp: { tools: () => tools } } : {}),
75
+ ...(mcpTools ? { mcp: { connections: (mcpConnectionIds ?? []).map((id) => ({ id })), tools: () => tools } } : {}),
76
76
  ...(workflowEnabled ? { workflow } : {}),
77
77
  }),
78
78
  emit: (event) => {
@@ -168,7 +168,7 @@ class WorkerSession {
168
168
  const state = await this.rpc.call("create", [{ ...options, backend: this.launchOptions.backend ?? "pi",
169
169
  workflowEnabled: !workflowBuilder && !!workflow,
170
170
  ...(workflowBuilder ? { workflowBuilderInstructions: workflowBuilder.instructions }
171
- : mcp ? { mcpTools: mcpMetadata(mcp) } : {}),
171
+ : mcp ? { mcpTools: mcpMetadata(mcp), mcpConnectionIds: (mcp.connections ?? []).map((connection) => connection.id) } : {}),
172
172
  ...(this.launchOptions.backendModule ? { backendModule: this.launchOptions.backendModule } : {}),
173
173
  }], controller.signal);
174
174
  this.updateSnapshot(state);
package/dist/build-id CHANGED
@@ -1 +1 @@
1
- dd94e5bf-c6e7-43c8-9b45-5cd67ff6c921
1
+ e95e7068-765f-495c-9ba0-420a165b3c5f
@@ -883,7 +883,7 @@ async function bootstrap() {
883
883
  if (!managed) throw new Error("Missing systemd update configuration");
884
884
  await assertSystemdOwner(managed, managed.updater, process.pid);
885
885
  }
886
- const lease = await install.register("dd94e5bf-c6e7-43c8-9b45-5cd67ff6c921", root, args, process.env.FLOW_UPDATE_CAPABILITY ?? systemdCapability(root));
886
+ const lease = await install.register("e95e7068-765f-495c-9ba0-420a165b3c5f", root, args, process.env.FLOW_UPDATE_CAPABILITY ?? systemdCapability(root));
887
887
  delete process.env.FLOW_UPDATE_CAPABILITY;
888
888
  process.on("exit", lease.release);
889
889
  if (args[0] === "update") {
@@ -1,9 +1,7 @@
1
- import { realpathSync } from 'node:fs';
2
1
  import { isAbsolute, resolve } from 'node:path';
3
2
  import { isSea } from 'node:sea';
4
3
  import { fileURLToPath } from 'node:url';
5
4
  import { launchWorker } from "../backend/worker/launcher.js";
6
- import { checkWorkflowAuthoringDirectory, workflowAuthoringDirectory } from "./workflow-authoring-scope.js";
7
5
  const unavailable = () => new Error('Workflow authoring Scope unavailable');
8
6
  const changed = () => new Error('Workflow authoring Scope changed; discover again');
9
7
  const validPath = (path) => typeof path === 'string' && path.length > 0 && path.length <= 4096 && !path.includes('\0');
@@ -22,28 +20,12 @@ export class WorkflowAuthoringScopeChecks {
22
20
  async read(path) {
23
21
  if (this.closed || !validPath(path))
24
22
  throw unavailable();
25
- if (process.platform === 'linux' && this.options.linuxSync !== false) {
26
- try {
27
- return workflowAuthoringDirectory(realpathSync(path));
28
- }
29
- catch {
30
- throw unavailable();
31
- }
32
- }
33
23
  return this.inspect({ operation: 'read', path: resolve(path) });
34
24
  }
35
25
  async check(directory) {
36
26
  if (this.closed || !validDirectory(directory))
37
27
  throw changed();
38
28
  const pinned = { path: directory.path, identity: directory.identity };
39
- if (process.platform === 'linux' && this.options.linuxSync !== false) {
40
- try {
41
- return checkWorkflowAuthoringDirectory(pinned);
42
- }
43
- catch {
44
- throw changed();
45
- }
46
- }
47
29
  const actual = await this.inspect({ operation: 'check', ...pinned });
48
30
  if (actual.path !== pinned.path || actual.identity !== pinned.identity)
49
31
  throw changed();
@@ -293,10 +293,13 @@ export class WorkflowMcpAuthoringService {
293
293
  async bounded(work) {
294
294
  const deadline = Date.now() + 10_000;
295
295
  let timer;
296
+ const timeout = new Promise((_, reject) => {
297
+ timer = setTimeout(() => reject(new Error('MCP discovery timed out')), Math.max(0, deadline - Date.now()));
298
+ });
296
299
  try {
297
- return await Promise.race([work(deadline), new Promise((_, reject) => {
298
- timer = setTimeout(() => reject(new Error('MCP discovery timed out')), Math.max(0, deadline - Date.now()));
299
- })]);
300
+ const result = await Promise.race([timeout, work(deadline)]);
301
+ this.checkDeadline(deadline);
302
+ return result;
300
303
  }
301
304
  finally {
302
305
  clearTimeout(timer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nathanstephenson/flow",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",