@nmzpy/pi-ember-stack 0.2.1 → 0.2.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.
Files changed (30) hide show
  1. package/README.md +83 -83
  2. package/package.json +63 -59
  3. package/plugins/devin-auth/extensions/index.ts +23 -0
  4. package/plugins/devin-auth/src/cloud-direct/auth.ts +246 -246
  5. package/plugins/devin-auth/src/cloud-direct/catalog.ts +246 -246
  6. package/plugins/devin-auth/src/cloud-direct/chat.ts +1096 -1091
  7. package/plugins/devin-auth/src/cloud-direct/index.ts +41 -41
  8. package/plugins/devin-auth/src/cloud-direct/metadata.ts +78 -78
  9. package/plugins/devin-auth/src/cloud-direct/wire.ts +202 -202
  10. package/plugins/devin-auth/src/oauth/register-user.ts +174 -174
  11. package/plugins/devin-auth/src/oauth/types.ts +71 -71
  12. package/plugins/devin-auth/src/stream.ts +1 -1
  13. package/plugins/pi-compact-tools/index.ts +19 -1
  14. package/plugins/pi-compact-tools/renderer.ts +231 -61
  15. package/plugins/pi-custom-agents/index.ts +310 -102
  16. package/plugins/pi-custom-agents/questionnaire-tool.ts +14 -5
  17. package/plugins/pi-custom-agents/subagent/extensions/agents.ts +18 -1
  18. package/plugins/pi-custom-agents/subagent/extensions/index.ts +116 -224
  19. package/plugins/pi-custom-agents/subagent/extensions/model.ts +96 -96
  20. package/plugins/pi-custom-agents/subagent/extensions/render.ts +205 -1
  21. package/plugins/pi-custom-agents/subagent/extensions/runner.ts +241 -177
  22. package/plugins/pi-custom-agents/subagent/extensions/test/render.test.ts +145 -0
  23. package/plugins/pi-ember-fff/index.ts +275 -17
  24. package/plugins/pi-ember-fff/query.ts +170 -10
  25. package/plugins/pi-ember-fff/test/query.test.ts +157 -1
  26. package/plugins/pi-ember-fff/test/renderer.test.ts +367 -16
  27. package/plugins/pi-ember-tps/index.ts +27 -5
  28. package/plugins/pi-ember-ui/ember.json +3 -0
  29. package/plugins/pi-ember-ui/index.ts +223 -36
  30. package/plugins/pi-ember-ui/mode-colors.ts +36 -8
package/README.md CHANGED
@@ -1,91 +1,91 @@
1
- # pi-ember-stack
2
-
3
- The Ember-owned pi package. It installs the complete Ember agent workflow as
4
- one package:
5
-
6
- - Primary modes: `/coder`, `/architect`, `/doctor`, `/orchestrator`, and
7
- `/ui-doctor`.
8
- - Inline `questionnaire` UI for decision-oriented questions. Agents are told to
9
- prefer it when they need a user choice.
10
- - A compact native `edit` renderer that shows the filename and a single
11
- `+N / -N` result row.
12
- - Vendored subagent support with bundled `coder` and `architect` definitions,
13
- plus the upstream bundled roles.
14
- - Bundled Devin auth/provider support, including OAuth, model catalog refresh,
15
- and streaming transport.
16
- - A self-contained `Ctrl+Space` mode-cycle shortcut and a footer showing the
17
- active mode, model, and thinking variant.
18
-
19
- ## Plugin registry
20
-
21
- The package has one top-level pi extension which dispatches to the internal
22
- plugins under `plugins/`. Ember projects enable them in `.pi/ember-stack.json`:
23
-
24
- ```json
25
- {
1
+ # pi-ember-stack
2
+
3
+ The Ember-owned pi package. It installs the complete Ember agent workflow as
4
+ one package:
5
+
6
+ - Primary modes: `/coder`, `/architect`, `/doctor`, `/orchestrator`, and
7
+ `/ui-doctor`.
8
+ - Inline `questionnaire` UI for decision-oriented questions. Agents are told to
9
+ prefer it when they need a user choice.
10
+ - A compact native `edit` renderer that shows the filename and a single
11
+ `+N / -N` result row.
12
+ - Vendored subagent support with bundled `coder` and `architect` definitions,
13
+ plus the upstream bundled roles.
14
+ - Bundled Devin auth/provider support, including OAuth, model catalog refresh,
15
+ and streaming transport.
16
+ - A self-contained `Ctrl+Space` mode-cycle shortcut and a footer showing the
17
+ active mode, model, and thinking variant.
18
+
19
+ ## Plugin registry
20
+
21
+ The package has one top-level pi extension which dispatches to the internal
22
+ plugins under `plugins/`. Ember projects enable them in `.pi/ember-stack.json`:
23
+
24
+ ```json
25
+ {
26
26
  "plugins": ["pi-compact-tools", "pi-custom-agents", "devin-auth"]
27
- }
28
- ```
29
-
30
- Remove a plugin ID to disable it, or use `/stack-plugins` to toggle one from
31
- the TUI. Restart pi after changing the list. The available plugins are:
32
-
27
+ }
28
+ ```
29
+
30
+ Remove a plugin ID to disable it, or use `/stack-plugins` to toggle one from
31
+ the TUI. Restart pi after changing the list. The available plugins are:
32
+
33
33
  - `pi-compact-tools`: collapsed native edit rendering.
