@kedataindo/docflow-core 0.0.61 → 0.0.63

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.
@@ -1 +1 @@
1
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIDraftCitation, g as AIDraftEvent, a as AIDraftFn, h as AIProvider, A as AIStreamFn, j as Auth, k as CONTEXT_CHAR_CAP, l as CslDate, m as CslItemData, n as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, p as buildAIPrompt, q as httpKeyStorage, r as localStorageKeyStorage, s as memoryKeyStorage, t as openaiCompatibleProvider, u as toAIStreamFn, v as trimContextAfter, w as trimContextBefore } from '../index-BsIFJXPk.cjs';
1
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-CDULnDYX.cjs';
@@ -1 +1 @@
1
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIDraftCitation, g as AIDraftEvent, a as AIDraftFn, h as AIProvider, A as AIStreamFn, j as Auth, k as CONTEXT_CHAR_CAP, l as CslDate, m as CslItemData, n as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, p as buildAIPrompt, q as httpKeyStorage, r as localStorageKeyStorage, s as memoryKeyStorage, t as openaiCompatibleProvider, u as toAIStreamFn, v as trimContextAfter, w as trimContextBefore } from '../index-BsIFJXPk.js';
1
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, a as AIDraftFn, i as AIProvider, A as AIStreamFn, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from '../index-CDULnDYX.js';
@@ -45,6 +45,36 @@ type AIProviderFactory = (config: {
45
45
  signal?: AbortSignal;
46
46
  }) => AIProvider;
47
47
  type AIAction = 'rewrite' | 'summarize' | 'grammar' | 'tone' | 'translate' | 'expand' | 'shorten' | 'generate' | 'chat' | 'draft';
48
+ /**
49
+ * Location context of the selection/cursor sent alongside the request so the
50
+ * LLM can reason about *where* in the document the user is pointing. All fields
51
+ * optional — hosts that don't fill them keep working unchanged (issue #219).
52
+ */
53
+ interface AIContextLocation {
54
+ /** 1-based page number containing the selection head (DOM pagination). */
55
+ page?: number;
56
+ /** Total pages in the document (DOM pagination). */
57
+ pageCount?: number;
58
+ /** 1-based paragraph/block index within the document. */
59
+ paragraphIndex?: number;
60
+ /** 1-based line number of the selection head within its block. */
61
+ line?: number;
62
+ /** Node type of the block under the selection, e.g. 'paragraph' | 'heading' | 'bulletList' | 'tableRow'. */
63
+ blockType?: string;
64
+ /** Nearest preceding heading text (BAB/section context), e.g. 'BAB II …'. */
65
+ section?: string;
66
+ }
67
+ /**
68
+ * Payload for the host's AI-chat hook (issue #219). Carries the selected text
69
+ * (if any) plus the cursor/selection location so a host with its OWN chat panel
70
+ * can pre-fill the prompt with context — without re-reading editor state.
71
+ */
72
+ interface AiChatRequestContext {
73
+ /** Selected text, when the selection is not empty. */
74
+ selection?: string;
75
+ /** Location of the selection/cursor (page, paragraph, line, section…). */
76
+ context: AIContextLocation;
77
+ }
48
78
  interface AIActionRequest {
49
79
  action: AIAction;
50
80
  /** Selected text (7B). */
@@ -53,7 +83,7 @@ interface AIActionRequest {
53
83
  context?: {
54
84
  before: string;
55
85
  after: string;
56
- };
86
+ } & AIContextLocation;
57
87
  /** User instruction (/ai prompt, chat message, tone target, target language). */
58
88
  prompt?: string;
59
89
  /** For doc-aware chat / RAG scoping. */
@@ -99,7 +129,7 @@ type AIDraftFn = (req: {
99
129
  context?: {
100
130
  before: string;
101
131
  after: string;
102
- };
132
+ } & AIContextLocation;
103
133
  k?: number;
104
134
  }, signal: AbortSignal) => AsyncIterable<AIDraftEvent>;
105
135
 
@@ -310,4 +340,4 @@ interface OpenAICompatibleConfig {
310
340
  }
311
341
  declare function openaiCompatibleProvider(config: OpenAICompatibleConfig): AIProvider;
312
342
 
