samagotchi 0.172.0 → 0.173.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/architecture.md +16 -5
- data/docs/cli.md +2 -1
- data/docs/configuration.md +1 -1
- data/docs/internals/background-tasks.md +20 -7
- data/docs/internals/bridge.md +2 -2
- data/docs/internals/engine.md +2 -1
- data/docs/internals/participants.md +67 -9
- data/docs/internals/remote-sessions.md +1 -1
- data/docs/internals/web-frontend.md +44 -15
- data/docs/plugins.md +3 -1
- data/docs/sessions.md +2 -2
- data/docs/testing.md +43 -3
- data/lib/samagotchi/bridge.rb +3 -2
- data/lib/samagotchi/bundle_command/try/sandbox.rb +2 -2
- data/lib/samagotchi/bundles/core/manifest.yml +2 -2
- data/lib/samagotchi/bundles/slow-commands/manifest.yml +3 -3
- data/lib/samagotchi/bundles/slow-commands/plugin.rb +3 -3
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/engine/participants.rb +2 -2
- data/lib/samagotchi/engine.rb +0 -1
- data/lib/samagotchi/file_ref.rb +3 -5
- data/lib/samagotchi/guardrails/participant_refusal.rb +1 -1
- data/lib/samagotchi/memory_usage.rb +2 -1
- data/lib/samagotchi/message_parts.rb +5 -3
- data/lib/samagotchi/objectives_backing.rb +6 -10
- data/lib/samagotchi/parent_report.rb +1 -1
- data/lib/samagotchi/participant_prompts.rb +101 -0
- data/lib/samagotchi/participant_turn_mode.rb +1 -1
- data/lib/samagotchi/project_env.rb +7 -5
- data/lib/samagotchi/prompt_history.rb +2 -2
- data/lib/samagotchi/send_command/parent_gate.rb +2 -2
- data/lib/samagotchi/send_command.rb +4 -4
- data/lib/samagotchi/session_command_catalog.rb +210 -0
- data/lib/samagotchi/session_commands.rb +12 -183
- data/lib/samagotchi/session_manager/lifecycle.rb +5 -4
- data/lib/samagotchi/session_manager.rb +2 -1
- data/lib/samagotchi/session_stores.rb +2 -0
- data/lib/samagotchi/spawn_env.rb +75 -0
- data/lib/samagotchi/task_files.rb +51 -0
- data/lib/samagotchi/task_transcript.rb +67 -0
- data/lib/samagotchi/task_watch.rb +8 -6
- data/lib/samagotchi/terminal_ui/attached_loop/composer.rb +3 -3
- data/lib/samagotchi/terminal_ui/attached_loop/questions.rb +2 -2
- data/lib/samagotchi/terminal_ui/attached_loop.rb +3 -3
- data/lib/samagotchi/terminal_ui/input_support.rb +1 -1
- data/lib/samagotchi/testing/boundary.rb +5 -0
- data/lib/samagotchi/tool_activity.rb +63 -79
- data/lib/samagotchi/tool_names.rb +179 -0
- data/lib/samagotchi/tool_view.rb +3 -5
- data/lib/samagotchi/tools/ask_user_question.rb +2 -1
- data/lib/samagotchi/tools/builtins.rb +1 -1
- data/lib/samagotchi/tools/cancel_reminder.rb +2 -1
- data/lib/samagotchi/tools/cancel_schedule.rb +3 -1
- data/lib/samagotchi/tools/context_read.rb +2 -1
- data/lib/samagotchi/tools/delegate.rb +2 -1
- data/lib/samagotchi/tools/delegate_result.rb +2 -1
- data/lib/samagotchi/tools/edit.rb +2 -1
- data/lib/samagotchi/tools/execute.rb +22 -28
- data/lib/samagotchi/tools/forget_outputs.rb +2 -1
- data/lib/samagotchi/tools/leftovers.rb +8 -4
- data/lib/samagotchi/tools/list_reminders.rb +2 -1
- data/lib/samagotchi/tools/list_schedules.rb +3 -1
- data/lib/samagotchi/tools/list_sessions.rb +2 -1
- data/lib/samagotchi/tools/memory.rb +3 -2
- data/lib/samagotchi/tools/objectives_tool.rb +5 -4
- data/lib/samagotchi/tools/read.rb +2 -1
- data/lib/samagotchi/tools/register_reminder.rb +2 -1
- data/lib/samagotchi/tools/schedule_task.rb +3 -1
- data/lib/samagotchi/tools/send_note.rb +2 -1
- data/lib/samagotchi/tools/task_create.rb +2 -1
- data/lib/samagotchi/tools/task_get.rb +2 -1
- data/lib/samagotchi/tools/task_list.rb +2 -1
- data/lib/samagotchi/tools/task_runtime.rb +34 -154
- data/lib/samagotchi/tools/task_stop.rb +2 -1
- data/lib/samagotchi/tools/task_wait.rb +3 -2
- data/lib/samagotchi/tools/web_fetch.rb +2 -1
- data/lib/samagotchi/tools/write.rb +2 -1
- data/lib/samagotchi/turn_checkpoint.rb +1 -1
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/app.rb +38 -36
- data/lib/samagotchi/web/message_display.rb +1 -7
- data/lib/samagotchi/web/participant_access.rb +12 -4
- data/lib/samagotchi/web/participant_history.rb +68 -0
- data/lib/samagotchi/web/participant_images.rb +2 -1
- data/lib/samagotchi/web/participant_show.rb +5 -5
- data/lib/samagotchi/web/participants_admin.rb +1 -1
- data/lib/samagotchi/web/public/app.js +13 -10
- data/lib/samagotchi/web/public/card_kinds.js +51 -0
- data/lib/samagotchi/web/public/card_registry.js +248 -0
- data/lib/samagotchi/web/public/cards_offscreen.js +3 -3
- data/lib/samagotchi/web/public/cards_place.js +21 -4
- data/lib/samagotchi/web/public/history_shape.js +1 -2
- data/lib/samagotchi/web/public/participant_history.js +27 -0
- data/lib/samagotchi/web/public/question_cards.js +16 -15
- data/lib/samagotchi/web/public/reload_check.js +90 -72
- data/lib/samagotchi/web/public/session_sync.js +4 -2
- data/lib/samagotchi/web/public/session_view.js +6 -1
- data/lib/samagotchi/web/public/stage_asking.js +18 -13
- data/lib/samagotchi/web/public/stage_place.js +144 -0
- data/lib/samagotchi/web/public/stage_probe.js +64 -0
- data/lib/samagotchi/web/public/stage_view.js +52 -104
- data/lib/samagotchi/web/public/stage_waiting.js +28 -17
- data/lib/samagotchi/web/public/task_stop.js +1 -1
- data/lib/samagotchi/web/push_routes.rb +1 -1
- data/lib/samagotchi/web/reload_check_route.rb +5 -2
- data/lib/samagotchi/web/request_body.rb +72 -0
- data/lib/samagotchi/web/server.rb +70 -0
- data/lib/samagotchi/web/session_access_routes.rb +13 -11
- data/lib/samagotchi/web/session_control.rb +21 -15
- data/lib/samagotchi/web/session_create.rb +2 -1
- data/lib/samagotchi/web/session_show.rb +8 -8
- data/lib/samagotchi/web/viewer.rb +7 -2
- data/lib/samagotchi/web/working_set_routes.rb +3 -3
- data/lib/samagotchi/worker.rb +49 -182
- data/lib/samagotchi/worker_exit_claim.rb +102 -0
- data/lib/samagotchi/worker_participant_gate.rb +156 -0
- data/lib/samagotchi/worker_task_wakes.rb +2 -2
- metadata +16 -1
|
@@ -8,7 +8,10 @@ require_relative "../process_group"
|
|
|
8
8
|
require_relative "leftovers"
|
|
9
9
|
require_relative "output_guardrails"
|
|
10
10
|
require_relative "shell"
|
|
11
|
+
require_relative "../spawn_env"
|
|
12
|
+
require_relative "../task_files"
|
|
11
13
|
require_relative "task_runtime"
|
|
14
|
+
require_relative "../tool_names"
|
|
12
15
|
|
|
13
16
|
module Samagotchi
|
|
14
17
|
module Tools
|
|
@@ -21,22 +24,19 @@ module Samagotchi
|
|
|
21
24
|
# <tool name="execute">bundle exec rspec spec/some_spec.rb --no-color</tool>
|
|
22
25
|
# <tool name="execute">ruby path/to/script.rb</tool>
|
|
23
26
|
class Execute
|
|
24
|
-
NAME =
|
|
27
|
+
NAME = ToolNames::Execute::NAME
|
|
25
28
|
TIMEOUT_SEC = 120
|
|
26
29
|
STOP_GRACE_SEC = 1.0
|
|
27
30
|
STOP_POLL_INTERVAL_SEC = 0.05
|
|
28
31
|
WAIT_SLICE_SEC = 0.2
|
|
29
|
-
|
|
30
|
-
#
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# a parent stopping its delegate) canceled the turn: :session_stopped.
|
|
38
|
-
NOT_RUN_ON_SESSION_STOP = "Error: not run, the session was stopped"
|
|
39
|
-
STOPPED_BY_SESSION_STOP = "Error: command stopped as the session was stopped"
|
|
32
|
+
# What a stopped turn's command returns (ToolNames::Execute says which
|
|
33
|
+
# stop each is for). slow-commands looks them up here by reflection.
|
|
34
|
+
NOT_RUN_ON_STOP = ToolNames::Execute::NOT_RUN_ON_STOP
|
|
35
|
+
STOPPED_BY_USER = ToolNames::Execute::STOPPED_BY_USER
|
|
36
|
+
NOT_RUN_ON_SIGNAL = ToolNames::Execute::NOT_RUN_ON_SIGNAL
|
|
37
|
+
STOPPED_BY_SIGNAL = ToolNames::Execute::STOPPED_BY_SIGNAL
|
|
38
|
+
NOT_RUN_ON_SESSION_STOP = ToolNames::Execute::NOT_RUN_ON_SESSION_STOP
|
|
39
|
+
STOPPED_BY_SESSION_STOP = ToolNames::Execute::STOPPED_BY_SESSION_STOP
|
|
40
40
|
# The first words of a command killed at the limit in kill mode (hooks
|
|
41
41
|
# match on it).
|
|
42
42
|
TIMEOUT_PREFIX = "Error: command timed out after"
|
|
@@ -67,16 +67,10 @@ module Samagotchi
|
|
|
67
67
|
# record is gone or is older than RETENTION_DAYS.
|
|
68
68
|
ORPHAN_AGE_SEC = 24 * 3600
|
|
69
69
|
RETENTION_DAYS = 14
|
|
70
|
-
# The first words of a command
|
|
71
|
-
#
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# form, "at the 120s limit".
|
|
75
|
-
HANDED_OVER = "Still running at the"
|
|
76
|
-
# What follows HANDED_OVER on the first line, as regexp source: "120s
|
|
77
|
-
# limit:" (the limit) or "4s mark:" (a message from the user ended the
|
|
78
|
-
# wait early). Every matcher of the line builds on it.
|
|
79
|
-
HANDED_OVER_AFTER = "(?:\\d+s limit|\\d+s mark):"
|
|
70
|
+
# The first words of a command handed over as a task, and what follows
|
|
71
|
+
# them on that line as regexp source (ToolNames::Execute says more).
|
|
72
|
+
HANDED_OVER = ToolNames::Execute::HANDED_OVER
|
|
73
|
+
HANDED_OVER_AFTER = ToolNames::Execute::HANDED_OVER_AFTER
|
|
80
74
|
# A message from the user waiting for the turn hands a command over
|
|
81
75
|
# early, but never before it has run this long: a short command ends
|
|
82
76
|
# on its own first, and its result is the better answer.
|
|
@@ -104,7 +98,7 @@ module Samagotchi
|
|
|
104
98
|
# instead of the user)
|
|
105
99
|
# @param env [Hash, nil] added to the command's environment, over
|
|
106
100
|
# chi's Ruby/Bundler variables scrubbed as task_create scrubs them
|
|
107
|
-
# (
|
|
101
|
+
# (SpawnEnv.sanitized_spawn_env); chi's callers build it, so it
|
|
108
102
|
# may set those keys (task_create refuses them from the model)
|
|
109
103
|
# @param on_timeout [Symbol, String, nil] :task or :kill (ON_TIMEOUT);
|
|
110
104
|
# nil reads execute.on_timeout
|
|
@@ -158,8 +152,8 @@ module Samagotchi
|
|
|
158
152
|
def self.not_run(stop_reason) = NOT_RUN.fetch(stop_reason.call, NOT_RUN_ON_STOP)
|
|
159
153
|
|
|
160
154
|
# The texts above by the stop's reason; any other is the user's Stop.
|
|
161
|
-
NOT_RUN =
|
|
162
|
-
STOPPED_BY =
|
|
155
|
+
NOT_RUN = ToolNames::Execute::NOT_RUN
|
|
156
|
+
STOPPED_BY = ToolNames::Execute::STOPPED_BY
|
|
163
157
|
|
|
164
158
|
# execute.on_timeout, or the caller's: :task (the default) or :kill.
|
|
165
159
|
def self.on_timeout_mode(value)
|
|
@@ -203,7 +197,7 @@ module Samagotchi
|
|
|
203
197
|
dir = File.join(logs_root, id)
|
|
204
198
|
FileUtils.mkdir_p(dir)
|
|
205
199
|
logs = [File.join(dir, STDOUT_LOG), File.join(dir, STDERR_LOG)]
|
|
206
|
-
exit_code_path = File.join(dir,
|
|
200
|
+
exit_code_path = File.join(dir, TaskFiles::EXIT_CODE_FILENAME)
|
|
207
201
|
begin
|
|
208
202
|
pid = spawn_logged(command, env: env, cwd: cwd, logs: logs, exit_code_path: exit_code_path)
|
|
209
203
|
rescue StandardError => e
|
|
@@ -309,7 +303,7 @@ module Samagotchi
|
|
|
309
303
|
# file, and each write lands at the end.
|
|
310
304
|
ios = logs.map { |path| File.open(path, "a") }
|
|
311
305
|
ios.each { |io| io.flock(File::LOCK_SH) }
|
|
312
|
-
ProcessGroup.spawn(
|
|
306
|
+
ProcessGroup.spawn(SpawnEnv.sanitized_spawn_env.merge(env || {}), *Shell.argv(TaskRuntime.wrapped_shell_command(command, exit_code_path)),
|
|
313
307
|
chdir: cwd, in: File::NULL, out: ios[0], err: ios[1])
|
|
314
308
|
ensure
|
|
315
309
|
ios&.each(&:close)
|
|
@@ -360,7 +354,7 @@ module Samagotchi
|
|
|
360
354
|
record, error = TaskRuntime.adopt(task)
|
|
361
355
|
return nil if error
|
|
362
356
|
|
|
363
|
-
File.write(File.join(dir, BACK_POINTER), File.expand_path(
|
|
357
|
+
File.write(File.join(dir, BACK_POINTER), File.expand_path(TaskFiles.metadata_path(record.id)))
|
|
364
358
|
TaskRuntime.record_exit_status(waiter, record.exit_code_path, task_id: record.id)
|
|
365
359
|
# Ended between the deadline and the adopt: the record says how.
|
|
366
360
|
TaskRuntime.get_record(record.id) unless waiter.alive?
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
|
+
require_relative "../tool_names"
|
|
4
5
|
|
|
5
6
|
module Samagotchi
|
|
6
7
|
module Tools
|
|
@@ -12,7 +13,7 @@ module Samagotchi
|
|
|
12
13
|
# the handler's kctx). This reads the call: models write lists as JSON,
|
|
13
14
|
# as a JSON string, or as words, so every id form is taken.
|
|
14
15
|
class ForgetOutputs
|
|
15
|
-
NAME =
|
|
16
|
+
NAME = ToolNames::ForgetOutputs::NAME
|
|
16
17
|
|
|
17
18
|
def self.name = NAME
|
|
18
19
|
|
|
@@ -28,9 +28,13 @@ module Samagotchi
|
|
|
28
28
|
WHAT = { stopped: "was stopped", detached: "was left running" }.freeze
|
|
29
29
|
# What each tool's hint tells the model to do instead. Never just
|
|
30
30
|
# "with task_create": a `server &` there is stopped too. The task
|
|
31
|
-
# side never says "use task_create" (that is how it got there)
|
|
32
|
-
# holder left running is told how to end it.
|
|
33
|
-
EXECUTE_ADVICE =
|
|
31
|
+
# side never says "use task_create" (that is how it got there); a
|
|
32
|
+
# holder left running on either side is told how to end it.
|
|
33
|
+
EXECUTE_ADVICE = {
|
|
34
|
+
stopped: "to keep a server or long job running, start it with task_create in the foreground (no `&`)",
|
|
35
|
+
detached: "it left the command's process group, so chi can't stop it: kill it if it shouldn't run; " \
|
|
36
|
+
"next time, start a long job with task_create in the foreground (no `&`)"
|
|
37
|
+
}.freeze
|
|
34
38
|
TASK_ADVICE = {
|
|
35
39
|
stopped: "to keep one running, run it in the foreground or end the command with `wait`",
|
|
36
40
|
detached: "it left the task's process group, so task_stop can't reach it: kill it if it shouldn't run; " \
|
|
@@ -45,7 +49,7 @@ module Samagotchi
|
|
|
45
49
|
def hint(kind, held:, advice:) = "(a background process kept #{held} open and #{WHAT.fetch(kind)}; #{advice})"
|
|
46
50
|
|
|
47
51
|
# execute's hint (Execute::BACKGROUND_HINT, BACKGROUND_DETACHED_HINT).
|
|
48
|
-
def execute_hint(kind) = hint(kind, held: "the output", advice: EXECUTE_ADVICE)
|
|
52
|
+
def execute_hint(kind) = hint(kind, held: "the output", advice: EXECUTE_ADVICE.fetch(kind))
|
|
49
53
|
|
|
50
54
|
# A task's hint (TaskRuntime.leftovers_note: task_get, task_wait, the
|
|
51
55
|
# finish note, task_list).
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../reminder_store"
|
|
4
|
+
require_relative "../tool_names"
|
|
4
5
|
|
|
5
6
|
module Samagotchi
|
|
6
7
|
module Tools
|
|
7
8
|
# Lists all active registered reminders.
|
|
8
9
|
class ListReminders
|
|
9
|
-
NAME =
|
|
10
|
+
NAME = ToolNames::ListReminders::NAME
|
|
10
11
|
|
|
11
12
|
def self.name = NAME
|
|
12
13
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../tool_names"
|
|
4
|
+
|
|
3
5
|
module Samagotchi
|
|
4
6
|
module Tools
|
|
5
7
|
# The durable schedules of this session's chain (docs/scheduling.md): id,
|
|
@@ -8,7 +10,7 @@ module Samagotchi
|
|
|
8
10
|
# machine-wide view. Schedules is required inside the call, so the testing
|
|
9
11
|
# kit does not pay for the session lifecycle at load time.
|
|
10
12
|
class ListSchedules
|
|
11
|
-
NAME =
|
|
13
|
+
NAME = ToolNames::ListSchedules::NAME
|
|
12
14
|
|
|
13
15
|
def self.name = NAME
|
|
14
16
|
|
|
@@ -4,6 +4,7 @@ require_relative "../paths"
|
|
|
4
4
|
require_relative "../project_scope"
|
|
5
5
|
require_relative "../session"
|
|
6
6
|
require_relative "peers"
|
|
7
|
+
require_relative "../tool_names"
|
|
7
8
|
|
|
8
9
|
module Samagotchi
|
|
9
10
|
# Loaded on first use: this autoload keeps SessionManager and its ~80
|
|
@@ -18,7 +19,7 @@ module Samagotchi
|
|
|
18
19
|
# they are cut short and labelled as such. A session this one delegated
|
|
19
20
|
# is marked child, the one that delegated this one parent.
|
|
20
21
|
class ListSessions
|
|
21
|
-
NAME =
|
|
22
|
+
NAME = ToolNames::ListSessions::NAME
|
|
22
23
|
LIMIT = 20
|
|
23
24
|
|
|
24
25
|
def self.name = NAME
|
|
@@ -7,6 +7,7 @@ require_relative "../atomic_file"
|
|
|
7
7
|
require_relative "../memory_orphans"
|
|
8
8
|
require_relative "../memory_paths"
|
|
9
9
|
require_relative "../model_match"
|
|
10
|
+
require_relative "../tool_names"
|
|
10
11
|
|
|
11
12
|
module Samagotchi
|
|
12
13
|
module Tools
|
|
@@ -19,7 +20,7 @@ module Samagotchi
|
|
|
19
20
|
# When scope is omitted, reads from project first and falls back to system.
|
|
20
21
|
# Usage: call("entry_name", scope: "project"|"system"|nil)
|
|
21
22
|
class MemoryRead
|
|
22
|
-
NAME =
|
|
23
|
+
NAME = ToolNames::MemoryRead::NAME
|
|
23
24
|
|
|
24
25
|
def self.name = NAME
|
|
25
26
|
|
|
@@ -223,7 +224,7 @@ module Samagotchi
|
|
|
223
224
|
# Passing path: "index" writes index.md verbatim (no index maintenance).
|
|
224
225
|
# Usage: call(content, path: "entry_name", scope: "project"|"system", description: "…")
|
|
225
226
|
class MemoryWrite
|
|
226
|
-
NAME =
|
|
227
|
+
NAME = ToolNames::MemoryWrite::NAME
|
|
227
228
|
|
|
228
229
|
def self.name = NAME
|
|
229
230
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../tool_response"
|
|
4
|
+
require_relative "../tool_names"
|
|
4
5
|
|
|
5
6
|
module Samagotchi
|
|
6
7
|
# Read at a call only: the builtins' file list loads this, Session not with it.
|
|
@@ -15,9 +16,9 @@ module Samagotchi
|
|
|
15
16
|
# action being the /objectives line; the model never changes the list by
|
|
16
17
|
# itself. See docs/internals/objectives.md.
|
|
17
18
|
class ObjectivesTool
|
|
18
|
-
NAME =
|
|
19
|
+
NAME = ToolNames::ObjectivesTool::NAME
|
|
19
20
|
MOVE = "move"
|
|
20
|
-
PROPOSE =
|
|
21
|
+
PROPOSE = ToolNames::ObjectivesTool::PROPOSE
|
|
21
22
|
PROPOSED = "Proposed %s. The list is unchanged: the user sees a card and applies it or not."
|
|
22
23
|
RECORDED = "Recorded a move on %s."
|
|
23
24
|
EDITED_BY_USER = "The user edits the list with /objectives."
|
|
@@ -25,8 +26,8 @@ module Samagotchi
|
|
|
25
26
|
# A move's state: where the objective stands in the agent's view. DONE is
|
|
26
27
|
# its claim, never a status change (the user marks done).
|
|
27
28
|
PROGRESS = "progress"
|
|
28
|
-
BLOCKED =
|
|
29
|
-
DONE =
|
|
29
|
+
BLOCKED = ToolNames::ObjectivesTool::BLOCKED
|
|
30
|
+
DONE = ToolNames::ObjectivesTool::DONE
|
|
30
31
|
STATES = [PROGRESS, BLOCKED, DONE].freeze
|
|
31
32
|
|
|
32
33
|
def self.name = NAME
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
require_relative "output_guardrails"
|
|
4
4
|
require_relative "tool_path"
|
|
5
5
|
require_relative "../image_store"
|
|
6
|
+
require_relative "../tool_names"
|
|
6
7
|
|
|
7
8
|
module Samagotchi
|
|
8
9
|
module Tools
|
|
9
10
|
# Reads a file from disk and returns its contents as a string.
|
|
10
11
|
class Read
|
|
11
|
-
NAME =
|
|
12
|
+
NAME = ToolNames::Read::NAME
|
|
12
13
|
|
|
13
14
|
DEFAULT_HARD_MAX_BYTES = 2 * 1024 * 1024
|
|
14
15
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "json"
|
|
4
4
|
require_relative "../reminder_store"
|
|
5
|
+
require_relative "../tool_names"
|
|
5
6
|
|
|
6
7
|
module Samagotchi
|
|
7
8
|
module Tools
|
|
@@ -12,7 +13,7 @@ module Samagotchi
|
|
|
12
13
|
# without blocking the main turn. The reminder fires when the agent is idle
|
|
13
14
|
# and a new turn is about to start.
|
|
14
15
|
class RegisterReminder
|
|
15
|
-
NAME =
|
|
16
|
+
NAME = ToolNames::RegisterReminder::NAME
|
|
16
17
|
|
|
17
18
|
def self.name = NAME
|
|
18
19
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../tool_names"
|
|
4
|
+
|
|
3
5
|
module Samagotchi
|
|
4
6
|
module Tools
|
|
5
7
|
# Register a durable schedule for this session (docs/scheduling.md): a
|
|
@@ -9,7 +11,7 @@ module Samagotchi
|
|
|
9
11
|
# Unlike register_reminder, a schedule needs no live worker — a tick run by
|
|
10
12
|
# cron (or chi web's hub) wakes one — and it never holds an idle worker up.
|
|
11
13
|
class ScheduleTask
|
|
12
|
-
NAME =
|
|
14
|
+
NAME = ToolNames::ScheduleTask::NAME
|
|
13
15
|
|
|
14
16
|
def self.name = NAME
|
|
15
17
|
|
|
@@ -5,13 +5,14 @@ require_relative "../context_note"
|
|
|
5
5
|
require_relative "../session_inbox"
|
|
6
6
|
require_relative "../note_delivery"
|
|
7
7
|
require_relative "peers"
|
|
8
|
+
require_relative "../tool_names"
|
|
8
9
|
|
|
9
10
|
module Samagotchi
|
|
10
11
|
module Tools
|
|
11
12
|
# Tell another chi session something: a context note it sees on its next
|
|
12
13
|
# turn as background from this session. It never starts a turn there.
|
|
13
14
|
class SendNote
|
|
14
|
-
NAME =
|
|
15
|
+
NAME = ToolNames::SendNote::NAME
|
|
15
16
|
|
|
16
17
|
def self.name = NAME
|
|
17
18
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "task_runtime"
|
|
4
|
+
require_relative "../tool_names"
|
|
4
5
|
|
|
5
6
|
module Samagotchi
|
|
6
7
|
module Tools
|
|
7
8
|
class TaskList
|
|
8
|
-
NAME =
|
|
9
|
+
NAME = ToolNames::TaskList::NAME
|
|
9
10
|
COMMAND_PREVIEW_LIMIT = 80
|
|
10
11
|
|
|
11
12
|
def self.name = NAME
|