xgen-dex-cli 1.49.0 → 1.51.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.
@@ -1096,6 +1096,109 @@ var ChatApi = class {
1096
1096
  }
1097
1097
  };
1098
1098
 
1099
+ // ../../packages/protocol/src/chat-guardrails.ts
1100
+ var CHAT_AI_DISCLAIMER_KEY = "CHAT_AI_DISCLAIMER_ENABLED";
1101
+ function coerceConfigBool(value, fallback) {
1102
+ if (value === null || value === void 0) return fallback;
1103
+ if (typeof value === "boolean") return value;
1104
+ if (typeof value === "number") return value !== 0;
1105
+ if (typeof value === "string") {
1106
+ const s = value.trim().toLowerCase();
1107
+ if (["true", "1", "yes", "on", "enabled"].includes(s)) return true;
1108
+ if (["false", "0", "no", "off", "disabled", ""].includes(s)) return false;
1109
+ }
1110
+ return fallback;
1111
+ }
1112
+ var SAFE = { pii: false, forbidden: false, flagged: false };
1113
+ var ChatGuardrailsApi = class {
1114
+ constructor(http) {
1115
+ this.http = http;
1116
+ }
1117
+ /**
1118
+ * 답변 아래 면책 문구를 보일까. 모르면 **보인다**(기본 켜짐).
1119
+ *
1120
+ * 못 읽었다고 문구를 빼면, 있어야 할 안내가 조용히 사라진다 — 잠깐 늦게 뜨는 쪽이 낫다.
1121
+ */
1122
+ async disclaimerEnabled() {
1123
+ try {
1124
+ const res = await this.http.get(
1125
+ `/api/base/v1/config/${encodeURIComponent(CHAT_AI_DISCLAIMER_KEY)}`
1126
+ );
1127
+ return coerceConfigBool(res?.current_value, true);
1128
+ } catch {
1129
+ return true;
1130
+ }
1131
+ }
1132
+ /**
1133
+ * 보내려는 글에 민감정보가 있는가. 검사기가 없거나 실패하면 **없는 것으로** 본다.
1134
+ *
1135
+ * 여기서 막지 않는다 — 경고만 남기고 보내는 것은 사용자가 정한다(웹과 같다).
1136
+ */
1137
+ async checkContent(text) {
1138
+ if (!text.trim()) return SAFE;
1139
+ try {
1140
+ const res = await this.http.post("/api/config/content-filter/check", {
1141
+ text
1142
+ });
1143
+ return { pii: !!res?.pii, forbidden: !!res?.forbidden, flagged: !!res?.flagged };
1144
+ } catch {
1145
+ return SAFE;
1146
+ }
1147
+ }
1148
+ };
1149
+
1150
+ // ../../packages/protocol/src/feedback.ts
1151
+ var toFeedback = (r) => ({
1152
+ id: r.id,
1153
+ executionIoId: r.execution_io_id,
1154
+ starRating: r.star_rating,
1155
+ issueType: r.issue_type,
1156
+ comment: r.comment ?? null,
1157
+ createdAt: r.created_at ?? null,
1158
+ updatedAt: r.updated_at ?? null
1159
+ });
1160
+ var FeedbackApi = class {
1161
+ constructor(http) {
1162
+ this.http = http;
1163
+ }
1164
+ /** 별점·문제 유형을 남긴다. 이미 남긴 실행이면 서버가 갱신한다. */
1165
+ async submit(input) {
1166
+ const res = await this.http.post("/api/agentflow/feedback", {
1167
+ execution_io_id: input.executionIoId,
1168
+ star_rating: input.starRating,
1169
+ issue_type: input.issueType,
1170
+ ...input.comment ? { comment: input.comment } : {}
1171
+ });
1172
+ return toFeedback(res.data);
1173
+ }
1174
+ /** 이미 남긴 것을 고친다. */
1175
+ async update(feedbackId, input) {
1176
+ const res = await this.http.put(`/api/agentflow/feedback/${feedbackId}`, {
1177
+ ...input.starRating !== void 0 ? { star_rating: input.starRating } : {},
1178
+ ...input.issueType !== void 0 ? { issue_type: input.issueType } : {},
1179
+ ...input.comment !== void 0 ? { comment: input.comment } : {}
1180
+ });
1181
+ return toFeedback(res.data);
1182
+ }
1183
+ async remove(feedbackId) {
1184
+ await this.http.del(`/api/agentflow/feedback/${feedbackId}`);
1185
+ }
1186
+ /**
1187
+ * 이 실행들에 내가 남긴 피드백 — 대화를 열 때 한 번에 읽는다.
1188
+ *
1189
+ * 답변마다 물어보면 대화 하나를 열 때 수십 번을 부르게 된다. 빈 목록을 물어보지도 않는다.
1190
+ */
1191
+ async mine(executionIoIds) {
1192
+ const ids = executionIoIds.filter((id) => id !== void 0 && id !== null);
1193
+ if (ids.length === 0) return [];
1194
+ const params = new URLSearchParams({ execution_io_ids: ids.join(",") });
1195
+ const res = await this.http.get(
1196
+ `/api/agentflow/feedback/me?${params}`
1197
+ );
1198
+ return (res.items ?? []).map(toFeedback);
1199
+ }
1200
+ };
1201
+
1099
1202
  // ../../packages/protocol/src/browser.ts
1100
1203
  var BROWSER_CONTEXT_START = "<xgen_browser_context>";
1101
1204
  var BROWSER_CONTEXT_END = "</xgen_browser_context>";
@@ -1821,6 +1924,8 @@ var XgenClient = class {
1821
1924
  auth;
1822
1925
  agents;
1823
1926
  chat;
1927
+ guardrails;
1928
+ feedback;
1824
1929
  history;
1825
1930
  preferences;
1826
1931
  ssh;
@@ -1847,6 +1952,8 @@ var XgenClient = class {
1847
1952
  this.auth = new AuthApi(this.http);
1848
1953
  this.agents = new AgentsApi(this.http);
1849
1954
  this.chat = new ChatApi(this.http);
1955
+ this.guardrails = new ChatGuardrailsApi(this.http);
1956
+ this.feedback = new FeedbackApi(this.http);
1850
1957
  this.history = new HistoryApi(this.http);
1851
1958
  this.preferences = new PreferencesApi(this.http);
1852
1959
  this.ssh = new SshApi(this.http);
@@ -5858,4 +5965,4 @@ export {
5858
5965
  credentialBackend,
5859
5966
  SystemCredentialStore
5860
5967
  };
5861
- //# sourceMappingURL=chunk-KQD34QI4.js.map
5968
+ //# sourceMappingURL=chunk-BI3JMI6K.js.map