@haklex/rich-agent-core 0.0.94

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 (58) hide show
  1. package/dist/agent-executor.d.ts +19 -0
  2. package/dist/agent-executor.d.ts.map +1 -0
  3. package/dist/diff-engine.d.ts +8 -0
  4. package/dist/diff-engine.d.ts.map +1 -0
  5. package/dist/document-context.d.ts +4 -0
  6. package/dist/document-context.d.ts.map +1 -0
  7. package/dist/document-tools.d.ts +5 -0
  8. package/dist/document-tools.d.ts.map +1 -0
  9. package/dist/index.d.ts +21 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.mjs +1143 -0
  12. package/dist/initialState.d.ts +63 -0
  13. package/dist/initialState.d.ts.map +1 -0
  14. package/dist/messages-engine/base/BaseEveryUserContentProvider.d.ts +11 -0
  15. package/dist/messages-engine/base/BaseEveryUserContentProvider.d.ts.map +1 -0
  16. package/dist/messages-engine/base/BaseFirstUserContentProvider.d.ts +7 -0
  17. package/dist/messages-engine/base/BaseFirstUserContentProvider.d.ts.map +1 -0
  18. package/dist/messages-engine/base/BaseLastUserContentProvider.d.ts +13 -0
  19. package/dist/messages-engine/base/BaseLastUserContentProvider.d.ts.map +1 -0
  20. package/dist/messages-engine/base/BaseMessageEngineProcessor.d.ts +8 -0
  21. package/dist/messages-engine/base/BaseMessageEngineProcessor.d.ts.map +1 -0
  22. package/dist/messages-engine/base/BaseSystemRoleProvider.d.ts +7 -0
  23. package/dist/messages-engine/base/BaseSystemRoleProvider.d.ts.map +1 -0
  24. package/dist/messages-engine/base/BaseSystemRootProvider.d.ts +8 -0
  25. package/dist/messages-engine/base/BaseSystemRootProvider.d.ts.map +1 -0
  26. package/dist/messages-engine/base/constants.d.ts +4 -0
  27. package/dist/messages-engine/base/constants.d.ts.map +1 -0
  28. package/dist/messages-engine/base/messageContextUtils.d.ts +15 -0
  29. package/dist/messages-engine/base/messageContextUtils.d.ts.map +1 -0
  30. package/dist/messages-engine/engine.d.ts +9 -0
  31. package/dist/messages-engine/engine.d.ts.map +1 -0
  32. package/dist/messages-engine/helpers.d.ts +16 -0
  33. package/dist/messages-engine/helpers.d.ts.map +1 -0
  34. package/dist/messages-engine/index.d.ts +5 -0
  35. package/dist/messages-engine/index.d.ts.map +1 -0
  36. package/dist/messages-engine/processors.d.ts +8 -0
  37. package/dist/messages-engine/processors.d.ts.map +1 -0
  38. package/dist/protocol.d.ts +121 -0
  39. package/dist/protocol.d.ts.map +1 -0
  40. package/dist/review-engine.d.ts +12 -0
  41. package/dist/review-engine.d.ts.map +1 -0
  42. package/dist/review-types.d.ts +27 -0
  43. package/dist/review-types.d.ts.map +1 -0
  44. package/dist/selectors.d.ts +8 -0
  45. package/dist/selectors.d.ts.map +1 -0
  46. package/dist/snapshot.d.ts +9 -0
  47. package/dist/snapshot.d.ts.map +1 -0
  48. package/dist/store-actions.d.ts +46 -0
  49. package/dist/store-actions.d.ts.map +1 -0
  50. package/dist/store-types.d.ts +5 -0
  51. package/dist/store-types.d.ts.map +1 -0
  52. package/dist/store-utils.d.ts +2 -0
  53. package/dist/store-utils.d.ts.map +1 -0
  54. package/dist/store.d.ts +9 -0
  55. package/dist/store.d.ts.map +1 -0
  56. package/dist/types.d.ts +47 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/package.json +48 -0
