@gotgenes/pi-subagents 18.0.1 → 18.0.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.
- package/CHANGELOG.md +7 -0
- package/docs/architecture/architecture.md +157 -204
- package/docs/architecture/history/phase-19-implement-ui-decisions.md +282 -0
- package/package.json +5 -6
- package/src/lifecycle/subagent.ts +5 -9
- package/src/observation/notification.ts +23 -10
- package/src/observation/subagent-events-observer.ts +1 -3
- package/src/tools/get-result-report.ts +60 -0
- package/src/tools/get-result-tool.ts +25 -40
- package/src/types.ts +1 -1
- package/src/ui/session-navigator.ts +0 -2
- package/.prettierignore +0 -5
- package/AGENTS.md +0 -7
- package/docs/plans/0048-implement-subagents-api.md +0 -304
- package/docs/plans/0049-remove-group-join-output-file-rpc.md +0 -180
- package/docs/plans/0051-update-adr-0001-hard-fork.md +0 -77
- package/docs/plans/0052-remove-scheduled-subagents.md +0 -133
- package/docs/plans/0053-extract-model-resolution-from-execute.md +0 -181
- package/docs/plans/0054-decompose-index-into-modules.md +0 -302
- package/docs/plans/0057-structured-debug-logging.md +0 -154
- package/docs/plans/0061-session-format-transcript.md +0 -284
- package/docs/plans/0066-replace-as-any-with-sdk-types.md +0 -215
- package/docs/plans/0069-create-subagent-runtime.md +0 -345
- package/docs/plans/0070-extract-event-handlers.md +0 -306
- package/docs/plans/0071-extract-session-config-assembler.md +0 -362
- package/docs/plans/0072-inject-agent-manager-collaborators.md +0 -329
- package/docs/plans/0076-inject-cwd-into-agent-manager.md +0 -102
- package/docs/plans/0077-inject-project-agents-dir.md +0 -115
- package/docs/plans/0080-consolidate-agent-config-lookup.md +0 -247
- package/docs/plans/0084-extract-git-worktree-manager.md +0 -142
- package/docs/plans/0087-evolve-subagent-runtime-methods.md +0 -240
- package/docs/plans/0098-extract-agent-record-state-machine.md +0 -435
- package/docs/plans/0099-replace-ctx-with-parent-snapshot.md +0 -488
- package/docs/plans/0100-replace-callback-threading-with-session-subscription.md +0 -454
- package/docs/plans/0102-consolidate-test-record-factory.md +0 -176
- package/docs/plans/0108-extract-agent-type-registry.md +0 -322
- package/docs/plans/0109-extract-settings-manager.md +0 -276
- package/docs/plans/0110-agent-activity-tracker.md +0 -297
- package/docs/plans/0111-split-agent-record-lifecycle.md +0 -582
- package/docs/plans/0112-replace-agent-manager-callbacks.md +0 -241
- package/docs/plans/0113-disambiguate-spawn-options.md +0 -155
- package/docs/plans/0114-narrow-agent-tool-menu-deps.md +0 -279
- package/docs/plans/0115-decompose-agent-tool.md +0 -337
- package/docs/plans/0116-type-housekeeping.md +0 -351
- package/docs/plans/0118-settings-manager-apply-methods.md +0 -271
- package/docs/plans/0123-remove-vi-fn-cast-smell.md +0 -179
- package/docs/plans/0131-consolidate-shared-test-fixtures.md +0 -207
- package/docs/plans/0132-inject-io-into-session-config.md +0 -219
- package/docs/plans/0133-inject-sdk-boundary-into-agent-runner.md +0 -373
- package/docs/plans/0134-reduce-as-any-casts.md +0 -366
- package/docs/plans/0135-extract-display-helpers.md +0 -182
- package/docs/plans/0136-decompose-agent-menu.md +0 -300
- package/docs/plans/0144-consolidate-observation-model.md +0 -263
- package/docs/plans/0145-decompose-execute-push-ctx-to-boundary.md +0 -290
- package/docs/plans/0146-narrow-ui-context.md +0 -319
- package/docs/plans/0147-inject-wrap-text-into-conversation-viewer.md +0 -166
- package/docs/plans/0148-split-agent-widget-rendering.md +0 -255
- package/docs/plans/0152-add-prompt-snippet.md +0 -91
- package/docs/plans/0164-reorganize-into-domain-directories.md +0 -409
- package/docs/plans/0165-decompose-resolved-spawn-config.md +0 -157
- package/docs/plans/0166-extract-parent-session-info.md +0 -231
- package/docs/plans/0167-narrow-runner-io.md +0 -150
- package/docs/plans/0168-extract-tool-filter-config.md +0 -173
- package/docs/plans/0169-extract-run-context-from-run-options.md +0 -194
- package/docs/plans/0170-reduce-build-content-lines-complexity.md +0 -225
- package/docs/plans/0171-reduce-render-result-complexity.md +0 -200
- package/docs/plans/0172-extract-turn-formatting.md +0 -206
- package/docs/plans/0180-reorder-append-prompt-for-kv-cache.md +0 -100
- package/docs/plans/0185-remove-persistent-agent-memory.md +0 -161
- package/docs/plans/0188-replace-any-casts-with-sdk-types.md +0 -162
- package/docs/plans/0192-define-session-context-interface.md +0 -107
- package/docs/plans/0193-runtime-owns-context-queries.md +0 -245
- package/docs/plans/0194-align-tool-interfaces-for-structural-typing.md +0 -139
- package/docs/plans/0195-convert-tool-factories-to-classes.md +0 -264
- package/docs/plans/0196-convert-runner-menu-to-classes.md +0 -268
- package/docs/plans/0205-decompose-render-widget-lines.md +0 -140
- package/docs/plans/0206-decompose-show-agent-detail.md +0 -211
- package/docs/plans/0207-decompose-agent-widget-update.md +0 -242
- package/docs/plans/0208-extract-shared-test-fixtures.md +0 -298
- package/docs/plans/0214-convert-remaining-closure-factories-to-classes.md +0 -261
- package/docs/plans/0215-decompose-build-parent-context.md +0 -166
- package/docs/plans/0216-decompose-start-agent.md +0 -255
- package/docs/plans/0217-extract-overwrite-guard.md +0 -176
- package/docs/plans/0218-push-sdk-boundary-in-settings.md +0 -172
- package/docs/plans/0219-reduce-test-duplication-top-3-clone-families.md +0 -162
- package/docs/plans/0227-evolve-agent-record-into-agent.md +0 -322
- package/docs/plans/0228-async-start-agent-dissolve-run-handle.md +0 -288
- package/docs/plans/0229-agent-born-complete.md +0 -564
- package/docs/plans/0230-extract-concurrency-queue.md +0 -265
- package/docs/plans/0231-push-exec-registry-to-runner.md +0 -245
- package/docs/plans/0232-agent-resume-internal-observer-lifecycle.md +0 -180
- package/docs/plans/0237-remove-disallowed-tools.md +0 -180
- package/docs/plans/0238-remove-extensions-filtering.md +0 -191
- package/docs/plans/0239-collapse-filter-active-tools.md +0 -217
- package/docs/plans/0242-rename-agent-tool-to-subagent.md +0 -165
- package/docs/plans/0256-extract-worktree-isolation.md +0 -256
- package/docs/plans/0257-extract-child-session-factory.md +0 -285
- package/docs/plans/0262-add-workspace-provider-seam.md +0 -264
- package/docs/plans/0264-remove-extension-lifecycle-control.md +0 -277
- package/docs/plans/0265-born-complete-subagent-session.md +0 -333
- package/docs/plans/0270-type-consumable-public-surface.md +0 -204
- package/docs/plans/0272-export-workspace-collaborator-types.md +0 -147
- package/docs/plans/0277-encapsulate-agent-session.md +0 -304
- package/docs/plans/0280-rename-agent-to-subagent.md +0 -197
- package/docs/plans/0360-custom-agents-default-append.md +0 -132
- package/docs/plans/0373-extract-subagent-state.md +0 -250
- package/docs/plans/0374-encapsulate-subagent-start-notification.md +0 -268
- package/docs/plans/0375-extract-run-listener-workspace-bracket.md +0 -300
- package/docs/plans/0376-extract-manager-observer.md +0 -232
- package/docs/plans/0377-split-widget-delegation-from-runtime.md +0 -254
- package/docs/plans/0378-consolidate-lifecycle-test-fixtures.md +0 -243
- package/docs/plans/0379-consolidate-ui-tools-test-fixtures.md +0 -335
- package/docs/plans/0380-extract-layered-settings-loader.md +0 -223
- package/docs/plans/0381-replace-concurrency-queue-with-limiter.md +0 -267
- package/docs/plans/0400-include-parent-prompt-in-replace-mode.md +0 -199
- package/docs/plans/0403-abort-subagents-on-interrupt.md +0 -180
- package/docs/plans/0412-unify-session-mock-builders.md +0 -146
- package/docs/plans/0420-fold-run-metrics-live-activity-onto-record.md +0 -228
- package/docs/plans/0421-migrate-activity-readers-to-record-getters.md +0 -309
- package/docs/plans/0422-delete-activity-tracker-ui-observer.md +0 -204
- package/docs/plans/0423-widget-self-drive-from-lifecycle.md +0 -264
- package/docs/plans/0424-drop-widget-dep-from-subagent-tool.md +0 -166
- package/docs/plans/0425-reconcile-subagent-events-contract.md +0 -144
- package/docs/plans/0426-consolidate-residual-test-clone-families.md +0 -235
- package/docs/plans/0427-reconsider-ui-direction.md +0 -212
- package/docs/plans/0441-remove-agent-definition-management-subtree.md +0 -180
- package/docs/plans/0442-dissolve-agents-conversation-viewer.md +0 -195
- package/docs/plans/0443-consolidate-remaining-test-clone-families.md +0 -268
- package/docs/plans/0444-shrink-widget-to-background-agents.md +0 -156
- package/docs/plans/0445-native-session-navigation.md +0 -365
- package/docs/plans/0446-spike-session-navigation-entry-criteria.md +0 -171
- package/docs/plans/0447-extract-subagents-settings-command.md +0 -220
- package/docs/plans/0448-block-disabled-agent-spawn.md +0 -207
- package/docs/plans/0462-navigation-renderer-tui-components.md +0 -338
- package/docs/plans/0463-file-snapshot-source-evicted-agents.md +0 -306
- package/docs/plans/0470-refresh-readme-command-surface.md +0 -159
- package/docs/retro/0048-implement-subagents-api.md +0 -44
- package/docs/retro/0049-remove-group-join-output-file-rpc.md +0 -49
- package/docs/retro/0051-update-adr-0001-hard-fork.md +0 -39
- package/docs/retro/0053-extract-model-resolution-from-execute.md +0 -40
- package/docs/retro/0054-decompose-index-into-modules.md +0 -53
- package/docs/retro/0057-structured-debug-logging.md +0 -77
- package/docs/retro/0061-session-format-transcript.md +0 -41
- package/docs/retro/0066-replace-as-any-with-sdk-types.md +0 -44
- package/docs/retro/0069-create-subagent-runtime.md +0 -43
- package/docs/retro/0070-extract-event-handlers.md +0 -49
- package/docs/retro/0071-extract-session-config-assembler.md +0 -60
- package/docs/retro/0072-inject-agent-manager-collaborators.md +0 -46
- package/docs/retro/0076-inject-cwd-into-agent-manager.md +0 -35
- package/docs/retro/0077-inject-project-agents-dir.md +0 -33
- package/docs/retro/0080-consolidate-agent-config-lookup.md +0 -35
- package/docs/retro/0084-extract-git-worktree-manager.md +0 -37
- package/docs/retro/0087-evolve-subagent-runtime-methods.md +0 -42
- package/docs/retro/0098-extract-agent-record-state-machine.md +0 -46
- package/docs/retro/0099-replace-ctx-with-parent-snapshot.md +0 -37
- package/docs/retro/0100-replace-callback-threading-with-session-subscription.md +0 -36
- package/docs/retro/0102-consolidate-test-record-factory.md +0 -30
- package/docs/retro/0108-extract-agent-type-registry.md +0 -41
- package/docs/retro/0109-extract-settings-manager.md +0 -55
- package/docs/retro/0110-agent-activity-tracker.md +0 -44
- package/docs/retro/0111-split-agent-record-lifecycle.md +0 -61
- package/docs/retro/0112-replace-agent-manager-callbacks.md +0 -35
- package/docs/retro/0113-disambiguate-spawn-options.md +0 -29
- package/docs/retro/0114-narrow-agent-tool-menu-deps.md +0 -38
- package/docs/retro/0115-decompose-agent-tool.md +0 -51
- package/docs/retro/0116-type-housekeeping.md +0 -42
- package/docs/retro/0118-settings-manager-apply-methods.md +0 -40
- package/docs/retro/0123-remove-vi-fn-cast-smell.md +0 -49
- package/docs/retro/0131-consolidate-shared-test-fixtures.md +0 -46
- package/docs/retro/0132-inject-io-into-session-config.md +0 -33
- package/docs/retro/0133-inject-sdk-boundary-into-agent-runner.md +0 -45
- package/docs/retro/0134-reduce-as-any-casts.md +0 -56
- package/docs/retro/0135-extract-display-helpers.md +0 -38
- package/docs/retro/0136-decompose-agent-menu.md +0 -43
- package/docs/retro/0144-consolidate-observation-model.md +0 -39
- package/docs/retro/0145-decompose-execute-push-ctx-to-boundary.md +0 -56
- package/docs/retro/0146-narrow-ui-context.md +0 -70
- package/docs/retro/0147-inject-wrap-text-into-conversation-viewer.md +0 -90
- package/docs/retro/0148-split-agent-widget-rendering.md +0 -39
- package/docs/retro/0152-add-prompt-snippet.md +0 -34
- package/docs/retro/0164-reorganize-into-domain-directories.md +0 -82
- package/docs/retro/0165-decompose-resolved-spawn-config.md +0 -78
- package/docs/retro/0166-extract-parent-session-info.md +0 -66
- package/docs/retro/0167-narrow-runner-io.md +0 -63
- package/docs/retro/0168-extract-tool-filter-config.md +0 -76
- package/docs/retro/0169-extract-run-context-from-run-options.md +0 -68
- package/docs/retro/0170-reduce-build-content-lines-complexity.md +0 -72
- package/docs/retro/0171-reduce-render-result-complexity.md +0 -77
- package/docs/retro/0172-extract-turn-formatting.md +0 -80
- package/docs/retro/0180-reorder-append-prompt-for-kv-cache.md +0 -62
- package/docs/retro/0185-remove-persistent-agent-memory.md +0 -73
- package/docs/retro/0188-replace-any-casts-with-sdk-types.md +0 -69
- package/docs/retro/0192-define-session-context-interface.md +0 -59
- package/docs/retro/0193-runtime-owns-context-queries.md +0 -75
- package/docs/retro/0194-align-tool-interfaces-for-structural-typing.md +0 -62
- package/docs/retro/0195-convert-tool-factories-to-classes.md +0 -84
- package/docs/retro/0196-convert-runner-menu-to-classes.md +0 -73
- package/docs/retro/0205-decompose-render-widget-lines.md +0 -64
- package/docs/retro/0206-decompose-show-agent-detail.md +0 -67
- package/docs/retro/0207-decompose-agent-widget-update.md +0 -92
- package/docs/retro/0208-extract-shared-test-fixtures.md +0 -102
- package/docs/retro/0214-convert-remaining-closure-factories-to-classes.md +0 -66
- package/docs/retro/0215-decompose-build-parent-context.md +0 -61
- package/docs/retro/0216-decompose-start-agent.md +0 -80
- package/docs/retro/0217-extract-overwrite-guard.md +0 -63
- package/docs/retro/0218-push-sdk-boundary-in-settings.md +0 -72
- package/docs/retro/0219-reduce-test-duplication-top-3-clone-families.md +0 -64
- package/docs/retro/0227-evolve-agent-record-into-agent.md +0 -80
- package/docs/retro/0228-async-start-agent-dissolve-run-handle.md +0 -80
- package/docs/retro/0229-agent-born-complete.md +0 -89
- package/docs/retro/0230-extract-concurrency-queue.md +0 -38
- package/docs/retro/0231-push-exec-registry-to-runner.md +0 -71
- package/docs/retro/0232-agent-resume-internal-observer-lifecycle.md +0 -109
- package/docs/retro/0237-remove-disallowed-tools.md +0 -78
- package/docs/retro/0238-remove-extensions-filtering.md +0 -72
- package/docs/retro/0239-collapse-filter-active-tools.md +0 -70
- package/docs/retro/0242-rename-agent-tool-to-subagent.md +0 -82
- package/docs/retro/0256-extract-worktree-isolation.md +0 -89
- package/docs/retro/0257-extract-child-session-factory.md +0 -33
- package/docs/retro/0262-add-workspace-provider-seam.md +0 -89
- package/docs/retro/0264-remove-extension-lifecycle-control.md +0 -91
- package/docs/retro/0265-born-complete-subagent-session.md +0 -97
- package/docs/retro/0270-type-consumable-public-surface.md +0 -108
- package/docs/retro/0272-export-workspace-collaborator-types.md +0 -38
- package/docs/retro/0277-encapsulate-agent-session.md +0 -80
- package/docs/retro/0280-rename-agent-to-subagent.md +0 -96
- package/docs/retro/0360-custom-agents-default-append.md +0 -81
- package/docs/retro/0373-extract-subagent-state.md +0 -94
- package/docs/retro/0374-encapsulate-subagent-start-notification.md +0 -171
- package/docs/retro/0375-extract-run-listener-workspace-bracket.md +0 -104
- package/docs/retro/0376-extract-manager-observer.md +0 -81
- package/docs/retro/0377-split-widget-delegation-from-runtime.md +0 -105
- package/docs/retro/0378-consolidate-lifecycle-test-fixtures.md +0 -100
- package/docs/retro/0379-consolidate-ui-tools-test-fixtures.md +0 -52
- package/docs/retro/0380-extract-layered-settings-loader.md +0 -97
- package/docs/retro/0381-replace-concurrency-queue-with-limiter.md +0 -95
- package/docs/retro/0400-include-parent-prompt-in-replace-mode.md +0 -84
- package/docs/retro/0403-abort-subagents-on-interrupt.md +0 -90
- package/docs/retro/0412-unify-session-mock-builders.md +0 -80
- package/docs/retro/0420-fold-run-metrics-live-activity-onto-record.md +0 -90
- package/docs/retro/0421-migrate-activity-readers-to-record-getters.md +0 -105
- package/docs/retro/0422-delete-activity-tracker-ui-observer.md +0 -97
- package/docs/retro/0423-widget-self-drive-from-lifecycle.md +0 -112
- package/docs/retro/0424-drop-widget-dep-from-subagent-tool.md +0 -89
- package/docs/retro/0425-reconcile-subagent-events-contract.md +0 -101
- package/docs/retro/0426-consolidate-residual-test-clone-families.md +0 -100
- package/docs/retro/0427-reconsider-ui-direction.md +0 -102
- package/docs/retro/0441-remove-agent-definition-management-subtree.md +0 -97
- package/docs/retro/0442-dissolve-agents-conversation-viewer.md +0 -108
- package/docs/retro/0443-consolidate-remaining-test-clone-families.md +0 -28
- package/docs/retro/0444-shrink-widget-to-background-agents.md +0 -81
- package/docs/retro/0445-native-session-navigation.md +0 -122
- package/docs/retro/0446-spike-session-navigation-entry-criteria.md +0 -99
- package/docs/retro/0447-extract-subagents-settings-command.md +0 -91
- package/docs/retro/0448-block-disabled-agent-spawn.md +0 -75
- package/docs/retro/0462-navigation-renderer-tui-components.md +0 -105
- package/docs/retro/0463-file-snapshot-source-evicted-agents.md +0 -103
- package/docs/retro/0470-refresh-readme-command-surface.md +0 -40
- package/src/observation/notification-state.ts +0 -27
- package/vitest.config.ts +0 -14
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 426
|
|
3
|
-
issue_title: "pi-subagents: consolidate residual test clone families"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Consolidate residual test clone families
|
|
7
|
-
|
|
8
|
-
## Release Recommendation
|
|
9
|
-
|
|
10
|
-
**Release:** ship independently
|
|
11
|
-
|
|
12
|
-
The architecture roadmap (`docs/architecture/architecture.md`, Phase 18, step 7) tags this issue "Independent of the disentanglement spine — can land at any time" and carries no `Release: batch` annotation.
|
|
13
|
-
It is a test-only consolidation with no production-surface change, so it ships on its own.
|
|
14
|
-
|
|
15
|
-
## Problem Statement
|
|
16
|
-
|
|
17
|
-
fallow reports a long tail of test clone groups in `pi-subagents` (currently 24 test clone groups across the suite).
|
|
18
|
-
A handful of these clone families are stable test scaffolding — tmp-directory setup, repeated arrange-then-act blocks, and near-identical menu-assertion cases — that the Phase 18 disentanglement spine does not rewrite as a side effect.
|
|
19
|
-
They warrant their own shared fixtures rather than riding along with a production refactor.
|
|
20
|
-
|
|
21
|
-
The goal is to extract shared fixtures for the clone families fallow identifies in the four named test files, dropping the package's test clone-group count below 15.
|
|
22
|
-
|
|
23
|
-
## Goals
|
|
24
|
-
|
|
25
|
-
- Eliminate the cross-file tmp-directory + `writeGlobal`/`writeProject` duplication between `test/settings.test.ts` and `test/layered-settings.test.ts` via a shared fixture helper.
|
|
26
|
-
- Eliminate the three internal clone groups in `test/lifecycle/create-subagent-session.test.ts` by extracting the repeated arrange (factory session + deps) while keeping each `createSubagentSession(...)` act explicit.
|
|
27
|
-
- Eliminate the four internal clone groups in `test/ui/agent-config-editor.test.ts` — convert the menu-option-structure cases to a table-driven `it.each` and hoist the shared `filePath`/arrange in the Edit/Delete blocks.
|
|
28
|
-
- Land the package below 15 test clone groups (the four files contribute exactly 10 of the current 24 groups → 14 remaining).
|
|
29
|
-
- Keep the full `vitest` suite green and the assertion strength unchanged (no behavioral coverage loss).
|
|
30
|
-
|
|
31
|
-
This change is **not breaking** — it touches only test files and adds test-only helpers; no production module, export, or default changes.
|
|
32
|
-
|
|
33
|
-
## Non-Goals
|
|
34
|
-
|
|
35
|
-
- The production-code clone in `src/ui/agent-config-editor.ts` (the `location`/`targetDir`/`targetPath` block, dup `ff960d84`) — the issue scopes to *test* clone families; a production extraction is a separate concern.
|
|
36
|
-
- The remaining test clone groups outside the four named files (`subagent-manager.test.ts`, `subagent.test.ts`, `concurrency-limiter.test.ts`, `workspace-bracket.test.ts`, `session-config.test.ts`, `get-result-tool.test.ts`, `spawn-config.test.ts`, `agent-creation-wizard.test.ts`, `agent-file-ops.test.ts`, `agent-menu.test.ts`, `agent-widget.test.ts`).
|
|
37
|
-
The cross-file group `5d8dbd48` (`subagent-manager.test.ts` ↔ `subagent.test.ts`) is explicitly left alone — neither side is a target file.
|
|
38
|
-
- The cross-package `vitest.config.ts` clone (`e5e6691e`, 6 instances) — not a `pi-subagents` test-suite group and not in scope.
|
|
39
|
-
- Phase 18 step 8 ([#427]), the UI-direction ADR — a separate, later step.
|
|
40
|
-
|
|
41
|
-
## Background
|
|
42
|
-
|
|
43
|
-
Relevant existing test-helper conventions live in `packages/pi-subagents/test/helpers/`:
|
|
44
|
-
|
|
45
|
-
- `make-deps.ts`, `make-spawn-config.ts`, `make-subagent.ts`, `manager-stubs.ts`, `mock-session.ts`, `stub-ctx.ts`, `subagent-session-io.ts`, `ui-stubs.ts` — each exports `createX`/`makeX` factory functions with matching `*.test.ts` self-tests.
|
|
46
|
-
- `subagent-session-io.ts` already exports `createFactorySession`, `createSubagentSessionDeps`, `createSubagentSessionIO`, `createAgentLookup`, `createChildLifecycleMock` — the create-subagent-session consolidation builds on these.
|
|
47
|
-
- `ui-stubs.ts` already exports `createTestSubagentConfig`, `makeFileOps`, `makeMenuUI` — the agent-config-editor consolidation builds on these.
|
|
48
|
-
|
|
49
|
-
Constraints from the `testing` skill that shape this plan:
|
|
50
|
-
|
|
51
|
-
- **Do not wrap the system-under-test call in a helper to eliminate a duplication-metric clone — the repeated act is the test subject, not duplication to remove.**
|
|
52
|
-
Consolidate the *arrange*, not the *act*.
|
|
53
|
-
For `create-subagent-session`, extract the factory-session + deps arrange but keep `await createSubagentSession(...)` written out in each test.
|
|
54
|
-
- **Group shared setup in a describe-scoped `beforeEach` and keep the act explicit** when the arrangement is uniform.
|
|
55
|
-
- A table-driven `it.each` keeps the act visible in the parameterized body (run once per row) and is the right tool for the menu-option-structure cases — it is not a helper that hides the act.
|
|
56
|
-
- Test-only refactors carry the `test:` conventional-commit type.
|
|
57
|
-
|
|
58
|
-
Each helper module in `test/helpers/` ships a paired `*.test.ts`; any new shared helper follows that convention.
|
|
59
|
-
|
|
60
|
-
## Design Overview
|
|
61
|
-
|
|
62
|
-
This is a refactor verified by the existing suite staying green plus a falling fallow clone count — there are no new red→green behavior cycles.
|
|
63
|
-
Three independent consolidations, each scoped to its file(s).
|
|
64
|
-
|
|
65
|
-
### 1. Settings tmp-dir fixture (cross-file)
|
|
66
|
-
|
|
67
|
-
`test/settings.test.ts` and `test/layered-settings.test.ts` both stand up two `mkdtempSync` directories in `beforeEach`, tear them down in `afterEach`, and define identical `writeGlobal`/`writeProject` helpers (clone groups `21d1fb01`, `4003c0e7` span both files; `4fc062db` is internal to `layered-settings.test.ts`).
|
|
68
|
-
|
|
69
|
-
Extract a shared fixture into `test/helpers/tmp-settings-dirs.ts`:
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
export interface SettingsDirs {
|
|
73
|
-
globalDir: string; // agentDir / global scope
|
|
74
|
-
projectDir: string; // cwd / project scope
|
|
75
|
-
globalFile: (filename?: string) => string;
|
|
76
|
-
projectFile: (filename?: string) => string;
|
|
77
|
-
writeGlobal: (obj: unknown, filename?: string) => void;
|
|
78
|
-
writeProject: (obj: unknown, filename?: string) => void;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Caller wires it into beforeEach/afterEach:
|
|
82
|
-
export function createSettingsDirs(filename: string): SettingsDirs;
|
|
83
|
-
export function disposeSettingsDirs(dirs: SettingsDirs): void;
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Each test file calls `createSettingsDirs(...)` in `beforeEach` and `disposeSettingsDirs(...)` in `afterEach`, then references `dirs.writeGlobal` / `dirs.writeProject`.
|
|
87
|
-
`settings.test.ts` uses `"subagents.json"`; `layered-settings.test.ts` uses its `FILENAME` constant.
|
|
88
|
-
The malformed-settings warn-assertion clone inside `layered-settings.test.ts` (`4fc062db`, two adjacent `it` blocks) collapses into a single `it.each` over `[malformed-global, malformed-project]` rows that share the spy-assert body.
|
|
89
|
-
|
|
90
|
-
Interaction sketch (consumer call site, ~5 lines):
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
let dirs: SettingsDirs;
|
|
94
|
-
beforeEach(() => { dirs = createSettingsDirs("subagents.json"); });
|
|
95
|
-
afterEach(() => { disposeSettingsDirs(dirs); });
|
|
96
|
-
it("loads from global when no project file", () => {
|
|
97
|
-
dirs.writeGlobal({ maxConcurrent: 16 });
|
|
98
|
-
expect(loadSettings(dirs.globalDir, dirs.projectDir)).toEqual({ maxConcurrent: 16 });
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
The helper owns only filesystem scaffolding (Tell-Don't-Ask: callers ask it to write, not for raw paths to write themselves); it does not import or know about `loadSettings`/`loadLayeredSettings`, so the act stays in the test.
|
|
103
|
-
|
|
104
|
-
### 2. create-subagent-session arrange helper (internal)
|
|
105
|
-
|
|
106
|
-
Clone groups `48ff1484`, `c92feb70`, `5fbe9ebb` all live in the `createSubagentSession — post-bind recursion guard` describe block (lines ~204–262).
|
|
107
|
-
Each test repeats:
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
const session = createFactorySession({ toolsBeforeBind, toolsAfterBind });
|
|
111
|
-
io.createSession.mockResolvedValue({ session });
|
|
112
|
-
await createSubagentSession(
|
|
113
|
-
{ snapshot: STUB_SNAPSHOT, type: "Explore" },
|
|
114
|
-
createSubagentSessionDeps({ io, exec, registry: mockAgentLookup }),
|
|
115
|
-
);
|
|
116
|
-
const postBindArgs = session.setActiveToolsByName.mock.calls[0][0];
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
The variation is the factory tool-list config and the assertions; the act is identical.
|
|
120
|
-
Add two file-local arrange helpers (the factory mocks differ per test, so a describe-scoped `beforeEach` cannot fully arrange):
|
|
121
|
-
|
|
122
|
-
```typescript
|
|
123
|
-
function arrangeFactory(opts?: Parameters<typeof createFactorySession>[0]) {
|
|
124
|
-
const session = createFactorySession(opts);
|
|
125
|
-
io.createSession.mockResolvedValue({ session });
|
|
126
|
-
return session;
|
|
127
|
-
}
|
|
128
|
-
function defaultDeps() {
|
|
129
|
-
return createSubagentSessionDeps({ io, exec, registry: mockAgentLookup });
|
|
130
|
-
}
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Each test becomes `const session = arrangeFactory({...}); await createSubagentSession({ snapshot: STUB_SNAPSHOT, type: "Explore" }, defaultDeps());` — the act line stays written out.
|
|
134
|
-
The remaining two-line arrange+act sequence falls below fallow's clone threshold.
|
|
135
|
-
These helpers stay file-local (one consumer file), so no new `test/helpers/` module is needed.
|
|
136
|
-
|
|
137
|
-
### 3. agent-config-editor table-driven menu cases (internal)
|
|
138
|
-
|
|
139
|
-
Clone groups `4ac7b228`, `a8e71e9c` (×3), `e36d2314` cluster in the "Menu option structure" block (lines ~104–139); `23fe1f93` is in the Edit/Delete blocks (~180–210).
|
|
140
|
-
|
|
141
|
-
- **Menu-option-structure cases** → one `it.each` table.
|
|
142
|
-
Each existing case differs only in (a) the `resolveAgentConfig` mock (default vs. custom vs. disabled) and (b) the expected option array.
|
|
143
|
-
Model the rows as `{ name, config, filePath, expected }` and run the shared act once per row:
|
|
144
|
-
|
|
145
|
-
```typescript
|
|
146
|
-
it.each([
|
|
147
|
-
{ name: "default agent, no file", config: testDefaultConfig, filePath: undefined,
|
|
148
|
-
expected: ["Eject (export as .md)", "Disable", "Back"] },
|
|
149
|
-
// …one row per existing menu-structure case…
|
|
150
|
-
])("shows $name options", async ({ config, filePath, expected }) => {
|
|
151
|
-
vi.spyOn(testRegistry, "resolveAgentConfig").mockReturnValue(config);
|
|
152
|
-
const { editor, ui } = setupDetail([undefined], filePath ? { filePath } : {});
|
|
153
|
-
await editor.showAgentDetail(ui, "test-agent");
|
|
154
|
-
expect((ui.select.mock.calls[0][1] as string[])).toEqual(expected);
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The act (`editor.showAgentDetail(...)`) stays visible in the table body.
|
|
159
|
-
- **Edit/Delete block (`23fe1f93`)** → hoist the shared `const filePath = "/project/.pi/agents/test-agent.md"` to a describe-scoped constant and keep each `await editor.showAgentDetail(...)` act explicit; the residual per-test arrange (`setupDetail`, `ui.editor`/`ui.confirm` resolution) stays inline because it carries the test's intent.
|
|
160
|
-
|
|
161
|
-
No change to `setupDetail`, `makeEditor`, or `ui-stubs.ts` — they already provide the right arrange seam.
|
|
162
|
-
|
|
163
|
-
## Module-Level Changes
|
|
164
|
-
|
|
165
|
-
- `test/helpers/tmp-settings-dirs.ts` — **new**: shared tmp-dir fixture (`createSettingsDirs`, `disposeSettingsDirs`, `SettingsDirs` type, `writeGlobal`/`writeProject`).
|
|
166
|
-
- `test/helpers/tmp-settings-dirs.test.ts` — **new**: self-test for the fixture (follows the `test/helpers/*.test.ts` convention — every helper module ships a paired test).
|
|
167
|
-
- `test/settings.test.ts` — **changed**: replace inline tmp-dir `beforeEach`/`afterEach`/`writeGlobal`/`writeProject` with the shared fixture.
|
|
168
|
-
- `test/layered-settings.test.ts` — **changed**: same fixture swap; fold the two adjacent malformed-settings warn cases into one `it.each`.
|
|
169
|
-
- `test/lifecycle/create-subagent-session.test.ts` — **changed**: add file-local `arrangeFactory`/`defaultDeps`; rewrite the post-bind-guard tests to call them while keeping each `createSubagentSession(...)` act explicit.
|
|
170
|
-
- `test/ui/agent-config-editor.test.ts` — **changed**: convert the menu-option-structure cases to `it.each`; hoist the shared `filePath` in the Edit/Delete blocks.
|
|
171
|
-
|
|
172
|
-
No `src/` files change.
|
|
173
|
-
No SKILL.md, architecture-doc, or README references to the affected test internals exist to update — these are intra-test fixtures (verified: the architecture roadmap references the *issue* `#426`, not the specific helpers).
|
|
174
|
-
The roadmap step's status flips to ✅ in a follow-up doc pass at ship time, not in this plan (consistent with how steps 1–6 were marked).
|
|
175
|
-
|
|
176
|
-
## Test Impact Analysis
|
|
177
|
-
|
|
178
|
-
This issue *is* a test-maintenance change, so the standard extraction lens is inverted:
|
|
179
|
-
|
|
180
|
-
1. **New tests enabled** — only the new `tmp-settings-dirs.test.ts`, a self-test pinning the shared fixture's filesystem behavior (writes land at the right global/project paths; dispose removes both dirs).
|
|
181
|
-
No production seam is newly testable.
|
|
182
|
-
2. **Tests becoming redundant** — none are removed outright.
|
|
183
|
-
The two malformed-settings cases in `layered-settings.test.ts` merge into one `it.each` (two rows = same two assertions, no coverage loss); the agent-config-editor menu cases merge into one `it.each` (one row per former case, identical assertions).
|
|
184
|
-
The total assertion set is preserved; only the surrounding arrange is deduplicated.
|
|
185
|
-
3. **Tests that must stay as-is** — the act in every consolidated test (`loadSettings`/`loadLayeredSettings`/`createSubagentSession`/`showAgentDetail`) stays written out per the `testing` skill rule; the distinct intent of each Edit/Delete case (write vs. no-write vs. cancel) stays inline.
|
|
186
|
-
|
|
187
|
-
## Invariants at risk
|
|
188
|
-
|
|
189
|
-
The four target files belong to surfaces earlier Phase 17/18 steps refactored (`subagent-session-io.ts` fixtures from #378/#412; `create-subagent-session` from #257/#265; `agent-config-editor` UI from the disentanglement spine).
|
|
190
|
-
The invariant at risk is purely **coverage preservation** — a consolidation must not silently drop an assertion.
|
|
191
|
-
Each consolidation step is gated by:
|
|
192
|
-
|
|
193
|
-
- The full `vitest` suite staying green (test count must not *drop* except by the deliberate `it.each` merges, whose row count equals the former case count).
|
|
194
|
-
- Running `pnpm fallow dupes` after each step to confirm the targeted clone groups disappear and no new ones appear.
|
|
195
|
-
|
|
196
|
-
No production `Outcome:`/`Landed:` invariant from a prior roadmap step is touched, because no `src/` file changes.
|
|
197
|
-
|
|
198
|
-
## Refactor Order
|
|
199
|
-
|
|
200
|
-
These are refactor (not red→green) steps: each makes a consolidation, verifies the suite stays green and the targeted clone groups drop, then commits with `test:`.
|
|
201
|
-
Order is independent — the three consolidations do not depend on each other — but listed for clean, reviewable commits.
|
|
202
|
-
|
|
203
|
-
1. **Shared settings tmp-dir fixture.**
|
|
204
|
-
Add `test/helpers/tmp-settings-dirs.ts` + `tmp-settings-dirs.test.ts`; migrate `test/settings.test.ts` and `test/layered-settings.test.ts` to it; fold the two malformed-settings cases in `layered-settings.test.ts` into one `it.each`.
|
|
205
|
-
Verify: `pnpm --filter @gotgenes/pi-subagents exec vitest run test/settings.test.ts test/layered-settings.test.ts test/helpers/tmp-settings-dirs.test.ts` green; `pnpm fallow dupes` shows `21d1fb01`, `4003c0e7`, `4fc062db` gone.
|
|
206
|
-
Commit: `test: extract shared settings tmp-dir fixture (#426)`.
|
|
207
|
-
2. **create-subagent-session arrange helpers.**
|
|
208
|
-
Add file-local `arrangeFactory`/`defaultDeps`; rewrite the post-bind-guard tests to use them with the act kept explicit.
|
|
209
|
-
Verify: `pnpm --filter @gotgenes/pi-subagents exec vitest run test/lifecycle/create-subagent-session.test.ts` green; clone groups `48ff1484`, `c92feb70`, `5fbe9ebb` gone.
|
|
210
|
-
Commit: `test: consolidate create-subagent-session post-bind arrange (#426)`.
|
|
211
|
-
3. **agent-config-editor table-driven menu cases.**
|
|
212
|
-
Convert the menu-option-structure cases to `it.each`; hoist the shared `filePath` in the Edit/Delete blocks.
|
|
213
|
-
Verify: `pnpm --filter @gotgenes/pi-subagents exec vitest run test/ui/agent-config-editor.test.ts` green; clone groups `4ac7b228`, `a8e71e9c`, `e36d2314`, `23fe1f93` gone.
|
|
214
|
-
Commit: `test: table-drive agent-config-editor menu cases (#426)`.
|
|
215
|
-
4. **Final verification.**
|
|
216
|
-
Run the full suite (`pnpm --filter @gotgenes/pi-subagents exec vitest run`), `pnpm run check`, `pnpm run lint`, `pnpm fallow dead-code` (catch orphaned imports left by removed inline helpers), and `pnpm fallow dupes` to confirm the package's test clone-group count is below 15 (expected: 24 → 14).
|
|
217
|
-
No separate commit unless cleanup is needed.
|
|
218
|
-
|
|
219
|
-
## Risks and Mitigations
|
|
220
|
-
|
|
221
|
-
- **Risk: an `it.each` merge silently drops an assertion.**
|
|
222
|
-
Mitigation: map each former `it` to exactly one table row with the same assertions; confirm the post-merge test count equals (old count − merged duplicates) and the suite stays green.
|
|
223
|
-
- **Risk: removing an inline `writeGlobal`/`writeProject` leaves an orphaned import** (Biome `noUnusedImports` is warning-level, exit 0).
|
|
224
|
-
Mitigation: step 4 runs `pnpm fallow dead-code`; re-check each migrated file's imports (`mkdirSync`, `writeFileSync`, `mkdtempSync`, `rmSync`, `tmpdir`, `join`) after the fixture swap.
|
|
225
|
-
- **Risk: a helper that wraps the act re-introduces the "act is the subject" smell.**
|
|
226
|
-
Mitigation: the design keeps every `loadSettings`/`createSubagentSession`/`showAgentDetail` call written out in the test body; helpers cover arrange only.
|
|
227
|
-
- **Risk: the fixture's `filename` parameterization diverges from the two call sites' expectations** (`subagents.json` vs. `FILENAME`).
|
|
228
|
-
Mitigation: `createSettingsDirs(filename)` takes the filename explicitly; the self-test pins both path shapes.
|
|
229
|
-
|
|
230
|
-
## Open Questions
|
|
231
|
-
|
|
232
|
-
- Whether to also dissolve the production clone in `src/ui/agent-config-editor.ts` (dup `ff960d84`) — deferred as a Non-Goal; revisit if the Phase 18 UI-direction ADR (#427) reworks that file anyway.
|
|
233
|
-
- Whether a shared tmp-dir fixture should live in a cross-package location (other packages stand up similar dirs) — out of scope; keep it `pi-subagents`-local until a second consumer appears.
|
|
234
|
-
|
|
235
|
-
[#427]: https://github.com/gotgenes/pi-packages/issues/427
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 427
|
|
3
|
-
issue_title: "pi-subagents: reconsider the UI direction from first principles (ADR)"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Reconsider the UI direction from first principles (ADR)
|
|
7
|
-
|
|
8
|
-
## Release Recommendation
|
|
9
|
-
|
|
10
|
-
**Release:** ship independently
|
|
11
|
-
|
|
12
|
-
Phase 18 carries no `Release:` batch annotation in the architecture roadmap, so this issue ships on its own.
|
|
13
|
-
It is a decision-only ADR plus an architecture-doc update — docs-only, no runtime change — and it completes the Phase 18 roadmap, gateway-ing the (separately planned) Phase 19 implementation.
|
|
14
|
-
|
|
15
|
-
## Problem Statement
|
|
16
|
-
|
|
17
|
-
Phase 18's spine (Steps 1–7) disentangled the activity tier from the core, leaving the inherited UI a pure reactive consumer of the broadcast-plus-query surface.
|
|
18
|
-
The UI is now _substitutable_.
|
|
19
|
-
This final step (Step 8, [#427]) decides the UI's _direction and distribution_, not whether substitution is possible — and records the decision in an ADR that gateways Phase 19.
|
|
20
|
-
|
|
21
|
-
The decision is **per component** (widget, conversation viewer, `/agents` menu) and per the architecture's own first principles: keep, shrink, extract to a separate package, or remove — judged on our terms, not preserved by default.
|
|
22
|
-
Two standing concerns are the evidence:
|
|
23
|
-
|
|
24
|
-
- **Foreground widget redundancy** — in foreground the tool's inline `onUpdate` stream already shows progress, so the above-editor widget duplicates it; the widget earns its keep only for background agents.
|
|
25
|
-
- **Truncated transcript** — the bespoke conversation viewer renders a custom, capped transcript, yet each child is already persisted as a standard Pi session JSONL (`outputFile`); the limit is the bespoke overlay, not data access.
|
|
26
|
-
|
|
27
|
-
## Goals
|
|
28
|
-
|
|
29
|
-
- Write `docs/decisions/0004-reconsider-ui-direction.md` recording a per-component decision for the widget, the conversation viewer, and the `/agents` menu.
|
|
30
|
-
- Record the **distribution** decision: the surviving UI stays in-core as a reactive consumer (substitutable, not extracted to a separate package now).
|
|
31
|
-
- Record the open feasibility questions for the native-session-navigation direction as Phase 19 spike gates (not pretend-resolved).
|
|
32
|
-
- Update `docs/architecture/architecture.md`: mark Phase 18 Step 8 complete, mark Phase 18 complete, and add a forward pointer to ADR-0004 / Phase 19.
|
|
33
|
-
- This is a **decision-only** ADR — no `src/` or `test/` changes; the implementation lands in the separately-planned Phase 19.
|
|
34
|
-
|
|
35
|
-
## Non-Goals
|
|
36
|
-
|
|
37
|
-
- No UI code changes (no widget edit, no viewer removal, no menu decomposition, no new `/subagents:settings` command).
|
|
38
|
-
Those are Phase 19 implementation, planned and shipped separately.
|
|
39
|
-
- No new `@gotgenes/pi-subagents-ui` package — extraction is explicitly _not_ chosen now.
|
|
40
|
-
- No resolution of the `switchSession` mechanics (root-continuity, view-only-vs-interactive) — the ADR records these as Phase 19 spike entry criteria.
|
|
41
|
-
- No full Phase 19 roadmap — the arch-doc update adds only a forward pointer; Phase 19's steps are planned in their own pass.
|
|
42
|
-
- No SKILL.md edits — `package-pi-subagents` SKILL describes the UI domain's module count, which changes only when Phase 19 code lands.
|
|
43
|
-
|
|
44
|
-
## Background
|
|
45
|
-
|
|
46
|
-
Relevant modules and how they relate:
|
|
47
|
-
|
|
48
|
-
- `src/ui/agent-widget.ts` (~290 LOC) — `AgentWidget implements SubagentManagerObserver`; self-drives an 80 ms render loop from lifecycle events (Step 4, [#423]), renders running/completed agents above the editor.
|
|
49
|
-
- `src/ui/conversation-viewer.ts` (~241 LOC) — bespoke `ConversationViewer` overlay; subscribes to `record.subscribeToUpdates`, renders a live, width-capped transcript of one agent's `messages`, plus a streaming indicator.
|
|
50
|
-
- `src/ui/agent-menu.ts` (~331 LOC) + `agent-config-editor.ts`, `agent-creation-wizard.ts`, `agent-file-ops.ts` — the `/agents` command.
|
|
51
|
-
Four entries: **Running agents** (→ `ConversationViewer`), **Agent types** (→ `AgentConfigEditor` view/edit/enable/disable), **Create new agent** (→ `AgentCreationWizard`), **Settings** (max concurrency / default max turns / grace turns, written to layered settings).
|
|
52
|
-
- `src/tools/foreground-runner.ts` — foreground runs stream progress via the tool's inline `onUpdate` callback; the result is rendered by `result-renderer.ts` (caps display at 50 lines).
|
|
53
|
-
- The core persists each child as a standalone Pi session JSONL at `Subagent.outputFile`; `Subagent.messages` exposes full history.
|
|
54
|
-
|
|
55
|
-
Pi SDK surface relevant to the candidate redesign (verified against `@earendil-works/pi-coding-agent@0.79.1`):
|
|
56
|
-
|
|
57
|
-
- `ExtensionActions.switchSession(sessionPath, { withSession })` — switches the **active** session to a different session file; fires `session_before_switch` / `session_shutdown` and invalidates the current session context (`setBeforeSessionInvalidate` exists for host-owned UI teardown).
|
|
58
|
-
Returns `{ cancelled }`.
|
|
59
|
-
The switched-to session is fully interactive — `ReplacedSessionContext` exposes `sendUserMessage`.
|
|
60
|
-
- `session-manager` exports `loadEntriesFromFile(filePath)` / `parseSessionEntries(content)` — read a session file's entries without switching (the read-only alternative).
|
|
61
|
-
|
|
62
|
-
Constraint from AGENTS.md / the package SKILL: pi-subagents is a minimal core, open for extension and closed for modification; the UI is an _observational consumer_ (unlimited, the core never waits on it), distinct from the rationed generative `WorkspaceProvider` seam.
|
|
63
|
-
The ADR records a consumer-design decision; it must not introduce any new inbound dependency from the core onto the UI.
|
|
64
|
-
|
|
65
|
-
## Design Overview
|
|
66
|
-
|
|
67
|
-
The ADR records four decisions, each motivated by the first principles in the architecture doc's "first-principles refinement."
|
|
68
|
-
|
|
69
|
-
### Decision A — Foreground widget: shrink to background agents only
|
|
70
|
-
|
|
71
|
-
The above-editor widget duplicates the foreground tool's inline `onUpdate` stream.
|
|
72
|
-
Decision: the widget survives **only** as the background-agent status surface (concern (b): background agents have no tool-call display, so _something_ must indicate their state).
|
|
73
|
-
Foreground runs suppress the widget; the inline stream is authoritative there.
|
|
74
|
-
|
|
75
|
-
Multiple subagents can run in parallel, so the background surface must represent N concurrent agents at once — the widget's existing per-agent tree already does this; the change is _when_ it shows (background-only), not _what_ it shows.
|
|
76
|
-
|
|
77
|
-
### Decision B — Conversation viewer: replace the bespoke overlay with native session navigation
|
|
78
|
-
|
|
79
|
-
Concern (c) — "let the operator switch into a subagent's session, scroll/read it, switch between subagents, and exit back to root" — is a richer interaction than a live overlay.
|
|
80
|
-
The core already persists each child as a standalone Pi session JSONL, so this maps onto Pi's own session machinery rather than a bespoke renderer.
|
|
81
|
-
|
|
82
|
-
Decision (direction): **remove `ConversationViewer`**; the operator navigates into a child's persisted session via Pi's native viewer and back to root.
|
|
83
|
-
The bespoke, width-capped transcript is replaced by the same viewer Pi uses for any session — the recursive-Pi insight applied to the already-persisted session file.
|
|
84
|
-
|
|
85
|
-
Candidate call-site shape (Phase 19, illustrative — verifies the interaction pattern, not final):
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
// "View running agents" → pick a child → switch into its persisted session
|
|
89
|
-
const child = manager.getRecord(id);
|
|
90
|
-
if (child?.outputFile) {
|
|
91
|
-
await ctx.switchSession(child.outputFile);
|
|
92
|
-
// operator reads/scrolls in Pi's native viewer; a later switch returns to root
|
|
93
|
-
}
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
This is Tell-Don't-Ask (hand Pi the session path; Pi owns the viewer) and keeps the core free of transcript-rendering code.
|
|
97
|
-
|
|
98
|
-
Open mechanics (recorded in the ADR, resolved by a Phase 19 spike — see Open Questions): `switchSession` is a full active-session takeover (not a view-only overlay), it invalidates the current session context, and the switched-to session is interactive.
|
|
99
|
-
The spike decides whether the operator UX is (i) true `switchSession` round-trips, or (ii) a read-only transcript built from `loadEntriesFromFile` that renders Pi-standard entries without leaving root.
|
|
100
|
-
The ADR records the _direction_ (native session machinery over a bespoke renderer) and gates the mechanism on the spike.
|
|
101
|
-
|
|
102
|
-
### Decision C — `/agents` menu: dissolve the monolithic command into focused surfaces
|
|
103
|
-
|
|
104
|
-
The single `/agents` command bundles four unrelated jobs.
|
|
105
|
-
Decision (direction): split them; do not keep all in one command.
|
|
106
|
-
The operator does not value managing agent definitions through the menu at all — creating or editing agents is firmly better done with other tools (directly in Pi, or a real text editor / IDE), so both of those surfaces are **removed outright**, not merely deprioritized.
|
|
107
|
-
|
|
108
|
-
- **Create new agent (wizard)** → **remove.**
|
|
109
|
-
An operator generates a new agent `.md` by asking a Pi agent directly (more capable than a fixed wizard) or by writing the file in an editor — the wizard earns no keep.
|
|
110
|
-
- **Agent types (list + config editor)** → **remove.**
|
|
111
|
-
Viewing and editing agent definitions is better served by opening the `.md` files directly in an editor/IDE; the in-menu config editor earns no keep.
|
|
112
|
-
- **Running agents (visibility)** → **keep the responsibility, re-home it.**
|
|
113
|
-
_Something_ must own running-agent visibility; it moves onto the background widget (Decision A) plus the native session navigation (Decision B), not a bespoke in-menu overlay.
|
|
114
|
-
- **Settings (concurrency / max turns / grace turns)** → **extract to a focused command** (e.g. `/subagents:settings`).
|
|
115
|
-
Some value, but it does not belong bundled with agent management.
|
|
116
|
-
|
|
117
|
-
### Decision D — Distribution: keep the surviving UI in-core (substitutable, not extracted)
|
|
118
|
-
|
|
119
|
-
The spine already made the UI substitutable — a replacement UI is a downstream concern that targets the public broadcast-plus-query surface.
|
|
120
|
-
Decision: the surviving UI (background widget + a settings command + session-navigation glue) **stays in-core** as a reactive consumer.
|
|
121
|
-
Extraction to `@gotgenes/pi-subagents-ui` is _not_ chosen now; it remains an available future option precisely because the core is byte-for-byte identical with or without a given UI consumer (the composition invariant).
|
|
122
|
-
|
|
123
|
-
This answers the issue's headline question — the UI's _distribution_ — with "keep in core, substitutable," recorded explicitly rather than left implicit.
|
|
124
|
-
|
|
125
|
-
## Module-Level Changes
|
|
126
|
-
|
|
127
|
-
This is a decision-only ADR; the only files touched are docs.
|
|
128
|
-
|
|
129
|
-
- **New:** `packages/pi-subagents/docs/decisions/0004-reconsider-ui-direction.md`.
|
|
130
|
-
Frontmatter (`status: accepted`, `date: <ISO date>`), then `# 0004 — ...`, `## Status`, `## Context`, `## Decision` (Decisions A–D), `## Consequences`, `## Phase 19 entry criteria` (the spike gates + per-component implementation handles).
|
|
131
|
-
- **Changed:** `packages/pi-subagents/docs/architecture/architecture.md`:
|
|
132
|
-
- Phase 18 Step 8 (`### Steps`, item 8) — mark complete with a `Landed:` bullet referencing ADR-0004 and the recorded decisions.
|
|
133
|
-
- Step dependency diagram node `S8` — append a ✅ marker (matching S1–S7) so the diagram is consistent.
|
|
134
|
-
- The phase summary table row `| 18 | Reconsider UI (first principles) | In progress |` → `Complete`, and add the per-phase pointer to the ADR.
|
|
135
|
-
- Add a forward-pointer line gateway-ing Phase 19 (implementation of the recorded decisions, planned separately).
|
|
136
|
-
- Add a `[#427]` reference usage is already present; no new link-ref definition needed.
|
|
137
|
-
Add an ADR-0004 reference link if the doc cites it by path.
|
|
138
|
-
|
|
139
|
-
No `src/`, `test/`, or SKILL.md changes — every removed-symbol / reworded-mechanism check is therefore vacuous for this issue (no symbols removed, no runtime mechanism reworded).
|
|
140
|
-
The architecture doc's UI-domain module count and health metrics are _not_ edited here — they change when Phase 19 code lands.
|
|
141
|
-
|
|
142
|
-
## Test Impact Analysis
|
|
143
|
-
|
|
144
|
-
None — this is a docs-only ADR.
|
|
145
|
-
|
|
146
|
-
1. No new unit tests are enabled (no extraction, no behavior change).
|
|
147
|
-
2. No existing tests become redundant (no code removed).
|
|
148
|
-
3. No tests must stay-as-is for a layer being extracted (nothing is extracted in this issue).
|
|
149
|
-
|
|
150
|
-
The Phase 19 implementation that acts on these decisions will carry its own Test Impact Analysis when it is planned.
|
|
151
|
-
|
|
152
|
-
## Invariants at risk
|
|
153
|
-
|
|
154
|
-
None regressed by this issue — it changes no code, so every Phase 18 spine outcome stays green by construction.
|
|
155
|
-
|
|
156
|
-
The ADR _records_ that Phase 19 must preserve these spine invariants when it implements the decisions:
|
|
157
|
-
|
|
158
|
-
- Step 3 ([#422]) outcome "runtime holds zero UI state" — Phase 19 must not re-introduce UI state on the core when wiring the background-only widget or session navigation.
|
|
159
|
-
- Step 4/5 ([#423], [#424]) outcome "the widget is a reactive consumer; no inbound calls from core spawn tools / the LLM tool depends only on manager/runtime/settings/registry" — the background-only restriction and the `/agents` decomposition must keep the dependency direction inward.
|
|
160
|
-
- Step 6 ([#425]) outcome "declared channels equal emitted channels; no vacant hook" — any new navigation surface must consume existing broadcast/query channels, not add a vacant one.
|
|
161
|
-
|
|
162
|
-
These are pinned today by the existing observer/widget/event-contract suites; Phase 19 inherits them.
|
|
163
|
-
|
|
164
|
-
## Build Order
|
|
165
|
-
|
|
166
|
-
Docs-only — no red→green test cycles.
|
|
167
|
-
Numbered build steps, each a single reviewable commit.
|
|
168
|
-
|
|
169
|
-
1. **Write ADR-0004.**
|
|
170
|
-
Author `docs/decisions/0004-reconsider-ui-direction.md` with Status / Context / Decision (A–D) / Consequences / Phase 19 entry criteria, capturing the `switchSession` findings and open mechanics.
|
|
171
|
-
Verify: `pnpm run lint` passes (rumdl markdown rules); the ADR states a decision for every component named in [#427].
|
|
172
|
-
Commit: `docs: add ADR-0004 reconsidering the UI direction (#427)`.
|
|
173
|
-
2. **Update the architecture doc.**
|
|
174
|
-
Mark Phase 18 Step 8 complete (Landed bullet → ADR-0004), append ✅ to the `S8` diagram node, flip the phase table row to Complete, and add the Phase 19 forward pointer.
|
|
175
|
-
Verify: `pnpm run lint` passes; the `[#427]` reference still resolves; no orphaned link-ref definitions (MD053); Phase 18 reads as complete end-to-end.
|
|
176
|
-
Commit: `docs: mark Phase 18 complete and gateway Phase 19 (#427)`.
|
|
177
|
-
|
|
178
|
-
(Both steps may be folded into one commit if preferred; kept separate here because they touch different documents with different review concerns.)
|
|
179
|
-
|
|
180
|
-
## Risks and Mitigations
|
|
181
|
-
|
|
182
|
-
- **Risk:** the ADR over-commits to `switchSession` before its mechanics are understood, locking Phase 19 into an infeasible UX.
|
|
183
|
-
**Mitigation:** the ADR records the _direction_ (native session machinery over a bespoke renderer) and explicitly gates the _mechanism_ on a Phase 19 spike, listing the read-only `loadEntriesFromFile` fallback as a first-class alternative.
|
|
184
|
-
- **Risk:** removing the conversation viewer and the running-agents menu entry leaves a visibility gap before Phase 19 ships.
|
|
185
|
-
**Mitigation:** this issue removes _nothing_ — it only records decisions; the viewer/menu stay live until Phase 19 replaces them, so there is no interim regression.
|
|
186
|
-
- **Risk:** the arch-doc edits silently drop an enclosing structure (the Steps list, the diagram fence, the phase table).
|
|
187
|
-
**Mitigation:** anchor edits on unique adjacent lines, re-read each edited region after editing, and run `pnpm run lint` to confirm the Mermaid fence and tables still parse.
|
|
188
|
-
- **Risk:** a future reader treats the recorded "keep in core" distribution decision as permanent.
|
|
189
|
-
**Mitigation:** the ADR frames extraction as a still-available option enabled by the composition invariant, with the conditions under which it would be revisited.
|
|
190
|
-
|
|
191
|
-
## Open Questions
|
|
192
|
-
|
|
193
|
-
These are recorded in the ADR as Phase 19 spike entry criteria, not resolved here:
|
|
194
|
-
|
|
195
|
-
- **Root-continuity during a session switch.**
|
|
196
|
-
`switchSession` invalidates the current session context — does the root's in-flight turn survive a switch-out-and-return, and what is the correct "return to root" gesture?
|
|
197
|
-
Spike before committing Phase 19 to true `switchSession` round-trips.
|
|
198
|
-
- **View-only vs interactive.**
|
|
199
|
-
A switched-to child session is interactive (`sendUserMessage`).
|
|
200
|
-
Is steering a child from its own session desirable, or should the viewer be strictly read-only (favoring the `loadEntriesFromFile` transcript path)?
|
|
201
|
-
- **Parallel-agent navigation.**
|
|
202
|
-
With N background agents running, what is the operator's gesture to pick which child to view and to cycle between them — driven from the background widget, a dedicated command, or both?
|
|
203
|
-
- **Settings command namespace.**
|
|
204
|
-
Confirm the final command name/namespace for the extracted settings surface (`/subagents:settings` vs another form) against how sibling packages register namespaced commands.
|
|
205
|
-
|
|
206
|
-
The agent create/edit surfaces are _not_ open questions: the operator firmly removes both (managing agent definitions belongs in an editor/IDE or a Pi agent, not the menu).
|
|
207
|
-
|
|
208
|
-
[#422]: https://github.com/gotgenes/pi-packages/issues/422
|
|
209
|
-
[#423]: https://github.com/gotgenes/pi-packages/issues/423
|
|
210
|
-
[#424]: https://github.com/gotgenes/pi-packages/issues/424
|
|
211
|
-
[#425]: https://github.com/gotgenes/pi-packages/issues/425
|
|
212
|
-
[#427]: https://github.com/gotgenes/pi-packages/issues/427
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
issue: 441
|
|
3
|
-
issue_title: "pi-subagents: remove the orphaned agent-definition management subtree"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Remove the orphaned agent-definition management subtree
|
|
7
|
-
|
|
8
|
-
## Release Recommendation
|
|
9
|
-
|
|
10
|
-
**Release:** ship now — batch "dissolve-agents" tail (this issue completes the batch)
|
|
11
|
-
|
|
12
|
-
This issue is Phase 19 Step 6, the tail of release batch "dissolve-agents" (Steps 5–6) in `docs/architecture/architecture.md`.
|
|
13
|
-
Step 5 ([#442], commit `cb813f2c`) landed a breaking `feat(pi-subagents)!:` that is still **unreleased** — it sits after the latest tag `pi-subagents-v17.5.0`.
|
|
14
|
-
Landing this tail completes the batch and lets release-please cut the major bump that carries Step 5's `/agents` removal.
|
|
15
|
-
|
|
16
|
-
## Problem Statement
|
|
17
|
-
|
|
18
|
-
ADR-0004 Decision C removes both agent-definition surfaces: creating a new agent is better done by asking a Pi session directly (more capable than a fixed wizard) or by writing the `.md` file in an editor, and viewing or editing definitions is better served by opening the `.md` files in an editor or IDE.
|
|
19
|
-
Phase 19 Step 5 ([#442]) deleted `agent-menu.ts` — the only importer of the creation wizard, config editor, and their file-ops helpers — so this subtree is now pure dead code.
|
|
20
|
-
This step is the second of two deletion commits in the Phase 19 terminal cut: a clean `git rm` of the orphaned modules, with no surviving references and no edit to any doomed file.
|
|
21
|
-
|
|
22
|
-
## Goals
|
|
23
|
-
|
|
24
|
-
- Delete the orphaned creation wizard, config editor, and their two file-ops helper modules, plus their tests.
|
|
25
|
-
- Delete the transient `menu-ui.ts` module, orphaned once its only consumers (the wizard and editor) are gone.
|
|
26
|
-
- Prune the now-unused helpers from `test/helpers/ui-stubs.ts`, keeping only the helper a surviving test still uses.
|
|
27
|
-
- Drive the package's remaining production duplication to zero (the 11-line internal clone in `disableAgent`/`ejectAgent` dies with `agent-config-editor.ts`).
|
|
28
|
-
- This is **not** a breaking change at this step: the modules are already unreachable after Step 5, so deleting them changes no observable behavior — the user-facing removal already shipped (unreleased) in Step 5's `feat!:`.
|
|
29
|
-
|
|
30
|
-
## Non-Goals
|
|
31
|
-
|
|
32
|
-
- No change to `index.ts` — it already references none of the deleted symbols (verified by grep); the dewiring happened in Step 5.
|
|
33
|
-
- No change to the surviving UI modules (`agent-widget.ts`, `display.ts`, `session-navigation.ts`, `session-navigator.ts`, `subagents-settings.ts`, `widget-renderer.ts`).
|
|
34
|
-
- No change to `subagents-settings.ts`, which carries its own `SubagentsSettingsUI` interface and never depended on `MenuUI`.
|
|
35
|
-
- Test clone consolidation (Phase 19 Step 7, [#443]) — runs after this cut so no surviving helper is extracted into a doomed file.
|
|
36
|
-
|
|
37
|
-
## Background
|
|
38
|
-
|
|
39
|
-
Relevant modules and their current dependency facts (verified against `main`):
|
|
40
|
-
|
|
41
|
-
- `src/ui/agent-creation-wizard.ts` (235 LOC) — `AgentCreationWizard` class; imports `AgentFileOps`, `writeAgentFile`, and `MenuUI` from its siblings.
|
|
42
|
-
- `src/ui/agent-config-editor.ts` (201 LOC) — `AgentConfigEditor` class plus `buildMenuOptions`/`buildEjectContent`; imports `AgentFileOps`, `writeAgentFile`, and `MenuUI`.
|
|
43
|
-
Contains the package's only remaining production clone (the 11-line `disableAgent`/`ejectAgent` block).
|
|
44
|
-
- `src/ui/agent-file-ops.ts` (59 LOC) — `AgentFileOps` interface + `FsAgentFileOps`; only consumers were the wizard and editor.
|
|
45
|
-
- `src/ui/agent-file-writer.ts` (55 LOC) — `writeAgentFile` + narrow interfaces; only consumers were the wizard and editor.
|
|
46
|
-
- `src/ui/menu-ui.ts` (9 LOC) — the `MenuUI` interface, extracted in Step 5's tidy-first prep commit (`bb03efd7`) to break a bidirectional type cycle.
|
|
47
|
-
After this step deletes the wizard and editor, `menu-ui.ts` has zero importers.
|
|
48
|
-
The architecture doc marks it for removal here: its current-state directory listing reads `menu-ui.ts transient: MenuUI interface (removed with wizard/editor in #441)` (line 346), and the Step 5 entry states "The `menu-ui.ts` module is transient and is removed with the wizard/editor in Step 6" (line 1076).
|
|
49
|
-
|
|
50
|
-
Orphan verification (grep across `src/`, excluding the doomed files themselves): **no** surviving importer of any of the five modules or their exported symbols (`AgentCreationWizard`, `AgentConfigEditor`, `FsAgentFileOps`, `writeAgentFile`, `MenuUI`).
|
|
51
|
-
`src/index.ts` references none of them.
|
|
52
|
-
|
|
53
|
-
Test-helper facts (`test/helpers/ui-stubs.ts`), evaluated **after** the four doomed test files are deleted:
|
|
54
|
-
|
|
55
|
-
- `makeMenuUI` — still imported by `test/ui/subagents-settings.test.ts` → **survives**.
|
|
56
|
-
- `makeFileOps` — only remaining importer is its own self-test `ui-stubs.test.ts` → orphan.
|
|
57
|
-
- `makeMenuManager` (including the wizard `spawnAndWait` relay) — only remaining importer is `ui-stubs.test.ts` → orphan.
|
|
58
|
-
- `createTestSubagentConfig` (and its private `DEFAULT_TEST_AGENT_CONFIG`) — only remaining importer is `ui-stubs.test.ts` → orphan.
|
|
59
|
-
|
|
60
|
-
AGENTS.md constraints that apply:
|
|
61
|
-
|
|
62
|
-
- Run `pnpm fallow dead-code` locally before pushing — CI gates on it.
|
|
63
|
-
- Conventional Commits; reference the issue as `(#441)` in the subject, never `Closes #441`.
|
|
64
|
-
- `pnpm` only; package-scoped scripts via `pnpm --filter @gotgenes/pi-subagents`.
|
|
65
|
-
|
|
66
|
-
## Design Overview
|
|
67
|
-
|
|
68
|
-
This is a deletion-only change — no new collaborators, no shared-interface edits, no behavior moved.
|
|
69
|
-
There is nothing to extract and no decision model beyond "delete the orphans, leave `fallow` clean."
|
|
70
|
-
|
|
71
|
-
Two clarifications where the issue body is less precise than the authoritative architecture doc:
|
|
72
|
-
|
|
73
|
-
1. **`menu-ui.ts` is in scope.**
|
|
74
|
-
The issue body's "Proposed change" lists only the four modules, but `menu-ui.ts` is orphaned by the same cut and the architecture doc (lines 346, 1076) explicitly schedules its removal here.
|
|
75
|
-
Deleting it in the same commit as the wizard/editor avoids a dangling `import type { MenuUI }` and a `fallow dead-code` flag.
|
|
76
|
-
|
|
77
|
-
2. **`makeMenuManager` is removed whole, not just its `spawnAndWait` field.**
|
|
78
|
-
The issue body says to prune the "wizard `spawnAndWait` relay," but after the four test files are deleted, `makeMenuManager`'s only remaining caller is its own self-test.
|
|
79
|
-
A test helper whose sole consumer is its own unit test is exactly the residual clutter the Phase 19 cut eliminates, so the whole helper (and its `describe` block) goes.
|
|
80
|
-
The architecture doc's Step 6 phrasing — "delete … `spawnAndWait` from `makeMenuManager` **if no surviving consumer remains**; delete the file outright once all consumers are gone" — licenses this: no real consumer remains.
|
|
81
|
-
`ui-stubs.ts` itself survives because `makeMenuUI` still has a real consumer.
|
|
82
|
-
|
|
83
|
-
End state of `test/helpers/ui-stubs.ts`: a single `makeMenuUI` export plus its file header.
|
|
84
|
-
End state of `test/helpers/ui-stubs.test.ts`: the `makeMenuUI` `describe` block only.
|
|
85
|
-
|
|
86
|
-
Commit-type rationale: deleting already-unreachable code is `refactor(pi-subagents):` — it neither adds a feature nor fixes a bug, and it changes no observable behavior at this step.
|
|
87
|
-
The release is driven by Step 5's unreleased `feat!:` already in the queue, not by this commit's type.
|
|
88
|
-
|
|
89
|
-
## Module-Level Changes
|
|
90
|
-
|
|
91
|
-
Source (deleted):
|
|
92
|
-
|
|
93
|
-
- `src/ui/agent-creation-wizard.ts` — deleted (235 LOC).
|
|
94
|
-
- `src/ui/agent-config-editor.ts` — deleted (201 LOC); removes the 11-line internal production clone.
|
|
95
|
-
- `src/ui/agent-file-ops.ts` — deleted (59 LOC).
|
|
96
|
-
- `src/ui/agent-file-writer.ts` — deleted (55 LOC).
|
|
97
|
-
- `src/ui/menu-ui.ts` — deleted (9 LOC); orphaned once the wizard and editor are gone.
|
|
98
|
-
|
|
99
|
-
Tests (deleted):
|
|
100
|
-
|
|
101
|
-
- `test/ui/agent-creation-wizard.test.ts` — deleted (296 LOC).
|
|
102
|
-
- `test/ui/agent-config-editor.test.ts` — deleted (392 LOC).
|
|
103
|
-
- `test/ui/agent-file-ops.test.ts` — deleted (112 LOC).
|
|
104
|
-
- `test/ui/agent-file-writer.test.ts` — deleted (148 LOC).
|
|
105
|
-
|
|
106
|
-
Tests (pruned, not deleted):
|
|
107
|
-
|
|
108
|
-
- `test/helpers/ui-stubs.ts` — remove `makeFileOps`, `makeMenuManager`, `createTestSubagentConfig`, and the private `DEFAULT_TEST_AGENT_CONFIG`; keep `makeMenuUI`.
|
|
109
|
-
Also drop the file's `import type { AgentConfig }` — it serves only the removed helpers, and `makeMenuUI` references no package-local type.
|
|
110
|
-
- `test/helpers/ui-stubs.test.ts` — remove the `makeFileOps`, `makeMenuManager`, and `createTestSubagentConfig` `describe` blocks and the now-unused imports; keep the `makeMenuUI` `describe` block.
|
|
111
|
-
|
|
112
|
-
Docs (updated):
|
|
113
|
-
|
|
114
|
-
- `docs/architecture/architecture.md` — in the current-state directory tree (lines ~341–346), remove the five deleted `ui/` entries including the `menu-ui.ts` transient line; add a `Landed` note to the Step 6 entry and mark it ✅, mirroring the Step 5 entry's format.
|
|
115
|
-
- `.pi/skills/package-pi-subagents/SKILL.md` — update the UI domain-table row: module count `11` → `6`, and drop "creation wizard, config editor" from the responsibility summary.
|
|
116
|
-
|
|
117
|
-
Doc-reference grep results (the removed symbols / mechanism):
|
|
118
|
-
|
|
119
|
-
- `docs/plans/*` and `docs/retro/*` and `docs/architecture/history/*` mention the deleted modules only as **historical record** of prior phases (extraction, narrowing, clone removal).
|
|
120
|
-
Per markdown conventions these are immutable records of completed work — do not rewrite them.
|
|
121
|
-
- The only **current-state** docs that describe the live layout are `architecture.md` (directory tree + Step 6 entry) and `SKILL.md` (UI domain row), both listed above.
|
|
122
|
-
|
|
123
|
-
## Test Impact Analysis
|
|
124
|
-
|
|
125
|
-
This is a deletion, not an extraction, so the standard extraction lenses invert:
|
|
126
|
-
|
|
127
|
-
1. **New tests enabled:** none — nothing new is created.
|
|
128
|
-
2. **Tests that become redundant:** all four deleted test files exercised only the deleted modules; they go with their subjects.
|
|
129
|
-
The three pruned `ui-stubs.test.ts` `describe` blocks tested helpers that no longer exist.
|
|
130
|
-
3. **Tests that must stay as-is:** `test/ui/subagents-settings.test.ts` (the surviving real consumer of `makeMenuUI`) and the `makeMenuUI` `describe` block in `ui-stubs.test.ts` — both genuinely exercise the surviving helper.
|
|
131
|
-
|
|
132
|
-
After the cut, `pnpm --filter @gotgenes/pi-subagents run test` must stay green with the reduced suite.
|
|
133
|
-
|
|
134
|
-
## Invariants at risk
|
|
135
|
-
|
|
136
|
-
This step touches surfaces that Phase 19 Step 5 ([#442]) and earlier phases refactored, but only by deleting them, so no earlier `Outcome:` is regressed — it is fulfilled:
|
|
137
|
-
|
|
138
|
-
- Step 5's outcome ("`/agents` dissolved; the definition-management leaves orphaned for Step 6") is the precondition this step consumes.
|
|
139
|
-
Verification that the leaves are still orphaned is the grep in Background (no surviving importer) — the standing guarantee that nothing re-wired them between Step 5 landing and this step.
|
|
140
|
-
- The "production duplication → 0 lines" target in the Phase 19 health-metrics table is met when `agent-config-editor.ts` is deleted.
|
|
141
|
-
Pin: `pnpm fallow dupes` after the cut shows no production clone group.
|
|
142
|
-
|
|
143
|
-
No green-suite regression risk exists because no surviving code path is modified; the type checker and `fallow dead-code` are the guards that the deletion is complete and clean.
|
|
144
|
-
|
|
145
|
-
## Step Order
|
|
146
|
-
|
|
147
|
-
This is a pure-deletion plan with no red→green cycles, so it routes to `/build-plan`, not `/tdd-plan`.
|
|
148
|
-
Two commits, ordered for reviewability.
|
|
149
|
-
|
|
150
|
-
1. **Remove the orphaned subtree and prune the test helpers.**
|
|
151
|
-
`git rm` the five source modules and four test files; prune `test/helpers/ui-stubs.ts` and `test/helpers/ui-stubs.test.ts` to `makeMenuUI` only.
|
|
152
|
-
The `menu-ui.ts` deletion and the four-module deletion go together — deleting them in one commit means no dangling `import type { MenuUI }` ever exists at the type-check boundary.
|
|
153
|
-
The helper prune rides in the same commit as the test-file deletion that orphans the helpers, so `fallow dead-code` sees a consistent state.
|
|
154
|
-
Verify: `pnpm --filter @gotgenes/pi-subagents run check`, `… run test`, `pnpm fallow dead-code`, and `pnpm fallow dupes` (expect no production clone group) all green.
|
|
155
|
-
Commit: `refactor(pi-subagents): remove orphaned agent-definition management subtree (#441)`.
|
|
156
|
-
|
|
157
|
-
2. **Update the current-state docs.**
|
|
158
|
-
Edit `docs/architecture/architecture.md` (directory tree + Step 6 `Landed`/✅ note) and `.pi/skills/package-pi-subagents/SKILL.md` (UI domain row count + summary).
|
|
159
|
-
Verify: `pnpm run lint` (rumdl) green.
|
|
160
|
-
Commit: `docs(pi-subagents): record agent-definition subtree removal (#441)`.
|
|
161
|
-
|
|
162
|
-
## Risks and Mitigations
|
|
163
|
-
|
|
164
|
-
- **Risk:** a non-obvious importer of one of the five modules exists and the deletion breaks the type check.
|
|
165
|
-
**Mitigation:** the Background grep already confirms zero `src/` importers and `index.ts` is clean; the Step 1 `check` is the backstop.
|
|
166
|
-
- **Risk:** pruning `ui-stubs.ts` removes a helper a surviving test still imports.
|
|
167
|
-
**Mitigation:** verified `makeMenuUI` is the only helper imported outside the doomed test files (by `subagents-settings.test.ts`); it is explicitly kept.
|
|
168
|
-
- **Risk:** deleting `menu-ui.ts` was not anticipated by the issue body and could be seen as scope creep.
|
|
169
|
-
**Mitigation:** it is mandated by the architecture doc (lines 346, 1076) and is a forced consequence of the orphan analysis; documented in Design Overview.
|
|
170
|
-
- **Risk:** `refactor:` commit type fails to trigger the batch release.
|
|
171
|
-
**Mitigation:** Step 5's unreleased `feat(pi-subagents)!:` (`cb813f2c`, after `v17.5.0`) is already queued; release-please cuts the major bump on the next release regardless of this commit's type.
|
|
172
|
-
`/ship-issue` reads the `**Release:** ship now — batch tail` marker and releases.
|
|
173
|
-
|
|
174
|
-
## Open Questions
|
|
175
|
-
|
|
176
|
-
None.
|
|
177
|
-
The two interpretation points (deleting `menu-ui.ts`; removing `makeMenuManager` whole) are resolved in Design Overview against the authoritative architecture doc and orphan analysis, not deferred.
|
|
178
|
-
|
|
179
|
-
[#442]: https://github.com/gotgenes/pi-packages/issues/442
|
|
180
|
-
[#443]: https://github.com/gotgenes/pi-packages/issues/443
|