@jskit-ai/assistant-runtime 0.1.130 → 0.1.131-oldline.2
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/package.descriptor.mjs +155 -0
- package/package.json +8 -157
- package/src/client/components/AssistantSettingsClientElement.vue +1 -1
- package/src/client/composables/useAssistantRuntime.js +2 -2
- package/src/client/providers/AssistantClientProvider.js +2 -0
- package/src/server/AssistantProvider.js +1 -1
- package/src/server/repositories/assistantConfigRepository.js +1 -1
- package/src/server/repositories/conversationsRepository.js +1 -1
- package/src/server/repositories/messagesRepository.js +1 -1
- package/test/packageDescriptor.test.js +38 -0
- package/src/server/repositories/repositoryPersistenceUtils.js +0 -29
- package/test/packageMetadata.test.js +0 -38
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export default Object.freeze({
|
|
2
|
+
packageVersion: 1,
|
|
3
|
+
packageId: "@jskit-ai/assistant-runtime",
|
|
4
|
+
version: "0.1.131-oldline.2",
|
|
5
|
+
kind: "runtime",
|
|
6
|
+
description: "Shared assistant runtime with per-surface assistant registration.",
|
|
7
|
+
dependsOn: [
|
|
8
|
+
"@jskit-ai/assistant-core",
|
|
9
|
+
"@jskit-ai/database-runtime",
|
|
10
|
+
"@jskit-ai/http-runtime",
|
|
11
|
+
"@jskit-ai/shell-web",
|
|
12
|
+
"@jskit-ai/users-core",
|
|
13
|
+
"@jskit-ai/users-web"
|
|
14
|
+
],
|
|
15
|
+
capabilities: {
|
|
16
|
+
provides: ["assistant.runtime"],
|
|
17
|
+
requires: [
|
|
18
|
+
"runtime.actions",
|
|
19
|
+
"runtime.database",
|
|
20
|
+
"auth.policy",
|
|
21
|
+
"runtime.http-client",
|
|
22
|
+
"users.core",
|
|
23
|
+
"users.web"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
runtime: {
|
|
27
|
+
server: {
|
|
28
|
+
providers: [
|
|
29
|
+
{
|
|
30
|
+
entrypoint: "src/server/AssistantProvider.js",
|
|
31
|
+
export: "AssistantProvider"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
client: {
|
|
36
|
+
providers: [
|
|
37
|
+
{
|
|
38
|
+
entrypoint: "src/client/providers/AssistantClientProvider.js",
|
|
39
|
+
export: "AssistantClientProvider"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
metadata: {
|
|
45
|
+
jskit: {
|
|
46
|
+
tableOwnership: {
|
|
47
|
+
tables: [
|
|
48
|
+
{
|
|
49
|
+
tableName: "assistant_config",
|
|
50
|
+
provenance: "runtime-package",
|
|
51
|
+
ownerKind: "package-runtime"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
tableName: "assistant_conversations",
|
|
55
|
+
provenance: "runtime-package",
|
|
56
|
+
ownerKind: "package-runtime"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
tableName: "assistant_messages",
|
|
60
|
+
provenance: "runtime-package",
|
|
61
|
+
ownerKind: "package-runtime"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
apiSummary: {
|
|
67
|
+
surfaces: [
|
|
68
|
+
{
|
|
69
|
+
subpath: "./client",
|
|
70
|
+
summary: "Exports assistant runtime client elements and composables."
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
subpath: "./shared",
|
|
74
|
+
summary: "Exports assistant runtime shared config helpers."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
subpath: "./server/actionIds",
|
|
78
|
+
summary: "Exports assistant runtime action identifiers."
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
containerTokens: {
|
|
82
|
+
server: [
|
|
83
|
+
"assistant.config.repository",
|
|
84
|
+
"assistant.conversation.repository",
|
|
85
|
+
"assistant.message.repository",
|
|
86
|
+
"assistant.ai.client.factory",
|
|
87
|
+
"assistant.service.tool-catalog"
|
|
88
|
+
],
|
|
89
|
+
client: [
|
|
90
|
+
"assistant.web.settings.element"
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
mutations: {
|
|
96
|
+
dependencies: {
|
|
97
|
+
runtime: {
|
|
98
|
+
"@jskit-ai/assistant-core": "0.1.124",
|
|
99
|
+
"@jskit-ai/database-runtime": "0.1.147",
|
|
100
|
+
"@jskit-ai/http-runtime": "0.1.146",
|
|
101
|
+
"@jskit-ai/kernel": "0.1.147",
|
|
102
|
+
"@jskit-ai/shell-web": "0.1.148",
|
|
103
|
+
"@jskit-ai/users-core": "0.1.161",
|
|
104
|
+
"@jskit-ai/users-web": "0.1.165"
|
|
105
|
+
},
|
|
106
|
+
dev: {}
|
|
107
|
+
},
|
|
108
|
+
packageJson: {
|
|
109
|
+
scripts: {}
|
|
110
|
+
},
|
|
111
|
+
procfile: {},
|
|
112
|
+
files: [
|
|
113
|
+
{
|
|
114
|
+
op: "install-migration",
|
|
115
|
+
from: "templates/migrations/assistant_config_initial.cjs",
|
|
116
|
+
toDir: "migrations",
|
|
117
|
+
extension: ".cjs",
|
|
118
|
+
reason: "Install assistant configuration schema migration.",
|
|
119
|
+
category: "assistant-runtime",
|
|
120
|
+
id: "assistant-runtime-config-initial-schema"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
op: "install-migration",
|
|
124
|
+
from: "templates/migrations/assistant_transcripts_initial.cjs",
|
|
125
|
+
toDir: "migrations",
|
|
126
|
+
extension: ".cjs",
|
|
127
|
+
reason: "Install assistant transcript schema migration.",
|
|
128
|
+
category: "assistant-runtime",
|
|
129
|
+
id: "assistant-runtime-transcripts-initial-schema"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
text: [
|
|
133
|
+
{
|
|
134
|
+
op: "append-text",
|
|
135
|
+
file: "config/public.js",
|
|
136
|
+
position: "bottom",
|
|
137
|
+
skipIfContains: "config.assistantSurfaces ||= {};",
|
|
138
|
+
value: "\nconfig.assistantSurfaces ||= {};\n",
|
|
139
|
+
reason: "Initialize the shared assistant surface registry in public app config.",
|
|
140
|
+
category: "assistant-runtime",
|
|
141
|
+
id: "assistant-runtime-public-surface-registry-init"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
op: "append-text",
|
|
145
|
+
file: "config/server.js",
|
|
146
|
+
position: "bottom",
|
|
147
|
+
skipIfContains: "config.assistantServer ||= {};",
|
|
148
|
+
value: "\nconfig.assistantServer ||= {};\n",
|
|
149
|
+
reason: "Initialize the shared assistant server config registry.",
|
|
150
|
+
category: "assistant-runtime",
|
|
151
|
+
id: "assistant-runtime-server-surface-registry-init"
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/assistant-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.131-oldline.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./client": "./src/client/index.js",
|
|
@@ -8,167 +8,18 @@
|
|
|
8
8
|
"./server/actionIds": "./src/server/actionIds.js"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@jskit-ai/assistant-core": "0.1.
|
|
12
|
-
"@jskit-ai/database-runtime": "0.1.
|
|
13
|
-
"@jskit-ai/http-
|
|
14
|
-
"@jskit-ai/
|
|
15
|
-
"@jskit-ai/
|
|
16
|
-
"@jskit-ai/
|
|
17
|
-
"@jskit-ai/users-
|
|
18
|
-
"@jskit-ai/users-web": "0.1.177",
|
|
11
|
+
"@jskit-ai/assistant-core": "0.1.124",
|
|
12
|
+
"@jskit-ai/database-runtime": "0.1.147",
|
|
13
|
+
"@jskit-ai/http-runtime": "0.1.146",
|
|
14
|
+
"@jskit-ai/kernel": "0.1.147",
|
|
15
|
+
"@jskit-ai/shell-web": "0.1.148",
|
|
16
|
+
"@jskit-ai/users-core": "0.1.161",
|
|
17
|
+
"@jskit-ai/users-web": "0.1.178-oldline.3",
|
|
19
18
|
"json-rest-schema": "^1.0.17"
|
|
20
19
|
},
|
|
21
20
|
"peerDependencies": {
|
|
22
21
|
"@tanstack/vue-query": "^5.90.5",
|
|
23
22
|
"vue": "^3.5.13",
|
|
24
23
|
"vuetify": "^4.0.0"
|
|
25
|
-
},
|
|
26
|
-
"description": "Shared assistant runtime with per-surface assistant registration.",
|
|
27
|
-
"jskit": {
|
|
28
|
-
"kind": "runtime",
|
|
29
|
-
"capabilities": {
|
|
30
|
-
"provides": [
|
|
31
|
-
"assistant.runtime"
|
|
32
|
-
],
|
|
33
|
-
"requires": [
|
|
34
|
-
"runtime.actions",
|
|
35
|
-
"runtime.database",
|
|
36
|
-
"auth.policy",
|
|
37
|
-
"runtime.http-web",
|
|
38
|
-
"runtime.http-client",
|
|
39
|
-
"users.core",
|
|
40
|
-
"users.web"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"runtime": {
|
|
44
|
-
"server": {
|
|
45
|
-
"providers": [
|
|
46
|
-
{
|
|
47
|
-
"entrypoint": "src/server/AssistantProvider.js",
|
|
48
|
-
"export": "AssistantProvider"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"client": {
|
|
53
|
-
"providers": [
|
|
54
|
-
{
|
|
55
|
-
"entrypoint": "src/client/providers/AssistantClientProvider.js",
|
|
56
|
-
"export": "AssistantClientProvider"
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"metadata": {
|
|
62
|
-
"jskit": {
|
|
63
|
-
"tableOwnership": {
|
|
64
|
-
"tables": [
|
|
65
|
-
{
|
|
66
|
-
"tableName": "assistant_config",
|
|
67
|
-
"provenance": "runtime-package",
|
|
68
|
-
"ownerKind": "package-runtime"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"tableName": "assistant_conversations",
|
|
72
|
-
"provenance": "runtime-package",
|
|
73
|
-
"ownerKind": "package-runtime"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"tableName": "assistant_messages",
|
|
77
|
-
"provenance": "runtime-package",
|
|
78
|
-
"ownerKind": "package-runtime"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"apiSummary": {
|
|
84
|
-
"surfaces": [
|
|
85
|
-
{
|
|
86
|
-
"subpath": "./client",
|
|
87
|
-
"summary": "Exports assistant runtime client elements and composables."
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
"subpath": "./shared",
|
|
91
|
-
"summary": "Exports assistant runtime shared config helpers."
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"subpath": "./server/actionIds",
|
|
95
|
-
"summary": "Exports assistant runtime action identifiers."
|
|
96
|
-
}
|
|
97
|
-
],
|
|
98
|
-
"containerTokens": {
|
|
99
|
-
"server": [
|
|
100
|
-
"assistant.config.repository",
|
|
101
|
-
"assistant.conversation.repository",
|
|
102
|
-
"assistant.message.repository",
|
|
103
|
-
"assistant.ai.client.factory",
|
|
104
|
-
"assistant.service.tool-catalog"
|
|
105
|
-
],
|
|
106
|
-
"client": [
|
|
107
|
-
"assistant.web.settings.element"
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"mutations": {
|
|
113
|
-
"dependencies": {
|
|
114
|
-
"runtime": {
|
|
115
|
-
"@jskit-ai/assistant-core": "0.1.135",
|
|
116
|
-
"@jskit-ai/database-runtime": "0.1.159",
|
|
117
|
-
"@jskit-ai/http-web": "0.1.4",
|
|
118
|
-
"@jskit-ai/http-runtime": "0.1.157",
|
|
119
|
-
"@jskit-ai/kernel": "0.1.159",
|
|
120
|
-
"@jskit-ai/shell-web": "0.1.163",
|
|
121
|
-
"@jskit-ai/users-core": "0.1.172",
|
|
122
|
-
"@jskit-ai/users-web": "0.1.177"
|
|
123
|
-
},
|
|
124
|
-
"dev": {}
|
|
125
|
-
},
|
|
126
|
-
"packageJson": {
|
|
127
|
-
"scripts": {}
|
|
128
|
-
},
|
|
129
|
-
"procfile": {},
|
|
130
|
-
"files": [
|
|
131
|
-
{
|
|
132
|
-
"op": "install-migration",
|
|
133
|
-
"from": "templates/migrations/assistant_config_initial.cjs",
|
|
134
|
-
"toDir": "migrations",
|
|
135
|
-
"extension": ".cjs",
|
|
136
|
-
"reason": "Install assistant configuration schema migration.",
|
|
137
|
-
"category": "assistant-runtime",
|
|
138
|
-
"id": "assistant-runtime-config-initial-schema"
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
"op": "install-migration",
|
|
142
|
-
"from": "templates/migrations/assistant_transcripts_initial.cjs",
|
|
143
|
-
"toDir": "migrations",
|
|
144
|
-
"extension": ".cjs",
|
|
145
|
-
"reason": "Install assistant transcript schema migration.",
|
|
146
|
-
"category": "assistant-runtime",
|
|
147
|
-
"id": "assistant-runtime-transcripts-initial-schema"
|
|
148
|
-
}
|
|
149
|
-
],
|
|
150
|
-
"text": [
|
|
151
|
-
{
|
|
152
|
-
"op": "append-text",
|
|
153
|
-
"file": "config/public.js",
|
|
154
|
-
"position": "bottom",
|
|
155
|
-
"skipIfContains": "config.assistantSurfaces ||= {};",
|
|
156
|
-
"value": "\nconfig.assistantSurfaces ||= {};\n",
|
|
157
|
-
"reason": "Initialize the shared assistant surface registry in public app config.",
|
|
158
|
-
"category": "assistant-runtime",
|
|
159
|
-
"id": "assistant-runtime-public-surface-registry-init"
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"op": "append-text",
|
|
163
|
-
"file": "config/server.js",
|
|
164
|
-
"position": "bottom",
|
|
165
|
-
"skipIfContains": "config.assistantServer ||= {};",
|
|
166
|
-
"value": "\nconfig.assistantServer ||= {};\n",
|
|
167
|
-
"reason": "Initialize the shared assistant server config registry.",
|
|
168
|
-
"category": "assistant-runtime",
|
|
169
|
-
"id": "assistant-runtime-server-surface-registry-init"
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
}
|
|
173
24
|
}
|
|
174
25
|
}
|
|
@@ -30,7 +30,7 @@ import { validateOperationSection } from "@jskit-ai/http-runtime/shared/validato
|
|
|
30
30
|
import { assistantHttpClient, createAssistantApi, AssistantSettingsFormCard } from "@jskit-ai/assistant-core/client";
|
|
31
31
|
import { assistantConfigResource, assistantSettingsQueryKey, buildAssistantApiPath } from "@jskit-ai/assistant-core/shared";
|
|
32
32
|
import { useShellWebErrorRuntime } from "@jskit-ai/shell-web/client/error";
|
|
33
|
-
import { useSurfaceRouteContext } from "@jskit-ai/
|
|
33
|
+
import { useSurfaceRouteContext } from "@jskit-ai/users-web/client/composables/useSurfaceRouteContext";
|
|
34
34
|
import { resolveAssistantSurfaceConfig } from "../../shared/assistantSurfaces.js";
|
|
35
35
|
import { useWorkspaceWebScopeSupport } from "../support/workspaceScopeSupport.js";
|
|
36
36
|
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
createAssistantApi
|
|
21
21
|
} from "@jskit-ai/assistant-core/client";
|
|
22
22
|
import { useShellWebErrorRuntime } from "@jskit-ai/shell-web/client/error";
|
|
23
|
-
import { usePagedCollection } from "@jskit-ai/
|
|
24
|
-
import { useSurfaceRouteContext } from "@jskit-ai/
|
|
23
|
+
import { usePagedCollection } from "@jskit-ai/users-web/client/composables/usePagedCollection";
|
|
24
|
+
import { useSurfaceRouteContext } from "@jskit-ai/users-web/client/composables/useSurfaceRouteContext";
|
|
25
25
|
import { resolveAssistantSurfaceConfig } from "../../shared/assistantSurfaces.js";
|
|
26
26
|
import { insertTextAtSelection } from "../support/composerInputSupport.js";
|
|
27
27
|
import { useWorkspaceWebScopeSupport } from "../support/workspaceScopeSupport.js";
|
|
@@ -2,6 +2,8 @@ import AssistantSettingsClientElement from "../components/AssistantSettingsClien
|
|
|
2
2
|
|
|
3
3
|
class AssistantClientProvider {
|
|
4
4
|
static id = "assistant.web.client";
|
|
5
|
+
static dependsOn = ["users.web.client"];
|
|
6
|
+
|
|
5
7
|
register(app) {
|
|
6
8
|
if (!app || typeof app.singleton !== "function") {
|
|
7
9
|
throw new Error("AssistantClientProvider requires application singleton().");
|
|
@@ -60,7 +60,7 @@ function createAssistantAiClientFactory(config = {}) {
|
|
|
60
60
|
class AssistantProvider {
|
|
61
61
|
static id = "assistant.chat.service";
|
|
62
62
|
|
|
63
|
-
static
|
|
63
|
+
static dependsOn = ["runtime.actions", "runtime.database", "auth.policy.fastify", "users.core"];
|
|
64
64
|
|
|
65
65
|
register(app) {
|
|
66
66
|
if (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeDbRecordId, createWithTransaction } from "@jskit-ai/database-runtime/shared";
|
|
2
2
|
import { normalizeSurfaceId } from "@jskit-ai/kernel/shared/surface/registry";
|
|
3
3
|
import { normalizeRecordId, normalizeText } from "@jskit-ai/kernel/shared/support/normalize";
|
|
4
|
-
import { resolveInsertedId } from "
|
|
4
|
+
import { resolveInsertedId } from "@jskit-ai/assistant-core/server";
|
|
5
5
|
import { assistantRuntimeConfig } from "../../shared/assistantRuntimeConfig.js";
|
|
6
6
|
|
|
7
7
|
function normalizeTargetSurfaceId(value = "") {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
resolveInsertedId,
|
|
7
7
|
stringifyJsonObject,
|
|
8
8
|
toIso
|
|
9
|
-
} from "
|
|
9
|
+
} from "@jskit-ai/assistant-core/server";
|
|
10
10
|
import { assistantRuntimeConfig } from "../../shared/assistantRuntimeConfig.js";
|
|
11
11
|
|
|
12
12
|
function normalizeWorkspaceId(value) {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
resolveInsertedId,
|
|
6
6
|
stringifyJsonObject,
|
|
7
7
|
toIso
|
|
8
|
-
} from "
|
|
8
|
+
} from "@jskit-ai/assistant-core/server";
|
|
9
9
|
import { assistantRuntimeConfig } from "../../shared/assistantRuntimeConfig.js";
|
|
10
10
|
|
|
11
11
|
function normalizeWorkspaceId(value) {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import descriptor from "../package.descriptor.mjs";
|
|
4
|
+
|
|
5
|
+
function findTextMutation(id) {
|
|
6
|
+
const mutations = Array.isArray(descriptor?.mutations?.text) ? descriptor.mutations.text : [];
|
|
7
|
+
return mutations.find((entry) => String(entry?.id || "") === id) || null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function findFileMutation(id) {
|
|
11
|
+
const mutations = Array.isArray(descriptor?.mutations?.files) ? descriptor.mutations.files : [];
|
|
12
|
+
return mutations.find((entry) => String(entry?.id || "") === id) || null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test("assistant-runtime descriptor registers runtime providers and initializes assistant config roots", () => {
|
|
16
|
+
assert.equal(descriptor.kind, "runtime");
|
|
17
|
+
assert.equal(descriptor.packageId, "@jskit-ai/assistant-runtime");
|
|
18
|
+
assert.equal(descriptor.dependsOn.includes("@jskit-ai/workspaces-core"), false);
|
|
19
|
+
assert.equal(descriptor.dependsOn.includes("@jskit-ai/workspaces-web"), false);
|
|
20
|
+
assert.equal(descriptor.capabilities?.requires?.includes("workspaces.core"), false);
|
|
21
|
+
assert.equal(descriptor.capabilities?.requires?.includes("workspaces.web"), false);
|
|
22
|
+
assert.equal(descriptor.runtime?.server?.providers?.[0]?.entrypoint, "src/server/AssistantProvider.js");
|
|
23
|
+
assert.equal(descriptor.runtime?.client?.providers?.[0]?.entrypoint, "src/client/providers/AssistantClientProvider.js");
|
|
24
|
+
|
|
25
|
+
const publicInit = findTextMutation("assistant-runtime-public-surface-registry-init");
|
|
26
|
+
const serverInit = findTextMutation("assistant-runtime-server-surface-registry-init");
|
|
27
|
+
|
|
28
|
+
assert.match(String(publicInit?.value || ""), /config\.assistantSurfaces \|\|= \{\};/);
|
|
29
|
+
assert.match(String(serverInit?.value || ""), /config\.assistantServer \|\|= \{\};/);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("assistant-runtime descriptor ships common assistant migrations", () => {
|
|
33
|
+
const configMigration = findFileMutation("assistant-runtime-config-initial-schema");
|
|
34
|
+
const transcriptMigration = findFileMutation("assistant-runtime-transcripts-initial-schema");
|
|
35
|
+
|
|
36
|
+
assert.equal(configMigration?.from, "templates/migrations/assistant_config_initial.cjs");
|
|
37
|
+
assert.equal(transcriptMigration?.from, "templates/migrations/assistant_transcripts_initial.cjs");
|
|
38
|
+
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { resolveInsertedRecordId } from "@jskit-ai/database-runtime/shared";
|
|
2
|
-
import { parseJsonObject } from "@jskit-ai/assistant-core/shared";
|
|
3
|
-
|
|
4
|
-
function stringifyJsonObject(value) {
|
|
5
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
6
|
-
return null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return JSON.stringify(value);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function toIso(value) {
|
|
13
|
-
if (!value) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const date = value instanceof Date ? value : new Date(value);
|
|
18
|
-
if (Number.isNaN(date.getTime())) {
|
|
19
|
-
return "";
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return date.toISOString();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function resolveInsertedId(insertResult) {
|
|
26
|
-
return resolveInsertedRecordId(insertResult, { fallback: "" }) || "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { parseJsonObject, stringifyJsonObject, toIso, resolveInsertedId };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import test from "node:test";
|
|
3
|
-
import packageJson from "../package.json" with { type: "json" };
|
|
4
|
-
|
|
5
|
-
const packageMetadata = packageJson.jskit;
|
|
6
|
-
|
|
7
|
-
function findTextMutation(id) {
|
|
8
|
-
const mutations = Array.isArray(packageMetadata?.mutations?.text) ? packageMetadata.mutations.text : [];
|
|
9
|
-
return mutations.find((entry) => String(entry?.id || "") === id) || null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function findFileMutation(id) {
|
|
13
|
-
const mutations = Array.isArray(packageMetadata?.mutations?.files) ? packageMetadata.mutations.files : [];
|
|
14
|
-
return mutations.find((entry) => String(entry?.id || "") === id) || null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
test("assistant-runtime packageMetadata registers runtime providers and initializes assistant config roots", () => {
|
|
18
|
-
assert.equal(packageMetadata.kind, "runtime");
|
|
19
|
-
assert.equal(packageJson.name, "@jskit-ai/assistant-runtime");
|
|
20
|
-
assert.equal(packageMetadata.capabilities?.requires?.includes("workspaces.core"), false);
|
|
21
|
-
assert.equal(packageMetadata.capabilities?.requires?.includes("workspaces.web"), false);
|
|
22
|
-
assert.equal(packageMetadata.runtime?.server?.providers?.[0]?.entrypoint, "src/server/AssistantProvider.js");
|
|
23
|
-
assert.equal(packageMetadata.runtime?.client?.providers?.[0]?.entrypoint, "src/client/providers/AssistantClientProvider.js");
|
|
24
|
-
|
|
25
|
-
const publicInit = findTextMutation("assistant-runtime-public-surface-registry-init");
|
|
26
|
-
const serverInit = findTextMutation("assistant-runtime-server-surface-registry-init");
|
|
27
|
-
|
|
28
|
-
assert.match(String(publicInit?.value || ""), /config\.assistantSurfaces \|\|= \{\};/);
|
|
29
|
-
assert.match(String(serverInit?.value || ""), /config\.assistantServer \|\|= \{\};/);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test("assistant-runtime packageMetadata ships common assistant migrations", () => {
|
|
33
|
-
const configMigration = findFileMutation("assistant-runtime-config-initial-schema");
|
|
34
|
-
const transcriptMigration = findFileMutation("assistant-runtime-transcripts-initial-schema");
|
|
35
|
-
|
|
36
|
-
assert.equal(configMigration?.from, "templates/migrations/assistant_config_initial.cjs");
|
|
37
|
-
assert.equal(transcriptMigration?.from, "templates/migrations/assistant_transcripts_initial.cjs");
|
|
38
|
-
});
|