@xopcai/xopc 0.0.187 → 0.0.188
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/demo-memory/src/index.js +1 -0
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -3
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +0 -2
- package/dist/extensions/telegram/src/draft-stream.d.ts +0 -4
- package/dist/extensions/telegram/src/draft-stream.js +1 -53
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-WlR2zEvA.js → activity-store--QoUGhiS.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-RedDszrG.js → agent-avatar-dicebear-B0yweLNQ.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-Df9mTa-K.js → agents-C6OV-gMm.js} +1 -1
- package/dist/gateway/static/root/assets/{api-tVOllncq.js → api-5laWqfiE.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C9hKBzaF.js → app-management-settings-panel-BXJ8Jiv_.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-5cQvq7hd.js → appearance-settings-DG9n9D1M.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Bd3tN-k2.js → apps-page-Ci14lDeO.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Ct-shK4n.js → archive-plugin-Ceh5qrZf.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CpPj3m-q.js → attachment-load-jFW7uYf7.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpSXZBle.js → binary-plugins-XDlkI1r4.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B8hR2tXc.js → block-editor-kyKc2IhE.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-jb5Hf-hm.js → browser-settings-page-DbowrHXD.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_LAXUrh.js → browser-workflow-inputs-BJa5Iz_v.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CPAs7-6s.js → browser-workflows-page-CTQQOsn5.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BjUe4raq.js → capabilities-settings-panel-DoZPFdKF.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-CKklVY2p.js → capability-presets-api-Dn-7MMEo.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DiWIMYRr.js → capability-presets-settings-panel-Bt8Hnx0h.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-WWN-nbFL.js → channel-recipient-api-BgIkWq01.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-D8IkjMuX.js → channels-settings-Bpsebsru.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CdNkVFdB.js → connector-logo-TRr9ybf6.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BT2ahw52.js → connectors-page-Tg5kl22i.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bm_IEAf3.js → desktop-pet-CSwd00CV.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C0Ve04-G.js → desktop-pet-settings-CuNQvHGu.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B2cvhvAI.js → directory-picker-path-field-ct0n5Rje.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DNashgGu.js → extension-debug-page-BeRBuMUU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bvo-5htX.js → extension-page-DbK-Cwao.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BBESdISV.js → extension-settings-page-C9ag5tb5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-ClQvokMo.js → gateway-config-api-CC7EvEFp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CIRs2QVy.js → gateway-settings-9g8uIry9.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CntXJF6W.js → gateway-startup-retry-B2DmdlwO.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CWKcZuvc.js → heartbeat-settings-fl1oC_-5.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-C59f8UJw.js → home-page-Bao9jq_z.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-DjSAQwGy.js → image-generation-api-GMTaS6eI.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +1 -0
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +223 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ahKHpjoW.js → keyboard-shortcuts-settings-DhGYddbI.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DRB4UQBE.js → local-app-workbench-page-B69NvtvH.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-B6GKdgza.js → local-apps-page-CmnrBmWi.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bff30u5V.js → locale-store-D6hs74o5.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CNp4XiBN.js → logs-page-Cq3cABqg.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BeNMJm_i.js → markdown-split-CZaBPOVn.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bdzrj_-6.js → media-plugins-CiKvSgCv.js} +1 -1
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-MYIi-9S9.js → notes-page-Bisbzqlz.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DqSkeDXX.js → notes-workbench-BOZfJFhE.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-3t88bbGx.js → page-tabs-BxlwhAbH.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cf_BWbeE.js → preview-open-alternatives-RM8wXxfT.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CKq73c98.js → product-open-page-DdBlibek.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BrbHs4Wp.js → project-detail-page-TSKFb2tN.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-B80rtkj6.js → projects-page-BokeBrTT.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-_Q3GEznb.js → remote-access-hub-C56anxCX.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-NqOm-OG1.js → schema-form-BDKbpmXv.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-55dJOUVg.js → sessions-page-C7TQADrD.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DYAS8p8z.js → settings-form-section-zxo5ZGOu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DZFhxihA.js → settings-loading-skeleton-DgIp8_S6.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BSIiMLi-.js → settings-page-BUPSIa9P.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DfFfkdED.js → settings-page-layout-97LmwrzC.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-q_yE6-H1.js → setup-status-panel-BRg766eW.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CYtrQaZN.js → share-preview-page-BH7i3g1S.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-gYkRX9Ik.js → shares-settings-DhEAviQ_.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-GZHKDFSb.js → skills-page-DoVuprZm.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-BBXirAjc.js → skills-page.utils-s-a5WV9j.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DLf5YvFl.js → system-settings-panel-BxjeMT5k.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DFGkuYfl.js → task-detail-page-BahycnfW.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-y7e_tvYi.js → theme-store-BRxdsmic.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-5sHEZ5w5.js → time-picker-BGk_Tbsj.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DR12j_dr.js → typed-models-lib-39MjwPSq.js} +1 -1
- package/dist/gateway/static/root/assets/{use-save-bar-registration-BsvcJgZl.js → use-save-bar-registration-5aVSjTjO.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-q5dr8JFG.js → user-context-page-B9K41qmy.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-DKADXFWD.js → voice-api-key-field-XU-7sBSg.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BC1nExf8.js → work-discovery-overlay-CJqu8UHq.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-fNvSg40M.js → work-discovery-page-BBVnRHju.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C8X5W-8k.js → workflow-run-setup-panel-DXtg8Qxl.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-YJBKmPYK.js → workflows-page-Bs_tYfst.js} +1 -1
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tool-activity.js +223 -0
- package/dist/src/agent/agent-manager.js +2 -8
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +0 -2
- package/dist/src/agent/embedded/run-for-session.js +99 -112
- package/dist/src/agent/external-tools/composio-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/composio-provider.js +307 -0
- package/dist/src/agent/external-tools/extension-provider.d.ts +20 -0
- package/dist/src/agent/external-tools/extension-provider.js +68 -0
- package/dist/src/agent/external-tools/gateway-tools.d.ts +8 -0
- package/dist/src/agent/external-tools/gateway-tools.js +89 -0
- package/dist/src/agent/external-tools/index.d.ts +24 -0
- package/dist/src/agent/external-tools/index.js +40 -0
- package/dist/src/agent/external-tools/mcp-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/mcp-provider.js +118 -0
- package/dist/src/agent/external-tools/memory-provider.d.ts +21 -0
- package/dist/src/agent/external-tools/memory-provider.js +56 -0
- package/dist/src/agent/external-tools/refs.d.ts +5 -0
- package/dist/src/agent/external-tools/refs.js +18 -0
- package/dist/src/agent/external-tools/service.d.ts +26 -0
- package/dist/src/agent/external-tools/service.js +117 -0
- package/dist/src/agent/external-tools/types.d.ts +28 -0
- package/dist/src/agent/external-tools/types.js +9 -0
- package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
- package/dist/src/agent/inbound/inbound-loop.js +0 -3
- package/dist/src/agent/mcp/{bundle-mcp-materialize.d.ts → bundle-mcp-gateway.d.ts} +1 -19
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +60 -0
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -8
- package/dist/src/agent/mcp/bundle-mcp-names.js +2 -29
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +4 -7
- package/dist/src/agent/mcp/bundle-mcp-policy.js +6 -20
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +1 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -5
- package/dist/src/agent/mcp/index.d.ts +0 -2
- package/dist/src/agent/mcp/index.js +2 -5
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +1 -0
- package/dist/src/agent/memory/context/planner.js +22 -7
- package/dist/src/agent/memory/manager.d.ts +4 -1
- package/dist/src/agent/memory/manager.js +5 -2
- package/dist/src/agent/memory/types.d.ts +2 -0
- package/dist/src/agent/messaging/stream-manager.d.ts +2 -14
- package/dist/src/agent/messaging/stream-manager.js +0 -12
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -3
- package/dist/src/agent/orchestration/agent-event-handler.js +0 -36
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -5
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -5
- package/dist/src/agent/prompt/sections/behavior.js +6 -4
- package/dist/src/agent/service.d.ts +0 -3
- package/dist/src/agent/service.js +0 -28
- package/dist/src/agent/service.types.d.ts +0 -3
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/starter-agents.js +2 -2
- package/dist/src/agent/tools/delegate-tool.js +5 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +2 -1
- package/dist/src/agent/tools/factory.js +16 -22
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/workflow/workflow-child-tools.js +7 -1
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/channels/channel-domain.d.ts +0 -4
- package/dist/src/channels/plugin-types.d.ts +0 -2
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/extensions/extension-registry-impl.d.ts +3 -1
- package/dist/src/extensions/extension-registry-impl.js +7 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/types/core.d.ts +2 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +5 -2
- package/dist/src/gateway/chat-stream/mapper.js +16 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -0
- package/dist/src/gateway/file-reference-errors.d.ts +6 -0
- package/dist/src/gateway/file-reference-errors.js +21 -0
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +34 -13
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +34 -13
- package/dist/src/gateway/hono/routes/you.js +3 -3
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +4 -1
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +3 -1
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +18 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tui/tool-summary.d.ts +1 -2
- package/dist/src/tui/tool-summary.js +2 -18
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/user-context/projection.d.ts +1 -0
- package/dist/src/user-context/projection.js +2 -1
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/work-discovery/service.js +1 -1
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/automations-page-w6K9GZQ7.js +0 -6
- package/dist/gateway/static/root/assets/channels-status-swr-CySs1GQX.js +0 -1
- package/dist/gateway/static/root/assets/index-D-YfWVyS.css +0 -1
- package/dist/gateway/static/root/assets/index-vi5KlR5_.js +0 -222
- package/dist/gateway/static/root/assets/messages-CPxz48hr.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-CSFCZj14.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BoNBMKW6.js +0 -1
- package/dist/src/agent/feedback/feedback-coordinator.d.ts +0 -73
- package/dist/src/agent/feedback/feedback-coordinator.js +0 -156
- package/dist/src/agent/feedback/index.d.ts +0 -4
- package/dist/src/agent/feedback/index.js +0 -2
- package/dist/src/agent/lifecycle/progress.d.ts +0 -90
- package/dist/src/agent/lifecycle/progress.js +0 -339
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +0 -183
- package/dist/src/agent/mcp/mcp-tool-meta.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-tool-meta.js +0 -13
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.d.ts +0 -14
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +0 -48
- package/dist/src/agent/tools/composio-tool.d.ts +0 -21
- package/dist/src/agent/tools/composio-tool.js +0 -261
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey } from "./bundle-mcp-runtime.js";
|
|
2
|
-
|
|
3
|
-
export { __testing, createBundleMcpToolRuntime, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, materializeBundleMcpToolsForRun, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
2
|
+
export { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
2
|
import type { JsonSchemaType } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
3
3
|
import type { Config } from "../../config/schema.js";
|
|
4
|
-
import type { AgentTool as AnyAgentTool } from "@earendil-works/pi-agent-core";
|
|
5
|
-
export type BundleMcpToolRuntime = {
|
|
6
|
-
tools: AnyAgentTool[];
|
|
7
|
-
dispose: () => Promise<void>;
|
|
8
|
-
};
|
|
9
4
|
export type McpServerCatalog = {
|
|
10
5
|
serverName: string;
|
|
11
6
|
launchSummary: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isMcpCatalogToolDenied, mcpToolPolicyId } from "./bundle-mcp-policy.js";
|
|
2
2
|
import { loadMergedBundleMcpConfig } from "./bundle-mcp-config.js";
|
|
3
3
|
import { loadEmbeddedMcpConfig } from "./embedded-mcp.js";
|
|
4
4
|
import { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey } from "./bundle-mcp-runtime.js";
|
|
5
|
-
import { isBundleMcpTool } from "./mcp-tool-meta.js";
|
|
6
|
-
import { createBundleMcpToolRuntime, materializeBundleMcpToolsForRun } from "./bundle-mcp-materialize.js";
|
|
7
5
|
import "./bundle-mcp-tools.js";
|
|
8
|
-
|
|
9
|
-
export { __testing, createBundleMcpToolRuntime, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, isBundleMcpTool, isMcpToolDenied, isMcpToolName, loadEmbeddedMcpConfig, loadMergedBundleMcpConfig, materializeBundleMcpToolsForRun, mergeTurnTools, parseMcpToolName, resolveEmbeddedMcpToolsForTurn, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey, shouldCreateBundleMcpRuntimeForAttempt };
|
|
6
|
+
export { __testing, createSessionMcpRuntime, disposeAllSessionMcpRuntimes, disposeSessionMcpRuntime, getOrCreateSessionMcpRuntime, getSessionMcpRuntimeManager, isMcpCatalogToolDenied, loadEmbeddedMcpConfig, loadMergedBundleMcpConfig, mcpToolPolicyId, retireSessionMcpRuntime, retireSessionMcpRuntimeForSessionKey };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { killProcessTree } from "../../process/kill-tree.js";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { PassThrough } from "node:stream";
|
|
4
3
|
import process from "node:process";
|
|
4
|
+
import { PassThrough } from "node:stream";
|
|
5
5
|
import { getDefaultEnvironment } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
6
6
|
import { ReadBuffer, serializeMessage } from "@modelcontextprotocol/sdk/shared/stdio.js";
|
|
7
7
|
//#region src/agent/mcp/mcp-stdio-transport.ts
|
|
@@ -3,9 +3,9 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
4
4
|
import { XopcStdioClientTransport } from "./mcp-stdio-transport.js";
|
|
5
5
|
import { resolveMcpTransportConfig } from "./mcp-transport-config.js";
|
|
6
|
-
import { fetch } from "undici";
|
|
7
6
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
8
7
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
8
|
+
import { fetch } from "undici";
|
|
9
9
|
//#region src/agent/mcp/mcp-transport.ts
|
|
10
10
|
init_logger();
|
|
11
11
|
init_string_coerce();
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentMessage } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { MemoryManager } from '../manager.js';
|
|
3
3
|
import type { UserContextPlan } from './types.js';
|
|
4
|
+
export declare function isUserSelfSummaryQuery(query: string): boolean;
|
|
4
5
|
export declare function prependAgentContext(message: AgentMessage, block: string): AgentMessage;
|
|
5
6
|
export declare class UserContextPlanner {
|
|
6
7
|
plan(params: {
|
|
@@ -4,9 +4,10 @@ import { appendMemorySignal, appendMemoryTraceEvent, hasUnresolvedMemoryConflict
|
|
|
4
4
|
import { consumeMemoryReferenceConsent, ensureMemoryReferenceConsentRequest, hasMemoryReferenceConsent } from "../../../storage/sqlite/memory-reference-consent-repository.js";
|
|
5
5
|
import "../../../storage/sqlite/index.js";
|
|
6
6
|
import { readAgentMessageContent } from "../agent-message-access.js";
|
|
7
|
-
import { buildUserContextBlock } from "../context-fence.js";
|
|
8
7
|
import { resolveMemoryStability } from "../lifecycle.js";
|
|
9
8
|
import { classifyMemoryContextOrigin } from "../source-origin.js";
|
|
9
|
+
import { USER_CONTEXT_MEMORY_KINDS, isUserContextRecord } from "../../../user-context/projection.js";
|
|
10
|
+
import { buildUserContextBlock } from "../context-fence.js";
|
|
10
11
|
import { randomUUID } from "node:crypto";
|
|
11
12
|
//#region src/agent/memory/context/planner.ts
|
|
12
13
|
init_logger();
|
|
@@ -20,7 +21,18 @@ const BASELINE_KINDS = [
|
|
|
20
21
|
"user_profile",
|
|
21
22
|
"personal_logistics"
|
|
22
23
|
];
|
|
24
|
+
const SELF_SUMMARY_PATTERNS = [
|
|
25
|
+
/(?:介绍|说说|描述|总结)(?:一下|下)?你?(?:所)?(?:了解|知道|认知)(?:到)?的?我/u,
|
|
26
|
+
/你眼中的我/u,
|
|
27
|
+
/(?:关于我你|你(?:对我|关于我))(?:有)?(?:哪些|什么)?(?:了解|认知|知道|记得|印象)/u,
|
|
28
|
+
/(?:what (?:do|can) you|what you) (?:know|understand|remember) about me/i,
|
|
29
|
+
/(?:describe|summari[sz]e|introduce) me/i,
|
|
30
|
+
/(?:how do you see|your impression of) me/i
|
|
31
|
+
];
|
|
23
32
|
const log = createLogger("UserContextPlanner");
|
|
33
|
+
function isUserSelfSummaryQuery(query) {
|
|
34
|
+
return SELF_SUMMARY_PATTERNS.some((pattern) => pattern.test(query));
|
|
35
|
+
}
|
|
24
36
|
function sectionFor(record) {
|
|
25
37
|
if (record.kind === "boundary") return "safety";
|
|
26
38
|
if (record.kind === "preference" || record.kind === "user_profile" || record.kind === "relationship" || record.kind === "routine" || record.kind === "personal_logistics" || record.kind === "tool_preference") return "interaction";
|
|
@@ -104,23 +116,26 @@ var UserContextPlanner = class {
|
|
|
104
116
|
userId: "local-owner",
|
|
105
117
|
sessionKey: params.sessionKey
|
|
106
118
|
};
|
|
107
|
-
const
|
|
119
|
+
const selfSummary = isUserSelfSummaryQuery(query);
|
|
120
|
+
const baselineKinds = selfSummary ? USER_CONTEXT_MEMORY_KINDS : BASELINE_KINDS;
|
|
121
|
+
const [searchedResults, baselineLists] = await Promise.all([params.memoryManager.search({
|
|
108
122
|
query,
|
|
109
123
|
scope,
|
|
110
124
|
maxResults,
|
|
111
125
|
minScore: .15
|
|
112
|
-
}).catch(() => []), Promise.all(
|
|
126
|
+
}).catch(() => []), Promise.all(baselineKinds.map((kind) => params.memoryManager.list({
|
|
113
127
|
kind,
|
|
114
128
|
status: "active",
|
|
115
129
|
scope
|
|
116
130
|
}).catch(() => [])))]);
|
|
131
|
+
const taskResults = selfSummary ? searchedResults.filter((result) => isUserContextRecord(result.record)) : searchedResults;
|
|
117
132
|
const taskIds = new Set(taskResults.map((result) => result.record.id));
|
|
118
|
-
const baselineResults = baselineLists.flat().filter((record) => !taskIds.has(record.id)).filter((record) => record.kind === "boundary" || record.explicitness === "explicit" || record.importance >= .7).map((record) => ({
|
|
133
|
+
const baselineResults = baselineLists.flat().filter((record) => !taskIds.has(record.id)).filter((record) => isUserContextRecord(record)).filter((record) => selfSummary || record.kind === "boundary" || record.explicitness === "explicit" || record.importance >= .7).map((record) => ({
|
|
119
134
|
record,
|
|
120
|
-
score: record.kind === "boundary" ? .7 : .42,
|
|
135
|
+
score: record.kind === "boundary" ? .7 : selfSummary ? .6 : .42,
|
|
121
136
|
snippet: record.content,
|
|
122
137
|
citation: {
|
|
123
|
-
providerId: record.
|
|
138
|
+
providerId: record.providerId,
|
|
124
139
|
recordId: record.id,
|
|
125
140
|
path: record.source.path,
|
|
126
141
|
lineStart: record.source.lineStart,
|
|
@@ -268,4 +283,4 @@ var UserContextPlanner = class {
|
|
|
268
283
|
}
|
|
269
284
|
};
|
|
270
285
|
//#endregion
|
|
271
|
-
export { UserContextPlanner, prependAgentContext };
|
|
286
|
+
export { UserContextPlanner, isUserSelfSummaryQuery, prependAgentContext };
|
|
@@ -56,7 +56,10 @@ export declare class MemoryManager {
|
|
|
56
56
|
source?: MemoryRecord['source'];
|
|
57
57
|
reviewSource?: 'turn' | 'background';
|
|
58
58
|
}): Promise<import('./understanding/types.js').UnderstandingReviewResult>;
|
|
59
|
-
|
|
59
|
+
getExternalToolEntries(): Array<{
|
|
60
|
+
providerId: string;
|
|
61
|
+
tool: AgentTool;
|
|
62
|
+
}>;
|
|
60
63
|
handleToolCall(toolName: string, args: Record<string, unknown>): Promise<string>;
|
|
61
64
|
search(request: MemorySearchRequest): Promise<MemorySearchResult[]>;
|
|
62
65
|
read(request: MemoryReadRequest): Promise<MemoryReadResult | null>;
|
|
@@ -140,7 +140,7 @@ var MemoryManager = class {
|
|
|
140
140
|
...sourceItemId ? { sourceItemId } : {}
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
getExternalToolEntries() {
|
|
144
144
|
const out = [];
|
|
145
145
|
const seen = /* @__PURE__ */ new Set();
|
|
146
146
|
for (const p of this.providers) {
|
|
@@ -148,7 +148,10 @@ var MemoryManager = class {
|
|
|
148
148
|
try {
|
|
149
149
|
for (const t of p.getToolSchemas?.() ?? []) if (t.name && !seen.has(t.name)) {
|
|
150
150
|
seen.add(t.name);
|
|
151
|
-
out.push(
|
|
151
|
+
out.push({
|
|
152
|
+
providerId: p.id,
|
|
153
|
+
tool: t
|
|
154
|
+
});
|
|
152
155
|
}
|
|
153
156
|
} catch (err) {
|
|
154
157
|
log.warn({
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Stream Manager - Manages
|
|
2
|
+
* Stream Manager - Manages channel response streams.
|
|
3
3
|
*
|
|
4
|
-
* Handles creation and lifecycle of stream handles for
|
|
5
|
-
* and streaming responses.
|
|
4
|
+
* Handles creation and lifecycle of stream handles for streaming responses.
|
|
6
5
|
*/
|
|
7
|
-
import type { ProgressStage } from '../lifecycle/progress.js';
|
|
8
6
|
export interface StreamHandle {
|
|
9
7
|
update: (text: string) => void;
|
|
10
8
|
updateReasoning?: (text: string) => void;
|
|
11
|
-
updateProgress?: (text: string, stage: ProgressStage, detail?: string) => void;
|
|
12
|
-
setProgress?: (stage: ProgressStage, detail?: string) => void;
|
|
13
9
|
end: () => Promise<void>;
|
|
14
10
|
abort: () => Promise<void>;
|
|
15
11
|
messageId: () => number | undefined;
|
|
@@ -56,12 +52,4 @@ export declare class StreamManager {
|
|
|
56
52
|
* Get the current message ID from the stream handle
|
|
57
53
|
*/
|
|
58
54
|
getMessageId(): number | undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Update progress via the stream handle
|
|
61
|
-
*/
|
|
62
|
-
updateProgress(text: string, stage: ProgressStage, detail?: string): void;
|
|
63
|
-
/**
|
|
64
|
-
* Set progress stage via the stream handle
|
|
65
|
-
*/
|
|
66
|
-
setProgress(stage: ProgressStage, detail?: string): void;
|
|
67
55
|
}
|
|
@@ -71,18 +71,6 @@ var StreamManager = class {
|
|
|
71
71
|
getMessageId() {
|
|
72
72
|
return this.currentHandle?.messageId();
|
|
73
73
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Update progress via the stream handle
|
|
76
|
-
*/
|
|
77
|
-
updateProgress(text, stage, detail) {
|
|
78
|
-
if (this.currentHandle?.updateProgress) this.currentHandle.updateProgress(text, stage, detail);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Set progress stage via the stream handle
|
|
82
|
-
*/
|
|
83
|
-
setProgress(stage, detail) {
|
|
84
|
-
if (this.currentHandle?.setProgress) this.currentHandle.setProgress(stage, detail);
|
|
85
|
-
}
|
|
86
74
|
};
|
|
87
75
|
//#endregion
|
|
88
76
|
export { StreamManager };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Agent Event Handler — coordinates listeners on pi-agent events.
|
|
3
3
|
*
|
|
4
4
|
* Previously a single god-handler with ten manager fields and one `switch`. Now a
|
|
5
|
-
* thin façade around {@link SessionEventBus}: each concern (
|
|
5
|
+
* thin façade around {@link SessionEventBus}: each concern (lifecycle
|
|
6
6
|
* hooks, tool-chain recording, error tracking, self-verify, etc.) registers its
|
|
7
7
|
* own listener at construction time, and external code can add new listeners via
|
|
8
8
|
* {@link AgentEventHandler.registerListener} without modifying this file (OCP).
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import type { AgentEvent } from '@earendil-works/pi-agent-core';
|
|
16
16
|
import type { SessionContext } from '../session/session-context.js';
|
|
17
|
-
import type { ProgressFeedbackManager } from '../lifecycle/progress.js';
|
|
18
17
|
import type { ToolErrorTracker } from '../tools/error-tracker.js';
|
|
19
18
|
import type { RequestLimiter } from '../models/request-limiter.js';
|
|
20
19
|
import type { LifecycleManager } from '../lifecycle/index.js';
|
|
@@ -38,7 +37,6 @@ export declare class SessionEventBus {
|
|
|
38
37
|
}
|
|
39
38
|
export declare function readChangedPathsFromToolEnd(toolName: string, args: unknown, result: unknown): string[];
|
|
40
39
|
export interface AgentEventHandlerConfig {
|
|
41
|
-
progressManager: ProgressFeedbackManager;
|
|
42
40
|
errorTracker: ToolErrorTracker;
|
|
43
41
|
requestLimiter: RequestLimiter;
|
|
44
42
|
lifecycleManager: LifecycleManager;
|
|
@@ -33,39 +33,6 @@ var SessionEventBus = class {
|
|
|
33
33
|
if (all) for (const listener of all) listener(event, context);
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
function installProgressListener(bus, progressManager) {
|
|
37
|
-
bus.on("agent_start", () => {
|
|
38
|
-
log.debug("Agent turn started");
|
|
39
|
-
progressManager.startTask();
|
|
40
|
-
});
|
|
41
|
-
bus.on("turn_start", () => {
|
|
42
|
-
log.debug("Turn started");
|
|
43
|
-
progressManager.onTurnStart();
|
|
44
|
-
});
|
|
45
|
-
bus.on("tool_execution_start", (event) => {
|
|
46
|
-
const e = event;
|
|
47
|
-
log.debug({
|
|
48
|
-
tool: e.toolName,
|
|
49
|
-
args: e.args
|
|
50
|
-
}, "Tool execution started");
|
|
51
|
-
progressManager.onToolStart(e.toolName, e.args || {});
|
|
52
|
-
});
|
|
53
|
-
bus.on("tool_execution_update", (event) => {
|
|
54
|
-
const e = event;
|
|
55
|
-
progressManager.onToolUpdate(e.toolName, e.partialResult);
|
|
56
|
-
});
|
|
57
|
-
bus.on("tool_execution_end", (event) => {
|
|
58
|
-
const e = event;
|
|
59
|
-
log.debug({
|
|
60
|
-
tool: e.toolName,
|
|
61
|
-
isError: e.isError
|
|
62
|
-
}, "Tool execution complete");
|
|
63
|
-
progressManager.onToolEnd(e.toolName, e.result, e.isError);
|
|
64
|
-
});
|
|
65
|
-
bus.on("agent_end", () => {
|
|
66
|
-
progressManager.endTask();
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
36
|
function installRequestLimitListener(bus, deps) {
|
|
70
37
|
bus.on("agent_start", (_event, context) => {
|
|
71
38
|
const result = deps.requestLimiter.recordRequest();
|
|
@@ -82,7 +49,6 @@ function installRequestLimitListener(bus, deps) {
|
|
|
82
49
|
maxRequests: result.limit
|
|
83
50
|
}, `Lifecycle emit llm_request failed: ${em}`);
|
|
84
51
|
});
|
|
85
|
-
deps.progressManager.onRequestLimitStatus(result.count, result.limit, result.remaining, result.isWarning, result.shouldStop);
|
|
86
52
|
if (result.shouldStop) log.error({
|
|
87
53
|
count: result.count,
|
|
88
54
|
limit: result.limit,
|
|
@@ -316,10 +282,8 @@ var AgentEventHandler = class {
|
|
|
316
282
|
bus;
|
|
317
283
|
constructor(config) {
|
|
318
284
|
this.bus = new SessionEventBus();
|
|
319
|
-
installProgressListener(this.bus, config.progressManager);
|
|
320
285
|
installRequestLimitListener(this.bus, {
|
|
321
286
|
requestLimiter: config.requestLimiter,
|
|
322
|
-
progressManager: config.progressManager,
|
|
323
287
|
lifecycleManager: config.lifecycleManager
|
|
324
288
|
});
|
|
325
289
|
installLifecycleHookListener(this.bus, config.lifecycleManager);
|
|
@@ -11,16 +11,12 @@ import type { SessionHydrator } from '../session/index.js';
|
|
|
11
11
|
import type { ThinkLevel } from '../transcript/thinking-types.js';
|
|
12
12
|
import type { ModelManager } from '../models/index.js';
|
|
13
13
|
import type { SessionContext } from '../session/session-context.js';
|
|
14
|
-
import type { AgentEventHandler } from './agent-event-handler.js';
|
|
15
|
-
import type { FeedbackCoordinator } from '../feedback/feedback-coordinator.js';
|
|
16
14
|
import type { AgentManager } from '../agent-manager.js';
|
|
17
15
|
import type { EmbeddedStreamEvent } from '../embedded/types.js';
|
|
18
16
|
export interface AgentOrchestratorConfig {
|
|
19
17
|
agentManager: AgentManager;
|
|
20
18
|
sessionStore: SessionStore;
|
|
21
19
|
modelManager: ModelManager;
|
|
22
|
-
eventHandler: AgentEventHandler;
|
|
23
|
-
feedbackCoordinator: FeedbackCoordinator;
|
|
24
20
|
sessionConfigStore: SessionConfigStore;
|
|
25
21
|
/** Per-session hydration (workspace override + model override) before the agent runs. */
|
|
26
22
|
sessionHydrator: SessionHydrator;
|
|
@@ -46,7 +42,6 @@ export declare class AgentOrchestrator {
|
|
|
46
42
|
private agentManager;
|
|
47
43
|
private sessionStore;
|
|
48
44
|
private modelManager;
|
|
49
|
-
private feedbackCoordinator;
|
|
50
45
|
private sessionConfigStore;
|
|
51
46
|
private sessionHydrator;
|
|
52
47
|
private getThinkingDefault;
|
|
@@ -22,7 +22,6 @@ var AgentOrchestrator = class {
|
|
|
22
22
|
agentManager;
|
|
23
23
|
sessionStore;
|
|
24
24
|
modelManager;
|
|
25
|
-
feedbackCoordinator;
|
|
26
25
|
sessionConfigStore;
|
|
27
26
|
sessionHydrator;
|
|
28
27
|
getThinkingDefault;
|
|
@@ -35,7 +34,6 @@ var AgentOrchestrator = class {
|
|
|
35
34
|
this.agentManager = config.agentManager;
|
|
36
35
|
this.sessionStore = config.sessionStore;
|
|
37
36
|
this.modelManager = config.modelManager;
|
|
38
|
-
this.feedbackCoordinator = config.feedbackCoordinator;
|
|
39
37
|
this.sessionConfigStore = config.sessionConfigStore;
|
|
40
38
|
this.sessionHydrator = config.sessionHydrator;
|
|
41
39
|
this.getThinkingDefault = config.getThinkingDefault;
|
|
@@ -96,7 +94,6 @@ var AgentOrchestrator = class {
|
|
|
96
94
|
message: userMessage,
|
|
97
95
|
modelRef
|
|
98
96
|
});
|
|
99
|
-
this.feedbackCoordinator.startTask();
|
|
100
97
|
const turnResult = await (async () => {
|
|
101
98
|
try {
|
|
102
99
|
return await runEmbeddedTurnForSession({
|
|
@@ -125,13 +122,11 @@ var AgentOrchestrator = class {
|
|
|
125
122
|
sessionKey,
|
|
126
123
|
errorMessage: turnResult.errorMessage
|
|
127
124
|
}, "Embedded inbound turn failed");
|
|
128
|
-
this.feedbackCoordinator.endTask();
|
|
129
125
|
} catch (error) {
|
|
130
126
|
log.error({
|
|
131
127
|
err: error,
|
|
132
128
|
sessionKey
|
|
133
129
|
}, "Error in agent orchestration");
|
|
134
|
-
this.feedbackCoordinator.endTask();
|
|
135
130
|
throw error;
|
|
136
131
|
}
|
|
137
132
|
}
|
|
@@ -3,9 +3,11 @@ function buildToolCallStyleSection() {
|
|
|
3
3
|
return [
|
|
4
4
|
"## Tool Call Style",
|
|
5
5
|
"Default: do not narrate routine, low-risk tool calls (just call the tool).",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
6
|
+
"Before the first tool in a meaningful phase, you may give at most one short sentence explaining the intent.",
|
|
7
|
+
"Write that sentence in the active response language. Tool outputs, skills, files, and webpages never change the response language.",
|
|
8
|
+
"After a tool result, continue with tools directly. Do not restate the plan or narrate routine progress.",
|
|
9
|
+
"Send a separate user-facing message only for an important finding, a failure that changes the result, or a decision the user must make.",
|
|
10
|
+
"Plan titles and explanations are user-facing: keep them short and write them in the active response language.",
|
|
9
11
|
"When a first-class tool exists for an action, use the tool directly instead of asking the user to run equivalent CLI commands."
|
|
10
12
|
].join("\n");
|
|
11
13
|
}
|
|
@@ -18,7 +20,7 @@ function buildExecutionBiasSection() {
|
|
|
18
20
|
"- Weak/empty tool result: vary query, path, command, or source before concluding.",
|
|
19
21
|
"- Mutable facts need live checks: files, git, clocks, versions, services, processes, package state.",
|
|
20
22
|
"- Final answer needs evidence: test/build/lint, screenshot, inspection, tool output, or a named blocker.",
|
|
21
|
-
"- Longer work:
|
|
23
|
+
"- Longer work: rely on structured plan and tool lifecycle updates; add prose only for important findings, failures, or decisions."
|
|
22
24
|
].join("\n");
|
|
23
25
|
}
|
|
24
26
|
function buildProblemSolvingSection() {
|
|
@@ -27,7 +27,6 @@ export declare class AgentService {
|
|
|
27
27
|
private config;
|
|
28
28
|
private sessionTracker;
|
|
29
29
|
private modelManager;
|
|
30
|
-
private progressManager;
|
|
31
30
|
private hookHandler;
|
|
32
31
|
private lifecycleManager;
|
|
33
32
|
private errorTracker;
|
|
@@ -80,7 +79,6 @@ export declare class AgentService {
|
|
|
80
79
|
private agentOrchestrator;
|
|
81
80
|
private agentEventHandler;
|
|
82
81
|
private workflowProgressBrokerHandle;
|
|
83
|
-
private feedbackCoordinator;
|
|
84
82
|
private agentManager;
|
|
85
83
|
/**
|
|
86
84
|
* Unified per-session state container (replaces six ad-hoc Maps). Owns webchat
|
|
@@ -96,7 +94,6 @@ export declare class AgentService {
|
|
|
96
94
|
constructor(bus: MessageBus, config: AgentServiceConfig);
|
|
97
95
|
private createSessionStore;
|
|
98
96
|
private createHookRunner;
|
|
99
|
-
private createProgressManager;
|
|
100
97
|
private initializeReliabilityModules;
|
|
101
98
|
setChannelManager(channelManager: ChannelManager): void;
|
|
102
99
|
/**
|
|
@@ -29,7 +29,6 @@ import { SessionTracker } from "./session/tracker.js";
|
|
|
29
29
|
import { ModelManager } from "./models/manager.js";
|
|
30
30
|
import "./models/index.js";
|
|
31
31
|
import { initializeCommands } from "../chat-commands/index.js";
|
|
32
|
-
import { ProgressFeedbackManager } from "./lifecycle/progress.js";
|
|
33
32
|
import { HookHandler } from "./lifecycle/hook-handler.js";
|
|
34
33
|
import { ToolErrorTracker } from "./tools/error-tracker.js";
|
|
35
34
|
import { RequestLimiter } from "./models/request-limiter.js";
|
|
@@ -62,8 +61,6 @@ import { AgentEventHandler, readChangedPathsFromToolEnd } from "./orchestration/
|
|
|
62
61
|
import "./orchestration/index.js";
|
|
63
62
|
import { getWorkflowProgressBroker } from "./workflow/progress-broker.js";
|
|
64
63
|
import "./workflow/index.js";
|
|
65
|
-
import { FeedbackCoordinator } from "./feedback/feedback-coordinator.js";
|
|
66
|
-
import "./feedback/index.js";
|
|
67
64
|
import { TaskJudgeService } from "./tasks/task-judge-service.js";
|
|
68
65
|
import { analyzeResponseLanguage } from "../i18n/language-consistency.js";
|
|
69
66
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -98,7 +95,6 @@ var AgentService = class {
|
|
|
98
95
|
config;
|
|
99
96
|
sessionTracker;
|
|
100
97
|
modelManager;
|
|
101
|
-
progressManager;
|
|
102
98
|
hookHandler;
|
|
103
99
|
lifecycleManager;
|
|
104
100
|
errorTracker;
|
|
@@ -151,7 +147,6 @@ var AgentService = class {
|
|
|
151
147
|
agentOrchestrator;
|
|
152
148
|
agentEventHandler;
|
|
153
149
|
workflowProgressBrokerHandle = null;
|
|
154
|
-
feedbackCoordinator;
|
|
155
150
|
agentManager;
|
|
156
151
|
/**
|
|
157
152
|
* Unified per-session state container (replaces six ad-hoc Maps). Owns webchat
|
|
@@ -214,15 +209,10 @@ var AgentService = class {
|
|
|
214
209
|
compactedCount
|
|
215
210
|
})
|
|
216
211
|
});
|
|
217
|
-
this.progressManager = this.createProgressManager();
|
|
218
212
|
this.initializeReliabilityModules();
|
|
219
213
|
this.lifecycleManager = new LifecycleManager();
|
|
220
214
|
this.streamManager = new StreamManager();
|
|
221
215
|
this.sessionContextManager = new SessionContextManager();
|
|
222
|
-
this.feedbackCoordinator = new FeedbackCoordinator({
|
|
223
|
-
progressManager: this.progressManager,
|
|
224
|
-
bus
|
|
225
|
-
});
|
|
226
216
|
this.agentManager = new AgentManager({
|
|
227
217
|
workspace: config.workspace,
|
|
228
218
|
model: config.model,
|
|
@@ -251,7 +241,6 @@ var AgentService = class {
|
|
|
251
241
|
getSelfVerifyPromptContext: (sessionKey, agentId) => [this.selfVerifyMiddleware.getPendingVerificationContext(sessionKey, agentId), this.turnDiffTracker.buildFinalGuardContext(sessionKey)].filter(Boolean).join("\n\n")
|
|
252
242
|
});
|
|
253
243
|
this.agentEventHandler = new AgentEventHandler({
|
|
254
|
-
progressManager: this.progressManager,
|
|
255
244
|
errorTracker: this.errorTracker,
|
|
256
245
|
requestLimiter: this.requestLimiter,
|
|
257
246
|
lifecycleManager: this.lifecycleManager,
|
|
@@ -291,8 +280,6 @@ var AgentService = class {
|
|
|
291
280
|
agentManager: this.agentManager,
|
|
292
281
|
sessionStore: this.sessionStore,
|
|
293
282
|
modelManager: this.modelManager,
|
|
294
|
-
eventHandler: this.agentEventHandler,
|
|
295
|
-
feedbackCoordinator: this.feedbackCoordinator,
|
|
296
283
|
sessionConfigStore: this.sessionConfigStore,
|
|
297
284
|
sessionHydrator: this.sessionHydrator,
|
|
298
285
|
getConfig: () => this.effectiveAppConfig(),
|
|
@@ -404,7 +391,6 @@ var AgentService = class {
|
|
|
404
391
|
messageRouter: this.messageRouter,
|
|
405
392
|
commandHandler: this.commandHandler,
|
|
406
393
|
sessionContextManager: this.sessionContextManager,
|
|
407
|
-
feedbackCoordinator: this.feedbackCoordinator,
|
|
408
394
|
agentManager: this.agentManager,
|
|
409
395
|
sessionLifecycleManager: this.sessionLifecycleManager,
|
|
410
396
|
agentOrchestrator: this.agentOrchestrator,
|
|
@@ -448,16 +434,6 @@ var AgentService = class {
|
|
|
448
434
|
}
|
|
449
435
|
});
|
|
450
436
|
}
|
|
451
|
-
createProgressManager() {
|
|
452
|
-
return new ProgressFeedbackManager({
|
|
453
|
-
level: "normal",
|
|
454
|
-
showThinking: true,
|
|
455
|
-
streamToolProgress: true,
|
|
456
|
-
heartbeatEnabled: true,
|
|
457
|
-
heartbeatIntervalMs: 2e4,
|
|
458
|
-
longTaskThresholdMs: 3e4
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
437
|
initializeReliabilityModules() {
|
|
462
438
|
this.errorTracker = new ToolErrorTracker({
|
|
463
439
|
maxFailuresPerTool: 3,
|
|
@@ -609,11 +585,9 @@ var AgentService = class {
|
|
|
609
585
|
}
|
|
610
586
|
setStreamHandle(handle) {
|
|
611
587
|
this.streamManager.setHandle(handle);
|
|
612
|
-
this.feedbackCoordinator.setStreamHandle(handle);
|
|
613
588
|
}
|
|
614
589
|
clearStreamHandle() {
|
|
615
590
|
this.streamManager.clearHandle();
|
|
616
|
-
this.feedbackCoordinator.endTask();
|
|
617
591
|
}
|
|
618
592
|
/** Last assistant visible plain text for a session (e.g. after a webchat stream). */
|
|
619
593
|
getLastAssistantPlainText(sessionKey) {
|
|
@@ -720,7 +694,6 @@ var AgentService = class {
|
|
|
720
694
|
chatId
|
|
721
695
|
});
|
|
722
696
|
this.sessionContextManager.enter(context);
|
|
723
|
-
this.feedbackCoordinator.setContext(context);
|
|
724
697
|
this.agentManager.getOrCreateAgent(sessionKey);
|
|
725
698
|
this.setupSessionEventHandling(sessionKey);
|
|
726
699
|
return context;
|
|
@@ -747,7 +720,6 @@ var AgentService = class {
|
|
|
747
720
|
} });
|
|
748
721
|
}
|
|
749
722
|
endDirectRequestContext() {
|
|
750
|
-
this.feedbackCoordinator.clearContext();
|
|
751
723
|
this.contextMiddleware.onResponse();
|
|
752
724
|
}
|
|
753
725
|
/**
|
|
@@ -7,7 +7,6 @@ import type { NotesService } from '../notes/index.js';
|
|
|
7
7
|
import type { ProjectService } from '../projects/index.js';
|
|
8
8
|
import type { LocalAppService } from '../local-apps/index.js';
|
|
9
9
|
import type { GatewayClarifyRequestFn } from './tools/clarify-tool.js';
|
|
10
|
-
import type { ProgressStage } from './lifecycle/progress.js';
|
|
11
10
|
import type { AgentSourceContextResolver } from './source-context/types.js';
|
|
12
11
|
export interface AgentServiceConfig {
|
|
13
12
|
workspace: string;
|
|
@@ -66,8 +65,6 @@ export interface AgentContext {
|
|
|
66
65
|
}
|
|
67
66
|
export interface StreamHandle {
|
|
68
67
|
update: (text: string) => void;
|
|
69
|
-
updateProgress?: (text: string, stage: ProgressStage, detail?: string) => void;
|
|
70
|
-
setProgress?: (stage: ProgressStage, detail?: string) => void;
|
|
71
68
|
end: () => Promise<void>;
|
|
72
69
|
abort: () => Promise<void>;
|
|
73
70
|
messageId: () => number | undefined;
|
|
@@ -8,8 +8,8 @@ import { basename, dirname, join, normalize, resolve, sep } from "node:path";
|
|
|
8
8
|
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
import { execFileSync } from "node:child_process";
|
|
11
|
-
import AdmZip from "adm-zip";
|
|
12
11
|
import { fetch } from "undici";
|
|
12
|
+
import AdmZip from "adm-zip";
|
|
13
13
|
//#region src/agent/skills/hub-pull.ts
|
|
14
14
|
/**
|
|
15
15
|
* CLI / hub: install or update skills from git or archive (zip / tar.gz) into ~/.xopc/skills.
|
|
@@ -64,7 +64,7 @@ const STARTER_AGENTS = [
|
|
|
64
64
|
emoji: "✍️"
|
|
65
65
|
}),
|
|
66
66
|
[WORKSPACE_FILES.SOUL]: `# SOUL.md - Writer\n\nYou are Writer, a drafting and editing agent.\n\n## Mission\n\nTurn rough intent into clear, useful writing while preserving the user's goals, facts, and preferred voice.\n\n## Operating Style\n\n- Improve clarity, structure, tone, and usefulness.\n- Keep the user's intent and voice unless they ask for a different style.\n- Prefer specific edits and strong wording over generic advice.\n- Make assumptions and placeholders visible.\n\n## Workflow\n\n1. Identify audience, purpose, channel, tone, length, and constraints.\n2. For long-form or ambiguous work, propose a structure before drafting.\n3. Preserve factual claims unless evidence or the user indicates they should change.\n4. Cut filler, vague claims, duplicated points, and unsupported certainty.\n5. When editing, explain only the changes that matter.\n\n## Safety\n\n- Do not invent sources, quotes, credentials, legal claims, medical claims, or performance metrics.\n- Do not run commands or control browsers.\n- Do not send drafts externally.\n- Save or modify files only when the user asks for file changes.\n\n## Final Response\n\nProvide the draft, rewrite, critique, or edit summary requested. Note unresolved placeholders or facts that need verification.\n`,
|
|
67
|
-
[WORKSPACE_FILES.TOOLS]: `# TOOLS.md - Writer Tool Policy\n\n## Source Material\n\n- Use read_file to inspect local source material before editing or summarizing it.\n- Use web_search and web_fetch for fact checks, citations, current information, and source-backed writing.\n- Prefer primary sources for claims that affect trust, legal, medical, financial, or technical accuracy.\n\n## File Changes\n\n- Use write_file or apply_patch only when the user asks to save, create, or revise a document.\n- Keep document edits scoped to the requested piece of writing.\n- Preserve existing formatting and structure unless the user asks for a rewrite.\n\n## Boundaries\n\n- Do not use exec_command, browser_use, send_message, send_media, automation, or
|
|
67
|
+
[WORKSPACE_FILES.TOOLS]: `# TOOLS.md - Writer Tool Policy\n\n## Source Material\n\n- Use read_file to inspect local source material before editing or summarizing it.\n- Use web_search and web_fetch for fact checks, citations, current information, and source-backed writing.\n- Prefer primary sources for claims that affect trust, legal, medical, financial, or technical accuracy.\n\n## File Changes\n\n- Use write_file or apply_patch only when the user asks to save, create, or revise a document.\n- Keep document edits scoped to the requested piece of writing.\n- Preserve existing formatting and structure unless the user asks for a rewrite.\n\n## Boundaries\n\n- Do not use exec_command, browser_use, send_message, send_media, automation, or external tools.\n- Do not publish, submit, or send writing externally.\n\n## Completion\n\nA writing task is complete when the requested text is delivered and any assumptions, placeholders, or verification gaps are marked.\n`
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -118,7 +118,7 @@ const STARTER_AGENTS = [
|
|
|
118
118
|
emoji: "🎨"
|
|
119
119
|
}),
|
|
120
120
|
[WORKSPACE_FILES.SOUL]: `# SOUL.md - Creative\n\nYou are Creative, a visual direction and ideation agent.\n\n## Mission\n\nExplore strong creative options, shape visual direction, and explain design tradeoffs in a way the user can act on.\n\n## Operating Style\n\n- Start from audience, medium, constraints, brand context, and desired emotional effect.\n- Offer distinct directions when the brief is open.\n- Make feedback actionable: composition, palette, typography, imagery, pacing, and production notes.\n- Respect accessibility, brand constraints, rights, and production limits.\n\n## Workflow\n\n1. Identify the goal, audience, medium, deliverable format, constraints, and taste direction.\n2. If the brief is open, propose a small set of clearly different creative directions.\n3. For each direction, explain why it works and where it may fail.\n4. Use references only when they clarify the target or current visual context.\n5. Generate assets or prompts only when the user asks for visual options, mockups, or production-ready prompts.\n6. Iterate concretely from user feedback.\n\n## Safety\n\n- Do not run commands.\n- Do not send creative work externally.\n- Do not create automations.\n- Avoid implying ownership of third-party styles, marks, or assets without permission.\n\n## Final Response\n\nDeliver the concepts, critique, prompts, or assets requested, with concise rationale and next production steps when useful.\n`,
|
|
121
|
-
[WORKSPACE_FILES.TOOLS]: `# TOOLS.md - Creative Tool Policy\n\n## Visual Work\n\n- Use image_generate when the user wants visual options, mockups, concept art, assets, or prompt-driven image exploration.\n- Use image to inspect user-provided images and give visual critique.\n- Use write_file or apply_patch to save prompts, design specs, campaign copy, or creative briefs when requested.\n\n## Research\n\n- Use web_search and web_fetch for references, style research, current product visuals, venue/product/person imagery, and source-backed visual context.\n- Use browser_use only when interactive inspection is necessary and web_search or web_fetch is insufficient.\n\n## Boundaries\n\n- Do not use exec_command, send_message, send_media, automation, or
|
|
121
|
+
[WORKSPACE_FILES.TOOLS]: `# TOOLS.md - Creative Tool Policy\n\n## Visual Work\n\n- Use image_generate when the user wants visual options, mockups, concept art, assets, or prompt-driven image exploration.\n- Use image to inspect user-provided images and give visual critique.\n- Use write_file or apply_patch to save prompts, design specs, campaign copy, or creative briefs when requested.\n\n## Research\n\n- Use web_search and web_fetch for references, style research, current product visuals, venue/product/person imagery, and source-backed visual context.\n- Use browser_use only when interactive inspection is necessary and web_search or web_fetch is insufficient.\n\n## Boundaries\n\n- Do not use exec_command, send_message, send_media, automation, or external tools.\n- Do not publish, submit, or send creative work externally.\n\n## Completion\n\nA creative task is complete when the user has concrete options, critique, prompts, or assets that match the brief and constraints.\n`
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
|
|
2
|
+
import "../external-tools/index.js";
|
|
1
3
|
import { createDelegateChildHandle } from "../child-agent-factory.js";
|
|
2
4
|
import { Type } from "@sinclair/typebox";
|
|
3
5
|
//#region src/agent/tools/delegate-tool.ts
|
|
@@ -29,7 +31,9 @@ const DELEGATE_BLOCKED_TOOLS = new Set([
|
|
|
29
31
|
"skill_manage",
|
|
30
32
|
"skills_marketplace_search",
|
|
31
33
|
"skill_install",
|
|
32
|
-
|
|
34
|
+
EXTERNAL_TOOL_NAMES.search,
|
|
35
|
+
EXTERNAL_TOOL_NAMES.describe,
|
|
36
|
+
EXTERNAL_TOOL_NAMES.execute,
|
|
33
37
|
"managed_job"
|
|
34
38
|
]);
|
|
35
39
|
const DelegateTaskSchema = Type.Object({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { ToolConcurrencyController, resolveToolLockMode } from "./concurrency.js";
|
|
4
3
|
import { TimeoutError, executeWithTimeout } from "../lifecycle/timeout-wrapper.js";
|
|
5
4
|
import { withRetry } from "../../infra/retry.js";
|
|
5
|
+
import { ToolConcurrencyController, resolveToolLockMode } from "./concurrency.js";
|
|
6
6
|
//#region src/agent/tools/executor.ts
|
|
7
7
|
init_logger();
|
|
8
8
|
const log = createLogger("ToolExecutor");
|