@bpmsoftwaresolutions/ai-engine-client 1.1.97 → 1.1.99

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/src/client.js CHANGED
@@ -15,6 +15,7 @@ import { createGatewayDomain } from './domains/gateway.js';
15
15
  import { createHealthDomain } from './domains/health.js';
16
16
  import { createLogaDomain } from './domains/loga.js';
17
17
  import { createNotesLabDomain } from './domains/notes-lab.js';
18
+ import { createCommunicationTicketsDomain } from './domains/communication-tickets.js';
18
19
  import { createPortfolioDomain } from './domains/portfolio.js';
19
20
  import { createProjectReportsDomain } from './domains/project-reports.js';
20
21
  import { createProjectResumeDomain } from './domains/project-resume.js';
@@ -32,6 +33,7 @@ import { createImplementationItemsDomain } from './domains/implementation-items.
32
33
  import { createRepoDomain } from './domains/repo.js';
33
34
  import { createProjectCharteringDomain } from './domains/project-chartering.js';
34
35
  import { createProjectsDomain } from './domains/projects.js';
36
+ import { createRefactoringTransfersDomain } from './domains/refactoring-transfers.js';
35
37
  import { createOperatorStatusDomain } from './domains/operator-status.js';
36
38
  import { createRoadmapsDomain } from './domains/roadmaps.js';
37
39
  import { createScriptDiscoveryDomain } from './domains/script-discovery.js';
@@ -43,6 +45,9 @@ import { createSelfOptimizationDomain } from './domains/self-optimization.js';
43
45
  import { createSkillGovernanceDomain } from './domains/skill-governance.js';
44
46
  import { createSkillsDomain } from './domains/skills.js';
45
47
  import { createSearchContactsDomain } from './domains/search-contacts.js';
48
+ import { createExternalProjectsDomain } from './domains/external-projects.js';
49
+ import { createExternalAudioDomain } from './domains/external-audio.js';
50
+ import { createExternalWorkflowArtifactsDomain } from './domains/external-workflow-artifacts.js';
46
51
  import { createAgentCommunicationsFacade, createCollaborationFacade } from './compat/facades.js';
47
52
  import { createClaimsDomain } from './domains/claims.js';
48
53
  import { createSessionGovernanceDomain } from './domains/session-governance.js';
@@ -66,6 +71,7 @@ import { createToolRegistryDomain } from './domains/tool-registry.js';
66
71
  import { createWorkflowCompositionDomain } from './domains/workflow-composition.js';
67
72
  import { createWorkflowsDomain } from './domains/workflows.js';
68
73
  import { createWarehouseDomain } from './domains/warehouse.js';
74
+ import { installClientCompatibilityDelegates } from './compat/aliases.js';
69
75
  import { buildHeaders, requestBinary, requestJson, requestLogaProjection, requestText, resolveAccessToken } from './transport/index.js';
70
76
  import { normalizeEnum, trimTrailingSlash } from './utils/text.js';
71
77
 
