@bpmsoftwaresolutions/ai-engine-client 1.1.98 → 1.1.101

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
@@ -1,7 +1,5 @@
1
1
  import { AI_ENGINE_CLIENT_CAPABILITIES } from './constants/governance.js';
2
- import { AGENT_COMMUNICATION_CONTRACT_VERSION, AGENT_COMMUNICATION_MESSAGE_KINDS, AGENT_COMMUNICATION_RECIPIENT_MODES, AGENT_COMMUNICATION_THREAD_TYPES, AGENT_COMMUNICATION_TRANSFER_KINDS, AGENT_COMMUNICATION_TRANSFER_LIFECYCLE_STATES, AGENT_COMMUNICATION_TRANSFER_MODES, AGENT_COMMUNICATION_TRANSFER_RECEIPT_TYPES } from './constants/agent-communications.js';
3
2
  import { AI_ENGINE_CLIENT_VERSION, DEFAULT_TIMEOUT_MS } from './constants/client.js';
4
- import { LOGA_CONTRACT, LOGA_INTERACTION_CONTRACT, LOGA_NAVIGATION_CONTRACT, LOGA_PROJECTION_WORKFLOW } from './constants/loga.js';
5
3
  import { createActionsDomain } from './domains/actions.js';
6
4
  import { createBenchmarksDomain } from './domains/benchmarks.js';
7
5
  import { createCapabilitiesDomain } from './domains/capabilities.js';
@@ -15,6 +13,7 @@ import { createGatewayDomain } from './domains/gateway.js';
15
13
  import { createHealthDomain } from './domains/health.js';
16
14
  import { createLogaDomain } from './domains/loga.js';
17
15
  import { createNotesLabDomain } from './domains/notes-lab.js';
16
+ import { createCommunicationTicketsDomain } from './domains/communication-tickets.js';
18
17
  import { createPortfolioDomain } from './domains/portfolio.js';
19
18
  import { createProjectReportsDomain } from './domains/project-reports.js';
20
19
  import { createProjectResumeDomain } from './domains/project-resume.js';
@@ -32,6 +31,7 @@ import { createImplementationItemsDomain } from './domains/implementation-items.
32
31
  import { createRepoDomain } from './domains/repo.js';
33
32
  import { createProjectCharteringDomain } from './domains/project-chartering.js';
34
33
  import { createProjectsDomain } from './domains/projects.js';
34
+ import { createRefactoringTransfersDomain } from './domains/refactoring-transfers.js';
35
35
  import { createOperatorStatusDomain } from './domains/operator-status.js';
36
36
  import { createRoadmapsDomain } from './domains/roadmaps.js';
37
37
  import { createScriptDiscoveryDomain } from './domains/script-discovery.js';
@@ -43,6 +43,9 @@ import { createSelfOptimizationDomain } from './domains/self-optimization.js';
43
43
  import { createSkillGovernanceDomain } from './domains/skill-governance.js';
44
44
  import { createSkillsDomain } from './domains/skills.js';
45
45
  import { createSearchContactsDomain } from './domains/search-contacts.js';
46
+ import { createExternalProjectsDomain } from './domains/external-projects.js';
47
+ import { createExternalAudioDomain } from './domains/external-audio.js';
48
+ import { createExternalWorkflowArtifactsDomain } from './domains/external-workflow-artifacts.js';
46
49
  import { createAgentCommunicationsFacade, createCollaborationFacade } from './compat/facades.js';
47
50
  import { createClaimsDomain } from './domains/claims.js';
48
51
  import { createSessionGovernanceDomain } from './domains/session-governance.js';
@@ -66,184 +69,9 @@ import { createToolRegistryDomain } from './domains/tool-registry.js';
66
69
  import { createWorkflowCompositionDomain } from './domains/workflow-composition.js';
67
70
  import { createWorkflowsDomain } from './domains/workflows.js';
68
71
  import { createWarehouseDomain } from './domains/warehouse.js';
72
+ import { installClientCompatibilityDelegates } from './compat/aliases.js';
69
73
  import { buildHeaders, requestBinary, requestJson, requestLogaProjection, requestText, resolveAccessToken } from './transport/index.js';
