@bpmsoftwaresolutions/ai-engine-client 1.1.90 → 1.1.92

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmsoftwaresolutions/ai-engine-client",
3
- "version": "1.1.90",
3
+ "version": "1.1.92",
4
4
  "description": "Thin npm client for the AI Engine operator and retrieval APIs",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/client.js CHANGED
@@ -2691,142 +2691,6 @@ export class AIEngineClient {
2691
2691
  });
2692
2692
  }
2693
2693
 
2694
- async getPortfolioClosureReadiness({
2695
- projectLimit = 25,
2696
- includeInactive = false,
2697
- includeLogaPortfolioProjection = false,
2698
- includeLogaRoadmapProjections = false,
2699
- } = {}) {
2700
- const portfolioBundle = await this._request('/api/operator/portfolio/bundle');
2701
- const projectListPayload = await this.projects.listProjects({ limit: projectLimit, includeInactive });
2702
-
2703
- const bundleProjects = Array.isArray(portfolioBundle?.projects)
2704
- ? portfolioBundle.projects.filter((project) => isPlainObject(project))
2705
- : [];
2706
- const listedProjects = Array.isArray(projectListPayload?.projects)
2707
- ? projectListPayload.projects.filter((project) => isPlainObject(project))
2708
- : Array.isArray(projectListPayload)
2709
- ? projectListPayload.filter((project) => isPlainObject(project))
2710
- : [];
2711
- const activeProjects = listedProjects.length > 0 ? listedProjects : bundleProjects;
2712
- const logaPortfolioProjection = includeLogaPortfolioProjection
2713
- ? await this.getLogaProjectPortfolioProjection()
2714
- : null;
2715
- const logaRoadmapProjections = {};
2716
-
2717
- const projectReadiness = [];
2718
- for (const project of activeProjects) {
2719
- const projectId = cleanText(project.project_id) || cleanText(project.projectId);
2720
- if (!projectId) {
2721
- continue;
2722
- }
2723
-
2724
- const roadmapSummaryPayload = await this.getProjectRoadmapSummary(projectId);
2725
- const roadmapSummary = isPlainObject(roadmapSummaryPayload?.summary) ? roadmapSummaryPayload.summary : {};
2726
- const activeItemPayload = await this.getProjectRoadmapActiveItem(projectId);
2727
- const activeItem = isPlainObject(activeItemPayload?.active_item)
2728
- ? activeItemPayload.active_item
2729
- : isPlainObject(activeItemPayload)
2730
- ? activeItemPayload
2731
- : {};
2732
- const openTasksPayload = await this.listProjectOpenTasks(projectId);
2733
- const openTasks = Array.isArray(openTasksPayload?.tasks)
2734
- ? openTasksPayload.tasks.filter((task) => isPlainObject(task))
2735
- : Array.isArray(openTasksPayload)
2736
- ? openTasksPayload.filter((task) => isPlainObject(task))
2737
- : [];
2738
-
2739
- const activeItemStatus = cleanText(activeItem.item_status) || cleanText(activeItem.status);
2740
- const completionPercentage = Number(
2741
- roadmapSummary.completion_percentage
2742
- ?? roadmapSummary.completion_pct
2743
- ?? roadmapSummary.progress_percentage
2744
- ?? 0,
2745
- );
2746
- const totalItems = Number(
2747
- roadmapSummary.total_items
2748
- ?? roadmapSummary.item_count
2749
- ?? roadmapSummary.total_count
2750
- ?? 0,
2751
- );
2752
- const openItems = Number(
2753
- roadmapSummary.open_items
2754
- ?? roadmapSummary.open_item_count
2755
- ?? roadmapSummary.remaining_items
2756
- ?? openTasks.length,
2757
- );
2758
- const terminalStatuses = new Set(['accepted', 'verified', 'done', 'completed', 'closed']);
2759
- const activeItemReady = !activeItemStatus || terminalStatuses.has(activeItemStatus.toLowerCase());
2760
- const projectReady = openItems === 0 && openTasks.length === 0 && activeItemReady && completionPercentage >= 100;
2761
- const blockingReason = projectReady
2762
- ? null
2763
- : [
2764
- openTasks.length > 0 ? `${openTasks.length} open task(s) remain` : null,
2765
- openItems > 0 ? `${openItems} roadmap item(s) remain open` : null,
2766
- !activeItemReady ? `active item status is ${activeItemStatus || 'missing'}` : null,
2767
- completionPercentage < 100 ? `completion is ${completionPercentage.toFixed(1)}%` : null,
2768
- ].filter(Boolean).join('; ') || 'portfolio closure readiness is not satisfied';
2769
-
2770
- const roadmapCompletion = {
2771
- completion_percentage: completionPercentage,
2772
- total_items: totalItems,
2773
- open_items: openItems,
2774
- completed_items: Math.max(totalItems - openItems, 0),
2775
- };
2776
- const projectReadinessEntry = {
2777
- project: {
2778
- project_id: projectId,
2779
- project_name: cleanText(project.project_name) || cleanText(project.projectName) || null,
2780
- project_slug: cleanText(project.project_slug) || cleanText(project.projectSlug) || null,
2781
- process_status: cleanText(project.process_status) || cleanText(project.processStatus) || null,
2782
- charter_status: cleanText(project.charter_status) || cleanText(project.charterStatus) || null,
2783
- },
2784
- roadmap_completion: roadmapCompletion,
2785
- active_item: activeItem,
2786
- open_task_count: openTasks.length,
2787
- closure_ready: projectReady,
2788
- blocking_reason: blockingReason,
2789
- };
2790
- if (includeLogaRoadmapProjections) {
2791
- projectReadinessEntry.loga_roadmap_projection = await this.getLogaProjectRoadmapProjection(projectId);
2792
- logaRoadmapProjections[projectId] = projectReadinessEntry.loga_roadmap_projection;
2793
- }
2794
- projectReadiness.push(projectReadinessEntry);
2795
- }
2796
-
2797
- const closureReady = projectReadiness.length === 0 || projectReadiness.every((project) => project.closure_ready === true);
2798
- const blockingProject = projectReadiness.find((project) => project.closure_ready !== true);
2799
-
2800
- return {
2801
- portfolio_summary: isPlainObject(portfolioBundle?.summary) ? portfolioBundle.summary : {},
2802
- portfolio_bundle: portfolioBundle,
2803
- active_projects: projectReadiness,
2804
- closure_readiness: closureReady,
2805
- blocking_reason: closureReady ? null : `${cleanText(blockingProject?.project?.project_name) || cleanText(blockingProject?.project?.project_id) || 'project'}: ${blockingProject?.blocking_reason || 'closure readiness is not satisfied'}`,
2806
- blocking_project_id: closureReady ? null : cleanText(blockingProject?.project?.project_id),
2807
- blocking_project_name: closureReady ? null : cleanText(blockingProject?.project?.project_name),
2808
- project_count: projectReadiness.length,
2809
- open_task_count: projectReadiness.reduce((total, project) => total + Number(project.open_task_count || 0), 0),
2810
- loga_portfolio_projection: logaPortfolioProjection,
2811
- loga_roadmap_projections: includeLogaRoadmapProjections ? logaRoadmapProjections : null,
2812
- };
2813
- }
2814
-
2815
- async getPortfolioStatus({
2816
- projectId,
2817
- project_id,
2818
- } = {}) {
2819
- return this._request('/api/operator/portfolio/status', {
2820
- query: {
2821
- project_id: cleanText(project_id) || cleanText(projectId),
2822
- },
2823
- });
2824
- }
2825
-
2826
- async getPortfolioBundle() {
2827
- return this._request('/api/operator/portfolio/bundle');
2828
- }
2829
-
2830
2694
  async getExternalProjectStatus(projectId) {
2831
2695
  return this._request(`/api/v1/projects/${projectId}/status`);
2832
2696
  }
