@pimote/sdk 0.16.0-rc.1 → 0.16.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,7 @@ Pimote's extensibility SDK provides APIs for [Pi](https://github.com/earendil-wo
5
5
  - **`@pimote/sdk/panels`** — push structured card data to the Pimote web client
6
6
  - **`@pimote/sdk/folders`** — type-only folder discovery entries for Pimote extensions
7
7
  - **`@pimote/sdk/activity`** — answer Pimote's idle-reap background-activity poll
8
+ - **`@pimote/sdk/subagents`** — register or discover a typed per-session subagent provider
8
9
  - **`@pimote/sdk/pimote`** — define global `PimoteExtension` factories for sources and Settings files
9
10
 
10
11
  The root `@pimote/sdk` import re-exports session-scoped modules and Pimote extension types.
@@ -113,6 +114,30 @@ Detection uses pi's EventBus for a synchronous in-process round-trip — pimote'
113
114
 
114
115
  When pimote isn't present, the EventBus emit fires with no listener, `detect()` returns `null`, and there's zero overhead.
115
116
 
117
+ ## Subagents — `@pimote/sdk/subagents`
118
+
119
+ This module defines the per-session presentation provider for interactive subagent views. A provider publishes a root-relative hierarchy, typed subagent operations, one ordered replay cursor, and leases to existing child sessions. Pimote discovers providers on the root session's EventBus; child runtimes stay owned by the extension that created them.
120
+
121
+ Use `registerProvider(pi, provider)` to publish a provider. Use `discoverProvider(pi, onProvider)` or the discovery handle to find providers, including late registration and replacement. Registration and discovery return cleanup functions or handles. Cleanup stops discovery or registration; it does not dispose the provider or child sessions. The `SubagentPresentationProvider` contract, typed operation data, cursors, snapshots, and borrowed-session lease types are exported from this module. The my-pi subagents extension implements this provider for Pimote.
122
+
123
+ Provider operations carry typed placement through `toolCallId` and `contentIndex`, or through the containing custom entry's `entryId`. Pimote's server projector suppresses the declared native renderers and places each operation as typed subagent content inside its originating assistant row, preserving surrounding native content order.
124
+
125
+ Tool-backed final payloads use `{ operation, parameters, result }`. Parameters contain the complete normalized public inputs. Results retain output, errors, outcome flags, and received metadata. Target references use root-relative agent paths. Router correlation IDs stay inside my-pi. Asynchronous custom messages carry result-only payloads rather than invented tool parameters. Pimote renders these fields as labeled data and uses its transcript Markdown renderer for free-form prose.
126
+
127
+ Await starts only after complete tool arguments arrive. Omitted or empty `parameters.agents` means all agents. Named targets remain in the final parameters, including when a wait is interrupted or returns no child results. Send and respond retain progressive prose in `parameters.message`; send responses stream into `result.response`. Existing lifecycle event types remain unchanged.
128
+
129
+ An await result contains the child completions returned by that tool call. Standalone completion operations replace asynchronous subagent custom messages only. Pimote restores persisted operations through provider hydration. The provider normalizes older saved payloads into the current envelope rather than making the client decode extension details.
130
+
131
+ ```ts
132
+ {
133
+ operation: 'await',
134
+ parameters: { agents: [['worker']] },
135
+ result: {
136
+ statuses: [{ path: ['worker'], state: 'idle', output: 'Checks passed.' }]
137
+ }
138
+ }
139
+ ```
140
+
116
141
  ## Pimote extensions — `@pimote/sdk/pimote`
117
142
 
118
143
  Pimote extensions are process-global modules. The host loads direct JavaScript/TypeScript modules and entry-bearing directories from `$XDG_CONFIG_HOME/pimote/extensions/`. User-scoped Pi packages can contribute entries through their `pimote.extensions` manifest field. Project packages and `pi.extensions` entries never load in this host. A module listed in both sections is an explicit dual-host module and runs twice with independent lifecycles.
