@agentunion/fastaun 0.5.26 → 0.5.28

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.
Files changed (94) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/_packed_docs/CHANGELOG.md +77 -0
  3. package/_packed_docs/INDEX.md +37 -14
  4. package/_packed_docs/KITE_DOCS_GUIDE.md +23 -15
  5. 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 +16 -1
  6. package/_packed_docs/aun/346/265/213/350/257/225/350/277/220/350/241/214/346/214/207/345/215/227.md +37 -9
  7. package/_packed_docs/cli/AUN-CLI/350/256/276/350/256/241/346/226/207/346/241/243.md +20 -9
  8. package/_packed_docs/cli/CLI/346/211/213/345/206/214.md +57 -12
  9. package/_packed_docs/sdk/0.5.22-SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +2 -2
  10. package/_packed_docs/sdk/06-API/346/211/213/345/206/214.md +2 -2
  11. package/_packed_docs/sdk/09-/345/207/255/350/257/201/346/234/215/345/212/241RPC/346/211/213/345/206/214.md +187 -73
  12. package/_packed_docs/sdk/09-/347/273/204/347/273/207/346/234/215/345/212/241RPC/346/211/213/345/206/214.md +1 -1
  13. package/_packed_docs/sdk/AUN_DOCS_GUIDE.md +13 -9
  14. package/_packed_docs/sdk/INDEX.md +23 -13
  15. 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 +973 -266
  16. 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 +950 -242
  17. package/dist/agent-md-changes.d.ts +42 -0
  18. package/dist/agent-md-changes.js +339 -0
  19. package/dist/agent-md-changes.js.map +1 -0
  20. package/dist/agent-md-schema.d.ts +1 -0
  21. package/dist/agent-md-schema.js +31 -14
  22. package/dist/agent-md-schema.js.map +1 -1
  23. package/dist/agent-md.d.ts +11 -0
  24. package/dist/agent-md.js +91 -15
  25. package/dist/agent-md.js.map +1 -1
  26. package/dist/aid-store.d.ts +11 -0
  27. package/dist/aid-store.js +102 -21
  28. package/dist/aid-store.js.map +1 -1
  29. package/dist/aid.js +3 -3
  30. package/dist/aid.js.map +1 -1
  31. package/dist/auth.d.ts +10 -0
  32. package/dist/auth.js +65 -23
  33. package/dist/auth.js.map +1 -1
  34. package/dist/cert-utils.d.ts +1 -1
  35. package/dist/cert-utils.js +4 -4
  36. package/dist/cert-utils.js.map +1 -1
  37. package/dist/client/control-messages.d.ts +31 -0
  38. package/dist/client/control-messages.js +474 -0
  39. package/dist/client/control-messages.js.map +1 -0
  40. package/dist/client/delivery.js +10 -2
  41. package/dist/client/delivery.js.map +1 -1
  42. package/dist/client/lifecycle.d.ts +1 -1
  43. package/dist/client/lifecycle.js +10 -0
  44. package/dist/client/lifecycle.js.map +1 -1
  45. package/dist/client/rpc-pipeline.js +84 -14
  46. package/dist/client/rpc-pipeline.js.map +1 -1
  47. package/dist/client/v2-e2ee.d.ts +3 -0
  48. package/dist/client/v2-e2ee.js +12 -0
  49. package/dist/client/v2-e2ee.js.map +1 -1
  50. package/dist/client.d.ts +38 -0
  51. package/dist/client.js +572 -36
  52. package/dist/client.js.map +1 -1
  53. package/dist/discovery.d.ts +3 -0
  54. package/dist/discovery.js +52 -2
  55. package/dist/discovery.js.map +1 -1
  56. package/dist/events.js +14 -1
  57. package/dist/events.js.map +1 -1
  58. package/dist/facades.d.ts +38 -0
  59. package/dist/facades.js +49 -5
  60. package/dist/facades.js.map +1 -1
  61. package/dist/index.d.ts +4 -0
  62. package/dist/index.js +3 -0
  63. package/dist/index.js.map +1 -1
  64. package/dist/org-protocol.d.ts +1 -0
  65. package/dist/org-protocol.js +39 -36
  66. package/dist/org-protocol.js.map +1 -1
  67. package/dist/ownership-v21.js +7 -7
  68. package/dist/ownership-v21.js.map +1 -1
  69. package/dist/register-flow.js +2 -2
  70. package/dist/register-flow.js.map +1 -1
  71. package/dist/risk-control.d.ts +68 -0
  72. package/dist/risk-control.js +344 -0
  73. package/dist/risk-control.js.map +1 -0
  74. package/dist/semantic-facade.d.ts +176 -0
  75. package/dist/semantic-facade.js +611 -0
  76. package/dist/semantic-facade.js.map +1 -0
  77. package/dist/semantic-protocol.d.ts +810 -0
  78. package/dist/semantic-protocol.js +894 -0
  79. package/dist/semantic-protocol.js.map +1 -0
  80. package/dist/storage/lowlevel.d.ts +1 -0
  81. package/dist/storage/lowlevel.js +2 -2
  82. package/dist/storage/lowlevel.js.map +1 -1
  83. package/dist/tools/cross-sdk-agent.d.ts +11 -1
  84. package/dist/tools/cross-sdk-agent.js +388 -7
  85. package/dist/tools/cross-sdk-agent.js.map +1 -1
  86. package/dist/transport.d.ts +22 -1
  87. package/dist/transport.js +227 -22
  88. package/dist/transport.js.map +1 -1
  89. package/dist/v2/e2ee/decrypt.d.ts +5 -0
  90. package/dist/v2/e2ee/decrypt.js +22 -2
  91. package/dist/v2/e2ee/decrypt.js.map +1 -1
  92. package/dist/version.d.ts +1 -1
  93. package/dist/version.js +1 -1
  94. package/package.json +1 -1
