flavor-code 1.4.2 → 1.4.3
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 +53 -1
- package/README.zh-CN.md +53 -1
- package/dist/agent/loop.d.ts +1 -0
- package/dist/{app-4CUS3GEJ.js → app-TVY2HM5L.js} +891 -604
- package/dist/apply-WOW3QU5I.js +51 -0
- package/dist/broker-cli-X5H46FZV.js +15 -0
- package/dist/check-CSKTV4O2.js +16 -0
- package/dist/chunk-3563SW4X.js +10513 -0
- package/dist/chunk-36IDJRLQ.js +630 -0
- package/dist/chunk-3UX2CGDW.js +1955 -0
- package/dist/chunk-4TMLXZVZ.js +75 -0
- package/dist/{chunk-7YFHRORG.js → chunk-5BDKRA6U.js} +412 -172
- package/dist/chunk-6F66UXBI.js +48 -0
- package/dist/{chunk-KMBDK4SN.js → chunk-6URQ7FIF.js} +24 -88
- package/dist/chunk-7Y64WNBB.js +8930 -0
- package/dist/chunk-AA4QNKTF.js +501 -0
- package/dist/chunk-BDX777JR.js +11 -0
- package/dist/chunk-CVP5OUHD.js +103 -0
- package/dist/chunk-EWD7FWTH.js +14547 -0
- package/dist/{chunk-N5MXHJKD.js → chunk-GTFP2R5I.js} +1 -1
- package/dist/{chunk-W2TIY6JY.js → chunk-IKGT4MDT.js} +2028 -516
- package/dist/chunk-IQEEFDEE.js +389 -0
- package/dist/chunk-IU3UBETC.js +30 -0
- package/dist/chunk-JQM2L2YM.js +1003 -0
- package/dist/chunk-KRWWCVXA.js +74 -0
- package/dist/chunk-OKHV7CTB.js +482 -0
- package/dist/chunk-ONRY3C2L.js +196 -0
- package/dist/chunk-PULWAH6E.js +474 -0
- package/dist/chunk-PZ5NKRVA.js +85 -0
- package/dist/chunk-QACFKPZP.js +43704 -0
- package/dist/chunk-RBAZLFKB.js +1022 -0
- package/dist/chunk-RV3EXUXM.js +30 -0
- package/dist/chunk-TIEOVQW6.js +61 -0
- package/dist/chunk-WLZUAVVU.js +15 -0
- package/dist/chunk-X442CJJH.js +114 -0
- package/dist/chunk-X6U6BO5D.js +2130 -0
- package/dist/{chunk-RAYH6K2H.js → chunk-Y7EH4NVO.js} +1 -1
- package/dist/{chunk-S32JRDZK.js → chunk-ZKKVSR37.js} +6 -1
- package/dist/{claude-ink-VQU3C5UL.js → claude-ink-F554I3GJ.js} +9 -4
- package/dist/cli-MAWCV2YR.js +163 -0
- package/dist/cli-main.js +3805 -473
- package/dist/cli.js +50 -4
- package/dist/config/load.d.ts +8 -0
- package/dist/config/protected-file.d.ts +2 -0
- package/dist/config/schema.d.ts +14 -0
- package/dist/context/global-instructions.d.ts +12 -0
- package/dist/context/manager.d.ts +4 -0
- package/dist/desktop/main.js +4943 -1562
- package/dist/desktop/preload.cjs +30 -0
- package/dist/desktop-renderer/assets/index-BWklSoOO.css +1 -0
- package/dist/desktop-renderer/assets/index-CjC0Ibiq.js +153 -0
- package/dist/desktop-renderer/assets/{interactive-terminal-ouQQ3brz.js → interactive-terminal-IjIT3Xoa.js} +1 -1
- package/dist/desktop-renderer/index.html +2 -2
- package/dist/doctor-SEL32R7M.js +20 -0
- package/dist/harness/local.d.ts +1 -0
- package/dist/load-RHWXNUCS.js +25 -0
- package/dist/log-ATFIPRNU.js +19 -0
- package/dist/manager-IYBNNKUP.js +191 -0
- package/dist/models/anthropic.d.ts +3 -0
- package/dist/node-LOIXT44J.js +879 -0
- package/dist/plugin-worker-entry.js +1 -1
- package/dist/production-TQROFEPV.js +46 -0
- package/dist/production.d.ts +28 -1
- package/dist/project-3QXE22TG.js +11 -0
- package/dist/react-M6JGXSJZ.js +7 -0
- package/dist/recorder-FAGJJH3N.js +11 -0
- package/dist/sdk/index.js +30 -8
- package/dist/server-2KLKPHPL.js +11 -0
- package/dist/session/store.d.ts +1 -0
- package/dist/store-MZZERW7K.js +18 -0
- package/dist/ui/commands.d.ts +11 -3
- package/dist/ui/session.d.ts +2 -1
- package/dist/usage-summary-G5FBOJLK.js +13 -0
- package/dist/write-stream-CGD57URC.js +77 -0
- package/package.json +1 -1
- package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +649 -1
- package/dist/chunk-B23V72YR.js +0 -170
- package/dist/chunk-QKND3FX7.js +0 -26103
- package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +0 -1
- package/dist/desktop-renderer/assets/index-CPXrzFgv.js +0 -154
- package/dist/load-UPOG3XQR.js +0 -19
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
gt,
|
|
5
|
+
isValidVersion
|
|
6
|
+
} from "./chunk-3UX2CGDW.js";
|
|
7
|
+
|
|
8
|
+
// src/update/check.ts
|
|
9
|
+
var NPM_PACKAGE_NAME = "flavor-code";
|
|
10
|
+
var REGISTRY_LATEST_URL = `https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`;
|
|
11
|
+
var DEFAULT_TIMEOUT_MS = 3e3;
|
|
12
|
+
function findNewerVersion(current, latest) {
|
|
13
|
+
if (!isValidVersion(current) || !isValidVersion(latest)) return void 0;
|
|
14
|
+
return gt(latest, current) ? latest : void 0;
|
|
15
|
+
}
|
|
16
|
+
async function fetchLatestVersion(options = {}) {
|
|
17
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
18
|
+
const fetchImpl = options.fetchImpl ?? ((url, init) => fetch(url, init));
|
|
19
|
+
let timer;
|
|
20
|
+
const timeout = new Promise((resolve) => {
|
|
21
|
+
timer = setTimeout(() => resolve(void 0), timeoutMs);
|
|
22
|
+
timer.unref?.();
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
const response = await Promise.race([
|
|
26
|
+
fetchImpl(REGISTRY_LATEST_URL, { signal: AbortSignal.timeout(timeoutMs) }),
|
|
27
|
+
timeout
|
|
28
|
+
]);
|
|
29
|
+
if (response === void 0 || !response.ok) return void 0;
|
|
30
|
+
const body = await Promise.race([response.json(), timeout]);
|
|
31
|
+
return typeof body?.version === "string" ? body.version : void 0;
|
|
32
|
+
} catch {
|
|
33
|
+
return void 0;
|
|
34
|
+
} finally {
|
|
35
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function checkForUpdate(current, options = {}) {
|
|
39
|
+
const latest = await fetchLatestVersion(options);
|
|
40
|
+
return latest === void 0 ? void 0 : findNewerVersion(current, latest);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
NPM_PACKAGE_NAME,
|
|
45
|
+
findNewerVersion,
|
|
46
|
+
fetchLatestVersion,
|
|
47
|
+
checkForUpdate
|
|
48
|
+
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from "node:module"; const require =
|
|
2
|
+
import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
|
-
message
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
message
|
|
5
|
+
} from "./chunk-BDX777JR.js";
|
|
6
|
+
import {
|
|
7
|
+
external_exports
|
|
8
|
+
} from "./chunk-EWD7FWTH.js";
|
|
8
9
|
|
|
9
10
|
// src/rpc/server.ts
|
|
10
11
|
import { createInterface } from "readline";
|
|
11
12
|
|
|
12
13
|
// src/rpc/schema.ts
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
z.object({ ...base, type: z.literal("shutdown") }).strict()
|
|
14
|
+
var base = { id: external_exports.string().min(1).max(128).optional() };
|
|
15
|
+
var RpcCommandSchema = external_exports.discriminatedUnion("type", [
|
|
16
|
+
external_exports.object({ ...base, type: external_exports.literal("prompt"), message: external_exports.string().trim().min(1).max(1e6) }).strict(),
|
|
17
|
+
external_exports.object({ ...base, type: external_exports.literal("steer"), message: external_exports.string().trim().min(1).max(1e6) }).strict(),
|
|
18
|
+
external_exports.object({ ...base, type: external_exports.literal("follow_up"), message: external_exports.string().trim().min(1).max(1e6) }).strict(),
|
|
19
|
+
external_exports.object({ ...base, type: external_exports.literal("abort") }).strict(),
|
|
20
|
+
external_exports.object({ ...base, type: external_exports.literal("get_state") }).strict(),
|
|
21
|
+
external_exports.object({ ...base, type: external_exports.literal("get_queue") }).strict(),
|
|
22
|
+
external_exports.object({ ...base, type: external_exports.literal("clear_queue") }).strict(),
|
|
23
|
+
external_exports.object({ ...base, type: external_exports.literal("approval_decision"), approvalId: external_exports.string().min(1).max(128), decision: external_exports.enum(["once", "always", "deny"]) }).strict(),
|
|
24
|
+
external_exports.object({ ...base, type: external_exports.literal("write_commit"), writeId: external_exports.string().uuid() }).strict(),
|
|
25
|
+
external_exports.object({ ...base, type: external_exports.literal("checkpoint"), label: external_exports.string().trim().min(1).max(256).optional() }).strict(),
|
|
26
|
+
external_exports.object({ ...base, type: external_exports.literal("get_tree") }).strict(),
|
|
27
|
+
external_exports.object({ ...base, type: external_exports.literal("rewind"), nodeId: external_exports.string().min(1).max(256) }).strict(),
|
|
28
|
+
external_exports.object({ ...base, type: external_exports.literal("unrevert") }).strict(),
|
|
29
|
+
external_exports.object({ ...base, type: external_exports.literal("fork"), nodeId: external_exports.string().min(1).max(256) }).strict(),
|
|
30
|
+
external_exports.object({ ...base, type: external_exports.literal("shutdown") }).strict()
|
|
31
31
|
]);
|
|
32
32
|
|
|
33
33
|
// src/rpc/server.ts
|
|
@@ -182,70 +182,6 @@ function required(service, name) {
|
|
|
182
182
|
return service;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
// src/trace/recorder.ts
|
|
186
|
-
import { mkdir, open } from "fs/promises";
|
|
187
|
-
import { dirname, resolve } from "path";
|
|
188
|
-
|
|
189
|
-
// src/trace/schema.ts
|
|
190
|
-
import { z as z2 } from "zod";
|
|
191
|
-
var TraceKindSchema = z2.enum(["command", "response", "output", "queue", "history", "verification"]);
|
|
192
|
-
var TraceRecordSchema = z2.object({
|
|
193
|
-
version: z2.literal(1),
|
|
194
|
-
sequence: z2.number().int().positive(),
|
|
195
|
-
timestamp: z2.string().datetime(),
|
|
196
|
-
sessionId: z2.string().min(1),
|
|
197
|
-
kind: TraceKindSchema,
|
|
198
|
-
payload: z2.unknown()
|
|
199
|
-
}).strict();
|
|
200
|
-
|
|
201
|
-
// src/trace/recorder.ts
|
|
202
|
-
var TraceRecorder = class {
|
|
203
|
-
path;
|
|
204
|
-
#sessionId;
|
|
205
|
-
#secrets;
|
|
206
|
-
#now;
|
|
207
|
-
#sequence = 0;
|
|
208
|
-
#handle;
|
|
209
|
-
#tail = Promise.resolve();
|
|
210
|
-
constructor(options) {
|
|
211
|
-
this.path = resolve(options.path);
|
|
212
|
-
this.#sessionId = options.sessionId;
|
|
213
|
-
this.#secrets = options.secrets ?? [];
|
|
214
|
-
this.#now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
215
|
-
}
|
|
216
|
-
record(kind, payload) {
|
|
217
|
-
const sequence = ++this.#sequence;
|
|
218
|
-
this.#tail = this.#tail.then(async () => {
|
|
219
|
-
const handle = await this.#file();
|
|
220
|
-
const serialized = redactErrorText(redactSecrets(JSON.stringify(payload) ?? "null", this.#secrets));
|
|
221
|
-
const record = TraceRecordSchema.parse({
|
|
222
|
-
version: 1,
|
|
223
|
-
sequence,
|
|
224
|
-
timestamp: this.#now().toISOString(),
|
|
225
|
-
sessionId: this.#sessionId,
|
|
226
|
-
kind,
|
|
227
|
-
payload: JSON.parse(serialized)
|
|
228
|
-
});
|
|
229
|
-
await handle.appendFile(`${JSON.stringify(record)}
|
|
230
|
-
`, "utf8");
|
|
231
|
-
});
|
|
232
|
-
return this.#tail;
|
|
233
|
-
}
|
|
234
|
-
async close() {
|
|
235
|
-
await this.#tail;
|
|
236
|
-
await this.#handle?.close();
|
|
237
|
-
this.#handle = void 0;
|
|
238
|
-
}
|
|
239
|
-
async #file() {
|
|
240
|
-
if (this.#handle !== void 0) return this.#handle;
|
|
241
|
-
await mkdir(dirname(this.path), { recursive: true });
|
|
242
|
-
this.#handle = await open(this.path, "a", 384);
|
|
243
|
-
return this.#handle;
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
185
|
export {
|
|
248
|
-
FlavorRpcServer
|
|
249
|
-
TraceRecordSchema,
|
|
250
|
-
TraceRecorder
|
|
186
|
+
FlavorRpcServer
|
|
251
187
|
};
|