@@ -1,3 +1,4 @@
1
- export type { AgentPath, BorrowedAgentSession, BorrowedSessionManager, CommunicationData, CompletionData, DelegationData, FeedCursor, PiEventRef, ReplayResult, SubagentAwaitChildStatus, SubagentAwaitData, SubagentCapabilities, SubagentCompletionData, SubagentDelegationData, SubagentEvent, SubagentEventData, SubagentEventKind, SubagentLease, SubagentLeaseEvent, SubagentLifecycleData, SubagentMessageData, SubagentNode, SubagentNodeEventData, SubagentNodeSnapshot, SubagentNodeState, SubagentOperation, SubagentOwnerControlPort, SubagentProvider, SubagentProviderDiscovery, SubagentProviderRequest, SubagentProviderResponse, SubagentResurrectRequest, SubagentResurrectResult, SubagentSemanticFact, SubagentSnapshot, SubagentState, SubagentStopRequest, SubagentTeardownReason, SubagentTeardownResult, SubagentUsage, SubagentUsageSnapshot, SubagentRuntimeReplacedData, SubagentCostBreakdown, } from './types.js';
1
+ export type { AgentPath, BorrowedAgentSession, BorrowedSessionManager, FeedCursor, PiEventRef, SubagentAwaitChildStatus, SubagentCapabilities, SubagentLease, SubagentLeaseEvent, SubagentNode, SubagentNodeEventData, SubagentNodeSnapshot, SubagentNodeState, SubagentOperation, SubagentOwnerControlPort, SubagentProviderDiscovery, SubagentProviderRequest, SubagentProviderResponse, SubagentResurrectRequest, SubagentResurrectResult, SubagentState, SubagentStopRequest, SubagentTeardownReason, SubagentTeardownResult, SubagentUsage, SubagentUsageSnapshot, SubagentRuntimeReplacedData, SubagentCostBreakdown, } from './types.js';
2
2
  export { SUBAGENT_PROVIDER_REQUEST, SUBAGENT_PROVIDER_RESPONSE, discover, discoverProvider, register, registerProvider } from './provider.js';
3
3
  export type { DiscoverProviderOptions } from './provider.js';
