feat: add JavaScript session orchestration runtime
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"runId": "c0f104c0-f80a-4890-86a5-96dd9a44fb78",
|
||||
"sourceConversationId": "c01c2e84-5d52-4b0b-bab0-e10daf6c65c9",
|
||||
"scriptsDir": "/home/cc-web/.ccweb/scripts",
|
||||
"name": "restart-smoke-20260826.js",
|
||||
"scriptPath": "/home/cc-web/.ccweb/scripts/restart-smoke-20260826.js",
|
||||
"status": "succeeded",
|
||||
"startedAt": "2026-08-26T00:58:42.657Z",
|
||||
"finishedAt": "2026-08-26T00:58:42.864Z",
|
||||
"durationMs": 207,
|
||||
"exitCode": 0,
|
||||
"signal": null,
|
||||
"terminationReason": null,
|
||||
"stopRequested": false,
|
||||
"tokenRevoked": true,
|
||||
"pid": 1181595,
|
||||
"stderrPreview": ""
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"smoke":true,"conversationId":"c01c2e84-5d52-4b0b-bab0-e10daf6c65c9"}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"runId": "caa16aa4-50ac-48fd-9b04-7596f1c4df99",
|
||||
"sourceConversationId": "c01c2e84-5d52-4b0b-bab0-e10daf6c65c9",
|
||||
"scriptsDir": "/home/cc-web/.ccweb/scripts",
|
||||
"name": "session-orchestration-e2e-20260826.js",
|
||||
"scriptPath": "/home/cc-web/.ccweb/scripts/session-orchestration-e2e-20260826.js",
|
||||
"status": "succeeded",
|
||||
"startedAt": "2026-08-26T01:55:38.851Z",
|
||||
"finishedAt": "2026-08-26T01:56:21.027Z",
|
||||
"durationMs": 42176,
|
||||
"exitCode": 0,
|
||||
"signal": null,
|
||||
"terminationReason": null,
|
||||
"stopRequested": false,
|
||||
"tokenRevoked": true,
|
||||
"pid": 1239105,
|
||||
"stderrPreview": ""
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"conversationId":"ca0da1e9-a3b4-46c1-a964-be1d1cb5db1e","branch":"测试成功","message":"已收到"}
|
||||
8
.ccweb/scripts/package.json
Normal file
8
.ccweb/scripts/package.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "ccweb-script-runtime",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@ccweb/session": "1.0.0"
|
||||
}
|
||||
}
|
||||
4
.ccweb/scripts/restart-smoke-20260826.js
Normal file
4
.ccweb/scripts/restart-smoke-20260826.js
Normal file
@@ -0,0 +1,4 @@
|
||||
import { getCurrentConversationId } from '@ccweb/session';
|
||||
|
||||
const conversationId = await getCurrentConversationId();
|
||||
console.log(JSON.stringify({ smoke: true, conversationId }));
|
||||
31
.ccweb/scripts/session-orchestration-e2e-20260826.js
Normal file
31
.ccweb/scripts/session-orchestration-e2e-20260826.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
createConversation,
|
||||
sendMessage,
|
||||
selectSemanticBranch,
|
||||
} from '@ccweb/session';
|
||||
|
||||
const conversationId = await createConversation(
|
||||
'这是 JavaScript 会话编排端到端测试。请只回复:测试成功'
|
||||
);
|
||||
|
||||
const branch = await selectSemanticBranch(conversationId, [
|
||||
'测试成功',
|
||||
'测试失败',
|
||||
]);
|
||||
|
||||
if (branch !== '测试成功') {
|
||||
const error = new Error(`语义分支未命中测试成功:${branch}`);
|
||||
error.code = 'unexpected_semantic_branch';
|
||||
throw error;
|
||||
}
|
||||
|
||||
const message = await sendMessage(
|
||||
conversationId,
|
||||
'收到。请只回复:已收到'
|
||||
);
|
||||
|
||||
console.log(JSON.stringify({
|
||||
conversationId,
|
||||
branch,
|
||||
message,
|
||||
}));
|
||||
Reference in New Issue
Block a user