@space3-npm/cybersoul-client 1.4.26 → 1.4.27
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 +6 -0
- package/dist/client.js +35 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -151,6 +151,12 @@ export declare class CyberSoulClient {
|
|
|
151
151
|
* snapshot (or `null` if there was nothing to send / the request failed).
|
|
152
152
|
*/
|
|
153
153
|
updateDynamicContext(stateUpdate: DispatcherIntent["stateUpdate"], userAnalysis?: DispatcherIntent["userAnalysis"]): Promise<PersistedDynamicContext | null>;
|
|
154
|
+
/**
|
|
155
|
+
* Restores the server-side relationship temperature to an exact absolute
|
|
156
|
+
* value. Used by chat recall, where inverse deltas are not accurate once the
|
|
157
|
+
* backend has applied dampening, caps, and stage re-evaluation.
|
|
158
|
+
*/
|
|
159
|
+
restoreDynamicContextTemperature(temperatureAbsolute: number): Promise<PersistedDynamicContext | null>;
|
|
154
160
|
/**
|
|
155
161
|
* Gift a new outfit to the character's wardrobe inventory.
|
|
156
162
|
* Returns the number of wardrobe items the backend created (the
|
package/dist/client.js
CHANGED
|
@@ -1519,6 +1519,41 @@ Output strictly valid JSON ONLY. No markdown, no conversational filler. Return e
|
|
|
1519
1519
|
async updateDynamicContext(stateUpdate, userAnalysis) {
|
|
1520
1520
|
return this._updateDynamicContextInternal(stateUpdate, userAnalysis);
|
|
1521
1521
|
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Restores the server-side relationship temperature to an exact absolute
|
|
1524
|
+
* value. Used by chat recall, where inverse deltas are not accurate once the
|
|
1525
|
+
* backend has applied dampening, caps, and stage re-evaluation.
|
|
1526
|
+
*/
|
|
1527
|
+
async restoreDynamicContextTemperature(temperatureAbsolute) {
|
|
1528
|
+
if (!Number.isFinite(temperatureAbsolute))
|
|
1529
|
+
return null;
|
|
1530
|
+
const normalizedAbsolute = Math.max(0, Math.min(100, Math.round(temperatureAbsolute * 10) / 10));
|
|
1531
|
+
try {
|
|
1532
|
+
const res = await this.apiFetch("/api/v1/cyber-soul/characters/dynamic-context", {
|
|
1533
|
+
method: "PATCH",
|
|
1534
|
+
body: JSON.stringify({ temperatureAbsolute: normalizedAbsolute }),
|
|
1535
|
+
});
|
|
1536
|
+
if (!res.ok)
|
|
1537
|
+
return null;
|
|
1538
|
+
const payload = (await res.json());
|
|
1539
|
+
if (payload?.status !== "success")
|
|
1540
|
+
return null;
|
|
1541
|
+
if (typeof payload.dynamicContext?.temperature !== "number")
|
|
1542
|
+
return null;
|
|
1543
|
+
if (!Number.isFinite(payload.dynamicContext.temperature))
|
|
1544
|
+
return null;
|
|
1545
|
+
return {
|
|
1546
|
+
temperature: payload.dynamicContext.temperature,
|
|
1547
|
+
relationshipStage: typeof payload.relationshipStage === "string"
|
|
1548
|
+
? payload.relationshipStage
|
|
1549
|
+
: undefined,
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
catch (e) {
|
|
1553
|
+
console.error("restoreDynamicContextTemperature failed", e);
|
|
1554
|
+
return null;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1522
1557
|
/**
|
|
1523
1558
|
* Gift a new outfit to the character's wardrobe inventory.
|
|
1524
1559
|
* Returns the number of wardrobe items the backend created (the
|