Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 配对
Expand Down
54 changes: 28 additions & 26 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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! ()
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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 $ []
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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 $ {}
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion deps.cirru
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading