fourmis-agents-sdk 0.3.1 → 0.4.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.
Files changed (84) hide show
  1. package/README.md +126 -198
  2. package/dist/agent-loop.d.ts +21 -3
  3. package/dist/agent-loop.d.ts.map +1 -1
  4. package/dist/agent-loop.js +279 -90
  5. package/dist/agents/index.js +1079 -124
  6. package/dist/agents/tools.d.ts.map +1 -1
  7. package/dist/agents/tools.js +1079 -124
  8. package/dist/agents/types.d.ts +4 -0
  9. package/dist/agents/types.d.ts.map +1 -1
  10. package/dist/api.d.ts +8 -5
  11. package/dist/api.d.ts.map +1 -1
  12. package/dist/api.js +1663 -430
  13. package/dist/hooks.d.ts +19 -1
  14. package/dist/hooks.d.ts.map +1 -1
  15. package/dist/hooks.js +27 -2
  16. package/dist/index.d.ts +8 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1671 -431
  19. package/dist/mcp/client.d.ts +8 -1
  20. package/dist/mcp/client.d.ts.map +1 -1
  21. package/dist/mcp/client.js +134 -13
  22. package/dist/mcp/index.js +134 -13
  23. package/dist/mcp/types.d.ts +21 -1
  24. package/dist/mcp/types.d.ts.map +1 -1
  25. package/dist/permissions.d.ts.map +1 -1
  26. package/dist/permissions.js +7 -3
  27. package/dist/providers/anthropic.d.ts.map +1 -1
  28. package/dist/providers/anthropic.js +41 -2
  29. package/dist/providers/openai.d.ts +6 -0
  30. package/dist/providers/openai.d.ts.map +1 -1
  31. package/dist/providers/openai.js +36 -6
  32. package/dist/providers/registry.js +76 -8
  33. package/dist/providers/types.d.ts +4 -1
  34. package/dist/providers/types.d.ts.map +1 -1
  35. package/dist/query.d.ts +21 -2
  36. package/dist/query.d.ts.map +1 -1
  37. package/dist/query.js +69 -1
  38. package/dist/skills/index.js +23 -1
  39. package/dist/skills/skills.d.ts +16 -0
  40. package/dist/skills/skills.d.ts.map +1 -1
  41. package/dist/skills/skills.js +23 -1
  42. package/dist/tools/ask-user-question.d.ts +7 -0
  43. package/dist/tools/ask-user-question.d.ts.map +1 -0
  44. package/dist/tools/ask-user-question.js +48 -0
  45. package/dist/tools/bash.d.ts.map +1 -1
  46. package/dist/tools/bash.js +47 -2
  47. package/dist/tools/config.d.ts +7 -0
  48. package/dist/tools/config.d.ts.map +1 -0
  49. package/dist/tools/config.js +114 -0
  50. package/dist/tools/exit-plan-mode.d.ts +7 -0
  51. package/dist/tools/exit-plan-mode.d.ts.map +1 -0
  52. package/dist/tools/exit-plan-mode.js +34 -0
  53. package/dist/tools/index.d.ts +7 -0
  54. package/dist/tools/index.d.ts.map +1 -1
  55. package/dist/tools/index.js +506 -9
  56. package/dist/tools/notebook-edit.d.ts +7 -0
  57. package/dist/tools/notebook-edit.d.ts.map +1 -0
  58. package/dist/tools/notebook-edit.js +83 -0
  59. package/dist/tools/presets.d.ts +2 -1
  60. package/dist/tools/presets.d.ts.map +1 -1
  61. package/dist/tools/presets.js +22 -4
  62. package/dist/tools/read.d.ts.map +1 -1
  63. package/dist/tools/read.js +12 -1
  64. package/dist/tools/registry.d.ts +2 -0
  65. package/dist/tools/registry.d.ts.map +1 -1
  66. package/dist/tools/registry.js +10 -0
  67. package/dist/tools/todo-write.d.ts +7 -0
  68. package/dist/tools/todo-write.d.ts.map +1 -0
  69. package/dist/tools/todo-write.js +69 -0
  70. package/dist/tools/web-fetch.d.ts +6 -0
  71. package/dist/tools/web-fetch.d.ts.map +1 -0
  72. package/dist/tools/web-fetch.js +85 -0
  73. package/dist/tools/web-search.d.ts +7 -0
  74. package/dist/tools/web-search.d.ts.map +1 -0
  75. package/dist/tools/web-search.js +78 -0
  76. package/dist/types.d.ts +344 -42
  77. package/dist/types.d.ts.map +1 -1
  78. package/dist/utils/session-store.d.ts +1 -1
  79. package/dist/utils/session-store.d.ts.map +1 -1
  80. package/dist/utils/session-store.js +49 -2
  81. package/dist/utils/system-prompt.d.ts +2 -0
  82. package/dist/utils/system-prompt.d.ts.map +1 -1
  83. package/dist/utils/system-prompt.js +33 -4
  84. package/package.json +3 -2
