@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.d.cts
CHANGED
|
@@ -258,7 +258,7 @@ declare const ChatEventType: {
|
|
|
258
258
|
type ChatEventTypeValue = (typeof ChatEventType)[keyof typeof ChatEventType];
|
|
259
259
|
type WireBlockKind = "text" | "thinking" | "tool_use";
|
|
260
260
|
type WireBlockStatus = "streaming" | "awaiting_client_result" | "ok" | "error" | "denied" | "cancelled";
|
|
261
|
-
type WireStopReason = "end_turn" | "tool_use" | "max_tokens" | "context_overflow" | "error";
|
|
261
|
+
type WireStopReason = "end_turn" | "tool_use" | "max_tokens" | "context_overflow" | "incomplete" | "error";
|
|
262
262
|
interface WireTextDelta {
|
|
263
263
|
channel: "text";
|
|
264
264
|
text: string;
|
|
@@ -1120,7 +1120,11 @@ interface VoiceConfig {
|
|
|
1120
1120
|
* (or compare against `"raw"`) before polishing.
|
|
1121
1121
|
*/
|
|
1122
1122
|
defaultMode: VoicePolishMode;
|
|
1123
|
-
/**
|
|
1123
|
+
/**
|
|
1124
|
+
* @deprecated Always `2`. The server no longer sends the field and no
|
|
1125
|
+
* shipped client implements pause detection; kept so existing code compiles,
|
|
1126
|
+
* slated for removal in the next major.
|
|
1127
|
+
*/
|
|
1124
1128
|
silenceAutoStopSeconds: number;
|
|
1125
1129
|
/**
|
|
1126
1130
|
* @deprecated Always `false`. Auto-send was removed from the platform
|
package/dist/index.d.ts
CHANGED
|
@@ -258,7 +258,7 @@ declare const ChatEventType: {
|
|
|
258
258
|
type ChatEventTypeValue = (typeof ChatEventType)[keyof typeof ChatEventType];
|
|
259
259
|
type WireBlockKind = "text" | "thinking" | "tool_use";
|
|
260
260
|
type WireBlockStatus = "streaming" | "awaiting_client_result" | "ok" | "error" | "denied" | "cancelled";
|
|
261
|
-
type WireStopReason = "end_turn" | "tool_use" | "max_tokens" | "context_overflow" | "error";
|
|
261
|
+
type WireStopReason = "end_turn" | "tool_use" | "max_tokens" | "context_overflow" | "incomplete" | "error";
|
|
262
262
|
interface WireTextDelta {
|
|
263
263
|
channel: "text";
|
|
264
264
|
text: string;
|
|
@@ -1120,7 +1120,11 @@ interface VoiceConfig {
|
|
|
1120
1120
|
* (or compare against `"raw"`) before polishing.
|
|
1121
1121
|
*/
|
|
1122
1122
|
defaultMode: VoicePolishMode;
|
|
1123
|
-
/**
|
|
1123
|
+
/**
|
|
1124
|
+
* @deprecated Always `2`. The server no longer sends the field and no
|
|
1125
|
+
* shipped client implements pause detection; kept so existing code compiles,
|
|
1126
|
+
* slated for removal in the next major.
|
|
1127
|
+
*/
|
|
1124
1128
|
silenceAutoStopSeconds: number;
|
|
1125
1129
|
/**
|
|
1126
1130
|
* @deprecated Always `false`. Auto-send was removed from the platform
|
package/dist/index.js
CHANGED
|
@@ -1081,7 +1081,11 @@ var AstralformClient = class {
|
|
|
1081
1081
|
// A mode this SDK does not know must not reach a `switch` typed as
|
|
1082
1082
|
// `VoicePolishMode`; `structured` is the server's own default.
|
|
1083
1083
|
defaultMode: isVoicePolishMode(raw.default_mode) ? raw.default_mode : "structured",
|
|
1084
|
-
|
|
1084
|
+
// Deliberately not read from the wire. The field was retired from the
|
|
1085
|
+
// platform (2026-10-09): no shipped client implements pause detection
|
|
1086
|
+
// and the server no longer sends it, so an older server's stored value
|
|
1087
|
+
// must not resurrect it.
|
|
1088
|
+
silenceAutoStopSeconds: 2,
|
|
1085
1089
|
// Deliberately not read from the wire. Auto-send was removed from the
|
|
1086
1090
|
// platform (2026-09-14) and the server pins `auto_send` to false; an
|
|
1087
1091
|
// older server still sending `true` must not make a client auto-send, so
|
|
@@ -1738,22 +1742,24 @@ function translateWireEvent(wire) {
|
|
|
1738
1742
|
status: wire.status,
|
|
1739
1743
|
final: wire.final
|
|
1740
1744
|
};
|
|
1741
|
-
case "message_stop":
|
|
1745
|
+
case "message_stop": {
|
|
1746
|
+
const usage = wire.usage ?? {};
|
|
1742
1747
|
return {
|
|
1743
1748
|
type: "message_stop",
|
|
1744
1749
|
turnId: wire.turn_id,
|
|
1745
1750
|
jobId: wire.job_id,
|
|
1746
1751
|
stopReason: wire.stop_reason,
|
|
1747
1752
|
usage: {
|
|
1748
|
-
inputTokens:
|
|
1749
|
-
outputTokens:
|
|
1750
|
-
cachedTokens:
|
|
1751
|
-
cacheCreationTokens:
|
|
1753
|
+
inputTokens: usage.input_tokens ?? 0,
|
|
1754
|
+
outputTokens: usage.output_tokens ?? 0,
|
|
1755
|
+
cachedTokens: usage.cached_tokens ?? 0,
|
|
1756
|
+
cacheCreationTokens: usage.cache_creation_tokens ?? 0
|
|
1752
1757
|
},
|
|
1753
1758
|
ttfbMs: wire.ttfb_ms,
|
|
1754
1759
|
totalMs: wire.total_ms,
|
|
1755
1760
|
stallCount: wire.stall_count
|
|
1756
1761
|
};
|
|
1762
|
+
}
|
|
1757
1763
|
case "stall":
|
|
1758
1764
|
return {
|
|
1759
1765
|
type: "stall",
|
|
@@ -2105,7 +2111,7 @@ var ChatSession = class {
|
|
|
2105
2111
|
if (!(err instanceof DOMException && err.name === "AbortError")) {
|
|
2106
2112
|
this.emit({
|
|
2107
2113
|
type: "error",
|
|
2108
|
-
code: "connection_error",
|
|
2114
|
+
code: err instanceof AstralformError ? err.code : "connection_error",
|
|
2109
2115
|
message: err instanceof Error ? err.message : String(err),
|
|
2110
2116
|
blockPath: null
|
|
2111
2117
|
});
|
|
@@ -2257,6 +2263,9 @@ var ChatSession = class {
|
|
|
2257
2263
|
if (typeof data?.seq === "number") {
|
|
2258
2264
|
this.lastSeq = data.seq;
|
|
2259
2265
|
}
|
|
2266
|
+
if (typeof data === "object" && data !== null && "data" in data && data.data === "[DONE]") {
|
|
2267
|
+
sawTerminal = true;
|
|
2268
|
+
}
|
|
2260
2269
|
continue;
|
|
2261
2270
|
}
|
|
2262
2271
|
parsed = data;
|
|
@@ -2386,7 +2395,7 @@ var ChatSession = class {
|
|
|
2386
2395
|
}
|
|
2387
2396
|
return;
|
|
2388
2397
|
case "block_delta":
|
|
2389
|
-
if (ownsTurnState && wire.delta
|
|
2398
|
+
if (ownsTurnState && wire.delta?.channel === "text" && this.currentTextPath !== null && pathEquals(this.currentTextPath, wire.path)) {
|
|
2390
2399
|
this.accumulatedText += wire.delta.text;
|
|
2391
2400
|
}
|
|
2392
2401
|
return;
|