@nestjs-adk/core 0.0.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.
Files changed (47) hide show
  1. package/README.md +28 -0
  2. package/dist/index.cjs +1452 -0
  3. package/dist/index.d.ts +49 -0
  4. package/dist/index.mjs +1394 -0
  5. package/dist/lib/abstracts/adk-agent.d.ts +17 -0
  6. package/dist/lib/abstracts/adk-engine.d.ts +6 -0
  7. package/dist/lib/abstracts/adk-skill.d.ts +3 -0
  8. package/dist/lib/abstracts/adk-tool.d.ts +6 -0
  9. package/dist/lib/abstracts/adk-workflow.d.ts +6 -0
  10. package/dist/lib/abstracts/artifact-store.d.ts +10 -0
  11. package/dist/lib/abstracts/embedder.d.ts +13 -0
  12. package/dist/lib/abstracts/memory-store.d.ts +13 -0
  13. package/dist/lib/abstracts/session-store.d.ts +8 -0
  14. package/dist/lib/constants.d.ts +8 -0
  15. package/dist/lib/decorators/agent.decorator.d.ts +2 -0
  16. package/dist/lib/decorators/skill.decorator.d.ts +6 -0
  17. package/dist/lib/decorators/tool.decorator.d.ts +6 -0
  18. package/dist/lib/decorators/workflow-agent.decorator.d.ts +2 -0
  19. package/dist/lib/embeddings/similarity.d.ts +3 -0
  20. package/dist/lib/errors/adk.error.d.ts +4 -0
  21. package/dist/lib/errors/boot.errors.d.ts +43 -0
  22. package/dist/lib/errors/index.d.ts +3 -0
  23. package/dist/lib/errors/runtime.errors.d.ts +51 -0
  24. package/dist/lib/models/context-policy.d.ts +16 -0
  25. package/dist/lib/models/model-specs.d.ts +48 -0
  26. package/dist/lib/module/adk-options.d.ts +24 -0
  27. package/dist/lib/module/adk.module.d.ts +8 -0
  28. package/dist/lib/prompts/adk-prompt.d.ts +8 -0
  29. package/dist/lib/prompts/prompt-files.d.ts +11 -0
  30. package/dist/lib/registry/agent-definition.d.ts +44 -0
  31. package/dist/lib/registry/agent-ref.d.ts +26 -0
  32. package/dist/lib/registry/agent-registry.d.ts +28 -0
  33. package/dist/lib/runner/agent-runner.d.ts +44 -0
  34. package/dist/lib/runner/instruction-builder.d.ts +7 -0
  35. package/dist/lib/runner/run-logger.d.ts +13 -0
  36. package/dist/lib/runner/state-bag.d.ts +9 -0
  37. package/dist/lib/sessions/agent-sessions.d.ts +15 -0
  38. package/dist/lib/stores/in-memory-artifact-store.d.ts +12 -0
  39. package/dist/lib/stores/in-memory-session-store.d.ts +11 -0
  40. package/dist/lib/testing/scripted-engine.d.ts +27 -0
  41. package/dist/lib/testing/scripted-model.d.ts +8 -0
  42. package/dist/lib/types/events.d.ts +113 -0
  43. package/dist/lib/types/options.d.ts +44 -0
  44. package/dist/lib/types/resolved-agent.d.ts +22 -0
  45. package/dist/lib/types/tool-context.d.ts +15 -0
  46. package/dist/lib/types/toolset.d.ts +10 -0
  47. package/package.json +35 -0