@@ -52,6 +52,7 @@ import { homedir } from "os";
52
52
  import { basename, dirname, isAbsolute, join, resolve } from "path";
53
53
  var MAX_NAME_LENGTH = 64;
54
54
  var MAX_DESCRIPTION_LENGTH = 1024;
55
+ var MAX_COMPATIBILITY_LENGTH = 500;
55
56
  var CONFIG_DIR_NAME = ".claude";
56
57
  function shouldIgnore(name) {
57
58
  return name.startsWith(".") || name === "node_modules";
@@ -84,6 +85,14 @@ function validateDescription(description) {
84
85
  }
85
86
  return errors;
86
87
  }
88
+ function validateCompatibility(compatibility) {
89
+ if (!compatibility)
90
+ return [];
91
+ if (compatibility.length > MAX_COMPATIBILITY_LENGTH) {
92
+ return [`compatibility exceeds ${MAX_COMPATIBILITY_LENGTH} characters (${compatibility.length})`];
93
+ }
94
+ return [];
95
+ }
87
96
  function loadSkillsFromDir(options) {
88
97
  return loadSkillsFromDirInternal(options.dir, options.source, true);
89
98
  }
@@ -148,9 +157,15 @@ function loadSkillFromFile(filePath, source) {
148
157
  for (const error of nameErrors) {
149
158
  diagnostics.push({ type: "warning", message: error, path: filePath });
150
159
  }
160
+ const compatErrors = validateCompatibility(frontmatter.compatibility);
161
+ for (const error of compatErrors) {
162
+ diagnostics.push({ type: "warning", message: error, path: filePath });
163
+ }
151
164
  if (!frontmatter.description || frontmatter.description.trim() === "") {
152
165
  return { skill: null, diagnostics };
153
166
  }
167
+ const allowedToolsRaw = frontmatter["allowed-tools"];
168
+ const allowedTools = allowedToolsRaw ? allowedToolsRaw.split(/\s+/).filter(Boolean) : undefined;
154
169
  return {
155
170
  skill: {
156
171
  name,
@@ -158,7 +173,11 @@ function loadSkillFromFile(filePath, source) {
158
173
  filePath,
159
174
  baseDir: skillDir,
160
175
  source,
161
- disableModelInvocation: frontmatter["disable-model-invocation"] === true
176
+ disableModelInvocation: frontmatter["disable-model-invocation"] === true,
177
+ license: frontmatter.license,
178
+ compatibility: frontmatter.compatibility,
179
+ metadata: frontmatter.metadata,
180
+ allowedTools
162
181
  },
163
182
  diagnostics
164
183
  };
@@ -274,6 +293,9 @@ function formatSkillsForPrompt(skills) {
274
293
  lines.push(` <name>${escapeXml(skill.name)}</name>`);
275
294
  lines.push(` <description>${escapeXml(skill.description)}</description>`);
276
295
  lines.push(` <location>${escapeXml(skill.filePath)}</location>`);
296
+ if (skill.allowedTools?.length) {
297
+ lines.push(` <allowed-tools>${escapeXml(skill.allowedTools.join(" "))}</allowed-tools>`);
298
+ }
277
299
  lines.push(" </skill>");
278
300
  }
279
301
  lines.push("</available_skills>");
@@ -346,11 +368,18 @@ function buildSystemPrompt(context) {
346
368
  sections.push(`# Environment
347
369
 
348
370
  Working directory: ${context.cwd}`);
349
- const instructions = readProjectInstructions(context.cwd);
350
- if (instructions) {
351
- sections.push(`# Project Instructions
371
+ if (context.additionalDirectories && context.additionalDirectories.length > 0) {
372
+ sections.push(`Additional allowed directories:
373
+ ${context.additionalDirectories.map((d) => `- ${d}`).join(`
374
+ `)}`);
375
+ }
376
+ if (context.loadProjectInstructions) {
377
+ const instructions = readProjectInstructions(context.cwd);
378
+ if (instructions) {
379
+ sections.push(`# Project Instructions
352
380
 
353
381
  ${instructions}`);
382
+ }
354
383
  }
355
384
  }
356
385
  if (context.skills && context.skills.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourmis-agents-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "description": "Multi-provider AI agent SDK with direct API access and in-process tool execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -58,7 +58,8 @@
58
58
  "typecheck": "tsc --noEmit",
59
59
  "test": "bun test",
60
60
  "test:tools": "bun test tests/tools/",
61
- "test:integration": "bun test tests/integration.test.ts"
61
+ "test:integration": "bun test tests/integration.test.ts",
62
+ "test:compat": "bun run tests/compat/run-compat.ts"
62
63
  },
63
64
  "dependencies": {
64
65
  "@anthropic-ai/sdk": "^0.74.0",