Conversation
FIG wave-1 lane B(M4-lite):backend/src/completion/{mod,protocol,security,
executor,local,ssh} 新模块 + main.rs 路由臂(仅此一处接线)。
- protocol.rs 与冻结镜像 frontend/.../host/protocol.ts 逐字段一致
(serde camelCase + tag=kind lowercase),round-trip 测试固化;
- security.rs:mode 白名单(completion-generator)、command/args/cwd 的
NUL 与数量校验、timeoutMs clamp [200,3000](缺省 1200)、
maxOutputBytes clamp ≤256KiB;远端拼装复用既有 exec::shell_quote
逐参数转义;
- local.rs:短生命周期 tokio 子进程(argv 直 exec、stdin /dev/null、
kill_on_drop),stdout/stderr 并发读取各自截断、任一到顶立即杀进程,
completion 层竞速超时;不触碰 local_terminal 的交互 PTY;
- ssh.rs:read-only 门(决策 D4,经 ssh.rs 预批最小只读查询 fn)、
execId=completion-<uuid>、竞速超时(决策 D3)后走既有 cancel_exec
回收,不改 SshRuntime::exec 内部 clamp(5,300);exec 合并流 output
显式映射到 stdout、stderr 恒空;
- 错误统一 completion: 前缀;零新增依赖,Cargo.lock 未动。
RPC 总表加行 + 文末新节(文体对齐 WT-4):参数表(camelCase)、返回 字段、语义要点(target-side 执行、sudo 恒 false、只读拒绝 D4、超时 竞速+取消 D3、双流各自 maxOutputBytes 截断、exec 合并流映射、 completion: 错误前缀、ssh cwd wave-1 显式不支持)。
对齐 smoke_fs_test 约定(Method not found → SKIP、CaseResult 记账、 前置用例依赖)。覆盖 local echo/超时竞速/输出截断、安全拒绝 (mode/空 command)、ssh 基础/参数引号往返/未知会话/超时竞速/只读 连接拒绝(D4)。本机 docker 测试容器实测 9 PASS / 0 SKIP / 0 FAIL。
Linux 宿主(GPU 合成停摆/动画被节流的 webview)里,reka 弹层的入场动画 (tw-animate-css `enter`,首帧 opacity 0)会永远冻结在第一帧:弹窗实际 已打开但全透明、无任何报错——用户侧即「点了按钮,弹窗出不来,也没有明 显的提示」(mockDbxHost ?noanim 注释记载过的同款"鬼影弹层"现象,浏览器 走查已在动画被节流的面板里实测复现)。 新增 lib/popupReveal.ts 兜底:body 级 MutationObserver 监听弹层挂载 (popover/dialog/select/context-menu 四类 data-slot;组件 ref 只能拿到 portal 锚点注释节点,够不着 teleport 后的弹层本体),挂载 300ms 后弹层 仍不足全不透明则把卡住的动画 finish 到终态——fill-mode none,动画结束 回落自然可见样式。正常宿主动画 duration-100 远早于观察点结束,此路径 零视觉差异;观察器回调走微任务,不依赖渲染帧,冻结宿主里照样触发。 验证:popupReveal 单测 9 条;前端全套 1293/1293 通过;vue-tsc 干净; node build.mjs 生产构建通过;动画冻结的浏览器面板端到端复现修复效果 (Docker 鲸鱼面板与强杀确认弹窗均正常显形)。
…urce - core/edit:applyEditToText(越界向行界收敛,不抛错)+ trailingTokenEdit - core/ranking:rankItems 唯一排序出口(score 降序/label 字典序/截 20 条) - keyboard:契约 §2.2 规则表纯函数(Enter 恒放行、hint/loading Tab 透传), 全组合表驱动单测固化 - CompletionController:resolver=冻结接缝 FigCompletionSource(构造注入), 三重 guard(revision+requestId+sessionId)/90ms 防抖合并/异常降级 pass-through/enabled 直通;防御 thenable 分支为 Worker 化留位 - testing/fakeFigSource:确定性 Fake(git ch 静态候选、git co 别名展开、 深参数位 null)驱动 controller 全路径单测 + dev 手动清单
- App.vue:补全面收进 CompletionController(锚点=函数名:openCompletionMenu/ handleCompletionKey/acceptCompletionRow/refreshCompletionMenu/trackPendingInput/ replaceTerminalLineWith/refreshSuggestionsAfterInput、Enter·Ctrl+C 清行点、 ghost 接受点、会话切换 resetSession);键盘消费经 keyboard.ts 规则表 (Enter 恒放行 shell、动态位/loading Tab 透传语义不变);接受路径 item.edit→applyEditToText→replaceTerminalLineWith(整行擦重打不变); 输入门仅常规键入放行(粘贴/快速命令/guard 抑制面不开浮层,同基线) - dev 构建注入 FakeFigCompletionSource(手动清单用);生产为 pass-through source,真实实现由 Lane C' 集成时在构造点一处替换 - CompletionMenu.vue:props 迁移为 items: CompletionItem[](§24 映射, label/description/kind 直用,accept 回传 item),spec 同步更新 - legacy 退役:删除 lib/completions 整目录;pluginStore 键位 swap (ssh-completion-engine:fig-safe 默认/fig/off,含 sanitize/load 单点); SettingsDialog 开关改引擎 Select;i18n 七语全补(engine* 五键, 旧 settingsEnabled*/level* 键随退役删除) - 冻结文件 tokenize.ts/spec 仅注释性改动:移除退役路径字面量以过 退役 grep 门禁(两 grep 均无结果),无代码语义变更
…ocess 产候选,失败超时一律 null
… manifest - scripts/sync_fig_specs.mjs(唯一联网点):pin withfig/autocomplete@aef52acf (全量语料 src/)+ aws/amazon-q-developer-cli@5c621df6(autocomplete TS parser 子树最终状态,其后于 09aa3cba 被上游整体删除);npm 闭包 @fig/{shared,generators,helpers}+semver 一并 vendored(frontend/vendor/fig-npm)。 - parser 经 vite(rolldown,零新增依赖)打出 frontend/vendor/autocomplete-engine/ parser.js(57KB 单 ESM browser-safe);宿主耦合面(fs/CDN loadSpec、桌面 设置、shell 执行)经 facades/ 剥离,误调用抛 unsupported(§43 降级)。 - 语料逐 spec 编译为 ESM(1461/1467 成功,6 个外部依赖 yaml/strip-json-comments 者跳过记录);预算(5MB 总量/500KB 单 spec,单 spec 上限首测后上调)+ MOST_USED 优先的确定性 allowlist → build/724 specs + spec-manifest.generated.ts 静态 import map + snapshot.json(双 pin/sizes/skipped)。 - scripts/verify_fig_specs.mjs(离线门禁):双 pin/LICENSE/NOTICE/manifest↔build 一致/全量 import/parser 冒烟/体积预算+裁剪建议序。scripts/import-fig-specs.mjs 删除(最终架构取消项)。 - frontend/package.json:fig:sync / fig:verify / fig:test。幂等:同 pin 全 vendor 目录(845 文件)二次运行哈希一致。
…t 注册表
- 实现冻结接缝 fig/source.ts:tokenize 用 core/tokenize.ts(行级判定),
语义全走 vendored parser(updateState 状态机:嵌套/持久选项/变参//
--flag=value 复合 token),候选编辑范围用 shell-parser token 节点的
buffer 绝对偏移。
- 同步驱动镜像上游 parseArgumentsCached 非异步路径:根级/子级 loadSpec
(string→[{name,type}] 归一化形态)与 isCommand/isModule 参数位经 manifest
注册表换轨;generateSpec 动态面不执行(镜像上游失败降级:保留静态候选,
纯动态位 null)。
- generator 参数位:不执行 generator,静态候选照常;无静态候选 → null
(批次 2 经 completion/execute 接入)。异常吞掉返 null,绝不上抛。
- 离线测试:parser 冒烟(真实 git 语料:嵌套//flag=value/别名展开/变参/
token 偏移)+ source fixture 断言(编辑边界/kind 映射/换轨/异常吞掉/
命令名补全)+ verify 纯函数单测(manifest 一致性/预算裁剪序/冒烟函数)。
…剪建议序 - docs/fig-specs-size-report.md:全量分布/单 spec 上限 300KB→500KB 上调 依据/裁剪规则与建议序/skipped 清单/幂等说明(批次 2 D2' 决策输入)。 - docs/COMPLETION.zh-CN.md:spec 导入一节随 import-fig-specs.mjs 删除改写 为退役说明,指向 vendored parser 新架构。
…-wave1-integration
…异常跳过,icon 等无通道字段仅接受不透传
…目标机执行/前缀过滤/缺省 postProcess 适配
…ipt 槽位产出,字符串/函数 script 与 template 不产槽位,冻结 resolve 同步面零变化
…equestId+revision+sessionId 三重 guard 丢弃在途 generator 结果
…g 态 Tab 放行)、engineHint 更新与 loading 文案七语
- engineRunner.ts:FigCompletionSource 的运行层。feature-detect(无 Worker 全局或 inline worker 构造 throw,如 CSP 拦 data-URL)→ 主线程直跑,调用方 无感;worker 模式把 resolve 代理成 postMessage 往返,运行时返回 thenable, 由 CompletionController 既有 thenable 防御分支(Worker 化留位)按 requestId/revision/sessionId 三重 guard 交付,runner 侧无需额外排队 - 崩溃恢复(方案 §44):worker error/messageerror → 丢弃在途(以 null 结清 = pass-through)→ 重启一次;再失败 → 永久降级主线程;事件带代际校验, 旧 worker 迟到回执一律忽略 - engine.worker.ts:真实 figCompletionSource 构造迁入 worker(manifest + vendored parser),postMessage 协议 resolve/response;任何异常回 response:null,worker 内绝不死;消息处理纯函数化(createWorkerMessageHandler) 供单测直驱;Node 导入安全(无 self 跳过接线) - build.mjs:rolldown 弃用项 inlineDynamicImports:true 迁移为等价的 codeSplitting:false;单文件断言全过、产物结构与哈希不变 - 测试(vitest 全 Fake、零联网):fallback 同步路径、协议序列化往返 (FakeWorker)、error/messageerror→重启→再败→永久降级、构造 throw→直接 主线程、postMessage 抛错按崩溃处理、迟到回执忽略、worker 内异常→pass-through - 门禁:pnpm --dir frontend typecheck / test(133 文件 1364 用例)/ build 全绿; 临时接线实验(已还原)证实接入后仍为双资产+单 html、零额外 chunk
…模),collect 通道直引单例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
按
docs/FIG_AUTOCOMPLETE_INTEGRATION_PLAN.zh-CN.md实施的补全引擎最终架构:vendored amazon-q autocomplete parser(pin 5c621df6,上游已删除该引擎,快照即最终形态)+ withfig/autocomplete 语料(pin aef52acf,确定性 allowlist 724 specs/4.99MB)+ CompletionHost RPC(completion/execute 目标机执行)+ worker/主线程双模引擎 + legacy lib/completions 退役。分支链(全部已推送,供逐段 review)
门禁证据(集成 HEAD 实测)
smoke_completion.py:9/9(docker sshd 实测:local 超时竞速/截断、ssh 转义/只读拒绝)fig:verify:724 specs / 4.99MB ≤ 预算;fig:sync 幂等(845 文件哈希一致)ui/index.html= 11.76MB(语料在主 bundle 与 worker 载荷双份)。必须先落批次 2-3 裁剪:allowlist 收敛到 MOST_USED_SPECS 重跑 fig:sync,Top-N 数值待拍板。需人工 review / 验收
completion/execute属新增命令执行面(agent-flow: human_review_required)——backend/src/completion/** + PROTOCOL 增补 + smoke 为评审材料worker-src blob:;git ch/co 、kubectl get -o ;无命中 Tab 透传;worker 崩溃注入(1 次重启/2 次永久主线程);设置三态文档
docs/{FIG_ROADMAP, FIG_WAVE1_CONTRACT, FIG_VERIFICATION, FIG_ADJUDICATIONS, WAVE1_LANE_*}.zh-CN.md、docs/fig-specs-size-report.md
Follow-up
批次 2-3 体积定版;批次 3:custom JS generator facade、WSL executor、per-request 超时、generator trigger 过滤、versioned spec diff 合并