@@ -326,6 +332,11 @@ export class AIEngineClient {
326
332
  this.presence = createPresenceDomain(this);
327
333
  this.pingPong = createPingPongDomain(this);
328
334
  this.agentCommunications = createAgentCommunicationsDomain(this);
335
+ this.communicationTickets = createCommunicationTicketsDomain(this);
336
+ this.refactoringTransfers = createRefactoringTransfersDomain(this);
337
+ this.externalProjects = createExternalProjectsDomain(this);
338
+ this.externalAudio = createExternalAudioDomain(this);
339
+ this.externalWorkflowArtifacts = createExternalWorkflowArtifactsDomain(this);
329
340
  this.collaborationDomain = createCollaborationDomain(this);
330
341
  this.agentComms = createAgentCommunicationsFacade(this);
331
342
  this.collaboration = createCollaborationFacade(this);
@@ -570,720 +581,11 @@ export class AIEngineClient {
570
581
  includeTransferChannelProjection = true,
571
582
  includeOperatorProjectionMetadata = true,
572
583
  } = {}) {
573
- const missingSurfaces = [];
574
- const normalizedMetadata = isPlainObject(metadata) ? metadata : {};
575
- const normalizedTransferChannelId = cleanText(transfer_channel_id) || cleanText(transferChannelId) || cleanText(channel_id) || cleanText(channelId);
576
- const normalizedWorkTransferPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId) || cleanText(packet_id) || cleanText(packetId);
577
- const normalizedWorkflowRunId = cleanText(workflow_run_id) || cleanText(workflowRunId);
578
- const normalizedRequestedBy = cleanText(requested_by) || cleanText(requestedBy) || this.agentSessionId || this.actorId;
579
- const normalizedAssignedTo = cleanText(assigned_to) || cleanText(assignedTo);
580
- const normalizedSeverity = cleanText(severity) || 'medium';
581
- const normalizedSourceRef = cleanText(source_ref) || cleanText(sourceRef) || cleanText(finding_id) || cleanText(findingId) || cleanText(blocker_id) || cleanText(blockerId) || cleanText(failed_check_id) || cleanText(failedCheckId) || cleanText(workflow_gap) || cleanText(workflowGap);
582
- const normalizedExpectedResponse = cleanText(expected_response) || cleanText(expectedResponse) || 'assignee acknowledgement';
583
- const normalizedParticipantRole = cleanText(participant_role) || cleanText(participantRole) || 'requester';
584
- const normalizedWatcherRole = cleanText(watcher_role) || cleanText(watcherRole) || 'watcher';
585
- const normalizedBlockerKind = cleanText(blocker_kind) || cleanText(blockerKind) || 'remediation';
586
- const normalizedBlockerSummary = cleanText(blocker_summary) || cleanText(blockerSummary) || normalizedSourceRef || normalizedExpectedResponse;
587
- const normalizedBlockerDetails = cleanText(blocker_details) || cleanText(blockerDetails) || normalizedExpectedResponse;
588
- const normalizedExpectedMessageKind = cleanText(expected_message_kind) || cleanText(expectedMessageKind) || 'response';
589
- const normalizedReplyPayload = isPlainObject(reply_payload) ? reply_payload : (isPlainObject(replyPayload) ? replyPayload : {});
590
- const normalizedReplyScope = isPlainObject(reply_scope) ? reply_scope : (isPlainObject(replyScope) ? replyScope : {});
591
- const normalizedReplyEvidenceRefs = Array.isArray(reply_evidence_refs) ? reply_evidence_refs : (Array.isArray(replyEvidenceRefs) ? replyEvidenceRefs : []);
592
- const shouldMoveOwnership = Boolean(ownership_move ?? ownershipMove ?? transfer_ownership ?? transferOwnership);
593
- const hasExplicitChannel = Boolean(normalizedTransferChannelId);
594
-
595
- if (!hasExplicitChannel && !shouldMoveOwnership) {
596
- throw new Error('channel_id is required unless ownershipMove is true.');
597
- }
598
-
599
- let resumedChannel = null;
600
- let resolvedTransferChannelId = normalizedTransferChannelId;
601
- let resolvedWorkTransferPacketId = normalizedWorkTransferPacketId;
602
-
603
- if (hasExplicitChannel) {
604
- const resumeSurface = typeof this.resumeTransferChannel === 'function'
605
- ? this.resumeTransferChannel.bind(this)
606
- : null;
607
- if (!resumeSurface) missingSurfaces.push('resumeTransferChannel');
608
- if (resumeSurface) {
609
- resumedChannel = await resumeSurface({
610
- transferChannelId: normalizedTransferChannelId,
611
- workTransferPacketId: normalizedWorkTransferPacketId,
612
- workflowRunId: normalizedWorkflowRunId,
613
- participantRole: normalizedParticipantRole,
614
- participantKind: 'agent_session',
615
- participantLabel: normalizedParticipantRole,
616
- agentSessionId: this.agentSessionId,
617
- currentPhase: 'remediation',
618
- currentTaskSummary: normalizedBlockerSummary,
619
- lastSeenMessageId: cleanText(message_watch_id) || cleanText(messageWatchId),
620
- metadata: {
621
- ...normalizedMetadata,
622
- source: 'createCrossAgentRemediationTicket',
623
- },
624
- });
625
- const resumedPayload = isPlainObject(resumedChannel) ? resumedChannel : {};
626
- resolvedTransferChannelId = cleanText(resumedPayload.transfer_channel_id)
627
- || cleanText(resumedPayload.channel_id)
628
- || cleanText(resumedPayload.transfer_channel?.transfer_channel_id)
629
- || cleanText(resumedPayload.communication_transfer_channel?.transfer_channel_id)
630
- || resolvedTransferChannelId;
631
- resolvedWorkTransferPacketId = cleanText(resumedPayload.work_transfer_packet_id)
632
- || cleanText(resumedPayload.work_transfer_packet?.work_transfer_packet_id)
633
- || cleanText(resumedPayload.communication_transfer_channel?.work_transfer_packet_id)
634
- || resolvedWorkTransferPacketId;
635
- }
636
- }
637
-
638
- if (shouldMoveOwnership) {
639
- const transferSurface = typeof this.transferWorkPacket === 'function'
640
- ? this.transferWorkPacket.bind(this)
641
- : null;
642
- if (!transferSurface) missingSurfaces.push('transferWorkPacket');
643
- if (transferSurface) {
644
- const transferResult = await transferSurface({
645
- workflowRunId: normalizedWorkflowRunId,
646
- transferKind: 'upstream_remediation',
647
- objective: normalizedBlockerSummary,
648
- requestedOutcome: normalizedExpectedResponse,
649
- target: {
650
- intent: 'upstream_remediation',
651
- recipient_mode: normalizedAssignedTo ? 'agent_session' : 'role',
652
- preferred_agent_session_id: normalizedAssignedTo,
653
- preferred_role_key: normalizedAssignedTo || normalizedWatcherRole,
654
- },
655
- artifacts: [],
656
- issues: [],
657
- expectedEvidence: [],
658
- preferredModes: ['bundle', 'artifact_refs', 'inline_payload'],
659
- capabilities: {},
660
- senderAgentSessionId: this.agentSessionId,
661
- senderActorSessionId: null,
662
- subject: normalizedBlockerSummary,
663
- bodyMarkdown: cleanText(reply_body_markdown) || cleanText(replyBodyMarkdown) || normalizedBlockerDetails,
664
- messageKind: normalizedExpectedMessageKind,
665
- metadata: {
666
- ...normalizedMetadata,
667
- source: 'createCrossAgentRemediationTicket',
668
- source_ref: normalizedSourceRef,
669
- assigned_to: normalizedAssignedTo,
670
- requested_by: normalizedRequestedBy,
671
- },
672
- });
673
- const transferPayload = isPlainObject(transferResult) ? transferResult : {};
674
- resolvedWorkTransferPacketId = cleanText(transferPayload.work_transfer_packet?.work_transfer_packet_id)
675
- || cleanText(transferPayload.work_transfer_packet_id)
676
- || cleanText(transferPayload.transfer_packet_id)
677
- || cleanText(transferPayload.packet_id)
678
- || resolvedWorkTransferPacketId;
679
- resolvedTransferChannelId = cleanText(transferPayload.communication_transfer_channel?.transfer_channel_id)
680
- || cleanText(transferPayload.communication_transfer_channel?.channel_id)
681
- || cleanText(transferPayload.channel_id)
682
- || resolvedTransferChannelId;
683
- }
684
- }
685
-
686
- if (!resolvedTransferChannelId) {
687
- throw new Error('channel ownership is ambiguous.');
688
- }
689
- if (!resolvedWorkTransferPacketId) {
690
- throw new Error('work_transfer_packet_id is required.');
691
- }
692
-
693
- const blockerSurface = typeof this.raiseCollaborationBlocker === 'function'
694
- ? this.raiseCollaborationBlocker.bind(this)
695
- : null;
696
- if (!blockerSurface) missingSurfaces.push('raiseCollaborationBlocker');
697
- const blockerResult = blockerSurface && resolvedTransferChannelId
698
- ? await blockerSurface({
699
- transferChannelId: resolvedTransferChannelId,
700
- workTransferPacketId: resolvedWorkTransferPacketId,
701
- workflowRunId: normalizedWorkflowRunId,
702
- participantRole: normalizedParticipantRole,
703
- blockerKind: normalizedBlockerKind,
704
- blockerState: 'open',
705
- blockedSide: normalizedWatcherRole,
706
- blockerSummary: normalizedBlockerSummary,
707
- blockerDetails: normalizedBlockerDetails,
708
- expectedNextUpdate: normalizedExpectedResponse,
709
- nextOwner: normalizedAssignedTo,
710
- reviewerAgentSessionId: this.agentSessionId,
711
- reviewerActorSessionId: null,
712
- metadata: {
713
- ...normalizedMetadata,
714
- source: 'createCrossAgentRemediationTicket',
715
- source_ref: normalizedSourceRef,
716
- assigned_to: normalizedAssignedTo,
717
- requested_by: normalizedRequestedBy,
718
- },
719
- })
720
- : null;
721
-
722
- const proposalIdCandidate = cleanText(collaboration_proposal_id) || cleanText(collaborationProposalId) || cleanText(proposal_id) || cleanText(proposalId);
723
- const proposalSurface = proposalIdCandidate && typeof this.reviewCollaborationProposal === 'function'
724
- ? this.reviewCollaborationProposal.bind(this)
725
- : null;
726
- if (proposalIdCandidate && !proposalSurface) missingSurfaces.push('reviewCollaborationProposal');
727
- const proposalResult = proposalSurface && resolvedTransferChannelId
728
- ? await proposalSurface({
729
- transferChannelId: resolvedTransferChannelId,
730
- collaborationProposalId: proposalIdCandidate,
731
- decision: 'accept',
732
- nextOwner: normalizedAssignedTo,
733
- phase: 'remediation',
734
- decisionReason: normalizedBlockerSummary,
735
- evidenceRefs: normalizedReplyEvidenceRefs,
736
- reviewerRole: normalizedParticipantRole,
737
- reviewerAgentSessionId: this.agentSessionId,
738
- reviewerActorSessionId: null,
739
- reviewedByClaimId: null,
740
- metadata: {
741
- ...normalizedMetadata,
742
- source: 'createCrossAgentRemediationTicket',
743
- source_ref: normalizedSourceRef,
744
- },
745
- })
746
- : null;
747
-
748
- const watchSurface = typeof this.startMessageWatch === 'function'
749
- ? this.startMessageWatch.bind(this)
750
- : null;
751
- if (!watchSurface) missingSurfaces.push('startMessageWatch');
752
- const watchResult = watchSurface && resolvedTransferChannelId && resolvedWorkTransferPacketId
753
- ? await watchSurface({
754
- transferChannelId: resolvedTransferChannelId,
755
- workTransferPacketId: resolvedWorkTransferPacketId,
756
- workflowRunId: normalizedWorkflowRunId,
757
- watchingAgentRole: normalizedWatcherRole,
758
- expectedFromRole: normalizedAssignedTo || normalizedParticipantRole,
759
- expectedMessageKind: normalizedExpectedMessageKind,
760
- watchType: 'expected_peer_message',
761
- watchingAgentSessionId: this.agentSessionId,
762
- expectedPayload: {
763
- source_ref: normalizedSourceRef,
764
- severity: normalizedSeverity,
765
- assigned_to: normalizedAssignedTo,
766
- requested_by: normalizedRequestedBy,
767
- },
768
- currentStatus: 'watching',
769
- operatorNudge: normalizedExpectedResponse,
770
- metadata: {
771
- ...normalizedMetadata,
772
- source: 'createCrossAgentRemediationTicket',
773
- },
774
- })
775
- : null;
776
-
777
- const heartbeatSurface = typeof this.postCollaborationHeartbeat === 'function'
778
- ? this.postCollaborationHeartbeat.bind(this)
779
- : typeof this.postAgentHeartbeat === 'function'
780
- ? this.postAgentHeartbeat.bind(this)
781
- : null;
782
- if (!heartbeatSurface) missingSurfaces.push('postCollaborationHeartbeat');
783
- const heartbeatResult = heartbeatSurface && resolvedTransferChannelId && resolvedWorkTransferPacketId
784
- ? await heartbeatSurface({
785
- transferChannelId: resolvedTransferChannelId,
786
- workTransferPacketId: resolvedWorkTransferPacketId,
787
- workflowRunId: normalizedWorkflowRunId,
788
- participantRole: normalizedParticipantRole,
789
- activityState: 'active',
790
- agentSessionId: this.agentSessionId,
791
- currentPhase: 'remediation',
792
- currentTaskSummary: normalizedBlockerSummary,
793
- isActive: true,
794
- metadata: {
795
- ...normalizedMetadata,
796
- source: 'createCrossAgentRemediationTicket',
797
- },
798
- })
799
- : null;
800
-
801
- const transferChannelProjectionSurface = typeof this.getTransferChannelProjection === 'function'
802
- ? this.getTransferChannelProjection.bind(this)
803
- : typeof this.getLogaTransferChannelThreadProjection === 'function'
804
- ? this.getLogaTransferChannelThreadProjection.bind(this)
805
- : null;
806
- if (!transferChannelProjectionSurface) missingSurfaces.push('getTransferChannelProjection');
807
- const transferChannelProjection = includeTransferChannelProjection && transferChannelProjectionSurface && resolvedTransferChannelId
808
- ? await transferChannelProjectionSurface(resolvedTransferChannelId).catch(() => null)
809
- : null;
810
-
811
- const blockerPayload = isPlainObject(blockerResult) ? blockerResult : {};
812
- const proposalPayload = isPlainObject(proposalResult) ? proposalResult : {};
813
- const watchPayload = isPlainObject(watchResult) ? watchResult : {};
814
- const heartbeatPayload = isPlainObject(heartbeatResult) ? heartbeatResult : {};
815
- const blockerRecord = isPlainObject(blockerPayload.collaboration_blocker)
816
- ? blockerPayload.collaboration_blocker
817
- : blockerPayload;
818
- const watchRecord = isPlainObject(watchPayload.message_watch)
819
- ? watchPayload.message_watch
820
- : watchPayload;
821
- const heartbeatRecord = isPlainObject(heartbeatPayload.collaboration_heartbeat)
822
- ? heartbeatPayload.collaboration_heartbeat
823
- : heartbeatPayload;
824
-
825
- const blockerRecordId = cleanText(blockerRecord.collaboration_blocker_id)
826
- || cleanText(blockerRecord.blocker_id)
827
- || cleanText(blockerPayload.collaboration_blocker_id)
828
- || cleanText(blockerPayload.blocker_id)
829
- || null;
830
- const remediationTicketId = cleanText(transferChannelProjection?.remediation_ticket_id)
831
- || cleanText(transferChannelProjection?.work_transfer_packet_id)
832
- || cleanText(transferChannelProjection?.transfer_packet_id)
833
- || resolvedWorkTransferPacketId
834
- || null;
835
- const watchId = cleanText(watchRecord.message_watch_id)
836
- || cleanText(watchRecord.watch_id)
837
- || null;
838
- const heartbeatStatus = cleanText(heartbeatRecord.activity_state)
839
- || cleanText(heartbeatRecord.status)
840
- || 'active';
841
- const waitingSide = cleanText(watchRecord.waiting_side)
842
- || cleanText(blockerRecord.blocked_side)
843
- || cleanText(proposalPayload.next_owner)
844
- || normalizedWatcherRole;
845
- const expectedResponseText = cleanText(blockerRecord.expected_next_update)
846
- || cleanText(watchRecord.expected_message_kind)
847
- || cleanText(heartbeatRecord.expected_message_kind)
848
- || normalizedExpectedResponse;
849
- const status = missingSurfaces.length > 0 ? 'partial' : 'ready';
850
- const operatorProjectionMetadata = includeOperatorProjectionMetadata
851
- ? {
852
- transfer_channel_projection: transferChannelProjection,
853
- blocker: blockerPayload,
854
- proposal: proposalPayload,
855
- message_watch: watchPayload,
856
- heartbeat: heartbeatPayload,
857
- }
858
- : null;
859
-
860
- return {
861
- status,
862
- remediation_ticket_id: remediationTicketId,
863
- blocker_id: blockerRecordId,
864
- channel_id: resolvedTransferChannelId || null,
865
- transfer_packet_id: resolvedWorkTransferPacketId || null,
866
- assigned_to: normalizedAssignedTo,
867
- requested_by: normalizedRequestedBy,
868
- severity: normalizedSeverity,
869
- source_ref: normalizedSourceRef,
870
- expected_response: expectedResponseText,
871
- watch_id: watchId,
872
- heartbeat_status: heartbeatStatus,
873
- operator_projection_metadata: operatorProjectionMetadata,
874
- missing_surfaces: [...new Set(missingSurfaces)],
875
- resume_channel: resumedChannel,
876
- blocker: blockerPayload,
877
- proposal: proposalPayload,
878
- watch: watchPayload,
879
- heartbeat: heartbeatPayload,
880
- };
584
+ return this.communicationTickets.createCrossAgentRemediationTicket(arguments[0]);
881
585
  }
