@nodetool-ai/protocol 0.7.0-rc.11

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.
Files changed (117) hide show
  1. package/dist/agent-protocol.d.ts +217 -0
  2. package/dist/agent-protocol.d.ts.map +1 -0
  3. package/dist/agent-protocol.js +85 -0
  4. package/dist/agent-protocol.js.map +1 -0
  5. package/dist/api-schemas/api-error-code.d.ts +21 -0
  6. package/dist/api-schemas/api-error-code.d.ts.map +1 -0
  7. package/dist/api-schemas/api-error-code.js +20 -0
  8. package/dist/api-schemas/api-error-code.js.map +1 -0
  9. package/dist/api-schemas/assets.d.ts +162 -0
  10. package/dist/api-schemas/assets.d.ts.map +1 -0
  11. package/dist/api-schemas/assets.js +119 -0
  12. package/dist/api-schemas/assets.js.map +1 -0
  13. package/dist/api-schemas/collections.d.ts +64 -0
  14. package/dist/api-schemas/collections.d.ts.map +1 -0
  15. package/dist/api-schemas/collections.js +67 -0
  16. package/dist/api-schemas/collections.js.map +1 -0
  17. package/dist/api-schemas/costs.d.ts +168 -0
  18. package/dist/api-schemas/costs.d.ts.map +1 -0
  19. package/dist/api-schemas/costs.js +90 -0
  20. package/dist/api-schemas/costs.js.map +1 -0
  21. package/dist/api-schemas/error-helpers.d.ts +19 -0
  22. package/dist/api-schemas/error-helpers.d.ts.map +1 -0
  23. package/dist/api-schemas/error-helpers.js +7 -0
  24. package/dist/api-schemas/error-helpers.js.map +1 -0
  25. package/dist/api-schemas/files.d.ts +38 -0
  26. package/dist/api-schemas/files.d.ts.map +1 -0
  27. package/dist/api-schemas/files.js +25 -0
  28. package/dist/api-schemas/files.js.map +1 -0
  29. package/dist/api-schemas/fonts.d.ts +6 -0
  30. package/dist/api-schemas/fonts.d.ts.map +1 -0
  31. package/dist/api-schemas/fonts.js +8 -0
  32. package/dist/api-schemas/fonts.js.map +1 -0
  33. package/dist/api-schemas/index.d.ts +20 -0
  34. package/dist/api-schemas/index.d.ts.map +1 -0
  35. package/dist/api-schemas/index.js +20 -0
  36. package/dist/api-schemas/index.js.map +1 -0
  37. package/dist/api-schemas/jobs.d.ts +77 -0
  38. package/dist/api-schemas/jobs.d.ts.map +1 -0
  39. package/dist/api-schemas/jobs.js +60 -0
  40. package/dist/api-schemas/jobs.js.map +1 -0
  41. package/dist/api-schemas/mcp-config.d.ts +119 -0
  42. package/dist/api-schemas/mcp-config.d.ts.map +1 -0
  43. package/dist/api-schemas/mcp-config.js +59 -0
  44. package/dist/api-schemas/mcp-config.js.map +1 -0
  45. package/dist/api-schemas/messages.d.ts +77 -0
  46. package/dist/api-schemas/messages.d.ts.map +1 -0
  47. package/dist/api-schemas/messages.js +81 -0
  48. package/dist/api-schemas/messages.js.map +1 -0
  49. package/dist/api-schemas/models.d.ts +202 -0
  50. package/dist/api-schemas/models.d.ts.map +1 -0
  51. package/dist/api-schemas/models.js +135 -0
  52. package/dist/api-schemas/models.js.map +1 -0
  53. package/dist/api-schemas/nodes.d.ts +23 -0
  54. package/dist/api-schemas/nodes.d.ts.map +1 -0
  55. package/dist/api-schemas/nodes.js +20 -0
  56. package/dist/api-schemas/nodes.js.map +1 -0
  57. package/dist/api-schemas/settings.d.ts +75 -0
  58. package/dist/api-schemas/settings.d.ts.map +1 -0
  59. package/dist/api-schemas/settings.js +66 -0
  60. package/dist/api-schemas/settings.js.map +1 -0
  61. package/dist/api-schemas/skills.d.ts +19 -0
  62. package/dist/api-schemas/skills.d.ts.map +1 -0
  63. package/dist/api-schemas/skills.js +16 -0
  64. package/dist/api-schemas/skills.js.map +1 -0
  65. package/dist/api-schemas/storage.d.ts +46 -0
  66. package/dist/api-schemas/storage.d.ts.map +1 -0
  67. package/dist/api-schemas/storage.js +32 -0
  68. package/dist/api-schemas/storage.js.map +1 -0
  69. package/dist/api-schemas/threads.d.ts +58 -0
  70. package/dist/api-schemas/threads.d.ts.map +1 -0
  71. package/dist/api-schemas/threads.js +52 -0
  72. package/dist/api-schemas/threads.js.map +1 -0
  73. package/dist/api-schemas/users.d.ts +49 -0
  74. package/dist/api-schemas/users.d.ts.map +1 -0
  75. package/dist/api-schemas/users.js +44 -0
  76. package/dist/api-schemas/users.js.map +1 -0
  77. package/dist/api-schemas/workflows.d.ts +489 -0
  78. package/dist/api-schemas/workflows.d.ts.map +1 -0
  79. package/dist/api-schemas/workflows.js +248 -0
  80. package/dist/api-schemas/workflows.js.map +1 -0
  81. package/dist/api-schemas/workspace.d.ts +88 -0
  82. package/dist/api-schemas/workspace.d.ts.map +1 -0
  83. package/dist/api-schemas/workspace.js +65 -0
  84. package/dist/api-schemas/workspace.js.map +1 -0
  85. package/dist/api-types.d.ts +809 -0
  86. package/dist/api-types.d.ts.map +1 -0
  87. package/dist/api-types.js +9 -0
  88. package/dist/api-types.js.map +1 -0
  89. package/dist/graph.d.ts +75 -0
  90. package/dist/graph.d.ts.map +1 -0
  91. package/dist/graph.js +15 -0
  92. package/dist/graph.js.map +1 -0
  93. package/dist/index.d.ts +12 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +12 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/messages.d.ts +334 -0
  98. package/dist/messages.d.ts.map +1 -0
  99. package/dist/messages.js +71 -0
  100. package/dist/messages.js.map +1 -0
  101. package/dist/toolSchemas.d.ts +108 -0
  102. package/dist/toolSchemas.d.ts.map +1 -0
  103. package/dist/toolSchemas.js +205 -0
  104. package/dist/toolSchemas.js.map +1 -0
  105. package/dist/type-metadata.d.ts +39 -0
  106. package/dist/type-metadata.d.ts.map +1 -0
  107. package/dist/type-metadata.js +126 -0
  108. package/dist/type-metadata.js.map +1 -0
  109. package/dist/typecheck.d.ts +17 -0
  110. package/dist/typecheck.d.ts.map +1 -0
  111. package/dist/typecheck.js +63 -0
  112. package/dist/typecheck.js.map +1 -0
  113. package/dist/wrap-primitives.d.ts +18 -0
  114. package/dist/wrap-primitives.d.ts.map +1 -0
  115. package/dist/wrap-primitives.js +28 -0
  116. package/dist/wrap-primitives.js.map +1 -0
  117. package/package.json +58 -0
