flavor-code 1.3.4 → 1.3.7

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 CHANGED
@@ -33,9 +33,10 @@ Flavor Code connects to OpenAI, Anthropic, or compatible services and works with
33
33
  | --- | --- | --- |
34
34
  | 🖥️ | **One runtime, three entry points** | CLI, Electron, and VS Code share model configuration, sessions, and tooling |
35
35
  | 🧭 | **Controlled progress on complex tasks** | Task plans, sub-agents, steering, follow-ups, `/loop`, `/goal`, and conflict-safe parallel execution (tasks owning overlapping files run serially) |
36
- | ⏪ | **Traceable, resumable results** | Full timeline, checkpoints, rewind, traces, diffs, and failure audits |
37
- | 🧱 | **Crash-consistent execution** | Fsync-backed event journal, durable steering queue, savepoints, and no automatic replay of non-idempotent tools |
38
- | 🧠 | **Local long-term context** | Memory, Skills, plugins, and project guides stored on your machine |
36
+ | 🏝️ | **Flavor Island local control** | Host apps steer a running session over a token-authenticated local IPC channel (Windows named pipes / Unix sockets): abort, steering, follow-ups, and window focus; model duration, token usage, task summaries, and deliverables are reported via hook events |
37
+ | ⏪ | **Traceable, resumable results** | Full timeline, checkpoints, rewind, traces, diffs, and failure audits |
38
+ | 🧱 | **Crash-consistent execution** | Fsync-backed event journal, durable steering queue, savepoints, and no automatic replay of non-idempotent tools |
39
+ | 🧠 | **Local long-term context** | Memory, Skills, plugins, and project guides stored on your machine |
39
40
  | 🔎 | **Code graph navigation** | A local AST code-graph index (`.flavor/astgraph/`) powers `ast_search`/`ast_callers`/`ast_impact` queries for precise symbol lookup and reachability tracing |
40
41
  | 🌿 | **Git-native workflows** | `/commit` drafts a Conventional-Commits message for staged changes and commits after confirmation; `/review` audits uncommitted changes; the read-only `GitHistory` tool explains when and why code changed |
41
42
  | 🎨 | **E2E requirement-to-delivery** | From a rough requirement or a design export to a delivered product: PRD, interactive prototype, visual implementation, API integration, autonomous acceptance, and scored delivery (Electron only) |
@@ -204,9 +205,9 @@ npm run desktop:pack # Windows portable directory
204
205
  npm run desktop:dist # Windows NSIS installer
