toolcraft 0.0.149 → 0.0.151
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/composition.json +2 -2
- package/dist/composition.json +2 -2
- package/dist/index.compile-check.js +23 -0
- package/dist/mcp.js +9 -1
- package/dist/sdk.compile-check.js +27 -0
- package/dist/sdk.d.ts +3 -1
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.151",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.151",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.151",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.151",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -38,6 +38,29 @@ const ignoredFileChangeCommand = defineCommand({
|
|
|
38
38
|
changes: [{ kind: "added", path: "flows/morning.json", newContent: "{}\n" }]
|
|
39
39
|
})
|
|
40
40
|
});
|
|
41
|
+
defineCommand({
|
|
42
|
+
name: "mapped-result",
|
|
43
|
+
params: S.Object({}),
|
|
44
|
+
result: S.Object({ data: S.Array(S.String()) }),
|
|
45
|
+
mcpResult: (result) => ({ data: result }),
|
|
46
|
+
handler: async () => [],
|
|
47
|
+
});
|
|
48
|
+
defineCommand({
|
|
49
|
+
name: "invalid-async-mapped-result",
|
|
50
|
+
params: S.Object({}),
|
|
51
|
+
result: S.Object({ data: S.Array(S.String()) }),
|
|
52
|
+
// @ts-expect-error MCP result mappers are synchronous
|
|
53
|
+
mcpResult: async (result) => ({ data: result }),
|
|
54
|
+
handler: async () => [],
|
|
55
|
+
});
|
|
56
|
+
defineCommand({
|
|
57
|
+
name: "invalid-scalar-mapped-result",
|
|
58
|
+
params: S.Object({}),
|
|
59
|
+
result: S.Object({ data: S.Array(S.String()) }),
|
|
60
|
+
// @ts-expect-error MCP structured results must have an object root
|
|
61
|
+
mcpResult: () => "invalid",
|
|
62
|
+
handler: async () => [],
|
|
63
|
+
});
|
|
41
64
|
const ignoredGroup = defineGroup({
|
|
42
65
|
name: "root",
|
|
43
66
|
scope: ignoredScope,
|
package/dist/mcp.js
CHANGED
|
@@ -892,7 +892,15 @@ function createResolvedMCPServer(root, options, runtime = {}) {
|
|
|
892
892
|
return renderPendingApproval(result);
|
|
893
893
|
}
|
|
894
894
|
if (tool.resultSchema !== undefined) {
|
|
895
|
-
|
|
895
|
+
let mcpResult = result;
|
|
896
|
+
if (tool.command.mcpResult !== undefined) {
|
|
897
|
+
try {
|
|
898
|
+
mcpResult = tool.command.mcpResult(result);
|
|
899
|
+
}
|
|
900
|
+
catch (error) {
|
|
901
|
+
throw new ToolError(JSON_RPC_ERROR_CODES.INTERNAL_ERROR, error instanceof Error ? error.message : String(error));
|
|
902
|
+
}
|
|
903
|
+
}
|
|
896
904
|
const structuredContent = validateCommandResult(tool.resultSchema, mcpResult, casing);
|
|
897
905
|
return {
|
|
898
906
|
content: [{ type: "text", text: JSON.stringify(structuredContent) }],
|
|
@@ -33,6 +33,17 @@ const ignoredRoot = defineGroup({
|
|
|
33
33
|
apiKey: params.APIKey,
|
|
34
34
|
}),
|
|
35
35
|
}),
|
|
36
|
+
defineCommand({
|
|
37
|
+
name: "json-payload",
|
|
38
|
+
scope: ["sdk"],
|
|
39
|
+
params: S.Object({
|
|
40
|
+
payload_json: S.Json(),
|
|
41
|
+
items_by_id: S.Record(S.Object({
|
|
42
|
+
display_name: S.String(),
|
|
43
|
+
})),
|
|
44
|
+
}),
|
|
45
|
+
handler: async ({ params }) => params,
|
|
46
|
+
}),
|
|
36
47
|
defineCommand({
|
|
37
48
|
name: "cli-only",
|
|
38
49
|
scope: ["cli"],
|
|
@@ -116,6 +127,22 @@ const ignoredHttpServerResult = ignoredSdk.poeCode.generate.httpServer({
|
|
|
116
127
|
void ignoredHttpServerResult.then((value) => {
|
|
117
128
|
void value.apiKey;
|
|
118
129
|
});
|
|
130
|
+
void ignoredSdk.poeCode.generate.jsonPayload({
|
|
131
|
+
payloadJson: {
|
|
132
|
+
file_upload: "upload-1",
|
|
133
|
+
nested_value: { preserve_this_key: true },
|
|
134
|
+
},
|
|
135
|
+
itemsById: {
|
|
136
|
+
"item-1": { displayName: "One" },
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
ignoredSdk.poeCode.generate.jsonPayload({
|
|
140
|
+
payloadJson: null,
|
|
141
|
+
itemsById: {
|
|
142
|
+
// @ts-expect-error declared fields inside arbitrary-key records are still camel-cased
|
|
143
|
+
"item-1": { display_name: "One" },
|
|
144
|
+
},
|
|
145
|
+
});
|
|
119
146
|
const ignoredQueuedResult = ignoredSdk.poeCode.generate.queued({
|
|
120
147
|
promptText: "hello",
|
|
121
148
|
});
|
package/dist/sdk.d.ts
CHANGED
|
@@ -30,7 +30,9 @@ type CapitalizeJoinCamelWords<TWords extends readonly string[]> = TWords extends
|
|
|
30
30
|
...infer TTail extends readonly string[]
|
|
31
31
|
] ? `${Capitalize<THead>}${CapitalizeJoinCamelWords<TTail>}` : "";
|
|
32
32
|
type CamelCase<TValue extends string> = JoinCamelWords<SplitCamelWords<TValue>>;
|
|
33
|
-
type Camelize<TValue> = TValue extends Primitive ? TValue : TValue extends readonly (infer TItem)[] ? Array<Camelize<TItem>> : TValue extends object ? {
|
|
33
|
+
type Camelize<TValue> = TValue extends Primitive ? TValue : TValue extends readonly (infer TItem)[] ? Array<Camelize<TItem>> : TValue extends object ? string extends keyof TValue ? {
|
|
34
|
+
[TKey in keyof TValue]: Camelize<TValue[TKey]>;
|
|
35
|
+
} : {
|
|
34
36
|
[TKey in keyof TValue as TKey extends string ? CamelCase<TKey> : TKey]: Camelize<TValue[TKey]>;
|
|
35
37
|
} : TValue;
|
|
36
38
|
type SDKResult<TResult, THumanInLoopMode extends HumanInLoopMode | undefined> = [THumanInLoopMode] extends ["async"] ? ["async"] extends [THumanInLoopMode] ? HumanInLoopPending : TResult : TResult;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.151",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.151",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|