@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,244 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import * as databaseStore from '../storage/database-store.js';
|
|
3
|
+
import * as llmStore from '../storage/llm-store.js';
|
|
4
|
+
const INDEX_BATCH_SIZE = 16;
|
|
5
|
+
const MAX_INDEX_TEXT_LENGTH = 24_000;
|
|
6
|
+
export class DatabaseVectorError extends Error {
|
|
7
|
+
debug;
|
|
8
|
+
constructor(message, debug) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'DatabaseVectorError';
|
|
11
|
+
this.debug = debug;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export async function indexDatabaseVectors(workspaceId, databaseId) {
|
|
15
|
+
const database = databaseStore.getDatabase(workspaceId, databaseId);
|
|
16
|
+
if (!database)
|
|
17
|
+
throw new Error(`Database not found: ${databaseId}`);
|
|
18
|
+
if (!database.embeddingModelId)
|
|
19
|
+
throw new Error('Embedding model is not bound to this database.');
|
|
20
|
+
const config = requireEmbeddingModelConfig(database.embeddingModelId);
|
|
21
|
+
const nodes = databaseStore.listNodes(workspaceId, databaseId).filter((node) => !node.isTrash);
|
|
22
|
+
const records = nodes
|
|
23
|
+
.map((node) => ({
|
|
24
|
+
node,
|
|
25
|
+
path: buildDatabaseNodePath(node, nodes),
|
|
26
|
+
text: normalizeIndexText(`${node.title}\n${stripHtml(node.content)}`),
|
|
27
|
+
}))
|
|
28
|
+
.filter((item) => item.text.length > 0);
|
|
29
|
+
let indexedCount = 0;
|
|
30
|
+
for (let index = 0; index < records.length; index += INDEX_BATCH_SIZE) {
|
|
31
|
+
const batch = records.slice(index, index + INDEX_BATCH_SIZE);
|
|
32
|
+
const batchDebug = {
|
|
33
|
+
batchStart: index,
|
|
34
|
+
batchSize: batch.length,
|
|
35
|
+
indexedCount,
|
|
36
|
+
};
|
|
37
|
+
console.info('[database-vector:index] embedding batch', {
|
|
38
|
+
workspaceId,
|
|
39
|
+
databaseId,
|
|
40
|
+
modelId: config.model.modelId,
|
|
41
|
+
providerName: config.provider.name,
|
|
42
|
+
...batchDebug,
|
|
43
|
+
inputLengths: batch.map((item) => item.text.length),
|
|
44
|
+
});
|
|
45
|
+
const embeddings = await embedTexts(config, batch.map((item) => item.text), batchDebug);
|
|
46
|
+
embeddings.forEach((embedding, offset) => {
|
|
47
|
+
const item = batch[offset];
|
|
48
|
+
databaseStore.upsertDatabaseEmbedding(workspaceId, databaseId, {
|
|
49
|
+
nodeId: item.node.id,
|
|
50
|
+
title: item.node.title,
|
|
51
|
+
path: item.path,
|
|
52
|
+
content: item.text,
|
|
53
|
+
contentHash: hashText(item.text),
|
|
54
|
+
embedding,
|
|
55
|
+
modelId: config.model.modelId,
|
|
56
|
+
agentId: config.model.id,
|
|
57
|
+
});
|
|
58
|
+
indexedCount++;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
databaseStore.deleteStaleDatabaseEmbeddings(workspaceId, databaseId, records.map((item) => item.node.id));
|
|
62
|
+
return {
|
|
63
|
+
...databaseStore.getVectorStats(workspaceId, databaseId),
|
|
64
|
+
indexedCount,
|
|
65
|
+
skippedCount: nodes.length - records.length,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export async function searchDatabaseVectors(workspaceId, databaseId, query, limit = 5) {
|
|
69
|
+
const database = databaseStore.getDatabase(workspaceId, databaseId);
|
|
70
|
+
if (!database)
|
|
71
|
+
throw new Error(`Database not found: ${databaseId}`);
|
|
72
|
+
if (!database.embeddingModelId)
|
|
73
|
+
throw new Error('Embedding model is not bound to this database.');
|
|
74
|
+
const cleanQuery = normalizeIndexText(query);
|
|
75
|
+
if (!cleanQuery)
|
|
76
|
+
throw new Error('query is required.');
|
|
77
|
+
const config = requireEmbeddingModelConfig(database.embeddingModelId);
|
|
78
|
+
const [queryEmbedding] = await embedTexts(config, [cleanQuery]);
|
|
79
|
+
return databaseStore.listDatabaseEmbeddings(workspaceId, databaseId)
|
|
80
|
+
.map((row) => ({
|
|
81
|
+
nodeId: row.nodeId,
|
|
82
|
+
title: row.title,
|
|
83
|
+
path: row.path,
|
|
84
|
+
content: row.content,
|
|
85
|
+
updatedAt: row.updatedAt,
|
|
86
|
+
score: cosineSimilarity(queryEmbedding, row.embedding),
|
|
87
|
+
}))
|
|
88
|
+
.sort((a, b) => b.score - a.score)
|
|
89
|
+
.slice(0, Math.max(1, Math.min(limit, 20)));
|
|
90
|
+
}
|
|
91
|
+
function requireEmbeddingModelConfig(modelId) {
|
|
92
|
+
const model = llmStore.getModel(modelId);
|
|
93
|
+
if (!model)
|
|
94
|
+
throw new Error(`Embedding model not found: ${modelId}`);
|
|
95
|
+
if (!model.embedding)
|
|
96
|
+
throw new Error(`Selected model is not marked as an embedding model: ${model.name}`);
|
|
97
|
+
const provider = llmStore.listProviders().find((item) => item.name === model.provider);
|
|
98
|
+
if (!provider)
|
|
99
|
+
throw new Error(`Provider not found for embedding model: ${model.provider}`);
|
|
100
|
+
if (!provider.apiBase || !provider.apiKey || !model.modelId) {
|
|
101
|
+
throw new Error(`Embedding provider is missing apiBase, apiKey, or modelId: ${provider.name}`);
|
|
102
|
+
}
|
|
103
|
+
return { model, provider };
|
|
104
|
+
}
|
|
105
|
+
async function embedTexts(config, input, extraDebug = {}) {
|
|
106
|
+
const requestUrl = getEmbeddingsUrl(config.provider.apiBase);
|
|
107
|
+
const requestDebug = {
|
|
108
|
+
stage: 'embedding_request',
|
|
109
|
+
providerName: config.provider.name,
|
|
110
|
+
modelId: config.model.modelId,
|
|
111
|
+
requestUrl,
|
|
112
|
+
inputCount: input.length,
|
|
113
|
+
inputLengths: input.map((item) => item.length),
|
|
114
|
+
...extraDebug,
|
|
115
|
+
};
|
|
116
|
+
console.info('[database-vector:embed] request', requestDebug);
|
|
117
|
+
const response = await fetch(requestUrl, {
|
|
118
|
+
method: 'POST',
|
|
119
|
+
headers: {
|
|
120
|
+
Authorization: `Bearer ${config.provider.apiKey}`,
|
|
121
|
+
'Content-Type': 'application/json',
|
|
122
|
+
},
|
|
123
|
+
body: JSON.stringify({
|
|
124
|
+
model: config.model.modelId,
|
|
125
|
+
input,
|
|
126
|
+
}),
|
|
127
|
+
});
|
|
128
|
+
const responseText = await response.text();
|
|
129
|
+
const responseDebugBase = {
|
|
130
|
+
...requestDebug,
|
|
131
|
+
stage: 'embedding_response',
|
|
132
|
+
status: response.status,
|
|
133
|
+
responseContentType: response.headers.get('content-type'),
|
|
134
|
+
};
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
const debug = {
|
|
137
|
+
...responseDebugBase,
|
|
138
|
+
responsePreview: responseText.slice(0, 1000),
|
|
139
|
+
};
|
|
140
|
+
console.warn('[database-vector:embed] failed response', debug);
|
|
141
|
+
throw new DatabaseVectorError(`Embedding request failed with status ${response.status}`, debug);
|
|
142
|
+
}
|
|
143
|
+
let data;
|
|
144
|
+
try {
|
|
145
|
+
data = JSON.parse(responseText);
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
const debug = {
|
|
149
|
+
...responseDebugBase,
|
|
150
|
+
stage: 'embedding_parse_json',
|
|
151
|
+
responsePreview: responseText.slice(0, 1000),
|
|
152
|
+
};
|
|
153
|
+
console.warn('[database-vector:embed] invalid json', debug);
|
|
154
|
+
throw new DatabaseVectorError('Embedding response is not valid JSON.', debug);
|
|
155
|
+
}
|
|
156
|
+
const responseData = isRecord(data) && Array.isArray(data.data) ? data.data : undefined;
|
|
157
|
+
const embeddings = responseData
|
|
158
|
+
?.map((item) => isRecord(item) ? item.embedding : undefined)
|
|
159
|
+
.filter((item) => Array.isArray(item) && item.every((value) => typeof value === 'number'));
|
|
160
|
+
const debug = {
|
|
161
|
+
...responseDebugBase,
|
|
162
|
+
responseDataCount: responseData?.length,
|
|
163
|
+
validEmbeddingCount: embeddings?.length ?? 0,
|
|
164
|
+
embeddingDimensions: embeddings?.map((embedding) => embedding.length).slice(0, 10),
|
|
165
|
+
responseKeys: isRecord(data) ? Object.keys(data) : undefined,
|
|
166
|
+
responsePreview: previewEmbeddingResponse(data),
|
|
167
|
+
};
|
|
168
|
+
console.info('[database-vector:embed] parsed response', debug);
|
|
169
|
+
if (!embeddings || embeddings.length !== input.length) {
|
|
170
|
+
throw new DatabaseVectorError(`Embedding response does not match input length. expected=${input.length}, data=${responseData?.length ?? 0}, validEmbeddings=${embeddings?.length ?? 0}`, debug);
|
|
171
|
+
}
|
|
172
|
+
return embeddings;
|
|
173
|
+
}
|
|
174
|
+
function isRecord(value) {
|
|
175
|
+
return Boolean(value && typeof value === 'object' && !Array.isArray(value));
|
|
176
|
+
}
|
|
177
|
+
function previewEmbeddingResponse(value) {
|
|
178
|
+
if (!isRecord(value))
|
|
179
|
+
return value;
|
|
180
|
+
const data = Array.isArray(value.data)
|
|
181
|
+
? value.data.slice(0, 3).map((item) => {
|
|
182
|
+
if (!isRecord(item))
|
|
183
|
+
return item;
|
|
184
|
+
const embedding = Array.isArray(item.embedding) ? item.embedding : undefined;
|
|
185
|
+
return {
|
|
186
|
+
...item,
|
|
187
|
+
embedding: embedding ? `[number[${embedding.length}]]` : item.embedding,
|
|
188
|
+
};
|
|
189
|
+
})
|
|
190
|
+
: value.data;
|
|
191
|
+
return {
|
|
192
|
+
...value,
|
|
193
|
+
data,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function getEmbeddingsUrl(apiBase) {
|
|
197
|
+
const base = apiBase.replace(/\/+$/, '');
|
|
198
|
+
if (base.endsWith('/embeddings'))
|
|
199
|
+
return base;
|
|
200
|
+
return `${base}/embeddings`;
|
|
201
|
+
}
|
|
202
|
+
function normalizeIndexText(text) {
|
|
203
|
+
return text.replace(/\s+/g, ' ').trim().slice(0, MAX_INDEX_TEXT_LENGTH);
|
|
204
|
+
}
|
|
205
|
+
function stripHtml(content) {
|
|
206
|
+
return content
|
|
207
|
+
.replace(/<style[\s\S]*?<\/style>/gi, ' ')
|
|
208
|
+
.replace(/<script[\s\S]*?<\/script>/gi, ' ')
|
|
209
|
+
.replace(/<[^>]+>/g, ' ');
|
|
210
|
+
}
|
|
211
|
+
function hashText(text) {
|
|
212
|
+
return createHash('sha256').update(text).digest('hex');
|
|
213
|
+
}
|
|
214
|
+
function cosineSimilarity(a, b) {
|
|
215
|
+
if (a.length !== b.length || a.length === 0)
|
|
216
|
+
return 0;
|
|
217
|
+
let dot = 0;
|
|
218
|
+
let ma = 0;
|
|
219
|
+
let mb = 0;
|
|
220
|
+
for (let index = 0; index < a.length; index++) {
|
|
221
|
+
dot += a[index] * b[index];
|
|
222
|
+
ma += a[index] * a[index];
|
|
223
|
+
mb += b[index] * b[index];
|
|
224
|
+
}
|
|
225
|
+
if (!ma || !mb)
|
|
226
|
+
return 0;
|
|
227
|
+
return dot / (Math.sqrt(ma) * Math.sqrt(mb));
|
|
228
|
+
}
|
|
229
|
+
function buildDatabaseNodePath(node, nodes) {
|
|
230
|
+
const byId = new Map(nodes.map((item) => [item.id, item]));
|
|
231
|
+
const parts = [node.title || node.id];
|
|
232
|
+
let parentId = node.parentId;
|
|
233
|
+
let guard = 0;
|
|
234
|
+
while (parentId && guard < 100) {
|
|
235
|
+
const parent = byId.get(parentId);
|
|
236
|
+
if (!parent)
|
|
237
|
+
break;
|
|
238
|
+
parts.unshift(parent.title || parent.id);
|
|
239
|
+
parentId = parent.parentId;
|
|
240
|
+
guard++;
|
|
241
|
+
}
|
|
242
|
+
return `/${parts.join('/')}`;
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=database-vector.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { listHooks } from '../storage/hook-store.js';
|
|
3
|
+
function matchToolName(matcher, toolName) {
|
|
4
|
+
if (matcher === '*')
|
|
5
|
+
return true;
|
|
6
|
+
if (matcher.startsWith('/') && matcher.endsWith('/')) {
|
|
7
|
+
try {
|
|
8
|
+
const regex = new RegExp(matcher.slice(1, -1));
|
|
9
|
+
return regex.test(toolName);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return matcher === toolName;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return matcher === toolName;
|
|
16
|
+
}
|
|
17
|
+
function executeCommand(command, env, timeout) {
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
exec(command, { env: { ...process.env, ...env }, timeout: Math.min(timeout, 30000) }, (error) => {
|
|
20
|
+
if (error)
|
|
21
|
+
console.warn(`[HookEngine] command error: ${error.message}`);
|
|
22
|
+
resolve();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
async function executeWebhook(url, body, timeout) {
|
|
27
|
+
try {
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timer = setTimeout(() => controller.abort(), Math.min(timeout, 30000));
|
|
30
|
+
await fetch(url, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: { 'Content-Type': 'application/json' },
|
|
33
|
+
body: JSON.stringify(body),
|
|
34
|
+
signal: controller.signal,
|
|
35
|
+
});
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
console.warn(`[HookEngine] webhook error: ${error.message}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function executeRule(rule, phase, toolName, workspaceId, context) {
|
|
43
|
+
const timeout = rule.timeout ?? 10000;
|
|
44
|
+
if (rule.type === 'command' && rule.command) {
|
|
45
|
+
await executeCommand(rule.command, {
|
|
46
|
+
HOOK_TOOL_NAME: toolName,
|
|
47
|
+
HOOK_TOOL_INPUT: JSON.stringify(context.toolInput ?? {}),
|
|
48
|
+
HOOK_TOOL_RESULT: JSON.stringify(context.toolResult ?? ''),
|
|
49
|
+
HOOK_WORKSPACE_ID: workspaceId,
|
|
50
|
+
HOOK_PHASE: phase,
|
|
51
|
+
}, timeout);
|
|
52
|
+
}
|
|
53
|
+
else if (rule.type === 'webhook' && rule.url) {
|
|
54
|
+
await executeWebhook(rule.url, {
|
|
55
|
+
event: phase,
|
|
56
|
+
toolName,
|
|
57
|
+
toolInput: context.toolInput,
|
|
58
|
+
toolResult: context.toolResult ?? undefined,
|
|
59
|
+
timestamp: new Date().toISOString(),
|
|
60
|
+
workspaceId,
|
|
61
|
+
}, timeout);
|
|
62
|
+
}
|
|
63
|
+
else if (rule.type === 'script') {
|
|
64
|
+
console.warn(`[HookEngine] script type not implemented, skipping rule in ${phase}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export class HookEngine {
|
|
68
|
+
hooks = [];
|
|
69
|
+
workspaceId;
|
|
70
|
+
constructor(workspaceId) {
|
|
71
|
+
this.workspaceId = workspaceId;
|
|
72
|
+
}
|
|
73
|
+
load() {
|
|
74
|
+
this.hooks = listHooks(this.workspaceId);
|
|
75
|
+
}
|
|
76
|
+
reload() {
|
|
77
|
+
this.load();
|
|
78
|
+
}
|
|
79
|
+
getHooks() {
|
|
80
|
+
return this.hooks;
|
|
81
|
+
}
|
|
82
|
+
async executeHooks(phase, toolName, context) {
|
|
83
|
+
const enabledHooks = this.hooks.filter(h => h.enabled);
|
|
84
|
+
const promises = [];
|
|
85
|
+
for (const hook of enabledHooks) {
|
|
86
|
+
const rules = hook.hooks[phase];
|
|
87
|
+
if (!rules)
|
|
88
|
+
continue;
|
|
89
|
+
for (const rule of rules) {
|
|
90
|
+
if (matchToolName(rule.matcher, toolName)) {
|
|
91
|
+
promises.push(executeRule(rule, phase, toolName, this.workspaceId, context));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
await Promise.allSettled(promises);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function wrapOnEventWithHooks(onEvent, workspaceId, hooksEnabled) {
|
|
99
|
+
if (!hooksEnabled)
|
|
100
|
+
return onEvent;
|
|
101
|
+
const engine = new HookEngine(workspaceId);
|
|
102
|
+
engine.load();
|
|
103
|
+
const toolNameById = new Map();
|
|
104
|
+
return (event) => {
|
|
105
|
+
onEvent(event);
|
|
106
|
+
if (event.type === 'tool_use') {
|
|
107
|
+
toolNameById.set(event.id, event.name);
|
|
108
|
+
engine.executeHooks('PreToolUse', event.name, { toolInput: event.input });
|
|
109
|
+
}
|
|
110
|
+
if (event.type === 'tool_result') {
|
|
111
|
+
const toolName = event.toolUseId ? (toolNameById.get(event.toolUseId) ?? '') : '';
|
|
112
|
+
if (toolName) {
|
|
113
|
+
engine.executeHooks('PostToolUse', toolName, { toolResult: event.result });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=hook-engine.js.map
|
package/dist/services/issue.js
CHANGED
|
@@ -35,6 +35,10 @@ function ensureRetryDefaults(workspaceId, issue) {
|
|
|
35
35
|
issue.maxRetries = 3;
|
|
36
36
|
changed = true;
|
|
37
37
|
}
|
|
38
|
+
if (issue.continuousRun === undefined) {
|
|
39
|
+
issue.continuousRun = true;
|
|
40
|
+
changed = true;
|
|
41
|
+
}
|
|
38
42
|
if (changed)
|
|
39
43
|
updateIssue({ ...issue, workspaceId });
|
|
40
44
|
}
|
|
@@ -70,6 +74,7 @@ export function create(workspaceId, input) {
|
|
|
70
74
|
tasks: [],
|
|
71
75
|
members: input.members || [],
|
|
72
76
|
workflowId: input.workflowId,
|
|
77
|
+
continuousRun: true,
|
|
73
78
|
retryCount: 0,
|
|
74
79
|
maxRetries: 3,
|
|
75
80
|
createdAt: now,
|
|
@@ -94,6 +99,7 @@ export function createForChannel(workspaceId, channelId, input) {
|
|
|
94
99
|
status: input.status ?? 'draft',
|
|
95
100
|
tasks: [],
|
|
96
101
|
members: [...issueMembers],
|
|
102
|
+
continuousRun: true,
|
|
97
103
|
retryCount: 0,
|
|
98
104
|
maxRetries: 3,
|
|
99
105
|
createdAt: now,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as store from '../storage/kanban-store.js';
|
|
2
|
+
export function getBoard(workspaceId) {
|
|
3
|
+
return store.getBoard(workspaceId);
|
|
4
|
+
}
|
|
5
|
+
export function ensureBoard(workspaceId) {
|
|
6
|
+
let board = store.getBoard(workspaceId);
|
|
7
|
+
if (!board) {
|
|
8
|
+
board = store.createBoard(workspaceId);
|
|
9
|
+
const defaultColumns = [
|
|
10
|
+
{ id: 'todo', title: 'To Do', color: 'sky', order: 0 },
|
|
11
|
+
{ id: 'progress', title: 'In Progress', color: 'amber', order: 1 },
|
|
12
|
+
{ id: 'done', title: 'Done', color: 'emerald', order: 2 },
|
|
13
|
+
{ id: 'archive', title: 'Archive', color: 'slate', order: 3 },
|
|
14
|
+
];
|
|
15
|
+
store.saveColumns(board.id, defaultColumns);
|
|
16
|
+
board = store.getBoard(workspaceId);
|
|
17
|
+
}
|
|
18
|
+
return board;
|
|
19
|
+
}
|
|
20
|
+
export function updateBoard(workspaceId, updates) {
|
|
21
|
+
return store.updateBoard(workspaceId, updates);
|
|
22
|
+
}
|
|
23
|
+
export function saveColumns(workspaceId, columns) {
|
|
24
|
+
const board = store.getBoard(workspaceId);
|
|
25
|
+
if (!board)
|
|
26
|
+
return null;
|
|
27
|
+
store.saveColumns(board.id, columns);
|
|
28
|
+
return store.getBoard(workspaceId);
|
|
29
|
+
}
|
|
30
|
+
export function saveTasks(workspaceId, tasks) {
|
|
31
|
+
const board = store.getBoard(workspaceId);
|
|
32
|
+
if (!board)
|
|
33
|
+
return null;
|
|
34
|
+
store.saveTasks(board.id, tasks);
|
|
35
|
+
return store.getBoard(workspaceId);
|
|
36
|
+
}
|
|
37
|
+
export function saveBoard(workspaceId, data) {
|
|
38
|
+
let board = store.getBoard(workspaceId);
|
|
39
|
+
if (!board)
|
|
40
|
+
board = store.createBoard(workspaceId);
|
|
41
|
+
if (data.title || data.layoutMode) {
|
|
42
|
+
store.updateBoard(workspaceId, { title: data.title, layoutMode: data.layoutMode });
|
|
43
|
+
}
|
|
44
|
+
if (data.columns)
|
|
45
|
+
store.saveColumns(board.id, data.columns);
|
|
46
|
+
if (data.tasks)
|
|
47
|
+
store.saveTasks(board.id, data.tasks);
|
|
48
|
+
return store.getBoard(workspaceId);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=kanban.js.map
|
|
@@ -41,6 +41,7 @@ export async function runBotAgent(workspaceId, preset, message) {
|
|
|
41
41
|
configDir: agentService.getAgentConfigDir(workspaceId, preset),
|
|
42
42
|
sandboxDirs: preset.sandboxDirs,
|
|
43
43
|
systemPrompt: preset.systemPrompt,
|
|
44
|
+
outputStyle: preset.outputStyle,
|
|
44
45
|
});
|
|
45
46
|
agentService.complete(workspaceId, session.id, result.success ? undefined : result.error || result.summary, {
|
|
46
47
|
runtime: preset.runtimeKind,
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { basename, join } from 'node:path';
|
|
4
|
+
import { ensureDir, getDataDir } from '../storage/json-store.js';
|
|
5
|
+
import { listTemplates } from './agent.js';
|
|
6
|
+
function getDir() {
|
|
7
|
+
return join(getDataDir(), 'output-styles');
|
|
8
|
+
}
|
|
9
|
+
function getMetaPath() {
|
|
10
|
+
return join(getDir(), 'meta.json');
|
|
11
|
+
}
|
|
12
|
+
function readMeta() {
|
|
13
|
+
const path = getMetaPath();
|
|
14
|
+
if (!existsSync(path))
|
|
15
|
+
return { templates: [] };
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(readFileSync(path, 'utf-8'));
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return { templates: [] };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function writeMeta(meta) {
|
|
24
|
+
ensureDir(getDir());
|
|
25
|
+
writeFileSync(getMetaPath(), JSON.stringify(meta, null, 2), 'utf-8');
|
|
26
|
+
}
|
|
27
|
+
export function listOutputStyles() {
|
|
28
|
+
return readMeta().templates;
|
|
29
|
+
}
|
|
30
|
+
export function resolveOutputStyleTemplate(ref) {
|
|
31
|
+
const needle = sanitizeOutputStyleName(ref);
|
|
32
|
+
if (!needle)
|
|
33
|
+
return null;
|
|
34
|
+
return listOutputStyles().find((template) => template.id === ref?.trim()
|
|
35
|
+
|| template.name === ref?.trim()
|
|
36
|
+
|| sanitizeOutputStyleName(template.name) === needle) ?? null;
|
|
37
|
+
}
|
|
38
|
+
export function resolveOutputStyleContent(ref) {
|
|
39
|
+
const raw = ref?.trim();
|
|
40
|
+
if (!raw)
|
|
41
|
+
return undefined;
|
|
42
|
+
return resolveOutputStyleTemplate(raw)?.content ?? raw;
|
|
43
|
+
}
|
|
44
|
+
export function prepareClaudeOutputStyleFile(configDir, ref) {
|
|
45
|
+
const raw = ref?.trim();
|
|
46
|
+
if (!raw)
|
|
47
|
+
return undefined;
|
|
48
|
+
const template = resolveOutputStyleTemplate(raw);
|
|
49
|
+
const content = template?.content ?? raw;
|
|
50
|
+
const fileStem = sanitizeOutputStyleName(template?.name) || `output-style-${shortHash(content)}`;
|
|
51
|
+
if (!fileStem)
|
|
52
|
+
return undefined;
|
|
53
|
+
const dir = join(configDir, 'output_styles');
|
|
54
|
+
rmSync(dir, { recursive: true, force: true });
|
|
55
|
+
mkdirSync(dir, { recursive: true });
|
|
56
|
+
writeFileSync(join(dir, `${fileStem}.md`), `${content.trimEnd()}\n`, 'utf-8');
|
|
57
|
+
return fileStem;
|
|
58
|
+
}
|
|
59
|
+
export function createOutputStyle(name, content, storeId, description) {
|
|
60
|
+
const meta = readMeta();
|
|
61
|
+
const now = new Date().toISOString();
|
|
62
|
+
const id = `os-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
63
|
+
const tmpl = { id, name, description, content, storeId, createdAt: now, updatedAt: now };
|
|
64
|
+
meta.templates.push(tmpl);
|
|
65
|
+
writeMeta(meta);
|
|
66
|
+
return tmpl;
|
|
67
|
+
}
|
|
68
|
+
export function updateOutputStyle(id, data) {
|
|
69
|
+
const meta = readMeta();
|
|
70
|
+
const tmpl = meta.templates.find((t) => t.id === id);
|
|
71
|
+
if (!tmpl)
|
|
72
|
+
return null;
|
|
73
|
+
if (data.name !== undefined)
|
|
74
|
+
tmpl.name = data.name;
|
|
75
|
+
if (data.description !== undefined)
|
|
76
|
+
tmpl.description = data.description;
|
|
77
|
+
if (data.content !== undefined)
|
|
78
|
+
tmpl.content = data.content;
|
|
79
|
+
tmpl.updatedAt = new Date().toISOString();
|
|
80
|
+
writeMeta(meta);
|
|
81
|
+
return tmpl;
|
|
82
|
+
}
|
|
83
|
+
export function deleteOutputStyle(id) {
|
|
84
|
+
const meta = readMeta();
|
|
85
|
+
const idx = meta.templates.findIndex((t) => t.id === id);
|
|
86
|
+
if (idx < 0)
|
|
87
|
+
return false;
|
|
88
|
+
meta.templates.splice(idx, 1);
|
|
89
|
+
writeMeta(meta);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
export function applyOutputStyleToAgents(styleId, agentIds) {
|
|
93
|
+
const meta = readMeta();
|
|
94
|
+
const tmpl = meta.templates.find((t) => t.id === styleId);
|
|
95
|
+
if (!tmpl)
|
|
96
|
+
return 0;
|
|
97
|
+
const agents = listTemplates();
|
|
98
|
+
let applied = 0;
|
|
99
|
+
for (const agentId of agentIds) {
|
|
100
|
+
const agent = agents.find((a) => a.id === agentId);
|
|
101
|
+
if (!agent)
|
|
102
|
+
continue;
|
|
103
|
+
const agentDir = join(getDataDir(), 'agent-templates', agent.id);
|
|
104
|
+
const agentPath = join(agentDir, 'agent.json');
|
|
105
|
+
if (!existsSync(agentPath))
|
|
106
|
+
continue;
|
|
107
|
+
const config = JSON.parse(readFileSync(agentPath, 'utf-8'));
|
|
108
|
+
config.outputStyle = tmpl.name;
|
|
109
|
+
writeFileSync(agentPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
110
|
+
applied++;
|
|
111
|
+
}
|
|
112
|
+
return applied;
|
|
113
|
+
}
|
|
114
|
+
export function listOutputStyleAgentCandidates() {
|
|
115
|
+
return listTemplates()
|
|
116
|
+
.filter((a) => a.id !== 'agent-generator')
|
|
117
|
+
.map((a) => ({
|
|
118
|
+
id: a.id,
|
|
119
|
+
name: a.name || a.id,
|
|
120
|
+
avatarUrl: a.avatarUrl,
|
|
121
|
+
description: a.description,
|
|
122
|
+
hasOutputStyle: !!a.outputStyle,
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
function sanitizeOutputStyleName(name) {
|
|
126
|
+
const raw = name?.trim();
|
|
127
|
+
if (!raw)
|
|
128
|
+
return '';
|
|
129
|
+
return basename(raw).replace(/\.md$/i, '').replace(/[^a-zA-Z0-9._-]+/g, '-').replace(/^-+|-+$/g, '');
|
|
130
|
+
}
|
|
131
|
+
function shortHash(text) {
|
|
132
|
+
return createHash('sha1').update(text).digest('hex').slice(0, 8);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=output-style.js.map
|
|
@@ -26,11 +26,11 @@ function writeMeta(meta) {
|
|
|
26
26
|
export function listPromptTemplates() {
|
|
27
27
|
return readMeta().templates;
|
|
28
28
|
}
|
|
29
|
-
export function createPromptTemplate(name, content) {
|
|
29
|
+
export function createPromptTemplate(name, content, storeId) {
|
|
30
30
|
const meta = readMeta();
|
|
31
31
|
const now = new Date().toISOString();
|
|
32
32
|
const id = `prompt-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
33
|
-
const tmpl = { id, name, content, createdAt: now, updatedAt: now };
|
|
33
|
+
const tmpl = { id, name, content, storeId, createdAt: now, updatedAt: now };
|
|
34
34
|
meta.templates.push(tmpl);
|
|
35
35
|
writeMeta(meta);
|
|
36
36
|
return tmpl;
|