@astralform/js 4.6.1 → 4.8.0
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 +65 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -1
- package/dist/index.d.ts +56 -1
- package/dist/index.js +65 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,16 @@ interface TodoItem {
|
|
|
19
19
|
interface TodoUpdatePayload {
|
|
20
20
|
todos: TodoItem[];
|
|
21
21
|
}
|
|
22
|
+
/** The conversation's plan, as markdown, after the agent wrote or revised it.
|
|
23
|
+
* Full body rather than a diff — `write_plan` replaces the document wholesale. */
|
|
24
|
+
interface PlanUpdatePayload {
|
|
25
|
+
plan: string;
|
|
26
|
+
}
|
|
27
|
+
/** Names of the conversation's notes, after one was written or deleted.
|
|
28
|
+
* Names only; bodies are unbounded and read on demand. */
|
|
29
|
+
interface NoteUpdatePayload {
|
|
30
|
+
notes: string[];
|
|
31
|
+
}
|
|
22
32
|
interface TitleGeneratedPayload {
|
|
23
33
|
title: string;
|
|
24
34
|
}
|
|
@@ -188,6 +198,8 @@ declare const ChatEventType: {
|
|
|
188
198
|
readonly UserMessage: "user_message";
|
|
189
199
|
readonly TitleGenerated: "title_generated";
|
|
190
200
|
readonly TodoUpdate: "todo_update";
|
|
201
|
+
readonly PlanUpdate: "plan_update";
|
|
202
|
+
readonly NoteUpdate: "note_update";
|
|
191
203
|
readonly ContextUpdate: "context_update";
|
|
192
204
|
readonly SubagentStart: "subagent_start";
|
|
193
205
|
readonly SubagentStop: "subagent_stop";
|
|
@@ -432,6 +444,20 @@ type ChatEvent = {
|
|
|
432
444
|
} | {
|
|
433
445
|
type: "todo_update";
|
|
434
446
|
todos: TodoItem[];
|
|
447
|
+
}
|
|
448
|
+
/** The conversation's plan, as markdown, after the agent wrote or revised it.
|
|
449
|
+
* Carries the FULL body rather than a diff: the backend replaces the plan
|
|
450
|
+
* wholesale (`write_plan` — "Replaces any existing plan"), so a consumer that
|
|
451
|
+
* merged deltas would drift from the stored document. */
|
|
452
|
+
| {
|
|
453
|
+
type: "plan_update";
|
|
454
|
+
plan: string;
|
|
455
|
+
}
|
|
456
|
+
/** Names of the conversation's notes, after one was written or deleted. Names
|
|
457
|
+
* only — bodies are unbounded and read on demand. */
|
|
458
|
+
| {
|
|
459
|
+
type: "note_update";
|
|
460
|
+
notes: string[];
|
|
435
461
|
} | {
|
|
436
462
|
type: "context_update";
|
|
437
463
|
context: Record<string, unknown>;
|
|
@@ -889,6 +915,7 @@ declare class AstralformClient {
|
|
|
889
915
|
private send;
|
|
890
916
|
get<T>(path: string): Promise<T>;
|
|
891
917
|
post<T>(path: string, body: unknown): Promise<T>;
|
|
918
|
+
patch<T>(path: string, body: unknown): Promise<T>;
|
|
892
919
|
private del;
|
|
893
920
|
private handleError;
|
|
894
921
|
getHealth(): Promise<{
|
|
@@ -899,6 +926,16 @@ declare class AstralformClient {
|
|
|
899
926
|
getAgentStatus(): Promise<AgentStatus>;
|
|
900
927
|
getConversations(limit?: number, offset?: number): Promise<Conversation[]>;
|
|
901
928
|
getMessages(conversationId: string): Promise<Message[]>;
|
|
929
|
+
/**
|
|
930
|
+
* Replace the title the server generated from the conversation's first turn.
|
|
931
|
+
*
|
|
932
|
+
* The server does NOT bump `updated_at` for a rename — conversations list
|
|
933
|
+
* newest-updated first, and relabelling one is not activity — so the
|
|
934
|
+
* timestamp coming back is the original. Callers should merge the response
|
|
935
|
+
* rather than stamp their own, or they reintroduce the reordering the
|
|
936
|
+
* server deliberately avoids.
|
|
937
|
+
*/
|
|
938
|
+
renameConversation(id: string, title: string): Promise<Conversation>;
|
|
902
939
|
deleteConversation(id: string): Promise<void>;
|
|
903
940
|
/**
|
|
904
941
|
* List the AI personas (sub-agents) available INSIDE the client's active
|
|
@@ -1223,6 +1260,19 @@ declare class ChatSession {
|
|
|
1223
1260
|
* already scanned.
|
|
1224
1261
|
*/
|
|
1225
1262
|
loadMoreConversations(): Promise<Conversation[]>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Rename a conversation, server first.
|
|
1265
|
+
*
|
|
1266
|
+
* Deliberately NOT optimistic, unlike the delete below. A failed delete is
|
|
1267
|
+
* self-correcting (the row is still there on the next page fetch), but a
|
|
1268
|
+
* failed rename that had already been written locally would leave the
|
|
1269
|
+
* sidebar showing a title the server never accepted — and nothing refetches
|
|
1270
|
+
* a conversation that is already in the loaded list.
|
|
1271
|
+
*
|
|
1272
|
+
* Mirrors the `title_generated` path: the entry in `conversations` is
|
|
1273
|
+
* mutated in place, which is what every consumer of the list reads.
|
|
1274
|
+
*/
|
|
1275
|
+
renameConversation(id: string, title: string): Promise<void>;
|
|
1226
1276
|
deleteConversation(id: string): Promise<void>;
|
|
1227
1277
|
toggleClientTool(name: string): boolean;
|
|
1228
1278
|
}
|
|
@@ -1349,6 +1399,11 @@ declare class StreamManager {
|
|
|
1349
1399
|
skipHistoryReplay?: boolean;
|
|
1350
1400
|
}): Promise<void>;
|
|
1351
1401
|
createConversation(): Promise<string>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Rename a conversation. Purely a relabel — no active-conversation or
|
|
1404
|
+
* background-job bookkeeping to do, unlike delete, so this is a passthrough.
|
|
1405
|
+
*/
|
|
1406
|
+
renameConversation(id: string, title: string): Promise<void>;
|
|
1352
1407
|
deleteConversation(id: string): Promise<void>;
|
|
1353
1408
|
stop(): void;
|
|
1354
1409
|
destroy(): void;
|
|
@@ -1441,4 +1496,4 @@ declare function isEmbeddedResource(value: unknown): value is {
|
|
|
1441
1496
|
*/
|
|
1442
1497
|
declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
|
|
1443
1498
|
|
|
1444
|
-
export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
|
|
1499
|
+
export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type NoteUpdatePayload, type PlanUpdatePayload, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ interface TodoItem {
|
|
|
19
19
|
interface TodoUpdatePayload {
|
|
20
20
|
todos: TodoItem[];
|
|
21
21
|
}
|
|
22
|
+
/** The conversation's plan, as markdown, after the agent wrote or revised it.
|
|
23
|
+
* Full body rather than a diff — `write_plan` replaces the document wholesale. */
|
|
24
|
+
interface PlanUpdatePayload {
|
|
25
|
+
plan: string;
|
|
26
|
+
}
|
|
27
|
+
/** Names of the conversation's notes, after one was written or deleted.
|
|
28
|
+
* Names only; bodies are unbounded and read on demand. */
|
|
29
|
+
interface NoteUpdatePayload {
|
|
30
|
+
notes: string[];
|
|
31
|
+
}
|
|
22
32
|
interface TitleGeneratedPayload {
|
|
23
33
|
title: string;
|
|
24
34
|
}
|
|
@@ -188,6 +198,8 @@ declare const ChatEventType: {
|
|
|
188
198
|
readonly UserMessage: "user_message";
|
|
189
199
|
readonly TitleGenerated: "title_generated";
|
|
190
200
|
readonly TodoUpdate: "todo_update";
|
|
201
|
+
readonly PlanUpdate: "plan_update";
|
|
202
|
+
readonly NoteUpdate: "note_update";
|
|
191
203
|
readonly ContextUpdate: "context_update";
|
|
192
204
|
readonly SubagentStart: "subagent_start";
|
|
193
205
|
readonly SubagentStop: "subagent_stop";
|
|
@@ -432,6 +444,20 @@ type ChatEvent = {
|
|
|
432
444
|
} | {
|
|
433
445
|
type: "todo_update";
|
|
434
446
|
todos: TodoItem[];
|
|
447
|
+
}
|
|
448
|
+
/** The conversation's plan, as markdown, after the agent wrote or revised it.
|
|
449
|
+
* Carries the FULL body rather than a diff: the backend replaces the plan
|
|
450
|
+
* wholesale (`write_plan` — "Replaces any existing plan"), so a consumer that
|
|
451
|
+
* merged deltas would drift from the stored document. */
|
|
452
|
+
| {
|
|
453
|
+
type: "plan_update";
|
|
454
|
+
plan: string;
|
|
455
|
+
}
|
|
456
|
+
/** Names of the conversation's notes, after one was written or deleted. Names
|
|
457
|
+
* only — bodies are unbounded and read on demand. */
|
|
458
|
+
| {
|
|
459
|
+
type: "note_update";
|
|
460
|
+
notes: string[];
|
|
435
461
|
} | {
|
|
436
462
|
type: "context_update";
|
|
437
463
|
context: Record<string, unknown>;
|
|
@@ -889,6 +915,7 @@ declare class AstralformClient {
|
|
|
889
915
|
private send;
|
|
890
916
|
get<T>(path: string): Promise<T>;
|
|
891
917
|
post<T>(path: string, body: unknown): Promise<T>;
|
|
918
|
+
patch<T>(path: string, body: unknown): Promise<T>;
|
|
892
919
|
private del;
|
|
893
920
|
private handleError;
|
|
894
921
|
getHealth(): Promise<{
|
|
@@ -899,6 +926,16 @@ declare class AstralformClient {
|
|
|
899
926
|
getAgentStatus(): Promise<AgentStatus>;
|
|
900
927
|
getConversations(limit?: number, offset?: number): Promise<Conversation[]>;
|
|
901
928
|
getMessages(conversationId: string): Promise<Message[]>;
|
|
929
|
+
/**
|
|
930
|
+
* Replace the title the server generated from the conversation's first turn.
|
|
931
|
+
*
|
|
932
|
+
* The server does NOT bump `updated_at` for a rename — conversations list
|
|
933
|
+
* newest-updated first, and relabelling one is not activity — so the
|
|
934
|
+
* timestamp coming back is the original. Callers should merge the response
|
|
935
|
+
* rather than stamp their own, or they reintroduce the reordering the
|
|
936
|
+
* server deliberately avoids.
|
|
937
|
+
*/
|
|
938
|
+
renameConversation(id: string, title: string): Promise<Conversation>;
|
|
902
939
|
deleteConversation(id: string): Promise<void>;
|
|
903
940
|
/**
|
|
904
941
|
* List the AI personas (sub-agents) available INSIDE the client's active
|
|
@@ -1223,6 +1260,19 @@ declare class ChatSession {
|
|
|
1223
1260
|
* already scanned.
|
|
1224
1261
|
*/
|
|
1225
1262
|
loadMoreConversations(): Promise<Conversation[]>;
|
|
1263
|
+
/**
|
|
1264
|
+
* Rename a conversation, server first.
|
|
1265
|
+
*
|
|
1266
|
+
* Deliberately NOT optimistic, unlike the delete below. A failed delete is
|
|
1267
|
+
* self-correcting (the row is still there on the next page fetch), but a
|
|
1268
|
+
* failed rename that had already been written locally would leave the
|
|
1269
|
+
* sidebar showing a title the server never accepted — and nothing refetches
|
|
1270
|
+
* a conversation that is already in the loaded list.
|
|
1271
|
+
*
|
|
1272
|
+
* Mirrors the `title_generated` path: the entry in `conversations` is
|
|
1273
|
+
* mutated in place, which is what every consumer of the list reads.
|
|
1274
|
+
*/
|
|
1275
|
+
renameConversation(id: string, title: string): Promise<void>;
|
|
1226
1276
|
deleteConversation(id: string): Promise<void>;
|
|
1227
1277
|
toggleClientTool(name: string): boolean;
|
|
1228
1278
|
}
|
|
@@ -1349,6 +1399,11 @@ declare class StreamManager {
|
|
|
1349
1399
|
skipHistoryReplay?: boolean;
|
|
1350
1400
|
}): Promise<void>;
|
|
1351
1401
|
createConversation(): Promise<string>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Rename a conversation. Purely a relabel — no active-conversation or
|
|
1404
|
+
* background-job bookkeeping to do, unlike delete, so this is a passthrough.
|
|
1405
|
+
*/
|
|
1406
|
+
renameConversation(id: string, title: string): Promise<void>;
|
|
1352
1407
|
deleteConversation(id: string): Promise<void>;
|
|
1353
1408
|
stop(): void;
|
|
1354
1409
|
destroy(): void;
|
|
@@ -1441,4 +1496,4 @@ declare function isEmbeddedResource(value: unknown): value is {
|
|
|
1441
1496
|
*/
|
|
1442
1497
|
declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
|
|
1443
1498
|
|
|
1444
|
-
export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
|
|
1499
|
+
export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type NoteUpdatePayload, type PlanUpdatePayload, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
|
package/dist/index.js
CHANGED
|
@@ -460,6 +460,12 @@ var AstralformClient = class {
|
|
|
460
460
|
return await response.json();
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
+
async patch(path, body) {
|
|
464
|
+
return this.withDeadline(async (signal) => {
|
|
465
|
+
const response = await this.send("PATCH", path, body, signal);
|
|
466
|
+
return await response.json();
|
|
467
|
+
});
|
|
468
|
+
}
|
|
463
469
|
async del(path) {
|
|
464
470
|
await this.request("DELETE", path);
|
|
465
471
|
}
|
|
@@ -530,6 +536,25 @@ var AstralformClient = class {
|
|
|
530
536
|
createdAt: m.created_at
|
|
531
537
|
}));
|
|
532
538
|
}
|
|
539
|
+
/**
|
|
540
|
+
* Replace the title the server generated from the conversation's first turn.
|
|
541
|
+
*
|
|
542
|
+
* The server does NOT bump `updated_at` for a rename — conversations list
|
|
543
|
+
* newest-updated first, and relabelling one is not activity — so the
|
|
544
|
+
* timestamp coming back is the original. Callers should merge the response
|
|
545
|
+
* rather than stamp their own, or they reintroduce the reordering the
|
|
546
|
+
* server deliberately avoids.
|
|
547
|
+
*/
|
|
548
|
+
async renameConversation(id, title) {
|
|
549
|
+
const c = await this.patch(`/v1/conversations/${encodeURIComponent(id)}`, { title });
|
|
550
|
+
return {
|
|
551
|
+
id: c.id,
|
|
552
|
+
title: c.title,
|
|
553
|
+
messageCount: c.message_count,
|
|
554
|
+
createdAt: c.created_at,
|
|
555
|
+
updatedAt: c.updated_at
|
|
556
|
+
};
|
|
557
|
+
}
|
|
533
558
|
async deleteConversation(id) {
|
|
534
559
|
await this.del(`/v1/conversations/${encodeURIComponent(id)}`);
|
|
535
560
|
}
|
|
@@ -1012,6 +1037,16 @@ function translateCustomEvent(name, data) {
|
|
|
1012
1037
|
type: "todo_update",
|
|
1013
1038
|
todos: data.todos ?? []
|
|
1014
1039
|
};
|
|
1040
|
+
case "plan_update":
|
|
1041
|
+
return {
|
|
1042
|
+
type: "plan_update",
|
|
1043
|
+
plan: data.plan ?? ""
|
|
1044
|
+
};
|
|
1045
|
+
case "note_update":
|
|
1046
|
+
return {
|
|
1047
|
+
type: "note_update",
|
|
1048
|
+
notes: data.notes ?? []
|
|
1049
|
+
};
|
|
1015
1050
|
case "context_update":
|
|
1016
1051
|
return {
|
|
1017
1052
|
type: "context_update",
|
|
@@ -1879,6 +1914,26 @@ var ChatSession = class {
|
|
|
1879
1914
|
this.isLoadingConversations = false;
|
|
1880
1915
|
}
|
|
1881
1916
|
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Rename a conversation, server first.
|
|
1919
|
+
*
|
|
1920
|
+
* Deliberately NOT optimistic, unlike the delete below. A failed delete is
|
|
1921
|
+
* self-correcting (the row is still there on the next page fetch), but a
|
|
1922
|
+
* failed rename that had already been written locally would leave the
|
|
1923
|
+
* sidebar showing a title the server never accepted — and nothing refetches
|
|
1924
|
+
* a conversation that is already in the loaded list.
|
|
1925
|
+
*
|
|
1926
|
+
* Mirrors the `title_generated` path: the entry in `conversations` is
|
|
1927
|
+
* mutated in place, which is what every consumer of the list reads.
|
|
1928
|
+
*/
|
|
1929
|
+
async renameConversation(id, title) {
|
|
1930
|
+
const updated = await this.client.renameConversation(id, title);
|
|
1931
|
+
const conv = this.conversations.find((c) => c.id === id);
|
|
1932
|
+
if (conv) {
|
|
1933
|
+
conv.title = updated.title;
|
|
1934
|
+
}
|
|
1935
|
+
await this.storage.updateConversationTitle(id, updated.title);
|
|
1936
|
+
}
|
|
1882
1937
|
async deleteConversation(id) {
|
|
1883
1938
|
try {
|
|
1884
1939
|
await this.client.deleteConversation(id);
|
|
@@ -1983,6 +2038,8 @@ var ChatEventType = {
|
|
|
1983
2038
|
UserMessage: "user_message",
|
|
1984
2039
|
TitleGenerated: "title_generated",
|
|
1985
2040
|
TodoUpdate: "todo_update",
|
|
2041
|
+
PlanUpdate: "plan_update",
|
|
2042
|
+
NoteUpdate: "note_update",
|
|
1986
2043
|
ContextUpdate: "context_update",
|
|
1987
2044
|
SubagentStart: "subagent_start",
|
|
1988
2045
|
SubagentStop: "subagent_stop",
|
|
@@ -2169,12 +2226,19 @@ var StreamManager = class {
|
|
|
2169
2226
|
}
|
|
2170
2227
|
await this.restore(conversationId);
|
|
2171
2228
|
}
|
|
2172
|
-
// ── Create / delete conversation
|
|
2229
|
+
// ── Create / rename / delete conversation ─────────────────────
|
|
2173
2230
|
async createConversation() {
|
|
2174
2231
|
const id = await this.session.createNewConversation();
|
|
2175
2232
|
this.setActiveConversation(id);
|
|
2176
2233
|
return id;
|
|
2177
2234
|
}
|
|
2235
|
+
/**
|
|
2236
|
+
* Rename a conversation. Purely a relabel — no active-conversation or
|
|
2237
|
+
* background-job bookkeeping to do, unlike delete, so this is a passthrough.
|
|
2238
|
+
*/
|
|
2239
|
+
async renameConversation(id, title) {
|
|
2240
|
+
await this.session.renameConversation(id, title);
|
|
2241
|
+
}
|
|
2178
2242
|
async deleteConversation(id) {
|
|
2179
2243
|
await this.session.deleteConversation(id);
|
|
2180
2244
|
this._backgroundJobs.delete(id);
|