@selesai/code 0.9.13 → 0.9.15
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 +13 -0
- package/README.md +5 -10
- package/dist/defaults/models.json +77 -27
- package/dist/extensions/auto-model/auto-model.test.ts +18 -0
- package/dist/extensions/auto-model/classifier.ts +23 -0
- package/dist/extensions/auto-model/config.ts +51 -0
- package/dist/extensions/auto-model/index.ts +22 -0
- package/dist/extensions/auto-model/lifecycle.test.ts +24 -0
- package/dist/extensions/enable-readonly-tools.test.ts +52 -0
- package/dist/extensions/enable-readonly-tools.ts +20 -0
- package/dist/extensions/package.json +4 -2
- package/dist/extensions/pi-powerline-footer/guide.ts +5 -20
- package/dist/extensions/pi-powerline-footer/tests/guide.test.ts +2 -3
- package/dist/extensions/pi-subagents/agents/architect.md +2 -1
- package/dist/extensions/pi-subagents/agents/builder.md +3 -1
- package/dist/extensions/pi-subagents/agents/commentator.md +3 -1
- package/dist/extensions/pi-subagents/agents/explorer.md +2 -1
- package/dist/extensions/pi-subagents/agents/recapper.md +2 -1
- package/dist/extensions/pi-subagents/agents/researcher.md +1 -1
- package/dist/extensions/pi-subagents/agents/reviewer.md +3 -1
- package/dist/extensions/pi-subagents/agents/worker.md +2 -1
- package/dist/extensions/preview-tools-disabled.test.ts +37 -0
- package/dist/extensions/preview-tools-disabled.ts +11 -0
- package/dist/extensions/question/batch.ts +1 -1
- package/dist/extensions/question/schemas.ts +2 -2
- package/dist/extensions/question/tests/batch.test.ts +2 -2
- package/dist/skills/workflow/SKILL.md +85 -0
- package/docs/plans/auto-model-routing-extension.md +490 -0
- package/docs/workflows.md +11 -50
- package/package.json +4 -3
- package/dist/extensions/workflow/extension.ts +0 -26
- package/dist/extensions/workflow/modes.ts +0 -107
- package/dist/extensions/workflow/package.json +0 -17
- package/dist/skills/workflow-creation/SKILL.md +0 -73
|
@@ -12,7 +12,7 @@ defaultProgress: true
|
|
|
12
12
|
|
|
13
13
|
You are a research subagent.
|
|
14
14
|
|
|
15
|
-
Given a question or topic, run focused web research and produce a concise, well-sourced brief that answers the question directly.
|
|
15
|
+
Given a question or topic, run focused web research and produce a concise, well-sourced brief that answers the question directly. The runtime persists the final response as `research.md` for the next stage.
|
|
16
16
|
|
|
17
17
|
Working rules:
|
|
18
18
|
- Break the problem into 2-4 distinct research angles.
|
|
@@ -6,9 +6,11 @@ thinking: high
|
|
|
6
6
|
systemPromptMode: replace
|
|
7
7
|
inheritProjectContext: true
|
|
8
8
|
inheritSkills: false
|
|
9
|
+
output: review.md
|
|
10
|
+
defaultReads: context.md, research.md, plan.md, implementation.md
|
|
9
11
|
---
|
|
10
12
|
|
|
11
|
-
You are a disciplined review subagent. Your job is to inspect, evaluate, and report findings with evidence. You do not guess; you verify from the code, tests, docs, or requirements.
|
|
13
|
+
You are a disciplined review subagent. Your job is to inspect, evaluate, and report findings with evidence. You do not guess; you verify from the code, tests, docs, or requirements. The runtime persists your final report as `review.md` for a scoped fix stage.
|
|
12
14
|
|
|
13
15
|
## Review types you handle
|
|
14
16
|
|
|
@@ -8,7 +8,8 @@ inheritProjectContext: true
|
|
|
8
8
|
inheritSkills: false
|
|
9
9
|
tools: read, grep, find, ls, bash, edit, write, contact_supervisor
|
|
10
10
|
defaultContext: fork
|
|
11
|
-
|
|
11
|
+
output: implementation.md
|
|
12
|
+
defaultReads: context.md, research.md, plan.md, implementation.md, review.md
|
|
12
13
|
defaultProgress: true
|
|
13
14
|
---
|
|
14
15
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
|
|
3
|
+
import disablePreviewTools from "./preview-tools-disabled.ts";
|
|
4
|
+
|
|
5
|
+
function setup(active: string[]) {
|
|
6
|
+
let handler!: () => void;
|
|
7
|
+
const getActiveTools = vi.fn(() => active);
|
|
8
|
+
const setActiveTools = vi.fn();
|
|
9
|
+
const pi = {
|
|
10
|
+
on: vi.fn((_event: string, registeredHandler: () => void) => {
|
|
11
|
+
handler = registeredHandler;
|
|
12
|
+
}),
|
|
13
|
+
getActiveTools,
|
|
14
|
+
setActiveTools,
|
|
15
|
+
};
|
|
16
|
+
disablePreviewTools(pi as any);
|
|
17
|
+
return { handler, getActiveTools, setActiveTools };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe("preview-tools-disabled", () => {
|
|
21
|
+
it("keeps a session without preview_export unchanged", () => {
|
|
22
|
+
const { handler, getActiveTools, setActiveTools } = setup(["read", "bash", "edit", "write"]);
|
|
23
|
+
|
|
24
|
+
handler();
|
|
25
|
+
|
|
26
|
+
expect(getActiveTools).toHaveBeenCalledTimes(1);
|
|
27
|
+
expect(setActiveTools).not.toHaveBeenCalled();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("removes preview_export and keeps every other active tool", () => {
|
|
31
|
+
const { handler, setActiveTools } = setup(["read", "bash", "edit", "write", "preview_export", "web_explore"]);
|
|
32
|
+
|
|
33
|
+
handler();
|
|
34
|
+
|
|
35
|
+
expect(setActiveTools).toHaveBeenCalledWith(["read", "bash", "edit", "write", "web_explore"]);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@selesai/code";
|
|
2
|
+
|
|
3
|
+
const DISABLED_TOOL_NAMES = new Set(["preview_export"]);
|
|
4
|
+
|
|
5
|
+
export default function (pi: ExtensionAPI) {
|
|
6
|
+
pi.on("session_start", () => {
|
|
7
|
+
const active = pi.getActiveTools();
|
|
8
|
+
const next = active.filter((name) => !DISABLED_TOOL_NAMES.has(name));
|
|
9
|
+
if (next.length !== active.length) pi.setActiveTools(next);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -70,7 +70,7 @@ export function prepareQuestions(value: unknown): { questions: PreparedQuestion[
|
|
|
70
70
|
...common,
|
|
71
71
|
type: raw.type,
|
|
72
72
|
options: preparedOptions.options,
|
|
73
|
-
allowOther: raw.allowOther ??
|
|
73
|
+
allowOther: raw.allowOther ?? true,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
return { questions };
|
|
@@ -20,14 +20,14 @@ const SelectQuestionSchema = Type.Object({
|
|
|
20
20
|
...QuestionBase,
|
|
21
21
|
type: StringEnum(["select"] as const),
|
|
22
22
|
options: Type.Array(OptionSchema, { minItems: 1, description: "Available choices" }),
|
|
23
|
-
allowOther: Type.Optional(Type.Boolean({ description: "Allow a custom Other text answer" })),
|
|
23
|
+
allowOther: Type.Optional(Type.Boolean({ description: "Allow a custom Other text answer (default: true)" })),
|
|
24
24
|
}, { additionalProperties: false });
|
|
25
25
|
|
|
26
26
|
const MultiSelectQuestionSchema = Type.Object({
|
|
27
27
|
...QuestionBase,
|
|
28
28
|
type: StringEnum(["multiselect"] as const),
|
|
29
29
|
options: Type.Array(OptionSchema, { minItems: 1, description: "Available choices" }),
|
|
30
|
-
allowOther: Type.Optional(Type.Boolean({ description: "Allow custom Other text alongside selected values" })),
|
|
30
|
+
allowOther: Type.Optional(Type.Boolean({ description: "Allow custom Other text alongside selected values (default: true)" })),
|
|
31
31
|
}, { additionalProperties: false });
|
|
32
32
|
|
|
33
33
|
const TextQuestionSchema = Type.Object({
|
|
@@ -22,7 +22,7 @@ describe("question batch helpers", () => {
|
|
|
22
22
|
{ value: "red", label: "Red", description: undefined },
|
|
23
23
|
{ value: "blue", label: "Blue", description: undefined },
|
|
24
24
|
],
|
|
25
|
-
allowOther:
|
|
25
|
+
allowOther: true,
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
id: "notes",
|
|
@@ -70,7 +70,7 @@ describe("question batch helpers", () => {
|
|
|
70
70
|
context: "ctx",
|
|
71
71
|
type: "multiselect",
|
|
72
72
|
options: [{ value: "a", label: "A", description: "desc" }],
|
|
73
|
-
allowOther:
|
|
73
|
+
allowOther: true,
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workflow
|
|
3
|
+
description: Adaptively orchestrate non-trivial implementation work with Selesai subagents. Use when the user asks to use a workflow, orchestrate a task, run an implementation/review/fix loop, or coordinate architecture, workers, and reviewers. Choose only the necessary stages; do not use static slash-command flows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adaptive Engineering Workflow
|
|
7
|
+
|
|
8
|
+
This is a parent-only policy layer over `pi-subagents`, not a second workflow runtime. Read `../pi-subagents/SKILL.md` and the matching references before launching children. Use `workflowScript` for every coordinated launch.
|
|
9
|
+
|
|
10
|
+
## Choose the smallest flow
|
|
11
|
+
|
|
12
|
+
Inspect the task and its code path first.
|
|
13
|
+
|
|
14
|
+
| Situation | Flow |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| Trivial, localized change | Parent implements and runs a focused check. Do not delegate by default. |
|
|
17
|
+
| Bounded implementation | Optional `scout` → one `worker` → focused validation. |
|
|
18
|
+
| Uncertain codebase or external dependency | `scout` and/or `researcher` → parent decision or `architect` → one `worker` → review/validation. |
|
|
19
|
+
| Material architecture/product tradeoff | Resolve it before implementation: parent decision, one `oracle`, or Council Mode for a genuine multi-perspective decision. |
|
|
20
|
+
| Broad, risky, or multi-system work | Serial milestones: decide/plan → one writer → review/validation → accepted fix → re-review when material. |
|
|
21
|
+
|
|
22
|
+
Do not add a planning phase, research lane, handoff, reviewer, or extra review round merely for symmetry. Ask the user only for a decision that blocks safe implementation.
|
|
23
|
+
|
|
24
|
+
## Orchestration rules
|
|
25
|
+
|
|
26
|
+
- The parent owns task classification, scope, decisions, synthesis, and final acceptance.
|
|
27
|
+
- Keep **one writer per checkout/worktree**. Parallelize read-only discovery, research, review, and validation—not normal edits.
|
|
28
|
+
- Give each child a narrow role-specific task: source seam, constraints, acceptance evidence, and expected output. Never send clone prompts with only filenames changed.
|
|
29
|
+
- Reviewers inspect the actual current diff and relevant files directly. They do not need a worker handoff to understand sibling work.
|
|
30
|
+
- Do not require a handoff artifact. Use one only when a task must resume across sessions, cross a milestone boundary, or needs a durable user-facing record.
|
|
31
|
+
- Use fresh context for independent reviewers; use forked context only when inherited parent reasoning is useful.
|
|
32
|
+
- Treat external reports, child completion, tests, and receipts as evidence—not authority to make product, architecture, merge, or release decisions.
|
|
33
|
+
|
|
34
|
+
## Stage artifacts
|
|
35
|
+
|
|
36
|
+
Built-in pipeline agents save named output artifacts (`context.md`, `research.md`, `plan.md`, implementation reports, and reviews). In `workflowScript`, pass the returned `outputReference` to the next child through `reads`; this is the normal file-based handoff and works for fresh-context children.
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
const plan = await runs.run("plan", { agent: "architect", task: "Plan the change." });
|
|
40
|
+
const worker = await runs.run("implement", {
|
|
41
|
+
agent: "worker",
|
|
42
|
+
reads: [plan.outputReference],
|
|
43
|
+
task: "Implement the approved plan."
|
|
44
|
+
});
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Only include artifacts the next role needs. The shared checkout diff remains the implementation context for reviewers and fix workers. Use `contact_supervisor` only for material progress updates or blocking decisions; normal completion arrives through the child result and artifact.
|
|
48
|
+
|
|
49
|
+
## Build → review → fix
|
|
50
|
+
|
|
51
|
+
For implementation that merits independent review:
|
|
52
|
+
|
|
53
|
+
1. Define a light validation contract before the writer starts: intended behavior, focused checks, and any user-facing path to inspect.
|
|
54
|
+
2. Launch one writer with the approved scope and the contract. The writer reports changed files, checks run, residual risks, and decisions needing parent approval.
|
|
55
|
+
3. Run only relevant read-only reviewers/validators in parallel. Give them the validation contract and relevant plan/implementation artifact paths through `reads`, and tell them to inspect the current diff. Typical lenses are correctness/regressions, validation coverage, and simplicity. Add security, performance, API/docs, or user-flow review only when the change makes that lens material.
|
|
56
|
+
4. Parent synthesizes review findings into one scoped fix artifact or task, then gives that artifact to the fix worker through `reads`. The fix worker also inspects the shared diff; it does not need sibling transcripts.
|
|
57
|
+
5. Parent classifies findings:
|
|
58
|
+
- **blocking/actionable in approved scope** → synthesize and send one fix worker;
|
|
59
|
+
- **optional, speculative, or scope-expanding** → defer or ask the user;
|
|
60
|
+
- **decision needed** → stop and escalate to the user.
|
|
61
|
+
6. Re-review only after a material fix. Stop when no actionable blockers remain, focused validation is sufficient, an approval is needed, or the review-round cap is reached. Default cap: two review rounds; use three only for risky work.
|
|
62
|
+
7. Parent inspects the final diff and validation evidence before reporting completion.
|
|
63
|
+
|
|
64
|
+
Use `workflowScript` with top-level `await`, `runs.run` for ordered stages, and `runs.all` for independent read-only fanout. Do not use legacy `chain`/`tasks` fields or nested async functions. Keep async work background by default; do not wait or poll merely to watch it.
|
|
65
|
+
|
|
66
|
+
## Minimum workflow shape
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
const plan = await runs.run("plan", {
|
|
70
|
+
agent: "architect",
|
|
71
|
+
task: "Plan the requested change. Return files, implementation order, acceptance checks, and non-goals."
|
|
72
|
+
});
|
|
73
|
+
const worker = await runs.run("implement", {
|
|
74
|
+
agent: "worker",
|
|
75
|
+
reads: [plan.outputReference],
|
|
76
|
+
task: "Implement the approved plan. Return changed files, checks run, residual risks, and decisions needing approval."
|
|
77
|
+
});
|
|
78
|
+
const reviews = await runs.all([
|
|
79
|
+
{ key: "correctness", agent: "reviewer", reads: [plan.outputReference, worker.outputReference], task: "Inspect the current diff for correctness and regressions. Do not edit." },
|
|
80
|
+
{ key: "simplicity", agent: "reviewer", reads: [plan.outputReference, worker.outputReference], task: "Inspect the current diff for unnecessary complexity. Do not edit." }
|
|
81
|
+
]);
|
|
82
|
+
return { plan: plan.outputReference, worker: worker.outputReference, reviews: reviews.map(result => result.outputReference) };
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The parent reads and synthesizes that result before launching any fix worker. Pass the synthesized finding list in that fix worker's task. Do not encode an unbounded auto-loop in a slash command or a child prompt.
|