@adminforth/agent 1.43.29 → 1.44.1

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.
Files changed (39) hide show
  1. package/agentEvents.ts +66 -0
  2. package/agentResponseEvents.ts +1 -206
  3. package/build.log +2 -2
  4. package/custom/conversation_area/ProcessingTimeline.vue +23 -2
  5. package/custom/incremark_code_renderers/IncremarkShikiCodeBlock.vue +2 -2
  6. package/custom/types.ts +5 -4
  7. package/dist/agent/checkpointer.d.ts +29 -0
  8. package/dist/agent/languageDetect.d.ts +10 -0
  9. package/dist/agent/middleware/apiBasedTools.d.ts +3 -0
  10. package/dist/agent/middleware/openAiResponsesContinuation.d.ts +1 -0
  11. package/dist/agent/middleware/sequenceDebug.d.ts +46 -0
  12. package/dist/agent/simpleAgent.d.ts +61 -0
  13. package/dist/agent/skills/registry.d.ts +13 -0
  14. package/dist/agent/systemPrompt.d.ts +11 -0
  15. package/dist/agent/toolCallEvents.d.ts +27 -0
  16. package/dist/agent/tools/apiTool.d.ts +6 -0
  17. package/dist/agent/tools/fetchSkill.d.ts +8 -0
  18. package/dist/agent/tools/fetchToolSchema.d.ts +9 -0
  19. package/dist/agent/tools/getUserLocation.d.ts +8 -0
  20. package/dist/agent/tools/index.d.ts +4 -0
  21. package/dist/agentEvents.d.ts +56 -0
  22. package/dist/agentEvents.js +1 -0
  23. package/dist/agentResponseEvents.d.ts +1 -0
  24. package/dist/agentResponseEvents.js +1 -144
  25. package/dist/apiBasedTools.d.ts +29 -0
  26. package/dist/custom/conversation_area/ProcessingTimeline.vue +23 -2
  27. package/dist/custom/incremark_code_renderers/IncremarkShikiCodeBlock.vue +2 -2
  28. package/dist/custom/types.ts +5 -4
  29. package/dist/index.d.ts +58 -0
  30. package/dist/index.js +280 -48
  31. package/dist/sanitizeSpeechText.d.ts +1 -0
  32. package/dist/surfaces/web-sse/createSseEventEmitter.d.ts +14 -0
  33. package/dist/surfaces/web-sse/createSseEventEmitter.js +211 -0
  34. package/dist/types.d.ts +94 -0
  35. package/index.ts +315 -46
  36. package/package.json +2 -2
  37. package/surfaces/web-sse/createSseEventEmitter.ts +278 -0
  38. package/tsconfig.json +1 -0
  39. package/types.ts +6 -0
