@toolpack-sdk/agents 2.0.0-alpha.1 → 2.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.
package/dist/index.d.cts CHANGED
@@ -1,15 +1,17 @@
1
- import { A as AgentInput, a as AgentResult, b as IAgentRegistry, d as AgentOutput, e as AgentInstance, C as ChannelInterface, P as PendingAsk, B as BaseAgentOptions } from './types-BWoRx1ZE.cjs';
2
- export { c as AgentRunOptions, I as Interceptor, f as InterceptorChainConfig, g as InterceptorContext, h as InterceptorResult, N as NextFunction, S as SKIP_SENTINEL, W as WorkflowStep, i as isSkipSentinel, s as skip } from './types-BWoRx1ZE.cjs';
3
- import { B as BaseAgent } from './base-agent-CjrUlo6Y.cjs';
4
- export { A as AgentEvents } from './base-agent-CjrUlo6Y.cjs';
5
- import { ModeConfig, ConversationStore, AssemblerOptions, AssembledPrompt } from 'toolpack-sdk';
1
+ import { A as AgentInput, a as AgentResult, c as IAgentRegistry, e as AgentOutput, f as AgentInstance, C as ChannelInterface, P as PendingAsk, B as BaseAgentOptions } from './types-TB6yypig.cjs';
2
+ export { b as AgentDelegationConfig, d as AgentRunOptions, I as Interceptor, g as InterceptorChainConfig, h as InterceptorContext, i as InterceptorResult, N as NextFunction, S as SKIP_SENTINEL, W as WorkflowStep, j as isSkipSentinel, s as skip } from './types-TB6yypig.cjs';
3
+ import { B as BaseAgent, A as AgentMindConfig } from './base-agent-DPdK4Pnl.cjs';
4
+ export { a as AgentEvents, C as ConfidenceLevel, G as GoalPriority, b as GoalStatus, M as MindBelief, c as MindEntry, d as MindEntryType, e as MindGoal, f as MindRecallResult, g as MindReflection, h as MindTtlDefaults } from './base-agent-DPdK4Pnl.cjs';
5
+ import { ModeConfig, ConversationStore, AssemblerOptions, AssembledPrompt, RequestToolDefinition, ToolProject } from 'toolpack-sdk';
6
6
  export { AssembledPrompt, AssemblerOptions, ConversationScope, ConversationStore, GetOptions, InMemoryConversationStore, InMemoryConversationStoreConfig, Participant, PromptMessage, ConversationSearchOptions as SearchOptions, StoredMessage } from 'toolpack-sdk';
7
- export { BaseChannel, DiscordChannel, DiscordChannelConfig, EmailChannel, EmailChannelConfig, SMSChannel, SMSChannelConfig, ScheduledChannel, ScheduledChannelConfig, SlackChannel, SlackChannelConfig, TelegramChannel, TelegramChannelConfig, WebhookChannel, WebhookChannelConfig } from './channels/index.cjs';
8
- export { I as IntentClassification, a as IntentClassifierAgent, b as IntentClassifierInput } from './intent-classifier-agent-BLXXcbNJ.cjs';
7
+ import { S as SchedulerStore } from './index-Du6S0eG7.cjs';
8
+ export { B as BaseChannel, C as CreateJobOptions, a as CreateJobResult, D as DiscordChannel, b as DiscordChannelConfig, E as EmailChannel, c as EmailChannelConfig, J as JobStatus, d as SMSChannel, e as SMSChannelConfig, f as ScheduledChannel, g as ScheduledChannelConfig, h as ScheduledJob, i as SlackChannel, j as SlackChannelConfig, T as TelegramChannel, k as TelegramChannelConfig, W as WebhookChannel, l as WebhookChannelConfig } from './index-Du6S0eG7.cjs';
9
+ export { I as IntentClassification, a as IntentClassifierAgent, b as IntentClassifierInput } from './intent-classifier-agent-DxyfJWcm.cjs';
9
10
  import { SummarizerAgent } from './capabilities/index.cjs';
10
11
  export { HistoryTurn, SummarizerInput, SummarizerOutput } from './capabilities/index.cjs';
11
12
  export { AddressCheckConfig, AddressCheckResult, CaptureHistoryConfig, ComposedChain, DepthExceededError, DepthGuardConfig, EventDedupConfig, IntentClassifierInterceptorConfig, InvocationDepthExceededError, NoiseFilterConfig, ParticipantResolverConfig, RateLimitConfig, SelfFilterConfig, TracerConfig, composeChain, createAddressCheckInterceptor, createCaptureInterceptor, createDepthGuardInterceptor, createEventDedupInterceptor, createIntentClassifierInterceptor, createNoiseFilterInterceptor, createParticipantResolverInterceptor, createRateLimitInterceptor, createSelfFilterInterceptor, createTracerInterceptor, executeChain } from './interceptors/index.cjs';
