flavor-code 1.4.1 → 1.4.3-beta.2

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 (76) hide show
  1. package/README.md +32 -2
  2. package/README.zh-CN.md +32 -2
  3. package/dist/{app-4YRKE7VI.js → app-G35YBHPR.js} +873 -641
  4. package/dist/apply-WOW3QU5I.js +51 -0
  5. package/dist/broker-cli-X5H46FZV.js +15 -0
  6. package/dist/check-CSKTV4O2.js +16 -0
  7. package/dist/chunk-3563SW4X.js +10513 -0
  8. package/dist/chunk-3UX2CGDW.js +1955 -0
  9. package/dist/chunk-4TMLXZVZ.js +75 -0
  10. package/dist/chunk-6F66UXBI.js +48 -0
  11. package/dist/{chunk-FAORPP4F.js → chunk-6URQ7FIF.js} +24 -88
  12. package/dist/chunk-6X62CGMA.js +193 -0
  13. package/dist/chunk-7Y64WNBB.js +8930 -0
  14. package/dist/chunk-AA4QNKTF.js +501 -0
  15. package/dist/chunk-BDX777JR.js +11 -0
  16. package/dist/chunk-CVP5OUHD.js +103 -0
  17. package/dist/chunk-EWD7FWTH.js +14547 -0
  18. package/dist/chunk-FAJ6YDZK.js +630 -0
  19. package/dist/{chunk-N5MXHJKD.js → chunk-GTFP2R5I.js} +1 -1
  20. package/dist/{chunk-7YFHRORG.js → chunk-HGTCIHWA.js} +383 -172
  21. package/dist/chunk-IDJAHEG6.js +43501 -0
  22. package/dist/chunk-IQEEFDEE.js +389 -0
  23. package/dist/chunk-IU3UBETC.js +30 -0
  24. package/dist/chunk-K7UGGWJV.js +1003 -0
  25. package/dist/chunk-KRWWCVXA.js +74 -0
  26. package/dist/chunk-OKHV7CTB.js +482 -0
  27. package/dist/chunk-PULWAH6E.js +474 -0
  28. package/dist/chunk-PZ5NKRVA.js +85 -0
  29. package/dist/chunk-RBAZLFKB.js +1022 -0
  30. package/dist/chunk-RV3EXUXM.js +30 -0
  31. package/dist/chunk-SJUIIHIA.js +2130 -0
  32. package/dist/{chunk-VMQWXQEC.js → chunk-T6RE76D2.js} +2003 -493
  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-RAYH6K2H.js → chunk-Y7EH4NVO.js} +1 -1
  37. package/dist/{chunk-S32JRDZK.js → chunk-ZKKVSR37.js} +6 -1
  38. package/dist/{claude-ink-JZXNSAQS.js → claude-ink-BE56DB6N.js} +9 -4
  39. package/dist/cli-3MF6EL2H.js +163 -0
  40. package/dist/cli-main.js +3805 -473
  41. package/dist/cli.js +50 -4
  42. package/dist/config/load.d.ts +8 -0
  43. package/dist/config/schema.d.ts +11 -0
  44. package/dist/context/manager.d.ts +2 -0
  45. package/dist/desktop/main.js +4303 -1171
  46. package/dist/desktop/preload.cjs +30 -0
  47. package/dist/desktop-renderer/assets/index-BWklSoOO.css +1 -0
  48. package/dist/desktop-renderer/assets/index-DCqIrF1S.js +153 -0
  49. package/dist/desktop-renderer/assets/{interactive-terminal-1agnYY5L.js → interactive-terminal-B6GbpzIn.js} +1 -1
  50. package/dist/desktop-renderer/index.html +2 -2
  51. package/dist/doctor-OHCGK52S.js +20 -0
  52. package/dist/load-QK6CMLDF.js +25 -0
  53. package/dist/log-ATFIPRNU.js +19 -0
  54. package/dist/manager-5SI4MPES.js +191 -0
  55. package/dist/models/anthropic.d.ts +3 -0
  56. package/dist/node-LOIXT44J.js +879 -0
  57. package/dist/plugin-worker-entry.js +1 -1
  58. package/dist/production-6DIZ6YLQ.js +46 -0
  59. package/dist/production.d.ts +28 -1
  60. package/dist/project-3QXE22TG.js +11 -0
  61. package/dist/react-M6JGXSJZ.js +7 -0
  62. package/dist/recorder-FAGJJH3N.js +11 -0
  63. package/dist/sdk/index.js +30 -8
  64. package/dist/server-2KLKPHPL.js +11 -0
  65. package/dist/session/store.d.ts +1 -0
  66. package/dist/store-ZIHN6363.js +18 -0
  67. package/dist/ui/commands.d.ts +1 -5
  68. package/dist/usage-summary-G5FBOJLK.js +13 -0
  69. package/dist/utils/execFileNoThrow.d.ts +1 -0
  70. package/dist/write-stream-CGD57URC.js +77 -0
  71. package/package.json +1 -1
  72. package/dist/chunk-O2PC44GY.js +0 -26120
  73. package/dist/chunk-ZJCAQXA7.js +0 -169
  74. package/dist/desktop-renderer/assets/index-BM9ugkh9.js +0 -154
  75. package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +0 -1
  76. package/dist/load-UPOG3XQR.js +0 -19
