@modelprofile.com/flexharness 6.0.0 → 7.0.0

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 (169) hide show
  1. package/dist_ts/00_commitinfo_data.js +1 -1
  2. package/dist_ts_chat/classes.chatsession.d.ts +37 -0
  3. package/dist_ts_chat/classes.chatsession.js +102 -0
  4. package/dist_ts_chat/index.d.ts +2 -0
  5. package/dist_ts_chat/index.js +2 -0
  6. package/dist_ts_chat/interfaces.d.ts +72 -0
  7. package/dist_ts_chat/interfaces.js +2 -0
  8. package/dist_ts_chat/plugins.d.ts +4 -0
  9. package/dist_ts_chat/plugins.js +4 -0
  10. package/dist_ts_chat_cli/components.chatapp.d.ts +10 -0
  11. package/dist_ts_chat_cli/components.chatapp.js +75 -0
  12. package/dist_ts_chat_cli/components.inputarea.d.ts +7 -0
  13. package/dist_ts_chat_cli/components.inputarea.js +18 -0
  14. package/dist_ts_chat_cli/components.message.d.ts +12 -0
  15. package/dist_ts_chat_cli/components.message.js +21 -0
  16. package/dist_ts_chat_cli/components.messagelist.d.ts +9 -0
  17. package/dist_ts_chat_cli/components.messagelist.js +19 -0
  18. package/dist_ts_chat_cli/components.statusbar.d.ts +9 -0
  19. package/dist_ts_chat_cli/components.statusbar.js +15 -0
  20. package/dist_ts_chat_cli/index.d.ts +2 -0
  21. package/dist_ts_chat_cli/index.js +2 -0
  22. package/dist_ts_chat_cli/plugins.d.ts +12 -0
  23. package/dist_ts_chat_cli/plugins.js +14 -0
  24. package/dist_ts_chat_cli/startchat.d.ts +18 -0
  25. package/dist_ts_chat_cli/startchat.js +17 -0
  26. package/dist_ts_chat_web/flexchat-input.d.ts +21 -0
  27. package/dist_ts_chat_web/flexchat-input.js +172 -0
  28. package/dist_ts_chat_web/flexchat-message.d.ts +26 -0
  29. package/dist_ts_chat_web/flexchat-message.js +174 -0
  30. package/dist_ts_chat_web/flexchat-window.d.ts +34 -0
  31. package/dist_ts_chat_web/flexchat-window.js +394 -0
  32. package/dist_ts_chat_web/index.d.ts +3 -0
  33. package/dist_ts_chat_web/index.js +4 -0
  34. package/dist_ts_chat_web/plugins.d.ts +6 -0
  35. package/dist_ts_chat_web/plugins.js +4 -0
  36. package/dist_ts_compaction/index.d.ts +2 -0
  37. package/dist_ts_compaction/index.js +2 -0
  38. package/dist_ts_compaction/plugins.d.ts +4 -0
  39. package/dist_ts_compaction/plugins.js +3 -0
  40. package/dist_ts_compaction/smartagent.compaction.d.ts +14 -0
  41. package/dist_ts_compaction/smartagent.compaction.js +49 -0
  42. package/dist_ts_document/index.d.ts +19 -0
  43. package/dist_ts_document/index.js +55 -0
  44. package/dist_ts_document/plugins.d.ts +3 -0
  45. package/dist_ts_document/plugins.js +4 -0
  46. package/dist_ts_kvm/classes.browserkvm.d.ts +22 -0
  47. package/dist_ts_kvm/classes.browserkvm.js +271 -0
  48. package/dist_ts_kvm/classes.kvmterminal.d.ts +8 -0
  49. package/dist_ts_kvm/classes.kvmterminal.js +88 -0
  50. package/dist_ts_kvm/commandwrappers.d.ts +14 -0
  51. package/dist_ts_kvm/commandwrappers.js +58 -0
  52. package/dist_ts_kvm/index.d.ts +6 -0
  53. package/dist_ts_kvm/index.js +7 -0
  54. package/dist_ts_kvm/interfaces.d.ts +106 -0
  55. package/dist_ts_kvm/interfaces.js +2 -0
  56. package/dist_ts_kvm/ocr.d.ts +14 -0
  57. package/dist_ts_kvm/ocr.js +23 -0
  58. package/dist_ts_kvm/plugins.d.ts +6 -0
  59. package/dist_ts_kvm/plugins.js +10 -0
  60. package/dist_ts_kvm/tools.d.ts +15 -0
  61. package/dist_ts_kvm/tools.js +40 -0
  62. package/dist_ts_mcp/index.d.ts +86 -0
  63. package/dist_ts_mcp/index.js +284 -0
  64. package/dist_ts_mcp/requestcontext.d.ts +11 -0
  65. package/dist_ts_mcp/requestcontext.js +42 -0
  66. package/dist_ts_media/index.d.ts +8 -0
  67. package/dist_ts_media/index.js +21 -0
  68. package/dist_ts_media/plugins.d.ts +2 -0
  69. package/dist_ts_media/plugins.js +3 -0
  70. package/dist_ts_ocr/classes.imageocr.d.ts +19 -0
  71. package/dist_ts_ocr/classes.imageocr.js +27 -0
  72. package/dist_ts_ocr/index.d.ts +2 -0
  73. package/dist_ts_ocr/index.js +3 -0
  74. package/dist_ts_ocr/ocr.mistral.d.ts +75 -0
  75. package/dist_ts_ocr/ocr.mistral.js +77 -0
  76. package/dist_ts_tools/index.d.ts +17 -0
  77. package/dist_ts_tools/index.js +10 -0
  78. package/dist_ts_tools/plugins.d.ts +7 -0
  79. package/dist_ts_tools/plugins.js +6 -0
  80. package/dist_ts_tools/tool.browser.d.ts +11 -0
  81. package/dist_ts_tools/tool.browser.js +128 -0
  82. package/dist_ts_tools/tool.context.d.ts +4 -0
  83. package/dist_ts_tools/tool.context.js +23 -0
  84. package/dist_ts_tools/tool.filesystem.d.ts +11 -0
  85. package/dist_ts_tools/tool.filesystem.js +106 -0
  86. package/dist_ts_tools/tool.http.d.ts +2 -0
  87. package/dist_ts_tools/tool.http.js +65 -0
  88. package/dist_ts_tools/tool.json.d.ts +2 -0
  89. package/dist_ts_tools/tool.json.js +47 -0
  90. package/dist_ts_tools/tool.shell.d.ts +15 -0
  91. package/dist_ts_tools/tool.shell.js +329 -0
  92. package/dist_ts_tools/utils.truncation.d.ts +10 -0
  93. package/dist_ts_tools/utils.truncation.js +26 -0
  94. package/dist_ts_tools_node/index.d.ts +5 -0
  95. package/dist_ts_tools_node/index.js +4 -0
  96. package/dist_ts_tools_node/plugins.d.ts +13 -0
  97. package/dist_ts_tools_node/plugins.js +13 -0
  98. package/dist_ts_tools_node/tool.context.d.ts +31 -0
  99. package/dist_ts_tools_node/tool.context.js +837 -0
  100. package/dist_ts_tools_node/tool.persistence.d.ts +15 -0
  101. package/dist_ts_tools_node/tool.persistence.js +129 -0
  102. package/dist_ts_tools_node/tools.local.d.ts +11 -0
  103. package/dist_ts_tools_node/tools.local.js +15 -0
  104. package/package.json +112 -4
  105. package/readme.md +122 -66
  106. package/ts/00_commitinfo_data.ts +1 -1
  107. package/ts/readme.md +122 -66
  108. package/ts_chat/classes.chatsession.ts +116 -0
  109. package/ts_chat/index.ts +8 -0
  110. package/ts_chat/interfaces.ts +64 -0
  111. package/ts_chat/plugins.ts +7 -0
  112. package/ts_chat/readme.md +49 -0
  113. package/ts_chat_cli/components.chatapp.ts +103 -0
  114. package/ts_chat_cli/components.inputarea.ts +29 -0
  115. package/ts_chat_cli/components.message.ts +48 -0
  116. package/ts_chat_cli/components.messagelist.ts +45 -0
  117. package/ts_chat_cli/components.statusbar.ts +31 -0
  118. package/ts_chat_cli/index.ts +2 -0
  119. package/ts_chat_cli/plugins.ts +21 -0
  120. package/ts_chat_cli/readme.md +40 -0
  121. package/ts_chat_cli/startchat.ts +34 -0
  122. package/ts_chat_web/flexchat-input.ts +184 -0
  123. package/ts_chat_web/flexchat-message.ts +185 -0
  124. package/ts_chat_web/flexchat-window.ts +416 -0
  125. package/ts_chat_web/index.ts +3 -0
  126. package/ts_chat_web/plugins.ts +9 -0
  127. package/ts_chat_web/readme.md +46 -0
  128. package/ts_compaction/index.ts +2 -0
  129. package/ts_compaction/plugins.ts +6 -0
  130. package/ts_compaction/readme.md +37 -0
  131. package/ts_compaction/smartagent.compaction.ts +59 -0
  132. package/ts_document/index.ts +82 -0
  133. package/ts_document/plugins.ts +3 -0
  134. package/ts_document/readme.md +49 -0
  135. package/ts_kvm/classes.browserkvm.ts +335 -0
  136. package/ts_kvm/classes.kvmterminal.ts +103 -0
  137. package/ts_kvm/commandwrappers.ts +83 -0
  138. package/ts_kvm/index.ts +6 -0
  139. package/ts_kvm/interfaces.ts +152 -0
  140. package/ts_kvm/ocr.ts +41 -0
  141. package/ts_kvm/plugins.ts +13 -0
  142. package/ts_kvm/readme.md +482 -0
  143. package/ts_kvm/tools.ts +58 -0
  144. package/ts_mcp/index.ts +470 -0
  145. package/ts_mcp/readme.md +37 -0
  146. package/ts_mcp/requestcontext.ts +66 -0
  147. package/ts_media/index.ts +29 -0
  148. package/ts_media/plugins.ts +2 -0
  149. package/ts_media/readme.md +37 -0
  150. package/ts_ocr/classes.imageocr.ts +53 -0
  151. package/ts_ocr/index.ts +2 -0
  152. package/ts_ocr/ocr.mistral.ts +192 -0
  153. package/ts_ocr/readme.md +48 -0
  154. package/ts_tools/index.ts +49 -0
  155. package/ts_tools/plugins.ts +7 -0
  156. package/ts_tools/readme.md +37 -0
  157. package/ts_tools/tool.browser.ts +159 -0
  158. package/ts_tools/tool.context.ts +23 -0
  159. package/ts_tools/tool.filesystem.ts +144 -0
  160. package/ts_tools/tool.http.ts +78 -0
  161. package/ts_tools/tool.json.ts +53 -0
  162. package/ts_tools/tool.shell.ts +418 -0
  163. package/ts_tools/utils.truncation.ts +39 -0
  164. package/ts_tools_node/index.ts +5 -0
  165. package/ts_tools_node/plugins.ts +16 -0
  166. package/ts_tools_node/readme.md +37 -0
  167. package/ts_tools_node/tool.context.ts +991 -0
  168. package/ts_tools_node/tool.persistence.ts +146 -0
  169. package/ts_tools_node/tools.local.ts +26 -0