882
586
 
883
- async transferRefactoringBundle({
884
- projectIdentifier,
885
- projectId,
886
- startWorkBody = {},
887
- startWorkRequest = {},
888
- resumeProjectWorkOptions = {},
889
- transferChannelId,
890
- transfer_channel_id,
891
- channelId,
892
- channel_id,
893
- workTransferPacketId,
894
- work_transfer_packet_id,
895
- workflowRunId,
896
- workflow_run_id,
897
- sourceAgent,
898
- source_agent,
899
- sourceAgentSessionId,
900
- source_agent_session_id,
901
- targetAgent,
902
- target_agent,
903
- targetAgentSessionId,
904
- target_agent_session_id,
905
- targetAgentLabel,
906
- target_agent_label,
907
- sourceRef,
908
- source_ref,
909
- problemStatement,
910
- problem_statement,
911
- affectedFilesOrSymbols,
912
- affected_files_or_symbols,
913
- recommendedAction,
914
- recommended_action,
915
- acceptanceCriteria,
916
- acceptance_criteria,
917
- evidenceRefs = [],
918
- evidence_refs = [],
919
- riskLevel,
920
- risk_level,
921
- handoffNotes,
922
- handoff_notes,
923
- ownershipAssignment = {},
924
- ownership_assignment = {},
925
- proposal = {},
926
- refactoringBundle = {},
927
- refactoring_bundle = {},
928
- participantRole,
929
- participant_role,
930
- includeTransferChannelProjection = true,
931
- includeOperatorProjectionMetadata = true,
932
- metadata = {},
933
- } = {}) {
934
- const missingSurfaces = [];
935
- const normalizedMetadata = isPlainObject(metadata) ? metadata : {};
936
- const normalizedBundle = isPlainObject(refactoring_bundle)
937
- ? refactoring_bundle
938
- : (isPlainObject(refactoringBundle) ? refactoringBundle : {});
939
- const normalizedOwnershipAssignment = isPlainObject(ownership_assignment)
940
- ? ownership_assignment
941
- : (isPlainObject(ownershipAssignment) ? ownershipAssignment : {});
942
- const normalizedProposal = isPlainObject(proposal) ? proposal : {};
943
- const normalizedProjectReference = cleanText(projectIdentifier) || cleanText(projectId);
944
- const normalizedSourceAgent = cleanText(source_agent) || cleanText(sourceAgent) || this.agentSessionId || this.actorId;
945
- const normalizedTargetAgent = cleanText(target_agent) || cleanText(targetAgent) || cleanText(target_agent_session_id) || cleanText(targetAgentSessionId);
946
- const normalizedTargetLabel = cleanText(target_agent_label) || cleanText(targetAgentLabel) || normalizedTargetAgent;
947
- const normalizedParticipantRole = cleanText(participant_role) || cleanText(participantRole) || 'requester';
948
- const normalizedSourceRef = cleanText(source_ref) || cleanText(sourceRef) || cleanText(normalizedBundle.source_ref);
949
- const normalizedProblemStatement = cleanText(problem_statement) || cleanText(problemStatement) || cleanText(normalizedBundle.problem_statement);
950
- const normalizedAffectedFiles = Array.isArray(affected_files_or_symbols)
951
- ? affected_files_or_symbols
952
- : (Array.isArray(affectedFilesOrSymbols) ? affectedFilesOrSymbols : normalizedBundle.affected_files_or_symbols || []);
953
- const normalizedRecommendedAction = cleanText(recommended_action) || cleanText(recommendedAction) || cleanText(normalizedBundle.recommended_action);
954
- const normalizedAcceptanceCriteria = Array.isArray(acceptance_criteria)
955
- ? acceptance_criteria
956
- : (Array.isArray(acceptanceCriteria) ? acceptanceCriteria : normalizedBundle.acceptance_criteria || []);
957
- const normalizedEvidenceRefs = Array.isArray(evidence_refs) ? evidence_refs : (Array.isArray(evidenceRefs) ? evidenceRefs : normalizedBundle.evidence_refs || []);
958
- const normalizedRiskLevel = cleanText(risk_level) || cleanText(riskLevel) || cleanText(normalizedBundle.risk_level) || 'medium';
959
- const normalizedHandoffNotes = cleanText(handoff_notes) || cleanText(handoffNotes) || cleanText(normalizedBundle.handoff_notes);
960
- const shouldMoveOwnership = Boolean(normalizedTargetAgent || normalizedOwnershipAssignment.owner_agent_session_id);
961
- if (!normalizedTargetAgent) {
962
- throw new Error('target_agent is required.');
963
- }
964
-
965
- let continuation = null;
966
- let startWorkResult = null;
967
- if (normalizedProjectReference) {
968
- if (typeof this.resumeProjectWork === 'function') {
969
- continuation = await this.resumeProjectWork({
970
- projectIdentifier: normalizedProjectReference,
971
- projectId: normalizedProjectReference,
972
- requireClaim: false,
973
- ...resumeProjectWorkOptions,
974
- ...normalizedMetadata.resume_project_work_options,
975
- });
976
- } else {
977
- missingSurfaces.push('resumeProjectWork');
978
- }
979
- } else if (Object.keys(isPlainObject(startWorkRequest) ? startWorkRequest : {}).length > 0 || Object.keys(isPlainObject(startWorkBody) ? startWorkBody : {}).length > 0) {
980
- if (typeof this.startWork === 'function') {
981
- startWorkResult = await this.startWork({
982
- ...(isPlainObject(startWorkBody) ? startWorkBody : {}),
983
- ...(isPlainObject(startWorkRequest) ? startWorkRequest : {}),
984
- });
985
- } else {
986
- missingSurfaces.push('startWork');
987
- }
988
- } else {
989
- throw new Error('projectIdentifier is required.');
990
- }
991
-
992
- const projectPayload = isPlainObject(continuation?.project)
993
- ? continuation.project
994
- : isPlainObject(startWorkResult?.project)
995
- ? startWorkResult.project
996
- : isPlainObject(continuation?.summary)
997
- ? continuation.summary
998
- : {};
999
- const resolvedProjectId = cleanText(projectPayload.project_id) || cleanText(projectPayload.projectId) || normalizedProjectReference;
1000
- const resolvedWorkflowId = cleanText(projectPayload.workflow_id) || cleanText(projectPayload.workflowId) || cleanText(continuation?.workflow_id) || cleanText(startWorkResult?.workflow_id);
1001
- const resolvedWorkflowRunId = cleanText(projectPayload.workflow_run_id) || cleanText(projectPayload.workflowRunId) || cleanText(continuation?.workflow_run_id) || cleanText(startWorkResult?.workflow_run_id) || cleanText(startWorkResult?.workflowRunId) || cleanText(workflow_run_id) || cleanText(workflowRunId);
1002
- if (!resolvedProjectId || !resolvedWorkflowRunId) {
1003
- throw new Error('project/work identifiers are ambiguous.');
1004
- }
1005
-
1006
- const transferSurface = typeof this.transferWorkPacket === 'function'
1007
- ? this.transferWorkPacket.bind(this)
1008
- : null;
1009
- if (!transferSurface) missingSurfaces.push('transferWorkPacket');
1010
- const transferResult = transferSurface
1011
- ? await transferSurface({
1012
- workflowRunId: resolvedWorkflowRunId,
1013
- transferKind: 'upstream_remediation',
1014
- objective: normalizedProblemStatement || normalizedRecommendedAction || 'Refactoring bundle transfer',
1015
- requestedOutcome: normalizedRecommendedAction || normalizedProblemStatement || 'Receive refactoring bundle acknowledgement.',
1016
- target: {
1017
- intent: 'upstream_remediation',
1018
- recipient_mode: 'agent_session',
1019
- preferred_agent_session_id: normalizedTargetAgent,
1020
- preferred_role_key: normalizedTargetLabel,
1021
- },
1022
- artifacts: normalizedAffectedFiles,
1023
- issues: [],
1024
- expectedEvidence: normalizedAcceptanceCriteria,
1025
- preferredModes: ['bundle', 'artifact_refs', 'inline_payload'],
1026
- capabilities: {},
1027
- senderAgentSessionId: normalizedSourceAgent,
1028
- senderActorSessionId: null,
1029
- subject: normalizedProblemStatement || normalizedRecommendedAction || 'Refactoring bundle transfer',
1030
- bodyMarkdown: normalizedHandoffNotes || normalizedRecommendedAction || normalizedProblemStatement,
1031
- messageKind: 'handoff',
1032
- metadata: {
1033
- ...normalizedMetadata,
1034
- source: 'transferRefactoringBundle',
1035
- source_ref: normalizedSourceRef,
1036
- risk_level: normalizedRiskLevel,
1037
- },
1038
- })
1039
- : null;
1040
- const transferPayload = isPlainObject(transferResult) ? transferResult : {};
1041
- let resolvedWorkTransferPacketId = cleanText(work_transfer_packet_id)
1042
- || cleanText(workTransferPacketId)
1043
- || cleanText(transferPayload.work_transfer_packet?.work_transfer_packet_id)
1044
- || cleanText(transferPayload.work_transfer_packet_id)
1045
- || cleanText(transferPayload.transfer_packet_id)
1046
- || cleanText(transferPayload.packet_id)
1047
- || null;
1048
- const transferChannel = isPlainObject(transferPayload.communication_transfer_channel) ? transferPayload.communication_transfer_channel : {};
1049
- let resolvedTransferChannelId = cleanText(transfer_channel_id)
1050
- || cleanText(transferChannelId)
1051
- || cleanText(channel_id)
1052
- || cleanText(channelId)
1053
- || cleanText(transferChannel.transfer_channel_id)
1054
- || cleanText(transferChannel.channel_id)
1055
- || null;
1056
-
1057
- const shouldResumeChannel = Boolean(cleanText(transfer_channel_id) || cleanText(transferChannelId) || cleanText(channel_id) || cleanText(channelId));
1058
- const channelSurface = shouldResumeChannel
1059
- ? (typeof this.resumeTransferChannel === 'function'
1060
- ? this.resumeTransferChannel.bind(this)
1061
- : null)
1062
- : (typeof this.openTransferChannel === 'function'
1063
- ? this.openTransferChannel.bind(this)
1064
- : null);
1065
- if (!channelSurface) missingSurfaces.push(shouldResumeChannel ? 'resumeTransferChannel' : 'openTransferChannel');
1066
- const channelResult = channelSurface && resolvedWorkTransferPacketId
1067
- ? await channelSurface({
1068
- transferChannelId: resolvedTransferChannelId,
1069
- workTransferPacketId: resolvedWorkTransferPacketId,
1070
- workflowRunId: resolvedWorkflowRunId,
1071
- channelKind: 'bidirectional',
1072
- downstreamAgentSessionId: normalizedTargetAgent,
1073
- downstreamActorSessionId: null,
1074
- upstreamAgentSessionId: normalizedSourceAgent,
1075
- upstreamActorSessionId: null,
1076
- evidenceRequiredForClosure: true,
1077
- metadata: {
1078
- ...normalizedMetadata,
1079
- source: 'transferRefactoringBundle',
1080
- },
1081
- })
1082
- : null;
1083
- const channelPayload = isPlainObject(channelResult) ? channelResult : {};
1084
- resolvedTransferChannelId = cleanText(channelPayload.transfer_channel_id)
1085
- || cleanText(channelPayload.channel_id)
1086
- || cleanText(channelPayload.transfer_channel?.transfer_channel_id)
1087
- || cleanText(channelPayload.communication_transfer_channel?.transfer_channel_id)
1088
- || resolvedTransferChannelId;
1089
-
1090
- const ownershipSurface = typeof this.assignCollaborationOwnership === 'function'
1091
- ? this.assignCollaborationOwnership.bind(this)
1092
- : null;
1093
- if (!ownershipSurface) missingSurfaces.push('assignCollaborationOwnership');
1094
- const ownershipResult = ownershipSurface && resolvedTransferChannelId && normalizedTargetAgent
1095
- ? await ownershipSurface({
1096
- transferChannelId: resolvedTransferChannelId,
1097
- workTransferPacketId: resolvedWorkTransferPacketId,
1098
- workflowRunId: resolvedWorkflowRunId,
1099
- participantRole: normalizedParticipantRole,
1100
- ownerAgentSessionId: normalizedTargetAgent,
1101
- ownerActorSessionId: null,
1102
- ownerLabel: normalizedTargetLabel,
1103
- assignmentState: 'assigned',
1104
- assignmentReason: normalizedProblemStatement || normalizedRecommendedAction,
1105
- currentPhase: 'refactoring_bundle_transfer',
1106
- assignedByAgentSessionId: normalizedSourceAgent,
1107
- assignedByActorSessionId: null,
1108
- metadata: {
1109
- ...normalizedMetadata,
1110
- source: 'transferRefactoringBundle',
1111
- source_ref: normalizedSourceRef,
1112
- },
1113
- })
1114
- : null;
1115
- const ownershipPayload = isPlainObject(ownershipResult) ? ownershipResult : {};
1116
-
1117
- const proposalSurface = typeof this.postCollaborationProposal === 'function'
1118
- ? this.postCollaborationProposal.bind(this)
1119
- : null;
1120
- if (!proposalSurface) missingSurfaces.push('postCollaborationProposal');
1121
- const proposalResult = proposalSurface && resolvedTransferChannelId && resolvedWorkTransferPacketId
1122
- ? await proposalSurface({
1123
- transferChannelId: resolvedTransferChannelId,
1124
- workTransferPacketId: resolvedWorkTransferPacketId,
1125
- workflowRunId: resolvedWorkflowRunId,
1126
- proposalKind: 'refactoring_bundle',
1127
- proposalState: 'proposed',
1128
- participantRole: normalizedParticipantRole,
1129
- proposalSummary: normalizedProblemStatement || normalizedRecommendedAction || 'Refactoring bundle transfer',
1130
- currentPhase: 'refactoring_bundle_transfer',
1131
- expectedNextUpdate: normalizedAcceptanceCriteria.join('; ') || normalizedRecommendedAction,
1132
- requiredEvidence: normalizedAcceptanceCriteria,
1133
- responseSchema: {
1134
- source_ref: normalizedSourceRef,
1135
- risk_level: normalizedRiskLevel,
1136
- target_agent: normalizedTargetAgent,
1137
- },
1138
- blockerSummary: normalizedProblemStatement || normalizedRecommendedAction,
1139
- revisionNumber: 1,
1140
- proposerAgentSessionId: normalizedSourceAgent,
1141
- proposerActorSessionId: null,
1142
- metadata: {
1143
- ...normalizedMetadata,
1144
- source: 'transferRefactoringBundle',
1145
- affected_files_or_symbols: normalizedAffectedFiles,
1146
- },
1147
- })
1148
- : null;
1149
- const proposalPayload = isPlainObject(proposalResult) ? proposalResult : {};
1150
-
1151
- const watchSurface = typeof this.startMessageWatch === 'function'
1152
- ? this.startMessageWatch.bind(this)
1153
- : null;
1154
- if (!watchSurface) missingSurfaces.push('startMessageWatch');
1155
- const watchResult = watchSurface && resolvedTransferChannelId && resolvedWorkTransferPacketId
1156
- ? await watchSurface({
1157
- transferChannelId: resolvedTransferChannelId,
1158
- workTransferPacketId: resolvedWorkTransferPacketId,
1159
- workflowRunId: resolvedWorkflowRunId,
1160
- watchingAgentRole: normalizedSourceAgent,
1161
- expectedFromRole: normalizedTargetAgent,
1162
- expectedMessageKind: 'response',
1163
- watchType: 'expected_peer_message',
1164
- watchingAgentSessionId: normalizedSourceAgent,
1165
- expectedPayload: {
1166
- source_ref: normalizedSourceRef,
1167
- expected_acknowledgement: 'refactoring bundle received',
1168
- target_agent: normalizedTargetAgent,
1169
- },
1170
- currentStatus: 'watching',
1171
- operatorNudge: normalizedHandoffNotes || normalizedRecommendedAction || normalizedProblemStatement,
1172
- metadata: {
1173
- ...normalizedMetadata,
1174
- source: 'transferRefactoringBundle',
1175
- },
1176
- })
1177
- : null;
1178
- const watchPayload = isPlainObject(watchResult) ? watchResult : {};
1179
-
1180
- const heartbeatSurface = typeof this.postCollaborationHeartbeat === 'function'
1181
- ? this.postCollaborationHeartbeat.bind(this)
1182
- : typeof this.postAgentHeartbeat === 'function'
1183
- ? this.postAgentHeartbeat.bind(this)
1184
- : null;
1185
- if (!heartbeatSurface) missingSurfaces.push('postCollaborationHeartbeat');
1186
- const heartbeatResult = heartbeatSurface && resolvedTransferChannelId && resolvedWorkTransferPacketId
1187
- ? await heartbeatSurface({
1188
- transferChannelId: resolvedTransferChannelId,
1189
- workTransferPacketId: resolvedWorkTransferPacketId,
1190
- workflowRunId: resolvedWorkflowRunId,
1191
- participantRole: normalizedParticipantRole,
1192
- activityState: 'active',
1193
- agentSessionId: normalizedSourceAgent,
1194
- currentPhase: 'refactoring_bundle_transfer',
1195
- currentTaskSummary: normalizedProblemStatement || normalizedRecommendedAction || 'Refactoring bundle transfer',
1196
- isActive: true,
1197
- metadata: {
1198
- ...normalizedMetadata,
1199
- source: 'transferRefactoringBundle',
1200
- },
1201
- })
1202
- : null;
1203
- const heartbeatPayload = isPlainObject(heartbeatResult) ? heartbeatResult : {};
1204
-
1205
- const transferChannelProjectionSurface = typeof this.getTransferChannelProjection === 'function'
1206
- ? this.getTransferChannelProjection.bind(this)
1207
- : typeof this.getLogaTransferChannelThreadProjection === 'function'
1208
- ? this.getLogaTransferChannelThreadProjection.bind(this)
1209
- : null;
1210
- if (!transferChannelProjectionSurface) missingSurfaces.push('getTransferChannelProjection');
1211
- const transferChannelProjection = includeTransferChannelProjection && transferChannelProjectionSurface && resolvedTransferChannelId
1212
- ? await transferChannelProjectionSurface(resolvedTransferChannelId).catch(() => null)
1213
- : null;
1214
-
1215
- const transferPacketId = cleanText(transferPayload.work_transfer_packet?.work_transfer_packet_id)
1216
- || cleanText(transferPayload.work_transfer_packet_id)
1217
- || cleanText(transferPayload.transfer_packet_id)
1218
- || cleanText(transferPayload.packet_id)
1219
- || resolvedWorkTransferPacketId
1220
- || null;
1221
- const channelIdResolved = resolvedTransferChannelId || cleanText(channelPayload.transfer_channel_id) || cleanText(channelPayload.channel_id) || null;
1222
- const ownershipAssignmentId = cleanText(ownershipPayload.collaboration_ownership_assignment_id)
1223
- || cleanText(ownershipPayload.ownership_assignment_id)
1224
- || cleanText(ownershipPayload.collaboration_ownership_assignment?.collaboration_ownership_assignment_id)
1225
- || cleanText(ownershipPayload.collaboration_ownership_assignment?.ownership_assignment_id)
1226
- || null;
1227
- const proposalId = cleanText(proposalPayload.collaboration_proposal_id)
1228
- || cleanText(proposalPayload.proposal_id)
1229
- || cleanText(proposalPayload.collaboration_proposal?.collaboration_proposal_id)
1230
- || cleanText(proposalPayload.collaboration_proposal?.proposal_id)
1231
- || null;
1232
- const watchId = cleanText(watchPayload.message_watch_id)
1233
- || cleanText(watchPayload.watch_id)
1234
- || cleanText(watchPayload.message_watch?.message_watch_id)
1235
- || cleanText(watchPayload.message_watch?.watch_id)
1236
- || null;
1237
- const heartbeatStatus = cleanText(heartbeatPayload.collaboration_heartbeat?.activity_state)
1238
- || cleanText(heartbeatPayload.activity_state)
1239
- || cleanText(heartbeatPayload.status)
1240
- || cleanText(heartbeatPayload.collaboration_heartbeat?.status)
1241
- || 'active';
1242
- const expectedAcknowledgement = cleanText(watchPayload.expected_message_kind)
1243
- || cleanText(watchPayload.message_watch?.expected_message_kind)
1244
- || cleanText(watchPayload.message_watch?.expected_acknowledgement)
1245
- || 'response';
1246
- const operatorProjectionMetadata = includeOperatorProjectionMetadata
1247
- ? {
1248
- transfer_channel_projection: transferChannelProjection,
1249
- transfer: transferPayload,
1250
- channel: channelPayload,
1251
- ownership_assignment: ownershipPayload,
1252
- proposal: proposalPayload,
1253
- message_watch: watchPayload,
1254
- heartbeat: heartbeatPayload,
1255
- }
1256
- : null;
1257
-
1258
- return {
1259
- status: missingSurfaces.length > 0 ? 'partial' : 'ready',
1260
- project_id: resolvedProjectId,
1261
- source_agent: normalizedSourceAgent,
1262
- target_agent: normalizedTargetAgent,
1263
- transfer_packet_id: transferPacketId,
1264
- channel_id: channelIdResolved,
1265
- ownership_assignment_id: ownershipAssignmentId,
1266
- proposal_id: proposalId,
1267
- watch_id: watchId,
1268
- expected_acknowledgement: expectedAcknowledgement,
1269
- heartbeat_status: heartbeatStatus,
1270
- operator_projection_metadata: operatorProjectionMetadata,
1271
- missing_surfaces: [...new Set(missingSurfaces)],
1272
- transfer: transferPayload,
1273
- channel: channelPayload,
1274
- ownership_assignment: ownershipPayload,
1275
- proposal: proposalPayload,
1276
- message_watch: watchPayload,
1277
- heartbeat: heartbeatPayload,
1278
- };
1279
- }
1280
-
1281
- async _resolveMessageWatchId(request = {}) {
1282
- return this.messageWatch.resolveMessageWatchId(request);
1283
- }
1284
-
1285
- async acceptAgentChannel(request = {}) {
1286
- return this.messageWatch.acceptAgentChannel(request);
587
+ async transferRefactoringBundle(request = {}) {
588
+ return this.refactoringTransfers.transferRefactoringBundle(request);
1287
589
  }
1288
590
 
1289
591
  async postAgentHeartbeat(request = {}) {
@@ -1332,10 +634,6 @@ export class AIEngineClient {
1332
634
  return this.transferChannels.closeAgentChannel(request);
1333
635
  }
1334
636
 
1335
- async respondToMessageWatch(request = {}) {
1336
- return this.messageWatch.respondToMessageWatch(request);
1337
- }
1338
-
1339
637
  async reviseCollaborationProposal(request = {}) {
1340
638
  return this.collaborationDomain.reviseCollaborationProposal(request);
1341
639
  }
@@ -1348,10 +646,6 @@ export class AIEngineClient {
1348
646
  return this.collaborationDomain.beginCollaborationImplementation(request);
1349
647
  }
1350
648
 
1351
- async requestCollaborationClosure(request = {}) {
1352
- return this.collaborationDomain.requestCollaborationClosure(request);
1353
- }
1354
-
1355
649
  async bootstrapCommunication() {
1356
650
  return this._request('/api/agent-communications/bootstrap');
1357
651
  }
@@ -1510,18 +804,6 @@ export class AIEngineClient {
1510
804
  });
1511
805
  }
