@convilyn/sdk-author 0.7.0 → 0.9.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/CHANGELOG.md +56 -0
- package/LICENSE +201 -201
- package/README.md +1 -1
- package/dist/{chunk-ZNZXT5ZP.js → chunk-3TXBARBR.js} +59 -12
- package/dist/chunk-3TXBARBR.js.map +1 -0
- package/dist/cli.cjs +53 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +71 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZNZXT5ZP.js.map +0 -1
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-
|
|
2
|
+
import { VERSION, allChecksPassed, serve, runComplianceChecks, ConvilynClient, ConvilynApiError, WorkflowSpec } from './chunk-3TXBARBR.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.
|
|
9
|
+
var VERSION = "0.9.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");
|
|
@@ -1438,14 +1458,30 @@ var ConvilynClient = class {
|
|
|
1438
1458
|
* key. No auth required. The returned key is captured on this client for
|
|
1439
1459
|
* subsequent calls (and returned so the caller can persist it — it is shown
|
|
1440
1460
|
* only once).
|
|
1461
|
+
*
|
|
1462
|
+
* A 503 with code `REGISTRATION_STORE_UNAVAILABLE` means the platform's
|
|
1463
|
+
* registration store is temporarily unreachable — it is NOT a problem with
|
|
1464
|
+
* your request; retry in a few minutes. The error message spells this out.
|
|
1441
1465
|
*/
|
|
1442
1466
|
async register(request) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1467
|
+
let result;
|
|
1468
|
+
try {
|
|
1469
|
+
result = await this.#request(
|
|
1470
|
+
"POST",
|
|
1471
|
+
"/developers/register",
|
|
1472
|
+
request,
|
|
1473
|
+
false
|
|
1474
|
+
);
|
|
1475
|
+
} catch (error) {
|
|
1476
|
+
if (error instanceof ConvilynApiError && error.status === 503 && extractErrorCode(error.body) === "REGISTRATION_STORE_UNAVAILABLE") {
|
|
1477
|
+
throw new ConvilynApiError(
|
|
1478
|
+
503,
|
|
1479
|
+
"Developer registration is temporarily unavailable (registration store unreachable). This is not a problem with your request \u2014 retry in a few minutes. [REGISTRATION_STORE_UNAVAILABLE]",
|
|
1480
|
+
error.body
|
|
1481
|
+
);
|
|
1482
|
+
}
|
|
1483
|
+
throw error;
|
|
1484
|
+
}
|
|
1449
1485
|
if (result.api_key && !this.#apiKey) {
|
|
1450
1486
|
this.#apiKey = result.api_key;
|
|
1451
1487
|
}
|
|
@@ -1480,9 +1516,17 @@ var ConvilynClient = class {
|
|
|
1480
1516
|
await this.#request("DELETE", `/developers/servers/${encodeURIComponent(serverId)}`);
|
|
1481
1517
|
}
|
|
1482
1518
|
// ── Workflow operations ─────────────────────────────────────────
|
|
1483
|
-
/**
|
|
1519
|
+
/**
|
|
1520
|
+
* `POST /developers/workflows` — submit a compiled workflow spec + its
|
|
1521
|
+
* server ids. `server_ids` may be omitted for a server-less spec that uses
|
|
1522
|
+
* only platform built-in tools; the wire always carries an explicit array
|
|
1523
|
+
* (parity with the Python SDK's `list(server_ids)`).
|
|
1524
|
+
*/
|
|
1484
1525
|
async submitWorkflow(request) {
|
|
1485
|
-
return this.#request("POST", "/developers/workflows",
|
|
1526
|
+
return this.#request("POST", "/developers/workflows", {
|
|
1527
|
+
workflow_spec: request.workflow_spec,
|
|
1528
|
+
server_ids: request.server_ids ?? []
|
|
1529
|
+
});
|
|
1486
1530
|
}
|
|
1487
1531
|
/** `GET /developers/workflows` — list this developer's workflows. */
|
|
1488
1532
|
async listWorkflows() {
|
|
@@ -1559,6 +1603,23 @@ var ConvilynClient = class {
|
|
|
1559
1603
|
return [];
|
|
1560
1604
|
}
|
|
1561
1605
|
};
|
|
1606
|
+
function extractErrorCode(body) {
|
|
1607
|
+
if (typeof body !== "object" || body === null) {
|
|
1608
|
+
return null;
|
|
1609
|
+
}
|
|
1610
|
+
const record = body;
|
|
1611
|
+
if (typeof record.code === "string") {
|
|
1612
|
+
return record.code;
|
|
1613
|
+
}
|
|
1614
|
+
const detail = record.detail;
|
|
1615
|
+
if (typeof detail === "object" && detail !== null) {
|
|
1616
|
+
const code = detail.code;
|
|
1617
|
+
if (typeof code === "string") {
|
|
1618
|
+
return code;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return null;
|
|
1622
|
+
}
|
|
1562
1623
|
|
|
1563
1624
|
// src/harness.ts
|
|
1564
1625
|
async function invokeTool(server, toolName, args = {}, options = {}) {
|
|
@@ -1616,6 +1677,7 @@ exports.devInsecureRequested = devInsecureRequested;
|
|
|
1616
1677
|
exports.failedChecks = failedChecks;
|
|
1617
1678
|
exports.generateRefId = generateRefId;
|
|
1618
1679
|
exports.invokeTool = invokeTool;
|
|
1680
|
+
exports.isConvilynAuthorError = isConvilynAuthorError;
|
|
1619
1681
|
exports.mintConfirmationToken = mintConfirmationToken;
|
|
1620
1682
|
exports.normalizeForDigest = normalizeForDigest;
|
|
1621
1683
|
exports.runComplianceChecks = runComplianceChecks;
|