@astralform/js 1.0.0 → 1.1.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.d.cts CHANGED
@@ -641,6 +641,27 @@ interface ToolApprovalRequest {
641
641
  decision: ToolApprovalDecision;
642
642
  scope: ToolApprovalScope;
643
643
  }
644
+ /**
645
+ * A remembered tool-permission grant belonging to the current end user.
646
+ * Only `conversation`/`always` grants are ever stored (`once` is consumed at
647
+ * approval time and never persisted).
648
+ */
649
+ interface ToolGrant {
650
+ id: string;
651
+ toolName: string;
652
+ decision: ToolApprovalDecision;
653
+ scope: Exclude<ToolApprovalScope, "once">;
654
+ /** Set for `conversation`-scoped grants; `null` for `always`. */
655
+ conversationId: string | null;
656
+ createdAt: string;
657
+ }
658
+ /** A page of the current end user's own tool grants. */
659
+ interface MyToolGrantsPage {
660
+ grants: ToolGrant[];
661
+ total: number;
662
+ limit: number;
663
+ offset: number;
664
+ }
644
665
  interface ToolDefinition {
645
666
  name: string;
646
667
  description: string;
@@ -759,6 +780,21 @@ declare class AstralformClient {
759
780
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
760
781
  submitToolResult(request: ToolResultRequest): Promise<void>;
761
782
  submitToolApproval(request: ToolApprovalRequest): Promise<void>;
783
+ /**
784
+ * List the current end user's own remembered tool-permission grants.
785
+ * Only `conversation`/`always` grants exist (`once` is never persisted).
786
+ * Paginated via `limit` (default 100, max 200) / `offset`; `total` lets you
787
+ * page through all of them.
788
+ */
789
+ getMyToolPermissions(options?: {
790
+ limit?: number;
791
+ offset?: number;
792
+ }): Promise<MyToolGrantsPage>;
793
+ /**
794
+ * Revoke one of the current end user's remembered grants by id. The agent
795
+ * will ask again the next time that tool is used.
796
+ */
797
+ revokeToolPermission(id: string): Promise<void>;
762
798
  private mapAsset;
763
799
  uploadFile(conversationId: string, file: Blob, filename?: string): Promise<ConversationAsset>;
764
800
  listUploads(conversationId: string): Promise<ConversationAsset[]>;
@@ -1122,4 +1158,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1122
1158
  */
1123
1159
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1124
1160
 
1125
- export { type ActiveJob, type AgentIdentity, type AgentInfo, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, 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 ProjectStatus, type ProjectSummary, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, 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 };
1161
+ export { type ActiveJob, type AgentIdentity, type AgentInfo, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, 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 MyToolGrantsPage, type ProjectStatus, type ProjectSummary, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, 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
@@ -641,6 +641,27 @@ interface ToolApprovalRequest {
641
641
  decision: ToolApprovalDecision;
642
642
  scope: ToolApprovalScope;
643
643
  }
644
+ /**
645
+ * A remembered tool-permission grant belonging to the current end user.
646
+ * Only `conversation`/`always` grants are ever stored (`once` is consumed at
647
+ * approval time and never persisted).
648
+ */
649
+ interface ToolGrant {
650
+ id: string;
651
+ toolName: string;
652
+ decision: ToolApprovalDecision;
653
+ scope: Exclude<ToolApprovalScope, "once">;
654
+ /** Set for `conversation`-scoped grants; `null` for `always`. */
655
+ conversationId: string | null;
656
+ createdAt: string;
657
+ }
658
+ /** A page of the current end user's own tool grants. */
659
+ interface MyToolGrantsPage {
660
+ grants: ToolGrant[];
661
+ total: number;
662
+ limit: number;
663
+ offset: number;
664
+ }
644
665
  interface ToolDefinition {
645
666
  name: string;
646
667
  description: string;
@@ -759,6 +780,21 @@ declare class AstralformClient {
759
780
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
760
781
  submitToolResult(request: ToolResultRequest): Promise<void>;
761
782
  submitToolApproval(request: ToolApprovalRequest): Promise<void>;
783
+ /**
784
+ * List the current end user's own remembered tool-permission grants.
785
+ * Only `conversation`/`always` grants exist (`once` is never persisted).
786
+ * Paginated via `limit` (default 100, max 200) / `offset`; `total` lets you
787
+ * page through all of them.
788
+ */
789
+ getMyToolPermissions(options?: {
790
+ limit?: number;
791
+ offset?: number;
792
+ }): Promise<MyToolGrantsPage>;
793
+ /**
794
+ * Revoke one of the current end user's remembered grants by id. The agent
795
+ * will ask again the next time that tool is used.
796
+ */
797
+ revokeToolPermission(id: string): Promise<void>;
762
798
  private mapAsset;
763
799
  uploadFile(conversationId: string, file: Blob, filename?: string): Promise<ConversationAsset>;
764
800
  listUploads(conversationId: string): Promise<ConversationAsset[]>;
@@ -1122,4 +1158,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1122
1158
  */
1123
1159
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1124
1160
 
1125
- export { type ActiveJob, type AgentIdentity, type AgentInfo, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, 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 ProjectStatus, type ProjectSummary, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, 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 };
1161
+ export { type ActiveJob, type AgentIdentity, type AgentInfo, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, 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 MyToolGrantsPage, type ProjectStatus, type ProjectSummary, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, 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
@@ -508,6 +508,49 @@ var AstralformClient = class {
508
508
  async submitToolApproval(request) {
509
509
  await this.post("/v1/tool-approval", request);
510
510
  }
511
+ // --- End-user tool-permission self-service ---
512
+ /**
513
+ * List the current end user's own remembered tool-permission grants.
514
+ * Only `conversation`/`always` grants exist (`once` is never persisted).
515
+ * Paginated via `limit` (default 100, max 200) / `offset`; `total` lets you
516
+ * page through all of them.
517
+ */
518
+ async getMyToolPermissions(options) {
519
+ const params = new URLSearchParams();
520
+ if (options?.limit != null) {
521
+ const safeLimit = Math.max(
522
+ 1,
523
+ Math.min(200, Math.floor(Number(options.limit)))
524
+ );
525
+ params.set("limit", String(safeLimit));
526
+ }
527
+ if (options?.offset != null) {
528
+ const safeOffset = Math.max(0, Math.floor(Number(options.offset)));
529
+ params.set("offset", String(safeOffset));
530
+ }
531
+ const qs = params.toString();
532
+ const raw = await this.get(`/v1/me/tool-permissions${qs ? `?${qs}` : ""}`);
533
+ return {
534
+ grants: raw.grants.map((g) => ({
535
+ id: g.id,
536
+ toolName: g.tool_name,
537
+ decision: g.decision,
538
+ scope: g.scope,
539
+ conversationId: g.conversation_id,
540
+ createdAt: g.created_at
541
+ })),
542
+ total: raw.total,
543
+ limit: raw.limit,
544
+ offset: raw.offset
545
+ };
546
+ }
547
+ /**
548
+ * Revoke one of the current end user's remembered grants by id. The agent
549
+ * will ask again the next time that tool is used.
550
+ */
551
+ async revokeToolPermission(id) {
552
+ await this.del(`/v1/me/tool-permissions/${encodeURIComponent(id)}`);
553
+ }
511
554
  // --- Conversation Assets ---
512
555
  mapAsset(raw) {
513
556
  return {