@agent-e/server 1.6.4 → 1.6.6

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/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1,87 @@
1
+ import * as _agent_e_core from '@agent-e/core';
2
+ import { AgentEConfig, AgentE, EconomyState, EconomicEvent, Diagnosis, AgentEMode } from '@agent-e/core';
3
+
4
+ interface ServerConfig {
5
+ port?: number;
6
+ host?: string;
7
+ agentE?: Partial<Omit<AgentEConfig, 'adapter'>>;
8
+ validateState?: boolean;
9
+ corsOrigin?: string;
10
+ serveDashboard?: boolean;
11
+ }
12
+ interface EnrichedAdjustment {
13
+ parameter: string;
14
+ value: number;
15
+ scope?: _agent_e_core.ParameterScope;
16
+ reasoning: string;
17
+ }
18
+ declare class AgentEServer {
19
+ private readonly agentE;
20
+ private readonly server;
21
+ private lastState;
22
+ private adjustmentQueue;
23
+ private alerts;
24
+ readonly port: number;
25
+ private readonly host;
26
+ private readonly thresholds;
27
+ private readonly startedAt;
28
+ private wsHandle;
29
+ readonly validateState: boolean;
30
+ readonly corsOrigin: string;
31
+ readonly serveDashboard: boolean;
32
+ constructor(config?: ServerConfig);
33
+ start(): Promise<void>;
34
+ stop(): Promise<void>;
35
+ getAgentE(): AgentE;
36
+ getAddress(): {
37
+ port: number;
38
+ host: string;
39
+ };
40
+ getUptime(): number;
41
+ /**
42
+ * Process a tick with the given state.
43
+ * 1. Clear adjustment queue
44
+ * 2. Set state
45
+ * 3. Ingest events
46
+ * 4. Run agentE.tick(state)
47
+ * 5. Drain adjustment queue, enrich with reasoning from decisions
48
+ * 6. Return response
49
+ */
50
+ processTick(state: EconomyState, events?: EconomicEvent[]): Promise<{
51
+ adjustments: EnrichedAdjustment[];
52
+ alerts: Diagnosis[];
53
+ health: number;
54
+ tick: number;
55
+ decisions: ReturnType<AgentE['getDecisions']>;
56
+ }>;
57
+ /**
58
+ * Run Observer + Diagnoser on the given state without side effects (no execution).
59
+ * Computes fresh metrics from the state rather than reading stored metrics.
60
+ */
61
+ diagnoseOnly(state: EconomyState): {
62
+ diagnoses: ReturnType<AgentE['diagnoseNow']>;
63
+ health: number;
64
+ };
65
+ setMode(mode: AgentEMode): void;
66
+ lock(param: string): void;
67
+ unlock(param: string): void;
68
+ constrain(param: string, bounds: {
69
+ min: number;
70
+ max: number;
71
+ }): void;
72
+ broadcast(data: Record<string, unknown>): void;
73
+ }
74
+
75
+ /**
76
+ * Quick-start helper — creates and starts an AgentE server.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { startServer } from '@agent-e/server';
81
+ * const server = await startServer({ port: 3100 });
82
+ * // POST /tick, GET /health, etc.
83
+ * ```
84
+ */
85
+ declare function startServer(config?: ServerConfig): Promise<AgentEServer>;
86
+
87
+ export { AgentEServer, type EnrichedAdjustment, type ServerConfig, startServer };
@@ -0,0 +1,87 @@
1
+ import * as _agent_e_core from '@agent-e/core';
2
+ import { AgentEConfig, AgentE, EconomyState, EconomicEvent, Diagnosis, AgentEMode } from '@agent-e/core';
3
+
4
+ interface ServerConfig {
5
+ port?: number;
6
+ host?: string;
7
+ agentE?: Partial<Omit<AgentEConfig, 'adapter'>>;
8
+ validateState?: boolean;
9
+ corsOrigin?: string;
10
+ serveDashboard?: boolean;
11
+ }
12
+ interface EnrichedAdjustment {
13
+ parameter: string;
14
+ value: number;
15
+ scope?: _agent_e_core.ParameterScope;
16
+ reasoning: string;
17
+ }
18
+ declare class AgentEServer {
19
+ private readonly agentE;
20
+ private readonly server;
21
+ private lastState;
22
+ private adjustmentQueue;
23
+ private alerts;
24
+ readonly port: number;
25
+ private readonly host;
26
+ private readonly thresholds;
27
+ private readonly startedAt;
28
+ private wsHandle;
29
+ readonly validateState: boolean;
30
+ readonly corsOrigin: string;
31
+ readonly serveDashboard: boolean;
32
+ constructor(config?: ServerConfig);
33
+ start(): Promise<void>;
34
+ stop(): Promise<void>;
35
+ getAgentE(): AgentE;
36
+ getAddress(): {
37
+ port: number;
38
+ host: string;
39
+ };
40
+ getUptime(): number;
41
+ /**
42
+ * Process a tick with the given state.
43
+ * 1. Clear adjustment queue
44
+ * 2. Set state
45
+ * 3. Ingest events
46
+ * 4. Run agentE.tick(state)
47
+ * 5. Drain adjustment queue, enrich with reasoning from decisions
48
+ * 6. Return response
49
+ */
50
+ processTick(state: EconomyState, events?: EconomicEvent[]): Promise<{
51
+ adjustments: EnrichedAdjustment[];
52
+ alerts: Diagnosis[];
53
+ health: number;
54
+ tick: number;
55
+ decisions: ReturnType<AgentE['getDecisions']>;
56
+ }>;
57
+ /**
58
+ * Run Observer + Diagnoser on the given state without side effects (no execution).
59
+ * Computes fresh metrics from the state rather than reading stored metrics.
60
+ */
61
+ diagnoseOnly(state: EconomyState): {
62
+ diagnoses: ReturnType<AgentE['diagnoseNow']>;
63
+ health: number;
64
+ };
65
+ setMode(mode: AgentEMode): void;
66
+ lock(param: string): void;
67
+ unlock(param: string): void;
68
+ constrain(param: string, bounds: {
69
+ min: number;
70
+ max: number;
71
+ }): void;
72
+ broadcast(data: Record<string, unknown>): void;
73
+ }
74
+
75
+ /**
76
+ * Quick-start helper — creates and starts an AgentE server.
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * import { startServer } from '@agent-e/server';
81
+ * const server = await startServer({ port: 3100 });
82
+ * // POST /tick, GET /health, etc.
83
+ * ```
84
+ */
85
+ declare function startServer(config?: ServerConfig): Promise<AgentEServer>;
86
+
87
+ export { AgentEServer, type EnrichedAdjustment, type ServerConfig, startServer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-e/server",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "Ready-to-run HTTP + WebSocket server for AgentE",
5
5
  "license": "MIT",
6
6
  "repository": {