@copilotkitnext/runtime 0.0.21 → 0.0.22-alpha.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/{chunk-SZFA2SCT.mjs → chunk-LDTC5BLU.mjs} +311 -207
- package/dist/chunk-LDTC5BLU.mjs.map +1 -0
- package/dist/express.d.mts +1 -1
- package/dist/express.d.ts +1 -1
- package/dist/express.js +9 -3
- package/dist/express.js.map +1 -1
- package/dist/express.mjs +1 -1
- package/dist/index.d.mts +64 -5
- package/dist/index.d.ts +64 -5
- package/dist/index.js +320 -208
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{runtime-BEcxV64L.d.mts → runtime-njBGN6lZ.d.mts} +29 -1
- package/dist/{runtime-BEcxV64L.d.ts → runtime-njBGN6lZ.d.ts} +29 -1
- package/package.json +4 -4
- package/dist/chunk-SZFA2SCT.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CopilotRuntime, A as AgentRunner, a as AgentRunnerRunRequest, b as AgentRunnerConnectRequest, c as AgentRunnerIsRunningRequest, d as AgentRunnerStopRequest } from './runtime-
|
|
2
|
-
export {
|
|
1
|
+
import { C as CopilotRuntime, A as AgentRunner, R as ResourceScope, a as AgentRunnerRunRequest, b as AgentRunnerConnectRequest, c as AgentRunnerIsRunningRequest, d as AgentRunnerStopRequest, e as AgentRunnerListThreadsRequest, f as AgentRunnerListThreadsResponse, T as ThreadMetadata } from './runtime-njBGN6lZ.mjs';
|
|
2
|
+
export { g as CopilotRuntimeOptions, V as VERSION } from './runtime-njBGN6lZ.mjs';
|
|
3
3
|
import * as hono_hono_base from 'hono/hono-base';
|
|
4
4
|
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
|
-
import { BaseEvent } from '@ag-ui/client';
|
|
6
|
+
import { BaseEvent, RunAgentInput } from '@ag-ui/client';
|
|
7
7
|
export { finalizeRunEvents } from '@copilotkitnext/shared';
|
|
8
8
|
|
|
9
9
|
interface CopilotEndpointParams {
|
|
@@ -103,11 +103,70 @@ declare function createCopilotEndpointSingleRoute({ runtime, basePath }: Copilot
|
|
|
103
103
|
};
|
|
104
104
|
}, string>;
|
|
105
105
|
|
|
106
|
-
declare class
|
|
106
|
+
declare abstract class AgentRunnerBase extends AgentRunner {
|
|
107
|
+
private active;
|
|
108
|
+
private threadScope;
|
|
109
|
+
constructor();
|
|
110
|
+
protected abstract acquireRun(threadId: string, runId: string): Promise<boolean>;
|
|
111
|
+
protected abstract releaseRun(threadId: string): Promise<void>;
|
|
112
|
+
protected abstract isRunningState(threadId: string): Promise<boolean>;
|
|
113
|
+
protected abstract listRuns(threadId: string): Promise<Array<{
|
|
114
|
+
runId: string;
|
|
115
|
+
events: BaseEvent[];
|
|
116
|
+
createdAt: number;
|
|
117
|
+
}>>;
|
|
118
|
+
protected abstract saveRun(threadId: string, runId: string, events: BaseEvent[], input: RunAgentInput, parentRunId: string | null): Promise<void>;
|
|
119
|
+
protected abstract pageThreads(params: {
|
|
120
|
+
scope?: ResourceScope | null;
|
|
121
|
+
limit?: number;
|
|
122
|
+
offset?: number;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
threadIds: string[];
|
|
125
|
+
total: number;
|
|
126
|
+
}>;
|
|
127
|
+
protected abstract deleteThreadStorage(threadId: string, scope?: ResourceScope | null): Promise<void>;
|
|
128
|
+
protected abstract publishLive(threadId: string, event: BaseEvent): Promise<void> | void;
|
|
129
|
+
protected abstract completeLive(threadId: string): Promise<void> | void;
|
|
130
|
+
protected abstract subscribeLive(threadId: string): Observable<BaseEvent>;
|
|
131
|
+
protected closeLive?(threadId: string): Promise<void> | void;
|
|
107
132
|
run(request: AgentRunnerRunRequest): Observable<BaseEvent>;
|
|
108
133
|
connect(request: AgentRunnerConnectRequest): Observable<BaseEvent>;
|
|
109
134
|
isRunning(request: AgentRunnerIsRunningRequest): Promise<boolean>;
|
|
110
135
|
stop(request: AgentRunnerStopRequest): Promise<boolean | undefined>;
|
|
136
|
+
listThreads(request: AgentRunnerListThreadsRequest): Promise<AgentRunnerListThreadsResponse>;
|
|
137
|
+
getThreadMetadata(threadId: string, scope?: ResourceScope | null): Promise<ThreadMetadata | null>;
|
|
138
|
+
deleteThread(threadId: string, scope?: ResourceScope | null): Promise<void>;
|
|
111
139
|
}
|
|
112
140
|
|
|
113
|
-
|
|
141
|
+
type HistoricRun = {
|
|
142
|
+
runId: string;
|
|
143
|
+
events: BaseEvent[];
|
|
144
|
+
createdAt: number;
|
|
145
|
+
};
|
|
146
|
+
declare class InMemoryAgentRunner extends AgentRunnerBase {
|
|
147
|
+
private state;
|
|
148
|
+
private runs;
|
|
149
|
+
private channels;
|
|
150
|
+
constructor();
|
|
151
|
+
private ensureChannel;
|
|
152
|
+
protected acquireRun(threadId: string, runId: string): Promise<boolean>;
|
|
153
|
+
protected releaseRun(threadId: string): Promise<void>;
|
|
154
|
+
protected isRunningState(threadId: string): Promise<boolean>;
|
|
155
|
+
protected listRuns(threadId: string): Promise<HistoricRun[]>;
|
|
156
|
+
protected saveRun(threadId: string, runId: string, events: BaseEvent[], input: RunAgentInput, parentRunId: string | null): Promise<void>;
|
|
157
|
+
protected pageThreads(params: {
|
|
158
|
+
scope?: any;
|
|
159
|
+
limit?: number;
|
|
160
|
+
offset?: number;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
threadIds: string[];
|
|
163
|
+
total: number;
|
|
164
|
+
}>;
|
|
165
|
+
protected deleteThreadStorage(threadId: string): Promise<void>;
|
|
166
|
+
protected publishLive(threadId: string, event: BaseEvent): void;
|
|
167
|
+
protected completeLive(threadId: string): void;
|
|
168
|
+
protected subscribeLive(threadId: string): Observable<BaseEvent>;
|
|
169
|
+
protected closeLive(threadId: string): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { AgentRunner, AgentRunnerBase, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerListThreadsRequest, AgentRunnerListThreadsResponse, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotRuntime, InMemoryAgentRunner, ResourceScope, ThreadMetadata, createCopilotEndpoint, createCopilotEndpointSingleRoute };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CopilotRuntime, A as AgentRunner, a as AgentRunnerRunRequest, b as AgentRunnerConnectRequest, c as AgentRunnerIsRunningRequest, d as AgentRunnerStopRequest } from './runtime-
|
|
2
|
-
export {
|
|
1
|
+
import { C as CopilotRuntime, A as AgentRunner, R as ResourceScope, a as AgentRunnerRunRequest, b as AgentRunnerConnectRequest, c as AgentRunnerIsRunningRequest, d as AgentRunnerStopRequest, e as AgentRunnerListThreadsRequest, f as AgentRunnerListThreadsResponse, T as ThreadMetadata } from './runtime-njBGN6lZ.js';
|
|
2
|
+
export { g as CopilotRuntimeOptions, V as VERSION } from './runtime-njBGN6lZ.js';
|
|
3
3
|
import * as hono_hono_base from 'hono/hono-base';
|
|
4
4
|
import * as hono_utils_http_status from 'hono/utils/http-status';
|
|
5
5
|
import { Observable } from 'rxjs';
|
|
6
|
-
import { BaseEvent } from '@ag-ui/client';
|
|
6
|
+
import { BaseEvent, RunAgentInput } from '@ag-ui/client';
|
|
7
7
|
export { finalizeRunEvents } from '@copilotkitnext/shared';
|
|
8
8
|
|
|
9
9
|
interface CopilotEndpointParams {
|
|
@@ -103,11 +103,70 @@ declare function createCopilotEndpointSingleRoute({ runtime, basePath }: Copilot
|
|
|
103
103
|
};
|
|
104
104
|
}, string>;
|
|
105
105
|
|
|
106
|
-
declare class
|
|
106
|
+
declare abstract class AgentRunnerBase extends AgentRunner {
|
|
107
|
+
private active;
|
|
108
|
+
private threadScope;
|
|
109
|
+
constructor();
|
|
110
|
+
protected abstract acquireRun(threadId: string, runId: string): Promise<boolean>;
|
|
111
|
+
protected abstract releaseRun(threadId: string): Promise<void>;
|
|
112
|
+
protected abstract isRunningState(threadId: string): Promise<boolean>;
|
|
113
|
+
protected abstract listRuns(threadId: string): Promise<Array<{
|
|
114
|
+
runId: string;
|
|
115
|
+
events: BaseEvent[];
|
|
116
|
+
createdAt: number;
|
|
117
|
+
}>>;
|
|
118
|
+
protected abstract saveRun(threadId: string, runId: string, events: BaseEvent[], input: RunAgentInput, parentRunId: string | null): Promise<void>;
|
|
119
|
+
protected abstract pageThreads(params: {
|
|
120
|
+
scope?: ResourceScope | null;
|
|
121
|
+
limit?: number;
|
|
122
|
+
offset?: number;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
threadIds: string[];
|
|
125
|
+
total: number;
|
|
126
|
+
}>;
|
|
127
|
+
protected abstract deleteThreadStorage(threadId: string, scope?: ResourceScope | null): Promise<void>;
|
|
128
|
+
protected abstract publishLive(threadId: string, event: BaseEvent): Promise<void> | void;
|
|
129
|
+
protected abstract completeLive(threadId: string): Promise<void> | void;
|
|
130
|
+
protected abstract subscribeLive(threadId: string): Observable<BaseEvent>;
|
|
131
|
+
protected closeLive?(threadId: string): Promise<void> | void;
|
|
107
132
|
run(request: AgentRunnerRunRequest): Observable<BaseEvent>;
|
|
108
133
|
connect(request: AgentRunnerConnectRequest): Observable<BaseEvent>;
|
|
109
134
|
isRunning(request: AgentRunnerIsRunningRequest): Promise<boolean>;
|
|
110
135
|
stop(request: AgentRunnerStopRequest): Promise<boolean | undefined>;
|
|
136
|
+
listThreads(request: AgentRunnerListThreadsRequest): Promise<AgentRunnerListThreadsResponse>;
|
|
137
|
+
getThreadMetadata(threadId: string, scope?: ResourceScope | null): Promise<ThreadMetadata | null>;
|
|
138
|
+
deleteThread(threadId: string, scope?: ResourceScope | null): Promise<void>;
|
|
111
139
|
}
|
|
112
140
|
|
|
113
|
-
|
|
141
|
+
type HistoricRun = {
|
|
142
|
+
runId: string;
|
|
143
|
+
events: BaseEvent[];
|
|
144
|
+
createdAt: number;
|
|
145
|
+
};
|
|
146
|
+
declare class InMemoryAgentRunner extends AgentRunnerBase {
|
|
147
|
+
private state;
|
|
148
|
+
private runs;
|
|
149
|
+
private channels;
|
|
150
|
+
constructor();
|
|
151
|
+
private ensureChannel;
|
|
152
|
+
protected acquireRun(threadId: string, runId: string): Promise<boolean>;
|
|
153
|
+
protected releaseRun(threadId: string): Promise<void>;
|
|
154
|
+
protected isRunningState(threadId: string): Promise<boolean>;
|
|
155
|
+
protected listRuns(threadId: string): Promise<HistoricRun[]>;
|
|
156
|
+
protected saveRun(threadId: string, runId: string, events: BaseEvent[], input: RunAgentInput, parentRunId: string | null): Promise<void>;
|
|
157
|
+
protected pageThreads(params: {
|
|
158
|
+
scope?: any;
|
|
159
|
+
limit?: number;
|
|
160
|
+
offset?: number;
|
|
161
|
+
}): Promise<{
|
|
162
|
+
threadIds: string[];
|
|
163
|
+
total: number;
|
|
164
|
+
}>;
|
|
165
|
+
protected deleteThreadStorage(threadId: string): Promise<void>;
|
|
166
|
+
protected publishLive(threadId: string, event: BaseEvent): void;
|
|
167
|
+
protected completeLive(threadId: string): void;
|
|
168
|
+
protected subscribeLive(threadId: string): Observable<BaseEvent>;
|
|
169
|
+
protected closeLive(threadId: string): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export { AgentRunner, AgentRunnerBase, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerListThreadsRequest, AgentRunnerListThreadsResponse, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotRuntime, InMemoryAgentRunner, ResourceScope, ThreadMetadata, createCopilotEndpoint, createCopilotEndpointSingleRoute };
|