fourmis-agents-sdk 0.2.2 → 0.2.3

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.
@@ -97,14 +97,18 @@ __export(exports_openai_oauth, {
97
97
  import { randomBytes, createHash } from "crypto";
98
98
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
99
99
  import { join } from "path";
100
+ import { homedir } from "os";
101
+ function getHome() {
102
+ return process.env.HOME ?? homedir();
103
+ }
100
104
  function tokenDir() {
101
- return join(process.env.HOME ?? "/root", ".fourmis");
105
+ return join(getHome(), ".fourmis");
102
106
  }
103
107
  function tokenPath() {
104
108
  return join(tokenDir(), "openai-auth.json");
105
109
  }
106
110
  function codexFallbackPath() {
107
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
111
+ return join(getHome(), ".codex", "auth.json");
108
112
  }
109
113
  function loadTokens() {
110
114
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1447,9 +1451,10 @@ class OpenAIAdapter {
1447
1451
  }
1448
1452
  }
1449
1453
  function loadTokensSync() {
1454
+ const home = process.env.HOME ?? __require("os").homedir();
1450
1455
  const paths = [
1451
- `${process.env.HOME}/.fourmis/openai-auth.json`,
1452
- `${process.env.HOME}/.codex/auth.json`
1456
+ `${home}/.fourmis/openai-auth.json`,
1457
+ `${home}/.codex/auth.json`
1453
1458
  ];
1454
1459
  for (const p of paths) {
1455
1460
  try {
@@ -97,14 +97,18 @@ __export(exports_openai_oauth, {
97
97
  import { randomBytes, createHash } from "crypto";
98
98
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
99
99
  import { join } from "path";
100
+ import { homedir } from "os";
101
+ function getHome() {
102
+ return process.env.HOME ?? homedir();
103
+ }
100
104
  function tokenDir() {
101
- return join(process.env.HOME ?? "/root", ".fourmis");
105
+ return join(getHome(), ".fourmis");
102
106
  }
103
107
  function tokenPath() {
104
108
  return join(tokenDir(), "openai-auth.json");
105
109
  }
106
110
  function codexFallbackPath() {
107
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
111
+ return join(getHome(), ".codex", "auth.json");
108
112
  }
109
113
  function loadTokens() {
110
114
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1447,9 +1451,10 @@ class OpenAIAdapter {
1447
1451
  }
1448
1452
  }
1449
1453
  function loadTokensSync() {
1454
+ const home = process.env.HOME ?? __require("os").homedir();
1450
1455
  const paths = [
1451
- `${process.env.HOME}/.fourmis/openai-auth.json`,
1452
- `${process.env.HOME}/.codex/auth.json`
1456
+ `${home}/.fourmis/openai-auth.json`,
1457
+ `${home}/.codex/auth.json`
1453
1458
  ];
1454
1459
  for (const p of paths) {
1455
1460
  try {
package/dist/api.js CHANGED
@@ -97,14 +97,18 @@ __export(exports_openai_oauth, {
97
97
  import { randomBytes, createHash } from "crypto";
98
98
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
99
99
  import { join } from "path";
100
+ import { homedir } from "os";
101
+ function getHome() {
102
+ return process.env.HOME ?? homedir();
103
+ }
100
104
  function tokenDir() {
101
- return join(process.env.HOME ?? "/root", ".fourmis");
105
+ return join(getHome(), ".fourmis");
102
106
  }
103
107
  function tokenPath() {
104
108
  return join(tokenDir(), "openai-auth.json");
105
109
  }
106
110
  function codexFallbackPath() {
107
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
111
+ return join(getHome(), ".codex", "auth.json");
108
112
  }
109
113
  function loadTokens() {
110
114
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1447,9 +1451,10 @@ class OpenAIAdapter {
1447
1451
  }
1448
1452
  }
1449
1453
  function loadTokensSync() {
1454
+ const home = process.env.HOME ?? __require("os").homedir();
1450
1455
  const paths = [
1451
- `${process.env.HOME}/.fourmis/openai-auth.json`,
1452
- `${process.env.HOME}/.codex/auth.json`
1456
+ `${home}/.fourmis/openai-auth.json`,
1457
+ `${home}/.codex/auth.json`
1453
1458
  ];
1454
1459
  for (const p of paths) {
1455
1460
  try {
@@ -2209,7 +2214,7 @@ class PermissionManager {
2209
2214
  // src/settings.ts
2210
2215
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
2211
2216
  import { dirname as dirname2, join as join2 } from "path";
2212
- import { homedir } from "os";
2217
+ import { homedir as homedir2 } from "os";
2213
2218
 
2214
2219
  class SettingsManager {
2215
2220
  cwd;
@@ -2295,7 +2300,7 @@ class SettingsManager {
2295
2300
  sourceToPath(source) {
2296
2301
  switch (source) {
2297
2302
  case "user":
2298
- return join2(homedir(), ".claude", "settings.json");
2303
+ return join2(homedir2(), ".claude", "settings.json");
2299
2304
  case "project":
2300
2305
  return join2(this.cwd, ".claude", "settings.json");
2301
2306
  case "local":
@@ -2305,7 +2310,7 @@ class SettingsManager {
2305
2310
  destinationToPath(destination) {
2306
2311
  switch (destination) {
2307
2312
  case "userSettings":
2308
- return join2(homedir(), ".claude", "settings.json");
2313
+ return join2(homedir2(), ".claude", "settings.json");
2309
2314
  case "projectSettings":
2310
2315
  return join2(this.cwd, ".claude", "settings.json");
2311
2316
  case "localSettings":
@@ -2926,12 +2931,12 @@ class TaskManager {
2926
2931
  // src/utils/session-store.ts
2927
2932
  import { readFileSync as readFileSync4, appendFileSync, mkdirSync as mkdirSync3, readdirSync, statSync } from "fs";
2928
2933
  import { join as join4 } from "path";
2929
- import { homedir as homedir2 } from "os";
2934
+ import { homedir as homedir3 } from "os";
2930
2935
  function sanitizeCwd(cwd) {
2931
2936
  return cwd.replace(/[/.]/g, "-");
2932
2937
  }
2933
2938
  function sessionsDir(cwd) {
2934
- return join4(homedir2(), ".claude", "projects", sanitizeCwd(cwd));
2939
+ return join4(homedir3(), ".claude", "projects", sanitizeCwd(cwd));
2935
2940
  }
2936
2941
  function ensureDir(dir) {
2937
2942
  mkdirSync3(dir, { recursive: true });
@@ -28,14 +28,18 @@ __export(exports_openai_oauth, {
28
28
  import { randomBytes, createHash } from "crypto";
29
29
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
30
30
  import { join } from "path";
31
+ import { homedir } from "os";
32
+ function getHome() {
33
+ return process.env.HOME ?? homedir();
34
+ }
31
35
  function tokenDir() {
32
- return join(process.env.HOME ?? "/root", ".fourmis");
36
+ return join(getHome(), ".fourmis");
33
37
  }
34
38
  function tokenPath() {
35
39
  return join(tokenDir(), "openai-auth.json");
36
40
  }
37
41
  function codexFallbackPath() {
38
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
42
+ return join(getHome(), ".codex", "auth.json");
39
43
  }
40
44
  function loadTokens() {
41
45
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1 +1 @@
1
- {"version":3,"file":"openai-oauth.d.ts","sourceRoot":"","sources":["../../src/auth/openai-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAiBH,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAcF,wBAAgB,UAAU,IAAI,YAAY,GAAG,IAAI,CAahD;AAYD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAID,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAKnE;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAO5D;AAmDD,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAwBhG;AAID,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CACzB,IAAI,CAAC,EAAE;IA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
27
27
  import { randomBytes, createHash } from "crypto";
28
28
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
29
29
  import { join } from "path";
30
+ import { homedir } from "os";
31
+ function getHome() {
32
+ return process.env.HOME ?? homedir();
33
+ }
30
34
  function tokenDir() {
31
- return join(process.env.HOME ?? "/root", ".fourmis");
35
+ return join(getHome(), ".fourmis");
32
36
  }
33
37
  function tokenPath() {
34
38
  return join(tokenDir(), "openai-auth.json");
35
39
  }
36
40
  function codexFallbackPath() {
37
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
41
+ return join(getHome(), ".codex", "auth.json");
38
42
  }
39
43
  function loadTokens() {
40
44
  for (const p of [tokenPath(), codexFallbackPath()]) {
package/dist/index.js CHANGED
@@ -97,14 +97,18 @@ __export(exports_openai_oauth, {
97
97
  import { randomBytes, createHash } from "crypto";
98
98
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
99
99
  import { join } from "path";
100
+ import { homedir } from "os";
101
+ function getHome() {
102
+ return process.env.HOME ?? homedir();
103
+ }
100
104
  function tokenDir() {
101
- return join(process.env.HOME ?? "/root", ".fourmis");
105
+ return join(getHome(), ".fourmis");
102
106
  }
103
107
  function tokenPath() {
104
108
  return join(tokenDir(), "openai-auth.json");
105
109
  }
106
110
  function codexFallbackPath() {
107
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
111
+ return join(getHome(), ".codex", "auth.json");
108
112
  }
109
113
  function loadTokens() {
110
114
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1447,9 +1451,10 @@ class OpenAIAdapter {
1447
1451
  }
1448
1452
  }
1449
1453
  function loadTokensSync() {
1454
+ const home = process.env.HOME ?? __require("os").homedir();
1450
1455
  const paths = [
1451
- `${process.env.HOME}/.fourmis/openai-auth.json`,
1452
- `${process.env.HOME}/.codex/auth.json`
1456
+ `${home}/.fourmis/openai-auth.json`,
1457
+ `${home}/.codex/auth.json`
1453
1458
  ];
1454
1459
  for (const p of paths) {
1455
1460
  try {
@@ -2209,7 +2214,7 @@ class PermissionManager {
2209
2214
  // src/settings.ts
2210
2215
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
2211
2216
  import { dirname as dirname2, join as join2 } from "path";
2212
- import { homedir } from "os";
2217
+ import { homedir as homedir2 } from "os";
2213
2218
 
2214
2219
  class SettingsManager {
2215
2220
  cwd;
@@ -2295,7 +2300,7 @@ class SettingsManager {
2295
2300
  sourceToPath(source) {
2296
2301
  switch (source) {
2297
2302
  case "user":
2298
- return join2(homedir(), ".claude", "settings.json");
2303
+ return join2(homedir2(), ".claude", "settings.json");
2299
2304
  case "project":
2300
2305
  return join2(this.cwd, ".claude", "settings.json");
2301
2306
  case "local":
@@ -2305,7 +2310,7 @@ class SettingsManager {
2305
2310
  destinationToPath(destination) {
2306
2311
  switch (destination) {
2307
2312
  case "userSettings":
2308
- return join2(homedir(), ".claude", "settings.json");
2313
+ return join2(homedir2(), ".claude", "settings.json");
2309
2314
  case "projectSettings":
2310
2315
  return join2(this.cwd, ".claude", "settings.json");
2311
2316
  case "localSettings":
@@ -2926,12 +2931,12 @@ class TaskManager {
2926
2931
  // src/utils/session-store.ts
2927
2932
  import { readFileSync as readFileSync4, appendFileSync, mkdirSync as mkdirSync3, readdirSync, statSync } from "fs";
2928
2933
  import { join as join4 } from "path";
2929
- import { homedir as homedir2 } from "os";
2934
+ import { homedir as homedir3 } from "os";
2930
2935
  function sanitizeCwd(cwd) {
2931
2936
  return cwd.replace(/[/.]/g, "-");
2932
2937
  }
2933
2938
  function sessionsDir(cwd) {
2934
- return join4(homedir2(), ".claude", "projects", sanitizeCwd(cwd));
2939
+ return join4(homedir3(), ".claude", "projects", sanitizeCwd(cwd));
2935
2940
  }
2936
2941
  function ensureDir(dir) {
2937
2942
  mkdirSync3(dir, { recursive: true });
@@ -27,14 +27,18 @@ __export(exports_openai_oauth, {
27
27
  import { randomBytes, createHash } from "crypto";
28
28
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
29
29
  import { join } from "path";
30
+ import { homedir } from "os";
31
+ function getHome() {
32
+ return process.env.HOME ?? homedir();
33
+ }
30
34
  function tokenDir() {
31
- return join(process.env.HOME ?? "/root", ".fourmis");
35
+ return join(getHome(), ".fourmis");
32
36
  }
33
37
  function tokenPath() {
34
38
  return join(tokenDir(), "openai-auth.json");
35
39
  }
36
40
  function codexFallbackPath() {
37
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
41
+ return join(getHome(), ".codex", "auth.json");
38
42
  }
39
43
  function loadTokens() {
40
44
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -850,9 +854,10 @@ class OpenAIAdapter {
850
854
  }
851
855
  }
852
856
  function loadTokensSync() {
857
+ const home = process.env.HOME ?? __require("os").homedir();
853
858
  const paths = [
854
- `${process.env.HOME}/.fourmis/openai-auth.json`,
855
- `${process.env.HOME}/.codex/auth.json`
859
+ `${home}/.fourmis/openai-auth.json`,
860
+ `${home}/.codex/auth.json`
856
861
  ];
857
862
  for (const p of paths) {
858
863
  try {
@@ -27,14 +27,18 @@ __export(exports_openai_oauth, {
27
27
  import { randomBytes, createHash } from "crypto";
28
28
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
29
29
  import { join } from "path";
30
+ import { homedir } from "os";
31
+ function getHome() {
32
+ return process.env.HOME ?? homedir();
33
+ }
30
34
  function tokenDir() {
31
- return join(process.env.HOME ?? "/root", ".fourmis");
35
+ return join(getHome(), ".fourmis");
32
36
  }
33
37
  function tokenPath() {
34
38
  return join(tokenDir(), "openai-auth.json");
35
39
  }
36
40
  function codexFallbackPath() {
37
- return join(process.env.HOME ?? "/root", ".codex", "auth.json");
41
+ return join(getHome(), ".codex", "auth.json");
38
42
  }
39
43
  function loadTokens() {
40
44
  for (const p of [tokenPath(), codexFallbackPath()]) {
@@ -1064,9 +1068,10 @@ class OpenAIAdapter {
1064
1068
  }
1065
1069
  }
1066
1070
  function loadTokensSync() {
1071
+ const home = process.env.HOME ?? __require("os").homedir();
1067
1072
  const paths = [
1068
- `${process.env.HOME}/.fourmis/openai-auth.json`,
1069
- `${process.env.HOME}/.codex/auth.json`
1073
+ `${home}/.fourmis/openai-auth.json`,
1074
+ `${home}/.codex/auth.json`
1070
1075
  ];
1071
1076
  for (const p of paths) {
1072
1077
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fourmis-agents-sdk",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Multi-provider AI agent SDK with direct API access and in-process tool execution",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",