ask-agent 0.29.1 → 0.30.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b6eca46c976555990a13366053665b9340f4a97d578a332a8cbf9615cd5647d
4
- data.tar.gz: 7c16e54008a44cc0eafb8ebfea51c752e0d6879749635e606142f84cdd03d682
3
+ metadata.gz: cf67fcc30605c8d4752a97133a13a7fbe500c32a68c47640552bc30cf6dbea5b
4
+ data.tar.gz: 638931a8c1c2c5ae0ca5535e9e78e9252910106af9134366a455523925b6d895
5
5
  SHA512:
6
- metadata.gz: 05eb5c72881fcb3730dab2f89d51444b3f86f41413f454090331d5c9bb240b6ca4751c40f0fdc3ef10f2ea718989aa7e68e716e13570e247a094f76ae0702051
7
- data.tar.gz: 712139e5f89850fe706268b74a08854c2f1f0be7276e4717039c73192a872d6f4a3c2566954ae4133ce10917d51ea4ae5687995b828ef024bead95a8222ac68d
6
+ metadata.gz: 01ca01b502aa5789eef910f50626085bb6675e86dedd435b189b0e928d592ac27c48c145ff5c159580c2a9854528160c86074031dccd971b033b75b6f42bf3fa
7
+ data.tar.gz: 6bf3ebc3428cf64c8a1ee7e958e45c349669e4eaba92a8bc5d90b522f0b9a47d4f3743570db235b8d9b4e526d3ea470eb1a81795acc6492fd67afda4b59d9b70
data/CHANGELOG.md CHANGED
@@ -1,3 +1,52 @@
1
+ ## [0.30.1] — 2026-08-06
2
+
3
+ ### Fixed
4
+
5
+ - **Framework-injected tools are no longer persisted in session metadata.**
6
+ The built-in `load_skill` tool was saved alongside user tools and could
7
+ not be auto-instantiated on load (`LoadSkillTool` requires a registry), so
8
+ the previous 0.30.0 fix skipped it with a broad rescue. Persisted metadata
9
+ now contains only user-supplied tools (`persisted_tools`); `load_skill` is
10
+ re-added by `resolve_tools` per session with a proper registry.
11
+ - **`Session.load` no longer swallows tool-restore failures silently.** The
12
+ safety net now rescues only `NameError` (renamed/removed classes) and
13
+ `ArgumentError` (constructors with required args), and warns with the
14
+ tool name instead of failing the whole load — genuine tool bugs surface
15
+ instead of disappearing.
16
+
17
+ ## [0.30.0] — 2026-08-06
18
+
19
+ ### Added
20
+
21
+ - **Session checkpoints: fork, rollback, resume.** Versioned, durable
22
+ checkpoints on any state adapter. Enable with
23
+ `Session.new(state: store, checkpoints: true)` — every turn is snapshotted
24
+ under a sequential key, and the session gains time travel:
25
+ - **`Session#rollback!(seq: / turn:)`** — rewind messages and turn count
26
+ to an earlier checkpoint. Later checkpoints are kept, so the session
27
+ can roll forward again. The legacy blob stays consistent.
28
+ - **`Session#fork(at_seq: / at_turn:)`** — a new session (new id, same
29
+ model/tools) whose history is everything up to that point, backed by
30
+ its own checkpoint chain; continue the branch with `run`.
31
+ - **`Session#checkpoint_history` / `Session#load_checkpoint(seq:)`** —
32
+ inspect the timeline. `Session.load` re-enables checkpointing
33
+ automatically when the stored session has checkpoints.
34
+ - `Ask::Agent::CheckpointStore` — the store itself, usable standalone.
35
+ It needs only the minimal KV contract (`get`/`set`/`delete`), so it
36
+ works with every state provider (SQLite, Redis, Postgres, MySQL) and
37
+ custom adapters — no list primitives required, no provider mandated.
38
+ - `Events::SessionRolledBack` / `Events::SessionForked` fire on rollback
39
+ and fork. `Session#delete` cleans up checkpoint keys too.
40
+
41
+ ### Fixed
42
+
43
+ - **`Session.load` could not restore sessions saved with tools.** The
44
+ built-in `LoadSkillTool` (auto-added to every session) cannot be
45
+ instantiated without a registry, so any saved session with tools failed
46
+ to load with `ArgumentError: missing keyword: :registry`. Load now
47
+ instantiates saved tool classes defensively — un-instantiable classes are
48
+ skipped and re-added by `resolve_tools` with a proper registry.
49
+
1
50
  ## [0.29.1] — 2026-08-06
2
51
 
3
52
  ### Fixed
@@ -314,14 +314,16 @@ module Ask
314
314
  session = new(
315
315
  id: data[:id],
316
316
  model: data.dig(:metadata, :model),
317
- # Instantiate saved tool classes defensively: tools that cannot be
318
- # auto-constructed (e.g. the built-in LoadSkillTool, which needs a
319
- # registry) are skippedresolve_tools re-adds them with a proper
320
- # registry. Callers can also pass their own `tools:` after load.
317
+ # Restore saved user tools by class name. Tools that cannot be
318
+ # restored renamed/removed classes (NameError) or constructors
319
+ # with required args (ArgumentError) are skipped with a warning
320
+ # instead of failing the whole load; resolve_tools re-adds the
321
+ # framework-injected load_skill tool with a proper registry.
321
322
  tools: data.dig(:metadata, :tools).to_a.filter_map do |name|
322
323
  begin
323
324
  name.constantize.new
324
- rescue StandardError
325
+ rescue NameError, ArgumentError => e
326
+ warn "[ask-agent] Session.load skipped tool '#{name}': #{e.class}: #{e.message}"
325
327
  nil
326
328
  end
327
329
  end,
@@ -694,6 +696,15 @@ module Ask
694
696
  target.instance_variable_set(:@turn_count, data.dig(:metadata, :turn_count) || 0)
695
697
  end
696
698
 
699
+ # User-supplied tools only. Framework-injected tools (the built-in
700
+ # load_skill tool) are re-created by resolve_tools on every session, so
701
+ # persisting them would leak framework internals into user data — and
702
+ # they cannot be auto-instantiated on load anyway (LoadSkillTool needs
703
+ # a registry).
704
+ def persisted_tools
705
+ @tools.reject { |t| t.is_a?(Ask::Skills::LoadSkillTool) }
706
+ end
707
+
697
708
  def persist!
698
709
  payload = {
699
710
  id: @id,
@@ -707,7 +718,7 @@ module Ask
707
718
  },
708
719
  metadata: {
709
720
  model: @chat.model.respond_to?(:id) ? @chat.model.id : @chat.model,
710
- tools: @tools.map { |t| t.class.name },
721
+ tools: persisted_tools.map { |t| t.class.name },
711
722
  max_turns: @max_turns,
712
723
  turn_count: @turn_count,
713
724
  created_at: @created_at.iso8601,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module Agent
5
- VERSION = "0.29.1"
5
+ VERSION = "0.30.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.1
4
+ version: 0.30.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto