space-architect 9.2.1 → 9.4.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.
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "async/process"
4
- require "async/http/client"
5
- require "async/http/endpoint"
6
- require "protocol/http/body/writable"
7
4
  require "json"
8
5
  require "pathname"
9
- require "uri"
10
6
 
11
7
  module Space::Architect
12
8
  module Harness
@@ -106,8 +102,7 @@ module Space::Architect
106
102
  @guard_path = guard_path
107
103
  end
108
104
 
109
- def run(prompt_path:, run_log_path:, chdir:, push_url: nil, push_token: nil,
110
- push_client: nil, timeout: nil, liveness_delay: LIVENESS_DELAY_SECONDS, err: $stderr)
105
+ def run(prompt_path:, run_log_path:, chdir:, timeout: nil, liveness_delay: LIVENESS_DELAY_SECONDS, err: $stderr)
111
106
  prompt_path = Pathname.new(prompt_path)
112
107
  run_log_path = Pathname.new(run_log_path)
113
108
 
@@ -117,7 +112,7 @@ module Space::Architect
117
112
  Sync do
118
113
  child = Async::Process::Child.new(*argv, chdir: chdir.to_s, in: prompt_io, out: w, err: log)
119
114
  w.close
120
- tasks = start_tee(r, log, push_url: push_url, push_token: push_token, push_client: push_client, err: err)
115
+ tasks = [Async { drain_pipe(r, log) }]
121
116
  timed_out = false
122
117
  timeout_task = nil
123
118
 
@@ -266,50 +261,6 @@ module Space::Architect
266
261
  # Best-effort: an internal read/parse failure must never break the run.
267
262
  end
268
263
 
269
- def start_tee(r, log, push_url:, push_token:, push_client:, err: $stderr)
270
- if push_url || push_client
271
- body = Protocol::HTTP::Body::Writable.new(queue: Thread::SizedQueue.new(32))
272
- push = Async { push_body(body, push_url: push_url, push_token: push_token, push_client: push_client, err: err) }
273
- [Async { tee_pipe(r, log, body, err: err) }, push]
274
- else
275
- [Async { drain_pipe(r, log) }]
276
- end
277
- end
278
-
279
- def push_body(body, push_url:, push_token:, push_client:, err: $stderr)
280
- path = push_url ? URI.parse(push_url).path : "/"
281
- headers = [["content-type", "application/x-ndjson"]]
282
- headers << ["authorization", "Bearer #{push_token}"] if push_token
283
- if push_client
284
- push_client.post(path, headers: headers, body: body).discard
285
- else
286
- Async::HTTP::Client.open(Async::HTTP::Endpoint.parse(push_url)) do |c|
287
- c.post(path, headers: headers, body: body).discard
288
- end
289
- end
290
- rescue StandardError => e
291
- err.puts "push_body: transport error (best-effort, run log intact): #{e.class}: #{e.message}"
292
- end
293
-
294
- def tee_pipe(r, log, body, err: $stderr)
295
- pushing = true
296
- while (chunk = r.gets)
297
- log.write(chunk)
298
- log.flush
299
- if pushing
300
- begin
301
- body.write(chunk)
302
- rescue StandardError => e
303
- err.puts "tee_pipe: push write failed (best-effort, continuing log): #{e.class}: #{e.message}"
304
- pushing = false
305
- end
306
- end
307
- end
308
- ensure
309
- body.close_write
310
- r.close
311
- end
312
-
313
264
  def drain_pipe(r, log)
314
265
  while (chunk = r.gets)
315
266
  log.write(chunk)
@@ -22,6 +22,49 @@ module Space::Architect
22
22
  REQUIRED_ROLES = %w[spec builder judge coordinator narrator].freeze
23
23
  ENTRY_KEYS = %w[model thinking].freeze
24
24
 
25
+ # I09: the `architect routing init` scaffold — the exact bytes the command
26
+ # writes, living beside the parsers that must accept it. Example models are
27
+ # loud REPLACE_MEs; the header comment carries both locations and the merge
28
+ # order so the file is self-documenting. Byte-exact contract: the extension
29
+ # lane's tests carry an inline copy, and the command round-trips the write
30
+ # through parse below — a template the machinery rejects is a bug.
31
+ TEMPLATE = <<~'YAML'.freeze
32
+ # architect.yaml — space-architect loop role routing, scaffolded by `architect routing init`.
33
+ # Locations (merged in this order; the space-local entry wins per role):
34
+ # global: ~/.config/space-architect/architect.yaml (machine-wide)
35
+ # local: architect.yaml beside this space's space.yaml (this file)
36
+ # A local entry overrides the global entry for THAT ROLE only; after the
37
+ # merge every agent role must be routed: spec, builder, judge, coordinator,
38
+ # narrator (architect is optional).
39
+ # Replace every example/REPLACE_ME below with a real provider/model-id
40
+ # (e.g. zai/glm-5.3). thinking is optional: off|minimal|low|medium|high|xhigh|max.
41
+ # Once saved, the next /loop or architect command picks the file up.
42
+ version: 1
43
+ roles:
44
+ architect:
45
+ model: example/REPLACE_ME
46
+ thinking: high
47
+ spec:
48
+ model: example/REPLACE_ME
49
+ thinking: high
50
+ builder:
51
+ model: example/REPLACE_ME
52
+ thinking: high
53
+ judge:
54
+ model: example/REPLACE_ME
55
+ thinking: high
56
+ coordinator:
57
+ model: example/REPLACE_ME
58
+ thinking: high
59
+ narrator:
60
+ model: example/REPLACE_ME
61
+ thinking: low
62
+ YAML
63
+
64
+ # The one canonical cure line appended to default_model_inform's last-resort
65
+ # inform — self-punctuating, appended after a single space by the caller.
66
+ INIT_HINT = "Create one: `architect routing init` (beside space.yaml) or `architect routing init --global` (~/.config/space-architect/architect.yaml).".freeze
67
+
25
68
  def self.global_path
26
69
  env = ENV["SPACE_ARCHITECT_GLOBAL_CONFIG"]
27
70
  return Pathname.new(env) unless env.nil?
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Space
4
4
  module Architect
5
- VERSION = "9.2.1"
5
+ VERSION = "9.4.0"
6
6
  end
7
7
  end
@@ -5,14 +5,10 @@ require_relative "space_architect/version"
5
5
 
6
6
  require_relative "space_architect/harness"
7
7
  require_relative "space_architect/routing"
8
- require_relative "space_architect/run_creator"
9
- require_relative "space_architect/space_push"
10
8
  require_relative "space_architect/gate_lint"
11
9
  require_relative "space_architect/gate_evaluator"
12
10
  require_relative "space_architect/architect_project"
13
11
  require_relative "space_architect/skill_installer"
14
12
  require_relative "space_architect/bug_report"
15
13
  require_relative "space_architect/research"
16
- require_relative "space_architect/conversations_client"
17
- require_relative "space_architect/session_sync"
18
14
  require_relative "space_architect/cli"