@kenkaiiii/ggcoder 7.3.1 → 7.4.1

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.
Files changed (54) hide show
  1. package/dist/app-sidecar/app-settings.d.ts +0 -3
  2. package/dist/app-sidecar/app-settings.js +3 -3
  3. package/dist/app-sidecar/app-settings.js.map +1 -1
  4. package/dist/app-sidecar/autopilot-runner.d.ts +2 -1
  5. package/dist/app-sidecar/autopilot-runner.js +1 -1
  6. package/dist/app-sidecar/autopilot-runner.js.map +1 -1
  7. package/dist/app-sidecar/feature-map-watch.d.ts +2 -0
  8. package/dist/app-sidecar/feature-map-watch.js +11 -0
  9. package/dist/app-sidecar/feature-map-watch.js.map +1 -1
  10. package/dist/app-sidecar/fix-all-checkout.d.ts +45 -0
  11. package/dist/app-sidecar/fix-all-checkout.js +100 -0
  12. package/dist/app-sidecar/fix-all-checkout.js.map +1 -0
  13. package/dist/app-sidecar/fix-all-checks.d.ts +58 -0
  14. package/dist/app-sidecar/fix-all-checks.js +426 -0
  15. package/dist/app-sidecar/fix-all-checks.js.map +1 -0
  16. package/dist/app-sidecar/fix-all-git.d.ts +81 -0
  17. package/dist/app-sidecar/fix-all-git.js +271 -0
  18. package/dist/app-sidecar/fix-all-git.js.map +1 -0
  19. package/dist/app-sidecar/fix-all-journal.d.ts +56 -0
  20. package/dist/app-sidecar/fix-all-journal.js +68 -0
  21. package/dist/app-sidecar/fix-all-journal.js.map +1 -0
  22. package/dist/app-sidecar/fix-all-launch.d.ts +23 -0
  23. package/dist/app-sidecar/fix-all-launch.js +77 -0
  24. package/dist/app-sidecar/fix-all-launch.js.map +1 -0
  25. package/dist/app-sidecar/fix-all-routes.d.ts +10 -0
  26. package/dist/app-sidecar/fix-all-routes.js +100 -0
  27. package/dist/app-sidecar/fix-all-routes.js.map +1 -0
  28. package/dist/app-sidecar/fix-all-runner.d.ts +163 -0
  29. package/dist/app-sidecar/fix-all-runner.js +1012 -0
  30. package/dist/app-sidecar/fix-all-runner.js.map +1 -0
  31. package/dist/app-sidecar/prompt-routes.js +6 -0
  32. package/dist/app-sidecar/prompt-routes.js.map +1 -1
  33. package/dist/app-sidecar/route-context.d.ts +7 -0
  34. package/dist/app-sidecar/run-control-routes.js +1 -0
  35. package/dist/app-sidecar/run-control-routes.js.map +1 -1
  36. package/dist/app-sidecar/run-progress.d.ts +7 -0
  37. package/dist/app-sidecar/run-progress.js +56 -0
  38. package/dist/app-sidecar/run-progress.js.map +1 -0
  39. package/dist/app-sidecar/session-broadcast.d.ts +11 -0
  40. package/dist/app-sidecar/session-broadcast.js +11 -0
  41. package/dist/app-sidecar/session-broadcast.js.map +1 -0
  42. package/dist/app-sidecar/session-routes.d.ts +1 -0
  43. package/dist/app-sidecar/session-routes.js +1 -0
  44. package/dist/app-sidecar/session-routes.js.map +1 -1
  45. package/dist/app-sidecar/session-types.d.ts +3 -0
  46. package/dist/app-sidecar/session-types.js.map +1 -1
  47. package/dist/app-sidecar/shell-routes.js +6 -0
  48. package/dist/app-sidecar/shell-routes.js.map +1 -1
  49. package/dist/app-sidecar/worktrees.d.ts +2 -0
  50. package/dist/app-sidecar/worktrees.js +5 -1
  51. package/dist/app-sidecar/worktrees.js.map +1 -1
  52. package/dist/app-sidecar.js +226 -17
  53. package/dist/app-sidecar.js.map +1 -1
  54. package/package.json +6 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-all-routes.js","sourceRoot":"","sources":["../../src/app-sidecar/fix-all-routes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CA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I,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,4CAA4C,EAAE,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,163 @@
