Skip to content

Commit 8e8c982

Browse files
committed
chore: release 1.0.18
1 parent b1b4056 commit 8e8c982

11 files changed

Lines changed: 259 additions & 18 deletions

File tree

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "aitoearn-openclaw-workspace",
33
"private": true,
4-
"version": "1.0.17",
4+
"version": "1.0.18",
55
"type": "module",
66
"workspaces": [
77
"packages/shared",

packages/installer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aitoearn/openclaw-plugin-cli",
3-
"version": "1.0.17",
3+
"version": "1.0.18",
44
"type": "module",
55
"main": "./dist/installer/src/index.js",
66
"types": "./dist/installer/src/index.d.ts",

packages/runtime/openclaw.plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "aitoearn",
33
"name": "AiToEarn",
44
"description": "AiToEarn social media management tools",
5-
"version": "1.0.17",
5+
"version": "1.0.18",
66
"skills": [
77
"./skills"
88
],

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aitoearn/openclaw-plugin",
3-
"version": "1.0.17",
3+
"version": "1.0.18",
44
"type": "module",
55
"main": "./dist/runtime/index.js",
66
"types": "./dist/runtime/index.d.ts",

packages/runtime/src/tool-discovery-helper.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,18 @@ describe("runToolDiscoveryHelper", () => {
6262
name: "remote_tool",
6363
description: "Remote",
6464
inputSchema: {
65+
id: "create-video-draft",
6566
type: "object",
6667
properties: {
68+
payload: {
69+
id: "video-payload",
70+
type: "object",
71+
properties: {
72+
id: {
73+
type: "string",
74+
},
75+
},
76+
},
6777
time: {
6878
type: "array",
6979
items: [
@@ -118,8 +128,18 @@ describe("runToolDiscoveryHelper", () => {
118128
name: "remote_tool",
119129
description: "Remote",
120130
inputSchema: {
131+
$id: "create-video-draft",
121132
type: "object",
122133
properties: {
134+
payload: {
135+
$id: "video-payload",
136+
type: "object",
137+
properties: {
138+
id: {
139+
type: "string",
140+
},
141+
},
142+
},
123143
time: {
124144
type: "array",
125145
items: {

packages/runtime/src/tools.test.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,79 @@ describe("normalizeToolInputSchema", () => {
7777
},
7878
});
7979
});
80+
81+
it("converts legacy schema id to $id without touching property names", () => {
82+
const schema = normalizeToolInputSchema({
83+
id: "create-video-draft",
84+
type: "object",
85+
properties: {
86+
id: {
87+
type: "string",
88+
},
89+
payload: {
90+
id: "video-payload",
91+
type: "object",
92+
properties: {
93+
id: {
94+
type: "string",
95+
},
96+
clips: {
97+
type: "array",
98+
prefixItems: [
99+
{
100+
id: "clip-item",
101+
type: "string",
102+
},
103+
],
104+
},
105+
},
106+
},
107+
},
108+
});
109+
110+
expect(schema).toEqual({
111+
$id: "create-video-draft",
112+
type: "object",
113+
properties: {
114+
id: {
115+
type: "string",
116+
},
117+
payload: {
118+
$id: "video-payload",
119+
type: "object",
120+
properties: {
121+
id: {
122+
type: "string",
123+
},
124+
clips: {
125+
type: "array",
126+
prefixItems: [
127+
{
128+
$id: "clip-item",
129+
type: "string",
130+
},
131+
],
132+
},
133+
},
134+
},
135+
},
136+
});
137+
});
138+
139+
it("keeps an existing $id and removes the legacy id keyword", () => {
140+
const schema = normalizeToolInputSchema({
141+
id: "legacy-schema-id",
142+
$id: "canonical-schema-id",
143+
type: "object",
144+
properties: {},
145+
});
146+
147+
expect(schema).toEqual({
148+
$id: "canonical-schema-id",
149+
type: "object",
150+
properties: {},
151+
});
152+
});
80153
});
81154

82155
describe("sanitizeToolDefinitions", () => {

packages/runtime/src/tools.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const SINGLE_SCHEMA_KEYS = [
5353
"unevaluatedProperties",
5454
] as const;
5555

56-
const ARRAY_OF_SCHEMAS_KEYS = ["allOf", "anyOf", "oneOf"] as const;
56+
const ARRAY_OF_SCHEMAS_KEYS = ["allOf", "anyOf", "oneOf", "prefixItems"] as const;
5757

5858
export interface ParsedToolSnapshotResult extends SanitizedToolsResult {
5959
snapshot: ToolSnapshot | null;
@@ -204,6 +204,7 @@ function normalizeJsonSchema(schema: JsonSchema): JsonSchema {
204204
}
205205

206206
const normalized: Record<string, unknown> = { ...schema };
207+
applyLegacySchemaIdCompatibility(normalized);
207208

208209
for (const key of RECORD_OF_SCHEMAS_KEYS) {
209210
const value = normalized[key];
@@ -236,6 +237,18 @@ function normalizeJsonSchema(schema: JsonSchema): JsonSchema {
236237
return normalized;
237238
}
238239

240+
function applyLegacySchemaIdCompatibility(schema: Record<string, unknown>): void {
241+
if (!Object.prototype.hasOwnProperty.call(schema, "id")) {
242+
return;
243+
}
244+
245+
if (typeof schema.id === "string" && !Object.prototype.hasOwnProperty.call(schema, "$id")) {
246+
schema.$id = schema.id;
247+
}
248+
249+
delete schema.id;
250+
}
251+
239252
function normalizeSchemaRecordMap(
240253
values: Record<string, unknown>
241254
): Record<string, unknown> {

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aitoearn/openclaw-plugin-shared",
3-
"version": "1.0.17",
3+
"version": "1.0.18",
44
"private": true,
55
"type": "module",
66
"main": "./dist/src/index.js",

packages/shared/src/mcp-client.test.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,59 @@ describe("mcp-client retry helpers", () => {
7777
expect(sdkClientMock.callTool).toHaveBeenCalledTimes(2);
7878
expect(sdkClientMock.clients).toHaveLength(2);
7979
});
80+
81+
it("retries callTool once after a retryable tool error result", async () => {
82+
sdkClientMock.callTool
83+
.mockResolvedValueOnce({
84+
isError: true,
85+
structuredContent: {
86+
status: "error",
87+
tool: "getallaccounts",
88+
error: "Not connected",
89+
},
90+
content: [
91+
{
92+
type: "text",
93+
text: '{"status":"error","tool":"getallaccounts","error":"Not connected"}',
94+
},
95+
],
96+
})
97+
.mockResolvedValueOnce({
98+
content: [{ type: "text", text: "ok" }],
99+
});
100+
101+
const result = await callMcpTool(
102+
"test-api-key",
103+
"https://aitoearn.ai/api",
104+
"getAllAccounts",
105+
{}
106+
);
107+
108+
expect(result).toEqual({
109+
content: [{ type: "text", text: "ok" }],
110+
});
111+
expect(sdkClientMock.callTool).toHaveBeenCalledTimes(2);
112+
expect(sdkClientMock.clients).toHaveLength(2);
113+
});
114+
115+
it("does not retry non-connection tool error results", async () => {
116+
sdkClientMock.callTool.mockResolvedValueOnce({
117+
isError: true,
118+
content: [{ type: "text", text: "Insufficient balance" }],
119+
});
120+
121+
const result = await callMcpTool(
122+
"test-api-key",
123+
"https://aitoearn.ai/api",
124+
"acceptTask",
125+
{}
126+
);
127+
128+
expect(result).toEqual({
129+
isError: true,
130+
content: [{ type: "text", text: "Insufficient balance" }],
131+
});
132+
expect(sdkClientMock.callTool).toHaveBeenCalledTimes(1);
133+
expect(sdkClientMock.clients).toHaveLength(1);
134+
});
80135
});

0 commit comments

Comments
 (0)