ftown 0.19.50 → 0.19.51

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.
@@ -2,8 +2,9 @@
2
2
  name: ftown
3
3
  description: >-
4
4
  Control ftown sessions: create/list/read/drive sibling sessions, send ftown
5
- mail, and coordinate worker agents. Use for ftown sessions, child/sibling
6
- agents, bridge mail/inbox, or explicitly requested orchestration.
5
+ mail, request human attention, link session PRs, and coordinate worker agents.
6
+ Use for ftown sessions, child/sibling agents, bridge mail/inbox, or explicitly
7
+ requested orchestration.
7
8
  ---
8
9
 
9
10
  # ftown
@@ -39,6 +40,9 @@ entrypoint with `--repair`.
39
40
  ftown sessions list
40
41
  ftown sessions create --prompt "Review the auth module" --workdir "$PWD" --parent
41
42
  ftown sessions screen <session-id> --limit 200
43
+ ftown sessions attention --message "Please review the migration plan" --title "Review requested"
44
+ ftown sessions pr https://github.com/owner/repo/pull/123
45
+ ftown sessions pr --clear
42
46
  ftown harness mail send <session-id> --type task "review the API client"
43
47
  ftown harness mail read
44
48
  ftown env --help
@@ -66,6 +70,40 @@ Prefer mail for agent communication; use terminal key injection only when the
66
70
  task needs it. Inspect peers with `ftown sessions list` and
67
71
  `ftown sessions screen <id> --limit 100`.
68
72
 
73
+ ## Human attention and pull requests
74
+
75
+ Use `ftown sessions attention --message "..."` when you need human input. It
76
+ creates a durable attention record and uses the dashboard's existing notice flow;
77
+ it does not answer a prompt or guarantee a push notification. Push remains opt-in
78
+ and requires a supported hosted session. Repeating an unresolved request updates
79
+ its occurrence count; after an uncertain result, inspect the existing request
80
+ before retrying.
81
+
82
+ Attach one GitHub pull request with `ftown sessions pr <URL>`; another URL
83
+ replaces it and `--clear` removes it. This records a link without fetching GitHub
84
+ or creating a PR. Both commands target trimmed `$FTOWN_SESSION_ID` unless you
85
+ supply `--session-id <id>`; they never guess identity from the working directory.
86
+ Older bridges report `bridge_upgrade_required` before mutation.
87
+
88
+ Remote MCP callers use `attention_request` with explicit `machine` and
89
+ `sessionId`, or `sessions_update` with `pullRequestUrl` (string to set, null to
90
+ clear). Mutation tools require control access; remote callers have no automatic
91
+ local self identity. Keep the returned attention event ID for existing inbox,
92
+ acknowledge and resolve operations, which do not answer the agent's question.
93
+
94
+ For tasks performed in an FTown session, associate the task's GitHub PR when
95
+ created or updated, before the completion notice: use `ftown sessions pr <URL>`
96
+ or MCP `sessions_update.pullRequestUrl`. Omit this step for tasks without a PR;
97
+ never invent a PR or guess a session identity.
98
+
99
+ Once the task is complete, request user attention **once per completed task**,
100
+ before the final handoff, using `ftown sessions attention --title 'Work complete'
101
+ --message "<truthful outcome, checks and PR summary>"` or MCP `attention_request`.
102
+ Do not send a completion notice every turn; retain the uncertain-result guidance
103
+ above. Children must still report their result to the parent as assigned; user
104
+ attention does not replace that reporting. See the completion example in
105
+ `references/sessions.md`.
106
+
69
107
  ## Cleanup
70
108
 
71
109
  Session cleanup is an explicit user or orchestrator action. Reporting a result
@@ -51,6 +51,51 @@ ftown sessions archive
51
51
  ftown sessions revive <session-id>
