@kingcrab/pi-imessage 1.1.0 → 1.2.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 (80) hide show
  1. package/README.md +4 -6
  2. package/dist/agent/behavior.js +7 -13
  3. package/dist/agent/chats.js +7 -8
  4. package/dist/agent/commands.js +16 -11
  5. package/dist/agent/harness.js +6 -0
  6. package/dist/agent/progress.js +30 -4
  7. package/dist/agent/prompt.js +41 -24
  8. package/dist/agent/run.js +5 -4
  9. package/dist/agent/scheduling.js +11 -34
  10. package/dist/cli.js +42 -5
  11. package/dist/config/settings.js +4 -0
  12. package/dist/extensions/browser.js +7 -3
  13. package/dist/extensions/codemode.js +16 -0
  14. package/dist/extensions/final-text.js +12 -0
  15. package/dist/extensions/schedules.js +1 -1
  16. package/dist/extensions/subagent.js +3 -12
  17. package/dist/extensions/workspace.js +6 -2
  18. package/dist/main.js +38 -34
  19. package/dist/transport/watch.js +7 -1
  20. package/dist/web/app.js +10 -3
  21. package/dist/web/server.js +7 -3
  22. package/docs/adr/{0004-native-extensions.md → 0003-native-extensions.md} +1 -1
  23. package/docs/adr/{0006-jsonl-storage.md → 0004-jsonl-storage.md} +1 -1
  24. package/docs/adr/{0007-images-by-path.md → 0005-images-by-path.md} +1 -1
  25. package/docs/adr/{0010-test-budget.md → 0006-test-budget.md} +1 -1
  26. package/docs/adr/{0011-reconcile-unsent-answers.md → 0007-reconcile-unsent-answers.md} +2 -2
  27. package/docs/adr/{0012-run-in-owned-conversation.md → 0008-run-in-owned-conversation.md} +5 -5
  28. package/docs/adr/{0032-native-background-schedules.md → 0009-native-background-schedules.md} +1 -1
  29. package/docs/adr/0010-framework-and-workspace.md +27 -0
  30. package/docs/adr/README.md +24 -47
  31. package/docs/api.md +16 -8
  32. package/docs/architecture.md +19 -8
  33. package/docs/browser.md +7 -7
  34. package/docs/install.md +109 -0
  35. package/docs/workspace-extensions.md +8 -4
  36. package/package.json +4 -5
  37. package/dist/agent/compaction.js +0 -51
  38. package/dist/extensions/restart.js +0 -100
  39. package/docs/adr/0003-replies-at-most-once.md +0 -11
  40. package/docs/adr/0005-history-migration.md +0 -11
  41. package/docs/adr/0008-compaction-and-run.md +0 -11
  42. package/docs/adr/0009-one-shot-cutover.md +0 -11
  43. package/docs/adr/0013-thin-adapters-around-durable.md +0 -18
  44. package/docs/adr/0014-ephemeral-private-storage.md +0 -13
  45. package/docs/adr/0015-ordinary-stop-keeps-native-inbox.md +0 -21
  46. package/docs/adr/0016-process-http-transport.md +0 -21
  47. package/docs/adr/0017-browser-cli-owned-scope.md +0 -22
  48. package/docs/adr/0018-tasks-without-prompt-api.md +0 -19
  49. package/docs/adr/0019-remove-scheduled-services.md +0 -41
  50. package/docs/adr/0020-chat-task-progress.md +0 -41
  51. package/docs/adr/0021-readable-progress-without-link-previews.md +0 -33
  52. package/docs/adr/0022-progress-admission-and-settlement.md +0 -35
  53. package/docs/adr/0023-retain-progress-type-prefixes.md +0 -18
  54. package/docs/adr/0024-status-marker-before-type-prefix.md +0 -13
  55. package/docs/adr/0025-reusable-progress-and-command-preview.md +0 -49
  56. package/docs/adr/0026-inline-command-only-requests.md +0 -16
  57. package/docs/adr/0027-command-preview-width.md +0 -10
  58. package/docs/adr/0028-command-preview-120.md +0 -8
  59. package/docs/adr/0030-shared-web-read-cache.md +0 -33
  60. package/docs/adr/0031-quiet-compaction-progress.md +0 -32
  61. package/docs/adr/0033-operator-scheduled-run.md +0 -23
  62. package/docs/adr/0034-machine-local-schedule-time.md +0 -36
  63. package/docs/adr/0035-external-business-task-extensions.md +0 -56
  64. package/docs/adr/0036-workspace-policy-and-neutral-service-id.md +0 -37
  65. package/docs/adr/0037-restart-during-in-flight-work.md +0 -30
  66. package/docs/adr/0038-restart-any-time.md +0 -25
  67. package/docs/adr/0039-rerun-interrupted-tools.md +0 -24
  68. package/docs/adr/0040-chat-progress-notices.md +0 -44
  69. package/docs/adr/0041-restart-and-recovery.md +0 -28
  70. package/docs/adr/0042-background-schedules-and-workspace-extensions.md +0 -44
  71. package/docs/adr/0043-remove-legacy-migration.md +0 -23
  72. package/docs/adr/0044-message-channels.md +0 -32
  73. package/docs/adr/0045-chat-scheduling-tools.md +0 -51
  74. package/docs/adr/0046-selective-command-redaction.md +0 -31
  75. package/docs/adr/0047-one-scheduling-path.md +0 -158
  76. package/docs/adr/0048-quiet-attachment-reads.md +0 -11
  77. package/docs/adr/0049-per-chat-progress-notices.md +0 -21
  78. package/docs/adr/0052-host-owned-self-restart.md +0 -53
  79. package/ops/README.md +0 -250
  80. package/ops/preflight.mjs +0 -28
