@copilotkitnext/runtime 0.0.1
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/.cursor/rules/runtime.always.mdc +9 -0
- package/.turbo/turbo-build.log +22 -0
- package/.turbo/turbo-check-types.log +4 -0
- package/.turbo/turbo-lint.log +56 -0
- package/.turbo/turbo-test$colon$coverage.log +149 -0
- package/.turbo/turbo-test.log +107 -0
- package/LICENSE +11 -0
- package/README-RUNNERS.md +78 -0
- package/dist/index.d.mts +245 -0
- package/dist/index.d.ts +245 -0
- package/dist/index.js +1873 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1841 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.mjs +3 -0
- package/package.json +62 -0
- package/src/__tests__/get-runtime-info.test.ts +117 -0
- package/src/__tests__/handle-run.test.ts +69 -0
- package/src/__tests__/handle-transcribe.test.ts +289 -0
- package/src/__tests__/in-process-agent-runner-messages.test.ts +599 -0
- package/src/__tests__/in-process-agent-runner.test.ts +726 -0
- package/src/__tests__/middleware.test.ts +432 -0
- package/src/__tests__/routing.test.ts +257 -0
- package/src/endpoint.ts +150 -0
- package/src/handler.ts +3 -0
- package/src/handlers/get-runtime-info.ts +50 -0
- package/src/handlers/handle-connect.ts +144 -0
- package/src/handlers/handle-run.ts +156 -0
- package/src/handlers/handle-transcribe.ts +126 -0
- package/src/index.ts +8 -0
- package/src/middleware.ts +232 -0
- package/src/runner/__tests__/enterprise-runner.test.ts +992 -0
- package/src/runner/__tests__/event-compaction.test.ts +253 -0
- package/src/runner/__tests__/in-memory-runner.test.ts +483 -0
- package/src/runner/__tests__/sqlite-runner.test.ts +975 -0
- package/src/runner/agent-runner.ts +27 -0
- package/src/runner/enterprise.ts +653 -0
- package/src/runner/event-compaction.ts +250 -0
- package/src/runner/in-memory.ts +322 -0
- package/src/runner/index.ts +0 -0
- package/src/runner/sqlite.ts +481 -0
- package/src/runtime.ts +53 -0
- package/src/transcription-service/transcription-service-openai.ts +29 -0
- package/src/transcription-service/transcription-service.ts +11 -0
- package/tsconfig.json +13 -0
- package/tsup.config.ts +11 -0
- package/vitest.config.mjs +15 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Conventions for the runtime package.
|
|
3
|
+
globs: "*"
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
- Node-targeted code compiled from `src/` to `dist/` using TypeScript.
|
|
8
|
+
- Vitest tests reside in `src/__tests__/` and use Node environment.
|
|
9
|
+
- Exported APIs live under `src/index.ts`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
> @copilotkitnext/runtime@0.0.0 build /Users/mme/Code/CopilotKit2/packages/runtime
|
|
3
|
+
> tsup
|
|
4
|
+
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v8.5.0
|
|
8
|
+
CLI Using tsup config: /Users/mme/Code/CopilotKit2/packages/runtime/tsup.config.ts
|
|
9
|
+
CLI Target: es2022
|
|
10
|
+
CLI Cleaning output folder
|
|
11
|
+
CJS Build start
|
|
12
|
+
ESM Build start
|
|
13
|
+
ESM dist/index.mjs 55.89 KB
|
|
14
|
+
ESM dist/index.mjs.map 117.76 KB
|
|
15
|
+
ESM ⚡️ Build success in 17ms
|
|
16
|
+
CJS dist/index.js 58.40 KB
|
|
17
|
+
CJS dist/index.js.map 118.05 KB
|
|
18
|
+
CJS ⚡️ Build success in 17ms
|
|
19
|
+
DTS Build start
|
|
20
|
+
DTS ⚡️ Build success in 6164ms
|
|
21
|
+
DTS dist/index.d.ts 7.96 KB
|
|
22
|
+
DTS dist/index.d.mts 7.96 KB
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
> @copilotkit/runtime@0.0.0 lint /Users/mme/Code/CopilotKit2/packages/runtime
|
|
3
|
+
> eslint . --max-warnings 0
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/Users/mme/Code/CopilotKit2/packages/runtime/src/__tests__/in-process-agent-runner-messages.test.ts
|
|
7
|
+
35:17 warning 'input' is defined but never used @typescript-eslint/no-unused-vars
|
|
8
|
+
46:5 warning Include a description after the "@ts-expect-error" directive to explain why the @ts-expect-error is necessary. The description must be 3 characters or longer @typescript-eslint/ban-ts-comment
|
|
9
|
+
|
|
10
|
+
/Users/mme/Code/CopilotKit2/packages/runtime/src/runner/__tests__/event-compaction.test.ts
|
|
11
|
+
21:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
12
|
+
41:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
13
|
+
45:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
14
|
+
47:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
15
|
+
66:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
16
|
+
68:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
17
|
+
72:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
18
|
+
74:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
19
|
+
90:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
20
|
+
117:29 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
21
|
+
137:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
22
|
+
157:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
23
|
+
161:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
24
|
+
163:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
25
|
+
182:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
26
|
+
184:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
27
|
+
188:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
28
|
+
190:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
29
|
+
206:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
30
|
+
221:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
31
|
+
244:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
32
|
+
249:31 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
33
|
+
|
|
34
|
+
/Users/mme/Code/CopilotKit2/packages/runtime/src/runner/event-compaction.ts
|
|
35
|
+
129:19 warning 'messageId' is assigned a value but never used @typescript-eslint/no-unused-vars
|
|
36
|
+
140:21 warning 'toolCallId' is assigned a value but never used @typescript-eslint/no-unused-vars
|
|
37
|
+
|
|
38
|
+
/Users/mme/Code/CopilotKit2/packages/runtime/src/runner/in-memory.ts
|
|
39
|
+
8:10 warning 'EMPTY' is defined but never used @typescript-eslint/no-unused-vars
|
|
40
|
+
99:31 warning 'args' is defined but never used @typescript-eslint/no-unused-vars
|
|
41
|
+
121:16 warning 'error' is defined but never used @typescript-eslint/no-unused-vars
|
|
42
|
+
|
|
43
|
+
/Users/mme/Code/CopilotKit2/packages/runtime/src/runner/sqlite.ts
|
|
44
|
+
8:10 warning 'EMPTY' is defined but never used @typescript-eslint/no-unused-vars
|
|
45
|
+
60:15 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
46
|
+
68:41 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
47
|
+
71:24 warning A `require()` style import is forbidden @typescript-eslint/no-require-imports
|
|
48
|
+
73:14 warning 'e' is defined but never used @typescript-eslint/no-unused-vars
|
|
49
|
+
164:50 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
50
|
+
232:31 warning 'args' is defined but never used @typescript-eslint/no-unused-vars
|
|
51
|
+
254:16 warning 'error' is defined but never used @typescript-eslint/no-unused-vars
|
|
52
|
+
|
|
53
|
+
✖ 37 problems (0 errors, 37 warnings)
|
|
54
|
+
|
|
55
|
+
ESLint found too many warnings (maximum: 0).
|
|
56
|
+
ELIFECYCLE Command failed with exit code 1.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @copilotkit/runtime@0.0.0 test:coverage /Users/mme/Code/CopilotKit2/packages/runtime
|
|
4
|
+
> jest --coverage
|
|
5
|
+
|
|
6
|
+
[1m[2mDetermining test suites to run...[22m[22m[999D[K
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
10
|
+
|
|
11
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
12
|
+
|
|
13
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
14
|
+
|
|
15
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
16
|
+
|
|
17
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
18
|
+
|
|
19
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
20
|
+
|
|
21
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
22
|
+
|
|
23
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
24
|
+
|
|
25
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
26
|
+
|
|
27
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
28
|
+
|
|
29
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
30
|
+
|
|
31
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
32
|
+
|
|
33
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
34
|
+
|
|
35
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
36
|
+
|
|
37
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
38
|
+
|
|
39
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
40
|
+
|
|
41
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
42
|
+
|
|
43
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
44
|
+
|
|
45
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
46
|
+
|
|
47
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
48
|
+
|
|
49
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
[0m[7m[33m[1m RUNS [22m[39m[27m[0m [2msrc/__tests__/[22m[1mendpoint.test.ts[22m
|
|
131
|
+
|
|
132
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
133
|
+
----------------|---------|----------|---------|---------|-------------------
|
|
134
|
+
[31;1mAll files [0m | [31;1m 43.47[0m | [33;1m 52.17[0m | [31;1m 15.38[0m | [31;1m 43.47[0m | [31;1m [0m
|
|
135
|
+
[31;1m src [0m | [31;1m 46.42[0m | [33;1m 57.14[0m | [31;1m 22.22[0m | [31;1m 46.42[0m | [31;1m [0m
|
|
136
|
+
[31;1m endpoint.ts [0m | [31;1m 38.63[0m | [31;1m 36.36[0m | [31;1m 14.28[0m | [31;1m 38.63[0m | [31;1m10-40,85-131 [0m
|
|
137
|
+
[32;1m handler.ts [0m | [32;1m 100[0m | [32;1m 100[0m | [32;1m 100[0m | [32;1m 100[0m | [33;1m [0m
|
|
138
|
+
[32;1m logger.ts [0m | [32;1m 100[0m | [33;1m 75[0m | [32;1m 100[0m | [32;1m 100[0m | [33;1m12-16 [0m
|
|
139
|
+
[33;1m runtime.ts [0m | [33;1m 50[0m | [32;1m 100[0m | [31;1m 0[0m | [33;1m 50[0m | [31;1m44-46 [0m
|
|
140
|
+
[31;1m src/handlers [0m | [31;1m 30.76[0m | [31;1m 0[0m | [31;1m 0[0m | [31;1m 30.76[0m | [31;1m [0m
|
|
141
|
+
[31;1m get-agents.ts[0m | [31;1m 12.5[0m | [31;1m 0[0m | [31;1m 0[0m | [31;1m 12.5[0m | [31;1m10-34 [0m
|
|
142
|
+
[33;1m get-info.ts [0m | [33;1m 66.66[0m | [32;1m 100[0m | [31;1m 0[0m | [33;1m 66.66[0m | [31;1m10 [0m
|
|
143
|
+
[33;1m handle-run.ts[0m | [33;1m 50[0m | [32;1m 100[0m | [31;1m 0[0m | [33;1m 50[0m | [31;1m14 [0m
|
|
144
|
+
----------------|---------|----------|---------|---------|-------------------
|
|
145
|
+
[1mTest Suites: [22m[1m[32m1 passed[39m[22m, 1 total
|
|
146
|
+
[1mTests: [22m[1m[32m20 passed[39m[22m, 20 total
|
|
147
|
+
[1mSnapshots: [22m0 total
|
|
148
|
+
[1mTime:[22m 0.556 s, estimated 1 s
|
|
149
|
+
[2mRan all test suites[22m[2m.[22m
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
> @copilotkitnext/runtime@0.0.0 test /Users/mme/Code/CopilotKit2/packages/runtime
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
RUN v3.2.4 /Users/mme/Code/CopilotKit2/packages/runtime
|
|
7
|
+
|
|
8
|
+
✓ src/__tests__/handle-transcribe.test.ts (12 tests) 36ms
|
|
9
|
+
stderr | src/__tests__/handle-run.test.ts > handleRunAgent > should return 500 when runtime.agents throws an error
|
|
10
|
+
Error running agent: Error: Database connection failed
|
|
11
|
+
at [90m/Users/mme/Code/CopilotKit2/packages/runtime/[39msrc/__tests__/handle-run.test.ts:46:30
|
|
12
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:155:11
|
|
13
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:752:26
|
|
14
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:1897:20
|
|
15
|
+
at new Promise (<anonymous>)
|
|
16
|
+
at runWithTimeout (file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:1863:10)
|
|
17
|
+
at runTest (file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:1574:12)
|
|
18
|
+
[90m at processTicksAndRejections (node:internal/process/task_queues:95:5)[39m
|
|
19
|
+
at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:1729:8)
|
|
20
|
+
at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/[4m.pnpm[24m/@vitest+runner@3.2.4/node_modules/[4m@vitest[24m/runner/dist/chunk-hooks.js:1729:8)
|
|
21
|
+
Error stack: Error: Database connection failed
|
|
22
|
+
at /Users/mme/Code/CopilotKit2/packages/runtime/src/__tests__/handle-run.test.ts:46:30
|
|
23
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:155:11
|
|
24
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:752:26
|
|
25
|
+
at file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1897:20
|
|
26
|
+
at new Promise (<anonymous>)
|
|
27
|
+
at runWithTimeout (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1863:10)
|
|
28
|
+
at runTest (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1574:12)
|
|
29
|
+
at processTicksAndRejections (node:internal/process/task_queues:95:5)
|
|
30
|
+
at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
|
|
31
|
+
at runSuite (file:///Users/mme/Code/CopilotKit2/node_modules/.pnpm/@vitest+runner@3.2.4/node_modules/@vitest/runner/dist/chunk-hooks.js:1729:8)
|
|
32
|
+
Error details: {
|
|
33
|
+
name: [32m'Error'[39m,
|
|
34
|
+
message: [32m'Database connection failed'[39m,
|
|
35
|
+
cause: [90mundefined[39m
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
✓ src/runner/__tests__/in-memory-runner.test.ts (7 tests) 8ms
|
|
39
|
+
✓ src/__tests__/in-process-agent-runner-messages.test.ts (7 tests) 8ms
|
|
40
|
+
✓ src/__tests__/handle-run.test.ts (2 tests) 16ms
|
|
41
|
+
✓ src/__tests__/routing.test.ts (21 tests) 39ms
|
|
42
|
+
✓ src/runner/__tests__/sqlite-runner.test.ts (19 tests) 201ms
|
|
43
|
+
✓ src/__tests__/in-process-agent-runner.test.ts (18 tests) 749ms
|
|
44
|
+
✓ src/runner/__tests__/event-compaction.test.ts (12 tests) 28ms
|
|
45
|
+
✓ src/__tests__/get-runtime-info.test.ts (4 tests) 8ms
|
|
46
|
+
stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware timeout
|
|
47
|
+
{
|
|
48
|
+
err: Response {
|
|
49
|
+
status: [33m502[39m,
|
|
50
|
+
statusText: [32m''[39m,
|
|
51
|
+
headers: Headers {},
|
|
52
|
+
body: [1mnull[22m,
|
|
53
|
+
bodyUsed: [33mfalse[39m,
|
|
54
|
+
ok: [33mfalse[39m,
|
|
55
|
+
redirected: [33mfalse[39m,
|
|
56
|
+
type: [32m'default'[39m,
|
|
57
|
+
url: [32m''[39m
|
|
58
|
+
},
|
|
59
|
+
url: [32m'https://example.com/info'[39m,
|
|
60
|
+
path: [32m'/info'[39m
|
|
61
|
+
} Error running before request middleware
|
|
62
|
+
|
|
63
|
+
stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware error responses
|
|
64
|
+
{
|
|
65
|
+
err: Response {
|
|
66
|
+
status: [33m400[39m,
|
|
67
|
+
statusText: [32m''[39m,
|
|
68
|
+
headers: Headers { [32m'content-type'[39m: [32m'text/plain;charset=UTF-8'[39m },
|
|
69
|
+
body: ReadableStream { locked: [33mfalse[39m, state: [32m'readable'[39m, supportsBYOB: [33mtrue[39m },
|
|
70
|
+
bodyUsed: [33mfalse[39m,
|
|
71
|
+
ok: [33mfalse[39m,
|
|
72
|
+
redirected: [33mfalse[39m,
|
|
73
|
+
type: [32m'default'[39m,
|
|
74
|
+
url: [32m''[39m
|
|
75
|
+
},
|
|
76
|
+
url: [32m'https://example.com/info'[39m,
|
|
77
|
+
path: [32m'/info'[39m
|
|
78
|
+
} Error running before request middleware
|
|
79
|
+
|
|
80
|
+
stderr | src/__tests__/middleware.test.ts > CopilotEndpoint middleware > handles webhook middleware server error
|
|
81
|
+
{
|
|
82
|
+
err: Response {
|
|
83
|
+
status: [33m502[39m,
|
|
84
|
+
statusText: [32m''[39m,
|
|
85
|
+
headers: Headers {},
|
|
86
|
+
body: [1mnull[22m,
|
|
87
|
+
bodyUsed: [33mfalse[39m,
|
|
88
|
+
ok: [33mfalse[39m,
|
|
89
|
+
redirected: [33mfalse[39m,
|
|
90
|
+
type: [32m'default'[39m,
|
|
91
|
+
url: [32m''[39m
|
|
92
|
+
},
|
|
93
|
+
url: [32m'https://example.com/info'[39m,
|
|
94
|
+
path: [32m'/info'[39m
|
|
95
|
+
} Error running before request middleware
|
|
96
|
+
|
|
97
|
+
✓ src/__tests__/middleware.test.ts (11 tests) 2378ms
|
|
98
|
+
✓ CopilotEndpoint middleware > handles webhook middleware timeout 2003ms
|
|
99
|
+
✓ src/runner/__tests__/enterprise-runner.test.ts (20 tests) 3206ms
|
|
100
|
+
✓ EnterpriseAgentRunner > should prevent concurrent runs on same thread 630ms
|
|
101
|
+
✓ EnterpriseAgentRunner > should track running state correctly 303ms
|
|
102
|
+
|
|
103
|
+
Test Files 11 passed (11)
|
|
104
|
+
Tests 133 passed (133)
|
|
105
|
+
Start at 10:38:14
|
|
106
|
+
Duration 4.92s (transform 1.12s, setup 0ms, collect 6.01s, tests 6.68s, environment 1ms, prepare 2.04s)
|
|
107
|
+
|
package/LICENSE
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Note: This license does not apply to the whole project. Individual packages may contain their own licenses.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Copyright 2025 Tawkit Inc.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
|
|
9
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Agent Runners
|
|
2
|
+
|
|
3
|
+
CopilotKit Runtime provides two agent runners for different use cases:
|
|
4
|
+
|
|
5
|
+
## InMemoryAgentRunner (Default)
|
|
6
|
+
|
|
7
|
+
The default runner that stores all data in memory. Perfect for development and applications that don't need persistence.
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
import { CopilotRuntime, InMemoryAgentRunner } from "@copilotkitnext/runtime";
|
|
11
|
+
|
|
12
|
+
// Default - uses InMemoryAgentRunner automatically
|
|
13
|
+
const runtime = new CopilotRuntime({
|
|
14
|
+
agents: myAgents,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Or explicitly
|
|
18
|
+
const runtime = new CopilotRuntime({
|
|
19
|
+
agents: myAgents,
|
|
20
|
+
runner: new InMemoryAgentRunner(),
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Features:**
|
|
25
|
+
|
|
26
|
+
- No external dependencies
|
|
27
|
+
- Fast performance
|
|
28
|
+
- Data is lost when process restarts
|
|
29
|
+
- Perfect for development and stateless applications
|
|
30
|
+
|
|
31
|
+
## SqliteAgentRunner
|
|
32
|
+
|
|
33
|
+
Provides persistent storage using SQLite. Ideal for applications that need to preserve conversation history across restarts.
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { CopilotRuntime, SqliteAgentRunner } from "@copilotkitnext/runtime";
|
|
37
|
+
|
|
38
|
+
const runtime = new CopilotRuntime({
|
|
39
|
+
agents: myAgents,
|
|
40
|
+
runner: new SqliteAgentRunner("./data/copilot.db"),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Or use in-memory SQLite (data persists during runtime only)
|
|
44
|
+
const runtime = new CopilotRuntime({
|
|
45
|
+
agents: myAgents,
|
|
46
|
+
runner: new SqliteAgentRunner(":memory:"),
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Features:**
|
|
51
|
+
|
|
52
|
+
- Persistent storage across restarts
|
|
53
|
+
- Maintains conversation history
|
|
54
|
+
- Parent-child run relationships
|
|
55
|
+
- Event compaction for historic runs
|
|
56
|
+
|
|
57
|
+
**Requirements:**
|
|
58
|
+
|
|
59
|
+
- Requires `better-sqlite3` to be installed:
|
|
60
|
+
```bash
|
|
61
|
+
npm install better-sqlite3
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Choosing the Right Runner
|
|
65
|
+
|
|
66
|
+
- **Use InMemoryAgentRunner when:**
|
|
67
|
+
- Building prototypes or demos
|
|
68
|
+
- Running in serverless environments
|
|
69
|
+
- You don't need conversation history
|
|
70
|
+
- You want zero external dependencies
|
|
71
|
+
|
|
72
|
+
- **Use SqliteAgentRunner when:**
|
|
73
|
+
- You need persistent conversation history
|
|
74
|
+
- Building production applications
|
|
75
|
+
- You want to analyze historic conversations
|
|
76
|
+
- Running on a traditional server
|
|
77
|
+
|
|
78
|
+
Both runners implement the same `AgentRunner` interface, so you can switch between them without changing your application code.
|