@farm.js/eve 0.1.0-beta.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.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Farm.js Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @farm.js/eve
2
+
3
+ First-class Eve agent runtime integration for Farm.js
4
+
5
+ Farm.js is currently in beta.
6
+
7
+ ```bash
8
+ npm install @farm.js/eve@beta
9
+ ```
10
+
11
+ See the [Farm.js repository](https://github.com/farming-labs/farm.js) for documentation, examples, and support.
@@ -0,0 +1,44 @@
1
+ import { FarmAgentRuntimeInstance, createAgentRuntimeIntegration } from '@farm.js/core/agent-runtime';
2
+
3
+ interface EveDevOptions {
4
+ /** Maximum time to wait for the Eve server. Defaults to 180 seconds. */
5
+ timeoutMs?: number;
6
+ /** Forward Eve's process output through Farm's logger. Defaults to true. */
7
+ logs?: boolean;
8
+ /** Label shown by Eve for this agent. */
9
+ name?: string;
10
+ }
11
+ interface EveVercelOptions {
12
+ /** Internal Vercel service mount. Public Eve routes remain under /eve. */
13
+ servicePrefix?: string;
14
+ /** Override the command Vercel uses to build the Eve service. */
15
+ buildCommand?: string;
16
+ }
17
+ interface EveOptions {
18
+ /** Eve application root, relative to farm.config.ts. Defaults to the Farm root. */
19
+ root?: string;
20
+ /** Use an already-running Eve service instead of starting one in development. */
21
+ origin?: string;
22
+ /** Disable managed local development or configure its process. */
23
+ dev?: false | EveDevOptions;
24
+ /** Disable automatic Vercel service composition or configure it. */
25
+ vercel?: false | EveVercelOptions;
26
+ }
27
+ interface EveRuntime extends FarmAgentRuntimeInstance {
28
+ readonly root: string;
29
+ }
30
+ type BaseEveIntegration = ReturnType<typeof createAgentRuntimeIntegration>;
31
+ type EveIntegration = Omit<BaseEveIntegration, "instance"> & {
32
+ readonly instance: EveRuntime;
33
+ };
34
+ /**
35
+ * Hosts a filesystem-first Eve agent beside a Farm application.
36
+ *
37
+ * @example
38
+ * integrations: { agent: eve() }
39
+ */
40
+ declare function eve(options?: EveOptions): EveIntegration;
41
+ declare function findEveServerOrigin(output: string): string | undefined;
42
+ declare function assertEveNodeVersion(version?: string): void;
43
+
44
+ export { type EveDevOptions, type EveIntegration, type EveOptions, type EveRuntime, type EveVercelOptions, assertEveNodeVersion, eve, findEveServerOrigin };
package/dist/index.js ADDED
@@ -0,0 +1,204 @@
1
+ // src/index.ts
2
+ import { resolve as resolve2 } from "path";
3
+ import {
4
+ createAgentRuntimeIntegration,
5
+ resolveProjectPackageBin,
6
+ startManagedAgentRuntime
7
+ } from "@farm.js/core/agent-runtime";
8
+
9
+ // src/vercel.ts
10
+ import { spawn } from "child_process";
11
+ import { readFile } from "fs/promises";
12
+ import { join, resolve } from "path";
13
+ var EVE_VERCEL_RUNNER = `
14
+ import { withEve } from "eve/next";
15
+ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
16
+ import { join } from "node:path";
17
+
18
+ const options = JSON.parse(
19
+ Buffer.from(process.argv[1], "base64url").toString("utf8"),
20
+ );
21
+ const projectPath = join(process.cwd(), ".vercel", "project.json");
22
+ let createdProjectMarker = false;
23
+
24
+ try {
25
+ await readFile(projectPath, "utf8");
26
+ } catch (error) {
27
+ if (!(error instanceof Error && "code" in error && error.code === "ENOENT")) throw error;
28
+ await mkdir(join(process.cwd(), ".vercel"), { recursive: true });
29
+ await writeFile(projectPath, "{}\\n");
30
+ createdProjectMarker = true;
31
+ }
32
+
33
+ try {
34
+ const resolveConfig = withEve({}, options);
35
+ await resolveConfig("phase-production-build", {});
36
+ } finally {
37
+ if (createdProjectMarker) await rm(projectPath, { force: true });
38
+ }
39
+ `;
40
+ async function writeEveVercelOutput(options) {
41
+ const root = resolve(options.root);
42
+ const outputConfigPath = join(root, ".vercel", "output", "config.json");
43
+ await assertFarmVercelOutput(outputConfigPath);
44
+ const serializedOptions = Buffer.from(
45
+ JSON.stringify({
46
+ eveRoot: resolve(root, options.agentRoot),
47
+ ...options.servicePrefix ? { servicePrefix: options.servicePrefix } : {},
48
+ ...options.buildCommand ? { eveBuildCommand: options.buildCommand } : {}
49
+ })
50
+ ).toString("base64url");
51
+ await runEveVercelAdapter({
52
+ command: options.nodePath || process.execPath,
53
+ cwd: root,
54
+ encodedOptions: serializedOptions,
55
+ onOutput: options.onOutput
56
+ });
57
+ await assertEveService(outputConfigPath);
58
+ }
59
+ async function assertFarmVercelOutput(configPath) {
60
+ try {
61
+ await readFile(configPath, "utf8");
62
+ } catch {
63
+ throw new Error(
64
+ `Farm Vercel output was not found at ${configPath}. Build with the vercel preset before composing Eve.`
65
+ );
66
+ }
67
+ }
68
+ async function assertEveService(configPath) {
69
+ const config = JSON.parse(await readFile(configPath, "utf8"));
70
+ const services = Array.isArray(config.services) ? config.services : Object.values(config.services || {});
71
+ if (!services.some((service) => service.framework === "eve")) {
72
+ throw new Error("Eve did not add its service to Farm's Vercel output.");
73
+ }
74
+ }
75
+ async function runEveVercelAdapter(input) {
76
+ await new Promise((resolveRun, reject) => {
77
+ const child = spawn(
78
+ input.command,
79
+ ["--input-type=module", "--eval", EVE_VERCEL_RUNNER, input.encodedOptions],
80
+ {
81
+ cwd: input.cwd,
82
+ env: {
83
+ ...process.env,
84
+ VERCEL: process.env.VERCEL || "1"
85
+ },
86
+ stdio: ["ignore", "pipe", "pipe"]
87
+ }
88
+ );
89
+ let output = "";
90
+ const onData = (chunk, stream) => {
91
+ const text = chunk.toString("utf8");
92
+ output = `${output}${text}`.slice(-16384);
93
+ for (const line of text.split(/\r?\n/)) {
94
+ if (line) input.onOutput?.(line, stream);
95
+ }
96
+ };
97
+ child.stdout?.on("data", (chunk) => onData(chunk, "stdout"));
98
+ child.stderr?.on("data", (chunk) => onData(chunk, "stderr"));
99
+ child.once("error", reject);
100
+ child.once("close", (code, signal) => {
101
+ if (code === 0) {
102
+ resolveRun();
103
+ return;
104
+ }
105
+ reject(
106
+ new Error(
107
+ `Eve Vercel output adapter failed (code ${String(code)}, signal ${String(signal)}).${output ? `
108
+ ${output.trim()}` : ""}`
109
+ )
110
+ );
111
+ });
112
+ });
113
+ }
114
+
115
+ // src/index.ts
116
+ var EVE_ROUTE_PREFIX = "/eve";
117
+ var EVE_WORKFLOW_ROUTE_PREFIX = "/.well-known/workflow";
118
+ var EVE_HEALTH_PATH = "/eve/v1/health";
119
+ function eve(options = {}) {
120
+ const configuredRoot = options.root || ".";
121
+ const devOptions = options.dev === false ? void 0 : options.dev || {};
122
+ const vercelOptions = options.vercel === false ? void 0 : options.vercel || {};
123
+ const composeVercel = Boolean(
124
+ vercelOptions && !options.origin && !process.env.EVE_BASE_URL?.trim()
125
+ );
126
+ return createAgentRuntimeIntegration({
127
+ provider: "eve",
128
+ routePrefix: EVE_ROUTE_PREFIX,
129
+ additionalRoutePrefixes: [EVE_WORKFLOW_ROUTE_PREFIX],
130
+ origin: options.origin,
131
+ originEnv: "EVE_BASE_URL",
132
+ instance: {
133
+ root: configuredRoot
134
+ },
135
+ ...devOptions ? {
136
+ async startDev(context) {
137
+ assertEveNodeVersion();
138
+ const binary = await resolveProjectPackageBin(context.root, "eve", "eve");
139
+ const agentRoot = resolve2(context.root, configuredRoot);
140
+ const showLogs = devOptions.logs !== false;
141
+ return startManagedAgentRuntime({
142
+ command: process.execPath,
143
+ args: [
144
+ binary,
145
+ "dev",
146
+ "--no-ui",
147
+ "--host",
148
+ "127.0.0.1",
149
+ "--port",
150
+ "0",
151
+ ...devOptions.name ? ["--name", devOptions.name] : []
152
+ ],
153
+ cwd: agentRoot,
154
+ label: "Eve development server",
155
+ resolveOrigin: findEveServerOrigin,
156
+ healthPath: EVE_HEALTH_PATH,
157
+ timeoutMs: devOptions.timeoutMs ?? 18e4,
158
+ onOutput: showLogs ? (line, stream) => {
159
+ const message = `[eve] ${line}`;
160
+ if (stream === "stderr") context.log.warn(message);
161
+ else context.log.info(message);
162
+ } : void 0
163
+ });
164
+ }
165
+ } : {},
166
+ ...composeVercel ? {
167
+ async afterBuild(context) {
168
+ if (context.preset !== "vercel" && context.preset !== "vercel-edge") {
169
+ return;
170
+ }
171
+ assertEveNodeVersion();
172
+ await writeEveVercelOutput({
173
+ root: context.root,
174
+ agentRoot: configuredRoot,
175
+ servicePrefix: vercelOptions?.servicePrefix,
176
+ buildCommand: vercelOptions?.buildCommand
177
+ });
178
+ }
179
+ } : {}
180
+ });
181
+ }
182
+ function findEveServerOrigin(output) {
183
+ for (const match of output.matchAll(/https?:\/\/[^\s"'<>]+/gi)) {
184
+ try {
185
+ const url = new URL(match[0]);
186
+ const isLoopback = url.hostname === "localhost" || url.hostname === "[::1]" || url.hostname === "::1" || /^127(?:\.\d{1,3}){3}$/.test(url.hostname);
187
+ if (isLoopback && url.port) return url.origin;
188
+ } catch {
189
+ }
190
+ }
191
+ return void 0;
192
+ }
193
+ function assertEveNodeVersion(version = process.versions.node) {
194
+ const major = Number.parseInt(version.split(".")[0] || "0", 10);
195
+ if (!Number.isFinite(major) || major < 24) {
196
+ throw new Error(`Eve requires Node.js 24 or newer. Farm is running Node.js ${version}.`);
197
+ }
198
+ }
199
+ export {
200
+ assertEveNodeVersion,
201
+ eve,
202
+ findEveServerOrigin
203
+ };
204
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/vercel.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport {\n createAgentRuntimeIntegration,\n resolveProjectPackageBin,\n startManagedAgentRuntime,\n type FarmAgentRuntimeInstance,\n} from \"@farm.js/core/agent-runtime\";\nimport { writeEveVercelOutput } from \"./vercel\";\n\nconst EVE_ROUTE_PREFIX = \"/eve\";\nconst EVE_WORKFLOW_ROUTE_PREFIX = \"/.well-known/workflow\";\nconst EVE_HEALTH_PATH = \"/eve/v1/health\";\n\nexport interface EveDevOptions {\n /** Maximum time to wait for the Eve server. Defaults to 180 seconds. */\n timeoutMs?: number;\n /** Forward Eve's process output through Farm's logger. Defaults to true. */\n logs?: boolean;\n /** Label shown by Eve for this agent. */\n name?: string;\n}\n\nexport interface EveVercelOptions {\n /** Internal Vercel service mount. Public Eve routes remain under /eve. */\n servicePrefix?: string;\n /** Override the command Vercel uses to build the Eve service. */\n buildCommand?: string;\n}\n\nexport interface EveOptions {\n /** Eve application root, relative to farm.config.ts. Defaults to the Farm root. */\n root?: string;\n /** Use an already-running Eve service instead of starting one in development. */\n origin?: string;\n /** Disable managed local development or configure its process. */\n dev?: false | EveDevOptions;\n /** Disable automatic Vercel service composition or configure it. */\n vercel?: false | EveVercelOptions;\n}\n\nexport interface EveRuntime extends FarmAgentRuntimeInstance {\n readonly root: string;\n}\n\ntype BaseEveIntegration = ReturnType<typeof createAgentRuntimeIntegration>;\nexport type EveIntegration = Omit<BaseEveIntegration, \"instance\"> & {\n readonly instance: EveRuntime;\n};\n\n/**\n * Hosts a filesystem-first Eve agent beside a Farm application.\n *\n * @example\n * integrations: { agent: eve() }\n */\nexport function eve(options: EveOptions = {}): EveIntegration {\n const configuredRoot = options.root || \".\";\n const devOptions = options.dev === false ? undefined : options.dev || {};\n const vercelOptions = options.vercel === false ? undefined : options.vercel || {};\n const composeVercel = Boolean(\n vercelOptions && !options.origin && !process.env.EVE_BASE_URL?.trim(),\n );\n\n return createAgentRuntimeIntegration({\n provider: \"eve\",\n routePrefix: EVE_ROUTE_PREFIX,\n additionalRoutePrefixes: [EVE_WORKFLOW_ROUTE_PREFIX],\n origin: options.origin,\n originEnv: \"EVE_BASE_URL\",\n instance: {\n root: configuredRoot,\n },\n ...(devOptions\n ? {\n async startDev(context) {\n assertEveNodeVersion();\n const binary = await resolveProjectPackageBin(context.root, \"eve\", \"eve\");\n const agentRoot = resolve(context.root, configuredRoot);\n const showLogs = devOptions.logs !== false;\n return startManagedAgentRuntime({\n command: process.execPath,\n args: [\n binary,\n \"dev\",\n \"--no-ui\",\n \"--host\",\n \"127.0.0.1\",\n \"--port\",\n \"0\",\n ...(devOptions.name ? [\"--name\", devOptions.name] : []),\n ],\n cwd: agentRoot,\n label: \"Eve development server\",\n resolveOrigin: findEveServerOrigin,\n healthPath: EVE_HEALTH_PATH,\n timeoutMs: devOptions.timeoutMs ?? 180_000,\n onOutput: showLogs\n ? (line, stream) => {\n const message = `[eve] ${line}`;\n if (stream === \"stderr\") context.log.warn(message);\n else context.log.info(message);\n }\n : undefined,\n });\n },\n }\n : {}),\n ...(composeVercel\n ? {\n async afterBuild(context) {\n if (context.preset !== \"vercel\" && context.preset !== \"vercel-edge\") {\n return;\n }\n assertEveNodeVersion();\n await writeEveVercelOutput({\n root: context.root,\n agentRoot: configuredRoot,\n servicePrefix: vercelOptions?.servicePrefix,\n buildCommand: vercelOptions?.buildCommand,\n });\n },\n }\n : {}),\n }) as EveIntegration;\n}\n\nexport function findEveServerOrigin(output: string): string | undefined {\n for (const match of output.matchAll(/https?:\\/\\/[^\\s\"'<>]+/gi)) {\n try {\n const url = new URL(match[0]);\n const isLoopback =\n url.hostname === \"localhost\" ||\n url.hostname === \"[::1]\" ||\n url.hostname === \"::1\" ||\n /^127(?:\\.\\d{1,3}){3}$/.test(url.hostname);\n if (isLoopback && url.port) return url.origin;\n } catch {\n // Ignore prose that only resembles a URL.\n }\n }\n return undefined;\n}\n\nexport function assertEveNodeVersion(version = process.versions.node): void {\n const major = Number.parseInt(version.split(\".\")[0] || \"0\", 10);\n if (!Number.isFinite(major) || major < 24) {\n throw new Error(`Eve requires Node.js 24 or newer. Farm is running Node.js ${version}.`);\n }\n}\n","import { spawn } from \"node:child_process\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\n\nconst EVE_VERCEL_RUNNER = `\nimport { withEve } from \"eve/next\";\nimport { mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nconst options = JSON.parse(\n Buffer.from(process.argv[1], \"base64url\").toString(\"utf8\"),\n);\nconst projectPath = join(process.cwd(), \".vercel\", \"project.json\");\nlet createdProjectMarker = false;\n\ntry {\n await readFile(projectPath, \"utf8\");\n} catch (error) {\n if (!(error instanceof Error && \"code\" in error && error.code === \"ENOENT\")) throw error;\n await mkdir(join(process.cwd(), \".vercel\"), { recursive: true });\n await writeFile(projectPath, \"{}\\\\n\");\n createdProjectMarker = true;\n}\n\ntry {\n const resolveConfig = withEve({}, options);\n await resolveConfig(\"phase-production-build\", {});\n} finally {\n if (createdProjectMarker) await rm(projectPath, { force: true });\n}\n`;\n\nexport interface EveVercelOutputOptions {\n root: string;\n agentRoot: string;\n servicePrefix?: string;\n buildCommand?: string;\n nodePath?: string;\n onOutput?(line: string, stream: \"stdout\" | \"stderr\"): void;\n}\n\nexport async function writeEveVercelOutput(options: EveVercelOutputOptions): Promise<void> {\n const root = resolve(options.root);\n const outputConfigPath = join(root, \".vercel\", \"output\", \"config.json\");\n await assertFarmVercelOutput(outputConfigPath);\n\n const serializedOptions = Buffer.from(\n JSON.stringify({\n eveRoot: resolve(root, options.agentRoot),\n ...(options.servicePrefix ? { servicePrefix: options.servicePrefix } : {}),\n ...(options.buildCommand ? { eveBuildCommand: options.buildCommand } : {}),\n }),\n ).toString(\"base64url\");\n\n await runEveVercelAdapter({\n command: options.nodePath || process.execPath,\n cwd: root,\n encodedOptions: serializedOptions,\n onOutput: options.onOutput,\n });\n await assertEveService(outputConfigPath);\n}\n\nasync function assertFarmVercelOutput(configPath: string): Promise<void> {\n try {\n await readFile(configPath, \"utf8\");\n } catch {\n throw new Error(\n `Farm Vercel output was not found at ${configPath}. Build with the vercel preset before composing Eve.`,\n );\n }\n}\n\nasync function assertEveService(configPath: string): Promise<void> {\n const config = JSON.parse(await readFile(configPath, \"utf8\")) as {\n services?: Record<string, { framework?: string }> | Array<{ framework?: string }>;\n };\n const services = Array.isArray(config.services)\n ? config.services\n : Object.values(config.services || {});\n if (!services.some((service) => service.framework === \"eve\")) {\n throw new Error(\"Eve did not add its service to Farm's Vercel output.\");\n }\n}\n\nasync function runEveVercelAdapter(input: {\n command: string;\n cwd: string;\n encodedOptions: string;\n onOutput?: EveVercelOutputOptions[\"onOutput\"];\n}): Promise<void> {\n await new Promise<void>((resolveRun, reject) => {\n const child = spawn(\n input.command,\n [\"--input-type=module\", \"--eval\", EVE_VERCEL_RUNNER, input.encodedOptions],\n {\n cwd: input.cwd,\n env: {\n ...process.env,\n VERCEL: process.env.VERCEL || \"1\",\n },\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n },\n );\n let output = \"\";\n\n const onData = (chunk: Buffer, stream: \"stdout\" | \"stderr\") => {\n const text = chunk.toString(\"utf8\");\n output = `${output}${text}`.slice(-16_384);\n for (const line of text.split(/\\r?\\n/)) {\n if (line) input.onOutput?.(line, stream);\n }\n };\n\n child.stdout?.on(\"data\", (chunk: Buffer) => onData(chunk, \"stdout\"));\n child.stderr?.on(\"data\", (chunk: Buffer) => onData(chunk, \"stderr\"));\n child.once(\"error\", reject);\n child.once(\"close\", (code, signal) => {\n if (code === 0) {\n resolveRun();\n return;\n }\n reject(\n new Error(\n `Eve Vercel output adapter failed (code ${String(code)}, signal ${String(signal)}).${output ? `\\n${output.trim()}` : \"\"}`,\n ),\n );\n });\n });\n}\n"],"mappings":";AAAA,SAAS,WAAAA,gBAAe;AACxB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;;;ACNP,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAE9B,IAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqC1B,eAAsB,qBAAqB,SAAgD;AACzF,QAAM,OAAO,QAAQ,QAAQ,IAAI;AACjC,QAAM,mBAAmB,KAAK,MAAM,WAAW,UAAU,aAAa;AACtE,QAAM,uBAAuB,gBAAgB;AAE7C,QAAM,oBAAoB,OAAO;AAAA,IAC/B,KAAK,UAAU;AAAA,MACb,SAAS,QAAQ,MAAM,QAAQ,SAAS;AAAA,MACxC,GAAI,QAAQ,gBAAgB,EAAE,eAAe,QAAQ,cAAc,IAAI,CAAC;AAAA,MACxE,GAAI,QAAQ,eAAe,EAAE,iBAAiB,QAAQ,aAAa,IAAI,CAAC;AAAA,IAC1E,CAAC;AAAA,EACH,EAAE,SAAS,WAAW;AAEtB,QAAM,oBAAoB;AAAA,IACxB,SAAS,QAAQ,YAAY,QAAQ;AAAA,IACrC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,UAAU,QAAQ;AAAA,EACpB,CAAC;AACD,QAAM,iBAAiB,gBAAgB;AACzC;AAEA,eAAe,uBAAuB,YAAmC;AACvE,MAAI;AACF,UAAM,SAAS,YAAY,MAAM;AAAA,EACnC,QAAQ;AACN,UAAM,IAAI;AAAA,MACR,uCAAuC,UAAU;AAAA,IACnD;AAAA,EACF;AACF;AAEA,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AAC,MAAM,WAAW;AAChB,kBAAM,UAAU,SAAS,IAAI;AAC7B,gBAAI,WAAW,SAAU,SAAQ,IAAI,KAAK,OAAO;AAAA,gBAC5C,SAAQ,IAAI,KAAK,OAAO;AAAA,UAC/B,IACA;AAAA,QACN,CAAC;AAAA,MACH;AAAA,IACF,IACA,CAAC;AAAA,IACL,GAAI,gBACA;AAAA,MACE,MAAM,WAAW,SAAS;AACxB,YAAI,QAAQ,WAAW,YAAY,QAAQ,WAAW,eAAe;AACnE;AAAA,QACF;AACA,6BAAqB;AACrB,cAAM,qBAAqB;AAAA,UACzB,MAAM,QAAQ;AAAA,UACd,WAAW;AAAA,UACX,eAAe,eAAe;AAAA,UAC9B,cAAc,eAAe;AAAA,QAC/B,CAAC;AAAA,MACH;AAAA,IACF,IACA,CAAC;AAAA,EACP,CAAC;AACH;AAEO,SAAS,oBAAoB,QAAoC;AACtE,aAAW,SAAS,OAAO,SAAS,yBAAyB,GAAG;AAC9D,QAAI;AACF,YAAM,MAAM,IAAI,IAAI,MAAM,CAAC,CAAC;AAC5B,YAAM,aACJ,IAAI,aAAa,eACjB,IAAI,aAAa,WACjB,IAAI,aAAa,SACjB,wBAAwB,KAAK,IAAI,QAAQ;AAC3C,UAAI,cAAc,IAAI,KAAM,QAAO,IAAI;AAAA,IACzC,QAAQ;AAAA,IAER;AAAA,EACF;AACA,SAAO;AACT;AAEO,SAAS,qBAAqB,UAAU,QAAQ,SAAS,MAAY;AAC1E,QAAM,QAAQ,OAAO,SAAS,QAAQ,MAAM,GAAG,EAAE,CAAC,KAAK,KAAK,EAAE;AAC9D,MAAI,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,IAAI;AACzC,UAAM,IAAI,MAAM,6DAA6D,OAAO,GAAG;AAAA,EACzF;AACF;","names":["resolve","resolve"]}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@farm.js/eve",
3
+ "version": "0.1.0-beta.0",
4
+ "description": "First-class Eve agent runtime integration for Farm.js",
5
+ "keywords": [
6
+ "agents",
7
+ "eve",
8
+ "farmjs",
9
+ "vercel"
10
+ ],
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/farming-labs/farm.js",
15
+ "directory": "packages/farm-eve"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "type": "module",
21
+ "main": "./dist/index.js",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@farm.js/core": "0.1.0-beta.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.10.5",
38
+ "eve": "0.24.6",
39
+ "tsup": "^8.5.1",
40
+ "typescript": "^5.3.3",
41
+ "vitest": "^1.6.1"
42
+ },
43
+ "peerDependencies": {
44
+ "eve": ">=0.24.6 <1"
45
+ },
46
+ "engines": {
47
+ "node": ">=24"
48
+ },
49
+ "scripts": {
50
+ "build": "tsup",
51
+ "dev": "tsup --watch",
52
+ "test": "vitest run",
53
+ "type-check": "tsc --noEmit"
54
+ }
55
+ }