4
+ export type { ActiveSubagentOperation, PersistedSubagentContent, SubagentDelegatedChild, SubagentInterruptResult, SubagentInterruptTarget, SubagentResurrectedAgent, SubagentAwaitResult, SubagentAwaitStatus, SubagentCompletionResult, SubagentDeltaData, SubagentDeltaEvent, SubagentEndData, SubagentEndEvent, SubagentFiniteData, SubagentFiniteEvent, SubagentFinalData, SubagentOperationKind, SubagentOperationTarget, SubagentPlacement, SubagentPresentationManifest, SubagentPresentationProvider, SubagentPresentationReplay, SubagentProtocolErrorData, SubagentProviderEvent, SubagentProviderSnapshot, SubagentStartData, SubagentStartEvent, SubagentToolParameters, SubagentTopologyEvent, } from './presentation.js';
@@ -0,0 +1,240 @@
1
+ import type { AgentPath, BorrowedAgentSession, FeedCursor, PiEventRef, SubagentNodeEventData, SubagentNodeSnapshot, SubagentProviderControls, SubagentRuntimeReplacedData, SubagentUsage } from './types.js';
2
+ export type SubagentPresentationManifest = Readonly<{
3
+ hiddenToolNames: readonly string[];
4
+ hiddenCustomTypes: readonly string[];
5
+ }>;
6
+ export type SubagentOperationKind = 'send' | 'message_received' | 'respond' | 'await' | 'delegation' | 'completion' | 'interrupt' | 'teardown' | 'resurrect';
7
+ /** Normalized public tool inputs. Final operations carry complete values. */
8
+ export type SubagentToolParameters = Readonly<Record<string, unknown>>;
9
+ export type SubagentPlacement = Readonly<{
10
+ toolCallId: string;
11
+ contentIndex: number;
12
+ entryId?: string;
13
+ }> | Readonly<{
14
+ entryId: string;
15
+ }>;
16
+ export type SubagentOperationTarget = Readonly<{
17
+ operationId: string;
18
+ kind: SubagentOperationKind;
19
+ path: AgentPath;
20
+ placement?: SubagentPlacement;
21
+ }>;
22
+ export type SubagentAwaitStatus = Readonly<{
23
+ path: AgentPath;
24
+ state: 'running' | 'waiting' | 'idle' | 'errored' | 'dead' | 'stopped';
25
+ output?: string;
26
+ error?: string;
27
+ sessionId?: string;
28
+ }>;
29
+ export type SubagentCompletionResult = Readonly<{
30
+ state: 'idle' | 'errored' | 'dead' | 'stopped';
31
+ output?: string;
32
+ error?: string;
33
+ usage?: SubagentUsage;
34
+ }>;
35
+ export type SubagentAwaitResult = Readonly<{
36
+ statuses: readonly SubagentAwaitStatus[];
37
+ interrupted?: boolean;
38
+ error?: string;
39
+ }>;
40
+ export type SubagentStartData = Readonly<{
41
+ operation: 'send';
42
+ parameters: SubagentToolParameters;
43
+ result: Readonly<{
44
+ response: string;
45
+ phase: 'ready' | 'sending' | 'waiting' | 'responding';
46
+ }>;
47
+ }> | Readonly<{
48
+ operation: 'respond';
49
+ parameters: SubagentToolParameters;
50
+ result: Readonly<Record<string, unknown>>;
51
+ }> | Readonly<{
52
+ operation: 'await';
53
+ parameters: SubagentToolParameters;
54
+ result: SubagentAwaitResult;
55
+ }>;
56
+ export type SubagentDeltaData = Readonly<{
57
+ operation: 'send';
58
+ field: 'request' | 'response';
59
+ delta: string;
60
+ }> | Readonly<{
61
+ operation: 'send';
62
+ phase: 'waiting' | 'responding';
63
+ }> | Readonly<{
64
+ operation: 'respond';
65
+ delta: string;
66
+ }> | Readonly<{
67
+ operation: 'await';
68
+ statuses: readonly SubagentAwaitStatus[];
69
+ }>;
70
+ export type SubagentEndData = Readonly<{
71
+ operation: 'send';
72
+ parameters?: SubagentToolParameters;
73
+ result: Readonly<Record<string, unknown>>;
74
+ }> | Readonly<{
75
+ operation: 'respond';
76
+ parameters?: SubagentToolParameters;
77
+ result: Readonly<Record<string, unknown>>;
78
+ }> | Readonly<{
79
+ operation: 'await';
80
+ parameters: SubagentToolParameters;
81
+ result: SubagentAwaitResult;
82
+ }>;
83
+ export type SubagentDelegatedChild = Readonly<{
84
+ path: AgentPath;
85
+ task: string;
86
+ persona?: string;
87
+ status?: SubagentAwaitStatus['state'];
88
+ }>;
89
+ export type SubagentInterruptTarget = Readonly<{
90
+ path: AgentPath;
91
+ output?: string;
92
+ error?: string;
93
+ }>;
94
+ export type SubagentInterruptResult = Readonly<{
95
+ interrupted: readonly SubagentInterruptTarget[];
96
+ pending: readonly SubagentInterruptTarget[];
97
+ failed: readonly SubagentInterruptTarget[];
98
+ }>;
99
+ export type SubagentResurrectedAgent = Readonly<{
100
+ path: AgentPath;
101
+ sessionId: string;
102
+ incarnation: string;
103
+ state: 'idle' | 'running';
104
+ usage: SubagentUsage;
105
+ output?: string;
106
+ error?: string;
107
+ }>;
108
+ export type SubagentFiniteData = Readonly<{
109
+ operation: 'delegation';
110
+ parameters: SubagentToolParameters;
111
+ result: Readonly<{
112
+ children: readonly SubagentDelegatedChild[];
113
+ }>;
114
+ }> | Readonly<{
115
+ operation: 'completion';
116
+ result: SubagentCompletionResult;
117
+ }> | Readonly<{
118
+ operation: 'interrupt';
119
+ parameters: SubagentToolParameters;
120
+ result: SubagentInterruptResult;
121
+ }> | Readonly<{
122
+ operation: 'teardown';
123
+ parameters: SubagentToolParameters;
124
+ result: Readonly<{
125
+ affectedAgents: readonly Readonly<{
126
+ path: AgentPath;
127
+ sessionId: string;
128
+ incarnation: string;
129
+ state: SubagentAwaitStatus['state'];
130
+ usage: SubagentUsage;
131
+ output?: string;
132
+ error?: string;
133
+ }>[];
134
+ status: 'removed' | 'already_removed' | 'not_found';
135
+ }>;
136
+ }> | Readonly<{
137
+ operation: 'resurrect';
138
+ parameters: SubagentToolParameters;
139
+ result: Readonly<{
140
+ affectedAgents: readonly SubagentResurrectedAgent[];
141
+ }>;
142
+ }> | Readonly<{
143
+ operation: 'protocol_error';
144
+ result: Readonly<{
145
+ error: string;
146
+ }>;
147
+ }>;
148
+ export type SubagentFinalData = SubagentEndData | SubagentFiniteData;
149
+ export type SubagentProtocolErrorData = Readonly<{
150
+ operationId: string;
151
+ operation: SubagentOperationKind;
152
+ message: string;
153
+ }>;
154
+ export type ActiveSubagentOperation = Readonly<{
155
+ target: SubagentOperationTarget;
156
+ data: SubagentStartData;
157
+ }>;
158
+ type PresentationEventBase = Readonly<{
159
+ eventId: string;
160
+ cursor: FeedCursor;
161
+ target: SubagentOperationTarget;
162
+ }>;
163
+ export type SubagentStartEvent = PresentationEventBase & Readonly<{
164
+ type: 'subagent_start';
165
+ data: SubagentStartData;
166
+ }>;
167
+ export type SubagentDeltaEvent = PresentationEventBase & Readonly<{
168
+ type: 'subagent_delta';
169
+ data: SubagentDeltaData;
170
+ }>;
171
+ export type SubagentEndEvent = PresentationEventBase & Readonly<{
172
+ type: 'subagent_end';
173
+ state: 'complete' | 'error' | 'aborted';
174
+ data: SubagentEndData;
175
+ }>;
176
+ export type SubagentFiniteEvent = PresentationEventBase & Readonly<{
177
+ type: 'subagent_snapshot_event';
178
+ state: 'complete' | 'error' | 'aborted';
179
+ data: SubagentFinalData;
180
+ }>;
181
+ type SubagentTopologyData = Readonly<{
182
+ kind: 'node_added' | 'node_updated';
183
+ data: SubagentNodeEventData;
184
+ }> | Readonly<{
185
+ kind: 'node_removed';
186
+ data: Readonly<{
187
+ node: SubagentNodeSnapshot;
188
+ reason: string;
189
+ }>;
190
+ }> | Readonly<{
191
+ kind: 'runtime_replaced';
192
+ data: SubagentRuntimeReplacedData;
193
+ }>;
194
+ export type SubagentTopologyEvent = Readonly<{
195
+ eventId: string;
196
+ cursor: FeedCursor;
197
+ path: AgentPath;
198
+ relatedPiEvents: readonly PiEventRef[];
199
+ }> & SubagentTopologyData;
200
+ export type SubagentProviderEvent = SubagentTopologyEvent | SubagentStartEvent | SubagentDeltaEvent | SubagentEndEvent | SubagentFiniteEvent;
201
+ export type PersistedSubagentContent = Readonly<{
202
+ operationId: string;
203
+ kind: SubagentOperationKind;
204
+ state: 'complete' | 'error' | 'aborted';
205
+ data: SubagentFinalData;
206
+ }> & (Readonly<{
207
+ source: 'tool';
208
+ placement: Extract<SubagentPlacement, {
209
+ toolCallId: string;
210
+ }>;
211
+ }> | Readonly<{
212
+ source: 'custom_entry';
213
+ placement?: Extract<SubagentPlacement, {
214
+ entryId: string;
215
+ }>;
216
+ }>);
217
+ export type SubagentProviderSnapshot = Readonly<{
218
+ manifest: SubagentPresentationManifest;
219
+ nodes: readonly SubagentNodeSnapshot[];
220
+ cursor: FeedCursor;
221
+ activeOperations: readonly ActiveSubagentOperation[];
222
+ }>;
223
+ export type SubagentPresentationReplay = Readonly<{
224
+ kind: 'events';
225
+ cursor: FeedCursor;
226
+ events: readonly SubagentProviderEvent[];
227
+ }> | Readonly<{
228
+ kind: 'snapshot_required';
229
+ reason: 'epoch_changed' | 'history_unavailable';
230
+ }>;
231
+ export interface SubagentPresentationProvider extends SubagentProviderControls {
232
+ snapshot(): SubagentProviderSnapshot;
233
+ subscribe(listener: (event: SubagentProviderEvent) => void): () => void;
234
+ replay(after?: FeedCursor): SubagentPresentationReplay;
235
+ rehydrate(input: {
236
+ session: BorrowedAgentSession;
237
+ path: AgentPath;
238
+ }): Promise<void>;
239
+ }
240
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,13 +1,15 @@
1
1
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
2
- import type { SubagentEventBusOwner, SubagentProvider, SubagentProviderDiscovery } from './types.js';
2
+ import type { SubagentEventBusOwner, SubagentProviderDiscovery } from './types.js';
3
+ import type { SubagentPresentationProvider } from './presentation.js';
4
+ type RegisteredProvider = SubagentPresentationProvider;
3
5
  /** EventBus channel emitted by a Pimote host to discover a provider. */