34
34
  - `pi-custom-agents`: questionnaire UI, primary modes, plans, subagent tool, and bundled agent definitions.
35
- - `devin-auth`: Devin provider, OAuth, catalog refresh, and streaming.
36
-
37
- ## Project setup
38
-
39
- The Ember repository contains a project-local `.pi/settings.json` entry for:
40
-
41
- ```json
35
+ - `devin-auth`: Devin provider, OAuth, catalog refresh, and streaming.
36
+
37
+ ## Project setup
38
+
39
+ The Ember repository contains a project-local `.pi/settings.json` entry for:
40
+
41
+ ```json
42
42
  "npm:@nmzpy/pi-ember-stack@0.1.6"
43
- ```
44
-
45
- On a new clone, start pi from the project directory. Pi will ask for a
46
- one-time project trust decision before it installs the package into the
47
- project-local `.pi/npm/` directory. The same decision can be approved
48
- non-interactively with:
49
-
50
- ```text
51
- pi --approve
52
- ```
53
-
54
- Project trust is intentionally a user decision; a repository cannot safely
55
- bypass it. After trust, normal startup is just `pi` from the Ember directory.
56
-
57
- When a new version is intentionally released, update the pinned version in
58
- the project settings and run:
59
-
60
- ```text
61
- pi update --extensions
62
- ```
63
-
64
- Third-party utilities such as pi-fff and image paste remain separate package
65
- entries. Devin auth is now bundled as a stack plugin, but credentials and
66
- provider secrets stay in the machine-local pi configuration and are not part
67
- of this repository.
68
-
69
- ## Development
70
-
43
+ ```
44
+
45
+ On a new clone, start pi from the project directory. Pi will ask for a
46
+ one-time project trust decision before it installs the package into the
47
+ project-local `.pi/npm/` directory. The same decision can be approved
48
+ non-interactively with:
49
+
50
+ ```text
51
+ pi --approve
52
+ ```
53
+
54
+ Project trust is intentionally a user decision; a repository cannot safely
55
+ bypass it. After trust, normal startup is just `pi` from the Ember directory.
56
+
57
+ When a new version is intentionally released, update the pinned version in
58
+ the project settings and run:
59
+
60
+ ```text
61
+ pi update --extensions
62
+ ```
63
+
64
+ Third-party utilities such as pi-fff and image paste remain separate package
65
+ entries. Devin auth is now bundled as a stack plugin, but credentials and
66
+ provider secrets stay in the machine-local pi configuration and are not part
67
+ of this repository.
68
+
69
+ ## Development
70
+
71
71
  The package entrypoint is `plugins/index.ts`. Compact tools are under
