@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
|
@@ -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":"AA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C,CAAC;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAChE,OAAO,mBAAmB,CAAC,CAAC,QAAQ,OAAO,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IAC1F,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;IAChB,OAAO,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"}
|
|
@@ -1,80 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
* One API-key option for a provider that splits auth across multiple distinct
|
|
4
|
-
* endpoints/credentials (currently only Xiaomi: Token Plan vs. API Credits).
|
|
5
|
-
* Each variant stores under its own auth.json key so a user can hold both at
|
|
6
|
-
* once — the model registry picks which one a given model resolves via
|
|
7
|
-
* `getAuthStorageKeys()`.
|
|
8
|
-
*/
|
|
9
|
-
export interface ApiKeyVariant {
|
|
10
|
-
/** Storage key in auth.json (distinct from `value` when multiple variants exist). */
|
|
11
|
-
key: string;
|
|
12
|
-
/** Display label, e.g. "Token Plan" or "API Credits". */
|
|
13
|
-
label: string;
|
|
14
|
-
/** Base URL stored alongside this variant's credential. */
|
|
15
|
-
baseUrl?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface AuthProviderMeta {
|
|
18
|
-
/** Stable provider id (matches the gg-ai Provider union, plus storage keys). */
|
|
19
|
-
value: string;
|
|
20
|
-
/** Display name shown in the login list. */
|
|
21
|
-
label: string;
|
|
22
|
-
/** One-line model summary. */
|
|
23
|
-
description: string;
|
|
24
|
-
/** Supported auth methods, in preferred order (oauth first when both). */
|
|
25
|
-
methods: AuthMethod[];
|
|
26
|
-
/** Friendly label for the API key field (e.g. "Z.AI"). */
|
|
27
|
-
apiKeyLabel?: string;
|
|
28
|
-
/** Fixed base URL stored alongside an API key (e.g. Xiaomi's token plan). */
|
|
29
|
-
apiKeyBaseUrl?: string;
|
|
30
|
-
/**
|
|
31
|
-
* When a provider's API-key auth splits across multiple endpoints, the
|
|
32
|
-
* choices to present (in order). The first variant is the default. Absent
|
|
33
|
-
* for every provider with a single API-key credential.
|
|
34
|
-
*/
|
|
35
|
-
apiKeyVariants?: ApiKeyVariant[];
|
|
36
|
-
/**
|
|
37
|
-
* Per-method guidance overrides. Only providers whose methods differ in
|
|
38
|
-
* billing/entitlement (the dual-auth ones) need these; everything else is
|
|
39
|
-
* described generically by {@link describeAuthMethods}.
|
|
40
|
-
*/
|
|
41
|
-
methodDetails?: Partial<Record<AuthMethod, AuthMethodMeta>>;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* What one auth method means for a provider, so both UIs can answer "which do I
|
|
45
|
-
* pick?" without hardcoding provider knowledge in a component.
|
|
46
|
-
*/
|
|
47
|
-
export interface AuthMethodMeta {
|
|
48
|
-
method: AuthMethod;
|
|
49
|
-
/** Button/row label, e.g. "Sign in with Grok (SuperGrok / X Premium)". */
|
|
50
|
-
label: string;
|
|
51
|
-
/** What the user spends on this method. */
|
|
52
|
-
billing: string;
|
|
53
|
-
/** When to choose it. */
|
|
54
|
-
when: string;
|
|
55
|
-
/** Prerequisite the user must already have, if any. */
|
|
56
|
-
requires?: string;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Every provider a user can connect, in login-screen order. `description`
|
|
60
|
-
* lists that provider's models and feeds both the CLI login screen and the
|
|
61
|
-
* app's provider list, so `auth-providers.test.ts` pins each one to the model
|
|
62
|
-
* registry — a registry change that isn't reflected here fails the suite.
|
|
63
|
-
*/
|
|
64
|
-
export declare const AUTH_PROVIDERS: AuthProviderMeta[];
|
|
65
|
-
export declare function getAuthProvider(value: string): AuthProviderMeta | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Per-method guidance for a provider, in resolution order. Providers with a
|
|
68
|
-
* single method get a generic description; the dual-auth ones (Kimi, Grok) carry
|
|
69
|
-
* explicit `methodDetails` because the choice changes what the user is billed.
|
|
70
|
-
*/
|
|
71
|
-
export declare function describeAuthMethods(provider: string): AuthMethodMeta[];
|
|
72
|
-
/**
|
|
73
|
-
* How the runtime picks between two connected methods, phrased for the UI. Only
|
|
74
|
-
* dual-auth providers have a choice to explain; everything else returns
|
|
75
|
-
* undefined so callers can omit the note entirely.
|
|
76
|
-
*
|
|
77
|
-
* Keep this wording in sync with AuthStorage's actual resolution order in
|
|
78
|
-
* gg-core (`DUAL_AUTH_PROVIDERS`) — it is the user-facing description of it.
|
|
79
|
-
*/
|
|
80
|
-
export declare function authPriorityNote(provider: string): string | undefined;
|
|
1
|
+
export { AUTH_PROVIDERS, getAuthProvider, describeAuthMethods, authPriorityNote, } from "@kenkaiiii/gg-core";
|
|
2
|
+
export type { AuthMethod, ApiKeyVariant, AuthProviderMeta, AuthMethodMeta, } from "@kenkaiiii/gg-core";
|
|
@@ -1,184 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { XIAOMI_CREDITS_KEY, dualAuthProvider } from "@kenkaiiii/gg-core";
|
|
6
|
-
/**
|
|
7
|
-
* Every provider a user can connect, in login-screen order. `description`
|
|
8
|
-
* lists that provider's models and feeds both the CLI login screen and the
|
|
9
|
-
* app's provider list, so `auth-providers.test.ts` pins each one to the model
|
|
10
|
-
* registry — a registry change that isn't reflected here fails the suite.
|
|
11
|
-
*/
|
|
12
|
-
export const AUTH_PROVIDERS = [
|
|
13
|
-
{
|
|
14
|
-
value: "anthropic",
|
|
15
|
-
label: "Anthropic",
|
|
16
|
-
description: "Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5",
|
|
17
|
-
methods: ["oauth"],
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
value: "openai",
|
|
21
|
-
label: "OpenAI",
|
|
22
|
-
description: "GPT-6 Astra, GPT-6.1 Sol, GPT-6 Luna",
|
|
23
|
-
methods: ["oauth"],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
value: "gemini",
|
|
27
|
-
label: "Gemini",
|
|
28
|
-
description: "Gemini 3.8 Flash, 3.5 Flash Lite, 3.7 Flash, 3.1 Flash Lite, 3.5 Flash, 3.1 Pro (Preview)",
|
|
29
|
-
methods: ["oauth"],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: "xai",
|
|
33
|
-
label: "xAI (Grok)",
|
|
34
|
-
description: "Grok 4.7 · OAuth or API key",
|
|
35
|
-
methods: ["oauth", "apikey"],
|
|
36
|
-
apiKeyLabel: "xAI",
|
|
37
|
-
methodDetails: {
|
|
38
|
-
oauth: {
|
|
39
|
-
method: "oauth",
|
|
40
|
-
label: "Sign in with Grok",
|
|
41
|
-
billing: "Included with SuperGrok or X Premium.",
|
|
42
|
-
when: "",
|
|
43
|
-
},
|
|
44
|
-
apikey: {
|
|
45
|
-
method: "apikey",
|
|
46
|
-
label: "xAI API key",
|
|
47
|
-
billing: "Pay-per-token on console.x.ai credits.",
|
|
48
|
-
when: "",
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
value: "moonshot",
|
|
54
|
-
label: "Moonshot",
|
|
55
|
-
description: "Kimi K3, K2.8 Preview (Kimi sign-in), K2.7 Code, K2.7 Code HighSpeed · OAuth or API key",
|
|
56
|
-
methods: ["oauth", "apikey"],
|
|
57
|
-
apiKeyLabel: "Moonshot",
|
|
58
|
-
methodDetails: {
|
|
59
|
-
oauth: {
|
|
60
|
-
method: "oauth",
|
|
61
|
-
label: "Sign in with Kimi",
|
|
62
|
-
billing: "Included with a Kimi For Coding plan.",
|
|
63
|
-
when: "",
|
|
64
|
-
},
|
|
65
|
-
apikey: {
|
|
66
|
-
method: "apikey",
|
|
67
|
-
label: "Moonshot API key",
|
|
68
|
-
billing: "Pay-per-token on Moonshot credits.",
|
|
69
|
-
when: "",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
value: "glm",
|
|
75
|
-
label: "Z.AI (GLM)",
|
|
76
|
-
description: "GLM-5.3, GLM-5.3-Flash",
|
|
77
|
-
methods: ["apikey"],
|
|
78
|
-
apiKeyLabel: "Z.AI",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
value: "minimax",
|
|
82
|
-
label: "MiniMax",
|
|
83
|
-
description: "MiniMax M3",
|
|
84
|
-
methods: ["apikey"],
|
|
85
|
-
apiKeyLabel: "MiniMax",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
value: "xiaomi",
|
|
89
|
-
label: "Xiaomi (MiMo)",
|
|
90
|
-
description: "MiMo-V2.6-Pro, MiMo-V2.6-Flash, MiMo-V2.6-Pro-UltraSpeed · Token Plan or API Credits",
|
|
91
|
-
methods: ["apikey"],
|
|
92
|
-
apiKeyLabel: "Xiaomi MiMo",
|
|
93
|
-
apiKeyBaseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
94
|
-
apiKeyVariants: [
|
|
95
|
-
{
|
|
96
|
-
key: "xiaomi",
|
|
97
|
-
label: "Token Plan",
|
|
98
|
-
baseUrl: "https://token-plan-sgp.xiaomimimo.com/v1",
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
key: XIAOMI_CREDITS_KEY,
|
|
102
|
-
label: "API Credits (required for UltraSpeed)",
|
|
103
|
-
baseUrl: "https://api.xiaomimimo.com/v1",
|
|
104
|
-
},
|
|
105
|
-
],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
value: "deepseek",
|
|
109
|
-
label: "DeepSeek",
|
|
110
|
-
description: "DeepSeek V4 Pro, V4.1 Flash",
|
|
111
|
-
methods: ["apikey"],
|
|
112
|
-
apiKeyLabel: "DeepSeek",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
value: "sakana",
|
|
116
|
-
label: "Sakana (Fugu)",
|
|
117
|
-
description: "Fugu, Fugu Max, Fugu Ultra",
|
|
118
|
-
methods: ["apikey"],
|
|
119
|
-
apiKeyLabel: "Sakana",
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
value: "openrouter",
|
|
123
|
-
label: "OpenRouter",
|
|
124
|
-
description: "Qwen3.8 Max · multi-provider gateway",
|
|
125
|
-
methods: ["apikey"],
|
|
126
|
-
apiKeyLabel: "OpenRouter",
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
value: "huggingface",
|
|
130
|
-
label: "Hugging Face",
|
|
131
|
-
description: "Kimi K2.7 Code, DeepSeek V4.1 Flash, GPT-OSS 120B",
|
|
132
|
-
methods: ["apikey"],
|
|
133
|
-
apiKeyLabel: "Hugging Face",
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
export function getAuthProvider(value) {
|
|
137
|
-
return AUTH_PROVIDERS.find((p) => p.value === value);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Per-method guidance for a provider, in resolution order. Providers with a
|
|
141
|
-
* single method get a generic description; the dual-auth ones (Kimi, Grok) carry
|
|
142
|
-
* explicit `methodDetails` because the choice changes what the user is billed.
|
|
143
|
-
*/
|
|
144
|
-
export function describeAuthMethods(provider) {
|
|
145
|
-
const meta = getAuthProvider(provider);
|
|
146
|
-
if (!meta)
|
|
147
|
-
return [];
|
|
148
|
-
return meta.methods.map((method) => {
|
|
149
|
-
const override = meta.methodDetails?.[method];
|
|
150
|
-
// Copy rather than hand back the table entry itself: callers serialize this
|
|
151
|
-
// alongside the provider meta, and a shared reference appearing twice in one
|
|
152
|
-
// payload trips the sidecar's cycle-safe JSON encoder ([CIRCULAR]).
|
|
153
|
-
if (override)
|
|
154
|
-
return { ...override };
|
|
155
|
-
return method === "oauth"
|
|
156
|
-
? {
|
|
157
|
-
method,
|
|
158
|
-
label: `Sign in with ${meta.label}`,
|
|
159
|
-
billing: "Uses your existing plan with this provider.",
|
|
160
|
-
when: "",
|
|
161
|
-
}
|
|
162
|
-
: {
|
|
163
|
-
method,
|
|
164
|
-
label: `${meta.apiKeyLabel ?? meta.label} API key`,
|
|
165
|
-
billing: "Pay-per-token on this provider's API credits.",
|
|
166
|
-
when: "",
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* How the runtime picks between two connected methods, phrased for the UI. Only
|
|
172
|
-
* dual-auth providers have a choice to explain; everything else returns
|
|
173
|
-
* undefined so callers can omit the note entirely.
|
|
174
|
-
*
|
|
175
|
-
* Keep this wording in sync with AuthStorage's actual resolution order in
|
|
176
|
-
* gg-core (`DUAL_AUTH_PROVIDERS`) — it is the user-facing description of it.
|
|
177
|
-
*/
|
|
178
|
-
export function authPriorityNote(provider) {
|
|
179
|
-
const dual = dualAuthProvider(provider);
|
|
180
|
-
if (!dual)
|
|
181
|
-
return undefined;
|
|
182
|
-
return `Uses ${dual.oauthLabel} first; the ${dual.apiKeyLabel} takes over when it runs out, then switches back.`;
|
|
183
|
-
}
|
|
1
|
+
// Moved to @kenkaiiii/gg-core. This shim re-exports it so existing relative
|
|
2
|
+
// imports (`./auth-providers.js`) and the `./core/auth` export keep resolving
|
|
3
|
+
// unchanged.
|
|
4
|
+
export { AUTH_PROVIDERS, getAuthProvider, describeAuthMethods, authPriorityNote, } from "@kenkaiiii/gg-core";
|
|
184
5
|
//# sourceMappingURL=auth-providers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-providers.js","sourceRoot":"","sources":["../../src/core/auth-providers.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"auth-providers.js","sourceRoot":"","sources":["../../src/core/auth-providers.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,aAAa;AACb,OAAO,EACL,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,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,I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C,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"}
|
package/dist/core/env-delta.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Message } from "@kenkaiiii/gg-ai";
|
|
2
|
-
import type
|
|
2
|
+
import { type SystemPromptEnvironment } from "../system-prompt.js";
|
|
3
|
+
import type { LanguageId } from "./language-detector.js";
|
|
3
4
|
/**
|
|
4
5
|
* Keep the model's picture of its environment true without breaking the cache.
|
|
5
6
|
*
|
|
@@ -24,3 +25,10 @@ export declare function fingerprintEnvironment(env: SystemPromptEnvironment): st
|
|
|
24
25
|
* they agree — the dedupe that keeps an unchanged environment at zero tokens.
|
|
25
26
|
*/
|
|
26
27
|
export declare function buildEnvDeltaMessage(rendered: SystemPromptEnvironment, current: SystemPromptEnvironment): Message | null;
|
|
28
|
+
/**
|
|
29
|
+
* Style packs for languages that appeared after the system prompt was cached
|
|
30
|
+
* (e.g. the previous task scaffolded a TypeScript project). Same append-only
|
|
31
|
+
* idea as the environment update: re-rendering the prompt to add a pack would
|
|
32
|
+
* invalidate every cached byte after it. `null` when nothing renders.
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildLanguageUpdateMessage(languages: Set<LanguageId>, cwd: string): Message | null;
|
package/dist/core/env-delta.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { renderLanguageGuidance } from "../system-prompt.js";
|
|
1
2
|
/**
|
|
2
3
|
* Keep the model's picture of its environment true without breaking the cache.
|
|
3
4
|
*
|
|
@@ -62,4 +63,23 @@ export function buildEnvDeltaMessage(rendered, current) {
|
|
|
62
63
|
"\nTrust them over anything earlier that disagrees. Do not restate this note; just proceed.",
|
|
63
64
|
};
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Style packs for languages that appeared after the system prompt was cached
|
|
68
|
+
* (e.g. the previous task scaffolded a TypeScript project). Same append-only
|
|
69
|
+
* idea as the environment update: re-rendering the prompt to add a pack would
|
|
70
|
+
* invalidate every cached byte after it. `null` when nothing renders.
|
|
71
|
+
*/
|
|
72
|
+
export function buildLanguageUpdateMessage(languages, cwd) {
|
|
73
|
+
const sections = renderLanguageGuidance(languages, cwd);
|
|
74
|
+
if (sections.length === 0)
|
|
75
|
+
return null;
|
|
76
|
+
return {
|
|
77
|
+
role: "user",
|
|
78
|
+
provenance: { source: "runtime", kind: "notification", visibility: "hidden" },
|
|
79
|
+
content: "Project update: new languages are now in use. Apply these defaults to code you write " +
|
|
80
|
+
"from here on, the same way as any style guidance in your instructions.\n\n" +
|
|
81
|
+
sections.join("\n\n") +
|
|
82
|
+
"\n\nDo not restate this note; just proceed.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
65
85
|
//# sourceMappingURL=env-delta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-delta.js","sourceRoot":"","sources":["../../src/core/env-delta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env-delta.js","sourceRoot":"","sources":["../../src/core/env-delta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAgC,MAAM,qBAAqB,CAAC;AAG3F;;;;;;;;;;;;;;;;GAgBG;AAEH,8EAA8E;AAC9E,MAAM,UAAU,sBAAsB,CAAC,GAA4B;IACjE,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,KAAK,E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,CAAC,MAAM,GAAG,CAAC;YACrB,CAAC,CAAC,+BAA+B,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,4BAA4B;YACjG,CAAC,CAAC,mDAAmD,CACxD,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAEpC,8EAA8E;IAC9E,6EAA6E;IAC7E,yEAAyE;IACzE,6EAA6E;IAC7E,mEAAmE;IACnE,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE;QAC7E,OAAO,EACL,gFAAgF;YAChF,8CAA8C;YAC9C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;YAChB,4FAA4F;KAC/F,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAA0B,EAC1B,GAAW;IAEX,MAAM,QAAQ,GAAG,sBAAsB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE;QAC7E,OAAO,EACL,uFAAuF;YACvF,4EAA4E;YAC5E,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;YACrB,6CAA6C;KAChD,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 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 {};
|