@astralform/js 7.3.0 → 7.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.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,17 @@ 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, which
763
+ * binds it. A later turn may omit it or repeat the same value; a DIFFERENT
764
+ * value is refused (409), not ignored — a task is bound to one repository for
765
+ * life, so a different repository means a new task. Chat-mode agents ignore
766
+ * it entirely.
767
+ * Astralform >= 0.70.0.
768
+ */
769
+ repository?: string;
741
770
  mcp_manifest?: ToolDefinition[];
742
771
  enabled_mcp?: string[];
743
772
  continue_from_message?: string;
@@ -762,6 +791,37 @@ interface ChatStreamRequest {
762
791
  reasoning_effort?: ReasoningEffort;
763
792
  temperature?: number;
764
793
  }
794
+ /** One repository an app user works with on a code-mode agent. */
795
+ interface CodeProject {
796
+ repoFullName: string;
797
+ addedAt: string;
798
+ }
799
+ /** A repository the workspace's GitHub installations cover. */
800
+ interface AvailableRepository {
801
+ fullName: string;
802
+ private: boolean;
803
+ }
804
+ /**
805
+ * What an app user may add, and why the list might be empty.
806
+ *
807
+ * `state` separates the three empty cases a picker must not conflate:
808
+ * `ok` (connected, covers nothing new), `not_installed` (no installation to ask)
809
+ * and `unavailable` (GitHub could not be reached — try again, do not tell the
810
+ * user they have no repositories). `totalCount` is the installations' raw total
811
+ * BEFORE already-added projects are subtracted, so it is not the list's length.
812
+ */
813
+ interface AvailableRepositories {
814
+ state: "ok" | "unavailable" | "not_installed";
815
+ repositories: AvailableRepository[];
816
+ totalCount: number;
817
+ /**
818
+ * At least one of the workspace's GitHub installations could not be
819
+ * enumerated, so the list is missing whatever that one covers. It is NOT
820
+ * pagination — there is no next page to ask for. A picker should say some
821
+ * repositories may be missing rather than present the list as complete.
822
+ */
823
+ partial: boolean;
824
+ }
765
825
  interface ToolResultRequest {
766
826
  conversation_id: string;
767
827
  message_id: string;
@@ -1003,6 +1063,16 @@ interface SendOptions$1 extends ModelChoiceOptions {
1003
1063
  * it's complete. Omit for a normal turn.
1004
1064
  */
1005
1065
  goal?: string;
1066
+ /**
1067
+ * The project this task belongs to (`owner/repo`), on a code-mode agent.
1068
+ *
1069
+ * Send it on the turn that STARTS a task; the binding is write-once, so a
1070
+ * later turn may omit it or repeat the same value, and a DIFFERENT value is
1071
+ * refused (409) rather than ignored. A first turn without it on a code-mode
1072
+ * agent is refused too (400) — the run needs a repository before it can hold a
1073
+ * credential scoped to one. Astralform >= 0.70.0.
1074
+ */
1075
+ repository?: string;
1006
1076
  }
1007
1077
  /**
1008
1078
  * A selectable model for one of the team's connected providers, from
@@ -1150,7 +1220,16 @@ declare class AstralformClient {
1150
1220
  ollama_connected: boolean;
1151
1221
  }>;
1152
1222
  getAgentStatus(): Promise<AgentStatus>;
1153
- getConversations(limit?: number, offset?: number): Promise<Conversation[]>;
1223
+ /**
1224
+ * A page of conversations, newest-updated first.
1225
+ *
1226
+ * `options.repository` narrows to one project's tasks (`owner/repo`) on a
1227
+ * code-mode agent — the same paging applies within the filter, so a client
1228
+ * showing tasks per project pages each project separately.
1229
+ */
1230
+ getConversations(limit?: number, offset?: number, options?: {
1231
+ repository?: string;
1232
+ }): Promise<Conversation[]>;
1154
1233
  getMessages(conversationId: string): Promise<Message[]>;
1155
1234
  /**
1156
1235
  * Replace the title the server generated from the conversation's first turn.
@@ -1235,6 +1314,39 @@ declare class AstralformClient {
1235
1314
  * `getAgents()`, which lists the AI personas inside the active agent.
1236
1315
  */
1237
1316
  listAgents(teamId: string): Promise<TeamAgentSummary[]>;
1317
+ /**
1318
+ * The projects (GitHub repositories) this app user works with, and what they
1319
+ * may add.
1320
+ *
1321
+ * A project list is per app user within a code-mode agent: the developer
1322
+ * connects the workspace's GitHub account, and each user curates their own
1323
+ * list from what that connection covers. Every method 404s on a chat-mode
1324
+ * agent, so the surface is invisible rather than empty there.
1325
+ */
1326
+ readonly code: {
1327
+ projects: {
1328
+ /** This user's projects on the active agent, oldest first. */
1329
+ list: () => Promise<CodeProject[]>;
1330
+ /**
1331
+ * What the workspace's GitHub installations cover, minus what this user
1332
+ * has already added. Read `state` before the list: an empty `repositories`
1333
+ * means something different in each of its three values.
1334
+ */
1335
+ available: () => Promise<AvailableRepositories>;
1336
+ /**
1337
+ * Add a repository. The server checks it against the workspace's own
1338
+ * installations and answers a repository it cannot reach the same way it
1339
+ * answers one owned by someone else — deliberately, so this call cannot be
1340
+ * used to discover which organisations use Astralform.
1341
+ */
1342
+ add: (repoFullName: string) => Promise<CodeProject>;
1343
+ /**
1344
+ * Remove a project. Tasks already bound to that repository keep their
1345
+ * binding — they simply stop grouping under it.
1346
+ */
1347
+ remove: (owner: string, repo: string) => Promise<void>;
1348
+ };
1349
+ };
1238
1350
  createJob(request: ChatStreamRequest): Promise<JobCreateResponse>;
1239
1351
  streamJobEvents(jobId: string, afterSeq?: number, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
1240
1352
  cancelJob(jobId: string): Promise<void>;
@@ -1707,6 +1819,17 @@ interface SendOptions extends ModelChoiceOptions {
1707
1819
  * goal objective the backend drives to completion. Omit for a normal turn.
1708
1820
  */
1709
1821
  goal?: string;
1822
+ /**
1823
+ * The project this task belongs to (`owner/repo`), on a code-mode agent.
1824
+ *
1825
+ * Write-once server-side, and the refusal is the part that matters: the FIRST
1826
+ * turn binds the task, a later turn may omit it or repeat the same value, and
1827
+ * a DIFFERENT value is refused (409) rather than ignored — silently acting on
1828
+ * the wrong repository is the failure that rule exists to prevent. A first
1829
+ * turn without it on a code-mode agent is refused too (400). Astralform
1830
+ * >= 0.70.0.
1831
+ */
1832
+ repository?: string;
1710
1833
  }
1711
1834
  type StreamManagerEvent = {
1712
1835
  type: "stateChange";
@@ -2003,4 +2126,4 @@ declare function isEmbeddedResource(value: unknown): value is {
2003
2126
  */
2004
2127
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
2005
2128
 
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 };
2129
+ 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,17 @@ 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, which
763
+ * binds it. A later turn may omit it or repeat the same value; a DIFFERENT
764
+ * value is refused (409), not ignored — a task is bound to one repository for
765
+ * life, so a different repository means a new task. Chat-mode agents ignore
766
+ * it entirely.
767
+ * Astralform >= 0.70.0.
768
+ */
769
+ repository?: string;
741
770
  mcp_manifest?: ToolDefinition[];
742
771
  enabled_mcp?: string[];
743
772
  continue_from_message?: string;
@@ -762,6 +791,37 @@ interface ChatStreamRequest {
762
791
  reasoning_effort?: ReasoningEffort;
763
792
  temperature?: number;
764
793
  }
794
+ /** One repository an app user works with on a code-mode agent. */
795
+ interface CodeProject {
796
+ repoFullName: string;
797
+ addedAt: string;
798
+ }
799
+ /** A repository the workspace's GitHub installations cover. */
800
+ interface AvailableRepository {
801
+ fullName: string;
802
+ private: boolean;
803
+ }
804
+ /**
805
+ * What an app user may add, and why the list might be empty.
806
+ *
807
+ * `state` separates the three empty cases a picker must not conflate:
808
+ * `ok` (connected, covers nothing new), `not_installed` (no installation to ask)
809
+ * and `unavailable` (GitHub could not be reached — try again, do not tell the
810
+ * user they have no repositories). `totalCount` is the installations' raw total
811
+ * BEFORE already-added projects are subtracted, so it is not the list's length.
812
+ */
813
+ interface AvailableRepositories {
814
+ state: "ok" | "unavailable" | "not_installed";
815
+ repositories: AvailableRepository[];
816
+ totalCount: number;
817
+ /**
818
+ * At least one of the workspace's GitHub installations could not be
819
+ * enumerated, so the list is missing whatever that one covers. It is NOT
820
+ * pagination — there is no next page to ask for. A picker should say some
821
+ * repositories may be missing rather than present the list as complete.
822
+ */
823
+ partial: boolean;
824
+ }
765
825
  interface ToolResultRequest {
766
826
  conversation_id: string;
767
827
  message_id: string;
@@ -1003,6 +1063,16 @@ interface SendOptions$1 extends ModelChoiceOptions {
1003
1063
  * it's complete. Omit for a normal turn.
1004
1064
  */
1005
1065
  goal?: string;
1066
+ /**
1067
+ * The project this task belongs to (`owner/repo`), on a code-mode agent.
1068
+ *
1069
+ * Send it on the turn that STARTS a task; the binding is write-once, so a
1070
+ * later turn may omit it or repeat the same value, and a DIFFERENT value is
1071
+ * refused (409) rather than ignored. A first turn without it on a code-mode
1072
+ * agent is refused too (400) — the run needs a repository before it can hold a
1073
+ * credential scoped to one. Astralform >= 0.70.0.
1074
+ */
1075
+ repository?: string;
1006
1076
  }
1007
1077
  /**
1008
1078
  * A selectable model for one of the team's connected providers, from
@@ -1150,7 +1220,16 @@ declare class AstralformClient {
1150
1220
  ollama_connected: boolean;
1151
1221
  }>;
1152
1222
  getAgentStatus(): Promise<AgentStatus>;
1153
- getConversations(limit?: number, offset?: number): Promise<Conversation[]>;
1223
+ /**
1224
+ * A page of conversations, newest-updated first.
1225
+ *
1226
+ * `options.repository` narrows to one project's tasks (`owner/repo`) on a
1227
+ * code-mode agent — the same paging applies within the filter, so a client
1228
+ * showing tasks per project pages each project separately.
1229
+ */
1230
+ getConversations(limit?: number, offset?: number, options?: {
1231
+ repository?: string;
1232
+ }): Promise<Conversation[]>;
1154
1233
  getMessages(conversationId: string): Promise<Message[]>;
1155
1234
  /**
1156
1235
  * Replace the title the server generated from the conversation's first turn.
@@ -1235,6 +1314,39 @@ declare class AstralformClient {
1235
1314
  * `getAgents()`, which lists the AI personas inside the active agent.
1236
1315
  */
1237
1316
  listAgents(teamId: string): Promise<TeamAgentSummary[]>;
1317
+ /**
1318
+ * The projects (GitHub repositories) this app user works with, and what they
1319
+ * may add.
1320
+ *
1321
+ * A project list is per app user within a code-mode agent: the developer
1322
+ * connects the workspace's GitHub account, and each user curates their own
1323
+ * list from what that connection covers. Every method 404s on a chat-mode
1324
+ * agent, so the surface is invisible rather than empty there.
1325
+ */
1326
+ readonly code: {
1327
+ projects: {
1328
+ /** This user's projects on the active agent, oldest first. */
1329
+ list: () => Promise<CodeProject[]>;
1330
+ /**
1331
+ * What the workspace's GitHub installations cover, minus what this user
1332
+ * has already added. Read `state` before the list: an empty `repositories`
1333
+ * means something different in each of its three values.
1334
+ */
1335
+ available: () => Promise<AvailableRepositories>;
1336
+ /**
1337
+ * Add a repository. The server checks it against the workspace's own
1338
+ * installations and answers a repository it cannot reach the same way it
1339
+ * answers one owned by someone else — deliberately, so this call cannot be
1340
+ * used to discover which organisations use Astralform.
1341
+ */
1342
+ add: (repoFullName: string) => Promise<CodeProject>;
1343
+ /**
1344
+ * Remove a project. Tasks already bound to that repository keep their
1345
+ * binding — they simply stop grouping under it.
1346
+ */
1347
+ remove: (owner: string, repo: string) => Promise<void>;
1348
+ };
1349
+ };
1238
1350
  createJob(request: ChatStreamRequest): Promise<JobCreateResponse>;
1239
1351
  streamJobEvents(jobId: string, afterSeq?: number, signal?: AbortSignal): AsyncGenerator<ChatStreamEvent>;
1240
1352
  cancelJob(jobId: string): Promise<void>;
@@ -1707,6 +1819,17 @@ interface SendOptions extends ModelChoiceOptions {
1707
1819
  * goal objective the backend drives to completion. Omit for a normal turn.
1708
1820
  */
1709
1821
  goal?: string;
1822
+ /**
1823
+ * The project this task belongs to (`owner/repo`), on a code-mode agent.
1824
+ *
1825
+ * Write-once server-side, and the refusal is the part that matters: the FIRST
1826
+ * turn binds the task, a later turn may omit it or repeat the same value, and
1827
+ * a DIFFERENT value is refused (409) rather than ignored — silently acting on
1828
+ * the wrong repository is the failure that rule exists to prevent. A first
1829
+ * turn without it on a code-mode agent is refused too (400). Astralform
1830
+ * >= 0.70.0.
1831
+ */
1832
+ repository?: string;
1710
1833
  }
1711
1834
  type StreamManagerEvent = {
1712
1835
  type: "stateChange";
@@ -2003,4 +2126,4 @@ declare function isEmbeddedResource(value: unknown): value is {
2003
2126
  */
2004
2127
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
2005
2128
 
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 };
2129
+ 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
- async getConversations(limit = 50, offset = 0) {
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 raw = await this.get(`/v1/conversations?limit=${safeLimit}&offset=${safeOffset}`);
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,
@@ -2528,23 +2602,8 @@ var StreamManager = class {
2528
2602
  this.setState("streaming");
2529
2603
  try {
2530
2604
  await this.session.send(content, {
2531
- // Address the send explicitly. `ChatSession.send` otherwise falls back
2532
- // to `session.conversationId`, which LAGS this pointer: a restore
2533
- // assigns it synchronously but only reaches the next switch's own
2534
- // `loadConversation` an await later, so between the two the session
2535
- // still names the conversation the user left. The manager's pointer
2536
- // moved the moment the user clicked; it is the authority.
2537
- conversationId: target ?? void 0,
2538
- agentName: options?.agentName,
2539
- uploadIds: options?.uploadIds,
2540
- planMode: options?.planMode,
2541
- imageMode: options?.imageMode,
2542
- videoMode: options?.videoMode,
2543
- goal: options?.goal,
2544
- provider: options?.provider,
2545
- model: options?.model,
2546
- reasoningEffort: options?.reasoningEffort,
2547
- temperature: options?.temperature
2605
+ ...options,
2606
+ conversationId: target ?? void 0
2548
2607
  });
2549
2608
  } catch {
2550
2609
  }