@kenkaiiii/ggcoder 5.77.0 → 5.79.0
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/autopilot-runner.js +2 -5
- package/dist/app-sidecar/autopilot-runner.js.map +1 -1
- package/dist/app-sidecar/goal-routes.d.ts +26 -0
- package/dist/app-sidecar/goal-routes.js +444 -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/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 +3 -0
- package/dist/app-sidecar/workspace-routes.js.map +1 -1
- package/dist/app-sidecar.js +113 -9
- package/dist/app-sidecar.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/verification-tracker.d.ts +5 -1
- package/dist/core/agent-session/verification-tracker.js +25 -6
- package/dist/core/agent-session/verification-tracker.js.map +1 -1
- package/dist/core/agent-session.d.ts +50 -0
- package/dist/core/agent-session.js +49 -11
- 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/autopilot-cycle.d.ts +2 -0
- package/dist/core/autopilot-cycle.js +21 -2
- package/dist/core/autopilot-cycle.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/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/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/prompt-commands.js +29 -4
- package/dist/core/prompt-commands.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.js +5 -1
- 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/core/verification-evidence.d.ts +13 -2
- package/dist/core/verification-evidence.js +256 -3
- package/dist/core/verification-evidence.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/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.js +20 -11
- 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/bash.d.ts +3 -1
- package/dist/tools/bash.js +8 -4
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/edit.d.ts +1 -0
- package/dist/tools/edit.js +84 -1
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/index.d.ts +7 -1
- package/dist/tools/index.js +13 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/read-only-bash.js +3 -0
- package/dist/tools/read-only-bash.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/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../src/core/ask-user.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,GAAG,MAAM,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,GAAG,MAAM,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CACzC,gCAAgC,EAChC,+BAA+B,CAChC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,OAAO,UAAU,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,gCAAgC,CAAC;AACzF,CAAC;
|
|
1
|
+
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../src/core/ask-user.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,EAAE,GAAG,MAAM,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,GAAG,MAAM,CAAC;AAE1D;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,GAAG,CACzC,gCAAgC,EAChC,+BAA+B,CAChC,CAAC;AAEF,+EAA+E;AAC/E,MAAM,UAAU,iBAAiB,CAAC,UAAmB;IACnD,OAAO,UAAU,CAAC,CAAC,CAAC,+BAA+B,CAA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CACL,GAAG,IAAI,MAAM;QACb,kFAAkF;QAClF,qDAAqD,CACtD,CAAC;AACJ,CAAC;AAcD;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAmB,EAAE,IAAoB;IACzE,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;IAClB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAAE,IAAI,CAAC,YAAY,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -26,6 +26,8 @@ import { type AutopilotVerdict } from "./autopilot-verdict.js";
|
|
|
26
26
|
* submitted plan to review and the session is read-only, so the loop halts
|
|
27
27
|
* and hands control to the user. */
|
|
28
28
|
export declare const AUTOPILOT_PLAN_DRAFTING_REASON = "GG Coder is still drafting a plan (plan mode is active with nothing submitted). Finish or cancel the plan yourself; autopilot can't prompt a read-only session.";
|
|
29
|
+
/** Injected when Autopilot finds the work unchecked before its review. */
|
|
30
|
+
export declare const AUTOPILOT_VERIFY_PROMPT: string;
|
|
29
31
|
/** Situational-awareness preamble prepended to EVERY build-session run that
|
|
30
32
|
* Autopilot Ken injects (fix prompts, plan-revision prompts, the post-approval
|
|
31
33
|
* "implement it now" run). GG Coder otherwise can't tell an autopilot-injected
|
|
@@ -26,6 +26,9 @@ import { CORPUS_UNVERIFIED_REASON } from "./autopilot-verdict.js";
|
|
|
26
26
|
* submitted plan to review and the session is read-only, so the loop halts
|
|
27
27
|
* and hands control to the user. */
|
|
28
28
|
export const AUTOPILOT_PLAN_DRAFTING_REASON = "GG Coder is still drafting a plan (plan mode is active with nothing submitted). Finish or cancel the plan yourself; autopilot can't prompt a read-only session.";
|
|
29
|
+
/** Injected when Autopilot finds the work unchecked before its review. */
|
|
30
|
+
export const AUTOPILOT_VERIFY_PROMPT = "Run the project's checks for your changes (see Verification), standalone and unpiped, " +
|
|
31
|
+
"and fix any failures.";
|
|
29
32
|
/** Situational-awareness preamble prepended to EVERY build-session run that
|
|
30
33
|
* Autopilot Ken injects (fix prompts, plan-revision prompts, the post-approval
|
|
31
34
|
* "implement it now" run). GG Coder otherwise can't tell an autopilot-injected
|
|
@@ -83,11 +86,27 @@ export async function driveAutopilotCycle(deps) {
|
|
|
83
86
|
deps.emit({ type: "autopilot_human", data: { reason } });
|
|
84
87
|
return true;
|
|
85
88
|
};
|
|
86
|
-
|
|
89
|
+
// Plain replies leave checks to the commit, so a turn often ends unchecked.
|
|
90
|
+
// Autopilot has a real end, so it asks for the checks once before reviewing;
|
|
91
|
+
// only work still unchecked after that goes back to the human.
|
|
92
|
+
const ensureVerified = async (round) => {
|
|
93
|
+
if (!deps.verificationProblem())
|
|
94
|
+
return true;
|
|
95
|
+
// A pending plan is reviewed by Ken in plan mode, where checks cannot run;
|
|
96
|
+
// its outcome (or the user) decides what happens to the unchecked work.
|
|
97
|
+
if (deps.planPending()) {
|
|
98
|
+
stopIfUnverified();
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
deps.onInjected(AUTOPILOT_VERIFY_PROMPT, round);
|
|
102
|
+
await deps.runPrompt(AUTOPILOT_VERIFY_PROMPT);
|
|
103
|
+
return !deps.isCancelled() && !stopIfUnverified();
|
|
104
|
+
};
|
|
105
|
+
if (deps.isCancelled() || !(await ensureVerified(1)))
|
|
87
106
|
return;
|
|
88
107
|
await deps.resetReviewer();
|
|
89
108
|
for (let round = 1; round <= deps.maxRounds; round++) {
|
|
90
|
-
if (deps.isCancelled() ||
|
|
109
|
+
if (deps.isCancelled() || !(await ensureVerified(round)))
|
|
91
110
|
return;
|
|
92
111
|
if (deps.planPending()) {
|
|
93
112
|
const verdict = await deps.reviewPlan();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autopilot-cycle.js","sourceRoot":"","sources":["../../src/core/autopilot-cycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,w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AC;gBACR,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE;aAC7E,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACzE,OAAO;QACT,CAAC;QACD,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO;IACjC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A child's brief with files its parent already read appended, so the child
|
|
3
|
+
* starts with their current contents instead of spending turns reading them
|
|
4
|
+
* again. Paths resolve against the child's folder. A file that's missing,
|
|
5
|
+
* binary or past the limits is named with the reason, never fatal: the child
|
|
6
|
+
* can still read it itself. Returns the brief unchanged when there are none.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withContextFiles(task: string, files: readonly string[], cwd: string): Promise<string>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/** The most of one file handed over; longer files are cut and say so. */
|
|
4
|
+
const FILE_LIMIT = 24_000;
|
|
5
|
+
/** The most handed over in all; files past it are named but not included. */
|
|
6
|
+
const TOTAL_LIMIT = 60_000;
|
|
7
|
+
/**
|
|
8
|
+
* A child's brief with files its parent already read appended, so the child
|
|
9
|
+
* starts with their current contents instead of spending turns reading them
|
|
10
|
+
* again. Paths resolve against the child's folder. A file that's missing,
|
|
11
|
+
* binary or past the limits is named with the reason, never fatal: the child
|
|
12
|
+
* can still read it itself. Returns the brief unchanged when there are none.
|
|
13
|
+
*/
|
|
14
|
+
export async function withContextFiles(task, files, cwd) {
|
|
15
|
+
if (files.length === 0)
|
|
16
|
+
return task;
|
|
17
|
+
const parts = [];
|
|
18
|
+
let used = 0;
|
|
19
|
+
for (const file of [...new Set(files)]) {
|
|
20
|
+
const full = path.resolve(cwd, file);
|
|
21
|
+
if (used >= TOTAL_LIMIT) {
|
|
22
|
+
parts.push(`### ${full}\n(not included: over the size limit; read it if you need it)`);
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
let text;
|
|
26
|
+
try {
|
|
27
|
+
text = await fs.readFile(full, "utf8");
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
parts.push(`### ${full}\n(not included: couldn't be read)`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (text.includes("\u0000")) {
|
|
34
|
+
parts.push(`### ${full}\n(not included: binary file)`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const room = Math.min(FILE_LIMIT, TOTAL_LIMIT - used);
|
|
38
|
+
const cut = text.length > room;
|
|
39
|
+
const shown = cut ? text.slice(0, room) : text;
|
|
40
|
+
used += shown.length;
|
|
41
|
+
const fence = shown.includes("```") ? "````" : "```";
|
|
42
|
+
parts.push(`### ${full}${cut ? ` (first ${room} of ${text.length} characters; read the rest if you need it)` : ""}\n${fence}\n${shown}${shown.endsWith("\n") ? "" : "\n"}${fence}`);
|
|
43
|
+
}
|
|
44
|
+
return `${task}\n\n## Files already read for you\nTheir current contents, so you don't need to read them again before working on them.\n\n${parts.join("\n\n")}`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=context-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-files.js","sourceRoot":"","sources":["../../src/core/context-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,yEAAyE;AACzE,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,6EAA6E;AAC7E,MAAM,WAAW,GAAG,MAAM,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,IAAY,EACZ,KAAwB,EACxB,GAAW;IAEX,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,WAAW,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,+DAA+D,CAAC,CAAC;YACvF,SAAS;QACX,CAAC;QACD,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,MAAM,CAAC;YACP,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,oCAAoC,CAAC,CAAC;YAC5D,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,+BAA+B,CAAC,CAAC;YACvD,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/C,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC;QACrB,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;QACrD,KAAK,CAAC,IAAI,CACR,OAAO,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI,OAAO,IAAI,CAAC,MAAM,4CAA4C,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,KAAK,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,EAAE,CACxK,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,IAAI,8HAA8H,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;AACnK,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AskQuestion, AskUserResult } from "./ask-user.js";
|
|
3
|
+
/**
|
|
4
|
+
* Goals: a long-running objective the user hands to GG Coder ("Bring p95
|
|
5
|
+
* latency under 200 ms across the whole API"). Each goal is its own folder under
|
|
6
|
+
* `~/.gg/goals/<id>/` holding `goal.json`; that folder is also the goal's
|
|
7
|
+
* workspace (the coordinator session's cwd) and, later, its shared library.
|
|
8
|
+
* Context folders and files the user attaches live elsewhere on disk and are
|
|
9
|
+
* referenced by absolute path.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GOAL_FILE = "goal.json";
|
|
12
|
+
/** New names stay short enough to read at a glance in the goal list. */
|
|
13
|
+
export declare const GOAL_NAME_MAX = 15;
|
|
14
|
+
export declare const GOAL_TEXT_MAX = 2000;
|
|
15
|
+
export declare const GOAL_CONTEXT_MAX = 20;
|
|
16
|
+
/** Standing instructions the user gives a goal (rules that hold throughout). */
|
|
17
|
+
export declare const GOAL_INSTRUCTIONS_MAX = 4000;
|
|
18
|
+
/** The goal's memory file in its folder: decisions and preferences learned along the way. */
|
|
19
|
+
export declare const GOAL_MEMORY_FILE = "MEMORY.md";
|
|
20
|
+
/** How much of the memory file is loaded into GG Goals' brief. */
|
|
21
|
+
export declare const GOAL_MEMORY_MAX = 16000;
|
|
22
|
+
declare const contextItemSchema: z.ZodObject<{
|
|
23
|
+
path: z.ZodString;
|
|
24
|
+
kind: z.ZodEnum<{
|
|
25
|
+
file: "file";
|
|
26
|
+
folder: "folder";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
declare const goalRecordSchema: z.ZodObject<{
|
|
30
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
name: z.ZodString;
|
|
33
|
+
goal: z.ZodString;
|
|
34
|
+
context: z.ZodArray<z.ZodObject<{
|
|
35
|
+
path: z.ZodString;
|
|
36
|
+
kind: z.ZodEnum<{
|
|
37
|
+
file: "file";
|
|
38
|
+
folder: "folder";
|
|
39
|
+
}>;
|
|
40
|
+
}, z.core.$strip>>;
|
|
41
|
+
createdAt: z.ZodString;
|
|
42
|
+
kickoffAt: z.ZodOptional<z.ZodString>;
|
|
43
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
44
|
+
critterModel: z.ZodOptional<z.ZodObject<{
|
|
45
|
+
provider: z.ZodString;
|
|
46
|
+
model: z.ZodString;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
49
|
+
pausedAt: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
/** What the app sends to create a goal. Context kinds are re-derived on disk. */
|
|
52
|
+
export declare const createGoalInputSchema: z.ZodObject<{
|
|
53
|
+
name: z.ZodString;
|
|
54
|
+
goal: z.ZodString;
|
|
55
|
+
context: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
56
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
/** What the app sends to change a goal's context or instructions after it's created. */
|
|
59
|
+
export declare const updateGoalInputSchema: z.ZodObject<{
|
|
60
|
+
context: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
61
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type UpdateGoalInput = z.input<typeof updateGoalInputSchema>;
|
|
64
|
+
export type GoalContextItem = z.infer<typeof contextItemSchema>;
|
|
65
|
+
export type GoalRecord = z.infer<typeof goalRecordSchema>;
|
|
66
|
+
export type CreateGoalInput = z.input<typeof createGoalInputSchema>;
|
|
67
|
+
export type GoalResult<T> = {
|
|
68
|
+
ok: true;
|
|
69
|
+
value: T;
|
|
70
|
+
} | {
|
|
71
|
+
ok: false;
|
|
72
|
+
error: string;
|
|
73
|
+
};
|
|
74
|
+
/** Folder that holds every goal. */
|
|
75
|
+
export declare function goalsRoot(agentDir: string): string;
|
|
76
|
+
/** Lowercase dashed folder name; empty when the name has no usable characters. */
|
|
77
|
+
export declare function goalSlug(name: string): string;
|
|
78
|
+
/** True when `dir` is exactly one goal folder directly inside `root`. */
|
|
79
|
+
export declare function isGoalDir(root: string, dir: string): boolean;
|
|
80
|
+
/** True when `target` is `root` or anything beneath it. */
|
|
81
|
+
export declare function isInsideGoalsRoot(root: string, target: string): boolean;
|
|
82
|
+
/** Read and validate one goal folder's record; null when absent or invalid. */
|
|
83
|
+
export declare function readGoal(dir: string): Promise<GoalRecord | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Create a goal folder and its record. The folder name is the slug, suffixed
|
|
86
|
+
* `-2`, `-3`… when taken; `mkdir` without `recursive` makes the claim atomic.
|
|
87
|
+
*/
|
|
88
|
+
export declare function createGoal(root: string, input: CreateGoalInput, now: Date): Promise<GoalResult<{
|
|
89
|
+
dir: string;
|
|
90
|
+
record: GoalRecord;
|
|
91
|
+
}>>;
|
|
92
|
+
/** Every valid goal under `root` with its folder. Unreadable folders are skipped. */
|
|
93
|
+
export declare function listGoals(root: string): Promise<Array<{
|
|
94
|
+
dir: string;
|
|
95
|
+
record: GoalRecord;
|
|
96
|
+
}>>;
|
|
97
|
+
/**
|
|
98
|
+
* True while a goal still needs GG Goals' automatic first reply: the kickoff
|
|
99
|
+
* was never started and the conversation has no user or assistant message yet.
|
|
100
|
+
* The system prompt is not conversation, so it does not count.
|
|
101
|
+
*/
|
|
102
|
+
export declare function goalNeedsKickoff(record: GoalRecord, messages: ReadonlyArray<{
|
|
103
|
+
role: string;
|
|
104
|
+
}>): boolean;
|
|
105
|
+
/** Briefing until the user starts the goal; active from then on. */
|
|
106
|
+
export type GoalPhase = "briefing" | "active";
|
|
107
|
+
export declare function goalPhase(record: GoalRecord): GoalPhase;
|
|
108
|
+
/**
|
|
109
|
+
* True when an ask_user result is the user choosing to start the goal. An
|
|
110
|
+
* answer comes back as the option's `value` when it has one, so pass the
|
|
111
|
+
* questions asked: an option labelled GOAL_START_OPTION counts by its value
|
|
112
|
+
* too (live bug: GG Goals gave it the value "start", the answer came back as
|
|
113
|
+
* "start", and the goal never started).
|
|
114
|
+
*/
|
|
115
|
+
export declare function isGoalStartAnswer(result: AskUserResult, questions?: ReadonlyArray<AskQuestion>): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Start the goal if `result` is the user choosing to, whether it came back
|
|
118
|
+
* while GG Goals was still waiting on its question or after the question's
|
|
119
|
+
* deadline passed (a late answer). Returns the started record, or null when
|
|
120
|
+
* the answer isn't the start option or the goal had already started.
|
|
121
|
+
*/
|
|
122
|
+
export declare function startGoalOnAnswer(dir: string, record: GoalRecord, result: AskUserResult, now: Date, questions?: ReadonlyArray<AskQuestion>): Promise<GoalRecord | null>;
|
|
123
|
+
/**
|
|
124
|
+
* Pin the model the goal's workers run on, or clear it (null) so they follow
|
|
125
|
+
* GG Goals' model. Returns the updated record; null when the goal is gone.
|
|
126
|
+
*/
|
|
127
|
+
export declare function setGoalCritterModel(dir: string, pick: {
|
|
128
|
+
provider: string;
|
|
129
|
+
model: string;
|
|
130
|
+
} | null): Promise<GoalRecord | null>;
|
|
131
|
+
/**
|
|
132
|
+
* Record that the user started the goal. Returns the updated record, or null
|
|
133
|
+
* when it had already started (or the goal is gone), so it is set only once.
|
|
134
|
+
*/
|
|
135
|
+
export declare function markGoalStarted(dir: string, now: Date): Promise<GoalRecord | null>;
|
|
136
|
+
/**
|
|
137
|
+
* Change a goal's attached context or standing instructions. Paths are
|
|
138
|
+
* re-resolved on disk like at creation; an empty instructions string clears
|
|
139
|
+
* them. Takes effect for the goal's next session (GG Goals' brief is fixed
|
|
140
|
+
* for a session, so its prompt cache holds).
|
|
141
|
+
*/
|
|
142
|
+
export declare function updateGoal(dir: string, input: UpdateGoalInput): Promise<GoalResult<GoalRecord>>;
|
|
143
|
+
/** Pause a goal (true) or let it carry on (false). Returns the updated record, or null if missing. */
|
|
144
|
+
export declare function setGoalPaused(dir: string, paused: boolean, now: Date): Promise<GoalRecord | null>;
|
|
145
|
+
/**
|
|
146
|
+
* The goal's memory: what GG Goals has written down in its folder's
|
|
147
|
+
* MEMORY.md (decisions, the user's preferences and corrections, what's done
|
|
148
|
+
* and what's left). Empty when there's none yet. Long files are cut to
|
|
149
|
+
* GOAL_MEMORY_MAX, with a note, so the brief stays bounded.
|
|
150
|
+
*/
|
|
151
|
+
export declare function readGoalMemory(dir: string): Promise<string>;
|
|
152
|
+
/**
|
|
153
|
+
* Delete one goal: its folder (record, notes, artifacts) and the coordinator
|
|
154
|
+
* sessions stored for it. Attached context lives elsewhere and is untouched.
|
|
155
|
+
* `id` must name a direct child of `root`; anything else is refused.
|
|
156
|
+
*/
|
|
157
|
+
export declare function deleteGoal(root: string, sessionsDir: string, id: string): Promise<GoalResult<{
|
|
158
|
+
dir: string;
|
|
159
|
+
}>>;
|
|
160
|
+
/**
|
|
161
|
+
* Record that the coordinator's first reply has started. Returns null when it
|
|
162
|
+
* already had (or the goal is gone), so a second caller never kicks off twice.
|
|
163
|
+
*/
|
|
164
|
+
export declare function markGoalKickoff(dir: string, now: Date): Promise<GoalRecord | null>;
|
|
165
|
+
/** The two answers to the coordinator's "ready to start?" question. */
|
|
166
|
+
export declare const GOAL_START_OPTION = "Start the goal now";
|
|
167
|
+
export declare const GOAL_HOLD_OPTION = "Hang on, I want to discuss it more";
|
|
168
|
+
/**
|
|
169
|
+
* The coordinator's standing brief, appended to the system prompt of a session
|
|
170
|
+
* whose cwd is a goal folder. Static for the goal's lifetime.
|
|
171
|
+
*/
|
|
172
|
+
/** What GG Goals' brief carries besides the goal itself, read once per session. */
|
|
173
|
+
export interface GoalBriefExtras {
|
|
174
|
+
/** The goal folder's MEMORY.md (see readGoalMemory); empty when there's none. */
|
|
175
|
+
memory?: string;
|
|
176
|
+
/** Each attached folder's instruction files (AGENTS.md, CLAUDE.md…), by folder. */
|
|
177
|
+
projectRules?: ReadonlyArray<{
|
|
178
|
+
readonly folder: string;
|
|
179
|
+
readonly rules: readonly string[];
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
export declare function renderGoalPrompt(dir: string, record: GoalRecord, extras?: GoalBriefExtras): string;
|
|
183
|
+
/** What GG Goals is told when the user changes the goal's settings mid-session. */
|
|
184
|
+
export declare function goalSettingsNote(record: GoalRecord): string;
|
|
185
|
+
/**
|
|
186
|
+
* Whether a started goal was cut off mid-work and should pick itself back up
|
|
187
|
+
* when its session opens again: it isn't paused, and either a worker was
|
|
188
|
+
* interrupted by the restart or GG Goals' own last turn never finished (its
|
|
189
|
+
* last message is a tool call, or a tool result or message with no reply
|
|
190
|
+
* after it).
|
|
191
|
+
*/
|
|
192
|
+
export declare function goalWasInterrupted(record: GoalRecord, messages: ReadonlyArray<{
|
|
193
|
+
role: string;
|
|
194
|
+
content?: unknown;
|
|
195
|
+
}>, workers: ReadonlyArray<{
|
|
196
|
+
state: string;
|
|
197
|
+
recovered?: boolean;
|
|
198
|
+
}>): boolean;
|
|
199
|
+
/**
|
|
200
|
+
* The note behind GG Goals' first run after the goal was interrupted (the
|
|
201
|
+
* app closed or crashed mid-work): workers don't survive a restart, so it
|
|
202
|
+
* checks what got done and carries on with the rest. Cut off mid-briefing,
|
|
203
|
+
* it asks its question again instead.
|
|
204
|
+
*/
|
|
205
|
+
export declare function goalResumePrompt(record: GoalRecord): string;
|
|
206
|
+
/** The hidden instruction behind the coordinator's first, automatic reply. */
|
|
207
|
+
export declare function goalKickoffPrompt(record: GoalRecord): string;
|
|
208
|
+
export {};
|