@zigai/pi-autoname-session 1.1.4
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/LICENSE +21 -0
- package/README.md +73 -0
- package/config.schema.json +163 -0
- package/package.json +95 -0
- package/src/index.ts +751 -0
- package/src/picker-request.ts +104 -0
- package/src/session-naming.ts +711 -0
- package/src/settings-input.ts +164 -0
- package/src/settings.prevalidated.ts +31 -0
- package/src/settings.ts +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zigai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Pi Autoname Session
|
|
2
|
+
|
|
3
|
+
Automatically name Pi sessions from the user's request and repository context.
|
|
4
|
+
|
|
5
|
+
The extension can name a session after a configurable activity threshold and optionally refresh that name as work continues.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pi install npm:@zigai/pi-autoname-session
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
<!-- pi-extension-settings:start -->
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
Global settings are stored in `~/.pi/agent/extension-settings/pi-autoname-session.json`.
|
|
17
|
+
|
|
18
|
+
| Option | Type | Default | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| `enabled` | boolean | `true` | Enable the extension. |
|
|
21
|
+
| `initialNaming.enabled` | boolean | `true` | Automatically name an otherwise unnamed session once. |
|
|
22
|
+
| `initialNaming.timing` | `prompt` \| `settled` | `"prompt"` | When to first check the naming trigger: before the agent starts on a prompt, or after the agent has settled. |
|
|
23
|
+
| `initialNaming.trigger` | `messages` \| `turns` \| `tool_calls` \| `tokens` \| `minutes` | `"messages"` | The session activity that starts a naming attempt. |
|
|
24
|
+
| `initialNaming.threshold` | integer | `1` | The initial activity threshold. |
|
|
25
|
+
| `refreshNaming.enabled` | boolean | `false` | Periodically refresh the name as the session develops. |
|
|
26
|
+
| `refreshNaming.trigger` | `messages` \| `turns` \| `tool_calls` \| `tokens` \| `minutes` | `"turns"` | The activity that starts a naming refresh. |
|
|
27
|
+
| `refreshNaming.threshold` | integer | `10` | The amount of activity between refreshes. |
|
|
28
|
+
| `model` | string | `"current"` | Picker model: provider/model-id, or current for the active model. |
|
|
29
|
+
| `reasoningEffort` | `off` \| `minimal` \| `low` \| `medium` \| `high` \| `xhigh` \| `max` | `"low"` | Reasoning effort used by the session-name picker. |
|
|
30
|
+
| `timeoutMs` | integer | `30000` | Maximum time in milliseconds for picker authentication and the model response before the naming attempt is treated as failed. |
|
|
31
|
+
| `conversationScope` | `minimized` \| `full` | `"minimized"` | How much refresh context to send. Minimized sends only user and assistant text; full also includes tool arguments, results, and shell output. Initial naming always uses only the first user request. |
|
|
32
|
+
| `prompt` | string | *See JSON below* | Prompt used by the picker. Available placeholders are {{repository_context}}, {{conversation}}, {{current_name}}, {{cwd}}, and {{reason}}. |
|
|
33
|
+
| `nameConstraints.minLength` | integer | `6` | Minimum number of characters in a name returned by the picker. |
|
|
34
|
+
| `nameConstraints.maxLength` | integer | `40` | Maximum number of characters in a name returned by the picker. |
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"$schema": "./schemas/pi-autoname-session.schema.json",
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"initialNaming": {
|
|
41
|
+
"enabled": true,
|
|
42
|
+
"timing": "prompt",
|
|
43
|
+
"trigger": "messages",
|
|
44
|
+
"threshold": 1
|
|
45
|
+
},
|
|
46
|
+
"refreshNaming": {
|
|
47
|
+
"enabled": false,
|
|
48
|
+
"trigger": "turns",
|
|
49
|
+
"threshold": 10
|
|
50
|
+
},
|
|
51
|
+
"model": "current",
|
|
52
|
+
"reasoningEffort": "low",
|
|
53
|
+
"timeoutMs": 30000,
|
|
54
|
+
"conversationScope": "minimized",
|
|
55
|
+
"prompt": "Generate a title that will help the user recognize this coding session weeks later.\n\nBefore answering, silently identify:\n- Subject: the system, feature, or problem the request is really about.\n- Outcome: what the user ultimately wants to understand or change.\n- Incidental instructions: details about tools, process, output, or how the agent should work.\n\nTitle the durable subject and desired outcome. Discard incidental instructions.\nPrioritize user requests over assistant discoveries. Preserve the original subject until the user clearly changes goals.\n\nEditorial rules:\n- Use 3 to 8 words and a compact noun phrase or clear action phrase.\n- Capture the umbrella goal when the request lists several symptoms or steps.\n- Name the product change, not a plan, report, branch, commit, PR, test run, or monitoring step used to produce it.\n- Exclude models, subagents, tools, and output formats unless they are themselves the topic.\n- For reviews, name what is being reviewed and the relevant concern.\n- For research, name the question domain rather than the research process.\n- Do not claim the work is complete or merely copy and truncate the request.\n- Avoid repository names already visible in the workspace metadata, quotes, labels, filler, and trailing punctuation.\n\nWorkspace metadata:\n<workspace>\n{{repository_context}}\n</workspace>\n\nConversation:\n<conversation>\n{{conversation}}\n</conversation>\n\nCurrent title: {{current_name}}\nNaming phase: {{reason}}",
|
|
56
|
+
"nameConstraints": {
|
|
57
|
+
"minLength": 6,
|
|
58
|
+
"maxLength": 40
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
<!-- pi-extension-settings:end -->
|
|
63
|
+
|
|
64
|
+
## Development
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
just setup
|
|
68
|
+
just coverage
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/zigai/pi-autoname-session/HEAD/config.schema.json",
|
|
4
|
+
"title": "Pi Autoname Session settings",
|
|
5
|
+
"description": "Settings for Pi Autoname Session.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"default": "./schemas/pi-autoname-session.schema.json",
|
|
12
|
+
"description": "JSON Schema used by editors for this settings file."
|
|
13
|
+
},
|
|
14
|
+
"enabled": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": true,
|
|
17
|
+
"description": "Enable the extension."
|
|
18
|
+
},
|
|
19
|
+
"initialNaming": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"enabled": {
|
|
23
|
+
"type": "boolean",
|
|
24
|
+
"default": true,
|
|
25
|
+
"description": "Automatically name an otherwise unnamed session once."
|
|
26
|
+
},
|
|
27
|
+
"timing": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": [
|
|
30
|
+
"prompt",
|
|
31
|
+
"settled"
|
|
32
|
+
],
|
|
33
|
+
"description": "When to first check the naming trigger: before the agent starts on a prompt, or after the agent has settled.",
|
|
34
|
+
"default": "prompt"
|
|
35
|
+
},
|
|
36
|
+
"trigger": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": [
|
|
39
|
+
"messages",
|
|
40
|
+
"turns",
|
|
41
|
+
"tool_calls",
|
|
42
|
+
"tokens",
|
|
43
|
+
"minutes"
|
|
44
|
+
],
|
|
45
|
+
"description": "The session activity that starts a naming attempt.",
|
|
46
|
+
"default": "messages"
|
|
47
|
+
},
|
|
48
|
+
"threshold": {
|
|
49
|
+
"type": "integer",
|
|
50
|
+
"default": 1,
|
|
51
|
+
"minimum": 1,
|
|
52
|
+
"description": "The initial activity threshold."
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"additionalProperties": false,
|
|
56
|
+
"default": {
|
|
57
|
+
"enabled": true,
|
|
58
|
+
"timing": "prompt",
|
|
59
|
+
"trigger": "messages",
|
|
60
|
+
"threshold": 1
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"refreshNaming": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"properties": {
|
|
66
|
+
"enabled": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"default": false,
|
|
69
|
+
"description": "Periodically refresh the name as the session develops."
|
|
70
|
+
},
|
|
71
|
+
"trigger": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"messages",
|
|
75
|
+
"turns",
|
|
76
|
+
"tool_calls",
|
|
77
|
+
"tokens",
|
|
78
|
+
"minutes"
|
|
79
|
+
],
|
|
80
|
+
"description": "The activity that starts a naming refresh.",
|
|
81
|
+
"default": "turns"
|
|
82
|
+
},
|
|
83
|
+
"threshold": {
|
|
84
|
+
"type": "integer",
|
|
85
|
+
"default": 10,
|
|
86
|
+
"minimum": 1,
|
|
87
|
+
"description": "The amount of activity between refreshes."
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"additionalProperties": false,
|
|
91
|
+
"default": {
|
|
92
|
+
"enabled": false,
|
|
93
|
+
"trigger": "turns",
|
|
94
|
+
"threshold": 10
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"model": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"default": "current",
|
|
100
|
+
"minLength": 1,
|
|
101
|
+
"pattern": "^(?:current|[^/\\s]+/\\S+)$",
|
|
102
|
+
"description": "Picker model: provider/model-id, or current for the active model."
|
|
103
|
+
},
|
|
104
|
+
"reasoningEffort": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"enum": [
|
|
107
|
+
"off",
|
|
108
|
+
"minimal",
|
|
109
|
+
"low",
|
|
110
|
+
"medium",
|
|
111
|
+
"high",
|
|
112
|
+
"xhigh",
|
|
113
|
+
"max"
|
|
114
|
+
],
|
|
115
|
+
"description": "Reasoning effort used by the session-name picker.",
|
|
116
|
+
"default": "low"
|
|
117
|
+
},
|
|
118
|
+
"timeoutMs": {
|
|
119
|
+
"type": "integer",
|
|
120
|
+
"default": 30000,
|
|
121
|
+
"minimum": 1000,
|
|
122
|
+
"description": "Maximum time in milliseconds for picker authentication and the model response before the naming attempt is treated as failed."
|
|
123
|
+
},
|
|
124
|
+
"conversationScope": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"enum": [
|
|
127
|
+
"minimized",
|
|
128
|
+
"full"
|
|
129
|
+
],
|
|
130
|
+
"description": "How much refresh context to send. Minimized sends only user and assistant text; full also includes tool arguments, results, and shell output. Initial naming always uses only the first user request.",
|
|
131
|
+
"default": "minimized"
|
|
132
|
+
},
|
|
133
|
+
"prompt": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"default": "Generate a title that will help the user recognize this coding session weeks later.\n\nBefore answering, silently identify:\n- Subject: the system, feature, or problem the request is really about.\n- Outcome: what the user ultimately wants to understand or change.\n- Incidental instructions: details about tools, process, output, or how the agent should work.\n\nTitle the durable subject and desired outcome. Discard incidental instructions.\nPrioritize user requests over assistant discoveries. Preserve the original subject until the user clearly changes goals.\n\nEditorial rules:\n- Use 3 to 8 words and a compact noun phrase or clear action phrase.\n- Capture the umbrella goal when the request lists several symptoms or steps.\n- Name the product change, not a plan, report, branch, commit, PR, test run, or monitoring step used to produce it.\n- Exclude models, subagents, tools, and output formats unless they are themselves the topic.\n- For reviews, name what is being reviewed and the relevant concern.\n- For research, name the question domain rather than the research process.\n- Do not claim the work is complete or merely copy and truncate the request.\n- Avoid repository names already visible in the workspace metadata, quotes, labels, filler, and trailing punctuation.\n\nWorkspace metadata:\n<workspace>\n{{repository_context}}\n</workspace>\n\nConversation:\n<conversation>\n{{conversation}}\n</conversation>\n\nCurrent title: {{current_name}}\nNaming phase: {{reason}}",
|
|
136
|
+
"minLength": 1,
|
|
137
|
+
"x-control": "textarea",
|
|
138
|
+
"description": "Prompt used by the picker. Available placeholders are {{repository_context}}, {{conversation}}, {{current_name}}, {{cwd}}, and {{reason}}."
|
|
139
|
+
},
|
|
140
|
+
"nameConstraints": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"properties": {
|
|
143
|
+
"minLength": {
|
|
144
|
+
"type": "integer",
|
|
145
|
+
"default": 6,
|
|
146
|
+
"minimum": 1,
|
|
147
|
+
"description": "Minimum number of characters in a name returned by the picker."
|
|
148
|
+
},
|
|
149
|
+
"maxLength": {
|
|
150
|
+
"type": "integer",
|
|
151
|
+
"default": 40,
|
|
152
|
+
"minimum": 1,
|
|
153
|
+
"description": "Maximum number of characters in a name returned by the picker."
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"additionalProperties": false,
|
|
157
|
+
"default": {
|
|
158
|
+
"minLength": 6,
|
|
159
|
+
"maxLength": 40
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zigai/pi-autoname-session",
|
|
3
|
+
"version": "1.1.4",
|
|
4
|
+
"description": "Automatically name and keep Pi sessions organized",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"autoname-session",
|
|
7
|
+
"pi",
|
|
8
|
+
"pi-coding-agent",
|
|
9
|
+
"pi-extension",
|
|
10
|
+
"pi-package"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/zigai/pi-autoname-session#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/zigai/pi-autoname-session/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "zigai",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/zigai/pi-autoname-session.git"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"src",
|
|
24
|
+
"README.md",
|
|
25
|
+
"config.schema.json",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "src/index.ts",
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"lint": "oxlint -c ./oxlint.config.ts .",
|
|
35
|
+
"lint:fix": "oxlint -c ./oxlint.config.ts . --fix",
|
|
36
|
+
"format": "oxfmt .",
|
|
37
|
+
"format:check": "oxfmt --check .",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"coverage": "vitest run --coverage",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"check": "npm run config:check && npm run format:check && npm run lint && npm run typecheck && npm test",
|
|
42
|
+
"verify": "npm run check",
|
|
43
|
+
"config:generate": "pi-extension-settings generate",
|
|
44
|
+
"config:check": "pi-extension-settings check",
|
|
45
|
+
"release": "release --root .",
|
|
46
|
+
"release:dry-run": "release --dry --root ."
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@zigai/pi-extension-settings": "0.5.3"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@earendil-works/pi-ai": "^0.83.0",
|
|
53
|
+
"@earendil-works/pi-coding-agent": "^0.83.0",
|
|
54
|
+
"@types/node": "^24.13.3",
|
|
55
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
56
|
+
"oxfmt": "^0.59.0",
|
|
57
|
+
"oxlint": "^1.74.0",
|
|
58
|
+
"oxlint-rules": "0.4.3",
|
|
59
|
+
"oxlint-tsgolint": "^7.0.2001",
|
|
60
|
+
"typebox": "^1.3.8",
|
|
61
|
+
"typescript": "^7.0.2",
|
|
62
|
+
"vitest": "^4.1.10"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@earendil-works/pi-ai": "*",
|
|
66
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
67
|
+
"typebox": "*"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"@earendil-works/pi-coding-agent": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"@earendil-works/pi-ai": {
|
|
74
|
+
"optional": true
|
|
75
|
+
},
|
|
76
|
+
"typebox": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"engines": {
|
|
81
|
+
"node": ">=22.19.0 <27"
|
|
82
|
+
},
|
|
83
|
+
"packageManager": "npm@11.18.0",
|
|
84
|
+
"pi": {
|
|
85
|
+
"extensions": [
|
|
86
|
+
"./src/index.ts"
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
"piExtensionSettings": {
|
|
90
|
+
"definition": "./src/settings-input.ts",
|
|
91
|
+
"prevalidation": "./src/settings.prevalidated.ts",
|
|
92
|
+
"schema": "./config.schema.json",
|
|
93
|
+
"readme": "./README.md"
|
|
94
|
+
}
|
|
95
|
+
}
|