flavor-code 1.2.7 → 1.2.9

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 (41) hide show
  1. package/README.md +405 -369
  2. package/README.zh-CN.md +387 -356
  3. package/dist/agent/loop.d.ts +4 -0
  4. package/dist/agent/types.d.ts +10 -0
  5. package/dist/{app-R3SDG2OH.js → app-USAFQVSX.js} +379 -12
  6. package/dist/{chunk-NVLYFU6P.js → chunk-F2HMO5Q2.js} +28 -11
  7. package/dist/{chunk-WN2EZV3Y.js → chunk-G32MCAZA.js} +1 -1
  8. package/dist/{chunk-N2S7USST.js → chunk-RQTYHUMK.js} +2 -1
  9. package/dist/{chunk-5RHJ3PQN.js → chunk-WGYNTR4Q.js} +1834 -495
  10. package/dist/{chunk-HFR2WS6T.js → chunk-XFCJXRJ2.js} +18 -5
  11. package/dist/{claude-ink-WPWPEL5A.js → claude-ink-ORUA7GWG.js} +2 -2
  12. package/dist/cli.js +9 -8
  13. package/dist/config/protected-file.d.ts +6 -0
  14. package/dist/config/schema.d.ts +2 -0
  15. package/dist/context/manager.d.ts +2 -0
  16. package/dist/context/workspace-instructions.d.ts +10 -0
  17. package/dist/desktop/main.js +12736 -5178
  18. package/dist/desktop/pixel-worker.js +73 -0
  19. package/dist/desktop/preload.cjs +80 -2
  20. package/dist/desktop-renderer/assets/index-D-s27J39.js +151 -0
  21. package/dist/desktop-renderer/assets/index-DMZBSGrp.css +1 -0
  22. package/dist/desktop-renderer/index.html +3 -4
  23. package/dist/harness/local.d.ts +4 -1
  24. package/dist/jobs/registry.d.ts +48 -0
  25. package/dist/{load-XC5JYYBQ.js → load-6ZMEBHSG.js} +1 -1
  26. package/dist/models/anthropic.d.ts +4 -0
  27. package/dist/permissions/engine.d.ts +7 -0
  28. package/dist/production.d.ts +13 -1
  29. package/dist/sdk/index.js +4 -4
  30. package/dist/terminal/service.d.ts +57 -0
  31. package/dist/tools/files.d.ts +10 -0
  32. package/dist/tools/jobs.d.ts +4 -0
  33. package/dist/tools/runtime.d.ts +2 -0
  34. package/dist/tools/shell.d.ts +13 -3
  35. package/dist/tools/terminal.d.ts +3 -0
  36. package/dist/tools/types.d.ts +76 -4
  37. package/dist/tools/web.d.ts +53 -0
  38. package/package.json +13 -2
  39. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +752 -1
  40. package/dist/desktop-renderer/assets/index-CLrVaR9H.js +0 -143
  41. package/dist/desktop-renderer/assets/index-Cm_ktmXm.css +0 -1
