@pixelbyte-software/pixcode 1.54.11 → 1.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/server/claude-sdk.js +1 -1
- package/dist-server/server/claude-sdk.js.map +1 -1
- package/dist-server/server/index.js +6 -11
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/modules/security/permission-policy.js.map +1 -0
- package/dist-server/server/modules/tasks/git-worktree.js +98 -0
- package/dist-server/server/modules/tasks/git-worktree.js.map +1 -0
- package/dist-server/server/modules/tasks/index.js +8 -0
- package/dist-server/server/modules/tasks/index.js.map +1 -0
- package/dist-server/server/modules/tasks/prompt-builder.js +85 -0
- package/dist-server/server/modules/tasks/prompt-builder.js.map +1 -0
- package/dist-server/server/modules/tasks/role-presets.js +94 -0
- package/dist-server/server/modules/tasks/role-presets.js.map +1 -0
- package/dist-server/server/modules/tasks/runners/claude-runner.js +109 -0
- package/dist-server/server/modules/tasks/runners/claude-runner.js.map +1 -0
- package/dist-server/server/modules/tasks/runners/codex-runner.js +67 -0
- package/dist-server/server/modules/tasks/runners/codex-runner.js.map +1 -0
- package/dist-server/server/modules/tasks/runners/spawn-runner.js +111 -0
- package/dist-server/server/modules/tasks/runners/spawn-runner.js.map +1 -0
- package/dist-server/server/modules/tasks/runners/types.js +5 -0
- package/dist-server/server/modules/tasks/runners/types.js.map +1 -0
- package/dist-server/server/modules/tasks/scheduler.js +69 -0
- package/dist-server/server/modules/tasks/scheduler.js.map +1 -0
- package/dist-server/server/modules/tasks/task-queue.js +81 -0
- package/dist-server/server/modules/tasks/task-queue.js.map +1 -0
- package/dist-server/server/modules/tasks/task-routes.js +195 -0
- package/dist-server/server/modules/tasks/task-routes.js.map +1 -0
- package/dist-server/server/modules/tasks/task-runner.js +187 -0
- package/dist-server/server/modules/tasks/task-runner.js.map +1 -0
- package/dist-server/server/modules/tasks/task-store.js +196 -0
- package/dist-server/server/modules/tasks/task-store.js.map +1 -0
- package/dist-server/server/modules/tasks/task-types.js +5 -0
- package/dist-server/server/modules/tasks/task-types.js.map +1 -0
- package/dist-server/server/modules/tasks/user-interaction.js +73 -0
- package/dist-server/server/modules/tasks/user-interaction.js.map +1 -0
- package/dist-server/server/services/control-room.js +9 -1
- package/dist-server/server/services/control-room.js.map +1 -1
- package/dist-server/server/services/public-api-manifest.js +5 -5
- package/dist-server/server/services/public-api-manifest.js.map +1 -1
- package/dist-server/server/services/telegram/control-center.js +10 -10
- package/dist-server/server/services/telegram/control-center.js.map +1 -1
- package/dist-server/server/services/telegram/telegram-gateway.js +2 -2
- package/dist-server/server/services/telegram/telegram-gateway.js.map +1 -1
- package/dist-server/server/services/telegram/translations.js +5 -5
- package/dist-server/server/services/telegram/translations.js.map +1 -1
- package/package.json +1 -1
- package/server/claude-sdk.js +1 -1
- package/server/index.js +6 -23
- package/server/modules/tasks/git-worktree.ts +102 -0
- package/server/modules/tasks/index.ts +9 -0
- package/server/modules/tasks/prompt-builder.ts +98 -0
- package/server/modules/tasks/role-presets.ts +113 -0
- package/server/modules/tasks/runners/claude-runner.ts +120 -0
- package/server/modules/tasks/runners/codex-runner.ts +80 -0
- package/server/modules/tasks/runners/spawn-runner.ts +122 -0
- package/server/modules/tasks/runners/types.ts +25 -0
- package/server/modules/tasks/scheduler.ts +75 -0
- package/server/modules/tasks/task-queue.ts +91 -0
- package/server/modules/tasks/task-routes.ts +245 -0
- package/server/modules/tasks/task-runner.ts +219 -0
- package/server/modules/tasks/task-store.ts +223 -0
- package/server/modules/tasks/task-types.ts +100 -0
- package/server/modules/tasks/user-interaction.ts +93 -0
- package/server/services/control-room.js +10 -1
- package/server/services/public-api-manifest.js +5 -5
- package/server/services/telegram/control-center.js +10 -10
- package/server/services/telegram/telegram-gateway.js +2 -2
- package/server/services/telegram/translations.js +5 -5
- package/dist/api-automation.html +0 -110
- package/dist/api-docs.html +0 -548
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/index-Bcqs_1vc.js +0 -877
- package/dist/assets/index-Dz1luE0u.css +0 -32
- package/dist/assets/index-ak1p_4ew.js +0 -11
- package/dist/assets/localMonaco-DFIbtDNp.js +0 -1
- package/dist/assets/vendor-codemirror-CIYNS698.js +0 -41
- package/dist/assets/vendor-react-DB6V5Fl1.js +0 -59
- package/dist/assets/vendor-xterm-C7tpxJl7.js +0 -9
- package/dist/clear-cache.html +0 -85
- package/dist/convert-icons.md +0 -53
- package/dist/docs.html +0 -308
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +0 -8
- package/dist/features.html +0 -133
- package/dist/generate-icons.js +0 -49
- package/dist/humans.txt +0 -15
- package/dist/icons/claude-ai-icon.svg +0 -1
- package/dist/icons/codex-white.svg +0 -3
- package/dist/icons/codex.svg +0 -3
- package/dist/icons/cursor-white.svg +0 -12
- package/dist/icons/cursor.svg +0 -1
- package/dist/icons/gemini-ai-icon.svg +0 -1
- package/dist/icons/icon-128x128.png +0 -0
- package/dist/icons/icon-128x128.svg +0 -9
- package/dist/icons/icon-144x144.png +0 -0
- package/dist/icons/icon-144x144.svg +0 -9
- package/dist/icons/icon-152x152.png +0 -0
- package/dist/icons/icon-152x152.svg +0 -9
- package/dist/icons/icon-192x192.png +0 -0
- package/dist/icons/icon-192x192.svg +0 -9
- package/dist/icons/icon-384x384.png +0 -0
- package/dist/icons/icon-384x384.svg +0 -9
- package/dist/icons/icon-512x512.png +0 -0
- package/dist/icons/icon-512x512.svg +0 -9
- package/dist/icons/icon-72x72.png +0 -0
- package/dist/icons/icon-72x72.svg +0 -9
- package/dist/icons/icon-96x96.png +0 -0
- package/dist/icons/icon-96x96.svg +0 -9
- package/dist/icons/icon-template.svg +0 -9
- package/dist/icons/opencode-logo-dark.svg +0 -1
- package/dist/icons/opencode-logo-light.svg +0 -1
- package/dist/icons/qwen-ai-icon.png +0 -0
- package/dist/icons/qwen-logo.svg +0 -15
- package/dist/index.html +0 -62
- package/dist/landing.html +0 -268
- package/dist/llms-full.txt +0 -119
- package/dist/llms.txt +0 -53
- package/dist/logo-128.png +0 -0
- package/dist/logo-256.png +0 -0
- package/dist/logo-32.png +0 -0
- package/dist/logo-512.png +0 -0
- package/dist/logo-64.png +0 -0
- package/dist/logo.png +0 -0
- package/dist/logo.svg +0 -12
- package/dist/manifest.json +0 -61
- package/dist/openapi.yaml +0 -1696
- package/dist/orchestration.html +0 -125
- package/dist/robots.txt +0 -4
- package/dist/screenshots/cli-selection.png +0 -0
- package/dist/screenshots/desktop-main.png +0 -0
- package/dist/screenshots/mobile-chat.png +0 -0
- package/dist/screenshots/tools-modal.png +0 -0
- package/dist/site.css +0 -692
- package/dist/sitemap.xml +0 -51
- package/dist/sw.js +0 -132
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js +0 -73
- package/dist-server/server/modules/orchestration/a2a/adapter-registry.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js +0 -17
- package/dist-server/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js +0 -236
- package/dist-server/server/modules/orchestration/a2a/adapters/claude-code.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js +0 -202
- package/dist-server/server/modules/orchestration/a2a/adapters/codex.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js +0 -205
- package/dist-server/server/modules/orchestration/a2a/adapters/cursor.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js +0 -205
- package/dist-server/server/modules/orchestration/a2a/adapters/gemini.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.js +0 -84
- package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.test.js +0 -43
- package/dist-server/server/modules/orchestration/a2a/adapters/json-event.adapter.test.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js +0 -205
- package/dist-server/server/modules/orchestration/a2a/adapters/opencode.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js +0 -205
- package/dist-server/server/modules/orchestration/a2a/adapters/qwen.adapter.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/agent-card.js +0 -50
- package/dist-server/server/modules/orchestration/a2a/agent-card.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/auth.middleware.js +0 -25
- package/dist-server/server/modules/orchestration/a2a/auth.middleware.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/bus.js +0 -34
- package/dist-server/server/modules/orchestration/a2a/bus.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/routes.js +0 -502
- package/dist-server/server/modules/orchestration/a2a/routes.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/task-dispatcher.js +0 -295
- package/dist-server/server/modules/orchestration/a2a/task-dispatcher.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/task-store.js +0 -144
- package/dist-server/server/modules/orchestration/a2a/task-store.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/types.js +0 -6
- package/dist-server/server/modules/orchestration/a2a/types.js.map +0 -1
- package/dist-server/server/modules/orchestration/a2a/validator.js +0 -101
- package/dist-server/server/modules/orchestration/a2a/validator.js.map +0 -1
- package/dist-server/server/modules/orchestration/index.js +0 -27
- package/dist-server/server/modules/orchestration/index.js.map +0 -1
- package/dist-server/server/modules/orchestration/preview/port-watcher.js +0 -90
- package/dist-server/server/modules/orchestration/preview/port-watcher.js.map +0 -1
- package/dist-server/server/modules/orchestration/preview/preview-proxy.js +0 -58
- package/dist-server/server/modules/orchestration/preview/preview-proxy.js.map +0 -1
- package/dist-server/server/modules/orchestration/preview/types.js +0 -2
- package/dist-server/server/modules/orchestration/preview/types.js.map +0 -1
- package/dist-server/server/modules/orchestration/security/permission-policy.js.map +0 -1
- package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js +0 -34
- package/dist-server/server/modules/orchestration/tasks/orchestration-task-store.js.map +0 -1
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js +0 -70
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.routes.js.map +0 -1
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js +0 -181
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.service.js.map +0 -1
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js +0 -2
- package/dist-server/server/modules/orchestration/tasks/orchestration-task.types.js.map +0 -1
- package/dist-server/server/modules/orchestration/tasks/task-run-graph.js +0 -100
- package/dist-server/server/modules/orchestration/tasks/task-run-graph.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/approval-queue.js +0 -72
- package/dist-server/server/modules/orchestration/workflows/approval-queue.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js +0 -126
- package/dist-server/server/modules/orchestration/workflows/built-in-workflows.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/context-packet.js +0 -89
- package/dist-server/server/modules/orchestration/workflows/context-packet.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/handoff-artifact.js +0 -123
- package/dist-server/server/modules/orchestration/workflows/handoff-artifact.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-fallback-policy.js +0 -114
- package/dist-server/server/modules/orchestration/workflows/workflow-fallback-policy.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-replay.js +0 -177
- package/dist-server/server/modules/orchestration/workflows/workflow-replay.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-runner.js +0 -1718
- package/dist-server/server/modules/orchestration/workflows/workflow-runner.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-store.js +0 -76
- package/dist-server/server/modules/orchestration/workflows/workflow-store.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-templates.js +0 -242
- package/dist-server/server/modules/orchestration/workflows/workflow-templates.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow-trace.js +0 -388
- package/dist-server/server/modules/orchestration/workflows/workflow-trace.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow.routes.js +0 -508
- package/dist-server/server/modules/orchestration/workflows/workflow.routes.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workflow.types.js +0 -2
- package/dist-server/server/modules/orchestration/workflows/workflow.types.js.map +0 -1
- package/dist-server/server/modules/orchestration/workflows/workspace-target.js +0 -100
- package/dist-server/server/modules/orchestration/workflows/workspace-target.js.map +0 -1
- package/dist-server/server/modules/orchestration/workspace/docker-workspace.js +0 -123
- package/dist-server/server/modules/orchestration/workspace/docker-workspace.js.map +0 -1
- package/dist-server/server/modules/orchestration/workspace/path-safety.js +0 -48
- package/dist-server/server/modules/orchestration/workspace/path-safety.js.map +0 -1
- package/dist-server/server/modules/orchestration/workspace/types.js +0 -11
- package/dist-server/server/modules/orchestration/workspace/types.js.map +0 -1
- package/dist-server/server/modules/orchestration/workspace/workspace-manager.js +0 -84
- package/dist-server/server/modules/orchestration/workspace/workspace-manager.js.map +0 -1
- package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js +0 -97
- package/dist-server/server/modules/orchestration/workspace/worktree-workspace.js.map +0 -1
- package/server/modules/orchestration/a2a/adapter-registry.ts +0 -108
- package/server/modules/orchestration/a2a/adapters/abstract-a2a.adapter.ts +0 -63
- package/server/modules/orchestration/a2a/adapters/claude-code.adapter.ts +0 -286
- package/server/modules/orchestration/a2a/adapters/codex.adapter.ts +0 -244
- package/server/modules/orchestration/a2a/adapters/cursor.adapter.ts +0 -249
- package/server/modules/orchestration/a2a/adapters/gemini.adapter.ts +0 -248
- package/server/modules/orchestration/a2a/adapters/json-event.adapter.test.ts +0 -60
- package/server/modules/orchestration/a2a/adapters/json-event.adapter.ts +0 -101
- package/server/modules/orchestration/a2a/adapters/opencode.adapter.ts +0 -248
- package/server/modules/orchestration/a2a/adapters/qwen.adapter.ts +0 -248
- package/server/modules/orchestration/a2a/agent-card.ts +0 -55
- package/server/modules/orchestration/a2a/auth.middleware.ts +0 -29
- package/server/modules/orchestration/a2a/bus.ts +0 -46
- package/server/modules/orchestration/a2a/routes.ts +0 -586
- package/server/modules/orchestration/a2a/task-dispatcher.ts +0 -345
- package/server/modules/orchestration/a2a/task-store.ts +0 -178
- package/server/modules/orchestration/a2a/types.ts +0 -126
- package/server/modules/orchestration/a2a/validator.ts +0 -113
- package/server/modules/orchestration/index.ts +0 -99
- package/server/modules/orchestration/preview/port-watcher.ts +0 -112
- package/server/modules/orchestration/preview/preview-proxy.ts +0 -60
- package/server/modules/orchestration/preview/types.ts +0 -19
- package/server/modules/orchestration/tasks/orchestration-task-store.ts +0 -41
- package/server/modules/orchestration/tasks/orchestration-task.routes.ts +0 -81
- package/server/modules/orchestration/tasks/orchestration-task.service.ts +0 -201
- package/server/modules/orchestration/tasks/orchestration-task.types.ts +0 -40
- package/server/modules/orchestration/tasks/task-run-graph.ts +0 -155
- package/server/modules/orchestration/workflows/approval-queue.ts +0 -106
- package/server/modules/orchestration/workflows/built-in-workflows.ts +0 -127
- package/server/modules/orchestration/workflows/context-packet.ts +0 -186
- package/server/modules/orchestration/workflows/handoff-artifact.ts +0 -175
- package/server/modules/orchestration/workflows/workflow-fallback-policy.ts +0 -161
- package/server/modules/orchestration/workflows/workflow-replay.ts +0 -254
- package/server/modules/orchestration/workflows/workflow-runner.ts +0 -2062
- package/server/modules/orchestration/workflows/workflow-store.ts +0 -97
- package/server/modules/orchestration/workflows/workflow-templates.ts +0 -272
- package/server/modules/orchestration/workflows/workflow-trace.ts +0 -424
- package/server/modules/orchestration/workflows/workflow.routes.ts +0 -586
- package/server/modules/orchestration/workflows/workflow.types.ts +0 -111
- package/server/modules/orchestration/workflows/workspace-target.ts +0 -122
- package/server/modules/orchestration/workspace/docker-workspace.ts +0 -136
- package/server/modules/orchestration/workspace/path-safety.ts +0 -55
- package/server/modules/orchestration/workspace/types.ts +0 -52
- package/server/modules/orchestration/workspace/workspace-manager.ts +0 -102
- package/server/modules/orchestration/workspace/worktree-workspace.ts +0 -126
- /package/dist-server/server/modules/{orchestration/security → security}/permission-policy.js +0 -0
- /package/server/modules/{orchestration/security → security}/permission-policy.ts +0 -0
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import crypto from 'node:crypto';
|
|
2
|
-
|
|
3
|
-
import { adapterRegistry } from '@/modules/orchestration/a2a/adapter-registry.js';
|
|
4
|
-
import { a2aBus } from '@/modules/orchestration/a2a/bus.js';
|
|
5
|
-
import { a2aTaskStore } from '@/modules/orchestration/a2a/task-store.js';
|
|
6
|
-
import type {
|
|
7
|
-
BusEvent,
|
|
8
|
-
Message,
|
|
9
|
-
SubmitTaskInput,
|
|
10
|
-
Task,
|
|
11
|
-
TaskState,
|
|
12
|
-
} from '@/modules/orchestration/a2a/types.js';
|
|
13
|
-
import type { TaskHandle } from '@/modules/orchestration/a2a/adapters/abstract-a2a.adapter.js';
|
|
14
|
-
import { portWatcher } from '@/modules/orchestration/preview/port-watcher.js';
|
|
15
|
-
import type { PreviewArtifactData } from '@/modules/orchestration/preview/types.js';
|
|
16
|
-
import {
|
|
17
|
-
type PermissionPolicy,
|
|
18
|
-
type PermissionPolicyContext,
|
|
19
|
-
} from '@/modules/orchestration/security/permission-policy.js';
|
|
20
|
-
import { workspaceManager } from '@/modules/orchestration/workspace/workspace-manager.js';
|
|
21
|
-
import type {
|
|
22
|
-
WorkspaceHandle,
|
|
23
|
-
WorkspaceKind,
|
|
24
|
-
WorkspaceMetadata,
|
|
25
|
-
} from '@/modules/orchestration/workspace/types.js';
|
|
26
|
-
import { WorkspaceError } from '@/modules/orchestration/workspace/types.js';
|
|
27
|
-
|
|
28
|
-
type RoutingHints = {
|
|
29
|
-
preferredAdapterId?: string;
|
|
30
|
-
preferredProvider?: string;
|
|
31
|
-
preferredSkillId?: string;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const TERMINAL: TaskState[] = ['completed', 'canceled', 'failed'];
|
|
35
|
-
const MAX_TASKS = 1000;
|
|
36
|
-
const activeWorkspaces = new Map<string, WorkspaceHandle>();
|
|
37
|
-
const activeHandles = new Map<string, TaskHandle>();
|
|
38
|
-
const previewStops = new Map<string, () => void>();
|
|
39
|
-
const taskUnsubs = new Map<string, () => void>();
|
|
40
|
-
const finalizingTasks = new Set<string>();
|
|
41
|
-
|
|
42
|
-
function newId(prefix: string): string {
|
|
43
|
-
return `${prefix}_${crypto.randomBytes(8).toString('hex')}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function isTerminalTaskState(state: TaskState): boolean {
|
|
47
|
-
return TERMINAL.includes(state);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function readRoutingHints(value: unknown): RoutingHints {
|
|
51
|
-
if (!value || typeof value !== 'object') {
|
|
52
|
-
return {};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const source = value as Record<string, unknown>;
|
|
56
|
-
return {
|
|
57
|
-
preferredAdapterId:
|
|
58
|
-
typeof source.preferredAdapterId === 'string' ? source.preferredAdapterId : undefined,
|
|
59
|
-
preferredProvider:
|
|
60
|
-
typeof source.preferredProvider === 'string' ? source.preferredProvider : undefined,
|
|
61
|
-
preferredSkillId:
|
|
62
|
-
typeof source.preferredSkillId === 'string' ? source.preferredSkillId : undefined,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function readString(value: unknown): string | undefined {
|
|
67
|
-
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function readBoolean(value: unknown): boolean | undefined {
|
|
71
|
-
return typeof value === 'boolean' ? value : undefined;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function readObject(value: unknown): Record<string, unknown> | undefined {
|
|
75
|
-
return value && typeof value === 'object' ? value as Record<string, unknown> : undefined;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function readWorkspaceKind(value: unknown): WorkspaceKind | undefined {
|
|
79
|
-
return value === 'host' || value === 'worktree' || value === 'docker' ? value : undefined;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function workspaceMetadata(workspace: WorkspaceHandle, keepAfterCompletion?: boolean): WorkspaceMetadata {
|
|
83
|
-
return {
|
|
84
|
-
id: workspace.id,
|
|
85
|
-
kind: workspace.kind,
|
|
86
|
-
path: workspace.path,
|
|
87
|
-
baseRef: workspace.baseRef,
|
|
88
|
-
branchName: workspace.branchName,
|
|
89
|
-
keepAfterCompletion,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function evictOldestTerminalTask(): boolean {
|
|
94
|
-
for (const [taskId, task] of a2aTaskStore.entries()) {
|
|
95
|
-
if (!isTerminalTaskState(task.state)) continue;
|
|
96
|
-
const unsub = taskUnsubs.get(taskId);
|
|
97
|
-
if (unsub) {
|
|
98
|
-
unsub();
|
|
99
|
-
taskUnsubs.delete(taskId);
|
|
100
|
-
}
|
|
101
|
-
a2aTaskStore.delete(taskId);
|
|
102
|
-
return true;
|
|
103
|
-
}
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async function finalizeTerminalTask(task: Task): Promise<void> {
|
|
108
|
-
if (finalizingTasks.has(task.id)) return;
|
|
109
|
-
finalizingTasks.add(task.id);
|
|
110
|
-
|
|
111
|
-
const stopPreview = previewStops.get(task.id);
|
|
112
|
-
if (stopPreview) {
|
|
113
|
-
stopPreview();
|
|
114
|
-
previewStops.delete(task.id);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const workspace = activeWorkspaces.get(task.id);
|
|
118
|
-
try {
|
|
119
|
-
if (workspace) {
|
|
120
|
-
const diff = await workspace.diff();
|
|
121
|
-
if (diff.trim()) {
|
|
122
|
-
a2aBus.publish({
|
|
123
|
-
kind: 'artifact',
|
|
124
|
-
taskId: task.id,
|
|
125
|
-
artifact: {
|
|
126
|
-
artifactId: newId('art'),
|
|
127
|
-
type: 'file-diff',
|
|
128
|
-
parts: [{ kind: 'text', text: diff }],
|
|
129
|
-
metadata: {
|
|
130
|
-
source: 'workspace-diff',
|
|
131
|
-
workspaceId: workspace.id,
|
|
132
|
-
workspaceKind: workspace.kind,
|
|
133
|
-
baseRef: workspace.baseRef,
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const keepAfterCompletion = task.metadata?.workspace &&
|
|
140
|
-
typeof task.metadata.workspace === 'object' &&
|
|
141
|
-
readBoolean((task.metadata.workspace as Record<string, unknown>).keepAfterCompletion);
|
|
142
|
-
if (workspace.kind !== 'host' && keepAfterCompletion !== true) {
|
|
143
|
-
await workspace.destroy();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
} catch (error) {
|
|
147
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
148
|
-
task.metadata = {
|
|
149
|
-
...task.metadata,
|
|
150
|
-
workspaceFinalizationError: message,
|
|
151
|
-
};
|
|
152
|
-
task.updatedAt = Date.now();
|
|
153
|
-
a2aTaskStore.set(task);
|
|
154
|
-
} finally {
|
|
155
|
-
activeWorkspaces.delete(task.id);
|
|
156
|
-
activeHandles.delete(task.id);
|
|
157
|
-
const unsub = taskUnsubs.get(task.id);
|
|
158
|
-
if (unsub) {
|
|
159
|
-
unsub();
|
|
160
|
-
taskUnsubs.delete(task.id);
|
|
161
|
-
}
|
|
162
|
-
finalizingTasks.delete(task.id);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function attachBusToTask(task: Task): void {
|
|
167
|
-
if (taskUnsubs.has(task.id)) return;
|
|
168
|
-
|
|
169
|
-
const unsubscribe = a2aBus.subscribe(task.id, (event: BusEvent) => {
|
|
170
|
-
if (event.kind === 'task-state') {
|
|
171
|
-
task.state = event.state;
|
|
172
|
-
if (event.error) task.error = event.error;
|
|
173
|
-
task.updatedAt = Date.now();
|
|
174
|
-
a2aTaskStore.set(task);
|
|
175
|
-
if (isTerminalTaskState(event.state)) {
|
|
176
|
-
void finalizeTerminalTask(task);
|
|
177
|
-
}
|
|
178
|
-
} else if (event.kind === 'message') {
|
|
179
|
-
task.history.push(event.message);
|
|
180
|
-
task.updatedAt = Date.now();
|
|
181
|
-
a2aTaskStore.set(task);
|
|
182
|
-
} else if (event.kind === 'artifact') {
|
|
183
|
-
task.artifacts.push(event.artifact);
|
|
184
|
-
task.updatedAt = Date.now();
|
|
185
|
-
a2aTaskStore.set(task);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
taskUnsubs.set(task.id, unsubscribe);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export function getA2ATask(taskId: string): Task | undefined {
|
|
192
|
-
return a2aTaskStore.get(taskId);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export function listA2AAgentCards() {
|
|
196
|
-
return adapterRegistry.agentCards();
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export async function submitA2ATask(input: SubmitTaskInput): Promise<Task> {
|
|
200
|
-
const metadata = input.metadata as Record<string, unknown> | undefined;
|
|
201
|
-
const routing = readRoutingHints(metadata?.routing);
|
|
202
|
-
const adapter = adapterRegistry.resolve(input.adapterId, routing);
|
|
203
|
-
if (!adapter) {
|
|
204
|
-
throw new Error(`ADAPTER_NOT_FOUND: ${input.adapterId}`);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (a2aTaskStore.size >= MAX_TASKS && !evictOldestTerminalTask()) {
|
|
208
|
-
throw new Error(`TASK_LIMIT: task store at capacity (${MAX_TASKS})`);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const userMessage: Message = input.message;
|
|
212
|
-
const task: Task = {
|
|
213
|
-
id: newId('task'),
|
|
214
|
-
contextId: input.contextId,
|
|
215
|
-
state: 'submitted',
|
|
216
|
-
history: [{ ...userMessage, taskId: '' }],
|
|
217
|
-
artifacts: [],
|
|
218
|
-
metadata: {
|
|
219
|
-
...metadata,
|
|
220
|
-
adapterId: adapter.id,
|
|
221
|
-
adapterSelector: input.adapterId,
|
|
222
|
-
},
|
|
223
|
-
createdAt: Date.now(),
|
|
224
|
-
updatedAt: Date.now(),
|
|
225
|
-
};
|
|
226
|
-
task.history[0] = { ...userMessage, taskId: task.id };
|
|
227
|
-
a2aTaskStore.set(task);
|
|
228
|
-
attachBusToTask(task);
|
|
229
|
-
|
|
230
|
-
const workspaceOptions = (metadata?.workspace && typeof metadata.workspace === 'object'
|
|
231
|
-
? metadata.workspace
|
|
232
|
-
: {}) as Record<string, unknown>;
|
|
233
|
-
let workspace: WorkspaceHandle;
|
|
234
|
-
try {
|
|
235
|
-
workspace = await workspaceManager.create({
|
|
236
|
-
taskId: task.id,
|
|
237
|
-
projectPath: readString(workspaceOptions.projectPath) ?? process.cwd(),
|
|
238
|
-
kind: readWorkspaceKind(workspaceOptions.kind) ?? readWorkspaceKind(metadata?.isolation),
|
|
239
|
-
baseRef: readString(workspaceOptions.baseRef) ?? readString(metadata?.baseRef) ?? 'HEAD',
|
|
240
|
-
keepAfterCompletion: readBoolean(workspaceOptions.keepAfterCompletion),
|
|
241
|
-
metadata: workspaceOptions,
|
|
242
|
-
});
|
|
243
|
-
} catch (err) {
|
|
244
|
-
const workspaceError = err instanceof WorkspaceError ? err : undefined;
|
|
245
|
-
a2aBus.publish({
|
|
246
|
-
kind: 'task-state',
|
|
247
|
-
taskId: task.id,
|
|
248
|
-
state: 'failed',
|
|
249
|
-
error: {
|
|
250
|
-
code: workspaceError?.code ?? 'WORKSPACE_CREATE_FAILED',
|
|
251
|
-
message: err instanceof Error ? err.message : String(err),
|
|
252
|
-
details: workspaceError?.details,
|
|
253
|
-
},
|
|
254
|
-
});
|
|
255
|
-
return a2aTaskStore.get(task.id) ?? task;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
activeWorkspaces.set(task.id, workspace);
|
|
259
|
-
task.metadata = {
|
|
260
|
-
...task.metadata,
|
|
261
|
-
workspace: workspaceMetadata(workspace, readBoolean(workspaceOptions.keepAfterCompletion)),
|
|
262
|
-
};
|
|
263
|
-
task.updatedAt = Date.now();
|
|
264
|
-
a2aTaskStore.set(task);
|
|
265
|
-
|
|
266
|
-
previewStops.set(
|
|
267
|
-
task.id,
|
|
268
|
-
portWatcher.watch({
|
|
269
|
-
taskId: task.id,
|
|
270
|
-
workspace,
|
|
271
|
-
onPort: (event) => {
|
|
272
|
-
const data: PreviewArtifactData = {
|
|
273
|
-
url: event.url,
|
|
274
|
-
proxiedUrl: `/preview/${event.port}/`,
|
|
275
|
-
port: event.port,
|
|
276
|
-
host: event.host,
|
|
277
|
-
processName: event.processName,
|
|
278
|
-
confidence: event.confidence,
|
|
279
|
-
};
|
|
280
|
-
a2aBus.publish({
|
|
281
|
-
kind: 'artifact',
|
|
282
|
-
taskId: task.id,
|
|
283
|
-
artifact: {
|
|
284
|
-
artifactId: newId('art'),
|
|
285
|
-
type: 'preview-url',
|
|
286
|
-
parts: [{ kind: 'data', data: { ...data } }],
|
|
287
|
-
metadata: {
|
|
288
|
-
source: 'port-watcher',
|
|
289
|
-
workspaceId: workspace.id,
|
|
290
|
-
},
|
|
291
|
-
},
|
|
292
|
-
});
|
|
293
|
-
},
|
|
294
|
-
}),
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
try {
|
|
298
|
-
const handle = await adapter.submitTask(task, {
|
|
299
|
-
cwd: workspace.path,
|
|
300
|
-
workspace,
|
|
301
|
-
model: readString(metadata?.model),
|
|
302
|
-
permissionMode: readString(metadata?.permissionMode),
|
|
303
|
-
permissionPolicy: readObject(metadata?.permissionPolicy) as PermissionPolicy | undefined,
|
|
304
|
-
permissionPolicyContext: readObject(metadata?.permissionPolicyContext) as PermissionPolicyContext | undefined,
|
|
305
|
-
toolsSettings: readObject(metadata?.toolsSettings),
|
|
306
|
-
});
|
|
307
|
-
activeHandles.set(task.id, handle);
|
|
308
|
-
handle.finished.finally(() => {
|
|
309
|
-
activeHandles.delete(task.id);
|
|
310
|
-
}).catch(() => undefined);
|
|
311
|
-
} catch (err) {
|
|
312
|
-
a2aBus.publish({
|
|
313
|
-
kind: 'task-state',
|
|
314
|
-
taskId: task.id,
|
|
315
|
-
state: 'failed',
|
|
316
|
-
error: {
|
|
317
|
-
code: 'ADAPTER_SUBMIT_FAILED',
|
|
318
|
-
message: err instanceof Error ? err.message : String(err),
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
return a2aTaskStore.get(task.id) ?? task;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
export async function cancelA2ATask(taskId: string, adapterId?: string): Promise<Task | undefined> {
|
|
327
|
-
const task = a2aTaskStore.get(taskId);
|
|
328
|
-
if (!task) return undefined;
|
|
329
|
-
|
|
330
|
-
const handle = activeHandles.get(taskId);
|
|
331
|
-
if (handle) {
|
|
332
|
-
await handle.cancel();
|
|
333
|
-
return a2aTaskStore.get(taskId) ?? task;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
const resolvedAdapterId = adapterId ?? readString(task.metadata?.adapterId);
|
|
337
|
-
const adapter = resolvedAdapterId ? adapterRegistry.resolve(resolvedAdapterId) : undefined;
|
|
338
|
-
if (adapter) {
|
|
339
|
-
await adapter.cancelTask(task.id);
|
|
340
|
-
return a2aTaskStore.get(task.id) ?? task;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
a2aBus.publish({ kind: 'task-state', taskId: task.id, state: 'canceled' });
|
|
344
|
-
return a2aTaskStore.get(task.id) ?? task;
|
|
345
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
// server/modules/orchestration/a2a/task-store.ts
|
|
2
|
-
// A2A task persistence backed by shared JsonStore for atomic writes and corruption recovery.
|
|
3
|
-
// Exposes a Map-compatible surface (get/set/delete/size/entries/values) so routes.ts
|
|
4
|
-
// can treat the store as a typed Map while still benefiting from durable JSON storage.
|
|
5
|
-
|
|
6
|
-
import os from 'os';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
|
|
9
|
-
import { JsonStore } from '@/database/json-store.js';
|
|
10
|
-
import type { Message, Task, TaskState, TaskSummary } from '@/modules/orchestration/a2a/types.js';
|
|
11
|
-
|
|
12
|
-
const filePath = path.join(os.homedir(), '.pixcode', 'a2a-tasks.json');
|
|
13
|
-
|
|
14
|
-
export interface A2ATaskStoreOptions {
|
|
15
|
-
terminalTaskTtlMs?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface ListOptions {
|
|
19
|
-
state?: TaskState;
|
|
20
|
-
contextId?: string;
|
|
21
|
-
adapterId?: string;
|
|
22
|
-
limit?: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class A2ATaskStore {
|
|
26
|
-
private store: JsonStore;
|
|
27
|
-
|
|
28
|
-
constructor(_options?: A2ATaskStoreOptions) {
|
|
29
|
-
this.store = new JsonStore(filePath, { a2a_tasks: [] });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ── Map-compatible API ─────────────────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
get(id: string): Task | undefined {
|
|
35
|
-
return this.store.findWhere('a2a_tasks', (t: Task) => t.id === id) ?? undefined;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
set(task: Task): void {
|
|
39
|
-
const existing = this.get(task.id);
|
|
40
|
-
if (existing) {
|
|
41
|
-
this.store.updateWhere('a2a_tasks', (t: Task) => t.id === task.id, task);
|
|
42
|
-
} else {
|
|
43
|
-
this.store.insert('a2a_tasks', task, { autoId: false });
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
delete(id: string): void {
|
|
48
|
-
this.store.deleteWhere('a2a_tasks', (t: Task) => t.id === id);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get size(): number {
|
|
52
|
-
return (this.store.filterWhere('a2a_tasks', () => true) as Task[]).length;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
*entries(): IterableIterator<[string, Task]> {
|
|
56
|
-
const tasks = this.store.filterWhere('a2a_tasks', () => true) as Task[];
|
|
57
|
-
for (const task of tasks) {
|
|
58
|
-
yield [task.id, task];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
*values(): IterableIterator<Task> {
|
|
63
|
-
const tasks = this.store.filterWhere('a2a_tasks', () => true) as Task[];
|
|
64
|
-
for (const task of tasks) {
|
|
65
|
-
yield task;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// ── Query helpers ──────────────────────────────────────────────────────────
|
|
70
|
-
|
|
71
|
-
list(options: ListOptions = {}): Task[] {
|
|
72
|
-
const { state, contextId, adapterId, limit = 50 } = options;
|
|
73
|
-
let tasks = this.store.filterWhere('a2a_tasks', (t: Task) => {
|
|
74
|
-
if (state && t.state !== state) return false;
|
|
75
|
-
if (contextId && t.contextId !== contextId) return false;
|
|
76
|
-
if (adapterId && (t.metadata?.adapterId as string | undefined) !== adapterId) return false;
|
|
77
|
-
return true;
|
|
78
|
-
}) as Task[];
|
|
79
|
-
if (limit > 0) tasks = tasks.slice(0, limit);
|
|
80
|
-
return tasks;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
summarize(task: Task): TaskSummary {
|
|
84
|
-
return {
|
|
85
|
-
id: task.id,
|
|
86
|
-
contextId: task.contextId,
|
|
87
|
-
state: task.state,
|
|
88
|
-
adapterId: task.metadata?.adapterId as string | undefined,
|
|
89
|
-
adapterSelector: task.metadata?.adapterSelector as string | undefined,
|
|
90
|
-
error: task.error,
|
|
91
|
-
createdAt: task.createdAt,
|
|
92
|
-
updatedAt: task.updatedAt,
|
|
93
|
-
messageCount: task.history?.length ?? 0,
|
|
94
|
-
artifactCount: task.artifacts?.length ?? 0,
|
|
95
|
-
lastMessage: task.history?.at(-1),
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// ── Legacy named methods (kept for any future internal callers) ────────────
|
|
100
|
-
|
|
101
|
-
getTask(id: string): Task | undefined {
|
|
102
|
-
return this.get(id);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
getTaskByIndex(index: number): Task | undefined {
|
|
106
|
-
const tasks = this.store.filterWhere('a2a_tasks', () => true) as Task[];
|
|
107
|
-
return tasks[index] ?? undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
getTasks(): Task[] {
|
|
111
|
-
return this.store.filterWhere('a2a_tasks', () => true) as Task[];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
createTask(task: Task): void {
|
|
115
|
-
this.store.insert('a2a_tasks', task, { autoId: false });
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
updateTask(id: string, updates: Partial<Task>): void {
|
|
119
|
-
const existing = this.get(id);
|
|
120
|
-
if (!existing) return;
|
|
121
|
-
const updated = { ...existing, ...updates, id: existing.id };
|
|
122
|
-
this.store.updateWhere('a2a_tasks', (t: Task) => t.id === id, updated);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
updateTaskState(id: string, state: TaskState): void {
|
|
126
|
-
this.updateTask(id, { status: { state } } as Partial<Task>);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
deleteTask(id: string): void {
|
|
130
|
-
this.delete(id);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
appendHistory(id: string, entry: { state: TaskState; timestamp: string }): void {
|
|
134
|
-
const task = this.get(id);
|
|
135
|
-
if (!task) return;
|
|
136
|
-
const history = [...(task.history ?? []), entry as unknown as Message];
|
|
137
|
-
this.updateTask(id, { history } as Partial<Task>);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
addArtifact(id: string, artifact: NonNullable<Task['artifacts']>[number]): void {
|
|
141
|
-
const task = this.get(id);
|
|
142
|
-
if (!task) return;
|
|
143
|
-
const artifacts = [...(task.artifacts ?? []), artifact];
|
|
144
|
-
this.updateTask(id, { artifacts } as Partial<Task>);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
addMessage(id: string, message: Message): void {
|
|
148
|
-
const task = this.get(id);
|
|
149
|
-
if (!task) return;
|
|
150
|
-
const history = [...(task.history ?? []), message];
|
|
151
|
-
this.updateTask(id, { history } as Partial<Task>);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
updateMessage(id: string, messageId: string, updates: Partial<Message>): void {
|
|
155
|
-
const task = this.get(id);
|
|
156
|
-
if (!task?.history) return;
|
|
157
|
-
const history = task.history.map((m) =>
|
|
158
|
-
m.messageId === messageId ? { ...m, ...updates } : m,
|
|
159
|
-
);
|
|
160
|
-
this.updateTask(id, { history } as Partial<Task>);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
getMessage(id: string, messageId: string): Message | undefined {
|
|
164
|
-
const task = this.get(id);
|
|
165
|
-
return task?.history?.find((m) => m.messageId === messageId);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
getMessages(id: string): Message[] {
|
|
169
|
-
const task = this.get(id);
|
|
170
|
-
return task?.history ?? [];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
clearMessages(id: string): void {
|
|
174
|
-
this.updateTask(id, { history: [] } as Partial<Task>);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export const a2aTaskStore = new A2ATaskStore();
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// server/modules/orchestration/a2a/types.ts
|
|
2
|
-
// A2A protocol v0.2 types — minimal surface used by pixcode.
|
|
3
|
-
// See https://a2a-protocol.org for the full spec; this file
|
|
4
|
-
// keeps only what the orchestrator actually exchanges.
|
|
5
|
-
|
|
6
|
-
export type TaskState =
|
|
7
|
-
| 'submitted'
|
|
8
|
-
| 'working'
|
|
9
|
-
| 'input-required'
|
|
10
|
-
| 'completed'
|
|
11
|
-
| 'canceled'
|
|
12
|
-
| 'failed';
|
|
13
|
-
|
|
14
|
-
export type Role = 'user' | 'agent';
|
|
15
|
-
|
|
16
|
-
export type PartKind = 'text' | 'file' | 'data';
|
|
17
|
-
|
|
18
|
-
export interface TextPart {
|
|
19
|
-
kind: 'text';
|
|
20
|
-
text: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface FilePart {
|
|
24
|
-
kind: 'file';
|
|
25
|
-
name: string;
|
|
26
|
-
mimeType?: string;
|
|
27
|
-
bytesBase64?: string;
|
|
28
|
-
uri?: string;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface DataPart {
|
|
32
|
-
kind: 'data';
|
|
33
|
-
data: Record<string, unknown>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export type Part = TextPart | FilePart | DataPart;
|
|
37
|
-
|
|
38
|
-
export interface Message {
|
|
39
|
-
messageId: string;
|
|
40
|
-
role: Role;
|
|
41
|
-
parts: Part[];
|
|
42
|
-
/** Required for task-scoped messages. Omit only for broadcast/standalone messages. */
|
|
43
|
-
taskId?: string;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type ArtifactType =
|
|
47
|
-
| 'file-diff'
|
|
48
|
-
| 'command-output'
|
|
49
|
-
| 'preview-url'
|
|
50
|
-
| 'handoff-artifact'
|
|
51
|
-
| 'data';
|
|
52
|
-
|
|
53
|
-
// Note: Artifact and AuthScheme use `type` discriminator (matches A2A
|
|
54
|
-
// v0.2 wire format). Part and BusEvent use `kind` per the same spec.
|
|
55
|
-
export interface Artifact {
|
|
56
|
-
artifactId: string;
|
|
57
|
-
type: ArtifactType;
|
|
58
|
-
parts: Part[];
|
|
59
|
-
metadata?: Record<string, unknown>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface TaskError {
|
|
63
|
-
code: string;
|
|
64
|
-
message: string;
|
|
65
|
-
details?: Record<string, unknown>;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface Task {
|
|
69
|
-
id: string;
|
|
70
|
-
contextId?: string;
|
|
71
|
-
state: TaskState;
|
|
72
|
-
history: Message[];
|
|
73
|
-
artifacts: Artifact[];
|
|
74
|
-
error?: TaskError;
|
|
75
|
-
metadata?: Record<string, unknown>;
|
|
76
|
-
createdAt: number;
|
|
77
|
-
updatedAt: number;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface TaskSummary {
|
|
81
|
-
id: string;
|
|
82
|
-
contextId?: string;
|
|
83
|
-
state: TaskState;
|
|
84
|
-
adapterId?: string;
|
|
85
|
-
adapterSelector?: string;
|
|
86
|
-
error?: TaskError;
|
|
87
|
-
createdAt: number;
|
|
88
|
-
updatedAt: number;
|
|
89
|
-
messageCount: number;
|
|
90
|
-
artifactCount: number;
|
|
91
|
-
lastMessage?: Message;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface AgentSkill {
|
|
95
|
-
id: string;
|
|
96
|
-
description: string;
|
|
97
|
-
examples?: string[];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export type AuthScheme =
|
|
101
|
-
| { type: 'none' }
|
|
102
|
-
| { type: 'bearer' }
|
|
103
|
-
| { type: 'mtls' };
|
|
104
|
-
|
|
105
|
-
export interface AgentCard {
|
|
106
|
-
name: string;
|
|
107
|
-
description: string;
|
|
108
|
-
url: string;
|
|
109
|
-
version: string;
|
|
110
|
-
capabilities: string[];
|
|
111
|
-
skills: AgentSkill[];
|
|
112
|
-
authentication: AuthScheme;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface SubmitTaskInput {
|
|
116
|
-
message: Message;
|
|
117
|
-
contextId?: string;
|
|
118
|
-
metadata?: Record<string, unknown>;
|
|
119
|
-
/** Adapter id, "auto", or "skill:<id>". Resolved by the adapter registry. */
|
|
120
|
-
adapterId: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export type BusEvent =
|
|
124
|
-
| { kind: 'task-state'; taskId: string; state: TaskState; error?: TaskError }
|
|
125
|
-
| { kind: 'message'; taskId: string; message: Message }
|
|
126
|
-
| { kind: 'artifact'; taskId: string; artifact: Artifact };
|