@@ -0,0 +1,108 @@
1
+ import { z } from "zod";
2
+ export declare const xyPositionSchema: z.ZodObject<{
3
+ x: z.ZodNumber;
4
+ y: z.ZodNumber;
5
+ }, z.core.$strip>;
6
+ export declare const positionInputSchema: z.ZodUnion<readonly [z.ZodObject<{
7
+ x: z.ZodNumber;
8
+ y: z.ZodNumber;
9
+ }, z.core.$strip>, z.ZodString]>;
10
+ export declare const nodePropertySchema: z.ZodRecord<z.ZodString, z.ZodAny>;
11
+ export declare const optionalWorkflowIdSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ export declare const uiSearchNodesParams: {
13
+ query: z.ZodString;
14
+ input_type: z.ZodOptional<z.ZodString>;
15
+ output_type: z.ZodOptional<z.ZodString>;
16
+ strict_match: z.ZodOptional<z.ZodBoolean>;
17
+ include_properties: z.ZodOptional<z.ZodBoolean>;
18
+ include_outputs: z.ZodOptional<z.ZodBoolean>;
19
+ limit: z.ZodOptional<z.ZodNumber>;
20
+ };
21
+ export declare const uiAddNodeParams: {
22
+ id: z.ZodString;
23
+ type: z.ZodString;
24
+ position: z.ZodUnion<readonly [z.ZodObject<{
25
+ x: z.ZodNumber;
26
+ y: z.ZodNumber;
27
+ }, z.core.$strip>, z.ZodString]>;
28
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
29
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
30
+ };
31
+ export declare const uiConnectNodesParams: {
32
+ source_node_id: z.ZodString;
33
+ source_handle: z.ZodString;
34
+ target_node_id: z.ZodString;
35
+ target_handle: z.ZodString;
36
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ };
38
+ export declare const uiGetGraphParams: {
39
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ };
41
+ export declare const uiUpdateNodeDataParams: {
42
+ node_id: z.ZodString;
43
+ data: z.ZodRecord<z.ZodString, z.ZodAny>;
44
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ };
46
+ export declare const uiDeleteNodeParams: {
47
+ node_id: z.ZodString;
48
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ };
50
+ export declare const uiDeleteEdgeParams: {
51
+ edge_id: z.ZodString;
52
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ };
54
+ export declare const uiMoveNodeParams: {
55
+ node_id: z.ZodString;
56
+ position: z.ZodObject<{
57
+ x: z.ZodNumber;
58
+ y: z.ZodNumber;
59
+ }, z.core.$strip>;
60
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
+ };
62
+ export declare const uiSetNodeTitleParams: {
63
+ node_id: z.ZodString;
64
+ title: z.ZodString;
65
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ };
67
+ export declare const uiSetNodeSyncModeParams: {
68
+ node_id: z.ZodString;
69
+ mode: z.ZodEnum<{
70
+ on_any: "on_any";
71
+ zip_all: "zip_all";
72
+ }>;
73
+ workflow_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
+ };
75
+ export declare const uiOpenWorkflowParams: {
76
+ workflow_id: z.ZodString;
77
+ };
78
+ export declare const uiRunWorkflowParams: {
79
+ workflow_id: z.ZodString;
80
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
81
+ };
82
+ export declare const uiSwitchTabParams: {
83
+ tab_index: z.ZodNumber;
84
+ };
85
+ export declare const MODEL_SEARCH_KINDS: readonly ["text_to_image", "image_to_image", "text_to_video", "image_to_video", "text_to_speech", "speech_to_text", "text_generation", "embedding"];
86
+ export declare const uiSearchModelsParams: {
87
+ kind: z.ZodEnum<{
88
+ image_to_video: "image_to_video";
89
+ text_to_image: "text_to_image";
90
+ image_to_image: "image_to_image";
91
+ text_to_video: "text_to_video";
92
+ text_to_speech: "text_to_speech";
93
+ speech_to_text: "speech_to_text";
94
+ text_generation: "text_generation";
95
+ embedding: "embedding";
96
+ }>;
97
+ limit: z.ZodOptional<z.ZodNumber>;
98
+ };
99
+ export declare const uiCopyParams: {
100
+ text: z.ZodString;
101
+ };
102
+ export declare const uiPasteParams: {};
103
+ export interface UiToolSchema {
104
+ description: string;
105
+ parameters: Record<string, z.ZodTypeAny>;
106
+ }
107
+ export declare const uiToolSchemas: Record<string, UiToolSchema>;
108
+ //# sourceMappingURL=toolSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSchemas.d.ts","sourceRoot":"","sources":["../src/toolSchemas.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB;;;iBAA6C,CAAC;AAC3E,eAAO,MAAM,mBAAmB;;;gCAA0C,CAAC;AAC3E,eAAO,MAAM,kBAAkB,oCAAgC,CAAC;AAChE,eAAO,MAAM,wBAAwB,2CAMlC,CAAC;AAIJ,eAAO,MAAM,mBAAmB;;;;;;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAoB3B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;CAkBhC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAE5B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;CAQlC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;CAM5B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;CAIhC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;CAQnC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;CAEhC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAQ/B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;CAM7B,CAAC;AAEF,eAAO,MAAM,kBAAkB,qJASrB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;CAiBhC,CAAC;AAEF,eAAO,MAAM,YAAY;;CAExB,CAAC;AAEF,eAAO,MAAM,aAAa,IAAK,CAAC;AAKhC,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAgFtD,CAAC"}
@@ -0,0 +1,205 @@
1
+ // packages/protocol/src/toolSchemas.ts
2
+ //
3
+ // Shared Zod tool schemas for frontend UI tools.
4
+ // Exported as ZodRawShape (plain objects of Zod types) for:
5
+ // - Agent SDK MCP server registration (electron/src/agent.ts)
6
+ // - Frontend tool validation (web/src/lib/tools/builtin/*.ts wraps with z.object())
7
+ //
8
+ // If you update a schema here, update the corresponding builtin tool file too.
9
+ import { z } from "zod";
10
+ // --- Shared sub-schemas ---
11
+ export const xyPositionSchema = z.object({ x: z.number(), y: z.number() });
12
+ export const positionInputSchema = z.union([xyPositionSchema, z.string()]);
13
+ export const nodePropertySchema = z.record(z.string(), z.any());
14
+ export const optionalWorkflowIdSchema = z
15
+ .string()
16
+ .nullable()
17
+ .optional()
18
+ .describe("Optional workflow id; when omitted/null, the current workflow is used.");
19
+ // --- Tool parameter shapes (ZodRawShape for SDK tool()) ---
20
+ export const uiSearchNodesParams = {
21
+ query: z.string(),
22
+ input_type: z.string().optional(),
23
+ output_type: z.string().optional(),
24
+ strict_match: z.boolean().optional(),
25
+ include_properties: z.boolean().optional(),
26
+ include_outputs: z.boolean().optional(),
27
+ limit: z.number().min(1).max(100).optional()
28
+ };
29
+ export const uiAddNodeParams = {
30
+ id: z
31
+ .string()
32
+ .describe("Unique node id within the workflow. Must be a stable, model-chosen string (e.g. 'llm_1', 'image_out')."),
33
+ type: z
34
+ .string()
35
+ .describe("Node type identifier from `ui_search_nodes` (e.g. 'nodetool.text.Format'). Same as `node_type` in search results."),
36
+ position: positionInputSchema.describe("Canvas coordinates: `{ x: number, y: number }`. Space nodes ~240px horizontally, ~160px vertically."),
37
+ properties: nodePropertySchema
38
+ .optional()
39
+ .describe("Optional initial property values keyed by property name. Required properties left unset will be reported as warnings."),
40
+ workflow_id: optionalWorkflowIdSchema
41
+ };
42
+ export const uiConnectNodesParams = {
43
+ source_node_id: z
44
+ .string()
45
+ .describe("Id of the node producing the value."),
46
+ source_handle: z
47
+ .string()
48
+ .describe("Output port name on the source node (from `outputs[].name` in ui_search_nodes)."),
49
+ target_node_id: z
50
+ .string()
51
+ .describe("Id of the node consuming the value."),
52
+ target_handle: z
53
+ .string()
54
+ .describe("Input port name on the target node (the property name from `properties[].name` in ui_search_nodes)."),
55
+ workflow_id: optionalWorkflowIdSchema
56
+ };
57
+ export const uiGetGraphParams = {
58
+ workflow_id: optionalWorkflowIdSchema
59
+ };
60
+ export const uiUpdateNodeDataParams = {
61
+ node_id: z.string().describe("Id of the node to update."),
62
+ data: z
63
+ .record(z.string(), z.any())
64
+ .describe("Partial node-data overlay merged into `data` (e.g. `{ properties: { x: 1 }, title: 'New' }`). Unspecified keys are preserved."),
65
+ workflow_id: optionalWorkflowIdSchema
66
+ };
67
+ export const uiDeleteNodeParams = {
68
+ node_id: z.string().describe("Id of the node to delete."),
69
+ workflow_id: optionalWorkflowIdSchema
70
+ };
71
+ export const uiDeleteEdgeParams = {
72
+ edge_id: z.string().describe("Id of the edge to delete."),
73
+ workflow_id: optionalWorkflowIdSchema
74
+ };
75
+ export const uiMoveNodeParams = {
76
+ node_id: z.string().describe("Id of the node to move."),
77
+ position: xyPositionSchema.describe("Absolute canvas coordinates `{x, y}` (numbers, not a string)."),
78
+ workflow_id: optionalWorkflowIdSchema
79
+ };
80
+ export const uiSetNodeTitleParams = {
81
+ node_id: z.string().describe("Id of the node whose title to set."),
82
+ title: z.string().describe("New display title for the node."),
83
+ workflow_id: optionalWorkflowIdSchema
84
+ };
85
+ export const uiSetNodeSyncModeParams = {
86
+ node_id: z.string().describe("Id of the node whose sync mode to set."),
87
+ mode: z
88
+ .enum(["on_any", "zip_all"])
89
+ .describe("`on_any`: process as soon as any input arrives. `zip_all`: wait for all inputs and pair them in arrival order."),
90
+ workflow_id: optionalWorkflowIdSchema
91
+ };
92
+ export const uiOpenWorkflowParams = {
93
+ workflow_id: z.string().describe("Id of the workflow to open.")
94
+ };
95
+ export const uiRunWorkflowParams = {
96
+ workflow_id: z.string().describe("Id of the workflow to run."),
97
+ params: z
98
+ .record(z.string(), z.unknown())
99
+ .optional()
100
+ .describe("Optional workflow input parameters keyed by input-node name.")
101
+ };
102
+ export const uiSwitchTabParams = {
103
+ tab_index: z
104
+ .number()
105
+ .int()
106
+ .min(0)
107
+ .describe("Zero-based tab index (0 is the first tab).")
108
+ };
109
+ export const MODEL_SEARCH_KINDS = [
110
+ "text_to_image",
111
+ "image_to_image",
112
+ "text_to_video",
113
+ "image_to_video",
114
+ "text_to_speech",
115
+ "speech_to_text",
116
+ "text_generation",
117
+ "embedding"
118
+ ];
119
+ export const uiSearchModelsParams = {
120
+ kind: z
121
+ .enum(MODEL_SEARCH_KINDS)
122
+ .describe("Model task category. Match to the AI node you're configuring: " +
123
+ "`text_to_image` for nodetool.image.TextToImage, `image_to_image` for nodetool.image.ImageToImage, " +
124
+ "`text_to_video` for nodetool.video.TextToVideo, `image_to_video` for nodetool.video.ImageToVideo, " +
125
+ "`text_to_speech` for nodetool.audio.TextToSpeech, `speech_to_text` for nodetool.text.AutomaticSpeechRecognition, " +
126
+ "`text_generation` for nodetool.agents.* and nodetool.generators.*, `embedding` for nodetool.text.Embedding."),
127
+ limit: z
128
+ .number()
129
+ .int()
130
+ .min(1)
131
+ .max(50)
132
+ .optional()
133
+ .describe("Max results to return (default 20).")
134
+ };
135
+ export const uiCopyParams = {
136
+ text: z.string().describe("The text to copy to the system clipboard.")
137
+ };
138
+ export const uiPasteParams = {};
139
+ export const uiToolSchemas = {
140
+ ui_search_nodes: {
141
+ description: "Search available node types from metadata store by query/type filters.",
142
+ parameters: uiSearchNodesParams
143
+ },
144
+ ui_search_models: {
145
+ description: "List recommended/available AI models for a given task. Required: `kind` (one of: text_to_image, image_to_image, text_to_video, image_to_video, text_to_speech, speech_to_text, text_generation, embedding). Returns model ids you can write to a generic AI node's `model` property via ui_update_node_data.",
146
+ parameters: uiSearchModelsParams
147
+ },
148
+ ui_add_node: {
149
+ description: "Add a single node to the current workflow graph. Required: `id` (unique within workflow), `type` (from ui_search_nodes), `position` ({x,y}). Optional: `properties` (initial values).",
150
+ parameters: uiAddNodeParams
151
+ },
152
+ ui_connect_nodes: {
153
+ description: "Connect two nodes by port name. Required: `source_node_id`, `source_handle` (output name), `target_node_id`, `target_handle` (input/property name).",
154
+ parameters: uiConnectNodesParams
155
+ },
156
+ ui_get_graph: {
157
+ description: "Get the current workflow graph (nodes and edges). No required arguments.",
158
+ parameters: uiGetGraphParams
159
+ },
160
+ ui_update_node_data: {
161
+ description: "Merge a partial overlay into a node's `data` (properties, title, sync_mode, etc.). Required: `node_id`, `data`.",
162
+ parameters: uiUpdateNodeDataParams
163
+ },
164
+ ui_delete_node: {
165
+ description: "Delete a node from the workflow graph. Required: `node_id`.",
166
+ parameters: uiDeleteNodeParams
167
+ },
168
+ ui_delete_edge: {
169
+ description: "Delete an edge from the workflow graph. Required: `edge_id`.",
170
+ parameters: uiDeleteEdgeParams
171
+ },
172
+ ui_move_node: {
173
+ description: "Move a node to an absolute canvas position. Required: `node_id`, `position` ({x, y}).",
174
+ parameters: uiMoveNodeParams
175
+ },
176
+ ui_set_node_title: {
177
+ description: "Set a node's display title. Required: `node_id`, `title`.",
178
+ parameters: uiSetNodeTitleParams
179
+ },
180
+ ui_set_node_sync_mode: {
181
+ description: "Set a node's input sync mode. Required: `node_id`, `mode` ('on_any' | 'zip_all').",
182
+ parameters: uiSetNodeSyncModeParams
183
+ },
184
+ ui_open_workflow: {
185
+ description: "Open a workflow tab and switch to it. Required: `workflow_id`.",
186
+ parameters: uiOpenWorkflowParams
187
+ },
188
+ ui_run_workflow: {
189
+ description: "Run a workflow. Required: `workflow_id`. Optional: `params` (input values).",
190
+ parameters: uiRunWorkflowParams
191
+ },
192
+ ui_switch_tab: {
193
+ description: "Switch to an already-open workflow tab. Required: `tab_index` (0-based).",
194
+ parameters: uiSwitchTabParams
195
+ },
196
+ ui_copy: {
197
+ description: "Copy text to the system clipboard. Required: `text`.",
198
+ parameters: uiCopyParams
199
+ },
200
+ ui_paste: {
201
+ description: "Read the system clipboard and return its text content. No arguments.",
202
+ parameters: uiPasteParams
203
+ }
204
+ };
205
+ //# sourceMappingURL=toolSchemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolSchemas.js","sourceRoot":"","sources":["../src/toolSchemas.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,iDAAiD;AACjD,4DAA4D;AAC5D,gEAAgE;AAChE,sFAAsF;AACtF,EAAE;AACF,+EAA+E;AAE/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6BAA6B;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,QAAQ,EAAE;KACV,QAAQ,CACP,wEAAwE,CACzE,CAAC;AAEJ,6DAA6D;AA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IACD,aAAa,EAAE;QACb,WAAW,EACT,0EAA0E;QAC5E,UAAU,EAAE,iBAAiB;KAC9B;IACD,OAAO,EAAE;QACP,WAAW,EAAE,sDAAsD;QACnE,UAAU,EAAE,YAAY;KACzB;IACD,QAAQ,EAAE;QACR,WAAW,EACT,sEAAsE;QACxE,UAAU,EAAE,aAAa;KAC1B;CACF,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * TypeMetadata — T-META-1.
3
+ *
4
+ * Parses and represents NodeTool type strings like "list[int]", "union[str, int]",
5
+ * "ImageRef", "any". Supports type compatibility checking.
6
+ */
7
+ export declare class TypeMetadata {
8
+ /** The base type name (e.g. "list", "union", "int", "ImageRef"). */
9
+ readonly type: string;
10
+ /** Inner type arguments for parameterized types (e.g. ["int"] for list[int]). */
11
+ readonly args: TypeMetadata[];
12
+ private constructor();
13
+ /**
14
+ * Parse a type string into a TypeMetadata instance.
15
+ *
16
+ * Examples: "int", "list[int]", "union[str, int]", "ImageRef", "any"
17
+ */
18
+ static fromString(typeStr: string): TypeMetadata;
19
+ /** Returns true if this is a list type (e.g. "list[int]"). */
20
+ isListType(): boolean;
21
+ /** Returns true if this is a union type (e.g. "union[str, int]"). */
22
+ isUnionType(): boolean;
23
+ /** Returns true if this is the "any" type. */
24
+ isAny(): boolean;
25
+ /**
26
+ * Check if this type is compatible with another type.
27
+ *
28
+ * Compatible means:
29
+ * - Same type (including args)
30
+ * - Either is "any"
31
+ * - Numeric widening (int -> float, int -> number, float -> number)
32
+ * - Union contains the other type
33
+ * - List element types are compatible
34
+ */
35
+ isCompatibleWith(other: TypeMetadata): boolean;
36
+ /** String representation. */
37
+ toString(): string;
38
+ }
39
+ //# sourceMappingURL=type-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-metadata.d.ts","sourceRoot":"","sources":["../src/type-metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,qBAAa,YAAY;IACvB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;IAE9B,OAAO;IAKP;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAwBhD,8DAA8D;IAC9D,UAAU,IAAI,OAAO;IAIrB,qEAAqE;IACrE,WAAW,IAAI,OAAO;IAItB,8CAA8C;IAC9C,KAAK,IAAI,OAAO;IAIhB;;;;;;;;;OASG;IACH,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IA4B9C,6BAA6B;IAC7B,QAAQ,IAAI,MAAM;CAInB"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * TypeMetadata — T-META-1.
3
+ *
4
+ * Parses and represents NodeTool type strings like "list[int]", "union[str, int]",
5
+ * "ImageRef", "any". Supports type compatibility checking.
6
+ */
7
+ const NUMERIC_TYPES = new Set(["int", "float", "number"]);
8
+ export class TypeMetadata {
9
+ /** The base type name (e.g. "list", "union", "int", "ImageRef"). */
10
+ type;
11
+ /** Inner type arguments for parameterized types (e.g. ["int"] for list[int]). */
12
+ args;
13
+ constructor(type, args = []) {
14
+ this.type = type;
15
+ this.args = args;
16
+ }
17
+ /**
18
+ * Parse a type string into a TypeMetadata instance.
19
+ *
20
+ * Examples: "int", "list[int]", "union[str, int]", "ImageRef", "any"
21
+ */
22
+ static fromString(typeStr) {
23
+ const s = typeStr.trim();
24
+ if (!s)
25
+ return new TypeMetadata("any");
26
+ const bracketIdx = s.indexOf("[");
27
+ if (bracketIdx === -1) {
28
+ return new TypeMetadata(s);
29
+ }
30
+ // Must end with ]
31
+ if (!s.endsWith("]")) {
32
+ return new TypeMetadata(s);
33
+ }
34
+ const baseName = s.slice(0, bracketIdx);
35
+ const inner = s.slice(bracketIdx + 1, -1).trim();
36
+ // Parse comma-separated args, respecting nested brackets
37
+ const args = splitTypeArgs(inner).map((arg) => TypeMetadata.fromString(arg));
38
+ return new TypeMetadata(baseName, args);
39
+ }
40
+ /** Returns true if this is a list type (e.g. "list[int]"). */
41
+ isListType() {
42
+ return this.type === "list";
43
+ }
44
+ /** Returns true if this is a union type (e.g. "union[str, int]"). */
45
+ isUnionType() {
46
+ return this.type === "union";
47
+ }
48
+ /** Returns true if this is the "any" type. */
49
+ isAny() {
50
+ return this.type === "any";
51
+ }
52
+ /**
53
+ * Check if this type is compatible with another type.
54
+ *
55
+ * Compatible means:
56
+ * - Same type (including args)
57
+ * - Either is "any"
58
+ * - Numeric widening (int -> float, int -> number, float -> number)
59
+ * - Union contains the other type
60
+ * - List element types are compatible
61
+ */
62
+ isCompatibleWith(other) {
63
+ // any matches everything
64
+ if (this.isAny() || other.isAny())
65
+ return true;
66
+ // Same base type
67
+ if (this.type === other.type) {
68
+ // For parameterized types, check args
69
+ if (this.args.length === 0 && other.args.length === 0)
70
+ return true;
71
+ if (this.args.length !== other.args.length)
72
+ return true; // loose match for different arities
73
+ return this.args.every((arg, i) => arg.isCompatibleWith(other.args[i]));
74
+ }
75
+ // Numeric widening
76
+ if (NUMERIC_TYPES.has(this.type) && NUMERIC_TYPES.has(other.type)) {
77
+ return true;
78
+ }
79
+ // Union: check if other type is in this union, or vice versa
80
+ if (this.isUnionType()) {
81
+ return this.args.some((arg) => arg.isCompatibleWith(other));
82
+ }
83
+ if (other.isUnionType()) {
84
+ return other.args.some((arg) => arg.isCompatibleWith(this));
85
+ }
86
+ return false;
87
+ }
88
+ /** String representation. */
89
+ toString() {
90
+ if (this.args.length === 0)
91
+ return this.type;
92
+ return `${this.type}[${this.args.map((a) => a.toString()).join(", ")}]`;
93
+ }
94
+ }
95
+ /**
96
+ * Split comma-separated type arguments, respecting nested brackets.
97
+ */
98
+ function splitTypeArgs(inner) {
99
+ if (!inner)
100
+ return [];
101
+ const args = [];
102
+ let depth = 0;
103
+ let current = "";
104
+ for (const ch of inner) {
105
+ if (ch === "[") {
106
+ depth++;
107
+ current += ch;
108
+ }
109
+ else if (ch === "]") {
110
+ depth--;
111
+ current += ch;
112
+ }
113
+ else if (ch === "," && depth === 0) {
114
+ args.push(current.trim());
115
+ current = "";
116
+ }
117
+ else {
118
+ current += ch;
119
+ }
120
+ }
121
+ const last = current.trim();
122
+ if (last)
123
+ args.push(last);
124
+ return args;
125
+ }
126
+ //# sourceMappingURL=type-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-metadata.js","sourceRoot":"","sources":["../src/type-metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE1D,MAAM,OAAO,YAAY;IACvB,oEAAoE;IAC3D,IAAI,CAAS;IACtB,iFAAiF;IACxE,IAAI,CAAiB;IAE9B,YAAoB,IAAY,EAAE,OAAuB,EAAE;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAe;QAC/B,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAEvC,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,kBAAkB;QAClB,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;QACxC,MA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KAAK,GAAG,EAAE,CAAC;YACf,KAAK,EAAE,CAAC;YACR,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;aAAM,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACtB,KAAK,EAAE,CAAC;YACR,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;aAAM,IAAI,EAAE,KAAK,GAAG,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1B,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,IAAI;QAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Type validation — T-META-3.
3
+ *
4
+ * Validates a runtime value against a NodeTool type string.
5
+ */
6
+ export interface ValidationResult {
7
+ valid: boolean;
8
+ error?: string;
9
+ }
10
+ /**
11
+ * Validate that `value` conforms to the type described by `typeStr`.
12
+ *
13
+ * Supported types: int, float, number, str, string, bool, boolean,
14
+ * list[X], any. Unknown types pass validation (no schema to check against).
15
+ */
16
+ export declare function validateType(value: unknown, typeStr: string): ValidationResult;
17
+ //# sourceMappingURL=typecheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typecheck.d.ts","sourceRoot":"","sources":["../src/typecheck.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,GACd,gBAAgB,CAGlB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Type validation — T-META-3.
3
+ *
4
+ * Validates a runtime value against a NodeTool type string.
5
+ */
6
+ import { TypeMetadata } from "./type-metadata.js";
7
+ const VALID = { valid: true };
8
+ function fail(message) {
9
+ return { valid: false, error: message };
10
+ }
11
+ /**
12
+ * Validate that `value` conforms to the type described by `typeStr`.
13
+ *
14
+ * Supported types: int, float, number, str, string, bool, boolean,
15
+ * list[X], any. Unknown types pass validation (no schema to check against).
16
+ */
17
+ export function validateType(value, typeStr) {
18
+ const meta = TypeMetadata.fromString(typeStr);
19
+ return validateWithMeta(value, meta);
20
+ }
21
+ function validateWithMeta(value, meta) {
22
+ if (meta.isAny())
23
+ return VALID;
24
+ const { type } = meta;
25
+ if (type === "int") {
26
+ if (typeof value !== "number")
27
+ return fail(`Expected int, got ${typeof value}`);
28
+ if (!Number.isInteger(value))
29
+ return fail(`Expected integer, got float ${value}`);
30
+ return VALID;
31
+ }
32
+ if (type === "float" || type === "number") {
33
+ if (typeof value !== "number")
34
+ return fail(`Expected ${type}, got ${typeof value}`);
35
+ return VALID;
36
+ }
37
+ if (type === "str" || type === "string") {
38
+ if (typeof value !== "string")
39
+ return fail(`Expected string, got ${typeof value}`);
40
+ return VALID;
41
+ }
42
+ if (type === "bool" || type === "boolean") {
43
+ if (typeof value !== "boolean")
44
+ return fail(`Expected boolean, got ${typeof value}`);
45
+ return VALID;
46
+ }
47
+ if (meta.isListType()) {
48
+ if (!Array.isArray(value))
49
+ return fail(`Expected array, got ${typeof value}`);
50
+ if (meta.args.length > 0) {
51
+ const elementType = meta.args[0];
52
+ for (let i = 0; i < value.length; i++) {
53
+ const r = validateWithMeta(value[i], elementType);
54
+ if (!r.valid)
55
+ return fail(`Element [${i}]: ${r.error}`);
56
+ }
57
+ }
58
+ return VALID;
59
+ }
60
+ // Unknown/custom types (ImageRef, AudioRef, etc.) — no validation possible
61
+ return VALID;
62
+ }
63
+ //# sourceMappingURL=typecheck.js.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AAK,QAAQ,EAAE,CAAC;QACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAC3B,OAAO,IAAI,CAAC,wBAAwB,OAAO,KAAK,EAAE,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC1C,IAAI,OAAO,KAAK,KAAK,SAAS;YAC5B,OAAO,IAAI,CAAC,yBAAyB,OAAO,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACvB,OAAO,IAAI,CAAC,uBAAuB,OAAO,KAAK,EAAE,CAAC,CAAC;QACrD,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,MAAM,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;gBAClD,IAAI,CAAC,CAAC,CAAC,KAAK;oBAAE,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,2EAA2E;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Wrap / unwrap primitives — T-MSG-7.
3
+ *
4
+ * Converts JS primitives to typed wrappers and back.
5
+ */
6
+ export interface WrappedPrimitive {
7
+ type: "int" | "float" | "str" | "bool";
8
+ value: number | string | boolean;
9
+ }
10
+ /**
11
+ * Wrap a JS primitive into a typed wrapper.
12
+ */
13
+ export declare function wrapPrimitive(value: number | string | boolean): WrappedPrimitive;
14
+ /**
15
+ * Unwrap a typed wrapper back to a JS primitive.
16
+ */
17
+ export declare function unwrapPrimitive(wrapped: WrappedPrimitive): number | string | boolean;
18
+ //# sourceMappingURL=wrap-primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-primitives.d.ts","sourceRoot":"","sources":["../src/wrap-primitives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IACvC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CAClC;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC/B,gBAAgB,CAYlB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,GACxB,MAAM,GAAG,MAAM,GAAG,OAAO,CAE3B"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Wrap / unwrap primitives — T-MSG-7.
3
+ *
4
+ * Converts JS primitives to typed wrappers and back.
5
+ */
6
+ /**
7
+ * Wrap a JS primitive into a typed wrapper.
8
+ */
9
+ export function wrapPrimitive(value) {
10
+ if (typeof value === "string") {
11
+ return { type: "str", value };
12
+ }
13
+ if (typeof value === "boolean") {
14
+ return { type: "bool", value };
15
+ }
16
+ // number
17
+ if (Number.isInteger(value)) {
18
+ return { type: "int", value };
19
+ }
20
+ return { type: "float", value };
21
+ }
22
+ /**
23
+ * Unwrap a typed wrapper back to a JS primitive.
24
+ */
25
+ export function unwrapPrimitive(wrapped) {
26
+ return wrapped.value;
27
+ }
28
+ //# sourceMappingURL=wrap-primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrap-primitives.js","sourceRoot":"","sources":["../src/wrap-primitives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgC;IAEhC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC;IACD,SAAS;IACT,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAyB;IAEzB,OAAO,OAAO,CAAC,KAAK,CAAC;AACvB,CAAC"}