riffer-rig 0.2.0 → 0.3.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 +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +2 -2
- data/lib/riffer/rig/cli.rb +21 -1
- data/lib/riffer/rig/coding_agent.rb +7 -5
- data/lib/riffer/rig/credentials.rb +24 -4
- data/lib/riffer/rig/repl.rb +70 -5
- data/lib/riffer/rig/settings/pricing.rb +19 -0
- data/lib/riffer/rig/settings.rb +33 -8
- data/lib/riffer/rig/token_tally.rb +22 -6
- data/lib/riffer/rig/tools/bash.rb +19 -4
- data/lib/riffer/rig/tools/edit.rb +6 -0
- data/lib/riffer/rig/tools/read.rb +6 -1
- data/lib/riffer/rig/tools/write.rb +4 -0
- data/lib/riffer/rig/ui/animator.rb +51 -11
- data/lib/riffer/rig/ui/banner.rb +28 -4
- data/lib/riffer/rig/ui/cursor.rb +46 -0
- data/lib/riffer/rig/ui/palette.rb +13 -7
- data/lib/riffer/rig/ui/renderer.rb +38 -7
- data/lib/riffer/rig/ui/smoother.rb +31 -5
- data/lib/riffer/rig/ui/theme.rb +38 -7
- data/lib/riffer/rig/version.rb +1 -1
- data/sig/generated/riffer/rig/cli.rbs +41 -0
- data/sig/generated/riffer/rig/coding_agent.rbs +9 -0
- data/sig/generated/riffer/rig/credentials.rbs +55 -0
- data/sig/generated/riffer/rig/repl.rbs +76 -0
- data/sig/generated/riffer/rig/settings/pricing.rbs +23 -0
- data/sig/generated/riffer/rig/settings.rbs +92 -0
- data/sig/generated/riffer/rig/token_tally.rbs +61 -0
- data/sig/generated/riffer/rig/tools/bash.rbs +28 -0
- data/sig/generated/riffer/rig/tools/edit.rbs +11 -0
- data/sig/generated/riffer/rig/tools/read.rbs +12 -0
- data/sig/generated/riffer/rig/tools/write.rbs +9 -0
- data/sig/generated/riffer/rig/ui/animator.rbs +76 -0
- data/sig/generated/riffer/rig/ui/banner.rbs +42 -0
- data/sig/generated/riffer/rig/ui/cursor.rbs +33 -0
- data/sig/generated/riffer/rig/ui/palette.rbs +17 -0
- data/sig/generated/riffer/rig/ui/renderer.rbs +68 -0
- data/sig/generated/riffer/rig/ui/smoother.rbs +67 -0
- data/sig/generated/riffer/rig/ui/theme.rbs +60 -0
- data/sig/generated/riffer/rig/version.rbs +7 -0
- data/sig/generated/riffer/rig.rbs +2 -0
- data/sig/manual/riffer/rig/cli.rbs +8 -0
- data/sig/manual/riffer/rig/credentials.rbs +8 -0
- data/sig/manual/riffer/rig/settings.rbs +8 -0
- data/sig/manual/riffer/rig/tools.rbs +5 -0
- data/sig/manual/riffer/rig/ui/banner.rbs +8 -0
- data/sig/manual/riffer/rig/ui.rbs +5 -0
- metadata +30 -2
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/repl.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::REPL
|
|
4
|
+
EXIT_COMMANDS: Array[String]
|
|
5
|
+
|
|
6
|
+
SKILL_COMMAND: Regexp
|
|
7
|
+
|
|
8
|
+
@pending_tool_calls: Array[Riffer::StreamEvents::ToolCallDone]
|
|
9
|
+
|
|
10
|
+
@output: untyped
|
|
11
|
+
|
|
12
|
+
@input: untyped
|
|
13
|
+
|
|
14
|
+
@theme: Riffer::Rig::UI::Theme
|
|
15
|
+
|
|
16
|
+
@cursor: Riffer::Rig::UI::Cursor
|
|
17
|
+
|
|
18
|
+
@smoother: Riffer::Rig::UI::Smoother
|
|
19
|
+
|
|
20
|
+
@animator: Riffer::Rig::UI::Animator
|
|
21
|
+
|
|
22
|
+
@renderer: Riffer::Rig::UI::Renderer
|
|
23
|
+
|
|
24
|
+
@agent: Riffer::Agent
|
|
25
|
+
|
|
26
|
+
# @rbs ?agent: Riffer::Agent
|
|
27
|
+
# @rbs ?renderer: Riffer::Rig::UI::Renderer
|
|
28
|
+
# @rbs input: untyped
|
|
29
|
+
# @rbs output: untyped
|
|
30
|
+
# @rbs ?theme: Riffer::Rig::UI::Theme
|
|
31
|
+
# @rbs ?animator: Riffer::Rig::UI::Animator
|
|
32
|
+
# @rbs ?smoother: Riffer::Rig::UI::Smoother
|
|
33
|
+
# @rbs ?cursor: Riffer::Rig::UI::Cursor
|
|
34
|
+
# @rbs return: void
|
|
35
|
+
def initialize: (agent: untyped, renderer: untyped, ?input: untyped, ?output: untyped, ?theme: untyped, ?animator: untyped, ?smoother: untyped, ?cursor: untyped) -> void
|
|
36
|
+
|
|
37
|
+
# @rbs return: Symbol
|
|
38
|
+
def run: () -> Symbol
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
# @rbs prompt: String
|
|
43
|
+
# @rbs return: void
|
|
44
|
+
def run_turn: (String prompt) -> void
|
|
45
|
+
|
|
46
|
+
# @rbs name: String
|
|
47
|
+
# @rbs args: String
|
|
48
|
+
# @rbs return: void
|
|
49
|
+
def run_skill_command: (String name, String args) -> void
|
|
50
|
+
|
|
51
|
+
# @rbs name: String
|
|
52
|
+
# @rbs return: String?
|
|
53
|
+
def activate_skill: (String name) -> String?
|
|
54
|
+
|
|
55
|
+
# @rbs name: String
|
|
56
|
+
# @rbs body: String
|
|
57
|
+
# @rbs return: String
|
|
58
|
+
def skill_block: (String name, String body) -> String
|
|
59
|
+
|
|
60
|
+
# Tool call lines print below their round's stats line to reflect the actual
|
|
61
|
+
# timeline (usage is reported when the model stream closes, after the calls
|
|
62
|
+
# were decided). ToolCallDone events are therefore held until the stats line
|
|
63
|
+
# or the next event forces them out. Callers must have the spinner stopped —
|
|
64
|
+
# the flush renders between their existing stop/start pair.
|
|
65
|
+
#
|
|
66
|
+
# @rbs return: void
|
|
67
|
+
def flush_pending_tool_calls: () -> void
|
|
68
|
+
|
|
69
|
+
# Tool results can land mid-animation (tool execution emits no stream events,
|
|
70
|
+
# so the indicator is up); stop it around the line so its next frame doesn't
|
|
71
|
+
# erase what we printed.
|
|
72
|
+
#
|
|
73
|
+
# @rbs message: Riffer::Messages::Base
|
|
74
|
+
# @rbs return: void
|
|
75
|
+
def render_tool_result: (Riffer::Messages::Base message) -> void
|
|
76
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/settings/pricing.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# USD per million tokens, parsed from a model's entry in the settings file.
|
|
4
|
+
class Riffer::Rig::Settings::Pricing
|
|
5
|
+
# @dynamic input, output, cache_write, cache_read
|
|
6
|
+
attr_reader input: Float
|
|
7
|
+
|
|
8
|
+
# @dynamic input, output, cache_write, cache_read
|
|
9
|
+
attr_reader output: Float
|
|
10
|
+
|
|
11
|
+
# @dynamic input, output, cache_write, cache_read
|
|
12
|
+
attr_reader cache_write: Float
|
|
13
|
+
|
|
14
|
+
# @dynamic input, output, cache_write, cache_read
|
|
15
|
+
attr_reader cache_read: Float
|
|
16
|
+
|
|
17
|
+
# @rbs input: Float
|
|
18
|
+
# @rbs output: Float
|
|
19
|
+
# @rbs cache_write: Float
|
|
20
|
+
# @rbs cache_read: Float
|
|
21
|
+
# @rbs return: void
|
|
22
|
+
def initialize: (input: Float, output: Float, cache_write: Float, cache_read: Float) -> void
|
|
23
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/settings.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Reads and writes the riffer-rig user settings file at
|
|
4
|
+
# <tt>~/.riffer/settings.json</tt>.
|
|
5
|
+
#
|
|
6
|
+
# Example file:
|
|
7
|
+
#
|
|
8
|
+
# {
|
|
9
|
+
# "model": "anthropic/claude-sonnet-4-6",
|
|
10
|
+
# "reasoning": "low",
|
|
11
|
+
# "models": {
|
|
12
|
+
# "anthropic/claude-sonnet-4-6": {
|
|
13
|
+
# "input": 3.0,
|
|
14
|
+
# "output": 15.0,
|
|
15
|
+
# "cache_write": 3.75,
|
|
16
|
+
# "cache_read": 0.3
|
|
17
|
+
# }
|
|
18
|
+
# }
|
|
19
|
+
# }
|
|
20
|
+
#
|
|
21
|
+
# All keys are optional. Missing pricing means cost display is suppressed.
|
|
22
|
+
# <tt>"reasoning"</tt> is translated to the appropriate provider-specific
|
|
23
|
+
# parameter on each API call; accepted values depend on the provider:
|
|
24
|
+
#
|
|
25
|
+
# - Anthropic: <tt>"low"</tt>, <tt>"medium"</tt>, <tt>"high"</tt>,
|
|
26
|
+
# <tt>"xhigh"</tt>, <tt>"max"</tt>
|
|
27
|
+
# - OpenAI / OpenRouter: <tt>"low"</tt>, <tt>"medium"</tt>, <tt>"high"</tt>,
|
|
28
|
+
# <tt>"xhigh"</tt>
|
|
29
|
+
#
|
|
30
|
+
# Omitting the key (or supplying an unrecognised value) leaves the model's
|
|
31
|
+
# default reasoning behaviour unchanged.
|
|
32
|
+
module Riffer::Rig::Settings
|
|
33
|
+
PATH: String
|
|
34
|
+
|
|
35
|
+
DEFAULT_MODEL: ::String
|
|
36
|
+
|
|
37
|
+
REASONING_LEVELS_BY_PROVIDER: Hash[String, Array[String]]
|
|
38
|
+
|
|
39
|
+
# Returns the configured model string, or +DEFAULT_MODEL+ if not set.
|
|
40
|
+
#
|
|
41
|
+
# @rbs path: String
|
|
42
|
+
# @rbs return: String
|
|
43
|
+
def model: (?path: String) -> String
|
|
44
|
+
|
|
45
|
+
# Returns model options for the configured model and reasoning level, ready
|
|
46
|
+
# to pass directly to the Riffer agent's +model_options+.
|
|
47
|
+
#
|
|
48
|
+
# @rbs path: String
|
|
49
|
+
# @rbs return: Hash[Symbol, untyped]
|
|
50
|
+
def model_options: (?path: String) -> Hash[Symbol, untyped]
|
|
51
|
+
|
|
52
|
+
# Returns the provider prefix for +model_string+, e.g. <tt>"anthropic"</tt>
|
|
53
|
+
# for <tt>"anthropic/claude-sonnet-4-6"</tt>. Returns +nil+ if the model
|
|
54
|
+
# string contains no slash.
|
|
55
|
+
#
|
|
56
|
+
# @rbs model_string: String
|
|
57
|
+
# @rbs return: String?
|
|
58
|
+
def provider_for: (String model_string) -> String?
|
|
59
|
+
|
|
60
|
+
# Returns the pricing for +model+, or +nil+ if not configured.
|
|
61
|
+
#
|
|
62
|
+
# @rbs model: String
|
|
63
|
+
# @rbs path: String
|
|
64
|
+
# @rbs return: Pricing?
|
|
65
|
+
def pricing_for: (String model, ?path: String) -> Pricing?
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
# @rbs provider: String?
|
|
70
|
+
# @rbs return: Hash[Symbol, untyped]
|
|
71
|
+
def base_options: (String? provider) -> Hash[Symbol, untyped]
|
|
72
|
+
|
|
73
|
+
# @rbs path: String
|
|
74
|
+
# @rbs ?provider: String?
|
|
75
|
+
# @rbs return: String?
|
|
76
|
+
def reasoning_for: (?path: String, ?provider: untyped) -> String?
|
|
77
|
+
|
|
78
|
+
# Maps a reasoning level to the provider-specific model option hash expected
|
|
79
|
+
# by Riffer. Returns an empty hash when +level+ is +nil+.
|
|
80
|
+
#
|
|
81
|
+
# @rbs level: String?
|
|
82
|
+
# @rbs provider: String?
|
|
83
|
+
# @rbs return: Hash[Symbol, untyped]
|
|
84
|
+
def reasoning_options: (String? level, String? provider) -> Hash[Symbol, untyped]
|
|
85
|
+
|
|
86
|
+
# The parsed settings file, or an empty hash when the file is absent or
|
|
87
|
+
# malformed.
|
|
88
|
+
#
|
|
89
|
+
# @rbs path: String
|
|
90
|
+
# @rbs return: Hash[String, untyped]
|
|
91
|
+
def read: (String path) -> Hash[String, untyped]
|
|
92
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/token_tally.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Accumulates token usage across multiple turns in a session and computes an
|
|
4
|
+
# estimated cost based on a pricing object sourced from
|
|
5
|
+
# +Riffer::Rig::Settings+.
|
|
6
|
+
#
|
|
7
|
+
# Instantiate once per REPL session, call +add+ after each turn, then read
|
|
8
|
+
# +total_tokens+ and +estimated_cost+ for display.
|
|
9
|
+
#
|
|
10
|
+
# pricing = Riffer::Rig::Settings.pricing_for('anthropic/claude-sonnet-4-6')
|
|
11
|
+
# tally = Riffer::Rig::TokenTally.new(pricing: pricing)
|
|
12
|
+
# tally.add(usage)
|
|
13
|
+
# tally.estimated_cost # => 0.000042 (USD), or nil if pricing is nil
|
|
14
|
+
class Riffer::Rig::TokenTally
|
|
15
|
+
@input_tokens: Integer
|
|
16
|
+
|
|
17
|
+
@output_tokens: Integer
|
|
18
|
+
|
|
19
|
+
@cache_write_tokens: Integer
|
|
20
|
+
|
|
21
|
+
@cache_read_tokens: Integer
|
|
22
|
+
|
|
23
|
+
@pricing: Riffer::Rig::Settings::Pricing?
|
|
24
|
+
|
|
25
|
+
# @dynamic input_tokens, output_tokens, cache_write_tokens, cache_read_tokens
|
|
26
|
+
attr_reader input_tokens: untyped
|
|
27
|
+
|
|
28
|
+
# @dynamic input_tokens, output_tokens, cache_write_tokens, cache_read_tokens
|
|
29
|
+
attr_reader output_tokens: untyped
|
|
30
|
+
|
|
31
|
+
# @dynamic input_tokens, output_tokens, cache_write_tokens, cache_read_tokens
|
|
32
|
+
attr_reader cache_write_tokens: untyped
|
|
33
|
+
|
|
34
|
+
# @dynamic input_tokens, output_tokens, cache_write_tokens, cache_read_tokens
|
|
35
|
+
attr_reader cache_read_tokens: untyped
|
|
36
|
+
|
|
37
|
+
# @rbs ?pricing: Riffer::Rig::Settings::Pricing?
|
|
38
|
+
# @rbs return: void
|
|
39
|
+
def initialize: (?pricing: untyped) -> void
|
|
40
|
+
|
|
41
|
+
# Accumulates token counts from a +Riffer::Providers::TokenUsage+ object.
|
|
42
|
+
#
|
|
43
|
+
# @rbs usage: Riffer::Providers::TokenUsage
|
|
44
|
+
# @rbs return: void
|
|
45
|
+
def add: (Riffer::Providers::TokenUsage usage) -> void
|
|
46
|
+
|
|
47
|
+
# Returns the total token count across all categories.
|
|
48
|
+
#
|
|
49
|
+
# @rbs return: Integer
|
|
50
|
+
def total_tokens: () -> Integer
|
|
51
|
+
|
|
52
|
+
# Returns +true+ if any tokens have been counted.
|
|
53
|
+
#
|
|
54
|
+
# @rbs return: bool
|
|
55
|
+
def any?: () -> bool
|
|
56
|
+
|
|
57
|
+
# Returns the estimated cost in USD, or +nil+ if no pricing was provided.
|
|
58
|
+
#
|
|
59
|
+
# @rbs return: Float?
|
|
60
|
+
def estimated_cost: () -> Float?
|
|
61
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/tools/bash.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::Tools::Bash < Riffer::Tool
|
|
4
|
+
DEFAULT_TIMEOUT_MS: Integer
|
|
5
|
+
|
|
6
|
+
MAX_OUTPUT_BYTES: Integer
|
|
7
|
+
|
|
8
|
+
# @rbs context: Riffer::Agent::Context?
|
|
9
|
+
# @rbs command: String
|
|
10
|
+
# @rbs ?timeout_ms: Integer
|
|
11
|
+
# @rbs return: Riffer::Tools::Response
|
|
12
|
+
def call: (context: Riffer::Agent::Context?, command: String, ?timeout_ms: untyped) -> Riffer::Tools::Response
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
# @rbs command: String
|
|
17
|
+
# @rbs timeout_seconds: Float
|
|
18
|
+
# @rbs return: [String, Integer]
|
|
19
|
+
def run: (String command, Float timeout_seconds) -> [ String, Integer ]
|
|
20
|
+
|
|
21
|
+
# @rbs pid: Integer
|
|
22
|
+
# @rbs return: Integer
|
|
23
|
+
def kill_group: (Integer pid) -> Integer
|
|
24
|
+
|
|
25
|
+
# @rbs output: String
|
|
26
|
+
# @rbs return: String
|
|
27
|
+
def truncate: (String output) -> String
|
|
28
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/tools/edit.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::Tools::Edit < Riffer::Tool
|
|
4
|
+
# @rbs context: Riffer::Agent::Context?
|
|
5
|
+
# @rbs path: String
|
|
6
|
+
# @rbs old_string: String
|
|
7
|
+
# @rbs new_string: String
|
|
8
|
+
# @rbs ?replace_all: bool
|
|
9
|
+
# @rbs return: Riffer::Tools::Response
|
|
10
|
+
def call: (context: Riffer::Agent::Context?, path: String, old_string: String, new_string: String, ?replace_all: untyped) -> Riffer::Tools::Response
|
|
11
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/tools/read.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::Tools::Read < Riffer::Tool
|
|
4
|
+
DEFAULT_LIMIT: Integer
|
|
5
|
+
|
|
6
|
+
# @rbs context: Riffer::Agent::Context?
|
|
7
|
+
# @rbs path: String
|
|
8
|
+
# @rbs ?offset: Integer?
|
|
9
|
+
# @rbs ?limit: Integer
|
|
10
|
+
# @rbs return: Riffer::Tools::Response
|
|
11
|
+
def call: (context: Riffer::Agent::Context?, path: String, ?offset: untyped, ?limit: untyped) -> Riffer::Tools::Response
|
|
12
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/tools/write.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::Tools::Write < Riffer::Tool
|
|
4
|
+
# @rbs context: Riffer::Agent::Context?
|
|
5
|
+
# @rbs path: String
|
|
6
|
+
# @rbs content: String
|
|
7
|
+
# @rbs return: Riffer::Tools::Response
|
|
8
|
+
def call: (context: Riffer::Agent::Context?, path: String, content: String) -> Riffer::Tools::Response
|
|
9
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/animator.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Animated output is gated behind an interactive, colour-enabled TTY, so piped
|
|
4
|
+
# or tested runs stay silent and escape-free.
|
|
5
|
+
class Riffer::Rig::UI::Animator
|
|
6
|
+
REVEAL_FRAME_SECONDS: Float
|
|
7
|
+
|
|
8
|
+
SPINNER_FRAME_SECONDS: Float
|
|
9
|
+
|
|
10
|
+
EQ_LEVELS: Array[String]
|
|
11
|
+
|
|
12
|
+
EQ_BARS: Integer
|
|
13
|
+
|
|
14
|
+
NEUTRAL_LABEL: String
|
|
15
|
+
|
|
16
|
+
REASONING_PHRASES: Array[String]
|
|
17
|
+
|
|
18
|
+
REASONING_TICK_RANGE: Range[Integer]
|
|
19
|
+
|
|
20
|
+
@stop: bool
|
|
21
|
+
|
|
22
|
+
@phrase: String?
|
|
23
|
+
|
|
24
|
+
@mode: Symbol
|
|
25
|
+
|
|
26
|
+
@thread: Thread?
|
|
27
|
+
|
|
28
|
+
@theme: Riffer::Rig::UI::Theme
|
|
29
|
+
|
|
30
|
+
@io: untyped
|
|
31
|
+
|
|
32
|
+
# @rbs io: untyped
|
|
33
|
+
# @rbs ?theme: Riffer::Rig::UI::Theme
|
|
34
|
+
# @rbs return: void
|
|
35
|
+
def initialize: (?io: untyped, ?theme: untyped) -> void
|
|
36
|
+
|
|
37
|
+
# When not on a TTY, prints the final frame once instead of animating.
|
|
38
|
+
#
|
|
39
|
+
# @rbs frames: Array[Array[String]]
|
|
40
|
+
# @rbs return: void
|
|
41
|
+
def reveal: (Array[Array[String]] frames) -> void
|
|
42
|
+
|
|
43
|
+
# @rbs ?mode: Symbol
|
|
44
|
+
# @rbs return: void
|
|
45
|
+
def start: (?untyped mode) -> void
|
|
46
|
+
|
|
47
|
+
# @rbs return: void
|
|
48
|
+
def stop: () -> void
|
|
49
|
+
|
|
50
|
+
# @rbs tick: Integer
|
|
51
|
+
# @rbs ?label: String
|
|
52
|
+
# @rbs return: String
|
|
53
|
+
def equalizer: (Integer tick, ?untyped label) -> String
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
# @rbs return: void
|
|
58
|
+
def animate: () -> void
|
|
59
|
+
|
|
60
|
+
# Re-rolls both phrase and duration whenever the reasoning tick expires.
|
|
61
|
+
#
|
|
62
|
+
# @rbs roll_at: Float
|
|
63
|
+
# @rbs return: Float
|
|
64
|
+
def roll_phrase: (Float roll_at) -> Float
|
|
65
|
+
|
|
66
|
+
# Range rand returns nil for an empty range; this one is a non-empty constant.
|
|
67
|
+
#
|
|
68
|
+
# @rbs return: Integer
|
|
69
|
+
def roll_rand: () -> Integer
|
|
70
|
+
|
|
71
|
+
# @rbs return: String
|
|
72
|
+
def label: () -> String
|
|
73
|
+
|
|
74
|
+
# @rbs return: bool
|
|
75
|
+
def enabled?: () -> bool
|
|
76
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/banner.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Riffer::Rig::UI::Banner
|
|
4
|
+
WORDMARK: Array[String]
|
|
5
|
+
|
|
6
|
+
ROW_COLOURS: Array[Array[Integer]]
|
|
7
|
+
|
|
8
|
+
INFO_LABEL_WIDTH: Integer
|
|
9
|
+
|
|
10
|
+
INDENT: String
|
|
11
|
+
|
|
12
|
+
# @rbs theme: Riffer::Rig::UI::Theme
|
|
13
|
+
# @rbs model: String
|
|
14
|
+
# @rbs cwd: String
|
|
15
|
+
# @rbs context: String
|
|
16
|
+
# @rbs skills: String
|
|
17
|
+
# @rbs version: String
|
|
18
|
+
# @rbs return: String
|
|
19
|
+
def call: (Riffer::Rig::UI::Theme theme, model: String, cwd: String, context: String, skills: String, version: String) -> String
|
|
20
|
+
|
|
21
|
+
# @rbs theme: Riffer::Rig::UI::Theme
|
|
22
|
+
# @rbs model: String
|
|
23
|
+
# @rbs cwd: String
|
|
24
|
+
# @rbs context: String
|
|
25
|
+
# @rbs skills: String
|
|
26
|
+
# @rbs version: String
|
|
27
|
+
# @rbs return: Array[String]
|
|
28
|
+
def lines: (Riffer::Rig::UI::Theme theme, model: String, cwd: String, context: String, skills: String, version: String) -> Array[String]
|
|
29
|
+
|
|
30
|
+
# @rbs theme: Riffer::Rig::UI::Theme
|
|
31
|
+
# @rbs return: Array[String]
|
|
32
|
+
def art: (Riffer::Rig::UI::Theme theme) -> Array[String]
|
|
33
|
+
|
|
34
|
+
# @rbs theme: Riffer::Rig::UI::Theme
|
|
35
|
+
# @rbs model: String
|
|
36
|
+
# @rbs cwd: String
|
|
37
|
+
# @rbs context: String
|
|
38
|
+
# @rbs skills: String
|
|
39
|
+
# @rbs version: String
|
|
40
|
+
# @rbs return: Array[String]
|
|
41
|
+
def info: (Riffer::Rig::UI::Theme theme, model: String, cwd: String, context: String, skills: String, version: String) -> Array[String]
|
|
42
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/cursor.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Hides the terminal cursor while a turn is in flight: a hidden cursor can't
|
|
4
|
+
# flicker against the animator's erase-and-redraw churn.
|
|
5
|
+
class Riffer::Rig::UI::Cursor
|
|
6
|
+
HIDE: String
|
|
7
|
+
|
|
8
|
+
SHOW: String
|
|
9
|
+
|
|
10
|
+
@io: untyped
|
|
11
|
+
|
|
12
|
+
@theme: Riffer::Rig::UI::Theme
|
|
13
|
+
|
|
14
|
+
# @rbs io: untyped
|
|
15
|
+
# @rbs ?theme: Riffer::Rig::UI::Theme
|
|
16
|
+
# @rbs return: void
|
|
17
|
+
def initialize: (?io: untyped, ?theme: untyped) -> void
|
|
18
|
+
|
|
19
|
+
# @rbs return: void
|
|
20
|
+
def hide: () -> void
|
|
21
|
+
|
|
22
|
+
# @rbs return: void
|
|
23
|
+
def show: () -> void
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
# @rbs sequence: String
|
|
28
|
+
# @rbs return: void
|
|
29
|
+
def write: (String sequence) -> void
|
|
30
|
+
|
|
31
|
+
# @rbs return: bool
|
|
32
|
+
def enabled?: () -> bool
|
|
33
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/palette.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module Riffer::Rig::UI::Palette
|
|
4
|
+
PINK: Array[Integer]
|
|
5
|
+
|
|
6
|
+
MAGENTA: Array[Integer]
|
|
7
|
+
|
|
8
|
+
PURPLE: Array[Integer]
|
|
9
|
+
|
|
10
|
+
BLUE: Array[Integer]
|
|
11
|
+
|
|
12
|
+
CYAN: Array[Integer]
|
|
13
|
+
|
|
14
|
+
GREY: Array[Integer]
|
|
15
|
+
|
|
16
|
+
RED: Array[Integer]
|
|
17
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/renderer.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
class Riffer::Rig::UI::Renderer
|
|
4
|
+
RESULT_PREVIEW_LIMIT: Integer
|
|
5
|
+
|
|
6
|
+
@io: untyped
|
|
7
|
+
|
|
8
|
+
@theme: Riffer::Rig::UI::Theme
|
|
9
|
+
|
|
10
|
+
@tally: Riffer::Rig::TokenTally?
|
|
11
|
+
|
|
12
|
+
@smoother: Riffer::Rig::UI::Smoother | PassThroughSmoother?
|
|
13
|
+
|
|
14
|
+
# @rbs io: untyped
|
|
15
|
+
# @rbs ?theme: Riffer::Rig::UI::Theme
|
|
16
|
+
# @rbs ?tally: Riffer::Rig::TokenTally?
|
|
17
|
+
# @rbs ?smoother: Riffer::Rig::UI::Smoother | PassThroughSmoother?
|
|
18
|
+
# @rbs return: void
|
|
19
|
+
def initialize: (?io: untyped, ?theme: untyped, ?tally: untyped, ?smoother: untyped) -> void
|
|
20
|
+
|
|
21
|
+
# @rbs event: Riffer::StreamEvents::Base
|
|
22
|
+
# @rbs return: void
|
|
23
|
+
def render: (Riffer::StreamEvents::Base event) -> void
|
|
24
|
+
|
|
25
|
+
# @rbs message: Riffer::Messages::Base
|
|
26
|
+
# @rbs return: void
|
|
27
|
+
def render_tool_result: (Riffer::Messages::Base message) -> void
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# @rbs return: Riffer::Rig::UI::Smoother | PassThroughSmoother
|
|
32
|
+
def smoother: () -> (Riffer::Rig::UI::Smoother | PassThroughSmoother)
|
|
33
|
+
|
|
34
|
+
# Stand-in when no smoother is injected, so a bare Riffer::Rig::UI::Renderer still prints
|
|
35
|
+
# synchronously.
|
|
36
|
+
class PassThroughSmoother
|
|
37
|
+
@io: untyped
|
|
38
|
+
|
|
39
|
+
# @rbs io: untyped
|
|
40
|
+
# @rbs return: void
|
|
41
|
+
def initialize: (untyped io) -> void
|
|
42
|
+
|
|
43
|
+
# @rbs content: String
|
|
44
|
+
# @rbs return: self
|
|
45
|
+
def <<: (String content) -> self
|
|
46
|
+
|
|
47
|
+
# @rbs return: nil
|
|
48
|
+
def drain: () -> nil
|
|
49
|
+
|
|
50
|
+
# @rbs return: nil
|
|
51
|
+
def finish: () -> nil
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @rbs return: void
|
|
55
|
+
def drain_smoother: () -> void
|
|
56
|
+
|
|
57
|
+
# @rbs usage: Riffer::Providers::TokenUsage
|
|
58
|
+
# @rbs return: void
|
|
59
|
+
def render_token_usage: (Riffer::Providers::TokenUsage usage) -> void
|
|
60
|
+
|
|
61
|
+
# @rbs arguments: String
|
|
62
|
+
# @rbs return: String
|
|
63
|
+
def format_arguments: (String arguments) -> String
|
|
64
|
+
|
|
65
|
+
# @rbs content: String
|
|
66
|
+
# @rbs return: String
|
|
67
|
+
def preview: (String content) -> String
|
|
68
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/smoother.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Paces streamed text onto a 60fps cadence so API bursts read as continuous
|
|
4
|
+
# typing. On a non-TTY output it is transparent: writes pass through
|
|
5
|
+
# synchronously and no thread ever runs.
|
|
6
|
+
class Riffer::Rig::UI::Smoother
|
|
7
|
+
TICK_SECONDS: Float
|
|
8
|
+
|
|
9
|
+
# A frame removes only a sixtieth of the remaining backlog — an exponential
|
|
10
|
+
# decay whose tail keeps text flowing for a second or more, so the reveal
|
|
11
|
+
# never visibly stops between chunks. The carry accrues sub-character
|
|
12
|
+
# releases so the effective rate can settle at the provider's throughput;
|
|
13
|
+
# the floor is fractional (10 chars/s) so it can't over-drain a backlog
|
|
14
|
+
# that's trickling in slower than 60 chars/s.
|
|
15
|
+
BACKLOG_FRACTION_PER_TICK: Rational
|
|
16
|
+
|
|
17
|
+
MIN_CHARS_PER_TICK: Rational
|
|
18
|
+
|
|
19
|
+
@stop: bool
|
|
20
|
+
|
|
21
|
+
@thread: Thread?
|
|
22
|
+
|
|
23
|
+
@mutex: Mutex
|
|
24
|
+
|
|
25
|
+
@carry: Rational
|
|
26
|
+
|
|
27
|
+
@backlog: String
|
|
28
|
+
|
|
29
|
+
@clock: singleton(Kernel)
|
|
30
|
+
|
|
31
|
+
@theme: Riffer::Rig::UI::Theme
|
|
32
|
+
|
|
33
|
+
@io: untyped
|
|
34
|
+
|
|
35
|
+
# @rbs io: untyped
|
|
36
|
+
# @rbs ?theme: Riffer::Rig::UI::Theme
|
|
37
|
+
# @rbs clock: singleton(Kernel)
|
|
38
|
+
# @rbs return: void
|
|
39
|
+
def initialize: (?io: untyped, ?theme: untyped, ?clock: singleton(Kernel)) -> void
|
|
40
|
+
|
|
41
|
+
# @rbs return: void
|
|
42
|
+
def start: () -> void
|
|
43
|
+
|
|
44
|
+
# @rbs content: String
|
|
45
|
+
# @rbs return: self
|
|
46
|
+
def <<: (String content) -> self
|
|
47
|
+
|
|
48
|
+
# The write sits inside the mutex so a concurrent tick can't reorder a drain.
|
|
49
|
+
#
|
|
50
|
+
# @rbs return: void
|
|
51
|
+
def tick: () -> void
|
|
52
|
+
|
|
53
|
+
# Called before non-delta output so printed order matches stream order.
|
|
54
|
+
#
|
|
55
|
+
# @rbs return: void
|
|
56
|
+
def drain: () -> void
|
|
57
|
+
|
|
58
|
+
# Idempotent: the REPL's ensure path runs it even after a happy-path finish.
|
|
59
|
+
#
|
|
60
|
+
# @rbs return: void
|
|
61
|
+
def finish: () -> void
|
|
62
|
+
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
# @rbs return: bool
|
|
66
|
+
def enabled?: () -> bool
|
|
67
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Generated from lib/riffer/rig/ui/theme.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# +enabled+ gates every escape so the same code path emits plain, escape-free
|
|
4
|
+
# text when piped or tested.
|
|
5
|
+
class Riffer::Rig::UI::Theme
|
|
6
|
+
@enabled: bool
|
|
7
|
+
|
|
8
|
+
# @rbs return: bool
|
|
9
|
+
# @dynamic enabled
|
|
10
|
+
attr_reader enabled: bool
|
|
11
|
+
|
|
12
|
+
# @rbs enabled: bool
|
|
13
|
+
# @rbs return: void
|
|
14
|
+
def initialize: (enabled: bool) -> void
|
|
15
|
+
|
|
16
|
+
# @rbs io: untyped
|
|
17
|
+
# @rbs return: Riffer::Rig::UI::Theme
|
|
18
|
+
def self.for: (untyped io) -> Riffer::Rig::UI::Theme
|
|
19
|
+
|
|
20
|
+
# @rbs text: String
|
|
21
|
+
# @rbs rgb: Array[Integer]
|
|
22
|
+
# @rbs return: String
|
|
23
|
+
def paint: (String text, Array[Integer] rgb) -> String
|
|
24
|
+
|
|
25
|
+
# @rbs text: String
|
|
26
|
+
# @rbs return: String
|
|
27
|
+
def pink: (String text) -> String
|
|
28
|
+
|
|
29
|
+
# @rbs text: String
|
|
30
|
+
# @rbs return: String
|
|
31
|
+
def magenta: (String text) -> String
|
|
32
|
+
|
|
33
|
+
# @rbs text: String
|
|
34
|
+
# @rbs return: String
|
|
35
|
+
def purple: (String text) -> String
|
|
36
|
+
|
|
37
|
+
# @rbs text: String
|
|
38
|
+
# @rbs return: String
|
|
39
|
+
def blue: (String text) -> String
|
|
40
|
+
|
|
41
|
+
# @rbs text: String
|
|
42
|
+
# @rbs return: String
|
|
43
|
+
def cyan: (String text) -> String
|
|
44
|
+
|
|
45
|
+
# @rbs text: String
|
|
46
|
+
# @rbs return: String
|
|
47
|
+
def grey: (String text) -> String
|
|
48
|
+
|
|
49
|
+
# @rbs text: String
|
|
50
|
+
# @rbs return: String
|
|
51
|
+
def red: (String text) -> String
|
|
52
|
+
|
|
53
|
+
# @rbs text: String
|
|
54
|
+
# @rbs return: String
|
|
55
|
+
def dim: (String text) -> String
|
|
56
|
+
|
|
57
|
+
# @rbs text: String
|
|
58
|
+
# @rbs return: String
|
|
59
|
+
def bold: (String text) -> String
|
|
60
|
+
end
|