12
13
  import 'events';
14
+ import '@toolpack-sdk/knowledge';
13
15
 
14
16
  /**
15
17
  * Transport interface for agent-to-agent communication.
@@ -331,4 +333,65 @@ interface ConversationSearchTool {
331
333
  */
332
334
  declare function createConversationSearchTool(store: ConversationStore, conversationId: string, config?: ConversationSearchToolConfig): ConversationSearchTool;
333
335
 
334
- export { AgentError, AgentInput, AgentInstance, AgentJsonRpcServer, AgentOutput, AgentRegistry, type AgentRegistryTransportOptions, AgentResult, type AgentTransport, BaseAgent, BaseAgentOptions, BrowserAgent, ChannelInterface, CodingAgent, type ConversationSearchTool, type ConversationSearchToolConfig, DataAgent, IAgentRegistry, JsonRpcTransport, LocalTransport, PendingAsk, ResearchAgent, SummarizerAgent, assemblePrompt, createConversationSearchTool };
336
+ interface RunContext {
337
+ /** The assembled header string to prepend to the system prompt (empty string if no content). */
338
+ mindHeader: string;
339
+ /** The 7 mind tool definitions to add to requestTools. */
340
+ tools: RequestToolDefinition[];
341
+ /** Call this at run completion. Pass isError=true on crash. */
342
+ flush: (isError: boolean) => Promise<void>;
343
+ }
344
+ /**
345
+ * AgentMind is the cognitive layer coordinator.
346
+ * One instance lives for the lifetime of the agent (lazily created in BaseAgent).
347
+ * A fresh DraftBuffer is created per run() call via createRunContext().
348
+ */
349
+ declare class AgentMind {
350
+ private readonly store;
351
+ private readonly config;
352
+ private constructor();
353
+ /**
354
+ * Create and initialise an AgentMind instance.
355
+ * Lazily creates the PersistentKnowledgeProvider when no custom provider is given.
356
+ */
357
+ static create(agentName: string, options: AgentMindConfig): Promise<AgentMind>;
358
+ /**
359
+ * Called once at the start of each run() to:
360
+ * 1. Assemble the current header from committed store state.
361
+ * 2. Create a fresh per-run DraftBuffer.
362
+ * 3. Build the 7 mind tool definitions bound to that buffer.
363
+ * 4. Return a flush closure for the run's lifecycle hooks.
364
+ *
365
+ * Throws if the store read fails — callers must not proceed with an empty header
366
+ * because pinned safety rules may be missing.
367
+ */
368
+ createRunContext(): Promise<RunContext>;
369
+ close(): Promise<void>;
370
+ }
371
+
372
+ /**
373
+ * Creates a `ToolProject` that exposes four scheduler tools to the LLM.
374
+ *
375
+ * Register the returned project as `customTools` when initialising Toolpack so
376
+ * the agent can manage its own schedule autonomously.
377
+ *
378
+ * @example
379
+ * ```ts
380
+ * const store = new SchedulerStore({ dbPath: './scheduler.db' });
381
+ *
382
+ * const toolpack = await Toolpack.init({
383
+ * provider: 'openai',
384
+ * tools: true,
385
+ * customTools: [createSchedulerTools(store)],
386
+ * });
387
+ * ```
388
+ *
389
+ * Tools exposed:
390
+ * - `scheduler.create` — schedule a new recurring or one-shot invocation
391
+ * - `scheduler.list` — list pending/all jobs
392
+ * - `scheduler.cancel` — cancel a pending job
393
+ * - `scheduler.update` — modify an existing pending job
394
+ */
395
+ declare function createSchedulerTools(store: SchedulerStore): ToolProject;
396
+
397
+ export { AgentError, AgentInput, AgentInstance, AgentJsonRpcServer, AgentMind, AgentMindConfig, AgentOutput, AgentRegistry, type AgentRegistryTransportOptions, AgentResult, type AgentTransport, BaseAgent, BaseAgentOptions, BrowserAgent, ChannelInterface, CodingAgent, type ConversationSearchTool, type ConversationSearchToolConfig, DataAgent, IAgentRegistry, JsonRpcTransport, LocalTransport, type RunContext as MindRunContext, PendingAsk, ResearchAgent, SchedulerStore, SummarizerAgent, assemblePrompt, createConversationSearchTool, createSchedulerTools };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
- import { A as AgentInput, a as AgentResult, b as IAgentRegistry, d as AgentOutput, e as AgentInstance, C as ChannelInterface, P as PendingAsk, B as BaseAgentOptions } from './types-BWoRx1ZE.js';
2
- export { c as AgentRunOptions, I as Interceptor, f as InterceptorChainConfig, g as InterceptorContext, h as InterceptorResult, N as NextFunction, S as SKIP_SENTINEL, W as WorkflowStep, i as isSkipSentinel, s as skip } from './types-BWoRx1ZE.js';
3
- import { B as BaseAgent } from './base-agent-Cx2kWzLF.js';
4
- export { A as AgentEvents } from './base-agent-Cx2kWzLF.js';
5
- import { ModeConfig, ConversationStore, AssemblerOptions, AssembledPrompt } from 'toolpack-sdk';
1
+ import { A as AgentInput, a as AgentResult, c as IAgentRegistry, e as AgentOutput, f as AgentInstance, C as ChannelInterface, P as PendingAsk, B as BaseAgentOptions } from './types-TB6yypig.js';
2
+ export { b as AgentDelegationConfig, d as AgentRunOptions, I as Interceptor, g as InterceptorChainConfig, h as InterceptorContext, i as InterceptorResult, N as NextFunction, S as SKIP_SENTINEL, W as WorkflowStep, j as isSkipSentinel, s as skip } from './types-TB6yypig.js';
3
+ import { B as BaseAgent, A as AgentMindConfig } from './base-agent-nU8pr4nu.js';
4
+ export { a as AgentEvents, C as ConfidenceLevel, G as GoalPriority, b as GoalStatus, M as MindBelief, c as MindEntry, d as MindEntryType, e as MindGoal, f as MindRecallResult, g as MindReflection, h as MindTtlDefaults } from './base-agent-nU8pr4nu.js';
5
+ import { ModeConfig, ConversationStore, AssemblerOptions, AssembledPrompt, RequestToolDefinition, ToolProject } from 'toolpack-sdk';
6
6
  export { AssembledPrompt, AssemblerOptions, ConversationScope, ConversationStore, GetOptions, InMemoryConversationStore, InMemoryConversationStoreConfig, Participant, PromptMessage, ConversationSearchOptions as SearchOptions, StoredMessage } from 'toolpack-sdk';
