@kenkaiiii/ggcoder 5.86.3 → 5.87.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/README.md +23 -32
- package/assets/skills/bulletproof/SKILL.md +3 -1
- package/assets/skills/compliance-guard/SKILL.md +1 -1
- package/assets/skills/durable/SKILL.md +1 -1
- package/assets/skills/lean/SKILL.md +3 -1
- package/dist/app-sidecar/progress-manager.d.ts +2 -20
- package/dist/app-sidecar/progress-manager.js +2 -15
- package/dist/app-sidecar/progress-manager.js.map +1 -1
- package/dist/app-sidecar/royale.d.ts +26 -24
- package/dist/app-sidecar/royale.js +85 -187
- package/dist/app-sidecar/royale.js.map +1 -1
- package/dist/app-sidecar.js +32 -40
- package/dist/app-sidecar.js.map +1 -1
- package/dist/config.d.ts +12 -0
- package/dist/config.js +24 -94
- package/dist/config.js.map +1 -1
- package/dist/core/autopilot-gate.js +2 -3
- package/dist/core/autopilot-gate.js.map +1 -1
- package/dist/core/bundled-agents.js +7 -27
- package/dist/core/bundled-agents.js.map +1 -1
- package/dist/core/checklist-items.d.ts +0 -8
- package/dist/core/checklist-items.js +0 -8
- package/dist/core/checklist-items.js.map +1 -1
- package/dist/core/code-retrieval.d.ts +1 -1
- package/dist/core/code-retrieval.js +2 -2
- package/dist/core/code-retrieval.js.map +1 -1
- package/dist/core/mcp/deferred-catalog.d.ts +1 -1
- package/dist/core/mcp/deferred-catalog.js +1 -1
- package/dist/core/prompt-commands.js +0 -99
- package/dist/core/prompt-commands.js.map +1 -1
- package/dist/core/skills.d.ts +6 -0
- package/dist/core/skills.js +11 -3
- package/dist/core/skills.js.map +1 -1
- package/dist/core/style-packs/packs.js +1 -1
- package/dist/core/subagent-policy.d.ts +6 -0
- package/dist/core/subagent-policy.js +21 -2
- package/dist/core/subagent-policy.js.map +1 -1
- package/dist/core/subagent-receipt.d.ts +2 -2
- package/dist/core/subagent-receipt.js +5 -8
- package/dist/core/subagent-receipt.js.map +1 -1
- package/dist/core/trophies/catalog-more.js +3 -23
- package/dist/core/trophies/catalog-more.js.map +1 -1
- package/dist/core/trophies/engine.js +0 -4
- package/dist/core/trophies/engine.js.map +1 -1
- package/dist/core/trophies/types.d.ts +1 -1
- package/dist/core/trophies/types.js +0 -2
- package/dist/core/trophies/types.js.map +1 -1
- package/dist/goals-agent/goal-team.js +3 -4
- package/dist/goals-agent/goal-team.js.map +1 -1
- package/dist/modes/acp-mode.js +0 -1
- package/dist/modes/acp-mode.js.map +1 -1
- package/dist/system-prompt.js +1 -0
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/index.d.ts +0 -2
- package/dist/tools/index.js +0 -6
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/operations.js +1 -1
- package/dist/tools/operations.js.map +1 -1
- package/dist/tools/prompt-hints.js +0 -6
- package/dist/tools/prompt-hints.js.map +1 -1
- package/dist/tools/skill.js +11 -5
- package/dist/tools/skill.js.map +1 -1
- package/dist/tools/tool-tiers.d.ts +2 -1
- package/dist/tools/tool-tiers.js +2 -3
- package/dist/tools/tool-tiers.js.map +1 -1
- package/dist/ui/App.js +0 -1
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/components/SkillsOverlay.js +2 -1
- package/dist/ui/components/SkillsOverlay.js.map +1 -1
- package/package.json +6 -5
- package/assets/skills/clarify/SKILL.md +0 -39
- package/assets/skills/code-review/SKILL.md +0 -82
- package/assets/skills/code-review/references/agent-diffs.md +0 -27
- package/assets/skills/code-review/references/tests.md +0 -19
- package/assets/skills/evidence-led-ui/LICENSES.md +0 -79
- package/assets/skills/evidence-led-ui/SKILL.md +0 -95
- package/assets/skills/evidence-led-ui/references/anti-defaults.md +0 -110
- package/assets/skills/evidence-led-ui/references/archetypes.md +0 -97
- package/assets/skills/evidence-led-ui/references/craft-rulings.md +0 -242
- package/assets/skills/evidence-led-ui/references/direction.md +0 -116
- package/assets/skills/evidence-led-ui/references/methodology.md +0 -64
- package/assets/skills/evidence-led-ui/references/observed-patterns.md +0 -68
- package/assets/skills/evidence-led-ui/references/production-contract.md +0 -148
- package/assets/skills/evidence-led-ui/references/provenance.md +0 -142
- package/assets/skills/evidence-led-ui/references/quality-rubric.md +0 -126
- package/assets/skills/evidence-led-ui/references/ui-libraries.md +0 -30
- package/assets/skills/refactoring/SKILL.md +0 -72
- package/assets/skills/refactoring/references/agent-pitfalls.md +0 -46
- package/assets/skills/refactoring/references/legacy.md +0 -70
- package/assets/skills/refactoring/references/smells.md +0 -71
- package/assets/skills/root-cause/SKILL.md +0 -46
- package/assets/skills/shared-language/SKILL.md +0 -32
- package/assets/skills/tdd/SKILL.md +0 -42
- package/dist/app-sidecar/royale-bug.d.ts +0 -19
- package/dist/app-sidecar/royale-bug.js +0 -112
- package/dist/app-sidecar/royale-bug.js.map +0 -1
- package/dist/app-sidecar/royale-deploy.d.ts +0 -5
- package/dist/app-sidecar/royale-deploy.js +0 -76
- package/dist/app-sidecar/royale-deploy.js.map +0 -1
- package/dist/tools/code-nav.d.ts +0 -29
- package/dist/tools/code-nav.js +0 -299
- package/dist/tools/code-nav.js.map +0 -1
- package/dist/tools/search-code.d.ts +0 -10
- package/dist/tools/search-code.js +0 -90
- package/dist/tools/search-code.js.map +0 -1
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
1
|
import fs from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { log } from "../core/logger.js";
|
|
5
|
-
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/** The
|
|
14
|
-
*
|
|
15
|
-
export const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
function count(v) {
|
|
19
|
-
return typeof v === "number" && Number.isSafeInteger(v) && v >= 0 ? v : 0;
|
|
20
|
-
}
|
|
4
|
+
// ── GG World device link ────────────────────────────────────────────────
|
|
5
|
+
// One device link per install, used only for GG World online save and the
|
|
6
|
+
// live world. It lives in ~/.gg/royale.json (the name is from GG Royale, now
|
|
7
|
+
// closed; the file and its format are unchanged so existing players keep
|
|
8
|
+
// their account). The device token is only ever sent to the server it was
|
|
9
|
+
// minted for.
|
|
10
|
+
/** The live GG World server. GG_WORLD_URL overrides it. */
|
|
11
|
+
export const DEFAULT_WORLD_URL = "https://gg-world.buzzbeamaustralia.workers.dev";
|
|
12
|
+
/** The retired GG Royale server. Links made with it belong to the live World
|
|
13
|
+
* server (same database), so they are never re-registered. */
|
|
14
|
+
export const LEGACY_ROYALE_URL = "https://gg-royale.buzzbeamaustralia.workers.dev";
|
|
15
|
+
const WORLD_TIMEOUT_MS = 8_000;
|
|
16
|
+
const REGISTER_TIMEOUT_MS = 10_000;
|
|
21
17
|
function stripSlashes(url) {
|
|
22
18
|
return url.replace(/\/+$/, "");
|
|
23
19
|
}
|
|
20
|
+
/** The server a saved link belongs to: missing or the old Royale URL = live World. */
|
|
21
|
+
function linkServer(file) {
|
|
22
|
+
const url = stripSlashes(file.serverUrl ?? DEFAULT_WORLD_URL);
|
|
23
|
+
return url === LEGACY_ROYALE_URL ? DEFAULT_WORLD_URL : url;
|
|
24
|
+
}
|
|
24
25
|
function isRoyaleFile(v) {
|
|
25
26
|
if (typeof v !== "object" || v === null)
|
|
26
27
|
return false;
|
|
@@ -31,11 +32,15 @@ function isRoyaleFile(v) {
|
|
|
31
32
|
typeof o.linkedAt === "number" &&
|
|
32
33
|
(o.serverUrl === undefined || typeof o.serverUrl === "string"));
|
|
33
34
|
}
|
|
34
|
-
export function
|
|
35
|
+
export function createWorldLink(opts) {
|
|
35
36
|
const filePath = path.join(opts.agentDir, "royale.json");
|
|
36
37
|
const env = opts.env ?? process.env;
|
|
37
38
|
const doFetch = opts.fetchImpl ?? fetch;
|
|
38
39
|
const now = opts.now ?? Date.now;
|
|
40
|
+
function base() {
|
|
41
|
+
const fromEnv = env.GG_WORLD_URL;
|
|
42
|
+
return stripSlashes(fromEnv && fromEnv.length > 0 ? fromEnv : DEFAULT_WORLD_URL);
|
|
43
|
+
}
|
|
39
44
|
async function read() {
|
|
40
45
|
try {
|
|
41
46
|
const parsed = JSON.parse(await fs.readFile(filePath, "utf8"));
|
|
@@ -45,47 +50,15 @@ export function createRoyale(opts) {
|
|
|
45
50
|
return null;
|
|
46
51
|
}
|
|
47
52
|
}
|
|
48
|
-
/** The
|
|
49
|
-
function target() {
|
|
50
|
-
const fromEnv = env.GG_ROYALE_URL;
|
|
51
|
-
return stripSlashes(fromEnv && fromEnv.length > 0 ? fromEnv : DEFAULT_ROYALE_URL);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The saved link, only if it was made with the server we're talking to. A
|
|
55
|
-
* link (and its device token) belongs to one server: it's never sent to
|
|
56
|
-
* another, and a link to a dev server doesn't stick once you're back on the
|
|
57
|
-
* live game. Links saved before serverUrl was always stored are live links.
|
|
58
|
-
*/
|
|
53
|
+
/** The saved link, only if it belongs to the server we're talking to. */
|
|
59
54
|
async function link() {
|
|
60
55
|
const file = await read();
|
|
61
|
-
|
|
62
|
-
return null;
|
|
63
|
-
return stripSlashes(file.serverUrl ?? DEFAULT_ROYALE_URL) === target() ? file : null;
|
|
64
|
-
}
|
|
65
|
-
async function register(base) {
|
|
66
|
-
const reg = await postJson(`${base}/api/device/register`, {
|
|
67
|
-
client: "gg-coder",
|
|
68
|
-
version: opts.version,
|
|
69
|
-
});
|
|
70
|
-
const r = reg;
|
|
71
|
-
if (typeof r?.playerId !== "string" ||
|
|
72
|
-
typeof r.deviceToken !== "string" ||
|
|
73
|
-
r.deviceToken.length === 0) {
|
|
74
|
-
throw new Error("The GG Royale server sent an unexpected sign-up response.");
|
|
75
|
-
}
|
|
76
|
-
const file = {
|
|
77
|
-
playerId: r.playerId,
|
|
78
|
-
deviceToken: r.deviceToken,
|
|
79
|
-
linkedAt: now(),
|
|
80
|
-
serverUrl: base,
|
|
81
|
-
};
|
|
82
|
-
await write(file);
|
|
83
|
-
return file;
|
|
56
|
+
return file && linkServer(file) === base() ? file : null;
|
|
84
57
|
}
|
|
85
58
|
async function write(file) {
|
|
86
59
|
await fs.mkdir(opts.agentDir, { recursive: true });
|
|
87
60
|
// The device token is private from its first byte: write a 0600 temp
|
|
88
|
-
// file and rename it into place
|
|
61
|
+
// file and rename it into place.
|
|
89
62
|
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
90
63
|
try {
|
|
91
64
|
await fs.writeFile(tmp, JSON.stringify(file, null, 2), {
|
|
@@ -100,152 +73,77 @@ export function createRoyale(opts) {
|
|
|
100
73
|
}
|
|
101
74
|
await fs.chmod(filePath, 0o600).catch(() => { });
|
|
102
75
|
}
|
|
103
|
-
async function
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
res = await doFetch(url, {
|
|
107
|
-
method: "POST",
|
|
108
|
-
headers: {
|
|
109
|
-
"content-type": "application/json",
|
|
110
|
-
...(token ? { authorization: `Bearer ${token}` } : {}),
|
|
111
|
-
},
|
|
112
|
-
body: body === undefined ? undefined : JSON.stringify(body),
|
|
113
|
-
signal: AbortSignal.timeout(OPEN_TIMEOUT_MS),
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
catch {
|
|
117
|
-
throw new Error("Couldn't reach the GG Royale server. Check your connection and try again.");
|
|
118
|
-
}
|
|
119
|
-
if (!res.ok) {
|
|
120
|
-
throw Object.assign(new Error(`The GG Royale server returned an error (HTTP ${res.status}).`), { status: res.status });
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
return await res.json();
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
throw new Error("The GG Royale server sent a response the app couldn't read.");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async function status() {
|
|
130
|
-
const file = await link();
|
|
131
|
-
return { linked: file !== null, serverUrl: target() };
|
|
132
|
-
}
|
|
133
|
-
async function open() {
|
|
134
|
-
const base = target();
|
|
135
|
-
let file = (await link()) ?? (await register(base));
|
|
136
|
-
const code = async (f) => (await postJson(`${base}/api/device/login-code`, undefined, f.deviceToken));
|
|
137
|
-
let codeRes;
|
|
138
|
-
try {
|
|
139
|
-
codeRes = await code(file);
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
// The server no longer knows this link (reset or removed): link again, once.
|
|
143
|
-
if (err.status !== 401)
|
|
144
|
-
throw err;
|
|
145
|
-
file = await register(base);
|
|
146
|
-
codeRes = await code(file);
|
|
147
|
-
}
|
|
148
|
-
if (typeof codeRes?.code !== "string" || codeRes.code.length === 0) {
|
|
149
|
-
throw new Error("The GG Royale server sent an unexpected sign-in response.");
|
|
150
|
-
}
|
|
151
|
-
return { url: `${base}/#code=${encodeURIComponent(codeRes.code)}` };
|
|
152
|
-
}
|
|
153
|
-
async function unlink() {
|
|
154
|
-
await fs.rm(filePath, { force: true });
|
|
155
|
-
}
|
|
156
|
-
function send(base, token, kind, count, bug) {
|
|
157
|
-
// Payload is deliberately ONLY kind/count/at (+ a whitelisted bug label).
|
|
158
|
-
const safeBug = bug && ROYALE_BUG_CATEGORIES.includes(bug) ? bug : null;
|
|
159
|
-
const body = JSON.stringify(safeBug ? { kind, count, at: now(), bug: safeBug } : { kind, count, at: now() });
|
|
160
|
-
void doFetch(`${base}/api/device/outcome`, {
|
|
76
|
+
async function register(server) {
|
|
77
|
+
const res = await doFetch(`${server}/api/world/device/register`, {
|
|
161
78
|
method: "POST",
|
|
162
|
-
headers: { "content-type": "application/json"
|
|
163
|
-
body,
|
|
164
|
-
signal: AbortSignal.timeout(
|
|
165
|
-
})
|
|
166
|
-
.then((res) => {
|
|
167
|
-
if (!res.ok)
|
|
168
|
-
log("DEBUG", "royale", "outcome rejected", { status: String(res.status) });
|
|
169
|
-
})
|
|
170
|
-
.catch((err) => {
|
|
171
|
-
log("DEBUG", "royale", "outcome failed", {
|
|
172
|
-
message: err instanceof Error ? err.message : String(err),
|
|
173
|
-
});
|
|
79
|
+
headers: { "content-type": "application/json" },
|
|
80
|
+
body: JSON.stringify({ client: "gg-coder", version: opts.version }),
|
|
81
|
+
signal: AbortSignal.timeout(REGISTER_TIMEOUT_MS),
|
|
174
82
|
});
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
const key = createHash("sha256").update(goalId).digest("hex").slice(0, 16);
|
|
183
|
-
const day = utcDay();
|
|
184
|
-
let seen = [];
|
|
185
|
-
try {
|
|
186
|
-
const parsed = JSON.parse(await fs.readFile(goalsFile, "utf8"));
|
|
187
|
-
if (parsed.day === day && Array.isArray(parsed.goals)) {
|
|
188
|
-
seen = parsed.goals.filter((g) => typeof g === "string");
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
// No file yet, or unreadable: a fresh day.
|
|
83
|
+
if (!res.ok)
|
|
84
|
+
throw new Error(`World sign-up failed (HTTP ${res.status}).`);
|
|
85
|
+
const r = (await res.json());
|
|
86
|
+
if (typeof r?.playerId !== "string" ||
|
|
87
|
+
typeof r.deviceToken !== "string" ||
|
|
88
|
+
r.deviceToken.length === 0) {
|
|
89
|
+
throw new Error("The World server sent an unexpected sign-up response.");
|
|
193
90
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
void link()
|
|
203
|
-
.then(async (file) => {
|
|
204
|
-
if (!file)
|
|
205
|
-
return;
|
|
206
|
-
const base = target();
|
|
207
|
-
send(base, file.deviceToken, "run", 1, bug);
|
|
208
|
-
const n = Number.isFinite(commits) ? Math.floor(commits) : 0;
|
|
209
|
-
if (n > 0)
|
|
210
|
-
send(base, file.deviceToken, "commit", n);
|
|
211
|
-
if (deployed)
|
|
212
|
-
send(base, file.deviceToken, "deploy", 1);
|
|
213
|
-
if (goalId && (n > 0 || workers) && (await firstGoalWorkToday(goalId))) {
|
|
214
|
-
send(base, file.deviceToken, "goal", 1);
|
|
215
|
-
}
|
|
216
|
-
})
|
|
217
|
-
.catch((err) => {
|
|
218
|
-
log("DEBUG", "royale", "report failed", {
|
|
219
|
-
message: err instanceof Error ? err.message : String(err),
|
|
220
|
-
});
|
|
221
|
-
});
|
|
91
|
+
const file = {
|
|
92
|
+
playerId: r.playerId,
|
|
93
|
+
deviceToken: r.deviceToken,
|
|
94
|
+
linkedAt: now(),
|
|
95
|
+
serverUrl: server,
|
|
96
|
+
};
|
|
97
|
+
await write(file);
|
|
98
|
+
return file;
|
|
222
99
|
}
|
|
223
|
-
async function
|
|
100
|
+
async function world(method, route, body) {
|
|
101
|
+
const server = base();
|
|
224
102
|
try {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
103
|
+
const linked = await link();
|
|
104
|
+
// Nothing to delete without a link: don't sign up just to delete.
|
|
105
|
+
if (!linked && method === "DELETE")
|
|
106
|
+
return { status: 200, body: { deleted: true } };
|
|
107
|
+
const file = linked ?? (await register(server));
|
|
108
|
+
const res = await doFetch(`${server}${route}`, {
|
|
109
|
+
method,
|
|
110
|
+
headers: {
|
|
111
|
+
authorization: `Bearer ${file.deviceToken}`,
|
|
112
|
+
...(body === undefined ? {} : { "content-type": "application/json" }),
|
|
113
|
+
},
|
|
114
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
115
|
+
signal: AbortSignal.timeout(WORLD_TIMEOUT_MS),
|
|
231
116
|
});
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
117
|
+
let parsed = null;
|
|
118
|
+
try {
|
|
119
|
+
parsed = await res.json();
|
|
235
120
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return { claimable: count(o.claimable), streak: count(o.streak), playing: count(o.playing) };
|
|
121
|
+
catch {
|
|
122
|
+
parsed = null;
|
|
123
|
+
}
|
|
124
|
+
return { status: res.status, body: parsed };
|
|
241
125
|
}
|
|
242
126
|
catch (err) {
|
|
243
|
-
log("DEBUG", "
|
|
127
|
+
log("DEBUG", "world", "world request failed", {
|
|
244
128
|
message: err instanceof Error ? err.message : String(err),
|
|
245
129
|
});
|
|
246
|
-
return
|
|
130
|
+
return { status: 0, body: { error: "Couldn't reach the server." } };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function accountDelete() {
|
|
134
|
+
const result = await world("DELETE", "/api/world/account");
|
|
135
|
+
// 404: the server no longer knows this device, so the account is gone too.
|
|
136
|
+
if ((result.status >= 200 && result.status < 300) || result.status === 404) {
|
|
137
|
+
await fs.rm(filePath, { force: true }).catch(() => { });
|
|
247
138
|
}
|
|
139
|
+
return result;
|
|
248
140
|
}
|
|
249
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
worldGet: () => world("GET", "/api/world/profile"),
|
|
143
|
+
worldPut: (ver, patch) => world("PUT", "/api/world/profile", { ver, patch }),
|
|
144
|
+
worldDelete: () => world("DELETE", "/api/world/me"),
|
|
145
|
+
worldLive: () => world("POST", "/api/world/live", {}),
|
|
146
|
+
accountDelete,
|
|
147
|
+
};
|
|
250
148
|
}
|
|
251
149
|
//# sourceMappingURL=royale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"royale.js","sourceRoot":"","sources":["../../src/app-sidecar/royale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"royale.js","sourceRoot":"","sources":["../../src/app-sidecar/royale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,0EAA0E;AAC1E,cAAc;AAEd,2DAA2D;AAC3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,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AE,eAAe,CAAC;QACnD,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,CAAC;QACrD,aAAa;KACd,CAAC;AACJ,CAAC"}
|
package/dist/app-sidecar.js
CHANGED
|
@@ -64,9 +64,7 @@ import { parseWorkspaceMode, } from "./app-sidecar/session-types.js";
|
|
|
64
64
|
import { ALL_PROVIDERS, loadProjectModelPrefs, loadKenModelPref, loadAutopilot, } from "./app-sidecar/app-settings.js";
|
|
65
65
|
import { KEN_ALLOWED_TOOLS } from "./app-sidecar/ken-context.js";
|
|
66
66
|
import { createProgressManager } from "./app-sidecar/progress-manager.js";
|
|
67
|
-
import {
|
|
68
|
-
import { classifyFixedCheck } from "./app-sidecar/royale-bug.js";
|
|
69
|
-
import { detectDeploy } from "./app-sidecar/royale-deploy.js";
|
|
67
|
+
import { createWorldLink } from "./app-sidecar/royale.js";
|
|
70
68
|
import { createTrophyManager } from "./app-sidecar/trophy-manager.js";
|
|
71
69
|
import { localTrophyDate } from "./core/trophies/engine.js";
|
|
72
70
|
import { handleSessionRoutes } from "./app-sidecar/session-routes.js";
|
|
@@ -223,12 +221,12 @@ async function main() {
|
|
|
223
221
|
// XP/rank progress — loaded once per daemon; awards fan out to every window.
|
|
224
222
|
// Each frame is tagged `origin: true` only for the session that earned the
|
|
225
223
|
// XP, so that window alone plays sounds/chips while the rest just re-render.
|
|
226
|
-
// GG
|
|
227
|
-
const
|
|
224
|
+
// GG World online save + live tickets (opt-in; one device link in ~/.gg/royale.json).
|
|
225
|
+
const world = createWorldLink({ agentDir: paths.agentDir, version: VERSION });
|
|
228
226
|
const progress = await createProgressManager(paths.agentDir, (snapshot, originId) => {
|
|
229
227
|
for (const ctx of sessions.values())
|
|
230
228
|
ctx.broadcast("progress", { ...snapshot, origin: ctx.id === originId });
|
|
231
|
-
}
|
|
229
|
+
});
|
|
232
230
|
// Trophies — daemon-level like progress. XP totals (commits, streak, level)
|
|
233
231
|
// come from the progress snapshot rather than being counted twice.
|
|
234
232
|
const trophies = await createTrophyManager(() => {
|
|
@@ -397,46 +395,46 @@ async function main() {
|
|
|
397
395
|
daemonJson(res, 200, trophies.snapshot());
|
|
398
396
|
return;
|
|
399
397
|
}
|
|
400
|
-
// GG
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
if (method === "GET" && url === "/royale/summary") {
|
|
409
|
-
// summary() never throws; null = unlinked or unreachable.
|
|
410
|
-
void royale.summary().then((summary) => daemonJson(res, 200, summary));
|
|
398
|
+
// GG World online save (one device link, app-wide so no session header). Always 200 with the World
|
|
399
|
+
// server's { status, body } so the app can tell 409/400/unreachable apart.
|
|
400
|
+
if (url === "/world/live" && method === "POST") {
|
|
401
|
+
void daemonReadBody(req, res).then(async (raw) => {
|
|
402
|
+
if (raw === null)
|
|
403
|
+
return;
|
|
404
|
+
daemonJson(res, 200, await world.worldLive());
|
|
405
|
+
});
|
|
411
406
|
return;
|
|
412
407
|
}
|
|
413
|
-
if (
|
|
408
|
+
if (url === "/world/save" && (method === "GET" || method === "PUT" || method === "DELETE")) {
|
|
414
409
|
void daemonReadBody(req, res).then(async (raw) => {
|
|
415
410
|
if (raw === null)
|
|
416
411
|
return;
|
|
417
|
-
|
|
418
|
-
daemonJson(res, 200, await
|
|
412
|
+
if (method === "GET") {
|
|
413
|
+
daemonJson(res, 200, await world.worldGet());
|
|
419
414
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
415
|
+
else if (method === "DELETE") {
|
|
416
|
+
daemonJson(res, 200, await world.worldDelete());
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
let parsed;
|
|
420
|
+
try {
|
|
421
|
+
parsed = JSON.parse(raw || "{}");
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
daemonJson(res, 400, { error: "invalid JSON" });
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
const ver = typeof parsed.ver === "number" ? parsed.ver : 0;
|
|
428
|
+
daemonJson(res, 200, await world.worldPut(ver, parsed.patch ?? {}));
|
|
425
429
|
}
|
|
426
430
|
});
|
|
427
431
|
return;
|
|
428
432
|
}
|
|
429
|
-
if (method === "
|
|
433
|
+
if (method === "DELETE" && url === "/world/account") {
|
|
430
434
|
void daemonReadBody(req, res).then(async (raw) => {
|
|
431
435
|
if (raw === null)
|
|
432
436
|
return;
|
|
433
|
-
|
|
434
|
-
await royale.unlink();
|
|
435
|
-
daemonJson(res, 200, { ok: true });
|
|
436
|
-
}
|
|
437
|
-
catch (err) {
|
|
438
|
-
daemonJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
439
|
-
}
|
|
437
|
+
daemonJson(res, 200, await world.accountDelete());
|
|
440
438
|
});
|
|
441
439
|
return;
|
|
442
440
|
}
|
|
@@ -1630,14 +1628,8 @@ async function createSession(deps, opts) {
|
|
|
1630
1628
|
// A hash, so the trophies file never holds project paths.
|
|
1631
1629
|
project: createHash("sha256").update(path.resolve(cwd)).digest("hex").slice(0, 16),
|
|
1632
1630
|
};
|
|
1633
|
-
const runMessages = session.getMessages().slice(messagesBeforeRun);
|
|
1634
1631
|
void progress
|
|
1635
|
-
.awardRun(cwd, runStartedAt, opts.id
|
|
1636
|
-
// GG Royale: a goal's working run, and a successful deploy.
|
|
1637
|
-
goalId: goal?.record.id ?? null,
|
|
1638
|
-
workers: runFacts.tools.some((t) => t.name === "spawn_agent"),
|
|
1639
|
-
deployed: detectDeploy(runMessages),
|
|
1640
|
-
})
|
|
1632
|
+
.awardRun(cwd, runStartedAt, opts.id)
|
|
1641
1633
|
.then(() => trophies.recordRun(runFacts, opts.id));
|
|
1642
1634
|
}
|
|
1643
1635
|
// A run may have switched branches, changed files, or spawned/finished
|