@d3ara1n/pi-model-roles 0.1.0 → 0.2.0
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 +16 -9
- package/package.json +1 -1
- package/src/defaults.ts +11 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Model role configuration library for [pi](https://github.com/earendil-works/pi) extensions.
|
|
4
4
|
|
|
5
|
-
Defines named model roles (e.g. "heavy", "fast", "
|
|
5
|
+
Defines named model roles (e.g. "heavy", "fast", "utility") and resolves them to pi `Model` instances with API key and headers.
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
@@ -24,14 +24,15 @@ Built-in defaults use `model: null` (use pi's current model, don't switch):
|
|
|
24
24
|
|
|
25
25
|
| Role | model | thinking | Description |
|
|
26
26
|
|------|-------|----------|-------------|
|
|
27
|
-
| `default` | null | medium |
|
|
28
|
-
| `heavy` | null | high |
|
|
29
|
-
| `fast` | null |
|
|
27
|
+
| `default` | null | medium | Regular dev tasks: new features, code edits, code review, adding tests, general debugging, single-file changes |
|
|
28
|
+
| `heavy` | null | high | Deep-thinking tasks: cross-file refactoring, architecture design, complex bug debugging, performance optimization, security analysis, DB schema changes, multi-module migrations |
|
|
29
|
+
| `fast` | null | low | Simple deterministic tasks: one-line edits, formatting, simple Q&A, doc lookups, git operations, confirmations |
|
|
30
|
+
| `utility` | null | off | Lightweight utility tasks: routing, commit gen, title summarization |
|
|
30
31
|
|
|
31
32
|
`model: null` means "keep using whatever model pi currently has".
|
|
32
33
|
Only `thinking` level differs between roles by default.
|
|
33
34
|
|
|
34
|
-
Custom roles
|
|
35
|
+
Custom roles can be added freely — any role name works:
|
|
35
36
|
|
|
36
37
|
## Configuration
|
|
37
38
|
|
|
@@ -48,11 +49,10 @@ Override specific roles in `~/.pi/agent/settings.json`:
|
|
|
48
49
|
"model": "google/gemini-2.5-flash",
|
|
49
50
|
"thinking": "off"
|
|
50
51
|
},
|
|
51
|
-
//
|
|
52
|
-
"
|
|
52
|
+
// Lightweight utility tasks (routing, commit generation, etc.)
|
|
53
|
+
"utility": {
|
|
53
54
|
"model": "deepseek/deepseek-v4-flash",
|
|
54
|
-
"thinking": "off"
|
|
55
|
-
"hidden": true
|
|
55
|
+
"thinking": "off"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"defaultRole": "default"
|
|
@@ -63,6 +63,13 @@ Override specific roles in `~/.pi/agent/settings.json`:
|
|
|
63
63
|
User settings **merge** with built-in defaults: only override roles you want to change.
|
|
64
64
|
You can also add entirely new roles.
|
|
65
65
|
|
|
66
|
+
### Hidden roles
|
|
67
|
+
|
|
68
|
+
Roles with `hidden: true` (like `utility` by default) are excluded from scout's role
|
|
69
|
+
selection list — the side agent won't suggest switching to them. They can still be
|
|
70
|
+
used directly by name (e.g. as `sideAgentRole` in scout config) and resolved via
|
|
71
|
+
`resolveRole()` / `resolveRoleAsync()`.
|
|
72
|
+
|
|
66
73
|
### Role fields
|
|
67
74
|
|
|
68
75
|
| Field | Type | Default | Description |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3ara1n/pi-model-roles",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model role configuration library for pi extensions — defines named model roles and resolves them to Model instances",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/types.ts",
|
package/src/defaults.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in default role definitions.
|
|
3
3
|
*
|
|
4
|
-
* Only universal roles are built-in.
|
|
5
|
-
*
|
|
4
|
+
* Only universal roles are built-in. Plugin-specific roles
|
|
5
|
+
* are left for users to define — modelRoles accepts
|
|
6
6
|
* any custom role name.
|
|
7
7
|
*
|
|
8
8
|
* model=null means "use pi's current model, don't switch".
|
|
@@ -13,17 +13,23 @@ import type { RoleConfig } from "./types.ts";
|
|
|
13
13
|
export const BUILTIN_DEFAULT_ROLES: Record<string, RoleConfig> = {
|
|
14
14
|
default: {
|
|
15
15
|
model: null,
|
|
16
|
-
description: "
|
|
16
|
+
description: "常规开发任务:编写新功能、修改现有代码、代码审查、添加测试、一般性调试、文件级别的修改",
|
|
17
17
|
thinking: "medium",
|
|
18
18
|
},
|
|
19
19
|
heavy: {
|
|
20
20
|
model: null,
|
|
21
|
-
description: "
|
|
21
|
+
description: "需要深度思考的任务:跨文件重构、架构设计、复杂 bug 调试、性能优化、安全分析、数据库 schema 变更、涉及多个模块的迁移",
|
|
22
22
|
thinking: "high",
|
|
23
23
|
},
|
|
24
24
|
fast: {
|
|
25
25
|
model: null,
|
|
26
|
-
description: "
|
|
26
|
+
description: "简单确定性的任务:一行修改、格式调整、简单问答、文档查阅、git 操作、确认类回复",
|
|
27
|
+
thinking: "low",
|
|
28
|
+
},
|
|
29
|
+
utility: {
|
|
30
|
+
model: null,
|
|
31
|
+
description: "轻量辅助:模型路由、commit 生成、标题摘要等(hidden)",
|
|
27
32
|
thinking: "off",
|
|
33
|
+
hidden: true,
|
|
28
34
|
},
|
|
29
35
|
};
|