@xopcai/xopc 0.0.169 → 0.0.170
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/{activity-store-DumQD8EX.js → activity-store-CkUp1qvf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CNI1HQdV.js → agent-avatar-dicebear-DDuem4HM.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-DfpeWAnu.js → agents-BiaQhiQp.js} +1 -1
- package/dist/gateway/static/root/assets/{api-D7eNcGmE.js → api-BnuPQhJW.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BPbnbnFn.js → app-management-settings-panel-DdZw8Hi1.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-WWFCDver.js → appearance-settings-BN8Vk2bX.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-B27faKqW.js → apps-page-CuL8Q4yF.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Cu2dsFtI.js → archive-plugin-C82MaDQj.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-C9mycbtr.js → attachment-load-uilrwSdW.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DtHqVViI.js → automation-suggestion-card-CkDZjAmy.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BoH5grBX.js → automations-page-TZOluRNp.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DqrPRyjm.js → binary-plugins-B7NTL0_T.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9dc3pqc.js → block-editor-D_LDNlB-.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CK2fnxHY.js → browser-settings-page-C-l6O68Z.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-70k5yvTc.js → browser-workflow-inputs-UFVUzn4v.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DBNuaWwR.js → browser-workflows-page-CGgC0N92.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-gg9GXU00.js → capabilities-settings-panel-BW8c0xPp.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-CvV4M4Oe.js → capability-presets-api-DUIorGUd.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-A1qGVyll.js → capability-presets-settings-panel-PTz00nR4.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-BnLOBd7v.js → channel-recipient-api-BYwSB8c6.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-H4vCzqiD.js → channels-settings-h9CsE0GT.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-C058Mcfr.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CYQPu4Nn.js → connector-logo-CsbegNqi.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DphVkloc.js → connectors-page-BWALafGW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Deb8fsr-.js → desktop-pet-CkT98fPT.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DHTY5Ku1.js → desktop-pet-settings-DkbIzdA3.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-cGL2aEB6.js → directory-picker-path-field-dBQvj1sG.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-C2XF2wL4.js → dreaming-settings-DkdnKMZx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-F8AzDx0d.js → extension-debug-page-BfxoIiNo.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-ZrX_Ge87.js → extension-page-EIJ3wIb7.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-VypAD6ok.js → extension-settings-page-DBBec51N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-C-UsxEKi.js → gateway-config-api-4_u53Ufq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-ChG26Coy.js → gateway-settings-v9kJM59H.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D73V3EVy.js → gateway-startup-retry-CXITih5d.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-B6aBG2KK.js → goal-create-dialog-y2Y3p7_k.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-B_G9oVL1.js → goal-detail-page-DuzL-alv.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-fv7JLhjy.js → goals-config-api-D54YQPon.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BQmg_7aD.js → goals-page-OeLtfKI2.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DlfyneMz.js → goals-settings-DDezXaVi.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BPyFbSbh.js → heartbeat-settings-CRsIUeZN.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-CSKX7PsM.js → image-generation-api-CY6cQUHL.js} +1 -1
- package/dist/gateway/static/root/assets/{index-DJtuKve9.js → index-Dfq2laZe.js} +83 -70
- package/dist/gateway/static/root/assets/index-o4uaOGKT.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BUxrnWH_.js → keyboard-shortcuts-settings-D9k7EDdY.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Dzlj4fH8.js → local-app-workbench-page-3ssYIEK6.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BsZMeDnS.js → local-apps-page-DbaiBolh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DXq-Y8Bi.js → locale-store-Dqp9H2Uf.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-Bg1B-cKU.js → logs-page-DoCY0Mm9.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Cmaw70yM.js → markdown-split-BGlQR-Be.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Blqj_oJD.js → media-plugins-BpaeV6f_.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-Cj_n7gUv.js → messages-KEk-hTFt.js} +2 -2
- package/dist/gateway/static/root/assets/{notes-page-B6Fdlf_s.js → notes-page-Cd2HpciM.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-4HYPR6Hb.js → notes-workbench-CatZNAPc.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-D6zFoyJY.js → page-tabs-DyimBUp_.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BLoo7Ad8.js → preview-open-alternatives-BKZulEYr.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-0-tt2dp7.js → product-open-page-Bjz9BxBY.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DJUOgqm4.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-BXmIeErj.js → projects-page-BQQAD_nu.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-bxrIHaRt.js → remote-access-hub-fIGXTTnA.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-9ujl7LRy.js → save-bar-controls-BPTqb2_r.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-e80Mj-0z.js → schedule-field-YN0D81Dk.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DYZQD-PL.js → schema-form-BmY5PSS2.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-D_7ms_LG.js → sessions-page-BuU-8FCe.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DlKoeZm3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Clt3p-mk.js → settings-form-section-B-RhgD_p.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CTuS66nC.js → settings-loading-skeleton-DkPupX2B.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CMP_owwc.js → settings-page-2QBMvaxj.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BWUV_wx6.js → settings-page-layout-CtrW-LD6.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CAClgrxi.js → setup-status-panel-BSUcDFnb.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-tISZJtRK.js → share-preview-page-BezIW1n9.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-t-hP0QDv.js → shares-settings-Bk2-SwGJ.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-e_Fx1kVC.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C6CXLWnN.js → skills-page-D_cCADfj.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-6u0k0wJi.js → system-settings-panel-WAFhKyAu.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DSpAOJ9G.js → theme-store-BiC0gIBa.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-BF3f8el1.js → time-picker-fqRXpNJV.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-CyRCjjGS.js → typed-models-lib-WAQO3F_8.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-B_Igd7ec.js → use-channel-catalog-CKlfsSeU.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-B3zeQLeM.js → user-context-page-9Ov4htPW.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BanJk_cf.js → voice-api-key-field-BAFHF0_v.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BCANmOUS.js → work-discovery-page-DGN2FxWv.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-t5xiIEFv.js → work-item-detail-page-HmyWSgUo.js} +1 -1
- package/dist/gateway/static/root/assets/work-page-D3iKVjFq.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DCXTQx7p.js → workflow-run-setup-panel-1OP4HyvS.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-B5L4SFw4.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/service/process-direct-one-shot.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +2 -1
- package/dist/src/agent/workflow/builtins/index.js +2 -2
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/cli/commands/onboard/model.d.ts +2 -0
- package/dist/src/cli/commands/onboard/model.js +16 -3
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +2 -4
- package/dist/src/config/schema.js +1 -2
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +13 -2
- package/dist/src/gateway/service/sessions-api.js +2 -2
- package/dist/src/session/reset-policy.js +3 -5
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +19 -8
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -3
- package/dist/src/storage/sqlite/transcript-repository.js +31 -22
- package/dist/src/workflows/domain/result.d.ts +4 -15
- package/dist/src/workflows/engine/workflow-engine.js +5 -14
- package/dist/src/workflows/runtime/graph-workflow-runtime.js +7 -11
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
- package/dist/src/workflows/store/run-index-store.js +1 -6
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DtswVkDX.js +0 -1
- package/dist/gateway/static/root/assets/index-DfE2j0g8.css +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CGa68F1d.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-VLuu9WHc.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CYRaxTqs.js +0 -1
- package/dist/gateway/static/root/assets/work-page-CEI3zs-y.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B8FRLCHp.js +0 -11
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260713-1" />
|
|
13
13
|
<title>XOPC — Turn goals into loops. Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-Dfq2laZe.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/circle-alert-BEjgurr2.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/assets/messages-
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/locale-store-
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/assets/messages-KEk-hTFt.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-Dqp9H2Uf.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/schemas-DgQq6Z5S.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/product-delivery-BTRT9kCS.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
34
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-
|
|
35
|
-
<link rel="modulepreload" crossorigin href="/assets/activity-store-
|
|
36
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-store-
|
|
37
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-CXITih5d.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-CkUp1qvf.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-BiC0gIBa.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="/assets/index-o4uaOGKT.css">
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { buildMemoryRuntime } from "../../../agent-runtime/memory-runtime.js";
|
|
2
1
|
import { DEFAULT_DEEP_CRON, DEFAULT_LIGHT_CRON, DEFAULT_REM_CRON } from "./constants.js";
|
|
2
|
+
import { buildMemoryRuntime } from "../../../agent-runtime/memory-runtime.js";
|
|
3
3
|
//#region src/agent/memory/dreaming/config.ts
|
|
4
4
|
function clampScore(value, fallback) {
|
|
5
5
|
if (!Number.isFinite(value)) return fallback;
|
|
@@ -17,7 +17,8 @@ async function runProcessDirect(deps, input) {
|
|
|
17
17
|
cfg: deps.config,
|
|
18
18
|
sessionKey: input.sessionKey,
|
|
19
19
|
body: input.content,
|
|
20
|
-
resetSession: deps.resetSession
|
|
20
|
+
resetSession: deps.resetSession,
|
|
21
|
+
skipImplicitExpiry: channel === "webchat"
|
|
21
22
|
});
|
|
22
23
|
resetTriggeredAtInit = turn.resetTriggered;
|
|
23
24
|
if (turn.bareReset && turn.ackMessage) return turn.ackMessage;
|
|
@@ -154,7 +154,8 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
154
154
|
cfg,
|
|
155
155
|
sessionKey,
|
|
156
156
|
body: input.content,
|
|
157
|
-
resetSession: deps.resetSession
|
|
157
|
+
resetSession: deps.resetSession,
|
|
158
|
+
skipImplicitExpiry: channel === "webchat"
|
|
158
159
|
});
|
|
159
160
|
resetTriggeredAtInit = turn.resetTriggered;
|
|
160
161
|
if (turn.bareReset && turn.ackMessage) {
|
|
@@ -230,12 +230,12 @@ function createParallelGraph(spec) {
|
|
|
230
230
|
{
|
|
231
231
|
id: "output",
|
|
232
232
|
kind: "output",
|
|
233
|
-
title: "
|
|
233
|
+
title: "Deliverable",
|
|
234
234
|
position: {
|
|
235
235
|
x: 1280,
|
|
236
236
|
y: 260
|
|
237
237
|
},
|
|
238
|
-
config: {
|
|
238
|
+
config: {}
|
|
239
239
|
}
|
|
240
240
|
],
|
|
241
241
|
edges: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { buildMemoryRuntime } from "./memory-runtime.js";
|
|
1
2
|
import { checkBoundary } from "./boundary-guard.js";
|
|
2
3
|
import { resolveModelRole } from "./model-router.js";
|
|
3
4
|
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";
|
|
3
4
|
import { checkBoundary } from "./boundary-guard.js";
|
|
4
5
|
import { resolveModelRole } from "./model-router.js";
|
|
5
6
|
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) {
|
|
@@ -2,5 +2,7 @@
|
|
|
2
2
|
* Catalog-driven model configuration for onboarding.
|
|
3
3
|
*/
|
|
4
4
|
import type { Config } from '../../../config/schema.js';
|
|
5
|
+
import { XopcCloudModelSource } from '../../../providers/xopc-cloud-model-source.js';
|
|
5
6
|
import type { CLIContext } from '../../registry.js';
|
|
7
|
+
export declare function refreshOnboardModelCatalogIfNeeded(provider: string, hasCatalogModels: boolean, source?: Pick<XopcCloudModelSource, 'refresh'>): Promise<void>;
|
|
6
8
|
export declare function setupModel(existingConfig: Config | null, ctx: CLIContext): Promise<Config>;
|
|
@@ -9,6 +9,7 @@ import { getDomesticProviderBaseUrl, getDomesticProviderPreset, getDomesticProvi
|
|
|
9
9
|
import { getProviderHint, getRecommendedModelsForProvider, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
10
10
|
import { prepareUpdateGlobalDefaults } from "../../../gateway/global-defaults-admin.js";
|
|
11
11
|
import { discoverProviderModels, isProviderApiDiscoverable } from "../../../providers/model-discovery.js";
|
|
12
|
+
import { XopcCloudModelSource } from "../../../providers/xopc-cloud-model-source.js";
|
|
12
13
|
import { listProfilesForProvider } from "../../../auth/profiles/profiles.js";
|
|
13
14
|
import { getOAuthProvider } from "../../utils/oauth-providers.js";
|
|
14
15
|
import { colors } from "../../utils/colors.js";
|
|
@@ -89,6 +90,13 @@ function getModelsForProvider(provider) {
|
|
|
89
90
|
};
|
|
90
91
|
});
|
|
91
92
|
}
|
|
93
|
+
async function refreshOnboardModelCatalogIfNeeded(provider, hasCatalogModels, source) {
|
|
94
|
+
if (provider !== "xopc-cloud" || hasCatalogModels) return;
|
|
95
|
+
console.log("\n→ Loading models from XOPC Model Service...");
|
|
96
|
+
const result = await (source ?? new XopcCloudModelSource()).refresh();
|
|
97
|
+
if (result.status === "skipped") throw new Error("XOPC Model Service credentials are unavailable after OAuth login. Please sign in again.");
|
|
98
|
+
console.log(colors.green(`✓ Loaded ${result.modelCount} models`));
|
|
99
|
+
}
|
|
92
100
|
function discoveredModelsToChoices(provider, models) {
|
|
93
101
|
return models.filter((model) => !model.id.includes("/")).map((model) => ({
|
|
94
102
|
value: `${provider}/${model.id}`,
|
|
@@ -445,8 +453,13 @@ async function setupModel(existingConfig, ctx) {
|
|
|
445
453
|
console.error(`\n❌ Could not configure credentials for ${providerName}.`);
|
|
446
454
|
return config;
|
|
447
455
|
}
|
|
448
|
-
|
|
449
|
-
|
|
456
|
+
let modelChoices = getModelsForProvider(provider);
|
|
457
|
+
await refreshOnboardModelCatalogIfNeeded(provider, modelChoices.length > 0);
|
|
458
|
+
modelChoices = getModelsForProvider(provider);
|
|
459
|
+
if (modelChoices.length === 0) {
|
|
460
|
+
if (provider === "xopc-cloud") throw new Error(`No models are currently available for ${providerName}.`);
|
|
461
|
+
throw new Error(`No catalog models found for ${providerName}. Add a Custom API provider instead.`);
|
|
462
|
+
}
|
|
450
463
|
console.log(`\n📋 Models for ${providerName}:`);
|
|
451
464
|
const model = await select({
|
|
452
465
|
message: "Model:",
|
|
@@ -459,4 +472,4 @@ async function setupModel(existingConfig, ctx) {
|
|
|
459
472
|
return setPrimaryModel(config, ctx.workspacePath, model);
|
|
460
473
|
}
|
|
461
474
|
//#endregion
|
|
462
|
-
export { setupModel };
|
|
475
|
+
export { refreshOnboardModelCatalogIfNeeded, setupModel };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
1
2
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
3
|
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
|
|
@@ -460,7 +460,6 @@ export declare const SessionConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
460
460
|
}>>;
|
|
461
461
|
identityLinks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
462
462
|
resetTriggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
463
|
-
idleMinutes: z.ZodOptional<z.ZodNumber>;
|
|
464
463
|
reset: z.ZodOptional<z.ZodObject<{
|
|
465
464
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
466
465
|
idle: "idle";
|
|
@@ -507,7 +506,7 @@ export declare const SessionConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
507
506
|
pruneAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
508
507
|
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
509
508
|
}, z.core.$strip>>;
|
|
510
|
-
}, z.core.$
|
|
509
|
+
}, z.core.$strict>>;
|
|
511
510
|
/** Channel buckets — shapes validated post-parse by registered channel plugins. */
|
|
512
511
|
export declare const ChannelsConfigSchema: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
513
512
|
export declare const SearchProviderEntrySchema: z.ZodObject<{
|
|
@@ -1905,7 +1904,6 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1905
1904
|
}>>;
|
|
1906
1905
|
identityLinks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
1907
1906
|
resetTriggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1908
|
-
idleMinutes: z.ZodOptional<z.ZodNumber>;
|
|
1909
1907
|
reset: z.ZodOptional<z.ZodObject<{
|
|
1910
1908
|
mode: z.ZodOptional<z.ZodEnum<{
|
|
1911
1909
|
idle: "idle";
|
|
@@ -1952,7 +1950,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1952
1950
|
pruneAfterMs: z.ZodOptional<z.ZodNumber>;
|
|
1953
1951
|
maxEntries: z.ZodOptional<z.ZodNumber>;
|
|
1954
1952
|
}, z.core.$strip>>;
|
|
1955
|
-
}, z.core.$
|
|
1953
|
+
}, z.core.$strict>>;
|
|
1956
1954
|
channels: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1957
1955
|
gateway: z.ZodDefault<z.ZodObject<{
|
|
1958
1956
|
bind: z.ZodOptional<z.ZodEnum<{
|
|
@@ -263,12 +263,11 @@ var init_schema = __esmMin((() => {
|
|
|
263
263
|
dmScope: SessionDmScopeSchema.default("main"),
|
|
264
264
|
identityLinks: z.record(z.string(), z.array(z.string())).optional(),
|
|
265
265
|
resetTriggers: z.array(z.string()).optional(),
|
|
266
|
-
idleMinutes: z.number().int().positive().optional(),
|
|
267
266
|
reset: SessionResetConfigSchema.optional(),
|
|
268
267
|
resetByType: SessionResetByTypeSchema.optional(),
|
|
269
268
|
resetByChannel: z.record(z.string(), SessionResetConfigSchema).optional(),
|
|
270
269
|
storage: SessionStorageConfigSchema.optional()
|
|
271
|
-
}).default({
|
|
270
|
+
}).strict().default({
|
|
272
271
|
scope: "per-sender",
|
|
273
272
|
mainKey: "main",
|
|
274
273
|
dmScope: "main"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
+
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
3
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { WORKSPACE_FILES, init_paths, resolveUserProfilePath } from "../config/paths.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
@@ -35,6 +35,10 @@ function parseOffset(value) {
|
|
|
35
35
|
const parsed = value ? Number.parseInt(value, 10) : 0;
|
|
36
36
|
return Number.isFinite(parsed) ? Math.max(0, parsed) : 0;
|
|
37
37
|
}
|
|
38
|
+
function isHistoryCursor(value) {
|
|
39
|
+
if (!/^(0|[1-9]\d*)$/.test(value)) return false;
|
|
40
|
+
return Number.isSafeInteger(Number(value));
|
|
41
|
+
}
|
|
38
42
|
function buildDirectSessionMetadata(params) {
|
|
39
43
|
return {
|
|
40
44
|
sourceChannel: params.source,
|
|
@@ -268,7 +272,12 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
268
272
|
const limitRaw = c.req.query("limit");
|
|
269
273
|
const parsedLimit = limitRaw ? Number.parseInt(limitRaw, 10) : void 0;
|
|
270
274
|
const limit = parsedLimit !== void 0 && Number.isFinite(parsedLimit) ? Math.min(500, Math.max(1, parsedLimit)) : void 0;
|
|
271
|
-
const
|
|
275
|
+
const beforeRaw = c.req.query("before");
|
|
276
|
+
const before = beforeRaw?.trim();
|
|
277
|
+
if (beforeRaw !== void 0 && (!before || !isHistoryCursor(before))) return c.json({
|
|
278
|
+
ok: false,
|
|
279
|
+
error: "Invalid session history cursor"
|
|
280
|
+
}, 400);
|
|
272
281
|
const offsetRaw = c.req.query("offset");
|
|
273
282
|
const parsedOffset = offsetRaw ? Number.parseInt(offsetRaw, 10) : 0;
|
|
274
283
|
const offset = Number.isFinite(parsedOffset) ? Math.max(0, parsedOffset) : 0;
|
|
@@ -294,7 +303,9 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
294
303
|
const key = c.req.param("key");
|
|
295
304
|
const offsetRaw = c.req.query("offset");
|
|
296
305
|
const limitRaw = c.req.query("limit");
|
|
297
|
-
const
|
|
306
|
+
const beforeRaw = c.req.query("before");
|
|
307
|
+
const before = beforeRaw?.trim();
|
|
308
|
+
if (beforeRaw !== void 0 && (!before || !isHistoryCursor(before))) return c.json({ error: "Invalid session history cursor" }, 400);
|
|
298
309
|
const parsedOffset = offsetRaw ? Number.parseInt(offsetRaw, 10) : 0;
|
|
299
310
|
const parsedLimit = limitRaw ? Number.parseInt(limitRaw, 10) : 50;
|
|
300
311
|
const offset = Number.isFinite(parsedOffset) ? Math.max(0, parsedOffset) : 0;
|
|
@@ -53,11 +53,11 @@ var GatewaySessionsApi = class {
|
|
|
53
53
|
}
|
|
54
54
|
async getTimeline(key) {
|
|
55
55
|
if (!await this.opts.sessionIndex.getSessionMetadata(key)) return null;
|
|
56
|
-
return buildSessionTimeline(await this.opts.sessionIndex.getStore().
|
|
56
|
+
return buildSessionTimeline(await this.opts.sessionIndex.getStore().loadTranscriptHistoryRows(key));
|
|
57
57
|
}
|
|
58
58
|
async getTranscriptWindow(key, options) {
|
|
59
59
|
if (!await this.opts.sessionIndex.getSessionMetadata(key)) return null;
|
|
60
|
-
const rows = await this.opts.sessionIndex.getStore().
|
|
60
|
+
const rows = await this.opts.sessionIndex.getStore().loadTranscriptHistoryRows(key);
|
|
61
61
|
const totalRows = rows.length;
|
|
62
62
|
if (totalRows === 0) return {
|
|
63
63
|
messages: [],
|
|
@@ -14,12 +14,10 @@ function resolveSessionResetPolicy(params) {
|
|
|
14
14
|
const sessionCfg = params.sessionCfg;
|
|
15
15
|
const baseReset = params.resetOverride ?? sessionCfg?.reset;
|
|
16
16
|
const typeReset = params.resetOverride ? void 0 : sessionCfg?.resetByType?.[params.resetType];
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const configured = Boolean(baseReset || typeReset || legacyIdleMinutes != null);
|
|
20
|
-
const mode = typeReset?.mode ?? baseReset?.mode ?? (!hasExplicitReset && legacyIdleMinutes != null ? "idle" : "daily");
|
|
17
|
+
const configured = Boolean(baseReset || typeReset);
|
|
18
|
+
const mode = typeReset?.mode ?? baseReset?.mode ?? "daily";
|
|
21
19
|
const atHour = normalizeResetAtHour(typeReset?.atHour ?? baseReset?.atHour ?? 4);
|
|
22
|
-
const idleMinutesRaw = typeReset?.idleMinutes ?? baseReset?.idleMinutes
|
|
20
|
+
const idleMinutesRaw = typeReset?.idleMinutes ?? baseReset?.idleMinutes;
|
|
23
21
|
let idleMinutes;
|
|
24
22
|
if (idleMinutesRaw != null) {
|
|
25
23
|
const normalized = Math.floor(idleMinutesRaw);
|
|
@@ -60,6 +60,7 @@ export declare class SessionStore {
|
|
|
60
60
|
} | null>;
|
|
61
61
|
private buildSessionDetail;
|
|
62
62
|
loadTranscriptRows(key: string): Promise<TranscriptStoredRow[]>;
|
|
63
|
+
loadTranscriptHistoryRows(key: string): Promise<TranscriptStoredRow[]>;
|
|
63
64
|
getMetadata(key: string): Promise<SessionMetadata | null>;
|
|
64
65
|
resolveKeyBySessionId(sessionId: string): Promise<string | null>;
|
|
65
66
|
updateMetadata(key: string, updates: Partial<SessionMetadata>): Promise<void>;
|
|
@@ -6,7 +6,7 @@ import "./types.js";
|
|
|
6
6
|
import { buildSessionContextForLlm, buildSessionDisplayMessages, mergeLlmMessagesPreservingContextRows, transcriptRowsFromJsonArray } from "./session-context-for-llm.js";
|
|
7
7
|
import { estimateTokensFromMessages } from "../storage/sqlite/row-mappers.js";
|
|
8
8
|
import { deleteSessionRecord, ensureSessionRecord, findSessionKeyBySessionId, getGlobalSessionStats, getSessionMetadata, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, resetSessionRecord } from "../storage/sqlite/session-repository.js";
|
|
9
|
-
import { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint } from "../storage/sqlite/transcript-repository.js";
|
|
9
|
+
import { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint } from "../storage/sqlite/transcript-repository.js";
|
|
10
10
|
import "../storage/sqlite/index.js";
|
|
11
11
|
import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
|
|
12
12
|
import { readPostCompactionContext } from "../agent/reply/post-compaction-context.js";
|
|
@@ -87,14 +87,15 @@ var SessionStore = class {
|
|
|
87
87
|
if (!metadata) return null;
|
|
88
88
|
const limit = Math.min(200, Math.max(1, Math.trunc(options.limit ?? 50)));
|
|
89
89
|
const offset = Math.max(0, Math.trunc(options.offset ?? 0));
|
|
90
|
-
const parsedBefore = options.before ?
|
|
91
|
-
const hasBeforeCursor = parsedBefore !== void 0
|
|
90
|
+
const parsedBefore = options.before === void 0 ? void 0 : parseHistoryBeforeIndex(options.before);
|
|
91
|
+
const hasBeforeCursor = parsedBefore !== void 0;
|
|
92
92
|
if (options.includeContextRows) {
|
|
93
93
|
const page = paginateTranscriptMessages(key, {
|
|
94
94
|
limit,
|
|
95
95
|
offset: hasBeforeCursor ? void 0 : offset,
|
|
96
|
-
|
|
97
|
-
includeContext: true
|
|
96
|
+
beforeIndex: hasBeforeCursor ? parsedBefore : void 0,
|
|
97
|
+
includeContext: true,
|
|
98
|
+
includeArchived: true
|
|
98
99
|
});
|
|
99
100
|
const messages = transcriptRowsToClientHistory(page.rows);
|
|
100
101
|
const endIndex = hasBeforeCursor ? Math.min(page.total, Math.max(0, parsedBefore)) : Math.max(0, page.total - offset);
|
|
@@ -121,7 +122,7 @@ var SessionStore = class {
|
|
|
121
122
|
const page = this.paginateDisplayMessages(displayMessages, {
|
|
122
123
|
limit,
|
|
123
124
|
offset: hasBeforeCursor ? void 0 : offset,
|
|
124
|
-
|
|
125
|
+
beforeIndex: hasBeforeCursor ? parsedBefore : void 0
|
|
125
126
|
});
|
|
126
127
|
const session = await this.buildSessionDetail(key, metadata, page.messages, options);
|
|
127
128
|
const nextBeforeCursor = page.startIndex > 0 ? String(page.startIndex) : void 0;
|
|
@@ -162,6 +163,10 @@ var SessionStore = class {
|
|
|
162
163
|
requireXopcDatabase();
|
|
163
164
|
return loadTranscriptRowsForSession(key);
|
|
164
165
|
}
|
|
166
|
+
async loadTranscriptHistoryRows(key) {
|
|
167
|
+
requireXopcDatabase();
|
|
168
|
+
return loadTranscriptHistoryRowsForSession(key);
|
|
169
|
+
}
|
|
165
170
|
async getMetadata(key) {
|
|
166
171
|
requireXopcDatabase();
|
|
167
172
|
return getSessionMetadata(key);
|
|
@@ -569,8 +574,8 @@ var SessionStore = class {
|
|
|
569
574
|
const offset = Math.max(0, Math.trunc(options.offset ?? 0));
|
|
570
575
|
let startIndex;
|
|
571
576
|
let endIndex;
|
|
572
|
-
if (options.
|
|
573
|
-
endIndex = Math.min(total, Math.max(0, Math.trunc(options.
|
|
577
|
+
if (options.beforeIndex !== void 0 && Number.isFinite(options.beforeIndex)) {
|
|
578
|
+
endIndex = Math.min(total, Math.max(0, Math.trunc(options.beforeIndex)));
|
|
574
579
|
startIndex = Math.max(0, endIndex - limit);
|
|
575
580
|
} else {
|
|
576
581
|
endIndex = Math.max(0, total - offset);
|
|
@@ -666,5 +671,11 @@ var SessionStore = class {
|
|
|
666
671
|
});
|
|
667
672
|
}
|
|
668
673
|
};
|
|
674
|
+
function parseHistoryBeforeIndex(value) {
|
|
675
|
+
if (!/^(0|[1-9]\d*)$/.test(value)) throw new Error("Invalid session history cursor");
|
|
676
|
+
const parsed = Number(value);
|
|
677
|
+
if (!Number.isSafeInteger(parsed)) throw new Error("Invalid session history cursor");
|
|
678
|
+
return parsed;
|
|
679
|
+
}
|
|
669
680
|
//#endregion
|
|
670
681
|
export { SessionStore };
|
|
@@ -12,7 +12,7 @@ export { completeTaskOutcome, findTaskOutcomeForAssistant, getTaskOutcome, listT
|
|
|
12
12
|
export { buildDefaultSessionMetadata, type SessionMetadataSeed, } from './session-metadata.js';
|
|
13
13
|
export { buildGlobalSessionStats, classifyStoredRow, estimateTokensFromMessages, extractFtsContent, metadataToSessionInsert, sessionConfigRowToConfig, sessionRowToMetadata, transcriptEntryRowToStoredRow, type SessionConfigRow, type SessionRow, type TranscriptEntryRow, } from './row-mappers.js';
|
|
14
14
|
export { deleteSessionRecord, ensureSessionRecord, getCurrentSessionId, getGlobalSessionStats, findSessionKeyBySessionId, getSessionPersistedLevels, getSessionMetadata, incrementSessionStatsOnAppend, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, resetSessionRecord, resolveSessionAgentId, updateSessionStats, } from './session-repository.js';
|
|
15
|
-
export { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint, } from './transcript-repository.js';
|
|
15
|
+
export { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint, } from './transcript-repository.js';
|
|
16
16
|
export { deleteNoteRecord, getNoteRecord, listNoteRecords, upsertNoteRecord, } from './notes-repository.js';
|
|
17
17
|
export { deleteNoteAgentContextRecord, getNoteAgentContextRecord, upsertNoteAgentContextRecord, type NoteAgentContextRecord, } from './note-agent-context-repository.js';
|
|
18
18
|
export { searchMemoryIndex, syncMemoryIndex, type MemorySearchHit, } from './memory-index-repository.js';
|
|
@@ -13,7 +13,7 @@ import { completeTaskOutcome, findTaskOutcomeForAssistant, getTaskOutcome, listT
|
|
|
13
13
|
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
14
14
|
import { buildGlobalSessionStats, classifyStoredRow, estimateTokensFromMessages, extractFtsContent, metadataToSessionInsert, sessionConfigRowToConfig, sessionRowToMetadata, transcriptEntryRowToStoredRow } from "./row-mappers.js";
|
|
15
15
|
import { deleteSessionRecord, ensureSessionRecord, findSessionKeyBySessionId, getCurrentSessionId, getGlobalSessionStats, getSessionMetadata, getSessionPersistedLevels, incrementSessionStatsOnAppend, listSessionMetadata, listSessionsByAgent, patchSessionMetadata, resetSessionRecord, resolveSessionAgentId, updateSessionStats } from "./session-repository.js";
|
|
16
|
-
import { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint } from "./transcript-repository.js";
|
|
16
|
+
import { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint } from "./transcript-repository.js";
|
|
17
17
|
import { deleteNoteRecord, getNoteRecord, listNoteRecords, upsertNoteRecord } from "./notes-repository.js";
|
|
18
18
|
import { deleteNoteAgentContextRecord, getNoteAgentContextRecord, upsertNoteAgentContextRecord } from "./note-agent-context-repository.js";
|
|
19
19
|
import { searchMemoryIndex, syncMemoryIndex } from "./memory-index-repository.js";
|
|
@@ -25,4 +25,4 @@ import { appendConnectorExecutionAudit, claimConnectorWebhookDelivery, completeC
|
|
|
25
25
|
import { getUserTrustPolicy, setUserTrustPolicy } from "./user-trust-repository.js";
|
|
26
26
|
import { consumeMemoryReferenceConsent, decideMemoryReferenceConsent, ensureMemoryReferenceConsentRequest, hasMemoryReferenceConsent, listMemoryReferenceConsents, revokeMemoryReferenceConsent } from "./memory-reference-consent-repository.js";
|
|
27
27
|
import { getUserProfilePromptState, setUserProfilePromptState } from "./user-profile-setup-repository.js";
|
|
28
|
-
export { COMPOSER_INPUT_HISTORY_LIMIT, DatabaseSchemaMigrationGapError, DatabaseSchemaTooNewError, SCHEMA_META_SCHEMA_VERSION_KEY, USER_UNDERSTANDING_REMEDIATION_POLICY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_FILENAME, XOPC_DB_SCHEMA_VERSION, appendComposerInputHistory, appendConnectorExecutionAudit, appendMemorySignal, appendMemoryTraceEvent, appendTranscriptEntry, applyPendingMigrations, attachMemoryEvidence, buildDefaultSessionMetadata, buildGlobalSessionStats, buildRelationshipPrompt, captureCompactionCheckpoint, claimConnectorWebhookDelivery, claimKnowledgeSourceItems, classifyStoredRow, clearComposerInputHistory, closeXopcDatabase, completeConnectorWebhookDelivery, completeKnowledgeSourceItemSynthesis, completeTaskOutcome, consumeConnectorApproval, consumeMemoryReferenceConsent, createConnectorApproval, createObjectLinkRecord, decideConnectorApproval, decideMemoryReferenceConsent, deleteConnectorConnection, deleteConnectorInstallation, deleteMemoryEvidenceForRecord, deleteMemoryRecord, deleteNoteAgentContextRecord, deleteNoteRecord, deleteSessionConfig, deleteSessionRecord, discoverSqlMigrations, ensureMemoryReferenceConsentRequest, ensureSessionRecord, ensureXopcDatabaseSchema, estimateTokensFromMessages, extractFtsContent, findLatestMemoryInjectTrace, findSessionKeyBySessionId, findTaskOutcomeForAssistant, finishKnowledgeSyncRun, getActivityEventRecord, getCachedConnectorCatalogEntry, getCompactionCheckpointDetail, getConnectorApproval, getConnectorConnection, getConnectorInstallation, getCurrentSessionId, getGlobalSessionStats, getInteractionState, getKnowledgeConsumerWatermark, getKnowledgeSourceCursor, getKnowledgeSourceItem, getMemoryProviderState, getMemoryRecord, getNoteAgentContextRecord, getNoteRecord, getRelationshipSettings, getSessionConfig, getSessionMetadata, getSessionPersistedLevels, getSqliteDatabase, getTaskOutcome, getUserProfilePromptState, getUserTrustPolicy, getXopcDatabase, hasMemoryReferenceConsent, hasSessionConfig, hasUnresolvedMemoryConflict, incrementSessionStatsOnAppend, inspectSchemaMigrationStatus, isProactiveSupportAllowed, isXopcDatabaseOpen, listActivityRecords, listCachedConnectorCatalogEntries, listCompactionCheckpoints, listComposerInputHistory, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns, listMemoryEvidence, listMemoryRecords, listMemoryReferenceConsents, listMemorySignals, listMemoryTraceEvents, listNoteRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, listRegisteredMigrationTargets, listSessionMetadata, listSessionsByAgent, listTaskOutcomes, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptRows, loadTranscriptRowsForSession, markMemoryRecordsConflicted, metadataToSessionInsert, openXopcDatabase, paginateTranscriptMessages, patchSessionMetadata, readSchemaVersion, readSchemaVersionForTest, recordActivityEvent, releaseConnectorWebhookDelivery, replaceConnectorCatalogEntries, replaceTranscriptRows, requireXopcDatabase, resetSessionRecord, resetXopcDatabaseSingletonForTest, resolveMigrationsDir, resolveSessionAgentId, resolveXopcDatabasePath, restoreCompactionCheckpoint, revokeMemoryReferenceConsent, runSqliteWriteTransaction, searchMemoryIndex, searchMemoryRecords, sessionConfigRowToConfig, sessionRowToMetadata, setInteractionState, setKnowledgeConsumerWatermark, setKnowledgeSourceCursor, setKnowledgeSourceItemSynthesisStatus, setLatestMemoryInjectFeedback, setMemoryProviderState, setMemoryTraceFeedback, setSessionConfig, setTaskOutcomeFeedback, setUserProfilePromptState, setUserTrustPolicy, startKnowledgeSyncRun, startTaskOutcome, summarizeMemoryRecallFeedback, summarizeTaskOutcomes, summarizeUserUnderstandingQuality, syncMemoryIndex, transcriptEntryRowToStoredRow, updateInteractionStateFromMessage, updateRelationshipSettings, updateSessionConfig, updateSessionStats, updateTaskOutcome, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation, upsertKnowledgeSourceItems, upsertMemoryRecord, upsertNoteAgentContextRecord, upsertNoteRecord };
|
|
28
|
+
export { COMPOSER_INPUT_HISTORY_LIMIT, DatabaseSchemaMigrationGapError, DatabaseSchemaTooNewError, SCHEMA_META_SCHEMA_VERSION_KEY, USER_UNDERSTANDING_REMEDIATION_POLICY, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_FILENAME, XOPC_DB_SCHEMA_VERSION, appendComposerInputHistory, appendConnectorExecutionAudit, appendMemorySignal, appendMemoryTraceEvent, appendTranscriptEntry, applyPendingMigrations, attachMemoryEvidence, buildDefaultSessionMetadata, buildGlobalSessionStats, buildRelationshipPrompt, captureCompactionCheckpoint, claimConnectorWebhookDelivery, claimKnowledgeSourceItems, classifyStoredRow, clearComposerInputHistory, closeXopcDatabase, completeConnectorWebhookDelivery, completeKnowledgeSourceItemSynthesis, completeTaskOutcome, consumeConnectorApproval, consumeMemoryReferenceConsent, createConnectorApproval, createObjectLinkRecord, decideConnectorApproval, decideMemoryReferenceConsent, deleteConnectorConnection, deleteConnectorInstallation, deleteMemoryEvidenceForRecord, deleteMemoryRecord, deleteNoteAgentContextRecord, deleteNoteRecord, deleteSessionConfig, deleteSessionRecord, discoverSqlMigrations, ensureMemoryReferenceConsentRequest, ensureSessionRecord, ensureXopcDatabaseSchema, estimateTokensFromMessages, extractFtsContent, findLatestMemoryInjectTrace, findSessionKeyBySessionId, findTaskOutcomeForAssistant, finishKnowledgeSyncRun, getActivityEventRecord, getCachedConnectorCatalogEntry, getCompactionCheckpointDetail, getConnectorApproval, getConnectorConnection, getConnectorInstallation, getCurrentSessionId, getGlobalSessionStats, getInteractionState, getKnowledgeConsumerWatermark, getKnowledgeSourceCursor, getKnowledgeSourceItem, getMemoryProviderState, getMemoryRecord, getNoteAgentContextRecord, getNoteRecord, getRelationshipSettings, getSessionConfig, getSessionMetadata, getSessionPersistedLevels, getSqliteDatabase, getTaskOutcome, getUserProfilePromptState, getUserTrustPolicy, getXopcDatabase, hasMemoryReferenceConsent, hasSessionConfig, hasUnresolvedMemoryConflict, incrementSessionStatsOnAppend, inspectSchemaMigrationStatus, isProactiveSupportAllowed, isXopcDatabaseOpen, listActivityRecords, listCachedConnectorCatalogEntries, listCompactionCheckpoints, listComposerInputHistory, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns, listMemoryEvidence, listMemoryRecords, listMemoryReferenceConsents, listMemorySignals, listMemoryTraceEvents, listNoteRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, listRegisteredMigrationTargets, listSessionMetadata, listSessionsByAgent, listTaskOutcomes, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, markMemoryRecordsConflicted, metadataToSessionInsert, openXopcDatabase, paginateTranscriptMessages, patchSessionMetadata, readSchemaVersion, readSchemaVersionForTest, recordActivityEvent, releaseConnectorWebhookDelivery, replaceConnectorCatalogEntries, replaceTranscriptRows, requireXopcDatabase, resetSessionRecord, resetXopcDatabaseSingletonForTest, resolveMigrationsDir, resolveSessionAgentId, resolveXopcDatabasePath, restoreCompactionCheckpoint, revokeMemoryReferenceConsent, runSqliteWriteTransaction, searchMemoryIndex, searchMemoryRecords, sessionConfigRowToConfig, sessionRowToMetadata, setInteractionState, setKnowledgeConsumerWatermark, setKnowledgeSourceCursor, setKnowledgeSourceItemSynthesisStatus, setLatestMemoryInjectFeedback, setMemoryProviderState, setMemoryTraceFeedback, setSessionConfig, setTaskOutcomeFeedback, setUserProfilePromptState, setUserTrustPolicy, startKnowledgeSyncRun, startTaskOutcome, summarizeMemoryRecallFeedback, summarizeTaskOutcomes, summarizeUserUnderstandingQuality, syncMemoryIndex, transcriptEntryRowToStoredRow, updateInteractionStateFromMessage, updateRelationshipSettings, updateSessionConfig, updateSessionStats, updateTaskOutcome, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation, upsertKnowledgeSourceItems, upsertMemoryRecord, upsertNoteAgentContextRecord, upsertNoteRecord };
|
|
@@ -8,6 +8,7 @@ export declare function appendTranscriptEntry(sessionKey: string, row: Transcrip
|
|
|
8
8
|
tokenDelta?: number;
|
|
9
9
|
}): TranscriptEntryRow;
|
|
10
10
|
export declare function loadTranscriptRowsForSession(sessionKey: string): TranscriptStoredRow[];
|
|
11
|
+
export declare function loadTranscriptHistoryRowsForSession(sessionKey: string): TranscriptStoredRow[];
|
|
11
12
|
export declare function loadTranscriptRows(sessionId: string): TranscriptStoredRow[];
|
|
12
13
|
export declare function loadLlmMessagesForSession(sessionKey: string): AgentMessage[];
|
|
13
14
|
export declare function replaceTranscriptRows(sessionKey: string, rows: TranscriptStoredRow[], opts?: {
|
|
@@ -17,10 +18,10 @@ export declare function loadCheckpointRows(sessionKey: string, checkpointId: str
|
|
|
17
18
|
export declare function paginateTranscriptMessages(sessionKey: string, options?: {
|
|
18
19
|
offset?: number;
|
|
19
20
|
limit?: number;
|
|
20
|
-
|
|
21
|
-
/** 0-based exclusive end index (legacy cursor from gateway UI). */
|
|
22
|
-
beforeEndIndex?: number;
|
|
21
|
+
beforeIndex?: number;
|
|
23
22
|
includeContext?: boolean;
|
|
23
|
+
/** Include reset/rollover transcripts for read-only conversation history. */
|
|
24
|
+
includeArchived?: boolean;
|
|
24
25
|
}): {
|
|
25
26
|
rows: TranscriptStoredRow[];
|
|
26
27
|
messages: AgentMessage[];
|
|
@@ -63,6 +63,15 @@ function loadTranscriptRowsForSession(sessionKey) {
|
|
|
63
63
|
if (!sessionId) return [];
|
|
64
64
|
return loadTranscriptRows(sessionId);
|
|
65
65
|
}
|
|
66
|
+
function loadTranscriptHistoryRowsForSession(sessionKey) {
|
|
67
|
+
if (!getCurrentSessionId(sessionKey)) return [];
|
|
68
|
+
return getSqliteDatabase().prepare(`SELECT e.entry_id, e.session_id, e.seq, e.entry_kind, e.role, e.payload_json, e.created_at
|
|
69
|
+
FROM transcript_entries e
|
|
70
|
+
JOIN transcripts t ON t.session_id = e.session_id
|
|
71
|
+
WHERE t.session_key = ?
|
|
72
|
+
AND (t.status = 'active' OR t.archive_reason IN ('reset', 'stale'))
|
|
73
|
+
ORDER BY t.created_at ASC, t.rowid ASC, e.seq ASC`).all(sessionKey).map(transcriptEntryRowToStoredRow);
|
|
74
|
+
}
|
|
66
75
|
function loadTranscriptRows(sessionId) {
|
|
67
76
|
return getSqliteDatabase().prepare(`SELECT entry_id, session_id, seq, entry_kind, role, payload_json, created_at
|
|
68
77
|
FROM transcript_entries
|
|
@@ -121,36 +130,36 @@ function paginateTranscriptMessages(sessionKey, options = {}) {
|
|
|
121
130
|
const db = getSqliteDatabase();
|
|
122
131
|
const kinds = options.includeContext ? ["message", "context"] : ["message"];
|
|
123
132
|
const kindPlaceholders = kinds.map(() => "?").join(", ");
|
|
124
|
-
const
|
|
125
|
-
|
|
133
|
+
const includeArchived = options.includeArchived === true;
|
|
134
|
+
const transcriptWhere = includeArchived ? `t.session_key = ? AND (t.status = 'active' OR t.archive_reason IN ('reset', 'stale'))` : "e.session_id = ?";
|
|
135
|
+
const transcriptArg = includeArchived ? sessionKey : sessionId;
|
|
136
|
+
const total = db.prepare(`SELECT COUNT(*) AS total
|
|
137
|
+
FROM transcript_entries e
|
|
138
|
+
JOIN transcripts t ON t.session_id = e.session_id
|
|
139
|
+
WHERE ${transcriptWhere} AND e.entry_kind IN (${kindPlaceholders})`).get(transcriptArg, ...kinds).total;
|
|
126
140
|
const limit = Math.min(200, Math.max(1, Math.trunc(options.limit ?? 50)));
|
|
127
141
|
const offset = Math.max(0, Math.trunc(options.offset ?? 0));
|
|
128
142
|
let rows;
|
|
129
|
-
if (options.
|
|
130
|
-
const endExclusive = Math.min(total, Math.max(0, Math.trunc(options.
|
|
143
|
+
if (options.beforeIndex !== void 0 && Number.isFinite(options.beforeIndex)) {
|
|
144
|
+
const endExclusive = Math.min(total, Math.max(0, Math.trunc(options.beforeIndex)));
|
|
131
145
|
const startInclusive = Math.max(0, endExclusive - limit);
|
|
132
146
|
rows = db.prepare(`SELECT entry_id, session_id, seq, entry_kind, role, payload_json, created_at
|
|
133
147
|
FROM (
|
|
134
|
-
SELECT entry_id, session_id, seq, entry_kind, role, payload_json, created_at,
|
|
135
|
-
ROW_NUMBER() OVER (ORDER BY seq ASC) - 1 AS idx
|
|
136
|
-
FROM transcript_entries
|
|
137
|
-
|
|
148
|
+
SELECT e.entry_id, e.session_id, e.seq, e.entry_kind, e.role, e.payload_json, e.created_at,
|
|
149
|
+
ROW_NUMBER() OVER (ORDER BY t.created_at ASC, t.rowid ASC, e.seq ASC) - 1 AS idx
|
|
150
|
+
FROM transcript_entries e
|
|
151
|
+
JOIN transcripts t ON t.session_id = e.session_id
|
|
152
|
+
WHERE ${transcriptWhere} AND e.entry_kind IN (${kindPlaceholders})
|
|
138
153
|
)
|
|
139
154
|
WHERE idx >= ? AND idx < ?
|
|
140
|
-
ORDER BY
|
|
141
|
-
} else if (options.beforeSeq !== void 0 && Number.isFinite(options.beforeSeq)) {
|
|
142
|
-
rows = db.prepare(`SELECT entry_id, session_id, seq, entry_kind, role, payload_json, created_at
|
|
143
|
-
FROM transcript_entries
|
|
144
|
-
WHERE session_id = ? AND entry_kind IN (${kindPlaceholders}) AND seq < ?
|
|
145
|
-
ORDER BY seq DESC
|
|
146
|
-
LIMIT ?`).all(sessionId, ...kinds, options.beforeSeq, limit);
|
|
147
|
-
rows.reverse();
|
|
155
|
+
ORDER BY idx ASC`).all(transcriptArg, ...kinds, startInclusive, endExclusive);
|
|
148
156
|
} else {
|
|
149
|
-
rows = db.prepare(`SELECT entry_id, session_id, seq, entry_kind, role, payload_json, created_at
|
|
150
|
-
FROM transcript_entries
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
157
|
+
rows = db.prepare(`SELECT e.entry_id, e.session_id, e.seq, e.entry_kind, e.role, e.payload_json, e.created_at
|
|
158
|
+
FROM transcript_entries e
|
|
159
|
+
JOIN transcripts t ON t.session_id = e.session_id
|
|
160
|
+
WHERE ${transcriptWhere} AND e.entry_kind IN (${kindPlaceholders})
|
|
161
|
+
ORDER BY t.created_at DESC, t.rowid DESC, e.seq DESC
|
|
162
|
+
LIMIT ? OFFSET ?`).all(transcriptArg, ...kinds, limit, offset);
|
|
154
163
|
rows.reverse();
|
|
155
164
|
}
|
|
156
165
|
const storedRows = rows.map(transcriptEntryRowToStoredRow);
|
|
@@ -244,4 +253,4 @@ function restoreCompactionCheckpoint(sessionKey, checkpointId) {
|
|
|
244
253
|
});
|
|
245
254
|
}
|
|
246
255
|
//#endregion
|
|
247
|
-
export { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint };
|
|
256
|
+
export { appendTranscriptEntry, captureCompactionCheckpoint, getCompactionCheckpointDetail, listCompactionCheckpoints, loadCheckpointRows, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreCompactionCheckpoint };
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
export interface WorkflowResultEnvelope {
|
|
2
2
|
title?: string;
|
|
3
3
|
summary: string;
|
|
4
|
-
sections
|
|
4
|
+
sections?: WorkflowResultSection[];
|
|
5
5
|
actions?: WorkflowNextAction[];
|
|
6
6
|
artifacts?: WorkflowArtifactRef[];
|
|
7
7
|
followUps?: WorkflowFollowUp[];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/** Product-level outcome contract for reusable workflow deliverables. */
|
|
11
|
-
export interface WorkflowOutcome {
|
|
12
|
-
summary: string;
|
|
13
|
-
artifacts?: WorkflowArtifactRef[];
|
|
14
|
-
followUps?: WorkflowFollowUp[];
|
|
15
|
-
structuredOutput?: unknown;
|
|
8
|
+
/** Machine-readable workflow output. It is intentionally not rendered as user-facing content. */
|
|
9
|
+
data?: unknown;
|
|
16
10
|
}
|
|
17
11
|
export interface WorkflowFollowUp {
|
|
18
12
|
id: string;
|
|
@@ -20,7 +14,7 @@ export interface WorkflowFollowUp {
|
|
|
20
14
|
prompt?: string;
|
|
21
15
|
priority?: 'low' | 'medium' | 'high';
|
|
22
16
|
}
|
|
23
|
-
export type WorkflowResultSection = WorkflowTextSection | WorkflowFindingsSection | WorkflowRisksSection | WorkflowQuestionsSection
|
|
17
|
+
export type WorkflowResultSection = WorkflowTextSection | WorkflowFindingsSection | WorkflowRisksSection | WorkflowQuestionsSection;
|
|
24
18
|
export interface WorkflowTextSection {
|
|
25
19
|
kind: 'text';
|
|
26
20
|
title: string;
|
|
@@ -41,11 +35,6 @@ export interface WorkflowQuestionsSection {
|
|
|
41
35
|
title: string;
|
|
42
36
|
items: string[];
|
|
43
37
|
}
|
|
44
|
-
export interface WorkflowJsonSection {
|
|
45
|
-
kind: 'json';
|
|
46
|
-
title: string;
|
|
47
|
-
value: unknown;
|
|
48
|
-
}
|
|
49
38
|
export interface WorkflowFinding {
|
|
50
39
|
title: string;
|
|
51
40
|
severity?: WorkflowSeverity;
|
|
@@ -177,7 +177,7 @@ var WorkflowEngine = class {
|
|
|
177
177
|
await eventQueue;
|
|
178
178
|
if (currentPhaseId) await appendEvent("phase_completed", { phaseId: currentPhaseId });
|
|
179
179
|
const result = requireWorkflowResultEnvelope(runtimeResult.result);
|
|
180
|
-
assertWorkflowOutput(definition, result);
|
|
180
|
+
assertWorkflowOutput(definition, result.data === void 0 ? result.summary : result.data);
|
|
181
181
|
await appendEvent("run_completed", { result });
|
|
182
182
|
await this.callHooks((hook) => hook.afterRun?.({
|
|
183
183
|
runId,
|
|
@@ -622,16 +622,7 @@ function groupReplayTargetsByPhase(targets) {
|
|
|
622
622
|
function buildReplayResultEnvelope(options, results) {
|
|
623
623
|
return {
|
|
624
624
|
summary: `Replay completed for ${results.filter((item) => item.status === "done").length}/${results.length} target${results.length === 1 ? "" : "s"}.`,
|
|
625
|
-
|
|
626
|
-
kind: "json",
|
|
627
|
-
title: "Replay targets",
|
|
628
|
-
value: {
|
|
629
|
-
sourceRunId: options.sourceRunId,
|
|
630
|
-
scope: options.replayScope,
|
|
631
|
-
targets: results
|
|
632
|
-
}
|
|
633
|
-
}],
|
|
634
|
-
structuredOutput: { replay: {
|
|
625
|
+
data: { replay: {
|
|
635
626
|
sourceRunId: options.sourceRunId,
|
|
636
627
|
scope: options.replayScope,
|
|
637
628
|
targets: results
|
|
@@ -669,6 +660,7 @@ function normalizeCompletedAgentStatus(status) {
|
|
|
669
660
|
function previewWorkflowValue(value) {
|
|
670
661
|
if (value === null || value === void 0) return;
|
|
671
662
|
if (typeof value === "string") return truncate(value, 300);
|
|
663
|
+
if (isWorkflowResultEnvelope(value)) return truncate(value.summary, 1200);
|
|
672
664
|
try {
|
|
673
665
|
return truncate(JSON.stringify(value), 300);
|
|
674
666
|
} catch {
|
|
@@ -687,12 +679,11 @@ function assertWorkflowOutput(definition, value) {
|
|
|
687
679
|
}
|
|
688
680
|
function isWorkflowResultEnvelope(value) {
|
|
689
681
|
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
690
|
-
|
|
691
|
-
return typeof record.summary === "string" && Array.isArray(record.sections);
|
|
682
|
+
return typeof value.summary === "string";
|
|
692
683
|
}
|
|
693
684
|
function requireWorkflowResultEnvelope(value) {
|
|
694
685
|
if (isWorkflowResultEnvelope(value)) return value;
|
|
695
|
-
throw new WorkflowEngineRunError("result_validation_failed", "Workflow output node must return a result envelope with summary
|
|
686
|
+
throw new WorkflowEngineRunError("result_validation_failed", "Workflow output node must return a result envelope with summary.", false);
|
|
696
687
|
}
|
|
697
688
|
function toWorkflowRunError(err, wasAborted, abortReason) {
|
|
698
689
|
if (err instanceof WorkflowEngineRunError) return {
|