@indigoai-us/hq-cli 5.117.0 → 5.117.1
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 +28 -0
- package/dist/command-catalog.generated.d.ts +1 -1
- package/dist/command-catalog.generated.js +1 -1
- package/dist/commands/agent-kit.d.ts +23 -3
- package/dist/commands/agent-kit.js +110 -13
- package/dist/commands/agent-probe.d.ts +15 -7
- package/dist/commands/agent-probe.js +59 -21
- package/dist/commands/dm.d.ts +10 -0
- package/dist/commands/dm.js +80 -0
- package/dist/lib/agent-kit/fallback.d.ts +63 -0
- package/dist/lib/agent-kit/fallback.js +129 -0
- package/dist/lib/agent-kit/run/inbox.d.ts +18 -6
- package/dist/lib/agent-kit/run/inbox.js +38 -6
- package/dist/lib/agent-kit/run/mesh-listener.d.ts +22 -6
- package/dist/lib/agent-kit/run/mesh-listener.js +44 -8
- package/dist/lib/agent-kit/run/supervisor.d.ts +35 -0
- package/dist/lib/agent-kit/run/supervisor.js +85 -0
- package/dist/lib/mesh/live/daemon/credentials.d.ts +27 -0
- package/dist/lib/mesh/live/daemon/credentials.js +95 -0
- package/package.json +1 -1
|
@@ -385,4 +385,99 @@ export class CredentialRenewalManager {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
+
export function normalizePersonalRealtimeBundle(raw) {
|
|
389
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
390
|
+
throw new Error("contract-2 vend response is not an object");
|
|
391
|
+
}
|
|
392
|
+
const r = raw;
|
|
393
|
+
if (r.contractVersion !== 2) {
|
|
394
|
+
throw new Error(`expected contractVersion 2, got ${String(r.contractVersion)}`);
|
|
395
|
+
}
|
|
396
|
+
const creds = r.credentials;
|
|
397
|
+
if (!creds ||
|
|
398
|
+
typeof creds.accessKeyId !== "string" ||
|
|
399
|
+
typeof creds.secretAccessKey !== "string" ||
|
|
400
|
+
typeof creds.sessionToken !== "string") {
|
|
401
|
+
throw new Error("contract-2 vend missing credentials");
|
|
402
|
+
}
|
|
403
|
+
for (const key of ["clientId", "iotEndpoint", "region"]) {
|
|
404
|
+
if (typeof r[key] !== "string" || !r[key].trim()) {
|
|
405
|
+
throw new Error(`contract-2 vend missing ${key}`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const topicsRaw = r.topics && typeof r.topics === "object" && !Array.isArray(r.topics)
|
|
409
|
+
? r.topics
|
|
410
|
+
: {};
|
|
411
|
+
const topics = {};
|
|
412
|
+
for (const [k, v] of Object.entries(topicsRaw)) {
|
|
413
|
+
if (typeof v === "string" && v.trim())
|
|
414
|
+
topics[k] = v.trim();
|
|
415
|
+
}
|
|
416
|
+
if (!topics.dm && typeof r.topic === "string")
|
|
417
|
+
topics.dm = r.topic;
|
|
418
|
+
const actorUid = (typeof r.principalUid === "string" && /^(?:prs|agt)_[A-Za-z0-9]+$/.test(r.principalUid)
|
|
419
|
+
? r.principalUid
|
|
420
|
+
: undefined) ||
|
|
421
|
+
actorUidFromPersonalTopic(topics.dm) ||
|
|
422
|
+
"";
|
|
423
|
+
if (!actorUid)
|
|
424
|
+
throw new Error("contract-2 vend could not derive actorUid");
|
|
425
|
+
// Only keep topics that belong to the vended principal.
|
|
426
|
+
for (const [k, v] of Object.entries(topics)) {
|
|
427
|
+
if (actorUidFromPersonalTopic(v) !== actorUid)
|
|
428
|
+
delete topics[k];
|
|
429
|
+
}
|
|
430
|
+
const expiresAt = (typeof r.expiresAt === "string" && r.expiresAt) ||
|
|
431
|
+
(typeof creds.expiration === "string" && creds.expiration) ||
|
|
432
|
+
"";
|
|
433
|
+
if (!expiresAt)
|
|
434
|
+
throw new Error("contract-2 vend missing expiresAt");
|
|
435
|
+
return {
|
|
436
|
+
contractVersion: 2,
|
|
437
|
+
credentials: {
|
|
438
|
+
accessKeyId: creds.accessKeyId,
|
|
439
|
+
secretAccessKey: creds.secretAccessKey,
|
|
440
|
+
sessionToken: creds.sessionToken,
|
|
441
|
+
expiration: expiresAt,
|
|
442
|
+
},
|
|
443
|
+
iotEndpoint: r.iotEndpoint,
|
|
444
|
+
region: r.region,
|
|
445
|
+
clientId: r.clientId,
|
|
446
|
+
actorUid,
|
|
447
|
+
topics,
|
|
448
|
+
expiresAt,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
export function createPersonalRealtimeFetcher(opts) {
|
|
452
|
+
return async () => {
|
|
453
|
+
if (opts.post) {
|
|
454
|
+
const res = await opts.post(REALTIME_CREDENTIALS_PATH, { contractVersion: 2 });
|
|
455
|
+
if (res.status < 200 || res.status >= 300) {
|
|
456
|
+
throw classifyCredentialVendFailure(res.status, res.body, headerGet(res.headers, "Retry-After"));
|
|
457
|
+
}
|
|
458
|
+
return normalizePersonalRealtimeBundle(res.body);
|
|
459
|
+
}
|
|
460
|
+
const res = await vaultApiFetch({
|
|
461
|
+
token: opts.token,
|
|
462
|
+
path: REALTIME_CREDENTIALS_PATH,
|
|
463
|
+
method: "POST",
|
|
464
|
+
body: { contractVersion: 2 },
|
|
465
|
+
baseUrl: opts.baseUrl ?? DEFAULT_VAULT_API_URL,
|
|
466
|
+
});
|
|
467
|
+
const text = await res.text();
|
|
468
|
+
let body = {};
|
|
469
|
+
if (text) {
|
|
470
|
+
try {
|
|
471
|
+
body = JSON.parse(text);
|
|
472
|
+
}
|
|
473
|
+
catch {
|
|
474
|
+
body = { raw: text.slice(0, 200) };
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (!res.ok) {
|
|
478
|
+
throw classifyCredentialVendFailure(res.status, body, res.headers.get("Retry-After"));
|
|
479
|
+
}
|
|
480
|
+
return normalizePersonalRealtimeBundle(body);
|
|
481
|
+
};
|
|
482
|
+
}
|
|
388
483
|
//# sourceMappingURL=credentials.js.map
|