@dsdenes/devboard 0.1.560 → 0.1.562
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/AGENTS.md +59 -0
- package/README.md +2497 -26
- package/bin/devboard.mjs +352 -118
- package/client/App.svelte +523 -0
- package/client/FeedbackOverlay.svelte +1125 -0
- package/client/FlowMode.svelte +1015 -0
- package/client/app.css +3922 -0
- package/client/env.d.ts +23 -0
- package/client/lib/commands.ts +836 -0
- package/client/lib/components/ActivityBar.svelte +295 -0
- package/client/lib/components/AdrTable.svelte +241 -0
- package/client/lib/components/CommandPalette.svelte +198 -0
- package/client/lib/components/ConceptKind.svelte +66 -0
- package/client/lib/components/ConfirmDialog.svelte +62 -0
- package/client/lib/components/DataTable.svelte +243 -0
- package/client/lib/components/DetailSplit.svelte +68 -0
- package/client/lib/components/DiscoverOverview.svelte +898 -0
- package/client/lib/components/DiscoverWorkspace.svelte +437 -0
- package/client/lib/components/DraftsPage.svelte +186 -0
- package/client/lib/components/GoalWorkspace.svelte +1042 -0
- package/client/lib/components/IssuesAgentFocus.svelte +117 -0
- package/client/lib/components/IssuesAgentLog.svelte +50 -0
- package/client/lib/components/IssuesQuestion.svelte +95 -0
- package/client/lib/components/IssuesWorkspace.svelte +577 -0
- package/client/lib/components/MermaidDiagram.svelte +89 -0
- package/client/lib/components/MonacoEditor.svelte +190 -0
- package/client/lib/components/NotificationRegion.svelte +195 -0
- package/client/lib/components/PaneHandle.svelte +25 -0
- package/client/lib/components/ScoutIssues.svelte +215 -0
- package/client/lib/components/ScoutWorkspace.svelte +180 -0
- package/client/lib/components/Sidebar.svelte +622 -0
- package/client/lib/components/StatusBar.svelte +118 -0
- package/client/lib/components/Terminal.svelte +193 -0
- package/client/lib/components/WatchdogWorkspace.svelte +537 -0
- package/client/lib/components/ui/button.svelte +56 -0
- package/client/lib/components/ui/icon-button.svelte +56 -0
- package/client/lib/components/ui/input.svelte +19 -0
- package/client/lib/components/ui/page-header.svelte +120 -0
- package/client/lib/components/ui/stage-track.svelte +141 -0
- package/client/lib/components/watchdog-indicator.svelte +189 -0
- package/client/lib/connection.svelte.ts +210 -0
- package/client/lib/dependency-diagram.test.ts +90 -0
- package/client/lib/dependency-diagram.ts +75 -0
- package/client/lib/discover-format.test.ts +265 -0
- package/client/lib/discover-format.ts +394 -0
- package/client/lib/discover.svelte.ts +412 -0
- package/client/lib/draft-format.test.ts +48 -0
- package/client/lib/draft-format.ts +13 -0
- package/client/lib/flow-save.test.ts +148 -0
- package/client/lib/flow.svelte.ts +445 -0
- package/client/lib/goal-reconnect.test.ts +282 -0
- package/client/lib/goal.svelte.ts +652 -0
- package/client/lib/issues.svelte.ts +439 -0
- package/client/lib/layout.svelte.ts +234 -0
- package/client/lib/notification-issue.test.ts +53 -0
- package/client/lib/notification-issue.ts +27 -0
- package/client/lib/notifications.svelte.ts +62 -0
- package/client/lib/poll-status.test.ts +141 -0
- package/client/lib/poll-status.ts +88 -0
- package/client/lib/record-status.test.ts +19 -0
- package/client/lib/record-status.ts +25 -0
- package/client/lib/scout.svelte.ts +164 -0
- package/client/lib/skill-document.test.ts +77 -0
- package/client/lib/skill-document.ts +57 -0
- package/client/lib/status-tone.test.ts +40 -0
- package/client/lib/status-tone.ts +33 -0
- package/client/lib/types.ts +578 -0
- package/client/lib/utils.ts +6 -0
- package/client/lib/viewport.svelte.ts +20 -0
- package/client/lib/watchdog.svelte.ts +69 -0
- package/client/main.ts +7 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/assets/abnfDiagram-VCTEODGH-CmBSMArZ.js +1 -0
- package/dist/assets/arc-BZgCSX2H.js +1 -0
- package/dist/assets/architecture-7GRP2DOG-CF9MHlfo.js +1 -0
- package/dist/assets/architectureDiagram-5GKGNRK7-DzWB6xiQ.js +36 -0
- package/dist/assets/array-BifhSqXX.js +1 -0
- package/dist/assets/blockDiagram-I7D4REHJ-BtmGJ0hn.js +129 -0
- package/dist/assets/c4Diagram-7LVT6UL2-D5CHrrRX.js +38 -0
- package/dist/assets/channel-CgM4lcUW.js +1 -0
- package/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/assets/chunk-4HAMMTFA-DeIufjFl.js +62 -0
- package/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/assets/chunk-75Z2AOVW-DbtzyKUg.js +2 -0
- package/dist/assets/chunk-DU6HZSFF-C0fdbx3K.js +127 -0
- package/dist/assets/chunk-F27PBJKO-HObL2IvF.js +1 -0
- package/dist/assets/chunk-FOHPRMQF-DD4dKubD.js +161 -0
- package/dist/assets/chunk-GMAD6QVW-fg8wvtPY.js +72 -0
- package/dist/assets/chunk-GVQU2GXP-C0TaHOrD.js +1 -0
- package/dist/assets/chunk-IMKFNOWR-BVoIdx20.js +231 -0
- package/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/assets/chunk-L3NEJ4N5-B_kmqfk5.js +1 -0
- package/dist/assets/chunk-OSK3NFVY-DO0vhxHH.js +10 -0
- package/dist/assets/chunk-P2QGCYS3-CjljLvFj.js +1 -0
- package/dist/assets/chunk-POPQ4Y6H-BU0C7tw6.js +1 -0
- package/dist/assets/chunk-PWAF6VOD-Dn0OjBt0.js +1 -0
- package/dist/assets/chunk-SHT3W25Y-CMCZE2xx.js +168 -0
- package/dist/assets/chunk-SVP7TREG-BIRmRy_W.js +88 -0
- package/dist/assets/chunk-TICWLB2K-C1bc2CDE.js +206 -0
- package/dist/assets/chunk-XXDRQBXY-Cc38QUmR.js +1 -0
- package/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/assets/classDiagram-ZZMXUADV-BDh5w6Nc.js +1 -0
- package/dist/assets/classDiagram-v2-VYDZK3BY-BDh5w6Nc.js +1 -0
- package/dist/assets/cose-bilkent-JH36ORCC-B7pU7qhM.js +1 -0
- package/dist/assets/cynefin-OW5HDTMX-76dswSqS.js +1 -0
- package/dist/assets/cynefinDiagram-5FMLGOSQ-2kS4q01d.js +62 -0
- package/dist/assets/cytoscape.esm-BegBNzOV.js +321 -0
- package/dist/assets/dagre-D7JM2Yhv.js +1 -0
- package/dist/assets/dagre-GXQ25YYZ-B5Y21TQM.js +4 -0
- package/dist/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/assets/diagram-S7CK7UJ4-CY6td7Et.js +30 -0
- package/dist/assets/diagram-UQ7AKVKN-DmDqnGZf.js +41 -0
- package/dist/assets/diagram-VSXAHHWV-KGLWOOcE.js +3 -0
- package/dist/assets/diagram-VX7I27RA-D5syUraJ.js +24 -0
- package/dist/assets/diagram-Z3DM3KII-Dtrbs1Om.js +24 -0
- package/dist/assets/dist-Dce-2YbA.js +1 -0
- package/dist/assets/ebnfDiagram-PWID7BFC-CQpJLtU3.js +1 -0
- package/dist/assets/editor.worker-BmdWdrHZ.js +33 -0
- package/dist/assets/erDiagram-RLTQ6QDP-cMTzKLu_.js +99 -0
- package/dist/assets/eventmodeling-NTZA5JFV-CMzLdNaL.js +1 -0
- package/dist/assets/flowDiagram-HODETNUW-BMUajB-G.js +1 -0
- package/dist/assets/ganttDiagram-EL5Y4UJY-DseBS5Fs.js +292 -0
- package/dist/assets/gitGraph-4MIJSDKK-CUQZRpxJ.js +1 -0
- package/dist/assets/gitGraphDiagram-WWUBYQGX-CfMfsJ3b.js +106 -0
- package/dist/assets/graphlib-DS17s2tU.js +1 -0
- package/dist/assets/index-ByQ-XX38.css +1 -0
- package/dist/assets/index-CIf5TpfY.js +214 -0
- package/dist/assets/info-A6RAGUB7-D3nAKZ8M.js +1 -0
- package/dist/assets/infoDiagram-27XIBGKW-zu1O0WOy.js +2 -0
- package/dist/assets/init-C-OQMol4.js +1 -0
- package/dist/assets/ishikawaDiagram-5VMMS53U-DKC7BO9p.js +70 -0
- package/dist/assets/journeyDiagram-3NMN7TZE-Ld5mXse7.js +139 -0
- package/dist/assets/kanban-definition-UXKFOSKX-CH7_QlHL.js +89 -0
- package/dist/assets/katex-DJhrJSbw.js +257 -0
- package/dist/assets/line-N9XiCREw.js +1 -0
- package/dist/assets/linear-C9hnqmJv.js +1 -0
- package/dist/assets/mermaid-parser.core-DgPwV5Bh.js +7 -0
- package/dist/assets/mermaid.core-BKqynXLR.js +44 -0
- package/dist/assets/mindmap-definition-YA3MSWOX-DkiL-wiW.js +96 -0
- package/dist/assets/monaco-DjpsE8to.css +1 -0
- package/dist/assets/monaco-DqzJaNIe.js +908 -0
- package/dist/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/assets/packet-AYTQ26CC-DuMTvpEJ.js +1 -0
- package/dist/assets/path-fybaL0A-.js +1 -0
- package/dist/assets/pegDiagram-XKGWAZYB-DvMl_xSe.js +1 -0
- package/dist/assets/pie-WAS4IAKB-Da0xPaD8.js +1 -0
- package/dist/assets/pieDiagram-E7YTZNPT-amANNRJY.js +39 -0
- package/dist/assets/quadrantDiagram-AXDQQJYC-BrgvDMnk.js +7 -0
- package/dist/assets/radar-RG4KPBEZ-Dz3Ih5-N.js +1 -0
- package/dist/assets/railroad-74A4TZTK-CKMW-IV2.js +1 -0
- package/dist/assets/railroad-abnf-HS5TGJTU-ChqmSWSF.js +1 -0
- package/dist/assets/railroad-ebnf-LZEXJU2U-V3R4fFdb.js +1 -0
- package/dist/assets/railroad-peg-WCYAUIDC-B-RuhUQW.js +1 -0
- package/dist/assets/railroadDiagram-O6MQD6OU-FjG-6OLu.js +1 -0
- package/dist/assets/requirementDiagram-BXWQKSXE-Cnj8RfE4.js +84 -0
- package/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/assets/sankeyDiagram-P5KCCOFB-DMu1fnEh.js +40 -0
- package/dist/assets/sequenceDiagram-WJ2MYXX4-CtCtaRpW.js +162 -0
- package/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/dist/assets/src-CGp3bfio.js +1 -0
- package/dist/assets/stateDiagram-D77RDMKH-xcJbLNhz.js +1 -0
- package/dist/assets/stateDiagram-v2-MP3YSRHH-DYHrQmJJ.js +1 -0
- package/dist/assets/swimlanes-42K2YHIH-BwLln_ga.js +1 -0
- package/dist/assets/swimlanesDiagram-VR7AAH4N-BcDfUQ0A.js +8 -0
- package/dist/assets/timeline-definition-24CTP7MA-ucNGsUUz.js +120 -0
- package/dist/assets/treeView-Q6P3EWNA-3uOomRue.js +1 -0
- package/dist/assets/treemap-WGGIJYW6-iGK7vwID.js +1 -0
- package/dist/assets/vennDiagram-4TSXK5OY-B9LgGe16.js +34 -0
- package/dist/assets/wardley-WFR3VGLG-FupMOf6k.js +1 -0
- package/dist/assets/wardleyDiagram-VM6X3IG4-CGZdEXM2.js +78 -0
- package/dist/assets/xterm-BrP-ENHg.css +1 -0
- package/dist/assets/xterm-C8zLTNGk.js +16 -0
- package/dist/assets/xychartDiagram-S5SC5T6Z-DafZrSBJ.js +7 -0
- package/dist/favicon.ico +0 -0
- package/dist/favicon.svg +6 -0
- package/dist/index.html +34 -0
- package/extensions/implement-goal-issue.ts +368 -0
- package/extensions/implement-next-epic.ts +835 -0
- package/index.html +28 -0
- package/install.sh +111 -0
- package/issues/control.ts +91 -0
- package/issues/guards.ts +12 -0
- package/issues/ledger.ts +122 -0
- package/issues/legacy.ts +68 -0
- package/issues/lock.ts +305 -0
- package/issues/paths.ts +76 -0
- package/issues/preflight.ts +189 -0
- package/issues/repository.ts +203 -0
- package/issues/scout/actions.ts +255 -0
- package/issues/scout/control.ts +80 -0
- package/issues/scout/github.ts +358 -0
- package/issues/scout/paths.ts +129 -0
- package/issues/scout/preflight.ts +277 -0
- package/issues/scout/recommendation.ts +400 -0
- package/issues/scout/scan.ts +143 -0
- package/issues/scout/state.ts +448 -0
- package/issues/scout/worker.ts +1282 -0
- package/issues/state.ts +584 -0
- package/issues/tracker.ts +271 -0
- package/issues/worker.ts +1065 -0
- package/lib/dependencies.ts +61 -0
- package/lib/forge-auth.ts +953 -0
- package/lib/forge.ts +141 -0
- package/lib/gitea.ts +709 -0
- package/lib/github-release.ts +318 -0
- package/lib/inventory.test.ts +79 -0
- package/lib/inventory.ts +53 -0
- package/lib/release.test.ts +269 -0
- package/lib/release.ts +801 -0
- package/omp/commands/adr-resolve.md +8 -0
- package/omp/commands/discover.md +6 -0
- package/omp/commands/epic-next.md +8 -0
- package/omp/commands/flow-change.md +8 -0
- package/omp/commands/flow-goal.md +8 -0
- package/omp/commands/flow-implement.md +8 -0
- package/omp/commands/flow-widget.md +8 -0
- package/omp/commands/goal-draft.md +8 -0
- package/omp/commands/goal-outcome.md +8 -0
- package/omp/commands/implement-issue.md +8 -0
- package/omp/commands/prepare-skills.md +6 -0
- package/omp/commands/scout-recommendations.md +8 -0
- package/omp/commands/setup-devboard.md +24 -0
- package/omp/config.yml +12 -0
- package/omp/extensions/implement-goal-issue.ts +2 -0
- package/omp/extensions/implement-next-epic.ts +2 -0
- package/omp/mcp.json +9 -0
- package/package.json +86 -7
- package/prompts/adr-resolve.md +130 -0
- package/prompts/discover.md +541 -0
- package/prompts/epic-next.md +533 -0
- package/prompts/flow-change.md +76 -0
- package/prompts/flow-goal.md +126 -0
- package/prompts/flow-implement.md +103 -0
- package/prompts/flow-widget.md +54 -0
- package/prompts/goal-draft.md +147 -0
- package/prompts/goal-outcome.md +87 -0
- package/prompts/implement-issue.md +66 -0
- package/prompts/prepare-skills.md +142 -0
- package/prompts/scout-recommendations.md +143 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +6 -0
- package/server/acp.ts +540 -0
- package/server/activity.test.ts +96 -0
- package/server/activity.ts +48 -0
- package/server/app.test.ts +882 -0
- package/server/app.ts +6179 -0
- package/server/ask.test.ts +543 -0
- package/server/ask.ts +589 -0
- package/server/dependencies.test.ts +118 -0
- package/server/discover-remote.test.ts +1602 -0
- package/server/discover-sheet.test.ts +176 -0
- package/server/discover.test.ts +1510 -0
- package/server/discover.ts +3198 -0
- package/server/feedback.test.ts +458 -0
- package/server/feedback.ts +369 -0
- package/server/fixtures/adr-source.ts +71 -0
- package/server/fixtures/hang-download.ts +14 -0
- package/server/fixtures/stub-agent.ts +1870 -0
- package/server/fixtures/stub-forge.ts +141 -0
- package/server/fixtures/stub-gh.ts +57 -0
- package/server/flow-pr.test.ts +976 -0
- package/server/flow.test.ts +1632 -0
- package/server/flow.ts +2655 -0
- package/server/forge-pr.ts +387 -0
- package/server/goal-creation.test.ts +957 -0
- package/server/goal-draft.test.ts +348 -0
- package/server/goal-drafts.ts +449 -0
- package/server/goal-proposal.test.ts +479 -0
- package/server/goal-proposal.ts +232 -0
- package/server/goal-revision.test.ts +613 -0
- package/server/goal-slug.test.ts +56 -0
- package/server/goal-slug.ts +96 -0
- package/server/goal.ts +20 -0
- package/server/index.ts +147 -0
- package/server/issue-close.test.ts +100 -0
- package/server/issue-close.ts +178 -0
- package/server/issues.test.ts +167 -0
- package/server/issues.ts +479 -0
- package/server/journal.test.ts +350 -0
- package/server/journal.ts +329 -0
- package/server/lifecycle-pause.test.ts +1795 -0
- package/server/lifecycle.test.ts +1879 -0
- package/server/parallel-lifecycle.test.ts +1029 -0
- package/server/persistence-restart.test.ts +723 -0
- package/server/persistence.test.ts +1935 -0
- package/server/records.test.ts +180 -0
- package/server/records.ts +99 -0
- package/server/reset-implementation.test.ts +997 -0
- package/server/run.test.ts +611 -0
- package/server/scout.test.ts +877 -0
- package/server/scout.ts +459 -0
- package/server/skills-preparation.test.ts +1073 -0
- package/server/state.ts +249 -0
- package/server/tracker.ts +369 -0
- package/server/updates.test.ts +444 -0
- package/server/updates.ts +198 -0
- package/server/version.test.ts +140 -0
- package/server/version.ts +151 -0
- package/server/watchdog.ts +389 -0
- package/svelte.config.js +5 -0
- package/templates/host-AGENTS.md +235 -0
- package/tsconfig.json +21 -0
- package/vite.config.ts +21 -0
- package/watchdog/cleanup-main.ts +98 -0
- package/watchdog/cleanup.ts +301 -0
- package/watchdog/collect.ts +311 -0
- package/watchdog/coordinator.ts +397 -0
- package/watchdog/delivery.ts +107 -0
- package/watchdog/discovery.ts +209 -0
- package/watchdog/findings.ts +211 -0
- package/watchdog/github.ts +189 -0
- package/watchdog/history.ts +138 -0
- package/watchdog/install.ts +103 -0
- package/watchdog/ledger.ts +188 -0
- package/watchdog/lock.ts +63 -0
- package/watchdog/main.ts +106 -0
- package/watchdog/status.ts +71 -0
- package/watchdog/systemd.ts +96 -0
- package/watchdog/uninstall.ts +30 -0
- package/watchdog/units/devboard-watchdog.service +9 -0
- package/watchdog/units/devboard-watchdog.timer +10 -0
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
import { connection } from "./connection.svelte";
|
|
2
|
+
import { notifications } from "./notifications.svelte";
|
|
3
|
+
import type {
|
|
4
|
+
AnswerTarget,
|
|
5
|
+
FlowBlocker,
|
|
6
|
+
FlowCheckpoint,
|
|
7
|
+
FlowConversation,
|
|
8
|
+
FlowFile,
|
|
9
|
+
FlowGoalCreation,
|
|
10
|
+
FlowHistoryEntry,
|
|
11
|
+
FlowPr,
|
|
12
|
+
FlowSnapshot,
|
|
13
|
+
FlowStatus,
|
|
14
|
+
FlowSteeringNote,
|
|
15
|
+
FlowVerification,
|
|
16
|
+
FlowWidget,
|
|
17
|
+
RunQuestion,
|
|
18
|
+
} from "./types";
|
|
19
|
+
|
|
20
|
+
type Message = Record<string, unknown>;
|
|
21
|
+
|
|
22
|
+
function isObject(value: unknown): value is Record<string, unknown> {
|
|
23
|
+
return typeof value === "object" && value !== null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function appendLine(lines: string[], text: string, append: boolean): string[] {
|
|
27
|
+
if (append && lines.length > 0) {
|
|
28
|
+
return [...lines.slice(0, -1), (lines[lines.length - 1] ?? "") + text];
|
|
29
|
+
}
|
|
30
|
+
return [...lines, text];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isHttpUrl(url: string): boolean {
|
|
34
|
+
return url.startsWith("https://") || url.startsWith("http://");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class FlowStore {
|
|
38
|
+
sessionId = $state<string | null>(null);
|
|
39
|
+
status = $state<FlowStatus>("none");
|
|
40
|
+
goal = $state("");
|
|
41
|
+
decisions = $state("");
|
|
42
|
+
worktree = $state<string | null>(null);
|
|
43
|
+
branch = $state<string | null>(null);
|
|
44
|
+
baseRevision = $state<string | null>(null);
|
|
45
|
+
files = $state<FlowFile[]>([]);
|
|
46
|
+
widgets = $state<FlowWidget[]>([]);
|
|
47
|
+
steering = $state<FlowSteeringNote[]>([]);
|
|
48
|
+
checkpoints = $state<FlowCheckpoint[]>([]);
|
|
49
|
+
verification = $state<FlowVerification | null>(null);
|
|
50
|
+
blockers = $state<FlowBlocker[]>([]);
|
|
51
|
+
pr = $state<FlowPr | null>(null);
|
|
52
|
+
prError = $state<string | null>(null);
|
|
53
|
+
leftover = $state<string | null>(null);
|
|
54
|
+
question = $state<RunQuestion | null>(null);
|
|
55
|
+
goalCreation = $state<FlowGoalCreation | null>(null);
|
|
56
|
+
conversation = $state<FlowConversation | null>(null);
|
|
57
|
+
activity = $state<string[]>([]);
|
|
58
|
+
notice = $state<string | null>(null);
|
|
59
|
+
history = $state<FlowHistoryEntry[]>([]);
|
|
60
|
+
errorMessage = $state<string | null>(null);
|
|
61
|
+
noticeMessage = $state<string | null>(null);
|
|
62
|
+
|
|
63
|
+
goalDraft = $state("");
|
|
64
|
+
goalDirty = $state(false);
|
|
65
|
+
decisionsDraft = $state("");
|
|
66
|
+
decisionsDirty = $state(false);
|
|
67
|
+
steeringDraft = $state("");
|
|
68
|
+
conversationDraft = $state("");
|
|
69
|
+
conclusionDraft = $state("");
|
|
70
|
+
answers = $state<Record<AnswerTarget, string>>({
|
|
71
|
+
goal: "",
|
|
72
|
+
implementation: "",
|
|
73
|
+
conversation: "",
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
refusingId = $state<string | null>(null);
|
|
77
|
+
refuseReason = $state("");
|
|
78
|
+
|
|
79
|
+
get startDisabled(): boolean {
|
|
80
|
+
return this.status === "merged" || this.status === "running" || this.goal.trim().length === 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get stopDisabled(): boolean {
|
|
84
|
+
return this.status !== "running";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get readyDisabled(): boolean {
|
|
88
|
+
return !(this.status === "stopped" && this.pr?.state === "draft");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get mergeDisabled(): boolean {
|
|
92
|
+
return !(this.status === "stopped" && this.pr?.state === "live");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get conversationStale(): boolean {
|
|
96
|
+
return (
|
|
97
|
+
this.conversation !== null &&
|
|
98
|
+
!this.widgets.some((widget) => widget.id === this.conversation?.widgetId)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
widget(id: string): FlowWidget | null {
|
|
103
|
+
return this.widgets.find((widget) => widget.id === id) ?? null;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
file(path: string): FlowFile | null {
|
|
107
|
+
return this.files.find((file) => file.path === path) ?? null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
checkpoint(id: string): FlowCheckpoint | null {
|
|
111
|
+
return this.checkpoints.find((checkpoint) => checkpoint.id === id) ?? null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
detailFiles(widget: FlowWidget): FlowFile[] {
|
|
115
|
+
return widget.files
|
|
116
|
+
.map((path) => this.file(path))
|
|
117
|
+
.filter((file): file is FlowFile => file !== null);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
applySnapshot(message: FlowSnapshot): void {
|
|
121
|
+
this.sessionId = message.sessionId;
|
|
122
|
+
this.status = message.status;
|
|
123
|
+
this.goal = message.goal;
|
|
124
|
+
this.decisions = message.decisions;
|
|
125
|
+
this.worktree = message.worktree;
|
|
126
|
+
this.branch = message.branch;
|
|
127
|
+
this.baseRevision = message.baseRevision;
|
|
128
|
+
this.files = message.files;
|
|
129
|
+
this.widgets = message.widgets;
|
|
130
|
+
this.steering = message.steering;
|
|
131
|
+
this.checkpoints = message.checkpoints;
|
|
132
|
+
this.verification = message.verification;
|
|
133
|
+
this.blockers = message.blockers;
|
|
134
|
+
this.pr = message.pr;
|
|
135
|
+
this.prError = message.prError;
|
|
136
|
+
this.leftover = message.leftover;
|
|
137
|
+
this.question = message.question;
|
|
138
|
+
this.goalCreation = message.goalCreation;
|
|
139
|
+
this.conversation = message.conversation;
|
|
140
|
+
this.activity = message.activity;
|
|
141
|
+
this.notice = message.notice;
|
|
142
|
+
this.history = message.history;
|
|
143
|
+
if (!this.goalDirty) this.goalDraft = message.goal;
|
|
144
|
+
if (!this.decisionsDirty) this.decisionsDraft = message.decisions;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
setGoalDraft(text: string): void {
|
|
148
|
+
this.goalDraft = text;
|
|
149
|
+
this.goalDirty = text !== this.goal;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
setDecisionsDraft(text: string): void {
|
|
153
|
+
this.decisionsDraft = text;
|
|
154
|
+
this.decisionsDirty = text !== this.decisions;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
saveGoal(): void {
|
|
158
|
+
if (!connection.send({ type: "saveFlowGoal", text: this.goalDraft })) return;
|
|
159
|
+
this.goalDirty = false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
discardDecisionsDraft(): void {
|
|
163
|
+
this.decisionsDraft = this.decisions;
|
|
164
|
+
this.decisionsDirty = false;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
saveDecisions(): void {
|
|
168
|
+
if (!connection.send({ type: "saveFlowDecisions", text: this.decisionsDraft })) return;
|
|
169
|
+
this.decisionsDirty = false;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
createGoal(): void {
|
|
173
|
+
connection.send({ type: "createFlowGoal" });
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
startImplementation(): void {
|
|
177
|
+
connection.send({ type: "startFlowImplementation" });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
stopImplementation(): void {
|
|
181
|
+
connection.send({ type: "stopFlowImplementation" });
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
toggleWidget(widget: FlowWidget): void {
|
|
185
|
+
connection.send({ type: "acceptFlowWidget", id: widget.id, accepted: !widget.accepted });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
startRefuse(widget: FlowWidget): void {
|
|
189
|
+
this.refusingId = widget.id;
|
|
190
|
+
this.refuseReason = "";
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
cancelRefuse(): void {
|
|
194
|
+
this.refusingId = null;
|
|
195
|
+
this.refuseReason = "";
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
confirmRefuse(widget: FlowWidget): void {
|
|
199
|
+
connection.send({ type: "refuseFlowWidget", id: widget.id, reason: this.refuseReason });
|
|
200
|
+
this.refusingId = null;
|
|
201
|
+
this.refuseReason = "";
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
discuss(widget: FlowWidget): void {
|
|
205
|
+
connection.send({ type: "openFlowWidget", id: widget.id });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
sendSteering(): void {
|
|
209
|
+
const text = this.steeringDraft;
|
|
210
|
+
if (text.trim().length === 0) return;
|
|
211
|
+
connection.send({ type: "sendFlowSteering", text });
|
|
212
|
+
this.steeringDraft = "";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
dismissBlocker(blocker: FlowBlocker): void {
|
|
216
|
+
connection.send({ type: "dismissFlowBlocker", id: blocker.id });
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
answerQuestion(pending: RunQuestion, value: string, target: AnswerTarget): void {
|
|
220
|
+
const trimmed = value.trim();
|
|
221
|
+
if (trimmed.length === 0) return;
|
|
222
|
+
connection.send({ type: "flowAnswer", id: pending.id, value: trimmed, target });
|
|
223
|
+
this.answers[target] = "";
|
|
224
|
+
if (target === "goal" && this.goalCreation !== null) {
|
|
225
|
+
this.goalCreation = { ...this.goalCreation, question: null };
|
|
226
|
+
} else if (target === "conversation" && this.conversation !== null) {
|
|
227
|
+
this.conversation = { ...this.conversation, question: null };
|
|
228
|
+
} else if (target === "implementation") {
|
|
229
|
+
this.question = null;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
sendConversation(): void {
|
|
234
|
+
const text = this.conversationDraft;
|
|
235
|
+
if (text.trim().length === 0) return;
|
|
236
|
+
connection.send({ type: "sendFlowConversation", text });
|
|
237
|
+
this.conversationDraft = "";
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
sendConclusion(): void {
|
|
241
|
+
const text = this.conclusionDraft;
|
|
242
|
+
if (text.trim().length === 0) return;
|
|
243
|
+
connection.send({ type: "sendFlowConclusion", text });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
closeConversation(): void {
|
|
247
|
+
connection.send({ type: "closeFlowWidget" });
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
retryPr(): void {
|
|
251
|
+
connection.send({ type: "retryFlowPr" });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
markPrReady(): void {
|
|
255
|
+
connection.send({ type: "markFlowPrReady" });
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
mergePr(): void {
|
|
259
|
+
connection.send({ type: "mergeFlowPr" });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
isHttpUrl(url: string): boolean {
|
|
263
|
+
return isHttpUrl(url);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
outputTail(output: string): string {
|
|
267
|
+
return output.length > 2000 ? `…${output.slice(-2000)}` : output;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
handleEvent(message: Message): void {
|
|
271
|
+
const type = message.type;
|
|
272
|
+
|
|
273
|
+
if (type === "flowSnapshot" && isObject(message)) {
|
|
274
|
+
this.applySnapshot(message as unknown as FlowSnapshot);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (type === "flowGoalStarted") {
|
|
278
|
+
this.goalCreation = { activity: [], question: null };
|
|
279
|
+
this.errorMessage = null;
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (type === "flowGoalStopped") {
|
|
283
|
+
this.goalCreation = null;
|
|
284
|
+
if (message.completed === true && typeof message.text === "string") {
|
|
285
|
+
this.goal = message.text;
|
|
286
|
+
this.goalDirty = false;
|
|
287
|
+
this.goalDraft = message.text;
|
|
288
|
+
}
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (type === "flowActivity" && typeof message.text === "string") {
|
|
292
|
+
const append = message.append === true;
|
|
293
|
+
if (this.goalCreation !== null) {
|
|
294
|
+
this.goalCreation = {
|
|
295
|
+
...this.goalCreation,
|
|
296
|
+
activity: appendLine(this.goalCreation.activity, message.text, append),
|
|
297
|
+
};
|
|
298
|
+
} else {
|
|
299
|
+
this.activity = appendLine(this.activity, message.text, append);
|
|
300
|
+
}
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (
|
|
304
|
+
type === "flowQuestion" &&
|
|
305
|
+
(typeof message.id === "string" || typeof message.id === "number") &&
|
|
306
|
+
typeof message.message === "string" &&
|
|
307
|
+
Array.isArray(message.options)
|
|
308
|
+
) {
|
|
309
|
+
const pending = {
|
|
310
|
+
id: message.id,
|
|
311
|
+
message: message.message,
|
|
312
|
+
options: message.options,
|
|
313
|
+
} as RunQuestion;
|
|
314
|
+
if (message.target === "goal") {
|
|
315
|
+
this.goalCreation = {
|
|
316
|
+
activity: this.goalCreation?.activity ?? [],
|
|
317
|
+
question: pending,
|
|
318
|
+
};
|
|
319
|
+
} else if (message.target === "conversation") {
|
|
320
|
+
if (this.conversation !== null) this.conversation = { ...this.conversation, question: pending };
|
|
321
|
+
} else {
|
|
322
|
+
this.question = pending;
|
|
323
|
+
}
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
if (type === "flowNotice" && typeof message.message === "string") {
|
|
327
|
+
this.notice = message.message;
|
|
328
|
+
this.noticeMessage = message.message;
|
|
329
|
+
notifications.push("notice", message.message);
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (type === "flowImplementationStarted") {
|
|
333
|
+
this.status = "running";
|
|
334
|
+
this.activity = [];
|
|
335
|
+
if (typeof message.sessionId === "string") this.sessionId = message.sessionId;
|
|
336
|
+
if (typeof message.worktree === "string") this.worktree = message.worktree;
|
|
337
|
+
if (typeof message.branch === "string") this.branch = message.branch;
|
|
338
|
+
if (typeof message.baseRevision === "string") this.baseRevision = message.baseRevision;
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
if (type === "flowStopped") {
|
|
342
|
+
if (this.status !== "merged") this.status = "stopped";
|
|
343
|
+
this.question = null;
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
if (type === "flowError" && typeof message.message === "string") {
|
|
347
|
+
this.errorMessage = message.message;
|
|
348
|
+
notifications.push("error", message.message);
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (type === "flowFiles" && Array.isArray(message.files)) {
|
|
352
|
+
this.files = message.files as FlowFile[];
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
if (type === "flowWidgets" && Array.isArray(message.widgets)) {
|
|
356
|
+
this.widgets = message.widgets as FlowWidget[];
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (type === "flowSteering" && Array.isArray(message.notes)) {
|
|
360
|
+
this.steering = message.notes as FlowSteeringNote[];
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (type === "flowDecisions" && typeof message.text === "string") {
|
|
364
|
+
this.decisions = message.text;
|
|
365
|
+
if (!this.decisionsDirty) this.decisionsDraft = message.text;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
if (type === "flowCheckpoints" && Array.isArray(message.checkpoints)) {
|
|
369
|
+
this.checkpoints = message.checkpoints as FlowCheckpoint[];
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (type === "flowVerification") {
|
|
373
|
+
this.verification = (message.verification ?? null) as FlowVerification | null;
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (type === "flowBlockers" && Array.isArray(message.blockers)) {
|
|
377
|
+
this.blockers = message.blockers as FlowBlocker[];
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
if (type === "flowPr") {
|
|
381
|
+
this.pr = (message.pr ?? null) as FlowPr | null;
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (type === "flowConversationStarted" && typeof message.widgetId === "string") {
|
|
385
|
+
this.conversation = {
|
|
386
|
+
widgetId: message.widgetId,
|
|
387
|
+
messages: [],
|
|
388
|
+
activity: [],
|
|
389
|
+
question: null,
|
|
390
|
+
};
|
|
391
|
+
this.conversationDraft = "";
|
|
392
|
+
this.conclusionDraft = "";
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (
|
|
396
|
+
type === "flowConversationStopped" &&
|
|
397
|
+
this.conversation !== null &&
|
|
398
|
+
message.widgetId === this.conversation.widgetId
|
|
399
|
+
) {
|
|
400
|
+
this.conversation = null;
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
if (
|
|
404
|
+
type === "flowConversationMessage" &&
|
|
405
|
+
this.conversation !== null &&
|
|
406
|
+
(message.role === "developer" || message.role === "agent") &&
|
|
407
|
+
typeof message.text === "string"
|
|
408
|
+
) {
|
|
409
|
+
this.conversation = {
|
|
410
|
+
...this.conversation,
|
|
411
|
+
messages: [...this.conversation.messages, { role: message.role, text: message.text }],
|
|
412
|
+
};
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (
|
|
416
|
+
type === "flowConversationActivity" &&
|
|
417
|
+
this.conversation !== null &&
|
|
418
|
+
typeof message.text === "string"
|
|
419
|
+
) {
|
|
420
|
+
this.conversation = {
|
|
421
|
+
...this.conversation,
|
|
422
|
+
activity: appendLine(this.conversation.activity, message.text, message.append === true),
|
|
423
|
+
};
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (
|
|
427
|
+
type === "flowConversationQuestion" &&
|
|
428
|
+
this.conversation !== null &&
|
|
429
|
+
(typeof message.id === "string" || typeof message.id === "number") &&
|
|
430
|
+
typeof message.message === "string" &&
|
|
431
|
+
Array.isArray(message.options)
|
|
432
|
+
) {
|
|
433
|
+
this.conversation = {
|
|
434
|
+
...this.conversation,
|
|
435
|
+
question: {
|
|
436
|
+
id: message.id,
|
|
437
|
+
message: message.message,
|
|
438
|
+
options: message.options,
|
|
439
|
+
} as RunQuestion,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export const flow = new FlowStore();
|