@deepagents/agent 0.1.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.
Files changed (57) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +916 -0
  4. package/dist/index.js.map +7 -0
  5. package/dist/lib/agent.d.ts +100 -0
  6. package/dist/lib/agent.d.ts.map +1 -0
  7. package/dist/lib/blog/deepagents.d.ts +12 -0
  8. package/dist/lib/blog/deepagents.d.ts.map +1 -0
  9. package/dist/lib/blog/docker.d.ts +4 -0
  10. package/dist/lib/blog/docker.d.ts.map +1 -0
  11. package/dist/lib/blog/mesh.d.ts +4 -0
  12. package/dist/lib/blog/mesh.d.ts.map +1 -0
  13. package/dist/lib/blog/package-star.d.ts +4 -0
  14. package/dist/lib/blog/package-star.d.ts.map +1 -0
  15. package/dist/lib/blog/research.d.ts +4 -0
  16. package/dist/lib/blog/research.d.ts.map +1 -0
  17. package/dist/lib/blog/star.d.ts +4 -0
  18. package/dist/lib/blog/star.d.ts.map +1 -0
  19. package/dist/lib/examples/animated_svg.d.ts +2 -0
  20. package/dist/lib/examples/animated_svg.d.ts.map +1 -0
  21. package/dist/lib/examples/finanicals_bot.d.ts +2 -0
  22. package/dist/lib/examples/finanicals_bot.d.ts.map +1 -0
  23. package/dist/lib/examples/plan_and_act_example.d.ts +2 -0
  24. package/dist/lib/examples/plan_and_act_example.d.ts.map +1 -0
  25. package/dist/lib/examples/planner.d.ts +15 -0
  26. package/dist/lib/examples/planner.d.ts.map +1 -0
  27. package/dist/lib/examples/research_bot.d.ts +2 -0
  28. package/dist/lib/examples/research_bot.d.ts.map +1 -0
  29. package/dist/lib/memory.d.ts +701 -0
  30. package/dist/lib/memory.d.ts.map +1 -0
  31. package/dist/lib/models.d.ts +7 -0
  32. package/dist/lib/models.d.ts.map +1 -0
  33. package/dist/lib/patterns/plan_and_act/plan_and_act.d.ts +56 -0
  34. package/dist/lib/patterns/plan_and_act/plan_and_act.d.ts.map +1 -0
  35. package/dist/lib/patterns/plan_and_execute/plan_and_execute.d.ts +3 -0
  36. package/dist/lib/patterns/plan_and_execute/plan_and_execute.d.ts.map +1 -0
  37. package/dist/lib/patterns/plan_and_execute/plan_and_execute_os.d.ts +2 -0
  38. package/dist/lib/patterns/plan_and_execute/plan_and_execute_os.d.ts.map +1 -0
  39. package/dist/lib/patterns/plan_and_execute/plan_and_execute_supervisor.d.ts +2 -0
  40. package/dist/lib/patterns/plan_and_execute/plan_and_execute_supervisor.d.ts.map +1 -0
  41. package/dist/lib/patterns/plan_and_execute/plan_and_execute_triage.d.ts +2 -0
  42. package/dist/lib/patterns/plan_and_execute/plan_and_execute_triage.d.ts.map +1 -0
  43. package/dist/lib/patterns/rewoo/rewoo.d.ts +64 -0
  44. package/dist/lib/patterns/rewoo/rewoo.d.ts.map +1 -0
  45. package/dist/lib/patterns/supervisor.d.ts +12 -0
  46. package/dist/lib/patterns/supervisor.d.ts.map +1 -0
  47. package/dist/lib/prompts.d.ts +3 -0
  48. package/dist/lib/prompts.d.ts.map +1 -0
  49. package/dist/lib/rag.d.ts +2 -0
  50. package/dist/lib/rag.d.ts.map +1 -0
  51. package/dist/lib/stream_utils.d.ts +26 -0
  52. package/dist/lib/stream_utils.d.ts.map +1 -0
  53. package/dist/lib/swarm.d.ts +23 -0
  54. package/dist/lib/swarm.d.ts.map +1 -0
  55. package/dist/lib/visualize.d.ts +32 -0
  56. package/dist/lib/visualize.d.ts.map +1 -0
  57. package/package.json +44 -0
