@compilr-dev/sdk 0.1.13 → 0.1.15

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 CHANGED
@@ -1,13 +1,100 @@
1
- MIT License
1
+ Functional Source License, Version 1.1, MIT Future License
2
2
 
3
- Copyright (c) 2026 Carmelo Scozzola
3
+ Abbreviation: FSL-1.1-MIT
4
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:
5
+ Notice
6
+
7
+ Copyright 2026 Carmelo Scozzola
8
+
9
+ Terms and Conditions
10
+
11
+ Licensor ("We")
12
+
13
+ The party offering the Software under these Terms and Conditions.
14
+
15
+ The Software
16
+
17
+ The "Software" is each version of the software that we make available under
18
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
19
+ Conditions with the Software.
20
+
21
+ License Grant
22
+
23
+ Subject to your compliance with this License Grant and the Patents,
24
+ Redistribution and Trademark clauses below, we hereby grant you the right to
25
+ use, copy, modify, create derivative works, publicly perform, publicly display
26
+ and redistribute the Software for any Permitted Purpose identified below.
27
+
28
+ Permitted Purpose
29
+
30
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
31
+ means making the Software available to others in a commercial product or
32
+ service that:
33
+
34
+ 1. substitutes for the Software;
35
+
36
+ 2. substitutes for any other product or service we offer using the Software
37
+ that exists as of the date we make the Software available; or
38
+
39
+ 3. offers the same or substantially similar functionality as the Software.
40
+
41
+ Permitted Purposes specifically include using the Software:
42
+
43
+ 1. for your internal use and access;
44
+
45
+ 2. for non-commercial education;
46
+
47
+ 3. for non-commercial research; and
48
+
49
+ 4. in connection with professional services that you provide to a licensee
50
+ using the Software in accordance with these Terms and Conditions.
51
+
52
+ Patents
53
+
54
+ To the extent your use for a Permitted Purpose would necessarily infringe our
55
+ patents, the license grant above includes a license under our patents. If you
56
+ make a claim against any party that the Software infringes or contributes to
57
+ the infringement of any patent, then your patent license to the Software ends
58
+ immediately.
59
+
60
+ Redistribution
61
+
62
+ The Terms and Conditions apply to all copies, modifications and derivatives of
63
+ the Software.
64
+
65
+ If you redistribute any copies, modifications or derivatives of the Software,
66
+ you must include a copy of or a link to these Terms and Conditions and not
67
+ remove any copyright notices provided in or with the Software.
68
+
69
+ Disclaimer
70
+
71
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
72
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
73
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
74
+
75
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
76
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
77
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
78
+
79
+ Trademarks
80
+
81
+ Except for displaying the License Details and identifying us as the origin of
82
+ the Software, you have no right under these Terms and Conditions to use our
83
+ trademarks, trade names, service marks or product names.
84
+
85
+ Grant of Future License
86
+
87
+ We hereby irrevocably grant you an additional license to use the Software under
88
+ the MIT license that is effective on the second anniversary of the date we make
89
+ the Software available. On or after that date, you may use the Software under
90
+ the MIT license, in which case the following will apply:
91
+
92
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
93
+ this software and associated documentation files (the "Software"), to deal in
94
+ the Software without restriction, including without limitation the rights to
95
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
96
+ of the Software, and to permit persons to whom the Software is furnished to do
97
+ so, subject to the following conditions:
11
98
 
12
99
  The above copyright notice and this permission notice shall be included in all
13
100
  copies or substantial portions of the Software.
package/README.md CHANGED
@@ -13,7 +13,7 @@
13
13
  > Universal agent runtime for building AI-powered applications
14
14
 
