@evomap/evolver-adapter-public 2.0.50 → 2.0.51
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/dist/connect.d.ts +3 -1
- package/dist/connect.js +11 -0
- package/dist/hubCapability.d.ts +6 -0
- package/dist/hubCapability.js +21 -4
- package/package.json +2 -2
package/dist/connect.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type hub } from '@evomap/evolver-core';
|
|
2
2
|
import { PublicHubCapability } from './hubCapability.js';
|
|
3
3
|
import type { AntiAbuseTelemetryOptions } from './antiAbuseTelemetry.js';
|
|
4
4
|
import type { MalformedPublishReceiptEvent } from './hubCapability.js';
|
|
@@ -35,6 +35,8 @@ export interface ConnectPublicOptions {
|
|
|
35
35
|
}>;
|
|
36
36
|
/** Optional anti-abuse metadata context for heartbeat payloads. */
|
|
37
37
|
antiAbuse?: AntiAbuseTelemetryOptions;
|
|
38
|
+
/** The host agents and plugins the node served lately, reported on hello and heartbeat. */
|
|
39
|
+
clients?: () => readonly hub.SeenClient[];
|
|
38
40
|
/** Optional non-sensitive notification when publish returns malformed 2xx JSON. */
|
|
39
41
|
onMalformedPublishReceipt?: (event: MalformedPublishReceiptEvent) => void;
|
|
40
42
|
}
|
package/dist/connect.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import { hub as hubNs } from '@evomap/evolver-core';
|
|
3
4
|
import { PublicHubCapability } from './hubCapability.js';
|
|
4
5
|
import { globalFetchLike } from './hubFetch.js';
|
|
5
6
|
import { LegacyAuthShim } from './auth/legacyShim.js';
|
|
@@ -48,11 +49,21 @@ export function connectPublicHub(opts) {
|
|
|
48
49
|
fetchFn,
|
|
49
50
|
senderId: opts.senderId,
|
|
50
51
|
antiAbuse: withWorkspaceIdResolver(opts.antiAbuse),
|
|
52
|
+
...clientsOf(opts),
|
|
51
53
|
...(opts.onMalformedPublishReceipt ? { onMalformedPublishReceipt: opts.onMalformedPublishReceipt } : {}),
|
|
52
54
|
}),
|
|
53
55
|
auth,
|
|
54
56
|
};
|
|
55
57
|
}
|
|
58
|
+
// A Proxy passes the clients it serves; a one-shot CLI process serves the one client that started it, named in its env.
|
|
59
|
+
function clientsOf(opts) {
|
|
60
|
+
if (opts.clients)
|
|
61
|
+
return { clients: opts.clients };
|
|
62
|
+
const processClient = hubNs.clientIdentityFromEnv(opts.antiAbuse?.env ?? process.env);
|
|
63
|
+
if (!processClient)
|
|
64
|
+
return {};
|
|
65
|
+
return { clients: () => [{ ...processClient, last_seen: new Date().toISOString() }], processClient };
|
|
66
|
+
}
|
|
56
67
|
function withWorkspaceIdResolver(antiAbuse) {
|
|
57
68
|
if (antiAbuse?.workspaceId || antiAbuse?.workspaceIdResolver)
|
|
58
69
|
return antiAbuse;
|
package/dist/hubCapability.d.ts
CHANGED
|
@@ -80,6 +80,10 @@ export interface PublicHubOptions {
|
|
|
80
80
|
subscribePollMs?: number;
|
|
81
81
|
/** Public Hub anti-abuse heartbeat metadata. Defaults to env-controlled heartbeat mode. */
|
|
82
82
|
antiAbuse?: AntiAbuseTelemetryOptions;
|
|
83
|
+
/** The host agents and plugins this node served lately, for hello and heartbeat. */
|
|
84
|
+
clients?: () => readonly hub.SeenClient[];
|
|
85
|
+
/** The client a one-shot process acts for when no Proxy request scope names one. */
|
|
86
|
+
processClient?: hub.ClientIdentity;
|
|
83
87
|
/** Best-effort notification for malformed 2xx publish responses; receives no Hub body or credential data. */
|
|
84
88
|
onMalformedPublishReceipt?: (event: MalformedPublishReceiptEvent) => void;
|
|
85
89
|
}
|
|
@@ -159,6 +163,8 @@ export declare class PublicHubCapability implements hub.HubCapability {
|
|
|
159
163
|
readonly recipes: hub.RecipeCapability;
|
|
160
164
|
constructor(opts: PublicHubOptions);
|
|
161
165
|
private evolverVersionForWire;
|
|
166
|
+
private clientsForWire;
|
|
167
|
+
private withRequestClient;
|
|
162
168
|
private envFingerprintForWire;
|
|
163
169
|
hello(opts: PublicHelloOptions): Promise<PublicHelloResult>;
|
|
164
170
|
heartbeat(opts?: PublicHeartbeatOptions): Promise<PublicHeartbeatResult>;
|
package/dist/hubCapability.js
CHANGED
|
@@ -133,6 +133,15 @@ export class PublicHubCapability {
|
|
|
133
133
|
? explicitVersion
|
|
134
134
|
: antiAbuse?.evolverVersion ?? antiAbuse?.envFingerprint?.evolver_version);
|
|
135
135
|
}
|
|
136
|
+
// Not inside env_fingerprint: the Hub matches nodes on that object, and an agent upgrade must not look like a new node.
|
|
137
|
+
clientsForWire() {
|
|
138
|
+
const clients = this.opts.clients?.() ?? [];
|
|
139
|
+
return clients.length > 0 ? { clients } : {};
|
|
140
|
+
}
|
|
141
|
+
withRequestClient(wire) {
|
|
142
|
+
const client = hubNs.currentRequestClient() ?? this.opts.processClient;
|
|
143
|
+
return client ? { ...wire, client } : wire;
|
|
144
|
+
}
|
|
136
145
|
envFingerprintForWire(evolverVersion) {
|
|
137
146
|
const fingerprint = {
|
|
138
147
|
...(this.opts.antiAbuse?.envFingerprint
|
|
@@ -161,6 +170,7 @@ export class PublicHubCapability {
|
|
|
161
170
|
// one-shot CLI paths never send; the hub then answers heartbeats with resend_hello
|
|
162
171
|
// `missing_env_fingerprint` and 403-antibodies /a2a/fetch (#555).
|
|
163
172
|
env_fingerprint: this.envFingerprintForWire(evolverVersion),
|
|
173
|
+
...this.clientsForWire(),
|
|
164
174
|
}));
|
|
165
175
|
const payload = asRecord(body['payload']) ?? body;
|
|
166
176
|
const retryAfterMs = numberField(payload, 'retry_after_ms') ?? numberField(payload, 'retryAfterMs');
|
|
@@ -264,6 +274,9 @@ export class PublicHubCapability {
|
|
|
264
274
|
const meta = {};
|
|
265
275
|
if (nodeSecretVersion !== undefined)
|
|
266
276
|
meta['node_secret_version'] = nodeSecretVersion;
|
|
277
|
+
const { clients } = this.clientsForWire();
|
|
278
|
+
if (clients)
|
|
279
|
+
meta['clients'] = clients;
|
|
267
280
|
const antiAbuse = this.opts.antiAbuse ?? {};
|
|
268
281
|
if (antiAbuseTelemetryMode(antiAbuse.env) === 'heartbeat') {
|
|
269
282
|
try {
|
|
@@ -355,7 +368,7 @@ export class PublicHubCapability {
|
|
|
355
368
|
// #69: map camelCase SearchQuery → hub snake_case wire (signalsAny → signals) before sending.
|
|
356
369
|
// /a2a/fetch responses are FULL GEP envelopes (buildResponse('fetch', …)); the rows live at payload.results,
|
|
357
370
|
// NOT at the top level. Reading body.results here always yielded [] — every fetch silently returned nothing.
|
|
358
|
-
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', searchQueryToFetchWire(query)));
|
|
371
|
+
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', this.withRequestClient(searchQueryToFetchWire(query))));
|
|
359
372
|
return reference.withReferenceScope(this.referenceScope, () => {
|
|
360
373
|
reference.assertExecutionEligible(body);
|
|
361
374
|
return newbieFetchConfirmation(body) ?? { assets: assetsFromBody(body), confirmRequired: false };
|
|
@@ -371,7 +384,7 @@ export class PublicHubCapability {
|
|
|
371
384
|
const id = assetId.trim();
|
|
372
385
|
if (!id)
|
|
373
386
|
return { status: 'absent' };
|
|
374
|
-
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', { asset_ids: [id] }));
|
|
387
|
+
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', this.withRequestClient({ asset_ids: [id] })));
|
|
375
388
|
const matches = [];
|
|
376
389
|
for (const row of reference.withReferenceScope(this.referenceScope, () => assetCandidatesFromBody(body))) {
|
|
377
390
|
const asset = unwrapFetchDeliveryRow(row);
|
|
@@ -432,7 +445,7 @@ export class PublicHubCapability {
|
|
|
432
445
|
});
|
|
433
446
|
return reference.withReferenceScope(this.referenceScope, () => semanticSearchAssets(body));
|
|
434
447
|
}
|
|
435
|
-
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', searchQueryToSearchOnlyWire(query)));
|
|
448
|
+
const body = await this.http.call('POST', '/a2a/fetch', gepEnvelope('fetch', this.withRequestClient(searchQueryToSearchOnlyWire(query))));
|
|
436
449
|
return reference.withReferenceScope(this.referenceScope, () => signalSearchAssets(body));
|
|
437
450
|
}
|
|
438
451
|
agentDirectory = {
|
|
@@ -584,6 +597,10 @@ export class PublicHubCapability {
|
|
|
584
597
|
if ('reason' in timeSavedSeconds)
|
|
585
598
|
return { recorded: false, reason: timeSavedSeconds.reason };
|
|
586
599
|
try {
|
|
600
|
+
// Preserve host provenance locally; the public Hub rejects this local-only field.
|
|
601
|
+
const evidence = report.evidence ? { ...report.evidence } : undefined;
|
|
602
|
+
if (evidence)
|
|
603
|
+
delete evidence['source'];
|
|
587
604
|
const body = await this.http.call('POST', `/a2a/assets/${encodeURIComponent(assetId)}/reuse-result`, {
|
|
588
605
|
asset_id: assetId,
|
|
589
606
|
outcome: report.outcome,
|
|
@@ -595,7 +612,7 @@ export class PublicHubCapability {
|
|
|
595
612
|
...(report.traceId ? { trace_id: report.traceId } : {}),
|
|
596
613
|
...(timeSavedSeconds.value !== undefined ? { time_saved_seconds: timeSavedSeconds.value } : {}),
|
|
597
614
|
...(report.reason ? { reason: report.reason } : {}),
|
|
598
|
-
...(
|
|
615
|
+
...(evidence ? { evidence } : {}),
|
|
599
616
|
});
|
|
600
617
|
const payload = body['payload'] === undefined ? body : asRecord(body['payload']) ?? {};
|
|
601
618
|
const terminalDeclared = payload['terminal'] === true || body['terminal'] === true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evomap/evolver-adapter-public",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.51",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@evomap/atp-sdk": "^0.1.0",
|
|
20
|
-
"@evomap/evolver-core": "2.0.
|
|
20
|
+
"@evomap/evolver-core": "2.0.51",
|
|
21
21
|
"undici": "^6.29.1"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|