@grepai/cli 0.7.6 → 0.7.8

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 (3) hide show
  1. package/index.js +40 -21
  2. package/index.js.map +5 -5
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -89625,26 +89625,26 @@ class AgentFs extends Service()("@grepai/core/internal/services/agentfs", {
89625
89625
  const { authToken, url: url3, syncMode } = config3.experimental__agentFs;
89626
89626
  const baseAgentFsLocalPath = path4.resolve(config3.cwd, "./.grepai/agentfs");
89627
89627
  yield* fs2.makeDirectory(baseAgentFsLocalPath, { recursive: true });
89628
- const db = yield* tryPromise2({
89629
- try: async () => {
89630
- const db2 = await connect({
89628
+ const db = yield* firstSuccessOf2([
89629
+ tryPromise2({
89630
+ try: () => connect({
89631
89631
  path: path4.join(baseAgentFsLocalPath, "local.db"),
89632
89632
  url: url3,
89633
89633
  authToken,
89634
89634
  clientName: "grepai"
89635
- });
89636
- if (syncMode === "pull") {
89637
- await db2.pull().catch((e) => {
89638
- if (e instanceof Error && e.message.includes("File is locked by another process")) {
89639
- return;
89640
- }
89641
- throw e;
89642
- });
89643
- }
89644
- return db2;
89645
- },
89646
- catch: (cause2) => new AgentFsError({ cause: cause2 })
89647
- });
89635
+ }),
89636
+ catch: (cause2) => new AgentFsError({ cause: cause2 })
89637
+ }),
89638
+ tryPromise2({
89639
+ try: () => connect({
89640
+ path: ":memory:",
89641
+ url: url3,
89642
+ authToken,
89643
+ clientName: "grepai"
89644
+ }),
89645
+ catch: (cause2) => new AgentFsError({ cause: cause2 })
89646
+ })
89647
+ ]);
89648
89648
  const agentFs = yield* tryPromise2({
89649
89649
  try: () => AgentFS2.openWith(db),
89650
89650
  catch: (cause2) => new AgentFsError({ cause: cause2 })
@@ -89655,11 +89655,21 @@ class AgentFs extends Service()("@grepai/core/internal/services/agentfs", {
89655
89655
  catch: (cause2) => new AgentFsError({ cause: cause2 })
89656
89656
  });
89657
89657
  const dbPull = () => tryPromise2({
89658
- try: () => db.pull(),
89658
+ try: async () => {
89659
+ if (syncMode === "pull") {
89660
+ return db.pull();
89661
+ }
89662
+ throw new Error('`experimental__agentFs.syncMode` is not set to "pull"');
89663
+ },
89659
89664
  catch: (cause2) => new AgentFsError({ cause: cause2 })
89660
89665
  });
89661
89666
  const dbPush = () => tryPromise2({
89662
- try: () => db.push(),
89667
+ try: async () => {
89668
+ if (syncMode === "push") {
89669
+ return db.push();
89670
+ }
89671
+ throw new Error('`experimental__agentFs.syncMode` is not set to "push"');
89672
+ },
89663
89673
  catch: (cause2) => new AgentFsError({ cause: cause2 })
89664
89674
  });
89665
89675
  return {
@@ -105231,7 +105241,16 @@ class FileIndexer extends Service()("@grepai/core/internal/services/file-indexer
105231
105241
  const embeddings = yield* embedder.embedMany(map4(chunks2, ({ content: content2 }) => content2)).pipe(map16(map4((embedding, index2) => ({
105232
105242
  chunkId: chunks2[index2].id,
105233
105243
  embedding
105234
- }))));
105244
+ }))), catchTags2({
105245
+ VercelAiError: (cause2) => {
105246
+ if (cause2.message.includes("at most 100 requests")) {
105247
+ return new VercelAiError({
105248
+ cause: new Error(cause2.message + " " + input.filePath)
105249
+ });
105250
+ }
105251
+ return cause2;
105252
+ }
105253
+ }));
105235
105254
  yield* pipe(documentStorage.insert({ filePath, hash: hash3 }), zipRight3(chunkStorage.insertMany(chunks2)), zipRight3(chunkStorage.insertManyEmbeddings(embeddings)));
105236
105255
  }, (effect3) => match2(db, {
105237
105256
  onNone: () => effect3,
@@ -112849,11 +112868,11 @@ var program = gen2(function* () {
112849
112868
  ]));
112850
112869
  const cli = exports_Command.run(command, {
112851
112870
  name: "GREP AI",
112852
- version: "v0.7.6"
112871
+ version: "v0.7.8"
112853
112872
  });
112854
112873
  yield* cli(process.argv);
112855
112874
  });
112856
112875
  program.pipe(provide2(mergeAll5(GrepAi.Default).pipe(provideMerge2(Clack.Default), provideMerge2(exports_BunContext.layer))), exports_BunRuntime.runMain);
112857
112876
 
112858
- //# debugId=809A729242A92C2664756E2164756E21
112877
+ //# debugId=5A46409FBB25BEA164756E2164756E21
112859
112878
  //# sourceMappingURL=index.js.map