samagotchi 0.2.0 → 0.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.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +198 -1
  3. data/README.md +56 -4
  4. data/bin/chi +118 -50
  5. data/docs/cli.md +184 -9
  6. data/docs/configuration.md +333 -47
  7. data/docs/desktop.md +45 -4
  8. data/docs/guardrails.md +11 -0
  9. data/docs/hooks.md +208 -5
  10. data/docs/plugins.md +68 -2
  11. data/docs/releasing.md +23 -13
  12. data/docs/sessions.md +45 -17
  13. data/lib/samagotchi/answer_display.rb +95 -0
  14. data/lib/samagotchi/archive_store.rb +90 -0
  15. data/lib/samagotchi/bootstrap/config_writer.rb +342 -0
  16. data/lib/samagotchi/bootstrap/probe.rb +262 -0
  17. data/lib/samagotchi/bootstrap_command.rb +347 -0
  18. data/lib/samagotchi/bridge/pending_card.rb +89 -0
  19. data/lib/samagotchi/bridge/turn_accumulator.rb +15 -3
  20. data/lib/samagotchi/bridge.rb +13 -1
  21. data/lib/samagotchi/bridge_client.rb +6 -2
  22. data/lib/samagotchi/bundles/check-in/manifest.yml +10 -0
  23. data/lib/samagotchi/bundles/check-in/plugin.rb +244 -0
  24. data/lib/samagotchi/bundles/source-links/hooks/source_links.rb +531 -0
  25. data/lib/samagotchi/bundles/source-links/manifest.yml +14 -0
  26. data/lib/samagotchi/bundles/source-links/source_links.md +5 -0
  27. data/lib/samagotchi/bundles/system/config_modification_protocol.md +10 -6
  28. data/lib/samagotchi/bundles/system/delegated.md +6 -7
  29. data/lib/samagotchi/bundles/system/manifest.yml +4 -4
  30. data/lib/samagotchi/bundles/system/self_map.md +8 -2
  31. data/lib/samagotchi/client.rb +81 -19
  32. data/lib/samagotchi/commands/registry.rb +8 -0
  33. data/lib/samagotchi/config.rb +252 -48
  34. data/lib/samagotchi/desktop/macos/App.swift +12 -8
  35. data/lib/samagotchi/desktop/macos/ChiRunner.swift +17 -9
  36. data/lib/samagotchi/desktop/macos/Images.swift +113 -0
  37. data/lib/samagotchi/desktop/macos/Info.plist.erb +6 -0
  38. data/lib/samagotchi/desktop/macos/Panel.swift +180 -25
  39. data/lib/samagotchi/desktop/macos.rb +59 -8
  40. data/lib/samagotchi/desktop_command.rb +6 -3
  41. data/lib/samagotchi/edit_preview.rb +82 -0
  42. data/lib/samagotchi/empty_answer_retry.rb +43 -0
  43. data/lib/samagotchi/engine.rb +434 -140
  44. data/lib/samagotchi/gem_update.rb +89 -0
  45. data/lib/samagotchi/guardrails/approval.rb +35 -4
  46. data/lib/samagotchi/guardrails/load_failures.rb +9 -3
  47. data/lib/samagotchi/guardrails/scratch_writes.rb +40 -0
  48. data/lib/samagotchi/guardrails.rb +1 -0
  49. data/lib/samagotchi/hooks/registry.rb +24 -5
  50. data/lib/samagotchi/host_registry.rb +9 -12
  51. data/lib/samagotchi/idle_client.rb +24 -15
  52. data/lib/samagotchi/idle_recap.rb +5 -1
  53. data/lib/samagotchi/idle_reminders.rb +2 -2
  54. data/lib/samagotchi/image_store.rb +10 -6
  55. data/lib/samagotchi/kernel_loop.rb +73 -94
  56. data/lib/samagotchi/live_versions.rb +59 -0
  57. data/lib/samagotchi/llm/api_key.rb +41 -0
  58. data/lib/samagotchi/llm/chat_loop.rb +132 -29
  59. data/lib/samagotchi/llm/errors.rb +41 -9
  60. data/lib/samagotchi/llm/http.rb +57 -17
  61. data/lib/samagotchi/llm/openai_chat.rb +17 -30
  62. data/lib/samagotchi/log_subscriber.rb +18 -3
  63. data/lib/samagotchi/memory_bundle/installer.rb +65 -63
  64. data/lib/samagotchi/memory_bundle/provenance.rb +51 -12
  65. data/lib/samagotchi/memory_bundle/shipped_update.rb +157 -0
  66. data/lib/samagotchi/memory_bundle/status.rb +4 -1
  67. data/lib/samagotchi/memory_bundle/system_bundle.rb +81 -53
  68. data/lib/samagotchi/model_profile.rb +24 -1
  69. data/lib/samagotchi/plugin/context.rb +22 -1
  70. data/lib/samagotchi/plugin/sessions.rb +3 -1
  71. data/lib/samagotchi/prompt.rb +4 -2
  72. data/lib/samagotchi/reminder_store.rb +1 -9
  73. data/lib/samagotchi/reply_wait.rb +126 -0
  74. data/lib/samagotchi/sampling_settings.rb +58 -0
  75. data/lib/samagotchi/self_report.rb +18 -3
  76. data/lib/samagotchi/send_command.rb +252 -11
  77. data/lib/samagotchi/session.rb +52 -11
  78. data/lib/samagotchi/session_archive_command.rb +107 -0
  79. data/lib/samagotchi/session_commands.rb +46 -7
  80. data/lib/samagotchi/session_manager.rb +115 -25
  81. data/lib/samagotchi/session_metrics.rb +222 -106
  82. data/lib/samagotchi/steer.rb +72 -0
  83. data/lib/samagotchi/terminal_ui/attached_loop.rb +57 -28
  84. data/lib/samagotchi/terminal_ui/event_renderer.rb +21 -11
  85. data/lib/samagotchi/terminal_ui/formatting.rb +40 -8
  86. data/lib/samagotchi/terminal_ui/input_support.rb +7 -19
  87. data/lib/samagotchi/terminal_ui/question_prompt.rb +35 -0
  88. data/lib/samagotchi/terminal_ui.rb +134 -247
  89. data/lib/samagotchi/text_diff.rb +181 -0
  90. data/lib/samagotchi/thinking.rb +115 -0
  91. data/lib/samagotchi/tool_activity.rb +3 -1
  92. data/lib/samagotchi/tool_runner.rb +34 -1
  93. data/lib/samagotchi/tools/ask_user_question.rb +41 -33
  94. data/lib/samagotchi/tools/builtins.rb +15 -4
  95. data/lib/samagotchi/tools/delegate_wait.rb +26 -69
  96. data/lib/samagotchi/tools/edit.rb +23 -9
  97. data/lib/samagotchi/tools/execute.rb +52 -14
  98. data/lib/samagotchi/tools/task_runtime.rb +19 -0
  99. data/lib/samagotchi/tools/task_wait.rb +27 -3
  100. data/lib/samagotchi/tools/write.rb +4 -0
  101. data/lib/samagotchi/turn_flow.rb +12 -2
  102. data/lib/samagotchi/turn_note.rb +60 -6
  103. data/lib/samagotchi/update_command.rb +308 -0
  104. data/lib/samagotchi/update_hint.rb +59 -0
  105. data/lib/samagotchi/version.rb +1 -1
  106. data/lib/samagotchi/vision_support.rb +7 -9
  107. data/lib/samagotchi/web/app.rb +91 -7
  108. data/lib/samagotchi/web/message_parts.rb +8 -3
  109. data/lib/samagotchi/web/public/activity.js +13 -1
  110. data/lib/samagotchi/web/public/annotate_presets.js +26 -0
  111. data/lib/samagotchi/web/public/annotations.js +13 -0
  112. data/lib/samagotchi/web/public/app.js +472 -111
  113. data/lib/samagotchi/web/public/card.js +5 -3
  114. data/lib/samagotchi/web/public/chat_view.js +13 -1
  115. data/lib/samagotchi/web/public/copy.js +20 -4
  116. data/lib/samagotchi/web/public/ctx.js +15 -0
  117. data/lib/samagotchi/web/public/data.js +23 -6
  118. data/lib/samagotchi/web/public/diff_view.js +58 -0
  119. data/lib/samagotchi/web/public/format.js +9 -0
  120. data/lib/samagotchi/web/public/index.html +60 -3
  121. data/lib/samagotchi/web/public/notify.js +175 -0
  122. data/lib/samagotchi/web/public/question_card.js +5 -2
  123. data/lib/samagotchi/web/public/sessions_list.js +7 -0
  124. data/lib/samagotchi/web/public/timing.js +39 -14
  125. data/lib/samagotchi/web/public/turn_events.js +75 -5
  126. data/lib/samagotchi/web/public/turn_view.js +49 -8
  127. data/lib/samagotchi/web/server.rb +8 -4
  128. data/lib/samagotchi/web/session_hub.rb +2 -1
  129. data/lib/samagotchi/web/session_summary.rb +24 -1
  130. data/lib/samagotchi/worker.rb +16 -4
  131. metadata +31 -1
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.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Dedov
@@ -123,10 +123,16 @@ files:
123
123
  - docs/releasing.md