205
206
  ```
206
207
 
207
- The desktop app keeps multiple projects open and can run up to four independent tasks concurrently inside one project; switching projects or tasks does not stop background work. Completion, failure, attention, and interruption events enter a persistent activity inbox and trigger native notifications, while unread completions retain a blue dot. Projects can be pinned, renamed, closed, revealed, or copied; tasks can be searched, renamed, pinned, and archived.
208
-
209
- Use `Ctrl+P` to switch projects, `Ctrl+K` for the command palette, and `Ctrl+N` for a new task; the title bar also supports back/forward navigation. Interrupted work gets a recovery banner after an abnormal exit. The **Git Changes** view provides per-file diffs, stage/unstage/discard, commits, and `/review` handoff. Streaming Markdown, permission confirmations, and Skills, MCP, memory, and model management remain available.
208
+ The desktop app keeps multiple projects open and can run up to four independent tasks concurrently inside one project; switching projects or tasks does not stop background work. Completion, failure, attention, and interruption events enter a persistent activity inbox and trigger native notifications, while unread completions retain a blue dot. Projects can be pinned, renamed, closed, revealed, or copied; tasks can be searched, renamed, pinned, and archived.
209
+
210
+ Use `Ctrl+P` to switch projects, `Ctrl+K` for the command palette, and `Ctrl+N` for a new task; the title bar also supports back/forward navigation. Interrupted work gets a recovery banner after an abnormal exit. The **Git Changes** view provides per-file diffs, stage/unstage/discard, commits, and `/review` handoff. Streaming Markdown, permission confirmations, and Skills, MCP, memory, and model management remain available.
210
211
 
211
212
  The **E2E** module in the sidebar drives a rough requirement or an existing design export through the full delivery pipeline: it generates a PRD and an interactive prototype for review, then moves into D2C visual implementation (Vue 3 / React) under `src/d2c-output/<task>/`. A Vite dev server starts automatically for pixel-level comparison, producing a visual-fidelity score and a structured diff report (region offsets, color deviations, font differences); the results workbench offers overlay, curtain, flicker, and heatmap modes, an SVG annotation layer, and a severity-sorted issue list. After visual review, a Swagger/OpenAPI contract is generated or imported to auto-create Axios wrappers and an Express mock server, followed by autonomous interactive acceptance and scored delivery.
212
213
 
@@ -250,12 +251,14 @@ flavor mcp disable docs
250
251
 
251
252
  </details>
252
253
 
253
- A Skill is a `SKILL.md` with YAML frontmatter, placed in `.flavor/skills/<name>/` or `~/.flavor-code/skills/<name>/`. Flavor loads skills progressively based on the task, and you can invoke one explicitly with `/<skill-name>`. Skill bodies support `$ARGUMENTS`, `$ARGUMENTS[N]`, and `$N` substitutions. A running composite Skill can load a dependency through the read-only `Skill` tool; plugin-qualified names such as `superharness:test-driven-development` resolve to discovered skills.
254
+ A Skill is a `SKILL.md` with YAML frontmatter, placed in `.flavor/skills/<name>/` or `~/.flavor-code/skills/<name>/`. Flavor loads skills progressively based on the task, and you can invoke one explicitly with `/<skill-name>`. Skill bodies support `$ARGUMENTS`, `$ARGUMENTS[N]`, and `$N` substitutions. A running composite Skill can load a dependency through the read-only `Skill` tool; plugin-qualified names such as `superharness:test-driven-development` resolve to discovered skills.
255
+
256
+ Plugins live in `.flavor/plugins/` and can register commands, tools, hooks, Skill roots, and model adapters. `additionalContext` returned by `SessionStart` and `UserPromptSubmit` hooks is added to the current task context, enabling reliable project-level engineering policy injection. Plugin loads record a content fingerprint plus declared capabilities. Worker/vm isolation is available through the embedding API's `pluginSandbox: true` option; the compatibility default remains in-process because bundled and existing plugins use Node.js APIs that the isolated runtime does not yet mediate.
254
257
 
255
- Plugins live in `.flavor/plugins/` and can register commands, tools, hooks, Skill roots, and model adapters. `additionalContext` returned by `SessionStart` and `UserPromptSubmit` hooks is added to the current task context, enabling reliable project-level engineering policy injection. Plugin loads record a content fingerprint plus declared capabilities. Worker/vm isolation is available through the embedding API's `pluginSandbox: true` option; the compatibility default remains in-process because bundled and existing plugins use Node.js APIs that the isolated runtime does not yet mediate.
256
-
257
- > [!WARNING]
258
- > The default in-process plugin runtime grants full Node.js access. Only install and enable plugins you trust. Sandboxing reduces ambient access but does not make untrusted instructions safe, and plugins that import Node.js built-ins will not load with `pluginSandbox: true` yet.
258
+ When the `flavor-island` plugin is loaded, Flavor also starts a Flavor Island local control channel: a loopback-only IPC service (Windows named pipe, or Unix socket on macOS/Linux) secured by a random token. A host app (such as the Flavor Island desktop) can use it to abort, steer, or send follow-ups to a running session, and desktop hosts can also bring their window into focus. The channel's endpoint, token, and capability list are exposed to the host plugin via hook event context (`islandControlEndpoint`/`islandControlToken`/`islandControlCapabilities`); model-call duration and token usage, plus the final task summary and deliverables, are reported through hook events so the host can show live status and a result overview.
259
+
260
+ > [!WARNING]
261
+ > The default in-process plugin runtime grants full Node.js access. Only install and enable plugins you trust. Sandboxing reduces ambient access but does not make untrusted instructions safe, and plugins that import Node.js built-ins will not load with `pluginSandbox: true` yet.
259
262
 
260
263
  ## Sessions, Memory & Execution Records
261
264
 
@@ -264,8 +267,8 @@ Project runtime data lives under `.flavor/`:
264
267
  ```text