@@ -33,6 +33,9 @@ var ProviderConfigSchema = z.object({
33
33
  cheapModel: z.string().min(1).optional(),
34
34
  models: z.array(z.string().min(1)).max(100).optional(),
35
35
  maxOutputTokens: z.number().int().positive().optional(),
36
+ // Send the Claude Code client fingerprint (User-Agent/x-app) with Anthropic requests,
37
+ // for gateways that restrict the Anthropic protocol to Claude clients.
38
+ claudeClient: z.boolean().optional(),
36
39
  // OAuth PKCE fields
37
40
  apiType: z.enum(["openai", "anthropic"]).optional(),
38
41
  authorizationUrl: z.string().url().optional(),
@@ -149,11 +152,12 @@ var FlavorConfigSchema = z.object({
149
152
 
150
153
  // src/config/protected-file.ts
151
154
  import { randomUUID } from "crypto";
152
- import { mkdir, open, readFile, rename, rm, stat } from "fs/promises";
155
+ import { copyFile, mkdir, open, readFile, rename, rm, stat, unlink } from "fs/promises";
153
156
  import { dirname } from "path";
154
157
  var LOCK_WAIT_MS = 20;
155
158
  var LOCK_TIMEOUT_MS = 2e3;
156
159
  var STALE_LOCK_MS = 3e4;
160
+ var defaultFileOperations = { rename, copyFile, unlink };
157
161
  async function readRecoverableFile(path, decode) {
158
162
  let primaryError;
159
163
  try {
@@ -180,9 +184,9 @@ async function updateProtectedFile(options) {
180
184
  const next = await options.update(current?.value);
181
185
  if (current !== void 0) {
182
186
  const backup = options.backupEncode === void 0 ? await options.encode(current.value) : await options.backupEncode(current.value);
183
- await writeAtomic(`${options.path}.bak`, backup);
187
+ await writeAtomic(`${options.path}.bak`, backup, options.fileOperations ?? defaultFileOperations);
184
188
  }
185
- await writeAtomic(options.path, await options.encode(next));
189
+ await writeAtomic(options.path, await options.encode(next), options.fileOperations ?? defaultFileOperations);
186
190
  return next;
187
191
  }, options.lockTimeoutMs ?? LOCK_TIMEOUT_MS, options.staleLockMs ?? STALE_LOCK_MS);
188
192
  }
@@ -256,7 +260,7 @@ function isProcessAlive(pid) {
256
260
  return isCode(error, "EPERM");
257
261
  }
258
262
  }
259
- async function writeAtomic(path, content) {
263
+ async function writeAtomic(path, content, operations) {
260
264
  const temporary = `${path}.${process.pid}.${randomUUID()}.tmp`;
261
265
  let handle;
262
266
  try {
@@ -265,12 +269,21 @@ async function writeAtomic(path, content) {
265
269
  await handle.sync();
266
270
  await handle.close();
267
271
  handle = void 0;
268
- await rename(temporary, path);
272
+ try {
273
+ await operations.rename(temporary, path);
274
+ } catch (error) {
275
+ if (!isWindowsSharingError(error)) throw error;
276
+ await operations.copyFile(temporary, path);
277
+ await operations.unlink(temporary).catch(() => void 0);
278
+ }
269
279
  } finally {
270
280
  await handle?.close().catch(() => void 0);
271
281
  await rm(temporary, { force: true }).catch(() => void 0);
272
282
  }
273
283
  }
284
+ function isWindowsSharingError(error) {
285
+ return typeof error === "object" && error !== null && "code" in error && ["EPERM", "EACCES", "EBUSY", "EEXIST"].includes(String(error.code));
286
+ }
274
287
  function delay(ms) {
275
288
  return new Promise((resolvePromise) => setTimeout(resolvePromise, ms));
276
289
  }
@@ -10,8 +10,8 @@ import {
10
10
  useStdout,
11
11
  use_app_default,
12
12
  use_input_default
13
- } from "./chunk-NVLYFU6P.js";
14
- import "./chunk-N2S7USST.js";
13
+ } from "./chunk-F2HMO5Q2.js";
14
+ import "./chunk-RQTYHUMK.js";
15
15
  import "./chunk-S32JRDZK.js";
16
16
  export {
17
17
  AlternateScreen,
package/dist/cli.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module"; const require = createRequire(impor
3
3
  import {
4
4
  FlavorRpcServer,
5
5
  TraceRecorder
6
- } from "./chunk-WN2EZV3Y.js";
6
+ } from "./chunk-G32MCAZA.js";
7
7
  import {
8
8
  staticTaskLines
9
9
  } from "./chunk-KKIBYDJI.js";
@@ -20,7 +20,7 @@ import {
20
20
  message,
21
21
  packageVersion,
22
22
  redactErrorText
23
- } from "./chunk-5RHJ3PQN.js";
23
+ } from "./chunk-WGYNTR4Q.js";
24
24
  import {
25
25
  McpServerConfigSchema,
26
26
  McpServerNameSchema,
@@ -29,8 +29,8 @@ import {
29
29
  readRecoverableFile,
30
30
  setProjectSkillDisabled,
31
31
  updateProtectedFile
32
- } from "./chunk-HFR2WS6T.js";
33
- import "./chunk-N2S7USST.js";
32
+ } from "./chunk-XFCJXRJ2.js";
33
+ import "./chunk-RQTYHUMK.js";
34
34
  import "./chunk-S32JRDZK.js";
35
35
 
36
36
  // src/cli.tsx
@@ -601,6 +601,7 @@ var EvaluationSpecSchema = z.object({
601
601
  }).strict();
602
602
 
603
603
  // src/eval/runner.ts
604
+ var DEFAULT_VERIFICATION_TIMEOUT_MS = 10 * 6e4;
604
605
  async function runEvaluation(spec, dependencies) {
605
606
  const now = dependencies.now ?? Date.now;
606
607
  const started = now();
@@ -631,7 +632,7 @@ async function runEvaluation(spec, dependencies) {
631
632
  command: check.command,
632
633
  args: check.args,
633
634
  cwd: spec.workspace,
634
- ...check.timeoutMs === void 0 ? {} : { timeoutMs: check.timeoutMs }
635
+ timeoutMs: check.timeoutMs ?? DEFAULT_VERIFICATION_TIMEOUT_MS
635
636
  });
636
637
  verification.push({
637
638
  command: [check.command, ...check.args].join(" "),
@@ -669,7 +670,7 @@ async function runEvaluationFile(path, outputPath) {
669
670
  })),
670
671
  ...parsed.maxTokens === void 0 ? {} : { maxTokens: parsed.maxTokens }
671
672
  };
672
- const configured = await import("./load-XC5JYYBQ.js").then(({ loadConfig: loadConfig2 }) => loadConfig2({ cwd: workspace, home: process.env.USERPROFILE ?? process.env.HOME ?? workspace }));
673
+ const configured = await import("./load-6ZMEBHSG.js").then(({ loadConfig: loadConfig2 }) => loadConfig2({ cwd: workspace, home: process.env.USERPROFILE ?? process.env.HOME ?? workspace }));
673
674
  const environment = createExecutionEnvironment(workspace, configured.config.execution) ?? new LocalExecutionEnvironment();
674
675
  let report;
675
676
  try {
@@ -769,9 +770,9 @@ function createProgram() {
769
770
  }
770
771
  setInteractiveProcessTitle();
771
772
  const [{ render, AlternateScreen }, { createElement }, { App }] = await Promise.all([
772
- import("./claude-ink-WPWPEL5A.js"),
773
+ import("./claude-ink-ORUA7GWG.js"),
773
774
  import("react"),
774
- import("./app-R3SDG2OH.js")
775
+ import("./app-USAFQVSX.js")
775
776
  ]);
776
777
  const instance = await render(createElement(
777
778
  AlternateScreen,
@@ -10,6 +10,12 @@ export interface ProtectedFileUpdate<T> {
10
10
  backupEncode?(current: T): string | Promise<string>;
11
11
  lockTimeoutMs?: number;
12
12
  staleLockMs?: number;
13
+ fileOperations?: ProtectedFileOperations;
14
+ }
15
+ export interface ProtectedFileOperations {
16
+ rename(source: string, target: string): Promise<void>;
17
+ copyFile(source: string, target: string): Promise<void>;
18
+ unlink(path: string): Promise<void>;
13
19
  }
14
20
  export declare function readRecoverableFile<T>(path: string, decode: (raw: string) => T | Promise<T>): Promise<RecoverableFile<T> | undefined>;
15
21
  export declare function updateProtectedFile<T>(options: ProtectedFileUpdate<T>): Promise<T>;
@@ -19,6 +19,7 @@ export declare const ProviderConfigSchema: z.ZodObject<{
19
19
  cheapModel: z.ZodOptional<z.ZodString>;
20
20
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
21
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
22
+ claudeClient: z.ZodOptional<z.ZodBoolean>;
22
23
  apiType: z.ZodOptional<z.ZodEnum<{
23
24
  anthropic: "anthropic";
24
25
  openai: "openai";
@@ -67,6 +68,7 @@ export declare const FlavorConfigSchema: z.ZodObject<{
67
68
  cheapModel: z.ZodOptional<z.ZodString>;
68
69
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
70
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
71
+ claudeClient: z.ZodOptional<z.ZodBoolean>;
70
72
  apiType: z.ZodOptional<z.ZodEnum<{
71
73
  anthropic: "anthropic";
72
74
  openai: "openai";
@@ -6,6 +6,8 @@ export interface ContextManagerOptions {
6
6
  /** Dynamic system suffix excluded from the stable prompt-cache prefix. */
7
7
  volatileSystem?: SystemPromptSource;
8
8
  flavor?: string;
9
+ /** Root AGENTS.md/CLAUDE.md guidance, separate from FLAVOR.md attribution. */
10
+ workspaceInstructions?: string;
9
11
  memory?: string;
10
12
  taskState?: string;
11
13
  /** Stable user preferences, emitted as the final system section for prompt caching. */
@@ -0,0 +1,10 @@
1
+ export interface WorkspaceInstructionOptions {
2
+ maxFileBytes?: number;
3
+ maxTotalBytes?: number;
4
+ }
5
+ export declare class WorkspaceInstructions {
6
+ #private;
7
+ constructor(workspace: string, options?: WorkspaceInstructionOptions);
8
+ baseline(scope?: string): Promise<string>;
9
+ discover(paths: readonly string[], scope?: string): Promise<string[]>;
10
+ }