@ocxp/client 0.2.4 → 0.2.6

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",
@@ -1129,6 +1187,29 @@ var deleteRepo = (options) => (options.client ?? client).delete({
1129
1187
  url: "/ocxp/repo/{repo_id}",
1130
1188
  ...options
1131
1189
  });
1190
+ var syncAllRepos = (options) => (options?.client ?? client).post({
1191
+ security: [{ scheme: "bearer", type: "http" }],
1192
+ url: "/ocxp/repo/sync-all",
1193
+ ...options,
1194
+ headers: {
1195
+ "Content-Type": "application/json",
1196
+ ...options?.headers
1197
+ }
1198
+ });
1199
+ var getRepoCommits = (options) => (options.client ?? client).get({
1200
+ security: [{ scheme: "bearer", type: "http" }],
1201
+ url: "/ocxp/repo/{repo_id}/commits",
1202
+ ...options
1203
+ });
1204
+ var syncRepo = (options) => (options.client ?? client).post({
1205
+ security: [{ scheme: "bearer", type: "http" }],
1206
+ url: "/ocxp/repo/{repo_id}/sync",
1207
+ ...options,
1208
+ headers: {
1209
+ "Content-Type": "application/json",
1210
+ ...options.headers
1211
+ }
1212
+ });
1132
1213
  var githubCheckAccess = (options) => (options.client ?? client).post({
1133
1214
  security: [{ scheme: "bearer", type: "http" }],
1134
1215
  url: "/ocxp/github/check-access",
@@ -1941,6 +2022,48 @@ var OCXPClient = class {
1941
2022
  });
1942
2023
  return extractData(response);
1943
2024
  }
2025
+ /**
2026
+ * Sync a repository with its remote GitHub branch
2027
+ * @param repoId - Repository ID (owner/repo format)
2028
+ * @param force - Force sync even if no changes detected
2029
+ */
2030
+ async syncRepo(repoId, force = false) {
2031
+ const headers = await this.getHeaders();
2032
+ const response = await syncRepo({
2033
+ client: this.client,
2034
+ path: { repo_id: repoId },
2035
+ body: { force },
2036
+ headers
2037
+ });
2038
+ return extractData(response);
2039
+ }
2040
+ /**
2041
+ * Sync all repositories with their remote GitHub branches
2042
+ * @param force - Force sync all repos even if no changes
2043
+ */
2044
+ async syncAllRepos(force = false) {
2045
+ const headers = await this.getHeaders();
2046
+ const response = await syncAllRepos({
2047
+ client: this.client,
2048
+ body: { force },
2049
+ headers
2050
+ });
2051
+ return extractData(response);
2052
+ }
2053
+ /**
2054
+ * Get commit status for a repository
2055
+ * Shows how many commits behind and lists missing commits
2056
+ * @param repoId - Repository ID (owner/repo format)
2057
+ */
2058
+ async getRepoCommitStatus(repoId) {
2059
+ const headers = await this.getHeaders();
2060
+ const response = await getRepoCommits({
2061
+ client: this.client,
2062
+ path: { repo_id: repoId },
2063
+ headers
2064
+ });
2065
+ return extractData(response);
2066
+ }
1944
2067
  // ============== Database Operations ==============
