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
4 changes: 2 additions & 2 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- uses: calcit-lang/setup-calcit@v1.5.0
with:
tools: calcit,caps
caps-version: "0.1.1"
caps-version: "0.1.2"
deps-file: deps.cirru

- name: Resolve Calcit dependencies
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:

- name: Upload and verify web assets on COS
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: worktools/cos-upload-action@v1.2.0
uses: worktools/cos-upload-action@v1.3.0
with:
source-dir: dist
bucket: ${{ secrets.COS_BUCKET }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Demo:<https://r.tiye.me/Termina/msg-buffer/>。Gemini 文档:<https://ai.goo

## 对使用者的影响

本地开发使用正式 Calcit 和 `@calcit/procs` **0.47.1**。升级后请重装依赖,分别重建网页与扩展资源,并刷新。页面 HUD、模型名称、请求配置和存档格式保持原行为。
本地开发使用正式 Calcit 和 `@calcit/procs` **0.53.0**。升级后请重装依赖,分别重建网页与扩展资源,并刷新。页面 HUD、模型名称、请求配置和存档格式保持原行为。

模块使用已发布的 Respo 0.20.1、UI 0.16.7、JS FFI 0.2.26、Reel 0.11.11、Alerts 0.14.13、Markdown 0.9.11 和 Router 0.12.19。
模块使用已发布的 Respo 0.20.5、UI 0.16.11、JS FFI 0.2.31、Reel 0.11.16、Alerts 0.14.17、Markdown 0.9.14 和 Router 0.12.23。

## 迁移合同

Expand All @@ -26,7 +26,7 @@ SDK 响应、可空 DOM 和 object URL 保留原受检边界及清理行为。

## 开发和验证

使用 Node.js 24、Yarn 4.18.0、Calcit 0.47.1,文件为 `calcit.cirru`、`deps.cirru`。
使用 Node.js 24、Yarn 4.18.0、Calcit 0.53.0,文件为 `calcit.cirru`、`deps.cirru`。

```sh
caps --strict --ci
Expand Down
92 changes: 43 additions & 49 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,7 @@
normalize-chat-state raw-chat-state
done? $ :done? state
messages $ :messages state
model $ if
tag? $ :model state
:model state
, :gemini
model $ :model state
is-viewing-history? $ match current-session-id
(:none) false
(:some id)
Expand Down Expand Up @@ -620,22 +617,9 @@
, &unit
submit-message! cursor submit-state text search? think? model d!
, &unit
message-box-state $ let
raw-message-box-state $ .unwrap-or
&map:get (>> states :message-box) :data
{} (:content |) (:search? false) (:think? false) (:focus-mode? false)
if
and (struct? raw-message-box-state) (&struct:matches? raw-message-box-state MessageBoxState)
struct-match raw-message-box-state (MessageBoxState typed typed)
_ other $ raise "|Expected MessageBoxState"
decode-map-as
if (struct? raw-message-box-state)
if
= (&struct:get-name raw-message-box-state) :MessageBoxState
&struct:to-map raw-message-box-state
raise "|Expected MessageBoxState"
, raw-message-box-state
, 'app.schema/MessageBoxState
message-box-state $ decode-message-box-state $ .unwrap-or
&map:get (>> states :message-box) :data
{} (:content |) (:search? false) (:think? false) (:focus-mode? false)
sessions-plugin $ use-drawer (>> states :sessions-modal)
{} (:title "|History Sessions")
:style $ {} (:min-width "||max(320px,30vw)\"") (:max-width |80vw)
Expand Down Expand Up @@ -672,7 +656,8 @@
raw $ let
host-value $ js-await $ db-get archive-key
if
or (nil? host-value)
or
.none? $ nil->option host-value
= (js/typeof host-value) |undefined
, | $ contract/expect-string "|Archive storage value" host-value
if (blank? raw) (js/alert "|No archives found!")
Expand Down Expand Up @@ -1000,20 +985,8 @@
(:none) ([])
state $ match (get states :data)
(:none)
%{} MessageBoxState (:content |) (:search? false) (:think? false) (:focus-mode? false)
(:some raw-message-box-state)
if
and (struct? raw-message-box-state) (&struct:matches? raw-message-box-state MessageBoxState)
struct-match raw-message-box-state (MessageBoxState typed typed)
_ other $ raise "|Expected MessageBoxState"
decode-map-as
if (struct? raw-message-box-state)
if
= (&struct:get-name raw-message-box-state) :MessageBoxState
&struct:to-map raw-message-box-state
raise "|Expected MessageBoxState"
, raw-message-box-state
, 'app.schema/MessageBoxState
MessageBoxState :content | :search? false :think? false :focus-mode? false
(:some raw-message-box-state) (decode-message-box-state raw-message-box-state)
[] (effect-focus) (on-fill cursor state on-submit)
div
{} $ :class-name $ str-spaced css/center style-message-box-panel
Expand Down Expand Up @@ -1240,7 +1213,8 @@
raw $ let
host-value $ js-await $ db-get archive-key
if
or (nil? host-value)
or
.none? $ nil->option host-value
= (js/typeof host-value) |undefined
, | $ contract/expect-string "|Archive storage value" host-value
old-archives $ if (blank? raw) (take sessions 0)
Expand Down Expand Up @@ -1293,7 +1267,9 @@
parts0 $ if (js-present-dynamic? content0) (contract/object-field "|GenAI stream" content0 |parts) js/undefined
part0 $ if (js-present-dynamic? parts0) (contract/object-field "|GenAI stream" parts0 |0) js/undefined
thought0 $ if (js-present-dynamic? part0) (contract/object-field "|GenAI stream" part0 |thought) js/undefined
thinking? $ if (bool? thought0) (contract/expect-bool "|GenAI thought" thought0) false
thinking? $ match (try-decode-map-as thought0 Bool)
(:ok value) value
(:err _) false
part-text $ if (js-present-dynamic? part0) (contract/object-field "|GenAI stream" part0 |text) js/undefined
chunk-text $ contract/object-field "|GenAI stream" chunk-data |text
primary-text $ if (js-present-dynamic? part-text) part-text chunk-text
Expand All @@ -1310,6 +1286,22 @@
assert= |blocked $ :text decoded
assert= false $ :thinking? decoded
:schema $ quote $ Fn T (-> StreamChunk) (:generics T) (:features :js-ffi)
'decode-message-box-state $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn decode-message-box-state (raw-message-box-state)
if
and (struct? raw-message-box-state) (&struct:matches? raw-message-box-state MessageBoxState)
struct-match raw-message-box-state (MessageBoxState typed typed)
_ other $ raise "|Expected MessageBoxState"
decode-map-as
if (struct? raw-message-box-state)
if
= (&struct:get-name raw-message-box-state) :MessageBoxState
&struct:to-map raw-message-box-state
raise "|Expected MessageBoxState"
, raw-message-box-state
, 'app.schema/MessageBoxState
:examples $ []
:schema $ quote $ Fn Input (-> MessageBoxState) (:generics Input) (:open :decode)
'download-sessions! $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn download-sessions! (sessions)
let
Expand Down Expand Up @@ -1570,7 +1562,7 @@
if (tag? model-value) model-value :gemini
, :thinking $ stream-text $ .unwrap-or (get data :thinking) |
:examples $ []
:schema $ quote $ Fn T (-> ChatState) (:generics T) (:features :js-ffi)
:schema $ quote $ Fn T (-> ChatState) (:generics T) (:features :js-ffi) (:open :decode)
:tests $ [] $ %{} 'TestEntry (:name |legacy-nil-fields)
:code $ quote $ let
legacy $ normalize-chat-state $ {} (:answer nil) (:loading? false) (:done? true)
Expand Down Expand Up @@ -1685,7 +1677,9 @@
:schema $ quote $ Fn Store ChatState (-> Store)
'stream-text $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn stream-text (value)
if (string? value) value |
match (try-decode-map-as value String)
(:ok text) text
(:err _) |
:examples $ []
:schema $ quote $ Fn T (-> String) (:generics T) (:features :js-ffi)
:tests $ []
Expand Down Expand Up @@ -2276,7 +2270,7 @@
js/window.addEventListener |dblclick $ fn (event) (.!preventDefault event)
js/window.addEventListener |wheel
fn (event)
if
when
contract/expect-bool |ctrlKey $ js/Boolean $ .-ctrlKey event
.!preventDefault event
js-object $ :passive false
Expand All @@ -2288,7 +2282,7 @@
visibility-state $ .unwrap-or
js-nullish->option $ .-visibilityState document
, |
if (= |hidden visibility-state) (persist-storage!)
when (= |hidden visibility-state) (persist-storage!)
, &unit
if config/chrome-extension? $ listen-extension!
sync-gemini-key!
Expand Down Expand Up @@ -2320,7 +2314,7 @@
, data
_ $ do (eprintln "|unknown op:" raw) (schema/DispatchOp :unhandled)
:examples $ []
:schema $ quote $ Fn Input (-> schema/DispatchOp) (:generics Input) (:features :io)
:schema $ quote $ Fn Input (-> schema/DispatchOp) (:generics Input) (:features :io) (:open :decode)
'on-control! $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn on-control! (control) (dispatch! control)
:examples $ []
Expand Down Expand Up @@ -2488,7 +2482,7 @@
assert= store $ normalize-store empty-wire
'normalize-chat-message $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn normalize-chat-message (raw)
hint-fn $ Fn T (-> ChatMessage) (:generics T) (:features :js-ffi)
hint-fn $ Fn T (-> ChatMessage) (:generics T) (:features :js-ffi) (:open :decode)
if
and (struct? raw) (&struct:matches? raw ChatMessage)
struct-match raw
Expand All @@ -2513,10 +2507,10 @@
decode-map-as (assoc data :thinking normalized-thinking) 'app.schema/ChatMessage
raise "|Expected chat message map"
:examples $ []
:schema $ quote $ Fn T (-> ChatMessage) (:generics T) (:features :js-ffi)
:schema $ quote $ Fn T (-> ChatMessage) (:generics T) (:features :js-ffi) (:open :decode)
'normalize-chat-session $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn normalize-chat-session (raw)
hint-fn $ Fn T (-> ChatSession) (:generics T) (:features :js-ffi)
hint-fn $ Fn T (-> ChatSession) (:generics T) (:features :js-ffi) (:open :decode)
if
and (struct? raw) (&struct:matches? raw ChatSession)
struct-match raw
Expand Down Expand Up @@ -2550,7 +2544,7 @@
ChatSession :id (:id base) :created-at (:created-at base) :messages messages :model (:model base) :preview (:preview base) :is-history? $ :is-history? base
raise "|Expected chat session map"
:examples $ []
:schema $ quote $ Fn T (-> ChatSession) (:generics T) (:features :js-ffi)
:schema $ quote $ Fn T (-> ChatSession) (:generics T) (:features :js-ffi) (:open :decode)
:tests $ [] $ %{} 'TestEntry (:name |accepts-typed-and-map)
:code $ quote $ let
typed $ ChatSession :id |typed :created-at 1 :messages ([]) :model :gemini :preview |Typed :is-history? true
Expand All @@ -2566,7 +2560,7 @@
:tags $ #{} :regression :unit
'normalize-store $ %{} 'CodeEntry (:doc |)
:code $ quote $ defn normalize-store (raw)
hint-fn $ Fn T (-> Store) (:generics T) (:features :js-ffi)
hint-fn $ Fn T (-> Store) (:generics T) (:features :js-ffi) (:open :decode)
if
and (struct? raw)
match (struct-definition raw)
Expand Down Expand Up @@ -2615,7 +2609,7 @@
true None
decode-map-as patched 'app.schema/Store
:examples $ []
:schema $ quote $ Fn T (-> Store) (:generics T) (:features :js-ffi)
:schema $ quote $ Fn T (-> Store) (:generics T) (:features :js-ffi) (:open :decode)
:tests $ []
%{} 'TestEntry (:name |migrates-legacy-message-thinking)
:code $ quote $ let
Expand Down Expand Up @@ -2783,7 +2777,7 @@
assoc :current-session-id None
_ store
:examples $ []
:schema $ quote $ Fn Store app.schema/DispatchOp String Number (-> Store)
:schema $ quote $ Fn Store app.schema/DispatchOp String Number (-> Store) (:open :decode)
:tests $ [] $ %{} 'TestEntry (:name |mixed-cursor-latest-state-merge)
:code $ quote $ let
cursor $ [] :panel |draft 7
Expand Down
14 changes: 7 additions & 7 deletions deps.cirru
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

{} (:calcit-version |0.47.1)
{} (:calcit-version |0.53.0)
:version |0.0.10
:dependencies $ {} (|Respo/alerts.calcit |0.14.13)
|Respo/reel.calcit |0.11.11
|Respo/respo-markdown.calcit |0.9.11
|Respo/respo-ui.calcit |0.16.7
|Respo/respo.calcit |0.20.1
|calcit-lang/js-ffi |0.2.26
:dependencies $ {} (|Respo/alerts.calcit |0.14.17)
|Respo/reel.calcit |0.11.16
|Respo/respo-markdown.calcit |0.9.14
|Respo/respo-ui.calcit |0.16.11
|Respo/respo.calcit |0.20.5
|calcit-lang/js-ffi |0.2.31
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.47.1",
"@calcit/procs": "0.53.0",
"@google/genai": "2.23.0",
"@tiye/main-fonts": "0.0.1",
"axios": "1.20.0",
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.