@axiom-lattice/examples-deep_research 1.0.94 → 1.0.96
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/.turbo/turbo-build.log +5 -5
- package/CHANGELOG.md +20 -0
- package/dist/index.js +60 -60
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/agents/sap_b1/XSM_ZSK_metadata_interfaces.md +827 -827
- package/src/agents/sap_b1/__tests__/tools.test.ts +36 -36
- package/src/agents/sap_b1/index.ts +4 -4
- package/src/agents/sap_b1/tools.ts +64 -64
|
@@ -24,22 +24,22 @@ function callTool(key: string, input: any): Promise<any> {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
// ============================================================
|
|
27
|
-
//
|
|
27
|
+
// erp_api_search
|
|
28
28
|
// ============================================================
|
|
29
29
|
|
|
30
|
-
describe("
|
|
30
|
+
describe("erp_api_search", () => {
|
|
31
31
|
beforeAll(async () => {
|
|
32
32
|
await import("../tools");
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("finds BusinessPartners by exact name", async () => {
|
|
36
|
-
const result = await callTool("
|
|
36
|
+
const result = await callTool("erp_api_search", { query: "BusinessPartners" });
|
|
37
37
|
expect(result.totalMatches).toBeGreaterThanOrEqual(1);
|
|
38
38
|
expect(result.results.some((r: any) => r.name === "BusinessPartners")).toBe(true);
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
it("finds Items by exact name", async () => {
|
|
42
|
-
const result = await callTool("
|
|
42
|
+
const result = await callTool("erp_api_search", { query: "Items" });
|
|
43
43
|
expect(result.results.some((r: any) => r.name === "Items")).toBe(true);
|
|
44
44
|
const items = result.results.find((r: any) => r.name === "Items");
|
|
45
45
|
expect(items.primaryKey).toBe("ItemCode");
|
|
@@ -48,22 +48,22 @@ describe("sap_api_search", () => {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
it("finds Orders by exact name", async () => {
|
|
51
|
-
const result = await callTool("
|
|
51
|
+
const result = await callTool("erp_api_search", { query: "Orders" });
|
|
52
52
|
expect(result.results.some((r: any) => r.name === "Orders")).toBe(true);
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it("finds PurchaseOrders by exact name", async () => {
|
|
56
|
-
const result = await callTool("
|
|
56
|
+
const result = await callTool("erp_api_search", { query: "PurchaseOrders" });
|
|
57
57
|
expect(result.results.some((r: any) => r.name === "PurchaseOrders")).toBe(true);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it("finds Warehouses by exact name", async () => {
|
|
61
|
-
const result = await callTool("
|
|
61
|
+
const result = await callTool("erp_api_search", { query: "Warehouses" });
|
|
62
62
|
expect(result.results.some((r: any) => r.name === "Warehouses")).toBe(true);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it("finds by partial/substring match", async () => {
|
|
66
|
-
const result = await callTool("
|
|
66
|
+
const result = await callTool("erp_api_search", { query: "business" });
|
|
67
67
|
expect(result.totalMatches).toBeGreaterThan(1);
|
|
68
68
|
result.results.forEach((r: any) => {
|
|
69
69
|
expect(r.name.toLowerCase()).toContain("business");
|
|
@@ -71,30 +71,30 @@ describe("sap_api_search", () => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
it("finds by partial match — Item", async () => {
|
|
74
|
-
const result = await callTool("
|
|
74
|
+
const result = await callTool("erp_api_search", { query: "Item" });
|
|
75
75
|
expect(result.totalMatches).toBeGreaterThan(1);
|
|
76
76
|
expect(result.results.some((r: any) => r.name === "Items")).toBe(true);
|
|
77
77
|
expect(result.results.some((r: any) => r.name === "ItemGroups")).toBe(true);
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it("finds by partial match — Order", async () => {
|
|
81
|
-
const result = await callTool("
|
|
81
|
+
const result = await callTool("erp_api_search", { query: "Order" });
|
|
82
82
|
expect(result.totalMatches).toBeGreaterThan(0);
|
|
83
83
|
expect(result.results.some((r: any) => r.name === "Orders")).toBe(true);
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
it("finds by partial match — Purchase", async () => {
|
|
87
|
-
const result = await callTool("
|
|
87
|
+
const result = await callTool("erp_api_search", { query: "Purchase" });
|
|
88
88
|
expect(result.totalMatches).toBeGreaterThan(1);
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
it("finds by partial match — Inventory", async () => {
|
|
92
|
-
const result = await callTool("
|
|
92
|
+
const result = await callTool("erp_api_search", { query: "Inventory" });
|
|
93
93
|
expect(result.totalMatches).toBeGreaterThan(1);
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
it("finds by Chinese keyword — 客户 (BP)", async () => {
|
|
97
|
-
const result = await callTool("
|
|
97
|
+
const result = await callTool("erp_api_search", { query: "客户" });
|
|
98
98
|
expect(result.totalMatches).toBeGreaterThan(0);
|
|
99
99
|
result.results.forEach((r: any) => {
|
|
100
100
|
expect(r.domain).toBe("BusinessPartner");
|
|
@@ -102,7 +102,7 @@ describe("sap_api_search", () => {
|
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
it("finds by Chinese keyword — 物料 (Item)", async () => {
|
|
105
|
-
const result = await callTool("
|
|
105
|
+
const result = await callTool("erp_api_search", { query: "物料" });
|
|
106
106
|
expect(result.totalMatches).toBeGreaterThan(0);
|
|
107
107
|
result.results.forEach((r: any) => {
|
|
108
108
|
expect(r.domain).toBe("Item / Product");
|
|
@@ -110,7 +110,7 @@ describe("sap_api_search", () => {
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
it("finds by Chinese keyword — 订单 (Document)", async () => {
|
|
113
|
-
const result = await callTool("
|
|
113
|
+
const result = await callTool("erp_api_search", { query: "订单" });
|
|
114
114
|
expect(result.totalMatches).toBeGreaterThan(0);
|
|
115
115
|
result.results.forEach((r: any) => {
|
|
116
116
|
expect(r.domain).toBe("Document");
|
|
@@ -118,7 +118,7 @@ describe("sap_api_search", () => {
|
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
it("finds by Chinese keyword — 库存 (Inventory)", async () => {
|
|
121
|
-
const result = await callTool("
|
|
121
|
+
const result = await callTool("erp_api_search", { query: "库存" });
|
|
122
122
|
expect(result.totalMatches).toBeGreaterThan(0);
|
|
123
123
|
result.results.forEach((r: any) => {
|
|
124
124
|
expect(r.domain).toBe("Inventory / Warehouse");
|
|
@@ -126,7 +126,7 @@ describe("sap_api_search", () => {
|
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
it("filters by domain", async () => {
|
|
129
|
-
const result = await callTool("
|
|
129
|
+
const result = await callTool("erp_api_search", {
|
|
130
130
|
query: "",
|
|
131
131
|
domain: "BusinessPartner",
|
|
132
132
|
});
|
|
@@ -137,7 +137,7 @@ describe("sap_api_search", () => {
|
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
it("filters by domain — Item / Product", async () => {
|
|
140
|
-
const result = await callTool("
|
|
140
|
+
const result = await callTool("erp_api_search", {
|
|
141
141
|
query: "",
|
|
142
142
|
domain: "Item / Product",
|
|
143
143
|
});
|
|
@@ -148,7 +148,7 @@ describe("sap_api_search", () => {
|
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
it("filters by domain — Inventory / Warehouse", async () => {
|
|
151
|
-
const result = await callTool("
|
|
151
|
+
const result = await callTool("erp_api_search", {
|
|
152
152
|
query: "",
|
|
153
153
|
domain: "Inventory / Warehouse",
|
|
154
154
|
});
|
|
@@ -159,14 +159,14 @@ describe("sap_api_search", () => {
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
it("returns EntitySet with primaryKey in results", async () => {
|
|
162
|
-
const result = await callTool("
|
|
162
|
+
const result = await callTool("erp_api_search", { query: "BusinessPartners" });
|
|
163
163
|
const bp = result.results.find((r: any) => r.name === "BusinessPartners");
|
|
164
164
|
expect(bp.primaryKey).toBe("CardCode");
|
|
165
165
|
expect(bp.kind).toBe("EntitySet");
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
it("returns FunctionImport in results", async () => {
|
|
169
|
-
const result = await callTool("
|
|
169
|
+
const result = await callTool("erp_api_search", {
|
|
170
170
|
query: "InitData",
|
|
171
171
|
maxResults: 20,
|
|
172
172
|
});
|
|
@@ -174,19 +174,19 @@ describe("sap_api_search", () => {
|
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
it("returns suggestion when no results found", async () => {
|
|
177
|
-
const result = await callTool("
|
|
177
|
+
const result = await callTool("erp_api_search", { query: "xyzwqkxyz" });
|
|
178
178
|
expect(result.totalMatches).toBe(0);
|
|
179
179
|
expect(result.results).toHaveLength(0);
|
|
180
180
|
expect(result.suggestion).toBeDefined();
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
it("respects maxResults limit", async () => {
|
|
184
|
-
const result = await callTool("
|
|
184
|
+
const result = await callTool("erp_api_search", { query: "", maxResults: 3 });
|
|
185
185
|
expect(result.results.length).toBeLessThanOrEqual(3);
|
|
186
186
|
});
|
|
187
187
|
|
|
188
188
|
it("returns domain distribution", async () => {
|
|
189
|
-
const result = await callTool("
|
|
189
|
+
const result = await callTool("erp_api_search", { query: "" });
|
|
190
190
|
expect(typeof result.domainsFound).toBe("object");
|
|
191
191
|
if (result.results.length > 0) {
|
|
192
192
|
const total = Object.values(result.domainsFound).reduce(
|
|
@@ -198,23 +198,23 @@ describe("sap_api_search", () => {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
it("returns hint in each result", async () => {
|
|
201
|
-
const result = await callTool("
|
|
201
|
+
const result = await callTool("erp_api_search", { query: "BusinessPartners" });
|
|
202
202
|
expect(result.results[0].hint).toBeDefined();
|
|
203
|
-
expect(result.results[0].hint).toContain("
|
|
203
|
+
expect(result.results[0].hint).toContain("erp_api_call");
|
|
204
204
|
});
|
|
205
205
|
});
|
|
206
206
|
|
|
207
207
|
// ============================================================
|
|
208
|
-
//
|
|
208
|
+
// erp_api_call
|
|
209
209
|
// ============================================================
|
|
210
210
|
|
|
211
|
-
describe("
|
|
211
|
+
describe("erp_api_call", () => {
|
|
212
212
|
beforeAll(async () => {
|
|
213
213
|
await import("../tools");
|
|
214
214
|
});
|
|
215
215
|
|
|
216
216
|
it("returns HTTP response with unified format", async () => {
|
|
217
|
-
const result = await callTool("
|
|
217
|
+
const result = await callTool("erp_api_call", {
|
|
218
218
|
entitySet: "BusinessPartners",
|
|
219
219
|
method: "GET",
|
|
220
220
|
queryOptions: "$top=1&$select=CardCode,CardName",
|
|
@@ -228,7 +228,7 @@ describe("sap_api_call", () => {
|
|
|
228
228
|
});
|
|
229
229
|
|
|
230
230
|
it("passes filter query correctly", async () => {
|
|
231
|
-
const result = await callTool("
|
|
231
|
+
const result = await callTool("erp_api_call", {
|
|
232
232
|
entitySet: "BusinessPartners",
|
|
233
233
|
method: "GET",
|
|
234
234
|
queryOptions: "$top=1&$select=CardCode,CardName",
|
|
@@ -240,7 +240,7 @@ describe("sap_api_call", () => {
|
|
|
240
240
|
});
|
|
241
241
|
|
|
242
242
|
it("returns 200 for Items query", async () => {
|
|
243
|
-
const result = await callTool("
|
|
243
|
+
const result = await callTool("erp_api_call", {
|
|
244
244
|
entitySet: "Items",
|
|
245
245
|
method: "GET",
|
|
246
246
|
queryOptions: "$top=1&$select=ItemCode,ItemName",
|
|
@@ -252,7 +252,7 @@ describe("sap_api_call", () => {
|
|
|
252
252
|
});
|
|
253
253
|
|
|
254
254
|
it("returns 200 for Orders query", async () => {
|
|
255
|
-
const result = await callTool("
|
|
255
|
+
const result = await callTool("erp_api_call", {
|
|
256
256
|
entitySet: "Orders",
|
|
257
257
|
method: "GET",
|
|
258
258
|
queryOptions: "$top=1&$select=DocEntry,DocTotal",
|
|
@@ -263,7 +263,7 @@ describe("sap_api_call", () => {
|
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
it("returns 200 for Warehouses query", async () => {
|
|
266
|
-
const result = await callTool("
|
|
266
|
+
const result = await callTool("erp_api_call", {
|
|
267
267
|
entitySet: "Warehouses",
|
|
268
268
|
method: "GET",
|
|
269
269
|
queryOptions: "$top=1&$select=WarehouseCode,WarehouseName",
|
|
@@ -274,7 +274,7 @@ describe("sap_api_call", () => {
|
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
it("returns 200 for InventoryGenEntries query", async () => {
|
|
277
|
-
const result = await callTool("
|
|
277
|
+
const result = await callTool("erp_api_call", {
|
|
278
278
|
entitySet: "InventoryGenEntries",
|
|
279
279
|
method: "GET",
|
|
280
280
|
queryOptions: "$top=1&$select=DocEntry,DocDate",
|
|
@@ -284,7 +284,7 @@ describe("sap_api_call", () => {
|
|
|
284
284
|
});
|
|
285
285
|
|
|
286
286
|
it("respects $top limit", async () => {
|
|
287
|
-
const result = await callTool("
|
|
287
|
+
const result = await callTool("erp_api_call", {
|
|
288
288
|
entitySet: "BusinessPartners",
|
|
289
289
|
method: "GET",
|
|
290
290
|
queryOptions: "$top=3&$select=CardCode",
|
|
@@ -294,7 +294,7 @@ describe("sap_api_call", () => {
|
|
|
294
294
|
});
|
|
295
295
|
|
|
296
296
|
it("returns error for POST without auth", async () => {
|
|
297
|
-
const result = await callTool("
|
|
297
|
+
const result = await callTool("erp_api_call", {
|
|
298
298
|
entitySet: "BusinessPartners",
|
|
299
299
|
method: "POST",
|
|
300
300
|
body: { CardCode: "TEST001", CardName: "Test" },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* ERP Service Layer API Tools
|
|
3
3
|
*
|
|
4
|
-
* 提供 2 个工具用于搜索和调用
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* 提供 2 个工具用于搜索和调用 ERP Service Layer 的 OData API:
|
|
5
|
+
* erp_api_search — 搜索接口元数据
|
|
6
|
+
* erp_api_call — 构造 API 调用
|
|
7
7
|
*/
|
|
8
8
|
import "./tools";
|