124
124
  - docs/sessions.md
125
125
  - lib/samagotchi.rb
126
+ - lib/samagotchi/answer_display.rb
127
+ - lib/samagotchi/archive_store.rb
128
+ - lib/samagotchi/bootstrap/config_writer.rb
129
+ - lib/samagotchi/bootstrap/probe.rb
130
+ - lib/samagotchi/bootstrap_command.rb
126
131
  - lib/samagotchi/bridge.rb
127
132
  - lib/samagotchi/bridge/bounded_queue.rb
128
133
  - lib/samagotchi/bridge/card_store.rb
129
134
  - lib/samagotchi/bridge/event_id.rb
135
+ - lib/samagotchi/bridge/pending_card.rb
130
136
  - lib/samagotchi/bridge/ring_buffer.rb
131
137
  - lib/samagotchi/bridge/sse_writer.rb
132
138
  - lib/samagotchi/bridge/turn_accumulator.rb
@@ -136,6 +142,8 @@ files:
136
142
  - lib/samagotchi/bundle_needs.rb
137
143
  - lib/samagotchi/bundles/btw/manifest.yml
138
144
  - lib/samagotchi/bundles/btw/plugin.rb
145
+ - lib/samagotchi/bundles/check-in/manifest.yml
146
+ - lib/samagotchi/bundles/check-in/plugin.rb
139
147
  - lib/samagotchi/bundles/guardrails/guardrails.md
