@ixo/oracle-runtime-workers 0.9.0 → 0.11.0
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/README.md +5 -2
- package/package.json +1 -1
- package/src/core/context-budget.ts +201 -0
- package/src/core/context-window.ts +289 -0
- package/src/core/env.ts +38 -0
- package/src/core/main-agent-types.ts +46 -0
- package/src/core/main-agent.ts +86 -9
- package/src/core/middlewares/context-guard.ts +270 -0
- package/src/core/middlewares/result-cap.ts +180 -0
- package/src/core/middlewares/summarization.ts +87 -6
- package/src/core/middlewares/tool-marks.ts +209 -0
- package/src/core/openrouter-pricing.ts +42 -1
- package/src/core/read-result-tool.ts +77 -0
- package/src/core/runtime-context.ts +7 -0
- package/src/core/sub-agent-fallback.ts +20 -3
- package/src/core/wrap-plugin-tool.ts +24 -3
- package/src/do/ambient.ts +17 -0
- package/src/do/contracts.ts +249 -0
- package/src/do/result-store-test-do.ts +88 -0
- package/src/do/result-store.ts +339 -0
- package/src/do/run-buffer.ts +204 -0
- package/src/do/run-coordinator.ts +572 -0
- package/src/do/run-request.ts +52 -0
- package/src/do/run-store-test-do.ts +130 -0
- package/src/do/run-store.ts +604 -0
- package/src/do/session-id-migration.ts +85 -0
- package/src/do/speaker-prefix.ts +37 -0
- package/src/do/sse-stream.ts +567 -400
- package/src/do/transcript.ts +238 -0
- package/src/do/turn-body.ts +10 -0
- package/src/do/user-oracle-do.ts +1019 -169
- package/src/matrix/gateway-do.ts +230 -29
- package/src/matrix/group-chat-summarizer.ts +107 -0
- package/src/matrix/group-chat.ts +1163 -0
- package/src/matrix/inbox-store.ts +23 -3
- package/src/matrix/ingest.ts +54 -11
- package/src/matrix/reply-chain.ts +34 -25
- package/src/owner-store/ixo-vfs-store.ts +12 -5
- package/src/owner-store/matrix-media-store.ts +12 -7
- package/src/owner-store/measure.ts +39 -0
- package/src/owner-store/migrating-store.ts +9 -3
- package/src/owner-store/types.ts +14 -4
- package/src/plugin-api/tool-helper.ts +9 -1
- package/src/plugin-api/types.ts +86 -0
- package/src/plugins/index.ts +3 -0
- package/src/plugins/matrix-group-chats/README.md +70 -0
- package/src/plugins/matrix-group-chats/index.ts +132 -0
- package/src/plugins/matrix-group-chats/tools.ts +172 -0
- package/src/plugins/tasks/tasks-tools.ts +4 -0
- package/src/shell/app.ts +78 -0
- package/src/sqlite/cache-config.ts +27 -6
- package/src/sqlite/chunk-layout.ts +14 -0
- package/src/sqlite/database.ts +188 -19
- package/src/sqlite/do-vfs.ts +963 -99
- package/src/sqlite/index.ts +13 -0
- package/src/sqlite/page-tier.ts +668 -0
- package/src/sqlite/sqlite-saver.ts +81 -0
- package/src/tasks/scheduler.ts +134 -3
- package/src/tasks/store.ts +22 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's group-room speaker prefix (`MessagesService`): in a room with more
|
|
3
|
+
* than two members every user message the model sees starts with
|
|
4
|
+
* `[DisplayName]: ` so it knows who is speaking. Applied to the stored
|
|
5
|
+
* message, exactly as on Node; a message already carrying the prefix is left
|
|
6
|
+
* alone. Node only ever prefixed strings — the attachment pipeline's block
|
|
7
|
+
* content gets the prefix on its first text block, or a leading text block
|
|
8
|
+
* when there is none.
|
|
9
|
+
*/
|
|
10
|
+
import type { MessageContent } from '@langchain/core/messages';
|
|
11
|
+
|
|
12
|
+
export function speakerPrefix(displayName: string): string {
|
|
13
|
+
return `[${displayName}]: `;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function prefixSpeaker(
|
|
17
|
+
content: MessageContent,
|
|
18
|
+
displayName: string,
|
|
19
|
+
): MessageContent {
|
|
20
|
+
const prefix = speakerPrefix(displayName);
|
|
21
|
+
if (typeof content === 'string')
|
|
22
|
+
return content.startsWith(prefix) ? content : `${prefix}${content}`;
|
|
23
|
+
const index = content.findIndex(
|
|
24
|
+
(block) =>
|
|
25
|
+
typeof block === 'object' &&
|
|
26
|
+
block !== null &&
|
|
27
|
+
(block as { type?: unknown }).type === 'text' &&
|
|
28
|
+
typeof (block as { text?: unknown }).text === 'string',
|
|
29
|
+
);
|
|
30
|
+
if (index === -1)
|
|
31
|
+
return [{ type: 'text', text: prefix.trimEnd() }, ...content];
|
|
32
|
+
const block = content[index] as { type: 'text'; text: string };
|
|
33
|
+
if (block.text.startsWith(prefix)) return content;
|
|
34
|
+
const out = content.slice();
|
|
35
|
+
out[index] = { ...block, text: `${prefix}${block.text}` };
|
|
36
|
+
return out;
|
|
37
|
+
}
|