@happyvertical/smrt-agents 0.35.3 → 0.36.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/manifest.json +2 -2
- package/dist/smrt-knowledge.json +4 -4
- package/dist/ui.d.ts +9 -21
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/package.json +9 -9
package/dist/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0.0",
|
|
3
|
-
"timestamp":
|
|
3
|
+
"timestamp": 1782368754886,
|
|
4
4
|
"packageName": "@happyvertical/smrt-agents",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.36.0",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-agents:Agent": {
|
|
8
8
|
"name": "agent",
|
package/dist/smrt-knowledge.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
|
-
"generatedAt": "2026-06-
|
|
3
|
+
"generatedAt": "2026-06-25T06:25:55.247Z",
|
|
4
4
|
"packageName": "@happyvertical/smrt-agents",
|
|
5
|
-
"packageVersion": "0.
|
|
5
|
+
"packageVersion": "0.36.0",
|
|
6
6
|
"sourceManifestPath": "dist/manifest.json",
|
|
7
7
|
"agentDocPath": "AGENTS.md",
|
|
8
8
|
"sourceHashes": {
|
|
9
|
-
"manifest": "
|
|
10
|
-
"packageJson": "
|
|
9
|
+
"manifest": "156fda493b552573dbc260c634d20707ddf76874189ac999145caf0fd74655b7",
|
|
10
|
+
"packageJson": "369344109e6854993fdc0fbebec1503b0d57f3b7bba650cb5514ea29b319414e",
|
|
11
11
|
"agents": "3cdef62db9f57de1f5675726cdc54b3e64e9d39e67ad316904d08212cf046112"
|
|
12
12
|
},
|
|
13
13
|
"exports": [
|
package/dist/ui.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';
|
|
1
|
+
import { ModuleComponentType, ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';
|
|
2
2
|
/**
|
|
3
3
|
* UI type definitions for SMRT Agents
|
|
4
4
|
*
|
|
@@ -17,28 +17,16 @@ import { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
/**
|
|
20
|
-
* Svelte component type
|
|
20
|
+
* Svelte component type for agent admin-panel slots.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* The `any`s here are irreducible (#1579, S4): this placeholder must be
|
|
29
|
-
* simultaneously assignable FROM arbitrary concrete Svelte components (the
|
|
30
|
-
* `register()`/`registerByKey()` storage side) and assignable TO Svelte's
|
|
31
|
-
* `ConstructorOfATypedSvelteComponent | Component<any, any, any>` render union
|
|
32
|
-
* (the `<Component this={...} />` site in AgentAdminPanel.svelte). Under
|
|
33
|
-
* `strictFunctionTypes` no single non-`any` function type satisfies both
|
|
34
|
-
* directions, and aliasing to svelte's `Component<Props>` additionally trips
|
|
35
|
-
* the `Props extends Record<string, any>` constraint against the registry's
|
|
36
|
-
* `register<TProps extends AdminPanelBaseProps>` generic (an interface with no
|
|
37
|
-
* index signature). This mirrors the unresolved `ModuleComponentType` in
|
|
38
|
-
* `@happyvertical/smrt-types` and `createModuleUIRegistry` in
|
|
39
|
-
* `@happyvertical/smrt-ui`.
|
|
22
|
+
* Re-exported from the canonical {@link ModuleComponentType} in
|
|
23
|
+
* `@happyvertical/smrt-types` — the single shared definition that owns the
|
|
24
|
+
* irreducible `any` (see its inline note: the placeholder must be assignable
|
|
25
|
+
* both FROM arbitrary concrete components and TO Svelte's render union, which
|
|
26
|
+
* no non-`any` type satisfies under `strictFunctionTypes`). Aliased here so
|
|
27
|
+
* this package's public UI surface keeps the local `ComponentType` name.
|
|
40
28
|
*/
|
|
41
|
-
export type ComponentType<Props =
|
|
29
|
+
export type ComponentType<Props = unknown> = ModuleComponentType<Props>;
|
|
42
30
|
/**
|
|
43
31
|
* Base props that all admin panel components receive
|
|
44
32
|
*/
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,CAAC,KAAK,GAAG,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,OAAO,GAAG,OAAO;IACpD,8DAA8D;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB,6CAA6C;IAC7C,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,+EAA+E;IAC/E,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DA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AC;IAEb,IAAI,qBAAqB,EAAE,wBAAwB,GAAG,SAAS,CAAC;CACjE;AAKD,eAAO,MAAM,eAAe,EAAE,wBACI,CAAC;AAEnC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gFAAgF;IAChF,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,+CAA+C;IAC/C,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA8CxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAWhC,CAAC"}
|
package/dist/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sources":["../src/ui.ts"],"sourcesContent":["import type { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';\n\n/**\n * UI type definitions for SMRT Agents\n *\n * These types allow agents to declare admin panel UI slots\n * that can be implemented as Svelte components in agent packages.\n *\n * @example\n * ```typescript\n * import { AgentUIRegistry, type AdminPanelBaseProps } from '@happyvertical/smrt-agents/ui';\n *\n * // In agent package: register components at import time\n * AgentUIRegistry.register('MyAgent', 'settings', SettingsPanel);\n *\n * // In host app: use registered components\n * const Component = AgentUIRegistry.get('MyAgent', 'settings');\n * ```\n */\n\n/**\n * Svelte component type (compatible with svelte's ComponentType)\n *\n * Using a generic function type to avoid requiring svelte as a dependency\n * and to avoid DOM type references that don't exist in Node.js builds.\n *\n * In practice, the actual Svelte component will be passed and used\n * with `<svelte:component this={Component} />` in SvelteKit apps.\n *\n * The `any`s here are irreducible (#1579, S4): this placeholder must be\n * simultaneously assignable FROM arbitrary concrete Svelte components (the\n * `register()`/`registerByKey()` storage side) and assignable TO Svelte's\n * `ConstructorOfATypedSvelteComponent | Component<any, any, any>` render union\n * (the `<Component this={...} />` site in AgentAdminPanel.svelte). Under\n * `strictFunctionTypes` no single non-`any` function type satisfies both\n * directions, and aliasing to svelte's `Component<Props>` additionally trips\n * the `Props extends Record<string, any>` constraint against the registry's\n * `register<TProps extends AdminPanelBaseProps>` generic (an interface with no\n * index signature). This mirrors the unresolved `ModuleComponentType` in\n * `@happyvertical/smrt-types` and `createModuleUIRegistry` in\n * `@happyvertical/smrt-ui`.\n */\nexport type ComponentType<Props = any> = (...args: any[]) => any;\n\n/**\n * Base props that all admin panel components receive\n */\nexport interface AdminPanelBaseProps<TConfig = unknown> {\n /** Current configuration from the agent (merged file + db) */\n config: TConfig;\n /** Callback to save configuration changes */\n onSave: (config: TConfig) => Promise<void>;\n /** Whether the panel is in read-only mode */\n readonly?: boolean;\n /** CSS class for styling integration */\n class?: string;\n /**\n * Read-only file-based configuration defaults (from smrt.config.js)\n * Use this to display which values come from the config file\n */\n fileConfig?: TConfig;\n /**\n * Editable database-persisted configuration overrides\n * Use this to display which values have been customized in the DB\n */\n dbConfig?: TConfig;\n}\n\n/**\n * Definition of a UI slot that an agent declares\n *\n * Agents define slots they support; UI packages implement them.\n */\nexport interface AgentUISlot {\n /** Unique identifier for this slot (e.g., 'sources', 'reports', 'settings') */\n id: string;\n /** Human-readable label for the slot */\n label: string;\n /** Description of what this panel configures */\n description?: string;\n /** Icon identifier (e.g., 'settings', 'database', 'users') */\n icon?: string;\n /** Display order (lower numbers first) */\n order?: number;\n /** Whether the slot is currently unavailable in the admin UI */\n disabled?: boolean;\n}\n\n/**\n * Map of slot IDs to their definitions\n * Used as static property on Agent subclasses\n */\nexport type AgentUISlots = Record<string, AgentUISlot>;\n\n/**\n * A route an agent provides for its admin UI\n *\n * Agents declare these so that host applications or tooling\n * (for example, a Vite plugin) can wire them into a SvelteKit app.\n *\n * @example\n * ```typescript\n * static adminRoutes: AgentAdminRoute[] = [\n * { path: 'sources', component: 'SourcesPanel', load: 'loadSources' },\n * { path: 'sources/[sourceId]', component: 'SourceDetail', load: 'loadSourceDetail' },\n * ];\n * ```\n */\nexport interface AgentAdminRoute {\n /** Route path relative to agent root (e.g., 'sources/[sourceId]') */\n path: string;\n /** Component export name from the agent's admin entry point */\n component: string;\n /** Optional: export name for server load function */\n load?: string;\n}\n\n/**\n * Context passed to agent route load functions\n *\n * A normalized subset of SvelteKit's ServerLoadEvent,\n * so agent load functions don't need a direct SvelteKit dependency.\n */\nexport interface AgentRouteLoadContext {\n params: Record<string, string>;\n parent: () => Promise<Record<string, unknown>>;\n fetch: typeof fetch;\n url: URL;\n}\n\n/**\n * Agent route load function signature\n *\n * Returned data is spread into the page's `data` prop.\n */\nexport type AgentRouteLoadFn = (\n context: AgentRouteLoadContext,\n) => Promise<Record<string, unknown>> | Record<string, unknown>;\n\n/**\n * Agent manifest type (re-exported from smrt-core scanner types)\n * Duplicated here to avoid hard dependency on scanner internals\n */\nexport interface AgentManifestInfo {\n name: string;\n slug: string;\n icon?: string;\n tier: 'free' | 'standard' | 'premium';\n description?: string;\n uiSlots: Record<string, AgentUISlot>;\n adminRoutes?: AgentAdminRoute[];\n /** Default signal subscriptions declared by this agent */\n signalSubscriptions?: string[];\n permissions: Array<{\n id: string;\n label: string;\n category: string;\n defaultGranted?: boolean;\n }>;\n features: Array<{\n id: string;\n label: string;\n description?: string;\n type: string;\n }>;\n menuItems: Array<{\n id: string;\n label: string;\n icon?: string;\n order: number;\n path: string;\n requiredPermission?: string;\n }>;\n components: Array<{ exportPath: string; type: string }>;\n}\n\n/**\n * Registry of UI component implementations\n * Maps agent class name + slot ID to Svelte component\n */\nexport interface AgentUIComponentRegistry {\n /** Register a component for an agent's slot */\n register<TProps extends AdminPanelBaseProps>(\n agentClass: string,\n slotId: string,\n component: ComponentType<TProps>,\n ): void;\n\n /** Get a component for an agent's slot */\n get<TProps extends AdminPanelBaseProps>(\n agentClass: string,\n slotId: string,\n ): ComponentType<TProps> | undefined;\n\n /** Get all registered slot IDs for an agent */\n getSlots(agentClass: string): string[];\n\n /** Check if a component is registered */\n has(agentClass: string, slotId: string): boolean;\n\n /** Get all registered agent class names */\n getAgents(): string[];\n\n /** Unregister a component (useful for testing) */\n unregister(agentClass: string, slotId: string): boolean;\n\n /** Clear all registrations (useful for testing) */\n clear(): void;\n\n /** Register a component by composite key (e.g., 'praeco:sources') */\n registerByKey(key: string, component: ComponentType): void;\n\n /** Get a component by composite key */\n getByKey(key: string): ComponentType | undefined;\n\n /** Register an agent manifest for runtime access */\n registerManifest(agentClass: string, manifest: AgentManifestInfo): void;\n\n /** Get a registered agent manifest */\n getManifest(agentClass: string): AgentManifestInfo | undefined;\n\n /** Get all registered manifests */\n getAllManifests(): Map<string, AgentManifestInfo>;\n\n /** Register a route component for an agent */\n registerRouteComponent(\n agentClass: string,\n path: string,\n component: ComponentType,\n ): void;\n\n /** Get a route component for an agent */\n getRouteComponent(\n agentClass: string,\n path: string,\n ): ComponentType | undefined;\n\n /** Register a route load function for an agent */\n registerRouteLoad(\n agentClass: string,\n path: string,\n loadFn: AgentRouteLoadFn,\n ): void;\n\n /** Get a route load function for an agent */\n getRouteLoad(agentClass: string, path: string): AgentRouteLoadFn | undefined;\n}\n\n/**\n * Create a new UI component registry\n *\n * @example\n * ```typescript\n * const registry = createUIRegistry();\n * registry.register('MyAgent', 'settings', SettingsPanel);\n *\n * const Component = registry.get('MyAgent', 'settings');\n * if (Component) {\n * // Render component\n * }\n * ```\n */\nexport function createUIRegistry(): AgentUIComponentRegistry {\n const components = new Map<string, ComponentType>();\n const manifests = new Map<string, AgentManifestInfo>();\n const routeComponents = new Map<string, ComponentType>();\n const routeLoads = new Map<string, AgentRouteLoadFn>();\n\n const makeKey = (agentClass: string, slotId: string) =>\n `${agentClass}:${slotId}`;\n\n const makeRouteKey = (agentClass: string, path: string) =>\n `${agentClass}:route:${path}`;\n\n return {\n register(agentClass, slotId, component) {\n components.set(makeKey(agentClass, slotId), component);\n },\n\n get(agentClass, slotId) {\n return components.get(makeKey(agentClass, slotId));\n },\n\n getSlots(agentClass) {\n const prefix = `${agentClass}:`;\n return Array.from(components.keys())\n .filter((k) => k.startsWith(prefix))\n .map((k) => k.slice(prefix.length));\n },\n\n has(agentClass, slotId) {\n return components.has(makeKey(agentClass, slotId));\n },\n\n getAgents() {\n const agents = new Set<string>();\n for (const key of components.keys()) {\n const agentClass = key.split(':')[0];\n agents.add(agentClass);\n }\n return Array.from(agents);\n },\n\n unregister(agentClass, slotId) {\n return components.delete(makeKey(agentClass, slotId));\n },\n\n clear() {\n components.clear();\n manifests.clear();\n routeComponents.clear();\n routeLoads.clear();\n },\n\n registerByKey(key, component) {\n components.set(key, component);\n },\n\n getByKey(key) {\n return components.get(key);\n },\n\n registerManifest(agentClass, manifest) {\n manifests.set(agentClass, manifest);\n },\n\n getManifest(agentClass) {\n return manifests.get(agentClass);\n },\n\n getAllManifests() {\n return new Map(manifests);\n },\n\n registerRouteComponent(agentClass, path, component) {\n routeComponents.set(makeRouteKey(agentClass, path), component);\n },\n\n getRouteComponent(agentClass, path) {\n return routeComponents.get(makeRouteKey(agentClass, path));\n },\n\n registerRouteLoad(agentClass, path, loadFn) {\n routeLoads.set(makeRouteKey(agentClass, path), loadFn);\n },\n\n getRouteLoad(agentClass, path) {\n return routeLoads.get(makeRouteKey(agentClass, path));\n },\n };\n}\n\n/**\n * Global UI registry singleton\n *\n * Agent UI packages register their components here at import time,\n * enabling discovery by host applications.\n *\n * Uses a `globalThis.__smrtAgentUIRegistry` property to guarantee a\n * single registry instance per JavaScript runtime, even when bundlers\n * (Vite, webpack) duplicate this module across optimized dependency\n * chunks or package versions.\n *\n * @example\n * ```typescript\n * // In agent package (e.g., @happyvertical/praeco/admin)\n * import { AgentUIRegistry } from '@happyvertical/smrt-agents/ui';\n * import SourcesPanel from './SourcesPanel.svelte';\n *\n * AgentUIRegistry.register('Praeco', 'sources', SourcesPanel);\n *\n * // In host SvelteKit app\n * import { AgentUIRegistry } from '@happyvertical/smrt-agents/ui';\n * import '@happyvertical/praeco/admin'; // Registers components\n *\n * const Component = AgentUIRegistry.get('Praeco', 'sources');\n * ```\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtAgentUIRegistry: AgentUIComponentRegistry | undefined;\n}\n\nif (!globalThis.__smrtAgentUIRegistry) {\n globalThis.__smrtAgentUIRegistry = createUIRegistry();\n}\nexport const AgentUIRegistry: AgentUIComponentRegistry =\n globalThis.__smrtAgentUIRegistry;\n\n/**\n * What an agent's `./admin` entry point must export.\n *\n * This is the contract between agent packages and host apps.\n * Instead of registering individual slot components, agents export\n * a single root component that handles its own sub-navigation.\n *\n * @example\n * ```typescript\n * // In agent package: histrio/src/ui/admin/index.ts\n * export { default } from './AdminRoot.svelte';\n * export { createAPIClient } from '../types.js';\n * export const navItems: AgentAdminNavItem[] = [\n * { id: 'characters', label: 'Characters', icon: 'users', order: 1 },\n * { id: 'performers', label: 'Performers', icon: 'mic', order: 2 },\n * ];\n * ```\n */\nexport interface AgentAdminExport {\n /** Root admin component — renders all panels, handles its own sub-navigation */\n default?: ComponentType;\n /** Create a typed API client for this agent */\n createAPIClient?: (baseUrl: string) => unknown;\n /** Navigation items for tabs/sidebar within the agent admin */\n navItems?: AgentAdminNavItem[];\n}\n\n/**\n * Props passed to the root admin component\n */\nexport interface AgentAdminRootProps {\n /** Typed API client created by the agent's own factory */\n apiClient: unknown;\n /** Which panel to show (from URL hash, e.g., 'sources') */\n activePanel?: string;\n /** Called when user navigates within the agent */\n onNavigate?: (panelId: string) => void;\n /** Whether admin is in read-only mode */\n readonly?: boolean;\n}\n\n/**\n * Navigation item within an agent's admin UI\n */\nexport interface AgentAdminNavItem {\n /** Matches hash fragment and panel ID */\n id: string;\n /** Display label */\n label: string;\n /** Icon identifier */\n icon?: string;\n /** Display order (lower numbers first) */\n order?: number;\n}\n\n/**\n * Agents module UI slots (for ModuleUIRegistry)\n */\nexport const AGENTS_UI_SLOTS: Record<string, ModuleUISlot> = {\n 'agent-dashboard': {\n id: 'agent-dashboard',\n label: 'Agent Dashboard',\n description: 'Combined overview panel for agent schedules',\n icon: 'activity',\n category: 'admin',\n order: 1,\n propsInterface: 'AgentDashboardProps',\n },\n 'agent-schedule-list': {\n id: 'agent-schedule-list',\n label: 'Agent Schedule List',\n description: 'List of scheduled agents',\n icon: 'calendar',\n category: 'list',\n order: 2,\n propsInterface: 'AgentScheduleListProps',\n },\n 'agent-schedule-form': {\n id: 'agent-schedule-form',\n label: 'Agent Schedule Form',\n description: 'Form for creating or editing agent schedules',\n icon: 'edit',\n category: 'form',\n order: 3,\n propsInterface: 'AgentScheduleFormProps',\n },\n 'agent-run-history': {\n id: 'agent-run-history',\n label: 'Agent Run History',\n description: 'History of agent runs',\n icon: 'clock',\n category: 'list',\n order: 4,\n propsInterface: 'AgentRunHistoryProps',\n },\n 'schedule-status-badge': {\n id: 'schedule-status-badge',\n label: 'Schedule Status Badge',\n description: 'Status indicator for schedule states',\n icon: 'tag',\n category: 'display',\n order: 5,\n propsInterface: 'ScheduleStatusBadgeProps',\n },\n};\n\n/**\n * Agents module metadata\n */\nexport const AGENTS_MODULE_META: SmrtModuleMeta = {\n name: '@happyvertical/smrt-agents',\n displayName: 'Agents',\n description: 'Agent framework for building autonomous actors',\n uiSlots: AGENTS_UI_SLOTS,\n models: ['Agent', 'AgentConfig', 'AgentSchedule', 'TenantAgent'],\n collections: [\n 'AgentConfigCollection',\n 'AgentScheduleCollection',\n 'TenantAgentCollection',\n ],\n};\n"],"names":[],"mappings":"AAsQO,SAAS,mBAA6C;AAC3D,QAAM,iCAAiB,IAAA;AACvB,QAAM,gCAAgB,IAAA;AACtB,QAAM,sCAAsB,IAAA;AAC5B,QAAM,iCAAiB,IAAA;AAEvB,QAAM,UAAU,CAAC,YAAoB,WACnC,GAAG,UAAU,IAAI,MAAM;AAEzB,QAAM,eAAe,CAAC,YAAoB,SACxC,GAAG,UAAU,UAAU,IAAI;AAE7B,SAAO;AAAA,IACL,SAAS,YAAY,QAAQ,WAAW;AACtC,iBAAW,IAAI,QAAQ,YAAY,MAAM,GAAG,SAAS;AAAA,IACvD;AAAA,IAEA,IAAI,YAAY,QAAQ;AACtB,aAAO,WAAW,IAAI,QAAQ,YAAY,MAAM,CAAC;AAAA,IACnD;AAAA,IAEA,SAAS,YAAY;AACnB,YAAM,SAAS,GAAG,UAAU;AAC5B,aAAO,MAAM,KAAK,WAAW,KAAA,CAAM,EAChC,OAAO,CAAC,MAAM,EAAE,WAAW,MAAM,CAAC,EAClC,IAAI,CAAC,MAAM,EAAE,MAAM,OAAO,MAAM,CAAC;AAAA,IACtC;AAAA,IAEA,IAAI,YAAY,QAAQ;AACtB,aAAO,WAAW,IAAI,QAAQ,YAAY,MAAM,CAAC;AAAA,IACnD;AAAA,IAEA,YAAY;AACV,YAAM,6BAAa,IAAA;AACnB,iBAAW,OAAO,WAAW,QAAQ;AACnC,cAAM,aAAa,IAAI,MAAM,GAAG,EAAE,CAAC;AACnC,eAAO,IAAI,UAAU;AAAA,MACvB;AACA,aAAO,MAAM,KAAK,MAAM;AAAA,IAC1B;AAAA,IAEA,WAAW,YAAY,QAAQ;AAC7B,aAAO,WAAW,OAAO,QAAQ,YAAY,MAAM,C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ACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAAA,EAElB,uBAAuB;AAAA,IACrB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAAA,EAElB,qBAAqB;AAAA,IACnB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAAA,EAElB,yBAAyB;AAAA,IACvB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAEpB;AAKO,MAAM,qBAAqC;AAAA,EAChD,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,SAAS,eAAe,iBAAiB,aAAa;AAAA,EAC/D,aAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ui.js","sources":["../src/ui.ts"],"sourcesContent":["import type {\n ModuleComponentType,\n ModuleUISlot,\n SmrtModuleMeta,\n} from '@happyvertical/smrt-types';\n\n/**\n * UI type definitions for SMRT Agents\n *\n * These types allow agents to declare admin panel UI slots\n * that can be implemented as Svelte components in agent packages.\n *\n * @example\n * ```typescript\n * import { AgentUIRegistry, type AdminPanelBaseProps } from '@happyvertical/smrt-agents/ui';\n *\n * // In agent package: register components at import time\n * AgentUIRegistry.register('MyAgent', 'settings', SettingsPanel);\n *\n * // In host app: use registered components\n * const Component = AgentUIRegistry.get('MyAgent', 'settings');\n * ```\n */\n\n/**\n * Svelte component type for agent admin-panel slots.\n *\n * Re-exported from the canonical {@link ModuleComponentType} in\n * `@happyvertical/smrt-types` — the single shared definition that owns the\n * irreducible `any` (see its inline note: the placeholder must be assignable\n * both FROM arbitrary concrete components and TO Svelte's render union, which\n * no non-`any` type satisfies under `strictFunctionTypes`). Aliased here so\n * this package's public UI surface keeps the local `ComponentType` name.\n */\nexport type ComponentType<Props = unknown> = ModuleComponentType<Props>;\n\n/**\n * Base props that all admin panel components receive\n */\nexport interface AdminPanelBaseProps<TConfig = unknown> {\n /** Current configuration from the agent (merged file + db) */\n config: TConfig;\n /** Callback to save configuration changes */\n onSave: (config: TConfig) => Promise<void>;\n /** Whether the panel is in read-only mode */\n readonly?: boolean;\n /** CSS class for styling integration */\n class?: string;\n /**\n * Read-only file-based configuration defaults (from smrt.config.js)\n * Use this to display which values come from the config file\n */\n fileConfig?: TConfig;\n /**\n * Editable database-persisted configuration overrides\n * Use this to display which values have been customized in the DB\n */\n dbConfig?: TConfig;\n}\n\n/**\n * Definition of a UI slot that an agent declares\n *\n * Agents define slots they support; UI packages implement them.\n */\nexport interface AgentUISlot {\n /** Unique identifier for this slot (e.g., 'sources', 'reports', 'settings') */\n id: string;\n /** Human-readable label for the slot */\n label: string;\n /** Description of what this panel configures */\n description?: string;\n /** Icon identifier (e.g., 'settings', 'database', 'users') */\n icon?: string;\n /** Display order (lower numbers first) */\n order?: number;\n /** Whether the slot is currently unavailable in the admin UI */\n disabled?: boolean;\n}\n\n/**\n * Map of slot IDs to their definitions\n * Used as static property on Agent subclasses\n */\nexport type AgentUISlots = Record<string, AgentUISlot>;\n\n/**\n * A route an agent provides for its admin UI\n *\n * Agents declare these so that host applications or tooling\n * (for example, a Vite plugin) can wire them into a SvelteKit app.\n *\n * @example\n * ```typescript\n * static adminRoutes: AgentAdminRoute[] = [\n * { path: 'sources', component: 'SourcesPanel', load: 'loadSources' },\n * { path: 'sources/[sourceId]', component: 'SourceDetail', load: 'loadSourceDetail' },\n * ];\n * ```\n */\nexport interface AgentAdminRoute {\n /** Route path relative to agent root (e.g., 'sources/[sourceId]') */\n path: string;\n /** Component export name from the agent's admin entry point */\n component: string;\n /** Optional: export name for server load function */\n load?: string;\n}\n\n/**\n * Context passed to agent route load functions\n *\n * A normalized subset of SvelteKit's ServerLoadEvent,\n * so agent load functions don't need a direct SvelteKit dependency.\n */\nexport interface AgentRouteLoadContext {\n params: Record<string, string>;\n parent: () => Promise<Record<string, unknown>>;\n fetch: typeof fetch;\n url: URL;\n}\n\n/**\n * Agent route load function signature\n *\n * Returned data is spread into the page's `data` prop.\n */\nexport type AgentRouteLoadFn = (\n context: AgentRouteLoadContext,\n) => Promise<Record<string, unknown>> | Record<string, unknown>;\n\n/**\n * Agent manifest type (re-exported from smrt-core scanner types)\n * Duplicated here to avoid hard dependency on scanner internals\n */\nexport interface AgentManifestInfo {\n name: string;\n slug: string;\n icon?: string;\n tier: 'free' | 'standard' | 'premium';\n description?: string;\n uiSlots: Record<string, AgentUISlot>;\n adminRoutes?: AgentAdminRoute[];\n /** Default signal subscriptions declared by this agent */\n signalSubscriptions?: string[];\n permissions: Array<{\n id: string;\n label: string;\n category: string;\n defaultGranted?: boolean;\n }>;\n features: Array<{\n id: string;\n label: string;\n description?: string;\n type: string;\n }>;\n menuItems: Array<{\n id: string;\n label: string;\n icon?: string;\n order: number;\n path: string;\n requiredPermission?: string;\n }>;\n components: Array<{ exportPath: string; type: string }>;\n}\n\n/**\n * Registry of UI component implementations\n * Maps agent class name + slot ID to Svelte component\n */\nexport interface AgentUIComponentRegistry {\n /** Register a component for an agent's slot */\n register<TProps extends AdminPanelBaseProps>(\n agentClass: string,\n slotId: string,\n component: ComponentType<TProps>,\n ): void;\n\n /** Get a component for an agent's slot */\n get<TProps extends AdminPanelBaseProps>(\n agentClass: string,\n slotId: string,\n ): ComponentType<TProps> | undefined;\n\n /** Get all registered slot IDs for an agent */\n getSlots(agentClass: string): string[];\n\n /** Check if a component is registered */\n has(agentClass: string, slotId: string): boolean;\n\n /** Get all registered agent class names */\n getAgents(): string[];\n\n /** Unregister a component (useful for testing) */\n unregister(agentClass: string, slotId: string): boolean;\n\n /** Clear all registrations (useful for testing) */\n clear(): void;\n\n /** Register a component by composite key (e.g., 'praeco:sources') */\n registerByKey(key: string, component: ComponentType): void;\n\n /** Get a component by composite key */\n getByKey(key: string): ComponentType | undefined;\n\n /** Register an agent manifest for runtime access */\n registerManifest(agentClass: string, manifest: AgentManifestInfo): void;\n\n /** Get a registered agent manifest */\n getManifest(agentClass: string): AgentManifestInfo | undefined;\n\n /** Get all registered manifests */\n getAllManifests(): Map<string, AgentManifestInfo>;\n\n /** Register a route component for an agent */\n registerRouteComponent(\n agentClass: string,\n path: string,\n component: ComponentType,\n ): void;\n\n /** Get a route component for an agent */\n getRouteComponent(\n agentClass: string,\n path: string,\n ): ComponentType | undefined;\n\n /** Register a route load function for an agent */\n registerRouteLoad(\n agentClass: string,\n path: string,\n loadFn: AgentRouteLoadFn,\n ): void;\n\n /** Get a route load function for an agent */\n getRouteLoad(agentClass: string, path: string): AgentRouteLoadFn | undefined;\n}\n\n/**\n * Create a new UI component registry\n *\n * @example\n * ```typescript\n * const registry = createUIRegistry();\n * registry.register('MyAgent', 'settings', SettingsPanel);\n *\n * const Component = registry.get('MyAgent', 'settings');\n * if (Component) {\n * // Render component\n * }\n * ```\n */\nexport function createUIRegistry(): AgentUIComponentRegistry {\n const components = new Map<string, ComponentType>();\n const manifests = new Map<string, AgentManifestInfo>();\n const routeComponents = new Map<string, ComponentType>();\n const routeLoads = new Map<string, AgentRouteLoadFn>();\n\n const makeKey = (agentClass: string, slotId: string) =>\n `${agentClass}:${slotId}`;\n\n const makeRouteKey = (agentClass: string, path: string) =>\n `${agentClass}:route:${path}`;\n\n return {\n register(agentClass, slotId, component) {\n components.set(makeKey(agentClass, slotId), component);\n },\n\n get(agentClass, slotId) {\n return components.get(makeKey(agentClass, slotId));\n },\n\n getSlots(agentClass) {\n const prefix = `${agentClass}:`;\n return Array.from(components.keys())\n .filter((k) => k.startsWith(prefix))\n .map((k) => k.slice(prefix.length));\n },\n\n has(agentClass, slotId) {\n return components.has(makeKey(agentClass, slotId));\n },\n\n getAgents() {\n const agents = new Set<string>();\n for (const key of components.keys()) {\n const agentClass = key.split(':')[0];\n agents.add(agentClass);\n }\n return Array.from(agents);\n },\n\n unregister(agentClass, slotId) {\n return components.delete(makeKey(agentClass, slotId));\n },\n\n clear() {\n components.clear();\n manifests.clear();\n routeComponents.clear();\n routeLoads.clear();\n },\n\n registerByKey(key, component) {\n components.set(key, component);\n },\n\n getByKey(key) {\n return components.get(key);\n },\n\n registerManifest(agentClass, manifest) {\n manifests.set(agentClass, manifest);\n },\n\n getManifest(agentClass) {\n return manifests.get(agentClass);\n },\n\n getAllManifests() {\n return new Map(manifests);\n },\n\n registerRouteComponent(agentClass, path, component) {\n routeComponents.set(makeRouteKey(agentClass, path), component);\n },\n\n getRouteComponent(agentClass, path) {\n return routeComponents.get(makeRouteKey(agentClass, path));\n },\n\n registerRouteLoad(agentClass, path, loadFn) {\n routeLoads.set(makeRouteKey(agentClass, path), loadFn);\n },\n\n getRouteLoad(agentClass, path) {\n return routeLoads.get(makeRouteKey(agentClass, path));\n },\n };\n}\n\n/**\n * Global UI registry singleton\n *\n * Agent UI packages register their components here at import time,\n * enabling discovery by host applications.\n *\n * Uses a `globalThis.__smrtAgentUIRegistry` property to guarantee a\n * single registry instance per JavaScript runtime, even when bundlers\n * (Vite, webpack) duplicate this module across optimized dependency\n * chunks or package versions.\n *\n * @example\n * ```typescript\n * // In agent package (e.g., @happyvertical/praeco/admin)\n * import { AgentUIRegistry } from '@happyvertical/smrt-agents/ui';\n * import SourcesPanel from './SourcesPanel.svelte';\n *\n * AgentUIRegistry.register('Praeco', 'sources', SourcesPanel);\n *\n * // In host SvelteKit app\n * import { AgentUIRegistry } from '@happyvertical/smrt-agents/ui';\n * import '@happyvertical/praeco/admin'; // Registers components\n *\n * const Component = AgentUIRegistry.get('Praeco', 'sources');\n * ```\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __smrtAgentUIRegistry: AgentUIComponentRegistry | undefined;\n}\n\nif (!globalThis.__smrtAgentUIRegistry) {\n globalThis.__smrtAgentUIRegistry = createUIRegistry();\n}\nexport const AgentUIRegistry: AgentUIComponentRegistry =\n globalThis.__smrtAgentUIRegistry;\n\n/**\n * What an agent's `./admin` entry point must export.\n *\n * This is the contract between agent packages and host apps.\n * Instead of registering individual slot components, agents export\n * a single root component that handles its own sub-navigation.\n *\n * @example\n * ```typescript\n * // In agent package: histrio/src/ui/admin/index.ts\n * export { default } from './AdminRoot.svelte';\n * export { createAPIClient } from '../types.js';\n * export const navItems: AgentAdminNavItem[] = [\n * { id: 'characters', label: 'Characters', icon: 'users', order: 1 },\n * { id: 'performers', label: 'Performers', icon: 'mic', order: 2 },\n * ];\n * ```\n */\nexport interface AgentAdminExport {\n /** Root admin component — renders all panels, handles its own sub-navigation */\n default?: ComponentType;\n /** Create a typed API client for this agent */\n createAPIClient?: (baseUrl: string) => unknown;\n /** Navigation items for tabs/sidebar within the agent admin */\n navItems?: AgentAdminNavItem[];\n}\n\n/**\n * Props passed to the root admin component\n */\nexport interface AgentAdminRootProps {\n /** Typed API client created by the agent's own factory */\n apiClient: unknown;\n /** Which panel to show (from URL hash, e.g., 'sources') */\n activePanel?: string;\n /** Called when user navigates within the agent */\n onNavigate?: (panelId: string) => void;\n /** Whether admin is in read-only mode */\n readonly?: boolean;\n}\n\n/**\n * Navigation item within an agent's admin UI\n */\nexport interface AgentAdminNavItem {\n /** Matches hash fragment and panel ID */\n id: string;\n /** Display label */\n label: string;\n /** Icon identifier */\n icon?: string;\n /** Display order (lower numbers first) */\n order?: number;\n}\n\n/**\n * Agents module UI slots (for ModuleUIRegistry)\n */\nexport const AGENTS_UI_SLOTS: Record<string, ModuleUISlot> = {\n 'agent-dashboard': {\n id: 'agent-dashboard',\n label: 'Agent Dashboard',\n description: 'Combined overview panel for agent schedules',\n icon: 'activity',\n category: 'admin',\n order: 1,\n propsInterface: 'AgentDashboardProps',\n },\n 'agent-schedule-list': {\n id: 'agent-schedule-list',\n label: 'Agent Schedule List',\n description: 'List of scheduled agents',\n icon: 'calendar',\n category: 'list',\n order: 2,\n propsInterface: 'AgentScheduleListProps',\n },\n 'agent-schedule-form': {\n id: 'agent-schedule-form',\n label: 'Agent Schedule Form',\n description: 'Form for creating or editing agent schedules',\n icon: 'edit',\n category: 'form',\n order: 3,\n propsInterface: 'AgentScheduleFormProps',\n },\n 'agent-run-history': {\n id: 'agent-run-history',\n label: 'Agent Run History',\n description: 'History of agent runs',\n icon: 'clock',\n category: 'list',\n order: 4,\n propsInterface: 'AgentRunHistoryProps',\n },\n 'schedule-status-badge': {\n id: 'schedule-status-badge',\n label: 'Schedule Status Badge',\n description: 'Status indicator for schedule states',\n icon: 'tag',\n category: 'display',\n order: 5,\n propsInterface: 'ScheduleStatusBadgeProps',\n },\n};\n\n/**\n * Agents module metadata\n */\nexport const AGENTS_MODULE_META: SmrtModuleMeta = {\n name: '@happyvertical/smrt-agents',\n displayName: 'Agents',\n description: 'Agent framework for building autonomous actors',\n uiSlots: AGENTS_UI_SLOTS,\n models: ['Agent', 'AgentConfig', 'AgentSchedule', 'TenantAgent'],\n collections: [\n 'AgentConfigCollection',\n 'AgentScheduleCollection',\n 'TenantAgentCollection',\n ],\n};\n"],"names":[],"mappings":"AA8PO,SAAS,mBAA6C;AAC3D,QAAM,iCAAiB,IAAA;AACvB,QAAM,gCAAgB,IAAA;AACtB,QAAM,sCAAsB,IAAA;AAC5B,QAAM,iCAAiB,IAAA;AAEvB,QAAM,UAAU,CAAC,YAAoB,WACnC,GAAG,UAAU,IAAI,MAAM;AAEzB,QAAM,eAAe,CAAC,YAAoB,SACxC,GAAG,UAAU,UAAU,IAAI;AAE7B,SAAO;AAAA,IACL,SAAS,YAAY,QAAQ,WAAW;AACtC,iBAAW,IAAI,QAAQ,YAAY,MAAM,GAAG,SAAS;AAAA,IACvD;AAAA,IAEA,IAAI,YAAY,QAAQ;AACtB,aAAO,WAAW,IAAI,QAAQ,Y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AAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,SAAS,eAAe,iBAAiB,aAAa;AAAA,EAC/D,aAAa;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"smrtRawPrimitives": "strict",
|
|
6
6
|
"description": "Agent framework for building autonomous actors in the SMRT ecosystem",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"@happyvertical/ai": "^0.74.7",
|
|
60
60
|
"@happyvertical/files": "^0.74.7",
|
|
61
61
|
"@happyvertical/utils": "^0.74.7",
|
|
62
|
-
"@happyvertical/smrt-config": "0.
|
|
63
|
-
"@happyvertical/smrt-core": "0.
|
|
64
|
-
"@happyvertical/smrt-secrets": "0.
|
|
65
|
-
"@happyvertical/smrt-
|
|
66
|
-
"@happyvertical/smrt-
|
|
67
|
-
"@happyvertical/smrt-
|
|
68
|
-
"@happyvertical/smrt-
|
|
62
|
+
"@happyvertical/smrt-config": "0.36.0",
|
|
63
|
+
"@happyvertical/smrt-core": "0.36.0",
|
|
64
|
+
"@happyvertical/smrt-secrets": "0.36.0",
|
|
65
|
+
"@happyvertical/smrt-ui": "0.36.0",
|
|
66
|
+
"@happyvertical/smrt-tenancy": "0.36.0",
|
|
67
|
+
"@happyvertical/smrt-users": "0.36.0",
|
|
68
|
+
"@happyvertical/smrt-types": "0.36.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@happyvertical/logger": "^0.74.7",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"typescript": "^5.9.3",
|
|
83
83
|
"vite": "^7.3.1",
|
|
84
84
|
"vitest": "^4.0.17",
|
|
85
|
-
"@happyvertical/smrt-vitest": "0.
|
|
85
|
+
"@happyvertical/smrt-vitest": "0.36.0"
|
|
86
86
|
},
|
|
87
87
|
"keywords": [
|
|
88
88
|
"agent",
|