@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/dist/call-agent-schema.d.ts +494 -44
- package/dist/call-agent-schema.d.ts.map +1 -1
- package/dist/call-agent-schema.js +95 -55
- package/dist/call-agent-schema.js.map +1 -1
- package/dist/cjs/call-agent-schema.js +96 -56
- package/dist/cjs/call-agent-schema.js.map +1 -1
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/registry.js +0 -24
- package/dist/cjs/registry.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +0 -24
- package/dist/registry.js.map +1 -1
- package/dist/types.d.ts +8 -82
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +8 -8
- package/package.json +3 -2
- package/src/call-agent-schema.ts +136 -55
- package/src/index.ts +8 -3
- package/src/registry.ts +0 -29
- package/src/types.ts +17 -106
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
|
-
|
|
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
|
|
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
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
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
|
-
/**
|
|
821
|
-
export interface
|
|
731
|
+
/** Callback response (fire-and-forget confirmation) */
|
|
732
|
+
export interface CallAgentCallbackResponse {
|
|
822
733
|
success: true;
|
|
823
|
-
|
|
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
|
-
|
|
|
751
|
+
| CallAgentCallbackResponse
|
|
841
752
|
| CallAgentErrorResponse;
|