@@ -2912,7 +2776,6 @@ export class AIEngineClient {
2912
2776
  export function createAIEngineClient(options) {
2913
2777
  return new AIEngineClient(options);
2914
2778
  }
2915
-
2916
2779
  function defineCompatibilityMethods(proto, targetName, methodNames) {
2917
2780
  for (const methodName of methodNames) {
2918
2781
  if (Object.prototype.hasOwnProperty.call(proto, methodName)) continue;
@@ -3001,6 +2864,6 @@ function installClientCompatibilityDelegates(ClientClass) {
3001
2864
  defineCompatibilityMethods(proto, 'commitGovernance', ['evaluateCommitGovernance', 'checkGitShipReadiness', 'getCommitGovernanceEvaluation', 'listCommitGovernanceEvaluationsByClaim']);
3002
2865
  defineCompatibilityMethods(proto, 'contextSessions', ['openContextSession', 'getOrientationWindow', 'acknowledgeReminder', 'completeOrientation', 'lockContextSessionClaim', 'getContextSessionGateStatus']);
3003
2866
  defineCompatibilityMethods(proto, 'contextOrientation', ['conductOrientation']);
2867
+ defineCompatibilityMethods(proto, 'portfolio', ['getPortfolioStatus', 'getPortfolioBundle', 'getPortfolioClosureReadiness']);
3004
2868
  }
3005
-
3006
2869
  installClientCompatibilityDelegates(AIEngineClient);
@@ -2,12 +2,16 @@ import { cleanText, isPlainObject } from '../utils/text.js';
2
2
 
3
3
  export function createPortfolioDomain(client) {
4
4
  return {
5
- getPortfolioStatus: (request) => client.getPortfolioStatus(request),
5
+ getPortfolioStatus: ({ projectId, project_id } = {}) => client._request('/api/operator/portfolio/status', {
6
+ query: {
7
+ project_id: cleanText(project_id) || cleanText(projectId),
8
+ },
9
+ }),
6
10
  getPortfolioSummary: () => client.getPortfolioSummary(),
7
11
  getPortfolioExceptions: () => client.getPortfolioExceptions(),
8
12
  getPortfolioProject: (projectId) => client.getPortfolioProject(projectId),
9
13
  getPortfolioReport: () => client.getPortfolioReport(),
10
- getPortfolioBundle: () => client.getPortfolioBundle(),
14
+ getPortfolioBundle: () => client._request('/api/operator/portfolio/bundle'),
11
15
  getPortfolioClosureReadiness: async ({
12
16
  projectLimit = 25,
13
17
  includeInactive = false,
@@ -7,5 +7,7 @@ export function createWarehouseDomain(client) {
7
7
  requestModernizationWrapperExecution: (request) => client.requestModernizationWrapperExecution(request),
8
8
  getModernizationWrapperEvidence: (request) => client.getModernizationWrapperEvidence(request),
9
9
  decideModernizationGate: (request) => client.decideModernizationGate(request),
10
+ getPortfolioStatus: (request) => client.getPortfolioStatus(request),
11
+ getPortfolioBundle: () => client.getPortfolioBundle(),
10
12
  };
11
13
  }
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AIEngineClient, createAIEngineClient } from './client.js';
2
- export const AI_ENGINE_CLIENT_VERSION = '1.1.90';
2
+ export const AI_ENGINE_CLIENT_VERSION = '1.1.92';
3
3
  export { GOVERNED_MUTATION_REQUIRED_CAPABILITIES, AI_ENGINE_CLIENT_CAPABILITIES, TASK_BOUND_SUBSTRATE_EXECUTION_POLICY } from './constants/governance.js';
4
4
  export { LOGA_CONTRACT, LOGA_INTERACTION_CONTRACT, LOGA_NAVIGATION_CONTRACT, LOGA_PROJECTION_WORKFLOW } from './constants/loga.js';
5
5
  export {