@farm.js/agent 0.1.0-beta.0 → 0.1.0-beta.1

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.
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export { AgentFramework } from 'agent-unit';
7
7
  * Nitro and Workers settings, which belong in farm.config.
8
8
  */
9
9
  interface AgentOptions extends Omit<AgentUnitConfig, "server" | "preset" | "runtime" | "cloudflare" | "nitro"> {
10
- /** Where the agent API is mounted. It owns every path under it. Default `/api/agent`. */
10
+ /** Where the agent API is mounted, under `/api`. It owns every path under it. Default `/api/agent`. */
11
11
  basePath?: string;
12
12
  /** The folder of agent files, relative to the app root. Default `agents` in `srcDir`. */
13
13
  agentsDir?: string;
@@ -28,7 +28,79 @@ declare function agent(options?: AgentOptions): _farm_js_core.DefinedIntegration
28
28
  category: "agent";
29
29
  type: string;
30
30
  instance: AgentInstance;
31
- plugins: _farm_js_core.FarmPlugin<undefined, Record<string, never>, unknown, undefined, unknown, false, _farm_js_core.PluginRoutes>[];
31
+ plugins: _farm_js_core.FarmPlugin<undefined, Record<string, never>, unknown, undefined, unknown, false, (_farm_js_core.RouteDefinition<`/${string}`, "POST", {
32
+ __types: {
33
+ body: unknown;
34
+ inputBody: never;
35
+ query: never;
36
+ inputQuery: never;
37
+ headers: never;
38
+ inputHeaders: never;
39
+ response: unknown;
40
+ errors: never;
41
+ };
42
+ __path?: string;
43
+ __method?: string;
44
+ __openapi?: _farm_js_core.EndpointOpenAPIMetadata;
45
+ __mcp?: _farm_js_core.EndpointMCPOptions;
46
+ } & ((options?: {
47
+ body?: undefined;
48
+ query?: undefined;
49
+ headers?: undefined;
50
+ } | undefined) => Promise<unknown>) & {
51
+ __types: {
52
+ params: {};
53
+ inputHeaders: never;
54
+ };
55
+ }> | _farm_js_core.RouteDefinition<`/${string}`, "GET", {
56
+ __types: {
57
+ body: unknown;
58
+ inputBody: never;
59
+ query: never;
60
+ inputQuery: never;
61
+ headers: never;
62
+ inputHeaders: never;
63
+ response: unknown;
64
+ errors: never;
65
+ };
66
+ __path?: string;
67
+ __method?: string;
68
+ __openapi?: _farm_js_core.EndpointOpenAPIMetadata;
69
+ __mcp?: _farm_js_core.EndpointMCPOptions;
70
+ } & ((options?: {
71
+ body?: undefined;
72
+ query?: undefined;
73
+ headers?: undefined;
74
+ } | undefined) => Promise<unknown>) & {
75
+ __types: {
76
+ params: {};
77
+ inputHeaders: never;
78
+ };
79
+ }> | _farm_js_core.RouteDefinition<`/${string}`, "DELETE", {
80
+ __types: {
81
+ body: unknown;
82
+ inputBody: never;
83
+ query: never;
84
+ inputQuery: never;
85
+ headers: never;
86
+ inputHeaders: never;
87
+ response: unknown;
88
+ errors: never;
89
+ };
90
+ __path?: string;
91
+ __method?: string;
92
+ __openapi?: _farm_js_core.EndpointOpenAPIMetadata;
93
+ __mcp?: _farm_js_core.EndpointMCPOptions;
94
+ } & ((options?: {
95
+ body?: undefined;
96
+ query?: undefined;
97
+ headers?: undefined;
98
+ } | undefined) => Promise<unknown>) & {
99
+ __types: {
100
+ params: {};
101
+ inputHeaders: never;
102
+ };
103
+ }>)[]>[];
32
104
  }, _farm_js_core.FarmSchema | undefined>;
33
105
 
34
106
  export { type AgentInstance, type AgentOptions, agent };
package/dist/index.js CHANGED
@@ -8,58 +8,82 @@ function registerAgentUnitConfig(config) {
8
8
  }
9
9
 
10
10
  // src/plugin.ts
11
+ import { writeFileSync } from "fs";
11
12
  import path from "path";
12
- import { Readable } from "stream";
13
13
  import { fileURLToPath } from "url";
14
14
  import { definePlugin } from "@farm.js/core/plugin";
15
15
  var loadBuildOnly = (specifier) => import(
16
16
  /* @vite-ignore */
17
17
  specifier
18
18
  );
19
+ var AGENT_SERVER = /* @__PURE__ */ Symbol.for("farm.agent.server");
20
+ var METHODS = ["get", "post", "delete"];
19
21
  function isUnder(pathname, basePath) {
20
22
  return basePath === "/" || pathname === basePath || pathname.startsWith(`${basePath}/`);
21
23
  }