@@ -0,0 +1,15 @@
1
+ import type { IToolJobSnapshot, IToolJobStore, IToolJobState } from '@modelprofile.com/flexharness-agent';
2
+ export interface IFileToolJobStoreOptions {
3
+ filePath: string;
4
+ lockTimeoutMs?: number;
5
+ }
6
+ export declare class FileToolJobStore implements IToolJobStore {
7
+ private readonly filePath;
8
+ private readonly lockTimeoutMs;
9
+ constructor(options: IFileToolJobStoreOptions);
10
+ private readSnapshot;
11
+ private withLock;
12
+ private writeAtomic;
13
+ load(abortSignal?: AbortSignal): Promise<IToolJobSnapshot | undefined>;
14
+ save(jobs: readonly IToolJobState[], expectedRevision: number, abortSignal?: AbortSignal): Promise<number>;
15
+ }
@@ -0,0 +1,129 @@
1
+ import * as plugins from './plugins.js';
2
+ const decodeSnapshot = (value) => {
3
+ const snapshot = value;
4
+ if (!snapshot
5
+ || snapshot.schemaVersion !== plugins.JOB_SNAPSHOT_SCHEMA_VERSION
6
+ || !Number.isSafeInteger(snapshot.revision)
7
+ || (snapshot.revision ?? -1) < 1
8
+ || !Array.isArray(snapshot.jobs)) {
9
+ throw new Error('Invalid tool job snapshot.');
10
+ }
11
+ return snapshot;
12
+ };
13
+ const sleep = async (milliseconds) => {
14
+ await new Promise((resolve) => setTimeout(resolve, milliseconds));
15
+ };
16
+ export class FileToolJobStore {
17
+ filePath;
18
+ lockTimeoutMs;
19
+ constructor(options) {
20
+ if (!options.filePath.trim())
21
+ throw new Error('FileToolJobStore filePath must not be empty.');
22
+ this.filePath = plugins.path.resolve(options.filePath);
23
+ this.lockTimeoutMs = options.lockTimeoutMs ?? 10_000;
24
+ if (!Number.isSafeInteger(this.lockTimeoutMs) || this.lockTimeoutMs <= 0) {
25
+ throw new Error('lockTimeoutMs must be a positive integer.');
26
+ }
27
+ }
28
+ async readSnapshot() {
29
+ try {
30
+ return decodeSnapshot(plugins.v8.deserialize(await plugins.fs.promises.readFile(this.filePath)));
31
+ }
32
+ catch (error) {
33
+ if (error.code === 'ENOENT')
34
+ return undefined;
35
+ throw error;
36
+ }
37
+ }
38
+ async withLock(operation, abortSignal) {
39
+ const lockPath = `${this.filePath}.lock`;
40
+ const ownerPath = plugins.path.join(lockPath, 'owner');
41
+ const ownerToken = plugins.crypto.randomUUID();
42
+ const ownerRecord = JSON.stringify({ token: ownerToken });
43
+ await plugins.fs.promises.mkdir(plugins.path.dirname(lockPath), { recursive: true });
44
+ const startedAt = Date.now();
45
+ while (true) {
46
+ abortSignal?.throwIfAborted();
47
+ try {
48
+ await plugins.fs.promises.mkdir(lockPath);
49
+ try {
50
+ await plugins.fs.promises.writeFile(ownerPath, ownerRecord, 'utf8');
51
+ }
52
+ catch (error) {
53
+ await plugins.fs.promises.rm(lockPath, { recursive: true, force: true });
54
+ throw error;
55
+ }
56
+ break;
57
+ }
58
+ catch (error) {
59
+ if (error.code !== 'EEXIST')
60
+ throw error;
61
+ if (Date.now() - startedAt >= this.lockTimeoutMs) {
62
+ throw new Error(`Timed out waiting for the tool job store lock at "${lockPath}".`);
63
+ }
64
+ await sleep(20);
65
+ }
66
+ }
67
+ try {
68
+ return await operation();
69
+ }
70
+ finally {
71
+ let stillOwner = false;
72
+ try {
73
+ const owner = JSON.parse(await plugins.fs.promises.readFile(ownerPath, 'utf8'));
74
+ stillOwner = owner.token === ownerToken;
75
+ }
76
+ catch { }
77
+ if (stillOwner) {
78
+ await plugins.fs.promises.rm(lockPath, { recursive: true, force: true });
79
+ }
80
+ }
81
+ }
82
+ async writeAtomic(snapshot, abortSignal) {
83
+ abortSignal?.throwIfAborted();
84
+ const directoryPath = plugins.path.dirname(this.filePath);
85
+ await plugins.fs.promises.mkdir(directoryPath, { recursive: true });
86
+ const temporaryPath = `${this.filePath}.${process.pid}.${plugins.crypto.randomUUID()}.tmp`;
87
+ let handle;
88
+ try {
89
+ handle = await plugins.fs.promises.open(temporaryPath, 'wx');
90
+ await handle.writeFile(plugins.v8.serialize(snapshot));
91
+ await handle.sync();
92
+ await handle.close();
93
+ handle = undefined;
94
+ abortSignal?.throwIfAborted();
95
+ await plugins.fs.promises.rename(temporaryPath, this.filePath);
96
+ const directoryHandle = await plugins.fs.promises.open(directoryPath, 'r');
97
+ try {
98
+ await directoryHandle.sync();
99
+ }
100
+ finally {
101
+ await directoryHandle.close();
102
+ }
103
+ }
104
+ finally {
105
+ if (handle)
106
+ await handle.close().catch(() => undefined);
107
+ await plugins.fs.promises.rm(temporaryPath, { force: true });
108
+ }
109
+ }
110
+ async load(abortSignal) {
111
+ abortSignal?.throwIfAborted();
112
+ const snapshot = await this.readSnapshot();
113
+ abortSignal?.throwIfAborted();
114
+ return snapshot;
115
+ }
116
+ async save(jobs, expectedRevision, abortSignal) {
117
+ return this.withLock(async () => {
118
+ abortSignal?.throwIfAborted();
119
+ const actualRevision = (await this.readSnapshot())?.revision ?? 0;
120
+ if (actualRevision !== expectedRevision) {
121
+ throw new plugins.ToolJobStoreConflictError(expectedRevision, actualRevision);
122
+ }
123
+ const revision = expectedRevision + 1;
124
+ await this.writeAtomic(plugins.createToolJobSnapshot(jobs, revision), abortSignal);
125
+ return revision;
126
+ }, abortSignal);
127
+ }
128
+ }
129
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbC5wZXJzaXN0ZW5jZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3Rvb2xzX25vZGUvdG9vbC5wZXJzaXN0ZW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQVF4QyxNQUFNLGNBQWMsR0FBRyxDQUFDLEtBQWMsRUFBb0IsRUFBRTtJQUMxRCxNQUFNLFFBQVEsR0FBRyxLQUFrQyxDQUFDO0lBQ3BELElBQ0UsQ0FBQyxRQUFRO1dBQ04sUUFBUSxDQUFDLGFBQWEsS0FBSyxPQUFPLENBQUMsMkJBQTJCO1dBQzlELENBQUMsTUFBTSxDQUFDLGFBQWEsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDO1dBQ3hDLENBQUMsUUFBUSxDQUFDLFFBQVEsSUFBSSxDQUFDLENBQUMsQ0FBQyxHQUFHLENBQUM7V0FDN0IsQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUMsRUFDaEMsQ0FBQztRQUNELE1BQU0sSUFBSSxLQUFLLENBQUMsNEJBQTRCLENBQUMsQ0FBQztJQUNoRCxDQUFDO0lBQ0QsT0FBTyxRQUE0QixDQUFDO0FBQ3RDLENBQUMsQ0FBQztBQUVGLE1BQU0sS0FBSyxHQUFHLEtBQUssRUFBRSxZQUFvQixFQUFpQixFQUFFO0lBQzFELE1BQU0sSUFBSSxPQUFPLENBQUMsQ0FBQyxPQUFPLEVBQUUsRUFBRSxDQUFDLFVBQVUsQ0FBQyxPQUFPLEVBQUUsWUFBWSxDQ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UF3QixFQUN4QixXQUF5QjtRQUV6QixPQUFPLElBQUksQ0FBQyxRQUFRLENBQUMsS0FBSyxJQUFJLEVBQUU7WUFDOUIsV0FBVyxFQUFFLGNBQWMsRUFBRSxDQUFDO1lBQzlCLE1BQU0sY0FBYyxHQUFHLENBQUMsTUFBTSxJQUFJLENBQUMsWUFBWSxFQUFFLENBQUMsRUFBRSxRQUFRLElBQUksQ0FBQyxDQUFDO1lBQ2xFLElBQUksY0FBYyxLQUFLLGdCQUFnQixFQUFFLENBQUM7Z0JBQ3hDLE1BQU0sSUFBSSxPQUFPLENBQUMseUJBQXlCLENBQUMsZ0JBQWdCLEVBQUUsY0FBYyxDQUFDLENBQUM7WUFDaEYsQ0FBQztZQUNELE1BQU0sUUFBUSxHQUFHLGdCQUFnQixHQUFHLENBQUMsQ0FBQztZQUN0QyxNQUFNLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLHFCQUFxQixDQUFDLElBQUksRUFBRSxRQUFRLENBQUMsRUFBRSxXQUFXLENBQUMsQ0FBQztZQUNuRixPQUFPLFFBQVEsQ0FBQztRQUNsQixDQUFDLEVBQUUsV0FBVyxDQUFDLENBQUM7SUFDbEIsQ0FBQztDQUNGIn0=
@@ -0,0 +1,11 @@
1
+ import * as plugins from './plugins.js';
2
+ export interface IFilesystemToolOptions extends plugins.ICreateFilesystemToolsOptions {
3
+ rootDir?: string;
4
+ context?: plugins.IToolExecutionContext;
5
+ }
6
+ export interface IShellToolOptions extends plugins.ICreateShellToolsOptions {
7
+ cwd?: string;
8
+ context?: plugins.IToolExecutionContext;
9
+ }
10
+ export declare function filesystemTool(options?: IFilesystemToolOptions): plugins.ToolSet;
11
+ export declare function shellTool(options?: IShellToolOptions): plugins.ToolSet;
@@ -0,0 +1,15 @@
1
+ import * as plugins from './plugins.js';
2
+ import { createLocalToolExecutionContext } from './tool.context.js';
3
+ export function filesystemTool(options) {
4
+ const context = options?.context ?? createLocalToolExecutionContext({ rootDir: options?.rootDir });
5
+ return plugins.createFilesystemTools(context, options);
6
+ }
7
+ export function shellTool(options) {
8
+ const context = options?.context ?? createLocalToolExecutionContext({ cwd: options?.cwd });
9
+ return plugins.createShellTools(context, {
10
+ ...options,
11
+ // An internally created context has no caller-visible background-job owner.
12
+ includeBackground: options?.context ? true : false,
13
+ });
14
+ }
15
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbHMubG9jYWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90c190b29sc19ub2RlL3Rvb2xzLmxvY2FsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxPQUFPLE1BQU0sY0FBYyxDQUFDO0FBQ3hDLE9BQU8sRUFBRSwrQkFBK0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBWXBFLE1BQU0sVUFBVSxjQUFjLENBQUMsT0FBZ0M7SUFDN0QsTUFBTSxPQUFPLEdBQUcsT0FBTyxFQUFFLE9BQU8sSUFBSSwrQkFBK0IsQ0FBQyxFQUFFLE9BQU8sRUFBRSxPQUFPLEVBQUUsT0FBTyxFQUFFLENBQUMsQ0FBQztJQUNuRyxPQUFPLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQyxPQUFPLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDekQsQ0FBQztBQUVELE1BQU0sVUFBVSxTQUFTLENBQUMsT0FBMkI7SUFDbkQsTUFBTSxPQUFPLEdBQUcsT0FBTyxFQUFFLE9BQU8sSUFBSSwrQkFBK0IsQ0FBQyxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsR0FBRyxFQUFFLENBQUMsQ0FBQztJQUMzRixPQUFPLE9BQU8sQ0FBQyxnQkFBZ0IsQ0FBQyxPQUFPLEVBQUU7UUFDdkMsR0FBRyxPQUFPO1FBQ1YsNEVBQTRFO1FBQzVFLGlCQUFpQixFQUFFLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsS0FBSztLQUNuRCxDQUFDLENBQUM7QUFDTCxDQUFDIn0=
package/package.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "author": "Task Venture Capital GmbH",
3
3
  "license": "MIT",
