@convilyn/sdk-author 0.7.0 → 0.8.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/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { VERSION, allChecksPassed, serve, runComplianceChecks, ConvilynClient, ConvilynApiError, WorkflowSpec } from './chunk-ZNZXT5ZP.js';
2
+ import { VERSION, allChecksPassed, serve, runComplianceChecks, ConvilynClient, ConvilynApiError, WorkflowSpec } from './chunk-RUBSAKX7.js';
3
3
  import { Command } from 'commander';
4
4
  import { mkdir, writeFile, stat, readdir } from 'fs/promises';
5
5
  import { resolve, join, extname } from 'path';
package/dist/index.cjs CHANGED
@@ -6,16 +6,22 @@ var zodToJsonSchema = require('zod-to-json-schema');
6
6
  var http = require('http');
7
7
 
8
8
  // src/version.ts
9
- var VERSION = "0.7.0";
9
+ var VERSION = "0.8.0";
10
10
  var MANIFEST_SDK_VERSION = "1.0.0";
11
11
 
12
12
  // src/errors.ts
13
+ var CONVILYN_AUTHOR_ERROR_BRAND = /* @__PURE__ */ Symbol.for("@convilyn/sdk-author.ConvilynAuthorError");
13
14
  var ConvilynAuthorError = class extends Error {
15
+ /** @internal brand marker — see {@link isConvilynAuthorError} */
16
+ [CONVILYN_AUTHOR_ERROR_BRAND] = true;
14
17
  constructor(message) {
15
18
  super(message);
16
19
  this.name = "ConvilynAuthorError";
17
20
  }
18
21
  };
22
+ function isConvilynAuthorError(err) {
23
+ return typeof err === "object" && err !== null && err[CONVILYN_AUTHOR_ERROR_BRAND] === true;
24
+ }
19
25
  var InvalidSignatureError = class extends ConvilynAuthorError {
20
26
  reason;
21
27
  constructor(reason, message) {
@@ -731,8 +737,22 @@ function compileInputSchema(schema) {
731
737
  if (json.type === "object") {
732
738
  json.additionalProperties = false;
733
739
  }
740
+ assertSchemaNotSilentlyEmpty(schema, json);
734
741
  return json;
735
742
  }
743
+ function assertSchemaNotSilentlyEmpty(schema, json) {
744
+ const shape = schema.shape;
745
+ const declaredFieldCount = isRecord2(shape) ? Object.keys(shape).length : 0;
746
+ if (declaredFieldCount === 0) {
747
+ return;
748
+ }
749
+ const compiledFieldCount = isRecord2(json.properties) ? Object.keys(json.properties).length : 0;
750
+ if (compiledFieldCount === 0) {
751
+ throw new Error(
752
+ `defineTool: the input schema declares ${declaredFieldCount} field(s) but zod-to-json-schema produced an empty input_schema. This usually means two separate 'zod' module instances are loaded (zod is a peerDependency \u2014 check for a nested/duplicate zod install), or the server was built with a raw 'tsc' compile instead of the documented 'tsup' build.`
753
+ );
754
+ }
755
+ }
736
756
  function defineTool(def) {
737
757
  if (!def.name) {
738
758
  throw new Error("defineTool: name is required");
@@ -1616,6 +1636,7 @@ exports.devInsecureRequested = devInsecureRequested;
1616
1636
  exports.failedChecks = failedChecks;
1617
1637
  exports.generateRefId = generateRefId;
1618
1638
  exports.invokeTool = invokeTool;
1639
+ exports.isConvilynAuthorError = isConvilynAuthorError;
1619
1640
  exports.mintConfirmationToken = mintConfirmationToken;
1620
1641
  exports.normalizeForDigest = normalizeForDigest;
1621
1642
  exports.runComplianceChecks = runComplianceChecks;