@ocxp/client 0.2.8 → 0.2.9

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
@@ -813,7 +813,11 @@ var createClient = (config = {}) => {
813
813
  };
814
814
 
815
815
  // src/generated/client.gen.ts
816
- var client = createClient(createConfig());
816
+ var client = createClient(
817
+ createConfig({
818
+ baseUrl: "https://ix8b43sg3j.execute-api.us-west-2.amazonaws.com"
819
+ })
820
+ );
817
821
 
818
822
  // src/generated/sdk.gen.ts
819
823
  var bulkReadContent = (options) => (options.client ?? client).post({
@@ -981,6 +985,13 @@ var removeLinkedRepo = (options) => (options.client ?? client).delete({
981
985
  url: "/ocxp/project/{project_id}/repos/{repo_id}",
982
986
  ...options
983
987
  });
988
+ var cleanupDeadRepos = (options) => (options?.client ?? client).post(
989
+ {
990
+ security: [{ scheme: "bearer", type: "http" }],
991
+ url: "/ocxp/project/cleanup-dead-repos",
992
+ ...options
993
+ }
994
+ );
984
995
  var setDefaultRepo = (options) => (options.client ?? client).put({
985
996
  security: [{ scheme: "bearer", type: "http" }],
986
997
  url: "/ocxp/project/{project_id}/default-repo",
@@ -1126,6 +1137,20 @@ var regenerateMission = (options) => (options.client ?? client).post({
1126
1137
  ...options.headers
1127
1138
  }
1128
1139
  });
1140
+ var getKbStatus = (options) => (options?.client ?? client).get({
1141
+ security: [{ scheme: "bearer", type: "http" }],
1142
+ url: "/ocxp/kb/status",
1143
+ ...options
1144
+ });
1145
+ var triggerKbSync = (options) => (options.client ?? client).post({
1146
+ security: [{ scheme: "bearer", type: "http" }],
1147
+ url: "/ocxp/kb/sync",
1148
+ ...options,
1149
+ headers: {
1150
+ "Content-Type": "application/json",
1151
+ ...options.headers
1152
+ }
1153
+ });
1129
1154
  var queryKnowledgeBase = (options) => (options.client ?? client).post({
1130
1155
  security: [{ scheme: "bearer", type: "http" }],
1131
1156
  url: "/ocxp/kb/query",
@@ -1395,6 +1420,11 @@ var listContextDatabases = (options) => (options?.client ?? client).get({
1395
1420
  url: "/ocxp/context/database/databases",
1396
1421
  ...options
1397
1422
  });
1423
+ var getDatabaseDiagram = (options) => (options?.client ?? client).get({
1424
+ security: [{ scheme: "bearer", type: "http" }],
1425
+ url: "/ocxp/context/database/diagram",
1426
+ ...options
1427
+ });
1398
1428
  var getContentTypes = (options) => (options?.client ?? client).get({
1399
1429
  security: [{ scheme: "bearer", type: "http" }],
1400
1430
  url: "/ocxp/context/types",
@@ -1825,6 +1855,33 @@ var OCXPClient = class {
1825
1855
  });
1826
1856
  return extractData(response);
1827
1857
  }
1858
+ // ============== KB Status Operations ==============
1859
+ /**
1860
+ * Get status of all Knowledge Bases (code, docs, visual)
1861
+ */
1862
+ async kbStatus() {
1863
+ const headers = await this.getHeaders();
1864
+ const response = await getKbStatus({
1865
+ client: this.client,
1866
+ headers
1867
+ });
1868
+ return extractData(response);
1869
+ }
1870
+ /**
1871
+ * Trigger KB re-indexing
1872
+ */
1873
+ async kbSync(options) {
1874
+ const headers = await this.getHeaders();
1875
+ const response = await triggerKbSync({
1876
+ client: this.client,
1877
+ body: {
1878
+ kb_type: options?.kbType ?? null,
1879
+ force: options?.force ?? false
1880
+ },
1881
+ headers
1882
+ });
1883
+ return extractData(response);
1884
+ }
1828
1885
  // ============== Mission Operations ==============
1829
1886
  /**
1830
1887
  * List all missions in workspace with pagination support
@@ -2269,6 +2326,23 @@ var OCXPClient = class {
2269
2326
  });
2270
2327
  return extractData(response);
2271
2328
  }
2329
+ /**
2330
+ * Get database ER diagram in Mermaid syntax
2331
+ */
2332
+ async getDatabaseDiagram(databaseId, tables, includeMockData, mockRows) {
2333
+ const headers = await this.getHeaders();
2334
+ const response = await getDatabaseDiagram({
2335
+ client: this.client,
2336
+ query: {
2337
+ database_id: databaseId,
2338
+ tables,
2339
+ include_mock_data: includeMockData,
2340
+ mock_rows: mockRows
2341
+ },
2342
+ headers
2343
+ });
2344
+ return extractData(response);
2345
+ }
2272
2346
  /**
2273
2347
  * List all tables in database
2274
2348
  */
@@ -2356,7 +2430,8 @@ var OCXPClient = class {
2356
2430
  category: options?.category,
2357
2431
  priority: options?.priority,
2358
2432
  auto_include: options?.autoInclude,
2359
- branch: options?.branch
2433
+ branch: options?.branch,
2434
+ prompt: options?.prompt
2360
2435
  };
2361
2436
  const response = await addLinkedRepo({
2362
2437
  client: this.client,
@@ -2378,6 +2453,72 @@ var OCXPClient = class {
2378
2453
  });
2379
2454
  return extractData(response);
2380
2455
  }
2456
+ /**
2457
+ * Link a database to a project
2458
+ */
2459
+ async addProjectDatabase(projectId, databaseId, options) {
2460
+ const headers = await this.getHeaders();
2461
+ const response = await addDatabase({
2462
+ client: this.client,
2463
+ path: { project_id: projectId },
2464
+ headers,
2465
+ body: {
2466
+ database_id: databaseId,
2467
+ priority: options?.priority ?? 50,
2468
+ auto_include: options?.autoInclude ?? true,
2469
+ prompt: options?.prompt
2470
+ }
2471
+ });
2472
+ return extractData(response);
2473
+ }
2474
+ /**
2475
+ * Remove a database from a project
2476
+ */
2477
+ async removeProjectDatabase(projectId, databaseId) {
2478
+ const headers = await this.getHeaders();
2479
+ const response = await removeDatabase({
2480
+ client: this.client,
2481
+ path: { project_id: projectId, database_id: databaseId },
2482
+ headers
2483
+ });
2484
+ return extractData(response);
2485
+ }
2486
+ /**
2487
+ * Set the default database for a project
2488
+ */
2489
+ async setProjectDefaultDatabase(projectId, databaseId) {
2490
+ const headers = await this.getHeaders();
2491
+ const response = await setDefaultDatabase({
2492
+ client: this.client,
2493
+ path: { project_id: projectId },
2494
+ headers,
2495
+ body: { database_id: databaseId }
2496
+ });
2497
+ return extractData(response);
2498
+ }
2499
+ /**
2500
+ * Get all databases linked to a project
2501
+ */
2502
+ async getProjectDatabases(projectId) {
2503
+ const headers = await this.getHeaders();
2504
+ const response = await getProjectDatabases({
2505
+ client: this.client,
2506
+ path: { project_id: projectId },
2507
+ headers
2508
+ });
2509
+ return extractData(response);
2510
+ }
2511
+ /**
2512
+ * Scan all projects and remove links to repos that no longer exist in the index
2513
+ */
2514
+ async cleanupDeadRepos() {
2515
+ const headers = await this.getHeaders();
2516
+ const response = await cleanupDeadRepos({
2517
+ client: this.client,
2518
+ headers
2519
+ });
2520
+ return extractData(response);
2521
+ }
2381
2522
  /**
2382
2523
  * Set default repository for project
2383
2524
  */
@@ -2836,12 +2977,16 @@ var OCXPClient = class {
2836
2977
  throw new Error(`Failed to delete credentials: ${JSON.stringify(response.error)}`);
2837
2978
  }
2838
2979
  }
2839
- // ============== Document Generation ==============
2980
+ // ============== Document Generation (Workflow-based) ==============
2840
2981
  /**
2841
- * Generate mission output (documents, reports, etc.)
2982
+ * Generate mission output by creating a workflow with doc tasks.
2983
+ * Returns the workflow_id so the client can open WorkflowDetailView
2984
+ * for real-time progress tracking.
2985
+ *
2842
2986
  * @param missionId - Mission UUID
2843
2987
  * @param outputType - Type of output: 'documents', 'report', 'summary', etc.
2844
2988
  * @param options - Output options (doc_types, strategy, etc.)
2989
+ * @returns OutputGenerationResponse with workflow_id for tracking
2845
2990
  */
2846
2991
  async generateMissionOutput(missionId, outputType, options) {
2847
2992
  const headers = await this.getHeaders();
@@ -2853,8 +2998,7 @@ var OCXPClient = class {
2853
2998
  output_type: outputType,
2854
2999
  doc_types: options?.doc_types,
2855
3000
  strategy: options?.strategy || "generate_all",
2856
- session_id: options?.session_id,
2857
- options: options?.options
3001
+ session_id: options?.session_id
2858
3002
  }
2859
3003
  });
2860
3004
  if (response.error) {
@@ -2862,23 +3006,6 @@ var OCXPClient = class {
2862
3006
  }
2863
3007
  return response.data;
2864
3008
  }
2865
- /**
2866
- * Get output generation status
2867
- * @param missionId - Mission UUID
2868
- * @param outputType - Type of output to check (default: 'documents')
2869
- */
2870
- async getMissionOutputStatus(missionId, outputType = "documents") {
2871
- const headers = await this.getHeaders();
2872
- const response = await this.client.request({
2873
- method: "GET",
2874
- url: `/ocxp/mission/${missionId}/output/status?output_type=${outputType}`,
2875
- headers
2876
- });
2877
- if (response.error) {
2878
- throw new Error(`Failed to get output status: ${JSON.stringify(response.error)}`);
2879
- }
2880
- return response.data;
2881
- }
2882
3009
  // ============== Namespaced Accessors ==============
2883
3010
  _mission;
2884
3011
  _project;
@@ -3063,37 +3190,23 @@ var MissionNamespace = class {
3063
3190
  return this.client.tree("mission", path, depth, includeVersions);
3064
3191
  }
3065
3192
  /**
3066
- * Generate mission output (documents, reports, etc.)
3067
- * General endpoint for all output types using existing research.
3193
+ * Generate mission output by creating a workflow.
3194
+ * Returns workflow_id for tracking via WorkflowDetailView.
3068
3195
  *
3069
3196
  * @param missionId - Mission UUID
3070
3197
  * @param outputType - Type of output: 'documents', 'report', 'summary', etc.
3071
3198
  * @param options - Output options (doc_types, strategy, etc.)
3072
- * @returns Output response with session_id for tracking
3199
+ * @returns OutputGenerationResponse with workflow_id
3073
3200
  *
3074
3201
  * @example
3075
- * await ocxp.mission.generateOutput('mission-id', 'documents', {
3202
+ * const result = await ocxp.mission.generateOutput('mission-id', 'documents', {
3076
3203
  * doc_types: ['implementation-guide', 'prd'],
3077
- * strategy: 'generate_all'
3078
- * })
3204
+ * });
3205
+ * // Open WorkflowDetailView with result.workflow_id
3079
3206
  */
3080
3207
  async generateOutput(missionId, outputType, options) {
3081
3208
  return this.client.generateMissionOutput(missionId, outputType, options);
3082
3209
  }
3083
- /**
3084
- * Get output generation status
3085
- * Check progress and status of output generation.
3086
- *
3087
- * @param missionId - Mission UUID
3088
- * @param outputType - Type of output to check (default: 'documents')
3089
- * @returns Current output status with progress
3090
- *
3091
- * @example
3092
- * const status = await ocxp.mission.getOutputStatus('mission-id', 'documents')
3093
- */
3094
- async getOutputStatus(missionId, outputType = "documents") {
3095
- return this.client.getMissionOutputStatus(missionId, outputType);
3096
- }
3097
3210
  };
3098
3211
  var ProjectNamespace = class {
3099
3212
  constructor(client2) {
@@ -3144,6 +3257,12 @@ var ProjectNamespace = class {
3144
3257
  async removeRepo(projectId, repoId) {
3145
3258
  return this.client.removeProjectRepo(projectId, repoId);
3146
3259
  }
3260
+ /**
3261
+ * Remove dead repo links from all projects in the workspace
3262
+ */
3263
+ async cleanupDeadRepos() {
3264
+ return this.client.cleanupDeadRepos();
3265
+ }
3147
3266
  /**
3148
3267
  * Set the default repository for a project
3149
3268
  */
@@ -3168,6 +3287,30 @@ var ProjectNamespace = class {
3168
3287
  async removeMission(projectId, missionId) {
3169
3288
  return this.client.removeProjectMission(projectId, missionId);
3170
3289
  }
3290
+ /**
3291
+ * Link a database to a project
3292
+ */
3293
+ async addDatabase(projectId, databaseId, options) {
3294
+ return this.client.addProjectDatabase(projectId, databaseId, options);
3295
+ }
3296
+ /**
3297
+ * Remove a database from a project
3298
+ */
3299
+ async removeDatabase(projectId, databaseId) {
3300
+ return this.client.removeProjectDatabase(projectId, databaseId);
3301
+ }
3302
+ /**
3303
+ * Set the default database for a project
3304
+ */
3305
+ async setDefaultDatabase(projectId, databaseId) {
3306
+ return this.client.setProjectDefaultDatabase(projectId, databaseId);
3307
+ }
3308
+ /**
3309
+ * Get all databases linked to a project
3310
+ */
3311
+ async getProjectDatabases(projectId) {
3312
+ return this.client.getProjectDatabases(projectId);
3313
+ }
3171
3314
  /**
3172
3315
  * Get project content tree structure from S3
3173
3316
  * @param includeVersions - If true, includes S3 version IDs for files
@@ -3234,6 +3377,20 @@ var KBNamespace = class {
3234
3377
  async rag(query, sessionId) {
3235
3378
  return this.client.kbRag(query, sessionId);
3236
3379
  }
3380
+ /**
3381
+ * Get status of all Knowledge Bases (code, docs, visual)
3382
+ * @example ocxp.kb.status()
3383
+ */
3384
+ async status() {
3385
+ return this.client.kbStatus();
3386
+ }
3387
+ /**
3388
+ * Trigger KB re-indexing
3389
+ * @example ocxp.kb.sync({ kbType: 'code' })
3390
+ */
3391
+ async sync(options) {
3392
+ return this.client.kbSync(options);
3393
+ }
3237
3394
  };
3238
3395
  var PrototypeNamespace = class {
3239
3396
  constructor(client2) {
@@ -3729,6 +3886,12 @@ var WebSocketService = class {
3729
3886
  onPrototypeSyncComplete(handler) {
3730
3887
  return this.on("prototype_sync_complete", handler);
3731
3888
  }
3889
+ /**
3890
+ * Subscribe to KB indexing status updates
3891
+ */
3892
+ onKBIndexingStatus(handler) {
3893
+ return this.on("kb_indexing_status", handler);
3894
+ }
3732
3895
  /**
3733
3896
  * Subscribe to connection state changes
3734
3897
  */
@@ -4781,6 +4944,7 @@ exports.getContentTypes = getContentTypes;
4781
4944
  exports.getContextRepos = getContextRepos;
4782
4945
  exports.getCurrentUser = getCurrentUser;
4783
4946
  exports.getDatabase = getDatabase;
4947
+ exports.getKbStatus = getKbStatus;
4784
4948
  exports.getMemo = getMemo;
4785
4949
  exports.getMemoForSource = getMemoForSource;
4786
4950
  exports.getMissionContext = getMissionContext;
@@ -4853,6 +5017,7 @@ exports.syncRepo = syncRepo;
4853
5017
  exports.testDatabaseConnection = testDatabaseConnection;
4854
5018
  exports.toolCreateMission = toolCreateMission;
4855
5019
  exports.toolUpdateMission = toolUpdateMission;
5020
+ exports.triggerKbSync = triggerKbSync;
4856
5021
  exports.unlockContent = unlockContent;
4857
5022
  exports.updateDatabase = updateDatabase;
4858
5023
  exports.updateProject = updateProject;