@bpmsoftwaresolutions/ai-engine-client 1.1.86 → 1.1.87

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.86",
3
+ "version": "1.1.87",
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
@@ -47,6 +47,7 @@ import { createTransferBundlesDomain } from './domains/transfer-bundles.js';
47
47
  import { createTransferChannelsDomain } from './domains/transfer-channels.js';
48
48
  import { createToolRegistryDomain } from './domains/tool-registry.js';
49
49
  import { createWorkflowCompositionDomain } from './domains/workflow-composition.js';
50
+ import { createWorkflowsDomain } from './domains/workflows.js';
50
51
  import { createWarehouseDomain } from './domains/warehouse.js';
51
52
  import { buildHeaders, requestBinary, requestJson, requestLogaProjection, requestText, resolveAccessToken } from './transport/index.js';
52
53
  import { normalizeEnum, trimTrailingSlash } from './utils/text.js';
@@ -404,6 +405,7 @@ export class AIEngineClient {
404
405
  this.retrievalWrapper = createRetrievalWrapperDomain(this);
405
406
  this.repo = createRepoDomain(this);
406
407
  this.retrievalManagement = createRetrievalManagementDomain(this);
408
+ this.workflows = createWorkflowsDomain(this);
407
409
  this.capabilities = createCapabilitiesDomain(this);
408
410
  this.benchmarks = createBenchmarksDomain(this);
409
411
  this.selfLearning = createSelfLearningDomain(this);
@@ -561,18 +563,7 @@ export class AIEngineClient {
561
563
  }
562
564
 
563
565
  async runReportDefinition({ reportKey, definition = {}, requestedBy } = {}) {
564
- const normalizedReportKey = cleanText(reportKey);
565
- if (!normalizedReportKey) {
566
- throw new Error('reportKey is required.');
567
- }
568
- return this._request('/api/gateway/reports/run', {
569
- method: 'POST',
570
- body: {
571
- report_key: normalizedReportKey,
572
- definition: isPlainObject(definition) ? definition : {},
573
- requested_by: cleanText(requestedBy),
574
- },
575
- });
566
+ return this.reports.run({ reportKey, definition, requestedBy });
576
567
  }
577
568
 
578
569
  async renderProjection({ projectionType, viewContract = {}, requestedBy } = {}) {
@@ -3706,315 +3697,243 @@ export class AIEngineClient {
3706
3697
  // ─── Retrieval Wrapper ─────────────────────────────────────────────────────
3707
3698
 
3708
3699
  async getCommandCard({ commandKey, alias, intentText, requestedBy } = {}) {
3709
- return this._request('/api/operator/retrieval/wrapper/command-card', {
3710
- query: { command_key: commandKey, alias, intent_text: intentText, requested_by: requestedBy },
3711
- });
3700
+ return this.retrievalWrapper.getCommandCard({ commandKey, alias, intentText, requestedBy });
3712
3701
  }
3713
3702
 
3714
3703
  async resolveOperatingProcedure({ procedureKey, intentText, requestedBy } = {}) {
3715
- return this._request('/api/operator/retrieval/wrapper/operating-procedure', {
3716
- query: { procedure_key: procedureKey, intent_text: intentText, requested_by: requestedBy },
3717
- });
3704
+ return this.retrievalWrapper.resolveOperatingProcedure({ procedureKey, intentText, requestedBy });
3718
3705
  }
3719
3706
 
3720
3707
  async getSymbolDefinition({ symbolKey, qualifiedName, symbolName, projectScope, includeCode = true, maxLines = 120, requestedBy } = {}) {
3721
- return this._request('/api/operator/retrieval/wrapper/symbol-definition', {
3722
- query: {
3723
- symbol_key: symbolKey,
3724
- qualified_name: qualifiedName,
3725
- symbol_name: symbolName,
3726
- project_scope: projectScope,
3727
- include_code: includeCode,
3728
- max_lines: maxLines,
3729
- requested_by: requestedBy,
3730
- },
3731
- });
3708
+ return this.retrievalWrapper.getSymbolDefinition({ symbolKey, qualifiedName, symbolName, projectScope, includeCode, maxLines, requestedBy });
3732
3709
  }
3733
3710
 
3734
3711
  async getRelatedCode({ symbolKey, qualifiedName, relationshipType, depth = 1, includeCode = false, maxLines = 80, requestedBy } = {}) {
3735
- return this._request('/api/operator/retrieval/wrapper/related-code', {
3736
- query: {
3737
- symbol_key: symbolKey,
3738
- qualified_name: qualifiedName,
3739
- relationship_type: relationshipType,
3740
- depth,
3741
- include_code: includeCode,
3742
- max_lines: maxLines,
3743
- requested_by: requestedBy,
3744
- },
3745
- });
3712
+ return this.retrievalWrapper.getRelatedCode({ symbolKey, qualifiedName, relationshipType, depth, includeCode, maxLines, requestedBy });
3746
3713
  }
3747
3714
 
3748
3715
  // ─── Repo Inventory ───────────────────────────────────────────────────────
3749
3716
 
3750
3717
  async listRepositories({ limit } = {}) {
3751
- return this._request('/api/repo/repositories', {
3752
- query: { limit },
3753
- });
3718
+ return this.repo.listRepositories({ limit });
3754
3719
  }
3755
3720
 
3756
3721
  async getRepository(repositoryId) {
3757
- return this._request(`/api/repo/repositories/${repositoryId}`);
3722
+ return this.repo.getRepository(repositoryId);
3758
3723
  }
3759
3724
 
3760
3725
  async listProjects({ repositoryId, repoKey, limit } = {}) {
3761
- return this._request('/api/repo/projects', {
3762
- query: { repository_id: repositoryId, repo_key: repoKey, limit },
3763
- });
3726
+ return this.repo.listProjects({ repositoryId, repoKey, limit });
3764
3727
  }
3765
3728
 
3766
3729
  async getProject(projectId) {
3767
- return this._request(`/api/repo/projects/${projectId}`);
3730
+ return this.repo.getProject(projectId);
3768
3731
  }
3769
3732
 
3770
3733
  async listCodeFiles({ repositoryId, projectId, language, pathPrefix, page = 1, pageSize = 50 } = {}) {
3771
- return this._request('/api/repo/files', {
3772
- query: {
3773
- repository_id: repositoryId,
3774
- project_id: projectId,
3775
- language,
3776
- path_prefix: pathPrefix,
3777
- page,
3778
- page_size: pageSize,
3779
- },
3780
- });
3734
+ return this.repo.listCodeFiles({ repositoryId, projectId, language, pathPrefix, page, pageSize });
3781
3735
  }
3782
3736
 
3783
3737
  async getCodeFile(fileId) {
3784
- return this._request(`/api/repo/files/${fileId}`);
3738
+ return this.repo.getCodeFile(fileId);
3785
3739
  }
3786
3740
 
3787
3741
  async getCodeFileContentWindow(fileId, { startLine = 1, endLine } = {}) {
3788
- return this._request(`/api/repo/files/${fileId}/content-window`, {
3789
- query: { start_line: startLine, end_line: endLine ?? startLine },
3790
- });
3742
+ return this.repo.getCodeFileContentWindow(fileId, { startLine, endLine });
3791
3743
  }
3792
3744
 
3793
3745
  async listCodeSymbolsByFile(fileId, { limit = 500 } = {}) {
3794
- return this._request(`/api/repo/files/${fileId}/symbols`, {
3795
- query: { limit },
3796
- });
3746
+ return this.repo.listCodeSymbolsByFile(fileId, { limit });
3797
3747
  }
3798
3748
 
3799
3749
  async getCodeSymbol(symbolId, { includeCode = false, maxLines = 120 } = {}) {
3800
- return this._request(`/api/repo/symbols/${symbolId}`, {
3801
- query: { include_code: includeCode, max_lines: maxLines },
3802
- });
3750
+ return this.repo.getCodeSymbol(symbolId, { includeCode, maxLines });
3803
3751
  }
3804
3752
 
3805
3753
  async searchSymbols({ query, projectScope, maxResults = 10 } = {}) {
3806
- return this._request('/api/repo/symbols/search', {
3807
- query: { query, project_scope: projectScope, max_results: maxResults },
3808
- });
3754
+ return this.repo.searchSymbols({ query, projectScope, maxResults });
3809
3755
  }
3810
3756
 
3811
3757
  async getSymbolRelationships(symbolId, { relationshipType, depth = 1 } = {}) {
3812
- return this._request(`/api/repo/symbols/${symbolId}/relationships`, {
3813
- query: { relationship_type: relationshipType, depth },
3814
- });
3758
+ return this.repo.getSymbolRelationships(symbolId, { relationshipType, depth });
3815
3759
  }
3816
3760
 
3817
3761
  async listCodeRelationships({ repositoryId, projectId, relationshipType, limit = 100 } = {}) {
3818
- return this._request('/api/repo/relationships', {
3819
- query: { repository_id: repositoryId, project_id: projectId, relationship_type: relationshipType, limit },
3820
- });
3762
+ return this.repo.listCodeRelationships({ repositoryId, projectId, relationshipType, limit });
3821
3763
  }
3822
3764
 
3823
3765
  async listActionObservations({ repositoryId, projectPath, filePath, symbolId, actionKind, limit = 100 } = {}) {
3824
- return this._request('/api/repo/action-observations', {
3825
- query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, symbol_id: symbolId, action_kind: actionKind, limit },
3826
- });
3766
+ return this.repo.listActionObservations({ repositoryId, projectPath, filePath, symbolId, actionKind, limit });
3827
3767
  }
3828
3768
 
3829
3769
  async listCodebaseShapeFindings({ repositoryId, projectPath, filePath, severity, status, limit = 100 } = {}) {
3830
- return this._request('/api/repo/shape/findings', {
3831
- query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, severity, status, limit },
3832
- });
3770
+ return this.repo.listCodebaseShapeFindings({ repositoryId, projectPath, filePath, severity, status, limit });
3833
3771
  }
3834
3772
 
3835
3773
  async listObjectFlowObservations({ repositoryId, projectPath, filePath, objectKind, boundaryKind, limit = 100 } = {}) {
3836
- return this._request('/api/repo/object-flow-observations', {
3837
- query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, object_kind: objectKind, boundary_kind: boundaryKind, limit },
3838
- });
3774
+ return this.repo.listObjectFlowObservations({ repositoryId, projectPath, filePath, objectKind, boundaryKind, limit });
3839
3775
  }