265
268
  .flavor/
266
269
  ├── flavor.json # Project config
267
- ├── sessions/ # Session timelines
268
- │ └── *.events.jsonl # Crash-consistent execution journals
270
+ ├── sessions/ # Session timelines
271
+ │ └── *.events.jsonl # Crash-consistent execution journals
269
272
  ├── session-assets/ # Image attachments
270
273
  ├── session-trees/ # Session branches
271
274
  ├── checkpoints/ # Workspace snapshots
@@ -290,9 +293,9 @@ Image prompts support PNG, JPEG, and WebP, with a 5 MiB per-image maximum and up
290
293
  | `plan` | Read-only planning; no modifications or execution |
291
294
  | `bypassPermissions` | The main agent executes as much as possible after hard safety checks |
292
295
  | `auto` | A classifier decides, falling back to human approval when uncertain |
293
- | `bubble` | Uncertain operations bubble up to the main session for approval |
294
-
295
- Layered permission policies can be defined in the managed, user, project, local-project, and session tiers. Matching rules use token arrays and the strictest result always wins (`deny > ask > allow`); built-in hard denials cannot be weakened.
296
+ | `bubble` | Uncertain operations bubble up to the main session for approval |
297
+
298
+ Layered permission policies can be defined in the managed, user, project, local-project, and session tiers. Matching rules use token arrays and the strictest result always wins (`deny > ask > allow`); built-in hard denials cannot be weakened.
296
299
 
297
300
  > [!CAUTION]
298
301
  > Local Shell still runs as your current user. Consider enabling Docker when working with untrusted projects.
@@ -382,8 +385,8 @@ npm run build
382
385
  ## Documentation
383
386
 
384
387
  - [Technical Design Report](./技术方案报告.md): overall architecture, agent loop, context, permissions, plugins, and security model
385
- - [Runtime reliability spec](./docs/specs/2026-07-26-runtime-reliability.md)
386
- - [1.3 reliability, prompt-cache & verification contract](./docs/specs/2026-08-24-v1.3-reliability-contract.md)
388
+ - [Runtime reliability spec](./docs/specs/2026-07-26-runtime-reliability.md)
389
+ - [1.3 reliability, prompt-cache & verification contract](./docs/specs/2026-08-24-v1.3-reliability-contract.md)
387
390
  - [Control plane, sandbox & VS Code spec](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)
388
391
  - [Multimodal image attachments spec](./docs/specs/2026-07-30-multimodal-image-attachments.md)
389
392
  - [D2C design-to-code spec](./docs/specs/2026-08-09-d2c-design-to-code.md)
@@ -397,7 +400,7 @@ npm run build
397
400
  - Review model-generated code and commands, especially dependency installs, scripts, and deletions.
398
401
  - Do not treat `.flavor/sessions/`, traces, or long-term memory as secret stores.
399
402
  - Use least-privilege API keys and never commit `.env`.
400
- - Skill content can influence model behavior; sandboxed plugins still require review, while explicitly enabled legacy in-process plugins have full Node.js permissions.
403
+ - Skill content can influence model behavior; sandboxed plugins still require review, while explicitly enabled legacy in-process plugins have full Node.js permissions.
401
404
  - Work under version control and create checkpoints before high-risk tasks.
402
405
 
403
406
  ## Contributing
package/README.zh-CN.md CHANGED
@@ -33,9 +33,10 @@ Flavor Code 接入 OpenAI、Anthropic 或兼容服务,在受控工作区内使
33
33
  | --- | --- | --- |
34
34
  | 🖥️ | **一个运行时,三个入口** | CLI、Electron 与 VS Code 共享模型配置、会话和工具能力 |
35
35
  | 🧭 | **复杂任务可控推进** | 任务计划、子 Agent、steering、follow-up、`/loop`、`/goal`,并行任务自动避免写冲突(拥有重叠文件的任务串行执行) |