package/agentEvents.ts ADDED
@@ -0,0 +1,66 @@
1
+ import type { ToolCallEvent } from "./agent/toolCallEvents.js";
2
+
3
+ export type AgentEvent =
4
+ | {
5
+ type: "turn-started";
6
+ messageId: string;
7
+ }
8
+ | {
9
+ type: "text-delta";
10
+ delta: string;
11
+ }
12
+ | {
13
+ type: "reasoning-delta";
14
+ delta: string;
15
+ }
16
+ | {
17
+ type: "tool-call";
18
+ data: ToolCallEvent;
19
+ }
20
+ | {
21
+ type: "rendering";
22
+ phase: "start" | "end";
23
+ label: string;
24
+ }
25
+ | {
26
+ type: "transcript";
27
+ text: string;
28
+ language?: string;
29
+ }
30
+ | {
31
+ type: "response";
32
+ text: string;
33
+ sessionId: string;
34
+ turnId: string;
35
+ }
36
+ | {
37
+ type: "speech-response";
38
+ transcript: { text: string; language?: string };
39
+ response: { text: string };
40
+ sessionId: string;
41
+ turnId: string;
42
+ }
43
+ | {
44
+ type: "audio-start";
45
+ mimeType: string;
46
+ format: string;
47
+ sampleRate: number;
48
+ channelCount: number;
49
+ bitsPerSample: number;
50
+ }
51
+ | {
52
+ type: "audio-delta";
53
+ value: Uint8Array;
54
+ }
55
+ | {
56
+ type: "audio-done";
57
+ }
58
+ | {
59
+ type: "error";
60
+ error: string;
61
+ }
62
+ | {
63
+ type: "finish";
64
+ };
65
+
66
+ export type AgentEventEmitter = (event: AgentEvent) => void | Promise<void>;
@@ -1,206 +1 @@
1
- import { randomUUID } from "crypto";
2
-
3
- import type { ToolCallEvent } from "./agent/toolCallEvents.js";
4
-
5
- type AgentEventStreamResponse = {
6
- writeHead: (statusCode: number, headers: Record<string, string>) => void;
7
- write: (chunk: string) => unknown;
8
- end: () => unknown;
9
- writableEnded: boolean;
10
- destroyed: boolean;
11
- };
12
-
13
- type AgentEventStreamOptions = {
14
- vercelAiUiMessageStream?: boolean;
15
- closeActiveBlockOnToolStart?: boolean;
16
- };
17
-
18
- export function createAgentEventStream(
19
- res: AgentEventStreamResponse,
20
- options: AgentEventStreamOptions = {},
21
- ) {
22
- let isStreamClosed = false;
23
- let activeBlock: { type: "text" | "reasoning"; id: string } | null = null;
24
-
25
- res.writeHead(200, {
26
- "Content-Type": "text/event-stream",
27
- "Cache-Control": "no-cache",
28
- "Connection": "keep-alive",
29
- ...(options.vercelAiUiMessageStream
30
- ? { "x-vercel-ai-ui-message-stream": "v1" }
31
- : {}),
32
- });
33
-
34
- const stream = {
35
- send(obj: unknown) {
36
- if (isStreamClosed || res.writableEnded || res.destroyed) {
37
- return;
38
- }
39
-
40
- res.write(`data: ${JSON.stringify(obj)}\n\n`);
41
- },
42
-
43
- endActiveBlock() {
44
- if (!activeBlock) {
45
- return;
46
- }
47
-
48
- stream.send({
49
- type: `${activeBlock.type}-end`,
50
- id: activeBlock.id,
51
- });
52
-
53
- activeBlock = null;
54
- },
55
-
56
- startBlock(type: "text" | "reasoning") {
57
- if (activeBlock?.type === type) {
58
- return activeBlock.id;
59
- }
60
-
61
- stream.endActiveBlock();
62
-
63
- const id = randomUUID();
64
- activeBlock = { type, id };
65
-
66
- stream.send({
67
- type: `${type}-start`,
68
- id,
69
- });
70
-
71
- return id;
72
- },
73
-
74
- start(messageId: string) {
75
- stream.send({
76
- type: "start",
77
- messageId,
78
- });
79
- },
80
-
81
- textDelta(delta: string) {
82
- const textId = stream.startBlock("text");
83
- stream.send({
84
- type: "text-delta",
85
- id: textId,
86
- delta,
87
- });
88
- },
89
-
90
- reasoningDelta(delta: string) {
91
- const reasoningId = stream.startBlock("reasoning");
92
- stream.send({
93
- type: "reasoning-delta",
94
- id: reasoningId,
95
- delta,
96
- });
97
- },
98
-
99
- toolCall(event: ToolCallEvent) {
100
- if (options.closeActiveBlockOnToolStart && event.phase === "start") {
101
- stream.endActiveBlock();
102
- }
103
-
104
- stream.send({
105
- type: "data-tool-call",
106
- data: event,
107
- });
108
- },
109
-
110
- transcript(text: string, language?: string) {
111
- stream.send({
112
- type: "transcript",
113
- data: {
114
- text,
115
- language,
116
- },
117
- });
118
- },
119
-
120
- response(text: string, sessionId: string, turnId: string) {
121
- stream.send({
122
- type: "response",
123
- data: {
124
- text,
125
- sessionId,
126
- turnId,
127
- },
128
- });
129
- },
130
-
131
- speechResponse(
132
- transcript: { text: string; language?: string },
133
- response: { text: string },
134
- sessionId: string,
135
- turnId: string,
136
- ) {
137
- stream.send({
138
- type: "speech-response",
139
- data: {
140
- transcript,
141
- response,
142
- sessionId,
143
- turnId,
144
- },
145
- });
146
- },
147
-
148
- audioStart(
149
- mimeType: string,
150
- format: string,
151
- sampleRate: number,
152
- channelCount: number,
153
- bitsPerSample: number,
154
- ) {
155
- stream.send({
156
- type: "audio-start",
157
- data: {
158
- mimeType,
159
- format,
160
- sampleRate,
161
- channelCount,
162
- bitsPerSample,
163
- },
164
- });
165
- },
166
-
167
- audioDelta(value: Uint8Array) {
168
- stream.send({
169
- type: "audio-delta",
170
- data: {
171
- base64: Buffer.from(value).toString("base64"),
172
- },
173
- });
174
- },
175
-
176
- audioDone() {
177
- stream.send({
178
- type: "audio-done",
179
- });
180
- },
181
-
182
- error(error: string) {
183
- stream.send({
184
- type: "error",
185
- error,
186
- });
187
- },
188
-
189
- end() {
190
- if (isStreamClosed || res.writableEnded || res.destroyed) {
191
- return;
192
- }
193
-
194
- stream.endActiveBlock();
195
- stream.send({
196
- type: "finish",
197
- });
198
-
199
- res.write("data: [DONE]\n\n");
200
- isStreamClosed = true;
201
- res.end();
202
- },
203
- };
204
-
205
- return stream;
206
- }
1
+ export { createSseEventEmitter } from "./surfaces/web-sse/createSseEventEmitter.js";
package/build.log CHANGED
@@ -62,5 +62,5 @@ custom/speech_recognition_frontend/voiceActivityDetection.ts
62
62
  custom/speech_recognition_frontend/types/
