@harrylabsj/kiwi 0.11.0 → 0.12.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/README.md +4 -1
- package/contracts/kiwi-contracts.lock.json +1 -1
- package/contracts/manifest.json +2 -2
- package/contracts/runtime-binding/0.1.2/document.schema.json +3 -1
- package/dist/a2a/node.d.ts +2 -0
- package/dist/a2a/node.js +92 -13
- package/dist/a2a/node.js.map +1 -1
- package/dist/a2a/server/merchant-handler.js +31 -17
- package/dist/a2a/server/merchant-handler.js.map +1 -1
- package/dist/a2a/server/pipeline.js +1 -0
- package/dist/a2a/server/pipeline.js.map +1 -1
- package/dist/a2a/server/types.d.ts +1 -0
- package/dist/agent/buyer/buyer-tools.d.ts +2 -2
- package/dist/agent/buyer/buyer-tools.js.map +1 -1
- package/dist/agent/chat-tools.d.ts +2 -11
- package/dist/agent/chat-tools.js.map +1 -1
- package/dist/agent/fake-chat-model.d.ts +3 -3
- package/dist/agent/fake-chat-model.js +3 -5
- package/dist/agent/fake-chat-model.js.map +1 -1
- package/dist/agent/kernel-builder.js +4 -4
- package/dist/agent/kernel-builder.js.map +1 -1
- package/dist/agent/kernel.d.ts +15 -5
- package/dist/agent/kernel.js +143 -67
- package/dist/agent/kernel.js.map +1 -1
- package/dist/agent/kiwi-tool.d.ts +33 -0
- package/dist/agent/kiwi-tool.js +17 -0
- package/dist/agent/kiwi-tool.js.map +1 -0
- package/dist/agent/merchant/merchant-tools.d.ts +2 -17
- package/dist/agent/merchant/merchant-tools.js.map +1 -1
- package/dist/agent/negotiation-chat.d.ts +3 -2
- package/dist/agent/negotiation-chat.js.map +1 -1
- package/dist/agent/session.d.ts +15 -3
- package/dist/agent/session.js +114 -122
- package/dist/agent/session.js.map +1 -1
- package/dist/agent/skills/tools.d.ts +2 -2
- package/dist/agent/skills/tools.js.map +1 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +239 -32
- package/dist/cli.js.map +1 -1
- package/dist/cloud/binding/enrollment-challenge.d.ts +37 -0
- package/dist/cloud/binding/enrollment-challenge.js +153 -0
- package/dist/cloud/binding/enrollment-challenge.js.map +1 -0
- package/dist/cloud/binding/enrollment-heartbeat.d.ts +26 -0
- package/dist/cloud/binding/enrollment-heartbeat.js +146 -0
- package/dist/cloud/binding/enrollment-heartbeat.js.map +1 -0
- package/dist/cloud/binding/enrollment-key-recovery.d.ts +27 -0
- package/dist/cloud/binding/enrollment-key-recovery.js +127 -0
- package/dist/cloud/binding/enrollment-key-recovery.js.map +1 -0
- package/dist/cloud/binding/runtime-challenge.d.ts +1 -1
- package/dist/cloud/binding/runtime-challenge.js +8 -1
- package/dist/cloud/binding/runtime-challenge.js.map +1 -1
- package/dist/cloud/bootstrap.js +241 -17
- package/dist/cloud/bootstrap.js.map +1 -1
- package/dist/cloud/catalog-client.d.ts +305 -0
- package/dist/cloud/catalog-client.js +962 -0
- package/dist/cloud/catalog-client.js.map +1 -0
- package/dist/cloud/config.d.ts +12 -0
- package/dist/cloud/config.js +45 -0
- package/dist/cloud/config.js.map +1 -1
- package/dist/cloud/http-router.d.ts +2 -0
- package/dist/cloud/http-router.js +8 -0
- package/dist/cloud/http-router.js.map +1 -1
- package/dist/cloud/listing-publisher.d.ts +45 -0
- package/dist/cloud/listing-publisher.js +244 -0
- package/dist/cloud/listing-publisher.js.map +1 -0
- package/dist/cloud/merchant-connect.d.ts +47 -0
- package/dist/cloud/merchant-connect.js +331 -0
- package/dist/cloud/merchant-connect.js.map +1 -0
- package/dist/cloud/merchant-identity.d.ts +14 -0
- package/dist/cloud/merchant-identity.js +76 -0
- package/dist/cloud/merchant-identity.js.map +1 -0
- package/dist/cloud/onboarding/catalog-pipeline.d.ts +135 -0
- package/dist/cloud/onboarding/catalog-pipeline.js +454 -0
- package/dist/cloud/onboarding/catalog-pipeline.js.map +1 -0
- package/dist/cloud/onboarding/steps.js +2 -2
- package/dist/cloud/onboarding/steps.js.map +1 -1
- package/dist/cloud/product-import-tabular.d.ts +100 -0
- package/dist/cloud/product-import-tabular.js +1073 -0
- package/dist/cloud/product-import-tabular.js.map +1 -0
- package/dist/cloud/product-source.d.ts +8 -1
- package/dist/cloud/product-source.js +63 -13
- package/dist/cloud/product-source.js.map +1 -1
- package/dist/config/profile.d.ts +4 -0
- package/dist/config/profile.js +14 -0
- package/dist/config/profile.js.map +1 -1
- package/dist/discovery/catalog-source/cloud-card.d.ts +1 -1
- package/dist/discovery/catalog-source/cloud-card.js +7 -1
- package/dist/discovery/catalog-source/cloud-card.js.map +1 -1
- package/dist/http/merchant-management/api.d.ts +17 -0
- package/dist/http/merchant-management/api.js +244 -7
- package/dist/http/merchant-management/api.js.map +1 -1
- package/dist/http/merchant-management/page.js +313 -18
- package/dist/http/merchant-management/page.js.map +1 -1
- package/dist/mcp/merchant-runtime-assembly.js +4 -1
- package/dist/mcp/merchant-runtime-assembly.js.map +1 -1
- package/dist/mcp/merchant-server.d.ts +2 -0
- package/dist/mcp/merchant-server.js +15 -0
- package/dist/mcp/merchant-server.js.map +1 -1
- package/dist/merchant/negotiation-observer.d.ts +92 -0
- package/dist/merchant/negotiation-observer.js +278 -0
- package/dist/merchant/negotiation-observer.js.map +1 -0
- package/dist/merchant/operations-report.d.ts +85 -0
- package/dist/merchant/operations-report.js +227 -0
- package/dist/merchant/operations-report.js.map +1 -0
- package/dist/merchant/stats-store.d.ts +5 -0
- package/dist/merchant/stats-store.js +18 -0
- package/dist/merchant/stats-store.js.map +1 -1
- package/dist/merchant-gateway/catalog-publications.d.ts +28 -0
- package/dist/merchant-gateway/catalog-publications.js +69 -0
- package/dist/merchant-gateway/catalog-publications.js.map +1 -1
- package/dist/merchant-gateway/catalog-tools.js +20 -0
- package/dist/merchant-gateway/catalog-tools.js.map +1 -1
- package/dist/negotiation/lease/store.js +21 -2
- package/dist/negotiation/lease/store.js.map +1 -1
- package/dist/product-cli.d.ts +2 -2
- package/dist/product-cli.js +24 -9
- package/dist/product-cli.js.map +1 -1
- package/dist/product-init.d.ts +4 -1
- package/dist/product-init.js +39 -11
- package/dist/product-init.js.map +1 -1
- package/dist/product-publish.d.ts +8 -2
- package/dist/product-publish.js +222 -142
- package/dist/product-publish.js.map +1 -1
- package/dist/runtime/fake-model.js +9 -3
- package/dist/runtime/fake-model.js.map +1 -1
- package/package.json +7 -4
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 harrylabsj
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import type { AgentCard } from "../discovery/agent-card/types.js";
|
|
17
|
+
import { type JwsSigningIdentity } from "../trust/identity/jws.js";
|
|
18
|
+
import type { JsonWebKey } from "../trust/identity/jwk.js";
|
|
19
|
+
export type CatalogClientErrorCode =
|
|
20
|
+
/** 调用方输入非法(缺 runtime_origin、非 https、代次非法等)。 */
|
|
21
|
+
"INVALID_INPUT"
|
|
22
|
+
/** 本地产物不符合 0.1.2 契约 schema(发出前自检)。 */
|
|
23
|
+
| "SCHEMA_VIOLATION"
|
|
24
|
+
/** 名片的 url / supportedInterfaces 不在自身 runtime origin 内。 */
|
|
25
|
+
| "CARD_ORIGIN_VIOLATION"
|
|
26
|
+
/** 名片没有任何一个接口等于绑定的 a2a_endpoint。 */
|
|
27
|
+
| "CARD_ENDPOINT_NOT_BOUND"
|
|
28
|
+
/** 目录不可达(网络失败/超时/5xx/429)——可重试,标 pending_publication。 */
|
|
29
|
+
| "CATALOG_UNREACHABLE"
|
|
30
|
+
/** 4xx(非 409/404):请求被拒绝,重试不会变好。 */
|
|
31
|
+
| "REQUEST_REJECTED"
|
|
32
|
+
/** CAS 冲突(重读 + 重试一次后仍 409)——停下来报人工。 */
|
|
33
|
+
| "CONFLICT"
|
|
34
|
+
/** 响应体非法(非 JSON / 结构不符 / 重定向)。 */
|
|
35
|
+
| "RESPONSE_INVALID"
|
|
36
|
+
/**
|
|
37
|
+
* 绑定存在但公开文档暂不可读(catalog 在"无活动名片/绑定过期/已撤回"时
|
|
38
|
+
* 对公开读返回 403,不签发声明)。首绑确认后到首发布之间就是这个窗口。
|
|
39
|
+
*/
|
|
40
|
+
| "BINDING_UNREADABLE"
|
|
41
|
+
/** 等待门户确认超时(不是失败:商家还没在门户确认)。 */
|
|
42
|
+
| "CONFIRMATION_TIMEOUT";
|
|
43
|
+
export declare class CatalogClientError extends Error {
|
|
44
|
+
readonly code: CatalogClientErrorCode;
|
|
45
|
+
readonly status?: number;
|
|
46
|
+
readonly remoteCode?: string;
|
|
47
|
+
constructor(code: CatalogClientErrorCode, message: string, status?: number, remoteCode?: string);
|
|
48
|
+
}
|
|
49
|
+
/** Runtime 自持签名身份(私钥不出进程;公钥 JWK 由私钥导出,杜绝不一致)。 */
|
|
50
|
+
export interface RuntimeSigningIdentity {
|
|
51
|
+
signingIdentity: JwsSigningIdentity;
|
|
52
|
+
/** 绑定声明里的 key_id(与 JWS 头 kid 同值)。 */
|
|
53
|
+
keyId: string;
|
|
54
|
+
}
|
|
55
|
+
export interface CatalogClientOptions {
|
|
56
|
+
/** Catalog 控制面根 URL(https;末尾斜杠容忍并剥离)。 */
|
|
57
|
+
baseUrl: string;
|
|
58
|
+
fetchImpl?: typeof fetch;
|
|
59
|
+
timeoutMs?: number;
|
|
60
|
+
/** nonce 工厂(测试注入;缺省每次随机 24 字节 base64url,绝不复用)。 */
|
|
61
|
+
nonceFactory?: () => string;
|
|
62
|
+
/** 签名负载 `issued_at` 的时钟(测试注入;服务端要求 300s 时钟偏差窗内)。 */
|
|
63
|
+
now?: () => Date;
|
|
64
|
+
}
|
|
65
|
+
export interface DeviceEnrollmentInput {
|
|
66
|
+
runtimeOrigin: string;
|
|
67
|
+
a2aEndpoint: string;
|
|
68
|
+
generation: number;
|
|
69
|
+
serviceEpoch: number;
|
|
70
|
+
publicPreview: Record<string, unknown>;
|
|
71
|
+
publicProfileRevision: number;
|
|
72
|
+
}
|
|
73
|
+
export interface DeviceEnrollmentSession {
|
|
74
|
+
enrollmentId: string;
|
|
75
|
+
deviceCode: string;
|
|
76
|
+
userCode: string;
|
|
77
|
+
verificationUri: string;
|
|
78
|
+
expiresAt: string;
|
|
79
|
+
intervalSeconds: number;
|
|
80
|
+
keyThumbprint: string;
|
|
81
|
+
}
|
|
82
|
+
export type DeviceEnrollmentPoll = {
|
|
83
|
+
status: "authorization_pending" | "slow_down";
|
|
84
|
+
intervalSeconds: number;
|
|
85
|
+
} | {
|
|
86
|
+
status: "authorized";
|
|
87
|
+
enrollmentId: string;
|
|
88
|
+
grant: string;
|
|
89
|
+
catalogAgentId: string;
|
|
90
|
+
merchantId: string;
|
|
91
|
+
runtimeOrigin: string;
|
|
92
|
+
a2aEndpoint: string;
|
|
93
|
+
expiresAt: string;
|
|
94
|
+
authorizationEpoch: number;
|
|
95
|
+
approvedCardDigest: string;
|
|
96
|
+
scopes: string[];
|
|
97
|
+
};
|
|
98
|
+
export interface GrantBindingResult {
|
|
99
|
+
bindingId: string;
|
|
100
|
+
bindingVersion: number;
|
|
101
|
+
keyThumbprint: string;
|
|
102
|
+
activeCardRevision: number | null;
|
|
103
|
+
bindingClaim: Record<string, unknown>;
|
|
104
|
+
}
|
|
105
|
+
export interface SignedListingPublicationInput {
|
|
106
|
+
catalogAgentId: string;
|
|
107
|
+
merchantId: string;
|
|
108
|
+
bindingId: string;
|
|
109
|
+
idempotencyKey: string;
|
|
110
|
+
listingDigest: string;
|
|
111
|
+
listing: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
export interface SignedListingPublicationResult {
|
|
114
|
+
listingId: string;
|
|
115
|
+
idempotent: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface SignedListingContext {
|
|
118
|
+
catalogAgentId: string;
|
|
119
|
+
merchantId: string;
|
|
120
|
+
bindingId: string;
|
|
121
|
+
keyId: string;
|
|
122
|
+
}
|
|
123
|
+
export interface SignedListingPage {
|
|
124
|
+
results: Array<Record<string, unknown>>;
|
|
125
|
+
nextCursor?: string;
|
|
126
|
+
}
|
|
127
|
+
export interface RequestBindingInput {
|
|
128
|
+
/** catalog_agent_id(cagt_…,路由段)。 */
|
|
129
|
+
agentId: string;
|
|
130
|
+
/** 运行时公开 origin——**只取自 KIWI_CLOUD_PUBLIC_ORIGIN**。 */
|
|
131
|
+
runtimeOrigin: string;
|
|
132
|
+
/** A2A 端点(必须在 runtimeOrigin 域内)。 */
|
|
133
|
+
a2aEndpoint: string;
|
|
134
|
+
generation: number;
|
|
135
|
+
serviceEpoch: number;
|
|
136
|
+
/** 可选:受控注册闸门(门户确认流程下由服务端另行处理,Runtime 默认不带)。 */
|
|
137
|
+
adminToken?: string;
|
|
138
|
+
/** 可选:绑定到期时间(ISO 8601)。 */
|
|
139
|
+
expiresAt?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface RequestBindingResult {
|
|
142
|
+
/** 服务端回执里的 binding_request_id(未返回则 null)。 */
|
|
143
|
+
bindingRequestId: string | null;
|
|
144
|
+
keyThumbprint: string;
|
|
145
|
+
/** 本次请求的 nonce(审计/对账用;下次请求必然不同)。 */
|
|
146
|
+
nonce: string;
|
|
147
|
+
}
|
|
148
|
+
/** 公开读到的绑定文档中,与 Runtime 自身核对所需的字段。 */
|
|
149
|
+
export interface PublicBinding {
|
|
150
|
+
bindingId: string;
|
|
151
|
+
bindingVersion: number;
|
|
152
|
+
merchantId: string;
|
|
153
|
+
runtimeOrigin: string;
|
|
154
|
+
a2aEndpoint: string;
|
|
155
|
+
keyId: string;
|
|
156
|
+
keyThumbprint: string;
|
|
157
|
+
expiresAt: string;
|
|
158
|
+
/** 当前活动名片 revision(CAS 的 expected_revision 来源;未发布过为 null)。 */
|
|
159
|
+
cardRevision: number | null;
|
|
160
|
+
cardEtag: string | null;
|
|
161
|
+
publicationState: string;
|
|
162
|
+
}
|
|
163
|
+
export interface AwaitBindingInput {
|
|
164
|
+
agentId: string;
|
|
165
|
+
/** 只取自 KIWI_CLOUD_PUBLIC_ORIGIN;与公开文档逐字比对。 */
|
|
166
|
+
runtimeOrigin: string;
|
|
167
|
+
keyThumbprint: string;
|
|
168
|
+
/** 已知 binding_id 时强制比对(轮换场景);缺省接受首个匹配的绑定。 */
|
|
169
|
+
bindingId?: string;
|
|
170
|
+
timeoutMs?: number;
|
|
171
|
+
pollIntervalMs?: number;
|
|
172
|
+
/** 测试注入。 */
|
|
173
|
+
sleep?: (ms: number) => Promise<void>;
|
|
174
|
+
now?: () => Date;
|
|
175
|
+
}
|
|
176
|
+
export interface PublishCardInput {
|
|
177
|
+
agentId: string;
|
|
178
|
+
bindingId: string;
|
|
179
|
+
generation: number;
|
|
180
|
+
/** CAS 前置条件:当前活动 revision(首发布为 0)。 */
|
|
181
|
+
expectedRevision: number;
|
|
182
|
+
agentCard: AgentCard;
|
|
183
|
+
/** 绑定的 a2a_endpoint:名片至少一个接口必须等于它(提前自查)。 */
|
|
184
|
+
a2aEndpoint: string;
|
|
185
|
+
/** 只取自 KIWI_CLOUD_PUBLIC_ORIGIN;名片全部 URL 必须在它域内。 */
|
|
186
|
+
runtimeOrigin: string;
|
|
187
|
+
/** 409 时重读公开绑定后重试一次(缺省 true)。 */
|
|
188
|
+
casRetry?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface PublishCardResult {
|
|
191
|
+
/** 服务端回执里的 revision(未返回则 null)。 */
|
|
192
|
+
revision: number | null;
|
|
193
|
+
cardDigest: string;
|
|
194
|
+
nonce: string;
|
|
195
|
+
}
|
|
196
|
+
export interface ActivateCardInput {
|
|
197
|
+
agentId: string;
|
|
198
|
+
/** 发布由当前活动绑定背书(catalog 验签要求签名覆盖它)。 */
|
|
199
|
+
bindingId: string;
|
|
200
|
+
/** 要激活的名片 revision(publish 回执的 card_revision;顶层必填,缺了 400)。 */
|
|
201
|
+
cardRevision: number;
|
|
202
|
+
/** CAS:必须等于当前活动 revision。 */
|
|
203
|
+
expectedRevision: number;
|
|
204
|
+
/** 409 时重读公开绑定后重试一次(缺省 true)。 */
|
|
205
|
+
casRetry?: boolean;
|
|
206
|
+
}
|
|
207
|
+
export interface ActivateCardResult {
|
|
208
|
+
revision: number | null;
|
|
209
|
+
nonce: string;
|
|
210
|
+
}
|
|
211
|
+
/** 规范化 origin(去掉末尾斜杠,逐字比对前的统一口径)。 */
|
|
212
|
+
export declare function normalizeOrigin(value: string): string;
|
|
213
|
+
export declare class CatalogClient {
|
|
214
|
+
private readonly baseUrl;
|
|
215
|
+
private readonly fetchImpl;
|
|
216
|
+
private readonly timeoutMs;
|
|
217
|
+
private readonly nonceFactory;
|
|
218
|
+
private readonly now;
|
|
219
|
+
constructor(options: CatalogClientOptions);
|
|
220
|
+
/** Catalog origin is pinned by constructor configuration and remains the only control-plane trust anchor. */
|
|
221
|
+
get catalogOrigin(): string;
|
|
222
|
+
/** 创建独立 Runtime 设备授权会话;仅绑定本机持久密钥和锁定的公开预览。 */
|
|
223
|
+
createDeviceEnrollment(input: DeviceEnrollmentInput, identity: RuntimeSigningIdentity): Promise<DeviceEnrollmentSession>;
|
|
224
|
+
/** 以匹配设备私钥轮询;user_code 不是取回 grant 的凭据。 */
|
|
225
|
+
pollDeviceEnrollment(deviceCode: string, identity: RuntimeSigningIdentity): Promise<DeviceEnrollmentPoll>;
|
|
226
|
+
/** 一次性许可换取活动绑定;Catalog 的挑战和签发结果是绑定权威。 */
|
|
227
|
+
bindEnrollment(input: {
|
|
228
|
+
enrollmentId: string;
|
|
229
|
+
grant: string;
|
|
230
|
+
catalogAgentId: string;
|
|
231
|
+
runtimeOrigin: string;
|
|
232
|
+
a2aEndpoint: string;
|
|
233
|
+
generation: number;
|
|
234
|
+
serviceEpoch: number;
|
|
235
|
+
authorizationEpoch: number;
|
|
236
|
+
merchantId: string;
|
|
237
|
+
}, identity: RuntimeSigningIdentity): Promise<GrantBindingResult>;
|
|
238
|
+
/** Catalog origin 固定来自部署配置;JWKS仅经其标准HTTPS/TLS读取后用于验声明。 */
|
|
239
|
+
/** Publish one already-approved public listing with the active Runtime binding key. */
|
|
240
|
+
publishSignedListing(input: SignedListingPublicationInput, identity: RuntimeSigningIdentity): Promise<SignedListingPublicationResult>;
|
|
241
|
+
/** Owner-token-free self-list, authenticated by the current binding JWS. */
|
|
242
|
+
listSignedListings(context: SignedListingContext, identity: RuntimeSigningIdentity, input: {
|
|
243
|
+
limit: number;
|
|
244
|
+
cursor?: string;
|
|
245
|
+
freshnessState?: string;
|
|
246
|
+
}): Promise<SignedListingPage>;
|
|
247
|
+
/** Withdraw one disappeared product projection with the current binding. */
|
|
248
|
+
withdrawSignedListing(context: SignedListingContext, identity: RuntimeSigningIdentity, input: {
|
|
249
|
+
listingId: string;
|
|
250
|
+
idempotencyKey: string;
|
|
251
|
+
}): Promise<void>;
|
|
252
|
+
private verifyCatalogBindingClaim;
|
|
253
|
+
/**
|
|
254
|
+
* 匿名读公开绑定文档。404(未确认/不存在)返回 null;其它失败抛类型化错误。
|
|
255
|
+
*
|
|
256
|
+
* 这是**公开读**:名片与绑定是"任何人都能核验"的公开事实,一旦需要凭据,
|
|
257
|
+
* 验证就退化成"相信持有凭据的那个人"(与 cloud-card.ts 同一纪律)。
|
|
258
|
+
*
|
|
259
|
+
* catalog 现状(kiwi-catalog `binding_claims.py::read_runtime_binding`):
|
|
260
|
+
* 绑定已确认但**没有活动名片**时(首绑确认后 → 首发布之间的窗口),公开读
|
|
261
|
+
* 返回 403 而不是文档——此时抛 `BINDING_UNREADABLE`,调用方据此区分
|
|
262
|
+
* "还没确认"(404 → null)与"已确认但文档暂不可读"(403)。
|
|
263
|
+
*/
|
|
264
|
+
fetchPublicBinding(agentId: string): Promise<PublicBinding | null>;
|
|
265
|
+
requestBinding(input: RequestBindingInput, identity: RuntimeSigningIdentity): Promise<RequestBindingResult>;
|
|
266
|
+
/**
|
|
267
|
+
* 轮询公开读地址,直到出现与本实例**逐字匹配**的绑定(runtime_origin +
|
|
268
|
+
* key_thumbprint,给了 binding_id 还要逐字匹配 binding_id)。
|
|
269
|
+
*
|
|
270
|
+
* 超时不是失败:商家可能还没看到门户上的待确认卡片。抛 `CONFIRMATION_TIMEOUT`,
|
|
271
|
+
* 由调用方提示商家到门户「我的名片」页确认后再继续(断点续办)。
|
|
272
|
+
*/
|
|
273
|
+
awaitBindingConfirmation(input: AwaitBindingInput): Promise<PublicBinding>;
|
|
274
|
+
publishCard(input: PublishCardInput, identity: RuntimeSigningIdentity): Promise<PublishCardResult>;
|
|
275
|
+
/**
|
|
276
|
+
* 激活指定名片 revision(kiwi-catalog `activate_card_publication` 的实际契约):
|
|
277
|
+
* body 是**平铺**的 `{agent_id, binding_id, card_revision, expected_revision}`
|
|
278
|
+
* (`card_revision`/`expected_revision` 都是顶层必填整数,缺 card_revision 直接 400);
|
|
279
|
+
* JWS 覆盖 `agent_id/binding_id/card_revision/expected_revision` + `issued_at` + nonce。
|
|
280
|
+
*/
|
|
281
|
+
activateCard(input: ActivateCardInput, identity: RuntimeSigningIdentity): Promise<ActivateCardResult>;
|
|
282
|
+
/**
|
|
283
|
+
* CAS 冲突处理(§4.6):409 → 匿名重读公开绑定文档信封的 `card_revision`
|
|
284
|
+
* (契约 `document.schema.json` 的公开元数据,= catalog `card_publications.
|
|
285
|
+
* active_revision`;不在 claims 里)→ 用**新 nonce** 重试一次;仍冲突抛
|
|
286
|
+
* CONFLICT 停下来报人工。重读到的 revision 与手头相同说明冲突不是"版本旧了",
|
|
287
|
+
* 重试无意义,直接报人工。文档不可读(BINDING_UNREADABLE,首发布前窗口)时
|
|
288
|
+
* 无从取新版本,同样直接报人工。
|
|
289
|
+
*/
|
|
290
|
+
private withCasRetry;
|
|
291
|
+
private requireAgentId;
|
|
292
|
+
/**
|
|
293
|
+
* 统一出站:redirect: manual、超时覆盖 body 读取、响应体上限(与
|
|
294
|
+
* cloud-card.ts 同口径)。错误映射:网络/超时/5xx/429 → CATALOG_UNREACHABLE;
|
|
295
|
+
* 409 → CONFLICT;404 原样上报(匿名读用);其余 4xx → REQUEST_REJECTED。
|
|
296
|
+
*/
|
|
297
|
+
private request;
|
|
298
|
+
}
|
|
299
|
+
/** 由自持私钥导出公钥 JWK 与指纹(私钥不出进程;公钥随绑定请求公开)。 */
|
|
300
|
+
export declare function runtimePublicKey(identity: RuntimeSigningIdentity): {
|
|
301
|
+
keyJwk: JsonWebKey;
|
|
302
|
+
keyThumbprint: string;
|
|
303
|
+
};
|
|
304
|
+
/** 名片域内自查(§4.6:发出前客户端先拦,服务端也会拦)。 */
|
|
305
|
+
export declare function assertCardWithinOrigin(card: AgentCard, runtimeOrigin: string, a2aEndpoint: string): void;
|