@ocxp/client 0.2.4 → 0.2.5

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 CHANGED
@@ -847,6 +847,64 @@ var bulkDeleteContent = (options) => (options.client ?? client).post({
847
847
  ...options.headers
848
848
  }
849
849
  });
850
+ var listPrototypeChats = (options) => (options?.client ?? client).get({
851
+ security: [{ scheme: "bearer", type: "http" }],
852
+ url: "/ocxp/prototype/chat/list",
853
+ ...options
854
+ });
855
+ var previewPrototypeChat = (options) => (options.client ?? client).post({
856
+ security: [{ scheme: "bearer", type: "http" }],
857
+ url: "/ocxp/prototype/chat/preview",
858
+ ...options,
859
+ headers: {
860
+ "Content-Type": "application/json",
861
+ ...options.headers
862
+ }
863
+ });
864
+ var linkPrototypeChat = (options) => (options.client ?? client).post({
865
+ security: [{ scheme: "bearer", type: "http" }],
866
+ url: "/ocxp/prototype/chat/link",
867
+ ...options,
868
+ headers: {
869
+ "Content-Type": "application/json",
870
+ ...options.headers
871
+ }
872
+ });
873
+ var syncPrototypeChat = (options) => (options.client ?? client).post({
874
+ security: [{ scheme: "bearer", type: "http" }],
875
+ url: "/ocxp/prototype/chat/sync",
876
+ ...options,
877
+ headers: {
878
+ "Content-Type": "application/json",
879
+ ...options.headers
880
+ }
881
+ });
882
+ var getStoredVersions = (options) => (options.client ?? client).get(
883
+ {
884
+ security: [{ scheme: "bearer", type: "http" }],
885
+ url: "/ocxp/prototype/chat/{provider}/{chat_id}/stored-versions",
886
+ ...options
887
+ }
888
+ );
889
+ var getPrototypeChat = (options) => (options.client ?? client).get({
890
+ security: [{ scheme: "bearer", type: "http" }],
891
+ url: "/ocxp/prototype/chat/{provider}/{chat_id}",
892
+ ...options
893
+ });
894
+ var syncPrototypeChatAsync = (options) => (options.client ?? client).post({
895
+ security: [{ scheme: "bearer", type: "http" }],
896
+ url: "/ocxp/prototype/chat/sync-async",
897
+ ...options,
898
+ headers: {
899
+ "Content-Type": "application/json",
900
+ ...options.headers
901
+ }
902
+ });
903
+ var getSyncStatus = (options) => (options.client ?? client).get({
904
+ security: [{ scheme: "bearer", type: "http" }],
905
+ url: "/ocxp/prototype/chat/sync-status/{job_id}",
906
+ ...options
907
+ });
850
908
  var listSessions = (options) => (options?.client ?? client).get({
851
909
  security: [{ scheme: "bearer", type: "http" }],
852
910
  url: "/ocxp/session",
@@ -2264,6 +2322,120 @@ var OCXPClient = class {
2264
2322
  headers
2265
2323
  });
2266
2324
  }
