@hasna/oldpal 0.1.0 → 0.1.1
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/README.md +3 -3
- package/dist/index.js +34 -14
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,10 +6,10 @@ Your personal AI assistant - terminal first, voice enabled, connector powered.
|
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
# Install globally with bun
|
|
9
|
-
bun install -g @
|
|
9
|
+
bun install -g @hasna/oldpal
|
|
10
10
|
|
|
11
11
|
# Or with npm
|
|
12
|
-
npm install -g @
|
|
12
|
+
npm install -g @hasna/oldpal
|
|
13
13
|
|
|
14
14
|
# Run
|
|
15
15
|
oldpal
|
|
@@ -100,7 +100,7 @@ Hooks run at specific lifecycle points:
|
|
|
100
100
|
|
|
101
101
|
```bash
|
|
102
102
|
# Clone the repo
|
|
103
|
-
git clone https://github.com/
|
|
103
|
+
git clone https://github.com/hasna/oldpal.git
|
|
104
104
|
cd oldpal
|
|
105
105
|
|
|
106
106
|
# Install dependencies
|
package/dist/index.js
CHANGED
|
@@ -20450,15 +20450,35 @@ var exports_anthropic = {};
|
|
|
20450
20450
|
__export(exports_anthropic, {
|
|
20451
20451
|
AnthropicClient: () => AnthropicClient
|
|
20452
20452
|
});
|
|
20453
|
+
import { readFileSync as readFileSync2, existsSync as existsSync2 } from "fs";
|
|
20454
|
+
import { homedir as homedir3 } from "os";
|
|
20455
|
+
import { join as join4 } from "path";
|
|
20456
|
+
function loadApiKeyFromSecrets() {
|
|
20457
|
+
const secretsPath = join4(homedir3(), ".secrets");
|
|
20458
|
+
if (existsSync2(secretsPath)) {
|
|
20459
|
+
try {
|
|
20460
|
+
const content = readFileSync2(secretsPath, "utf-8");
|
|
20461
|
+
const match = content.match(/export\s+ANTHROPIC_API_KEY\s*=\s*["']?([^"'\n]+)["']?/);
|
|
20462
|
+
if (match) {
|
|
20463
|
+
return match[1];
|
|
20464
|
+
}
|
|
20465
|
+
} catch {}
|
|
20466
|
+
}
|
|
20467
|
+
return;
|
|
20468
|
+
}
|
|
20453
20469
|
|
|
20454
20470
|
class AnthropicClient {
|
|
20455
20471
|
client;
|
|
20456
20472
|
model;
|
|
20457
20473
|
maxTokens;
|
|
20458
20474
|
constructor(config) {
|
|
20459
|
-
|
|
20460
|
-
|
|
20461
|
-
|
|
20475
|
+
const apiKey = config.apiKey || process.env.ANTHROPIC_API_KEY || loadApiKeyFromSecrets();
|
|
20476
|
+
if (!apiKey) {
|
|
20477
|
+
throw new Error(`ANTHROPIC_API_KEY not found. Please either:
|
|
20478
|
+
` + ` 1. Set the ANTHROPIC_API_KEY environment variable, or
|
|
20479
|
+
` + ' 2. Add it to ~/.secrets: export ANTHROPIC_API_KEY="your-key"');
|
|
20480
|
+
}
|
|
20481
|
+
this.client = new sdk_default({ apiKey });
|
|
20462
20482
|
this.model = config.model;
|
|
20463
20483
|
this.maxTokens = config.maxTokens || 8192;
|
|
20464
20484
|
}
|
|
@@ -23370,7 +23390,7 @@ var require_core = __commonJS((exports, module) => {
|
|
|
23370
23390
|
return match && match.index === 0;
|
|
23371
23391
|
}
|
|
23372
23392
|
var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
|
|
23373
|
-
function
|
|
23393
|
+
function join6(regexps, separator = "|") {
|
|
23374
23394
|
let numCaptures = 0;
|
|
23375
23395
|
return regexps.map((regex2) => {
|
|
23376
23396
|
numCaptures += 1;
|
|
@@ -23653,7 +23673,7 @@ var require_core = __commonJS((exports, module) => {
|
|
|
23653
23673
|
this.exec = () => null;
|
|
23654
23674
|
}
|
|
23655
23675
|
const terminators = this.regexes.map((el) => el[1]);
|
|
23656
|
-
this.matcherRe = langRe(
|
|
23676
|
+
this.matcherRe = langRe(join6(terminators), true);
|
|
23657
23677
|
this.lastIndex = 0;
|
|
23658
23678
|
}
|
|
23659
23679
|
exec(s) {
|
|
@@ -84046,8 +84066,8 @@ async function createLLMClient(config) {
|
|
|
84046
84066
|
}
|
|
84047
84067
|
|
|
84048
84068
|
// packages/core/src/config.ts
|
|
84049
|
-
import { join as
|
|
84050
|
-
import { homedir as
|
|
84069
|
+
import { join as join5 } from "path";
|
|
84070
|
+
import { homedir as homedir4 } from "os";
|
|
84051
84071
|
var DEFAULT_CONFIG = {
|
|
84052
84072
|
llm: {
|
|
84053
84073
|
provider: "anthropic",
|
|
@@ -84077,13 +84097,13 @@ var DEFAULT_CONFIG = {
|
|
|
84077
84097
|
]
|
|
84078
84098
|
};
|
|
84079
84099
|
function getConfigDir() {
|
|
84080
|
-
return
|
|
84100
|
+
return join5(homedir4(), ".oldpal");
|
|
84081
84101
|
}
|
|
84082
84102
|
function getConfigPath(filename) {
|
|
84083
|
-
return
|
|
84103
|
+
return join5(getConfigDir(), filename);
|
|
84084
84104
|
}
|
|
84085
84105
|
function getProjectConfigDir(cwd2 = process.cwd()) {
|
|
84086
|
-
return
|
|
84106
|
+
return join5(cwd2, ".oldpal");
|
|
84087
84107
|
}
|
|
84088
84108
|
async function loadConfig(cwd2 = process.cwd()) {
|
|
84089
84109
|
const config = { ...DEFAULT_CONFIG };
|
|
@@ -84096,7 +84116,7 @@ async function loadConfig(cwd2 = process.cwd()) {
|
|
|
84096
84116
|
if (userConfig.voice)
|
|
84097
84117
|
config.voice = { ...config.voice, ...userConfig.voice };
|
|
84098
84118
|
}
|
|
84099
|
-
const projectConfigPath =
|
|
84119
|
+
const projectConfigPath = join5(getProjectConfigDir(cwd2), "settings.json");
|
|
84100
84120
|
const projectConfig = await loadJsonFile(projectConfigPath);
|
|
84101
84121
|
if (projectConfig) {
|
|
84102
84122
|
Object.assign(config, projectConfig);
|
|
@@ -84105,7 +84125,7 @@ async function loadConfig(cwd2 = process.cwd()) {
|
|
|
84105
84125
|
if (projectConfig.voice)
|
|
84106
84126
|
config.voice = { ...config.voice, ...projectConfig.voice };
|
|
84107
84127
|
}
|
|
84108
|
-
const localConfigPath =
|
|
84128
|
+
const localConfigPath = join5(getProjectConfigDir(cwd2), "settings.local.json");
|
|
84109
84129
|
const localConfig = await loadJsonFile(localConfigPath);
|
|
84110
84130
|
if (localConfig) {
|
|
84111
84131
|
Object.assign(config, localConfig);
|
|
@@ -84123,7 +84143,7 @@ async function loadHooksConfig(cwd2 = process.cwd()) {
|
|
|
84123
84143
|
if (userHooks?.hooks) {
|
|
84124
84144
|
mergeHooks(hooks, userHooks.hooks);
|
|
84125
84145
|
}
|
|
84126
|
-
const projectHooksPath =
|
|
84146
|
+
const projectHooksPath = join5(getProjectConfigDir(cwd2), "hooks.json");
|
|
84127
84147
|
const projectHooks = await loadJsonFile(projectHooksPath);
|
|
84128
84148
|
if (projectHooks?.hooks) {
|
|
84129
84149
|
mergeHooks(hooks, projectHooks.hooks);
|
|
@@ -87575,4 +87595,4 @@ waitUntilExit().then(() => {
|
|
|
87575
87595
|
process.exit(0);
|
|
87576
87596
|
});
|
|
87577
87597
|
|
|
87578
|
-
//# debugId=
|
|
87598
|
+
//# debugId=D4B20D698CC1E6E964756E2164756E21
|