15
15
  [![npm version](https://img.shields.io/npm/v/@compilr-dev/sdk.svg)](https://www.npmjs.com/package/@compilr-dev/sdk)
16
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
16
+ [![License: FSL-1.1-MIT](https://img.shields.io/badge/License-FSL--1.1--MIT-blue.svg)](https://fsl.software/)
17
17
 
18
18
  > [!WARNING]
19
19
  > This package is in beta. APIs may change between minor versions.
@@ -127,7 +127,7 @@ await team.run('Add rate limiting to the API');
127
127
 
128
128
  ## License
129
129
 
130
- MIT - See [LICENSE](LICENSE) for details.
130
+ [FSL-1.1-MIT](https://fsl.software/) - See [LICENSE](LICENSE) for details. Converts to MIT after 2 years per version.
131
131
 
132
132
  ---
133
133
 
@@ -27,7 +27,7 @@ export interface MetaToolStats {
27
27
  export interface MetaTools {
28
28
  /** Lists available tools by category */
29
29
  listToolsTool: Tool;
30
- /** Returns the JSON schema for a tool's parameters */
30
+ /** Returns compact parameter info for a tool */
31
31
  getToolInfoTool: Tool;
32
32
  /** Executes any registered tool by name */
33
33
  useToolTool: Tool;
@@ -91,4 +91,4 @@ export declare class MetaToolsRegistry {
91
91
  * Create the three meta-tools + fallback handler, all bound to a registry instance.
92
92
  */
93
93
  export declare function createMetaTools(registry: MetaToolsRegistry): MetaTools;
94
- export declare const META_TOOLS_SYSTEM_PROMPT_PREFIX = "\n## Tool Index (Specialized Tools)\n\nThese tools are called **exactly like direct tools** \u2014 just use the tool name with parameters. No special syntax or wrapper needed. The system routes them automatically.\n\n**IMPORTANT \u2014 These are CLI system tools, NOT your project's backend. Never use localhost/curl to access them.**\n\n**Parameter Rules:**\n- For **zero-parameter calls**: call the tool directly (e.g., `workitem_query()`, `git_status()`).\n- For **calls WITH parameters**: you MUST call `get_tool_info(\"tool_name\")` first to get the exact JSON schema. The signatures below are summaries only \u2014 do NOT guess parameter structure from them.\n- After a failed tool call, always call `get_tool_info()` before retrying.\n\n";
94
+ export declare const META_TOOLS_SYSTEM_PROMPT_PREFIX = "\n## Tool Index (Specialized Tools)\n\nThese tools are called **exactly like direct tools** \u2014 just use the tool name with parameters. No special syntax or wrapper needed. The system routes them automatically.\n\n**IMPORTANT \u2014 These are CLI system tools, NOT your project's backend. Never use localhost/curl to access them.**\n\n**Parameter Rules:**\n- For **zero-parameter calls**: call the tool directly (e.g., `workitem_query()`, `git_status()`).\n- For **calls WITH parameters**: you MUST call `get_tool_info(\"tool_name\")` first to get parameter details. The signatures below are summaries only \u2014 do NOT guess parameter structure from them.\n- After a failed tool call, always call `get_tool_info()` before retrying.\n\n";
@@ -187,7 +187,7 @@ export function createMetaTools(registry) {
187
187
  // -------------------------------------------------------------------------
188
188
  const getToolInfoTool = defineTool({
189
189
  name: 'get_tool_info',
190
- description: "Get the exact JSON schema for a tool's parameters. " +
190
+ description: "Get a tool's parameter signature and descriptions. " +
191
191
  'MUST be called before passing any parameters to a Tool Index tool. ' +
192
192
  'Zero-parameter calls do not need this.',
193
193
  inputSchema: {
@@ -211,11 +211,7 @@ export function createMetaTools(registry) {
211
211
  `Available tools include: ${availableTools.join(', ')}... ` +
212
212
  `Check the Tool Index for the full list.`));
213
213
  }
214
- return Promise.resolve(createSuccessResult({
215
- name: tool.definition.name,
216
- description: tool.definition.description,
217
- parameters: tool.definition.inputSchema,
218
- }));
214
+ return Promise.resolve(createSuccessResult(buildCompactSchema(tool)));
219
215
  },
220
216
  });
221
217
  // -------------------------------------------------------------------------
@@ -267,9 +263,8 @@ export function createMetaTools(registry) {
267
263
  // 2. Validate args
268
264
  const validationError = registry.validateArgs(tool_name, args);
269
265
  if (validationError) {
270
- return createErrorResult(`Invalid arguments for '${tool_name}': ${validationError}. ` +
271
- `Expected schema: ${JSON.stringify(tool.definition.inputSchema, null, 2)}. ` +
272
- `Hint: Call get_tool_info("${tool_name}") to see full parameter details.`);
266
+ return createErrorResult(`Invalid arguments for '${tool_name}': ${validationError}.\n` +
267
+ `Expected:\n${buildCompactSchema(tool)}`);
273
268
  }
274
269
  // 3. Execute the tool
275
270
  try {
@@ -347,7 +342,7 @@ These tools are called **exactly like direct tools** — just use the tool name
347
342
 
348
343
  **Parameter Rules:**
349
344
  - For **zero-parameter calls**: call the tool directly (e.g., \`workitem_query()\`, \`git_status()\`).
350
- - For **calls WITH parameters**: you MUST call \`get_tool_info("tool_name")\` first to get the exact JSON schema. The signatures below are summaries only — do NOT guess parameter structure from them.
345
+ - For **calls WITH parameters**: you MUST call \`get_tool_info("tool_name")\` first to get parameter details. The signatures below are summaries only — do NOT guess parameter structure from them.
351
346
  - After a failed tool call, always call \`get_tool_info()\` before retrying.
352
347
 
353
348
  `;
@@ -372,6 +367,22 @@ function getCategoryName(prefix) {
372
367
  };
373
368
  return categoryMap[prefix] ?? 'Other';
374
369
  }
370
+ /**
371
+ * Resolve a compact type string from a JSON Schema property.
372
+ */
373
+ function resolveCompactType(prop) {
374
+ const type = typeof prop.type === 'string' ? prop.type : 'any';
375
+ if (type === 'array') {
376
+ const items = prop.items;
377
+ const itemType = typeof items?.type === 'string' ? items.type : 'any';
378
+ return `${itemType}[]`;
379
+ }
380
+ if (type === 'boolean')
381
+ return 'bool';
382
+ if (type === 'integer')
383
+ return 'int';
384
+ return type;
385
+ }
375
386
  /**
376
387
  * Build a concise signature for a tool.
377
388
  * e.g., "git_commit(message: string, files?: string[]) - Create a commit"
@@ -383,7 +394,7 @@ function buildToolSignature(tool) {
383
394
  const required = new Set(schema.required ?? []);
384
395
  for (const [name, prop] of Object.entries(schema.properties)) {
385
396
  const isRequired = required.has(name);
386
- const type = prop.type ?? 'any';
397
+ const type = resolveCompactType(prop);
387
398
  params.push(isRequired ? `${name}: ${type}` : `${name}?: ${type}`);
388
399
  }
389
400
  }
@@ -391,6 +402,51 @@ function buildToolSignature(tool) {
391
402
  const desc = tool.definition.description.split('.')[0]; // First sentence
392
403
  return `${tool.definition.name}(${paramsStr}) - ${desc}`;
393
404
  }
405
+ /**
406
+ * Build a compact schema string for get_tool_info responses.
407
+ * Includes signature, full description, and per-parameter details.
408
+ *
409
+ * Example output:
410
+ * git_commit(message: string, files?: string[], amend?: bool)
411
+ * Create a git commit with the specified message.
412
+ * - message: The commit message (required)
413
+ * - files: Files to stage before committing
414
+ * - amend: Amend the last commit instead of creating new
415
+ */
416
+ function buildCompactSchema(tool) {
417
+ const schema = tool.definition.inputSchema;
418
+ const required = new Set(schema.required ?? []);
419
+ const params = [];
420
+ const paramDetails = [];
421
+ if (schema.properties) {
422
+ for (const [name, prop] of Object.entries(schema.properties)) {
423
+ const isRequired = required.has(name);
424
+ const type = resolveCompactType(prop);
425
+ params.push(isRequired ? `${name}: ${type}` : `${name}?: ${type}`);
426
+ // Build parameter detail line
427
+ const desc = prop.description;
428
+ const enumValues = prop.enum;
429
+ let detail = `- ${name}`;
430
+ if (desc) {
431
+ detail += `: ${desc}`;
432
+ }
433
+ if (enumValues) {
434
+ detail += ` (${enumValues.map((v) => `"${v}"`).join('|')})`;
435
+ }
436
+ if (isRequired) {
437
+ detail += ' (required)';
438
+ }
439
+ paramDetails.push(detail);
440
+ }
441
+ }
442
+ const paramsStr = params.join(', ');
443
+ const lines = [`${tool.definition.name}(${paramsStr})`];
444
+ lines.push(` ${tool.definition.description}`);
445
+ for (const detail of paramDetails) {
446
+ lines.push(` ${detail}`);
447
+ }
448
+ return lines.join('\n');
449
+ }
394
450
  /**
395
451
  * Format AJV validation errors into a readable string.
396
452
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -44,7 +44,7 @@
44
44
  "anthropic"
45
45
  ],
46
46
  "author": "Carmelo Scozzola",
47
- "license": "MIT",
47
+ "license": "FSL-1.1-MIT",
48
48
  "bugs": {
49
49
  "url": "https://github.com/compilr-dev/sdk/issues"
50
50
  },