@@ -0,0 +1,17 @@
1
+ import type { AgentEvent, RunInput, RunResult } from "../types/events";
2
+ export declare abstract class AdkAgent<TOutput = unknown> {
3
+ readonly __adkOutput?: TOutput;
4
+ private readonly adkRunner;
5
+ ask(input: RunInput): Promise<RunResult<TOutput>>;
6
+ stream(input: RunInput): AsyncGenerator<AgentEvent>;
7
+ approve(params: {
8
+ sessionId: string;
9
+ callId: string;
10
+ message?: string;
11
+ }): Promise<RunResult>;
12
+ reject(params: {
13
+ sessionId: string;
14
+ callId: string;
15
+ reason?: string;
16
+ }): Promise<RunResult>;
17
+ }
@@ -0,0 +1,6 @@
1
+ import type { AgentEvent, RunInput } from "../types/events";
2
+ import type { ResolvedAgent } from "../types/resolved-agent";
3
+ export declare abstract class AdkEngine {
4
+ abstract run(agent: ResolvedAgent, input: RunInput): AsyncIterable<AgentEvent>;
5
+ native(): unknown;
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare abstract class AdkSkill {
2
+ abstract content(): string | Promise<string>;
3
+ }
@@ -0,0 +1,6 @@
1
+ import type { z } from "zod";
2
+ import type { AnyZodObject } from "../types/options";
3
+ import type { ToolContext } from "../types/tool-context";
4
+ export declare abstract class AdkTool<S extends AnyZodObject = AnyZodObject> {
5
+ abstract execute(input: z.infer<S>, ctx?: ToolContext): unknown | Promise<unknown>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import type { AgentEvent, RunInput, RunResult } from "../types/events";
2
+ export declare abstract class AdkWorkflow {
3
+ private readonly adkRunner;
4
+ ask(input: RunInput): Promise<RunResult>;
5
+ stream(input: RunInput): AsyncGenerator<AgentEvent>;
6
+ }
@@ -0,0 +1,10 @@
1
+ import type { ArtifactPart, ArtifactRef } from "../types/events";
2
+ export declare abstract class ArtifactStore {
3
+ abstract save(ref: ArtifactRef, part: ArtifactPart): Promise<number>;
4
+ abstract load(ref: ArtifactRef, version?: number): Promise<ArtifactPart | null>;
5
+ abstract listKeys(scope: {
6
+ sessionId: string;
7
+ }): Promise<string[]>;
8
+ abstract listVersions(ref: ArtifactRef): Promise<number[]>;
9
+ abstract delete(ref: ArtifactRef): Promise<void>;
10
+ }
@@ -0,0 +1,13 @@
1
+ export interface EmbeddingUsage {
2
+ promptTokens: number;
3
+ }
4
+ export interface EmbeddingResult {
5
+ embeddings: number[][];
6
+ usage: EmbeddingUsage;
7
+ }
8
+ export declare abstract class Embedder {
9
+ private static active?;
10
+ static setActive(instance: Embedder | undefined): void;
11
+ static getActive(): Embedder;
12
+ abstract embed(texts: string[]): Promise<EmbeddingResult>;
13
+ }
@@ -0,0 +1,13 @@
1
+ export declare abstract class MemoryStore {
2
+ abstract ingest(entry: {
3
+ sessionId: string;
4
+ content: string;
5
+ metadata?: Record<string, unknown>;
6
+ }): Promise<void>;
7
+ abstract search(query: string, scope?: {
8
+ userId?: string;
9
+ }): Promise<Array<{
10
+ content: string;
11
+ score: number;
12
+ }>>;
13
+ }
@@ -0,0 +1,8 @@
1
+ import type { Session, SessionEvent, SessionInit } from "../types/events";
2
+ export declare abstract class SessionStore {
3
+ abstract get(id: string): Promise<Session | null>;
4
+ abstract create(init: SessionInit): Promise<Session>;
5
+ abstract appendEvent(sessionId: string, event: SessionEvent): Promise<void>;
6
+ abstract updateState(sessionId: string, delta: Record<string, unknown>): Promise<void>;
7
+ abstract delete(id: string): Promise<void>;
8
+ }
@@ -0,0 +1,8 @@
1
+ export declare const AGENT_METADATA: unique symbol;
2
+ export declare const TOOL_METADATA: unique symbol;
3
+ export declare const SKILL_METADATA: unique symbol;
4
+ export declare const WORKFLOW_METADATA: unique symbol;
5
+ export declare const INLINE_TOOLS_METADATA: unique symbol;
6
+ export declare const INLINE_SKILLS_METADATA: unique symbol;
7
+ export declare const ADK_OPTIONS: unique symbol;
8
+ export declare const ADK_RUNNER: unique symbol;
@@ -0,0 +1,2 @@
1
+ import type { AgentOptions } from "../types/options";
2
+ export declare function Agent(options: AgentOptions): ClassDecorator;
@@ -0,0 +1,6 @@
1
+ import type { SkillOptions } from "../types/options";
2
+ export interface InlineSkillMetadata {
3
+ method: string;
4
+ options: Required<Pick<SkillOptions, "name" | "description" | "mode">>;
5
+ }
6
+ export declare function Skill(options: SkillOptions): (target: object, propertyKey?: string | symbol) => void;
@@ -0,0 +1,6 @@
1
+ import type { AnyZodObject, ToolOptions } from "../types/options";
2
+ export interface InlineToolMetadata {
3
+ method: string;
4
+ options: ToolOptions;
5
+ }
6
+ export declare function Tool<S extends AnyZodObject>(options: ToolOptions<S>): (target: object, propertyKey?: string | symbol) => void;
@@ -0,0 +1,2 @@
1
+ import type { WorkflowOptions } from "../types/options";
2
+ export declare function WorkflowAgent(options: WorkflowOptions): ClassDecorator;
@@ -0,0 +1,3 @@
1
+ export declare class Similarity {
2
+ cosine(a: number[], b: number[]): number;
3
+ }
@@ -0,0 +1,4 @@
1
+ export declare abstract class AdkError extends Error {
2
+ abstract readonly code: string;
3
+ constructor(message: string, options?: ErrorOptions);
4
+ }
@@ -0,0 +1,43 @@
1
+ import { AdkError } from "./adk.error";
2
+ export declare abstract class AdkBootError extends AdkError {
3
+ }
4
+ export declare class DuplicateAgentNameError extends AdkBootError {
5
+ readonly code = "DUPLICATE_AGENT_NAME";
6
+ constructor(name: string, classes: [string, string]);
7
+ }
8
+ export declare class ReservedMethodError extends AdkBootError {
9
+ readonly code = "RESERVED_METHOD";
10
+ constructor(agentClass: string, method: string);
11
+ }
12
+ export declare class UnregisteredToolError extends AdkBootError {
13
+ readonly code = "UNREGISTERED_TOOL";
14
+ constructor(agentClass: string, toolClass: string);
15
+ }
16
+ export declare class UnregisteredSkillError extends AdkBootError {
17
+ readonly code = "UNREGISTERED_SKILL";
18
+ constructor(agentClass: string, skillClass: string);
19
+ }
20
+ export declare class UnregisteredSubAgentError extends AdkBootError {
21
+ readonly code = "UNREGISTERED_SUB_AGENT";
22
+ constructor(agentClass: string, subAgentClass: string);
23
+ }
24
+ export declare class MissingModelError extends AdkBootError {
25
+ readonly code = "MISSING_MODEL";
26
+ constructor(agentClass: string);
27
+ }
28
+ export declare class InvalidWorkflowError extends AdkBootError {
29
+ readonly code = "INVALID_WORKFLOW";
30
+ constructor(workflowClass: string, reason: string);
31
+ }
32
+ export declare class ConflictingPromptError extends AdkBootError {
33
+ readonly code = "CONFLICTING_PROMPT";
34
+ constructor(agentClass: string);
35
+ }
36
+ export declare class UnregisteredPromptError extends AdkBootError {
37
+ readonly code = "UNREGISTERED_PROMPT";
38
+ constructor(agentClass: string, promptClass: string);
39
+ }
40
+ export declare class UnresolvedToolsetError extends AdkBootError {
41
+ readonly code = "UNRESOLVED_TOOLSET";
42
+ constructor(agentClass: string, toolsetName: string);
43
+ }
@@ -0,0 +1,3 @@
1
+ export { AdkError } from "./adk.error";
2
+ export { AdkBootError, DuplicateAgentNameError, ConflictingPromptError, InvalidWorkflowError, MissingModelError, ReservedMethodError, UnregisteredPromptError, UnregisteredSkillError, UnregisteredSubAgentError, UnregisteredToolError, UnresolvedToolsetError, } from "./boot.errors";
3
+ export { AgentNotFoundError, ApprovalNotFoundError, EmbedderNotConfiguredError, AiEmptyResponseError, McpConnectionError, ModelsExhaustedError, OutputValidationError, SessionNotFoundError, SkillNotFoundError, ToolExecutionError, } from "./runtime.errors";
@@ -0,0 +1,51 @@
1
+ import { AdkError } from "./adk.error";
2
+ export declare class AiEmptyResponseError extends AdkError {
3
+ readonly code = "AI_EMPTY_RESPONSE";
4
+ constructor(agent: string);
5
+ }
6
+ export declare class ToolExecutionError extends AdkError {
7
+ readonly tool: string;
8
+ readonly code = "TOOL_EXECUTION_FAILED";
9
+ constructor(tool: string, cause: unknown);
10
+ }
11
+ export declare class ModelsExhaustedError extends AdkError {
12
+ readonly failures: Array<{
13
+ target: string;
14
+ error: unknown;
15
+ }>;
16
+ readonly code = "MODELS_EXHAUSTED";
17
+ constructor(failures: Array<{
18
+ target: string;
19
+ error: unknown;
20
+ }>);
21
+ }
22
+ export declare class SessionNotFoundError extends AdkError {
23
+ readonly code = "SESSION_NOT_FOUND";
24
+ constructor(sessionId: string);
25
+ }
26
+ export declare class EmbedderNotConfiguredError extends AdkError {
27
+ readonly code = "EMBEDDER_NOT_CONFIGURED";
28
+ constructor();
29
+ }
30
+ export declare class AgentNotFoundError extends AdkError {
31
+ readonly code = "AGENT_NOT_FOUND";
32
+ constructor(agent: string);
33
+ }
34
+ export declare class SkillNotFoundError extends AdkError {
35
+ readonly code = "SKILL_NOT_FOUND";
36
+ constructor(skill: string, agent: string);
37
+ }
38
+ export declare class OutputValidationError extends AdkError {
39
+ readonly rawOutput: unknown;
40
+ readonly issues: unknown;
41
+ readonly code = "OUTPUT_VALIDATION_FAILED";
42
+ constructor(agent: string, rawOutput: unknown, issues: unknown);
43
+ }
44
+ export declare class McpConnectionError extends AdkError {
45
+ readonly code = "MCP_CONNECTION_FAILED";
46
+ constructor(server: string, cause: unknown);
47
+ }
48
+ export declare class ApprovalNotFoundError extends AdkError {
49
+ readonly code = "APPROVAL_NOT_FOUND";
50
+ constructor(callId: string, sessionId: string);
51
+ }
@@ -0,0 +1,16 @@
1
+ import type { ModelInput } from "../types/options";
2
+ export interface CompactionPolicy {
3
+ maxTokens: number;
4
+ targetTokens?: number;
5
+ keepRecent?: number;
6
+ summarizer?: ModelInput;
7
+ }
8
+ export interface ContextPolicy {
9
+ readonly __adkContextPolicy: true;
10
+ compaction?: CompactionPolicy;
11
+ offload?: {
12
+ threshold?: number;
13
+ } | false;
14
+ }
15
+ export declare function contextPolicy(options: Omit<ContextPolicy, "__adkContextPolicy">): ContextPolicy;
16
+ export declare const DEFAULT_OFFLOAD_THRESHOLD = 20000;
@@ -0,0 +1,48 @@
1
+ export interface GeminiOptions {
2
+ apiKey?: string;
3
+ vertexai?: boolean;
4
+ project?: string;
5
+ location?: string;
6
+ labels?: Record<string, string>;
7
+ cache?: {
8
+ content: string;
9
+ };
10
+ config?: Record<string, unknown>;
11
+ }
12
+ export declare class Gemini implements GeminiOptions {
13
+ readonly model: string;
14
+ readonly __adkModelSpec: "gemini";
15
+ readonly apiKey?: string;
16
+ readonly vertexai?: boolean;
17
+ readonly project?: string;
18
+ readonly location?: string;
19
+ readonly labels?: Record<string, string>;
20
+ readonly cache?: {
21
+ content: string;
22
+ };
23
+ readonly config?: Record<string, unknown>;
24
+ constructor(model: string, options?: GeminiOptions);
25
+ }
26
+ export interface OpenAiLikeOptions {
27
+ baseUrl?: string;
28
+ apiKeyEnv?: string;
29
+ }
30
+ export declare class OpenAiLike implements OpenAiLikeOptions {
31
+ readonly model: string;
32
+ readonly __adkModelSpec: "openai-like";
33
+ readonly baseUrl?: string;
34
+ readonly apiKeyEnv?: string;
35
+ constructor(model: string, options?: OpenAiLikeOptions);
36
+ }
37
+ export type RouterTarget = string | Gemini | OpenAiLike | object;
38
+ export declare class ModelRouter {
39
+ readonly __adkModelSpec: "router";
40
+ readonly targets: Record<string, RouterTarget>;
41
+ readonly strategy: "failover";
42
+ constructor(options: {
43
+ targets: Record<string, RouterTarget> | RouterTarget[];
44
+ strategy?: "failover";
45
+ });
46
+ }
47
+ export type ModelSpec = Gemini | OpenAiLike | ModelRouter;
48
+ export declare function isModelSpec(model: unknown): model is ModelSpec;
@@ -0,0 +1,24 @@
1
+ import type { InjectionToken, ModuleMetadata, Type } from "@nestjs/common";
2
+ import type { AdkEngine } from "../abstracts/adk-engine";
3
+ import type { ArtifactStore } from "../abstracts/artifact-store";
4
+ import type { MemoryStore } from "../abstracts/memory-store";
5
+ import type { SessionStore } from "../abstracts/session-store";
6
+ import type { ModelInput } from "../types/options";
7
+ export interface AdkModuleOptions {
8
+ engine: Type<AdkEngine>;
9
+ defaultModel?: ModelInput;
10
+ session?: Type<SessionStore>;
11
+ memory?: Type<MemoryStore>;
12
+ artifacts?: Type<ArtifactStore>;
13
+ embedder?: Type<import("../abstracts/embedder").Embedder>;
14
+ prompts?: {
15
+ dir?: string;
16
+ };
17
+ logging?: import("../runner/run-logger").LoggingOption;
18
+ context?: import("../models/context-policy").ContextPolicy;
19
+ }
20
+ export interface AdkModuleAsyncOptions extends Pick<ModuleMetadata, "imports"> {
21
+ engine: Type<AdkEngine>;
22
+ useFactory: (...args: never[]) => Omit<AdkModuleOptions, "engine"> | Promise<Omit<AdkModuleOptions, "engine">>;
23
+ inject?: InjectionToken[];
24
+ }
@@ -0,0 +1,8 @@
1
+ import { type DynamicModule } from "@nestjs/common";
2
+ import type { AdkModuleAsyncOptions, AdkModuleOptions } from "./adk-options";
3
+ export declare class AdkModule {
4
+ static forRoot(options: AdkModuleOptions): DynamicModule;
5
+ static forRootAsync(options: AdkModuleAsyncOptions): DynamicModule;
6
+ private static assemble;
7
+ }
8
+ export type { AdkModuleAsyncOptions, AdkModuleOptions } from "./adk-options";
@@ -0,0 +1,8 @@
1
+ import type { ToolContext } from "../types/tool-context";
2
+ export type PromptContext = ToolContext;
3
+ export declare abstract class AdkPrompt {
4
+ private readonly adkOptions?;
5
+ private readonly files;
6
+ abstract build(ctx: PromptContext): string | Promise<string>;
7
+ protected fromFile(path: string, vars?: Record<string, unknown>): Promise<string>;
8
+ }
@@ -0,0 +1,11 @@
1
+ export declare class PromptFiles {
2
+ private static readonly cache;
3
+ resolvePath(path: string, promptsDir?: string, callerDir?: string): string;
4
+ render(path: string, options?: {
5
+ promptsDir?: string;
6
+ callerDir?: string;
7
+ vars?: Record<string, unknown>;
8
+ }): Promise<string>;
9
+ interpolate(template: string, vars: Record<string, unknown>): string;
10
+ callerDir(): string | undefined;
11
+ }
@@ -0,0 +1,44 @@
1
+ import type { Type } from "@nestjs/common";
2
+ import type { AdkSkill } from "../abstracts/adk-skill";
3
+ import type { AdkTool } from "../abstracts/adk-tool";
4
+ import type { AdkPrompt } from "../prompts/adk-prompt";
5
+ import type { AgentOptions, ModelInput, SkillOptions, ToolOptions, WorkflowOptions } from "../types/options";
6
+ export type ToolBinding = {
7
+ kind: "class";
8
+ type: Type<AdkTool>;
9
+ instance: AdkTool;
10
+ options: ToolOptions;
11
+ } | {
12
+ kind: "inline";
13
+ method: string;
14
+ options: ToolOptions;
15
+ };
16
+ export type SkillBinding = {
17
+ kind: "class";
18
+ type: Type<AdkSkill>;
19
+ instance: AdkSkill;
20
+ options: Required<SkillOptions>;
21
+ } | {
22
+ kind: "inline";
23
+ method: string;
24
+ options: Required<SkillOptions>;
25
+ };
26
+ export declare class AgentDefinition {
27
+ readonly name: string;
28
+ readonly type: Type;
29
+ readonly instance: object;
30
+ readonly options: AgentOptions | undefined;
31
+ readonly model: ModelInput | undefined;
32
+ readonly tools: ToolBinding[];
33
+ readonly skills: SkillBinding[];
34
+ readonly subAgents: Type[];
35
+ readonly promptText: string | undefined;
36
+ readonly promptFile: string | undefined;
37
+ readonly promptInstance: AdkPrompt | undefined;
38
+ readonly workflow: WorkflowOptions | undefined;
39
+ readonly output?: import("../types/options").AnyZodObject | undefined;
40
+ readonly outputKey?: string | undefined;
41
+ readonly toolsets: import("../types/toolset").ToolsetRef[];
42
+ constructor(name: string, type: Type, instance: object, options: AgentOptions | undefined, model: ModelInput | undefined, tools: ToolBinding[], skills: SkillBinding[], subAgents: Type[], promptText: string | undefined, promptFile: string | undefined, promptInstance: AdkPrompt | undefined, workflow: WorkflowOptions | undefined, output?: import("../types/options").AnyZodObject | undefined, outputKey?: string | undefined, toolsets?: import("../types/toolset").ToolsetRef[]);
43
+ get description(): string;
44
+ }
@@ -0,0 +1,26 @@
1
+ import type { Type } from "@nestjs/common";
2
+ import type { AgentRunner } from "../runner/agent-runner";
3
+ import type { AgentEvent, RunInput, RunResult } from "../types/events";
4
+ import type { AgentDefinition } from "./agent-definition";
5
+ import type { AgentRegistry } from "./agent-registry";
6
+ export declare class AgentRef<TAgent = unknown> {
7
+ private readonly registry;
8
+ private readonly agentType;
9
+ private readonly getRunner;
10
+ readonly __adkAgent?: TAgent;
11
+ constructor(registry: AgentRegistry, agentType: Type, getRunner: () => AgentRunner);
12
+ get name(): string;
13
+ get definition(): AgentDefinition;
14
+ ask(input: RunInput): Promise<RunResult>;
15
+ stream(input: RunInput): AsyncGenerator<AgentEvent>;
16
+ approve(params: {
17
+ sessionId: string;
18
+ callId: string;
19
+ message?: string;
20
+ }): Promise<RunResult>;
21
+ reject(params: {
22
+ sessionId: string;
23
+ callId: string;
24
+ reason?: string;
25
+ }): Promise<RunResult>;
26
+ }
@@ -0,0 +1,28 @@
1
+ import { type OnApplicationBootstrap, type Type } from "@nestjs/common";
2
+ import { DiscoveryService, ModuleRef } from "@nestjs/core";
3
+ import type { AdkModuleOptions } from "../module/adk-options";
4
+ import type { ModelInput } from "../types/options";
5
+ import { AgentDefinition } from "./agent-definition";
6
+ import { AgentRef } from "./agent-ref";
7
+ export declare class AgentRegistry implements OnApplicationBootstrap {
8
+ private readonly discovery;
9
+ private readonly moduleRef;
10
+ private readonly options;
11
+ private readonly byName;
12
+ private readonly byType;
13
+ private readonly refs;
14
+ private readonly modelOverrides;
15
+ private built;
16
+ constructor(discovery: DiscoveryService, moduleRef: ModuleRef, options: AdkModuleOptions);
17
+ onApplicationBootstrap(): void;
18
+ list(): AgentDefinition[];
19
+ get(name: string): AgentDefinition;
20
+ getByType(type: Type): AgentDefinition;
21
+ overrideModel(type: Type, model: ModelInput): void;
22
+ modelFor(definition: AgentDefinition): ModelInput | undefined;
23
+ getRef(type: Type): AgentRef;
24
+ private ensureBuilt;
25
+ private build;
26
+ private createDefinition;
27
+ private hasToolsetResolver;
28
+ }
@@ -0,0 +1,44 @@
1
+ import { type Type } from "@nestjs/common";
2
+ import { AdkEngine } from "../abstracts/adk-engine";
3
+ import { ArtifactStore } from "../abstracts/artifact-store";
4
+ import { SessionStore } from "../abstracts/session-store";
5
+ import type { AdkModuleOptions } from "../module/adk-options";
6
+ import { AgentRegistry } from "../registry/agent-registry";
7
+ import type { AgentEvent, RunInput, RunResult } from "../types/events";
8
+ import type { ResolvedAgent } from "../types/resolved-agent";
9
+ import { ToolsetResolver } from "../types/toolset";
10
+ export declare class AgentRunner {
11
+ private readonly engine;
12
+ private readonly registry;
13
+ private readonly store;
14
+ private readonly artifacts;
15
+ private readonly options;
16
+ private readonly toolsets?;
17
+ constructor(engine: AdkEngine, registry: AgentRegistry, store: SessionStore, artifacts: ArtifactStore, options: AdkModuleOptions, toolsets?: ToolsetResolver | undefined);
18
+ run(agentType: Type | string, input: RunInput): AsyncGenerator<AgentEvent>;
19
+ ask<TOutput = unknown>(agentType: Type | string, input: RunInput): Promise<RunResult<TOutput>>;
20
+ approve(agentType: Type | string, params: {
21
+ sessionId: string;
22
+ callId: string;
23
+ message?: string;
24
+ }): Promise<RunResult>;
25
+ reject(agentType: Type | string, params: {
26
+ sessionId: string;
27
+ callId: string;
28
+ reason?: string;
29
+ }): Promise<RunResult>;
30
+ resolve(agentType: Type | string, input?: RunInput): Promise<ResolvedAgent>;
31
+ private definitionOf;
32
+ private openSession;
33
+ private takePending;
34
+ private createToolContext;
35
+ private policyOf;
36
+ private resolveAgent;
37
+ private needsApproval;
38
+ private executeBinding;
39
+ private maybeOffload;
40
+ private createReadArtifactTool;
41
+ private createLoadSkillTool;
42
+ private persistAgentEvent;
43
+ private persist;
44
+ }
@@ -0,0 +1,7 @@
1
+ import type { AgentDefinition, SkillBinding } from "../registry/agent-definition";
2
+ import type { ToolContext } from "../types/tool-context";
3
+ export interface InstructionOptions {
4
+ promptsDir?: string;
5
+ }
6
+ export declare function skillContent(definition: AgentDefinition, binding: SkillBinding): Promise<string>;
7
+ export declare function buildInstruction(definition: AgentDefinition, options?: InstructionOptions, ctx?: ToolContext): Promise<string | undefined>;
@@ -0,0 +1,13 @@
1
+ import type { AgentEvent, RunInput } from "../types/events";
2
+ export type LoggingOption = boolean | "info" | "debug" | "verbose" | undefined;
3
+ export declare class RunLogger {
4
+ private readonly level;
5
+ static create(option: LoggingOption, agentName: string): RunLogger | undefined;
6
+ private readonly logger;
7
+ private readonly startedAt;
8
+ private constructor();
9
+ start(input: RunInput): void;
10
+ event(event: AgentEvent): void;
11
+ private enabled;
12
+ private preview;
13
+ }
@@ -0,0 +1,9 @@
1
+ import type { StateBag } from "../types/tool-context";
2
+ export declare class DeltaStateBag implements StateBag {
3
+ private readonly initial;
4
+ private readonly changes;
5
+ constructor(initial: Record<string, unknown>);
6
+ get<T = unknown>(key: string): T | undefined;
7
+ set(key: string, value: unknown): void;
8
+ delta(): Record<string, unknown>;
9
+ }
@@ -0,0 +1,15 @@
1
+ import { SessionStore } from "../abstracts/session-store";
2
+ import type { Session, SessionEvent, SessionInit } from "../types/events";
3
+ export interface AppendSliceInput {
4
+ type: string;
5
+ data: Record<string, unknown>;
6
+ author?: SessionEvent["author"];
7
+ }
8
+ export declare class AgentSessions {
9
+ private readonly store;
10
+ constructor(store: SessionStore);
11
+ get(id: string): Promise<Session | null>;
12
+ create(init?: SessionInit): Promise<Session>;
13
+ append(sessionId: string, input: AppendSliceInput): Promise<SessionEvent>;
14
+ delete(id: string): Promise<void>;
15
+ }
@@ -0,0 +1,12 @@
1
+ import { ArtifactStore } from "../abstracts/artifact-store";
2
+ import type { ArtifactPart, ArtifactRef } from "../types/events";
3
+ export declare class InMemoryArtifactStore extends ArtifactStore {
4
+ private readonly artifacts;
5
+ save(ref: ArtifactRef, part: ArtifactPart): Promise<number>;
6
+ load(ref: ArtifactRef, version?: number): Promise<ArtifactPart | null>;
7
+ listKeys(scope: {
8
+ sessionId: string;
9
+ }): Promise<string[]>;
10
+ listVersions(ref: ArtifactRef): Promise<number[]>;
11
+ delete(ref: ArtifactRef): Promise<void>;
12
+ }
@@ -0,0 +1,11 @@
1
+ import { SessionStore } from "../abstracts/session-store";
2
+ import type { Session, SessionEvent, SessionInit } from "../types/events";
3
+ export declare class InMemorySessionStore extends SessionStore {
4
+ private readonly sessions;
5
+ get(id: string): Promise<Session | null>;
6
+ create(init: SessionInit): Promise<Session>;
7
+ appendEvent(sessionId: string, event: SessionEvent): Promise<void>;
8
+ updateState(sessionId: string, delta: Record<string, unknown>): Promise<void>;
9
+ delete(id: string): Promise<void>;
10
+ private require;
11
+ }
@@ -0,0 +1,27 @@
1
+ import { AdkEngine } from "../abstracts/adk-engine";
2
+ import type { AgentEvent, RunInput, TokenUsage } from "../types/events";
3
+ import type { ResolvedAgent } from "../types/resolved-agent";
4
+ export type ScriptTurn = {
5
+ kind: "tool_call";
6
+ tool: string;
7
+ args: unknown;
8
+ } | {
9
+ kind: "text";
10
+ text: string;
11
+ usage: TokenUsage;
12
+ } | {
13
+ kind: "fail";
14
+ message: string;
15
+ };
16
+ export declare function callTool(tool: string, args: unknown): ScriptTurn;
17
+ export declare function fail(message: string): ScriptTurn;
18
+ export declare function text(value: string, usage?: Partial<TokenUsage>): ScriptTurn;
19
+ export declare class ScriptedEngine extends AdkEngine {
20
+ private readonly scripts;
21
+ private readonly draft;
22
+ lastAgent?: ResolvedAgent;
23
+ lastInput?: RunInput;
24
+ enqueue(turns: ScriptTurn[]): void;
25
+ push(turn: ScriptTurn): void;
26
+ run(agent: ResolvedAgent, input: RunInput): AsyncGenerator<AgentEvent>;
27
+ }
@@ -0,0 +1,8 @@
1
+ import type { ScriptTurn } from "./scripted-engine";
2
+ export declare class ScriptedModel {
3
+ readonly __adkScriptedModel = true;
4
+ readonly scripts: ScriptTurn[][];
5
+ constructor(...scripts: ScriptTurn[][]);
6
+ enqueue(turns: ScriptTurn[]): this;
7
+ }
8
+ export declare function isScriptedModel(model: unknown): model is ScriptedModel;