@sgtbeatdown/pi-tasks 0.1.0 → 0.1.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.
- package/README.md +69 -447
- package/package.json +9 -4
- package/skills/task-context-summary/SKILL.md +34 -0
- package/skills/wolfpack-pi-task-delegation/SKILL.md +34 -56
- package/src/extension.ts +217 -259
- package/src/gateway-client.ts +409 -0
- package/src/in-memory-task-relay.ts +114 -0
- package/src/index.ts +35 -0
- package/src/legacy-extension.ts +248 -0
- package/src/legacy-task-inbox.ts +148 -0
- package/src/metrics-cli.ts +20 -0
- package/src/metrics.ts +288 -0
- package/src/sqlite-database.ts +68 -0
- package/src/task-artifacts.ts +153 -0
- package/src/task-board.ts +365 -0
- package/src/task-core.ts +383 -0
- package/src/task-inbox.ts +109 -0
- package/src/task-protocol.ts +129 -0
- package/src/task-relay-conformance.ts +23 -0
- package/src/task-store.ts +238 -0
- package/src/v1-compat-extension.ts +1 -0
- package/src/wolfpack-task-relay.ts +319 -0
- package/src/auto-notify.ts +0 -24
- package/src/protocol.ts +0 -73
- package/src/store.ts +0 -494
- package/src/stores/filesystem.ts +0 -40
- package/src/task-communication.ts +0 -68
- package/src/transports/wolfpack.ts +0 -29
- package/src/types.ts +0 -114
|
@@ -1,75 +1,53 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wolfpack-pi-task-delegation
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use when opening, selecting, delegating to, checking, or cleaning up a Wolfpack Pi subagent through the gateway-backed agent task tools.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# wolfpack pi task delegation
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
skill/instructions for opening, selecting, inspecting, or controlling Wolfpack
|
|
10
|
-
sessions.
|
|
8
|
+
use `wolfpack-tailnet-control` for session control. this skill covers gateway task lifecycle, curated context, and parent verification. Pi is one conforming adapter. Wolfpack's [harness-neutral task adapter contract](https://github.com/almogdepaz/wolfpack/blob/main/docs/task-adapter-contract.md) is the canonical adapter reference; its [task gateway guide](https://github.com/almogdepaz/wolfpack/blob/main/docs/task-gateway.md) covers routes, trust, retention, and federation.
|
|
11
9
|
|
|
12
|
-
##
|
|
10
|
+
## gateway requirements and addressing
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
- every participating Pi process needs this package and a reachable local Wolfpack v1 gateway.
|
|
13
|
+
- `WOLFPACK_SESSION_NAME` is the caller selector; the local gateway resolves it to a stable broker ID. `WOLFPACK_PORT` selects the local port and defaults to `18790`.
|
|
14
|
+
- address a target as `to: { machine, sessionId }`, retaining the stable broker `sessionId` from structured Wolfpack session control rather than a terminal label.
|
|
15
|
+
- use `machine: "local"` for same-machine work. For remote work, use only the receiver's canonical HTTPS Tailnet origin, such as `https://worker.example.ts.net`; never a terminal name, arbitrary URL, path, query, fragment, credentials, or unexpected port.
|
|
16
|
+
- v1 trusts local processes and trusted Tailnet machines. Pi calls only its local gateway; gateways use direct fetch federation. JWT federation is unsupported, so do not promise remote delivery where Wolfpack global JWT requires credentials.
|
|
18
17
|
|
|
19
|
-
##
|
|
18
|
+
## phase roles and handoffs
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
existing Wolfpack control workflow (`wolfpack-tailnet-control`) to create the
|
|
23
|
-
session. Prefer the canonical CLI path:
|
|
20
|
+
For a multi-step project phase, retain one persistent implementer and one persistent read-only reviewer. Reuse a healthy role session for corrections and follow-up review; a completed task is an assignment result, not a reason to replace its session. Do not rotate a healthy role session for routine corrections. Rotate only for explicit phase completion, material context saturation, harness failure, or a required independent specialist. Keep at most one active assignment per role unless the user explicitly asks for parallel work.
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
wolfpack agent spawn <project> --prompt 'you are a task worker. wait for structured pi.task.assignment.v1 assignments; finish assigned work only with agent_task_done.' --json
|
|
27
|
-
```
|
|
22
|
+
Persistence is a parent decision, not a default. After every verified and acknowledged terminal task, the parent must explicitly choose whether to retain or close a session it spawned. Retain it only when the parent expects concrete follow-up work; close it when the parent does not expect to use it again. Do not leave the cleanup decision implicit.
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
use it only when that is the available command in the environment.
|
|
24
|
+
Use gateway task tools for assignments, questions, decisions, completion, and acknowledgment. terminal `send` is only for explicit human steering; it is not task state, a completion channel, or a substitute for `agent_task_message`.
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
handle/name/id. Treat it as opaque. Do not infer the target from browser UI
|
|
34
|
-
labels, terminal prose, or pane previews.
|
|
26
|
+
## workflow
|
|
35
27
|
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
1. create or select an existing Pi session with canonical Wolfpack session control. Reuse the phase role session when it is healthy. For a disposable worker, omit `--prompt`: `wolfpack agent spawn <project> --name <task-role> --json`. Put all worker instructions in `agent_task_send.task` so the fresh Pi process can reach idle before assignment. Do not start a disposable worker with a blocking “wait for assignments” model prompt. Read the structured spawn response and retain the stable broker `sessionId`. Before remote dispatch, complete Wolfpack's [Live-peer readiness checklist](https://github.com/almogdepaz/wolfpack/blob/main/docs/task-gateway.md#live-peer-readiness-checklist), including operator-recorded package/reload evidence; if it cannot pass, stop before task creation and report fixture-only verification.
|
|
29
|
+
2. send concise opaque task instructions with `agent_task_send`. Use `context.summary` only for constraints, decisions, and recovery state, and deliberately select `context.refs` with `path`, optional `selector`, and `purpose`; refs are metadata, not copied files or transcript. Use `task-context-summary` only for recovery/reuse.
|
|
30
|
+
3. include `role`, `metadata`, enforceable `preflight.requiredProject`, bounded timeout, idempotency key, and `onCompletePrompt` only when they apply. Timeout is 1000ms through 24h; default is 30 minutes. Task/context limits are 16 KiB each, assignment envelope 48 KiB, and request body 64 KiB.
|
|
31
|
+
4. after durable receipt, keep working. Do not call `agent_task_wait` unless the user explicitly asks to block. Use `agent_task_status` or `agent_task_inbox` for structured follow-up.
|
|
32
|
+
5. use `agent_task_message` for durable `question`, `answer`, or `information` flow. One question may be unresolved globally; answers link to it. A receiver question accepted by the sender ends the receiver turn; a parent question does not end the parent turn.
|
|
33
|
+
6. assignees call `agent_task_done` exactly once as their final action with `completed`, `failed`, or `cancelled`, concise summary, and optional structured result/error/artifact metadata. Report source modifications in `result.changedFiles`; artifacts are receiver-project-relative regular files for a parent to inspect, not changed-file lists: `{ "result": { "changedFiles": ["src/extension.ts"] }, "artifacts": [{ "path": "verification/task-2.md" }] }`. Follow the canonical Wolfpack artifact contract for provenance, containment, and warning behavior. No prose completion afterward.
|
|
34
|
+
7. parent independently verifies files, diff, tests, and artifacts before reporting success. Then use `agent_task_ack({ taskId })` for that one verified terminal task; remote acknowledgment is two-phase and failed propagation leaves the task visible for explicit repair. After acknowledgment, explicitly decide whether the spawned session has a likely next assignment. Retain it while review, correction, or another concrete assignment is expected; otherwise close it through canonical Wolfpack session control. Cleanup applies only to sessions this parent spawned and only after result verification and acknowledgment.
|
|
38
35
|
|
|
39
|
-
|
|
40
|
-
to wait. Continue local work if there is other useful work to do.
|
|
36
|
+
## delivery and recovery
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
- `agent_task_status` for one task
|
|
44
|
-
- `agent_task_wait` only when the user wants the result now
|
|
45
|
-
- `agent_task_inbox` to check completed delegated work
|
|
46
|
-
- `agent_task_cancel` to cancel non-terminal tasks
|
|
38
|
+
`agent_task_send` returns after durable receiver-gateway acceptance, not adapter insertion or model execution; delivery remains pending until `task.delivered`. A remote initial send gets one initial attempt. The receiver stores a provisional receipt, and Pi sees the assignment only after sender receipt confirmation. Later peer events get four total attempts: initial plus retries around 1, 2, and 4 seconds with jitter. Retry exhaustion is a surfaced local delivery failure; v1 has no gateway queue, scheduler, or offline dispatch.
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
`agent_task_done`, do not send extra prose; the tool result is the completion
|
|
50
|
-
channel.
|
|
40
|
+
The sender gateway owns canonical order, expiry, and terminal choice; the first accepted terminal event wins. Sender timeout causes best-effort remote cancellation. The local extension polls every five seconds. With no pending message, it submits visible events through Pi's safe `deliverAs: "followUp"` queue: idle sessions start immediately, active turns finish first, and task delivery never steers or interrupts them. It stores `{ taskId, eventId }` in structured custom messages, replays missing events after restart, and records delivery only after structural insertion. Do not call that exactly-once execution.
|
|
51
41
|
|
|
52
|
-
|
|
42
|
+
Isolated coverage is the deterministic acceptance gate, but a specific live peer still requires current readiness at the time of use. Do not claim that a particular remote deployment is reachable without the checklist evidence.
|
|
53
43
|
|
|
54
|
-
|
|
55
|
-
- Do not ask the target to report completion in prose.
|
|
56
|
-
- Do not use `wolfpack session wait` for task completion; it waits for literal
|
|
57
|
-
terminal text and is the wrong protocol for this package.
|
|
58
|
-
- Do not duplicate Wolfpack session-control rules here. If session control is
|
|
59
|
-
ambiguous, consult/use `wolfpack-tailnet-control`.
|
|
44
|
+
## do not
|
|
60
45
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
3. Tell the user the task id and that you’ll check structured results later.
|
|
70
|
-
|
|
71
|
-
User: “check on the subagent”
|
|
72
|
-
|
|
73
|
-
Expected approach:
|
|
74
|
-
- Use `agent_task_inbox` or `agent_task_status`; do not read terminal prose to
|
|
75
|
-
infer done-ness.
|
|
46
|
+
- do not use terminal output as task state or completion evidence.
|
|
47
|
+
- do not ask workers to complete in prose.
|
|
48
|
+
- do not steer or interrupt an active Pi turn with task context; use the adapter's follow-up queue.
|
|
49
|
+
- Do not copy plans, source contents, or transcripts into task context.
|
|
50
|
+
- do not use filesystem task storage or retain old `mustReturn`, `rejected`, or semantic completion contracts.
|
|
51
|
+
- do not promise JWT federation, artifact byte transfer, or background retry/offline dispatch.
|
|
52
|
+
- do not make workers close their own sessions.
|
|
53
|
+
- do not leave a parent-spawned session open after acknowledgment when the parent does not expect further work from it.
|