3840
3776
 
3841
3777
  async getChangeAnalysis({ fileId, symbolId, limit = 25 } = {}) {
3842
- return this._request('/api/repo/change-analysis', {
3843
- query: { file_id: fileId, symbol_id: symbolId, limit },
3844
- });
3778
+ return this.repo.getChangeAnalysis({ fileId, symbolId, limit });
3845
3779
  }
3846
3780
 
3847
3781
  async listRefactorCandidates({ repositoryRoot, limit = 10 } = {}) {
3848
- return this._request('/api/repo/refactor-candidates', {
3849
- query: { repository_root: repositoryRoot, limit },
3850
- });
3782
+ return this.repo.listRefactorCandidates({ repositoryRoot, limit });
3851
3783
  }
3852
3784
 
3853
3785
  async analyzeRefactorCandidate({ filePath, requestedBy, packetId, refactorIntent } = {}) {
3854
- return this._request('/api/repo/refactor-candidate-analysis', {
3855
- method: 'POST',
3856
- body: { file_path: filePath, requested_by: requestedBy, packet_id: packetId, refactor_intent: refactorIntent },
3857
- });
3786
+ return this.repo.analyzeRefactorCandidate({ filePath, requestedBy, packetId, refactorIntent });
3858
3787
  }
3859
3788
 
