@robota-sdk/agent-sdk 3.0.0-beta.46 → 3.0.0-beta.48

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.
@@ -2409,6 +2409,10 @@ var InteractiveSession = class {
2409
2409
  }
2410
2410
  }
2411
2411
  }
2412
+ /** Attach a transport adapter to this session. Calls transport.attach(this). */
2413
+ attachTransport(transport) {
2414
+ transport.attach(this);
2415
+ }
2412
2416
  /** Access underlying Session. For advanced use / testing only. */
2413
2417
  getSession() {
2414
2418
  return this.getSessionOrThrow();
@@ -2493,6 +2497,13 @@ var InteractiveSession = class {
2493
2497
  const state = { toolName: event.toolName, firstArg, isRunning: true };
2494
2498
  this.activeTools.push(state);
2495
2499
  this.emit("tool_start", state);
2500
+ this.history.push({
2501
+ id: (0, import_node_crypto.randomUUID)(),
2502
+ timestamp: /* @__PURE__ */ new Date(),
2503
+ category: "event",
2504
+ type: "tool-start",
2505
+ data: { toolName: event.toolName, firstArg, isRunning: true }
2506
+ });
2496
2507
  } else {
2497
2508
  const result = event.denied ? "denied" : event.success === false ? "error" : "success";
2498
2509
  const idx = this.activeTools.findIndex((t) => t.toolName === event.toolName && t.isRunning);
@@ -2501,6 +2512,18 @@ var InteractiveSession = class {
2501
2512
  this.activeTools[idx] = finished;
2502
2513
  this.trimCompletedTools();
2503
2514
  this.emit("tool_end", finished);
2515
+ this.history.push({
2516
+ id: (0, import_node_crypto.randomUUID)(),
2517
+ timestamp: /* @__PURE__ */ new Date(),
2518
+ category: "event",
2519
+ type: "tool-end",
2520
+ data: {
2521
+ toolName: finished.toolName,
2522
+ firstArg: finished.firstArg,
2523
+ isRunning: false,
2524
+ result
2525
+ }
2526
+ });
2504
2527
  }
2505
2528
  }
2506
2529
  }
@@ -404,6 +404,20 @@ interface IInteractiveSessionEvents {
404
404
  interrupted: (result: IExecutionResult) => void;
405
405
  }
406
406
  type TInteractiveEventName = keyof IInteractiveSessionEvents;
407
+ /**
408
+ * Common interface for all transport adapters.
409
+ * Each transport exposes InteractiveSession over a specific protocol.
410
+ */
411
+ interface ITransportAdapter {
412
+ /** Human-readable transport name (e.g., 'http', 'ws', 'mcp', 'headless') */
413
+ readonly name: string;
414
+ /** Attach an InteractiveSession to this transport. */
415
+ attach(session: InteractiveSession): void;
416
+ /** Start serving. What this means depends on the transport. */
417
+ start(): Promise<void>;
418
+ /** Stop serving and clean up resources. */
419
+ stop(): Promise<void>;
420
+ }
407
421
 
408
422
  /**
409
423
  * InteractiveSession — the single entry point for all SDK consumers.
@@ -498,6 +512,8 @@ declare class InteractiveSession {
498
512
  getName(): string | undefined;
499
513
  /** Set session name and persist if store is available. */
500
514
  setName(name: string): void;
515
+ /** Attach a transport adapter to this session. Calls transport.attach(this). */
516
+ attachTransport(transport: ITransportAdapter): void;
501
517
  /** Access underlying Session. For advanced use / testing only. */
502
518
  getSession(): Session;
503
519
  private executePrompt;
@@ -1155,4 +1171,4 @@ declare function userPaths(): {
1155
1171
  */
1156
1172
  declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
1157
1173
 
1158
- export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommand, type ICommandResult, type ICommandSource, type ICreateQueryOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IPromptExecutorOptions, type IPromptProvider, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type IToolState, type IToolSummary, InteractiveSession, MarketplaceClient, PluginCommandSource, PluginSettingsStore, PromptExecutor, SkillCommandSource, type SkillPromptContext, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TPermissionResultValue, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSkillPrompt, createAgentTool, createQuery, createSubagentLogger, createSubagentSession, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, parseFrontmatter, preprocessShellCommands, projectPaths, promptForApproval, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, substituteVariables, userPaths };
1174
+ export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommand, type ICommandResult, type ICommandSource, type ICreateQueryOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IPromptExecutorOptions, type IPromptProvider, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type IToolState, type IToolSummary, type ITransportAdapter, InteractiveSession, MarketplaceClient, PluginCommandSource, PluginSettingsStore, PromptExecutor, SkillCommandSource, type SkillPromptContext, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TPermissionResultValue, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSkillPrompt, createAgentTool, createQuery, createSubagentLogger, createSubagentSession, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, parseFrontmatter, preprocessShellCommands, projectPaths, promptForApproval, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, substituteVariables, userPaths };
@@ -404,6 +404,20 @@ interface IInteractiveSessionEvents {
404
404
  interrupted: (result: IExecutionResult) => void;
405
405
  }
406
406
  type TInteractiveEventName = keyof IInteractiveSessionEvents;