@@ -0,0 +1,63 @@
1
+ import { ReviewState } from './review-types';
2
+ import { DiffState } from './types';
3
+ export type ToolCallItemStatus = 'pending' | 'running' | 'completed' | 'error';
4
+ export type ToolCallGroupItem = {
5
+ id: string;
6
+ toolName: string;
7
+ description?: string;
8
+ params: Record<string, unknown>;
9
+ status: ToolCallItemStatus;
10
+ result?: string;
11
+ resultPreview?: string;
12
+ error?: string;
13
+ startedAt?: number;
14
+ finishedAt?: number;
15
+ };
16
+ export type ChatBubble = {
17
+ type: 'user';
18
+ content: string;
19
+ } | {
20
+ type: 'assistant';
21
+ content: string;
22
+ streaming?: boolean;
23
+ } | {
24
+ type: 'tool_call';
25
+ toolName: string;
26
+ params: Record<string, unknown>;
27
+ } | {
28
+ type: 'tool_result';
29
+ toolName: string;
30
+ success: boolean;
31
+ summary: string;
32
+ } | {
33
+ type: 'thinking';
34
+ content: string;
35
+ id?: string;
36
+ rawText?: string;
37
+ steps?: string[];
38
+ isStreaming?: boolean;
39
+ } | {
40
+ type: 'tool_call_group';
41
+ id: string;
42
+ items: ToolCallGroupItem[];
43
+ } | {
44
+ type: 'error';
45
+ message: string;
46
+ } | {
47
+ type: 'diff_summary';
48
+ accepted: number;
49
+ rejected: number;
50
+ pending: number;
51
+ } | {
52
+ type: 'diff_review';
53
+ batchId: string;
54
+ };
55
+ export type AgentStoreStatus = 'idle' | 'running' | 'thinking' | 'calling_tool' | 'writing' | 'done';
56
+ export type AgentStoreState = {
57
+ status: AgentStoreStatus;
58
+ bubbles: ChatBubble[];
59
+ diffState: DiffState | null;
60
+ reviewState: ReviewState | null;
61
+ };
62
+ export declare function createInitialAgentStoreState(): AgentStoreState;
63
+ //# sourceMappingURL=initialState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../src/initialState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;AAE/E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;I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BAAgB,GACxB,MAAM,GACN,SAAS,GACT,UAAU,GACV,cAAc,GACd,SAAS,GACT,MAAM,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,wBAAgB,4BAA4B,IAAI,eAAe,CAO9D"}
@@ -0,0 +1,11 @@
1
+ import { MessageDraft, MessageEngineContext } from '../../protocol';
2
+ import { UserMessage } from '../helpers';
3
+ import { BaseMessageEngineProcessor } from './BaseMessageEngineProcessor';
4
+ export declare abstract class BaseEveryUserContentProvider extends BaseMessageEngineProcessor {
5
+ protected abstract buildContentForMessage(message: UserMessage, index: number, isLastUser: boolean, context: MessageEngineContext): {
6
+ content: string;
7
+ contextType: string;
8
+ } | null;
9
+ protected doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
10
+ }
11
+ //# sourceMappingURL=BaseEveryUserContentProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseEveryUserContentProvider.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseEveryUserContentProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAQ1E,8BAAsB,4BAA6B,SAAQ,0BAA0B;IACnF,SAAS,CAAC,QAAQ,CAAC,sBAAsB,CACvC,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,EACnB,OAAO,EAAE,oBAAoB,GAC5B;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAElD,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;CAmBtF"}
@@ -0,0 +1,7 @@
1
+ import { ChatMessage, MessageDraft, MessageEngineContext } from '../../protocol';
2
+ import { BaseMessageEngineProcessor } from './BaseMessageEngineProcessor';
3
+ export declare abstract class BaseFirstUserContentProvider extends BaseMessageEngineProcessor {
4
+ protected abstract buildMessages(context: MessageEngineContext): ChatMessage | ChatMessage[] | null;
5
+ protected doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
6
+ }
7
+ //# sourceMappingURL=BaseFirstUserContentProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseFirstUserContentProvider.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseFirstUserContentProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,8BAAsB,4BAA6B,SAAQ,0BAA0B;IACnF,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,OAAO,EAAE,oBAAoB,GAC5B,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI;IAErC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;CAUtF"}
@@ -0,0 +1,13 @@
1
+ import { MessageDraft, MessageEngineContext } from '../../protocol';
2
+ import { BaseMessageEngineProcessor } from './BaseMessageEngineProcessor';
3
+ export declare abstract class BaseLastUserContentProvider extends BaseMessageEngineProcessor {
4
+ protected abstract buildContent(context: MessageEngineContext): {
5
+ content: string;
6
+ contextType: string;
7
+ } | null;
8
+ protected doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
9
+ protected hasExistingSystemContext(draft: MessageDraft): boolean;
10
+ protected wrapWithSystemContext(content: string, contextType: string): string;
11
+ protected createContextBlock(content: string, contextType: string): string;
12
+ }
13
+ //# sourceMappingURL=BaseLastUserContentProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseLastUserContentProvider.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseLastUserContentProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAW1E,8BAAsB,2BAA4B,SAAQ,0BAA0B;IAClF,SAAS,CAAC,QAAQ,CAAC,YAAY,CAC7B,OAAO,EAAE,oBAAoB,GAC5B;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAElD,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;IAkBrF,SAAS,CAAC,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO;IAQhE,SAAS,CAAC,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;IAI7E,SAAS,CAAC,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM;CAG3E"}
@@ -0,0 +1,8 @@
1
+ import { MessageDraft, MessageEngineContext } from '../../protocol';
2
+ export declare abstract class BaseMessageEngineProcessor {
3
+ process(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
4
+ protected shouldProcess(_context: MessageEngineContext, _draft: MessageDraft): boolean;
5
+ protected cloneDraft(draft: MessageDraft): MessageDraft;
6
+ protected abstract doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
7
+ }
8
+ //# sourceMappingURL=BaseMessageEngineProcessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseMessageEngineProcessor.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseMessageEngineProcessor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,8BAAsB,0BAA0B;IAC9C,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;IAQzE,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,oBAAoB,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO;IAItF,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY;IAavD,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;CAC/F"}
@@ -0,0 +1,7 @@
1
+ import { MessageDraft, MessageEngineContext } from '../../protocol';
2
+ import { BaseMessageEngineProcessor } from './BaseMessageEngineProcessor';
3
+ export declare abstract class BaseSystemRoleProvider extends BaseMessageEngineProcessor {
4
+ protected abstract buildContent(context: MessageEngineContext): string | null;
5
+ protected doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
6
+ }
7
+ //# sourceMappingURL=BaseSystemRoleProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseSystemRoleProvider.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseSystemRoleProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,8BAAsB,sBAAuB,SAAQ,0BAA0B;IAC7E,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI;IAE7E,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;CAiBtF"}
@@ -0,0 +1,8 @@
1
+ import { MessageDraft, MessageEngineContext } from '../../protocol';
2
+ import { SystemMessage } from '../helpers';
3
+ import { BaseMessageEngineProcessor } from './BaseMessageEngineProcessor';
4
+ export declare abstract class BaseSystemRootProvider extends BaseMessageEngineProcessor {
5
+ protected abstract buildMessages(context: MessageEngineContext): SystemMessage | SystemMessage[] | null;
6
+ protected doProcess(draft: MessageDraft, context: MessageEngineContext): MessageDraft;
7
+ }
8
+ //# sourceMappingURL=BaseSystemRootProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseSystemRootProvider.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/BaseSystemRootProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,8BAAsB,sBAAuB,SAAQ,0BAA0B;IAC7E,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC9B,OAAO,EAAE,oBAAoB,GAC5B,aAAa,GAAG,aAAa,EAAE,GAAG,IAAI;IAEzC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAoB,GAAG,YAAY;CAOtF"}
@@ -0,0 +1,4 @@
1
+ export declare const SYSTEM_CONTEXT_START = "<!-- SYSTEM CONTEXT (NOT PART OF USER QUERY) -->";
2
+ export declare const SYSTEM_CONTEXT_END = "<!-- END SYSTEM CONTEXT -->";
3
+ export declare const CONTEXT_INSTRUCTION = "<context.instruction>following part contains context information injected by the system. Please follow these instructions:\n\n1. Always prioritize handling user-visible content.\n2. the context is only required when user's queries rely on it.\n</context.instruction>";
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,qDAAqD,CAAC;AACvF,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAChE,eAAO,MAAM,mBAAmB,+QAIT,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { MessageDraft } from '../../protocol';
2
+ import { UserMessage } from '../helpers';
3
+ export type UserMessageLocation = {
4
+ scope: 'messages';
5
+ index: number;
6
+ };
7
+ export declare function getUserMessageLocations(draft: MessageDraft): UserMessageLocation[];
8
+ export declare function getUserMessage(draft: MessageDraft, location: UserMessageLocation): UserMessage;
9
+ export declare function setUserMessage(draft: MessageDraft, location: UserMessageLocation, message: UserMessage): void;
10
+ export declare function hasSystemContextWrapper(content: string): boolean;
11
+ export declare function createContextBlock(content: string, contextType: string): string;
12
+ export declare function wrapWithSystemContext(content: string, contextType: string): string;
13
+ export declare function insertIntoExistingWrapper(existingContent: string, newContextBlock: string): string;
14
+ export declare function appendSystemContextToUserMessage(message: UserMessage, content: string, contextType: string): UserMessage;
15
+ //# sourceMappingURL=messageContextUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messageContextUtils.d.ts","sourceRoot":"","sources":["../../../src/messages-engine/base/messageContextUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,MAAM,mBAAmB,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,mBAAmB,EAAE,CAUlF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,mBAAmB,GAAG,WAAW,CAE9F;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,EAAE,WAAW,GACnB,IAAI,CAEN;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAI/E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAOlF;AAED,wBAAgB,yBAAyB,CACvC,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,MAAM,GACtB,MAAM,CAUR;AAED,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,WAAW,CAcb"}
@@ -0,0 +1,9 @@
1
+ import { ChatMessage, MessageEngine, MessageEngineContext, PreparedMessages } from '../protocol';
2
+ import { BaseMessageEngineProcessor } from './processors';
3
+ export declare class MessagesEngine implements MessageEngine {
4
+ private readonly processors;
5
+ constructor(processors: BaseMessageEngineProcessor[]);
6
+ process(context: MessageEngineContext): PreparedMessages;
7
+ }
8
+ export declare function buildMessages(preparedMessages: PreparedMessages): ChatMessage[];
9
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/messages-engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,qBAAa,cAAe,YAAW,aAAa;IACtC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,0BAA0B,EAAE;IAErE,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,gBAAgB;CAQzD;AAED,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,WAAW,EAAE,CAM/E"}
@@ -0,0 +1,16 @@
1
+ import { ChatMessage, MessageDraft, MessageEngineContext, PreparedMessages } from '../protocol';
2
+ export type SystemMessage = Extract<ChatMessage, {
3
+ role: 'system';
4
+ }>;
5
+ export type UserMessage = Extract<ChatMessage, {
6
+ role: 'user';
7
+ }>;
8
+ type MessageListValue<TMessage> = TMessage | TMessage[] | undefined | null;
9
+ export declare function appendText(base: string, next: string): string;
10
+ export declare function normalizeMessageList<TMessage>(value: MessageListValue<TMessage>): TMessage[];
11
+ export declare function getLastItem<TValue>(items: readonly TValue[]): TValue | undefined;
12
+ export declare function appendToUserMessage(message: UserMessage, content: string): UserMessage;
13
+ export declare function createInitialDraft(context: MessageEngineContext): MessageDraft;
14
+ export declare function draftToPreparedMessages(draft: MessageDraft): PreparedMessages;
15
+ export {};
16
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/messages-engine/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC;AACrE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjE,KAAK,gBAAgB,CAAC,QAAQ,IAAI,QAAQ,GAAG,QAAQ,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAE3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI7D;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAAE,CAG5F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAGhF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAKtF;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,CAK9E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,gBAAgB,CAM7E"}
@@ -0,0 +1,5 @@
1
+ export { buildMessages, MessagesEngine } from './engine';
2
+ export { BaseEveryUserContentProvider, BaseFirstUserContentProvider, BaseLastUserContentProvider, BaseMessageEngineProcessor, BaseSystemRoleProvider, BaseSystemRootProvider, } from './processors';
3
+ export { BaseFirstUserContentProvider as BaseFirstUserMessageProvider } from './processors';
4
+ export { BaseSystemRoleProvider as BaseSystemMessageProvider } from './processors';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages-engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,4BAA4B,IAAI,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAC5F,OAAO,EAAE,sBAAsB,IAAI,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { BaseEveryUserContentProvider } from './base/BaseEveryUserContentProvider';
2
+ export { BaseFirstUserContentProvider } from './base/BaseFirstUserContentProvider';
3
+ export { BaseLastUserContentProvider } from './base/BaseLastUserContentProvider';
4
+ export { BaseMessageEngineProcessor } from './base/BaseMessageEngineProcessor';
5
+ export { BaseSystemRoleProvider } from './base/BaseSystemRoleProvider';
6
+ export { BaseSystemRootProvider } from './base/BaseSystemRootProvider';
7
+ export { CONTEXT_INSTRUCTION, SYSTEM_CONTEXT_END, SYSTEM_CONTEXT_START } from './base/constants';
8
+ //# sourceMappingURL=processors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processors.d.ts","sourceRoot":"","sources":["../../src/messages-engine/processors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,121 @@
1
+ export type ChatMessage = {
2
+ role: 'system';
3
+ content: string;
4
+ cacheBreakpoint?: boolean;
5
+ } | {
6
+ role: 'user';
7
+ content: string;
8
+ cacheBreakpoint?: boolean;
9
+ metadata?: UserMessageMetadata;
10
+ } | {
11
+ role: 'assistant';
12
+ content: string;
13
+ } | {
14
+ role: 'assistant_tool_call';
15
+ toolCalls: ToolCall[];
16
+ } | {
17
+ role: 'tool_result';
18
+ toolCallId: string;
19
+ content: string;
20
+ isError?: boolean;
21
+ };
22
+ export type ToolCall = {
23
+ id: string;
24
+ name: string;
25
+ arguments: string;
26
+ };
27
+ export type ToolSchema = {
28
+ name: string;
29
+ description: string;
30
+ parameters: Record<string, unknown>;
31
+ };
32
+ export type LLMChunk = {
33
+ type: 'text';
34
+ text: string;
35
+ } | {
36
+ type: 'thinking';
37
+ text: string;
38
+ } | {
39
+ type: 'tool_call';
40
+ id: string;
41
+ name: string;
42
+ arguments: string;
43
+ } | {
44
+ type: 'done';
45
+ };
46
+ export type LLMProvider = {
47
+ chat: (messages: ChatMessage[], tools?: ToolSchema[]) => AsyncIterable<LLMChunk>;
48
+ };
49
+ export type AgentToolResult = {
50
+ ok: true;
51
+ content: string;
52
+ } | {
53
+ ok: false;
54
+ error: ToolError;
55
+ };
56
+ export type ToolError = {
57
+ error: 'block_modified' | 'block_not_found' | string;
58
+ blockId?: string;
59
+ message: string;
60
+ currentContent?: string;
61
+ };
62
+ export type AgentToolConfig = {
63
+ name: string;
64
+ description: string;
65
+ parameters: Record<string, unknown>;
66
+ execute: (params: unknown) => Promise<AgentToolResult>;
67
+ describeCall?: (params: unknown) => string;
68
+ };
69
+ export type DocumentContextOptions = {
70
+ compact?: boolean;
71
+ mode: 'full' | 'structure' | 'selection-window';
72
+ windowSize?: number;
73
+ };
74
+ export type PageSelection = {
75
+ xml: string;
76
+ startLine?: number;
77
+ endLine?: number;
78
+ };
79
+ export type UserMessageMetadata = {
80
+ pageSelections?: PageSelection[];
81
+ } & Record<string, unknown>;
82
+ export type PageContentMetadata = {
83
+ charCount?: number;
84
+ fileType?: string;
85
+ lineCount?: number;
86
+ title: string;
87
+ };
88
+ export type PageContentContext = {
89
+ markdown?: string;
90
+ metadata: PageContentMetadata;
91
+ xml?: string;
92
+ };
93
+ export type MessageEngineInitialContext = {
94
+ pageEditor?: PageContentContext;
95
+ };
96
+ export type MessageEngineStepContext = {
97
+ stepPageEditor?: {
98
+ xml?: string;
99
+ };
100
+ };
101
+ export type MessageEngineContext = {
102
+ messages: ChatMessage[];
103
+ pageContentContext?: PageContentContext;
104
+ initialContext?: MessageEngineInitialContext;
105
+ stepContext?: MessageEngineStepContext;
106
+ };
107
+ export type MessageDraft = {
108
+ systemMessages: Array<Extract<ChatMessage, {
109
+ role: 'system';
110
+ }>>;
111
+ messages: ChatMessage[];
112
+ };
113
+ export interface MessageEngine {
114
+ process: (context: MessageEngineContext) => PreparedMessages;
115
+ }
116
+ export type PreparedMessages = {
117
+ systemMessages: ChatMessage[];
118
+ preambleMessages: ChatMessage[];
119
+ turns: ChatMessage[];
120
+ };
121
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9D;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,GACD;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,SAAS,EAAE,QAAQ,EAAE,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,QAAQ,G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Q,CAAA;KAAE,CAAC,CAAC,CAAC;IAChE,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,gBAAgB,CAAC;CAC9D;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,gBAAgB,EAAE,WAAW,EAAE,CAAC;IAChC,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { SerializedEditorState } from 'lexical';
2
+ import { ReviewBatch, ReviewState } from './review-types';
3
+ import { AgentOperation } from './types';
4
+ export declare function applyOpsToSnapshot(base: SerializedEditorState, ops: AgentOperation[]): SerializedEditorState;
5
+ export declare function createReviewBatch(ops: AgentOperation[], baseSnapshot: SerializedEditorState, baseRevision: number): ReviewBatch;
6
+ export declare function acceptBatch(state: ReviewState, batchId: string): ReviewState;
7
+ export declare function rejectBatch(state: ReviewState, batchId: string): ReviewState;
8
+ export declare function reconcileReviewBatches(state: ReviewState): ReviewState;
9
+ export declare function acceptAndRebaseBatch(state: ReviewState, batchId: string): ReviewState;
10
+ export declare function resolveReviewEntry(state: ReviewState, batchId: string, entryId: string, resolution: 'accepted' | 'rejected'): ReviewState;
11
+ export declare function detectConflicts(state: ReviewState): ReviewState;
12
+ //# sourceMappingURL=review-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-engine.d.ts","sourceRoot":"","sources":["../src/review-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAyB,MAAM,SAAS,CAAC;AAG5E,OAAO,KAAK,EAAE,WAAW,EAAe,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2E9C,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,qBAAqB,EAC3B,GAAG,EAAE,cAAc,EAAE,GACpB,qBAAqB,CA6BvB;AAiDD,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,cAAc,EAAE,EACrB,YAAY,EAAE,qBAAqB,EACnC,YAAY,EAAE,MAAM,GACnB,WAAW,CAoDb;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAE5E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAE5E;AA+FD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAqCtE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAqBrF;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GAAG,UAAU,GAClC,WAAW,CAqBb;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAE/D"}
@@ -0,0 +1,27 @@
1
+ import { SerializedEditorState } from 'lexical';
2
+ import { AgentOperation } from './types';
3
+ export type ReviewEntryStatus = 'pending' | 'accepted' | 'rejected' | 'conflicted';
4
+ export type ReviewBatchStatus = 'pending' | 'order_dependent' | 'accepted' | 'rejected' | 'conflicted';
5
+ export type ReviewEntry = {
6
+ id: string;
7
+ op: AgentOperation;
8
+ targetBlockId?: string;
9
+ anchorBeforeId?: string;
10
+ anchorAfterId?: string;
11
+ originalFingerprint: string;
12
+ status: ReviewEntryStatus;
13
+ };
14
+ export type ReviewBatch = {
15
+ id: string;
16
+ baseRevision: number;
17
+ baseSnapshot: SerializedEditorState;
18
+ previewSnapshot: SerializedEditorState;
19
+ status: ReviewBatchStatus;
20
+ entries: ReviewEntry[];
21
+ touchedBlockIds: string[];
22
+ };
23
+ export type ReviewState = {
24
+ documentRevision: number;
25
+ batches: ReviewBatch[];
26
+ };
27
+ //# sourceMappingURL=review-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-types.d.ts","sourceRoot":"","sources":["../src/review-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AACnF,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,iBAAiB,GACjB,UAAU,GACV,UAAU,GACV,YAAY,CAAC;AAEjB,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,cAAc,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,qBAAqB,CAAC;IACpC,eAAe,EAAE,qBAAqB,CAAC;IACvC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AgentStoreState } from './initialState';
2
+ export declare const agentStoreSelectors: {
3
+ bubbles: (state: AgentStoreState) => import('./initialState').ChatBubble[];
4
+ diffState: (state: AgentStoreState) => import('./types').DiffState | null;
5
+ reviewState: (state: AgentStoreState) => import('./review-types').ReviewState | null;
6
+ status: (state: AgentStoreState) => import('./initialState').AgentStoreStatus;
7
+ };
8
+ //# sourceMappingURL=selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,eAAO,MAAM,mBAAmB;qBACb,eAAe;uBACb,eAAe;yBACb,eAAe;oBACpB,eAAe;CAChC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
+ export type EditorSnapshot = {
3
+ raw: SerializedEditorState;
4
+ blockIds: string[];
5
+ getBlock: (blockId: string) => SerializedLexicalNode | undefined;
6
+ };
7
+ export declare function createSnapshot(editorState: SerializedEditorState): EditorSnapshot;
8
+ export declare function compareBlockContent(a: SerializedLexicalNode, b: SerializedLexicalNode): boolean;
9
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE5E,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,qBAAqB,GAAG,SAAS,CAAC;CAClE,CAAC;AAEF,wBAAgB,cAAc,CAAC,WAAW,EAAE,qBAAqB,GAAG,cAAc,CAoBjF;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAE/F"}
@@ -0,0 +1,46 @@
1
+ import { StoreApi } from 'zustand/vanilla';
2
+ import { AgentStoreStatus, ChatBubble } from './initialState';
3
+ import { ReviewBatch, ReviewState } from './review-types';
4
+ import { StoreSetter } from './store-types';
5
+ import { DiffState } from './types';
6
+ type AgentStoreShape = {
7
+ bubbles: ChatBubble[];
8
+ diffState: DiffState | null;
9
+ reviewState: ReviewState | null;
10
+ status: AgentStoreStatus;
11
+ };
12
+ export type AgentStoreActionMethods = {
13
+ addBubble: (bubble: ChatBubble) => void;
14
+ addReviewBatch: (batch: ReviewBatch) => void;
15
+ acceptReviewBatch: (batchId: string) => void;
16
+ acceptReviewEntry: (batchId: string, entryId: string) => void;
17
+ rejectReviewBatch: (batchId: string) => void;
18
+ rejectReviewEntry: (batchId: string, entryId: string) => void;
19
+ reset: () => void;
20
+ setDiffState: (diffState: DiffState | null) => void;
21
+ setReviewState: (state: ReviewState | null) => void;
22
+ setStatus: (status: AgentStoreStatus) => void;
23
+ updateLastBubble: (bubble: ChatBubble) => void;
24
+ updateToolCallItem: (groupId: string, itemId: string, patch: Partial<import('./initialState').ToolCallGroupItem>) => void;
25
+ };
26
+ type Setter = StoreSetter<AgentStoreShape & AgentStoreActionMethods>;
27
+ export declare function createAgentStoreSlice(set: Setter, get: () => AgentStoreShape & AgentStoreActionMethods, api?: StoreApi<AgentStoreShape & AgentStoreActionMethods>): AgentStoreActionImpl;
28
+ export declare class AgentStoreActionImpl {
29
+ #private;
30
+ constructor(set: Setter, get: () => AgentStoreShape & AgentStoreActionMethods, api?: StoreApi<AgentStoreShape & AgentStoreActionMethods>);
31
+ addBubble: (bubble: ChatBubble) => void;
32
+ reset: () => void;
33
+ setDiffState: (diffState: DiffState | null) => void;
34
+ addReviewBatch: (batch: ReviewBatch) => void;
35
+ acceptReviewBatch: (batchId: string) => void;
36
+ acceptReviewEntry: (batchId: string, entryId: string) => void;
37
+ rejectReviewBatch: (batchId: string) => void;
38
+ rejectReviewEntry: (batchId: string, entryId: string) => void;
39
+ setReviewState: (reviewState: ReviewState | null) => void;
40
+ setStatus: (status: AgentStoreStatus) => void;
41
+ updateToolCallItem: (groupId: string, itemId: string, patch: Partial<import('./initialState').ToolCallGroupItem>) => void;
42
+ updateLastBubble: (bubble: ChatBubble) => void;
43
+ }
44
+ export type AgentStoreActions = Pick<AgentStoreActionImpl, keyof AgentStoreActionImpl>;
45
+ export {};
46
+ //# sourceMappingURL=store-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-actions.d.ts","sourceRoot":"","sources":["../src/store-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IAC7C,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,iBAAi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AAiB,GAAI,SAAS,MAAM,EAAE,SAAS,MAAM,UAKnD;IAEF,cAAc,GAAI,aAAa,WAAW,GAAG,IAAI,UAE/C;IAEF,SAAS,GAAI,QAAQ,gBAAgB,UAEnC;IAEF,kBAAkB,GAChB,SAAS,MAAM,EACf,QAAQ,MAAM,EACd,OAAO,OAAO,CAAC,OAAO,gBAAgB,EAAE,iBAAiB,CAAC,UAqB1D;IAEF,gBAAgB,GAAI,QAAQ,UAAU,UAQpC;CACH;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export interface StoreSetter<TStore> {
2
+ (partial: TStore | Partial<TStore> | ((state: TStore) => TStore | Partial<TStore>), replace?: false | undefined, action?: unknown): void;
3
+ (state: TStore | ((state: TStore) => TStore), replace: true, action?: unknown): void;
4
+ }
5
+ //# sourceMappingURL=store-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-types.d.ts","sourceRoot":"","sources":["../src/store-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW,CAAC,MAAM;IACjC,CACE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EACjF,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,EAC3B,MAAM,CAAC,EAAE,OAAO,GACf,IAAI,CAAC;IACR,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACtF"}
@@ -0,0 +1,2 @@
1
+ export declare const flattenActions: <T extends object>(actions: object[]) => T;
2
+ //# sourceMappingURL=store-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-utils.d.ts","sourceRoot":"","sources":["../src/store-utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,EAAE,SAAS,MAAM,EAAE,KAAG,CAgCpE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { StoreApi } from 'zustand/vanilla';
2
+ import { AgentStoreState } from './initialState';
3
+ import { AgentStoreActions } from './store-actions';
4
+ export type { AgentStoreState, ChatBubble } from './initialState';
5
+ export type { AgentStoreActions } from './store-actions';
6
+ export type AgentStoreSlice = AgentStoreState & AgentStoreActions;
7
+ export type AgentStore = StoreApi<AgentStoreSlice>;
8
+ export declare function createAgentStore(): AgentStore;
9
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAE,KAAK,eAAe,EAAgC,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,KAAK,iBAAiB,EAAyB,MAAM,iBAAiB,CAAC;AAGhF,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;AAOnD,wBAAgB,gBAAgB,IAAI,UAAU,CAE7C"}
@@ -0,0 +1,47 @@
1
+ import { SerializedLexicalNode } from 'lexical';
2
+ export type NodePosition = {
3
+ type: 'after';
4
+ blockId: string;
5
+ } | {
6
+ type: 'before';
7
+ blockId: string;
8
+ } | {
9
+ type: 'root';
10
+ index?: number;
11
+ };
12
+ export type AgentOperation = {
13
+ op: 'insert';
14
+ position: NodePosition;
15
+ node: SerializedLexicalNode;
16
+ } | {
17
+ op: 'replace';
18
+ blockId: string;
19
+ node: SerializedLexicalNode;
20
+ } | {
21
+ op: 'delete';
22
+ blockId: string;
23
+ };
24
+ export type SelectionSnapshot = {
25
+ text: string;
26
+ anchorBlockId: string;
27
+ anchorOffset: number;
28
+ focusBlockId: string;
29
+ focusOffset: number;
30
+ };
31
+ export type AgentContext = {
32
+ selection: SelectionSnapshot | null;
33
+ getBlockByBlockId: (blockId: string) => SerializedLexicalNode | null;
34
+ getDocumentStructure: () => SerializedLexicalNode;
35
+ };
36
+ export type DiffEntry = {
37
+ id: string;
38
+ op: AgentOperation;
39
+ status: 'pending' | 'accepted' | 'rejected';
40
+ originalNode?: SerializedLexicalNode;
41
+ };
42
+ export type DiffState = {
43
+ entries: DiffEntry[];
44
+ getByBlockId: (blockId: string) => DiffEntry | undefined;
45
+ getPending: () => DiffEntry[];
46
+ };
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErC,MAAM,MAAM,cAAc,GACtB;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GACrE;IAAE,EAAE,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAC/D;IAAE,EAAE,EAA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