@axiom-lattice/gateway 2.1.91 → 2.1.93
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 +9 -9
- package/CHANGELOG.md +24 -0
- package/dist/index.js +1019 -396
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +923 -299
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/scripts/seed-lark-installation.ts +54 -0
- package/src/channels/lark/LarkChannelAdapter.ts +140 -18
- package/src/channels/lark/types.ts +0 -13
- package/src/channels/lark/verification.ts +1 -36
- package/src/controllers/__tests__/run.test.ts +115 -0
- package/src/controllers/__tests__/tasks.test.ts +215 -0
- package/src/controllers/agent_task.ts +7 -0
- package/src/controllers/assistant.ts +15 -2
- package/src/controllers/auth.ts +9 -0
- package/src/controllers/menu-items.ts +114 -0
- package/src/controllers/personal-assistant.ts +191 -0
- package/src/controllers/run.ts +47 -0
- package/src/controllers/tasks.ts +187 -0
- package/src/controllers/workflow-tracking.ts +66 -13
- package/src/index.ts +50 -20
- package/src/router/MessageRouter.ts +107 -41
- package/src/routes/index.ts +23 -0
- package/src/routes/menu-items.ts +10 -0
- package/src/services/agent_task_consumer.ts +2 -8
- package/src/channels/lark/__tests__/aggregator.test.ts +0 -23
- package/src/channels/lark/aggregator.ts +0 -16
- package/src/channels/lark/config.ts +0 -44
- package/src/channels/lark/runner.ts +0 -37
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { LarkIngressConfig } from "./types";
|
|
2
|
-
|
|
3
|
-
export function loadLarkIngressConfig(): LarkIngressConfig {
|
|
4
|
-
return {
|
|
5
|
-
enabled: process.env.LARK_ENABLED !== "false",
|
|
6
|
-
appId: process.env.LARK_APP_ID || "",
|
|
7
|
-
appSecret: process.env.LARK_APP_SECRET || "",
|
|
8
|
-
verificationToken: process.env.LARK_VERIFICATION_TOKEN,
|
|
9
|
-
encryptKey: process.env.LARK_ENCRYPT_KEY,
|
|
10
|
-
tenantId: process.env.LARK_TENANT_ID || "default",
|
|
11
|
-
assistantId: process.env.LARK_ASSISTANT_ID || "default_agent",
|
|
12
|
-
workspaceId: process.env.LARK_WORKSPACE_ID,
|
|
13
|
-
projectId: process.env.LARK_PROJECT_ID,
|
|
14
|
-
mappingMode:
|
|
15
|
-
(process.env.LARK_MAPPING_MODE as "user" | "group" | "hybrid") ||
|
|
16
|
-
"hybrid",
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function isLarkIngressEnabled(config: LarkIngressConfig): boolean {
|
|
21
|
-
return config.enabled;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function assertLarkIngressConfig(config: LarkIngressConfig): void {
|
|
25
|
-
if (!config.enabled) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!config.appId) {
|
|
30
|
-
throw new Error("LARK_APP_ID is required when Lark ingress is enabled");
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (!config.appSecret) {
|
|
34
|
-
throw new Error("LARK_APP_SECRET is required when Lark ingress is enabled");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!config.tenantId) {
|
|
38
|
-
throw new Error("LARK_TENANT_ID is required when Lark ingress is enabled");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (!config.assistantId) {
|
|
42
|
-
throw new Error("LARK_ASSISTANT_ID is required when Lark ingress is enabled");
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { agentInstanceManager } from "@axiom-lattice/core";
|
|
2
|
-
import { MessageChunkTypes } from "@axiom-lattice/protocols";
|
|
3
|
-
import { aggregateLarkReply } from "./aggregator";
|
|
4
|
-
|
|
5
|
-
export async function runAgentAndCollectLarkReply(input: {
|
|
6
|
-
tenantId: string;
|
|
7
|
-
assistantId: string;
|
|
8
|
-
threadId: string;
|
|
9
|
-
text: string;
|
|
10
|
-
workspaceId?: string;
|
|
11
|
-
projectId?: string;
|
|
12
|
-
}): Promise<string> {
|
|
13
|
-
const agent = agentInstanceManager.getAgent({
|
|
14
|
-
tenant_id: input.tenantId,
|
|
15
|
-
assistant_id: input.assistantId,
|
|
16
|
-
thread_id: input.threadId,
|
|
17
|
-
workspace_id: input.workspaceId,
|
|
18
|
-
project_id: input.projectId,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const result = await agent.addMessage({
|
|
22
|
-
input: {
|
|
23
|
-
message: input.text,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const chunks = [];
|
|
28
|
-
const stream = agent.chunkStream(result.messageId, [
|
|
29
|
-
MessageChunkTypes.MESSAGE_COMPLETED,
|
|
30
|
-
]);
|
|
31
|
-
|
|
32
|
-
for await (const chunk of stream) {
|
|
33
|
-
chunks.push(chunk);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return aggregateLarkReply(result.messageId, chunks);
|
|
37
|
-
}
|