@agentunion/fastaun 0.5.18 → 0.5.20
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/CHANGELOG.md +172 -79
- package/_packed_docs/CHANGELOG.md +172 -79
- package/_packed_docs/INDEX.md +244 -116
- package/_packed_docs/KITE_DOCS_GUIDE.md +98 -69
- package/_packed_docs/agent.md/SCHEMA.md +245 -205
- package/_packed_docs/agent.md//350/277/234/347/250/213agent.md/347/274/223/345/255/230/344/270/216etag/351/200/217/344/274/240/346/226/271/346/241/210.md +11 -11
- package/_packed_docs/aun/345/210/206/345/270/203/345/274/217/346/265/213/350/257/225/350/277/220/350/241/214/346/214/207/345/215/227.md +42 -15
- package/_packed_docs/aun/346/265/213/350/257/225/350/277/220/350/241/214/346/214/207/345/215/227.md +4 -4
- package/_packed_docs/protocol/01-/350/272/253/344/273/275/344/270/216/345/207/255/350/257/201/345/215/217/350/256/256-auth.md +45 -134
- package/_packed_docs/protocol/06-/346/234/215/345/212/241/345/215/217/350/256/256.md +1072 -1072
- package/_packed_docs/protocol/07-/351/224/231/350/257/257/347/240/201/344/270/216/347/212/266/346/200/201/346/234/272.md +5 -20
- package/_packed_docs/protocol/10-Group-/345/255/220/345/215/217/350/256/256.md +687 -668
- package/_packed_docs/protocol/11-Storage-/345/255/220/345/215/217/350/256/256.md +19 -28
- package/_packed_docs/protocol/Ownership/345/215/217/350/256/256/345/256/232/344/271/211.md +443 -0
- package/_packed_docs/protocol/Ownership/345/215/217/350/256/256/345/256/232/344/271/2112.0.md +161 -0
- package/_packed_docs/protocol/Ownership/345/215/217/350/256/256/345/256/232/344/271/2112.1.md +658 -0
- package/_packed_docs/protocol/Ownership/345/215/217/350/256/256/345/256/232/344/271/2113.0.md +233 -0
- package/_packed_docs/protocol/agent.md/SCHEMA.md +4 -0
- package/_packed_docs/sdk/03-/346/240/270/345/277/203/346/246/202/345/277/265.md +1 -1
- package/_packed_docs/sdk/04-/350/277/236/346/216/245/344/270/216/350/256/244/350/257/201.md +68 -61
- package/_packed_docs/sdk/05-E2EE/345/212/240/345/257/206/351/200/232/344/277/241.md +1 -1
- package/_packed_docs/sdk/06-API/346/211/213/345/206/214.md +279 -285
- package/_packed_docs/sdk/08-/346/234/200/344/275/263/345/256/236/350/267/265.md +3 -3
- package/_packed_docs/sdk/09-group-rpc-manual.md +271 -235
- package/_packed_docs/sdk/09-message-rpc-manual.md +47 -6
- package/_packed_docs/sdk/09-storage-rpc-manual.md +70 -68
- package/_packed_docs/sdk/AUN_DOCS_GUIDE.md +63 -34
- package/_packed_docs/sdk/INDEX.md +105 -34
- package/_packed_docs/sdk/Ownership-SDK/345/256/236/347/216/260/346/214/207/345/215/227.md +169 -0
- package/_packed_docs/sdk/Ownership-SDK/347/274/226/346/216/222/346/214/207/345/215/227.md +349 -0
- package/_packed_docs/sdk/Ownership-SDK/347/274/226/346/216/222/346/214/207/345/215/2272.1.md +922 -0
- package/_packed_docs/sdk/Ownership-SDK/351/233/206/346/210/220/346/214/207/345/215/227.md +270 -0
- package/_packed_docs/sdk/Ownership2.1-SDK/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +300 -0
- package/_packed_docs/sdk/Ownership2.1-SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +382 -0
- package/_packed_docs/sdk/Ownership2.1-TDD/345/210/206/351/230/266/346/256/265/345/256/236/346/226/275/350/256/241/345/210/222.md +708 -0
- package/_packed_docs/sdk/Ownership2.1/350/257/246/347/273/206/350/256/276/350/256/241.md +476 -0
- package/_packed_docs/sdk/Ownership/347/256/241/347/220/206/344/270/223/351/242/230.md +559 -0
- package/_packed_docs/sdk/ProtectedHeaders/347/224/250/346/263/225/344/270/223/351/242/230.md +299 -0
- package/_packed_docs/sdk//345/207/255/350/257/201/344/270/216/347/273/204/347/273/207/346/234/215/345/212/241SDK/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +173 -0
- package/_packed_docs/sdk//345/207/255/350/257/201/344/270/216/347/273/204/347/273/207/346/234/215/345/212/241SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +211 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273SDK/345/256/236/347/216/260/347/247/273/346/244/215/346/214/207/345/215/227.md +331 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273SDK/351/233/206/346/210/220/346/214/207/345/215/227.md +207 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273/344/273/243/347/240/201/345/256/241/346/237/245/346/212/245/345/221/212.md +252 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273/345/256/236/346/226/275/350/256/241/345/210/222.md +156 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273/346/226/271/346/241/210.md +273 -0
- package/_packed_docs//350/267/250/350/256/276/345/244/207/345/267/262/350/257/273/346/234/252/350/257/273/350/257/246/347/273/206/350/256/276/350/256/241.md +211 -0
- package/dist/agent-md-schema.d.ts +15 -1
- package/dist/agent-md-schema.js +87 -24
- package/dist/agent-md-schema.js.map +1 -1
- package/dist/agent-md.d.ts +54 -2
- package/dist/agent-md.js +637 -53
- package/dist/agent-md.js.map +1 -1
- package/dist/aid-store.d.ts +38 -59
- package/dist/aid-store.js +300 -265
- package/dist/aid-store.js.map +1 -1
- package/dist/aid.js +30 -11
- package/dist/aid.js.map +1 -1
- package/dist/auth.d.ts +6 -1
- package/dist/auth.js +500 -15
- package/dist/auth.js.map +1 -1
- package/dist/cert-utils.d.ts +44 -2
- package/dist/cert-utils.js +149 -49
- package/dist/cert-utils.js.map +1 -1
- package/dist/client/delivery.d.ts +11 -1
- package/dist/client/delivery.js +321 -62
- package/dist/client/delivery.js.map +1 -1
- package/dist/client/rpc-pipeline.d.ts +1 -0
- package/dist/client/rpc-pipeline.js +142 -82
- package/dist/client/rpc-pipeline.js.map +1 -1
- package/dist/client/v2-e2ee.d.ts +1 -0
- package/dist/client/v2-e2ee.js +166 -96
- package/dist/client/v2-e2ee.js.map +1 -1
- package/dist/client.d.ts +84 -1
- package/dist/client.js +780 -30
- package/dist/client.js.map +1 -1
- package/dist/errors.js +4 -3
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +9 -3
- package/dist/events.js +69 -11
- package/dist/events.js.map +1 -1
- package/dist/facades.d.ts +83 -3
- package/dist/facades.js +100 -6
- package/dist/facades.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/keystore/aid-db.d.ts +5 -0
- package/dist/keystore/aid-db.js +57 -0
- package/dist/keystore/aid-db.js.map +1 -1
- package/dist/keystore/index.d.ts +8 -0
- package/dist/keystore/local-identity-store.js +10 -3
- package/dist/keystore/local-identity-store.js.map +1 -1
- package/dist/keystore/local-token-store.d.ts +6 -1
- package/dist/keystore/local-token-store.js +24 -1
- package/dist/keystore/local-token-store.js.map +1 -1
- package/dist/org-protocol.d.ts +98 -0
- package/dist/org-protocol.js +1753 -0
- package/dist/org-protocol.js.map +1 -0
- package/dist/ownership-proof.d.ts +82 -5
- package/dist/ownership-proof.js +327 -31
- package/dist/ownership-proof.js.map +1 -1
- package/dist/ownership-v21.d.ts +196 -0
- package/dist/ownership-v21.js +712 -0
- package/dist/ownership-v21.js.map +1 -0
- package/dist/ownership-workflow.d.ts +87 -0
- package/dist/ownership-workflow.js +1182 -0
- package/dist/ownership-workflow.js.map +1 -0
- package/dist/seq-tracker.d.ts +1 -0
- package/dist/seq-tracker.js +10 -1
- package/dist/seq-tracker.js.map +1 -1
- package/dist/tools/cross-sdk-agent.d.ts +90 -1
- package/dist/tools/cross-sdk-agent.js +441 -7
- package/dist/tools/cross-sdk-agent.js.map +1 -1
- package/dist/transport.d.ts +8 -0
- package/dist/transport.js +118 -4
- package/dist/transport.js.map +1 -1
- package/dist/v2/e2ee/decrypt.d.ts +1 -0
- package/dist/v2/e2ee/decrypt.js +9 -1
- package/dist/v2/e2ee/decrypt.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
import { AIDStore } from './aid-store.js';
|
|
14
14
|
import { type Subscription, type EventHandler } from './events.js';
|
|
15
15
|
import { CollabClient } from './collab/client.js';
|
|
16
|
-
import { GroupFacade, MailFacade, MessageFacade, StreamFacade } from './facades.js';
|
|
16
|
+
import { CredentialFacade, OrgFacade, GroupFacade, MailFacade, MessageFacade, StreamFacade } from './facades.js';
|
|
17
17
|
import { StorageVFS } from './storage/vfs.js';
|
|
18
18
|
import { type JsonObject, type JsonValue, type RpcParams, type RpcResult, ConnectionState } from './types.js';
|
|
19
19
|
import { AID } from './aid.js';
|
|
20
|
+
import { type OwnershipConsensusResult } from './ownership-v21.js';
|
|
21
|
+
import { type OwnershipTaskResult } from './ownership-workflow.js';
|
|
20
22
|
/**
|
|
21
23
|
* 递归排序键的 JSON 序列化(Canonical JSON for AUN)
|
|
22
24
|
* 等价于 Python json.dumps(sort_keys=True, separators=(",",":"), ensure_ascii=False)
|
|
@@ -60,6 +62,10 @@ export interface CreateGroupOptions {
|
|
|
60
62
|
export interface CompleteGroupTransferOptions {
|
|
61
63
|
aidStore?: AIDStore;
|
|
62
64
|
}
|
|
65
|
+
export interface OrgIdentityOptions {
|
|
66
|
+
aidStore?: AIDStore;
|
|
67
|
+
serviceAid?: string;
|
|
68
|
+
}
|
|
63
69
|
export declare class AUNClient {
|
|
64
70
|
/** 原始配置 */
|
|
65
71
|
readonly config: RpcParams;
|
|
@@ -73,6 +79,21 @@ export declare class AUNClient {
|
|
|
73
79
|
private _state;
|
|
74
80
|
/** 当前 AID 值对象(新 API) */
|
|
75
81
|
private _currentAid;
|
|
82
|
+
private _serviceEventIdentityVersion;
|
|
83
|
+
/** ownership 关系只在 SDK 内存中编排;服务端不保存状态机。 */
|
|
84
|
+
private _ownershipRecords;
|
|
85
|
+
private _ownershipType;
|
|
86
|
+
private _ownershipStorage;
|
|
87
|
+
private _ownershipFiles;
|
|
88
|
+
private _ownershipWorkflow;
|
|
89
|
+
private _getOwnershipStorage;
|
|
90
|
+
private _getOwnershipFiles;
|
|
91
|
+
private _getOwnershipWorkflow;
|
|
92
|
+
private _persistOwnershipRecords;
|
|
93
|
+
private _restoreOwnershipRecords;
|
|
94
|
+
private _resumeOwnershipAfterConnect;
|
|
95
|
+
private _resumeRegistrationIntent;
|
|
96
|
+
private _resumeOwnership;
|
|
76
97
|
/** 实例级 protected_headers */
|
|
77
98
|
private _instanceProtectedHeaders;
|
|
78
99
|
/** 重连退避时间戳(ms) */
|
|
@@ -95,6 +116,7 @@ export declare class AUNClient {
|
|
|
95
116
|
private _transport;
|
|
96
117
|
/** 认证流程 */
|
|
97
118
|
private _auth;
|
|
119
|
+
resolveCredentialService?: (cid: string) => string | null | undefined | Promise<string | null | undefined>;
|
|
98
120
|
/** 密钥存储 */
|
|
99
121
|
private _tokenStore;
|
|
100
122
|
/** 会话参数(重连用) */
|
|
@@ -147,6 +169,10 @@ export declare class AUNClient {
|
|
|
147
169
|
private _v2SenderIKPending;
|
|
148
170
|
/** sender IK 后台补齐任务去重。 */
|
|
149
171
|
private _v2SenderIKFetching;
|
|
172
|
+
private _readStateCache;
|
|
173
|
+
private _readStateQueries;
|
|
174
|
+
private _readStateIdentity;
|
|
175
|
+
private _readStateGeneration;
|
|
150
176
|
private _heartbeatTimer;
|
|
151
177
|
private _tokenRefreshTimer;
|
|
152
178
|
private _tokenRefreshFailures;
|
|
@@ -193,12 +219,16 @@ export declare class AUNClient {
|
|
|
193
219
|
private _mail?;
|
|
194
220
|
private _group?;
|
|
195
221
|
private _stream?;
|
|
222
|
+
private _credential?;
|
|
223
|
+
private _org?;
|
|
196
224
|
constructor(aid?: AID);
|
|
197
225
|
/** 当前 AID */
|
|
198
226
|
get aid(): string | null;
|
|
199
227
|
/** 返回后台刷新任务维护的最新 access token。 */
|
|
200
228
|
getAccessToken(): string | null;
|
|
201
229
|
/** AUN Storage VFS 入口 */
|
|
230
|
+
get credential(): CredentialFacade;
|
|
231
|
+
get org(): OrgFacade;
|
|
202
232
|
get storage(): StorageVFS;
|
|
203
233
|
/** AUN Collab 入口 */
|
|
204
234
|
get collab(): CollabClient;
|
|
@@ -210,6 +240,39 @@ export declare class AUNClient {
|
|
|
210
240
|
get stream(): StreamFacade;
|
|
211
241
|
/** 当前 AID 值对象 */
|
|
212
242
|
get currentAid(): AID | null;
|
|
243
|
+
private _ownershipKey;
|
|
244
|
+
getType(): string;
|
|
245
|
+
get_type(): string;
|
|
246
|
+
getOwner(): string | null;
|
|
247
|
+
get_owner(): string | null;
|
|
248
|
+
getOwnershipStatus(): Record<string, unknown>;
|
|
249
|
+
get_ownership_status(): Record<string, unknown>;
|
|
250
|
+
bindOwneraid(ownerAid: string): Promise<OwnershipTaskResult>;
|
|
251
|
+
bindSubaid(subAid: string): Promise<OwnershipTaskResult>;
|
|
252
|
+
releaseSubaid(subAid: string): Promise<OwnershipTaskResult>;
|
|
253
|
+
transferSubaid(subAid: string, newOwnerAid: string): Promise<OwnershipTaskResult>;
|
|
254
|
+
checkOwnershipConsensus(subAid?: string): Promise<OwnershipConsensusResult>;
|
|
255
|
+
bindAid(subjectAid: string, options?: {
|
|
256
|
+
subjectType?: string;
|
|
257
|
+
subject_type?: string;
|
|
258
|
+
extensions?: Record<string, unknown>;
|
|
259
|
+
requestId?: string;
|
|
260
|
+
request_id?: string;
|
|
261
|
+
}): Promise<RpcResult>;
|
|
262
|
+
bind_aid(subjectAid: string, options?: Parameters<AUNClient['bindAid']>[1]): Promise<RpcResult>;
|
|
263
|
+
bindOwner(ownerAid: string, options?: {
|
|
264
|
+
subjectType?: string;
|
|
265
|
+
subject_type?: string;
|
|
266
|
+
extensions?: Record<string, unknown>;
|
|
267
|
+
requestId?: string;
|
|
268
|
+
request_id?: string;
|
|
269
|
+
}): Promise<RpcResult>;
|
|
270
|
+
bind_owner(ownerAid: string, options?: Parameters<AUNClient['bindOwner']>[1]): Promise<RpcResult>;
|
|
271
|
+
releaseOwnership(subjectAid: string): Promise<RpcResult>;
|
|
272
|
+
release_ownership(subjectAid: string): Promise<RpcResult>;
|
|
273
|
+
acceptOwnershipRequest(operationId: string): Promise<OwnershipTaskResult>;
|
|
274
|
+
rejectOwnershipRequest(operationId: string, reason?: string): Promise<OwnershipTaskResult>;
|
|
275
|
+
private _handleOwnershipMessage;
|
|
213
276
|
get hasIdentity(): boolean;
|
|
214
277
|
get canSign(): boolean;
|
|
215
278
|
get canConnect(): boolean;
|
|
@@ -275,12 +338,23 @@ export declare class AUNClient {
|
|
|
275
338
|
call(method: string, params?: RpcParams): Promise<RpcResult>;
|
|
276
339
|
private _maybeHandleHalfOpenRpcFailure;
|
|
277
340
|
_recoverIdentityAdmission(err: unknown, _method?: string, params?: RpcParams): Promise<boolean>;
|
|
341
|
+
private _ensureInitialAgentMd;
|
|
278
342
|
private _checkIdentityAdmissionAfterConnect;
|
|
279
343
|
private _runGroupIdentityOperation;
|
|
344
|
+
createOrg(params?: RpcParams, options?: OrgIdentityOptions): Promise<RpcResult>;
|
|
345
|
+
private _resumeOrgIdentityAfterConnect;
|
|
346
|
+
completeOrgTransfer(params?: RpcParams, options?: OrgIdentityOptions): Promise<RpcResult>;
|
|
347
|
+
dissolveOrg(params?: RpcParams, options?: OrgIdentityOptions): Promise<RpcResult>;
|
|
348
|
+
private _uploadOrgAgentMd;
|
|
280
349
|
createGroup(params?: RpcParams, options?: CreateGroupOptions): Promise<RpcResult>;
|
|
281
350
|
private _inviteInitialGroupMembers;
|
|
282
351
|
private _groupAgentMdContent;
|
|
352
|
+
private _resumeGroupAgentMdUpload;
|
|
283
353
|
private _uploadGroupAgentMd;
|
|
354
|
+
private _localEntityCertificate;
|
|
355
|
+
private _freshEntityCertificate;
|
|
356
|
+
private _freshEntitySigner;
|
|
357
|
+
private _resolveEntityAgentMdOwner;
|
|
284
358
|
bindGroupAid(params?: RpcParams, options?: BindGroupAidOptions): Promise<RpcResult>;
|
|
285
359
|
startGroupTransfer(params?: RpcParams, options?: CompleteGroupTransferOptions): Promise<RpcResult>;
|
|
286
360
|
renewGroupAid(params?: RpcParams, options?: BindGroupAidOptions): Promise<RpcResult>;
|
|
@@ -296,6 +370,13 @@ export declare class AUNClient {
|
|
|
296
370
|
notify(method: string, params?: RpcParams, options?: NotifyOptions): Promise<void>;
|
|
297
371
|
/** 订阅事件 */
|
|
298
372
|
on(event: string, handler: EventHandler): Subscription;
|
|
373
|
+
private _readStateIsNewer;
|
|
374
|
+
private _ensureReadStateIdentity;
|
|
375
|
+
private _registerReadStateQuery;
|
|
376
|
+
private _readStateItems;
|
|
377
|
+
private _observeReadStateResult;
|
|
378
|
+
private _onRawReadChanged;
|
|
379
|
+
private _reconcileReadStates;
|
|
299
380
|
private _callRawV2Rpc;
|
|
300
381
|
/** P2-13: 取消订阅事件(对齐 Python/JS off 方法) */
|
|
301
382
|
off(event: string, handler: EventHandler): void;
|
|
@@ -360,6 +441,7 @@ export declare class AUNClient {
|
|
|
360
441
|
*/
|
|
361
442
|
private _verifyEventSignatureAsync;
|
|
362
443
|
private _validateAndCachePeerCert;
|
|
444
|
+
private _fetchServiceEventCertificate;
|
|
363
445
|
/** 获取对方证书(带缓存 + 完整 PKI 验证),跨域时自动路由到 peer 所在域。 */
|
|
364
446
|
private _fetchPeerCert;
|
|
365
447
|
private _bootstrapCaChain;
|
|
@@ -473,6 +555,7 @@ export declare class AUNClient {
|
|
|
473
555
|
private _decryptV2PushMessage;
|
|
474
556
|
/** 按当前 AID 发现 Gateway;用于 authenticate()/connect() 的新入口。 */
|
|
475
557
|
private _resolveGatewayForAid;
|
|
558
|
+
private _resolveOwnershipCertificateGateway;
|
|
476
559
|
/** 发现并缓存全部 Gateway 候选,供首连和自动重连故障转移使用。 */
|
|
477
560
|
private _resolveGatewayCandidatesForAid;
|
|
478
561
|
/** 从参数中解析 Gateway URL */
|