@@ -1,5 +1,5 @@
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
 
4
4
  // src/plugins/plugin-worker-entry.ts
5
5
  import { readFile, realpath } from "fs/promises";
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ ApprovalBridge,
5
+ DEFAULT_SHUTDOWN_STEP_TIMEOUT_MS,
6
+ compileHeadlessToolAllowlist,
7
+ createProductionRuntime,
8
+ createPromptEnvironment,
9
+ matchesHeadlessAllowlist,
10
+ runGoalSession,
11
+ runResumeGoalSession
12
+ } from "./chunk-IDJAHEG6.js";
13
+ import "./chunk-TIEOVQW6.js";
14
+ import "./chunk-OKHV7CTB.js";
15
+ import "./chunk-K7UGGWJV.js";
16
+ import "./chunk-IU3UBETC.js";
17
+ import "./chunk-PZ5NKRVA.js";
18
+ import "./chunk-6F66UXBI.js";
19
+ import "./chunk-3UX2CGDW.js";
20
+ import "./chunk-7Y64WNBB.js";
21
+ import "./chunk-CVP5OUHD.js";
22
+ import "./chunk-3563SW4X.js";
23
+ import "./chunk-RBAZLFKB.js";
24
+ import "./chunk-FAJ6YDZK.js";
25
+ import "./chunk-WLZUAVVU.js";
26
+ import "./chunk-RV3EXUXM.js";
27
+ import "./chunk-IQEEFDEE.js";
28
+ import "./chunk-GTFP2R5I.js";
29
+ import "./chunk-HGTCIHWA.js";
30
+ import "./chunk-SJUIIHIA.js";
31
+ import "./chunk-BDX777JR.js";
32
+ import "./chunk-6X62CGMA.js";
33
+ import "./chunk-EWD7FWTH.js";
34
+ import "./chunk-KRWWCVXA.js";
35
+ import "./chunk-X442CJJH.js";
36
+ import "./chunk-ZKKVSR37.js";
37
+ export {
38
+ ApprovalBridge,
39
+ DEFAULT_SHUTDOWN_STEP_TIMEOUT_MS,
40
+ compileHeadlessToolAllowlist,
41
+ createProductionRuntime,
42
+ createPromptEnvironment,
43
+ matchesHeadlessAllowlist,
44
+ runGoalSession,
45
+ runResumeGoalSession
46
+ };
@@ -1,7 +1,7 @@
1
1
  import type { AgentEvent } from "./agent/types.js";
2
2
  import { GoalOrchestrator } from "./goal/orchestrator.js";
3
3
  import { type McpClientFactory } from "./mcp/client.js";
4
- import type { PermissionProfile, PermissionRequest } from "./permissions/engine.js";
4
+ import type { PermissionMode, PermissionProfile, PermissionRequest } from "./permissions/engine.js";
5
5
  import { type PromptEnvironment } from "./prompts/system.js";
6
6
  import type { ApprovalDecision } from "./tools/runtime.js";
7
7
  import { type MemoryRestartContinuation } from "./utils/memory-restart.js";