3860
3789
  async getRepoRetrievalPacket(retrievalPacketId) {
3861
- return this._request(`/api/repo/retrieval/packets/${retrievalPacketId}`);
3790
+ return this.repo.getRepoRetrievalPacket(retrievalPacketId);
3862
3791
  }
3863
3792
 
3864
3793
  async getRepoRetrievalPacketFragments(retrievalPacketId) {
3865
- return this._request(`/api/repo/retrieval/packets/${retrievalPacketId}/fragments`);
3794
+ return this.repo.getRepoRetrievalPacketFragments(retrievalPacketId);
3866
3795
  }
3867
3796
 
3868
3797
  async evaluateProposalScope({ filePath, projectId, changeType = 'refactor', requestedBy, refactorIntent } = {}) {
3869
- return this._request('/api/repo/proposal-scope-evaluation', {
3870
- method: 'POST',
3871
- body: { file_path: filePath, project_id: projectId, change_type: changeType, requested_by: requestedBy, refactor_intent: refactorIntent },
3872
- });
3798
+ return this.repo.evaluateProposalScope({ filePath, projectId, changeType, requestedBy, refactorIntent });
3873
3799
  }
3874
3800
 
3875
3801
  // ─── Retrieval Management ──────────────────────────────────────────────────
3876
3802
 
3877
3803
  async getRetrievalStatus() {
3878
- return this._request('/api/operator/retrieval/status');
3804
+ return this.retrievalManagement.getRetrievalStatus();
3879
3805
  }
3880
3806
 
3881
3807
  async getRetrievalProfileMetrics() {
3882
- return this._request('/api/operator/retrieval/profiles/metrics');
3808
+ return this.retrievalManagement.getRetrievalProfileMetrics();
3883
3809
  }
3884
3810
 
3885
3811
  async getRetrievalFeedbackMetrics() {
3886
- return this._request('/api/operator/retrieval/feedback-metrics');
3812
+ return this.retrievalManagement.getRetrievalFeedbackMetrics();
3887
3813
  }
3888
3814
 
3889
3815
  async getRetrievalQuery(retrievalQueryId) {
3890
- return this._request(`/api/operator/retrieval/queries/${retrievalQueryId}`);
3816
+ return this.retrievalManagement.getRetrievalQuery(retrievalQueryId);
3891
3817
  }
3892
3818
 
3893
3819
  async getRetrievalPacket(retrievalPacketId) {
3894
- return this._request(`/api/operator/retrieval/packets/${retrievalPacketId}`);
3820
+ return this.retrievalManagement.getRetrievalPacket(retrievalPacketId);
3895
3821
  }
3896
3822
 
3897
3823
  async generateRetrievalCandidates(body) {
3898
- return this._request('/api/operator/retrieval/generate-candidates', { method: 'POST', body });
3824
+ return this.retrievalManagement.generateRetrievalCandidates(body);
3899
3825
  }
3900
3826
 
3901
3827
  async selectRetrievalPacket(body) {
3902
- return this._request('/api/operator/retrieval/select-packet', { method: 'POST', body });
3828
+ return this.retrievalManagement.selectRetrievalPacket(body);
3903
3829
  }
3904
3830
 
