@zetaloop/chappie 0.5.0 → 1.0.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/.codex-plugin/plugin.json +13 -0
- package/README.md +26 -29
- package/dist/chunk-5CKVVDZ2.js +1042 -0
- package/dist/chunk-DM523QRR.js +148 -0
- package/dist/chunk-DN7OHZK6.js +110 -0
- package/dist/chunk-DQWC5GFN.js +1745 -0
- package/dist/chunk-EIPDEA3I.js +286 -0
- package/dist/chunk-GWYP7B66.js +8479 -0
- package/dist/chunk-GX4JWLHH.js +98 -0
- package/dist/chunk-K2VE2MDU.js +14916 -0
- package/dist/chunk-OWAAWZNT.js +56 -0
- package/dist/chunk-UOFCCHBS.js +94 -0
- package/dist/cli.js +47 -0
- package/dist/codex-RI2XL4HV.js +5144 -0
- package/dist/codex-plugin-NSKWB3WS.js +179 -0
- package/dist/codex.json +23 -0
- package/dist/index.js +4752 -0
- package/dist/instructions.md +13 -0
- package/dist/omp.js +240 -0
- package/dist/opencode.js +904 -0
- package/dist/promise-OHH5J44X.js +72 -0
- package/dist/stdio-KJVCYPXJ.js +1279 -0
- package/docs/setup.md +82 -0
- package/docs/tools.md +106 -96
- package/package.json +100 -56
- package/src/activity.ts +0 -21
- package/src/broker.ts +0 -780
- package/src/config.ts +0 -20
- package/src/delivery.ts +0 -54
- package/src/history.ts +0 -136
- package/src/index.ts +0 -42
- package/src/instructions.md +0 -17
- package/src/ipc.ts +0 -492
- package/src/provider.ts +0 -194
- package/src/questions.ts +0 -87
- package/src/resources.ts +0 -209
- package/src/server.ts +0 -566
- package/src/session.ts +0 -848
- package/src/state.ts +0 -163
- package/src/stdio.ts +0 -58
- package/src/tools.ts +0 -91
- package/src/transfer.ts +0 -313
- /package/{src → dist}/question.html +0 -0
package/docs/setup.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Setup and configuration
|
|
2
|
+
|
|
3
|
+
The broker is available as `chappie` after global installation, or through `pnpx -y @zetaloop/chappie`. Agent plugins connect to it from their own devices.
|
|
4
|
+
|
|
5
|
+
## Codex
|
|
6
|
+
|
|
7
|
+
Install the plugin from this repository's marketplace:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
codex plugin marketplace add zetaloop/chappie
|
|
11
|
+
codex plugin add chappie@chappie
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Using an ordinary model
|
|
15
|
+
|
|
16
|
+
Enable `localTools` in Chappie's configuration. The installed plugin provides tools for working with other Chappie sessions.
|
|
17
|
+
|
|
18
|
+
### Using the Chappie model
|
|
19
|
+
|
|
20
|
+
To receive work in Codex, save the [model catalog](https://raw.githubusercontent.com/zetaloop/chappie/main/src/codex.json) locally and reference its absolute path in Codex's user configuration, `~/.codex/config.toml` or `$CODEX_HOME/config.toml`:
|
|
21
|
+
|
|
22
|
+
```toml
|
|
23
|
+
model_provider = "chappie"
|
|
24
|
+
model = "chatgpt"
|
|
25
|
+
model_catalog_json = "/absolute/path/to/codex.json"
|
|
26
|
+
|
|
27
|
+
[model_providers.chappie]
|
|
28
|
+
name = "Chappie"
|
|
29
|
+
base_url = "http://127.0.0.1:24275/v1"
|
|
30
|
+
|
|
31
|
+
[mcp_servers.chappie]
|
|
32
|
+
command = "pnpx"
|
|
33
|
+
args = ["-y", "@zetaloop/chappie", "codex", "--chatgpt"]
|
|
34
|
+
env_vars = ["CODEX_HOME"]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Restart the Codex app after changing its provider configuration. The plugin starts the local provider service.
|
|
38
|
+
|
|
39
|
+
To return to an ordinary model, restore its model, provider, and catalog settings and remove the `[mcp_servers.chappie]` override shown above, then restart the app. The installed plugin supplies the local tools.
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
Settings live in `~/.chappie/config.json`. The broker and agent plugins read this file at startup; an absent file uses the defaults.
|
|
44
|
+
|
|
45
|
+
| Setting | Default | Used by | Purpose |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `ask` | `true` | Broker | Enable question widgets in ChatGPT. |
|
|
48
|
+
| `cooldown` | `20` | Broker | Participation window, in seconds. |
|
|
49
|
+
| `listen` | `false` | Broker | Accept TCP connections; `true` uses port `24274`, or supply a port number. |
|
|
50
|
+
| `connect` | Local socket | Agent plugins | Broker hostname, optionally followed by `:port`. |
|
|
51
|
+
| `localTools` | `false` | Agent plugins | Provide collaboration tools to ordinary models. |
|
|
52
|
+
|
|
53
|
+
`cooldown` applies to each ChatGPT conversation and target session. Repeated initialization within the window returns [observation instructions](tools.md#participation). The window refreshes when a question widget first loads or a resource is accessed; `0` disables it.
|
|
54
|
+
|
|
55
|
+
### Multiple devices
|
|
56
|
+
|
|
57
|
+
On the broker's device:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{ "listen": true }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On each other device:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{ "connect": "<broker>.local" }
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The default TCP port is `24274`. All connected agents share the session directory and file transfer service. Paths are resolved on their respective devices.
|
|
70
|
+
|
|
71
|
+
### OpenCode
|
|
72
|
+
|
|
73
|
+
Chappie discovers OpenCode's local background service automatically. For a standalone server, set `opencode.url` to its HTTP address and `opencode.password` when authentication is enabled.
|
|
74
|
+
|
|
75
|
+
### Codex service
|
|
76
|
+
|
|
77
|
+
| Setting | Default | Purpose |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `codex.port` | `24275` | Local provider HTTP port. |
|
|
80
|
+
| `codex.appServer` | Default control socket | Codex app-server endpoint: `unix://<path>` or a WebSocket URL. |
|
|
81
|
+
|
|
82
|
+
When changing `codex.port`, update `model_providers.chappie.base_url` in Codex's configuration to match.
|
package/docs/tools.md
CHANGED
|
@@ -1,66 +1,38 @@
|
|
|
1
1
|
# Tools
|
|
2
2
|
|
|
3
|
+
ChatGPT uses the tools below. Agent sessions using ordinary models have a [local tool set](#local-models).
|
|
4
|
+
|
|
3
5
|
| Tool | Purpose |
|
|
4
6
|
|---|---|
|
|
5
|
-
| `
|
|
6
|
-
| `
|
|
7
|
-
| `
|
|
8
|
-
| `
|
|
9
|
-
| `chat` | Send an assistant message
|
|
7
|
+
| `sessions` | Find sessions by agent, device, directory, or name. |
|
|
8
|
+
| `init` | Select this ChatGPT conversation's default session and read its environment. |
|
|
9
|
+
| `tools` | Read the selected session's native tool definitions. |
|
|
10
|
+
| `call` | Execute a native tool batch. |
|
|
11
|
+
| `chat` | Send an assistant message or answer a model request. |
|
|
12
|
+
| `history` | Read the agent's transcript with entry IDs and timestamps. |
|
|
13
|
+
| `transfer` | Exchange files and images with ChatGPT or another session. |
|
|
10
14
|
| `ask` | Create a persistent question in ChatGPT. |
|
|
11
|
-
| `ask_assert` | Confirm that
|
|
12
|
-
| `call` | Run one or more Pi tools as one native batch. |
|
|
13
|
-
| `read` | Read local text or images. |
|
|
14
|
-
| `bash` | Run a shell command. |
|
|
15
|
-
| `edit` | Apply text replacements. |
|
|
16
|
-
| `write` | Write text to a file. |
|
|
17
|
-
| `transfer` | Move files between ChatGPT and Pi, copy between Pi sessions, or export a Pi image. |
|
|
15
|
+
| `ask_assert` | Confirm that its widget loaded. |
|
|
18
16
|
|
|
19
17
|
## Sessions
|
|
20
18
|
|
|
21
|
-
|
|
22
|
-
|
|
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`.
|
|
24
|
-
|
|
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.
|
|
26
|
-
|
|
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.
|
|
28
|
-
|
|
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.
|
|
30
|
-
|
|
31
|
-
## History
|
|
32
|
-
|
|
33
|
-
`history` reads the current branch of a Pi session. It uses the saved default or an explicit `sessionId`, independently of default-session selection.
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{ "sessionId": "<session-id>", "limit": 20, "before": "<entry-id>" }
|
|
37
|
-
```
|
|
38
|
-
|
|
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.
|
|
40
|
-
|
|
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.
|
|
42
|
-
|
|
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.
|
|
44
|
-
|
|
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.
|
|
46
|
-
|
|
47
|
-
## Participation
|
|
19
|
+
`init` accepts a `sessionId` to resume a task, including from another ChatGPT conversation or branch. Read recent `history` to recover its progress. When `globalAgents` is present, its path identifies the host's global instruction file.
|
|
48
20
|
|
|
49
|
-
|
|
21
|
+
Without `sessionId`, `init` reuses the saved default or selects an online session with no saved ChatGPT binding. The first execution tool can also establish a default. Once a default exists, another tool's `sessionId` selects only that operation's target; `init({ sessionId })` changes the default.
|
|
50
22
|
|
|
51
|
-
|
|
23
|
+
Several conversations can share a session, and one conversation can work with several sessions. An operation stays associated with the target selected when it started. Conversation bindings survive broker restarts.
|
|
52
24
|
|
|
53
|
-
|
|
25
|
+
`sessions` returns IDs, agents, devices, working directories, names, models, execution status, and binding counts. A session registers while its Chappie provider is selected. Devices using `listen` and `connect` share this directory of sessions.
|
|
54
26
|
|
|
55
|
-
|
|
27
|
+
## Native tools
|
|
56
28
|
|
|
57
|
-
|
|
29
|
+
`init` includes a short tool catalog. `tools` returns full definitions, optionally selected by name:
|
|
58
30
|
|
|
59
31
|
```json
|
|
60
|
-
{ "names": ["
|
|
32
|
+
{ "names": ["read", "bash"] }
|
|
61
33
|
```
|
|
62
34
|
|
|
63
|
-
|
|
35
|
+
Names and parameters come from the selected agent. For example, a Pi session accepts this batch:
|
|
64
36
|
|
|
65
37
|
```json
|
|
66
38
|
{
|
|
@@ -71,92 +43,82 @@ A `call` array is one Pi tool batch:
|
|
|
71
43
|
}
|
|
72
44
|
```
|
|
73
45
|
|
|
74
|
-
|
|
46
|
+
A `calls` array executes as one native batch. Separate requests are ordered within a session; different sessions can execute independently. Tools retain their host's execution, interaction, and transcript behavior.
|
|
75
47
|
|
|
76
|
-
`
|
|
48
|
+
`call` also accepts `base64`: the same `calls` array serialized as UTF-8 JSON and encoded as Base64. Supply either representation, with `sessionId` outside the encoded array.
|
|
49
|
+
|
|
50
|
+
`chat` sends progress and completion messages to the selected session:
|
|
77
51
|
|
|
78
52
|
```json
|
|
79
53
|
{ "text": "Updated the parser and its callers." }
|
|
80
54
|
```
|
|
81
55
|
|
|
82
|
-
|
|
83
|
-
|
|
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.
|
|
85
|
-
|
|
86
|
-
The active model remains the current ChatGPT conversation. Starting another `chappie/chatgpt` agent inside Pi does not create another browser conversation; tools that need another model should use a separately configured provider.
|
|
87
|
-
|
|
88
|
-
## Webpage questions
|
|
56
|
+
Local user input accompanies later results, including images. Completed output from an interrupted request can be delivered to its originating conversation with a later response.
|
|
89
57
|
|
|
90
|
-
|
|
58
|
+
A session can request generated text, such as a summary or title. The result includes a `request` ID, its `sessionId`, instructions, and the original input. Reply with `chat`:
|
|
91
59
|
|
|
92
60
|
```json
|
|
93
61
|
{
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"options": [
|
|
98
|
-
{ "title": "JSON", "description": "Convenient for programs.", "recommended": true },
|
|
99
|
-
{ "title": "CSV", "description": "Convenient for spreadsheets." }
|
|
100
|
-
]
|
|
62
|
+
"sessionId": "<session-id>",
|
|
63
|
+
"replyTo": "<request-id>",
|
|
64
|
+
"text": "The requested summary."
|
|
101
65
|
}
|
|
102
66
|
```
|
|
103
67
|
|
|
104
|
-
|
|
68
|
+
During a pending model request, `call` reports the batch as unexecuted with `cancelled` and an error status. Read context with `history`, reply to the request, then submit the tools still needed. Each request has its own ID; a reply can include another request when the session needs several summaries.
|
|
69
|
+
|
|
70
|
+
ChatGPT removes the middle of tool responses exceeding 10,000 tokens. Use history pagination or limit native tool output when needed; local tools have no such response limit.
|
|
71
|
+
|
|
72
|
+
## History
|
|
73
|
+
|
|
74
|
+
`history` reads the native transcript using the saved default or an explicit `sessionId`:
|
|
105
75
|
|
|
106
76
|
```json
|
|
107
|
-
{ "
|
|
77
|
+
{ "sessionId": "<session-id>", "limit": 20, "before": "<entry-id>" }
|
|
108
78
|
```
|
|
109
79
|
|
|
110
|
-
|
|
111
|
-
|
|
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.
|
|
80
|
+
The default is the latest 20 readable entries. `before` pages backward and `after` pages forward; both can delimit a range. Named entries are excluded from that range. Results follow transcript order, with native IDs and recorded timestamps. `hasMore` indicates more entries in the requested direction.
|
|
113
81
|
|
|
114
|
-
|
|
82
|
+
Use `after` with `wait: true` to follow progress. Available entries return immediately; at the end of the transcript the request waits up to 30 seconds, returning an empty page when no entries arrive. Reads with `before` return immediately.
|
|
115
83
|
|
|
116
|
-
|
|
84
|
+
History includes native messages, tool calls and results, summaries, images, and resource references. Each read reflects the host's current records, including work in progress. Re-read the same range to see updates to existing entries.
|
|
117
85
|
|
|
118
|
-
|
|
86
|
+
### Participation
|
|
119
87
|
|
|
120
|
-
|
|
88
|
+
The executing assistant uses `chat` for progress and completion. When `initialization.instructions` assigns observation, read that work through `history` with `observer: true` and `wait: true`, then report its recorded outcome in ChatGPT.
|
|
121
89
|
|
|
122
|
-
|
|
90
|
+
## Files and images
|
|
123
91
|
|
|
124
|
-
|
|
125
|
-
{
|
|
126
|
-
"paths": ["assets/reference.png", "data/input.csv"],
|
|
127
|
-
"files": ["/mnt/data/reference.png", "/mnt/data/input.csv"]
|
|
128
|
-
}
|
|
129
|
-
```
|
|
92
|
+
`paths` names files on the selected session's device. Relative paths use its working directory; absolute paths and `~/` are accepted. Each transfer pairs source and destination paths by position.
|
|
130
93
|
|
|
131
|
-
|
|
94
|
+
### From ChatGPT
|
|
132
95
|
|
|
133
|
-
|
|
96
|
+
Pair destination paths with ChatGPT attachments:
|
|
134
97
|
|
|
135
98
|
```json
|
|
136
99
|
{
|
|
137
|
-
"paths": ["assets/reference.png"],
|
|
138
|
-
"files": ["/mnt/data/reference.png"]
|
|
139
|
-
"overwrite": true
|
|
100
|
+
"paths": ["assets/reference.png", "data/input.csv"],
|
|
101
|
+
"files": ["/mnt/data/reference.png", "/mnt/data/input.csv"]
|
|
140
102
|
}
|
|
141
103
|
```
|
|
142
104
|
|
|
143
|
-
|
|
105
|
+
ChatGPT converts the attachment references into downloadable file objects. Chappie creates parent directories. `overwrite: true` replaces existing targets.
|
|
144
106
|
|
|
145
|
-
###
|
|
107
|
+
### To ChatGPT
|
|
146
108
|
|
|
147
|
-
|
|
109
|
+
Export files from the selected session:
|
|
148
110
|
|
|
149
111
|
```json
|
|
150
112
|
{ "paths": ["build/output.zip", "renders/preview.png"] }
|
|
151
113
|
```
|
|
152
114
|
|
|
153
|
-
|
|
115
|
+
The returned resource links identify the original session and file. ChatGPT retrieves their bytes through resource materialization, which may prompt for approval. The producing connection and source file provide those bytes even after the conversation changes its default session.
|
|
154
116
|
|
|
155
|
-
|
|
117
|
+
Native image results also carry `chappie://` references. Pass a reference to `transfer.paths` to retrieve those exact bytes, or use the original file path to export the source image.
|
|
156
118
|
|
|
157
|
-
###
|
|
119
|
+
### Between sessions
|
|
158
120
|
|
|
159
|
-
|
|
121
|
+
Send files using `to`:
|
|
160
122
|
|
|
161
123
|
```json
|
|
162
124
|
{
|
|
@@ -169,12 +131,60 @@ Supply `to` to copy files to another connected Pi session:
|
|
|
169
131
|
}
|
|
170
132
|
```
|
|
171
133
|
|
|
172
|
-
|
|
134
|
+
Retrieve files using `from`:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"paths": ["downloads/output.zip"],
|
|
139
|
+
"from": {
|
|
140
|
+
"sessionId": "<source-session>",
|
|
141
|
+
"paths": ["build/output.zip"]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Both sides use their existing broker connections and resolve paths on their own devices. Different agents use the same transfer operations. Completed files remain available when another file in the batch fails or is cancelled.
|
|
147
|
+
|
|
148
|
+
## Local models
|
|
149
|
+
|
|
150
|
+
Enable `localTools` in Chappie's configuration to provide these tools to ordinary models:
|
|
151
|
+
|
|
152
|
+
| Tool | Target |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `sessions` | Online Chappie sessions, with the current local ID reported as `self`. |
|
|
155
|
+
| `remote_tools` | Tool definitions from the required `sessionId`. |
|
|
156
|
+
| `remote_call` | One native tool batch in the required `sessionId`. |
|
|
157
|
+
| `remote_chat` | An assistant message or model-request reply in the required `sessionId`. |
|
|
158
|
+
| `history` | The current local transcript, or a Chappie session named by `sessionId`. |
|
|
159
|
+
| `transfer` | Local files and resources exchanged with Chappie sessions. |
|
|
173
160
|
|
|
174
|
-
|
|
161
|
+
Use an ordinary model in the controlling session and the Chappie model in each target. This supports agent-to-agent collaboration, such as building a project on another operating system.
|
|
175
162
|
|
|
176
|
-
|
|
163
|
+
Local `history` reads the controlling session; pass `sessionId` for a target's transcript. `transfer` uses local paths and exchanges files with targets through `from` and `to`.
|
|
164
|
+
|
|
165
|
+
Use `remote_tools` to discover a target's definitions, then `remote_call` to execute them. When `globalAgents.path` is returned, read that file for the target's instructions. `remote_chat` sends an assistant message to the target:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{ "sessionId": "<target-session>", "text": "The build completed successfully." }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Model requests include instructions naming the local tools. Supply `replyTo` to answer with `remote_chat`, then submit the tools still needed with `remote_call`. These operations use native session IDs, independently of ChatGPT conversation bindings.
|
|
172
|
+
|
|
173
|
+
## Questions in ChatGPT
|
|
174
|
+
|
|
175
|
+
`ask` saves a question and requests its widget:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"header": "Export format",
|
|
180
|
+
"question": "Which export format should the command use?",
|
|
181
|
+
"options": [
|
|
182
|
+
{ "title": "JSON", "description": "Structured data for programs.", "recommended": true },
|
|
183
|
+
{ "title": "CSV", "description": "Tabular data for spreadsheets." }
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
177
187
|
|
|
178
|
-
`
|
|
188
|
+
Call `ask_assert` with the returned `question.id`. It confirms loading or marks the question skipped after 10 seconds. Native agent interaction tools are also available through `call`.
|
|
179
189
|
|
|
180
|
-
|
|
190
|
+
Answers, revisions, and skips arrive as `webAnswer` in later results. Omit `options` for a text answer; use `allowMultiple: true` for multiple choices. Questions persist across replies and broker restarts.
|
package/package.json
CHANGED
|
@@ -1,57 +1,101 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
2
|
+
"name": "@zetaloop/chappie",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Connect ChatGPT and coding agents across devices",
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@ai-sdk/provider": "^3.0.8",
|
|
7
|
+
"@earendil-works/pi-ai": "^0.87.1",
|
|
8
|
+
"@earendil-works/pi-coding-agent": "^0.87.1",
|
|
9
|
+
"@earendil-works/pi-tui": "^0.87.1",
|
|
10
|
+
"@modelcontextprotocol/server": "^2.0.0",
|
|
11
|
+
"@oh-my-pi/pi-ai": "^18.3.0",
|
|
12
|
+
"@oh-my-pi/pi-coding-agent": "^18.3.0",
|
|
13
|
+
"@oh-my-pi/pi-utils": "^18.3.0",
|
|
14
|
+
"@opencode/client": "^2.0.18",
|
|
15
|
+
"@opencode/plugin": "^2.0.18",
|
|
16
|
+
"@types/cross-spawn": "^6.0.6",
|
|
17
|
+
"@types/node": "^26.5.1",
|
|
18
|
+
"@types/ws": "^8.18.1",
|
|
19
|
+
"cross-spawn": "^7.0.6",
|
|
20
|
+
"esbuild": "^0.28.2",
|
|
21
|
+
"mime": "^4.1.0",
|
|
22
|
+
"typebox": "^1.3.30",
|
|
23
|
+
"typescript": "^7.0.2",
|
|
24
|
+
"ws": "^8.21.3",
|
|
25
|
+
"zod": "^4.6.4"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"pi-package",
|
|
29
|
+
"chatgpt",
|
|
30
|
+
"mcp"
|
|
31
|
+
],
|
|
32
|
+
"author": "zetaloop",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"type": "module",
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=26",
|
|
37
|
+
"pnpm": ">=12"
|
|
38
|
+
},
|
|
39
|
+
"pi": {
|
|
40
|
+
"extensions": [
|
|
41
|
+
"./dist/index.js"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"@earendil-works/pi-ai": "*",
|
|
46
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
47
|
+
"@earendil-works/pi-tui": "*",
|
|
48
|
+
"@oh-my-pi/pi-ai": "*",
|
|
49
|
+
"@oh-my-pi/pi-coding-agent": "*",
|
|
50
|
+
"@oh-my-pi/pi-utils": "*"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist",
|
|
54
|
+
"docs",
|
|
55
|
+
".codex-plugin"
|
|
56
|
+
],
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "git+https://github.com/zetaloop/chappie.git"
|
|
63
|
+
},
|
|
64
|
+
"bin": {
|
|
65
|
+
"chappie": "./dist/cli.js"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"@earendil-works/pi-ai": {
|
|
69
|
+
"optional": true
|
|
70
|
+
},
|
|
71
|
+
"@earendil-works/pi-coding-agent": {
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
"@earendil-works/pi-tui": {
|
|
75
|
+
"optional": true
|
|
76
|
+
},
|
|
77
|
+
"@oh-my-pi/pi-ai": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"@oh-my-pi/pi-coding-agent": {
|
|
81
|
+
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"@oh-my-pi/pi-utils": {
|
|
84
|
+
"optional": true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"omp": {
|
|
88
|
+
"extensions": [
|
|
89
|
+
"./dist/omp.js"
|
|
90
|
+
]
|
|
91
|
+
},
|
|
92
|
+
"exports": {
|
|
93
|
+
".": "./dist/index.js",
|
|
94
|
+
"./server": "./dist/opencode.js"
|
|
95
|
+
},
|
|
96
|
+
"scripts": {
|
|
97
|
+
"format": "biome check --write .",
|
|
98
|
+
"check": "biome check . && tsc --noEmit",
|
|
99
|
+
"build": "node scripts/build.ts"
|
|
100
|
+
}
|
|
101
|
+
}
|
package/src/activity.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export interface Source {
|
|
2
|
-
chatId: string;
|
|
3
|
-
requestId?: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface Activity extends Partial<Source> {
|
|
7
|
-
event?: string;
|
|
8
|
-
initialization?: "explicit" | "implicit";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function source(chatId: string, requestId: unknown): Source {
|
|
12
|
-
return {
|
|
13
|
-
chatId,
|
|
14
|
-
...(typeof requestId === "string" ? { requestId } : {}),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function chatLabel({ chatId, requestId }: Source): string {
|
|
19
|
-
const workflow = requestId?.match(/^wfr_([^/]+)\//)?.[1];
|
|
20
|
-
return `ChatGPT ${chatId.slice(-4)}${workflow ? `(${workflow.slice(-4)})` : ""}`;
|
|
21
|
-
}
|