@evomap/evolver-adapter-public 2.0.46 → 2.0.48

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.
@@ -155,6 +155,7 @@ export declare class PublicHubCapability implements hub.HubCapability {
155
155
  private lastMalformedPublish2xxAt;
156
156
  private lastMalformedPublish2xxStatus;
157
157
  readonly auth: hub.AuthProvider;
158
+ readonly triggerFeedback: hub.TriggerFeedbackCapability;
158
159
  readonly recipes: hub.RecipeCapability;
159
160
  constructor(opts: PublicHubOptions);
160
161
  private evolverVersionForWire;
@@ -7,6 +7,7 @@ import { antiAbuseTelemetryMode, buildHeartbeatAntiAbuseTelemetry, } from './ant
7
7
  import { getWorkspaceKeychainMode } from './auth/workspaceKeychain.js';
8
8
  import { agentDirectoryFailure, parsePublicAgentPage, parsePublicAgentProfile, paginatePublicAgentPage, mergePublicAgentPages, publicAgentSearchQuery, publicTaskDiscoveryQuery, PUBLIC_TASK_DISCOVERY_MAX_CANDIDATES, unsupportedPublicAvailability, unsupportedPublicSort, withDirectoryTimeout, } from './agentDirectory.js';
9
9
  import { createRecipeExecution } from './recipeExecution.js';
10
+ import { createTriggerFeedbackCapability } from './triggerFeedback.js';
10
11
  import { assetMatchesId, stripHubDeliveryMetadataForIntegrity } from './hubReuse.js';
11
12
  import { OAuthAuthenticationPreflightError, OAuthCredentialBindingError } from './auth/oauthDeviceToken.js';
12
13
  export const INBOUND_LIMIT = 100;
@@ -104,6 +105,7 @@ export class PublicHubCapability {
104
105
  lastMalformedPublish2xxAt;
105
106
  lastMalformedPublish2xxStatus;
106
107
  auth;
108
+ triggerFeedback;
107
109
  recipes = {
108
110
  create: async (request) => this.createRecipe(request),
109
111
  publish: async (recipeId, options) => this.publishRecipe(recipeId, options),
@@ -117,6 +119,13 @@ export class PublicHubCapability {
117
119
  this.auth = opts.auth;
118
120
  this.http = new HubFetch({ baseUrl: opts.baseUrl, auth: opts.auth, fetchFn: opts.fetchFn, senderId: opts.senderId });
119
121
  this.recipes.execution = createRecipeExecution(opts);
122
+ this.triggerFeedback = createTriggerFeedbackCapability(async (method, path, body) => {
123
+ if (!this.opts.senderId()?.trim())
124
+ throw new Error('trigger_feedback_node_unbound');
125
+ if (!reference.isExecutionEligible(body, this.referenceScope))
126
+ throw new Error('reference_not_execution_evidence');
127
+ return this.http.call(method, path, body);
128
+ });
120
129
  }
121
130
  evolverVersionForWire(explicitVersion) {
122
131
  const antiAbuse = this.opts.antiAbuse;
@@ -578,6 +587,10 @@ export class PublicHubCapability {
578
587
  const body = await this.http.call('POST', `/a2a/assets/${encodeURIComponent(assetId)}/reuse-result`, {
579
588
  asset_id: assetId,
580
589
  outcome: report.outcome,
590
+ // The Hub reads the idempotency key from the BODY only (never from a request header).
591
+ // A caller-supplied key makes a network retry record once; without it the Hub keeps
592
+ // its legacy per-report semantics.
593
+ ...(report.idempotencyKey ? { idempotency_key: report.idempotencyKey } : {}),
581
594
  ...(report.taskId ? { task_id: report.taskId } : {}),
582
595
  ...(report.traceId ? { trace_id: report.traceId } : {}),
583
596
  ...(timeSavedSeconds.value !== undefined ? { time_saved_seconds: timeSavedSeconds.value } : {}),
@@ -743,7 +756,9 @@ export class PublicHubCapability {
743
756
  if (isHubDryRunEnabled()) {
744
757
  return dryRunRecipeSearchReceipt('search_recipe', request);
745
758
  }
746
- const body = await this.http.call('GET', '/a2a/recipe/search', undefined, recipeSearchQuery(request));
759
+ const body = request.context
760
+ ? await this.http.call('POST', '/a2a/recipe/search', { ...recipeSearchQuery(request), context: request.context })
761
+ : await this.http.call('GET', '/a2a/recipe/search', undefined, recipeSearchQuery(request));
747
762
  return recipeSearchReceiptFromBody(body);
748
763
  }
749
764
  async listRecipes(request = {}) {
@@ -1054,13 +1069,21 @@ function recipeSearchReceiptFromBody(body) {
1054
1069
  ?? booleanField(payload, 'hasMore')
1055
1070
  ?? booleanField(body, 'has_more')
1056
1071
  ?? booleanField(body, 'hasMore');
1072
+ const contextFit = contextFitOf(body['context_fit']);
1057
1073
  return {
1058
1074
  recipes,
1059
1075
  ...(nextCursor ? { nextCursor } : {}),
1060
1076
  ...(hasMore !== undefined ? { hasMore } : {}),
1077
+ ...(contextFit ? { contextFit } : {}),
1061
1078
  raw: body,
1062
1079
  };
1063
1080
  }
1081
+ function contextFitOf(value) {
1082
+ const record = asRecord(value);
1083
+ const judged = record?.['judged'];
1084
+ const kept = record?.['kept'];
1085
+ return typeof judged === 'number' && typeof kept === 'number' ? { judged, kept } : undefined;
1086
+ }
1064
1087
  function dryRunRecipeSearchReceipt(action, request) {
1065
1088
  return {
1066
1089
  recipes: [],
@@ -111,6 +111,7 @@ export declare class HubFetch {
111
111
  call<T>(method: string, path: string, bodyObj?: Record<string, unknown>, query?: Record<string, string | number | undefined>, requestHeaders?: Readonly<Record<string, string>>): Promise<T>;
112
112
  }
113
113
  export declare function resolveHubOperationTimeouts(env?: Record<string, string | undefined>, overrides?: Partial<HubOperationTimeouts>): HubOperationTimeouts;
114
+ export declare function awaitWithAbort<T>(promise: PromiseLike<T>, signal?: AbortSignal): Promise<T>;
114
115
  export declare function hubResponseContentType(res: Pick<HubFetchResponse, 'headers'> | undefined): string;
115
116
  export declare function isHubApiResponse(res: Pick<HubFetchResponse, 'headers'> | undefined): boolean;
116
117
  export declare function hubUnreachableBackoffMs(failureCount: number): number;
package/dist/hubFetch.js CHANGED
@@ -102,6 +102,8 @@ const LEGACY_BEARER_POST_PATHS = new Set([
102
102
  '/a2a/fetch',
103
103
  '/a2a/events/poll',
104
104
  '/a2a/mailbox/outbound',
105
+ '/a2a/trigger-feedback',
106
+ '/a2a/trigger-feedback/get',
105
107
  ]);
106
108
  function requestHeaderName(headers, name) {
107
109
  const normalized = name.toLowerCase();
@@ -352,7 +354,7 @@ function abortReason(signal) {
352
354
  error.name = 'AbortError';
353
355
  return error;
354
356
  }
355
- async function awaitWithAbort(promise, signal) {
357
+ export async function awaitWithAbort(promise, signal) {
356
358
  const pending = Promise.resolve(promise);
357
359
  if (!signal)
358
360
  return await pending;
@@ -0,0 +1,3 @@
1
+ import { hub } from '@evomap/evolver-core';
2
+ export type TriggerFeedbackHttp = (method: 'POST', path: string, body: Record<string, unknown>) => Promise<unknown>;
3
+ export declare function createTriggerFeedbackCapability(call: TriggerFeedbackHttp): hub.TriggerFeedbackCapability;
@@ -0,0 +1,19 @@
1
+ import { hub } from '@evomap/evolver-core';
2
+ export function createTriggerFeedbackCapability(call) {
3
+ return {
4
+ async commit(report) {
5
+ const normalized = hub.normalizeTriggerFeedbackReport(report);
6
+ const raw = await call('POST', '/a2a/trigger-feedback', { ...normalized });
7
+ const receipt = hub.parseTriggerFeedbackReceipt(raw, normalized.run_id);
8
+ if (!hub.triggerFeedbackReceiptMatches(receipt, normalized))
9
+ throw new Error('trigger_feedback_receipt_unconfirmed');
10
+ return receipt;
11
+ },
12
+ async get(runId) {
13
+ if (!runId.trim() || Buffer.byteLength(runId) > 256)
14
+ throw new Error('trigger_feedback_invalid_identity');
15
+ const raw = await call('POST', '/a2a/trigger-feedback/get', { run_id: runId });
16
+ return hub.parseTriggerFeedbackReceipt(raw, runId);
17
+ },
18
+ };
19
+ }
package/dist/wireMap.js CHANGED
@@ -20,6 +20,8 @@ export function searchQueryToFetchWire(q) {
20
20
  out['signals'] = q.signalsAny;
21
21
  if (q.text)
22
22
  out['query'] = q.text;
23
+ if (q.text && q.context)
24
+ out['context'] = q.context;
23
25
  if (q.kind)
24
26
  out['kind'] = q.kind;
25
27
  if (q.category)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evomap/evolver-adapter-public",
3
- "version": "2.0.46",
3
+ "version": "2.0.48",
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.46",
20
+ "@evomap/evolver-core": "2.0.48",
21
21
  "undici": "^6.29.1"
22
22
  },
23
23
  "optionalDependencies": {