@modelprofile.com/flexharness 6.1.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.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts_chat/classes.chatsession.d.ts +37 -0
- package/dist_ts_chat/classes.chatsession.js +102 -0
- package/dist_ts_chat/index.d.ts +2 -0
- package/dist_ts_chat/index.js +2 -0
- package/dist_ts_chat/interfaces.d.ts +72 -0
- package/dist_ts_chat/interfaces.js +2 -0
- package/dist_ts_chat/plugins.d.ts +4 -0
- package/dist_ts_chat/plugins.js +4 -0
- package/dist_ts_chat_cli/components.chatapp.d.ts +10 -0
- package/dist_ts_chat_cli/components.chatapp.js +75 -0
- package/dist_ts_chat_cli/components.inputarea.d.ts +7 -0
- package/dist_ts_chat_cli/components.inputarea.js +18 -0
- package/dist_ts_chat_cli/components.message.d.ts +12 -0
- package/dist_ts_chat_cli/components.message.js +21 -0
- package/dist_ts_chat_cli/components.messagelist.d.ts +9 -0
- package/dist_ts_chat_cli/components.messagelist.js +19 -0
- package/dist_ts_chat_cli/components.statusbar.d.ts +9 -0
- package/dist_ts_chat_cli/components.statusbar.js +15 -0
- package/dist_ts_chat_cli/index.d.ts +2 -0
- package/dist_ts_chat_cli/index.js +2 -0
- package/dist_ts_chat_cli/plugins.d.ts +12 -0
- package/dist_ts_chat_cli/plugins.js +14 -0
- package/dist_ts_chat_cli/startchat.d.ts +18 -0
- package/dist_ts_chat_cli/startchat.js +17 -0
- package/dist_ts_chat_web/flexchat-input.d.ts +21 -0
- package/dist_ts_chat_web/flexchat-input.js +172 -0
- package/dist_ts_chat_web/flexchat-message.d.ts +26 -0
- package/dist_ts_chat_web/flexchat-message.js +174 -0
- package/dist_ts_chat_web/flexchat-window.d.ts +34 -0
- package/dist_ts_chat_web/flexchat-window.js +394 -0
- package/dist_ts_chat_web/index.d.ts +3 -0
- package/dist_ts_chat_web/index.js +4 -0
- package/dist_ts_chat_web/plugins.d.ts +6 -0
- package/dist_ts_chat_web/plugins.js +4 -0
- package/dist_ts_compaction/index.d.ts +2 -0
- package/dist_ts_compaction/index.js +2 -0
- package/dist_ts_compaction/plugins.d.ts +4 -0
- package/dist_ts_compaction/plugins.js +3 -0
- package/dist_ts_compaction/smartagent.compaction.d.ts +14 -0
- package/dist_ts_compaction/smartagent.compaction.js +49 -0
- package/dist_ts_document/index.d.ts +19 -0
- package/dist_ts_document/index.js +55 -0
- package/dist_ts_document/plugins.d.ts +3 -0
- package/dist_ts_document/plugins.js +4 -0
- package/dist_ts_kvm/classes.browserkvm.d.ts +22 -0
- package/dist_ts_kvm/classes.browserkvm.js +271 -0
- package/dist_ts_kvm/classes.kvmterminal.d.ts +8 -0
- package/dist_ts_kvm/classes.kvmterminal.js +88 -0
- package/dist_ts_kvm/commandwrappers.d.ts +14 -0
- package/dist_ts_kvm/commandwrappers.js +58 -0
- package/dist_ts_kvm/index.d.ts +6 -0
- package/dist_ts_kvm/index.js +7 -0
- package/dist_ts_kvm/interfaces.d.ts +106 -0
- package/dist_ts_kvm/interfaces.js +2 -0
- package/dist_ts_kvm/ocr.d.ts +14 -0
- package/dist_ts_kvm/ocr.js +23 -0
- package/dist_ts_kvm/plugins.d.ts +6 -0
- package/dist_ts_kvm/plugins.js +10 -0
- package/dist_ts_kvm/tools.d.ts +15 -0
- package/dist_ts_kvm/tools.js +40 -0
- package/dist_ts_mcp/index.d.ts +86 -0
- package/dist_ts_mcp/index.js +284 -0
- package/dist_ts_mcp/requestcontext.d.ts +11 -0
- package/dist_ts_mcp/requestcontext.js +42 -0
- package/dist_ts_media/index.d.ts +8 -0
- package/dist_ts_media/index.js +21 -0
- package/dist_ts_media/plugins.d.ts +2 -0
- package/dist_ts_media/plugins.js +3 -0
- package/dist_ts_ocr/classes.imageocr.d.ts +19 -0
- package/dist_ts_ocr/classes.imageocr.js +27 -0
- package/dist_ts_ocr/index.d.ts +2 -0
- package/dist_ts_ocr/index.js +3 -0
- package/dist_ts_ocr/ocr.mistral.d.ts +75 -0
- package/dist_ts_ocr/ocr.mistral.js +77 -0
- package/dist_ts_tools/index.d.ts +17 -0
- package/dist_ts_tools/index.js +10 -0
- package/dist_ts_tools/plugins.d.ts +7 -0
- package/dist_ts_tools/plugins.js +6 -0
- package/dist_ts_tools/tool.browser.d.ts +11 -0
- package/dist_ts_tools/tool.browser.js +128 -0
- package/dist_ts_tools/tool.context.d.ts +4 -0
- package/dist_ts_tools/tool.context.js +23 -0
- package/dist_ts_tools/tool.filesystem.d.ts +11 -0
- package/dist_ts_tools/tool.filesystem.js +106 -0
- package/dist_ts_tools/tool.http.d.ts +2 -0
- package/dist_ts_tools/tool.http.js +65 -0
- package/dist_ts_tools/tool.json.d.ts +2 -0
- package/dist_ts_tools/tool.json.js +47 -0
- package/dist_ts_tools/tool.shell.d.ts +15 -0
- package/dist_ts_tools/tool.shell.js +329 -0
- package/dist_ts_tools/utils.truncation.d.ts +10 -0
- package/dist_ts_tools/utils.truncation.js +26 -0
- package/dist_ts_tools_node/index.d.ts +5 -0
- package/dist_ts_tools_node/index.js +4 -0
- package/dist_ts_tools_node/plugins.d.ts +13 -0
- package/dist_ts_tools_node/plugins.js +13 -0
- package/dist_ts_tools_node/tool.context.d.ts +31 -0
- package/dist_ts_tools_node/tool.context.js +837 -0
- package/dist_ts_tools_node/tool.persistence.d.ts +15 -0
- package/dist_ts_tools_node/tool.persistence.js +129 -0
- package/dist_ts_tools_node/tools.local.d.ts +11 -0
- package/dist_ts_tools_node/tools.local.js +15 -0
- package/package.json +112 -4
- package/readme.md +122 -66
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/readme.md +122 -66
- package/ts_chat/classes.chatsession.ts +116 -0
- package/ts_chat/index.ts +8 -0
- package/ts_chat/interfaces.ts +64 -0
- package/ts_chat/plugins.ts +7 -0
- package/ts_chat/readme.md +49 -0
- package/ts_chat_cli/components.chatapp.ts +103 -0
- package/ts_chat_cli/components.inputarea.ts +29 -0
- package/ts_chat_cli/components.message.ts +48 -0
- package/ts_chat_cli/components.messagelist.ts +45 -0
- package/ts_chat_cli/components.statusbar.ts +31 -0
- package/ts_chat_cli/index.ts +2 -0
- package/ts_chat_cli/plugins.ts +21 -0
- package/ts_chat_cli/readme.md +40 -0
- package/ts_chat_cli/startchat.ts +34 -0
- package/ts_chat_web/flexchat-input.ts +184 -0
- package/ts_chat_web/flexchat-message.ts +185 -0
- package/ts_chat_web/flexchat-window.ts +416 -0
- package/ts_chat_web/index.ts +3 -0
- package/ts_chat_web/plugins.ts +9 -0
- package/ts_chat_web/readme.md +46 -0
- package/ts_compaction/index.ts +2 -0
- package/ts_compaction/plugins.ts +6 -0
- package/ts_compaction/readme.md +37 -0
- package/ts_compaction/smartagent.compaction.ts +59 -0
- package/ts_document/index.ts +82 -0
- package/ts_document/plugins.ts +3 -0
- package/ts_document/readme.md +49 -0
- package/ts_kvm/classes.browserkvm.ts +335 -0
- package/ts_kvm/classes.kvmterminal.ts +103 -0
- package/ts_kvm/commandwrappers.ts +83 -0
- package/ts_kvm/index.ts +6 -0
- package/ts_kvm/interfaces.ts +152 -0
- package/ts_kvm/ocr.ts +41 -0
- package/ts_kvm/plugins.ts +13 -0
- package/ts_kvm/readme.md +482 -0
- package/ts_kvm/tools.ts +58 -0
- package/ts_mcp/index.ts +470 -0
- package/ts_mcp/readme.md +37 -0
- package/ts_mcp/requestcontext.ts +66 -0
- package/ts_media/index.ts +29 -0
- package/ts_media/plugins.ts +2 -0
- package/ts_media/readme.md +37 -0
- package/ts_ocr/classes.imageocr.ts +53 -0
- package/ts_ocr/index.ts +2 -0
- package/ts_ocr/ocr.mistral.ts +192 -0
- package/ts_ocr/readme.md +48 -0
- package/ts_tools/index.ts +49 -0
- package/ts_tools/plugins.ts +7 -0
- package/ts_tools/readme.md +37 -0
- package/ts_tools/tool.browser.ts +159 -0
- package/ts_tools/tool.context.ts +23 -0
- package/ts_tools/tool.filesystem.ts +144 -0
- package/ts_tools/tool.http.ts +78 -0
- package/ts_tools/tool.json.ts +53 -0
- package/ts_tools/tool.shell.ts +418 -0
- package/ts_tools/utils.truncation.ts +39 -0
- package/ts_tools_node/index.ts +5 -0
- package/ts_tools_node/plugins.ts +16 -0
- package/ts_tools_node/readme.md +37 -0
- package/ts_tools_node/tool.context.ts +991 -0
- package/ts_tools_node/tool.persistence.ts +146 -0
- 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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbC5wZXJzaXN0ZW5jZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzX3Rvb2xzX25vZGUvdG9vbC5wZXJzaXN0ZW5jZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssT0FBTyxNQUFNLGNBQWMsQ0FBQztBQVF4QyxNQUFNLGNBQWMsR0FBRyxDQUFDLEtBQWMsRUFBb0IsRUFBRTtJQUMxRCxNQUFNLFFBQVEsR0FBRyxLQUFrQyxDQUFDO0lBQ3BELElBQ0UsQ0FBQyxRQUFRO1dBQ04sUUFBUSxDQUFDLGFBQWEsS0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QUksRUFBRSxRQUFRLENBQUMsRUFBRSxXQUFXLENBQUMsQ0FBQztZQUNuRixPQUFPLFFBQVEsQ0FBQztRQUNsQixDQUFDLEVBQUUsV0FBVyxDQUFDLENBQUM7SUFDbEIsQ0FBQztDQUNGIn0=
|
|
@@ -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": "
|
|
5
|
+
"version": "7.0.0",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"description": "Managed
|
|
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": "
|
|
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":
|
|
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,
|
|
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
|
-
##
|
|
7
|
+
## Install and choose an entrypoint
|
|
8
8
|
|
|
9
|
-
|
|
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 |
|
|
13
|
+
| Package | Use it for |
|
|
12
14
|
| --- | --- |
|
|
13
|
-
| `flexharness
|
|
14
|
-
| `flexharness-
|
|
15
|
-
| `flexharness-
|
|
16
|
-
| `flexharness` |
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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-
|
|
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-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
76
|
+
```typescript
|
|
77
|
+
import { ChatSession } from '@modelprofile.com/flexharness/chat';
|
|
78
|
+
import '@modelprofile.com/flexharness/chat/web';
|
|
79
|
+
```
|
|
62
80
|
|
|
63
|
-
|
|
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
|
-
##
|
|
86
|
+
## Provider subpaths
|
|
66
87
|
|
|
67
|
-
|
|
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
|
-
|
|
|
91
|
+
| Import suffix | Capability |
|
|
70
92
|
| --- | --- |
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| `
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|