@space3-npm/cybersoul-client 1.4.5 → 1.4.7
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 +11 -1
- package/dist/client.js +31 -0
- package/dist/types.d.ts +18 -0
- package/package.json +1 -1
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
|
@@ -669,7 +669,9 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
669
669
|
// 5. Build Final Media Calls parallel
|
|
670
670
|
const mediaTasks = [];
|
|
671
671
|
let finalImageUrl = undefined;
|
|
672
|
+
let finalImageMediaId = undefined;
|
|
672
673
|
let finalAudioUrl = undefined;
|
|
674
|
+
let finalAudioMediaId = undefined;
|
|
673
675
|
let finalDurationSec = undefined;
|
|
674
676
|
// Output Event Trigger
|
|
675
677
|
if (parsedIntent.triggerEvent) {
|
|
@@ -703,6 +705,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
703
705
|
mediaTasks.push(this.generatePrimitive("image", imagePayload)
|
|
704
706
|
.then((res) => {
|
|
705
707
|
finalImageUrl = res.image_url;
|
|
708
|
+
finalImageMediaId = res.id;
|
|
706
709
|
})
|
|
707
710
|
.catch((e) => {
|
|
708
711
|
console.error("[CyberSoulClient] Image generation failed:", e);
|
|
@@ -726,6 +729,7 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
726
729
|
})
|
|
727
730
|
.then((res) => {
|
|
728
731
|
finalAudioUrl = res.audio_url;
|
|
732
|
+
finalAudioMediaId = res.id;
|
|
729
733
|
finalDurationSec = res.duration_sec;
|
|
730
734
|
})
|
|
731
735
|
.catch((e) => {
|
|
@@ -746,7 +750,9 @@ Note: Always include "isEndTurn". If "imageParams", "voiceArgs", "triggerEvent",
|
|
|
746
750
|
textResponse: resolvedTextResponse || "...",
|
|
747
751
|
actionText: parsedIntent.actionText || "",
|
|
748
752
|
imageUrl: finalImageUrl,
|
|
753
|
+
imageMediaId: finalImageMediaId,
|
|
749
754
|
audioUrl: finalAudioUrl,
|
|
755
|
+
audioMediaId: finalAudioMediaId,
|
|
750
756
|
likePreviousPicture: parsedIntent.likePreviousPicture,
|
|
751
757
|
durationSec: finalDurationSec,
|
|
752
758
|
triggeredEvent: parsedIntent.triggerEvent || undefined,
|
|
@@ -984,10 +990,12 @@ You MUST output ONLY a valid JSON object matching exactly this structure:
|
|
|
984
990
|
}
|
|
985
991
|
// Handle Optional Media (Image only for proactive to save compute normally, but you can extend)
|
|
986
992
|
let finalImageUrl = undefined;
|
|
993
|
+
let finalImageMediaId = undefined;
|
|
987
994
|
if (parsedIntent.imageParams) {
|
|
988
995
|
try {
|
|
989
996
|
const res = await this.generatePrimitive("image", parsedIntent.imageParams);
|
|
990
997
|
finalImageUrl = res.image_url;
|
|
998
|
+
finalImageMediaId = res.id;
|
|
991
999
|
}
|
|
992
1000
|
catch (e) {
|
|
993
1001
|
console.error("[CyberSoulClient] Proactive Image generation failed:", e);
|
|
@@ -999,6 +1007,7 @@ You MUST output ONLY a valid JSON object matching exactly this structure:
|
|
|
999
1007
|
textResponse: parsedIntent.textResponse,
|
|
1000
1008
|
actionText: parsedIntent.actionText,
|
|
1001
1009
|
imageUrl: finalImageUrl,
|
|
1010
|
+
imageMediaId: finalImageMediaId,
|
|
1002
1011
|
stateUpdate: parsedIntent.stateUpdate,
|
|
1003
1012
|
persistedDynamicContext,
|
|
1004
1013
|
};
|
|
@@ -1041,6 +1050,7 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
|
|
|
1041
1050
|
const res = await this.generatePrimitive("image", imageParams);
|
|
1042
1051
|
return {
|
|
1043
1052
|
imageUrl: res.image_url,
|
|
1053
|
+
imageMediaId: res.id,
|
|
1044
1054
|
};
|
|
1045
1055
|
}
|
|
1046
1056
|
/**
|
|
@@ -1079,6 +1089,7 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
|
|
|
1079
1089
|
});
|
|
1080
1090
|
return {
|
|
1081
1091
|
audioUrl: res.audio_url,
|
|
1092
|
+
audioMediaId: res.id,
|
|
1082
1093
|
durationSec: res.duration_sec,
|
|
1083
1094
|
};
|
|
1084
1095
|
}
|
|
@@ -1088,6 +1099,26 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
|
|
|
1088
1099
|
async getState() {
|
|
1089
1100
|
return this.fetchRemoteState();
|
|
1090
1101
|
}
|
|
1102
|
+
/**
|
|
1103
|
+
* List the public LLM models the backend currently supports, including the
|
|
1104
|
+
* `customConfigDefinition` schema for each model's `customSettings`.
|
|
1105
|
+
*
|
|
1106
|
+
* Use this to discover valid `provider` / `model` strings and the keys
|
|
1107
|
+
* each model accepts via `llmConfig.customSettings`.
|
|
1108
|
+
*/
|
|
1109
|
+
async listSupportedLLMs() {
|
|
1110
|
+
const res = await this.apiFetch("/api/v1/cyber-soul/llm-models");
|
|
1111
|
+
if (!res.ok) {
|
|
1112
|
+
throw new Error(`Failed to list supported LLMs: ${res.status}`);
|
|
1113
|
+
}
|
|
1114
|
+
const body = (await res.json());
|
|
1115
|
+
if (Array.isArray(body))
|
|
1116
|
+
return body;
|
|
1117
|
+
if (body && typeof body === "object" && Array.isArray(body.data)) {
|
|
1118
|
+
return body.data;
|
|
1119
|
+
}
|
|
1120
|
+
throw new Error("Unexpected response shape from /llm-models");
|
|
1121
|
+
}
|
|
1091
1122
|
/**
|
|
1092
1123
|
* Updates the character's relationship temperature or mood.
|
|
1093
1124
|
* 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?: {
|
|
@@ -303,6 +307,20 @@ export interface IVoiceModel {
|
|
|
303
307
|
isPublic: boolean;
|
|
304
308
|
pointsPerGeneration: number;
|
|
305
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Public LLM model entry returned by `GET /api/v1/cyber-soul/llm-models`.
|
|
312
|
+
*
|
|
313
|
+
* - `provider` is the value to pass as `llmConfig.provider`.
|
|
314
|
+
* - `name` is the value to pass as `llmConfig.model`.
|
|
315
|
+
* - `customConfigDefinition` describes the keys (and their constraints) that
|
|
316
|
+
* the model accepts via `llmConfig.customSettings`.
|
|
317
|
+
*/
|
|
318
|
+
export interface SupportedLLMModel {
|
|
319
|
+
id: string;
|
|
320
|
+
name: string;
|
|
321
|
+
provider: string;
|
|
322
|
+
customConfigDefinition: IModelCustomConfigField[];
|
|
323
|
+
}
|
|
306
324
|
export interface ICharacterProfile {
|
|
307
325
|
id: string;
|
|
308
326
|
name: string;
|