@tuttiai/cli 0.8.0 → 0.10.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.
package/README.md CHANGED
@@ -29,6 +29,8 @@ Load a score file and open an interactive REPL:
29
29
  ```bash
30
30
  tutti-ai run # defaults to ./tutti.score.ts
31
31
  tutti-ai run ./custom-score.ts # specify a score file
32
+ tutti-ai run --watch # hot-reload the score on file changes
33
+ tutti-ai run -w ./score.ts # short alias
32
34
  ```
33
35
 
34
36
  Features:
@@ -36,6 +38,104 @@ Features:
36
38
  - Colored tool execution trace
37
39
  - Session continuity across messages
38
40
  - Graceful Ctrl+C handling
41
+ - Hot reload with `--watch` / `-w` (see below)
42
+
43
+ #### Watch mode
44
+
45
+ `--watch` reloads the score (and any file in the score's directory tree,
46
+ excluding `node_modules`, `dist`, and dotfiles) whenever it changes on
47
+ disk. Changes are debounced 200ms so editor saves that touch the file
48
+ multiple times collapse into a single reload.
49
+
50
+ ```
51
+ > research quantum computing
52
+ [tutti] Score changed, reloading...
53
+ [tutti] Score reloaded. Changes applied.
54
+ > what did you learn last turn?
55
+ ```
56
+
57
+ Semantics:
58
+
59
+ - **Changes take effect at turn boundaries**, never mid-tool-call. The
60
+ current turn always completes with the config it started with; the
61
+ next turn reads the new config.
62
+ - **Session history is preserved** across reloads — the REPL's
63
+ `session_id` carries over, so the conversation continues.
64
+ - **Syntax errors are recovered** — if the reload fails to parse or
65
+ validate, the error is printed and the REPL keeps using the previous
66
+ config. Fix the file and save again.
67
+ - **Trade-off**: runtime internals (tool cache, semantic memory) reset
68
+ on reload. Conversation history survives because the REPL owns the
69
+ session store and reuses it across runtime swaps.
70
+
71
+ Deferred (known gaps):
72
+ - The watcher uses a directory-tree watch, not a resolved import graph —
73
+ unrelated file edits in the project tree will also trigger reloads.
74
+ A future revision may use `madge` or the TS compiler API for
75
+ precision.
76
+ - Voice-level partial reload isn't implemented; the whole runtime is
77
+ rebuilt on every change. Fast enough in practice (typically <50ms)
78
+ but means runtime-internal caches reset.
79
+
80
+ ### `tutti-ai resume <session-id>`
81
+
82
+ Resume a crashed or interrupted run from its last durable checkpoint.
83
+ Requires the agent to have been configured with `durable: true` on the
84
+ original run, and a Redis or Postgres backend reachable via the matching
85
+ env var.
86
+
87
+ ```bash
88
+ # Redis-backed checkpoint
89
+ export TUTTI_REDIS_URL=redis://127.0.0.1:6379/0
90
+ tutti-ai resume 811b3b38-9a1d-4b98-ab7d-57e4acaecdea --store redis
91
+
92
+ # Postgres-backed checkpoint
93
+ export TUTTI_PG_URL=postgres://localhost/tutti
94
+ tutti-ai resume 811b3b38-9a1d-4b98-ab7d-57e4acaecdea --store postgres
95
+ ```
96
+
97
+ Options:
98
+
99
+ | Flag | Default | What it does |
100
+ |---|---|---|
101
+ | `--store <backend>` | `redis` | Which durable store the checkpoint was written to (`redis` or `postgres`). |
102
+ | `-s, --score <path>` | `./tutti.score.ts` | Score file to load — must match the one the original run used. |
103
+ | `-a, --agent <name>` | `score.entry` or the first agent | Which agent to resume. |
104
+ | `-y, --yes` | false | Skip the confirmation prompt (useful for scripts). |
105
+
106
+ The command prints a summary (last completed turn, timestamp, first few
107
+ messages) and asks `Resume from turn N? (y/n)` before handing off. On
108
+ confirm it loads the score, reattaches the checkpoint store, seeds the
109
+ session, and calls the runtime — picking up exactly where the previous
110
+ run left off. Saying `n` exits without running anything.
111
+
112
+ Typical flow after a crash:
113
+
114
+ ```bash
115
+ $ tutti-ai run ./my-score.ts
116
+ > research recent AI papers
117
+ · Checkpoint saved at turn 1
118
+ · Checkpoint saved at turn 2
119
+ [process crashes / SIGKILL]
120
+
121
+ $ tutti-ai resume 811b3b38-9a1d-4b98-ab7d-57e4acaecdea --store redis
122
+
123
+ Checkpoint summary
124
+ Session ID: 811b3b38-9a1d-4b98-ab7d-57e4acaecdea
125
+ Last turn: 2
126
+ Saved at: 2026-04-13T15:47:12.031Z
127
+ Messages: 5 total
128
+
129
+ First messages
130
+ [user] research recent AI papers
131
+ [assistant] [tool_use search_web]
132
+ [user] [tool_result {"results":[…]}]
133
+
134
+ Resume from turn 2? (y/n) y
135
+ ↻ Restored from turn 2 (session 811b3b38…)
136
+ ✓ Resumed run complete.
137
+ Final turn: 3
138
+ ```
39
139
 
40
140
  ## Links
41
141