@adonis-agora/agent 0.20.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/CHANGELOG.md +23 -0
- package/README.md +39 -1
- package/dist/assets/spa/assets/index-D8pLS_sd.css +1 -0
- package/dist/assets/spa/assets/index-DoUZ23yb.js +9 -0
- package/dist/assets/spa/index.html +13 -0
- package/dist/configure.d.ts +11 -6
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +12 -6
- package/dist/configure.js.map +1 -1
- package/dist/providers/agent_provider.d.ts.map +1 -1
- package/dist/providers/agent_provider.js +6 -0
- package/dist/providers/agent_provider.js.map +1 -1
- package/dist/providers/dashboard_provider.d.ts +55 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -0
- package/dist/providers/dashboard_provider.js +152 -0
- package/dist/providers/dashboard_provider.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +75 -0
- package/dist/src/dashboard/define_config.d.ts.map +1 -0
- package/dist/src/dashboard/define_config.js +56 -0
- package/dist/src/dashboard/define_config.js.map +1 -0
- package/dist/src/dashboard/gate.d.ts +33 -0
- package/dist/src/dashboard/gate.d.ts.map +1 -0
- package/dist/src/dashboard/gate.js +52 -0
- package/dist/src/dashboard/gate.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +20 -0
- package/dist/src/dashboard/index.d.ts.map +1 -0
- package/dist/src/dashboard/index.js +20 -0
- package/dist/src/dashboard/index.js.map +1 -0
- package/dist/src/dashboard/paths.d.ts +40 -0
- package/dist/src/dashboard/paths.d.ts.map +1 -0
- package/dist/src/dashboard/paths.js +99 -0
- package/dist/src/dashboard/paths.js.map +1 -0
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/telescope/agent-governance-providers.d.ts +67 -0
- package/dist/src/telescope/agent-governance-providers.d.ts.map +1 -0
- package/dist/src/telescope/agent-governance-providers.js +312 -0
- package/dist/src/telescope/agent-governance-providers.js.map +1 -0
- package/dist/src/telescope/dashboard.d.ts +28 -8
- package/dist/src/telescope/dashboard.d.ts.map +1 -1
- package/dist/src/telescope/dashboard.js +233 -4
- package/dist/src/telescope/dashboard.js.map +1 -1
- package/dist/src/telescope/data-providers.d.ts +40 -1
- package/dist/src/telescope/data-providers.d.ts.map +1 -1
- package/dist/src/telescope/data-providers.js +19 -8
- package/dist/src/telescope/data-providers.js.map +1 -1
- package/dist/src/telescope/extension.d.ts +59 -14
- package/dist/src/telescope/extension.d.ts.map +1 -1
- package/dist/src/telescope/extension.js +90 -13
- package/dist/src/telescope/extension.js.map +1 -1
- package/dist/src/telescope/governance-registry.d.ts +15 -0
- package/dist/src/telescope/governance-registry.d.ts.map +1 -0
- package/dist/src/telescope/governance-registry.js +42 -0
- package/dist/src/telescope/governance-registry.js.map +1 -0
- package/dist/src/telescope/index.d.ts +4 -2
- package/dist/src/telescope/index.d.ts.map +1 -1
- package/dist/src/telescope/index.js +3 -1
- package/dist/src/telescope/index.js.map +1 -1
- package/dist/src/telescope/rag-data-providers.d.ts +69 -0
- package/dist/src/telescope/rag-data-providers.d.ts.map +1 -0
- package/dist/src/telescope/rag-data-providers.js +84 -0
- package/dist/src/telescope/rag-data-providers.js.map +1 -0
- package/dist/src/telescope/telescope-sdk.d.ts +11 -0
- package/dist/src/telescope/telescope-sdk.d.ts.map +1 -1
- package/dist/stubs/config/agent.stub +7 -0
- package/package.json +28 -18
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** Fill defaults for the optional dashboard config block. */
|
|
2
|
+
export function resolveDashboardConfig(config) {
|
|
3
|
+
const resolved = { enabled: config?.enabled ?? true };
|
|
4
|
+
if (config?.path !== undefined)
|
|
5
|
+
resolved.path = config.path;
|
|
6
|
+
if (config?.authorize !== undefined)
|
|
7
|
+
resolved.authorize = config.authorize;
|
|
8
|
+
return resolved;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The exact wording the provider logs when it declines to mount. Mirrors the agent provider's own
|
|
12
|
+
* governance boot warning — same three facts, same vocabulary — so a reader who sees one recognises
|
|
13
|
+
* the other.
|
|
14
|
+
*/
|
|
15
|
+
const NO_GOVERNANCE_GATE_WARNING = '[@adonis-agora/agent-dashboard] the governance console was NOT mounted: every panel but Quota reads the cross-actor `/agent/governance/*` routes, and those are themselves not mounted because no `governanceAuthorize` gate is configured — so the console would load and then fail on every panel. Set `governanceAuthorize` in config/agent.ts (e.g. an ADMIN check) to mount the routes and this console gated, or `governanceAuthorize: () => true` to deliberately restore the old behaviour of letting ANY authenticated actor read them. `GET /agent/approvals/mine` is unaffected — it stays mounted and scoped to the calling actor. To keep the console off on purpose and silence this, set `dashboard: { enabled: false }`.';
|
|
16
|
+
/**
|
|
17
|
+
* The wording logged when the read-model itself was turned off. Deliberately distinct from
|
|
18
|
+
* {@link NO_GOVERNANCE_GATE_WARNING}: both produce the same dead console, and an operator staring at
|
|
19
|
+
* a 404 must be able to tell from the log ALONE which of the two knobs is responsible. A shared
|
|
20
|
+
* "governance is not configured" message would recreate exactly the diagnosability problem this
|
|
21
|
+
* check exists to remove.
|
|
22
|
+
*/
|
|
23
|
+
const NO_GOVERNANCE_QUERIES_WARNING = '[@adonis-agora/agent-dashboard] the governance console was NOT mounted: `governanceQueries` is set to `false` in config/agent.ts, so the cross-actor read-model was never built and the `/agent/governance/*` routes it serves do not exist — the console would load and then fail on every panel but Quota. A `governanceAuthorize` gate is NOT the missing piece here; it is already configured. Remove `governanceQueries: false` (omit it to get the Lucid read-model when the main store is Lucid, or pass a store/factory explicitly) to mount the read-model and this console. To keep the console off on purpose and silence this, set `dashboard: { enabled: false }`.';
|
|
24
|
+
/**
|
|
25
|
+
* Decide whether to register the console's routes at all — the router-free core of the provider's
|
|
26
|
+
* mount check, extracted so it can be unit tested without booting an app.
|
|
27
|
+
*
|
|
28
|
+
* The console is a pure consumer of the agent's cross-actor `/agent/governance/*` read routes, and
|
|
29
|
+
* those routes are not mounted unless the agent config carries a `governanceAuthorize` gate. Serving
|
|
30
|
+
* a shell that can only 404 its own data is worse than not serving it: the failure shows up as seven
|
|
31
|
+
* dead panels at click time with nothing anywhere explaining why. So the console follows the same
|
|
32
|
+
* fail-closed-by-omission rule one layer down — no gate, no routes — and says so at boot.
|
|
33
|
+
*
|
|
34
|
+
* This costs nothing that still works: every app affected is an app whose console is ALREADY dead in
|
|
35
|
+
* every view but Quota. `dashboard.authorize` is deliberately NOT the trigger; it gates the shell,
|
|
36
|
+
* not the data, and an app can set it and still have a console with nothing to render.
|
|
37
|
+
*/
|
|
38
|
+
export function decideDashboardMount(enabled, governanceAuthorize, governanceQueries) {
|
|
39
|
+
if (!enabled)
|
|
40
|
+
return { mount: false, reason: 'disabled' };
|
|
41
|
+
if (governanceAuthorize === undefined) {
|
|
42
|
+
return { mount: false, reason: 'no-governance-gate', warning: NO_GOVERNANCE_GATE_WARNING };
|
|
43
|
+
}
|
|
44
|
+
// ONLY an explicit `false` is decidable here. `undefined` does NOT mean "no read-model": the agent
|
|
45
|
+
// provider's `#resolveGovernance` defaults it to the Lucid read-model whenever the main store is
|
|
46
|
+
// Lucid, and reproducing that resolution would duplicate provider logic in the dashboard.
|
|
47
|
+
if (governanceQueries === false) {
|
|
48
|
+
return {
|
|
49
|
+
mount: false,
|
|
50
|
+
reason: 'no-governance-queries',
|
|
51
|
+
warning: NO_GOVERNANCE_QUERIES_WARNING,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return { mount: true };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=define_config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../../src/dashboard/define_config.ts"],"names":[],"mappings":"AAiDA,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,MAAwC;IAExC,MAAM,QAAQ,GAAiC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,IAAI,IAAI,EAAE,CAAC;IACpF,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS;QAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC5D,IAAI,MAAM,EAAE,SAAS,KAAK,SAAS;QAAE,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IAC3E,OAAO,QAAQ,CAAC;AAClB,CAAC;AASD;;;;GAIG;AACH,MAAM,0BAA0B,GAC9B,0sBAA0sB,CAAC;AAE7sB;;;;;;GAMG;AACH,MAAM,6BAA6B,GACjC,ipBAAipB,CAAC;AAEppB;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,mBAAyD,EACzD,iBAA2B;IAE3B,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC1D,IAAI,mBAAmB,KAAK,SAAS,EAAE,CAAC;QACtC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,0BAA0B,EAAE,CAAC;IAC7F,CAAC;IACD,mGAAmG;IACnG,iGAAiG;IACjG,0FAA0F;IAC1F,IAAI,iBAAiB,KAAK,KAAK,EAAE,CAAC;QAChC,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,uBAAuB;YAC/B,OAAO,EAAE,6BAA6B;SACvC,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HttpContext } from '@adonisjs/core/http';
|
|
2
|
+
import type { ActorResolver } from '../spi/actor-resolver.js';
|
|
3
|
+
import type { AgentDashboardAuthorize } from './define_config.js';
|
|
4
|
+
/** The outcome of the dashboard access gate: proceed, or deny with an HTTP status + message. */
|
|
5
|
+
export type DashboardGateVerdict = {
|
|
6
|
+
ok: true;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
status: 401 | 403;
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Decide whether a request may reach the dashboard, WITHOUT touching the response — so it is unit
|
|
14
|
+
* testable free of the AdonisJS router/app: resolve the actor through the agent config's resolver
|
|
15
|
+
* (missing/failed → `401`), then run the optional `authorize` gate over the resolved actor
|
|
16
|
+
* (denied/threw → `403`).
|
|
17
|
+
*
|
|
18
|
+
* This gates the SPA **shell**, and only the shell. It is NOT what decides whether the console's data
|
|
19
|
+
* is readable, and it is no longer the last line of defence it once had to be:
|
|
20
|
+
*
|
|
21
|
+
* - Whether the console mounts at all is decided earlier, by {@link decideDashboardMount} — the
|
|
22
|
+
* routes are not registered unless the agent config carries a `governanceAuthorize` gate AND its
|
|
23
|
+
* `governanceQueries` read-model exists. So this function never runs for a console that could only
|
|
24
|
+
* 404 its own panels.
|
|
25
|
+
* - Whether the DATA is readable is decided by the agent's own `governanceAuthorize` on the
|
|
26
|
+
* `/agent/governance/*` routes, not here. Omitting `authorize` while a gate is configured leaves
|
|
27
|
+
* the shell open to any resolved actor but exposes no cross-actor data.
|
|
28
|
+
*
|
|
29
|
+
* Omitting BOTH the resolver and `authorize` would expose the shell to any request; the provider is
|
|
30
|
+
* expected to short-circuit on a missing resolver via the `401` here.
|
|
31
|
+
*/
|
|
32
|
+
export declare function evaluateDashboardGate(ctx: HttpContext, actorResolver: ActorResolver | undefined, authorize?: AgentDashboardAuthorize): Promise<DashboardGateVerdict>;
|
|
33
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/dashboard/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,gGAAgG;AAChG,MAAM,MAAM,oBAAoB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,GAAG,GAAG,GAAG,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,WAAW,EAChB,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,SAAS,CAAC,EAAE,uBAAuB,GAClC,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decide whether a request may reach the dashboard, WITHOUT touching the response — so it is unit
|
|
3
|
+
* testable free of the AdonisJS router/app: resolve the actor through the agent config's resolver
|
|
4
|
+
* (missing/failed → `401`), then run the optional `authorize` gate over the resolved actor
|
|
5
|
+
* (denied/threw → `403`).
|
|
6
|
+
*
|
|
7
|
+
* This gates the SPA **shell**, and only the shell. It is NOT what decides whether the console's data
|
|
8
|
+
* is readable, and it is no longer the last line of defence it once had to be:
|
|
9
|
+
*
|
|
10
|
+
* - Whether the console mounts at all is decided earlier, by {@link decideDashboardMount} — the
|
|
11
|
+
* routes are not registered unless the agent config carries a `governanceAuthorize` gate AND its
|
|
12
|
+
* `governanceQueries` read-model exists. So this function never runs for a console that could only
|
|
13
|
+
* 404 its own panels.
|
|
14
|
+
* - Whether the DATA is readable is decided by the agent's own `governanceAuthorize` on the
|
|
15
|
+
* `/agent/governance/*` routes, not here. Omitting `authorize` while a gate is configured leaves
|
|
16
|
+
* the shell open to any resolved actor but exposes no cross-actor data.
|
|
17
|
+
*
|
|
18
|
+
* Omitting BOTH the resolver and `authorize` would expose the shell to any request; the provider is
|
|
19
|
+
* expected to short-circuit on a missing resolver via the `401` here.
|
|
20
|
+
*/
|
|
21
|
+
export async function evaluateDashboardGate(ctx, actorResolver, authorize) {
|
|
22
|
+
if (actorResolver === undefined) {
|
|
23
|
+
return { ok: false, status: 401, error: 'no actor resolver configured' };
|
|
24
|
+
}
|
|
25
|
+
let actor;
|
|
26
|
+
try {
|
|
27
|
+
actor = await actorResolver.resolve(ctx);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
ok: false,
|
|
32
|
+
status: 401,
|
|
33
|
+
error: error instanceof Error ? error.message : 'unauthorized',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (authorize !== undefined) {
|
|
37
|
+
try {
|
|
38
|
+
if (!(await authorize(actor, ctx))) {
|
|
39
|
+
return { ok: false, status: 403, error: 'forbidden' };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
status: 403,
|
|
46
|
+
error: error instanceof Error ? error.message : 'forbidden',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return { ok: true };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../../src/dashboard/gate.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,GAAgB,EAChB,aAAwC,EACxC,SAAmC;IAEnC,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,8BAA8B,EAAE,CAAC;IAC3E,CAAC;IACD,IAAI,KAAoD,CAAC;IACzD,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;SAC/D,CAAC;IACJ,CAAC;IACD,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,IAAI,CAAC,CAAC,MAAM,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;gBACnC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;YACxD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,MAAM,EAAE,GAAG;gBACX,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;aAC5D,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving helpers for the `@adonis-agora/agent-dashboard` governance SPA — the config shape, the
|
|
3
|
+
* mount/gate decisions, and the pure path/asset helpers. Framework-light (no AdonisJS router/app
|
|
4
|
+
* dependency), so they're unit-testable in isolation and reusable by BOTH dashboard providers:
|
|
5
|
+
*
|
|
6
|
+
* - `@adonis-agora/agent/dashboard_provider` (this package, `providers/dashboard_provider.ts`) —
|
|
7
|
+
* embedded: registered automatically by `node ace configure @adonis-agora/agent`, serves the SPA
|
|
8
|
+
* bundle copied into THIS package's own `dist/assets/spa` at build time.
|
|
9
|
+
* - `@adonis-agora/agent-dashboard`'s own provider (`agent_dashboard_provider.ts`) — standalone: an
|
|
10
|
+
* independently installable/registrable package some apps already depend on directly.
|
|
11
|
+
*
|
|
12
|
+
* Living here (rather than in `@adonis-agora/agent-dashboard`) keeps the dependency direction
|
|
13
|
+
* one-way: the dashboard package already depends on this one for `AgentConfig`/`ActorResolver`/etc.,
|
|
14
|
+
* so a package.json edge back from here to there would be circular. See
|
|
15
|
+
* `providers/dashboard_provider.ts`'s module doc for the full story.
|
|
16
|
+
*/
|
|
17
|
+
export { type AgentDashboardAuthorize, type AgentDashboardConfig, type DashboardMountDecision, type ResolvedAgentDashboardConfig, decideDashboardMount, resolveDashboardConfig, } from './define_config.js';
|
|
18
|
+
export { type DashboardGateVerdict, evaluateDashboardGate } from './gate.js';
|
|
19
|
+
export { apiBaseFor, contentTypeFor, injectApiBase, injectBaseHref, mountPathFor, safeAssetSegments, trimSlashes, } from './paths.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving helpers for the `@adonis-agora/agent-dashboard` governance SPA — the config shape, the
|
|
3
|
+
* mount/gate decisions, and the pure path/asset helpers. Framework-light (no AdonisJS router/app
|
|
4
|
+
* dependency), so they're unit-testable in isolation and reusable by BOTH dashboard providers:
|
|
5
|
+
*
|
|
6
|
+
* - `@adonis-agora/agent/dashboard_provider` (this package, `providers/dashboard_provider.ts`) —
|
|
7
|
+
* embedded: registered automatically by `node ace configure @adonis-agora/agent`, serves the SPA
|
|
8
|
+
* bundle copied into THIS package's own `dist/assets/spa` at build time.
|
|
9
|
+
* - `@adonis-agora/agent-dashboard`'s own provider (`agent_dashboard_provider.ts`) — standalone: an
|
|
10
|
+
* independently installable/registrable package some apps already depend on directly.
|
|
11
|
+
*
|
|
12
|
+
* Living here (rather than in `@adonis-agora/agent-dashboard`) keeps the dependency direction
|
|
13
|
+
* one-way: the dashboard package already depends on this one for `AgentConfig`/`ActorResolver`/etc.,
|
|
14
|
+
* so a package.json edge back from here to there would be circular. See
|
|
15
|
+
* `providers/dashboard_provider.ts`'s module doc for the full story.
|
|
16
|
+
*/
|
|
17
|
+
export { decideDashboardMount, resolveDashboardConfig, } from './define_config.js';
|
|
18
|
+
export { evaluateDashboardGate } from './gate.js';
|
|
19
|
+
export { apiBaseFor, contentTypeFor, injectApiBase, injectBaseHref, mountPathFor, safeAssetSegments, trimSlashes, } from './paths.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAKL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA6B,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EACL,UAAU,EACV,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,WAAW,GACZ,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure path/asset helpers for serving the `@adonis-agora/agent-dashboard` governance SPA — extracted
|
|
3
|
+
* so they can be unit-tested without booting an AdonisJS app. Both dashboard providers compose these;
|
|
4
|
+
* each holds only the router wiring + I/O. Owned here (rather than in `@adonis-agora/agent-dashboard`)
|
|
5
|
+
* so `packages/adonis`'s OWN embedded dashboard provider (`providers/dashboard_provider.ts`) can reuse
|
|
6
|
+
* them without depending on the dashboard package at runtime — the dashboard package already depends
|
|
7
|
+
* on THIS one (for `AgentConfig`/`ActorResolver`/...), and a package.json edge the other way would be
|
|
8
|
+
* circular. See `providers/dashboard_provider.ts`'s module doc for the full story.
|
|
9
|
+
*/
|
|
10
|
+
/** Collapse duplicate slashes and strip leading/trailing ones: `/agent//` → `agent`. */
|
|
11
|
+
export declare function trimSlashes(path: string): string;
|
|
12
|
+
/** The agent API base as an absolute path with a single leading slash: `agent` → `/agent`. */
|
|
13
|
+
export declare function apiBaseFor(agentPath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* The canonical dashboard mount path (no trailing slash), default `<agentPath>/dashboard`. A caller
|
|
16
|
+
* may override with an explicit `dashboardPath`; both are normalized to a single leading slash.
|
|
17
|
+
*/
|
|
18
|
+
export declare function mountPathFor(agentPath: string, dashboardPath?: string): string;
|
|
19
|
+
/** MIME type for a filename by extension; `application/octet-stream` for anything unknown. */
|
|
20
|
+
export declare function contentTypeFor(filename: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Reject a wildcard asset request that tries to escape the SPA root via `..` or an absolute path.
|
|
23
|
+
* Returns the safe, normalized relative segments (never starting with `..`), or `null` to deny.
|
|
24
|
+
*/
|
|
25
|
+
export declare function safeAssetSegments(wildcard: string | string[] | undefined): string[] | null;
|
|
26
|
+
/**
|
|
27
|
+
* Inject the resolved agent API base into the served `index.html` as a global the SPA reads before
|
|
28
|
+
* boot, so the client calls the exact base the provider mounted (no build-time coupling). Idempotent
|
|
29
|
+
* per response — inserted right before `</head>`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function injectApiBase(html: string, apiBase: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Inject a `<base href="${mount}/">` as the FIRST thing inside `<head>`, so the SPA's relative
|
|
34
|
+
* `./assets/*` URLs (Vite `base: './'`) resolve against the mount directory no matter whether the
|
|
35
|
+
* browser's URL carries a trailing slash. This replaces the old trailing-slash redirect, which the
|
|
36
|
+
* AdonisJS router (it normalizes trailing slashes) turned into a duplicate-route crash. `mount` is a
|
|
37
|
+
* leading-slash, no-trailing-slash path (e.g. `/agent/dashboard`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function injectBaseHref(html: string, mount: string): string;
|
|
40
|
+
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/dashboard/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9E;AAsBD,8FAA8F;AAC9F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,IAAI,CAU1F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAInE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQlE"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure path/asset helpers for serving the `@adonis-agora/agent-dashboard` governance SPA — extracted
|
|
3
|
+
* so they can be unit-tested without booting an AdonisJS app. Both dashboard providers compose these;
|
|
4
|
+
* each holds only the router wiring + I/O. Owned here (rather than in `@adonis-agora/agent-dashboard`)
|
|
5
|
+
* so `packages/adonis`'s OWN embedded dashboard provider (`providers/dashboard_provider.ts`) can reuse
|
|
6
|
+
* them without depending on the dashboard package at runtime — the dashboard package already depends
|
|
7
|
+
* on THIS one (for `AgentConfig`/`ActorResolver`/...), and a package.json edge the other way would be
|
|
8
|
+
* circular. See `providers/dashboard_provider.ts`'s module doc for the full story.
|
|
9
|
+
*/
|
|
10
|
+
/** Collapse duplicate slashes and strip leading/trailing ones: `/agent//` → `agent`. */
|
|
11
|
+
export function trimSlashes(path) {
|
|
12
|
+
return path.replace(/\/+/g, '/').replace(/^\/+|\/+$/g, '');
|
|
13
|
+
}
|
|
14
|
+
/** The agent API base as an absolute path with a single leading slash: `agent` → `/agent`. */
|
|
15
|
+
export function apiBaseFor(agentPath) {
|
|
16
|
+
const trimmed = trimSlashes(agentPath);
|
|
17
|
+
return trimmed === '' ? '/' : `/${trimmed}`;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The canonical dashboard mount path (no trailing slash), default `<agentPath>/dashboard`. A caller
|
|
21
|
+
* may override with an explicit `dashboardPath`; both are normalized to a single leading slash.
|
|
22
|
+
*/
|
|
23
|
+
export function mountPathFor(agentPath, dashboardPath) {
|
|
24
|
+
if (dashboardPath !== undefined && trimSlashes(dashboardPath) !== '') {
|
|
25
|
+
return `/${trimSlashes(dashboardPath)}`;
|
|
26
|
+
}
|
|
27
|
+
const trimmed = trimSlashes(agentPath);
|
|
28
|
+
return trimmed === '' ? '/dashboard' : `/${trimmed}/dashboard`;
|
|
29
|
+
}
|
|
30
|
+
const CONTENT_TYPES = {
|
|
31
|
+
html: 'text/html; charset=utf-8',
|
|
32
|
+
js: 'text/javascript; charset=utf-8',
|
|
33
|
+
mjs: 'text/javascript; charset=utf-8',
|
|
34
|
+
css: 'text/css; charset=utf-8',
|
|
35
|
+
json: 'application/json; charset=utf-8',
|
|
36
|
+
svg: 'image/svg+xml',
|
|
37
|
+
png: 'image/png',
|
|
38
|
+
jpg: 'image/jpeg',
|
|
39
|
+
jpeg: 'image/jpeg',
|
|
40
|
+
gif: 'image/gif',
|
|
41
|
+
webp: 'image/webp',
|
|
42
|
+
ico: 'image/x-icon',
|
|
43
|
+
woff: 'font/woff',
|
|
44
|
+
woff2: 'font/woff2',
|
|
45
|
+
ttf: 'font/ttf',
|
|
46
|
+
map: 'application/json; charset=utf-8',
|
|
47
|
+
txt: 'text/plain; charset=utf-8',
|
|
48
|
+
};
|
|
49
|
+
/** MIME type for a filename by extension; `application/octet-stream` for anything unknown. */
|
|
50
|
+
export function contentTypeFor(filename) {
|
|
51
|
+
const dot = filename.lastIndexOf('.');
|
|
52
|
+
const ext = dot === -1 ? '' : filename.slice(dot + 1).toLowerCase();
|
|
53
|
+
return CONTENT_TYPES[ext] ?? 'application/octet-stream';
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Reject a wildcard asset request that tries to escape the SPA root via `..` or an absolute path.
|
|
57
|
+
* Returns the safe, normalized relative segments (never starting with `..`), or `null` to deny.
|
|
58
|
+
*/
|
|
59
|
+
export function safeAssetSegments(wildcard) {
|
|
60
|
+
const parts = Array.isArray(wildcard) ? wildcard : (wildcard ?? '').split('/');
|
|
61
|
+
const segments = [];
|
|
62
|
+
for (const raw of parts) {
|
|
63
|
+
const part = raw.trim();
|
|
64
|
+
if (part === '' || part === '.')
|
|
65
|
+
continue;
|
|
66
|
+
if (part === '..' || part.includes('\0') || part.includes('\\'))
|
|
67
|
+
return null;
|
|
68
|
+
segments.push(part);
|
|
69
|
+
}
|
|
70
|
+
return segments;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Inject the resolved agent API base into the served `index.html` as a global the SPA reads before
|
|
74
|
+
* boot, so the client calls the exact base the provider mounted (no build-time coupling). Idempotent
|
|
75
|
+
* per response — inserted right before `</head>`.
|
|
76
|
+
*/
|
|
77
|
+
export function injectApiBase(html, apiBase) {
|
|
78
|
+
const tag = `<script>window.__AGENT_DASHBOARD_BASE__=${JSON.stringify(apiBase)}</script>`;
|
|
79
|
+
if (html.includes('</head>'))
|
|
80
|
+
return html.replace('</head>', `${tag}</head>`);
|
|
81
|
+
return `${tag}${html}`;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Inject a `<base href="${mount}/">` as the FIRST thing inside `<head>`, so the SPA's relative
|
|
85
|
+
* `./assets/*` URLs (Vite `base: './'`) resolve against the mount directory no matter whether the
|
|
86
|
+
* browser's URL carries a trailing slash. This replaces the old trailing-slash redirect, which the
|
|
87
|
+
* AdonisJS router (it normalizes trailing slashes) turned into a duplicate-route crash. `mount` is a
|
|
88
|
+
* leading-slash, no-trailing-slash path (e.g. `/agent/dashboard`).
|
|
89
|
+
*/
|
|
90
|
+
export function injectBaseHref(html, mount) {
|
|
91
|
+
const tag = `<base href="${mount}/">`;
|
|
92
|
+
const headOpen = html.match(/<head[^>]*>/i);
|
|
93
|
+
if (headOpen?.index !== undefined) {
|
|
94
|
+
const at = headOpen.index + headOpen[0].length;
|
|
95
|
+
return html.slice(0, at) + tag + html.slice(at);
|
|
96
|
+
}
|
|
97
|
+
return `${tag}${html}`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/dashboard/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,wFAAwF;AACxF,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,MAAM,OAAO,GAAG,WAAW,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AAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC5C,IAAI,QAAQ,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;QAClC,MAAM,EAAE,GAAG,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,GAAG,GAAG,GAAG,IAAI,EAAE,CAAC;AACzB,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DataProvider } from './telescope-sdk.js';
|
|
2
|
+
/** Shift a `YYYY-MM-DD` UTC day by `deltaDays` (negative goes back in time). */
|
|
3
|
+
export declare function shiftUtcDay(day: string, deltaDays: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* Derive the query range: honour explicit `fromDay`/`toDay` (validated ISO days), otherwise default
|
|
6
|
+
* to the trailing {@link DEFAULT_TREND_WINDOW_DAYS}-day window ending today (UTC).
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveRange(query: Record<string, unknown> | undefined): {
|
|
9
|
+
fromDay: string;
|
|
10
|
+
toDay: string;
|
|
11
|
+
};
|
|
12
|
+
/** Cap a run's error message to {@link ERROR_MESSAGE_CAP} characters. `resolve()` output bypasses
|
|
13
|
+
* Telescope's entry redaction pipeline (that only runs on Watcher-recorded entries) — this cap is a
|
|
14
|
+
* stopgap so an unbounded stack trace never rides straight into a table cell unbounded. */
|
|
15
|
+
export declare function capErrorMessage(message: string | null): string;
|
|
16
|
+
/** stat → authoritative total spend (USD) over the range. */
|
|
17
|
+
export declare function agentSpendTotalProvider(): DataProvider;
|
|
18
|
+
/** stat → authoritative total tokens (input + output) over the range. */
|
|
19
|
+
export declare function agentTokensTotalProvider(): DataProvider;
|
|
20
|
+
/** breakdown → spend share per model (models with zero cost dropped from the donut). */
|
|
21
|
+
export declare function agentSpendByModelProvider(): DataProvider;
|
|
22
|
+
/** table → per-model requests / in+out tokens / cost. */
|
|
23
|
+
export declare function agentModelSpendTableProvider(): DataProvider;
|
|
24
|
+
/** timeseries → daily spend + tokens trend. */
|
|
25
|
+
export declare function agentUsageTrendProvider(): DataProvider;
|
|
26
|
+
/** table → spend per acting ref (user/tenant). */
|
|
27
|
+
export declare function agentActorSpendTableProvider(): DataProvider;
|
|
28
|
+
/** breakdown → spend share per actor (actors with zero cost dropped). */
|
|
29
|
+
export declare function agentSpendByActorProvider(): DataProvider;
|
|
30
|
+
/** stat → total runs over the range. */
|
|
31
|
+
export declare function agentRunsTotalProvider(): DataProvider;
|
|
32
|
+
/** stat → completed/total success rate over the range. */
|
|
33
|
+
export declare function agentRunsSuccessRateProvider(): DataProvider;
|
|
34
|
+
/** stat → failed run count over the range. */
|
|
35
|
+
export declare function agentRunsFailedProvider(): DataProvider;
|
|
36
|
+
/**
|
|
37
|
+
* stat → MEAN settled-run duration over the range. Not a percentile: `RunReliability` exposes only
|
|
38
|
+
* `avgDurationMs` (see this file's header) — there is no p50/p95 to select between, unlike the Nest
|
|
39
|
+
* reference's `query.metric` switch. `null` (no settled runs) resolves to 0.
|
|
40
|
+
*/
|
|
41
|
+
export declare function agentRunsDurationProvider(): DataProvider;
|
|
42
|
+
/** table → run/failure rollup per agent (empty when the adapter predates `byAgent`). */
|
|
43
|
+
export declare function agentRunsByAgentTableProvider(): DataProvider;
|
|
44
|
+
/** timeseries → daily runs + failures trend (empty when the adapter predates `trend`). */
|
|
45
|
+
export declare function agentRunsTrendProvider(): DataProvider;
|
|
46
|
+
/** table → most recent runs (newest first), via `listRuns`' first page — see this file's header for
|
|
47
|
+
* why this isn't the paged-table protocol. errorMessage capped per {@link capErrorMessage}. */
|
|
48
|
+
export declare function agentRecentRunsTableProvider(): DataProvider;
|
|
49
|
+
/** table → most recent tool calls (newest first), from the durable read-model. */
|
|
50
|
+
export declare function agentRecentToolCallsTableProvider(): DataProvider;
|
|
51
|
+
/** table → most recently active threads, with rolled-up message/token counts. */
|
|
52
|
+
export declare function agentRecentThreadsTableProvider(): DataProvider;
|
|
53
|
+
/**
|
|
54
|
+
* stat → an APPROXIMATE count of tool calls sitting `pending_approval`, capped at
|
|
55
|
+
* {@link MAX_RECENT_LIMIT}. `AgentGovernanceQueries.pendingApprovals` has no `total` — unlike the
|
|
56
|
+
* Nest reference's exact `approvalsPage({ page: 1, pageSize: 1 }).total`, there is no cheap "how
|
|
57
|
+
* many, without listing them" query on this SPI (see this file's header). A backlog past the cap
|
|
58
|
+
* undercounts here exactly the way Nest's OLD `pendingApprovals(500).length` did before it got an
|
|
59
|
+
* exact query — that regression is accepted, not fixed, until `AgentGovernanceQueries` grows one.
|
|
60
|
+
*/
|
|
61
|
+
export declare function agentPendingApprovalsCountProvider(): DataProvider;
|
|
62
|
+
/** table → the pending-approvals inbox, oldest request first. */
|
|
63
|
+
export declare function agentPendingApprovalsTableProvider(): DataProvider;
|
|
64
|
+
/** table → per-tool call/failure/rejection/latency rollup over the range. Only ONE latency column
|
|
65
|
+
* (`avgDurationMs`) — `PerToolStatRow` has no p50/p95 split, unlike the Nest reference's table. */
|
|
66
|
+
export declare function agentToolStatsTableProvider(): DataProvider;
|
|
67
|
+
//# sourceMappingURL=agent-governance-providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-governance-providers.d.ts","sourceRoot":"","sources":["../../../src/telescope/agent-governance-providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC;AA4DzE,gFAAgF;AAChF,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAIlE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,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