313
- export { type AIStreamFn as A, type CitationPort as C, type HttpKeyStorageUrls as H, type ImageUploadHandler as I, type KeyStorage as K, LOCAL_STORAGE_KEY as L, type OpenAICompatibleConfig as O, type StreamEvent as S, type AIDraftFn as a, type AIAction as b, type AIActionRequest as c, type AICompleteRequest as d, type AIConfig as e, type AIDraftCitation as f, type AIDraftEvent as g, type AIProvider as h, type AIProviderFactory as i, type Auth as j, CONTEXT_CHAR_CAP as k, type CslDate as l, type CslItemData as m, type CslName as n, type ImageUploadResult as o, buildAIPrompt as p, httpKeyStorage as q, localStorageKeyStorage as r, memoryKeyStorage as s, openaiCompatibleProvider as t, toAIStreamFn as u, trimContextAfter as v, trimContextBefore as w };
343
+ export { type AIStreamFn as A, type CitationPort as C, type HttpKeyStorageUrls as H, type ImageUploadHandler as I, type KeyStorage as K, LOCAL_STORAGE_KEY as L, type OpenAICompatibleConfig as O, type StreamEvent as S, type AIDraftFn as a, type AIAction as b, type AIActionRequest as c, type AICompleteRequest as d, type AIConfig as e, type AIContextLocation as f, type AIDraftCitation as g, type AIDraftEvent as h, type AIProvider as i, type AIProviderFactory as j, type AiChatRequestContext as k, type Auth as l, CONTEXT_CHAR_CAP as m, type CslDate as n, type CslItemData as o, type CslName as p, type ImageUploadResult as q, buildAIPrompt as r, httpKeyStorage as s, localStorageKeyStorage as t, memoryKeyStorage as u, openaiCompatibleProvider as v, toAIStreamFn as w, trimContextAfter as x, trimContextBefore as y };
@@ -45,6 +45,36 @@ type AIProviderFactory = (config: {
45
45
  signal?: AbortSignal;
46
46
  }) => AIProvider;
47
47
  type AIAction = 'rewrite' | 'summarize' | 'grammar' | 'tone' | 'translate' | 'expand' | 'shorten' | 'generate' | 'chat' | 'draft';
48
+ /**
49
+ * Location context of the selection/cursor sent alongside the request so the
50
+ * LLM can reason about *where* in the document the user is pointing. All fields
51
+ * optional — hosts that don't fill them keep working unchanged (issue #219).
52
+ */
53
+ interface AIContextLocation {
54
+ /** 1-based page number containing the selection head (DOM pagination). */
55
+ page?: number;
56
+ /** Total pages in the document (DOM pagination). */
57
+ pageCount?: number;
58
+ /** 1-based paragraph/block index within the document. */
59
+ paragraphIndex?: number;
60
+ /** 1-based line number of the selection head within its block. */
61
+ line?: number;
62
+ /** Node type of the block under the selection, e.g. 'paragraph' | 'heading' | 'bulletList' | 'tableRow'. */
63
+ blockType?: string;
64
+ /** Nearest preceding heading text (BAB/section context), e.g. 'BAB II …'. */
65
+ section?: string;
66
+ }
67
+ /**
68
+ * Payload for the host's AI-chat hook (issue #219). Carries the selected text
69
+ * (if any) plus the cursor/selection location so a host with its OWN chat panel
70
+ * can pre-fill the prompt with context — without re-reading editor state.
71
+ */
72
+ interface AiChatRequestContext {
73
+ /** Selected text, when the selection is not empty. */
74
+ selection?: string;
75
+ /** Location of the selection/cursor (page, paragraph, line, section…). */
76
+ context: AIContextLocation;
77
+ }
48
78
  interface AIActionRequest {
49
79
  action: AIAction;
50
80
  /** Selected text (7B). */
@@ -53,7 +83,7 @@ interface AIActionRequest {
53
83
  context?: {
54
84
  before: string;
55
85
  after: string;
56
- };
86
+ } & AIContextLocation;
57
87
  /** User instruction (/ai prompt, chat message, tone target, target language). */
58
88
  prompt?: string;
59
89
  /** For doc-aware chat / RAG scoping. */
@@ -99,7 +129,7 @@ type AIDraftFn = (req: {
99
129
  context?: {
100
130
  before: string;
101
131
  after: string;
102
- };
132
+ } & AIContextLocation;
103
133
  k?: number;
104
134
  }, signal: AbortSignal) => AsyncIterable<AIDraftEvent>;
105
135
 
@@ -310,4 +340,4 @@ interface OpenAICompatibleConfig {
310
340
  }
311
341
  declare function openaiCompatibleProvider(config: OpenAICompatibleConfig): AIProvider;
312
342
 