@@ -35,6 +35,12 @@ export interface ProductionRuntimeOptions {
35
35
  onToolsChange?(): void;
36
36
  /** Non-interactive callers must deny requests instead of waiting for input. */
37
37
  approvalPolicy?: "prompt" | "deny";
38
+ /** Override the resolved permission mode for this runtime (CLI --permission-mode). Takes precedence over recovered and configured modes. */
39
+ permissionMode?: PermissionMode;
40
+ /** Override the main model for this runtime (CLI --model), validated against the registry and any PKCE allowlist. */
41
+ modelOverride?: string;
42
+ /** Tool patterns auto-approved when approvalPolicy is "deny" (CLI --allowed-tools), e.g. "Read", "mcp__docs__*", "Shell(npm test:*)". */
43
+ headlessToolAllowlist?: readonly string[];
38
44
  /** Allow a protocol host to resolve tool approvals without enabling other interactive UI bridges. */
39
45
  rpcToolApprovals?: boolean;
40
46
  /** Optional pre-commit gate used by protocol hosts to stream a proposed text write before it reaches disk. */
@@ -118,5 +124,26 @@ export interface MemoryRestartRotation {
118
124
  /** Retention census holders reported by the major in-memory owners. */
119
125
  holders?: Record<string, RotationCensusHolder>;
120
126
  }
127
+ interface HeadlessAllowlistEntry {
128
+ /** Exact tool name match. */
129
+ tool?: string;
130
+ /** `pattern*` matches any tool name starting with the pattern. */
131
+ prefix?: string;
132
+ /** `Shell(prefix:*)` additionally requires the raw shell command to start with prefix. */
133
+ command?: string;
134
+ }
135
+ /**
136
+ * Compiles CLI --allowed-tools patterns for headless runs. Supported forms:
137
+ * `Read` (exact tool), `mcp__docs__*` (name prefix), `Shell(npm test:*)`
138
+ * (shell command prefix). Malformed patterns are ignored.
139
+ */
140
+ export declare function compileHeadlessToolAllowlist(patterns: readonly string[]): readonly HeadlessAllowlistEntry[];
141
+ /**
142
+ * Decides whether an "ask" permission request is pre-approved by the headless
143
+ * allowlist. Monotonic denials from the permission engine never reach here,
144
+ * and wrapped/opaque shell commands are never auto-approved.
145
+ */
146
+ export declare function matchesHeadlessAllowlist(entries: readonly HeadlessAllowlistEntry[], request: Pick<PermissionRequest, "tool" | "command" | "args">): boolean;
121
147
  export declare function runGoalSession(orchestrator: GoalOrchestrator, goal: string, signal: AbortSignal): AsyncIterable<AgentEvent>;
122
148
  export declare function runResumeGoalSession(orchestrator: GoalOrchestrator, goalId: string, signal: AbortSignal): AsyncIterable<AgentEvent>;
149
+ export {};
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ initializeFlavor,
5
+ inspectProject
6
+ } from "./chunk-OKHV7CTB.js";
7
+ import "./chunk-ZKKVSR37.js";
8
+ export {
9
+ initializeFlavor,
10
+ inspectProject
11
+ };
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ require_react
5
+ } from "./chunk-PULWAH6E.js";
6
+ import "./chunk-ZKKVSR37.js";
7
+ export default require_react();
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ TraceRecorder
5
+ } from "./chunk-4TMLXZVZ.js";
6
+ import "./chunk-WLZUAVVU.js";
7
+ import "./chunk-EWD7FWTH.js";
8
+ import "./chunk-ZKKVSR37.js";
9
+ export {
10
+ TraceRecorder
11
+ };
package/dist/sdk/index.js CHANGED
@@ -1,10 +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
+ import {
4
+ FlavorRpcServer
5
+ } from "../chunk-6URQ7FIF.js";
3
6
  import {
4
- FlavorRpcServer,
5
7
  TraceRecordSchema,
6
8
  TraceRecorder
7
- } from "../chunk-FAORPP4F.js";
9
+ } from "../chunk-4TMLXZVZ.js";
8
10
  import {
9
11
  AgentMessageQueue,
10
12
  DockerExecutionEnvironment,
@@ -13,11 +15,31 @@ import {
13
15
  WorkspaceCheckpointStore,
14
16
  buildDockerInvocation,
15
17
  createProductionRuntime
16
- } from "../chunk-O2PC44GY.js";
17
- import "../chunk-N5MXHJKD.js";
18
- import "../chunk-7YFHRORG.js";
19
- import "../chunk-ZJCAQXA7.js";
20
- import "../chunk-S32JRDZK.js";
18
+ } from "../chunk-IDJAHEG6.js";
19
+ import "../chunk-TIEOVQW6.js";
20
+ import "../chunk-OKHV7CTB.js";
21
+ import "../chunk-K7UGGWJV.js";
22
+ import "../chunk-IU3UBETC.js";
23
+ import "../chunk-PZ5NKRVA.js";
24
+ import "../chunk-6F66UXBI.js";
25
+ import "../chunk-3UX2CGDW.js";
26
+ import "../chunk-7Y64WNBB.js";
27
+ import "../chunk-CVP5OUHD.js";
28
+ import "../chunk-3563SW4X.js";
29
+ import "../chunk-RBAZLFKB.js";
30
+ import "../chunk-FAJ6YDZK.js";
31
+ import "../chunk-WLZUAVVU.js";
32
+ import "../chunk-RV3EXUXM.js";
33
+ import "../chunk-IQEEFDEE.js";
34
+ import "../chunk-GTFP2R5I.js";
35
+ import "../chunk-HGTCIHWA.js";
36
+ import "../chunk-SJUIIHIA.js";
37
+ import "../chunk-BDX777JR.js";
38
+ import "../chunk-6X62CGMA.js";
39
+ import "../chunk-EWD7FWTH.js";
40
+ import "../chunk-KRWWCVXA.js";
41
+ import "../chunk-X442CJJH.js";
42
+ import "../chunk-ZKKVSR37.js";
21
43
 
