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.
@@ -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
- export interface PanelEvent {
24
- type: PanelEventType
25
- /** part payload for part.updated; session properties for idle/error. */
26
- payload?: Record<string, unknown>
27
- }
28
-
29
- export interface ToastOptions {
30
- variant?: "success" | "warning" | "error"
31
- title?: string
32
- duration?: number
33
- }
34
-
35
- /**
36
- * The full surface the SubAgentPanel component consumes.
37
- * V1 and V2 each implement this against their host SDK; the panel is agnostic.
38
- * Theme is slot-scoped in both hosts, so it is passed as a panel prop,
39
- * not part of the API.
40
- */
41
- export interface PanelApi {
42
- kv: KVApi
43
- usage: UsageReader
44
- session: {
45
- get(sid: string): SessionLike | undefined
46
- status(sid: string): SessionStatusLike | undefined
47
- /** Raw message list for a session (scan / error extraction). */
48
- messages(sid: string): unknown[] | undefined
49
- /** Raw parts of a message (scan). */
50
- part(messageID: string): unknown[] | undefined
51
- }
52
- event: {
53
- on(type: PanelEventType, cb: (e: PanelEvent) => void): () => void
54
- }
55
- client: {
56
- abort(input: { sessionID: string }): Promise<void>
57
- }
58
- route: {
59
- navigateSession(sessionID: string): void
60
- }
61
- ui: {
62
- toast(message: string, opts?: ToastOptions): void
63
- }
64
- settings: {
65
- lang: () => Lang
66
- maxEntries: () => number
67
- sortOrder: () => SortOrder
68
- scrollMode: () => ScrollMode
69
- }
70
- }
71
-
72
- export type { TodoStats }
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
+ }