@axiom-lattice/gateway 3.0.2 → 3.0.3
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/dist/index.js +31 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -6
- package/.eslintrc.json +0 -22
- package/.turbo/turbo-build.log +0 -46
- package/AGENTS.md +0 -112
- package/CHANGELOG.md +0 -1190
- package/LOGGER_CONFIG.md +0 -135
- package/RESUME_STREAM_CONTENT_BASED.md +0 -326
- package/RESUME_STREAM_README.md +0 -388
- package/jest.config.js +0 -72
- package/public/sdk/README.md +0 -695
- package/public/sdk/dashboard-engine-skill.md +0 -1122
- package/public/sdk/dashboard-single-file-spec.md +0 -357
- package/public/sdk/data-query-sdk-skill.md +0 -307
- package/public/sdk/data-query-sdk.d.ts +0 -252
- package/public/sdk/data-query-sdk.js +0 -970
- package/public/sdk/occupancy-dashboard.html +0 -363
- package/public/sdk/test-dashboard.html +0 -690
- package/scripts/seed-lark-installation.ts +0 -54
- package/src/__tests__/__mocks__/e2b.ts +0 -1
- package/src/__tests__/a2a.test.ts +0 -428
- package/src/__tests__/channel-installations.test.ts +0 -199
- package/src/__tests__/data-query.test.ts +0 -77
- package/src/__tests__/sandbox-provider-registration.test.ts +0 -74
- package/src/__tests__/setup.ts +0 -5
- package/src/__tests__/workspace.test.ts +0 -400
- package/src/channels/__tests__/routes.test.ts +0 -50
- package/src/channels/lark/LarkChannelAdapter.ts +0 -217
- package/src/channels/lark/README.md +0 -187
- package/src/channels/lark/__tests__/controller.test.ts +0 -136
- package/src/channels/lark/__tests__/mapping-service.test.ts +0 -118
- package/src/channels/lark/__tests__/parser.test.ts +0 -72
- package/src/channels/lark/__tests__/sender.test.ts +0 -37
- package/src/channels/lark/__tests__/verification.test.ts +0 -157
- package/src/channels/lark/controller.ts +0 -48
- package/src/channels/lark/mapping-service.ts +0 -138
- package/src/channels/lark/parser.ts +0 -68
- package/src/channels/lark/routes.ts +0 -22
- package/src/channels/lark/sender.ts +0 -58
- package/src/channels/lark/types.ts +0 -20
- package/src/channels/lark/verification.ts +0 -32
- package/src/channels/registry.ts +0 -20
- package/src/channels/routes.ts +0 -30
- package/src/channels/wechat/WechatChannelAdapter.ts +0 -294
- package/src/channels/wechat/__tests__/context-store.test.ts +0 -148
- package/src/channels/wechat/context-store.ts +0 -54
- package/src/channels/wechat/controller.ts +0 -59
- package/src/channels/wechat/routes.ts +0 -7
- package/src/channels/wechat/types.ts +0 -62
- package/src/channels/wechat/wechat-client.ts +0 -162
- package/src/config/local-a2a-templates.ts +0 -59
- package/src/config.ts +0 -124
- package/src/controllers/__tests__/assistant-local-a2a.test.ts +0 -147
- package/src/controllers/__tests__/local-a2a-templates.test.ts +0 -112
- package/src/controllers/__tests__/mime.test.ts +0 -74
- package/src/controllers/__tests__/resources.test.ts +0 -122
- package/src/controllers/__tests__/run.test.ts +0 -115
- package/src/controllers/__tests__/tasks.test.ts +0 -215
- package/src/controllers/__tests__/workflow-tracking.test.ts +0 -113
- package/src/controllers/agent_task.ts +0 -72
- package/src/controllers/assistant.ts +0 -490
- package/src/controllers/auth.ts +0 -524
- package/src/controllers/channel-bindings.ts +0 -135
- package/src/controllers/channel-installations.ts +0 -409
- package/src/controllers/collections.ts +0 -176
- package/src/controllers/config.ts +0 -126
- package/src/controllers/connections.ts +0 -181
- package/src/controllers/data-query.ts +0 -236
- package/src/controllers/database-configs.ts +0 -440
- package/src/controllers/embeddings.ts +0 -22
- package/src/controllers/entries.ts +0 -167
- package/src/controllers/eval.ts +0 -513
- package/src/controllers/export-import.ts +0 -166
- package/src/controllers/health.ts +0 -36
- package/src/controllers/local-a2a-templates.ts +0 -18
- package/src/controllers/local-a2a.ts +0 -149
- package/src/controllers/mcp-configs.ts +0 -673
- package/src/controllers/memory.ts +0 -257
- package/src/controllers/menu-items.ts +0 -114
- package/src/controllers/metrics-configs.ts +0 -1061
- package/src/controllers/middleware-types.ts +0 -15
- package/src/controllers/models.ts +0 -199
- package/src/controllers/personal-assistant.ts +0 -191
- package/src/controllers/resources.ts +0 -477
- package/src/controllers/run.ts +0 -338
- package/src/controllers/sandbox.ts +0 -255
- package/src/controllers/schedules.ts +0 -336
- package/src/controllers/skills.ts +0 -256
- package/src/controllers/tasks.ts +0 -213
- package/src/controllers/tenants.ts +0 -121
- package/src/controllers/thread_status.ts +0 -66
- package/src/controllers/threads.ts +0 -260
- package/src/controllers/tools.ts +0 -139
- package/src/controllers/users.ts +0 -135
- package/src/controllers/workflow-tracking.ts +0 -693
- package/src/controllers/workspace.ts +0 -879
- package/src/export_registrations/a2a-api-key.registration.ts +0 -89
- package/src/export_registrations/agent.registration.ts +0 -80
- package/src/export_registrations/binding.registration.ts +0 -106
- package/src/export_registrations/channel-installation.registration.ts +0 -88
- package/src/export_registrations/collection.registration.ts +0 -85
- package/src/export_registrations/connection.registration.ts +0 -97
- package/src/export_registrations/database-config.registration.ts +0 -94
- package/src/export_registrations/eval.registration.ts +0 -334
- package/src/export_registrations/index.ts +0 -31
- package/src/export_registrations/mcp-config.registration.ts +0 -97
- package/src/export_registrations/menu.registration.ts +0 -91
- package/src/export_registrations/metrics-config.registration.ts +0 -94
- package/src/export_registrations/skill.registration.ts +0 -88
- package/src/export_registrations/task.registration.ts +0 -99
- package/src/index.ts +0 -497
- package/src/logger/Logger.ts +0 -186
- package/src/router/MessageContext.ts +0 -14
- package/src/router/MessageRouter.ts +0 -490
- package/src/router/middlewares/auditLogger.ts +0 -34
- package/src/router/middlewares/deduplication.ts +0 -38
- package/src/router/middlewares/index.ts +0 -3
- package/src/router/middlewares/rateLimit.ts +0 -46
- package/src/routes/__tests__/a2a-test-connection.test.ts +0 -177
- package/src/routes/a2a-bridge.ts +0 -266
- package/src/routes/a2a-test-connection.ts +0 -126
- package/src/routes/a2a.ts +0 -851
- package/src/routes/channel-bindings.ts +0 -11
- package/src/routes/channel-installations.ts +0 -33
- package/src/routes/index.ts +0 -640
- package/src/routes/menu-items.ts +0 -10
- package/src/routes/resource-routes.ts +0 -35
- package/src/routes/stt.ts +0 -102
- package/src/schemas/data-query.ts +0 -69
- package/src/schemas/index.ts +0 -852
- package/src/services/ExportImportService.ts +0 -296
- package/src/services/__tests__/ExportImportService.test.ts +0 -130
- package/src/services/__tests__/eval-runner.test.ts +0 -131
- package/src/services/__tests__/local-a2a.test.ts +0 -124
- package/src/services/agent_task_consumer.ts +0 -348
- package/src/services/collection_service.ts +0 -258
- package/src/services/eval-runner.ts +0 -283
- package/src/services/local-a2a.ts +0 -354
- package/src/services/queue_service.ts +0 -104
- package/src/services/sandbox_service.ts +0 -223
- package/src/services/skill_service.ts +0 -97
- package/src/services/supabase.ts +0 -60
- package/src/swagger.ts +0 -77
- package/src/types/index.ts +0 -118
- package/src/types/koa.d.ts +0 -7
- package/src/utils/__tests__/local-a2a-runtime.test.ts +0 -77
- package/src/utils/__tests__/path-containment.test.ts +0 -35
- package/src/utils/a2a-url.ts +0 -20
- package/src/utils/local-a2a-runtime.ts +0 -107
- package/src/utils/mime.ts +0 -44
- package/src/utils/path-containment.ts +0 -38
- package/tsconfig.json +0 -26
package/src/controllers/tools.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { FastifyRequest, FastifyReply } from "fastify";
|
|
2
|
-
import { toolLatticeManager } from "@axiom-lattice/core";
|
|
3
|
-
import type {
|
|
4
|
-
ToolConfig,
|
|
5
|
-
} from "@axiom-lattice/protocols";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Tools Controller
|
|
9
|
-
* Handles tool-related operations
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Tool config meta response interface
|
|
14
|
-
*/
|
|
15
|
-
interface ToolConfigMetaResponse {
|
|
16
|
-
success: boolean;
|
|
17
|
-
message: string;
|
|
18
|
-
data: {
|
|
19
|
-
records: Array<{
|
|
20
|
-
id: string;
|
|
21
|
-
name: string;
|
|
22
|
-
description: string;
|
|
23
|
-
schema?: any; // Serialized schema
|
|
24
|
-
returnDirect?: boolean;
|
|
25
|
-
needUserApprove?: boolean;
|
|
26
|
-
}>;
|
|
27
|
-
total: number;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Serialize ZodSchema to JSON-serializable format
|
|
33
|
-
* Attempts to extract schema information for API response
|
|
34
|
-
*/
|
|
35
|
-
function serializeSchema(schema: any): any {
|
|
36
|
-
if (!schema) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
try {
|
|
41
|
-
// Try to get JSON schema if available (zod-to-json-schema or similar)
|
|
42
|
-
if (schema._def) {
|
|
43
|
-
// For Zod schemas, try to extract basic info
|
|
44
|
-
const def = schema._def;
|
|
45
|
-
if (def.typeName === "ZodObject") {
|
|
46
|
-
// Extract shape information
|
|
47
|
-
const shape = def.shape();
|
|
48
|
-
const properties: Record<string, any> = {};
|
|
49
|
-
const required: string[] = [];
|
|
50
|
-
|
|
51
|
-
for (const [key, value] of Object.entries(shape)) {
|
|
52
|
-
const fieldDef = (value as any)._def;
|
|
53
|
-
if (fieldDef) {
|
|
54
|
-
properties[key] = {
|
|
55
|
-
type: fieldDef.typeName === "ZodString" ? "string" :
|
|
56
|
-
fieldDef.typeName === "ZodNumber" ? "number" :
|
|
57
|
-
fieldDef.typeName === "ZodBoolean" ? "boolean" :
|
|
58
|
-
fieldDef.typeName === "ZodArray" ? "array" :
|
|
59
|
-
fieldDef.typeName === "ZodObject" ? "object" : "unknown",
|
|
60
|
-
description: fieldDef.description,
|
|
61
|
-
};
|
|
62
|
-
if (!(value as any).isOptional()) {
|
|
63
|
-
required.push(key);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
type: "object",
|
|
70
|
-
properties,
|
|
71
|
-
required: required.length > 0 ? required : undefined,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Fallback: return schema description or type name
|
|
77
|
-
return {
|
|
78
|
-
type: "object",
|
|
79
|
-
description: schema.description || "Schema definition",
|
|
80
|
-
};
|
|
81
|
-
} catch (error) {
|
|
82
|
-
// If serialization fails, return a safe fallback
|
|
83
|
-
return {
|
|
84
|
-
type: "object",
|
|
85
|
-
description: "Schema definition",
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get tool config meta from ToolLatticeManager
|
|
92
|
-
* Exposes tool configuration metadata via /api/tools endpoint
|
|
93
|
-
*/
|
|
94
|
-
export async function getToolConfigs(
|
|
95
|
-
request: FastifyRequest,
|
|
96
|
-
reply: FastifyReply
|
|
97
|
-
): Promise<ToolConfigMetaResponse> {
|
|
98
|
-
try {
|
|
99
|
-
const allLattices = toolLatticeManager.getAllLattices();
|
|
100
|
-
|
|
101
|
-
const toolConfigs = allLattices.map((lattice) => {
|
|
102
|
-
const config = { ...lattice.config };
|
|
103
|
-
|
|
104
|
-
// Serialize schema if present
|
|
105
|
-
const serializedSchema = config.schema ? serializeSchema(config.schema) : undefined;
|
|
106
|
-
|
|
107
|
-
return {
|
|
108
|
-
id: lattice.key,
|
|
109
|
-
name: config.name,
|
|
110
|
-
description: config.description,
|
|
111
|
-
schema: serializedSchema,
|
|
112
|
-
returnDirect: config.returnDirect,
|
|
113
|
-
needUserApprove: config.needUserApprove,
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
return reply.send({
|
|
118
|
-
success: true,
|
|
119
|
-
message: "Successfully retrieved tool configs",
|
|
120
|
-
data: {
|
|
121
|
-
records: toolConfigs,
|
|
122
|
-
total: toolConfigs.length,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
} catch (error: any) {
|
|
126
|
-
console.error("Failed to get tool configs", {
|
|
127
|
-
error: error.message,
|
|
128
|
-
stack: error.stack,
|
|
129
|
-
});
|
|
130
|
-
return reply.status(500).send({
|
|
131
|
-
success: false,
|
|
132
|
-
message: `Failed to retrieve tool configs: ${error.message}`,
|
|
133
|
-
data: {
|
|
134
|
-
records: [],
|
|
135
|
-
total: 0,
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
package/src/controllers/users.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { FastifyInstance, FastifyRequest, FastifyReply } from "fastify";
|
|
2
|
-
import { getStoreLattice } from "@axiom-lattice/core";
|
|
3
|
-
import type {
|
|
4
|
-
CreateUserRequest,
|
|
5
|
-
UpdateUserRequest,
|
|
6
|
-
} from "@axiom-lattice/protocols";
|
|
7
|
-
import { v4 as uuidv4 } from "uuid";
|
|
8
|
-
|
|
9
|
-
interface UserParams {
|
|
10
|
-
userId: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface ListUsersQuery {
|
|
14
|
-
email?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class UsersController {
|
|
18
|
-
private userStore;
|
|
19
|
-
|
|
20
|
-
constructor() {
|
|
21
|
-
this.userStore = getStoreLattice("default", "user").store;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async listUsers(
|
|
25
|
-
request: FastifyRequest<{ Querystring: ListUsersQuery }>,
|
|
26
|
-
reply: FastifyReply
|
|
27
|
-
) {
|
|
28
|
-
const { email } = request.query;
|
|
29
|
-
|
|
30
|
-
if (email) {
|
|
31
|
-
const user = await this.userStore.getUserByEmail(email);
|
|
32
|
-
return { success: true, data: user ? [user] : [] };
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const users = await this.userStore.getAllUsers();
|
|
36
|
-
return { success: true, data: users };
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async createUser(
|
|
40
|
-
request: FastifyRequest<{ Body: CreateUserRequest }>,
|
|
41
|
-
reply: FastifyReply
|
|
42
|
-
) {
|
|
43
|
-
const data = request.body;
|
|
44
|
-
const id = uuidv4();
|
|
45
|
-
|
|
46
|
-
const existingUser = await this.userStore.getUserByEmail(data.email);
|
|
47
|
-
if (existingUser) {
|
|
48
|
-
return reply.status(409).send({
|
|
49
|
-
success: false,
|
|
50
|
-
error: `User with email ${data.email} already exists`,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const user = await this.userStore.createUser(id, data);
|
|
55
|
-
return reply.status(201).send({ success: true, data: user });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async getUser(
|
|
59
|
-
request: FastifyRequest<{ Params: UserParams }>,
|
|
60
|
-
reply: FastifyReply
|
|
61
|
-
) {
|
|
62
|
-
const { userId } = request.params;
|
|
63
|
-
|
|
64
|
-
const user = await this.userStore.getUserById(userId);
|
|
65
|
-
|
|
66
|
-
if (!user) {
|
|
67
|
-
return reply.status(404).send({
|
|
68
|
-
success: false,
|
|
69
|
-
error: "User not found",
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return { success: true, data: user };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async updateUser(
|
|
77
|
-
request: FastifyRequest<{
|
|
78
|
-
Params: UserParams;
|
|
79
|
-
Body: UpdateUserRequest;
|
|
80
|
-
}>,
|
|
81
|
-
reply: FastifyReply
|
|
82
|
-
) {
|
|
83
|
-
const { userId } = request.params;
|
|
84
|
-
const updates = request.body;
|
|
85
|
-
|
|
86
|
-
if (updates.email) {
|
|
87
|
-
const existingUser = await this.userStore.getUserByEmail(updates.email);
|
|
88
|
-
if (existingUser && existingUser.id !== userId) {
|
|
89
|
-
return reply.status(409).send({
|
|
90
|
-
success: false,
|
|
91
|
-
error: `User with email ${updates.email} already exists`,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const user = await this.userStore.updateUser(userId, updates);
|
|
97
|
-
|
|
98
|
-
if (!user) {
|
|
99
|
-
return reply.status(404).send({
|
|
100
|
-
success: false,
|
|
101
|
-
error: "User not found",
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return { success: true, data: user };
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async deleteUser(
|
|
109
|
-
request: FastifyRequest<{ Params: UserParams }>,
|
|
110
|
-
reply: FastifyReply
|
|
111
|
-
) {
|
|
112
|
-
const { userId } = request.params;
|
|
113
|
-
|
|
114
|
-
const deleted = await this.userStore.deleteUser(userId);
|
|
115
|
-
|
|
116
|
-
if (!deleted) {
|
|
117
|
-
return reply.status(404).send({
|
|
118
|
-
success: false,
|
|
119
|
-
error: "User not found",
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return { success: true };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export function registerUserRoutes(app: FastifyInstance) {
|
|
128
|
-
const controller = new UsersController();
|
|
129
|
-
|
|
130
|
-
app.get("/api/users", controller.listUsers.bind(controller));
|
|
131
|
-
app.post("/api/users", controller.createUser.bind(controller));
|
|
132
|
-
app.get("/api/users/:userId", controller.getUser.bind(controller));
|
|
133
|
-
app.patch("/api/users/:userId", controller.updateUser.bind(controller));
|
|
134
|
-
app.delete("/api/users/:userId", controller.deleteUser.bind(controller));
|
|
135
|
-
}
|