samagotchi 0.50.0 → 0.51.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/CHANGELOG.md +44 -1
- data/docs/cli.md +21 -7
- data/docs/configuration.md +11 -9
- data/docs/hooks.md +3 -2
- data/docs/internals/engine.md +4 -2
- data/docs/sessions.md +5 -4
- data/lib/samagotchi/bridge/turn_accumulator.rb +3 -1
- data/lib/samagotchi/bridge.rb +24 -9
- data/lib/samagotchi/bridge_client.rb +3 -1
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/delivery.rb +33 -0
- data/lib/samagotchi/host_registry.rb +16 -3
- data/lib/samagotchi/kernel_loop.rb +28 -2
- data/lib/samagotchi/llm/native_tool_normalizer.rb +2 -2
- data/lib/samagotchi/send_command.rb +63 -10
- data/lib/samagotchi/session_commands.rb +9 -0
- data/lib/samagotchi/session_inbox.rb +27 -7
- data/lib/samagotchi/session_manager.rb +13 -3
- data/lib/samagotchi/session_metrics.rb +25 -6
- data/lib/samagotchi/sessions_command.rb +1 -1
- data/lib/samagotchi/steer_cut.rb +12 -8
- data/lib/samagotchi/terminal_ui/attached_loop.rb +48 -1
- data/lib/samagotchi/terminal_ui/formatting.rb +51 -4
- data/lib/samagotchi/terminal_ui.rb +48 -5
- data/lib/samagotchi/tool_activity.rb +3 -0
- data/lib/samagotchi/tool_runner.rb +2 -0
- data/lib/samagotchi/tools/builtin_calls.rb +33 -0
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +6 -2
- data/lib/samagotchi/web/message_parts.rb +3 -0
- data/lib/samagotchi/web/public/activity.js +6 -0
- data/lib/samagotchi/web/public/app.js +66 -28
- data/lib/samagotchi/web/public/index.html +17 -15
- data/lib/samagotchi/web/public/session_title.js +26 -0
- data/lib/samagotchi/web/public/strip.js +4 -6
- data/lib/samagotchi/web/public/turn_events.js +3 -2
- data/lib/samagotchi/web/public/turn_html.js +3 -1
- data/lib/samagotchi/worker.rb +1 -1
- data/lib/samagotchi/worker_inbound.rb +8 -5
- data/lib/samagotchi.rb +1 -0
- metadata +3 -1
|
@@ -558,8 +558,9 @@ export function snapshotEvents({ current_turn: turn = null, queued = [], queued_
|
|
|
558
558
|
const call = { iteration: part.iteration, call_index: part.call_index, tool: part.tool };
|
|
559
559
|
if (part.label) call.label = part.label;
|
|
560
560
|
const title = part.title ? { title: part.title } : {};
|
|
561
|
+
const alias = part.called_as ? { called_as: part.called_as } : {};
|
|
561
562
|
const view = part.view ? { view: part.view } : {};
|
|
562
|
-
events.push({ type: "tool_call_started", ...call, params: part.params, ...title, ...view });
|
|
563
|
+
events.push({ type: "tool_call_started", ...call, params: part.params, ...title, ...alias, ...view });
|
|
563
564
|
if (part.status !== "running") {
|
|
564
565
|
// The activity as the live event had it; action and duration_ms
|
|
565
566
|
// only in snapshots from a worker that keeps them (the TUI's
|
|
@@ -567,7 +568,7 @@ export function snapshotEvents({ current_turn: turn = null, queued = [], queued_
|
|
|
567
568
|
const action = part.action ? { action: part.action } : {};
|
|
568
569
|
const completed = {
|
|
569
570
|
type: "tool_call_completed", ...call, output: part.output, output_truncated: !!part.output_truncated,
|
|
570
|
-
activity: { ...action, tool: part.tool, status: part.status, params: part.params, ...title },
|
|
571
|
+
activity: { ...action, tool: part.tool, status: part.status, params: part.params, ...title, ...alias },
|
|
571
572
|
};
|
|
572
573
|
if (part.duration_ms != null) completed.duration_ms = part.duration_ms;
|
|
573
574
|
if (part.diff) completed.diff = part.diff;
|
|
@@ -78,13 +78,15 @@ export function toolRowInnerHtml(row, { thumbs = () => "" } = {}) {
|
|
|
78
78
|
const shown = row.title || row.params;
|
|
79
79
|
const hover = rowHover(row) ? ` title="${escapeHtml(rowHover(row))}"` : "";
|
|
80
80
|
const params = shown ? `<span class="activity-params"${hover}>${escapeHtml(shown)}</span>` : "";
|
|
81
|
+
// The name the model called the tool by when it was an alias's, dim.
|
|
82
|
+
const alias = row.called_as ? `<span class="activity-alias">(called as ${escapeHtml(row.called_as)})</span>` : "";
|
|
81
83
|
const duration = formatDuration(row.duration_ms);
|
|
82
84
|
const full = row.status === "running" ? "" : String(row.output || "").replace(/^\[[^\]]*\]\s*/, "");
|
|
83
85
|
const output = full
|
|
84
86
|
? `<div class="activity-output" title="${escapeHtml(full)}">${escapeHtml(full.length > 300 ? `${full.slice(0, 300)}…` : full)}</div>`
|
|
85
87
|
: "";
|
|
86
88
|
const status = statusParts(row.status);
|
|
87
|
-
return `${statusMarkHtml(status)}<span class="activity-tool">${escapeHtml(toolName(row))}</span>${params}${statusWordHtml(status)}` +
|
|
89
|
+
return `${statusMarkHtml(status)}<span class="activity-tool">${escapeHtml(toolName(row))}</span>${params}${alias}${statusWordHtml(status)}` +
|
|
88
90
|
`${duration ? `<span class="activity-duration">${escapeHtml(duration)}</span>` : ""}` +
|
|
89
91
|
`${commandBlockHtml(row.view, row.title)}${llmEditHtml(row)}${output}` +
|
|
90
92
|
`${row.images?.length ? thumbs(row.images) : ""}${row.diff ? activityDiffHtml(row.diff) : ""}`;
|
data/lib/samagotchi/worker.rb
CHANGED
|
@@ -953,7 +953,7 @@ module Samagotchi
|
|
|
953
953
|
# A line with images runs as its own next turn (steering merges text
|
|
954
954
|
# only), and so does anything queued after it, to keep the order.
|
|
955
955
|
files = SessionInbox.find_new_input_files(@session_dir).sort
|
|
956
|
-
.take_while { |input_file| !SessionInbox.
|
|
956
|
+
.take_while { |input_file| !SessionInbox.waits_for_turn_end?(input_file) }
|
|
957
957
|
merged = files.filter_map do |input_file|
|
|
958
958
|
claimed_file = SessionInbox.claim_input_file(input_file)
|
|
959
959
|
next unless claimed_file
|
|
@@ -31,9 +31,11 @@ module Samagotchi
|
|
|
31
31
|
|
|
32
32
|
# A prompt to run a turn for: an input file's, or the first prompt.
|
|
33
33
|
# +no_interrupt+: an offer its turn makes keeps it for its continue
|
|
34
|
-
# turn; +images+: its image refs ({file:, name:})
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
# turn; +images+: its image refs ({file:, name:}); +delivery+: the wire
|
|
35
|
+
# value the sender asked for ("queue", or nil for the default
|
|
36
|
+
# next_step).
|
|
37
|
+
Prompt = Data.define(:text, :origin, :no_interrupt, :images, :delivery) do
|
|
38
|
+
def initialize(text:, origin: nil, no_interrupt: false, images: [], delivery: nil) = super
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# A context wake turn to run: the ContextAbsorber::Delivery that woke
|
|
@@ -181,11 +183,12 @@ module Samagotchi
|
|
|
181
183
|
return unless claimed_file
|
|
182
184
|
|
|
183
185
|
begin
|
|
184
|
-
message, origin, no_interrupt, images = SessionInbox.read_input(claimed_file)
|
|
186
|
+
message, origin, no_interrupt, images, delivery = SessionInbox.read_input(claimed_file)
|
|
185
187
|
return if message.to_s.strip.empty?
|
|
186
188
|
return if Array(images).empty? && queue_as_command(message, origin, File.basename(input_file))
|
|
187
189
|
|
|
188
|
-
yield Prompt.new(text: message, origin: origin, no_interrupt: !!no_interrupt, images: images || []
|
|
190
|
+
yield Prompt.new(text: message, origin: origin, no_interrupt: !!no_interrupt, images: images || [],
|
|
191
|
+
delivery: delivery)
|
|
189
192
|
ensure
|
|
190
193
|
FileUtils.rm_f(claimed_file)
|
|
191
194
|
end
|
data/lib/samagotchi.rb
CHANGED
|
@@ -6,6 +6,7 @@ require_relative "samagotchi/model_profile"
|
|
|
6
6
|
require_relative "samagotchi/prompt"
|
|
7
7
|
require_relative "samagotchi/client"
|
|
8
8
|
require_relative "samagotchi/debug_log"
|
|
9
|
+
require_relative "samagotchi/delivery"
|
|
9
10
|
require_relative "samagotchi/pending_input_queue"
|
|
10
11
|
require_relative "samagotchi/kernel_loop"
|
|
11
12
|
require_relative "samagotchi/session"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: samagotchi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.51.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -238,6 +238,7 @@ files:
|
|
|
238
238
|
- lib/samagotchi/continue_offer.rb
|
|
239
239
|
- lib/samagotchi/cut_policy.rb
|
|
240
240
|
- lib/samagotchi/debug_log.rb
|
|
241
|
+
- lib/samagotchi/delivery.rb
|
|
241
242
|
- lib/samagotchi/desktop.rb
|
|
242
243
|
- lib/samagotchi/desktop/macos.rb
|
|
243
244
|
- lib/samagotchi/desktop/macos/App.swift
|
|
@@ -533,6 +534,7 @@ files:
|
|
|
533
534
|
- lib/samagotchi/web/public/scroll.js
|
|
534
535
|
- lib/samagotchi/web/public/sentences.js
|
|
535
536
|
- lib/samagotchi/web/public/session_state.js
|
|
537
|
+
- lib/samagotchi/web/public/session_title.js
|
|
536
538
|
- lib/samagotchi/web/public/sessions_list.js
|
|
537
539
|
- lib/samagotchi/web/public/shown_texts.js
|
|
538
540
|
- lib/samagotchi/web/public/stable_html.js
|