package/dist/agent-md.js CHANGED
@@ -193,10 +193,26 @@ function requestText(url, opts) {
193
193
  });
194
194
  }
195
195
  export class AgentMdManager {
196
+ static _commitListeners = new Map();
197
+ static _commitRoot(aunPath) {
198
+ const root = path.resolve(aunPath, 'AIDs');
199
+ return process.platform === 'win32' ? root.toLowerCase() : root;
200
+ }
201
+ static subscribeCommits(aunPath, callback) {
202
+ const root = this._commitRoot(aunPath), listeners = this._commitListeners.get(root) ?? new Set();
203
+ listeners.add(callback);
204
+ this._commitListeners.set(root, listeners);
205
+ return () => {
206
+ listeners.delete(callback);
207
+ if (!listeners.size && this._commitListeners.get(root) === listeners)
208
+ this._commitListeners.delete(root);
209
+ };
210
+ }
196
211
  _aunPath;
197
212
  _verifySsl;
198
213
  _log;
199
214
  _onChanged;
215
+ _onCommitted;
200
216
  _discoveryPort;
201
217
  _uploadViaGatewayHost;
202
218
  _ownerAidGetter;
@@ -214,11 +230,24 @@ export class AgentMdManager {
214
230
  _autoDownloadRetry = new Map();
215
231
  _downloadActive = 0;
216
232
  _downloadWaiters = [];
233
+ _httpHandler = null;
234
+ setHttpHandler(handler) { this._httpHandler = handler; }
235
+ async _requestText(url, opts) {
236
+ if (!this._httpHandler)
237
+ return requestText(url, opts);
238
+ const perform = async () => {
239
+ const result = await requestText(url, opts);
240
+ return new Response(opts.method === 'HEAD' || [204, 205, 304].includes(result.status) ? null : result.text, { status: result.status, headers: result.headers });
241
+ };
242
+ const response = await this._httpHandler(url, { method: opts.method, headers: opts.headers, body: opts.body }, perform);
243
+ return { status: response.status, headers: Object.fromEntries(response.headers), text: await response.text() };
244
+ }
217
245
  constructor(opts) {
218
246
  this._aunPath = String(opts.aunPath ?? '');
219
247
  this._verifySsl = opts.verifySsl ?? true;
220
248
  this._log = opts.logger ?? noopLogger;
221
249
  this._onChanged = opts.onChanged;
250
+ this._onCommitted = opts.onCommitted;
222
251
  this._discoveryPort = opts.discoveryPort ?? null;
223
252
  this._uploadViaGatewayHost = opts.uploadViaGatewayHost ?? false;
224
253
  this._ownerAidGetter = opts.ownerAidGetter;
@@ -307,16 +336,41 @@ export class AgentMdManager {
307
336
  loadRecord(aid) {
308
337
  return this._loadRecord(aid);
309
338
  }
339
+ listRecordedAids() {
340
+ return fs.readdirSync(this.root, { withFileTypes: true }).filter((entry) => entry.isDirectory() && fs.existsSync(path.join(this.root, entry.name, 'agentmd.json'))).map((entry) => this.safeAid(entry.name));
341
+ }
342
+ updateRecord(aid, change) {
343
+ const target = this.safeAid(aid);
344
+ this._withRecordLock(target, () => {
345
+ const record = this._readRecordUnlocked(target, true);
346
+ change(record);
347
+ record.updated_at = Date.now();
348
+ this._writeRecordUnlocked(target, record);
349
+ });
350
+ this._cache.delete(target);
351
+ }
352
+ setOnCommitted(callback) { this._onCommitted = callback; }
310
353
  _saveRecord(aid, fields, strict = false, observation) {
311
354
  const target = String(aid ?? '').trim();
312
355
  if (!target)
313
356
  return {};
357
+ let completedNotice = false;
314
358
  try {
315
359
  const inputFields = { ...fields };
316
360
  const hasContent = Object.prototype.hasOwnProperty.call(inputFields, 'content') && inputFields.content !== undefined && inputFields.content !== null;
317
361
  let savedTo = '';
318
362
  const record = this._withRecordLock(target, () => {
319
363
  const next = { ...this._readRecordUnlocked(target, true), aid: target };
364
+ if (inputFields.pending_operation === '' && next.pending_operation === 'replace' && isJsonObject(next.pending_agent_md_notice)
365
+ && typeof fields.content === 'string' && fields.content === next.pending_content) {
366
+ const notice = { ...next.pending_agent_md_notice, etag: String(inputFields.remote_etag ?? '') || AgentMdManager.contentEtag(fields.content) };
367
+ const outbox = Array.isArray(next.agent_md_change_outbox) ? [...next.agent_md_change_outbox] : [];
368
+ if (notice.owner_aid && notice.sender_aid && !outbox.some((item) => item.message_id === notice.message_id))
369
+ outbox.push(notice);
370
+ inputFields.agent_md_change_outbox = outbox;
371
+ inputFields.pending_agent_md_notice = {};
372
+ completedNotice = true;
373
+ }
320
374
  if (observation && (this.root !== observation.root || String(next.remote_etag ?? '') !== observation.etag || Number(next.observation_version ?? 0) !== observation.version))
321
375
  throw ownershipFailure('unavailable', 'agent.md observation changed during download', true);
322
376
  if (hasContent) {
@@ -348,6 +402,17 @@ export class AgentMdManager {
348
402
  loaded.content = current.content;
349
403
  }
350
404
  this._cache.set(target, { ...loaded });
405
+ if (completedNotice) {
406
+ const listeners = new Set(AgentMdManager._commitListeners.get(AgentMdManager._commitRoot(this._aunPath)));
407
+ if (this._onCommitted)
408
+ listeners.add(this._onCommitted);
409
+ for (const callback of listeners) {
410
+ try {
411
+ callback(target);
412
+ }
413
+ catch { }
414
+ }
415
+ }
351
416
  return { ...loaded };
352
417
  }
353
418
  catch (err) {
@@ -399,7 +464,7 @@ export class AgentMdManager {
399
464
  const rawContent = content === undefined || content === null ? String(this._loadRecord(target, true)?.local_draft_content ?? '') || this.readContent(target) : String(content);
400
465
  if (!rawContent.trim())
401
466
  throw new ValidationError('uploadAgentMd requires non-empty content');
402
- const parsed = validateAgentMdDocument(rawContent, { expectedAid: target, validateOwnership: false });
467
+ const parsed = validateAgentMdDocument(rawContent, { expectedAid: target, validateOwnership: false, forUpload: true });
403
468
  if (['group', 'org'].includes(String(parsed.frontmatter.type)))
404
469
  return await this.uploadAs(target, rawContent, current);
405
470
  if (parseAgentMdTailSignature(rawContent).signatures.length > 1) {
@@ -417,7 +482,7 @@ export class AgentMdManager {
417
482
  }
418
483
  async readAgentMdFresh(aid) {
419
484
  const target = this.safeAid(aid), gateway = await this._resolveGateway(target);
420
- const response = await requestText(this._url(target, gateway, this._uploadViaGatewayHost), {
485
+ const response = await this._requestText(this._url(target, gateway, this._uploadViaGatewayHost), {
421
486
  method: 'GET', verifySsl: this._verifySsl,
422
487
  headers: { 'X-AUN-Signature-Format': 'multi-v1', Accept: 'text/markdown', 'Cache-Control': 'no-cache', ...(this._uploadViaGatewayHost ? { Host: target } : {}) },
423
488
  timeoutMs: DEFAULT_HTTP_TIMEOUT_MS, redirectsLeft: 0, strictUtf8: true,
@@ -520,7 +585,7 @@ export class AgentMdManager {
520
585
  if (viaGateway)
521
586
  headers.Host = target;
522
587
  const request = (url) => { if (method === 'PUT')
523
- assertActive?.(); return requestText(url, { method, verifySsl: this._verifySsl, headers, body: raw, timeoutMs: DEFAULT_HTTP_TIMEOUT_MS, redirectsLeft: 0, strictUtf8: true }); };
588
+ assertActive?.(); return this._requestText(url, { method, verifySsl: this._verifySsl, headers, body: raw, timeoutMs: DEFAULT_HTTP_TIMEOUT_MS, redirectsLeft: 0, strictUtf8: true }); };
524
589
  const primary = this._url(target, gatewayUrl, viaGateway);
525
590
  let response = await request(primary);
526
591
  if (response.status === 404 && !headerValue(response.headers, 'X-AUN-Ownership-Protocol') && headerValue(response.headers, 'X-AUN-Ownership-Status') !== 'not_applicable') {
@@ -537,7 +602,7 @@ export class AgentMdManager {
537
602
  const rawContent = String(content ?? '');
538
603
  if (!rawContent.trim())
539
604
  throw new ValidationError('uploadAgentMd requires non-empty content');
540
- const parsed = validateAgentMdDocument(rawContent, { expectedAid: target, validateOwnership: false });
605
+ const parsed = validateAgentMdDocument(rawContent, { expectedAid: target, validateOwnership: false, forUpload: true });
541
606
  if (['group', 'org'].includes(String(parsed.frontmatter.type)) && parsed.signature) {
542
607
  const identity = await this._entitySigningIdentity(target, parsed.frontmatter, parsed.signature, signer);
543
608
  await this._verifyDocument(rawContent, target, identity, true);
@@ -580,7 +645,7 @@ export class AgentMdManager {
580
645
  const condition = pending.condition;
581
646
  if (!condition || Object.keys(condition).length !== 1 || !(typeof condition.if_match === 'string' && condition.if_match || condition.if_none_match === '*'))
582
647
  throw ownershipFailure('persistence_unavailable', 'pending agent.md requires its original document condition');
583
- const parsed = validateAgentMdDocument(pending.content, { expectedAid: aid, validateOwnership: false });
648
+ const parsed = validateAgentMdDocument(pending.content, { expectedAid: aid, validateOwnership: false, forUpload: true });
584
649
  const meta = parsed.frontmatter;
585
650
  try {
586
651
  if (pending.relation?.legacy === true)
@@ -669,7 +734,7 @@ export class AgentMdManager {
669
734
  }
670
735
  }
671
736
  async _uploadPrepared(target, signedContent, signer, originalCondition) {
672
- const meta = validateAgentMdDocument(signedContent, { expectedAid: target, validateOwnership: false }).frontmatter;
737
+ const meta = validateAgentMdDocument(signedContent, { expectedAid: target, validateOwnership: false, forUpload: true }).frontmatter;
673
738
  const entity = ['group', 'org'].includes(String(meta.type));
674
739
  const legacy = legacyRelationship(meta);
675
740
  const draftStrict = !originalCondition || !this._pendingUpload(target, true);
@@ -698,7 +763,13 @@ export class AgentMdManager {
698
763
  }
699
764
  const uploader = this._currentAid();
700
765
  const entityAuthorization = '';
701
- const pending = this._saveRecord(target, { pending_operation: 'replace', pending_target_aid: target, pending_content: signedContent, pending_content_etag: AgentMdManager.contentEtag(signedContent), pending_error: '', pending_condition: condition, pending_relation: relation, pending_authorization: entityAuthorization }, draftStrict);
766
+ const existing = this._loadRecord(target, true);
767
+ const ownership = isJsonObject(meta.ownership) ? meta.ownership : {};
768
+ const statement = isJsonObject(ownership.statement) ? ownership.statement : {};
769
+ const noticeOwner = String(statement.owner_aid ?? ownership.owner_aid ?? meta.owner ?? '').trim();
770
+ const previousNotice = existing?.pending_content === signedContent && isJsonObject(existing.pending_agent_md_notice) ? existing.pending_agent_md_notice : null;
771
+ const notice = previousNotice ?? { sender_aid: uploader?.aid ?? this._ownerAid(), owner_aid: noticeOwner, aid: target, document_type: String(meta.type ?? 'agent'), message_id: crypto.randomUUID() };
772
+ const pending = this._saveRecord(target, { pending_operation: 'replace', pending_target_aid: target, pending_content: signedContent, pending_content_etag: AgentMdManager.contentEtag(signedContent), pending_error: '', pending_condition: condition, pending_relation: relation, pending_authorization: entityAuthorization, pending_agent_md_notice: notice }, draftStrict);
702
773
  const savedCondition = pending.pending_condition;
703
774
  if (pending.pending_content !== signedContent || savedCondition?.if_match !== condition.if_match || savedCondition?.if_none_match !== condition.if_none_match || pending.pending_authorization !== entityAuthorization || legacy && !isDeepStrictEqual(pending.pending_relation, relation))
704
775
  throw new StateError('agent.md pending upload persistence failed');
@@ -754,7 +825,7 @@ export class AgentMdManager {
754
825
  else
755
826
  verifyAgentMdBodyUpdate(pending.content, identity.certPem, target);
756
827
  const base = await this._verifyLegacyBodyContent(target, relation.base_content);
757
- const candidate = validateAgentMdDocument(pending.content, { expectedAid: target, validateOwnership: false });
828
+ const candidate = validateAgentMdDocument(pending.content, { expectedAid: target, validateOwnership: false, forUpload: true });
758
829
  if (!isDeepStrictEqual(legacyRelationship(base.frontmatter), relation.fields) || !isDeepStrictEqual(relationshipFields(candidate.frontmatter), relation.fields))
759
830
  throw ownershipFailure('persistence_unavailable', 'pending legacy relationship material changed');
760
831
  const remote = await this._readLegacyBodyBase(target);
@@ -775,10 +846,13 @@ export class AgentMdManager {
775
846
  async _readEntityFresh(target) {
776
847
  const gateway = await this._resolveGateway(target);
777
848
  const headers = { 'X-AUN-Ownership-Check': '1', 'X-AUN-Signature-Format': 'multi-v1', 'Cache-Control': 'no-cache', ...(this._uploadViaGatewayHost ? { Host: target } : {}) };
778
- const request = (url) => requestText(url, { method: 'GET', verifySsl: this._verifySsl, headers, timeoutMs: DEFAULT_HTTP_TIMEOUT_MS, redirectsLeft: 0, strictUtf8: true });
849
+ const request = (url) => this._requestText(url, { method: 'GET', verifySsl: this._verifySsl, headers, timeoutMs: DEFAULT_HTTP_TIMEOUT_MS, redirectsLeft: 0, strictUtf8: true });
779
850
  const response = await request(this._url(target, gateway, this._uploadViaGatewayHost));
780
851
  if (response.status !== 200 && response.status !== 404)
781
852
  throw ownershipFailure('unavailable', `entity agent.md fresh read failed: HTTP ${response.status}`, true);
853
+ if (response.status === 404 && ['X-AUN-Ownership-Status', 'X-AUN-Entity-Verification-Status', 'X-AUN-Entity-Owner-AID', 'X-AUN-Entity-Cert-Fingerprint'].every((field) => !headerValue(response.headers, field))) {
854
+ return { exists: false, content: '', etag: '', owner_aid: '', entity_cert_fingerprint: '', initial_missing: true };
855
+ }
782
856
  if (headerValue(response.headers, 'X-AUN-Ownership-Status') !== 'not_applicable' || !['current', 'stale'].includes(headerValue(response.headers, 'X-AUN-Entity-Verification-Status')))
783
857
  throw ownershipFailure('unavailable', 'entity authority status metadata is unavailable', true);
784
858
  const etag = headerValue(response.headers, 'ETag');
@@ -788,6 +862,8 @@ export class AgentMdManager {
788
862
  }
789
863
  async readEntityAuthorityFresh(target) {
790
864
  const observed = await this._readEntityFresh(this.safeAid(target));
865
+ if (observed.initial_missing)
866
+ throw new StateError('entity owner authority metadata is unavailable', { stringCode: 'unavailable', retryable: true, data: { http_status: 404 } });
791
867
  try {
792
868
  ownershipAid(observed.owner_aid, 'owner_aid');
793
869
  }
@@ -827,7 +903,7 @@ export class AgentMdManager {
827
903
  async _verifyDocument(content, target, identity, current = false, bodyUpdate = false) {
828
904
  const certificates = new Map();
829
905
  const parsed = parseAgentMdTailSignature(content, !current);
830
- const meta = validateAgentMdReadDocument(content, { expectedAid: target }).frontmatter;
906
+ const meta = current ? validateAgentMdDocument(content, { expectedAid: target, forUpload: true }).frontmatter : validateAgentMdReadDocument(content, { expectedAid: target }).frontmatter;
831
907
  const historicalEntityOwner = !current && ['group', 'org'].includes(String(meta.type)) && parsed.signatures.length === 1 && parsed.fields?.signer_aid !== undefined && parsed.fields.signer_aid === meta.owner && parsed.fields.signer_aid !== meta.aid;
832
908
  const readCompatibility = !current && (!['group', 'org'].includes(String(meta.type)) || meta.type === 'group' && !Object.hasOwn(meta, 'entity_cert_fingerprint') && parsed.signatures.length === 1 && (parsed.fields?.signer_aid === undefined || parsed.fields.signer_aid === meta.aid));
833
909
  for (const item of parsed.signatures.slice(1)) {
@@ -897,7 +973,7 @@ export class AgentMdManager {
897
973
  throw ownershipFailure('persistence_unavailable', 'agent.md upload requires its original document condition');
898
974
  const gatewayUrl = await this._resolveGateway(target);
899
975
  const authorization = String(ownerAuthorization ?? '').trim();
900
- const meta = validateAgentMdDocument(signedContent, { expectedAid: target, validateOwnership: false }).frontmatter;
976
+ const meta = validateAgentMdDocument(signedContent, { expectedAid: target, validateOwnership: false, forUpload: true }).frontmatter;
901
977
  const entity = ['group', 'org'].includes(String(meta.type));
902
978
  const uploadHeaders = {
903
979
  'X-AUN-Signature-Format': 'multi-v1',
@@ -910,7 +986,7 @@ export class AgentMdManager {
910
986
  const token = await this._uploadAccessToken(entity ? this._ownerAid() : target, gatewayUrl);
911
987
  uploadHeaders.Authorization = `Bearer ${token}`;
912
988
  }
913
- const uploadRequest = (url) => requestText(url, {
989
+ const uploadRequest = (url) => this._requestText(url, {
914
990
  method: 'PUT',
915
991
  verifySsl: this._verifySsl,
916
992
  headers: uploadHeaders,
@@ -1199,7 +1275,7 @@ export class AgentMdManager {
1199
1275
  async _head(aid) {
1200
1276
  const target = this.safeAid(aid);
1201
1277
  const gatewayUrl = await this._resolveGateway(target);
1202
- const response = await requestText(this._url(target, gatewayUrl), {
1278
+ const response = await this._requestText(this._url(target, gatewayUrl), {
1203
1279
  method: 'HEAD',
1204
1280
  verifySsl: this._verifySsl,
1205
1281
  headers: { 'X-AUN-Signature-Format': 'multi-v1', Accept: 'text/markdown' },
@@ -1243,7 +1319,7 @@ export class AgentMdManager {
1243
1319
  const headers = { 'X-AUN-Signature-Format': 'multi-v1', Accept: 'text/markdown' };
1244
1320
  const etag = String(cached.remote_etag ?? cached.etag ?? cached.local_etag ?? '').trim();
1245
1321
  const lastModified = String(cached.last_modified ?? '').trim();
1246
- let response = await requestText(this._url(target, gatewayUrl), {
1322
+ let response = await this._requestText(this._url(target, gatewayUrl), {
1247
1323
  method: 'GET',
1248
1324
  verifySsl: this._verifySsl,
1249
1325
  headers,
@@ -1265,7 +1341,7 @@ export class AgentMdManager {
1265
1341
  };
1266
1342
  }
1267
1343
  else if (response.status === 304) {
1268
- response = await requestText(this._url(target, gatewayUrl), {
1344
+ response = await this._requestText(this._url(target, gatewayUrl), {
1269
1345
  method: 'GET',
1270
1346
  verifySsl: this._verifySsl,
1271
1347
  headers: { 'X-AUN-Signature-Format': 'multi-v1', Accept: 'text/markdown' },