@looopy-ai/core 2.1.8 → 2.1.11
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/core/agent.d.ts +4 -8
- package/dist/core/agent.js +3 -5
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/iteration.d.ts +3 -3
- package/dist/core/iteration.js +33 -34
- package/dist/core/loop.d.ts +3 -3
- package/dist/core/tools.d.ts +1 -1
- package/dist/core/tools.js +26 -19
- package/dist/events/utils.d.ts +19 -53
- package/dist/events/utils.js +0 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/observability/spans/iteration.d.ts +1 -1
- package/dist/observability/spans/llm-call.d.ts +5 -5
- package/dist/observability/spans/llm-call.js +8 -4
- package/dist/observability/spans/tool.d.ts +3 -3
- package/dist/plugins/agent-academy.d.ts +9 -0
- package/dist/plugins/agent-academy.js +137 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/system-prompt.d.ts +3 -0
- package/dist/plugins/system-prompt.js +20 -0
- package/dist/providers/litellm-provider.d.ts +3 -2
- package/dist/providers/litellm-provider.js +11 -9
- package/dist/stores/artifacts/internal-event-artifact-store.d.ts +2 -2
- package/dist/stores/artifacts/internal-event-artifact-store.js +0 -6
- package/dist/stores/filesystem/filesystem-message-store.d.ts +5 -5
- package/dist/stores/messages/hybrid-message-store.d.ts +7 -7
- package/dist/stores/messages/interfaces.d.ts +8 -8
- package/dist/stores/messages/mem0-message-store.d.ts +5 -5
- package/dist/stores/messages/memory-message-store.d.ts +5 -5
- package/dist/tools/agent-tool-provider.d.ts +5 -5
- package/dist/tools/agent-tool-provider.js +14 -10
- package/dist/tools/artifact-tools.d.ts +2 -2
- package/dist/tools/artifact-tools.js +14 -14
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.js +0 -1
- package/dist/tools/local-tools.d.ts +4 -3
- package/dist/tools/local-tools.js +8 -8
- package/dist/tools/mcp-tool-provider.d.ts +5 -4
- package/dist/tools/mcp-tool-provider.js +7 -7
- package/dist/tools/tool-result-events.d.ts +3 -4
- package/dist/tools/tool-result-events.js +2 -8
- package/dist/types/a2a.d.ts +2 -2
- package/dist/types/agent.d.ts +1 -1
- package/dist/types/core.d.ts +56 -0
- package/dist/types/core.js +8 -0
- package/dist/types/event.d.ts +6 -5
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/llm.d.ts +3 -3
- package/dist/types/message.d.ts +5 -5
- package/dist/types/prettify.d.ts +3 -0
- package/dist/types/state.d.ts +2 -2
- package/dist/types/tools.d.ts +3 -12
- package/dist/types/tools.js +2 -2
- package/dist/utils/prompt.d.ts +5 -7
- package/dist/utils/prompt.js +12 -10
- package/package.json +5 -3
- package/dist/core/types.d.ts +0 -31
- package/dist/skills/index.d.ts +0 -1
- package/dist/skills/index.js +0 -1
- package/dist/skills/registry.d.ts +0 -14
- package/dist/skills/registry.js +0 -61
- package/dist/tools/client-tool-provider.d.ts +0 -25
- package/dist/tools/client-tool-provider.js +0 -143
- /package/dist/{core/types.js → types/prettify.js} +0 -0
package/dist/core/agent.d.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import type { SkillRegistry } from '../skills';
|
|
3
2
|
import type { MessageStore } from '../stores/messages/interfaces';
|
|
4
3
|
import type { AgentState, AgentStore } from '../types/agent';
|
|
4
|
+
import type { Plugin } from '../types/core';
|
|
5
5
|
import type { ContextAnyEvent } from '../types/event';
|
|
6
6
|
import type { LLMProvider } from '../types/llm';
|
|
7
|
-
import type {
|
|
8
|
-
import type { ToolProvider } from '../types/tools';
|
|
9
|
-
import type { SystemPromptProp } from '../utils/prompt';
|
|
7
|
+
import type { LLMMessage } from '../types/message';
|
|
10
8
|
export interface AgentConfig<AuthContext> {
|
|
11
9
|
agentId: string;
|
|
12
10
|
contextId: string;
|
|
13
11
|
llmProvider: LLMProvider;
|
|
14
|
-
toolProviders: ToolProvider<AuthContext>[];
|
|
15
12
|
messageStore: MessageStore;
|
|
16
13
|
agentStore?: AgentStore;
|
|
17
14
|
autoCompact?: boolean;
|
|
18
15
|
maxMessages?: number;
|
|
19
|
-
|
|
20
|
-
skillRegistry?: SkillRegistry;
|
|
16
|
+
plugins?: Plugin<AuthContext>[];
|
|
21
17
|
logger?: import('pino').Logger;
|
|
22
18
|
}
|
|
23
19
|
export interface GetMessagesOptions {
|
|
@@ -42,7 +38,7 @@ export declare class Agent<AuthContext> {
|
|
|
42
38
|
}): Promise<Observable<ContextAnyEvent>>;
|
|
43
39
|
private executeInternal;
|
|
44
40
|
shutdown(): Promise<void>;
|
|
45
|
-
getMessages(options?: GetMessagesOptions): Promise<
|
|
41
|
+
getMessages(options?: GetMessagesOptions): Promise<LLMMessage[]>;
|
|
46
42
|
clear(): Promise<void>;
|
|
47
43
|
private persistState;
|
|
48
44
|
private persistStateSafely;
|
package/dist/core/agent.js
CHANGED
|
@@ -58,7 +58,7 @@ export class Agent {
|
|
|
58
58
|
}
|
|
59
59
|
setResumeAttributes(span, existingMessages.length);
|
|
60
60
|
}
|
|
61
|
-
this._state.status = '
|
|
61
|
+
this._state.status = 'idle';
|
|
62
62
|
this._state.lastActivity = new Date();
|
|
63
63
|
await this.persistState();
|
|
64
64
|
this.logger.info({ status: this._state.status }, 'Agent initialized');
|
|
@@ -169,10 +169,8 @@ export class Agent {
|
|
|
169
169
|
taskId,
|
|
170
170
|
authContext,
|
|
171
171
|
parentContext: turnContext,
|
|
172
|
-
systemPrompt: this.config.systemPrompt,
|
|
173
|
-
toolProviders: this.config.toolProviders,
|
|
174
|
-
skillRegistry: this.config.skillRegistry,
|
|
175
172
|
logger: this.config.logger.child({ taskId, turnNumber }),
|
|
173
|
+
plugins: this.config.plugins || [],
|
|
176
174
|
turnNumber,
|
|
177
175
|
metadata,
|
|
178
176
|
}, {
|
|
@@ -237,7 +235,7 @@ export class Agent {
|
|
|
237
235
|
try {
|
|
238
236
|
this._state.turnCount++;
|
|
239
237
|
this._state.lastActivity = new Date();
|
|
240
|
-
this._state.status = '
|
|
238
|
+
this._state.status = 'idle';
|
|
241
239
|
await this.persistState();
|
|
242
240
|
setTurnCountAttribute(turnSpan, this._state.turnCount);
|
|
243
241
|
if (this.config.autoCompact) {
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
package/dist/core/iteration.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Observable } from 'rxjs';
|
|
2
|
+
import type { IterationConfig, IterationContext } from '../types/core';
|
|
2
3
|
import type { ContextAnyEvent } from '../types/event';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
export declare const runIteration: <AuthContext>(context: LoopContext<AuthContext>, config: IterationConfig, history: Message[]) => Observable<ContextAnyEvent>;
|
|
4
|
+
import type { LLMMessage } from '../types/message';
|
|
5
|
+
export declare const runIteration: <AuthContext>(context: IterationContext<AuthContext>, config: IterationConfig<AuthContext>, history: LLMMessage[]) => Observable<ContextAnyEvent>;
|
package/dist/core/iteration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { concat, defer, filter, map, mergeMap, shareReplay } from 'rxjs';
|
|
2
2
|
import { startLLMCallSpan, startLoopIterationSpan } from '../observability/spans';
|
|
3
|
-
import {
|
|
3
|
+
import { getSystemPrompts } from '../utils/prompt';
|
|
4
4
|
import { runToolCall } from './tools';
|
|
5
5
|
export const runIteration = (context, config, history) => {
|
|
6
6
|
const logger = context.logger.child({
|
|
@@ -9,17 +9,26 @@ export const runIteration = (context, config, history) => {
|
|
|
9
9
|
});
|
|
10
10
|
const { traceContext: iterationContext, tapFinish: finishIterationSpan } = startLoopIterationSpan({ ...context, logger }, config.iterationNumber);
|
|
11
11
|
const llmEvents$ = defer(async () => {
|
|
12
|
-
const
|
|
13
|
-
const messages = await prepareMessages(
|
|
14
|
-
const tools = await prepareTools(context.
|
|
15
|
-
logger.debug({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
const systemPrompts = await getSystemPrompts(context.plugins, context);
|
|
13
|
+
const messages = await prepareMessages(systemPrompts, history);
|
|
14
|
+
const tools = await prepareTools(context.plugins);
|
|
15
|
+
logger.debug({ systemPrompts, messages: messages.length, tools: tools.map((t) => t.id).join(', ') }, 'Prepared messages and tools for LLM call');
|
|
16
|
+
return { messages, tools, systemPrompts };
|
|
17
|
+
}).pipe(mergeMap(({ messages, tools, systemPrompts }) => {
|
|
18
|
+
const { tapFinish: finishLLMCallSpan } = startLLMCallSpan({ ...context, parentContext: iterationContext }, systemPrompts, messages, tools);
|
|
19
|
+
const metadata = systemPrompts.before
|
|
20
|
+
.concat(systemPrompts.after)
|
|
21
|
+
.reverse()
|
|
22
|
+
.reduce((acc, sp) => {
|
|
23
|
+
if (sp.metadata) {
|
|
24
|
+
return Object.assign(acc, sp.metadata);
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
const llmProvider = typeof config.llmProvider === 'function'
|
|
29
|
+
? config.llmProvider(context, metadata)
|
|
30
|
+
: config.llmProvider;
|
|
31
|
+
return llmProvider
|
|
23
32
|
.call({
|
|
24
33
|
messages,
|
|
25
34
|
tools,
|
|
@@ -29,6 +38,7 @@ export const runIteration = (context, config, history) => {
|
|
|
29
38
|
.pipe(finishLLMCallSpan, map((event) => ({
|
|
30
39
|
contextId: context.contextId,
|
|
31
40
|
taskId: context.taskId,
|
|
41
|
+
path: undefined,
|
|
32
42
|
...event,
|
|
33
43
|
})));
|
|
34
44
|
}), shareReplay({ refCount: true }));
|
|
@@ -39,29 +49,18 @@ export const runIteration = (context, config, history) => {
|
|
|
39
49
|
}, event)));
|
|
40
50
|
return concat(llmEvents$.pipe(filter((event) => event.kind !== 'tool-call')), toolEvents$).pipe(finishIterationSpan);
|
|
41
51
|
};
|
|
42
|
-
const prepareMessages = async (
|
|
43
|
-
const messages =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const skills = skillRegistry.list();
|
|
52
|
-
if (skills.length > 0) {
|
|
53
|
-
const skillList = skills.map((s) => `- **${s.name}**: ${s.description}`).join('\n');
|
|
54
|
-
const skillMessage = {
|
|
55
|
-
role: 'system',
|
|
56
|
-
content: `You can learn new skills by using the 'learn_skill' tool. Available skills:\n\n${skillList}`,
|
|
57
|
-
};
|
|
58
|
-
messages.push(skillMessage);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return messages.concat(history);
|
|
52
|
+
const prepareMessages = async (systemPrompts, history) => {
|
|
53
|
+
const messages = systemPrompts.before.map((sp) => ({
|
|
54
|
+
role: 'system',
|
|
55
|
+
content: sp.content,
|
|
56
|
+
}));
|
|
57
|
+
return messages.concat(history, systemPrompts.after.map((sp) => ({
|
|
58
|
+
role: 'system',
|
|
59
|
+
content: sp.content,
|
|
60
|
+
})));
|
|
62
61
|
};
|
|
63
62
|
const prepareTools = async (toolProviders) => {
|
|
64
|
-
const toolPromises = toolProviders.map((p) => p.
|
|
63
|
+
const toolPromises = toolProviders.map((p) => p.listTools?.());
|
|
65
64
|
const toolArrays = await Promise.all(toolPromises);
|
|
66
|
-
return toolArrays.flat();
|
|
65
|
+
return toolArrays.filter(Boolean).flat();
|
|
67
66
|
};
|
package/dist/core/loop.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import type { LoopConfig, LoopContext } from '../types/core';
|
|
1
2
|
import type { ContextAnyEvent } from '../types/event';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const runLoop: <AuthContext>(context: TurnContext<AuthContext>, config: LoopConfig, history: Message[]) => import("rxjs").Observable<ContextAnyEvent>;
|
|
3
|
+
import type { LLMMessage } from '../types/message';
|
|
4
|
+
export declare const runLoop: <AuthContext>(context: LoopContext<AuthContext>, config: LoopConfig, history: LLMMessage[]) => import("rxjs").Observable<ContextAnyEvent>;
|
package/dist/core/tools.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Observable } from 'rxjs';
|
|
2
|
+
import { type IterationContext } from '../types/core';
|
|
2
3
|
import type { ContextAnyEvent, ContextEvent, ToolCallEvent } from '../types/event';
|
|
3
|
-
import type { IterationContext } from './types';
|
|
4
4
|
export declare const runToolCall: <AuthContext>(context: IterationContext<AuthContext>, toolCall: ContextEvent<ToolCallEvent>) => Observable<ContextAnyEvent>;
|
package/dist/core/tools.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { catchError, concat, defer, mergeMap, of, tap } from 'rxjs';
|
|
1
|
+
import { catchError, concat, defer, map, mergeMap, of, tap } from 'rxjs';
|
|
2
2
|
import { isChildTaskEvent } from '../events/utils';
|
|
3
3
|
import { startToolExecuteSpan } from '../observability/spans';
|
|
4
4
|
import { toolErrorEvent } from '../tools/tool-result-events';
|
|
5
|
+
import { isToolPlugin } from '../types/core';
|
|
5
6
|
export const runToolCall = (context, toolCall) => {
|
|
6
7
|
const logger = context.logger.child({
|
|
7
8
|
component: 'tool-call',
|
|
@@ -9,21 +10,19 @@ export const runToolCall = (context, toolCall) => {
|
|
|
9
10
|
toolName: toolCall.toolName,
|
|
10
11
|
});
|
|
11
12
|
return defer(async () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
tool: await p.getTool(toolCall.toolName),
|
|
13
|
+
const matchingPlugins = await Promise.all(context.plugins.filter(isToolPlugin).map(async (p) => ({
|
|
14
|
+
plugin: p,
|
|
15
|
+
tool: await p.getTool?.(toolCall.toolName),
|
|
15
16
|
})));
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
-
logger.warn('No
|
|
17
|
+
const matchingPlugin = matchingPlugins.find((p) => p.tool !== undefined);
|
|
18
|
+
if (!matchingPlugin?.tool) {
|
|
19
|
+
logger.warn('No plugin found for tool');
|
|
19
20
|
return of(toolCall);
|
|
20
21
|
}
|
|
21
|
-
const {
|
|
22
|
-
logger.debug({ providerName:
|
|
22
|
+
const { plugin, tool } = matchingPlugin;
|
|
23
|
+
logger.debug({ providerName: plugin.name, toolIcon: tool.icon }, 'Found tool provider for tool');
|
|
23
24
|
const toolStartEvent = {
|
|
24
25
|
kind: 'tool-start',
|
|
25
|
-
contextId: context.contextId,
|
|
26
|
-
taskId: context.taskId,
|
|
27
26
|
toolCallId: toolCall.toolCallId,
|
|
28
27
|
icon: tool.icon,
|
|
29
28
|
toolName: toolCall.toolName,
|
|
@@ -41,34 +40,42 @@ export const runToolCall = (context, toolCall) => {
|
|
|
41
40
|
const { tapFinish } = startToolExecuteSpan(context, toolCall);
|
|
42
41
|
const execution$ = defer(() => {
|
|
43
42
|
try {
|
|
44
|
-
logger.trace({ providerName:
|
|
45
|
-
|
|
43
|
+
logger.trace({ providerName: plugin.name }, 'Executing tool');
|
|
44
|
+
if (!isToolPlugin(plugin)) {
|
|
45
|
+
return of(toolErrorEvent(toolCallInput, 'Plugin does not implement tools'));
|
|
46
|
+
}
|
|
47
|
+
return plugin.executeTool(toolCallInput, context).pipe(tap((event) => {
|
|
46
48
|
if (isChildTaskEvent(event))
|
|
47
49
|
return;
|
|
48
50
|
if (event.kind !== 'tool-complete') {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
logger.trace({ providerName:
|
|
53
|
+
logger.trace({ providerName: plugin.name, success: event.success }, 'Tool execution complete');
|
|
52
54
|
}), tapFinish, catchError((error) => {
|
|
53
55
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
54
56
|
logger.error({
|
|
55
|
-
providerName:
|
|
57
|
+
providerName: plugin.name,
|
|
56
58
|
error: err.message,
|
|
57
59
|
stack: err.stack,
|
|
58
60
|
}, 'Tool execution error');
|
|
59
|
-
return of(toolErrorEvent(
|
|
61
|
+
return of(toolErrorEvent(toolCallInput, err.message));
|
|
60
62
|
}));
|
|
61
63
|
}
|
|
62
64
|
catch (error) {
|
|
63
65
|
const err = error instanceof Error ? error : new Error(String(error));
|
|
64
66
|
logger.error({
|
|
65
|
-
providerName:
|
|
67
|
+
providerName: plugin.name,
|
|
66
68
|
error: err.message,
|
|
67
69
|
stack: err.stack,
|
|
68
70
|
}, 'Tool execution error');
|
|
69
|
-
return of(toolErrorEvent(
|
|
71
|
+
return of(toolErrorEvent(toolCallInput, err.message));
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
return concat(of(toolStartEvent), execution$);
|
|
73
|
-
}).pipe(mergeMap((obs) => obs))
|
|
75
|
+
}).pipe(mergeMap((obs) => obs), map((event) => ({
|
|
76
|
+
contextId: context.contextId,
|
|
77
|
+
taskId: context.taskId,
|
|
78
|
+
path: [`tool:${toolCall.toolName}`],
|
|
79
|
+
...event,
|
|
80
|
+
})));
|
|
74
81
|
};
|
package/dist/events/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyEvent, AuthCompletedEvent, AuthRequiredEvent, AuthType, ContentCompleteEvent, ContentDeltaEvent, ContextAnyEvent, ContextEvent, DatasetWriteEvent, DataWriteEvent, FileWriteEvent, FinishReason, InputProvider, InputReceivedEvent, InputRequiredEvent, InputType, InternalCheckpointEvent, InternalLLMCallEvent, InternalThoughtProcessEvent, JSONSchema, SubtaskCreatedEvent, TaskCompleteEvent, TaskCreatedEvent, TaskInitiator, TaskStatus, TaskStatusEvent, ThoughtStreamEvent, ThoughtType, ThoughtVerbosity, ToolCompleteEvent, ToolProgressEvent, ToolStartEvent } from '../types/event';
|
|
1
|
+
import type { AnyEvent, AuthCompletedEvent, AuthRequiredEvent, AuthType, ChildTaskEvent, ContentCompleteEvent, ContentDeltaEvent, ContextAnyEvent, ContextEvent, DatasetWriteEvent, DataWriteEvent, FileWriteEvent, FinishReason, InputProvider, InputReceivedEvent, InputRequiredEvent, InputType, InternalCheckpointEvent, InternalLLMCallEvent, InternalThoughtProcessEvent, JSONSchema, SubtaskCreatedEvent, TaskCompleteEvent, TaskCreatedEvent, TaskInitiator, TaskStatus, TaskStatusEvent, ThoughtStreamEvent, ThoughtType, ThoughtVerbosity, ToolCompleteEvent, ToolProgressEvent, ToolStartEvent } from '../types/event';
|
|
2
2
|
export declare function generateEventId(): string;
|
|
3
3
|
export interface CreateTaskCreatedEventOptions {
|
|
4
4
|
contextId: string;
|
|
@@ -38,22 +38,16 @@ export interface CreateTaskCompleteEventOptions {
|
|
|
38
38
|
}
|
|
39
39
|
export declare function createTaskCompleteEvent(options: CreateTaskCompleteEventOptions): ContextEvent<TaskCompleteEvent>;
|
|
40
40
|
export interface CreateContentDeltaEventOptions {
|
|
41
|
-
contextId: string;
|
|
42
|
-
taskId: string;
|
|
43
41
|
delta: string;
|
|
44
42
|
index: number;
|
|
45
43
|
}
|
|
46
|
-
export declare function createContentDeltaEvent(options: CreateContentDeltaEventOptions):
|
|
44
|
+
export declare function createContentDeltaEvent(options: CreateContentDeltaEventOptions): ContentDeltaEvent;
|
|
47
45
|
export interface CreateContentCompleteEventOptions {
|
|
48
|
-
contextId: string;
|
|
49
|
-
taskId: string;
|
|
50
46
|
content: string;
|
|
51
47
|
finishReason?: FinishReason;
|
|
52
48
|
}
|
|
53
|
-
export declare function createContentCompleteEvent(options: CreateContentCompleteEventOptions):
|
|
49
|
+
export declare function createContentCompleteEvent(options: CreateContentCompleteEventOptions): ContentCompleteEvent;
|
|
54
50
|
export interface CreateToolStartEventOptions {
|
|
55
|
-
contextId: string;
|
|
56
|
-
taskId: string;
|
|
57
51
|
toolCallId: string;
|
|
58
52
|
toolName: string;
|
|
59
53
|
arguments: Record<string, unknown>;
|
|
@@ -63,10 +57,8 @@ export interface CreateToolStartEventOptions {
|
|
|
63
57
|
[key: string]: unknown;
|
|
64
58
|
};
|
|
65
59
|
}
|
|
66
|
-
export declare function createToolStartEvent(options: CreateToolStartEventOptions):
|
|
60
|
+
export declare function createToolStartEvent(options: CreateToolStartEventOptions): ToolStartEvent;
|
|
67
61
|
export interface CreateToolProgressEventOptions {
|
|
68
|
-
contextId: string;
|
|
69
|
-
taskId: string;
|
|
70
62
|
toolCallId: string;
|
|
71
63
|
progress: number;
|
|
72
64
|
message?: string;
|
|
@@ -77,10 +69,8 @@ export interface CreateToolProgressEventOptions {
|
|
|
77
69
|
[key: string]: unknown;
|
|
78
70
|
};
|
|
79
71
|
}
|
|
80
|
-
export declare function createToolProgressEvent(options: CreateToolProgressEventOptions):
|
|
72
|
+
export declare function createToolProgressEvent(options: CreateToolProgressEventOptions): ToolProgressEvent;
|
|
81
73
|
export interface CreateToolCompleteEventOptions {
|
|
82
|
-
contextId: string;
|
|
83
|
-
taskId: string;
|
|
84
74
|
toolCallId: string;
|
|
85
75
|
toolName: string;
|
|
86
76
|
success: boolean;
|
|
@@ -93,10 +83,8 @@ export interface CreateToolCompleteEventOptions {
|
|
|
93
83
|
[key: string]: unknown;
|
|
94
84
|
};
|
|
95
85
|
}
|
|
96
|
-
export declare function createToolCompleteEvent(options: CreateToolCompleteEventOptions):
|
|
86
|
+
export declare function createToolCompleteEvent(options: CreateToolCompleteEventOptions): ToolCompleteEvent;
|
|
97
87
|
export interface CreateInputRequiredEventOptions {
|
|
98
|
-
contextId: string;
|
|
99
|
-
taskId: string;
|
|
100
88
|
inputId: string;
|
|
101
89
|
requireUser?: boolean;
|
|
102
90
|
inputType: InputType;
|
|
@@ -105,10 +93,8 @@ export interface CreateInputRequiredEventOptions {
|
|
|
105
93
|
options?: unknown[];
|
|
106
94
|
metadata?: Record<string, unknown>;
|
|
107
95
|
}
|
|
108
|
-
export declare function createInputRequiredEvent(options: CreateInputRequiredEventOptions):
|
|
96
|
+
export declare function createInputRequiredEvent(options: CreateInputRequiredEventOptions): InputRequiredEvent;
|
|
109
97
|
export interface CreateInputReceivedEventOptions {
|
|
110
|
-
contextId: string;
|
|
111
|
-
taskId: string;
|
|
112
98
|
inputId: string;
|
|
113
99
|
providedBy: InputProvider;
|
|
114
100
|
userId?: string;
|
|
@@ -118,10 +104,8 @@ export interface CreateInputReceivedEventOptions {
|
|
|
118
104
|
[key: string]: unknown;
|
|
119
105
|
};
|
|
120
106
|
}
|
|
121
|
-
export declare function createInputReceivedEvent(options: CreateInputReceivedEventOptions):
|
|
107
|
+
export declare function createInputReceivedEvent(options: CreateInputReceivedEventOptions): InputReceivedEvent;
|
|
122
108
|
export interface CreateAuthRequiredEventOptions {
|
|
123
|
-
contextId: string;
|
|
124
|
-
taskId: string;
|
|
125
109
|
authId: string;
|
|
126
110
|
authType: AuthType;
|
|
127
111
|
provider?: string;
|
|
@@ -133,10 +117,8 @@ export interface CreateAuthRequiredEventOptions {
|
|
|
133
117
|
[key: string]: unknown;
|
|
134
118
|
};
|
|
135
119
|
}
|
|
136
|
-
export declare function createAuthRequiredEvent(options: CreateAuthRequiredEventOptions):
|
|
120
|
+
export declare function createAuthRequiredEvent(options: CreateAuthRequiredEventOptions): AuthRequiredEvent;
|
|
137
121
|
export interface CreateAuthCompletedEventOptions {
|
|
138
|
-
contextId: string;
|
|
139
|
-
taskId: string;
|
|
140
122
|
authId: string;
|
|
141
123
|
userId: string;
|
|
142
124
|
metadata?: {
|
|
@@ -144,10 +126,8 @@ export interface CreateAuthCompletedEventOptions {
|
|
|
144
126
|
[key: string]: unknown;
|
|
145
127
|
};
|
|
146
128
|
}
|
|
147
|
-
export declare function createAuthCompletedEvent(options: CreateAuthCompletedEventOptions):
|
|
129
|
+
export declare function createAuthCompletedEvent(options: CreateAuthCompletedEventOptions): AuthCompletedEvent;
|
|
148
130
|
export interface CreateFileWriteEventOptions {
|
|
149
|
-
contextId: string;
|
|
150
|
-
taskId: string;
|
|
151
131
|
artifactId: string;
|
|
152
132
|
data: string;
|
|
153
133
|
index: number;
|
|
@@ -162,10 +142,8 @@ export interface CreateFileWriteEventOptions {
|
|
|
162
142
|
[key: string]: unknown;
|
|
163
143
|
};
|
|
164
144
|
}
|
|
165
|
-
export declare function createFileWriteEvent(options: CreateFileWriteEventOptions):
|
|
145
|
+
export declare function createFileWriteEvent(options: CreateFileWriteEventOptions): FileWriteEvent;
|
|
166
146
|
export interface CreateDataWriteEventOptions {
|
|
167
|
-
contextId: string;
|
|
168
|
-
taskId: string;
|
|
169
147
|
artifactId: string;
|
|
170
148
|
data: Record<string, unknown>;
|
|
171
149
|
name?: string;
|
|
@@ -176,10 +154,8 @@ export interface CreateDataWriteEventOptions {
|
|
|
176
154
|
[key: string]: unknown;
|
|
177
155
|
};
|
|
178
156
|
}
|
|
179
|
-
export declare function createDataWriteEvent(options: CreateDataWriteEventOptions):
|
|
157
|
+
export declare function createDataWriteEvent(options: CreateDataWriteEventOptions): DataWriteEvent;
|
|
180
158
|
export interface CreateDatasetWriteEventOptions {
|
|
181
|
-
contextId: string;
|
|
182
|
-
taskId: string;
|
|
183
159
|
artifactId: string;
|
|
184
160
|
rows: Record<string, unknown>[];
|
|
185
161
|
index: number;
|
|
@@ -194,18 +170,14 @@ export interface CreateDatasetWriteEventOptions {
|
|
|
194
170
|
[key: string]: unknown;
|
|
195
171
|
};
|
|
196
172
|
}
|
|
197
|
-
export declare function createDatasetWriteEvent(options: CreateDatasetWriteEventOptions):
|
|
173
|
+
export declare function createDatasetWriteEvent(options: CreateDatasetWriteEventOptions): DatasetWriteEvent;
|
|
198
174
|
export interface CreateSubtaskCreatedEventOptions {
|
|
199
|
-
contextId: string;
|
|
200
|
-
taskId: string;
|
|
201
175
|
subtaskId: string;
|
|
202
176
|
agentId?: string;
|
|
203
177
|
prompt: string;
|
|
204
178
|
}
|
|
205
|
-
export declare function createSubtaskCreatedEvent(options: CreateSubtaskCreatedEventOptions):
|
|
179
|
+
export declare function createSubtaskCreatedEvent(options: CreateSubtaskCreatedEventOptions): SubtaskCreatedEvent;
|
|
206
180
|
export interface CreateThoughtStreamEventOptions {
|
|
207
|
-
contextId: string;
|
|
208
|
-
taskId: string;
|
|
209
181
|
thoughtId: string;
|
|
210
182
|
thoughtType: ThoughtType;
|
|
211
183
|
verbosity: ThoughtVerbosity;
|
|
@@ -218,34 +190,28 @@ export interface CreateThoughtStreamEventOptions {
|
|
|
218
190
|
[key: string]: unknown;
|
|
219
191
|
};
|
|
220
192
|
}
|
|
221
|
-
export declare function createThoughtStreamEvent(options: CreateThoughtStreamEventOptions):
|
|
193
|
+
export declare function createThoughtStreamEvent(options: CreateThoughtStreamEventOptions): ThoughtStreamEvent;
|
|
222
194
|
export interface CreateInternalThoughtProcessEventOptions {
|
|
223
|
-
contextId: string;
|
|
224
|
-
taskId: string;
|
|
225
195
|
iteration: number;
|
|
226
196
|
stage: 'pre-llm' | 'post-llm' | 'pre-tool' | 'post-tool';
|
|
227
197
|
reasoning: string;
|
|
228
198
|
state: Record<string, unknown>;
|
|
229
199
|
}
|
|
230
|
-
export declare function createInternalThoughtProcessEvent(options: CreateInternalThoughtProcessEventOptions):
|
|
200
|
+
export declare function createInternalThoughtProcessEvent(options: CreateInternalThoughtProcessEventOptions): InternalThoughtProcessEvent;
|
|
231
201
|
export interface CreateInternalLLMCallEventOptions {
|
|
232
|
-
contextId: string;
|
|
233
|
-
taskId: string;
|
|
234
202
|
iteration: number;
|
|
235
203
|
messageCount: number;
|
|
236
204
|
toolCount: number;
|
|
237
205
|
}
|
|
238
|
-
export declare function createInternalLLMCallEvent(options: CreateInternalLLMCallEventOptions):
|
|
206
|
+
export declare function createInternalLLMCallEvent(options: CreateInternalLLMCallEventOptions): InternalLLMCallEvent;
|
|
239
207
|
export interface CreateInternalCheckpointEventOptions {
|
|
240
|
-
contextId: string;
|
|
241
|
-
taskId: string;
|
|
242
208
|
iteration: number;
|
|
243
209
|
}
|
|
244
|
-
export declare function createInternalCheckpointEvent(options: CreateInternalCheckpointEventOptions):
|
|
210
|
+
export declare function createInternalCheckpointEvent(options: CreateInternalCheckpointEventOptions): InternalCheckpointEvent;
|
|
245
211
|
export declare function filterExternalEvents(events: ContextAnyEvent[]): ContextAnyEvent[];
|
|
246
212
|
export declare function filterByTaskId(events: ContextAnyEvent[], taskId: string): ContextAnyEvent[];
|
|
247
213
|
export declare function filterByContextId(events: ContextAnyEvent[], contextId: string): ContextAnyEvent[];
|
|
248
214
|
export declare function filterByKind<K extends ContextAnyEvent['kind']>(events: ContextAnyEvent[], kind: K): Extract<ContextAnyEvent, {
|
|
249
215
|
kind: K;
|
|
250
216
|
}>[];
|
|
251
|
-
export declare const isChildTaskEvent: (event: AnyEvent) =>
|
|
217
|
+
export declare const isChildTaskEvent: (event: AnyEvent) => event is ChildTaskEvent<ContextAnyEvent>;
|
package/dist/events/utils.js
CHANGED
|
@@ -37,8 +37,6 @@ export function createTaskCompleteEvent(options) {
|
|
|
37
37
|
export function createContentDeltaEvent(options) {
|
|
38
38
|
return {
|
|
39
39
|
kind: 'content-delta',
|
|
40
|
-
contextId: options.contextId,
|
|
41
|
-
taskId: options.taskId,
|
|
42
40
|
delta: options.delta,
|
|
43
41
|
index: options.index,
|
|
44
42
|
timestamp: new Date().toISOString(),
|
|
@@ -47,8 +45,6 @@ export function createContentDeltaEvent(options) {
|
|
|
47
45
|
export function createContentCompleteEvent(options) {
|
|
48
46
|
return {
|
|
49
47
|
kind: 'content-complete',
|
|
50
|
-
contextId: options.contextId,
|
|
51
|
-
taskId: options.taskId,
|
|
52
48
|
content: options.content,
|
|
53
49
|
finishReason: options.finishReason || 'stop',
|
|
54
50
|
timestamp: new Date().toISOString(),
|
|
@@ -57,8 +53,6 @@ export function createContentCompleteEvent(options) {
|
|
|
57
53
|
export function createToolStartEvent(options) {
|
|
58
54
|
return {
|
|
59
55
|
kind: 'tool-start',
|
|
60
|
-
contextId: options.contextId,
|
|
61
|
-
taskId: options.taskId,
|
|
62
56
|
toolCallId: options.toolCallId,
|
|
63
57
|
toolName: options.toolName,
|
|
64
58
|
arguments: options.arguments,
|
|
@@ -69,8 +63,6 @@ export function createToolStartEvent(options) {
|
|
|
69
63
|
export function createToolProgressEvent(options) {
|
|
70
64
|
return {
|
|
71
65
|
kind: 'tool-progress',
|
|
72
|
-
contextId: options.contextId,
|
|
73
|
-
taskId: options.taskId,
|
|
74
66
|
toolCallId: options.toolCallId,
|
|
75
67
|
progress: options.progress,
|
|
76
68
|
message: options.message,
|
|
@@ -81,8 +73,6 @@ export function createToolProgressEvent(options) {
|
|
|
81
73
|
export function createToolCompleteEvent(options) {
|
|
82
74
|
return {
|
|
83
75
|
kind: 'tool-complete',
|
|
84
|
-
contextId: options.contextId,
|
|
85
|
-
taskId: options.taskId,
|
|
86
76
|
toolCallId: options.toolCallId,
|
|
87
77
|
toolName: options.toolName,
|
|
88
78
|
success: options.success,
|
|
@@ -95,8 +85,6 @@ export function createToolCompleteEvent(options) {
|
|
|
95
85
|
export function createInputRequiredEvent(options) {
|
|
96
86
|
return {
|
|
97
87
|
kind: 'input-required',
|
|
98
|
-
contextId: options.contextId,
|
|
99
|
-
taskId: options.taskId,
|
|
100
88
|
inputId: options.inputId,
|
|
101
89
|
requireUser: options.requireUser,
|
|
102
90
|
inputType: options.inputType,
|
|
@@ -110,8 +98,6 @@ export function createInputRequiredEvent(options) {
|
|
|
110
98
|
export function createInputReceivedEvent(options) {
|
|
111
99
|
return {
|
|
112
100
|
kind: 'input-received',
|
|
113
|
-
contextId: options.contextId,
|
|
114
|
-
taskId: options.taskId,
|
|
115
101
|
inputId: options.inputId,
|
|
116
102
|
providedBy: options.providedBy,
|
|
117
103
|
userId: options.userId,
|
|
@@ -123,8 +109,6 @@ export function createInputReceivedEvent(options) {
|
|
|
123
109
|
export function createAuthRequiredEvent(options) {
|
|
124
110
|
return {
|
|
125
111
|
kind: 'auth-required',
|
|
126
|
-
contextId: options.contextId,
|
|
127
|
-
taskId: options.taskId,
|
|
128
112
|
authId: options.authId,
|
|
129
113
|
authType: options.authType,
|
|
130
114
|
provider: options.provider,
|
|
@@ -138,8 +122,6 @@ export function createAuthRequiredEvent(options) {
|
|
|
138
122
|
export function createAuthCompletedEvent(options) {
|
|
139
123
|
return {
|
|
140
124
|
kind: 'auth-completed',
|
|
141
|
-
contextId: options.contextId,
|
|
142
|
-
taskId: options.taskId,
|
|
143
125
|
authId: options.authId,
|
|
144
126
|
userId: options.userId,
|
|
145
127
|
timestamp: new Date().toISOString(),
|
|
@@ -149,8 +131,6 @@ export function createAuthCompletedEvent(options) {
|
|
|
149
131
|
export function createFileWriteEvent(options) {
|
|
150
132
|
return {
|
|
151
133
|
kind: 'file-write',
|
|
152
|
-
contextId: options.contextId,
|
|
153
|
-
taskId: options.taskId,
|
|
154
134
|
artifactId: options.artifactId,
|
|
155
135
|
data: options.data,
|
|
156
136
|
index: options.index,
|
|
@@ -166,8 +146,6 @@ export function createFileWriteEvent(options) {
|
|
|
166
146
|
export function createDataWriteEvent(options) {
|
|
167
147
|
return {
|
|
168
148
|
kind: 'data-write',
|
|
169
|
-
contextId: options.contextId,
|
|
170
|
-
taskId: options.taskId,
|
|
171
149
|
artifactId: options.artifactId,
|
|
172
150
|
data: options.data,
|
|
173
151
|
name: options.name,
|
|
@@ -179,8 +157,6 @@ export function createDataWriteEvent(options) {
|
|
|
179
157
|
export function createDatasetWriteEvent(options) {
|
|
180
158
|
return {
|
|
181
159
|
kind: 'dataset-write',
|
|
182
|
-
contextId: options.contextId,
|
|
183
|
-
taskId: options.taskId,
|
|
184
160
|
artifactId: options.artifactId,
|
|
185
161
|
rows: options.rows,
|
|
186
162
|
index: options.index,
|
|
@@ -195,8 +171,6 @@ export function createDatasetWriteEvent(options) {
|
|
|
195
171
|
export function createSubtaskCreatedEvent(options) {
|
|
196
172
|
return {
|
|
197
173
|
kind: 'subtask-created',
|
|
198
|
-
contextId: options.contextId,
|
|
199
|
-
taskId: options.taskId,
|
|
200
174
|
subtaskId: options.subtaskId,
|
|
201
175
|
agentId: options.agentId,
|
|
202
176
|
prompt: options.prompt,
|
|
@@ -206,8 +180,6 @@ export function createSubtaskCreatedEvent(options) {
|
|
|
206
180
|
export function createThoughtStreamEvent(options) {
|
|
207
181
|
return {
|
|
208
182
|
kind: 'thought-stream',
|
|
209
|
-
contextId: options.contextId,
|
|
210
|
-
taskId: options.taskId,
|
|
211
183
|
thoughtId: options.thoughtId,
|
|
212
184
|
thoughtType: options.thoughtType,
|
|
213
185
|
verbosity: options.verbosity,
|
|
@@ -220,8 +192,6 @@ export function createThoughtStreamEvent(options) {
|
|
|
220
192
|
export function createInternalThoughtProcessEvent(options) {
|
|
221
193
|
return {
|
|
222
194
|
kind: 'internal:thought-process',
|
|
223
|
-
contextId: options.contextId,
|
|
224
|
-
taskId: options.taskId,
|
|
225
195
|
iteration: options.iteration,
|
|
226
196
|
stage: options.stage,
|
|
227
197
|
reasoning: options.reasoning,
|
|
@@ -232,8 +202,6 @@ export function createInternalThoughtProcessEvent(options) {
|
|
|
232
202
|
export function createInternalLLMCallEvent(options) {
|
|
233
203
|
return {
|
|
234
204
|
kind: 'internal:llm-call',
|
|
235
|
-
contextId: options.contextId,
|
|
236
|
-
taskId: options.taskId,
|
|
237
205
|
iteration: options.iteration,
|
|
238
206
|
messageCount: options.messageCount,
|
|
239
207
|
toolCount: options.toolCount,
|
|
@@ -243,8 +211,6 @@ export function createInternalLLMCallEvent(options) {
|
|
|
243
211
|
export function createInternalCheckpointEvent(options) {
|
|
244
212
|
return {
|
|
245
213
|
kind: 'internal:checkpoint',
|
|
246
|
-
contextId: options.contextId,
|
|
247
|
-
taskId: options.taskId,
|
|
248
214
|
iteration: options.iteration,
|
|
249
215
|
timestamp: new Date().toISOString(),
|
|
250
216
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './core';
|
|
2
2
|
export * from './events';
|
|
3
3
|
export * from './observability';
|
|
4
|
+
export * from './plugins';
|
|
4
5
|
export * from './providers';
|
|
5
6
|
export * from './server';
|
|
6
|
-
export * from './skills';
|
|
7
7
|
export * from './stores';
|
|
8
8
|
export * from './tools';
|
|
9
9
|
export * from './types';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './core';
|
|
2
2
|
export * from './events';
|
|
3
3
|
export * from './observability';
|
|
4
|
+
export * from './plugins';
|
|
4
5
|
export * from './providers';
|
|
5
6
|
export * from './server';
|
|
6
|
-
export * from './skills';
|
|
7
7
|
export * from './stores';
|
|
8
8
|
export * from './tools';
|
|
9
9
|
export * from './types';
|