@agent-spaces/server 0.3.62 → 0.3.64
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/adapters/agent-runtime-types.js +12 -0
- package/dist/adapters/claude-code-runtime/index.js +3 -0
- package/dist/adapters/claude-code-runtime/message-format.js +1 -1
- package/dist/adapters/codex-runtime.js +2 -2
- package/dist/adapters/git.js +161 -57
- package/dist/adapters/langchain-runtime.js +2 -2
- package/dist/adapters/open-agent-sdk-runtime.js +2 -2
- package/dist/agents/agent-designer.js +66 -12
- package/dist/agents/commit-agent.js +1 -0
- package/dist/agents/issue-agent-progress.js +4 -2
- package/dist/agents/issue-agent-runner.js +5 -5
- package/dist/agents/issue-task-controller.js +96 -15
- package/dist/app.js +123 -5
- package/dist/package.json +1 -1
- package/dist/routes/agent-commands.js +72 -0
- package/dist/routes/agent-sse.js +10 -2
- package/dist/routes/agent.js +15 -1
- package/dist/routes/database.js +345 -0
- package/dist/routes/git.js +52 -1
- package/dist/routes/hooks.js +88 -0
- package/dist/routes/issue.js +59 -1
- package/dist/routes/kanban.js +39 -0
- package/dist/routes/output-style.js +48 -0
- package/dist/routes/prompt-template.js +2 -2
- package/dist/routes/skill.js +86 -15
- package/dist/routes/task.js +13 -1
- package/dist/services/agent-commands.js +168 -0
- package/dist/services/builtin-tools/command-tools.js +117 -0
- package/dist/services/builtin-tools/database-tools.js +578 -0
- package/dist/services/builtin-tools/index.js +5 -0
- package/dist/services/builtin-tools/input-helpers.js +26 -0
- package/dist/services/builtin-tools/issue-tools.js +209 -0
- package/dist/services/builtin-tools/kanban-tools.js +277 -0
- package/dist/services/database-vector.js +244 -0
- package/dist/services/hook-engine.js +118 -0
- package/dist/services/issue.js +6 -0
- package/dist/services/kanban.js +50 -0
- package/dist/services/notification-hub/bot-agent.js +1 -0
- package/dist/services/output-style.js +134 -0
- package/dist/services/prompt-template.js +2 -2
- package/dist/services/skill.js +148 -35
- package/dist/storage/database-store.js +365 -0
- package/dist/storage/hook-store.js +55 -0
- package/dist/storage/kanban-store.js +142 -0
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +26 -30
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +14 -14
- package/dist/web/__next._tree.txt +3 -8
- package/dist/web/_next/static/chunks/0-9194nbxy_6d.js +1 -0
- package/dist/web/_next/static/chunks/0-f~0xmwl__u5.js +1 -0
- package/dist/web/_next/static/chunks/0.n~yfwf4~6w-.js +1 -0
- package/dist/web/_next/static/chunks/002_j970b9gdx.js +1 -0
- package/dist/web/_next/static/chunks/01iqv28_snwus.js +1 -0
- package/dist/web/_next/static/chunks/01~quun6sefgl.js +1 -0
- package/dist/web/_next/static/chunks/02mf61htij8g0.js +31 -0
- package/dist/web/_next/static/chunks/03scq1-0ykve3.js +1 -0
- package/dist/web/_next/static/chunks/04a4vsq2wknm4.js +1 -0
- package/dist/web/_next/static/chunks/04dg4l4hv11q2.js +3 -0
- package/dist/web/_next/static/chunks/04fxddw-y20~-.js +7 -0
- package/dist/web/_next/static/chunks/04w7~5ooz_pwm.js +1 -0
- package/dist/web/_next/static/chunks/05oc21sj24wtq.js +1 -0
- package/dist/web/_next/static/chunks/{0zd1o3u04~qvo.js → 05psi2gtx~bev.js} +7 -7
- package/dist/web/_next/static/chunks/{0-oog4zg4_m~m.css → 062f9zqctzg.b.css} +0 -3
- package/dist/web/_next/static/chunks/{12odetnu-lyrr.js → 06whz1~s_7pva.js} +12 -12
- package/dist/web/_next/static/chunks/08ckpwmmwlors.js +3 -0
- package/dist/web/_next/static/chunks/08k~meqbd8d6v.js +1 -0
- package/dist/web/_next/static/chunks/099h96wjsdb25.js +2 -0
- package/dist/web/_next/static/chunks/09h23logvq65m.js +1 -0
- package/dist/web/_next/static/chunks/{0njy89g5coeyi.js → 0_8dm7bxp18xo.js} +6 -6
- package/dist/web/_next/static/chunks/0_mvduwjsm35w.js +1 -0
- package/dist/web/_next/static/chunks/0_vi1a~g4wx46.js +3 -0
- package/dist/web/_next/static/chunks/0a5y-vhf4i5id.js +3 -0
- package/dist/web/_next/static/chunks/0ake2f3x2uan4.js +24 -0
- package/dist/web/_next/static/chunks/{0tvd~rxgf0oh_.js → 0bbmx45w_h5np.js} +1 -1
- package/dist/web/_next/static/chunks/0ck8dw_9-1cdx.js +1 -0
- package/dist/web/_next/static/chunks/{07a0rktf_nr5h.js → 0ctg5qmw7uu.1.js} +2 -2
- package/dist/web/_next/static/chunks/0ewceguykiut5.js +1 -0
- package/dist/web/_next/static/chunks/0f7cb9li~3jra.js +67 -0
- package/dist/web/_next/static/chunks/0fttswpzu69qx.js +1 -0
- package/dist/web/_next/static/chunks/0ghs9on7wodrm.js +1 -0
- package/dist/web/_next/static/chunks/0ghx3j_.-gdyd.js +1 -0
- package/dist/web/_next/static/chunks/{0202ia13sijwb.js → 0h18ej5yf974e.js} +1 -1
- package/dist/web/_next/static/chunks/0h9cu-k6z5o08.js +1 -0
- package/dist/web/_next/static/chunks/0i39jifmxla7q.js +1 -0
- package/dist/web/_next/static/chunks/0iuf30t0rjsjv.js +19 -0
- package/dist/web/_next/static/chunks/0jb4~3qqkw2ps.js +1 -0
- package/dist/web/_next/static/chunks/0k4zdm72k_bfy.js +1 -0
- package/dist/web/_next/static/chunks/{08o-zmr-40r5g.js → 0m11vvph7q94-.js} +1 -1
- package/dist/web/_next/static/chunks/0n6_4so_afuwk.js +71 -0
- package/dist/web/_next/static/chunks/0nb8.iteznuvx.js +1 -0
- package/dist/web/_next/static/chunks/0np.d~hc1-pmh.js +4 -0
- package/dist/web/_next/static/chunks/{0qpq0~_58fe9a.js → 0oaq67r7ix.vg.js} +1 -1
- package/dist/web/_next/static/chunks/{0d_dp_4ofz0l3.css → 0ojcao3hdm36s.css} +0 -1
- package/dist/web/_next/static/chunks/0os58q93stt7j.js +3 -0
- package/dist/web/_next/static/chunks/{0gig.k.rq8d0x.js → 0ppr271hz0xoq.js} +1 -1
- package/dist/web/_next/static/chunks/0s9lmk8iauou3.js +1 -0
- package/dist/web/_next/static/chunks/0sp_zbx~w0am7.js +1 -0
- package/dist/web/_next/static/chunks/0tel~zsv4z8l_.js +1 -0
- package/dist/web/_next/static/chunks/0twamv4wr_dbv.js +1 -0
- package/dist/web/_next/static/chunks/0uhol5wafdbl~.js +1 -0
- package/dist/web/_next/static/chunks/0v3a_x4vt42kx.js +5 -0
- package/dist/web/_next/static/chunks/{002-dxhags4dj.js → 0v6hte2z-32ca.js} +2 -2
- package/dist/web/_next/static/chunks/0v7q4mys.mnm..css +1 -0
- package/dist/web/_next/static/chunks/0vbqaynjq8ga..js +3 -0
- package/dist/web/_next/static/chunks/0xbaakj0dfc0..js +1 -0
- package/dist/web/_next/static/chunks/{0..g0jl-8qup7.js → 0xoo17yef_b8g.js} +1 -1
- package/dist/web/_next/static/chunks/0xt-8wk21gs7g.js +1 -0
- package/dist/web/_next/static/chunks/0za1r07-6az6w.js +1 -0
- package/dist/web/_next/static/chunks/0z~vqzbm_q371.js +1 -0
- package/dist/web/_next/static/chunks/0~3xm80~j9ddg.js +1 -0
- package/dist/web/_next/static/chunks/0~u.5r3-t7179.js +1 -0
- package/dist/web/_next/static/chunks/10l-9myrdo3x9.js +1 -0
- package/dist/web/_next/static/chunks/11-czmcci_55y.js +1 -0
- package/dist/web/_next/static/chunks/11k-.49r~1mfm.js +1 -0
- package/dist/web/_next/static/chunks/{0k.8qdk7oi_os.js → 128ugqd34tr_-.js} +1 -1
- package/dist/web/_next/static/chunks/12jm4gwmvq-0q.js +90 -0
- package/dist/web/_next/static/chunks/{0rke_patcovgr.js → 1442stwa0gbxe.js} +1 -1
- package/dist/web/_next/static/chunks/{0jokpgh485~28.js → 14hqmid8q4apf.js} +11 -11
- package/dist/web/_next/static/chunks/14s37n6h0_q3x.js +16 -0
- package/dist/web/_next/static/chunks/161ik5kfyuwtd.js +1 -0
- package/dist/web/_next/static/chunks/16sg-lflc8csx.js +1 -0
- package/dist/web/_next/static/chunks/17k~zbv0_4rep.js +1 -0
- package/dist/web/_next/static/chunks/17oc2l.ekcs8b.css +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0lrdxynxb9-1t.js → turbopack-0ndm2zc_pdptk.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -31
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +14 -14
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +3 -3
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +30 -31
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +26 -30
- package/dist/web/login/__next._full.txt +32 -36
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +14 -14
- package/dist/web/login/__next._tree.txt +3 -8
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +32 -36
- package/dist/web/settings/__next._full.txt +29 -34
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +14 -14
- package/dist/web/settings/__next._tree.txt +3 -8
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +27 -32
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +14 -14
- package/dist/web/settings/agents/__next._tree.txt +3 -8
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +27 -32
- package/dist/web/settings/mcps/__next._full.txt +27 -32
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +14 -14
- package/dist/web/settings/mcps/__next._tree.txt +3 -8
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +27 -32
- package/dist/web/settings/models/__next._full.txt +27 -32
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +14 -14
- package/dist/web/settings/models/__next._tree.txt +3 -8
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +27 -32
- package/dist/web/settings/output-styles/__next._full.txt +38 -0
- package/dist/web/settings/output-styles/__next._head.txt +6 -0
- package/dist/web/settings/output-styles/__next._index.txt +15 -0
- package/dist/web/settings/output-styles/__next._tree.txt +3 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.__PAGE__.txt +9 -0
- package/dist/web/settings/output-styles/__next.settings.output-styles.txt +5 -0
- package/dist/web/settings/output-styles/__next.settings.txt +7 -0
- package/dist/web/settings/output-styles.html +1 -0
- package/dist/web/settings/output-styles.txt +38 -0
- package/dist/web/settings/prompts/__next._full.txt +27 -32
- package/dist/web/settings/prompts/__next._head.txt +4 -4
- package/dist/web/settings/prompts/__next._index.txt +14 -14
- package/dist/web/settings/prompts/__next._tree.txt +3 -8
- package/dist/web/settings/prompts/__next.settings.prompts.__PAGE__.txt +4 -4
- package/dist/web/settings/prompts/__next.settings.prompts.txt +3 -3
- package/dist/web/settings/prompts/__next.settings.txt +5 -5
- package/dist/web/settings/prompts.html +1 -1
- package/dist/web/settings/prompts.txt +27 -32
- package/dist/web/settings/providers/__next._full.txt +27 -32
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +14 -14
- package/dist/web/settings/providers/__next._tree.txt +3 -8
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +27 -32
- package/dist/web/settings/skills/__next._full.txt +27 -32
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +14 -14
- package/dist/web/settings/skills/__next._tree.txt +3 -8
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +27 -32
- package/dist/web/settings/tools/__next._full.txt +38 -0
- package/dist/web/settings/tools/__next._head.txt +6 -0
- package/dist/web/settings/tools/__next._index.txt +15 -0
- package/dist/web/settings/tools/__next._tree.txt +3 -0
- package/dist/web/settings/tools/__next.settings.tools.__PAGE__.txt +9 -0
- package/dist/web/settings/tools/__next.settings.tools.txt +5 -0
- package/dist/web/settings/tools/__next.settings.txt +7 -0
- package/dist/web/settings/tools.html +1 -0
- package/dist/web/settings/tools.txt +38 -0
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +29 -34
- package/dist/web/workflows/__next._full.txt +34 -37
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +14 -14
- package/dist/web/workflows/__next._tree.txt +3 -8
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +34 -37
- package/dist/web/workspace/_/__next._full.txt +32 -77
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +14 -14
- package/dist/web/workspace/_/__next._tree.txt +4 -23
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -18
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +32 -77
- package/dist/web/workspaces/__next._full.txt +32 -38
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +14 -14
- package/dist/web/workspaces/__next._tree.txt +3 -8
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +32 -38
- package/dist/ws/agent-prompt.js +45 -8
- package/dist/ws/agent-runner.js +10 -6
- package/package.json +11 -10
- package/public/output-styles/carmack-mode.md +381 -0
- package/public/output-styles/codex-rigor-mode.md +114 -0
- package/public/output-styles/dhh-mode.md +265 -0
- package/public/output-styles/evan-you-mode.md +539 -0
- package/public/output-styles/index.json +37 -0
- package/public/output-styles/jobs-mode.md +369 -0
- package/public/output-styles/linus-mode.md +135 -0
- package/public/output-styles/uncle-bob-mode.md +221 -0
- package/public/prompt/andrej-karpathy-skills.md +65 -0
- package/public/prompt/claude-token-efficient-coding.md +35 -0
- package/public/prompt/index.json +12 -0
- package/public/skills/index.json +92 -0
- package/public/skills/planning-with-files/planning-with-files-zh/SKILL.md +243 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.ps1 +44 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/check-complete.sh +46 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.ps1 +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/init-session.sh +124 -0
- package/public/skills/planning-with-files/planning-with-files-zh/scripts/session-catchup.py +438 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/findings.md +29 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/progress.md +40 -0
- package/public/skills/planning-with-files/planning-with-files-zh/templates/task_plan.md +58 -0
- package/public/skills/superpowers/brainstorming/SKILL.md +164 -0
- package/public/skills/superpowers/brainstorming/scripts/frame-template.html +214 -0
- package/public/skills/superpowers/brainstorming/scripts/helper.js +88 -0
- package/public/skills/superpowers/brainstorming/scripts/server.cjs +354 -0
- package/public/skills/superpowers/brainstorming/scripts/start-server.sh +148 -0
- package/public/skills/superpowers/brainstorming/scripts/stop-server.sh +56 -0
- package/public/skills/superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/brainstorming/visual-companion.md +287 -0
- package/public/skills/superpowers/dispatching-parallel-agents/SKILL.md +182 -0
- package/public/skills/superpowers/executing-plans/SKILL.md +70 -0
- package/public/skills/superpowers/finishing-a-development-branch/SKILL.md +251 -0
- package/public/skills/superpowers/receiving-code-review/SKILL.md +213 -0
- package/public/skills/superpowers/requesting-code-review/SKILL.md +103 -0
- package/public/skills/superpowers/requesting-code-review/code-reviewer.md +168 -0
- package/public/skills/superpowers/subagent-driven-development/SKILL.md +279 -0
- package/public/skills/superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/public/skills/superpowers/subagent-driven-development/implementer-prompt.md +113 -0
- package/public/skills/superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/public/skills/superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/public/skills/superpowers/systematic-debugging/SKILL.md +296 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/public/skills/superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/public/skills/superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/public/skills/superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/public/skills/superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/public/skills/superpowers/systematic-debugging/test-academic.md +14 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/public/skills/superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/public/skills/superpowers/test-driven-development/SKILL.md +371 -0
- package/public/skills/superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/public/skills/superpowers/using-git-worktrees/SKILL.md +215 -0
- package/public/skills/superpowers/using-superpowers/SKILL.md +117 -0
- package/public/skills/superpowers/using-superpowers/references/codex-tools.md +59 -0
- package/public/skills/superpowers/using-superpowers/references/copilot-tools.md +42 -0
- package/public/skills/superpowers/using-superpowers/references/gemini-tools.md +51 -0
- package/public/skills/superpowers/verification-before-completion/SKILL.md +139 -0
- package/public/skills/superpowers/writing-plans/SKILL.md +152 -0
- package/public/skills/superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/public/skills/superpowers/writing-skills/SKILL.md +655 -0
- package/public/skills/superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/public/skills/superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/public/skills/superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/public/skills/superpowers/writing-skills/persuasion-principles.md +187 -0
- package/public/skills/superpowers/writing-skills/render-graphs.js +168 -0
- package/public/skills/superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/dist/web/_next/static/chunks/0-81wi7xr2nd-.js +0 -270
- package/dist/web/_next/static/chunks/00lca9lsasdm7.js +0 -1
- package/dist/web/_next/static/chunks/01gi~q0c6ez6..js +0 -1
- package/dist/web/_next/static/chunks/02shswpmybici.js +0 -1
- package/dist/web/_next/static/chunks/05tx6hzdtkgi9.js +0 -2
- package/dist/web/_next/static/chunks/07nbyndvzftr1.js +0 -3
- package/dist/web/_next/static/chunks/0bn~onkv~9xza.js +0 -1
- package/dist/web/_next/static/chunks/0g-0n6glz_z6w.js +0 -1
- package/dist/web/_next/static/chunks/0gyede80jpy3n.js +0 -4
- package/dist/web/_next/static/chunks/0hrbuvzuxrjfl.js +0 -1
- package/dist/web/_next/static/chunks/0i51q.5s_-.vh.css +0 -1
- package/dist/web/_next/static/chunks/0qf163pbrwy4z.js +0 -1
- package/dist/web/_next/static/chunks/0rnt-f3pjxb-d.js +0 -5
- package/dist/web/_next/static/chunks/0tgbcgsca9mrg.js +0 -1
- package/dist/web/_next/static/chunks/0tyhv6.y7~yxd.js +0 -1
- package/dist/web/_next/static/chunks/0u7_qd9hzqwac.js +0 -1
- package/dist/web/_next/static/chunks/0vuvql8rloda5.js +0 -1
- package/dist/web/_next/static/chunks/0wv0h27jafag4.js +0 -1
- package/dist/web/_next/static/chunks/0wwvc4zc2q6bn.js +0 -1
- package/dist/web/_next/static/chunks/0xmmk3vebw8xs.js +0 -1
- package/dist/web/_next/static/chunks/0xwqf.llmm_u2.js +0 -31
- package/dist/web/_next/static/chunks/0yo22_w53mo~5.js +0 -1
- package/dist/web/_next/static/chunks/12c0jp0qvlr1t.js +0 -1
- package/dist/web/_next/static/chunks/12pg1nn3v~~5k.js +0 -1
- package/dist/web/_next/static/chunks/16cyr8ilpx1nn.js +0 -1
- package/dist/web/_next/static/media/0a7740363b4d4863-s.1110aazvokzp..woff2 +0 -0
- package/dist/web/_next/static/media/0da9c7f357bd9d4d-s.0ek5sshv8wk3m.woff2 +0 -0
- package/dist/web/_next/static/media/1b99372b3eaef0c8-s.p.0gx2haw2tmll8.woff2 +0 -0
- package/dist/web/_next/static/media/41e95f694c5c4549-s.0r1jrq7neqdsq.woff2 +0 -0
- package/dist/web/_next/static/media/5c285b27cdda1fe8-s.p.0yo6-5yoeeudq.woff2 +0 -0
- package/dist/web/_next/static/media/5f9d24ebef5d5292-s.0esuu2f5si~v8.woff2 +0 -0
- package/dist/web/_next/static/media/6c55a692938ebbbc-s.0g6rbszwfgn9y.woff2 +0 -0
- package/dist/web/_next/static/media/8e6fa89aa22d24ec-s.p.0uvzar8hswo3p.woff2 +0 -0
- package/dist/web/_next/static/media/a218039a3287bcfd-s.p.17-1enzs_j91b.woff2 +0 -0
- package/dist/web/_next/static/media/b2ea385cb5ae8625-s.0kjod.kaq1k69.woff2 +0 -0
- package/dist/web/_next/static/media/bdc7e24a509eb931-s.0apt5mko2.qn3.woff2 +0 -0
- package/dist/web/_next/static/media/c3cb240f9c892514-s.163v2i5cux7-c.woff2 +0 -0
- package/dist/web/_next/static/media/e2334d715941921e-s.p.12skym0rqknxy.woff2 +0 -0
- package/public/avatars/1777813826407-bea0ja-minimax.svg +0 -1
- package/public/avatars/1777813967088-3xlvd0-minimax.svg +0 -1
- package/public/avatars/1777814041714-yp0qeq-minimax.svg +0 -1
- package/public/avatars/1777904986095-rg26je-icon.png +0 -0
- package/public/avatars/1778953228323-5je54x-user.jpg +0 -0
- package/public/avatars/1778954057880-g01q6y-user.jpg +0 -0
- /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{GS3b40oeaeLxm7i9-ibaj → e8w3vd9Eov_LDYWj_0zsE}/_ssgManifest.js +0 -0
- /package/public/avatars/{1777815865622-08wp9m-user.jpg → user.jpg} +0 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import * as store from '../storage/database-store.js';
|
|
5
|
+
import * as databaseVector from '../services/database-vector.js';
|
|
6
|
+
import * as agentService from '../services/agent.js';
|
|
7
|
+
import * as workspaceService from '../services/workspace.js';
|
|
8
|
+
import { createDatabaseFunctionTools } from '../services/builtin-tools/index.js';
|
|
9
|
+
import { createAgentRuntime } from '../adapters/agent-runtime.js';
|
|
10
|
+
import { getThinkingRuntimeConfig } from '../services/llm-model-config.js';
|
|
11
|
+
import { getDataDir, ensureDir } from '../storage/json-store.js';
|
|
12
|
+
import { generateAgentDesign } from '../agents/agent-designer.js';
|
|
13
|
+
const router = Router({ mergeParams: true });
|
|
14
|
+
const pendingContentSaves = new Map();
|
|
15
|
+
const CONTENT_SAVE_IDLE_MS = 30_000;
|
|
16
|
+
const DATABASE_AGENT_ID = 'database-agent';
|
|
17
|
+
const DATABASE_AGENT_TOOLS = [
|
|
18
|
+
'ListDatabases',
|
|
19
|
+
'ListDatabaseNodes',
|
|
20
|
+
'SearchDatabaseNodes',
|
|
21
|
+
'QueryDatabaseVectors',
|
|
22
|
+
'ReadDatabaseNode',
|
|
23
|
+
'ListDatabaseNodeVersions',
|
|
24
|
+
'CreateDatabaseNode',
|
|
25
|
+
'WriteDatabaseNode',
|
|
26
|
+
'DeleteDatabaseNode',
|
|
27
|
+
'MoveDatabaseNode',
|
|
28
|
+
'UpdateDatabaseNodeMeta',
|
|
29
|
+
];
|
|
30
|
+
const wid = (req) => req.params.id;
|
|
31
|
+
const databaseId = (req) => req.query.databaseId || store.getDefaultDatabase(wid(req)).id;
|
|
32
|
+
router.get('/agent-presets', (req, res) => {
|
|
33
|
+
res.json([readDatabaseAgent(wid(req))]);
|
|
34
|
+
});
|
|
35
|
+
router.get('/agent-presets/:presetId', (req, res) => {
|
|
36
|
+
if (req.params.presetId !== DATABASE_AGENT_ID)
|
|
37
|
+
return res.status(404).json({ error: 'database agent not found' });
|
|
38
|
+
res.json(readDatabaseAgent(wid(req)));
|
|
39
|
+
});
|
|
40
|
+
router.put('/agent-presets/:presetId', (req, res) => {
|
|
41
|
+
if (req.params.presetId !== DATABASE_AGENT_ID)
|
|
42
|
+
return res.status(404).json({ error: 'database agent not found' });
|
|
43
|
+
res.json(writeDatabaseAgent(wid(req), req.body));
|
|
44
|
+
});
|
|
45
|
+
router.post('/agent-presets/test-connection', async (req, res) => {
|
|
46
|
+
const result = await agentService.testConnection(wid(req), req.body);
|
|
47
|
+
if (!result)
|
|
48
|
+
return res.status(404).json({ error: 'workspace not found' });
|
|
49
|
+
res.status(result.success ? 200 : 400).json(result);
|
|
50
|
+
});
|
|
51
|
+
router.post('/agent-presets/generate', async (req, res) => {
|
|
52
|
+
const { prompt } = req.body;
|
|
53
|
+
if (!prompt?.trim())
|
|
54
|
+
return res.status(400).json({ error: 'prompt is required' });
|
|
55
|
+
try {
|
|
56
|
+
res.json(await generateAgentDesign(prompt));
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
res.status(400).json({ error: err instanceof Error ? err.message : 'agent generation failed' });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
router.post('/chat', async (req, res) => {
|
|
63
|
+
const workspaceId = wid(req);
|
|
64
|
+
const { message, history } = req.body;
|
|
65
|
+
const prompt = message?.trim();
|
|
66
|
+
if (!prompt)
|
|
67
|
+
return res.status(400).json({ error: 'message is required' });
|
|
68
|
+
const workspace = workspaceService.getById(workspaceId);
|
|
69
|
+
if (!workspace)
|
|
70
|
+
return res.status(404).json({ error: 'workspace not found' });
|
|
71
|
+
const agent = readDatabaseAgent(workspaceId);
|
|
72
|
+
if (agent.enabled === false)
|
|
73
|
+
return res.status(400).json({ error: 'database agent is disabled' });
|
|
74
|
+
const workingDir = workspace.boundDirs[0] || process.cwd();
|
|
75
|
+
const functionTools = createDatabaseFunctionTools(workspaceId, agent.tools);
|
|
76
|
+
const runtime = createAgentRuntime({
|
|
77
|
+
kind: agent.runtimeKind,
|
|
78
|
+
provider: agent.modelProvider,
|
|
79
|
+
model: agent.modelId,
|
|
80
|
+
apiKey: agent.apiKey,
|
|
81
|
+
baseURL: getRuntimeBaseURL(agent.modelProvider, agent.apiBase),
|
|
82
|
+
adapterBaseURL: agent.apiBase,
|
|
83
|
+
...getThinkingRuntimeConfig(agent),
|
|
84
|
+
});
|
|
85
|
+
const result = await runtime.execute(buildDatabaseAgentPrompt(workspaceId, agent, prompt, history ?? []), workingDir, {
|
|
86
|
+
maxTurns: 60,
|
|
87
|
+
functionTools,
|
|
88
|
+
mcpServers: {},
|
|
89
|
+
skills: [],
|
|
90
|
+
sandboxDirs: [],
|
|
91
|
+
outputStyle: agent.outputStyle,
|
|
92
|
+
});
|
|
93
|
+
const finalMessage = result.success
|
|
94
|
+
? extractFinalMessage(result.output, result.summary)
|
|
95
|
+
: result.error || extractFinalMessage(result.output, result.summary);
|
|
96
|
+
res.status(result.success ? 200 : 400).json({ finalMessage });
|
|
97
|
+
});
|
|
98
|
+
router.get('/databases', (req, res) => {
|
|
99
|
+
const databases = store.listDatabases(wid(req));
|
|
100
|
+
res.json(databases.length > 0 ? databases : [store.getDefaultDatabase(wid(req))]);
|
|
101
|
+
});
|
|
102
|
+
router.post('/databases', (req, res) => {
|
|
103
|
+
const database = store.createDatabase(wid(req), req.body);
|
|
104
|
+
res.status(201).json(database);
|
|
105
|
+
});
|
|
106
|
+
router.put('/databases/:databaseId', (req, res) => {
|
|
107
|
+
const database = store.updateDatabase(wid(req), req.params.databaseId, req.body);
|
|
108
|
+
if (!database)
|
|
109
|
+
return res.status(404).json({ error: 'Database not found' });
|
|
110
|
+
res.json(database);
|
|
111
|
+
});
|
|
112
|
+
router.get('/databases/:databaseId/vector', (req, res) => {
|
|
113
|
+
if (!store.getDatabase(wid(req), req.params.databaseId)) {
|
|
114
|
+
return res.status(404).json({ error: 'Database not found' });
|
|
115
|
+
}
|
|
116
|
+
res.json(store.getVectorStats(wid(req), req.params.databaseId));
|
|
117
|
+
});
|
|
118
|
+
router.put('/databases/:databaseId/vector', (req, res) => {
|
|
119
|
+
const { embeddingModelId } = req.body;
|
|
120
|
+
const database = store.setDatabaseEmbeddingModel(wid(req), req.params.databaseId, embeddingModelId || null);
|
|
121
|
+
if (!database)
|
|
122
|
+
return res.status(404).json({ error: 'Database not found' });
|
|
123
|
+
res.json(store.getVectorStats(wid(req), req.params.databaseId));
|
|
124
|
+
});
|
|
125
|
+
router.post('/databases/:databaseId/vector/index', async (req, res) => {
|
|
126
|
+
try {
|
|
127
|
+
res.json(await databaseVector.indexDatabaseVectors(wid(req), req.params.databaseId));
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
console.error('[database:vector:index] failed', {
|
|
131
|
+
workspaceId: wid(req),
|
|
132
|
+
databaseId: req.params.databaseId,
|
|
133
|
+
error: error instanceof Error ? error.message : String(error),
|
|
134
|
+
debug: error instanceof databaseVector.DatabaseVectorError ? error.debug : undefined,
|
|
135
|
+
});
|
|
136
|
+
res.status(400).json({
|
|
137
|
+
error: error instanceof Error ? error.message : String(error),
|
|
138
|
+
debug: error instanceof databaseVector.DatabaseVectorError ? error.debug : undefined,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
router.delete('/databases/:databaseId', (req, res) => {
|
|
143
|
+
if (!store.deleteDatabase(wid(req), req.params.databaseId)) {
|
|
144
|
+
return res.status(404).json({ error: 'Database not found' });
|
|
145
|
+
}
|
|
146
|
+
res.json({ ok: true });
|
|
147
|
+
});
|
|
148
|
+
// List all nodes
|
|
149
|
+
router.get('/', (req, res) => {
|
|
150
|
+
res.json(store.listNodes(wid(req), databaseId(req)));
|
|
151
|
+
});
|
|
152
|
+
// Get single node
|
|
153
|
+
router.get('/:nodeId', (req, res) => {
|
|
154
|
+
const node = store.getNode(wid(req), req.params.nodeId, databaseId(req));
|
|
155
|
+
if (!node)
|
|
156
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
157
|
+
res.json(node);
|
|
158
|
+
});
|
|
159
|
+
router.get('/:nodeId/versions', (req, res) => {
|
|
160
|
+
flushPendingContentSave(wid(req), databaseId(req), req.params.nodeId);
|
|
161
|
+
const limit = typeof req.query.limit === 'string' ? Number(req.query.limit) : 50;
|
|
162
|
+
const versions = store.listNodeVersions(wid(req), req.params.nodeId, databaseId(req), limit);
|
|
163
|
+
res.json(versions);
|
|
164
|
+
});
|
|
165
|
+
// Create node
|
|
166
|
+
router.post('/', (req, res) => {
|
|
167
|
+
const node = store.createNode(wid(req), { ...req.body, databaseId: databaseId(req) });
|
|
168
|
+
res.status(201).json(node);
|
|
169
|
+
});
|
|
170
|
+
// Update node
|
|
171
|
+
router.put('/:nodeId', (req, res) => {
|
|
172
|
+
const workspaceId = wid(req);
|
|
173
|
+
const activeDatabaseId = databaseId(req);
|
|
174
|
+
const nodeId = req.params.nodeId;
|
|
175
|
+
const body = req.body;
|
|
176
|
+
const { content, ...metadataUpdates } = body;
|
|
177
|
+
let node = Object.keys(metadataUpdates).length > 0
|
|
178
|
+
? store.updateNode(workspaceId, nodeId, metadataUpdates, activeDatabaseId)
|
|
179
|
+
: store.getNode(workspaceId, nodeId, activeDatabaseId);
|
|
180
|
+
if (!node)
|
|
181
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
182
|
+
if (typeof content === 'string') {
|
|
183
|
+
scheduleContentSave(workspaceId, activeDatabaseId, nodeId, content);
|
|
184
|
+
node = { ...node, content, updatedAt: Date.now() };
|
|
185
|
+
}
|
|
186
|
+
res.json(node);
|
|
187
|
+
});
|
|
188
|
+
// Move node (change parent)
|
|
189
|
+
router.put('/:nodeId/move', (req, res) => {
|
|
190
|
+
const { parentId } = req.body;
|
|
191
|
+
const node = store.moveNode(wid(req), req.params.nodeId, parentId ?? null, databaseId(req));
|
|
192
|
+
if (!node)
|
|
193
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
194
|
+
res.json(node);
|
|
195
|
+
});
|
|
196
|
+
// Trash node (soft delete)
|
|
197
|
+
router.put('/:nodeId/trash', (req, res) => {
|
|
198
|
+
const node = store.trashNode(wid(req), req.params.nodeId, databaseId(req));
|
|
199
|
+
if (!node)
|
|
200
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
201
|
+
res.json(node);
|
|
202
|
+
});
|
|
203
|
+
// Restore node from trash
|
|
204
|
+
router.put('/:nodeId/restore', (req, res) => {
|
|
205
|
+
const node = store.restoreNode(wid(req), req.params.nodeId, databaseId(req));
|
|
206
|
+
if (!node)
|
|
207
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
208
|
+
res.json(node);
|
|
209
|
+
});
|
|
210
|
+
// Delete node permanently
|
|
211
|
+
router.delete('/:nodeId', (req, res) => {
|
|
212
|
+
if (!store.deleteNode(wid(req), req.params.nodeId, databaseId(req))) {
|
|
213
|
+
return res.status(404).json({ error: 'Node not found' });
|
|
214
|
+
}
|
|
215
|
+
res.json({ ok: true });
|
|
216
|
+
});
|
|
217
|
+
function scheduleContentSave(workspaceId, activeDatabaseId, nodeId, content) {
|
|
218
|
+
const key = `${workspaceId}:${activeDatabaseId}:${nodeId}`;
|
|
219
|
+
const existing = pendingContentSaves.get(key);
|
|
220
|
+
if (existing)
|
|
221
|
+
clearTimeout(existing.timer);
|
|
222
|
+
const timer = setTimeout(() => {
|
|
223
|
+
flushPendingContentSave(workspaceId, activeDatabaseId, nodeId);
|
|
224
|
+
}, CONTENT_SAVE_IDLE_MS);
|
|
225
|
+
pendingContentSaves.set(key, { timer, content });
|
|
226
|
+
}
|
|
227
|
+
function flushPendingContentSave(workspaceId, activeDatabaseId, nodeId) {
|
|
228
|
+
const key = `${workspaceId}:${activeDatabaseId}:${nodeId}`;
|
|
229
|
+
const pending = pendingContentSaves.get(key);
|
|
230
|
+
if (!pending)
|
|
231
|
+
return;
|
|
232
|
+
clearTimeout(pending.timer);
|
|
233
|
+
pendingContentSaves.delete(key);
|
|
234
|
+
store.updateNode(workspaceId, nodeId, { content: pending.content }, activeDatabaseId);
|
|
235
|
+
}
|
|
236
|
+
function databaseAgentPath(workspaceId) {
|
|
237
|
+
return join(getDataDir(), 'workspaces', workspaceId, 'database', 'agent.json');
|
|
238
|
+
}
|
|
239
|
+
function readDatabaseAgent(workspaceId) {
|
|
240
|
+
const filePath = databaseAgentPath(workspaceId);
|
|
241
|
+
if (!existsSync(filePath))
|
|
242
|
+
return defaultDatabaseAgent();
|
|
243
|
+
try {
|
|
244
|
+
return normalizeDatabaseAgent(JSON.parse(readFileSync(filePath, 'utf-8')));
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return defaultDatabaseAgent();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function writeDatabaseAgent(workspaceId, input) {
|
|
251
|
+
const agent = normalizeDatabaseAgent(input);
|
|
252
|
+
ensureDir(join(getDataDir(), 'workspaces', workspaceId, 'database'));
|
|
253
|
+
writeFileSync(databaseAgentPath(workspaceId), JSON.stringify(agent, null, 2), 'utf-8');
|
|
254
|
+
return agent;
|
|
255
|
+
}
|
|
256
|
+
function defaultDatabaseAgent() {
|
|
257
|
+
return normalizeDatabaseAgent({
|
|
258
|
+
name: 'Database AI',
|
|
259
|
+
role: 'agent',
|
|
260
|
+
description: 'Knowledge base assistant for Agent Spaces database documents.',
|
|
261
|
+
runtimeKind: 'claude-code',
|
|
262
|
+
modelProvider: undefined,
|
|
263
|
+
modelId: '',
|
|
264
|
+
apiBase: '',
|
|
265
|
+
apiKey: '',
|
|
266
|
+
systemPrompt: [
|
|
267
|
+
'You are the database knowledge base assistant.',
|
|
268
|
+
'Answer from Agent Spaces database content when possible.',
|
|
269
|
+
'Use only the provided database tools for knowledge base operations.',
|
|
270
|
+
'Return only the final answer in concise Markdown.',
|
|
271
|
+
].join('\n'),
|
|
272
|
+
temperature: 0.2,
|
|
273
|
+
maxTokens: 4096,
|
|
274
|
+
enabled: true,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function normalizeDatabaseAgent(input) {
|
|
278
|
+
return {
|
|
279
|
+
id: DATABASE_AGENT_ID,
|
|
280
|
+
name: input.name?.trim() || 'Database AI',
|
|
281
|
+
role: 'agent',
|
|
282
|
+
description: input.description || '',
|
|
283
|
+
runtimeKind: input.runtimeKind || 'claude-code',
|
|
284
|
+
modelProvider: input.modelProvider,
|
|
285
|
+
modelId: input.modelId || '',
|
|
286
|
+
apiBase: input.apiBase || '',
|
|
287
|
+
apiKey: input.apiKey || '',
|
|
288
|
+
workingDir: '',
|
|
289
|
+
mcps: {},
|
|
290
|
+
skills: [],
|
|
291
|
+
tools: DATABASE_AGENT_TOOLS,
|
|
292
|
+
systemPrompt: input.systemPrompt || defaultDatabaseAgent().systemPrompt,
|
|
293
|
+
outputStyle: input.outputStyle,
|
|
294
|
+
temperature: input.temperature ?? 0.2,
|
|
295
|
+
maxTokens: input.maxTokens ?? 4096,
|
|
296
|
+
sandboxDirs: [],
|
|
297
|
+
maxRetries: input.maxRetries,
|
|
298
|
+
enabled: input.enabled ?? true,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function buildDatabaseAgentPrompt(workspaceId, agent, userMessage, history) {
|
|
302
|
+
const recentHistory = history
|
|
303
|
+
.slice(-12)
|
|
304
|
+
.map((item) => `${item.role === 'user' ? 'User' : 'Agent'}: ${item.content}`)
|
|
305
|
+
.join('\n\n');
|
|
306
|
+
return [
|
|
307
|
+
agent.systemPrompt?.trim(),
|
|
308
|
+
'Runtime constraints:',
|
|
309
|
+
`- Current workspace id: ${workspaceId}`,
|
|
310
|
+
'- MCP servers configured for this agent: none.',
|
|
311
|
+
`- Available database tools: ${DATABASE_AGENT_TOOLS.map((tool) => `mcp__agent-spaces__${tool}`).join(', ')}.`,
|
|
312
|
+
'- Use mcp__agent-spaces__ListDatabases when you need to know valid database IDs.',
|
|
313
|
+
'- If the user does not specify a database, omit databaseId and the first database will be used automatically.',
|
|
314
|
+
'- Never use the workspace id as databaseId.',
|
|
315
|
+
'- Do not use filesystem, command, issue, channel, web, or other non-database tools for knowledge base work.',
|
|
316
|
+
'- If you need database content, call the database tools before answering.',
|
|
317
|
+
'- Return only the final answer in Markdown. Do not include tool logs or implementation traces.',
|
|
318
|
+
recentHistory ? `Conversation history:\n${recentHistory}` : '',
|
|
319
|
+
`User message:\n${userMessage}`,
|
|
320
|
+
].filter(Boolean).join('\n\n');
|
|
321
|
+
}
|
|
322
|
+
function extractFinalMessage(output, fallback) {
|
|
323
|
+
const candidates = output
|
|
324
|
+
.map((line) => line.trim())
|
|
325
|
+
.filter((line) => {
|
|
326
|
+
if (!line)
|
|
327
|
+
return false;
|
|
328
|
+
if (/^\[Usage\]/i.test(line))
|
|
329
|
+
return false;
|
|
330
|
+
if (/^(Tool:|Todo:|Codex initialized\b|Claude Code initialized\b)/i.test(line))
|
|
331
|
+
return false;
|
|
332
|
+
if (/^\[Reasoning\]/i.test(line))
|
|
333
|
+
return false;
|
|
334
|
+
return true;
|
|
335
|
+
});
|
|
336
|
+
return candidates.at(-1) || fallback || '';
|
|
337
|
+
}
|
|
338
|
+
function getRuntimeBaseURL(provider, apiBase) {
|
|
339
|
+
if (provider === 'openai-responses-to-anthropic-messages'
|
|
340
|
+
|| provider === 'openai-chat-completions-to-anthropic-messages')
|
|
341
|
+
return undefined;
|
|
342
|
+
return apiBase;
|
|
343
|
+
}
|
|
344
|
+
export default router;
|
|
345
|
+
//# sourceMappingURL=database.js.map
|
package/dist/routes/git.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { gitStatus, gitDiff, gitLog, gitCommit, gitDiscard, gitDiscardAll, gitBranches, gitCheckout, gitInit, gitGenerateCommitMsg, gitPush, gitPull, gitGetRemotes, gitAddRemote, gitCheckoutDetached, gitCherryPick, gitCreateBranch, gitDeleteBranch, gitCreateTag, gitCommitDiff, gitGetRemoteUrl, gitMergeBase, gitGetConfig, gitSetConfig } from '../adapters/git.js';
|
|
2
|
+
import { gitStatus, gitDiff, gitLog, gitCommit, gitDiscard, gitDiscardAll, gitBranches, gitCheckout, gitInit, gitGenerateCommitMsg, gitPush, gitPull, gitFetch, gitGetRemotes, gitAddRemote, gitCheckoutDetached, gitCherryPick, gitCreateBranch, gitDeleteBranch, gitCreateTag, gitCommitDiff, gitGetRemoteUrl, gitMergeBase, gitGetConfig, gitSetConfig, gitStage, gitUnstage, gitResolveFile } from '../adapters/git.js';
|
|
3
3
|
const router = Router({ mergeParams: true });
|
|
4
4
|
router.get('/status', async (req, res) => {
|
|
5
5
|
try {
|
|
@@ -67,6 +67,48 @@ router.post('/discard-all', async (req, res) => {
|
|
|
67
67
|
res.status(500).json({ error: err.message });
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
|
+
router.post('/stage', async (req, res) => {
|
|
71
|
+
try {
|
|
72
|
+
const { path } = req.body;
|
|
73
|
+
if (!path) {
|
|
74
|
+
res.status(400).json({ error: 'path is required' });
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await gitStage(req.params.id, path);
|
|
78
|
+
res.json({ ok: true });
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
res.status(500).json({ error: err.message });
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
router.post('/unstage', async (req, res) => {
|
|
85
|
+
try {
|
|
86
|
+
const { path } = req.body;
|
|
87
|
+
if (!path) {
|
|
88
|
+
res.status(400).json({ error: 'path is required' });
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await gitUnstage(req.params.id, path);
|
|
92
|
+
res.json({ ok: true });
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
res.status(500).json({ error: err.message });
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
router.post('/resolve-file', async (req, res) => {
|
|
99
|
+
try {
|
|
100
|
+
const { path, content, stage } = req.body;
|
|
101
|
+
if (!path || typeof content !== 'string') {
|
|
102
|
+
res.status(400).json({ error: 'path and content are required' });
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await gitResolveFile(req.params.id, path, content, stage !== false);
|
|
106
|
+
res.json({ ok: true });
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
res.status(500).json({ error: err.message });
|
|
110
|
+
}
|
|
111
|
+
});
|
|
70
112
|
router.get('/branches', async (req, res) => {
|
|
71
113
|
try {
|
|
72
114
|
const result = await gitBranches(req.params.id);
|
|
@@ -108,6 +150,15 @@ router.post('/generate-commit-message', async (req, res) => {
|
|
|
108
150
|
res.status(500).json({ error: err.message });
|
|
109
151
|
}
|
|
110
152
|
});
|
|
153
|
+
router.post('/fetch', async (req, res) => {
|
|
154
|
+
try {
|
|
155
|
+
await gitFetch(req.params.id);
|
|
156
|
+
res.json({ ok: true });
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
res.status(500).json({ error: err.message });
|
|
160
|
+
}
|
|
161
|
+
});
|
|
111
162
|
router.post('/push', async (req, res) => {
|
|
112
163
|
try {
|
|
113
164
|
await gitPush(req.params.id);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import * as store from '../storage/hook-store.js';
|
|
3
|
+
const router = Router({ mergeParams: true });
|
|
4
|
+
router.get('/', (req, res) => {
|
|
5
|
+
try {
|
|
6
|
+
res.json(store.listHooks(req.params.id));
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
res.status(500).json({ error: error.message });
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
router.get('/:name', (req, res) => {
|
|
13
|
+
try {
|
|
14
|
+
const hook = store.getHook(req.params.id, req.params.name);
|
|
15
|
+
if (!hook) {
|
|
16
|
+
res.status(404).json({ error: 'Hook not found' });
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
res.json(hook);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
res.status(500).json({ error: error.message });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
router.post('/', (req, res) => {
|
|
26
|
+
try {
|
|
27
|
+
const config = req.body;
|
|
28
|
+
if (!config.name) {
|
|
29
|
+
res.status(400).json({ error: 'name required' });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
store.saveHook(req.params.id, config);
|
|
33
|
+
res.status(201).json(config);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
res.status(400).json({ error: error.message });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
router.put('/:name', (req, res) => {
|
|
40
|
+
try {
|
|
41
|
+
const config = req.body;
|
|
42
|
+
config.name = req.params.name;
|
|
43
|
+
store.saveHook(req.params.id, config);
|
|
44
|
+
res.json(config);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
res.status(400).json({ error: error.message });
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
router.delete('/:name', (req, res) => {
|
|
51
|
+
try {
|
|
52
|
+
store.deleteHook(req.params.id, req.params.name);
|
|
53
|
+
res.status(204).send();
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
res.status(400).json({ error: error.message });
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
router.post('/upload', (req, res) => {
|
|
60
|
+
try {
|
|
61
|
+
const { content } = req.body;
|
|
62
|
+
if (!content || typeof content !== 'string') {
|
|
63
|
+
res.status(400).json({ error: 'content (string) required' });
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const config = store.uploadHook(req.params.id, content);
|
|
67
|
+
res.status(201).json(config);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
res.status(400).json({ error: error.message });
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
router.post('/:name/apply', (req, res) => {
|
|
74
|
+
try {
|
|
75
|
+
const { targetWorkspaceId } = req.body;
|
|
76
|
+
if (!targetWorkspaceId) {
|
|
77
|
+
res.status(400).json({ error: 'targetWorkspaceId required' });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
store.applyToWorkspace(req.params.id, req.params.name, targetWorkspaceId);
|
|
81
|
+
res.json({ ok: true });
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
res.status(400).json({ error: error.message });
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
export default router;
|
|
88
|
+
//# sourceMappingURL=hooks.js.map
|
package/dist/routes/issue.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as agentService from '../services/agent.js';
|
|
|
8
8
|
import * as taskService from '../services/task.js';
|
|
9
9
|
import { retryIssue } from '../services/issue-retry.js';
|
|
10
10
|
import { hasActiveIssueAutomation, runIssueAutomation } from '../agents/issue-agent-runner.js';
|
|
11
|
+
import { continueIssueTaskScheduling, stopIssueAutomation } from '../agents/issue-task-controller.js';
|
|
11
12
|
import * as workflowService from '../services/workflow.js';
|
|
12
13
|
const router = Router({ mergeParams: true });
|
|
13
14
|
router.get('/', (req, res) => {
|
|
@@ -48,13 +49,15 @@ router.put('/:issueId', (req, res) => {
|
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
const previousStatus = issue.status;
|
|
51
|
-
const { title, description, status, members, workflowId } = req.body;
|
|
52
|
+
const { title, description, status, members, workflowId, continuousRun } = req.body;
|
|
52
53
|
if (title)
|
|
53
54
|
issue.title = title;
|
|
54
55
|
if (description !== undefined)
|
|
55
56
|
issue.description = description;
|
|
56
57
|
if (workflowId !== undefined)
|
|
57
58
|
issue.workflowId = workflowId || undefined;
|
|
59
|
+
if (continuousRun !== undefined)
|
|
60
|
+
issue.continuousRun = continuousRun !== false;
|
|
58
61
|
if (members !== undefined) {
|
|
59
62
|
issue.members = normalizeIssueMembers(req.params.id, mergeWorkflowMembers(members, issue.workflowId));
|
|
60
63
|
}
|
|
@@ -142,6 +145,61 @@ router.post('/:issueId/resume', async (req, res) => {
|
|
|
142
145
|
}
|
|
143
146
|
res.json(result.issue);
|
|
144
147
|
});
|
|
148
|
+
router.post('/:issueId/continue', (req, res) => {
|
|
149
|
+
const workspaceId = req.params.id;
|
|
150
|
+
const { issueId } = req.params;
|
|
151
|
+
const before = issueService.getById(workspaceId, issueId);
|
|
152
|
+
if (!before) {
|
|
153
|
+
res.status(404).json({ error: 'issue not found' });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const issue = before.status === 'draft' || before.status === 'planned'
|
|
157
|
+
? issueService.updateStatus(workspaceId, issueId, 'in_progress')
|
|
158
|
+
: before;
|
|
159
|
+
if (!issue) {
|
|
160
|
+
res.status(404).json({ error: 'issue not found' });
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (issue.status !== before.status) {
|
|
164
|
+
broadcastToWorkspace(workspaceId, 'issue.status_changed', { issueId, from: before.status, to: issue.status });
|
|
165
|
+
}
|
|
166
|
+
broadcastToWorkspace(workspaceId, 'issue.updated', issue);
|
|
167
|
+
res.json(issue);
|
|
168
|
+
const ctx = {
|
|
169
|
+
workspaceId,
|
|
170
|
+
broadcast: (event, data) => broadcastToWorkspace(workspaceId, event, data),
|
|
171
|
+
getSession: (sessionId) => agentService.getById(workspaceId, sessionId),
|
|
172
|
+
updateSessionStatus: (sessionId, status, extra) => agentService.updateStatus(workspaceId, sessionId, status, extra),
|
|
173
|
+
};
|
|
174
|
+
continueIssueTaskScheduling(workspaceId, issueId, ctx).catch((err) => {
|
|
175
|
+
console.error(`[issue-continue] scheduling error for issue ${issueId}:`, err);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
router.post('/:issueId/interrupt', (req, res) => {
|
|
179
|
+
const workspaceId = req.params.id;
|
|
180
|
+
const { issueId } = req.params;
|
|
181
|
+
const before = issueService.getById(workspaceId, issueId);
|
|
182
|
+
if (!before) {
|
|
183
|
+
res.status(404).json({ error: 'issue not found' });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const reason = 'Interrupted by user';
|
|
187
|
+
const failedTasks = stopIssueAutomation(workspaceId, issueId, reason);
|
|
188
|
+
for (const { task, from } of failedTasks) {
|
|
189
|
+
broadcastToWorkspace(workspaceId, 'task.status_changed', { taskId: task.id, from, to: task.status });
|
|
190
|
+
broadcastToWorkspace(workspaceId, 'task.updated', task);
|
|
191
|
+
}
|
|
192
|
+
if (before.channelId)
|
|
193
|
+
stopChannelRuns(workspaceId, before.channelId);
|
|
194
|
+
const issue = issueService.markError(workspaceId, issueId, reason);
|
|
195
|
+
if (!issue) {
|
|
196
|
+
res.status(404).json({ error: 'issue not found' });
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
broadcastToWorkspace(workspaceId, 'issue.status_changed', { issueId, from: before.status, to: 'error' });
|
|
200
|
+
broadcastToWorkspace(workspaceId, 'issue.updated', issue);
|
|
201
|
+
res.json(issue);
|
|
202
|
+
});
|
|
145
203
|
router.delete('/:issueId', (req, res) => {
|
|
146
204
|
const { id, issueId } = req.params;
|
|
147
205
|
const issue = issueService.getById(id, issueId);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import * as svc from '../services/kanban.js';
|
|
3
|
+
const router = Router({ mergeParams: true });
|
|
4
|
+
// GET /api/workspaces/:id/kanban — 获取或初始化 board
|
|
5
|
+
router.get('/', (req, res) => {
|
|
6
|
+
const workspaceId = req.params.id;
|
|
7
|
+
if (!workspaceId) {
|
|
8
|
+
res.status(400).json({ error: 'workspaceId required' });
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const board = svc.ensureBoard(workspaceId);
|
|
13
|
+
res.json(board);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
res.status(500).json({ error: error.message });
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
// PUT /api/workspaces/:id/kanban — 保存完整 board 状态
|
|
20
|
+
router.put('/', (req, res) => {
|
|
21
|
+
const workspaceId = req.params.id;
|
|
22
|
+
if (!workspaceId) {
|
|
23
|
+
res.status(400).json({ error: 'workspaceId required' });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const board = svc.saveBoard(workspaceId, req.body);
|
|
28
|
+
if (!board) {
|
|
29
|
+
res.status(404).json({ error: 'Board not found' });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
res.json(board);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
res.status(400).json({ error: error.message });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export default router;
|
|
39
|
+
//# sourceMappingURL=kanban.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { listOutputStyles, createOutputStyle, updateOutputStyle, deleteOutputStyle, applyOutputStyleToAgents, listOutputStyleAgentCandidates, } from '../services/output-style.js';
|
|
3
|
+
const router = Router();
|
|
4
|
+
router.get('/', (_req, res) => {
|
|
5
|
+
res.json(listOutputStyles());
|
|
6
|
+
});
|
|
7
|
+
router.get('/agents', (_req, res) => {
|
|
8
|
+
res.json(listOutputStyleAgentCandidates());
|
|
9
|
+
});
|
|
10
|
+
router.post('/', (req, res) => {
|
|
11
|
+
const { name, content, storeId, description } = req.body;
|
|
12
|
+
if (!name || !content) {
|
|
13
|
+
res.status(400).json({ error: 'name and content required' });
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
res.json(createOutputStyle(name, content, storeId, description));
|
|
17
|
+
});
|
|
18
|
+
router.put('/:id', (req, res) => {
|
|
19
|
+
const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
|
|
20
|
+
const data = req.body;
|
|
21
|
+
const tmpl = updateOutputStyle(id, data);
|
|
22
|
+
if (!tmpl) {
|
|
23
|
+
res.status(404).json({ error: 'Not found' });
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
res.json(tmpl);
|
|
27
|
+
});
|
|
28
|
+
router.delete('/:id', (req, res) => {
|
|
29
|
+
const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
|
|
30
|
+
const ok = deleteOutputStyle(id);
|
|
31
|
+
if (!ok) {
|
|
32
|
+
res.status(404).json({ error: 'Not found' });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
res.json({ success: true });
|
|
36
|
+
});
|
|
37
|
+
router.post('/:id/apply', (req, res) => {
|
|
38
|
+
const id = typeof req.params.id === 'string' ? req.params.id : req.params.id[0];
|
|
39
|
+
const { agentIds } = req.body;
|
|
40
|
+
if (!agentIds?.length) {
|
|
41
|
+
res.status(400).json({ error: 'agentIds required' });
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const applied = applyOutputStyleToAgents(id, agentIds);
|
|
45
|
+
res.json({ applied });
|
|
46
|
+
});
|
|
47
|
+
export default router;
|
|
48
|
+
//# sourceMappingURL=output-style.js.map
|