4
4
  "name": "@modelprofile.com/flexharness",
5
- "version": "6.0.0",
5
+ "version": "7.0.0",
6
6
  "type": "module",
7
- "description": "Managed multi-scope agent harness with permissions, public projections and persistence coordination.",
7
+ "description": "Managed agent sessions with tools, MCP, chat, OCR, documents and browser control through focused subpath imports.",
8
8
  "main": "./dist_ts/index.js",
9
9
  "types": "./dist_ts/index.d.ts",
10
10
  "exports": {
@@ -15,20 +15,128 @@
15
15
  "./migration": {
16
16
  "types": "./dist_ts_migration/index.d.ts",
17
17
  "import": "./dist_ts_migration/index.js"
18
+ },
19
+ "./tools": {
20
+ "types": "./dist_ts_tools/index.d.ts",
21
+ "import": "./dist_ts_tools/index.js"
22
+ },
23
+ "./tools/node": {
24
+ "types": "./dist_ts_tools_node/index.d.ts",
25
+ "import": "./dist_ts_tools_node/index.js"
26
+ },
27
+ "./compaction": {
28
+ "types": "./dist_ts_compaction/index.d.ts",
29
+ "import": "./dist_ts_compaction/index.js"
30
+ },
31
+ "./mcp": {
32
+ "types": "./dist_ts_mcp/index.d.ts",
33
+ "import": "./dist_ts_mcp/index.js"
34
+ },
35
+ "./media": {
36
+ "types": "./dist_ts_media/index.d.ts",
37
+ "import": "./dist_ts_media/index.js"
38
+ },
39
+ "./documents": {
40
+ "types": "./dist_ts_document/index.d.ts",
41
+ "import": "./dist_ts_document/index.js"
42
+ },
43
+ "./ocr": {
44
+ "types": "./dist_ts_ocr/index.d.ts",
45
+ "import": "./dist_ts_ocr/index.js"
46
+ },
47
+ "./kvm": {
48
+ "types": "./dist_ts_kvm/index.d.ts",
49
+ "import": "./dist_ts_kvm/index.js"
50
+ },
51
+ "./chat": {
52
+ "types": "./dist_ts_chat/index.d.ts",
53
+ "import": "./dist_ts_chat/index.js"
54
+ },
55
+ "./chat/cli": {
56
+ "types": "./dist_ts_chat_cli/index.d.ts",
57
+ "import": "./dist_ts_chat_cli/index.js"
58
+ },
59
+ "./chat/web": {
60
+ "types": "./dist_ts_chat_web/index.d.ts",
61
+ "import": "./dist_ts_chat_web/index.js"
18
62
  }
19
63
  },
