@xopcai/xopc 0.0.471 → 0.0.472
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/{apps-page-O944fHx0.js → apps-page-BlDivdQ0.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-Cflfmbrc.js → automations-page-36Dx_eLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DM6e37bB.js → automations-workspace-BY3P8w5G.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-page-DYU6WSde.js → capabilities-page-DWslQZCv.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-DfyND0IO.js → capabilities-settings-panel-Drpf_JGM.js} +2 -2
- package/dist/gateway/static/root/assets/{channels-DwUmMnA1.js → channels-CjDJ2Mmb.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-C0ONpQcA.js → chat-page-D_8adelp.js} +30 -30
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dn7Cm1O4.js → chat-terminal-dock-1VI02yzQ.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DfDVgGh_.js → connectors-page-T7W-zTEK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DIAyDA-a.js → extension-debug-page-DIU2PfhR.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CCe4R7L7.js → extension-iframe-host-0xdd5xm5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-BD0ZamBV.js → extension-message-router-CN1KAjhe.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C09dlV3J.js → extension-page-BiAzQtvI.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BhluafoX.js → extension-provider-CYVVZ21G.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CB8KLYoG.js → extension-settings-page-B71tjY9p.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-8KwhWlYt.js → home-page-C79KZbb1.js} +3 -3
- package/dist/gateway/static/root/assets/{index-CwEEoE-7.js → index-Jbmr3G0d.js} +6 -6
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DmzgjJNj.js → local-app-workbench-page-TZ7JoORJ.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-Cu_YCIN6.js → note-detail-panel-DFR9Fc16.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-CQtqNBlW.js → notes-page-Y6jTwZhu.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Cn4zi3Mt.js → page-context-capture-button-zG-782MJ.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-OK0-3ovb.js → personal-page-CNAaIQe_.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-CNI5Eor6.js → personal-profile-settings-OoFMAniP.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-BcrpYRn9.js → personal-settings-panel-BVv8cYny.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-runtime-RnBDP-Lq.js → preview-runtime-pJGZe5Jx.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-ydVvC7Fi.js → project-detail-page-CdIhsx42.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-g-LvDQgh.js → route-preload-DAyaQF0B.js} +2 -2
- package/dist/gateway/static/root/assets/{routine-panel-rjq-8nZ8.js → routine-panel-BsUWc1HR.js} +2 -2
- package/dist/gateway/static/root/assets/session-manager-DzSlogQc.js +22 -0
- package/dist/gateway/static/root/assets/{settings-page-DHXt4EPc.js → settings-page-C2DiHQf_.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-nzWjWhqF.js → share-preview-page-DDd5iT5G.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-LB3SYKFS.js → shares-settings-Dmk9W8r9.js} +1 -1
- package/dist/gateway/static/root/assets/{space-page-D7YRR6ZW.js → space-page-fq1NyJx5.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BUn6GRzz.js → task-detail-page-DE3BWEBP.js} +1 -1
- package/dist/gateway/static/root/assets/{task-header-title-BsYL4R80.js → task-header-title-BTCuRQKx.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Bmgta9z9.js → task-result-evidence-DCHcXh04.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-sszsCdh5.js → use-composer-attachments-B6CKcx51.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D4b4fDeu.js → use-file-preview-expanded-1ZjXWaYM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-personal-work-CNK4dpEh.js → use-personal-work-CwZNBF3F.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-cugjs8cK.js → use-realtime-voice-D5-XzM7H.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-Crfx5ctU.js → use-workspace-tree-DsuGqCMo.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-BzfNK5Jm.js → voice-settings-lJN2e9mQ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-g-wCKoQU.js → workspace-api-CFPK3JR6.js} +2 -2
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DxaxVC3q.js → workspace-file-preview-dialog-35uL-ra3.js} +1 -1
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -1
- package/dist/src/agent/service/process-direct-streaming.js +14 -0
- package/dist/src/gateway/chat-stream/mapper.js +10 -4
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +5 -2
- package/dist/src/gateway/hono/routes/video-generation.js +6 -5
- package/dist/src/gateway/service/session-input-coordinator.d.ts +2 -1
- package/dist/src/gateway/service/session-input-coordinator.js +3 -1
- package/dist/src/gateway/service.js +4 -4
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/music-generation/artifact.d.ts +1 -1
- package/dist/src/music-generation/artifact.js +4 -3
- package/dist/src/music-generation/provider.d.ts +1 -0
- package/dist/src/music-generation/providers.js +4 -1
- package/dist/src/music-generation/worker.js +1 -1
- package/dist/src/music-generation/xopc-cloud.js +22 -0
- package/dist/src/session/manager.d.ts +3 -1
- package/dist/src/session/manager.js +2 -2
- package/dist/src/session/store.d.ts +3 -1
- package/dist/src/session/store.js +2 -2
- package/dist/src/session/user-round-delete.d.ts +3 -1
- package/dist/src/session/user-round-delete.js +6 -4
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +6 -1
- package/dist/src/video-generation/drafts.js +3 -3
- package/dist/src/video-generation/settings.d.ts +1 -0
- package/dist/src/video-generation/settings.js +23 -7
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +0 -22
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260910-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260910-1" />
|
|
13
13
|
<title>XOPC — Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-Jbmr3G0d.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/diagnostics-Bo0Z42P_.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -142,9 +142,9 @@
|
|
|
142
142
|
<link rel="modulepreload" crossorigin href="/assets/attachment-utils-core-BPYdUI6y.js">
|
|
143
143
|
<link rel="modulepreload" crossorigin href="/assets/use-async-resource-BHFGZCY2.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="/assets/files-BNL4kkSB.js">
|
|
145
|
-
<link rel="modulepreload" crossorigin href="/assets/workspace-api-
|
|
145
|
+
<link rel="modulepreload" crossorigin href="/assets/workspace-api-CFPK3JR6.js">
|
|
146
146
|
<link rel="modulepreload" crossorigin href="/assets/index.module-Cd9ENXfk.js">
|
|
147
|
-
<link rel="modulepreload" crossorigin href="/assets/preview-runtime-
|
|
147
|
+
<link rel="modulepreload" crossorigin href="/assets/preview-runtime-pJGZe5Jx.js">
|
|
148
148
|
<link rel="modulepreload" crossorigin href="/assets/trash-2-DusmjVPV.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="/assets/user-round-C9jxPhMR.js">
|
|
150
150
|
<link rel="modulepreload" crossorigin href="/assets/copy-text-row-CpiRzq4G.js">
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-store-BpnGXAhi.js">
|
|
160
160
|
<link rel="modulepreload" crossorigin href="/assets/gateway-realtime-BnwNxbyc.js">
|
|
161
161
|
<link rel="modulepreload" crossorigin href="/assets/agents-admin-api-BL8lN8gP.js">
|
|
162
|
-
<link rel="modulepreload" crossorigin href="/assets/session-manager-
|
|
162
|
+
<link rel="modulepreload" crossorigin href="/assets/session-manager-DzSlogQc.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="/assets/new-session-preferences-gb411vZP.js">
|
|
164
164
|
<link rel="modulepreload" crossorigin href="/assets/open-capability-settings-DQsmJxI7.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="/assets/model-sort-_Tz8s_4N.js">
|
|
@@ -182,15 +182,15 @@
|
|
|
182
182
|
<link rel="modulepreload" crossorigin href="/assets/voice-CDlC6XMH.js">
|
|
183
183
|
<link rel="modulepreload" crossorigin href="/assets/activity-store-DKP2sWTJ.js">
|
|
184
184
|
<link rel="modulepreload" crossorigin href="/assets/composer-notifications-B0IZsy8x.js">
|
|
185
|
-
<link rel="modulepreload" crossorigin href="/assets/use-realtime-voice-
|
|
185
|
+
<link rel="modulepreload" crossorigin href="/assets/use-realtime-voice-D5-XzM7H.js">
|
|
186
186
|
<link rel="modulepreload" crossorigin href="/assets/voice-call-context-BM2A4bLz.js">
|
|
187
187
|
<link rel="modulepreload" crossorigin href="/assets/app-chrome-BeB4KgOf.js">
|
|
188
188
|
<link rel="modulepreload" crossorigin href="/assets/page-header-store-1-lflHAx.js">
|
|
189
189
|
<link rel="modulepreload" crossorigin href="/assets/new-chat-navigation-DXYDldT_.js">
|
|
190
190
|
<link rel="modulepreload" crossorigin href="/assets/loopi-CNtmi9FU.js">
|
|
191
191
|
<link rel="modulepreload" crossorigin href="/assets/theme-store-C1MxmBg7.js">
|
|
192
|
-
<link rel="modulepreload" crossorigin href="/assets/extension-message-router-
|
|
193
|
-
<link rel="modulepreload" crossorigin href="/assets/extension-provider-
|
|
192
|
+
<link rel="modulepreload" crossorigin href="/assets/extension-message-router-CN1KAjhe.js">
|
|
193
|
+
<link rel="modulepreload" crossorigin href="/assets/extension-provider-CYVVZ21G.js">
|
|
194
194
|
<link rel="modulepreload" crossorigin href="/assets/agent-avatar-display-CIsejg_E.js">
|
|
195
195
|
<link rel="modulepreload" crossorigin href="/assets/skill-wire-pattern-BPpeIcCi.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="/assets/composer-handoff-params-DBpzHuNo.js">
|
|
@@ -205,9 +205,9 @@
|
|
|
205
205
|
<link rel="modulepreload" crossorigin href="/assets/constants-D5Z-mUto.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="/assets/sliding-indicator-hwz0sx3h.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="/assets/sliding-tab-list-CmcrqRzN.js">
|
|
208
|
-
<link rel="modulepreload" crossorigin href="/assets/use-file-preview-expanded-
|
|
208
|
+
<link rel="modulepreload" crossorigin href="/assets/use-file-preview-expanded-1ZjXWaYM.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="/assets/file-preview-surface-CeFFZo3a.js">
|
|
210
|
-
<link rel="modulepreload" crossorigin href="/assets/use-composer-attachments-
|
|
210
|
+
<link rel="modulepreload" crossorigin href="/assets/use-composer-attachments-B6CKcx51.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="/assets/skill-api-utils-C7V4JVXM.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="/assets/skill-list-api-D4eokPXx.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="/assets/command-palette-api-DPtCt8Je.js">
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
<link rel="modulepreload" crossorigin href="/assets/automation-task-card-BNT3n0qu.js">
|
|
219
219
|
<link rel="modulepreload" crossorigin href="/assets/dev-view-store-DnQ2nBtV.js">
|
|
220
220
|
<link rel="modulepreload" crossorigin href="/assets/extension-authoritative-grants-BqtUnmq-.js">
|
|
221
|
-
<link rel="modulepreload" crossorigin href="/assets/extension-iframe-host-
|
|
221
|
+
<link rel="modulepreload" crossorigin href="/assets/extension-iframe-host-0xdd5xm5.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="/assets/runtime-health-zDkHcOZO.js">
|
|
223
223
|
<link rel="modulepreload" crossorigin href="/assets/api-V4P8zfkJ.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="/assets/terminal-panel-store-B1bAD5Xf.js">
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
<link rel="modulepreload" crossorigin href="/assets/page-context-draft-BjbX5zd7.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="/assets/management-api-DG-yZnHK.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="/assets/side-chat-shortcut-BIw-1TTD.js">
|
|
231
|
-
<link rel="modulepreload" crossorigin href="/assets/chat-page-
|
|
231
|
+
<link rel="modulepreload" crossorigin href="/assets/chat-page-D_8adelp.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="/assets/arrow-right-DSSvoX71.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="/assets/browser-notification-delivery-DmE2FgGc.js">
|
|
234
234
|
<link rel="modulepreload" crossorigin href="/assets/unlink-NsCMuCT1.js">
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
<link rel="modulepreload" crossorigin href="/assets/panel-left-C8MqSXRZ.js">
|
|
286
286
|
<link rel="modulepreload" crossorigin href="/assets/panel-right-CFGrHTsD.js">
|
|
287
287
|
<link rel="modulepreload" crossorigin href="/assets/wand-sparkles-CkSL-3Fy.js">
|
|
288
|
-
<link rel="modulepreload" crossorigin href="/assets/use-personal-work-
|
|
288
|
+
<link rel="modulepreload" crossorigin href="/assets/use-personal-work-CwZNBF3F.js">
|
|
289
289
|
<link rel="modulepreload" crossorigin href="/assets/pin-off-BMRv-Kxr.js">
|
|
290
290
|
<link rel="modulepreload" crossorigin href="/assets/power-ZI-pBczI.js">
|
|
291
291
|
<link rel="modulepreload" crossorigin href="/assets/puzzle-BptcPjKI.js">
|
|
@@ -306,16 +306,16 @@
|
|
|
306
306
|
<link rel="modulepreload" crossorigin href="/assets/preference-select-fields-BKmzpfHq.js">
|
|
307
307
|
<link rel="modulepreload" crossorigin href="/assets/navigation-ByOzYT0t.js">
|
|
308
308
|
<link rel="modulepreload" crossorigin href="/assets/page-tabs-oeTY7z3_.js">
|
|
309
|
-
<link rel="modulepreload" crossorigin href="/assets/route-preload-
|
|
309
|
+
<link rel="modulepreload" crossorigin href="/assets/route-preload-DAyaQF0B.js">
|
|
310
310
|
<link rel="modulepreload" crossorigin href="/assets/use-personal-profile-CNPszzzT.js">
|
|
311
311
|
<link rel="modulepreload" crossorigin href="/assets/personal-avatar-CM3vUGhL.js">
|
|
312
312
|
<link rel="modulepreload" crossorigin href="/assets/project-understanding-Dv26vu9S.js">
|
|
313
313
|
<link rel="modulepreload" crossorigin href="/assets/refresh-button-DiWdGAaX.js">
|
|
314
314
|
<link rel="modulepreload" crossorigin href="/assets/file-tree-CYUkQR1t.js">
|
|
315
|
-
<link rel="modulepreload" crossorigin href="/assets/workspace-file-preview-dialog-
|
|
316
|
-
<link rel="modulepreload" crossorigin href="/assets/use-workspace-tree-
|
|
315
|
+
<link rel="modulepreload" crossorigin href="/assets/workspace-file-preview-dialog-35uL-ra3.js">
|
|
316
|
+
<link rel="modulepreload" crossorigin href="/assets/use-workspace-tree-DsuGqCMo.js">
|
|
317
317
|
<link rel="modulepreload" crossorigin href="/assets/date-formatters-DukWSVwc.js">
|
|
318
|
-
<link rel="modulepreload" crossorigin href="/assets/task-header-title-
|
|
318
|
+
<link rel="modulepreload" crossorigin href="/assets/task-header-title-BTCuRQKx.js">
|
|
319
319
|
<link rel="modulepreload" crossorigin href="/assets/date-time-picker--LGC1D3b.js">
|
|
320
320
|
<link rel="modulepreload" crossorigin href="/assets/settings-mode-store-Dk0bZQgo.js">
|
|
321
321
|
<link rel="modulepreload" crossorigin href="/assets/global-defaults-api-CNyJ0dGb.js">
|
package/dist/package.js
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* in their own classes and are unit-testable.
|
|
16
16
|
*/
|
|
17
17
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
18
|
+
import type { UserTurnDocument } from '@xopcai/gateway-contract';
|
|
18
19
|
import type { Config } from '../../config/schema.js';
|
|
19
20
|
import type { ContextualLogger } from '../../utils/logger/types.js';
|
|
20
21
|
import type { AgentManager } from '../agent-manager.js';
|
|
@@ -97,6 +98,7 @@ export declare class TurnDispatcher {
|
|
|
97
98
|
sourceContexts?: AgentSourceContext[];
|
|
98
99
|
voiceAgentInstruction?: boolean;
|
|
99
100
|
clientMessageId?: string;
|
|
101
|
+
userTurnDocument?: UserTurnDocument;
|
|
100
102
|
onHandled?: () => void;
|
|
101
103
|
}): Promise<boolean>;
|
|
102
104
|
private buildStreamingDeps;
|
|
@@ -103,6 +103,7 @@ var TurnDispatcher = class {
|
|
|
103
103
|
clientMessageId: options.clientMessageId,
|
|
104
104
|
steered: true
|
|
105
105
|
} : {},
|
|
106
|
+
...options.userTurnDocument ? { userTurnDocument: options.userTurnDocument } : {},
|
|
106
107
|
...options.sourceContexts?.length ? { sourceContexts: options.sourceContexts.map(summarizeSourceContext) } : {}
|
|
107
108
|
}
|
|
108
109
|
};
|
|
@@ -124,7 +125,8 @@ var TurnDispatcher = class {
|
|
|
124
125
|
timestamp: Date.now(),
|
|
125
126
|
metadata: {
|
|
126
127
|
clientMessageId: options.clientMessageId,
|
|
127
|
-
steered: true
|
|
128
|
+
steered: true,
|
|
129
|
+
...options.userTurnDocument ? { userTurnDocument: options.userTurnDocument } : {}
|
|
128
130
|
}
|
|
129
131
|
},
|
|
130
132
|
onHandled: options.onHandled
|
|
@@ -9,6 +9,7 @@ import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
|
9
9
|
import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
10
10
|
import { init_model_usage, modelUsageOriginFromTurn, withModelUsageOrigin } from "../../providers/model-usage.js";
|
|
11
11
|
import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
|
|
12
|
+
import { onSessionTranscriptUpdate } from "../../session/transcript-events.js";
|
|
12
13
|
import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
|
|
13
14
|
import { abortEmbeddedRun } from "../embedded/runs.js";
|
|
14
15
|
import { phoneResumeForRun } from "../../phone/assistance.js";
|
|
@@ -173,6 +174,18 @@ async function* runProcessDirectStreamingInner(deps, input) {
|
|
|
173
174
|
});
|
|
174
175
|
};
|
|
175
176
|
if (channel === "webchat") deps.registerWebchatStreamPublisher(conversationId, pushVisible);
|
|
177
|
+
const stopSteerEvents = channel === "webchat" && input.runId ? onSessionTranscriptUpdate((update) => {
|
|
178
|
+
if (update.conversationId !== conversationId) return;
|
|
179
|
+
const message = update.message;
|
|
180
|
+
if (message?.role !== "user" || message.turnId !== input.runId || !message.metadata?.steered || !message.metadata.clientMessageId) return;
|
|
181
|
+
pushVisible({
|
|
182
|
+
type: "user_message",
|
|
183
|
+
content: message.content,
|
|
184
|
+
timestamp: message.timestamp,
|
|
185
|
+
media: message.media,
|
|
186
|
+
metadata: message.metadata
|
|
187
|
+
});
|
|
188
|
+
}) : void 0;
|
|
176
189
|
const signal = input.signal;
|
|
177
190
|
let userAborted = false;
|
|
178
191
|
let abortHandled = false;
|
|
@@ -441,6 +454,7 @@ async function* runProcessDirectStreamingInner(deps, input) {
|
|
|
441
454
|
}
|
|
442
455
|
deps.recordTaskReviewStreamHint?.(conversationId, { skipTaskReview: ranSlashCommand });
|
|
443
456
|
} finally {
|
|
457
|
+
stopSteerEvents?.();
|
|
444
458
|
if (channel === "webchat") deps.unregisterWebchatStreamPublisher(conversationId);
|
|
445
459
|
deps.endDirectRequestContext();
|
|
446
460
|
}
|
|
@@ -3,6 +3,7 @@ import { resolveToolActivity } from "../../../packages/gateway-contract/src/tool
|
|
|
3
3
|
import { isUserTurnDocument } from "../../../packages/gateway-contract/src/user-turn-document.js";
|
|
4
4
|
import { readClarificationPresentation } from "../../../packages/gateway-contract/src/clarifications.js";
|
|
5
5
|
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
6
|
+
import { stripRuntimeContextFromUserContent } from "../../session/user-message-display.js";
|
|
6
7
|
import { productDeliveries } from "../../session/compact-history.js";
|
|
7
8
|
import { createPetFeedback } from "./pet-feedback.js";
|
|
8
9
|
//#region src/gateway/chat-stream/mapper.ts
|
|
@@ -449,10 +450,11 @@ var ChatStreamMapper = class {
|
|
|
449
450
|
}
|
|
450
451
|
};
|
|
451
452
|
function userMessageFromEvent(event, turnId) {
|
|
453
|
+
const content = event.content;
|
|
452
454
|
return {
|
|
453
455
|
role: "user",
|
|
454
456
|
turnId,
|
|
455
|
-
content:
|
|
457
|
+
content: typeof content === "string" || Array.isArray(content) ? stripRuntimeContextFromUserContent(content) : [],
|
|
456
458
|
attachments: event.media,
|
|
457
459
|
metadata: userMessageDisplayMetadata(event.metadata),
|
|
458
460
|
timestamp: typeof event.timestamp === "number" ? event.timestamp : Date.now()
|
|
@@ -462,8 +464,11 @@ function userMessageDisplayMetadata(value) {
|
|
|
462
464
|
const metadata = asRecord(value);
|
|
463
465
|
const rows = metadata?.sourceContexts;
|
|
464
466
|
const userTurnDocument = isUserTurnDocument(metadata?.userTurnDocument) ? metadata.userTurnDocument : void 0;
|
|
465
|
-
|
|
466
|
-
|
|
467
|
+
const steer = metadata?.steered === true && typeof metadata.clientMessageId === "string" ? {
|
|
468
|
+
steered: true,
|
|
469
|
+
clientMessageId: metadata.clientMessageId
|
|
470
|
+
} : void 0;
|
|
471
|
+
const sourceContexts = (Array.isArray(rows) ? rows : []).flatMap((value) => {
|
|
467
472
|
const row = asRecord(value);
|
|
468
473
|
if (row?.kind !== "note" && row?.kind !== "task" && row?.kind !== "file" && row?.kind !== "session" && row?.kind !== "browser_tab" && row?.kind !== "mcp_resource" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
469
474
|
return [{
|
|
@@ -477,7 +482,8 @@ function userMessageDisplayMetadata(value) {
|
|
|
477
482
|
...row.kind === "file" && (row.fileKind === "file" || row.fileKind === "directory") ? { fileKind: row.fileKind } : {}
|
|
478
483
|
}];
|
|
479
484
|
});
|
|
480
|
-
return sourceContexts.length > 0 || userTurnDocument ? {
|
|
485
|
+
return sourceContexts.length > 0 || userTurnDocument || steer ? {
|
|
486
|
+
...steer,
|
|
481
487
|
...sourceContexts.length > 0 ? { sourceContexts } : {},
|
|
482
488
|
...userTurnDocument ? { userTurnDocument } : {}
|
|
483
489
|
} : void 0;
|
|
@@ -8,8 +8,8 @@ import { acknowledgeHomeAttention } from "../../../storage/sqlite/home-attention
|
|
|
8
8
|
import "../../../storage/sqlite/index.js";
|
|
9
9
|
import { HomeQueryService, buildHomeWorkbench, decisionFromTask } from "../../../tasks/home-query-service.js";
|
|
10
10
|
import { resumeApprovedConnectorAction } from "../../../connectors/approval-resume.js";
|
|
11
|
-
import { HomeOpportunityActionError, HomeOpportunityNotFoundError } from "../../../home-intelligence/application-service.js";
|
|
12
11
|
import { ObservationConflictError } from "../../../home-intelligence/observation.js";
|
|
12
|
+
import { HomeOpportunityActionError, HomeOpportunityNotFoundError } from "../../../home-intelligence/application-service.js";
|
|
13
13
|
//#region src/gateway/hono/routes/home.ts
|
|
14
14
|
init_src();
|
|
15
15
|
/** Register the unified work-home read model and its decision actions. */
|
|
@@ -875,8 +875,11 @@ function registerSessionsRoutes(authenticated, deps) {
|
|
|
875
875
|
if (service.voiceRealtime?.hasConversation(key)) return c.json({ error: "End the voice call before editing its history" }, 409);
|
|
876
876
|
const body = await c.req.json().catch(() => ({}));
|
|
877
877
|
const userRoundIndex = typeof body.userRoundIndex === "number" ? body.userRoundIndex : void 0;
|
|
878
|
-
|
|
879
|
-
|
|
878
|
+
const steerId = typeof body.steerId === "string" ? body.steerId.trim() : "";
|
|
879
|
+
if (steerId && (steerId.length > 128 || body.userRoundIndex !== void 0)) return c.json({ error: "Specify one valid message target" }, 400);
|
|
880
|
+
const target = steerId ? { steerId } : userRoundIndex;
|
|
881
|
+
if (target === void 0 || typeof target === "number" && (!Number.isInteger(target) || target < 0)) return c.json({ error: "userRoundIndex must be a non-negative integer" }, 400);
|
|
882
|
+
const result = await service.sessionIndexInstance.deleteUserRound(key, target);
|
|
880
883
|
if (!result) return c.json({ error: "User round index out of range" }, 400);
|
|
881
884
|
await deleteMediaUrisNoLongerReferenced({
|
|
882
885
|
removed: result.removedMessages,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_transaction, runSqliteWriteTransaction } from "../../../storage/sqlite/transaction.js";
|
|
2
|
-
import { VIDEO_IMAGE_MAX_BYTES,
|
|
2
|
+
import { VIDEO_IMAGE_MAX_BYTES, VIDEO_MODEL_REFS, VIDEO_RESOLUTIONS, WAN_VIDEO_MODEL_REF, isVideoDurationSupported } from "../../../../packages/gateway-contract/src/video-generation.js";
|
|
3
3
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
4
4
|
import { readMediaReference } from "../../../media/media-reference.js";
|
|
5
|
-
import { getVideoDefaults, getVideoModel, setVideoDefaults, setVideoModel } from "../../../video-generation/settings.js";
|
|
5
|
+
import { getVideoDefaults, getVideoModel, getVideoModelDefinition, setVideoDefaults, setVideoModel } from "../../../video-generation/settings.js";
|
|
6
6
|
import { enqueueVideoJob, getVideoJob, listVideoJobs } from "../../../video-generation/repository.js";
|
|
7
7
|
import { getVideoDraft } from "../../../video-generation/drafts.js";
|
|
8
8
|
import { readVideoArtifact } from "../../../video-generation/artifact.js";
|
|
@@ -59,7 +59,8 @@ async function videoSettings() {
|
|
|
59
59
|
modelRef,
|
|
60
60
|
defaults: getVideoDefaults(modelRef),
|
|
61
61
|
configured,
|
|
62
|
-
modelRefs: [...new Set([...getAvailableVideoModelRefs(), modelRef])]
|
|
62
|
+
modelRefs: [...new Set([...getAvailableVideoModelRefs(), modelRef])],
|
|
63
|
+
models: Object.fromEntries(getAvailableVideoModelRefs().map((ref) => [ref, getVideoModelDefinition(ref)]))
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
function registerVideoGenerationRoutes(app, deps) {
|
|
@@ -79,7 +80,7 @@ function registerVideoGenerationRoutes(app, deps) {
|
|
|
79
80
|
}).safeParse(await c.req.json().catch(() => null));
|
|
80
81
|
if (!parsed.success) return c.json({ error: "Invalid video defaults" }, 400);
|
|
81
82
|
const { modelRef, duration, resolution } = parsed.data;
|
|
82
|
-
const model =
|
|
83
|
+
const model = getVideoModelDefinition(modelRef);
|
|
83
84
|
if (!isVideoDurationSupported(model, duration) || !model.resolutions.includes(resolution)) return c.json({ error: "The selected model does not support these video defaults" }, 400);
|
|
84
85
|
setVideoDefaults(modelRef, {
|
|
85
86
|
duration,
|
|
@@ -130,7 +131,7 @@ function registerVideoGenerationRoutes(app, deps) {
|
|
|
130
131
|
const { imageUri, modelRef, ...request } = parsed.data;
|
|
131
132
|
const upload = form?.get("image") ?? null;
|
|
132
133
|
if (upload !== null && (!(upload instanceof File) || imageUri || !upload.size || upload.size > 5242880)) return c.json({ error: "Provide one PNG, JPEG or WebP image up to 5 MiB" }, 400);
|
|
133
|
-
const model =
|
|
134
|
+
const model = getVideoModelDefinition(modelRef);
|
|
134
135
|
const hasImage = Boolean(upload || imageUri);
|
|
135
136
|
if (!isVideoDurationSupported(model, request.duration) || !model.resolutions.includes(request.resolution) || hasImage && !model.imageRatios.includes(request.ratio)) return c.json({ error: "The selected model does not support these video settings" }, 400);
|
|
136
137
|
let bytes;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SessionInputControlCommand } from '@xopcai/gateway-contract';
|
|
1
|
+
import { parseUserTurnDocument, type SessionInputControlCommand } from '@xopcai/gateway-contract';
|
|
2
2
|
import { type PhoneAssistance } from '../../phone/assistance.js';
|
|
3
3
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
4
4
|
import type { ConnectionWait } from '@xopcai/gateway-contract';
|
|
@@ -66,6 +66,7 @@ export declare class SessionInputCoordinator {
|
|
|
66
66
|
sourceContexts?: AgentSourceContext[];
|
|
67
67
|
voiceAgentInstruction?: boolean;
|
|
68
68
|
clientMessageId?: string;
|
|
69
|
+
userTurnDocument?: NonNullable<ReturnType<typeof parseUserTurnDocument>>;
|
|
69
70
|
onHandled?: () => void;
|
|
70
71
|
}) => Promise<boolean>;
|
|
71
72
|
emit: (type: string, payload: unknown) => void;
|
|
@@ -300,7 +300,7 @@ var SessionInputCoordinator = class {
|
|
|
300
300
|
}
|
|
301
301
|
const target = validateLatestSessionTurnTarget(conversationId, targetTurnId);
|
|
302
302
|
if (target.ok === false) return target;
|
|
303
|
-
const original = findSessionInputByRunId(conversationId, targetTurnId);
|
|
303
|
+
const original = targetTurnId.startsWith("steer:") ? findSessionInput(conversationId, targetTurnId.slice(6)) : findSessionInputByRunId(conversationId, targetTurnId);
|
|
304
304
|
if (original) {
|
|
305
305
|
input.origin = original.origin;
|
|
306
306
|
input.sourceContexts = [...(input.sourceContexts ?? []).filter((source) => source.kind !== "device_context"), ...(original.contextSnapshots ?? []).filter((source) => source.kind === "device_context")];
|
|
@@ -506,6 +506,7 @@ var SessionInputCoordinator = class {
|
|
|
506
506
|
}
|
|
507
507
|
steerInput(row, runId) {
|
|
508
508
|
const text = steeringText(row.content, row.contextSnapshots);
|
|
509
|
+
const userTurnDocument = parseUserTurnDocument(row.content);
|
|
509
510
|
const voiceAgentInstruction = isNaturalVoiceDelegation(row);
|
|
510
511
|
const trackDelivery = row.origin.type === "endpoint";
|
|
511
512
|
if (!trackDelivery && !voiceAgentInstruction && !row.attachments?.length && !row.contextSnapshots?.length) return this.deps.steer(row.conversationId, text, runId);
|
|
@@ -515,6 +516,7 @@ var SessionInputCoordinator = class {
|
|
|
515
516
|
...voiceAgentInstruction ? { voiceAgentInstruction: true } : {},
|
|
516
517
|
...trackDelivery ? {
|
|
517
518
|
clientMessageId: row.clientMessageId,
|
|
519
|
+
...userTurnDocument ? { userTurnDocument } : {},
|
|
518
520
|
onHandled: () => {
|
|
519
521
|
const current = getSessionInputById(row.conversationId, row.id);
|
|
520
522
|
if (current?.status === "injecting" && current.targetRunId === runId) setSessionInputStatus(row.id, "completed");
|
|
@@ -107,10 +107,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
107
107
|
import "../discussions/index.js";
|
|
108
108
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
109
109
|
import "../endpoint-tools/index.js";
|
|
110
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
111
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
112
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
113
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
114
110
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
115
111
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
116
112
|
import { deliverAutomationCompletion } from "./automation-completion-delivery.js";
|
|
@@ -177,6 +173,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
|
|
|
177
173
|
import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
|
|
178
174
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
179
175
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
176
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
177
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
178
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
179
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
180
180
|
import crypto from "node:crypto";
|
|
181
181
|
//#region src/gateway/service.ts
|
|
182
182
|
init_session_repository();
|
|
@@ -7,14 +7,14 @@ import { TaskRepository, init_task_repository } from "../tasks/task-repository.j
|
|
|
7
7
|
import { appendTranscriptEntry } from "../storage/sqlite/transcript-repository.js";
|
|
8
8
|
import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
|
|
9
9
|
import { TaskApplicationService } from "../tasks/task-application-service.js";
|
|
10
|
-
import { homePatternKey } from "./strategy.js";
|
|
11
|
-
import { HomeIntelligenceRepository } from "./repository.js";
|
|
12
|
-
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
13
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
14
10
|
import { HomeObservation, ObservationConflictError } from "./observation.js";
|
|
15
11
|
import { HomeFollowUps } from "./follow-ups.js";
|
|
16
|
-
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
17
12
|
import { observationStarters } from "./observation-starters.js";
|
|
13
|
+
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
14
|
+
import { homePatternKey } from "./strategy.js";
|
|
15
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
16
|
+
import { HomeIntelligenceRepository } from "./repository.js";
|
|
17
|
+
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
18
18
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
19
19
|
import { ObservationRoutines } from "./routines.js";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MusicProvider } from './provider.js';
|
|
2
2
|
export declare function musicArtifactExists(id: string): Promise<boolean>;
|
|
3
3
|
export declare function deleteMusicArtifact(id: string): Promise<void>;
|
|
4
|
-
export declare function saveMusicArtifact(id: string, provider: MusicProvider, source: string, canPublish: () => boolean): Promise<void>;
|
|
4
|
+
export declare function saveMusicArtifact(id: string, provider: MusicProvider, source: string, canPublish: () => boolean, key?: string): Promise<void>;
|
|
5
5
|
export declare function readMusicArtifact(id: string, rangeHeader?: string, download?: boolean): Promise<Response>;
|
|
@@ -21,9 +21,10 @@ async function musicArtifactExists(id) {
|
|
|
21
21
|
async function deleteMusicArtifact(id) {
|
|
22
22
|
await deleteMediaUris([buildMediaUri("outbound", `music-${id}.mp3`)], { strict: true });
|
|
23
23
|
}
|
|
24
|
-
async function saveMusicArtifact(id, provider, source, canPublish) {
|
|
24
|
+
async function saveMusicArtifact(id, provider, source, canPublish, key) {
|
|
25
25
|
const url = new URL(source);
|
|
26
|
-
|
|
26
|
+
const download = provider.downloadAudio && key ? () => provider.downloadAudio(key, url) : void 0;
|
|
27
|
+
if (url.protocol !== "https:" || url.username || url.password || url.port || !download && !provider.allowsAudioHost(url.hostname)) throw new Error("Music provider returned an untrusted audio URL.");
|
|
27
28
|
await assertSafeUrl(url);
|
|
28
29
|
const path = artifactPath(id);
|
|
29
30
|
const temporary = `${path}.${randomUUID()}.part`;
|
|
@@ -31,7 +32,7 @@ async function saveMusicArtifact(id, provider, source, canPublish) {
|
|
|
31
32
|
recursive: true,
|
|
32
33
|
mode: 448
|
|
33
34
|
});
|
|
34
|
-
const response = await fetch(url, {
|
|
35
|
+
const response = download ? await download() : await fetch(url, {
|
|
35
36
|
signal: AbortSignal.timeout(45e3),
|
|
36
37
|
redirect: "error"
|
|
37
38
|
});
|
|
@@ -27,6 +27,7 @@ export interface MusicProvider {
|
|
|
27
27
|
submit(key: string, model: string, input: MusicInput): Promise<string>;
|
|
28
28
|
query(key: string, mode: MusicMode, taskId: string): Promise<MusicProviderStatus>;
|
|
29
29
|
allowsAudioHost(host: string): boolean;
|
|
30
|
+
downloadAudio?(key: string, url: URL): Promise<Response>;
|
|
30
31
|
}
|
|
31
32
|
export declare class MusicRequestRejected extends Error {
|
|
32
33
|
readonly code: Extract<MusicJobErrorCode, 'provider_rate_limited' | 'provider_rejected'>;
|
|
@@ -26,8 +26,11 @@ function resolveMusicModel(ref) {
|
|
|
26
26
|
}
|
|
27
27
|
function selectedMusicModel() {
|
|
28
28
|
const ref = storedMusicModel() ?? process.env.XOPC_MUSIC_MODEL?.trim();
|
|
29
|
-
if (ref && resolveMusicModel(ref)) return ref;
|
|
30
29
|
const cloud = getCloudMediaDefault("music");
|
|
30
|
+
if (ref && resolveMusicModel(ref)) {
|
|
31
|
+
if (cloud === "xopc-cloud/music" && ref.startsWith("xopc-cloud/") && !getCloudMediaModels("music").some((item) => `xopc-cloud/${item.id}` === ref)) return cloud;
|
|
32
|
+
return ref;
|
|
33
|
+
}
|
|
31
34
|
return cloud && resolveMusicModel(cloud) ? cloud : DEFAULT_MUSIC_MODEL;
|
|
32
35
|
}
|
|
33
36
|
function hasMusicProvider(id) {
|
|
@@ -109,7 +109,7 @@ var MusicGenerationWorker = class {
|
|
|
109
109
|
keepLease: true
|
|
110
110
|
})) return;
|
|
111
111
|
saving = true;
|
|
112
|
-
await saveMusicArtifact(id, provider, result.url, () => updateMusicJob(id, token, "saving", { keepLease: true }));
|
|
112
|
+
await saveMusicArtifact(id, provider, result.url, () => updateMusicJob(id, token, "saving", { keepLease: true }), key);
|
|
113
113
|
if (await musicArtifactExists(id)) updateMusicJob(id, token, "completed");
|
|
114
114
|
if (!getMusicJob(row.conversation_id, id)) await deleteMusicArtifact(id);
|
|
115
115
|
}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "../providers/xopc-cloud-config.js";
|
|
1
2
|
import { CLOUD_MEDIA_PROVIDER, CloudMediaError, queryCloudMedia, submitCloudMedia } from "../providers/xopc-cloud-media.js";
|
|
2
3
|
import { MusicRequestRejected } from "./provider.js";
|
|
3
4
|
import { murekaGlobalProvider, murekaProvider } from "./mureka.js";
|
|
4
5
|
import { tencentMpsProvider } from "./tencent-mps.js";
|
|
6
|
+
//#region src/music-generation/xopc-cloud.ts
|
|
7
|
+
init_xopc_cloud_config();
|
|
5
8
|
const cloudMusicProvider = {
|
|
6
9
|
id: CLOUD_MEDIA_PROVIDER,
|
|
7
10
|
name: "XOPC Cloud",
|
|
8
11
|
models: {
|
|
9
12
|
music: murekaProvider.models["mureka-9.5"],
|
|
13
|
+
"music-mureka-cn": {
|
|
14
|
+
...murekaProvider.models["mureka-9.5"],
|
|
15
|
+
name: "mureka-9.5 (China)"
|
|
16
|
+
},
|
|
10
17
|
"music-mureka-global": {
|
|
11
18
|
...murekaGlobalProvider.models["mureka-9.5"],
|
|
12
19
|
name: "mureka-9.5 (Global)"
|
|
@@ -15,6 +22,21 @@ const cloudMusicProvider = {
|
|
|
15
22
|
},
|
|
16
23
|
environmentKey: () => void 0,
|
|
17
24
|
allowsAudioHost: (host) => murekaProvider.allowsAudioHost(host) || tencentMpsProvider.allowsAudioHost(host),
|
|
25
|
+
async downloadAudio(token, url) {
|
|
26
|
+
const router = new URL(resolveXopcModelRouterUrl());
|
|
27
|
+
const prefix = `${router.pathname.replace(/\/$/, "")}/music/generations/`;
|
|
28
|
+
const route = url.pathname.slice(prefix.length);
|
|
29
|
+
if (url.origin === router.origin && url.pathname.startsWith(prefix) && /^[\da-f-]{36}\/audio$/i.test(route) && !url.search && !url.hash) return fetch(url, {
|
|
30
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
31
|
+
signal: AbortSignal.timeout(45e3),
|
|
32
|
+
redirect: "error"
|
|
33
|
+
});
|
|
34
|
+
if (!cloudMusicProvider.allowsAudioHost(url.hostname)) throw new Error("Music provider returned an untrusted audio URL.");
|
|
35
|
+
return fetch(url, {
|
|
36
|
+
signal: AbortSignal.timeout(45e3),
|
|
37
|
+
redirect: "error"
|
|
38
|
+
});
|
|
39
|
+
},
|
|
18
40
|
async submit(token, model, input) {
|
|
19
41
|
try {
|
|
20
42
|
return await submitCloudMedia("music", token, {
|
|
@@ -137,7 +137,9 @@ export declare class SessionIndex extends EventEmitter {
|
|
|
137
137
|
saveMessages(key: string, messages: any[], options?: {
|
|
138
138
|
metadata?: SessionMetadataSeed;
|
|
139
139
|
}): Promise<void>;
|
|
140
|
-
deleteUserRound(key: string,
|
|
140
|
+
deleteUserRound(key: string, target: number | {
|
|
141
|
+
steerId: string;
|
|
142
|
+
}): Promise<{
|
|
141
143
|
deleted: number;
|
|
142
144
|
removedMessages: import("@earendil-works/pi-agent-core").AgentMessage[];
|
|
143
145
|
remainingMessages: import("@earendil-works/pi-agent-core").AgentMessage[];
|
|
@@ -236,8 +236,8 @@ var SessionIndex = class extends EventEmitter$1 {
|
|
|
236
236
|
async saveMessages(key, messages, options) {
|
|
237
237
|
return this.store.saveMessages(key, messages, options);
|
|
238
238
|
}
|
|
239
|
-
async deleteUserRound(key,
|
|
240
|
-
const result = await this.store.deleteUserRound(key,
|
|
239
|
+
async deleteUserRound(key, target) {
|
|
240
|
+
const result = await this.store.deleteUserRound(key, target);
|
|
241
241
|
if (result) this.emit("sessionUpdated", { key });
|
|
242
242
|
return result;
|
|
243
243
|
}
|
|
@@ -170,7 +170,9 @@ export declare class SessionStore {
|
|
|
170
170
|
saveMessages(key: string, messages: AgentMessage[], options?: {
|
|
171
171
|
metadata?: SessionMetadataSeed;
|
|
172
172
|
}): Promise<void>;
|
|
173
|
-
deleteUserRound(key: string,
|
|
173
|
+
deleteUserRound(key: string, target: number | {
|
|
174
|
+
steerId: string;
|
|
175
|
+
}): Promise<{
|
|
174
176
|
deleted: number;
|
|
175
177
|
removedMessages: AgentMessage[];
|
|
176
178
|
remainingMessages: AgentMessage[];
|
|
@@ -520,11 +520,11 @@ var SessionStore = class {
|
|
|
520
520
|
replaceTranscriptRows(key, mergeLlmMessagesPreservingContextRows(await this.loadTranscriptRows(key), messages));
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
-
async deleteUserRound(key,
|
|
523
|
+
async deleteUserRound(key, target) {
|
|
524
524
|
return this.runStoreMutation(async () => {
|
|
525
525
|
requireXopcDatabase();
|
|
526
526
|
const canonicalRows = (await this.loadTranscriptRows(key)).filter((row) => !isTranscriptCompactionEntry(row) && !isRuntimeOnlyTranscriptMessage(row));
|
|
527
|
-
const range = computeTranscriptUserRoundDeleteRange(canonicalRows,
|
|
527
|
+
const range = computeTranscriptUserRoundDeleteRange(canonicalRows, target);
|
|
528
528
|
if (!range) return null;
|
|
529
529
|
const removedRows = canonicalRows.slice(range.startIndex, range.startIndex + range.count);
|
|
530
530
|
const remainingRows = canonicalRows.slice(0, range.startIndex).concat(canonicalRows.slice(range.startIndex + range.count));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type TranscriptStoredRow } from './session-context-for-llm.js';
|
|
2
2
|
/** Raw transcript range for one UI-visible user turn. */
|
|
3
|
-
export declare function computeTranscriptUserRoundDeleteRange(rows: readonly TranscriptStoredRow[],
|
|
3
|
+
export declare function computeTranscriptUserRoundDeleteRange(rows: readonly TranscriptStoredRow[], target: number | {
|
|
4
|
+
steerId: string;
|
|
5
|
+
}): {
|
|
4
6
|
startIndex: number;
|
|
5
7
|
count: number;
|
|
6
8
|
} | null;
|
|
@@ -6,13 +6,15 @@ function isVisibleUserRow(row) {
|
|
|
6
6
|
return row.role === "user";
|
|
7
7
|
}
|
|
8
8
|
/** Raw transcript range for one UI-visible user turn. */
|
|
9
|
-
function computeTranscriptUserRoundDeleteRange(rows,
|
|
10
|
-
if (!Number.isInteger(
|
|
9
|
+
function computeTranscriptUserRoundDeleteRange(rows, target) {
|
|
10
|
+
if (typeof target === "number" && (!Number.isInteger(target) || target < 0)) return null;
|
|
11
11
|
let userCount = 0;
|
|
12
12
|
let startIndex = -1;
|
|
13
13
|
for (let index = 0; index < rows.length; index += 1) {
|
|
14
|
-
|
|
15
|
-
if (
|
|
14
|
+
const row = rows[index];
|
|
15
|
+
if (!isVisibleUserRow(row)) continue;
|
|
16
|
+
const { role, metadata } = row;
|
|
17
|
+
if (typeof target === "number" ? userCount === target : role === "user" && metadata?.steered === true && metadata.clientMessageId === target.steerId) {
|
|
16
18
|
startIndex = index;
|
|
17
19
|
break;
|
|
18
20
|
}
|
|
@@ -18,7 +18,12 @@ function rowTurnId(row) {
|
|
|
18
18
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
19
19
|
}
|
|
20
20
|
function validateTargetRows(rows, targetTurnId) {
|
|
21
|
-
const targetIndex = rows.findIndex((row) =>
|
|
21
|
+
const targetIndex = rows.findIndex((row) => {
|
|
22
|
+
const { role, metadata } = row;
|
|
23
|
+
if (role !== "user") return false;
|
|
24
|
+
if (metadata?.steered && metadata.clientMessageId) return `steer:${metadata.clientMessageId}` === targetTurnId;
|
|
25
|
+
return rowTurnId(row) === targetTurnId;
|
|
26
|
+
});
|
|
22
27
|
if (targetIndex < 0) return {
|
|
23
28
|
ok: false,
|
|
24
29
|
code: "TARGET_NOT_FOUND"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { estimateVideoCostFen, isVideoDurationSupported } from "../../packages/gateway-contract/src/video-generation.js";
|
|
2
2
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
4
4
|
import { getCurrentTranscriptId, init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
5
5
|
import { loadRecentUserTranscriptRows } from "../storage/sqlite/transcript-repository.js";
|
|
6
6
|
import { getActiveTranscriptUserMedia } from "../agent/inbound/attachment-pipeline.js";
|
|
7
7
|
import { getCloudMediaModels } from "../providers/xopc-cloud-media.js";
|
|
8
|
-
import { getVideoDefaults, getVideoModel } from "./settings.js";
|
|
8
|
+
import { getVideoDefaults, getVideoModel, getVideoModelDefinition } from "./settings.js";
|
|
9
9
|
import { getVideoJob } from "./repository.js";
|
|
10
10
|
import { randomUUID } from "node:crypto";
|
|
11
11
|
//#region src/video-generation/drafts.ts
|
|
@@ -40,7 +40,7 @@ function prepareVideoDraft(conversationId, input) {
|
|
|
40
40
|
if (input.action === "create" && previous && !job) throw new Error("A video draft is already pending. Update it instead.");
|
|
41
41
|
const base = input.action === "create" ? void 0 : previous;
|
|
42
42
|
const modelRef = getVideoModel();
|
|
43
|
-
const model =
|
|
43
|
+
const model = getVideoModelDefinition(modelRef);
|
|
44
44
|
const defaults = getVideoDefaults(modelRef);
|
|
45
45
|
const prompt = (input.prompt ?? base?.prompt ?? "").trim();
|
|
46
46
|
if (!prompt || prompt.length > 1e3) throw new Error("Provide a video description of 1–1000 characters.");
|