Dax Raad 9 months ago
parent
commit
e88264075a

+ 1 - 1
js/example/cli.ts

@@ -1,5 +1,5 @@
 import { App } from "../src/app";
 import { App } from "../src/app";
-import path from "node:path";
+import path from "path";
 import { edit } from "../src/tool";
 import { edit } from "../src/tool";
 import { FileTimes } from "../src/tool/util/file-times";
 import { FileTimes } from "../src/tool/util/file-times";
 
 

+ 1 - 1
js/src/app/config.ts

@@ -1,4 +1,4 @@
-import path from "node:path";
+import path from "path";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { z } from "zod";
 import { z } from "zod";
 import { LLM } from "../llm/llm";
 import { LLM } from "../llm/llm";

+ 1 - 1
js/src/app/index.ts

@@ -1,4 +1,4 @@
-import fs from "node:fs/promises";
+import fs from "fs/promises";
 import { AppPath } from "./path";
 import { AppPath } from "./path";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { Context } from "../util/context";
 import { Context } from "../util/context";

+ 1 - 1
js/src/app/path.ts

@@ -1,4 +1,4 @@
-import path from "node:path";
+import path from "path";
 
 
 export namespace AppPath {
 export namespace AppPath {
   export function data(input: string) {
   export function data(input: string) {

+ 1 - 1
js/src/bun/index.ts

@@ -1,4 +1,4 @@
-import path from "node:path";
+import path from "path";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 export namespace BunProc {
 export namespace BunProc {
   const log = Log.create({ service: "bun" });
   const log = Log.create({ service: "bun" });

+ 1 - 1
js/src/id/id.ts

@@ -1,5 +1,5 @@
 import { z } from "zod";
 import { z } from "zod";
-import { randomBytes } from "node:crypto";
+import { randomBytes } from "crypto";
 
 
 export namespace Identifier {
 export namespace Identifier {
   const prefixes = {
   const prefixes = {

+ 2 - 2
js/src/index.ts

@@ -1,7 +1,7 @@
 import { App } from "./app";
 import { App } from "./app";
 import { Server } from "./server/server";
 import { Server } from "./server/server";
-import fs from "node:fs/promises";
-import path from "node:path";
+import fs from "fs/promises";
+import path from "path";
 import { Bus } from "./bus";
 import { Bus } from "./bus";
 import { Session } from "./session/session";
 import { Session } from "./session/session";
 import cac from "cac";
 import cac from "cac";

+ 1 - 1
js/src/llm/llm.ts

@@ -1,7 +1,7 @@
 import { App } from "../app";
 import { App } from "../app";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { mergeDeep } from "remeda";
 import { mergeDeep } from "remeda";
-import path from "node:path";
+import path from "path";
 
 
 import type { LanguageModel, Provider } from "ai";
 import type { LanguageModel, Provider } from "ai";
 import { NoSuchModelError } from "ai";
 import { NoSuchModelError } from "ai";

+ 2 - 2
js/src/lsp/client.ts

@@ -1,5 +1,5 @@
-import { spawn } from "node:child_process";
-import path from "node:path";
+import { spawn } from "child_process";
+import path from "path";
 import {
 import {
   createMessageConnection,
   createMessageConnection,
   StreamMessageReader,
   StreamMessageReader,

+ 1 - 1
js/src/lsp/index.ts

@@ -1,7 +1,7 @@
 import { App } from "../app";
 import { App } from "../app";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { LSPClient } from "./client";
 import { LSPClient } from "./client";
-import path from "node:path";
+import path from "path";
 
 
 export namespace LSP {
 export namespace LSP {
   const log = Log.create({ service: "lsp" });
   const log = Log.create({ service: "lsp" });

+ 2 - 3
js/src/session/session.ts

@@ -1,4 +1,4 @@
-import path from "node:path";
+import path from "path";
 import { App } from "../app/";
 import { App } from "../app/";
 import { Identifier } from "../id/id";
 import { Identifier } from "../id/id";
 import { LLM } from "../llm/llm";
 import { LLM } from "../llm/llm";
@@ -6,6 +6,7 @@ import { Storage } from "../storage/storage";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import {
 import {
   convertToModelMessages,
   convertToModelMessages,
+  generateText,
   stepCountIs,
   stepCountIs,
   streamText,
   streamText,
   type TextUIPart,
   type TextUIPart,
@@ -181,7 +182,6 @@ export namespace Session {
       }
       }
       msgs.push(system);
       msgs.push(system);
       state().messages.set(input.sessionID, msgs);
       state().messages.set(input.sessionID, msgs);
-      /*
       generateText({
       generateText({
         messages: convertToModelMessages([
         messages: convertToModelMessages([
           {
           {
@@ -204,7 +204,6 @@ export namespace Session {
           draft.title = result.text;
           draft.title = result.text;
         });
         });
       });
       });
-      */
       await write(system);
       await write(system);
     }
     }
     const msg: Message = {
     const msg: Message = {

+ 1 - 1
js/src/storage/storage.ts

@@ -1,6 +1,6 @@
 import { FileStorage } from "@flystorage/file-storage";
 import { FileStorage } from "@flystorage/file-storage";
 import { LocalStorageAdapter } from "@flystorage/local-fs";
 import { LocalStorageAdapter } from "@flystorage/local-fs";
-import fs from "node:fs/promises";
+import fs from "fs/promises";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { App } from "../app";
 import { App } from "../app";
 import { AppPath } from "../app/path";
 import { AppPath } from "../app/path";

+ 1 - 3
js/src/tool/bash.ts

@@ -193,9 +193,7 @@ export const bash = Tool.define({
       timeout: timeout,
       timeout: timeout,
     });
     });
     return {
     return {
-      output: {
-        content: process.stdout.toString("utf-8"),
-      },
+      output: process.stdout.toString("utf-8"),
     };
     };
   },
   },
 });
 });

+ 1 - 1
js/src/tool/edit.ts

@@ -1,5 +1,5 @@
 import { z } from "zod";
 import { z } from "zod";
-import * as path from "node:path";
+import * as path from "path";
 import { Log } from "../util/log";
 import { Log } from "../util/log";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
 import { FileTimes } from "./util/file-times";
 import { FileTimes } from "./util/file-times";

+ 3 - 3
js/src/tool/grep.ts

@@ -1,9 +1,9 @@
 import { z } from "zod";
 import { z } from "zod";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
 import { App } from "../app";
 import { App } from "../app";
-import { spawn } from "node:child_process";
-import { promises as fs } from "node:fs";
-import path from "node:path";
+import { spawn } from "child_process";
+import { promises as fs } from "fs";
+import path from "path";
 
 
 const DESCRIPTION = `Fast content search tool that finds files containing specific text or patterns, returning matching file paths sorted by modification time (newest first).
 const DESCRIPTION = `Fast content search tool that finds files containing specific text or patterns, returning matching file paths sorted by modification time (newest first).
 
 

+ 2 - 2
js/src/tool/ls.ts

@@ -1,8 +1,8 @@
 import { z } from "zod";
 import { z } from "zod";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
 import { App } from "../app";
 import { App } from "../app";
-import * as path from "node:path";
-import * as fs from "node:fs";
+import * as path from "path";
+import * as fs from "fs";
 
 
 const DESCRIPTION = `Directory listing tool that shows files and subdirectories in a tree structure, helping you explore and understand the project organization.
 const DESCRIPTION = `Directory listing tool that shows files and subdirectories in a tree structure, helping you explore and understand the project organization.
 
 

+ 1 - 1
js/src/tool/lsp-diagnostics.ts

@@ -1,6 +1,6 @@
 import { z } from "zod";
 import { z } from "zod";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
-import path from "node:path";
+import path from "path";
 import { LSP } from "../lsp";
 import { LSP } from "../lsp";
 import { App } from "../app";
 import { App } from "../app";
 
 

+ 1 - 1
js/src/tool/lsp-hover.ts

@@ -1,6 +1,6 @@
 import { z } from "zod";
 import { z } from "zod";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
-import path from "node:path";
+import path from "path";
 import { LSP } from "../lsp";
 import { LSP } from "../lsp";
 import { App } from "../app";
 import { App } from "../app";
 
 

+ 2 - 2
js/src/tool/patch.ts

@@ -1,6 +1,6 @@
 import { z } from "zod";
 import { z } from "zod";
-import * as path from "node:path";
-import * as fs from "node:fs/promises";
+import * as path from "path";
+import * as fs from "fs/promises";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
 import { FileTimes } from "./util/file-times";
 import { FileTimes } from "./util/file-times";
 
 

+ 2 - 2
js/src/tool/view.ts

@@ -1,6 +1,6 @@
 import { z } from "zod";
 import { z } from "zod";
-import * as fs from "node:fs";
-import * as path from "node:path";
+import * as fs from "fs";
+import * as path from "path";
 import { Tool } from "./tool";
 import { Tool } from "./tool";
 import { LSP } from "../lsp";
 import { LSP } from "../lsp";
 import { FileTimes } from "./util/file-times";
 import { FileTimes } from "./util/file-times";

+ 1 - 1
js/src/util/context.ts

@@ -1,4 +1,4 @@
-import { AsyncLocalStorage } from "node:async_hooks";
+import { AsyncLocalStorage } from "async_hooks";
 
 
 export namespace Context {
 export namespace Context {
   export class NotFound extends Error {
   export class NotFound extends Error {

+ 2 - 2
js/src/util/log.ts

@@ -1,6 +1,6 @@
-import path from "node:path";
+import path from "path";
 import { AppPath } from "../app/path";
 import { AppPath } from "../app/path";
-import fs from "node:fs/promises";
+import fs from "fs/promises";
 export namespace Log {
 export namespace Log {
   const write = {
   const write = {
     out: (msg: string) => {
     out: (msg: string) => {