1512
806
 
1513
- async postCollaborationProposal(request = {}) {
1514
- return this.collaborationDomain.postCollaborationProposal(request);
1515
- }
1516
-
1517
- async assignCollaborationOwnership(request = {}) {
1518
- return this.collaborationDomain.assignCollaborationOwnership(request);
1519
- }
1520
-
1521
- async transferWorkPacket(request = {}) {
1522
- return this.transferBundles.transferWorkPacket(request);
1523
- }
1524
-
1525
807
  async openCommunicationThread({
1526
808
  workflowRunId,
1527
809
  workflow_run_id,
@@ -1590,42 +872,6 @@ export class AIEngineClient {
1590
872
  });
1591
873
  }
1592
874
 
1593
- async whoIsOnline(request = {}) {
1594
- return this.presence.whoIsOnline(request);
1595
- }
1596
-
1597
- async findOnlineParticipant(request = {}) {
1598
- return this.presence.findOnlineParticipant(request);
1599
- }
1600
-
1601
- async sendToParticipant(request = {}) {
1602
- return this.presence.sendToParticipant(request);
1603
- }
1604
-
1605
- async sendToRole(request = {}) {
1606
- return this.presence.sendToRole(request);
1607
- }
1608
-
1609
- async startCoordinationPingPong(request = {}) {
1610
- return this.pingPong.startCoordinationPingPong(request);
1611
- }
1612
-
1613
- async sendCoordinationPing(request = {}) {
1614
- return this.pingPong.sendCoordinationPing(request);
1615
- }
1616
-
1617
- async sendCoordinationPong(request = {}) {
1618
- return this.pingPong.sendCoordinationPong(request);
1619
- }
1620
-
1621
- async getCoordinationPingPongStatus(request = {}) {
1622
- return this.pingPong.getCoordinationPingPongStatus(request);
1623
- }
1624
-
1625
- async stopCoordinationPingPong(request = {}) {
1626
- return this.pingPong.stopCoordinationPingPong(request);
1627
- }
1628
-
1629
875
  async verifyMessageSent({ messageId, message_id } = {}) {
1630
876
  const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
1631
877
  if (!normalizedMessageId) throw new Error('message_id is required.');
@@ -1754,46 +1000,6 @@ export class AIEngineClient {
1754
1000
  });
