@siduri-x/api 1.0.2 → 1.0.5
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/app.d.ts +43 -0
- package/dist/app.js +637 -0
- package/dist/auth.d.ts +34 -0
- package/dist/auth.js +84 -0
- package/dist/auth.test.d.ts +1 -0
- package/dist/auth.test.js +74 -0
- package/dist/b0-b6.test.d.ts +1 -0
- package/dist/b0-b6.test.js +121 -0
- package/dist/context-mapper.d.ts +18 -0
- package/dist/context-mapper.js +160 -0
- package/dist/context-mapper.test.d.ts +1 -0
- package/dist/context-mapper.test.js +136 -0
- package/dist/cors.d.ts +3 -0
- package/dist/cors.js +42 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +191 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +137 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +17 -0
- package/dist/runtime.test.d.ts +1 -0
- package/dist/runtime.test.js +282 -0
- package/dist/smoke.test.d.ts +0 -0
- package/dist/smoke.test.js +6 -0
- package/dist/t4-gating.test.d.ts +1 -0
- package/dist/t4-gating.test.js +193 -0
- package/dist/t5-experience.test.d.ts +1 -0
- package/dist/t5-experience.test.js +155 -0
- package/dist/t6-security.test.d.ts +1 -0
- package/dist/t6-security.test.js +423 -0
- package/dist/t7-release.test.d.ts +1 -0
- package/dist/t7-release.test.js +119 -0
- package/package.json +14 -11
- package/src/app.ts +36 -64
- package/src/auth.test.ts +56 -23
- package/src/auth.ts +74 -22
- package/src/context-mapper.test.ts +42 -147
- package/src/context-mapper.ts +44 -179
- package/src/index.test.ts +8 -32
- package/src/index.ts +19 -3
- package/src/runtime.test.ts +3 -5
- package/src/t5-experience.test.ts +0 -1
- package/src/t6-security.test.ts +0 -1
package/dist/cors.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllowedOrigins = getAllowedOrigins;
|
|
4
|
+
exports.createCorsOptions = createCorsOptions;
|
|
5
|
+
function getAllowedOrigins() {
|
|
6
|
+
const allowed = new Set([
|
|
7
|
+
'http://localhost:3000',
|
|
8
|
+
'http://127.0.0.1:3000',
|
|
9
|
+
'http://localhost:3001',
|
|
10
|
+
'http://127.0.0.1:3001',
|
|
11
|
+
]);
|
|
12
|
+
if (process.env.PORT) {
|
|
13
|
+
allowed.add(`http://localhost:${process.env.PORT}`);
|
|
14
|
+
allowed.add(`http://127.0.0.1:${process.env.PORT}`);
|
|
15
|
+
}
|
|
16
|
+
const envOrigins = process.env.ALLOWED_ORIGINS;
|
|
17
|
+
if (envOrigins) {
|
|
18
|
+
for (const origin of envOrigins.split(',')) {
|
|
19
|
+
const trimmed = origin.trim();
|
|
20
|
+
if (trimmed) {
|
|
21
|
+
allowed.add(trimmed);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return allowed;
|
|
26
|
+
}
|
|
27
|
+
function createCorsOptions() {
|
|
28
|
+
return {
|
|
29
|
+
origin: (origin, callback) => {
|
|
30
|
+
// Allow non-browser requests with no origin header (e.g., native tools, curl)
|
|
31
|
+
if (!origin) {
|
|
32
|
+
return callback(null, true);
|
|
33
|
+
}
|
|
34
|
+
const allowedOrigins = getAllowedOrigins();
|
|
35
|
+
if (allowedOrigins.has(origin)) {
|
|
36
|
+
return callback(null, true);
|
|
37
|
+
}
|
|
38
|
+
return callback(null, false);
|
|
39
|
+
},
|
|
40
|
+
credentials: true,
|
|
41
|
+
};
|
|
42
|
+
}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.app = exports.createApp = void 0;
|
|
21
|
+
const promises_1 = require("node:fs/promises");
|
|
22
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
23
|
+
const app_1 = require("./app");
|
|
24
|
+
Object.defineProperty(exports, "createApp", { enumerable: true, get: function () { return app_1.createApp; } });
|
|
25
|
+
const runtime_1 = require("./runtime");
|
|
26
|
+
const brain_1 = require("@siduri-x/brain");
|
|
27
|
+
const memory_1 = require("@siduri-x/memory");
|
|
28
|
+
const voice_1 = require("@siduri-x/voice");
|
|
29
|
+
const knowledge_1 = require("@siduri-x/knowledge");
|
|
30
|
+
const vision_1 = require("@siduri-x/vision");
|
|
31
|
+
const behavior_1 = require("@siduri-x/behavior");
|
|
32
|
+
const body_1 = require("@siduri-x/body");
|
|
33
|
+
const observation_1 = require("@siduri-x/observation");
|
|
34
|
+
__exportStar(require("./context-mapper"), exports);
|
|
35
|
+
const runtimes = new Map();
|
|
36
|
+
const instance = (0, app_1.createApp)(runtimes);
|
|
37
|
+
exports.app = instance.app;
|
|
38
|
+
exports.default = exports.app;
|
|
39
|
+
function createBrain(config) {
|
|
40
|
+
const provider = config?.provider || 'openrouter';
|
|
41
|
+
const defaultKeyEnv = provider === 'openai-compatible' ? 'OPENAI_COMPATIBLE_API_KEY' : 'OPENROUTER_API_KEY';
|
|
42
|
+
const apiKey = config?.apiKey || process.env[config?.apiKeyEnv || defaultKeyEnv] || '';
|
|
43
|
+
if (provider === 'openai-compatible') {
|
|
44
|
+
return new brain_1.OpenAICompatibleBrain({
|
|
45
|
+
apiKey,
|
|
46
|
+
model: config?.model || 'local-model',
|
|
47
|
+
baseUrl: config?.baseUrl || 'http://127.0.0.1:1234/v1',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return new brain_1.OpenRouterBrain({ apiKey, model: config?.model || 'gpt-4o-mini' });
|
|
51
|
+
}
|
|
52
|
+
function isDisabled(config) {
|
|
53
|
+
return !config || config.provider === 'none';
|
|
54
|
+
}
|
|
55
|
+
function createVoice(config) {
|
|
56
|
+
return isDisabled(config)
|
|
57
|
+
? undefined
|
|
58
|
+
: new voice_1.VoiceAdapter({
|
|
59
|
+
provider: config?.provider || 'voicevox',
|
|
60
|
+
baseUrl: config?.baseUrl || process.env.VOICEVOX_URL || 'http://localhost:50021',
|
|
61
|
+
speakerId: config?.speakerId || 1,
|
|
62
|
+
...config,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function createKnowledge(config) {
|
|
66
|
+
if (isDisabled(config))
|
|
67
|
+
return undefined;
|
|
68
|
+
if (!config?.packPath && !config?.registryUrl && !config?.baseUrl) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return new knowledge_1.EKnowledgeAdapter(config || {});
|
|
72
|
+
}
|
|
73
|
+
function createVision(config) {
|
|
74
|
+
return isDisabled(config)
|
|
75
|
+
? undefined
|
|
76
|
+
: new vision_1.OpenRouterVisionAdapter({
|
|
77
|
+
apiKey: config?.apiKey || process.env.OPENROUTER_API_KEY || '',
|
|
78
|
+
model: config?.model || 'gpt-4-vision',
|
|
79
|
+
...config,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function createBehavior(config) {
|
|
83
|
+
return isDisabled(config) ? undefined : new behavior_1.ActiveSelfCompiler();
|
|
84
|
+
}
|
|
85
|
+
function createBody(config) {
|
|
86
|
+
return isDisabled(config)
|
|
87
|
+
? undefined
|
|
88
|
+
: new body_1.Live2DAdapter(config);
|
|
89
|
+
}
|
|
90
|
+
function createMemory(config) {
|
|
91
|
+
if (isDisabled(config))
|
|
92
|
+
return undefined;
|
|
93
|
+
const provider = config?.provider || 'postgres';
|
|
94
|
+
if (provider === 'in-memory') {
|
|
95
|
+
return new memory_1.InMemoryMemoryOrgan();
|
|
96
|
+
}
|
|
97
|
+
if (provider === 'postgres') {
|
|
98
|
+
const connectionString = config?.connectionString || process.env.DATABASE_URL || 'postgresql://postgres:postgres@localhost:5432/siduri';
|
|
99
|
+
return new memory_1.PostgresMemoryOrgan({ connectionString, maxConnections: config?.maxConnections });
|
|
100
|
+
}
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
const PORT = process.env.PORT || 3001;
|
|
104
|
+
const defaultCompanionConfig = {
|
|
105
|
+
id: 'default',
|
|
106
|
+
name: 'Siduri',
|
|
107
|
+
brain: { provider: 'openrouter', model: 'gpt-4o-mini' },
|
|
108
|
+
voice: { provider: 'voicevox', speakerId: 1 },
|
|
109
|
+
memory: { provider: 'postgres' },
|
|
110
|
+
knowledge: {
|
|
111
|
+
provider: process.env.SIDURI_KNOWLEDGE_PROVIDER || 'e-knowledge',
|
|
112
|
+
packPath: process.env.SIDURI_KNOWLEDGE_PACK || '',
|
|
113
|
+
registryUrl: process.env.SIDURI_KNOWLEDGE_REGISTRY_URL || '',
|
|
114
|
+
packId: process.env.SIDURI_KNOWLEDGE_PACK_ID || '',
|
|
115
|
+
timeoutMs: Number(process.env.SIDURI_KNOWLEDGE_TIMEOUT_MS || 5000),
|
|
116
|
+
preferredMode: process.env.SIDURI_KNOWLEDGE_MODE || 'lexical',
|
|
117
|
+
},
|
|
118
|
+
behavior: { provider: 'active_self' },
|
|
119
|
+
body: {
|
|
120
|
+
provider: 'live2d',
|
|
121
|
+
},
|
|
122
|
+
vision: { provider: 'openrouter', model: 'gpt-4-vision' }
|
|
123
|
+
};
|
|
124
|
+
async function loadCompanionConfig() {
|
|
125
|
+
const configPath = process.env.SIDURI_CONFIG || node_path_1.default.resolve(process.cwd(), 'siduri.config.json');
|
|
126
|
+
let fileConfig = {};
|
|
127
|
+
try {
|
|
128
|
+
fileConfig = JSON.parse(await (0, promises_1.readFile)(configPath, 'utf8'));
|
|
129
|
+
console.log(`Loaded companion configuration from ${configPath}`);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (error?.code !== 'ENOENT')
|
|
133
|
+
throw new Error(`Unable to read ${configPath}: ${error.message}`);
|
|
134
|
+
console.log(`No ${configPath} found; using environment/default configuration.`);
|
|
135
|
+
}
|
|
136
|
+
const config = {
|
|
137
|
+
...defaultCompanionConfig,
|
|
138
|
+
...fileConfig,
|
|
139
|
+
id: fileConfig.id || defaultCompanionConfig.id,
|
|
140
|
+
brain: { ...defaultCompanionConfig.brain, ...fileConfig.brain },
|
|
141
|
+
voice: { ...defaultCompanionConfig.voice, ...fileConfig.voice },
|
|
142
|
+
memory: { ...defaultCompanionConfig.memory, ...fileConfig.memory },
|
|
143
|
+
knowledge: { ...defaultCompanionConfig.knowledge, ...fileConfig.knowledge },
|
|
144
|
+
behavior: { ...defaultCompanionConfig.behavior, ...fileConfig.behavior },
|
|
145
|
+
body: { ...defaultCompanionConfig.body, ...fileConfig.body },
|
|
146
|
+
vision: { ...defaultCompanionConfig.vision, ...fileConfig.vision },
|
|
147
|
+
};
|
|
148
|
+
if (process.env.SIDURI_KNOWLEDGE_PROVIDER)
|
|
149
|
+
config.knowledge.provider = process.env.SIDURI_KNOWLEDGE_PROVIDER;
|
|
150
|
+
if (process.env.SIDURI_KNOWLEDGE_PACK)
|
|
151
|
+
config.knowledge.packPath = process.env.SIDURI_KNOWLEDGE_PACK;
|
|
152
|
+
if (process.env.SIDURI_KNOWLEDGE_REGISTRY_URL)
|
|
153
|
+
config.knowledge.registryUrl = process.env.SIDURI_KNOWLEDGE_REGISTRY_URL;
|
|
154
|
+
if (process.env.SIDURI_KNOWLEDGE_PACK_ID)
|
|
155
|
+
config.knowledge.packId = process.env.SIDURI_KNOWLEDGE_PACK_ID;
|
|
156
|
+
if (process.env.SIDURI_KNOWLEDGE_MODE)
|
|
157
|
+
config.knowledge.preferredMode = process.env.SIDURI_KNOWLEDGE_MODE;
|
|
158
|
+
return config;
|
|
159
|
+
}
|
|
160
|
+
async function bootDefaultCompanion() {
|
|
161
|
+
if (runtimes.has('default'))
|
|
162
|
+
return;
|
|
163
|
+
console.log("Booting default companion...");
|
|
164
|
+
const config = await loadCompanionConfig();
|
|
165
|
+
const brain = createBrain(config.brain);
|
|
166
|
+
const memory = createMemory(config.memory);
|
|
167
|
+
const voice = createVoice(config.voice);
|
|
168
|
+
const knowledge = createKnowledge(config.knowledge);
|
|
169
|
+
const vision = createVision(config.vision);
|
|
170
|
+
const observation = new observation_1.FixtureObservationOrgan(vision ?? { analyze: async () => JSON.stringify({ readings: [] }) });
|
|
171
|
+
instance.setObservationOrgan(observation);
|
|
172
|
+
const behavior = createBehavior(config.behavior);
|
|
173
|
+
const body = createBody(config.body);
|
|
174
|
+
if (memory && typeof memory.runMigrations === 'function') {
|
|
175
|
+
await memory.runMigrations().catch((e) => console.warn("Migrations warning:", e.message));
|
|
176
|
+
}
|
|
177
|
+
const runtime = new runtime_1.SiduriRuntime('default', config, { brain, memory, voice, knowledge, vision, behavior, body });
|
|
178
|
+
await runtime.initialize();
|
|
179
|
+
runtimes.set('default', runtime);
|
|
180
|
+
console.log("Default companion booted successfully.");
|
|
181
|
+
}
|
|
182
|
+
if (process.env.NODE_ENV !== 'test') {
|
|
183
|
+
bootDefaultCompanion().then(() => {
|
|
184
|
+
exports.app.listen(Number(PORT), '127.0.0.1', () => {
|
|
185
|
+
console.log(`Siduri-X API running on port ${PORT} (127.0.0.1)`);
|
|
186
|
+
});
|
|
187
|
+
}).catch(e => {
|
|
188
|
+
console.error("Failed to boot default companion:", e);
|
|
189
|
+
process.exit(1);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const supertest_1 = __importDefault(require("supertest"));
|
|
7
|
+
const app_1 = require("./app");
|
|
8
|
+
describe('API Boundary Context Validation (P2 Route Integration)', () => {
|
|
9
|
+
const fakeRuntime = {
|
|
10
|
+
handleUserMessage: jest.fn().mockResolvedValue({
|
|
11
|
+
response: { subtitle_en: 'Hello there' },
|
|
12
|
+
metadata: {},
|
|
13
|
+
}),
|
|
14
|
+
};
|
|
15
|
+
let app;
|
|
16
|
+
let runtimes;
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
runtimes = new Map([['companion-a', fakeRuntime]]);
|
|
19
|
+
const created = (0, app_1.createApp)(runtimes);
|
|
20
|
+
app = created.app;
|
|
21
|
+
fakeRuntime.handleUserMessage.mockClear();
|
|
22
|
+
});
|
|
23
|
+
test('accepts valid anonymous chat request and maps through API boundary', async () => {
|
|
24
|
+
const res = await (0, supertest_1.default)(app)
|
|
25
|
+
.post('/chat')
|
|
26
|
+
.send({
|
|
27
|
+
id: 'companion-a',
|
|
28
|
+
message: 'Hello neutral world',
|
|
29
|
+
history: [],
|
|
30
|
+
});
|
|
31
|
+
expect(res.status).toBe(200);
|
|
32
|
+
expect(fakeRuntime.handleUserMessage).toHaveBeenCalledWith('Hello neutral world', expect.objectContaining({
|
|
33
|
+
companionId: 'companion-a',
|
|
34
|
+
conversation: expect.objectContaining({ channel: 'direct' }),
|
|
35
|
+
}), []);
|
|
36
|
+
});
|
|
37
|
+
test('accepts neutral context chat envelope at /chat route', async () => {
|
|
38
|
+
const res = await (0, supertest_1.default)(app)
|
|
39
|
+
.post('/chat')
|
|
40
|
+
.send({
|
|
41
|
+
companionId: 'companion-a',
|
|
42
|
+
context: {
|
|
43
|
+
actor: {
|
|
44
|
+
actorId: 'actor-a',
|
|
45
|
+
sessionId: 'session-a',
|
|
46
|
+
authorizationRole: 'viewer',
|
|
47
|
+
capabilities: ['chat:public'],
|
|
48
|
+
authenticated: false,
|
|
49
|
+
},
|
|
50
|
+
conversation: {
|
|
51
|
+
channel: 'public',
|
|
52
|
+
correlationId: 'corr-route-1',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
message: 'Hello structured context',
|
|
56
|
+
history: [],
|
|
57
|
+
});
|
|
58
|
+
expect(res.status).toBe(200);
|
|
59
|
+
expect(fakeRuntime.handleUserMessage).toHaveBeenCalledWith('Hello structured context', expect.objectContaining({
|
|
60
|
+
companionId: 'companion-a',
|
|
61
|
+
conversation: expect.objectContaining({ channel: 'public' }),
|
|
62
|
+
}), []);
|
|
63
|
+
});
|
|
64
|
+
test('rejects global primary_user subject with 400 and structured error', async () => {
|
|
65
|
+
const res = await (0, supertest_1.default)(app)
|
|
66
|
+
.post('/chat')
|
|
67
|
+
.send({
|
|
68
|
+
companionId: 'companion-a',
|
|
69
|
+
context: {
|
|
70
|
+
actor: {
|
|
71
|
+
actorId: 'actor-a',
|
|
72
|
+
sessionId: 'session-a',
|
|
73
|
+
authorizationRole: 'viewer',
|
|
74
|
+
capabilities: ['chat:public'],
|
|
75
|
+
authenticated: true,
|
|
76
|
+
},
|
|
77
|
+
conversation: {
|
|
78
|
+
channel: 'public',
|
|
79
|
+
correlationId: 'corr-err-2',
|
|
80
|
+
},
|
|
81
|
+
subject: {
|
|
82
|
+
subjectId: 'primary_user',
|
|
83
|
+
kind: 'actor',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
message: 'Forbidden primary user test',
|
|
87
|
+
});
|
|
88
|
+
expect(res.status).toBe(400);
|
|
89
|
+
expect(res.body.accepted).toBe(false);
|
|
90
|
+
expect(res.body.error.code).toBe('FORBIDDEN_CONTEXT');
|
|
91
|
+
expect(fakeRuntime.handleUserMessage).not.toHaveBeenCalled();
|
|
92
|
+
});
|
|
93
|
+
test('streams response chunks via POST /chat/stream', async () => {
|
|
94
|
+
fakeRuntime.mouth = {
|
|
95
|
+
stream: async function* () {
|
|
96
|
+
yield { utteranceId: 'utt-1', index: 1, deltaText: 'Hello', isComplete: false, medium: 'web' };
|
|
97
|
+
yield { utteranceId: 'utt-1', index: 2, deltaText: ' world', isComplete: false, medium: 'web' };
|
|
98
|
+
yield { utteranceId: 'utt-1', index: 3, deltaText: '', isComplete: true, medium: 'web' };
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
const res = await (0, supertest_1.default)(app)
|
|
102
|
+
.post('/chat/stream')
|
|
103
|
+
.send({
|
|
104
|
+
id: 'companion-a',
|
|
105
|
+
message: 'Stream me',
|
|
106
|
+
});
|
|
107
|
+
expect(res.status).toBe(200);
|
|
108
|
+
expect(res.headers['content-type']).toContain('text/event-stream');
|
|
109
|
+
expect(res.text).toContain('event: staged');
|
|
110
|
+
expect(res.text).toContain('event: chunk');
|
|
111
|
+
expect(res.text).toContain('event: done');
|
|
112
|
+
});
|
|
113
|
+
test('handles barge-in interruption via POST /chat/interrupt', async () => {
|
|
114
|
+
fakeRuntime.interruptMouth = jest.fn();
|
|
115
|
+
const res = await (0, supertest_1.default)(app)
|
|
116
|
+
.post('/chat/interrupt')
|
|
117
|
+
.send({
|
|
118
|
+
companionId: 'companion-a',
|
|
119
|
+
reason: 'user_stop',
|
|
120
|
+
});
|
|
121
|
+
expect(res.status).toBe(200);
|
|
122
|
+
expect(res.body.interrupted).toBe(true);
|
|
123
|
+
expect(fakeRuntime.interruptMouth).toHaveBeenCalledWith('user_stop');
|
|
124
|
+
});
|
|
125
|
+
test('handles mouth interruption via POST /mouth/interrupt', async () => {
|
|
126
|
+
fakeRuntime.interruptMouth = jest.fn();
|
|
127
|
+
const res = await (0, supertest_1.default)(app)
|
|
128
|
+
.post('/mouth/interrupt')
|
|
129
|
+
.send({
|
|
130
|
+
companionId: 'companion-a',
|
|
131
|
+
reason: 'user_barge_in',
|
|
132
|
+
});
|
|
133
|
+
expect(res.status).toBe(200);
|
|
134
|
+
expect(res.body.interrupted).toBe(true);
|
|
135
|
+
expect(fakeRuntime.interruptMouth).toHaveBeenCalledWith('user_barge_in');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@siduri-x/core';
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("@siduri-x/core"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|