22
44
  // src/trace/replay.ts
23
45
  import { readFile } from "fs/promises";
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ FlavorRpcServer
5
+ } from "./chunk-6URQ7FIF.js";
6
+ import "./chunk-BDX777JR.js";
7
+ import "./chunk-EWD7FWTH.js";
8
+ import "./chunk-ZKKVSR37.js";
9
+ export {
10
+ FlavorRpcServer
11
+ };
@@ -109,6 +109,7 @@ export declare const SessionDocumentSchema: z.ZodObject<{
109
109
  cacheBreakpoint: z.ZodOptional<z.ZodBoolean>;
110
110
  }, z.core.$strict>>;
111
111
  sources: z.ZodRecord<z.ZodString, z.ZodString>;
112
+ pinnedSources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
112
113
  stableSourceHash: z.ZodString;
113
114
  }, z.core.$strict>>;
114
115
  visibilityLog: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ DEFAULT_MAX_SESSION_BYTES,
5
+ SESSION_VERSION,
6
+ SessionDocumentSchema,
7
+ SessionStore
8
+ } from "./chunk-SJUIIHIA.js";
9
+ import "./chunk-BDX777JR.js";
10
+ import "./chunk-6X62CGMA.js";
11
+ import "./chunk-EWD7FWTH.js";
12
+ import "./chunk-ZKKVSR37.js";
13
+ export {
14
+ DEFAULT_MAX_SESSION_BYTES,
15
+ SESSION_VERSION,
16
+ SessionDocumentSchema,
17
+ SessionStore
18
+ };
@@ -1,4 +1,4 @@
1
- export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "help", "exit", "audit", "usage", "doctor", "loop", "goal", "evolve", "mcp", "commit", "review", "explain", "ide", "memory", "remember", "forget", "forget-cold", "checkpoint", "tree", "rewind", "unrevert", "fork", "pals", "chat", "co-work", "tool"];
1
+ export declare const MVP_COMMANDS: readonly ["model", "init", "config", "login", "logout", "permissions", "skills", "plugins", "hooks", "tasks", "finish", "compact", "clear", "paste-image", "help", "exit", "audit", "usage", "doctor", "loop", "goal", "evolve", "mcp", "commit", "review", "explain", "ide", "memory", "remember", "forget", "forget-cold", "checkpoint", "tree", "rewind", "unrevert", "fork", "pals", "chat", "co-work", "tool"];
2
2
  export declare const COMMAND_DESCRIPTIONS: Record<(typeof MVP_COMMANDS)[number], string>;