4
6
  export declare const SUBAGENT_PROVIDER_REQUEST: "pimote:subagents:request";
5
7
  /** EventBus channel carrying the currently registered provider. */
6
8
  export declare const SUBAGENT_PROVIDER_RESPONSE: "pimote:subagents:response";
7
- export declare function registerProvider(owner: SubagentEventBusOwner | ExtensionAPI, provider: SubagentProvider): () => void;
9
+ export declare function registerProvider(owner: SubagentEventBusOwner | ExtensionAPI, provider: RegisteredProvider): () => void;
8
10
  export interface DiscoverProviderOptions {
9
11
  /** Called whenever the provider first appears or is replaced. */
10
- onProvider?: (provider: SubagentProvider) => void;
12
+ onProvider?: (provider: RegisteredProvider) => void;
11
13
  }
12
14
  /**
13
15
  * Discover the provider on a session EventBus and keep listening for late
@@ -19,9 +21,10 @@ export interface DiscoverProviderOptions {
19
21
  * after installing its response listener, so a provider registered before or
20
22
  * during the handshake cannot be missed.
21
23
  */
22
- export declare function discoverProvider(owner: SubagentEventBusOwner | ExtensionAPI, onProvider: (provider: SubagentProvider) => void): () => void;
24
+ export declare function discoverProvider(owner: SubagentEventBusOwner | ExtensionAPI, onProvider: (provider: RegisteredProvider) => void): () => void;
23
25
  export declare function discoverProvider(owner: SubagentEventBusOwner | ExtensionAPI, options?: DiscoverProviderOptions): SubagentProviderDiscovery;