1945
2068
  /**
1946
2069
  * List all database configurations in workspace
@@ -2264,6 +2387,120 @@ var OCXPClient = class {
2264
2387
  headers
2265
2388
  });
2266
2389
  }
2390
+ // ============== Prototype Operations ==============
2391
+ /**
2392
+ * List all accessible prototype chats from a provider
2393
+ * @param provider - Filter by provider (v0, lovable, bolt)
2394
+ */
2395
+ async listPrototypeChats(provider) {
2396
+ const headers = await this.getHeaders();
2397
+ const response = await listPrototypeChats({
2398
+ client: this.client,
2399
+ query: { provider },
2400
+ headers
2401
+ });
2402
+ return extractData(response);
2403
+ }
2404
+ /**
2405
+ * Preview a prototype chat (fetch metadata without linking)
2406
+ * @param chatUrl - Chat URL to preview
2407
+ * @param provider - Prototype provider (optional, auto-detected from URL)
2408
+ */
2409
+ async previewPrototypeChat(chatUrl, provider) {
2410
+ const headers = await this.getHeaders();
2411
+ const response = await previewPrototypeChat({
2412
+ client: this.client,
2413
+ body: { chat_url: chatUrl, provider },
2414
+ headers
2415
+ });
2416
+ return extractData(response);
2417
+ }
2418
+ /**
2419
+ * Link a prototype chat to a mission
2420
+ * @param data - Link request data
2421
+ */
2422
+ async linkPrototypeChat(data) {
2423
+ const headers = await this.getHeaders();
2424
+ const response = await linkPrototypeChat({
2425
+ client: this.client,
2426
+ body: data,
2427
+ headers
2428
+ });
2429
+ return extractData(response);
2430
+ }
2431
+ /**
2432
+ * Sync/refresh a linked prototype chat
2433
+ * @param data - Sync request data
2434
+ */
2435
+ async syncPrototypeChat(data) {
2436
+ const headers = await this.getHeaders();
2437
+ const response = await syncPrototypeChat({
2438
+ client: this.client,
2439
+ body: data,
2440
+ headers
2441
+ });
2442
+ return extractData(response);
2443
+ }
2444
+ /**
2445
+ * Get stored prototype chat data
2446
+ * @param provider - Provider name (v0, lovable, bolt)
2447
+ * @param chatId - Chat ID
2448
+ * @param options - Optional query parameters
2449
+ */
2450
+ async getPrototypeChat(provider, chatId, options) {
2451
+ const headers = await this.getHeaders();
2452
+ const response = await getPrototypeChat({
2453
+ client: this.client,
2454
+ path: { provider, chat_id: chatId },
2455
+ query: { project_id: options?.projectId, version_id: options?.versionId },
2456
+ headers
2457
+ });
2458
+ return extractData(response);
2459
+ }
2460
+ /**
2461
+ * Start async prototype chat sync job
2462
+ * @param data - Async sync request data
2463
+ */
2464
+ async syncPrototypeChatAsync(data) {
2465
+ const headers = await this.getHeaders();
2466
+ const response = await syncPrototypeChatAsync({
2467
+ client: this.client,
2468
+ body: data,
2469
+ headers
2470
+ });
2471
+ return extractData(response);
2472
+ }
2473
+ /**
2474
+ * Get sync job status
2475
+ * @param jobId - Job ID from async sync response
2476
+ */
2477
+ async getPrototypeSyncStatus(jobId) {
2478
+ const headers = await this.getHeaders();
2479
+ const response = await getSyncStatus({
2480
+ client: this.client,
2481
+ path: { job_id: jobId },
2482
+ headers
2483
+ });
2484
+ return extractData(response);
2485
+ }
2486
+ /**
2487
+ * Get stored versions for a prototype chat (fast DynamoDB query)
2488
+ * Use this for UI button states instead of full sync
2489
+ * @param provider - Provider name (v0, lovable, bolt)
2490
+ * @param chatId - Chat ID
2491
+ * @param options - Optional settings
2492
+ * @param options.includeDetails - If true, returns full version metadata (files, pages, screenshots)
2493
+ */
2494
+ async getStoredVersions(provider, chatId, options) {
2495
+ const headers = await this.getHeaders();
2496
+ const response = await getStoredVersions({
2497
+ client: this.client,
2498
+ path: { provider, chat_id: chatId },
2499
+ query: options?.includeDetails ? { include_details: true } : void 0,
2500
+ headers
2501
+ });
2502
+ return extractData(response);
2503
+ }
2267
2504
  // ============== Auth Operations ==============
2268
2505
  /**
2269
2506
  * Get auth configuration (public endpoint)
@@ -2387,6 +2624,7 @@ var OCXPClient = class {
2387
2624
  _project;
2388
2625
  _session;
2389
2626
  _kb;
2627
+ _prototype;
2390
2628
  /**
2391
2629
  * Mission namespace for convenient mission operations
2392
2630
  * @example ocxp.mission.list({ status: 'pending' })
@@ -2427,6 +2665,16 @@ var OCXPClient = class {
2427
2665
  }
2428
2666
  return this._kb;
2429
2667
  }
2668
+ /**
2669
+ * Prototype namespace for convenient prototype chat operations
2670
+ * @example ocxp.prototype.list('v0')
2671
+ */
2672
+ get prototype() {
2673
+ if (!this._prototype) {
2674
+ this._prototype = new PrototypeNamespace(this);
2675
+ }
2676
+ return this._prototype;
2677
+ }
2430
2678
  };
