@xopcai/xopc 0.0.177 → 0.0.178
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-Wu2ikfbM.js → activity-store-BzGX__8I.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-TpIpJk59.js → agents-DC9F12Kw.js} +1 -1
- package/dist/gateway/static/root/assets/{api-DljBt-N5.js → api-hi6f2Xtp.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.js → appearance-settings-BZ-IxQfB.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cxbn5hy8.js → apps-page-5bKr05Fa.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-D18gyP76.js → archive-plugin-ZSLLG8wB.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.js → attachment-load-D4YktqIF.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-DKrVoiiK.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DYv16QMU.js → automations-page-Dg6dmt5g.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DdSyGL6M.js → binary-plugins-BIkPxfxj.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.js → block-editor-Q3v_YQom.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DlcqaGu1.js → browser-settings-page-BHoo6Rpq.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-C0SnSj_R.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.js → browser-workflows-page-B3T1KYk4.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-QPX4wsGZ.js → capabilities-settings-panel-BlsqN8Fu.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-RM6S7ES5.js → capability-presets-api-DE09c0VB.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DmCeusO8.js → capability-presets-settings-panel-DJeT8_B4.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-B4sha-30.js → channel-recipient-api-CFR5FBfS.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-HcKoP1wm.js → channels-settings-C4VVjYEm.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-BPsKIyoM.js → connector-logo-B1mD-3pM.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-DwbThFvd.js → connectors-page-DNcrDThX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DjL1GWON.js → desktop-pet-B1urphOZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-u_abAXh7.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BoZGualI.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-BXcb8fwx.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-C2Jraq8l.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-DcXQDTpG.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.js → gateway-config-api-DmPIZrvg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-Dt1PNJmb.js → gateway-settings-DmObBx9b.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-WaXTw3fi.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DEiOOLGU.js → goal-create-dialog-BRhmmBe9.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-C1Qj4o1K.js → goal-detail-page-C1k7_s_O.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-BL0fAEns.js → goals-config-api-Fwu1wjEP.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-qJDcEDzc.js → goals-page-hOu9uA3q.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-DV3ZlrdI.js → goals-settings-DY-JjvHz.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-C3kzg6ai.js → heartbeat-settings-BtKu2NWT.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.js → image-generation-api-05Gg8wsU.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C1h0zkNo.js → index-C0CGebQ1.js} +7 -7
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-0KSmaPu0.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DcD4mVId.js → local-app-workbench-page-EjsNT7nJ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BMrU8u7w.js → local-apps-page-Df8BW1A_.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.js → locale-store-CTwSy7yW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CW5m9Cov.js → logs-page-Dswjlraa.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BVqbtN9o.js → markdown-split-B3FvKbaP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.js → media-plugins-DsjrvvB6.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-BWZRXsq6.js → notes-page-tuzIwy3c.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DdnwNz9x.js → notes-workbench-DSh3-hMY.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-DWWgy0bF.js → page-tabs-ke9s4nYi.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BR7QFmT-.js → product-open-page-dXQCMAtH.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B8GeS4dl.js → project-detail-page-D0QPRHR_.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-DOeu1Hk_.js → projects-page-CI5Vz62F.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-De94rxnE.js → remote-access-hub-S1jpzBS5.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BzS-rRTP.js → save-bar-controls-Bl30zjHc.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-DqhmXQKo.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.js → schema-form-DkUCy6vf.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-A7p8G0OJ.js → sessions-page-CTm66k7h.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BSDNBfHn.js → settings-form-section-C6ZbNpdy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-k8iE_NdX.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-DgFSya2e.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-B_KDlyZA.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.js → share-preview-page-CV7nL_J9.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-Xo3N99PO.js → shares-settings-DK6XK95e.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C019Ml5q.js → skills-page-BGHvVbay.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CXnpudm6.js → skills-page.utils-kahBIHg0.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-JV3-MG5F.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.js → theme-store-DFLyzoLO.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-C0DCya4U.js → time-picker-XwpxdZFr.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C-M3Fv2N.js → typed-models-lib-60Aqo-UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.js → use-channel-catalog-CnTkHDnw.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-fYBzpus-.js → user-context-page-DBCMk-Vn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-p_g4UI1-.js → voice-api-key-field-CNa8qUgS.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DI0gCZRw.js → work-discovery-page-C1UIdsCl.js} +1 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
- package/dist/gateway/static/root/assets/{work-page-Z-nUaS_n.js → work-page-D5qYmCTq.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CHEXVvhH.js → workflow-run-setup-panel-yV_x595t.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BDfwnM-Y.js → workflows-page-yrK17ZZ5.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +3 -0
- package/dist/src/agent/embedded/run-for-session.js +18 -5
- package/dist/src/agent/embedded/run-turn.js +6 -3
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/routes/browser-install.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/providers/provider-auth-service.js +3 -0
- package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
- package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
- package/dist/src/session/store.d.ts +2 -0
- package/dist/src/session/store.js +30 -0
- package/package.json +3 -11
- package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
- package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
- package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
|
@@ -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-C0CGebQ1.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-DP6tPKk-.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-CTwSy7yW.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-BZEkOdPm.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-BzGX__8I.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-DFLyzoLO.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="/assets/index-eqq25gvV.css">
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -2,6 +2,7 @@ import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
|
|
|
2
2
|
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
4
|
import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
|
|
5
|
+
import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
|
|
5
6
|
import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
|
|
6
7
|
import { getApiKeySync, init_providers } from "../../providers/index.js";
|
|
7
8
|
import { InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
@@ -12,11 +13,13 @@ init_model_credential_store();
|
|
|
12
13
|
init_sync_provider_auth();
|
|
13
14
|
init_paths();
|
|
14
15
|
init_providers();
|
|
16
|
+
init_register_bundled_oauth_flows();
|
|
15
17
|
init_register_runtime_providers();
|
|
16
18
|
function resolveEmbeddedProviderApiKeySync(providerId) {
|
|
17
19
|
return resolveProviderApiKeySync(providerId) ?? getApiKeySync(providerId);
|
|
18
20
|
}
|
|
19
21
|
async function createEmbeddedModelRuntime(providerId) {
|
|
22
|
+
registerBundledOAuthFlows();
|
|
20
23
|
const resolver = new CredentialResolver();
|
|
21
24
|
const credentials = new XopcModelCredentialStore(resolver);
|
|
22
25
|
const modelRuntime = await ModelRuntime.create({
|
|
@@ -91,13 +91,15 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
91
91
|
}, "Agent model fallback candidates resolved");
|
|
92
92
|
let lastResult;
|
|
93
93
|
let lastError;
|
|
94
|
+
let resumeLastUserMessage = false;
|
|
94
95
|
const primaryModelRef = modelRef;
|
|
95
|
-
const beforeLen = Array.isArray(agent.state?.messages) ? agent.state.messages.length : void 0;
|
|
96
96
|
for (let i = 0; i < resolvedCandidates.length; i++) {
|
|
97
97
|
const candidate = resolvedCandidates[i];
|
|
98
98
|
const candidateModelRef = candidate.ref;
|
|
99
99
|
const isFallbackAttempt = i > 0;
|
|
100
100
|
const candidateModel = candidate.model;
|
|
101
|
+
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
102
|
+
const rowsBeforeAttempt = hasNextCandidate ? await sessionStore.loadTranscriptRows(sessionKey) : void 0;
|
|
101
103
|
if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, candidateModel, candidateModelRef);
|
|
102
104
|
agentManager.setModelForSession(sessionKey, candidateModelRef);
|
|
103
105
|
if (isFallbackAttempt) log.info({
|
|
@@ -123,7 +125,8 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
123
125
|
sessionStore,
|
|
124
126
|
timeoutMs: resolveAgentTurnTimeoutMs(config),
|
|
125
127
|
abortSignal: params.abortSignal,
|
|
126
|
-
onEvent: params.onEvent
|
|
128
|
+
onEvent: params.onEvent,
|
|
129
|
+
resumeLastUserMessage
|
|
127
130
|
});
|
|
128
131
|
if (turnResult.ok) {
|
|
129
132
|
if (isFallbackAttempt) log.info({
|
|
@@ -137,7 +140,6 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
137
140
|
return turnResult;
|
|
138
141
|
}
|
|
139
142
|
lastResult = turnResult;
|
|
140
|
-
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
141
143
|
log.warn({
|
|
142
144
|
sessionKey,
|
|
143
145
|
runId,
|
|
@@ -150,7 +152,6 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
150
152
|
} catch (err) {
|
|
151
153
|
lastError = err;
|
|
152
154
|
if (err instanceof DOMException && err.name === "AbortError") throw err;
|
|
153
|
-
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
154
155
|
log.warn({
|
|
155
156
|
err,
|
|
156
157
|
sessionKey,
|
|
@@ -161,7 +162,19 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
161
162
|
hasNextCandidate
|
|
162
163
|
}, hasNextCandidate ? "Agent model call threw, trying fallback" : "Agent model call threw, no fallback remains");
|
|
163
164
|
}
|
|
164
|
-
if (
|
|
165
|
+
if (hasNextCandidate && rowsBeforeAttempt) {
|
|
166
|
+
const preparation = await sessionStore.prepareModelFallback(sessionKey, rowsBeforeAttempt);
|
|
167
|
+
if (preparation === "unsafe") {
|
|
168
|
+
log.warn({
|
|
169
|
+
sessionKey,
|
|
170
|
+
runId,
|
|
171
|
+
modelRef: candidateModelRef,
|
|
172
|
+
attempt: i + 1
|
|
173
|
+
}, "Agent model fallback skipped because the failed attempt changed the transcript");
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
resumeLastUserMessage = preparation === "resume";
|
|
177
|
+
}
|
|
165
178
|
}
|
|
166
179
|
if (lastResult) return lastResult;
|
|
167
180
|
if (lastError instanceof Error) throw lastError;
|
|
@@ -206,9 +206,12 @@ async function runXopcEmbeddedTurn(params) {
|
|
|
206
206
|
}
|
|
207
207
|
try {
|
|
208
208
|
await runAgentTurnWithTimeout(session.agent, async () => {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
if (params.resumeLastUserMessage) await session.agent.continue();
|
|
210
|
+
else {
|
|
211
|
+
const text = userMessageToPromptText(userMessage);
|
|
212
|
+
const images = params.images ?? [];
|
|
213
|
+
await session.prompt(text, images.length > 0 ? { images } : void 0);
|
|
214
|
+
}
|
|
212
215
|
await session.agent.waitForIdle();
|
|
213
216
|
await maybeRetryTurnAfterTransientLlmFailure(session.agent, {
|
|
214
217
|
sessionKey,
|
|
@@ -89,6 +89,8 @@ export type RunXopcEmbeddedTurnParams = {
|
|
|
89
89
|
abortSignal?: AbortSignal;
|
|
90
90
|
onEvent?: (event: EmbeddedStreamEvent) => void;
|
|
91
91
|
images?: ImageContent[];
|
|
92
|
+
/** Continue from the persisted trailing user row instead of appending it again. */
|
|
93
|
+
resumeLastUserMessage?: boolean;
|
|
92
94
|
};
|
|
93
95
|
export type RunXopcEmbeddedTurnResult = {
|
|
94
96
|
ok: boolean;
|
|
@@ -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
|
|
@@ -76,7 +76,7 @@ var ComposioSessionsAdapter = class {
|
|
|
76
76
|
try {
|
|
77
77
|
[{Composio}, {PiProvider}] = await Promise.all([import("@composio/core"), import("@composio/experimental")]);
|
|
78
78
|
} catch (cause) {
|
|
79
|
-
throw new Error("
|
|
79
|
+
throw new Error("The xopc installation is missing the bundled Composio runtime. Reinstall @xopcai/xopc and restart the gateway.", { cause });
|
|
80
80
|
}
|
|
81
81
|
return new Composio({
|
|
82
82
|
apiKey,
|
|
@@ -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";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
2
1
|
import { acquireBrowserInstallLock, cancelBrowserInstall } from "../../../browser/install-lock.js";
|
|
2
|
+
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
3
3
|
import { runPlaywrightChromiumInstallWithProgress } from "../../../browser/providers/playwright-install.js";
|
|
4
4
|
import { streamSSE } from "hono/streaming";
|
|
5
5
|
//#region src/gateway/hono/routes/browser-install.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -2,11 +2,13 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { init_paths, resolveModelsJsonPath } from "../config/paths.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
4
4
|
import { XopcModelCredentialStore, init_model_credential_store } from "../auth/model-credential-store.js";
|
|
5
|
+
import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "./register-bundled-oauth-flows.js";
|
|
5
6
|
import { init_register_runtime_providers, registerRuntimeProviders } from "./register-runtime-providers.js";
|
|
6
7
|
import { InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
7
8
|
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
8
9
|
//#region src/providers/provider-auth-service.ts
|
|
9
10
|
async function createAuthRuntime(credentials) {
|
|
11
|
+
registerBundledOAuthFlows();
|
|
10
12
|
const runtime = await ModelRuntime.create({
|
|
11
13
|
credentials,
|
|
12
14
|
modelsPath: resolveModelsJsonPath(),
|
|
@@ -32,6 +34,7 @@ var init_provider_auth_service = __esmMin((() => {
|
|
|
32
34
|
init_credentials();
|
|
33
35
|
init_model_credential_store();
|
|
34
36
|
init_paths();
|
|
37
|
+
init_register_bundled_oauth_flows();
|
|
35
38
|
init_register_runtime_providers();
|
|
36
39
|
ProviderAuthService = class {
|
|
37
40
|
credentials;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { registerBunOAuthFlows } from "@earendil-works/pi-ai/bun-oauth";
|
|
3
|
+
//#region src/providers/register-bundled-oauth-flows.ts
|
|
4
|
+
/** Statically include pi-ai OAuth flows for single-file runtimes such as Electron. */
|
|
5
|
+
function registerBundledOAuthFlows() {
|
|
6
|
+
if (registered) return;
|
|
7
|
+
registerBunOAuthFlows();
|
|
8
|
+
registered = true;
|
|
9
|
+
}
|
|
10
|
+
var registered;
|
|
11
|
+
var init_register_bundled_oauth_flows = __esmMin((() => {
|
|
12
|
+
registered = false;
|
|
13
|
+
}));
|
|
14
|
+
//#endregion
|
|
15
|
+
init_register_bundled_oauth_flows();
|
|
16
|
+
export { init_register_bundled_oauth_flows, registerBundledOAuthFlows };
|
|
@@ -26,6 +26,7 @@ export interface SessionCompactionHooks {
|
|
|
26
26
|
compactedCount: number;
|
|
27
27
|
}) => Promise<void> | void;
|
|
28
28
|
}
|
|
29
|
+
export type ModelFallbackPreparation = 'prompt' | 'resume' | 'unsafe';
|
|
29
30
|
export declare class SessionStore {
|
|
30
31
|
private options;
|
|
31
32
|
private window;
|
|
@@ -78,6 +79,7 @@ export declare class SessionStore {
|
|
|
78
79
|
private buildSessionDetail;
|
|
79
80
|
loadTranscriptRows(key: string): Promise<TranscriptStoredRow[]>;
|
|
80
81
|
loadTranscriptHistoryRows(key: string): Promise<TranscriptStoredRow[]>;
|
|
82
|
+
prepareModelFallback(key: string, rowsBeforeAttempt: readonly TranscriptStoredRow[]): Promise<ModelFallbackPreparation>;
|
|
81
83
|
getMetadata(key: string): Promise<SessionMetadata | null>;
|
|
82
84
|
resolveKeyBySessionId(sessionId: string): Promise<string | null>;
|
|
83
85
|
updateMetadata(key: string, updates: Partial<SessionMetadata>): Promise<void>;
|
|
@@ -21,6 +21,16 @@ init_paths_state();
|
|
|
21
21
|
init_logger();
|
|
22
22
|
const log = createLogger("SessionStore");
|
|
23
23
|
const INDEX_VERSION = "1.0";
|
|
24
|
+
function isTranscriptMessageRole(row, role) {
|
|
25
|
+
return !!row && typeof row === "object" && "role" in row && row.role === role;
|
|
26
|
+
}
|
|
27
|
+
function isErrorAssistantRow(row) {
|
|
28
|
+
return isTranscriptMessageRole(row, "assistant") && row.stopReason === "error";
|
|
29
|
+
}
|
|
30
|
+
function transcriptPrefixMatches(expected, current) {
|
|
31
|
+
if (current.length < expected.length) return false;
|
|
32
|
+
return expected.every((row, index) => JSON.stringify(row) === JSON.stringify(current[index]));
|
|
33
|
+
}
|
|
24
34
|
var SessionStore = class {
|
|
25
35
|
window;
|
|
26
36
|
compactor;
|
|
@@ -186,6 +196,26 @@ var SessionStore = class {
|
|
|
186
196
|
requireXopcDatabase();
|
|
187
197
|
return loadTranscriptHistoryRowsForSession(key);
|
|
188
198
|
}
|
|
199
|
+
async prepareModelFallback(key, rowsBeforeAttempt) {
|
|
200
|
+
return this.runStoreMutation(async () => {
|
|
201
|
+
requireXopcDatabase();
|
|
202
|
+
const currentRows = loadTranscriptRowsForSession(key);
|
|
203
|
+
if (!transcriptPrefixMatches(rowsBeforeAttempt, currentRows)) return "unsafe";
|
|
204
|
+
let preparedRows = currentRows;
|
|
205
|
+
let removedError = false;
|
|
206
|
+
if (isErrorAssistantRow(preparedRows.at(-1))) {
|
|
207
|
+
preparedRows = preparedRows.slice(0, -1);
|
|
208
|
+
removedError = true;
|
|
209
|
+
}
|
|
210
|
+
const appendedRows = preparedRows.slice(rowsBeforeAttempt.length);
|
|
211
|
+
if (appendedRows.length === 1 && isTranscriptMessageRole(appendedRows[0], "user") || removedError && appendedRows.length === 0 && isTranscriptMessageRole(preparedRows.at(-1), "user")) {
|
|
212
|
+
if (removedError) replaceTranscriptRows(key, preparedRows);
|
|
213
|
+
return "resume";
|
|
214
|
+
}
|
|
215
|
+
if (!removedError && appendedRows.length === 0) return "prompt";
|
|
216
|
+
return "unsafe";
|
|
217
|
+
});
|
|
218
|
+
}
|
|
189
219
|
async getMetadata(key) {
|
|
190
220
|
requireXopcDatabase();
|
|
191
221
|
return getSessionMetadata(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.178",
|
|
4
4
|
"description": "Local-first AI system that remembers context, coordinates AI, and sustains long-term progress.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
"node": ">=22.19.0"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
+
"@composio/core": "0.14.1",
|
|
69
|
+
"@composio/experimental": "0.2.0",
|
|
68
70
|
"@earendil-works/pi-agent-core": "0.84.1",
|
|
69
71
|
"@earendil-works/pi-ai": "0.84.1",
|
|
70
72
|
"@earendil-works/pi-coding-agent": "0.84.1",
|
|
@@ -106,20 +108,12 @@
|
|
|
106
108
|
"zod": "^4.4.3"
|
|
107
109
|
},
|
|
108
110
|
"peerDependencies": {
|
|
109
|
-
"@composio/core": "0.14.1",
|
|
110
|
-
"@composio/experimental": "0.2.0",
|
|
111
111
|
"@huggingface/transformers": "3.8.1",
|
|
112
112
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
113
113
|
"playwright-core": "^1.60.0",
|
|
114
114
|
"sherpa-onnx-node": "1.13.4"
|
|
115
115
|
},
|
|
116
116
|
"peerDependenciesMeta": {
|
|
117
|
-
"@composio/core": {
|
|
118
|
-
"optional": true
|
|
119
|
-
},
|
|
120
|
-
"@composio/experimental": {
|
|
121
|
-
"optional": true
|
|
122
|
-
},
|
|
123
117
|
"@huggingface/transformers": {
|
|
124
118
|
"optional": true
|
|
125
119
|
},
|
|
@@ -134,8 +128,6 @@
|
|
|
134
128
|
}
|
|
135
129
|
},
|
|
136
130
|
"devDependencies": {
|
|
137
|
-
"@composio/core": "0.14.1",
|
|
138
|
-
"@composio/experimental": "0.2.0",
|
|
139
131
|
"@huggingface/transformers": "3.8.1",
|
|
140
132
|
"@larksuiteoapi/node-sdk": "^1.66.0",
|
|
141
133
|
"@resvg/resvg-js": "^2.6.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./locale-store-DVGhFXRz.js";import{n as t}from"./channel-recipient-api-B4sha-30.js";function n(){return e(`/api/channels/status`)}var r=t;export{r as n,n as t};
|