7
- export { BaseChannel, DiscordChannel, DiscordChannelConfig, EmailChannel, EmailChannelConfig, SMSChannel, SMSChannelConfig, ScheduledChannel, ScheduledChannelConfig, SlackChannel, SlackChannelConfig, TelegramChannel, TelegramChannelConfig, WebhookChannel, WebhookChannelConfig } from './channels/index.js';
8
- export { I as IntentClassification, a as IntentClassifierAgent, b as IntentClassifierInput } from './intent-classifier-agent-BLpDwKVf.js';
7
+ import { S as SchedulerStore } from './index-o8Lbzv5N.js';
8
+ export { B as BaseChannel, C as CreateJobOptions, a as CreateJobResult, D as DiscordChannel, b as DiscordChannelConfig, E as EmailChannel, c as EmailChannelConfig, J as JobStatus, d as SMSChannel, e as SMSChannelConfig, f as ScheduledChannel, g as ScheduledChannelConfig, h as ScheduledJob, i as SlackChannel, j as SlackChannelConfig, T as TelegramChannel, k as TelegramChannelConfig, W as WebhookChannel, l as WebhookChannelConfig } from './index-o8Lbzv5N.js';
9
+ export { I as IntentClassification, a as IntentClassifierAgent, b as IntentClassifierInput } from './intent-classifier-agent-0JZDlhpk.js';
9
10
  import { SummarizerAgent } from './capabilities/index.js';
10
11
  export { HistoryTurn, SummarizerInput, SummarizerOutput } from './capabilities/index.js';
11
12
  export { AddressCheckConfig, AddressCheckResult, CaptureHistoryConfig, ComposedChain, DepthExceededError, DepthGuardConfig, EventDedupConfig, IntentClassifierInterceptorConfig, InvocationDepthExceededError, NoiseFilterConfig, ParticipantResolverConfig, RateLimitConfig, SelfFilterConfig, TracerConfig, composeChain, createAddressCheckInterceptor, createCaptureInterceptor, createDepthGuardInterceptor, createEventDedupInterceptor, createIntentClassifierInterceptor, createNoiseFilterInterceptor, createParticipantResolverInterceptor, createRateLimitInterceptor, createSelfFilterInterceptor, createTracerInterceptor, executeChain } from './interceptors/index.js';
