@jskit-ai/assistant-runtime 0.1.229 → 0.1.231
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.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/assistant-runtime",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.231",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node --test --test-concurrency=1"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"./server": "./src/server/index.js"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@jskit-ai/assistant-core": "0.1.
|
|
15
|
+
"@jskit-ai/assistant-core": "0.1.237",
|
|
16
16
|
"json-rest-schema": "^1.0.17"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
@@ -52,8 +52,9 @@ and `assistantServer` in server config.
|
|
|
52
52
|
semantic placements, an AI integration and its server resolver for an `admin` surface.
|
|
53
53
|
Install `@jskit-ai/connectors-catalog` and `@jskit-ai/connectors-core` and register
|
|
54
54
|
`ApplicationAiFeature` in the ordinary server feature list. Set its application ID
|
|
55
|
-
and AI-use policy. The example
|
|
56
|
-
|
|
55
|
+
and AI-use policy. The example selects Z.AI's GLM-4.7-Flash with a regular Z.AI key
|
|
56
|
+
in `APP_AI_API_KEY`; choose the application's own provider, model and key.
|
|
57
|
+
Provider availability is independent of configuration. Adapt the complete files to the
|
|
57
58
|
application's existing config and placement registries.
|
|
58
59
|
|
|
59
60
|
## Variation points
|
|
@@ -504,8 +504,10 @@ function createConversation(identity, { api, socket, actorKey, placement, reader
|
|
|
504
504
|
const rejection = failure.details?.delivery;
|
|
505
505
|
const notSent = Number.isInteger(failure.status) && failure.status >= 400 && failure.status < 500 &&
|
|
506
506
|
rejection && !Array.isArray(rejection) && rejection.status === "not-sent" && rejection.messageId === messageId;
|
|
507
|
+
// A definite rejection keeps its code so the application can offer
|
|
508
|
+
// the matching recovery, such as freeing assistant context.
|
|
507
509
|
if (notSent || SEND_REJECTIONS.has(failure.code) || failure.code === "conversation_steer_turn_finished" && failure.status === 409 && !failure.details?.delivery) return { ok: false, error: failure.message,
|
|
508
|
-
...(
|
|
510
|
+
...(failure.code ? { code: failure.code } : {}) };
|
|
509
511
|
throw failure;
|
|
510
512
|
} finally {
|
|
511
513
|
if (pendingMessages.get(messageId) === pending) pendingMessages.delete(messageId);
|
|
@@ -23,10 +23,11 @@ test("assistant surface pattern keeps product config explicit and secrets extern
|
|
|
23
23
|
const { ApplicationAiFeature } = await import(new URL("src/ApplicationAiFeature.js", exampleRoot));
|
|
24
24
|
const { ai } = await ApplicationAiFeature.setup({ env: {} });
|
|
25
25
|
await assert.rejects(ai.resolve({ context: {}, integrationId: "assistant" }));
|
|
26
|
-
const
|
|
26
|
+
const keyed = (await ApplicationAiFeature.setup({ env: { APP_AI_API_KEY: "fixture-key" } })).ai;
|
|
27
|
+
const client = await createAssistantAiClientFactory({ appConfig: serverConfig, env: {}, aiConnections: keyed })
|
|
27
28
|
.resolveClient("admin", { context: { actor: { id: "fixture-user" } } });
|
|
28
29
|
assert.equal(client.enabled, true);
|
|
29
|
-
assert.equal(client.defaultModel, "
|
|
30
|
+
assert.equal(client.defaultModel, "glm-4.7-flash");
|
|
30
31
|
assert.doesNotMatch(JSON.stringify({ publicConfig, serverConfig }), /api[_-]?key|secret/iu);
|
|
31
32
|
assert.doesNotMatch(placementSource, /generator|scaffold|receipt|provenance/u);
|
|
32
33
|
|