@xopcai/xopc 0.0.351 → 0.0.353
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/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/dist/browser-ext/dist/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dc0yBlKV.js → agent-avatar-dicebear-BVIuZcCP.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BXFins6I.js → agent-defaults-settings-panel-CcTnphqy.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-B-w6bJuj.js → agent-plugin-dialog-CdCzMPhC.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BiNKpndr.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-yUALtmym.js → agents-admin-api-Ck2x78jq.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C7QjGlMZ.js → app-management-settings-panel-BvGDN5J6.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CgApGxhN.js → appearance-settings-BhQYkuQj.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DWii4stP.js → apps-page-BQZJuM-C.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin--oP0UmoE.js → archive-plugin-BZXXJvpX.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DkV4w6xr.js → automations-page-C7VKkDb5.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DT95Uk9d.js → automations-workspace-y4qcvlg8.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-DIpBiw_8.js → binary-plugins-DoT3g5SP.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Di4X446B.js → block-editor-sqqrCafh.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-B0TlAcoB.js → browser-automation-inputs-CZOKsAaa.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-pKPvkGW8.js → browser-automations-page-TEeTmkGP.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-cJ200PlY.js → browser-settings-page--N4P7V0l.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-e-fO70DK.js → capabilities-BOrLei_L.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CPKbJUDL.js → capabilities-page-F7OAv-iz.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-D5xUFWBJ.js → capabilities-settings-panel-CaiIo1S1.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-header-actions-9qDm8ioP.js → capability-header-actions-CR_O9_Vr.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CO_9_oIH.js → channels-Bb-8c4wl.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DCFwzHu2.js → chat-terminal-dock-Q99iKyiO.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-bwWQ3axN.js → computer-settings-page-QuXZBfky.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BIIP-gX4.js → connector-service-page-BIqzVqCO.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-C0b5Xbca.js → connectors-page-CZ24DSBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-DBio7OE6.js → date-picker-Ck-FmYEL.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-hyPm_1tB.js → dependency-picker-BjH8XrKb.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BDPfot60.js → desktop-pet-DyGxNAVW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C6IRO2iD.js → desktop-pet-settings-C1rKgB-S.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CUOh38IK.js → device-pairing-wizard-UrPcOU6Q.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ljXXfuLL.js → directory-picker-path-field-BYxUgMZb.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DHw1dG1g.js → extension-debug-page-CGL0jpQA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BjLN3E6q.js → extension-page-DPWf-tYg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BMp6v6zP.js → extension-settings-page-DZWBY39d.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CmjHbMj7.js → gateway-config-swr-B31I6Gbq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DzyR6LYb.js → gateway-realtime-D6ffOiPe.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DQuFWNjA.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-D76thCuX.js → gateway-settings-D5w5aYXK.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CbOUnKv5.js → gateway-startup-retry-DVol958v.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-D1Tyeuul.js → home-page-DPQwxBGy.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-BmLpVntI.js → image-generation-api-TVgJfz9r.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CabovqRQ.js → imports-page-CnRWDtGz.js} +1 -1
- package/dist/gateway/static/root/assets/index-B-w6Rk9Z.css +1 -0
- package/dist/gateway/static/root/assets/{index-Bb32g7Ll.js → index-DU5Eb1V8.js} +20 -20
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DvN-2bcS.js → keyboard-shortcuts-settings-CoYdyBRh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CSEzRWxs.js → local-app-workbench-page-hjFeYlIq.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-C3Wy2zG2.js → local-apps-page-CeBhXeoX.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-wiq_12oN.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-WMaCMm3_.js → locale-store-Y1aBayM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-YojQFX9o.js → logs-page-CzpZDjkA.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-CNMk0HRn.js → management-settings-Beu_R_Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-Oe4rXk1N.js → markdown-view-BlzX7Ze5.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Ds7HF3EM.js → media-plugins-C9ya5rUH.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DPw2X06D.js +3 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-D8vQ_INI.js → note-detail-panel-D8bpTGwP.js} +3 -3
- package/dist/gateway/static/root/assets/{notes-page-CIFcEPAd.js → notes-page-OmgXowUG.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-YKiYT0q2.js → page-context-capture-button-BjjjuLkz.js} +1 -1
- package/dist/gateway/static/root/assets/{page-tabs-ZUC486EH.js → page-tabs-_DiuzxyD.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Ca9tBmOg.js → preview-open-alternatives-BKvUadws.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BuGb8QPn.js → product-open-page-DUPsiVP9.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-C6Awj1Ql.js → project-detail-page-CWlCg2x5.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CmO8Gb9G.js → projects-page-NbVNo0tP.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DEePN1Rc.js → registry-api-DqDOrPQ0.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BsqHroXR.js → remote-access-hub-CD8HrqGC.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Cva9t35o.js → runtime-tools-settings-panel-C25xEYTK.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-3_61bQHN.js → scenes-page-DbWaemwR.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DWHFyKEB.js → schema-form-_3LQ4hyB.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-Bv-hCMKS.js → session-api-CTN4qwiN.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-BcDptzCN.js → session-manager-DsH1DZI_.js} +5 -5
- package/dist/gateway/static/root/assets/{sessions-page-BaHue2bK.js → sessions-page-B7ZUdXlb.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CpKzZMft.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BwdrtX6k.js → settings-form-section-DS80hVSY.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DqCJHcdG.js +1 -0
- package/dist/gateway/static/root/assets/{setup-status-panel-nMWHz-ra.js → setup-status-panel-De-kC3yJ.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-DH0KHlev.js → share-preview-page-T-0g_rwr.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-KK-VNbMw.js → shares-settings-Dz33T3du.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BbNk-3Ig.js → skill-api-Cx6GGpSY.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DyJ-Duem.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-BQya9ygw.js → skills-page-B2iyN-kP.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-akm5mc8b.js → system-settings-panel-By3SZQR_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-wLGUc7Nu.js → task-detail-page-4yHUTs4_.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-vZ7P_KIQ.js → tunnel-api-BoH0LBkw.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-BV1KJ0EY.js → usage-page-dKU5X9zT.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DQdLcZfO.js → use-autosave-YKCwQvqT.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-DnLTTyOE.js → user-model-page-Uht32LPP.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-CJ-FjNHr.js → voice-api-key-field-DiqHIA8l.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DbjjZkIg.js → voice-config-api-BM75K3mR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BA1AAqaW.js → work-discovery-overlay-BnfD6w0k.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BhIOKmjW.js → workflow-run-setup-panel-DSy57rBr.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-aYoObmuS.js → workflows-page-Cq3vRUbc.js} +1 -1
- package/dist/gateway/static/root/index.html +15 -15
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
- package/dist/src/agent/agent-manager.js +25 -11
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -9
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +2 -4
- package/dist/src/agent/context/workspace-seed.d.ts +1 -7
- package/dist/src/agent/context/workspace-seed.js +4 -13
- package/dist/src/agent/context/workspace-templates/AGENTS.md +1 -1
- package/dist/src/agent/context/workspace.d.ts +1 -3
- package/dist/src/agent/context/workspace.js +3 -7
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/messaging/no-reply.d.ts +1 -0
- package/dist/src/agent/messaging/no-reply.js +4 -0
- package/dist/src/agent/messaging/outbound-coordinator.d.ts +0 -4
- package/dist/src/agent/messaging/outbound-coordinator.js +2 -4
- package/dist/src/agent/prompt/sections/agent-identity.d.ts +3 -0
- package/dist/src/agent/prompt/sections/agent-identity.js +13 -0
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +0 -5
- package/dist/src/agent/prompt/sections/messaging-runtime.js +2 -16
- package/dist/src/agent/prompt/sections/project-context.d.ts +0 -3
- package/dist/src/agent/prompt/sections/project-context.js +2 -9
- package/dist/src/agent/prompt/sections/tooling.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +2 -0
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -8
- package/dist/src/agent/prompt/subagent-context.js +1 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +0 -4
- package/dist/src/agent/prompt/system-prompt-params.js +0 -2
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -2
- package/dist/src/agent/prompt/system-prompt.js +8 -9
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/starter-agents.d.ts +3 -4
- package/dist/src/agent/starter-agents.js +104 -90
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +7 -4
- package/dist/src/agent/tools/factory.d.ts +4 -2
- package/dist/src/agent/tools/factory.js +6 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +2 -1
- package/dist/src/agent-catalog/migrations/identity-markdown-cutover.d.ts +5 -0
- package/dist/src/agent-catalog/migrations/identity-markdown-cutover.js +94 -0
- package/dist/src/agent-catalog/repository.js +7 -1
- package/dist/src/agent-catalog/service.js +2 -2
- package/dist/src/agent-config/resolver.js +2 -0
- package/dist/src/agent-config/schema.d.ts +21 -0
- package/dist/src/agent-config/schema.js +9 -4
- package/dist/src/auth/credentials.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/events/event-repository.js +2 -1
- package/dist/src/bootstrap/application-state.js +2 -0
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +4 -7
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +0 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/init.js +0 -33
- package/dist/src/cli/commands/onboard/model.js +2 -2
- package/dist/src/cli/commands/providers.js +1 -1
- package/dist/src/cli/templates.d.ts +1 -1
- package/dist/src/cli/templates.js +1 -23
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/paths.d.ts +0 -2
- package/dist/src/config/paths.js +1 -3
- package/dist/src/config/reload.d.ts +0 -1
- package/dist/src/config/reload.js +0 -4
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +0 -45
- package/dist/src/config/schema.js +2 -23
- package/dist/src/connectors/connection-recovery-service.js +5 -0
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.d.ts +2 -9
- package/dist/src/gateway/agents-admin.js +8 -32
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agents.js +8 -1
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/host.d.ts +0 -2
- package/dist/src/gateway/host.js +2 -5
- package/dist/src/gateway/service.js +11 -11
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/notifications/device-store.d.ts +0 -1
- package/dist/src/notifications/device-store.js +2 -7
- package/dist/src/notifications/service.d.ts +0 -1
- package/dist/src/notifications/service.js +13 -82
- package/dist/src/session/execution-detail.js +16 -0
- package/dist/src/storage/sqlite/notes-repository.js +19 -4
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/audio/normalize.js +34 -1
- package/dist/src/voice/realtime/persona-context.d.ts +2 -2
- package/dist/src/voice/realtime/persona-context.js +19 -33
- package/package.json +11 -12
- package/dist/gateway/static/root/assets/agents-CuFzMN58.js +0 -70
- package/dist/gateway/static/root/assets/gateway-realtime-store-KyhksZSM.js +0 -1
- package/dist/gateway/static/root/assets/index-CPi50n0l.css +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-CxXjQ5Du.js +0 -1
- package/dist/gateway/static/root/assets/messages-sXePe3LQ.js +0 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-C4y4c2M7.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-B6YZFEye.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DUOG2Ig1.js +0 -1
- package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +0 -3
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +0 -18
- package/dist/src/agent/context/workspace-templates/HEARTBEAT.md +0 -26
- package/dist/src/agent/context/workspace-templates/IDENTITY.md +0 -30
- package/dist/src/agent/service/parse-outbound-session-key.d.ts +0 -8
- package/dist/src/agent/service/parse-outbound-session-key.js +0 -44
- package/dist/src/heartbeat/active-hours.d.ts +0 -11
- package/dist/src/heartbeat/active-hours.js +0 -40
- package/dist/src/heartbeat/content-check.d.ts +0 -4
- package/dist/src/heartbeat/content-check.js +0 -17
- package/dist/src/heartbeat/event-prompt.d.ts +0 -4
- package/dist/src/heartbeat/event-prompt.js +0 -11
- package/dist/src/heartbeat/index.d.ts +0 -5
- package/dist/src/heartbeat/index.js +0 -6
- package/dist/src/heartbeat/tokens.d.ts +0 -15
- package/dist/src/heartbeat/tokens.js +0 -25
- package/dist/src/heartbeat/wake.d.ts +0 -13
- package/dist/src/heartbeat/wake.js +0 -46
|
@@ -4,19 +4,16 @@ export { clearAllBootstrapSnapshots, clearBootstrapSnapshot } from './bootstrap-
|
|
|
4
4
|
export declare function resolveBootstrapFilesSync(params: {
|
|
5
5
|
profileDir: string;
|
|
6
6
|
conversationId?: string;
|
|
7
|
-
excludeHeartbeat?: boolean;
|
|
8
7
|
}): WorkspaceBootstrapFile[];
|
|
9
8
|
export declare function resolveBootstrapFilesForRun(params: {
|
|
10
9
|
profileDir: string;
|
|
11
10
|
conversationId?: string;
|
|
12
|
-
excludeHeartbeat?: boolean;
|
|
13
11
|
warn?: (message: string) => void;
|
|
14
12
|
}): Promise<WorkspaceBootstrapFile[]>;
|
|
15
13
|
export declare function resolveBootstrapContextSync(params: {
|
|
16
14
|
profileDir: string;
|
|
17
15
|
config?: Config;
|
|
18
16
|
conversationId?: string;
|
|
19
|
-
excludeHeartbeat?: boolean;
|
|
20
17
|
contextInjection?: 'always' | 'continuation-skip' | 'never';
|
|
21
18
|
}): {
|
|
22
19
|
bootstrapFiles: WorkspaceBootstrapFile[];
|
|
@@ -26,7 +23,6 @@ export declare function resolveBootstrapContextForRun(params: {
|
|
|
26
23
|
profileDir: string;
|
|
27
24
|
config?: Config;
|
|
28
25
|
conversationId?: string;
|
|
29
|
-
excludeHeartbeat?: boolean;
|
|
30
26
|
contextInjection?: 'always' | 'continuation-skip' | 'never';
|
|
31
27
|
warn?: (message: string) => void;
|
|
32
28
|
}): Promise<{
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { DEFAULT_HEARTBEAT_FILENAME } from "../context/workspace.js";
|
|
2
1
|
import { loadProfileBootstrapFiles } from "./load-bootstrap-files.js";
|
|
3
2
|
import { clearAllBootstrapSnapshots, clearBootstrapSnapshot, getOrLoadBootstrapFiles, markBootstrapContextInjected, wasBootstrapContextInjected } from "./bootstrap-cache.js";
|
|
4
3
|
import { buildBootstrapContextFiles, resolveBootstrapMaxChars, resolveBootstrapTotalMaxChars } from "./bootstrap-context.js";
|
|
5
|
-
import { filterBootstrapFilesForSession } from "./filter-bootstrap-files.js";
|
|
6
4
|
//#region src/agent/bootstrap/bootstrap-files.ts
|
|
7
|
-
function filterHeartbeatBootstrapFile(files, exclude) {
|
|
8
|
-
if (!exclude) return files;
|
|
9
|
-
return files.filter((file) => file.name !== DEFAULT_HEARTBEAT_FILENAME);
|
|
10
|
-
}
|
|
11
5
|
function resolveBootstrapFilesSync(params) {
|
|
12
|
-
return
|
|
6
|
+
return loadProfileBootstrapFiles(params.profileDir);
|
|
13
7
|
}
|
|
14
8
|
async function resolveBootstrapFilesForRun(params) {
|
|
15
9
|
const conversationId = params.conversationId;
|
|
16
|
-
return
|
|
10
|
+
return conversationId ? await getOrLoadBootstrapFiles({
|
|
17
11
|
profileDir: params.profileDir,
|
|
18
12
|
conversationId
|
|
19
|
-
}) : loadProfileBootstrapFiles(params.profileDir)
|
|
13
|
+
}) : loadProfileBootstrapFiles(params.profileDir);
|
|
20
14
|
}
|
|
21
15
|
function resolveBootstrapContextSync(params) {
|
|
22
16
|
const mode = params.contextInjection ?? "always";
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { DEFAULT_AGENTS_FILENAME,
|
|
1
|
+
import { DEFAULT_AGENTS_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET, stripFrontMatter } from "../context/workspace.js";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent/bootstrap/load-bootstrap-files.ts
|
|
5
5
|
const PROFILE_LOAD_ORDER = [
|
|
6
6
|
DEFAULT_AGENTS_FILENAME,
|
|
7
7
|
DEFAULT_SOUL_FILENAME,
|
|
8
|
-
DEFAULT_TOOLS_FILENAME
|
|
9
|
-
DEFAULT_IDENTITY_FILENAME,
|
|
10
|
-
DEFAULT_HEARTBEAT_FILENAME
|
|
8
|
+
DEFAULT_TOOLS_FILENAME
|
|
11
9
|
];
|
|
12
10
|
function readProfileFile(filePath) {
|
|
13
11
|
if (!existsSync(filePath)) return null;
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
* Seed profile Markdown files into `agents/<agentId>/profile/` (and optionally `git init` the Markdown workspace).
|
|
3
3
|
* Resolution order per file: `XOPC_TEMPLATE_PATH` or repo `docs/reference/templates`, then bundled `./workspace-templates/`.
|
|
4
4
|
*/
|
|
5
|
-
/** Marker in bundled/reference `IDENTITY.md` templates; replaced on agent creation when a display name is known. */
|
|
6
|
-
export declare const IDENTITY_NAME_PLACEHOLDER = "_(pick something you like)_";
|
|
7
|
-
export type SeedWorkspaceProfileMarkdownOptions = {
|
|
8
|
-
/** Fills the **Name** line in `IDENTITY.md` when the template still contains the placeholder. */
|
|
9
|
-
displayName?: string;
|
|
10
|
-
};
|
|
11
5
|
/**
|
|
12
6
|
* Seed profile Markdown into `profileDir` (`agents/<id>/profile/`).
|
|
13
7
|
* When `markdownWorkspaceDir` is set, runs `git init` on a brand-new Markdown workspace only (never under `profile/`).
|
|
14
8
|
* Does not overwrite existing files.
|
|
15
9
|
*/
|
|
16
|
-
export declare function seedAgentProfileMarkdownFiles(profileDir: string, markdownWorkspaceDir: string
|
|
10
|
+
export declare function seedAgentProfileMarkdownFiles(profileDir: string, markdownWorkspaceDir: string): void;
|
|
17
11
|
/**
|
|
18
12
|
* Ensure default (`main`) agent has reference profile Markdown templates (missing files only).
|
|
19
13
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_agent_scope, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agent-scope.js";
|
|
4
|
-
import { WORKSPACE_FILES, init_paths } from "../../config/paths.js";
|
|
5
4
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES } from "./workspace.js";
|
|
6
5
|
import { dirname, join } from "node:path";
|
|
7
6
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -13,11 +12,8 @@ import { execFileSync } from "node:child_process";
|
|
|
13
12
|
* Resolution order per file: `XOPC_TEMPLATE_PATH` or repo `docs/reference/templates`, then bundled `./workspace-templates/`.
|
|
14
13
|
*/
|
|
15
14
|
init_agent_scope();
|
|
16
|
-
init_paths();
|
|
17
15
|
init_logger();
|
|
18
16
|
const log = createLogger("WorkspaceSeed");
|
|
19
|
-
/** Marker in bundled/reference `IDENTITY.md` templates; replaced on agent creation when a display name is known. */
|
|
20
|
-
const IDENTITY_NAME_PLACEHOLDER = "_(pick something you like)_";
|
|
21
17
|
const SEED_FILENAMES = [...AGENT_PROFILE_MARKDOWN_SYSTEM_FILES];
|
|
22
18
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
19
|
function resolveBundledTemplatesDir() {
|
|
@@ -56,17 +52,12 @@ function writeFileIfMissing(targetPath, content) {
|
|
|
56
52
|
writeFileSync(targetPath, content, "utf-8");
|
|
57
53
|
return true;
|
|
58
54
|
}
|
|
59
|
-
function personalizeIdentityTemplate(content, displayName) {
|
|
60
|
-
const n = displayName?.trim();
|
|
61
|
-
if (!n || !content.includes("_(pick something you like)_")) return content;
|
|
62
|
-
return content.replaceAll(IDENTITY_NAME_PLACEHOLDER, n);
|
|
63
|
-
}
|
|
64
55
|
/**
|
|
65
56
|
* Seed profile Markdown into `profileDir` (`agents/<id>/profile/`).
|
|
66
57
|
* When `markdownWorkspaceDir` is set, runs `git init` on a brand-new Markdown workspace only (never under `profile/`).
|
|
67
58
|
* Does not overwrite existing files.
|
|
68
59
|
*/
|
|
69
|
-
function seedAgentProfileMarkdownFiles(profileDir, markdownWorkspaceDir
|
|
60
|
+
function seedAgentProfileMarkdownFiles(profileDir, markdownWorkspaceDir) {
|
|
70
61
|
const wsPreExisted = existsSync(markdownWorkspaceDir);
|
|
71
62
|
mkdirSync(profileDir, { recursive: true });
|
|
72
63
|
mkdirSync(markdownWorkspaceDir, { recursive: true });
|
|
@@ -79,7 +70,7 @@ function seedAgentProfileMarkdownFiles(profileDir, markdownWorkspaceDir, options
|
|
|
79
70
|
log.warn({ name }, "Missing workspace template file; skip seeding");
|
|
80
71
|
continue;
|
|
81
72
|
}
|
|
82
|
-
if (writeFileIfMissing(targetPath,
|
|
73
|
+
if (writeFileIfMissing(targetPath, tpl)) seeded++;
|
|
83
74
|
}
|
|
84
75
|
if (seeded > 0) log.info({
|
|
85
76
|
profileDir,
|
|
@@ -107,7 +98,7 @@ function ensureGitRepo(markdownWorkspaceDir, isBrandNew) {
|
|
|
107
98
|
*/
|
|
108
99
|
function seedMainAgentProfileMarkdown() {
|
|
109
100
|
const agentId = resolveDefaultAgentId();
|
|
110
|
-
seedAgentProfileMarkdownFiles(resolveAgentProfileDir(agentId), resolveAgentWorkspaceDir(agentId)
|
|
101
|
+
seedAgentProfileMarkdownFiles(resolveAgentProfileDir(agentId), resolveAgentWorkspaceDir(agentId));
|
|
111
102
|
}
|
|
112
103
|
//#endregion
|
|
113
|
-
export {
|
|
104
|
+
export { seedAgentProfileMarkdownFiles, seedMainAgentProfileMarkdown };
|
|
@@ -11,7 +11,7 @@ This workspace is the agent's working area. Treat it as user-owned state.
|
|
|
11
11
|
|
|
12
12
|
## Startup Context
|
|
13
13
|
|
|
14
|
-
Use runtime-provided startup context first. It may already include the shared user context and profile files such as `SOUL.md`, `
|
|
14
|
+
Use runtime-provided startup context first. It may already include the shared user context and profile files such as `SOUL.md`, `TOOLS.md`, and `AGENTS.md`.
|
|
15
15
|
|
|
16
16
|
Do not manually reread startup files unless:
|
|
17
17
|
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
export declare const DEFAULT_AGENTS_FILENAME = "AGENTS.md";
|
|
8
8
|
export declare const DEFAULT_SOUL_FILENAME = "SOUL.md";
|
|
9
9
|
export declare const DEFAULT_TOOLS_FILENAME = "TOOLS.md";
|
|
10
|
-
export
|
|
11
|
-
export declare const DEFAULT_HEARTBEAT_FILENAME = "HEARTBEAT.md";
|
|
12
|
-
export type AgentProfileMarkdownFilename = typeof DEFAULT_AGENTS_FILENAME | typeof DEFAULT_SOUL_FILENAME | typeof DEFAULT_TOOLS_FILENAME | typeof DEFAULT_IDENTITY_FILENAME | typeof DEFAULT_HEARTBEAT_FILENAME;
|
|
10
|
+
export type AgentProfileMarkdownFilename = typeof DEFAULT_AGENTS_FILENAME | typeof DEFAULT_SOUL_FILENAME | typeof DEFAULT_TOOLS_FILENAME;
|
|
13
11
|
/**
|
|
14
12
|
* Order for loading profile Markdown files into the system prompt (persona / user before repo guide, etc.).
|
|
15
13
|
*/
|
|
@@ -15,20 +15,16 @@ const log = createLogger("Workspace");
|
|
|
15
15
|
const DEFAULT_AGENTS_FILENAME = "AGENTS.md";
|
|
16
16
|
const DEFAULT_SOUL_FILENAME = "SOUL.md";
|
|
17
17
|
const DEFAULT_TOOLS_FILENAME = "TOOLS.md";
|
|
18
|
-
const DEFAULT_IDENTITY_FILENAME = "IDENTITY.md";
|
|
19
|
-
const DEFAULT_HEARTBEAT_FILENAME = "HEARTBEAT.md";
|
|
20
18
|
/**
|
|
21
19
|
* Order for loading profile Markdown files into the system prompt (persona / user before repo guide, etc.).
|
|
22
20
|
*/
|
|
23
21
|
const AGENT_PROFILE_MARKDOWN_SYSTEM_FILES = [
|
|
24
22
|
DEFAULT_SOUL_FILENAME,
|
|
25
|
-
DEFAULT_IDENTITY_FILENAME,
|
|
26
23
|
DEFAULT_TOOLS_FILENAME,
|
|
27
|
-
DEFAULT_AGENTS_FILENAME
|
|
28
|
-
DEFAULT_HEARTBEAT_FILENAME
|
|
24
|
+
DEFAULT_AGENTS_FILENAME
|
|
29
25
|
];
|
|
30
26
|
/** Files that should be surfaced when missing. Other profile files are optional overlays. */
|
|
31
|
-
const REQUIRED_AGENT_PROFILE_MARKDOWN_FILES = [DEFAULT_SOUL_FILENAME
|
|
27
|
+
const REQUIRED_AGENT_PROFILE_MARKDOWN_FILES = [DEFAULT_SOUL_FILENAME];
|
|
32
28
|
const REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET = new Set(REQUIRED_AGENT_PROFILE_MARKDOWN_FILES);
|
|
33
29
|
/**
|
|
34
30
|
* Strip YAML front matter from markdown content.
|
|
@@ -164,4 +160,4 @@ function extractThinkingFromAssistantMessage(message) {
|
|
|
164
160
|
return typeof t === "string" ? t : "";
|
|
165
161
|
}
|
|
166
162
|
//#endregion
|
|
167
|
-
export { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, DEFAULT_AGENTS_FILENAME,
|
|
163
|
+
export { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, DEFAULT_AGENTS_FILENAME, DEFAULT_SOUL_FILENAME, DEFAULT_TOOLS_FILENAME, PROFILE_MARKDOWN_MAX_CHARS, REQUIRED_AGENT_PROFILE_MARKDOWN_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET, extractTextContent, extractThinkingContent, extractThinkingFromAssistantMessage, loadProfileMarkdownFiles, stripFrontMatter, toWorkspaceProfileMarkdownFile, truncateProfileMarkdownContent };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveMcpOAuthPath } from "../../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomic } from "../../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveMcpOAuthPath } from "../../../config/paths.js";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NO_REPLY = "NO_REPLY";
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* unit-testable and lets the parent `AgentService` shrink to a coordinator.
|
|
14
14
|
*/
|
|
15
15
|
import type { MessageBus, InboundMessage } from '../../infra/bus/index.js';
|
|
16
|
-
import type { Config } from '../../config/schema.js';
|
|
17
16
|
import type { HookHandler } from '../lifecycle/hook-handler.js';
|
|
18
17
|
import type { SessionContext } from '../session/index.js';
|
|
19
18
|
import { type TypingController } from '../lifecycle/typing.js';
|
|
@@ -22,8 +21,6 @@ export interface OutboundCoordinatorConfig {
|
|
|
22
21
|
bus: MessageBus;
|
|
23
22
|
hookHandler: HookHandler;
|
|
24
23
|
streamManager: StreamManager;
|
|
25
|
-
/** Reads the effective config snapshot (honours runtime overrides). */
|
|
26
|
-
getConfig: () => Config | undefined;
|
|
27
24
|
/** Resolves the last visible assistant text for a session (in-memory + agent fallback). */
|
|
28
25
|
getLastAssistantPlainText: (conversationId: string) => string;
|
|
29
26
|
reviewTaskTurn: (payload: SessionTurnCompletePayload) => Promise<void>;
|
|
@@ -43,7 +40,6 @@ export declare class OutboundCoordinator {
|
|
|
43
40
|
private readonly bus;
|
|
44
41
|
private readonly hookHandler;
|
|
45
42
|
private readonly streamManager;
|
|
46
|
-
private readonly getConfig;
|
|
47
43
|
private readonly getLastAssistantPlainText;
|
|
48
44
|
private readonly reviewTaskTurn;
|
|
49
45
|
constructor(config: OutboundCoordinatorConfig);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import
|
|
3
|
+
import "./no-reply.js";
|
|
4
4
|
import { createTypingController } from "../lifecycle/typing.js";
|
|
5
5
|
//#region src/agent/messaging/outbound-coordinator.ts
|
|
6
6
|
init_logger();
|
|
@@ -9,14 +9,12 @@ var OutboundCoordinator = class {
|
|
|
9
9
|
bus;
|
|
10
10
|
hookHandler;
|
|
11
11
|
streamManager;
|
|
12
|
-
getConfig;
|
|
13
12
|
getLastAssistantPlainText;
|
|
14
13
|
reviewTaskTurn;
|
|
15
14
|
constructor(config) {
|
|
16
15
|
this.bus = config.bus;
|
|
17
16
|
this.hookHandler = config.hookHandler;
|
|
18
17
|
this.streamManager = config.streamManager;
|
|
19
|
-
this.getConfig = config.getConfig;
|
|
20
18
|
this.getLastAssistantPlainText = config.getLastAssistantPlainText;
|
|
21
19
|
this.reviewTaskTurn = config.reviewTaskTurn;
|
|
22
20
|
}
|
|
@@ -70,7 +68,7 @@ var OutboundCoordinator = class {
|
|
|
70
68
|
if (this.streamManager.consumeSkipFinalOutbound()) return;
|
|
71
69
|
const finalContent = this.getLastAssistantPlainText(sessionContext.conversationId);
|
|
72
70
|
if (!finalContent?.trim()) return;
|
|
73
|
-
if (
|
|
71
|
+
if (finalContent.trim() === "NO_REPLY") {
|
|
74
72
|
log.debug({ conversationId: sessionContext.conversationId }, "Silent reply — skipping outbound");
|
|
75
73
|
return;
|
|
76
74
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/agent/prompt/sections/agent-identity.ts
|
|
2
|
+
/** Identity comes from the Agent catalog, never from workspace Markdown. */
|
|
3
|
+
function buildAgentIdentitySection(profile) {
|
|
4
|
+
if (!profile) return;
|
|
5
|
+
const lines = [`Name: ${profile.name}`];
|
|
6
|
+
if (profile.description) lines.push(`Description: ${profile.description}`);
|
|
7
|
+
if (profile.creature) lines.push(`Type: ${profile.creature}`);
|
|
8
|
+
if (profile.style) lines.push(`Style: ${profile.style}`);
|
|
9
|
+
if (profile.language) lines.push(`Primary language: ${profile.language}`);
|
|
10
|
+
return `## Agent identity\n\n${lines.join("\n")}`;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { buildAgentIdentitySection };
|
|
@@ -9,8 +9,3 @@ export declare function buildSilentRepliesSection(params: {
|
|
|
9
9
|
}): string;
|
|
10
10
|
export declare function buildOutputDirectivesSection(isMinimal: boolean): string;
|
|
11
11
|
export declare function buildTimeSection(timezone?: string): string;
|
|
12
|
-
export declare function buildHeartbeatBehaviorSection(params: {
|
|
13
|
-
enabled: boolean;
|
|
14
|
-
customPrompt?: string;
|
|
15
|
-
userTimezone?: string;
|
|
16
|
-
}): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NO_REPLY } from "
|
|
1
|
+
import { NO_REPLY } from "../../messaging/no-reply.js";
|
|
2
2
|
//#region src/agent/prompt/sections/messaging-runtime.ts
|
|
3
3
|
function buildMessagingSection(params) {
|
|
4
4
|
if (params.isMinimal || params.channels.length === 0) return "";
|
|
@@ -49,19 +49,5 @@ function buildTimeSection(timezone) {
|
|
|
49
49
|
"If you need the current date/time/day-of-week, use the `session_status` tool or the inbound message timestamp envelope (when present)."
|
|
50
50
|
].join("\n");
|
|
51
51
|
}
|
|
52
|
-
function buildHeartbeatBehaviorSection(params) {
|
|
53
|
-
if (!params.enabled) return "";
|
|
54
|
-
if (params.customPrompt?.trim()) return `## Heartbeats\n\n${params.customPrompt.trim()}`;
|
|
55
|
-
let quietHoursNote = "";
|
|
56
|
-
if (params.userTimezone) quietHoursNote = `\n\n> Quiet hours: The user is in **${params.userTimezone}**. Avoid proactive checks during late night (23:00-08:00) unless urgent.`;
|
|
57
|
-
return [
|
|
58
|
-
"## Heartbeats",
|
|
59
|
-
"",
|
|
60
|
-
"If the current user message is a heartbeat poll and nothing needs attention, reply exactly: HEARTBEAT_OK",
|
|
61
|
-
"",
|
|
62
|
-
"If something needs attention, do NOT include \"HEARTBEAT_OK\"; reply with the alert text instead.",
|
|
63
|
-
quietHoursNote.trim()
|
|
64
|
-
].filter(Boolean).join("\n");
|
|
65
|
-
}
|
|
66
52
|
//#endregion
|
|
67
|
-
export {
|
|
53
|
+
export { buildMessagingSection, buildOutputDirectivesSection, buildSilentRepliesSection, buildTimeSection };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { EmbeddedContextFile } from '../../bootstrap/types.js';
|
|
2
2
|
export declare const CONTEXT_FILE_ORDER: Map<string, number>;
|
|
3
|
-
export declare const DEFAULT_HEARTBEAT_PROMPT_CONTEXT_BLOCK = "Default heartbeat prompt:\n`Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.`";
|
|
4
3
|
export declare function normalizeContextFilePath(pathValue: string): string;
|
|
5
4
|
export declare function getContextFileBasename(pathValue: string): string;
|
|
6
5
|
export declare function sanitizeContextFileContentForPrompt(content: string): string;
|
|
@@ -9,5 +8,3 @@ export declare function buildProjectContextSection(params: {
|
|
|
9
8
|
files: EmbeddedContextFile[];
|
|
10
9
|
heading: string;
|
|
11
10
|
}): string[];
|
|
12
|
-
/** Heartbeat content belongs to the heartbeat user turn, never the system prompt. */
|
|
13
|
-
export declare function isHeartbeatContextFile(pathValue: string): boolean;
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { DEFAULT_HEARTBEAT_FILENAME } from "../../context/workspace.js";
|
|
2
1
|
//#region src/agent/prompt/sections/project-context.ts
|
|
3
2
|
const CONTEXT_FILE_ORDER = new Map([
|
|
4
3
|
["agents.md", 10],
|
|
5
4
|
["soul.md", 20],
|
|
6
|
-
["identity.md", 30],
|
|
7
5
|
["user.md", 40],
|
|
8
6
|
["tools.md", 50],
|
|
9
7
|
["bootstrap.md", 60],
|
|
10
8
|
["memory.md", 70]
|
|
11
9
|
]);
|
|
12
|
-
const DEFAULT_HEARTBEAT_PROMPT_CONTEXT_BLOCK = "Default heartbeat prompt:\n`Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.`";
|
|
13
10
|
function normalizeContextFilePath(pathValue) {
|
|
14
11
|
return pathValue.trim().replace(/\\/g, "/");
|
|
15
12
|
}
|
|
@@ -18,7 +15,7 @@ function getContextFileBasename(pathValue) {
|
|
|
18
15
|
return (normalizedPath.split("/").pop() ?? normalizedPath).toLowerCase();
|
|
19
16
|
}
|
|
20
17
|
function sanitizeContextFileContentForPrompt(content) {
|
|
21
|
-
return content.
|
|
18
|
+
return content.replace(/\n{3,}/g, "\n\n");
|
|
22
19
|
}
|
|
23
20
|
function sortContextFilesForPrompt(contextFiles) {
|
|
24
21
|
return [...contextFiles].sort((a, b) => {
|
|
@@ -41,9 +38,5 @@ function buildProjectContextSection(params) {
|
|
|
41
38
|
for (const file of params.files) lines.push(`## ${file.path}`, "", sanitizeContextFileContentForPrompt(file.content), "");
|
|
42
39
|
return lines;
|
|
43
40
|
}
|
|
44
|
-
/** Heartbeat content belongs to the heartbeat user turn, never the system prompt. */
|
|
45
|
-
function isHeartbeatContextFile(pathValue) {
|
|
46
|
-
return getContextFileBasename(pathValue) === DEFAULT_HEARTBEAT_FILENAME.toLowerCase();
|
|
47
|
-
}
|
|
48
41
|
//#endregion
|
|
49
|
-
export { CONTEXT_FILE_ORDER,
|
|
42
|
+
export { CONTEXT_FILE_ORDER, buildProjectContextSection, getContextFileBasename, normalizeContextFilePath, sanitizeContextFileContentForPrompt, sortContextFilesForPrompt };
|
|
@@ -142,7 +142,7 @@ function buildToolingSection(params) {
|
|
|
142
142
|
hasRead ? `Use \`${readToolName}\` for targeted file inspection before editing; do not rely on filenames alone.` : "",
|
|
143
143
|
hasPatch ? `Use \`${patchToolName}\` for source changes; keep patches focused and inspect failures carefully.` : "",
|
|
144
144
|
hasWrite ? `Use \`${writeToolName}\` only for new files or intentional complete rewrites.` : "",
|
|
145
|
-
hasXopcUse && hasRead && hasWrite ? `When the user explicitly asks to change or customize the current agent's name, identity, personality, instructions, working style, tools,
|
|
145
|
+
hasXopcUse && hasRead && hasWrite ? `When the user explicitly asks to change or customize the current agent's name, identity, personality, instructions, working style, tools, or workspace, persist the change instead of only drafting advice. Inspect the current state first; use \`${readToolName}\` and \`${writeToolName}\` for the current agent's profile Markdown, and use \`xopc_use\` mode \`agent\` for structured settings. Target only the current runtime agent unless the user names another one, verify the saved result, and ask before consequential capability or scope expansion when intent is ambiguous.` : "",
|
|
146
146
|
hasXopcUse ? "When the user explicitly asks to create an Agent, use `xopc_use` mode `agent`: list first, create the Agent without a Project or custom workspace unless the user requests one, verify the result, and clearly identify the created Agent so the user can open its own conversation for further customization." : "",
|
|
147
147
|
hasGrep || hasFind ? `Use ${[hasGrep ? `\`${grepToolName}\`` : "", hasFind ? `\`${findToolName}\`` : ""].filter(Boolean).join(" and ")} for text/file discovery; use code graph or symbol tools when available for definitions and call relationships.` : "",
|
|
148
148
|
hasExec ? `Use \`${execToolName}\` for verification and safe inspection, not routine file editing.` : "",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Combines base system prompt with skill prompts and bootstrap Project Context.
|
|
5
5
|
*/
|
|
6
6
|
import type { Config } from '../../config/schema.js';
|
|
7
|
+
import type { AgentProfile } from '../../agent-config/index.js';
|
|
7
8
|
import type { EmbeddedContextFile } from '../bootstrap/types.js';
|
|
8
9
|
import type { SkillManager } from '../skills/skill-manager.js';
|
|
9
10
|
import type { PromptMode, SilentReplyPromptMode } from './types.js';
|
|
@@ -13,6 +14,7 @@ export interface SystemPromptBuildOptions {
|
|
|
13
14
|
workspaceOverride?: string;
|
|
14
15
|
profileMarkdownPathRoot?: string;
|
|
15
16
|
customInstructions?: string;
|
|
17
|
+
agentProfile?: AgentProfile;
|
|
16
18
|
skillPromptText?: string;
|
|
17
19
|
skillAllowlist?: string[];
|
|
18
20
|
registeredToolNames?: string[];
|
|
@@ -34,7 +34,6 @@ var SystemPromptBuilder = class {
|
|
|
34
34
|
const actionTrustLevel = isXopcDatabaseOpen() ? getUserTrustPolicy().defaultActionLevel : DEFAULT_USER_TRUST_LEVEL;
|
|
35
35
|
const interactionState = isXopcDatabaseOpen() && options.conversationId ? getInteractionState(options.conversationId) : void 0;
|
|
36
36
|
const interactionPrompt = interactionState ? buildInteractionStatePrompt(interactionState) : "";
|
|
37
|
-
const heartbeatEnabled = this.config.gateway?.heartbeat?.includeSystemPromptSection ?? false;
|
|
38
37
|
const userTimezone = isXopcDatabaseOpen() ? getUserTimezone() : void 0;
|
|
39
38
|
const ttsMerged = mergeTtsConfigFromAppConfig(this.config.messages?.tts);
|
|
40
39
|
const reg = options.registeredToolNames ?? [];
|
|
@@ -53,7 +52,6 @@ var SystemPromptBuilder = class {
|
|
|
53
52
|
toolSummaries: options.toolSummaries,
|
|
54
53
|
userTimezone,
|
|
55
54
|
externalMemoryInstructions: options.externalMemoryInstructions,
|
|
56
|
-
heartbeatEnabled,
|
|
57
55
|
ttsSystemHint,
|
|
58
56
|
extraSystemPrompt: [options.extraSystemPrompt, interactionPrompt].filter(Boolean).join("\n\n"),
|
|
59
57
|
activeProjectContext: options.activeProjectContext,
|
|
@@ -67,8 +65,6 @@ var SystemPromptBuilder = class {
|
|
|
67
65
|
const basePrompt = buildSystemPrompt(ws, {
|
|
68
66
|
contextFiles,
|
|
69
67
|
promptMode: resolved.promptMode,
|
|
70
|
-
heartbeatEnabled: resolved.heartbeatEnabled,
|
|
71
|
-
heartbeatPrompt: resolved.heartbeatPrompt,
|
|
72
68
|
toolNames: resolved.toolNames,
|
|
73
69
|
toolSummaries: resolved.toolSummaries,
|
|
74
70
|
memoryCitationsMode: resolved.memoryCitationsMode,
|
|
@@ -87,7 +83,8 @@ var SystemPromptBuilder = class {
|
|
|
87
83
|
includeToneSection: resolved.includeToneSection,
|
|
88
84
|
actionTrustLevel,
|
|
89
85
|
responseLanguage,
|
|
90
|
-
customInstructions: options.customInstructions
|
|
86
|
+
customInstructions: options.customInstructions,
|
|
87
|
+
agentProfile: options.agentProfile
|
|
91
88
|
});
|
|
92
89
|
const skillPrompt = options.skillPromptText !== void 0 ? options.skillPromptText : this.skillManager.getPromptForSkillAllowlist(options.skillAllowlist, options.registeredToolNames);
|
|
93
90
|
const fullPrompt = skillPrompt ? appendStablePromptSection(basePrompt, skillPrompt) : basePrompt;
|
|
@@ -115,13 +112,11 @@ var SystemPromptBuilder = class {
|
|
|
115
112
|
conversationId: options?.conversationId,
|
|
116
113
|
toolNames: options?.registeredToolNames,
|
|
117
114
|
userTimezone: isXopcDatabaseOpen() ? getUserTimezone() : void 0,
|
|
118
|
-
externalMemoryInstructions: options?.externalMemoryInstructions
|
|
119
|
-
heartbeatEnabled: this.config.gateway?.heartbeat?.includeSystemPromptSection ?? false
|
|
115
|
+
externalMemoryInstructions: options?.externalMemoryInstructions
|
|
120
116
|
});
|
|
121
117
|
return buildSystemPrompt(ws, {
|
|
122
118
|
contextFiles,
|
|
123
119
|
promptMode: resolved.promptMode,
|
|
124
|
-
heartbeatEnabled: resolved.heartbeatEnabled,
|
|
125
120
|
toolNames: resolved.toolNames,
|
|
126
121
|
userTimezone: resolved.userTimezone,
|
|
127
122
|
runtime: resolved.runtimeInfo,
|
|
@@ -21,8 +21,6 @@ export interface SystemPromptBuildParams {
|
|
|
21
21
|
channels?: string[];
|
|
22
22
|
memoryCitationsMode?: MemoryCitationsMode;
|
|
23
23
|
includeMemorySection?: boolean;
|
|
24
|
-
heartbeatEnabled?: boolean;
|
|
25
|
-
heartbeatPrompt?: string;
|
|
26
24
|
externalMemoryInstructions?: string;
|
|
27
25
|
ttsSystemHint?: string;
|
|
28
26
|
extraSystemPrompt?: string;
|
|
@@ -39,8 +37,6 @@ export declare function resolveSystemPromptBuildParams(config: Config, params: {
|
|
|
39
37
|
toolSummaries?: Record<string, string>;
|
|
40
38
|
userTimezone?: string;
|
|
41
39
|
externalMemoryInstructions?: string;
|
|
42
|
-
heartbeatEnabled?: boolean;
|
|
43
|
-
heartbeatPrompt?: string;
|
|
44
40
|
ttsSystemHint?: string;
|
|
45
41
|
extraSystemPrompt?: string;
|
|
46
42
|
activeProjectContext?: string;
|
|
@@ -58,8 +58,6 @@ function resolveSystemPromptBuildParams(config, params) {
|
|
|
58
58
|
channels: resolveDeliverableChannels(config),
|
|
59
59
|
memoryCitationsMode: params.memoryCitationsMode,
|
|
60
60
|
includeMemorySection: params.includeMemorySection,
|
|
61
|
-
heartbeatEnabled: params.heartbeatEnabled,
|
|
62
|
-
heartbeatPrompt: params.heartbeatPrompt,
|
|
63
61
|
externalMemoryInstructions: params.externalMemoryInstructions,
|
|
64
62
|
ttsSystemHint: params.ttsSystemHint,
|
|
65
63
|
extraSystemPrompt: params.extraSystemPrompt,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* not to manually reread startup files.
|
|
7
7
|
*/
|
|
8
8
|
import type { EmbeddedContextFile } from '../bootstrap/types.js';
|
|
9
|
+
import type { AgentProfile } from '../../agent-config/index.js';
|
|
9
10
|
import type { ResponseLanguage } from '../../i18n/response-language.js';
|
|
10
11
|
import { type UserTrustLevel } from '../../user-context/trust-policy.js';
|
|
11
12
|
import type { ProviderSystemPromptContribution } from './contribution.js';
|
|
@@ -16,8 +17,6 @@ export { getContextFileBasename, sortContextFilesForPrompt, } from './sections/p
|
|
|
16
17
|
export interface SystemPromptOptions {
|
|
17
18
|
contextFiles?: EmbeddedContextFile[];
|
|
18
19
|
promptMode?: PromptMode;
|
|
19
|
-
heartbeatEnabled?: boolean;
|
|
20
|
-
heartbeatPrompt?: string;
|
|
21
20
|
/** Registered tool names for Tooling section and memory/skills gating. */
|
|
22
21
|
toolNames?: string[];
|
|
23
22
|
toolSummaries?: Record<string, string>;
|
|
@@ -38,6 +37,7 @@ export interface SystemPromptOptions {
|
|
|
38
37
|
actionTrustLevel?: UserTrustLevel;
|
|
39
38
|
responseLanguage?: ResponseLanguage;
|
|
40
39
|
customInstructions?: string;
|
|
40
|
+
agentProfile?: AgentProfile;
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Build system prompt with bootstrap Project Context integration.
|
|
@@ -2,11 +2,12 @@ import { buildActionTrustPrompt, init_trust_policy } from "../../user-context/tr
|
|
|
2
2
|
import { PROMPT_CACHE_BOUNDARY, splitPromptCacheBoundary } from "./cache-boundary.js";
|
|
3
3
|
import { buildAestheticSection, buildExecutionBiasSection, buildHumanCollaborationSection, buildProblemSolvingSection, buildSafetySection, buildToolCallStyleSection, buildWorkContinuitySection } from "./sections/behavior.js";
|
|
4
4
|
import { buildExternalMemorySection, buildMemorySection, buildSkillsSection } from "./sections/memory-skills.js";
|
|
5
|
-
import {
|
|
6
|
-
import { buildProjectContextSection, getContextFileBasename,
|
|
5
|
+
import { buildMessagingSection, buildOutputDirectivesSection, buildSilentRepliesSection, buildTimeSection } from "./sections/messaging-runtime.js";
|
|
6
|
+
import { buildProjectContextSection, getContextFileBasename, sortContextFilesForPrompt } from "./sections/project-context.js";
|
|
7
7
|
import { buildToolingSection, hasSkillsTools } from "./sections/tooling.js";
|
|
8
8
|
import { buildRuntimeSection, buildWorkspaceFilesIntroSection, buildWorkspaceSection } from "./sections/workspace-runtime.js";
|
|
9
9
|
import { buildResponseLanguageSection } from "./sections/response-language.js";
|
|
10
|
+
import { buildAgentIdentitySection } from "./sections/agent-identity.js";
|
|
10
11
|
import { buildOverridablePromptSection } from "./system-prompt-params.js";
|
|
11
12
|
//#region src/agent/prompt/system-prompt.ts
|
|
12
13
|
init_trust_policy();
|
|
@@ -17,9 +18,10 @@ function joinSections(sections) {
|
|
|
17
18
|
* Build system prompt with bootstrap Project Context integration.
|
|
18
19
|
*/
|
|
19
20
|
function buildSystemPrompt(workspaceDir, options = {}) {
|
|
20
|
-
const { contextFiles = [], promptMode = "full",
|
|
21
|
+
const { contextFiles = [], promptMode = "full", toolNames = [], toolSummaries, memoryCitationsMode = "on", includeMemorySection, userTimezone, runtime, agentId, channels = [], externalMemoryInstructions, ttsSystemHint, extraSystemPrompt, activeProjectContext, silentReplyPromptMode = "generic", promptContribution, includeProblemSolving = true, includeToneSection = true, actionTrustLevel, responseLanguage = "auto", customInstructions, agentProfile } = options;
|
|
21
22
|
if (promptMode === "none") return joinSections([
|
|
22
23
|
"You are a personal AI assistant running inside xopc.",
|
|
24
|
+
buildAgentIdentitySection(agentProfile),
|
|
23
25
|
customInstructions?.trim() ? `<custom_instructions>\n${customInstructions.trim()}\n</custom_instructions>` : void 0,
|
|
24
26
|
buildResponseLanguageSection(responseLanguage),
|
|
25
27
|
activeProjectContext
|
|
@@ -28,10 +30,11 @@ function buildSystemPrompt(workspaceDir, options = {}) {
|
|
|
28
30
|
const normalizedTools = new Set(toolNames.map((tool) => tool.toLowerCase()));
|
|
29
31
|
const effectiveAgentId = agentId ?? runtime?.agentId;
|
|
30
32
|
const sectionOverrides = promptContribution?.sectionOverrides ?? {};
|
|
31
|
-
const orderedContextFiles = sortContextFilesForPrompt(contextFiles.filter((file) => file.path.trim().length > 0
|
|
33
|
+
const orderedContextFiles = sortContextFilesForPrompt(contextFiles.filter((file) => file.path.trim().length > 0));
|
|
32
34
|
const hasProfileMemory = orderedContextFiles.some((file) => getContextFileBasename(file.path) === "memory.md");
|
|
33
35
|
const stableSections = [
|
|
34
36
|
"You are a personal AI assistant running inside xopc.",
|
|
37
|
+
buildAgentIdentitySection(agentProfile) ?? "",
|
|
35
38
|
...customInstructions?.trim() ? [`<custom_instructions>\n${customInstructions.trim()}\n</custom_instructions>`] : [],
|
|
36
39
|
buildResponseLanguageSection(responseLanguage),
|
|
37
40
|
buildToolingSection({
|
|
@@ -95,11 +98,7 @@ function buildSystemPrompt(workspaceDir, options = {}) {
|
|
|
95
98
|
fallback: ""
|
|
96
99
|
});
|
|
97
100
|
if (providerDynamicSuffix) dynamicSections.push(providerDynamicSuffix);
|
|
98
|
-
dynamicSections.push(
|
|
99
|
-
enabled: heartbeatEnabled,
|
|
100
|
-
customPrompt: heartbeatPrompt,
|
|
101
|
-
userTimezone
|
|
102
|
-
}), buildRuntimeSection(runtime));
|
|
101
|
+
dynamicSections.push(buildRuntimeSection(runtime));
|
|
103
102
|
const stablePrefix = joinSections(stableSections);
|
|
104
103
|
const dynamicSuffix = joinSections(dynamicSections);
|
|
105
104
|
if (!dynamicSuffix.trim()) return `${stablePrefix}\n\n${PROMPT_CACHE_BOUNDARY}`.trim();
|
|
@@ -355,7 +355,6 @@ var AgentService = class {
|
|
|
355
355
|
bus,
|
|
356
356
|
hookHandler: this.hookHandler,
|
|
357
357
|
streamManager: this.streamManager,
|
|
358
|
-
getConfig: () => this.effectiveAppConfig(),
|
|
359
358
|
getLastAssistantPlainText: (sk) => this.getLastAssistantPlainText(sk),
|
|
360
359
|
reviewTaskTurn: (payload) => this.taskJudge.reviewTurn(payload)
|
|
361
360
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
|
|
2
1
|
import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
|
|
2
|
+
import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
//#region src/agent/skills/hub-lock.ts
|
|
5
5
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../../utils/logger.js";
|
|
4
|
-
import { init_paths } from "../../config/paths.js";
|
|
5
4
|
import { parseFrontmatter } from "../../markdown/frontmatter.js";
|
|
5
|
+
import { init_paths } from "../../config/paths.js";
|
|
6
6
|
import { findInstallSpec, hasBinary, installSkill } from "./installer.js";
|
|
7
7
|
import { applySkillEnvOverrides, createSkillConfigManager, getSkillEnvironment, isSkillEnabled, resolveSkillConfig, validateSkillConfig } from "./config.js";
|
|
8
8
|
import { parseSkillToolConditions } from "./skill-tool-gating.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveSkillsDir } from "../../config/paths.js";
|
|
2
1
|
import { parseFrontmatter } from "../../markdown/frontmatter.js";
|
|
2
|
+
import { init_paths, resolveSkillsDir } from "../../config/paths.js";
|
|
3
3
|
import { loadSkillsLock } from "./hub-lock.js";
|
|
4
4
|
import { dirname, join, resolve, sep } from "node:path";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_paths, resolveSkillsDir } from "../../config/paths.js";
|
|
2
1
|
import { parseFrontmatter } from "../../markdown/frontmatter.js";
|
|
2
|
+
import { init_paths, resolveSkillsDir } from "../../config/paths.js";
|
|
3
3
|
import { resolveWorkspaceSkillsDir } from "./workspace-skills-dir.js";
|
|
4
4
|
import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
|
|
5
5
|
import { fuzzyFindText, normalizeForFuzzyMatch, normalizeToLF, restoreLineEndings } from "../tools/edit-diff.js";
|