70
- import { normalizeEnum, trimTrailingSlash } from './utils/text.js';
71
-
72
- function normalizeThreadType(value) {
73
- return normalizeEnum(value, AGENT_COMMUNICATION_THREAD_TYPES, 'coordination', 'thread_type', {
74
- task_request: 'request',
75
- task: 'request',
76
- review_request: 'review',
77
- handoff_request: 'handoff',
78
- });
79
- }
80
-
81
- function normalizeMessageKind(value) {
82
- return normalizeEnum(value, AGENT_COMMUNICATION_MESSAGE_KINDS, 'request', 'message_kind', {
83
- task: 'request',
84
- note: 'request',
85
- update: 'response',
86
- });
87
- }
88
-
89
- function normalizeConnectionFirstMessageKind(value, transferKind) {
90
- const text = cleanText(value);
91
- if (!text) {
92
- return normalizeMessageKind(transferKind === 'handoff' ? 'handoff' : 'request');
93
- }
94
- const normalized = text.toLowerCase();
95
- const aliases = {
96
- connection_request: 'request',
97
- connection_accepted: 'response',
98
- connection_acceptance: 'response',
99
- handoff_request: 'handoff',
100
- handoff_acceptance: 'response',
101
- handoff_response: 'response',
102
- acceptance: 'response',
103
- decline: 'response',
104
- };
105
- const candidate = aliases[normalized] || text;
106
- try {
107
- return normalizeMessageKind(candidate);
108
- } catch (error) {
109
- void error;
110
- return normalizeMessageKind(transferKind === 'handoff' ? 'handoff' : 'request');
111
- }
112
- }
113
-
114
- function normalizeTransferKind(value) {
115
- return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_KINDS, 'upstream_remediation', 'transfer_kind', {
116
- remediation_request: 'upstream_remediation',
117
- review: 'review_request',
118
- });
119
- }
120
-
121
- function normalizeTransferMode(value) {
122
- return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_MODES, 'inline_payload', 'transfer_mode');
123
- }
124
-
125
- function normalizeTransferLifecycleStatus(value) {
126
- return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_LIFECYCLE_STATES, 'created', 'lifecycle_status');
127
- }
128
-
129
- function normalizeTransferReceiptType(value) {
130
- return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_RECEIPT_TYPES, 'delivery_receipt', 'receipt_type');
131
- }
132
-
133
- function normalizeRecipientMode(value) {
134
- return normalizeEnum(value, AGENT_COMMUNICATION_RECIPIENT_MODES, 'role', 'recipient_mode');
135
- }
136
-
137
- function appendQuery(url, query) {
138
- const target = new URL(url);
139
- for (const [key, value] of Object.entries(query || {})) {
140
- if (value === undefined || value === null || value === '') continue;
141
- target.searchParams.set(key, String(value));
142
- }
143
- return target;
144
- }
145
-
146
- async function readJson(response) {
147
- const contentType = response.headers.get('content-type') || '';
148
- if (contentType.includes('application/json')) return response.json();
149
- const text = await response.text();
150
- return { message: text };
151
- }
152
-
153
- function parseContentDispositionFilename(headerValue) {
154
- const value = String(headerValue || '');
155
- const quotedMatch = value.match(/filename="([^"]+)"/i);
156
- if (quotedMatch) return quotedMatch[1];
157
- const plainMatch = value.match(/filename=([^;]+)/i);
158
- return plainMatch ? plainMatch[1].trim() : null;
159
- }
160
-
161
- function readResponseHeader(headers, name) {
162
- if (!headers || typeof headers.get !== 'function') return null;
163
- return headers.get(name) || headers.get(name.toLowerCase()) || null;
164
- }
165
-
166
- function extractLogaProjectionMetadata(headers) {
167
- const projectionWorkflow = readResponseHeader(headers, 'x-projection-workflow');
168
- const projectionVersion = readResponseHeader(headers, 'x-projection-version');
169
- const sourceVersion = readResponseHeader(headers, 'x-source-version');
170
- const correlationId = readResponseHeader(headers, 'x-correlation-id');
171
- const logaContract = readResponseHeader(headers, 'x-loga-contract');
172
- const navigationContract = readResponseHeader(headers, 'x-navigation-contract');
173
- const projectionType = readResponseHeader(headers, 'x-projection-type');
174
- const sourceTruth = readResponseHeader(headers, 'x-source-truth');
175
- const refreshPolicy = readResponseHeader(headers, 'x-refresh-policy');
176
- const generatedAt = readResponseHeader(headers, 'x-generated-at');
177
-
178
- return {
179
- logaContract,
180
- navigationContract,
181
- interactionContract: LOGA_INTERACTION_CONTRACT,
182
- projectionType,
183
- projectionWorkflow,
184
- projectionVersion,
185
- sourceTruth,
186
- sourceVersion,
187
- correlationId,
188
- refreshPolicy,
189
- generatedAt,
190
- provenance: {
191
- sourceTruth,
192
- sourceVersion,
193
- projectionVersion,
194
- projectionWorkflow,
195
- correlationId,
196
- generatedAt,
197
- },
198
- };
199
- }
200
-
201
- function isFormDataBody(value) {
202
- return typeof FormData !== 'undefined' && value instanceof FormData;
203
- }
204
-
205
- function isBinaryBody(value) {
206
- return (
207
- value instanceof ArrayBuffer
208
- || ArrayBuffer.isView(value)
209
- || (typeof Blob !== 'undefined' && value instanceof Blob)
210
- || value instanceof URLSearchParams
211
- || typeof value === 'string'
212
- );
213
- }
214
-
215
- function isJsonBody(value) {
216
- if (value === undefined || value === null) return false;
217
- if (isFormDataBody(value) || isBinaryBody(value)) return false;
218
- return typeof value === 'object';
219
- }
220
-
221
- function cleanText(value) {
222
- const text = String(value || '').trim();
223
- return text || null;
224
- }
225
-
226
- function compareSemanticVersions(left, right) {
227
- const leftParts = String(left || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
228
- const rightParts = String(right || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
229
- const width = Math.max(leftParts.length, rightParts.length);
230
- for (let index = 0; index < width; index += 1) {
231
- const a = leftParts[index] || 0;
232
- const b = rightParts[index] || 0;
233
- if (a > b) return 1;
234
- if (a < b) return -1;
235
- }
236
- return 0;
237
- }
238
-
239
- function cleanList(value) {
240
- if (!Array.isArray(value)) return [];
241
- return value.map((item) => cleanText(item)).filter(Boolean);
242
- }
243
-
244
- function isPlainObject(value) {
245
- return value !== null && typeof value === 'object' && !Array.isArray(value);
246
- }
74
+ import { cleanText, isPlainObject, trimTrailingSlash } from './utils/text.js';
247
75
 
248
76
  export class AIEngineClient {
249
77
  constructor({ baseUrl, accessToken, tokenProvider, apiKey, clientId, actorId, agentSessionId, fetchImpl, timeoutMs } = {}) {
@@ -326,6 +154,11 @@ export class AIEngineClient {
326
154
  this.presence = createPresenceDomain(this);
327
155
  this.pingPong = createPingPongDomain(this);
328
156
  this.agentCommunications = createAgentCommunicationsDomain(this);
157
+ this.communicationTickets = createCommunicationTicketsDomain(this);
158
+ this.refactoringTransfers = createRefactoringTransfersDomain(this);
159
+ this.externalProjects = createExternalProjectsDomain(this);
160
+ this.externalAudio = createExternalAudioDomain(this);
161
+ this.externalWorkflowArtifacts = createExternalWorkflowArtifactsDomain(this);
329
162
  this.collaborationDomain = createCollaborationDomain(this);
330
163
  this.agentComms = createAgentCommunicationsFacade(this);
331
164
  this.collaboration = createCollaborationFacade(this);
@@ -347,1739 +180,10 @@ export class AIEngineClient {
347
180
 
348
181
  // ─── Health ────────────────────────────────────────────────────────────────
349
182
 
350
- async startAgentConnection({
351
- workflowRunId,
352
- workflow_run_id,
353
- upstreamAgent,
354
- upstream_agent,
355
- upstreamAgentSessionId,
356
- upstream_agent_session_id,
357
- upstreamAgentId,
358
- upstream_agent_id,
359
- upstreamRole,
360
- upstream_role,
361
- recipientMode,
362
- recipient_mode,
363
- purpose,
364
- objective,
365
- mode = 'handoff',
366
- firstMessage = {},
367
- first_message = {},
368
- expectedMessageKind,
369
- expected_message_kind,
370
- participantRole,
371
- participant_role,
372
- participantLabel,
373
- participant_label,
374
- senderAgentSessionId,
375
- sender_agent_session_id,
376
- senderActorSessionId,
377
- sender_actor_session_id,
378
- cleanupPolicy,
379
- cleanup_policy,
380
- staleAfterSeconds = 300,
381
- stale_after_seconds,
382
- operatorNudge,
383
- operator_nudge,
384
- metadata = {},
385
- } = {}) {
386
- return this.agentCommunications.startAgentConnection(arguments[0]);
387
- }
388
-
389
- async establishAgentCommunicationChannel({
390
- projectIdentifier,
391
- projectId,
392
- claimId,
393
- actorId,
394
- actorMode = 'operator',
395
- executionIntent = 'establish agent communication channel',
396
- workflowRunLimit = 5,
397
- startWorkBody = {},
398
- startWorkRequest = {},
399
- resumeProjectWorkOptions = {},
400
- transferKind = 'coordination',
401
- objective,
402
- requestedOutcome,
403
- transferChannelId,
404
- transfer_channel_id,
405
- channelId,
406
- channel_id,
407
- workTransferPacketId,
408
- work_transfer_packet_id,
409
- packetId,
410
- packet_id,
411
- participantRole,
412
- participant_role,
413
- participantLabel,
414
- participant_label,
415
- participantKind,
416
- participant_kind,
417
- agentSessionId,
418
- agent_session_id,
419
- actorSessionId,
420
- actor_session_id,
421
- upstreamAgentSessionId,
422
- upstream_agent_session_id,
423
- upstreamActorSessionId,
424
- upstream_actor_session_id,
425
- downstreamAgentSessionId,
426
- downstream_agent_session_id,
427
- downstreamActorSessionId,
428
- downstream_actor_session_id,
429
- expectedMessageKind = 'connection_accepted',
430
- expected_message_kind,
431
- expectedNextMessage,
432
- expected_next_message,
433
- currentPhase = 'channel_ready',
434
- current_phase,
435
- currentTaskSummary,
436
- current_task_summary,
437
- channelKind = 'bidirectional',
438
- channel_kind,
439
- includeTransferChannelProjection = true,
440
- includeChannelPresenceProjection = true,
441
- includeOperatorProjectionMetadata = true,
442
- metadata = {},
443
- } = {}) {
444
- return this.agentCommunications.establishAgentCommunicationChannel(arguments[0]);
445
- }
446
-
447
- async runInterAgentMessagingLoop({
448
- transferChannelId,
449
- transfer_channel_id,
450
- channelId,
451
- channel_id,
452
- workTransferPacketId,
453
- work_transfer_packet_id,
454
- workflowRunId,
455
- workflow_run_id,
456
- participantRole,
457
- participant_role,
458
- watchingAgentRole,
459
- watching_agent_role,
460
- expectedFromRole,
461
- expected_from_role,
462
- expectedMessageKind,
463
- expected_message_kind,
464
- expectedNextMessage,
465
- expected_next_message,
466
- replyRequest = {},
467
- reply_request = {},
468
- replyBodyMarkdown,
469
- reply_body_markdown,
470
- replyMessageKind,
471
- reply_message_kind,
472
- replyPayload = {},
473
- reply_payload = {},
474
- replyScope = {},
475
- reply_scope = {},
476
- replyEvidenceRefs = [],
477
- reply_evidence_refs = [],
478
- replyRecipientAgentSessionId,
479
- reply_recipient_agent_session_id,
480
- replyRecipientActorSessionId,
481
- reply_recipient_actor_session_id,
482
- replySenderAgentSessionId,
483
- reply_sender_agent_session_id,
484
- replySenderActorSessionId,
485
- reply_sender_actor_session_id,
486
- watchRequest = {},
487
- watch_request = {},
488
- acknowledgeRequest = {},
489
- acknowledge_request = {},
490
- heartbeatRequest = {},
491
- heartbeat_request = {},
492
- closeWhenAcknowledged = false,
493
- close_when_acknowledged = false,
494
- requestClosure = false,
495
- request_closure = false,
496
- closureReason,
497
- closure_reason,
498
- failureReason,
499
- failure_reason,
500
- closureEvidence = {},
501
- closure_evidence = {},
502
- closureEvidenceManifestSha256,
503
- closure_evidence_manifest_sha256,
504
- includeTransferChannelProjection = true,
505
- includeOperatorProjectionMetadata = true,
506
- metadata = {},
507
- } = {}) {
508
- return this.agentCommunications.runInterAgentMessagingLoop(arguments[0]);
509
- }
510
-
511
- async createCrossAgentRemediationTicket({
512
- transferChannelId,
513
- transfer_channel_id,
514
- channelId,
515
- channel_id,
516
- workTransferPacketId,
517
- work_transfer_packet_id,
518
- packetId,
519
- packet_id,
520
- workflowRunId,
521
- workflow_run_id,
522
- ownershipMove,
523
- ownership_move,
524
- transferOwnership,
525
- transfer_ownership,
526
- assignedTo,
527
- assigned_to,
528
- requestedBy,
529
- requested_by,
530
- severity,
531
- sourceRef,
532
- source_ref,
533
- findingId,
534
- finding_id,
535
- blockerId,
536
- blocker_id,
537
- failedCheckId,
538
- failed_check_id,
539
- workflowGap,
540
- workflow_gap,
541
- blockerKind,
542
- blocker_kind,
543
- blockerSummary,
544
- blocker_summary,
545
- blockerDetails,
546
- blocker_details,
547
- expectedResponse,
548
- expected_response,
549
- participantRole,
550
- participant_role,
551
- watcherRole,
552
- watcher_role,
553
- proposalId,
554
- proposal_id,
555
- collaborationProposalId,
556
- collaboration_proposal_id,
557
- expectedMessageKind,
558
- expected_message_kind,
559
- messageWatchId,
560
- message_watch_id,
561
- replyBodyMarkdown,
562
- reply_body_markdown,
563
- replyPayload = {},
564
- reply_payload = {},
565
- replyScope = {},
566
- reply_scope = {},
567
- replyEvidenceRefs = [],
568
- reply_evidence_refs = [],
569
- metadata = {},
570
- includeTransferChannelProjection = true,
571
- includeOperatorProjectionMetadata = true,
572
- } = {}) {
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
- };
881
- }
882
-
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);
1287
- }
1288
-
1289
- async postAgentHeartbeat(request = {}) {
1290
- return this.transferChannels.postAgentHeartbeat(request);
1291
- }
1292
-
1293
183
  async postAgentMessage(request = {}) {
1294
184
  return this._sendAgentCommsMessage(request);
1295
185
  }
1296
186
 
1297
- async acknowledgeAgentMessage({
1298
- transferChannelId,
1299
- transfer_channel_id,
1300
- channelId,
1301
- channel_id,
1302
- messageWatchId,
1303
- message_watch_id,
1304
- watchId,
1305
- watch_id,
1306
- messageId,
1307
- message_id,
1308
- messageKind,
1309
- message_kind,
1310
- observedMessageId,
1311
- observed_message_id,
1312
- observedMessageKind,
1313
- observed_message_kind,
1314
- operatorNudge,
1315
- operator_nudge,
1316
- metadata = {},
1317
- } = {}) {
1318
- const normalizedWatchId = cleanText(message_watch_id) || cleanText(messageWatchId) || cleanText(watch_id) || cleanText(watchId) || await this._resolveMessageWatchId({ transfer_channel_id, transferChannelId, channel_id, channelId });
1319
- if (!normalizedWatchId) throw new Error('message_watch_id is required.');
1320
- return this._request(`/api/agent-communications/message-watches/${encodeURIComponent(normalizedWatchId)}/acknowledge-message`, {
1321
- method: 'POST',
1322
- body: {
1323
- observed_message_id: cleanText(observed_message_id) || cleanText(observedMessageId) || cleanText(message_id) || cleanText(messageId),
1324
- observed_message_kind: cleanText(observed_message_kind) || cleanText(observedMessageKind) || cleanText(message_kind) || cleanText(messageKind),
1325
- operator_nudge: cleanText(operator_nudge) || cleanText(operatorNudge),
1326
- metadata: isPlainObject(metadata) ? metadata : {},
1327
- },
1328
- });
1329
- }
1330
-
1331
- async closeAgentChannel(request = {}) {
1332
- return this.transferChannels.closeAgentChannel(request);
1333
- }
1334
-
1335
- async respondToMessageWatch(request = {}) {
1336
- return this.messageWatch.respondToMessageWatch(request);
1337
- }
1338
-
1339
- async reviseCollaborationProposal(request = {}) {
1340
- return this.collaborationDomain.reviseCollaborationProposal(request);
1341
- }
1342
-
1343
- async raiseCollaborationBlocker(request = {}) {
1344
- return this.collaborationDomain.raiseCollaborationBlocker(request);
1345
- }
1346
-
1347
- async beginCollaborationImplementation(request = {}) {
1348
- return this.collaborationDomain.beginCollaborationImplementation(request);
1349
- }
1350
-
1351
- async requestCollaborationClosure(request = {}) {
1352
- return this.collaborationDomain.requestCollaborationClosure(request);
1353
- }
1354
-
1355
- async bootstrapCommunication() {
1356
- return this._request('/api/agent-communications/bootstrap');
1357
- }
1358
-
1359
- async negotiateCommunicationTransfer({
1360
- preferredModes,
1361
- preferred_modes,
1362
- preferred,
1363
- capabilities = {},
1364
- estimatedPayloadKb,
1365
- estimated_payload_kb,
1366
- requiresReceipts = true,
1367
- requires_receipts = true,
1368
- supportsHashValidation = true,
1369
- supports_hash_validation = true,
1370
- transferKind,
1371
- transfer_kind,
1372
- workflowRunId,
1373
- workflow_run_id,
1374
- } = {}) {
1375
- const normalizedPreferredModes = Array.isArray(preferred_modes)
1376
- ? preferred_modes
1377
- : (Array.isArray(preferredModes) ? preferredModes : (Array.isArray(preferred) ? preferred : ['bundle', 'artifact_refs', 'inline_payload']));
1378
- return this._request('/api/agent-communications/transfers/negotiate', {
1379
- method: 'POST',
1380
- body: {
1381
- preferred_modes: normalizedPreferredModes.map((mode) => normalizeTransferMode(mode)),
1382
- capabilities: isPlainObject(capabilities) ? capabilities : {},
1383
- estimated_payload_kb: Number(estimated_payload_kb ?? estimatedPayloadKb ?? 0) || undefined,
1384
- requires_receipts: Boolean(requires_receipts ?? requiresReceipts),
1385
- supports_hash_validation: Boolean(supports_hash_validation ?? supportsHashValidation),
1386
- transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
1387
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1388
- },
1389
- });
1390
- }
1391
-
1392
- async resolveCommunicationTarget({
1393
- intent,
1394
- transferKind,
1395
- transfer_kind,
1396
- recipientMode,
1397
- recipient_mode,
1398
- preferredRoleKey,
1399
- preferred_role_key,
1400
- preferredAgentSessionId,
1401
- preferred_agent_session_id,
1402
- workflowRunId,
1403
- workflow_run_id,
1404
- } = {}) {
1405
- return this._request('/api/agent-communications/targets/resolve', {
1406
- method: 'POST',
1407
- body: {
1408
- intent: cleanText(intent) || cleanText(transfer_kind) || cleanText(transferKind),
1409
- recipient_mode: normalizeRecipientMode(recipient_mode ?? recipientMode ?? 'role'),
1410
- preferred_role_key: cleanText(preferred_role_key) || cleanText(preferredRoleKey),
1411
- preferred_agent_session_id: cleanText(preferred_agent_session_id) || cleanText(preferredAgentSessionId),
1412
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1413
- },
1414
- });
1415
- }
1416
-
1417
- async createCommunicationEvidencePacket({
1418
- workflowRunId,
1419
- workflow_run_id,
1420
- transferKind,
1421
- transfer_kind,
1422
- objective,
1423
- requestedOutcome,
1424
- requested_outcome,
1425
- artifacts = [],
1426
- artifactRefs,
1427
- artifact_refs,
1428
- issues = [],
1429
- issueRefs,
1430
- issue_refs,
1431
- expectedEvidence = [],
1432
- expected_evidence,
1433
- metadata = {},
1434
- } = {}) {
1435
- return this._request('/api/agent-communications/evidence-packets', {
1436
- method: 'POST',
1437
- body: {
1438
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1439
- transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
1440
- objective: cleanText(objective),
1441
- requested_outcome: cleanText(requested_outcome) || cleanText(requestedOutcome),
1442
- artifacts: Array.isArray(artifacts) ? artifacts : (Array.isArray(artifact_refs) ? artifact_refs : (Array.isArray(artifactRefs) ? artifactRefs : [])),
1443
- issues: Array.isArray(issues) ? issues : (Array.isArray(issue_refs) ? issue_refs : (Array.isArray(issueRefs) ? issueRefs : [])),
1444
- expected_evidence: Array.isArray(expected_evidence) ? expected_evidence : (Array.isArray(expectedEvidence) ? expectedEvidence : []),
1445
- metadata: isPlainObject(metadata) ? metadata : {},
1446
- },
1447
- });
1448
- }
1449
-
1450
- async listCommunicationFrictionTaxonomy({
1451
- categoryGroup,
1452
- category_group,
1453
- isActive,
1454
- is_active,
1455
- } = {}) {
1456
- return this._request('/api/agent-communications/friction-taxonomy', {
1457
- query: {
1458
- category_group: cleanText(category_group) || cleanText(categoryGroup),
1459
- is_active: is_active !== undefined ? String(Boolean(is_active)) : (isActive !== undefined ? String(Boolean(isActive)) : undefined),
1460
- },
1461
- });
1462
- }
1463
-
1464
- async recordCommunicationFrictionEvent({
1465
- workflowRunId,
1466
- workflow_run_id,
1467
- workTransferPacketId,
1468
- work_transfer_packet_id,
1469
- communicationThreadId,
1470
- communication_thread_id,
1471
- communicationMessageId,
1472
- communication_message_id,
1473
- taxonomyKey,
1474
- taxonomy_key,
1475
- frictionType,
1476
- friction_type,
1477
- severity,
1478
- observedBehavior,
1479
- observed_behavior,
1480
- attemptedAction,
1481
- attempted_action,
1482
- resolutionPath,
1483
- resolution_path,
1484
- missingSurfaceKey,
1485
- missing_surface_key,
1486
- promotionCandidate,
1487
- promotion_candidate,
1488
- repeatedCount,
1489
- repeated_count,
1490
- metadata = {},
1491
- } = {}) {
1492
- return this._request('/api/agent-communications/friction-events', {
1493
- method: 'POST',
1494
- body: {
1495
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1496
- work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
1497
- communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId),
1498
- communication_message_id: cleanText(communication_message_id) || cleanText(communicationMessageId),
1499
- taxonomy_key: cleanText(taxonomy_key) || cleanText(taxonomyKey) || 'enum_drift',
1500
- friction_type: cleanText(friction_type) || cleanText(frictionType) || 'discovery',
1501
- severity: cleanText(severity) || 'warning',
1502
- observed_behavior: cleanText(observed_behavior) || cleanText(observedBehavior),
1503
- attempted_action: cleanText(attempted_action) || cleanText(attemptedAction),
1504
- resolution_path: cleanText(resolution_path) || cleanText(resolutionPath),
1505
- missing_surface_key: cleanText(missing_surface_key) || cleanText(missingSurfaceKey),
1506
- promotion_candidate: Boolean(promotion_candidate ?? promotionCandidate),
1507
- repeated_count: Number(repeated_count ?? repeatedCount ?? 1) || 1,
1508
- metadata: isPlainObject(metadata) ? metadata : {},
1509
- },
1510
- });
1511
- }
1512
-
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
- async openCommunicationThread({
1526
- workflowRunId,
1527
- workflow_run_id,
1528
- threadType,
1529
- thread_type,
1530
- subject,
1531
- objective,
1532
- parentThreadId,
1533
- parent_thread_id,
1534
- createdByAgentSessionId,
1535
- created_by_agent_session_id,
1536
- createdByActorSessionId,
1537
- created_by_actor_session_id,
1538
- metadata,
1539
- } = {}) {
1540
- return this._request('/api/agent-communications/threads', {
1541
- method: 'POST',
1542
- body: {
1543
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1544
- parent_thread_id: cleanText(parent_thread_id) || cleanText(parentThreadId),
1545
- thread_type: normalizeThreadType(cleanText(thread_type) || cleanText(threadType)),
1546
- subject: cleanText(subject),
1547
- objective: cleanText(objective),
1548
- created_by_agent_session_id: cleanText(created_by_agent_session_id) || cleanText(createdByAgentSessionId),
1549
- created_by_actor_session_id: cleanText(created_by_actor_session_id) || cleanText(createdByActorSessionId),
1550
- metadata: isPlainObject(metadata) ? metadata : {},
1551
- },
1552
- });
1553
- }
1554
-
1555
- async getCommunicationThread(threadId) {
1556
- return this._request(`/api/agent-communications/threads/${encodeURIComponent(threadId)}`);
1557
- }
1558
-
1559
- async listCommunicationInbox({
1560
- recipientAgentSessionId,
1561
- recipient_agent_session_id,
1562
- recipientRoleKey,
1563
- recipient_role_key,
1564
- workflowRunId,
1565
- workflow_run_id,
1566
- } = {}) {
1567
- return this._request('/api/agent-communications/inbox', {
1568
- query: {
1569
- recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
1570
- recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
1571
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1572
- },
1573
- });
1574
- }
1575
-
1576
- async getMyInbox({
1577
- recipientAgentSessionId,
1578
- recipient_agent_session_id,
1579
- recipientRoleKey,
1580
- recipient_role_key,
1581
- workflowRunId,
1582
- workflow_run_id,
1583
- } = {}) {
1584
- return this._request('/api/agent-communications/inbox/me', {
1585
- query: {
1586
- recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
1587
- recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
1588
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1589
- },
1590
- });
1591
- }
1592
-
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
- async verifyMessageSent({ messageId, message_id } = {}) {
1630
- const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
1631
- if (!normalizedMessageId) throw new Error('message_id is required.');
1632
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-sent`, {
1633
- method: 'POST',
1634
- body: { message_id: normalizedMessageId },
1635
- });
1636
- }
1637
-
1638
- async verifyMessageReceived({
1639
- messageId,
1640
- message_id,
1641
- recipientAgentSessionId,
1642
- recipient_agent_session_id,
1643
- recipientRole,
1644
- recipient_role,
1645
- role,
1646
- participantId,
1647
- participant_id,
1648
- } = {}) {
1649
- const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
1650
- if (!normalizedMessageId) throw new Error('message_id is required.');
1651
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-received`, {
1652
- method: 'POST',
1653
- body: {
1654
- message_id: normalizedMessageId,
1655
- recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
1656
- recipient_role: cleanText(recipient_role) || cleanText(recipientRole) || cleanText(role),
1657
- participant_id: cleanText(participant_id) || cleanText(participantId),
1658
- },
1659
- });
1660
- }
1661
-
1662
- async getMessageDeliveryReceipt({ messageId, message_id } = {}) {
1663
- const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
1664
- if (!normalizedMessageId) throw new Error('message_id is required.');
1665
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/delivery-receipt`, {
1666
- method: 'GET',
1667
- });
1668
- }
1669
-
1670
- async _sendAgentCommsMessage(request = {}) {
1671
- const hasThreadContext = Boolean(
1672
- cleanText(request.communication_thread_id)
1673
- || cleanText(request.communicationThreadId)
1674
- || cleanText(request.thread_id)
1675
- || cleanText(request.threadId)
1676
- || cleanText(request.recipient_role_key)
1677
- || cleanText(request.recipientRoleKey)
1678
- );
1679
- const hasTransferChannelContext = Boolean(
1680
- cleanText(request.transfer_channel_id)
1681
- || cleanText(request.transferChannelId)
1682
- || cleanText(request.channel_id)
1683
- || cleanText(request.channelId)
1684
- || cleanText(request.sender_role)
1685
- || cleanText(request.senderRole)
1686
- || cleanText(request.recipient_role)
1687
- || cleanText(request.recipientRole)
1688
- || cleanText(request.role)
1689
- || cleanText(request.participant_role)
1690
- || cleanText(request.participantRole)
1691
- || cleanText(request.participant_id)
1692
- || cleanText(request.participantId)
1693
- || cleanText(request.recipient_participant_id)
1694
- || cleanText(request.recipientParticipantId)
1695
- );
1696
- if (hasTransferChannelContext && !hasThreadContext) {
1697
- if (
1698
- cleanText(request.participant_id)
1699
- || cleanText(request.participantId)
1700
- || cleanText(request.recipient_participant_id)
1701
- || cleanText(request.recipientParticipantId)
1702
- || cleanText(request.recipient_agent_session_id)
1703
- || cleanText(request.recipientAgentSessionId)
1704
- ) {
1705
- return this.sendToParticipant(request);
1706
- }
1707
- return this.sendToRole(request);
1708
- }
1709
- return this.sendCommunicationMessage(request);
1710
- }
1711
-
1712
- async sendCommunicationMessage({
1713
- communicationThreadId,
1714
- communication_thread_id,
1715
- threadId,
1716
- communicationBundleId,
1717
- communication_bundle_id,
1718
- senderAgentSessionId,
1719
- sender_agent_session_id,
1720
- recipientAgentSessionId,
1721
- recipient_agent_session_id,
1722
- recipientRoleKey,
1723
- recipient_role_key,
1724
- messageKind,
1725
- message_kind,
1726
- bodyMarkdown,
1727
- body_markdown,
1728
- messageStatus,
1729
- message_status,
1730
- payload = {},
1731
- scope = {},
1732
- requiredResponseSchema = {},
1733
- required_response_schema = {},
1734
- metadata = {},
1735
- } = {}) {
1736
- return this._request('/api/agent-communications/messages', {
1737
- method: 'POST',
1738
- body: {
1739
- communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId) || cleanText(threadId),
1740
- communication_bundle_id: cleanText(communication_bundle_id) || cleanText(communicationBundleId),
1741
- sender_agent_session_id: cleanText(sender_agent_session_id) || cleanText(senderAgentSessionId) || this.agentSessionId,
1742
- recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
1743
- recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
1744
- message_kind: normalizeMessageKind(cleanText(message_kind) || cleanText(messageKind)),
1745
- message_status: cleanText(message_status) || cleanText(messageStatus) || 'sent',
1746
- body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
1747
- payload: isPlainObject(payload) ? payload : {},
1748
- scope: isPlainObject(scope) ? scope : {},
1749
- required_response_schema: isPlainObject(requiredResponseSchema)
1750
- ? requiredResponseSchema
1751
- : (isPlainObject(required_response_schema) ? required_response_schema : {}),
1752
- metadata: isPlainObject(metadata) ? metadata : {},
1753
- },
1754
- });
1755
- }
1756
-
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
- async acceptCommunicationTransferPacket({
1798
- workTransferPacketId,
1799
- work_transfer_packet_id,
1800
- acceptedByAgentSessionId,
1801
- accepted_by_agent_session_id,
1802
- acceptedByActorSessionId,
1803
- accepted_by_actor_session_id,
1804
- acceptedByClaimId,
1805
- accepted_by_claim_id,
1806
- advanceToInProgress,
1807
- advance_to_in_progress,
1808
- metadata = {},
1809
- } = {}) {
1810
- const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
1811
- if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
1812
- return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/accept`, {
1813
- method: 'POST',
1814
- body: {
1815
- accepted_by_agent_session_id: cleanText(accepted_by_agent_session_id) || cleanText(acceptedByAgentSessionId),
1816
- accepted_by_actor_session_id: cleanText(accepted_by_actor_session_id) || cleanText(acceptedByActorSessionId),
1817
- accepted_by_claim_id: cleanText(accepted_by_claim_id) || cleanText(acceptedByClaimId),
1818
- advance_to_in_progress: Boolean(advance_to_in_progress ?? advanceToInProgress),
1819
- metadata: isPlainObject(metadata) ? metadata : {},
1820
- },
1821
- });
1822
- }
1823
-
1824
- async closeCommunicationTransferPacket({
1825
- workTransferPacketId,
1826
- work_transfer_packet_id,
1827
- closureStatus,
1828
- closure_status,
1829
- closureReason,
1830
- closure_reason,
1831
- failureReason,
1832
- failure_reason,
1833
- closedByAgentSessionId,
1834
- closed_by_agent_session_id,
1835
- closedByActorSessionId,
1836
- closed_by_actor_session_id,
1837
- closedByClaimId,
1838
- closed_by_claim_id,
1839
- evidence = {},
1840
- evidenceManifestSha256,
1841
- evidence_manifest_sha256,
1842
- metadata = {},
1843
- } = {}) {
1844
- const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
1845
- if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
1846
- return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/close`, {
1847
- method: 'POST',
1848
- body: {
1849
- closure_status: normalizeTransferLifecycleStatus(cleanText(closure_status) || cleanText(closureStatus) || 'closed'),
1850
- closure_reason: cleanText(closure_reason) || cleanText(closureReason),
1851
- failure_reason: cleanText(failure_reason) || cleanText(failureReason),
1852
- closed_by_agent_session_id: cleanText(closed_by_agent_session_id) || cleanText(closedByAgentSessionId),
1853
- closed_by_actor_session_id: cleanText(closed_by_actor_session_id) || cleanText(closedByActorSessionId),
1854
- closed_by_claim_id: cleanText(closed_by_claim_id) || cleanText(closedByClaimId),
1855
- evidence: isPlainObject(evidence) ? evidence : {},
1856
- evidence_manifest_sha256: cleanText(evidence_manifest_sha256) || cleanText(evidenceManifestSha256),
1857
- metadata: isPlainObject(metadata) ? metadata : {},
1858
- },
1859
- });
1860
- }
1861
-
1862
- async getCommunicationTransferHealth({
1863
- workflowRunId,
1864
- workflow_run_id,
1865
- workTransferPacketId,
1866
- work_transfer_packet_id,
1867
- } = {}) {
1868
- return this._request('/api/agent-communications/transfers/health', {
1869
- query: {
1870
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1871
- work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
1872
- },
1873
- });
1874
- }
1875
-
1876
- async acceptCommunicationMessage(messageId) {
1877
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(messageId)}/accept`, {
1878
- method: 'POST',
1879
- body: {},
1880
- });
1881
- }
1882
-
1883
- async respondToCommunicationMessage({
1884
- agentMessageId,
1885
- agent_message_id,
1886
- messageId,
1887
- status,
1888
- bodyMarkdown,
1889
- body_markdown,
1890
- payload = {},
1891
- metadata = {},
1892
- evidenceRefs,
1893
- evidence_refs,
1894
- } = {}) {
1895
- const normalizedMessageId = cleanText(agent_message_id) || cleanText(agentMessageId) || cleanText(messageId);
1896
- if (!normalizedMessageId) {
1897
- throw new Error('agent_message_id is required.');
1898
- }
1899
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/respond-with-evidence`, {
1900
- method: 'POST',
1901
- body: {
1902
- status: cleanText(status) || 'answered',
1903
- body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
1904
- payload: isPlainObject(payload) ? payload : {},
1905
- metadata: isPlainObject(metadata) ? metadata : {},
1906
- evidence_refs: Array.isArray(evidence_refs) ? evidence_refs : (Array.isArray(evidenceRefs) ? evidenceRefs : []),
1907
- },
1908
- });
1909
- }
1910
-
1911
- async attachCommunicationMessageEvidence({
1912
- agentMessageId,
1913
- agent_message_id,
1914
- messageId,
1915
- evidenceType,
1916
- evidence_type,
1917
- evidenceRef,
1918
- evidence_ref,
1919
- sourceTruth,
1920
- source_truth,
1921
- trustLevel,
1922
- trust_level,
1923
- metadata = {},
1924
- } = {}) {
1925
- const normalizedMessageId = cleanText(agent_message_id) || cleanText(agentMessageId) || cleanText(messageId);
1926
- if (!normalizedMessageId) {
1927
- throw new Error('agent_message_id is required.');
1928
- }
1929
- return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/evidence-links`, {
1930
- method: 'POST',
1931
- body: {
1932
- evidence_type: cleanText(evidence_type) || cleanText(evidenceType),
1933
- evidence_ref: cleanText(evidence_ref) || cleanText(evidenceRef),
1934
- source_truth: cleanText(source_truth) || cleanText(sourceTruth),
1935
- trust_level: cleanText(trust_level) || cleanText(trustLevel) || 'candidate',
1936
- metadata: isPlainObject(metadata) ? metadata : {},
1937
- },
1938
- });
1939
- }
1940
-
1941
- async createCommunicationHandoff({
1942
- workflowRunId,
1943
- workflow_run_id,
1944
- title,
1945
- agentSessionId,
1946
- agent_session_id,
1947
- handoffKind,
1948
- handoff_kind,
1949
- handoffPriority,
1950
- handoff_priority,
1951
- summaryText,
1952
- summary_text,
1953
- handoffPayload = {},
1954
- handoff_payload = {},
1955
- createdBy,
1956
- created_by,
1957
- supersedesHandoffId,
1958
- supersedes_handoff_id,
1959
- } = {}) {
1960
- return this._request('/api/agent-communications/handoffs', {
1961
- method: 'POST',
1962
- body: {
1963
- workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1964
- title: cleanText(title),
1965
- agent_session_id: cleanText(agent_session_id) || cleanText(agentSessionId) || this.agentSessionId,
1966
- handoff_kind: cleanText(handoff_kind) || cleanText(handoffKind) || 'general',
1967
- handoff_priority: cleanText(handoff_priority) || cleanText(handoffPriority) || 'normal',
1968
- summary_text: cleanText(summary_text) || cleanText(summaryText),
1969
- handoff_payload: isPlainObject(handoffPayload)
1970
- ? handoffPayload
1971
- : (isPlainObject(handoff_payload) ? handoff_payload : {}),
1972
- created_by: cleanText(created_by) || cleanText(createdBy),
1973
- supersedes_handoff_id: cleanText(supersedes_handoff_id) || cleanText(supersedesHandoffId),
1974
- },
1975
- });
1976
- }
1977
-
1978
- async acceptCommunicationHandoff(handoffId) {
1979
- return this._request(`/api/agent-communications/handoffs/${encodeURIComponent(handoffId)}/accept`, {
1980
- method: 'POST',
1981
- body: {},
1982
- });
1983
- }
1984
-
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
- async describeDatabaseCatalog({ includeSystemSchemas, limit } = {}) {
1994
- return this.database.schema.getOverview({ includeSystemSchemas, limit });
1995
- }
1996
-
1997
- async listDatabaseSchemas({ includeSystemSchemas, limit } = {}) {
1998
- return this.database.schema.listSchemas({ includeSystemSchemas, limit });
1999
- }
2000
-
2001
- async listDatabaseTables({ schemaName, includeSystemSchemas, limit } = {}) {
2002
- return this.database.schema.listTables({ schemaName, includeSystemSchemas, limit });
2003
- }
2004
-
2005
- async listDatabaseColumns({ schemaName, tableName } = {}) {
2006
- return this.database.schema.listColumns({ schemaName, tableName });
2007
- }
2008
-
2009
- async listDatabaseIndexes({ schemaName, tableName, includeSystemSchemas, limit } = {}) {
2010
- return this.database.schema.listIndexes({ schemaName, tableName, includeSystemSchemas, limit });
2011
- }
2012
-
2013
- async describeDatabaseTable({ schemaName, tableName, includeSystemSchemas } = {}) {
2014
- return this.database.schema.describeTable({ schemaName, tableName, includeSystemSchemas });
2015
- }
2016
-
2017
- async createDatabaseBackup({ databaseName, outputName, noWait } = {}) {
2018
- return this._request('/api/operator/database/backups', {
2019
- method: 'POST',
2020
- body: {
2021
- database_name: databaseName,
2022
- output_name: outputName,
2023
- no_wait: noWait,
2024
- },
2025
- });
2026
- }
2027
-
2028
- async getPortfolioBundle() {
2029
- return this.portfolio.getPortfolioBundle();
2030
- }
2031
-
2032
- async getExternalProjectStatus(projectId) {
2033
- return this._request(`/api/v1/projects/${projectId}/status`);
2034
- }
2035
-
2036
- async getExternalProjectRoadmapSummary(projectId) {
2037
- return this._request(`/api/v1/projects/${projectId}/implementation-roadmap/summary`);
2038
- }
2039
-
2040
- async getExternalProjectRoadmapActiveItem(projectId) {
2041
- return this._request(`/api/v1/projects/${projectId}/implementation-roadmap/active-item`);
2042
- }
2043
-
2044
- async listExternalProjectOpenTasks(projectId) {
2045
- return this._request(`/api/v1/projects/${projectId}/open-tasks`);
2046
- }
2047
-
2048
- async getExternalProjectStatusBundle(projectId) {
2049
- return this._request(`/api/v1/projects/${projectId}/status-bundle`);
2050
- }
2051
-
2052
- async createExternalAudioRender({ text, voice, model, speed, file } = {}) {
2053
- if (file) {
2054
- const form = new FormData();
2055
- form.append('file', file);
2056
- if (voice !== undefined) form.append('voice', String(voice));
2057
- if (model !== undefined) form.append('model', String(model));
2058
- if (speed !== undefined) form.append('speed', String(speed));
2059
- return this._request('/api/v1/audio-renders', { method: 'POST', body: form });
2060
- }
2061
- return this._request('/api/v1/audio-renders', {
2062
- method: 'POST',
2063
- body: { text, voice, model, speed },
2064
- });
2065
- }
2066
-
2067
- async getExternalAudioRender(audioRenderRunId) {
2068
- return this._request(`/api/v1/audio-renders/${audioRenderRunId}`);
2069
- }
2070
-
2071
- async downloadExternalAudioRender(audioRenderRunId) {
2072
- return this._requestBinary(`/api/v1/audio-renders/${audioRenderRunId}/download`);
2073
- }
2074
-
2075
- async listExternalWorkflowRunArtifacts(workflowRunId) {
2076
- return this._request(`/api/v1/runs/${workflowRunId}/artifacts`);
2077
- }
2078
-
2079
- async downloadExternalWorkflowRunArtifact(workflowRunId, artifactType) {
2080
- return this._requestBinary(`/api/v1/runs/${workflowRunId}/artifacts/${artifactType}/download`);
2081
- }
2082
-
2083
187
  // ─── Core HTTP ─────────────────────────────────────────────────────────────
