@xopcai/xopc 0.0.124 → 0.0.126
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 +56 -102
- package/README.zh-CN.md +51 -98
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +6 -6
- package/dist/extensions/feishu/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +1 -1
- package/dist/extensions/telegram/src/config-schema.d.ts +8 -8
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/src/workflow-progress.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/workflow-progress.js +1 -1
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B5uSVAyJ.js → agent-avatar-dicebear-C70vgt60.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DRYVahI-.js +2 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-D9-HW6cy.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-BHlahIDL.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BdJ1eQg3.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CXUGRp2i.js → archive-plugin-B-aoIt0w.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Cmiub3Wg.js → attachment-load-BD0G0FD5.js} +1 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-iJRVI7aZ.js +1 -0
- package/dist/gateway/static/root/assets/automations-page-D8hYQbkl.js +4 -0
- package/dist/gateway/static/root/assets/{binary-plugins-0Izz-N3p.js → binary-plugins-B0mNlVSz.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-C1Kv0IkJ.js → block-editor-CJY9Lu5G.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CiWEO-Iy.js +8 -0
- package/dist/gateway/static/root/assets/capability-presets-api-Bgc8ag55.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-B1nIi0TC.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BeA2aVor.js → channel-recipient-api-0sauApoC.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BddPdqVo.js +1 -0
- package/dist/gateway/static/root/assets/code-editor-gbRgS14t.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-Ba2GDhSE.js +2 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-2rjzUu57.js → directory-picker-path-field-CiEc4KmY.js} +1 -1
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +1 -0
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +1 -0
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +1 -0
- package/dist/gateway/static/root/assets/dreaming-settings-4bvpk5wr.js +3 -0
- package/dist/gateway/static/root/assets/extension-debug-page-BbyczVZ3.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-DLN1I3DR.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-D9VGHmYJ.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-BU5S0Sn7.js → fetch-5V96dUz3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-BIPGwrl1.js → gateway-config-api-BtIzObwp.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-KFsGGDhg.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cd0Zz30N.js → gateway-startup-retry-DEMad2wt.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-4PcF6Sh6.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-B482PSaG.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-B95KdGMj.js → goals-config-api-CVN7-pdM.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-CUdgJuDn.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-IYCH3-Pi.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-Cf_a2Bmz.js +1 -0
- package/dist/gateway/static/root/assets/{html-workspace-editor-CQLWDiwE.js → html-workspace-editor-DV90ddkE.js} +1 -1
- package/dist/gateway/static/root/assets/index-CA2tR2vm.js +256 -0
- package/dist/gateway/static/root/assets/index-Ds3u0LOk.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-lKTg6St7.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-BCporcNH.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-editor-AssmZFx4.js → markdown-editor-BFOjBBla.js} +2 -2
- package/dist/gateway/static/root/assets/markdown-split-Bv4k6iGJ.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BhIQU5yS.js → media-plugins-Bbi8g3N8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C22hxE1N.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-D68Pyow7.js +2 -0
- package/dist/gateway/static/root/assets/notes-page-CuUMOiyv.js +1 -0
- package/dist/gateway/static/root/assets/notes-workbench-Dx2N5zTk.js +2 -0
- package/dist/gateway/static/root/assets/page-tabs-Cp395RYD.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DGzet1d7.js → preview-open-alternatives-DqV5OM4m.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-sB8AzZi3.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-LBnJqWK2.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-Dbj0o6SC.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Cqgb-jqa.js → save-bar-controls-BItmzAzI.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DVZcI8Yt.js → schedule-field-BQ8IjjCn.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-Bj7sOxC8.js → schema-form-BRpD6x3d.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DhDZKspB.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvXLMNL6.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BmXn-8N6.js → settings-collapsible-section-BKSPQM4R.js} +1 -1
- package/dist/gateway/static/root/assets/settings-form-section-BmyfthNQ.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-Cfm9UxAr.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-Bls5tfbH.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-kQEsTGAs.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-IB1v8i86.js → share-preview-page-DbYZNAPb.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BtR4B0kn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CJNVOWoK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DcWDHrt3.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BxQ384RC.js → system-settings-panel-DKDAojWM.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BkcpvFYO.js → typed-models-lib-BCCV4Kkp.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-Cd0FaEQ4.js → use-channel-catalog-NBqg3iFY.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-DQ7NnRSY.js → user-profile-settings-panel-suQ2x-LB.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-YKhVf7Ka.js → utils-DPGVr3tS.js} +1 -1
- package/dist/gateway/static/root/assets/{vendor-codemirror-CNP1wPe7.js → vendor-codemirror-BvNgyE1Q.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-DaJASKFP.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-BrCZpAWh.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BTkRVNAh.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-start-dialog-BNJVCWoS.js → workflow-start-dialog-DAImVtdO.js} +1 -1
- package/dist/gateway/static/root/assets/workflows-page-vyJ8wSXm.js +18 -0
- package/dist/gateway/static/root/index.html +8 -7
- package/dist/package.js +1 -1
- package/dist/src/activity/context.d.ts +11 -0
- package/dist/src/activity/context.js +36 -0
- package/dist/src/activity/context.js.map +1 -0
- package/dist/src/activity/emitter.d.ts +6 -0
- package/dist/src/activity/emitter.js +43 -0
- package/dist/src/activity/emitter.js.map +1 -0
- package/dist/src/activity/index.d.ts +3 -0
- package/dist/src/activity/index.js +3 -0
- package/dist/src/activity/service.d.ts +12 -0
- package/dist/src/activity/service.js +59 -0
- package/dist/src/activity/service.js.map +1 -0
- package/dist/src/activity/types.d.ts +109 -0
- package/dist/src/activity/types.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +7 -0
- package/dist/src/agent/agent-manager.js +12 -5
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +2 -0
- package/dist/src/agent/child-agent-factory.js +2 -0
- package/dist/src/agent/child-agent-factory.js.map +1 -1
- package/dist/src/agent/coding/index.d.ts +1 -0
- package/dist/src/agent/coding/index.js +2 -0
- package/dist/src/agent/coding/turn-diff-tracker.d.ts +67 -0
- package/dist/src/agent/coding/turn-diff-tracker.js +233 -0
- package/dist/src/agent/coding/turn-diff-tracker.js.map +1 -0
- package/dist/src/agent/context/project-context.js +2 -2
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/dreaming/config.d.ts +2 -2
- package/dist/src/agent/memory/dreaming/config.js +3 -3
- package/dist/src/agent/memory/dreaming/config.js.map +1 -1
- package/dist/src/agent/memory/dreaming/constants.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/constants.js +1 -1
- package/dist/src/agent/memory/dreaming/constants.js.map +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +1 -0
- package/dist/src/agent/memory/dreaming/deep-promotion.js +11 -20
- package/dist/src/agent/memory/dreaming/deep-promotion.js.map +1 -1
- package/dist/src/agent/memory/dreaming/events.d.ts +3 -3
- package/dist/src/agent/memory/dreaming/events.js +6 -6
- package/dist/src/agent/memory/dreaming/events.js.map +1 -1
- package/dist/src/agent/memory/dreaming/last-run.d.ts +2 -2
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js.map +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +3 -3
- package/dist/src/agent/memory/dreaming/light-sweep.js.map +1 -1
- package/dist/src/agent/memory/dreaming/preview.d.ts +1 -0
- package/dist/src/agent/memory/dreaming/preview.js +2 -2
- package/dist/src/agent/memory/dreaming/preview.js.map +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +13 -13
- package/dist/src/agent/memory/dreaming/rem-patterns.js.map +1 -1
- package/dist/src/agent/memory/dreaming/scope.d.ts +14 -0
- package/dist/src/agent/memory/dreaming/scope.js +27 -0
- package/dist/src/agent/memory/dreaming/scope.js.map +1 -0
- package/dist/src/agent/memory/dreaming/short-term-store.d.ts +4 -4
- package/dist/src/agent/memory/dreaming/short-term-store.js +17 -17
- package/dist/src/agent/memory/dreaming/short-term-store.js.map +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +2 -0
- package/dist/src/agent/orchestration/agent-event-handler.js +13 -0
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +22 -12
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/sandbox/command-validator.js +12 -0
- package/dist/src/agent/sandbox/command-validator.js.map +1 -1
- package/dist/src/agent/service.d.ts +2 -1
- package/dist/src/agent/service.js +24 -9
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/service.types.d.ts +7 -0
- package/dist/src/agent/session/session-inspector.d.ts +5 -3
- package/dist/src/agent/session/session-inspector.js +17 -8
- package/dist/src/agent/session/session-inspector.js.map +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/source-context/types.d.ts +1 -1
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/source-context/types.js.map +1 -1
- package/dist/src/agent/tool-manuals/index.js +15 -6
- package/dist/src/agent/tool-manuals/index.js.map +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -0
- package/dist/src/agent/tool-manuals/xopc-use.js +204 -0
- package/dist/src/agent/tool-manuals/xopc-use.js.map +1 -0
- package/dist/src/agent/tools/apply-patch.js +116 -62
- package/dist/src/agent/tools/apply-patch.js.map +1 -1
- package/dist/src/agent/tools/concurrency.d.ts +8 -0
- package/dist/src/agent/tools/concurrency.js +31 -0
- package/dist/src/agent/tools/concurrency.js.map +1 -0
- package/dist/src/agent/tools/dreaming-tool.d.ts +2 -0
- package/dist/src/agent/tools/dreaming-tool.js +13 -10
- package/dist/src/agent/tools/dreaming-tool.js.map +1 -1
- package/dist/src/agent/tools/exec-command.js +4 -0
- package/dist/src/agent/tools/exec-command.js.map +1 -1
- package/dist/src/agent/tools/executor.d.ts +6 -4
- package/dist/src/agent/tools/executor.js +7 -4
- package/dist/src/agent/tools/executor.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +10 -0
- package/dist/src/agent/tools/factory.js +16 -1
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/find.js +2 -0
- package/dist/src/agent/tools/find.js.map +1 -1
- package/dist/src/agent/tools/goal-tool.js +2 -2
- package/dist/src/agent/tools/grep.js +2 -0
- package/dist/src/agent/tools/grep.js.map +1 -1
- package/dist/src/agent/tools/index.d.ts +3 -0
- package/dist/src/agent/tools/index.js +4 -1
- package/dist/src/agent/tools/list-dir.js +2 -0
- package/dist/src/agent/tools/list-dir.js.map +1 -1
- package/dist/src/agent/tools/memory-tool.d.ts +1 -0
- package/dist/src/agent/tools/memory-tool.js +2 -2
- package/dist/src/agent/tools/memory-tool.js.map +1 -1
- package/dist/src/agent/tools/metadata.d.ts +15 -0
- package/dist/src/agent/tools/metadata.js +26 -0
- package/dist/src/agent/tools/metadata.js.map +1 -0
- package/dist/src/agent/tools/read.js +2 -0
- package/dist/src/agent/tools/read.js.map +1 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -1
- package/dist/src/agent/tools/write.js +6 -0
- package/dist/src/agent/tools/write.js.map +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +34 -0
- package/dist/src/agent/tools/xopc-use-tool.js +636 -0
- package/dist/src/agent/tools/xopc-use-tool.js.map +1 -0
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +5 -1
- package/dist/src/agent/workflow/subagent-runner.js.map +1 -1
- package/dist/src/agent/workflow/workflow-child-tools.js +5 -0
- package/dist/src/agent/workflow/workflow-child-tools.js.map +1 -1
- package/dist/src/agent-manifest/schema.d.ts +27 -27
- package/dist/src/automations/api/routes.js +1 -1
- package/dist/src/automations/domain/validation.d.ts +55 -55
- package/dist/src/automations/draft/automation-draft-validator.d.ts +25 -25
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/browser/cdp-local-launcher.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +3 -3
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/browser/providers/playwright-doctor.js +1 -1
- package/dist/src/browser/stealth.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/chat-commands/builtins/goal.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +2 -2
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/goal.js +3 -3
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/project.js +4 -4
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/gateway-bind.js +1 -1
- package/dist/src/config/index.js +1 -1
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +14 -14
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +60 -60
- package/dist/src/connectors/health.d.ts +2 -1
- package/dist/src/connectors/health.js +59 -1
- package/dist/src/connectors/health.js.map +1 -1
- package/dist/src/connectors/install.d.ts +1 -0
- package/dist/src/connectors/install.js +28 -1
- package/dist/src/connectors/install.js.map +1 -1
- package/dist/src/connectors/instances.js +7 -0
- package/dist/src/connectors/instances.js.map +1 -1
- package/dist/src/connectors/materialize.js +2 -1
- package/dist/src/connectors/materialize.js.map +1 -1
- package/dist/src/connectors/registries/modelscope.js +38 -13
- package/dist/src/connectors/registries/modelscope.js.map +1 -1
- package/dist/src/connectors/types.d.ts +2 -0
- package/dist/src/daemon/launchd.js +1 -1
- package/dist/src/daemon/systemd.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +1 -0
- package/dist/src/gateway/dreaming-automation-reconciler.js +62 -42
- package/dist/src/gateway/dreaming-automation-reconciler.js.map +1 -1
- package/dist/src/gateway/hono/app.js +7 -1
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +14 -14
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/middleware/log-context.js +8 -1
- package/dist/src/gateway/hono/middleware/log-context.js.map +1 -1
- package/dist/src/gateway/hono/routes/activity.d.ts +14 -0
- package/dist/src/gateway/hono/routes/activity.js +72 -0
- package/dist/src/gateway/hono/routes/activity.js.map +1 -0
- package/dist/src/gateway/hono/routes/connectors.js +46 -2
- package/dist/src/gateway/hono/routes/connectors.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +111 -66
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/goals.js +1 -1
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/index.js.map +1 -1
- package/dist/src/gateway/hono/routes/memory.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +903 -50
- package/dist/src/gateway/hono/routes/projects.js.map +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +102 -2
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/ports.js +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +10 -0
- package/dist/src/gateway/service/sessions-api.js +31 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -1
- package/dist/src/gateway/service.js +28 -16
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/goals/goal-store.js +1 -1
- package/dist/src/goals/goal-store.js.map +1 -1
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/infra/ports.js +1 -1
- package/dist/src/infra/ssh-tunnel.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media/store.js +1 -1
- package/dist/src/media/store.js.map +1 -1
- package/dist/src/media/types.d.ts +1 -1
- package/dist/src/media/uri.js +2 -1
- package/dist/src/media/uri.js.map +1 -1
- package/dist/src/migrations/runner.js +1 -1
- package/dist/src/notes/service.js +65 -6
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/notes/store.js +1 -1
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +59 -2
- package/dist/src/projects/project-service.js.map +1 -1
- package/dist/src/projects/project-store.d.ts +2 -1
- package/dist/src/projects/project-store.js +43 -0
- package/dist/src/projects/project-store.js.map +1 -1
- package/dist/src/projects/types.d.ts +10 -0
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/session/client-history.d.ts +3 -0
- package/dist/src/session/client-history.js +24 -9
- package/dist/src/session/client-history.js.map +1 -1
- package/dist/src/session/init-session-turn.js +1 -1
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-context-for-llm.d.ts +2 -0
- package/dist/src/session/session-context-for-llm.js +14 -1
- package/dist/src/session/session-context-for-llm.js.map +1 -1
- package/dist/src/session/session-title.js +2 -2
- package/dist/src/session/store.js +3 -3
- package/dist/src/session/store.js.map +1 -1
- package/dist/src/session/types.d.ts +4 -0
- package/dist/src/session/types.js.map +1 -1
- package/dist/src/storage/sqlite/activity-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/activity-repository.js +208 -0
- package/dist/src/storage/sqlite/activity-repository.js.map +1 -0
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/022_work_items.sql +61 -0
- package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +15 -0
- package/dist/src/storage/sqlite/migrations/024_activity_events.sql +62 -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.js.map +1 -1
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/row-mappers.js +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +141 -0
- package/dist/src/storage/sqlite/session-repository.js +11 -0
- package/dist/src/storage/sqlite/session-repository.js.map +1 -1
- package/dist/src/tui/backends/embedded-backend.d.ts +13 -0
- package/dist/src/tui/backends/embedded-backend.js +76 -7
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/backends/gateway-sse-backend.d.ts +13 -0
- package/dist/src/tui/backends/gateway-sse-backend.js +53 -0
- package/dist/src/tui/backends/gateway-sse-backend.js.map +1 -1
- package/dist/src/tui/chat-history.js +16 -3
- package/dist/src/tui/chat-history.js.map +1 -1
- package/dist/src/tui/clipboard-image.js +1 -1
- package/dist/src/tui/components/assistant-message.js +12 -2
- package/dist/src/tui/components/assistant-message.js.map +1 -1
- package/dist/src/tui/components/chat-log.d.ts +23 -3
- package/dist/src/tui/components/chat-log.js +68 -9
- package/dist/src/tui/components/chat-log.js.map +1 -1
- package/dist/src/tui/components/tool-execution.d.ts +8 -0
- package/dist/src/tui/components/tool-execution.js +87 -77
- package/dist/src/tui/components/tool-execution.js.map +1 -1
- package/dist/src/tui/components/tui-bottom-bar.js +9 -5
- package/dist/src/tui/components/tui-bottom-bar.js.map +1 -1
- package/dist/src/tui/components/visual-truncate.d.ts +1 -0
- package/dist/src/tui/components/visual-truncate.js +28 -1
- package/dist/src/tui/components/visual-truncate.js.map +1 -1
- package/dist/src/tui/tool-summary.d.ts +22 -0
- package/dist/src/tui/tool-summary.js +212 -0
- package/dist/src/tui/tool-summary.js.map +1 -0
- package/dist/src/tui/tui-backend.d.ts +16 -0
- package/dist/src/tui/tui-command-formatters.js +2 -2
- package/dist/src/tui/tui-commands.d.ts +9 -0
- package/dist/src/tui/tui-commands.js +95 -6
- package/dist/src/tui/tui-commands.js.map +1 -1
- package/dist/src/tui/tui-picker-overlay.d.ts +1 -0
- package/dist/src/tui/tui-picker-overlay.js +36 -1
- package/dist/src/tui/tui-picker-overlay.js.map +1 -1
- package/dist/src/tui/tui-picker-services.d.ts +13 -0
- package/dist/src/tui/tui-run-state.js +11 -0
- package/dist/src/tui/tui-run-state.js.map +1 -1
- package/dist/src/tui/tui-run-status-format.d.ts +3 -0
- package/dist/src/tui/tui-run-status-format.js +33 -0
- package/dist/src/tui/tui-run-status-format.js.map +1 -0
- package/dist/src/tui/tui-session-actions.d.ts +5 -0
- package/dist/src/tui/tui-session-actions.js +24 -0
- package/dist/src/tui/tui-session-actions.js.map +1 -1
- package/dist/src/tui/tui-timeline-picker.d.ts +19 -0
- package/dist/src/tui/tui-timeline-picker.js +81 -0
- package/dist/src/tui/tui-timeline-picker.js.map +1 -0
- package/dist/src/tui/tui-timeline.d.ts +15 -0
- package/dist/src/tui/tui-timeline.js +65 -0
- package/dist/src/tui/tui-timeline.js.map +1 -0
- package/dist/src/tui/tui-tool-diff.d.ts +15 -0
- package/dist/src/tui/tui-tool-diff.js +178 -7
- package/dist/src/tui/tui-tool-diff.js.map +1 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui-types.js +1 -0
- package/dist/src/tui/tui-types.js.map +1 -1
- package/dist/src/tui/tui.js +31 -25
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +1 -1
- package/dist/src/utils/logger/stats.d.ts +3 -3
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/work-items/agent-context.d.ts +7 -0
- package/dist/src/work-items/agent-context.js +75 -0
- package/dist/src/work-items/agent-context.js.map +1 -0
- package/dist/src/work-items/index.d.ts +4 -0
- package/dist/src/work-items/index.js +4 -0
- package/dist/src/work-items/types.d.ts +112 -0
- package/dist/src/work-items/types.js +1 -0
- package/dist/src/work-items/work-item-service.d.ts +35 -0
- package/dist/src/work-items/work-item-service.js +277 -0
- package/dist/src/work-items/work-item-service.js.map +1 -0
- package/dist/src/work-items/work-item-store.d.ts +21 -0
- package/dist/src/work-items/work-item-store.js +302 -0
- package/dist/src/work-items/work-item-store.js.map +1 -0
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +4 -3
- package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +4 -1
- package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +0 -41
- package/dist/gateway/static/root/assets/agents-BjIxt67Z.js +0 -2
- package/dist/gateway/static/root/assets/app-management-settings-panel-CYCONLIL.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-Clw3ryKg.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-QICTeGjX.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-CU0-4nQ-.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Car-jtiz.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-CMeBJzlS.js +0 -8
- package/dist/gateway/static/root/assets/capability-presets-api-BmQTM9Il.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DZEJEoCF.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-kkW-xFau.js +0 -1
- package/dist/gateway/static/root/assets/code-editor-dZTY2dRW.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BvaQvO5F.js +0 -2
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +0 -1
- package/dist/gateway/static/root/assets/dist-wO9a2_ID.js +0 -1
- package/dist/gateway/static/root/assets/dreaming-settings-DnHO686d.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-BGLRuWVN.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-D978ePp9.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B6Ih4Swx.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CMEA3r5u.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-B-KHKeXN.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-BxrSoWdj.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-BTJzIl28.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-BJyEuLLm.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-wkOjYNQT.js +0 -1
- package/dist/gateway/static/root/assets/index-BLaXr6Ev.css +0 -1
- package/dist/gateway/static/root/assets/index-c_9TVr_C.js +0 -191
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BT8T4DyC.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CrxBJUgI.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-Dv66bO2b.js +0 -1
- package/dist/gateway/static/root/assets/messages-O6TAtdFC.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-DOOpz6y1.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-Br16pK9v.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-PSJAi0ZC.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-CIGGgKuw.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B2grhsBt.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CXMORxBD.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-Bi2wkBzU.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B1L3G4IA.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-BnqYMWHR.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BfRSHJmO.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-CdWZU1hd.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CWtPM7RK.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-ngbsBgij.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BIe442Gv.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BfchZRVa.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-C5Ov8Uk_.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BYD9BtOq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BYF29ANm.js +0 -18
package/dist/src/utils/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { getAsyncLogContext, inboundCorrelationMetadataFromAsyncLogContext, runWithLogContext, updateAsyncLogContext } from "./logger/context.js";
|
|
1
2
|
import { getLogDir, getLoggerConfig } from "./logger/config.js";
|
|
2
3
|
import { getRuntimeLogStats } from "./logger/stats.js";
|
|
3
4
|
import { flushAndClose, isLoggerShuttingDown, setShuttingDown } from "./logger/shutdown.js";
|
|
4
5
|
import { cleanOldLogs, rotateLogs } from "./logger/rotation.js";
|
|
5
|
-
import { getAsyncLogContext, inboundCorrelationMetadataFromAsyncLogContext, runWithLogContext, updateAsyncLogContext } from "./logger/context.js";
|
|
6
6
|
import { isLogRedactionEnabled, redactObject, redactPemBlock, redactSecret, redactSensitiveInfo } from "./logger/redact.js";
|
|
7
7
|
import { exportLog, flushExporters, getExporters, initializeExporters } from "./logger/exporters.js";
|
|
8
8
|
import { configureAuditLog, getAuditConfig, logAuditEvent, logAuthEvent, logConfigChange, logDataAccess, logPermissionChange } from "./logger/audit.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { PACKAGE_VERSION, init_package_version } from "../../package-version.js";
|
|
3
|
+
import { getAsyncLogContext, getAsyncLogCorrelationKeys, inboundCorrelationMetadataFromAsyncLogContext, init_context, mergeContext, runWithLogContext, updateAsyncLogContext } from "./context.js";
|
|
3
4
|
import { config, getLogDir, getLoggerConfig, init_config } from "./config.js";
|
|
4
5
|
import { init_streams, initializeStreams } from "./streams.js";
|
|
5
6
|
import { getRuntimeLogStats, incrementStats, init_stats } from "./stats.js";
|
|
6
7
|
import { flushAndClose, init_shutdown, isLoggerShuttingDown, setShuttingDown } from "./shutdown.js";
|
|
7
8
|
import { cleanOldLogs, init_rotation, rotateLogs } from "./rotation.js";
|
|
8
|
-
import { getAsyncLogContext, getAsyncLogCorrelationKeys, inboundCorrelationMetadataFromAsyncLogContext, init_context, mergeContext, runWithLogContext, updateAsyncLogContext } from "./context.js";
|
|
9
9
|
import { init_redact, isLogRedactionEnabled, redactLogRecord, redactObject, redactPemBlock, redactSecret, redactSensitiveInfo } from "./redact.js";
|
|
10
10
|
import { exportLog, flushExporters, getExporters, init_exporters, initializeExporters } from "./exporters.js";
|
|
11
11
|
import { configureAuditLog, getAuditConfig, init_audit, logAuditEvent, logAuthEvent, logConfigChange, logDataAccess, logPermissionChange } from "./audit.js";
|
|
@@ -12,13 +12,13 @@ export declare function incrementStats(level: LogLevel, module?: string): void;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function getRuntimeLogStats(): {
|
|
14
14
|
byLevel: {
|
|
15
|
-
error: number;
|
|
16
|
-
debug: number;
|
|
17
|
-
silent: number;
|
|
18
15
|
trace: number;
|
|
16
|
+
debug: number;
|
|
19
17
|
info: number;
|
|
20
18
|
warn: number;
|
|
19
|
+
error: number;
|
|
21
20
|
fatal: number;
|
|
21
|
+
silent: number;
|
|
22
22
|
};
|
|
23
23
|
byModule: {
|
|
24
24
|
[k: string]: number;
|
package/dist/src/utils/logger.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { getAsyncLogContext, inboundCorrelationMetadataFromAsyncLogContext, runWithLogContext, updateAsyncLogContext } from "./logger/context.js";
|
|
2
3
|
import { getLogDir, getLoggerConfig } from "./logger/config.js";
|
|
3
4
|
import { getRuntimeLogStats } from "./logger/stats.js";
|
|
4
5
|
import { flushAndClose, isLoggerShuttingDown, setShuttingDown } from "./logger/shutdown.js";
|
|
5
6
|
import { cleanOldLogs, rotateLogs } from "./logger/rotation.js";
|
|
6
|
-
import { getAsyncLogContext, inboundCorrelationMetadataFromAsyncLogContext, runWithLogContext, updateAsyncLogContext } from "./logger/context.js";
|
|
7
7
|
import { isLogRedactionEnabled, redactObject, redactPemBlock, redactSecret, redactSensitiveInfo } from "./logger/redact.js";
|
|
8
8
|
import { exportLog, flushExporters, getExporters, initializeExporters } from "./logger/exporters.js";
|
|
9
9
|
import { configureAuditLog, getAuditConfig, logAuditEvent, logAuthEvent, logConfigChange, logDataAccess, logPermissionChange } from "./logger/audit.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AgentSourceContext } from '../agent/source-context/types.js';
|
|
2
|
+
import type { MediaRef } from '../media/types.js';
|
|
3
|
+
import type { WorkItem } from './types.js';
|
|
4
|
+
export declare function buildWorkItemAgentContext(item: WorkItem, opts?: {
|
|
5
|
+
attachments?: readonly MediaRef[];
|
|
6
|
+
includeImages?: boolean;
|
|
7
|
+
}): Promise<AgentSourceContext>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readMediaReferenceBase64 } from "../media/media-reference.js";
|
|
2
|
+
//#region src/work-items/agent-context.ts
|
|
3
|
+
const MAX_NATIVE_VISION_IMAGES = 6;
|
|
4
|
+
const MAX_NATIVE_VISION_IMAGE_BYTES = 2 * 1024 * 1024;
|
|
5
|
+
function contextLine(label, value) {
|
|
6
|
+
if (value === void 0 || value === null) return null;
|
|
7
|
+
const text = String(value).trim();
|
|
8
|
+
return text ? `${label}: ${text}` : null;
|
|
9
|
+
}
|
|
10
|
+
async function loadWorkItemNativeVisionImages(item) {
|
|
11
|
+
const images = [];
|
|
12
|
+
for (const attachment of item.attachments ?? []) {
|
|
13
|
+
if (attachment.type !== "image") continue;
|
|
14
|
+
if (!attachment.mimeType.toLowerCase().startsWith("image/")) continue;
|
|
15
|
+
if (attachment.size > MAX_NATIVE_VISION_IMAGE_BYTES) continue;
|
|
16
|
+
try {
|
|
17
|
+
const loaded = await readMediaReferenceBase64(attachment.mediaUri, MAX_NATIVE_VISION_IMAGE_BYTES);
|
|
18
|
+
images.push({
|
|
19
|
+
type: "image",
|
|
20
|
+
data: loaded.data,
|
|
21
|
+
mimeType: attachment.mimeType || loaded.mimeType
|
|
22
|
+
});
|
|
23
|
+
if (images.length >= MAX_NATIVE_VISION_IMAGES) break;
|
|
24
|
+
} catch {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return images;
|
|
29
|
+
}
|
|
30
|
+
function renderAttachmentLines(item, refs) {
|
|
31
|
+
if (!item.attachments?.length) return "";
|
|
32
|
+
return item.attachments.slice(0, 12).map((attachment, index) => {
|
|
33
|
+
const ref = refs?.[index];
|
|
34
|
+
return [
|
|
35
|
+
`- ${ref?.name ?? attachment.fileName} (${ref?.mimeType ?? attachment.mimeType}, ${ref?.size ?? attachment.size} bytes)`,
|
|
36
|
+
` xopc-media-uri:${ref?.uri ?? attachment.mediaUri}`,
|
|
37
|
+
" Use the read_media tool with the xopc-media-uri value when you need to inspect this attachment."
|
|
38
|
+
].join("\n");
|
|
39
|
+
}).join("\n");
|
|
40
|
+
}
|
|
41
|
+
async function buildWorkItemAgentContext(item, opts = {}) {
|
|
42
|
+
const links = item.links?.length ? item.links.slice(0, 12).map((link) => `- ${link.kind}: ${link.title || link.targetId}${link.statusSnapshot ? ` (${link.statusSnapshot})` : ""}`).join("\n") : "";
|
|
43
|
+
const attachments = renderAttachmentLines(item, opts.attachments);
|
|
44
|
+
const images = opts.includeImages === false ? [] : await loadWorkItemNativeVisionImages(item);
|
|
45
|
+
const text = [
|
|
46
|
+
"You are working inside a project work item. Treat this as the active task context, not as a new user message.",
|
|
47
|
+
"",
|
|
48
|
+
contextLine("Work item id", item.id),
|
|
49
|
+
contextLine("Project id", item.projectId),
|
|
50
|
+
contextLine("Title", item.title),
|
|
51
|
+
contextLine("Status", item.status),
|
|
52
|
+
contextLine("Priority", item.priority),
|
|
53
|
+
contextLine("Owner agent", item.ownerAgentId),
|
|
54
|
+
contextLine("Description", item.description),
|
|
55
|
+
contextLine("Next action", item.nextAction),
|
|
56
|
+
contextLine("Blocked reason", item.blockedReason),
|
|
57
|
+
item.dueAt ? contextLine("Due at", new Date(item.dueAt).toISOString()) : null,
|
|
58
|
+
links ? `Linked executions:\n${links}` : null,
|
|
59
|
+
attachments ? `Attachments:\n${attachments}` : null,
|
|
60
|
+
"",
|
|
61
|
+
"When you answer, keep the work item moving. If the discussion changes scope, call out the suggested work item update explicitly."
|
|
62
|
+
].filter(Boolean).join("\n");
|
|
63
|
+
return {
|
|
64
|
+
kind: "work_item",
|
|
65
|
+
sourceId: item.id,
|
|
66
|
+
version: String(item.updatedAt),
|
|
67
|
+
title: item.title,
|
|
68
|
+
text,
|
|
69
|
+
...images.length ? { images } : {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { buildWorkItemAgentContext };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=agent-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context.js","names":[],"sources":["../../../src/work-items/agent-context.ts"],"sourcesContent":["import type { ImageContent } from '@earendil-works/pi-ai';\n\nimport type { AgentSourceContext } from '../agent/source-context/types.js';\nimport { readMediaReferenceBase64 } from '../media/media-reference.js';\nimport type { MediaRef } from '../media/types.js';\n\nimport type { WorkItem } from './types.js';\n\nconst MAX_NATIVE_VISION_IMAGES = 6;\nconst MAX_NATIVE_VISION_IMAGE_BYTES = 2 * 1024 * 1024;\n\nfunction contextLine(label: string, value: string | number | undefined | null): string | null {\n if (value === undefined || value === null) return null;\n const text = String(value).trim();\n return text ? `${label}: ${text}` : null;\n}\n\nasync function loadWorkItemNativeVisionImages(item: WorkItem): Promise<ImageContent[]> {\n const images: ImageContent[] = [];\n for (const attachment of item.attachments ?? []) {\n if (attachment.type !== 'image') continue;\n if (!attachment.mimeType.toLowerCase().startsWith('image/')) continue;\n if (attachment.size > MAX_NATIVE_VISION_IMAGE_BYTES) continue;\n try {\n const loaded = await readMediaReferenceBase64(attachment.mediaUri, MAX_NATIVE_VISION_IMAGE_BYTES);\n images.push({ type: 'image', data: loaded.data, mimeType: attachment.mimeType || loaded.mimeType });\n if (images.length >= MAX_NATIVE_VISION_IMAGES) break;\n } catch {\n continue;\n }\n }\n return images;\n}\n\nfunction renderAttachmentLines(item: WorkItem, refs?: readonly MediaRef[]): string {\n if (!item.attachments?.length) return '';\n return item.attachments\n .slice(0, 12)\n .map((attachment, index) => {\n const ref = refs?.[index];\n return [\n `- ${ref?.name ?? attachment.fileName} (${ref?.mimeType ?? attachment.mimeType}, ${ref?.size ?? attachment.size} bytes)`,\n ` xopc-media-uri:${ref?.uri ?? attachment.mediaUri}`,\n ' Use the read_media tool with the xopc-media-uri value when you need to inspect this attachment.',\n ].join('\\n');\n })\n .join('\\n');\n}\n\nexport async function buildWorkItemAgentContext(\n item: WorkItem,\n opts: { attachments?: readonly MediaRef[]; includeImages?: boolean } = {},\n): Promise<AgentSourceContext> {\n const links = item.links?.length\n ? item.links\n .slice(0, 12)\n .map((link) => `- ${link.kind}: ${link.title || link.targetId}${link.statusSnapshot ? ` (${link.statusSnapshot})` : ''}`)\n .join('\\n')\n : '';\n const attachments = renderAttachmentLines(item, opts.attachments);\n const images = opts.includeImages === false ? [] : await loadWorkItemNativeVisionImages(item);\n const text = [\n 'You are working inside a project work item. Treat this as the active task context, not as a new user message.',\n '',\n contextLine('Work item id', item.id),\n contextLine('Project id', item.projectId),\n contextLine('Title', item.title),\n contextLine('Status', item.status),\n contextLine('Priority', item.priority),\n contextLine('Owner agent', item.ownerAgentId),\n contextLine('Description', item.description),\n contextLine('Next action', item.nextAction),\n contextLine('Blocked reason', item.blockedReason),\n item.dueAt ? contextLine('Due at', new Date(item.dueAt).toISOString()) : null,\n links ? `Linked executions:\\n${links}` : null,\n attachments ? `Attachments:\\n${attachments}` : null,\n '',\n 'When you answer, keep the work item moving. If the discussion changes scope, call out the suggested work item update explicitly.',\n ].filter(Boolean).join('\\n');\n\n return {\n kind: 'work_item',\n sourceId: item.id,\n version: String(item.updatedAt),\n title: item.title,\n text,\n ...(images.length ? { images } : {}),\n };\n}\n"],"mappings":";;AAQA,MAAM,2BAA2B;AACjC,MAAM,gCAAgC,IAAI,OAAO;AAEjD,SAAS,YAAY,OAAe,OAA0D;AAC5F,KAAI,UAAU,KAAA,KAAa,UAAU,KAAM,QAAO;CAClD,MAAM,OAAO,OAAO,MAAM,CAAC,MAAM;AACjC,QAAO,OAAO,GAAG,MAAM,IAAI,SAAS;;AAGtC,eAAe,+BAA+B,MAAyC;CACrF,MAAM,SAAyB,EAAE;AACjC,MAAK,MAAM,cAAc,KAAK,eAAe,EAAE,EAAE;AAC/C,MAAI,WAAW,SAAS,QAAS;AACjC,MAAI,CAAC,WAAW,SAAS,aAAa,CAAC,WAAW,SAAS,CAAE;AAC7D,MAAI,WAAW,OAAO,8BAA+B;AACrD,MAAI;GACF,MAAM,SAAS,MAAM,yBAAyB,WAAW,UAAU,8BAA8B;AACjG,UAAO,KAAK;IAAE,MAAM;IAAS,MAAM,OAAO;IAAM,UAAU,WAAW,YAAY,OAAO;IAAU,CAAC;AACnG,OAAI,OAAO,UAAU,yBAA0B;UACzC;AACN;;;AAGJ,QAAO;;AAGT,SAAS,sBAAsB,MAAgB,MAAoC;AACjF,KAAI,CAAC,KAAK,aAAa,OAAQ,QAAO;AACtC,QAAO,KAAK,YACT,MAAM,GAAG,GAAG,CACZ,KAAK,YAAY,UAAU;EAC1B,MAAM,MAAM,OAAO;AACnB,SAAO;GACL,K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WorkItemService, WORK_ITEM_ATTACHMENT_MAX_BYTES, WORK_ITEM_ATTACHMENT_MAX_COUNT, WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES, } from './work-item-service.js';
|
|
2
|
+
export { WorkItemStore } from './work-item-store.js';
|
|
3
|
+
export { buildWorkItemAgentContext } from './agent-context.js';
|
|
4
|
+
export type * from './types.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { WorkItemStore } from "./work-item-store.js";
|
|
2
|
+
import { WORK_ITEM_ATTACHMENT_MAX_BYTES, WORK_ITEM_ATTACHMENT_MAX_COUNT, WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES, WorkItemService } from "./work-item-service.js";
|
|
3
|
+
import { buildWorkItemAgentContext } from "./agent-context.js";
|
|
4
|
+
export { WORK_ITEM_ATTACHMENT_MAX_BYTES, WORK_ITEM_ATTACHMENT_MAX_COUNT, WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES, WorkItemService, WorkItemStore, buildWorkItemAgentContext };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export type WorkItemStatus = 'backlog' | 'todo' | 'in_progress' | 'blocked' | 'needs_input' | 'in_review' | 'done' | 'cancelled';
|
|
2
|
+
export type WorkItemPriority = 'urgent' | 'high' | 'normal' | 'low';
|
|
3
|
+
export type WorkItemLinkKind = 'chat' | 'goal' | 'workflow_run' | 'automation' | 'note';
|
|
4
|
+
export type WorkItemEventType = 'created' | 'updated' | 'status_changed' | 'archived' | 'attachment_added' | 'attachment_removed' | 'chat_started' | 'goal_created' | 'workflow_started' | 'automation_added' | 'link_added' | 'progress_note_added' | 'update_suggestion_created' | 'update_suggestion_applied' | 'update_suggestion_dismissed';
|
|
5
|
+
export type WorkItemUpdateSuggestionStatus = 'pending' | 'applied' | 'dismissed';
|
|
6
|
+
export type WorkItemUpdateSuggestionSourceKind = 'chat' | 'goal' | 'workflow_run' | 'automation';
|
|
7
|
+
export interface WorkItem {
|
|
8
|
+
id: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
status: WorkItemStatus;
|
|
13
|
+
priority: WorkItemPriority;
|
|
14
|
+
ownerAgentId?: string;
|
|
15
|
+
nextAction?: string;
|
|
16
|
+
blockedReason?: string;
|
|
17
|
+
dueAt?: number;
|
|
18
|
+
completedAt?: number;
|
|
19
|
+
archivedAt?: number;
|
|
20
|
+
createdAt: number;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
links?: WorkItemLink[];
|
|
23
|
+
attachments?: WorkItemAttachment[];
|
|
24
|
+
}
|
|
25
|
+
export interface WorkItemAttachment {
|
|
26
|
+
id: string;
|
|
27
|
+
workItemId: string;
|
|
28
|
+
mediaUri: string;
|
|
29
|
+
mediaId: string;
|
|
30
|
+
bucket: string;
|
|
31
|
+
type: 'image' | 'audio' | 'video' | 'file';
|
|
32
|
+
mimeType: string;
|
|
33
|
+
fileName: string;
|
|
34
|
+
size: number;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
}
|
|
37
|
+
export interface WorkItemLink {
|
|
38
|
+
id: string;
|
|
39
|
+
workItemId: string;
|
|
40
|
+
kind: WorkItemLinkKind;
|
|
41
|
+
targetId: string;
|
|
42
|
+
title?: string;
|
|
43
|
+
statusSnapshot?: string;
|
|
44
|
+
createdAt: number;
|
|
45
|
+
}
|
|
46
|
+
export interface WorkItemEvent {
|
|
47
|
+
id: string;
|
|
48
|
+
workItemId: string;
|
|
49
|
+
type: WorkItemEventType;
|
|
50
|
+
payload?: unknown;
|
|
51
|
+
createdAt: number;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkItemUpdateSuggestion {
|
|
54
|
+
id: string;
|
|
55
|
+
workItemId: string;
|
|
56
|
+
sourceKind: WorkItemUpdateSuggestionSourceKind;
|
|
57
|
+
sourceId: string;
|
|
58
|
+
status: WorkItemUpdateSuggestionStatus;
|
|
59
|
+
patch: Pick<UpdateWorkItemInput, 'status' | 'nextAction' | 'blockedReason'>;
|
|
60
|
+
progressNote?: string;
|
|
61
|
+
rationale?: string;
|
|
62
|
+
confidence?: number;
|
|
63
|
+
createdAt: number;
|
|
64
|
+
appliedAt?: number;
|
|
65
|
+
dismissedAt?: number;
|
|
66
|
+
}
|
|
67
|
+
export interface CreateWorkItemUpdateSuggestionInput {
|
|
68
|
+
sourceKind: WorkItemUpdateSuggestionSourceKind;
|
|
69
|
+
sourceId: string;
|
|
70
|
+
patch?: Pick<UpdateWorkItemInput, 'status' | 'nextAction' | 'blockedReason'>;
|
|
71
|
+
progressNote?: string;
|
|
72
|
+
rationale?: string;
|
|
73
|
+
confidence?: number;
|
|
74
|
+
}
|
|
75
|
+
export interface WorkItemListQuery {
|
|
76
|
+
status?: WorkItemStatus | WorkItemStatus[];
|
|
77
|
+
priority?: WorkItemPriority | WorkItemPriority[];
|
|
78
|
+
includeArchived?: boolean;
|
|
79
|
+
search?: string;
|
|
80
|
+
sortBy?: 'updatedAt' | 'createdAt' | 'priority' | 'status';
|
|
81
|
+
sortOrder?: 'asc' | 'desc';
|
|
82
|
+
limit?: number;
|
|
83
|
+
offset?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface WorkItemListResult {
|
|
86
|
+
items: WorkItem[];
|
|
87
|
+
total: number;
|
|
88
|
+
limit: number;
|
|
89
|
+
offset: number;
|
|
90
|
+
hasMore: boolean;
|
|
91
|
+
}
|
|
92
|
+
export interface CreateWorkItemInput {
|
|
93
|
+
title: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
status?: WorkItemStatus;
|
|
96
|
+
priority?: WorkItemPriority;
|
|
97
|
+
ownerAgentId?: string;
|
|
98
|
+
nextAction?: string;
|
|
99
|
+
blockedReason?: string;
|
|
100
|
+
dueAt?: number;
|
|
101
|
+
}
|
|
102
|
+
export interface UpdateWorkItemInput {
|
|
103
|
+
title?: string;
|
|
104
|
+
description?: string | null;
|
|
105
|
+
status?: WorkItemStatus;
|
|
106
|
+
priority?: WorkItemPriority;
|
|
107
|
+
ownerAgentId?: string | null;
|
|
108
|
+
nextAction?: string | null;
|
|
109
|
+
blockedReason?: string | null;
|
|
110
|
+
dueAt?: number | null;
|
|
111
|
+
archivedAt?: number | null;
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MediaRef } from '../media/types.js';
|
|
2
|
+
import { WorkItemStore } from './work-item-store.js';
|
|
3
|
+
import type { CreateWorkItemUpdateSuggestionInput, CreateWorkItemInput, UpdateWorkItemInput, WorkItem, WorkItemAttachment, WorkItemEvent, WorkItemLink, WorkItemListQuery, WorkItemListResult, WorkItemUpdateSuggestion, WorkItemUpdateSuggestionStatus } from './types.js';
|
|
4
|
+
export declare const WORK_ITEM_ATTACHMENT_MAX_BYTES: number;
|
|
5
|
+
export declare const WORK_ITEM_ATTACHMENT_MAX_COUNT = 10;
|
|
6
|
+
export declare const WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES: number;
|
|
7
|
+
export declare class WorkItemService {
|
|
8
|
+
private readonly store;
|
|
9
|
+
constructor(store?: WorkItemStore);
|
|
10
|
+
listProjectWorkItems(projectId: string, query?: WorkItemListQuery): WorkItemListResult;
|
|
11
|
+
createProjectWorkItem(projectId: string, input: CreateWorkItemInput): WorkItem;
|
|
12
|
+
getWorkItem(id: string): WorkItem | null;
|
|
13
|
+
updateWorkItem(id: string, patch: UpdateWorkItemInput): WorkItem | null;
|
|
14
|
+
addLink(workItemId: string, input: Omit<WorkItemLink, 'id' | 'workItemId' | 'createdAt'>, eventType?: Parameters<WorkItemStore['addEvent']>[1]): WorkItemLink | null;
|
|
15
|
+
listEvents(workItemId: string): WorkItemEvent[];
|
|
16
|
+
listAttachments(workItemId: string): WorkItemAttachment[] | null;
|
|
17
|
+
addAttachment(workItemId: string, file: {
|
|
18
|
+
name: string;
|
|
19
|
+
buffer: Buffer;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
}): Promise<WorkItemAttachment | null>;
|
|
22
|
+
readAttachment(workItemId: string, attachmentId: string): Promise<{
|
|
23
|
+
attachment: WorkItemAttachment;
|
|
24
|
+
buffer: Buffer;
|
|
25
|
+
} | null>;
|
|
26
|
+
removeAttachment(workItemId: string, attachmentId: string): Promise<WorkItemAttachment | null>;
|
|
27
|
+
snapshotAttachmentsForGoal(workItemId: string): Promise<MediaRef[] | null>;
|
|
28
|
+
createUpdateSuggestion(workItemId: string, input: CreateWorkItemUpdateSuggestionInput): WorkItemUpdateSuggestion | null;
|
|
29
|
+
listUpdateSuggestions(workItemId: string, status?: WorkItemUpdateSuggestionStatus): WorkItemUpdateSuggestion[];
|
|
30
|
+
applyUpdateSuggestion(id: string): {
|
|
31
|
+
item: WorkItem;
|
|
32
|
+
suggestion: WorkItemUpdateSuggestion;
|
|
33
|
+
} | null;
|
|
34
|
+
dismissUpdateSuggestion(id: string): WorkItemUpdateSuggestion | null;
|
|
35
|
+
}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { changedFieldsFromPatch, emitActivity, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
|
|
2
|
+
import { deleteMediaBuffer, mimeTypeFromMediaPath, saveMediaBuffer } from "../media/store.js";
|
|
3
|
+
import { readMediaReference } from "../media/media-reference.js";
|
|
4
|
+
import { WorkItemStore } from "./work-item-store.js";
|
|
5
|
+
//#region src/work-items/work-item-service.ts
|
|
6
|
+
const WORK_ITEM_ATTACHMENT_MAX_BYTES = 25 * 1024 * 1024;
|
|
7
|
+
const WORK_ITEM_ATTACHMENT_MAX_COUNT = 10;
|
|
8
|
+
const WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES = WORK_ITEM_ATTACHMENT_MAX_BYTES * 10 + 1024 * 1024;
|
|
9
|
+
function inferAttachmentType(mimeType) {
|
|
10
|
+
if (mimeType.startsWith("image/")) return "image";
|
|
11
|
+
if (mimeType.startsWith("audio/")) return "audio";
|
|
12
|
+
if (mimeType.startsWith("video/")) return "video";
|
|
13
|
+
return "file";
|
|
14
|
+
}
|
|
15
|
+
function attachmentTypeForMediaRef(attachment) {
|
|
16
|
+
return attachment.type === "file" ? "document" : attachment.type;
|
|
17
|
+
}
|
|
18
|
+
var WorkItemService = class {
|
|
19
|
+
constructor(store = new WorkItemStore()) {
|
|
20
|
+
this.store = store;
|
|
21
|
+
}
|
|
22
|
+
listProjectWorkItems(projectId, query = {}) {
|
|
23
|
+
return this.store.list(projectId, query);
|
|
24
|
+
}
|
|
25
|
+
createProjectWorkItem(projectId, input) {
|
|
26
|
+
const item = this.store.create(projectId, input);
|
|
27
|
+
this.store.addEvent(item.id, "created", {
|
|
28
|
+
title: item.title,
|
|
29
|
+
status: item.status,
|
|
30
|
+
priority: item.priority
|
|
31
|
+
});
|
|
32
|
+
emitActivity({
|
|
33
|
+
type: "work_item.created",
|
|
34
|
+
primaryObject: {
|
|
35
|
+
kind: "work_item",
|
|
36
|
+
id: item.id,
|
|
37
|
+
title: item.title
|
|
38
|
+
},
|
|
39
|
+
actor: systemActivityActor(),
|
|
40
|
+
source: systemActivitySource(),
|
|
41
|
+
payload: {
|
|
42
|
+
title: item.title,
|
|
43
|
+
status: item.status,
|
|
44
|
+
priority: item.priority
|
|
45
|
+
},
|
|
46
|
+
scopes: [{
|
|
47
|
+
scopeKind: "project",
|
|
48
|
+
scopeId: projectId,
|
|
49
|
+
reason: "object_owner"
|
|
50
|
+
}],
|
|
51
|
+
nowMs: item.createdAt
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
...item,
|
|
55
|
+
links: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
getWorkItem(id) {
|
|
59
|
+
return this.store.get(id);
|
|
60
|
+
}
|
|
61
|
+
updateWorkItem(id, patch) {
|
|
62
|
+
const before = this.store.get(id);
|
|
63
|
+
if (!before) return null;
|
|
64
|
+
const after = this.store.update(id, patch);
|
|
65
|
+
if (!after) return null;
|
|
66
|
+
if (before.status !== after.status) this.store.addEvent(id, "status_changed", {
|
|
67
|
+
from: before.status,
|
|
68
|
+
to: after.status
|
|
69
|
+
});
|
|
70
|
+
else this.store.addEvent(id, "updated", patch);
|
|
71
|
+
if (!before.archivedAt && after.archivedAt) this.store.addEvent(id, "archived", { archivedAt: after.archivedAt });
|
|
72
|
+
const type = !before.archivedAt && after.archivedAt ? "work_item.archived" : before.status !== after.status ? "work_item.status_changed" : "work_item.updated";
|
|
73
|
+
emitActivity({
|
|
74
|
+
type,
|
|
75
|
+
primaryObject: {
|
|
76
|
+
kind: "work_item",
|
|
77
|
+
id: after.id,
|
|
78
|
+
title: after.title
|
|
79
|
+
},
|
|
80
|
+
actor: systemActivityActor(),
|
|
81
|
+
source: systemActivitySource(),
|
|
82
|
+
payload: {
|
|
83
|
+
changes: changedFieldsFromPatch(patch),
|
|
84
|
+
...type === "work_item.status_changed" ? {
|
|
85
|
+
from: before.status,
|
|
86
|
+
to: after.status
|
|
87
|
+
} : {},
|
|
88
|
+
...type === "work_item.archived" ? { archivedAt: after.archivedAt } : {}
|
|
89
|
+
},
|
|
90
|
+
scopes: [{
|
|
91
|
+
scopeKind: "project",
|
|
92
|
+
scopeId: after.projectId,
|
|
93
|
+
reason: "object_owner"
|
|
94
|
+
}],
|
|
95
|
+
nowMs: after.updatedAt
|
|
96
|
+
});
|
|
97
|
+
return after;
|
|
98
|
+
}
|
|
99
|
+
addLink(workItemId, input, eventType = "link_added") {
|
|
100
|
+
if (!this.store.get(workItemId)) return null;
|
|
101
|
+
const link = this.store.addLink({
|
|
102
|
+
...input,
|
|
103
|
+
workItemId
|
|
104
|
+
});
|
|
105
|
+
this.store.addEvent(workItemId, eventType, {
|
|
106
|
+
kind: link.kind,
|
|
107
|
+
targetId: link.targetId,
|
|
108
|
+
title: link.title,
|
|
109
|
+
statusSnapshot: link.statusSnapshot
|
|
110
|
+
});
|
|
111
|
+
const item = this.store.get(workItemId);
|
|
112
|
+
if (item) emitActivity({
|
|
113
|
+
type: "work_item.link_added",
|
|
114
|
+
primaryObject: {
|
|
115
|
+
kind: "work_item",
|
|
116
|
+
id: item.id,
|
|
117
|
+
title: item.title
|
|
118
|
+
},
|
|
119
|
+
actor: systemActivityActor(),
|
|
120
|
+
source: systemActivitySource(),
|
|
121
|
+
payload: { target: {
|
|
122
|
+
kind: link.kind,
|
|
123
|
+
id: link.targetId,
|
|
124
|
+
title: link.title
|
|
125
|
+
} },
|
|
126
|
+
scopes: [{
|
|
127
|
+
scopeKind: "project",
|
|
128
|
+
scopeId: item.projectId,
|
|
129
|
+
reason: "object_owner"
|
|
130
|
+
}],
|
|
131
|
+
nowMs: link.createdAt
|
|
132
|
+
});
|
|
133
|
+
return link;
|
|
134
|
+
}
|
|
135
|
+
listEvents(workItemId) {
|
|
136
|
+
return this.store.listEvents(workItemId);
|
|
137
|
+
}
|
|
138
|
+
listAttachments(workItemId) {
|
|
139
|
+
if (!this.store.get(workItemId)) return null;
|
|
140
|
+
return this.store.listAttachments(workItemId);
|
|
141
|
+
}
|
|
142
|
+
async addAttachment(workItemId, file) {
|
|
143
|
+
if (!this.store.get(workItemId)) return null;
|
|
144
|
+
const saved = await saveMediaBuffer(file.buffer, {
|
|
145
|
+
bucket: "work-item",
|
|
146
|
+
contentType: file.mimeType,
|
|
147
|
+
maxBytes: WORK_ITEM_ATTACHMENT_MAX_BYTES,
|
|
148
|
+
originalFilename: file.name
|
|
149
|
+
});
|
|
150
|
+
const mimeType = saved.contentType || file.mimeType || mimeTypeFromMediaPath(saved.path);
|
|
151
|
+
const attachment = this.store.addAttachment({
|
|
152
|
+
workItemId,
|
|
153
|
+
mediaUri: saved.uri,
|
|
154
|
+
mediaId: saved.id,
|
|
155
|
+
bucket: saved.bucket,
|
|
156
|
+
type: inferAttachmentType(mimeType),
|
|
157
|
+
mimeType,
|
|
158
|
+
fileName: file.name.trim() || saved.id,
|
|
159
|
+
size: saved.size
|
|
160
|
+
});
|
|
161
|
+
this.store.addEvent(workItemId, "attachment_added", {
|
|
162
|
+
attachmentId: attachment.id,
|
|
163
|
+
fileName: attachment.fileName,
|
|
164
|
+
mimeType: attachment.mimeType,
|
|
165
|
+
size: attachment.size
|
|
166
|
+
});
|
|
167
|
+
return attachment;
|
|
168
|
+
}
|
|
169
|
+
async readAttachment(workItemId, attachmentId) {
|
|
170
|
+
const attachment = this.store.getAttachment(workItemId, attachmentId);
|
|
171
|
+
if (!attachment) return null;
|
|
172
|
+
const { buffer } = await readMediaReference(attachment.mediaUri, WORK_ITEM_ATTACHMENT_MAX_BYTES);
|
|
173
|
+
return {
|
|
174
|
+
attachment,
|
|
175
|
+
buffer
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
async removeAttachment(workItemId, attachmentId) {
|
|
179
|
+
const attachment = this.store.removeAttachment(workItemId, attachmentId);
|
|
180
|
+
if (!attachment) return null;
|
|
181
|
+
await deleteMediaBuffer(attachment.mediaId, "work-item");
|
|
182
|
+
this.store.addEvent(workItemId, "attachment_removed", {
|
|
183
|
+
attachmentId: attachment.id,
|
|
184
|
+
fileName: attachment.fileName,
|
|
185
|
+
mimeType: attachment.mimeType,
|
|
186
|
+
size: attachment.size
|
|
187
|
+
});
|
|
188
|
+
return attachment;
|
|
189
|
+
}
|
|
190
|
+
async snapshotAttachmentsForGoal(workItemId) {
|
|
191
|
+
const item = this.store.get(workItemId);
|
|
192
|
+
if (!item) return null;
|
|
193
|
+
const refs = [];
|
|
194
|
+
for (const attachment of item.attachments ?? []) {
|
|
195
|
+
const { buffer } = await readMediaReference(attachment.mediaUri, WORK_ITEM_ATTACHMENT_MAX_BYTES);
|
|
196
|
+
const saved = await saveMediaBuffer(buffer, {
|
|
197
|
+
bucket: "inbound",
|
|
198
|
+
contentType: attachment.mimeType,
|
|
199
|
+
maxBytes: WORK_ITEM_ATTACHMENT_MAX_BYTES,
|
|
200
|
+
originalFilename: attachment.fileName
|
|
201
|
+
});
|
|
202
|
+
refs.push({
|
|
203
|
+
id: saved.id,
|
|
204
|
+
bucket: saved.bucket,
|
|
205
|
+
type: attachmentTypeForMediaRef(attachment),
|
|
206
|
+
mimeType: saved.contentType || attachment.mimeType,
|
|
207
|
+
name: attachment.fileName,
|
|
208
|
+
size: saved.size,
|
|
209
|
+
uri: saved.uri,
|
|
210
|
+
path: saved.path
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
return refs;
|
|
214
|
+
}
|
|
215
|
+
createUpdateSuggestion(workItemId, input) {
|
|
216
|
+
const suggestion = this.store.createUpdateSuggestion(workItemId, input);
|
|
217
|
+
if (!suggestion) return null;
|
|
218
|
+
this.store.addEvent(workItemId, "update_suggestion_created", {
|
|
219
|
+
suggestionId: suggestion.id,
|
|
220
|
+
sourceKind: suggestion.sourceKind,
|
|
221
|
+
sourceId: suggestion.sourceId,
|
|
222
|
+
patch: suggestion.patch,
|
|
223
|
+
hasProgressNote: Boolean(suggestion.progressNote)
|
|
224
|
+
});
|
|
225
|
+
return suggestion;
|
|
226
|
+
}
|
|
227
|
+
listUpdateSuggestions(workItemId, status) {
|
|
228
|
+
return this.store.listUpdateSuggestions(workItemId, status);
|
|
229
|
+
}
|
|
230
|
+
applyUpdateSuggestion(id) {
|
|
231
|
+
const suggestion = this.store.getUpdateSuggestion(id);
|
|
232
|
+
if (!suggestion || suggestion.status !== "pending") return null;
|
|
233
|
+
const before = this.store.get(suggestion.workItemId);
|
|
234
|
+
if (!before) return null;
|
|
235
|
+
const patch = {};
|
|
236
|
+
if (suggestion.patch.status !== void 0) patch.status = suggestion.patch.status;
|
|
237
|
+
if (suggestion.patch.nextAction !== void 0) patch.nextAction = suggestion.patch.nextAction;
|
|
238
|
+
if (suggestion.patch.blockedReason !== void 0) patch.blockedReason = suggestion.patch.blockedReason;
|
|
239
|
+
const item = Object.keys(patch).length > 0 ? this.updateWorkItem(suggestion.workItemId, patch) : before;
|
|
240
|
+
if (!item) return null;
|
|
241
|
+
if (suggestion.progressNote) this.store.addEvent(suggestion.workItemId, "progress_note_added", {
|
|
242
|
+
sourceKind: suggestion.sourceKind,
|
|
243
|
+
sourceId: suggestion.sourceId,
|
|
244
|
+
suggestionId: suggestion.id,
|
|
245
|
+
text: suggestion.progressNote
|
|
246
|
+
});
|
|
247
|
+
const marked = this.store.markUpdateSuggestion(id, "applied");
|
|
248
|
+
if (!marked) return null;
|
|
249
|
+
this.store.addEvent(suggestion.workItemId, "update_suggestion_applied", {
|
|
250
|
+
suggestionId: suggestion.id,
|
|
251
|
+
sourceKind: suggestion.sourceKind,
|
|
252
|
+
sourceId: suggestion.sourceId,
|
|
253
|
+
patch,
|
|
254
|
+
previousStatus: before.status,
|
|
255
|
+
nextStatus: item.status
|
|
256
|
+
});
|
|
257
|
+
return {
|
|
258
|
+
item,
|
|
259
|
+
suggestion: marked
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
dismissUpdateSuggestion(id) {
|
|
263
|
+
const suggestion = this.store.getUpdateSuggestion(id);
|
|
264
|
+
if (!suggestion || suggestion.status !== "pending") return null;
|
|
265
|
+
const marked = this.store.markUpdateSuggestion(id, "dismissed");
|
|
266
|
+
if (marked) this.store.addEvent(marked.workItemId, "update_suggestion_dismissed", {
|
|
267
|
+
suggestionId: marked.id,
|
|
268
|
+
sourceKind: marked.sourceKind,
|
|
269
|
+
sourceId: marked.sourceId
|
|
270
|
+
});
|
|
271
|
+
return marked;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
export { WORK_ITEM_ATTACHMENT_MAX_BYTES, WORK_ITEM_ATTACHMENT_MAX_COUNT, WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES, WorkItemService };
|
|
276
|
+
|
|
277
|
+
//# sourceMappingURL=work-item-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work-item-service.js","names":[],"sources":["../../../src/work-items/work-item-service.ts"],"sourcesContent":["import { changedFieldsFromPatch, emitActivity, systemActivityActor, systemActivitySource } from '../activity/emitter.js';\nimport { deleteMediaBuffer, mimeTypeFromMediaPath, saveMediaBuffer } from '../media/store.js';\nimport { readMediaReference } from '../media/media-reference.js';\nimport type { MediaRef } from '../media/types.js';\nimport { WorkItemStore } from './work-item-store.js';\nimport type {\n CreateWorkItemUpdateSuggestionInput,\n CreateWorkItemInput,\n UpdateWorkItemInput,\n WorkItem,\n WorkItemAttachment,\n WorkItemEvent,\n WorkItemLink,\n WorkItemListQuery,\n WorkItemListResult,\n WorkItemUpdateSuggestion,\n WorkItemUpdateSuggestionStatus,\n} from './types.js';\n\nexport const WORK_ITEM_ATTACHMENT_MAX_BYTES = 25 * 1024 * 1024;\nexport const WORK_ITEM_ATTACHMENT_MAX_COUNT = 10;\nexport const WORK_ITEM_ATTACHMENT_UPLOAD_BODY_MAX_BYTES =\n WORK_ITEM_ATTACHMENT_MAX_BYTES * WORK_ITEM_ATTACHMENT_MAX_COUNT + 1024 * 1024;\n\nfunction inferAttachmentType(mimeType: string): WorkItemAttachment['type'] {\n if (mimeType.startsWith('image/')) return 'image';\n if (mimeType.startsWith('audio/')) return 'audio';\n if (mimeType.startsWith('video/')) return 'video';\n return 'file';\n}\n\nfunction attachmentTypeForMediaRef(attachment: WorkItemAttachment): string {\n return attachment.type === 'file' ? 'document' : attachment.type;\n}\n\nexport class WorkItemService {\n constructor(private readonly store = new WorkItemStore()) {}\n\n listProjectWorkItems(projectId: string, query: WorkItemListQuery = {}): WorkItemListResult {\n return this.store.list(projectId, query);\n }\n\n createProjectWorkItem(projectId: string, input: CreateWorkItemInput): WorkItem {\n const item = this.store.create(projectId, input);\n this.store.addEvent(item.id, 'created', { title: item.title, status: item.status, priority: item.priority });\n emitActivity({\n type: 'work_item.created',\n primaryObject: { kind: 'work_item', id: item.id, title: item.title },\n actor: systemActivityActor(),\n source: systemActivitySource(),\n payload: { title: item.title, status: item.status, priority: item.priority },\n scopes: [{ scopeKind: 'project', scopeId: projectId, reason: 'object_owner' }],\n nowMs: item.createdAt,\n });\n return { ...item, links: [] };\n }\n\n getWorkItem(id: string): WorkItem | null {\n return this.store.get(id);\n }\n\n updateWorkItem(id: string, patch: UpdateWorkItemInput): WorkItem | null {\n const before = this.store.get(id);\n if (!before) return null;\n const after = this.store.update(id, patch);\n if (!after) return null;\n if (before.status !== after.status) {\n this.store.addEvent(id, 'status_changed', { from: before.status, to: after.status });\n } else {\n this.store.addEvent(id, 'updated', patch);\n }\n if (!before.archivedAt && after.archivedAt) {\n this.store.addEvent(id, 'archived', { archivedAt: after.archivedAt });\n }\n const type = !before.archivedAt && after.archivedAt\n ? 'work_item.archived'\n : before.status !== after.status\n ? 'work_item.status_changed'\n : 'work_item.updated';\n emitActivity({\n type,\n primaryObject: { kind: 'work_item', id: after.id, title: after.title },\n actor: systemActivityActor(),\n source: systemActivitySource(),\n payload: {\n changes: changedFieldsFromPatch(patch as Record<string, unknown>),\n ...(type === 'work_item.status_changed' ? { from: before.status, to: after.status } : {}),\n ...(type === 'work_item.archived' ? { archivedAt: after.archivedAt } : {}),\n },\n scopes: [{ scopeKind: 'project', scopeId: after.projectId, reason: 'object_owner' }],\n nowMs: after.updatedAt,\n });\n return after;\n }\n\n addLink(workItemId: string, input: Omit<WorkItemLink, 'id' | 'workItemId' | 'createdAt'>, eventType: Parameters<WorkItemStore['addEvent']>[1] = 'link_added'): WorkItemLink | null {\n if (!this.store.get(workItemId)) return null;\n const link = this.store.addLink({ ...input, workItemId });\n this.store.addEvent(workItemId, eventType, { kind: link.kind, targetId: link.targetId, title: link.title, statusSnapshot: link.statusSnapshot });\n const item = this.store.get(workItemId);\n if (item) {\n emitActivity({\n type: 'work_item.link_added',\n primaryObject: { kind: 'work_item', id: item.id, title: item.title },\n actor: systemActivityActor(),\n source: systemActivitySource(),\n payload: { target: { kind: link.kind, id: link.targetId, title: link.title } },\n scopes: [{ scopeKind: 'project', scopeId: item.projectId, reason: 'object_owner' }],\n nowMs: link.createdAt,\n });\n }\n return link;\n }\n\n listEvents(workItemId: string): WorkItemEvent[] {\n return this.store.listEvents(workItemId);\n }\n\n listAttachments(workItemId: string): WorkItemAttachment[] | null {\n if (!this.store.get(workItemId)) return null;\n return this.store.listAttachments(workItemId);\n }\n\n async addAttachment(\n workItemId: string,\n file: { name: string; buffer: Buffer; mimeType: string },\n ): Promise<WorkItemAttachment | null> {\n if (!this.store.get(workItemId)) return null;\n const saved = await saveMediaBuffer(file.buffer, {\n bucket: 'work-item',\n contentType: file.mimeType,\n maxBytes: WORK_ITEM_ATTACHMENT_MAX_BYTES,\n originalFilename: file.name,\n });\n const mimeType = saved.contentType || file.mimeType || mimeTypeFromMediaPath(saved.path);\n const attachment = this.store.addAttachment({\n workItemId,\n mediaUri: saved.uri,\n mediaId: saved.id,\n bucket: saved.bucket,\n type: inferAttachmentType(mimeType),\n mimeType,\n fileName: file.name.trim() || saved.id,\n size: saved.size,\n });\n this.store.addEvent(workItemId, 'attachment_added', {\n attachmentId: attachment.id,\n fileName: attachment.fileName,\n mimeType: attachment.mimeType,\n size: attachment.size,\n });\n return attachment;\n }\n\n async readAttachment(\n workItemId: string,\n attachmentId: string,\n ): Promise<{ attachment: WorkItemAttachment; buffer: Buffer } | null> {\n const attachment = this.store.getAttachment(workItemId, attachmentId);\n if (!attachment) return null;\n const { buffer } = await readMediaReference(attachment.mediaUri, WORK_ITEM_ATTACHMENT_MAX_BYTES);\n return { attachment, buffer };\n }\n\n async removeAttachment(workItemId: string, attachmentId: string): Promise<WorkItemAttachment | null> {\n const attachment = this.store.removeAttachment(workItemId, attachmentId);\n if (!attachment) return null;\n await deleteMediaBuffer(attachment.mediaId, 'work-item');\n this.store.addEvent(workItemId, 'attachment_removed', {\n attachmentId: attachment.id,\n fileName: attachment.fileName,\n mimeType: attachment.mimeType,\n size: attachment.size,\n });\n return attachment;\n }\n\n async snapshotAttachmentsForGoal(workItemId: string): Promise<MediaRef[] | null> {\n const item = this.store.get(workItemId);\n if (!item) return null;\n const refs: MediaRef[] = [];\n for (const attachment of item.attachments ?? []) {\n const { buffer } = await readMediaReference(attachment.mediaUri, WORK_ITEM_ATTACHMENT_MAX_BYTES);\n const saved = await saveMediaBuffer(buffer, {\n bucket: 'inbound',\n contentType: attachment.mimeType,\n maxBytes: WORK_ITEM_ATTACHMENT_MAX_BYTES,\n originalFilename: attachment.fileName,\n });\n refs.push({\n id: saved.id,\n bucket: saved.bucket,\n type: attachmentTypeForMediaRef(attachment),\n mimeType: saved.contentType || attachment.mimeType,\n name: attachment.fileName,\n size: saved.size,\n uri: saved.uri,\n path: saved.path,\n });\n }\n return refs;\n }\n\n createUpdateSuggestion(workItemId: string, input: CreateWorkItemUpdateSuggestionInput): WorkItemUpdateSuggestion | null {\n const suggestion = this.store.createUpdateSuggestion(workItemId, input);\n if (!suggestion) return null;\n this.store.addEvent(workItemId, 'update_suggestion_created', {\n suggestionId: suggestion.id,\n sourceKind: suggestion.sourceKind,\n sourceId: suggestion.sourceId,\n patch: suggestion.patch,\n hasProgressNote: Boolean(suggestion.progressNote),\n });\n return suggestion;\n }\n\n listUpdateSuggestions(workItemId: string, status?: WorkItemUpdateSuggestionStatus): WorkItemUpdateSuggestion[] {\n return this.store.listUpdateSuggestions(workItemId, status);\n }\n\n applyUpdateSuggestion(id: string): { item: WorkItem; suggestion: WorkItemUpdateSuggestion } | null {\n const suggestion = this.store.getUpdateSuggestion(id);\n if (!suggestion || suggestion.status !== 'pending') return null;\n const before = this.store.get(suggestion.workItemId);\n if (!before) return null;\n const patch: UpdateWorkItemInput = {};\n if (suggestion.patch.status !== undefined) patch.status = suggestion.patch.status;\n if (suggestion.patch.nextAction !== undefined) patch.nextAction = suggestion.patch.nextAction;\n if (suggestion.patch.blockedReason !== undefined) patch.blockedReason = suggestion.patch.blockedReason;\n const item = Object.keys(patch).length > 0\n ? this.updateWorkItem(suggestion.workItemId, patch)\n : before;\n if (!item) return null;\n if (suggestion.progressNote) {\n this.store.addEvent(suggestion.workItemId, 'progress_note_added', {\n sourceKind: suggestion.sourceKind,\n sourceId: suggestion.sourceId,\n suggestionId: suggestion.id,\n text: suggestion.progressNote,\n });\n }\n const marked = this.store.markUpdateSuggestion(id, 'applied');\n if (!marked) return null;\n this.store.addEvent(suggestion.workItemId, 'update_suggestion_applied', {\n suggestionId: suggestion.id,\n sourceKind: suggestion.sourceKind,\n sourceId: suggestion.sourceId,\n patch,\n previousStatus: before.status,\n nextStatus: item.status,\n });\n return { item, suggestion: marked };\n }\n\n dismissUpdateSuggestion(id: string): WorkItemUpdateSuggestion | null {\n const suggestion = this.store.getUpdateSuggestion(id);\n if (!suggestion || suggestion.status !== 'pending') return null;\n const marked = this.store.markUpdateSuggestion(id, 'dismissed');\n if (marked) {\n this.store.addEvent(marked.workItemId, 'update_suggestion_dismissed', {\n suggestionId: marked.id,\n sourceKind: marked.sourceKind,\n sourceId: marked.sourceId,\n });\n }\n return marked;\n }\n}\n"],"mappings":";;;;;AAmBA,MAAa,iCAAiC,KAAK,OAAO;AAC1D,MAAa,iCAAiC;AAC9C,MAAa,6CACX,iCAAA,KAAkE,OAAO;AAE3E,SAAS,oBAAoB,UAA8C;AACzE,KAAI,SAAS,WAAW,SAAS,CAAE,QAAO;AAC1C,KAAI,SAAS,WAAW,SAAS,CAAE,QAAO;AAC1C,KAAI,SAAS,WAAW,SAAS,CAAE,QAAO;AAC1C,QAAO;;AAGT,SAAS,0BAA0B,YAAwC;AACzE,QAAO,WAAW,SAAS,SAAS,aAAa,WAAW;;AAG9D,IAAa,kBAAb,MAA6B;CAC3B,YAAY,QAAyB,IAAI,eAAe,EAAE;AAA7B,OAAA,QAAA;;CAE7B,qBAAqB,WAAmB,QAA2B,EAAE,EAAsB;AACzF,SAAO,KAAK,MAAM,KAAK,WAAW,MAAM;;CAG1C,sBAAsB,WAAmB,OAAsC;EAC7E,MAAM,OAAO,KAAK,MAAM,OAAO,WAAW,MAAM;AAChD,OAAK,MAAM,SAAS,KAAK,IAAI,WAAW;GAAE,OAAO,KAAK;GAAO,QAAQ,KAAK;GAAQ,UAAU,KAAK;GAAU,CAAC;AAC5G,eAAa;GACX,MAAM;GAC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KAAK,MAAM,qBAAqB,IAAI,UAAU;AAC7D,MAAI,CAAC,OAAQ,QAAO;AACpB,OAAK,MAAM,SAAS,WAAW,YAAY,6BAA6B;GACtE,cAAc,WAAW;GACzB,YAAY,WAAW;GACvB,UAAU,WAAW;GACrB;GACA,gBAAgB,OAAO;GACvB,YAAY,KAAK;GAClB,CAAC;AACF,SAAO;GAAE;GAAM,YAAY;GAAQ;;CAGrC,wBAAwB,IAA6C;EACnE,MAAM,aAAa,KAAK,MAAM,oBAAoB,GAAG;AACrD,MAAI,CAAC,cAAc,WAAW,WAAW,UAAW,QAAO;EAC3D,MAAM,SAAS,KAAK,MAAM,qBAAqB,IAAI,YAAY;AAC/D,MAAI,OACF,MAAK,MAAM,SAAS,OAAO,YAAY,+BAA+B;GACpE,cAAc,OAAO;GACrB,YAAY,OAAO;GACnB,UAAU,OAAO;GAClB,CAAC;AAEJ,SAAO"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CreateWorkItemUpdateSuggestionInput, CreateWorkItemInput, UpdateWorkItemInput, WorkItem, WorkItemAttachment, WorkItemEvent, WorkItemEventType, WorkItemLink, WorkItemListQuery, WorkItemListResult, WorkItemUpdateSuggestion, WorkItemUpdateSuggestionStatus } from './types.js';
|
|
2
|
+
export declare class WorkItemStore {
|
|
3
|
+
create(projectId: string, input: CreateWorkItemInput): WorkItem;
|
|
4
|
+
get(id: string): WorkItem | null;
|
|
5
|
+
list(projectId: string, query?: WorkItemListQuery): WorkItemListResult;
|
|
6
|
+
update(id: string, patch: UpdateWorkItemInput): WorkItem | null;
|
|
7
|
+
addLink(input: Omit<WorkItemLink, 'id' | 'createdAt'>): WorkItemLink;
|
|
8
|
+
listLinks(workItemId: string): WorkItemLink[];
|
|
9
|
+
listLinksForItems(workItemIds: string[]): Map<string, WorkItemLink[]>;
|
|
10
|
+
addAttachment(input: Omit<WorkItemAttachment, 'id' | 'createdAt'>): WorkItemAttachment;
|
|
11
|
+
getAttachment(workItemId: string, attachmentId: string): WorkItemAttachment | null;
|
|
12
|
+
listAttachments(workItemId: string): WorkItemAttachment[];
|
|
13
|
+
listAttachmentsForItems(workItemIds: string[]): Map<string, WorkItemAttachment[]>;
|
|
14
|
+
removeAttachment(workItemId: string, attachmentId: string): WorkItemAttachment | null;
|
|
15
|
+
addEvent(workItemId: string, type: WorkItemEventType, payload?: unknown): WorkItemEvent;
|
|
16
|
+
listEvents(workItemId: string): WorkItemEvent[];
|
|
17
|
+
createUpdateSuggestion(workItemId: string, input: CreateWorkItemUpdateSuggestionInput): WorkItemUpdateSuggestion | null;
|
|
18
|
+
getUpdateSuggestion(id: string): WorkItemUpdateSuggestion | null;
|
|
19
|
+
listUpdateSuggestions(workItemId: string, status?: WorkItemUpdateSuggestionStatus): WorkItemUpdateSuggestion[];
|
|
20
|
+
markUpdateSuggestion(id: string, status: Extract<WorkItemUpdateSuggestionStatus, 'applied' | 'dismissed'>): WorkItemUpdateSuggestion | null;
|
|
21
|
+
}
|