@autobe/rpc 0.29.2 → 0.30.0-dev.20260315

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,138 +1,145 @@
1
- import {
2
- AutoBeHistory,
3
- AutoBePhase,
4
- AutoBeUserMessageContent,
5
- IAutoBeAgent,
6
- IAutoBeGetFilesOptions,
7
- IAutoBeRpcListener,
8
- IAutoBeRpcService,
9
- IAutoBeTokenUsageJson,
10
- } from "@autobe/interface";
11
- import typia from "typia";
12
-
13
- /**
14
- * WebSocket RPC service implementation that wraps AutoBeAgent for remote
15
- * access.
16
- *
17
- * This class serves as the WebSocket RPC Provider in TGrid's paradigm, exposing
18
- * AutoBeAgent functionality to remote client applications through type-safe
19
- * WebSocket connections. It implements the {@link IAutoBeRpcService} interface
20
- * to provide standardized remote procedure call access to the vibe coding
21
- * pipeline.
22
- *
23
- * The service automatically bridges all agent events to the client's event
24
- * listener, ensuring that remote clients receive real-time progress
25
- * notifications throughout the development process. This enables responsive
26
- * user interfaces that can display progress, handle artifacts, and provide
27
- * feedback during the automated development workflow.
28
- *
29
- * By wrapping the AutoBeAgent, this service transforms local agent capabilities
30
- * into a distributed system component that supports multiple concurrent client
31
- * connections while maintaining the full functionality and event transparency
32
- * of the underlying vibe coding system.
33
- *
34
- * @author Samchon
35
- */
36
- export class AutoBeRpcService implements IAutoBeRpcService {
37
- /**
38
- * Initializes the RPC service with an AutoBeAgent and client event listener.
39
- *
40
- * Creates the service wrapper around the provided AutoBeAgent and establishes
41
- * automatic event forwarding to the client's listener. All agent events are
42
- * automatically registered and forwarded to ensure the remote client receives
43
- * comprehensive real-time updates about conversation flow, development
44
- * progress, and completion events.
45
- *
46
- * The event bridging is established during construction and remains active
47
- * throughout the service lifetime, providing seamless integration between the
48
- * local agent's event system and the remote client's notification handlers.
49
- *
50
- * @param props Configuration containing the agent instance and client
51
- * listener
52
- */
53
- public constructor(private readonly props: AgenticaRpcService.IProps) {
54
- const { agent, listener } = this.props;
55
- for (const key of typia.misc.literals<keyof IAutoBeRpcListener>()) {
56
- if (key === "enable") continue;
57
- agent.on(key, (event) => {
58
- listener[key]!(event as any).catch(() => {});
59
- });
60
- }
61
- }
62
-
63
- public async conversate(
64
- content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[],
65
- ): Promise<AutoBeHistory[]> {
66
- if (this.props.onStart) this.props.onStart(content);
67
-
68
- this.props.listener.enable(false).catch(() => {});
69
- try {
70
- const result: AutoBeHistory[] =
71
- await this.props.agent.conversate(content);
72
- if (this.props.onComplete) this.props.onComplete(result);
73
- return result;
74
- } finally {
75
- this.props.listener.enable(true).catch(() => {});
76
- }
77
- }
78
-
79
- public async getFiles(
80
- options?: Partial<IAutoBeGetFilesOptions>,
81
- ): Promise<Record<string, string>> {
82
- return this.props.agent.getFiles(options);
83
- }
84
-
85
- public async getHistories(): Promise<AutoBeHistory[]> {
86
- return this.props.agent.getHistories();
87
- }
88
-
89
- public async getTokenUsage(): Promise<IAutoBeTokenUsageJson> {
90
- return this.props.agent.getTokenUsage();
91
- }
92
-
93
- public async getPhase(): Promise<AutoBePhase | null> {
94
- return this.props.agent.getPhase();
95
- }
96
- }
97
-
98
- export namespace AgenticaRpcService {
99
- /**
100
- * Configuration properties for initializing the AutoBeRpcService.
101
- *
102
- * Defines the required components for creating a WebSocket RPC service that
103
- * exposes AutoBeAgent functionality to remote clients. The configuration
104
- * establishes both the underlying agent capabilities and the event forwarding
105
- * mechanism necessary for real-time client notifications.
106
- *
107
- * @author Samchon
108
- */
109
- export interface IProps {
110
- /**
111
- * AutoBeAgent instance to expose through the RPC service.
112
- *
113
- * The core agent that provides vibe coding capabilities including
114
- * conversation processing, development pipeline orchestration, and artifact
115
- * generation. This agent's functionality becomes available to remote
116
- * clients through the RPC service interface while maintaining full feature
117
- * compatibility.
118
- */
119
- agent: IAutoBeAgent;
120
-
121
- /**
122
- * Client event listener for receiving agent events.
123
- *
124
- * The remote client's event listener implementation that will receive all
125
- * agent events including conversation flow, development progress, and
126
- * completion notifications. The service automatically forwards all agent
127
- * events to this listener to ensure comprehensive real-time visibility for
128
- * the remote client.
129
- */
130
- listener: IAutoBeRpcListener;
131
-
132
- onStart?: (
133
- content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[],
134
- ) => void;
135
-
136
- onComplete?: (result: AutoBeHistory[]) => void;
137
- }
138
- }
1
+ import {
2
+ AutoBeHistory,
3
+ AutoBePhase,
4
+ AutoBeUserConversateContent,
5
+ IAutoBeAgent,
6
+ IAutoBeGetFilesOptions,
7
+ IAutoBeRpcListener,
8
+ IAutoBeRpcService,
9
+ IAutoBeTokenUsageJson,
10
+ } from "@autobe/interface";
11
+ import typia from "typia";
12
+
13
+ /**
14
+ * WebSocket RPC service implementation that wraps AutoBeAgent for remote
15
+ * access.
16
+ *
17
+ * This class serves as the WebSocket RPC Provider in TGrid's paradigm, exposing
18
+ * AutoBeAgent functionality to remote client applications through type-safe
19
+ * WebSocket connections. It implements the {@link IAutoBeRpcService} interface
20
+ * to provide standardized remote procedure call access to the vibe coding
21
+ * pipeline.
22
+ *
23
+ * The service automatically bridges all agent events to the client's event
24
+ * listener, ensuring that remote clients receive real-time progress
25
+ * notifications throughout the development process. This enables responsive
26
+ * user interfaces that can display progress, handle artifacts, and provide
27
+ * feedback during the automated development workflow.
28
+ *
29
+ * By wrapping the AutoBeAgent, this service transforms local agent capabilities
30
+ * into a distributed system component that supports multiple concurrent client
31
+ * connections while maintaining the full functionality and event transparency
32
+ * of the underlying vibe coding system.
33
+ *
34
+ * @author Samchon
35
+ */
36
+ export class AutoBeRpcService implements IAutoBeRpcService {
37
+ /**
38
+ * Initializes the RPC service with an AutoBeAgent and client event listener.
39
+ *
40
+ * Creates the service wrapper around the provided AutoBeAgent and establishes
41
+ * automatic event forwarding to the client's listener. All agent events are
42
+ * automatically registered and forwarded to ensure the remote client receives
43
+ * comprehensive real-time updates about conversation flow, development
44
+ * progress, and completion events.
45
+ *
46
+ * The event bridging is established during construction and remains active
47
+ * throughout the service lifetime, providing seamless integration between the
48
+ * local agent's event system and the remote client's notification handlers.
49
+ *
50
+ * @param props Configuration containing the agent instance and client
51
+ * listener
52
+ */
53
+ public constructor(private readonly props: AgenticaRpcService.IProps) {
54
+ const { agent, listener } = this.props;
55
+ for (const key of typia.misc.literals<keyof IAutoBeRpcListener>()) {
56
+ if (key === "enable") continue;
57
+ agent.on(key, (event) => {
58
+ // biome-ignore lint: intended
59
+ listener[key]!(event as any).catch(() => {});
60
+ });
61
+ }
62
+ }
63
+
64
+ public async conversate(
65
+ content:
66
+ | string
67
+ | AutoBeUserConversateContent
68
+ | AutoBeUserConversateContent[],
69
+ ): Promise<AutoBeHistory[]> {
70
+ if (this.props.onStart) this.props.onStart(content);
71
+
72
+ this.props.listener.enable(false).catch(() => {});
73
+ try {
74
+ const result: AutoBeHistory[] =
75
+ await this.props.agent.conversate(content);
76
+ if (this.props.onComplete) this.props.onComplete(result);
77
+ return result;
78
+ } finally {
79
+ this.props.listener.enable(true).catch(() => {});
80
+ }
81
+ }
82
+
83
+ public async getFiles(
84
+ options?: Partial<IAutoBeGetFilesOptions>,
85
+ ): Promise<Record<string, string>> {
86
+ return this.props.agent.getFiles(options);
87
+ }
88
+
89
+ public async getHistories(): Promise<AutoBeHistory[]> {
90
+ return this.props.agent.getHistories();
91
+ }
92
+
93
+ public async getTokenUsage(): Promise<IAutoBeTokenUsageJson> {
94
+ return this.props.agent.getTokenUsage();
95
+ }
96
+
97
+ public async getPhase(): Promise<AutoBePhase | null> {
98
+ return this.props.agent.getPhase();
99
+ }
100
+ }
101
+
102
+ export namespace AgenticaRpcService {
103
+ /**
104
+ * Configuration properties for initializing the AutoBeRpcService.
105
+ *
106
+ * Defines the required components for creating a WebSocket RPC service that
107
+ * exposes AutoBeAgent functionality to remote clients. The configuration
108
+ * establishes both the underlying agent capabilities and the event forwarding
109
+ * mechanism necessary for real-time client notifications.
110
+ *
111
+ * @author Samchon
112
+ */
113
+ export interface IProps {
114
+ /**
115
+ * AutoBeAgent instance to expose through the RPC service.
116
+ *
117
+ * The core agent that provides vibe coding capabilities including
118
+ * conversation processing, development pipeline orchestration, and artifact
119
+ * generation. This agent's functionality becomes available to remote
120
+ * clients through the RPC service interface while maintaining full feature
121
+ * compatibility.
122
+ */
123
+ agent: IAutoBeAgent;
124
+
125
+ /**
126
+ * Client event listener for receiving agent events.
127
+ *
128
+ * The remote client's event listener implementation that will receive all
129
+ * agent events including conversation flow, development progress, and
130
+ * completion notifications. The service automatically forwards all agent
131
+ * events to this listener to ensure comprehensive real-time visibility for
132
+ * the remote client.
133
+ */
134
+ listener: IAutoBeRpcListener;
135
+
136
+ onStart?: (
137
+ content:
138
+ | string
139
+ | AutoBeUserConversateContent
140
+ | AutoBeUserConversateContent[],
141
+ ) => void;
142
+
143
+ onComplete?: (result: AutoBeHistory[]) => void;
144
+ }
145
+ }
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from "./AutoBeRpcService";
1
+ export * from "./AutoBeRpcService";