1755
1001
  }
1756
1002
 
1757
- async createCommunicationBundle(request = {}) {
1758
- return this.transferBundles.createCommunicationBundle(request);
1759
- }
1760
-
1761
- async getCommunicationBundle(bundleId) {
1762
- return this.transferBundles.getCommunicationBundle(bundleId);
1763
- }
1764
-
1765
- async listCommunicationBundles(request = {}) {
1766
- return this.transferBundles.listCommunicationBundles(request);
1767
- }
1768
-
1769
- async addCommunicationBundleItem(request = {}) {
1770
- return this.transferBundles.addCommunicationBundleItem(request);
1771
- }
1772
-
1773
- async uploadCommunicationBundle(request = {}) {
1774
- return this.transferBundles.uploadCommunicationBundle(request);
1775
- }
1776
-
1777
- async attachCommunicationBundleToMessage(request = {}) {
1778
- return this.transferBundles.attachCommunicationBundleToMessage(request);
1779
- }
1780
-
1781
- async recordCommunicationBundleReceipt(request = {}) {
1782
- return this.transferBundles.recordCommunicationBundleReceipt(request);
1783
- }
1784
-
1785
- async recordCommunicationBundleCleanupEvent(request = {}) {
1786
- return this.transferBundles.recordCommunicationBundleCleanupEvent(request);
1787
- }
1788
-
1789
- async claimCommunicationBundle(request = {}) {
1790
- return this.transferBundles.claimCommunicationBundle(request);
1791
- }
1792
-
1793
- async recordCommunicationTransferReceipt(request = {}) {
1794
- return this.transferBundles.recordCommunicationTransferReceipt(request);
1795
- }
1796
-
1797
1003
  async acceptCommunicationTransferPacket({
1798
1004
  workTransferPacketId,
1799
1005
  work_transfer_packet_id,
@@ -1982,76 +1188,28 @@ export class AIEngineClient {
1982
1188
  });
1983
1189
  }
