@xopcai/xopc 0.0.192 → 0.0.194
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/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-B-tzXpDD.js → activity-store-BwmdJ5pv.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-xOu0qNwc.js → agent-avatar-dicebear-4ln7j-oZ.js} +1 -1
- package/dist/gateway/static/root/assets/agents-C1Z-rurI.js +68 -0
- package/dist/gateway/static/root/assets/{api-fMItZb-h.js → api-BM1hNzjw.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-D6Rv3OWI.js → app-management-settings-panel-B0IMpHk8.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CKoNCwco.js → appearance-settings-BG6ZGIUf.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CwsZENTk.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BokNQBwH.js → archive-plugin-BNpjG4FR.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Dx1HglsM.js → attachment-load-BK25C_hA.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BedezAfO.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CPYAflIG.js → binary-plugins-fbFe6Jqc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BFLgl8SS.js → block-editor-SQHwWg1e.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-CC0_TfTy.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-CqLnqA9z.js → browser-workflow-inputs-DuUQ_Ycz.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Db5v3HtE.js → browser-workflows-page-B8I2FmrM.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ditT6VRs.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-lov0J9A2.js → capability-presets-api-BoOzFotX.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-bNVds1ta.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DSJznouK.js → channel-recipient-api-_8IiTxRB.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DhsWSbJ2.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DPaJSYX_.js +1 -0
- package/dist/gateway/static/root/assets/{connectors-api-3ccRyS3L.js → connectors-api-Ne8mQrYN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-hZA9M1z_.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-C9hhCiuo.js → cron-expression-DtWb3YAh.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CTtZFZug.js → dependency-picker-3vjdusik.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DOUeNVmC.js → desktop-pet-NmW7VWdO.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-D4704vtl.js → desktop-pet-settings-DrdSI9lX.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DJDXeA1B.js → directory-picker-path-field-CG5XR1UD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-C0n2NMF1.js → extension-debug-page-RjIezQyy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-vG-xxRNs.js → extension-page-D9Elz9mr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CtuY2THd.js → extension-settings-page-BvVjqFvm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CZra7GuI.js → gateway-config-api-C-rYVz-n.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Cz33jRkR.js → gateway-settings-CLS25-gm.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BbVV0udv.js → gateway-startup-retry--2njcDpC.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D2XMlA_U.js → heartbeat-settings-DSgDxtwJ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CDpUUelT.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BgrOvhaJ.js → image-generation-api-Cki7jfEV.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DzmbmOGA.js → index-Cb9y6tVR.js} +61 -61
- package/dist/gateway/static/root/assets/index-DtEVsSU1.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BfyAEG1G.js → keyboard-shortcuts-settings-RcHmSHYI.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DvzXo7dx.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BYalcRSY.js → local-apps-page-s7PKLTvO.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-VOY1wMO9.js → locale-store-Bjvw7jtg.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CNm5fu3L.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BQf-6s32.js → management-settings-CWUHBXje.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Cy_2SN1Q.js → markdown-split-B-IuPr4L.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CkDupqb2.js → media-plugins-CiejHVt4.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-DMJ-6-1m.js → messages-DQ5X6cXp.js} +2 -2
- package/dist/gateway/static/root/assets/{notes-page-kiGRR9jo.js → notes-page-BSJAwHqy.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DTWRQ_EU.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-CvzSdYVj.js → page-tabs-D6YJ6_l_.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-kZ0nco7e.js → preview-open-alternatives-Tw_G-6jb.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DgoieqQC.js → product-open-page-BlB3QjTV.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DT7aWLWT.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B-i3U2fU.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-v-kXavTc.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bud_NTEZ.js → runtime-tools-settings-panel-D59bftC7.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-GlbsCBmv.js → schema-form-DyXqGA71.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-tEfg1Pru.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-tbguNxVJ.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CKLns16d.js → settings-form-section-DZUGXwFO.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BDzpxgk0.js → settings-loading-skeleton-Lz1ec5lN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BH0pF7QB.js → settings-page-DLofKC7q.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-J793iqfm.js → settings-page-layout-BdkN2U81.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DQgoV7gj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-UTm_7r0l.js → share-preview-page-DrZVv8tB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-I2bBkyDb.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-gFdcImEc.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-zOD__-H5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Bwid1TGB.js → skills-page.utils-ZDcx95iD.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BJhat70L.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DoyREaFj.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-GVZOImyb.js → theme-store-DtxpMC5S.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CT2c85Ju.js → typed-models-lib-B1p3wMFK.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CcvY7DTh.js → use-autosave-Frcfbncl.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-DniWcH92.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Ricc3QGo.js → voice-api-key-field-CSNOUNF4.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BoomfqhX.js → work-discovery-overlay-DTJGssPz.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-Bt2-fzHu.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-D3uCmyag.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-Ba5fVQWY.js +5 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/gateway/static/root/notification-sw.js +15 -0
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/oauth/xopc-cloud.js +163 -7
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/extensions/sdk/index.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/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +21 -8
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/work-discovery/analyzer.js +1 -2
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-CxuwvDk0.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-wAb5dnHZ.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Drgazevs.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DmYlFJW7.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D7Z8T0o5.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-COjnwO0U.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-DcRYBNN7.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-C2UYdebT.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-FVmvBG9H.js +0 -2
- package/dist/gateway/static/root/assets/home-page-CPrHkPN6.js +0 -3
- package/dist/gateway/static/root/assets/index-Cg7Xnlu3.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Clz47vSr.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Cxq9WMf5.js +0 -2
- package/dist/gateway/static/root/assets/notes-workbench-DkYkPGyB.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CeSjJd-N.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-fZ1rm4b9.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CbYI6KC8.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-sOJ_TnLm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BI0u77dt.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGsml89P.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BM--lgUS.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CGCOC-rV.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-iLyaOl48.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-BcB3p1e3.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DQYEf08v.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CGI41bfO.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-mbnepbQk.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DSWG2xqL.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DtV0ruyk.js +0 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
self.addEventListener('notificationclick', (event) => {
|
|
2
|
+
event.notification.close();
|
|
3
|
+
const route = event.notification.data?.route;
|
|
4
|
+
if (typeof route !== 'string' || !route.startsWith('/chat/')) return;
|
|
5
|
+
event.waitUntil((async () => {
|
|
6
|
+
const windows = await self.clients.matchAll({ type: 'window', includeUncontrolled: true });
|
|
7
|
+
const client = windows[0];
|
|
8
|
+
if (client) {
|
|
9
|
+
client.postMessage({ type: 'xopc:notification-click', route });
|
|
10
|
+
await client.focus();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
await self.clients.openWindow(`/#${route}`);
|
|
14
|
+
})());
|
|
15
|
+
});
|
package/dist/package.js
CHANGED
|
@@ -4,6 +4,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
4
4
|
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
5
5
|
import { getSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
6
6
|
import "../storage/sqlite/index.js";
|
|
7
|
+
import { checkBoundary } from "../agent-runtime/boundary-guard.js";
|
|
7
8
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
8
9
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
9
10
|
import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
|
|
@@ -37,7 +38,6 @@ import { UserContextCoordinator } from "./memory/user-context-coordinator.js";
|
|
|
37
38
|
import { WorkspaceRuntimeRegistry } from "./workspace-runtime/registry.js";
|
|
38
39
|
import { BackgroundReviewCoordinator } from "./background-review/coordinator.js";
|
|
39
40
|
import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
|
|
40
|
-
import { checkBoundary } from "../agent-runtime/boundary-guard.js";
|
|
41
41
|
import { SkillFilesystemWatcher } from "./skills/filesystem-watcher.js";
|
|
42
42
|
import { ProjectTrustStore, hasTrustRequiringProjectResources } from "../project-trust/trust-store.js";
|
|
43
43
|
import { basename, resolve, sep } from "node:path";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
1
2
|
import { isMemorySubsystemEnabled } from "./memory-config.js";
|
|
2
3
|
import { BuiltinMemoryProvider } from "./builtin-provider.js";
|
|
3
4
|
import { MemoryManager } from "./manager.js";
|
|
4
5
|
import { loadMemoryPluginProviders } from "./plugin-discovery.js";
|
|
5
|
-
import { buildMemoryRuntime } from "../../agent-runtime/memory-runtime.js";
|
|
6
6
|
//#region src/agent/memory/create-memory-manager.ts
|
|
7
7
|
function createMemoryManagerFromConfig(config) {
|
|
8
8
|
const routing = resolveMemoryManagerOptions(config);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
2
1
|
import { checkBoundary } from "./boundary-guard.js";
|
|
3
2
|
import { resolveModelRole } from "./model-router.js";
|
|
4
3
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
4
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
5
5
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
6
6
|
import { buildAgentRuntimeProfile } from "./runtime-profile.js";
|
|
7
7
|
import { appendAgentRunEvent, createAgentRunTrace, finishAgentRunTrace, hashEffectiveManifest } from "./run-trace.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { buildAgentManifestPromptSection } from "../agent-manifest/prompt.js";
|
|
2
2
|
import "../agent-manifest/index.js";
|
|
3
|
-
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
4
3
|
import { checkBoundary } from "./boundary-guard.js";
|
|
5
4
|
import { resolveModelRole } from "./model-router.js";
|
|
6
5
|
import { buildRuntimeToolRegistry } from "./tool-registry.js";
|
|
6
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
7
7
|
import { resolveWorkflow, validateWorkflowForRuntime } from "./workflow-runtime.js";
|
|
8
8
|
//#region src/agent-runtime/runtime-profile.ts
|
|
9
9
|
function buildAgentRuntimeProfile(params) {
|
|
@@ -32,8 +32,164 @@ async function tokenRequest(body, signal) {
|
|
|
32
32
|
signal: signal ?? AbortSignal.timeout(3e4)
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
35
|
+
function escapeHtml(value) {
|
|
36
|
+
return value.replace(/[&<>"']/g, (character) => ({
|
|
37
|
+
"&": "&",
|
|
38
|
+
"<": "<",
|
|
39
|
+
">": ">",
|
|
40
|
+
"\"": """,
|
|
41
|
+
"'": "'"
|
|
42
|
+
})[character] ?? character);
|
|
43
|
+
}
|
|
44
|
+
function callbackHtml(title, message, tone) {
|
|
45
|
+
const safeTitle = escapeHtml(title);
|
|
46
|
+
const safeMessage = escapeHtml(message);
|
|
47
|
+
return `<!doctype html>
|
|
48
|
+
<html lang="en">
|
|
49
|
+
<head>
|
|
50
|
+
<meta charset="utf-8" />
|
|
51
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
52
|
+
<meta name="referrer" content="no-referrer" />
|
|
53
|
+
<title>${safeTitle} · XOPC</title>
|
|
54
|
+
<style>
|
|
55
|
+
:root {
|
|
56
|
+
color-scheme: light dark;
|
|
57
|
+
--accent: #3a6bff;
|
|
58
|
+
--accent-soft: #eef3ff;
|
|
59
|
+
--canvas: #f7f8fb;
|
|
60
|
+
--panel: rgba(255, 255, 255, 0.88);
|
|
61
|
+
--text: #111111;
|
|
62
|
+
--muted: #666666;
|
|
63
|
+
--edge: rgba(17, 17, 17, 0.08);
|
|
64
|
+
--status: ${tone === "success" ? "#17864b" : "#d64242"};
|
|
65
|
+
--status-soft: ${tone === "success" ? "#e7fbf1" : "#fff0f0"};
|
|
66
|
+
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
67
|
+
}
|
|
68
|
+
* { box-sizing: border-box; }
|
|
69
|
+
html, body { min-height: 100%; }
|
|
70
|
+
body {
|
|
71
|
+
margin: 0;
|
|
72
|
+
min-height: 100vh;
|
|
73
|
+
display: grid;
|
|
74
|
+
place-items: center;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
padding: 24px;
|
|
77
|
+
background:
|
|
78
|
+
radial-gradient(circle at 18% 18%, rgba(46, 216, 255, 0.16), transparent 34rem),
|
|
79
|
+
radial-gradient(circle at 82% 78%, rgba(91, 87, 255, 0.14), transparent 32rem),
|
|
80
|
+
var(--canvas);
|
|
81
|
+
color: var(--text);
|
|
82
|
+
-webkit-font-smoothing: antialiased;
|
|
83
|
+
}
|
|
84
|
+
.glow {
|
|
85
|
+
position: fixed;
|
|
86
|
+
width: 280px;
|
|
87
|
+
height: 280px;
|
|
88
|
+
border-radius: 999px;
|
|
89
|
+
background: rgba(58, 107, 255, 0.12);
|
|
90
|
+
filter: blur(72px);
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
}
|
|
93
|
+
.glow-one { top: -120px; right: -80px; }
|
|
94
|
+
.glow-two { bottom: -150px; left: -80px; }
|
|
95
|
+
.card {
|
|
96
|
+
position: relative;
|
|
97
|
+
width: min(100%, 480px);
|
|
98
|
+
padding: 34px;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
border: 1px solid var(--edge);
|
|
101
|
+
border-radius: 24px;
|
|
102
|
+
background: var(--panel);
|
|
103
|
+
box-shadow: 0 24px 80px rgba(31, 41, 78, 0.12), 0 2px 12px rgba(17, 17, 17, 0.05);
|
|
104
|
+
backdrop-filter: blur(20px);
|
|
105
|
+
-webkit-backdrop-filter: blur(20px);
|
|
106
|
+
}
|
|
107
|
+
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 34px; font-weight: 700; letter-spacing: -0.02em; }
|
|
108
|
+
.logo { width: 38px; height: 38px; filter: drop-shadow(0 8px 14px rgba(58, 107, 255, 0.22)); }
|
|
109
|
+
.status {
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
gap: 7px;
|
|
113
|
+
margin-bottom: 18px;
|
|
114
|
+
border-radius: 999px;
|
|
115
|
+
padding: 7px 11px 7px 8px;
|
|
116
|
+
background: var(--status-soft);
|
|
117
|
+
color: var(--status);
|
|
118
|
+
font-size: 12px;
|
|
119
|
+
font-weight: 650;
|
|
120
|
+
letter-spacing: 0.01em;
|
|
121
|
+
}
|
|
122
|
+
.status-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
123
|
+
h1 { margin: 0; font-size: clamp(26px, 6vw, 32px); line-height: 1.15; letter-spacing: -0.035em; }
|
|
124
|
+
.message { margin: 14px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
|
|
125
|
+
.next-step {
|
|
126
|
+
display: flex;
|
|
127
|
+
align-items: flex-start;
|
|
128
|
+
gap: 11px;
|
|
129
|
+
margin-top: 28px;
|
|
130
|
+
padding-top: 22px;
|
|
131
|
+
border-top: 1px solid var(--edge);
|
|
132
|
+
color: var(--muted);
|
|
133
|
+
font-size: 13px;
|
|
134
|
+
line-height: 1.55;
|
|
135
|
+
}
|
|
136
|
+
.window-icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
|
137
|
+
@media (prefers-color-scheme: dark) {
|
|
138
|
+
:root {
|
|
139
|
+
--accent-soft: rgba(58, 107, 255, 0.16);
|
|
140
|
+
--canvas: #090a0d;
|
|
141
|
+
--panel: rgba(20, 22, 28, 0.9);
|
|
142
|
+
--text: #f7f8fb;
|
|
143
|
+
--muted: #a6a9b2;
|
|
144
|
+
--edge: rgba(255, 255, 255, 0.09);
|
|
145
|
+
--status: ${tone === "success" ? "#63d69a" : "#ff8484"};
|
|
146
|
+
--status-soft: ${tone === "success" ? "rgba(44, 203, 127, 0.12)" : "rgba(255, 93, 93, 0.12)"};
|
|
147
|
+
}
|
|
148
|
+
body {
|
|
149
|
+
background:
|
|
150
|
+
radial-gradient(circle at 18% 18%, rgba(46, 216, 255, 0.09), transparent 34rem),
|
|
151
|
+
radial-gradient(circle at 82% 78%, rgba(91, 87, 255, 0.12), transparent 32rem),
|
|
152
|
+
var(--canvas);
|
|
153
|
+
}
|
|
154
|
+
.card { box-shadow: 0 26px 90px rgba(0, 0, 0, 0.42); }
|
|
155
|
+
}
|
|
156
|
+
@media (max-width: 520px) {
|
|
157
|
+
body { padding: 16px; }
|
|
158
|
+
.card { padding: 26px 22px; border-radius: 20px; }
|
|
159
|
+
.brand { margin-bottom: 28px; }
|
|
160
|
+
}
|
|
161
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
162
|
+
.card { animation: enter 420ms cubic-bezier(.2, .75, .25, 1) both; }
|
|
163
|
+
.status-icon { animation: settle 520ms 160ms cubic-bezier(.2, .8, .25, 1.25) both; }
|
|
164
|
+
@keyframes enter { from { opacity: 0; transform: translateY(10px) scale(.985); } }
|
|
165
|
+
@keyframes settle { from { opacity: 0; transform: scale(.65); } }
|
|
166
|
+
}
|
|
167
|
+
</style>
|
|
168
|
+
</head>
|
|
169
|
+
<body>
|
|
170
|
+
<div class="glow glow-one"></div>
|
|
171
|
+
<div class="glow glow-two"></div>
|
|
172
|
+
<main class="card">
|
|
173
|
+
<div class="brand">
|
|
174
|
+
<svg class="logo" viewBox="0 0 72 72" aria-hidden="true">
|
|
175
|
+
<rect width="72" height="72" rx="20" fill="#3a6bff" />
|
|
176
|
+
<path d="M22 22l28 28M50 22 22 50" stroke="#fff" stroke-width="8" stroke-linecap="round" />
|
|
177
|
+
</svg>
|
|
178
|
+
<span>XOPC</span>
|
|
179
|
+
</div>
|
|
180
|
+
<div class="status">
|
|
181
|
+
<svg class="status-icon" viewBox="0 0 24 24" aria-hidden="true">${tone === "success" ? "<path d=\"m7.5 12 3 3 6-7\" />" : "<path d=\"M12 8v5m0 3.5v.01\" />"}</svg>
|
|
182
|
+
<span>${tone === "success" ? "Authorization successful" : "Authorization needs attention"}</span>
|
|
183
|
+
</div>
|
|
184
|
+
<h1>${safeTitle}</h1>
|
|
185
|
+
<p class="message">${safeMessage}</p>
|
|
186
|
+
<div class="next-step">
|
|
187
|
+
<svg class="window-icon" viewBox="0 0 24 24" aria-hidden="true"><rect x="3" y="5" width="18" height="14" rx="2" /><path d="M3 9h18" /></svg>
|
|
188
|
+
<span>You can safely close this window and return to XOPC.</span>
|
|
189
|
+
</div>
|
|
190
|
+
</main>
|
|
191
|
+
</body>
|
|
192
|
+
</html>`;
|
|
37
193
|
}
|
|
38
194
|
async function loginWithBrowser(callbacks) {
|
|
39
195
|
if (callbacks.signal?.aborted) throw callbacks.signal.reason instanceof Error ? callbacks.signal.reason : /* @__PURE__ */ new Error("XOPC OAuth login cancelled");
|
|
@@ -49,7 +205,7 @@ async function loginWithBrowser(callbacks) {
|
|
|
49
205
|
const url = new URL(request.url ?? "", "http://127.0.0.1");
|
|
50
206
|
if (url.pathname !== CALLBACK_PATH) {
|
|
51
207
|
response.statusCode = 404;
|
|
52
|
-
response.end(callbackHtml("Authorization callback not found", "This is not a valid XOPC OAuth callback URL."));
|
|
208
|
+
response.end(callbackHtml("Authorization callback not found", "This is not a valid XOPC OAuth callback URL.", "error"));
|
|
53
209
|
return;
|
|
54
210
|
}
|
|
55
211
|
const returnedState = url.searchParams.get("state");
|
|
@@ -58,24 +214,24 @@ async function loginWithBrowser(callbacks) {
|
|
|
58
214
|
if (returnedState !== state) {
|
|
59
215
|
const error = /* @__PURE__ */ new Error("XOPC OAuth state mismatch");
|
|
60
216
|
response.statusCode = 400;
|
|
61
|
-
response.end(callbackHtml("Authorization failed", error.message));
|
|
217
|
+
response.end(callbackHtml("Authorization failed", error.message, "error"));
|
|
62
218
|
settle?.({ error });
|
|
63
219
|
return;
|
|
64
220
|
}
|
|
65
221
|
if (oauthError || !code) {
|
|
66
222
|
const error = /* @__PURE__ */ new Error(oauthError === "access_denied" ? "XOPC OAuth authorization was denied" : "XOPC OAuth callback did not include an authorization code");
|
|
67
223
|
response.statusCode = 400;
|
|
68
|
-
response.end(callbackHtml("Authorization failed", error.message));
|
|
224
|
+
response.end(callbackHtml("Authorization failed", error.message, "error"));
|
|
69
225
|
settle?.({ error });
|
|
70
226
|
return;
|
|
71
227
|
}
|
|
72
228
|
response.statusCode = 200;
|
|
73
|
-
response.end(callbackHtml("Authorization complete", "XOPC received the authorization callback successfully."));
|
|
229
|
+
response.end(callbackHtml("Authorization complete", "XOPC received the authorization callback successfully.", "success"));
|
|
74
230
|
settle?.({ code });
|
|
75
231
|
} catch {
|
|
76
232
|
const error = /* @__PURE__ */ new Error("XOPC OAuth callback could not be processed");
|
|
77
233
|
response.statusCode = 500;
|
|
78
|
-
response.end(callbackHtml("Authorization failed", error.message));
|
|
234
|
+
response.end(callbackHtml("Authorization failed", error.message, "error"));
|
|
79
235
|
settle?.({ error });
|
|
80
236
|
}
|
|
81
237
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildChannelCatalogForConfig, init_channel_catalog_service } from "../../channels/catalog/channel-catalog-service.js";
|
|
2
2
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
|
+
import { formatExamples, register } from "../registry.js";
|
|
3
4
|
import { listChannelPairingState } from "../../channels/pairing/pairing-service.js";
|
|
4
5
|
import { approveChannelPairingFromCli } from "../../channels/pairing/approve-cli.js";
|
|
5
|
-
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
//#region src/cli/commands/channels.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
|
|
2
2
|
import { getStoreConnectorInstallPlan, installStoreConnector, listStoreConnectors } from "../../capabilities/store-connector.js";
|
|
3
3
|
import { register } from "../registry.js";
|
|
4
|
-
import { confirm } from "@inquirer/prompts";
|
|
5
4
|
import { Command } from "commander";
|
|
5
|
+
import { confirm } from "@inquirer/prompts";
|
|
6
6
|
//#region src/cli/commands/connectors.ts
|
|
7
7
|
init_loader();
|
|
8
8
|
function parsePairs(values, option) {
|
|
@@ -13,8 +13,8 @@ import { existsSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
|
13
13
|
import { execSync } from "node:child_process";
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
15
15
|
import semver from "semver";
|
|
16
|
-
import { confirm } from "@inquirer/prompts";
|
|
17
16
|
import { Command } from "commander";
|
|
17
|
+
import { confirm } from "@inquirer/prompts";
|
|
18
18
|
//#region src/cli/commands/extension-marketplace.ts
|
|
19
19
|
init_loader();
|
|
20
20
|
init_paths();
|
|
@@ -3,8 +3,8 @@ import { loadConfig } from "../../../config/loader.js";
|
|
|
3
3
|
import "../../../config/index.js";
|
|
4
4
|
import { isRestartEnabled } from "../../../config/commands.flags.js";
|
|
5
5
|
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
6
|
-
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
7
6
|
import { findVerifiedGatewayListenerPidsOnPortSync, formatGatewayPidList, signalVerifiedGatewayPidSync } from "../../../infra/gateway-processes.js";
|
|
7
|
+
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
8
8
|
import { runServiceRestart, runServiceStop } from "./lifecycle-core.js";
|
|
9
9
|
import { DEFAULT_RESTART_HEALTH_ATTEMPTS, renderGatewayPortHealthDiagnostics, waitForGatewayHealthyListener } from "./restart-health.js";
|
|
10
10
|
import { parsePortFromArgs, renderGatewayServiceStartHints, resolveGatewayPortFromConfig } from "./shared.js";
|
|
@@ -8,8 +8,8 @@ import "../../config/index.js";
|
|
|
8
8
|
import { prepareUpdateGlobalDefaults } from "../../gateway/global-defaults-admin.js";
|
|
9
9
|
import { colors } from "../utils/colors.js";
|
|
10
10
|
import { runCliOAuthLogin } from "../utils/oauth-login.js";
|
|
11
|
-
import { input } from "@inquirer/prompts";
|
|
12
11
|
import { Command } from "commander";
|
|
12
|
+
import { input } from "@inquirer/prompts";
|
|
13
13
|
//#region src/cli/commands/models.ts
|
|
14
14
|
init_credentials();
|
|
15
15
|
init_schema();
|
|
@@ -10,8 +10,8 @@ import { initWorkspace } from "../utils/init-workspace.js";
|
|
|
10
10
|
import { setupModel } from "./onboard/model.js";
|
|
11
11
|
import { getChannelConfigurators } from "./onboard/channels/registry.js";
|
|
12
12
|
import { setupChannels } from "./onboard/channels/index.js";
|
|
13
|
-
import { select } from "@inquirer/prompts";
|
|
14
13
|
import { Command } from "commander";
|
|
14
|
+
import { select } from "@inquirer/prompts";
|
|
15
15
|
//#region src/cli/commands/onboard.ts
|
|
16
16
|
init_schema();
|
|
17
17
|
init_paths_state();
|
|
@@ -2,9 +2,9 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { loadConfig } from "../../config/loader.js";
|
|
3
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
4
|
import "../../config/index.js";
|
|
5
|
-
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
6
5
|
import { normalizeUpdateChannel } from "../../infra/update-channels.js";
|
|
7
6
|
import { compareSemver, resolveNpmChannelTag } from "../../infra/update-check.js";
|
|
7
|
+
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
8
8
|
import { formatUpdateApiResult, resolveUpdateInstallSurface, runGatewayUpdateWithPostSteps } from "../../infra/update-runner.js";
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
//#region src/cli/commands/update.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
2
|
import "../agent-manifest/index.js";
|
|
3
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
4
4
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
5
5
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
//#region src/config/agent-profile.ts
|
|
@@ -7,8 +7,8 @@ import { SlotRegistry, getSlotRegistry, registerSlotType } from "../slots.js";
|
|
|
7
7
|
import { ExtensionDiagnostics, ExtensionLoaderCacheImpl, getExtensionCache, getExtensionDiagnostics } from "../diagnostics.js";
|
|
8
8
|
import "../loader.js";
|
|
9
9
|
import { ExtensionHookRunner, createHookContext, isHookEvent } from "../hooks.js";
|
|
10
|
-
import { defineChannelPluginEntry } from "./channel-entry.js";
|
|
11
10
|
import { registerExtensionCliProgram } from "./channel-helpers.js";
|
|
11
|
+
import { defineChannelPluginEntry } from "./channel-entry.js";
|
|
12
12
|
import { lazyFunction, lazyModule } from "./lazy.js";
|
|
13
13
|
import { createMockExtensionApi, createTestGateway } from "./testing.js";
|
|
14
14
|
//#region src/extensions/sdk/index.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
1
|
import { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
|
+
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
3
3
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readLocalAppAcceptanceConfig } from "../../../local-apps/acceptance.js";
|
|
2
|
-
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
3
2
|
import { LOCAL_APP_RUNTIME_BRIDGE_HASH, injectLocalAppRuntimeBridge } from "../../../local-apps/preview-runtime-bridge.js";
|
|
3
|
+
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
4
4
|
import { relative, resolve } from "node:path";
|
|
5
5
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/gateway/hono/routes/local-apps.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../../../package-version.js";
|
|
2
2
|
import { loadConfig } from "../../../config/loader.js";
|
|
3
3
|
import "../../../config/index.js";
|
|
4
|
-
import { acquireUpdateLock } from "../../../infra/update-lock.js";
|
|
5
4
|
import { normalizeUpdateChannel } from "../../../infra/update-channels.js";
|
|
5
|
+
import { acquireUpdateLock } from "../../../infra/update-lock.js";
|
|
6
|
+
import { formatUpdateApiResult, runGatewayUpdateWithPostSteps } from "../../../infra/update-runner.js";
|
|
6
7
|
import { getUpdateAvailable, runGatewayUpdateCheck } from "../../../infra/update-startup.js";
|
|
7
8
|
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
8
|
-
import { formatUpdateApiResult, runGatewayUpdateWithPostSteps } from "../../../infra/update-runner.js";
|
|
9
9
|
import { streamSSE } from "hono/streaming";
|
|
10
10
|
//#region src/gateway/hono/routes/update.ts
|
|
11
11
|
init_package_version();
|
|
@@ -7,9 +7,9 @@ import { messagesToClientHistory } from "../../../session/client-history.js";
|
|
|
7
7
|
import "../../../workflows/domain/index.js";
|
|
8
8
|
import { resolveWorkflowRunArtifactsDir } from "../../../workflows/store/paths.js";
|
|
9
9
|
import { WorkflowDraftService } from "../../../workflows/draft/workflow-draft-service.js";
|
|
10
|
-
import "../../../workflows/draft/index.js";
|
|
11
10
|
import { WorkflowDraftConflictError, WorkflowDraftStore } from "../../../workflows/authoring/workflow-draft-store.js";
|
|
12
11
|
import "../../../workflows/authoring/index.js";
|
|
12
|
+
import "../../../workflows/draft/index.js";
|
|
13
13
|
import { basename, join } from "node:path";
|
|
14
14
|
import { readFile, stat } from "node:fs/promises";
|
|
15
15
|
//#region src/gateway/hono/routes/workflows.ts
|
|
@@ -3,6 +3,7 @@ import { defaultGatewayBindMode, isContainerEnvironment, resolveGatewayBindHost,
|
|
|
3
3
|
import { buckets } from "./rate-limit/buckets.js";
|
|
4
4
|
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
5
5
|
import "./rate-limit/index.js";
|
|
6
|
+
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
6
7
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
7
8
|
import { resolveGatewayListenHost, resolveGatewayListenPlan } from "./listen.js";
|
|
8
9
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
@@ -12,7 +13,6 @@ import { createHonoApp } from "./hono/app.js";
|
|
|
12
13
|
import { GatewayServer } from "./server.js";
|
|
13
14
|
import { GatewayLockError, acquireGatewayLock } from "./lock.js";
|
|
14
15
|
import { runGatewayLoop } from "./run-loop.js";
|
|
15
|
-
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
16
16
|
import { apiError, apiOk } from "./protocol.js";
|
|
17
17
|
import "./hono/index.js";
|
|
18
18
|
import { assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, isInsecurePrivateWsAllowed, isSecureWebSocketUrl } from "./ws-security.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { loadConfig } from "../config/loader.js";
|
|
2
2
|
import "../config/index.js";
|
|
3
3
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
4
|
+
import { consumeGatewayRestartIntentSync, consumeGatewaySigusr1RestartAuthorization, isGatewaySigusr1RestartExternallyAllowed, resetGatewayRestartStateForInProcessRestart, scheduleGatewaySigusr1Restart, setGatewaySigusr1RestartPolicy } from "../infra/restart.js";
|
|
4
5
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
5
6
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
6
7
|
import { acquireGatewayLock } from "./lock.js";
|
|
7
|
-
import { consumeGatewayRestartIntentSync, consumeGatewaySigusr1RestartAuthorization, isGatewaySigusr1RestartExternallyAllowed, resetGatewayRestartStateForInProcessRestart, scheduleGatewaySigusr1Restart, setGatewaySigusr1RestartPolicy } from "../infra/restart.js";
|
|
8
8
|
//#region src/gateway/run-loop.ts
|
|
9
9
|
/**
|
|
10
10
|
* Gateway Run Loop - Core run loop for gateway process management
|
|
@@ -33,6 +33,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
33
33
|
let taskRun;
|
|
34
34
|
let taskRunStatus = "failed";
|
|
35
35
|
let taskRunSummary = "Agent run ended unexpectedly";
|
|
36
|
+
let terminalStatus = "error";
|
|
36
37
|
let webchatSessionKey;
|
|
37
38
|
let webchatSessionId;
|
|
38
39
|
let webchatMetadata;
|
|
@@ -107,8 +108,8 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
107
108
|
yield event;
|
|
108
109
|
}
|
|
109
110
|
};
|
|
110
|
-
yield* emitAndYield(mapper.start());
|
|
111
111
|
try {
|
|
112
|
+
yield* emitAndYield(mapper.start());
|
|
112
113
|
if (channel === "webchat" && webchatSessionKey) {
|
|
113
114
|
const sessionKey = webchatSessionKey;
|
|
114
115
|
updateAsyncLogContext({
|
|
@@ -139,16 +140,10 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
139
140
|
const endStatus = mergedSignal.aborted ? "cancelled" : "success";
|
|
140
141
|
const endSummary = mergedSignal.aborted ? "Interrupted" : "Message processed successfully";
|
|
141
142
|
taskRunStatus = mergedSignal.aborted ? "cancelled" : "succeeded";
|
|
143
|
+
terminalStatus = endStatus;
|
|
142
144
|
taskRunSummary = endSummary;
|
|
143
145
|
yield* emitAndYield(mapper.end(endStatus, endSummary));
|
|
144
146
|
completeRealtimeTopic(`run:${runId}`);
|
|
145
|
-
try {
|
|
146
|
-
const metaAfter = await sessionIndex.getSessionMetadata(sessionKey);
|
|
147
|
-
if (metaAfter?.name) emit("session.updated", {
|
|
148
|
-
key: sessionKey,
|
|
149
|
-
name: metaAfter.name
|
|
150
|
-
});
|
|
151
|
-
} catch {}
|
|
152
147
|
return {
|
|
153
148
|
status: mergedSignal.aborted ? "aborted" : "ok",
|
|
154
149
|
summary: mergedSignal.aborted ? "Interrupted" : "Message processed successfully"
|
|
@@ -165,6 +160,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
165
160
|
}, `Agent processing failed: ${em}`);
|
|
166
161
|
streamError = em;
|
|
167
162
|
taskRunStatus = "failed";
|
|
163
|
+
terminalStatus = "error";
|
|
168
164
|
taskRunSummary = em;
|
|
169
165
|
const errorContent = formatAgentRunErrorForClient(streamError);
|
|
170
166
|
yield* emitAndYield(mapper.error(errorContent));
|
|
@@ -278,6 +274,23 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
278
274
|
runId
|
|
279
275
|
}, `Task run finalization failed: ${errorMessage}`);
|
|
280
276
|
}
|
|
277
|
+
if (webchatSessionKey) {
|
|
278
|
+
const metaAfter = await sessionIndex.getSessionMetadata(webchatSessionKey).catch(() => void 0);
|
|
279
|
+
if (metaAfter?.name) emit("session.updated", {
|
|
280
|
+
key: webchatSessionKey,
|
|
281
|
+
name: metaAfter.name
|
|
282
|
+
});
|
|
283
|
+
emit("agent.run.ended", {
|
|
284
|
+
schemaVersion: 1,
|
|
285
|
+
runId,
|
|
286
|
+
sessionKey: webchatSessionKey,
|
|
287
|
+
status: terminalStatus,
|
|
288
|
+
completedAtMs: Date.now(),
|
|
289
|
+
route: `/chat/${encodeURIComponent(webchatSessionKey)}`,
|
|
290
|
+
source: "webchat",
|
|
291
|
+
...metaAfter?.name?.trim() ? { sessionTitle: metaAfter.name.trim().slice(0, 100) } : {}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
281
294
|
}
|
|
282
295
|
}
|
|
283
296
|
//#endregion
|
|
@@ -48,9 +48,6 @@ import { MessageBus, MessageBusShutdownError } from "../infra/bus/queue.js";
|
|
|
48
48
|
import "../infra/bus/index.js";
|
|
49
49
|
import { AgentService } from "../agent/service.js";
|
|
50
50
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
51
|
-
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
52
|
-
import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
53
|
-
import { ChannelManager } from "../channels/manager.js";
|
|
54
51
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
55
52
|
import "../config/index.js";
|
|
56
53
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
@@ -66,6 +63,12 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
66
63
|
import "../discussions/index.js";
|
|
67
64
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
68
65
|
import "../endpoint-tools/index.js";
|
|
66
|
+
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
67
|
+
import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
68
|
+
import { ChannelManager } from "../channels/manager.js";
|
|
69
|
+
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
70
|
+
import { LocalAppService } from "../local-apps/service.js";
|
|
71
|
+
import "../local-apps/index.js";
|
|
69
72
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
70
73
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
71
74
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -85,8 +88,6 @@ import { auditGatewayConfig } from "./security/audit.js";
|
|
|
85
88
|
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
86
89
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
87
90
|
import { MobileNotificationService } from "../mobile/notification-service.js";
|
|
88
|
-
import { LocalAppService } from "../local-apps/service.js";
|
|
89
|
-
import "../local-apps/index.js";
|
|
90
91
|
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
91
92
|
import "../browser/recipes/index.js";
|
|
92
93
|
import { mapProductEventToProactive } from "../proactive/events/product-event-bridge.js";
|
|
@@ -98,7 +99,6 @@ import { ProactiveTemporalWorker } from "../proactive/temporal/worker.js";
|
|
|
98
99
|
import { ProactiveInboxService } from "../proactive/inbox/service.js";
|
|
99
100
|
import { ProactiveInboxWorker } from "../proactive/inbox/worker.js";
|
|
100
101
|
import "../proactive/index.js";
|
|
101
|
-
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
102
102
|
import { resolveChannelConnectDeferSet } from "./resolve-channel-connect-defer.js";
|
|
103
103
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
104
104
|
import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
@@ -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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listPortListeners } from "../gateway/ports.js";
|
|
2
1
|
import { isGatewayArgv, parseProcCmdline } from "./gateway-process-argv.js";
|
|
2
|
+
import { listPortListeners } from "../gateway/ports.js";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
//#region src/infra/gateway-processes.ts
|
|
@@ -4,8 +4,8 @@ import { init_paths, resolveConfigPath } from "../config/paths.js";
|
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
5
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
6
6
|
import { resolveGatewayService } from "../daemon/service.js";
|
|
7
|
-
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
8
7
|
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
8
|
+
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
9
9
|
import { refreshGatewayServiceAfterUpdate } from "./update-service-refresh.js";
|
|
10
10
|
//#region src/infra/update-restart.ts
|
|
11
11
|
init_loader();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
2
|
-
import "./update-channels.js";
|
|
3
|
-
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
4
2
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
5
3
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
6
4
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
|
7
5
|
import { runGlobalPackageUpdateSteps } from "./package-update-steps.js";
|
|
8
6
|
import { resolveStableNodePath } from "./stable-node-path.js";
|
|
7
|
+
import "./update-channels.js";
|
|
8
|
+
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
9
9
|
import { trimLogTail } from "./update-log.js";
|
|
10
10
|
import { maybeRestartGatewayAfterUpdate } from "./update-restart.js";
|
|
11
11
|
import path from "node:path";
|
|
@@ -3,9 +3,9 @@ import { init_paths_state, resolveUpdateCheckStatePath } from "../config/paths-s
|
|
|
3
3
|
import { createLogger } from "../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../utils/logger.js";
|
|
5
5
|
import { init_write_file_atomic, writeTextAtomic } from "./write-file-atomic.js";
|
|
6
|
-
import { acquireUpdateLock } from "./update-lock.js";
|
|
7
6
|
import { normalizeUpdateChannel } from "./update-channels.js";
|
|
8
7
|
import { compareSemver, detectInstallKind, resolveNpmChannelTag, resolvePackageRoot } from "./update-check.js";
|
|
8
|
+
import { acquireUpdateLock } from "./update-lock.js";
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
//#region src/infra/update-startup.ts
|