3905
3831
  async recordRetrievalFeedback(body) {
3906
- return this._request('/api/operator/retrieval/feedback', { method: 'POST', body });
3832
+ return this.retrievalManagement.recordRetrievalFeedback(body);
3907
3833
  }
3908
3834
 
3909
3835
  async deriveRetrievalOptimizationCandidates(body) {
3910
- return this._request('/api/operator/retrieval/optimization-candidates', { method: 'POST', body });
3836
+ return this.retrievalManagement.deriveRetrievalOptimizationCandidates(body);
3911
3837
  }
3912
3838
 
3913
3839
  async validatePromptAssembly(body) {
3914
- return this._request('/api/operator/retrieval/validate-prompt-assembly', { method: 'POST', body });
3840
+ return this.retrievalManagement.validatePromptAssembly(body);
3915
3841
  }
3916
3842
 
3917
3843
  // ─── Workflows ─────────────────────────────────────────────────────────────
3918
3844
 
3919
3845
  async listWorkflows({ status, includeSteps } = {}) {
3920
- return this._request('/api/workflows', {
3921
- query: { status, include_steps: includeSteps },
3922
- });
3846
+ return this.workflows.listWorkflows({ status, includeSteps });
3923
3847
  }
3924
3848
 
3925
3849
  async createWorkflow({ name, slug, description, goal, governanceProfile, steps = [] } = {}) {
3926
- return this._request('/api/workflows', {
3927
- method: 'POST',
3928
- body: { name, slug, description, goal, governance_profile: governanceProfile, steps },
3929
- });
3850
+ return this.workflows.createWorkflow({ name, slug, description, goal, governanceProfile, steps });
3930
3851
  }
3931
3852
 
3932
3853
  async getWorkflow(workflowId) {
3933
- return this._request(`/api/workflows/${workflowId}`);
3854
+ return this.workflows.getWorkflow(workflowId);
3934
3855
  }
3935
3856
 
3936
3857
  async replaceWorkflowSteps(workflowId, steps) {
3937
- return this._request(`/api/workflows/${workflowId}/steps`, { method: 'PUT', body: { steps } });
3858
+ return this.workflows.replaceWorkflowSteps(workflowId, steps);
3938
3859
  }
3939
3860
 
3940
3861
  async publishWorkflow(workflowId) {
3941
- return this._request(`/api/workflows/${workflowId}/publish`, { method: 'POST' });
3862
+ return this.workflows.publishWorkflow(workflowId);
3942
3863
  }
3943
3864
 
3944
3865
  async cloneWorkflow(workflowId) {
3945
- return this._request(`/api/workflows/${workflowId}/clone`, { method: 'POST' });
3866
+ return this.workflows.cloneWorkflow(workflowId);
3946
3867
  }
3947
3868
 
3948
3869
  // ─── Workflow Governance ───────────────────────────────────────────────────
3949
3870
 
3950
3871
  async evaluateWorkflowGovernance(workflowId) {
3951
- return this._request(`/api/workflows/${workflowId}/governance/evaluate`, { method: 'POST' });
3872
+ return this.workflows.evaluateWorkflowGovernance(workflowId);
3952
3873
  }
3953
3874
 
3954
3875
  async listWorkflowGovernanceDecisions(workflowId) {
3955
- return this._request(`/api/workflows/${workflowId}/governance/decisions`);
3876
+ return this.workflows.listWorkflowGovernanceDecisions(workflowId);
3956
3877
  }
3957
3878
 
3958
3879
  async getWorkflowGovernanceSimulation(workflowId) {
3959
- return this._request(`/api/workflows/${workflowId}/governance/simulation`);
3880
+ return this.workflows.getWorkflowGovernanceSimulation(workflowId);
3960
3881
  }
3961
3882
 
3962
3883
  async listWorkflowGovernanceBundles(workflowId) {
3963
- return this._request(`/api/workflows/${workflowId}/governance/bundles`);
3884
+ return this.workflows.listWorkflowGovernanceBundles(workflowId);
3964
3885
  }
3965
3886
 
3966
3887
  async listWorkflowGovernanceApprovals(workflowId) {
3967
- return this._request(`/api/workflows/${workflowId}/governance/approvals`);
3888
+ return this.workflows.listWorkflowGovernanceApprovals(workflowId);
3968
3889
  }
3969
3890
 
3970
3891
  async listWorkflowGovernanceEvents(workflowId) {
3971
- return this._request(`/api/workflows/${workflowId}/governance/events`);
3892
+ return this.workflows.listWorkflowGovernanceEvents(workflowId);
3972
3893
  }
3973
3894
 
3974
3895
  async getWorkflowGovernanceReview(workflowId) {
3975
- return this._request(`/api/workflows/${workflowId}/governance/review`);
3896
+ return this.workflows.getWorkflowGovernanceReview(workflowId);
3976
3897
  }
3977
3898
 
