opencode-subagent-magazine 1.6.0-beta.0 → 1.6.0-beta.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/dist/_version.d.ts +1 -1
- package/dist/_version.js +1 -1
- package/dist/core/types.js +1 -1
- package/dist/panel/SubAgentPanel.js +22 -6
- package/dist/panel/panel-api.d.ts +3 -0
- package/dist/panel/session-routing.d.ts +3 -0
- package/dist/panel/session-routing.js +4 -0
- package/dist/tui.js +24 -8
- package/dist/v2/v2-panel-api.js +11 -4
- package/dist/v2.js +31 -11
- package/package.json +2 -1
- package/src/_version.ts +1 -1
- package/src/core/types.ts +58 -58
- package/src/panel/SubAgentPanel.tsx +18 -6
- package/src/panel/panel-api.ts +75 -72
- package/src/panel/session-routing.ts +10 -0
- package/src/v2/v2-panel-api.ts +307 -301
package/src/panel/panel-api.ts
CHANGED
|
@@ -1,72 +1,75 @@
|
|
|
1
|
-
import type { KVApi } from "../core/kv"
|
|
2
|
-
import type { UsageReader, TodoStats } from "../core/usage"
|
|
3
|
-
import type { Lang, SortOrder, ScrollMode } from "../core/types"
|
|
4
|
-
|
|
5
|
-
/** Minimal session shape the panel reads from the host SDK. */
|
|
6
|
-
export interface SessionLike {
|
|
7
|
-
id?: string
|
|
8
|
-
parentID?: string
|
|
9
|
-
agent?: string
|
|
10
|
-
cost?: number
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface SessionStatusLike {
|
|
14
|
-
type: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Standardized panel events. Adapter layers (V1/V2) translate host events
|
|
19
|
-
* into these shapes so the panel component never touches host APIs directly.
|
|
20
|
-
*/
|
|
21
|
-
export type PanelEventType = "part.updated" | "message.updated" | "session.idle" | "session.error"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
1
|
+
import type { KVApi } from "../core/kv"
|
|
2
|
+
import type { UsageReader, TodoStats } from "../core/usage"
|
|
3
|
+
import type { Lang, SortOrder, ScrollMode } from "../core/types"
|
|
4
|
+
|
|
5
|
+
/** Minimal session shape the panel reads from the host SDK. */
|
|
6
|
+
export interface SessionLike {
|
|
7
|
+
id?: string
|
|
8
|
+
parentID?: string
|
|
9
|
+
agent?: string
|
|
10
|
+
cost?: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface SessionStatusLike {
|
|
14
|
+
type: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Standardized panel events. Adapter layers (V1/V2) translate host events
|
|
19
|
+
* into these shapes so the panel component never touches host APIs directly.
|
|
20
|
+
*/
|
|
21
|
+
export type PanelEventType = "part.updated" | "message.updated" | "session.idle" | "session.error"
|
|
22
|
+
export type PanelEventScope = "session" | "global"
|
|
23
|
+
|
|
24
|
+
export interface PanelEvent {
|
|
25
|
+
type: PanelEventType
|
|
26
|
+
/** Global V2 events need explicit session ownership checks. */
|
|
27
|
+
scope?: PanelEventScope
|
|
28
|
+
/** part payload for part.updated; session properties for idle/error. */
|
|
29
|
+
payload?: Record<string, unknown>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface ToastOptions {
|
|
33
|
+
variant?: "success" | "warning" | "error"
|
|
34
|
+
title?: string
|
|
35
|
+
duration?: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The full surface the SubAgentPanel component consumes.
|
|
40
|
+
* V1 and V2 each implement this against their host SDK; the panel is agnostic.
|
|
41
|
+
* Theme is slot-scoped in both hosts, so it is passed as a panel prop,
|
|
42
|
+
* not part of the API.
|
|
43
|
+
*/
|
|
44
|
+
export interface PanelApi {
|
|
45
|
+
kv: KVApi
|
|
46
|
+
usage: UsageReader
|
|
47
|
+
session: {
|
|
48
|
+
get(sid: string): SessionLike | undefined
|
|
49
|
+
status(sid: string): SessionStatusLike | undefined
|
|
50
|
+
/** Raw message list for a session (scan / error extraction). */
|
|
51
|
+
messages(sid: string): unknown[] | undefined
|
|
52
|
+
/** Raw parts of a message (scan). */
|
|
53
|
+
part(messageID: string): unknown[] | undefined
|
|
54
|
+
}
|
|
55
|
+
event: {
|
|
56
|
+
on(type: PanelEventType, cb: (e: PanelEvent) => void): () => void
|
|
57
|
+
}
|
|
58
|
+
client: {
|
|
59
|
+
abort(input: { sessionID: string }): Promise<void>
|
|
60
|
+
}
|
|
61
|
+
route: {
|
|
62
|
+
navigateSession(sessionID: string): void
|
|
63
|
+
}
|
|
64
|
+
ui: {
|
|
65
|
+
toast(message: string, opts?: ToastOptions): void
|
|
66
|
+
}
|
|
67
|
+
settings: {
|
|
68
|
+
lang: () => Lang
|
|
69
|
+
maxEntries: () => number
|
|
70
|
+
sortOrder: () => SortOrder
|
|
71
|
+
scrollMode: () => ScrollMode
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type { TodoStats }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SessionLike } from "./panel-api"
|
|
2
|
+
|
|
3
|
+
/** Whether an end event belongs to a child tracked by the current panel. */
|
|
4
|
+
export function isDirectChildSession(
|
|
5
|
+
currentSessionId: string,
|
|
6
|
+
eventSessionId: string,
|
|
7
|
+
eventSession: SessionLike | undefined,
|
|
8
|
+
): boolean {
|
|
9
|
+
return eventSessionId !== currentSessionId && eventSession?.parentID === currentSessionId
|
|
10
|
+
}
|