@selesai/code 0.8.4 → 0.8.6
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/CHANGELOG.md +22 -0
- package/README.md +7 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/defaults/models.json +46 -55
- package/dist/defaults/settings.json +7 -8
- package/dist/extensions/agent-browser.test.ts +178 -2
- package/dist/extensions/agent-browser.ts +2 -0
- package/dist/extensions/copy-turn.test.ts +229 -0
- package/dist/extensions/copy-turn.ts +11 -0
- package/dist/extensions/grep-app/index.test.ts +356 -1
- package/dist/extensions/grep-app/index.ts +6 -1
- package/dist/extensions/handoff-new.test.ts +351 -161
- package/dist/extensions/handoff-new.ts +3 -0
- package/dist/extensions/inline-skills.test.ts +93 -0
- package/dist/extensions/inline-skills.ts +3 -0
- package/dist/extensions/pi-subagents/CHANGELOG.md +26 -3
- package/dist/extensions/pi-subagents/README.md +2 -0
- package/dist/extensions/pi-subagents/agents/builder.md +5 -2
- package/dist/extensions/pi-subagents/agents/commentator.md +1 -1
- package/dist/extensions/pi-subagents/docs/configuration.md +54 -2
- package/dist/extensions/pi-subagents/docs/observability.md +1 -1
- package/dist/extensions/pi-subagents/docs/tool-reference.md +1 -1
- package/dist/extensions/pi-subagents/docs/workflows.md +1 -1
- package/dist/extensions/pi-subagents/package-lock.json +2 -2
- package/dist/extensions/pi-subagents/package.json +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +1 -1
- package/dist/extensions/pi-subagents/src/agents/agents.ts +9 -3
- package/dist/extensions/pi-subagents/src/extension/config.ts +12 -0
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +40 -0
- package/dist/extensions/pi-subagents/src/extension/index.ts +104 -14
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +5 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +3 -9
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +2 -2
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +4 -1
- package/dist/extensions/pi-subagents/src/missions/lifecycle.ts +4 -7
- package/dist/extensions/pi-subagents/src/missions/store.ts +4 -4
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +6 -2
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +374 -0
- package/dist/extensions/pi-subagents/src/runs/background/active-run-index.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +117 -29
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +12 -6
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +7 -1
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +14 -5
- package/dist/extensions/pi-subagents/src/runs/background/chain-append.ts +33 -15
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +5 -2
- package/dist/extensions/pi-subagents/src/runs/background/owned-process-tree.ts +104 -0
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +17 -3
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +19 -1
- package/dist/extensions/pi-subagents/src/runs/background/retained-children.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +5 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +12 -6
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +84 -36
- package/dist/extensions/pi-subagents/src/runs/background/wait-subscriptions.ts +2 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +37 -2
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +135 -22
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +12 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +7 -4
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +171 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +653 -196
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +13 -4
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +286 -0
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +23 -0
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +44 -1
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +280 -0
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +4 -2
- package/dist/extensions/pi-subagents/src/runs/shared/task-intent.ts +19 -3
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +17 -5
- package/dist/extensions/pi-subagents/src/shared/session-lineage.ts +71 -0
- package/dist/extensions/pi-subagents/src/shared/types.ts +108 -0
- package/dist/extensions/pi-subagents/src/shared/utils.ts +3 -1
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +7 -5
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +226 -13
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +22 -5
- package/dist/extensions/pi-subagents/src/workflows/workflow-auto-relaunch.ts +28 -0
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +87 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +96 -6
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +28 -5
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +8 -5
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +83 -2
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +211 -15
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +41 -3
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +314 -10
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +31 -1
- package/dist/extensions/pi-subagents/test/unit/active-async-capacity.test.ts +317 -0
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +21 -2
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +16 -1
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +6 -1
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +75 -4
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +18 -0
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +29 -1
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +31 -5
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +139 -1
- package/dist/extensions/pi-subagents/test/unit/foreground-control.test.ts +10 -0
- package/dist/extensions/pi-subagents/test/unit/handoff-adoption.test.ts +103 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +22 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +2 -1
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +171 -0
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +30 -4
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +14 -0
- package/dist/extensions/pi-subagents/test/unit/owned-process-tree.test.ts +69 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +83 -0
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/process-terminal.test.ts +55 -2
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +12 -1
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +7 -7
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +121 -0
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +9 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +4 -3
- package/dist/extensions/pi-subagents/test/unit/session-lineage.test.ts +73 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +28 -0
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/task-intent.test.ts +39 -0
- package/dist/extensions/pi-subagents/test/unit/timeout-defaults.test.ts +65 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-auto-relaunch.test.ts +45 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +61 -0
- package/dist/extensions/ponytail/index.js +11 -0
- package/dist/extensions/ponytail/ponytail-config.cjs +2 -0
- package/dist/extensions/ponytail/ponytail-instructions.cjs +6 -0
- package/dist/extensions/ponytail/test/extension.test.js +274 -140
- package/dist/extensions/ponytail/test/helpers.test.js +280 -92
- package/dist/extensions/question/index.ts +18 -0
- package/dist/extensions/question/question-list.ts +22 -0
- package/dist/extensions/question/tests/batch.test.ts +103 -65
- package/dist/extensions/question/tests/helpers.test.ts +68 -35
- package/dist/extensions/question/tests/question-list.test.ts +506 -204
- package/dist/extensions/question/tests/row-layout.test.ts +180 -114
- package/dist/extensions/question/tests/schemas.test.ts +42 -19
- package/dist/extensions/question/tests/shortcuts.test.ts +106 -84
- package/dist/extensions/question/tests/wizard.test.ts +771 -50
- package/dist/extensions/rtk.test.ts +180 -1
- package/dist/extensions/tokenin-onboarding.ts +3 -0
- package/dist/extensions/undo.test.ts +720 -0
- package/dist/extensions/undo.ts +6 -0
- package/dist/extensions/web-agent-onboarding.test.ts +415 -0
- package/dist/extensions/workflow/extension.ts +3 -3
- package/dist/extensions/workflow/modes.ts +41 -19
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.js +48 -1
- package/dist/skills/pi-subagents/references/execution-controls.md +1 -1
- package/docs/plans/workflow-autoloop-reference.md +1 -2
- package/docs/plans/workflow-handoff-carryover.md +108 -0
- package/docs/quickstart.md +27 -43
- package/docs/settings.md +4 -0
- package/docs/usage.md +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Plan: Carry workflows over compaction & auto-handoff
|
|
2
|
+
|
|
3
|
+
Status: implemented (P0 + P1). The first workflow attempt timed out in `build-1` with zero changes; the parent session then implemented the plan directly. All changes are in `src/extensions/pi-subagents`; no core changes. Feasibility held at ~90%.
|
|
4
|
+
|
|
5
|
+
## 1. Problem
|
|
6
|
+
|
|
7
|
+
Running a scripted workflow (`/workflow-*` → `launchSlashSubagent({ workflowScript, async: true })` → pi-subagents async run) and then triggering **compaction** or **auto-handoff** (`handoff-new` via `_checkAutoHandoff`) makes the workflow "disappear":
|
|
8
|
+
|
|
9
|
+
- After **auto-handoff** the new session shows no widget/fleet jobs, receives no completion results, cannot resume/steer the workflow, and the handoff document itself omits tool-call details — so the fresh agent doesn't even know a workflow exists.
|
|
10
|
+
- After **compaction** the parent agent loses the workflow manifest (run ids, keys, phases) from its context; the only countermeasure is a generic "resume the parent task" nudge.
|
|
11
|
+
|
|
12
|
+
## 2. Root cause (trace)
|
|
13
|
+
|
|
14
|
+
1. Workflow runs are **detached child processes** with state on disk under a global tmp root (`DIRS.async` / `DIRS.results`, `src/extensions/pi-subagents/src/shared/types.ts:2030`). The workflow script itself (worker thread + `runs.run` children + mission-backed `state.get/set`) lives in that spawned run — it keeps running after the parent session is replaced. Nothing about the workflow actually dies.
|
|
15
|
+
2. Auto-handoff replaces the session: `ctx.newSession()` (`src/extensions/handoff-new.ts:146`) → `AgentSessionRuntime.newSession` (`src/core/agent-session-runtime.ts:226`) → `teardownCurrent` + fresh `createRuntime` → **fresh extension instances**. The new pi-subagents instance restores state only for its own session identity.
|
|
16
|
+
3. The identity key is the **session file path** (`resolveCurrentSessionId`, `src/extensions/pi-subagents/src/shared/session-identity.ts` → `getSessionFile() ?? getSessionId()`). Every restore path filters by it and misses the old session's runs:
|
|
17
|
+
|
|
18
|
+
| Component | Filter that drops the old session | File |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Async job tracker | `restoreActiveJobs` → `listAsyncRuns(..., sessionId: state.currentSessionId)` | `runs/background/async-job-tracker.ts:648` |
|
|
21
|
+
| Result delivery | `ownsSession(sessionId, epoch)` / `identity.sessionId === state.currentSessionId` | `runs/background/result-watcher.ts:168, 211` |
|
|
22
|
+
| Foreground history | `run.sessionId === sessionId` | `runs/foreground/foreground-history.ts:124` |
|
|
23
|
+
| Retained children (`children.list`) | `listRetainedChildren(DIRS.async, ownerSessionId)` | `runs/background/retained-children.ts` |
|
|
24
|
+
| Wait subscriptions | `record.sessionId === state.currentSessionId` | `runs/background/wait-subscriptions.ts:~245` |
|
|
25
|
+
| Async capacity | `getActiveAsyncCapacitySnapshot(state.currentSessionId, ...)` | `extension/index.ts:757` |
|
|
26
|
+
| Mission goal notices | `ownerSessionId = state.currentSessionId` | `extension/index.ts:~634` |
|
|
27
|
+
|
|
28
|
+
4. `session_shutdown` (`extension/index.ts:~843`) clears in-memory jobs, stops the result watcher, and disposes watchers — by design, but nothing re-links the old session's estate.
|
|
29
|
+
5. The new session's header records the parent: `parentSession` in `SessionHeader` (`src/core/session-manager.ts:942`), and `SessionStartEvent` carries `previousSessionFile` for reason `"new"`/`"fork"` (`src/core/extensions/types.ts:562`). The extension never uses either.
|
|
30
|
+
6. Compaction: tool results are summarized away (`compaction.ts` / `branch-summarization.ts` skip tool-result bodies). The `session_compact` handler injects a resume message only when active async jobs exist, with **generic** text (`extension/index.ts:810`) — run ids/keys/phases are lost from the model's context.
|
|
31
|
+
|
|
32
|
+
## 3. Fix design — session lineage adoption
|
|
33
|
+
|
|
34
|
+
> Implemented. Files changed: `shared/session-lineage.ts` (new), `shared/types.ts`, `runs/background/async-status.ts`, `runs/background/async-job-tracker.ts`, `runs/background/result-watcher.ts`, `runs/background/notify.ts`, `runs/background/run-status.ts`, `runs/background/run-id-resolver.ts`, `runs/background/retained-children.ts`, `runs/background/wait-subscriptions.ts`, `runs/foreground/foreground-history.ts`, `runs/foreground/subagent-executor.ts`, `tui/fleet.ts`, `extension/index.ts`. Tests: `test/unit/session-lineage.test.ts` (new), `test/unit/handoff-adoption.test.ts` (new), existing `compaction-resume.test.ts` unchanged and passing. One extra find beyond the plan: the completion notifier (`notify.ts`) rejected non-current-session results, so it also needed lineage awareness for adopted result delivery.
|
|
35
|
+
|
|
36
|
+
One concept fixes the handoff half: **on `session_start` with `previousSessionFile`, adopt the previous session's workflow estate** instead of filtering on the current session id alone. Everything is keyed by stable session-file paths and the chain is recoverable via `SessionManager.getHeader().parentSession` (`session-manager.ts:1291`), so adoption is additive and needs **zero core changes**.
|
|
37
|
+
|
|
38
|
+
### 3.1 New helper — `shared/session-lineage.ts`
|
|
39
|
+
|
|
40
|
+
- `resolveSessionLineage(ctx, { depth = 8 })`: `[currentSessionId, ...walk(getHeader().parentSession)]`, depth-bounded, deduped, skipping paths that don't exist (`existsSync` guard, same as `retainedSessionFile` in `retained-children.ts`).
|
|
41
|
+
- Stored as `state.sessionLineage: string[]` in `resetSessionState` (`extension/index.ts:~766`).
|
|
42
|
+
- `listAsyncRuns` gains a `sessionIds: string[]` filter (`async-status.ts`) so all callers share one primitive.
|
|
43
|
+
|
|
44
|
+
### 3.2 Adopt the estate (P0)
|
|
45
|
+
|
|
46
|
+
| # | Change | Location |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| 1 | `restoreActiveJobs`: list `queued|running` runs for `sessionIds: state.sessionLineage`; mark adopted jobs (`adopted: true`) so completion notices can say "started in a previous session". | `async-job-tracker.ts:648` |
|
|
49
|
+
| 2 | Result watcher: treat lineage as owned (`ownsSession` + identity checks accept lineage set); dedupe: at adoption only prime results whose `runId` ∈ adopted set or `completedAt` ≥ session-start epoch — never replay ancient results. | `result-watcher.ts:168–262` |
|
|
50
|
+
| 3 | Foreground history, retained children, wait subscriptions: restore/union over lineage. | `foreground-history.ts:124`, `retained-children.ts`, `wait-subscriptions.ts:~245` |
|
|
51
|
+
| 4 | Async capacity: snapshot over lineage so adopted runs count against `maxActiveAsyncRunsPerSession`. | `active-async-capacity.ts` caller at `extension/index.ts:757` |
|
|
52
|
+
| 5 | Mission goal notices: collect for each lineage owner on `session_start` (reasons `new`/`fork`) in addition to the existing `agent_end` path. Missions themselves already persist per-project (`missions/store.ts`) and `mission.list` works. | `extension/index.ts:~634`, `missions/goal-driver.ts:118` |
|
|
53
|
+
| 6 | Schedules: already re-armed on the new session (`bindSession` → `selectProject` → `restoreOne` → `arm`); `scheduledRunManager.stop()` on shutdown is safe because of that re-arm. Lock in with a regression test. | `scheduled-runs.ts:376–381` |
|
|
54
|
+
|
|
55
|
+
### 3.3 Make the new agent aware (P0)
|
|
56
|
+
|
|
57
|
+
- On `session_start` (reason `new`/`fork`) with adopted active workflows, set `state.handoffResumePending`. On the first `agent_settled` after that (avoids racing the handoff doc's first turn), send one custom message — same pattern as `subagent-compaction-resume`:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
customType: "subagent-handoff-resume", display: false, triggerTurn: true
|
|
61
|
+
content: "Session handoff detected. N active background workflows carried over from the previous session:
|
|
62
|
+
- <id8> workflow[task] builder · step 3/5 · running (last: read)
|
|
63
|
+
- <id8> single explorer · running
|
|
64
|
+
Monitor with subagent status <id>, interrupt/resume/steer/approve-checkpoint by run id; children.list shows completed steps."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Built from `state.asyncJobs` (id, mode, `workflowKey`, agent, phase/currentStep, activity).
|
|
68
|
+
|
|
69
|
+
### 3.4 Enrich the compaction nudge (P1)
|
|
70
|
+
|
|
71
|
+
- Replace the generic `subagent-compaction-resume` text with the same workflow manifest (one line per active job). Keep the trigger conditions and custom type unchanged — test at `test/unit/compaction-resume.test.ts` covers the pattern.
|
|
72
|
+
|
|
73
|
+
### 3.5 Out of scope (documented, intentional)
|
|
74
|
+
|
|
75
|
+
- **Watchdog**: resets on `session_before_switch` by design (`watchdog/register-main.ts:431`). Keep.
|
|
76
|
+
- **Core changes**: none needed. If a third extension later needs cross-session state, revisit with a generic `session_replaced` state-bag API (rejected now — YAGNI).
|
|
77
|
+
- **Blocking handoff while workflows run**: rejected; long workflows would lock the session. Carry-over is the correct fix.
|
|
78
|
+
|
|
79
|
+
## 4. Tests
|
|
80
|
+
|
|
81
|
+
- unit: `resolveSessionLineage` (chain walk, depth bound, missing files, dedupe) — `test/unit/session-lineage.test.ts` ✔
|
|
82
|
+
- unit: `restoreActiveJobs` adopts lineage runs — covered by the adoption harness ✔
|
|
83
|
+
- unit: result watcher delivers lineage results; no replay of pre-adoption results (dedupe watermark) — harness asserts adopted result delivery + cleanup ✔
|
|
84
|
+
- unit: `session_start(reason:"new")` + first `agent_settled` injects `subagent-handoff-resume` when adopted workflows exist; nothing when none — `test/unit/handoff-adoption.test.ts` ✔ (repeated-settle no-op also asserted)
|
|
85
|
+
- unit: compaction resume message contains the workflow manifest — harness asserts run id in content ✔
|
|
86
|
+
- regression: full pi-subagents unit suite 1907 pass / 0 fail ✔
|
|
87
|
+
|
|
88
|
+
## 5. Risk register
|
|
89
|
+
|
|
90
|
+
| Risk | Mitigation |
|
|
91
|
+
|---|---|
|
|
92
|
+
| Result replay across the boundary (ancient results re-delivered) | Adopt-set + epoch watermark (3.2 #2) |
|
|
93
|
+
| Resume message races the handoff doc's first turn | Defer to first `agent_settled` (3.3) |
|
|
94
|
+
| Stale/deleted parent session files | `existsSync` guard + bounded walk (3.1) |
|
|
95
|
+
| Adopted runs exceeding capacity | Count lineage in capacity snapshot (3.2 #4); existing spawn budgets still enforce |
|
|
96
|
+
| Double-watch in the same process | Old instance fully disposed at `session_shutdown` before the new one starts; watchers are per-instance |
|
|
97
|
+
| Extra turn noise after handoff | One message, `display:false`, same precedent as compaction resume |
|
|
98
|
+
|
|
99
|
+
## 6. Effort & feasibility
|
|
100
|
+
|
|
101
|
+
- **Possibility: ~90%.** Everything the workflow needs already persists on disk keyed by stable session-file paths; the spawned workflow process survives the session switch; the new session already knows its parent (`parentSession` header + `previousSessionFile` event); all filters to widen live in one package; the message-injection pattern already exists. The change is additive filtering + one notification — no protocol, no core change, no data migration.
|
|
102
|
+
- **Size:** ~500–700 LOC + ~12–16 tests, all in `src/extensions/pi-subagents`.
|
|
103
|
+
- **Effort:** 2–3 focused dev-days.
|
|
104
|
+
- **Order:** P0 (3.1–3.3) → P1 (3.4) → tests/regression. Each P0 item is independently shippable.
|
|
105
|
+
|
|
106
|
+
## 7. Verification (manual)
|
|
107
|
+
|
|
108
|
+
Same as before — worth an interactive smoke test with `/workflow-task` + `/handoff-new` to see the widget adoption and the `subagent-handoff-resume` notice end-to-end. Automated coverage: `src/extensions/pi-subagents/test/unit/{session-lineage,handoff-adoption}.test.ts` + existing compaction-resume test.
|
package/docs/quickstart.md
CHANGED
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
# Quickstart
|
|
2
2
|
|
|
3
|
-
This page gets you from install to a useful first
|
|
3
|
+
This page gets you from install to a useful first Selesai session.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Selesai is distributed as an npm package:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install -g
|
|
10
|
+
npm install -g @selesai/code
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Uninstall
|
|
16
|
-
|
|
17
|
-
Use the package manager that installed pi. The curl installer uses npm globally, so curl and npm installs are removed with npm:
|
|
13
|
+
Then start Selesai in the project directory you want it to work on:
|
|
18
14
|
|
|
19
15
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# pnpm
|
|
24
|
-
pnpm remove -g @earendil-works/pi-coding-agent
|
|
25
|
-
|
|
26
|
-
# Yarn
|
|
27
|
-
yarn global remove @earendil-works/pi-coding-agent
|
|
28
|
-
|
|
29
|
-
# Bun
|
|
30
|
-
bun uninstall -g @earendil-works/pi-coding-agent
|
|
16
|
+
cd /path/to/project
|
|
17
|
+
selesai
|
|
31
18
|
```
|
|
32
19
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Then start pi in the project directory you want it to work on:
|
|
20
|
+
To install directly from the public repository (builds the latest `main` from source):
|
|
36
21
|
|
|
37
22
|
```bash
|
|
38
|
-
|
|
39
|
-
pi
|
|
23
|
+
npm install -g github:SelesaiInTech/selesai-code
|
|
40
24
|
```
|
|
41
25
|
|
|
42
26
|
## Authenticate
|
|
@@ -45,7 +29,7 @@ Pi can use subscription providers through `/login`, or API-key providers through
|
|
|
45
29
|
|
|
46
30
|
### Option 1: subscription login
|
|
47
31
|
|
|
48
|
-
Start
|
|
32
|
+
Start Selesai and run:
|
|
49
33
|
|
|
50
34
|
```text
|
|
51
35
|
/login
|
|
@@ -55,26 +39,26 @@ Then select a provider. Built-in subscription logins include Claude Pro/Max, Cha
|
|
|
55
39
|
|
|
56
40
|
### Option 2: API key
|
|
57
41
|
|
|
58
|
-
Set an API key before launching
|
|
42
|
+
Set an API key before launching Selesai:
|
|
59
43
|
|
|
60
44
|
```bash
|
|
61
45
|
export ANTHROPIC_API_KEY=sk-ant-...
|
|
62
|
-
|
|
46
|
+
selesai
|
|
63
47
|
```
|
|
64
48
|
|
|
65
|
-
You can also run `/login` and select an API-key provider to store the key in `~/.
|
|
49
|
+
You can also run `/login` and select an API-key provider to store the key in `~/.selesai/agent/auth.json`.
|
|
66
50
|
|
|
67
51
|
See [Providers](providers.md) for all supported providers, environment variables, and cloud-provider setup.
|
|
68
52
|
|
|
69
53
|
## First session
|
|
70
54
|
|
|
71
|
-
Once
|
|
55
|
+
Once Selesai starts, type a request and press Enter:
|
|
72
56
|
|
|
73
57
|
```text
|
|
74
58
|
Summarize this repository and tell me how to run its checks.
|
|
75
59
|
```
|
|
76
60
|
|
|
77
|
-
By default,
|
|
61
|
+
By default, Selesai gives the model four tools:
|
|
78
62
|
|
|
79
63
|
- `read` - read files
|
|
80
64
|
- `write` - create or overwrite files
|
|
@@ -83,7 +67,7 @@ By default, pi gives the model four tools:
|
|
|
83
67
|
|
|
84
68
|
Additional built-in read-only tools (`grep`, `find`, `ls`) are available through tool options. Pi runs in your current working directory and can modify files there. Use git or another checkpointing workflow if you want easy rollback.
|
|
85
69
|
|
|
86
|
-
## Give
|
|
70
|
+
## Give Selesai project instructions
|
|
87
71
|
|
|
88
72
|
Pi loads context files at startup. Add an `AGENTS.md` file to tell it how to work in a project:
|
|
89
73
|
|
|
@@ -97,10 +81,10 @@ Pi loads context files at startup. Add an `AGENTS.md` file to tell it how to wor
|
|
|
97
81
|
|
|
98
82
|
Pi loads:
|
|
99
83
|
|
|
100
|
-
- `~/.
|
|
84
|
+
- `~/.selesai/agent/AGENTS.md` for global instructions
|
|
101
85
|
- `AGENTS.md` or `CLAUDE.md` from parent directories and the current directory
|
|
102
86
|
|
|
103
|
-
Restart
|
|
87
|
+
Restart Selesai, or run `/reload`, after changing context files.
|
|
104
88
|
|
|
105
89
|
## Common things to try
|
|
106
90
|
|
|
@@ -109,8 +93,8 @@ Restart pi, or run `/reload`, after changing context files.
|
|
|
109
93
|
Type `@` in the editor to fuzzy-search files, or pass files on the command line:
|
|
110
94
|
|
|
111
95
|
```bash
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
selesai @README.md "Summarize this"
|
|
97
|
+
selesai @src/app.ts @src/app.test.ts "Review these together"
|
|
114
98
|
```
|
|
115
99
|
|
|
116
100
|
Images can be pasted with Ctrl+V (Alt+V on Windows) or dragged into supported terminals.
|
|
@@ -134,22 +118,22 @@ Use `/model` or Ctrl+L to choose a model. Use Shift+Tab to cycle thinking level.
|
|
|
134
118
|
Sessions are saved automatically:
|
|
135
119
|
|
|
136
120
|
```bash
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
121
|
+
selesai -c # Continue most recent session
|
|
122
|
+
selesai -r # Browse previous sessions
|
|
123
|
+
selesai --name "my task" # Set session display name at startup
|
|
124
|
+
selesai --session <path|id> # Open a specific session
|
|
141
125
|
```
|
|
142
126
|
|
|
143
|
-
Inside
|
|
127
|
+
Inside Selesai, use `/resume`, `/new`, `/tree`, `/fork`, and `/clone` to manage sessions.
|
|
144
128
|
|
|
145
129
|
### Non-interactive mode
|
|
146
130
|
|
|
147
131
|
For one-shot prompts:
|
|
148
132
|
|
|
149
133
|
```bash
|
|
150
|
-
|
|
151
|
-
cat README.md |
|
|
152
|
-
|
|
134
|
+
selesai -p "Summarize this codebase"
|
|
135
|
+
cat README.md | selesai -p "Summarize this text"
|
|
136
|
+
selesai -p @screenshot.png "What's in this image?"
|
|
153
137
|
```
|
|
154
138
|
|
|
155
139
|
Use `--mode json` for JSON event output or `--mode rpc` for process integration.
|
package/docs/settings.md
CHANGED
|
@@ -322,3 +322,7 @@ Project settings (`.selesai/settings.json`) override global settings. Nested obj
|
|
|
322
322
|
"compaction": { "enabled": true, "reserveTokens": 8192 }
|
|
323
323
|
}
|
|
324
324
|
```
|
|
325
|
+
|
|
326
|
+
## Factory Reset
|
|
327
|
+
|
|
328
|
+
Run `/settings-factory-reset` inside a session to restore the global settings file (`~/.selesai/agent/settings.json`) to the bundled factory defaults. The command warns before replacing the file, saves a backup as `settings.json.bak` next to it, and leaves credentials (`auth.json`), sessions, extensions, skills, and themes untouched. Settings take effect immediately after the reset (equivalent to `/reload`).
|
package/docs/usage.md
CHANGED
|
@@ -43,6 +43,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
|
|
|
43
43
|
| `/model` | Switch models |
|
|
44
44
|
| `/scoped-models` | Enable/disable models for Ctrl+P cycling |
|
|
45
45
|
| `/settings` | Thinking level, theme, message delivery, transport |
|
|
46
|
+
| `/settings-factory-reset` | Reset settings to factory defaults (with confirmation) |
|
|
46
47
|
| `/resume` | Pick from previous sessions |
|
|
47
48
|
| `/new` | Start a new session |
|
|
48
49
|
| `/name <name>` | Set session display name |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selesai/code",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.6",
|
|
4
4
|
"description": "Maintained, extension-first Pi coding agent with built-in workflows, subagents, web research, questions, skills, and an enhanced terminal UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
],
|
|
51
51
|
"scripts": {
|
|
52
52
|
"clean": "shx rm -rf dist",
|
|
53
|
+
"test": "vitest run src/extensions/undo.test.ts src/extensions/agent-browser.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/web-agent-onboarding.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-onboarding.test.ts src/__tests__/workflow-modes.test.ts",
|
|
54
|
+
"test:coverage": "vitest run --coverage src/extensions/undo.test.ts src/extensions/agent-browser.test.ts src/extensions/context-compaction-reminder.test.ts src/extensions/copy-turn.test.ts src/extensions/grep-app/index.test.ts src/extensions/inline-skills.test.ts src/extensions/rtk.test.ts src/extensions/web-agent-onboarding.test.ts src/extensions/handoff-new.test.ts src/extensions/question/tests src/extensions/ponytail/test src/__tests__/tokenin-onboarding.test.ts src/__tests__/workflow-modes.test.ts",
|
|
55
|
+
"prepare": "npm run build",
|
|
53
56
|
"build": "npm run clean && tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js && npm run copy-assets",
|
|
54
57
|
"copy-assets": "shx mkdir -p dist/modes/interactive/theme && shx cp src/modes/interactive/theme/*.json dist/modes/interactive/theme/ && shx mkdir -p dist/modes/interactive/assets && shx cp src/modes/interactive/assets/*.png dist/modes/interactive/assets/ && shx mkdir -p dist/core/export-html/vendor && shx cp src/core/export-html/template.html src/core/export-html/template.css src/core/export-html/template.js dist/core/export-html/ && shx cp src/core/export-html/vendor/*.js dist/core/export-html/vendor/ && shx mkdir -p dist/defaults && shx cp src/defaults/* dist/defaults/ && shx mkdir -p dist/extensions && node scripts/copy-extensions.mjs && shx mkdir -p dist/themes && shx cp -r src/themes/. dist/themes/ && shx mkdir -p dist/skills && shx cp -r src/skills/. dist/skills/"
|
|
55
58
|
},
|
|
@@ -88,6 +91,7 @@
|
|
|
88
91
|
"@types/proper-lockfile": "4.1.4",
|
|
89
92
|
"@types/semver": "7.7.1",
|
|
90
93
|
"@typescript/native-preview": "^7.0.0-dev.20260120.1",
|
|
94
|
+
"@vitest/coverage-v8": "4.1.9",
|
|
91
95
|
"shx": "0.4.0",
|
|
92
96
|
"typescript": "5.9.3",
|
|
93
97
|
"vitest": "4.1.9"
|