2325
+ // ============== Prototype Operations ==============
2326
+ /**
2327
+ * List all accessible prototype chats from a provider
2328
+ * @param provider - Filter by provider (v0, lovable, bolt)
2329
+ */
2330
+ async listPrototypeChats(provider) {
2331
+ const headers = await this.getHeaders();
2332
+ const response = await listPrototypeChats({
2333
+ client: this.client,
2334
+ query: { provider },
2335
+ headers
2336
+ });
2337
+ return extractData(response);
2338
+ }
2339
+ /**
2340
+ * Preview a prototype chat (fetch metadata without linking)
2341
+ * @param chatUrl - Chat URL to preview
2342
+ * @param provider - Prototype provider (optional, auto-detected from URL)
2343
+ */
2344
+ async previewPrototypeChat(chatUrl, provider) {
2345
+ const headers = await this.getHeaders();
2346
+ const response = await previewPrototypeChat({
2347
+ client: this.client,
2348
+ body: { chat_url: chatUrl, provider },
2349
+ headers
2350
+ });
2351
+ return extractData(response);
2352
+ }
2353
+ /**
2354
+ * Link a prototype chat to a mission
2355
+ * @param data - Link request data
2356
+ */
2357
+ async linkPrototypeChat(data) {
2358
+ const headers = await this.getHeaders();
2359
+ const response = await linkPrototypeChat({
2360
+ client: this.client,
2361
+ body: data,
2362
+ headers
2363
+ });
2364
+ return extractData(response);
2365
+ }
2366
+ /**
2367
+ * Sync/refresh a linked prototype chat
2368
+ * @param data - Sync request data
2369
+ */
2370
+ async syncPrototypeChat(data) {
2371
+ const headers = await this.getHeaders();
2372
+ const response = await syncPrototypeChat({
2373
+ client: this.client,
2374
+ body: data,
2375
+ headers
2376
+ });
2377
+ return extractData(response);
2378
+ }
2379
+ /**
2380
+ * Get stored prototype chat data
2381
+ * @param provider - Provider name (v0, lovable, bolt)
2382
+ * @param chatId - Chat ID
2383
+ * @param options - Optional query parameters
2384
+ */
2385
+ async getPrototypeChat(provider, chatId, options) {
2386
+ const headers = await this.getHeaders();
2387
+ const response = await getPrototypeChat({
2388
+ client: this.client,
2389
+ path: { provider, chat_id: chatId },
2390
+ query: { project_id: options?.projectId, version_id: options?.versionId },
2391
+ headers
2392
+ });
2393
+ return extractData(response);
2394
+ }
2395
+ /**
2396
+ * Start async prototype chat sync job
2397
+ * @param data - Async sync request data
2398
+ */
2399
+ async syncPrototypeChatAsync(data) {
2400
+ const headers = await this.getHeaders();
2401
+ const response = await syncPrototypeChatAsync({
2402
+ client: this.client,
2403
+ body: data,
2404
+ headers
2405
+ });
2406
+ return extractData(response);
2407
+ }
2408
+ /**
2409
+ * Get sync job status
2410
+ * @param jobId - Job ID from async sync response
2411
+ */
2412
+ async getPrototypeSyncStatus(jobId) {
2413
+ const headers = await this.getHeaders();
2414
+ const response = await getSyncStatus({
2415
+ client: this.client,
2416
+ path: { job_id: jobId },
2417
+ headers
2418
+ });
2419
+ return extractData(response);
2420
+ }
2421
+ /**
2422
+ * Get stored versions for a prototype chat (fast DynamoDB query)
2423
+ * Use this for UI button states instead of full sync
2424
+ * @param provider - Provider name (v0, lovable, bolt)
2425
+ * @param chatId - Chat ID
2426
+ * @param options - Optional settings
2427
+ * @param options.includeDetails - If true, returns full version metadata (files, pages, screenshots)
2428
+ */
2429
+ async getStoredVersions(provider, chatId, options) {
2430
+ const headers = await this.getHeaders();
2431
+ const response = await getStoredVersions({
2432
+ client: this.client,
2433
+ path: { provider, chat_id: chatId },
2434
+ query: options?.includeDetails ? { include_details: true } : void 0,
2435
+ headers
2436
+ });
2437
+ return extractData(response);
2438
+ }
2267
2439
  // ============== Auth Operations ==============
2268
2440
  /**
2269
2441
  * Get auth configuration (public endpoint)
@@ -2387,6 +2559,7 @@ var OCXPClient = class {
2387
2559
  _project;
2388
2560
  _session;
2389
2561
  _kb;
2562
+ _prototype;
2390
2563
  /**
2391
2564
  * Mission namespace for convenient mission operations
2392
2565
  * @example ocxp.mission.list({ status: 'pending' })
@@ -2427,6 +2600,16 @@ var OCXPClient = class {
2427
2600
  }
2428
2601
  return this._kb;
2429
2602
  }
2603
+ /**
2604
+ * Prototype namespace for convenient prototype chat operations
2605
+ * @example ocxp.prototype.list('v0')
2606
+ */
2607
+ get prototype() {
2608
+ if (!this._prototype) {
2609
+ this._prototype = new PrototypeNamespace(this);
2610
+ }
2611
+ return this._prototype;
2612
+ }
2430
2613
  };
