@kafca/agentdock 0.1.42 → 0.1.44
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/README.md +10 -0
- package/dist/renderer/assets/{Badge-D-WU4kUV.js → Badge-Qk9qHovH.js} +1 -1
- package/dist/renderer/assets/{Chat-BGkC5tAe.js → Chat-BK-fm0Xr.js} +1 -1
- package/dist/renderer/assets/{ChatMarkdown-CfbC1jRd.js → ChatMarkdown-BKdW8OON.js} +1 -1
- package/dist/renderer/assets/{Config-qQb4bX5D.js → Config-B93CQGvY.js} +2 -2
- package/dist/renderer/assets/CronList-Z3TvSRKP.js +1 -0
- package/dist/renderer/assets/{Dashboard-xn6cUy_n.js → Dashboard-Ch3QkWwf.js} +2 -2
- package/dist/renderer/assets/{EmptyState-BdKBBUpr.js → EmptyState-kD9yAwtw.js} +1 -1
- package/dist/renderer/assets/{KnowledgeDetail-Duk8IQP3.js → KnowledgeDetail-BAMCLrjz.js} +2 -2
- package/dist/renderer/assets/{KnowledgeHome-BfjX_4Sv.js → KnowledgeHome-ChvjOfrc.js} +2 -2
- package/dist/renderer/assets/{Logs-Bfq61QMn.js → Logs-Cv0nth3j.js} +1 -1
- package/dist/renderer/assets/{Modal-B3vlBmBr.js → Modal-DwY4lecS.js} +1 -1
- package/dist/renderer/assets/MonitorList-JEvMoWUm.js +1 -0
- package/dist/renderer/assets/{Page-CPsLOP3z.js → Page-CnB9ePsb.js} +1 -1
- package/dist/renderer/assets/{ProjectDetail-D-g46wyF.js → ProjectDetail-DJa3sMmU.js} +2 -2
- package/dist/renderer/assets/{ProjectList-BrQEKDQ8.js → ProjectList-D6CXumR_.js} +1 -1
- package/dist/renderer/assets/{Select-C4CFMQmF.js → Select-zfoksLGB.js} +1 -1
- package/dist/renderer/assets/SessionChat-DUTh4WoM.js +1 -0
- package/dist/renderer/assets/{SessionList-DPWIUbOg.js → SessionList-D9o-lUst.js} +1 -1
- package/dist/renderer/assets/{ThreadChat-BjtU-j9q.js → ThreadChat-BYXlT-Kc.js} +7 -7
- package/dist/renderer/assets/{Workspace-BcNmHuJx.js → Workspace-BrhSwRQ-.js} +1 -1
- package/dist/renderer/assets/{arrow-left-DPzSmidS.js → arrow-left-CNEAuElg.js} +1 -1
- package/dist/renderer/assets/{book-open-B0xhoRqZ.js → book-open-BNJMhNI-.js} +1 -1
- package/dist/renderer/assets/{check-BTJTyd0C.js → check-BnclClRU.js} +1 -1
- package/dist/renderer/assets/{chevron-down-B6jJXlhi.js → chevron-down-Bh53e0O-.js} +1 -1
- package/dist/renderer/assets/{circle-qRhJR9qR.js → circle-ClZTWCWO.js} +1 -1
- package/dist/renderer/assets/desktop-C5vBT0yM.js +1 -0
- package/dist/renderer/assets/desktop-C6q6wBae.js +5 -0
- package/dist/renderer/assets/en-D2SkCrhG.js +1 -0
- package/dist/renderer/assets/{funnel-CbYKGTn8.js → funnel-_5hsz0xI.js} +1 -1
- package/dist/renderer/assets/{heart-DjwWJfkz.js → heart-u4Q1aOqj.js} +1 -1
- package/dist/renderer/assets/{index-BWmHJRhe.js → index-B36eowj-.js} +39 -34
- package/dist/renderer/assets/{index-CyZs_2NJ.js → index-BNFx4uYv.js} +3 -3
- package/dist/renderer/assets/{pencil-1dfAivmj.js → pencil-DLh9QNmT.js} +1 -1
- package/dist/renderer/assets/{play-CB3w1G6S.js → play-BDTk9Scm.js} +1 -1
- package/dist/renderer/assets/{plug-Bvep5o3r.js → plug-BG0JHW6B.js} +1 -1
- package/dist/renderer/assets/{plus-DJVg9m09.js → plus-BSc8POsz.js} +1 -1
- package/dist/renderer/assets/projects-DwfZwxDW.js +1 -0
- package/dist/renderer/assets/{save-xjJn3qf2.js → save-D5AO_G6a.js} +1 -1
- package/dist/renderer/assets/{search-BK3UrQxM.js → search-CniPk7Ey.js} +1 -1
- package/dist/renderer/assets/{server-Dyd2eXJu.js → server-GsXyQAZm.js} +1 -1
- package/dist/renderer/assets/{session-utils-eXC0020s.js → session-utils-BDxzgTBC.js} +1 -1
- package/dist/renderer/assets/{sessions-WLYpkyUt.js → sessions-CLcKA1Tt.js} +1 -1
- package/dist/renderer/assets/{shield-check-C0N6aWzF.js → shield-check-4i0E3hmf.js} +1 -1
- package/dist/renderer/assets/{trash-2-BGMTNJA6.js → trash-2-DhtOCsO5.js} +1 -1
- package/dist/renderer/assets/{user-BcGMLyhu.js → user-BtC_pVXV.js} +1 -1
- package/dist/renderer/assets/{wifi-off-FhcQx0HK.js → wifi-off-BHPzPY_B.js} +1 -1
- package/dist/renderer/assets/zh-DIcdHycM.js +1 -0
- package/dist/renderer/index.html +1 -1
- package/dist-electron/packages/contracts/src/local-core.js +28 -0
- package/dist-electron/packages/core-sdk/src/index.js +32 -0
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +51 -0
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-store.js +4 -1364
- package/dist-electron/services/local-ai-core/src/acp/store/agent-task-store.js +166 -0
- package/dist-electron/services/local-ai-core/src/acp/store/automation-monitor-store.js +231 -0
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +263 -0
- package/dist-electron/services/local-ai-core/src/acp/store/platform-store.js +186 -0
- package/dist-electron/services/local-ai-core/src/acp/store/scheduler-store.js +201 -0
- package/dist-electron/services/local-ai-core/src/acp/store/schema.js +275 -0
- package/dist-electron/services/local-ai-core/src/acp/store/security-store.js +266 -0
- package/dist-electron/services/local-ai-core/src/acp/store/thread-store.js +232 -0
- package/dist-electron/services/local-ai-core/src/acp/store/utils.js +47 -0
- package/dist-electron/services/local-ai-core/src/acp/store/workspace-registry-store.js +109 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js +136 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-repository.js +56 -0
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +359 -0
- package/dist-electron/services/local-ai-core/src/automation/condition-evaluator.js +77 -0
- package/dist-electron/services/local-ai-core/src/automation/mock-stock-provider.js +40 -0
- package/dist-electron/services/local-ai-core/src/automation/monitor-id.js +10 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/cards.js +55 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound.js +114 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +153 -94
- package/dist-electron/services/local-ai-core/src/channel/shared/session-command-runtime.js +53 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/thread-routing.js +34 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +63 -51
- package/dist-electron/services/local-ai-core/src/cli/lac.js +196 -0
- package/dist-electron/services/local-ai-core/src/cli/monitor-cli-parsers.js +37 -0
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +43 -0
- package/dist-electron/services/local-ai-core/src/kernel/capability-registry.js +12 -0
- package/dist-electron/services/local-ai-core/src/plugins/builtin/monitor-stock-plugin.js +30 -0
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +41 -0
- package/dist-electron/services/local-ai-core/src/runtime/server-routes.js +31 -0
- package/dist-electron/services/local-ai-core/src/runtime/server.js +36 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-bridge-session.js +25 -11
- package/dist-electron/services/local-ai-core/src/thread/session-command-service.js +275 -0
- package/dist-electron/services/local-ai-core/src/thread/slash-command-registry.js +27 -0
- package/dist-electron/services/local-ai-core/src/thread/thread-command-service.js +15 -15
- package/dist-electron/shared/desktop.js +21 -1
- package/dist-electron/tests/contracts/local-core-contracts.test.js +9 -0
- package/dist-electron/tests/electron/automation-monitor.test.js +38 -0
- package/dist-electron/tests/electron/lac-cli.test.js +146 -0
- package/dist-electron/tests/integration/channel-gateways.test.js +32 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +1918 -0
- package/dist-electron/tests/integration/local-core-acp-progress.test.js +1772 -0
- package/dist-electron/tests/integration/local-core-refactor.test.js +216 -4566
- package/dist-electron/tests/integration/local-core-routes.test.js +204 -0
- package/dist-electron/tests/integration/weixin-gateway.test.js +927 -0
- package/package.json +1 -1
- package/dist/renderer/assets/CronList-CKhggzYk.js +0 -1
- package/dist/renderer/assets/SessionChat-06Jny5_G.js +0 -1
- package/dist/renderer/assets/desktop-DXmXjjUR.js +0 -1
- package/dist/renderer/assets/desktop-O8_6ZCVZ.js +0 -4
- package/dist/renderer/assets/en-CKhCF6St.js +0 -1
- package/dist/renderer/assets/projects-xnW0fTtq.js +0 -1
- package/dist/renderer/assets/zh-Dz5FLTBV.js +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalAgentTaskStore = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const index_js_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
|
+
const utils_js_1 = require("./utils.js");
|
|
7
|
+
class LocalAgentTaskStore {
|
|
8
|
+
db;
|
|
9
|
+
createAuditEvent;
|
|
10
|
+
constructor(db, createAuditEvent) {
|
|
11
|
+
this.db = db;
|
|
12
|
+
this.createAuditEvent = createAuditEvent;
|
|
13
|
+
}
|
|
14
|
+
create(input) {
|
|
15
|
+
const id = `task:${(0, node_crypto_1.randomUUID)()}`;
|
|
16
|
+
const now = new Date().toISOString();
|
|
17
|
+
const status = (0, index_js_1.normalizeAgentTaskStatus)(input.status);
|
|
18
|
+
const timeline = [{
|
|
19
|
+
id: `timeline:${(0, node_crypto_1.randomUUID)()}`,
|
|
20
|
+
type: 'status_change',
|
|
21
|
+
title: `Task ${status}`,
|
|
22
|
+
status,
|
|
23
|
+
timestamp: now,
|
|
24
|
+
}];
|
|
25
|
+
this.db.prepare(`
|
|
26
|
+
INSERT INTO agent_tasks (
|
|
27
|
+
id, workspace_id, device_id, runtime_id, thread_id, run_id, title, prompt, status, created_at, updated_at, queued_at,
|
|
28
|
+
started_at, completed_at, summary, error, timeline_json, logs_json, artifacts_json, approval_ids_json, metadata_json
|
|
29
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, NULL, ?, '[]', '[]', '[]', ?)
|
|
30
|
+
`).run(id, input.workspaceId, input.deviceId, input.runtimeId, input.threadId || null, input.runId || null, input.title, input.prompt ? (0, utils_js_1.redactSecrets)(input.prompt) : null, status, now, now, status === 'queued' ? now : null, status === 'running' ? now : null, JSON.stringify(timeline), JSON.stringify(input.metadata || {}));
|
|
31
|
+
const task = this.get(id);
|
|
32
|
+
this.createAuditEvent({
|
|
33
|
+
type: 'task.created',
|
|
34
|
+
workspaceId: task.workspaceId,
|
|
35
|
+
taskId: task.taskId,
|
|
36
|
+
actor: 'local',
|
|
37
|
+
summary: `Task created: ${task.title}`,
|
|
38
|
+
metadata: { runtimeId: task.runtimeId, threadId: task.threadId, runId: task.runId },
|
|
39
|
+
});
|
|
40
|
+
return task;
|
|
41
|
+
}
|
|
42
|
+
list(query = {}) {
|
|
43
|
+
const predicates = [];
|
|
44
|
+
const params = [];
|
|
45
|
+
if (query.workspaceId) {
|
|
46
|
+
predicates.push('workspace_id = ?');
|
|
47
|
+
params.push(query.workspaceId);
|
|
48
|
+
}
|
|
49
|
+
if (query.runtimeId) {
|
|
50
|
+
predicates.push('runtime_id = ?');
|
|
51
|
+
params.push(query.runtimeId);
|
|
52
|
+
}
|
|
53
|
+
if (query.status) {
|
|
54
|
+
const statuses = (Array.isArray(query.status) ? query.status : [query.status]).map((status) => (0, index_js_1.normalizeAgentTaskStatus)(status));
|
|
55
|
+
predicates.push(`status IN (${statuses.map(() => '?').join(', ')})`);
|
|
56
|
+
params.push(...statuses);
|
|
57
|
+
}
|
|
58
|
+
const limit = Math.max(1, Math.min(Number(query.limit || 50), 100));
|
|
59
|
+
const where = predicates.length ? `WHERE ${predicates.join(' AND ')}` : '';
|
|
60
|
+
const rows = this.db.prepare(`
|
|
61
|
+
SELECT *
|
|
62
|
+
FROM agent_tasks
|
|
63
|
+
${where}
|
|
64
|
+
ORDER BY updated_at DESC
|
|
65
|
+
LIMIT ?
|
|
66
|
+
`).all(...params, limit);
|
|
67
|
+
return { tasks: rows.map((row) => this.toAgentTask(row)) };
|
|
68
|
+
}
|
|
69
|
+
get(taskId) {
|
|
70
|
+
const row = this.db.prepare('SELECT * FROM agent_tasks WHERE id = ?').get(taskId);
|
|
71
|
+
return row ? this.toAgentTask(row) : undefined;
|
|
72
|
+
}
|
|
73
|
+
getByRunId(runId) {
|
|
74
|
+
const row = this.db.prepare('SELECT * FROM agent_tasks WHERE run_id = ? ORDER BY updated_at DESC LIMIT 1').get(runId);
|
|
75
|
+
return row ? this.toAgentTask(row) : undefined;
|
|
76
|
+
}
|
|
77
|
+
update(taskId, input) {
|
|
78
|
+
const existing = this.get(taskId);
|
|
79
|
+
if (!existing) {
|
|
80
|
+
throw new Error(`Task not found: ${taskId}`);
|
|
81
|
+
}
|
|
82
|
+
const now = new Date().toISOString();
|
|
83
|
+
const nextStatus = input.status ? (0, index_js_1.normalizeAgentTaskStatus)(input.status) : existing.status;
|
|
84
|
+
const timeline = [...existing.timeline];
|
|
85
|
+
const logs = [...existing.logs];
|
|
86
|
+
const artifacts = [...existing.artifacts];
|
|
87
|
+
const approvalIds = [...existing.approvalIds];
|
|
88
|
+
if (input.status && nextStatus !== existing.status) {
|
|
89
|
+
timeline.push({
|
|
90
|
+
id: `timeline:${(0, node_crypto_1.randomUUID)()}`,
|
|
91
|
+
type: 'status_change',
|
|
92
|
+
title: `Task ${nextStatus}`,
|
|
93
|
+
status: nextStatus,
|
|
94
|
+
timestamp: now,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (input.timelineItem) {
|
|
98
|
+
timeline.push({
|
|
99
|
+
id: input.timelineItem.id || `timeline:${(0, node_crypto_1.randomUUID)()}`,
|
|
100
|
+
timestamp: input.timelineItem.timestamp || now,
|
|
101
|
+
...input.timelineItem,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (input.log) {
|
|
105
|
+
logs.push({
|
|
106
|
+
id: input.log.id || `log:${(0, node_crypto_1.randomUUID)()}`,
|
|
107
|
+
timestamp: input.log.timestamp || now,
|
|
108
|
+
...input.log,
|
|
109
|
+
message: (0, utils_js_1.redactSecrets)(input.log.message),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
if (input.artifact) {
|
|
113
|
+
artifacts.push({
|
|
114
|
+
id: input.artifact.id || `artifact:${(0, node_crypto_1.randomUUID)()}`,
|
|
115
|
+
...input.artifact,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
if (input.approvalId && !approvalIds.includes(input.approvalId)) {
|
|
119
|
+
approvalIds.push(input.approvalId);
|
|
120
|
+
}
|
|
121
|
+
this.db.prepare(`
|
|
122
|
+
UPDATE agent_tasks
|
|
123
|
+
SET status = ?, thread_id = ?, run_id = ?, title = ?, updated_at = ?, queued_at = ?, started_at = ?, completed_at = ?,
|
|
124
|
+
summary = ?, error = ?, timeline_json = ?, logs_json = ?, artifacts_json = ?, approval_ids_json = ?, metadata_json = ?
|
|
125
|
+
WHERE id = ?
|
|
126
|
+
`).run(nextStatus, input.threadId || existing.threadId || null, input.runId || existing.runId || null, input.title || existing.title, now, existing.queuedAt || (nextStatus === 'queued' ? now : null), existing.startedAt || (nextStatus === 'running' ? now : null), existing.completedAt || (['completed', 'failed', 'cancelled'].includes(nextStatus) ? now : null), input.summary ?? existing.summary ?? null, input.error === null ? null : input.error ?? existing.error ?? null, JSON.stringify(timeline), JSON.stringify(logs), JSON.stringify(artifacts), JSON.stringify(approvalIds), JSON.stringify(input.metadata || existing.metadata || {}), taskId);
|
|
127
|
+
const task = this.get(taskId);
|
|
128
|
+
if (input.status && nextStatus !== existing.status) {
|
|
129
|
+
this.createAuditEvent({
|
|
130
|
+
type: 'task.updated',
|
|
131
|
+
workspaceId: task.workspaceId,
|
|
132
|
+
taskId: task.taskId,
|
|
133
|
+
actor: 'local',
|
|
134
|
+
summary: `Task status changed to ${nextStatus}.`,
|
|
135
|
+
metadata: { previousStatus: existing.status, status: nextStatus, runId: task.runId },
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return task;
|
|
139
|
+
}
|
|
140
|
+
toAgentTask(row) {
|
|
141
|
+
return {
|
|
142
|
+
taskId: row.id,
|
|
143
|
+
workspaceId: row.workspace_id,
|
|
144
|
+
deviceId: row.device_id,
|
|
145
|
+
runtimeId: row.runtime_id,
|
|
146
|
+
threadId: row.thread_id || undefined,
|
|
147
|
+
runId: row.run_id || undefined,
|
|
148
|
+
title: row.title,
|
|
149
|
+
prompt: row.prompt || undefined,
|
|
150
|
+
status: (0, index_js_1.normalizeAgentTaskStatus)(row.status),
|
|
151
|
+
createdAt: row.created_at,
|
|
152
|
+
updatedAt: row.updated_at,
|
|
153
|
+
queuedAt: row.queued_at || undefined,
|
|
154
|
+
startedAt: row.started_at || undefined,
|
|
155
|
+
completedAt: row.completed_at || undefined,
|
|
156
|
+
summary: row.summary || undefined,
|
|
157
|
+
error: row.error || undefined,
|
|
158
|
+
timeline: (0, utils_js_1.parseJson)(row.timeline_json, []),
|
|
159
|
+
logs: (0, utils_js_1.parseJson)(row.logs_json, []),
|
|
160
|
+
artifacts: (0, utils_js_1.parseJson)(row.artifacts_json, []),
|
|
161
|
+
approvalIds: (0, utils_js_1.parseJson)(row.approval_ids_json, []),
|
|
162
|
+
metadata: (0, utils_js_1.parseJson)(row.metadata_json, {}),
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.LocalAgentTaskStore = LocalAgentTaskStore;
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LocalAutomationMonitorStore = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const index_js_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
|
+
class LocalAutomationMonitorStore {
|
|
7
|
+
db;
|
|
8
|
+
constructor(db) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
}
|
|
11
|
+
list(workspaceId) {
|
|
12
|
+
const query = workspaceId
|
|
13
|
+
? `
|
|
14
|
+
SELECT id, workspace_id, title, source_type, source_config_json, condition_json, prompt_template, platform, route_type, route_config,
|
|
15
|
+
execution_mode, enabled, cooldown_ms, concurrency_policy, last_state_json, created_at, updated_at, last_triggered_at, last_status, last_error
|
|
16
|
+
FROM automation_monitors
|
|
17
|
+
WHERE workspace_id = ?
|
|
18
|
+
ORDER BY updated_at DESC
|
|
19
|
+
`
|
|
20
|
+
: `
|
|
21
|
+
SELECT id, workspace_id, title, source_type, source_config_json, condition_json, prompt_template, platform, route_type, route_config,
|
|
22
|
+
execution_mode, enabled, cooldown_ms, concurrency_policy, last_state_json, created_at, updated_at, last_triggered_at, last_status, last_error
|
|
23
|
+
FROM automation_monitors
|
|
24
|
+
ORDER BY updated_at DESC
|
|
25
|
+
`;
|
|
26
|
+
const rows = this.db.prepare(query).all(...(workspaceId ? [workspaceId] : []));
|
|
27
|
+
return rows.map((row) => this.toMonitor(row));
|
|
28
|
+
}
|
|
29
|
+
get(monitorId) {
|
|
30
|
+
const row = this.db.prepare(`
|
|
31
|
+
SELECT id, workspace_id, title, source_type, source_config_json, condition_json, prompt_template, platform, route_type, route_config,
|
|
32
|
+
execution_mode, enabled, cooldown_ms, concurrency_policy, last_state_json, created_at, updated_at, last_triggered_at, last_status, last_error
|
|
33
|
+
FROM automation_monitors
|
|
34
|
+
WHERE id = ?
|
|
35
|
+
`).get(monitorId);
|
|
36
|
+
return row ? this.toMonitor(row) : undefined;
|
|
37
|
+
}
|
|
38
|
+
create(input) {
|
|
39
|
+
const title = String(input.title || '').trim();
|
|
40
|
+
if (!title)
|
|
41
|
+
throw new Error('Automation monitor title is required.');
|
|
42
|
+
const sourceType = String(input.sourceType || '').trim();
|
|
43
|
+
if (!sourceType)
|
|
44
|
+
throw new Error('Automation monitor source type is required.');
|
|
45
|
+
const condition = {
|
|
46
|
+
...input.condition,
|
|
47
|
+
metric: String(input.condition?.metric || '').trim(),
|
|
48
|
+
operator: (0, index_js_1.normalizeAutomationMonitorConditionOperator)(input.condition?.operator),
|
|
49
|
+
};
|
|
50
|
+
if (!condition.metric)
|
|
51
|
+
throw new Error('Automation monitor condition metric is required.');
|
|
52
|
+
const id = this.createMonitorId();
|
|
53
|
+
const now = new Date().toISOString();
|
|
54
|
+
this.db.prepare(`
|
|
55
|
+
INSERT INTO automation_monitors (
|
|
56
|
+
id, workspace_id, title, source_type, source_config_json, condition_json, prompt_template, platform, route_type, route_config,
|
|
57
|
+
execution_mode, enabled, cooldown_ms, concurrency_policy, last_state_json, created_at, updated_at
|
|
58
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'skip_if_running', ?, ?, ?)
|
|
59
|
+
`).run(id, input.workspaceId, title, sourceType, JSON.stringify(input.sourceConfig || {}), JSON.stringify(condition), input.promptTemplate, (0, index_js_1.normalizeChannelPlatform)(input.platform), input.route.type, JSON.stringify(input.route), (0, index_js_1.normalizeScheduledJobExecutionMode)(input.executionMode, 'side-thread'), input.enabled === false ? 0 : 1, Math.max(0, Number(input.cooldownMs ?? 15 * 60 * 1000)), null, now, now);
|
|
60
|
+
return this.get(id);
|
|
61
|
+
}
|
|
62
|
+
update(monitorId, input) {
|
|
63
|
+
const existing = this.get(monitorId);
|
|
64
|
+
if (!existing)
|
|
65
|
+
throw new Error(`Automation monitor not found: ${monitorId}`);
|
|
66
|
+
const nextCondition = input.condition
|
|
67
|
+
? {
|
|
68
|
+
...input.condition,
|
|
69
|
+
metric: String(input.condition.metric || '').trim(),
|
|
70
|
+
operator: (0, index_js_1.normalizeAutomationMonitorConditionOperator)(input.condition.operator),
|
|
71
|
+
}
|
|
72
|
+
: existing.condition;
|
|
73
|
+
const next = {
|
|
74
|
+
...existing,
|
|
75
|
+
...(typeof input.title === 'string' ? { title: input.title.trim() } : {}),
|
|
76
|
+
...(input.sourceConfig ? { sourceConfig: input.sourceConfig } : {}),
|
|
77
|
+
condition: nextCondition,
|
|
78
|
+
...(typeof input.promptTemplate === 'string' ? { promptTemplate: input.promptTemplate } : {}),
|
|
79
|
+
...(input.route ? { route: input.route } : {}),
|
|
80
|
+
...(input.executionMode ? { executionMode: (0, index_js_1.normalizeScheduledJobExecutionMode)(input.executionMode, 'side-thread') } : {}),
|
|
81
|
+
...(typeof input.enabled === 'boolean' ? { enabled: input.enabled } : {}),
|
|
82
|
+
...(typeof input.cooldownMs === 'number' ? { cooldownMs: Math.max(0, input.cooldownMs) } : {}),
|
|
83
|
+
updatedAt: new Date().toISOString(),
|
|
84
|
+
};
|
|
85
|
+
if (!next.title)
|
|
86
|
+
throw new Error('Automation monitor title is required.');
|
|
87
|
+
this.db.prepare(`
|
|
88
|
+
UPDATE automation_monitors
|
|
89
|
+
SET title = ?, source_config_json = ?, condition_json = ?, prompt_template = ?, route_type = ?, route_config = ?,
|
|
90
|
+
execution_mode = ?, enabled = ?, cooldown_ms = ?, updated_at = ?
|
|
91
|
+
WHERE id = ?
|
|
92
|
+
`).run(next.title, JSON.stringify(next.sourceConfig || {}), JSON.stringify(next.condition), next.promptTemplate, next.route.type, JSON.stringify(next.route), next.executionMode, next.enabled ? 1 : 0, next.cooldownMs, next.updatedAt, monitorId);
|
|
93
|
+
return this.get(monitorId);
|
|
94
|
+
}
|
|
95
|
+
updateState(monitorId, input) {
|
|
96
|
+
this.db.prepare(`
|
|
97
|
+
UPDATE automation_monitors
|
|
98
|
+
SET last_state_json = CASE WHEN ? IS NULL THEN last_state_json ELSE ? END,
|
|
99
|
+
last_triggered_at = COALESCE(?, last_triggered_at),
|
|
100
|
+
last_status = COALESCE(?, last_status),
|
|
101
|
+
last_error = CASE WHEN ? IS NULL THEN last_error ELSE ? END,
|
|
102
|
+
enabled = CASE WHEN ? IS NULL THEN enabled ELSE ? END,
|
|
103
|
+
updated_at = ?
|
|
104
|
+
WHERE id = ?
|
|
105
|
+
`).run(input.lastState == null ? null : JSON.stringify(input.lastState), input.lastState == null ? null : JSON.stringify(input.lastState), input.lastTriggeredAt || null, input.lastStatus || null, input.lastError == null ? null : input.lastError, input.lastError == null ? null : input.lastError, typeof input.enabled === 'boolean' ? (input.enabled ? 1 : 0) : null, typeof input.enabled === 'boolean' ? (input.enabled ? 1 : 0) : null, new Date().toISOString(), monitorId);
|
|
106
|
+
}
|
|
107
|
+
delete(monitorId) {
|
|
108
|
+
const result = this.db.prepare('DELETE FROM automation_monitors WHERE id = ?').run(monitorId);
|
|
109
|
+
if (result.changes === 0)
|
|
110
|
+
throw new Error(`Automation monitor not found: ${monitorId}`);
|
|
111
|
+
return { deleted: true };
|
|
112
|
+
}
|
|
113
|
+
listRuns(monitorId) {
|
|
114
|
+
const rows = this.db.prepare(`
|
|
115
|
+
SELECT id, monitor_id, status, triggered_at, started_at, finished_at, error, event_snapshot_json, thread_id, run_id, delivery_mode, delivery_status, delivery_error, last_bridge_event_at
|
|
116
|
+
FROM automation_monitor_runs
|
|
117
|
+
WHERE monitor_id = ?
|
|
118
|
+
ORDER BY triggered_at DESC
|
|
119
|
+
`).all(monitorId);
|
|
120
|
+
return rows.map((row) => this.toRun(row));
|
|
121
|
+
}
|
|
122
|
+
createRun(monitorId, status, input = {}) {
|
|
123
|
+
const id = `monitorrun:${(0, node_crypto_1.randomUUID)()}`;
|
|
124
|
+
const triggeredAt = input.triggeredAt || new Date().toISOString();
|
|
125
|
+
const normalizedStatus = (0, index_js_1.normalizeAutomationMonitorStatus)(status);
|
|
126
|
+
this.db.prepare(`
|
|
127
|
+
INSERT INTO automation_monitor_runs (id, monitor_id, status, triggered_at, started_at, finished_at, error, event_snapshot_json, thread_id, run_id, delivery_mode, delivery_status, delivery_error, last_bridge_event_at)
|
|
128
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
129
|
+
`).run(id, monitorId, normalizedStatus, triggeredAt, input.startedAt || null, input.finishedAt || null, input.error || null, input.eventSnapshot ? JSON.stringify(input.eventSnapshot) : null, input.threadId || null, input.runId || null, input.deliveryMode || null, input.deliveryStatus || null, input.deliveryError || null, input.lastBridgeEventAt || null);
|
|
130
|
+
this.updateState(monitorId, {
|
|
131
|
+
lastTriggeredAt: triggeredAt,
|
|
132
|
+
lastStatus: normalizedStatus,
|
|
133
|
+
lastError: input.error || '',
|
|
134
|
+
});
|
|
135
|
+
return this.getRun(id);
|
|
136
|
+
}
|
|
137
|
+
getRun(runId) {
|
|
138
|
+
const row = this.db.prepare(`
|
|
139
|
+
SELECT id, monitor_id, status, triggered_at, started_at, finished_at, error, event_snapshot_json, thread_id, run_id, delivery_mode, delivery_status, delivery_error, last_bridge_event_at
|
|
140
|
+
FROM automation_monitor_runs
|
|
141
|
+
WHERE id = ?
|
|
142
|
+
`).get(runId);
|
|
143
|
+
return row ? this.toRun(row) : undefined;
|
|
144
|
+
}
|
|
145
|
+
updateRun(runId, input) {
|
|
146
|
+
const existing = this.getRun(runId);
|
|
147
|
+
if (!existing)
|
|
148
|
+
throw new Error(`Automation monitor run not found: ${runId}`);
|
|
149
|
+
const next = {
|
|
150
|
+
...existing,
|
|
151
|
+
...input,
|
|
152
|
+
...(input.status ? { status: (0, index_js_1.normalizeAutomationMonitorStatus)(input.status) } : {}),
|
|
153
|
+
};
|
|
154
|
+
this.db.prepare(`
|
|
155
|
+
UPDATE automation_monitor_runs
|
|
156
|
+
SET status = ?, triggered_at = ?, started_at = ?, finished_at = ?, error = ?, event_snapshot_json = ?, thread_id = ?, run_id = ?, delivery_mode = ?, delivery_status = ?, delivery_error = ?, last_bridge_event_at = ?
|
|
157
|
+
WHERE id = ?
|
|
158
|
+
`).run(next.status, next.triggeredAt, next.startedAt || null, next.finishedAt || null, next.error || null, next.eventSnapshot ? JSON.stringify(next.eventSnapshot) : null, next.threadId || null, next.runId || null, next.deliveryMode || null, next.deliveryStatus || null, next.deliveryError || null, next.lastBridgeEventAt || null, runId);
|
|
159
|
+
if (input.status || Object.prototype.hasOwnProperty.call(input, 'error') || input.finishedAt || input.triggeredAt) {
|
|
160
|
+
this.updateState(existing.monitorId, {
|
|
161
|
+
lastTriggeredAt: next.triggeredAt,
|
|
162
|
+
lastStatus: next.status,
|
|
163
|
+
lastError: next.error || '',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
return this.getRun(runId);
|
|
167
|
+
}
|
|
168
|
+
toMonitor(row) {
|
|
169
|
+
const condition = parseJson(row.condition_json, {});
|
|
170
|
+
return {
|
|
171
|
+
id: row.id,
|
|
172
|
+
workspaceId: row.workspace_id,
|
|
173
|
+
title: row.title,
|
|
174
|
+
sourceType: row.source_type,
|
|
175
|
+
sourceConfig: parseJson(row.source_config_json || '{}', {}),
|
|
176
|
+
condition: {
|
|
177
|
+
...condition,
|
|
178
|
+
operator: (0, index_js_1.normalizeAutomationMonitorConditionOperator)(condition.operator),
|
|
179
|
+
},
|
|
180
|
+
promptTemplate: row.prompt_template,
|
|
181
|
+
platform: (0, index_js_1.normalizeChannelPlatform)(row.platform),
|
|
182
|
+
route: JSON.parse(row.route_config),
|
|
183
|
+
executionMode: (0, index_js_1.normalizeScheduledJobExecutionMode)(row.execution_mode, 'side-thread'),
|
|
184
|
+
enabled: Boolean(row.enabled),
|
|
185
|
+
cooldownMs: Number(row.cooldown_ms || 0),
|
|
186
|
+
concurrencyPolicy: row.concurrency_policy,
|
|
187
|
+
lastState: row.last_state_json ? parseJson(row.last_state_json, {}) : undefined,
|
|
188
|
+
createdAt: row.created_at,
|
|
189
|
+
updatedAt: row.updated_at,
|
|
190
|
+
lastTriggeredAt: row.last_triggered_at || undefined,
|
|
191
|
+
lastStatus: row.last_status ? (0, index_js_1.normalizeAutomationMonitorStatus)(row.last_status) : undefined,
|
|
192
|
+
lastError: row.last_error || undefined,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
toRun(row) {
|
|
196
|
+
return {
|
|
197
|
+
id: row.id,
|
|
198
|
+
monitorId: row.monitor_id,
|
|
199
|
+
status: (0, index_js_1.normalizeAutomationMonitorStatus)(row.status),
|
|
200
|
+
triggeredAt: row.triggered_at,
|
|
201
|
+
startedAt: row.started_at || undefined,
|
|
202
|
+
finishedAt: row.finished_at || undefined,
|
|
203
|
+
error: row.error || undefined,
|
|
204
|
+
eventSnapshot: row.event_snapshot_json ? parseJson(row.event_snapshot_json, {}) : undefined,
|
|
205
|
+
threadId: row.thread_id || undefined,
|
|
206
|
+
runId: row.run_id || undefined,
|
|
207
|
+
deliveryMode: row.delivery_mode || undefined,
|
|
208
|
+
deliveryStatus: row.delivery_status || undefined,
|
|
209
|
+
deliveryError: row.delivery_error || undefined,
|
|
210
|
+
lastBridgeEventAt: row.last_bridge_event_at || undefined,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
createMonitorId() {
|
|
214
|
+
let id = `monitor:${(0, node_crypto_1.randomUUID)()}`;
|
|
215
|
+
for (let attempt = 0; attempt < 5 && this.get(id); attempt += 1) {
|
|
216
|
+
id = `monitor:${(0, node_crypto_1.randomUUID)()}`;
|
|
217
|
+
}
|
|
218
|
+
if (this.get(id))
|
|
219
|
+
throw new Error('Unable to allocate a unique automation monitor id.');
|
|
220
|
+
return id;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
exports.LocalAutomationMonitorStore = LocalAutomationMonitorStore;
|
|
224
|
+
function parseJson(value, fallback) {
|
|
225
|
+
try {
|
|
226
|
+
return JSON.parse(value);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return fallback;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactSecrets = exports.LocalCoreAcpStore = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_sqlite_1 = require("node:sqlite");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const desktop_js_1 = require("../../../../../shared/desktop.js");
|
|
8
|
+
const agent_task_store_js_1 = require("./agent-task-store.js");
|
|
9
|
+
const automation_monitor_store_js_1 = require("./automation-monitor-store.js");
|
|
10
|
+
const schema_js_1 = require("./schema.js");
|
|
11
|
+
const platform_store_js_1 = require("./platform-store.js");
|
|
12
|
+
const scheduler_store_js_1 = require("./scheduler-store.js");
|
|
13
|
+
const security_store_js_1 = require("./security-store.js");
|
|
14
|
+
const thread_store_js_1 = require("./thread-store.js");
|
|
15
|
+
const workspace_registry_store_js_1 = require("./workspace-registry-store.js");
|
|
16
|
+
class LocalCoreAcpStore {
|
|
17
|
+
db;
|
|
18
|
+
threads;
|
|
19
|
+
workspaceRegistry;
|
|
20
|
+
security;
|
|
21
|
+
agentTasks;
|
|
22
|
+
scheduler;
|
|
23
|
+
automationMonitors;
|
|
24
|
+
platform;
|
|
25
|
+
constructor(userDataPath) {
|
|
26
|
+
const dbPath = (0, node_path_1.join)(userDataPath, 'runtime', 'local-core.db');
|
|
27
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(dbPath), { recursive: true });
|
|
28
|
+
this.db = new node_sqlite_1.DatabaseSync(dbPath);
|
|
29
|
+
this.threads = new thread_store_js_1.LocalThreadStore(this.db);
|
|
30
|
+
this.workspaceRegistry = new workspace_registry_store_js_1.LocalWorkspaceRegistryStore(this.db);
|
|
31
|
+
this.security = new security_store_js_1.LocalSecurityStore(this.db, (taskId, input) => {
|
|
32
|
+
this.agentTasks.update(taskId, input);
|
|
33
|
+
});
|
|
34
|
+
this.agentTasks = new agent_task_store_js_1.LocalAgentTaskStore(this.db, (input) => {
|
|
35
|
+
this.security.createAuditEvent(input);
|
|
36
|
+
});
|
|
37
|
+
this.scheduler = new scheduler_store_js_1.LocalSchedulerStore(this.db);
|
|
38
|
+
this.automationMonitors = new automation_monitor_store_js_1.LocalAutomationMonitorStore(this.db);
|
|
39
|
+
this.platform = new platform_store_js_1.LocalPlatformStore(this.db);
|
|
40
|
+
(0, schema_js_1.ensureLocalCoreAcpSchema)(this.db);
|
|
41
|
+
}
|
|
42
|
+
close() {
|
|
43
|
+
this.db.close();
|
|
44
|
+
}
|
|
45
|
+
listThreadSummaries(workspaceId) {
|
|
46
|
+
return this.threads.listSummaries(workspaceId);
|
|
47
|
+
}
|
|
48
|
+
countThreads(workspaceId) {
|
|
49
|
+
return this.threads.count(workspaceId);
|
|
50
|
+
}
|
|
51
|
+
createThread(workspaceId, title, agentType = desktop_js_1.LOCALCORE_ACP_AGENT_TYPE, agentMode = 'default') {
|
|
52
|
+
return this.threads.create(workspaceId, title, agentType, agentMode);
|
|
53
|
+
}
|
|
54
|
+
getThread(threadId, selectedKnowledgeBaseIds) {
|
|
55
|
+
return this.threads.get(threadId, selectedKnowledgeBaseIds);
|
|
56
|
+
}
|
|
57
|
+
renameThread(threadId, title) {
|
|
58
|
+
this.threads.rename(threadId, title);
|
|
59
|
+
}
|
|
60
|
+
deleteThread(threadId) {
|
|
61
|
+
this.platform.clearAuthorizedUserThreadByThreadId(threadId);
|
|
62
|
+
this.platform.deletePlatformThreadBindingsByThreadId(threadId);
|
|
63
|
+
this.threads.delete(threadId);
|
|
64
|
+
}
|
|
65
|
+
appendMessage(threadId, role, content, kind, toolCall, bridgeKind, bridgeStatus) {
|
|
66
|
+
return this.threads.appendMessage(threadId, role, content, kind, toolCall, bridgeKind, bridgeStatus);
|
|
67
|
+
}
|
|
68
|
+
upsertMessage(threadId, id, role, content, kind, toolCall, bridgeKind, bridgeStatus) {
|
|
69
|
+
return this.threads.upsertMessage(threadId, id, role, content, kind, toolCall, bridgeKind, bridgeStatus);
|
|
70
|
+
}
|
|
71
|
+
updateRun(runId, threadId, status) {
|
|
72
|
+
this.threads.updateRun(runId, threadId, status);
|
|
73
|
+
}
|
|
74
|
+
getLatestRunForThread(threadId) {
|
|
75
|
+
return this.threads.getLatestRunForThread(threadId);
|
|
76
|
+
}
|
|
77
|
+
getRun(runId) {
|
|
78
|
+
return this.threads.getRun(runId);
|
|
79
|
+
}
|
|
80
|
+
listWorkspaceRegistry() {
|
|
81
|
+
return this.workspaceRegistry.list();
|
|
82
|
+
}
|
|
83
|
+
getWorkspaceRegistryEntry(workspaceId) {
|
|
84
|
+
return this.workspaceRegistry.get(workspaceId);
|
|
85
|
+
}
|
|
86
|
+
upsertWorkspaceRegistryEntry(input) {
|
|
87
|
+
return this.workspaceRegistry.upsert(input);
|
|
88
|
+
}
|
|
89
|
+
updateWorkspaceRegistryEntry(workspaceId, input) {
|
|
90
|
+
return this.workspaceRegistry.update(workspaceId, input);
|
|
91
|
+
}
|
|
92
|
+
deleteWorkspaceRegistryEntry(workspaceId) {
|
|
93
|
+
return this.workspaceRegistry.delete(workspaceId);
|
|
94
|
+
}
|
|
95
|
+
touchWorkspaceRegistryEntry(workspaceId) {
|
|
96
|
+
this.workspaceRegistry.touch(workspaceId);
|
|
97
|
+
}
|
|
98
|
+
getWorkspaceSecuritySettings(workspaceId) {
|
|
99
|
+
return this.security.getWorkspaceSecuritySettings(workspaceId);
|
|
100
|
+
}
|
|
101
|
+
updateWorkspaceSecuritySettings(workspaceId, input) {
|
|
102
|
+
return this.security.updateWorkspaceSecuritySettings(workspaceId, input);
|
|
103
|
+
}
|
|
104
|
+
createApprovalRequest(input) {
|
|
105
|
+
return this.security.createApprovalRequest(input);
|
|
106
|
+
}
|
|
107
|
+
listApprovalRequests(query = {}) {
|
|
108
|
+
return this.security.listApprovalRequests(query);
|
|
109
|
+
}
|
|
110
|
+
getApprovalRequest(approvalId) {
|
|
111
|
+
return this.security.getApprovalRequest(approvalId);
|
|
112
|
+
}
|
|
113
|
+
resolveApprovalRequest(approvalId, input) {
|
|
114
|
+
return this.security.resolveApprovalRequest(approvalId, input);
|
|
115
|
+
}
|
|
116
|
+
createAuditEvent(input) {
|
|
117
|
+
return this.security.createAuditEvent(input);
|
|
118
|
+
}
|
|
119
|
+
listAuditEvents(query = {}) {
|
|
120
|
+
return this.security.listAuditEvents(query);
|
|
121
|
+
}
|
|
122
|
+
createAgentTask(input) {
|
|
123
|
+
return this.agentTasks.create(input);
|
|
124
|
+
}
|
|
125
|
+
listAgentTasks(query = {}) {
|
|
126
|
+
return this.agentTasks.list(query);
|
|
127
|
+
}
|
|
128
|
+
getAgentTask(taskId) {
|
|
129
|
+
return this.agentTasks.get(taskId);
|
|
130
|
+
}
|
|
131
|
+
getAgentTaskByRunId(runId) {
|
|
132
|
+
return this.agentTasks.getByRunId(runId);
|
|
133
|
+
}
|
|
134
|
+
updateAgentTask(taskId, input) {
|
|
135
|
+
return this.agentTasks.update(taskId, input);
|
|
136
|
+
}
|
|
137
|
+
listScheduledJobs(workspaceId) {
|
|
138
|
+
return this.scheduler.listJobs(workspaceId);
|
|
139
|
+
}
|
|
140
|
+
getScheduledJob(jobId) {
|
|
141
|
+
return this.scheduler.getJob(jobId);
|
|
142
|
+
}
|
|
143
|
+
createScheduledJob(input) {
|
|
144
|
+
return this.scheduler.createJob(input);
|
|
145
|
+
}
|
|
146
|
+
updateScheduledJob(jobId, input) {
|
|
147
|
+
return this.scheduler.updateJob(jobId, input);
|
|
148
|
+
}
|
|
149
|
+
deleteScheduledJob(jobId) {
|
|
150
|
+
return this.scheduler.deleteJob(jobId);
|
|
151
|
+
}
|
|
152
|
+
listScheduledJobRuns(jobId) {
|
|
153
|
+
return this.scheduler.listRuns(jobId);
|
|
154
|
+
}
|
|
155
|
+
createScheduledJobRun(jobId, status, input = {}) {
|
|
156
|
+
return this.scheduler.createRun(jobId, status, input);
|
|
157
|
+
}
|
|
158
|
+
getScheduledJobRun(runId) {
|
|
159
|
+
return this.scheduler.getRun(runId);
|
|
160
|
+
}
|
|
161
|
+
updateScheduledJobRun(runId, input) {
|
|
162
|
+
return this.scheduler.updateRun(runId, input);
|
|
163
|
+
}
|
|
164
|
+
updateScheduledJobStatus(jobId, input) {
|
|
165
|
+
this.scheduler.updateJobStatus(jobId, input);
|
|
166
|
+
}
|
|
167
|
+
listAutomationMonitors(workspaceId) {
|
|
168
|
+
return this.automationMonitors.list(workspaceId);
|
|
169
|
+
}
|
|
170
|
+
getAutomationMonitor(monitorId) {
|
|
171
|
+
return this.automationMonitors.get(monitorId);
|
|
172
|
+
}
|
|
173
|
+
createAutomationMonitor(input) {
|
|
174
|
+
return this.automationMonitors.create(input);
|
|
175
|
+
}
|
|
176
|
+
updateAutomationMonitor(monitorId, input) {
|
|
177
|
+
return this.automationMonitors.update(monitorId, input);
|
|
178
|
+
}
|
|
179
|
+
updateAutomationMonitorState(monitorId, input) {
|
|
180
|
+
this.automationMonitors.updateState(monitorId, input);
|
|
181
|
+
}
|
|
182
|
+
deleteAutomationMonitor(monitorId) {
|
|
183
|
+
return this.automationMonitors.delete(monitorId);
|
|
184
|
+
}
|
|
185
|
+
listAutomationMonitorRuns(monitorId) {
|
|
186
|
+
return this.automationMonitors.listRuns(monitorId);
|
|
187
|
+
}
|
|
188
|
+
createAutomationMonitorRun(monitorId, status, input = {}) {
|
|
189
|
+
return this.automationMonitors.createRun(monitorId, status, input);
|
|
190
|
+
}
|
|
191
|
+
getAutomationMonitorRun(runId) {
|
|
192
|
+
return this.automationMonitors.getRun(runId);
|
|
193
|
+
}
|
|
194
|
+
updateAutomationMonitorRun(runId, input) {
|
|
195
|
+
return this.automationMonitors.updateRun(runId, input);
|
|
196
|
+
}
|
|
197
|
+
getThreadRow(threadId) {
|
|
198
|
+
return this.threads.getRow(threadId);
|
|
199
|
+
}
|
|
200
|
+
updateThreadAgentMode(threadId, mode) {
|
|
201
|
+
this.threads.updateAgentMode(threadId, mode);
|
|
202
|
+
}
|
|
203
|
+
updateThreadAgentType(threadId, agentType) {
|
|
204
|
+
this.threads.updateAgentType(threadId, agentType);
|
|
205
|
+
}
|
|
206
|
+
updateThreadSession(threadId, sessionId, supportsLoad) {
|
|
207
|
+
this.threads.updateSession(threadId, sessionId, supportsLoad);
|
|
208
|
+
}
|
|
209
|
+
createPairingRequest(input) {
|
|
210
|
+
this.platform.createPairingRequest(input);
|
|
211
|
+
}
|
|
212
|
+
listPendingPairings(workspaceId) {
|
|
213
|
+
return this.platform.listPendingPairings(workspaceId);
|
|
214
|
+
}
|
|
215
|
+
getPairingRequest(code) {
|
|
216
|
+
return this.platform.getPairingRequest(code);
|
|
217
|
+
}
|
|
218
|
+
updatePairingStatus(code, status) {
|
|
219
|
+
this.platform.updatePairingStatus(code, status);
|
|
220
|
+
}
|
|
221
|
+
expirePendingPairings(nowIso = new Date().toISOString()) {
|
|
222
|
+
this.platform.expirePendingPairings(nowIso);
|
|
223
|
+
}
|
|
224
|
+
getAuthorizedUser(workspaceId, platformUserId, platform = 'lark') {
|
|
225
|
+
return this.platform.getAuthorizedUser(workspaceId, platformUserId, platform);
|
|
226
|
+
}
|
|
227
|
+
listAuthorizedUsers(workspaceId, platform) {
|
|
228
|
+
return this.platform.listAuthorizedUsers(workspaceId, platform);
|
|
229
|
+
}
|
|
230
|
+
createAuthorizedUser(input) {
|
|
231
|
+
this.platform.createAuthorizedUser(input);
|
|
232
|
+
}
|
|
233
|
+
updateAuthorizedUserThread(workspaceId, platformUserId, threadId, platform = 'lark') {
|
|
234
|
+
this.platform.updateAuthorizedUserThread(workspaceId, platformUserId, threadId, platform);
|
|
235
|
+
}
|
|
236
|
+
clearAuthorizedUserThreadByThreadId(threadId) {
|
|
237
|
+
this.platform.clearAuthorizedUserThreadByThreadId(threadId);
|
|
238
|
+
}
|
|
239
|
+
getPlatformThreadBinding(workspaceId, chatId, platformUserId, platform = 'lark') {
|
|
240
|
+
return this.platform.getPlatformThreadBinding(workspaceId, chatId, platformUserId, platform);
|
|
241
|
+
}
|
|
242
|
+
getPlatformThreadBindingByThreadId(threadId) {
|
|
243
|
+
return this.platform.getPlatformThreadBindingByThreadId(threadId);
|
|
244
|
+
}
|
|
245
|
+
deletePlatformThreadBindingsByThreadId(threadId) {
|
|
246
|
+
this.platform.deletePlatformThreadBindingsByThreadId(threadId);
|
|
247
|
+
}
|
|
248
|
+
upsertPlatformThreadBinding(input) {
|
|
249
|
+
this.platform.upsertPlatformThreadBinding(input);
|
|
250
|
+
}
|
|
251
|
+
updatePlatformThreadMessageId(workspaceId, chatId, platformUserId, messageId, platform = 'lark') {
|
|
252
|
+
this.platform.updatePlatformThreadMessageId(workspaceId, chatId, platformUserId, messageId, platform);
|
|
253
|
+
}
|
|
254
|
+
clearPlatformThreadMessageId(workspaceId, chatId, platformUserId, platform = 'lark') {
|
|
255
|
+
this.platform.clearPlatformThreadMessageId(workspaceId, chatId, platformUserId, platform);
|
|
256
|
+
}
|
|
257
|
+
listPairingRequests(workspaceId, platform) {
|
|
258
|
+
return this.platform.listPairingRequests(workspaceId, platform);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
exports.LocalCoreAcpStore = LocalCoreAcpStore;
|
|
262
|
+
var utils_js_1 = require("./utils.js");
|
|
263
|
+
Object.defineProperty(exports, "redactSecrets", { enumerable: true, get: function () { return utils_js_1.redactSecrets; } });
|