@@ -0,0 +1,7 @@
1
+ export declare const lmstudio: import("@ai-sdk/openai-compatible").OpenAICompatibleProvider<string, string, string, string>;
2
+ export declare const glm: import("@ai-sdk/openai-compatible").OpenAICompatibleProvider<string, string, string, string>;
3
+ export declare function embed(documents: string[]): Promise<{
4
+ embeddings: number[][];
5
+ dimensions: number;
6
+ }>;
7
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/lib/models.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,8FAKnB,CAAC;AAEH,eAAO,MAAM,GAAG,8FAId,CAAC;AAEH,wBAAsB,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACxD,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAQD"}
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ declare const PlanningResponseSchema: z.ZodObject<{
3
+ reasoning: z.ZodString;
4
+ plan: z.ZodObject<{
5
+ steps: z.ZodArray<z.ZodString>;
6
+ estimated_complexity: z.ZodEnum<{
7
+ low: "low";
8
+ medium: "medium";
9
+ high: "high";
10
+ }>;
11
+ }, z.core.$strip>;
12
+ }, z.core.$strip>;
13
+ declare const ExecutionResultSchema: z.ZodObject<{
14
+ reasoning: z.ZodString;
15
+ action_taken: z.ZodString;
16
+ result: z.ZodString;
17
+ success: z.ZodBoolean;
18
+ }, z.core.$strip>;
19
+ declare const ReplanningDecisionSchema: z.ZodObject<{
20
+ reasoning: z.ZodString;
21
+ decision: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
+ type: z.ZodLiteral<"continue">;
23
+ updated_plan: z.ZodArray<z.ZodString>;
24
+ notes: z.ZodOptional<z.ZodString>;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ type: z.ZodLiteral<"complete">;
27
+ final_answer: z.ZodString;
28
+ summary: z.ZodString;
29
+ }, z.core.$strip>], "type">;
30
+ }, z.core.$strip>;
31
+ export type PlanningResponse = z.infer<typeof PlanningResponseSchema>;
32
+ export type ExecutionResult = z.infer<typeof ExecutionResultSchema>;
33
+ export type ReplanningDecision = z.infer<typeof ReplanningDecisionSchema>;
34
+ export interface PlanAndActState {
35
+ originalQuery: string;
36
+ currentPlan: string[];
37
+ executionHistory: Array<{
38
+ stepIndex: number;
39
+ step: string;
40
+ execution: ExecutionResult;
41
+ decision: ReplanningDecision;
42
+ }>;
43
+ isComplete: boolean;
44
+ finalAnswer?: string;
45
+ }
46
+ /**
47
+ * Implements the Plan-and-Act framework from the whitepaper.
48
+ * Separates high-level planning from low-level execution with dynamic replanning.
49
+ */
50
+ export declare function runPlanAndAct(query: string, maxIterations?: number): Promise<{
51
+ plan: PlanningResponse;
52
+ history: PlanAndActState['executionHistory'];
53
+ answer: string;
54
+ }>;
55
+ export {};
56
+ //# sourceMappingURL=plan_and_act.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan_and_act.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_act/plan_and_act.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,QAAA,MAAM,sBAAsB;;;;;;;;;;iBAY1B,CAAC;AAGH,QAAA,MAAM,qBAAqB;;;;;iBASzB,CAAC;AAGH,QAAA,MAAM,wBAAwB;;;;;;;;;;;iBAuB5B,CAAC;AAGH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAG1E,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,eAAe,CAAC;QAC3B,QAAQ,EAAE,kBAAkB,CAAC;KAC9B,CAAC,CAAC;IACH,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAgFD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,KAAK,EAAE,MAAM,EACb,aAAa,SAAK,GACjB,OAAO,CAAC;IACT,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CA6ID"}
@@ -0,0 +1,3 @@
1
+ export declare const triage: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables>;
2
+ export declare function planAndExecute(objective: string, autoConfirm?: boolean): Promise<string>;
3
+ //# sourceMappingURL=plan_and_execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan_and_execute.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute.ts"],"names":[],"mappings":"AAsGA,eAAO,MAAM,MAAM,oFAUjB,CAAC;AAGH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,UAAQ,GAClB,OAAO,CAAC,MAAM,CAAC,CAmFjB"}
@@ -0,0 +1,2 @@
1
+ export declare function planAndExecute(objective: string, autoConfirm?: boolean): Promise<string>;
2
+ //# sourceMappingURL=plan_and_execute_os.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan_and_execute_os.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute_os.ts"],"names":[],"mappings":"AAuGA,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,UAAQ,GAClB,OAAO,CAAC,MAAM,CAAC,CAmFjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plan_and_execute_supervisor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan_and_execute_supervisor.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute_supervisor.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=plan_and_execute_triage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan_and_execute_triage.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/plan_and_execute/plan_and_execute_triage.ts"],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import z from 'zod';
2
+ declare const ToolNameSchema: z.ZodEnum<{
3
+ images: "images";
4
+ web: "web";
5
+ news: "news";
6
+ }>;
7
+ export declare const RewooPlanSchema: z.ZodObject<{
8
+ statements: z.ZodArray<z.ZodObject<{
9
+ id: z.ZodString;
10
+ content: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ tool_calls: z.ZodArray<z.ZodObject<{
13
+ id: z.ZodString;
14
+ tool: z.ZodEnum<{
15
+ images: "images";
16
+ web: "web";
17
+ news: "news";
18
+ }>;
19
+ input: z.ZodString;
20
+ depends_on: z.ZodDefault<z.ZodArray<z.ZodString>>;
21
+ }, z.core.$strip>>;
22
+ notes: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ export type RewooPlan = z.infer<typeof RewooPlanSchema>;
25
+ export type Evidence = {
26
+ id: string;
27
+ tool: z.infer<typeof ToolNameSchema>;
28
+ input: string;
29
+ summary: string;
30
+ raw?: unknown;
31
+ };
32
+ export declare const rewooPlanner: import("../../agent.ts").Agent<{
33
+ statements: {
34
+ id: string;
35
+ content: string;
36
+ }[];
37
+ tool_calls: {
38
+ id: string;
39
+ tool: "images" | "web" | "news";
40
+ input: string;
41
+ depends_on: string[];
42
+ }[];
43
+ notes?: string | undefined;
44
+ }, import("../../agent.ts").ContextVariables>;
45
+ export declare const rewooSolver: import("../../agent.ts").Agent<unknown, import("../../agent.ts").ContextVariables>;
46
+ export declare function runRewoo(query: string): Promise<{
47
+ readonly plan: {
48
+ statements: {
49
+ id: string;
50
+ content: string;
51
+ }[];
52
+ tool_calls: {
53
+ id: string;
54
+ tool: "images" | "web" | "news";
55
+ input: string;
56
+ depends_on: string[];
57
+ }[];
58
+ notes?: string | undefined;
59
+ };
60
+ readonly evidences: Evidence[];
61
+ readonly answer: string;
62
+ }>;
63
+ export {};
64
+ //# sourceMappingURL=rewoo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewoo.d.ts","sourceRoot":"","sources":["../../../../src/lib/patterns/rewoo/rewoo.ts"],"names":[],"mappings":"AACA,OAAO,CAAC,MAAM,KAAK,CAAC;AAcpB,QAAA,MAAM,cAAc;;;;EAAoC,CAAC;AAiBzD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAa1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AASF,eAAO,MAAM,YAAY;;;;;;;;;;;;6CAoBvB,CAAC;AA+BH,eAAO,MAAM,WAAW,oFAgBtB,CAAC;AAMH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;GAmC3C"}
@@ -0,0 +1,12 @@
1
+ import { type Tool } from 'ai';
2
+ import { type Agent, type AgentModel, type Instruction } from '../agent.ts';
3
+ export declare function createSupervisor<C>(props: {
4
+ prompt: Instruction<C>;
5
+ subagents: Agent<unknown, C>[];
6
+ name?: string;
7
+ model: AgentModel;
8
+ outputMode?: 'full_history' | 'last_message';
9
+ handoffDescription?: string;
10
+ tools?: Record<string, Tool>;
11
+ }): Agent<unknown, C>;
12
+ //# sourceMappingURL=supervisor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../../src/lib/patterns/supervisor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,aAAa,CAAC;AAKrB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE;IACzC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC9B,qBA2EA"}
@@ -0,0 +1,3 @@
1
+ export declare const RECOMMENDED_PROMPT_PREFIX: string;
2
+ export declare const SUPERVISOR_PROMPT_PREFIX: string;
3
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,yBAAyB,QAqB1B,CAAC;AAEb,eAAO,MAAM,wBAAwB,QAuBpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rag.d.ts","sourceRoot":"","sources":["../../src/lib/rag.ts"],"names":[],"mappings":""}
@@ -0,0 +1,26 @@
1
+ import { type GenerateTextResult, type InferUIMessageChunk, type StreamTextResult, type Tool, type ToolCallOptions, type UIDataTypes, type UIMessage, type UITools } from 'ai';
2
+ export declare function streamWrite(response: StreamTextResult<Record<string, Tool>, never>): Promise<void>;
3
+ export declare const printer: {
4
+ readableStream: (stream: ReadableStream<InferUIMessageChunk<UIMessage<unknown, UIDataTypes, UITools>>>, options?: {
5
+ reasoning?: boolean;
6
+ wrapInTags?: boolean;
7
+ text?: boolean;
8
+ }) => Promise<void>;
9
+ stdout: (response: StreamTextResult<Record<string, Tool>, unknown>, options?: {
10
+ reasoning?: boolean;
11
+ text?: boolean;
12
+ wrapInTags?: boolean;
13
+ }) => Promise<void>;
14
+ mermaid: (root: import("./agent.ts").Agent<any, import("./agent.ts").ContextVariables>, options?: import("./visualize.ts").VisualizeOptions | undefined) => void;
15
+ semantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables>) => void;
16
+ richSemantic: (root: import("./agent.ts").Agent<unknown, import("./agent.ts").ContextVariables>) => void;
17
+ };
18
+ export declare function messageToUiMessage(message: string): UIMessage;
19
+ export declare const user: typeof messageToUiMessage;
20
+ export declare function input(defaultValue?: string): Promise<string>;
21
+ export declare function confirm(message: string, defaultValue?: boolean): Promise<boolean>;
22
+ export declare function last<T>(iterable: AsyncIterable<T>, position?: number): Promise<NonNullable<T>>;
23
+ export declare function finished<T>(iterable: AsyncIterable<T>): Promise<void>;
24
+ export declare function toOutput<T>(result: Promise<GenerateTextResult<Record<string, Tool>, T>> | StreamTextResult<Record<string, Tool>, T>): Promise<T>;
25
+ export declare function toState<C>(options: ToolCallOptions): C;
26
+ //# sourceMappingURL=stream_utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream_utils.d.ts","sourceRoot":"","sources":["../../src/lib/stream_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,IAAI,EACT,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,OAAO,EAEb,MAAM,IAAI,CAAC;AAaZ,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,iBA2BxD;AAmC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1,23 @@
1
+ import { type ModelMessage, type PrepareStepFunction, type PrepareStepResult, type Tool, type UIDataTypes, type UIMessage, type UITools, streamText } from 'ai';
2
+ import { type Agent, type AgentModel } from './agent.ts';
3
+ export type OutputMode = 'full_history' | 'last_message';
4
+ export interface ExecuteOptions {
5
+ contextVariables?: Record<string, unknown>;
6
+ systemPrompt?: string;
7
+ abortSignal?: AbortSignal;
8
+ outputMode?: OutputMode;
9
+ }
10
+ export declare function run<O, C>(agent: Agent<O, C>, messages: UIMessage[] | string, contextVariables: C, config?: {
11
+ abortSignal?: AbortSignal;
12
+ providerOptions?: Parameters<typeof streamText>[0]['providerOptions'];
13
+ }): Promise<import("ai").GenerateTextResult<Record<string, Tool>, O>>;
14
+ export declare function execute<O, C>(agent: Agent<O, C>, messages: UIMessage[] | string, contextVariables: C, config?: {
15
+ abortSignal?: AbortSignal;
16
+ providerOptions?: Parameters<typeof streamText>[0]['providerOptions'];
17
+ }): import("ai").StreamTextResult<Record<string, Tool>, import("ai").DeepPartial<O>>;
18
+ export declare const stream: typeof execute;
19
+ export declare const generate: typeof run;
20
+ export declare const prepareStep: <C>(agent: Agent<unknown, C>, model: AgentModel, contextVariables: C) => PrepareStepFunction<NoInfer<Record<string, Tool>>>;
21
+ export declare function swarm<C>(agent: Agent<unknown, C>, messages: UIMessage[] | string, contextVariables: C, abortSignal?: AbortSignal): ReadableStream<import("ai").InferUIMessageChunk<UIMessage<unknown, UIDataTypes, UITools>>>;
22
+ export declare function prepareAgent<C>(defaultModel: AgentModel, agent: Agent<unknown, C>, messages: ModelMessage[], contextVariables?: C): Promise<PrepareStepResult<NoInfer<Record<string, Tool>>>>;
23
+ //# sourceMappingURL=swarm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swarm.d.ts","sourceRoot":"","sources":["../../src/lib/swarm.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,EAGjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,I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,EAC3B,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EACxB,OAAO,UAAU,EACjB,kBAAkB,CAAC,KAClB,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAyBnD,CAAC;AAEF,wBAAgB,KAAK,CAAC,CAAC,EACrB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EACxB,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,EAC9B,gBAAgB,EAAE,CAAC,EACnB,WAAW,CAAC,EAAE,WAAW,8FAoE1B;AAED,wBAAsB,YAAY,CAAC,CAAC,EAClC,YAAY,EAAE,UAAU,EACxB,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,EACxB,QAAQ,EAAE,YAAY,EAAE,EACxB,gBAAgB,CAAC,EAAE,CAAC,GACnB,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CA+B3D"}
@@ -0,0 +1,32 @@
1
+ import type { Agent } from './agent.ts';
2
+ export type VisualizeOptions = {
3
+ direction?: 'LR' | 'TB' | 'BT' | 'RL';
4
+ showTools?: boolean;
5
+ };
6
+ /**
7
+ * Build a minimal Mermaid flowchart to visualize agents, their local tools, and handoff transfers.
8
+ *
9
+ * - Agent nodes include their name and (optionally) their tool names.
10
+ * - Edges represent transfer tools (handoffs) from one agent to another, labeled by the transfer tool name.
11
+ */
12
+ export declare function visualizeMermaid(root: Agent<any>, options?: VisualizeOptions): string;
13
+ /**
14
+ * Convenience alias with simpler name.
15
+ */
16
+ export declare const visualize: typeof visualizeMermaid;
17
+ /**
18
+ * Produce a semantic, human-readable map of transfers between agents.
19
+ * Example lines:
20
+ * supervisor transfers to: agentx, agenty
21
+ * agentx transfers to: supervisor
22
+ */
23
+ export declare function visualizeSemantic(root: Agent): string;
24
+ /**
25
+ * Minimal arrow-based semantic visualizer.
26
+ * Prints one line per transfer using Unicode arrows, e.g.:
27
+ * supervisor ──▶ agentx
28
+ * supervisor ──▶ agenty
29
+ * agentx ──▶ supervisor
30
+ */
31
+ export declare function visualizeRichSemantic(root: Agent): string;
32
+ //# sourceMappingURL=visualize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visualize.d.ts","sourceRoot":"","sources":["../../src/lib/visualize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACtC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAcF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,EAChB,OAAO,GAAE,gBAAqB,GAC7B,MAAM,CA2ER;AAOD;;GAEG;AACH,eAAO,MAAM,SAAS,yBAAmB,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAqBrD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,KAAK,GAAG,MAAM,CAyBzD"}
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@deepagents/agent",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!**/*.tsbuildinfo",
19
+ "!**/*.test.*"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "dependencies": {
25
+ "stringcase": "^4.3.1",
26
+ "lodash-es": "^4.17.21",
27
+ "zod-to-json-schema": "^3.24.6",
28
+ "ai": "^5.0.68",
29
+ "chalk": "^5.6.2",
30
+ "@ai-sdk/groq": "2.0.24",
31
+ "listr2": "^9.0.4",
32
+ "@ai-sdk/openai": "2.0.51",
33
+ "conf": "^15.0.2",
34
+ "@ai-sdk/openai-compatible": "^1.0.22",
35
+ "dedent": "1.7.0",
36
+ "@deepagents/retrieval": "0.1.0"
37
+ },
38
+ "peerDependencies": {
39
+ "zod": "^3.25.76 || ^4.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/debug": "^4.1.12"
43
+ }
44
+ }