36
- | ⏪ | **结果可追溯、可恢复** | 完整时间线、checkpoint、rewind、trace、Diff 和失败审计 |
37
- | 🧱 | **崩溃一致执行** | fsync 事件日志、持久 steering 队列、savepoint,非幂等工具不自动重放 |
38
- | 🧠 | **本地长期上下文** | 记忆、Skill、插件和项目指南均保存在本机 |
36
+ | 🏝️ | **Flavor Island 本地控制** | 宿主应用通过 token 认证的本机 IPC(Windows named pipe / Unix socket)控制运行中的会话:中止、steering、follow-up 与窗口聚焦;模型耗时、token 用量、任务摘要和交付物随 Hook 事件上报 |
37
+ | ⏪ | **结果可追溯、可恢复** | 完整时间线、checkpoint、rewind、trace、Diff 和失败审计 |
38
+ | 🧱 | **崩溃一致执行** | fsync 事件日志、持久 steering 队列、savepoint,非幂等工具不自动重放 |
39
+ | 🧠 | **本地长期上下文** | 记忆、Skill、插件和项目指南均保存在本机 |
39
40
  | 🔎 | **代码图导航** | 本地 AST 代码图索引(`.flavor/astgraph/`),通过 `ast_search`/`ast_callers`/`ast_impact` 等查询精确定位符号、追踪可达性 |
40
41
  | 🌿 | **Git 原生工作流** | `/commit` 为暂存改动生成 Conventional Commits 提交信息并确认提交;`/review` 审查未提交改动;只读 `GitHistory` 工具回答“这段代码为什么是这样” |
41
42
  | 🎨 | **E2E 需求到交付** | 从粗需求或设计稿到可交付产品:PRD、交互原型、视觉还原、接口联调、自主验收与评分交付(仅 Electron) |
@@ -204,9 +205,9 @@ npm run desktop:pack # Windows 免安装目录
204
205
  npm run desktop:dist # Windows NSIS 安装包
