@adminforth/agent 2.0.9 → 2.1.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 +333 -10
- package/dist/application/ports.d.ts +66 -0
- package/dist/application/runTurnUseCase.d.ts +68 -0
- package/dist/application/runTurnUseCase.js +358 -0
- package/dist/{agentEvents.d.ts → domain/agentEvents.d.ts} +1 -1
- package/dist/{agent → domain}/systemPrompt.js +1 -1
- package/dist/{agent/turn → domain}/turnTypes.d.ts +41 -37
- package/dist/{agent/turn/VegaLiteStreamBuffer.d.ts → domain/vegaLiteStreamBuffer.d.ts} +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +40 -35
- package/dist/{agent/runtime/AgentContext.d.ts → llm/agentContext.d.ts} +3 -3
- package/dist/{agent/simpleAgent.d.ts → llm/agentModels.d.ts} +18 -16
- package/dist/llm/agentModels.js +65 -0
- package/dist/{agent/runtime/AgentRuntime.d.ts → llm/agentRuntime.d.ts} +11 -2
- package/dist/{agent/runtime/AgentRuntime.js → llm/agentRuntime.js} +38 -6
- package/dist/llm/langGraphLlm.d.ts +25 -0
- package/dist/llm/langGraphLlm.js +54 -0
- package/dist/{agent/middleware/apiBasedTools.d.ts → llm/middleware/apiToolsMiddleware.d.ts} +1 -1
- package/dist/{agent/middleware/apiBasedTools.js → llm/middleware/apiToolsMiddleware.js} +8 -14
- package/dist/{agent → llm}/middleware/sequenceDebug.d.ts +1 -1
- package/dist/{agent/models/AgentModelFactory.d.ts → llm/modelFactory.d.ts} +1 -1
- package/dist/{agent/models/AgentModelFactory.js → llm/modelFactory.js} +1 -1
- package/dist/llm/streamAdapter.d.ts +18 -0
- package/dist/llm/streamAdapter.js +117 -0
- package/dist/{sessionStore.d.ts → persistence/sessionStore.d.ts} +12 -2
- package/dist/{sessionStore.js → persistence/sessionStore.js} +33 -0
- package/dist/{agent/tools/AgentToolProvider.d.ts → tools/agentToolProvider.d.ts} +1 -1
- package/dist/{agent/tools/AgentToolProvider.js → tools/agentToolProvider.js} +1 -1
- package/dist/{apiBasedTools.js → tools/apiBasedTools.js} +10 -6
- package/dist/{agent/tools → tools}/apiTool.d.ts +1 -1
- package/dist/{agent/tools → tools}/fetchSkill.js +1 -1
- package/dist/{agent/tools → tools}/fetchToolSchema.d.ts +1 -1
- package/dist/{agent/tools → tools}/index.d.ts +1 -1
- package/dist/{agent/tools → tools}/navigateUser.d.ts +3 -3
- package/dist/{endpoints → transport/http}/context.d.ts +2 -2
- package/dist/transport/http/context.js +1 -0
- package/dist/{endpoints/core.js → transport/http/coreEndpoints.js} +3 -3
- package/dist/{endpoints/sessions.js → transport/http/sessionEndpoints.js} +7 -1
- package/dist/transport/sse/sseWriter.d.ts +29 -0
- package/dist/{surfaces/web-sse/createSseEventEmitter.js → transport/sse/sseWriter.js} +15 -0
- package/dist/{chatSurfaceService.d.ts → transport/surfaces/chatSurfaceService.d.ts} +3 -3
- package/dist/{chatSurfaceService.js → transport/surfaces/chatSurfaceService.js} +7 -5
- package/dist/{agent/speech/SpeechTurnService.d.ts → transport/surfaces/speechTurnService.d.ts} +1 -1
- package/dist/{agent/speech/SpeechTurnService.js → transport/surfaces/speechTurnService.js} +2 -2
- package/dist/types.d.ts +10 -4
- package/package.json +11 -2
- package/.woodpecker/buildRelease.sh +0 -13
- package/.woodpecker/buildSlackNotify.sh +0 -46
- package/.woodpecker/release.yml +0 -57
- package/agent/checkpointer.ts +0 -329
- package/agent/languageDetect.ts +0 -92
- package/agent/middleware/apiBasedTools.ts +0 -174
- package/agent/middleware/openAiResponsesContinuation.ts +0 -92
- package/agent/middleware/sequenceDebug.ts +0 -429
- package/agent/models/AgentModeResolver.ts +0 -9
- package/agent/models/AgentModelFactory.ts +0 -28
- package/agent/runtime/AgentContext.ts +0 -30
- package/agent/runtime/AgentRuntime.ts +0 -89
- package/agent/simpleAgent.ts +0 -199
- package/agent/skills/registry.ts +0 -162
- package/agent/speech/SpeechTurnService.ts +0 -179
- package/agent/systemPrompt.ts +0 -133
- package/agent/toolCallEvents.ts +0 -135
- package/agent/tools/AgentToolProvider.ts +0 -28
- package/agent/tools/apiTool.ts +0 -66
- package/agent/tools/fetchSkill.ts +0 -68
- package/agent/tools/fetchToolSchema.ts +0 -47
- package/agent/tools/getUserLocation.ts +0 -45
- package/agent/tools/index.ts +0 -31
- package/agent/tools/navigateUser.ts +0 -210
- package/agent/turn/TurnContextBuilder.ts +0 -36
- package/agent/turn/TurnLifecycleService.ts +0 -47
- package/agent/turn/TurnPersistenceService.ts +0 -33
- package/agent/turn/TurnPromptBuilder.ts +0 -51
- package/agent/turn/TurnStreamConsumer.ts +0 -69
- package/agent/turn/VegaLiteStreamBuffer.ts +0 -90
- package/agent/turn/turnTypes.ts +0 -100
- package/agentEvents.ts +0 -75
- package/agentTurnService.ts +0 -314
- package/apiBasedTools.ts +0 -702
- package/build.log +0 -67
- package/chatSurfaceService.ts +0 -319
- package/custom/ChatFooter.vue +0 -173
- package/custom/ChatHeader.vue +0 -78
- package/custom/ChatSurface.vue +0 -160
- package/custom/CustomAutoScrollContainer.vue +0 -164
- package/custom/SessionsHistory.vue +0 -88
- package/custom/chat.ts +0 -82
- package/custom/composables/agentAudio/utils.ts +0 -220
- package/custom/composables/agentStore/constants.ts +0 -19
- package/custom/composables/agentStore/pageContext.ts +0 -8
- package/custom/composables/agentStore/useAgentChat.ts +0 -241
- package/custom/composables/agentStore/useAgentPlaceholder.ts +0 -142
- package/custom/composables/agentStore/useAgentSessions.ts +0 -350
- package/custom/composables/useAgentAudio.ts +0 -272
- package/custom/composables/useAgentStore.ts +0 -510
- package/custom/composables/useAgentTransitions.ts +0 -58
- package/custom/conversation_area/ConversationArea.vue +0 -301
- package/custom/conversation_area/MessageRenderer.vue +0 -49
- package/custom/conversation_area/ProcessingTimeline.vue +0 -286
- package/custom/conversation_area/ReasoningRenderer.vue +0 -79
- package/custom/conversation_area/SystemMessageRenderer.vue +0 -28
- package/custom/conversation_area/TextRenderer.vue +0 -182
- package/custom/conversation_area/ThreeDotsAnimation.vue +0 -35
- package/custom/conversation_area/ToolApprovalRenderer.vue +0 -98
- package/custom/conversation_area/ToolRenderer.vue +0 -178
- package/custom/conversation_area/ToolsGroup.vue +0 -59
- package/custom/env.d.ts +0 -7
- package/custom/incremark_code_renderers/IncremarkShikiCodeBlock.vue +0 -393
- package/custom/incremark_code_renderers/incremarkCodeHighlight.ts +0 -285
- package/custom/incremark_code_renderers/incremarkRenderer.ts +0 -653
- package/custom/incremark_code_renderers/renderIncremarkMarkdown.ts +0 -118
- package/custom/package.json +0 -30
- package/custom/pnpm-lock.yaml +0 -2394
- package/custom/public/agentAudio/agent-processing.mp3 +0 -0
- package/custom/skills/analyze_data/SKILL.md +0 -25
- package/custom/skills/charts/SKILL.md +0 -193
- package/custom/skills/fetch_data/SKILL.md +0 -31
- package/custom/skills/mutate_data/SKILL.md +0 -121
- package/custom/speech_recognition_frontend/AudioLines.vue +0 -43
- package/custom/speech_recognition_frontend/MicrophoneButon.vue +0 -185
- package/custom/speech_recognition_frontend/types/voice-activity-detection.d.ts +0 -22
- package/custom/speech_recognition_frontend/voiceActivityDetection.ts +0 -62
- package/custom/tsconfig.json +0 -15
- package/custom/types.ts +0 -108
- package/custom/utils.ts +0 -38
- package/dist/agent/middleware/openAiResponsesContinuation.d.ts +0 -1
- package/dist/agent/middleware/openAiResponsesContinuation.js +0 -66
- package/dist/agent/models/AgentModeResolver.d.ts +0 -9
- package/dist/agent/models/AgentModeResolver.js +0 -9
- package/dist/agent/simpleAgent.js +0 -118
- package/dist/agent/turn/TurnContextBuilder.d.ts +0 -14
- package/dist/agent/turn/TurnContextBuilder.js +0 -31
- package/dist/agent/turn/TurnLifecycleService.d.ts +0 -24
- package/dist/agent/turn/TurnLifecycleService.js +0 -47
- package/dist/agent/turn/TurnPersistenceService.d.ts +0 -13
- package/dist/agent/turn/TurnPersistenceService.js +0 -35
- package/dist/agent/turn/TurnPromptBuilder.d.ts +0 -19
- package/dist/agent/turn/TurnPromptBuilder.js +0 -43
- package/dist/agent/turn/TurnStreamConsumer.d.ts +0 -11
- package/dist/agent/turn/TurnStreamConsumer.js +0 -84
- package/dist/agentTurnService.d.ts +0 -24
- package/dist/agentTurnService.js +0 -269
- package/dist/surfaces/web-sse/createSseEventEmitter.d.ts +0 -14
- package/endpoints/chatSurfaces.ts +0 -66
- package/endpoints/context.ts +0 -52
- package/endpoints/core.ts +0 -181
- package/endpoints/sessions.ts +0 -183
- package/errors.ts +0 -10
- package/index.ts +0 -192
- package/pnpm-workspace.yaml +0 -4
- package/sanitizeSpeechText.ts +0 -32
- package/sessionStore.ts +0 -105
- package/surfaces/web-sse/createSseEventEmitter.ts +0 -311
- package/tsconfig.json +0 -14
- package/types.ts +0 -127
- /package/dist/{agent/turn/turnTypes.js → application/ports.js} +0 -0
- /package/dist/{agentEvents.js → domain/agentEvents.js} +0 -0
- /package/dist/{agent → domain}/languageDetect.d.ts +0 -0
- /package/dist/{agent → domain}/languageDetect.js +0 -0
- /package/dist/{agent → domain}/systemPrompt.d.ts +0 -0
- /package/dist/{agent → domain}/toolCallEvents.d.ts +0 -0
- /package/dist/{agent → domain}/toolCallEvents.js +0 -0
- /package/dist/{endpoints/context.js → domain/turnTypes.js} +0 -0
- /package/dist/{agent/turn/VegaLiteStreamBuffer.js → domain/vegaLiteStreamBuffer.js} +0 -0
- /package/dist/{agent/runtime/AgentContext.js → llm/agentContext.js} +0 -0
- /package/dist/{agent → llm}/middleware/sequenceDebug.js +0 -0
- /package/dist/{agent/checkpointer.d.ts → persistence/checkpointStore.d.ts} +0 -0
- /package/dist/{agent/checkpointer.js → persistence/checkpointStore.js} +0 -0
- /package/dist/{errors.d.ts → shared/errors.d.ts} +0 -0
- /package/dist/{errors.js → shared/errors.js} +0 -0
- /package/dist/{sanitizeSpeechText.d.ts → shared/sanitizeSpeechText.d.ts} +0 -0
- /package/dist/{sanitizeSpeechText.js → shared/sanitizeSpeechText.js} +0 -0
- /package/dist/{apiBasedTools.d.ts → tools/apiBasedTools.d.ts} +0 -0
- /package/dist/{agent/tools → tools}/apiTool.js +0 -0
- /package/dist/{agent/tools → tools}/fetchSkill.d.ts +0 -0
- /package/dist/{agent/tools → tools}/fetchToolSchema.js +0 -0
- /package/dist/{agent/tools → tools}/getUserLocation.d.ts +0 -0
- /package/dist/{agent/tools → tools}/getUserLocation.js +0 -0
- /package/dist/{agent/tools → tools}/index.js +0 -0
- /package/dist/{agent/tools → tools}/navigateUser.js +0 -0
- /package/dist/{agent → tools}/skills/registry.d.ts +0 -0
- /package/dist/{agent → tools}/skills/registry.js +0 -0
- /package/dist/{endpoints/chatSurfaces.d.ts → transport/http/chatSurfaceEndpoints.d.ts} +0 -0
- /package/dist/{endpoints/chatSurfaces.js → transport/http/chatSurfaceEndpoints.js} +0 -0
- /package/dist/{endpoints/core.d.ts → transport/http/coreEndpoints.d.ts} +0 -0
- /package/dist/{endpoints/sessions.d.ts → transport/http/sessionEndpoints.d.ts} +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { createIncremarkParser, type IncremarkParserOptions } from '@incremark/core';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
highlightCodeSnippetHtml,
|
|
5
|
-
type IncremarkCodeTheme
|
|
6
|
-
} from './incremarkCodeHighlight';
|
|
7
|
-
import { renderIncremarkAst, renderKatexIncremarkHtml } from './incremarkRenderer';
|
|
8
|
-
|
|
9
|
-
const INCREMARK_PARSER_OPTIONS = {
|
|
10
|
-
gfm: true,
|
|
11
|
-
math: { tex: true },
|
|
12
|
-
containers: true,
|
|
13
|
-
htmlTree: true
|
|
14
|
-
} satisfies IncremarkParserOptions;
|
|
15
|
-
|
|
16
|
-
const INCREMARK_CODE_BLOCK_PATTERN =
|
|
17
|
-
/(<div class="incremark-block incremark-code"><div class="incremark-code-toolbar">[\s\S]*?<\/div>)<pre><code(?: class="language-([^"]+)")?>([\s\S]*?)<\/code><\/pre><\/div>/g;
|
|
18
|
-
const HTML_ENTITY_RE = /&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g;
|
|
19
|
-
|
|
20
|
-
const NAMED_HTML_ENTITIES: Record<string, string> = {
|
|
21
|
-
amp: '&',
|
|
22
|
-
apos: "'",
|
|
23
|
-
gt: '>',
|
|
24
|
-
lt: '<',
|
|
25
|
-
quot: '"'
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export async function renderIncremarkMarkdown(
|
|
29
|
-
markdown: string,
|
|
30
|
-
theme: IncremarkCodeTheme = 'dark'
|
|
31
|
-
): Promise<string> {
|
|
32
|
-
const parser = createIncremarkParser(INCREMARK_PARSER_OPTIONS);
|
|
33
|
-
|
|
34
|
-
if (markdown) {
|
|
35
|
-
parser.append(markdown);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
parser.finalize();
|
|
39
|
-
|
|
40
|
-
const baseHtml = renderIncremarkAst(parser.getAst());
|
|
41
|
-
const mathHtml = await renderKatexIncremarkHtml(baseHtml);
|
|
42
|
-
return highlightRenderedIncremarkHtmlServer(mathHtml, theme);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function highlightRenderedIncremarkHtmlServer(
|
|
46
|
-
html: string,
|
|
47
|
-
theme: IncremarkCodeTheme
|
|
48
|
-
): Promise<string> {
|
|
49
|
-
if (!html.includes('incremark-code')) {
|
|
50
|
-
return html;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return replaceAsync(html, INCREMARK_CODE_BLOCK_PATTERN, async (_match, prefix, language, code) => {
|
|
54
|
-
const highlightedHtml = await highlightCodeSnippetHtml(
|
|
55
|
-
decodeHtmlEntities(code),
|
|
56
|
-
language ?? 'text',
|
|
57
|
-
theme
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return `${prefix}${addClassToPreTag(highlightedHtml, 'incremark-code-highlight')}</div>`;
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function replaceAsync(
|
|
65
|
-
value: string,
|
|
66
|
-
pattern: RegExp,
|
|
67
|
-
replacer: (...args: string[]) => Promise<string>
|
|
68
|
-
): Promise<string> {
|
|
69
|
-
pattern.lastIndex = 0;
|
|
70
|
-
const matches = Array.from(value.matchAll(pattern));
|
|
71
|
-
if (matches.length === 0) {
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const replacements = await Promise.all(matches.map((match) => replacer(...match)));
|
|
76
|
-
|
|
77
|
-
let cursor = 0;
|
|
78
|
-
let result = '';
|
|
79
|
-
|
|
80
|
-
for (const [index, match] of matches.entries()) {
|
|
81
|
-
const fullMatch = match[0];
|
|
82
|
-
const matchIndex = match.index ?? 0;
|
|
83
|
-
result += value.slice(cursor, matchIndex);
|
|
84
|
-
result += replacements[index];
|
|
85
|
-
cursor = matchIndex + fullMatch.length;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
result += value.slice(cursor);
|
|
89
|
-
return result;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function addClassToPreTag(html: string, className: string): string {
|
|
93
|
-
if (html.startsWith('<pre class="')) {
|
|
94
|
-
return html.replace('<pre class="', `<pre class="${className} `);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (html.startsWith('<pre ')) {
|
|
98
|
-
return html.replace('<pre ', `<pre class="${className}" `);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return html.replace('<pre>', `<pre class="${className}">`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function decodeHtmlEntities(value: string): string {
|
|
105
|
-
return value.replace(HTML_ENTITY_RE, (match, entity) => {
|
|
106
|
-
if (entity.startsWith('#x') || entity.startsWith('#X')) {
|
|
107
|
-
const codePoint = Number.parseInt(entity.slice(2), 16);
|
|
108
|
-
return Number.isNaN(codePoint) ? match : String.fromCodePoint(codePoint);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (entity.startsWith('#')) {
|
|
112
|
-
const codePoint = Number.parseInt(entity.slice(1), 10);
|
|
113
|
-
return Number.isNaN(codePoint) ? match : String.fromCodePoint(codePoint);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return NAMED_HTML_ENTITIES[entity] ?? match;
|
|
117
|
-
});
|
|
118
|
-
}
|
package/custom/package.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "custom",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"keywords": [],
|
|
10
|
-
"author": "DevForth (https://devforth.io)",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"packageManager": "pnpm@10.33.0",
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@incremark/core": "^1.0.2",
|
|
15
|
-
"@incremark/theme": "^1.0.2",
|
|
16
|
-
"@incremark/vue": "^1.0.2",
|
|
17
|
-
"@ricky0123/vad-web": "^0.0.30",
|
|
18
|
-
"@shikijs/langs": "^4.0.2",
|
|
19
|
-
"@shikijs/themes": "^4.0.2",
|
|
20
|
-
"@vueuse/core": "^14.2.1",
|
|
21
|
-
"ai": "^6.0.168",
|
|
22
|
-
"custom-vue-scrollbar": "^0.0.8",
|
|
23
|
-
"dompurify": "^3.3.3",
|
|
24
|
-
"katex": "^0.16.45",
|
|
25
|
-
"marked": "^18.0.0",
|
|
26
|
-
"shiki": "^4.0.2",
|
|
27
|
-
"vega-embed": "^7.1.0",
|
|
28
|
-
"voice-activity-detection": "^0.0.5"
|
|
29
|
-
}
|
|
30
|
-
}
|