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.
Files changed (81) hide show
  1. package/README.md +53 -1
  2. package/README.zh-CN.md +53 -1
  3. package/dist/agent/loop.d.ts +1 -0
  4. package/dist/{app-4CUS3GEJ.js → app-TVY2HM5L.js} +891 -604
  5. package/dist/apply-WOW3QU5I.js +51 -0
  6. package/dist/broker-cli-X5H46FZV.js +15 -0
  7. package/dist/check-CSKTV4O2.js +16 -0
  8. package/dist/chunk-3563SW4X.js +10513 -0
  9. package/dist/chunk-36IDJRLQ.js +630 -0
  10. package/dist/chunk-3UX2CGDW.js +1955 -0
  11. package/dist/chunk-4TMLXZVZ.js +75 -0
  12. package/dist/{chunk-7YFHRORG.js → chunk-5BDKRA6U.js} +412 -172
  13. package/dist/chunk-6F66UXBI.js +48 -0
  14. package/dist/{chunk-KMBDK4SN.js → chunk-6URQ7FIF.js} +24 -88
  15. package/dist/chunk-7Y64WNBB.js +8930 -0
  16. package/dist/chunk-AA4QNKTF.js +501 -0
  17. package/dist/chunk-BDX777JR.js +11 -0
  18. package/dist/chunk-CVP5OUHD.js +103 -0
  19. package/dist/chunk-EWD7FWTH.js +14547 -0
  20. package/dist/{chunk-N5MXHJKD.js → chunk-GTFP2R5I.js} +1 -1
  21. package/dist/{chunk-W2TIY6JY.js → chunk-IKGT4MDT.js} +2028 -516
  22. package/dist/chunk-IQEEFDEE.js +389 -0
  23. package/dist/chunk-IU3UBETC.js +30 -0
  24. package/dist/chunk-JQM2L2YM.js +1003 -0
  25. package/dist/chunk-KRWWCVXA.js +74 -0
  26. package/dist/chunk-OKHV7CTB.js +482 -0
  27. package/dist/chunk-ONRY3C2L.js +196 -0
  28. package/dist/chunk-PULWAH6E.js +474 -0
  29. package/dist/chunk-PZ5NKRVA.js +85 -0
  30. package/dist/chunk-QACFKPZP.js +43704 -0
  31. package/dist/chunk-RBAZLFKB.js +1022 -0
  32. package/dist/chunk-RV3EXUXM.js +30 -0
  33. package/dist/chunk-TIEOVQW6.js +61 -0
  34. package/dist/chunk-WLZUAVVU.js +15 -0
  35. package/dist/chunk-X442CJJH.js +114 -0
  36. package/dist/chunk-X6U6BO5D.js +2130 -0
  37. package/dist/{chunk-RAYH6K2H.js → chunk-Y7EH4NVO.js} +1 -1
  38. package/dist/{chunk-S32JRDZK.js → chunk-ZKKVSR37.js} +6 -1
  39. package/dist/{claude-ink-VQU3C5UL.js → claude-ink-F554I3GJ.js} +9 -4
  40. package/dist/cli-MAWCV2YR.js +163 -0
  41. package/dist/cli-main.js +3805 -473
  42. package/dist/cli.js +50 -4
  43. package/dist/config/load.d.ts +8 -0
  44. package/dist/config/protected-file.d.ts +2 -0
  45. package/dist/config/schema.d.ts +14 -0
  46. package/dist/context/global-instructions.d.ts +12 -0
  47. package/dist/context/manager.d.ts +4 -0
  48. package/dist/desktop/main.js +4943 -1562
  49. package/dist/desktop/preload.cjs +30 -0
  50. package/dist/desktop-renderer/assets/index-BWklSoOO.css +1 -0
  51. package/dist/desktop-renderer/assets/index-CjC0Ibiq.js +153 -0
  52. package/dist/desktop-renderer/assets/{interactive-terminal-ouQQ3brz.js → interactive-terminal-IjIT3Xoa.js} +1 -1
  53. package/dist/desktop-renderer/index.html +2 -2
  54. package/dist/doctor-SEL32R7M.js +20 -0
  55. package/dist/harness/local.d.ts +1 -0
  56. package/dist/load-RHWXNUCS.js +25 -0
  57. package/dist/log-ATFIPRNU.js +19 -0
  58. package/dist/manager-IYBNNKUP.js +191 -0
  59. package/dist/models/anthropic.d.ts +3 -0
  60. package/dist/node-LOIXT44J.js +879 -0
  61. package/dist/plugin-worker-entry.js +1 -1
  62. package/dist/production-TQROFEPV.js +46 -0
  63. package/dist/production.d.ts +28 -1
  64. package/dist/project-3QXE22TG.js +11 -0
  65. package/dist/react-M6JGXSJZ.js +7 -0
  66. package/dist/recorder-FAGJJH3N.js +11 -0
  67. package/dist/sdk/index.js +30 -8
  68. package/dist/server-2KLKPHPL.js +11 -0
  69. package/dist/session/store.d.ts +1 -0
  70. package/dist/store-MZZERW7K.js +18 -0
  71. package/dist/ui/commands.d.ts +11 -3
  72. package/dist/ui/session.d.ts +2 -1
  73. package/dist/usage-summary-G5FBOJLK.js +13 -0
  74. package/dist/write-stream-CGD57URC.js +77 -0
  75. package/package.json +1 -1
  76. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +649 -1
  77. package/dist/chunk-B23V72YR.js +0 -170
  78. package/dist/chunk-QKND3FX7.js +0 -26103
  79. package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +0 -1
  80. package/dist/desktop-renderer/assets/index-CPXrzFgv.js +0 -154
  81. package/dist/load-UPOG3XQR.js +0 -19
