@xopcai/xopc 0.0.175 → 0.0.176
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-CM6mQUS2.js → activity-store-DsFM1upC.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-eckyE9AY.js → agent-avatar-dicebear-DvdMLOga.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-D-OIB_r0.js → agents-BVjlpbeZ.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BfMRS6FX.js → api-BdPLCCBm.js} +1 -1
- package/dist/gateway/static/root/assets/{api-2SLLStKp.js → api-Bop4IQRW.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DYkzZQzZ.js → app-management-settings-panel-DMLDOHul.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-DbI9foFR.js +1 -0
- package/dist/gateway/static/root/assets/{apps-page-CuvFyvuu.js → apps-page-njqxLWYD.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-k909a76t.js → archive-plugin-Dfdxuwvb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CqNzyhdJ.js → attachment-load-Dn3RlnYD.js} +2 -2
- package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
- package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
- package/dist/gateway/static/root/assets/{automation-suggestion-card-snNG6u0v.js → automation-suggestion-card-Bc0Y7A9u.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DetGVTjI.js → automations-page-D-eweHZJ.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-PfQ9ZHDF.js → binary-plugins-0XtB-xC0.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-Xrw-DnE_.js → block-editor-C4fXWbEE.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-G92AdEnX.js → browser-settings-page-lC86-drr.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DJPF2lUY.js → browser-workflow-inputs-CZmzNymN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BoXs4pgc.js → browser-workflows-page-CBYM9HqG.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-nS_AMN1K.js → capabilities-settings-panel-6tYNfHqJ.js} +2 -2
- package/dist/gateway/static/root/assets/{capability-presets-api-BgY-Ysmi.js → capability-presets-api-BiJxmmhW.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DIO8ZNHW.js → capability-presets-settings-panel-Co-ymbd9.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-D32T1EJM.js → channel-recipient-api-BKTUZDp-.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-4Im3vtnO.js → channels-settings-D46eVjaQ.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BMRAO4zZ.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-C-l8haIK.js → connector-logo-Pr4RIKjj.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-vL3SjHSc.js → connectors-page-Dw1eYbRi.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CwOI_Hei.js → desktop-pet-B8cZuQUt.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Cldo_pA3.js → desktop-pet-settings-CEQacUDF.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CMASXbgJ.js → directory-picker-path-field-DWnxdZtc.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BnMx02w0.js → dreaming-settings-D2e2w2Ho.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-mUFs3ign.js → extension-debug-page-BLjTGbv3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BsFBOZ5N.js → extension-page-D2_UC6hy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CTEoovnV.js → extension-settings-page-BsH6o_PX.js} +1 -1
- package/dist/gateway/static/root/assets/{focus-detail-page-CCaZthpU.js → focus-detail-page-BBXUtxRB.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Bwx-EetD.js → gateway-config-api-C-DkC6UJ.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CvgyqhR_.js → gateway-settings-DEOGiimF.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-C8f5KwkT.js → gateway-startup-retry-BlSLh1TF.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-Bhynl9LN.js → goal-create-dialog-CSFcRE_N.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-ChS2rU0w.js → goal-detail-page-VjRArfAJ.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-CUnfbgHa.js → goals-config-api-CcdS9qek.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BAS_liXl.js → goals-page-BAcErdch.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-Bkk-tOcf.js → goals-settings-BY7crl0z.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D9Pldf5E.js → heartbeat-settings-DtTkS0gs.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-D7aCMgOv.js → image-generation-api-WGgkbwDZ.js} +1 -1
- package/dist/gateway/static/root/assets/index-2UImfRDC.js +212 -0
- package/dist/gateway/static/root/assets/index-CS9sVShT.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CBhtXhHb.js → keyboard-shortcuts-settings-C5lpWQ3f.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-HQeu_F1C.js → local-app-workbench-page-Cl0fcPL4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BtJGF3M8.js → local-apps-page-b05wWvXG.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DO-u1yS7.js → locale-store-sToMfHX_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-0lvwfLAA.js → logs-page-cDE1jLJv.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGPaeTch.js → markdown-split-0gPVst5y.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C_Cx8v6u.js → media-plugins-Rxyq_KTm.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CarlxqXV.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-CIYy5BKF.js → notes-page-DRhNDl_Q.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-_FgNPlOx.js → notes-workbench-BKNBk0Uf.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-C2vsdfJO.js → page-tabs-cOEOQqHh.js} +1 -1
- package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
- package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-D_VT83bW.js → preview-open-alternatives-BopOLFvu.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BNP9kZ3Q.js → product-open-page-DWVPmmOq.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-MNi-3mZU.js → project-detail-page-BhjEXNQW.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-xx8nUKZO.js → projects-page-B80e69PH.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-H5DSn2bR.js → remote-access-hub-CwdVob6H.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BJL6Xb-F.js → save-bar-controls-BfZmKe1t.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-CxCPSLbu.js → schedule-field-Cpi4jCRV.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Cao1wGbk.js → schema-form-OXFkcZQe.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-CMQsupwM.js → sessions-page-BGt3Asj6.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BnTdM9Nn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-9pgClEud.js → settings-form-section-BwqkZCHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CQz0gEUK.js → settings-loading-skeleton-BbqH_S3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DgsMzZLm.js → settings-page-BoxC-JSa.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BhqupMfG.js → settings-page-layout-Ddu2iGaW.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B7BsWxJt.js → setup-status-panel-z1Lwv0js.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CC4dQsQN.js → share-preview-page-CVazOFjy.js} +2 -2
- package/dist/gateway/static/root/assets/{shares-settings-Bhz21P05.js → shares-settings-C4lXuyQj.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DSuIDkeI.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-A0rNObNB.js → skills-page-xgZczqVe.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-CF4AYPQg.js → skills-page.utils-DgyB1tSo.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CzZHWI4u.js → system-settings-panel-BoLSQL65.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BZWNdSZC.js → theme-store-CBNcGOfj.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-BC922Mdg.js → time-picker-gochWrny.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C1S-B1pk.js → typed-models-lib-DvRnr7YB.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DTiLxcLF.js → use-channel-catalog-CA9BFVB7.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-8XdpiAyP.js → user-context-page-CEfIy4WZ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CtIYRNfI.js → voice-api-key-field-v8tgylEZ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DBer86NF.js → work-discovery-page-B-3MClaf.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-BUPyfYaq.js → work-item-detail-page-CEsFEdax.js} +1 -1
- package/dist/gateway/static/root/assets/work-page-CT9AHnq6.js +3 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CC3cJn5k.js +3 -0
- package/dist/gateway/static/root/assets/{workflows-page-CNls7g6v.js → workflows-page-C-1-_Zp1.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +7 -7
- package/dist/src/agent/context/execution-scope.d.ts +26 -0
- package/dist/src/agent/context/execution-scope.js +84 -0
- package/dist/src/agent/context/project-context.d.ts +3 -1
- package/dist/src/agent/context/project-context.js +26 -8
- package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
- package/dist/src/agent/embedded/model-runtime.js +17 -29
- package/dist/src/agent/embedded/session-runner.js +2 -3
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
- package/dist/src/agent/prompt/system-prompt.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +7 -4
- package/dist/src/agent/session/session-config-service.d.ts +4 -1
- package/dist/src/agent/session/session-config-service.js +5 -3
- package/dist/src/agent/session/session-inspector.d.ts +6 -0
- package/dist/src/agent/session/session-inspector.js +9 -2
- package/dist/src/agent/workflow/subagent-runner.js +2 -0
- package/dist/src/agent/workflow/types.d.ts +1 -0
- package/dist/src/auth/model-credential-store.d.ts +17 -0
- package/dist/src/auth/model-credential-store.js +110 -0
- package/dist/src/auth/oauth/github-copilot.js +2 -2
- package/dist/src/auth/oauth/openai-codex.js +98 -7
- package/dist/src/auth/oauth/types.d.ts +4 -1
- package/dist/src/auth/oauth/xopc-cloud.js +124 -6
- package/dist/src/cli/commands/gateway/lifecycle.js +2 -2
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/schema.d.ts +21 -0
- package/dist/src/config/schema.js +12 -2
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
- package/dist/src/gateway/hono/lib/config-payload.js +1 -0
- package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
- package/dist/src/gateway/hono/oauth-async.js +20 -8
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
- package/dist/src/gateway/hono/routes/goals.js +13 -0
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +2 -1
- package/dist/src/gateway/service.js +5 -5
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +2 -2
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/providers/index.js +4 -2
- package/dist/src/providers/provider-auth-service.d.ts +22 -0
- package/dist/src/providers/provider-auth-service.js +66 -0
- package/dist/src/providers/register-runtime-providers.d.ts +6 -0
- package/dist/src/providers/register-runtime-providers.js +55 -0
- package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
- package/dist/src/providers/xopc-cloud-account-service.js +6 -5
- package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
- package/dist/src/providers/xopc-cloud-config.js +13 -0
- package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
- package/dist/src/providers/xopc-cloud-model-source.js +6 -5
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/thinking-resolve.d.ts +8 -0
- package/dist/src/session/thinking-resolve.js +6 -3
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
- package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
- package/dist/src/workflows/engine/workflow-engine.js +2 -0
- package/dist/src/workflows/service/workflow-run-service.js +12 -6
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/appearance-settings-CDXXN57j.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CMctpuqb.js +0 -1
- package/dist/gateway/static/root/assets/index-DJ5vdaHk.css +0 -1
- package/dist/gateway/static/root/assets/index-TnouSpay.js +0 -212
- package/dist/gateway/static/root/assets/messages-BP8aQX-5.js +0 -3
- package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
- package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
- package/dist/gateway/static/root/assets/settings-advanced-gate-OBUdG6bV.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CBP-UB88.js +0 -1
- package/dist/gateway/static/root/assets/work-page-G8phwwI1.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-IKxqDAXw.js +0 -3
|
@@ -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-2UImfRDC.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-CarlxqXV.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-sToMfHX_.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-BlSLh1TF.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-DsFM1upC.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-CBNcGOfj.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CS9sVShT.css">
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -12,7 +12,7 @@ import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
|
12
12
|
import { getApiKeySync, getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
|
|
13
13
|
import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
|
|
14
14
|
import { extractTextContent } from "./context/workspace.js";
|
|
15
|
-
import {
|
|
15
|
+
import { buildExecutionScopeContextForPrompt } from "./context/execution-scope.js";
|
|
16
16
|
import { clearBootstrapSnapshot } from "./bootstrap/bootstrap-cache.js";
|
|
17
17
|
import { resolveBootstrapContextSync } from "./bootstrap/bootstrap-files.js";
|
|
18
18
|
import { loadProjectAgentsContextFile } from "./bootstrap/project-agents-context.js";
|
|
@@ -532,7 +532,7 @@ var AgentManager = class {
|
|
|
532
532
|
const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
|
|
533
533
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
534
534
|
const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
|
|
535
|
-
instance.activeProjectContext =
|
|
535
|
+
instance.activeProjectContext = buildExecutionScopeContextForPrompt(instance.sessionKey);
|
|
536
536
|
instance.activeSelfVerifyContext = this.getSelfVerifyPromptContext(instance.sessionKey, instance.effectiveProfile.agentId);
|
|
537
537
|
const newPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
538
538
|
externalMemoryInstructions: rt.memoryManager.buildExternalSystemPrompt(),
|
|
@@ -604,7 +604,7 @@ var AgentManager = class {
|
|
|
604
604
|
const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
|
|
605
605
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
606
606
|
const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
|
|
607
|
-
instance.activeProjectContext =
|
|
607
|
+
instance.activeProjectContext = buildExecutionScopeContextForPrompt(instance.sessionKey);
|
|
608
608
|
instance.activeSelfVerifyContext = this.getSelfVerifyPromptContext(instance.sessionKey, instance.effectiveProfile.agentId);
|
|
609
609
|
const newPrompt = rt.systemPromptBuilder.rebuild(contextFiles, {
|
|
610
610
|
externalMemoryInstructions: rt.memoryManager.buildExternalSystemPrompt(),
|
|
@@ -648,7 +648,7 @@ var AgentManager = class {
|
|
|
648
648
|
sessionKey
|
|
649
649
|
}, "memory initializeAll failed"));
|
|
650
650
|
if (isMemorySubsystemEnabled(cfg) && shouldRegisterCuratedMemoryTool(cfg)) rt.builtinMemoryStore.loadFromDiskSync();
|
|
651
|
-
const activeProjectContext =
|
|
651
|
+
const activeProjectContext = buildExecutionScopeContextForPrompt(sessionKey);
|
|
652
652
|
const activeSelfVerifyContext = this.getSelfVerifyPromptContext(sessionKey, profile.agentId);
|
|
653
653
|
const profileModelRef = profile.primaryModelRef?.trim() || this.defaultModel;
|
|
654
654
|
const modelManager = this.config.getModelManager?.();
|
|
@@ -745,7 +745,7 @@ var AgentManager = class {
|
|
|
745
745
|
const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
|
|
746
746
|
const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
|
|
747
747
|
const thinkingLevel = instance.effectiveProfile.thinkingDefault ?? this.config.thinkingLevel ?? "medium";
|
|
748
|
-
const activeProjectContext =
|
|
748
|
+
const activeProjectContext = buildExecutionScopeContextForPrompt(sessionKey);
|
|
749
749
|
const activeSelfVerifyContext = this.getSelfVerifyPromptContext(sessionKey, instance.effectiveProfile.agentId);
|
|
750
750
|
instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
751
751
|
externalMemoryInstructions: rt.memoryManager.buildExternalSystemPrompt(),
|
|
@@ -917,7 +917,7 @@ var AgentManager = class {
|
|
|
917
917
|
};
|
|
918
918
|
}
|
|
919
919
|
refreshActiveProjectContextIfChanged(instance) {
|
|
920
|
-
const nextProjectContext =
|
|
920
|
+
const nextProjectContext = buildExecutionScopeContextForPrompt(instance.sessionKey);
|
|
921
921
|
const nextSelfVerifyContext = this.getSelfVerifyPromptContext(instance.sessionKey, instance.effectiveProfile.agentId);
|
|
922
922
|
if (nextProjectContext === instance.activeProjectContext && nextSelfVerifyContext === (instance.activeSelfVerifyContext ?? "")) return;
|
|
923
923
|
const cfg = this.config.config;
|
|
@@ -964,7 +964,7 @@ var AgentManager = class {
|
|
|
964
964
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
965
965
|
const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
|
|
966
966
|
const thinkingLevel = instance.agent.state.thinkingLevel ?? instance.effectiveProfile.thinkingDefault ?? this.config.thinkingLevel ?? "medium";
|
|
967
|
-
const activeProjectContext =
|
|
967
|
+
const activeProjectContext = buildExecutionScopeContextForPrompt(sessionKey);
|
|
968
968
|
const activeSelfVerifyContext = this.getSelfVerifyPromptContext(sessionKey, instance.effectiveProfile.agentId);
|
|
969
969
|
instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
970
970
|
externalMemoryInstructions: rt.memoryManager.buildExternalSystemPrompt(),
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type ExecutionObjective = {
|
|
2
|
+
kind: 'goal';
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
objective: string;
|
|
6
|
+
status: string;
|
|
7
|
+
scopeBoundary?: string;
|
|
8
|
+
acceptanceCriteria: string[];
|
|
9
|
+
evidencePlan: string[];
|
|
10
|
+
nextAction?: string;
|
|
11
|
+
blockedReason?: string;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'workflow';
|
|
14
|
+
id?: string;
|
|
15
|
+
title: string;
|
|
16
|
+
objective: string;
|
|
17
|
+
status: 'running';
|
|
18
|
+
};
|
|
19
|
+
export interface ExecutionScope {
|
|
20
|
+
sessionKey: string;
|
|
21
|
+
projectId?: string;
|
|
22
|
+
objective?: ExecutionObjective;
|
|
23
|
+
}
|
|
24
|
+
export declare function resolveExecutionScope(sessionKey: string): ExecutionScope;
|
|
25
|
+
export declare function formatCurrentWorkForPrompt(scope: ExecutionScope): string | undefined;
|
|
26
|
+
export declare function buildExecutionScopeContextForPrompt(sessionKey: string): string | undefined;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
2
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
3
|
+
import "../../storage/sqlite/index.js";
|
|
4
|
+
import { GoalService } from "../../goals/goal-service.js";
|
|
5
|
+
import "../../goals/index.js";
|
|
6
|
+
import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
|
|
7
|
+
import { buildActiveProjectContextForPrompt } from "./project-context.js";
|
|
8
|
+
//#region src/agent/context/execution-scope.ts
|
|
9
|
+
const MAX_OBJECTIVE_TEXT = 1200;
|
|
10
|
+
const MAX_CRITERIA = 12;
|
|
11
|
+
function bounded(value, max = MAX_OBJECTIVE_TEXT) {
|
|
12
|
+
const text = value?.trim();
|
|
13
|
+
if (!text) return void 0;
|
|
14
|
+
return text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}…`;
|
|
15
|
+
}
|
|
16
|
+
function goalObjective(goal) {
|
|
17
|
+
return {
|
|
18
|
+
kind: "goal",
|
|
19
|
+
id: goal.id,
|
|
20
|
+
title: goal.title,
|
|
21
|
+
objective: goal.contract?.objective?.trim() || goal.title,
|
|
22
|
+
status: goal.status,
|
|
23
|
+
scopeBoundary: bounded(goal.contract?.scopeBoundary),
|
|
24
|
+
acceptanceCriteria: goal.checklist.slice(0, MAX_CRITERIA).map((item) => item.text),
|
|
25
|
+
evidencePlan: goal.contract?.evidencePlan.slice(0, MAX_CRITERIA) ?? [],
|
|
26
|
+
nextAction: bounded(goal.nextAction),
|
|
27
|
+
blockedReason: bounded(goal.blockedReason)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function workflowObjective(sessionKey) {
|
|
31
|
+
const metadata = getSessionMetadata(sessionKey);
|
|
32
|
+
if (!metadata) return void 0;
|
|
33
|
+
if (metadata.sessionType === "workflow-subagent" && metadata.parentSessionKey) return workflowObjective(metadata.parentSessionKey);
|
|
34
|
+
if (metadata.sessionType !== "workflow-run") return void 0;
|
|
35
|
+
const objective = bounded(typeof metadata.customData?.workflowGoal === "string" ? metadata.customData.workflowGoal : void 0);
|
|
36
|
+
const definitionId = metadata.workflowDefinitionId?.trim() || (typeof metadata.customData?.workflowDefinitionId === "string" ? metadata.customData.workflowDefinitionId.trim() : "workflow");
|
|
37
|
+
return {
|
|
38
|
+
kind: "workflow",
|
|
39
|
+
id: metadata.workflowRunId,
|
|
40
|
+
title: definitionId,
|
|
41
|
+
objective: objective || definitionId,
|
|
42
|
+
status: "running"
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resolveExecutionScope(sessionKey) {
|
|
46
|
+
if (!isXopcDatabaseOpen()) return { sessionKey };
|
|
47
|
+
const metadata = getSessionMetadata(sessionKey);
|
|
48
|
+
const activeGoal = new GoalService().getActiveForSession(sessionKey);
|
|
49
|
+
return {
|
|
50
|
+
sessionKey,
|
|
51
|
+
projectId: metadata?.projectId,
|
|
52
|
+
objective: activeGoal ? goalObjective(activeGoal) : workflowObjective(sessionKey)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function formatCurrentWorkForPrompt(scope) {
|
|
56
|
+
const objective = scope.objective;
|
|
57
|
+
if (!objective) return void 0;
|
|
58
|
+
const lines = [
|
|
59
|
+
"# Current Work",
|
|
60
|
+
"",
|
|
61
|
+
`Type: ${objective.kind}`,
|
|
62
|
+
...objective.id ? [`Id: ${sanitizeForPromptLiteral(objective.id)}`] : [],
|
|
63
|
+
`Title: ${sanitizeForPromptLiteral(objective.title)}`,
|
|
64
|
+
`Status: ${objective.status}`,
|
|
65
|
+
"",
|
|
66
|
+
"## Objective",
|
|
67
|
+
sanitizeForPromptLiteral(objective.objective)
|
|
68
|
+
];
|
|
69
|
+
if (objective.kind === "goal") {
|
|
70
|
+
if (objective.scopeBoundary) lines.push("", "## Scope Boundary", sanitizeForPromptLiteral(objective.scopeBoundary));
|
|
71
|
+
if (objective.acceptanceCriteria.length > 0) lines.push("", "## Acceptance Criteria", ...objective.acceptanceCriteria.map((item) => `- ${sanitizeForPromptLiteral(item)}`));
|
|
72
|
+
if (objective.evidencePlan.length > 0) lines.push("", "## Completion Evidence", ...objective.evidencePlan.map((item) => `- ${sanitizeForPromptLiteral(item)}`));
|
|
73
|
+
if (objective.nextAction) lines.push("", "Next action:", sanitizeForPromptLiteral(objective.nextAction));
|
|
74
|
+
if (objective.blockedReason) lines.push("", "Blocked reason:", sanitizeForPromptLiteral(objective.blockedReason));
|
|
75
|
+
}
|
|
76
|
+
lines.push("", "Keep work inside this objective and its project scope. Treat the acceptance criteria and completion evidence as the definition of done.");
|
|
77
|
+
return lines.join("\n");
|
|
78
|
+
}
|
|
79
|
+
function buildExecutionScopeContextForPrompt(sessionKey) {
|
|
80
|
+
const scope = resolveExecutionScope(sessionKey);
|
|
81
|
+
return [buildActiveProjectContextForPrompt(sessionKey, { memoryQuery: scope.objective?.objective }), formatCurrentWorkForPrompt(scope)].filter((section) => Boolean(section?.trim())).join("\n\n") || void 0;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { buildExecutionScopeContextForPrompt, formatCurrentWorkForPrompt, resolveExecutionScope };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type GoalWithDetails } from '../../goals/index.js';
|
|
2
2
|
import type { Project } from '../../projects/types.js';
|
|
3
|
-
export declare function buildActiveProjectContextForPrompt(sessionKey: string
|
|
3
|
+
export declare function buildActiveProjectContextForPrompt(sessionKey: string, options?: {
|
|
4
|
+
memoryQuery?: string;
|
|
5
|
+
}): string | undefined;
|
|
4
6
|
export declare function formatActiveProjectContextForPrompt(input: {
|
|
5
7
|
project: Project;
|
|
6
8
|
workspacePath?: string;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { listMemoryRecords } from "../../storage/sqlite/memory-records-repository.js";
|
|
1
|
+
import { listMemoryRecords, searchMemoryRecords } from "../../storage/sqlite/memory-records-repository.js";
|
|
2
2
|
import "../../storage/sqlite/index.js";
|
|
3
3
|
import { GoalService } from "../../goals/goal-service.js";
|
|
4
4
|
import "../../goals/index.js";
|
|
5
|
+
import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
|
|
5
6
|
import { LocalAppStore } from "../../local-apps/store.js";
|
|
6
7
|
import { ProjectStore } from "../../projects/project-store.js";
|
|
7
8
|
import { getProjectForSession, getProjectWorkspacePathForSession } from "../../projects/workspace.js";
|
|
8
|
-
import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
|
|
9
9
|
//#region src/agent/context/project-context.ts
|
|
10
10
|
const MAX_TEXT = 1200;
|
|
11
11
|
const MAX_GOALS = 5;
|
|
12
12
|
const MAX_SESSIONS = 5;
|
|
13
|
-
const
|
|
13
|
+
const MAX_RECENT_MEMORY = 5;
|
|
14
|
+
const MAX_RELEVANT_MEMORY = 5;
|
|
15
|
+
const MAX_MEMORY = 8;
|
|
14
16
|
function truncateText(value, max = MAX_TEXT) {
|
|
15
17
|
const trimmed = value?.trim();
|
|
16
18
|
if (!trimmed) return void 0;
|
|
@@ -27,7 +29,15 @@ function formatGoal(goal) {
|
|
|
27
29
|
if (goal.blockedReason?.trim()) parts.push(`blocked=${sanitizeForPromptLiteral(truncateText(goal.blockedReason, 200) ?? "")}`);
|
|
28
30
|
return parts.join(" | ");
|
|
29
31
|
}
|
|
30
|
-
function
|
|
32
|
+
function selectProjectMemoryRecords(input) {
|
|
33
|
+
const selected = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const record of [...input.relevant, ...input.recent]) {
|
|
35
|
+
if (!selected.has(record.id)) selected.set(record.id, record);
|
|
36
|
+
if (selected.size >= MAX_MEMORY) break;
|
|
37
|
+
}
|
|
38
|
+
return [...selected.values()];
|
|
39
|
+
}
|
|
40
|
+
function buildActiveProjectContextForPrompt(sessionKey, options = {}) {
|
|
31
41
|
const project = getProjectForSession(sessionKey);
|
|
32
42
|
if (!project) return void 0;
|
|
33
43
|
const localAppStore = new LocalAppStore();
|
|
@@ -47,10 +57,18 @@ function buildActiveProjectContextForPrompt(sessionKey) {
|
|
|
47
57
|
limit: MAX_GOALS
|
|
48
58
|
}),
|
|
49
59
|
recentSessions: new ProjectStore().getRecentSessions(project.id, MAX_SESSIONS),
|
|
50
|
-
memoryRecords:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
memoryRecords: selectProjectMemoryRecords({
|
|
61
|
+
relevant: options.memoryQuery?.trim() ? searchMemoryRecords({
|
|
62
|
+
query: options.memoryQuery,
|
|
63
|
+
projectId: project.id,
|
|
64
|
+
statuses: ["active"],
|
|
65
|
+
maxResults: MAX_RELEVANT_MEMORY
|
|
66
|
+
}).map((result) => result.record) : [],
|
|
67
|
+
recent: listMemoryRecords({
|
|
68
|
+
projectId: project.id,
|
|
69
|
+
status: "active",
|
|
70
|
+
limit: MAX_RECENT_MEMORY
|
|
71
|
+
})
|
|
54
72
|
}),
|
|
55
73
|
localApp: localApp ? {
|
|
56
74
|
extensionId: localApp.extensionId,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { ModelRuntime } from '@earendil-works/pi-coding-agent';
|
|
2
2
|
export declare function resolveEmbeddedProviderApiKeySync(providerId: string): string | undefined;
|
|
3
|
-
export declare function createEmbeddedModelRuntime(): Promise<ModelRuntime>;
|
|
4
|
-
export declare function applyEmbeddedProviderCredential(modelRuntime: Pick<ModelRuntime, 'setRuntimeApiKey'>, providerId: string): Promise<void>;
|
|
3
|
+
export declare function createEmbeddedModelRuntime(providerId: string): Promise<ModelRuntime>;
|
|
@@ -1,49 +1,37 @@
|
|
|
1
1
|
import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
|
|
2
2
|
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
3
|
-
import { getModelCatalogStore, init_model_catalog_store } from "../../providers/model-catalog-store.js";
|
|
4
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
|
+
import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
|
|
5
|
+
import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
|
|
5
6
|
import { getApiKeySync, init_providers } from "../../providers/index.js";
|
|
7
|
+
import { InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
6
8
|
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import { InMemoryCredentialStore, InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
8
9
|
//#region src/agent/embedded/model-runtime.ts
|
|
9
10
|
init_credentials();
|
|
11
|
+
init_model_credential_store();
|
|
10
12
|
init_sync_provider_auth();
|
|
11
13
|
init_paths();
|
|
12
14
|
init_providers();
|
|
13
|
-
|
|
15
|
+
init_register_runtime_providers();
|
|
14
16
|
function resolveEmbeddedProviderApiKeySync(providerId) {
|
|
15
17
|
return resolveProviderApiKeySync(providerId) ?? getApiKeySync(providerId);
|
|
16
18
|
}
|
|
17
|
-
async function createEmbeddedModelRuntime() {
|
|
19
|
+
async function createEmbeddedModelRuntime(providerId) {
|
|
20
|
+
const resolver = new CredentialResolver();
|
|
21
|
+
const credentials = new XopcModelCredentialStore(resolver);
|
|
18
22
|
const modelRuntime = await ModelRuntime.create({
|
|
19
|
-
credentials
|
|
23
|
+
credentials,
|
|
20
24
|
modelsPath: resolveModelsJsonPath(),
|
|
21
25
|
modelsStore: new InMemoryModelsStore()
|
|
22
26
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
reasoning: false,
|
|
31
|
-
input: ["text"],
|
|
32
|
-
cost: {
|
|
33
|
-
input: 0,
|
|
34
|
-
output: 0,
|
|
35
|
-
cacheRead: 0,
|
|
36
|
-
cacheWrite: 0
|
|
37
|
-
},
|
|
38
|
-
contextWindow: 128e3,
|
|
39
|
-
maxTokens: model.maxOutputTokens ?? 16384
|
|
40
|
-
}))
|
|
41
|
-
});
|
|
27
|
+
registerRuntimeProviders(modelRuntime);
|
|
28
|
+
const runtimeProvider = modelRuntime.getProvider(providerId);
|
|
29
|
+
const storedCredential = await credentials.read(providerId);
|
|
30
|
+
if (!(runtimeProvider?.auth.oauth && storedCredential?.type === "oauth")) {
|
|
31
|
+
const key = await resolver.resolveApiKey(providerId) ?? getApiKeySync(providerId);
|
|
32
|
+
if (key && key !== "extension-managed") await modelRuntime.setRuntimeApiKey(providerId, key);
|
|
33
|
+
}
|
|
42
34
|
return modelRuntime;
|
|
43
35
|
}
|
|
44
|
-
async function applyEmbeddedProviderCredential(modelRuntime, providerId) {
|
|
45
|
-
const key = await new CredentialResolver().resolveApiKey(providerId) ?? getApiKeySync(providerId);
|
|
46
|
-
if (key && key !== "extension-managed") await modelRuntime.setRuntimeApiKey(providerId, key, { allowNetwork: false });
|
|
47
|
-
}
|
|
48
36
|
//#endregion
|
|
49
|
-
export {
|
|
37
|
+
export { createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync };
|
|
@@ -3,7 +3,7 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { guardSessionManager } from "./session-tool-result-guard.js";
|
|
4
4
|
import { transformUserMessageForPersistence } from "../inbound/attachment-pipeline.js";
|
|
5
5
|
import { openSqliteHydratingSessionManager } from "./sqlite-hydrating-session-manager.js";
|
|
6
|
-
import {
|
|
6
|
+
import { createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync } from "./model-runtime.js";
|
|
7
7
|
import { wrapStreamFnForXopcExtensions } from "./xopc-stream-bridge.js";
|
|
8
8
|
import { xopcToolsToDefinitions } from "./xopc-tools-bridge.js";
|
|
9
9
|
import { applySystemPromptOverrideToSession } from "./system-prompt-override.js";
|
|
@@ -174,8 +174,7 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
174
174
|
});
|
|
175
175
|
const toolDefs = xopcToolsToDefinitions(tools);
|
|
176
176
|
const toolNames = tools.map((t) => t.name);
|
|
177
|
-
const modelRuntime = await createEmbeddedModelRuntime();
|
|
178
|
-
await applyEmbeddedProviderCredential(modelRuntime, model.provider);
|
|
177
|
+
const modelRuntime = await createEmbeddedModelRuntime(model.provider);
|
|
179
178
|
const resourceLoader = new DefaultResourceLoader({
|
|
180
179
|
cwd: workspaceDir,
|
|
181
180
|
agentDir: getAgentDir(),
|
|
@@ -63,6 +63,7 @@ var SystemPromptBuilder = class {
|
|
|
63
63
|
if (playbookPrompt) fullPrompt = `${fullPrompt}\n\n${playbookPrompt}`;
|
|
64
64
|
if (interactionPrompt) fullPrompt = `${fullPrompt}\n\n${interactionPrompt}`;
|
|
65
65
|
if (continuityPrompt) fullPrompt = `${fullPrompt}\n\n${continuityPrompt}`;
|
|
66
|
+
if (options.activeProjectContext?.trim()) fullPrompt = `${fullPrompt}\n\n${options.activeProjectContext.trim()}`;
|
|
66
67
|
log.debug({
|
|
67
68
|
baseLength: trimmed.length,
|
|
68
69
|
skillLength: skillPrompt.length,
|
|
@@ -16,7 +16,7 @@ function joinSections(sections) {
|
|
|
16
16
|
*/
|
|
17
17
|
function buildSystemPrompt(workspaceDir, options = {}) {
|
|
18
18
|
const { contextFiles = [], promptMode = "full", heartbeatEnabled = false, heartbeatPrompt, toolNames: toolNamesOption, toolSummaries, availableTools = [], memoryCitationsMode = "on", includeMemorySection, userTimezone, runtime, agentId, channels = [], externalMemoryInstructions, ttsSystemHint, extraSystemPrompt, activeProjectContext, silentReplyPromptMode = "generic", promptContribution, includeProblemSolving = true, includeToneSection = true, actionTrustLevel } = options;
|
|
19
|
-
if (promptMode === "none") return "You are a personal AI assistant running inside xopc.";
|
|
19
|
+
if (promptMode === "none") return joinSections(["You are a personal AI assistant running inside xopc.", activeProjectContext]);
|
|
20
20
|
const isMinimal = promptMode === "minimal";
|
|
21
21
|
const toolNames = toolNamesOption ?? availableTools;
|
|
22
22
|
const normalizedTools = new Set(toolNames.map((tool) => tool.toLowerCase()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
2
2
|
import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
|
|
3
3
|
import { formatAgentRunErrorForClient } from "../client-error-format.js";
|
|
4
|
-
import { resolveEffectiveReasoningLevel } from "../../session/thinking-resolve.js";
|
|
4
|
+
import { resolveConfiguredActivityDetailDefault, resolveEffectiveReasoningLevel } from "../../session/thinking-resolve.js";
|
|
5
5
|
import { initSessionTurn } from "../../session/init-session-turn.js";
|
|
6
6
|
import "../../session/index.js";
|
|
7
7
|
import { isVoiceLikeAttachment, mergeSttConfigFromAppConfig, mergeVoiceTranscriptsIntoUserText } from "../../channels/attachments/voice-stt-webchat.js";
|
|
@@ -117,9 +117,9 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
117
117
|
const { channel, chatId } = await deps.resolveSessionEndpoint(sessionKey);
|
|
118
118
|
const context = deps.initDirectStreamingSession(sessionKey, channel, chatId);
|
|
119
119
|
const queue = new AsyncQueue();
|
|
120
|
-
let reasoningLevel = "stream";
|
|
120
|
+
let reasoningLevel = channel === "webchat" ? resolveConfiguredActivityDetailDefault(deps.getConfig()) : "stream";
|
|
121
121
|
const pushVisible = (event) => {
|
|
122
|
-
const visible = applyReasoningVisibilityToSseEvent(event, reasoningLevel);
|
|
122
|
+
const visible = channel === "webchat" ? event : applyReasoningVisibilityToSseEvent(event, reasoningLevel);
|
|
123
123
|
if (visible !== null) queue.push(visible);
|
|
124
124
|
};
|
|
125
125
|
const formatStreamError = (raw) => {
|
|
@@ -173,7 +173,10 @@ async function* runProcessDirectStreaming(deps, input) {
|
|
|
173
173
|
}, "Session reset boundary at direct turn start");
|
|
174
174
|
}
|
|
175
175
|
await hydratePerTurnState(deps, sessionKey, input.thinking);
|
|
176
|
-
|
|
176
|
+
{
|
|
177
|
+
const defReason = channel === "webchat" ? resolveConfiguredActivityDetailDefault(cfg) : "stream";
|
|
178
|
+
reasoningLevel = await resolveEffectiveReasoningLevel(deps.sessionConfigStore, sessionKey, defReason);
|
|
179
|
+
}
|
|
177
180
|
const prepared = await deps.prepareInboundAttachments(sessionKey, input.attachments);
|
|
178
181
|
const sttCfg = mergeSttConfigFromAppConfig(deps.getConfig()?.tools?.media?.audio, deps.getConfig()?.tools?.media);
|
|
179
182
|
const voiceMerge = await mergeVoiceTranscriptsIntoUserText(prepared, turnBody, sttCfg);
|
|
@@ -28,7 +28,10 @@ export interface SessionConfigServiceOptions {
|
|
|
28
28
|
export interface PatchSessionAgentConfigInput {
|
|
29
29
|
thinkingLevel?: string;
|
|
30
30
|
model?: string | null;
|
|
31
|
-
|
|
31
|
+
/** Preferred activity-detail field. `null` clears the session override. */
|
|
32
|
+
activityDetailLevel?: string | null;
|
|
33
|
+
/** @deprecated Use activityDetailLevel. */
|
|
34
|
+
reasoningLevel?: string | null;
|
|
32
35
|
verboseLevel?: string;
|
|
33
36
|
workingDirectory?: string;
|
|
34
37
|
}
|
|
@@ -53,11 +53,13 @@ var SessionConfigService = class {
|
|
|
53
53
|
await this.opts.sessionConfigStore.update(sessionKey, { thinkingLevel: normalized });
|
|
54
54
|
this.opts.agentManager.setThinkingLevel(sessionKey, normalized);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const activityDetailLevel = partial.activityDetailLevel !== void 0 ? partial.activityDetailLevel : partial.reasoningLevel;
|
|
57
|
+
if (activityDetailLevel !== void 0) if (activityDetailLevel === null) await this.opts.sessionConfigStore.update(sessionKey, { reasoningLevel: void 0 });
|
|
58
|
+
else {
|
|
59
|
+
const normalized = normalizeReasoningLevel(activityDetailLevel);
|
|
58
60
|
if (!normalized) return {
|
|
59
61
|
ok: false,
|
|
60
|
-
error: "Invalid
|
|
62
|
+
error: "Invalid activity detail level"
|
|
61
63
|
};
|
|
62
64
|
await this.opts.sessionConfigStore.update(sessionKey, { reasoningLevel: normalized });
|
|
63
65
|
}
|
|
@@ -46,6 +46,12 @@ export interface SessionAgentConfigView {
|
|
|
46
46
|
thinkingLevel: ThinkingLevel;
|
|
47
47
|
model: string;
|
|
48
48
|
reasoningLevel: ReasoningLevel;
|
|
49
|
+
activityDetail: {
|
|
50
|
+
default: ReasoningLevel;
|
|
51
|
+
override: ReasoningLevel | null;
|
|
52
|
+
effective: ReasoningLevel;
|
|
53
|
+
source: 'session' | 'default';
|
|
54
|
+
};
|
|
49
55
|
verboseLevel: VerboseLevel;
|
|
50
56
|
effectiveWorkspacePath: string;
|
|
51
57
|
workingDirectoryLocked: boolean;
|
|
@@ -7,7 +7,7 @@ import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../se
|
|
|
7
7
|
import { getProjectForSession } from "../../projects/workspace.js";
|
|
8
8
|
import { resolveCompactionPolicy } from "../memory/compaction-policy.js";
|
|
9
9
|
import { resolveVerboseLevel } from "../../session/config-store.js";
|
|
10
|
-
import { resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel } from "../../session/thinking-resolve.js";
|
|
10
|
+
import { resolveConfiguredActivityDetailDefault, resolveEffectiveReasoningLevel, resolveEffectiveThinkingLevel } from "../../session/thinking-resolve.js";
|
|
11
11
|
import "../../session/index.js";
|
|
12
12
|
import { runBtwQuery } from "../service/btw-query.js";
|
|
13
13
|
import { formatSessionContextReport } from "../service/session-context-report.js";
|
|
@@ -131,7 +131,8 @@ var SessionInspector = class {
|
|
|
131
131
|
if (!cfg) throw new Error("SessionInspector requires a config snapshot to resolve agent config");
|
|
132
132
|
const sc = await this.opts.sessionConfigStore.get(sessionKey);
|
|
133
133
|
const level = await resolveEffectiveThinkingLevel(this.opts.sessionConfigStore, sessionKey, null, "medium");
|
|
134
|
-
const
|
|
134
|
+
const defReason = resolveConfiguredActivityDetailDefault(cfg);
|
|
135
|
+
const reasoningLevel = await resolveEffectiveReasoningLevel(this.opts.sessionConfigStore, sessionKey, defReason);
|
|
135
136
|
const verboseLevel = await resolveVerboseLevel(this.opts.sessionConfigStore, sessionKey, "full");
|
|
136
137
|
const model = this.opts.modelManager.getModelForSession(sessionKey);
|
|
137
138
|
const project = getProjectForSession(sessionKey);
|
|
@@ -143,6 +144,12 @@ var SessionInspector = class {
|
|
|
143
144
|
thinkingLevel: level,
|
|
144
145
|
model,
|
|
145
146
|
reasoningLevel,
|
|
147
|
+
activityDetail: {
|
|
148
|
+
default: defReason,
|
|
149
|
+
override: sc?.reasoningLevel ?? null,
|
|
150
|
+
effective: reasoningLevel,
|
|
151
|
+
source: sc?.reasoningLevel ? "session" : "default"
|
|
152
|
+
},
|
|
146
153
|
verboseLevel,
|
|
147
154
|
effectiveWorkspacePath,
|
|
148
155
|
workingDirectoryLocked: Boolean(projectWorkspace || hasSessionWorkspaceOverride),
|
|
@@ -114,6 +114,7 @@ var DelegateSubagentRunner = class {
|
|
|
114
114
|
sessionType: "workflow-subagent",
|
|
115
115
|
hiddenFromSessionList: true,
|
|
116
116
|
parentSessionKey: metadata.parentSessionKey,
|
|
117
|
+
projectId: metadata.projectId,
|
|
117
118
|
workflowRunId: metadata.workflowRunId,
|
|
118
119
|
workflowDefinitionId: metadata.workflowDefinitionId,
|
|
119
120
|
workflowAgentId: metadata.workflowAgentId,
|
|
@@ -132,6 +133,7 @@ var DelegateSubagentRunner = class {
|
|
|
132
133
|
sessionType: "workflow-subagent",
|
|
133
134
|
hiddenFromSessionList: true,
|
|
134
135
|
parentSessionKey: metadata.parentSessionKey,
|
|
136
|
+
projectId: metadata.projectId,
|
|
135
137
|
workflowRunId: metadata.workflowRunId,
|
|
136
138
|
workflowDefinitionId: metadata.workflowDefinitionId,
|
|
137
139
|
workflowAgentId: metadata.workflowAgentId,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AuthOperationOptions, type Credential, type CredentialInfo, type CredentialStore } from '@earendil-works/pi-ai';
|
|
2
|
+
import { CredentialResolver } from './credentials.js';
|
|
3
|
+
type OAuthCredentialRepository = Pick<CredentialResolver, 'deleteOAuthToken' | 'listOAuthTokens' | 'loadOAuthTokenRecord' | 'saveOAuthToken'>;
|
|
4
|
+
/**
|
|
5
|
+
* ModelRuntime credential store backed by xopc OAuth persistence.
|
|
6
|
+
* API keys remain process-local because their canonical sources are xopc config and environment.
|
|
7
|
+
*/
|
|
8
|
+
export declare class XopcModelCredentialStore implements CredentialStore {
|
|
9
|
+
private readonly repository;
|
|
10
|
+
private readonly runtimeApiKeys;
|
|
11
|
+
constructor(repository?: OAuthCredentialRepository);
|
|
12
|
+
read(providerId: string, options?: AuthOperationOptions): Promise<Credential | undefined>;
|
|
13
|
+
list(options?: AuthOperationOptions): Promise<readonly CredentialInfo[]>;
|
|
14
|
+
modify(providerId: string, update: (current: Credential | undefined) => Promise<Credential | undefined>, options?: AuthOperationOptions): Promise<Credential | undefined>;
|
|
15
|
+
delete(providerId: string, options?: AuthOperationOptions): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|