@pluno/product-agent-web 0.1.52 → 0.1.54

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.
@@ -0,0 +1,18 @@
1
+ export type StoredProductAgentAttachmentFile = {
2
+ attachmentId: string;
3
+ name: string;
4
+ mimeType: string;
5
+ sizeBytes: number;
6
+ blob: Blob;
7
+ origin?: string;
8
+ sessionId?: string;
9
+ fileUrl?: string;
10
+ gcsPath?: string;
11
+ createdAt: number;
12
+ lastUsedAt: number;
13
+ };
14
+ export type ProductAgentAttachmentFileUpdate = Partial<Pick<StoredProductAgentAttachmentFile, "origin" | "sessionId" | "fileUrl" | "gcsPath" | "lastUsedAt" | "blob">>;
15
+ export declare function putProductAgentAttachmentFile(record: StoredProductAgentAttachmentFile): Promise<void>;
16
+ export declare function getProductAgentAttachmentFile(attachmentId: string): Promise<StoredProductAgentAttachmentFile | null>;
17
+ export declare function updateProductAgentAttachmentFile(attachmentId: string, patch: ProductAgentAttachmentFileUpdate): Promise<void>;
18
+ export declare function deleteStaleProductAgentAttachmentFiles(maxAgeMs?: number): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -40,10 +40,31 @@ export type ProductAgentMessage = {
40
40
  loading?: boolean;
41
41
  };
42
42
  export type ProductAgentAttachment = {
43
+ id?: string;
43
44
  name: string;
44
- mimeType: "image/png" | "image/jpeg" | "image/webp" | "image/gif" | "application/pdf";
45
+ mimeType: string;
45
46
  sizeBytes: number;
46
- dataUrl: string;
47
+ gcsPath?: string;
48
+ fileUrl?: string;
49
+ };
50
+ export type ProductAgentAttachmentUpload = {
51
+ sessionId: string;
52
+ attachment: ProductAgentAttachment;
53
+ uploadUrl: string;
54
+ uploadMethod: "PUT";
55
+ uploadHeaders: Record<string, string>;
56
+ };
57
+ export type ProductAgentPrepareAttachmentUploadInput = {
58
+ sessionId?: string;
59
+ attachmentId?: string;
60
+ clientId: string;
61
+ transportId: string;
62
+ name: string;
63
+ mimeType: string;
64
+ sizeBytes: number;
65
+ page: ProductAgentPage;
66
+ model?: ProductAgentModel;
67
+ metadata?: Record<string, unknown>;
47
68
  };
48
69
  export type ProductAgentSessionHistoryEntry = {
49
70
  id: string;
@@ -90,6 +111,7 @@ export type ProductAgentInitOptions = {
90
111
  autoConnect?: boolean;
91
112
  initialStarterPrompts?: string[];
92
113
  webSocketFactory?: ProductAgentWebSocketFactory;
114
+ prepareAttachmentUpload?: (input: ProductAgentPrepareAttachmentUploadInput) => Promise<ProductAgentAttachmentUpload>;
93
115
  restorePersistedState?: boolean;
94
116
  expectedPersistedSessionId?: string | null;
95
117
  };
@@ -133,6 +155,9 @@ export declare class PlunoProductAgent {
133
155
  private thinkingWatchdogResyncAttemptsByClientMessageId;
134
156
  private thinkingWatchdogRetryAttemptsByClientMessageId;
135
157
  private runtimeHelperJavascript;
158
+ private readonly attachmentFiles;
159
+ private readonly attachmentBlobCache;
160
+ private sessionUserFilesApiCleanup;
136
161
  private transientStarterPromptsRequestInFlight;
137
162
  private transientStarterPromptsRequestAttempted;
138
163
  private state;
@@ -145,7 +170,15 @@ export declare class PlunoProductAgent {
145
170
  destroy(): void;
146
171
  sendMessage(content: string, options?: {
147
172
  attachments?: ProductAgentAttachment[];
148
- }): void;
173
+ }): string | null;
174
+ createLocalAttachment(file: File): ProductAgentAttachment;
175
+ uploadAttachment(file: File): Promise<ProductAgentAttachment>;
176
+ private startBackgroundAttachmentUploads;
177
+ private uploadAttachmentForMessage;
178
+ private waitForSessionId;
179
+ private updateAttachmentInState;
180
+ private prepareEmbedAttachmentUpload;
181
+ private fetchEmbedAttachmentUpload;
149
182
  stop(): void;
150
183
  startNewSession(): void;
151
184
  listSessions(options?: {
@@ -154,6 +187,7 @@ export declare class PlunoProductAgent {
154
187
  }): Promise<ProductAgentSessionHistoryPage>;
155
188
  loadSession(sessionId: string): void;
156
189
  private send;
190
+ private getUploadToken;
157
191
  private sendNow;
158
192
  private requestTransientStarterPrompts;
159
193
  private flushQueuedClientEvents;
@@ -173,6 +207,8 @@ export declare class PlunoProductAgent {
173
207
  private recoverStuckThinking;
174
208
  private resyncThinkingSession;
175
209
  private executeToolCall;
210
+ private installSessionUserFilesApi;
211
+ private cleanupSessionUserFilesApi;
176
212
  private executeRuntimeHelper;
177
213
  private enableNetworkCapture;
178
214
  private enqueueNetworkEvent;