veryfront 0.0.9 → 0.0.10
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/ai/index.js +238 -45
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/react.d.ts +103 -2
- package/dist/cli.js +3912 -865
- package/dist/components.js +42 -38
- package/dist/components.js.map +4 -4
- package/dist/config.js +8 -0
- package/dist/config.js.map +3 -3
- package/dist/data.js +19 -2
- package/dist/data.js.map +4 -4
- package/dist/index.js +70 -52
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/ai/index.js
CHANGED
|
@@ -844,17 +844,30 @@ var GoogleProvider = class extends BaseProvider {
|
|
|
844
844
|
}
|
|
845
845
|
};
|
|
846
846
|
|
|
847
|
-
// src/
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
847
|
+
// src/platform/compat/process.ts
|
|
848
|
+
import process from "node:process";
|
|
849
|
+
|
|
850
|
+
// src/platform/compat/runtime.ts
|
|
851
|
+
var isDeno = typeof Deno !== "undefined";
|
|
852
|
+
var isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
|
|
853
|
+
var isBun = typeof globalThis.Bun !== "undefined";
|
|
854
|
+
var isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
|
|
855
|
+
|
|
856
|
+
// src/platform/compat/process.ts
|
|
857
|
+
function cwd() {
|
|
858
|
+
if (isDeno) {
|
|
859
|
+
return process.cwd();
|
|
851
860
|
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
861
|
+
return process.cwd();
|
|
862
|
+
}
|
|
863
|
+
function getEnv(key) {
|
|
864
|
+
if (isDeno) {
|
|
865
|
+
return process.env(key);
|
|
855
866
|
}
|
|
856
|
-
return
|
|
867
|
+
return process.env[key];
|
|
857
868
|
}
|
|
869
|
+
|
|
870
|
+
// src/ai/providers/factory.ts
|
|
858
871
|
var ProviderRegistry = class {
|
|
859
872
|
constructor() {
|
|
860
873
|
this.providers = /* @__PURE__ */ new Map();
|
|
@@ -1675,7 +1688,7 @@ var BYTES_PER_MB = 1024 * 1024;
|
|
|
1675
1688
|
// deno.json
|
|
1676
1689
|
var deno_default = {
|
|
1677
1690
|
name: "veryfront",
|
|
1678
|
-
version: "0.0.
|
|
1691
|
+
version: "0.0.10",
|
|
1679
1692
|
nodeModulesDir: "auto",
|
|
1680
1693
|
workspace: [
|
|
1681
1694
|
"./examples/async-worker-redis",
|
|
@@ -3645,16 +3658,16 @@ function createMockAdapter() {
|
|
|
3645
3658
|
files.set(path, content);
|
|
3646
3659
|
return Promise.resolve();
|
|
3647
3660
|
},
|
|
3648
|
-
exists:
|
|
3661
|
+
exists: (path) => {
|
|
3649
3662
|
if (files.has(path))
|
|
3650
|
-
return true;
|
|
3663
|
+
return Promise.resolve(true);
|
|
3651
3664
|
if (directories.has(path))
|
|
3652
|
-
return true;
|
|
3665
|
+
return Promise.resolve(true);
|
|
3653
3666
|
for (const filePath of files.keys()) {
|
|
3654
3667
|
if (filePath.startsWith(path + "/"))
|
|
3655
|
-
return true;
|
|
3668
|
+
return Promise.resolve(true);
|
|
3656
3669
|
}
|
|
3657
|
-
return false;
|
|
3670
|
+
return Promise.resolve(false);
|
|
3658
3671
|
},
|
|
3659
3672
|
readDir: async function* (path) {
|
|
3660
3673
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -3932,14 +3945,14 @@ async function findTypeScriptFiles(dir, context) {
|
|
|
3932
3945
|
}
|
|
3933
3946
|
}
|
|
3934
3947
|
} else {
|
|
3935
|
-
const { fs, path } = await getNodeDeps(context);
|
|
3936
|
-
if (!
|
|
3948
|
+
const { fs: fs2, path } = await getNodeDeps(context);
|
|
3949
|
+
if (!fs2 || !path) {
|
|
3937
3950
|
return files;
|
|
3938
3951
|
}
|
|
3939
|
-
if (!
|
|
3952
|
+
if (!fs2.existsSync(dir)) {
|
|
3940
3953
|
return files;
|
|
3941
3954
|
}
|
|
3942
|
-
const entries =
|
|
3955
|
+
const entries = fs2.readdirSync(dir, { withFileTypes: true });
|
|
3943
3956
|
for (const entry of entries) {
|
|
3944
3957
|
const filePath = path.join(dir, entry.name);
|
|
3945
3958
|
if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"))) {
|
|
@@ -4037,10 +4050,165 @@ function toAISDKTools(tools) {
|
|
|
4037
4050
|
return aiTools;
|
|
4038
4051
|
}
|
|
4039
4052
|
|
|
4053
|
+
// src/platform/compat/fs.ts
|
|
4054
|
+
var NodeFileSystem = class {
|
|
4055
|
+
constructor() {
|
|
4056
|
+
this.fs = null;
|
|
4057
|
+
this.os = null;
|
|
4058
|
+
this.path = null;
|
|
4059
|
+
this.initialized = false;
|
|
4060
|
+
}
|
|
4061
|
+
async ensureInitialized() {
|
|
4062
|
+
if (this.initialized)
|
|
4063
|
+
return;
|
|
4064
|
+
if (!isNode) {
|
|
4065
|
+
throw toError(createError({
|
|
4066
|
+
type: "not_supported",
|
|
4067
|
+
message: "Node.js fs modules not available",
|
|
4068
|
+
feature: "Node.js"
|
|
4069
|
+
}));
|
|
4070
|
+
}
|
|
4071
|
+
const [fsModule, osModule, pathModule] = await Promise.all([
|
|
4072
|
+
import("node:fs/promises"),
|
|
4073
|
+
import("node:os"),
|
|
4074
|
+
import("node:path")
|
|
4075
|
+
]);
|
|
4076
|
+
this.fs = fsModule;
|
|
4077
|
+
this.os = osModule;
|
|
4078
|
+
this.path = pathModule;
|
|
4079
|
+
this.initialized = true;
|
|
4080
|
+
}
|
|
4081
|
+
async readTextFile(path) {
|
|
4082
|
+
await this.ensureInitialized();
|
|
4083
|
+
return await this.fs.readFile(path, { encoding: "utf8" });
|
|
4084
|
+
}
|
|
4085
|
+
async readFile(path) {
|
|
4086
|
+
await this.ensureInitialized();
|
|
4087
|
+
return await this.fs.readFile(path);
|
|
4088
|
+
}
|
|
4089
|
+
async writeTextFile(path, data) {
|
|
4090
|
+
await this.ensureInitialized();
|
|
4091
|
+
await this.fs.writeFile(path, data, { encoding: "utf8" });
|
|
4092
|
+
}
|
|
4093
|
+
async writeFile(path, data) {
|
|
4094
|
+
await this.ensureInitialized();
|
|
4095
|
+
await this.fs.writeFile(path, data);
|
|
4096
|
+
}
|
|
4097
|
+
async exists(path) {
|
|
4098
|
+
await this.ensureInitialized();
|
|
4099
|
+
try {
|
|
4100
|
+
await this.fs.access(path);
|
|
4101
|
+
return true;
|
|
4102
|
+
} catch (error) {
|
|
4103
|
+
if (error.code === "ENOENT") {
|
|
4104
|
+
return false;
|
|
4105
|
+
}
|
|
4106
|
+
throw error;
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
async stat(path) {
|
|
4110
|
+
await this.ensureInitialized();
|
|
4111
|
+
const stat = await this.fs.stat(path);
|
|
4112
|
+
return {
|
|
4113
|
+
isFile: stat.isFile(),
|
|
4114
|
+
isDirectory: stat.isDirectory(),
|
|
4115
|
+
isSymlink: stat.isSymbolicLink(),
|
|
4116
|
+
size: stat.size,
|
|
4117
|
+
mtime: stat.mtime
|
|
4118
|
+
};
|
|
4119
|
+
}
|
|
4120
|
+
async mkdir(path, options) {
|
|
4121
|
+
await this.ensureInitialized();
|
|
4122
|
+
await this.fs.mkdir(path, { recursive: options?.recursive ?? false });
|
|
4123
|
+
}
|
|
4124
|
+
async *readDir(path) {
|
|
4125
|
+
await this.ensureInitialized();
|
|
4126
|
+
const entries = await this.fs.readdir(path, { withFileTypes: true });
|
|
4127
|
+
for (const entry of entries) {
|
|
4128
|
+
yield {
|
|
4129
|
+
name: entry.name,
|
|
4130
|
+
isFile: entry.isFile(),
|
|
4131
|
+
isDirectory: entry.isDirectory()
|
|
4132
|
+
};
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
async remove(path, options) {
|
|
4136
|
+
await this.ensureInitialized();
|
|
4137
|
+
await this.fs.rm(path, { recursive: options?.recursive ?? false, force: options?.recursive ?? false });
|
|
4138
|
+
}
|
|
4139
|
+
async makeTempDir(options) {
|
|
4140
|
+
await this.ensureInitialized();
|
|
4141
|
+
const tempDir = this.path.join(this.os.tmpdir(), `${options?.prefix ?? "tmp-"}${Math.random().toString(36).substring(2, 8)}`);
|
|
4142
|
+
await this.fs.mkdir(tempDir, { recursive: true });
|
|
4143
|
+
return tempDir;
|
|
4144
|
+
}
|
|
4145
|
+
};
|
|
4146
|
+
var DenoFileSystem = class {
|
|
4147
|
+
async readTextFile(path) {
|
|
4148
|
+
return await Deno.readTextFile(path);
|
|
4149
|
+
}
|
|
4150
|
+
async readFile(path) {
|
|
4151
|
+
return await Deno.readFile(path);
|
|
4152
|
+
}
|
|
4153
|
+
async writeTextFile(path, data) {
|
|
4154
|
+
await Deno.writeTextFile(path, data);
|
|
4155
|
+
}
|
|
4156
|
+
async writeFile(path, data) {
|
|
4157
|
+
await Deno.writeFile(path, data);
|
|
4158
|
+
}
|
|
4159
|
+
async exists(path) {
|
|
4160
|
+
try {
|
|
4161
|
+
await Deno.stat(path);
|
|
4162
|
+
return true;
|
|
4163
|
+
} catch (error) {
|
|
4164
|
+
if (error instanceof Deno.errors.NotFound) {
|
|
4165
|
+
return false;
|
|
4166
|
+
}
|
|
4167
|
+
throw error;
|
|
4168
|
+
}
|
|
4169
|
+
}
|
|
4170
|
+
async stat(path) {
|
|
4171
|
+
const stat = await Deno.stat(path);
|
|
4172
|
+
return {
|
|
4173
|
+
isFile: stat.isFile,
|
|
4174
|
+
isDirectory: stat.isDirectory,
|
|
4175
|
+
isSymlink: stat.isSymlink,
|
|
4176
|
+
size: stat.size,
|
|
4177
|
+
mtime: stat.mtime
|
|
4178
|
+
};
|
|
4179
|
+
}
|
|
4180
|
+
async mkdir(path, options) {
|
|
4181
|
+
await Deno.mkdir(path, { recursive: options?.recursive ?? false });
|
|
4182
|
+
}
|
|
4183
|
+
async *readDir(path) {
|
|
4184
|
+
for await (const entry of Deno.readDir(path)) {
|
|
4185
|
+
yield {
|
|
4186
|
+
name: entry.name,
|
|
4187
|
+
isFile: entry.isFile,
|
|
4188
|
+
isDirectory: entry.isDirectory
|
|
4189
|
+
};
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4192
|
+
async remove(path, options) {
|
|
4193
|
+
await Deno.remove(path, { recursive: options?.recursive ?? false });
|
|
4194
|
+
}
|
|
4195
|
+
async makeTempDir(options) {
|
|
4196
|
+
return await Deno.makeTempDir({ prefix: options?.prefix });
|
|
4197
|
+
}
|
|
4198
|
+
};
|
|
4199
|
+
function createFileSystem() {
|
|
4200
|
+
if (isDeno) {
|
|
4201
|
+
return new DenoFileSystem();
|
|
4202
|
+
} else {
|
|
4203
|
+
return new NodeFileSystem();
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4206
|
+
|
|
4040
4207
|
// src/ai/utils/setup.ts
|
|
4208
|
+
var fs = createFileSystem();
|
|
4041
4209
|
async function setupAI(options = {}) {
|
|
4042
4210
|
const {
|
|
4043
|
-
baseDir =
|
|
4211
|
+
baseDir = cwd(),
|
|
4044
4212
|
aiDir = "ai",
|
|
4045
4213
|
tools: manualTools = {},
|
|
4046
4214
|
agents: manualAgents = {},
|
|
@@ -4057,7 +4225,7 @@ async function setupAI(options = {}) {
|
|
|
4057
4225
|
const errors = [];
|
|
4058
4226
|
if (manifestPath) {
|
|
4059
4227
|
try {
|
|
4060
|
-
const manifest = await
|
|
4228
|
+
const manifest = await fs.readTextFile(manifestPath).then(JSON.parse);
|
|
4061
4229
|
if (manifest.tools) {
|
|
4062
4230
|
for (const [id, tool2] of Object.entries(manifest.tools)) {
|
|
4063
4231
|
tools.set(id, tool2);
|
|
@@ -4083,7 +4251,7 @@ async function setupAI(options = {}) {
|
|
|
4083
4251
|
}
|
|
4084
4252
|
}
|
|
4085
4253
|
if (verbose) {
|
|
4086
|
-
|
|
4254
|
+
cliLogger.info(`[setupAI] Loaded manifest: ${tools.size} tools, ${agents.size} agents`);
|
|
4087
4255
|
}
|
|
4088
4256
|
} catch (error) {
|
|
4089
4257
|
errors.push({
|
|
@@ -4114,11 +4282,11 @@ async function setupAI(options = {}) {
|
|
|
4114
4282
|
}
|
|
4115
4283
|
errors.push(...discovered.errors);
|
|
4116
4284
|
if (verbose) {
|
|
4117
|
-
|
|
4285
|
+
cliLogger.info(`[setupAI] Discovered: ${tools.size} tools, ${agents.size} agents`);
|
|
4118
4286
|
}
|
|
4119
4287
|
} catch (error) {
|
|
4120
4288
|
if (verbose) {
|
|
4121
|
-
|
|
4289
|
+
cliLogger.info(`[setupAI] Discovery skipped: ${error}`);
|
|
4122
4290
|
}
|
|
4123
4291
|
}
|
|
4124
4292
|
}
|
|
@@ -4166,24 +4334,6 @@ async function setupAI(options = {}) {
|
|
|
4166
4334
|
};
|
|
4167
4335
|
return result;
|
|
4168
4336
|
}
|
|
4169
|
-
function detectCwd() {
|
|
4170
|
-
if (typeof Deno !== "undefined" && typeof process.cwd === "function") {
|
|
4171
|
-
return process.cwd();
|
|
4172
|
-
}
|
|
4173
|
-
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
4174
|
-
return process.cwd();
|
|
4175
|
-
}
|
|
4176
|
-
return ".";
|
|
4177
|
-
}
|
|
4178
|
-
async function loadManifest(path) {
|
|
4179
|
-
if (typeof Deno !== "undefined" && typeof Deno.readTextFile === "function") {
|
|
4180
|
-
const content2 = await Deno.readTextFile(path);
|
|
4181
|
-
return JSON.parse(content2);
|
|
4182
|
-
}
|
|
4183
|
-
const fs = await import("node:fs/promises");
|
|
4184
|
-
const content = await fs.readFile(path, "utf-8");
|
|
4185
|
-
return JSON.parse(content);
|
|
4186
|
-
}
|
|
4187
4337
|
|
|
4188
4338
|
// src/ai/mcp/server.ts
|
|
4189
4339
|
var MCPServer = class {
|
|
@@ -5455,6 +5605,23 @@ function waitForApproval(id, options = {}) {
|
|
|
5455
5605
|
};
|
|
5456
5606
|
}
|
|
5457
5607
|
|
|
5608
|
+
// src/platform/compat/path-helper.ts
|
|
5609
|
+
import nodePath from "node:path";
|
|
5610
|
+
var pathMod = null;
|
|
5611
|
+
var denoPathPromise = null;
|
|
5612
|
+
if (typeof Deno === "undefined") {
|
|
5613
|
+
pathMod = nodePath;
|
|
5614
|
+
} else {
|
|
5615
|
+
denoPathPromise = import("path").then((mod) => {
|
|
5616
|
+
pathMod = mod;
|
|
5617
|
+
return pathMod;
|
|
5618
|
+
});
|
|
5619
|
+
}
|
|
5620
|
+
var sep = nodePath.sep;
|
|
5621
|
+
|
|
5622
|
+
// src/ai/workflow/blob/s3-storage.ts
|
|
5623
|
+
import { S3Client, PutObjectCommand, GetObjectCommand, DeleteObjectCommand, HeadObjectCommand, CreateBucketCommand } from "@aws-sdk/client-s3";
|
|
5624
|
+
|
|
5458
5625
|
// src/ai/workflow/backends/types.ts
|
|
5459
5626
|
function hasLockSupport(backend) {
|
|
5460
5627
|
return typeof backend.acquireLock === "function" && typeof backend.releaseLock === "function";
|
|
@@ -5795,6 +5962,15 @@ var MemoryBackend = class {
|
|
|
5795
5962
|
}
|
|
5796
5963
|
};
|
|
5797
5964
|
|
|
5965
|
+
// src/ai/workflow/backends/redis.ts
|
|
5966
|
+
var DenoRedis = void 0;
|
|
5967
|
+
var NodeRedis = void 0;
|
|
5968
|
+
if (typeof Deno !== "undefined") {
|
|
5969
|
+
DenoRedis = await import("redis");
|
|
5970
|
+
} else {
|
|
5971
|
+
NodeRedis = await import("redis");
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5798
5974
|
// src/ai/workflow/executor/dag-executor.ts
|
|
5799
5975
|
var DAGExecutor = class {
|
|
5800
5976
|
constructor(config) {
|
|
@@ -6038,7 +6214,7 @@ var DAGExecutor = class {
|
|
|
6038
6214
|
/**
|
|
6039
6215
|
* Execute a sub-workflow node
|
|
6040
6216
|
*/
|
|
6041
|
-
async executeSubWorkflowNode(node, config, context,
|
|
6217
|
+
async executeSubWorkflowNode(node, config, context, _nodeStates) {
|
|
6042
6218
|
const startTime = Date.now();
|
|
6043
6219
|
let workflowDef;
|
|
6044
6220
|
if (typeof config.workflow === "string") {
|
|
@@ -6601,7 +6777,10 @@ var StepExecutor = class {
|
|
|
6601
6777
|
const resolvedTool = typeof tool2 === "string" ? this.getTool(tool2) : tool2;
|
|
6602
6778
|
const result = await resolvedTool.execute(
|
|
6603
6779
|
input,
|
|
6604
|
-
{
|
|
6780
|
+
{
|
|
6781
|
+
agentId: "workflow",
|
|
6782
|
+
blobStorage: this.config.blobStorage
|
|
6783
|
+
}
|
|
6605
6784
|
);
|
|
6606
6785
|
return result;
|
|
6607
6786
|
}
|
|
@@ -6716,7 +6895,10 @@ var WorkflowExecutor = class _WorkflowExecutor {
|
|
|
6716
6895
|
lockDuration: _WorkflowExecutor.DEFAULT_LOCK_DURATION,
|
|
6717
6896
|
...config
|
|
6718
6897
|
};
|
|
6719
|
-
this.stepExecutor = new StepExecutor(
|
|
6898
|
+
this.stepExecutor = new StepExecutor({
|
|
6899
|
+
...this.config.stepExecutor,
|
|
6900
|
+
blobStorage: this.config.blobStorage
|
|
6901
|
+
});
|
|
6720
6902
|
this.checkpointManager = new CheckpointManager({
|
|
6721
6903
|
backend: this.config.backend,
|
|
6722
6904
|
debug: this.config.debug
|
|
@@ -6731,6 +6913,16 @@ var WorkflowExecutor = class _WorkflowExecutor {
|
|
|
6731
6913
|
onWaiting: () => {
|
|
6732
6914
|
}
|
|
6733
6915
|
});
|
|
6916
|
+
if (this.config.blobStorage) {
|
|
6917
|
+
const bs = this.config.blobStorage;
|
|
6918
|
+
this.blobResolver = {
|
|
6919
|
+
getText: (ref) => ref.__kind === "blob" ? bs.getText(ref.id) : Promise.resolve(null),
|
|
6920
|
+
getBytes: (ref) => ref.__kind === "blob" ? bs.getBytes(ref.id) : Promise.resolve(null),
|
|
6921
|
+
getStream: (ref) => ref.__kind === "blob" ? bs.getStream(ref.id) : Promise.resolve(null),
|
|
6922
|
+
stat: (ref) => ref.__kind === "blob" ? bs.stat(ref.id) : Promise.resolve(null),
|
|
6923
|
+
delete: (ref) => ref.__kind === "blob" ? bs.delete(ref.id) : Promise.resolve(void 0)
|
|
6924
|
+
};
|
|
6925
|
+
}
|
|
6734
6926
|
}
|
|
6735
6927
|
static {
|
|
6736
6928
|
/** Default lock duration: 30 seconds */
|
|
@@ -6909,7 +7101,8 @@ var WorkflowExecutor = class _WorkflowExecutor {
|
|
|
6909
7101
|
const builderContext = {
|
|
6910
7102
|
input: context.input,
|
|
6911
7103
|
context,
|
|
6912
|
-
blobStorage: this.config.blobStorage
|
|
7104
|
+
blobStorage: this.config.blobStorage,
|
|
7105
|
+
blob: this.blobResolver
|
|
6913
7106
|
};
|
|
6914
7107
|
nodes = workflow2.steps(builderContext);
|
|
6915
7108
|
}
|