1984
1190
 
1985
- async getPortfolioClosureReadiness(...args) {
1986
- return this.portfolio.getPortfolioClosureReadiness(...args);
1987
- }
1988
-
1989
- async getPortfolioStatus(...args) {
1990
- return this.portfolio.getPortfolioStatus(...args);
1991
- }
1992
-
1993
1191
  async describeDatabaseCatalog({ includeSystemSchemas, limit } = {}) {
1994
- return this._request('/api/operator/database/schema', {
1995
- query: {
1996
- view: 'overview',
1997
- include_system_schemas: includeSystemSchemas,
1998
- limit,
1999
- },
2000
- });
1192
+ return this.database.schema.getOverview({ includeSystemSchemas, limit });
2001
1193
  }
2002
1194
 
2003
1195
  async listDatabaseSchemas({ includeSystemSchemas, limit } = {}) {
2004
- return this._request('/api/operator/database/schema', {
2005
- query: {
2006
- view: 'schemas',
2007
- include_system_schemas: includeSystemSchemas,
2008
- limit,
2009
- },
2010
- });
1196
+ return this.database.schema.listSchemas({ includeSystemSchemas, limit });
2011
1197
  }
2012
1198
 
2013
1199
  async listDatabaseTables({ schemaName, includeSystemSchemas, limit } = {}) {
2014
- return this._request('/api/operator/database/schema', {
2015
- query: {
2016
- view: 'tables',
2017
- schema_name: schemaName,
2018
- include_system_schemas: includeSystemSchemas,
2019
- limit,
2020
- },
2021
- });
1200
+ return this.database.schema.listTables({ schemaName, includeSystemSchemas, limit });
2022
1201
  }
2023
1202
 
2024
1203
  async listDatabaseColumns({ schemaName, tableName } = {}) {
2025
- return this._request('/api/operator/database/schema', {
2026
- query: {
2027
- view: 'columns',
2028
- schema_name: schemaName,
2029
- table_name: tableName,
2030
- },
2031
- });
1204
+ return this.database.schema.listColumns({ schemaName, tableName });
2032
1205
  }
2033
1206
 
2034
1207
  async listDatabaseIndexes({ schemaName, tableName, includeSystemSchemas, limit } = {}) {
2035
- return this._request('/api/operator/database/schema', {
2036
- query: {
2037
- view: 'indexes',
2038
- schema_name: schemaName,
2039
- table_name: tableName,
2040
- include_system_schemas: includeSystemSchemas,
2041
- limit,
2042
- },
2043
- });
1208
+ return this.database.schema.listIndexes({ schemaName, tableName, includeSystemSchemas, limit });
2044
1209
  }
2045
1210
 
2046
1211
  async describeDatabaseTable({ schemaName, tableName, includeSystemSchemas } = {}) {
2047
- return this._request('/api/operator/database/schema', {
2048
- query: {
2049
- view: 'table',
2050
- schema_name: schemaName,
2051
- table_name: tableName,
2052
- include_system_schemas: includeSystemSchemas,
2053
- },
2054
- });
1212
+ return this.database.schema.describeTable({ schemaName, tableName, includeSystemSchemas });
2055
1213
  }
2056
1214
 
2057
1215
  async createDatabaseBackup({ databaseName, outputName, noWait } = {}) {
@@ -2065,10 +1223,6 @@ export class AIEngineClient {
2065
1223
  });
2066
1224
  }
2067
1225
 
2068
- async getPortfolioBundle() {
2069
- return this.portfolio.getPortfolioBundle();
2070
- }
2071
-
2072
1226
  async getExternalProjectStatus(projectId) {
2073
1227
  return this._request(`/api/v1/projects/${projectId}/status`);
2074
1228
  }
