@bpmsoftwaresolutions/ai-engine-client 1.1.99 → 1.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/client.js +3 -1091
- package/src/compat/aliases.js +6 -2
- package/src/domains/ping-pong.js +1 -13
- package/src/index.js +1 -1
- package/src/transport/index.js +2 -1
- package/src/utils/communication.js +1 -1
- package/src/utils/loga.js +1 -0
- package/src/utils/request.js +10 -0
- package/src/utils/version.js +12 -0
package/package.json
CHANGED
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';
|
|
@@ -73,183 +71,7 @@ import { createWorkflowsDomain } from './domains/workflows.js';
|
|
|
73
71
|
import { createWarehouseDomain } from './domains/warehouse.js';
|
|
74
72
|
import { installClientCompatibilityDelegates } from './compat/aliases.js';
|
|
75
73
|
import { buildHeaders, requestBinary, requestJson, requestLogaProjection, requestText, resolveAccessToken } from './transport/index.js';
|
|
76
|
-
import {
|
|
77
|
-
|
|
78
|
-
function normalizeThreadType(value) {
|
|
79
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_THREAD_TYPES, 'coordination', 'thread_type', {
|
|
80
|
-
task_request: 'request',
|
|
81
|
-
task: 'request',
|
|
82
|
-
review_request: 'review',
|
|
83
|
-
handoff_request: 'handoff',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function normalizeMessageKind(value) {
|
|
88
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_MESSAGE_KINDS, 'request', 'message_kind', {
|
|
89
|
-
task: 'request',
|
|
90
|
-
note: 'request',
|
|
91
|
-
update: 'response',
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function normalizeConnectionFirstMessageKind(value, transferKind) {
|
|
96
|
-
const text = cleanText(value);
|
|
97
|
-
if (!text) {
|
|
98
|
-
return normalizeMessageKind(transferKind === 'handoff' ? 'handoff' : 'request');
|
|
99
|
-
}
|
|
100
|
-
const normalized = text.toLowerCase();
|
|
101
|
-
const aliases = {
|
|
102
|
-
connection_request: 'request',
|
|
103
|
-
connection_accepted: 'response',
|
|
104
|
-
connection_acceptance: 'response',
|
|
105
|
-
handoff_request: 'handoff',
|
|
106
|
-
handoff_acceptance: 'response',
|
|
107
|
-
handoff_response: 'response',
|
|
108
|
-
acceptance: 'response',
|
|
109
|
-
decline: 'response',
|
|
110
|
-
};
|
|
111
|
-
const candidate = aliases[normalized] || text;
|
|
112
|
-
try {
|
|
113
|
-
return normalizeMessageKind(candidate);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
void error;
|
|
116
|
-
return normalizeMessageKind(transferKind === 'handoff' ? 'handoff' : 'request');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function normalizeTransferKind(value) {
|
|
121
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_KINDS, 'upstream_remediation', 'transfer_kind', {
|
|
122
|
-
remediation_request: 'upstream_remediation',
|
|
123
|
-
review: 'review_request',
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function normalizeTransferMode(value) {
|
|
128
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_MODES, 'inline_payload', 'transfer_mode');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function normalizeTransferLifecycleStatus(value) {
|
|
132
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_LIFECYCLE_STATES, 'created', 'lifecycle_status');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function normalizeTransferReceiptType(value) {
|
|
136
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_RECEIPT_TYPES, 'delivery_receipt', 'receipt_type');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function normalizeRecipientMode(value) {
|
|
140
|
-
return normalizeEnum(value, AGENT_COMMUNICATION_RECIPIENT_MODES, 'role', 'recipient_mode');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function appendQuery(url, query) {
|
|
144
|
-
const target = new URL(url);
|
|
145
|
-
for (const [key, value] of Object.entries(query || {})) {
|
|
146
|
-
if (value === undefined || value === null || value === '') continue;
|
|
147
|
-
target.searchParams.set(key, String(value));
|
|
148
|
-
}
|
|
149
|
-
return target;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
async function readJson(response) {
|
|
153
|
-
const contentType = response.headers.get('content-type') || '';
|
|
154
|
-
if (contentType.includes('application/json')) return response.json();
|
|
155
|
-
const text = await response.text();
|
|
156
|
-
return { message: text };
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function parseContentDispositionFilename(headerValue) {
|
|
160
|
-
const value = String(headerValue || '');
|
|
161
|
-
const quotedMatch = value.match(/filename="([^"]+)"/i);
|
|
162
|
-
if (quotedMatch) return quotedMatch[1];
|
|
163
|
-
const plainMatch = value.match(/filename=([^;]+)/i);
|
|
164
|
-
return plainMatch ? plainMatch[1].trim() : null;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function readResponseHeader(headers, name) {
|
|
168
|
-
if (!headers || typeof headers.get !== 'function') return null;
|
|
169
|
-
return headers.get(name) || headers.get(name.toLowerCase()) || null;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function extractLogaProjectionMetadata(headers) {
|
|
173
|
-
const projectionWorkflow = readResponseHeader(headers, 'x-projection-workflow');
|
|
174
|
-
const projectionVersion = readResponseHeader(headers, 'x-projection-version');
|
|
175
|
-
const sourceVersion = readResponseHeader(headers, 'x-source-version');
|
|
176
|
-
const correlationId = readResponseHeader(headers, 'x-correlation-id');
|
|
177
|
-
const logaContract = readResponseHeader(headers, 'x-loga-contract');
|
|
178
|
-
const navigationContract = readResponseHeader(headers, 'x-navigation-contract');
|
|
179
|
-
const projectionType = readResponseHeader(headers, 'x-projection-type');
|
|
180
|
-
const sourceTruth = readResponseHeader(headers, 'x-source-truth');
|
|
181
|
-
const refreshPolicy = readResponseHeader(headers, 'x-refresh-policy');
|
|
182
|
-
const generatedAt = readResponseHeader(headers, 'x-generated-at');
|
|
183
|
-
|
|
184
|
-
return {
|
|
185
|
-
logaContract,
|
|
186
|
-
navigationContract,
|
|
187
|
-
interactionContract: LOGA_INTERACTION_CONTRACT,
|
|
188
|
-
projectionType,
|
|
189
|
-
projectionWorkflow,
|
|
190
|
-
projectionVersion,
|
|
191
|
-
sourceTruth,
|
|
192
|
-
sourceVersion,
|
|
193
|
-
correlationId,
|
|
194
|
-
refreshPolicy,
|
|
195
|
-
generatedAt,
|
|
196
|
-
provenance: {
|
|
197
|
-
sourceTruth,
|
|
198
|
-
sourceVersion,
|
|
199
|
-
projectionVersion,
|
|
200
|
-
projectionWorkflow,
|
|
201
|
-
correlationId,
|
|
202
|
-
generatedAt,
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function isFormDataBody(value) {
|
|
208
|
-
return typeof FormData !== 'undefined' && value instanceof FormData;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function isBinaryBody(value) {
|
|
212
|
-
return (
|
|
213
|
-
value instanceof ArrayBuffer
|
|
214
|
-
|| ArrayBuffer.isView(value)
|
|
215
|
-
|| (typeof Blob !== 'undefined' && value instanceof Blob)
|
|
216
|
-
|| value instanceof URLSearchParams
|
|
217
|
-
|| typeof value === 'string'
|
|
218
|
-
);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
function isJsonBody(value) {
|
|
222
|
-
if (value === undefined || value === null) return false;
|
|
223
|
-
if (isFormDataBody(value) || isBinaryBody(value)) return false;
|
|
224
|
-
return typeof value === 'object';
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function cleanText(value) {
|
|
228
|
-
const text = String(value || '').trim();
|
|
229
|
-
return text || null;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function compareSemanticVersions(left, right) {
|
|
233
|
-
const leftParts = String(left || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
234
|
-
const rightParts = String(right || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
235
|
-
const width = Math.max(leftParts.length, rightParts.length);
|
|
236
|
-
for (let index = 0; index < width; index += 1) {
|
|
237
|
-
const a = leftParts[index] || 0;
|
|
238
|
-
const b = rightParts[index] || 0;
|
|
239
|
-
if (a > b) return 1;
|
|
240
|
-
if (a < b) return -1;
|
|
241
|
-
}
|
|
242
|
-
return 0;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function cleanList(value) {
|
|
246
|
-
if (!Array.isArray(value)) return [];
|
|
247
|
-
return value.map((item) => cleanText(item)).filter(Boolean);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function isPlainObject(value) {
|
|
251
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
252
|
-
}
|
|
74
|
+
import { cleanText, isPlainObject, trimTrailingSlash } from './utils/text.js';
|
|
253
75
|
|
|
254
76
|
export class AIEngineClient {
|
|
255
77
|
constructor({ baseUrl, accessToken, tokenProvider, apiKey, clientId, actorId, agentSessionId, fetchImpl, timeoutMs } = {}) {
|
|
@@ -324,6 +146,7 @@ export class AIEngineClient {
|
|
|
324
146
|
this.reports = createReportsDomain(this);
|
|
325
147
|
this.projections = createProjectionsDomain(this);
|
|
326
148
|
this.workflowComposition = createWorkflowCompositionDomain(this);
|
|
149
|
+
this.workflowComposition.searchCodeByIntent = (request) => this.searchCodeByIntent(request);
|
|
327
150
|
this.warehouse = createWarehouseDomain(this);
|
|
328
151
|
this.actions = createActionsDomain(this);
|
|
329
152
|
this.transferBundles = createTransferBundlesDomain(this);
|
|
@@ -340,6 +163,7 @@ export class AIEngineClient {
|
|
|
340
163
|
this.collaborationDomain = createCollaborationDomain(this);
|
|
341
164
|
this.agentComms = createAgentCommunicationsFacade(this);
|
|
342
165
|
this.collaboration = createCollaborationFacade(this);
|
|
166
|
+
this.collaboration.postCollaborationProposal = (request) => this.postCollaborationProposal(request);
|
|
343
167
|
}
|
|
344
168
|
|
|
345
169
|
static fromEnv(options = {}) {
|
|
@@ -358,922 +182,10 @@ export class AIEngineClient {
|
|
|
358
182
|
|
|
359
183
|
// ─── Health ────────────────────────────────────────────────────────────────
|
|
360
184
|
|
|
361
|
-
async startAgentConnection({
|
|
362
|
-
workflowRunId,
|
|
363
|
-
workflow_run_id,
|
|
364
|
-
upstreamAgent,
|
|
365
|
-
upstream_agent,
|
|
366
|
-
upstreamAgentSessionId,
|
|
367
|
-
upstream_agent_session_id,
|
|
368
|
-
upstreamAgentId,
|
|
369
|
-
upstream_agent_id,
|
|
370
|
-
upstreamRole,
|
|
371
|
-
upstream_role,
|
|
372
|
-
recipientMode,
|
|
373
|
-
recipient_mode,
|
|
374
|
-
purpose,
|
|
375
|
-
objective,
|
|
376
|
-
mode = 'handoff',
|
|
377
|
-
firstMessage = {},
|
|
378
|
-
first_message = {},
|
|
379
|
-
expectedMessageKind,
|
|
380
|
-
expected_message_kind,
|
|
381
|
-
participantRole,
|
|
382
|
-
participant_role,
|
|
383
|
-
participantLabel,
|
|
384
|
-
participant_label,
|
|
385
|
-
senderAgentSessionId,
|
|
386
|
-
sender_agent_session_id,
|
|
387
|
-
senderActorSessionId,
|
|
388
|
-
sender_actor_session_id,
|
|
389
|
-
cleanupPolicy,
|
|
390
|
-
cleanup_policy,
|
|
391
|
-
staleAfterSeconds = 300,
|
|
392
|
-
stale_after_seconds,
|
|
393
|
-
operatorNudge,
|
|
394
|
-
operator_nudge,
|
|
395
|
-
metadata = {},
|
|
396
|
-
} = {}) {
|
|
397
|
-
return this.agentCommunications.startAgentConnection(arguments[0]);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
async establishAgentCommunicationChannel({
|
|
401
|
-
projectIdentifier,
|
|
402
|
-
projectId,
|
|
403
|
-
claimId,
|
|
404
|
-
actorId,
|
|
405
|
-
actorMode = 'operator',
|
|
406
|
-
executionIntent = 'establish agent communication channel',
|
|
407
|
-
workflowRunLimit = 5,
|
|
408
|
-
startWorkBody = {},
|
|
409
|
-
startWorkRequest = {},
|
|
410
|
-
resumeProjectWorkOptions = {},
|
|
411
|
-
transferKind = 'coordination',
|
|
412
|
-
objective,
|
|
413
|
-
requestedOutcome,
|
|
414
|
-
transferChannelId,
|
|
415
|
-
transfer_channel_id,
|
|
416
|
-
channelId,
|
|
417
|
-
channel_id,
|
|
418
|
-
workTransferPacketId,
|
|
419
|
-
work_transfer_packet_id,
|
|
420
|
-
packetId,
|
|
421
|
-
packet_id,
|
|
422
|
-
participantRole,
|
|
423
|
-
participant_role,
|
|
424
|
-
participantLabel,
|
|
425
|
-
participant_label,
|
|
426
|
-
participantKind,
|
|
427
|
-
participant_kind,
|
|
428
|
-
agentSessionId,
|
|
429
|
-
agent_session_id,
|
|
430
|
-
actorSessionId,
|
|
431
|
-
actor_session_id,
|
|
432
|
-
upstreamAgentSessionId,
|
|
433
|
-
upstream_agent_session_id,
|
|
434
|
-
upstreamActorSessionId,
|
|
435
|
-
upstream_actor_session_id,
|
|
436
|
-
downstreamAgentSessionId,
|
|
437
|
-
downstream_agent_session_id,
|
|
438
|
-
downstreamActorSessionId,
|
|
439
|
-
downstream_actor_session_id,
|
|
440
|
-
expectedMessageKind = 'connection_accepted',
|
|
441
|
-
expected_message_kind,
|
|
442
|
-
expectedNextMessage,
|
|
443
|
-
expected_next_message,
|
|
444
|
-
currentPhase = 'channel_ready',
|
|
445
|
-
current_phase,
|
|
446
|
-
currentTaskSummary,
|
|
447
|
-
current_task_summary,
|
|
448
|
-
channelKind = 'bidirectional',
|
|
449
|
-
channel_kind,
|
|
450
|
-
includeTransferChannelProjection = true,
|
|
451
|
-
includeChannelPresenceProjection = true,
|
|
452
|
-
includeOperatorProjectionMetadata = true,
|
|
453
|
-
metadata = {},
|
|
454
|
-
} = {}) {
|
|
455
|
-
return this.agentCommunications.establishAgentCommunicationChannel(arguments[0]);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
async runInterAgentMessagingLoop({
|
|
459
|
-
transferChannelId,
|
|
460
|
-
transfer_channel_id,
|
|
461
|
-
channelId,
|
|
462
|
-
channel_id,
|
|
463
|
-
workTransferPacketId,
|
|
464
|
-
work_transfer_packet_id,
|
|
465
|
-
workflowRunId,
|
|
466
|
-
workflow_run_id,
|
|
467
|
-
participantRole,
|
|
468
|
-
participant_role,
|
|
469
|
-
watchingAgentRole,
|
|
470
|
-
watching_agent_role,
|
|
471
|
-
expectedFromRole,
|
|
472
|
-
expected_from_role,
|
|
473
|
-
expectedMessageKind,
|
|
474
|
-
expected_message_kind,
|
|
475
|
-
expectedNextMessage,
|
|
476
|
-
expected_next_message,
|
|
477
|
-
replyRequest = {},
|
|
478
|
-
reply_request = {},
|
|
479
|
-
replyBodyMarkdown,
|
|
480
|
-
reply_body_markdown,
|
|
481
|
-
replyMessageKind,
|
|
482
|
-
reply_message_kind,
|
|
483
|
-
replyPayload = {},
|
|
484
|
-
reply_payload = {},
|
|
485
|
-
replyScope = {},
|
|
486
|
-
reply_scope = {},
|
|
487
|
-
replyEvidenceRefs = [],
|
|
488
|
-
reply_evidence_refs = [],
|
|
489
|
-
replyRecipientAgentSessionId,
|
|
490
|
-
reply_recipient_agent_session_id,
|
|
491
|
-
replyRecipientActorSessionId,
|
|
492
|
-
reply_recipient_actor_session_id,
|
|
493
|
-
replySenderAgentSessionId,
|
|
494
|
-
reply_sender_agent_session_id,
|
|
495
|
-
replySenderActorSessionId,
|
|
496
|
-
reply_sender_actor_session_id,
|
|
497
|
-
watchRequest = {},
|
|
498
|
-
watch_request = {},
|
|
499
|
-
acknowledgeRequest = {},
|
|
500
|
-
acknowledge_request = {},
|
|
501
|
-
heartbeatRequest = {},
|
|
502
|
-
heartbeat_request = {},
|
|
503
|
-
closeWhenAcknowledged = false,
|
|
504
|
-
close_when_acknowledged = false,
|
|
505
|
-
requestClosure = false,
|
|
506
|
-
request_closure = false,
|
|
507
|
-
closureReason,
|
|
508
|
-
closure_reason,
|
|
509
|
-
failureReason,
|
|
510
|
-
failure_reason,
|
|
511
|
-
closureEvidence = {},
|
|
512
|
-
closure_evidence = {},
|
|
513
|
-
closureEvidenceManifestSha256,
|
|
514
|
-
closure_evidence_manifest_sha256,
|
|
515
|
-
includeTransferChannelProjection = true,
|
|
516
|
-
includeOperatorProjectionMetadata = true,
|
|
517
|
-
metadata = {},
|
|
518
|
-
} = {}) {
|
|
519
|
-
return this.agentCommunications.runInterAgentMessagingLoop(arguments[0]);
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
async createCrossAgentRemediationTicket({
|
|
523
|
-
transferChannelId,
|
|
524
|
-
transfer_channel_id,
|
|
525
|
-
channelId,
|
|
526
|
-
channel_id,
|
|
527
|
-
workTransferPacketId,
|
|
528
|
-
work_transfer_packet_id,
|
|
529
|
-
packetId,
|
|
530
|
-
packet_id,
|
|
531
|
-
workflowRunId,
|
|
532
|
-
workflow_run_id,
|
|
533
|
-
ownershipMove,
|
|
534
|
-
ownership_move,
|
|
535
|
-
transferOwnership,
|
|
536
|
-
transfer_ownership,
|
|
537
|
-
assignedTo,
|
|
538
|
-
assigned_to,
|
|
539
|
-
requestedBy,
|
|
540
|
-
requested_by,
|
|
541
|
-
severity,
|
|
542
|
-
sourceRef,
|
|
543
|
-
source_ref,
|
|
544
|
-
findingId,
|
|
545
|
-
finding_id,
|
|
546
|
-
blockerId,
|
|
547
|
-
blocker_id,
|
|
548
|
-
failedCheckId,
|
|
549
|
-
failed_check_id,
|
|
550
|
-
workflowGap,
|
|
551
|
-
workflow_gap,
|
|
552
|
-
blockerKind,
|
|
553
|
-
blocker_kind,
|
|
554
|
-
blockerSummary,
|
|
555
|
-
blocker_summary,
|
|
556
|
-
blockerDetails,
|
|
557
|
-
blocker_details,
|
|
558
|
-
expectedResponse,
|
|
559
|
-
expected_response,
|
|
560
|
-
participantRole,
|
|
561
|
-
participant_role,
|
|
562
|
-
watcherRole,
|
|
563
|
-
watcher_role,
|
|
564
|
-
proposalId,
|
|
565
|
-
proposal_id,
|
|
566
|
-
collaborationProposalId,
|
|
567
|
-
collaboration_proposal_id,
|
|
568
|
-
expectedMessageKind,
|
|
569
|
-
expected_message_kind,
|
|
570
|
-
messageWatchId,
|
|
571
|
-
message_watch_id,
|
|
572
|
-
replyBodyMarkdown,
|
|
573
|
-
reply_body_markdown,
|
|
574
|
-
replyPayload = {},
|
|
575
|
-
reply_payload = {},
|
|
576
|
-
replyScope = {},
|
|
577
|
-
reply_scope = {},
|
|
578
|
-
replyEvidenceRefs = [],
|
|
579
|
-
reply_evidence_refs = [],
|
|
580
|
-
metadata = {},
|
|
581
|
-
includeTransferChannelProjection = true,
|
|
582
|
-
includeOperatorProjectionMetadata = true,
|
|
583
|
-
} = {}) {
|
|
584
|
-
return this.communicationTickets.createCrossAgentRemediationTicket(arguments[0]);
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
async transferRefactoringBundle(request = {}) {
|
|
588
|
-
return this.refactoringTransfers.transferRefactoringBundle(request);
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
async postAgentHeartbeat(request = {}) {
|
|
592
|
-
return this.transferChannels.postAgentHeartbeat(request);
|
|
593
|
-
}
|
|
594
|
-
|
|
595
185
|
async postAgentMessage(request = {}) {
|
|
596
186
|
return this._sendAgentCommsMessage(request);
|
|
597
187
|
}
|
|
598
188
|
|
|
599
|
-
async acknowledgeAgentMessage({
|
|
600
|
-
transferChannelId,
|
|
601
|
-
transfer_channel_id,
|
|
602
|
-
channelId,
|
|
603
|
-
channel_id,
|
|
604
|
-
messageWatchId,
|
|
605
|
-
message_watch_id,
|
|
606
|
-
watchId,
|
|
607
|
-
watch_id,
|
|
608
|
-
messageId,
|
|
609
|
-
message_id,
|
|
610
|
-
messageKind,
|
|
611
|
-
message_kind,
|
|
612
|
-
observedMessageId,
|
|
613
|
-
observed_message_id,
|
|
614
|
-
observedMessageKind,
|
|
615
|
-
observed_message_kind,
|
|
616
|
-
operatorNudge,
|
|
617
|
-
operator_nudge,
|
|
618
|
-
metadata = {},
|
|
619
|
-
} = {}) {
|
|
620
|
-
const normalizedWatchId = cleanText(message_watch_id) || cleanText(messageWatchId) || cleanText(watch_id) || cleanText(watchId) || await this._resolveMessageWatchId({ transfer_channel_id, transferChannelId, channel_id, channelId });
|
|
621
|
-
if (!normalizedWatchId) throw new Error('message_watch_id is required.');
|
|
622
|
-
return this._request(`/api/agent-communications/message-watches/${encodeURIComponent(normalizedWatchId)}/acknowledge-message`, {
|
|
623
|
-
method: 'POST',
|
|
624
|
-
body: {
|
|
625
|
-
observed_message_id: cleanText(observed_message_id) || cleanText(observedMessageId) || cleanText(message_id) || cleanText(messageId),
|
|
626
|
-
observed_message_kind: cleanText(observed_message_kind) || cleanText(observedMessageKind) || cleanText(message_kind) || cleanText(messageKind),
|
|
627
|
-
operator_nudge: cleanText(operator_nudge) || cleanText(operatorNudge),
|
|
628
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
629
|
-
},
|
|
630
|
-
});
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
async closeAgentChannel(request = {}) {
|
|
634
|
-
return this.transferChannels.closeAgentChannel(request);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
async reviseCollaborationProposal(request = {}) {
|
|
638
|
-
return this.collaborationDomain.reviseCollaborationProposal(request);
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
async raiseCollaborationBlocker(request = {}) {
|
|
642
|
-
return this.collaborationDomain.raiseCollaborationBlocker(request);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
async beginCollaborationImplementation(request = {}) {
|
|
646
|
-
return this.collaborationDomain.beginCollaborationImplementation(request);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
async bootstrapCommunication() {
|
|
650
|
-
return this._request('/api/agent-communications/bootstrap');
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
async negotiateCommunicationTransfer({
|
|
654
|
-
preferredModes,
|
|
655
|
-
preferred_modes,
|
|
656
|
-
preferred,
|
|
657
|
-
capabilities = {},
|
|
658
|
-
estimatedPayloadKb,
|
|
659
|
-
estimated_payload_kb,
|
|
660
|
-
requiresReceipts = true,
|
|
661
|
-
requires_receipts = true,
|
|
662
|
-
supportsHashValidation = true,
|
|
663
|
-
supports_hash_validation = true,
|
|
664
|
-
transferKind,
|
|
665
|
-
transfer_kind,
|
|
666
|
-
workflowRunId,
|
|
667
|
-
workflow_run_id,
|
|
668
|
-
} = {}) {
|
|
669
|
-
const normalizedPreferredModes = Array.isArray(preferred_modes)
|
|
670
|
-
? preferred_modes
|
|
671
|
-
: (Array.isArray(preferredModes) ? preferredModes : (Array.isArray(preferred) ? preferred : ['bundle', 'artifact_refs', 'inline_payload']));
|
|
672
|
-
return this._request('/api/agent-communications/transfers/negotiate', {
|
|
673
|
-
method: 'POST',
|
|
674
|
-
body: {
|
|
675
|
-
preferred_modes: normalizedPreferredModes.map((mode) => normalizeTransferMode(mode)),
|
|
676
|
-
capabilities: isPlainObject(capabilities) ? capabilities : {},
|
|
677
|
-
estimated_payload_kb: Number(estimated_payload_kb ?? estimatedPayloadKb ?? 0) || undefined,
|
|
678
|
-
requires_receipts: Boolean(requires_receipts ?? requiresReceipts),
|
|
679
|
-
supports_hash_validation: Boolean(supports_hash_validation ?? supportsHashValidation),
|
|
680
|
-
transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
|
|
681
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
682
|
-
},
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
async resolveCommunicationTarget({
|
|
687
|
-
intent,
|
|
688
|
-
transferKind,
|
|
689
|
-
transfer_kind,
|
|
690
|
-
recipientMode,
|
|
691
|
-
recipient_mode,
|
|
692
|
-
preferredRoleKey,
|
|
693
|
-
preferred_role_key,
|
|
694
|
-
preferredAgentSessionId,
|
|
695
|
-
preferred_agent_session_id,
|
|
696
|
-
workflowRunId,
|
|
697
|
-
workflow_run_id,
|
|
698
|
-
} = {}) {
|
|
699
|
-
return this._request('/api/agent-communications/targets/resolve', {
|
|
700
|
-
method: 'POST',
|
|
701
|
-
body: {
|
|
702
|
-
intent: cleanText(intent) || cleanText(transfer_kind) || cleanText(transferKind),
|
|
703
|
-
recipient_mode: normalizeRecipientMode(recipient_mode ?? recipientMode ?? 'role'),
|
|
704
|
-
preferred_role_key: cleanText(preferred_role_key) || cleanText(preferredRoleKey),
|
|
705
|
-
preferred_agent_session_id: cleanText(preferred_agent_session_id) || cleanText(preferredAgentSessionId),
|
|
706
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
707
|
-
},
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
async createCommunicationEvidencePacket({
|
|
712
|
-
workflowRunId,
|
|
713
|
-
workflow_run_id,
|
|
714
|
-
transferKind,
|
|
715
|
-
transfer_kind,
|
|
716
|
-
objective,
|
|
717
|
-
requestedOutcome,
|
|
718
|
-
requested_outcome,
|
|
719
|
-
artifacts = [],
|
|
720
|
-
artifactRefs,
|
|
721
|
-
artifact_refs,
|
|
722
|
-
issues = [],
|
|
723
|
-
issueRefs,
|
|
724
|
-
issue_refs,
|
|
725
|
-
expectedEvidence = [],
|
|
726
|
-
expected_evidence,
|
|
727
|
-
metadata = {},
|
|
728
|
-
} = {}) {
|
|
729
|
-
return this._request('/api/agent-communications/evidence-packets', {
|
|
730
|
-
method: 'POST',
|
|
731
|
-
body: {
|
|
732
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
733
|
-
transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
|
|
734
|
-
objective: cleanText(objective),
|
|
735
|
-
requested_outcome: cleanText(requested_outcome) || cleanText(requestedOutcome),
|
|
736
|
-
artifacts: Array.isArray(artifacts) ? artifacts : (Array.isArray(artifact_refs) ? artifact_refs : (Array.isArray(artifactRefs) ? artifactRefs : [])),
|
|
737
|
-
issues: Array.isArray(issues) ? issues : (Array.isArray(issue_refs) ? issue_refs : (Array.isArray(issueRefs) ? issueRefs : [])),
|
|
738
|
-
expected_evidence: Array.isArray(expected_evidence) ? expected_evidence : (Array.isArray(expectedEvidence) ? expectedEvidence : []),
|
|
739
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
740
|
-
},
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
async listCommunicationFrictionTaxonomy({
|
|
745
|
-
categoryGroup,
|
|
746
|
-
category_group,
|
|
747
|
-
isActive,
|
|
748
|
-
is_active,
|
|
749
|
-
} = {}) {
|
|
750
|
-
return this._request('/api/agent-communications/friction-taxonomy', {
|
|
751
|
-
query: {
|
|
752
|
-
category_group: cleanText(category_group) || cleanText(categoryGroup),
|
|
753
|
-
is_active: is_active !== undefined ? String(Boolean(is_active)) : (isActive !== undefined ? String(Boolean(isActive)) : undefined),
|
|
754
|
-
},
|
|
755
|
-
});
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
async recordCommunicationFrictionEvent({
|
|
759
|
-
workflowRunId,
|
|
760
|
-
workflow_run_id,
|
|
761
|
-
workTransferPacketId,
|
|
762
|
-
work_transfer_packet_id,
|
|
763
|
-
communicationThreadId,
|
|
764
|
-
communication_thread_id,
|
|
765
|
-
communicationMessageId,
|
|
766
|
-
communication_message_id,
|
|
767
|
-
taxonomyKey,
|
|
768
|
-
taxonomy_key,
|
|
769
|
-
frictionType,
|
|
770
|
-
friction_type,
|
|
771
|
-
severity,
|
|
772
|
-
observedBehavior,
|
|
773
|
-
observed_behavior,
|
|
774
|
-
attemptedAction,
|
|
775
|
-
attempted_action,
|
|
776
|
-
resolutionPath,
|
|
777
|
-
resolution_path,
|
|
778
|
-
missingSurfaceKey,
|
|
779
|
-
missing_surface_key,
|
|
780
|
-
promotionCandidate,
|
|
781
|
-
promotion_candidate,
|
|
782
|
-
repeatedCount,
|
|
783
|
-
repeated_count,
|
|
784
|
-
metadata = {},
|
|
785
|
-
} = {}) {
|
|
786
|
-
return this._request('/api/agent-communications/friction-events', {
|
|
787
|
-
method: 'POST',
|
|
788
|
-
body: {
|
|
789
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
790
|
-
work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
|
|
791
|
-
communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId),
|
|
792
|
-
communication_message_id: cleanText(communication_message_id) || cleanText(communicationMessageId),
|
|
793
|
-
taxonomy_key: cleanText(taxonomy_key) || cleanText(taxonomyKey) || 'enum_drift',
|
|
794
|
-
friction_type: cleanText(friction_type) || cleanText(frictionType) || 'discovery',
|
|
795
|
-
severity: cleanText(severity) || 'warning',
|
|
796
|
-
observed_behavior: cleanText(observed_behavior) || cleanText(observedBehavior),
|
|
797
|
-
attempted_action: cleanText(attempted_action) || cleanText(attemptedAction),
|
|
798
|
-
resolution_path: cleanText(resolution_path) || cleanText(resolutionPath),
|
|
799
|
-
missing_surface_key: cleanText(missing_surface_key) || cleanText(missingSurfaceKey),
|
|
800
|
-
promotion_candidate: Boolean(promotion_candidate ?? promotionCandidate),
|
|
801
|
-
repeated_count: Number(repeated_count ?? repeatedCount ?? 1) || 1,
|
|
802
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
803
|
-
},
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
async openCommunicationThread({
|
|
808
|
-
workflowRunId,
|
|
809
|
-
workflow_run_id,
|
|
810
|
-
threadType,
|
|
811
|
-
thread_type,
|
|
812
|
-
subject,
|
|
813
|
-
objective,
|
|
814
|
-
parentThreadId,
|
|
815
|
-
parent_thread_id,
|
|
816
|
-
createdByAgentSessionId,
|
|
817
|
-
created_by_agent_session_id,
|
|
818
|
-
createdByActorSessionId,
|
|
819
|
-
created_by_actor_session_id,
|
|
820
|
-
metadata,
|
|
821
|
-
} = {}) {
|
|
822
|
-
return this._request('/api/agent-communications/threads', {
|
|
823
|
-
method: 'POST',
|
|
824
|
-
body: {
|
|
825
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
826
|
-
parent_thread_id: cleanText(parent_thread_id) || cleanText(parentThreadId),
|
|
827
|
-
thread_type: normalizeThreadType(cleanText(thread_type) || cleanText(threadType)),
|
|
828
|
-
subject: cleanText(subject),
|
|
829
|
-
objective: cleanText(objective),
|
|
830
|
-
created_by_agent_session_id: cleanText(created_by_agent_session_id) || cleanText(createdByAgentSessionId),
|
|
831
|
-
created_by_actor_session_id: cleanText(created_by_actor_session_id) || cleanText(createdByActorSessionId),
|
|
832
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
833
|
-
},
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
async getCommunicationThread(threadId) {
|
|
838
|
-
return this._request(`/api/agent-communications/threads/${encodeURIComponent(threadId)}`);
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
async listCommunicationInbox({
|
|
842
|
-
recipientAgentSessionId,
|
|
843
|
-
recipient_agent_session_id,
|
|
844
|
-
recipientRoleKey,
|
|
845
|
-
recipient_role_key,
|
|
846
|
-
workflowRunId,
|
|
847
|
-
workflow_run_id,
|
|
848
|
-
} = {}) {
|
|
849
|
-
return this._request('/api/agent-communications/inbox', {
|
|
850
|
-
query: {
|
|
851
|
-
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
852
|
-
recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
|
|
853
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
854
|
-
},
|
|
855
|
-
});
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
async getMyInbox({
|
|
859
|
-
recipientAgentSessionId,
|
|
860
|
-
recipient_agent_session_id,
|
|
861
|
-
recipientRoleKey,
|
|
862
|
-
recipient_role_key,
|
|
863
|
-
workflowRunId,
|
|
864
|
-
workflow_run_id,
|
|
865
|
-
} = {}) {
|
|
866
|
-
return this._request('/api/agent-communications/inbox/me', {
|
|
867
|
-
query: {
|
|
868
|
-
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
869
|
-
recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
|
|
870
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
871
|
-
},
|
|
872
|
-
});
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
async verifyMessageSent({ messageId, message_id } = {}) {
|
|
876
|
-
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
877
|
-
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
878
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-sent`, {
|
|
879
|
-
method: 'POST',
|
|
880
|
-
body: { message_id: normalizedMessageId },
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
async verifyMessageReceived({
|
|
885
|
-
messageId,
|
|
886
|
-
message_id,
|
|
887
|
-
recipientAgentSessionId,
|
|
888
|
-
recipient_agent_session_id,
|
|
889
|
-
recipientRole,
|
|
890
|
-
recipient_role,
|
|
891
|
-
role,
|
|
892
|
-
participantId,
|
|
893
|
-
participant_id,
|
|
894
|
-
} = {}) {
|
|
895
|
-
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
896
|
-
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
897
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-received`, {
|
|
898
|
-
method: 'POST',
|
|
899
|
-
body: {
|
|
900
|
-
message_id: normalizedMessageId,
|
|
901
|
-
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
902
|
-
recipient_role: cleanText(recipient_role) || cleanText(recipientRole) || cleanText(role),
|
|
903
|
-
participant_id: cleanText(participant_id) || cleanText(participantId),
|
|
904
|
-
},
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
async getMessageDeliveryReceipt({ messageId, message_id } = {}) {
|
|
909
|
-
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
910
|
-
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
911
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/delivery-receipt`, {
|
|
912
|
-
method: 'GET',
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
async _sendAgentCommsMessage(request = {}) {
|
|
917
|
-
const hasThreadContext = Boolean(
|
|
918
|
-
cleanText(request.communication_thread_id)
|
|
919
|
-
|| cleanText(request.communicationThreadId)
|
|
920
|
-
|| cleanText(request.thread_id)
|
|
921
|
-
|| cleanText(request.threadId)
|
|
922
|
-
|| cleanText(request.recipient_role_key)
|
|
923
|
-
|| cleanText(request.recipientRoleKey)
|
|
924
|
-
);
|
|
925
|
-
const hasTransferChannelContext = Boolean(
|
|
926
|
-
cleanText(request.transfer_channel_id)
|
|
927
|
-
|| cleanText(request.transferChannelId)
|
|
928
|
-
|| cleanText(request.channel_id)
|
|
929
|
-
|| cleanText(request.channelId)
|
|
930
|
-
|| cleanText(request.sender_role)
|
|
931
|
-
|| cleanText(request.senderRole)
|
|
932
|
-
|| cleanText(request.recipient_role)
|
|
933
|
-
|| cleanText(request.recipientRole)
|
|
934
|
-
|| cleanText(request.role)
|
|
935
|
-
|| cleanText(request.participant_role)
|
|
936
|
-
|| cleanText(request.participantRole)
|
|
937
|
-
|| cleanText(request.participant_id)
|
|
938
|
-
|| cleanText(request.participantId)
|
|
939
|
-
|| cleanText(request.recipient_participant_id)
|
|
940
|
-
|| cleanText(request.recipientParticipantId)
|
|
941
|
-
);
|
|
942
|
-
if (hasTransferChannelContext && !hasThreadContext) {
|
|
943
|
-
if (
|
|
944
|
-
cleanText(request.participant_id)
|
|
945
|
-
|| cleanText(request.participantId)
|
|
946
|
-
|| cleanText(request.recipient_participant_id)
|
|
947
|
-
|| cleanText(request.recipientParticipantId)
|
|
948
|
-
|| cleanText(request.recipient_agent_session_id)
|
|
949
|
-
|| cleanText(request.recipientAgentSessionId)
|
|
950
|
-
) {
|
|
951
|
-
return this.sendToParticipant(request);
|
|
952
|
-
}
|
|
953
|
-
return this.sendToRole(request);
|
|
954
|
-
}
|
|
955
|
-
return this.sendCommunicationMessage(request);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
async sendCommunicationMessage({
|
|
959
|
-
communicationThreadId,
|
|
960
|
-
communication_thread_id,
|
|
961
|
-
threadId,
|
|
962
|
-
communicationBundleId,
|
|
963
|
-
communication_bundle_id,
|
|
964
|
-
senderAgentSessionId,
|
|
965
|
-
sender_agent_session_id,
|
|
966
|
-
recipientAgentSessionId,
|
|
967
|
-
recipient_agent_session_id,
|
|
968
|
-
recipientRoleKey,
|
|
969
|
-
recipient_role_key,
|
|
970
|
-
messageKind,
|
|
971
|
-
message_kind,
|
|
972
|
-
bodyMarkdown,
|
|
973
|
-
body_markdown,
|
|
974
|
-
messageStatus,
|
|
975
|
-
message_status,
|
|
976
|
-
payload = {},
|
|
977
|
-
scope = {},
|
|
978
|
-
requiredResponseSchema = {},
|
|
979
|
-
required_response_schema = {},
|
|
980
|
-
metadata = {},
|
|
981
|
-
} = {}) {
|
|
982
|
-
return this._request('/api/agent-communications/messages', {
|
|
983
|
-
method: 'POST',
|
|
984
|
-
body: {
|
|
985
|
-
communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId) || cleanText(threadId),
|
|
986
|
-
communication_bundle_id: cleanText(communication_bundle_id) || cleanText(communicationBundleId),
|
|
987
|
-
sender_agent_session_id: cleanText(sender_agent_session_id) || cleanText(senderAgentSessionId) || this.agentSessionId,
|
|
988
|
-
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
989
|
-
recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
|
|
990
|
-
message_kind: normalizeMessageKind(cleanText(message_kind) || cleanText(messageKind)),
|
|
991
|
-
message_status: cleanText(message_status) || cleanText(messageStatus) || 'sent',
|
|
992
|
-
body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
|
|
993
|
-
payload: isPlainObject(payload) ? payload : {},
|
|
994
|
-
scope: isPlainObject(scope) ? scope : {},
|
|
995
|
-
required_response_schema: isPlainObject(requiredResponseSchema)
|
|
996
|
-
? requiredResponseSchema
|
|
997
|
-
: (isPlainObject(required_response_schema) ? required_response_schema : {}),
|
|
998
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
999
|
-
},
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
async acceptCommunicationTransferPacket({
|
|
1004
|
-
workTransferPacketId,
|
|
1005
|
-
work_transfer_packet_id,
|
|
1006
|
-
acceptedByAgentSessionId,
|
|
1007
|
-
accepted_by_agent_session_id,
|
|
1008
|
-
acceptedByActorSessionId,
|
|
1009
|
-
accepted_by_actor_session_id,
|
|
1010
|
-
acceptedByClaimId,
|
|
1011
|
-
accepted_by_claim_id,
|
|
1012
|
-
advanceToInProgress,
|
|
1013
|
-
advance_to_in_progress,
|
|
1014
|
-
metadata = {},
|
|
1015
|
-
} = {}) {
|
|
1016
|
-
const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
|
|
1017
|
-
if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
|
|
1018
|
-
return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/accept`, {
|
|
1019
|
-
method: 'POST',
|
|
1020
|
-
body: {
|
|
1021
|
-
accepted_by_agent_session_id: cleanText(accepted_by_agent_session_id) || cleanText(acceptedByAgentSessionId),
|
|
1022
|
-
accepted_by_actor_session_id: cleanText(accepted_by_actor_session_id) || cleanText(acceptedByActorSessionId),
|
|
1023
|
-
accepted_by_claim_id: cleanText(accepted_by_claim_id) || cleanText(acceptedByClaimId),
|
|
1024
|
-
advance_to_in_progress: Boolean(advance_to_in_progress ?? advanceToInProgress),
|
|
1025
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
1026
|
-
},
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
async closeCommunicationTransferPacket({
|
|
1031
|
-
workTransferPacketId,
|
|
1032
|
-
work_transfer_packet_id,
|
|
1033
|
-
closureStatus,
|
|
1034
|
-
closure_status,
|
|
1035
|
-
closureReason,
|
|
1036
|
-
closure_reason,
|
|
1037
|
-
failureReason,
|
|
1038
|
-
failure_reason,
|
|
1039
|
-
closedByAgentSessionId,
|
|
1040
|
-
closed_by_agent_session_id,
|
|
1041
|
-
closedByActorSessionId,
|
|
1042
|
-
closed_by_actor_session_id,
|
|
1043
|
-
closedByClaimId,
|
|
1044
|
-
closed_by_claim_id,
|
|
1045
|
-
evidence = {},
|
|
1046
|
-
evidenceManifestSha256,
|
|
1047
|
-
evidence_manifest_sha256,
|
|
1048
|
-
metadata = {},
|
|
1049
|
-
} = {}) {
|
|
1050
|
-
const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
|
|
1051
|
-
if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
|
|
1052
|
-
return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/close`, {
|
|
1053
|
-
method: 'POST',
|
|
1054
|
-
body: {
|
|
1055
|
-
closure_status: normalizeTransferLifecycleStatus(cleanText(closure_status) || cleanText(closureStatus) || 'closed'),
|
|
1056
|
-
closure_reason: cleanText(closure_reason) || cleanText(closureReason),
|
|
1057
|
-
failure_reason: cleanText(failure_reason) || cleanText(failureReason),
|
|
1058
|
-
closed_by_agent_session_id: cleanText(closed_by_agent_session_id) || cleanText(closedByAgentSessionId),
|
|
1059
|
-
closed_by_actor_session_id: cleanText(closed_by_actor_session_id) || cleanText(closedByActorSessionId),
|
|
1060
|
-
closed_by_claim_id: cleanText(closed_by_claim_id) || cleanText(closedByClaimId),
|
|
1061
|
-
evidence: isPlainObject(evidence) ? evidence : {},
|
|
1062
|
-
evidence_manifest_sha256: cleanText(evidence_manifest_sha256) || cleanText(evidenceManifestSha256),
|
|
1063
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
1064
|
-
},
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
async getCommunicationTransferHealth({
|
|
1069
|
-
workflowRunId,
|
|
1070
|
-
workflow_run_id,
|
|
1071
|
-
workTransferPacketId,
|
|
1072
|
-
work_transfer_packet_id,
|
|
1073
|
-
} = {}) {
|
|
1074
|
-
return this._request('/api/agent-communications/transfers/health', {
|
|
1075
|
-
query: {
|
|
1076
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
1077
|
-
work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
|
|
1078
|
-
},
|
|
1079
|
-
});
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
|
-
async acceptCommunicationMessage(messageId) {
|
|
1083
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(messageId)}/accept`, {
|
|
1084
|
-
method: 'POST',
|
|
1085
|
-
body: {},
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
async respondToCommunicationMessage({
|
|
1090
|
-
agentMessageId,
|
|
1091
|
-
agent_message_id,
|
|
1092
|
-
messageId,
|
|
1093
|
-
status,
|
|
1094
|
-
bodyMarkdown,
|
|
1095
|
-
body_markdown,
|
|
1096
|
-
payload = {},
|
|
1097
|
-
metadata = {},
|
|
1098
|
-
evidenceRefs,
|
|
1099
|
-
evidence_refs,
|
|
1100
|
-
} = {}) {
|
|
1101
|
-
const normalizedMessageId = cleanText(agent_message_id) || cleanText(agentMessageId) || cleanText(messageId);
|
|
1102
|
-
if (!normalizedMessageId) {
|
|
1103
|
-
throw new Error('agent_message_id is required.');
|
|
1104
|
-
}
|
|
1105
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/respond-with-evidence`, {
|
|
1106
|
-
method: 'POST',
|
|
1107
|
-
body: {
|
|
1108
|
-
status: cleanText(status) || 'answered',
|
|
1109
|
-
body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
|
|
1110
|
-
payload: isPlainObject(payload) ? payload : {},
|
|
1111
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
1112
|
-
evidence_refs: Array.isArray(evidence_refs) ? evidence_refs : (Array.isArray(evidenceRefs) ? evidenceRefs : []),
|
|
1113
|
-
},
|
|
1114
|
-
});
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
async attachCommunicationMessageEvidence({
|
|
1118
|
-
agentMessageId,
|
|
1119
|
-
agent_message_id,
|
|
1120
|
-
messageId,
|
|
1121
|
-
evidenceType,
|
|
1122
|
-
evidence_type,
|
|
1123
|
-
evidenceRef,
|
|
1124
|
-
evidence_ref,
|
|
1125
|
-
sourceTruth,
|
|
1126
|
-
source_truth,
|
|
1127
|
-
trustLevel,
|
|
1128
|
-
trust_level,
|
|
1129
|
-
metadata = {},
|
|
1130
|
-
} = {}) {
|
|
1131
|
-
const normalizedMessageId = cleanText(agent_message_id) || cleanText(agentMessageId) || cleanText(messageId);
|
|
1132
|
-
if (!normalizedMessageId) {
|
|
1133
|
-
throw new Error('agent_message_id is required.');
|
|
1134
|
-
}
|
|
1135
|
-
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/evidence-links`, {
|
|
1136
|
-
method: 'POST',
|
|
1137
|
-
body: {
|
|
1138
|
-
evidence_type: cleanText(evidence_type) || cleanText(evidenceType),
|
|
1139
|
-
evidence_ref: cleanText(evidence_ref) || cleanText(evidenceRef),
|
|
1140
|
-
source_truth: cleanText(source_truth) || cleanText(sourceTruth),
|
|
1141
|
-
trust_level: cleanText(trust_level) || cleanText(trustLevel) || 'candidate',
|
|
1142
|
-
metadata: isPlainObject(metadata) ? metadata : {},
|
|
1143
|
-
},
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
async createCommunicationHandoff({
|
|
1148
|
-
workflowRunId,
|
|
1149
|
-
workflow_run_id,
|
|
1150
|
-
title,
|
|
1151
|
-
agentSessionId,
|
|
1152
|
-
agent_session_id,
|
|
1153
|
-
handoffKind,
|
|
1154
|
-
handoff_kind,
|
|
1155
|
-
handoffPriority,
|
|
1156
|
-
handoff_priority,
|
|
1157
|
-
summaryText,
|
|
1158
|
-
summary_text,
|
|
1159
|
-
handoffPayload = {},
|
|
1160
|
-
handoff_payload = {},
|
|
1161
|
-
createdBy,
|
|
1162
|
-
created_by,
|
|
1163
|
-
supersedesHandoffId,
|
|
1164
|
-
supersedes_handoff_id,
|
|
1165
|
-
} = {}) {
|
|
1166
|
-
return this._request('/api/agent-communications/handoffs', {
|
|
1167
|
-
method: 'POST',
|
|
1168
|
-
body: {
|
|
1169
|
-
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
1170
|
-
title: cleanText(title),
|
|
1171
|
-
agent_session_id: cleanText(agent_session_id) || cleanText(agentSessionId) || this.agentSessionId,
|
|
1172
|
-
handoff_kind: cleanText(handoff_kind) || cleanText(handoffKind) || 'general',
|
|
1173
|
-
handoff_priority: cleanText(handoff_priority) || cleanText(handoffPriority) || 'normal',
|
|
1174
|
-
summary_text: cleanText(summary_text) || cleanText(summaryText),
|
|
1175
|
-
handoff_payload: isPlainObject(handoffPayload)
|
|
1176
|
-
? handoffPayload
|
|
1177
|
-
: (isPlainObject(handoff_payload) ? handoff_payload : {}),
|
|
1178
|
-
created_by: cleanText(created_by) || cleanText(createdBy),
|
|
1179
|
-
supersedes_handoff_id: cleanText(supersedes_handoff_id) || cleanText(supersedesHandoffId),
|
|
1180
|
-
},
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
async acceptCommunicationHandoff(handoffId) {
|
|
1185
|
-
return this._request(`/api/agent-communications/handoffs/${encodeURIComponent(handoffId)}/accept`, {
|
|
1186
|
-
method: 'POST',
|
|
1187
|
-
body: {},
|
|
1188
|
-
});
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
async describeDatabaseCatalog({ includeSystemSchemas, limit } = {}) {
|
|
1192
|
-
return this.database.schema.getOverview({ includeSystemSchemas, limit });
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
async listDatabaseSchemas({ includeSystemSchemas, limit } = {}) {
|
|
1196
|
-
return this.database.schema.listSchemas({ includeSystemSchemas, limit });
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
async listDatabaseTables({ schemaName, includeSystemSchemas, limit } = {}) {
|
|
1200
|
-
return this.database.schema.listTables({ schemaName, includeSystemSchemas, limit });
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
async listDatabaseColumns({ schemaName, tableName } = {}) {
|
|
1204
|
-
return this.database.schema.listColumns({ schemaName, tableName });
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
async listDatabaseIndexes({ schemaName, tableName, includeSystemSchemas, limit } = {}) {
|
|
1208
|
-
return this.database.schema.listIndexes({ schemaName, tableName, includeSystemSchemas, limit });
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
async describeDatabaseTable({ schemaName, tableName, includeSystemSchemas } = {}) {
|
|
1212
|
-
return this.database.schema.describeTable({ schemaName, tableName, includeSystemSchemas });
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
async createDatabaseBackup({ databaseName, outputName, noWait } = {}) {
|
|
1216
|
-
return this._request('/api/operator/database/backups', {
|
|
1217
|
-
method: 'POST',
|
|
1218
|
-
body: {
|
|
1219
|
-
database_name: databaseName,
|
|
1220
|
-
output_name: outputName,
|
|
1221
|
-
no_wait: noWait,
|
|
1222
|
-
},
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
async getExternalProjectStatus(projectId) {
|
|
1227
|
-
return this._request(`/api/v1/projects/${projectId}/status`);
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
async getExternalProjectRoadmapSummary(projectId) {
|
|
1231
|
-
return this._request(`/api/v1/projects/${projectId}/implementation-roadmap/summary`);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
async getExternalProjectRoadmapActiveItem(projectId) {
|
|
1235
|
-
return this._request(`/api/v1/projects/${projectId}/implementation-roadmap/active-item`);
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
async listExternalProjectOpenTasks(projectId) {
|
|
1239
|
-
return this._request(`/api/v1/projects/${projectId}/open-tasks`);
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
async getExternalProjectStatusBundle(projectId) {
|
|
1243
|
-
return this._request(`/api/v1/projects/${projectId}/status-bundle`);
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
async createExternalAudioRender({ text, voice, model, speed, file } = {}) {
|
|
1247
|
-
if (file) {
|
|
1248
|
-
const form = new FormData();
|
|
1249
|
-
form.append('file', file);
|
|
1250
|
-
if (voice !== undefined) form.append('voice', String(voice));
|
|
1251
|
-
if (model !== undefined) form.append('model', String(model));
|
|
1252
|
-
if (speed !== undefined) form.append('speed', String(speed));
|
|
1253
|
-
return this._request('/api/v1/audio-renders', { method: 'POST', body: form });
|
|
1254
|
-
}
|
|
1255
|
-
return this._request('/api/v1/audio-renders', {
|
|
1256
|
-
method: 'POST',
|
|
1257
|
-
body: { text, voice, model, speed },
|
|
1258
|
-
});
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
async getExternalAudioRender(audioRenderRunId) {
|
|
1262
|
-
return this._request(`/api/v1/audio-renders/${audioRenderRunId}`);
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
async downloadExternalAudioRender(audioRenderRunId) {
|
|
1266
|
-
return this._requestBinary(`/api/v1/audio-renders/${audioRenderRunId}/download`);
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
async listExternalWorkflowRunArtifacts(workflowRunId) {
|
|
1270
|
-
return this._request(`/api/v1/runs/${workflowRunId}/artifacts`);
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
async downloadExternalWorkflowRunArtifact(workflowRunId, artifactType) {
|
|
1274
|
-
return this._requestBinary(`/api/v1/runs/${workflowRunId}/artifacts/${artifactType}/download`);
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
189
|
// ─── Core HTTP ─────────────────────────────────────────────────────────────
|
|
1278
190
|
|
|
1279
191
|
async _resolveAccessToken() {
|
package/src/compat/aliases.js
CHANGED
|
@@ -5,6 +5,7 @@ export const COMPATIBILITY_ALIAS_GROUPS = [
|
|
|
5
5
|
'ping',
|
|
6
6
|
'query',
|
|
7
7
|
'getPortfolioClosureReadiness',
|
|
8
|
+
'searchCodeByIntent',
|
|
8
9
|
'registerModernizationAsset',
|
|
9
10
|
'classifyModernizationAsset',
|
|
10
11
|
'discoverSalvageCandidates',
|
|
@@ -41,6 +42,9 @@ export const COMPATIBILITY_ALIAS_GROUPS = [
|
|
|
41
42
|
{
|
|
42
43
|
namespace: 'agentCommunications',
|
|
43
44
|
aliases: [
|
|
45
|
+
'startAgentConnection',
|
|
46
|
+
'establishAgentCommunicationChannel',
|
|
47
|
+
'runInterAgentMessagingLoop',
|
|
44
48
|
'bootstrapCommunication',
|
|
45
49
|
'negotiateCommunicationTransfer',
|
|
46
50
|
'resolveCommunicationTarget',
|
|
@@ -184,7 +188,7 @@ export function installClientCompatibilityDelegates(ClientClass) {
|
|
|
184
188
|
defineCompatibilityMethods(proto, 'presence', ['getPresenceBoard', 'getChannelPresence', 'markParticipantOnline', 'markParticipantOffline', 'whoIsOnline', 'findOnlineParticipant', 'sendToParticipant', 'sendToRole', 'postPresenceHeartbeat']);
|
|
185
189
|
defineCompatibilityMethods(proto, 'collaborationDomain', ['reviewCollaborationProposal', 'reviseCollaborationProposal', 'postCollaborationProposal', 'acceptCollaborationProposal', 'assignCollaborationOwnership', 'raiseCollaborationBlocker', 'resolveCollaborationBlocker', 'postCollaborationHeartbeat', 'beginCollaborationImplementation', 'requestCollaborationClosure']);
|
|
186
190
|
defineCompatibilityMethods(proto, 'transferBundles', ['transferWorkPacket', 'getTransferBundle', 'listTransferBundles', 'createTransferReceipt', 'listTransferReceipts', 'createCommunicationBundle', 'getCommunicationBundle', 'listCommunicationBundles', 'addCommunicationBundleItem', 'uploadCommunicationBundle', 'attachCommunicationBundleToMessage', 'recordCommunicationBundleReceipt', 'recordCommunicationBundleCleanupEvent', 'claimCommunicationBundle', 'recordCommunicationTransferReceipt']);
|
|
187
|
-
defineCompatibilityMethods(proto, 'workflowComposition', ['registerModernizationAsset', 'classifyModernizationAsset', 'discoverSalvageCandidates', 'createModernizationWorkPacket', 'requestModernizationWrapperExecution', 'getModernizationWrapperEvidence', 'decideModernizationGate']);
|
|
191
|
+
defineCompatibilityMethods(proto, 'workflowComposition', ['registerModernizationAsset', 'classifyModernizationAsset', 'discoverSalvageCandidates', 'createModernizationWorkPacket', 'requestModernizationWrapperExecution', 'getModernizationWrapperEvidence', 'decideModernizationGate', 'searchCodeByIntent']);
|
|
188
192
|
defineCompatibilityMethods(proto, 'currentProject', ['currentProjectStatus']);
|
|
189
193
|
defineCompatibilityMethods(proto, 'projections', ['renderProjection', 'getLogaOperatorHomeProjection', 'getLogaProjectCatalogProjection', 'getLogaProjectPortfolioProjection', 'getLogaProjectRoadmapProjection', 'getLogaRoadmapItemProjection', 'getLogaWorkflowRunProjection', 'getLogaEvidencePacketProjection', 'getLogaTransferHomeProjection', 'getLogaTransferInboxProjection', 'getLogaTransferPacketProjection', 'getLogaTransferNegotiationEventsProjection', 'getLogaTransferFrictionLaneProjection', 'getLogaTransferReceiptsProjection', 'getLogaTransferClosureReviewProjection', 'getTransferChannelProjection']);
|
|
190
194
|
defineCompatibilityAliases(proto, 'projections', { getLogaTransferChannelThreadProjection: 'getTransferChannelProjection' });
|
|
@@ -209,7 +213,7 @@ export function installClientCompatibilityDelegates(ClientClass) {
|
|
|
209
213
|
defineCompatibilityMethods(proto, 'contextSessions', ['openContextSession', 'getOrientationWindow', 'acknowledgeReminder', 'completeOrientation', 'lockContextSessionClaim', 'getContextSessionGateStatus']);
|
|
210
214
|
defineCompatibilityMethods(proto, 'contextOrientation', ['conductOrientation']);
|
|
211
215
|
defineCompatibilityMethods(proto, 'portfolio', ['getPortfolioStatus', 'getPortfolioBundle', 'getPortfolioClosureReadiness']);
|
|
212
|
-
defineCompatibilityMethods(proto, 'agentCommunications', ['bootstrapCommunication', 'negotiateCommunicationTransfer', 'resolveCommunicationTarget', 'createCommunicationEvidencePacket', 'listCommunicationFrictionTaxonomy', 'recordCommunicationFrictionEvent', 'openCommunicationThread', 'getCommunicationThread', 'listCommunicationInbox', 'getMyInbox', 'verifyMessageSent', 'verifyMessageReceived', 'getMessageDeliveryReceipt', '_sendAgentCommsMessage', 'sendCommunicationMessage', 'acceptCommunicationTransferPacket', 'closeCommunicationTransferPacket', 'getCommunicationTransferHealth', 'acceptCommunicationMessage', 'respondToCommunicationMessage', 'attachCommunicationMessageEvidence', 'createCommunicationHandoff', 'acceptCommunicationHandoff']);
|
|
216
|
+
defineCompatibilityMethods(proto, 'agentCommunications', ['startAgentConnection', 'establishAgentCommunicationChannel', 'runInterAgentMessagingLoop', 'bootstrapCommunication', 'negotiateCommunicationTransfer', 'resolveCommunicationTarget', 'createCommunicationEvidencePacket', 'listCommunicationFrictionTaxonomy', 'recordCommunicationFrictionEvent', 'openCommunicationThread', 'getCommunicationThread', 'listCommunicationInbox', 'getMyInbox', 'verifyMessageSent', 'verifyMessageReceived', 'getMessageDeliveryReceipt', '_sendAgentCommsMessage', 'sendCommunicationMessage', 'acceptCommunicationTransferPacket', 'closeCommunicationTransferPacket', 'getCommunicationTransferHealth', 'acceptCommunicationMessage', 'respondToCommunicationMessage', 'attachCommunicationMessageEvidence', 'createCommunicationHandoff', 'acceptCommunicationHandoff']);
|
|
213
217
|
defineCompatibilityMethods(proto, 'communicationTickets', ['createCrossAgentRemediationTicket']);
|
|
214
218
|
defineCompatibilityMethods(proto, 'refactoringTransfers', ['transferRefactoringBundle']);
|
|
215
219
|
defineCompatibilityMethods(proto, 'externalProjects', ['getExternalProjectStatus', 'getExternalProjectRoadmapSummary', 'getExternalProjectRoadmapActiveItem', 'listExternalProjectOpenTasks', 'getExternalProjectStatusBundle']);
|
package/src/domains/ping-pong.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { AI_ENGINE_CLIENT_VERSION } from '../constants/client.js';
|
|
2
2
|
import { cleanText, isPlainObject } from '../utils/communication.js';
|
|
3
|
-
|
|
4
|
-
function compareSemanticVersions(left, right) {
|
|
5
|
-
const leftParts = String(left || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
6
|
-
const rightParts = String(right || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
7
|
-
const width = Math.max(leftParts.length, rightParts.length);
|
|
8
|
-
for (let index = 0; index < width; index += 1) {
|
|
9
|
-
const a = leftParts[index] || 0;
|
|
10
|
-
const b = rightParts[index] || 0;
|
|
11
|
-
if (a > b) return 1;
|
|
12
|
-
if (a < b) return -1;
|
|
13
|
-
}
|
|
14
|
-
return 0;
|
|
15
|
-
}
|
|
3
|
+
import { compareSemanticVersions } from '../utils/version.js';
|
|
16
4
|
|
|
17
5
|
function buildEligibilityError(message, details = {}) {
|
|
18
6
|
const error = new Error(message);
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AIEngineClient, createAIEngineClient } from './client.js';
|
|
2
|
-
export const AI_ENGINE_CLIENT_VERSION = '1.1.
|
|
2
|
+
export const AI_ENGINE_CLIENT_VERSION = '1.1.102';
|
|
3
3
|
export { GOVERNED_MUTATION_REQUIRED_CAPABILITIES, AI_ENGINE_CLIENT_CAPABILITIES, TASK_BOUND_SUBSTRATE_EXECUTION_POLICY } from './constants/governance.js';
|
|
4
4
|
export { LOGA_CONTRACT, LOGA_INTERACTION_CONTRACT, LOGA_NAVIGATION_CONTRACT, LOGA_PROJECTION_WORKFLOW } from './constants/loga.js';
|
|
5
5
|
export {
|
package/src/transport/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { appendQuery,
|
|
1
|
+
import { appendQuery, isJsonBody, parseContentDispositionFilename, readJson } from '../utils/request.js';
|
|
2
|
+
import { extractLogaProjectionMetadata } from '../utils/loga.js';
|
|
2
3
|
|
|
3
4
|
export async function resolveAccessToken(client) {
|
|
4
5
|
if (typeof client.tokenProvider === 'function') {
|
|
@@ -16,7 +16,7 @@ function normalizeEnum(value, allowedValues, fallback, label, aliases = {}) {
|
|
|
16
16
|
const lower = normalized.toLowerCase();
|
|
17
17
|
const match = allowedValues.find((item) => item.toLowerCase() === lower);
|
|
18
18
|
if (match) return match;
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error(`${label || 'value'} must be one of ${allowedValues.join(', ')}.`);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function cleanText(value) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { extractLogaProjectionMetadata } from './http.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function compareSemanticVersions(left, right) {
|
|
2
|
+
const leftParts = String(left || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
3
|
+
const rightParts = String(right || '').split('.').map((part) => Number.parseInt(part, 10) || 0);
|
|
4
|
+
const width = Math.max(leftParts.length, rightParts.length);
|
|
5
|
+
for (let index = 0; index < width; index += 1) {
|
|
6
|
+
const a = leftParts[index] || 0;
|
|
7
|
+
const b = rightParts[index] || 0;
|
|
8
|
+
if (a > b) return 1;
|
|
9
|
+
if (a < b) return -1;
|
|
10
|
+
}
|
|
11
|
+
return 0;
|
|
12
|
+
}
|