63
63
  custom/speech_recognition_frontend/types/voice-activity-detection.d.ts
64
64
 
65
- sent 1,666,103 bytes received 921 bytes 3,334,048.00 bytes/sec
66
- total size is 1,662,008 speedup is 1.00
65
+ sent 1,667,285 bytes received 905 bytes 3,336,380.00 bytes/sec
66
+ total size is 1,663,132 speedup is 1.00
@@ -39,6 +39,15 @@
39
39
  <template v-for="(part, index) in ToolOrReasoningParts" :key="index">
40
40
  <ReasoningRenderer v-if="part.type === 'reasoning'" :state="part.state" :text="part.text" />
41
41
  <ToolsGroup v-else-if="part.type==='data-tool-call'" :toolGroup="groupToolCallParts(message, part)" />
42
+ <li v-else-if="part.type === 'data-rendering'" class="mb-6 mx-2 mt-2 px-2 z-50 overflow-hidden">
43
+ <span class="bg-lightNavbar dark:bg-darkNavbar absolute flex items-center text-listTableHeadingText dark:text-darkListTableHeadingText justify-center w-5 h-5 rounded-full -start-[0.68rem] ring-4 ring-lightNavbar dark:ring-darkNavbar">
44
+ <div class="w-2 h-2 rounded-full bg-current animate-pulse"></div>
45
+ </span>
46
+ <h3 class="flex items-center mb-1 text-sm ml-3 gap-1 text-listTableHeadingText dark:text-darkListTableHeadingText">
47
+ <span class="font-semibold">{{ part.data?.label ?? 'Rendering...' }}</span>
48
+ <ThreeDotsAnimation />
49
+ </h3>
50
+ </li>
42
51
  </template>
43
52
  </ol>
44
53
  </CustomAutoScrollContainer>
@@ -73,7 +82,11 @@
73
82
  const isExpanded = ref(true);
74
83
  let isUserScrolled = false;
75
84
  const ToolOrReasoningParts = computed(() => {
76
- return props.message.parts.filter((part: IPart) => part.type === 'data-tool-call' || part.type === 'reasoning');
85
+ return props.message.parts.filter((part: IPart) => {
86
+ return part.type === 'data-tool-call'
87
+ || part.type === 'reasoning'
88
+ || isActiveRenderingPart(part);
89
+ });
77
90
  });
78
91
  const isResponseInProgress = computed(() =>{
79
92
  return props.isLastMessageInChat && agentStore.isResponseInProgress;
@@ -157,6 +170,14 @@
157
170
  });
158
171
  };
159
172
 
173
+ function isActiveRenderingPart(part: IPart) {
174
+ return part.type === 'data-rendering'
175
+ && part.data?.phase === 'start'
176
+ && !props.message.parts.some((candidate: IPart) => {
177
+ return candidate.type === 'data-rendering' && candidate.data?.phase === 'end';
178
+ });
179
+ }
180
+
160
181
  const groupToolCallParts = (message: IMessage, currentPart: IPart): IToolGroup[] => {
161
182
  if (currentPart.type !== 'data-tool-call') {
162
183
  return [];
@@ -259,4 +280,4 @@
259
280
  }
260
281
  }
