toolfactory 0.1.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.
- package/README.md +166 -0
- package/dist/bindings/index.d.ts +23 -0
- package/dist/bindings/index.js +29 -0
- package/dist/bindings/python.d.ts +33 -0
- package/dist/bindings/python.js +805 -0
- package/dist/bindings/python.test.d.ts +1 -0
- package/dist/bindings/python.test.js +316 -0
- package/dist/bindings/typescript.d.ts +39 -0
- package/dist/bindings/typescript.js +758 -0
- package/dist/bindings/typescript.test.d.ts +1 -0
- package/dist/bindings/typescript.test.js +264 -0
- package/dist/commands.d.ts +188 -0
- package/dist/commands.js +662 -0
- package/dist/commands.test.d.ts +1 -0
- package/dist/commands.test.js +215 -0
- package/dist/e2e.test.d.ts +1 -0
- package/dist/e2e.test.js +124 -0
- package/dist/hosts/browser.d.ts +10 -0
- package/dist/hosts/browser.js +94 -0
- package/dist/hosts/github.d.ts +66 -0
- package/dist/hosts/github.js +247 -0
- package/dist/hosts/openclaw.d.ts +4 -0
- package/dist/hosts/openclaw.js +94 -0
- package/dist/hosts/template.d.ts +15 -0
- package/dist/hosts/template.js +142 -0
- package/dist/hosts/web.d.ts +4 -0
- package/dist/hosts/web.js +89 -0
- package/dist/identity/name.d.ts +20 -0
- package/dist/identity/name.js +33 -0
- package/dist/identity/name.test.d.ts +1 -0
- package/dist/identity/name.test.js +37 -0
- package/dist/identity/read.d.ts +9 -0
- package/dist/identity/read.js +106 -0
- package/dist/identity/read.test.d.ts +1 -0
- package/dist/identity/read.test.js +76 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/introspect/index.d.ts +15 -0
- package/dist/introspect/index.js +63 -0
- package/dist/model.d.ts +236 -0
- package/dist/model.js +214 -0
- package/dist/ops.d.ts +255 -0
- package/dist/ops.js +297 -0
- package/dist/project/apply.d.ts +35 -0
- package/dist/project/apply.js +360 -0
- package/dist/project/apply.test.d.ts +1 -0
- package/dist/project/apply.test.js +285 -0
- package/dist/project/gate.d.ts +129 -0
- package/dist/project/gate.js +597 -0
- package/dist/project/history.d.ts +62 -0
- package/dist/project/history.js +41 -0
- package/dist/project/load.d.ts +21 -0
- package/dist/project/load.js +82 -0
- package/dist/project/lock.d.ts +28 -0
- package/dist/project/lock.js +42 -0
- package/dist/project/plan.d.ts +5 -0
- package/dist/project/plan.js +96 -0
- package/dist/report/coverage.d.ts +22 -0
- package/dist/report/coverage.js +72 -0
- package/dist/report/coverage.test.d.ts +1 -0
- package/dist/report/coverage.test.js +93 -0
- package/dist/surfaces/agent-plugins.d.ts +10 -0
- package/dist/surfaces/agent-plugins.js +36 -0
- package/dist/surfaces/agents.d.ts +35 -0
- package/dist/surfaces/agents.js +609 -0
- package/dist/surfaces/agents.template.d.ts +8 -0
- package/dist/surfaces/agents.template.js +21 -0
- package/dist/surfaces/agents.test.d.ts +1 -0
- package/dist/surfaces/agents.test.js +181 -0
- package/dist/surfaces/browser-extension.d.ts +101 -0
- package/dist/surfaces/browser-extension.js +1034 -0
- package/dist/surfaces/browser-extension.test.d.ts +1 -0
- package/dist/surfaces/browser-extension.test.js +145 -0
- package/dist/surfaces/claude.d.ts +2 -0
- package/dist/surfaces/claude.js +81 -0
- package/dist/surfaces/codex.d.ts +13 -0
- package/dist/surfaces/codex.js +101 -0
- package/dist/surfaces/codex.test.d.ts +1 -0
- package/dist/surfaces/codex.test.js +67 -0
- package/dist/surfaces/cursor.d.ts +2 -0
- package/dist/surfaces/cursor.js +50 -0
- package/dist/surfaces/distribution.test.d.ts +1 -0
- package/dist/surfaces/distribution.test.js +146 -0
- package/dist/surfaces/dsh.d.ts +25 -0
- package/dist/surfaces/dsh.js +147 -0
- package/dist/surfaces/dsh.test.d.ts +1 -0
- package/dist/surfaces/dsh.test.js +100 -0
- package/dist/surfaces/external.d.ts +9 -0
- package/dist/surfaces/external.js +4 -0
- package/dist/surfaces/gemini.d.ts +29 -0
- package/dist/surfaces/gemini.js +68 -0
- package/dist/surfaces/gemini.test.d.ts +1 -0
- package/dist/surfaces/gemini.test.js +74 -0
- package/dist/surfaces/hermes-native.d.ts +53 -0
- package/dist/surfaces/hermes-native.js +507 -0
- package/dist/surfaces/hermes-native.test.d.ts +1 -0
- package/dist/surfaces/hermes-native.test.js +156 -0
- package/dist/surfaces/kernel.d.ts +5 -0
- package/dist/surfaces/kernel.js +63 -0
- package/dist/surfaces/mcp-registry.d.ts +19 -0
- package/dist/surfaces/mcp-registry.js +160 -0
- package/dist/surfaces/mcp-registry.test.d.ts +1 -0
- package/dist/surfaces/mcp-registry.test.js +79 -0
- package/dist/surfaces/mcpb.d.ts +11 -0
- package/dist/surfaces/mcpb.js +118 -0
- package/dist/surfaces/mcpb.test.d.ts +1 -0
- package/dist/surfaces/mcpb.test.js +104 -0
- package/dist/surfaces/npm.d.ts +6 -0
- package/dist/surfaces/npm.js +72 -0
- package/dist/surfaces/openclaw-native.d.ts +93 -0
- package/dist/surfaces/openclaw-native.js +956 -0
- package/dist/surfaces/openclaw-native.test.d.ts +1 -0
- package/dist/surfaces/openclaw-native.test.js +246 -0
- package/dist/surfaces/pypi.d.ts +5 -0
- package/dist/surfaces/pypi.js +82 -0
- package/dist/surfaces/readme.d.ts +7 -0
- package/dist/surfaces/readme.js +181 -0
- package/dist/surfaces/registry.d.ts +6 -0
- package/dist/surfaces/registry.js +73 -0
- package/dist/surfaces/shared.d.ts +49 -0
- package/dist/surfaces/shared.js +112 -0
- package/dist/surfaces/skill.d.ts +7 -0
- package/dist/surfaces/skill.js +118 -0
- package/dist/surfaces/skill.test.d.ts +1 -0
- package/dist/surfaces/skill.test.js +87 -0
- package/dist/surfaces/web.d.ts +97 -0
- package/dist/surfaces/web.js +1285 -0
- package/dist/surfaces/web.test.d.ts +1 -0
- package/dist/surfaces/web.test.js +255 -0
- package/dist/surfaces/workflows.d.ts +2 -0
- package/dist/surfaces/workflows.js +809 -0
- package/dist/surfaces/workflows.test.d.ts +1 -0
- package/dist/surfaces/workflows.test.js +563 -0
- package/dist/toolfactory/cli.d.ts +2 -0
- package/dist/toolfactory/cli.js +65 -0
- package/dist/toolfactory/config.d.ts +3 -0
- package/dist/toolfactory/config.js +27 -0
- package/dist/toolfactory/mcp.d.ts +37 -0
- package/dist/toolfactory/mcp.js +269 -0
- package/dist/toolfactory/types.d.ts +31 -0
- package/dist/toolfactory/types.js +10 -0
- package/dist/toolfactory/web.d.ts +4 -0
- package/dist/toolfactory/web.js +40 -0
- package/dist/validate/agent-plugins.d.ts +5 -0
- package/dist/validate/agent-plugins.js +46 -0
- package/package.json +68 -0
- package/schemas/agent-plugins/mcp.schema.json +120 -0
- package/schemas/agent-plugins/plugin.schema.json +65 -0
- package/src/bindings/index.ts +47 -0
- package/src/bindings/python.test.ts +374 -0
- package/src/bindings/python.ts +862 -0
- package/src/bindings/typescript.test.ts +329 -0
- package/src/bindings/typescript.ts +818 -0
- package/src/commands.test.ts +253 -0
- package/src/commands.ts +886 -0
- package/src/e2e.test.ts +169 -0
- package/src/hosts/browser.ts +106 -0
- package/src/hosts/github.ts +321 -0
- package/src/hosts/openclaw.ts +110 -0
- package/src/hosts/template.ts +149 -0
- package/src/hosts/web.ts +111 -0
- package/src/identity/name.test.ts +43 -0
- package/src/identity/name.ts +39 -0
- package/src/identity/read.test.ts +92 -0
- package/src/identity/read.ts +119 -0
- package/src/index.ts +11 -0
- package/src/introspect/index.ts +72 -0
- package/src/model.ts +386 -0
- package/src/ops.ts +333 -0
- package/src/project/apply.test.ts +348 -0
- package/src/project/apply.ts +417 -0
- package/src/project/gate.ts +717 -0
- package/src/project/history.ts +46 -0
- package/src/project/load.ts +104 -0
- package/src/project/lock.ts +54 -0
- package/src/project/plan.ts +101 -0
- package/src/report/coverage.test.ts +108 -0
- package/src/report/coverage.ts +113 -0
- package/src/surfaces/agent-plugins.ts +47 -0
- package/src/surfaces/agents.template.ts +32 -0
- package/src/surfaces/agents.test.ts +206 -0
- package/src/surfaces/agents.ts +729 -0
- package/src/surfaces/browser-extension.test.ts +175 -0
- package/src/surfaces/browser-extension.ts +1095 -0
- package/src/surfaces/claude.ts +99 -0
- package/src/surfaces/codex.test.ts +71 -0
- package/src/surfaces/codex.ts +105 -0
- package/src/surfaces/cursor.ts +62 -0
- package/src/surfaces/distribution.test.ts +166 -0
- package/src/surfaces/dsh.test.ts +110 -0
- package/src/surfaces/dsh.ts +159 -0
- package/src/surfaces/external.ts +13 -0
- package/src/surfaces/gemini.test.ts +80 -0
- package/src/surfaces/gemini.ts +84 -0
- package/src/surfaces/hermes-native.test.ts +179 -0
- package/src/surfaces/hermes-native.ts +584 -0
- package/src/surfaces/kernel.ts +68 -0
- package/src/surfaces/mcp-registry.test.ts +99 -0
- package/src/surfaces/mcp-registry.ts +190 -0
- package/src/surfaces/mcpb.test.ts +112 -0
- package/src/surfaces/mcpb.ts +130 -0
- package/src/surfaces/npm.ts +78 -0
- package/src/surfaces/openclaw-native.test.ts +283 -0
- package/src/surfaces/openclaw-native.ts +1070 -0
- package/src/surfaces/pypi.ts +84 -0
- package/src/surfaces/readme.ts +218 -0
- package/src/surfaces/registry.ts +79 -0
- package/src/surfaces/shared.ts +140 -0
- package/src/surfaces/skill.test.ts +103 -0
- package/src/surfaces/skill.ts +136 -0
- package/src/surfaces/web.test.ts +303 -0
- package/src/surfaces/web.ts +1310 -0
- package/src/surfaces/workflows.test.ts +677 -0
- package/src/surfaces/workflows.ts +936 -0
- package/src/toolfactory/cli.ts +74 -0
- package/src/toolfactory/config.ts +33 -0
- package/src/toolfactory/mcp.ts +311 -0
- package/src/toolfactory/types.ts +52 -0
- package/src/toolfactory/web.ts +45 -0
- package/src/validate/agent-plugins.ts +53 -0
- package/web/dist/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/web/dist/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/web/dist/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/web/dist/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/web/dist/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/web/dist/assets/index-CCXhQKK3.css +2 -0
- package/web/dist/assets/index-D1PwZ3qS.js +10 -0
- package/web/dist/index.html +14 -0
package/dist/model.js
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared plane. Every generator and command works only with these types.
|
|
3
|
+
*
|
|
4
|
+
* Identity is authored in one file the ecosystem already defines (plugin.json,
|
|
5
|
+
* package.json, pyproject.toml, or a host manifest). Operations come from the
|
|
6
|
+
* author's code, snapshotted from the kernel MCP server's `tools/list`. The
|
|
7
|
+
* rest is derived and written in-tree, tracked by a lock file.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
export const CAPABILITIES = [
|
|
11
|
+
"net",
|
|
12
|
+
"fs",
|
|
13
|
+
"shell",
|
|
14
|
+
"secret",
|
|
15
|
+
"browser",
|
|
16
|
+
"model",
|
|
17
|
+
"user-input",
|
|
18
|
+
"channel",
|
|
19
|
+
];
|
|
20
|
+
export const PORTABLE_CAPABILITIES = new Set([
|
|
21
|
+
"net",
|
|
22
|
+
"fs",
|
|
23
|
+
"shell",
|
|
24
|
+
"secret",
|
|
25
|
+
]);
|
|
26
|
+
export const SURFACE_IDS = [
|
|
27
|
+
"skill",
|
|
28
|
+
"agent-plugins",
|
|
29
|
+
"claude",
|
|
30
|
+
"codex",
|
|
31
|
+
"cursor",
|
|
32
|
+
"mcp",
|
|
33
|
+
"mcp-registry",
|
|
34
|
+
"cli",
|
|
35
|
+
"npm",
|
|
36
|
+
"pypi",
|
|
37
|
+
"openclaw-native",
|
|
38
|
+
"hermes-native",
|
|
39
|
+
"clawhub",
|
|
40
|
+
"web",
|
|
41
|
+
"dsh",
|
|
42
|
+
"workflows",
|
|
43
|
+
"agents",
|
|
44
|
+
"readme",
|
|
45
|
+
"gemini",
|
|
46
|
+
"mcpb",
|
|
47
|
+
"browser-extension",
|
|
48
|
+
];
|
|
49
|
+
export const BINDINGS = ["typescript", "python"];
|
|
50
|
+
/**
|
|
51
|
+
* What `init` selects when asked for nothing: the skills-first minimum that already serves every
|
|
52
|
+
* harness — a skill (installed anywhere by `npx skills add`), the Agent Plugins bundle, the
|
|
53
|
+
* kernel as an MCP server and a CLI, and the binding's package registry to distribute them. Every
|
|
54
|
+
* host-specific plugin is opt-in: add one only when that host needs what a skill and an MCP
|
|
55
|
+
* server cannot give it (a gateway tab, browser capability, a store listing).
|
|
56
|
+
*/
|
|
57
|
+
export function defaultSurfaces(binding) {
|
|
58
|
+
return ["skill", "agent-plugins", "mcp", "cli", binding === "python" ? "pypi" : "npm"];
|
|
59
|
+
}
|
|
60
|
+
/** Package managers the generated workflows know how to drive; read from package.json `packageManager`. */
|
|
61
|
+
export const PACKAGE_MANAGERS = ["npm", "pnpm"];
|
|
62
|
+
/** Agent Plugins 1.0.0 name rule; the canonical name N every projection derives from. */
|
|
63
|
+
export const NAME_PATTERN = /^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;
|
|
64
|
+
const jsonObject = z.record(z.string(), z.unknown());
|
|
65
|
+
/** `dev.toolfactory/tool.json` — the one file toolfactory owns. */
|
|
66
|
+
export const ToolConfigSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
$schema: z.string().optional(),
|
|
69
|
+
schemaVersion: z.literal(1),
|
|
70
|
+
identity: z
|
|
71
|
+
.string()
|
|
72
|
+
.describe("Repo-relative path of the authored identity file (plugin.json, package.json, pyproject.toml, or a host manifest)."),
|
|
73
|
+
binding: z.enum(BINDINGS).describe("Language of the core logic and its kernel surfaces."),
|
|
74
|
+
runtime: z
|
|
75
|
+
.enum(["kernel", "none"])
|
|
76
|
+
.optional()
|
|
77
|
+
.describe("Whether this project has an executable kernel. `none` is for an instruction-only Codex skill/plugin and permits only the skill and codex surfaces."),
|
|
78
|
+
surfaces: z
|
|
79
|
+
.array(z.enum(SURFACE_IDS))
|
|
80
|
+
.min(1)
|
|
81
|
+
.describe("Selected surfaces. A file exists iff a selected surface owns it."),
|
|
82
|
+
kernel: z
|
|
83
|
+
.object({
|
|
84
|
+
command: z.string(),
|
|
85
|
+
args: z.array(z.string()).default([]),
|
|
86
|
+
})
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("How to spawn the kernel MCP server for introspection; defaults from the binding."),
|
|
89
|
+
bundle: z
|
|
90
|
+
.object({ runtime: z.enum(["package", "bundled"]).default("package") })
|
|
91
|
+
.default({ runtime: "package" })
|
|
92
|
+
.describe("How mcp.json reaches the kernel: a published package (npx/uvx) or a committed single-file build."),
|
|
93
|
+
config: jsonObject
|
|
94
|
+
.optional()
|
|
95
|
+
.refine((schema) => Object.values((schema?.properties ?? {})).every((property) => !property["x-toolfactory"]?.sensitive ||
|
|
96
|
+
property.default === undefined), "A sensitive config property must not declare a default: it would be committed into every manifest.")
|
|
97
|
+
.describe("JSON Schema 2020-12 object for the tool's configuration; mark secrets with x-toolfactory.sensitive."),
|
|
98
|
+
tests: z
|
|
99
|
+
.object({ examples: z.record(z.string(), jsonObject).default({}) })
|
|
100
|
+
.default({ examples: {} })
|
|
101
|
+
.describe("Example arguments per operation, used by the generated surface-smoke tests."),
|
|
102
|
+
npm: z.object({ scope: z.string().optional() }).optional(),
|
|
103
|
+
codex: z.object({ interface: jsonObject.optional() }).optional(),
|
|
104
|
+
browserExtension: z
|
|
105
|
+
.object({
|
|
106
|
+
endpoint: z
|
|
107
|
+
.string()
|
|
108
|
+
.optional()
|
|
109
|
+
.describe("The kernel's mcp --http URL the extension pairs with; defaults to the kernel's own default port."),
|
|
110
|
+
authDomains: z
|
|
111
|
+
.array(z.string())
|
|
112
|
+
.optional()
|
|
113
|
+
.describe("Match patterns the extension may act in with the user's own session (host_permissions)."),
|
|
114
|
+
cookieExport: z
|
|
115
|
+
.boolean()
|
|
116
|
+
.optional()
|
|
117
|
+
.describe("Opt in to exporting the session cookies of authDomains to the kernel (needs the cookies permission; Chromium and Firefox only)."),
|
|
118
|
+
geckoId: z
|
|
119
|
+
.string()
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Firefox add-on id; defaults to <name>@<github owner>.github.io."),
|
|
122
|
+
icon: z
|
|
123
|
+
.string()
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Repo-relative source PNG or SVG the icon set is resized from; the placeholder set otherwise."),
|
|
126
|
+
sidePanel: z
|
|
127
|
+
.boolean()
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("Also register a Chromium side panel (Chromium only)."),
|
|
130
|
+
safari: z
|
|
131
|
+
.boolean()
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("Add the macOS Safari packaging leg to the release workflow."),
|
|
134
|
+
})
|
|
135
|
+
.optional(),
|
|
136
|
+
mcpb: z
|
|
137
|
+
.object({ privacyPolicies: z.array(z.string()).optional() })
|
|
138
|
+
.optional()
|
|
139
|
+
.describe("Privacy-policy URLs of the services this tool talks to; Anthropic's Connectors Directory submission requires them in the MCPB manifest."),
|
|
140
|
+
hermes: z.object({ toolset: z.string().optional() }).optional(),
|
|
141
|
+
openclaw: z
|
|
142
|
+
.object({
|
|
143
|
+
registers: z
|
|
144
|
+
.array(z.object({
|
|
145
|
+
api: z
|
|
146
|
+
.string()
|
|
147
|
+
.describe("OpenClawPluginApi method, e.g. registerRealtimeVoiceProvider"),
|
|
148
|
+
contract: z
|
|
149
|
+
.string()
|
|
150
|
+
.describe("openclaw.plugin.json contracts key, e.g. realtimeVoiceProviders"),
|
|
151
|
+
ids: z.array(z.string()).default([]).describe("Ids registered under that contract"),
|
|
152
|
+
}))
|
|
153
|
+
.optional()
|
|
154
|
+
.describe("Host registrations the plugin makes beyond tools; one declaration drives the manifest contracts, the plugin inspector's expectations and the generated test."),
|
|
155
|
+
activation: jsonObject
|
|
156
|
+
.optional()
|
|
157
|
+
.describe("openclaw.plugin.json activation; default onStartup."),
|
|
158
|
+
pluginApi: z
|
|
159
|
+
.string()
|
|
160
|
+
.optional()
|
|
161
|
+
.describe("Plugin API range for compat.pluginApi and the openclaw peer dependency."),
|
|
162
|
+
dependencies: z.record(z.string(), z.string()).optional(),
|
|
163
|
+
peerDependencies: z.record(z.string(), z.string()).optional(),
|
|
164
|
+
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
165
|
+
})
|
|
166
|
+
.optional(),
|
|
167
|
+
})
|
|
168
|
+
.superRefine((tool, context) => {
|
|
169
|
+
if (tool.runtime !== "none")
|
|
170
|
+
return;
|
|
171
|
+
const unsupported = tool.surfaces.filter((surface) => surface !== "skill" && surface !== "codex");
|
|
172
|
+
if (unsupported.length) {
|
|
173
|
+
context.addIssue({
|
|
174
|
+
code: "custom",
|
|
175
|
+
path: ["surfaces"],
|
|
176
|
+
message: `runtime "none" supports only skill and codex surfaces; unsupported: ${unsupported.join(", ")}.`,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
})
|
|
180
|
+
.strict();
|
|
181
|
+
/** An instruction-only plugin has author prose but no generated executable or MCP server. */
|
|
182
|
+
export function isInstructionOnly(tool) {
|
|
183
|
+
return tool.runtime === "none";
|
|
184
|
+
}
|
|
185
|
+
export function isPortable(operation) {
|
|
186
|
+
return operation.requires.every((capability) => PORTABLE_CAPABILITIES.has(capability));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* The other half of the sensitive-config law above: a sensitive key must not declare a default
|
|
190
|
+
* (it would be committed into every manifest), and **no operation may take one as an argument**.
|
|
191
|
+
*
|
|
192
|
+
* An operation's `inputSchema` is projected onto MCP `tools/call`, the CLI flags, the skill's
|
|
193
|
+
* operations block, the web form and every host manifest at once, so a property named like a
|
|
194
|
+
* secret is a paste-into-chat path on every surface simultaneously. A secret reaches the kernel
|
|
195
|
+
* through config — the environment a host injects from its own masked store — and never through
|
|
196
|
+
* an argument. Enforced wherever a project is loaded, so `introspect`, `build` and `check` all
|
|
197
|
+
* refuse it.
|
|
198
|
+
*/
|
|
199
|
+
export function assertNoSensitiveArgument(config, operations) {
|
|
200
|
+
const properties = (config?.properties ?? {});
|
|
201
|
+
const sensitive = new Set(Object.entries(properties)
|
|
202
|
+
.filter(([, property]) => property["x-toolfactory"]?.sensitive)
|
|
203
|
+
.map(([key]) => key));
|
|
204
|
+
if (!sensitive.size)
|
|
205
|
+
return;
|
|
206
|
+
for (const operation of operations) {
|
|
207
|
+
const inputs = (operation.inputSchema.properties ?? {});
|
|
208
|
+
for (const name of Object.keys(inputs)) {
|
|
209
|
+
if (!sensitive.has(name))
|
|
210
|
+
continue;
|
|
211
|
+
throw new Error(`Operation "${operation.name}" declares an input named "${name}", which is a sensitive config key: a secret reaches the kernel through config (the environment the host injects), never through an argument every surface would prompt for. Read it from config in the handler and drop the property.`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
package/dist/ops.d.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* toolfactory's own operations. toolfactory is a tool built with toolfactory: this file is
|
|
3
|
+
* the author-owned operation module, and `src/toolfactory/{cli,mcp}.ts` are generated from
|
|
4
|
+
* it by `toolfactory build`, exactly as for any other tool.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
export declare const operations: (import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
8
|
+
root: z.ZodDefault<z.ZodString>;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
binding: z.ZodEnum<{
|
|
11
|
+
typescript: "typescript";
|
|
12
|
+
python: "python";
|
|
13
|
+
}>;
|
|
14
|
+
runtime: z.ZodOptional<z.ZodEnum<{
|
|
15
|
+
kernel: "kernel";
|
|
16
|
+
none: "none";
|
|
17
|
+
}>>;
|
|
18
|
+
surfaces: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
19
|
+
skill: "skill";
|
|
20
|
+
"agent-plugins": "agent-plugins";
|
|
21
|
+
claude: "claude";
|
|
22
|
+
codex: "codex";
|
|
23
|
+
cursor: "cursor";
|
|
24
|
+
mcp: "mcp";
|
|
25
|
+
"mcp-registry": "mcp-registry";
|
|
26
|
+
cli: "cli";
|
|
27
|
+
npm: "npm";
|
|
28
|
+
pypi: "pypi";
|
|
29
|
+
"openclaw-native": "openclaw-native";
|
|
30
|
+
"hermes-native": "hermes-native";
|
|
31
|
+
clawhub: "clawhub";
|
|
32
|
+
web: "web";
|
|
33
|
+
dsh: "dsh";
|
|
34
|
+
workflows: "workflows";
|
|
35
|
+
agents: "agents";
|
|
36
|
+
readme: "readme";
|
|
37
|
+
gemini: "gemini";
|
|
38
|
+
mcpb: "mcpb";
|
|
39
|
+
"browser-extension": "browser-extension";
|
|
40
|
+
}>>>;
|
|
41
|
+
description: z.ZodOptional<z.ZodString>;
|
|
42
|
+
license: z.ZodOptional<z.ZodString>;
|
|
43
|
+
repository: z.ZodOptional<z.ZodString>;
|
|
44
|
+
author: z.ZodOptional<z.ZodString>;
|
|
45
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
git: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
+
setup: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
49
|
+
public: z.ZodDefault<z.ZodBoolean>;
|
|
50
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
reviewers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
written: z.ZodArray<z.ZodString>;
|
|
54
|
+
agentConfig: z.ZodObject<{
|
|
55
|
+
setup: z.ZodBoolean;
|
|
56
|
+
harnesses: z.ZodArray<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
repository: z.ZodOptional<z.ZodObject<{
|
|
59
|
+
repository: z.ZodString;
|
|
60
|
+
visibility: z.ZodString;
|
|
61
|
+
topics: z.ZodArray<z.ZodString>;
|
|
62
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
63
|
+
commands: z.ZodArray<z.ZodString>;
|
|
64
|
+
dryRun: z.ZodBoolean;
|
|
65
|
+
}, z.core.$strip>>;
|
|
66
|
+
nextSteps: z.ZodArray<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
68
|
+
root: z.ZodDefault<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
path: z.ZodString;
|
|
71
|
+
changed: z.ZodBoolean;
|
|
72
|
+
operations: z.ZodNumber;
|
|
73
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
74
|
+
root: z.ZodDefault<z.ZodString>;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
written: z.ZodArray<z.ZodString>;
|
|
77
|
+
deleted: z.ZodArray<z.ZodString>;
|
|
78
|
+
unchanged: z.ZodArray<z.ZodString>;
|
|
79
|
+
manual: z.ZodArray<z.ZodString>;
|
|
80
|
+
stripped: z.ZodArray<z.ZodString>;
|
|
81
|
+
nudge: z.ZodOptional<z.ZodString>;
|
|
82
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
83
|
+
root: z.ZodDefault<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
ok: z.ZodLiteral<true>;
|
|
86
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
87
|
+
root: z.ZodDefault<z.ZodString>;
|
|
88
|
+
surface: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
skill: "skill";
|
|
90
|
+
"agent-plugins": "agent-plugins";
|
|
91
|
+
claude: "claude";
|
|
92
|
+
codex: "codex";
|
|
93
|
+
cursor: "cursor";
|
|
94
|
+
mcp: "mcp";
|
|
95
|
+
"mcp-registry": "mcp-registry";
|
|
96
|
+
cli: "cli";
|
|
97
|
+
npm: "npm";
|
|
98
|
+
pypi: "pypi";
|
|
99
|
+
"openclaw-native": "openclaw-native";
|
|
100
|
+
"hermes-native": "hermes-native";
|
|
101
|
+
clawhub: "clawhub";
|
|
102
|
+
web: "web";
|
|
103
|
+
dsh: "dsh";
|
|
104
|
+
workflows: "workflows";
|
|
105
|
+
agents: "agents";
|
|
106
|
+
readme: "readme";
|
|
107
|
+
gemini: "gemini";
|
|
108
|
+
mcpb: "mcpb";
|
|
109
|
+
"browser-extension": "browser-extension";
|
|
110
|
+
}>>;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
outcomes: z.ZodArray<z.ZodObject<{
|
|
113
|
+
label: z.ZodString;
|
|
114
|
+
command: z.ZodString;
|
|
115
|
+
ok: z.ZodBoolean;
|
|
116
|
+
}, z.core.$strip>>;
|
|
117
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
118
|
+
root: z.ZodDefault<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
surfaces: z.ZodArray<z.ZodString>;
|
|
121
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
122
|
+
operation: z.ZodString;
|
|
123
|
+
verdicts: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
124
|
+
kind: z.ZodString;
|
|
125
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strip>>;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
129
|
+
root: z.ZodDefault<z.ZodString>;
|
|
130
|
+
path: z.ZodString;
|
|
131
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
132
|
+
adopted: z.ZodString;
|
|
133
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
134
|
+
root: z.ZodDefault<z.ZodString>;
|
|
135
|
+
path: z.ZodString;
|
|
136
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
137
|
+
regenerated: z.ZodString;
|
|
138
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
139
|
+
root: z.ZodDefault<z.ZodString>;
|
|
140
|
+
surface: z.ZodEnum<{
|
|
141
|
+
skill: "skill";
|
|
142
|
+
"agent-plugins": "agent-plugins";
|
|
143
|
+
claude: "claude";
|
|
144
|
+
codex: "codex";
|
|
145
|
+
cursor: "cursor";
|
|
146
|
+
mcp: "mcp";
|
|
147
|
+
"mcp-registry": "mcp-registry";
|
|
148
|
+
cli: "cli";
|
|
149
|
+
npm: "npm";
|
|
150
|
+
pypi: "pypi";
|
|
151
|
+
"openclaw-native": "openclaw-native";
|
|
152
|
+
"hermes-native": "hermes-native";
|
|
153
|
+
clawhub: "clawhub";
|
|
154
|
+
web: "web";
|
|
155
|
+
dsh: "dsh";
|
|
156
|
+
workflows: "workflows";
|
|
157
|
+
agents: "agents";
|
|
158
|
+
readme: "readme";
|
|
159
|
+
gemini: "gemini";
|
|
160
|
+
mcpb: "mcpb";
|
|
161
|
+
"browser-extension": "browser-extension";
|
|
162
|
+
}>;
|
|
163
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
164
|
+
adopted: z.ZodArray<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
166
|
+
root: z.ZodDefault<z.ZodString>;
|
|
167
|
+
reviewers: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
168
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
169
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
170
|
+
repository: z.ZodString;
|
|
171
|
+
environment: z.ZodString;
|
|
172
|
+
reviewers: z.ZodArray<z.ZodString>;
|
|
173
|
+
secrets: z.ZodArray<z.ZodString>;
|
|
174
|
+
missing: z.ZodArray<z.ZodString>;
|
|
175
|
+
commands: z.ZodArray<z.ZodString>;
|
|
176
|
+
manual: z.ZodArray<z.ZodString>;
|
|
177
|
+
dryRun: z.ZodBoolean;
|
|
178
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
179
|
+
root: z.ZodDefault<z.ZodString>;
|
|
180
|
+
action: z.ZodDefault<z.ZodEnum<{
|
|
181
|
+
check: "check";
|
|
182
|
+
status: "status";
|
|
183
|
+
}>>;
|
|
184
|
+
key: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
186
|
+
secrets: z.ZodArray<z.ZodObject<{
|
|
187
|
+
name: z.ZodString;
|
|
188
|
+
kind: z.ZodEnum<{
|
|
189
|
+
config: "config";
|
|
190
|
+
release: "release";
|
|
191
|
+
}>;
|
|
192
|
+
required: z.ZodBoolean;
|
|
193
|
+
needs: z.ZodArray<z.ZodString>;
|
|
194
|
+
local: z.ZodBoolean;
|
|
195
|
+
github: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
url: z.ZodOptional<z.ZodString>;
|
|
197
|
+
howTo: z.ZodArray<z.ZodString>;
|
|
198
|
+
check: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
ok: z.ZodBoolean;
|
|
200
|
+
command: z.ZodString;
|
|
201
|
+
}, z.core.$strip>>;
|
|
202
|
+
}, z.core.$strip>>;
|
|
203
|
+
manual: z.ZodArray<z.ZodString>;
|
|
204
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
205
|
+
root: z.ZodDefault<z.ZodString>;
|
|
206
|
+
ref: z.ZodDefault<z.ZodString>;
|
|
207
|
+
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
208
|
+
hard: z.ZodDefault<z.ZodBoolean>;
|
|
209
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
from: z.ZodOptional<z.ZodString>;
|
|
211
|
+
dropped: z.ZodArray<z.ZodEnum<{
|
|
212
|
+
skill: "skill";
|
|
213
|
+
"agent-plugins": "agent-plugins";
|
|
214
|
+
claude: "claude";
|
|
215
|
+
codex: "codex";
|
|
216
|
+
cursor: "cursor";
|
|
217
|
+
mcp: "mcp";
|
|
218
|
+
"mcp-registry": "mcp-registry";
|
|
219
|
+
cli: "cli";
|
|
220
|
+
npm: "npm";
|
|
221
|
+
pypi: "pypi";
|
|
222
|
+
"openclaw-native": "openclaw-native";
|
|
223
|
+
"hermes-native": "hermes-native";
|
|
224
|
+
clawhub: "clawhub";
|
|
225
|
+
web: "web";
|
|
226
|
+
dsh: "dsh";
|
|
227
|
+
workflows: "workflows";
|
|
228
|
+
agents: "agents";
|
|
229
|
+
readme: "readme";
|
|
230
|
+
gemini: "gemini";
|
|
231
|
+
mcpb: "mcpb";
|
|
232
|
+
"browser-extension": "browser-extension";
|
|
233
|
+
}>>;
|
|
234
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
235
|
+
name: z.ZodString;
|
|
236
|
+
run: z.ZodString;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
ran: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
239
|
+
name: z.ZodString;
|
|
240
|
+
ok: z.ZodBoolean;
|
|
241
|
+
durationMs: z.ZodNumber;
|
|
242
|
+
}, z.core.$strip>>>;
|
|
243
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{
|
|
244
|
+
root: z.ZodDefault<z.ZodString>;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
steps: z.ZodArray<z.ZodObject<{
|
|
247
|
+
name: z.ZodString;
|
|
248
|
+
ok: z.ZodBoolean;
|
|
249
|
+
durationMs: z.ZodNumber;
|
|
250
|
+
}, z.core.$strip>>;
|
|
251
|
+
}, z.core.$strip>> | import("./toolfactory/types.js").Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
252
|
+
toolfactory: z.ZodString;
|
|
253
|
+
node: z.ZodString;
|
|
254
|
+
tools: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
255
|
+
}, z.core.$strip>>)[];
|