@kweaver-ai/kweaver-sdk 0.6.9 → 0.7.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.
@@ -0,0 +1,68 @@
1
+ import { debugTool, executeTool, exportConfig, importConfig, listTools, listToolboxes, setToolStatuses, uploadTool, } from "../api/toolboxes.js";
2
+ /** Toolbox / tool management on the agent-operator-integration service. */
3
+ export class ToolboxesResource {
4
+ ctx;
5
+ constructor(ctx) {
6
+ this.ctx = ctx;
7
+ }
8
+ async list(opts = {}) {
9
+ return listToolboxes({ ...this.ctx.base(), ...opts });
10
+ }
11
+ async listToolsIn(boxId) {
12
+ return listTools({ ...this.ctx.base(), boxId });
13
+ }
14
+ async uploadTool(opts) {
15
+ return uploadTool({
16
+ ...this.ctx.base(),
17
+ boxId: opts.boxId,
18
+ filePath: opts.filePath,
19
+ metadataType: opts.metadataType,
20
+ });
21
+ }
22
+ async setToolStatuses(opts) {
23
+ await setToolStatuses({ ...this.ctx.base(), ...opts });
24
+ }
25
+ /** Execute a published+enabled tool through the toolbox proxy. */
26
+ async execute(boxId, toolId, args = {}) {
27
+ return executeTool({
28
+ ...this.ctx.base(),
29
+ boxId,
30
+ toolId,
31
+ ...this.injectAuth(args),
32
+ });
33
+ }
34
+ /** Debug a tool through the toolbox proxy (works on draft/disabled tools too). */
35
+ async debug(boxId, toolId, args = {}) {
36
+ return debugTool({
37
+ ...this.ctx.base(),
38
+ boxId,
39
+ toolId,
40
+ ...this.injectAuth(args),
41
+ });
42
+ }
43
+ /**
44
+ * Export a toolbox/mcp/operator config (.adp JSON) as raw bytes.
45
+ *
46
+ * Returned bytes are usually UTF-8 JSON; mirrors the Python SDK's
47
+ * `export_config -> bytes`. Use `new TextDecoder().decode(buf)` if you
48
+ * need a string.
49
+ */
50
+ async exportConfig(id, opts = {}) {
51
+ return exportConfig({ ...this.ctx.base(), id, type: opts.type });
52
+ }
53
+ /** Import a previously exported config from disk. */
54
+ async importConfig(filePath, opts = {}) {
55
+ return importConfig({ ...this.ctx.base(), filePath, type: opts.type });
56
+ }
57
+ // The forwarder requires every header the downstream tool expects to be set
58
+ // explicitly under `header`; most published tools declare an Authorization
59
+ // parameter and would otherwise see no token. Auto-inject the active
60
+ // session token unless the caller already provided one.
61
+ injectAuth(args) {
62
+ const header = { ...(args.header ?? {}) };
63
+ const hasAuth = Object.keys(header).some((k) => k.toLowerCase() === "authorization");
64
+ if (!hasAuth)
65
+ header.Authorization = `Bearer ${this.ctx.base().accessToken}`;
66
+ return { ...args, header };
67
+ }
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kweaver-ai/kweaver-sdk",
3
- "version": "0.6.9",
3
+ "version": "0.7.1",
4
4
  "description": "KWeaver TypeScript SDK — CLI tool and programmatic API for knowledge networks and Decision Agents.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",