@prestyj/cli 5.30.2 → 5.31.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.
Files changed (142) hide show
  1. package/dist/app-sidecar/app-settings.d.ts +6 -2
  2. package/dist/app-sidecar/app-settings.js +39 -20
  3. package/dist/app-sidecar/app-settings.js.map +1 -1
  4. package/dist/app-sidecar/git-target.d.ts +17 -0
  5. package/dist/app-sidecar/git-target.js +31 -0
  6. package/dist/app-sidecar/git-target.js.map +1 -0
  7. package/dist/app-sidecar/goal-routes.d.ts +6 -0
  8. package/dist/app-sidecar/goal-routes.js +360 -0
  9. package/dist/app-sidecar/goal-routes.js.map +1 -0
  10. package/dist/app-sidecar/history-routes.d.ts +13 -0
  11. package/dist/app-sidecar/history-routes.js +37 -27
  12. package/dist/app-sidecar/history-routes.js.map +1 -1
  13. package/dist/app-sidecar/mcp-routes.js +1 -2
  14. package/dist/app-sidecar/mcp-routes.js.map +1 -1
  15. package/dist/app-sidecar/prompt-routes.js +1 -2
  16. package/dist/app-sidecar/prompt-routes.js.map +1 -1
  17. package/dist/app-sidecar/route-context.d.ts +12 -0
  18. package/dist/app-sidecar/run-control-routes.js +2 -1
  19. package/dist/app-sidecar/run-control-routes.js.map +1 -1
  20. package/dist/app-sidecar/session-routes.js +41 -0
  21. package/dist/app-sidecar/session-routes.js.map +1 -1
  22. package/dist/app-sidecar/session-types.d.ts +2 -0
  23. package/dist/app-sidecar/workspace-routes.js +13 -95
  24. package/dist/app-sidecar/workspace-routes.js.map +1 -1
  25. package/dist/app-sidecar.js +219 -67
  26. package/dist/app-sidecar.js.map +1 -1
  27. package/dist/cli/shared.js +1 -1
  28. package/dist/cli/shared.js.map +1 -1
  29. package/dist/core/acceptance-checks.js +17 -4
  30. package/dist/core/acceptance-checks.js.map +1 -1
  31. package/dist/core/agent-notifications.d.ts +1 -1
  32. package/dist/core/agent-session.d.ts +90 -5
  33. package/dist/core/agent-session.js +185 -63
  34. package/dist/core/agent-session.js.map +1 -1
  35. package/dist/core/ask-user.d.ts +11 -0
  36. package/dist/core/ask-user.js +6 -1
  37. package/dist/core/ask-user.js.map +1 -1
  38. package/dist/core/auth-providers.d.ts +2 -80
  39. package/dist/core/auth-providers.js +4 -183
  40. package/dist/core/auth-providers.js.map +1 -1
  41. package/dist/core/cache-diagnostics.d.ts +1 -1
  42. package/dist/core/cache-diagnostics.js +2 -1
  43. package/dist/core/cache-diagnostics.js.map +1 -1
  44. package/dist/core/compaction/tool-result-pruner.d.ts +10 -0
  45. package/dist/core/compaction/tool-result-pruner.js +12 -0
  46. package/dist/core/compaction/tool-result-pruner.js.map +1 -1
  47. package/dist/core/context-files.d.ts +8 -0
  48. package/dist/core/context-files.js +46 -0
  49. package/dist/core/context-files.js.map +1 -0
  50. package/dist/core/custom-commands.d.ts +6 -0
  51. package/dist/core/custom-commands.js +17 -0
  52. package/dist/core/custom-commands.js.map +1 -1
  53. package/dist/core/env-delta.d.ts +9 -1
  54. package/dist/core/env-delta.js +20 -0
  55. package/dist/core/env-delta.js.map +1 -1
  56. package/dist/core/goal-summary.d.ts +32 -0
  57. package/dist/core/goal-summary.js +104 -0
  58. package/dist/core/goal-summary.js.map +1 -0
  59. package/dist/core/goals-store.d.ts +208 -0
  60. package/dist/core/goals-store.js +521 -0
  61. package/dist/core/goals-store.js.map +1 -0
  62. package/dist/core/local-endpoint-store.js +15 -11
  63. package/dist/core/local-endpoint-store.js.map +1 -1
  64. package/dist/core/plan-handoff.d.ts +8 -0
  65. package/dist/core/plan-handoff.js +11 -0
  66. package/dist/core/plan-handoff.js.map +1 -1
  67. package/dist/core/project-discovery.d.ts +7 -0
  68. package/dist/core/project-discovery.js +9 -3
  69. package/dist/core/project-discovery.js.map +1 -1
  70. package/dist/core/radio.d.ts +2 -3
  71. package/dist/core/radio.js.map +1 -1
  72. package/dist/core/session-manager.d.ts +7 -1
  73. package/dist/core/session-manager.js +17 -7
  74. package/dist/core/session-manager.js.map +1 -1
  75. package/dist/core/session-storage.d.ts +3 -0
  76. package/dist/core/session-storage.js +8 -2
  77. package/dist/core/session-storage.js.map +1 -1
  78. package/dist/core/steroids.d.ts +8 -0
  79. package/dist/core/steroids.js +19 -3
  80. package/dist/core/steroids.js.map +1 -1
  81. package/dist/core/subagent-manager.d.ts +51 -0
  82. package/dist/core/subagent-manager.js +103 -16
  83. package/dist/core/subagent-manager.js.map +1 -1
  84. package/dist/core/subagent-store.js +2 -1
  85. package/dist/core/subagent-store.js.map +1 -1
  86. package/dist/goals-agent/goal-team.d.ts +2 -0
  87. package/dist/goals-agent/goal-team.js +83 -0
  88. package/dist/goals-agent/goal-team.js.map +1 -0
  89. package/dist/goals-agent/goals-agent.d.ts +90 -0
  90. package/dist/goals-agent/goals-agent.js +246 -0
  91. package/dist/goals-agent/goals-agent.js.map +1 -0
  92. package/dist/index.js +1 -1
  93. package/dist/index.js.map +1 -1
  94. package/dist/interactive.js +4 -3
  95. package/dist/interactive.js.map +1 -1
  96. package/dist/modes/acp-autopilot.d.ts +27 -0
  97. package/dist/modes/acp-autopilot.js +54 -0
  98. package/dist/modes/acp-autopilot.js.map +1 -0
  99. package/dist/modes/acp-goals.d.ts +48 -0
  100. package/dist/modes/acp-goals.js +103 -0
  101. package/dist/modes/acp-goals.js.map +1 -0
  102. package/dist/modes/acp-mode.d.ts +128 -3
  103. package/dist/modes/acp-mode.js +1082 -52
  104. package/dist/modes/acp-mode.js.map +1 -1
  105. package/dist/modes/subagent-worker-mode.d.ts +14 -0
  106. package/dist/modes/subagent-worker-mode.js +32 -1
  107. package/dist/modes/subagent-worker-mode.js.map +1 -1
  108. package/dist/system-prompt.d.ts +8 -0
  109. package/dist/system-prompt.js +21 -9
  110. package/dist/system-prompt.js.map +1 -1
  111. package/dist/tools/bash-read-evidence.d.ts +13 -0
  112. package/dist/tools/bash-read-evidence.js +48 -1
  113. package/dist/tools/bash-read-evidence.js.map +1 -1
  114. package/dist/tools/grep-scan.d.ts +96 -0
  115. package/dist/tools/grep-scan.js +283 -0
  116. package/dist/tools/grep-scan.js.map +1 -0
  117. package/dist/tools/grep.d.ts +10 -0
  118. package/dist/tools/grep.js +418 -10
  119. package/dist/tools/grep.js.map +1 -1
  120. package/dist/tools/index.d.ts +7 -1
  121. package/dist/tools/index.js +10 -2
  122. package/dist/tools/index.js.map +1 -1
  123. package/dist/tools/read-tracker.d.ts +6 -12
  124. package/dist/tools/read-tracker.js +21 -36
  125. package/dist/tools/read-tracker.js.map +1 -1
  126. package/dist/tools/read.js +2 -2
  127. package/dist/tools/read.js.map +1 -1
  128. package/dist/tools/subagent-control.js +22 -3
  129. package/dist/tools/subagent-control.js.map +1 -1
  130. package/dist/tools/write.js +110 -8
  131. package/dist/tools/write.js.map +1 -1
  132. package/dist/ui/components/ActivityIndicator.d.ts +5 -5
  133. package/dist/ui/components/InputArea.d.ts +2 -2
  134. package/dist/ui/components/InputArea.js +3 -3
  135. package/dist/ui/components/InputArea.js.map +1 -1
  136. package/dist/ui/components/ToolExecution.d.ts +2 -2
  137. package/dist/ui/hooks/useContextCompaction.js +38 -31
  138. package/dist/ui/hooks/useContextCompaction.js.map +1 -1
  139. package/dist/utils/format.d.ts +0 -4
  140. package/dist/utils/format.js +0 -7
  141. package/dist/utils/format.js.map +1 -1
  142. package/package.json +4 -4
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Goal list rows, shared by the desktop sidecar (`app-sidecar/goal-routes.ts`)
3
+ * and ACP mode (`modes/acp-goals.ts`), so both surfaces describe a goal the
4
+ * same way.
5
+ */
6
+ import { promises as fs } from "node:fs";
7
+ import { goalWasInterrupted } from "./goals-store.js";
8
+ import { formatRelativeTime } from "./project-discovery.js";
9
+ /** The kickoff/resume instruction is runtime-authored and never shown as a user bubble. */
10
+ export const GOAL_RUNTIME_PROVENANCE = {
11
+ source: "runtime",
12
+ kind: "automation",
13
+ visibility: "hidden",
14
+ };
15
+ /** How much of a session file's end is read to find its last message. */
16
+ const TAIL_BYTES = 64 * 1024;
17
+ /**
18
+ * The last few messages of a session file (role and content), read from its
19
+ * end only, never thawing or rewriting it. Empty when it can't be read
20
+ * (archived, gone): the goal then just isn't marked interrupted.
21
+ */
22
+ async function lastMessages(file) {
23
+ let text;
24
+ try {
25
+ const handle = await fs.open(file, "r");
26
+ try {
27
+ const { size } = await handle.stat();
28
+ const start = Math.max(0, size - TAIL_BYTES);
29
+ const buf = Buffer.alloc(size - start);
30
+ await handle.read(buf, 0, buf.length, start);
31
+ text = buf.toString("utf-8");
32
+ }
33
+ finally {
34
+ await handle.close();
35
+ }
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ const out = [];
41
+ for (const line of text.split("\n")) {
42
+ if (!line.startsWith("{"))
43
+ continue;
44
+ try {
45
+ const entry = JSON.parse(line);
46
+ if (entry.type === "message" && entry.message?.role) {
47
+ out.push({ role: entry.message.role, content: entry.message.content });
48
+ }
49
+ }
50
+ catch {
51
+ // A line cut at the start of the read window.
52
+ }
53
+ }
54
+ return out;
55
+ }
56
+ /** A goal's status for the list (see GoalSummary.status). */
57
+ export function goalListStatus(record, busy, cutOff = false) {
58
+ if (record.pausedAt)
59
+ return "paused";
60
+ if (busy)
61
+ return "running";
62
+ if (cutOff)
63
+ return "interrupted";
64
+ return record.startedAt ? "idle" : "briefing";
65
+ }
66
+ /** Summarize one goal for a list, from its record and its coordinator sessions. */
67
+ export async function summarizeGoal(sessions, dir, record, busy = false) {
68
+ const list = await sessions.list(dir).catch(() => []);
69
+ const withMessages = list.filter((s) => s.messageCount > 0);
70
+ let lastActiveMs = Date.parse(record.createdAt) || 0;
71
+ let latestSessionPath = null;
72
+ let latestSessionId = null;
73
+ let latestMs = -1;
74
+ for (const s of withMessages) {
75
+ const ms = Date.parse(s.lastActivity) || 0;
76
+ if (ms > latestMs) {
77
+ latestMs = ms;
78
+ latestSessionPath = s.path;
79
+ latestSessionId = s.id;
80
+ }
81
+ if (ms > lastActiveMs)
82
+ lastActiveMs = ms;
83
+ }
84
+ return {
85
+ id: record.id,
86
+ name: record.name,
87
+ goal: record.goal,
88
+ context: record.context,
89
+ path: dir,
90
+ createdAt: record.createdAt,
91
+ lastActiveMs,
92
+ lastActiveDisplay: formatRelativeTime(lastActiveMs),
93
+ latestSessionPath,
94
+ latestSessionId,
95
+ status: goalListStatus(record, busy,
96
+ // Not working, but its last turn never finished: the app closed, or it
97
+ // was stopped, mid-work. Workers aren't known here, only the session.
98
+ !busy &&
99
+ Boolean(record.startedAt) &&
100
+ latestSessionPath !== null &&
101
+ goalWasInterrupted(record, await lastMessages(latestSessionPath), [])),
102
+ };
103
+ }
104
+ //# sourceMappingURL=goal-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goal-summary.js","sourceRoot":"","sources":["../../src/core/goal-summary.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAmB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG5D,2FAA2F;AAC3F,MAAM,CAAC,MAAM,uBAAuB,GAAsB;IACxD,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,YAAY;IAClB,UAAU,EAAE,QAAQ;CACrB,CAAC;AAyBF,yEAAyE;AACzE,MAAM,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AAE7B;;;;GAIG;AACH,KAAK,UAAU,YAAY,CAAC,IAAY;IACtC,IAAI,IAAY,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,UAAU,CAAC,CAAC;YAC7C,M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MAAM,CAAC,SAAS;QAC3B,YAAY;QACZ,iBAAiB,EAAE,kBAAkB,CAAC,YAAY,CAAC;QACnD,iBAAiB;QACjB,eAAe;QACf,MAAM,EAAE,cAAc,CACpB,MAAM,EACN,IAAI;QACJ,uEAAuE;QACvE,sEAAsE;QACtE,CAAC,IAAI;YACH,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;YACzB,iBAAiB,KAAK,IAAI;YAC1B,kBAAkB,CAAC,MAAM,EAAE,MAAM,YAAY,CAAC,iBAAiB,CAAC,EAAE,EAAE,CAAC,CACxE;KACF,CAAC;AACJ,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 EZ Coder ("Bring p95
5
+ * latency under 200 ms across the whole API"). Each goal is its own folder under
6
+ * `~/.ezcoder/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 EZ 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 EZ 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: EZ 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 EZ 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
+ * EZ 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 (EZ 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 EZ 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 EZ 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 EZ 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 EZ 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 EZ 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 {};