2431
2614
  var MissionNamespace = class {
2432
2615
  constructor(client2) {
@@ -2647,6 +2830,69 @@ var KBNamespace = class {
2647
2830
  return this.client.kbRag(query, sessionId);
2648
2831
  }
2649
2832
  };
2833
+ var PrototypeNamespace = class {
2834
+ constructor(client2) {
2835
+ this.client = client2;
2836
+ }
2837
+ /**
2838
+ * List all accessible prototype chats
2839
+ * @example ocxp.prototype.list('v0')
2840
+ */
2841
+ async list(provider) {
2842
+ return this.client.listPrototypeChats(provider);
2843
+ }
2844
+ /**
2845
+ * Preview a prototype chat (fetch metadata without linking)
2846
+ * @example ocxp.prototype.preview('https://v0.dev/chat/abc123')
2847
+ */
2848
+ async preview(chatUrl, provider) {
2849
+ return this.client.previewPrototypeChat(chatUrl, provider);
2850
+ }
2851
+ /**
2852
+ * Link a prototype chat to a mission
2853
+ * @example ocxp.prototype.link({ mission_id: 'xyz', chat_url: 'https://v0.dev/chat/abc123' })
2854
+ */
2855
+ async link(data) {
2856
+ return this.client.linkPrototypeChat(data);
2857
+ }
2858
+ /**
2859
+ * Sync/refresh a linked prototype chat
2860
+ * @example ocxp.prototype.sync({ chat_id: 'abc123', mission_id: 'xyz' })
2861
+ */
2862
+ async sync(data) {
2863
+ return this.client.syncPrototypeChat(data);
2864
+ }
2865
+ /**
2866
+ * Get stored prototype chat data
2867
+ * @example ocxp.prototype.get('v0', 'abc123')
2868
+ */
2869
+ async get(provider, chatId, options) {
2870
+ return this.client.getPrototypeChat(provider, chatId, options);
2871
+ }
2872
+ /**
2873
+ * Start async prototype chat sync job
2874
+ * @example ocxp.prototype.syncAsync({ chat_id: 'abc123', mission_id: 'xyz', download_files: true })
2875
+ */
2876
+ async syncAsync(data) {
2877
+ return this.client.syncPrototypeChatAsync(data);
2878
+ }
2879
+ /**
2880
+ * Get sync job status
2881
+ * @example ocxp.prototype.getSyncStatus('job-id')
2882
+ */
2883
+ async getSyncStatus(jobId) {
2884
+ return this.client.getPrototypeSyncStatus(jobId);
2885
+ }
2886
+ /**
2887
+ * Get stored versions for a prototype chat (fast DynamoDB query)
2888
+ * Use this for UI button states instead of full sync
2889
+ * @param options.includeDetails - If true, returns full version metadata (files, pages, screenshots)
2890
+ * @example ocxp.prototype.getStoredVersions('v0', 'abc123', { includeDetails: true })
2891
+ */
2892
+ async getStoredVersions(provider, chatId, options) {
2893
+ return this.client.getStoredVersions(provider, chatId, options);
2894
+ }
2895
+ };
2650
2896
  function createOCXPClient(options) {
2651
2897
  return new OCXPClient(options);
2652
2898
  }
@@ -3066,6 +3312,18 @@ var WebSocketService = class {
3066
3312
  onSyncEvent(handler) {
3067
3313
  return this.on("sync_event", handler);
3068
3314
  }
3315
+ /**
3316
+ * Subscribe to prototype sync progress updates
3317
+ */
3318
+ onPrototypeSyncProgress(handler) {
3319
+ return this.on("prototype_sync_progress", handler);
3320
+ }
3321
+ /**
3322
+ * Subscribe to prototype sync complete notifications
3323
+ */
3324
+ onPrototypeSyncComplete(handler) {
3325
+ return this.on("prototype_sync_complete", handler);
3326
+ }
3069
3327
  /**
3070
3328
  * Subscribe to connection state changes
3071
3329
  */
@@ -3085,6 +3343,12 @@ var WebSocketService = class {
3085
3343
  subscribeToRepo(repoId) {
3086
3344
  this.send({ action: "subscribe", type: "repo", id: repoId });
3087
3345
  }
3346
+ /**
3347
+ * Subscribe to prototype sync job updates
3348
+ */
3349
+ subscribeToPrototypeSync(jobId) {
3350
+ this.send({ action: "subscribe", topic: `prototype_sync:${jobId}` });
3351
+ }
3088
3352
  /**
3089
3353
  * Send message to server
3090
3354
  */
@@ -3996,6 +4260,7 @@ exports.ProjectMissionSchema = ProjectMissionSchema;
3996
4260
  exports.ProjectNamespace = ProjectNamespace;
3997
4261
  exports.ProjectRepoSchema = ProjectRepoSchema;
3998
4262
  exports.ProjectSchema = ProjectSchema;
4263
+ exports.PrototypeNamespace = PrototypeNamespace;
3999
4264
  exports.QueryDataSchema = QueryDataSchema;
4000
4265
  exports.QueryFilterSchema = QueryFilterSchema;
4001
4266
  exports.QueryResponseSchema = QueryResponseSchema;
@@ -4085,10 +4350,13 @@ exports.getMemoForSource = getMemoForSource;
4085
4350
  exports.getMissionContext = getMissionContext;
4086
4351
  exports.getProject = getProject;
4087
4352
  exports.getProjectDatabases = getProjectDatabases;
4353
+ exports.getPrototypeChat = getPrototypeChat;
4088
4354
  exports.getRepoDownloadStatus = getRepoDownloadStatus;
4089
4355
  exports.getSample = getSample;
4090
4356
  exports.getSchema = getSchema;
4091
4357
  exports.getSessionMessages = getSessionMessages;
4358
+ exports.getStoredVersions = getStoredVersions;
4359
+ exports.getSyncStatus = getSyncStatus;
4092
4360
  exports.githubCheckAccess = githubCheckAccess;
4093
4361
  exports.githubGetContents = githubGetContents;
4094
4362
  exports.githubListBranches = githubListBranches;
@@ -4102,12 +4370,14 @@ exports.isOCXPRateLimitError = isOCXPRateLimitError;
4102
4370
  exports.isOCXPTimeoutError = isOCXPTimeoutError;
4103
4371
  exports.isOCXPValidationError = isOCXPValidationError;
4104
4372
  exports.isValidContentType = isValidContentType;
4373
+ exports.linkPrototypeChat = linkPrototypeChat;
4105
4374
  exports.listContent = listContent;
4106
4375
  exports.listContextDatabases = listContextDatabases;
4107
4376
  exports.listDatabases = listDatabases;
4108
4377
  exports.listDownloadedRepos = listDownloadedRepos;
4109
4378
  exports.listMemos = listMemos;
4110
4379
  exports.listProjects = listProjects;
4380
+ exports.listPrototypeChats = listPrototypeChats;
4111
4381
  exports.listSessions = listSessions;
4112
4382
  exports.listTables = listTables;
4113
4383
  exports.listWorkspaces = listWorkspaces;
@@ -4119,6 +4389,7 @@ exports.moveContent = moveContent;
4119
4389
  exports.normalizePath = normalizePath;
4120
4390
  exports.parsePath = parsePath;
4121
4391
  exports.parseWSMessage = parseWSMessage;
4392
+ exports.previewPrototypeChat = previewPrototypeChat;
4122
4393
  exports.queryContent = queryContent;
4123
4394
  exports.queryKnowledgeBase = queryKnowledgeBase;
4124
4395
  exports.ragKnowledgeBase = ragKnowledgeBase;
@@ -4133,6 +4404,8 @@ exports.safeParseWSMessage = safeParseWSMessage;
4133
4404
  exports.searchContent = searchContent;
4134
4405
  exports.setDefaultDatabase = setDefaultDatabase;
4135
4406
  exports.setDefaultRepo = setDefaultRepo;
4407
+ exports.syncPrototypeChat = syncPrototypeChat;
4408
+ exports.syncPrototypeChatAsync = syncPrototypeChatAsync;
4136
4409
  exports.testDatabaseConnection = testDatabaseConnection;
4137
4410
  exports.toolCreateMission = toolCreateMission;
4138
4411
  exports.toolUpdateMission = toolUpdateMission;