package/dist/cli.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
3
  import {
4
4
  MEMORY_RESTART_EXIT_CODE,
5
5
  memoryRestartArgs,
6
6
  memoryRestartMarkerPath,
7
7
  parseMemoryRestartMarker
8
- } from "./chunk-N5MXHJKD.js";
9
- import "./chunk-S32JRDZK.js";
8
+ } from "./chunk-GTFP2R5I.js";
9
+ import "./chunk-ZKKVSR37.js";
10
10
 
11
11
  // src/launcher.ts
12
12
  import { spawn } from "child_process";
@@ -20,6 +20,50 @@ function needsRelaunch(runtime) {
20
20
  if (!runtime.execArgv.some((argument) => argument === "--heap-prof")) return true;
21
21
  return !runtime.execArgv.some((argument) => argument === "--expose-gc");
22
22
  }
23
+ var LIGHT_CLI_COMMANDS = /* @__PURE__ */ new Set([
24
+ "init",
25
+ "update",
26
+ "doctor",
27
+ "skills",
28
+ "memory",
29
+ "mcp",
30
+ "sessions",
31
+ "config",
32
+ "usage",
33
+ "eval",
34
+ "help",
35
+ "completion"
36
+ ]);
37
+ function isLightCommand(argv) {
38
+ for (const argument of argv) {
39
+ if (argument === "--") break;
40
+ if (argument.startsWith("-") && argument !== "-") {
41
+ if (argument === "--pals-broker" || argument.startsWith("--pals-broker=")) return false;
42
+ if (/^-(?:[vh]|.*version\b|.*help\b)/u.test(argument)) return true;
43
+ continue;
44
+ }
45
+ return LIGHT_CLI_COMMANDS.has(argument);
46
+ }
47
+ return false;
48
+ }
49
+ var OUTPUT_FORMAT_VALUES = /* @__PURE__ */ new Set(["text", "json", "stream-json"]);
50
+ var PERMISSION_MODE_VALUES = /* @__PURE__ */ new Set(["default", "plan", "acceptEdits", "bypassPermissions"]);
51
+ function isStaticUsageError(argv) {
52
+ for (let index = 0; index < argv.length; index += 1) {
53
+ const argument = argv[index];
54
+ const value = (flag, allowed) => {
55
+ if (argument === flag) {
56
+ const next = argv[index + 1];
57
+ return next !== void 0 && !next.startsWith("-") && !allowed.has(next);
58
+ }
59
+ if (argument?.startsWith(`${flag}=`)) return !allowed.has(argument.slice(flag.length + 1));
60
+ return void 0;
61
+ };
62
+ if (value("--output-format", OUTPUT_FORMAT_VALUES) === true) return true;
63
+ if (value("--permission-mode", PERMISSION_MODE_VALUES) === true) return true;
64
+ }
65
+ return false;
66
+ }
23
67
  var HEAP_HEADROOM_MB = 8192;
