@farming-labs/farmjs 0.2.128 → 0.2.130

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.
@@ -4,10 +4,11 @@ export interface FarmDocsAgentSkillsOptions {
4
4
  configPath?: string;
5
5
  }
6
6
  /**
7
- * Snapshot configured Agent Skills and the project-root agent documents (`skill.md`, `AGENTS.md`)
8
- * into production builds. A deployed function such as a Vercel function contains the server
9
- * bundle but not the project's files, so the request-time filesystem fallback finds nothing
10
- * there. Development keeps reading the files, so edits show up without a rebuild.
7
+ * Snapshot configured Agent Skills, the project-root agent documents (`skill.md`, `AGENTS.md`),
8
+ * and the app's `package.json` version (the default MCP server version) into production builds.
9
+ * A deployed function such as a Vercel function contains the server bundle but not the
10
+ * project's files, so the request-time filesystem fallback finds nothing there. Development
11
+ * keeps reading the files, so edits show up without a rebuild.
11
12
  */
12
13
  export declare function docsAgentSkillsBundle(options?: FarmDocsAgentSkillsOptions): Plugin;
13
14
  //# sourceMappingURL=agent-skills.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent-skills.d.ts","sourceRoot":"","sources":["../src/agent-skills.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAMnD,MAAM,WAAW,0BAA0B;IACzC,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,0BAA+B,GAAG,MAAM,CAwCtF"}
1
+ {"version":3,"file":"agent-skills.d.ts","sourceRoot":"","sources":["../src/agent-skills.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAMnD,MAAM,WAAW,0BAA0B;IACzC,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAaD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,0BAA+B,GAAG,MAAM,CA6CtF"}
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- import { loadDocsConfigModule, renderDocsAgentSkillsBundle, resolveConfiguredAgentSkillsSync, } from "@farming-labs/docs/build";
3
+ import { loadDocsConfigModule, readDocsAppVersion, renderDocsAgentSkillsBundle, resolveConfiguredAgentSkillsSync, } from "@farming-labs/docs/build";
4
4
  const AGENT_SKILLS_BUNDLE_MODULE = "@farming-labs/docs/agent-skills-bundle";
5
5
  const RESOLVED_AGENT_SKILLS_BUNDLE_MODULE = "\0farming-labs-farmjs:agent-skills-bundle";
6
6
  const ROOT_DOCUMENT_FILES = ["skill.md", "AGENTS.md", "AGENT.md"];
@@ -15,15 +15,17 @@ function readRootDocuments(root) {
15
15
  return Object.keys(documents).length > 0 ? documents : undefined;
16
16
  }
17
17
  /**
18
- * Snapshot configured Agent Skills and the project-root agent documents (`skill.md`, `AGENTS.md`)
19
- * into production builds. A deployed function such as a Vercel function contains the server
20
- * bundle but not the project's files, so the request-time filesystem fallback finds nothing
21
- * there. Development keeps reading the files, so edits show up without a rebuild.
18
+ * Snapshot configured Agent Skills, the project-root agent documents (`skill.md`, `AGENTS.md`),
19
+ * and the app's `package.json` version (the default MCP server version) into production builds.
20
+ * A deployed function such as a Vercel function contains the server bundle but not the
21
+ * project's files, so the request-time filesystem fallback finds nothing there. Development
22
+ * keeps reading the files, so edits show up without a rebuild.
22
23
  */
23
24
  export function docsAgentSkillsBundle(options = {}) {
24
25
  let root = process.cwd();
25
26
  let source;
26
27
  async function renderBundle() {
28
+ const appVersion = readDocsAppVersion(root);
27
29
  let loaded;
28
30
  try {
29
31
  loaded = await loadDocsConfigModule(root, options.configPath);
@@ -31,14 +33,20 @@ export function docsAgentSkillsBundle(options = {}) {
31
33
  catch {
32
34
  loaded = null;
33
35
  }
34
- // Without the evaluated config, keep the package's empty module so the server still reads
35
- // skills from the filesystem, as it did before this snapshot existed.
36
- if (!loaded)
37
- return undefined;
36
+ // Without the evaluated config, leave the skills and documents undefined so the server
37
+ // still reads them from the filesystem, as it did before this snapshot existed.
38
+ if (!loaded) {
39
+ return [
40
+ "export const bundledAgentSkills = undefined;",
41
+ "export const bundledRootDocuments = undefined;",
42
+ `export const bundledAppVersion = ${appVersion ? JSON.stringify(appVersion) : "undefined"};`,
43
+ "",
44
+ ].join("\n");
45
+ }
38
46
  const skills = resolveConfiguredAgentSkillsSync(loaded.config.agent?.skills, {
39
47
  rootDir: root,
40
48
  });
41
- return renderDocsAgentSkillsBundle(skills, readRootDocuments(root));
49
+ return renderDocsAgentSkillsBundle(skills, readRootDocuments(root), appVersion);
42
50
  }
43
51
  return {
44
52
  name: "farming-labs-farmjs-agent-skills",
@@ -54,8 +62,7 @@ export function docsAgentSkillsBundle(options = {}) {
54
62
  if (id !== RESOLVED_AGENT_SKILLS_BUNDLE_MODULE)
55
63
  return undefined;
56
64
  source ??= renderBundle();
57
- return ((await source) ??
58
- "export const bundledAgentSkills = undefined;\nexport const bundledRootDocuments = undefined;\n");
65
+ return source;
59
66
  },
60
67
  };
61
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-skills.js","sourceRoot":"","sources":["../src/agent-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,0BAA0B,CAAC;AAGlC,MAAM,0BAA0B,GAAG,wCAAwC,CAAC;AAC5E,MAAM,mCAAmC,GAAG,2CAA2C,CAAC;AACxF,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAO3E,SAAS,iBAAiB,CAAC,IAAY;IACrC,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK,MAAM,QAAQ,IAAI,mBAAmB,EAAE,CAAC;QAC3C,MAAM,QAAQ,G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