205
206
  ```
206
207
 
207
- 桌面端可以同时保持多个项目打开,同一项目也可并行运行最多 4 个独立任务;切换项目或任务不会中止后台执行。运行中的任务显示动态活动标记;完成、失败、等待确认和异常中断会进入持久活动中心并触发系统通知,未读完成项保留蓝点。项目支持置顶、别名、关闭、定位和复制路径,任务支持搜索、重命名、置顶和归档。
208
-
209
- 使用 `Ctrl+P` 快速切换项目、`Ctrl+K` 打开命令面板、`Ctrl+N` 新建任务,标题栏支持前进/后退。异常退出后会出现恢复条。**Git 变更**视图提供逐文件 Diff、暂存、取消暂存、还原、提交及 `/review` 联动。桌面端还提供流式 Markdown、权限确认、Skill、MCP、记忆和模型管理。
208
+ 桌面端可以同时保持多个项目打开,同一项目也可并行运行最多 4 个独立任务;切换项目或任务不会中止后台执行。运行中的任务显示动态活动标记;完成、失败、等待确认和异常中断会进入持久活动中心并触发系统通知,未读完成项保留蓝点。项目支持置顶、别名、关闭、定位和复制路径,任务支持搜索、重命名、置顶和归档。
209
+
210
+ 使用 `Ctrl+P` 快速切换项目、`Ctrl+K` 打开命令面板、`Ctrl+N` 新建任务,标题栏支持前进/后退。异常退出后会出现恢复条。**Git 变更**视图提供逐文件 Diff、暂存、取消暂存、还原、提交及 `/review` 联动。桌面端还提供流式 Markdown、权限确认、Skill、MCP、记忆和模型管理。
210
211
 
211
212
  侧栏的 **E2E** 模块覆盖从粗需求到可验收成果物的完整交付链路:从粗需求生成 PRD 与可交互原型(支持审阅与退回),确认后进入 D2C 视觉还原(Vue 3 / React),自动启动 Vite dev server 进行像素级对比,输出视觉还原度评分与结构化差异报告,并提供叠加、帘幕、闪烁与热力图等对比模式、SVG 标注层和按严重度排序的问题列表;视觉审阅通过后,自动生成或导入 Swagger/OpenAPI 契约以创建 Axios 封装与 Express mock 服务,随后进行自主交互验收,最终完成评分与成果物交付。
212
213
 
@@ -250,12 +251,14 @@ flavor mcp disable docs
250
251
 
251
252
  </details>
252
253
 
253
- Skill 是带有 YAML 头信息的 `SKILL.md`,放在 `.flavor/skills/<name>/` 或 `~/.flavor-code/skills/<name>/`。Flavor 会按任务渐进加载,也支持通过 `/<skill-name>` 显式调用。Skill 正文支持 `$ARGUMENTS`、`$ARGUMENTS[N]` 和 `$N` 参数占位符;运行中的组合 Skill 可以使用只读 `Skill` 工具继续加载依赖 Skill,插件限定名称(如 `superharness:test-driven-development`)会安全解析到已发现的 Skill。
254
+ Skill 是带有 YAML 头信息的 `SKILL.md`,放在 `.flavor/skills/<name>/` 或 `~/.flavor-code/skills/<name>/`。Flavor 会按任务渐进加载,也支持通过 `/<skill-name>` 显式调用。Skill 正文支持 `$ARGUMENTS`、`$ARGUMENTS[N]` 和 `$N` 参数占位符;运行中的组合 Skill 可以使用只读 `Skill` 工具继续加载依赖 Skill,插件限定名称(如 `superharness:test-driven-development`)会安全解析到已发现的 Skill。
255
+
256
+ 插件放在 `.flavor/plugins/`,可以注册命令、工具、Hook、Skill 根目录和模型适配器。`SessionStart` 与 `UserPromptSubmit` Hook 返回的 `additionalContext` 会进入当前任务上下文,可用于注入项目级工程规则。插件加载会记录内容指纹与声明的能力。可通过嵌入 API 的 `pluginSandbox: true` 启用 Worker/vm 隔离;由于内置插件和已有插件依赖沙箱尚未代理的 Node.js API,当前兼容默认值仍为进程内运行。
254
257
 
255
- 插件放在 `.flavor/plugins/`,可以注册命令、工具、Hook、Skill 根目录和模型适配器。`SessionStart` 与 `UserPromptSubmit` Hook 返回的 `additionalContext` 会进入当前任务上下文,可用于注入项目级工程规则。插件加载会记录内容指纹与声明的能力。可通过嵌入 API 的 `pluginSandbox: true` 启用 Worker/vm 隔离;由于内置插件和已有插件依赖沙箱尚未代理的 Node.js API,当前兼容默认值仍为进程内运行。
256
-
257
- > [!WARNING]
258
- > 默认的进程内插件运行时拥有完整 Node.js 权限,只安装和启用你信任的插件。沙箱会降低环境权限,但不能让不可信指令自动变安全;目前导入 Node.js 内置模块的插件在 `pluginSandbox: true` 下仍无法加载。
258
+ 加载 `flavor-island` 插件时,Flavor 会额外启动一个 Flavor Island 本地控制通道:这是一个只监听本机回环的 IPC 服务(Windows 使用 named pipe,macOS/Linux 使用 Unix socket),通过随机 token 认证。宿主应用(如 Flavor Island 桌面端)可以借此对运行中的会话执行中止、steering、follow-up 等操作,桌面端还支持把窗口带到前台(focus)。通道的地址、token 与能力列表会通过 Hook 事件上下文(`islandControlEndpoint`/`islandControlToken`/`islandControlCapabilities`)提供给宿主插件,模型调用的耗时与 token 用量、任务结束时的摘要和交付文件也会随 Hook 事件上报,方便宿主展示运行状态与结果概览。
259
+
260
+ > [!WARNING]
261
+ > 默认的进程内插件运行时拥有完整 Node.js 权限,只安装和启用你信任的插件。沙箱会降低环境权限,但不能让不可信指令自动变安全;目前导入 Node.js 内置模块的插件在 `pluginSandbox: true` 下仍无法加载。
259
262
 
260
263
  ## 会话、记忆与执行记录
261
264
 
@@ -264,8 +267,8 @@ Skill 是带有 YAML 头信息的 `SKILL.md`,放在 `.flavor/skills/<name>/`
264
267
  ```text