24
26
  /** Short alias for hosts that use the request/response verb. */
25
27
  export declare const discover: typeof discoverProvider;
26
28
  /** Short alias for extensions that use the registration verb. */
27
29
  export declare const register: typeof registerProvider;
30
+ export {};
@@ -91,7 +91,7 @@ export function discoverProvider(owner, callbackOrOptions) {
91
91
  };
92
92
  if (callback)
93
93
  return close;
94
- return {
94
+ const discovery = {
95
95
  get provider() {
96
96
  return current;
97
97
  },
@@ -116,6 +116,7 @@ export function discoverProvider(owner, callbackOrOptions) {
116
116
  },
117
117
  close,
118
118
  };
119
+ return discovery;
119
120
  }
120
121
  /** Short alias for hosts that use the request/response verb. */
121
122
  export const discover = discoverProvider;
@@ -13,46 +13,6 @@ export type PiEventRef = Readonly<{
13
13
  toolCallId?: string;
14
14
  kind: 'message' | 'tool_call' | 'custom_message' | 'lifecycle';
15
15
  }>;
16
- export type SubagentEventKind = 'node_added' | 'node_updated' | 'node_removed' | 'runtime_replaced' | 'delegation' | 'message_thread' | 'await_started' | 'child_settled' | 'await_interrupted' | 'await_released' | 'completion' | 'interrupt' | 'teardown' | 'resurrect';
17
- export type SubagentDelegationData = Readonly<{
18
- invocationId: string;
19
- awaitsResult: boolean;
20
- children: readonly Readonly<{
21
- path: AgentPath;
22
- task: string;
23
- persona?: string;
24
- }>[];
25
- }>;
26
- /** Alias used by the my-pi provider implementation. */
27
- export type DelegationData = SubagentDelegationData;
28
- export type SubagentCompletionData = Readonly<{
29
- status: 'idle' | 'errored' | 'dead' | 'stopped';
30
- output?: string;
31
- error?: string;
32
- usage?: SubagentUsage;
33
- }> & (Readonly<{
34
- delivery: 'awaited';
35
- invocationId: string;
36
- }> | Readonly<{
37
- delivery: 'asynchronous';
38
- invocationId?: string;
39
- }>);
40
- /** Alias used by the my-pi provider implementation. */
41
- export type CompletionData = SubagentCompletionData;
42
- export type SubagentMessageData = Readonly<{
43
- from: AgentPath;
44
- to: AgentPath;
45
- text: string;
46
- correlationId?: string;
47
- responseExpected: boolean;
48
- }> & (Readonly<{
49
- phase: 'sent' | 'received' | 'response';
50
- }> | Readonly<{
51
- phase: 'failure';
52
- error: string;
53
- }>);
54
- /** Alias used by the my-pi provider implementation. */
55
- export type CommunicationData = SubagentMessageData;
56
16
  /** One child state included in await progress and settlement facts. */