2431
2679
  var MissionNamespace = class {
2432
2680
  constructor(client2) {
@@ -2647,6 +2895,69 @@ var KBNamespace = class {
2647
2895
  return this.client.kbRag(query, sessionId);
2648
2896
  }
2649
2897
  };
2898
+ var PrototypeNamespace = class {
2899
+ constructor(client2) {
2900
+ this.client = client2;
2901
+ }
2902
+ /**
2903
+ * List all accessible prototype chats
2904
+ * @example ocxp.prototype.list('v0')
2905
+ */
2906
+ async list(provider) {
2907
+ return this.client.listPrototypeChats(provider);
2908
+ }
2909
+ /**
2910
+ * Preview a prototype chat (fetch metadata without linking)
2911
+ * @example ocxp.prototype.preview('https://v0.dev/chat/abc123')
2912
+ */
2913
+ async preview(chatUrl, provider) {
2914
+ return this.client.previewPrototypeChat(chatUrl, provider);
2915
+ }
2916
+ /**
2917
+ * Link a prototype chat to a mission
2918
+ * @example ocxp.prototype.link({ mission_id: 'xyz', chat_url: 'https://v0.dev/chat/abc123' })
2919
+ */
2920
+ async link(data) {
2921
+ return this.client.linkPrototypeChat(data);
2922
+ }
2923
+ /**
2924
+ * Sync/refresh a linked prototype chat
2925
+ * @example ocxp.prototype.sync({ chat_id: 'abc123', mission_id: 'xyz' })
2926
+ */
2927
+ async sync(data) {
2928
+ return this.client.syncPrototypeChat(data);
2929
+ }
2930
+ /**
2931
+ * Get stored prototype chat data
2932
+ * @example ocxp.prototype.get('v0', 'abc123')
2933
+ */
2934
+ async get(provider, chatId, options) {
2935
+ return this.client.getPrototypeChat(provider, chatId, options);
2936
+ }
2937
+ /**
2938
+ * Start async prototype chat sync job
2939
+ * @example ocxp.prototype.syncAsync({ chat_id: 'abc123', mission_id: 'xyz', download_files: true })
2940
+ */
2941
+ async syncAsync(data) {
2942
+ return this.client.syncPrototypeChatAsync(data);
2943
+ }
2944
+ /**
2945
+ * Get sync job status
2946
+ * @example ocxp.prototype.getSyncStatus('job-id')
2947
+ */
2948
+ async getSyncStatus(jobId) {
2949
+ return this.client.getPrototypeSyncStatus(jobId);
2950
+ }
2951
+ /**
2952
+ * Get stored versions for a prototype chat (fast DynamoDB query)
2953
+ * Use this for UI button states instead of full sync
2954
+ * @param options.includeDetails - If true, returns full version metadata (files, pages, screenshots)
2955
+ * @example ocxp.prototype.getStoredVersions('v0', 'abc123', { includeDetails: true })
2956
+ */
2957
+ async getStoredVersions(provider, chatId, options) {
2958
+ return this.client.getStoredVersions(provider, chatId, options);
2959
+ }
2960
+ };
2650
2961
  function createOCXPClient(options) {
2651
2962
  return new OCXPClient(options);
2652
2963
  }
@@ -3066,6 +3377,18 @@ var WebSocketService = class {
3066
3377
  onSyncEvent(handler) {
3067
3378
  return this.on("sync_event", handler);
3068
3379
  }
3380
+ /**
3381
+ * Subscribe to prototype sync progress updates
3382
+ */
3383
+ onPrototypeSyncProgress(handler) {
3384
+ return this.on("prototype_sync_progress", handler);
3385
+ }
3386
+ /**
3387
+ * Subscribe to prototype sync complete notifications
3388
+ */
3389
+ onPrototypeSyncComplete(handler) {
3390
+ return this.on("prototype_sync_complete", handler);
3391
+ }
3069
3392
  /**
3070
3393
  * Subscribe to connection state changes
3071
3394
  */
@@ -3085,6 +3408,12 @@ var WebSocketService = class {
3085
3408
  subscribeToRepo(repoId) {
3086
3409
  this.send({ action: "subscribe", type: "repo", id: repoId });
3087
3410
  }
3411
+ /**
3412
+ * Subscribe to prototype sync job updates
3413
+ */
3414
+ subscribeToPrototypeSync(jobId) {
3415
+ this.send({ action: "subscribe", topic: `prototype_sync:${jobId}` });
3416
+ }
3088
3417
  /**
3089
3418
  * Send message to server
3090
3419
  */
@@ -3996,6 +4325,7 @@ exports.ProjectMissionSchema = ProjectMissionSchema;
3996
4325
  exports.ProjectNamespace = ProjectNamespace;
3997
4326
  exports.ProjectRepoSchema = ProjectRepoSchema;
3998
4327
  exports.ProjectSchema = ProjectSchema;
4328
+ exports.PrototypeNamespace = PrototypeNamespace;
3999
4329
  exports.QueryDataSchema = QueryDataSchema;
4000
4330
  exports.QueryFilterSchema = QueryFilterSchema;
4001
4331
  exports.QueryResponseSchema = QueryResponseSchema;
@@ -4085,10 +4415,14 @@ exports.getMemoForSource = getMemoForSource;
4085
4415
  exports.getMissionContext = getMissionContext;
4086
4416
  exports.getProject = getProject;
4087
4417
  exports.getProjectDatabases = getProjectDatabases;
4418
+ exports.getPrototypeChat = getPrototypeChat;
4419
+ exports.getRepoCommits = getRepoCommits;
4088
4420
  exports.getRepoDownloadStatus = getRepoDownloadStatus;
4089
4421
  exports.getSample = getSample;
4090
4422
  exports.getSchema = getSchema;
4091
4423
  exports.getSessionMessages = getSessionMessages;
4424
+ exports.getStoredVersions = getStoredVersions;
4425
+ exports.getSyncStatus = getSyncStatus;
4092
4426
  exports.githubCheckAccess = githubCheckAccess;
4093
4427
  exports.githubGetContents = githubGetContents;
4094
4428
  exports.githubListBranches = githubListBranches;
@@ -4102,12 +4436,14 @@ exports.isOCXPRateLimitError = isOCXPRateLimitError;
4102
4436
  exports.isOCXPTimeoutError = isOCXPTimeoutError;
4103
4437
  exports.isOCXPValidationError = isOCXPValidationError;
4104
4438
  exports.isValidContentType = isValidContentType;
4439
+ exports.linkPrototypeChat = linkPrototypeChat;
4105
4440
  exports.listContent = listContent;
4106
4441
  exports.listContextDatabases = listContextDatabases;
4107
4442
  exports.listDatabases = listDatabases;
4108
4443
  exports.listDownloadedRepos = listDownloadedRepos;
4109
4444
  exports.listMemos = listMemos;
4110
4445
  exports.listProjects = listProjects;
4446
+ exports.listPrototypeChats = listPrototypeChats;
4111
4447
  exports.listSessions = listSessions;
4112
4448
  exports.listTables = listTables;
4113
4449
  exports.listWorkspaces = listWorkspaces;
@@ -4119,6 +4455,7 @@ exports.moveContent = moveContent;
4119
4455
  exports.normalizePath = normalizePath;
4120
4456
  exports.parsePath = parsePath;
4121
4457
  exports.parseWSMessage = parseWSMessage;
4458
+ exports.previewPrototypeChat = previewPrototypeChat;
4122
4459
  exports.queryContent = queryContent;
4123
4460
  exports.queryKnowledgeBase = queryKnowledgeBase;
4124
4461
  exports.ragKnowledgeBase = ragKnowledgeBase;
@@ -4133,6 +4470,10 @@ exports.safeParseWSMessage = safeParseWSMessage;
4133
4470
  exports.searchContent = searchContent;
4134
4471
  exports.setDefaultDatabase = setDefaultDatabase;
4135
4472
  exports.setDefaultRepo = setDefaultRepo;
4473
+ exports.syncAllRepos = syncAllRepos;
4474
+ exports.syncPrototypeChat = syncPrototypeChat;
4475
+ exports.syncPrototypeChatAsync = syncPrototypeChatAsync;
4476
+ exports.syncRepo = syncRepo;
4136
4477
  exports.testDatabaseConnection = testDatabaseConnection;
4137
4478
  exports.toolCreateMission = toolCreateMission;
4138
4479
  exports.toolUpdateMission = toolUpdateMission;