@astralform/js 7.3.0 → 7.4.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 +76 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +111 -2
- package/dist/index.d.ts +111 -2
- package/dist/index.js +76 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -563,6 +563,12 @@ interface Conversation {
|
|
|
563
563
|
messageCount: number;
|
|
564
564
|
createdAt: string;
|
|
565
565
|
updatedAt: string;
|
|
566
|
+
/**
|
|
567
|
+
* The project this task belongs to (`owner/repo`), or `null` for an ordinary
|
|
568
|
+
* conversation. Set on the first turn and immutable after. Absent (rather than
|
|
569
|
+
* null) from an Astralform older than 0.70.0.
|
|
570
|
+
*/
|
|
571
|
+
repository?: string | null;
|
|
566
572
|
}
|
|
567
573
|
interface Message {
|
|
568
574
|
id: string;
|
|
@@ -612,6 +618,18 @@ interface AgentInfo {
|
|
|
612
618
|
isOrchestrator: boolean;
|
|
613
619
|
isEnabled: boolean;
|
|
614
620
|
avatarUrl?: string;
|
|
621
|
+
/**
|
|
622
|
+
* What the agent is for. A client shows Projects and Tasks only for `"code"`.
|
|
623
|
+
* Absent on Astralform older than 0.70.0 — treat that as `"chat"`, which is
|
|
624
|
+
* also the server's default.
|
|
625
|
+
*
|
|
626
|
+
* It is a property of the WORKSPACE, not of a persona: `GET /v1/agents` selects
|
|
627
|
+
* the workspace row itself and returns exactly one entry, so the mode is
|
|
628
|
+
* `agents[0].mode` rather than something that varies across the list. The
|
|
629
|
+
* workspace picker (`listAgents`) does not carry it, so a client learns an
|
|
630
|
+
* agent's mode after opening it.
|
|
631
|
+
*/
|
|
632
|
+
mode?: "chat" | "code";
|
|
615
633
|
}
|
|
616
634
|
interface TeamSummary {
|
|
617
635
|
id: string;
|
|
@@ -738,6 +756,15 @@ interface ModelChoiceOptions {
|
|
|
738
756
|
interface ChatStreamRequest {
|
|
739
757
|
message?: string;
|
|
740
758
|
conversation_id?: string;
|
|
759
|
+
/**
|
|
760
|
+
* Which project (GitHub repository, `owner/repo`) this task belongs to.
|
|
761
|
+
*
|
|
762
|
+
* Required on the FIRST turn of a conversation on a code-mode agent and
|
|
763
|
+
* ignored afterwards — a task is bound to one repository for life, so a
|
|
764
|
+
* different repository means a new task. Chat-mode agents ignore it entirely.
|
|
765
|
+
* Astralform >= 0.70.0.
|
|
766
|
+
*/
|
|
767
|
+
repository?: string;
|
|
741
768
|
mcp_manifest?: ToolDefinition[];
|
|
742
769
|
enabled_mcp?: string[];
|
|
743
770
|
continue_from_message?: string;
|
|
@@ -762,6 +789,37 @@ interface ChatStreamRequest {
|
|
|
762
789
|
reasoning_effort?: ReasoningEffort;
|
|
763
790
|
temperature?: number;
|
|
764
791
|
}
|
|
792
|
+
/** One repository an app user works with on a code-mode agent. */
|
|
793
|
+
interface CodeProject {
|
|
794
|
+
repoFullName: string;
|
|
795
|
+
addedAt: string;
|
|
796
|
+
}
|
|
797
|
+
/** A repository the workspace's GitHub installations cover. */
|
|
798
|
+
interface AvailableRepository {
|
|
799
|
+
fullName: string;
|
|
800
|
+
private: boolean;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* What an app user may add, and why the list might be empty.
|
|
804
|
+
*
|
|
805
|
+
* `state` separates the three empty cases a picker must not conflate:
|
|
806
|
+
* `ok` (connected, covers nothing new), `not_installed` (no installation to ask)
|
|
807
|
+
* and `unavailable` (GitHub could not be reached — try again, do not tell the
|
|
808
|
+
* user they have no repositories). `totalCount` is the installations' raw total
|
|
809
|
+
* BEFORE already-added projects are subtracted, so it is not the list's length.
|
|
810
|
+
*/
|
|
811
|
+
interface AvailableRepositories {
|
|
812
|
+
state: "ok" | "unavailable" | "not_installed";
|
|
813
|
+
repositories: AvailableRepository[];
|
|
814
|
+
totalCount: number;
|
|
815
|
+
/**
|
|
816
|
+
* At least one of the workspace's GitHub installations could not be
|
|
817
|
+
* enumerated, so the list is missing whatever that one covers. It is NOT
|
|
818
|
+
* pagination — there is no next page to ask for. A picker should say some
|
|
819
|
+
* repositories may be missing rather than present the list as complete.
|
|
820
|
+
*/
|
|
821
|
+
partial: boolean;
|
|
822
|
+
}
|
|
765
823
|
interface ToolResultRequest {
|
|
766
824
|
conversation_id: string;
|
|
767
825
|
message_id: string;
|
|
@@ -1003,6 +1061,15 @@ interface SendOptions$1 extends ModelChoiceOptions {
|
|
|
1003
1061
|
* it's complete. Omit for a normal turn.
|
|
1004
1062
|
*/
|
|
1005
1063
|
goal?: string;
|
|
1064
|
+
/**
|
|
1065
|
+
* The project this task belongs to (`owner/repo`), on a code-mode agent.
|
|
1066
|
+
*
|
|
1067
|
+
* Send it on the turn that STARTS a task; the binding is write-once, so later
|
|
1068
|
+
* turns can omit it (sending a different one is refused). A first turn without
|
|
1069
|
+
* it on a code-mode agent is refused too — the run needs a repository before it
|
|
1070
|
+
* can hold a credential scoped to one. Astralform >= 0.70.0.
|
|
1071
|
+
*/
|
|
1072
|
+
repository?: string;
|
|
1006
1073
|
}
|
|
1007
1074
|
/**
|
|
1008
1075
|
* A selectable model for one of the team's connected providers, from
|
|
@@ -1150,7 +1217,16 @@ declare class AstralformClient {
|
|
|
1150
1217
|
ollama_connected: boolean;
|
|
1151
1218
|
}>;
|
|
1152
1219
|
getAgentStatus(): Promise<AgentStatus>;
|
|
1153
|
-
|
|
1220
|
+
/**
|
|
1221
|
+
* A page of conversations, newest-updated first.
|
|
1222
|
+
*
|
|
1223
|
+
* `options.repository` narrows to one project's tasks (`owner/repo`) on a
|
|
1224
|
+
* code-mode agent — the same paging applies within the filter, so a client
|
|
1225
|
+
* showing tasks per project pages each project separately.
|
|
1226
|
+
*/
|
|
1227
|
+
getConversations(limit?: number, offset?: number, options?: {
|
|
1228
|
+
repository?: string;
|
|
1229
|
+
}): Promise<Conversation[]>;
|
|
1154
1230
|
getMessages(conversationId: string): Promise<Message[]>;
|
|
1155
1231
|
/**
|
|
1156
1232
|
* Replace the title the server generated from the conversation's first turn.
|
|
@@ -1235,6 +1311,39 @@ declare class AstralformClient {
|
|
|
1235
1311
|
* `getAgents()`, which lists the AI personas inside the active agent.
|
|
1236
1312
|
*/
|
|
1237
1313
|
listAgents(teamId: string): Promise<TeamAgentSummary[]>;
|
|
1314
|
+
/**
|
|
1315
|
+
* The projects (GitHub repositories) this app user works with, and what they
|
|
1316
|
+
* may add.
|
|
1317
|
+
*
|
|
1318
|
+
* A project list is per app user within a code-mode agent: the developer
|
|
1319
|
+
* connects the workspace's GitHub account, and each user curates their own
|
|
1320
|
+
* list from what that connection covers. Every method 404s on a chat-mode
|
|
1321
|
+
* agent, so the surface is invisible rather than empty there.
|
|
1322
|
+
*/
|
|
1323
|
+
readonly code: {
|
|
1324
|
+
projects: {
|
|
1325
|
+
/** This user's projects on the active agent, oldest first. */
|
|
1326
|
+
list: () => Promise<CodeProject[]>;
|
|
1327
|
+
/**
|
|
1328
|
+
* What the workspace's GitHub installations cover, minus what this user
|
|
1329
|
+
* has already added. Read `state` before the list: an empty `repositories`
|
|
1330
|
+
* means something different in each of its three values.
|
|
1331
|
+
*/
|
|
1332
|
+
available: () => Promise<AvailableRepositories>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Add a repository. The server checks it against the workspace's own
|
|
1335
|
+
* installations and answers a repository it cannot reach the same way it
|
|
1336
|
+
* answers one owned by someone else — deliberately, so this call cannot be
|
|
1337
|
+
* used to discover which organisations use Astralform.
|
|
1338
|
+
*/
|
|
1339
|
+
add: (repoFullName: string) => Promise<CodeProject>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Remove a project. Tasks already bound to that repository keep their
|
|
1342
|
+
* binding — they simply stop grouping under it.
|
|
1343
|
+
*/
|
|
1344
|
+
remove: (owner: string, repo: string) => Promise<void>;
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1238
1347
|
createJob(request: ChatStreamRequest): Promise<JobCreateResponse>;
|
|
1239
1348
|
streamJobEvents(jobId: string, afterSeq?: number, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
|
|
1240
1349
|
cancelJob(jobId: string): Promise<void>;
|
|
@@ -2003,4 +2112,4 @@ declare function isEmbeddedResource(value: unknown): value is {
|
|
|
2003
2112
|
*/
|
|
2004
2113
|
declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
|
|
2005
2114
|
|
|
2006
|
-
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 EffortRung, 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 ThinkingDescriptor, type ThinkingRungOption, 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, VOICE_POLISH_MODES, type VoiceConfig, type VoiceLLMMode, type VoicePolishEvent, type VoicePolishMode, type VoicePolishRequest, type VoiceTranscribeOptions, type VoiceTranscript, 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, isVoiceLLMMode, isVoicePolishMode, mapSseToChat, parseEmbeddedResource, parseVoicePolishFrame, replayEvents, streamJobSSE, translateDelta };
|
|
2115
|
+
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 AvailableRepositories, type AvailableRepository, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, type CodeProject, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EffortRung, 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 ThinkingDescriptor, type ThinkingRungOption, 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, VOICE_POLISH_MODES, type VoiceConfig, type VoiceLLMMode, type VoicePolishEvent, type VoicePolishMode, type VoicePolishRequest, type VoiceTranscribeOptions, type VoiceTranscript, 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, isVoiceLLMMode, isVoicePolishMode, mapSseToChat, parseEmbeddedResource, parseVoicePolishFrame, replayEvents, streamJobSSE, translateDelta };
|
package/dist/index.d.ts
CHANGED
|
@@ -563,6 +563,12 @@ interface Conversation {
|
|
|
563
563
|
messageCount: number;
|
|
564
564
|
createdAt: string;
|
|
565
565
|
updatedAt: string;
|
|
566
|
+
/**
|
|
567
|
+
* The project this task belongs to (`owner/repo`), or `null` for an ordinary
|
|
568
|
+
* conversation. Set on the first turn and immutable after. Absent (rather than
|
|
569
|
+
* null) from an Astralform older than 0.70.0.
|
|
570
|
+
*/
|
|
571
|
+
repository?: string | null;
|
|
566
572
|
}
|
|
567
573
|
interface Message {
|
|
568
574
|
id: string;
|
|
@@ -612,6 +618,18 @@ interface AgentInfo {
|
|
|
612
618
|
isOrchestrator: boolean;
|
|
613
619
|
isEnabled: boolean;
|
|
614
620
|
avatarUrl?: string;
|
|
621
|
+
/**
|
|
622
|
+
* What the agent is for. A client shows Projects and Tasks only for `"code"`.
|
|
623
|
+
* Absent on Astralform older than 0.70.0 — treat that as `"chat"`, which is
|
|
624
|
+
* also the server's default.
|
|
625
|
+
*
|
|
626
|
+
* It is a property of the WORKSPACE, not of a persona: `GET /v1/agents` selects
|
|
627
|
+
* the workspace row itself and returns exactly one entry, so the mode is
|
|
628
|
+
* `agents[0].mode` rather than something that varies across the list. The
|
|
629
|
+
* workspace picker (`listAgents`) does not carry it, so a client learns an
|
|
630
|
+
* agent's mode after opening it.
|
|
631
|
+
*/
|
|
632
|
+
mode?: "chat" | "code";
|
|
615
633
|
}
|
|
616
634
|
interface TeamSummary {
|
|
617
635
|
id: string;
|
|
@@ -738,6 +756,15 @@ interface ModelChoiceOptions {
|
|
|
738
756
|
interface ChatStreamRequest {
|
|
739
757
|
message?: string;
|
|
740
758
|
conversation_id?: string;
|
|
759
|
+
/**
|
|
760
|
+
* Which project (GitHub repository, `owner/repo`) this task belongs to.
|
|
761
|
+
*
|
|
762
|
+
* Required on the FIRST turn of a conversation on a code-mode agent and
|
|
763
|
+
* ignored afterwards — a task is bound to one repository for life, so a
|
|
764
|
+
* different repository means a new task. Chat-mode agents ignore it entirely.
|
|
765
|
+
* Astralform >= 0.70.0.
|
|
766
|
+
*/
|
|
767
|
+
repository?: string;
|
|
741
768
|
mcp_manifest?: ToolDefinition[];
|
|
742
769
|
enabled_mcp?: string[];
|
|
743
770
|
continue_from_message?: string;
|
|
@@ -762,6 +789,37 @@ interface ChatStreamRequest {
|
|
|
762
789
|
reasoning_effort?: ReasoningEffort;
|
|
763
790
|
temperature?: number;
|
|
764
791
|
}
|
|
792
|
+
/** One repository an app user works with on a code-mode agent. */
|
|
793
|
+
interface CodeProject {
|
|
794
|
+
repoFullName: string;
|
|
795
|
+
addedAt: string;
|
|
796
|
+
}
|
|
797
|
+
/** A repository the workspace's GitHub installations cover. */
|
|
798
|
+
interface AvailableRepository {
|
|
799
|
+
fullName: string;
|
|
800
|
+
private: boolean;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* What an app user may add, and why the list might be empty.
|
|
804
|
+
*
|
|
805
|
+
* `state` separates the three empty cases a picker must not conflate:
|
|
806
|
+
* `ok` (connected, covers nothing new), `not_installed` (no installation to ask)
|
|
807
|
+
* and `unavailable` (GitHub could not be reached — try again, do not tell the
|
|
808
|
+
* user they have no repositories). `totalCount` is the installations' raw total
|
|
809
|
+
* BEFORE already-added projects are subtracted, so it is not the list's length.
|
|
810
|
+
*/
|
|
811
|
+
interface AvailableRepositories {
|
|
812
|
+
state: "ok" | "unavailable" | "not_installed";
|
|
813
|
+
repositories: AvailableRepository[];
|
|
814
|
+
totalCount: number;
|
|
815
|
+
/**
|
|
816
|
+
* At least one of the workspace's GitHub installations could not be
|
|
817
|
+
* enumerated, so the list is missing whatever that one covers. It is NOT
|
|
818
|
+
* pagination — there is no next page to ask for. A picker should say some
|
|
819
|
+
* repositories may be missing rather than present the list as complete.
|
|
820
|
+
*/
|
|
821
|
+
partial: boolean;
|
|
822
|
+
}
|
|
765
823
|
interface ToolResultRequest {
|
|
766
824
|
conversation_id: string;
|
|
767
825
|
message_id: string;
|
|
@@ -1003,6 +1061,15 @@ interface SendOptions$1 extends ModelChoiceOptions {
|
|
|
1003
1061
|
* it's complete. Omit for a normal turn.
|
|
1004
1062
|
*/
|
|
1005
1063
|
goal?: string;
|
|
1064
|
+
/**
|
|
1065
|
+
* The project this task belongs to (`owner/repo`), on a code-mode agent.
|
|
1066
|
+
*
|
|
1067
|
+
* Send it on the turn that STARTS a task; the binding is write-once, so later
|
|
1068
|
+
* turns can omit it (sending a different one is refused). A first turn without
|
|
1069
|
+
* it on a code-mode agent is refused too — the run needs a repository before it
|
|
1070
|
+
* can hold a credential scoped to one. Astralform >= 0.70.0.
|
|
1071
|
+
*/
|
|
1072
|
+
repository?: string;
|
|
1006
1073
|
}
|
|
1007
1074
|
/**
|
|
1008
1075
|
* A selectable model for one of the team's connected providers, from
|
|
@@ -1150,7 +1217,16 @@ declare class AstralformClient {
|
|
|
1150
1217
|
ollama_connected: boolean;
|
|
1151
1218
|
}>;
|
|
1152
1219
|
getAgentStatus(): Promise<AgentStatus>;
|
|
1153
|
-
|
|
1220
|
+
/**
|
|
1221
|
+
* A page of conversations, newest-updated first.
|
|
1222
|
+
*
|
|
1223
|
+
* `options.repository` narrows to one project's tasks (`owner/repo`) on a
|
|
1224
|
+
* code-mode agent — the same paging applies within the filter, so a client
|
|
1225
|
+
* showing tasks per project pages each project separately.
|
|
1226
|
+
*/
|
|
1227
|
+
getConversations(limit?: number, offset?: number, options?: {
|
|
1228
|
+
repository?: string;
|
|
1229
|
+
}): Promise<Conversation[]>;
|
|
1154
1230
|
getMessages(conversationId: string): Promise<Message[]>;
|
|
1155
1231
|
/**
|
|
1156
1232
|
* Replace the title the server generated from the conversation's first turn.
|
|
@@ -1235,6 +1311,39 @@ declare class AstralformClient {
|
|
|
1235
1311
|
* `getAgents()`, which lists the AI personas inside the active agent.
|
|
1236
1312
|
*/
|
|
1237
1313
|
listAgents(teamId: string): Promise<TeamAgentSummary[]>;
|
|
1314
|
+
/**
|
|
1315
|
+
* The projects (GitHub repositories) this app user works with, and what they
|
|
1316
|
+
* may add.
|
|
1317
|
+
*
|
|
1318
|
+
* A project list is per app user within a code-mode agent: the developer
|
|
1319
|
+
* connects the workspace's GitHub account, and each user curates their own
|
|
1320
|
+
* list from what that connection covers. Every method 404s on a chat-mode
|
|
1321
|
+
* agent, so the surface is invisible rather than empty there.
|
|
1322
|
+
*/
|
|
1323
|
+
readonly code: {
|
|
1324
|
+
projects: {
|
|
1325
|
+
/** This user's projects on the active agent, oldest first. */
|
|
1326
|
+
list: () => Promise<CodeProject[]>;
|
|
1327
|
+
/**
|
|
1328
|
+
* What the workspace's GitHub installations cover, minus what this user
|
|
1329
|
+
* has already added. Read `state` before the list: an empty `repositories`
|
|
1330
|
+
* means something different in each of its three values.
|
|
1331
|
+
*/
|
|
1332
|
+
available: () => Promise<AvailableRepositories>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Add a repository. The server checks it against the workspace's own
|
|
1335
|
+
* installations and answers a repository it cannot reach the same way it
|
|
1336
|
+
* answers one owned by someone else — deliberately, so this call cannot be
|
|
1337
|
+
* used to discover which organisations use Astralform.
|
|
1338
|
+
*/
|
|
1339
|
+
add: (repoFullName: string) => Promise<CodeProject>;
|
|
1340
|
+
/**
|
|
1341
|
+
* Remove a project. Tasks already bound to that repository keep their
|
|
1342
|
+
* binding — they simply stop grouping under it.
|
|
1343
|
+
*/
|
|
1344
|
+
remove: (owner: string, repo: string) => Promise<void>;
|
|
1345
|
+
};
|
|
1346
|
+
};
|
|
1238
1347
|
createJob(request: ChatStreamRequest): Promise<JobCreateResponse>;
|
|
1239
1348
|
streamJobEvents(jobId: string, afterSeq?: number, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
|
|
1240
1349
|
cancelJob(jobId: string): Promise<void>;
|
|
@@ -2003,4 +2112,4 @@ declare function isEmbeddedResource(value: unknown): value is {
|
|
|
2003
2112
|
*/
|
|
2004
2113
|
declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
|
|
2005
2114
|
|
|
2006
|
-
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 EffortRung, 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 ThinkingDescriptor, type ThinkingRungOption, 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, VOICE_POLISH_MODES, type VoiceConfig, type VoiceLLMMode, type VoicePolishEvent, type VoicePolishMode, type VoicePolishRequest, type VoiceTranscribeOptions, type VoiceTranscript, 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, isVoiceLLMMode, isVoicePolishMode, mapSseToChat, parseEmbeddedResource, parseVoicePolishFrame, replayEvents, streamJobSSE, translateDelta };
|
|
2115
|
+
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 AvailableRepositories, type AvailableRepository, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, type CodeProject, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EffortRung, 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 ThinkingDescriptor, type ThinkingRungOption, 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, VOICE_POLISH_MODES, type VoiceConfig, type VoiceLLMMode, type VoicePolishEvent, type VoicePolishMode, type VoicePolishRequest, type VoiceTranscribeOptions, type VoiceTranscript, 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, isVoiceLLMMode, isVoicePolishMode, mapSseToChat, parseEmbeddedResource, parseVoicePolishFrame, replayEvents, streamJobSSE, translateDelta };
|
package/dist/index.js
CHANGED
|
@@ -338,6 +338,69 @@ function isApiKeyConfig(config) {
|
|
|
338
338
|
}
|
|
339
339
|
var AstralformClient = class {
|
|
340
340
|
constructor(config) {
|
|
341
|
+
// --- Code mode: the app user's projects ---
|
|
342
|
+
/**
|
|
343
|
+
* The projects (GitHub repositories) this app user works with, and what they
|
|
344
|
+
* may add.
|
|
345
|
+
*
|
|
346
|
+
* A project list is per app user within a code-mode agent: the developer
|
|
347
|
+
* connects the workspace's GitHub account, and each user curates their own
|
|
348
|
+
* list from what that connection covers. Every method 404s on a chat-mode
|
|
349
|
+
* agent, so the surface is invisible rather than empty there.
|
|
350
|
+
*/
|
|
351
|
+
this.code = {
|
|
352
|
+
projects: {
|
|
353
|
+
/** This user's projects on the active agent, oldest first. */
|
|
354
|
+
list: async () => {
|
|
355
|
+
const raw = await this.get(
|
|
356
|
+
"/v1/code/projects"
|
|
357
|
+
);
|
|
358
|
+
return raw.map((p) => camelizeKeys(p));
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* What the workspace's GitHub installations cover, minus what this user
|
|
362
|
+
* has already added. Read `state` before the list: an empty `repositories`
|
|
363
|
+
* means something different in each of its three values.
|
|
364
|
+
*/
|
|
365
|
+
available: async () => {
|
|
366
|
+
const raw = await this.get("/v1/code/projects/available");
|
|
367
|
+
return {
|
|
368
|
+
state: raw.state,
|
|
369
|
+
repositories: (raw.repositories ?? []).map((r) => ({
|
|
370
|
+
fullName: r.full_name,
|
|
371
|
+
private: r.private
|
|
372
|
+
})),
|
|
373
|
+
// Defaulted like its neighbours: the `unavailable` branch has nothing
|
|
374
|
+
// to count, and an absent field behind a `number` type prints
|
|
375
|
+
// "undefined" in a picker rather than a number.
|
|
376
|
+
totalCount: raw.total_count ?? 0,
|
|
377
|
+
partial: raw.partial ?? false
|
|
378
|
+
};
|
|
379
|
+
},
|
|
380
|
+
/**
|
|
381
|
+
* Add a repository. The server checks it against the workspace's own
|
|
382
|
+
* installations and answers a repository it cannot reach the same way it
|
|
383
|
+
* answers one owned by someone else — deliberately, so this call cannot be
|
|
384
|
+
* used to discover which organisations use Astralform.
|
|
385
|
+
*/
|
|
386
|
+
add: async (repoFullName) => {
|
|
387
|
+
const raw = await this.post(
|
|
388
|
+
"/v1/code/projects",
|
|
389
|
+
{ repo_full_name: repoFullName }
|
|
390
|
+
);
|
|
391
|
+
return camelizeKeys(raw);
|
|
392
|
+
},
|
|
393
|
+
/**
|
|
394
|
+
* Remove a project. Tasks already bound to that repository keep their
|
|
395
|
+
* binding — they simply stop grouping under it.
|
|
396
|
+
*/
|
|
397
|
+
remove: async (owner, repo) => {
|
|
398
|
+
await this.del(
|
|
399
|
+
`/v1/code/projects/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
};
|
|
341
404
|
if (isApiKeyConfig(config)) {
|
|
342
405
|
if (!config.apiKey || typeof config.apiKey !== "string") {
|
|
343
406
|
throw new Error("apiKey is required and must be a non-empty string");
|
|
@@ -578,10 +641,18 @@ var AstralformClient = class {
|
|
|
578
641
|
}
|
|
579
642
|
};
|
|
580
643
|
}
|
|
581
|
-
|
|
644
|
+
/**
|
|
645
|
+
* A page of conversations, newest-updated first.
|
|
646
|
+
*
|
|
647
|
+
* `options.repository` narrows to one project's tasks (`owner/repo`) on a
|
|
648
|
+
* code-mode agent — the same paging applies within the filter, so a client
|
|
649
|
+
* showing tasks per project pages each project separately.
|
|
650
|
+
*/
|
|
651
|
+
async getConversations(limit = 50, offset = 0, options) {
|
|
582
652
|
const safeLimit = Math.max(1, Math.min(200, Math.floor(Number(limit))));
|
|
583
653
|
const safeOffset = Math.max(0, Math.floor(Number(offset)));
|
|
584
|
-
const
|
|
654
|
+
const filter = options?.repository ? `&repository=${encodeURIComponent(options.repository)}` : "";
|
|
655
|
+
const raw = await this.get(`/v1/conversations?limit=${safeLimit}&offset=${safeOffset}${filter}`);
|
|
585
656
|
return raw.map((c) => camelizeKeys(c));
|
|
586
657
|
}
|
|
587
658
|
async getMessages(conversationId) {
|
|
@@ -1676,6 +1747,9 @@ var ChatSession = class {
|
|
|
1676
1747
|
image_mode: options?.imageMode,
|
|
1677
1748
|
video_mode: options?.videoMode,
|
|
1678
1749
|
goal: options?.goal,
|
|
1750
|
+
// The project this task belongs to, on a code-mode agent. Write-once
|
|
1751
|
+
// server-side: sent on every turn, honoured on the first.
|
|
1752
|
+
repository: options?.repository,
|
|
1679
1753
|
// Per-request model choice (client-side model selection).
|
|
1680
1754
|
provider: options?.provider,
|
|
1681
1755
|
model: options?.model,
|