20
64
  "dependencies": {
21
- "@modelprofile.com/flexharness-agent": "6.0.0"
65
+ "@modelprofile.com/flexharness-agent": "7.0.0",
66
+ "@modelprofile.com/flexharness-models": "7.0.0",
67
+ "@push.rocks/smartrequest": "^5.0.1",
68
+ "ai": "^7.0.79",
69
+ "zod": "^4.4.1"
70
+ },
71
+ "peerDependencies": {
72
+ "@modelcontextprotocol/sdk": "^1.29.0",
73
+ "@push.rocks/smartpdf": "^5.0.1",
74
+ "puppeteer": "^24.42.0",
75
+ "ink": "^6.8.0",
76
+ "ink-text-input": "^6.0.0",
77
+ "react": "^19.2.5",
78
+ "lit": "^3.2.0",
79
+ "@types/react": "^19.0.0"
80
+ },
81
+ "peerDependenciesMeta": {
82
+ "@modelcontextprotocol/sdk": {
83
+ "optional": true
84
+ },
85
+ "@push.rocks/smartpdf": {
86
+ "optional": true
87
+ },
88
+ "puppeteer": {
89
+ "optional": true
90
+ },
91
+ "ink": {
92
+ "optional": true
93
+ },
94
+ "ink-text-input": {
95
+ "optional": true
96
+ },
97
+ "react": {
98
+ "optional": true
99
+ },
100
+ "lit": {
101
+ "optional": true
102
+ },
103
+ "@types/react": {
104
+ "optional": true
105
+ }
22
106
  },
