From cb1bc044b72336cb938ac096e5d66be9be00216b Mon Sep 17 00:00:00 2001 From: tiye Date: Thu, 12 Nov 2026 17:12:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8D=87=E7=BA=A7=20Gen=20Code=20=E5=88=B0?= =?UTF-8?q?=20Calcit=200.42.1=20=E5=B9=B6=E6=94=B6=E7=B4=A7=E5=AD=98?= =?UTF-8?q?=E6=A1=A3=E6=81=A2=E5=A4=8D=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload.yaml | 2 +- README.md | 4 +-- calcit.cirru | 54 ++++++++++++++++++----------------- deps.cirru | 2 +- package.json | 2 +- 5 files changed, 33 insertions(+), 31 deletions(-) diff --git a/.github/workflows/upload.yaml b/.github/workflows/upload.yaml index 627de24..b2568e9 100644 --- a/.github/workflows/upload.yaml +++ b/.github/workflows/upload.yaml @@ -64,7 +64,7 @@ jobs: calcit calcit.cirru analyze weak-types --only coverage --coverage-level none,partial --format json | jq -e 'all(.data.definitions[]; .coverage == "partial" and - (.id == "gen-code.schema/normalize-store-data" or .id == "gen-code.schema/read-open-field-or"))' + .id == "gen-code.schema/read-open-field-or")' calcit calcit.cirru analyze weak-types --format json | jq -e ' .data.summary.kinds as $k | diff --git a/README.md b/README.md index a8bba83..428bd70 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Demo: https://repo.calcit-lang.org/gen-code/ ## 0.0.26 候选 -使用者需统一 Calcit CLI 和 `@calcit/procs` **0.42.0**,配对正式 +使用者需统一 Calcit CLI 和 `@calcit/procs` **0.42.1**,配对正式 UI **0.15.2**、Respo **0.19.5**、JS-FFI **0.2.13** 和传递依赖 Router **0.12.2**, 然后重新生成 JS。插件继续接收单事件派发,代码生成请求与存档行为沿用原合同。 Reel **0.11.0** 是 Demo 的开发依赖。Demo 将插件事件解码为具名 `GenCodeOp`,快捷键与面板通过独立回调接收 `Control`。流式补丁通过 `GenCodeFieldValue` union 约束为字符串或布尔值,Editor 等宿主的插件回调继续接收单个原格式操作。 内部 `call-genai-msg!` 只向回调交付补丁 Map。插件在派发边界补齐 cursor 和请求状态,生成原格式的 `:states-merge` 事件。 Meta+Enter 直接读取 Respo 提供的类型化键盘字段,快捷键条件与派发协议不变。 -质量检查使用 0.42.0 的 coverage、弱类型和弃用视图,继续限制两处既有 SDK 强转。 +质量检查使用 0.42.1 的 coverage、弱类型和弃用视图,继续限制两处既有 SDK 强转。 验收覆盖完整 strict、原测试、离线快捷键与流式回归和构建。 ## 历史 0.0.22 配对 diff --git a/calcit.cirru b/calcit.cirru index 6f746b4..001bdff 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -40,6 +40,7 @@ :schema $ quote $ Fn (reel.typed/State schema/GenCodeOp gen-code.types/StoreData) Fn reel.typed/Control $ -> Unit -> respo.schema/Component + :features :io :state :ns $ %{} 'NsEntry (:doc |) :code $ quote $ ns gen-code.comp.container :require (respo-ui.css :as css) @@ -214,7 +215,7 @@ Fn (Map Tag schema/GenCodeFieldValue) (-> Unit) Ref String -> Unit - :features :js-ffi + :features :io :js-ffi :state :async 'get-gemini-key! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn get-gemini-key! () @@ -266,7 +267,7 @@ , GenAIChatHost , &unit :examples $ [] - :schema $ quote $ Fn Tag (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn Tag (-> Unit) (:features :io :js-ffi :state) 'new-abort-controller! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn new-abort-controller! () js-cast (new js/AbortController) AbortControllerHost @@ -292,7 +293,7 @@ :examples $ [] :schema $ quote $ Fn GenAIChatHost String AbortControllerHost -> $ JsNullish JsObject - :features :js-ffi + :features :io :js-ffi 'send-genai-stream! $ %{} 'CodeEntry :doc "|Keep the Gemini SDK method call and browser abort signal in one typed JS adapter." :code $ quote $ defn send-genai-stream! (chat prompt-text) @@ -304,7 +305,7 @@ if (js-nullish? pending) (raise "|GenAI stream response is nullish") js-cast (js-await pending) GenAIStreamHost :examples $ [] - :schema $ quote $ Fn GenAIChatHost String (-> GenAIStreamHost) (:features :js-ffi) (:async) + :schema $ quote $ Fn GenAIChatHost String (-> GenAIStreamHost) (:features :io :js-ffi :state) (:async) 'sep $ %{} 'CodeEntry (:doc |) :code $ quote $ def sep (str &newline &newline |----------- &newline &newline) :examples $ [] @@ -334,7 +335,7 @@ -> Unit -> GenCodePluginData :generics StatesInput - :features :js-ffi + :features :io :js-ffi :state :open :host 'use-gen-code-with-dispatch $ %{} 'CodeEntry (:doc |) :code $ quote $ defn use-gen-code-with-dispatch (states get-hint-code on-submit encode-op) @@ -497,7 +498,7 @@ Fn schema/GenCodeOp $ -> HostOp -> GenCodePluginData :generics StatesInput HostOp - :features :js-ffi + :features :io :js-ffi :state :open :host :ns $ %{} 'NsEntry (:doc |) :code $ quote $ ns gen-code.core @@ -531,7 +532,7 @@ :timestamp $ host/date-now-snapshot , &unit :examples $ [] - :schema $ quote $ Fn schema/GenCodeOp (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn schema/GenCodeOp (-> Unit) (:features :io :js-ffi :state) 'main! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn main! () println "|Running mode:" $ if config/dev? |dev |release @@ -558,7 +559,7 @@ js/setInterval persist-storage! 60000 println "|App started." :examples $ [] - :schema $ quote $ Fn (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn (-> Unit) (:features :io :js-ffi :state) 'mount-target $ %{} 'CodeEntry (:doc |) :code $ quote $ def mount-target .unwrap $ dom/query-selector |.app @@ -569,7 +570,7 @@ reset! *reel $ typed/apply-control updater @*reel control , &unit :examples $ [] - :schema $ quote $ Fn typed/Control (-> Unit) + :schema $ quote $ Fn typed/Control (-> Unit) (:features :io :state) 'persist-storage! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn persist-storage! () println "|Saved at" $ :iso $ host/date-now-snapshot @@ -578,7 +579,7 @@ format-cirru-edn $ :store @*reel , &unit :examples $ [] - :schema $ quote $ Fn (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn (-> Unit) (:features :io :js-ffi :state) 'reload! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn reload! () if (nil? build-errors) @@ -591,14 +592,14 @@ hud! |error build-errors , &unit :examples $ [] - :schema $ quote $ Fn (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn (-> Unit) (:features :io :js-ffi :state) 'render-app! $ %{} 'CodeEntry (:doc |) :code $ quote $ defn render-app! () render-with! mount-target fn () $ comp-container @*reel on-control! , dispatch! :examples $ [] - :schema $ quote $ Fn (-> Unit) (:features :js-ffi) + :schema $ quote $ Fn (-> Unit) (:features :io :js-ffi :state) :ns $ %{} 'NsEntry (:doc |) :code $ quote $ ns gen-code.main :require @@ -703,21 +704,22 @@ decode-gen-code-op $ :: :hydrate-storage $ {} 'normalize-store-data $ %{} 'CodeEntry (:doc |) :code $ quote $ defn normalize-store-data (data) - hint-fn $ Fn Dynamic $ -> gen-code.types/StoreData - if (struct? data) - if (&struct:matches? data gen-code.types/StoreData) (assert-type data 'gen-code.types/StoreData) - if - = (&struct:get-name data) :StoreData - normalize-store-data $ &struct:to-map data + if + and (struct? data) (&struct:matches? data gen-code.types/StoreData) + assert-type data gen-code.types/StoreData + let + candidate $ if + and (struct? data) + = (&struct:get-name data) :StoreData + &struct:to-map data + , data + if (map? candidate) + let + states $ read-open-field-or candidate :states $ {} + if (map? states) (gen-code.types/StoreData :states states) store , store - if (map? data) - let - empty-map $ {} - states $ read-open-field-or data :states empty-map - if (map? states) (gen-code.types/StoreData :states states) store - , store :examples $ [] - :schema $ quote $ Fn Dynamic (-> gen-code.types/StoreData) (:features :js-ffi) + :schema $ quote $ Fn Input (-> gen-code.types/StoreData) (:generics Input) (:features :js-ffi) :tests $ [] $ %{} 'TestEntry (:name |legacy-and-nominal-hydration) :code $ quote $ let empty-map $ {} @@ -847,7 +849,7 @@ (:hydrate-storage data) data _ $ do (eprintln "|unknown op:" op) store :examples $ [] - :schema $ quote $ Fn gen-code.types/StoreData gen-code.schema/GenCodeOp String Number (-> gen-code.types/StoreData) + :schema $ quote $ Fn gen-code.types/StoreData gen-code.schema/GenCodeOp String Number (-> gen-code.types/StoreData) (:features :io) :ns $ %{} 'NsEntry (:doc |) :code $ quote $ ns gen-code.updater :require $ respo.cursor :refer $ update-state-tree update-state-tree-merge diff --git a/deps.cirru b/deps.cirru index 479b7a7..9f7798c 100644 --- a/deps.cirru +++ b/deps.cirru @@ -1,5 +1,5 @@ -{} (:calcit-version |0.42.0) +{} (:calcit-version |0.42.1) :version |0.0.26 :dependencies $ {} |Respo/respo-ui.calcit |0.15.2 diff --git a/package.json b/package.json index 1377e45..0aa42c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@calcit/procs": "0.42.0", + "@calcit/procs": "0.42.1", "@cirru/writer.ts": "^0.1.7", "@google/genai": "^1.4.0", "cirru-color": "^0.2.4", From 3776a0a6cc7b233bba8d0d1151c970af9e28d14f Mon Sep 17 00:00:00 2001 From: tiye Date: Thu, 12 Nov 2026 17:17:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=94=81=E5=AE=9A=E6=AD=A3=E5=BC=8F=20@cal?= =?UTF-8?q?cit/procs=200.42.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 57cb08a..fb27632 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,15 +12,15 @@ __metadata: languageName: node linkType: hard -"@calcit/procs@npm:0.42.0": - version: 0.42.0 - resolution: "@calcit/procs@npm:0.42.0" +"@calcit/procs@npm:0.42.1": + version: 0.42.1 + resolution: "@calcit/procs@npm:0.42.1" dependencies: "@calcit/finger-vec": "npm:0.1.1" "@calcit/ternary-tree": "npm:0.0.26" "@cirru/parser.ts": "npm:0.0.10" "@cirru/writer.ts": "npm:^0.1.9" - checksum: 10c0/195f6d27a1fc24a1b72b8fbafc02d64eb6cee9f3729e893564e9acd33c2ecff742d56b1a0a5f3a4573403724668afe81c8ac4331eb18bbec99b45e72bdeaf407 + checksum: 10c0/58e306e7bc72b258e07c33dae4d543241cd0c7ed6830262628bf61c734453d7907ef453af0b25a770ba911e9ce6ede19f869d9a78decea4589cf4ae1f7c40629 languageName: node linkType: hard @@ -1146,7 +1146,7 @@ __metadata: version: 0.0.0-use.local resolution: "root-workspace-0b6124@workspace:." dependencies: - "@calcit/procs": "npm:0.42.0" + "@calcit/procs": "npm:0.42.1" "@cirru/writer.ts": "npm:^0.1.7" "@google/genai": "npm:^1.4.0" bottom-tip: "npm:^0.1.5"