@kenkaiiii/ggcoder 5.78.0 → 5.79.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.
- package/dist/app-sidecar/app-settings.d.ts +6 -2
- package/dist/app-sidecar/app-settings.js +39 -20
- package/dist/app-sidecar/app-settings.js.map +1 -1
- package/dist/app-sidecar/git-target.d.ts +17 -0
- package/dist/app-sidecar/git-target.js +31 -0
- package/dist/app-sidecar/git-target.js.map +1 -0
- package/dist/app-sidecar/goal-routes.d.ts +26 -0
- package/dist/app-sidecar/goal-routes.js +445 -0
- package/dist/app-sidecar/goal-routes.js.map +1 -0
- package/dist/app-sidecar/history-routes.d.ts +13 -0
- package/dist/app-sidecar/history-routes.js +36 -25
- package/dist/app-sidecar/history-routes.js.map +1 -1
- package/dist/app-sidecar/mcp-routes.js +1 -2
- package/dist/app-sidecar/mcp-routes.js.map +1 -1
- package/dist/app-sidecar/route-context.d.ts +12 -0
- package/dist/app-sidecar/run-control-routes.js +2 -1
- package/dist/app-sidecar/run-control-routes.js.map +1 -1
- package/dist/app-sidecar/session-routes.js +41 -0
- package/dist/app-sidecar/session-routes.js.map +1 -1
- package/dist/app-sidecar/session-types.d.ts +2 -0
- package/dist/app-sidecar/workspace-routes.js +13 -95
- package/dist/app-sidecar/workspace-routes.js.map +1 -1
- package/dist/app-sidecar.js +213 -60
- package/dist/app-sidecar.js.map +1 -1
- package/dist/cli/shared.js +1 -1
- package/dist/cli/shared.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/acceptance-checks.js +17 -4
- package/dist/core/acceptance-checks.js.map +1 -1
- package/dist/core/agent-notifications.d.ts +1 -1
- package/dist/core/agent-session.d.ts +76 -5
- package/dist/core/agent-session.js +118 -22
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/ask-user.d.ts +11 -0
- package/dist/core/ask-user.js +6 -1
- package/dist/core/ask-user.js.map +1 -1
- package/dist/core/auth-providers.d.ts +2 -80
- package/dist/core/auth-providers.js +4 -183
- package/dist/core/auth-providers.js.map +1 -1
- package/dist/core/context-files.d.ts +8 -0
- package/dist/core/context-files.js +46 -0
- package/dist/core/context-files.js.map +1 -0
- package/dist/core/env-delta.d.ts +9 -1
- package/dist/core/env-delta.js +20 -0
- package/dist/core/env-delta.js.map +1 -1
- package/dist/core/goals-store.d.ts +208 -0
- package/dist/core/goals-store.js +520 -0
- package/dist/core/goals-store.js.map +1 -0
- package/dist/core/local-endpoint-store.js +15 -11
- package/dist/core/local-endpoint-store.js.map +1 -1
- package/dist/core/project-discovery.d.ts +7 -0
- package/dist/core/project-discovery.js +8 -2
- package/dist/core/project-discovery.js.map +1 -1
- package/dist/core/radio.d.ts +2 -3
- package/dist/core/radio.js.map +1 -1
- package/dist/core/session-manager.d.ts +7 -1
- package/dist/core/session-manager.js +17 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-storage.d.ts +3 -0
- package/dist/core/session-storage.js +8 -2
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/subagent-manager.d.ts +51 -0
- package/dist/core/subagent-manager.js +95 -15
- package/dist/core/subagent-manager.js.map +1 -1
- package/dist/core/subagent-store.js +2 -1
- package/dist/core/subagent-store.js.map +1 -1
- package/dist/goals-agent/goal-team.d.ts +2 -0
- package/dist/goals-agent/goal-team.js +82 -0
- package/dist/goals-agent/goal-team.js.map +1 -0
- package/dist/goals-agent/goals-agent.d.ts +90 -0
- package/dist/goals-agent/goals-agent.js +246 -0
- package/dist/goals-agent/goals-agent.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interactive.js +4 -3
- package/dist/interactive.js.map +1 -1
- package/dist/modes/subagent-worker-mode.d.ts +12 -0
- package/dist/modes/subagent-worker-mode.js +22 -1
- package/dist/modes/subagent-worker-mode.js.map +1 -1
- package/dist/system-prompt.d.ts +8 -0
- package/dist/system-prompt.js +21 -9
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/bash-read-evidence.d.ts +13 -0
- package/dist/tools/bash-read-evidence.js +48 -1
- package/dist/tools/bash-read-evidence.js.map +1 -1
- package/dist/tools/index.d.ts +7 -1
- package/dist/tools/index.js +10 -2
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/read-tracker.d.ts +6 -12
- package/dist/tools/read-tracker.js +21 -36
- package/dist/tools/read-tracker.js.map +1 -1
- package/dist/tools/read.js +2 -2
- package/dist/tools/read.js.map +1 -1
- package/dist/tools/subagent-control.js +22 -3
- package/dist/tools/subagent-control.js.map +1 -1
- package/dist/tools/write.js +110 -8
- package/dist/tools/write.js.map +1 -1
- package/dist/ui/components/ActivityIndicator.d.ts +5 -5
- package/dist/ui/components/InputArea.d.ts +2 -2
- package/dist/ui/components/InputArea.js +3 -3
- package/dist/ui/components/InputArea.js.map +1 -1
- package/dist/ui/components/ToolExecution.d.ts +2 -2
- package/dist/utils/format.d.ts +0 -4
- package/dist/utils/format.js +0 -7
- package/dist/utils/format.js.map +1 -1
- package/package.json +4 -4
|
@@ -36,6 +36,12 @@ export declare function defaultProjectsRoot(): string;
|
|
|
36
36
|
export declare function projectModelKey(cwd: string): string;
|
|
37
37
|
export declare function loadAppSettings(): Promise<AppSettings>;
|
|
38
38
|
export declare function saveAppSettings(settings: AppSettings): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Read-modify-write gg-app.json under the shared file lock, so two windows
|
|
41
|
+
* saving at once (or a local-endpoint save racing a model save) can't lose
|
|
42
|
+
* each other's change. Every settings write in the sidecar goes through here.
|
|
43
|
+
*/
|
|
44
|
+
export declare function updateAppSettings<T = void>(mutate: (settings: AppSettings) => T | Promise<T>): Promise<T>;
|
|
39
45
|
/** Read this project's persisted model/thinking prefs, if any. */
|
|
40
46
|
export declare function loadProjectModelPrefs(cwd: string): Promise<ProjectModelPrefs | undefined>;
|
|
41
47
|
/** Persist this project's model/thinking prefs via read-modify-write so the rest
|
|
@@ -61,5 +67,3 @@ export declare function persistModelSelection(settingsFile: string, provider: Pr
|
|
|
61
67
|
* Mirrors the CLI's handleToggleThinking persistence (App.tsx).
|
|
62
68
|
*/
|
|
63
69
|
export declare function persistThinkingLevel(settingsFile: string, level: ThinkingLevel | undefined): Promise<void>;
|
|
64
|
-
/** Validate a project folder name: lowercase letters, digits, dashes only. */
|
|
65
|
-
export declare function isValidProjectName(name: string): boolean;
|
|
@@ -3,6 +3,8 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { SettingsManager } from "../core/settings-manager.js";
|
|
5
5
|
import { log } from "../core/logger.js";
|
|
6
|
+
import { atomicWrite } from "../core/session-storage.js";
|
|
7
|
+
import { withFileLock } from "@kenkaiiii/gg-core";
|
|
6
8
|
export const ALL_PROVIDERS = [
|
|
7
9
|
// US
|
|
8
10
|
"anthropic",
|
|
@@ -40,8 +42,15 @@ export function projectModelKey(cwd) {
|
|
|
40
42
|
}
|
|
41
43
|
export async function loadAppSettings() {
|
|
42
44
|
try {
|
|
43
|
-
const
|
|
45
|
+
const parsed = JSON.parse(await fs.readFile(appSettingsFile(), "utf-8"));
|
|
46
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
47
|
+
return { projectsRoot: defaultProjectsRoot() };
|
|
48
|
+
}
|
|
49
|
+
const raw = parsed;
|
|
44
50
|
return {
|
|
51
|
+
// Keep every key this module doesn't own (localEndpoints, fields a newer
|
|
52
|
+
// app version or the Rust side writes) so a save never drops them.
|
|
53
|
+
...raw,
|
|
45
54
|
projectsRoot: typeof raw.projectsRoot === "string" && raw.projectsRoot.trim()
|
|
46
55
|
? raw.projectsRoot
|
|
47
56
|
: defaultProjectsRoot(),
|
|
@@ -60,7 +69,21 @@ export async function loadAppSettings() {
|
|
|
60
69
|
}
|
|
61
70
|
export async function saveAppSettings(settings) {
|
|
62
71
|
await fs.mkdir(path.dirname(appSettingsFile()), { recursive: true });
|
|
63
|
-
await
|
|
72
|
+
await atomicWrite(appSettingsFile(), JSON.stringify(settings, null, 2));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Read-modify-write gg-app.json under the shared file lock, so two windows
|
|
76
|
+
* saving at once (or a local-endpoint save racing a model save) can't lose
|
|
77
|
+
* each other's change. Every settings write in the sidecar goes through here.
|
|
78
|
+
*/
|
|
79
|
+
export async function updateAppSettings(mutate) {
|
|
80
|
+
await fs.mkdir(path.dirname(appSettingsFile()), { recursive: true });
|
|
81
|
+
return withFileLock(appSettingsFile(), async () => {
|
|
82
|
+
const s = await loadAppSettings();
|
|
83
|
+
const result = await mutate(s);
|
|
84
|
+
await saveAppSettings(s);
|
|
85
|
+
return result;
|
|
86
|
+
});
|
|
64
87
|
}
|
|
65
88
|
/** Read this project's persisted model/thinking prefs, if any. */
|
|
66
89
|
export async function loadProjectModelPrefs(cwd) {
|
|
@@ -70,10 +93,10 @@ export async function loadProjectModelPrefs(cwd) {
|
|
|
70
93
|
/** Persist this project's model/thinking prefs via read-modify-write so the rest
|
|
71
94
|
* of the settings file (projectsRoot, other projects' entries) is preserved. */
|
|
72
95
|
export async function saveProjectModelPrefs(cwd, prefs) {
|
|
73
|
-
const s = await loadAppSettings();
|
|
74
96
|
const key = projectModelKey(cwd);
|
|
75
|
-
|
|
76
|
-
|
|
97
|
+
await updateAppSettings((s) => {
|
|
98
|
+
s.projectModels = { ...(s.projectModels ?? {}), [key]: prefs };
|
|
99
|
+
});
|
|
77
100
|
}
|
|
78
101
|
/** Read this project's persisted Ken model override, if any. */
|
|
79
102
|
export async function loadKenModelPref(cwd) {
|
|
@@ -83,15 +106,15 @@ export async function loadKenModelPref(cwd) {
|
|
|
83
106
|
/** Persist (or with null, clear) this project's Ken model override via
|
|
84
107
|
* read-modify-write so the rest of the settings file is preserved. */
|
|
85
108
|
export async function saveKenModelPref(cwd, pref) {
|
|
86
|
-
const s = await loadAppSettings();
|
|
87
109
|
const key = projectModelKey(cwd);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
await updateAppSettings((s) => {
|
|
111
|
+
const next = { ...(s.kenModels ?? {}) };
|
|
112
|
+
if (pref)
|
|
113
|
+
next[key] = pref;
|
|
114
|
+
else
|
|
115
|
+
delete next[key];
|
|
116
|
+
s.kenModels = next;
|
|
117
|
+
});
|
|
95
118
|
}
|
|
96
119
|
/** Read this project's persisted autopilot flag (default off). */
|
|
97
120
|
export async function loadAutopilot(cwd) {
|
|
@@ -101,10 +124,10 @@ export async function loadAutopilot(cwd) {
|
|
|
101
124
|
/** Persist this project's autopilot flag via read-modify-write so the rest of
|
|
102
125
|
* the settings file (projectsRoot, model map, other projects) is preserved. */
|
|
103
126
|
export async function saveAutopilot(cwd, enabled) {
|
|
104
|
-
const s = await loadAppSettings();
|
|
105
127
|
const key = projectModelKey(cwd);
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
await updateAppSettings((s) => {
|
|
129
|
+
s.autopilot = { ...(s.autopilot ?? {}), [key]: enabled };
|
|
130
|
+
});
|
|
108
131
|
}
|
|
109
132
|
/**
|
|
110
133
|
* Persist the active model selection to ~/.gg/settings.json so it survives app
|
|
@@ -137,10 +160,6 @@ export async function persistThinkingLevel(settingsFile, level) {
|
|
|
137
160
|
log("WARN", "app-sidecar", "failed to persist thinking level", { err: String(err) });
|
|
138
161
|
}
|
|
139
162
|
}
|
|
140
|
-
/** Validate a project folder name: lowercase letters, digits, dashes only. */
|
|
141
|
-
export function isValidProjectName(name) {
|
|
142
|
-
return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name);
|
|
143
|
-
}
|
|
144
163
|
// ── History reconstruction types ──────────────────────────
|
|
145
164
|
// Mirrors HistoryEntry in gg-app/src/agent.ts — the wire shape the webview
|
|
146
165
|
// receives from GET /history. Fields beyond role/text carry the transcript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-settings.js","sourceRoot":"","sources":["../../src/app-sidecar/app-settings.ts"],"names":[],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,EAAE,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,KAAK;YAAE,MAAM,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,kCAAkC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACvF,CAAC;AACH,CAAC;AAED,6DAA6D;AAC7D,2EAA2E;AAC3E,2EAA2E"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GoalRecord } from "../core/goals-store.js";
|
|
2
|
+
/**
|
|
3
|
+
* The folder whose git state a window's titlebar shows (branch, uncommitted
|
|
4
|
+
* files, GitHub, CI, Project Health). Normally the window's cwd. A Goal
|
|
5
|
+
* window's cwd is the goal's own folder under `~/.gg/goals`, which is not a
|
|
6
|
+
* repo, so it uses the first attached folder that is inside a git work tree:
|
|
7
|
+
* the project the goal is actually changing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveGitCwd(cwd: string, goal: Pick<GoalRecord, "context"> | null, isRepo?: (dir: string) => Promise<boolean>): Promise<string>;
|
|
10
|
+
export interface GitState {
|
|
11
|
+
branch: string | null;
|
|
12
|
+
isRepo: boolean;
|
|
13
|
+
dirtyFileCount: number;
|
|
14
|
+
gitHubSlug: string | null;
|
|
15
|
+
}
|
|
16
|
+
/** Read a folder's git state; each part falls back on its own when git fails. */
|
|
17
|
+
export declare function readGitState(dir: string): Promise<GitState>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getGitBranch, getGitDirtyFileCount, isGitRepo } from "../utils/git.js";
|
|
2
|
+
import { getGitHubRepoSlug } from "../utils/github.js";
|
|
3
|
+
/**
|
|
4
|
+
* The folder whose git state a window's titlebar shows (branch, uncommitted
|
|
5
|
+
* files, GitHub, CI, Project Health). Normally the window's cwd. A Goal
|
|
6
|
+
* window's cwd is the goal's own folder under `~/.gg/goals`, which is not a
|
|
7
|
+
* repo, so it uses the first attached folder that is inside a git work tree:
|
|
8
|
+
* the project the goal is actually changing.
|
|
9
|
+
*/
|
|
10
|
+
export async function resolveGitCwd(cwd, goal, isRepo = isGitRepo) {
|
|
11
|
+
if (!goal)
|
|
12
|
+
return cwd;
|
|
13
|
+
for (const item of goal.context) {
|
|
14
|
+
if (item.kind !== "folder")
|
|
15
|
+
continue;
|
|
16
|
+
if (await isRepo(item.path).catch(() => false))
|
|
17
|
+
return item.path;
|
|
18
|
+
}
|
|
19
|
+
return cwd;
|
|
20
|
+
}
|
|
21
|
+
/** Read a folder's git state; each part falls back on its own when git fails. */
|
|
22
|
+
export async function readGitState(dir) {
|
|
23
|
+
const [branch, isRepo, dirtyFileCount, gitHubSlug] = await Promise.all([
|
|
24
|
+
getGitBranch(dir).catch(() => null),
|
|
25
|
+
isGitRepo(dir).catch(() => false),
|
|
26
|
+
getGitDirtyFileCount(dir).catch(() => 0),
|
|
27
|
+
getGitHubRepoSlug(dir).catch(() => null),
|
|
28
|
+
]);
|
|
29
|
+
return { branch, isRepo, dirtyFileCount, gitHubSlug };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=git-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-target.js","sourceRoot":"","sources":["../../src/app-sidecar/git-target.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAW,EACX,IAAwC,EACxC,SAA4C,SAAS;IAErD,IAAI,CAAC,IAAI;QAAE,OAAO,GAAG,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;YAAE,SAAS;QACrC,IAAI,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IACnE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AASD,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW;IAC5C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACrE,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QACnC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;QACjC,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACxC,iBAAiB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;KACzC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type http from "node:http";
|
|
2
|
+
import { type GoalRecord } from "../core/goals-store.js";
|
|
3
|
+
import type { SessionRouteContext } from "./route-context.js";
|
|
4
|
+
/** One row of the app's goal list. */
|
|
5
|
+
export interface GoalSummary {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
goal: string;
|
|
9
|
+
context: GoalRecord["context"];
|
|
10
|
+
path: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
lastActiveMs: number;
|
|
13
|
+
lastActiveDisplay: string;
|
|
14
|
+
/** Newest non-empty session to resume; null opens a fresh coordinator session. */
|
|
15
|
+
latestSessionPath: string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Where the goal stands, for the goal list: briefing (not started yet),
|
|
18
|
+
* running (working right now), paused (by the user), or idle (started,
|
|
19
|
+
* not working: done, or waiting to be opened again).
|
|
20
|
+
*/
|
|
21
|
+
status: "briefing" | "running" | "paused" | "interrupted" | "idle";
|
|
22
|
+
}
|
|
23
|
+
/** A goal's status for the list (see GoalSummary.status). */
|
|
24
|
+
export declare function goalListStatus(record: GoalRecord, busy: boolean, cutOff?: boolean): GoalSummary["status"];
|
|
25
|
+
/** Goal list, create, and the coordinator's automatic first reply. */
|
|
26
|
+
export declare function handleGoalRoutes(ctx: SessionRouteContext, req: http.IncomingMessage, res: http.ServerResponse, url: string, method: string): boolean;
|