3
3
  export type PermissionCommandMode = PermissionMode;
4
4
  export type ModelRole = "main" | "subagent";
@@ -102,10 +102,6 @@ export type SlashCommand = {
102
102
  } | {
103
103
  name: "evolve";
104
104
  args: string[];
105
- } | {
106
- name: "unknown";
107
- input: string;
108
- suggestions: string[];
109
105
  } | {
110
106
  name: "invalid";
111
107
  command: string;
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import {
4
+ formatUsageSummary,
5
+ parseUsageEntries,
6
+ summarizeUsage
7
+ } from "./chunk-X442CJJH.js";
8
+ import "./chunk-ZKKVSR37.js";
9
+ export {
10
+ formatUsageSummary,
11
+ parseUsageEntries,
12
+ summarizeUsage
13
+ };
@@ -1,5 +1,6 @@
1
1
  export interface ExecFileNoThrowOptions {
2
2
  timeout?: number;
3
+ maxBuffer?: number;
3
4
  useCwd?: boolean;
4
5
  env?: NodeJS.ProcessEnv;
5
6
  stdin?: "ignore" | "inherit" | "pipe";
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createFlavorRequire } from "node:module"; const require = createFlavorRequire(import.meta.url);
3
+ import "./chunk-ZKKVSR37.js";
4
+
5
+ // src/rpc/write-stream.ts
6
+ import { randomUUID } from "crypto";
7
+ var RpcWriteStreamBridge = class {
8
+ #output;
9
+ #pending;
10
+ constructor(output) {
11
+ this.#output = output;
12
+ }
13
+ get pendingId() {
14
+ return this.#pending?.id;
15
+ }
16
+ async preview(proposal, signal) {
17
+ if (this.#pending !== void 0) throw new Error("Another streamed write is still awaiting commit");
18
+ if (signal.aborted) throw signal.reason;
19
+ const id = randomUUID();
20
+ this.#output({
21
+ type: "write-start",
22
+ id,
23
+ path: proposal.path,
24
+ before: proposal.before,
25
+ totalBytes: Buffer.byteLength(proposal.after)
26
+ });
27
+ for (const delta of streamChunks(proposal.after)) this.#output({ type: "write-delta", id, delta });
28
+ this.#output({ type: "write-ready", id });
29
+ await new Promise((resolve, reject) => {
30
+ const onAbort = () => {
31
+ this.#output({ type: "write-cancelled", id });
32
+ this.#clear(id);
33
+ reject(signal.reason);
34
+ };
35
+ signal.addEventListener("abort", onAbort, { once: true });
36
+ this.#pending = {
37
+ id,
38
+ resolve,
39
+ reject,
40
+ removeAbort: () => signal.removeEventListener("abort", onAbort)
41
+ };
42
+ });
43
+ }
44
+ commit(id) {
45
+ const pending = this.#pending;
46
+ if (pending === void 0 || pending.id !== id) throw new Error("Streamed write is no longer awaiting commit");
47
+ pending.removeAbort();
48
+ this.#pending = void 0;
49
+ pending.resolve();
50
+ }
51
+ dispose() {
52
+ const pending = this.#pending;
53
+ if (pending === void 0) return;
54
+ pending.removeAbort();
55
+ this.#pending = void 0;
56
+ pending.reject(new Error("Streamed write bridge disposed"));
57
+ }
58
+ #clear(id) {
59
+ if (this.#pending?.id !== id) return;
60
+ this.#pending.removeAbort();
61
+ this.#pending = void 0;
62
+ }
63
+ };
64
+ function streamChunks(content, maxChars = 2048) {
65
+ if (!content) return [];
66
+ const chunks = [];
67
+ for (const line of content.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
68
+ for (let offset = 0; offset < line.length; offset += maxChars) {
69
+ chunks.push(line.slice(offset, offset + maxChars));
70
+ }
71
+ }
72
+ return chunks;
73
+ }
74
+ export {
75
+ RpcWriteStreamBridge,
76
+ streamChunks
77
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flavor-code",
3
- "version": "1.4.1",
3
+ "version": "1.4.3-beta.2",
4
4
  "author": "YachuanWzh",
5
5
  "type": "module",
6
6
  "publishConfig": {