313
- export { type AIStreamFn as A, type CitationPort as C, type HttpKeyStorageUrls as H, type ImageUploadHandler as I, type KeyStorage as K, LOCAL_STORAGE_KEY as L, type OpenAICompatibleConfig as O, type StreamEvent as S, type AIDraftFn as a, type AIAction as b, type AIActionRequest as c, type AICompleteRequest as d, type AIConfig as e, type AIDraftCitation as f, type AIDraftEvent as g, type AIProvider as h, type AIProviderFactory as i, type Auth as j, CONTEXT_CHAR_CAP as k, type CslDate as l, type CslItemData as m, type CslName as n, type ImageUploadResult as o, buildAIPrompt as p, httpKeyStorage as q, localStorageKeyStorage as r, memoryKeyStorage as s, openaiCompatibleProvider as t, toAIStreamFn as u, trimContextAfter as v, trimContextBefore as w };
343
+ export { type AIStreamFn as A, type CitationPort as C, type HttpKeyStorageUrls as H, type ImageUploadHandler as I, type KeyStorage as K, LOCAL_STORAGE_KEY as L, type OpenAICompatibleConfig as O, type StreamEvent as S, type AIDraftFn as a, type AIAction as b, type AIActionRequest as c, type AICompleteRequest as d, type AIConfig as e, type AIContextLocation as f, type AIDraftCitation as g, type AIDraftEvent as h, type AIProvider as i, type AIProviderFactory as j, type AiChatRequestContext as k, type Auth as l, CONTEXT_CHAR_CAP as m, type CslDate as n, type CslItemData as o, type CslName as p, type ImageUploadResult as q, buildAIPrompt as r, httpKeyStorage as s, localStorageKeyStorage as t, memoryKeyStorage as u, openaiCompatibleProvider as v, toAIStreamFn as w, trimContextAfter as x, trimContextBefore as y };
package/dist/index.d.cts CHANGED
@@ -4,8 +4,8 @@ import { IndexeddbPersistence } from 'y-indexeddb';
4
4
  import { WebrtcProvider } from 'y-webrtc';
5
5
  import { WebsocketProvider } from 'y-websocket';
6
6
  import * as Y from 'yjs';
7
- import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-BsIFJXPk.cjs';
8
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIDraftCitation, g as AIDraftEvent, h as AIProvider, i as AIProviderFactory, j as Auth, k as CONTEXT_CHAR_CAP, l as CslDate, m as CslItemData, n as CslName, H as HttpKeyStorageUrls, o as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, p as buildAIPrompt, q as httpKeyStorage, r as localStorageKeyStorage, s as memoryKeyStorage, t as openaiCompatibleProvider, u as toAIStreamFn, v as trimContextAfter, w as trimContextBefore } from './index-BsIFJXPk.cjs';
7
+ import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-CDULnDYX.cjs';
8
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-CDULnDYX.cjs';
9
9
  import { PaginationPlusOptions } from 'tiptap-pagination-plus';
10
10
  export { PAGE_SIZES, PageSize, PaginationPlus, PaginationPlusOptions } from 'tiptap-pagination-plus';
11
11
  import { PluginKey } from '@tiptap/pm/state';
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { IndexeddbPersistence } from 'y-indexeddb';
4
4
  import { WebrtcProvider } from 'y-webrtc';
5
5
  import { WebsocketProvider } from 'y-websocket';
6
6
  import * as Y from 'yjs';
7
- import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-BsIFJXPk.js';
8
- export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIDraftCitation, g as AIDraftEvent, h as AIProvider, i as AIProviderFactory, j as Auth, k as CONTEXT_CHAR_CAP, l as CslDate, m as CslItemData, n as CslName, H as HttpKeyStorageUrls, o as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, p as buildAIPrompt, q as httpKeyStorage, r as localStorageKeyStorage, s as memoryKeyStorage, t as openaiCompatibleProvider, u as toAIStreamFn, v as trimContextAfter, w as trimContextBefore } from './index-BsIFJXPk.js';
7
+ import { I as ImageUploadHandler, C as CitationPort, A as AIStreamFn, a as AIDraftFn } from './index-CDULnDYX.js';
8
+ export { b as AIAction, c as AIActionRequest, d as AICompleteRequest, e as AIConfig, f as AIContextLocation, g as AIDraftCitation, h as AIDraftEvent, i as AIProvider, j as AIProviderFactory, k as AiChatRequestContext, l as Auth, m as CONTEXT_CHAR_CAP, n as CslDate, o as CslItemData, p as CslName, H as HttpKeyStorageUrls, q as ImageUploadResult, K as KeyStorage, L as LOCAL_STORAGE_KEY, O as OpenAICompatibleConfig, S as StreamEvent, r as buildAIPrompt, s as httpKeyStorage, t as localStorageKeyStorage, u as memoryKeyStorage, v as openaiCompatibleProvider, w as toAIStreamFn, x as trimContextAfter, y as trimContextBefore } from './index-CDULnDYX.js';
9
9
  import { PaginationPlusOptions } from 'tiptap-pagination-plus';
10
10
  export { PAGE_SIZES, PageSize, PaginationPlus, PaginationPlusOptions } from 'tiptap-pagination-plus';
11
11
  import { PluginKey } from '@tiptap/pm/state';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kedataindo/docflow-core",
3
3
  "license": "UNLICENSED",
4
- "version": "0.0.61",
4
+ "version": "0.0.63",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",