@antseed/node 0.2.105 → 0.2.107
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/billing/index.d.ts +2 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +2 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/billing/unit.d.ts +3 -0
- package/dist/billing/unit.d.ts.map +1 -0
- package/dist/billing/unit.js +3 -0
- package/dist/billing/unit.js.map +1 -0
- package/dist/buyer-request-handler.d.ts +1 -54
- package/dist/buyer-request-handler.d.ts.map +1 -1
- package/dist/buyer-request-handler.js +2 -379
- package/dist/buyer-request-handler.js.map +1 -1
- package/dist/discovery/announcer.d.ts +7 -1
- package/dist/discovery/announcer.d.ts.map +1 -1
- package/dist/discovery/announcer.js +84 -33
- package/dist/discovery/announcer.js.map +1 -1
- package/dist/discovery/http-metadata-resolver.d.ts +4 -0
- package/dist/discovery/http-metadata-resolver.d.ts.map +1 -1
- package/dist/discovery/http-metadata-resolver.js +42 -2
- package/dist/discovery/http-metadata-resolver.js.map +1 -1
- package/dist/discovery/index.d.ts +1 -1
- package/dist/discovery/index.d.ts.map +1 -1
- package/dist/discovery/index.js +1 -1
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/metadata-codec.d.ts +4 -4
- package/dist/discovery/metadata-codec.d.ts.map +1 -1
- package/dist/discovery/metadata-codec.js +339 -23
- package/dist/discovery/metadata-codec.js.map +1 -1
- package/dist/discovery/metadata-validator.d.ts +7 -3
- package/dist/discovery/metadata-validator.d.ts.map +1 -1
- package/dist/discovery/metadata-validator.js +139 -8
- package/dist/discovery/metadata-validator.js.map +1 -1
- package/dist/discovery/peer-lookup.d.ts +1 -0
- package/dist/discovery/peer-lookup.d.ts.map +1 -1
- package/dist/discovery/peer-lookup.js +23 -5
- package/dist/discovery/peer-lookup.js.map +1 -1
- package/dist/discovery/peer-metadata.d.ts +2 -90
- package/dist/discovery/peer-metadata.d.ts.map +1 -1
- package/dist/discovery/peer-metadata.js +3 -11
- package/dist/discovery/peer-metadata.js.map +1 -1
- package/dist/discovery/seller-address-resolver.d.ts +1 -49
- package/dist/discovery/seller-address-resolver.d.ts.map +1 -1
- package/dist/discovery/seller-address-resolver.js +2 -114
- package/dist/discovery/seller-address-resolver.js.map +1 -1
- package/dist/errors.d.ts +43 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +73 -0
- package/dist/errors.js.map +1 -0
- package/dist/health/model-health-checker.d.ts +6 -5
- package/dist/health/model-health-checker.d.ts.map +1 -1
- package/dist/health/model-health-checker.js +22 -10
- package/dist/health/model-health-checker.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces/seller-provider.d.ts +6 -0
- package/dist/interfaces/seller-provider.d.ts.map +1 -1
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +28 -0
- package/dist/node.js.map +1 -1
- package/dist/p2p/connection-auth.d.ts +3 -8
- package/dist/p2p/connection-auth.d.ts.map +1 -1
- package/dist/p2p/connection-auth.js +4 -6
- package/dist/p2p/connection-auth.js.map +1 -1
- package/dist/p2p/connection-manager.d.ts +3 -1
- package/dist/p2p/connection-manager.d.ts.map +1 -1
- package/dist/p2p/connection-manager.js.map +1 -1
- package/dist/p2p/identity.d.ts +1 -21
- package/dist/p2p/identity.d.ts.map +1 -1
- package/dist/p2p/identity.js +3 -62
- package/dist/p2p/identity.js.map +1 -1
- package/dist/p2p/message-protocol.d.ts +1 -49
- package/dist/p2p/message-protocol.d.ts.map +1 -1
- package/dist/p2p/message-protocol.js +2 -125
- package/dist/p2p/message-protocol.js.map +1 -1
- package/dist/p2p/payment-codec.d.ts +1 -21
- package/dist/p2p/payment-codec.d.ts.map +1 -1
- package/dist/p2p/payment-codec.js +2 -220
- package/dist/p2p/payment-codec.js.map +1 -1
- package/dist/p2p/payment-mux.d.ts +1 -51
- package/dist/p2p/payment-mux.d.ts.map +1 -1
- package/dist/p2p/payment-mux.js +2 -159
- package/dist/p2p/payment-mux.js.map +1 -1
- package/dist/payments/buyer-free-usage-manager.d.ts +1 -43
- package/dist/payments/buyer-free-usage-manager.d.ts.map +1 -1
- package/dist/payments/buyer-free-usage-manager.js +2 -298
- package/dist/payments/buyer-free-usage-manager.js.map +1 -1
- package/dist/payments/buyer-payment-manager.d.ts +1 -277
- package/dist/payments/buyer-payment-manager.d.ts.map +1 -1
- package/dist/payments/buyer-payment-manager.js +2 -1039
- package/dist/payments/buyer-payment-manager.js.map +1 -1
- package/dist/payments/buyer-payment-negotiator.d.ts +1 -130
- package/dist/payments/buyer-payment-negotiator.d.ts.map +1 -1
- package/dist/payments/buyer-payment-negotiator.js +2 -950
- package/dist/payments/buyer-payment-negotiator.js.map +1 -1
- package/dist/payments/chain-config.d.ts.map +1 -1
- package/dist/payments/chain-config.js +13 -2
- package/dist/payments/chain-config.js.map +1 -1
- package/dist/payments/channel-session-state.d.ts +1 -13
- package/dist/payments/channel-session-state.d.ts.map +1 -1
- package/dist/payments/channel-session-state.js +2 -25
- package/dist/payments/channel-session-state.js.map +1 -1
- package/dist/payments/channel-store.d.ts +2 -51
- package/dist/payments/channel-store.d.ts.map +1 -1
- package/dist/payments/channel-store.js +3 -14
- package/dist/payments/channel-store.js.map +1 -1
- package/dist/payments/channel-usage-accounting.d.ts +1 -17
- package/dist/payments/channel-usage-accounting.d.ts.map +1 -1
- package/dist/payments/channel-usage-accounting.js +2 -65
- package/dist/payments/channel-usage-accounting.js.map +1 -1
- package/dist/payments/evm/base-evm-client.d.ts +1 -26
- package/dist/payments/evm/base-evm-client.d.ts.map +1 -1
- package/dist/payments/evm/base-evm-client.js +2 -115
- package/dist/payments/evm/base-evm-client.js.map +1 -1
- package/dist/payments/evm/channels-client.d.ts +1 -85
- package/dist/payments/evm/channels-client.d.ts.map +1 -1
- package/dist/payments/evm/channels-client.js +2 -193
- package/dist/payments/evm/channels-client.js.map +1 -1
- package/dist/payments/evm/deposits-client.d.ts +1 -29
- package/dist/payments/evm/deposits-client.d.ts.map +1 -1
- package/dist/payments/evm/deposits-client.js +2 -67
- package/dist/payments/evm/deposits-client.js.map +1 -1
- package/dist/payments/evm/signatures.d.ts +1 -203
- package/dist/payments/evm/signatures.d.ts.map +1 -1
- package/dist/payments/evm/signatures.js +2 -236
- package/dist/payments/evm/signatures.js.map +1 -1
- package/dist/payments/evm/subpool-client.d.ts +32 -0
- package/dist/payments/evm/subpool-client.d.ts.map +1 -0
- package/dist/payments/evm/subpool-client.js +158 -0
- package/dist/payments/evm/subpool-client.js.map +1 -0
- package/dist/payments/index.d.ts +1 -1
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +1 -1
- package/dist/payments/index.js.map +1 -1
- package/dist/payments/pricing.d.ts +1 -26
- package/dist/payments/pricing.d.ts.map +1 -1
- package/dist/payments/pricing.js +2 -36
- package/dist/payments/pricing.js.map +1 -1
- package/dist/payments/seller-payment-manager.d.ts +7 -0
- package/dist/payments/seller-payment-manager.d.ts.map +1 -1
- package/dist/payments/seller-payment-manager.js +27 -2
- package/dist/payments/seller-payment-manager.js.map +1 -1
- package/dist/payments/usdc-utils.d.ts +1 -8
- package/dist/payments/usdc-utils.d.ts.map +1 -1
- package/dist/payments/usdc-utils.js +2 -16
- package/dist/payments/usdc-utils.js.map +1 -1
- package/dist/proxy/proxy-mux.d.ts +1 -69
- package/dist/proxy/proxy-mux.d.ts.map +1 -1
- package/dist/proxy/proxy-mux.js +2 -346
- package/dist/proxy/proxy-mux.js.map +1 -1
- package/dist/proxy/request-codec.d.ts +1 -41
- package/dist/proxy/request-codec.d.ts.map +1 -1
- package/dist/proxy/request-codec.js +2 -280
- package/dist/proxy/request-codec.js.map +1 -1
- package/dist/seller-request-handler.d.ts +10 -3
- package/dist/seller-request-handler.d.ts.map +1 -1
- package/dist/seller-request-handler.js +112 -17
- package/dist/seller-request-handler.js.map +1 -1
- package/dist/types/billing.d.ts +2 -0
- package/dist/types/billing.d.ts.map +1 -0
- package/dist/types/billing.js +2 -0
- package/dist/types/billing.js.map +1 -0
- package/dist/types/capability.d.ts +1 -25
- package/dist/types/capability.d.ts.map +1 -1
- package/dist/types/capability.js +2 -1
- package/dist/types/capability.js.map +1 -1
- package/dist/types/connection.d.ts +1 -26
- package/dist/types/connection.d.ts.map +1 -1
- package/dist/types/connection.js +2 -10
- package/dist/types/connection.js.map +1 -1
- package/dist/types/http.d.ts +1 -39
- package/dist/types/http.d.ts.map +1 -1
- package/dist/types/http.js +2 -16
- package/dist/types/http.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/peer.d.ts +9 -31
- package/dist/types/peer.d.ts.map +1 -1
- package/dist/types/peer.js +2 -14
- package/dist/types/peer.js.map +1 -1
- package/dist/types/protocol.d.ts +1 -306
- package/dist/types/protocol.d.ts.map +1 -1
- package/dist/types/protocol.js +2 -81
- package/dist/types/protocol.js.map +1 -1
- package/dist/types/service-api.d.ts +1 -5
- package/dist/types/service-api.d.ts.map +1 -1
- package/dist/types/service-api.js +2 -12
- package/dist/types/service-api.js.map +1 -1
- package/dist/utils/debug.d.ts +1 -5
- package/dist/utils/debug.d.ts.map +1 -1
- package/dist/utils/debug.js +2 -52
- package/dist/utils/debug.js.map +1 -1
- package/dist/utils/hex.d.ts +1 -2
- package/dist/utils/hex.d.ts.map +1 -1
- package/dist/utils/hex.js +2 -14
- package/dist/utils/hex.js.map +1 -1
- package/dist/utils/json-codec.d.ts +1 -9
- package/dist/utils/json-codec.d.ts.map +1 -1
- package/dist/utils/json-codec.js +2 -51
- package/dist/utils/json-codec.js.map +1 -1
- package/dist/utils/response-usage.d.ts +1 -9
- package/dist/utils/response-usage.d.ts.map +1 -1
- package/dist/utils/response-usage.js +2 -39
- package/dist/utils/response-usage.js.map +1 -1
- package/dist/verification/codec.d.ts +1 -3
- package/dist/verification/codec.d.ts.map +1 -1
- package/dist/verification/codec.js +2 -37
- package/dist/verification/codec.js.map +1 -1
- package/dist/verification/response-auth.d.ts +1 -30
- package/dist/verification/response-auth.d.ts.map +1 -1
- package/dist/verification/response-auth.js +2 -110
- package/dist/verification/response-auth.js.map +1 -1
- package/dist/verification/verification-mux.d.ts +1 -19
- package/dist/verification/verification-mux.d.ts.map +1 -1
- package/dist/verification/verification-mux.js +2 -99
- package/dist/verification/verification-mux.js.map +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-lookup.js","sourceRoot":"","sources":["../../src/discovery/peer-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,SAAS,OAAO,CAAI,GAAQ;IAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;IACxB,KAAK,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9C,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAE,EAAE,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CA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AAC,MAAM,CAAC,0BAA0B,CACzE,CAAC;QACF,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,YAAY,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;QAC9E,OAAO;YACL,KAAK;YACL,WAAW;YACX,GAAG,CAAC,kBAAkB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACnE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;YAC9C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB;YAC/C,kBAAkB,EAAE,aAAa;SAClC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,QAAsB;QAC5B,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -1,91 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { ServiceApiProtocol } from "../types/service-api.js";
|
|
4
|
-
import { WELL_KNOWN_SERVICE_API_PROTOCOLS } from "../types/service-api.js";
|
|
5
|
-
export declare const METADATA_VERSION = 10;
|
|
6
|
-
export declare const WELL_KNOWN_SERVICE_CATEGORIES: readonly ["privacy", "legal", "uncensored", "coding", "finance", "tee"];
|
|
7
|
-
export { WELL_KNOWN_SERVICE_API_PROTOCOLS };
|
|
8
|
-
export type { ServiceApiProtocol };
|
|
9
|
-
export interface TokenPricingUsdPerMillion {
|
|
10
|
-
inputUsdPerMillion: number;
|
|
11
|
-
outputUsdPerMillion: number;
|
|
12
|
-
cachedInputUsdPerMillion?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface ProviderAnnouncement {
|
|
15
|
-
provider: string;
|
|
16
|
-
services: string[];
|
|
17
|
-
defaultPricing: TokenPricingUsdPerMillion;
|
|
18
|
-
servicePricing?: Record<string, TokenPricingUsdPerMillion>;
|
|
19
|
-
serviceCategories?: Record<string, string[]>;
|
|
20
|
-
serviceApiProtocols?: Record<string, ServiceApiProtocol[]>;
|
|
21
|
-
maxConcurrency: number;
|
|
22
|
-
currentLoad: number;
|
|
23
|
-
}
|
|
24
|
-
export type DomainVerificationMethod = "dns-txt" | "https-well-known";
|
|
25
|
-
export interface DomainVerificationClaim {
|
|
26
|
-
/** ASCII hostname only, lower-case, with no scheme, path, or port. */
|
|
27
|
-
domain: string;
|
|
28
|
-
/** Accepted proof transports. When omitted, clients may try every known method. */
|
|
29
|
-
methods?: DomainVerificationMethod[];
|
|
30
|
-
}
|
|
31
|
-
export interface GithubVerificationClaim {
|
|
32
|
-
/** GitHub username, lower-case. */
|
|
33
|
-
username: string;
|
|
34
|
-
/**
|
|
35
|
-
* Public repository holding the proof file, lower-case. Defaults to the
|
|
36
|
-
* profile repository `<username>/<username>` when omitted.
|
|
37
|
-
*/
|
|
38
|
-
repository?: string;
|
|
39
|
-
}
|
|
40
|
-
export interface PeerVerifications {
|
|
41
|
-
/**
|
|
42
|
-
* Domain ownership claims. Clients verify by checking a matching DNS TXT
|
|
43
|
-
* record at `_antseed.<domain>` or a well-known proof at
|
|
44
|
-
* `https://<domain>/.well-known/antseed.json`.
|
|
45
|
-
*/
|
|
46
|
-
domains?: DomainVerificationClaim[];
|
|
47
|
-
/**
|
|
48
|
-
* GitHub account ownership claims. Clients verify by fetching
|
|
49
|
-
* `https://raw.githubusercontent.com/<username>/<repository>/HEAD/antseed.json`
|
|
50
|
-
* — the username in the URL path binds the proof to the account.
|
|
51
|
-
*/
|
|
52
|
-
github?: GithubVerificationClaim[];
|
|
53
|
-
}
|
|
54
|
-
export interface PeerMetadata {
|
|
55
|
-
peerId: PeerId;
|
|
56
|
-
version: number;
|
|
57
|
-
displayName?: string;
|
|
58
|
-
publicAddress?: string;
|
|
59
|
-
providers: ProviderAnnouncement[];
|
|
60
|
-
offerings?: PeerOffering[];
|
|
61
|
-
region: string;
|
|
62
|
-
timestamp: number;
|
|
63
|
-
stakeAmountUSDC?: number;
|
|
64
|
-
onChainChannelCount?: number;
|
|
65
|
-
onChainGhostCount?: number;
|
|
66
|
-
/** Protocol capabilities supported by this peer. */
|
|
67
|
-
capabilities?: string[];
|
|
68
|
-
/**
|
|
69
|
-
* On-chain seller contract that fronts this peer (e.g. a DiemStakingProxy).
|
|
70
|
-
* Buyers resolve `seller = sellerContract` for channel flows and verify the
|
|
71
|
-
* binding by calling `sellerContract.isOperator(peerAddress)` on-chain.
|
|
72
|
-
* Stored as 40 lowercase hex chars (no `0x` prefix) matching `peerId` format.
|
|
73
|
-
*/
|
|
74
|
-
sellerContract?: string;
|
|
75
|
-
/** Optional external ownership claims announced by this peer. */
|
|
76
|
-
verifications?: PeerVerifications;
|
|
77
|
-
/**
|
|
78
|
-
* Buyer-local observation time for this metadata fetch. Not signed and not
|
|
79
|
-
* encoded in metadata; used only for diagnostics/freshness decisions.
|
|
80
|
-
*/
|
|
81
|
-
resolvedAtMs?: number;
|
|
82
|
-
/**
|
|
83
|
-
* Seller HTTP Date header observed during metadata fetch, in Unix ms. Not
|
|
84
|
-
* signed and not encoded in metadata. When present, buyers can judge the
|
|
85
|
-
* signed timestamp using the seller's wall clock instead of their own, which
|
|
86
|
-
* keeps discovery working for users whose local desktop clock is wrong.
|
|
87
|
-
*/
|
|
88
|
-
serverDateMs?: number;
|
|
89
|
-
signature: string;
|
|
90
|
-
}
|
|
1
|
+
export * from '@antseed/protocol/peer-metadata';
|
|
2
|
+
export { WELL_KNOWN_SERVICE_API_PROTOCOLS, type ServiceApiProtocol } from '@antseed/protocol/service-api';
|
|
91
3
|
//# sourceMappingURL=peer-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-metadata.d.ts","sourceRoot":"","sources":["../../src/discovery/peer-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"peer-metadata.d.ts","sourceRoot":"","sources":["../../src/discovery/peer-metadata.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,gCAAgC,EAAE,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
"privacy",
|
|
5
|
-
"legal",
|
|
6
|
-
"uncensored",
|
|
7
|
-
"coding",
|
|
8
|
-
"finance",
|
|
9
|
-
"tee",
|
|
10
|
-
];
|
|
11
|
-
export { WELL_KNOWN_SERVICE_API_PROTOCOLS };
|
|
1
|
+
// Moved to @antseed/protocol; re-exported for compatibility.
|
|
2
|
+
export * from '@antseed/protocol/peer-metadata';
|
|
3
|
+
export { WELL_KNOWN_SERVICE_API_PROTOCOLS } from '@antseed/protocol/service-api';
|
|
12
4
|
//# sourceMappingURL=peer-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-metadata.js","sourceRoot":"","sources":["../../src/discovery/peer-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"peer-metadata.js","sourceRoot":"","sources":["../../src/discovery/peer-metadata.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,iCAAiC,CAAC;AAChD,OAAO,EAAE,gCAAgC,EAA2B,MAAM,+BAA+B,CAAC"}
|
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { PeerMetadata } from "./peer-metadata.js";
|
|
3
|
-
/**
|
|
4
|
-
* Called by the resolver to ask the chain whether a peer is an authorized
|
|
5
|
-
* operator of a seller contract. Implementations typically wrap an
|
|
6
|
-
* `isOperator(address) view returns (bool)` call on the proxy.
|
|
7
|
-
*/
|
|
8
|
-
export type IsOperatorChecker = (sellerContract: string, peerAddress: string) => Promise<boolean>;
|
|
9
|
-
export declare class SellerAuthorizationError extends Error {
|
|
10
|
-
constructor(reason: string);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Resolves the on-chain seller address for a peer.
|
|
14
|
-
*
|
|
15
|
-
* If the peer's metadata advertises a `sellerContract`, the resolver verifies
|
|
16
|
-
* via a single on-chain call (`proxy.isOperator(peerAddress)`) that the peer is
|
|
17
|
-
* an authorized operator for that contract. Result is cached per peer with a
|
|
18
|
-
* short TTL; cache misses go back to chain. Fail-closed on unknown peers.
|
|
19
|
-
*/
|
|
20
|
-
export declare class SellerAddressResolver {
|
|
21
|
-
private readonly _cache;
|
|
22
|
-
private readonly _ttlMs;
|
|
23
|
-
private readonly _maxEntries;
|
|
24
|
-
private readonly _isOperator;
|
|
25
|
-
private readonly _rpcRetries;
|
|
26
|
-
private readonly _rpcRetryBackoffMs;
|
|
27
|
-
constructor(opts: {
|
|
28
|
-
isOperator: IsOperatorChecker;
|
|
29
|
-
ttlMs?: number;
|
|
30
|
-
maxEntries?: number;
|
|
31
|
-
rpcRetries?: number;
|
|
32
|
-
rpcRetryBackoffMs?: number;
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* - No sellerContract in metadata → return peerIdToAddress(peerId) (default).
|
|
36
|
-
* - sellerContract present and chain says peer is an operator → return sellerContract.
|
|
37
|
-
* - sellerContract present but chain says peer is NOT an operator → throw.
|
|
38
|
-
*/
|
|
39
|
-
resolveSellerAddress(peerId: PeerId, metadata?: PeerMetadata): Promise<string>;
|
|
40
|
-
invalidate(peerId: PeerId): void;
|
|
41
|
-
/**
|
|
42
|
-
* Retry `isOperator` a small number of times with linear backoff before
|
|
43
|
-
* failing closed. Transient RPC blips (timeout, rate limit, fallback
|
|
44
|
-
* provider churn) would otherwise drop peers from discovery for the full
|
|
45
|
-
* negotiation attempt; a couple of cheap retries absorb the common case.
|
|
46
|
-
*/
|
|
47
|
-
private _callIsOperatorWithRetry;
|
|
48
|
-
private _pruneCache;
|
|
49
|
-
}
|
|
1
|
+
export * from '@antseed/buyer-core/seller-address-resolver';
|
|
50
2
|
//# sourceMappingURL=seller-address-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller-address-resolver.d.ts","sourceRoot":"","sources":["../../src/discovery/seller-address-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seller-address-resolver.d.ts","sourceRoot":"","sources":["../../src/discovery/seller-address-resolver.ts"],"names":[],"mappings":"AACA,cAAc,6CAA6C,CAAC"}
|
|
@@ -1,115 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const DEFAULT_CACHE_TTL_MS = 5 * 60 * 1000;
|
|
4
|
-
const DEFAULT_CACHE_MAX_ENTRIES = 1024;
|
|
5
|
-
const DEFAULT_RPC_RETRIES = 2;
|
|
6
|
-
const DEFAULT_RPC_RETRY_BACKOFF_MS = 150;
|
|
7
|
-
export class SellerAuthorizationError extends Error {
|
|
8
|
-
constructor(reason) {
|
|
9
|
-
super(`seller authorization failed: ${reason}`);
|
|
10
|
-
this.name = "SellerAuthorizationError";
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Resolves the on-chain seller address for a peer.
|
|
15
|
-
*
|
|
16
|
-
* If the peer's metadata advertises a `sellerContract`, the resolver verifies
|
|
17
|
-
* via a single on-chain call (`proxy.isOperator(peerAddress)`) that the peer is
|
|
18
|
-
* an authorized operator for that contract. Result is cached per peer with a
|
|
19
|
-
* short TTL; cache misses go back to chain. Fail-closed on unknown peers.
|
|
20
|
-
*/
|
|
21
|
-
export class SellerAddressResolver {
|
|
22
|
-
_cache = new Map();
|
|
23
|
-
_ttlMs;
|
|
24
|
-
_maxEntries;
|
|
25
|
-
_isOperator;
|
|
26
|
-
_rpcRetries;
|
|
27
|
-
_rpcRetryBackoffMs;
|
|
28
|
-
constructor(opts) {
|
|
29
|
-
this._isOperator = opts.isOperator;
|
|
30
|
-
this._ttlMs = opts.ttlMs ?? DEFAULT_CACHE_TTL_MS;
|
|
31
|
-
this._maxEntries = opts.maxEntries ?? DEFAULT_CACHE_MAX_ENTRIES;
|
|
32
|
-
this._rpcRetries = opts.rpcRetries ?? DEFAULT_RPC_RETRIES;
|
|
33
|
-
this._rpcRetryBackoffMs = opts.rpcRetryBackoffMs ?? DEFAULT_RPC_RETRY_BACKOFF_MS;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* - No sellerContract in metadata → return peerIdToAddress(peerId) (default).
|
|
37
|
-
* - sellerContract present and chain says peer is an operator → return sellerContract.
|
|
38
|
-
* - sellerContract present but chain says peer is NOT an operator → throw.
|
|
39
|
-
*/
|
|
40
|
-
async resolveSellerAddress(peerId, metadata) {
|
|
41
|
-
const raw = metadata?.sellerContract;
|
|
42
|
-
if (!raw)
|
|
43
|
-
return peerIdToAddress(peerId);
|
|
44
|
-
// Normalize to lowercase `0x`-prefixed form so cache hits are stable
|
|
45
|
-
// regardless of casing upstream (defence in depth; the decoder already
|
|
46
|
-
// emits lowercase hex without the prefix).
|
|
47
|
-
const sellerContract = (raw.startsWith("0x") ? raw : "0x" + raw).toLowerCase();
|
|
48
|
-
const cached = this._cache.get(peerId);
|
|
49
|
-
if (cached &&
|
|
50
|
-
cached.sellerContract === sellerContract &&
|
|
51
|
-
Date.now() - cached.verifiedAt < this._ttlMs) {
|
|
52
|
-
// Refresh insertion order so eviction is true LRU, not FIFO.
|
|
53
|
-
this._cache.delete(peerId);
|
|
54
|
-
this._cache.set(peerId, cached);
|
|
55
|
-
return cached.sellerContract;
|
|
56
|
-
}
|
|
57
|
-
const peerAddress = peerIdToAddress(peerId);
|
|
58
|
-
const isAuthorized = await this._callIsOperatorWithRetry(sellerContract, peerAddress);
|
|
59
|
-
if (!isAuthorized) {
|
|
60
|
-
debugWarn(`[Resolver] peer ${peerId.slice(0, 12)}... is NOT an operator of ${sellerContract}`);
|
|
61
|
-
throw new SellerAuthorizationError("peer is not an authorized operator");
|
|
62
|
-
}
|
|
63
|
-
this._pruneCache();
|
|
64
|
-
this._cache.set(peerId, { sellerContract, verifiedAt: Date.now() });
|
|
65
|
-
return sellerContract;
|
|
66
|
-
}
|
|
67
|
-
invalidate(peerId) {
|
|
68
|
-
this._cache.delete(peerId);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Retry `isOperator` a small number of times with linear backoff before
|
|
72
|
-
* failing closed. Transient RPC blips (timeout, rate limit, fallback
|
|
73
|
-
* provider churn) would otherwise drop peers from discovery for the full
|
|
74
|
-
* negotiation attempt; a couple of cheap retries absorb the common case.
|
|
75
|
-
*/
|
|
76
|
-
async _callIsOperatorWithRetry(sellerContract, peerAddress) {
|
|
77
|
-
const maxAttempts = Math.max(1, this._rpcRetries + 1);
|
|
78
|
-
let lastErr;
|
|
79
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
80
|
-
try {
|
|
81
|
-
return await this._isOperator(sellerContract, peerAddress);
|
|
82
|
-
}
|
|
83
|
-
catch (err) {
|
|
84
|
-
lastErr = err;
|
|
85
|
-
if (attempt < maxAttempts) {
|
|
86
|
-
await new Promise((resolve) => setTimeout(resolve, this._rpcRetryBackoffMs * attempt));
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
debugWarn(`[Resolver] isOperator(${sellerContract}, ${peerAddress}) RPC failed after ${maxAttempts} attempt(s): ${lastErr instanceof Error ? lastErr.message : lastErr}`);
|
|
92
|
-
throw new SellerAuthorizationError("isOperator RPC failed");
|
|
93
|
-
}
|
|
94
|
-
_pruneCache() {
|
|
95
|
-
if (this._cache.size < this._maxEntries)
|
|
96
|
-
return;
|
|
97
|
-
const now = Date.now();
|
|
98
|
-
for (const [peerId, entry] of this._cache) {
|
|
99
|
-
if (now - entry.verifiedAt >= this._ttlMs)
|
|
100
|
-
this._cache.delete(peerId);
|
|
101
|
-
}
|
|
102
|
-
if (this._cache.size < this._maxEntries)
|
|
103
|
-
return;
|
|
104
|
-
// LRU eviction: `Map` iteration follows insertion order. The cache-hit
|
|
105
|
-
// path above `delete`s and re-`set`s the entry on every lookup, which
|
|
106
|
-
// moves it to the end of the iteration order. That makes
|
|
107
|
-
// `keys().next().value` the least-recently-used key here, not merely
|
|
108
|
-
// the first-inserted one — don't break that invariant without also
|
|
109
|
-
// updating the hit path.
|
|
110
|
-
const oldestKey = this._cache.keys().next().value;
|
|
111
|
-
if (oldestKey !== undefined)
|
|
112
|
-
this._cache.delete(oldestKey);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
1
|
+
// Moved to @antseed/buyer-core; re-exported for compatibility.
|
|
2
|
+
export * from '@antseed/buyer-core/seller-address-resolver';
|
|
115
3
|
//# sourceMappingURL=seller-address-resolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seller-address-resolver.js","sourceRoot":"","sources":["../../src/discovery/seller-address-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seller-address-resolver.js","sourceRoot":"","sources":["../../src/discovery/seller-address-resolver.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,cAAc,6CAA6C,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fault attribution for request failures.
|
|
3
|
+
*
|
|
4
|
+
* The buyer's dispatch path collapses almost every error into one catch, where
|
|
5
|
+
* a dead seller looks exactly like a dead chain RPC, an empty wallet, or one of
|
|
6
|
+
* our own state-machine bugs. Consumers that act on failures — cooling a peer
|
|
7
|
+
* down, choosing a status code, deciding whether to retry elsewhere — need to
|
|
8
|
+
* know whose fault it was, and a message string is not a contract.
|
|
9
|
+
*
|
|
10
|
+
* Errors carry that judgement from the site that raises them. Anything
|
|
11
|
+
* untagged is `unknown`, and callers must treat `unknown` as "not proven to be
|
|
12
|
+
* the peer's fault".
|
|
13
|
+
*/
|
|
14
|
+
export type FaultAttribution =
|
|
15
|
+
/** Our own wallet, deposits, config, transport or state machine. */
|
|
16
|
+
'buyer'
|
|
17
|
+
/** The remote peer misbehaved or went away. */
|
|
18
|
+
| 'peer'
|
|
19
|
+
/** Genuinely ambiguous — most timeouts and dropped connections land here. */
|
|
20
|
+
| 'unknown';
|
|
21
|
+
export type AntseedErrorCode = 'node-not-started' | 'node-stopped' | 'invalid-request' | 'buyer-stream-limit' | 'buyer-budget-too-low' | 'buyer-reserve-misconfigured' | 'buyer-session-state' | 'buyer-deposits-insufficient' | 'buyer-transport-closed' | 'invalid-spending-auth-header' | 'chain-rpc-unavailable' | 'peer-not-authorized' | 'peer-protocol-violation';
|
|
22
|
+
export interface AntseedRequestErrorOptions {
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
}
|
|
25
|
+
/** An error that knows whose fault it is. */
|
|
26
|
+
export declare class AntseedRequestError extends Error {
|
|
27
|
+
readonly attribution: FaultAttribution;
|
|
28
|
+
readonly code: AntseedErrorCode;
|
|
29
|
+
constructor(message: string, code: AntseedErrorCode, attribution: FaultAttribution, options?: AntseedRequestErrorOptions);
|
|
30
|
+
}
|
|
31
|
+
/** Convenience constructor for the common "this one is on us" case. */
|
|
32
|
+
export declare function buyerFault(message: string, code: AntseedErrorCode, options?: AntseedRequestErrorOptions): AntseedRequestError;
|
|
33
|
+
/** Convenience constructor for a proven peer fault. */
|
|
34
|
+
export declare function peerFault(message: string, code: AntseedErrorCode, options?: AntseedRequestErrorOptions): AntseedRequestError;
|
|
35
|
+
/**
|
|
36
|
+
* Read the attribution off an error, following `cause` chains so a wrapped
|
|
37
|
+
* error does not lose its verdict. Defaults to `unknown`, never to `peer` —
|
|
38
|
+
* blaming a peer requires evidence.
|
|
39
|
+
*/
|
|
40
|
+
export declare function faultAttributionOf(err: unknown, depth?: number): FaultAttribution;
|
|
41
|
+
/** Read the machine-readable code off an error, if it carries one. */
|
|
42
|
+
export declare function faultCodeOf(err: unknown, depth?: number): AntseedErrorCode | null;
|
|
43
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/err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@@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fault attribution for request failures.
|
|
3
|
+
*
|
|
4
|
+
* The buyer's dispatch path collapses almost every error into one catch, where
|
|
5
|
+
* a dead seller looks exactly like a dead chain RPC, an empty wallet, or one of
|
|
6
|
+
* our own state-machine bugs. Consumers that act on failures — cooling a peer
|
|
7
|
+
* down, choosing a status code, deciding whether to retry elsewhere — need to
|
|
8
|
+
* know whose fault it was, and a message string is not a contract.
|
|
9
|
+
*
|
|
10
|
+
* Errors carry that judgement from the site that raises them. Anything
|
|
11
|
+
* untagged is `unknown`, and callers must treat `unknown` as "not proven to be
|
|
12
|
+
* the peer's fault".
|
|
13
|
+
*/
|
|
14
|
+
/** An error that knows whose fault it is. */
|
|
15
|
+
export class AntseedRequestError extends Error {
|
|
16
|
+
attribution;
|
|
17
|
+
code;
|
|
18
|
+
constructor(message, code, attribution, options) {
|
|
19
|
+
super(message, options?.cause !== undefined ? { cause: options.cause } : undefined);
|
|
20
|
+
this.name = 'AntseedRequestError';
|
|
21
|
+
this.code = code;
|
|
22
|
+
this.attribution = attribution;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Convenience constructor for the common "this one is on us" case. */
|
|
26
|
+
export function buyerFault(message, code, options) {
|
|
27
|
+
return new AntseedRequestError(message, code, 'buyer', options);
|
|
28
|
+
}
|
|
29
|
+
/** Convenience constructor for a proven peer fault. */
|
|
30
|
+
export function peerFault(message, code, options) {
|
|
31
|
+
return new AntseedRequestError(message, code, 'peer', options);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Read the attribution off an error, following `cause` chains so a wrapped
|
|
35
|
+
* error does not lose its verdict. Defaults to `unknown`, never to `peer` —
|
|
36
|
+
* blaming a peer requires evidence.
|
|
37
|
+
*/
|
|
38
|
+
export function faultAttributionOf(err, depth = 0) {
|
|
39
|
+
if (depth > 5)
|
|
40
|
+
return 'unknown';
|
|
41
|
+
// Duck-typed rather than `instanceof AntseedRequestError`: other error
|
|
42
|
+
// classes carry the same verdict (e.g. SellerAuthorizationError), and a
|
|
43
|
+
// duplicated module instance would defeat a prototype check.
|
|
44
|
+
const attribution = err?.attribution;
|
|
45
|
+
if (attribution === 'buyer' || attribution === 'peer' || attribution === 'unknown') {
|
|
46
|
+
return attribution;
|
|
47
|
+
}
|
|
48
|
+
if (err instanceof Error && err.cause !== undefined && err.cause !== err) {
|
|
49
|
+
return faultAttributionOf(err.cause, depth + 1);
|
|
50
|
+
}
|
|
51
|
+
return 'unknown';
|
|
52
|
+
}
|
|
53
|
+
/** Read the machine-readable code off an error, if it carries one. */
|
|
54
|
+
export function faultCodeOf(err, depth = 0) {
|
|
55
|
+
if (depth > 5)
|
|
56
|
+
return null;
|
|
57
|
+
const code = err?.code;
|
|
58
|
+
if (typeof code === 'string' && ANTSEED_ERROR_CODES.has(code)) {
|
|
59
|
+
return code;
|
|
60
|
+
}
|
|
61
|
+
if (err instanceof Error && err.cause !== undefined && err.cause !== err) {
|
|
62
|
+
return faultCodeOf(err.cause, depth + 1);
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
/** Guards `faultCodeOf` against unrelated `code` fields, e.g. ethers' NETWORK_ERROR. */
|
|
67
|
+
const ANTSEED_ERROR_CODES = new Set([
|
|
68
|
+
'node-not-started', 'node-stopped', 'invalid-request', 'buyer-stream-limit',
|
|
69
|
+
'buyer-budget-too-low', 'buyer-reserve-misconfigured', 'buyer-session-state',
|
|
70
|
+
'buyer-deposits-insufficient', 'buyer-transport-closed', 'invalid-spending-auth-header',
|
|
71
|
+
'chain-rpc-unavailable', 'peer-not-authorized', 'peer-protocol-violation',
|
|
72
|
+
]);
|
|
73
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA6BH,6CAA6C;AAC7C,MAAM,OAAO,mB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C;QACzE,OAAO,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,GAAY,EAAE,KAAK,GAAG,CAAC;IACjD,IAAI,KAAK,GAAG,CAAC;QAAE,OAAO,IAAI,CAAA;IAC1B,MAAM,IAAI,GAAI,GAAiC,EAAE,IAAI,CAAA;IACrD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,mBAAmB,CAAC,GAAG,CAAC,IAAwB,CAAC,EAAE,CAAC;QAClF,OAAO,IAAwB,CAAA;IACjC,CAAC;IACD,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;QACzE,OAAO,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAA;IAC1C,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,wFAAwF;AACxF,MAAM,mBAAmB,GAAkC,IAAI,GAAG,CAAmB;IACnF,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,oBAAoB;IAC3E,sBAAsB,EAAE,6BAA6B,EAAE,qBAAqB;IAC5E,6BAA6B,EAAE,wBAAwB,EAAE,8BAA8B;IACvF,uBAAuB,EAAE,qBAAqB,EAAE,yBAAyB;CAC1E,CAAC,CAAA"}
|
|
@@ -87,6 +87,7 @@ export declare class ModelHealthChecker {
|
|
|
87
87
|
private _restoreService;
|
|
88
88
|
private _emitChange;
|
|
89
89
|
}
|
|
90
|
+
export declare function supportsHealthProbe(protocol: ServiceApiProtocol): boolean;
|
|
90
91
|
/**
|
|
91
92
|
* Build the cheapest request that proves the upstream model responds: a
|
|
92
93
|
* single-token completion. Sent through `Provider.handleRequest`, so the
|
|
@@ -98,11 +99,11 @@ export declare function buildHealthProbeRequest(service: string, protocol: Servi
|
|
|
98
99
|
* Classify a probe response status.
|
|
99
100
|
*
|
|
100
101
|
* - 2xx/3xx — the model answered: healthy.
|
|
101
|
-
* - 401/402/403/404 and 5xx — credentials broken, billing unavailable,
|
|
102
|
-
* gone, or upstream down: unhealthy. (The relay
|
|
103
|
-
* errors/timeouts to 502.)
|
|
104
|
-
* - Everything else (400, 422,
|
|
105
|
-
* itself was rejected (
|
|
102
|
+
* - 401/402/403/404, 429, and 5xx — credentials broken, billing unavailable,
|
|
103
|
+
* rate or usage limited, model gone, or upstream down: unhealthy. (The relay
|
|
104
|
+
* collapses upstream network errors/timeouts to 502.)
|
|
105
|
+
* - Everything else (400, 422, ...) — the endpoint is alive but the probe
|
|
106
|
+
* itself was rejected (for example, an unsupported parameter): inconclusive,
|
|
106
107
|
* so a working model is never unadvertised over a probe quirk.
|
|
107
108
|
*/
|
|
108
109
|
export declare function classifyProbeStatus(statusCode: number): ProbeOutcome;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-health-checker.d.ts","sourceRoot":"","sources":["../../src/health/model-health-checker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,yFAAyF;AACzF,eAAO,MAAM,gCAAgC,QAAa,CAAC;AAC3D,mEAAmE;AACnE,eAAO,MAAM,sCAAsC,IAAI,CAAC;AACxD,6EAA6E;AAC7E,eAAO,MAAM,qCAAqC,QAAS,CAAC;AAE5D,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE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AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,qBAAqB,CAwC5G;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAOpE"}
|
|
@@ -130,7 +130,14 @@ export class ModelHealthChecker {
|
|
|
130
130
|
state.lastProbeAt = Date.now();
|
|
131
131
|
let outcome;
|
|
132
132
|
try {
|
|
133
|
-
const
|
|
133
|
+
const protocol = resolveProbeProtocol(provider, service);
|
|
134
|
+
if (!supportsHealthProbe(protocol)) {
|
|
135
|
+
state.lastStatusCode = null;
|
|
136
|
+
state.lastDetail = `Skipped health probe for unsupported protocol ${protocol}`;
|
|
137
|
+
debugLog(`[ModelHealth] ${provider.name}/${service}: ${state.lastDetail}`);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const request = buildHealthProbeRequest(service, protocol);
|
|
134
141
|
const response = await withTimeout(probeProvider.handleRequest(request), this._probeTimeoutMs, `health probe for ${service} timed out after ${this._probeTimeoutMs}ms`);
|
|
135
142
|
state.lastStatusCode = response.statusCode;
|
|
136
143
|
outcome = classifyProbeStatus(response.statusCode);
|
|
@@ -145,8 +152,8 @@ export class ModelHealthChecker {
|
|
|
145
152
|
}
|
|
146
153
|
if (outcome === 'inconclusive') {
|
|
147
154
|
// The endpoint answered but the probe result proves nothing either way
|
|
148
|
-
// (
|
|
149
|
-
//
|
|
155
|
+
// (for example, 400 for an unsupported probe parameter). Leave failure
|
|
156
|
+
// counters and advertisement untouched.
|
|
150
157
|
debugLog(`[ModelHealth] ${provider.name}/${service}: inconclusive (${state.lastDetail})`);
|
|
151
158
|
return;
|
|
152
159
|
}
|
|
@@ -226,6 +233,9 @@ export class ModelHealthChecker {
|
|
|
226
233
|
function resolveProbeProtocol(provider, service) {
|
|
227
234
|
return provider.serviceApiProtocols?.[service]?.[0] ?? 'openai-chat-completions';
|
|
228
235
|
}
|
|
236
|
+
export function supportsHealthProbe(protocol) {
|
|
237
|
+
return protocol !== 'openai-images';
|
|
238
|
+
}
|
|
229
239
|
/**
|
|
230
240
|
* Build the cheapest request that proves the upstream model responds: a
|
|
231
241
|
* single-token completion. Sent through `Provider.handleRequest`, so the
|
|
@@ -259,10 +269,11 @@ export function buildHealthProbeRequest(service, protocol) {
|
|
|
259
269
|
body = { model: service, prompt: 'ping', max_tokens: 1 };
|
|
260
270
|
break;
|
|
261
271
|
case 'openai-chat-completions':
|
|
262
|
-
default:
|
|
263
272
|
path = '/v1/chat/completions';
|
|
264
273
|
body = { model: service, max_tokens: 1, messages: [{ role: 'user', content: 'ping' }] };
|
|
265
274
|
break;
|
|
275
|
+
case 'openai-images':
|
|
276
|
+
throw new Error('Health probes are not supported for openai-images services');
|
|
266
277
|
}
|
|
267
278
|
return {
|
|
268
279
|
requestId: `health-${Math.random().toString(36).slice(2, 10)}-${Date.now().toString(36)}`,
|
|
@@ -276,18 +287,19 @@ export function buildHealthProbeRequest(service, protocol) {
|
|
|
276
287
|
* Classify a probe response status.
|
|
277
288
|
*
|
|
278
289
|
* - 2xx/3xx — the model answered: healthy.
|
|
279
|
-
* - 401/402/403/404 and 5xx — credentials broken, billing unavailable,
|
|
280
|
-
* gone, or upstream down: unhealthy. (The relay
|
|
281
|
-
* errors/timeouts to 502.)
|
|
282
|
-
* - Everything else (400, 422,
|
|
283
|
-
* itself was rejected (
|
|
290
|
+
* - 401/402/403/404, 429, and 5xx — credentials broken, billing unavailable,
|
|
291
|
+
* rate or usage limited, model gone, or upstream down: unhealthy. (The relay
|
|
292
|
+
* collapses upstream network errors/timeouts to 502.)
|
|
293
|
+
* - Everything else (400, 422, ...) — the endpoint is alive but the probe
|
|
294
|
+
* itself was rejected (for example, an unsupported parameter): inconclusive,
|
|
284
295
|
* so a working model is never unadvertised over a probe quirk.
|
|
285
296
|
*/
|
|
286
297
|
export function classifyProbeStatus(statusCode) {
|
|
287
298
|
if (statusCode >= 200 && statusCode < 400)
|
|
288
299
|
return 'healthy';
|
|
289
|
-
if (statusCode === 401 || statusCode === 402 || statusCode === 403 || statusCode === 404)
|
|
300
|
+
if (statusCode === 401 || statusCode === 402 || statusCode === 403 || statusCode === 404 || statusCode === 429) {
|
|
290
301
|
return 'unhealthy';
|
|
302
|
+
}
|
|
291
303
|
if (statusCode >= 500)
|
|
292
304
|
return 'unhealthy';
|
|
293
305
|
return 'inconclusive';
|