407
+ /**
408
+ * Common interface for all transport adapters.
409
+ * Each transport exposes InteractiveSession over a specific protocol.
410
+ */
411
+ interface ITransportAdapter {
412
+ /** Human-readable transport name (e.g., 'http', 'ws', 'mcp', 'headless') */
413
+ readonly name: string;
414
+ /** Attach an InteractiveSession to this transport. */
415
+ attach(session: InteractiveSession): void;
416
+ /** Start serving. What this means depends on the transport. */
417
+ start(): Promise<void>;
418
+ /** Stop serving and clean up resources. */
419
+ stop(): Promise<void>;
420
+ }
407
421
 
408
422
  /**
409
423
  * InteractiveSession — the single entry point for all SDK consumers.
@@ -498,6 +512,8 @@ declare class InteractiveSession {
498
512
  getName(): string | undefined;
499
513
  /** Set session name and persist if store is available. */
500
514
  setName(name: string): void;
515
+ /** Attach a transport adapter to this session. Calls transport.attach(this). */
516
+ attachTransport(transport: ITransportAdapter): void;
501
517
  /** Access underlying Session. For advanced use / testing only. */
502
518
  getSession(): Session;
503
519
  private executePrompt;
@@ -1155,4 +1171,4 @@ declare function userPaths(): {
1155
1171
  */
1156
1172
  declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
1157
1173
 
1158
- export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommand, type ICommandResult, type ICommandSource, type ICreateQueryOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IPromptExecutorOptions, type IPromptProvider, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type IToolState, type IToolSummary, InteractiveSession, MarketplaceClient, PluginCommandSource, PluginSettingsStore, PromptExecutor, SkillCommandSource, type SkillPromptContext, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TPermissionResultValue, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSkillPrompt, createAgentTool, createQuery, createSubagentLogger, createSubagentSession, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, parseFrontmatter, preprocessShellCommands, projectPaths, promptForApproval, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, substituteVariables, userPaths };
1174
+ export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommand, type ICommandResult, type ICommandSource, type ICreateQueryOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IPromptExecutorOptions, type IPromptProvider, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type IToolState, type IToolSummary, type ITransportAdapter, InteractiveSession, MarketplaceClient, PluginCommandSource, PluginSettingsStore, PromptExecutor, SkillCommandSource, type SkillPromptContext, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TPermissionResultValue, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSkillPrompt, createAgentTool, createQuery, createSubagentLogger, createSubagentSession, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, parseFrontmatter, preprocessShellCommands, projectPaths, promptForApproval, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, substituteVariables, userPaths };
@@ -2359,6 +2359,10 @@ var InteractiveSession = class {
2359
2359
  }
2360
2360
  }
2361
2361
  }
2362
+ /** Attach a transport adapter to this session. Calls transport.attach(this). */
2363
+ attachTransport(transport) {
2364
+ transport.attach(this);
2365
+ }
2362
2366
  /** Access underlying Session. For advanced use / testing only. */
2363
2367
  getSession() {
2364
2368
  return this.getSessionOrThrow();
@@ -2443,6 +2447,13 @@ var InteractiveSession = class {
2443
2447
  const state = { toolName: event.toolName, firstArg, isRunning: true };
2444
2448
  this.activeTools.push(state);
2445
2449
  this.emit("tool_start", state);
2450
+ this.history.push({
2451
+ id: randomUUID(),
2452
+ timestamp: /* @__PURE__ */ new Date(),
2453
+ category: "event",
2454
+ type: "tool-start",
2455
+ data: { toolName: event.toolName, firstArg, isRunning: true }
2456
+ });
2446
2457
  } else {
2447
2458
  const result = event.denied ? "denied" : event.success === false ? "error" : "success";
2448
2459
  const idx = this.activeTools.findIndex((t) => t.toolName === event.toolName && t.isRunning);
@@ -2451,6 +2462,18 @@ var InteractiveSession = class {
2451
2462
  this.activeTools[idx] = finished;
2452
2463
  this.trimCompletedTools();
2453
2464
  this.emit("tool_end", finished);
2465
+ this.history.push({
2466
+ id: randomUUID(),
2467
+ timestamp: /* @__PURE__ */ new Date(),
2468
+ category: "event",
2469
+ type: "tool-end",
2470
+ data: {
2471
+ toolName: finished.toolName,
2472
+ firstArg: finished.firstArg,
2473
+ isRunning: false,
2474
+ result
2475
+ }
2476
+ });
2454
2477
  }
2455
2478
  }
2456
2479
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robota-sdk/agent-sdk",
3
- "version": "3.0.0-beta.46",
3
+ "version": "3.0.0-beta.48",
4
4
  "description": "Programmatic SDK for building AI agents with Robota — provides Session, query(), built-in tools, permissions, hooks, and context loading",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.js",
@@ -24,9 +24,9 @@
24
24
  "dependencies": {
25
25
  "chalk": "^5.3.0",
26
26
  "zod": "^3.24.0",
27
- "@robota-sdk/agent-core": "3.0.0-beta.46",
28
- "@robota-sdk/agent-sessions": "3.0.0-beta.46",
29
- "@robota-sdk/agent-tools": "3.0.0-beta.46"
27
+ "@robota-sdk/agent-core": "3.0.0-beta.48",
28
+ "@robota-sdk/agent-sessions": "3.0.0-beta.48",
29
+ "@robota-sdk/agent-tools": "3.0.0-beta.48"
30
30
  },
31
31
  "devDependencies": {
32
32
  "rimraf": "^5.0.5",