140
148
  - lib/samagotchi/bundles/guardrails/guardrails/rules.yml
141
149
  - lib/samagotchi/bundles/guardrails/manifest.yml
@@ -146,6 +154,9 @@ files:
146
154
  - lib/samagotchi/bundles/loop-guard/plugin.rb
147
155
  - lib/samagotchi/bundles/mcp/manifest.yml
148
156
  - lib/samagotchi/bundles/mcp/plugin.rb
157
+ - lib/samagotchi/bundles/source-links/hooks/source_links.rb
158
+ - lib/samagotchi/bundles/source-links/manifest.yml
159
+ - lib/samagotchi/bundles/source-links/source_links.md
149
160
  - lib/samagotchi/bundles/system/config_modification_protocol.md
150
161
  - lib/samagotchi/bundles/system/delegated.md
151
162
  - lib/samagotchi/bundles/system/identity.md
@@ -166,10 +177,14 @@ files:
166
177
  - lib/samagotchi/desktop/macos/App.swift
167
178
  - lib/samagotchi/desktop/macos/ChiRunner.swift
168
179
  - lib/samagotchi/desktop/macos/Hotkey.swift
180
+ - lib/samagotchi/desktop/macos/Images.swift
169
181
  - lib/samagotchi/desktop/macos/Info.plist.erb
170
182
  - lib/samagotchi/desktop/macos/Panel.swift
171
183
  - lib/samagotchi/desktop_command.rb
184
+ - lib/samagotchi/edit_preview.rb
185
+ - lib/samagotchi/empty_answer_retry.rb
172
186
  - lib/samagotchi/engine.rb
187
+ - lib/samagotchi/gem_update.rb
173
188
  - lib/samagotchi/guardrails.rb
174
189
  - lib/samagotchi/guardrails/approval.rb
175
190
  - lib/samagotchi/guardrails/approvals.rb
@@ -178,6 +193,7 @@ files:
178
193
  - lib/samagotchi/guardrails/load_failures.rb
179
194
  - lib/samagotchi/guardrails/protected_paths.rb
180
195
  - lib/samagotchi/guardrails/rules.rb
196
+ - lib/samagotchi/guardrails/scratch_writes.rb
181
197
  - lib/samagotchi/guardrails/targets.rb
182
198
  - lib/samagotchi/guardrails/verdict.rb
183
199
  - lib/samagotchi/hooks.rb
@@ -193,6 +209,8 @@ files:
193
209
  - lib/samagotchi/installed_gem.rb
194
210
  - lib/samagotchi/kernel_loop.rb
195
211
  - lib/samagotchi/launch_mode.rb
