@easbot/agent 0.2.13 → 0.2.14

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,6 +1,6 @@
1
1
  import z$1, { z, ZodType } from 'zod';
2
- import { AgentSideConnection, McpServer, Agent as Agent$3, InitializeRequest, InitializeResponse, AuthenticateRequest, AuthenticateResponse, NewSessionRequest, NewSessionResponse, LoadSessionRequest, LoadSessionResponse, PromptRequest, PromptResponse, CancelNotification, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, ListSessionsRequest, ListSessionsResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModelRequest, SetSessionModelResponse, CloseSessionRequest, CloseSessionResponse } from '@agentclientprotocol/sdk';
3
- import { EasbotClient, AgentConfig, Command as Command$2, McpRemoteConfig, Message as Message$1, Part, Provider as Provider$2, PermissionRequest as PermissionRequest$1, QuestionRequest as QuestionRequest$1, Session as Session$1, ToolListItem, ContextMode as ContextMode$1, Event as Event$1, GlobalEvent, QuestionAnswer } from '@easbot/sdk';
2
+ import { AgentSideConnection, McpServer, Agent as Agent$3, InitializeRequest, InitializeResponse, AuthenticateRequest, AuthenticateResponse, NewSessionRequest, NewSessionResponse, LoadSessionRequest, LoadSessionResponse, PromptRequest, PromptResponse, CancelNotification, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, ListSessionsRequest, ListSessionsResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModelRequest, SetSessionModelResponse, CloseSessionRequest, CloseSessionResponse, ContentBlock } from '@agentclientprotocol/sdk';
3
+ import { EasbotClient, AgentConfig, Command as Command$2, McpRemoteConfig, Message as Message$1, Part, Provider as Provider$2, PermissionRequest as PermissionRequest$1, QuestionRequest as QuestionRequest$2, Session as Session$1, ToolListItem, ContextMode as ContextMode$1, Event as Event$1, GlobalEvent, QuestionAnswer } from '@easbot/sdk';
4
4
  export { QuestionAnswer, ToolListItem } from '@easbot/sdk';
5
5
  import * as ai from 'ai';
6
6
  import { LanguageModel, EmbeddingModel, RerankingModel, LanguageModelUsage, ModelMessage, Tool as Tool$1 } from 'ai';
@@ -479,6 +479,22 @@ declare class SdkEventBridge {
479
479
  private handleSessionStatus;
480
480
  }
481
481
 