23
107
  "engines": {
24
108
  "node": ">=24"
25
109
  },
26
- "sideEffects": false,
110
+ "sideEffects": [
111
+ "./dist_ts_chat_web/**/*.js"
112
+ ],
27
113
  "files": [
28
114
  "ts",
29
115
  "dist_ts",
30
116
  "ts_migration",
31
117
  "dist_ts_migration",
118
+ "ts_tools",
119
+ "dist_ts_tools",
120
+ "ts_tools_node",
121
+ "dist_ts_tools_node",
122
+ "ts_compaction",
123
+ "dist_ts_compaction",
124
+ "ts_mcp",
125
+ "dist_ts_mcp",
126
+ "ts_media",
127
+ "dist_ts_media",
128
+ "ts_document",
129
+ "dist_ts_document",
130
+ "ts_ocr",
131
+ "dist_ts_ocr",
132
+ "ts_kvm",
133
+ "dist_ts_kvm",
134
+ "ts_chat",
135
+ "dist_ts_chat",
136
+ "ts_chat_cli",
137
+ "dist_ts_chat_cli",
138
+ "ts_chat_web",
139
+ "dist_ts_chat_web",
32
140
  "readme.md",
33
141
  "license.md"
34
142
  ]
package/readme.md CHANGED
@@ -1,98 +1,154 @@
1
- FlexHarness is a modular toolbox for model inference, standalone agents, managed sessions, tools and provider capabilities. It brings SmartAI and SmartAgent into one repository while publishing independently installable packages through tspublish.
1
+ FlexHarness is a modular toolbox for model inference, agents, managed sessions, chat, OCR, KVM control and provider capabilities. It brings SmartAI, SmartAgent, SmartChat, SmartKVM and SmartOCR's AI helpers into one repository through four focused packages published with tspublish.
2
2
 