2084
188
 
2085
189
  async _resolveAccessToken() {
@@ -2114,94 +218,4 @@ export class AIEngineClient {
2114
218
  export function createAIEngineClient(options) {
2115
219
  return new AIEngineClient(options);
2116
220
  }
2117
- function defineCompatibilityMethods(proto, targetName, methodNames) {
2118
- for (const methodName of methodNames) {
2119
- if (Object.prototype.hasOwnProperty.call(proto, methodName)) continue;
2120
- Object.defineProperty(proto, methodName, {
2121
- value: function delegatedClientMethod(...args) {
2122
- return this[targetName][methodName](...args);
2123
- },
2124
- configurable: true,
2125
- writable: true,
2126
- });
2127
- }
2128
- }
2129
-
2130
- function defineCompatibilityAliases(proto, targetName, methodMap) {
2131
- for (const [methodName, targetMethodName] of Object.entries(methodMap)) {
2132
- if (Object.prototype.hasOwnProperty.call(proto, methodName)) continue;
2133
- Object.defineProperty(proto, methodName, {
2134
- value: function delegatedClientMethod(...args) {
2135
- return this[targetName][targetMethodName](...args);
2136
- },
2137
- configurable: true,
2138
- writable: true,
2139
- });
2140
- }
2141
- }
2142
-
2143
- function installClientCompatibilityDelegates(ClientClass) {
2144
- const proto = ClientClass.prototype;
2145
- defineCompatibilityMethods(proto, 'health', ['ping']);
2146
- defineCompatibilityMethods(proto, 'operatorStatus', ['currentWorkflowStatus', 'getCurrentWorkflowStatus', 'currentArchitectureIntegrityStatus', 'getCurrentArchitectureIntegrityStatus', 'currentSecurityGovernanceStatus', 'getCurrentSecurityGovernanceStatus', 'getExecutionTelemetryCurrent', 'listExecutionProcessRuns', 'getExecutionProcessRun', 'getGeneratedExecutionUsability', 'getLogaGeneratedExecutionUsabilityProjection', 'getAntiPatternRules', 'currentCodebaseShapeStatus', 'getLatestMemoryProjection', 'currentProjectStatus', 'getDashboard', 'getCommunicationCapabilities', 'getCollaborationCapabilities', 'getDeploymentCapabilities']);
2147
- defineCompatibilityMethods(proto, 'database', ['query', 'createDatabaseBackup', 'listDatabaseBackups', 'getDatabaseBackup', 'listDatabaseBackupOperations', 'runAzureSqlBacpacBackup', 'listAzureSqlBacpacBackups', 'listAzureSqlBacpacBackupOperations']);
2148
- defineCompatibilityMethods(proto, 'reports', ['runReport', 'runReportDefinition']);
2149
- defineCompatibilityMethods(proto, 'retrievalWrapper', ['getCommandCard', 'resolveOperatingProcedure', 'getSymbolDefinition', 'getRelatedCode']);
2150
- defineCompatibilityMethods(proto, 'repo', ['listRepositories', 'getRepository', 'listCodeFiles', 'getCodeFile', 'getCodeFileContentWindow', 'listCodeSymbolsByFile', 'getCodeSymbol', 'searchSymbols', 'getSymbolRelationships', 'listCodeRelationships', 'listActionObservations', 'listCodebaseShapeFindings', 'listObjectFlowObservations', 'getChangeAnalysis', 'listRefactorCandidates', 'analyzeRefactorCandidate', 'getRepoRetrievalPacket', 'getRepoRetrievalPacketFragments', 'evaluateProposalScope']);
2151
- defineCompatibilityMethods(proto, 'retrievalManagement', ['getRetrievalStatus', 'getRetrievalProfileMetrics', 'getRetrievalFeedbackMetrics', 'getRetrievalQuery', 'getRetrievalPacket', 'generateRetrievalCandidates', 'selectRetrievalPacket', 'recordRetrievalFeedback', 'deriveRetrievalOptimizationCandidates', 'validatePromptAssembly']);
2152
- 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']);
2153
- defineCompatibilityMethods(proto, 'projects', ['listProjects', 'getProject', 'listProjectWorkflowRuns', 'closeProject', 'closeActiveProject', 'getProjectBundle', 'listProjectOpenTasks', 'closeRoadmapItemWorkflow']);
2154
- defineCompatibilityMethods(proto, 'projectChartering', ['createProjectCharter', 'createProjectDelivery', 'approveProjectCharterIntent', 'approveImplementationRoadmap', 'runProjectCharter', 'beginImplementationRoadmap', 'routeImplementationItem']);
2155
- defineCompatibilityMethods(proto, 'projectReports', ['getProjectCharterReport', 'createProjectMarkdownDownload', 'downloadProjectMarkdownReport', 'downloadProjectCharterReportMarkdown']);
2156
- defineCompatibilityMethods(proto, 'projectResume', ['resumeProjectWork']);
2157
- defineCompatibilityMethods(proto, 'roadmaps', ['listProjectRoadmaps', 'getProjectRoadmap', 'getProjectRoadmapSummary', 'getProjectRoadmapActiveItem', 'listProjectOpenTasks', 'getProjectPerformanceMetrics', 'ensureProjectRoadmapTaskSurface']);
2158
- defineCompatibilityMethods(proto, 'roadmapReports', ['getProjectImplementationRoadmapReport', 'downloadProjectImplementationRoadmapReportMarkdown']);
2159
- defineCompatibilityMethods(proto, 'implementationTasks', ['createImplementationTask', 'listImplementationTasks', 'listImplementationSubtasks', 'updateImplementationTask', 'assignImplementationTask', 'completeImplementationTask']);
2160
- defineCompatibilityMethods(proto, 'implementationPackets', ['importImplementationPacket', 'listImplementationPackets', 'getImplementationPacket', 'bindImplementationPacketToWorkflow', 'getWorkflowImplementationRoadmap', 'getWorkflowResumeContext', 'importImplementationPacketAndMaterializeRoadmap']);
2161
- defineCompatibilityMethods(proto, 'implementationChecks', ['getImplementationItemAcceptanceChecks', 'updateAcceptanceCheckStatus', 'updateAcceptanceCheckStatusVerified']);
2162
- defineCompatibilityMethods(proto, 'implementationArtifacts', ['getArtifactManifest', 'getDecisionPacket', 'verifyImplementationItemArtifacts']);
2163
- defineCompatibilityMethods(proto, 'implementationItems', ['updateImplementationItemStatus', 'updateImplementationItemStatusVerified']);
2164
- defineCompatibilityMethods(proto, 'implementationEvidence', ['addImplementationItemEvidence', 'addImplementationItemActivity', 'listImplementationItemActivity']);
2165
- defineCompatibilityMethods(proto, 'implementationGates', ['createImplementationPacketGateDecision']);
2166
- defineCompatibilityMethods(proto, 'workflowTurns', ['completeTurn', 'persistAssistantTurn']);
2167
- defineCompatibilityMethods(proto, 'claims', ['getClaim', 'claimIsValid', 'signoffClaim', 'promoteClaimSurface']);
2168
- defineCompatibilityMethods(proto, 'sessionGovernance', ['startSessionGovernance', 'startReviewGovernance', 'evaluateTurnCompliance', 'blockIfNonCompliant']);
2169
- defineCompatibilityMethods(proto, 'workStart', ['startWork', 'startClaimedWork', 'claimWorkItem', 'bindClaimedWorkItem']);
2170
- defineCompatibilityMethods(proto, 'executionEligibility', ['getExecutionEligibility', '_assertExecutionEligibility']);
2171
- defineCompatibilityMethods(proto, 'toolBindingApprovals', ['createWorkflowToolBindingApprovalLane', 'recordWorkflowToolBindingApprovalDecision', 'executeWorkflowToolBindingApprovalBinding', 'revalidateWorkflowToolBindingStartup']);
2172
- defineCompatibilityMethods(proto, 'verifiedMutations', ['executeVerifiedMutation']);
2173
- defineCompatibilityMethods(proto, 'charters', ['runCharter']);
2174
- defineCompatibilityMethods(proto, 'pingPong', ['checkCoordinationPingPongPreflight', 'startCoordinationPingPong', 'sendCoordinationPing', 'sendCoordinationPong', 'getCoordinationPingPongStatus', 'stopCoordinationPingPong']);
2175
- defineCompatibilityAliases(proto, 'pingPong', { pingAgentCommunicationPeer: 'sendCoordinationPing', pongAgentCommunicationPeer: 'sendCoordinationPong' });
2176
- defineCompatibilityMethods(proto, 'transferChannels', ['listCommunicationChannels', 'listOpenCommunicationChannels', 'getCommunicationChannelStatus', 'getCommunicationChannelParticipants', 'openTransferChannel', 'joinTransferChannel', 'resumeTransferChannel', 'replyToTransferChannel', 'closeTransferChannel', 'requestTransferClosure', 'openAgentChannel', 'connectToTransferChannel', 'startAgentConnection', 'postAgentHeartbeat', 'closeAgentChannel']);
2177
- defineCompatibilityMethods(proto, 'messageWatch', ['startMessageWatch', 'acknowledgeExpectedMessage', 'expireMessageWatch', 'respondToMessageWatch', 'acceptAgentChannel', 'resolveMessageWatchId']);
2178
- defineCompatibilityMethods(proto, 'presence', ['getPresenceBoard', 'getChannelPresence', 'markParticipantOnline', 'markParticipantOffline', 'whoIsOnline', 'findOnlineParticipant', 'sendToParticipant', 'sendToRole', 'postPresenceHeartbeat']);
2179
- defineCompatibilityMethods(proto, 'collaborationDomain', ['reviewCollaborationProposal', 'reviseCollaborationProposal', 'postCollaborationProposal', 'acceptCollaborationProposal', 'assignCollaborationOwnership', 'raiseCollaborationBlocker', 'resolveCollaborationBlocker', 'postCollaborationHeartbeat', 'beginCollaborationImplementation', 'requestCollaborationClosure']);
2180
- defineCompatibilityMethods(proto, 'transferBundles', ['transferWorkPacket', 'getTransferBundle', 'listTransferBundles', 'createTransferReceipt', 'listTransferReceipts', 'createCommunicationBundle', 'getCommunicationBundle', 'listCommunicationBundles', 'addCommunicationBundleItem', 'uploadCommunicationBundle', 'attachCommunicationBundleToMessage', 'recordCommunicationBundleReceipt', 'recordCommunicationBundleCleanupEvent', 'claimCommunicationBundle', 'recordCommunicationTransferReceipt']);
2181
- defineCompatibilityMethods(proto, 'workflowComposition', ['registerModernizationAsset', 'classifyModernizationAsset', 'discoverSalvageCandidates', 'createModernizationWorkPacket', 'requestModernizationWrapperExecution', 'getModernizationWrapperEvidence', 'decideModernizationGate']);
2182
- defineCompatibilityMethods(proto, 'currentProject', ['currentProjectStatus']);
2183
- defineCompatibilityMethods(proto, 'projections', ['renderProjection', 'getLogaOperatorHomeProjection', 'getLogaProjectCatalogProjection', 'getLogaProjectPortfolioProjection', 'getLogaProjectRoadmapProjection', 'getLogaRoadmapItemProjection', 'getLogaWorkflowRunProjection', 'getLogaEvidencePacketProjection', 'getLogaTransferHomeProjection', 'getLogaTransferInboxProjection', 'getLogaTransferPacketProjection', 'getLogaTransferNegotiationEventsProjection', 'getLogaTransferFrictionLaneProjection', 'getLogaTransferReceiptsProjection', 'getLogaTransferClosureReviewProjection', 'getTransferChannelProjection']);
2184
- defineCompatibilityAliases(proto, 'projections', { getLogaTransferChannelThreadProjection: 'getTransferChannelProjection' });
2185
- defineCompatibilityMethods(proto, 'loga', ['submitUxGateRemediation', 'listUxGateRemediations', 'getUxGateRemediation', 'appendUxRemediationTicketNote', 'listUxRemediationTicketNotes', 'promoteUxGateRemediationImplementationCandidate', 'getLogaUxGateRemediationProjection', 'getUxGateRemediationProjection']);
2186
- defineCompatibilityMethods(proto, 'actions', ['submitActionIntent']);
2187
- defineCompatibilityMethods(proto, 'executionTelemetry', ['getExecutionTelemetryCurrent', 'listExecutionProcessRuns', 'getExecutionProcessRun', 'getGeneratedExecutionUsability', 'getLogaGeneratedExecutionUsabilityProjection']);
2188
- defineCompatibilityMethods(proto, 'scripts', ['generateScript', 'renderScript', 'submitScriptArtifact', 'getScriptRunEvidence']);
2189
- defineCompatibilityMethods(proto, 'capabilities', ['listCapabilities', 'createCapability', 'testCapability']);
2190
- defineCompatibilityMethods(proto, 'skills', ['currentSkillRegistryStatus', 'getSkillContract', 'getSkillGovernance', 'createSkillContractDraft', 'recordSkillPatternReview', 'approveSkillContract', 'createWorkflowSkillContract', 'listWorkflowSkillBindings', 'seedFrequentOperationSkills']);
2191
- defineCompatibilityMethods(proto, 'skillGovernance', ['createSkillGovernanceChange', 'listSkillGovernanceChanges', 'getSkillGovernanceChange']);
2192
- defineCompatibilityMethods(proto, 'toolRegistry', ['currentToolRegistryStatus', 'getWorkflowToolRegistry', 'currentAssistantToolContext', 'getTool', 'getToolHistory', 'getToolInvocations', 'getToolEventReplayBundle', 'getToolGovernance', 'createToolReviewDecision', 'createToolGateDecision']);
2193
- defineCompatibilityMethods(proto, 'contextAssembly', ['getContextAssemblyContract', 'getContextAssemblyStatus', 'getOperatorContext', 'getContextFragments', 'getContextReuse', 'listPromptAssemblies']);
2194
- defineCompatibilityMethods(proto, 'performance', ['getSessionPerformanceMetrics', 'captureBenchmarkSnapshot', 'listBenchmarks', 'getBenchmarkMetrics', 'getBenchmarkDelta', 'getBenchmarkTrend', 'getPerformanceDashboard']);
2195
- defineCompatibilityMethods(proto, 'selfLearning', ['getSelfLearningPosture', 'listLearningRecords', 'getLearningRecord', 'listPromotionCandidates', 'getPromotionCandidate', 'listPromotionFlows']);
2196
- defineCompatibilityMethods(proto, 'selfOptimization', ['getSelfOptimizationDashboard', 'getSelfOptimizationCandidateQueue', 'getSelfOptimizationBacklogPosture', 'getSelfOptimizationPendingHandoffs']);
2197
- defineCompatibilityMethods(proto, 'designIntelligence', ['getDesignIntelligenceDashboard', 'listDesignDecisions', 'getDesignDecision', 'getDesignDecisionVariants', 'getDesignDecisionCritique', 'getDesignDecisionLineage', 'listDesignPatterns', 'getDecisionLabCanvas', 'getDesignRecommendations', 'getDesignPromotions', 'previewDesignPromotion', 'getDesignIntelligenceMetrics']);
2198
- defineCompatibilityMethods(proto, 'scriptDiscovery', ['scanScripts', 'listDiscoveredScriptAssets', 'listDiscoveredCapabilities', 'listWorkflowCandidates', 'promoteWorkflowCandidate']);
2199
- defineCompatibilityMethods(proto, 'notesLab', ['getNotesLabConfig', 'submitNote', 'approveNoteReview']);
2200
- defineCompatibilityMethods(proto, 'searchContacts', ['search', 'getOrganization', 'getContact']);
2201
- defineCompatibilityMethods(proto, 'benchmarks', ['listRecentBenchmarkRuns', 'getBenchmarkRun']);
2202
- defineCompatibilityMethods(proto, 'commitGovernance', ['evaluateCommitGovernance', 'checkGitShipReadiness', 'getCommitGovernanceEvaluation', 'listCommitGovernanceEvaluationsByClaim']);
2203
- defineCompatibilityMethods(proto, 'contextSessions', ['openContextSession', 'getOrientationWindow', 'acknowledgeReminder', 'completeOrientation', 'lockContextSessionClaim', 'getContextSessionGateStatus']);
2204
- defineCompatibilityMethods(proto, 'contextOrientation', ['conductOrientation']);
2205
- defineCompatibilityMethods(proto, 'portfolio', ['getPortfolioStatus', 'getPortfolioBundle', 'getPortfolioClosureReadiness']);
2206
- }
2207
221
  installClientCompatibilityDelegates(AIEngineClient);