265
268
  .flavor/
266
269
  ├── flavor.json # 项目配置
267
- ├── sessions/ # 会话时间线
268
- │ └── *.events.jsonl # 崩溃一致执行事件日志
270
+ ├── sessions/ # 会话时间线
271
+ │ └── *.events.jsonl # 崩溃一致执行事件日志
269
272
  ├── session-assets/ # 图片附件
270
273
  ├── session-trees/ # 会话分支
271
274
  ├── checkpoints/ # 工作区快照
@@ -290,9 +293,9 @@ Skill 是带有 YAML 头信息的 `SKILL.md`,放在 `.flavor/skills/<name>/`
290
293
  | `plan` | 只读规划,不允许修改和执行 |
291
294
  | `bypassPermissions` | 主 Agent 在硬安全检查后尽量自动执行 |
292
295
  | `auto` | 使用分类器判断,无法确定时回到人工确认 |
293
- | `bubble` | 将不确定操作冒泡给主会话审批 |
294
-
295
- 权限策略支持托管、用户、项目、本机项目和 session 五层配置。规则以 token 数组匹配,所有命中项始终采用最严格结果(`deny > ask > allow`),内置硬拒绝不可被放宽。
296
+ | `bubble` | 将不确定操作冒泡给主会话审批 |
297
+
298
+ 权限策略支持托管、用户、项目、本机项目和 session 五层配置。规则以 token 数组匹配,所有命中项始终采用最严格结果(`deny > ask > allow`),内置硬拒绝不可被放宽。
296
299
 
297
300
  > [!CAUTION]
298
301
  > 本地 Shell 仍然以当前用户身份运行。处理不可信项目时建议启用 Docker。
@@ -382,8 +385,8 @@ npm run build
382
385
  ## 文档
383
386
 
384
387
  - [技术方案报告](./技术方案报告.md):整体架构、Agent 循环、上下文、权限、插件和安全模型
385
- - [运行时可靠性规范](./docs/specs/2026-07-26-runtime-reliability.md)
386
- - [1.3 可靠性、Prompt Cache 与验收契约](./docs/specs/2026-08-24-v1.3-reliability-contract.md)
388
+ - [运行时可靠性规范](./docs/specs/2026-07-26-runtime-reliability.md)
389
+ - [1.3 可靠性、Prompt Cache 与验收契约](./docs/specs/2026-08-24-v1.3-reliability-contract.md)
387
390
  - [控制面、沙箱与 VS Code 规范](./docs/specs/2026-07-29-control-plane-sandbox-vscode.md)
388
391
  - [多模态图片规范](./docs/specs/2026-07-30-multimodal-image-attachments.md)
389
392
  - [VS Code 后续规划](./docs/specs/2026-08-01-flavor-code-vscode-next.md)
@@ -394,7 +397,7 @@ npm run build
394
397
  - 审查模型生成的代码和命令,尤其是依赖安装、脚本和删除操作。
395
398
  - 不要把 `.flavor/sessions/`、trace 或长期记忆当作秘密仓库。
396
399
  - 使用最小权限 API Key,不要提交 `.env`。
397
- - Skill 内容可能影响模型行为;沙箱插件仍需审查,显式启用的旧版进程内插件拥有完整 Node.js 权限。
400
+ - Skill 内容可能影响模型行为;沙箱插件仍需审查,显式启用的旧版进程内插件拥有完整 Node.js 权限。
398
401
  - 建议在版本控制下工作,并在高风险任务前创建 checkpoint。
399
402
 
400
403
  ## 参与贡献
@@ -16,7 +16,7 @@ import {
16
16
  redactErrorText,
17
17
  transcriptReducer,
18
18
  withTimeout
19
- } from "./chunk-YKSMZDUZ.js";
19
+ } from "./chunk-K2AOT2BI.js";
20
20
  import "./chunk-IG4Z23CL.js";
21
21
  import {
22
22
  Box_default,