@space3-npm/cybersoul-client 1.4.5 → 1.4.8

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/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CyberSoulClientConfig, InteractParams, ProactiveParams, ProactiveResponse, OndemandEventParams, OndemandEventResponse, DispatcherIntent, InteractResponse, CharacterState, CoreMemory, UserCodex, HistoryEntry, LikedPicture, PersistedDynamicContext } from "./types.js";
1
+ import { CyberSoulClientConfig, InteractParams, ProactiveParams, ProactiveResponse, OndemandEventParams, OndemandEventResponse, DispatcherIntent, InteractResponse, CharacterState, CoreMemory, UserCodex, HistoryEntry, LikedPicture, PersistedDynamicContext, SupportedLLMModel } from "./types.js";
2
2
  export declare class CyberSoulClient {
3
3
  private config;
4
4
  private llm;
@@ -90,6 +90,7 @@ export declare class CyberSoulClient {
90
90
  interactParams?: InteractParams;
91
91
  }): Promise<{
92
92
  imageUrl: string;
93
+ imageMediaId?: string;
93
94
  }>;
94
95
  /**
95
96
  * Manually synthesize voice audio outside of chat flow.
@@ -99,12 +100,21 @@ export declare class CyberSoulClient {
99
100
  interactParams?: InteractParams;
100
101
  }): Promise<{
101
102
  audioUrl: string;
103
+ audioMediaId?: string;
102
104
  durationSec?: number;
103
105
  }>;
104
106
  /**
105
107
  * Fetches the current dynamic context and daily state.
106
108
  */
107
109
  getState(): Promise<CharacterState>;
110
+ /**
111
+ * List the public LLM models the backend currently supports, including the
112
+ * `customConfigDefinition` schema for each model's `customSettings`.
113
+ *
114
+ * Use this to discover valid `provider` / `model` strings and the keys
115
+ * each model accepts via `llmConfig.customSettings`.
116
+ */
117
+ listSupportedLLMs(): Promise<SupportedLLMModel[]>;
108
118
  /**
109
119
  * Updates the character's relationship temperature or mood.
110
120
  * Returns the server-authoritative post-write `{ temperature, relationshipStage }`
package/dist/client.js CHANGED
@@ -224,6 +224,7 @@ export class CyberSoulClient {
224
224
  Name: ${state.name}
225
225
  Demographics: Age ${state.age || "unknown"}, Gender ${state.gender || "unknown"}, Occupation ${state.occupation || "unknown"}${appearanceStr}
226
226
  Hobby: ${state.hobby || "unknown"}
227
+ Backstory: ${state.backstory || "None"}
227
228
  Personality Traits: ${state.personality_traits || "None"}
228
229
  Communication Style: ${state.communication_style || "None"}
229
230
  Interaction Boundaries: ${state.interaction_boundaries || "None"}`);
@@ -669,7 +670,9 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
669
670
  // 5. Build Final Media Calls parallel
670
671
  const mediaTasks = [];
671
672
  let finalImageUrl = undefined;
673
+ let finalImageMediaId = undefined;
672
674
  let finalAudioUrl = undefined;
675
+ let finalAudioMediaId = undefined;
673
676
  let finalDurationSec = undefined;
674
677
  // Output Event Trigger
675
678
  if (parsedIntent.triggerEvent) {
@@ -703,6 +706,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
703
706
  mediaTasks.push(this.generatePrimitive("image", imagePayload)
704
707
  .then((res) => {
705
708
  finalImageUrl = res.image_url;
709
+ finalImageMediaId = res.id;
706
710
  })
707
711
  .catch((e) => {
708
712
  console.error("[CyberSoulClient] Image generation failed:", e);
@@ -726,6 +730,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
726
730
  })
727
731
  .then((res) => {
728
732
  finalAudioUrl = res.audio_url;
733
+ finalAudioMediaId = res.id;
729
734
  finalDurationSec = res.duration_sec;
730
735
  })
731
736
  .catch((e) => {
@@ -746,7 +751,9 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
746
751
  textResponse: resolvedTextResponse || "...",
747
752
  actionText: parsedIntent.actionText || "",
748
753
  imageUrl: finalImageUrl,
754
+ imageMediaId: finalImageMediaId,
749
755
  audioUrl: finalAudioUrl,
756
+ audioMediaId: finalAudioMediaId,
750
757
  likePreviousPicture: parsedIntent.likePreviousPicture,
751
758
  durationSec: finalDurationSec,
752
759
  triggeredEvent: parsedIntent.triggerEvent || undefined,
@@ -984,10 +991,12 @@ You MUST output ONLY a valid JSON object matching exactly this structure:
984
991
  }
985
992
  // Handle Optional Media (Image only for proactive to save compute normally, but you can extend)
986
993
  let finalImageUrl = undefined;
994
+ let finalImageMediaId = undefined;
987
995
  if (parsedIntent.imageParams) {
988
996
  try {
989
997
  const res = await this.generatePrimitive("image", parsedIntent.imageParams);
990
998
  finalImageUrl = res.image_url;
999
+ finalImageMediaId = res.id;
991
1000
  }
992
1001
  catch (e) {
993
1002
  console.error("[CyberSoulClient] Proactive Image generation failed:", e);
@@ -999,6 +1008,7 @@ You MUST output ONLY a valid JSON object matching exactly this structure:
999
1008
  textResponse: parsedIntent.textResponse,
1000
1009
  actionText: parsedIntent.actionText,
1001
1010
  imageUrl: finalImageUrl,
1011
+ imageMediaId: finalImageMediaId,
1002
1012
  stateUpdate: parsedIntent.stateUpdate,
1003
1013
  persistedDynamicContext,
1004
1014
  };
@@ -1041,6 +1051,7 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
1041
1051
  const res = await this.generatePrimitive("image", imageParams);
1042
1052
  return {
1043
1053
  imageUrl: res.image_url,
1054
+ imageMediaId: res.id,
1044
1055
  };
1045
1056
  }
1046
1057
  /**
@@ -1079,6 +1090,7 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
1079
1090
  });
1080
1091
  return {
1081
1092
  audioUrl: res.audio_url,
1093
+ audioMediaId: res.id,
1082
1094
  durationSec: res.duration_sec,
1083
1095
  };
1084
1096
  }
@@ -1088,6 +1100,26 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
1088
1100
  async getState() {
1089
1101
  return this.fetchRemoteState();
1090
1102
  }
1103
+ /**
1104
+ * List the public LLM models the backend currently supports, including the
1105
+ * `customConfigDefinition` schema for each model's `customSettings`.
1106
+ *
1107
+ * Use this to discover valid `provider` / `model` strings and the keys
1108
+ * each model accepts via `llmConfig.customSettings`.
1109
+ */
1110
+ async listSupportedLLMs() {
1111
+ const res = await this.apiFetch("/api/v1/cyber-soul/llm-models");
1112
+ if (!res.ok) {
1113
+ throw new Error(`Failed to list supported LLMs: ${res.status}`);
1114
+ }
1115
+ const body = (await res.json());
1116
+ if (Array.isArray(body))
1117
+ return body;
1118
+ if (body && typeof body === "object" && Array.isArray(body.data)) {
1119
+ return body.data;
1120
+ }
1121
+ throw new Error("Unexpected response shape from /llm-models");
1122
+ }
1091
1123
  /**
1092
1124
  * Updates the character's relationship temperature or mood.
1093
1125
  * Returns the server-authoritative post-write `{ temperature, relationshipStage }`
package/dist/types.d.ts CHANGED
@@ -66,7 +66,9 @@ export interface ProactiveResponse {
66
66
  textResponse?: string;
67
67
  actionText?: string;
68
68
  imageUrl?: string;
69
+ imageMediaId?: string;
69
70
  audioUrl?: string;
71
+ audioMediaId?: string;
70
72
  stateUpdate?: DispatcherIntent["stateUpdate"];
71
73
  /** Server-authoritative post-write snapshot (see PersistedDynamicContext). */
