tarsk 0.3.29 → 0.3.31

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/index.js CHANGED
@@ -1856,7 +1856,7 @@ import { Agent } from "@mariozechner/pi-agent-core";
1856
1856
  import {
1857
1857
  getModel
1858
1858
  } from "@mariozechner/pi-ai";
1859
- import { resolve } from "path";
1859
+ import { resolve, isAbsolute as isAbsolute2 } from "path";
1860
1860
 
1861
1861
  // src/tools/bash.ts
1862
1862
  import { randomBytes as randomBytes2 } from "node:crypto";
@@ -3435,6 +3435,15 @@ var PROVIDERS = [
3435
3435
  }
3436
3436
  ];
3437
3437
 
3438
+ // src/paths.ts
3439
+ import { join as join7 } from "path";
3440
+ import { homedir as homedir2 } from "os";
3441
+ var APP_SUPPORT_DIR = join7(homedir2(), "Library", "Application Support", "Tarsk");
3442
+ var DATA_DIR = join7(APP_SUPPORT_DIR, "data");
3443
+ function getDataDir() {
3444
+ return DATA_DIR;
3445
+ }
3446
+
3438
3447
  // src/managers/pi-executor.ts
3439
3448
  var PROVIDER_NAME_TO_PI = {
3440
3449
  anthropic: "anthropic",
@@ -3511,7 +3520,7 @@ class PiExecutorImpl {
3511
3520
  throw new Error("No model specified in execution context");
3512
3521
  }
3513
3522
  model = model.replace(`${providerName.toLowerCase()}/`, "");
3514
- const cwd = resolve(context.threadPath);
3523
+ const cwd = isAbsolute2(context.threadPath) ? context.threadPath : resolve(getDataDir(), context.threadPath);
3515
3524
  console.log("[ai] Execution context:", {
3516
3525
  model,
3517
3526
  cwd,
@@ -3689,7 +3698,7 @@ class PiExecutorImpl {
3689
3698
 
3690
3699
  // src/managers/conversation-manager.ts
3691
3700
  import { promises as fs2 } from "fs";
3692
- import { join as join7, dirname as dirname5 } from "path";
3701
+ import { join as join8, dirname as dirname5 } from "path";
3693
3702
  import { randomUUID as randomUUID3 } from "crypto";
3694
3703
  var CONVERSATION_FILE = "conversation-history.json";
3695
3704
 
@@ -3768,8 +3777,8 @@ class ConversationManagerImpl {
3768
3777
  }
3769
3778
  getConversationFilePath(threadPath) {
3770
3779
  const threadId = threadPath.split(/[\\/]/).pop() || "unknown";
3771
- const conversationsDir = join7(this.metadataDir, "conversations");
3772
- return join7(conversationsDir, threadId, CONVERSATION_FILE);
3780
+ const conversationsDir = join8(this.metadataDir, "conversations");
3781
+ return join8(conversationsDir, threadId, CONVERSATION_FILE);
3773
3782
  }
3774
3783
  }
3775
3784
 
@@ -4774,9 +4783,9 @@ async function getAIHubMixCredits(apiKey) {
4774
4783
 
4775
4784
  // src/utils/env-manager.ts
4776
4785
  import { promises as fs3 } from "fs";
4777
- import { join as join8 } from "path";
4786
+ import { join as join9 } from "path";
4778
4787
  async function updateEnvFile(keyNames) {
4779
- const envPath = join8(process.cwd(), ".env");
4788
+ const envPath = join9(process.cwd(), ".env");
4780
4789
  let content = "";
4781
4790
  try {
4782
4791
  content = await fs3.readFile(envPath, "utf-8");
@@ -4807,7 +4816,7 @@ async function updateEnvFile(keyNames) {
4807
4816
  `, "utf-8");
4808
4817
  }
4809
4818
  async function readEnvFile() {
4810
- const envPath = join8(process.cwd(), ".env");
4819
+ const envPath = join9(process.cwd(), ".env");
4811
4820
  const envMap = {};
4812
4821
  try {
4813
4822
  const content = await fs3.readFile(envPath, "utf-8");
@@ -5596,18 +5605,7 @@ import { Hono as Hono6 } from "hono";
5596
5605
  import { spawn as spawn7 } from "child_process";
5597
5606
  import { existsSync as existsSync6, readFileSync as readFileSync3, statSync as statSync3 } from "fs";
5598
5607
  import { join as join10 } from "path";
5599
- import { isAbsolute as isAbsolute2, normalize, resolve as resolve2 } from "path";
5600
-
5601
- // src/paths.ts
5602
- import { join as join9 } from "path";
5603
- import { homedir as homedir2 } from "os";
5604
- var APP_SUPPORT_DIR = join9(homedir2(), "Library", "Application Support", "Tarsk");
5605
- var DATA_DIR = join9(APP_SUPPORT_DIR, "data");
5606
- function getDataDir() {
5607
- return DATA_DIR;
5608
- }
5609
-
5610
- // src/routes/git.ts
5608
+ import { isAbsolute as isAbsolute3, normalize, resolve as resolve2 } from "path";
5611
5609
  import {
5612
5610
  completeSimple,
5613
5611
  getModel as getModel2
@@ -5732,7 +5730,7 @@ Generate only the commit message, nothing else:`;
5732
5730
  }
5733
5731
  }
5734
5732
  function resolveThreadPath(repoPath) {
5735
- const base = isAbsolute2(repoPath) ? repoPath : resolve2(getDataDir(), repoPath);
5733
+ const base = isAbsolute3(repoPath) ? repoPath : resolve2(getDataDir(), repoPath);
5736
5734
  return normalize(base);
5737
5735
  }
5738
5736
  function getGitRoot(cwd) {