samagotchi 0.164.0 → 0.166.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 +88 -1
- data/docs/architecture.md +7 -5
- data/docs/cli.md +23 -12
- data/docs/configuration.md +8 -2
- data/docs/guardrails.md +19 -18
- data/docs/internals/block-renderers.md +1 -1
- data/docs/internals/bridge.md +10 -3
- data/docs/internals/bundles.md +4 -2
- data/docs/internals/inline-widgets.md +8 -1
- data/docs/internals/remote-sessions.md +1 -1
- data/docs/internals/web-frontend.md +73 -13
- data/docs/memory.md +12 -7
- data/docs/plugins.md +6 -4
- data/docs/releasing.md +17 -4
- data/docs/scheduling.md +25 -3
- data/docs/sessions.md +12 -10
- data/docs/testing.md +37 -4
- data/lib/samagotchi/block_renderers.rb +3 -6
- data/lib/samagotchi/bridge/card_store.rb +2 -1
- data/lib/samagotchi/bridge/turn_accumulator.rb +7 -8
- data/lib/samagotchi/bridge.rb +45 -3
- data/lib/samagotchi/bundle_command/installed_check.rb +2 -1
- data/lib/samagotchi/bundles/system/manifest.yml +1 -1
- data/lib/samagotchi/chi_home.rb +44 -2
- data/lib/samagotchi/client_id.rb +34 -3
- data/lib/samagotchi/compat.rb +34 -0
- data/lib/samagotchi/context_command.rb +3 -0
- data/lib/samagotchi/context_providers.rb +5 -6
- data/lib/samagotchi/context_sources.rb +2 -2
- data/lib/samagotchi/continue_intent.rb +50 -5
- data/lib/samagotchi/events.rb +4 -4
- data/lib/samagotchi/extension_load.rb +2 -1
- data/lib/samagotchi/guardrails/approvals.rb +36 -9
- data/lib/samagotchi/guardrails/child_boundary.rb +7 -27
- data/lib/samagotchi/guardrails/rules.rb +11 -9
- data/lib/samagotchi/guardrails/targets.rb +3 -4
- data/lib/samagotchi/inline_widgets.rb +16 -1
- data/lib/samagotchi/memory_bundle/provenance.rb +46 -4
- data/lib/samagotchi/memory_bundle/status.rb +2 -1
- data/lib/samagotchi/memory_command.rb +3 -0
- data/lib/samagotchi/memory_orphans.rb +4 -7
- data/lib/samagotchi/memory_paths.rb +64 -7
- data/lib/samagotchi/memory_usage.rb +1 -1
- data/lib/samagotchi/plugin/sessions.rb +8 -3
- data/lib/samagotchi/project_command.rb +4 -1
- data/lib/samagotchi/project_id_clash.rb +37 -26
- data/lib/samagotchi/project_init.rb +24 -7
- data/lib/samagotchi/reply_wait/poll.rb +4 -14
- data/lib/samagotchi/reply_wait.rb +0 -23
- data/lib/samagotchi/run_options.rb +1 -1
- data/lib/samagotchi/schedules.rb +124 -106
- data/lib/samagotchi/send_command.rb +71 -18
- data/lib/samagotchi/session.rb +3 -2
- data/lib/samagotchi/session_access/local.rb +19 -2
- data/lib/samagotchi/session_access/remote.rb +13 -17
- data/lib/samagotchi/session_chain/links.rb +109 -0
- data/lib/samagotchi/session_chain.rb +7 -19
- data/lib/samagotchi/session_continue.rb +138 -54
- data/lib/samagotchi/session_inbox.rb +1 -1
- data/lib/samagotchi/session_inbox_delivery.rb +57 -38
- data/lib/samagotchi/session_manager/delivery.rb +104 -18
- data/lib/samagotchi/session_manager/removal.rb +13 -7
- data/lib/samagotchi/session_manager.rb +1 -0
- data/lib/samagotchi/session_retention.rb +20 -10
- data/lib/samagotchi/session_setup.rb +31 -1
- data/lib/samagotchi/state_format.rb +12 -8
- data/lib/samagotchi/terminal_ui/attach_launcher.rb +6 -7
- data/lib/samagotchi/terminal_ui.rb +20 -9
- data/lib/samagotchi/tools/delegate.rb +2 -3
- data/lib/samagotchi/verify_fresh.rb +4 -1
- data/lib/samagotchi/version.rb +1 -1
- data/lib/samagotchi/web/public/activity.js +2 -2
- data/lib/samagotchi/web/public/app.js +28 -21
- data/lib/samagotchi/web/public/auth_lost.js +3 -1
- data/lib/samagotchi/web/public/bar_fold.js +293 -0
- data/lib/samagotchi/web/public/card.js +1 -1
- data/lib/samagotchi/web/public/chip_popover.js +5 -1
- data/lib/samagotchi/web/public/composer_mode.js +5 -7
- data/lib/samagotchi/web/public/delivery_line.js +19 -4
- data/lib/samagotchi/web/public/index.html +242 -94
- data/lib/samagotchi/web/public/info_bar.js +28 -16
- data/lib/samagotchi/web/public/info_bar_model.js +76 -2
- data/lib/samagotchi/web/public/live_timing.js +3 -0
- data/lib/samagotchi/web/public/more_sheet.js +98 -40
- data/lib/samagotchi/web/public/resync_reach.js +59 -0
- data/lib/samagotchi/web/public/session_fields.js +1 -0
- data/lib/samagotchi/web/public/session_state.js +5 -0
- data/lib/samagotchi/web/public/stage_frame.js +4 -2
- data/lib/samagotchi/web/public/stage_stall.js +134 -0
- data/lib/samagotchi/web/public/stage_view.js +78 -7
- data/lib/samagotchi/web/public/stream_handlers.js +1 -1
- data/lib/samagotchi/web/public/turn_events.js +0 -122
- data/lib/samagotchi/web/public/turn_model.js +1 -1
- data/lib/samagotchi/web/public/widget_picks.js +18 -3
- data/lib/samagotchi/web/session_control.rb +15 -2
- data/lib/samagotchi/web/session_create.rb +4 -2
- data/lib/samagotchi/web/token.rb +2 -2
- data/lib/samagotchi/web/update_check.rb +27 -8
- metadata +5 -1
|
@@ -11,6 +11,7 @@ require_relative "../installed_gem"
|
|
|
11
11
|
require_relative "../installed_versions"
|
|
12
12
|
require_relative "../log"
|
|
13
13
|
require_relative "../paths"
|
|
14
|
+
require_relative "../state_format"
|
|
14
15
|
require_relative "../version"
|
|
15
16
|
require_relative "auto_update_record"
|
|
16
17
|
|
|
@@ -29,6 +30,20 @@ module Samagotchi
|
|
|
29
30
|
FIRST_CHECK = 30
|
|
30
31
|
# A failed check (offline at start) tries again this soon, not a whole check_hours later.
|
|
31
32
|
RETRY = 3600
|
|
33
|
+
# update_check.json's format. A file with no version is one from
|
|
34
|
+
# before it (the same members); a newer chi's keeps its version and
|
|
35
|
+
# the keys this one doesn't know through a write.
|
|
36
|
+
STATE_FORMAT_VERSION = 1
|
|
37
|
+
STATE_FORMAT = StateFormat.new(
|
|
38
|
+
version: STATE_FORMAT_VERSION, members: [],
|
|
39
|
+
document_members: [
|
|
40
|
+
StateFormat.added(:checked_at, in_version: 1, default: nil),
|
|
41
|
+
StateFormat.added(:available, in_version: 1, default: nil),
|
|
42
|
+
StateFormat.added(:notified, in_version: 1, default: []),
|
|
43
|
+
StateFormat.added(:auto, in_version: 1, default: nil),
|
|
44
|
+
StateFormat.added(:auto_failed, in_version: 1, default: [])
|
|
45
|
+
]
|
|
46
|
+
)
|
|
32
47
|
|
|
33
48
|
# @param enabled [Boolean] update.notify: the answer goes to the page
|
|
34
49
|
# @param auto [Boolean] update.auto is install: check even when +enabled+ is not
|
|
@@ -205,18 +220,21 @@ module Samagotchi
|
|
|
205
220
|
def blocked_reason = self.class.blocked_reason(gem_spec: @gem_spec, bundler: @bundler, gem_dir: @gem_dir)
|
|
206
221
|
|
|
207
222
|
def load_state
|
|
223
|
+
@document = STATE_FORMAT.read({}, collection: nil)
|
|
208
224
|
return empty_state unless File.file?(@state_file)
|
|
209
225
|
|
|
210
|
-
|
|
226
|
+
@document = STATE_FORMAT.read(JSON.parse(File.read(@state_file)), collection: nil)
|
|
227
|
+
data = @document.attributes
|
|
211
228
|
{
|
|
212
|
-
checked_at: data[
|
|
213
|
-
available: data[
|
|
214
|
-
notified: strings(data[
|
|
215
|
-
auto: AutoUpdateRecord.from_h(data[
|
|
216
|
-
auto_failed: strings(data[
|
|
229
|
+
checked_at: data[:checked_at],
|
|
230
|
+
available: data[:available],
|
|
231
|
+
notified: strings(data[:notified]),
|
|
232
|
+
auto: AutoUpdateRecord.from_h(data[:auto]),
|
|
233
|
+
auto_failed: strings(data[:auto_failed])
|
|
217
234
|
}
|
|
218
|
-
rescue JSON::ParserError, SystemCallError => e
|
|
235
|
+
rescue JSON::ParserError, SystemCallError, StateFormat::InvalidDocument => e
|
|
219
236
|
Log.warn(:web, "update_check_failed", error: e.class.name, msg: e.message)
|
|
237
|
+
@document = STATE_FORMAT.read({}, collection: nil)
|
|
220
238
|
empty_state
|
|
221
239
|
end
|
|
222
240
|
|
|
@@ -226,7 +244,8 @@ module Samagotchi
|
|
|
226
244
|
|
|
227
245
|
def persist(state)
|
|
228
246
|
FileUtils.mkdir_p(File.dirname(@state_file))
|
|
229
|
-
|
|
247
|
+
stored = @document.with(attributes: state.merge(auto: state[:auto]&.to_store))
|
|
248
|
+
AtomicFile.write(@state_file, JSON.generate(STATE_FORMAT.write(stored, collection: nil, updated_at: nil)), perm: 0o600)
|
|
230
249
|
@state = state
|
|
231
250
|
end
|
|
232
251
|
|
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.166.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitry Dedov
|
|
@@ -668,6 +668,7 @@ files:
|
|
|
668
668
|
- lib/samagotchi/session_access/web_bridge_client.rb
|
|
669
669
|
- lib/samagotchi/session_archive_command.rb
|
|
670
670
|
- lib/samagotchi/session_chain.rb
|
|
671
|
+
- lib/samagotchi/session_chain/links.rb
|
|
671
672
|
- lib/samagotchi/session_commands.rb
|
|
672
673
|
- lib/samagotchi/session_config.rb
|
|
673
674
|
- lib/samagotchi/session_continue.rb
|
|
@@ -911,6 +912,7 @@ files:
|
|
|
911
912
|
- lib/samagotchi/web/public/app.js
|
|
912
913
|
- lib/samagotchi/web/public/apple-touch-icon.png
|
|
913
914
|
- lib/samagotchi/web/public/auth_lost.js
|
|
915
|
+
- lib/samagotchi/web/public/bar_fold.js
|
|
914
916
|
- lib/samagotchi/web/public/block_frame.js
|
|
915
917
|
- lib/samagotchi/web/public/block_host.js
|
|
916
918
|
- lib/samagotchi/web/public/block_open.js
|
|
@@ -1009,6 +1011,7 @@ files:
|
|
|
1009
1011
|
- lib/samagotchi/web/public/refs.js
|
|
1010
1012
|
- lib/samagotchi/web/public/reload_check.js
|
|
1011
1013
|
- lib/samagotchi/web/public/restore.js
|
|
1014
|
+
- lib/samagotchi/web/public/resync_reach.js
|
|
1012
1015
|
- lib/samagotchi/web/public/review_apply.js
|
|
1013
1016
|
- lib/samagotchi/web/public/review_history.js
|
|
1014
1017
|
- lib/samagotchi/web/public/review_start.js
|
|
@@ -1034,6 +1037,7 @@ files:
|
|
|
1034
1037
|
- lib/samagotchi/web/public/stage_frame.js
|
|
1035
1038
|
- lib/samagotchi/web/public/stage_model.js
|
|
1036
1039
|
- lib/samagotchi/web/public/stage_slots.js
|
|
1040
|
+
- lib/samagotchi/web/public/stage_stall.js
|
|
1037
1041
|
- lib/samagotchi/web/public/stage_view.js
|
|
1038
1042
|
- lib/samagotchi/web/public/stage_watch.js
|
|
1039
1043
|
- lib/samagotchi/web/public/stale_params.js
|