@usepipa/pipa 0.6.0-beta.1 → 0.6.0-beta.3
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 +68 -122
- package/bin/pipa.mjs +5 -15
- package/package.json +1 -1
- package/src/app.mjs +79 -31
- package/src/errors.mjs +4 -0
- package/src/models.mjs +46 -54
- package/src/opencode-v2.mjs +398 -659
- package/src/opencode.mjs +48 -33
- package/src/state.mjs +0 -2
package/README.md
CHANGED
|
@@ -10,12 +10,11 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<strong>Pipa turns
|
|
14
|
-
No relay, no database, no public endpoint.
|
|
13
|
+
<strong>Pipa turns OpenCode into a Slack agent. Start sessions and talk to OpenCode from Slack.</strong>
|
|
15
14
|
</p>
|
|
16
15
|
|
|
17
16
|
<p align="center">
|
|
18
|
-
<a href="https://www.youtube.com/watch?v=rlTMdkPWPcA"><strong>Watch the
|
|
17
|
+
<a href="https://www.youtube.com/watch?v=rlTMdkPWPcA"><strong>Watch the four-minute setup video</strong></a>
|
|
19
18
|
·
|
|
20
19
|
<a href="https://www.usepipa.com/opencode-slack?utm_source=github&utm_medium=repo_readme&utm_campaign=signup&utm_content=readme_how_it_works">How it works</a>
|
|
21
20
|
·
|
|
@@ -24,20 +23,21 @@
|
|
|
24
23
|
<a href="https://github.com/lunchpaillola/pipa/issues">Issues</a>
|
|
25
24
|
</p>
|
|
26
25
|
|
|
27
|
-
> **Early preview.** Features may break
|
|
26
|
+
> **Early preview.** Features may break. Commands, configuration, and Slack behavior may change.
|
|
27
|
+
|
|
28
|
+
If Pipa is useful, [star the repo](https://github.com/lunchpaillola/pipa).
|
|
28
29
|
|
|
29
30
|
## Why Pipa
|
|
30
31
|
|
|
31
32
|
| What it does | What that means |
|
|
32
33
|
| --- | --- |
|
|
33
|
-
| **
|
|
34
|
-
| **
|
|
35
|
-
| **
|
|
36
|
-
| **Generated files** | In local mode, long work returns as a concise summary with generated files from a private per-turn directory. Attached non-loopback servers return inline text. |
|
|
37
|
-
| **Access control** | Restrict by Slack channel, human user, and bot. Allowlists are rechecked on every turn, interaction, and delivery. |
|
|
38
|
-
| **Restart** | `pipa restart` hands off to a detached worker and reports a durable status. |
|
|
34
|
+
| **Thread sessions** | Mention Pipa to start a session. Reply in the thread to keep working. |
|
|
35
|
+
| **Routines** | Schedule work in your timezone. Send results to a channel or thread. |
|
|
36
|
+
| **Access control** | Choose which Slack channels, people, and bots can use Pipa. |
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
## Pipa Managed
|
|
39
|
+
|
|
40
|
+
Want Lunch Pail Labs to set up and run agent workflows for your team? See [Pipa Managed](https://usepipa.com/managed?utm_source=github&utm_medium=repo_readme&utm_campaign=signup&utm_content=readme_footer).
|
|
41
41
|
|
|
42
42
|
## Quickstart
|
|
43
43
|
|
|
@@ -49,47 +49,31 @@ pipa init
|
|
|
49
49
|
pipa start
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
`pipa init`
|
|
52
|
+
`pipa init` walks you through Slack setup and saves your profile under `~/.pipa`. Invite Pipa to an allowed channel and mention it. Follow the [four-minute setup video](https://www.youtube.com/watch?v=rlTMdkPWPcA) or the [written tutorial](https://www.usepipa.com/opencode-slack?utm_source=github&utm_medium=repo_readme&utm_campaign=signup&utm_content=readme_install_guide).
|
|
53
53
|
|
|
54
54
|
### Opt-in 0.6 beta
|
|
55
55
|
|
|
56
|
-
`0.6.0-beta.
|
|
57
|
-
Once published, opt in with:
|
|
56
|
+
`0.6.0-beta.3` is being prepared for controlled testing, not stable release. Once published, opt in with:
|
|
58
57
|
|
|
59
58
|
```sh
|
|
60
|
-
npm install --global @usepipa/pipa@0.6.0-beta.
|
|
59
|
+
npm install --global @usepipa/pipa@0.6.0-beta.3
|
|
61
60
|
```
|
|
62
61
|
|
|
63
|
-
Normal installs
|
|
64
|
-
This updates Pipa only, not OpenCode. For an existing installation, arrange a
|
|
65
|
-
maintenance window, stop Pipa and back up its profile before installing. Keep
|
|
66
|
-
your current OpenCode version initially; do not rerun `pipa init` or create a
|
|
67
|
-
second listener. See the [beta release notes](https://github.com/lunchpaillola/pipa/blob/main/docs/beta-release.md)
|
|
68
|
-
for changes, limitations, and trial/rollback guidance.
|
|
62
|
+
Normal installs use npm's `latest` tag; later betas use `@beta`. This updates Pipa, not OpenCode. Before upgrading, stop Pipa and back up its profile. Keep your current OpenCode version initially. Do not rerun `pipa init` or start a second listener. Read the [beta release notes](https://github.com/lunchpaillola/pipa/blob/main/docs/beta-release.md) for limits and rollback steps.
|
|
69
63
|
|
|
70
64
|
## Security model
|
|
71
65
|
|
|
72
|
-
|
|
66
|
+
Pipa runs locally by default. Its OpenCode server listens on `127.0.0.1`; attached servers use their own network controls. Slack allowlists control who can send requests. Empty channel and human-user lists allow everyone otherwise eligible. Other bots are blocked unless listed.
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
**The working directory is a starting location, not a sandbox.** Allowed users can ask the agent to use the OpenCode profile's tools and permissions beyond that directory. Set channel and user allowlists before sharing Pipa.
|
|
75
69
|
|
|
76
|
-
|
|
70
|
+
Slack tokens stay in the local profile with private file permissions. OpenCode manages provider credentials. Keep tokens, passwords, and local state out of shared output and commits.
|
|
77
71
|
|
|
78
|
-
|
|
72
|
+
Read [SECURITY.md](SECURITY.md) for security boundaries and reporting.
|
|
79
73
|
|
|
80
74
|
## Local Socket Mode
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
### Requirements
|
|
85
|
-
|
|
86
|
-
- Node.js 22 or newer
|
|
87
|
-
- [OpenCode](https://opencode.ai) installed and authenticated; the dual-adapter candidate selects native v1/v2 automatically (current native v2 qualification target: 2.2.5; historical v2 pin: 2.0.29; v1 pins: 1.18.35, 1.19.0; release-qualified minimums pending)
|
|
88
|
-
- A Slack workspace where you can create an app
|
|
89
|
-
|
|
90
|
-
Invite the Slack app only to channels whose members may use OpenCode in the configured working directory.
|
|
91
|
-
|
|
92
|
-
See [OpenCode compatibility](docs/opencode-compatibility.md) for remaining-on-v1 and deliberate-v2 upgrade paths, matched-snapshot rollback, capability differences and remaining release gates. Upgrading Pipa preserves the existing Slack profile; it does not require recreating the Slack app or upgrading OpenCode.
|
|
76
|
+
Socket Mode connects Pipa to Slack through an outbound connection. You do not need a public web endpoint.
|
|
93
77
|
|
|
94
78
|
### Install
|
|
95
79
|
|
|
@@ -105,7 +89,7 @@ npm install --global @usepipa/pipa
|
|
|
105
89
|
pipa init
|
|
106
90
|
```
|
|
107
91
|
|
|
108
|
-
|
|
92
|
+
Follow the prompts to create and install the Slack app. Choose your working directory and set channel and user allowlists.
|
|
109
93
|
|
|
110
94
|
3. Start Pipa:
|
|
111
95
|
|
|
@@ -113,27 +97,23 @@ pipa init
|
|
|
113
97
|
pipa start
|
|
114
98
|
```
|
|
115
99
|
|
|
116
|
-
Keep `pipa start` running
|
|
117
|
-
|
|
118
|
-
Ordinary startup detects OpenCode v1/v2 and waits for listening, workspace readiness and Slack initialization without a default overall timeout or migration-status gate. OpenCode owns schema/data upgrades; Pipa never converts that data. Ctrl+C cancels startup and stops owned children, never attached servers. See the [startup contract](docs/opencode-compatibility.md#startup-contract) for retry, failure and explicit-deadline behavior.
|
|
100
|
+
Keep `pipa start` running. Invite Pipa to an allowed channel and mention it. Replies in that thread continue the same session without another mention. Different threads work independently.
|
|
119
101
|
|
|
120
|
-
|
|
102
|
+
On OpenCode v2, replies steer ongoing work, and background results can return to the thread. V1 interrupts the current turn when a new message arrives. Replies missed during a disconnect or restart are not recovered. After restart, send another message in the thread to resume background forwarding. Failed Slack deliveries are not replayed.
|
|
121
103
|
|
|
122
|
-
|
|
104
|
+
Startup waits for OpenCode and Slack to be ready, with no default overall timeout. Ctrl+C stops startup and processes Pipa owns, not attached servers. See [OpenCode compatibility](docs/opencode-compatibility.md) for startup, session, and upgrade details.
|
|
123
105
|
|
|
124
|
-
|
|
106
|
+
### Files
|
|
125
107
|
|
|
126
|
-
|
|
108
|
+
Include a text prompt with attachments. Incoming messages allow up to 10 files, each at most 10 MiB. Temporary copies are removed after the turn. Your model must support the files you send.
|
|
127
109
|
|
|
128
|
-
|
|
110
|
+
Generated files must stay inside Pipa's private artifact directory under `.pipa/artifacts`. Pipa checks paths, file identity, type, count, and size before sending them. Outgoing limits are 10 files and 100 MB per file or response. If file delivery fails, Pipa retries the summary without files. Attached servers on non-loopback hosts return inline text instead.
|
|
129
111
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
Startup reconciles the profile's private `~/.pipa/opencode-recovery.json` before accepting Slack or routine work. It removes only owned instructions/admissions and waits for owned execution to settle; it does not replay the failed prompt. Keep the recovery file and session mappings intact. If startup still blocks, resolve the reported server/workspace or foreign-writer conflict before trying again; deleting the recovery file would discard the evidence needed for safe cleanup. Review any partial side effects before manually retrying the original request.
|
|
112
|
+
Attached v2 servers may need `BUN_JSC_maxRegExpStackSize=536870912` in the **server process** to handle large attachments. Pipa sets this by default for v2 servers it starts, unless overridden. See [attachment guidance](docs/opencode-compatibility.md) for details.
|
|
133
113
|
|
|
134
114
|
### Access control
|
|
135
115
|
|
|
136
|
-
By default Pipa answers
|
|
116
|
+
By default, Pipa answers human users in channels it can see, excluding DMs and external channels. Use channel and user allowlists to restrict access. `pipa init` asks for these and saves them in the config:
|
|
137
117
|
|
|
138
118
|
```json
|
|
139
119
|
{
|
|
@@ -147,13 +127,14 @@ By default Pipa answers any human user who mentions it in a channel it can see,
|
|
|
147
127
|
}
|
|
148
128
|
```
|
|
149
129
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
130
|
+
- Human requests must pass both the channel and user allowlists. Missing or empty lists allow all otherwise eligible channels or people.
|
|
131
|
+
- Other bots are blocked unless listed in `allowedSlackBotIds`. Use the sender's `bot_id` (`B…`), not its app ID (`A…`) or user ID (`U…`). Bots must pass the channel list but do not need a user-list entry.
|
|
132
|
+
- For scripted setup, use comma-separated `PIPA_ALLOWED_CHANNEL_IDS`, `PIPA_ALLOWED_USER_IDS`, and `PIPA_ALLOWED_BOT_IDS`.
|
|
133
|
+
- Restart Pipa after editing the config. Access is checked again for each turn, interaction, and delivery.
|
|
153
134
|
|
|
154
135
|
#### Mention-only mode
|
|
155
136
|
|
|
156
|
-
|
|
137
|
+
Set `mentionOnly` to `true` to require an @-mention for every turn, even in an existing thread:
|
|
157
138
|
|
|
158
139
|
```json
|
|
159
140
|
{
|
|
@@ -161,15 +142,11 @@ By default, once Pipa is mentioned in a thread it subscribes to that thread and
|
|
|
161
142
|
}
|
|
162
143
|
```
|
|
163
144
|
|
|
164
|
-
`pipa init` asks for this
|
|
145
|
+
`pipa init` asks for this. For scripted setup, use `PIPA_MENTION_ONLY` (`1`, `true`, or `yes`). Missing or `false` keeps thread-following on. Routines are unaffected.
|
|
165
146
|
|
|
166
147
|
#### Find the sender's bot ID
|
|
167
148
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
1. Open the **sender app** at [Slack Apps](https://api.slack.com/apps), not Pipa's app.
|
|
171
|
-
2. Under **OAuth & Permissions**, copy its **Bot User OAuth Token** (`xoxb-…`). If needed, install the app in the workspace via **Install App** first.
|
|
172
|
-
3. Set that token locally in `SLACK_SENDER_BOT_TOKEN`, then call [Slack `auth.test`](https://docs.slack.dev/reference/methods/auth.test/):
|
|
149
|
+
Open the **sender app** at [Slack Apps](https://api.slack.com/apps). Under **OAuth & Permissions**, get its installed Bot User OAuth Token. Set it locally in `SLACK_SENDER_BOT_TOKEN`, then call [Slack `auth.test`](https://docs.slack.dev/reference/methods/auth.test/):
|
|
173
150
|
|
|
174
151
|
```sh
|
|
175
152
|
curl --silent --show-error --request POST \
|
|
@@ -177,48 +154,38 @@ curl --silent --show-error --request POST \
|
|
|
177
154
|
https://slack.com/api/auth.test
|
|
178
155
|
```
|
|
179
156
|
|
|
180
|
-
|
|
157
|
+
Use the response's `bot_id` in `allowedSlackBotIds`. Keep the token out of config examples, shared output, and commits.
|
|
181
158
|
|
|
182
|
-
|
|
183
|
-
{
|
|
184
|
-
"ok": true,
|
|
185
|
-
"user_id": "U0123456789",
|
|
186
|
-
"bot_id": "B0123456789"
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Use `bot_id` (`B0123456789`) in `allowedSlackBotIds`; `user_id` identifies the bot's user account and is not the bot allowlist ID.
|
|
159
|
+
**Incoming webhooks:** use the posted message's actual `bot_id`; it may differ from `auth.test`. Read it from the event or [conversation history](https://docs.slack.dev/reference/methods/conversations.history/) with the required access and history scope.
|
|
191
160
|
|
|
192
|
-
|
|
161
|
+
Allowed bots still need to mention Pipa or reply in a subscribed thread. Webhooks must put the mention in `text`. Only allow bots whose messages you trust as agent requests.
|
|
193
162
|
|
|
194
|
-
|
|
163
|
+
### Use an existing OpenCode server
|
|
195
164
|
|
|
196
|
-
|
|
165
|
+
Set the server URL before starting Pipa. Pipa checks the workspace but does not start or stop that server. If it requires authentication, also set `OPENCODE_SERVER_USERNAME` and `OPENCODE_SERVER_PASSWORD`:
|
|
197
166
|
|
|
198
167
|
```sh
|
|
199
168
|
export PIPA_OPENCODE_ATTACH_URL=http://localhost:5555
|
|
200
169
|
pipa start
|
|
201
170
|
```
|
|
202
171
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
Type your installation's command followed by `model` in an allowed Slack channel: `/chopper model` for `Chopper`, `/pipwick model` for `Pipwick`, or the `/pipa model` compatibility alias when registered to that app. Both forms use the same private native modal, authorization checks, and setting. A loading window opens before catalog discovery, then fills with models grouped by provider. Browse or type to filter, choose a model, and Save. Save closes the window promptly; a private channel message confirms success only after fresh validation and persistence, or explains a failure. Wait for that confirmation before testing the new selection. Cancel leaves the setting unchanged. Existing channel and human-user allowlists are rechecked after discovery, on Save, during persistence, and before delivering the private result.
|
|
172
|
+
**External clients of a Managed profile:** set an explicit shared `OPENCODE_SERVER_PASSWORD` in the server/restart environment and every client. On v2, `OPENCODE_PASSWORD` takes precedence; match it or remove conflicting values. Otherwise Pipa generates a private password for each launch, and external clients cannot connect. Keep passwords private. See [OpenCode compatibility](docs/opencode-compatibility.md).
|
|
206
173
|
|
|
207
|
-
|
|
174
|
+
### Choosing a model
|
|
208
175
|
|
|
209
|
-
|
|
176
|
+
In an allowed channel, type your app's command followed by `model`: `/chopper model` for `Chopper`, or `/pipa model` when registered. Search by model name, ID, or provider. Choose a model, save, and wait for the private confirmation. Cancel leaves the setting unchanged.
|
|
210
177
|
|
|
211
|
-
The
|
|
178
|
+
The choice applies to new threads without restarting Pipa. Existing threads keep their model across replies and restarts. New routines save the current choice; existing routines keep theirs. Routines with no saved model use OpenCode's default. With no selection, new threads also use OpenCode's default. Changing this setting does not change subagents or external clients.
|
|
212
179
|
|
|
213
|
-
|
|
180
|
+
To use a different model, start a new thread. Changing an existing v2 thread's model still requires OpenCode.
|
|
214
181
|
|
|
215
|
-
The picker
|
|
182
|
+
The picker shows up to 100 matches; narrow your search for more. A listed model may still lack credentials or quota. Saving does not test it. Providers such as `opencode` and `openai` use separate credentials. Reconnect failed providers in OpenCode. Pipa never silently switches models.
|
|
216
183
|
|
|
217
|
-
|
|
184
|
+
**Multiple Slack apps:** give each a distinct command. Slack sends a shared `/pipa` command to the most recently installed app. Register that alias with only one app, and check the app name in the picker before saving.
|
|
218
185
|
|
|
219
186
|
### Upgrading an existing installation
|
|
220
187
|
|
|
221
|
-
**An npm upgrade
|
|
188
|
+
**An npm upgrade does not update your Slack app, register commands, or grant scopes.** Mentions and thread replies still work without the model command. Do not rerun `pipa init` or replace credentials to add it.
|
|
222
189
|
|
|
223
190
|
To upgrade to `0.5.6`, use the same `PIPA_HOME` as your existing installation (leave it unset for the default `~/.pipa` profile):
|
|
224
191
|
|
|
@@ -228,35 +195,27 @@ pipa --version
|
|
|
228
195
|
pipa manifest > "$HOME/pipa-slack-manifest-0.5.6.json"
|
|
229
196
|
```
|
|
230
197
|
|
|
231
|
-
`pipa manifest`
|
|
198
|
+
`pipa manifest` prints a local template without tokens. It does not change your profile or contact Slack. It is not an export of your app's current Slack settings.
|
|
232
199
|
|
|
233
|
-
1. Open your **existing app** in [Slack App Management](https://api.slack.com/apps).
|
|
234
|
-
2.
|
|
235
|
-
3. Save
|
|
236
|
-
4. Restart the same profile
|
|
200
|
+
1. Open your **existing app** in [Slack App Management](https://api.slack.com/apps). Back up its current manifest.
|
|
201
|
+
2. Merge the desired `features.slash_commands` entries and add `commands` to `oauth_config.scopes.bot`. Keep existing settings, commands, scopes, Socket Mode, and interactivity. **Do not replace a customized Slack manifest with the local template.**
|
|
202
|
+
3. Save and reinstall or reauthorize the same app. Keep your tokens unless Slack rotates them. If it does, update the existing local config securely.
|
|
203
|
+
4. Restart the same profile:
|
|
237
204
|
|
|
238
205
|
```sh
|
|
239
206
|
pipa restart
|
|
240
207
|
pipa restart --status
|
|
241
208
|
```
|
|
242
209
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
Before npm publication, preview the feature branch from this repo without reinstalling or reinitializing your profile:
|
|
246
|
-
|
|
247
|
-
```sh
|
|
248
|
-
npm ci
|
|
249
|
-
node bin/pipa.mjs --version
|
|
250
|
-
node bin/pipa.mjs manifest > "$HOME/pipa-slack-manifest-preview.json"
|
|
251
|
-
```
|
|
210
|
+
Wait for restart completion, then try the registered model command. The absence of a startup warning does not prove the command is installed. Renaming the bot in Slack does not update Pipa's `botName` or command registration; keep them aligned and restart.
|
|
252
211
|
|
|
253
|
-
|
|
212
|
+
To try an unpublished branch, follow the isolated test-app steps in [CONTRIBUTING.md](CONTRIBUTING.md). Never start a second Socket listener with a running installation's credentials.
|
|
254
213
|
|
|
255
214
|
### Routines
|
|
256
215
|
|
|
257
|
-
|
|
216
|
+
Routines run scheduled work and send results to a channel or existing thread. Replies continue that session. Routines use the profile's directory, tools, permissions, and allowlists.
|
|
258
217
|
|
|
259
|
-
Preview agent-assisted changes
|
|
218
|
+
Preview agent-assisted changes, check the JSON, and confirm before saving:
|
|
260
219
|
|
|
261
220
|
```sh
|
|
262
221
|
pipa routine create \
|
|
@@ -269,7 +228,7 @@ pipa routine create \
|
|
|
269
228
|
--json
|
|
270
229
|
```
|
|
271
230
|
|
|
272
|
-
Remove `--preview` to save
|
|
231
|
+
Remove `--preview` to save. Use `--prompt-file` for exact multiline text or shell characters. Prompt files may be outside the starting folder; generated-file restrictions still apply. Use IANA timezones such as `America/New_York` or `UTC`, not `EST`.
|
|
273
232
|
|
|
274
233
|
Supported schedules:
|
|
275
234
|
|
|
@@ -282,14 +241,11 @@ pipa routine create --prompt "Follow up" --timezone UTC --channel C0BSE2JTYPR --
|
|
|
282
241
|
|
|
283
242
|
# Tuesday, Thursday, and Saturday at three local times
|
|
284
243
|
pipa routine create --prompt "Post status" --timezone America/New_York --channel C0BSE2JTYPR --every 1w --weekdays 2,4,6 --times 09:00,15:00,18:00
|
|
285
|
-
|
|
286
|
-
# Daily through the inclusive local date September 5
|
|
287
|
-
pipa routine create --prompt "Evening close" --timezone America/New_York --channel C0BSE2JTYPR --every 1d --times 19:00 --until 2030-09-05
|
|
288
244
|
```
|
|
289
245
|
|
|
290
|
-
Use `pipa routine list`, `show`, `edit`, `run`, and `delete
|
|
246
|
+
Use `pipa routine list`, `show`, `edit`, `run`, and `delete`. Pause or resume with `edit --status inactive|active`. Completed routines stay until deleted. `routine run` requests one execution without changing the schedule or status.
|
|
291
247
|
|
|
292
|
-
Routines
|
|
248
|
+
Routines need Socket Mode `pipa start` running and the machine awake. Missed scheduled runs are skipped. Explicit run requests survive restart, but a crash can cause repeated actions or deliveries. Managed profiles do not run routines. Use `pipa routine --help` for all options.
|
|
293
249
|
|
|
294
250
|
### Restarting Pipa
|
|
295
251
|
|
|
@@ -300,17 +256,13 @@ pipa restart
|
|
|
300
256
|
pipa restart --status
|
|
301
257
|
```
|
|
302
258
|
|
|
303
|
-
Anyone allowed by
|
|
304
|
-
|
|
305
|
-
The running Pipa launches a detached worker before stopping intake, cleaning up, and releasing its instance lock. The worker waits for the original process and lock to disappear, then starts a detached replacement and confirms workspace readiness (and Slack readiness for Socket Mode). The replacement continues in the background without terminal output; use `pipa stop` to stop it. This works for Socket and Managed profiles on supported macOS, Linux, and Windows systems. Attached OpenCode servers remain externally owned and are never stopped by Pipa.
|
|
259
|
+
Anyone allowed by Slack user and channel controls can request a restart. There is no separate approval. **Requested does not mean completed.** Check status; if failed or unconfirmed, inspect the reported phase and running instance before starting another process.
|
|
306
260
|
|
|
307
|
-
|
|
261
|
+
The replacement runs in the background. Use `pipa stop` to stop it. A Slack restart posts to the same thread when ready. Pipa never stops an attached OpenCode server. On Windows, `pipa stop` forcibly stops owned processes and can interrupt work; use `pipa restart` for a cooperative restart.
|
|
308
262
|
|
|
309
|
-
|
|
263
|
+
Do not chain `pipa stop` and `pipa start` inside an agent turn: stopping owned OpenCode kills that turn. OpenCode's `/instance/dispose` does not restart the server.
|
|
310
264
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
Commands must use the same `PIPA_HOME` (the parent of `.pipa`) as the running profile. Pipa passes the resolved absolute home to its owned OpenCode and restart processes. With an attached server, ensure the agent's command environment uses that home; a remote server needs command access to the Pipa host. An older running Pipa needs one manual stop/start after upgrading. If status reports failure or an unconfirmed handoff, inspect the reported phase and current instance before attempting a manual start.
|
|
265
|
+
Use the running profile's `PIPA_HOME` (the parent of `.pipa`) for all commands. An attached server's agent needs that environment and command access to the Pipa host. Older running versions need one manual stop/start after upgrading.
|
|
314
266
|
|
|
315
267
|
## Commands
|
|
316
268
|
|
|
@@ -318,8 +270,8 @@ Commands must use the same `PIPA_HOME` (the parent of `.pipa`) as the running pr
|
|
|
318
270
|
pipa init Configure Slack and the local working directory
|
|
319
271
|
pipa start Start the configured Slack runtime
|
|
320
272
|
pipa stop Stop the running local Pipa process
|
|
321
|
-
pipa restart [--channel <id> [--thread <ts>]] Request a
|
|
322
|
-
pipa restart --status
|
|
273
|
+
pipa restart [--channel <id> [--thread <ts>]] Request a restart
|
|
274
|
+
pipa restart --status Check the latest restart
|
|
323
275
|
pipa routine Create and manage local scheduled routines
|
|
324
276
|
pipa manifest Print the current local Slack manifest template for an existing profile
|
|
325
277
|
pipa --version Print the installed version
|
|
@@ -333,13 +285,7 @@ npm test
|
|
|
333
285
|
npm run test:pack
|
|
334
286
|
```
|
|
335
287
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
See the [testing strategy](docs/pipa-testing.md) for repeatable real-runtime and Slack validation, existing-app reuse, evidence, and cleanup.
|
|
339
|
-
|
|
340
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md) before opening a pull request.
|
|
341
|
-
|
|
342
|
-
See the [repository overview](docs/repository-overview.md) for a file-by-file explanation of how Pipa works.
|
|
288
|
+
Read [CONTRIBUTING.md](CONTRIBUTING.md) before opening a PR. The [testing guide](docs/pipa-testing.md) covers real OpenCode and Slack checks, isolated test profiles, and cleanup. The [repository overview](docs/repository-overview.md) explains the code.
|
|
343
289
|
|
|
344
290
|
## Releases
|
|
345
291
|
|
package/bin/pipa.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import crossSpawn from "cross-spawn";
|
|
4
4
|
import { constants } from "node:fs";
|
|
5
|
-
import {
|
|
5
|
+
import { open, readFile, realpath, stat } from "node:fs/promises";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import os from "node:os";
|
|
@@ -214,18 +214,13 @@ async function readPromptFile(file, workingDirectory) {
|
|
|
214
214
|
const maxBytes = 1024 * 1024;
|
|
215
215
|
const root = await realpath(workingDirectory);
|
|
216
216
|
const requested = path.resolve(root, file);
|
|
217
|
-
const
|
|
218
|
-
if (!isInside(root, beforeOpen)) cliError("--prompt-file must be inside the configured working directory");
|
|
219
|
-
const initial = await lstat(requested, { bigint: true });
|
|
220
|
-
if (initial.isSymbolicLink()) cliError("--prompt-file cannot be a symbolic link");
|
|
217
|
+
const initial = await stat(requested, { bigint: true });
|
|
221
218
|
if (!initial.isFile()) cliError("--prompt-file must be a regular file");
|
|
222
|
-
const handle = await open(requested, constants.O_RDONLY | (constants.
|
|
219
|
+
const handle = await open(requested, constants.O_RDONLY | (constants.O_NONBLOCK ?? 0));
|
|
223
220
|
try {
|
|
224
221
|
const opened = await handle.stat({ bigint: true });
|
|
225
|
-
const
|
|
226
|
-
if (!
|
|
227
|
-
const current = await lstat(requested, { bigint: true });
|
|
228
|
-
if (!opened.isFile() || current.isSymbolicLink()
|
|
222
|
+
const current = await stat(requested, { bigint: true });
|
|
223
|
+
if (!opened.isFile()
|
|
229
224
|
|| initial.dev !== opened.dev || initial.ino !== opened.ino
|
|
230
225
|
|| current.dev !== opened.dev || current.ino !== opened.ino) cliError("--prompt-file must be an unchanged regular file");
|
|
231
226
|
if (opened.size > BigInt(maxBytes)) cliError("--prompt-file must be no larger than 1 MB");
|
|
@@ -247,11 +242,6 @@ async function readPromptFile(file, workingDirectory) {
|
|
|
247
242
|
}
|
|
248
243
|
}
|
|
249
244
|
|
|
250
|
-
function isInside(root, candidate) {
|
|
251
|
-
const relative = path.relative(root, candidate);
|
|
252
|
-
return relative === "" || (relative !== ".." && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative));
|
|
253
|
-
}
|
|
254
|
-
|
|
255
245
|
function scheduleFromOptions(values, now) {
|
|
256
246
|
if (values.at !== undefined) {
|
|
257
247
|
rejectRecurringOptions(values);
|