@@ -1,44 +0,0 @@
1
- # 0042. Background schedules and workspace extensions
2
-
3
- Status: accepted (owner accepted on 2026-10-06; consolidates ADRs 0019 and 0032–0035 without changing behavior)
4
-
5
- **Problem.** Scheduling was removed (0019), rebuilt natively (0032–0034) and
6
- then separated from personal business code (0035). The current rules are
7
- spread over five ADRs that partly contradict each other.
8
-
9
- **Example.** A daily 07:45 workspace task and six-hour compaction both keep
10
- their deadlines across a restart. Changing the task's code changes only
11
- `WORKING_DIR/extensions/<name>/`, not the framework.
12
-
13
- **Decision.**
14
-
15
- - **Retired services stay removed:** cron, reminders, delayed prompts,
16
- completion watchers, PT Automation and HTTP `/prompt` / `/send`. Their
17
- endpoints return 404; stored old data is kept but unused.
18
- - **Workspace extensions** hold personal code: `WORKING_DIR/extensions/<name>/`
19
- with `index.ts` and `config.json`. Each is a trusted native Durable extension
20
- with tools, tasks and optional schedules. The owner and the chat assistant
21
- may both create them. Startup, `/reload` and `reload_extensions` scan direct
22
- child directories. Duplicate names are rejected; a failed reload keeps the
23
- old definitions; running calls keep their code.
24
- - **Framework scheduling** gives each schedule a dedicated conversation with a
25
- background task whose checkpoint saves the absolute next deadline. Each
26
- occurrence is a child task; occurrences never overlap. Daily slots run only
27
- today's slot, without backfill; interval slots skip missed ticks. Six-hour
28
- compaction uses the same mechanism and stays built in.
29
- - **Time** is the service machine's local timezone (or `TZ`). Daily slots are
30
- computed by calendar date, so daylight-saving changes keep the wall-clock
31
- time. Saved deadlines are never reset by reload, restart or timezone change.
32
- - **Delivery** commits business state and the outgoing item together. The host
33
- sends through existing receipts at most once; `unknown` is never resent.
34
- - **Operator run:** `serve --run-scheduled JOB --request-id ID` admits one
35
- occurrence at startup; repeating the same request ID returns the same task.
36
- - **History:** `/scheduled` shows each schedule, its deadline and the latest
37
- ten occurrences from native task records. Viewing never starts work.
38
- - **Removal:** removing an extension stops future scheduling only. Unfinished
39
- work keeps its code in memory; restart fails explicitly if required code is
40
- missing.
41
-
42
- **Consequences.** The service must be running to act at a deadline. Workspace
43
- extensions are trusted code and need backup. This supersedes ADRs 0019 and
44
- 0032–0035, and the scheduler clause of ADR 0013.
@@ -1,23 +0,0 @@
1
- # 0043. Remove the legacy migration code
2
-
3
- Status: accepted (owner decided on 2026-10-06)
4
-
5
- **Problem.** The one-time cutover from the legacy service is done, but its code
6
- and runbook remain: `src/migrate/`, the `pi-imessage import` command, a test and
7
- `ops/CUTOVER.md`. Readers must learn a whole layer that will never run again.
8
-
9
- **Example.** A new contributor reads the package table, finds `migrate/` next to
10
- `main.ts`, and spends time on history import rules unrelated to any change.
11
-
12
- **Decision.**
13
-
14
- - Delete `src/migrate/`, the `import` CLI command, `test/migrate.test.ts` and
15
- `ops/CUTOVER.md`.
16
- - Keep them reachable at the annotated tag `archive/legacy-migration`, the last
17
- revision that contains them. A tag is fixed and runnable; a wiki copy is not.
18
- - The rule "never run old and new message pipelines concurrently" stays in
19
- `AGENTS.md` and `ops/README.md`.
20
-
21
- **Consequences.** Imported history already lives in Durable storage and is
22
- unaffected. Rerunning a migration means checking out the tag in a separate
23
- worktree. This replaces ADRs 0005 and 0009, whose work is complete.
@@ -1,32 +0,0 @@
1
- # 0044. Organize message sources as channels
2
-
3
- Status: proposed
4
-
5
- **Problem.** `transport/` is iMessage-only: it polls `chat.db` and sends through
6
- Messages.app. A second message source, such as Telegram, has no place to go, and
7
- the name "transport" suggests a network layer. `transport/http.ts` is the shared
8
- outgoing HTTP client, not a message source.
9
-
10
- **Example.** Adding Telegram today would mean putting `telegram-watch.ts` beside
11
- `watch.ts`, while `agent/` imports `MessageSender` from the iMessage `send.ts`.
12
-
13
- **Decision.** Apply this when the second channel is implemented, not before
14
- (no abstraction until needed):
15
-
16
- - Rename `transport/` to `channels/`, with one directory per channel:
17
- `channels/imessage/` (`watch.ts`, `send.ts`, `rich-text.ts`,
18
- `attachments.ts`), `channels/telegram/`, and so on.
19
- - Put the shared contract in `channels/types.ts`: the incoming message shape and
20
- `MessageSender`. `agent/` depends on this contract, never on one channel.
21
- - Move the process HTTP client (ADR 0016) out of the channel package, for example
22
- to `config/` or a small `net/` package at the bottom layer.
23
- - Identify chats as `<channel>:<id>` for new channels. Existing iMessage chat
24
- GUIDs stay unchanged, so `settings.json` allowlists and Durable `Chats`
25
- records remain valid.
26
-
27
- **Consequences.** One rename and an import update when the second channel
28
- arrives; until then the code stays as it is. The layer rule (ADR 0002) is
29
- unchanged: channels stay below `agent/` and contain no agent logic.
30
-
31
- **Rejected.** A generic plugin loader for channels: there is one real channel
32
- today, and workspace extensions (ADR 0042) already cover tool plugins.
@@ -1,51 +0,0 @@
1
- # 0045. Native chat scheduling tools
2
-
3
- Status: proposed
4
-
5
- **Problem.** A simple deferred chat request currently requires the assistant to
6
- write a trusted workspace extension and reload it. That is useful for reusable
7
- business code, but unnecessarily complex for an ordinary reminder or agent task.
8
-
9
- **Example.** In iMessage, "remind me in ten minutes" should create a task through
10
- `schedule_task`, just as it does in the coding agent. "Every day at 09:00,
11
- summarize new items" should not require generated TypeScript either.
12
-
13
- **Decision.**
14
-
15
- - Add built-in `schedule_task`, `list_scheduled_tasks` and
16
- `cancel_scheduled_task` tools for chat conversations. The scheduling tool takes
17
- a time and a prompt, with optional explicit daily or interval repetition.
18
- Support durations, clock times and absolute datetimes; do not add a cron parser.
19
- - Bind each task to its originating chat in host code. List and cancellation
20
- operate only on that chat's interactive schedules, never framework maintenance
21
- or workspace extension schedules. Return a stable ID and the actual deadline.
22
- - Use native Durable background tasks and documents in the existing owning
23
- service. Creation must be atomic and deduplicated by the scheduling tool call;
24
- interruption must not create a second schedule. Persist absolute deadlines,
25
- configuration and cancellation. No detached timer, operating-system scheduler,
26
- legacy job files, HTTP prompt/send endpoint or second pipeline.
27
- - Execute each occurrence in a fresh isolated agent conversation with the
28
- normal authorized tools. Send its final result back to the originating chat
29
- through the existing at-most-once receipts and passive chat records, without
30
- steering an unrelated active chat turn. A scheduled prompt is a saved user
31
- request, not a system instruction.
32
- - Recurring occurrences never overlap and skip missed slots. One-shot tasks
33
- execute once when overdue, including after restart. Cancellation prevents
34
- future admission; it does not undo an already admitted occurrence or resend
35
- uncertain effects. Keep existing restart recovery and unknown-send safeguards.
36
- - Use the service machine's timezone, including explicit `TZ`, and expose native
37
- deadlines and occurrence records on the existing read-only Scheduled page.
38
- The service must be running to execute work; persistence does not wake a
39
- stopped service or machine.
40
- - Keep workspace extensions for reusable business tools and tasks. Existing
41
- extension schedules and six-hour compaction retain their IDs, deadlines and
42
- behavior. Reload must not disable or reset interactive schedules.
43
- - Replace the chat prompt's extension-writing requirement for ordinary scheduled
44
- work with brief instructions to use these tools. Do not remove unrelated chat
45
- steering or delivery safeguards.
46
-
47
- **Consequences.** This deliberately replaces ADR 0042's retirement of ordinary
48
- reminders and delayed agent prompts, but not its retired external services or
49
- workspace extension contract. It also replaces that clause of ADR 0018. It is a
50
- small native management interface over Durable, not a return to the old cron
51
- service. Implementation follows owner acceptance; accepted ADRs stay unchanged.
@@ -1,31 +0,0 @@
1
- # 0046. Selective command-preview redaction
2
-
3
- Status: proposed (owner requested `***` value masking on 2026-10-06; implementation tracked in #36)
4
-
5
- Supersedes only ADR 0040's whole-command credential suppression rule.
6
-
7
- **Problem.** A mention of `token`, `password`, `.env` or `auth.json` hides the
8
- entire command, even when it is just a source search or filename.
9
-
10
- **Example.** `TOKEN=demo123 curl --retry 3` becomes
11
- `→ [tool] bash: TOKEN=*** curl --retry 3`. `rg 'token' src` remains readable.
12
-
13
- **Decision.** Replace recognized credential values with `***`, retaining the
14
- surrounding command instead of a hidden-command placeholder. Cover sensitive
15
- assignments, options, authorization headers, URL userinfo, structured values,
16
- known credential prefixes and PEM private-key blocks. Read complete shell words,
17
- including quoted fragments, escaped spaces and command substitutions. Opaque
18
- escaped JSON and ambiguous substitutions may lose additional argument text to
19
- avoid showing a partial credential. Filenames and keyword mentions alone do not
20
- trigger hiding. Screening remains best effort, not an arbitrary-secret guarantee.
21
-
22
- Apply masking to the full command before whitespace normalization, URL/domain
23
- defanging and the existing 120-Unicode-code-point bound. Native execution,
24
- non-bash summaries, progress ownership, settlement and durable receipts remain
25
- unchanged. No new scheduler, pipeline, tool execution or delivery replay.
26
-
27
- **Verification.** Extend the existing isolated messaging regression with exact
28
- preview examples, quote/escape cases, structured credentials, line continuations,
29
- substitutions, known prefixes, private keys, keyword-only searches and masking
30
- before truncation. Existing native execution, ownership and uncertain-send
31
- regressions remain in force.
@@ -1,158 +0,0 @@
1
- # 0047. One scheduling path for recurring and one-off work
2
-
3
- Status: accepted (owner requested the minimal implementation on 2026-10-06)
4
-
5
- ## Problem
6
-
7
- Recurring workspace jobs currently enter through a native scheduler task, while
8
- `serve --run-scheduled JOB --request-id ID` calls `runOnce()` and creates an
9
- occurrence directly. Both use Durable, but admission follows two paths, and a
10
- manual trial requires a service restart.
11
-
12
- Calling all work "scheduled" is not sufficient. The common path must own deadline
13
- persistence, deduplication and non-overlap. A trial must also retain the original
14
- job's business state, rather than create an empty English learning history or
15
- bypass the monthly quota.
16
-
17
- ## Example
18
-
19
- Workplace English has a daily 07:45 trigger. An operator requests one trial now.
20
- The trial receives its own stable trigger ID, but targets the existing English
21
- job and business conversation. Reloading twice does not run it twice, and the
22
- regular 07:45 deadline does not move. Existing per-date card deduplication still
23
- applies: a trial is not permission to resend today's card.
24
-
25
- ## Evaluation
26
-
27
- - **One common scheduling path:** recommended. Recurrence and an immediate trial
28
- differ in their deadlines and repetition, not their executor or delivery path.
29
- - **One physical configuration file:** unnecessary. Keep trusted business code
30
- and configuration in the workspace extensions required by ADR 0042. Their
31
- declarations pass through one framework admission function.
32
- - **Automatic configuration polling:** unnecessary for the first version. The
33
- existing `reload_extensions` tool and `/reload` already apply configuration
34
- through the owning service without restart. Polling would add partial-write,
35
- repeated-load and failure-handling concerns without helping deadline execution.
36
- - **A local CLI/socket or HTTP run API:** unnecessary here. A trial can be a
37
- one-off declaration followed by the existing reload. This trades one explicit
38
- reload operation for avoiding another control protocol.
39
- - **A separate business executor for every cadence:** rejected. Reminder,
40
- script and model workflows remain native business tasks; they do not become
41
- separate schedulers.
42
-
43
- ## Decision
44
-
45
- ### One admission and execution path
46
-
47
- ```text
48
- Workspace extension configuration
49
- |
50
- startup / reload_extensions / /reload
51
- |
52
- validate and register triggers
53
- |
54
- native background Scheduler task
55
- |
56
- sleep(persisted absolute deadline)
57
- |
58
- native occurrence wrapper
59
- |
60
- registered native business task
61
- |
62
- native receipts -> read-only Scheduled Web
63
- |
64
- optional outbox -> existing send receipts
65
- ```
66
-
67
- The reload commands are configuration-loading entry points, not direct execution
68
- paths. No file edit alone invokes business work. An immediate trial becomes due
69
- once its declaration has been accepted; it is not a promise of zero latency.
70
- The service must be running, and publication of validated code/configuration must
71
- complete before newly due work can execute under that definition.
72
-
73
- The framework retains one owning Harness. Do not introduce another daemon,
74
- operating-system timer, SDK scheduler bridge, database, or polling watcher.
75
-
76
- ### Job identity and trigger identity
77
-
78
- - A **job** names registered business code, input, destination and its existing
79
- business conversation/state. It is not an arbitrary command or prompt supplied
80
- by a new public execution API.
81
- - A **trigger** names when that job is eligible to run. Recurring triggers and
82
- one-off triggers use the same registration function and scheduler definition.
83
- - The minimal version preserves elapsed-time intervals and one local daily slot,
84
- and adds a one-off absolute deadline or `now`. Multiple daily slots and monthly
85
- calendars are deferred, not part of this first change. Do not add a cron parser.
86
- - Resolve `now` to an absolute timestamp once, in the admission transaction.
87
- Persist the stable trigger ID, target job and deadline together. Subsequent
88
- reloads/restarts recover that trigger, including a terminal one; they never
89
- reevaluate `now`. A new intended trial needs a new trigger ID. Conflicting reuse
90
- of a one-off ID fails explicitly.
91
- - A one-off declaration targets an existing registered job. Do not give it a
92
- fresh business conversation, reset learning/checkpoints, or change the regular
93
- trigger's deadline. A workspace extension must provide this declarative trial
94
- binding; trial requests do not require generating a new extension per run.
95
- - Enforce non-overlap by target job, not merely by trigger. A due one-off can wait
96
- for that job's active occurrence, then admit its own occurrence. Do not report
97
- another trigger's work as completion of the new request.
98
- - Commit occurrence admission and the scheduler checkpoint together. A one-off
99
- scheduler becomes terminal after its occurrence; a recurring scheduler saves
100
- the next deadline. Failures remain visible in native occurrence records.
101
-
102
- ### Recovery, reload and delivery
103
-
104
- - Preserve ADR 0042's machine-local calendar/DST rules, saved absolute deadlines,
105
- daily/interval overdue behavior and lack of historical backfill. A one-off
106
- admitted before shutdown runs once when overdue after restart.
107
- - Load and validate a complete candidate before accepting declarations. A failed
108
- reload leaves old definitions and schedules active and must not start a trial.
109
- Reload does not interrupt existing business calls. Pausing/removing a declaration
110
- prevents future admission, not undoing already admitted effects.
111
- - Use native task versions/migrations where persisted structures change. Preserve
112
- existing job/conversation/task IDs, learning state, checkpoints, execution
113
- history and delivery receipts. Do not recreate terminal trials on startup.
114
- - Business tasks keep their own replay and success policy under ADR 0041. A shared
115
- clock does not make a script's external effects transactional or replay-safe.
116
- Reflection advances its checkpoint and starts backup only after verified success.
117
- - Keep the existing outgoing queue and at-most-once transport receipts. An
118
- interrupted send becomes `unknown` and is not automatically resent. One-off
119
- execution does not override a business quota, per-date dedupe or a send receipt.
120
- - Reuse the compact Scheduled page and native occurrence history. Show one-off
121
- executions under their target job, with links to their Task tree. Viewing the
122
- page starts no work; add no execution buttons.
123
-
124
- ### Entry points removed or deferred
125
-
126
- After the unified one-off path is available, remove the operator startup-run
127
- flags and the direct-occurrence `runOnce()` bypass. Keep their historical request
128
- and execution records; do not replay them during migration. Do not add a CLI or
129
- Unix socket replacement.
130
-
131
- ADR 0045 remains a separate proposal about chat scheduling tools. This ADR does
132
- not enable or reject those tools. If accepted, their declarations must use this
133
- same admission/clock/occurrence path, preserve chat ownership boundaries, and
134
- must not introduce another scheduler or call a business executor directly.
135
-
136
- ## Scope and consequences
137
-
138
- Framework changes concern the schedule declaration contract, common admission,
139
- calendar calculation, scheduler lifecycle and removal of the operator bypass.
140
- Personal messages, weather/news logic, memory updates, photo-date checks and
141
- Reflection remain workspace extensions, not framework-specific branches.
142
-
143
- Restoring the selected legacy jobs uses this path. Stop only their competing old
144
- cron producers during the authorized cutover; do not disable unrelated system
145
- jobs. Fixed-message business tasks do not restore the retired reminder service,
146
- PT workers or HTTP `/prompt` / `/send`. No restoration or migration is performed
147
- by accepting a file reload alone
148
- unless those jobs are explicitly declared.
149
-
150
- The first version requires an explicit reload after editing configuration. This
151
- is intentional: it avoids a new watcher and a new management service. Persistence
152
- cannot wake a stopped process or machine. Exactly-once external delivery is not
153
- claimed.
154
-
155
- This supersedes only ADR 0042's operator-run clause (which
156
- consolidated ADR 0033), and extends its cadence/declaration contract. Its workspace
157
- ownership, recovery and delivery rules remain in force. Accepted ADRs stay
158
- unchanged.
@@ -1,11 +0,0 @@
1
- # 0048. Quiet attachment reads
2
-
3
- Status: proposed (owner-requested behavior in #38, 2026-10-07)
4
-
5
- **Problem.** Reading an archived attachment adds noisy tool notices containing long private archive paths.
6
-
7
- **Example.** A native `read` of `WORKING_DIR/attachments/<chat>/<file>` produces no request or completion notice. An ordinary file read still shows the existing progress pair.
8
-
9
- **Decision.** Add a narrow exception to ADR 0040's all-tool progress rule: suppress both admission and settlement notices for native `read` calls under the active workspace attachment root, including owned child calls and failed reads. Normalize relative, home, @ and file-URL paths and resolve filesystem aliases using metadata only. Match directory boundaries, not a generic attachment substring. Other reads, tools, task progress, manual compaction and final replies remain unchanged.
10
-
11
- The existing native observer filters before assigning notice routing or making direct-send receipts. Execution, result/error history, receipt/no-replay rules and the single pipeline are unchanged. No new poller, sender, permission boundary, data removal or credential policy is introduced.
@@ -1,21 +0,0 @@
1
- # 0049. Per-chat progress notices
2
-
3
- Status: proposed (owner-requested implementation, 2026-10-24)
4
-
5
- **Problem.** `progressMessages` in `settings.json` turns tool progress notices on or off for every chat at once. A busy group wants only the final messages while an admin chat wants to watch the tools.
6
-
7
- **Example.**
8
-
9
- ```text
10
- /verbose -> Verbose: on (default)
11
- /verbose off -> Verbose: off (this chat only)
12
- /verbose default -> Verbose: on (default)
13
- ```
14
-
15
- **Decision.**
16
-
17
- - Each chat record in the native `imessage.chats` document gets an optional `progress` boolean. `/verbose on|off` sets it and `/verbose default` removes it; `/verbose` alone reports the effective state. The record version is unchanged; old records have no field.
18
- - The progress observer (ADR 0040) resolves the owning chat first and then gates both the admission and the settlement notice by `chat.progress ?? settings.progressMessages`. Reply-enabled allowlisting, formatting, screening, receipts and no-replay rules are unchanged.
19
- - `settings.json` stays the default and is never rewritten by a command; the per-chat choice lives only in Durable.
20
-
21
- **Consequences.** A `/verbose off` chat still runs tools and records their results; it only stops seeing the two notice lines. Child notices follow the owning chat's choice. Changing the global default does not touch chats with an explicit choice.
@@ -1,53 +0,0 @@
1
- # 0052. The host owns its own restart
2
-
3
- Status: accepted (owner accepted on 2026-10-24)
4
-
5
- **Problem.** A chat assistant restarts the service by writing a controller
6
- script and running it from a `bash` tool call. The host cannot tell that this
7
- call is about to stop it. When the call is still running at the stop, ADR 0041
8
- reruns it on the next start, which launches another controller and stops the
9
- service again (#39: about 70 restarts in eleven minutes). A host-side stop
10
- heuristic that aborts a tool interrupted twice in a row was tried the same
11
- day; it limits the damage after the fact, does not remove the cause, and
12
- aborts any long tool that two deployments happen to interrupt in a row.
13
-
14
- **Example.**
15
-
16
- ```text
17
- restart_service({ release: "d627232…" })
18
- -> Restart into /Users/clawbot/pi-imessage-releases/d627232… is scheduled;
19
- the service stops after this call settles. Controller directory:
20
- /tmp/pi-imessage-restart.Xy12ab. Verify in a later call.
21
- ```
22
-
23
- The call settles, the host opens the controller in Terminal, the controller
24
- stops the old process and becomes the new one. The next turn verifies the
25
- listener, the log and the running release directory.
26
-
27
- **Decision.**
28
-
29
- - A built-in `restart_service` tool takes the full commit hash of a prepared
30
- release directory, a sibling of the running one. It refuses a hash that is not
31
- a directory with `src/cli.ts`, `node_modules` and `ops/restart.command`, and
32
- a second request while one is scheduled.
33
- - The tool writes the private controller directory of ops/README.md step 3
34
- itself: `environment.sh` from the process environment, `control.sh` from the
35
- process's own PID, start time and command line, and a copy of
36
- `ops/restart.command` from the target release. The controller deletes
37
- `environment.sh` after sourcing it.
38
- - The tool returns at once. The host launches the controller only after the
39
- tool task has settled, so the stop can never interrupt the call that asked
40
- for it.
41
- - The tool is `replay: "unsafe"`. If it is interrupted anyway, the model gets
42
- an interrupted result and checks what is running instead of a rerun
43
- launching a second controller.
44
- - Ordinary tools keep the rerun default of ADR 0041. Operators keep the manual
45
- procedure for a cold start when no service is running.
46
-
47
- **Consequences.** A self-restart costs one restart and no extra model turn.
48
- The stop still happens at a tool boundary of the requesting chat, so that chat's
49
- next model request is repeated after the restart, as ADR 0041 accepts. The
50
- restart loop of #39 cannot recur through this tool, so the stop heuristic is
51
- removed and ADR 0041 applies unchanged to every other tool. A chat that writes
52
- its own controller through `bash` is still subject to the ops rule of ending
53
- the call right after `open`.