From ab08cf9fce7c3d13ebc76c6eb4e0c3f9c682f05c Mon Sep 17 00:00:00 2001 From: tiye Date: Sat, 14 Nov 2026 14:39:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E5=B7=B2=E9=AA=8C=E8=AF=81=E7=9A=84=20Gen=20Code=20=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calcit.cirru | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/calcit.cirru b/calcit.cirru index 6dc56ab..220c0f6 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -759,9 +759,12 @@ :schema $ quote $ Fn GenCodeOp (-> AnyEnum) (:open :reflect) 'read-draft $ %{} 'CodeEntry (:doc |) :code $ quote $ defn read-draft (raw) - decode-map-as - if (struct? raw) (&struct:to-map raw) raw - , 'gen-code.schema/GenCodeState + if + and (struct? raw) (&struct:matches? raw GenCodeState) + assert-type raw GenCodeState + decode-map-as + if (struct? raw) (&struct:to-map raw) raw + , GenCodeState :examples $ [] :schema $ quote $ Fn Input (-> GenCodeState) (:generics Input) 'read-open-field-or $ %{} 'CodeEntry From 224211055075148b307815fdb090ec65f0077858 Mon Sep 17 00:00:00 2001 From: tiye Date: Sat, 14 Nov 2026 14:41:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=9D=E7=95=99=20Gen=20Code=20=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=E4=BA=8B=E4=BB=B6=E7=9A=84=E5=85=B7=E5=90=8D=E8=BD=BD?= =?UTF-8?q?=E8=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calcit.cirru | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/calcit.cirru b/calcit.cirru index 220c0f6..daab251 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -693,7 +693,10 @@ (:states cursor state) Some $ GenCodeOp :states decode-map-as cursor $ List respo.schema/CoordKey - decode-map-as state 'gen-code.schema/GenCodeDraftValue + if + and (struct? state) (&struct:matches? state GenCodeState) + assert-type state GenCodeState + decode-map-as state GenCodeDraftValue (:states-merge cursor state changes) if and (struct? state) (&struct:matches? state GenCodeState) @@ -714,6 +717,18 @@ -> $ Option GenCodeOp :generics Input :tests $ [] + %{} 'TestEntry (:name |keeps-nominal-and-legacy-draft-operations) + :code $ quote $ let + draft $ GenCodeState :query |draft :answer | :code | :loading? false :done? false + fields $ {} (:query |draft) (:loading? false) + assert= + Some $ GenCodeOp :states ([] :draft) draft + decode-gen-code-op $ :: :states ([] :draft) draft + assert= + Some $ GenCodeOp :states ([] :draft) fields + decode-gen-code-op $ :: :states ([] :draft) fields + assert= None $ decode-gen-code-op $ :: :states ([] :draft) + {} $ :query 7 %{} 'TestEntry (:name |decodes-hydration) :code $ quote $ assert= Some $ GenCodeOp :hydrate-storage store From 44c242f674c0dd86eb9ca09706624776778a2195 Mon Sep 17 00:00:00 2001 From: tiye Date: Sat, 14 Nov 2026 14:42:52 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20JS=20=E5=AE=BF?= =?UTF-8?q?=E4=B8=BB=E7=B1=BB=E5=9E=8B=E7=BA=A6=E6=9D=9F=20GenAI=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- calcit.cirru | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calcit.cirru b/calcit.cirru index daab251..e4be177 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -278,7 +278,7 @@ reset! *ai-chat $ Some $ let model $ pick-model variant doc-content $ str (include-file! |declare-task.md) sep (include-file! |format-guide.md) sep (include-file! |calcit-lang.md) sep $ include-file! |respo.md - ai $ unsafe-coerce + ai $ js-cast new GoogleGenAI $ js-object $ :apiKey (get-gemini-key!) , GenAIClientHost js-cast