72
72
  `plugins/pi-compact-tools/`, while questionnaire, primary modes, plans,
73
73
  subagents, and bundled agents are under `plugins/pi-custom-agents/`. Devin auth
74
74
  is under `plugins/devin-auth/`.
75
-
76
- Run the package typecheck with:
77
-
78
- ```text
79
- npm install
80
- npm run typecheck
81
- ```
82
-
83
- ## Release
84
-
85
- Run `./gacp.sh --release` to bump the patch version, typecheck, commit, tag,
86
- push, and publish the package to npm. This only publishes the package; update
87
- Ember's pinned package version separately when you want the project to install it.
88
-
89
- The package is cross-platform: bundled paths are resolved from `import.meta.url`
90
- and do not depend on a Windows home directory or the current working
91
- directory.
75
+
76
+ Run the package typecheck with:
77
+
78
+ ```text
79
+ npm install
80
+ npm run typecheck
81
+ ```
82
+
83
+ ## Release
84
+
85
+ Run `./gacp.sh --release` to bump the patch version, typecheck, commit, tag,
86
+ push, and publish the package to npm. This only publishes the package; update
87
+ Ember's pinned package version separately when you want the project to install it.
88
+
89
+ The package is cross-platform: bundled paths are resolved from `import.meta.url`
90
+ and do not depend on a Windows home directory or the current working
91
+ directory.
package/package.json CHANGED
@@ -1,59 +1,63 @@
1
- {
2
- "name": "@nmzpy/pi-ember-stack",
3
- "version": "0.2.1",
4
- "description": "Ember's configurable pi plugin stack with modes, questionnaire, compact edits, subagents, and Devin auth",
5
- "type": "module",
6
- "license": "MIT",
7
- "keywords": [
8
- "pi-package",
9
- "pi-extension",
10
- "ember"
11
- ],
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/nmzpy/pi-ember-stack.git"
15
- },
16
- "bugs": {
17
- "url": "https://github.com/nmzpy/pi-ember-stack/issues"
18
- },
19
- "scripts": {
20
- "typecheck": "tsc --noEmit"
21
- },
22
- "files": [
23
- "README.md",
24
- "ATTRIBUTION.md",
25
- "tsconfig.json",
26
- "plugins"
27
- ],
28
- "exports": {
29
- ".": "./plugins/index.ts",
30
- "./renderer": "./plugins/pi-compact-tools/renderer.ts"
31
- },
32
- "pi": {
33
- "extensions": [
34
- "./plugins/index.ts"
35
- ]
36
- },
37
- "dependencies": {
38
- "@ff-labs/fff-node": "0.9.6",
39
- "@sinclair/typebox": "^0.34.0"
40
- },
41
- "peerDependencies": {
42
- "@earendil-works/pi-ai": "*",
43
- "@earendil-works/pi-agent-core": "*",
44
- "@earendil-works/pi-coding-agent": "*",
45
- "@earendil-works/pi-tui": "*",
46
- "typebox": "*"
47
- },
48
- "devDependencies": {
49
- "@earendil-works/pi-ai": "^0.80.6",
50
- "@earendil-works/pi-agent-core": "^0.80.6",
51
- "@earendil-works/pi-coding-agent": "^0.80.6",
52
- "@earendil-works/pi-tui": "^0.80.6",
53
- "@ff-labs/fff-node": "0.9.6",
54
- "@sinclair/typebox": "^0.34.0",
55
- "@types/node": "^20.19.43",
56
- "typebox": "^1.3.1",
57
- "typescript": "^5.9.3"
58
- }
59
- }
1
+ {
2
+ "name": "@nmzpy/pi-ember-stack",
3
+ "version": "0.2.2",
4
+ "description": "Ember's configurable pi plugin stack with modes, questionnaire, compact edits, subagents, and Devin auth",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "pi-package",
9
+ "pi-extension",
10
+ "ember"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/nmzpy/pi-ember-stack.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/nmzpy/pi-ember-stack/issues"
18
+ },
19
+ "scripts": {
20
+ "typecheck": "tsc --noEmit",
21
+ "lint": "biome lint",
22
+ "format": "biome format --write",
23
+ "check": "biome check"
24
+ },
25
+ "files": [
26
+ "README.md",
27
+ "ATTRIBUTION.md",
28
+ "tsconfig.json",
29
+ "plugins"
30
+ ],
31
+ "exports": {
32
+ ".": "./plugins/index.ts",
33
+ "./renderer": "./plugins/pi-compact-tools/renderer.ts"
34
+ },
35
+ "pi": {
36
+ "extensions": [
37
+ "./plugins/index.ts"
38
+ ]
39
+ },
40
+ "dependencies": {
41
+ "@ff-labs/fff-node": "0.9.6",
42
+ "@sinclair/typebox": "^0.34.0"
43
+ },
44
+ "peerDependencies": {
45
+ "@earendil-works/pi-agent-core": "*",
46
+ "@earendil-works/pi-ai": "*",
47
+ "@earendil-works/pi-coding-agent": "*",
48
+ "@earendil-works/pi-tui": "*",
49
+ "typebox": "*"
50
+ },
51
+ "devDependencies": {
52
+ "@biomejs/biome": "^2.5.3",
53
+ "@earendil-works/pi-agent-core": "^0.80.6",
54
+ "@earendil-works/pi-ai": "^0.80.6",
55
+ "@earendil-works/pi-coding-agent": "^0.80.6",
56
+ "@earendil-works/pi-tui": "^0.80.6",
57
+ "@ff-labs/fff-node": "0.9.6",
58
+ "@sinclair/typebox": "^0.34.0",
59
+ "@types/node": "^20.19.43",
60
+ "typebox": "^1.3.1",
61
+ "typescript": "^5.9.3"
62
+ }
63
+ }
@@ -108,6 +108,28 @@ function registerDevinProvider(pi: ExtensionAPI, models: ProviderModelConfig[]):
108
108
  export default async function (pi: ExtensionAPI): Promise<void> {
109
109
  _pi = pi;
110
110
 
111
+ // Swallow AbortError unhandled rejections that arise when the user
112
+ // cancels an in-flight agent run (Escape during streaming). The agent's
113
+ // AbortController.abort() sets signal.reason to a DOMException
114
+ // [AbortError]; late rejections from fetch body streams, reader.cancel(),
115
+ // or the anySignal polyfill can surface as unhandled rejections that —
116
+ // on Node ≥15 with --unhandled-rejections=throw (the default in Node 25)
117
+ // — trigger pi's uncaughtException handler and crash the process.
118
+ // These are expected during cancellation, not real errors.
119
+ //
120
+ // Non-abort rejections are genuine bugs: temporarily remove the guard,
121
+ // re-emit so pi's crash handler surfaces them, then re-attach.
122
+ const abortRejectionHandler = (reason: unknown): void => {
123
+ const isAbort =
124
+ reason instanceof DOMException && reason.name === 'AbortError';
125
+ if (isAbort) return; // expected during cancellation
126
+ // Re-emit non-abort rejections so they are not silently swallowed.
127
+ process.off('unhandledRejection', abortRejectionHandler);
128
+ process.emit('unhandledRejection', reason, Promise.reject(reason));
129
+ process.on('unhandledRejection', abortRejectionHandler);
130
+ };
131
+ process.on('unhandledRejection', abortRejectionHandler);
132
+
111
133
  // Register with an empty model list first so the provider (and OAuth
112
134
  // login support) is known even before the catalog arrives. Then, if we
113
135
  // already have credentials in auth.json, fetch the live catalog now —
@@ -175,5 +197,6 @@ export default async function (pi: ExtensionAPI): Promise<void> {
175
197
 
176
198
  pi.on('session_shutdown', async () => {
177
199
  _pi = null;
200
+ process.off('unhandledRejection', abortRejectionHandler);
178
201
  });
179
202
  }