@space3-npm/cybersoul-client 1.1.6 → 1.1.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
@@ -13,6 +13,7 @@ export declare class CyberSoulClient {
13
13
  private apiFetch;
14
14
  private buildStateContextPrompt;
15
15
  private getImageSchemaParams;
16
+ private getEventSchemaParams;
16
17
  private getVoiceSchemaParams;
17
18
  private buildVoiceSchemaFromDynamicParams;
18
19
  /**
package/dist/client.js CHANGED
@@ -155,6 +155,14 @@ ${scenarioContext}
155
155
  "ondemandOutfit": "e.g., silk robe (ENGLISH ONLY)",
156
156
  "style": "e.g., photorealistic (ENGLISH ONLY)"
157
157
  }`;
158
+ }
159
+ getEventSchemaParams(userName) {
160
+ const name = userName || "the user";
161
+ return `"eventTitle": "CRITICAL: Must include BOTH ‘WHAT to do’ AND ‘WITH WHOM’ (use their specific name if known, e.g., 'Having coffee with ${name}'). If you don't explicitly include WITH WHOM the event is by name, it is a hard failure.",
162
+ "eventDescription": "e.g. 'Meeting at the cafe, chatting about life' (Detailed description of the event and virtual scene)",
163
+ "scheduledStartTimeStr": "HH:MM (Optional, 24-hour format if a specific time today is agreed upon, e.g., '14:30', otherwise null)",
164
+ "durationMins": 60,
165
+ "outfitId": "optional wardrobe ID to change into if appropriate"`;
158
166
  }
159
167
  getVoiceSchemaParams() {
160
168
  // Only reached when no dynamic_params are configured on the voice model.
@@ -229,22 +237,7 @@ You MUST output ONLY a valid JSON object matching this exact structure:
229
237
  {
230
238
  "acceptEvent": true,
231
239
  "reason": "string (Why you accepted or declined, speaking in character)",
232
- "eventTitle": "string (A short title detailing exactly WHAT to do and WITH WHOM, e.g. 'Coffee with 哥哥')",
233
- "eventDescription": "string (Detailed description of the future event, virtual scene, and story with the participant)",
234
- "requiresOutfitChange": false,
235
- "selectedOutfitId": null,
236
- "scheduledStartTimeStr": "HH:MM (Optional, 24-hour format if a specific time today is agreed upon, e.g., '14:30', otherwise null)"
237
- }
238
-
239
- Example Valid Answer:
240
- {
241
- "acceptEvent": true,
242
- "reason": "Sure, I'd love to go to the cafe at 2:30 PM. It sounds relaxing.",
243
- "eventTitle": "Have Coffee with the user at the Starry Cafe",
244
- "eventDescription": "Meeting at the Starry Cafe at 2:30 PM, chatting about life while sipping lattes facing the window.",
245
- "requiresOutfitChange": false,
246
- "selectedOutfitId": null,
247
- "scheduledStartTimeStr": "14:30"
240
+ ${this.getEventSchemaParams(state.dynamic_context?.userNickname)}
248
241
  }
249
242
 
250
243
  CRITICAL: Output MUST be ONLY valid JSON with no markdown block wrappers. Do NOT wrap the JSON in \`\`\`json or add conversational text.`;
@@ -272,11 +265,11 @@ CRITICAL: Output MUST be ONLY valid JSON with no markdown block wrappers. Do NOT
272
265
  // 4. API call if accepted
273
266
  if (decisionData.acceptEvent === true) {
274
267
  const payload = {
275
- eventTitle: decisionData.eventTitle || decisionData.title || "On-demand Event",
276
- eventDescription: decisionData.eventDescription || params.eventDescription,
277
- durationMins: params.durationMins || 60,
278
- outfitId: decisionData.requiresOutfitChange ? decisionData.selectedOutfitId : undefined,
279
- scheduledStartTimeStr: decisionData.scheduledStartTimeStr || decisionData.startTime || undefined,
268
+ eventTitle: decisionData.eventTitle,
269
+ eventDescription: decisionData.eventDescription,
270
+ durationMins: decisionData.durationMins || params.durationMins || 60,
271
+ outfitId: decisionData.outfitId || undefined,
272
+ scheduledStartTimeStr: decisionData.scheduledStartTimeStr || undefined,
280
273
  };
281
274
  const backendRes = await this.apiFetch("/api/v1/cyber-soul/characters/ondemand-event", {
282
275
  method: "POST",
@@ -290,9 +283,9 @@ CRITICAL: Output MUST be ONLY valid JSON with no markdown block wrappers. Do NOT
290
283
  status: "success",
291
284
  acceptEvent: decisionData.acceptEvent,
292
285
  reason: decisionData.reason,
293
- requiresOutfitChange: decisionData.requiresOutfitChange,
294
- selectedOutfitId: decisionData.selectedOutfitId,
295
- scheduledStartTimeStr: decisionData.scheduledStartTimeStr || undefined,
286
+ requiresOutfitChange: !!decisionData.outfitId,
287
+ selectedOutfitId: decisionData.outfitId || null,
288
+ scheduledStartTimeStr: decisionData.scheduledStartTimeStr || decisionData.startTime || undefined,
296
289
  };
297
290
  }
298
291
  catch (error) {
@@ -537,7 +530,9 @@ Output JSON Schema:
537
530
  "textResponse": "The direct spoken dialogue in Chinese",
538
531
  "stateUpdate": { "temperatureDelta": 1, "userNickname": "What you now call the user", "agentNickname": "What the user calls you", "talkingStyle": "Current mood/style of talking" },
539
532
  "userAnalysis": { "newFactsLearned": [{ "category": "occupation", "value": "Software Engineer" }] },
540
- "triggerEvent": { "eventTitle": "Have Coffee with the user at the Starry Cafe (Must include WHAT to do and WITH WHOM)", "eventDescription": "Meeting at the Starry Cafe at 2:30 PM, chatting about life while sipping lattes facing the window.", "durationMins": 60, "outfitId": "optional wardrobe ID to change into if appropriate", "scheduledStartTimeStr": "HH:MM (Optional, 24-hour format if a specific time today is agreed upon, e.g., '14:30', otherwise null)" },
533
+ "triggerEvent": {
534
+ ${this.getEventSchemaParams(state.dynamic_context?.userNickname)}
535
+ },
541
536
  ${this.getImageSchemaParams()},
542
537
  ${this.getVoiceSchemaFromState(state)}
543
538
  }
@@ -588,8 +583,8 @@ Note: If "imageParams", "voiceArgs", "triggerEvent", or "userAnalysis" are not n
588
583
  mediaTasks.push(this.apiFetch("/api/v1/cyber-soul/characters/ondemand-event", {
589
584
  method: "POST",
590
585
  body: JSON.stringify({
591
- eventTitle: parsedIntent.triggerEvent.eventTitle || "Event",
592
- eventDescription: parsedIntent.triggerEvent.eventDescription || parsedIntent.triggerEvent.description || "Event",
586
+ eventTitle: parsedIntent.triggerEvent.eventTitle,
587
+ eventDescription: parsedIntent.triggerEvent.eventDescription,
593
588
  durationMins: parsedIntent.triggerEvent.durationMins || 60,
594
589
  outfitId: parsedIntent.triggerEvent.outfitId || undefined,
595
590
  scheduledStartTimeStr: parsedIntent.triggerEvent.scheduledStartTimeStr || undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@space3-npm/cybersoul-client",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",