52
52
  ```
53
53
 
54
+ ## Ask the human or associate a pull request
55
+
56
+ ```bash
57
+ # Request human input for this session (JSON {event} by default)
58
+ ftown sessions attention --message "Please review the migration plan" --title "Review requested"
59
+
60
+ # Set or replace this session's single GitHub PR link (JSON {session})
61
+ ftown sessions pr https://github.com/owner/repo/pull/123
62
+
63
+ # Clear the association
64
+ ftown sessions pr --clear
65
+
66
+ # Explicit target overrides FTOWN_SESSION_ID for either command
67
+ ftown sessions attention --session-id <id> --message "Which approach should I take?"
68
+ ftown sessions pr --session-id <id> https://github.com/owner/repo/pull/123
69
+ ```
70
+
71
+ Both commands use trimmed `FTOWN_SESSION_ID` when `--session-id` is omitted;
72
+ missing/invalid identity, empty/oversized text, malformed URLs and contradictory
73
+ arguments fail before transport. There is no working-directory or latest-session
74
+ fallback. Title is optional (default `Session needs your input`, max 200 characters);
75
+ message is required (max 2000). Controls and common credentials are sanitized.
76
+ `--plain` prints a concise success summary. `--help` is read-only.
77
+
78
+ Attention persists an `agent_needs_input` event, returns its exact ID and updates
79
+ the existing dashboard attention flow. Logical duplicate unresolved requests
80
+ coalesce while recording occurrences; resolving it permits a new incident.
81
+ Only creation triggers notification, and hosted push remains opt-in with existing
82
+ session/harness eligibility. Do not automatically retry an uncertain mutation.
83
+ Acknowledging/resolving an event never answers or approves a CLI prompt.
84
+
85
+ PR links accept only HTTPS GitHub `/owner/repo/pull/<positive-number>` URLs.
86
+ Outer whitespace, query/fragment and a trailing slash are normalized; credentials,
87
+ nondefault ports and other paths/hosts are rejected. No GitHub request is made.
88
+ Attaching/replacing/clearing is metadata-only; omitting it on an update preserves
89
+ its value. New sessions/children do not implicitly inherit a parent's PR.
90
+
91
+ New commands probe the exact bridge capability before writing; update old bridges
92
+ with the exact version setup command in their readiness hint. For remote MCP,
93
+ `attention_request` requires explicit `{machine, sessionId, message, title?}` and
94
+ returns `{machine, sessionId, event}`. `sessions_update` accepts `pullRequestUrl`
95
+ (string or null), alongside existing name/parent fields. A mixed PR+name update
96
+ rejects an old bridge before changing either field. Read-only MCP clients cannot
97
+ see these mutation tools; control authorization and machine ownership still apply.
98
+
54
99
  ## Messaging (mail)
55
100
 
56
101
  `tell` posts to the target session's **inbox**. Mail is delivered into the
@@ -117,6 +162,30 @@ ftown sessions screen <child-id> --limit 100
117
162
  ftown sessions grep <child-id> --pattern 'FAIL|Error'
118
163
  ```
119
164
 
165
+ ### Completion handoff
166
+
167
+ When the task creates or updates a GitHub PR, associate its actual URL with the
168
+ FTown session before the completion notice. Then request user attention once the
169
+ task is complete, before the final handoff. Replace the sample URL and summary
170
+ below with truthful outcomes and checks (including checks not run):
171
+
172
+ ```bash
173
+ ftown sessions pr https://github.com/owner/repo/pull/123
174
+ ftown sessions attention --title 'Work complete' \
175
+ --message 'Outcome: <actual result>. Checks: <actual results or not run>. PR: https://github.com/owner/repo/pull/123'
176
+ ```
177
+
178
+ For tasks without a PR, omit the PR command and PR summary. Use the verified
179
+ `FTOWN_SESSION_ID` or explicit `--session-id`; never guess a target. MCP callers
180
+ instead use `sessions_update` with `pullRequestUrl` when applicable, then
181
+ `attention_request` with title `Work complete` and the same truthful summary,
182
+ always supplying explicit `machine` and `sessionId`.
183
+
184
+ Send one completion request per completed task, not repeated per-turn notices.
185
+ Logical duplicate coalescing does not justify retries after an uncertain outcome;
186
+ inspect the existing request first, as described above. Child agents still send
187
+ their assigned result to the parent; the user attention request is additional.
188
+
120
189
  ## Environment
121
190
 
122
191
  Spawned ftown sessions receive:
@@ -145,7 +214,8 @@ The CLI wraps the loopback API. Raw access if needed:
145
214
  |--------|------|---------|
146
215
  | GET | `/api/sessions` | List |
147
216
  | POST | `/api/sessions` | Create |
148
- | PATCH | `/api/sessions/:id` | Rename and/or move (`{ name?, parentSessionId? }`; `null` moves to the root) |
217
+ | PATCH | `/api/sessions/:id` | Rename, move or associate a PR (`{ name?, parentSessionId?, pullRequestUrl? }`; `null` detaches/clears) |
218
+ | POST | `/api/sessions/:id/attention` | Request human input (`{ message, title? }`) → `{ event }` |
149
219
  | GET | `/api/sessions/:id/screen` | Terminal lines |
150
220
  | POST | `/api/sessions/:id/grep` | Search |
151
221
  | POST | `/api/sessions/:id/keys` | Send keys |