@gotgenes/pi-subagents 12.0.0 → 12.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/public.d.ts +1 -1
- package/docs/architecture/architecture.md +2 -2
- package/docs/plans/0272-export-workspace-collaborator-types.md +147 -0
- package/docs/retro/0272-export-workspace-collaborator-types.md +38 -0
- package/package.json +1 -1
- package/src/service/service.ts +20 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [12.1.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v12.0.0...pi-subagents-v12.1.0) (2026-05-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* export WorkspaceProvider collaborator types by name ([#272](https://github.com/gotgenes/pi-packages/issues/272)) ([1ff4697](https://github.com/gotgenes/pi-packages/commit/1ff4697a3033be445340d18af005a5d34fb5934d))
|
|
14
|
+
|
|
8
15
|
## [12.0.0](https://github.com/gotgenes/pi-packages/compare/pi-subagents-v11.6.0...pi-subagents-v12.0.0) (2026-05-29)
|
|
9
16
|
|
|
10
17
|
|
package/dist/public.d.ts
CHANGED
|
@@ -167,4 +167,4 @@ declare function getSubagentsService(): SubagentsService | undefined;
|
|
|
167
167
|
declare function unpublishSubagentsService(): void;
|
|
168
168
|
|
|
169
169
|
export { SUBAGENT_EVENTS, getSubagentsService, publishSubagentsService, unpublishSubagentsService };
|
|
170
|
-
export type { LifetimeUsage, SpawnOptions, SubagentRecord, SubagentStatus, SubagentsService, WorkspaceProvider };
|
|
170
|
+
export type { LifetimeUsage, SpawnOptions, SubagentRecord, SubagentStatus, SubagentsService, Workspace, WorkspaceDisposeOutcome, WorkspaceDisposeResult, WorkspacePrepareContext, WorkspaceProvider };
|
|
@@ -761,7 +761,7 @@ Migrate `@gotgenes/pi-permission-system` to subscribe to `session-created`/`disp
|
|
|
761
761
|
#### Step 2: Define the `WorkspaceProvider` seam — [#262] ✅ Delivered
|
|
762
762
|
|
|
763
763
|
Added the `WorkspaceProvider` / `Workspace` interfaces (`src/lifecycle/workspace.ts`) and `SubagentsService.registerWorkspaceProvider` (single provider, throws on duplicate, returns an unregister disposer).
|
|
764
|
-
|
|
764
|
+
All five workspace types are named-re-exported from `service.ts`: `WorkspaceProvider`, `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult` (added in #272).
|
|
765
765
|
At run-start `Agent.run()` consults the registered provider for the child's cwd and a disposal handle; with no provider the child runs in the parent's cwd (the legacy worktree-collaborator fallback was removed when worktrees left the core in #263).
|
|
766
766
|
On completion the core calls `Workspace.dispose({ status, description })` and appends the returned `resultAddendum` verbatim — the provider owns the wording.
|
|
767
767
|
|
|
@@ -778,7 +778,7 @@ Removed `worktree.ts`, `worktree-isolation.ts`, `GitWorktreeManager`, and the `i
|
|
|
778
778
|
|
|
779
779
|
- Supersedes #256.
|
|
780
780
|
New package registered in `release-please-config.json` and `.pi/settings.json` (after pi-subagents); consumes the published `@gotgenes/pi-subagents` from the registry (`linkWorkspacePackages: false`), since `exports.types` resolves to the shipped declaration bundle.
|
|
781
|
-
|
|
781
|
+
From the release carrying #272, all five workspace types are importable by name: `WorkspaceProvider`, `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult`.
|
|
782
782
|
- Outcome: git leaves the core; worktree users install one package, everyone else pays nothing.
|
|
783
783
|
|
|
784
784
|
#### Step 4: Remove `isolated` / `extensions: false` / `noSkills` — [#264]
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
---
|
|
2
|
+
issue: 272
|
|
3
|
+
issue_title: "Export WorkspaceProvider collaborator types by name from the public surface"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Export `WorkspaceProvider` collaborator types by name from the public surface
|
|
7
|
+
|
|
8
|
+
## Problem Statement
|
|
9
|
+
|
|
10
|
+
`@gotgenes/pi-subagents` re-exports the `WorkspaceProvider` seam by name from its public surface, but not the four collaborator types that seam references: `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult`.
|
|
11
|
+
Those types are inlined into the bundled declaration (rolled in because `WorkspaceProvider` references them) but never exported by name.
|
|
12
|
+
A consumer implementing the seam — `@gotgenes/pi-subagents-worktrees` (#263) — cannot `import type { Workspace, WorkspacePrepareContext } from "@gotgenes/pi-subagents"`.
|
|
13
|
+
Instead it recovers the names through indexed-access gymnastics (`Parameters<WorkspaceProvider["prepare"]>[0]`, `NonNullable<Awaited<ReturnType<...>>>`).
|
|
14
|
+
That compiles and is type-safe, but every seam consumer has to repeat the same incantation rather than importing the names directly.
|
|
15
|
+
|
|
16
|
+
## Goals
|
|
17
|
+
|
|
18
|
+
- Re-export `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult` by name from `src/service/service.ts`, alongside `WorkspaceProvider`.
|
|
19
|
+
- Confirm the four names land in the bundled `dist/public.d.ts` and are importable by an external consumer.
|
|
20
|
+
- Extend the verification harness (`scripts/verify-public-types.sh`) so its symbol guard and probe consumer assert the four names are present and importable.
|
|
21
|
+
- `feat:` — adds names to the publishable public API surface (purely additive, non-breaking).
|
|
22
|
+
|
|
23
|
+
## Non-Goals
|
|
24
|
+
|
|
25
|
+
- No change to `src/lifecycle/workspace.ts` — the four interfaces already exist there with the right shapes; this issue only re-exports them.
|
|
26
|
+
- No change to the runtime accessor functions, `SubagentsService`, `SpawnOptions`, `SubagentRecord`, or `SUBAGENT_EVENTS`.
|
|
27
|
+
- No edits to `@gotgenes/pi-subagents-worktrees`.
|
|
28
|
+
Replacing its indexed-access aliases with named imports and bumping its `@gotgenes/pi-subagents` dependency is deferred to that package — it can only consume these names after `pi-subagents` cuts a new release carrying them (the registry-consumption model settled in #270).
|
|
29
|
+
- No source restructuring of the entry's type closure (out of scope per #270's design; the rollup bundle already inlines the closure).
|
|
30
|
+
- No new vitest unit test — the re-exports are type-only and erase at runtime, so they are verified by the type-level `verify:public-types` harness, not by the runtime suite.
|
|
31
|
+
|
|
32
|
+
## Background
|
|
33
|
+
|
|
34
|
+
Relevant modules:
|
|
35
|
+
|
|
36
|
+
- `packages/pi-subagents/src/service/service.ts` — the public entry.
|
|
37
|
+
It currently imports `type { WorkspaceProvider } from "#src/lifecycle/workspace"` and `type { LifetimeUsage } from "#src/lifecycle/usage"`, and ends with `export type { LifetimeUsage, ..., WorkspaceProvider }`.
|
|
38
|
+
A standing comment already anticipates this issue: "Named re-exports of those collaborator types are tracked in #272."
|
|
39
|
+
- `packages/pi-subagents/src/lifecycle/workspace.ts` — defines all four collaborator interfaces plus `WorkspaceProvider`.
|
|
40
|
+
`WorkspacePrepareContext` carries `agentId`, `agentType`, `baseCwd`, and optional `invocation`; `WorkspaceDisposeOutcome` carries `status` and `description`; `WorkspaceDisposeResult` carries optional `resultAddendum`; `Workspace` carries `readonly cwd` and `dispose(outcome)`.
|
|
41
|
+
- `packages/pi-subagents/rollup.dts.config.mjs` — rolls `src/service/service.ts` into a self-contained `dist/public.d.ts`, inlining `#src/*` types and keeping `@earendil-works/*` external.
|
|
42
|
+
No config change is needed: once the names are exported from the entry, `rollup-plugin-dts` carries the (already-inlined) declarations through as named exports.
|
|
43
|
+
- `packages/pi-subagents/scripts/verify-public-types.sh` — the CI-backed verification harness.
|
|
44
|
+
It packs the tarball, runs a self-containment guard (`grep '#src'`), loops a symbol-presence guard (`for sym in getSubagentsService WorkspaceProvider SubagentsService LifetimeUsage`), then type-checks a throwaway `probe.ts` consumer against the packaged tarball.
|
|
45
|
+
|
|
46
|
+
Constraints from `AGENTS.md` and the package skill:
|
|
47
|
+
|
|
48
|
+
- Ship-source model with one build step: `build:types` (rollup) regenerates `dist/public.d.ts` at `prepack`; `dist/` is gitignored and must never be committed.
|
|
49
|
+
- Run `pnpm run verify:public-types` after any change to the public surface — it is also a CI step.
|
|
50
|
+
- Open-for-extension/closed-for-modification: pi-subagents is a minimal core; re-exporting collaborator types of an existing seam is consistent with that boundary (no new behavior, no consumer knowledge).
|
|
51
|
+
|
|
52
|
+
## Design Overview
|
|
53
|
+
|
|
54
|
+
The change is additive and type-only.
|
|
55
|
+
`service.ts` already imports the seam's entry type; extend that import to bring in the four collaborator types, then list them in the existing `export type { … }`.
|
|
56
|
+
|
|
57
|
+
Import and re-export shape after the change:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import type { LifetimeUsage } from "#src/lifecycle/usage";
|
|
61
|
+
import type {
|
|
62
|
+
Workspace,
|
|
63
|
+
WorkspaceDisposeOutcome,
|
|
64
|
+
WorkspaceDisposeResult,
|
|
65
|
+
WorkspacePrepareContext,
|
|
66
|
+
WorkspaceProvider,
|
|
67
|
+
} from "#src/lifecycle/workspace";
|
|
68
|
+
|
|
69
|
+
export type {
|
|
70
|
+
LifetimeUsage,
|
|
71
|
+
SpawnOptions,
|
|
72
|
+
SubagentRecord,
|
|
73
|
+
SubagentStatus,
|
|
74
|
+
SubagentsService,
|
|
75
|
+
Workspace,
|
|
76
|
+
WorkspaceDisposeOutcome,
|
|
77
|
+
WorkspaceDisposeResult,
|
|
78
|
+
WorkspacePrepareContext,
|
|
79
|
+
WorkspaceProvider,
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Consumer call site this enables (the pattern that motivates the issue):
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import type {
|
|
87
|
+
Workspace,
|
|
88
|
+
WorkspaceDisposeOutcome,
|
|
89
|
+
WorkspaceDisposeResult,
|
|
90
|
+
WorkspacePrepareContext,
|
|
91
|
+
WorkspaceProvider,
|
|
92
|
+
} from "@gotgenes/pi-subagents";
|
|
93
|
+
|
|
94
|
+
const provider: WorkspaceProvider = {
|
|
95
|
+
async prepare(ctx: WorkspacePrepareContext): Promise<Workspace | undefined> {
|
|
96
|
+
return { cwd: ctx.baseCwd, dispose: (_outcome: WorkspaceDisposeOutcome) => undefined };
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Edge cases:
|
|
102
|
+
|
|
103
|
+
- The standing comment in `service.ts` ("Named re-exports of those collaborator types are tracked in #272") becomes stale once the re-exports land — update it to describe the current state rather than a tracked future.
|
|
104
|
+
- `WorkspaceProvider` already pulls the four collaborator declarations into the rollup bundle by reference, so adding the named exports does not change the bundle's self-containment (the `grep '#src'` guard stays green).
|
|
105
|
+
|
|
106
|
+
## Module-Level Changes
|
|
107
|
+
|
|
108
|
+
- `packages/pi-subagents/src/service/service.ts` — widen the `#src/lifecycle/workspace` type import to include `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult`; add the same four names to the `export type { … }` block; replace the "tracked in #272" comment with a present-tense description of the seam's named re-exports.
|
|
109
|
+
- `packages/pi-subagents/scripts/verify-public-types.sh` — add the four names to the `for sym in …` symbol-presence guard, and extend the inline `probe.ts` to import and exercise the four types by name (e.g. annotate a `prepare` implementation with `WorkspacePrepareContext`/`Workspace` and reference `WorkspaceDisposeOutcome`/`WorkspaceDisposeResult`).
|
|
110
|
+
|
|
111
|
+
No architecture-doc updates are required: `docs/architecture/architecture.md` lists `workspace.ts` under the Lifecycle domain but does not enumerate the public surface's named exports, and no complexity/health table references this change.
|
|
112
|
+
|
|
113
|
+
## Test Impact Analysis
|
|
114
|
+
|
|
115
|
+
This is a type-only re-export change, not an extraction or refactor.
|
|
116
|
+
|
|
117
|
+
1. New tests enabled: none at the vitest level — type-only re-exports erase at runtime and cannot be observed by the runtime suite.
|
|
118
|
+
The meaningful new assertion is at the type level: the extended `verify:public-types` probe proves the four names are importable from the packaged tarball, and the symbol guard proves they appear in `dist/public.d.ts`.
|
|
119
|
+
2. Redundant existing tests: none.
|
|
120
|
+
`test/service/service.test.ts` exercises the runtime accessors and `SUBAGENT_EVENTS`; it is unaffected and stays as-is.
|
|
121
|
+
3. Tests that must stay as-is: the full vitest suite (the regression canary) and `test/lifecycle/agent.test.ts` (which imports `Workspace`/`WorkspaceProvider` from `#src/lifecycle/workspace` internally — unrelated to the public re-export).
|
|
122
|
+
|
|
123
|
+
## TDD Order
|
|
124
|
+
|
|
125
|
+
The "test surface" here is the type-level verification harness, which is the red→green loop for a type-only public-surface change.
|
|
126
|
+
|
|
127
|
+
1. Extend the verification harness (red → green in one step).
|
|
128
|
+
Add the four names to the `for sym in …` guard in `scripts/verify-public-types.sh` and extend the inline `probe.ts` to import them by name.
|
|
129
|
+
Run `pnpm run verify:public-types` to confirm it fails (red) because the names are absent from `dist/public.d.ts` and the probe import is unresolved.
|
|
130
|
+
Then add the import and `export type` entries in `src/service/service.ts` and update the standing comment, and re-run `pnpm run verify:public-types` to confirm it passes (green).
|
|
131
|
+
Harness change and source change land together because the type checker proves them as a unit — a packaged-tarball probe cannot import names the entry does not yet export.
|
|
132
|
+
Commit: `feat: export WorkspaceProvider collaborator types by name (#272)`.
|
|
133
|
+
|
|
134
|
+
The harness step and the source step are bundled into a single commit deliberately: splitting them would leave the repo in a state where `verify:public-types` (a CI step) fails between commits.
|
|
135
|
+
|
|
136
|
+
## Risks and Mitigations
|
|
137
|
+
|
|
138
|
+
- Risk: the rollup bundle does not surface the new names as named exports.
|
|
139
|
+
Mitigation: `rollup-plugin-dts` carries through whatever the entry exports; the symbol guard + probe in `verify:public-types` prove the names land in `dist/public.d.ts` and are importable.
|
|
140
|
+
- Risk: committing the generated `dist/public.d.ts`.
|
|
141
|
+
Mitigation: `dist/` is gitignored and regenerated at `prepack`; the plan commits only `service.ts` and the harness script.
|
|
142
|
+
- Risk: stale comment misleads future readers.
|
|
143
|
+
Mitigation: the comment update is part of the same step.
|
|
144
|
+
|
|
145
|
+
## Open Questions
|
|
146
|
+
|
|
147
|
+
- The downstream simplification in `@gotgenes/pi-subagents-worktrees` (swap indexed-access aliases for named imports, bump the `@gotgenes/pi-subagents` dependency) is intentionally deferred until a `pi-subagents` release carries these exports — it is tracked with #263's follow-up, not this plan.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
issue: 272
|
|
3
|
+
issue_title: "Export WorkspaceProvider collaborator types by name from the public surface"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Retro: #272 — Export `WorkspaceProvider` collaborator types by name from the public surface
|
|
7
|
+
|
|
8
|
+
## Stage: Planning (2026-05-29T23:23:37Z)
|
|
9
|
+
|
|
10
|
+
### Session summary
|
|
11
|
+
|
|
12
|
+
Planned a purely additive, type-only change to `@gotgenes/pi-subagents`'s public surface: re-export `Workspace`, `WorkspacePrepareContext`, `WorkspaceDisposeOutcome`, and `WorkspaceDisposeResult` by name from `src/service/service.ts`, alongside the already-exported `WorkspaceProvider`.
|
|
13
|
+
The plan bundles the source change with extending the `verify:public-types` harness (symbol guard + probe consumer) into a single `feat:` commit, since a packaged-tarball probe cannot import names the entry does not yet export.
|
|
14
|
+
|
|
15
|
+
### Observations
|
|
16
|
+
|
|
17
|
+
- The issue's "Proposed change" was unambiguous, so the `ask-user` design gate was skipped.
|
|
18
|
+
|
|
19
|
+
## Stage: Implementation — Build (2026-05-29T23:30:13Z)
|
|
20
|
+
|
|
21
|
+
### Session summary
|
|
22
|
+
|
|
23
|
+
Implemented the single plan step: widened the `#src/lifecycle/workspace` import in `src/service/service.ts` to include all four collaborator types and added them to the `export type { … }` block, updating the standing comment from a future-tracking reference to a present-tense description.
|
|
24
|
+
Extended `scripts/verify-public-types.sh` — the symbol guard loop and inline `probe.ts` — to assert all four new names, confirmed the harness fails (red) before the source change and passes (green) after.
|
|
25
|
+
Also updated two stale forward-references to #272 in `docs/architecture/architecture.md` (flagged by the pre-completion reviewer).
|
|
26
|
+
|
|
27
|
+
### Observations
|
|
28
|
+
|
|
29
|
+
- Red→green cycle through the type-level harness (`verify:public-types`) rather than vitest, exactly as planned.
|
|
30
|
+
- No rollup config change was needed — `rollup-plugin-dts` carries through whatever the entry exports; the symbol guard and `#src` self-containment guard both stayed green.
|
|
31
|
+
- The symbol guard already found the names present in the bundle (declared but not exported); the probe's type-check was the real red signal.
|
|
32
|
+
- Pre-completion reviewer: WARN — two stale forward-references to #272 in `docs/architecture/architecture.md`; both fixed in a follow-up `docs:` commit before shipping.
|
|
33
|
+
- No new vitest cycle: the re-exports are type-only and erase at runtime.
|
|
34
|
+
The red→green loop lives in the type-level `verify:public-types` harness, not the runtime suite — this is closer to a `/build-plan` shape than a code TDD cycle, but it still has a clean red→green via the probe consumer.
|
|
35
|
+
- The four interfaces already exist in `src/lifecycle/workspace.ts` with correct shapes; only re-exporting is in scope.
|
|
36
|
+
- `rollup.dts.config.mjs` needs no change — `WorkspaceProvider` already pulls the four collaborator declarations into the bundle by reference, so adding named exports keeps the `grep '#src'` self-containment guard green.
|
|
37
|
+
- A standing comment in `service.ts` ("Named re-exports … tracked in #272") goes stale on landing — the plan updates it in the same step.
|
|
38
|
+
- The downstream simplification in `@gotgenes/pi-subagents-worktrees` (swap indexed-access aliases for named imports, bump the dependency) is deferred until a `pi-subagents` release carries these exports — consistent with the registry-consumption model settled in #270.
|
package/package.json
CHANGED
package/src/service/service.ts
CHANGED
|
@@ -10,14 +10,26 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { LifetimeUsage } from "#src/lifecycle/usage";
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
import type {
|
|
14
|
+
Workspace,
|
|
15
|
+
WorkspaceDisposeOutcome,
|
|
16
|
+
WorkspaceDisposeResult,
|
|
17
|
+
WorkspacePrepareContext,
|
|
18
|
+
WorkspaceProvider,
|
|
19
|
+
} from "#src/lifecycle/workspace";
|
|
20
|
+
|
|
21
|
+
// Generative extension seam (ADR 0002, Phase 16 Step 2). The provider type
|
|
22
|
+
// and all four collaborator types it references are re-exported by name so
|
|
23
|
+
// consumers can import them directly rather than recovering them via
|
|
24
|
+
// indexed-access inference (e.g. `Parameters<WorkspaceProvider["prepare"]>[0]`).
|
|
25
|
+
export type {
|
|
26
|
+
LifetimeUsage,
|
|
27
|
+
Workspace,
|
|
28
|
+
WorkspaceDisposeOutcome,
|
|
29
|
+
WorkspaceDisposeResult,
|
|
30
|
+
WorkspacePrepareContext,
|
|
31
|
+
WorkspaceProvider,
|
|
32
|
+
};
|
|
21
33
|
|
|
22
34
|
export type SubagentStatus =
|
|
23
35
|
| "queued"
|