psadk 1.4.7 → 1.4.8

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.
@@ -12,6 +12,7 @@ export interface PSAgentConfig {
12
12
  model?: string;
13
13
  llm_config?: {
14
14
  max_completion_tokens?: number;
15
+ context_window?: number;
15
16
  max_specific_tool_calls?: number;
16
17
  reasoning_effort?: 'minimal' | 'low' | 'medium' | 'high';
17
18
  temperature?: number;
@@ -34,5 +35,32 @@ export interface PSAgentConfig {
34
35
  run_evaluator: boolean;
35
36
  reference_correlation_ids: string[] | null;
36
37
  };
38
+ /** Run the agent in-process via agent-core instead of the PS API. Default: false. */
39
+ local?: boolean;
40
+ /** Callback invoked for each streamed event during local execution. */
41
+ onEvent?: (event: LocalAgentEvent) => void;
37
42
  port?: number;
38
43
  }
44
+ /**
45
+ * Event emitted during local agent execution (local: true mode).
46
+ * Shape mirrors the remote event polling format so execute() can share a single handler path.
47
+ */
48
+ export interface LocalAgentEvent {
49
+ /** Current agent status */
50
+ agentStatus: 'pending' | 'in-progress' | 'waiting' | 'completed' | 'failed';
51
+ /** Unix timestamp (ms) when the event was generated */
52
+ timestamp: number;
53
+ /** Tool name — present when agentStatus is 'waiting' */
54
+ tool?: string;
55
+ /** Tool input — present when agentStatus is 'waiting' */
56
+ toolInput?: {
57
+ request_body: Record<string, any>;
58
+ };
59
+ /** Agent output — present when agentStatus is 'completed' */
60
+ output?: {
61
+ response: string;
62
+ [key: string]: any;
63
+ };
64
+ /** Error or status message — present when agentStatus is 'failed' or 'in-progress' */
65
+ message?: string;
66
+ }
@@ -1,3 +1,3 @@
1
1
  {
2
- "type": "commonjs"
2
+ "type": "module"
3
3
  }
@@ -9,6 +9,10 @@ export interface ServiceUrls {
9
9
  agents?: string;
10
10
  events?: string;
11
11
  llmtrack?: string;
12
+ /** Base URL for the PS LLM API. Used in local mode to route LLM calls in-process.
13
+ * e.g. 'https://dev.lionis.ai' — the /api/v1/llm path is appended automatically.
14
+ * Defaults to the agents service base URL when not specified. */
15
+ llm?: string;
12
16
  }
13
17
  export declare function sleep(ms: number): Promise<void>;
14
18
  /**
@@ -63,6 +67,8 @@ export declare class PSAgent implements AgentExecutor {
63
67
  private readonly log?;
64
68
  private serviceUrls?;
65
69
  private cancelledTasks;
70
+ private localAgent?;
71
+ private localEventLog;
66
72
  cancelTask: (taskId: string) => Promise<void>;
67
73
  /**
68
74
  * create a new PSAgent with the given config
@@ -232,6 +238,35 @@ export declare class PSAgent implements AgentExecutor {
232
238
  * @returns
233
239
  */
234
240
  execute(requestContext: RequestContext, eventBus: ExecutionEventBus): Promise<void>;
241
+ /**
242
+ * Translate an agent-core AgentEvent into a LocalAgentEvent.
243
+ * Returns undefined for events that don't need to be surfaced.
244
+ */
245
+ private translateAgentEvent;
246
+ /**
247
+ * Wrap a PSAgentTool as an agent-core AgentTool.
248
+ * The JSON Schema requestBody is passed as parameters directly—agent-core's
249
+ * validateToolArguments handles plain JSON Schema without TypeBox conversion.
250
+ */
251
+ private bridgePSToolToAgentTool;
252
+ /**
253
+ * Build a single-text user AgentMessage from a start() input object.
254
+ */
255
+ private buildUserMessage;
256
+ /**
257
+ * Convert history entries (remote format) to AgentMessage[] for agent-core.
258
+ */
259
+ private buildHistoryMessages;
260
+ /**
261
+ * Local start() path — runs agent-core in-process.
262
+ * Non-blocking: kicks off the loop and returns a synthetic correlation ID immediately.
263
+ */
264
+ private startLocal;
265
+ /**
266
+ * Local execute() path — A2A AgentExecutor using agent-core streaming.
267
+ * Publishes TaskStatusUpdateEvents to the eventBus as events arrive, without polling.
268
+ */
269
+ private executeLocal;
235
270
  private getHostIPAddress;
236
271
  /**
237
272
  * Port for A2A express server