261
282
 
262
- </style>
283
+ </style>
@@ -72,7 +72,7 @@ let highlightModulePromise: Promise<typeof import('./incremarkCodeHighlight')> |
72
72
  const sourceCode = computed(() => props.node.value ?? '');
73
73
  const language = computed(() => props.node.lang?.trim().toLowerCase() || 'text');
74
74
  const languageLabel = computed(() => language.value === 'vega-lite' ? '' : props.node.lang?.trim() || 'text');
75
- const shouldRenderVega = computed(() => language.value === 'vega-lite' && props.blockStatus === 'completed');
75
+ const shouldRenderVega = computed(() => language.value === 'vega-lite');
76
76
  const codeTheme = computed<IncremarkCodeTheme>(() => {
77
77
  const requestedTheme = props.theme ?? (prefersDarkMode.value ? props.darkTheme : props.lightTheme);
78
78
 
@@ -390,4 +390,4 @@ function clearVega() {
390
390
  :deep(.incremark-vega){
391
391
  padding: 0;
392
392
  }
393
- </style>
393
+ </style>
package/custom/types.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  export interface IPartData {
2
- toolCallId: string;
3
- toolName: string;
4
- phase: 'start' | 'end';
2
+ toolCallId?: string;
3
+ toolName?: string;
4
+ phase?: 'start' | 'end';
5
+ label?: string;
5
6
  input?: any;
6
7
  output?: any;
7
8
  durationMs?: number;
8
9
  toolInfo?: string;
9
10
  }
10
11
  export interface IPart {
11
- type: 'reasoning' | 'data-tool-call' | 'text';
12
+ type: 'reasoning' | 'data-tool-call' | 'data-rendering' | 'text';
12
13
  text?: string;
13
14
  state?: 'started' | 'thinking' | 'processing' | 'streaming' | 'done';
14
15
  data?: IPartData;
@@ -0,0 +1,29 @@
1
+ import type { RunnableConfig } from "@langchain/core/runnables";
2
+ import { BaseCheckpointSaver, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, type PendingWrite } from "@langchain/langgraph-checkpoint";
3
+ import type { PluginOptions } from "../types.js";
4
+ export declare class AdminForthCheckpointSaver extends BaseCheckpointSaver {
5
+ private readonly adminforth;
6
+ private readonly pluginOptions;
7
+ constructor(adminforth: any, pluginOptions: PluginOptions);
8
+ private get resourceConfig();
9
+ private resource;
10
+ private serialize;
11
+ private deserialize;
12
+ private now;
13
+ private encodeCheckpointNamespace;
14
+ private decodeCheckpointNamespace;
15
+ private getConfigValues;
16
+ private buildConfig;
17
+ private buildCheckpointRowId;
18
+ private buildWritesRowId;
19
+ private getWriteIndex;
20
+ private isDuplicateCheckpointWriteError;
21
+ put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata, _newVersions: Record<string, unknown>): Promise<RunnableConfig>;
22
+ putWrites(config: RunnableConfig, writes: PendingWrite[], taskId: string): Promise<void>;
23
+ getTuple(config: RunnableConfig): Promise<CheckpointTuple | undefined>;
24
+ list(config: RunnableConfig, options?: {
25
+ before?: RunnableConfig;
26
+ limit?: number;
27
+ }): AsyncGenerator<CheckpointTuple>;
28
+ deleteThread(threadId: string, checkpointNs?: string): Promise<void>;
29
+ }
@@ -0,0 +1,10 @@
1
+ import type { PluginOptions } from "../types.js";
2
+ export type DetectedLanguage = {
3
+ language: string;
4
+ code: string;
5
+ ambiguous: boolean;
6
+ };
7
+ export type PreviousUserMessage = {
8
+ text: string;
9
+ };
10
+ export declare function detectUserLanguage(completionAdapter: PluginOptions["modes"][number]["completionAdapter"], prompt: string, previousUserMessages?: PreviousUserMessage[]): Promise<DetectedLanguage | null>;
@@ -0,0 +1,3 @@
1
+ import { type IAdminForth } from "adminforth";
2
+ import { type ApiBasedTool } from "../../apiBasedTools.js";
3
+ export declare function createApiBasedToolsMiddleware(apiBasedTools: Record<string, ApiBasedTool>, adminforth: IAdminForth): import("langchain").AgentMiddleware<undefined, undefined, unknown, readonly (import("@langchain/core/tools").ClientTool | import("@langchain/core/tools").ServerTool)[]>;
@@ -0,0 +1 @@
1
+ export declare function createOpenAiResponsesContinuationMiddleware(): import("langchain").AgentMiddleware<undefined, undefined, unknown, readonly (import("@langchain/core/tools").ClientTool | import("@langchain/core/tools").ServerTool)[]>;
@@ -0,0 +1,46 @@
1
+ import type { ToolCallEvent } from "../toolCallEvents.js";
2
+ export type SequenceDebugResultType = "tool_calls" | "final_text";
3
+ type SequenceDebugToolCall = {
4
+ toolCallId: string;
5
+ toolName: string;
6
+ input: string;
7
+ output: string | null;
8
+ error: string | null;
9
+ };
10
+ export type SequenceDebug = {
11
+ sequenceId: number;
12
+ startedAt: string;
13
+ prompt: string;
14
+ promptTokens: number;
15
+ reasoning: string;
16
+ reasoningTokens: number;
17
+ text: string;
18
+ textTokens: number;
19
+ cachedTokens: number;
20
+ responseId: string | null;
21
+ toolCalls: SequenceDebugToolCall[];
22
+ endedAt: string;
23
+ resultType: SequenceDebugResultType;
24
+ };
25
+ type SequenceDebugModelCall = {
26
+ promptTokens: number;
27
+ reasoning: string;
28
+ reasoningTokens: number;
29
+ text: string;
30
+ textTokens: number;
31
+ cachedTokens: number;
32
+ responseId: string | null;
33
+ resultType: SequenceDebugResultType;
34
+ };
35
+ export type SequenceDebugModelCallSink = {
36
+ handleModelCallStart: (prompt: string) => void;
37
+ handleModelCallComplete: (params: SequenceDebugModelCall) => void;
38
+ };
39
+ export type SequenceDebugCollector = SequenceDebugModelCallSink & {
40
+ handleToolCallEvent: (event: ToolCallEvent) => void;
41
+ flush: () => void;
42
+ getHistory: () => SequenceDebug[];
43
+ };
44
+ export declare function createSequenceDebugCollector(): SequenceDebugCollector;
45
+ export declare function createSequenceDebugMiddleware(sink: SequenceDebugModelCallSink): import("langchain").AgentMiddleware<undefined, undefined, unknown, readonly (import("@langchain/core/tools").ClientTool | import("@langchain/core/tools").ServerTool)[]>;
46
+ export {};
@@ -0,0 +1,61 @@
1
+ import type { BaseChatModel } from "@langchain/core/language_models/chat_models";
2
+ import { type AdminUser, type CompletionAdapter, type IAdminForth } from "adminforth";
3
+ import { type BaseCheckpointSaver, type Messages } from "@langchain/langgraph";
4
+ import { z } from "zod";
5
+ import { createSequenceDebugMiddleware, type SequenceDebugModelCallSink } from "./middleware/sequenceDebug.js";
6
+ import type { ApiBasedTool } from "../apiBasedTools.js";
7
+ import type { ToolCallEventSink } from "./toolCallEvents.js";
8
+ import type { CurrentPageContext } from "./tools/getUserLocation.js";
9
+ export declare const contextSchema: z.ZodObject<{
10
+ adminUser: z.ZodCustom<AdminUser, AdminUser>;
11
+ userTimeZone: z.ZodString;
12
+ sessionId: z.ZodString;
13
+ turnId: z.ZodString;
14
+ abortSignal: z.ZodOptional<z.ZodCustom<AbortSignal, AbortSignal>>;
15
+ currentPage: z.ZodOptional<z.ZodCustom<CurrentPageContext, CurrentPageContext>>;
16
+ emitToolCallEvent: z.ZodCustom<ToolCallEventSink, ToolCallEventSink>;
17
+ }, z.core.$strip>;
18
+ export type AgentChatModel = BaseChatModel<any, any>;
19
+ export type AgentModelPurpose = "primary" | "summary";
20
+ export type AgentModeCompletionAdapter = CompletionAdapter & {
21
+ getLangChainAgentSpec(params: {
22
+ maxTokens: number;
23
+ purpose: AgentModelPurpose;
24
+ }): Promise<{
25
+ model: unknown;
26
+ middleware?: unknown[];
27
+ }> | {
28
+ model: unknown;
29
+ middleware?: unknown[];
30
+ };
31
+ };
32
+ type AgentMiddleware = ReturnType<typeof createSequenceDebugMiddleware>;
33
+ type AgentChatModelSpec = {
34
+ model: AgentChatModel;
35
+ middleware: AgentMiddleware[];
36
+ };
37
+ export declare function createAgentChatModel(params: {
38
+ adapter: CompletionAdapter;
39
+ maxTokens: number;
40
+ purpose: AgentModelPurpose;
41
+ }): Promise<AgentChatModelSpec>;
42
+ export declare function callAgent(params: {
43
+ name: string;
44
+ model: AgentChatModel;
45
+ summaryModel: AgentChatModel;
46
+ modelMiddleware?: AgentMiddleware[];
47
+ checkpointer?: BaseCheckpointSaver;
48
+ messages: Messages;
49
+ adminUser: AdminUser;
50
+ adminforth: IAdminForth;
51
+ apiBasedTools: Record<string, ApiBasedTool>;
52
+ customComponentsDir: string;
53
+ sessionId: string;
54
+ turnId: string;
55
+ currentPage?: CurrentPageContext;
56
+ userTimeZone: string;
57
+ abortSignal?: AbortSignal;
58
+ emitToolCallEvent: ToolCallEventSink;
59
+ sequenceDebugSink: SequenceDebugModelCallSink;
60
+ }): Promise<import("@langchain/core/utils/stream").IterableReadableStream<[import("langchain").BaseMessage<import("@langchain/core/messages").MessageStructure<import("@langchain/core/messages").MessageToolSet>, import("@langchain/core/messages").MessageType>, Record<string, any>]>>;
61
+ export {};
@@ -0,0 +1,13 @@
1
+ export interface AgentSkillManifest {
2
+ directoryName: string;
3
+ name: string;
4
+ description: string;
5
+ instructions: string;
6
+ }
7
+ export declare function getProjectSkillsDirectoryPath(customComponentsDir: string): string;
8
+ export declare function getProjectPluginSkillsDirectoryPath(customComponentsDir: string): string;
9
+ export declare function listBundledSkillManifests(): Promise<AgentSkillManifest[]>;
10
+ export declare function listProjectSkillManifests(customComponentsDir: string): Promise<AgentSkillManifest[]>;
11
+ export declare function listSkillManifests(customComponentsDir: string): Promise<AgentSkillManifest[]>;
12
+ export declare function loadSkillManifest(skillName: string, customComponentsDir: string): Promise<AgentSkillManifest | null>;
13
+ export declare function loadSkillMarkdown(skillName: string, customComponentsDir: string): Promise<string | null>;
@@ -0,0 +1,11 @@
1
+ import type { AdminUser, IAdminForth } from "adminforth";
2
+ import type { DetectedLanguage } from "./languageDetect.js";
3
+ export declare const DEFAULT_AGENT_SYSTEM_PROMPT: string;
4
+ export declare function appendCustomSystemPrompt(systemPrompt: string, customSystemPrompt?: string): string;
5
+ export declare function buildAgentTurnSystemPrompt(input: {
6
+ agentSystemPrompt: string;
7
+ adminUser: AdminUser;
8
+ usernameField: string;
9
+ userLanguage: DetectedLanguage | null;
10
+ }): string;
11
+ export declare function buildAgentSystemPrompt(adminforth: IAdminForth, hiddenResourceIds?: Iterable<string>): Promise<string>;
@@ -0,0 +1,27 @@
1
+ export type ToolCallEvent = {
2
+ toolCallId: string;
3
+ toolName: string;
4
+ toolInfo?: string;
5
+ phase: "start";
6
+ input: string;
7
+ } | {
8
+ toolCallId: string;
9
+ toolName: string;
10
+ phase: "end";
11
+ durationMs: number;
12
+ output: string | null;
13
+ error: string | null;
14
+ };
15
+ export type ToolCallEventSink = (event: ToolCallEvent) => void;
16
+ export declare function createToolCallTracker(params: {
17
+ emit: ToolCallEventSink;
18
+ toolCallId?: string;
19
+ toolName: string;
20
+ toolInfo?: string;
21
+ input?: Record<string, unknown>;
22
+ startedAt?: number;
23
+ }): {
24
+ start(): void;
25
+ finishSuccess(output: unknown): void;
26
+ finishError(error: unknown): void;
27
+ };
@@ -0,0 +1,6 @@
1
+ import type { ApiBasedTool } from "../../apiBasedTools.js";
2
+ export declare function createApiTool(toolName: string, apiBasedTool: ApiBasedTool): import("langchain").DynamicStructuredTool<Record<string, unknown> | {
3
+ readonly type: "object";
4
+ readonly properties: {};
5
+ readonly additionalProperties: true;
6
+ }, unknown, unknown, string, unknown, string>;
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export declare function createFetchSkillTool(customComponentsDir: string): Promise<import("langchain").DynamicStructuredTool<z.ZodObject<{
3
+ skillName: z.ZodString;
4
+ }, z.core.$strip>, {
5
+ skillName: string;
6
+ }, {
7
+ skillName: string;
8
+ }, string, unknown, "fetch_skill">>;
@@ -0,0 +1,9 @@
1
+ import { z } from "zod";
2
+ import { type ApiBasedTool } from "../../apiBasedTools.js";
3
+ export declare function createFetchToolSchemaTool(apiBasedTools: Record<string, ApiBasedTool>): Promise<import("langchain").DynamicStructuredTool<z.ZodObject<{
4
+ toolName: z.ZodString;
5
+ }, z.core.$strip>, {
6
+ toolName: string;
7
+ }, {
8
+ toolName: string;
9
+ }, string, unknown, "fetch_tool_schema">>;
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export type CurrentPageContext = {
3
+ path: string;
4
+ fullPath: string;
5
+ title: string;
6
+ url: string;
7
+ };
8
+ export declare function createGetUserLocationTool(): import("langchain").DynamicStructuredTool<z.ZodObject<{}, z.core.$strip>, Record<string, never>, Record<string, never>, string, unknown, "get_user_location">;
@@ -0,0 +1,4 @@
1
+ import type { ClientTool } from "@langchain/core/tools";
2
+ import type { ApiBasedTool } from "../../apiBasedTools.js";
3
+ export declare const ALWAYS_AVAILABLE_API_TOOL_NAMES: readonly ["get_resource"];
4
+ export declare function createAgentTools(customComponentsDir: string, apiBasedTools: Record<string, ApiBasedTool>): Promise<ClientTool[]>;
@@ -0,0 +1,56 @@
1
+ import type { ToolCallEvent } from "./agent/toolCallEvents.js";
2
+ export type AgentEvent = {
3
+ type: "turn-started";
4
+ messageId: string;
5
+ } | {
6
+ type: "text-delta";
7
+ delta: string;
8
+ } | {
9
+ type: "reasoning-delta";
10
+ delta: string;
11
+ } | {
12
+ type: "tool-call";
13
+ data: ToolCallEvent;
14
+ } | {
15
+ type: "rendering";
16
+ phase: "start" | "end";
17
+ label: string;
18
+ } | {
19
+ type: "transcript";
20
+ text: string;
21
+ language?: string;
22
+ } | {
23
+ type: "response";
24
+ text: string;
25
+ sessionId: string;
26
+ turnId: string;
27
+ } | {
28
+ type: "speech-response";
29
+ transcript: {
30
+ text: string;
31
+ language?: string;
32
+ };
33
+ response: {
34
+ text: string;
35
+ };
36
+ sessionId: string;
37
+ turnId: string;
38
+ } | {
39
+ type: "audio-start";
40
+ mimeType: string;
41
+ format: string;
42
+ sampleRate: number;
43
+ channelCount: number;
44
+ bitsPerSample: number;
45
+ } | {
46
+ type: "audio-delta";
47
+ value: Uint8Array;
48
+ } | {
49
+ type: "audio-done";
50
+ } | {
51
+ type: "error";
52
+ error: string;
53
+ } | {
54
+ type: "finish";
55
+ };
56
+ export type AgentEventEmitter = (event: AgentEvent) => void | Promise<void>;