@evomap/evolver-adapter-public 2.0.44 → 2.0.47

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.
@@ -28,7 +28,10 @@ export class LegacyAuthShim {
28
28
  this.onRotate = onRotate;
29
29
  this.onVersionUpdate = onVersionUpdate;
30
30
  this.onDiverged = onDiverged;
31
- if (!nodeSecret || !isNodeSecret(nodeSecret))
31
+ // An absent secret is the enrollment state, not an error: a node with no credential yet, and one whose
32
+ // secret notifyNodeSecretDiverged just dropped, both hello unauthenticated so the hub can mint one.
33
+ // Rejecting it here would fence off the re-acquisition this class is written to perform.
34
+ if (nodeSecret !== undefined && !isNodeSecret(nodeSecret))
32
35
  throw new Error('node_secret 必须是 64-hex');
33
36
  this.nodeSecretVersion = parseNodeSecretVersion(initialNodeSecretVersion);
34
37
  }
package/dist/connect.js CHANGED
@@ -14,8 +14,6 @@ export function connectPublicHub(opts) {
14
14
  let auth;
15
15
  switch (opts.authMode) {
16
16
  case 'legacy':
17
- if (!opts.nodeSecret)
18
- throw new Error('legacy 模式需 nodeSecret');
19
17
  auth = new LegacyAuthShim(opts.nodeSecret, opts.onNodeSecretRotated, opts.nodeSecretVersion, opts.onNodeSecretVersionUpdated, opts.onNodeSecretDiverged);
20
18
  break;
21
19
  case 'keypair':
@@ -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;
@@ -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.44",
3
+ "version": "2.0.47",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "@evomap/atp-sdk": "^0.1.0",
20
- "@evomap/evolver-core": "2.0.44",
21
- "undici": "^6.28.1"
20
+ "@evomap/evolver-core": "2.0.47",
21
+ "undici": "^6.29.1"
22
22
  },
23
23
  "optionalDependencies": {
24
24
  "@napi-rs/keyring": "^1.1.6"