rubik 0.15.2 → 0.15.3
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 +40 -3
- data/lib/rubik/ast/cache_store.rb +22 -4
- data/lib/rubik/ast/extractor.rb +1 -4
- data/lib/rubik/ast/ruby_extractor.rb +23 -1
- data/lib/rubik/ast/symbol.rb +9 -4
- data/lib/rubik/ast/treesitter/python_walker.rb +5 -4
- data/lib/rubik/ast/treesitter_extractor.rb +10 -3
- data/lib/rubik/buffer/diff.rb +34 -2
- data/lib/rubik/buffer/manager.rb +18 -15
- data/lib/rubik/buffer/path_validator.rb +18 -2
- data/lib/rubik/buffer/snapshot.rb +144 -9
- data/lib/rubik/concurrency/timers.rb +7 -0
- data/lib/rubik/config/scoped.rb +18 -7
- data/lib/rubik/config/secret_policy.rb +22 -1
- data/lib/rubik/config.rb +24 -26
- data/lib/rubik/context/ignore_rules.rb +7 -2
- data/lib/rubik/diagnostics/parser.rb +19 -8
- data/lib/rubik/kernel/dispatcher.rb +11 -5
- data/lib/rubik/llm/client.rb +24 -3
- data/lib/rubik/llm/connection_pool.rb +51 -30
- data/lib/rubik/llm/message_sanitizer.rb +20 -1
- data/lib/rubik/llm/sse_parser.rb +10 -1
- data/lib/rubik/lsp/transport.rb +61 -1
- data/lib/rubik/mcp/transport/stdio.rb +139 -122
- data/lib/rubik/orchestrator/activity_log.rb +3 -2
- data/lib/rubik/orchestrator/subagent/completion.rb +18 -8
- data/lib/rubik/platform/process.rb +74 -19
- data/lib/rubik/plugin/manager.rb +5 -6
- data/lib/rubik/repl/service_catalog.rb +1 -1
- data/lib/rubik/repl/terminal_guard.rb +29 -23
- data/lib/rubik/repl/turn_recorder.rb +35 -11
- data/lib/rubik/sandbox/driver/process.rb +11 -2
- data/lib/rubik/security/blocked_guidance.rb +4 -2
- data/lib/rubik/security/command_gate.rb +27 -14
- data/lib/rubik/security/errors.rb +13 -0
- data/lib/rubik/security/guard.rb +11 -2
- data/lib/rubik/security/path_policy.rb +9 -6
- data/lib/rubik/storage/store.rb +31 -11
- data/lib/rubik/tools/builtins/exec.rb +5 -1
- data/lib/rubik/tools/builtins/files.rb +2 -0
- data/lib/rubik/tools/uri_resolver.rb +23 -3
- data/lib/rubik/version.rb +1 -1
- metadata +1 -1
data/lib/rubik/storage/store.rb
CHANGED
|
@@ -24,8 +24,9 @@ module Rubik
|
|
|
24
24
|
# fiziki => <root>/<project>/store/{meta.json,<type>.jsonl}
|
|
25
25
|
# indeks => <root>/index.json (merkezi; proje sayıları + zaman damgaları)
|
|
26
26
|
#
|
|
27
|
-
# Tek kullanıcı CLI ölçeği: süreç içi Monitor ile thread-güvenli;
|
|
28
|
-
# süreç yazımlarında
|
|
27
|
+
# Tek kullanıcı CLI ölçeği: süreç içi Monitor ile thread-güvenli; index.json
|
|
28
|
+
# çapraz süreç yazımlarında flock ile serileştirilir, meta.json ise
|
|
29
|
+
# last-writer-wins (belgelenmiş sınırlama).
|
|
29
30
|
# Yazmalar Platform.atomic_write ile tmp+rename; kurulum tembeldir —
|
|
30
31
|
# ilk mutasyona kadar hiçbir dizin oluşturulmaz (standalone/test
|
|
31
32
|
# kurulumu dosya sistemine dokunmaz).
|
|
@@ -34,6 +35,9 @@ module Rubik
|
|
|
34
35
|
ID_PATTERN = /\A([a-z]+)\.(\d+)\.([0-9a-f]{16})\z/
|
|
35
36
|
HASH_PREFIX_MIN = 8
|
|
36
37
|
REF_PATTERN = /\A[a-zA-Z0-9._-]+\z/
|
|
38
|
+
# File::NOFOLLOW is POSIX-only; on Windows the advisory-flock guard
|
|
39
|
+
# remains and only the symlink refusal is unavailable.
|
|
40
|
+
LOCK_NOFOLLOW = defined?(File::NOFOLLOW) ? File::NOFOLLOW : 0
|
|
37
41
|
|
|
38
42
|
Summary = Struct.new(:id, :row, :title, :status, :updated_at, :tags, keyword_init: true)
|
|
39
43
|
|
|
@@ -467,16 +471,32 @@ module Rubik
|
|
|
467
471
|
|
|
468
472
|
# Merkezi indeksi günceller: bu projenin girdisi canlı meta'dan
|
|
469
473
|
# yeniden yazılır, diğer projelerin girdileri korunur.
|
|
474
|
+
# @monitor yalnızca TEK Store örneğini serileştirir; farkı projelerin
|
|
475
|
+
# Store'ları (ve ayrı süreçler) aynı indeksi hedefleyebilir. Okuma-değiştirme-
|
|
476
|
+
# yazımı indeksten türetilen sabit bir kilit dosyasında flock ile seri
|
|
477
|
+
# hale getiririz; kilit yalnızca bu kısa kritik bölümü kapsar.
|
|
470
478
|
def touch_index(meta)
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
479
|
+
path = Layout.index_path(@root)
|
|
480
|
+
lock_path = "#{path}.lock"
|
|
481
|
+
FileUtils.mkdir_p(File.dirname(lock_path))
|
|
482
|
+
# NOFOLLOW+0600: a pre-placed symlink at the derived lock path must not
|
|
483
|
+
# redirect the flock to an arbitrary file in a shared storage root.
|
|
484
|
+
File.open(lock_path, File::RDWR | File::CREAT | LOCK_NOFOLLOW, 0o600) do |lock|
|
|
485
|
+
lock.flock(File::LOCK_EX)
|
|
486
|
+
begin
|
|
487
|
+
snapshot = self.class.index_snapshot(@root)
|
|
488
|
+
snapshot["projects"][@project] = {
|
|
489
|
+
"path" => project_dir,
|
|
490
|
+
"entity_counts" => meta.fetch("counts", {}).dup,
|
|
491
|
+
"created_at" => (snapshot["projects"][@project] || {})["created_at"] || meta["created_at"],
|
|
492
|
+
"updated_at" => meta["updated_at"]
|
|
493
|
+
}
|
|
494
|
+
snapshot["updated_at"] = meta["updated_at"]
|
|
495
|
+
Rubik::Platform.atomic_write(path, JSON.pretty_generate(snapshot))
|
|
496
|
+
ensure
|
|
497
|
+
lock.flock(File::LOCK_UN)
|
|
498
|
+
end
|
|
499
|
+
end
|
|
480
500
|
end
|
|
481
501
|
end
|
|
482
502
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require "stringio"
|
|
4
4
|
require_relative "../base"
|
|
5
5
|
require_relative "../output"
|
|
6
|
+
require_relative "../symbol_tool_support"
|
|
6
7
|
require_relative "../../security/blocked_guidance"
|
|
7
8
|
|
|
8
9
|
module Rubik
|
|
@@ -149,7 +150,10 @@ module Rubik
|
|
|
149
150
|
|
|
150
151
|
def execute(args = {})
|
|
151
152
|
cmd = (args["command"] || args[:command]).to_s.strip
|
|
152
|
-
|
|
153
|
+
return ToolOutput.error("Error: `command` parameter is required and must not be empty.") if cmd.empty?
|
|
154
|
+
|
|
155
|
+
background, flag_error = SymbolToolSupport.boolean_argument(args, "background")
|
|
156
|
+
return flag_error if flag_error
|
|
153
157
|
return execute_background(cmd) if background
|
|
154
158
|
|
|
155
159
|
timeout = effective_timeout(args)
|
|
@@ -111,6 +111,8 @@ module Rubik
|
|
|
111
111
|
return ToolOutput.error("Error: Invalid file path '#{path}'. Path must be a valid file path " \
|
|
112
112
|
"relative to the project root (e.g. 'lib/app.rb', 'src/main.go', 'Gemfile').")
|
|
113
113
|
end
|
|
114
|
+
shape_ok = Rubik::Buffer::PathValidator.contained_relative?(path)
|
|
115
|
+
return ToolOutput.error(DiagnosticReporter.render_traversal_blocked(path)) unless shape_ok
|
|
114
116
|
|
|
115
117
|
# NB: reset_baseline defaults to false on purpose. The buffer only
|
|
116
118
|
# replaces the tracked baseline for files that have no baseline yet
|
|
@@ -137,6 +137,12 @@ module Rubik
|
|
|
137
137
|
# GoalStateAdapter precedent — a second registration would shadow this
|
|
138
138
|
# one).
|
|
139
139
|
class SubagentTranscriptAdapter
|
|
140
|
+
FRAGMENT_PARAM_KEYS = ["cursor", "limit", "snapshot"].freeze
|
|
141
|
+
FRAGMENT_SHAPES = {
|
|
142
|
+
"cursor" => /\A\d+\z/,
|
|
143
|
+
"snapshot" => /\A[a-z][a-z0-9_]*:[0-9a-f]{16}\z/
|
|
144
|
+
}.freeze
|
|
145
|
+
|
|
140
146
|
def match?(uri)
|
|
141
147
|
Rubik::Uris::SUBAGENT_TRANSCRIPT.match?(uri) || Rubik::Uris::SUBAGENT_RESULT.match?(uri)
|
|
142
148
|
end
|
|
@@ -180,12 +186,26 @@ module Rubik
|
|
|
180
186
|
Rubik::Orchestrator::Subagent::TranscriptReader.render_page(page)
|
|
181
187
|
end
|
|
182
188
|
|
|
183
|
-
# Fragment grammar: "#cursor=N&snapshot=
|
|
184
|
-
#
|
|
189
|
+
# Fragment grammar: "#cursor=N&limit=N&snapshot=SOURCE:HEX". Unknown
|
|
190
|
+
# keys and malformed values are dropped (the reader falls back to its
|
|
191
|
+
# own defaults) — no fragment text ever reaches the reader unchecked.
|
|
185
192
|
def fragment_params(uri)
|
|
186
193
|
uri.split("#", 2)[1].to_s.split("&").each_with_object({}) do |pair, acc|
|
|
187
194
|
key, value = pair.split("=", 2)
|
|
188
|
-
|
|
195
|
+
next unless key && value && valid_fragment_param?(key, value)
|
|
196
|
+
|
|
197
|
+
acc[key] = value
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
def valid_fragment_param?(key, value)
|
|
202
|
+
return false unless FRAGMENT_PARAM_KEYS.include?(key)
|
|
203
|
+
|
|
204
|
+
case key
|
|
205
|
+
when "limit"
|
|
206
|
+
value.match?(/\A\d+\z/) && value.to_i.between?(1, Rubik::Orchestrator::Subagent::TranscriptReader::MAX_PAGE_CHARS)
|
|
207
|
+
else
|
|
208
|
+
FRAGMENT_SHAPES.fetch(key).match?(value)
|
|
189
209
|
end
|
|
190
210
|
end
|
|
191
211
|
|
data/lib/rubik/version.rb
CHANGED