3
3
  ## Issue Reporting and Security
4
4
 
5
5
  For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
6
6
 
7
- ## Choose components
7
+ ## Install and choose an entrypoint
8
8
 
9
- All package names below use the `@modelprofile.com/` scope. Components share a release version; each published package declares only its own dependencies. The private repository root is a development dependency catalog, not an install-everything package.
9
+ The toolbox publishes **four packages** under `@modelprofile.com`, with one shared
10
+ release version. Integrations use subpath imports instead of additional package
11
+ names.
10
12
 
11
- | Package | Responsibility |
13
+ | Package | Use it for |
12
14
  | --- | --- |
13
- | `flexharness-models` | Model contracts, explicit `ModelRegistry`, AI SDK helpers and prompt caching |
14
- | `flexharness-provider-{anthropic,openai,google,groq,mistral,xai,perplexity,ollama}` | One explicitly selected model provider per package |
15
- | `flexharness-agent` | `runAgent`, `AgentSession`, canonical events, generation transactions and tool contracts |
16
- | `flexharness` | Managed scopes, sessions, permissions, public projections and persistence coordination |
17
- | `flexharness-tools` | Tool factories using a host-supplied execution context, HTTP and JSON tools |
18
- | `flexharness-tools-node` | Local filesystem/process contexts, `filesystemTool`, `shellTool` and file-backed job stores |
19
- | `flexharness-compaction` | Model-driven conversation compaction |
20
- | `flexharness-mcp` | MCP clients and AI SDK tool conversion |
21
- | `flexharness-openai-auth` | ChatGPT device/browser authentication, refresh and model connections |
22
- | `flexharness-openai-account` | Account lifecycle, model catalog, rate limits and credential envelopes |
23
- | `flexharness-openai-auth-files` | Explicit interoperability with existing external credential files |
24
- | `flexharness-media` | Vision recipes for an injected model |
25
- | `flexharness-media-openai` | OpenAI audio and image capabilities |
26
- | `flexharness-document` | PDF processing; this component alone brings SmartPDF |
27
- | `flexharness-ocr` | OCR contracts with an injected transport; no runtime dependencies |
28
- | `flexharness-research` | Anthropic research capabilities |
29
-
30
- For model inference without an agent:
15
+ | `flexharness` | Managed sessions, permissions, tools, chat, OCR, documents and KVM |
16
+ | `flexharness-agent` | Standalone `runAgent` and `AgentSession`; portable `/runner` |
17
+ | `flexharness-models` | Model contracts, `ModelRegistry`, AI SDK helpers and caching |
18
+ | `flexharness-providers` | All eight model providers, authentication, accounts, media and research |
19
+
20
+ For a managed agent with model providers:
21
+
22
+ ```sh
23
+ pnpm add @modelprofile.com/flexharness @modelprofile.com/flexharness-providers
24
+ ```
25
+
26
+ For inference without an agent:
31
27
 
32
28
  ```sh
33
- pnpm add @modelprofile.com/flexharness-models @modelprofile.com/flexharness-provider-openai
29
+ pnpm add @modelprofile.com/flexharness-models @modelprofile.com/flexharness-providers
34
30
  ```
35
31
 
36
32
  ```typescript
37
33
  import { ModelRegistry, generateText } from '@modelprofile.com/flexharness-models';
38
- import { createOpenAiModelProvider } from '@modelprofile.com/flexharness-provider-openai';
34
+ import { createOpenAiModelProvider } from '@modelprofile.com/flexharness-providers/openai';
39
35
 
40
36
  const models = new ModelRegistry().register(createOpenAiModelProvider());
41
37
  const setup = models.getModelSetup({
42
- provider: 'openai',
43
- model: 'gpt-5.5',
44
- apiKey: process.env.OPENAI_API_KEY,
38
+ provider: 'openai', model: 'gpt-5.5', apiKey: process.env.OPENAI_API_KEY,
45
39
  });
46
40
  const result = await generateText({ ...setup, prompt: 'Hello' });
47
41
  ```
48
42
 
