@dudousxd/nestjs-agent-dashboard 0.21.0 → 0.22.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/dist/server/index.cjs +276 -60
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +92 -1
- package/dist/server/index.d.ts +92 -1
- package/dist/server/index.js +255 -47
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/index-BW1bqmTf.css +1 -0
- package/dist/spa/assets/index-C4U9WEBt.js +1 -0
- package/dist/spa/assets/{preview-CbqJ2CAQ.js → preview-CJ1UfhOA.js} +1 -1
- package/dist/spa/index.html +3 -3
- package/dist/spa/preview.html +3 -3
- package/package.json +1 -1
- package/dist/spa/assets/index-ClnZsvJ1.css +0 -1
- package/dist/spa/assets/index-D3yTBCU0.js +0 -1
- /package/dist/spa/assets/{index-DS11tOEH.js → index-Br3YfiYJ.js} +0 -0
package/dist/server/index.cjs
CHANGED
|
@@ -35,16 +35,22 @@ __export(index_exports, {
|
|
|
35
35
|
AGENT_ACTOR_DIRECTORY: () => AGENT_ACTOR_DIRECTORY,
|
|
36
36
|
AGENT_ACTOR_RESOLVER: () => AGENT_ACTOR_RESOLVER,
|
|
37
37
|
AGENT_APPROVAL_PORT: () => AGENT_APPROVAL_PORT,
|
|
38
|
+
AGENT_CONSOLE_ID: () => AGENT_CONSOLE_ID,
|
|
39
|
+
AGENT_DASHBOARD_CONFIG_ID: () => AGENT_DASHBOARD_CONFIG_ID,
|
|
38
40
|
AGENT_GOVERNANCE_QUERIES: () => AGENT_GOVERNANCE_QUERIES,
|
|
39
41
|
AGENT_PRICING_STORE: () => AGENT_PRICING_STORE,
|
|
42
|
+
AVIARY_CONSOLES_SLOT: () => AVIARY_CONSOLES_SLOT,
|
|
40
43
|
AgentApiController: () => AgentApiController,
|
|
41
44
|
AgentApiModule: () => AgentApiModule,
|
|
45
|
+
AgentConsoleRegistration: () => AgentConsoleRegistration,
|
|
46
|
+
AgentConsolesController: () => AgentConsolesController,
|
|
42
47
|
AgentDashboardModule: () => AgentDashboardModule,
|
|
43
48
|
AgentDevToolsRegistration: () => AgentDevToolsRegistration,
|
|
44
49
|
AgentUiController: () => AgentUiController,
|
|
45
50
|
CONSOLE_AUTHORIZE_MISSING_WARNING: () => CONSOLE_AUTHORIZE_MISSING_WARNING,
|
|
46
51
|
CONSOLE_GATE: () => CONSOLE_GATE,
|
|
47
52
|
CONSOLE_PAGE_METADATA: () => CONSOLE_PAGE_METADATA,
|
|
53
|
+
CONSOLE_PROBE_TIMEOUT_MS: () => CONSOLE_PROBE_TIMEOUT_MS,
|
|
48
54
|
ConsoleAccessDenied: () => ConsoleAccessDenied,
|
|
49
55
|
ConsoleAuthorizeFilter: () => ConsoleAuthorizeFilter,
|
|
50
56
|
ConsoleAuthorizeGuard: () => ConsoleAuthorizeGuard,
|
|
@@ -61,8 +67,10 @@ __export(index_exports, {
|
|
|
61
67
|
agentDevTools: () => agentDevTools,
|
|
62
68
|
anyAuthorize: () => anyAuthorize,
|
|
63
69
|
authorizeByToken: () => authorizeByToken,
|
|
70
|
+
listVisibleConsoles: () => listVisibleConsoles,
|
|
64
71
|
normalizeConsoleResult: () => normalizeConsoleResult,
|
|
65
72
|
parsePriceInput: () => parsePriceInput,
|
|
73
|
+
registerAviaryConsole: () => registerAviaryConsole,
|
|
66
74
|
resolveConsoleAuthorize: () => resolveConsoleAuthorize
|
|
67
75
|
});
|
|
68
76
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -1109,17 +1117,17 @@ function agentDashboardMountPaths(options) {
|
|
|
1109
1117
|
__name(agentDashboardMountPaths, "agentDashboardMountPaths");
|
|
1110
1118
|
|
|
1111
1119
|
// src/server/agent-dashboard.module.ts
|
|
1112
|
-
var
|
|
1120
|
+
var import_nestjs_agent_core4 = require("@dudousxd/nestjs-agent-core");
|
|
1113
1121
|
var import_reflect_metadata = require("reflect-metadata");
|
|
1114
|
-
var
|
|
1122
|
+
var import_common11 = require("@nestjs/common");
|
|
1115
1123
|
var import_core3 = require("@nestjs/core");
|
|
1116
1124
|
|
|
1117
1125
|
// src/server/agent-ui.controller.ts
|
|
1118
1126
|
var import_node_fs = require("fs");
|
|
1119
1127
|
var import_node_path = require("path");
|
|
1120
1128
|
var import_node_url = require("url");
|
|
1121
|
-
var
|
|
1122
|
-
var
|
|
1129
|
+
var import_nestjs_agent_core3 = require("@dudousxd/nestjs-agent-core");
|
|
1130
|
+
var import_common9 = require("@nestjs/common");
|
|
1123
1131
|
|
|
1124
1132
|
// src/server/console-authorize.guard.ts
|
|
1125
1133
|
var import_common7 = require("@nestjs/common");
|
|
@@ -1508,7 +1516,9 @@ function UseConsoleAuthorize() {
|
|
|
1508
1516
|
}
|
|
1509
1517
|
__name(UseConsoleAuthorize, "UseConsoleAuthorize");
|
|
1510
1518
|
|
|
1511
|
-
// src/server/
|
|
1519
|
+
// src/server/console-switcher.ts
|
|
1520
|
+
var import_nestjs_agent_core2 = require("@dudousxd/nestjs-agent-core");
|
|
1521
|
+
var import_common8 = require("@nestjs/common");
|
|
1512
1522
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
1513
1523
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1514
1524
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -1535,7 +1545,186 @@ function _ts_param4(paramIndex, decorator) {
|
|
|
1535
1545
|
};
|
|
1536
1546
|
}
|
|
1537
1547
|
__name(_ts_param4, "_ts_param");
|
|
1548
|
+
var AVIARY_CONSOLES_SLOT = /* @__PURE__ */ Symbol.for("@dudousxd/aviary:consoles");
|
|
1549
|
+
var ID = /^[a-z][a-z0-9-]*$/;
|
|
1550
|
+
var ICONS = /* @__PURE__ */ new Set([
|
|
1551
|
+
"workflow",
|
|
1552
|
+
"telescope",
|
|
1553
|
+
"media",
|
|
1554
|
+
"payments",
|
|
1555
|
+
"agent",
|
|
1556
|
+
"identity",
|
|
1557
|
+
"generic"
|
|
1558
|
+
]);
|
|
1559
|
+
var CONSOLE_PROBE_TIMEOUT_MS = 300;
|
|
1560
|
+
function isSameOriginPath(path) {
|
|
1561
|
+
return typeof path === "string" && path.startsWith("/") && !path.startsWith("//");
|
|
1562
|
+
}
|
|
1563
|
+
__name(isSameOriginPath, "isSameOriginPath");
|
|
1564
|
+
function readAviaryConsoles() {
|
|
1565
|
+
const value = globalThis[AVIARY_CONSOLES_SLOT];
|
|
1566
|
+
if (value?.version !== 1 || !Array.isArray(value.entries)) return void 0;
|
|
1567
|
+
return value;
|
|
1568
|
+
}
|
|
1569
|
+
__name(readAviaryConsoles, "readAviaryConsoles");
|
|
1570
|
+
function registerAviaryConsole(entry, logger4) {
|
|
1571
|
+
if (!ID.test(entry.id)) throw new Error(`console id ${JSON.stringify(entry.id)} is invalid`);
|
|
1572
|
+
if (!isSameOriginPath(entry.path)) {
|
|
1573
|
+
throw new Error(`console path ${JSON.stringify(entry.path)} must start with a single "/"`);
|
|
1574
|
+
}
|
|
1575
|
+
const holder = globalThis;
|
|
1576
|
+
if (holder[AVIARY_CONSOLES_SLOT] === void 0) {
|
|
1577
|
+
const fresh = {
|
|
1578
|
+
version: 1,
|
|
1579
|
+
entries: []
|
|
1580
|
+
};
|
|
1581
|
+
holder[AVIARY_CONSOLES_SLOT] = fresh;
|
|
1582
|
+
}
|
|
1583
|
+
const registry = readAviaryConsoles();
|
|
1584
|
+
if (registry === void 0) return void 0;
|
|
1585
|
+
if (registry.entries.some((existing) => existing.id === entry.id)) {
|
|
1586
|
+
logger4?.warn(`console id "${entry.id}" is already registered`);
|
|
1587
|
+
return void 0;
|
|
1588
|
+
}
|
|
1589
|
+
registry.entries.push(entry);
|
|
1590
|
+
return () => {
|
|
1591
|
+
const index = registry.entries.indexOf(entry);
|
|
1592
|
+
if (index !== -1) registry.entries.splice(index, 1);
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
__name(registerAviaryConsole, "registerAviaryConsole");
|
|
1596
|
+
function consoleSwitcherConfig(selfId, endpoint) {
|
|
1597
|
+
const registry = readAviaryConsoles();
|
|
1598
|
+
if (!registry?.entries.some((entry) => entry.id === selfId)) return void 0;
|
|
1599
|
+
const others = registry.entries.filter((entry) => entry.id !== selfId).length;
|
|
1600
|
+
return others > 0 ? {
|
|
1601
|
+
endpoint,
|
|
1602
|
+
others
|
|
1603
|
+
} : void 0;
|
|
1604
|
+
}
|
|
1605
|
+
__name(consoleSwitcherConfig, "consoleSwitcherConfig");
|
|
1606
|
+
async function allows(entry, context, ms) {
|
|
1607
|
+
let timer;
|
|
1608
|
+
const timeout = new Promise((resolve2) => {
|
|
1609
|
+
timer = setTimeout(() => resolve2(false), ms);
|
|
1610
|
+
});
|
|
1611
|
+
try {
|
|
1612
|
+
return await Promise.race([
|
|
1613
|
+
Promise.resolve().then(() => entry.authorize(context)).then((decision) => decision?.allowed === true, () => false),
|
|
1614
|
+
timeout
|
|
1615
|
+
]);
|
|
1616
|
+
} finally {
|
|
1617
|
+
clearTimeout(timer);
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
__name(allows, "allows");
|
|
1621
|
+
async function listVisibleConsoles(registry, selfId, context, timeoutMs = CONSOLE_PROBE_TIMEOUT_MS) {
|
|
1622
|
+
const others = (registry?.entries ?? []).filter((entry) => entry.id !== selfId && isSameOriginPath(entry.path)).sort((a, b) => a.order - b.order || a.id.localeCompare(b.id));
|
|
1623
|
+
const verdicts = await Promise.all(others.map((entry) => allows(entry, context, timeoutMs)));
|
|
1624
|
+
return {
|
|
1625
|
+
version: 1,
|
|
1626
|
+
current: selfId,
|
|
1627
|
+
consoles: others.filter((_, index) => verdicts[index]).map((entry) => ({
|
|
1628
|
+
id: entry.id,
|
|
1629
|
+
title: entry.title,
|
|
1630
|
+
icon: ICONS.has(entry.icon) ? entry.icon : "generic",
|
|
1631
|
+
href: entry.path
|
|
1632
|
+
}))
|
|
1633
|
+
};
|
|
1634
|
+
}
|
|
1635
|
+
__name(listVisibleConsoles, "listVisibleConsoles");
|
|
1636
|
+
var AGENT_CONSOLE_ID = "agent";
|
|
1637
|
+
var logger2 = new import_common8.Logger("AgentDashboardModule");
|
|
1638
|
+
var AgentConsoleRegistration = class {
|
|
1639
|
+
static {
|
|
1640
|
+
__name(this, "AgentConsoleRegistration");
|
|
1641
|
+
}
|
|
1642
|
+
basePath;
|
|
1643
|
+
access;
|
|
1644
|
+
#unregister;
|
|
1645
|
+
constructor(basePath, access) {
|
|
1646
|
+
this.basePath = basePath;
|
|
1647
|
+
this.access = access;
|
|
1648
|
+
}
|
|
1649
|
+
onModuleInit() {
|
|
1650
|
+
this.#unregister = registerAviaryConsole({
|
|
1651
|
+
id: AGENT_CONSOLE_ID,
|
|
1652
|
+
title: "Agents",
|
|
1653
|
+
icon: "agent",
|
|
1654
|
+
order: 30,
|
|
1655
|
+
path: this.basePath === "" ? "/" : this.basePath,
|
|
1656
|
+
authorize: /* @__PURE__ */ __name((context) => this.access.check(context), "authorize")
|
|
1657
|
+
}, logger2);
|
|
1658
|
+
}
|
|
1659
|
+
onModuleDestroy() {
|
|
1660
|
+
this.#unregister?.();
|
|
1661
|
+
this.#unregister = void 0;
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
AgentConsoleRegistration = _ts_decorate4([
|
|
1665
|
+
(0, import_common8.Injectable)(),
|
|
1666
|
+
_ts_param4(0, (0, import_common8.Inject)(DASHBOARD_BASE_PATH)),
|
|
1667
|
+
_ts_metadata4("design:type", Function),
|
|
1668
|
+
_ts_metadata4("design:paramtypes", [
|
|
1669
|
+
String,
|
|
1670
|
+
typeof DashboardConsoleAccess === "undefined" ? Object : DashboardConsoleAccess
|
|
1671
|
+
])
|
|
1672
|
+
], AgentConsoleRegistration);
|
|
1673
|
+
var CurrentExecutionContext = (0, import_common8.createParamDecorator)((_data, context) => ({
|
|
1674
|
+
context
|
|
1675
|
+
}));
|
|
1676
|
+
var AgentConsolesController = class {
|
|
1677
|
+
static {
|
|
1678
|
+
__name(this, "AgentConsolesController");
|
|
1679
|
+
}
|
|
1680
|
+
consoles(current) {
|
|
1681
|
+
return listVisibleConsoles(readAviaryConsoles(), AGENT_CONSOLE_ID, current.context);
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
_ts_decorate4([
|
|
1685
|
+
(0, import_common8.Get)("consoles"),
|
|
1686
|
+
(0, import_common8.Header)("Cache-Control", "private, no-store"),
|
|
1687
|
+
_ts_param4(0, CurrentExecutionContext()),
|
|
1688
|
+
_ts_metadata4("design:type", Function),
|
|
1689
|
+
_ts_metadata4("design:paramtypes", [
|
|
1690
|
+
typeof CurrentContext === "undefined" ? Object : CurrentContext
|
|
1691
|
+
]),
|
|
1692
|
+
_ts_metadata4("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1693
|
+
], AgentConsolesController.prototype, "consoles", null);
|
|
1694
|
+
AgentConsolesController = _ts_decorate4([
|
|
1695
|
+
(0, import_nestjs_agent_core2.CanAnyone)(),
|
|
1696
|
+
(0, import_common8.Controller)()
|
|
1697
|
+
], AgentConsolesController);
|
|
1698
|
+
|
|
1699
|
+
// src/server/agent-ui.controller.ts
|
|
1700
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
1701
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1702
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1703
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1704
|
+
} else {
|
|
1705
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
1706
|
+
if (d = decorators[i]) {
|
|
1707
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1712
|
+
}
|
|
1713
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
1714
|
+
function _ts_metadata5(metadataKey, metadataValue) {
|
|
1715
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1716
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
1720
|
+
function _ts_param5(paramIndex, decorator) {
|
|
1721
|
+
return function(target, key) {
|
|
1722
|
+
decorator(target, key, paramIndex);
|
|
1723
|
+
};
|
|
1724
|
+
}
|
|
1725
|
+
__name(_ts_param5, "_ts_param");
|
|
1538
1726
|
var BUILD_BASE = "/ai-gateway";
|
|
1727
|
+
var AGENT_DASHBOARD_CONFIG_ID = "agent-dashboard-config";
|
|
1539
1728
|
function spaDir() {
|
|
1540
1729
|
return (0, import_node_url.fileURLToPath)(new URL("../spa", __importMetaUrl));
|
|
1541
1730
|
}
|
|
@@ -1570,67 +1759,81 @@ var AgentUiController = class {
|
|
|
1570
1759
|
}
|
|
1571
1760
|
const indexPath = (0, import_node_path.join)(this.dir, "index.html");
|
|
1572
1761
|
if (!(0, import_node_fs.existsSync)(indexPath)) {
|
|
1573
|
-
throw new
|
|
1762
|
+
throw new import_common9.NotFoundException("Dashboard is not built. Run the package build.");
|
|
1574
1763
|
}
|
|
1575
1764
|
const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
|
|
1576
|
-
const inject = `<script>window.__AGENT_BASE__='${this.basePath}';window.__AGENT_API__='${this.apiBasePath}';</script
|
|
1765
|
+
const inject = `<script>window.__AGENT_BASE__='${this.basePath}';window.__AGENT_API__='${this.apiBasePath}';</script>${this.configBlock()}`;
|
|
1577
1766
|
return html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : inject + html;
|
|
1578
1767
|
}
|
|
1768
|
+
/**
|
|
1769
|
+
* The page's JSON config block (`agent-dashboard-config`, CSP-safe: data, not script). It carries
|
|
1770
|
+
* `switcher` only when another Aviary console is registered.
|
|
1771
|
+
*/
|
|
1772
|
+
configBlock() {
|
|
1773
|
+
const switcher = consoleSwitcherConfig(AGENT_CONSOLE_ID, `${this.apiBasePath}/consoles`);
|
|
1774
|
+
const json = JSON.stringify({
|
|
1775
|
+
apiBase: this.apiBasePath,
|
|
1776
|
+
...switcher !== void 0 ? {
|
|
1777
|
+
switcher
|
|
1778
|
+
} : {}
|
|
1779
|
+
}).replaceAll("<", "\\u003c");
|
|
1780
|
+
return `<script type="application/json" id="${AGENT_DASHBOARD_CONFIG_ID}">${json}</script>`;
|
|
1781
|
+
}
|
|
1579
1782
|
asset(file) {
|
|
1580
1783
|
const safe = (0, import_node_path.basename)(file);
|
|
1581
|
-
if (safe !== file) throw new
|
|
1784
|
+
if (safe !== file) throw new import_common9.NotFoundException();
|
|
1582
1785
|
const root = (0, import_node_path.resolve)(this.dir, "assets");
|
|
1583
1786
|
const assetPath = (0, import_node_path.resolve)(root, safe);
|
|
1584
1787
|
if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
|
|
1585
|
-
throw new
|
|
1788
|
+
throw new import_common9.NotFoundException();
|
|
1586
1789
|
}
|
|
1587
1790
|
const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
|
|
1588
|
-
return new
|
|
1791
|
+
return new import_common9.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
|
|
1589
1792
|
type
|
|
1590
1793
|
});
|
|
1591
1794
|
}
|
|
1592
1795
|
};
|
|
1593
|
-
|
|
1594
|
-
(0,
|
|
1796
|
+
_ts_decorate5([
|
|
1797
|
+
(0, import_common9.Get)(),
|
|
1595
1798
|
ConsolePage(),
|
|
1596
|
-
(0,
|
|
1597
|
-
(0,
|
|
1598
|
-
|
|
1599
|
-
|
|
1799
|
+
(0, import_common9.Header)("Content-Type", "text/html; charset=utf-8"),
|
|
1800
|
+
(0, import_common9.Header)("Cache-Control", "no-store, must-revalidate"),
|
|
1801
|
+
_ts_param5(0, (0, import_common9.Req)()),
|
|
1802
|
+
_ts_param5(1, (0, import_common9.Res)({
|
|
1600
1803
|
passthrough: true
|
|
1601
1804
|
})),
|
|
1602
|
-
|
|
1603
|
-
|
|
1805
|
+
_ts_metadata5("design:type", Function),
|
|
1806
|
+
_ts_metadata5("design:paramtypes", [
|
|
1604
1807
|
typeof UiPageRequest === "undefined" ? Object : UiPageRequest,
|
|
1605
1808
|
typeof UiPageResponse === "undefined" ? Object : UiPageResponse
|
|
1606
1809
|
]),
|
|
1607
|
-
|
|
1810
|
+
_ts_metadata5("design:returntype", String)
|
|
1608
1811
|
], AgentUiController.prototype, "index", null);
|
|
1609
|
-
|
|
1610
|
-
(0,
|
|
1611
|
-
(0,
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1812
|
+
_ts_decorate5([
|
|
1813
|
+
(0, import_common9.Get)("assets/:file"),
|
|
1814
|
+
(0, import_common9.Header)("Cache-Control", "public, max-age=31536000, immutable"),
|
|
1815
|
+
_ts_param5(0, (0, import_common9.Param)("file")),
|
|
1816
|
+
_ts_metadata5("design:type", Function),
|
|
1817
|
+
_ts_metadata5("design:paramtypes", [
|
|
1615
1818
|
String
|
|
1616
1819
|
]),
|
|
1617
|
-
|
|
1820
|
+
_ts_metadata5("design:returntype", typeof import_common9.StreamableFile === "undefined" ? Object : import_common9.StreamableFile)
|
|
1618
1821
|
], AgentUiController.prototype, "asset", null);
|
|
1619
|
-
AgentUiController =
|
|
1620
|
-
(0,
|
|
1621
|
-
(0,
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1822
|
+
AgentUiController = _ts_decorate5([
|
|
1823
|
+
(0, import_nestjs_agent_core3.CanAnyone)(),
|
|
1824
|
+
(0, import_common9.Controller)(),
|
|
1825
|
+
_ts_param5(0, (0, import_common9.Inject)(DASHBOARD_BASE_PATH)),
|
|
1826
|
+
_ts_param5(1, (0, import_common9.Inject)(DASHBOARD_API_PATH)),
|
|
1827
|
+
_ts_metadata5("design:type", Function),
|
|
1828
|
+
_ts_metadata5("design:paramtypes", [
|
|
1626
1829
|
String,
|
|
1627
1830
|
String
|
|
1628
1831
|
])
|
|
1629
1832
|
], AgentUiController);
|
|
1630
1833
|
|
|
1631
1834
|
// src/server/dev-tools.ts
|
|
1632
|
-
var
|
|
1633
|
-
function
|
|
1835
|
+
var import_common10 = require("@nestjs/common");
|
|
1836
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1634
1837
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1635
1838
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1636
1839
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1643,19 +1846,19 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1643
1846
|
}
|
|
1644
1847
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1645
1848
|
}
|
|
1646
|
-
__name(
|
|
1647
|
-
function
|
|
1849
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
1850
|
+
function _ts_metadata6(metadataKey, metadataValue) {
|
|
1648
1851
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1649
1852
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
1650
1853
|
}
|
|
1651
1854
|
}
|
|
1652
|
-
__name(
|
|
1653
|
-
function
|
|
1855
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
1856
|
+
function _ts_param6(paramIndex, decorator) {
|
|
1654
1857
|
return function(target, key) {
|
|
1655
1858
|
decorator(target, key, paramIndex);
|
|
1656
1859
|
};
|
|
1657
1860
|
}
|
|
1658
|
-
__name(
|
|
1861
|
+
__name(_ts_param6, "_ts_param");
|
|
1659
1862
|
var DEV_TOOLS_SLOT = /* @__PURE__ */ Symbol.for("@dudousxd/aviary:dev-tools");
|
|
1660
1863
|
function devToolsSlot() {
|
|
1661
1864
|
const holder = globalThis;
|
|
@@ -1821,7 +2024,7 @@ function agentDevTools(dashboard) {
|
|
|
1821
2024
|
try {
|
|
1822
2025
|
detail = await dashboard.runDetail(String(input.id));
|
|
1823
2026
|
} catch (error) {
|
|
1824
|
-
if (error instanceof
|
|
2027
|
+
if (error instanceof import_common10.NotFoundException) throw new Error(`run ${String(input.id)} not found`);
|
|
1825
2028
|
throw error;
|
|
1826
2029
|
}
|
|
1827
2030
|
if (input.includeMessages !== true) return detail;
|
|
@@ -1989,7 +2192,7 @@ function agentDevTools(dashboard) {
|
|
|
1989
2192
|
];
|
|
1990
2193
|
}
|
|
1991
2194
|
__name(agentDevTools, "agentDevTools");
|
|
1992
|
-
var
|
|
2195
|
+
var logger3 = new import_common10.Logger("AgentDashboardModule");
|
|
1993
2196
|
var AgentDevToolsRegistration = class {
|
|
1994
2197
|
static {
|
|
1995
2198
|
__name(this, "AgentDevToolsRegistration");
|
|
@@ -2015,7 +2218,7 @@ var AgentDevToolsRegistration = class {
|
|
|
2015
2218
|
tools: agentDevTools(this.dashboard)
|
|
2016
2219
|
});
|
|
2017
2220
|
} catch (error) {
|
|
2018
|
-
|
|
2221
|
+
logger3.warn(`agent dev tools not registered: ${error instanceof Error ? error.message : String(error)}`);
|
|
2019
2222
|
}
|
|
2020
2223
|
}
|
|
2021
2224
|
onModuleDestroy() {
|
|
@@ -2023,11 +2226,11 @@ var AgentDevToolsRegistration = class {
|
|
|
2023
2226
|
this.#unregister = void 0;
|
|
2024
2227
|
}
|
|
2025
2228
|
};
|
|
2026
|
-
AgentDevToolsRegistration =
|
|
2027
|
-
(0,
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2229
|
+
AgentDevToolsRegistration = _ts_decorate6([
|
|
2230
|
+
(0, import_common10.Injectable)(),
|
|
2231
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_DEV_TOOLS)),
|
|
2232
|
+
_ts_metadata6("design:type", Function),
|
|
2233
|
+
_ts_metadata6("design:paramtypes", [
|
|
2031
2234
|
Boolean,
|
|
2032
2235
|
typeof DashboardService === "undefined" ? Object : DashboardService,
|
|
2033
2236
|
typeof DashboardConsoleAccess === "undefined" ? Object : DashboardConsoleAccess
|
|
@@ -2035,7 +2238,7 @@ AgentDevToolsRegistration = _ts_decorate5([
|
|
|
2035
2238
|
], AgentDevToolsRegistration);
|
|
2036
2239
|
|
|
2037
2240
|
// src/server/agent-dashboard.module.ts
|
|
2038
|
-
function
|
|
2241
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
2039
2242
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2040
2243
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2041
2244
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2048,7 +2251,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2048
2251
|
}
|
|
2049
2252
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2050
2253
|
}
|
|
2051
|
-
__name(
|
|
2254
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
2052
2255
|
function normalize(path) {
|
|
2053
2256
|
return normalizeDashboardPath(path);
|
|
2054
2257
|
}
|
|
@@ -2056,8 +2259,8 @@ __name(normalize, "normalize");
|
|
|
2056
2259
|
function consoleDecorators(decorators) {
|
|
2057
2260
|
return [
|
|
2058
2261
|
...decorators ?? [],
|
|
2059
|
-
(0,
|
|
2060
|
-
(0,
|
|
2262
|
+
(0, import_common11.UseGuards)(ConsoleAuthorizeGuard),
|
|
2263
|
+
(0, import_common11.UseFilters)(ConsoleAuthorizeFilter)
|
|
2061
2264
|
];
|
|
2062
2265
|
}
|
|
2063
2266
|
__name(consoleDecorators, "consoleDecorators");
|
|
@@ -2076,8 +2279,9 @@ var AgentApiModule = class _AgentApiModule {
|
|
|
2076
2279
|
imports: [
|
|
2077
2280
|
...options.imports ?? []
|
|
2078
2281
|
],
|
|
2079
|
-
controllers: options.routes === false ? [] : (0,
|
|
2080
|
-
AgentApiController
|
|
2282
|
+
controllers: options.routes === false ? [] : (0, import_nestjs_agent_core4.withControllerDecorators)([
|
|
2283
|
+
AgentApiController,
|
|
2284
|
+
AgentConsolesController
|
|
2081
2285
|
], consoleDecorators(options.decorators)),
|
|
2082
2286
|
providers: [
|
|
2083
2287
|
DashboardService,
|
|
@@ -2108,8 +2312,8 @@ var AgentApiModule = class _AgentApiModule {
|
|
|
2108
2312
|
};
|
|
2109
2313
|
}
|
|
2110
2314
|
};
|
|
2111
|
-
AgentApiModule =
|
|
2112
|
-
(0,
|
|
2315
|
+
AgentApiModule = _ts_decorate7([
|
|
2316
|
+
(0, import_common11.Module)({})
|
|
2113
2317
|
], AgentApiModule);
|
|
2114
2318
|
var AgentDashboardModule = class _AgentDashboardModule {
|
|
2115
2319
|
static {
|
|
@@ -2156,7 +2360,7 @@ var AgentDashboardModule = class _AgentDashboardModule {
|
|
|
2156
2360
|
])
|
|
2157
2361
|
]
|
|
2158
2362
|
],
|
|
2159
|
-
controllers: options.routes === false ? [] : (0,
|
|
2363
|
+
controllers: options.routes === false ? [] : (0, import_nestjs_agent_core4.withControllerDecorators)([
|
|
2160
2364
|
AgentUiController
|
|
2161
2365
|
], consoleDecorators(options.decorators)),
|
|
2162
2366
|
providers: [
|
|
@@ -2167,7 +2371,11 @@ var AgentDashboardModule = class _AgentDashboardModule {
|
|
|
2167
2371
|
{
|
|
2168
2372
|
provide: DASHBOARD_API_PATH,
|
|
2169
2373
|
useValue: apiBasePath
|
|
2170
|
-
}
|
|
2374
|
+
},
|
|
2375
|
+
// The console switcher lists this console only where it serves its own page.
|
|
2376
|
+
...options.routes === false ? [] : [
|
|
2377
|
+
AgentConsoleRegistration
|
|
2378
|
+
]
|
|
2171
2379
|
],
|
|
2172
2380
|
// Re-export the API module so its DashboardService reaches importers (e.g. the host's own
|
|
2173
2381
|
// controllers), and the paths a self-mounted `AgentUiController` subclass injects.
|
|
@@ -2179,24 +2387,30 @@ var AgentDashboardModule = class _AgentDashboardModule {
|
|
|
2179
2387
|
};
|
|
2180
2388
|
}
|
|
2181
2389
|
};
|
|
2182
|
-
AgentDashboardModule =
|
|
2183
|
-
(0,
|
|
2390
|
+
AgentDashboardModule = _ts_decorate7([
|
|
2391
|
+
(0, import_common11.Module)({})
|
|
2184
2392
|
], AgentDashboardModule);
|
|
2185
2393
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2186
2394
|
0 && (module.exports = {
|
|
2187
2395
|
AGENT_ACTOR_DIRECTORY,
|
|
2188
2396
|
AGENT_ACTOR_RESOLVER,
|
|
2189
2397
|
AGENT_APPROVAL_PORT,
|
|
2398
|
+
AGENT_CONSOLE_ID,
|
|
2399
|
+
AGENT_DASHBOARD_CONFIG_ID,
|
|
2190
2400
|
AGENT_GOVERNANCE_QUERIES,
|
|
2191
2401
|
AGENT_PRICING_STORE,
|
|
2402
|
+
AVIARY_CONSOLES_SLOT,
|
|
2192
2403
|
AgentApiController,
|
|
2193
2404
|
AgentApiModule,
|
|
2405
|
+
AgentConsoleRegistration,
|
|
2406
|
+
AgentConsolesController,
|
|
2194
2407
|
AgentDashboardModule,
|
|
2195
2408
|
AgentDevToolsRegistration,
|
|
2196
2409
|
AgentUiController,
|
|
2197
2410
|
CONSOLE_AUTHORIZE_MISSING_WARNING,
|
|
2198
2411
|
CONSOLE_GATE,
|
|
2199
2412
|
CONSOLE_PAGE_METADATA,
|
|
2413
|
+
CONSOLE_PROBE_TIMEOUT_MS,
|
|
2200
2414
|
ConsoleAccessDenied,
|
|
2201
2415
|
ConsoleAuthorizeFilter,
|
|
2202
2416
|
ConsoleAuthorizeGuard,
|
|
@@ -2213,8 +2427,10 @@ AgentDashboardModule = _ts_decorate6([
|
|
|
2213
2427
|
agentDevTools,
|
|
2214
2428
|
anyAuthorize,
|
|
2215
2429
|
authorizeByToken,
|
|
2430
|
+
listVisibleConsoles,
|
|
2216
2431
|
normalizeConsoleResult,
|
|
2217
2432
|
parsePriceInput,
|
|
2433
|
+
registerAviaryConsole,
|
|
2218
2434
|
resolveConsoleAuthorize
|
|
2219
2435
|
});
|
|
2220
2436
|
//# sourceMappingURL=index.cjs.map
|