rubik 0.8.0 → 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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/ATTRIBUTION.md +1 -1
  3. data/CHANGELOG.md +65 -1
  4. data/lib/rubik/kernel/dispatcher.rb +19 -23
  5. data/lib/rubik/kernel/init.rb +22 -18
  6. data/lib/rubik/orchestrator/goal_ledger/ledger.rb +3 -9
  7. data/lib/rubik/orchestrator/goal_ledger/observation_projection.rb +3 -9
  8. data/lib/rubik/orchestrator/subagent/deferred_spec.rb +51 -2
  9. data/lib/rubik/orchestrator/subagent/dependency.rb +20 -20
  10. data/lib/rubik/orchestrator/subagent/execution_reads.rb +1 -1
  11. data/lib/rubik/orchestrator/subagent/journal.rb +3 -9
  12. data/lib/rubik/orchestrator/subagent/lifecycle.rb +10 -1
  13. data/lib/rubik/orchestrator/subagent/paging.rb +49 -0
  14. data/lib/rubik/orchestrator/subagent/reaper.rb +1 -3
  15. data/lib/rubik/orchestrator/subagent/redeploy_transaction.rb +99 -0
  16. data/lib/rubik/orchestrator/subagent/result_archive.rb +12 -22
  17. data/lib/rubik/orchestrator/subagent/reuse.rb +37 -31
  18. data/lib/rubik/orchestrator/subagent/spawn_transaction.rb +1 -1
  19. data/lib/rubik/orchestrator/subagent/supervisor.rb +6 -2
  20. data/lib/rubik/orchestrator/subagent/task_ownership.rb +2 -2
  21. data/lib/rubik/orchestrator/subagent/transcript_reader.rb +14 -13
  22. data/lib/rubik/repl/commands/subagents.rb +3 -2
  23. data/lib/rubik/repl/pruner/service.rb +4 -9
  24. data/lib/rubik/runtime/context.rb +6 -1
  25. data/lib/rubik/runtime/fiber.rb +17 -5
  26. data/lib/rubik/runtime/manager.rb +19 -12
  27. data/lib/rubik/storage/layout.rb +14 -3
  28. data/lib/rubik/tools/base.rb +31 -0
  29. data/lib/rubik/tools/builtins/dmesg.rb +1 -1
  30. data/lib/rubik/tools/builtins/exec.rb +1 -2
  31. data/lib/rubik/tools/builtins/files.rb +1 -1
  32. data/lib/rubik/tools/builtins/goal_ledger.rb +1 -1
  33. data/lib/rubik/tools/builtins/grep.rb +2 -2
  34. data/lib/rubik/tools/builtins/interactive.rb +1 -3
  35. data/lib/rubik/tools/builtins/lsp.rb +2 -2
  36. data/lib/rubik/tools/builtins/pruner.rb +1 -1
  37. data/lib/rubik/tools/builtins/runtime.rb +1 -1
  38. data/lib/rubik/tools/builtins/send_message.rb +14 -3
  39. data/lib/rubik/tools/builtins/skill.rb +1 -1
  40. data/lib/rubik/tools/builtins/storage.rb +1 -1
  41. data/lib/rubik/tools/builtins/subagent.rb +2 -1
  42. data/lib/rubik/tools/builtins/subagent_lifecycle.rb +5 -3
  43. data/lib/rubik/tools/builtins/symbols.rb +4 -4
  44. data/lib/rubik/tools/builtins/task.rb +1 -1
  45. data/lib/rubik/tools/builtins/vakanuvis.rb +1 -1
  46. data/lib/rubik/version.rb +1 -1
  47. metadata +3 -1
@@ -88,9 +88,7 @@ module Rubik
88
88
  # a subagent child context (ScopedRegistry rebind); the root-context
89
89
  # instance stays nil here and keeps the human-dialog behavior.
90
90
  def init0_asker
91
- return nil unless @runtime_context.respond_to?(:get)
92
-
93
- Rubik::Coeffects.get(@runtime_context, Rubik::Coeffects::SUBAGENT_QUESTION_ASKER)
91
+ service(:subagent_question_asker)
94
92
  end
95
93
 
96
94
  # One blocking round-trip for the whole batch: the maestro answers once and
@@ -20,11 +20,11 @@ module Rubik
20
20
  end
21
21
 
22
22
  def effective_lsp_manager
23
- Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::LSP_MANAGER, @lsp_manager)
23
+ service(:lsp_manager, @lsp_manager)
24
24
  end
25
25
 
26
26
  def effective_buffer_manager
27
- @buffer_manager || Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::BUFFER_MANAGER, nil)
27
+ service(:buffer_manager, @buffer_manager)
28
28
  end
29
29
 
30
30
  private
@@ -49,7 +49,7 @@ module Rubik
49
49
 
50
50
  def execute(args = {})