72
74
  persistedDynamicContext?: PersistedDynamicContext;
@@ -116,7 +118,9 @@ export interface InteractResponse {
116
118
  textResponse: string;
117
119
  actionText?: string;
118
120
  imageUrl?: string;
121
+ imageMediaId?: string;
119
122
  audioUrl?: string;
123
+ audioMediaId?: string;
120
124
  likePreviousPicture?: boolean;
121
125
  durationSec?: number;
122
126
  triggeredEvent?: {
@@ -252,6 +256,7 @@ export interface CharacterState {
252
256
  appearance?: string;
253
257
  interaction_boundaries?: string;
254
258
  communication_style?: string;
259
+ backstory?: string;
255
260
  user_codex?: UserCodex;
256
261
  }
257
262
  export interface BaseLLMProvider {
@@ -303,6 +308,20 @@ export interface IVoiceModel {
303
308
  isPublic: boolean;
304
309
  pointsPerGeneration: number;
305
310
  }
311
+ /**
312
+ * Public LLM model entry returned by `GET /api/v1/cyber-soul/llm-models`.
313
+ *
314
+ * - `provider` is the value to pass as `llmConfig.provider`.
315
+ * - `name` is the value to pass as `llmConfig.model`.
316
+ * - `customConfigDefinition` describes the keys (and their constraints) that
317
+ * the model accepts via `llmConfig.customSettings`.
318
+ */
319
+ export interface SupportedLLMModel {
320
+ id: string;
321
+ name: string;
322
+ provider: string;
323
+ customConfigDefinition: IModelCustomConfigField[];
324
+ }
306
325
  export interface ICharacterProfile {
307
326
  id: string;
308
327
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.4.5",
3
+ "version": "1.4.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",