@@ -2154,94 +1308,4 @@ export class AIEngineClient {
2154
1308
  export function createAIEngineClient(options) {
2155
1309
  return new AIEngineClient(options);
2156
1310
  }
2157
- function defineCompatibilityMethods(proto, targetName, methodNames) {
2158
- for (const methodName of methodNames) {
2159
- if (Object.prototype.hasOwnProperty.call(proto, methodName)) continue;
2160
- Object.defineProperty(proto, methodName, {
2161
- value: function delegatedClientMethod(...args) {
2162
- return this[targetName][methodName](...args);
2163
- },
2164
- configurable: true,
2165
- writable: true,
2166
- });
2167
- }
2168
- }
2169
-
2170
- function defineCompatibilityAliases(proto, targetName, methodMap) {
2171
- for (const [methodName, targetMethodName] of Object.entries(methodMap)) {
2172
- if (Object.prototype.hasOwnProperty.call(proto, methodName)) continue;
2173
- Object.defineProperty(proto, methodName, {
2174
- value: function delegatedClientMethod(...args) {
2175
- return this[targetName][targetMethodName](...args);
2176
- },
2177
- configurable: true,
2178
- writable: true,
2179
- });
2180
- }
2181
- }
2182
-
2183
- function installClientCompatibilityDelegates(ClientClass) {
2184
- const proto = ClientClass.prototype;
2185
- defineCompatibilityMethods(proto, 'health', ['ping']);
2186
- defineCompatibilityMethods(proto, 'operatorStatus', ['currentWorkflowStatus', 'getCurrentWorkflowStatus', 'currentArchitectureIntegrityStatus', 'getCurrentArchitectureIntegrityStatus', 'currentSecurityGovernanceStatus', 'getCurrentSecurityGovernanceStatus', 'getExecutionTelemetryCurrent', 'listExecutionProcessRuns', 'getExecutionProcessRun', 'getGeneratedExecutionUsability', 'getLogaGeneratedExecutionUsabilityProjection', 'getAntiPatternRules', 'currentCodebaseShapeStatus', 'getLatestMemoryProjection', 'currentProjectStatus', 'getDashboard', 'getCommunicationCapabilities', 'getCollaborationCapabilities', 'getDeploymentCapabilities']);
2187
- defineCompatibilityMethods(proto, 'database', ['query', 'createDatabaseBackup', 'listDatabaseBackups', 'getDatabaseBackup', 'listDatabaseBackupOperations', 'runAzureSqlBacpacBackup', 'listAzureSqlBacpacBackups', 'listAzureSqlBacpacBackupOperations']);
2188
- defineCompatibilityMethods(proto, 'reports', ['runReport', 'runReportDefinition']);
2189
- defineCompatibilityMethods(proto, 'retrievalWrapper', ['getCommandCard', 'resolveOperatingProcedure', 'getSymbolDefinition', 'getRelatedCode']);
2190
- defineCompatibilityMethods(proto, 'repo', ['listRepositories', 'getRepository', 'listCodeFiles', 'getCodeFile', 'getCodeFileContentWindow', 'listCodeSymbolsByFile', 'getCodeSymbol', 'searchSymbols', 'getSymbolRelationships', 'listCodeRelationships', 'listActionObservations', 'listCodebaseShapeFindings', 'listObjectFlowObservations', 'getChangeAnalysis', 'listRefactorCandidates', 'analyzeRefactorCandidate', 'getRepoRetrievalPacket', 'getRepoRetrievalPacketFragments', 'evaluateProposalScope']);
2191
- defineCompatibilityMethods(proto, 'retrievalManagement', ['getRetrievalStatus', 'getRetrievalProfileMetrics', 'getRetrievalFeedbackMetrics', 'getRetrievalQuery', 'getRetrievalPacket', 'generateRetrievalCandidates', 'selectRetrievalPacket', 'recordRetrievalFeedback', 'deriveRetrievalOptimizationCandidates', 'validatePromptAssembly']);
2192
- defineCompatibilityMethods(proto, 'workflows', ['listWorkflows', 'createWorkflow', 'getWorkflow', 'replaceWorkflowSteps', 'publishWorkflow', 'cloneWorkflow', 'evaluateWorkflowGovernance', 'listWorkflowGovernanceDecisions', 'getWorkflowGovernanceSimulation', 'listWorkflowGovernanceBundles', 'listWorkflowGovernanceApprovals', 'listWorkflowGovernanceEvents', 'getWorkflowGovernanceReview', 'createWorkflowGovernanceReviewDecision', 'createWorkflowRun', 'getWorkflowRun', 'listWorkflowArtifacts', 'getWorkflowRunSubstrate', 'getWorkflowPlayback', 'resumeWorkflowRun', 'listRecentInspectorRuns', 'inspectWorkflowRun']);
2193
- defineCompatibilityMethods(proto, 'projects', ['listProjects', 'getProject', 'listProjectWorkflowRuns', 'closeProject', 'closeActiveProject', 'getProjectBundle', 'listProjectOpenTasks', 'closeRoadmapItemWorkflow']);
2194
- defineCompatibilityMethods(proto, 'projectChartering', ['createProjectCharter', 'createProjectDelivery', 'approveProjectCharterIntent', 'approveImplementationRoadmap', 'runProjectCharter', 'beginImplementationRoadmap', 'routeImplementationItem']);
2195
- defineCompatibilityMethods(proto, 'projectReports', ['getProjectCharterReport', 'createProjectMarkdownDownload', 'downloadProjectMarkdownReport', 'downloadProjectCharterReportMarkdown']);
2196
- defineCompatibilityMethods(proto, 'projectResume', ['resumeProjectWork']);
2197
- defineCompatibilityMethods(proto, 'roadmaps', ['listProjectRoadmaps', 'getProjectRoadmap', 'getProjectRoadmapSummary', 'getProjectRoadmapActiveItem', 'listProjectOpenTasks', 'getProjectPerformanceMetrics', 'ensureProjectRoadmapTaskSurface']);
2198
- defineCompatibilityMethods(proto, 'roadmapReports', ['getProjectImplementationRoadmapReport', 'downloadProjectImplementationRoadmapReportMarkdown']);
2199
- defineCompatibilityMethods(proto, 'implementationTasks', ['createImplementationTask', 'listImplementationTasks', 'listImplementationSubtasks', 'updateImplementationTask', 'assignImplementationTask', 'completeImplementationTask']);
2200
- defineCompatibilityMethods(proto, 'implementationPackets', ['importImplementationPacket', 'listImplementationPackets', 'getImplementationPacket', 'bindImplementationPacketToWorkflow', 'getWorkflowImplementationRoadmap', 'getWorkflowResumeContext', 'importImplementationPacketAndMaterializeRoadmap']);
2201
- defineCompatibilityMethods(proto, 'implementationChecks', ['getImplementationItemAcceptanceChecks', 'updateAcceptanceCheckStatus', 'updateAcceptanceCheckStatusVerified']);
2202
- defineCompatibilityMethods(proto, 'implementationArtifacts', ['getArtifactManifest', 'getDecisionPacket', 'verifyImplementationItemArtifacts']);
2203
- defineCompatibilityMethods(proto, 'implementationItems', ['updateImplementationItemStatus', 'updateImplementationItemStatusVerified']);
2204
- defineCompatibilityMethods(proto, 'implementationEvidence', ['addImplementationItemEvidence', 'addImplementationItemActivity', 'listImplementationItemActivity']);
2205
- defineCompatibilityMethods(proto, 'implementationGates', ['createImplementationPacketGateDecision']);
2206
- defineCompatibilityMethods(proto, 'workflowTurns', ['completeTurn', 'persistAssistantTurn']);
2207
- defineCompatibilityMethods(proto, 'claims', ['getClaim', 'claimIsValid', 'signoffClaim', 'promoteClaimSurface']);
2208
- defineCompatibilityMethods(proto, 'sessionGovernance', ['startSessionGovernance', 'startReviewGovernance', 'evaluateTurnCompliance', 'blockIfNonCompliant']);
2209
- defineCompatibilityMethods(proto, 'workStart', ['startWork', 'startClaimedWork', 'claimWorkItem', 'bindClaimedWorkItem']);
2210
- defineCompatibilityMethods(proto, 'executionEligibility', ['getExecutionEligibility', '_assertExecutionEligibility']);
2211
- defineCompatibilityMethods(proto, 'toolBindingApprovals', ['createWorkflowToolBindingApprovalLane', 'recordWorkflowToolBindingApprovalDecision', 'executeWorkflowToolBindingApprovalBinding', 'revalidateWorkflowToolBindingStartup']);
2212
- defineCompatibilityMethods(proto, 'verifiedMutations', ['executeVerifiedMutation']);
2213
- defineCompatibilityMethods(proto, 'charters', ['runCharter']);
2214
- defineCompatibilityMethods(proto, 'pingPong', ['checkCoordinationPingPongPreflight', 'startCoordinationPingPong', 'sendCoordinationPing', 'sendCoordinationPong', 'getCoordinationPingPongStatus', 'stopCoordinationPingPong']);
2215
- defineCompatibilityAliases(proto, 'pingPong', { pingAgentCommunicationPeer: 'sendCoordinationPing', pongAgentCommunicationPeer: 'sendCoordinationPong' });
2216
- defineCompatibilityMethods(proto, 'transferChannels', ['listCommunicationChannels', 'listOpenCommunicationChannels', 'getCommunicationChannelStatus', 'getCommunicationChannelParticipants', 'openTransferChannel', 'joinTransferChannel', 'resumeTransferChannel', 'replyToTransferChannel', 'closeTransferChannel', 'requestTransferClosure', 'openAgentChannel', 'connectToTransferChannel', 'startAgentConnection', 'postAgentHeartbeat', 'closeAgentChannel']);
2217
- defineCompatibilityMethods(proto, 'messageWatch', ['startMessageWatch', 'acknowledgeExpectedMessage', 'expireMessageWatch', 'respondToMessageWatch', 'acceptAgentChannel', 'resolveMessageWatchId']);
2218
- defineCompatibilityMethods(proto, 'presence', ['getPresenceBoard', 'getChannelPresence', 'markParticipantOnline', 'markParticipantOffline', 'whoIsOnline', 'findOnlineParticipant', 'sendToParticipant', 'sendToRole', 'postPresenceHeartbeat']);
2219
- defineCompatibilityMethods(proto, 'collaborationDomain', ['reviewCollaborationProposal', 'reviseCollaborationProposal', 'postCollaborationProposal', 'acceptCollaborationProposal', 'assignCollaborationOwnership', 'raiseCollaborationBlocker', 'resolveCollaborationBlocker', 'postCollaborationHeartbeat', 'beginCollaborationImplementation', 'requestCollaborationClosure']);
2220
- defineCompatibilityMethods(proto, 'transferBundles', ['transferWorkPacket', 'getTransferBundle', 'listTransferBundles', 'createTransferReceipt', 'listTransferReceipts', 'createCommunicationBundle', 'getCommunicationBundle', 'listCommunicationBundles', 'addCommunicationBundleItem', 'uploadCommunicationBundle', 'attachCommunicationBundleToMessage', 'recordCommunicationBundleReceipt', 'recordCommunicationBundleCleanupEvent', 'claimCommunicationBundle', 'recordCommunicationTransferReceipt']);
2221
- defineCompatibilityMethods(proto, 'workflowComposition', ['registerModernizationAsset', 'classifyModernizationAsset', 'discoverSalvageCandidates', 'createModernizationWorkPacket', 'requestModernizationWrapperExecution', 'getModernizationWrapperEvidence', 'decideModernizationGate']);
2222
- defineCompatibilityMethods(proto, 'currentProject', ['currentProjectStatus']);
2223
- defineCompatibilityMethods(proto, 'projections', ['renderProjection', 'getLogaOperatorHomeProjection', 'getLogaProjectCatalogProjection', 'getLogaProjectPortfolioProjection', 'getLogaProjectRoadmapProjection', 'getLogaRoadmapItemProjection', 'getLogaWorkflowRunProjection', 'getLogaEvidencePacketProjection', 'getLogaTransferHomeProjection', 'getLogaTransferInboxProjection', 'getLogaTransferPacketProjection', 'getLogaTransferNegotiationEventsProjection', 'getLogaTransferFrictionLaneProjection', 'getLogaTransferReceiptsProjection', 'getLogaTransferClosureReviewProjection', 'getTransferChannelProjection']);
2224
- defineCompatibilityAliases(proto, 'projections', { getLogaTransferChannelThreadProjection: 'getTransferChannelProjection' });
2225
- defineCompatibilityMethods(proto, 'loga', ['submitUxGateRemediation', 'listUxGateRemediations', 'getUxGateRemediation', 'appendUxRemediationTicketNote', 'listUxRemediationTicketNotes', 'promoteUxGateRemediationImplementationCandidate', 'getLogaUxGateRemediationProjection', 'getUxGateRemediationProjection']);
2226
- defineCompatibilityMethods(proto, 'actions', ['submitActionIntent']);
2227
- defineCompatibilityMethods(proto, 'executionTelemetry', ['getExecutionTelemetryCurrent', 'listExecutionProcessRuns', 'getExecutionProcessRun', 'getGeneratedExecutionUsability', 'getLogaGeneratedExecutionUsabilityProjection']);
2228
- defineCompatibilityMethods(proto, 'scripts', ['generateScript', 'renderScript', 'submitScriptArtifact', 'getScriptRunEvidence']);
2229
- defineCompatibilityMethods(proto, 'capabilities', ['listCapabilities', 'createCapability', 'testCapability']);
2230
- defineCompatibilityMethods(proto, 'skills', ['currentSkillRegistryStatus', 'getSkillContract', 'getSkillGovernance', 'createSkillContractDraft', 'recordSkillPatternReview', 'approveSkillContract', 'createWorkflowSkillContract', 'listWorkflowSkillBindings', 'seedFrequentOperationSkills']);
2231
- defineCompatibilityMethods(proto, 'skillGovernance', ['createSkillGovernanceChange', 'listSkillGovernanceChanges', 'getSkillGovernanceChange']);
2232
- defineCompatibilityMethods(proto, 'toolRegistry', ['currentToolRegistryStatus', 'getWorkflowToolRegistry', 'currentAssistantToolContext', 'getTool', 'getToolHistory', 'getToolInvocations', 'getToolEventReplayBundle', 'getToolGovernance', 'createToolReviewDecision', 'createToolGateDecision']);
2233
- defineCompatibilityMethods(proto, 'contextAssembly', ['getContextAssemblyContract', 'getContextAssemblyStatus', 'getOperatorContext', 'getContextFragments', 'getContextReuse', 'listPromptAssemblies']);
2234
- defineCompatibilityMethods(proto, 'performance', ['getSessionPerformanceMetrics', 'captureBenchmarkSnapshot', 'listBenchmarks', 'getBenchmarkMetrics', 'getBenchmarkDelta', 'getBenchmarkTrend', 'getPerformanceDashboard']);
2235
- defineCompatibilityMethods(proto, 'selfLearning', ['getSelfLearningPosture', 'listLearningRecords', 'getLearningRecord', 'listPromotionCandidates', 'getPromotionCandidate', 'listPromotionFlows']);
2236
- defineCompatibilityMethods(proto, 'selfOptimization', ['getSelfOptimizationDashboard', 'getSelfOptimizationCandidateQueue', 'getSelfOptimizationBacklogPosture', 'getSelfOptimizationPendingHandoffs']);
2237
- defineCompatibilityMethods(proto, 'designIntelligence', ['getDesignIntelligenceDashboard', 'listDesignDecisions', 'getDesignDecision', 'getDesignDecisionVariants', 'getDesignDecisionCritique', 'getDesignDecisionLineage', 'listDesignPatterns', 'getDecisionLabCanvas', 'getDesignRecommendations', 'getDesignPromotions', 'previewDesignPromotion', 'getDesignIntelligenceMetrics']);
2238
- defineCompatibilityMethods(proto, 'scriptDiscovery', ['scanScripts', 'listDiscoveredScriptAssets', 'listDiscoveredCapabilities', 'listWorkflowCandidates', 'promoteWorkflowCandidate']);
2239
- defineCompatibilityMethods(proto, 'notesLab', ['getNotesLabConfig', 'submitNote', 'approveNoteReview']);
2240
- defineCompatibilityMethods(proto, 'searchContacts', ['search', 'getOrganization', 'getContact']);
2241
- defineCompatibilityMethods(proto, 'benchmarks', ['listRecentBenchmarkRuns', 'getBenchmarkRun']);
2242
- defineCompatibilityMethods(proto, 'commitGovernance', ['evaluateCommitGovernance', 'checkGitShipReadiness', 'getCommitGovernanceEvaluation', 'listCommitGovernanceEvaluationsByClaim']);
2243
- defineCompatibilityMethods(proto, 'contextSessions', ['openContextSession', 'getOrientationWindow', 'acknowledgeReminder', 'completeOrientation', 'lockContextSessionClaim', 'getContextSessionGateStatus']);
2244
- defineCompatibilityMethods(proto, 'contextOrientation', ['conductOrientation']);
2245
- defineCompatibilityMethods(proto, 'portfolio', ['getPortfolioStatus', 'getPortfolioBundle', 'getPortfolioClosureReadiness']);
2246
- }
2247
1311
  installClientCompatibilityDelegates(AIEngineClient);