51
51
  action = (args["action"] || args[:action] || "status").to_s
52
- harness = Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::PRUNER, @harness)
52
+ harness = service(:pruner, @harness)
53
53
  unless harness
54
54
  return ToolOutput.error("Context pruner is not available: disabled by config " \
55
55
  "(subagents.pruner.enabled=false) or the harness is not wired " \
@@ -63,7 +63,7 @@ module Rubik
63
63
  cmds.sort.each { |name, meta| lines << " !#{name.ljust(16)} : #{meta[:description]}" }
64
64
  end
65
65
 
66
- task_mgr = (Rubik::Coeffects.get(@runtime_manager.context, Rubik::Coeffects::TASK_MANAGER) if @runtime_manager&.context.respond_to?(:get))
66
+ task_mgr = service(:task_manager)
67
67
  task_mgr ||= @shell.task_manager if @shell.respond_to?(:task_manager)
68
68
 
69
69
  if ["all", "tasks"].include?(target) && task_mgr
@@ -72,6 +72,19 @@ module Rubik
72
72
  return delivery_text(recipient) if delivered == true
73
73
  return queued_text(recipient, steps) if delivered == :queued
74
74
 
75
+ # A dependency-queued (or launching) spec exists but has never run:
76
+ # "not found" is false, and the redeploy suggestion below would
77
+ # refuse the same id — the model needs the truthful next action.
78
+ if sup.respond_to?(:get) && (spec = sup.get(recipient)) && spec.respond_to?(:queued?) &&
79
+ (spec.queued? || spec.spawning?)
80
+ return ToolOutput.error(
81
+ "Subagent '#{recipient}' is dependency-queued (deps: #{spec.depends_on.join(', ')}) and will " \
82
+ "launch automatically when its predecessors settle. Messages cannot be buffered on an unborn " \
83
+ "spec — re-send after it launches, or kill it with manage_subagents(action: 'kill', " \
84
+ "conversation_id: '#{recipient}') if the wait is no longer worth it."
85
+ )
86
+ end
87
+
75
88
  ToolOutput.error(
76
89
  "Subagent '#{recipient}' not found or no longer active. If it recently finished, redeploy it with its " \
77
90
  "context intact: manage_subagents(action: 'redeploy', conversation_id: '#{recipient}', prompt: '<task>') " \
@@ -84,9 +97,7 @@ module Rubik
84
97
  # Subagent düzlemi (rebound araç): gönderen coeffect'i GERÇEK subagent
85
98
  # id'sidir. Kök düzleminde sağlanmaz → Supervisor default'u kalır.
86
99
  def subagent_sender_id
87
- return nil unless @runtime_context.respond_to?(:get)
88
-
89
- Rubik::Coeffects.get(@runtime_context, Rubik::Coeffects::SUBAGENT_SENDER_ID)
100
+ service(:subagent_sender_id)
90
101
  end
91
102
 
92
103
  # Kök alias'ına giden mesajın yanıtı kök kişisiyle konuşur ("the
@@ -45,7 +45,7 @@ module Rubik
45
45
  end
46
46
 
47
47
  def execute(args = {})
48
- manager = Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::SKILL_MANAGER, @manager)
48
+ manager = service(:skill_manager, @manager)
49
49
  return ToolOutput.error("Error: skills manager is not available.") unless manager
50
50
  return ToolOutput.error("Error: skills are disabled (skills.enabled = false).") unless manager.enabled?
51
51
 
@@ -102,7 +102,7 @@ module Rubik
102
102
  # STORAGE_STORE coeffect'i (parent chain — subagent'lar buradan çözer)
103
103
  # → config'e dayalı tembel fresh default (storage kapalıysa nil).
104
104
  def resolve_store
105
- resolved = Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::STORAGE_STORE, @store)
105
+ resolved = service(:storage_store, @store)
106
106
  return resolved if resolved
107
107
 
108
108
  @resolve_store ||= Rubik::Storage::Service.build(config: @config, root_dir: @root_dir)
@@ -16,6 +16,7 @@ module Rubik
16
16
  module SubagentToolHelpers
17
17
  def resolve_supervisor(supervisor, runtime_context)
18
18
  return supervisor if supervisor
19
+ return service(:subagent_supervisor, ctx: runtime_context) if respond_to?(:service)
19
20
  return nil unless runtime_context.respond_to?(:get)
20
21
 
21
22
  Rubik::Coeffects.get(runtime_context, Rubik::Coeffects::SUBAGENT_SUPERVISOR)
@@ -99,7 +100,7 @@ module Rubik
99
100
  # Task ownership (issue #125): the spawning context's token owns the new
100
101
  # work (detached specs opt out per spec). Resolved at call time, so a
101
102
  # nested subagent inherits its ancestor's task through its child ctx.
