@copilotkitnext/runtime 0.0.17-alpha.0 → 0.0.17

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.mts CHANGED
@@ -18,8 +18,6 @@ import * as hono_utils_http_status from 'hono/utils/http-status';
18
18
  * • `AFTER_REQUEST` – runs *after* the handler returns a `Response`.
19
19
  */
20
20
 
21
- /** A string beginning with http:// or https:// that points to a webhook endpoint. */
22
- type MiddlewareURL = `${"http" | "https"}://${string}`;
23
21
  interface BeforeRequestMiddlewareParameters {
24
22
  runtime: CopilotRuntime;
25
23
  request: Request;
@@ -35,8 +33,8 @@ type AfterRequestMiddlewareFn = (params: AfterRequestMiddlewareParameters) => Ma
35
33
  /**
36
34
  * A middleware value can be either a callback function or a webhook URL.
37
35
  */
38
- type BeforeRequestMiddleware = BeforeRequestMiddlewareFn | MiddlewareURL;
39
- type AfterRequestMiddleware = AfterRequestMiddlewareFn | MiddlewareURL;
36
+ type BeforeRequestMiddleware = BeforeRequestMiddlewareFn;
37
+ type AfterRequestMiddleware = AfterRequestMiddlewareFn;
40
38
 
41
39
  interface TranscribeFileOptions {
42
40
  audioFile: File;
@@ -107,7 +105,7 @@ type CopilotEndpointContext = {
107
105
  modifiedRequest?: Request;
108
106
  };
109
107
  };
110
- declare function createCopilotEndpoint({ runtime, basePath, }: CopilotEndpointParams): hono_hono_base.HonoBase<CopilotEndpointContext, {
108
+ declare function createCopilotEndpoint({ runtime, basePath }: CopilotEndpointParams): hono_hono_base.HonoBase<CopilotEndpointContext, {
111
109
  [x: `${string}/*`]: {};
112
110
  } & {
113
111
  [x: `${string}/agent/:agentId/run`]: {
@@ -135,6 +133,21 @@ declare function createCopilotEndpoint({ runtime, basePath, }: CopilotEndpointPa
135
133
  status: hono_utils_http_status.StatusCode;
136
134
  };
137
135
  };
136
+ } & {
137
+ [x: `${string}/agent/:agentId/stop/:threadId`]: {
138
+ $post: {
139
+ input: {
140
+ param: {
141
+ agentId: string;
142
+ } & {
143
+ threadId: string;
144
+ };
145
+ };
146
+ output: {};
147
+ outputFormat: string;
148
+ status: hono_utils_http_status.StatusCode;
149
+ };
150
+ };
138
151
  } & {
139
152
  [x: `${string}/info`]: {
140
153
  $get: {
@@ -159,7 +172,13 @@ declare class InMemoryAgentRunner extends AgentRunner {
159
172
  run(request: AgentRunnerRunRequest): Observable<BaseEvent>;
160
173
  connect(request: AgentRunnerConnectRequest): Observable<BaseEvent>;
161
174
  isRunning(request: AgentRunnerIsRunningRequest): Promise<boolean>;
162
- stop(_request: AgentRunnerStopRequest): Promise<boolean | undefined>;
175
+ stop(request: AgentRunnerStopRequest): Promise<boolean | undefined>;
176
+ }
177
+
178
+ interface FinalizeRunOptions {
179
+ stopRequested?: boolean;
180
+ interruptionMessage?: string;
163
181
  }
182
+ declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
164
183
 
165
- export { AgentRunner, type AgentRunnerConnectRequest, type AgentRunnerIsRunningRequest, type AgentRunnerRunRequest, type AgentRunnerStopRequest, CopilotRuntime, type CopilotRuntimeOptions, InMemoryAgentRunner, VERSION, createCopilotEndpoint };
184
+ export { AgentRunner, type AgentRunnerConnectRequest, type AgentRunnerIsRunningRequest, type AgentRunnerRunRequest, type AgentRunnerStopRequest, CopilotRuntime, type CopilotRuntimeOptions, InMemoryAgentRunner, VERSION, createCopilotEndpoint, finalizeRunEvents };
package/dist/index.d.ts CHANGED
@@ -18,8 +18,6 @@ import * as hono_utils_http_status from 'hono/utils/http-status';
18
18
  * • `AFTER_REQUEST` – runs *after* the handler returns a `Response`.
19
19
  */
20
20
 
21
- /** A string beginning with http:// or https:// that points to a webhook endpoint. */
22
- type MiddlewareURL = `${"http" | "https"}://${string}`;
23
21
  interface BeforeRequestMiddlewareParameters {
24
22
  runtime: CopilotRuntime;
25
23
  request: Request;
@@ -35,8 +33,8 @@ type AfterRequestMiddlewareFn = (params: AfterRequestMiddlewareParameters) => Ma
35
33
  /**
36
34
  * A middleware value can be either a callback function or a webhook URL.
37
35
  */
38
- type BeforeRequestMiddleware = BeforeRequestMiddlewareFn | MiddlewareURL;
39
- type AfterRequestMiddleware = AfterRequestMiddlewareFn | MiddlewareURL;
36
+ type BeforeRequestMiddleware = BeforeRequestMiddlewareFn;
37
+ type AfterRequestMiddleware = AfterRequestMiddlewareFn;
40
38
 
41
39
  interface TranscribeFileOptions {
42
40
  audioFile: File;
@@ -107,7 +105,7 @@ type CopilotEndpointContext = {
107
105
  modifiedRequest?: Request;
108
106
  };
109
107
  };
110
- declare function createCopilotEndpoint({ runtime, basePath, }: CopilotEndpointParams): hono_hono_base.HonoBase<CopilotEndpointContext, {
108
+ declare function createCopilotEndpoint({ runtime, basePath }: CopilotEndpointParams): hono_hono_base.HonoBase<CopilotEndpointContext, {
111
109
  [x: `${string}/*`]: {};
112
110
  } & {
113
111
  [x: `${string}/agent/:agentId/run`]: {
@@ -135,6 +133,21 @@ declare function createCopilotEndpoint({ runtime, basePath, }: CopilotEndpointPa
135
133
  status: hono_utils_http_status.StatusCode;
136
134
  };
137
135
  };
136
+ } & {
137
+ [x: `${string}/agent/:agentId/stop/:threadId`]: {
138
+ $post: {
139
+ input: {
140
+ param: {
141
+ agentId: string;
142
+ } & {
143
+ threadId: string;
144
+ };
145
+ };
146
+ output: {};
147
+ outputFormat: string;
148
+ status: hono_utils_http_status.StatusCode;
149
+ };
150
+ };
138
151
  } & {
139
152
  [x: `${string}/info`]: {
140
153
  $get: {
@@ -159,7 +172,13 @@ declare class InMemoryAgentRunner extends AgentRunner {
159
172
  run(request: AgentRunnerRunRequest): Observable<BaseEvent>;
160
173
  connect(request: AgentRunnerConnectRequest): Observable<BaseEvent>;
161
174
  isRunning(request: AgentRunnerIsRunningRequest): Promise<boolean>;
162
- stop(_request: AgentRunnerStopRequest): Promise<boolean | undefined>;
175
+ stop(request: AgentRunnerStopRequest): Promise<boolean | undefined>;
176
+ }
177
+
178
+ interface FinalizeRunOptions {
179
+ stopRequested?: boolean;
180
+ interruptionMessage?: string;
163
181
  }
182
+ declare function finalizeRunEvents(events: BaseEvent[], options?: FinalizeRunOptions): BaseEvent[];
164
183
 
165
- export { AgentRunner, type AgentRunnerConnectRequest, type AgentRunnerIsRunningRequest, type AgentRunnerRunRequest, type AgentRunnerStopRequest, CopilotRuntime, type CopilotRuntimeOptions, InMemoryAgentRunner, VERSION, createCopilotEndpoint };
184
+ export { AgentRunner, type AgentRunnerConnectRequest, type AgentRunnerIsRunningRequest, type AgentRunnerRunRequest, type AgentRunnerStopRequest, CopilotRuntime, type CopilotRuntimeOptions, InMemoryAgentRunner, VERSION, createCopilotEndpoint, finalizeRunEvents };