3978
3899
  async createWorkflowGovernanceReviewDecision(workflowId, body) {
3979
- return this._request(`/api/workflows/${workflowId}/governance/review-decisions`, {
3980
- method: 'POST', body,
3981
- });
3900
+ return this.workflows.createWorkflowGovernanceReviewDecision(workflowId, body);
3982
3901
  }
3983
3902
 
3984
3903
  // ─── Workflow Runs ─────────────────────────────────────────────────────────
3985
3904
 
3986
3905
  async createWorkflowRun(body) {
3987
- return this._request('/api/workflow-runs', { method: 'POST', body });
3906
+ return this.workflows.createWorkflowRun(body);
3988
3907
  }
3989
3908
 
3990
3909
  async getWorkflowRun(workflowRunId) {
3991
- return this._request(`/api/workflow-runs/${workflowRunId}`);
3910
+ return this.workflows.getWorkflowRun(workflowRunId);
3992
3911
  }
3993
3912
 
3994
3913
  async listWorkflowArtifacts(workflowRunId) {
3995
- return this._request(`/api/workflow-runs/${workflowRunId}/artifacts`);
3914
+ return this.workflows.listWorkflowArtifacts(workflowRunId);
3996
3915
  }
3997
3916
 
3998
3917
  async getWorkflowRunSubstrate(workflowRunId) {
3999
- return this._request(`/api/workflow-runs/${workflowRunId}/substrate`);
3918
+ return this.workflows.getWorkflowRunSubstrate(workflowRunId);
4000
3919
  }
4001
3920
 
4002
3921
  async getWorkflowPlayback(workflowRunId) {
4003
- return this._request(`/api/operator/workflow-runs/${workflowRunId}/playback`);
3922
+ return this.workflows.getWorkflowPlayback(workflowRunId);
4004
3923
  }
4005
3924
 
4006
3925
  async resumeWorkflowRun(workflowRunId, body = {}) {
4007
- return this._request(`/api/workflow-runs/${workflowRunId}/resume`, { method: 'POST', body });
3926
+ return this.workflows.resumeWorkflowRun(workflowRunId, body);
4008
3927
  }
4009
3928
 
4010
3929
  // ─── Workflow Inspector ────────────────────────────────────────────────────
4011
3930
 
4012
3931
  async listRecentInspectorRuns({ limit } = {}) {
4013
- return this._request('/api/workflow-inspector/runs/recent', { query: { limit } });
3932
+ return this.workflows.listRecentInspectorRuns({ limit });
4014
3933
  }
4015
3934
 
4016
3935
  async inspectWorkflowRun(workflowRunId) {
4017
- return this._request(`/api/workflow-inspector/runs/${workflowRunId}`);
3936
+ return this.workflows.inspectWorkflowRun(workflowRunId);
4018
3937
  }
4019
3938
 
4020
3939
  // ─── Manual & Approval Tasks ───────────────────────────────────────────────
