@roj-ai/shared 0.0.2

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 (72) hide show
  1. package/dist/chat-protocol.d.ts +60 -0
  2. package/dist/chat-protocol.d.ts.map +1 -0
  3. package/dist/index.d.ts +13 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/lib/domain-utils.d.ts +16 -0
  6. package/dist/lib/domain-utils.d.ts.map +1 -0
  7. package/dist/lib/ids.d.ts +18 -0
  8. package/dist/lib/ids.d.ts.map +1 -0
  9. package/dist/lib/result.d.ts +26 -0
  10. package/dist/lib/result.d.ts.map +1 -0
  11. package/dist/projections/agent-detail-projection.d.ts +91 -0
  12. package/dist/projections/agent-detail-projection.d.ts.map +1 -0
  13. package/dist/projections/agent-registry.d.ts +16 -0
  14. package/dist/projections/agent-registry.d.ts.map +1 -0
  15. package/dist/projections/agent-tree-projection.d.ts +30 -0
  16. package/dist/projections/agent-tree-projection.d.ts.map +1 -0
  17. package/dist/projections/chat-debug.d.ts +34 -0
  18. package/dist/projections/chat-debug.d.ts.map +1 -0
  19. package/dist/projections/events.d.ts +9 -0
  20. package/dist/projections/events.d.ts.map +1 -0
  21. package/dist/projections/index.d.ts +22 -0
  22. package/dist/projections/index.d.ts.map +1 -0
  23. package/dist/projections/mailbox.d.ts +21 -0
  24. package/dist/projections/mailbox.d.ts.map +1 -0
  25. package/dist/projections/metrics.d.ts +30 -0
  26. package/dist/projections/metrics.d.ts.map +1 -0
  27. package/dist/projections/protocol-status.d.ts +9 -0
  28. package/dist/projections/protocol-status.d.ts.map +1 -0
  29. package/dist/projections/services-projection.d.ts +24 -0
  30. package/dist/projections/services-projection.d.ts.map +1 -0
  31. package/dist/projections/session-info.d.ts +19 -0
  32. package/dist/projections/session-info.d.ts.map +1 -0
  33. package/dist/projections/timeline.d.ts +26 -0
  34. package/dist/projections/timeline.d.ts.map +1 -0
  35. package/dist/projections/types.d.ts +182 -0
  36. package/dist/projections/types.d.ts.map +1 -0
  37. package/dist/rpc/client.d.ts +79 -0
  38. package/dist/rpc/client.d.ts.map +1 -0
  39. package/dist/rpc/index.d.ts +9 -0
  40. package/dist/rpc/index.d.ts.map +1 -0
  41. package/dist/src/api-types.d.ts +8 -0
  42. package/dist/src/index.d.ts +17 -0
  43. package/dist/src/rpc/admin-methods.d.ts +99 -0
  44. package/dist/src/rpc/client.d.ts +26 -0
  45. package/dist/src/rpc/definition.d.ts +39 -0
  46. package/dist/src/rpc/instance-methods.d.ts +94 -0
  47. package/dist/src/rpc/methods.d.ts +260 -0
  48. package/dist/src/rpc/server.d.ts +21 -0
  49. package/dist/src/workspace-config.d.ts +16 -0
  50. package/dist/tsconfig.tsbuildinfo +1 -0
  51. package/package.json +36 -0
  52. package/src/chat-protocol.ts +46 -0
  53. package/src/globals.d.ts +3 -0
  54. package/src/index.ts +82 -0
  55. package/src/lib/domain-utils.ts +26 -0
  56. package/src/lib/ids.ts +19 -0
  57. package/src/lib/result.ts +35 -0
  58. package/src/projections/agent-detail-projection.ts +623 -0
  59. package/src/projections/agent-registry.ts +37 -0
  60. package/src/projections/agent-tree-projection.ts +229 -0
  61. package/src/projections/chat-debug.ts +260 -0
  62. package/src/projections/events.ts +10 -0
  63. package/src/projections/index.ts +59 -0
  64. package/src/projections/mailbox.ts +113 -0
  65. package/src/projections/metrics.ts +111 -0
  66. package/src/projections/protocol-status.ts +23 -0
  67. package/src/projections/services-projection.ts +89 -0
  68. package/src/projections/session-info.ts +47 -0
  69. package/src/projections/timeline.ts +228 -0
  70. package/src/projections/types.ts +237 -0
  71. package/src/rpc/client.ts +188 -0
  72. package/src/rpc/index.ts +14 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Chat protocol types — shared between agent-server and platform SDK.
