@zetaloop/chappie 0.4.1 → 0.5.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,9 +29,9 @@ Call `init` from ChatGPT to connect the conversation to Pi. A conversation can r
29
29
 
30
30
  ## Usage
31
31
 
32
- Chappie exposes common coding tools directly and every active Pi tool through `tools` and `call`. `chat` sends an assistant message to Pi, Pi input accompanies later tool results, and `transfer` moves files in either direction. `history` reads recent Pi messages and activity with timestamps. `ask` can present a persistent question in ChatGPT when webpage questions are enabled.
32
+ Chappie exposes common coding tools directly and every active Pi tool through `tools` and `call`. `chat` sends an assistant message to Pi, Pi input accompanies later tool results, and `transfer` moves files between ChatGPT and Pi or between connected devices. `history` reads recent Pi messages and activity with timestamps. `ask` can present a persistent question in ChatGPT when webpage questions are enabled.
33
33
 
34
- See the [tool guide](docs/tools.md) for session selection, history, synchronization, Pi tools, webpage questions, and file transfer.
34
+ See the [tool guide](docs/tools.md) for session selection, history, Pi tools, webpage questions, and file transfer.
35
35
 
36
36
  ## Configuration
37
37
 
@@ -53,10 +53,4 @@ The default port is `24274`. Set `listen` to a port number or append `:port` to
53
53
 
54
54
  Set `ask` to `false` to disable webpage questions.
55
55
 