1
+ import type { FeatureMapSnapshot, FixAllState } from "@kenkaiiii/gg-protocol";
2
+ import { type CheckResult, type FixCheck } from "./fix-all-checks.js";
3
+ import { type Preflight, type RollbackRequest } from "./fix-all-git.js";
4
+ import { type FixAllJournal, type LoadedJournal } from "./fix-all-journal.js";
5
+ /** Group failures in a row before the run pauses (a broken provider or toolchain). */
6
+ export declare const FAIL_STREAK_PAUSE = 3;
7
+ export interface FixAllPromptResult {
8
+ /** The agent's last reply. */
9
+ readonly reply: string;
10
+ /** The run failed (a provider error), in plain words. */
11
+ readonly error: string | null;
12
+ /** The agent submitted a plan instead of fixing (the plan is already cleared). */
13
+ readonly planSubmitted: boolean;
14
+ }
15
+ /** A run's folder and branch, and the commit it started at: what an ended run with no fixes leaves. */
16
+ export interface FixAllRunFolder {
17
+ readonly root: string;
18
+ readonly branch: string;
19
+ readonly head: string;
20
+ }
21
+ /** What the daemon does to run a run in its own folder: a background session there takes it. */
22
+ export type FixAllLaunchRequest = {
23
+ readonly kind: "start";
24
+ /** The checkout Start was pressed in: the branch starts from its HEAD. */
25
+ readonly from: string;
26
+ readonly key: string;
27
+ readonly startCount: number;
28
+ } | {
29
+ readonly kind: "resume";
30
+ /** The run's folder. */
31
+ readonly root: string;
32
+ readonly key: string;
33
+ readonly confirmRestructure?: boolean;
34
+ };
35
+ export interface FixAllRunnerDeps {
36
+ readonly cwd: string;
37
+ /** `~/.gg/feature-maps`. */
38
+ readonly stateDir: string;
39
+ readonly map: {
40
+ snapshot(): Promise<FeatureMapSnapshot>;
41
+ refresh(): Promise<FeatureMapSnapshot>;
42
+ act(featureId: string, actionId: string): Promise<boolean>;
43
+ };
44
+ readonly session: {
45
+ /** A fresh session with the step's header row. */
46
+ begin(header: string): Promise<void>;
47
+ prompt(text: string, label: string): Promise<FixAllPromptResult>;
48
+ /** Stop the agent's run and its background agents (not called on the global Stop). */
49
+ abort(): void;
50
+ /**
51
+ * Wait for background agents the fix started; `onWait` hears how many still work. False when
52
+ * they were still working at the deadline (they're interrupted then).
53
+ */
54
+ settle(signal: AbortSignal, onWait: (working: number) => void): Promise<boolean>;
55
+ };
56
+ /** This session's current conversation file: the one to open to watch the run. */
57
+ readonly sessionPath?: () => string | null;
58
+ readonly git: {
59
+ /** The checkout root, or null outside Git. */
60
+ root(dir: string): Promise<string | null>;
61
+ /** The repository's main folder, the same from every worktree: what a run is keyed by. */
62
+ repoKey(dir: string): Promise<string | null>;
63
+ preflight(dir: string, opts?: {
64
+ branch?: string;
65
+ }): Promise<Preflight>;
66
+ proposeBranch(dir: string, now: Date): Promise<string>;
67
+ currentBranch(dir: string): Promise<string | null>;
68
+ head(dir: string): Promise<string | null>;
69
+ isAncestor(dir: string, commit: string): Promise<boolean>;
70
+ changedPaths(dir: string): Promise<string[]>;
71
+ filesToDiscard(dir: string, checkpoint: string): Promise<string[]>;
72
+ commit(dir: string, branch: string, message: string): Promise<string | null>;
73
+ rollback(req: RollbackRequest): Promise<string[]>;
74
+ };
75
+ readonly checks: {
76
+ resolve(root: string): Promise<FixCheck[]>;
77
+ /** What a fresh folder runs before its first checks (installs), each like a check. */
78
+ setup(root: string, checks: readonly FixCheck[]): Promise<FixCheck[]>;
79
+ /** The checks for one fix, given the files it changed (the full set when it can't narrow). */
80
+ scope(root: string, commands: readonly FixCheck[], changed: readonly string[]): FixCheck[];
81
+ run(root: string, commands: readonly FixCheck[], signal: AbortSignal, onCommand?: (index: number, command: FixCheck) => void): Promise<CheckResult>;
82
+ };
83
+ /** Why the window can't start a run now (agent running, task sweep, autopilot, Goal), or null. */
84
+ readonly busyReason: () => string | null;
85
+ /** Other sessions on this checkout, and whether any is working (only that clashes with a run). */
86
+ readonly othersOnCheckout: (root: string) => Promise<{
87
+ count: number;
88
+ busy: boolean;
89
+ }>;
90
+ /** Hold the window's run claim for the whole run; false when something else holds it. */
91
+ readonly claim: () => boolean;
92
+ readonly release: () => void;
93
+ /** To every session of the repository (`key`), or this one's while it has none. */
94
+ readonly broadcast: (state: FixAllState, key: string | null) => void;
95
+ /** This runner took the repository's run (true), or let it go once it ended (false). */
96
+ readonly onLive?: (key: string, live: boolean) => void;
97
+ /** The run ended (stopped, dismissed or never started) without committing a fix: remove its folder. */
98
+ readonly discardFolder?: (run: FixAllRunFolder) => void;
99
+ /** Run it in its own folder: a background session there takes it; resolves to its runner. */
100
+ readonly launch: (request: FixAllLaunchRequest) => Promise<FixAllRunner>;
101
+ readonly journal: {
102
+ load(file: string): Promise<LoadedJournal | null>;
103
+ save(file: string, journal: FixAllJournal): Promise<void>;
104
+ remove(file: string): Promise<void>;
105
+ };
106
+ readonly log: (level: "INFO" | "WARN", message: string, data?: Record<string, string>) => void;
107
+ readonly now?: () => Date;
108
+ }
109
+ export interface FixAllRunner {
110
+ state(): Promise<FixAllState>;
111
+ /** Fast guards, then launches the run in a folder of its own. Throws FixAllGuardError. */
112
+ start(): Promise<FixAllState>;
113
+ /** In the run's new folder, on its branch: set up, baseline checks, then the loop. */
114
+ beginInWorktree(opts: {
115
+ branch: string;
116
+ startCount: number;
117
+ }): Promise<FixAllState>;
118
+ pause(): Promise<FixAllState>;
119
+ resume(opts: {
120
+ confirmRestructure?: boolean;
121
+ }): Promise<FixAllState>;
122
+ /** `fromCancel`: the global Stop, which already aborted the agent. On a finished run: dismiss. */
123
+ stop(fromCancel?: boolean): Promise<FixAllState>;
124
+ /** A run is working (not paused or waiting): questions get the unattended deadline. */
125
+ active(): boolean;
126
+ /** Its loop is running: typed messages in sessions on its folder are held. */
127
+ working(): boolean;
128
+ /** This runner owns the repository's run until it ends or is dismissed (keeps its session). */
129
+ owns(): boolean;
130
+ /** The run's folder while this runner owns it. */
131
+ folder(): string | null;
132
+ /** The repository key, once known. */
133
+ key(): string | null;
134
+ /** Resolves once the background loop settles (tests). */
135
+ settled(): Promise<void>;
136
+ }
137
+ /** The reason while a pause takes effect; the app keys its "Pausing…" off it. */
138
+ export declare const PAUSING = "Pausing\u2026";
139
+ /** How long a fix's background agents may keep working before its checks run without them. */
140
+ export declare const FIX_ALL_SETTLE_MS: number;
141
+ /** A typed prompt or `!` command while a run works the checkout: it would land in the fixes. */
142
+ export declare const FIX_ALL_HOLDS_CHAT = "Fix all is working in this folder, so a message or command now would get mixed into its fixes. Pause it first.";
143
+ /** The Fix all run of each repository, shared by every session of it on any checkout (daemon-wide). */
144
+ export interface FixAllCheckout {
145
+ /** The runner that owns the repository's run (keyed by its main folder), or null. */
146
+ live(key: string): FixAllRunner | null;
147
+ setLive(key: string, runner: FixAllRunner, live: boolean): void;
148
+ /** A folder's checkout root (cached). */
149
+ rootOf(dir: string): Promise<string | null>;
150
+ /** A folder's repository key: its main folder (cached). */
151
+ keyOf(dir: string): Promise<string | null>;
152
+ /** To every session of the repository `key`, in order. */
153
+ broadcast(key: string, type: string, data: unknown): void;
154
+ }
155
+ /**
156
+ * Why a typed message or `!` command in a session on `dir` is held, or null: only while the
157
+ * repository's run is working, and only on the run's own folder (the project's folder and other
158
+ * worktrees stay free).
159
+ */
160
+ export declare function fixAllHoldsAt(checkout: FixAllCheckout, dir: string): Promise<string | null>;
161
+ /** Fixes are checked scoped to what they touched; the full checks run after this many. */
162
+ export declare const FULL_CHECKS_EVERY = 10;
163
+ export declare function createFixAllRunner(deps: FixAllRunnerDeps): FixAllRunner;