@autobe/rpc 0.22.0 → 0.23.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.
@@ -1,4 +1,4 @@
1
- import { AutoBeHistory, AutoBeUserMessageContent, IAutoBeAgent, IAutoBeGetFilesOptions, IAutoBeRpcListener, IAutoBeRpcService, IAutoBeTokenUsageJson } from "@autobe/interface";
1
+ import { AutoBeHistory, AutoBePhase, AutoBeUserMessageContent, IAutoBeAgent, IAutoBeGetFilesOptions, IAutoBeRpcListener, IAutoBeRpcService, IAutoBeTokenUsageJson } from "@autobe/interface";
2
2
  /**
3
3
  * WebSocket RPC service implementation that wraps AutoBeAgent for remote
4
4
  * access.
@@ -45,6 +45,7 @@ export declare class AutoBeRpcService implements IAutoBeRpcService {
45
45
  getFiles(options?: Partial<IAutoBeGetFilesOptions>): Promise<Record<string, string>>;
46
46
  getHistories(): Promise<AutoBeHistory[]>;
47
47
  getTokenUsage(): Promise<IAutoBeTokenUsageJson>;
48
+ getPhase(): Promise<AutoBePhase | null>;
48
49
  }
49
50
  export declare namespace AgenticaRpcService {
50
51
  /**
@@ -78,5 +79,7 @@ export declare namespace AgenticaRpcService {
78
79
  * the remote client.
79
80
  */
80
81
  listener: IAutoBeRpcListener;
82
+ onStart?: (content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[]) => void;
83
+ onComplete?: (result: AutoBeHistory[]) => void;
81
84
  }
82
85
  }
@@ -103,14 +103,31 @@ class AutoBeRpcService {
103
103
  "realizeValidate",
104
104
  "testComplete",
105
105
  "testStart",
106
- "testValidate"
107
- ])
106
+ "testValidate",
107
+ "enable"
108
+ ]) {
109
+ if (key === "enable")
110
+ continue;
108
111
  agent.on(key, (event) => {
109
112
  listener[key](event).catch(() => { });
110
113
  });
114
+ }
111
115
  }
112
116
  conversate(content) {
113
- return this.props.agent.conversate(content);
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ if (this.props.onStart)
119
+ this.props.onStart(content);
120
+ this.props.listener.enable(false).catch(() => { });
121
+ try {
122
+ const result = yield this.props.agent.conversate(content);
123
+ if (this.props.onComplete)
124
+ this.props.onComplete(result);
125
+ return result;
126
+ }
127
+ finally {
128
+ this.props.listener.enable(true).catch(() => { });
129
+ }
130
+ });
114
131
  }
115
132
  getFiles(options) {
116
133
  return __awaiter(this, void 0, void 0, function* () {
@@ -127,6 +144,11 @@ class AutoBeRpcService {
127
144
  return this.props.agent.getTokenUsage();
128
145
  });
129
146
  }
147
+ getPhase() {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ return this.props.agent.getPhase();
150
+ });
151
+ }
130
152
  }
131
153
  exports.AutoBeRpcService = AutoBeRpcService;
132
154
  //# sourceMappingURL=AutoBeRpcService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AutoBeRpcService.js","sourceRoot":"","sources":["../src/AutoBeRpcService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,kDAA0B;AAE1B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,gBAAgB;IAC3B;;;;;;;;;;;;;;;OAeG;IACH,YAAoC,KAAgC;QAAhC,UAAK,GAAL,KAAK,CAA2B;QAClE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACvC,KAAK,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YACZ,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE;gBACtB,QAAQ,CAAC,GAAG,CAAE,CAAC,KAAY,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;IACP,CAAC;IAEM,UAAU,CACf,OAAuE;QAEvE,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAEY,QAAQ,CACnB,OAA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AAE,GAAE,CAAC,CAAC,CAAC;YAClD,IAAI,CAAC;gBACH,MAAM,MAAM,GACV,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAC7C,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU;oBAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBACzD,OAAO,MAAM,CAAC;YAChB,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;KAAA;IAEY,QAAQ,CACnB,OAAyC;;YAEzC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;KAAA;IAEY,YAAY;;YACvB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;QACzC,CAAC;KAAA;IAEY,aAAa;;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC1C,CAAC;KAAA;IAEY,QAAQ;;YACnB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,CAAC;KAAA;CACF;AA5DD,4CA4DC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobe/rpc",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "AI backend server code generator",
5
5
  "main": "lib/index.js",
6
6
  "keywords": [],
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@samchon/openapi": "^4.7.1",
28
28
  "typia": "^9.7.2",
29
- "@autobe/interface": "^0.22.0"
29
+ "@autobe/interface": "^0.23.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "rimraf": "^6.0.1",
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  AutoBeHistory,
3
+ AutoBePhase,
3
4
  AutoBeUserMessageContent,
4
5
  IAutoBeAgent,
5
6
  IAutoBeGetFilesOptions,
@@ -51,16 +52,28 @@ export class AutoBeRpcService implements IAutoBeRpcService {
51
52
  */
52
53
  public constructor(private readonly props: AgenticaRpcService.IProps) {
53
54
  const { agent, listener } = this.props;
54
- for (const key of typia.misc.literals<keyof IAutoBeRpcListener>())
55
+ for (const key of typia.misc.literals<keyof IAutoBeRpcListener>()) {
56
+ if (key === "enable") continue;
55
57
  agent.on(key, (event) => {
56
58
  listener[key]!(event as any).catch(() => {});
57
59
  });
60
+ }
58
61
  }
59
62
 
60
- public conversate(
63
+ public async conversate(
61
64
  content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[],
62
65
  ): Promise<AutoBeHistory[]> {
63
- return this.props.agent.conversate(content);
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
+ }
64
77
  }
65
78
 
66
79
  public async getFiles(
@@ -76,6 +89,10 @@ export class AutoBeRpcService implements IAutoBeRpcService {
76
89
  public async getTokenUsage(): Promise<IAutoBeTokenUsageJson> {
77
90
  return this.props.agent.getTokenUsage();
78
91
  }
92
+
93
+ public async getPhase(): Promise<AutoBePhase | null> {
94
+ return this.props.agent.getPhase();
95
+ }
79
96
  }
80
97
 
81
98
  export namespace AgenticaRpcService {
@@ -111,5 +128,11 @@ export namespace AgenticaRpcService {
111
128
  * the remote client.
112
129
  */
113
130
  listener: IAutoBeRpcListener;
131
+
132
+ onStart?: (
133
+ content: string | AutoBeUserMessageContent | AutoBeUserMessageContent[],
134
+ ) => void;
135
+
136
+ onComplete?: (result: AutoBeHistory[]) => void;
114
137
  }
115
138
  }