24
+ var SERVER_MODULE = `// Generated by @farm.js/agent. Do not edit.
25
+ import { AsyncLocalStorage } from "node:async_hooks";
26
+ import { getUnit } from "./runtime.mjs";
27
+
28
+ const hostWaitUntil = new AsyncLocalStorage();
29
+
30
+ globalThis[Symbol.for("farm.agent.server")] = {
31
+ handle(request) {
32
+ const waitUntil = hostWaitUntil.getStore();
33
+ return getUnit().handler(request, waitUntil ? { waitUntil } : {});
34
+ },
35
+ };
36
+
37
+ export default function farmAgentHost(event, next) {
38
+ const req = event.req;
39
+ return typeof req.waitUntil === "function"
40
+ ? hostWaitUntil.run((promise) => req.waitUntil(promise), next)
41
+ : next();
42
+ }
43
+ `;
22
44
  function createAgentPlugin(config) {
23
45
  const { basePath } = config;
24
46
  let root;
25
47
  let agentsDir = config.agentsDir ?? "agents";
48
+ let isDev = false;
26
49
  let devHandler;
50
+ const buildConfig = () => ({ ...config, agentsDir });
51
+ const startDev = () => devHandler ??= loadBuildOnly("agent-unit/build").then(
52
+ ({ createDevHandler }) => createDevHandler({ root: root ?? process.cwd(), config: buildConfig() })
53
+ );
27
54
  const closeDev = async () => {
28
55
  const pending = devHandler;
29
56
  devHandler = void 0;
30
57
  await (await pending?.catch(() => void 0))?.close();
31
58
  };
32
- const buildConfig = () => ({ ...config, agentsDir });
33
- const devPlugin = {
34
- name: "farm:agent-dev",
35
- apply: "serve",
36
- // Ahead of Farm's API middleware, which answers 404 for API paths it does not route.
37
- enforce: "pre",
38
- // Vite runs this again on every restart, while the agents keep running in one dev handler.
39
- configureServer(server) {
40
- devHandler ??= loadBuildOnly("agent-unit/build").then(
41
- ({ createDevHandler }) => createDevHandler({ root: root ?? process.cwd(), config: buildConfig() })
59
+ const handle = async (request) => {
60
+ if (isDev) return (await startDev()).fetch(request);
61
+ const server = globalThis[AGENT_SERVER];
62
+ if (!server) {
63
+ throw new Error(
64
+ "@farm.js/agent: this server was built without the agents. Build it with `farm build`, which adds them."
42
65
  );
43
- const handler = devHandler;
44
- server.middlewares.use((req, res, next) => {
45
- if (!isUnder((req.url ?? "/").split("?")[0], basePath)) return next();
46
- void serveDev(handler, req, res).catch(next);
47
- });
48
66
  }
67
+ return server.handle(request);
49
68
  };
50
69
  return definePlugin({
51
70
  name: "farm:agent",
52
71
  configure(farmConfig, context) {
53
72
  root = path.resolve(farmConfig.root ?? process.cwd());
54
73
  agentsDir = config.agentsDir ?? path.posix.join(farmConfig.srcDir ?? "src", "agents");
55
- if (!context.isDev) return;
56
- const vite = farmConfig.vite ?? {};
57
- return { ...farmConfig, vite: { ...vite, plugins: [devPlugin, ...vite.plugins ?? []] } };
74
+ isDev = context.isDev;
58
75
  },
76
+ // Ordinary API routes, so a request passes Farm's middleware, runtime.before and integration
77
+ // guards before it reaches the agents, in development and in every production target.
78
+ routes: ({ route }) => METHODS.flatMap(
79
+ (method) => [basePath, `${basePath}/[...path]`].map(
80
+ (pattern) => route[method](pattern, { handler: (request) => handle(request) })
81
+ )
82
+ ),
59
83
  router: {
60
84
  // agent-unit answers every path under basePath, so an app route there would never be reached.
61
85
  discovered(route) {
62
- if (route.kind !== "api" || !isUnder(route.path, basePath)) return;
86
+ if (route.kind !== "api" || !route.filePath || !isUnder(route.path, basePath)) return;
63
87
  throw new Error(
64
88
  `@farm.js/agent: ${route.filePath} is served at ${route.path}, which the agent API owns (basePath "${basePath}"). Move the route, or set another basePath.`
65
89
  );
@@ -67,21 +91,48 @@ function createAgentPlugin(config) {
67
91
  },
68
92
  build: {
69
93
  // agent-unit builds the agents into Farm's Nitro output for its preset: their framework
70
- // adapters, storage, the sweep and `tasks` as scheduled tasks.
94
+ // adapters, storage, the sweep and `tasks` as scheduled tasks. Its own handler for basePath
95
+ // would answer before Farm's, so Farm's routes serve the API instead.
71
96
  async configure(nitroConfig) {
72
97
  const { agentUnit } = await loadBuildOnly("agent-unit/nitro");
73
- const module = agentUnit({
98
+ const unit = agentUnit({
74
99
  root: root ?? process.cwd(),
75
100
  basePath,
76
101
  config: buildConfig(),
77
102
  // The module agent-unit's engine reads its config from in the built server.
78
103
  configFile: fileURLToPath(new URL("./config.js", import.meta.url))
79
104
  });
105
+ const module = {
106
+ name: unit.name,
107
+ async setup(nitro) {
108
+ const before = nitro.options.handlers.length;
109
+ await unit.setup(nitro);
110
+ const added = nitro.options.handlers.splice(before);
111
+ const entry = added.find((handler) => handler.handler.endsWith("entry.mjs"))?.handler;
112
+ if (!entry) {
113
+ throw new Error(
114
+ "@farm.js/agent: agent-unit's Nitro module did not mount its handler. Install the agent-unit version @farm.js/agent supports."
115
+ );
116
+ }
117
+ nitro.options.handlers.push(...added.filter((handler) => handler.handler !== entry));
118
+ const server = path.posix.join(
119
+ path.posix.dirname(entry.replaceAll("\\", "/")),
120
+ "farm-server.mjs"
121
+ );
122
+ writeFileSync(server, SERVER_MODULE);
123
+ nitro.options.handlers.push(
124
+ { route: basePath, handler: server, middleware: true, lazy: false },
125
+ { route: `${basePath}/**`, handler: server, middleware: true, lazy: false }
126
+ );
127
+ }
128
+ };
80
129
  return { ...nitroConfig, modules: [...nitroConfig.modules ?? [], module] };
81
130
  }
82
131
  },
83
132
  dev: {
84
133
  server(_viteServer, { lifecycle }) {
134
+ void startDev().catch(() => {
135
+ });
85
136
  lifecycle.onShutdown(closeDev);
86
137
  }
87
138
  },
@@ -90,33 +141,6 @@ function createAgentPlugin(config) {
90
141
  }
91
142
  });
92
143
  }
93
- async function serveDev(handler, req, res) {
94
- const { sendWebResponse } = await loadBuildOnly("@farm.js/core/server");
95
- const response = await (await handler).fetch(toWebRequest(req, res));
96
- await sendWebResponse(res, response);
97
- }
98
- function toWebRequest(req, res) {
99
- const protocol = req.socket.encrypted ? "https" : "http";
100
- const url = new URL(req.url ?? "/", `${protocol}://${req.headers.host ?? "localhost"}`);
101
- const headers = new Headers();
102
- for (let index = 0; index < req.rawHeaders.length; index += 2) {
103
- const name = req.rawHeaders[index];
104
- if (!name.startsWith(":")) headers.append(name, req.rawHeaders[index + 1]);
105
- }
106
- const controller = new AbortController();
107
- res.once("close", () => {
108
- if (!res.writableFinished) controller.abort();
109
- });
110
- const method = req.method ?? "GET";
111
- const hasBody = method !== "GET" && method !== "HEAD";
112
- return new Request(url, {
113
- method,
114
- headers,
115
- signal: controller.signal,
116
- body: hasBody ? Readable.toWeb(req) : void 0,
117
- ...hasBody ? { duplex: "half" } : {}
118
- });
119
- }
120
144
 
121
145
  // src/index.ts
122
146
  var DEFAULT_BASE_PATH = "/api/agent";
@@ -124,7 +148,11 @@ function normalizeBasePath(value) {
124
148
  if (!value.startsWith("/")) {
125
149
  throw new Error(`@farm.js/agent: basePath must start with "/", got "${value}".`);
126
150
  }
127
- return value.replace(/\/+$/, "") || "/";
151
+ const basePath = value.replace(/\/+$/, "");
152
+ if (basePath !== "/api" && !basePath.startsWith("/api/")) {
153
+ throw new Error(`@farm.js/agent: basePath must be under /api, got "${value}".`);
154
+ }
155
+ return basePath;
128
156
  }
129
157
  function agent(options = {}) {
130
158
  const basePath = normalizeBasePath(options.basePath ?? DEFAULT_BASE_PATH);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/plugin.ts"],"sourcesContent":["import { defineIntegration } from \"@farm.js/core\";\nimport type { AgentFramework, AgentUnitConfig } from \"agent-unit\";\n\nimport { registerAgentUnitConfig } from \"./config.js\";\nimport { createAgentPlugin } from \"./plugin.js\";\n\nexport type { AgentFramework };\n\n/**\n * agent-unit's settings, minus what Farm owns: the host (`deploy.target`), the server and the\n * Nitro and Workers settings, which belong in farm.config.\n */\nexport interface AgentOptions extends Omit<\n AgentUnitConfig,\n \"server\" | \"preset\" | \"runtime\" | \"cloudflare\" | \"nitro\"\n> {\n /** Where the agent API is mounted. It owns every path under it. Default `/api/agent`. */\n basePath?: string;\n /** The folder of agent files, relative to the app root. Default `agents` in `srcDir`. */\n agentsDir?: string;\n}\n\nexport interface AgentInstance {\n readonly basePath: string;\n readonly framework?: AgentFramework;\n}\n\nconst DEFAULT_BASE_PATH = \"/api/agent\";\n\nfunction normalizeBasePath(value: string): string {\n if (!value.startsWith(\"/\")) {\n throw new Error(`@farm.js/agent: basePath must start with \"/\", got \"${value}\".`);\n }\n return value.replace(/\\/+$/, \"\") || \"/\";\n}\n\n/**\n * Durable agents in a Farm app: the agents in `src/agents`, written with the AI SDK, Mastra,\n * LangGraph, the OpenAI Agents SDK or agent-unit's `defineAgent`, served under `basePath` in\n * `farm dev` and built by agent-unit into every deployment target.\n *\n * @example\n * integrations: { agent: agent({ framework: \"ai-sdk\", storage: { driver: \"redis\", url: process.env.REDIS_URL } }) }\n */\nexport function agent(options: AgentOptions = {}) {\n const basePath = normalizeBasePath(options.basePath ?? DEFAULT_BASE_PATH);\n const config: AgentUnitConfig & { basePath: string } = { ...options, basePath };\n const instance: AgentInstance = { basePath, framework: options.framework };\n // agent-unit's engine reads it from the server that evaluates farm.config (see ./config).\n registerAgentUnitConfig(config);\n\n return defineIntegration({\n category: \"agent\",\n type: \"agent-unit\",\n instance,\n plugins: [createAgentPlugin(config)],\n });\n}\n","import type { AgentUnitConfig } from \"agent-unit\";\n\nconst AGENT_UNIT_CONFIG = Symbol.for(\"farm.agent.config\");\n\ntype ConfigHolder = { [AGENT_UNIT_CONFIG]?: AgentUnitConfig };\n\n/** @internal Called by `agent()` as farm.config evaluates, in Farm's process and in the server. */\nexport function registerAgentUnitConfig(config: AgentUnitConfig): void {\n (globalThis as ConfigHolder)[AGENT_UNIT_CONFIG] = config;\n}\n\n/**\n * The agent-unit config of the app's `agent()` integration. agent-unit's engine reads it when it is\n * first used: by then Farm's server has evaluated farm.config, so settings such as storage URLs and\n * `authorize` come from where the server runs.\n */\nexport default function agentUnitConfig(): AgentUnitConfig {\n const config = (globalThis as ConfigHolder)[AGENT_UNIT_CONFIG];\n if (!config) {\n throw new Error(\n \"@farm.js/agent: the server has not evaluated farm.config, so the agent() settings are missing. Mount agent() under `integrations` in farm.config.\",\n );\n }\n return config;\n}\n","import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport type { TLSSocket } from \"node:tls\";\nimport { fileURLToPath } from \"node:url\";\nimport { definePlugin } from \"@farm.js/core/plugin\";\nimport type { AgentUnitConfig } from \"agent-unit\";\nimport type { DevHandler } from \"agent-unit/build\";\nimport type { Plugin as VitePlugin } from \"vite\";\n\n// agent-unit's build and dev servers load only in Farm's own process. Farm bundles farm.config into\n// the production server, and a bundler follows literal imports, so these must not be literal.\nconst loadBuildOnly = <T>(specifier: string): Promise<T> => import(/* @vite-ignore */ specifier);\n\nexport function isUnder(pathname: string, basePath: string): boolean {\n return basePath === \"/\" || pathname === basePath || pathname.startsWith(`${basePath}/`);\n}\n\n/** Serves the agents in `farm dev` and builds them into the production server. */\nexport function createAgentPlugin(config: AgentUnitConfig & { basePath: string }) {\n const { basePath } = config;\n // Set by `configure`, in Farm's process: farm.config also evaluates inside the server, where a\n // Worker has no working directory.\n let root: string | undefined;\n let agentsDir = config.agentsDir ?? \"agents\";\n let devHandler: Promise<DevHandler> | undefined;\n\n const closeDev = async () => {\n const pending = devHandler;\n devHandler = undefined;\n await (await pending?.catch(() => undefined))?.close();\n };\n const buildConfig = (): AgentUnitConfig => ({ ...config, agentsDir });\n\n const devPlugin: VitePlugin = {\n name: \"farm:agent-dev\",\n apply: \"serve\",\n // Ahead of Farm's API middleware, which answers 404 for API paths it does not route.\n enforce: \"pre\",\n // Vite runs this again on every restart, while the agents keep running in one dev handler.\n configureServer(server) {\n devHandler ??= loadBuildOnly<typeof import(\"agent-unit/build\")>(\"agent-unit/build\").then(\n ({ createDevHandler }) =>\n createDevHandler({ root: root ?? process.cwd(), config: buildConfig() }),\n );\n const handler = devHandler;\n server.middlewares.use((req, res, next) => {\n if (!isUnder((req.url ?? \"/\").split(\"?\")[0]!, basePath)) return next();\n void serveDev(handler, req, res).catch(next);\n });\n },\n };\n\n return definePlugin({\n name: \"farm:agent\",\n configure(farmConfig, context) {\n root = path.resolve(farmConfig.root ?? process.cwd());\n agentsDir = config.agentsDir ?? path.posix.join(farmConfig.srcDir ?? \"src\", \"agents\");\n if (!context.isDev) return;\n const vite = farmConfig.vite ?? {};\n return { ...farmConfig, vite: { ...vite, plugins: [devPlugin, ...(vite.plugins ?? [])] } };\n },\n router: {\n // agent-unit answers every path under basePath, so an app route there would never be reached.\n discovered(route) {\n if (route.kind !== \"api\" || !isUnder(route.path, basePath)) return;\n throw new Error(\n `@farm.js/agent: ${route.filePath} is served at ${route.path}, which the agent API owns (basePath \"${basePath}\"). Move the route, or set another basePath.`,\n );\n },\n },\n build: {\n // agent-unit builds the agents into Farm's Nitro output for its preset: their framework\n // adapters, storage, the sweep and `tasks` as scheduled tasks.\n async configure(nitroConfig) {\n const { agentUnit } =\n await loadBuildOnly<typeof import(\"agent-unit/nitro\")>(\"agent-unit/nitro\");\n const module = agentUnit({\n root: root ?? process.cwd(),\n basePath,\n config: buildConfig(),\n // The module agent-unit's engine reads its config from in the built server.\n configFile: fileURLToPath(new URL(\"./config.js\", import.meta.url)),\n });\n return { ...nitroConfig, modules: [...(nitroConfig.modules ?? []), module] };\n },\n },\n dev: {\n server(_viteServer, { lifecycle }) {\n lifecycle.onShutdown(closeDev);\n },\n },\n runtime: {\n close: closeDev,\n },\n });\n}\n\nasync function serveDev(\n handler: Promise<DevHandler>,\n req: IncomingMessage,\n res: ServerResponse,\n): Promise<void> {\n const { sendWebResponse } =\n await loadBuildOnly<typeof import(\"@farm.js/core/server\")>(\"@farm.js/core/server\");\n const response = await (await handler).fetch(toWebRequest(req, res));\n await sendWebResponse(res, response);\n}\n\nfunction toWebRequest(req: IncomingMessage, res: ServerResponse): Request {\n const protocol = (req.socket as TLSSocket).encrypted ? \"https\" : \"http\";\n const url = new URL(req.url ?? \"/\", `${protocol}://${req.headers.host ?? \"localhost\"}`);\n const headers = new Headers();\n for (let index = 0; index < req.rawHeaders.length; index += 2) {\n const name = req.rawHeaders[index]!;\n if (!name.startsWith(\":\")) headers.append(name, req.rawHeaders[index + 1]!);\n }\n // A client that leaves an event stream ends the run's subscription, not the run.\n const controller = new AbortController();\n res.once(\"close\", () => {\n if (!res.writableFinished) controller.abort();\n });\n const method = req.method ?? \"GET\";\n const hasBody = method !== \"GET\" && method !== \"HEAD\";\n return new Request(url, {\n method,\n headers,\n signal: controller.signal,\n body: hasBody ? (Readable.toWeb(req) as ReadableStream<Uint8Array>) : undefined,\n ...(hasBody ? { duplex: \"half\" } : {}),\n } as RequestInit);\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;;;ACElC,IAAM,oBAAoB,uBAAO,IAAI,mBAAmB;AAKjD,SAAS,wBAAwB,QAA+B;AACrE,EAAC,WAA4B,iBAAiB,IAAI;AACpD;;;ACRA,OAAO,UAAU;AACjB,SAAS,gBAAgB;AAEzB,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAO7B,IAAM,gBAAgB,CAAI,cAAkC;AAAA;AAAA,EAA0B;AAAA;AAE/E,SAAS,QAAQ,UAAkB,UAA2B;AACnE,SAAO,aAAa,OAAO,aAAa,YAAY,SAAS,WAAW,GAAG,QAAQ,GAAG;AACxF;AAGO,SAAS,kBAAkB,QAAgD;AAChF,QAAM,EAAE,SAAS,IAAI;AAGrB,MAAI;AACJ,MAAI,YAAY,OAAO,aAAa;AACpC,MAAI;AAEJ,QAAM,WAAW,YAAY;AAC3B,UAAM,UAAU;AAChB,iBAAa;AACb,WAAO,MAAM,SAAS,MAAM,MAAM,MAAS,IAAI,MAAM;AAAA,EACvD;AACA,QAAM,cAAc,OAAwB,EAAE,GAAG,QAAQ,UAAU;AAEnE,QAAM,YAAwB;AAAA,IAC5B,MAAM;AAAA,IACN,OAAO;AAAA;AAAA,IAEP,SAAS;AAAA;AAAA,IAET,gBAAgB,QAAQ;AACtB,qBAAe,cAAiD,kBAAkB,EAAE;AAAA,QAClF,CAAC,EAAE,iBAAiB,MAClB,iBAAiB,EAAE,MAAM,QAAQ,QAAQ,IAAI,GAAG,QAAQ,YAAY,EAAE,CAAC;AAAA,MAC3E;AACA,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ClB;;;AFxGA,IAAM,oBAAoB;AAE1B,SAAS,kBAAkB,OAAuB;AAChD,MAAI,CAAC,MAAM,WAAW,GAAG,GAAG;AAC1B,UAAM,IAAI,MAAM,sDAAsD,KAAK,IAAI;AAAA,EACjF;AACA,SAAO,MAAM,QAAQ,QAAQ,EAAE,KAAK;AACtC;AAUO,SAAS,MAAM,UAAwB,CAAC,GAAG;AAChD,QAAM,WAAW,kBAAkB,QAAQ,YAAY,iBAAiB;AACxE,QAAM,SAAiD,EAAE,GAAG,SAAS,SAAS;AAC9E,QAAM,WAA0B,EAAE,UAAU,WAAW,QAAQ,UAAU;AAEzE,0BAAwB,MAAM;AAE9B,SAAO,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,MAAM;AAAA,IACN;AAAA,IACA,SAAS,CAAC,kBAAkB,MAAM,CAAC;AAAA,EACrC,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/config.ts","../src/plugin.ts"],"sourcesContent":["import { defineIntegration } from \"@farm.js/core\";\nimport type { AgentFramework, AgentUnitConfig } from \"agent-unit\";\n\nimport { registerAgentUnitConfig } from \"./config.js\";\nimport { createAgentPlugin } from \"./plugin.js\";\n\nexport type { AgentFramework };\n\n/**\n * agent-unit's settings, minus what Farm owns: the host (`deploy.target`), the server and the\n * Nitro and Workers settings, which belong in farm.config.\n */\nexport interface AgentOptions extends Omit<\n AgentUnitConfig,\n \"server\" | \"preset\" | \"runtime\" | \"cloudflare\" | \"nitro\"\n> {\n /** Where the agent API is mounted, under `/api`. It owns every path under it. Default `/api/agent`. */\n basePath?: string;\n /** The folder of agent files, relative to the app root. Default `agents` in `srcDir`. */\n agentsDir?: string;\n}\n\nexport interface AgentInstance {\n readonly basePath: string;\n readonly framework?: AgentFramework;\n}\n\nconst DEFAULT_BASE_PATH = \"/api/agent\";\n\nfunction normalizeBasePath(value: string): string {\n if (!value.startsWith(\"/\")) {\n throw new Error(`@farm.js/agent: basePath must start with \"/\", got \"${value}\".`);\n }\n const basePath = value.replace(/\\/+$/, \"\");\n // The agents are API routes, so Farm's middleware and guards run for them.\n if (basePath !== \"/api\" && !basePath.startsWith(\"/api/\")) {\n throw new Error(`@farm.js/agent: basePath must be under /api, got \"${value}\".`);\n }\n return basePath;\n}\n\n/**\n * Durable agents in a Farm app: the agents in `src/agents`, written with the AI SDK, Mastra,\n * LangGraph, the OpenAI Agents SDK or agent-unit's `defineAgent`, served under `basePath` in\n * `farm dev` and built by agent-unit into every deployment target.\n *\n * @example\n * integrations: { agent: agent({ framework: \"ai-sdk\", storage: { driver: \"redis\", url: process.env.REDIS_URL } }) }\n */\nexport function agent(options: AgentOptions = {}) {\n const basePath = normalizeBasePath(options.basePath ?? DEFAULT_BASE_PATH);\n const config: AgentUnitConfig & { basePath: string } = { ...options, basePath };\n const instance: AgentInstance = { basePath, framework: options.framework };\n // agent-unit's engine reads it from the server that evaluates farm.config (see ./config).\n registerAgentUnitConfig(config);\n\n return defineIntegration({\n category: \"agent\",\n type: \"agent-unit\",\n instance,\n plugins: [createAgentPlugin(config)],\n });\n}\n","import type { AgentUnitConfig } from \"agent-unit\";\n\nconst AGENT_UNIT_CONFIG = Symbol.for(\"farm.agent.config\");\n\ntype ConfigHolder = { [AGENT_UNIT_CONFIG]?: AgentUnitConfig };\n\n/** @internal Called by `agent()` as farm.config evaluates, in Farm's process and in the server. */\nexport function registerAgentUnitConfig(config: AgentUnitConfig): void {\n (globalThis as ConfigHolder)[AGENT_UNIT_CONFIG] = config;\n}\n\n/**\n * The agent-unit config of the app's `agent()` integration. agent-unit's engine reads it when it is\n * first used: by then Farm's server has evaluated farm.config, so settings such as storage URLs and\n * `authorize` come from where the server runs.\n */\nexport default function agentUnitConfig(): AgentUnitConfig {\n const config = (globalThis as ConfigHolder)[AGENT_UNIT_CONFIG];\n if (!config) {\n throw new Error(\n \"@farm.js/agent: the server has not evaluated farm.config, so the agent() settings are missing. Mount agent() under `integrations` in farm.config.\",\n );\n }\n return config;\n}\n","import { writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { definePlugin } from \"@farm.js/core/plugin\";\nimport type { AgentUnitConfig } from \"agent-unit\";\nimport type { DevHandler } from \"agent-unit/build\";\n\n// agent-unit's build and dev servers load only in Farm's own process. Farm bundles farm.config into\n// the production server, and a bundler follows literal imports, so these must not be literal.\nconst loadBuildOnly = <T>(specifier: string): Promise<T> => import(/* @vite-ignore */ specifier);\n\n/** Set by the built server's agent module (see SERVER_MODULE): agent-unit's engine. */\nconst AGENT_SERVER = Symbol.for(\"farm.agent.server\");\ntype AgentServer = { handle(request: Request): Promise<Response> };\ntype ServerHolder = { [AGENT_SERVER]?: AgentServer };\n\n// Every method agent-unit answers: the run API, MCP and the internal continue and sweep endpoints.\nconst METHODS = [\"get\", \"post\", \"delete\"] as const;\n\nexport function isUnder(pathname: string, basePath: string): boolean {\n return basePath === \"/\" || pathname === basePath || pathname.startsWith(`${basePath}/`);\n}\n\n// The built server's agent module, next to agent-unit's runtime. It hands the engine to the routes\n// below, and as Nitro middleware on the agent paths it passes on the host's waitUntil, which only\n// hosts that keep work alive after the response have, as agent-unit's own entry does.\nconst SERVER_MODULE = `// Generated by @farm.js/agent. Do not edit.\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { getUnit } from \"./runtime.mjs\";\n\nconst hostWaitUntil = new AsyncLocalStorage();\n\nglobalThis[Symbol.for(\"farm.agent.server\")] = {\n handle(request) {\n const waitUntil = hostWaitUntil.getStore();\n return getUnit().handler(request, waitUntil ? { waitUntil } : {});\n },\n};\n\nexport default function farmAgentHost(event, next) {\n const req = event.req;\n return typeof req.waitUntil === \"function\"\n ? hostWaitUntil.run((promise) => req.waitUntil(promise), next)\n : next();\n}\n`;\n\n/**\n * Serves the agents in `farm dev` and builds them into the production server, as API routes under\n * `basePath`: Farm's middleware, plugin guards and integration guards run for them as for any route.\n */\nexport function createAgentPlugin(config: AgentUnitConfig & { basePath: string }) {\n const { basePath } = config;\n // Set by `configure`, in Farm's process: farm.config also evaluates inside the server, where a\n // Worker has no working directory.\n let root: string | undefined;\n let agentsDir = config.agentsDir ?? \"agents\";\n let isDev = false;\n let devHandler: Promise<DevHandler> | undefined;\n\n const buildConfig = (): AgentUnitConfig => ({ ...config, agentsDir });\n const startDev = () =>\n (devHandler ??= loadBuildOnly<typeof import(\"agent-unit/build\")>(\"agent-unit/build\").then(\n ({ createDevHandler }) =>\n createDevHandler({ root: root ?? process.cwd(), config: buildConfig() }),\n ));\n const closeDev = async () => {\n const pending = devHandler;\n devHandler = undefined;\n await (await pending?.catch(() => undefined))?.close();\n };\n\n const handle = async (request: Request): Promise<Response> => {\n // A dev server runs the agents from source, kept across Vite restarts.\n if (isDev) return (await startDev()).fetch(request);\n const server = (globalThis as ServerHolder)[AGENT_SERVER];\n if (!server) {\n throw new Error(\n \"@farm.js/agent: this server was built without the agents. Build it with `farm build`, which adds them.\",\n );\n }\n return server.handle(request);\n };\n\n return definePlugin({\n name: \"farm:agent\",\n configure(farmConfig, context) {\n root = path.resolve(farmConfig.root ?? process.cwd());\n agentsDir = config.agentsDir ?? path.posix.join(farmConfig.srcDir ?? \"src\", \"agents\");\n isDev = context.isDev;\n },\n // Ordinary API routes, so a request passes Farm's middleware, runtime.before and integration\n // guards before it reaches the agents, in development and in every production target.\n routes: ({ route }) =>\n METHODS.flatMap((method) =>\n [basePath, `${basePath}/[...path]`].map((pattern) =>\n route[method](pattern, { handler: (request) => handle(request) }),\n ),\n ),\n router: {\n // agent-unit answers every path under basePath, so an app route there would never be reached.\n discovered(route) {\n if (route.kind !== \"api\" || !route.filePath || !isUnder(route.path, basePath)) return;\n throw new Error(\n `@farm.js/agent: ${route.filePath} is served at ${route.path}, which the agent API owns (basePath \"${basePath}\"). Move the route, or set another basePath.`,\n );\n },\n },\n build: {\n // agent-unit builds the agents into Farm's Nitro output for its preset: their framework\n // adapters, storage, the sweep and `tasks` as scheduled tasks. Its own handler for basePath\n // would answer before Farm's, so Farm's routes serve the API instead.\n async configure(nitroConfig) {\n const { agentUnit } =\n await loadBuildOnly<typeof import(\"agent-unit/nitro\")>(\"agent-unit/nitro\");\n const unit = agentUnit({\n root: root ?? process.cwd(),\n basePath,\n config: buildConfig(),\n // The module agent-unit's engine reads its config from in the built server.\n configFile: fileURLToPath(new URL(\"./config.js\", import.meta.url)),\n });\n const module: typeof unit = {\n name: unit.name,\n async setup(nitro) {\n const before = nitro.options.handlers.length;\n await unit.setup!(nitro);\n const added = nitro.options.handlers.splice(before);\n const entry = added.find((handler) => handler.handler.endsWith(\"entry.mjs\"))?.handler;\n if (!entry) {\n throw new Error(\n \"@farm.js/agent: agent-unit's Nitro module did not mount its handler. Install the agent-unit version @farm.js/agent supports.\",\n );\n }\n nitro.options.handlers.push(...added.filter((handler) => handler.handler !== entry));\n // Nitro writes handler paths into generated imports, so keep them in forward-slash\n // form; a Windows `D:\\…` path would lose its backslashes there.\n const server = path.posix.join(\n path.posix.dirname(entry.replaceAll(\"\\\\\", \"/\")),\n \"farm-server.mjs\",\n );\n writeFileSync(server, SERVER_MODULE);\n nitro.options.handlers.push(\n { route: basePath, handler: server, middleware: true, lazy: false },\n { route: `${basePath}/**`, handler: server, middleware: true, lazy: false },\n );\n },\n };\n return { ...nitroConfig, modules: [...(nitroConfig.modules ?? []), module] };\n },\n },\n dev: {\n server(_viteServer, { lifecycle }) {\n void startDev().catch(() => {});\n lifecycle.onShutdown(closeDev);\n },\n },\n runtime: {\n close: closeDev,\n },\n });\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;;;ACElC,IAAM,oBAAoB,uBAAO,IAAI,mBAAmB;AAKjD,SAAS,wBAAwB,QAA+B;AACrE,EAAC,WAA4B,iBAAiB,IAAI;AACpD;;;ACTA,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAM7B,IAAM,gBAAgB,CAAI,cAAkC;AAAA;AAAA,EAA0B;AAAA;AAGtF,IAAM,eAAe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E,0BAAwB,MAAM;AAE9B,SAAO,kBAAkB;AAAA,IACvB,UAAU;AAAA,IACV,MAAM;AAAA,IACN;AAAA,IACA,SAAS,CAAC,kBAAkB,MAAM,CAAC;AAAA,EACrC,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/agent",
3
- "version": "0.1.0-beta.0",
3
+ "version": "0.1.0-beta.1",
4
4
  "description": "Durable agents for Farm.js, served and built by agent-unit",
5
5
  "keywords": [
6
6
  "agent-unit",
@@ -44,10 +44,10 @@
44
44
  "typescript": "^5.3.3",
45
45
  "vite": "8.3.4",
46
46
  "vitest": "5.0.5",
47
- "@farm.js/core": "0.1.48"
47
+ "@farm.js/core": "0.1.50"
48
48
  },
49
49
  "peerDependencies": {
50
- "@farm.js/core": ">=0.1.48 <0.2.0"
50
+ "@farm.js/core": ">=0.1.50 <0.2.0"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22.13.0"