@xopcai/xopc 0.0.195 → 0.0.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DkYgzssq.js → agent-avatar-dicebear-C5st7lt5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Baxfj44y.js +68 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DVXLietl.js → app-management-settings-panel-S8LhoD6G.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-D7oohrYf.js → appearance-settings-D8Cd5vDP.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-0uCxKyE5.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CpBzHKzI.js → archive-plugin-qL07mwnY.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DMWXe12h.js → attachment-load-CqSobpdi.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-XyDat125.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BM0MgsHB.js → binary-plugins-DBRPyLYE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C2MT7mG3.js → block-editor-6wG1LU7t.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-CrYNMR4w.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-V01qhcZc.js → browser-workflow-inputs-Abil4puY.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DPmSKVWx.js → browser-workflows-page-BEu3E0et.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CvMcDhGf.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-CHJDY-Ih.js +3 -0
- package/dist/gateway/static/root/assets/channels-settings-Ds9BJbcY.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-CgWjgPSI.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-NUs-Zf7F.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-5SqAw4UD.js → cron-expression-ZdDBAoqA.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-eiaYMDYI.js → dependency-picker-BGeB1jpn.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BtfzkmnU.js → desktop-pet-CsLR4pWB.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Dn3hnBOU.js → desktop-pet-settings-CCjT1bdo.js} +1 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-C-Te1QN3.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-EWu0uOpw.js → extension-debug-page-CD73euAM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-2qZ7ngqL.js → extension-page-DAKjpNwd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-4MOAwYPT.js → extension-settings-page-BLSNdlgd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-aqPj1HAI.js → gateway-config-api-CQrf0k3D.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-BbQBgKWH.js → gateway-settings-CvgH8IJI.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-DXtG-Sy0.js → heartbeat-settings-SPpnqbjl.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BFoD6047.js +3 -0
- package/dist/gateway/static/root/assets/index-84ys9u-K.js +152 -0
- package/dist/gateway/static/root/assets/index-D-srnucP.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-WKmsr5WD.js → keyboard-shortcuts-settings-HMhxgOuD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D5uL2_Fd.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-3-aNfJwB.js → local-apps-page-DIWkFa3g.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page--6v8qq6y.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-D8vbsfLm.js → management-settings-DtEuS-kR.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-DRFl6Vfw.js → markdown-split-DvVBewS4.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C5J46ROp.js → media-plugins-YVj7NVzD.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-Z0lEBC-X.js → notes-page-BDzuL2I9.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-IdjuNXvH.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-Dyj6Snbu.js → page-tabs-7bSEWfSX.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-CPDM4F7n.js → preview-open-alternatives-tgLbHgcV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-8RFhWmcU.js → product-open-page-Bwx_CQht.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DnJXSuM4.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DckZKlBI.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CfbUHBUH.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BBgWkYk0.js → runtime-tools-settings-panel-Fe05Nus6.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BJqF0l7i.js → schema-form-CFfyC4CB.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-BCfCh4My.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cbi4FvzO.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CYL5uBzc.js → settings-form-section-gEnEYT_3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BabbixC0.js → settings-loading-skeleton-BRE_-7Da.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B7OH9I8A.js → settings-page-C1zxCpqB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D9X3eVDo.js → settings-page-layout-CRpXF_05.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BHdz-BO7.js → setup-status-panel-BcHdpmFf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CMuJZ5Qq.js → share-preview-page-DU8L68A5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-kjTqH9yY.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-QAGpwzIM.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C9U1pIT-.js → skills-page-lE1-YRdK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-C3iaLgk9.js → skills-page.utils-CYwFWTso.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CAN01aY0.js → system-settings-panel-CVDsiPKn.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DsM13-cy.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-C9FMLeH2.js → typed-models-lib-DelyYgoc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-AAZNoD6t.js → use-autosave-C50Mq5yQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-D-VEOt2A.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-yLXEYgwV.js → voice-api-key-field-DYfgTe3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-tbkbg-8l.js → work-discovery-overlay-DPbujsp3.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-D77opady.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJHOxj4Z.js → workflow-run-setup-panel-DqIb1oBB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-B9-PLmlX.js +5 -0
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +2 -0
- package/dist/src/agent/embedded/execution-context.js +11 -0
- package/dist/src/agent/embedded/index.d.ts +3 -1
- package/dist/src/agent/embedded/index.js +5 -3
- package/dist/src/agent/embedded/run-turn.js +15 -9
- package/dist/src/agent/embedded/session-runner.d.ts +6 -11
- package/dist/src/agent/embedded/session-runner.js +25 -36
- package/dist/src/agent/embedded/transcript-runtime.d.ts +35 -0
- package/dist/src/agent/embedded/transcript-runtime.js +66 -0
- package/dist/src/agent/embedded/types.d.ts +3 -1
- package/dist/src/agent/service.d.ts +15 -0
- package/dist/src/agent/service.js +30 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/home.d.ts +1 -1
- package/dist/src/gateway/hono/routes/home.js +2 -2
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/projects.js +12 -1
- package/dist/src/gateway/hono/routes/side-chats.d.ts +3 -0
- package/dist/src/gateway/hono/routes/side-chats.js +173 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +5 -1
- package/dist/src/gateway/service/agent-runner.d.ts +4 -0
- package/dist/src/gateway/service/agent-runner.js +15 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -0
- package/dist/src/gateway/service.js +33 -7
- package/dist/src/gateway/side-chat/context-snapshot.d.ts +11 -0
- package/dist/src/gateway/side-chat/context-snapshot.js +108 -0
- package/dist/src/gateway/side-chat/index.d.ts +5 -0
- package/dist/src/gateway/side-chat/index.js +4 -0
- package/dist/src/gateway/side-chat/manager.d.ts +45 -0
- package/dist/src/gateway/side-chat/manager.js +198 -0
- package/dist/src/gateway/side-chat/run-service.d.ts +22 -0
- package/dist/src/gateway/side-chat/run-service.js +110 -0
- package/dist/src/gateway/side-chat/types.d.ts +61 -0
- package/dist/src/gateway/side-chat/types.js +1 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/routing/session-key-utils.d.ts +0 -1
- package/dist/src/routing/session-key-utils.js +1 -6
- package/dist/src/routing/session-key.js +2 -2
- package/dist/src/tasks/home-query-service.d.ts +24 -0
- package/dist/src/tasks/home-query-service.js +284 -5
- package/dist/src/tasks/index.js +3 -3
- package/dist/src/tasks/project-operating-view-service.d.ts +2 -1
- package/dist/src/tasks/project-operating-view-service.js +27 -4
- package/dist/src/user-context/sources/activity-clustering.js +1 -1
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -0
- package/dist/src/user-context/sources/repository.js +4 -1
- package/dist/src/work-discovery/analyzer.js +8 -8
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-COX-ZLtY.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-S52mdBX_.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-DGGJQO9B.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-C_tkW-L_.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CPu6MIHF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-ttuWLoiJ.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DrWWVQjj.js +0 -1
- package/dist/gateway/static/root/assets/connectors-api-CG0UqhPN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CyfIrY2l.js +0 -2
- package/dist/gateway/static/root/assets/directory-picker-path-field-Wa5zFvbb.js +0 -1
- package/dist/gateway/static/root/assets/home-page-k21J7B1q.js +0 -3
- package/dist/gateway/static/root/assets/index-DtEVsSU1.css +0 -1
- package/dist/gateway/static/root/assets/index-peR_-O6U.js +0 -150
- package/dist/gateway/static/root/assets/local-app-workbench-page-r8wlEj3A.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-OU3uRCoz.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-B74ylIVP.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-3ugVthse.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-VVAyOeRA.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C6XqOPzA.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BMj-t4hX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B7WvJXGJ.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-B0F1jbhj.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Dnpq03tO.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bs5oS-wN.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CRY8IE-7.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-Dtqgvs_0.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-BBjCNaXn.js +0 -5
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { abortEmbeddedRun } from "../../agent/embedded/runs.js";
|
|
4
|
+
import { SideChatError } from "./manager.js";
|
|
5
|
+
import { ChatStreamMapper } from "../chat-stream/mapper.js";
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
//#region src/gateway/side-chat/run-service.ts
|
|
8
|
+
init_logger();
|
|
9
|
+
const log = createLogger("Gateway:SideChatRun");
|
|
10
|
+
var SideChatRunService = class {
|
|
11
|
+
activeBySideChat = /* @__PURE__ */ new Map();
|
|
12
|
+
constructor(options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
}
|
|
15
|
+
submit(sideChatId, clientInstanceId, content) {
|
|
16
|
+
const text = content.trim();
|
|
17
|
+
if (!text) throw new SideChatError("content is required", "INVALID_REQUEST");
|
|
18
|
+
const sideChat = this.options.manager.get(sideChatId, clientInstanceId);
|
|
19
|
+
if (this.activeBySideChat.has(sideChatId)) throw new SideChatError("A side chat run is already active", "CONFLICT");
|
|
20
|
+
const run = {
|
|
21
|
+
sideChatId,
|
|
22
|
+
clientInstanceId,
|
|
23
|
+
executionSessionKey: this.options.manager.getRuntime(sideChatId, clientInstanceId).runtimeId,
|
|
24
|
+
runId: randomUUID(),
|
|
25
|
+
abortController: new AbortController()
|
|
26
|
+
};
|
|
27
|
+
this.activeBySideChat.set(sideChatId, run);
|
|
28
|
+
this.options.manager.setStatus(sideChatId, clientInstanceId, "running");
|
|
29
|
+
this.execute(run, text, sideChat.config).catch((err) => {
|
|
30
|
+
log.error({
|
|
31
|
+
err,
|
|
32
|
+
sideChatId,
|
|
33
|
+
runId: run.runId
|
|
34
|
+
}, "Side chat run cleanup failed");
|
|
35
|
+
});
|
|
36
|
+
return { runId: run.runId };
|
|
37
|
+
}
|
|
38
|
+
async abort(sideChatId, clientInstanceId, runId) {
|
|
39
|
+
this.options.manager.get(sideChatId, clientInstanceId);
|
|
40
|
+
const active = this.activeBySideChat.get(sideChatId);
|
|
41
|
+
if (!active || runId && active.runId !== runId) return false;
|
|
42
|
+
this.options.agentRunner.cancelClarificationForRun(active.runId);
|
|
43
|
+
active.abortController.abort();
|
|
44
|
+
await abortEmbeddedRun(active.executionSessionKey).catch(() => false);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
async dispose(sideChatId, clientInstanceId) {
|
|
48
|
+
await this.abort(sideChatId, clientInstanceId).catch(() => false);
|
|
49
|
+
return this.options.manager.dispose(sideChatId, clientInstanceId);
|
|
50
|
+
}
|
|
51
|
+
submitClarification(sideChatId, clientInstanceId, requestId, answer) {
|
|
52
|
+
this.options.manager.get(sideChatId, clientInstanceId);
|
|
53
|
+
return this.options.agentRunner.submitClarifyResponse(requestId, answer);
|
|
54
|
+
}
|
|
55
|
+
async execute(run, content, config) {
|
|
56
|
+
const topic = `run:${run.runId}`;
|
|
57
|
+
const mapper = new ChatStreamMapper({
|
|
58
|
+
runId: run.runId,
|
|
59
|
+
sessionKey: run.sideChatId,
|
|
60
|
+
channel: "side-chat"
|
|
61
|
+
});
|
|
62
|
+
const publish = (event) => {
|
|
63
|
+
this.options.publishRealtime(topic, event.type, event);
|
|
64
|
+
};
|
|
65
|
+
const publishMapped = (event) => {
|
|
66
|
+
for (const mapped of mapper.map(event)) publish(mapped);
|
|
67
|
+
};
|
|
68
|
+
try {
|
|
69
|
+
for (const event of mapper.start()) publish(event);
|
|
70
|
+
publishMapped({
|
|
71
|
+
type: "user_message",
|
|
72
|
+
message: {
|
|
73
|
+
role: "user",
|
|
74
|
+
content,
|
|
75
|
+
timestamp: Date.now()
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
this.options.agentRunner.registerExternalWebchatRun(run.executionSessionKey, run.runId, (event) => publishMapped(event));
|
|
79
|
+
const result = await this.options.getAgentService().runEphemeralTurn({
|
|
80
|
+
executionSessionKey: run.executionSessionKey,
|
|
81
|
+
parentSessionKey: this.options.manager.get(run.sideChatId, run.clientInstanceId).parentSessionKey,
|
|
82
|
+
runId: run.runId,
|
|
83
|
+
content,
|
|
84
|
+
modelRef: config.modelRef,
|
|
85
|
+
thinkingLevel: config.thinkingLevel,
|
|
86
|
+
transcriptRuntime: this.options.manager.getRuntime(run.sideChatId, run.clientInstanceId),
|
|
87
|
+
abortSignal: run.abortController.signal,
|
|
88
|
+
onEvent: publishMapped
|
|
89
|
+
});
|
|
90
|
+
const cancelled = run.abortController.signal.aborted;
|
|
91
|
+
const status = cancelled ? "cancelled" : result.ok ? "success" : "error";
|
|
92
|
+
if (!result.ok && result.errorMessage) for (const event of mapper.error(result.errorMessage)) publish(event);
|
|
93
|
+
for (const event of mapper.end(status, cancelled ? "Interrupted" : result.errorMessage)) publish(event);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
96
|
+
for (const event of mapper.error(message)) publish(event);
|
|
97
|
+
for (const event of mapper.end("error", message)) publish(event);
|
|
98
|
+
} finally {
|
|
99
|
+
this.options.agentRunner.unregisterExternalWebchatRun(run.executionSessionKey, run.runId);
|
|
100
|
+
this.activeBySideChat.delete(run.sideChatId);
|
|
101
|
+
try {
|
|
102
|
+
this.options.manager.getMessages(run.sideChatId, run.clientInstanceId);
|
|
103
|
+
this.options.manager.setStatus(run.sideChatId, run.clientInstanceId, "idle");
|
|
104
|
+
} catch {}
|
|
105
|
+
this.options.completeRealtimeTopic(topic);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { SideChatRunService };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ThinkingLevel } from '@earendil-works/pi-agent-core';
|
|
2
|
+
export type SideChatStatus = 'idle' | 'running' | 'waiting-approval' | 'waiting-input' | 'closing';
|
|
3
|
+
export type SideChatSelection = {
|
|
4
|
+
id: string;
|
|
5
|
+
type: 'message';
|
|
6
|
+
messageId: string;
|
|
7
|
+
role: string;
|
|
8
|
+
content: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
} | {
|
|
11
|
+
id: string;
|
|
12
|
+
type: 'text';
|
|
13
|
+
text: string;
|
|
14
|
+
sourceMessageId?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
} | {
|
|
17
|
+
id: string;
|
|
18
|
+
type: 'file-range';
|
|
19
|
+
path: string;
|
|
20
|
+
startLine: number;
|
|
21
|
+
endLine: number;
|
|
22
|
+
text: string;
|
|
23
|
+
contentHash?: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
} | {
|
|
26
|
+
id: string;
|
|
27
|
+
type: 'diff';
|
|
28
|
+
diff: string;
|
|
29
|
+
path?: string;
|
|
30
|
+
label?: string;
|
|
31
|
+
};
|
|
32
|
+
export interface SideChatContextSnapshot {
|
|
33
|
+
parentSessionKey: string;
|
|
34
|
+
parentSessionId: string;
|
|
35
|
+
parentMessageCount: number;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
selections: SideChatSelection[];
|
|
38
|
+
contentHash: string;
|
|
39
|
+
}
|
|
40
|
+
export interface SideChatConfig {
|
|
41
|
+
modelRef: string;
|
|
42
|
+
thinkingLevel?: ThinkingLevel;
|
|
43
|
+
}
|
|
44
|
+
export interface SideChatView {
|
|
45
|
+
id: string;
|
|
46
|
+
parentSessionKey: string;
|
|
47
|
+
clientInstanceId: string;
|
|
48
|
+
status: SideChatStatus;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
lastActiveAt: string;
|
|
51
|
+
expiresAt: string;
|
|
52
|
+
messageCount: number;
|
|
53
|
+
context: SideChatContextSnapshot;
|
|
54
|
+
config: SideChatConfig;
|
|
55
|
+
}
|
|
56
|
+
export interface CreateSideChatInput {
|
|
57
|
+
parentSessionKey: string;
|
|
58
|
+
clientInstanceId: string;
|
|
59
|
+
selections?: SideChatSelection[];
|
|
60
|
+
config?: Partial<SideChatConfig>;
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -14,7 +14,6 @@ export type RawSessionConversationRef = {
|
|
|
14
14
|
};
|
|
15
15
|
/** Parse `agent:{agentId}:{rest}` session keys (OpenClaw canonical form). */
|
|
16
16
|
export declare function parseAgentSessionKey(sessionKey: string | undefined | null): ParsedAgentSessionKey | null;
|
|
17
|
-
export declare function isCronRunSessionKey(sessionKey: string | undefined | null): boolean;
|
|
18
17
|
export declare function isCronSessionKey(sessionKey: string | undefined | null): boolean;
|
|
19
18
|
export declare function isSubagentSessionKey(sessionKey: string | undefined | null): boolean;
|
|
20
19
|
export declare function getSubagentDepth(sessionKey: string | undefined | null): number;
|
|
@@ -16,11 +16,6 @@ function parseAgentSessionKey(sessionKey) {
|
|
|
16
16
|
rest
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function isCronRunSessionKey(sessionKey) {
|
|
20
|
-
const parsed = parseAgentSessionKey(sessionKey);
|
|
21
|
-
if (!parsed) return false;
|
|
22
|
-
return /^cron:[^:]+:run:[^:]+$/.test(parsed.rest);
|
|
23
|
-
}
|
|
24
19
|
function isCronSessionKey(sessionKey) {
|
|
25
20
|
const parsed = parseAgentSessionKey(sessionKey);
|
|
26
21
|
if (!parsed) return false;
|
|
@@ -87,4 +82,4 @@ var init_session_key_utils = __esmMin((() => {
|
|
|
87
82
|
}));
|
|
88
83
|
//#endregion
|
|
89
84
|
init_session_key_utils();
|
|
90
|
-
export { getSubagentDepth, init_session_key_utils, isAcpSessionKey,
|
|
85
|
+
export { getSubagentDepth, init_session_key_utils, isAcpSessionKey, isCronSessionKey, isSubagentSessionKey, parseAgentSessionKey, parseRawSessionConversationRef, parseThreadSessionSuffix, resolveThreadParentSessionKey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId, normalizeOptionalAccountId } from "./account-id.js";
|
|
3
|
-
import { getSubagentDepth, init_session_key_utils, isAcpSessionKey,
|
|
3
|
+
import { getSubagentDepth, init_session_key_utils, isAcpSessionKey, isCronSessionKey, isSubagentSessionKey, parseAgentSessionKey, parseRawSessionConversationRef, parseThreadSessionSuffix, resolveThreadParentSessionKey } from "./session-key-utils.js";
|
|
4
4
|
import { DEFAULT_AGENT_ID, DEFAULT_MAIN_KEY, assertAgentSessionKey, buildAgentMainSessionKey, buildAgentPeerSessionKey, buildGroupHistoryKey, classifySessionKeyShape, defaultMainSessionKey, init_agent_session_key, isValidAgentId, normalizeAgentId, normalizeMainKey, normalizeSessionKey, resolveAgentIdFromSessionKey, resolveThreadSessionKeys, sanitizeAgentId, scopedHeartbeatWakeOptions, toAgentRequestSessionKey, toAgentStoreSessionKey } from "./agent-session-key.js";
|
|
5
5
|
//#region src/routing/session-key.ts
|
|
6
6
|
function sanitizeSegment(value, options) {
|
|
@@ -188,4 +188,4 @@ var init_session_key = __esmMin((() => {
|
|
|
188
188
|
}));
|
|
189
189
|
//#endregion
|
|
190
190
|
init_session_key();
|
|
191
|
-
export { DEFAULT_ACCOUNT_ID, DEFAULT_AGENT_ID, DEFAULT_MAIN_KEY, assertAgentSessionKey, buildAgentMainSessionKey, buildAgentPeerSessionKey, buildGroupHistoryKey, buildSessionKey, buildSubagentSessionKey, classifySessionKeyShape, defaultMainSessionKey, getParentSessionKey, getSubagentDepth, init_session_key, isAcpSessionKey,
|
|
191
|
+
export { DEFAULT_ACCOUNT_ID, DEFAULT_AGENT_ID, DEFAULT_MAIN_KEY, assertAgentSessionKey, buildAgentMainSessionKey, buildAgentPeerSessionKey, buildGroupHistoryKey, buildSessionKey, buildSubagentSessionKey, classifySessionKeyShape, defaultMainSessionKey, getParentSessionKey, getSubagentDepth, init_session_key, isAcpSessionKey, isCronSessionKey, isSubagentSessionKey, isValidAgentId, isValidSegment, normalizeAccountId, normalizeAgentId, normalizeMainKey, normalizeOptionalAccountId, normalizeSessionKey, parseAgentSessionKey, parseRawSessionConversationRef, parseSessionKey, parseThreadSessionSuffix, resolveAgentIdFromSessionKey, resolveThreadParentSessionKey, resolveThreadSessionKeys, sanitizeAgentId, sanitizeSegment, scopedHeartbeatWakeOptions, toAgentRequestSessionKey, toAgentStoreSessionKey };
|
|
@@ -6,12 +6,25 @@ import type { NotesService } from '../notes/service.js';
|
|
|
6
6
|
import type { ProactiveInboxService } from '../proactive/inbox/service.js';
|
|
7
7
|
import type { ProjectService } from '../projects/project-service.js';
|
|
8
8
|
import type { SessionIndex } from '../session/manager.js';
|
|
9
|
+
import type { WorkflowRunSummary } from '../workflows/domain/index.js';
|
|
9
10
|
import type { WorkflowRunService } from '../workflows/service/workflow-run-service.js';
|
|
10
11
|
import { type TaskReadModel } from './task-read-model-projector.js';
|
|
11
12
|
type HomeDecision = HomeResponse['decisions'][number];
|
|
12
13
|
type HomeAttention = HomeResponse['attention'][number];
|
|
13
14
|
type HomeBriefingWin = HomeResponse['briefing']['wins'][number];
|
|
14
15
|
type HomeAutomation = HomeResponse['upcomingAutomations'][number];
|
|
16
|
+
type HomeFocusItem = HomeResponse['focusItems'][number];
|
|
17
|
+
type HomeWorkflowRun = {
|
|
18
|
+
id: string;
|
|
19
|
+
definitionId: string;
|
|
20
|
+
title: string;
|
|
21
|
+
status: WorkflowRunSummary['status'];
|
|
22
|
+
sessionKey?: string;
|
|
23
|
+
createdAtMs: number;
|
|
24
|
+
startedAtMs?: number;
|
|
25
|
+
completedAtMs?: number;
|
|
26
|
+
metrics: WorkflowRunSummary['metrics'];
|
|
27
|
+
};
|
|
15
28
|
type HomeAutomationRun = {
|
|
16
29
|
id: string;
|
|
17
30
|
automationId: string;
|
|
@@ -126,6 +139,17 @@ export declare function buildHomeBriefing(input: {
|
|
|
126
139
|
name?: string;
|
|
127
140
|
};
|
|
128
141
|
};
|
|
142
|
+
export declare function buildHomeFocusItems(input: {
|
|
143
|
+
locale?: string;
|
|
144
|
+
decisions: HomeDecision[];
|
|
145
|
+
attention: HomeAttention[];
|
|
146
|
+
activeWorkflowRuns: HomeWorkflowRun[];
|
|
147
|
+
runningTasks: HomeResponse['tasks']['running'];
|
|
148
|
+
wins: HomeBriefingWin[];
|
|
149
|
+
nextScheduled?: HomeAutomation;
|
|
150
|
+
inboxCount: number;
|
|
151
|
+
nowMs: number;
|
|
152
|
+
}): HomeFocusItem[];
|
|
129
153
|
export declare class HomeQueryService {
|
|
130
154
|
#private;
|
|
131
155
|
private readonly service;
|
|
@@ -114,6 +114,273 @@ function buildHomeBriefing(input) {
|
|
|
114
114
|
nextScheduled: input.nextScheduled
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
+
function homeActionCopy(locale) {
|
|
118
|
+
return locale?.toLowerCase().startsWith("zh") ?? false ? {
|
|
119
|
+
approve: "允许并继续",
|
|
120
|
+
deny: "拒绝",
|
|
121
|
+
review: "查看并处理",
|
|
122
|
+
retry: "重试",
|
|
123
|
+
acknowledge: "暂时忽略",
|
|
124
|
+
viewProgress: "查看进度",
|
|
125
|
+
viewResult: "查看结果",
|
|
126
|
+
viewSchedule: "查看计划",
|
|
127
|
+
runningTask: "任务正在推进",
|
|
128
|
+
runningWorkflow: "工作流正在推进",
|
|
129
|
+
scheduled: "下一项定时工作",
|
|
130
|
+
organizeInbox: "整理收件箱",
|
|
131
|
+
organizeInboxSummary: "把刚捕获的内容整理成笔记、任务或后续行动。",
|
|
132
|
+
openInbox: "去整理",
|
|
133
|
+
startSomething: "今天想推进什么?",
|
|
134
|
+
startSomethingSummary: "把想要的结果交给我,我会从这里开始。",
|
|
135
|
+
askAi: "交给 Agent"
|
|
136
|
+
} : {
|
|
137
|
+
approve: "Allow and continue",
|
|
138
|
+
deny: "Deny",
|
|
139
|
+
review: "Review",
|
|
140
|
+
retry: "Retry",
|
|
141
|
+
acknowledge: "Dismiss",
|
|
142
|
+
viewProgress: "View progress",
|
|
143
|
+
viewResult: "View result",
|
|
144
|
+
viewSchedule: "View schedule",
|
|
145
|
+
runningTask: "Task in progress",
|
|
146
|
+
runningWorkflow: "Workflow in progress",
|
|
147
|
+
scheduled: "Next scheduled work",
|
|
148
|
+
organizeInbox: "Organize your inbox",
|
|
149
|
+
organizeInboxSummary: "Turn recent captures into notes, tasks, or next actions.",
|
|
150
|
+
openInbox: "Organize",
|
|
151
|
+
startSomething: "What would you like to move forward?",
|
|
152
|
+
startSomethingSummary: "Hand me the outcome you want and I’ll take it from here.",
|
|
153
|
+
askAi: "Ask an agent"
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function buildHomeFocusItems(input) {
|
|
157
|
+
const copy = homeActionCopy(input.locale);
|
|
158
|
+
const decisions = input.decisions.map((decision) => {
|
|
159
|
+
const openAction = decision.kind === "agent_judgment" && decision.judgment ? {
|
|
160
|
+
type: "open",
|
|
161
|
+
label: copy.review,
|
|
162
|
+
target: "inbox_judgment",
|
|
163
|
+
targetId: decision.judgment.inboxItemId
|
|
164
|
+
} : decision.kind === "task" ? {
|
|
165
|
+
type: "open",
|
|
166
|
+
label: copy.review,
|
|
167
|
+
target: "task",
|
|
168
|
+
targetId: decision.id.replace(/^task:/, "")
|
|
169
|
+
} : {
|
|
170
|
+
type: "open",
|
|
171
|
+
label: copy.review,
|
|
172
|
+
target: "work"
|
|
173
|
+
};
|
|
174
|
+
const connectorActions = decision.response?.kind === "connector_approval" ? {
|
|
175
|
+
primaryAction: {
|
|
176
|
+
type: "connector_decision",
|
|
177
|
+
label: copy.approve,
|
|
178
|
+
approvalId: decision.response.approvalId,
|
|
179
|
+
decision: "approve"
|
|
180
|
+
},
|
|
181
|
+
secondaryActions: [{
|
|
182
|
+
type: "connector_decision",
|
|
183
|
+
label: copy.deny,
|
|
184
|
+
approvalId: decision.response.approvalId,
|
|
185
|
+
decision: "deny"
|
|
186
|
+
}]
|
|
187
|
+
} : {
|
|
188
|
+
primaryAction: openAction,
|
|
189
|
+
secondaryActions: []
|
|
190
|
+
};
|
|
191
|
+
return {
|
|
192
|
+
id: decision.id,
|
|
193
|
+
kind: "decision",
|
|
194
|
+
priority: decision.urgency === "now" ? 100 : 90,
|
|
195
|
+
title: decision.title,
|
|
196
|
+
summary: decision.detail || copy.review,
|
|
197
|
+
statusLabel: copy.review,
|
|
198
|
+
updatedAt: decision.updatedAt,
|
|
199
|
+
pinnable: false,
|
|
200
|
+
openAction,
|
|
201
|
+
...connectorActions
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
const failures = input.attention.map((item) => ({
|
|
205
|
+
id: item.id,
|
|
206
|
+
kind: "failure",
|
|
207
|
+
priority: 80,
|
|
208
|
+
title: item.title,
|
|
209
|
+
summary: item.detail,
|
|
210
|
+
updatedAt: item.updatedAt,
|
|
211
|
+
pinnable: false,
|
|
212
|
+
openAction: item.kind === "workflow_run" ? item.sessionKey ? {
|
|
213
|
+
type: "open",
|
|
214
|
+
label: copy.review,
|
|
215
|
+
target: "session",
|
|
216
|
+
sessionKey: item.sessionKey
|
|
217
|
+
} : {
|
|
218
|
+
type: "open",
|
|
219
|
+
label: copy.review,
|
|
220
|
+
target: "workflow_run",
|
|
221
|
+
targetId: item.runId
|
|
222
|
+
} : {
|
|
223
|
+
type: "open",
|
|
224
|
+
label: copy.review,
|
|
225
|
+
target: "automation",
|
|
226
|
+
targetId: item.runId
|
|
227
|
+
},
|
|
228
|
+
primaryAction: {
|
|
229
|
+
type: "retry_run",
|
|
230
|
+
label: copy.retry,
|
|
231
|
+
subjectKind: item.kind,
|
|
232
|
+
runId: item.runId
|
|
233
|
+
},
|
|
234
|
+
secondaryActions: [{
|
|
235
|
+
type: "acknowledge_run",
|
|
236
|
+
label: copy.acknowledge,
|
|
237
|
+
subjectKind: item.kind,
|
|
238
|
+
runId: item.runId
|
|
239
|
+
}]
|
|
240
|
+
}));
|
|
241
|
+
const workflows = input.activeWorkflowRuns.map((run) => {
|
|
242
|
+
const openAction = run.sessionKey ? {
|
|
243
|
+
type: "open",
|
|
244
|
+
label: copy.viewProgress,
|
|
245
|
+
target: "session",
|
|
246
|
+
sessionKey: run.sessionKey
|
|
247
|
+
} : {
|
|
248
|
+
type: "open",
|
|
249
|
+
label: copy.viewProgress,
|
|
250
|
+
target: "workflow_run",
|
|
251
|
+
targetId: run.id
|
|
252
|
+
};
|
|
253
|
+
return {
|
|
254
|
+
id: `workflow:${run.id}`,
|
|
255
|
+
kind: "running",
|
|
256
|
+
priority: 60,
|
|
257
|
+
title: run.title,
|
|
258
|
+
summary: copy.runningWorkflow,
|
|
259
|
+
statusLabel: run.metrics.agentCount > 0 ? `${run.metrics.doneAgentCount}/${run.metrics.agentCount}` : void 0,
|
|
260
|
+
updatedAt: run.startedAtMs ?? run.createdAtMs,
|
|
261
|
+
pinnable: true,
|
|
262
|
+
openAction,
|
|
263
|
+
primaryAction: openAction,
|
|
264
|
+
secondaryActions: []
|
|
265
|
+
};
|
|
266
|
+
});
|
|
267
|
+
const tasks = input.runningTasks.map((task) => {
|
|
268
|
+
const openAction = {
|
|
269
|
+
type: "open",
|
|
270
|
+
label: copy.viewProgress,
|
|
271
|
+
target: "task",
|
|
272
|
+
targetId: task.id
|
|
273
|
+
};
|
|
274
|
+
return {
|
|
275
|
+
id: `task:${task.id}`,
|
|
276
|
+
kind: "running",
|
|
277
|
+
priority: 55,
|
|
278
|
+
title: task.title,
|
|
279
|
+
summary: copy.runningTask,
|
|
280
|
+
updatedAt: task.updatedAt,
|
|
281
|
+
pinnable: true,
|
|
282
|
+
openAction,
|
|
283
|
+
primaryAction: openAction,
|
|
284
|
+
secondaryActions: []
|
|
285
|
+
};
|
|
286
|
+
});
|
|
287
|
+
const results = input.wins.map((win) => {
|
|
288
|
+
const openAction = win.kind === "workflow_run" ? {
|
|
289
|
+
type: "open",
|
|
290
|
+
label: copy.viewResult,
|
|
291
|
+
target: "workflow_run",
|
|
292
|
+
targetId: win.id.replace(/^workflow:/, "")
|
|
293
|
+
} : win.kind === "automation_run" ? {
|
|
294
|
+
type: "open",
|
|
295
|
+
label: copy.viewResult,
|
|
296
|
+
target: "automation",
|
|
297
|
+
targetId: win.id.replace(/^automation:/, "")
|
|
298
|
+
} : {
|
|
299
|
+
type: "open",
|
|
300
|
+
label: copy.viewResult,
|
|
301
|
+
target: "task",
|
|
302
|
+
targetId: win.id.replace(/^task:/, "")
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
id: win.id,
|
|
306
|
+
kind: "result",
|
|
307
|
+
priority: 40,
|
|
308
|
+
title: win.title,
|
|
309
|
+
summary: copy.viewResult,
|
|
310
|
+
updatedAt: win.completedAt,
|
|
311
|
+
pinnable: true,
|
|
312
|
+
openAction,
|
|
313
|
+
primaryAction: openAction,
|
|
314
|
+
secondaryActions: []
|
|
315
|
+
};
|
|
316
|
+
});
|
|
317
|
+
const scheduled = input.nextScheduled ? [{
|
|
318
|
+
id: `automation:${input.nextScheduled.id}:scheduled`,
|
|
319
|
+
kind: "scheduled",
|
|
320
|
+
priority: 30,
|
|
321
|
+
title: input.nextScheduled.name || input.nextScheduled.id,
|
|
322
|
+
summary: copy.scheduled,
|
|
323
|
+
statusLabel: new Date(input.nextScheduled.nextRunAt).toLocaleString(input.locale),
|
|
324
|
+
updatedAt: Date.parse(input.nextScheduled.nextRunAt),
|
|
325
|
+
pinnable: true,
|
|
326
|
+
openAction: {
|
|
327
|
+
type: "open",
|
|
328
|
+
label: copy.viewSchedule,
|
|
329
|
+
target: "automation",
|
|
330
|
+
targetId: input.nextScheduled.id
|
|
331
|
+
},
|
|
332
|
+
primaryAction: {
|
|
333
|
+
type: "open",
|
|
334
|
+
label: copy.viewSchedule,
|
|
335
|
+
target: "automation",
|
|
336
|
+
targetId: input.nextScheduled.id
|
|
337
|
+
},
|
|
338
|
+
secondaryActions: []
|
|
339
|
+
}] : [];
|
|
340
|
+
const items = [
|
|
341
|
+
...decisions,
|
|
342
|
+
...failures,
|
|
343
|
+
...workflows,
|
|
344
|
+
...tasks,
|
|
345
|
+
...results,
|
|
346
|
+
...scheduled
|
|
347
|
+
].sort((left, right) => right.priority - left.priority || right.updatedAt - left.updatedAt);
|
|
348
|
+
if (items.length > 0) return items;
|
|
349
|
+
if (input.inboxCount > 0) return [{
|
|
350
|
+
id: "suggestion:organize-inbox",
|
|
351
|
+
kind: "suggestion",
|
|
352
|
+
priority: 10,
|
|
353
|
+
title: `${copy.organizeInbox} · ${input.inboxCount}`,
|
|
354
|
+
summary: copy.organizeInboxSummary,
|
|
355
|
+
updatedAt: input.nowMs,
|
|
356
|
+
pinnable: false,
|
|
357
|
+
openAction: {
|
|
358
|
+
type: "open",
|
|
359
|
+
label: copy.openInbox,
|
|
360
|
+
target: "inbox"
|
|
361
|
+
},
|
|
362
|
+
primaryAction: {
|
|
363
|
+
type: "open",
|
|
364
|
+
label: copy.openInbox,
|
|
365
|
+
target: "inbox"
|
|
366
|
+
},
|
|
367
|
+
secondaryActions: []
|
|
368
|
+
}];
|
|
369
|
+
return [{
|
|
370
|
+
id: "suggestion:ask-agent",
|
|
371
|
+
kind: "suggestion",
|
|
372
|
+
priority: 10,
|
|
373
|
+
title: copy.startSomething,
|
|
374
|
+
summary: copy.startSomethingSummary,
|
|
375
|
+
updatedAt: input.nowMs,
|
|
376
|
+
pinnable: false,
|
|
377
|
+
primaryAction: {
|
|
378
|
+
type: "ask_ai",
|
|
379
|
+
label: copy.askAi
|
|
380
|
+
},
|
|
381
|
+
secondaryActions: []
|
|
382
|
+
}];
|
|
383
|
+
}
|
|
117
384
|
var HomeQueryService = class {
|
|
118
385
|
#runs = new TaskRunRepository();
|
|
119
386
|
#tasks = new TaskRepository();
|
|
@@ -256,6 +523,10 @@ var HomeQueryService = class {
|
|
|
256
523
|
href: "/automations",
|
|
257
524
|
completedAt: run.endedAtMs ?? run.createdAtMs
|
|
258
525
|
}))].sort((left, right) => right.completedAt - left.completedAt);
|
|
526
|
+
const runningTasks = tasks.filter((task) => {
|
|
527
|
+
const state = this.#projector.project(task).operationalState;
|
|
528
|
+
return state === "queued" || state === "running" || state === "verifying";
|
|
529
|
+
}).slice(0, 20);
|
|
259
530
|
const briefing = buildHomeBriefing({
|
|
260
531
|
locale,
|
|
261
532
|
decisions,
|
|
@@ -267,6 +538,17 @@ var HomeQueryService = class {
|
|
|
267
538
|
nowMs
|
|
268
539
|
});
|
|
269
540
|
return {
|
|
541
|
+
focusItems: buildHomeFocusItems({
|
|
542
|
+
locale,
|
|
543
|
+
decisions,
|
|
544
|
+
attention,
|
|
545
|
+
activeWorkflowRuns,
|
|
546
|
+
runningTasks,
|
|
547
|
+
wins,
|
|
548
|
+
nextScheduled: upcomingAutomations[0],
|
|
549
|
+
inboxCount: inbox.total,
|
|
550
|
+
nowMs
|
|
551
|
+
}),
|
|
270
552
|
recentlyOpened: recentlyOpened.items.filter((note) => note.lastOpenedAt),
|
|
271
553
|
inboxCount: inbox.total,
|
|
272
554
|
pendingTasks: pendingTasks.items,
|
|
@@ -302,14 +584,11 @@ var HomeQueryService = class {
|
|
|
302
584
|
recent: workChats.filter((chat) => !chat.active).slice(0, 8)
|
|
303
585
|
},
|
|
304
586
|
upcomingAutomations,
|
|
305
|
-
tasks: { running:
|
|
306
|
-
const state = this.#projector.project(task).operationalState;
|
|
307
|
-
return state === "queued" || state === "running" || state === "verifying";
|
|
308
|
-
}).slice(0, 20) },
|
|
587
|
+
tasks: { running: runningTasks },
|
|
309
588
|
recentTasks: tasks.flatMap((task) => this.#runs.listReceipts(task.id, 3)).sort((a, b) => b.finalizedAt - a.finalizedAt).slice(0, 8),
|
|
310
589
|
recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun)
|
|
311
590
|
};
|
|
312
591
|
}
|
|
313
592
|
};
|
|
314
593
|
//#endregion
|
|
315
|
-
export { HomeQueryService, buildHomeBriefing, decisionFromTask };
|
|
594
|
+
export { HomeQueryService, buildHomeBriefing, buildHomeFocusItems, decisionFromTask };
|
package/dist/src/tasks/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { TaskRunRepository } from "./task-run-repository.js";
|
|
|
3
3
|
import { TaskReadModelProjector } from "./task-read-model-projector.js";
|
|
4
4
|
import { resolveExecutionContext } from "./execution-context.js";
|
|
5
5
|
import { AttentionGovernor } from "./attention-governor.js";
|
|
6
|
-
import { HomeQueryService, buildHomeBriefing, decisionFromTask } from "./home-query-service.js";
|
|
6
|
+
import { HomeQueryService, buildHomeBriefing, buildHomeFocusItems, decisionFromTask } from "./home-query-service.js";
|
|
7
7
|
import { TaskContextRepository } from "./task-context-repository.js";
|
|
8
8
|
import { TaskDependencyError, TaskDependencyService } from "./task-dependency-service.js";
|
|
9
9
|
import { TaskApplicationService } from "./task-application-service.js";
|
|
@@ -13,9 +13,9 @@ import { ModelTaskContractPlanner, parseTaskContractResponse } from "./task-cont
|
|
|
13
13
|
import { assembleTaskContext, buildTaskExecutionDirective, getTaskContextManifest, getTaskExecutionBrief } from "./task-context-assembler.js";
|
|
14
14
|
import { TaskRunCoordinator } from "./task-run-coordinator.js";
|
|
15
15
|
import { ProjectMonitoringService, decideProactiveDisposition } from "./project-monitoring-service.js";
|
|
16
|
-
import { ProjectOperatingViewService, projectTaskLane } from "./project-operating-view-service.js";
|
|
16
|
+
import { ProjectOperatingViewService, projectTaskLane, summarizeProjectOperatingView } from "./project-operating-view-service.js";
|
|
17
17
|
import { TaskValueMetricsService } from "./task-value-metrics-service.js";
|
|
18
18
|
import { TaskOutboxDispatcher } from "./task-outbox-dispatcher.js";
|
|
19
19
|
import { TaskRunDispatcher } from "./task-run-dispatcher.js";
|
|
20
20
|
import { TaskSignalService } from "./task-signal-service.js";
|
|
21
|
-
export { AttentionGovernor, HomeQueryService, ModelTaskContractPlanner, ProjectMonitoringService, ProjectOperatingViewService, TaskApplicationService, TaskContextRepository, TaskDependencyError, TaskDependencyService, TaskOutboxDispatcher, TaskReadModelProjector, TaskRepository, TaskRunCoordinator, TaskRunDispatcher, TaskRunRepository, TaskSignalService, TaskValueMetricsService, TaskWorkflowCoordinator, assembleTaskContext, buildHomeBriefing, buildTaskExecutionDirective, decideProactiveDisposition, decisionFromTask, defineTaskContract, getTaskContextManifest, getTaskExecutionBrief, parseTaskContractResponse, projectTaskLane, resolveExecutionContext };
|
|
21
|
+
export { AttentionGovernor, HomeQueryService, ModelTaskContractPlanner, ProjectMonitoringService, ProjectOperatingViewService, TaskApplicationService, TaskContextRepository, TaskDependencyError, TaskDependencyService, TaskOutboxDispatcher, TaskReadModelProjector, TaskRepository, TaskRunCoordinator, TaskRunDispatcher, TaskRunRepository, TaskSignalService, TaskValueMetricsService, TaskWorkflowCoordinator, assembleTaskContext, buildHomeBriefing, buildHomeFocusItems, buildTaskExecutionDirective, decideProactiveDisposition, decisionFromTask, defineTaskContract, getTaskContextManifest, getTaskExecutionBrief, parseTaskContractResponse, projectTaskLane, resolveExecutionContext, summarizeProjectOperatingView };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ProjectOperatingView, ProjectTaskCard } from '@xopcai/gateway-contract';
|
|
1
|
+
import type { ProjectOperatingSummary, ProjectOperatingView, ProjectTaskCard } from '@xopcai/gateway-contract';
|
|
2
2
|
import type { ProjectService } from '../projects/index.js';
|
|
3
3
|
export declare function projectTaskLane(card: Pick<ProjectTaskCard, 'phase' | 'operationalState' | 'attention'>): ProjectTaskCard['lane'];
|
|
4
|
+
export declare function summarizeProjectOperatingView(view: ProjectOperatingView): ProjectOperatingSummary;
|
|
4
5
|
export declare class ProjectOperatingViewService {
|
|
5
6
|
#private;
|
|
6
7
|
private readonly projects;
|