omen 0.5.0 → 0.7.0

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: 38d16f1a8a34b75c8ec0c68256c468a1964433fd7700c3d70cac77a442d112a5
4
- data.tar.gz: de2689fb094379753948c4e7d8a98446b92e7870ea52ec26448f4e9dae19cc04
3
+ metadata.gz: 77023f5984f5bf7b9d121db8f2b233f1c69dcb0ae4580f31d78794f3c136c77c
4
+ data.tar.gz: d2b51269750ab2b89cac43fb90e8382508abc80dd7ed9c4ff2577f65aadeec12
5
5
  SHA512:
6
- metadata.gz: 0d53e0fffd2be50f0ed33c9def0f59df816dc6de58be56b9ad0a4397a0d9f4ad5f778c6b046938b85f0cad3e31b32346ee0e395084a29938116d1aa4b553b486
7
- data.tar.gz: 410c8befd10808099f1d07969b2197a6212b8a26c3a064788f60d5e828a37d4b9b254a32709171c84e35479183a30f7c6c55b90d8ec922704ee174b9afbf8629
6
+ metadata.gz: 16057a3aefe593c75889520a214e3697a61c3c72fd8115374eb62d8236dd51c1123c0169c5ff89ea6b38a1e6d0c262eaef9a9a0bfc9f39870c3d009ccd167bcc
7
+ data.tar.gz: 9bc6b5f7967966b99b8f666a135fc627d063109f0d228666b221dd4e1f18894554338c455cb56a46a0421c1fc1f2fe6f3d07408e9db614359f97c86f5d7aaeb8
data/CHANGELOG.md CHANGED
@@ -5,7 +5,19 @@ All notable changes to this project will be documented in this file.
5
5
  For more information about changelogs, check [Keep a Changelog](http://keepachangelog.com) and
6
6
  [Vandamme](http://tech-angels.github.io/vandamme).
7
7
 
8
- ## [Unreleased]
8
+ ## 0.7.0 - 2026-09-12
9
+
10
+ * [Bugfix] Keep the columns of an answer in the order the statement asked for them. They were
11
+ held as `jsonb`, which sorts a row's keys by length, so a page drew them scrambled
12
+
13
+ * [Breaking change] Carry five turns of a thread rather than twenty, which is what a question
14
+ usually leans on and what a thread nobody clears can afford to send again every time
15
+
16
+ ## 0.6.0 - 2026-09-11
17
+
18
+ * [Feature] Carry only the last turns of a thread into the next question, `Omen.config.remembered`
19
+ of them, 20 by default. A thread nobody clears was sending its whole history with every
20
+ question and being charged for it again each time
9
21
 
10
22
  ## 0.5.0 - 2026-09-11
11
23
 
data/INSTRUCTIONS.md CHANGED
@@ -121,17 +121,19 @@ writes it with each line commented out, as the list of what there is to say.
121
121
  | Setting | Default |
122
122
  |---|---|
123
123
  | `narrow_role` | `'omen_inquirer'` |
124
+ | `remembered` | `5`, the turns of a thread that travel with the next question |
124
125
  | `notes` | none, so the prompt says nothing about this app beyond its schema |
125
126
 
126
127
  ## What a host builds on top
127
128
 
128
- `Omen::Reading` has a `type` column nowhere, so a subclass is a transparent second name for the
129
- same rows: `Inquiry.all` carries no type condition, and `to_partial_path` becomes
130
- `inquiries/inquiry`.
129
+ `omen_readings` carries a `type`, so a subclass is a kind of reading rather than a second name
130
+ for every row: `Inquiry.all` counts inquiries, and a row answers as what it was written as,
131
+ whatever class asks for it. That last part is what keeps a narrowing honest, since what a
132
+ reading may read is the row's own to say.
131
133
 
132
134
  ```ruby
133
135
  class Inquiry < Omen::Reading
134
- belongs_to :agent
136
+ belongs_to :owner, polymorphic: true
135
137
  end
136
138
  ```
137
139
 
data/README.md CHANGED
@@ -18,7 +18,7 @@ statement returned is ever sent back.
18
18
  In your `Gemfile`, pinned to the current minor while this is still below 1.0:
19
19
 
20
20
  ```ruby
21
- gem 'omen', '~> 0.5.0'
21
+ gem 'omen', '~> 0.6.0'
22
22
  ```
23
23
 
24
24
  Then four commands:
@@ -24,7 +24,12 @@ private
24
24
  execute question.create_answer!(**reply)
25
25
  end
26
26
 
27
- def asked_up_to(question) = questions.where id: ..question.id
27
+ # The last few turns rather than every one: a thread nobody clears would otherwise carry its
28
+ # whole history into each question, and be charged for it again each time.
29
+ def asked_up_to(question)
30
+ asked = questions.where id: ..question.id
31
+ asked.where id: asked.reorder(id: :desc).limit(Omen.config.remembered).select(:id)
32
+ end
28
33
 
29
34
  def execute(answered)
30
35
  return if answered.sql.blank?
@@ -2,7 +2,7 @@ class CreateOmenAnswers < ActiveRecord::Migration[8.1]
2
2
  def change
3
3
  create_table :omen_answers do |t|
4
4
  t.jsonb :content, default: [], null: false
5
- t.jsonb :result, default: [], null: false
5
+ t.json :result, default: [], null: false
6
6
  t.jsonb :provenance, default: {}, null: false
7
7
  t.integer :input_usage, default: 0, null: false
8
8
  t.integer :output_usage, default: 0, null: false
@@ -0,0 +1,5 @@
1
+ class KeepTheColumnOrderOfAnAnswer < ActiveRecord::Migration[8.1]
2
+ def up
3
+ change_column :omen_answers, :result, :json, default: [], null: false
4
+ end
5
+ end
@@ -23,6 +23,10 @@ Omen.configure do |config|
23
23
  # there are more without counting them.
24
24
  # config.maximum_rows = 100
25
25
 
26
+ # How many turns of a thread travel with the next question. A thread nobody clears would
27
+ # otherwise carry its whole history into each one, and be charged for it again each time.
28
+ # config.remembered = 5
29
+
26
30
  # Left unset, the Anthropic SDK resolves ANTHROPIC_API_KEY and its own wider chain.
27
31
  # config.api_key = Rails.application.credentials.dig :anthropic, :api_key
28
32
 
data/lib/omen/config.rb CHANGED
@@ -15,6 +15,9 @@ module Omen
15
15
  # How many rows of one answer a page will show.
16
16
  attr_accessor :maximum_rows
17
17
 
18
+ # How many turns of a thread travel with the next question.
19
+ attr_accessor :remembered
20
+
18
21
  # The key the Anthropic API is reached with. Left unset, the SDK resolves one of its own.
19
22
  attr_accessor :api_key
20
23
 
@@ -26,6 +29,7 @@ module Omen
26
29
  @narrow_role = 'omen_inquirer'
27
30
  @claude_model = 'claude-opus-5'
28
31
  @maximum_rows = 100
32
+ @remembered = 5
29
33
  @schema_path = 'db/schema.rb'
30
34
  end
31
35
 
data/lib/omen/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Omen
2
2
  # The version of this gem, as RubyGems knows it.
3
- VERSION = '0.5.0'
3
+ VERSION = '0.7.0'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
@@ -99,6 +99,7 @@ files:
99
99
  - db/migrate/20260821120001_create_omen_questions.rb
100
100
  - db/migrate/20260821120002_create_omen_answers.rb
101
101
  - db/migrate/20260912000000_add_type_to_omen_readings.rb
102
+ - db/migrate/20260912100000_keep_the_column_order_of_an_answer.rb
102
103
  - lib/generators/omen/install/install_generator.rb
103
104
  - lib/generators/omen/install/templates/omen.rb
104
105
  - lib/generators/omen/pages/USAGE