@slashfi/agents-sdk 0.27.1 → 0.28.1

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/src/types.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import type { EventCallback, EventType } from "./events.js";
8
+ import type { AgentAction, CallerType } from "./call-agent-schema.js";
8
9
 
9
10
  /** Internal listener entry stored on agents/tools */
10
11
  export interface ListenerEntry {
@@ -262,16 +263,8 @@ export type SecurityScheme =
262
263
  // Agent Configuration
263
264
  // ============================================
264
265
 
265
- /**
266
- * Supported actions for agents.
267
- */
268
- export type AgentAction =
269
- | "invoke"
270
- | "ask"
271
- | "execute_tool"
272
- | "describe_tools"
273
- | "load"
274
- | "learn";
266
+ // AgentAction is derived from the zod schema in call-agent-schema.ts
267
+ export type { AgentAction } from "./call-agent-schema.js";
275
268
 
276
269
  /**
277
270
  * Agent configuration options.
@@ -336,7 +329,7 @@ export interface AgentConfig {
336
329
  /**
337
330
  * Caller type for context.
338
331
  */
339
- export type CallerType = "agent" | "user" | "system";
332
+ export type { CallerType } from "./call-agent-schema.js";
340
333
 
341
334
  /**
342
335
  * Core context shared across all executions.
@@ -457,25 +450,6 @@ export interface MessageContext extends CoreContext {
457
450
  senderType: "human" | "agent" | "bot" | "system";
458
451
  }
459
452
 
460
- /**
461
- * Context for the onLearn hook.
462
- *
463
- * @experimental The onLearn hook is not yet implemented.
464
- */
465
- export interface LearnContext extends CoreContext {
466
- /** Content to internalize */
467
- content: string;
468
-
469
- /** How long to remember */
470
- scope: "session" | "persistent" | "global";
471
-
472
- /** Category/topic for organization */
473
- category?: string;
474
-
475
- /** Who is teaching */
476
- callerId: string;
477
- }
478
-
479
453
  /**
480
454
  * Context for dynamic tool selection.
481
455
  */
@@ -541,14 +515,6 @@ export interface AgentRuntime {
541
515
  */
542
516
  onMessage?: (ctx: MessageContext) => Promise<void>;
543
517
 
544
- /**
545
- * Called when learning new information.
546
- * Use for memory management, knowledge updates.
547
- *
548
- * @experimental Not yet implemented in the agent runtime.
549
- */
550
- onLearn?: (ctx: LearnContext) => Promise<void>;
551
-
552
518
  /**
553
519
  * Dynamically select which tools to expose for a request.
554
520
  * Return tool names to include. If not implemented, all tools exposed.
@@ -699,72 +665,17 @@ export interface AgentDefinition<TContext extends ToolContext = ToolContext> {
699
665
  }
700
666
 
701
667
  // ============================================
702
- // CallAgent Request Types
668
+ // CallAgent Request Types (derived from zod schemas)
703
669
  // ============================================
704
670
 
705
- /** Base request fields */
706
- interface CallAgentBaseRequest {
707
- /** Target agent path */
708
- path: string;
709
- /** Caller ID for access control */
710
- callerId?: string;
711
- /** Caller type */
712
- callerType?: CallerType;
713
- /** Additional metadata */
714
- metadata?: Record<string, unknown>;
715
- }
716
-
717
- /** Invoke: fire-and-forget */
718
- export interface CallAgentInvokeRequest extends CallAgentBaseRequest {
719
- action: "invoke";
720
- prompt: string;
721
- sessionId?: string;
722
- branchAttributes?: Record<string, string>;
723
- }
724
-
725
- /** Ask: invoke and wait for response */
726
- export interface CallAgentAskRequest extends CallAgentBaseRequest {
727
- action: "ask";
728
- prompt: string;
729
- sessionId?: string;
730
- branchAttributes?: Record<string, string>;
731
- }
732
-
733
- /** Execute a specific tool */
734
- export interface CallAgentExecuteToolRequest extends CallAgentBaseRequest {
735
- action: "execute_tool";
736
- tool: string;
737
- params?: Record<string, unknown>;
738
- }
739
-
740
- /** Get tool schemas */
741
- export interface CallAgentDescribeToolsRequest extends CallAgentBaseRequest {
742
- action: "describe_tools";
743
- /** Optional: filter to specific tools */
744
- tools?: string[];
745
- }
746
-
747
- /** Load: get agent definition */
748
- export interface CallAgentLoadRequest extends CallAgentBaseRequest {
749
- action: "load";
750
- }
751
-
752
- /** Learn: teach the agent something */
753
- export interface CallAgentLearnRequest extends CallAgentBaseRequest {
754
- action: "learn";
755
- content: string;
756
- scope?: "session" | "persistent" | "global";
757
- category?: string;
758
- }
759
-
760
- /** Union of all request types */
761
- export type CallAgentRequest =
762
- | CallAgentInvokeRequest
763
- | CallAgentAskRequest
764
- | CallAgentExecuteToolRequest
765
- | CallAgentDescribeToolsRequest
766
- | CallAgentLoadRequest
767
- | CallAgentLearnRequest;
671
+ export type {
672
+ CallAgentRequest,
673
+ CallAgentInvokeRequest,
674
+ CallAgentAskRequest,
675
+ CallAgentExecuteToolRequest,
676
+ CallAgentDescribeToolsRequest,
677
+ CallAgentLoadRequest,
678
+ } from "./call-agent-schema.js";
768
679
 
769
680
  // ============================================
770
681
  // CallAgent Response Types
@@ -817,10 +728,10 @@ export interface CallAgentLoadResponse {
817
728
  };
818
729
  }
819
730
 
820
- /** Success response for learn */
821
- export interface CallAgentLearnResponse {
731
+ /** Callback response (fire-and-forget confirmation) */
732
+ export interface CallAgentCallbackResponse {
822
733
  success: true;
823
- action: "stored" | "updated" | "ignored";
734
+ callbackId: string;
824
735
  }
825
736
 
826
737
  /** Error response */
@@ -837,5 +748,5 @@ export type CallAgentResponse =
837
748
  | CallAgentExecuteToolResponse
838
749
  | CallAgentDescribeToolsResponse
839
750
  | CallAgentLoadResponse
840
- | CallAgentLearnResponse
751
+ | CallAgentCallbackResponse
841
752
  | CallAgentErrorResponse;