49
- For a standalone agent, add `@modelprofile.com/flexharness-agent` and pass the same model setup to `runAgent({ ...setup, prompt: 'Hello' })`. Providers are registered on caller-owned registries; duplicate IDs and unknown providers fail explicitly. Importing a provider, agent or harness does not register anything globally.
43
+ For a standalone agent, install `@modelprofile.com/flexharness-agent` and pass the
44
+ same setup to `runAgent({ ...setup, prompt: 'Hello' })`. Node.js 24 or newer is
45
+ required for Node entrypoints. Each application owns its model registry; imports
46
+ do not register providers globally.
47
+
48
+ ## Harness subpaths
49
+
50
+ All entries below belong to `@modelprofile.com/flexharness`. The root export stays
51
+ focused on managed sessions. Importing it does not load UI, PDF, browser automation
52
+ or provider SDKs.
53
+
54
+ | Import suffix | Capability | Additional install |
55
+ | --- | --- | --- |
56
+ | `/tools` | Host-supplied execution contexts, HTTP and JSON tools | None |
57
+ | `/tools/node` | Local filesystem and process tools, file-backed job adapters | None |
58
+ | `/compaction` | Model-driven conversation compaction | None |
59
+ | `/media` | Vision recipes using an injected model | None |
60
+ | `/ocr` | `ImageOcr`, OCR contracts and Mistral transport | None |
61
+ | `/chat` | Portable streaming `ChatSession`, history and usage | None |
62
+ | `/chat/cli` | Ink/React terminal chat | `ink ink-text-input react`; TypeScript: `@types/react` |
63
+ | `/chat/web` | Lit `flexchat-window`, `flexchat-message`, `flexchat-input` | `lit` |
64
+ | `/kvm` | Browser control, terminal framing and OCR observation | `puppeteer` |
65
+ | `/documents` | PDF processing and `extractTextFromPdf` | `@push.rocks/smartpdf` |
66
+ | `/mcp` | MCP clients and AI SDK tool conversion | `@modelcontextprotocol/sdk` |
67
+ | `/migration` | Existing versioned harness migrations | None |
68
+
69
+ The integrations in the last column use optional peer dependencies. Install them
70
+ only for the entrypoints your project imports, for example:
50
71
 