56
- Enable synchronization to resolve conflicting activity:
57
-
58
- ```json
59
- { "sync": true }
60
- ```
61
-
62
- Initialization returns a short name and a private code. `sync` pauses conflicting work for discussion through `chat` and `history`. The verified coordinator decides who continues, their tasks, and who exits, including retaining only one execution. See [synchronization](docs/tools.md#synchronization).
56
+ Closely spaced initializations from the same ChatGPT conversation receive guidance to observe the ongoing work through `history` and explain its results. See [participation](docs/tools.md#participation).
package/docs/tools.md CHANGED
@@ -4,7 +4,6 @@
4
4
  |---|---|
5
5
  | `init` | Select this ChatGPT conversation's default Pi session and read its environment. |
6
6
  | `history` | Read the current Pi branch with timestamps and entry IDs. |
7
- | `sync` | Resolve conflicting activity under one coordinator. |
8
7
  | `sessions` | List connected Pi sessions and the current default. |
9
8
  | `tools` | Read full definitions of active Pi tools for `call`. |
10
9
  | `chat` | Send an assistant message to Pi. |
@@ -15,17 +14,17 @@
15
14
  | `bash` | Run a shell command. |
16
15
  | `edit` | Apply text replacements. |
17
16
  | `write` | Write text to a file. |
18
- | `transfer` | Move files between ChatGPT and Pi or export a Pi image. |
17
+ | `transfer` | Move files between ChatGPT and Pi, copy between Pi sessions, or export a Pi image. |
19
18
 
20
19
  ## Sessions
21
20
 
22
21
  Call `init` at the start of local work. Without `sessionId`, it reuses the conversation's saved default or selects an online Pi session with no saved ChatGPT binding. Pass a Pi session ID to resume a specific task, including from another ChatGPT conversation or branch. Read recent `history` to recover progress before continuing the current task.
23
22
 
24
- Initialization returns the request suffix as `initialization.name` when available. Each execution retains its own name for coordination through `chat`.
23
+ When `globalAgents` is present, read and follow the instructions at `globalAgents.path` on the selected Pi session. Follow the participation guidance in `initialization.instructions`.
25
24
 
26
- `sessions` lists connected sessions with their ID, device, working directory, name, execution status, and binding count. The first execution tool call establishes the default using its `sessionId` or an online session with no saved bindings. During synchronization, `chat` and `history` use the requested session solely for communication. Once a default exists, another tool's `sessionId` selects only that operation's target; `init({ sessionId })` changes the default.
25
+ `sessions` lists connected sessions with their ID, device, working directory, name, execution status, and binding count. The first execution tool call establishes the default using its `sessionId` or an online session with no saved bindings. Once a default exists, another tool's `sessionId` selects only that operation's target; `init({ sessionId })` changes the default.
27
26
 
28
- Several ChatGPT conversations can use the same Pi session. One conversation can also operate on several Pi sessions explicitly. Requests already assigned to a session continue there even if the conversation later changes its default. Synchronization can cancel ordinary requests for the locked session or its bound conversations.
27
+ Several ChatGPT conversations can use the same Pi session. One conversation can also operate on several Pi sessions explicitly. Requests already assigned to a session continue there even if the conversation later changes its default.
29
28
 
30
29
  Remote Pi sessions appear in the same list when they connect to a broker exposed through `listen` and `connect`. Their tools, global `AGENTS.md`, files, images, and Pi interfaces come from the remote device.
31
30
 
@@ -39,42 +38,20 @@ Remote Pi sessions appear in the same list when they connect to a broker exposed
39
38
 
40
39
  Omit `before` for the latest entries. Use `after` to read forward from an entry. Both fields can delimit a range, with the named entries outside the returned range. The default limit is 20 readable entries. Results follow branch order and contain each entry's original ID and timestamp. `hasMore` indicates additional entries in the requested direction.
41
40
 
42
- Messages, tool calls and results, summaries, images, file links, and Chappie activity records use their saved contents, including Pi's existing truncation notices and full-output paths. Assistant messages carry their originating `chatId` and optional full `requestId` in `message.chappie`. Tool results inherit the source of their `toolCallId`, including when the call falls outside the requested page. Activity records carry the same source fields. Request-specific notices display a compact label such as `ChatGPT Zxbs(fd44) joined`; the workflow suffix is for log correlation and can be shared by parallel executions. When participants report different goals, workflow timing helps identify possible work resumed from an earlier ChatGPT message. Reading leaves a short notice in Pi; the returned history remains separate from new input and pending result delivery.
41
+ To follow progress, pass `after` with `wait: true`. Available entries return immediately; at the end of the branch, the request waits up to 30 seconds for new readable entries. A timeout returns an empty page. Reads with `before` return immediately. Cancellation, disconnection, or an invalidated branch cursor ends the request. Waiting for history leaves the session available for other requests.
43
42
 
44
- Pi user input, webpage answers, connection status, and deferred delivery target sessions or conversations. A deferred result's `requestId` identifies the original operation; the result can reach another execution in that conversation.
43
+ Set `observer: true` to read as an observer. New messages and work activity wake waiting readers; idle status alone does not indicate task completion.
45
44
 
46
- ## Synchronization
45
+ History includes saved messages, tool calls and results, summaries, images, file links, and work activity. Truncation notices and full-output paths are included so complete output can be read when needed. Reading history leaves new input and pending results available for normal delivery.
47
46
 
48
- Enable `sync` in the broker's `chappie.json`. Initialization returns a private `initialization.code` for its Pi session; a saved binding without a code receives one on its next execution.
47
+ ## Participation
49
48
 
50
- When activity conflicts, start synchronization:
51
-
52
- ```json
53
- { "action": "start", "sessionId": "<session-id>" }
54
- ```
55
-
56
- This locks ordinary tools and initialization for the Pi session and its bound conversations, cancelling their active ordinary requests. Bound conversations also pause work on other sessions; unrelated conversations continue. `chat`, `history`, and `sessions` remain available with existing bindings.
57
-
58
- Verify using the code from the most recent initialization:
59
-
60
- ```json
61
- { "action": "verify", "code": "<initialization-code>" }
62
- ```
63
-
64
- The first successful verification returns a replacement code to the coordinator. Everyone can discuss goals and progress through `chat` and `history`, including executions with missing or rejected codes. The coordinator decides who continues, their tasks, and who exits, and may retain only one execution.
65
-
66
- Participants acknowledge the decision. Those directed to exit leave a chat handoff and end their responses. Only the coordinator can release, after these decisions and exits are confirmed:
67
-
68
- ```json
69
- { "action": "release", "code": "<verified-code>" }
70
- ```
71
-
72
- Remaining executions resume their assigned work. Pending input, webpage answers, and deferred results resume normal delivery. Webpage submissions and exported resource reads remain available throughout synchronization.
73
-
74
- Codes persist per Pi session in `chappie.state.json`; locks last for the broker process and survive Pi-client or tunnel reconnections. Repeated `start` preserves the lock; `verify` with the current code, `sessions`, and `history` report its status.
49
+ The executing assistant uses `chat` to share progress and completion in Pi. When initialization directs an assistant to observe, it follows that work through `history` with `observer: true` and `wait: true`, thinks independently, and explains the recorded results in ChatGPT when the task is complete.
75
50
 
76
51
  ## Pi tools
77
52
 
53
+ ChatGPT truncates tool responses exceeding 10,000 tokens.
54
+
78
55
  `read`, `bash`, `edit`, `write`, and `transfer` are available directly. `init` includes a short catalog of the active Pi tools; use `tools` for their complete definitions and `call` to invoke extension tools.
79
56
 
80
57
  For example:
@@ -102,7 +79,7 @@ Pi controls execution inside that batch. Separate requests run in order within o
102
79
  { "text": "Updated the parser and its callers." }
103
80
  ```
104
81
 
105
- Pi user input consumed during the work accompanies later Chappie results, including images. Steering and follow-up follow Pi's own delivery timing.
82
+ Pi user input consumed during the work accompanies later Chappie results, including images.
106
83
 
107
84
  If a request is explicitly cancelled after local work has produced results, those results can accompany a later response to the originating ChatGPT conversation. Long-running local work is better run through the environment's persistent process facilities instead of occupying one tool request.
108
85
 
@@ -110,7 +87,7 @@ The active model remains the current ChatGPT conversation. Starting another `cha
110
87
 
111
88
  ## Webpage questions
112
89
 
113
- When enabled, `ask` creates a question in ChatGPT and returns its ID immediately:
90
+ When enabled, `ask` saves a question and requests a widget in ChatGPT, returning its ID immediately. Display depends on the host:
114
91
 
115
92
  ```json
116
93
  {
@@ -130,6 +107,8 @@ Call `ask_assert` with the returned ID to confirm that the widget loaded:
130
107
  { "questionId": "<question-id>" }
131
108
  ```
132
109
 
110
+ If the widget has not loaded within 10 seconds, `ask_assert` fails and saves the unanswered question as skipped. Use a Pi interactive tool when an answer is needed. The user can still answer or edit the saved question when its widget is available.
111
+
133
112
  Answers, revisions, and skips arrive later as `webAnswer` in normal Chappie results. `options` can be omitted for a text answer, and `allowMultiple: true` allows several choices. `sessionId` associates the question with a Pi session using the session selection rules above.
134
113
 
135
114
  Questions remain available after the assistant response and across broker restarts. Pi's own interactive tools remain ordinary Pi tools and can be invoked through `call`.
@@ -149,7 +128,7 @@ Pair Pi destinations with ChatGPT files:
149
128
  }
150
129
  ```
151
130
 
152
- The ChatGPT host turns the cloud paths or attachment references into downloadable file objects before the call reaches Chappie. Chappie creates parent directories and writes each file directly to its destination.
131
+ The ChatGPT host turns the cloud paths or attachment references into downloadable file objects before the call reaches Chappie. Parent directories are created as needed.
153
132
 
154
133
  Existing targets produce an error by default. Use `overwrite: true` when replacement is intended:
155
134
 
@@ -175,6 +154,25 @@ Chappie returns MCP resource links. ChatGPT retrieves the bytes when it material
175
154
 
176
155
  For a directory, create an archive with a Pi tool and export the resulting file.
177
156
 
157
+ ### Pi to Pi
158
+
159
+ Supply `to` to copy files to another connected Pi session:
160
+
161
+ ```json
162
+ {
163
+ "sessionId": "<source-session>",
164
+ "paths": ["build/output.zip"],
165
+ "to": {
166
+ "sessionId": "<destination-session>",
167
+ "paths": ["downloads/output.zip"]
168
+ }
169
+ }
170
+ ```
171
+
172
+ Source and destination paths correspond by position. Each session resolves its own relative paths, absolute paths, and `~/`. Image references can also be copied. `files` and `to` select different sources and are mutually exclusive.
173
+
174
+ Both Pi sessions need to stay connected during the transfer. `overwrite: true` replaces an existing destination. Cancellation or failure discards the incomplete file; successfully copied files remain available.
175
+
178
176
  ### Images
179
177
 
180
178
  `read` and Pi tool results send images directly to ChatGPT for visual inspection. Chappie also returns a `chappie://` image reference with Pi images. Pass that reference to `transfer.paths` when the same bytes are needed as a file in ChatGPT's cloud environment.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zetaloop/chappie",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Connect ChatGPT to Pi",
5
5
  "devDependencies": {
6
6
  "@earendil-works/pi-ai": "^0.85.1",