@evomap/evolver-adapter-public 2.0.0-beta.0
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/antiAbuseTelemetry.d.ts +36 -0
- package/dist/antiAbuseTelemetry.js +267 -0
- package/dist/atp.d.ts +54 -0
- package/dist/atp.js +140 -0
- package/dist/auth/credentialStore.d.ts +8 -0
- package/dist/auth/credentialStore.js +23 -0
- package/dist/auth/keypair.d.ts +42 -0
- package/dist/auth/keypair.js +80 -0
- package/dist/auth/legacyShim.d.ts +43 -0
- package/dist/auth/legacyShim.js +82 -0
- package/dist/auth/machineId.d.ts +20 -0
- package/dist/auth/machineId.js +38 -0
- package/dist/auth/oauthDeviceToken.d.ts +62 -0
- package/dist/auth/oauthDeviceToken.js +83 -0
- package/dist/auth/oauthHttpTransport.d.ts +33 -0
- package/dist/auth/oauthHttpTransport.js +93 -0
- package/dist/connect.d.ts +40 -0
- package/dist/connect.js +38 -0
- package/dist/hubCapability.d.ts +169 -0
- package/dist/hubCapability.js +899 -0
- package/dist/hubFetch.d.ts +116 -0
- package/dist/hubFetch.js +469 -0
- package/dist/hubReuse.d.ts +112 -0
- package/dist/hubReuse.js +292 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +16 -0
- package/dist/offlinePermit.d.ts +74 -0
- package/dist/offlinePermit.js +309 -0
- package/dist/pricing/modelPrices.d.ts +16 -0
- package/dist/pricing/modelPrices.js +44 -0
- package/dist/wireMap.d.ts +28 -0
- package/dist/wireMap.js +99 -0
- package/package.json +29 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { type hub } from '@evomap/evolver-core';
|
|
2
|
+
import { type FetchLike } from './hubFetch.js';
|
|
3
|
+
import { type AntiAbuseTelemetryOptions } from './antiAbuseTelemetry.js';
|
|
4
|
+
export declare const INBOUND_LIMIT = 100;
|
|
5
|
+
export declare const OUTBOUND_MAX_BATCH = 50;
|
|
6
|
+
export declare const OUTBOUND_MAX_BODY_BYTES: number;
|
|
7
|
+
export declare const PUBLIC_PROTOCOL_VERSION = "gep-a2a/1.0.0";
|
|
8
|
+
export declare const PUBLIC_HUB_CAPABILITIES: hub.HubCapabilityName[];
|
|
9
|
+
export declare const USED_ASSET_IDS_MAX = 50;
|
|
10
|
+
export declare const USED_ASSET_ID_MAX_LEN = 200;
|
|
11
|
+
/**
|
|
12
|
+
* An outcome the agent reports back to the hub's memory graph after a cycle.
|
|
13
|
+
* `usedAssetIds` is the fetch->outcome attribution claim: which hub assets the
|
|
14
|
+
* agent actually APPLIED while producing this outcome. The hub treats the list
|
|
15
|
+
* as a claim, never a fact — each id is cross-verified server-side against its
|
|
16
|
+
* own fetch ledger (the asset must really have been fetched by this node,
|
|
17
|
+
* cross-owner, before the outcome). Without this claim the hub cannot attribute
|
|
18
|
+
* outcomes to assets at all, so reuse never credits the publisher.
|
|
19
|
+
*/
|
|
20
|
+
export interface OutcomeReport {
|
|
21
|
+
signals: readonly string[];
|
|
22
|
+
status: 'success' | 'failed';
|
|
23
|
+
geneId?: string;
|
|
24
|
+
score?: number;
|
|
25
|
+
summary?: string;
|
|
26
|
+
usedAssetIds?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/** recordOutcome never throws: failures come back as `recorded:false` + reason. */
|
|
29
|
+
export interface OutcomeReceipt {
|
|
30
|
+
recorded: boolean;
|
|
31
|
+
reason?: string;
|
|
32
|
+
}
|
|
33
|
+
/** 完整 GEP-A2A 信封(实测 dev: publish/fetch/validate 等协议消息端点必须全信封, 非仅 protocol+message_type). */
|
|
34
|
+
export declare function gepEnvelope(messageType: string, payload: unknown): Record<string, unknown>;
|
|
35
|
+
export interface PublicHubOptions {
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
auth: hub.AuthProvider;
|
|
38
|
+
fetchFn: FetchLike;
|
|
39
|
+
senderId: () => string | undefined;
|
|
40
|
+
/** task.subscribe 轮询节奏(默认 10s). */
|
|
41
|
+
subscribePollMs?: number;
|
|
42
|
+
/** Public Hub anti-abuse heartbeat metadata. Defaults to env-controlled heartbeat mode. */
|
|
43
|
+
antiAbuse?: AntiAbuseTelemetryOptions;
|
|
44
|
+
}
|
|
45
|
+
export interface PublicHelloResult {
|
|
46
|
+
ok: boolean;
|
|
47
|
+
authError?: boolean;
|
|
48
|
+
nodeId?: string;
|
|
49
|
+
nodeSecretVersion?: number;
|
|
50
|
+
rateLimitUntilMs?: number;
|
|
51
|
+
error?: string;
|
|
52
|
+
details?: unknown;
|
|
53
|
+
retryAfterMs?: number;
|
|
54
|
+
status?: string;
|
|
55
|
+
httpStatus?: number;
|
|
56
|
+
secretDiverged?: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface PublicHeartbeatOptions {
|
|
59
|
+
evolverVersion?: string;
|
|
60
|
+
lastUpdate?: PublicLastUpdatePayload;
|
|
61
|
+
}
|
|
62
|
+
export interface PublicLastUpdatePayload {
|
|
63
|
+
to_version: string;
|
|
64
|
+
status: string;
|
|
65
|
+
finished_at: number;
|
|
66
|
+
from_version?: string;
|
|
67
|
+
directive_id?: string;
|
|
68
|
+
error?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface PublicForceUpdateDirective {
|
|
71
|
+
required_version?: string;
|
|
72
|
+
manifest?: unknown;
|
|
73
|
+
reason?: string;
|
|
74
|
+
release_url?: string;
|
|
75
|
+
update_channels?: readonly string[];
|
|
76
|
+
directive_id?: string;
|
|
77
|
+
deadline_ms?: number;
|
|
78
|
+
stagger_window_ms?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface PublicHeartbeatResult {
|
|
81
|
+
ok: boolean;
|
|
82
|
+
authError?: boolean;
|
|
83
|
+
error?: string;
|
|
84
|
+
details?: unknown;
|
|
85
|
+
retryAfterMs?: number;
|
|
86
|
+
status?: string;
|
|
87
|
+
httpStatus?: number;
|
|
88
|
+
lastUpdateAck?: {
|
|
89
|
+
ok?: boolean;
|
|
90
|
+
reason?: string;
|
|
91
|
+
};
|
|
92
|
+
forceUpdate?: PublicForceUpdateDirective;
|
|
93
|
+
}
|
|
94
|
+
export declare function isHubDryRunEnabled(env?: Record<string, string | undefined>): boolean;
|
|
95
|
+
export declare function outboundMaxBodyBytes(env?: Record<string, string | undefined>): number;
|
|
96
|
+
/**
|
|
97
|
+
* 公版 hub 的 HubCapability 实现(M6-6). 打 /a2a/{publish,fetch,mailbox/*,events/poll}.
|
|
98
|
+
* 唯一懂公版 wire shape 的地方; 经 wireMap 规约成 core 类型. 真链路冒烟在 M6-7(dev.evomap.ai).
|
|
99
|
+
*/
|
|
100
|
+
export declare class PublicHubCapability implements hub.HubCapability {
|
|
101
|
+
private readonly opts;
|
|
102
|
+
private readonly http;
|
|
103
|
+
readonly auth: hub.AuthProvider;
|
|
104
|
+
readonly recipes: hub.RecipeCapability;
|
|
105
|
+
constructor(opts: PublicHubOptions);
|
|
106
|
+
hello(opts: {
|
|
107
|
+
rotate: boolean;
|
|
108
|
+
evolverVersion?: string;
|
|
109
|
+
}): Promise<PublicHelloResult>;
|
|
110
|
+
heartbeat(opts?: PublicHeartbeatOptions): Promise<PublicHeartbeatResult>;
|
|
111
|
+
private heartbeatMeta;
|
|
112
|
+
publish(bundle: hub.AssetRecord[]): Promise<hub.PublishReceipt>;
|
|
113
|
+
fetch(query: hub.HubQuery): Promise<hub.AssetRecord[]>;
|
|
114
|
+
fetchAssetById(assetId: string): Promise<hub.AssetRecord | null>;
|
|
115
|
+
/**
|
|
116
|
+
* #69: search != fetch. Free-text is the hub's vector endpoint (GET /a2a/assets/semantic-search?q=);
|
|
117
|
+
* signals/id queries fall through to fetch. /a2a/fetch does NOT do semantic, so text must not go there.
|
|
118
|
+
*/
|
|
119
|
+
search(query: hub.HubQuery): Promise<hub.AssetRecord[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Report a cycle outcome to the hub's memory graph (POST /a2a/memory/record).
|
|
122
|
+
* Unlike the protocol-message endpoints (publish/fetch), memory/record takes a
|
|
123
|
+
* FLAT body — no GEP envelope. Reporting is observability for the network's
|
|
124
|
+
* attribution loop, never a dependency of the cycle itself, so this method
|
|
125
|
+
* NEVER throws: auth/4xx/5xx/network failures all degrade to `recorded:false`.
|
|
126
|
+
* Costs hub credits per the hub's memory pricing (caller gates on enablement).
|
|
127
|
+
*/
|
|
128
|
+
recordOutcome(report: OutcomeReport): Promise<OutcomeReceipt>;
|
|
129
|
+
recordReuseResult(report: hub.ReuseResultReport): Promise<hub.ReuseResultReceipt>;
|
|
130
|
+
/**
|
|
131
|
+
* Pre-publish dry-run (POST /a2a/validate). The hub runs the same hub-side quality +
|
|
132
|
+
* content-safety gate as publish but stores nothing and charges no credits. This adapter is
|
|
133
|
+
* the raw HubCapability; proxy-facing callers sanitize/leak-check before invoking it so the
|
|
134
|
+
* public tool matches publish's local egress guard. Like publish, the payload is the
|
|
135
|
+
* {assets:[…]} bundle wrapped in a FULL GEP-A2A envelope — /a2a/validate is a strict protocol endpoint
|
|
136
|
+
* (validateProtocol(["validate","publish"])) and 400s on a bare body. A dry-run is never
|
|
137
|
+
* a dependency of the cycle, so this NEVER throws: quality reject (400) / content-safety
|
|
138
|
+
* reject (422) / 5xx / network all degrade to { valid:false, reason }.
|
|
139
|
+
*/
|
|
140
|
+
validate(bundle: hub.AssetRecord[]): Promise<hub.ValidateReceipt>;
|
|
141
|
+
createRecipe(request: hub.RecipeCreateRequest): Promise<hub.RecipeReceipt>;
|
|
142
|
+
publishRecipe(recipeId: string): Promise<hub.RecipeReceipt>;
|
|
143
|
+
getRecipe(recipeId: string): Promise<hub.RecipeFetchReceipt>;
|
|
144
|
+
expressRecipe(recipeId: string, request?: hub.RecipeExpressRequest): Promise<hub.RecipeExpressionReceipt>;
|
|
145
|
+
task: {
|
|
146
|
+
claim: (taskId: string) => Promise<{
|
|
147
|
+
claimId: string;
|
|
148
|
+
}>;
|
|
149
|
+
complete: (claimId: string, result: unknown) => Promise<{
|
|
150
|
+
status: "completed";
|
|
151
|
+
}>;
|
|
152
|
+
subscribe: (filter: unknown) => AsyncIterable<hub.TaskEvent>;
|
|
153
|
+
};
|
|
154
|
+
questions: {
|
|
155
|
+
submit: (questions: readonly hub.HubQuestion[]) => Promise<hub.QuestionSubmitReceipt[]>;
|
|
156
|
+
};
|
|
157
|
+
private submitQuestions;
|
|
158
|
+
private subscribeTasks;
|
|
159
|
+
mailbox: {
|
|
160
|
+
poll: () => Promise<hub.MailboxPollResult>;
|
|
161
|
+
ack: (eventId: string) => Promise<void>;
|
|
162
|
+
push: (event: hub.AgentEvent) => Promise<void>;
|
|
163
|
+
pushMany: (events: readonly hub.AgentEvent[]) => Promise<hub.MailboxPushManyResult>;
|
|
164
|
+
status: () => Promise<{
|
|
165
|
+
pending: number;
|
|
166
|
+
}>;
|
|
167
|
+
};
|
|
168
|
+
capabilities(): Promise<hub.HubManifest>;
|
|
169
|
+
}
|