@@ -1,25 +1,128 @@
1
1
  export function createRepoDomain(client) {
2
2
  return {
3
- listRepositories: (request) => client.listRepositories(request),
4
- getRepository: (repositoryId) => client.getRepository(repositoryId),
5
- listProjects: (request) => client.listProjects(request),
6
- getProject: (projectId) => client.getProject(projectId),
7
- listCodeFiles: (request) => client.listCodeFiles(request),
8
- getCodeFile: (fileId) => client.getCodeFile(fileId),
9
- getCodeFileContentWindow: (fileId, request) => client.getCodeFileContentWindow(fileId, request),
10
- listCodeSymbolsByFile: (fileId, request) => client.listCodeSymbolsByFile(fileId, request),
11
- getCodeSymbol: (symbolId, request) => client.getCodeSymbol(symbolId, request),
12
- searchSymbols: (request) => client.searchSymbols(request),
13
- getSymbolRelationships: (symbolId, request) => client.getSymbolRelationships(symbolId, request),
14
- listCodeRelationships: (request) => client.listCodeRelationships(request),
15
- listActionObservations: (request) => client.listActionObservations(request),
16
- listCodebaseShapeFindings: (request) => client.listCodebaseShapeFindings(request),
17
- listObjectFlowObservations: (request) => client.listObjectFlowObservations(request),
18
- getChangeAnalysis: (request) => client.getChangeAnalysis(request),
19
- listRefactorCandidates: (request) => client.listRefactorCandidates(request),
20
- analyzeRefactorCandidate: (request) => client.analyzeRefactorCandidate(request),
21
- getRepoRetrievalPacket: (retrievalPacketId) => client.getRepoRetrievalPacket(retrievalPacketId),
22
- getRepoRetrievalPacketFragments: (retrievalPacketId) => client.getRepoRetrievalPacketFragments(retrievalPacketId),
23
- evaluateProposalScope: (request) => client.evaluateProposalScope(request),
3
+ listRepositories({ limit } = {}) {
4
+ return client._request('/api/repo/repositories', {
5
+ query: { limit },
6
+ });
7
+ },
8
+
9
+ getRepository(repositoryId) {
10
+ return client._request(`/api/repo/repositories/${repositoryId}`);
11
+ },
12
+
13
+ listProjects({ repositoryId, repoKey, limit } = {}) {
14
+ return client._request('/api/repo/projects', {
15
+ query: { repository_id: repositoryId, repo_key: repoKey, limit },
16
+ });
17
+ },
18
+
19
+ getProject(projectId) {
20
+ return client._request(`/api/repo/projects/${projectId}`);
21
+ },
22
+
23
+ listCodeFiles({ repositoryId, projectId, language, pathPrefix, page = 1, pageSize = 50 } = {}) {
24
+ return client._request('/api/repo/files', {
25
+ query: {
26
+ repository_id: repositoryId,
27
+ project_id: projectId,
28
+ language,
29
+ path_prefix: pathPrefix,
30
+ page,
31
+ page_size: pageSize,
32
+ },
33
+ });
34
+ },
35
+
36
+ getCodeFile(fileId) {
37
+ return client._request(`/api/repo/files/${fileId}`);
38
+ },
39
+
40
+ getCodeFileContentWindow(fileId, { startLine = 1, endLine } = {}) {
41
+ return client._request(`/api/repo/files/${fileId}/content-window`, {
42
+ query: { start_line: startLine, end_line: endLine ?? startLine },
43
+ });
44
+ },
45
+
46
+ listCodeSymbolsByFile(fileId, { limit = 500 } = {}) {
47
+ return client._request(`/api/repo/files/${fileId}/symbols`, {
48
+ query: { limit },
49
+ });
50
+ },
51
+
52
+ getCodeSymbol(symbolId, { includeCode = false, maxLines = 120 } = {}) {
53
+ return client._request(`/api/repo/symbols/${symbolId}`, {
54
+ query: { include_code: includeCode, max_lines: maxLines },
55
+ });
56
+ },
57
+
58
+ searchSymbols({ query, projectScope, maxResults = 10 } = {}) {
59
+ return client._request('/api/repo/symbols/search', {
60
+ query: { query, project_scope: projectScope, max_results: maxResults },
61
+ });
62
+ },
63
+
64
+ getSymbolRelationships(symbolId, { relationshipType, depth = 1 } = {}) {
65
+ return client._request(`/api/repo/symbols/${symbolId}/relationships`, {
66
+ query: { relationship_type: relationshipType, depth },
67
+ });
68
+ },
69
+
70
+ listCodeRelationships({ repositoryId, projectId, relationshipType, limit = 100 } = {}) {
71
+ return client._request('/api/repo/relationships', {
72
+ query: { repository_id: repositoryId, project_id: projectId, relationship_type: relationshipType, limit },
73
+ });
74
+ },
75
+
76
+ listActionObservations({ repositoryId, projectPath, filePath, symbolId, actionKind, limit = 100 } = {}) {
77
+ return client._request('/api/repo/action-observations', {
78
+ query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, symbol_id: symbolId, action_kind: actionKind, limit },
79
+ });
80
+ },
81
+
82
+ listCodebaseShapeFindings({ repositoryId, projectPath, filePath, severity, status, limit = 100 } = {}) {
83
+ return client._request('/api/repo/shape/findings', {
84
+ query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, severity, status, limit },
85
+ });
86
+ },
87
+
88
+ listObjectFlowObservations({ repositoryId, projectPath, filePath, objectKind, boundaryKind, limit = 100 } = {}) {
89
+ return client._request('/api/repo/object-flow-observations', {
90
+ query: { repository_id: repositoryId, project_path: projectPath, file_path: filePath, object_kind: objectKind, boundary_kind: boundaryKind, limit },
91
+ });
92
+ },
93
+
94
+ getChangeAnalysis({ fileId, symbolId, limit = 25 } = {}) {
95
+ return client._request('/api/repo/change-analysis', {
96
+ query: { file_id: fileId, symbol_id: symbolId, limit },
97
+ });
98
+ },
99
+
100
+ listRefactorCandidates({ repositoryRoot, limit = 10 } = {}) {
101
+ return client._request('/api/repo/refactor-candidates', {
102
+ query: { repository_root: repositoryRoot, limit },
103
+ });
104
+ },
105
+
106
+ analyzeRefactorCandidate({ filePath, requestedBy, packetId, refactorIntent } = {}) {
107
+ return client._request('/api/repo/refactor-candidate-analysis', {
108
+ method: 'POST',
109
+ body: { file_path: filePath, requested_by: requestedBy, packet_id: packetId, refactor_intent: refactorIntent },
110
+ });
111
+ },
112
+
113
+ getRepoRetrievalPacket(retrievalPacketId) {
114
+ return client._request(`/api/repo/retrieval/packets/${retrievalPacketId}`);
115
+ },
116
+
117
+ getRepoRetrievalPacketFragments(retrievalPacketId) {
118
+ return client._request(`/api/repo/retrieval/packets/${retrievalPacketId}/fragments`);
119
+ },
120
+
121
+ evaluateProposalScope({ filePath, projectId, changeType = 'refactor', requestedBy, refactorIntent } = {}) {
122
+ return client._request('/api/repo/proposal-scope-evaluation', {
123
+ method: 'POST',
124
+ body: { file_path: filePath, project_id: projectId, change_type: changeType, requested_by: requestedBy, refactor_intent: refactorIntent },
125
+ });
126
+ },
24
127
  };