3
+ *
4
+ * Defines the shape of chat messages and ask_user input types.
5
+ */
6
+ import type { ChatMessageId } from './lib/ids.js';
7
+ export interface UserChatMessage {
8
+ type: 'user_message';
9
+ messageId: ChatMessageId;
10
+ content: string;
11
+ timestamp: number;
12
+ }
13
+ export interface AgentChatMessage {
14
+ type: 'agent_message';
15
+ messageId: ChatMessageId;
16
+ content: string;
17
+ format: 'text' | 'markdown';
18
+ timestamp: number;
19
+ }
20
+ export interface AskUserChatMessage {
21
+ type: 'ask_user';
22
+ questionId: ChatMessageId;
23
+ question: string;
24
+ inputType: AskUserInputType;
25
+ answered: boolean;
26
+ answer?: unknown;
27
+ timestamp: number;
28
+ }
29
+ export type ChatMessage = UserChatMessage | AgentChatMessage | AskUserChatMessage;
30
+ export type AskUserOption = {
31
+ value: string;
32
+ label: string;
33
+ description?: string;
34
+ };
35
+ export type AskUserInputType = {
36
+ type: 'text';
37
+ placeholder?: string;
38
+ multiline?: boolean;
39
+ } | {
40
+ type: 'single_choice';
41
+ options: AskUserOption[];
42
+ } | {
43
+ type: 'multi_choice';
44
+ options: AskUserOption[];
45
+ minSelect?: number;
46
+ maxSelect?: number;
47
+ } | {
48
+ type: 'rating';
49
+ min: number;
50
+ max: number;
51
+ labels?: {
52
+ min?: string;
53
+ max?: string;
54
+ };
55
+ } | {
56
+ type: 'confirm';
57
+ confirmLabel?: string;
58
+ cancelLabel?: string;
59
+ };
60
+ //# sourceMappingURL=chat-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-protocol.d.ts","sourceRoot":"","sources":["../src/chat-protocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,WAAW,eAAe;IAC/B,IAAI,EAAE,cAAc,CAAA;IACpB,SAAS,EAAE,aAAa,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,eAAe,CAAA;IACrB,SAAS,EAAE,aAAa,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,GAAG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 @@
1
+ /**
2
+ * @roj-ai/shared
3
+ *
4
+ * Shared projections and utilities for Roj packages.
5
+ * Pure functions with no runtime dependencies beyond @roj-ai/sdk types.
6
+ */
7
+ export { AgentId, ChatMessageId, SessionId } from './lib/ids.js';
8
+ export type { AgentId as AgentIdType, ChatMessageId as ChatMessageIdType, SessionId as SessionIdType } from './lib/ids.js';
9
+ export type { AgentChatMessage, AskUserChatMessage, AskUserInputType, AskUserOption, ChatMessage, UserChatMessage, } from './chat-protocol.js';
10
+ export { contentToString, isDomainEvent } from './lib/domain-utils.js';
11
+ export { applyEventToAgentDetail, applyEventToAgentRegistry, applyEventToAgentTree, applyEventToChatDebug, applyEventToMailbox, applyEventToMetrics, applyEventToServices, applyEventToSessionInfo, applyEventToTimeline, buildAgentTreeFromProjection, createAgentDetailProjectionState, createAgentRegistryState, createAgentTreeProjectionState, createChatDebugState, createMailboxState, createMetricsState, createServicesProjectionState, createSessionInfoState, createTimelineState, getAgentDetail, getAgentName, getChatDebugMessages, getMailboxMessages, getTimelineItems, metricsStateToResponse, toProtocolStatus, } from './projections/index.js';
12
+ export type { AgentDetailProjectionState, AgentRegistryState, AgentTreeNode, AgentTreeProjectionState, AssistantConversationMessageView, ChatDebugState, ConversationMessageView, DebugChatMessage, GetAgentDetailResponse, GetEventsResponse, GetMetricsResponse, GlobalMailboxMessage, MailboxMessageView, MailboxState, MetricsState, ProjectionEvent, ServiceEntry, ServicesProjectionState, ServiceStatus, SessionInfoState, SystemConversationMessageView, TimelineItem, TimelineState, ToolCallView, ToolConversationMessageView, UserConversationMessageView, } from './projections/index.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAChE,YAAY,EAAE,OAAO,IAAI,WAAW,EAAE,aAAa,IAAI,iBAAiB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,cAAc,CAAA;AAG1H,YAAY,EACX,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,eAAe,GACf,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAGtE,OAAO,EACN,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,4BAA4B,EAC5B,gCAAgC,EAChC,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,GAChB,MAAM,wBAAwB,CAAA;AAE/B,YAAY,EACX,0BAA0B,EAC1B,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,gCAAgC,EAChC,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,uBAAuB,EACvB,aAAa,EACb,gBAAgB,EAChB,6BAA6B,EAC7B,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Domain utility functions for client-side use.
3
+ */
4
+ import type { DomainEvent } from '@roj-ai/sdk';
5
+ /**
6
+ * Type guard to check if an unknown value is a DomainEvent.
7
+ */
8
+ export declare const isDomainEvent: (event: unknown) => event is DomainEvent;
9
+ /**
10
+ * Helper to normalize content to string (for display/logging).
11
+ */
12
+ export declare const contentToString: (content: string | Array<{
13
+ type: string;
14
+ text?: string;
15
+ }>) => string;
16
+ //# sourceMappingURL=domain-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-utils.d.ts","sourceRoot":"","sources":["../../src/lib/domain-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,WAKhC,CAAA;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS,MAAM,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,KAAG,MAM1F,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Branded ID types and constructors.
3
+ *
4
+ * Uses Zod brands for structural compatibility with agent-server types.
5
+ * These are the canonical definitions — other packages import from here.
6
+ */
7
+ import z from 'zod/v4';
8
+ declare const sessionIdSchema: z.core.$ZodBranded<z.ZodString, "SessionId", "out">;
9
+ export type SessionId = z.infer<typeof sessionIdSchema>;
10
+ export declare const SessionId: (id: string) => SessionId;
11
+ declare const agentIdSchema: z.core.$ZodBranded<z.ZodString, "AgentId", "out">;
12
+ export type AgentId = z.infer<typeof agentIdSchema>;
13
+ export declare const AgentId: (id: string) => AgentId;
14
+ declare const chatMessageIdSchema: z.core.$ZodBranded<z.ZodString, "ChatMessageId", "out">;
15
+ export type ChatMessageId = z.infer<typeof chatMessageIdSchema>;
16
+ export declare const ChatMessageId: (id: string) => ChatMessageId;
17
+ export {};
18
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../src/lib/ids.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,CAAC,MAAM,QAAQ,CAAA;AAEtB,QAAA,MAAM,eAAe,qDAAgC,CAAA;AACrD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AACvD,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,SAA4B,CAAA;AAEnE,QAAA,MAAM,aAAa,mDAA8B,CAAA;AACjD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,eAAO,MAAM,OAAO,GAAI,IAAI,MAAM,KAAG,OAAwB,CAAA;AAE7D,QAAA,MAAM,mBAAmB,yDAAoC,CAAA;AAC7D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,eAAO,MAAM,aAAa,GAAI,IAAI,MAAM,KAAG,aAAoC,CAAA"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Result type for explicit error handling without exceptions.
3
+ * Inspired by Rust/Go approach.
4
+ */
5
+ export type Result<T, E = Error> = {
6
+ ok: true;
7
+ value: T;
8
+ } | {
9
+ ok: false;
10
+ error: E;
11
+ };
12
+ export declare const Ok: <T>(value: T) => Result<T, never>;
13
+ export declare const Err: <E>(error: E) => Result<never, E>;
14
+ export declare const isOk: <T, E>(result: Result<T, E>) => result is {
15
+ ok: true;
16
+ value: T;
17
+ };
18
+ export declare const isErr: <T, E>(result: Result<T, E>) => result is {
19
+ ok: false;
20
+ error: E;
21
+ };
22
+ export declare const mapResult: <T, U, E>(result: Result<T, E>, fn: (value: T) => U) => Result<U, E>;
23
+ export declare const flatMapResult: <T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>) => Result<U, E>;
24
+ export declare const unwrapOr: <T, E>(result: Result<T, E>, defaultValue: T) => T;
25
+ export declare const unwrapOrThrow: <T, E>(result: Result<T, E>) => T;
26
+ //# sourceMappingURL=result.d.ts.map
@@ -0,0 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K,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAC5B,MAAM,CAAC,CAAC,EAAE,CAAC,CAA0C,CAAA;AAGxD,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,KAAG,CAA4C,CAAA;AAEnH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAG,CAG1D,CAAA"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Agent detail projection - self-contained projection for agent detail views.
3
+ *
4
+ * Replaces useAgentDetail (client) and buildAgentDetail (CLI) that needed full SessionState.
5
+ * Tracks per-agent: conversation history, tool calls, mailbox, counters, skills.
6
+ */
7
+ import type { AgentCounters, AgentId, AgentPauseReason, LLMCallId, MessageId, ToolCallId } from '@roj-ai/sdk';
8
+ import type { ProjectionEvent } from './events.js';
9
+ import type { GetAgentDetailResponse } from './types.js';
10
+ interface LLMMessage {
11
+ role: 'user' | 'assistant' | 'tool' | 'system';
12
+ content: string | Array<{
13
+ type: string;
14
+ text?: string;
15
+ }>;
16
+ toolCalls?: Array<{
17
+ id: ToolCallId;
18
+ name: string;
19
+ input: unknown;
20
+ }>;
21
+ toolCallId?: ToolCallId;
22
+ isError?: boolean;
23
+ sourceMessageIds?: MessageId[];
24
+ timestamp?: number;
25
+ cost?: number;
26
+ llmCallId?: LLMCallId;
27
+ promptTokens?: number;
28
+ cachedTokens?: number;
29
+ cacheWriteTokens?: number;
30
+ }
31
+ interface ToolCall {
32
+ id: ToolCallId;
33
+ name: string;
34
+ input: unknown;
35
+ }
36
+ interface PendingToolResult {
37
+ toolCallId: ToolCallId;
38
+ toolName: string;
39
+ timestamp: number;
40
+ isError: boolean;
41
+ content: string | Array<{
42
+ type: string;
43
+ text?: string;
44
+ }>;
45
+ }
46
+ interface AgentViewModel {
47
+ id: AgentId;
48
+ definitionName: string;
49
+ status: 'pending' | 'inferring' | 'tool_exec' | 'errored' | 'paused';
50
+ parentId: AgentId | null;
51
+ conversationHistory: LLMMessage[];
52
+ pendingToolCalls: ToolCall[];
53
+ executingToolCall?: {
54
+ toolCallId: ToolCallId;
55
+ toolName: string;
56
+ startedAt: number;
57
+ };
58
+ pendingToolResults: PendingToolResult[];
59
+ /** Messages pending addition to history (set by inference_started, committed by inference_completed) */
60
+ pendingMessages: LLMMessage[];
61
+ typedInput?: unknown;
62
+ pauseReason?: AgentPauseReason;
63
+ pauseMessage?: string;
64
+ cost: number;
65
+ }
66
+ interface MailboxEntry {
67
+ id: MessageId;
68
+ from: string;
69
+ content: string;
70
+ timestamp: number;
71
+ consumed: boolean;
72
+ }
73
+ interface LoadedSkillEntry {
74
+ id: string;
75
+ name: string;
76
+ loadedAt: number;
77
+ }
78
+ export interface AgentDetailProjectionState {
79
+ agents: Map<AgentId, AgentViewModel>;
80
+ agentMailboxes: Map<AgentId, MailboxEntry[]>;
81
+ agentCounters: Map<AgentId, AgentCounters>;
82
+ agentSkills: Map<AgentId, LoadedSkillEntry[]>;
83
+ }
84
+ export declare function createAgentDetailProjectionState(): AgentDetailProjectionState;
85
+ export declare function applyEventToAgentDetail(state: AgentDetailProjectionState, event: ProjectionEvent): AgentDetailProjectionState;
86
+ /**
87
+ * Get agent detail response from projection state.
88
+ */
89
+ export declare function getAgentDetail(state: AgentDetailProjectionState, agentId: AgentId): GetAgentDetailResponse | null;
90
+ export {};
91
+ //# sourceMappingURL=agent-detail-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-detail-projection.d.ts","sourceRoot":"","sources":["../../src/projections/agent-detail-projection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAE7G,OAA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gBD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,0BAA0B,EAAE,KAAK,EAAE,eAAe,GAAG,0BAA0B,CAqY7H;AAQD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,0BAA0B,EAAE,OAAO,EAAE,OAAO,GAAG,sBAAsB,GAAG,IAAI,CA+GjH"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Agent registry projection - tracks agent names and count.
3
+ *
4
+ * Minimal projection that replaces SessionState for name lookups.
5
+ * Handles only agent_spawned events.
6
+ */
7
+ import type { AgentId } from '@roj-ai/sdk';
8
+ import type { ProjectionEvent } from './events.js';
9
+ export interface AgentRegistryState {
10
+ names: Map<AgentId, string>;
11
+ count: number;
12
+ }
13
+ export declare function createAgentRegistryState(): AgentRegistryState;
14
+ export declare function applyEventToAgentRegistry(state: AgentRegistryState, event: ProjectionEvent): AgentRegistryState;
15
+ export declare function getAgentName(state: AgentRegistryState, agentId: AgentId | string): string;
16
+ //# sourceMappingURL=agent-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-registry.d.ts","sourceRoot":"","sources":["../../src/projections/agent-registry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,WAAW,kBAAkB;IAClC,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,wBAAwB,IAAI,kBAAkB,CAK7D;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,eAAe,GAAG,kBAAkB,CAU/G;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAEzF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Agent tree projection - self-contained projection for building agent tree.
3
+ *
4
+ * Replaces the old buildAgentTree() that needed full SessionState.
5
+ * Tracks per-agent: status, parent, pending tool call count, executing flag, mailbox counts.
6
+ */
7
+ import type { AgentId } from '@roj-ai/sdk';
8
+ import type { ProjectionEvent } from './events.js';
9
+ import type { AgentTreeNode } from './types.js';
10
+ interface AgentTreeEntry {
11
+ id: AgentId;
12
+ definitionName: string;
13
+ status: 'pending' | 'inferring' | 'tool_exec' | 'errored' | 'paused';
14
+ parentId: AgentId | null;
15
+ pendingToolCallCount: number;
16
+ isExecuting: boolean;
17
+ mailboxUnconsumedCount: number;
18
+ cost: number;
19
+ }
20
+ export interface AgentTreeProjectionState {
21
+ agents: Map<AgentId, AgentTreeEntry>;
22
+ }
23
+ export declare function createAgentTreeProjectionState(): AgentTreeProjectionState;
24
+ export declare function applyEventToAgentTree(state: AgentTreeProjectionState, event: ProjectionEvent): AgentTreeProjectionState;
25
+ /**
26
+ * Build agent tree nodes from projection state.
27
+ */
28
+ export declare function buildAgentTreeFromProjection(state: AgentTreeProjectionState): AgentTreeNode[];
29
+ export {};
30
+ //# sourceMappingURL=agent-tree-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-tree-projection.d.ts","sourceRoot":"","sources":["../../src/projections/agent-tree-projection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAM/C,UAAU,cAAc;IACvB,EAAE,EAAE,OAAO,CAAA;IACX,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAA;IACpE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,OAAO,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;CACpC;AAED,wBAAgB,8BAA8B,IAAI,wBAAwB,CAEzE;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,GAAG,wBAAwB,CAoJvH;AAgBD;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,wBAAwB,GAAG,aAAa,EAAE,CAI7F"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Chat debug projection - tracks user-visible chat messages with debug links.
3
+ */
4
+ import type { AgentId, LLMCallId, ToolCallId } from '@roj-ai/sdk';
5
+ import type { AgentRegistryState } from './agent-registry.js';
6
+ import type { ProjectionEvent } from './events.js';
7
+ import type { DebugChatMessage } from './types.js';
8
+ /**
9
+ * State for tracking chat messages with debug info.
10
+ */
11
+ export interface ChatDebugState {
12
+ messages: DebugChatMessage[];
13
+ /** Tracking pending tool calls for linking (toolCallId -> { agentId, llmCallId, toolName }) */
14
+ pendingToolCalls: Map<ToolCallId, {
15
+ agentId: AgentId;
16
+ llmCallId?: LLMCallId;
17
+ toolName: string;
18
+ }>;
19
+ /** Last LLM call ID by agent (for linking tool calls to inference) */
20
+ lastLLMCallByAgent: Map<AgentId, LLMCallId>;
21
+ /** Event index counter */
22
+ eventIndex: number;
23
+ }
24
+ export declare function createChatDebugState(): ChatDebugState;
25
+ /**
26
+ * Apply event to chat debug state.
27
+ * @param registry Agent registry for name lookups
28
+ */
29
+ export declare function applyEventToChatDebug(state: ChatDebugState, event: ProjectionEvent, registry: AgentRegistryState): ChatDebugState;
30
+ /**
31
+ * Get chat debug messages sorted by timestamp.
32
+ */
33
+ export declare function getChatDebugMessages(state: ChatDebugState): DebugChatMessage[];
34
+ //# sourceMappingURL=chat-debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-debug.d.ts","sourceRoot":"","sources":["../../src/projections/chat-debug.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,EAAE,gBAAgB,EAAE,CAAA;IAC5B,+FAA+F;IAC/F,gBAAgB,EAAE,GAAG,CAAC,UAAU,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAChG,sEAAsE;IACtE,kBAAkB,EAAE,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;IAC3C,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;CAClB;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAOrD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,kBAAkB,GAC1B,cAAc,CAqNhB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,gBAAgB,EAAE,CAE9E"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * ProjectionEvent — union of all event types handled by shared projections.
3
+ *
4
+ * Boundary code (event-store.ts, debug.ts) casts DomainEvent → ProjectionEvent once.
5
+ * Individual projection reducers accept ProjectionEvent directly — no internal casts.
6
+ */
7
+ import type { BuiltinEvent, ServiceStatusChangedEvent, SkillLoadedEvent } from '@roj-ai/sdk';
8
+ export type ProjectionEvent = BuiltinEvent | SkillLoadedEvent | ServiceStatusChangedEvent;
9
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/projections/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAE5F,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,gBAAgB,GAAG,yBAAyB,CAAA"}
@@ -0,0 +1,22 @@
1
+ export type { ProjectionEvent } from './events.js';
2
+ export type { AgentTreeNode, AssistantConversationMessageView, ConversationMessageView, DebugChatMessage, GetAgentDetailResponse, GetEventsResponse, GetMetricsResponse, GlobalMailboxMessage, MailboxMessageView, SystemConversationMessageView, TimelineItem, ToolCallView, ToolConversationMessageView, UserConversationMessageView, } from './types.js';
3
+ export { toProtocolStatus } from './protocol-status.js';
4
+ export type { AgentRegistryState } from './agent-registry.js';
5
+ export { applyEventToAgentRegistry, createAgentRegistryState, getAgentName } from './agent-registry.js';
6
+ export type { AgentTreeProjectionState } from './agent-tree-projection.js';
7
+ export { applyEventToAgentTree, buildAgentTreeFromProjection, createAgentTreeProjectionState } from './agent-tree-projection.js';
8
+ export type { MetricsState } from './metrics.js';
9
+ export { applyEventToMetrics, createMetricsState, metricsStateToResponse } from './metrics.js';
10
+ export type { TimelineState } from './timeline.js';
11
+ export { applyEventToTimeline, createTimelineState, getTimelineItems } from './timeline.js';
12
+ export type { MailboxState } from './mailbox.js';
13
+ export { applyEventToMailbox, createMailboxState, getMailboxMessages } from './mailbox.js';
14
+ export type { ChatDebugState } from './chat-debug.js';
15
+ export { applyEventToChatDebug, createChatDebugState, getChatDebugMessages } from './chat-debug.js';
16
+ export type { AgentDetailProjectionState } from './agent-detail-projection.js';
17
+ export { applyEventToAgentDetail, createAgentDetailProjectionState, getAgentDetail } from './agent-detail-projection.js';
18
+ export type { SessionInfoState } from './session-info.js';
19
+ export { applyEventToSessionInfo, createSessionInfoState } from './session-info.js';
20
+ export type { ServiceEntry, ServicesProjectionState, ServiceStatus } from './services-projection.js';
21
+ export { applyEventToServices, createServicesProjectionState } from './services-projection.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projections/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAGlD,YAAY,EACX,aAAa,EACb,gCAAgC,EAChC,uBAAuB,EACvB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,YAAY,EACZ,YAAY,EACZ,2BAA2B,EAC3B,2BAA2B,GAC3B,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvG,YAAY,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,4BAA4B,CAAA;AAGhI,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAG9F,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAG3F,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAG1F,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAGnG,YAAY,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,gCAAgC,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAGxH,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAGnF,YAAY,EAAE,YAAY,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACpG,OAAO,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Global mailbox projection - tracks all inter-agent messages.
3
+ */
4
+ import type { AgentRegistryState } from './agent-registry.js';
5
+ import type { ProjectionEvent } from './events.js';
6
+ import type { GlobalMailboxMessage } from './types.js';
7
+ export interface MailboxState {
8
+ messages: GlobalMailboxMessage[];
9
+ consumedIds: Set<string>;
10
+ }
11
+ export declare function createMailboxState(): MailboxState;
12
+ /**
13
+ * Apply event to mailbox state.
14
+ * @param registry Agent registry for name lookups
15
+ */
16
+ export declare function applyEventToMailbox(state: MailboxState, event: ProjectionEvent, registry: AgentRegistryState): MailboxState;
17
+ /**
18
+ * Get mailbox messages sorted by timestamp.
19
+ */
20
+ export declare function getMailboxMessages(state: MailboxState): GlobalMailboxMessage[];
21
+ //# sourceMappingURL=mailbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailbox.d.ts","sourceRoot":"","sources":["../../src/projections/mailbox.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,oBAAoB,EAAE,CAAA;IAChC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAKjD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAClC,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,kBAAkB,GAC1B,YAAY,CA2Ed;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,oBAAoB,EAAE,CAG9E"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Metrics projection - tracks token usage, costs, and call counts.
3
+ */
4
+ import type { ProjectionEvent } from './events.js';
5
+ import type { GetMetricsResponse } from './types.js';
6
+ export interface ProviderMetricsState {
7
+ llmCalls: number;
8
+ totalTokens: number;
9
+ promptTokens: number;
10
+ completionTokens: number;
11
+ totalCost: number;
12
+ }
13
+ export interface MetricsState {
14
+ totalTokens: number;
15
+ promptTokens: number;
16
+ completionTokens: number;
17
+ llmCalls: number;
18
+ toolCalls: number;
19
+ totalCost: number;
20
+ firstEventTimestamp: number | null;
21
+ lastEventTimestamp: number | null;
22
+ byProvider: Record<string, ProviderMetricsState>;
23
+ }
24
+ export declare function createMetricsState(): MetricsState;
25
+ export declare function applyEventToMetrics(state: MetricsState, event: ProjectionEvent): MetricsState;
26
+ /**
27
+ * Convert MetricsState to GetMetricsResponse format.
28
+ */
29
+ export declare function metricsStateToResponse(state: MetricsState, agentCount: number): GetMetricsResponse;
30
+ //# sourceMappingURL=metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/projections/metrics.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpD,MAAM,WAAW,oBAAoB;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,gBAAgB,EAAE,MAAM,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CAChD;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAYjD;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,GAAG,YAAY,CAgD7F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAgBlG"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Protocol status conversion.
3
+ */
4
+ import type { DomainAgentStatus, ProtocolAgentStatus } from '@roj-ai/sdk';
5
+ /**
6
+ * Convert domain AgentStatus to protocol AgentStatus.
7
+ */
8
+ export declare function toProtocolStatus(status: DomainAgentStatus): ProtocolAgentStatus;
9
+ //# sourceMappingURL=protocol-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol-status.d.ts","sourceRoot":"","sources":["../../src/projections/protocol-status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEzE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CAa/E"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Services projection - tracks service states from events.
3
+ *
4
+ * Replaces selectPluginState(sessionState, 'services') for client-side use.
5
+ * Handles service_status_changed and session_restarted events.
6
+ */
7
+ import type { ServiceStatus } from '@roj-ai/sdk';
8
+ export type { ServiceStatus } from '@roj-ai/sdk';
9
+ import type { ProjectionEvent } from './events.js';
10
+ export interface ServiceEntry {
11
+ serviceType: string;
12
+ status: ServiceStatus;
13
+ port?: number;
14
+ error?: string;
15
+ startedAt?: number;
16
+ readyAt?: number;
17
+ stoppedAt?: number;
18
+ }
19
+ export interface ServicesProjectionState {
20
+ services: Map<string, ServiceEntry>;
21
+ }
22
+ export declare function createServicesProjectionState(): ServicesProjectionState;
23
+ export declare function applyEventToServices(state: ServicesProjectionState, event: ProjectionEvent): ServicesProjectionState;
24
+ //# sourceMappingURL=services-projection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services-projection.d.ts","sourceRoot":"","sources":["../../src/projections/services-projection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,aAAa,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,uBAAuB;IACvC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CACnC;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAEvE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,eAAe,GAAG,uBAAuB,CA2DpH"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Session info projection - tracks basic session metadata.
3
+ *
4
+ * Extracts session-level information (id, preset, status, timestamps)
5
+ * from lifecycle events without requiring full SessionState.
6
+ */
7
+ import type { SessionId } from '@roj-ai/sdk';
8
+ import type { ProjectionEvent } from './events.js';
9
+ export interface SessionInfoState {
10
+ id: SessionId | null;
11
+ presetId: string | null;
12
+ status: 'active' | 'closed';
13
+ createdAt: number | null;
14
+ closedAt?: number;
15
+ workspaceDir?: string;
16
+ }
17
+ export declare function createSessionInfoState(): SessionInfoState;
18
+ export declare function applyEventToSessionInfo(state: SessionInfoState, event: ProjectionEvent): SessionInfoState;
19
+ //# sourceMappingURL=session-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-info.d.ts","sourceRoot":"","sources":["../../src/projections/session-info.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,SAAS,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAOzD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAkBzG"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Timeline projection - tracks LLM calls, tool executions, and compactions.
3
+ */
4
+ import type { InferenceStartedEvent, LLMCallLogEntry, ToolStartedEvent } from '@roj-ai/sdk';
5
+ import type { AgentRegistryState } from './agent-registry.js';
6
+ import type { ProjectionEvent } from './events.js';
7
+ import type { TimelineItem } from './types.js';
8
+ export interface TimelineState {
9
+ items: TimelineItem[];
10
+ /** Pending inference starts waiting for completion */
11
+ pendingInferences: Map<string, InferenceStartedEvent>;
12
+ /** Pending tool starts waiting for completion */
13
+ pendingTools: Map<string, ToolStartedEvent>;
14
+ }
15
+ export declare function createTimelineState(): TimelineState;
16
+ /**
17
+ * Apply event to timeline state.
18
+ * @param registry Agent registry for name lookups
19
+ * @param llmCallMap Optional map for enriching LLM calls with detailed metrics
20
+ */
21
+ export declare function applyEventToTimeline(state: TimelineState, event: ProjectionEvent, registry: AgentRegistryState, llmCallMap?: Map<string, LLMCallLogEntry>): TimelineState;
22
+ /**
23
+ * Get timeline items including running items from pending state.
24
+ */
25
+ export declare function getTimelineItems(state: TimelineState, registry: AgentRegistryState): TimelineItem[];
26
+ //# sourceMappingURL=timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/projections/timeline.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAW,qBAAqB,EAAE,eAAe,EAAc,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAChH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C,MAAM,WAAW,aAAa;IAC7B,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,sDAAsD;IACtD,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;IACrD,iDAAiD;IACjD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAA;CAC3C;AAED,wBAAgB,mBAAmB,IAAI,aAAa,CAMnD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,aAAa,EACpB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,kBAAkB,EAC5B,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,GACvC,aAAa,CAyJf;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,kBAAkB,GAAG,YAAY,EAAE,CAkCnG"}