51
- For OpenAI ChatGPT authentication, add `flexharness-openai-auth` and set `connection: createOpenAiChatGptModelConnection(credentials)` in the OpenAI model options. This connection supplies the existing authentication settings and system-instruction middleware. API-key inference does not depend on the authentication or account packages.
52
-
53
- ## Install the managed harness
54
-
55
- ```bash
56
- pnpm add @modelprofile.com/flexharness
72
+ ```sh
73
+ pnpm add @modelprofile.com/flexharness lit
57
74
  ```
58
75
 
59
- Node.js 24 or newer is required.
60
-
61
- ## Overview
76
+ ```typescript
77
+ import { ChatSession } from '@modelprofile.com/flexharness/chat';
78
+ import '@modelprofile.com/flexharness/chat/web';
79
+ ```
62
80
 
63
- FlexHarness owns scope isolation, public session and message projections, permission decisions, event delivery, cancellation, and persistence coordination. Each session is backed by the `flexharness-agent` component's `AgentSession`, which owns the canonical private conversation and runtime event history. Model selection, tool execution, and optional execution-context creation remain application-defined extension points. The managed harness depends on the standalone agent; it does not install provider SDKs, MCP, document processing or local execution tools.
81
+ Chat uses the portable `flexharness-agent/runner`. A browser application can provide
82
+ a model backed by its own server transport, or supply `run` in
83
+ `IChatSessionOptions`. The web element accepts an `IChatSession` and maintains its
84
+ own subscription. Full Node `AgentSession` remains at the agent package root.
64
85
 
65
- ## Migrating from SmartAI and SmartAgent
86
+ ## Provider subpaths
66
87
 
67
- Update all related imports together and install the components they reference. The old packages are superseded; their published versions remain available so existing installations can be migrated deliberately.
88
+ Install `@modelprofile.com/flexharness-providers` once. Its root exports all provider
89
+ factories; use a provider subpath to import just that implementation.
68
90
 
69
- | Previous import/API | Replacement |
91
+ | Import suffix | Capability |
70
92
  | --- | --- |
71
- | `@push.rocks/smartai` model/cache/AI SDK contracts | `@modelprofile.com/flexharness-models` |
72
- | Global `getModel` / `getModelSetup` | A `ModelRegistry` with explicit provider registrations |
73
- | Provider-specific request types | The relevant `flexharness-provider-*` package |
74
- | `openAiChatGptAuth` model option | `connection: createOpenAiChatGptModelConnection(credentials)` from `flexharness-openai-auth` |
75
- | SmartAI root authentication functions/types | `flexharness-openai-auth` |
76
- | `@push.rocks/smartai/providers` | `flexharness-openai-account` |
77
- | `@push.rocks/smartai/openai-chatgpt-auth` | `flexharness-openai-auth-files` |
78
- | SmartAI `/vision`, `/audio`, `/image` | `flexharness-media`, `flexharness-media-openai`, `flexharness-media-openai` |
79
- | SmartAI `/document`, `/ocr`, `/research` | `flexharness-document`, `flexharness-ocr`, `flexharness-research` |
80
- | `@push.rocks/smartagent` agent/event/persistence/adapter contracts | `flexharness-agent` |
81
- | SmartAgent `/tools` factories and output formatting | `flexharness-tools` |
82
- | Local contexts, `filesystemTool`, `shellTool`, `FileToolJobStore` | `flexharness-tools-node` |
83
- | SmartAgent `/compaction`, `/mcp` | `flexharness-compaction`, `flexharness-mcp` |
84
-
85
- Existing `ISmartAi*` and `TSmartAi*` contract names remain where their semantics are unchanged. The models package accepts provider IDs as strings; applications that expose a fixed set of providers should own that narrower union. The OpenAI account registry remains `SmartAiProviderRegistry`; it manages account adapters and is distinct from inference's `ModelRegistry`.
86
-
87
- Durable Agent event/job schemas, FlexHarness projection schemas, credential envelopes, and external credential-source names and paths are preserved. The package move does not require a data migration. Existing FlexHarness versioned migration APIs remain at `@modelprofile.com/flexharness/migration`.
88
-
89
- ## Developing and releasing the toolbox
90
-
91
- Each `ts_*` component has a `tspublish.json` declaring its dependencies, owned folders and published exports. Cross-component source imports use package names. TypeScript mappings provide source entrypoints for tsrun and declaration entrypoints for tsbuild's compiled-folder resolution; no workspace links are required.
92
-
93
- `pnpm build` builds the components in declared dependency order. `pnpm test` runs the deterministic model, agent and harness regressions. Live provider tests and the browser authentication smoke test are preserved in `test_integration/` and run only when explicitly selected; they are not part of release preflight.
94
-
95
- GitZone's `release.targets.npm.packageSource: "tspublish"` prepares and packs every component once, publishes the dependency order to the configured registries, and records the exact artifacts in its release journal. A partial release resumes those stored artifacts. Third-party OpenAI Codex notices accompany the authentication and account packages.
93
+ | `/anthropic`, `/openai`, `/google`, `/groq`, `/mistral`, `/xai`, `/perplexity`, `/ollama` | Model adapters and their request types |
94
+ | `/auth` | ChatGPT browser/device authentication, refresh and model connections |
95
+ | `/accounts` | Account lifecycle, model catalogs, rate limits and credential envelopes |
96
+ | `/auth/files` | Explicit interoperability with external credential files |
97
+ | `/media` | OpenAI audio and image generation |
98
+ | `/research` | Anthropic research utilities |
99
+
100
+ Provider SDKs are installed together. Authentication, file access and vendor media
101
+ are separate entrypoints and are not imported by the provider factory root. For
102
+ ChatGPT authentication, pass
103
+ `connection: createOpenAiChatGptModelConnection(credentials)` from `/auth` to the
104
+ OpenAI model options. API-key inference needs no authentication setup.
105
+
106
+ ## Migration
107
+
108
+ Replace the withdrawn 6.x component imports with the subpaths above. Provider
109
+ imports change from individual provider packages to
110
+ `@modelprofile.com/flexharness-providers/<provider>`. Keep direct agent and models
111
+ imports and upgrade them to the same release version. The removed package names
112
+ are not republished.
113
+
114
+ | Previous API | Replacement |
115
+ | --- | --- |
116
+ | SmartAI models, caching and AI SDK contracts | `flexharness-models` and explicit `ModelRegistry` registrations |
117
+ | SmartAI provider factories | `flexharness-providers/<provider>` |
118
+ | SmartAI authentication, account adapters and external credential files | `flexharness-providers/auth`, `/accounts`, `/auth/files` |
119
+ | SmartAI vision, document and OCR helpers | `flexharness/media`, `/documents`, `/ocr` |
120
+ | SmartAI audio, image and research helpers | `flexharness-providers/media`, `/research` |
121
+ | SmartAgent runtime, events and persistence contracts | `flexharness-agent` |
122
+ | SmartAgent tools, local tools, compaction and MCP | `flexharness/tools`, `/tools/node`, `/compaction`, `/mcp` |
123
+ | SmartChat sessions, CLI and web components | `flexharness/chat`, `/chat/cli`, `/chat/web` |
124
+ | SmartKVM | `flexharness/kvm`: `BrowserKvm`, `KvmTerminal`, `createKvmTools` |
125
+ | SmartOCR image AI helper | `ImageOcr.recognizeImageBytes` from `flexharness/ocr` |
126
+ | SmartOCR PDF AI helper | `extractTextFromPdf` from `flexharness/documents` |
127
+
128
+ For image OCR, rename `smartAiOcrEngine` to `engine` and `mistralOcrOptions` to
129
+ `mistralOptions`; pass the API key explicitly. Native searchable-PDF processing
130
+ through `SmartOcr.processPdfBuffer` remains in SmartOCR.
131
+
132
+ Existing `ISmartAi*` and `TSmartAi*` contracts, durable event/job schemas, harness
133
+ projections, credential envelopes and external credential paths remain unchanged.
134
+ The OpenAI account `SmartAiProviderRegistry` is separate from inference's
135
+ `ModelRegistry`. The package consolidation requires no data migration.
136
+
137
+ ## Developing and releasing
138
+
139
+ Four named `tspublish.json` descriptors own the published packages. Other folder
140
+ descriptors specify compilation order only. Each package explicitly declares its
141
+ owned folders, exports and required or optional peer dependencies. Source and
142
+ compiled declaration mappings support development without workspace links.
143
+
144
+ Run `pnpm build`, `pnpm test` and `pnpm run check:test`. Tests install packed
145
+ artifacts in disposable directories to check minimal dependency graphs, every
146
+ public subpath and browser imports. Live provider and browser authentication tests
147
+ remain opt-in in `test_integration/`.
148
+
149
+ The configured GitZone release prepares four packages, records their exact
150
+ artifacts, and publishes models before its dependents to npmjs and Verdaccio.
151
+ Third-party OpenAI Codex notices accompany the providers package.
96
152
 
97
153
  ## Core Setup
98
154
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@modelprofile.com/flexharness',
6
- version: '6.0.0',
6
+ version: '7.0.0',
7
7
  description: 'The FlexHarness toolbox source repository and shared dependency catalog.'
8
8
  }