25
128
  }
@@ -1,5 +1,20 @@
1
+ import { cleanText, isPlainObject } from '../utils/text.js';
2
+
1
3
  export function createReportsDomain(client) {
2
4
  return {
3
- run: (request) => client.runReportDefinition(request),
5
+ run({ reportKey, definition = {}, requestedBy } = {}) {
6
+ const normalizedReportKey = cleanText(reportKey);
7
+ if (!normalizedReportKey) {
8
+ throw new Error('reportKey is required.');
9
+ }
10
+ return client._request('/api/gateway/reports/run', {
11
+ method: 'POST',
12
+ body: {
13
+ report_key: normalizedReportKey,
14
+ definition: isPlainObject(definition) ? definition : {},
15
+ requested_by: cleanText(requestedBy),
16
+ },
17
+ });
18
+ },
4
19
  };
5
20
  }
@@ -1,14 +1,23 @@
1
1
  export function createRetrievalManagementDomain(client) {
2
2
  return {
3
- getRetrievalStatus: () => client.getRetrievalStatus(),
4
- getRetrievalProfileMetrics: () => client.getRetrievalProfileMetrics(),
5
- getRetrievalFeedbackMetrics: () => client.getRetrievalFeedbackMetrics(),
6
- getRetrievalQuery: (retrievalQueryId) => client.getRetrievalQuery(retrievalQueryId),
7
- getRetrievalPacket: (retrievalPacketId) => client.getRetrievalPacket(retrievalPacketId),
8
- generateRetrievalCandidates: (body) => client.generateRetrievalCandidates(body),
9
- selectRetrievalPacket: (body) => client.selectRetrievalPacket(body),
10
- recordRetrievalFeedback: (body) => client.recordRetrievalFeedback(body),
11
- deriveRetrievalOptimizationCandidates: (body) => client.deriveRetrievalOptimizationCandidates(body),
12
- validatePromptAssembly: (body) => client.validatePromptAssembly(body),
3
+ getRetrievalStatus: () => client._request('/api/operator/retrieval/status'),
4
+
5
+ getRetrievalProfileMetrics: () => client._request('/api/operator/retrieval/profiles/metrics'),
6
+
7
+ getRetrievalFeedbackMetrics: () => client._request('/api/operator/retrieval/feedback-metrics'),
8
+
9
+ getRetrievalQuery: (retrievalQueryId) => client._request(`/api/operator/retrieval/queries/${retrievalQueryId}`),
10
+
11
+ getRetrievalPacket: (retrievalPacketId) => client._request(`/api/operator/retrieval/packets/${retrievalPacketId}`),
12
+
13
+ generateRetrievalCandidates: (body) => client._request('/api/operator/retrieval/generate-candidates', { method: 'POST', body }),
14
+
15
+ selectRetrievalPacket: (body) => client._request('/api/operator/retrieval/select-packet', { method: 'POST', body }),
16
+
17
+ recordRetrievalFeedback: (body) => client._request('/api/operator/retrieval/feedback', { method: 'POST', body }),
18
+
19
+ deriveRetrievalOptimizationCandidates: (body) => client._request('/api/operator/retrieval/optimization-candidates', { method: 'POST', body }),
20
+
21
+ validatePromptAssembly: (body) => client._request('/api/operator/retrieval/validate-prompt-assembly', { method: 'POST', body }),
13
22
  };
14
23
  }
@@ -1,7 +1,43 @@
1
1
  export function createRetrievalWrapperDomain(client) {
2
2
  return {
3
- getCommandCard: (request) => client.getCommandCard(request),
4
- getSymbolDefinition: (request) => client.getSymbolDefinition(request),
5
- getRelatedCode: (request) => client.getRelatedCode(request),
3
+ getCommandCard({ commandKey, alias, intentText, requestedBy } = {}) {
4
+ return client._request('/api/operator/retrieval/wrapper/command-card', {
5
+ query: { command_key: commandKey, alias, intent_text: intentText, requested_by: requestedBy },
6
+ });
7
+ },
8
+
9
+ resolveOperatingProcedure({ procedureKey, intentText, requestedBy } = {}) {
10
+ return client._request('/api/operator/retrieval/wrapper/operating-procedure', {
11
+ query: { procedure_key: procedureKey, intent_text: intentText, requested_by: requestedBy },
12
+ });
13
+ },
14
+
15
+ getSymbolDefinition({ symbolKey, qualifiedName, symbolName, projectScope, includeCode = true, maxLines = 120, requestedBy } = {}) {
16
+ return client._request('/api/operator/retrieval/wrapper/symbol-definition', {
17
+ query: {
18
+ symbol_key: symbolKey,
19
+ qualified_name: qualifiedName,
20
+ symbol_name: symbolName,
21
+ project_scope: projectScope,
22
+ include_code: includeCode,
23
+ max_lines: maxLines,
24
+ requested_by: requestedBy,
25
+ },
26
+ });
27
+ },
28
+
29
+ getRelatedCode({ symbolKey, qualifiedName, relationshipType, depth = 1, includeCode = false, maxLines = 80, requestedBy } = {}) {
30
+ return client._request('/api/operator/retrieval/wrapper/related-code', {
31
+ query: {
32
+ symbol_key: symbolKey,
33
+ qualified_name: qualifiedName,
34
+ relationship_type: relationshipType,
35
+ depth,
36
+ include_code: includeCode,
37
+ max_lines: maxLines,
38
+ requested_by: requestedBy,
39
+ },
40
+ });
41
+ },
6
42
  };
7
43
  }