212
+ - lib/samagotchi/live_versions.rb
213
+ - lib/samagotchi/llm/api_key.rb
196
214
  - lib/samagotchi/llm/backend.rb
197
215
  - lib/samagotchi/llm/chat_loop.rb
198
216
  - lib/samagotchi/llm/errors.rb
@@ -215,6 +233,7 @@ files:
215
233
  - lib/samagotchi/memory_bundle/merger.rb
216
234
  - lib/samagotchi/memory_bundle/placeholder.rb
217
235
  - lib/samagotchi/memory_bundle/provenance.rb
236
+ - lib/samagotchi/memory_bundle/shipped_update.rb
218
237
  - lib/samagotchi/memory_bundle/source.rb
219
238
  - lib/samagotchi/memory_bundle/status.rb
220
239
  - lib/samagotchi/memory_bundle/system_bundle.rb
@@ -239,15 +258,19 @@ files:
239
258
  - lib/samagotchi/prompt_literal_guard.rb
240
259
  - lib/samagotchi/recap_store.rb
241
260
  - lib/samagotchi/reminder_store.rb
261
+ - lib/samagotchi/reply_wait.rb
262
+ - lib/samagotchi/sampling_settings.rb
242
263
  - lib/samagotchi/self_report.rb
243
264
  - lib/samagotchi/send_command.rb
244
265
  - lib/samagotchi/served_model.rb
245
266
  - lib/samagotchi/session.rb
267
+ - lib/samagotchi/session_archive_command.rb
246
268
  - lib/samagotchi/session_commands.rb
247
269
  - lib/samagotchi/session_delete_command.rb
248
270
  - lib/samagotchi/session_manager.rb
249
271
  - lib/samagotchi/session_metrics.rb
250
272
  - lib/samagotchi/session_observer.rb
273
+ - lib/samagotchi/steer.rb
251
274
  - lib/samagotchi/terminal_ui.rb
252
275
  - lib/samagotchi/terminal_ui/attach_launcher.rb
253
276
  - lib/samagotchi/terminal_ui/attached_loop.rb
@@ -267,6 +290,8 @@ files:
267
290
  - lib/samagotchi/terminal_ui/screen.rb
268
291
  - lib/samagotchi/terminal_ui/surface.rb
269
292
  - lib/samagotchi/terminal_ui/thinking_line.rb
293
+ - lib/samagotchi/text_diff.rb
294
+ - lib/samagotchi/thinking.rb
270
295
  - lib/samagotchi/thinking_ticker.rb
271
296
  - lib/samagotchi/thought_stream_splitter.rb
272
297
  - lib/samagotchi/token_usage.rb
@@ -304,6 +329,8 @@ files:
304
329
  - lib/samagotchi/turn_flow.rb
305
330
  - lib/samagotchi/turn_note.rb
306
331
  - lib/samagotchi/turn_tally.rb
332
+ - lib/samagotchi/update_command.rb
333
+ - lib/samagotchi/update_hint.rb
307
334
  - lib/samagotchi/version.rb
308
335
  - lib/samagotchi/vision_context.rb
309
336
  - lib/samagotchi/vision_support.rb
@@ -311,6 +338,7 @@ files:
311
338
  - lib/samagotchi/web/markdown_renderer.rb
312
339
  - lib/samagotchi/web/message_parts.rb
313
340
  - lib/samagotchi/web/public/activity.js
341
+ - lib/samagotchi/web/public/annotate_presets.js
314
342
  - lib/samagotchi/web/public/annotations.js
315
343
  - lib/samagotchi/web/public/app.js
316
344
  - lib/samagotchi/web/public/card.js
@@ -321,12 +349,14 @@ files:
321
349
  - lib/samagotchi/web/public/copy.js
322
350
  - lib/samagotchi/web/public/ctx.js
323
351
  - lib/samagotchi/web/public/data.js
352
+ - lib/samagotchi/web/public/diff_view.js
324
353
  - lib/samagotchi/web/public/format.js
325
354
  - lib/samagotchi/web/public/hold.js
326
355
  - lib/samagotchi/web/public/images.js
327
356
  - lib/samagotchi/web/public/index.html
328
357
  - lib/samagotchi/web/public/init_row.js
329
358
  - lib/samagotchi/web/public/model_pick.js
359
+ - lib/samagotchi/web/public/notify.js
330
360
  - lib/samagotchi/web/public/question_card.js
331
361
  - lib/samagotchi/web/public/route.js
332
362
  - lib/samagotchi/web/public/scope.js