@callsitehq/zod 0.2.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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Callsite contributors
|
|
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:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @callsitehq/zod
|
|
2
|
+
|
|
3
|
+
Zod adapter for Callsite capability configs.
|
|
4
|
+
|
|
5
|
+
Use this package when your capabilities use Zod schemas and you want the CLI to
|
|
6
|
+
compile capabilities into Callsite IR without writing a JSON Schema mapper.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { defineConfig } from "@callsitehq/zod";
|
|
10
|
+
|
|
11
|
+
import { capabilities } from "./src/capabilities.js";
|
|
12
|
+
|
|
13
|
+
export default defineConfig({
|
|
14
|
+
capabilities
|
|
15
|
+
});
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Status
|
|
19
|
+
|
|
20
|
+
Early `0.x` package. It targets Zod 4's native JSON Schema emission.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AnyCapability, ToJsonSchema } from '@callsitehq/core';
|
|
2
|
+
|
|
3
|
+
interface DefineConfigOptions<Capabilities extends readonly AnyCapability[] = readonly AnyCapability[]> {
|
|
4
|
+
readonly capabilities: Capabilities;
|
|
5
|
+
readonly emit?: CallsiteEmitConfig;
|
|
6
|
+
}
|
|
7
|
+
interface CallsiteEmitConfig {
|
|
8
|
+
readonly mcp?: CallsiteMcpEmitConfig;
|
|
9
|
+
readonly openapi?: CallsiteOpenApiEmitConfig;
|
|
10
|
+
}
|
|
11
|
+
interface CallsiteMcpEmitConfig {
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly version?: string;
|
|
14
|
+
}
|
|
15
|
+
interface CallsiteOpenApiEmitConfig extends CallsiteMcpEmitConfig {
|
|
16
|
+
readonly baseUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
interface ZodCallsiteConfig<Capabilities extends readonly AnyCapability[] = readonly AnyCapability[]> extends DefineConfigOptions<Capabilities> {
|
|
19
|
+
readonly toJsonSchema: ToJsonSchema;
|
|
20
|
+
}
|
|
21
|
+
declare const toJsonSchema: ToJsonSchema;
|
|
22
|
+
declare function defineConfig<Capabilities extends readonly AnyCapability[]>(config: DefineConfigOptions<Capabilities>): ZodCallsiteConfig<Capabilities>;
|
|
23
|
+
|
|
24
|
+
export { type CallsiteEmitConfig, type CallsiteMcpEmitConfig, type CallsiteOpenApiEmitConfig, type DefineConfigOptions, type ZodCallsiteConfig, defineConfig, toJsonSchema };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var toJsonSchema = (schema, options) => z.toJSONSchema(schema, { io: options.direction });
|
|
4
|
+
function defineConfig(config) {
|
|
5
|
+
return {
|
|
6
|
+
...config,
|
|
7
|
+
toJsonSchema
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
defineConfig,
|
|
12
|
+
toJsonSchema
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport type { AnyCapability, JsonSchema, ToJsonSchema } from \"@callsitehq/core\";\n\nexport interface DefineConfigOptions<\n Capabilities extends readonly AnyCapability[] = readonly AnyCapability[]\n> {\n readonly capabilities: Capabilities;\n readonly emit?: CallsiteEmitConfig;\n}\n\nexport interface CallsiteEmitConfig {\n readonly mcp?: CallsiteMcpEmitConfig;\n readonly openapi?: CallsiteOpenApiEmitConfig;\n}\n\nexport interface CallsiteMcpEmitConfig {\n readonly name?: string;\n readonly version?: string;\n}\n\nexport interface CallsiteOpenApiEmitConfig extends CallsiteMcpEmitConfig {\n readonly baseUrl?: string;\n}\n\nexport interface ZodCallsiteConfig<\n Capabilities extends readonly AnyCapability[] = readonly AnyCapability[]\n> extends DefineConfigOptions<Capabilities> {\n readonly toJsonSchema: ToJsonSchema;\n}\n\nexport const toJsonSchema: ToJsonSchema = (schema, options) =>\n z.toJSONSchema(schema as z.ZodType, { io: options.direction }) as JsonSchema;\n\nexport function defineConfig<Capabilities extends readonly AnyCapability[]>(\n config: DefineConfigOptions<Capabilities>\n): ZodCallsiteConfig<Capabilities> {\n return {\n ...config,\n toJsonSchema\n };\n}\n"],"mappings":";AAAA,SAAS,SAAS;AA+BX,IAAM,eAA6B,CAAC,QAAQ,YACjD,EAAE,aAAa,QAAqB,EAAE,IAAI,QAAQ,UAAU,CAAC;AAExD,SAAS,aACd,QACiC;AACjC,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@callsitehq/zod",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Zod adapter for Callsite capability configs.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agents",
|
|
7
|
+
"capabilities",
|
|
8
|
+
"mcp",
|
|
9
|
+
"openapi",
|
|
10
|
+
"typescript",
|
|
11
|
+
"zod"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"homepage": "https://github.com/callsitehq/callsite/tree/main/packages/zod#readme",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/callsitehq/callsite.git",
|
|
18
|
+
"directory": "packages/zod"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/callsitehq/callsite/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"sideEffects": false,
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@callsitehq/core": "0.2.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"zod": "^4.0.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"zod": "^4.0.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"clean": "rm -rf dist *.tsbuildinfo",
|
|
49
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
50
|
+
}
|
|
51
|
+
}
|