@calcit/procs 0.13.58 → 0.13.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -0,0 +1,19 @@
1
+ # Async queue byte budget and terminal reserve
2
+
3
+ ## 中文
4
+
5
+ - native async queue 现在可同时限制事件数和累计 payload bytes,避免大量合法但体积较大的事件在 1024 个 event slots 内消耗过多内存。
6
+ - CLI runtime 使用 64 MiB 总字节预算,并为 `Complete`/`Fail` 预留 16 个 event slots 和 64 KiB;普通 Stream/Server emit 不能侵占这些预留资源。
7
+ - event admission 成功后才分配 sequence;event/byte budget 失败都返回稳定的 `QUEUE_FULL`,不会误占 terminal 或 sequence。
8
+ - coalescing 在字节压力下也能替换同一 Stream 的旧 emit,并精确维护 queued-byte accounting;drain/purge 同样回收字节账本。
9
+ - `--trace-ffi` 的 enqueue accepted/rejected 事件现在包含当前 queued events/bytes,便于定位 slow host 或 producer pressure。
10
+ - 修复 async protocol 文档仍描述 legacy Rust callback fallback 的过时内容。
11
+
12
+ ## English
13
+
14
+ - The native async queue can now bound both event count and aggregate payload bytes, preventing a queue of individually valid events from consuming excessive memory.
15
+ - The CLI runtime uses a 64 MiB byte budget and reserves 16 event slots plus 64 KiB for `Complete`/`Fail`; ordinary Stream/Server emits cannot consume those reserves.
16
+ - Event sequences are allocated only after admission. Event-count and byte-budget failures both map to stable `QUEUE_FULL` without claiming a sequence or terminal event.
17
+ - Coalescing can replace an older Stream emit under byte pressure while keeping queued-byte accounting exact; drain and purge release the same accounting.
18
+ - Accepted and rejected `--trace-ffi` enqueue events now include current queued event/byte counters for diagnosing slow hosts and producer pressure.
19
+ - Removed stale async protocol documentation that still described the deleted legacy Rust callback fallback.
@@ -0,0 +1,17 @@
1
+ # 接入异步 runtime 关闭 / Wire async runtime shutdown
2
+
3
+ ## 中文
4
+
5
+ - Calcit CLI 统一安装 Ctrl-C handler,信号线程只设置原子状态,`on-control-c` 回调改由 host thread 串行执行。
6
+ - 调用 async registry `begin_shutdown`,拒绝未完成 response,调用模块 cancel hook,并给 terminal event 保留 2 秒 grace period。
7
+ - grace period 结束后先关闭 host queue,再按 module/method/task/kind/age 输出诊断并强制 purge/release,避免迟到 producer 竞态。
8
+ - Watch loop 与兼容性 `async-sleep` 共享可唤醒的 shutdown signal,避免 Ctrl-C 后长时间挂起。
9
+ - 添加 response rejection、cancel invocation、grace timeout 强制清理测试,并使用真实 fswatch C-safe Stream 验证 cancel→Complete→release,无强制清理。
10
+
11
+ ## English
12
+
13
+ - Install one CLI-owned Ctrl-C handler; the signal thread only updates atomic state, while `on-control-c` callbacks run serially on the host thread.
14
+ - Invoke async-registry `begin_shutdown`, reject open responses, call module cancel hooks, and retain a two-second grace period for terminal events.
15
+ - After the deadline, close the host queue first, then diagnose unfinished tasks by module/method/task/kind/age and force purge/release them without a late-producer race.
16
+ - Let watch loops and compatibility `async-sleep` share a wakeable shutdown signal so Ctrl-C cannot leave the process hanging.
17
+ - Cover response rejection, cancel invocation, and forced cleanup after grace, plus a real fswatch C-safe Stream cancel→Complete→release smoke with no forced cleanup.
@@ -0,0 +1,13 @@
1
+ # 避免 shutdown 重复取消 / Avoid duplicate shutdown cancellation
2
+
3
+ ## 中文
4
+
5
+ - 在 `begin_shutdown` 之前保留 lifecycle snapshot,只向原先处于 `Active` 的 task 调用 cancel hook。
6
+ - 如果 `on-control-c` 或业务逻辑已经把 task 转为 `Closing`,全局 shutdown 只等待 terminal,不会重复调用模块取消。
7
+ - 测试断言已在 Closing 的 task 取消次数保持为零,同时继续受 grace timeout 和强制清理保护。
8
+
9
+ ## English
10
+
11
+ - Preserve the lifecycle snapshot before `begin_shutdown` and invoke cancel hooks only for tasks that were originally `Active`.
12
+ - If `on-control-c` or application logic already moved a task to `Closing`, global shutdown waits for its terminal acknowledgement without calling module cancellation twice.
13
+ - Assert that an already-closing task receives zero additional cancel calls while remaining protected by the grace timeout and forced cleanup.
@@ -0,0 +1,15 @@
1
+ # 完善关闭中断路径 / Complete shutdown interruption paths
2
+
3
+ ## 中文
4
+
5
+ - 按 condvar 谓词协议在持有 wake mutex 时记录 shutdown 并通知,消除检查状态与进入等待之间的丢失唤醒窗口。
6
+ - Native evaluator 低频检查 shutdown 请求,覆盖普通求值与尾递归执行;`on-control-c` 回调在 host thread 运行时临时暂停该检查。
7
+ - Watch 在收到文件事件后重新检查关闭状态;reload 与 codegen 在阶段之间检查,且无 timeout 的 codegen 也由可中断的 worker 执行。
8
+ - Once-mode 运行出错或被中断后不再提前跳过 async runtime 清理,而是先完成有界取消与回收,再返回原始错误。
9
+
10
+ ## English
11
+
12
+ - Record shutdown and notify while holding the condition-variable predicate mutex, closing the lost-wakeup window between checking state and waiting.
13
+ - Poll shutdown cheaply during native evaluation, including tail recursion, while temporarily suppressing interruption for the host-thread `on-control-c` callback.
14
+ - Recheck shutdown after watch events and between reload/codegen phases; timeout-free codegen now also runs behind an interruptible worker boundary.
15
+ - Once-mode failures and interruptions no longer bypass async-runtime cleanup: bounded cancellation and reclamation finish before the original error returns.
@@ -0,0 +1,19 @@
1
+ # 异步 task 队列指标 / Async task queue metrics
2
+
3
+ ## 中文
4
+
5
+ - 在 async queue 同一把 mutex 下维护有界的 per-task 固定元数据索引,覆盖 queued events、queued bytes、oldest age、accepted、coalesced、queue-full、dequeued 与 purged。
6
+ - Enqueue、coalescing、drain 与 purge 的新增指标工作只更新目标 task,不扫描全 registry,也不复制业务 payload;coalescing 延续队列原有的有界定位逻辑。
7
+ - `--trace-ffi` 在 enqueue/reject/cancel/release 展示 task-local 指标;shutdown 额外按 module/method 汇总 active/closing tasks 与 backlog。
8
+ - Task release 时删除指标状态;forced cleanup 诊断保留最终 backlog 与累计值。
9
+ - 单元测试覆盖 coalescing、queue-full、drain、purge、并发 producer 与 shutdown 后指标归零。
10
+ - Fibo release 五次中位数由 251.208ms 变为 250.554ms(-0.26%,无可见回退);真实 fswatch 0.0.9 trace 验证 `Emit → cancel → Complete → release` 且 `forced=0`。
11
+
12
+ ## English
13
+
14
+ - Maintain a bounded fixed-metadata per-task index under the async queue mutex for queued events, queued bytes, oldest age, accepted, coalesced, queue-full, dequeued, and purged counts.
15
+ - The added metric work for enqueue, coalescing, drain, and purge updates only the affected task without scanning the full registry or copying business payloads; coalescing retains the queue's existing bounded lookup.
16
+ - Extend `--trace-ffi` enqueue/reject/cancel/release records with task-local metrics and aggregate active/closing tasks plus backlog by module/method during shutdown.
17
+ - Remove metric state on task release while retaining the final backlog and cumulative counters in forced-cleanup diagnostics.
18
+ - Cover coalescing, queue-full, drain, purge, concurrent producers, and post-shutdown metric removal in tests.
19
+ - The five-run release fibo median changes from 251.208ms to 250.554ms (-0.26%, no visible regression); a real fswatch 0.0.9 trace verifies `Emit → cancel → Complete → release` with `forced=0`.
@@ -0,0 +1,19 @@
1
+ # Native async FFI 指标报告 / Native async FFI metrics report
2
+
3
+ ## 中文
4
+
5
+ - 新增 `--ffi-metrics`,在进程退出时向 stderr 输出唯一一条带 `schemaVersion` 的 JSON,不污染业务 stdout。
6
+ - 已完成 task 的 queue 与 lifecycle 计数折叠进有界的 module/method 聚合;当前 task 则与 live queue snapshot 合并,避免释放后丢失累计证据或长期保留 capability。
7
+ - Host 统一记录 response deadline timeout,以及 cancel 请求、成功与失败;模块内部 retry 与远端耗时明确由模块自身上报。
8
+ - JSON 提供 totals 和稳定排序的 module/method rows,覆盖 active/closing/completed task、backlog、oldest age 与所有 queue outcome。
9
+ - 单元测试覆盖 deadline timeout 与 cooperative/forced shutdown 后聚合;真实 fswatch 0.0.9 Ctrl-C 验证 `completedTasks=1`、cancel request/success 与 Complete dequeue 均为 1、`forced=0`,指标只出现在 stderr。
10
+ - 默认关闭报告时不执行 completed archive 或 outcome 锁更新,且复用已有 task control mutex、不增加每 task 分配;release fibo 五次中位数为 246.086ms,对比上一阶段 250.554ms 无可见回退。
11
+
12
+ ## English
13
+
14
+ - Add `--ffi-metrics`, which emits exactly one schema-versioned JSON record to stderr at process exit without contaminating business stdout.
15
+ - Fold completed-task queue and lifecycle counters into bounded module/method aggregates; merge current tasks with a live queue snapshot so release neither erases cumulative evidence nor retains capabilities indefinitely.
16
+ - Count response deadline timeouts and cancellation requests, successes, and failures in the host, while keeping module-internal retries and remote timings module-owned.
17
+ - Provide totals and deterministically ordered module/method rows for active/closing/completed tasks, backlog, oldest age, and every queue outcome.
18
+ - Cover deadline timeout plus cooperative/forced shutdown aggregation in unit tests; a real fswatch 0.0.9 Ctrl-C run reports `completedTasks=1`, one cancel request/success, one completed dequeue, and `forced=0`, only on stderr.
19
+ - When reporting is disabled, skip completed archives and outcome-lock updates, and reuse the existing task-control mutex without adding a per-task allocation. The five-run release fibo median is 246.086ms versus 250.554ms in the previous stage, with no visible regression.
@@ -0,0 +1,17 @@
1
+ # 类型化 FFI capability / Typed FFI capabilities
2
+
3
+ ## 中文
4
+
5
+ - 在 core 中增加 nominal `FfiTask` 与 `FfiResponse`,把 native async AnyRef 限制在各自 wrapper 的 `Dynamic` raw 字段中。
6
+ - 公开生命周期操作采用方法形式:task 使用 `.cancel` / `.cancel-with`,response 使用 `.resolve` / `.reject`;底层 `&ffi-*` procedure 仅由内部适配函数调用。
7
+ - reason 与 payload 使用方法级泛型 `T`。Calcit trait 禁止方法签名包含 `Dynamic`,因此用户值不会在进入 FFI 编码前丢失静态类型。
8
+ - 两种 capability 使用不同 nominal receiver;错误 receiver 会被 method dispatch 确定性拒绝,错误 raw capability 仍由 native 宿主校验 kind、owner、generation 与 lifecycle。
9
+ - 增加可重放的 architecture scaffold、core 构造测试,以及中英双语协议和使用文档。
10
+
11
+ ## English
12
+
13
+ - Added nominal core `FfiTask` and `FfiResponse` wrappers, confining native async AnyRef values to each wrapper's `Dynamic` raw field.
14
+ - Exposed lifecycle operations as methods: `.cancel` / `.cancel-with` for tasks and `.resolve` / `.reject` for responses. Internal adapters are the only callers of the raw `&ffi-*` procedures.
15
+ - Kept reason and payload values typed with method-level generic `T`. Calcit traits reject `Dynamic` method signatures, so caller-side types survive until FFI encoding.
16
+ - Kept task and response capabilities as distinct nominal receivers. Method dispatch rejects a wrong receiver deterministically, while the native host still validates raw capability kind, owner, generation, and lifecycle.
17
+ - Added a replayable architecture scaffold, core constructor tests, and bilingual protocol and usage documentation.
@@ -0,0 +1,13 @@
1
+ # 发布 0.13.59 / Release 0.13.59
2
+
3
+ ## 中文
4
+
5
+ - 发布 core 类型化 native async FFI capability API。
6
+ - `FfiTask` 提供 `.cancel` / `.cancel-with`,`FfiResponse` 提供 `.resolve` / `.reject`。
7
+ - 下游 native 模块可以从稳定版本开始迁移,不需要引用未发布提交。
8
+
9
+ ## English
10
+
11
+ - Release the typed native async FFI capability API in core.
12
+ - `FfiTask` exposes `.cancel` / `.cancel-with`, while `FfiResponse` exposes `.resolve` / `.reject`.
13
+ - Downstream native modules can migrate from a stable version instead of referencing an unpublished commit.
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.13.58",
3
+ "version": "0.13.59",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calcit/procs",
3
- "version": "0.13.58",
3
+ "version": "0.13.59",
4
4
  "main": "./lib/calcit.procs.mjs",
5
5
  "devDependencies": {
6
6
  "@types/node": "^25.7.0",