12
13
  import 'events';
14
+ import '@toolpack-sdk/knowledge';
13
15
 
14
16
  /**
15
17
  * Transport interface for agent-to-agent communication.
@@ -331,4 +333,65 @@ interface ConversationSearchTool {
331
333
  */
332
334
  declare function createConversationSearchTool(store: ConversationStore, conversationId: string, config?: ConversationSearchToolConfig): ConversationSearchTool;
333
335
 
334
- export { AgentError, AgentInput, AgentInstance, AgentJsonRpcServer, AgentOutput, AgentRegistry, type AgentRegistryTransportOptions, AgentResult, type AgentTransport, BaseAgent, BaseAgentOptions, BrowserAgent, ChannelInterface, CodingAgent, type ConversationSearchTool, type ConversationSearchToolConfig, DataAgent, IAgentRegistry, JsonRpcTransport, LocalTransport, PendingAsk, ResearchAgent, SummarizerAgent, assemblePrompt, createConversationSearchTool };
336
+ interface RunContext {
337
+ /** The assembled header string to prepend to the system prompt (empty string if no content). */
338
+ mindHeader: string;
339
+ /** The 7 mind tool definitions to add to requestTools. */
340
+ tools: RequestToolDefinition[];
341
+ /** Call this at run completion. Pass isError=true on crash. */
342
+ flush: (isError: boolean) => Promise<void>;
343
+ }
344
+ /**
345
+ * AgentMind is the cognitive layer coordinator.
346
+ * One instance lives for the lifetime of the agent (lazily created in BaseAgent).
347
+ * A fresh DraftBuffer is created per run() call via createRunContext().
348
+ */
349
+ declare class AgentMind {
350
+ private readonly store;
351
+ private readonly config;
352
+ private constructor();
353
+ /**
354
+ * Create and initialise an AgentMind instance.
355
+ * Lazily creates the PersistentKnowledgeProvider when no custom provider is given.
356
+ */
357
+ static create(agentName: string, options: AgentMindConfig): Promise<AgentMind>;
358
+ /**
359
+ * Called once at the start of each run() to:
360
+ * 1. Assemble the current header from committed store state.
361
+ * 2. Create a fresh per-run DraftBuffer.
362
+ * 3. Build the 7 mind tool definitions bound to that buffer.
363
+ * 4. Return a flush closure for the run's lifecycle hooks.
364
+ *
365
+ * Throws if the store read fails — callers must not proceed with an empty header
366
+ * because pinned safety rules may be missing.
367
+ */
368
+ createRunContext(): Promise<RunContext>;
369
+ close(): Promise<void>;
370
+ }
371
+
372
+ /**
373
+ * Creates a `ToolProject` that exposes four scheduler tools to the LLM.
374
+ *
375
+ * Register the returned project as `customTools` when initialising Toolpack so
376
+ * the agent can manage its own schedule autonomously.
377
+ *
378
+ * @example
379
+ * ```ts
380
+ * const store = new SchedulerStore({ dbPath: './scheduler.db' });
381
+ *
382
+ * const toolpack = await Toolpack.init({
383
+ * provider: 'openai',
384
+ * tools: true,
385
+ * customTools: [createSchedulerTools(store)],
386
+ * });
387
+ * ```
388
+ *
389
+ * Tools exposed:
390
+ * - `scheduler.create` — schedule a new recurring or one-shot invocation
391
+ * - `scheduler.list` — list pending/all jobs
392
+ * - `scheduler.cancel` — cancel a pending job
393
+ * - `scheduler.update` — modify an existing pending job
394
+ */
395
+ declare function createSchedulerTools(store: SchedulerStore): ToolProject;
396
+
397
+ export { AgentError, AgentInput, AgentInstance, AgentJsonRpcServer, AgentMind, AgentMindConfig, AgentOutput, AgentRegistry, type AgentRegistryTransportOptions, AgentResult, type AgentTransport, BaseAgent, BaseAgentOptions, BrowserAgent, ChannelInterface, CodingAgent, type ConversationSearchTool, type ConversationSearchToolConfig, DataAgent, IAgentRegistry, JsonRpcTransport, LocalTransport, type RunContext as MindRunContext, PendingAsk, ResearchAgent, SchedulerStore, SummarizerAgent, assemblePrompt, createConversationSearchTool, createSchedulerTools };