@toolpal/sdk 0.0.0-stage → 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/LICENSE ADDED
@@ -0,0 +1,85 @@
1
+ Toolpal License
2
+
3
+ Copyright (c) 2026 the Toolpal authors. All rights reserved.
4
+
5
+ This license covers the Toolpal client packages: toolpal, @toolpal/sdk,
6
+ @toolpal/tool, @toolpal/runtime, @toolpal/sandbox, @toolpal/manifest,
7
+ @toolpal/analyzer and @toolpal/builder (together, the "Software"). It does not
8
+ cover any other Toolpal software or service, such as the Toolpal registry or
9
+ website. The Toolpal authors are the "licensor"; "you" means the person or
10
+ organization using the Software.
11
+
12
+ 1. Use
13
+
14
+ The licensor grants you a free, worldwide, non-exclusive, non-transferable
15
+ license to install, run and use the Software for any purpose, including
16
+ commercial purposes, subject to the terms below.
17
+
18
+ 2. Tools you build
19
+
20
+ You may include @toolpal/tool, and any other code the Software adds to a
21
+ tool when it builds one, in tools you create. You may publish and
22
+ distribute those tools, through the Toolpal registry or otherwise, under
23
+ terms you choose for your own code. The parts of a tool that come from the
24
+ Software remain under this license.
25
+
26
+ 3. Copies
27
+
28
+ You may make the copies of the Software you need to use it, including in
29
+ your own applications, container images, caches and deployments, as long
30
+ as each copy keeps this license and is unmodified apart from automated
31
+ bundling, compilation or minification.
32
+
33
+ 4. Restrictions
34
+
35
+ You may not:
36
+
37
+ a. modify the Software or make derivative works of it, except as
38
+ sections 2 and 3 allow;
39
+ b. sell, rent, lease or sublicense the Software, or distribute it on its
40
+ own, except as sections 2 and 3 allow;
41
+ c. use the Software to offer a product or service that competes with
42
+ Toolpal, such as a tool registry or marketplace, without the
43
+ licensor's written permission;
44
+ d. remove or change any copyright, license or other notice in the
45
+ Software.
46
+
47
+ 5. Third-party software
48
+
49
+ The Software uses open-source components that are licensed to you under
50
+ their own licenses. Nothing in this license limits your rights under
51
+ those licenses.
52
+
53
+ 6. Ownership
54
+
55
+ The licensor keeps all rights in the Software that this license does not
56
+ expressly grant you. This license grants no rights to the Toolpal name or
57
+ logo.
58
+
59
+ 7. Termination
60
+
61
+ This license ends automatically if you break any of its terms. You must
62
+ then stop using the Software and delete your copies of it. Tools you
63
+ distributed before then stay licensed under section 2 for the people who
64
+ received them.
65
+
66
+ 8. No warranty
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
69
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
70
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
71
+
72
+ 9. Limitation of liability
73
+
74
+ IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
76
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
77
+ DEALINGS IN THE SOFTWARE. THIS INCLUDES HARM CAUSED BY TOOLS YOU RUN WITH
78
+ THE SOFTWARE: ITS ISOLATION REDUCES RISK BUT IS NOT A GUARANTEE (SEE THE
79
+ SECURITY MODEL IN THE TOOLPAL DOCUMENTATION).
80
+
81
+ 10. Future versions
82
+
83
+ The licensor may release future versions of the Software under different
84
+ terms. Each version of the Software is governed by the license included
85
+ with it.
package/README.md CHANGED
@@ -1,3 +1,31 @@
1
- # Temporary Holding Version
1
+ # @toolpal/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run pinned [Toolpal](https://toolpal.dev) workflows locally in a permission-restricted Node.js sandbox from your Node.js or TypeScript application.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @toolpal/sdk
9
+ npx toolpal add @toolpal/github-repo
10
+ ```
11
+
12
+ ## Usage
13
+
14
+ ```ts
15
+ import { toolpal } from "@toolpal/sdk";
16
+
17
+ const repo = await toolpal.execute({
18
+ tool: "@toolpal/github-repo",
19
+ input: { repo: "nodejs/node" },
20
+ });
21
+ ```
22
+
23
+ `toolpal.execute` only runs workflows pinned in your project's `toolpal.json` / `toolpal.lock`, validates inputs and outputs against each workflow's JSON Schema, and enforces declared permissions (`net`, `env`, `tmp`) inside an isolated Node.js child process.
24
+
25
+ Use `createToolpal(options)` for isolated instances, custom hooks (`beforeCall` / `afterCall`), `isolation: "per-call"`, or custom `fileRoots`.
26
+
27
+ ## Requirements
28
+
29
+ - **Node.js `>= 22.15.0`**
30
+
31
+ See [toolpal.dev/docs](https://toolpal.dev/docs) for full documentation, and [LICENSE](./LICENSE) for license terms.
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `@toolpal/sdk`: run pinned Toolpal tools from Node.js and TypeScript applications.
3
+ *
4
+ * ```ts
5
+ * import { toolpal } from "@toolpal/sdk";
6
+ *
7
+ * const { greeting } = await toolpal.execute<{ greeting: string }>({
8
+ * tool: "@demo/hello",
9
+ * input: { name: "Ada" },
10
+ * });
11
+ * ```
12
+ */
13
+ import { type ExecuteRequest, type HookContext, type ListedTool, type ToolpalOptions as RuntimeToolpalOptions, type ToolInfo, ToolpalError, type ToolpalErrorCode, type ToolpalHooks, type ToolpalLogEntry, type ToolpalLogHandler } from "@toolpal/runtime";
14
+ export type ToolpalOptions = Omit<RuntimeToolpalOptions, "simulateNetworkGuard">;
15
+ export type { ExecuteRequest, HookContext, ListedTool, ToolInfo, ToolpalErrorCode, ToolpalHooks, ToolpalLogEntry, ToolpalLogHandler, };
16
+ export { ToolpalError };
17
+ export interface DescribeOptions {
18
+ /** Also query the registry for live metadata (downloads, stars, publisher). Default: false. */
19
+ registryMetadata?: boolean;
20
+ }
21
+ /**
22
+ * Project-level client for executing pinned Toolpal tools from application code.
23
+ */
24
+ export interface ToolpalClient {
25
+ execute<TOut = unknown, TIn = unknown>(req: ExecuteRequest<TIn>): Promise<TOut>;
26
+ describe(tool: string, opts?: DescribeOptions): Promise<ToolInfo>;
27
+ install(tool: string): Promise<ToolInfo>;
28
+ list(): Promise<ListedTool[]>;
29
+ close(): Promise<void>;
30
+ }
31
+ /**
32
+ * Ready-to-use client rooted at the nearest ancestor of `process.cwd()` containing
33
+ * `toolpal.json`/`toolpal.lock` (or `process.cwd()`). Tool processes are unref'd
34
+ * when idle, so scripts exit on their own; long-running servers may `close()`.
35
+ */
36
+ export declare const toolpal: ToolpalClient;
37
+ /** Create an isolated project-level Toolpal client with custom options. */
38
+ export declare function createToolpal(opts?: ToolpalOptions): ToolpalClient;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,UAAU,EAEf,KAAK,cAAc,IAAI,qBAAqB,EAC5C,KAAK,QAAQ,EACb,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,EAAE,sBAAsB,CAAC,CAAC;AAEjF,YAAY,EACV,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,GAClB,CAAC;AACF,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,IAAI,GAAG,OAAO,EAAE,GAAG,GAAG,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AA6BD;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,aAkBrB,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,IAAI,GAAE,cAAmB,GAAG,aAAa,CAEtE"}
package/dist/index.js ADDED
@@ -0,0 +1,67 @@
1
+ /**
2
+ * `@toolpal/sdk`: run pinned Toolpal tools from Node.js and TypeScript applications.
3
+ *
4
+ * ```ts
5
+ * import { toolpal } from "@toolpal/sdk";
6
+ *
7
+ * const { greeting } = await toolpal.execute<{ greeting: string }>({
8
+ * tool: "@demo/hello",
9
+ * input: { name: "Ada" },
10
+ * });
11
+ * ```
12
+ */
13
+ import { Toolpal as RuntimeToolpal, ToolpalError, } from "@toolpal/runtime";
14
+ export { ToolpalError };
15
+ function wrap(runtime) {
16
+ return {
17
+ execute(req) {
18
+ return runtime.execute(req);
19
+ },
20
+ describe(tool, opts) {
21
+ return runtime.describe(tool, { registryMetadata: false, ...opts });
22
+ },
23
+ install(tool) {
24
+ return runtime.install(tool);
25
+ },
26
+ list() {
27
+ return runtime.list();
28
+ },
29
+ close() {
30
+ return runtime.close();
31
+ },
32
+ };
33
+ }
34
+ let instance;
35
+ function shared() {
36
+ instance ??= new RuntimeToolpal();
37
+ return instance;
38
+ }
39
+ /**
40
+ * Ready-to-use client rooted at the nearest ancestor of `process.cwd()` containing
41
+ * `toolpal.json`/`toolpal.lock` (or `process.cwd()`). Tool processes are unref'd
42
+ * when idle, so scripts exit on their own; long-running servers may `close()`.
43
+ */
44
+ export const toolpal = {
45
+ execute(req) {
46
+ return shared().execute(req);
47
+ },
48
+ describe(tool, opts) {
49
+ return shared().describe(tool, { registryMetadata: false, ...opts });
50
+ },
51
+ install(tool) {
52
+ return shared().install(tool);
53
+ },
54
+ list() {
55
+ return shared().list();
56
+ },
57
+ async close() {
58
+ const current = instance;
59
+ instance = undefined;
60
+ await current?.close();
61
+ },
62
+ };
63
+ /** Create an isolated project-level Toolpal client with custom options. */
64
+ export function createToolpal(opts = {}) {
65
+ return wrap(new RuntimeToolpal(opts));
66
+ }
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAIL,OAAO,IAAI,cAAc,EAGzB,YAAY,GAKb,MAAM,kBAAkB,CAAC;AAc1B,OAAO,EAAE,YAAY,EAAE,CAAC;AAkBxB,SAAS,IAAI,CAAC,OAAuB;IACnC,OAAO;QACL,OAAO,CAAgC,GAAwB;YAC7D,OAAO,OAAO,CAAC,OAAO,CAAY,GAAG,CAAC,CAAC;QACzC,CAAC;QACD,QAAQ,CAAC,IAAY,EAAE,IAAsB;YAC3C,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,OAAO,CAAC,IAAY;YAClB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,IAAI;YACF,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;QACD,KAAK;YACH,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,IAAI,QAAoC,CAAC;AAEzC,SAAS,MAAM;IACb,QAAQ,KAAK,IAAI,cAAc,EAAE,CAAC;IAClC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAkB;IACpC,OAAO,CAAgC,GAAwB;QAC7D,OAAO,MAAM,EAAE,CAAC,OAAO,CAAY,GAAG,CAAC,CAAC;IAC1C,CAAC;IACD,QAAQ,CAAC,IAAY,EAAE,IAAsB;QAC3C,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,CAAC,IAAY;QAClB,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IACD,IAAI;QACF,OAAO,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IACD,KAAK,CAAC,KAAK;QACT,MAAM,OAAO,GAAG,QAAQ,CAAC;QACzB,QAAQ,GAAG,SAAS,CAAC;QACrB,MAAM,OAAO,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;CACF,CAAC;AAEF,2EAA2E;AAC3E,MAAM,UAAU,aAAa,CAAC,IAAI,GAAmB,EAAE;IACrD,OAAO,IAAI,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@toolpal/sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Execute pinned Toolpal workflows locally in a sandbox from Node.js and TypeScript apps",
5
+ "homepage": "https://toolpal.dev",
6
+ "keywords": [
7
+ "toolpal",
8
+ "sdk",
9
+ "workflows",
10
+ "ai-agents",
11
+ "sandbox",
12
+ "local-first"
13
+ ],
14
+ "type": "module",
15
+ "license": "SEE LICENSE IN LICENSE",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "LICENSE",
28
+ "README.md"
29
+ ],
30
+ "engines": {
31
+ "node": ">=22.15.0"
32
+ },
33
+ "dependencies": {
34
+ "@toolpal/runtime": "0.1.1"
35
+ },
36
+ "devDependencies": {
37
+ "@toolpal/manifest": "0.1.1",
38
+ "@toolpal/builder": "0.1.1",
39
+ "@toolpal/sandbox": "0.1.1"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -b"
43
+ }
6
44
  }