@agentunion/fastaun 0.5.17 → 0.5.19
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 +83 -0
- package/_packed_docs/CHANGELOG.md +83 -0
- package/_packed_docs/INDEX.md +163 -16
- package/_packed_docs/KITE_DOCS_GUIDE.md +52 -20
- package/_packed_docs/agent.md/SCHEMA.md +266 -207
- 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 +64 -31
- package/_packed_docs/aun/346/265/213/350/257/225/350/277/220/350/241/214/346/214/207/345/215/227.md +8 -6
- 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 +39 -39
- 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 +1 -1
- package/_packed_docs/protocol/10-Group-/345/255/220/345/215/217/350/256/256.md +28 -9
- package/_packed_docs/protocol/11-Storage-/345/255/220/345/215/217/350/256/256.md +20 -2
- package/_packed_docs/protocol/agent.md/SCHEMA.md +4 -0
- package/_packed_docs/sdk/04-/350/277/236/346/216/245/344/270/216/350/256/244/350/257/201.md +5 -2
- package/_packed_docs/sdk/06-API/346/211/213/345/206/214.md +246 -241
- package/_packed_docs/sdk/09-group-rpc-manual.md +46 -14
- package/_packed_docs/sdk/09-message-rpc-manual.md +40 -2
- package/_packed_docs/sdk/09-storage-rpc-manual.md +69 -38
- package/_packed_docs/sdk/AUN_DOCS_GUIDE.md +25 -5
- package/_packed_docs/sdk/INDEX.md +78 -18
- package/dist/agent-md-schema.d.ts +2 -0
- package/dist/agent-md-schema.js +46 -9
- package/dist/agent-md-schema.js.map +1 -1
- package/dist/agent-md.d.ts +46 -1
- package/dist/agent-md.js +492 -30
- package/dist/agent-md.js.map +1 -1
- package/dist/aid-store.d.ts +9 -1
- package/dist/aid-store.js +139 -18
- package/dist/aid-store.js.map +1 -1
- package/dist/aid.d.ts +17 -1
- package/dist/aid.js +67 -7
- package/dist/aid.js.map +1 -1
- package/dist/auth.d.ts +6 -1
- package/dist/auth.js +428 -15
- package/dist/auth.js.map +1 -1
- package/dist/cert-utils.d.ts +1 -1
- package/dist/cert-utils.js +19 -7
- package/dist/cert-utils.js.map +1 -1
- package/dist/client/delivery.d.ts +4 -1
- package/dist/client/delivery.js +264 -68
- package/dist/client/delivery.js.map +1 -1
- package/dist/client/rpc-pipeline.js +29 -14
- package/dist/client/rpc-pipeline.js.map +1 -1
- package/dist/client/v2-e2ee.d.ts +8 -1
- package/dist/client/v2-e2ee.js +893 -529
- package/dist/client/v2-e2ee.js.map +1 -1
- package/dist/client.d.ts +87 -1
- package/dist/client.js +816 -35
- 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 +5 -1
- package/dist/events.js +47 -6
- package/dist/events.js.map +1 -1
- package/dist/facades.d.ts +85 -3
- package/dist/facades.js +104 -4
- package/dist/facades.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/keystore/aid-db.d.ts +5 -0
- package/dist/keystore/aid-db.js +48 -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 +1689 -0
- package/dist/org-protocol.js.map +1 -0
- package/dist/ownership-proof.d.ts +117 -0
- package/dist/ownership-proof.js +436 -0
- package/dist/ownership-proof.js.map +1 -0
- package/dist/ownership-v21.d.ts +178 -0
- package/dist/ownership-v21.js +635 -0
- package/dist/ownership-v21.js.map +1 -0
- package/dist/ownership-workflow.d.ts +82 -0
- package/dist/ownership-workflow.js +872 -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 +89 -1
- package/dist/tools/cross-sdk-agent.js +338 -7
- package/dist/tools/cross-sdk-agent.js.map +1 -1
- package/dist/transport.d.ts +7 -0
- package/dist/transport.js +108 -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 +8 -8
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
|
/** 会话参数(重连用) */
|
|
@@ -140,10 +162,17 @@ export declare class AUNClient {
|
|
|
140
162
|
private _pushProcessQueues;
|
|
141
163
|
/** P2P pull 进行中到达的纯通知 push 上界;pull gate 释放后需要补拉一次。 */
|
|
142
164
|
private _pendingP2pPullUpper;
|
|
165
|
+
/** P2P pending pull 的延迟重试定时器及次数,覆盖服务端异步落库窗口。 */
|
|
166
|
+
private _pendingP2pPullTimers;
|
|
167
|
+
private _pendingP2pPullRetries;
|
|
143
168
|
/** 缺 sender IK 时暂存原始 V2 消息,后台补齐 IK 后重试解密。 */
|
|
144
169
|
private _v2SenderIKPending;
|
|
145
170
|
/** sender IK 后台补齐任务去重。 */
|
|
146
171
|
private _v2SenderIKFetching;
|
|
172
|
+
private _readStateCache;
|
|
173
|
+
private _readStateQueries;
|
|
174
|
+
private _readStateIdentity;
|
|
175
|
+
private _readStateGeneration;
|
|
147
176
|
private _heartbeatTimer;
|
|
148
177
|
private _tokenRefreshTimer;
|
|
149
178
|
private _tokenRefreshFailures;
|
|
@@ -190,12 +219,16 @@ export declare class AUNClient {
|
|
|
190
219
|
private _mail?;
|
|
191
220
|
private _group?;
|
|
192
221
|
private _stream?;
|
|
222
|
+
private _credential?;
|
|
223
|
+
private _org?;
|
|
193
224
|
constructor(aid?: AID);
|
|
194
225
|
/** 当前 AID */
|
|
195
226
|
get aid(): string | null;
|
|
196
227
|
/** 返回后台刷新任务维护的最新 access token。 */
|
|
197
228
|
getAccessToken(): string | null;
|
|
198
229
|
/** AUN Storage VFS 入口 */
|
|
230
|
+
get credential(): CredentialFacade;
|
|
231
|
+
get org(): OrgFacade;
|
|
199
232
|
get storage(): StorageVFS;
|
|
200
233
|
/** AUN Collab 入口 */
|
|
201
234
|
get collab(): CollabClient;
|
|
@@ -207,6 +240,39 @@ export declare class AUNClient {
|
|
|
207
240
|
get stream(): StreamFacade;
|
|
208
241
|
/** 当前 AID 值对象 */
|
|
209
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;
|
|
210
276
|
get hasIdentity(): boolean;
|
|
211
277
|
get canSign(): boolean;
|
|
212
278
|
get canConnect(): boolean;
|
|
@@ -272,12 +338,23 @@ export declare class AUNClient {
|
|
|
272
338
|
call(method: string, params?: RpcParams): Promise<RpcResult>;
|
|
273
339
|
private _maybeHandleHalfOpenRpcFailure;
|
|
274
340
|
_recoverIdentityAdmission(err: unknown, _method?: string, params?: RpcParams): Promise<boolean>;
|
|
341
|
+
private _ensureInitialAgentMd;
|
|
275
342
|
private _checkIdentityAdmissionAfterConnect;
|
|
276
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;
|
|
277
349
|
createGroup(params?: RpcParams, options?: CreateGroupOptions): Promise<RpcResult>;
|
|
278
350
|
private _inviteInitialGroupMembers;
|
|
279
351
|
private _groupAgentMdContent;
|
|
352
|
+
private _resumeGroupAgentMdUpload;
|
|
280
353
|
private _uploadGroupAgentMd;
|
|
354
|
+
private _localEntityCertificate;
|
|
355
|
+
private _freshEntityCertificate;
|
|
356
|
+
private _freshEntitySigner;
|
|
357
|
+
private _resolveEntityAgentMdOwner;
|
|
281
358
|
bindGroupAid(params?: RpcParams, options?: BindGroupAidOptions): Promise<RpcResult>;
|
|
282
359
|
startGroupTransfer(params?: RpcParams, options?: CompleteGroupTransferOptions): Promise<RpcResult>;
|
|
283
360
|
renewGroupAid(params?: RpcParams, options?: BindGroupAidOptions): Promise<RpcResult>;
|
|
@@ -293,6 +370,13 @@ export declare class AUNClient {
|
|
|
293
370
|
notify(method: string, params?: RpcParams, options?: NotifyOptions): Promise<void>;
|
|
294
371
|
/** 订阅事件 */
|
|
295
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;
|
|
296
380
|
private _callRawV2Rpc;
|
|
297
381
|
/** P2-13: 取消订阅事件(对齐 Python/JS off 方法) */
|
|
298
382
|
off(event: string, handler: EventHandler): void;
|
|
@@ -357,6 +441,7 @@ export declare class AUNClient {
|
|
|
357
441
|
*/
|
|
358
442
|
private _verifyEventSignatureAsync;
|
|
359
443
|
private _validateAndCachePeerCert;
|
|
444
|
+
private _fetchServiceEventCertificate;
|
|
360
445
|
/** 获取对方证书(带缓存 + 完整 PKI 验证),跨域时自动路由到 peer 所在域。 */
|
|
361
446
|
private _fetchPeerCert;
|
|
362
447
|
private _bootstrapCaChain;
|
|
@@ -470,6 +555,7 @@ export declare class AUNClient {
|
|
|
470
555
|
private _decryptV2PushMessage;
|
|
471
556
|
/** 按当前 AID 发现 Gateway;用于 authenticate()/connect() 的新入口。 */
|
|
472
557
|
private _resolveGatewayForAid;
|
|
558
|
+
private _resolveOwnershipCertificateGateway;
|
|
473
559
|
/** 发现并缓存全部 Gateway 候选,供首连和自动重连故障转移使用。 */
|
|
474
560
|
private _resolveGatewayCandidatesForAid;
|
|
475
561
|
/** 从参数中解析 Gateway URL */
|