rubik 0.7.1 → 0.8.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/ATTRIBUTION.md +1 -1
- data/CHANGELOG.md +205 -1
- data/lib/rubik/ast/typescript_extractor.rb +2 -2
- data/lib/rubik/config/deep_ops.rb +14 -0
- data/lib/rubik/config/defaults.rb +5 -4
- data/lib/rubik/config/env_loader.rb +88 -0
- data/lib/rubik/config/model_catalog.rb +13 -0
- data/lib/rubik/config/pruner.rb +34 -0
- data/lib/rubik/config/schema.rb +163 -0
- data/lib/rubik/config/scoped.rb +108 -0
- data/lib/rubik/config/store.rb +19 -8
- data/lib/rubik/config.rb +129 -53
- data/lib/rubik/diagnostics/parser.rb +2 -2
- data/lib/rubik/kernel/dispatcher.rb +19 -23
- data/lib/rubik/kernel/init.rb +22 -18
- data/lib/rubik/orchestrator/goal_ledger/ledger.rb +3 -9
- data/lib/rubik/orchestrator/goal_ledger/observation_projection.rb +3 -9
- data/lib/rubik/orchestrator/step_executor.rb +12 -59
- data/lib/rubik/orchestrator/subagent/deferred_spec.rb +51 -2
- data/lib/rubik/orchestrator/subagent/dependency.rb +20 -20
- data/lib/rubik/orchestrator/subagent/execution_reads.rb +1 -1
- data/lib/rubik/orchestrator/subagent/journal.rb +3 -9
- data/lib/rubik/orchestrator/subagent/lifecycle.rb +10 -1
- data/lib/rubik/orchestrator/subagent/paging.rb +49 -0
- data/lib/rubik/orchestrator/subagent/reaper.rb +1 -3
- data/lib/rubik/orchestrator/subagent/redeploy_transaction.rb +99 -0
- data/lib/rubik/orchestrator/subagent/result_archive.rb +12 -22
- data/lib/rubik/orchestrator/subagent/reuse.rb +37 -31
- data/lib/rubik/orchestrator/subagent/scoped_registry.rb +14 -23
- data/lib/rubik/orchestrator/subagent/spawn_transaction.rb +13 -3
- data/lib/rubik/orchestrator/subagent/supervisor.rb +6 -2
- data/lib/rubik/orchestrator/subagent/task_ownership.rb +2 -2
- data/lib/rubik/orchestrator/subagent/tool_dispatch.rb +12 -49
- data/lib/rubik/orchestrator/subagent/transcript_reader.rb +14 -13
- data/lib/rubik/orchestrator/turn_executor.rb +9 -4
- data/lib/rubik/repl/commands/subagents.rb +3 -2
- data/lib/rubik/repl/commands/workspace.rb +14 -8
- data/lib/rubik/repl/lifecycle.rb +11 -0
- data/lib/rubik/repl/pruner/service.rb +4 -9
- data/lib/rubik/repl/service_catalog.rb +2 -1
- data/lib/rubik/runtime/context.rb +6 -1
- data/lib/rubik/runtime/fiber.rb +17 -5
- data/lib/rubik/runtime/manager.rb +19 -12
- data/lib/rubik/sandbox/runner.rb +28 -13
- data/lib/rubik/storage/layout.rb +14 -3
- data/lib/rubik/storage/render.rb +1 -1
- data/lib/rubik/storage/vakanuvis/distill_gate.rb +3 -3
- data/lib/rubik/storage/vakanuvis/harness.rb +4 -65
- data/lib/rubik/storage/vakanuvis/orientation.rb +1 -2
- data/lib/rubik/storage/vakanuvis/recall.rb +84 -0
- data/lib/rubik/storage/vakanuvis.rb +1 -0
- data/lib/rubik/tools/base.rb +65 -0
- data/lib/rubik/tools/builtins/define_subagent.rb +6 -0
- data/lib/rubik/tools/builtins/dmesg.rb +5 -5
- data/lib/rubik/tools/builtins/exec.rb +1 -2
- data/lib/rubik/tools/builtins/files.rb +19 -25
- data/lib/rubik/tools/builtins/goal_ledger.rb +2 -2
- data/lib/rubik/tools/builtins/grep.rb +8 -8
- data/lib/rubik/tools/builtins/interactive.rb +7 -3
- data/lib/rubik/tools/builtins/lifecycle.rb +2 -1
- data/lib/rubik/tools/builtins/lsp.rb +2 -2
- data/lib/rubik/tools/builtins/pruner.rb +2 -2
- data/lib/rubik/tools/builtins/runtime.rb +1 -1
- data/lib/rubik/tools/builtins/send_message.rb +20 -3
- data/lib/rubik/tools/builtins/skill.rb +1 -1
- data/lib/rubik/tools/builtins/storage.rb +1 -1
- data/lib/rubik/tools/builtins/subagent.rb +14 -1
- data/lib/rubik/tools/builtins/subagent_lifecycle.rb +5 -3
- data/lib/rubik/tools/builtins/symbols.rb +4 -4
- data/lib/rubik/tools/builtins/task.rb +1 -1
- data/lib/rubik/tools/builtins/vakanuvis.rb +2 -2
- data/lib/rubik/tools/catalog.rb +19 -0
- data/lib/rubik/tools/declaration.rb +15 -2
- data/lib/rubik/tools/result_normalizer.rb +115 -0
- data/lib/rubik/tools/truncator.rb +3 -3
- data/lib/rubik/version.rb +1 -1
- metadata +9 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e4570babb9dc3d48184b0285c431ef1d7fd37e5f900d1b745033d2f2fd7d35c0
|
|
4
|
+
data.tar.gz: 198350a1de0ef4233150c52445becc263b1456f013190d3400264ffde790ecfe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1c4761f4faf92b3d0c6fc8997196c92c975ec973a84ace43739a7cc433349ae8b266894cf024f4c66023d14592fd2e1aad416d53f41c5fe85d5d5adb7b8ff2af
|
|
7
|
+
data.tar.gz: 48c5177c5a1fe0e3209df5defd222845f9194d7f86cfd281cc9190cce3e332e9c7ad062a88243cd403a5ca94ef744bb5bf8f48f87afd85064ef913031e5f8eb2
|
data/ATTRIBUTION.md
CHANGED
|
@@ -121,7 +121,7 @@ SOFTWARE.
|
|
|
121
121
|
| **`strings-ansi`** | Piotr Murach | MIT | ANSI-aware string truncation and alignment for REPL formatters. |
|
|
122
122
|
| **`reline`** | Hiroshi SHIBATA & Ruby Team | Ruby License / BSD-2-Clause | Line-editing, history navigation, autocompletion hooks, and headless terminal adaptation. |
|
|
123
123
|
| **`prism`** | Kevin Newton & Ruby Core Team | MIT | High-performance Ruby parsing and AST extraction ([`Rubik::AST::RubyExtractor`](lib/rubik/ast/ruby_extractor.rb)). |
|
|
124
|
-
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,
|
|
124
|
+
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,200+ unit, integration, and contract tests. |
|
|
125
125
|
| **`rubocop`** | Bozhidar Batsov & contributors | MIT | Static code analysis, style enforcement, and architectural hygiene gates. |
|
|
126
126
|
| **`benchmark`, `logger`, `pstore`, `reline`, `fiddle`** | Ruby core / rubygems teams | Ruby License / BSD-2-Clause | Ruby stdlib gems pinned explicitly in `rubik.gemspec` as they are unbundled from the default set in Ruby 3.4/3.5. |
|
|
127
127
|
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,208 @@ commits, 2026-08-23 → 2026-10-09, see `git log`).
|
|
|
6
6
|
|
|
7
7
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
8
8
|
|
|
9
|
+
## [Unreleased]
|
|
10
|
+
|
|
11
|
+
## [0.8.1] - 2026-11-06
|
|
12
|
+
|
|
13
|
+
A reliability-and-single-homing patch: the kernel hardens the spatiotemporal
|
|
14
|
+
invariants (failure rollback, lock ordering, queue observability), the subagent
|
|
15
|
+
family converges on guarded state machines and truthful reporting for unborn
|
|
16
|
+
work, and five duplicated helpers (config_get, pagination window, coeffect
|
|
17
|
+
resolution, attention vocabulary, tombstone table) each collapse to one owner.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **Per-tool coeffect resolution unified behind `BaseTool#service` (#383):**
|
|
22
|
+
each builtin's private "fetch a service (or its subagent-plane fallback)"
|
|
23
|
+
dance now delegates to one Services-delegating helper, closing issue #368;
|
|
24
|
+
nil-guard on the fallback mock tightened in both `BaseTool#service` and
|
|
25
|
+
`SubagentToolHelpers`.
|
|
26
|
+
- **Shared pagination window extracted (ResultArchive ≅ TranscriptReader)
|
|
27
|
+
(#381):** the duplicated page-window slicing (offset/limit, ellipsis
|
|
28
|
+
framing) moved into one module closing issue #374; the predicate exposed
|
|
29
|
+
via `alias_method` to satisfy rubocop without renaming call sites.
|
|
30
|
+
- **Five `config_get` copies converged on `Layout.config_get` (#382):** the
|
|
31
|
+
string/symbol dotted-key access duplicated across five call sites now
|
|
32
|
+
delegates to one superset helper closing issue #373.
|
|
33
|
+
- **DeferredSpec transitions guarded like the family contract (#372):** the
|
|
34
|
+
raw `attr_accessor` written from six supervisor sites became a
|
|
35
|
+
`TRANSITIONS`-guarded machine (`mark_spawning!`/`requeue!`/`cancel!`,
|
|
36
|
+
fail-loud `StateError` on undeclared edges, same-state idempotency,
|
|
37
|
+
first-reason-wins cancellation), so an illegal edge can no longer fail
|
|
38
|
+
silently and `cancel_spec!`'s inline twin is gone.
|
|
39
|
+
- **Attention vocabulary derived from Lifecycle (#376):** the tool plane's
|
|
40
|
+
hand-copied "needs attention" state set moved beside `TRANSITIONS` in
|
|
41
|
+
`lifecycle.rb` (`PARKED_STATES`/`ATTENTION_STATES`, `parked?` recomposed
|
|
42
|
+
under one monitor acquisition); `TranscriptReader::ACTIVE_STATES` drops
|
|
43
|
+
its dead `:queued` entry — an Instance can never hold that state.
|
|
44
|
+
- **Tombstone table single-owned (#370):** the finished table is born in the
|
|
45
|
+
constructor alongside `@instances`/`@deferred` instead of relying on nine
|
|
46
|
+
defensive `@finished ||= {}`-style sites across seven files; semantics
|
|
47
|
+
unchanged.
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **Kernel & Runtime Composability & Resilience Hardening (F1-F5) (#380):**
|
|
52
|
+
- **Fiber Failure Reversibility (F1):** `ComponentFiber#activate!` now rolls back partial inverses on `Interrupt`, `SystemExit`, and non-`StandardError` signals before re-raising, eliminating leaked sub-contexts and unexecuted inverses.
|
|
53
|
+
- **Fail-Fast Provide on Disposed Context (F2):** `Context#provide` and `Manager#provide` now raise `ContextDisposedError` when invoked on a disposed context/manager instead of silently dropping services.
|
|
54
|
+
- **Context Dispose Lock-Order (F3):** `Context#dispose` now resolves `dmesg` outside `@monitor.synchronize`, preserving strict parent→child locking across context hierarchies and preventing latent deadlocks.
|
|
55
|
+
- **Monitor Scope Decoupling (F4):** `Init#kill_all`, `Init#reap_dead_units!`, and `Manager#dispose!` now take snapshots under the monitor and invoke external teardown/kills outside the lock, preventing blocking of supervisor inspection methods (`Init#get`, `Manager#active_fibers`).
|
|
56
|
+
- **Dispatcher Queue Watermark Observability (F5):** `Dispatcher#post` now emits a warning to the logger and `dmesg` when queue depth reaches high watermarks (`DEFAULT_WARN_QUEUE_DEPTH = 1000`), enhancing event queue visibility under high throughput.
|
|
57
|
+
- **Redeploy rolls back its transaction like spawn (#371):** a settle race
|
|
58
|
+
(reaper archive/kill between the redeployable? check and the guarded reset)
|
|
59
|
+
or any raise after the irreversible `redeploy_for!` mutation previously
|
|
60
|
+
leaked the freshly extended child context, a mutated instance, a registered
|
|
61
|
+
unit — and when `start_async` flipped then aborted, a `:running` zombie
|
|
62
|
+
holding a concurrency slot forever; the spawn-style rollback now covers it.
|
|
63
|
+
- **Queued and launching specs reported truthfully (#375):** `invoke_subagent`
|
|
64
|
+
no longer answers `:queued` for a requeue the cancelled-guard refused,
|
|
65
|
+
`send_message` to a queued spec names the deps and the real next actions
|
|
66
|
+
instead of "redeploy it" (false twice over), and the REPL list prints
|
|
67
|
+
"queued/launching (waiting on: ...)" instead of "ended (0.0s)" for a
|
|
68
|
+
mid-launch spec.
|
|
69
|
+
- **Deps:** `tree_sitter_language_pack` 1.22.1 → 1.23.1 (#379), rubocop dev
|
|
70
|
+
dep 1.92.1 → 1.92.2 (#378), CI `actions/cache` v4 → v6 (#377).
|
|
71
|
+
|
|
72
|
+
## [0.8.0] - 2026-11-05
|
|
73
|
+
|
|
74
|
+
A configuration-architecture minor: the write plane goes strict — typed
|
|
75
|
+
schema enforcement, layered composable configuration with delta pruning,
|
|
76
|
+
and a universal 12-factor environment loader — while the toolbelt deepens
|
|
77
|
+
around it (single-homed argument access and output normalization,
|
|
78
|
+
tool-owned plane membership, tool-owned terminal flag) and the vakanüvis
|
|
79
|
+
recall plane is extracted from the Harness. Existing configs carrying
|
|
80
|
+
out-of-spec values (a removed `buffer.auto_apply` value, an out-of-range
|
|
81
|
+
integer) will fail boot loudly — the value was never reaching a consumer
|
|
82
|
+
anyway.
|
|
83
|
+
|
|
84
|
+
### Added
|
|
85
|
+
|
|
86
|
+
- **Layered composable configuration (#362):** a five-layer model
|
|
87
|
+
(`@defaults` → `@global` → `@project` → `@env` → `@session`) with
|
|
88
|
+
automated delta persistence that prunes redundancy against
|
|
89
|
+
`DEFAULT_CONFIG` on save; `config.extend` scoped child configurations
|
|
90
|
+
for subagent context isolation; strict typed schema validation
|
|
91
|
+
(`Schema`) with boundary checks and scalar coercion; a 12-factor
|
|
92
|
+
universal environment loader (`RUBIK_<SECTION>_<KEY>`) with a legacy
|
|
93
|
+
deprecation bridge; revertible configuration mutations
|
|
94
|
+
(`set_revertible`) with reactive delete events; and lifecycle-aligned
|
|
95
|
+
observers (Sandbox::Runner, REPL observers) bound to `Context#on_dispose`.
|
|
96
|
+
The `!config set` operator surface is hardened to be operator-only
|
|
97
|
+
against autonomous agent tampering.
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
|
|
101
|
+
- **Single-homed model-supplied argument access in `BaseTool#param`
|
|
102
|
+
(#367):** ~110 builtin call sites across four string/symbol
|
|
103
|
+
normalization dialects (||-chains, `.to_i/.to_s.strip` postfix,
|
|
104
|
+
`== true` flag compares, hash-fetch) now delegate to
|
|
105
|
+
`param(args, *keys, type:, default:)`, keeping the old chains' byte
|
|
106
|
+
semantics — string key before symbol key per key, first non-nil wins,
|
|
107
|
+
`false` falls through to the default exactly like the old ||-chains,
|
|
108
|
+
type coercion applied to the resolved value and the default. The three
|
|
109
|
+
densest files (files, grep, dmesg) migrate first; remaining builtins
|
|
110
|
+
migrate per-touch, and rescue ladders stay deliberately untouched.
|
|
111
|
+
- **Tool-output normalization single-homed (#365):** the root StepExecutor and the
|
|
112
|
+
subagent ToolDispatch each carried a private copy of the carrier
|
|
113
|
+
classification (Result / status-duck / raw string), the error-prefix
|
|
114
|
+
lexicon and the truncation-knob fetch. Both planes now delegate to
|
|
115
|
+
`Rubik::Tools::ResultNormalizer`; the parity suite stays as anti-drift
|
|
116
|
+
insurance and a non-fetchable config object now warns once instead of
|
|
117
|
+
silently dropping operator-set truncation limits. Subagent-plane edge
|
|
118
|
+
cases (blank error first line, error?/failed? precedence) unified onto
|
|
119
|
+
the root behavior, pinned by tests.
|
|
120
|
+
- **Tool plane membership declared on the tool (#366):** ScopedRegistry's
|
|
121
|
+
hand-maintained `ROOT_ONLY_TOOLS` / `BUFFER_BOUND_TOOLS` name lists now
|
|
122
|
+
project from the tools' own `Declaration`s (`root_only:`, `buffer_bound:`)
|
|
123
|
+
via `Catalog` — the same declaration→projection pattern the archetype
|
|
124
|
+
allowlists, spawn set, write gate and maestro gate already use.
|
|
125
|
+
- **Vakanüvis recall plane extracted (#363):** the deterministic recall prose and
|
|
126
|
+
the RECALL_* policy constants moved out of the Harness thread core into
|
|
127
|
+
a pure Recall module - Harness#recall is now a one-line delegate, the
|
|
128
|
+
verbatim first_body_line duplication between Harness and Orientation is
|
|
129
|
+
gone, and Orientation/DistillGate no longer reach into Harness constants.
|
|
130
|
+
- **Terminal flag and plane rebinds declared on the tool (#369):** finish
|
|
131
|
+
was string-compared at four dispatch sites — `Declaration` gains
|
|
132
|
+
`terminal:`, the FinishTool declares it and `Catalog` projects
|
|
133
|
+
`terminal_tools`, with the name compare kept as the duck-typed fallback
|
|
134
|
+
so fake registries and Declaration-less finish tools still complete the
|
|
135
|
+
turn. The five tool classes ScopedRegistry case-matched onto the
|
|
136
|
+
subagent plane now own `rebind_to(ctx)`, reusing their own
|
|
137
|
+
`resolve_supervisor`; constructor knowledge and the rebind live in one
|
|
138
|
+
place per tool.
|
|
139
|
+
|
|
140
|
+
### Fixed
|
|
141
|
+
|
|
142
|
+
- **Strict typed schema enforcement (#364):** `Config#set`, `Scoped#set`, and
|
|
143
|
+
`Scoped` constructor overrides now reject values that violate
|
|
144
|
+
`Schema::DEFINITIONS` (previously the validation result was ignored —
|
|
145
|
+
e.g. `set("agent.max_steps", 0)` was silently accepted). The per-key
|
|
146
|
+
prompt-grace escape hatch is gone; the schema is the single validation
|
|
147
|
+
authority, including whole-section writes (nested leaves are coerced
|
|
148
|
+
first) and boot-time merged-tree validation. The stale
|
|
149
|
+
`buffer.auto_apply` enum gained the documented `on_test`/`on_finish`
|
|
150
|
+
modes, `sandbox.driver` became free-form (the driver registry is
|
|
151
|
+
plugin-extensible), and `tools.call_timeout` accepts `0` as its
|
|
152
|
+
documented off value.
|
|
153
|
+
- **Phantom legacy env mappings removed (#364):** six `LEGACY_MAP` entries pointed
|
|
154
|
+
at config keys no consumer reads (their real consumers read ENV
|
|
155
|
+
directly), so their deprecation advice was false and the mapped values
|
|
156
|
+
tripped "Unknown config key" warnings. Only config-backed legacy
|
|
157
|
+
variables remain.
|
|
158
|
+
- **CodeQL ReDoS and sanitization alerts resolved:** the four polynomial
|
|
159
|
+
backtracking quantifiers from the previous ReDoS pass converted to
|
|
160
|
+
possessive forms whose boundaries are forced by characters outside
|
|
161
|
+
their classes (captures and match results unchanged, backtracking
|
|
162
|
+
removed), and listing titles truncate before escaping so an escape
|
|
163
|
+
pair can no longer be cut in half. Closes the 5 open code scanning
|
|
164
|
+
alerts (#12, #33, #34, #35, #36).
|
|
165
|
+
- **Storage markdown cell escaping single-passed:** the two-gsub
|
|
166
|
+
backslash-then-pipe chain replaced with one pass over the character
|
|
167
|
+
class; the mapping is byte-identical (backslash doubles, pipe gains a
|
|
168
|
+
backslash) and truncation can no longer split an escape sequence.
|
|
169
|
+
|
|
170
|
+
## [0.7.1] - 2026-11-04
|
|
171
|
+
the RECALL_* policy constants moved out of the Harness thread core into
|
|
172
|
+
a pure Recall module - Harness#recall is now a one-line delegate, the
|
|
173
|
+
verbatim first_body_line duplication between Harness and Orientation is
|
|
174
|
+
gone, and Orientation/DistillGate no longer reach into Harness constants.
|
|
175
|
+
|
|
176
|
+
- **Tool-output normalization single-homed:** the root StepExecutor and the
|
|
177
|
+
subagent ToolDispatch each carried a private copy of the carrier
|
|
178
|
+
classification (Result / status-duck / raw string), the error-prefix
|
|
179
|
+
lexicon and the truncation-knob fetch. Both planes now delegate to
|
|
180
|
+
`Rubik::Tools::ResultNormalizer`; the parity suite stays as anti-drift
|
|
181
|
+
insurance and a non-fetchable config object now warns once instead of
|
|
182
|
+
silently dropping operator-set truncation limits. Subagent-plane edge
|
|
183
|
+
cases (blank error first line, error?/failed? precedence) unified onto
|
|
184
|
+
the root behavior, pinned by tests.
|
|
185
|
+
|
|
186
|
+
- **Tool plane membership declared on the tool:** ScopedRegistry's
|
|
187
|
+
hand-maintained `ROOT_ONLY_TOOLS` / `BUFFER_BOUND_TOOLS` name lists now
|
|
188
|
+
project from the tools' own `Declaration`s (`root_only:`, `buffer_bound:`)
|
|
189
|
+
via `Catalog` — the same declaration→projection pattern the archetype
|
|
190
|
+
allowlists, spawn set, write gate and maestro gate already use.
|
|
191
|
+
|
|
192
|
+
### Fixed
|
|
193
|
+
|
|
194
|
+
- **Strict typed schema enforcement:** `Config#set`, `Scoped#set`, and
|
|
195
|
+
`Scoped` constructor overrides now reject values that violate
|
|
196
|
+
`Schema::DEFINITIONS` (previously the validation result was ignored —
|
|
197
|
+
e.g. `set("agent.max_steps", 0)` was silently accepted). The per-key
|
|
198
|
+
prompt-grace escape hatch is gone; the schema is the single validation
|
|
199
|
+
authority, including whole-section writes (nested leaves are coerced
|
|
200
|
+
first) and boot-time merged-tree validation. The stale
|
|
201
|
+
`buffer.auto_apply` enum gained the documented `on_test`/`on_finish`
|
|
202
|
+
modes, `sandbox.driver` became free-form (the driver registry is
|
|
203
|
+
plugin-extensible), and `tools.call_timeout` accepts `0` as its
|
|
204
|
+
documented off value.
|
|
205
|
+
- **Phantom legacy env mappings removed:** six `LEGACY_MAP` entries pointed
|
|
206
|
+
at config keys no consumer reads (their real consumers read ENV
|
|
207
|
+
directly), so their deprecation advice was false and the mapped values
|
|
208
|
+
tripped "Unknown config key" warnings. Only config-backed legacy
|
|
209
|
+
variables remain.
|
|
210
|
+
|
|
9
211
|
## [0.7.1] - 2026-11-04
|
|
10
212
|
|
|
11
213
|
An LSP maturity patch: the language-server integration comes back from
|
|
@@ -1165,7 +1367,9 @@ installation section.
|
|
|
1165
1367
|
- Context: serialized index mutations, snapshot-outside-lock reconcile,
|
|
1166
1368
|
streaming-first truncation.
|
|
1167
1369
|
|
|
1168
|
-
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.
|
|
1370
|
+
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.8.1...HEAD
|
|
1371
|
+
[0.8.1]: https://github.com/ozgurulukir/rubik/compare/v0.8.0...v0.8.1
|
|
1372
|
+
[0.8.0]: https://github.com/ozgurulukir/rubik/compare/v0.7.1...v0.8.0
|
|
1169
1373
|
[0.7.1]: https://github.com/ozgurulukir/rubik/compare/v0.7.0...v0.7.1
|
|
1170
1374
|
[0.7.0]: https://github.com/ozgurulukir/rubik/compare/v0.6.0...v0.7.0
|
|
1171
1375
|
[0.6.0]: https://github.com/ozgurulukir/rubik/compare/v0.5.0...v0.6.0
|
|
@@ -185,7 +185,7 @@ module Rubik
|
|
|
185
185
|
next_i = end_line > line_num ? end_line - 1 : idx
|
|
186
186
|
[sym, next_i]
|
|
187
187
|
elsif (match = stripped.match(
|
|
188
|
-
/^(?:export\s
|
|
188
|
+
/^(?:export\s++)?(?:const|let|var)\s++([A-Za-z0-9_$]++)(?:\s*+:\s*+[^=]++)?\s*+=\s*+(?:async\s*+)?(?:\([^)]*+\)|[A-Za-z0-9_$]++)\s*+=>/
|
|
189
189
|
)) ||
|
|
190
190
|
(match = stripped.match(/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z0-9_$]+)\s*=\s*(?:async\s*)?function\b/))
|
|
191
191
|
fn_name = match[1]
|
|
@@ -210,7 +210,7 @@ module Rubik
|
|
|
210
210
|
|
|
211
211
|
def parse_method(line, stripped, line_num, idx, current_class)
|
|
212
212
|
return unless (match = stripped.match(
|
|
213
|
-
/^(?:(?:public|private|protected|static|async|get|set)\s
|
|
213
|
+
/^(?:(?:public|private|protected|static|async|get|set)\s++)*([A-Za-z0-9_$]++)\s*+\([^)]*+\)(?:\s*+:\s*+[^{]++)?\s*+\{/
|
|
214
214
|
))
|
|
215
215
|
|
|
216
216
|
method_name = match[1]
|
|
@@ -75,6 +75,20 @@ module Rubik
|
|
|
75
75
|
|
|
76
76
|
node.delete(keys.last) ? :deleted : :absent
|
|
77
77
|
end
|
|
78
|
+
|
|
79
|
+
# Sets a dot-path leaf in nested string-keyed hashes, creating intermediate
|
|
80
|
+
# Hash nodes as needed.
|
|
81
|
+
def deep_set_key(target_hash, path, value)
|
|
82
|
+
return unless target_hash.is_a?(Hash)
|
|
83
|
+
|
|
84
|
+
keys = path.to_s.split(".")
|
|
85
|
+
last_key = keys.pop
|
|
86
|
+
target = keys.reduce(target_hash) do |acc, k|
|
|
87
|
+
acc[k] = {} unless acc[k].is_a?(Hash)
|
|
88
|
+
acc[k]
|
|
89
|
+
end
|
|
90
|
+
target[last_key] = value
|
|
91
|
+
end
|
|
78
92
|
end
|
|
79
93
|
end
|
|
80
94
|
end
|
|
@@ -222,10 +222,11 @@ module Rubik
|
|
|
222
222
|
|
|
223
223
|
private
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
# Schema-backed keys must satisfy their spec wherever the merged tree is validated.
|
|
226
|
+
def validate_typed_value!(key, value)
|
|
227
|
+
return unless Schema::DEFINITIONS.key?(key.to_s)
|
|
227
228
|
|
|
228
|
-
|
|
229
|
+
Schema.validate_value!(key, value, strict: true)
|
|
229
230
|
end
|
|
230
231
|
|
|
231
232
|
def validate_schema(config, schema = DEFAULT_CONFIG, prefix = "", strict: false)
|
|
@@ -233,7 +234,7 @@ module Rubik
|
|
|
233
234
|
|
|
234
235
|
config.each do |key, val|
|
|
235
236
|
current_key = prefix.empty? ? key.to_s : "#{prefix}.#{key}"
|
|
236
|
-
|
|
237
|
+
validate_typed_value!(current_key, val)
|
|
237
238
|
if schema.is_a?(Hash) && !schema.key?(key.to_s)
|
|
238
239
|
candidate_keys = schema.keys
|
|
239
240
|
candidates = defined?(Rubik::Tools::FuzzyMatcher) ? Rubik::Tools::FuzzyMatcher.best_matches(key.to_s, candidate_keys) : []
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "schema"
|
|
4
|
+
require_relative "defaults"
|
|
5
|
+
|
|
6
|
+
module Rubik
|
|
7
|
+
class Config
|
|
8
|
+
# 12-Factor Universal Environment Variable Loader (AGENTS.md & Plan Remedy Phase 3).
|
|
9
|
+
# Discovers RUBIK_<SECTION>_<KEY> environment variables, coerces them to typed values,
|
|
10
|
+
# and populates Layer 3 of the configuration stack.
|
|
11
|
+
# Provides a backward-compatible deprecation bridge for legacy variables.
|
|
12
|
+
# Only variables with a real config-backed key belong here; consumers that
|
|
13
|
+
# read ENV directly (concurrency, overlays, native search, test armor)
|
|
14
|
+
# never flow through this map.
|
|
15
|
+
module EnvLoader
|
|
16
|
+
LEGACY_MAP = {
|
|
17
|
+
"RUBIK_NATIVE" => "tools.native",
|
|
18
|
+
"RUBIK_TOOLS_CALL_TIMEOUT" => "tools.call_timeout",
|
|
19
|
+
"RUBIK_LOG_LEVEL" => "ui.verbosity"
|
|
20
|
+
}.freeze
|
|
21
|
+
|
|
22
|
+
module_function
|
|
23
|
+
|
|
24
|
+
def load_env(env = ENV, schema = Defaults::DEFAULT_CONFIG, warnings = [])
|
|
25
|
+
resolved = {}
|
|
26
|
+
|
|
27
|
+
# 1. Parse RUBIK_<SECTION>_<KEY> universal patterns
|
|
28
|
+
env.each do |k, v|
|
|
29
|
+
next unless k.start_with?("RUBIK_")
|
|
30
|
+
|
|
31
|
+
stripped = k.delete_prefix("RUBIK_").downcase
|
|
32
|
+
parts = stripped.split("_")
|
|
33
|
+
matching_key = match_schema_key(parts, schema)
|
|
34
|
+
if matching_key
|
|
35
|
+
coerced = Schema.coerce(matching_key, v)
|
|
36
|
+
deep_set(resolved, matching_key, coerced)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# 2. Process legacy variables with deprecation notice if canonical variable was unset
|
|
41
|
+
LEGACY_MAP.each do |legacy_name, dot_key|
|
|
42
|
+
next unless env.key?(legacy_name)
|
|
43
|
+
|
|
44
|
+
current_val = deep_fetch(resolved, dot_key)
|
|
45
|
+
next unless current_val.nil?
|
|
46
|
+
|
|
47
|
+
raw_val = env[legacy_name]
|
|
48
|
+
coerced = Schema.coerce(dot_key, raw_val)
|
|
49
|
+
deep_set(resolved, dot_key, coerced)
|
|
50
|
+
warnings << "[DEPRECATION] Environment variable '#{legacy_name}' is deprecated. Use the universal format 'RUBIK_#{dot_key.upcase.tr('.', '_')}' instead."
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
resolved
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def match_schema_key(parts, schema, prefix = "")
|
|
57
|
+
(1..parts.length).each do |len|
|
|
58
|
+
head = parts[0...len].join("_")
|
|
59
|
+
tail = parts[len..]
|
|
60
|
+
full = prefix.empty? ? head : "#{prefix}.#{head}"
|
|
61
|
+
|
|
62
|
+
next unless schema.is_a?(Hash) && schema.key?(head)
|
|
63
|
+
return full if tail.empty?
|
|
64
|
+
|
|
65
|
+
nested = match_schema_key(tail, schema[head], full)
|
|
66
|
+
return nested if nested
|
|
67
|
+
end
|
|
68
|
+
nil
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def deep_set(hash, dotted_key, value)
|
|
72
|
+
keys = dotted_key.split(".")
|
|
73
|
+
last = keys.pop
|
|
74
|
+
node = keys.reduce(hash) { |acc, k| acc[k] ||= {} }
|
|
75
|
+
node[last] = value
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def deep_fetch(hash, dotted_key)
|
|
79
|
+
keys = dotted_key.split(".")
|
|
80
|
+
keys.reduce(hash) do |acc, k|
|
|
81
|
+
return nil unless acc.is_a?(Hash) && acc.key?(k)
|
|
82
|
+
|
|
83
|
+
acc[k]
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -22,6 +22,19 @@ module Rubik
|
|
|
22
22
|
|
|
23
23
|
@data["model"] = spec_hash.dup if role_str == "default"
|
|
24
24
|
|
|
25
|
+
if persisting?(persist)
|
|
26
|
+
scope_sym = persist.to_s.downcase.to_sym == :project ? :project : :global
|
|
27
|
+
layer = scope_sym == :project ? (@project_layer ||= {}) : (@global_layer ||= {})
|
|
28
|
+
layer["models"] ||= {}
|
|
29
|
+
layer["models"][role_str] = deep_dup(spec_hash)
|
|
30
|
+
layer["model"] = deep_dup(spec_hash) if role_str == "default"
|
|
31
|
+
else
|
|
32
|
+
@session_layer ||= {}
|
|
33
|
+
@session_layer["models"] ||= {}
|
|
34
|
+
@session_layer["models"][role_str] = deep_dup(spec_hash)
|
|
35
|
+
@session_layer["model"] = deep_dup(spec_hash) if role_str == "default"
|
|
36
|
+
end
|
|
37
|
+
|
|
25
38
|
res = persisting?(persist) ? persist_result(save!(persist)) : { ok: true }
|
|
26
39
|
res[:reason] = :persist_failed unless res[:ok]
|
|
27
40
|
notify_change("models.#{role_str}", spec_hash, old_spec)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "defaults"
|
|
4
|
+
|
|
5
|
+
module Rubik
|
|
6
|
+
class Config
|
|
7
|
+
# Automated redundancy pruner (AGENTS.md Spatiotemporal Remedy).
|
|
8
|
+
# Deeply prunes keys from `target` that are identical to `reference`.
|
|
9
|
+
# Preserves explicit non-default overrides and custom unmanaged keys.
|
|
10
|
+
# Drops redundant inherited defaults, shrinking disk files to true deltas.
|
|
11
|
+
module Pruner
|
|
12
|
+
module_function
|
|
13
|
+
|
|
14
|
+
def prune(target, reference = Defaults::DEFAULT_CONFIG)
|
|
15
|
+
return target unless target.is_a?(Hash) && reference.is_a?(Hash)
|
|
16
|
+
|
|
17
|
+
pruned = {}
|
|
18
|
+
target.each do |k, v|
|
|
19
|
+
k_str = k.to_s
|
|
20
|
+
has_key = reference.key?(k_str)
|
|
21
|
+
ref_val = reference[k_str]
|
|
22
|
+
|
|
23
|
+
if v.is_a?(Hash) && ref_val.is_a?(Hash)
|
|
24
|
+
nested = prune(v, ref_val)
|
|
25
|
+
pruned[k_str] = nested unless nested.empty?
|
|
26
|
+
elsif !has_key || v != ref_val
|
|
27
|
+
pruned[k_str] = v
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
pruned
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rubik
|
|
4
|
+
class Config
|
|
5
|
+
# Typed schema definition, boundary validation, and scalar coercion engine
|
|
6
|
+
# (AGENTS.md & Plan Remedy Phase 3). Eliminates primitive obsession across
|
|
7
|
+
# subsystems while preserving fail-soft backward compatibility.
|
|
8
|
+
module Schema
|
|
9
|
+
DEFINITIONS = {
|
|
10
|
+
"llm.stream" => { type: :boolean },
|
|
11
|
+
"llm.stream_timeout" => { type: :integer, min: 1 },
|
|
12
|
+
"llm.open_timeout" => { type: :integer, min: 1 },
|
|
13
|
+
"llm.default_max_output_tokens" => { type: :integer, min: 1 },
|
|
14
|
+
"llm.capture_reasoning" => { type: :boolean },
|
|
15
|
+
"llm.auto_continue_on_length" => { type: :boolean },
|
|
16
|
+
"llm.max_auto_continues" => { type: :integer, min: 0 },
|
|
17
|
+
"llm.thinking_budget_ratio" => { type: :float, min: 0.0, max: 0.8, nullable: true },
|
|
18
|
+
"llm.reasoning_effort" => { type: :enum, allowed: ["low", "medium", "high"], nullable: true },
|
|
19
|
+
"agent.max_steps" => { type: :integer, min: 1 },
|
|
20
|
+
"agent.goal_max_steps" => { type: :integer, min: 1 },
|
|
21
|
+
"agent.plan_max_steps" => { type: :integer, min: 1 },
|
|
22
|
+
"agent.warn_at_ratio" => { type: :float, min: 0.0, max: 1.0 },
|
|
23
|
+
"agent.ask_continue_on_limit" => { type: :boolean },
|
|
24
|
+
"tools.timeout_seconds" => { type: :integer, min: 1 },
|
|
25
|
+
"tools.max_output_chars" => { type: :integer, min: 100 },
|
|
26
|
+
"tools.max_output_lines" => { type: :integer, min: 10 },
|
|
27
|
+
"tools.truncation_strategy" => { type: :enum, allowed: ["head_tail", "head_only", "tail_only"] },
|
|
28
|
+
# min 0: 0 is a documented disable value (tool_timeout treats <=0 as off).
|
|
29
|
+
"tools.call_timeout" => { type: :integer, min: 0, nullable: true },
|
|
30
|
+
"tools.native" => { type: :enum, allowed: ["auto", "on", "off"] },
|
|
31
|
+
"router.mode" => { type: :enum, allowed: ["auto", "manual", "fast", "advanced"] },
|
|
32
|
+
"router.sticky" => { type: :boolean },
|
|
33
|
+
"repair.max_attempts" => { type: :integer, min: 0 },
|
|
34
|
+
"sandbox.enabled" => { type: :boolean },
|
|
35
|
+
# Free-form: the driver registry is dynamically extensible (plugins
|
|
36
|
+
# register drivers at runtime), so the value space is not closed.
|
|
37
|
+
"sandbox.driver" => { type: :string },
|
|
38
|
+
"sandbox.timeout_seconds" => { type: :integer, min: 1 },
|
|
39
|
+
"sandbox.memory_limit_mb" => { type: :integer, min: 16 },
|
|
40
|
+
"sandbox.allow_network" => { type: :boolean },
|
|
41
|
+
"sandbox.shell" => { type: :enum, allowed: ["auto", "bash", "powershell"] },
|
|
42
|
+
"security.allow_safe_probes" => { type: :boolean },
|
|
43
|
+
"security.command_allowlist" => { type: :array },
|
|
44
|
+
"network.allow" => { type: :boolean },
|
|
45
|
+
"buffer.auto_apply" => { type: :enum, allowed: ["manual", "on_test", "on_finish", "always"] },
|
|
46
|
+
"buffer.model_can_apply" => { type: :boolean },
|
|
47
|
+
"buffer.prompt_indicator" => { type: :boolean },
|
|
48
|
+
"buffer.exit_guard" => { type: :boolean },
|
|
49
|
+
"buffer.reminder_interval" => { type: :integer, min: 0 },
|
|
50
|
+
"ui.verbosity" => { type: :enum, allowed: ["quiet", "normal", "verbose", "debug", "trace", "0", "1", "2", "3"] },
|
|
51
|
+
"ui.color" => { type: :enum, allowed: ["auto", "always", "never"] },
|
|
52
|
+
"ui.glyphs" => { type: :enum, allowed: ["unicode", "ascii"] },
|
|
53
|
+
"ui.banner" => { type: :boolean },
|
|
54
|
+
"ui.spinner" => { type: :boolean },
|
|
55
|
+
"ui.markdown" => { type: :enum, allowed: ["live", "off"] },
|
|
56
|
+
"ui.statusline" => { type: :boolean },
|
|
57
|
+
"ui.prompt_grace_window_ms" => { type: :integer, min: 0 },
|
|
58
|
+
"workspace.allow_external_writes" => { type: :boolean },
|
|
59
|
+
"workspace.auto_index_additional" => { type: :boolean },
|
|
60
|
+
"subagents.max_concurrency" => { type: :integer, min: 1 },
|
|
61
|
+
"subagents.max_depth" => { type: :integer, min: 1 },
|
|
62
|
+
"subagents.default_max_steps" => { type: :integer, min: 1 },
|
|
63
|
+
"subagents.max_total_steps" => { type: :integer, min: 1 }
|
|
64
|
+
}.freeze
|
|
65
|
+
|
|
66
|
+
module_function
|
|
67
|
+
|
|
68
|
+
def validate_value!(key, val, strict: false)
|
|
69
|
+
spec = DEFINITIONS[key.to_s]
|
|
70
|
+
return true unless spec
|
|
71
|
+
|
|
72
|
+
return true if val.nil? && spec[:nullable]
|
|
73
|
+
|
|
74
|
+
case spec[:type]
|
|
75
|
+
when :boolean
|
|
76
|
+
unless [true, false].include?(val)
|
|
77
|
+
msg = "#{key} must be a boolean (true or false), got #{val.inspect}"
|
|
78
|
+
raise ArgumentError, msg if strict
|
|
79
|
+
|
|
80
|
+
return false
|
|
81
|
+
end
|
|
82
|
+
when :integer
|
|
83
|
+
unless val.is_a?(Integer) && (!spec[:min] || val >= spec[:min]) && (!spec[:max] || val <= spec[:max])
|
|
84
|
+
min_str = spec[:min] ? " >= #{spec[:min]}" : ""
|
|
85
|
+
max_str = spec[:max] ? " <= #{spec[:max]}" : ""
|
|
86
|
+
msg = "#{key} must be an integer#{min_str}#{max_str}, got #{val.inspect}"
|
|
87
|
+
raise ArgumentError, msg if strict
|
|
88
|
+
|
|
89
|
+
return false
|
|
90
|
+
end
|
|
91
|
+
when :float
|
|
92
|
+
val_f = val.is_a?(Numeric) ? val.to_f : nil
|
|
93
|
+
unless val_f && (!spec[:min] || val_f >= spec[:min]) && (!spec[:max] || val_f <= spec[:max])
|
|
94
|
+
msg = "#{key} must be a float between #{spec[:min]} and #{spec[:max]}, got #{val.inspect}"
|
|
95
|
+
raise ArgumentError, msg if strict
|
|
96
|
+
|
|
97
|
+
return false
|
|
98
|
+
end
|
|
99
|
+
when :enum
|
|
100
|
+
val_str = val.to_s.downcase.strip
|
|
101
|
+
unless spec[:allowed].include?(val_str)
|
|
102
|
+
msg = "#{key} must be one of #{spec[:allowed].inspect}, got #{val.inspect}"
|
|
103
|
+
raise ArgumentError, msg if strict
|
|
104
|
+
|
|
105
|
+
return false
|
|
106
|
+
end
|
|
107
|
+
when :string
|
|
108
|
+
unless val.is_a?(String)
|
|
109
|
+
msg = "#{key} must be a string, got #{val.inspect}"
|
|
110
|
+
raise ArgumentError, msg if strict
|
|
111
|
+
|
|
112
|
+
return false
|
|
113
|
+
end
|
|
114
|
+
when :array
|
|
115
|
+
unless val.is_a?(Array)
|
|
116
|
+
msg = "#{key} must be an Array, got #{val.inspect}"
|
|
117
|
+
raise ArgumentError, msg if strict
|
|
118
|
+
|
|
119
|
+
return false
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
true
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# Coerce schema-backed scalar leaves inside a whole-section Hash write
|
|
126
|
+
# (e.g. set("ui", {...})) so nested string values get the same
|
|
127
|
+
# coercion the dotted-key path enjoys before strict validation.
|
|
128
|
+
def coerce_nested!(hash, prefix = "")
|
|
129
|
+
hash.each do |key, val|
|
|
130
|
+
full = prefix.empty? ? key.to_s : "#{prefix}.#{key}"
|
|
131
|
+
if val.is_a?(Hash)
|
|
132
|
+
coerce_nested!(val, full)
|
|
133
|
+
elsif DEFINITIONS.key?(full)
|
|
134
|
+
hash[key] = coerce(full, val)
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
hash
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
def coerce(key, val)
|
|
141
|
+
spec = DEFINITIONS[key.to_s]
|
|
142
|
+
return val unless spec && val.is_a?(String)
|
|
143
|
+
|
|
144
|
+
case spec[:type]
|
|
145
|
+
when :boolean
|
|
146
|
+
case val.strip.downcase
|
|
147
|
+
when "true", "yes", "1", "on" then true
|
|
148
|
+
when "false", "no", "0", "off" then false
|
|
149
|
+
else val
|
|
150
|
+
end
|
|
151
|
+
when :integer
|
|
152
|
+
val.strip =~ /^-?\d+$/ ? val.strip.to_i : val
|
|
153
|
+
when :float
|
|
154
|
+
val.strip =~ /^-?\d+(\.\d+)?$/ ? val.strip.to_f : val
|
|
155
|
+
when :enum
|
|
156
|
+
val.strip.downcase
|
|
157
|
+
else
|
|
158
|
+
val
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|