@kafca/agentdock 0.1.56 → 0.1.58
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 +7 -0
- package/dist/renderer/assets/{Badge-DjcoXx2J.js → Badge-BfY1VaHS.js} +1 -1
- package/dist/renderer/assets/Card-DWA_Tww_.js +1 -0
- package/dist/renderer/assets/Config-nHj3g1U5.js +21 -0
- package/dist/renderer/assets/CronList-BwkA_I7v.js +1 -0
- package/dist/renderer/assets/Dashboard-D0_A7k02.js +41 -0
- package/dist/renderer/assets/{EmptyState-DIZLiccW.js → EmptyState-zatDjLj_.js} +1 -1
- package/dist/renderer/assets/HighlightedMarkdown-CsM5n70d.js +12 -0
- package/dist/renderer/assets/Input-R1XdFK1K.js +1 -0
- package/dist/renderer/assets/{KnowledgeDetail-CJ9IYOsa.js → KnowledgeDetail-Co5sxeGd.js} +2 -2
- package/dist/renderer/assets/{KnowledgeHome-BLGPwnBO.js → KnowledgeHome-DwziPw5m.js} +3 -3
- package/dist/renderer/assets/Logs-NwZUtR_G.js +6 -0
- package/dist/renderer/assets/{Modal-CQiUpfl4.js → Modal-CrcIwIFL.js} +3 -3
- package/dist/renderer/assets/MonitorList-CS1uLS5A.js +1 -0
- package/dist/renderer/assets/Page-Dp0obeSw.js +1 -0
- package/dist/renderer/assets/{Select-D6z65IT3.js → Select-6mVQaf84.js} +2 -2
- package/dist/renderer/assets/ThreadChat-BFzbn3L6.js +86 -0
- package/dist/renderer/assets/Workspace-DCmo8BMm.js +19 -0
- package/dist/renderer/assets/{arrow-left-CV5cL3f4.js → arrow-left-9rjg_Hp4.js} +1 -1
- package/dist/renderer/assets/{book-open-DThvB7pj.js → book-open-Bu8GCHnG.js} +1 -1
- package/dist/renderer/assets/channels-BxVbG-6j.js +6 -0
- package/dist/renderer/assets/chevron-down-BE8uQmWM.js +11 -0
- package/dist/renderer/assets/index-B7TeF6Es.js +41 -0
- package/dist/renderer/assets/index-BIKL3fTP.css +11 -0
- package/dist/renderer/assets/index-BkI9POxj.js +167 -0
- package/dist/renderer/assets/knowledge-Kl19SqGS.js +1 -0
- package/dist/renderer/assets/{pencil-Dv5WxhdC.js → pencil-CPB7SK1m.js} +1 -1
- package/dist/renderer/assets/{play-DnCnft83.js → play-DGAO4OCu.js} +1 -1
- package/dist/renderer/assets/{plus-DsxIagzS.js → plus-Bt26z-4q.js} +1 -1
- package/dist/renderer/assets/{save-CST01lIc.js → save-Une7GMxT.js} +1 -1
- package/dist/renderer/assets/{search-B_bqy6Wd.js → search-DE0agJjJ.js} +1 -1
- package/dist/renderer/assets/{shield-check-D6lG5Aoc.js → shield-check-De7xaXZh.js} +1 -1
- package/dist/renderer/assets/threads-BnsNL5ei.js +1 -0
- package/dist/renderer/assets/{trash-2-Cefngb6Q.js → trash-2-6iGF59Ac.js} +1 -1
- package/dist/renderer/index.html +2 -2
- package/dist-electron/packages/contracts/src/automation.js +2 -0
- package/dist-electron/packages/contracts/src/channels.js +2 -0
- package/dist-electron/packages/contracts/src/knowledge.js +2 -0
- package/dist-electron/packages/contracts/src/local-core.js +15 -0
- package/dist-electron/packages/contracts/src/runtime.js +2 -0
- package/dist-electron/packages/contracts/src/scheduler.js +2 -0
- package/dist-electron/packages/contracts/src/threads.js +2 -0
- package/dist-electron/packages/core-sdk/src/automation.js +32 -0
- package/dist-electron/packages/core-sdk/src/channels.js +121 -0
- package/dist-electron/packages/core-sdk/src/client.js +455 -0
- package/dist-electron/packages/core-sdk/src/index.js +43 -607
- package/dist-electron/packages/core-sdk/src/knowledge.js +85 -0
- package/dist-electron/packages/core-sdk/src/request.js +22 -0
- package/dist-electron/packages/core-sdk/src/runtime.js +214 -0
- package/dist-electron/packages/core-sdk/src/scheduler.js +32 -0
- package/dist-electron/packages/core-sdk/src/threads.js +67 -0
- package/dist-electron/packages/plugin-sdk/src/agents.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/automation.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/channels.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/index.js +21 -0
- package/dist-electron/packages/plugin-sdk/src/knowledge.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/runtime.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/scheduler.js +2 -0
- package/dist-electron/packages/plugin-sdk/src/threads.js +2 -0
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-backend.js +5 -8
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-content.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/local-core-acp-turn-coordinator.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/agent-task-store.js +5 -5
- package/dist-electron/services/local-ai-core/src/acp/store/automation-monitor-store.js +12 -12
- package/dist-electron/services/local-ai-core/src/acp/store/local-core-acp-store.js +2 -2
- package/dist-electron/services/local-ai-core/src/acp/store/scheduler-store.js +11 -11
- package/dist-electron/services/local-ai-core/src/acp/store/security-store.js +3 -3
- package/dist-electron/services/local-ai-core/src/acp/store/thread-store.js +7 -7
- package/dist-electron/services/local-ai-core/src/acp/workspace-acp-permissions.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/claudecode/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/codex/definition.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/localcore-acp/index.js +4 -4
- package/dist-electron/services/local-ai-core/src/agents/opencode/launch.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/definition.js +2 -2
- package/dist-electron/services/local-ai-core/src/agents/pi/launch.js +3 -3
- package/dist-electron/services/local-ai-core/src/agents/pi/provider-materializer.js +1 -1
- package/dist-electron/services/local-ai-core/src/agents/shared/agent-plugin.js +4 -4
- package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js +6 -47
- package/dist-electron/services/local-ai-core/src/automation/automation-monitor-service.js +2 -5
- package/dist-electron/services/local-ai-core/src/channel/lark/cards.js +33 -18
- package/dist-electron/services/local-ai-core/src/channel/lark/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/lark/gateway-utils.js +91 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/inbound-handler.js +180 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/local-core-lark-gateway.js +58 -539
- package/dist-electron/services/local-ai-core/src/channel/lark/outbound-transport.js +112 -0
- package/dist-electron/services/local-ai-core/src/channel/lark/runtime-state.js +5 -20
- package/dist-electron/services/local-ai-core/src/channel/shared/base-channel-gateway.js +37 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/bridge-event-helpers.js +23 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/channel-keys.js +6 -0
- package/dist-electron/services/local-ai-core/src/channel/shared/inbound-authorization.js +54 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/config.js +2 -2
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-media.js +21 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/inbound-poller.js +167 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/local-core-weixin-gateway.js +55 -512
- package/dist-electron/services/local-ai-core/src/channel/weixin/runtime-state.js +149 -0
- package/dist-electron/services/local-ai-core/src/channel/weixin/text-utils.js +92 -0
- package/dist-electron/services/local-ai-core/src/cli/lac.js +9 -11
- package/dist-electron/services/local-ai-core/src/cli/monitor-cli-parsers.js +2 -2
- package/dist-electron/services/local-ai-core/src/kernel/bootstrap.js +28 -70
- package/dist-electron/services/local-ai-core/src/kernel/local-core-errors.js +8 -0
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-ai-vector-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/plugins/builtin/knowledge-noop-plugin.js +2 -2
- package/dist-electron/services/local-ai-core/src/router/workspace-bridge-event-stream.js +29 -0
- package/dist-electron/services/local-ai-core/src/router/workspace-route-config.js +5 -5
- package/dist-electron/services/local-ai-core/src/router/workspace-router.js +47 -60
- package/dist-electron/services/local-ai-core/src/runtime/agent-runtime-detector.js +5 -5
- package/dist-electron/services/local-ai-core/src/runtime/config-migration.js +6 -6
- package/dist-electron/services/local-ai-core/src/runtime/deployment-diagnostics.js +3 -3
- package/dist-electron/services/local-ai-core/src/runtime/external-service.js +3 -1
- package/dist-electron/services/local-ai-core/src/runtime/handlers/automation-handler.js +11 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/channel-handler.js +12 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/external-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/knowledge-handler.js +18 -6
- package/dist-electron/services/local-ai-core/src/runtime/handlers/provider-handler.js +7 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/runtime-handler.js +28 -3
- package/dist-electron/services/local-ai-core/src/runtime/handlers/scheduler-handler.js +10 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/security-handler.js +18 -5
- package/dist-electron/services/local-ai-core/src/runtime/handlers/task-handler.js +14 -2
- package/dist-electron/services/local-ai-core/src/runtime/handlers/thread-handler.js +18 -15
- package/dist-electron/services/local-ai-core/src/runtime/handlers/workspace-handler.js +13 -2
- package/dist-electron/services/local-ai-core/src/runtime/local-core-controller.js +35 -8
- package/dist-electron/services/local-ai-core/src/runtime/request-validation.js +79 -0
- package/dist-electron/services/local-ai-core/src/runtime/runtime-detection-service.js +9 -9
- package/dist-electron/services/local-ai-core/src/runtime/server-helpers.js +10 -1
- package/dist-electron/services/local-ai-core/src/runtime/server.js +2 -1
- package/dist-electron/services/local-ai-core/src/runtime/workspace-project-registry.js +76 -0
- package/dist-electron/services/local-ai-core/src/sandbox/opensandbox-client.js +3 -2
- package/dist-electron/services/local-ai-core/src/sandbox/sandbox-config.js +8 -8
- package/dist-electron/services/local-ai-core/src/scheduler/base-channel-schedule-adapter.js +77 -0
- package/dist-electron/services/local-ai-core/src/scheduler/lark-schedule-adapter.js +13 -79
- package/dist-electron/services/local-ai-core/src/scheduler/local-schedule-adapter.js +2 -10
- package/dist-electron/services/local-ai-core/src/scheduler/run-polling.js +19 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-conversation-executor.js +3 -37
- package/dist-electron/services/local-ai-core/src/scheduler/scheduled-job-route.js +20 -0
- package/dist-electron/services/local-ai-core/src/scheduler/scheduler-service.js +15 -28
- package/dist-electron/services/local-ai-core/src/scheduler/thread-resolution.js +12 -0
- package/dist-electron/services/local-ai-core/src/scheduler/weixin-schedule-adapter.js +13 -79
- package/dist-electron/services/local-ai-core/src/thread/agent-message-policy.js +75 -0
- package/dist-electron/shared/desktop.js +1 -64
- package/dist-electron/src/components/chat/chat-controller-state.js +60 -0
- package/dist-electron/src/components/chat/chat-event-gate.js +146 -0
- package/dist-electron/src/components/chat/markdown-code-block.js +8 -0
- package/dist-electron/src/pages/Desktop/workspace-model.js +212 -0
- package/dist-electron/src/pages/Threads/thread-chat-model.js +50 -51
- package/dist-electron/tests/contracts/agent-message-policy.test.js +21 -0
- package/dist-electron/tests/contracts/architecture-docs.test.js +56 -33
- package/dist-electron/tests/contracts/chat-event-gate.test.js +114 -0
- package/dist-electron/tests/contracts/chat-markdown.test.js +16 -0
- package/dist-electron/tests/contracts/thread-task-state.test.js +32 -0
- package/dist-electron/tests/contracts/workspace-identity.test.js +23 -0
- package/dist-electron/tests/electron/core-client.test.js +284 -0
- package/dist-electron/tests/electron/plugin-kernel.test.js +54 -0
- package/dist-electron/tests/electron/renderer-packaging.test.js +9 -0
- package/dist-electron/tests/electron/workspace-task-store.test.js +31 -0
- package/dist-electron/tests/integration/channel-inbound-authorization.test.js +80 -0
- package/dist-electron/tests/integration/lark-gateway-utils.test.js +13 -0
- package/dist-electron/tests/integration/lark-gateway.test.js +4 -4
- package/dist-electron/tests/integration/local-core-refactor.test.js +15 -8
- package/dist-electron/tests/integration/weixin-runtime-state.test.js +32 -0
- package/dist-electron/tests/integration/weixin-text-utils.test.js +15 -0
- package/package.json +9 -4
- package/dist/renderer/assets/Chat-C5Bkm9-M.js +0 -2
- package/dist/renderer/assets/ChatMarkdown-uc36EzyD.js +0 -45
- package/dist/renderer/assets/Config-DHtQuuLy.js +0 -21
- package/dist/renderer/assets/CronList-BYUnhzSC.js +0 -1
- package/dist/renderer/assets/Dashboard-BPnGMDg3.js +0 -26
- package/dist/renderer/assets/Logs-Dyd2Uwlt.js +0 -1
- package/dist/renderer/assets/MonitorList-Byg3E3Gt.js +0 -1
- package/dist/renderer/assets/Page-7DxXvTMm.js +0 -1
- package/dist/renderer/assets/ProjectDetail-Dfr5s0Ja.js +0 -11
- package/dist/renderer/assets/ProjectList-CDDQjAQ_.js +0 -1
- package/dist/renderer/assets/SessionChat-s7CAaCPL.js +0 -1
- package/dist/renderer/assets/SessionList-D-OycKKS.js +0 -1
- package/dist/renderer/assets/ThreadChat-CLdFynB5.js +0 -28
- package/dist/renderer/assets/Workspace-xfT5z4j_.js +0 -19
- package/dist/renderer/assets/bot-CWQ5-ovl.js +0 -6
- package/dist/renderer/assets/check-DKM7zfWG.js +0 -6
- package/dist/renderer/assets/chevron-down-Dfw2KU87.js +0 -6
- package/dist/renderer/assets/circle-CoP4RA4s.js +0 -6
- package/dist/renderer/assets/desktop-CsDYrOOU.js +0 -1
- package/dist/renderer/assets/desktop-JQkhNOF4.js +0 -5
- package/dist/renderer/assets/funnel-DpVLlG3g.js +0 -6
- package/dist/renderer/assets/heart-BMD36ejP.js +0 -6
- package/dist/renderer/assets/index-COxSYBjE.js +0 -182
- package/dist/renderer/assets/index-CTGTI-cm.js +0 -41
- package/dist/renderer/assets/index-CjCuR6DI.css +0 -11
- package/dist/renderer/assets/projects-DgjHcNgt.js +0 -1
- package/dist/renderer/assets/server-ecH4GNwa.js +0 -11
- package/dist/renderer/assets/session-utils-Dd_WKMYW.js +0 -6
- package/dist/renderer/assets/sessions-BQ33Mv4k.js +0 -1
- package/dist/renderer/assets/user-D_8RSH-T.js +0 -6
- package/dist/renderer/assets/wifi-off-DB9D-pOu.js +0 -11
- package/dist-electron/services/local-ai-core/src/scheduler/lark-execution-policies.js +0 -13
- package/dist-electron/services/local-ai-core/src/scheduler/weixin-execution-policies.js +0 -13
- package/dist-electron/src/api/client.js +0 -73
- package/dist-electron/src/api/sessions.js +0 -21
- package/dist-electron/src/lib/session-utils.js +0 -51
- package/dist-electron/src/pages/Projects/project-provider-config.js +0 -75
- package/dist-electron/tests/electron/project-provider-config.test.js +0 -71
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalAutomationMonitorStore = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
class LocalAutomationMonitorStore {
|
|
7
7
|
db;
|
|
8
8
|
constructor(db) {
|
|
@@ -45,7 +45,7 @@ class LocalAutomationMonitorStore {
|
|
|
45
45
|
const condition = {
|
|
46
46
|
...input.condition,
|
|
47
47
|
metric: String(input.condition?.metric || '').trim(),
|
|
48
|
-
operator: (0,
|
|
48
|
+
operator: (0, superai_contracts_1.normalizeAutomationMonitorConditionOperator)(input.condition?.operator),
|
|
49
49
|
};
|
|
50
50
|
if (!condition.metric)
|
|
51
51
|
throw new Error('Automation monitor condition metric is required.');
|
|
@@ -56,7 +56,7 @@ class LocalAutomationMonitorStore {
|
|
|
56
56
|
id, workspace_id, title, source_type, source_config_json, condition_json, prompt_template, platform, route_type, route_config,
|
|
57
57
|
execution_mode, enabled, cooldown_ms, concurrency_policy, last_state_json, created_at, updated_at
|
|
58
58
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'skip_if_running', ?, ?, ?)
|
|
59
|
-
`).run(id, input.workspaceId, title, sourceType, JSON.stringify(input.sourceConfig || {}), JSON.stringify(condition), input.promptTemplate, (0,
|
|
59
|
+
`).run(id, input.workspaceId, title, sourceType, JSON.stringify(input.sourceConfig || {}), JSON.stringify(condition), input.promptTemplate, (0, superai_contracts_1.normalizeChannelPlatform)(input.platform), input.route.type, JSON.stringify(input.route), (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(input.executionMode, 'side-thread'), input.enabled === false ? 0 : 1, Math.max(0, Number(input.cooldownMs ?? 15 * 60 * 1000)), null, now, now);
|
|
60
60
|
return this.get(id);
|
|
61
61
|
}
|
|
62
62
|
update(monitorId, input) {
|
|
@@ -67,7 +67,7 @@ class LocalAutomationMonitorStore {
|
|
|
67
67
|
? {
|
|
68
68
|
...input.condition,
|
|
69
69
|
metric: String(input.condition.metric || '').trim(),
|
|
70
|
-
operator: (0,
|
|
70
|
+
operator: (0, superai_contracts_1.normalizeAutomationMonitorConditionOperator)(input.condition.operator),
|
|
71
71
|
}
|
|
72
72
|
: existing.condition;
|
|
73
73
|
const next = {
|
|
@@ -77,7 +77,7 @@ class LocalAutomationMonitorStore {
|
|
|
77
77
|
condition: nextCondition,
|
|
78
78
|
...(typeof input.promptTemplate === 'string' ? { promptTemplate: input.promptTemplate } : {}),
|
|
79
79
|
...(input.route ? { route: input.route } : {}),
|
|
80
|
-
...(input.executionMode ? { executionMode: (0,
|
|
80
|
+
...(input.executionMode ? { executionMode: (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(input.executionMode, 'side-thread') } : {}),
|
|
81
81
|
...(typeof input.enabled === 'boolean' ? { enabled: input.enabled } : {}),
|
|
82
82
|
...(typeof input.cooldownMs === 'number' ? { cooldownMs: Math.max(0, input.cooldownMs) } : {}),
|
|
83
83
|
updatedAt: new Date().toISOString(),
|
|
@@ -122,7 +122,7 @@ class LocalAutomationMonitorStore {
|
|
|
122
122
|
createRun(monitorId, status, input = {}) {
|
|
123
123
|
const id = `monitorrun:${(0, node_crypto_1.randomUUID)()}`;
|
|
124
124
|
const triggeredAt = input.triggeredAt || new Date().toISOString();
|
|
125
|
-
const normalizedStatus = (0,
|
|
125
|
+
const normalizedStatus = (0, superai_contracts_1.normalizeAutomationMonitorStatus)(status);
|
|
126
126
|
this.db.prepare(`
|
|
127
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
128
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
@@ -149,7 +149,7 @@ class LocalAutomationMonitorStore {
|
|
|
149
149
|
const next = {
|
|
150
150
|
...existing,
|
|
151
151
|
...input,
|
|
152
|
-
...(input.status ? { status: (0,
|
|
152
|
+
...(input.status ? { status: (0, superai_contracts_1.normalizeAutomationMonitorStatus)(input.status) } : {}),
|
|
153
153
|
};
|
|
154
154
|
this.db.prepare(`
|
|
155
155
|
UPDATE automation_monitor_runs
|
|
@@ -175,12 +175,12 @@ class LocalAutomationMonitorStore {
|
|
|
175
175
|
sourceConfig: parseJson(row.source_config_json || '{}', {}),
|
|
176
176
|
condition: {
|
|
177
177
|
...condition,
|
|
178
|
-
operator: (0,
|
|
178
|
+
operator: (0, superai_contracts_1.normalizeAutomationMonitorConditionOperator)(condition.operator),
|
|
179
179
|
},
|
|
180
180
|
promptTemplate: row.prompt_template,
|
|
181
|
-
platform: (0,
|
|
181
|
+
platform: (0, superai_contracts_1.normalizeChannelPlatform)(row.platform),
|
|
182
182
|
route: JSON.parse(row.route_config),
|
|
183
|
-
executionMode: (0,
|
|
183
|
+
executionMode: (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(row.execution_mode, 'side-thread'),
|
|
184
184
|
enabled: Boolean(row.enabled),
|
|
185
185
|
cooldownMs: Number(row.cooldown_ms || 0),
|
|
186
186
|
concurrencyPolicy: row.concurrency_policy,
|
|
@@ -188,7 +188,7 @@ class LocalAutomationMonitorStore {
|
|
|
188
188
|
createdAt: row.created_at,
|
|
189
189
|
updatedAt: row.updated_at,
|
|
190
190
|
lastTriggeredAt: row.last_triggered_at || undefined,
|
|
191
|
-
lastStatus: row.last_status ? (0,
|
|
191
|
+
lastStatus: row.last_status ? (0, superai_contracts_1.normalizeAutomationMonitorStatus)(row.last_status) : undefined,
|
|
192
192
|
lastError: row.last_error || undefined,
|
|
193
193
|
};
|
|
194
194
|
}
|
|
@@ -196,7 +196,7 @@ class LocalAutomationMonitorStore {
|
|
|
196
196
|
return {
|
|
197
197
|
id: row.id,
|
|
198
198
|
monitorId: row.monitor_id,
|
|
199
|
-
status: (0,
|
|
199
|
+
status: (0, superai_contracts_1.normalizeAutomationMonitorStatus)(row.status),
|
|
200
200
|
triggeredAt: row.triggered_at,
|
|
201
201
|
startedAt: row.started_at || undefined,
|
|
202
202
|
finishedAt: row.finished_at || undefined,
|
|
@@ -4,7 +4,7 @@ exports.redactSecrets = exports.LocalCoreAcpStore = void 0;
|
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
5
|
const node_sqlite_1 = require("node:sqlite");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
|
-
const
|
|
7
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
8
8
|
const agent_task_store_js_1 = require("./agent-task-store.js");
|
|
9
9
|
const automation_monitor_store_js_1 = require("./automation-monitor-store.js");
|
|
10
10
|
const schema_js_1 = require("./schema.js");
|
|
@@ -58,7 +58,7 @@ class LocalCoreAcpStore {
|
|
|
58
58
|
countThreads(workspaceId) {
|
|
59
59
|
return this.threads.count(workspaceId);
|
|
60
60
|
}
|
|
61
|
-
createThread(workspaceId, title, agentType =
|
|
61
|
+
createThread(workspaceId, title, agentType = superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE, agentMode = 'default') {
|
|
62
62
|
return this.threads.create(workspaceId, title, agentType, agentMode);
|
|
63
63
|
}
|
|
64
64
|
getThread(threadId, selectedKnowledgeBaseIds) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalSchedulerStore = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
const job_id_js_1 = require("../../scheduler/job-id.js");
|
|
7
7
|
const utils_js_1 = require("./utils.js");
|
|
8
8
|
class LocalSchedulerStore {
|
|
@@ -54,7 +54,7 @@ class LocalSchedulerStore {
|
|
|
54
54
|
id, workspace_id, platform, route_type, route_config, execution_mode, trigger_type, cron_expr, run_at,
|
|
55
55
|
prompt_template, description, enabled, concurrency_policy, created_at, updated_at
|
|
56
56
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'skip_if_running', ?, ?)
|
|
57
|
-
`).run(id, input.workspaceId, (0,
|
|
57
|
+
`).run(id, input.workspaceId, (0, superai_contracts_1.normalizeChannelPlatform)(input.platform), input.route.type, JSON.stringify(input.route), (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(input.executionMode), (0, superai_contracts_1.normalizeScheduledJobTriggerType)(input.triggerType), input.cronExpr || null, input.runAt || null, input.promptTemplate, input.description || '', input.enabled === false ? 0 : 1, now, now);
|
|
58
58
|
return this.getJob(id);
|
|
59
59
|
}
|
|
60
60
|
updateJob(jobId, input) {
|
|
@@ -65,8 +65,8 @@ class LocalSchedulerStore {
|
|
|
65
65
|
const next = {
|
|
66
66
|
...existing,
|
|
67
67
|
...(input.route ? { route: input.route } : {}),
|
|
68
|
-
...(input.executionMode ? { executionMode: (0,
|
|
69
|
-
...(input.triggerType ? { triggerType: (0,
|
|
68
|
+
...(input.executionMode ? { executionMode: (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(input.executionMode) } : {}),
|
|
69
|
+
...(input.triggerType ? { triggerType: (0, superai_contracts_1.normalizeScheduledJobTriggerType)(input.triggerType) } : {}),
|
|
70
70
|
...(Object.prototype.hasOwnProperty.call(input, 'cronExpr') ? { cronExpr: input.cronExpr || undefined } : {}),
|
|
71
71
|
...(Object.prototype.hasOwnProperty.call(input, 'runAt') ? { runAt: input.runAt || undefined } : {}),
|
|
72
72
|
...(typeof input.promptTemplate === 'string' ? { promptTemplate: input.promptTemplate } : {}),
|
|
@@ -101,7 +101,7 @@ class LocalSchedulerStore {
|
|
|
101
101
|
createRun(jobId, status, input = {}) {
|
|
102
102
|
const id = `jobrun:${(0, node_crypto_1.randomUUID)()}`;
|
|
103
103
|
const triggeredAt = input.triggeredAt || new Date().toISOString();
|
|
104
|
-
const normalizedStatus = (0,
|
|
104
|
+
const normalizedStatus = (0, superai_contracts_1.normalizeScheduledJobRunStatus)(status);
|
|
105
105
|
this.db.prepare(`
|
|
106
106
|
INSERT INTO scheduled_job_runs (id, job_id, status, triggered_at, started_at, finished_at, error, thread_id, run_id, platform_message_id, platform_message_ids_json, delivery_mode, delivery_status, delivery_error, last_bridge_event_at)
|
|
107
107
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
@@ -129,7 +129,7 @@ class LocalSchedulerStore {
|
|
|
129
129
|
const next = {
|
|
130
130
|
...existing,
|
|
131
131
|
...input,
|
|
132
|
-
...(input.status ? { status: (0,
|
|
132
|
+
...(input.status ? { status: (0, superai_contracts_1.normalizeScheduledJobRunStatus)(input.status) } : {}),
|
|
133
133
|
};
|
|
134
134
|
this.db.prepare(`
|
|
135
135
|
UPDATE scheduled_job_runs
|
|
@@ -161,10 +161,10 @@ class LocalSchedulerStore {
|
|
|
161
161
|
return {
|
|
162
162
|
id: row.id,
|
|
163
163
|
workspaceId: row.workspace_id,
|
|
164
|
-
platform: (0,
|
|
164
|
+
platform: (0, superai_contracts_1.normalizeChannelPlatform)(row.platform),
|
|
165
165
|
route,
|
|
166
|
-
executionMode: (0,
|
|
167
|
-
triggerType: (0,
|
|
166
|
+
executionMode: (0, superai_contracts_1.normalizeScheduledJobExecutionMode)(row.execution_mode),
|
|
167
|
+
triggerType: (0, superai_contracts_1.normalizeScheduledJobTriggerType)(row.trigger_type),
|
|
168
168
|
cronExpr: row.cron_expr || undefined,
|
|
169
169
|
runAt: row.run_at || undefined,
|
|
170
170
|
promptTemplate: row.prompt_template,
|
|
@@ -174,7 +174,7 @@ class LocalSchedulerStore {
|
|
|
174
174
|
createdAt: row.created_at,
|
|
175
175
|
updatedAt: row.updated_at,
|
|
176
176
|
lastRunAt: row.last_run_at || undefined,
|
|
177
|
-
lastStatus: row.last_status ? (0,
|
|
177
|
+
lastStatus: row.last_status ? (0, superai_contracts_1.normalizeScheduledJobRunStatus)(row.last_status) : undefined,
|
|
178
178
|
lastError: row.last_error || undefined,
|
|
179
179
|
};
|
|
180
180
|
}
|
|
@@ -182,7 +182,7 @@ class LocalSchedulerStore {
|
|
|
182
182
|
return {
|
|
183
183
|
id: row.id,
|
|
184
184
|
jobId: row.job_id,
|
|
185
|
-
status: (0,
|
|
185
|
+
status: (0, superai_contracts_1.normalizeScheduledJobRunStatus)(row.status),
|
|
186
186
|
triggeredAt: row.triggered_at,
|
|
187
187
|
startedAt: row.started_at || undefined,
|
|
188
188
|
finishedAt: row.finished_at || undefined,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalSecurityStore = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
7
7
|
class LocalSecurityStore {
|
|
8
8
|
db;
|
|
@@ -115,7 +115,7 @@ class LocalSecurityStore {
|
|
|
115
115
|
params.push(query.taskId);
|
|
116
116
|
}
|
|
117
117
|
if (query.status) {
|
|
118
|
-
const statuses = (Array.isArray(query.status) ? query.status : [query.status]).map((status) => (0,
|
|
118
|
+
const statuses = (Array.isArray(query.status) ? query.status : [query.status]).map((status) => (0, superai_contracts_1.normalizeApprovalRequestStatus)(status));
|
|
119
119
|
predicates.push(`status IN (${statuses.map(() => '?').join(', ')})`);
|
|
120
120
|
params.push(...statuses);
|
|
121
121
|
}
|
|
@@ -230,7 +230,7 @@ class LocalSecurityStore {
|
|
|
230
230
|
runId: row.run_id || undefined,
|
|
231
231
|
deviceId: row.device_id,
|
|
232
232
|
kind: row.kind,
|
|
233
|
-
status: (0,
|
|
233
|
+
status: (0, superai_contracts_1.normalizeApprovalRequestStatus)(row.status),
|
|
234
234
|
riskLevel: row.risk_level,
|
|
235
235
|
title: row.title,
|
|
236
236
|
description: row.description,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalThreadStore = void 0;
|
|
4
4
|
const node_crypto_1 = require("node:crypto");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
|
+
const superai_contracts_2 = require("../../../../../packages/contracts/src/index.js");
|
|
7
7
|
const workspace_thread_mappers_js_1 = require("../../thread/workspace-thread-mappers.js");
|
|
8
8
|
const workspace_thread_id_js_1 = require("../../thread/workspace-thread-id.js");
|
|
9
9
|
const utils_js_1 = require("./utils.js");
|
|
@@ -38,11 +38,11 @@ class LocalThreadStore {
|
|
|
38
38
|
const row = this.db.prepare('SELECT COUNT(*) AS total FROM threads WHERE workspace_id = ?').get(workspaceId);
|
|
39
39
|
return Number(row?.total || 0);
|
|
40
40
|
}
|
|
41
|
-
create(workspaceId, title, agentType =
|
|
41
|
+
create(workspaceId, title, agentType = superai_contracts_2.LOCALCORE_ACP_AGENT_TYPE, agentMode = 'default') {
|
|
42
42
|
const sessionId = (0, node_crypto_1.randomUUID)();
|
|
43
43
|
const threadId = (0, workspace_thread_id_js_1.encodeThreadId)(workspaceId, sessionId);
|
|
44
44
|
const now = new Date().toISOString();
|
|
45
|
-
const bridgeSessionKey = `${
|
|
45
|
+
const bridgeSessionKey = `${superai_contracts_2.LOCALCORE_ACP_AGENT_TYPE}:${workspaceId}:${sessionId}`;
|
|
46
46
|
this.db.prepare(`
|
|
47
47
|
INSERT INTO threads (id, workspace_id, session_id, bridge_session_key, title, agent_type, created_at, updated_at, history_count, excerpt, agent_mode)
|
|
48
48
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, 0, '', ?)
|
|
@@ -174,7 +174,7 @@ class LocalThreadStore {
|
|
|
174
174
|
}
|
|
175
175
|
updateRun(runId, threadId, status) {
|
|
176
176
|
const now = new Date().toISOString();
|
|
177
|
-
const normalizedStatus = (0,
|
|
177
|
+
const normalizedStatus = (0, superai_contracts_1.normalizeRunStatus)(status);
|
|
178
178
|
const existing = this.db.prepare('SELECT id FROM runs WHERE id = ?').get(runId);
|
|
179
179
|
if (existing) {
|
|
180
180
|
this.db.prepare('UPDATE runs SET status = ?, updated_at = ? WHERE id = ?').run(normalizedStatus, now, runId);
|
|
@@ -193,7 +193,7 @@ class LocalThreadStore {
|
|
|
193
193
|
ORDER BY updated_at DESC
|
|
194
194
|
LIMIT 1
|
|
195
195
|
`).get(threadId);
|
|
196
|
-
return row ? { ...row, status: (0,
|
|
196
|
+
return row ? { ...row, status: (0, superai_contracts_1.normalizeRunStatus)(row.status) } : undefined;
|
|
197
197
|
}
|
|
198
198
|
getRun(runId) {
|
|
199
199
|
const row = this.db.prepare(`
|
|
@@ -201,7 +201,7 @@ class LocalThreadStore {
|
|
|
201
201
|
FROM runs
|
|
202
202
|
WHERE id = ?
|
|
203
203
|
`).get(runId);
|
|
204
|
-
return row ? { ...row, status: (0,
|
|
204
|
+
return row ? { ...row, status: (0, superai_contracts_1.normalizeRunStatus)(row.status) } : undefined;
|
|
205
205
|
}
|
|
206
206
|
getRow(threadId) {
|
|
207
207
|
return this.db.prepare(`
|
|
@@ -4,9 +4,9 @@ exports.normalizePermissionAction = normalizePermissionAction;
|
|
|
4
4
|
exports.normalizePermissionOptionAction = normalizePermissionOptionAction;
|
|
5
5
|
exports.formatToolCallContent = formatToolCallContent;
|
|
6
6
|
exports.toPermissionButtonRows = toPermissionButtonRows;
|
|
7
|
-
const
|
|
7
|
+
const superai_contracts_1 = require("../../../../packages/contracts/src/index.js");
|
|
8
8
|
function normalizePermissionAction(kind) {
|
|
9
|
-
return (0,
|
|
9
|
+
return (0, superai_contracts_1.normalizePermissionResponse)(kind) || '';
|
|
10
10
|
}
|
|
11
11
|
function normalizePermissionOptionAction(option) {
|
|
12
12
|
const fields = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.claudeCodeAgentDefinition = void 0;
|
|
4
|
-
const
|
|
4
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
5
5
|
const launch_utils_js_1 = require("../shared/launch-utils.js");
|
|
6
6
|
const behavior_js_1 = require("./behavior.js");
|
|
7
7
|
exports.claudeCodeAgentDefinition = {
|
|
@@ -13,7 +13,7 @@ exports.claudeCodeAgentDefinition = {
|
|
|
13
13
|
versionArgs: ['--version'],
|
|
14
14
|
bundledRuntimes: [
|
|
15
15
|
{
|
|
16
|
-
packageName:
|
|
16
|
+
packageName: superai_contracts_1.DESKTOP_CLAUDECODE_ACP_PACKAGE,
|
|
17
17
|
candidates: [
|
|
18
18
|
'dist/cli.js',
|
|
19
19
|
'bin/claude-agent-acp.js',
|
|
@@ -23,7 +23,7 @@ exports.claudeCodeAgentDefinition = {
|
|
|
23
23
|
],
|
|
24
24
|
},
|
|
25
25
|
buildLaunchConfig(input) {
|
|
26
|
-
const bundled = (0, launch_utils_js_1.resolveBundledAcpCommand)(
|
|
26
|
+
const bundled = (0, launch_utils_js_1.resolveBundledAcpCommand)(superai_contracts_1.DESKTOP_CLAUDECODE_ACP_PACKAGE, 'claude-agent-acp');
|
|
27
27
|
return {
|
|
28
28
|
...bundled,
|
|
29
29
|
env: input.model
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.codexAgentDefinition = void 0;
|
|
4
|
-
const
|
|
4
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
5
5
|
const launch_utils_js_1 = require("../shared/launch-utils.js");
|
|
6
6
|
const behavior_js_1 = require("./behavior.js");
|
|
7
7
|
exports.codexAgentDefinition = {
|
|
@@ -13,12 +13,12 @@ exports.codexAgentDefinition = {
|
|
|
13
13
|
versionArgs: ['--version'],
|
|
14
14
|
bundledRuntimes: [
|
|
15
15
|
{
|
|
16
|
-
packageName:
|
|
16
|
+
packageName: superai_contracts_1.DESKTOP_CODEX_ACP_PACKAGE,
|
|
17
17
|
candidates: ['bin/codex-acp.js'],
|
|
18
18
|
},
|
|
19
19
|
],
|
|
20
20
|
},
|
|
21
21
|
buildLaunchConfig() {
|
|
22
|
-
return (0, launch_utils_js_1.resolveBundledAcpCommand)(
|
|
22
|
+
return (0, launch_utils_js_1.resolveBundledAcpCommand)(superai_contracts_1.DESKTOP_CODEX_ACP_PACKAGE, 'codex-acp');
|
|
23
23
|
},
|
|
24
24
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localCoreAcpAgentDefinition = void 0;
|
|
4
|
-
const
|
|
4
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
5
5
|
const behavior_js_1 = require("./behavior.js");
|
|
6
6
|
exports.localCoreAcpAgentDefinition = {
|
|
7
|
-
agentType:
|
|
7
|
+
agentType: superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
8
8
|
aliases: ['acp', ''],
|
|
9
9
|
displayName: 'LocalCore ACP',
|
|
10
10
|
behavior: behavior_js_1.localCoreAcpBehavior,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.localCoreAcpAgentDefinition = exports.localCoreAcpBehavior = void 0;
|
|
4
4
|
exports.createBuiltinLocalCoreAcpAgentPlugin = createBuiltinLocalCoreAcpAgentPlugin;
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
const agent_plugin_js_1 = require("../shared/agent-plugin.js");
|
|
7
7
|
const behavior_js_1 = require("./behavior.js");
|
|
8
8
|
Object.defineProperty(exports, "localCoreAcpBehavior", { enumerable: true, get: function () { return behavior_js_1.localCoreAcpBehavior; } });
|
|
@@ -11,14 +11,14 @@ Object.defineProperty(exports, "localCoreAcpAgentDefinition", { enumerable: true
|
|
|
11
11
|
function createBuiltinLocalCoreAcpAgentPlugin() {
|
|
12
12
|
const plugin = (0, agent_plugin_js_1.createBuiltinAgentPlugin)({
|
|
13
13
|
definition: definition_js_1.localCoreAcpAgentDefinition,
|
|
14
|
-
match: (normalizedAgentType) => !normalizedAgentType || normalizedAgentType === 'acp' || normalizedAgentType ===
|
|
14
|
+
match: (normalizedAgentType) => !normalizedAgentType || normalizedAgentType === 'acp' || normalizedAgentType === superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
15
15
|
});
|
|
16
16
|
plugin.capabilities = {
|
|
17
17
|
...plugin.capabilities,
|
|
18
18
|
channels: [
|
|
19
19
|
{
|
|
20
|
-
id: `channel.${
|
|
21
|
-
platform:
|
|
20
|
+
id: `channel.${superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE}`,
|
|
21
|
+
platform: superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
22
22
|
displayName: 'LocalCore ACP',
|
|
23
23
|
},
|
|
24
24
|
],
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveOpencodeModel = resolveOpencodeModel;
|
|
4
4
|
exports.buildOpencodeLaunchConfig = buildOpencodeLaunchConfig;
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
const launch_utils_js_1 = require("../shared/launch-utils.js");
|
|
7
7
|
function resolveOpencodeModel(input) {
|
|
8
8
|
const configuredProviderModel = getFirstProviderModelRef(input.providers);
|
|
9
9
|
if (configuredProviderModel &&
|
|
10
|
-
(!input.rawModel || input.normalizedModel ===
|
|
10
|
+
(!input.rawModel || input.normalizedModel === superai_contracts_1.DEFAULT_DESKTOP_OPENCODE_MODEL)) {
|
|
11
11
|
return configuredProviderModel;
|
|
12
12
|
}
|
|
13
13
|
return input.normalizedModel;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.piAgentDefinition = void 0;
|
|
4
|
-
const
|
|
4
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
5
5
|
const behavior_js_1 = require("./behavior.js");
|
|
6
6
|
const launch_js_1 = require("./launch.js");
|
|
7
7
|
exports.piAgentDefinition = {
|
|
@@ -13,7 +13,7 @@ exports.piAgentDefinition = {
|
|
|
13
13
|
versionArgs: ['--version'],
|
|
14
14
|
bundledRuntimes: [
|
|
15
15
|
{
|
|
16
|
-
packageName:
|
|
16
|
+
packageName: superai_contracts_1.DESKTOP_PI_CODING_AGENT_PACKAGE,
|
|
17
17
|
candidates: ['dist/cli.js'],
|
|
18
18
|
},
|
|
19
19
|
],
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvePiModel = resolvePiModel;
|
|
4
4
|
exports.buildPiLaunchConfig = buildPiLaunchConfig;
|
|
5
|
-
const
|
|
5
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
6
6
|
const launch_utils_js_1 = require("../shared/launch-utils.js");
|
|
7
7
|
const provider_materializer_js_1 = require("./provider-materializer.js");
|
|
8
8
|
function resolvePiModel(input) {
|
|
9
9
|
return input.rawModel || (0, launch_utils_js_1.getFirstProviderModelId)(input.providers);
|
|
10
10
|
}
|
|
11
11
|
function buildPiLaunchConfig(input) {
|
|
12
|
-
const bundledPiAcp = (0, launch_utils_js_1.resolveBundledAcpCommand)(
|
|
13
|
-
const bundledPiCommand = (0, launch_utils_js_1.resolveBundledBinCommand)(
|
|
12
|
+
const bundledPiAcp = (0, launch_utils_js_1.resolveBundledAcpCommand)(superai_contracts_1.DESKTOP_PI_ACP_PACKAGE, 'pi-acp');
|
|
13
|
+
const bundledPiCommand = (0, launch_utils_js_1.resolveBundledBinCommand)(superai_contracts_1.DESKTOP_PI_CODING_AGENT_PACKAGE, 'pi');
|
|
14
14
|
return {
|
|
15
15
|
command: bundledPiAcp.command,
|
|
16
16
|
args: [...bundledPiAcp.args],
|
|
@@ -31,7 +31,7 @@ function writePiProviderRuntimeConfig(input) {
|
|
|
31
31
|
return {};
|
|
32
32
|
}
|
|
33
33
|
const { providerId, modelId } = resolvePiProviderModel(input.providers, input.model);
|
|
34
|
-
const agentDir = (0, launch_utils_js_1.projectLocalStateDir)(input.configState, '.pi-agent', input.project.name);
|
|
34
|
+
const agentDir = (0, launch_utils_js_1.projectLocalStateDir)(input.configState, '.pi-agent', input.project.workspace_id || input.project.name);
|
|
35
35
|
(0, launch_utils_js_1.ensurePrivateDir)(agentDir);
|
|
36
36
|
const auth = {};
|
|
37
37
|
const modelProviders = {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createBuiltinAgentPlugin = createBuiltinAgentPlugin;
|
|
4
|
-
const
|
|
4
|
+
const superai_contracts_1 = require("../../../../../packages/contracts/src/index.js");
|
|
5
5
|
const workspace_route_config_js_1 = require("../../router/workspace-route-config.js");
|
|
6
6
|
function createRuntime(agentType, match, displayName) {
|
|
7
7
|
return {
|
|
8
8
|
agentType,
|
|
9
|
-
transport:
|
|
9
|
+
transport: superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
10
10
|
displayName: displayName || agentType,
|
|
11
11
|
matchesProject(project) {
|
|
12
12
|
const normalizedAgentType = String(project.agent?.type || '').trim().toLowerCase();
|
|
@@ -17,9 +17,9 @@ function createRuntime(agentType, match, displayName) {
|
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
|
-
kind:
|
|
20
|
+
kind: superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
21
21
|
agentType,
|
|
22
|
-
transport:
|
|
22
|
+
transport: superai_contracts_1.LOCALCORE_ACP_AGENT_TYPE,
|
|
23
23
|
config: {
|
|
24
24
|
...(0, workspace_route_config_js_1.toLocalCoreProjectConfig)(configState, project),
|
|
25
25
|
agentType,
|
package/dist-electron/services/local-ai-core/src/automation/automation-conversation-executor.js
CHANGED
|
@@ -4,7 +4,8 @@ exports.AutomationConversationExecutor = void 0;
|
|
|
4
4
|
exports.renderMonitorPrompt = renderMonitorPrompt;
|
|
5
5
|
const scheduled_bridge_session_js_1 = require("../scheduler/scheduled-bridge-session.js");
|
|
6
6
|
const scheduled_job_route_js_1 = require("../scheduler/scheduled-job-route.js");
|
|
7
|
-
const
|
|
7
|
+
const run_polling_js_1 = require("../scheduler/run-polling.js");
|
|
8
|
+
const thread_resolution_js_1 = require("../scheduler/thread-resolution.js");
|
|
8
9
|
const MONITOR_RUN_PERMISSION_MODE = 'bypassPermissions';
|
|
9
10
|
class AutomationConversationExecutor {
|
|
10
11
|
options;
|
|
@@ -36,9 +37,9 @@ class AutomationConversationExecutor {
|
|
|
36
37
|
try {
|
|
37
38
|
const sendResult = await workspaceRouter.sendThreadMessage(threadId, prompt, {
|
|
38
39
|
permissionMode: MONITOR_RUN_PERMISSION_MODE,
|
|
39
|
-
runtimeEnv:
|
|
40
|
+
runtimeEnv: (0, scheduled_job_route_js_1.buildPlatformRuntimeEnv)(monitor.platform, monitor.route),
|
|
40
41
|
});
|
|
41
|
-
await this.
|
|
42
|
+
await (0, run_polling_js_1.waitForRunCompletion)(this.options.store, sendResult.runId, timeoutMs, 'Monitor');
|
|
42
43
|
const thread = await workspaceRouter.getThread(threadId);
|
|
43
44
|
const replyText = [...thread.messages]
|
|
44
45
|
.reverse()
|
|
@@ -61,10 +62,10 @@ class AutomationConversationExecutor {
|
|
|
61
62
|
const workspaceRouter = this.options.getWorkspaceRouter();
|
|
62
63
|
if (monitor.executionMode === 'same-thread') {
|
|
63
64
|
const binding = this.options.store.getPlatformThreadBinding(monitor.workspaceId, monitor.route.channelId, monitor.route.participantId || '', monitor.platform);
|
|
64
|
-
if (binding?.thread_id && await
|
|
65
|
+
if (binding?.thread_id && await (0, thread_resolution_js_1.threadExists)(workspaceRouter, binding.thread_id)) {
|
|
65
66
|
return binding.thread_id;
|
|
66
67
|
}
|
|
67
|
-
if (monitor.route.threadId && await
|
|
68
|
+
if (monitor.route.threadId && await (0, thread_resolution_js_1.threadExists)(workspaceRouter, monitor.route.threadId)) {
|
|
68
69
|
return monitor.route.threadId;
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -79,48 +80,6 @@ class AutomationConversationExecutor {
|
|
|
79
80
|
const created = await workspaceRouter.createThread(monitor.workspaceId, title);
|
|
80
81
|
return created.id;
|
|
81
82
|
}
|
|
82
|
-
async threadExists(threadId) {
|
|
83
|
-
try {
|
|
84
|
-
await this.options.getWorkspaceRouter().getThread(threadId);
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
catch {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
buildRuntimeEnv(monitor) {
|
|
92
|
-
const basePlatform = (0, scheduled_job_route_js_1.getChannelPlatformBase)(monitor.platform);
|
|
93
|
-
const env = {};
|
|
94
|
-
if (basePlatform && basePlatform !== 'local') {
|
|
95
|
-
env.LOCAL_AI_PLATFORM = basePlatform;
|
|
96
|
-
env.LOCAL_AI_ROUTE_TYPE = (0, scheduled_job_route_js_1.routeTypeForPlatform)(monitor.platform);
|
|
97
|
-
}
|
|
98
|
-
const instanceId = monitor.route.instanceId || (0, scheduled_job_route_js_1.getChannelPlatformInstanceId)(monitor.platform);
|
|
99
|
-
if (instanceId) {
|
|
100
|
-
env.LOCAL_AI_PLATFORM_INSTANCE_ID = instanceId;
|
|
101
|
-
}
|
|
102
|
-
if (monitor.route.channelId) {
|
|
103
|
-
env.LOCAL_AI_CHAT_ID = monitor.route.channelId;
|
|
104
|
-
}
|
|
105
|
-
if (monitor.route.participantId) {
|
|
106
|
-
env.LOCAL_AI_PLATFORM_USER_ID = monitor.route.participantId;
|
|
107
|
-
}
|
|
108
|
-
return env;
|
|
109
|
-
}
|
|
110
|
-
async waitForRun(runId, timeoutMs) {
|
|
111
|
-
const startedAt = Date.now();
|
|
112
|
-
while (Date.now() - startedAt < timeoutMs) {
|
|
113
|
-
const run = this.options.store.getRun(runId);
|
|
114
|
-
if (run && TERMINAL_RUN_STATES.has(run.status)) {
|
|
115
|
-
if (run.status !== 'completed') {
|
|
116
|
-
throw new Error(`Monitor run finished with status ${run.status}`);
|
|
117
|
-
}
|
|
118
|
-
return run;
|
|
119
|
-
}
|
|
120
|
-
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
121
|
-
}
|
|
122
|
-
throw new Error(`Timed out waiting for monitor run ${runId}`);
|
|
123
|
-
}
|
|
124
83
|
}
|
|
125
84
|
exports.AutomationConversationExecutor = AutomationConversationExecutor;
|
|
126
85
|
function renderMonitorPrompt(template, event, monitor) {
|
|
@@ -5,6 +5,7 @@ const scheduled_job_route_js_1 = require("../scheduler/scheduled-job-route.js");
|
|
|
5
5
|
const condition_evaluator_js_1 = require("./condition-evaluator.js");
|
|
6
6
|
const automation_conversation_executor_js_1 = require("./automation-conversation-executor.js");
|
|
7
7
|
const automation_monitor_repository_js_1 = require("./automation-monitor-repository.js");
|
|
8
|
+
const monitor_id_js_1 = require("./monitor-id.js");
|
|
8
9
|
class AutomationMonitorService {
|
|
9
10
|
options;
|
|
10
11
|
timer = null;
|
|
@@ -278,7 +279,7 @@ class AutomationMonitorService {
|
|
|
278
279
|
}
|
|
279
280
|
const matches = this.repository
|
|
280
281
|
.list()
|
|
281
|
-
.filter((monitor) =>
|
|
282
|
+
.filter((monitor) => (0, monitor_id_js_1.toPublicAutomationMonitorId)(monitor.id) === monitorId);
|
|
282
283
|
if (matches.length === 0) {
|
|
283
284
|
return '';
|
|
284
285
|
}
|
|
@@ -353,7 +354,3 @@ class AutomationMonitorService {
|
|
|
353
354
|
}
|
|
354
355
|
}
|
|
355
356
|
exports.AutomationMonitorService = AutomationMonitorService;
|
|
356
|
-
function publicMonitorId(monitorId) {
|
|
357
|
-
const normalized = monitorId.startsWith('monitor:') ? monitorId.slice('monitor:'.length) : monitorId;
|
|
358
|
-
return normalized.includes('-') ? normalized.split('-')[0] || normalized : normalized;
|
|
359
|
-
}
|