57
17
  export type SubagentAwaitChildStatus = Readonly<{
58
18
  path: AgentPath;
@@ -61,31 +21,6 @@ export type SubagentAwaitChildStatus = Readonly<{
61
21
  error?: string;
62
22
  sessionId?: string;
63
23
  }>;
64
- /** Await progress, interruption, and release details. */
65
- export type SubagentAwaitData = Readonly<{
66
- invocationId?: string;
67
- requested?: readonly AgentPath[];
68
- statuses?: readonly SubagentAwaitChildStatus[];
69
- path?: AgentPath;
70
- output?: string;
71
- error?: string;
72
- reason?: 'settled' | 'detach' | 'stop' | 'message';
73
- message?: SubagentMessageData;
74
- /** Provider implementations can carry additional typed await facts. */
75
- readonly [key: string]: unknown;
76
- }>;
77
- /** Lifecycle operation details carried by interrupt, teardown, and resurrection facts. */
78
- export type SubagentLifecycleData = Readonly<{
79
- operation?: 'interrupt' | 'teardown' | 'resurrect';
80
- outcome?: string;
81
- path?: AgentPath;
82
- output?: string;
83
- error?: string;
84
- sessionId?: string;
85
- recovery?: Readonly<Record<string, unknown>>;
86
- /** Provider implementations can carry operation-specific recovery data. */
87
- readonly [key: string]: unknown;
88
- }>;
89
24
  /** A public node projection carried by topology events and snapshots. */
90
25
  export type SubagentNodeSnapshot = Readonly<{
91
26
  path: AgentPath;
@@ -104,7 +39,6 @@ export type SubagentNodeSnapshot = Readonly<{
104
39
  contextFill?: number;
105
40
  channels: readonly string[];
106
41
  waitingFor: readonly AgentPath[];
107
- pendingCorrelations: readonly string[];
108
42
  hasSubgroup: boolean;
109
43
  lastOutput?: string;
110
44
  lastError?: string;
@@ -120,44 +54,6 @@ export type SubagentRuntimeReplacedData = Readonly<{
120
54
  oldSessionId: string;
121
55
  newSessionId: string;
122
56
  }>;
123
- export type SubagentEventData = Readonly<{
124
- kind: 'node_added' | 'node_updated';
125
- data: SubagentNodeEventData;
126
- }> | Readonly<{
127
- kind: 'node_removed';
128
- data: Readonly<{
129
- node: SubagentNodeSnapshot;
130
- reason: string;
131
- }>;
132
- }> | Readonly<{
133
- kind: 'runtime_replaced';
134
- data: SubagentRuntimeReplacedData;
135
- }> | Readonly<{
136
- kind: 'delegation';
137
- data: SubagentDelegationData;
138
- }> | Readonly<{
139
- kind: 'message_thread';
140
- data: SubagentMessageData;
141
- }> | Readonly<{
142
- kind: 'await_started' | 'child_settled' | 'await_interrupted' | 'await_released';
143
- data: SubagentAwaitData;
144
- }> | Readonly<{
145
- kind: 'completion';
146
- data: SubagentCompletionData;
147
- }> | Readonly<{
148
- kind: 'interrupt' | 'teardown' | 'resurrect';
149
- data: SubagentLifecycleData;
150
- }>;
151
- /** A semantic overlay. Native Pi entries remain the transcript source. */
152
- export type SubagentSemanticFact = Readonly<{
153
- eventId: string;
154
- path: AgentPath;
155
- relatedPiEvents: readonly PiEventRef[];
156
- }> & SubagentEventData;
157
- /** A typed live feed event with its provider-owned replay cursor. */
158
- export type SubagentEvent = SubagentSemanticFact & Readonly<{
159
- cursor: FeedCursor;
160
- }>;
161
57
  export type SubagentState = 'running' | 'waiting' | 'idle' | 'errored' | 'dead';
162
58
  export type SubagentNodeState = SubagentState;
163
59
  export type SubagentCostBreakdown = Readonly<{
@@ -176,19 +72,6 @@ export type SubagentUsage = Readonly<{
176
72
  costBreakdown?: SubagentCostBreakdown;
177
73
  turns: number;
178
74
  }>;
179
- /** Snapshot boundary for the current provider epoch. */
180
- export type SubagentSnapshot = Readonly<{
181
- cursor: FeedCursor;
182
- nodes: readonly SubagentNodeSnapshot[];
183
- }>;
184
- export type ReplayResult = Readonly<{
185
- kind: 'events';
186
- cursor: FeedCursor;
187
- events: readonly SubagentEvent[];
188
- }> | Readonly<{
189
- kind: 'snapshot_required';
190
- reason: 'epoch_changed' | 'history_unavailable';
191
- }>;
192
75
  export type SubagentTeardownReason = 'not_found' | 'already_removed' | 'removed';
193
76
  export type SubagentTeardownResult = Readonly<{
194
77
  path: AgentPath;
@@ -261,6 +144,8 @@ export type BorrowedSessionManager = Pick<AgentSession['sessionManager'], 'getEn
261
144
  */
262
145
  export type BorrowedAgentSession = Pick<AgentSession, 'sessionId' | 'sessionFile' | 'messages' | 'model' | 'thinkingLevel' | 'isStreaming' | 'isIdle' | 'isCompacting' | 'subscribe' | 'prompt' | 'steer' | 'followUp' | 'abort' | 'executeBash' | 'abortBash' | 'setModel' | 'cycleModel' | 'setThinkingLevel' | 'cycleThinkingLevel' | 'setAutoCompactionEnabled' | 'compact' | 'navigateTree' | 'getContextUsage' | 'getSessionStats'> & {
263
146
  readonly sessionManager: BorrowedSessionManager;
147
+ /** Current native steering queue, when supported by the provider. */
148
+ readonly getSteeringMessages?: AgentSession['getSteeringMessages'];
264
149
  /** Full-resync native state projection. */
265
150
  readonly state: Pick<AgentSession['state'], 'streamingMessage' | 'pendingToolCalls' | 'errorMessage'>;
266
151
  };
@@ -287,11 +172,8 @@ export interface SubagentOwnerControlPort {
287
172
  stop(request: SubagentStopRequest): Promise<void>;
288
173
  resurrect(request: SubagentResurrectRequest): Promise<SubagentResurrectResult>;
289
174
  }
290
- /** Per-session provider feed and borrowed-runtime contract. */
291
- export interface SubagentProvider {
292
- subscribe(listener: (event: SubagentEvent) => void): () => void;
293
- snapshot(): SubagentSnapshot;
294
- replay(after?: FeedCursor): ReplayResult;
175
+ /** Provider-owned leases and guarded lifecycle controls shared by the presentation seam. */
176
+ export interface SubagentProviderControls {
295
177
  acquire(path: AgentPath): Promise<SubagentLease>;
296
178
  teardown(path: AgentPath, incarnation: string): Promise<SubagentTeardownResult>;
297
179
  stop(request: SubagentStopRequest): Promise<void>;
@@ -304,16 +186,16 @@ export type SubagentProviderRequest = Readonly<{
304
186
  }>;
305
187
  /** EventBus response payload used by provider registration and discovery. */
306
188
  export type SubagentProviderResponse = Readonly<{
307
- provider: SubagentProvider;
189
+ provider: import('./presentation.js').SubagentPresentationProvider;
308
190
  }>;
309
191
  /** A live discovery handle that tracks late registration and replacement. */
310
192
  export interface SubagentProviderDiscovery {
311
- readonly provider: SubagentProvider | undefined;
193
+ readonly provider: import('./presentation.js').SubagentPresentationProvider | undefined;
312
194
  /** Alias for callers that model discovery as a mutable current value. */
313
- readonly current: SubagentProvider | undefined;
314
- subscribe(listener: (provider: SubagentProvider | undefined) => void): () => void;
195
+ readonly current: import('./presentation.js').SubagentPresentationProvider | undefined;
196
+ subscribe(listener: (provider: import('./presentation.js').SubagentPresentationProvider | undefined) => void): () => void;
315
197
  /** Alias for subscribe, useful at the host event boundary. */
316
- onProvider(listener: (provider: SubagentProvider | undefined) => void): () => void;
198
+ onProvider(listener: (provider: import('./presentation.js').SubagentPresentationProvider | undefined) => void): () => void;
317
199
  close(): void;
318
200
  }
319
201
  /** Extract the EventBus from either ExtensionAPI or an EventBus itself. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pimote/sdk",
3
- "version": "0.16.0-rc.1",
3
+ "version": "0.16.0-rc.3",
4
4
  "description": "Pimote extensibility SDK: panel cards, background-activity reap guard, Pimote extensions, and source-only folder discovery",
5
5
  "type": "module",
6
6
  "license": "MIT",