102
- owner = Rubik::Coeffects.get(@runtime_context, Rubik::Coeffects::TASK_CANCELLATION)
103
+ owner = service(:task_cancellation)
103
104
 
104
105
  begin
105
106
  results = sup.spawn_batch(specs, owner: owner)
@@ -113,8 +113,10 @@ module Rubik
113
113
 
114
114
  # Blocked states that need maestro action before their chain proceeds
115
115
  # (bug-llm-timeout-observability ④): a bare JSON list made a stalled
116
- # subagent indistinguishable from a healthy one at a glance.
117
- ATTENTION_STATES = [:paused_error, :waiting_budget, :budget_exhausted, :waiting_input].freeze
116
+ # subagent indistinguishable from a healthy one at a glance. The set
117
+ # itself is owned by Lifecycle (ATTENTION_STATES beside TRANSITIONS) —
118
+ # this file used to hand-copy it.
119
+ def attention_states = Rubik::Orchestrator::Subagent::Lifecycle::ATTENTION_STATES
118
120
 
119
121
  # List with a prominent attention block: any blocked subagent is called
120
122
  # out ABOVE the JSON with its state, last error, and the exact recovery
@@ -124,7 +126,7 @@ module Rubik
124
126
  return "No active or tracked subagents." if instances.empty?
125
127
 
126
128
  lines = []
127
- attention = instances.select { |i| ATTENTION_STATES.include?(i.state.to_sym) }
129
+ attention = instances.select { |i| attention_states.include?(i.state.to_sym) }
128
130
  if attention.any?
129
131
  lines << "⚠ #{attention.size} subagent(s) need attention:"
130
132
  attention.each do |i|
@@ -30,7 +30,7 @@ module Rubik
30
30
  end
31
31
 
32
32
  def ast_graph
33
- Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::AST_GRAPH, @ast_graph)
33
+ service(:ast_graph, @ast_graph)
34
34
  end
35
35
 
36
36
  def execute(args = {})
@@ -96,7 +96,7 @@ module Rubik
96
96
  end
97
97
 
98
98
  def ast_graph
99
- Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::AST_GRAPH, @ast_graph)
99
+ service(:ast_graph, @ast_graph)
100
100
  end
101
101
 
102
102
  def execute(args = {})
@@ -146,7 +146,7 @@ module Rubik
146
146
  end
147
147
 
148
148
  def ast_graph
149
- Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::AST_GRAPH, @ast_graph)
149
+ service(:ast_graph, @ast_graph)
150
150
  end
151
151
 
152
152
  def execute(args = {})
@@ -201,7 +201,7 @@ module Rubik
201
201
  end
202
202
 
203
203
  def ast_graph
204
- Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::AST_GRAPH, @ast_graph)
204
+ service(:ast_graph, @ast_graph)
205
205
  end
206
206
 
207
207
  def execute(args = {})
@@ -72,7 +72,7 @@ module Rubik
72
72
  private
73
73
 
74
74
  def resolve_task_manager
75
- @task_manager || (@runtime_context.respond_to?(:get) ? Rubik::Coeffects.get(@runtime_context, Rubik::Coeffects::TASK_MANAGER) : nil)
75
+ service(:task_manager)
76
76
  end
77
77
 
78
78
  def extract_task_id(args)
@@ -75,7 +75,7 @@ module Rubik
75
75
 
76
76
  def execute(args = {})
77
77
  action = (args["action"] || args[:action] || "recall").to_s
78
- harness = Rubik::Coeffects.resolve(@runtime_context, Rubik::Coeffects::VAKANUIS, @harness)
78
+ harness = service(:vakanuvis, @harness)
79
79
  unless harness
80
80
  return ToolOutput.error("Vakanüvis chronicler is not available: disabled by config " \
81
81
  "(subagents.vakanuvis.enabled=false) or no store wired.")
data/lib/rubik/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rubik
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Özgür Ulukır
@@ -382,10 +382,12 @@ files:
382
382
  - lib/rubik/orchestrator/subagent/narration.rb
383
383
  - lib/rubik/orchestrator/subagent/notices.rb
384
384
  - lib/rubik/orchestrator/subagent/operation_tracker.rb
385
+ - lib/rubik/orchestrator/subagent/paging.rb
385
386
  - lib/rubik/orchestrator/subagent/profile_contract.rb
386
387
  - lib/rubik/orchestrator/subagent/profile_snapshot.rb
387
388
  - lib/rubik/orchestrator/subagent/questioner.rb
388
389
  - lib/rubik/orchestrator/subagent/reaper.rb
390
+ - lib/rubik/orchestrator/subagent/redeploy_transaction.rb
389
391
  - lib/rubik/orchestrator/subagent/resilience.rb
390
392
  - lib/rubik/orchestrator/subagent/result_archive.rb
391
393
  - lib/rubik/orchestrator/subagent/reuse.rb