rubik 0.9.1 → 0.10.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/ATTRIBUTION.md +1 -1
- data/CHANGELOG.md +143 -1
- data/lib/rubik/adapter/base.rb +2 -1
- data/lib/rubik/adapter/process.rb +28 -67
- data/lib/rubik/benchmark/vakanuvis_adoption.rb +10 -3
- data/lib/rubik/buffer/apply_contract.rb +3 -3
- data/lib/rubik/buffer/apply_transaction.rb +165 -0
- data/lib/rubik/buffer/manager.rb +26 -120
- data/lib/rubik/config/deep_ops.rb +4 -1
- data/lib/rubik/config/defaults.rb +6 -3
- data/lib/rubik/config/schema.rb +8 -0
- data/lib/rubik/config/secret_policy.rb +197 -0
- data/lib/rubik/config.rb +11 -0
- data/lib/rubik/diagnostics/collector.rb +0 -9
- data/lib/rubik/errors.rb +15 -0
- data/lib/rubik/event_bus.rb +2 -1
- data/lib/rubik/kernel/dispatcher.rb +12 -7
- data/lib/rubik/kernel/unit.rb +4 -1
- data/lib/rubik/llm/registry.rb +12 -9
- data/lib/rubik/llm/router.rb +2 -5
- data/lib/rubik/log.rb +21 -0
- data/lib/rubik/lsp/client.rb +77 -273
- data/lib/rubik/lsp/manager.rb +14 -10
- data/lib/rubik/lsp/transport.rb +365 -0
- data/lib/rubik/mcp/boot_lifecycle.rb +6 -2
- data/lib/rubik/mcp/boot_run.rb +190 -0
- data/lib/rubik/mcp/manager.rb +40 -163
- data/lib/rubik/mcp/transport/stdio.rb +4 -1
- data/lib/rubik/orchestrator/auto_apply.rb +4 -3
- data/lib/rubik/orchestrator/continuation_manager.rb +3 -22
- data/lib/rubik/orchestrator/goal_session.rb +53 -39
- data/lib/rubik/orchestrator/loop.rb +28 -47
- data/lib/rubik/orchestrator/maestro_gate.rb +5 -7
- data/lib/rubik/orchestrator/provider_recovery.rb +4 -2
- data/lib/rubik/orchestrator/provider_resolver.rb +4 -2
- data/lib/rubik/orchestrator/resume_window.rb +96 -0
- data/lib/rubik/orchestrator/shell_deps.rb +16 -0
- data/lib/rubik/orchestrator/stream_manager.rb +2 -1
- data/lib/rubik/orchestrator/subagent/deferred_spec.rb +4 -1
- data/lib/rubik/orchestrator/subagent/instance.rb +7 -12
- data/lib/rubik/orchestrator/subagent/lifecycle.rb +3 -1
- data/lib/rubik/orchestrator/subagent/questioner.rb +3 -1
- data/lib/rubik/orchestrator/subagent/reaper.rb +3 -5
- data/lib/rubik/orchestrator/subagent/resilience.rb +4 -2
- data/lib/rubik/orchestrator/subagent/result_archive.rb +0 -4
- data/lib/rubik/orchestrator/subagent/run_cycle.rb +2 -7
- data/lib/rubik/orchestrator/subagent/spawn_transaction.rb +11 -2
- data/lib/rubik/orchestrator/subagent/step_runner.rb +10 -2
- data/lib/rubik/orchestrator/subagent/type_definition.rb +0 -4
- data/lib/rubik/orchestrator/tool_timeout.rb +121 -1
- data/lib/rubik/platform/io_drain.rb +2 -1
- data/lib/rubik/platform/process.rb +144 -54
- data/lib/rubik/platform.rb +2 -1
- data/lib/rubik/plugin/manager.rb +2 -1
- data/lib/rubik/repl/commands/agent_context.rb +8 -7
- data/lib/rubik/repl/commands/agent_execution.rb +13 -32
- data/lib/rubik/repl/commands/agent_models.rb +4 -3
- data/lib/rubik/repl/commands/agent_providers.rb +43 -2
- data/lib/rubik/repl/commands/base.rb +47 -2
- data/lib/rubik/repl/commands/buffer.rb +5 -4
- data/lib/rubik/repl/commands/lsp.rb +2 -1
- data/lib/rubik/repl/commands/pruner.rb +2 -1
- data/lib/rubik/repl/commands/secrets.rb +151 -0
- data/lib/rubik/repl/commands/workspace.rb +60 -150
- data/lib/rubik/repl/commands/workspace_approval.rb +209 -0
- data/lib/rubik/repl/config_wiring.rb +3 -3
- data/lib/rubik/repl/hooks.rb +2 -1
- data/lib/rubik/repl/input_execution.rb +158 -76
- data/lib/rubik/repl/input_loop.rb +2 -1
- data/lib/rubik/repl/lifecycle.rb +59 -209
- data/lib/rubik/repl/notice_router.rb +319 -0
- data/lib/rubik/repl/paste_support.rb +3 -1
- data/lib/rubik/repl/presentation.rb +5 -3
- data/lib/rubik/repl/pruner/gate.rb +3 -1
- data/lib/rubik/repl/pruner/harness.rb +2 -1
- data/lib/rubik/repl/shell.rb +4 -3
- data/lib/rubik/repl/turn_recorder.rb +6 -5
- data/lib/rubik/runtime/discovery.rb +3 -2
- data/lib/rubik/runtime/loop_service.rb +4 -3
- data/lib/rubik/runtime/manifest_store.rb +9 -1
- data/lib/rubik/runtime/overlay_guard.rb +127 -0
- data/lib/rubik/runtime/overlay_storage.rb +92 -146
- data/lib/rubik/runtime/task_manager.rb +64 -25
- data/lib/rubik/sandbox/driver/docker.rb +5 -1
- data/lib/rubik/sandbox/runner.rb +16 -15
- data/lib/rubik/security/command_gate.rb +117 -93
- data/lib/rubik/security/guard.rb +6 -2
- data/lib/rubik/security/secret_store.rb +463 -0
- data/lib/rubik/security/synthesis_gate.rb +8 -11
- data/lib/rubik/session/manager.rb +7 -1
- data/lib/rubik/skills/manager.rb +2 -3
- data/lib/rubik/storage/search.rb +49 -0
- data/lib/rubik/storage/store.rb +13 -20
- data/lib/rubik/storage/vakanuvis/harness.rb +2 -3
- data/lib/rubik/tools/base.rb +22 -0
- data/lib/rubik/tools/builtins/files.rb +3 -15
- data/lib/rubik/tools/builtins/grep.rb +1 -6
- data/lib/rubik/tools/builtins/lifecycle.rb +6 -5
- data/lib/rubik/tools/lifecycle_rollbacks.rb +14 -1
- data/lib/rubik/tools/truncator.rb +48 -36
- data/lib/rubik/ui/banner.rb +4 -3
- data/lib/rubik/ui/spinner.rb +3 -1
- data/lib/rubik/ui/statusline.rb +6 -5
- data/lib/rubik/version.rb +1 -1
- data/lib/rubik.rb +1 -2
- metadata +13 -1
data/lib/rubik/tools/base.rb
CHANGED
|
@@ -172,6 +172,28 @@ module Rubik
|
|
|
172
172
|
"No matching files found for '#{filter}'.#{hint}"
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
+
# One home for the traversal-refusal disclosure used by the index
|
|
176
|
+
# filter tools (list_files, grep_search): renders the blocked message
|
|
177
|
+
# with the tool's root as the primary allowed root plus the context
|
|
178
|
+
# index's additional roots, so the honest-disclosure list cannot
|
|
179
|
+
# drift between tools. `context_index` may be nil (index unavailable)
|
|
180
|
+
# or a duck-typed double without additional_roots.
|
|
181
|
+
def self.traversal_blocked_message(path, root_dir, context_index)
|
|
182
|
+
allowed = [{ path: root_dir, primary: true }]
|
|
183
|
+
context_index.additional_roots.each { |r| allowed << { path: r, primary: false } } if context_index.respond_to?(:additional_roots)
|
|
184
|
+
DiagnosticReporter.render_traversal_blocked(path, allowed_roots: allowed)
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# One home for the fuzzy file-not-found disclosure used by the
|
|
188
|
+
# buffer-bound tools (read_file, replace_file_content): suggests the
|
|
189
|
+
# closest known files by basename match. The respond_to?(:all_files)
|
|
190
|
+
# guard keeps test doubles without the file indexer honest.
|
|
191
|
+
def self.file_not_found_message(buffer_manager, path)
|
|
192
|
+
known_files = buffer_manager.respond_to?(:all_files) ? buffer_manager.all_files : []
|
|
193
|
+
candidates = FuzzyMatcher.best_matches(File.basename(path), known_files.map { |f| File.basename(f) })
|
|
194
|
+
DiagnosticReporter.render_file_not_found(path, candidates: candidates)
|
|
195
|
+
end
|
|
196
|
+
|
|
175
197
|
def to_h
|
|
176
198
|
schema = @params_schema
|
|
177
199
|
if !@allow_additional_properties && schema.is_a?(Hash)
|
|
@@ -60,11 +60,7 @@ module Rubik
|
|
|
60
60
|
@buffer_manager.read(path)
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
unless content
|
|
64
|
-
known_files = @buffer_manager.respond_to?(:all_files) ? @buffer_manager.all_files : []
|
|
65
|
-
candidates = FuzzyMatcher.best_matches(File.basename(path), known_files.map { |f| File.basename(f) })
|
|
66
|
-
return ToolOutput.error(DiagnosticReporter.render_file_not_found(path, candidates: candidates))
|
|
67
|
-
end
|
|
63
|
+
return ToolOutput.error(BaseTool.file_not_found_message(@buffer_manager, path)) unless content
|
|
68
64
|
|
|
69
65
|
offset = param(args, :offset, type: :integer)
|
|
70
66
|
limit = param(args, :limit, type: :integer)
|
|
@@ -177,11 +173,7 @@ module Rubik
|
|
|
177
173
|
return ToolOutput.error(IndexMessages::INDEX_UNAVAILABLE_MESSAGE) unless idx
|
|
178
174
|
|
|
179
175
|
filter, error = BaseTool.normalize_path_filter(path_filter, @root_dir)
|
|
180
|
-
if error
|
|
181
|
-
allowed = [{ path: @root_dir, primary: true }]
|
|
182
|
-
idx.additional_roots.each { |r| allowed << { path: r, primary: false } } if idx.respond_to?(:additional_roots)
|
|
183
|
-
return ToolOutput.error(DiagnosticReporter.render_traversal_blocked(path_filter, allowed_roots: allowed))
|
|
184
|
-
end
|
|
176
|
+
return ToolOutput.error(BaseTool.traversal_blocked_message(path_filter, @root_dir, idx)) if error
|
|
185
177
|
|
|
186
178
|
# Tools never scan: an empty index answers honestly instead of
|
|
187
179
|
# triggering a synchronous full_scan inside the tool call.
|
|
@@ -273,11 +265,7 @@ module Rubik
|
|
|
273
265
|
return ToolOutput.error("Error: `replacement_content` parameter is required.") if replacement.nil?
|
|
274
266
|
|
|
275
267
|
content = @buffer_manager.read(path)
|
|
276
|
-
unless content
|
|
277
|
-
known_files = (@buffer_manager.respond_to?(:all_files) ? @buffer_manager.all_files : [])
|
|
278
|
-
candidates = FuzzyMatcher.best_matches(File.basename(path), known_files.map { |f| File.basename(f) })
|
|
279
|
-
return ToolOutput.error(DiagnosticReporter.render_file_not_found(path, candidates: candidates))
|
|
280
|
-
end
|
|
268
|
+
return ToolOutput.error(BaseTool.file_not_found_message(@buffer_manager, path)) unless content
|
|
281
269
|
|
|
282
270
|
has_crlf = content.to_s.include?("\r\n")
|
|
283
271
|
norm_file = content.to_s.gsub("\r\n", "\n")
|
|
@@ -64,12 +64,7 @@ module Rubik
|
|
|
64
64
|
ext_filter = param(args, :extension, type: :stripped_string)
|
|
65
65
|
|
|
66
66
|
path_filter, outside_error = BaseTool.normalize_path_filter(path_filter, @root_dir)
|
|
67
|
-
if outside_error
|
|
68
|
-
allowed = [{ path: @root_dir, primary: true }]
|
|
69
|
-
idx = context_index
|
|
70
|
-
idx.additional_roots.each { |r| allowed << { path: r, primary: false } } if idx.respond_to?(:additional_roots)
|
|
71
|
-
return ToolOutput.error(DiagnosticReporter.render_traversal_blocked(param(args, :path), allowed_roots: allowed))
|
|
72
|
-
end
|
|
67
|
+
return ToolOutput.error(BaseTool.traversal_blocked_message(param(args, :path), @root_dir, context_index)) if outside_error
|
|
73
68
|
|
|
74
69
|
case_sensitive = param(args, :case_sensitive, default: false)
|
|
75
70
|
max_results = param(args, :max_results, type: :integer, default: 50)
|
|
@@ -5,6 +5,7 @@ require_relative "../output"
|
|
|
5
5
|
require_relative "../../runtime"
|
|
6
6
|
require_relative "../../runtime/repair_probe"
|
|
7
7
|
require_relative "../../buffer/apply_contract"
|
|
8
|
+
require_relative "../../storage/layout"
|
|
8
9
|
|
|
9
10
|
module Rubik
|
|
10
11
|
module Tools
|
|
@@ -93,9 +94,9 @@ module Rubik
|
|
|
93
94
|
private
|
|
94
95
|
|
|
95
96
|
def auto_apply_mode
|
|
96
|
-
return nil unless @shell.respond_to?(:config)
|
|
97
|
+
return nil unless @shell.respond_to?(:config)
|
|
97
98
|
|
|
98
|
-
@shell.config
|
|
99
|
+
Rubik::Storage::Layout.config_get(@shell.config, "buffer.auto_apply", "manual")
|
|
99
100
|
end
|
|
100
101
|
end
|
|
101
102
|
|
|
@@ -270,7 +271,7 @@ module Rubik
|
|
|
270
271
|
|
|
271
272
|
case target
|
|
272
273
|
when "lsp"
|
|
273
|
-
raise "LSP manager and config are required for live activation" unless @lsp_manager && @config
|
|
274
|
+
raise RepairRuntimeError, "LSP manager and config are required for live activation" unless @lsp_manager && @config
|
|
274
275
|
|
|
275
276
|
had_client = !@lsp_manager.clients[lang].nil?
|
|
276
277
|
# The manager owns its client table. Restore the old configured
|
|
@@ -281,10 +282,10 @@ module Rubik
|
|
|
281
282
|
))
|
|
282
283
|
@lsp_manager.stop_client(lang)
|
|
283
284
|
start_res = @lsp_manager.start_client(lang)
|
|
284
|
-
raise "Failed to start LSP server: #{start_res}" unless start_res.is_a?(Hash) && start_res[:ok]
|
|
285
|
+
raise RepairRuntimeError, "Failed to start LSP server: #{start_res}" unless start_res.is_a?(Hash) && start_res[:ok]
|
|
285
286
|
|
|
286
287
|
service = @lsp_manager.clients[lang]
|
|
287
|
-
raise "LSP manager reported success without an active client" unless service
|
|
288
|
+
raise RepairRuntimeError, "LSP manager reported success without an active client" unless service
|
|
288
289
|
when "test_runner", "linter"
|
|
289
290
|
if @adapter_registry
|
|
290
291
|
adapter = @adapter_registry.get(lang)
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../errors"
|
|
4
|
+
|
|
3
5
|
# Named rollback objects for RepairRuntimeTool's promotion transaction
|
|
4
6
|
# (issue #427). Each replaces a former inline `on_dispose` closure, responds
|
|
5
7
|
# to #call and is executed in LIFO order by Context#dispose, keeping the
|
|
6
8
|
# rollback contract explicit and the promotion phase unit-testable.
|
|
7
9
|
module Rubik
|
|
8
10
|
module Tools
|
|
11
|
+
# Runtime-service promotion/rollback failure (issue #448): the repair
|
|
12
|
+
# plane's live-activation preconditions (builtins/lifecycle.rb) and this
|
|
13
|
+
# file's rollback restore raise this instead of bare RuntimeError.
|
|
14
|
+
# RepairRuntimeTool's promotion rescue converts it into a
|
|
15
|
+
# ToolOutput.error verbatim, and Context#dispose error-isolates the
|
|
16
|
+
# rollback inverse, so the class change is transparent to both
|
|
17
|
+
# consumers. Homed here (not builtins/lifecycle.rb) because the builtin
|
|
18
|
+
# file-size contract pins that page; the bottom require there loads this
|
|
19
|
+
# file, so the constant exists for every raise site.
|
|
20
|
+
class RepairRuntimeError < Rubik::Error; end
|
|
21
|
+
|
|
9
22
|
class RepairRuntimeTool
|
|
10
23
|
# Shared flag for the rollbacks of one promotion transaction: when a
|
|
11
24
|
# previous repair scope already owns the lifetime inverses for this key,
|
|
@@ -64,7 +77,7 @@ module Rubik
|
|
|
64
77
|
return unless had_client && !root_ctx.disposed?
|
|
65
78
|
|
|
66
79
|
restored = lsp_manager.start_client(lang)
|
|
67
|
-
raise "Previous LSP client could not be restarted: #{restored}" unless restored[:ok]
|
|
80
|
+
raise Rubik::Tools::RepairRuntimeError, "Previous LSP client could not be restarted: #{restored}" unless restored[:ok]
|
|
68
81
|
end
|
|
69
82
|
end
|
|
70
83
|
|
|
@@ -92,45 +92,15 @@ module Rubik
|
|
|
92
92
|
|
|
93
93
|
case strategy_sym
|
|
94
94
|
when :head_only
|
|
95
|
-
|
|
96
|
-
kept_str
|
|
97
|
-
if kept_str.bytesize > max_c
|
|
98
|
-
kept_str = kept_str.byteslice(0, max_c)
|
|
99
|
-
kept_str = kept_str.scrub("") unless kept_str.valid_encoding?
|
|
100
|
-
end
|
|
101
|
-
kept_line_count = kept_str.empty? ? 0 : kept_str.lines(sep).size
|
|
102
|
-
omitted_lines = [lines.size - kept_line_count, 0].max
|
|
103
|
-
omitted_chars = [str.bytesize - kept_str.bytesize, 0].max
|
|
104
|
-
notice = "\n... [Truncated: omitted #{omitted_lines} lines / #{omitted_chars} chars] ...\n"
|
|
105
|
-
{ text: finalize(kept_str, notice, prefix: true), truncated: true,
|
|
106
|
-
omitted_lines: omitted_lines, omitted_chars: omitted_chars }
|
|
95
|
+
kept_str = clamp_head(lines.first(max_l).join, max_c)
|
|
96
|
+
window_result(str, kept_str, lines.size, sep, :short, prefix: true)
|
|
107
97
|
when :tail_only
|
|
108
|
-
|
|
109
|
-
kept_str
|
|
110
|
-
if kept_str.bytesize > max_c
|
|
111
|
-
kept_str = kept_str.byteslice(-max_c, max_c)
|
|
112
|
-
kept_str = kept_str.scrub("") unless kept_str.valid_encoding?
|
|
113
|
-
end
|
|
114
|
-
kept_line_count = kept_str.empty? ? 0 : kept_str.lines(sep).size
|
|
115
|
-
omitted_lines = [lines.size - kept_line_count, 0].max
|
|
116
|
-
omitted_chars = [str.bytesize - kept_str.bytesize, 0].max
|
|
117
|
-
notice = "\n... [Truncated: omitted #{omitted_lines} lines / #{omitted_chars} chars] ...\n"
|
|
118
|
-
{ text: finalize(kept_str, notice, prefix: false), truncated: true,
|
|
119
|
-
omitted_lines: omitted_lines, omitted_chars: omitted_chars }
|
|
98
|
+
kept_str = clamp_tail(lines.last(max_l).join, max_c)
|
|
99
|
+
window_result(str, kept_str, lines.size, sep, :short, prefix: false)
|
|
120
100
|
else # :head_tail
|
|
121
101
|
if max_l <= 1
|
|
122
|
-
|
|
123
|
-
kept_str
|
|
124
|
-
if kept_str.bytesize > max_c
|
|
125
|
-
kept_str = kept_str.byteslice(0, max_c)
|
|
126
|
-
kept_str = kept_str.scrub("") unless kept_str.valid_encoding?
|
|
127
|
-
end
|
|
128
|
-
kept_line_count = kept_str.empty? ? 0 : kept_str.lines(sep).size
|
|
129
|
-
omitted_lines = [lines.size - kept_line_count, 0].max
|
|
130
|
-
omitted_chars = [str.bytesize - kept_str.bytesize, 0].max
|
|
131
|
-
notice = "\n\n... [Truncated: #{omitted_lines} lines / #{omitted_chars} chars omitted to preserve token budget] ...\n\n"
|
|
132
|
-
return { text: finalize(kept_str, notice, prefix: true), truncated: true,
|
|
133
|
-
omitted_lines: omitted_lines, omitted_chars: omitted_chars }
|
|
102
|
+
kept_str = clamp_head(lines.first(max_l).join, max_c)
|
|
103
|
+
return window_result(str, kept_str, lines.size, sep, :budget, prefix: true)
|
|
134
104
|
end
|
|
135
105
|
|
|
136
106
|
head_lines_count = max_l / 2
|
|
@@ -190,6 +160,48 @@ module Rubik
|
|
|
190
160
|
prefix ? "#{str}#{notice}" : "#{notice}#{str}"
|
|
191
161
|
end
|
|
192
162
|
|
|
163
|
+
# Shared kept-window accounting for the single-window strategies
|
|
164
|
+
# (head_only, tail_only, and head_tail's degenerate max_l <= 1
|
|
165
|
+
# branch): omitted_lines/omitted_chars are derived from the ORIGINAL
|
|
166
|
+
# line count and the KEPT byte size. `style` selects one of the two
|
|
167
|
+
# sanctioned full-truncation notice spellings — byte-identical
|
|
168
|
+
# output is pinned by tests, so the format lives here and nowhere
|
|
169
|
+
# else. The kept window must already be clamped (and scrubbed once
|
|
170
|
+
# after its last byteslice) via clamp_head / clamp_tail.
|
|
171
|
+
def self.window_result(str, kept_str, total_lines, sep, style, prefix:)
|
|
172
|
+
kept_line_count = kept_str.empty? ? 0 : kept_str.lines(sep).size
|
|
173
|
+
omitted_lines = [total_lines - kept_line_count, 0].max
|
|
174
|
+
omitted_chars = [str.bytesize - kept_str.bytesize, 0].max
|
|
175
|
+
notice = if style == :budget
|
|
176
|
+
"\n\n... [Truncated: #{omitted_lines} lines / #{omitted_chars} chars omitted to preserve token budget] ...\n\n"
|
|
177
|
+
else
|
|
178
|
+
"\n... [Truncated: omitted #{omitted_lines} lines / #{omitted_chars} chars] ...\n"
|
|
179
|
+
end
|
|
180
|
+
{ text: finalize(kept_str, notice, prefix: prefix), truncated: true,
|
|
181
|
+
omitted_lines: omitted_lines, omitted_chars: omitted_chars }
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Post-byteslice head clamp: a byte-boundary cut can split a multibyte
|
|
185
|
+
# character at the cut edge. Dropping the partial sequence keeps the
|
|
186
|
+
# byte budget honest while the kept window stays valid UTF-8.
|
|
187
|
+
def self.clamp_head(str, max_c)
|
|
188
|
+
return str if str.bytesize <= max_c
|
|
189
|
+
|
|
190
|
+
clamped = str.byteslice(0, max_c)
|
|
191
|
+
clamped = clamped.scrub("") unless clamped.valid_encoding?
|
|
192
|
+
clamped
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Tail clamp: same contract as clamp_head, slicing from the END of the
|
|
196
|
+
# window so the last lines survive.
|
|
197
|
+
def self.clamp_tail(str, max_c)
|
|
198
|
+
return str if str.bytesize <= max_c
|
|
199
|
+
|
|
200
|
+
clamped = str.byteslice(-max_c, max_c)
|
|
201
|
+
clamped = clamped.scrub("") unless clamped.valid_encoding?
|
|
202
|
+
clamped
|
|
203
|
+
end
|
|
204
|
+
|
|
193
205
|
# Canonical short-preview truncation for human/model-readable
|
|
194
206
|
# fragments: keep at most `limit` characters, then append one of the
|
|
195
207
|
# repo's two elision markers. `counted:` selects the spelling —
|
data/lib/rubik/ui/banner.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../platform"
|
|
4
|
+
require_relative "../storage/layout"
|
|
4
5
|
|
|
5
6
|
module Rubik
|
|
6
7
|
module UI
|
|
@@ -11,7 +12,7 @@ module Rubik
|
|
|
11
12
|
module_function
|
|
12
13
|
|
|
13
14
|
def render(shell, theme)
|
|
14
|
-
return nil unless shell.config
|
|
15
|
+
return nil unless Rubik::Storage::Layout.config_get(shell.config, "ui.banner", true)
|
|
15
16
|
return nil unless Capability.interactive?(input: shell.input, output: shell.output)
|
|
16
17
|
|
|
17
18
|
routed = Statusline.current_route(shell)
|
|
@@ -27,8 +28,8 @@ module Rubik
|
|
|
27
28
|
]
|
|
28
29
|
|
|
29
30
|
if Rubik::Platform.linux? && Rubik::Platform.which("bwrap") &&
|
|
30
|
-
!shell.config
|
|
31
|
-
shell.config
|
|
31
|
+
!Rubik::Storage::Layout.config_get(shell.config, "sandbox.enabled", false) &&
|
|
32
|
+
Rubik::Storage::Layout.config_get(shell.config, "sandbox.prompt_on_startup", true)
|
|
32
33
|
lines << theme.paint("💡 Linux & bwrap algılandı: '!sandbox on' ile donanımsal OS izolasyonu açılabilir", :warn)
|
|
33
34
|
end
|
|
34
35
|
|
data/lib/rubik/ui/spinner.rb
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
require "tty-spinner"
|
|
4
4
|
|
|
5
|
+
require_relative "../storage/layout"
|
|
6
|
+
|
|
5
7
|
module Rubik
|
|
6
8
|
module UI
|
|
7
9
|
# Live status spinner shown while the orchestrator queries the LLM:
|
|
@@ -25,7 +27,7 @@ module Rubik
|
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def enabled?
|
|
28
|
-
@config ? @config
|
|
30
|
+
@config ? Rubik::Storage::Layout.config_get(@config, "ui.spinner", true) != false : true
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
def spinning?
|
data/lib/rubik/ui/statusline.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../prompt/token_estimator"
|
|
4
|
+
require_relative "../storage/layout"
|
|
4
5
|
|
|
5
6
|
module Rubik
|
|
6
7
|
module UI
|
|
@@ -12,9 +13,9 @@ module Rubik
|
|
|
12
13
|
module_function
|
|
13
14
|
|
|
14
15
|
def render(shell, theme)
|
|
15
|
-
return nil unless shell.config
|
|
16
|
+
return nil unless Rubik::Storage::Layout.config_get(shell.config, "ui.statusline", true)
|
|
16
17
|
|
|
17
|
-
template = shell.config
|
|
18
|
+
template = Rubik::Storage::Layout.config_get(shell.config, "ui.statusline_template", default_template)
|
|
18
19
|
# `!config set ui.statusline_template "{a} {b}"` can arrive parsed as
|
|
19
20
|
# a YAML flow-mapping Hash; coerce any non-String back to the default.
|
|
20
21
|
template = default_template unless template.is_a?(String)
|
|
@@ -28,7 +29,7 @@ module Rubik
|
|
|
28
29
|
"ctx" => context_usage(shell, routed),
|
|
29
30
|
"dirty" => dirty_segment(shell, theme),
|
|
30
31
|
"sandbox" => sandbox_segment(shell),
|
|
31
|
-
"verbosity" => shell.config
|
|
32
|
+
"verbosity" => Rubik::Storage::Layout.config_get(shell.config, "ui.verbosity", "normal"),
|
|
32
33
|
"units" => units_str
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -79,8 +80,8 @@ module Rubik
|
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
def sandbox_segment(shell)
|
|
82
|
-
if shell.config
|
|
83
|
-
net_str = shell.config
|
|
83
|
+
if Rubik::Storage::Layout.config_get(shell.config, "sandbox.enabled", false)
|
|
84
|
+
net_str = Rubik::Storage::Layout.config_get(shell.config, "sandbox.allow_network", false) ? "ağ-açık" : "izole"
|
|
84
85
|
"#{shell.sandbox_runner&.driver&.name || 'sandbox'}:#{net_str}"
|
|
85
86
|
else
|
|
86
87
|
"kapalı"
|
data/lib/rubik/version.rb
CHANGED
data/lib/rubik.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "rubik/version"
|
|
4
|
+
require_relative "rubik/errors"
|
|
4
5
|
require_relative "rubik/log"
|
|
5
6
|
require_relative "rubik/platform"
|
|
6
7
|
require_relative "rubik/concurrency"
|
|
@@ -38,8 +39,6 @@ require_relative "rubik/kernel/unit"
|
|
|
38
39
|
require_relative "rubik/kernel/init"
|
|
39
40
|
|
|
40
41
|
module Rubik
|
|
41
|
-
class Error < StandardError; end
|
|
42
|
-
|
|
43
42
|
class << self
|
|
44
43
|
attr_accessor :current_shell, :runtime_manager
|
|
45
44
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rubik
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Özgür Ulukır
|
|
@@ -270,6 +270,7 @@ files:
|
|
|
270
270
|
- lib/rubik/benchmark/vakanuvis_adoption.rb
|
|
271
271
|
- lib/rubik/buffer.rb
|
|
272
272
|
- lib/rubik/buffer/apply_contract.rb
|
|
273
|
+
- lib/rubik/buffer/apply_transaction.rb
|
|
273
274
|
- lib/rubik/buffer/diff.rb
|
|
274
275
|
- lib/rubik/buffer/manager.rb
|
|
275
276
|
- lib/rubik/buffer/path_validator.rb
|
|
@@ -295,6 +296,7 @@ files:
|
|
|
295
296
|
- lib/rubik/config/pruner.rb
|
|
296
297
|
- lib/rubik/config/schema.rb
|
|
297
298
|
- lib/rubik/config/scoped.rb
|
|
299
|
+
- lib/rubik/config/secret_policy.rb
|
|
298
300
|
- lib/rubik/config/store.rb
|
|
299
301
|
- lib/rubik/context.rb
|
|
300
302
|
- lib/rubik/context/git_info.rb
|
|
@@ -307,6 +309,7 @@ files:
|
|
|
307
309
|
- lib/rubik/diagnostics/collector.rb
|
|
308
310
|
- lib/rubik/diagnostics/entry.rb
|
|
309
311
|
- lib/rubik/diagnostics/parser.rb
|
|
312
|
+
- lib/rubik/errors.rb
|
|
310
313
|
- lib/rubik/event_bus.rb
|
|
311
314
|
- lib/rubik/events.rb
|
|
312
315
|
- lib/rubik/kernel/dispatcher.rb
|
|
@@ -332,8 +335,10 @@ files:
|
|
|
332
335
|
- lib/rubik/lsp/document_store.rb
|
|
333
336
|
- lib/rubik/lsp/manager.rb
|
|
334
337
|
- lib/rubik/lsp/server_command.rb
|
|
338
|
+
- lib/rubik/lsp/transport.rb
|
|
335
339
|
- lib/rubik/mcp.rb
|
|
336
340
|
- lib/rubik/mcp/boot_lifecycle.rb
|
|
341
|
+
- lib/rubik/mcp/boot_run.rb
|
|
337
342
|
- lib/rubik/mcp/client.rb
|
|
338
343
|
- lib/rubik/mcp/errors.rb
|
|
339
344
|
- lib/rubik/mcp/manager.rb
|
|
@@ -366,6 +371,7 @@ files:
|
|
|
366
371
|
- lib/rubik/orchestrator/maestro_gate.rb
|
|
367
372
|
- lib/rubik/orchestrator/provider_recovery.rb
|
|
368
373
|
- lib/rubik/orchestrator/provider_resolver.rb
|
|
374
|
+
- lib/rubik/orchestrator/resume_window.rb
|
|
369
375
|
- lib/rubik/orchestrator/shell_deps.rb
|
|
370
376
|
- lib/rubik/orchestrator/step_executor.rb
|
|
371
377
|
- lib/rubik/orchestrator/stream_manager.rb
|
|
@@ -461,6 +467,7 @@ files:
|
|
|
461
467
|
- lib/rubik/repl/commands/mcp.rb
|
|
462
468
|
- lib/rubik/repl/commands/plugins.rb
|
|
463
469
|
- lib/rubik/repl/commands/pruner.rb
|
|
470
|
+
- lib/rubik/repl/commands/secrets.rb
|
|
464
471
|
- lib/rubik/repl/commands/session.rb
|
|
465
472
|
- lib/rubik/repl/commands/skills.rb
|
|
466
473
|
- lib/rubik/repl/commands/storage.rb
|
|
@@ -468,6 +475,7 @@ files:
|
|
|
468
475
|
- lib/rubik/repl/commands/system.rb
|
|
469
476
|
- lib/rubik/repl/commands/tasks.rb
|
|
470
477
|
- lib/rubik/repl/commands/workspace.rb
|
|
478
|
+
- lib/rubik/repl/commands/workspace_approval.rb
|
|
471
479
|
- lib/rubik/repl/composition.rb
|
|
472
480
|
- lib/rubik/repl/config_wiring.rb
|
|
473
481
|
- lib/rubik/repl/confirmations.rb
|
|
@@ -476,6 +484,7 @@ files:
|
|
|
476
484
|
- lib/rubik/repl/input_loop.rb
|
|
477
485
|
- lib/rubik/repl/interrupt_handler.rb
|
|
478
486
|
- lib/rubik/repl/lifecycle.rb
|
|
487
|
+
- lib/rubik/repl/notice_router.rb
|
|
479
488
|
- lib/rubik/repl/paste_support.rb
|
|
480
489
|
- lib/rubik/repl/pending_notice_queue.rb
|
|
481
490
|
- lib/rubik/repl/presentation.rb
|
|
@@ -506,6 +515,7 @@ files:
|
|
|
506
515
|
- lib/rubik/runtime/loop_service.rb
|
|
507
516
|
- lib/rubik/runtime/manager.rb
|
|
508
517
|
- lib/rubik/runtime/manifest_store.rb
|
|
518
|
+
- lib/rubik/runtime/overlay_guard.rb
|
|
509
519
|
- lib/rubik/runtime/overlay_storage.rb
|
|
510
520
|
- lib/rubik/runtime/repair_probe.rb
|
|
511
521
|
- lib/rubik/runtime/sealed_coeffects.rb
|
|
@@ -736,6 +746,7 @@ files:
|
|
|
736
746
|
- lib/rubik/security/guard.rb
|
|
737
747
|
- lib/rubik/security/path_policy.rb
|
|
738
748
|
- lib/rubik/security/redactor.rb
|
|
749
|
+
- lib/rubik/security/secret_store.rb
|
|
739
750
|
- lib/rubik/security/synthesis_gate.rb
|
|
740
751
|
- lib/rubik/session.rb
|
|
741
752
|
- lib/rubik/session/manager.rb
|
|
@@ -753,6 +764,7 @@ files:
|
|
|
753
764
|
- lib/rubik/storage/layout.rb
|
|
754
765
|
- lib/rubik/storage/ranking.rb
|
|
755
766
|
- lib/rubik/storage/render.rb
|
|
767
|
+
- lib/rubik/storage/search.rb
|
|
756
768
|
- lib/rubik/storage/service.rb
|
|
757
769
|
- lib/rubik/storage/store.rb
|
|
758
770
|
- lib/rubik/storage/transcript_indexer.rb
|