@contractspec/example.agent-console 1.46.1 → 1.48.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/.turbo/turbo-build$colon$bundle.log +275 -128
- package/.turbo/turbo-build.log +274 -127
- package/CHANGELOG.md +52 -0
- package/dist/agent/agent.entity.d.ts +36 -36
- package/dist/agent/agent.entity.d.ts.map +1 -1
- package/dist/agent/agent.enum.d.ts +4 -4
- package/dist/agent/agent.enum.d.ts.map +1 -1
- package/dist/agent/agent.event.d.ts +31 -31
- package/dist/agent/agent.event.d.ts.map +1 -1
- package/dist/agent/agent.event.js +5 -5
- package/dist/agent/agent.event.js.map +1 -1
- package/dist/agent/agent.handler.js.map +1 -1
- package/dist/agent/agent.operation.d.ts +117 -117
- package/dist/agent/agent.operation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.d.ts +4 -5
- package/dist/agent/agent.presentation.d.ts.map +1 -1
- package/dist/agent/agent.presentation.js +7 -7
- package/dist/agent/agent.presentation.js.map +1 -1
- package/dist/agent/agent.schema.d.ts +95 -95
- package/dist/agent/agent.schema.d.ts.map +1 -1
- package/dist/agent/agent.test-spec.d.ts +8 -0
- package/dist/agent/agent.test-spec.d.ts.map +1 -0
- package/dist/agent/agent.test-spec.js +65 -0
- package/dist/agent/agent.test-spec.js.map +1 -0
- package/dist/agent.capability.d.ts +7 -0
- package/dist/agent.capability.d.ts.map +1 -0
- package/dist/agent.capability.js +20 -0
- package/dist/agent.capability.js.map +1 -0
- package/dist/agent.feature.d.ts.map +1 -1
- package/dist/agent.feature.js +4 -2
- package/dist/agent.feature.js.map +1 -1
- package/dist/example.d.ts +2 -2
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +4 -2
- package/dist/example.js.map +1 -1
- package/dist/handlers/agent.handlers.d.ts +135 -0
- package/dist/handlers/agent.handlers.d.ts.map +1 -0
- package/dist/handlers/agent.handlers.js +263 -0
- package/dist/handlers/agent.handlers.js.map +1 -0
- package/dist/handlers/index.d.ts +2 -1
- package/dist/handlers/index.js +2 -1
- package/dist/index.d.ts +19 -1
- package/dist/index.js +19 -1
- package/dist/run/run.entity.d.ts +56 -56
- package/dist/run/run.enum.d.ts +5 -5
- package/dist/run/run.event.d.ts +71 -71
- package/dist/run/run.event.js +8 -8
- package/dist/run/run.event.js.map +1 -1
- package/dist/run/run.operation.d.ts +175 -175
- package/dist/run/run.presentation.d.ts +3 -4
- package/dist/run/run.presentation.d.ts.map +1 -1
- package/dist/run/run.presentation.js +5 -5
- package/dist/run/run.presentation.js.map +1 -1
- package/dist/run/run.schema.d.ts +99 -99
- package/dist/run/run.test-spec.d.ts +8 -0
- package/dist/run/run.test-spec.d.ts.map +1 -0
- package/dist/run/run.test-spec.js +65 -0
- package/dist/run/run.test-spec.js.map +1 -0
- package/dist/seeders/index.d.ts +10 -0
- package/dist/seeders/index.d.ts.map +1 -0
- package/dist/seeders/index.js +20 -0
- package/dist/seeders/index.js.map +1 -0
- package/dist/shared/overlay-types.d.ts +34 -0
- package/dist/shared/overlay-types.d.ts.map +1 -0
- package/dist/shared/overlay-types.js +0 -0
- package/dist/tool/tool.entity.d.ts +24 -24
- package/dist/tool/tool.enum.d.ts +4 -4
- package/dist/tool/tool.event.d.ts +25 -25
- package/dist/tool/tool.event.js +4 -4
- package/dist/tool/tool.event.js.map +1 -1
- package/dist/tool/tool.handler.d.ts.map +1 -1
- package/dist/tool/tool.operation.d.ts +101 -101
- package/dist/tool/tool.presentation.d.ts +3 -4
- package/dist/tool/tool.presentation.d.ts.map +1 -1
- package/dist/tool/tool.presentation.js +5 -5
- package/dist/tool/tool.presentation.js.map +1 -1
- package/dist/tool/tool.schema.d.ts +52 -52
- package/dist/tool/tool.schema.d.ts.map +1 -1
- package/dist/tool/tool.test-spec.d.ts +8 -0
- package/dist/tool/tool.test-spec.d.ts.map +1 -0
- package/dist/tool/tool.test-spec.js +65 -0
- package/dist/tool/tool.test-spec.js.map +1 -0
- package/dist/ui/AgentDashboard.d.ts +7 -0
- package/dist/ui/AgentDashboard.d.ts.map +1 -0
- package/dist/ui/AgentDashboard.js +420 -0
- package/dist/ui/AgentDashboard.js.map +1 -0
- package/dist/ui/AgentRunList.d.ts +2 -0
- package/dist/ui/AgentRunList.js +5 -0
- package/dist/ui/AgentToolRegistry.d.ts +2 -0
- package/dist/ui/AgentToolRegistry.js +5 -0
- package/dist/ui/hooks/index.d.ts +6 -0
- package/dist/ui/hooks/index.js +8 -0
- package/dist/ui/hooks/useAgentList.d.ts +28 -0
- package/dist/ui/hooks/useAgentList.d.ts.map +1 -0
- package/dist/ui/hooks/useAgentList.js +66 -0
- package/dist/ui/hooks/useAgentList.js.map +1 -0
- package/dist/ui/hooks/useAgentMutations.d.ts +29 -0
- package/dist/ui/hooks/useAgentMutations.d.ts.map +1 -0
- package/dist/ui/hooks/useAgentMutations.js +124 -0
- package/dist/ui/hooks/useAgentMutations.js.map +1 -0
- package/dist/ui/hooks/useRunList.d.ts +24 -0
- package/dist/ui/hooks/useRunList.d.ts.map +1 -0
- package/dist/ui/hooks/useRunList.js +66 -0
- package/dist/ui/hooks/useRunList.js.map +1 -0
- package/dist/ui/hooks/useToolList.d.ts +40 -0
- package/dist/ui/hooks/useToolList.d.ts.map +1 -0
- package/dist/ui/hooks/useToolList.js +96 -0
- package/dist/ui/hooks/useToolList.js.map +1 -0
- package/dist/ui/index.d.ts +24 -0
- package/dist/ui/index.js +24 -0
- package/dist/ui/modals/AgentActionsModal.d.ts +27 -0
- package/dist/ui/modals/AgentActionsModal.d.ts.map +1 -0
- package/dist/ui/modals/AgentActionsModal.js +262 -0
- package/dist/ui/modals/AgentActionsModal.js.map +1 -0
- package/dist/ui/modals/CreateAgentModal.d.ts +25 -0
- package/dist/ui/modals/CreateAgentModal.d.ts.map +1 -0
- package/dist/ui/modals/CreateAgentModal.js +214 -0
- package/dist/ui/modals/CreateAgentModal.js.map +1 -0
- package/dist/ui/modals/index.d.ts +3 -0
- package/dist/ui/modals/index.js +4 -0
- package/dist/ui/overlays/demo-overlays.d.ts +19 -0
- package/dist/ui/overlays/demo-overlays.d.ts.map +1 -0
- package/dist/ui/overlays/demo-overlays.js +73 -0
- package/dist/ui/overlays/demo-overlays.js.map +1 -0
- package/dist/ui/overlays/index.d.ts +2 -0
- package/dist/ui/overlays/index.js +3 -0
- package/dist/ui/renderers/agent-list.markdown.d.ts +15 -0
- package/dist/ui/renderers/agent-list.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/agent-list.markdown.js +51 -0
- package/dist/ui/renderers/agent-list.markdown.js.map +1 -0
- package/dist/ui/renderers/agent-list.renderer.d.ts +11 -0
- package/dist/ui/renderers/agent-list.renderer.d.ts.map +1 -0
- package/dist/ui/renderers/agent-list.renderer.js +19 -0
- package/dist/ui/renderers/agent-list.renderer.js.map +1 -0
- package/dist/ui/renderers/dashboard.markdown.d.ts +15 -0
- package/dist/ui/renderers/dashboard.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/dashboard.markdown.js +100 -0
- package/dist/ui/renderers/dashboard.markdown.js.map +1 -0
- package/dist/ui/renderers/index.d.ts +6 -0
- package/dist/ui/renderers/index.js +7 -0
- package/dist/ui/renderers/run-list.markdown.d.ts +15 -0
- package/dist/ui/renderers/run-list.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/run-list.markdown.js +44 -0
- package/dist/ui/renderers/run-list.markdown.js.map +1 -0
- package/dist/ui/renderers/tool-registry.markdown.d.ts +15 -0
- package/dist/ui/renderers/tool-registry.markdown.d.ts.map +1 -0
- package/dist/ui/renderers/tool-registry.markdown.js +55 -0
- package/dist/ui/renderers/tool-registry.markdown.js.map +1 -0
- package/dist/ui/views/AgentListView.d.ts +7 -0
- package/dist/ui/views/AgentListView.d.ts.map +1 -0
- package/dist/ui/views/AgentListView.js +93 -0
- package/dist/ui/views/AgentListView.js.map +1 -0
- package/dist/ui/views/RunListView.d.ts +14 -0
- package/dist/ui/views/RunListView.d.ts.map +1 -0
- package/dist/ui/views/RunListView.js +165 -0
- package/dist/ui/views/RunListView.js.map +1 -0
- package/dist/ui/views/ToolRegistryView.d.ts +14 -0
- package/dist/ui/views/ToolRegistryView.d.ts.map +1 -0
- package/dist/ui/views/ToolRegistryView.js +97 -0
- package/dist/ui/views/ToolRegistryView.js.map +1 -0
- package/dist/ui/views/index.d.ts +4 -0
- package/dist/ui/views/index.js +5 -0
- package/package.json +46 -10
- package/src/agent/agent.presentation.ts +7 -8
- package/src/agent/agent.test-spec.ts +55 -0
- package/src/agent.capability.ts +13 -0
- package/src/agent.feature.ts +3 -2
- package/src/example.ts +3 -3
- package/src/handlers/agent.handlers.ts +572 -0
- package/src/handlers/index.ts +3 -0
- package/src/index.ts +5 -0
- package/src/run/run.presentation.ts +5 -6
- package/src/run/run.test-spec.ts +55 -0
- package/src/seeders/index.ts +29 -0
- package/src/shared/overlay-types.ts +39 -0
- package/src/tool/tool.presentation.ts +5 -6
- package/src/tool/tool.test-spec.ts +55 -0
- package/src/ui/AgentDashboard.tsx +416 -0
- package/src/ui/AgentRunList.tsx +8 -0
- package/src/ui/AgentToolRegistry.tsx +8 -0
- package/src/ui/hooks/index.ts +14 -0
- package/src/ui/hooks/useAgentList.ts +80 -0
- package/src/ui/hooks/useAgentMutations.ts +156 -0
- package/src/ui/hooks/useRunList.ts +81 -0
- package/src/ui/hooks/useToolList.ts +122 -0
- package/src/ui/index.ts +21 -0
- package/src/ui/modals/AgentActionsModal.tsx +306 -0
- package/src/ui/modals/CreateAgentModal.tsx +257 -0
- package/src/ui/modals/index.ts +2 -0
- package/src/ui/overlays/demo-overlays.ts +77 -0
- package/src/ui/overlays/index.ts +1 -0
- package/src/ui/renderers/agent-list.markdown.ts +84 -0
- package/src/ui/renderers/agent-list.renderer.tsx +27 -0
- package/src/ui/renderers/dashboard.markdown.ts +169 -0
- package/src/ui/renderers/index.ts +12 -0
- package/src/ui/renderers/run-list.markdown.ts +75 -0
- package/src/ui/renderers/tool-registry.markdown.ts +91 -0
- package/src/ui/views/AgentListView.tsx +113 -0
- package/src/ui/views/RunListView.tsx +173 -0
- package/src/ui/views/ToolRegistryView.tsx +140 -0
- package/src/ui/views/index.ts +6 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.capability.d.ts","names":[],"sources":["../src/agent.capability.ts"],"sourcesContent":[],"mappings":";;;cAEa,iBAUX,4BAAA,CAV0B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StabilityEnum, defineCapability } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/agent.capability.ts
|
|
4
|
+
const AgentCapability = defineCapability({ meta: {
|
|
5
|
+
key: "agent",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "ui",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "AI agent management and console capability",
|
|
10
|
+
owners: ["platform.core"],
|
|
11
|
+
tags: [
|
|
12
|
+
"agent",
|
|
13
|
+
"ai",
|
|
14
|
+
"console"
|
|
15
|
+
]
|
|
16
|
+
} });
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { AgentCapability };
|
|
20
|
+
//# sourceMappingURL=agent.capability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.capability.js","names":[],"sources":["../src/agent.capability.ts"],"sourcesContent":["import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';\n\nexport const AgentCapability = defineCapability({\n meta: {\n key: 'agent',\n version: '1.0.0',\n kind: 'ui',\n stability: StabilityEnum.Experimental,\n description: 'AI agent management and console capability',\n owners: ['platform.core'],\n tags: ['agent', 'ai', 'console'],\n },\n});\n"],"mappings":";;;AAEA,MAAa,kBAAkB,iBAAiB,EAC9C,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,gBAAgB;CACzB,MAAM;EAAC;EAAS;EAAM;EAAU;CACjC,EACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.feature.d.ts","names":[],"sources":["../src/agent.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent.feature.d.ts","names":[],"sources":["../src/agent.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;;cAYa,qBAAqB"}
|
package/dist/agent.feature.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
1
3
|
//#region src/agent.feature.ts
|
|
2
4
|
/**
|
|
3
5
|
* Agent Console feature module that bundles all agent, tool, and run
|
|
4
6
|
* operations, events, and presentations into an installable feature.
|
|
5
7
|
*/
|
|
6
|
-
const AgentConsoleFeature = {
|
|
8
|
+
const AgentConsoleFeature = defineFeature({
|
|
7
9
|
meta: {
|
|
8
10
|
key: "agent-console",
|
|
9
11
|
version: "1.0.0",
|
|
@@ -296,7 +298,7 @@ const AgentConsoleFeature = {
|
|
|
296
298
|
version: "1.0.0"
|
|
297
299
|
}]
|
|
298
300
|
}
|
|
299
|
-
};
|
|
301
|
+
});
|
|
300
302
|
|
|
301
303
|
//#endregion
|
|
302
304
|
export { AgentConsoleFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.feature.js","names":[
|
|
1
|
+
{"version":3,"file":"agent.feature.js","names":[],"sources":["../src/agent.feature.ts"],"sourcesContent":["/**\n * Agent Console Feature Module Specification\n *\n * Defines the feature module for agent orchestration capabilities.\n */\nimport type { FeatureModuleSpec } from '@contractspec/lib.contracts';\nimport { defineFeature } from '@contractspec/lib.contracts';\n\n/**\n * Agent Console feature module that bundles all agent, tool, and run\n * operations, events, and presentations into an installable feature.\n */\nexport const AgentConsoleFeature: FeatureModuleSpec = defineFeature({\n meta: {\n key: 'agent-console',\n version: '1.0.0',\n title: 'AI Agent Console',\n description: 'AI agent orchestration with tools, runs, and logs management',\n domain: 'ai-ops',\n owners: ['@agent-console-team'],\n tags: ['ai', 'agents', 'orchestration'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n // Agent operations\n { key: 'agent-console.agent.create', version: '1.0.0' },\n { key: 'agent-console.agent.update', version: '1.0.0' },\n { key: 'agent-console.agent.get', version: '1.0.0' },\n { key: 'agent-console.agent.list', version: '1.0.0' },\n { key: 'agent-console.agent.assignTool', version: '1.0.0' },\n { key: 'agent-console.agent.removeTool', version: '1.0.0' },\n\n // Tool operations\n { key: 'agent.tool.create', version: '1.0.0' },\n { key: 'agent.tool.update', version: '1.0.0' },\n { key: 'agent.tool.get', version: '1.0.0' },\n { key: 'agent.tool.list', version: '1.0.0' },\n { key: 'agent.tool.test', version: '1.0.0' },\n\n // Run operations\n { key: 'agent.run.execute', version: '1.0.0' },\n { key: 'agent.run.cancel', version: '1.0.0' },\n { key: 'agent.run.get', version: '1.0.0' },\n { key: 'agent.run.list', version: '1.0.0' },\n { key: 'agent.run.getSteps', version: '1.0.0' },\n { key: 'agent.run.getLogs', version: '1.0.0' },\n { key: 'agent.run.getMetrics', version: '1.0.0' },\n ],\n\n // Events emitted by this feature\n events: [\n // Agent events\n { key: 'agent-console.agent.created', version: '1.0.0' },\n { key: 'agent-console.agent.updated', version: '1.0.0' },\n { key: 'agent-console.agent.toolAssigned', version: '1.0.0' },\n { key: 'agent-console.agent.toolRemoved', version: '1.0.0' },\n\n // Tool events\n { key: 'agent.tool.created', version: '1.0.0' },\n { key: 'agent.tool.updated', version: '1.0.0' },\n { key: 'agent.tool.statusChanged', version: '1.0.0' },\n\n // Run events\n { key: 'agent.run.started', version: '1.0.0' },\n { key: 'agent.run.completed', version: '1.0.0' },\n { key: 'agent.run.failed', version: '1.0.0' },\n { key: 'agent.run.cancelled', version: '1.0.0' },\n { key: 'agent.run.toolInvoked', version: '1.0.0' },\n { key: 'agent.run.toolCompleted', version: '1.0.0' },\n { key: 'agent.run.messageGenerated', version: '1.0.0' },\n ],\n\n // Presentations associated with this feature\n presentations: [\n { key: 'agent-console.dashboard', version: '1.0.0' },\n { key: 'agent-console.agent.list', version: '1.0.0' },\n { key: 'agent-console.agent.detail', version: '1.0.0' },\n { key: 'agent-console.run.list', version: '1.0.0' },\n { key: 'agent-console.run.detail', version: '1.0.0' },\n { key: 'agent-console.tool.list', version: '1.0.0' },\n { key: 'agent-console.tool.detail', version: '1.0.0' },\n ],\n\n // Link operations to their primary presentations\n opToPresentation: [\n {\n op: { key: 'agent-console.agent.list', version: '1.0.0' },\n pres: { key: 'agent-console.agent.list', version: '1.0.0' },\n },\n {\n op: { key: 'agent-console.agent.get', version: '1.0.0' },\n pres: { key: 'agent-console.agent.detail', version: '1.0.0' },\n },\n {\n op: { key: 'agent.run.list', version: '1.0.0' },\n pres: { key: 'agent-console.run.list', version: '1.0.0' },\n },\n {\n op: { key: 'agent.run.get', version: '1.0.0' },\n pres: { key: 'agent-console.run.detail', version: '1.0.0' },\n },\n {\n op: { key: 'agent.tool.list', version: '1.0.0' },\n pres: { key: 'agent-console.tool.list', version: '1.0.0' },\n },\n {\n op: { key: 'agent.tool.get', version: '1.0.0' },\n pres: { key: 'agent-console.tool.detail', version: '1.0.0' },\n },\n ],\n\n // Target requirements for multi-surface rendering\n presentationsTargets: [\n {\n key: 'agent-console.dashboard',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n {\n key: 'agent-console.agent.list',\n version: '1.0.0',\n targets: ['react', 'markdown', 'application/json'],\n },\n {\n key: 'agent-console.run.list',\n version: '1.0.0',\n targets: ['react', 'markdown', 'application/json'],\n },\n {\n key: 'agent-console.tool.list',\n version: '1.0.0',\n targets: ['react', 'markdown', 'application/json'],\n },\n ],\n\n // Capability requirements\n capabilities: {\n requires: [\n { key: 'identity', version: '1.0.0' },\n { key: 'audit-trail', version: '1.0.0' },\n { key: 'jobs', version: '1.0.0' },\n ],\n provides: [{ key: 'agent', version: '1.0.0' }],\n },\n});\n"],"mappings":";;;;;;;AAYA,MAA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E,KAAK;GACL,SAAS;GACT,SAAS;IAAC;IAAS;IAAY;IAAmB;GACnD;EACD;GACE,KAAK;GACL,SAAS;GACT,SAAS;IAAC;IAAS;IAAY;IAAmB;GACnD;EACF;CAGD,cAAc;EACZ,UAAU;GACR;IAAE,KAAK;IAAY,SAAS;IAAS;GACrC;IAAE,KAAK;IAAe,SAAS;IAAS;GACxC;IAAE,KAAK;IAAQ,SAAS;IAAS;GAClC;EACD,UAAU,CAAC;GAAE,KAAK;GAAS,SAAS;GAAS,CAAC;EAC/C;CACF,CAAC"}
|
package/dist/example.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
2
|
|
|
3
3
|
//#region src/example.d.ts
|
|
4
|
-
declare const example: ExampleSpec;
|
|
4
|
+
declare const example: _contractspec_lib_contracts0.ExampleSpec;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { example as default };
|
|
7
7
|
//# sourceMappingURL=example.d.ts.map
|
package/dist/example.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,
|
|
1
|
+
{"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAoCJ,4BAAA,CApCW"}
|
package/dist/example.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
1
3
|
//#region src/example.ts
|
|
2
|
-
const example = {
|
|
4
|
+
const example = defineExample({
|
|
3
5
|
meta: {
|
|
4
6
|
key: "agent-console",
|
|
5
7
|
version: "1.0.0",
|
|
@@ -48,7 +50,7 @@ const example = {
|
|
|
48
50
|
},
|
|
49
51
|
mcp: { enabled: true }
|
|
50
52
|
}
|
|
51
|
-
};
|
|
53
|
+
});
|
|
52
54
|
var example_default = example;
|
|
53
55
|
|
|
54
56
|
//#endregion
|
package/dist/example.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'agent-console',\n version: '1.0.0',\n title: 'Agent Console',\n description:\n 'AI agent ops console: tools, agents, runs, logs, and metrics (spec-first, regenerable).',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['ai', 'agents', 'tools', 'orchestration'],\n },\n docs: {\n rootDocId: 'docs.examples.agent-console.reference',\n goalDocId: 'docs.examples.agent-console.goal',\n usageDocId: 'docs.examples.agent-console.usage',\n constraintsDocId: 'docs.examples.agent-console.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.agent-console',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAM;GAAU;GAAS;GAAgB;EACjD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
|
|
2
|
+
|
|
3
|
+
//#region src/handlers/agent.handlers.d.ts
|
|
4
|
+
|
|
5
|
+
interface Agent {
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
organizationId: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
modelProvider: string;
|
|
12
|
+
modelName: string;
|
|
13
|
+
systemPrompt?: string;
|
|
14
|
+
temperature: number;
|
|
15
|
+
maxTokens: number;
|
|
16
|
+
status: 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}
|
|
20
|
+
interface Tool {
|
|
21
|
+
id: string;
|
|
22
|
+
projectId: string;
|
|
23
|
+
organizationId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
version: string;
|
|
27
|
+
category: 'RETRIEVAL' | 'COMPUTATION' | 'COMMUNICATION' | 'INTEGRATION' | 'UTILITY' | 'CUSTOM';
|
|
28
|
+
status: 'ACTIVE' | 'DISABLED' | 'DEPRECATED' | 'DRAFT';
|
|
29
|
+
inputSchema?: string;
|
|
30
|
+
outputSchema?: string;
|
|
31
|
+
endpoint?: string;
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
updatedAt: Date;
|
|
34
|
+
}
|
|
35
|
+
interface Run {
|
|
36
|
+
id: string;
|
|
37
|
+
projectId: string;
|
|
38
|
+
agentId: string;
|
|
39
|
+
agentName?: string;
|
|
40
|
+
status: 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';
|
|
41
|
+
input?: string;
|
|
42
|
+
output?: string;
|
|
43
|
+
totalTokens: number;
|
|
44
|
+
promptTokens: number;
|
|
45
|
+
completionTokens: number;
|
|
46
|
+
estimatedCostUsd: number;
|
|
47
|
+
durationMs?: number;
|
|
48
|
+
errorMessage?: string;
|
|
49
|
+
queuedAt: Date;
|
|
50
|
+
startedAt?: Date;
|
|
51
|
+
completedAt?: Date;
|
|
52
|
+
}
|
|
53
|
+
interface RunMetrics {
|
|
54
|
+
totalRuns: number;
|
|
55
|
+
successRate: number;
|
|
56
|
+
averageDurationMs: number;
|
|
57
|
+
totalTokens: number;
|
|
58
|
+
totalCostUsd: number;
|
|
59
|
+
}
|
|
60
|
+
interface ListAgentsInput {
|
|
61
|
+
projectId: string;
|
|
62
|
+
organizationId?: string;
|
|
63
|
+
status?: Agent['status'] | 'all';
|
|
64
|
+
search?: string;
|
|
65
|
+
limit?: number;
|
|
66
|
+
offset?: number;
|
|
67
|
+
}
|
|
68
|
+
interface ListAgentsOutput {
|
|
69
|
+
items: Agent[];
|
|
70
|
+
total: number;
|
|
71
|
+
hasMore: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface ListToolsInput {
|
|
74
|
+
projectId: string;
|
|
75
|
+
organizationId?: string;
|
|
76
|
+
category?: Tool['category'] | 'all';
|
|
77
|
+
status?: Tool['status'] | 'all';
|
|
78
|
+
search?: string;
|
|
79
|
+
limit?: number;
|
|
80
|
+
offset?: number;
|
|
81
|
+
}
|
|
82
|
+
interface ListToolsOutput {
|
|
83
|
+
items: Tool[];
|
|
84
|
+
total: number;
|
|
85
|
+
hasMore: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ListRunsInput {
|
|
88
|
+
projectId: string;
|
|
89
|
+
organizationId?: string;
|
|
90
|
+
agentId?: string;
|
|
91
|
+
status?: Run['status'] | 'all';
|
|
92
|
+
limit?: number;
|
|
93
|
+
offset?: number;
|
|
94
|
+
}
|
|
95
|
+
interface ListRunsOutput {
|
|
96
|
+
items: Run[];
|
|
97
|
+
total: number;
|
|
98
|
+
hasMore: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface CreateAgentInput {
|
|
101
|
+
name: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
modelProvider?: string;
|
|
104
|
+
modelName?: string;
|
|
105
|
+
systemPrompt?: string;
|
|
106
|
+
temperature?: number;
|
|
107
|
+
maxTokens?: number;
|
|
108
|
+
}
|
|
109
|
+
interface UpdateAgentInput {
|
|
110
|
+
id: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
status?: Agent['status'];
|
|
114
|
+
}
|
|
115
|
+
declare function createAgentHandlers(db: DatabasePort): {
|
|
116
|
+
listAgents: (input: ListAgentsInput) => Promise<ListAgentsOutput>;
|
|
117
|
+
getAgent: (id: string) => Promise<Agent | null>;
|
|
118
|
+
createAgent: (input: CreateAgentInput, context: {
|
|
119
|
+
projectId: string;
|
|
120
|
+
organizationId: string;
|
|
121
|
+
}) => Promise<Agent>;
|
|
122
|
+
updateAgent: (input: UpdateAgentInput) => Promise<Agent>;
|
|
123
|
+
listTools: (input: ListToolsInput) => Promise<ListToolsOutput>;
|
|
124
|
+
listRuns: (input: ListRunsInput) => Promise<ListRunsOutput>;
|
|
125
|
+
getRunMetrics: (input: {
|
|
126
|
+
projectId: string;
|
|
127
|
+
agentId?: string;
|
|
128
|
+
startDate?: Date;
|
|
129
|
+
endDate?: Date;
|
|
130
|
+
}) => Promise<RunMetrics>;
|
|
131
|
+
};
|
|
132
|
+
type AgentHandlers = ReturnType<typeof createAgentHandlers>;
|
|
133
|
+
//#endregion
|
|
134
|
+
export { Agent, AgentHandlers, CreateAgentInput, ListAgentsInput, ListAgentsOutput, ListRunsInput, ListRunsOutput, ListToolsInput, ListToolsOutput, Run, RunMetrics, Tool, UpdateAgentInput, createAgentHandlers };
|
|
135
|
+
//# sourceMappingURL=agent.handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.handlers.d.ts","names":[],"sources":["../../src/handlers/agent.handlers.ts"],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AGN;;;;;UAMM,gBAAA;SACR;;;;UAKQ,cAAA;;;aAGJ;WACF;;;;;UAMM,eAAA;SACR;;;;UAKQ,aAAA;;;;WAIN;;;;UAKM,cAAA;SACR;;;;UAKQ,gBAAA;;;;;;;;;UAUA,gBAAA;;;;WAIN;;iBAkHK,mBAAA,KAAwB;sBAIL,oBAAkB,QAAQ;4BAqDtB,QAAQ;uBAWpC;;;QAEN,QAAQ;uBAuCuB,qBAAmB,QAAQ;qBAyC7B,mBAAiB,QAAQ;oBA2D1B,kBAAgB,QAAQ;;;;gBAgDzC;cACF;QACR,QAAQ;;KA8DF,aAAA,GAAgB,kBAAkB"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { web } from "@contractspec/lib.runtime-sandbox";
|
|
2
|
+
|
|
3
|
+
//#region src/handlers/agent.handlers.ts
|
|
4
|
+
const { generateId } = web;
|
|
5
|
+
function rowToAgent(row) {
|
|
6
|
+
return {
|
|
7
|
+
id: row.id,
|
|
8
|
+
projectId: row.projectId,
|
|
9
|
+
organizationId: row.organizationId,
|
|
10
|
+
name: row.name,
|
|
11
|
+
description: row.description ?? void 0,
|
|
12
|
+
modelProvider: row.modelProvider,
|
|
13
|
+
modelName: row.modelName,
|
|
14
|
+
systemPrompt: row.systemPrompt ?? void 0,
|
|
15
|
+
temperature: row.temperature,
|
|
16
|
+
maxTokens: row.maxTokens,
|
|
17
|
+
status: row.status,
|
|
18
|
+
createdAt: new Date(row.createdAt),
|
|
19
|
+
updatedAt: new Date(row.updatedAt)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function rowToTool(row) {
|
|
23
|
+
return {
|
|
24
|
+
id: row.id,
|
|
25
|
+
projectId: row.projectId,
|
|
26
|
+
organizationId: row.organizationId,
|
|
27
|
+
name: row.name,
|
|
28
|
+
description: row.description ?? void 0,
|
|
29
|
+
version: row.version,
|
|
30
|
+
category: row.category,
|
|
31
|
+
status: row.status,
|
|
32
|
+
inputSchema: row.inputSchema ?? void 0,
|
|
33
|
+
outputSchema: row.outputSchema ?? void 0,
|
|
34
|
+
endpoint: row.endpoint ?? void 0,
|
|
35
|
+
createdAt: new Date(row.createdAt),
|
|
36
|
+
updatedAt: new Date(row.updatedAt)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function rowToRun(row, agentName) {
|
|
40
|
+
return {
|
|
41
|
+
id: row.id,
|
|
42
|
+
projectId: row.projectId,
|
|
43
|
+
agentId: row.agentId,
|
|
44
|
+
agentName,
|
|
45
|
+
status: row.status,
|
|
46
|
+
input: row.input ?? void 0,
|
|
47
|
+
output: row.output ?? void 0,
|
|
48
|
+
totalTokens: row.totalTokens,
|
|
49
|
+
promptTokens: row.promptTokens,
|
|
50
|
+
completionTokens: row.completionTokens,
|
|
51
|
+
estimatedCostUsd: row.estimatedCostUsd,
|
|
52
|
+
durationMs: row.durationMs ?? void 0,
|
|
53
|
+
errorMessage: row.errorMessage ?? void 0,
|
|
54
|
+
queuedAt: new Date(row.queuedAt),
|
|
55
|
+
startedAt: row.startedAt ? new Date(row.startedAt) : void 0,
|
|
56
|
+
completedAt: row.completedAt ? new Date(row.completedAt) : void 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createAgentHandlers(db) {
|
|
60
|
+
/**
|
|
61
|
+
* List agents
|
|
62
|
+
*/
|
|
63
|
+
async function listAgents(input) {
|
|
64
|
+
const { projectId, organizationId, status, search, limit = 20, offset = 0 } = input;
|
|
65
|
+
let whereClause = "WHERE projectId = ?";
|
|
66
|
+
const params = [projectId];
|
|
67
|
+
if (organizationId) {
|
|
68
|
+
whereClause += " AND organizationId = ?";
|
|
69
|
+
params.push(organizationId);
|
|
70
|
+
}
|
|
71
|
+
if (status && status !== "all") {
|
|
72
|
+
whereClause += " AND status = ?";
|
|
73
|
+
params.push(status);
|
|
74
|
+
}
|
|
75
|
+
if (search) {
|
|
76
|
+
whereClause += " AND (name LIKE ? OR description LIKE ?)";
|
|
77
|
+
params.push(`%${search}%`, `%${search}%`);
|
|
78
|
+
}
|
|
79
|
+
const total = (await db.query(`SELECT COUNT(*) as count FROM agent_definition ${whereClause}`, params)).rows[0]?.count ?? 0;
|
|
80
|
+
const rows = (await db.query(`SELECT * FROM agent_definition ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`, [
|
|
81
|
+
...params,
|
|
82
|
+
limit,
|
|
83
|
+
offset
|
|
84
|
+
])).rows;
|
|
85
|
+
return {
|
|
86
|
+
items: rows.map(rowToAgent),
|
|
87
|
+
total,
|
|
88
|
+
hasMore: offset + rows.length < total
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Get a single agent
|
|
93
|
+
*/
|
|
94
|
+
async function getAgent(id) {
|
|
95
|
+
const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows;
|
|
96
|
+
return rows[0] ? rowToAgent(rows[0]) : null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create an agent
|
|
100
|
+
*/
|
|
101
|
+
async function createAgent(input, context) {
|
|
102
|
+
const id = generateId("agent");
|
|
103
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
104
|
+
await db.execute(`INSERT INTO agent_definition (id, projectId, organizationId, name, description, modelProvider, modelName, systemPrompt, temperature, maxTokens, status, createdAt, updatedAt)
|
|
105
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, [
|
|
106
|
+
id,
|
|
107
|
+
context.projectId,
|
|
108
|
+
context.organizationId,
|
|
109
|
+
input.name,
|
|
110
|
+
input.description ?? null,
|
|
111
|
+
input.modelProvider ?? "openai",
|
|
112
|
+
input.modelName ?? "gpt-4",
|
|
113
|
+
input.systemPrompt ?? null,
|
|
114
|
+
input.temperature ?? .7,
|
|
115
|
+
input.maxTokens ?? 4096,
|
|
116
|
+
"DRAFT",
|
|
117
|
+
now,
|
|
118
|
+
now
|
|
119
|
+
]);
|
|
120
|
+
const row = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])).rows[0];
|
|
121
|
+
if (!row) throw new Error("Failed to retrieve created agent");
|
|
122
|
+
return rowToAgent(row);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Update an agent
|
|
126
|
+
*/
|
|
127
|
+
async function updateAgent(input) {
|
|
128
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
129
|
+
const updates = ["updatedAt = ?"];
|
|
130
|
+
const params = [now];
|
|
131
|
+
if (input.name !== void 0) {
|
|
132
|
+
updates.push("name = ?");
|
|
133
|
+
params.push(input.name);
|
|
134
|
+
}
|
|
135
|
+
if (input.description !== void 0) {
|
|
136
|
+
updates.push("description = ?");
|
|
137
|
+
params.push(input.description);
|
|
138
|
+
}
|
|
139
|
+
if (input.status !== void 0) {
|
|
140
|
+
updates.push("status = ?");
|
|
141
|
+
params.push(input.status);
|
|
142
|
+
}
|
|
143
|
+
params.push(input.id);
|
|
144
|
+
await db.execute(`UPDATE agent_definition SET ${updates.join(", ")} WHERE id = ?`, params);
|
|
145
|
+
const rows = (await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [input.id])).rows;
|
|
146
|
+
if (!rows[0]) throw new Error("NOT_FOUND");
|
|
147
|
+
return rowToAgent(rows[0]);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* List tools
|
|
151
|
+
*/
|
|
152
|
+
async function listTools(input) {
|
|
153
|
+
const { projectId, organizationId, category, status, search, limit = 50, offset = 0 } = input;
|
|
154
|
+
let whereClause = "WHERE projectId = ?";
|
|
155
|
+
const params = [projectId];
|
|
156
|
+
if (organizationId) {
|
|
157
|
+
whereClause += " AND organizationId = ?";
|
|
158
|
+
params.push(organizationId);
|
|
159
|
+
}
|
|
160
|
+
if (category && category !== "all") {
|
|
161
|
+
whereClause += " AND category = ?";
|
|
162
|
+
params.push(category);
|
|
163
|
+
}
|
|
164
|
+
if (status && status !== "all") {
|
|
165
|
+
whereClause += " AND status = ?";
|
|
166
|
+
params.push(status);
|
|
167
|
+
}
|
|
168
|
+
if (search) {
|
|
169
|
+
whereClause += " AND (name LIKE ? OR description LIKE ?)";
|
|
170
|
+
params.push(`%${search}%`, `%${search}%`);
|
|
171
|
+
}
|
|
172
|
+
const total = (await db.query(`SELECT COUNT(*) as count FROM agent_tool ${whereClause}`, params)).rows[0]?.count ?? 0;
|
|
173
|
+
const rows = (await db.query(`SELECT * FROM agent_tool ${whereClause} ORDER BY name ASC LIMIT ? OFFSET ?`, [
|
|
174
|
+
...params,
|
|
175
|
+
limit,
|
|
176
|
+
offset
|
|
177
|
+
])).rows;
|
|
178
|
+
return {
|
|
179
|
+
items: rows.map(rowToTool),
|
|
180
|
+
total,
|
|
181
|
+
hasMore: offset + rows.length < total
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* List runs
|
|
186
|
+
*/
|
|
187
|
+
async function listRuns(input) {
|
|
188
|
+
const { projectId, agentId, status, limit = 20, offset = 0 } = input;
|
|
189
|
+
let whereClause = "WHERE r.projectId = ?";
|
|
190
|
+
const params = [projectId];
|
|
191
|
+
if (agentId) {
|
|
192
|
+
whereClause += " AND r.agentId = ?";
|
|
193
|
+
params.push(agentId);
|
|
194
|
+
}
|
|
195
|
+
if (status && status !== "all") {
|
|
196
|
+
whereClause += " AND r.status = ?";
|
|
197
|
+
params.push(status);
|
|
198
|
+
}
|
|
199
|
+
const total = (await db.query(`SELECT COUNT(*) as count FROM agent_run r ${whereClause}`, params)).rows[0]?.count ?? 0;
|
|
200
|
+
const rows = (await db.query(`SELECT r.*, a.name as agentName
|
|
201
|
+
FROM agent_run r
|
|
202
|
+
LEFT JOIN agent_definition a ON r.agentId = a.id
|
|
203
|
+
${whereClause}
|
|
204
|
+
ORDER BY r.queuedAt DESC LIMIT ? OFFSET ?`, [
|
|
205
|
+
...params,
|
|
206
|
+
limit,
|
|
207
|
+
offset
|
|
208
|
+
])).rows;
|
|
209
|
+
return {
|
|
210
|
+
items: rows.map((r) => rowToRun(r, r.agentName)),
|
|
211
|
+
total,
|
|
212
|
+
hasMore: offset + rows.length < total
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get run metrics
|
|
217
|
+
*/
|
|
218
|
+
async function getRunMetrics(input) {
|
|
219
|
+
let whereClause = "WHERE projectId = ?";
|
|
220
|
+
const params = [input.projectId];
|
|
221
|
+
if (input.agentId) {
|
|
222
|
+
whereClause += " AND agentId = ?";
|
|
223
|
+
params.push(input.agentId);
|
|
224
|
+
}
|
|
225
|
+
if (input.startDate) {
|
|
226
|
+
whereClause += " AND queuedAt >= ?";
|
|
227
|
+
params.push(input.startDate.toISOString());
|
|
228
|
+
}
|
|
229
|
+
if (input.endDate) {
|
|
230
|
+
whereClause += " AND queuedAt <= ?";
|
|
231
|
+
params.push(input.endDate.toISOString());
|
|
232
|
+
}
|
|
233
|
+
const data = (await db.query(`SELECT
|
|
234
|
+
COUNT(*) as totalRuns,
|
|
235
|
+
SUM(CASE WHEN status = 'COMPLETED' THEN 1 ELSE 0 END) as completedRuns,
|
|
236
|
+
AVG(CASE WHEN status = 'COMPLETED' THEN durationMs ELSE NULL END) as avgDuration,
|
|
237
|
+
COALESCE(SUM(totalTokens), 0) as totalTokens,
|
|
238
|
+
COALESCE(SUM(estimatedCostUsd), 0) as totalCost
|
|
239
|
+
FROM agent_run ${whereClause}`, params)).rows[0];
|
|
240
|
+
const totalRuns = data?.totalRuns ?? 0;
|
|
241
|
+
const completedRuns = data?.completedRuns ?? 0;
|
|
242
|
+
return {
|
|
243
|
+
totalRuns,
|
|
244
|
+
successRate: totalRuns > 0 ? completedRuns / totalRuns : 0,
|
|
245
|
+
averageDurationMs: data?.avgDuration ?? 0,
|
|
246
|
+
totalTokens: data?.totalTokens ?? 0,
|
|
247
|
+
totalCostUsd: data?.totalCost ?? 0
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
listAgents,
|
|
252
|
+
getAgent,
|
|
253
|
+
createAgent,
|
|
254
|
+
updateAgent,
|
|
255
|
+
listTools,
|
|
256
|
+
listRuns,
|
|
257
|
+
getRunMetrics
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
//#endregion
|
|
262
|
+
export { createAgentHandlers };
|
|
263
|
+
//# sourceMappingURL=agent.handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.handlers.js","names":[],"sources":["../../src/handlers/agent.handlers.ts"],"sourcesContent":["/**\n * Runtime-local Agent Console handlers\n *\n * Database-backed handlers for agent management and runs.\n */\nimport type { DatabasePort } from '@contractspec/lib.runtime-sandbox';\nimport { web } from '@contractspec/lib.runtime-sandbox';\nconst { generateId } = web;\n\n// ============ Types ============\n\nexport interface Agent {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description?: string;\n modelProvider: string;\n modelName: string;\n systemPrompt?: string;\n temperature: number;\n maxTokens: number;\n status: 'DRAFT' | 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface Tool {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description?: string;\n version: string;\n category:\n | 'RETRIEVAL'\n | 'COMPUTATION'\n | 'COMMUNICATION'\n | 'INTEGRATION'\n | 'UTILITY'\n | 'CUSTOM';\n status: 'ACTIVE' | 'DISABLED' | 'DEPRECATED' | 'DRAFT';\n inputSchema?: string;\n outputSchema?: string;\n endpoint?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface Run {\n id: string;\n projectId: string;\n agentId: string;\n agentName?: string;\n status: 'QUEUED' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';\n input?: string;\n output?: string;\n totalTokens: number;\n promptTokens: number;\n completionTokens: number;\n estimatedCostUsd: number;\n durationMs?: number;\n errorMessage?: string;\n queuedAt: Date;\n startedAt?: Date;\n completedAt?: Date;\n}\n\nexport interface RunMetrics {\n totalRuns: number;\n successRate: number;\n averageDurationMs: number;\n totalTokens: number;\n totalCostUsd: number;\n}\n\nexport interface ListAgentsInput {\n projectId: string;\n organizationId?: string;\n status?: Agent['status'] | 'all';\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface ListAgentsOutput {\n items: Agent[];\n total: number;\n hasMore: boolean;\n}\n\nexport interface ListToolsInput {\n projectId: string;\n organizationId?: string;\n category?: Tool['category'] | 'all';\n status?: Tool['status'] | 'all';\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface ListToolsOutput {\n items: Tool[];\n total: number;\n hasMore: boolean;\n}\n\nexport interface ListRunsInput {\n projectId: string;\n organizationId?: string;\n agentId?: string;\n status?: Run['status'] | 'all';\n limit?: number;\n offset?: number;\n}\n\nexport interface ListRunsOutput {\n items: Run[];\n total: number;\n hasMore: boolean;\n}\n\nexport interface CreateAgentInput {\n name: string;\n description?: string;\n modelProvider?: string;\n modelName?: string;\n systemPrompt?: string;\n temperature?: number;\n maxTokens?: number;\n}\n\nexport interface UpdateAgentInput {\n id: string;\n name?: string;\n description?: string;\n status?: Agent['status'];\n}\n\n// ============ Row Types ============\n\ninterface AgentRow extends Record<string, unknown> {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description: string | null;\n modelProvider: string;\n modelName: string;\n systemPrompt: string | null;\n temperature: number;\n maxTokens: number;\n status: string;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ToolRow extends Record<string, unknown> {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description: string | null;\n version: string;\n category: string;\n status: string;\n inputSchema: string | null;\n outputSchema: string | null;\n endpoint: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface RunRow extends Record<string, unknown> {\n id: string;\n projectId: string;\n agentId: string;\n status: string;\n input: string | null;\n output: string | null;\n totalTokens: number;\n promptTokens: number;\n completionTokens: number;\n estimatedCostUsd: number;\n durationMs: number | null;\n errorMessage: string | null;\n queuedAt: string;\n startedAt: string | null;\n completedAt: string | null;\n}\n\nfunction rowToAgent(row: AgentRow): Agent {\n return {\n id: row.id,\n projectId: row.projectId,\n organizationId: row.organizationId,\n name: row.name,\n description: row.description ?? undefined,\n modelProvider: row.modelProvider,\n modelName: row.modelName,\n systemPrompt: row.systemPrompt ?? undefined,\n temperature: row.temperature,\n maxTokens: row.maxTokens,\n status: row.status as Agent['status'],\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction rowToTool(row: ToolRow): Tool {\n return {\n id: row.id,\n projectId: row.projectId,\n organizationId: row.organizationId,\n name: row.name,\n description: row.description ?? undefined,\n version: row.version,\n category: row.category as Tool['category'],\n status: row.status as Tool['status'],\n inputSchema: row.inputSchema ?? undefined,\n outputSchema: row.outputSchema ?? undefined,\n endpoint: row.endpoint ?? undefined,\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction rowToRun(row: RunRow, agentName?: string): Run {\n return {\n id: row.id,\n projectId: row.projectId,\n agentId: row.agentId,\n agentName,\n status: row.status as Run['status'],\n input: row.input ?? undefined,\n output: row.output ?? undefined,\n totalTokens: row.totalTokens,\n promptTokens: row.promptTokens,\n completionTokens: row.completionTokens,\n estimatedCostUsd: row.estimatedCostUsd,\n durationMs: row.durationMs ?? undefined,\n errorMessage: row.errorMessage ?? undefined,\n queuedAt: new Date(row.queuedAt),\n startedAt: row.startedAt ? new Date(row.startedAt) : undefined,\n completedAt: row.completedAt ? new Date(row.completedAt) : undefined,\n };\n}\n\n// ============ Handler Factory ============\n\nexport function createAgentHandlers(db: DatabasePort) {\n /**\n * List agents\n */\n async function listAgents(input: ListAgentsInput): Promise<ListAgentsOutput> {\n const {\n projectId,\n organizationId,\n status,\n search,\n limit = 20,\n offset = 0,\n } = input;\n\n let whereClause = 'WHERE projectId = ?';\n const params: (string | number)[] = [projectId];\n\n if (organizationId) {\n whereClause += ' AND organizationId = ?';\n params.push(organizationId);\n }\n\n if (status && status !== 'all') {\n whereClause += ' AND status = ?';\n params.push(status);\n }\n\n if (search) {\n whereClause += ' AND (name LIKE ? OR description LIKE ?)';\n params.push(`%${search}%`, `%${search}%`);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM agent_definition ${whereClause}`,\n params\n )\n ).rows as unknown as { count: number }[];\n const total = countResult[0]?.count ?? 0;\n\n const rows = (\n await db.query(\n `SELECT * FROM agent_definition ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as AgentRow[];\n\n return {\n items: rows.map(rowToAgent),\n total,\n hasMore: offset + rows.length < total,\n };\n }\n\n /**\n * Get a single agent\n */\n async function getAgent(id: string): Promise<Agent | null> {\n const rows = (\n await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])\n ).rows as unknown as AgentRow[];\n return rows[0] ? rowToAgent(rows[0]) : null;\n }\n\n /**\n * Create an agent\n */\n async function createAgent(\n input: CreateAgentInput,\n context: { projectId: string; organizationId: string }\n ): Promise<Agent> {\n const id = generateId('agent');\n const now = new Date().toISOString();\n\n await db.execute(\n `INSERT INTO agent_definition (id, projectId, organizationId, name, description, modelProvider, modelName, systemPrompt, temperature, maxTokens, status, createdAt, updatedAt)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n [\n id,\n context.projectId,\n context.organizationId,\n input.name,\n input.description ?? null,\n input.modelProvider ?? 'openai',\n input.modelName ?? 'gpt-4',\n input.systemPrompt ?? null,\n input.temperature ?? 0.7,\n input.maxTokens ?? 4096,\n 'DRAFT',\n now,\n now,\n ]\n );\n\n const rows = (\n await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [id])\n ).rows as unknown as AgentRow[];\n\n const row = rows[0];\n if (!row) {\n throw new Error('Failed to retrieve created agent');\n }\n\n return rowToAgent(row);\n }\n\n /**\n * Update an agent\n */\n async function updateAgent(input: UpdateAgentInput): Promise<Agent> {\n const now = new Date().toISOString();\n const updates: string[] = ['updatedAt = ?'];\n const params: (string | null)[] = [now];\n\n if (input.name !== undefined) {\n updates.push('name = ?');\n params.push(input.name);\n }\n\n if (input.description !== undefined) {\n updates.push('description = ?');\n params.push(input.description);\n }\n\n if (input.status !== undefined) {\n updates.push('status = ?');\n params.push(input.status);\n }\n\n params.push(input.id);\n\n await db.execute(\n `UPDATE agent_definition SET ${updates.join(', ')} WHERE id = ?`,\n params\n );\n\n const rows = (\n await db.query(`SELECT * FROM agent_definition WHERE id = ?`, [input.id])\n ).rows as unknown as AgentRow[];\n\n if (!rows[0]) {\n throw new Error('NOT_FOUND');\n }\n\n return rowToAgent(rows[0]);\n }\n\n /**\n * List tools\n */\n async function listTools(input: ListToolsInput): Promise<ListToolsOutput> {\n const {\n projectId,\n organizationId,\n category,\n status,\n search,\n limit = 50,\n offset = 0,\n } = input;\n\n let whereClause = 'WHERE projectId = ?';\n const params: (string | number)[] = [projectId];\n\n if (organizationId) {\n whereClause += ' AND organizationId = ?';\n params.push(organizationId);\n }\n\n if (category && category !== 'all') {\n whereClause += ' AND category = ?';\n params.push(category);\n }\n\n if (status && status !== 'all') {\n whereClause += ' AND status = ?';\n params.push(status);\n }\n\n if (search) {\n whereClause += ' AND (name LIKE ? OR description LIKE ?)';\n params.push(`%${search}%`, `%${search}%`);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM agent_tool ${whereClause}`,\n params\n )\n ).rows as unknown as { count: number }[];\n const total = countResult[0]?.count ?? 0;\n\n const rows = (\n await db.query(\n `SELECT * FROM agent_tool ${whereClause} ORDER BY name ASC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as ToolRow[];\n\n return {\n items: rows.map(rowToTool),\n total,\n hasMore: offset + rows.length < total,\n };\n }\n\n /**\n * List runs\n */\n async function listRuns(input: ListRunsInput): Promise<ListRunsOutput> {\n const { projectId, agentId, status, limit = 20, offset = 0 } = input;\n\n let whereClause = 'WHERE r.projectId = ?';\n const params: (string | number)[] = [projectId];\n\n if (agentId) {\n whereClause += ' AND r.agentId = ?';\n params.push(agentId);\n }\n\n if (status && status !== 'all') {\n whereClause += ' AND r.status = ?';\n params.push(status);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM agent_run r ${whereClause}`,\n params\n )\n ).rows as unknown as { count: number }[];\n const total = countResult[0]?.count ?? 0;\n\n const rows = (\n await db.query(\n `SELECT r.*, a.name as agentName \n FROM agent_run r \n LEFT JOIN agent_definition a ON r.agentId = a.id \n ${whereClause} \n ORDER BY r.queuedAt DESC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as (RunRow & { agentName: string })[];\n\n return {\n items: rows.map((r) => rowToRun(r, r.agentName)),\n total,\n hasMore: offset + rows.length < total,\n };\n }\n\n /**\n * Get run metrics\n */\n async function getRunMetrics(input: {\n projectId: string;\n agentId?: string;\n startDate?: Date;\n endDate?: Date;\n }): Promise<RunMetrics> {\n let whereClause = 'WHERE projectId = ?';\n const params: (string | number)[] = [input.projectId];\n\n if (input.agentId) {\n whereClause += ' AND agentId = ?';\n params.push(input.agentId);\n }\n\n if (input.startDate) {\n whereClause += ' AND queuedAt >= ?';\n params.push(input.startDate.toISOString());\n }\n\n if (input.endDate) {\n whereClause += ' AND queuedAt <= ?';\n params.push(input.endDate.toISOString());\n }\n\n const result = (\n await db.query(\n `SELECT \n COUNT(*) as totalRuns,\n SUM(CASE WHEN status = 'COMPLETED' THEN 1 ELSE 0 END) as completedRuns,\n AVG(CASE WHEN status = 'COMPLETED' THEN durationMs ELSE NULL END) as avgDuration,\n COALESCE(SUM(totalTokens), 0) as totalTokens,\n COALESCE(SUM(estimatedCostUsd), 0) as totalCost\n FROM agent_run ${whereClause}`,\n params\n )\n ).rows as unknown as {\n totalRuns: number;\n completedRuns: number;\n avgDuration: number | null;\n totalTokens: number;\n totalCost: number;\n }[];\n\n const data = result[0];\n const totalRuns = data?.totalRuns ?? 0;\n const completedRuns = data?.completedRuns ?? 0;\n\n return {\n totalRuns,\n successRate: totalRuns > 0 ? completedRuns / totalRuns : 0,\n averageDurationMs: data?.avgDuration ?? 0,\n totalTokens: data?.totalTokens ?? 0,\n totalCostUsd: data?.totalCost ?? 0,\n };\n }\n\n return {\n listAgents,\n getAgent,\n createAgent,\n updateAgent,\n listTools,\n listRuns,\n getRunMetrics,\n };\n}\n\nexport type AgentHandlers = ReturnType<typeof createAgentHandlers>;\n"],"mappings":";;;AAOA,MAAM,EAAE,eAAe;AAwLvB,SAAS,WAAW,KAAsB;AACxC,QAAO;EACL,IAAI,IAAI;EACR,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,MAAM,IAAI;EACV,aAAa,IAAI,eAAe;EAChC,eAAe,IAAI;EACnB,WAAW,IAAI;EACf,cAAc,IAAI,gBAAgB;EAClC,aAAa,IAAI;EACjB,WAAW,IAAI;EACf,QAAQ,IAAI;EACZ,WAAW,IAAI,KAAK,IAAI,UAAU;EAClC,WAAW,IAAI,KAAK,IAAI,UAAU;EACnC;;AAGH,SAAS,UAAU,KAAoB;AACrC,QAAO;EACL,IAAI,IAAI;EACR,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,MAAM,IAAI;EACV,aAAa,IAAI,eAAe;EAChC,SAAS,IAAI;EACb,UAAU,IAAI;EACd,QAAQ,IAAI;EACZ,aAAa,IAAI,eAAe;EAChC,cAAc,IAAI,gBAAgB;EAClC,UAAU,IAAI,YAAY;EAC1B,WAAW,IAAI,KAAK,IAAI,UAAU;EAClC,WAAW,IAAI,KAAK,IAAI,UAAU;EACnC;;AAGH,SAAS,SAAS,KAAa,WAAyB;AACtD,QAAO;EACL,IAAI,IAAI;EACR,WAAW,IAAI;EACf,SAAS,IAAI;EACb;EACA,QAAQ,IAAI;EACZ,OAAO,IAAI,SAAS;EACpB,QAAQ,IAAI,UAAU;EACtB,aAAa,IAAI;EACjB,cAAc,IAAI;EAClB,kBAAkB,IAAI;EACtB,kBAAkB,IAAI;EACtB,YAAY,IAAI,c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B1C,MAAM,QAlBJ,MAAM,GAAG,MACP;;;;;;wBAMgB,eAChB,OACD,EACD,KAQkB;EACpB,MAAM,YAAY,MAAM,aAAa;EACrC,MAAM,gBAAgB,MAAM,iBAAiB;AAE7C,SAAO;GACL;GACA,aAAa,YAAY,IAAI,gBAAgB,YAAY;GACzD,mBAAmB,MAAM,eAAe;GACxC,aAAa,MAAM,eAAe;GAClC,cAAc,MAAM,aAAa;GAClC;;AAGH,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AgentSummary, mockCreateAgentHandler, mockGetAgentHandler, mockListAgentsHandler } from "../agent/agent.handler.js";
|
|
2
|
+
import { Agent, AgentHandlers, CreateAgentInput, ListAgentsInput, ListAgentsOutput, ListRunsInput, ListRunsOutput, ListToolsInput, ListToolsOutput, Run, RunMetrics, Tool, UpdateAgentInput, createAgentHandlers } from "./agent.handlers.js";
|
|
2
3
|
import { RunSummary, mockExecuteAgentHandler, mockGetRunHandler, mockListRunsHandler } from "../run/run.handler.js";
|
|
3
4
|
import { ToolSummary, mockCreateToolHandler, mockGetToolHandler, mockListToolsHandler } from "../tool/tool.handler.js";
|
|
4
|
-
export { type AgentSummary, type RunSummary, type ToolSummary, mockCreateAgentHandler, mockCreateToolHandler, mockExecuteAgentHandler, mockGetAgentHandler, mockGetRunHandler, mockGetToolHandler, mockListAgentsHandler, mockListRunsHandler, mockListToolsHandler };
|
|
5
|
+
export { Agent, AgentHandlers, type AgentSummary, CreateAgentInput, ListAgentsInput, ListAgentsOutput, ListRunsInput, ListRunsOutput, ListToolsInput, ListToolsOutput, Run, RunMetrics, type RunSummary, Tool, type ToolSummary, UpdateAgentInput, createAgentHandlers, mockCreateAgentHandler, mockCreateToolHandler, mockExecuteAgentHandler, mockGetAgentHandler, mockGetRunHandler, mockGetToolHandler, mockListAgentsHandler, mockListRunsHandler, mockListToolsHandler };
|
package/dist/handlers/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mockCreateAgentHandler, mockGetAgentHandler, mockListAgentsHandler } from "../agent/agent.handler.js";
|
|
2
2
|
import { mockExecuteAgentHandler, mockGetRunHandler, mockListRunsHandler } from "../run/run.handler.js";
|
|
3
3
|
import { mockCreateToolHandler, mockGetToolHandler, mockListToolsHandler } from "../tool/tool.handler.js";
|
|
4
|
+
import { createAgentHandlers } from "./agent.handlers.js";
|
|
4
5
|
|
|
5
|
-
export { mockCreateAgentHandler, mockCreateToolHandler, mockExecuteAgentHandler, mockGetAgentHandler, mockGetRunHandler, mockGetToolHandler, mockListAgentsHandler, mockListRunsHandler, mockListToolsHandler };
|
|
6
|
+
export { createAgentHandlers, mockCreateAgentHandler, mockCreateToolHandler, mockExecuteAgentHandler, mockGetAgentHandler, mockGetRunHandler, mockGetToolHandler, mockListAgentsHandler, mockListRunsHandler, mockListToolsHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { AgentConsoleDashboardPresentation, AgentDetailPresentation, AgentListPr
|
|
|
8
8
|
import { AgentModel, AgentSummaryModel, AgentToolRefModel, AgentWithToolsModel, CreateAgentInputModel, UpdateAgentInputModel } from "./agent/agent.schema.js";
|
|
9
9
|
import "./agent/index.js";
|
|
10
10
|
import example from "./example.js";
|
|
11
|
+
import { AgentHandlers, CreateAgentInput, UpdateAgentInput, createAgentHandlers } from "./handlers/agent.handlers.js";
|
|
11
12
|
import { ListRunsInput, ListRunsOutput, RunSummary, mockCancelRunHandler, mockExecuteAgentHandler, mockGetRunHandler, mockListRunsHandler } from "./run/run.handler.js";
|
|
12
13
|
import { ListToolsInput, ListToolsOutput, ToolSummary, mockCreateToolHandler, mockGetToolHandler, mockListToolsHandler, mockTestToolHandler, mockUpdateToolHandler } from "./tool/tool.handler.js";
|
|
13
14
|
import { GranularityEnum, LogLevelEnum, RunStatusEnum, RunStepTypeEnum } from "./run/run.enum.js";
|
|
@@ -27,4 +28,21 @@ import "./tool/index.js";
|
|
|
27
28
|
import { MOCK_AGENTS } from "./shared/mock-agents.js";
|
|
28
29
|
import { MOCK_TOOLS } from "./shared/mock-tools.js";
|
|
29
30
|
import { MOCK_RUNS } from "./shared/mock-runs.js";
|
|
30
|
-
|
|
31
|
+
import { AgentDashboard } from "./ui/AgentDashboard.js";
|
|
32
|
+
import { RunListView } from "./ui/views/RunListView.js";
|
|
33
|
+
import { ToolRegistryView } from "./ui/views/ToolRegistryView.js";
|
|
34
|
+
import { AgentListView } from "./ui/views/AgentListView.js";
|
|
35
|
+
import { CreateAgentModal } from "./ui/modals/CreateAgentModal.js";
|
|
36
|
+
import { UseAgentListOptions, useAgentList } from "./ui/hooks/useAgentList.js";
|
|
37
|
+
import { AgentActionsModal } from "./ui/modals/AgentActionsModal.js";
|
|
38
|
+
import { UseRunListOptions, useRunList } from "./ui/hooks/useRunList.js";
|
|
39
|
+
import { UseToolListOptions, useToolList } from "./ui/hooks/useToolList.js";
|
|
40
|
+
import { UseAgentMutationsOptions, useAgentMutations } from "./ui/hooks/useAgentMutations.js";
|
|
41
|
+
import { agentListReactRenderer } from "./ui/renderers/agent-list.renderer.js";
|
|
42
|
+
import { agentListMarkdownRenderer } from "./ui/renderers/agent-list.markdown.js";
|
|
43
|
+
import { runListMarkdownRenderer } from "./ui/renderers/run-list.markdown.js";
|
|
44
|
+
import { toolRegistryMarkdownRenderer } from "./ui/renderers/tool-registry.markdown.js";
|
|
45
|
+
import { agentDashboardMarkdownRenderer } from "./ui/renderers/dashboard.markdown.js";
|
|
46
|
+
import { agentConsoleDemoOverlay, agentConsoleOverlays, agentConsoleReadOnlyOverlay } from "./ui/overlays/demo-overlays.js";
|
|
47
|
+
import "./ui/index.js";
|
|
48
|
+
export { AgentActionsModal, AgentConsoleDashboardPresentation, AgentConsoleFeature, AgentCreatedEvent, AgentDashboard, AgentDetailPresentation, AgentEntity, type AgentHandlers, AgentListPresentation, AgentListView, AgentModel, RunListView as AgentRunList, AgentStatusEntityEnum, AgentStatusEnum, AgentSummary, AgentSummaryModel, AgentToolAssignedEvent, AgentToolEntity, AgentToolRef, AgentToolRefModel, ToolRegistryView as AgentToolRegistry, AgentToolRemovedEvent, AgentUpdatedEvent, AgentWithTools, AgentWithToolsModel, AssignToolToAgentCommand, CancelRunCommand, CreateAgentCommand, CreateAgentInput, CreateAgentInputModel, CreateAgentModal, CreateToolCommand, CreateToolInputModel, ExecuteAgentCommand, GetAgentInput, GetAgentQuery, GetRunLogsQuery, GetRunMetricsQuery, GetRunQuery, GetRunStepsQuery, GetToolQuery, GranularityEnum, ImplementationTypeEntityEnum, ImplementationTypeEnum, ListAgentsInput, ListAgentsOutput, ListAgentsQuery, ListRunsInput, ListRunsOutput, ListRunsQuery, ListToolsInput, ListToolsOutput, ListToolsQuery, LogLevelEntityEnum, LogLevelEnum, MOCK_AGENTS, MOCK_RUNS, MOCK_TOOLS, MessageGeneratedEvent, ModelProviderEntityEnum, ModelProviderEnum, RemoveToolFromAgentCommand, RunAgentRefModel, RunCancelledEvent, RunCompletedEvent, RunDetailPresentation, RunEntity, RunFailedEvent, RunInputModel, RunListPresentation, RunListView, RunLogEntity, RunLogModel, RunModel, RunStartedEvent, RunStatusEntityEnum, RunStatusEnum, RunStepEntity, RunStepModel, RunStepTypeEntityEnum, RunStepTypeEnum, RunSummary, RunSummaryModel, TestToolCommand, TimelineDataPointModel, ToolCategoryEntityEnum, ToolCategoryEnum, ToolChoiceEnum, ToolCompletedEvent, ToolCreatedEvent, ToolDetailPresentation, ToolEntity, ToolInvokedEvent, ToolListPresentation, ToolModel, ToolRegistryView, ToolStatusChangedEvent, ToolStatusEntityEnum, ToolStatusEnum, ToolSummary, ToolSummaryModel, ToolUpdatedEvent, UpdateAgentCommand, UpdateAgentInput, UpdateAgentInputModel, UpdateToolCommand, UpdateToolInputModel, UseAgentListOptions, UseAgentMutationsOptions, UseRunListOptions, UseToolListOptions, agentConsoleDemoOverlay, agentConsoleOverlays, agentConsoleReadOnlyOverlay, agentDashboardMarkdownRenderer, agentListMarkdownRenderer, agentListReactRenderer, createAgentHandlers, example, mockCancelRunHandler, mockCreateAgentHandler, mockCreateToolHandler, mockExecuteAgentHandler, mockGetAgentHandler, mockGetRunHandler, mockGetToolHandler, mockListAgentsHandler, mockListRunsHandler, mockListToolsHandler, mockTestToolHandler, mockUpdateAgentHandler, mockUpdateToolHandler, runListMarkdownRenderer, toolRegistryMarkdownRenderer, useAgentList, useAgentMutations, useRunList, useToolList };
|