482
+ interface QuestionOption {
483
+ label: string;
484
+ description: string;
485
+ }
486
+ interface QuestionItem {
487
+ header: string;
488
+ question: string;
489
+ options?: QuestionOption[];
490
+ multiple?: boolean;
491
+ custom?: boolean;
492
+ }
493
+ interface QuestionAskedProps {
494
+ id: string;
495
+ sessionID: string;
496
+ questions: QuestionItem[];
497
+ }
482
498
  declare class AcpEventBridge {
483
499
  private sdk;
484
500
  private connection;
@@ -487,7 +503,15 @@ declare class AcpEventBridge {
487
503
  private started;
488
504
  private permissionQueues;
489
505
  private permissionOptions;
506
+ private questionQueues;
507
+ private questionOptions;
508
+ private acpService?;
490
509
  constructor(sdk: EasbotClient, connection: AgentSideConnection, localEventBus?: LocalEventBus);
510
+ setService(service: {
511
+ registerPendingQuestion: (question: QuestionAskedProps & {
512
+ id: string;
513
+ }) => void;
514
+ }): void;
491
515
  start(): Promise<void>;
492
516
  private subscribeLocalEvents;
493
517
  private handleAgentStatus;
@@ -497,6 +521,8 @@ declare class AcpEventBridge {
497
521
  private handleSessionStatus;
498
522
  private handleSessionDeleted;
499
523
  private handlePermissionAsked;
524
+ private handleQuestionAsked;
525
+ private sendQuestionUpdate;
500
526
  private handleMessagePartUpdated;
501
527
  private handleToolPart;
502
528
  private handleTextPart;
@@ -25905,6 +25931,23 @@ interface AdapterSessionState {
25905
25931
  modeId?: string;
25906
25932
  contextMode?: ContextMode;
25907
25933
  agent?: string;
25934
+ pendingQuestions: Map<string, QuestionRequest$1>;
25935
+ }
25936
+ interface QuestionRequest$1 {
25937
+ id: string;
25938
+ sessionID: string;
25939
+ questions: Array<{
25940
+ header: string;
25941
+ question: string;
25942
+ options?: Array<{
25943
+ label: string;
25944
+ description: string;
25945
+ }>;
25946
+ multiple?: boolean;
25947
+ custom?: boolean;
25948
+ }>;
25949
+ currentQuestionIndex: number;
25950
+ collectedAnswers: string[][];
25908
25951
  }
25909
25952
  declare class AdapterSessionManager {
25910
25953
  private sessions;
@@ -25918,6 +25961,11 @@ declare class AdapterSessionManager {
25918
25961
  providerID: string;
25919
25962
  modelID: string;
25920
25963
  } | undefined;
25964
+ registerPendingQuestion(sessionId: string, question: QuestionRequest$1): void;
25965
+ getPendingQuestion(sessionId: string, requestID: string): QuestionRequest$1 | undefined;
25966
+ getPendingQuestionsForSession(sessionId: string): QuestionRequest$1[];
25967
+ removePendingQuestion(sessionId: string, requestID: string): void;
25968
+ clearPendingQuestions(sessionId: string): void;
25921
25969
  setModel(sessionId: string, model: AdapterSessionState['model']): AdapterSessionState;
25922
25970
  getVariant(sessionId: string): string | undefined;
25923
25971
  setVariant(sessionId: string, variant?: string): AdapterSessionState;
@@ -25929,6 +25977,12 @@ declare class AdapterSessionManager {
25929
25977
  resolveConnectionState(sessionId: string): ConnectionState | undefined;
25930
25978
  }
25931
25979
 
25980
+ type QuestionAnswerResult = {
25981
+ handled: boolean;
25982
+ continueFlow: boolean;
25983
+ requestID?: string;
25984
+ answers?: string[][];
25985
+ };
25932
25986
  interface ACPServiceConfig {
25933
25987
  acp: ACPConfig;
25934
25988
  serviceMode: ServiceMode$1;
@@ -25988,6 +26042,8 @@ declare abstract class ACPService implements Agent$3 {
25988
26042
  subscribeEvents(callback: (event: AgentEvent) => void): () => void;
25989
26043
  setConnection(connection: AgentSideConnection): void;
25990
26044
  getConnection(): AgentSideConnection | undefined;
26045
+ abortConnection(): void;
26046
+ closeConnection(): void;
25991
26047
  getConnectionRegistry(): ConnectionRegistry | null;
25992
26048
  getSessionRouter(): SessionRouter | null;
25993
26049
  getDuplexExecutor(): DuplexExecutor | null;
@@ -26066,6 +26122,26 @@ declare abstract class ACPService implements Agent$3 {
26066
26122
  baseUrl?: string;
26067
26123
  error?: string;
26068
26124
  }>;
26125
+ registerPendingQuestion(question: {
26126
+ id: string;
26127
+ sessionID: string;
26128
+ questions: Array<{
26129
+ header: string;
26130
+ question: string;
26131
+ options?: Array<{
26132
+ label: string;
26133
+ description: string;
26134
+ }>;
26135
+ multiple?: boolean;
26136
+ custom?: boolean;
26137
+ }>;
26138
+ }): void;
26139
+ protected parseQuestionAnswer(text: string): {
26140
+ requestID: string;
26141
+ answer: string;
26142
+ } | null;
26143
+ protected handleQuestionAnswers(sessionID: string, prompt: Array<ContentBlock>): Promise<QuestionAnswerResult>;
26144
+ private sendNextQuestion;
26069
26145
  dispose(): Promise<void>;
26070
26146
  }
26071
26147
 
@@ -28790,6 +28866,12 @@ declare namespace SessionPrompt {
28790
28866
  resume_existing: z$1.ZodOptional<z$1.ZodBoolean>;
28791
28867
  }, z$1.core.$strip>;
28792
28868
  };
28869
+ export function lastModel(sessionID: string): Promise<{
28870
+ providerID: string;
28871
+ modelID: string;
28872
+ }>;
28873
+ export function lastAgent(sessionID: string): Promise<string>;
28874
+ export function lastUserMessage(sessionID: string): Promise<Message.User | undefined>;
28793
28875
  export const ShellInput: z$1.ZodObject<{
28794
28876
  sessionID: z$1.ZodString;
28795
28877
  agent: z$1.ZodString;
@@ -29106,7 +29188,7 @@ type PermissionRequest = PermissionRequest$1;
29106
29188
  type PermissionListResponse = PermissionRequest[];
29107
29189
  type PermissionReplyResponse = boolean;
29108
29190
  type PermissionRespondResponse = boolean;
29109
- type QuestionRequest = QuestionRequest$1;
29191
+ type QuestionRequest = QuestionRequest$2;
29110
29192
  type QuestionListResponse = QuestionRequest[];
29111
29193
  type QuestionReplyResponse = boolean;
29112
29194
  type QuestionRejectResponse = boolean;
@@ -29382,8 +29464,9 @@ declare function deleteSession(sessionId: string): Promise<SessionDeleteResponse
29382
29464
  declare function abortSession(sessionId: string): Promise<SessionAbortResponse>;
29383
29465
  declare function summarizeSession(options: {
29384
29466
  sessionId: string;
29385
- providerID: string;
29386
- modelID: string;
29467
+ agent?: string;
29468
+ providerID?: string;
29469
+ modelID?: string;
29387
29470
  auto?: boolean;
29388
29471
  }): Promise<SessionSummarizeResponse>;
29389
29472
  declare function updateSession(sessionId: string, input: {
@@ -31156,29 +31239,29 @@ declare namespace Compaction {
31156
31239
  const create: {
31157
31240
  (input: {
31158
31241
  sessionID: string;
31159
- agent: string;
31160
- model: {
31242
+ auto: boolean;
31243
+ agent?: string | undefined;
31244
+ model?: {
31161
31245
  providerID: string;
31162
31246
  modelID: string;
31163
- };
31164
- auto: boolean;
31247
+ } | undefined;
31165
31248
  }): Promise<void>;
31166
31249
  force(input: {
31167
31250
  sessionID: string;
31168
- agent: string;
31169
- model: {
31251
+ auto: boolean;
31252
+ agent?: string | undefined;
31253
+ model?: {
31170
31254
  providerID: string;
31171
31255
  modelID: string;
31172
- };
31173
- auto: boolean;
31256
+ } | undefined;
31174
31257
  }): Promise<void>;
31175
31258
  schema: z$1.ZodObject<{
31176
31259
  sessionID: z$1.ZodString;
31177
- agent: z$1.ZodString;
31178
- model: z$1.ZodObject<{
31260
+ agent: z$1.ZodOptional<z$1.ZodString>;
31261
+ model: z$1.ZodOptional<z$1.ZodObject<{
31179
31262
  providerID: z$1.ZodString;
31180
31263
  modelID: z$1.ZodString;
31181
- }, z$1.core.$strip>;
31264
+ }, z$1.core.$strip>>;
31182
31265
  auto: z$1.ZodBoolean;
31183
31266
  }, z$1.core.$strip>;
31184
31267
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import z$1, { z, ZodType } from 'zod';
2
- import { AgentSideConnection, McpServer, Agent as Agent$3, InitializeRequest, InitializeResponse, AuthenticateRequest, AuthenticateResponse, NewSessionRequest, NewSessionResponse, LoadSessionRequest, LoadSessionResponse, PromptRequest, PromptResponse, CancelNotification, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, ListSessionsRequest, ListSessionsResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModelRequest, SetSessionModelResponse, CloseSessionRequest, CloseSessionResponse } from '@agentclientprotocol/sdk';
3
- import { EasbotClient, AgentConfig, Command as Command$2, McpRemoteConfig, Message as Message$1, Part, Provider as Provider$2, PermissionRequest as PermissionRequest$1, QuestionRequest as QuestionRequest$1, Session as Session$1, ToolListItem, ContextMode as ContextMode$1, Event as Event$1, GlobalEvent, QuestionAnswer } from '@easbot/sdk';
2
+ import { AgentSideConnection, McpServer, Agent as Agent$3, InitializeRequest, InitializeResponse, AuthenticateRequest, AuthenticateResponse, NewSessionRequest, NewSessionResponse, LoadSessionRequest, LoadSessionResponse, PromptRequest, PromptResponse, CancelNotification, ForkSessionRequest, ForkSessionResponse, ResumeSessionRequest, ResumeSessionResponse, ListSessionsRequest, ListSessionsResponse, SetSessionModeRequest, SetSessionModeResponse, SetSessionConfigOptionRequest, SetSessionConfigOptionResponse, SetSessionModelRequest, SetSessionModelResponse, CloseSessionRequest, CloseSessionResponse, ContentBlock } from '@agentclientprotocol/sdk';
3
+ import { EasbotClient, AgentConfig, Command as Command$2, McpRemoteConfig, Message as Message$1, Part, Provider as Provider$2, PermissionRequest as PermissionRequest$1, QuestionRequest as QuestionRequest$2, Session as Session$1, ToolListItem, ContextMode as ContextMode$1, Event as Event$1, GlobalEvent, QuestionAnswer } from '@easbot/sdk';
4
4
  export { QuestionAnswer, ToolListItem } from '@easbot/sdk';
5
5
  import * as ai from 'ai';
6
6
  import { LanguageModel, EmbeddingModel, RerankingModel, LanguageModelUsage, ModelMessage, Tool as Tool$1 } from 'ai';
@@ -479,6 +479,22 @@ declare class SdkEventBridge {
479
479
  private handleSessionStatus;
480
480
  }
481
481
 
482
+ interface QuestionOption {
483
+ label: string;
484
+ description: string;
485
+ }
486
+ interface QuestionItem {
487
+ header: string;
488
+ question: string;
489
+ options?: QuestionOption[];
490
+ multiple?: boolean;
491
+ custom?: boolean;
492
+ }
493
+ interface QuestionAskedProps {
494
+ id: string;
495
+ sessionID: string;
496
+ questions: QuestionItem[];
497
+ }
482
498
  declare class AcpEventBridge {
483
499
  private sdk;
484
500
  private connection;
@@ -487,7 +503,15 @@ declare class AcpEventBridge {
487
503
  private started;
488
504
  private permissionQueues;
489
505
  private permissionOptions;
506
+ private questionQueues;
507
+ private questionOptions;
508
+ private acpService?;
490
509
  constructor(sdk: EasbotClient, connection: AgentSideConnection, localEventBus?: LocalEventBus);
510
+ setService(service: {
511
+ registerPendingQuestion: (question: QuestionAskedProps & {
512
+ id: string;
513
+ }) => void;
514
+ }): void;
491
515
  start(): Promise<void>;
492
516
  private subscribeLocalEvents;
493
517
  private handleAgentStatus;
@@ -497,6 +521,8 @@ declare class AcpEventBridge {
497
521
  private handleSessionStatus;
498
522
  private handleSessionDeleted;
499
523
  private handlePermissionAsked;
524
+ private handleQuestionAsked;
525
+ private sendQuestionUpdate;
500
526
  private handleMessagePartUpdated;
501
527
  private handleToolPart;
502
528
  private handleTextPart;
@@ -25905,6 +25931,23 @@ interface AdapterSessionState {
25905
25931
  modeId?: string;
25906
25932
  contextMode?: ContextMode;
25907
25933
  agent?: string;
25934
+ pendingQuestions: Map<string, QuestionRequest$1>;
25935
+ }
25936
+ interface QuestionRequest$1 {
25937
+ id: string;
25938
+ sessionID: string;
25939
+ questions: Array<{
25940
+ header: string;
25941
+ question: string;
25942
+ options?: Array<{
25943
+ label: string;
25944
+ description: string;
25945
+ }>;
25946
+ multiple?: boolean;
25947
+ custom?: boolean;
25948
+ }>;
25949
+ currentQuestionIndex: number;
25950
+ collectedAnswers: string[][];
25908
25951
  }
25909
25952
  declare class AdapterSessionManager {
25910
25953
  private sessions;
@@ -25918,6 +25961,11 @@ declare class AdapterSessionManager {
25918
25961
  providerID: string;
25919
25962
  modelID: string;
25920
25963
  } | undefined;
25964
+ registerPendingQuestion(sessionId: string, question: QuestionRequest$1): void;
25965
+ getPendingQuestion(sessionId: string, requestID: string): QuestionRequest$1 | undefined;
25966
+ getPendingQuestionsForSession(sessionId: string): QuestionRequest$1[];
25967
+ removePendingQuestion(sessionId: string, requestID: string): void;
25968
+ clearPendingQuestions(sessionId: string): void;
25921
25969
  setModel(sessionId: string, model: AdapterSessionState['model']): AdapterSessionState;
25922
25970
  getVariant(sessionId: string): string | undefined;
25923
25971
  setVariant(sessionId: string, variant?: string): AdapterSessionState;
@@ -25929,6 +25977,12 @@ declare class AdapterSessionManager {
25929
25977
  resolveConnectionState(sessionId: string): ConnectionState | undefined;
25930
25978
  }
25931
25979
 
25980
+ type QuestionAnswerResult = {
25981
+ handled: boolean;
25982
+ continueFlow: boolean;
25983
+ requestID?: string;
25984
+ answers?: string[][];
25985
+ };
25932
25986
  interface ACPServiceConfig {
25933
25987
  acp: ACPConfig;
25934
25988
  serviceMode: ServiceMode$1;
@@ -25988,6 +26042,8 @@ declare abstract class ACPService implements Agent$3 {
25988
26042
  subscribeEvents(callback: (event: AgentEvent) => void): () => void;
25989
26043
  setConnection(connection: AgentSideConnection): void;
25990
26044
  getConnection(): AgentSideConnection | undefined;
26045
+ abortConnection(): void;
26046
+ closeConnection(): void;
25991
26047
  getConnectionRegistry(): ConnectionRegistry | null;
25992
26048
  getSessionRouter(): SessionRouter | null;
25993
26049
  getDuplexExecutor(): DuplexExecutor | null;
@@ -26066,6 +26122,26 @@ declare abstract class ACPService implements Agent$3 {
26066
26122
  baseUrl?: string;
26067
26123
  error?: string;
26068
26124
  }>;
26125
+ registerPendingQuestion(question: {
26126
+ id: string;
26127
+ sessionID: string;
26128
+ questions: Array<{
26129
+ header: string;
26130
+ question: string;
26131
+ options?: Array<{
26132
+ label: string;
26133
+ description: string;
26134
+ }>;
26135
+ multiple?: boolean;
26136
+ custom?: boolean;
26137
+ }>;
26138
+ }): void;
26139
+ protected parseQuestionAnswer(text: string): {
26140
+ requestID: string;
26141
+ answer: string;
26142
+ } | null;
26143
+ protected handleQuestionAnswers(sessionID: string, prompt: Array<ContentBlock>): Promise<QuestionAnswerResult>;
26144
+ private sendNextQuestion;
26069
26145
  dispose(): Promise<void>;
26070
26146
  }
26071
26147
 
@@ -28790,6 +28866,12 @@ declare namespace SessionPrompt {
28790
28866
  resume_existing: z$1.ZodOptional<z$1.ZodBoolean>;
28791
28867
  }, z$1.core.$strip>;
28792
28868
  };
28869
+ export function lastModel(sessionID: string): Promise<{
28870
+ providerID: string;
28871
+ modelID: string;
28872
+ }>;
28873
+ export function lastAgent(sessionID: string): Promise<string>;
28874
+ export function lastUserMessage(sessionID: string): Promise<Message.User | undefined>;
28793
28875
  export const ShellInput: z$1.ZodObject<{
28794
28876
  sessionID: z$1.ZodString;
28795
28877
  agent: z$1.ZodString;
@@ -29106,7 +29188,7 @@ type PermissionRequest = PermissionRequest$1;
29106
29188
  type PermissionListResponse = PermissionRequest[];
29107
29189
  type PermissionReplyResponse = boolean;
29108
29190
  type PermissionRespondResponse = boolean;
29109
- type QuestionRequest = QuestionRequest$1;
29191
+ type QuestionRequest = QuestionRequest$2;
29110
29192
  type QuestionListResponse = QuestionRequest[];
29111
29193
  type QuestionReplyResponse = boolean;
29112
29194
  type QuestionRejectResponse = boolean;
@@ -29382,8 +29464,9 @@ declare function deleteSession(sessionId: string): Promise<SessionDeleteResponse
29382
29464
  declare function abortSession(sessionId: string): Promise<SessionAbortResponse>;
29383
29465
  declare function summarizeSession(options: {
29384
29466
  sessionId: string;
29385
- providerID: string;
29386
- modelID: string;
29467
+ agent?: string;
29468
+ providerID?: string;
29469
+ modelID?: string;
29387
29470
  auto?: boolean;
29388
29471
  }): Promise<SessionSummarizeResponse>;
29389
29472
  declare function updateSession(sessionId: string, input: {
@@ -31156,29 +31239,29 @@ declare namespace Compaction {
31156
31239
  const create: {
31157
31240
  (input: {
31158
31241
  sessionID: string;
31159
- agent: string;
31160
- model: {
31242
+ auto: boolean;
31243
+ agent?: string | undefined;
31244
+ model?: {
31161
31245
  providerID: string;
31162
31246
  modelID: string;
31163
- };
31164
- auto: boolean;
31247
+ } | undefined;
31165
31248
  }): Promise<void>;
31166
31249
  force(input: {
31167
31250
  sessionID: string;
31168
- agent: string;
31169
- model: {
31251
+ auto: boolean;
31252
+ agent?: string | undefined;
31253
+ model?: {
31170
31254
  providerID: string;
31171
31255
  modelID: string;
31172
- };
31173
- auto: boolean;
31256
+ } | undefined;
31174
31257
  }): Promise<void>;
31175
31258
  schema: z$1.ZodObject<{
31176
31259
  sessionID: z$1.ZodString;
31177
- agent: z$1.ZodString;
31178
- model: z$1.ZodObject<{
31260
+ agent: z$1.ZodOptional<z$1.ZodString>;
31261
+ model: z$1.ZodOptional<z$1.ZodObject<{
31179
31262
  providerID: z$1.ZodString;
31180
31263
  modelID: z$1.ZodString;
31181
- }, z$1.core.$strip>;
31264
+ }, z$1.core.$strip>>;
31182
31265
  auto: z$1.ZodBoolean;
31183
31266
  }, z$1.core.$strip>;
31184
31267
  };