omen 0.10.1 → 0.11.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 +4 -4
- data/CHANGELOG.md +17 -0
- data/INSTRUCTIONS.md +1 -0
- data/README.md +7 -1
- data/app/models/omen/answer.rb +1 -1
- data/app/models/omen/reading.rb +7 -0
- data/app/models/omen/worded.rb +42 -0
- data/config/locales/omen.en.yml +9 -0
- data/lib/generators/omen/install/templates/omen.rb +3 -0
- data/lib/omen/config.rb +4 -0
- data/lib/omen/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1133459de4acc00fce3144317e81c98e8d57b67d4afe0f8314ad962cc1178d7e
|
|
4
|
+
data.tar.gz: 5c377d7f308734e8707dde45b11621002960bd8a7976a29561f845a90b9dd81d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bd166680549604accb5254348eb325ed8a1109bdc24f85d045020df0d48b58057093ba56ead21669d4364a81fd4fd8517a9681391dee371de60ae10cded26f20
|
|
7
|
+
data.tar.gz: f68ed6d631c6d0be15627625b3f51613ec0e7fe334979ba0d02bf000f50d5e9c932db8978c03d2005e6676e89fd84185dce0919b3fae63673dbae80e7babf7b4
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ 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
|
+
## 0.11.1 - 2026-10-14
|
|
9
|
+
|
|
10
|
+
* [Fix] The sentences an answer reads as ship with the gem
|
|
11
|
+
|
|
12
|
+
0.11.0 kept them in `config/locales`, which the gem left out of what it packages, so a host
|
|
13
|
+
read `Translation missing: en.omen.figures` where an answer's figures belonged.
|
|
14
|
+
|
|
15
|
+
## 0.11.0 - 2026-10-14
|
|
16
|
+
|
|
17
|
+
* [Feature] An answer reads as words, and a reading as the turns of a chat
|
|
18
|
+
|
|
19
|
+
`answer.to_s` reads its figures out -- each name with its details in parentheses, the first
|
|
20
|
+
eight and `more` past them -- finishes its note where one figure answers it, says nothing
|
|
21
|
+
matched, that it ran long, or sorry where it failed. `reading.turns` pairs each question with
|
|
22
|
+
those words, `nil` while one is awaited. The sentences are `omen.*` keys a host rewords in its
|
|
23
|
+
own locale, and `config.rows_read_out` is how many figures are read out.
|
|
24
|
+
|
|
8
25
|
## 0.10.1 - 2026-10-14
|
|
9
26
|
|
|
10
27
|
* [Change] The narrowed role is granted the connection's current schema rather than `public`,
|
data/INSTRUCTIONS.md
CHANGED
|
@@ -124,6 +124,7 @@ writes it with each line commented out, as the list of what there is to say.
|
|
|
124
124
|
|---|---|
|
|
125
125
|
| `narrow_role` | `'omen_inquirer'` |
|
|
126
126
|
| `remembered` | `5`, the turns of a thread that travel with the next question |
|
|
127
|
+
| `rows_read_out` | `8`, the rows of an answer its words read out before saying there are more |
|
|
127
128
|
| `notes` | none, so the prompt says nothing about this app beyond its schema |
|
|
128
129
|
|
|
129
130
|
## What a host builds on top
|
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.
|
|
21
|
+
gem 'omen', '~> 0.11.0'
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
Then four commands:
|
|
@@ -80,6 +80,12 @@ the statement Claude wrote, the rows it found, and which of their headers held a
|
|
|
80
80
|
column. `rails g omen:pages` writes the pages that draw all of that, into your app, for you to
|
|
81
81
|
keep or replace.
|
|
82
82
|
|
|
83
|
+
An answer also reads as words: `answer.to_s` is its figures read out -- `Ada (Lovelace) and
|
|
84
|
+
Alan.`, `Contacts who signed in: 2.` -- or its note where it has none, and sorry where it
|
|
85
|
+
failed. `reading.turns` pairs each question with those words, `nil` while one is awaited, which
|
|
86
|
+
is all a chat bubble needs. The sentences are `omen.*` keys in the gem's locale file, so a host
|
|
87
|
+
rewords them in its own.
|
|
88
|
+
|
|
83
89
|
## Two kinds of reading
|
|
84
90
|
|
|
85
91
|
`omen_readings` carries a `type`, so a subclass of `Omen::Reading` is a kind of reading rather
|
data/app/models/omen/answer.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# What Claude said back: the prose, the statement it wrote, and the rows that statement found.
|
|
2
2
|
class Omen::Answer < Omen.config.record
|
|
3
|
-
include Omen::Revealed, Omen::Spoken
|
|
3
|
+
include Omen::Revealed, Omen::Spoken, Omen::Worded
|
|
4
4
|
|
|
5
5
|
# A \uXXXX escape that outlived JSON.parse, because Claude escaped the backslash of its own.
|
|
6
6
|
UNICODE_ESCAPE = /\\u([0-9a-fA-F]{4})/
|
data/app/models/omen/reading.rb
CHANGED
|
@@ -18,6 +18,13 @@ class Omen::Reading < Omen.config.record
|
|
|
18
18
|
|
|
19
19
|
# @return [String] the host's notes about its data, as this reading's asker is told them.
|
|
20
20
|
def notes = Omen.config.notes
|
|
21
|
+
|
|
22
|
+
# @return [Array<Array>] each question asked and the answer said back, nil while it is awaited.
|
|
23
|
+
def turns
|
|
24
|
+
questions.includes(:answer).map do |question|
|
|
25
|
+
[ question.text, question.answer&.to_s || (I18n.t('omen.failed') if failed?) ]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
ActiveSupport.run_load_hooks :omen_reading, Omen::Reading
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Extends Omen::Answer with the words it is read out in, which a host rewords in its own locale.
|
|
2
|
+
module Omen::Worded extend ActiveSupport::Concern
|
|
3
|
+
# @return [String] the answer in words: its figures read out, its note where it has none.
|
|
4
|
+
def to_s
|
|
5
|
+
return I18n.t('omen.failed') if error.present?
|
|
6
|
+
|
|
7
|
+
[ said, (I18n.t('omen.ran_long') if cut_off?) ].compact.join ' '
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def said
|
|
13
|
+
if sql.blank?
|
|
14
|
+
note.squish
|
|
15
|
+
else
|
|
16
|
+
read_out shown.first(Omen.config.rows_read_out)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def read_out(rows)
|
|
21
|
+
if rows.empty?
|
|
22
|
+
I18n.t 'omen.nothing'
|
|
23
|
+
elsif rows.one?
|
|
24
|
+
I18n.t 'omen.one', note: note.squish.delete_suffix('.'), figure: figure(rows.sole)
|
|
25
|
+
else
|
|
26
|
+
figures = [ *rows.map { |row| figure row }, more(rows) ].compact
|
|
27
|
+
I18n.t 'omen.figures', list: figures.to_sentence
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def more(rows) = (I18n.t 'omen.more' if shown.size > rows.size || truncated?)
|
|
32
|
+
|
|
33
|
+
def figure(row)
|
|
34
|
+
values = row.values.compact_blank.map(&:to_s)
|
|
35
|
+
|
|
36
|
+
if values.one?
|
|
37
|
+
values.first
|
|
38
|
+
else
|
|
39
|
+
I18n.t 'omen.figure', name: values.first, details: values.drop(1).join(', ')
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -23,6 +23,9 @@ Omen.configure do |config|
|
|
|
23
23
|
# there are more without counting them.
|
|
24
24
|
# config.maximum_rows = 100
|
|
25
25
|
|
|
26
|
+
# How many of those rows an answer's words read out before saying there are more.
|
|
27
|
+
# config.rows_read_out = 8
|
|
28
|
+
|
|
26
29
|
# How many turns of a thread travel with the next question. A thread nobody clears would
|
|
27
30
|
# otherwise carry its whole history into each one, and be charged for it again each time.
|
|
28
31
|
# config.remembered = 5
|
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 of those rows an answer's words read out before saying there are more.
|
|
19
|
+
attr_accessor :rows_read_out
|
|
20
|
+
|
|
18
21
|
# How many turns of a thread travel with the next question.
|
|
19
22
|
attr_accessor :remembered
|
|
20
23
|
|
|
@@ -29,6 +32,7 @@ module Omen
|
|
|
29
32
|
@narrow_role = 'omen_inquirer'
|
|
30
33
|
@claude_model = 'claude-opus-5'
|
|
31
34
|
@maximum_rows = 100
|
|
35
|
+
@rows_read_out = 8
|
|
32
36
|
@remembered = 5
|
|
33
37
|
@schema_path = 'db/schema.rb'
|
|
34
38
|
end
|
data/lib/omen/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Claudio Baccigalupo
|
|
@@ -95,6 +95,8 @@ files:
|
|
|
95
95
|
- app/models/omen/schema.rb
|
|
96
96
|
- app/models/omen/spoken.rb
|
|
97
97
|
- app/models/omen/stated.rb
|
|
98
|
+
- app/models/omen/worded.rb
|
|
99
|
+
- config/locales/omen.en.yml
|
|
98
100
|
- db/migrate/20260821120000_create_omen_readings.rb
|
|
99
101
|
- db/migrate/20260821120001_create_omen_questions.rb
|
|
100
102
|
- db/migrate/20260821120002_create_omen_answers.rb
|