@aliou/pi-processes 0.11.1 → 0.11.2

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.
@@ -12,7 +12,12 @@ export interface ProcessNotificationSendOptions {
12
12
  deliverAs: "steer" | "followUp" | "nextTurn";
13
13
  }
14
14
 
15
- /** Maps a notification attention level to Pi send-message options. */
15
+ /**
16
+ * Maps a notification attention level to Pi send-message options.
17
+ *
18
+ * `turn` wakes or steers the agent. Other emitted notifications wait for the
19
+ * next user prompt so they cannot split a tool call from its result.
20
+ */
16
21
  export function attentionToSendOptions(
17
22
  attention: Attention,
18
23
  ): ProcessNotificationSendOptions {
@@ -20,9 +25,9 @@ export function attentionToSendOptions(
20
25
  case "turn":
21
26
  return { triggerTurn: true, deliverAs: "steer" };
22
27
  case "context":
23
- return { triggerTurn: false, deliverAs: "steer" };
28
+ return { triggerTurn: false, deliverAs: "nextTurn" };
24
29
  case "ignore":
25
- return { triggerTurn: false, deliverAs: "steer" };
30
+ return { triggerTurn: false, deliverAs: "nextTurn" };
26
31
  }
27
32
  }
28
33
 
@@ -56,7 +56,7 @@ export function registerProcessTool(
56
56
  promptGuidelines: [
57
57
  "process tool: use process start for long-running commands (dev servers, watchers, builds) instead of shell background patterns like &, nohup, or setsid; give each process a specific name and check process list first when a duplicate would be noisy.",
58
58
  "process tool: after process start, do not sleep, poll, or hold your turn. End your turn or move on. Exits and notify.logMatches matches bring you back.",
59
- "process tool: attention turn wakes you when idle; context only reaches you if you are still working; ignore never notifies. Keep turn for anything whose result you need.",
59
+ "process tool: attention turn wakes or steers you now; context waits for the next user prompt. Ignore suppresses successful exits and external kills but retains log matches as context. Failures always notify, with ignore downgraded to context. Keep turn for anything whose result you need immediately.",
60
60
  "process tool: use notify.logMatches to get brought back on readiness or error signals instead of polling process output. If a watch is too noisy, use process update (watches.mode append/replace/remove/clear) to fix it without restarting.",
61
61
  "process tool: for the full lifecycle (start, list, output, update, write, stop, clear), notify options, use cases, and noisy-watch handling, read the pi-processes skill.",
62
62
  ],
@@ -6,12 +6,10 @@ import type { LogMatcherConfig, NotifyConfig } from "../notifications/registry";
6
6
  import type { NotifyLogMatchParamsType, NotifyParamsType } from "./schema";
7
7
 
8
8
  const DEFAULT_NOTIFY_CONFIG = {
9
- // A backgrounded process usually outlives the turn that started it, and
10
- // "context" only reaches the agent if it happens to still be streaming when
11
- // the process ends. Builds, tests, and other one-shot commands are started
12
- // precisely because the agent needs the result, so success defaults to a
13
- // turn. Long-running servers rarely exit 0, and callers that do not want the
14
- // interruption can pass onSuccess: "context".
9
+ // Builds, tests, and other one-shot commands are started because the agent
10
+ // needs the result, so success defaults to a turn. Long-running servers
11
+ // rarely exit 0, and callers that only need the result as future context can
12
+ // pass onSuccess: "context".
15
13
  onSuccess: "turn",
16
14
  onFailure: "turn",
17
15
  // External kills (outside this manager) surface as context by default so
@@ -142,7 +142,7 @@ const NotifyProperties = {
142
142
 
143
143
  export const NotifyParams = Type.Object(NotifyProperties, {
144
144
  description:
145
- "Notify settings. Attention: turn wakes an idle agent, context only reaches an agent still working, ignore never notifies.",
145
+ "Notify settings. Attention: turn wakes or steers the agent; context waits for the next user prompt; ignore suppresses successful exits and external kills but retains log matches as context. Failures always notify, with ignore downgraded to context.",
146
146
  });
147
147
 
148
148
  export const ProcessesParams = Type.Object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-processes",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -16,10 +16,9 @@ A started process runs in the background and the manager brings you back when so
16
16
  3. The process notifies you when:
17
17
  - a `logMatches` pattern hits (readiness, error, progress),
18
18
  - the process exits successfully (`onSuccess`, default `turn`),
19
- - the process fails or crashes (`onFailure`, default `turn`),
20
- - the process is killed externally (`onKilled`, default `context`, which does not wake an idle agent).
21
-
22
- Stopping a process yourself never notifies.
19
+ - the process fails or crashes (`onFailure`, default `turn`; failures always notify),
20
+ - the process is killed externally (`onKilled`, default `context`),
21
+ - you stop the process intentionally (always `context`; notify config does not apply).
23
22
  4. When a watch is too noisy or wrong, fix it with `process update` — do not restart the process just to change watches.
24
23
  5. `process stop` obsolete live processes and `process clear` finished entries when they are no longer useful.
25
24
 
@@ -52,7 +51,7 @@ Good:
52
51
  }
53
52
  ```
54
53
 
55
- `onSuccess: "context"` here because a dev server exiting cleanly needs no reaction. Keep the default `turn` for builds, tests, and other one-shot commands whose result you need.
54
+ `onSuccess: "context"` here because a dev server exiting cleanly needs no immediate reaction; the result becomes context on the next user prompt. Keep the default `turn` for builds, tests, and other one-shot commands whose result you need immediately.
56
55
 
57
56
  Optional `cwd` sets the working directory for the spawned command. Omit it to inherit the agent's current working directory.
58
57
 
@@ -219,8 +218,8 @@ Good:
219
218
  Exit attention:
220
219
 
221
220
  - `notify.onSuccess` — clean exit. Defaults to `turn`.
222
- - `notify.onFailure` — failure or crash. Defaults to `turn`.
223
- - `notify.onKilled` — killed from outside the tool. Defaults to `context`. Stopping a process yourself never notifies.
221
+ - `notify.onFailure` — failure or crash. Defaults to `turn`; `ignore` is downgraded to `context` because failures always notify.
222
+ - `notify.onKilled` — killed from outside the tool. Defaults to `context`. Intentional stops always produce context and bypass this setting.
224
223
 
225
224
  Log match watches (`notify.logMatches`, up to 20, each pattern up to 500 chars):
226
225
 
@@ -232,11 +231,11 @@ Log match watches (`notify.logMatches`, up to 20, each pattern up to 500 chars):
232
231
 
233
232
  Attention levels:
234
233
 
235
- - `turn` — starts an agent turn. Reaches you even when you are idle.
236
- - `context` — recorded in the transcript, no turn. It reaches you only if you are still working when the event fires; an idle agent is not woken and sees it on the next user message.
237
- - `ignore` — recorded, never notifies.
234
+ - `turn` — wakes an idle agent or steers an active run at the next safe boundary.
235
+ - `context` — queued for the next user prompt; it does not wake or steer the agent.
236
+ - `ignore` — suppresses successful-exit and external-kill notifications. Log matches are retained for the next user prompt. Failure and crash notifications are also retained because failures always notify.
238
237
 
239
- Use `context` only when nothing needs to happen in response.
238
+ Use `context` when nothing needs to happen immediately.
240
239
 
241
240
  ## Use cases
242
241
 
@@ -368,7 +367,7 @@ Then pick a `watches.mode`:
368
367
  }
369
368
  ```
370
369
 
371
- - **Silence without removing** — set the watch's `on` to `ignore` so matches are recorded but do not interrupt.
370
+ - **Retain without interrupting** — set the watch's `on` to `ignore` so matches become context on the next user prompt.
372
371
 
373
372
  ```json
374
373
  {