24
68
  var HEAP_HEADROOM_MIN_TOTALMEM = 12 * 1024 * 1024 * 1024;
25
69
  function cliMainArguments(mainPath, argv, heapProfile) {
@@ -66,7 +110,7 @@ async function launchCli() {
66
110
  const runtime = {
67
111
  execArgv: process.execArgv
68
112
  };
69
- if (!needsRelaunch(runtime)) {
113
+ if (isLightCommand(process.argv.slice(2)) || isStaticUsageError(process.argv.slice(2)) || !needsRelaunch(runtime)) {
70
114
  const cli = await import(mainUrl.href);
71
115
  await cli.runCli(process.argv);
72
116
  return;
@@ -141,6 +185,8 @@ if (process.argv[1]) {
141
185
  }
142
186
  export {
143
187
  cliMainArguments,
188
+ isLightCommand,
189
+ isStaticUsageError,
144
190
  launchCli,
145
191
  needsRelaunch
146
192
  };
@@ -17,5 +17,13 @@ export declare function setProjectMcpServerDisabled(cwd: string, serverName: str
17
17
  export declare function setProjectSkillDisabled(cwd: string, skillName: string, disabled: boolean, inheritedDisabled?: readonly string[]): Promise<string>;
18
18
  export declare function setGlobalProviderConfig(home: string, providerName: string, provider: ProviderConfig): Promise<string>;
19
19
  export declare function setProjectProviderConfig(cwd: string, providerName: string, provider: ProviderConfig): Promise<string>;
20
+ /**
21
+ * Write one value into the project `.flavor/flavor.json`. The merged result is
22
+ * validated through `loadConfig` before any write, so an invalid value aborts
23
+ * the update and leaves the file untouched (backups included).
24
+ */
25
+ export declare function setProjectConfigValue(cwd: string, home: string, key: string, value: unknown): Promise<string>;
26
+ /** Remove one key from the project `.flavor/flavor.json`, falling back to global/default layers. */
27
+ export declare function unsetProjectConfigValue(cwd: string, key: string): Promise<string>;
20
28
  export declare function redactConfig(config: unknown): unknown;
21
29
  export {};
@@ -19,3 +19,5 @@ export interface ProtectedFileOperations {
19
19
  }
20
20
  export declare function readRecoverableFile<T>(path: string, decode: (raw: string) => T | Promise<T>): Promise<RecoverableFile<T> | undefined>;
21
21
  export declare function updateProtectedFile<T>(options: ProtectedFileUpdate<T>): Promise<T>;
22
+ /** Lock and atomically update user-authored text without backup recovery or rewriting unchanged content. */
23
+ export declare function updatePlainTextFile(path: string, update: (current: string | undefined) => string | undefined | Promise<string | undefined>, maxBytes?: number): Promise<string | undefined>;
@@ -20,6 +20,10 @@ export declare const ProviderConfigSchema: z.ZodObject<{
20
20
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
21
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
22
22
  thinkingBudget: z.ZodOptional<z.ZodNumber>;
23
+ cacheTtl: z.ZodOptional<z.ZodEnum<{
24
+ "1h": "1h";
25
+ "5m": "5m";
26
+ }>>;
23
27
  thinkingEffort: z.ZodOptional<z.ZodEnum<{
24
28
  high: "high";
25
29
  low: "low";
@@ -78,6 +82,10 @@ export declare const FlavorConfigSchema: z.ZodObject<{
78
82
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
83
  maxOutputTokens: z.ZodOptional<z.ZodNumber>;
80
84
  thinkingBudget: z.ZodOptional<z.ZodNumber>;
85
+ cacheTtl: z.ZodOptional<z.ZodEnum<{
86
+ "1h": "1h";
87
+ "5m": "5m";
88
+ }>>;
81
89
  thinkingEffort: z.ZodOptional<z.ZodEnum<{
82
90
  high: "high";
83
91
  low: "low";
@@ -112,6 +120,9 @@ export declare const FlavorConfigSchema: z.ZodObject<{
112
120
  skills: z.ZodPrefault<z.ZodObject<{
113
121
  disabled: z.ZodDefault<z.ZodArray<z.ZodString>>;
114
122
  }, z.core.$strip>>;
123
+ globalInstructions: z.ZodPrefault<z.ZodObject<{
124
+ enabled: z.ZodDefault<z.ZodBoolean>;
125
+ }, z.core.$strip>>;
115
126
  agents: z.ZodOptional<z.ZodObject<{
116
127
  main: z.ZodOptional<z.ZodObject<{
117
128
  model: z.ZodString;
@@ -204,3 +215,6 @@ export type McpServerConfig = z.infer<typeof McpServerConfigSchema>;
204
215
  export type McpServerConfigInput = z.input<typeof McpServerConfigSchema>;
205
216
  export type McpStdioServerConfig = z.infer<typeof McpStdioServerConfigSchema>;
206
217
  export type McpHttpServerConfig = z.infer<typeof McpHttpServerConfigSchema>;
218
+ /** Top-level configuration keys, used to reject typos in `flavor config set/get`. */
219
+ export declare const CONFIG_TOP_LEVEL_KEYS: string[];
220
+ export declare function configPathSegments(key: string): string[];
@@ -0,0 +1,12 @@
1
+ /** User-maintained rules; only explicit /global commands write this file. */
2
+ export declare class GlobalInstructions {
3
+ #private;
4
+ static readonly MAX_BYTES: number;
5
+ static readonly MAX_RULE_BYTES: number;
6
+ readonly path: string;
7
+ constructor(home: string);
8
+ get content(): string | undefined;
9
+ refresh(): Promise<void>;
10
+ remember(input: string): Promise<"added" | "already-present">;
11
+ forget(input: string): Promise<"removed" | "not-found" | "ambiguous">;
12
+ }
@@ -12,6 +12,8 @@ export interface ContextManagerOptions {
12
12
  taskState?: string;
13
13
  /** Stable user preferences, emitted as the final system section for prompt caching. */
14
14
  userMemory?: SystemPromptSource;
15
+ /** User-authored global rules, placed after the stable cache breakpoint. */
16
+ globalInstructions?: SystemPromptSource;
15
17
  /** @deprecated Prefer token-based compaction policy. */
16
18
  compactAtChars?: number;
17
19
  toolOutputChars: number;
@@ -51,6 +53,8 @@ export interface ContextEpochSnapshot {
51
53
  stableMessages: ContextSystemMessage[];
52
54
  /** Last admitted values for dynamic sources. */
53
55
  sources: Record<string, string>;
56
+ /** Immutable dynamic-source snapshot rendered before conversation history. */
57
+ pinnedSources?: Record<string, string> | undefined;
54
58
  stableSourceHash: string;
55
59
  }
56
60
  export interface ContextSystemMessage {