@@ -0,0 +1,99 @@
1
+ export function createWorkflowsDomain(client) {
2
+ return {
3
+ listWorkflows({ status, includeSteps } = {}) {
4
+ return client._request('/api/workflows', {
5
+ query: { status, include_steps: includeSteps },
6
+ });
7
+ },
8
+
9
+ createWorkflow({ name, slug, description, goal, governanceProfile, steps = [] } = {}) {
10
+ return client._request('/api/workflows', {
11
+ method: 'POST',
12
+ body: { name, slug, description, goal, governance_profile: governanceProfile, steps },
13
+ });
14
+ },
15
+
16
+ getWorkflow(workflowId) {
17
+ return client._request(`/api/workflows/${workflowId}`);
18
+ },
19
+
20
+ replaceWorkflowSteps(workflowId, steps) {
21
+ return client._request(`/api/workflows/${workflowId}/steps`, { method: 'PUT', body: { steps } });
22
+ },
23
+
24
+ publishWorkflow(workflowId) {
25
+ return client._request(`/api/workflows/${workflowId}/publish`, { method: 'POST' });
26
+ },
27
+
28
+ cloneWorkflow(workflowId) {
29
+ return client._request(`/api/workflows/${workflowId}/clone`, { method: 'POST' });
30
+ },
31
+
32
+ evaluateWorkflowGovernance(workflowId) {
33
+ return client._request(`/api/workflows/${workflowId}/governance/evaluate`, { method: 'POST' });
34
+ },
35
+
36
+ listWorkflowGovernanceDecisions(workflowId) {
37
+ return client._request(`/api/workflows/${workflowId}/governance/decisions`);
38
+ },
39
+
40
+ getWorkflowGovernanceSimulation(workflowId) {
41
+ return client._request(`/api/workflows/${workflowId}/governance/simulation`);
42
+ },
43
+
44
+ listWorkflowGovernanceBundles(workflowId) {
45
+ return client._request(`/api/workflows/${workflowId}/governance/bundles`);
46
+ },
47
+
48
+ listWorkflowGovernanceApprovals(workflowId) {
49
+ return client._request(`/api/workflows/${workflowId}/governance/approvals`);
50
+ },
51
+
52
+ listWorkflowGovernanceEvents(workflowId) {
53
+ return client._request(`/api/workflows/${workflowId}/governance/events`);
54
+ },
55
+
56
+ getWorkflowGovernanceReview(workflowId) {
57
+ return client._request(`/api/workflows/${workflowId}/governance/review`);
58
+ },
59
+
60
+ createWorkflowGovernanceReviewDecision(workflowId, body) {
61
+ return client._request(`/api/workflows/${workflowId}/governance/review-decisions`, {
62
+ method: 'POST',
63
+ body,
64
+ });
65
+ },
66
+
67
+ createWorkflowRun(body) {
68
+ return client._request('/api/workflow-runs', { method: 'POST', body });
69
+ },
70
+
71
+ getWorkflowRun(workflowRunId) {
72
+ return client._request(`/api/workflow-runs/${workflowRunId}`);
73
+ },
74
+
75
+ listWorkflowArtifacts(workflowRunId) {
76
+ return client._request(`/api/workflow-runs/${workflowRunId}/artifacts`);
77
+ },
78
+
79
+ getWorkflowRunSubstrate(workflowRunId) {
80
+ return client._request(`/api/workflow-runs/${workflowRunId}/substrate`);
81
+ },
82
+
83
+ getWorkflowPlayback(workflowRunId) {
84
+ return client._request(`/api/operator/workflow-runs/${workflowRunId}/playback`);
85
+ },
86
+
87
+ resumeWorkflowRun(workflowRunId, body = {}) {
88
+ return client._request(`/api/workflow-runs/${workflowRunId}/resume`, { method: 'POST', body });
89
+ },
90
+
91
+ listRecentInspectorRuns({ limit } = {}) {
92
+ return client._request('/api/workflow-inspector/runs/recent', { query: { limit } });
93
+ },
94
+
95
+ inspectWorkflowRun(workflowRunId) {
96
+ return client._request(`/api/workflow-inspector/runs/${workflowRunId}`);
97
+ },
98
+ };
99
+ }
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.86';
2
+ export const AI_ENGINE_CLIENT_VERSION = '1.1.87';
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 {