@astralform/js 9.4.0 → 9.4.1
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/index.cjs +17 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +17 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1134,7 +1134,11 @@ var AstralformClient = class {
|
|
|
1134
1134
|
// A mode this SDK does not know must not reach a `switch` typed as
|
|
1135
1135
|
// `VoicePolishMode`; `structured` is the server's own default.
|
|
1136
1136
|
defaultMode: isVoicePolishMode(raw.default_mode) ? raw.default_mode : "structured",
|
|
1137
|
-
|
|
1137
|
+
// Deliberately not read from the wire. The field was retired from the
|
|
1138
|
+
// platform (2026-10-09): no shipped client implements pause detection
|
|
1139
|
+
// and the server no longer sends it, so an older server's stored value
|
|
1140
|
+
// must not resurrect it.
|
|
1141
|
+
silenceAutoStopSeconds: 2,
|
|
1138
1142
|
// Deliberately not read from the wire. Auto-send was removed from the
|
|
1139
1143
|
// platform (2026-09-14) and the server pins `auto_send` to false; an
|
|
1140
1144
|
// older server still sending `true` must not make a client auto-send, so
|
|
@@ -1791,22 +1795,24 @@ function translateWireEvent(wire) {
|
|
|
1791
1795
|
status: wire.status,
|
|
1792
1796
|
final: wire.final
|
|
1793
1797
|
};
|
|
1794
|
-
case "message_stop":
|
|
1798
|
+
case "message_stop": {
|
|
1799
|
+
const usage = wire.usage ?? {};
|
|
1795
1800
|
return {
|
|
1796
1801
|
type: "message_stop",
|
|
1797
1802
|
turnId: wire.turn_id,
|
|
1798
1803
|
jobId: wire.job_id,
|
|
1799
1804
|
stopReason: wire.stop_reason,
|
|
1800
1805
|
usage: {
|
|
1801
|
-
inputTokens:
|
|
1802
|
-
outputTokens:
|
|
1803
|
-
cachedTokens:
|
|
1804
|
-
cacheCreationTokens:
|
|
1806
|
+
inputTokens: usage.input_tokens ?? 0,
|
|
1807
|
+
outputTokens: usage.output_tokens ?? 0,
|
|
1808
|
+
cachedTokens: usage.cached_tokens ?? 0,
|
|
1809
|
+
cacheCreationTokens: usage.cache_creation_tokens ?? 0
|
|
1805
1810
|
},
|
|
1806
1811
|
ttfbMs: wire.ttfb_ms,
|
|
1807
1812
|
totalMs: wire.total_ms,
|
|
1808
1813
|
stallCount: wire.stall_count
|
|
1809
1814
|
};
|
|
1815
|
+
}
|
|
1810
1816
|
case "stall":
|
|
1811
1817
|
return {
|
|
1812
1818
|
type: "stall",
|
|
@@ -2158,7 +2164,7 @@ var ChatSession = class {
|
|
|
2158
2164
|
if (!(err instanceof DOMException && err.name === "AbortError")) {
|
|
2159
2165
|
this.emit({
|
|
2160
2166
|
type: "error",
|
|
2161
|
-
code: "connection_error",
|
|
2167
|
+
code: err instanceof AstralformError ? err.code : "connection_error",
|
|
2162
2168
|
message: err instanceof Error ? err.message : String(err),
|
|
2163
2169
|
blockPath: null
|
|
2164
2170
|
});
|
|
@@ -2310,6 +2316,9 @@ var ChatSession = class {
|
|
|
2310
2316
|
if (typeof data?.seq === "number") {
|
|
2311
2317
|
this.lastSeq = data.seq;
|
|
2312
2318
|
}
|
|
2319
|
+
if (typeof data === "object" && data !== null && "data" in data && data.data === "[DONE]") {
|
|
2320
|
+
sawTerminal = true;
|
|
2321
|
+
}
|
|
2313
2322
|
continue;
|
|
2314
2323
|
}
|
|
2315
2324
|
parsed = data;
|
|
@@ -2439,7 +2448,7 @@ var ChatSession = class {
|
|
|
2439
2448
|
}
|
|
2440
2449
|
return;
|
|
2441
2450
|
case "block_delta":
|
|
2442
|
-
if (ownsTurnState && wire.delta
|
|
2451
|
+
if (ownsTurnState && wire.delta?.channel === "text" && this.currentTextPath !== null && pathEquals(this.currentTextPath, wire.path)) {
|
|
2443
2452
|
this.accumulatedText += wire.delta.text;
|
|
2444
2453
|
}
|
|
2445
2454
|
return;
|