@hasna/oldpal 0.4.0 → 0.4.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/dist/config/settings.json +18 -3
- package/dist/index.js +197 -58
- package/dist/index.js.map +9 -9
- package/package.json +1 -1
|
@@ -18,11 +18,26 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"connectors": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"anthropic",
|
|
22
|
+
"brandsight",
|
|
23
|
+
"clickbank",
|
|
24
|
+
"cloudflare",
|
|
25
|
+
"discord",
|
|
23
26
|
"gmail",
|
|
24
27
|
"googlecalendar",
|
|
28
|
+
"googlecontacts",
|
|
29
|
+
"googledrive",
|
|
25
30
|
"linear",
|
|
26
|
-
"
|
|
31
|
+
"maropost",
|
|
32
|
+
"mercury",
|
|
33
|
+
"mistral",
|
|
34
|
+
"notion",
|
|
35
|
+
"openai",
|
|
36
|
+
"perplexity",
|
|
37
|
+
"sedo",
|
|
38
|
+
"slack",
|
|
39
|
+
"x",
|
|
40
|
+
"xai",
|
|
41
|
+
"zendesk"
|
|
27
42
|
]
|
|
28
43
|
}
|
package/dist/index.js
CHANGED
|
@@ -20451,10 +20451,10 @@ __export(exports_anthropic, {
|
|
|
20451
20451
|
AnthropicClient: () => AnthropicClient
|
|
20452
20452
|
});
|
|
20453
20453
|
import { readFileSync as readFileSync2, existsSync as existsSync5 } from "fs";
|
|
20454
|
-
import { homedir as
|
|
20454
|
+
import { homedir as homedir7 } from "os";
|
|
20455
20455
|
import { join as join7 } from "path";
|
|
20456
20456
|
function loadApiKeyFromSecrets() {
|
|
20457
|
-
const secretsPath = join7(
|
|
20457
|
+
const secretsPath = join7(homedir7(), ".secrets");
|
|
20458
20458
|
if (existsSync5(secretsPath)) {
|
|
20459
20459
|
try {
|
|
20460
20460
|
const content = readFileSync2(secretsPath, "utf-8");
|
|
@@ -28328,6 +28328,25 @@ var getInstance = (stdout, createInstance) => {
|
|
|
28328
28328
|
};
|
|
28329
28329
|
// node_modules/.pnpm/ink@5.2.1_@types+react@18.3.27_react-devtools-core@4.28.5_react@18.3.1/node_modules/ink/build/components/Static.js
|
|
28330
28330
|
var import_react11 = __toESM(require_react(), 1);
|
|
28331
|
+
function Static(props) {
|
|
28332
|
+
const { items, children: render2, style: customStyle } = props;
|
|
28333
|
+
const [index, setIndex] = import_react11.useState(0);
|
|
28334
|
+
const itemsToRender = import_react11.useMemo(() => {
|
|
28335
|
+
return items.slice(index);
|
|
28336
|
+
}, [items, index]);
|
|
28337
|
+
import_react11.useLayoutEffect(() => {
|
|
28338
|
+
setIndex(items.length);
|
|
28339
|
+
}, [items.length]);
|
|
28340
|
+
const children = itemsToRender.map((item, itemIndex) => {
|
|
28341
|
+
return render2(item, index + itemIndex);
|
|
28342
|
+
});
|
|
28343
|
+
const style = import_react11.useMemo(() => ({
|
|
28344
|
+
position: "absolute",
|
|
28345
|
+
flexDirection: "column",
|
|
28346
|
+
...customStyle
|
|
28347
|
+
}), [customStyle]);
|
|
28348
|
+
return import_react11.default.createElement("ink-box", { internal_static: true, style }, children);
|
|
28349
|
+
}
|
|
28331
28350
|
// node_modules/.pnpm/ink@5.2.1_@types+react@18.3.27_react-devtools-core@4.28.5_react@18.3.1/node_modules/ink/build/components/Transform.js
|
|
28332
28351
|
var import_react12 = __toESM(require_react(), 1);
|
|
28333
28352
|
// node_modules/.pnpm/ink@5.2.1_@types+react@18.3.27_react-devtools-core@4.28.5_react@18.3.1/node_modules/ink/build/components/Newline.js
|
|
@@ -28973,13 +28992,13 @@ class ConnectorBridge {
|
|
|
28973
28992
|
class BashTool {
|
|
28974
28993
|
static tool = {
|
|
28975
28994
|
name: "bash",
|
|
28976
|
-
description: "Execute a shell command.
|
|
28995
|
+
description: "Execute a shell command. RESTRICTED to read-only operations: ls, cat, grep, find, git status/log/diff, pwd, which, echo. Cannot modify files, install packages, or run destructive commands.",
|
|
28977
28996
|
parameters: {
|
|
28978
28997
|
type: "object",
|
|
28979
28998
|
properties: {
|
|
28980
28999
|
command: {
|
|
28981
29000
|
type: "string",
|
|
28982
|
-
description: "The shell command to execute"
|
|
29001
|
+
description: "The shell command to execute (read-only commands only)"
|
|
28983
29002
|
},
|
|
28984
29003
|
cwd: {
|
|
28985
29004
|
type: "string",
|
|
@@ -28987,29 +29006,111 @@ class BashTool {
|
|
|
28987
29006
|
},
|
|
28988
29007
|
timeout: {
|
|
28989
29008
|
type: "number",
|
|
28990
|
-
description: "Timeout in milliseconds (default:
|
|
29009
|
+
description: "Timeout in milliseconds (default: 30000)"
|
|
28991
29010
|
}
|
|
28992
29011
|
},
|
|
28993
29012
|
required: ["command"]
|
|
28994
29013
|
}
|
|
28995
29014
|
};
|
|
29015
|
+
static ALLOWED_COMMANDS = [
|
|
29016
|
+
"cat",
|
|
29017
|
+
"head",
|
|
29018
|
+
"tail",
|
|
29019
|
+
"less",
|
|
29020
|
+
"more",
|
|
29021
|
+
"ls",
|
|
29022
|
+
"tree",
|
|
29023
|
+
"find",
|
|
29024
|
+
"locate",
|
|
29025
|
+
"grep",
|
|
29026
|
+
"rg",
|
|
29027
|
+
"ag",
|
|
29028
|
+
"ack",
|
|
29029
|
+
"wc",
|
|
29030
|
+
"file",
|
|
29031
|
+
"stat",
|
|
29032
|
+
"du",
|
|
29033
|
+
"df",
|
|
29034
|
+
"pwd",
|
|
29035
|
+
"whoami",
|
|
29036
|
+
"date",
|
|
29037
|
+
"which",
|
|
29038
|
+
"where",
|
|
29039
|
+
"type",
|
|
29040
|
+
"env",
|
|
29041
|
+
"printenv",
|
|
29042
|
+
"echo",
|
|
29043
|
+
"git status",
|
|
29044
|
+
"git log",
|
|
29045
|
+
"git diff",
|
|
29046
|
+
"git branch",
|
|
29047
|
+
"git show",
|
|
29048
|
+
"git remote",
|
|
29049
|
+
"git tag",
|
|
29050
|
+
"connect-",
|
|
29051
|
+
"node --version",
|
|
29052
|
+
"bun --version",
|
|
29053
|
+
"npm --version",
|
|
29054
|
+
"pnpm --version"
|
|
29055
|
+
];
|
|
29056
|
+
static BLOCKED_PATTERNS = [
|
|
29057
|
+
/\brm\b/,
|
|
29058
|
+
/\brmdir\b/,
|
|
29059
|
+
/\bunlink\b/,
|
|
29060
|
+
/\bmv\b/,
|
|
29061
|
+
/\bcp\b/,
|
|
29062
|
+
/\bchmod\b/,
|
|
29063
|
+
/\bchown\b/,
|
|
29064
|
+
/\bchgrp\b/,
|
|
29065
|
+
/\bsudo\b/,
|
|
29066
|
+
/\bsu\b/,
|
|
29067
|
+
/\bdoas\b/,
|
|
29068
|
+
/\bnpm\s+(install|i|add|ci)\b/,
|
|
29069
|
+
/\bpnpm\s+(install|i|add)\b/,
|
|
29070
|
+
/\byarn\s+(install|add)\b/,
|
|
29071
|
+
/\bbun\s+(install|add|i)\b/,
|
|
29072
|
+
/\bpip\s+install\b/,
|
|
29073
|
+
/\bpip3\s+install\b/,
|
|
29074
|
+
/\bbrew\s+install\b/,
|
|
29075
|
+
/\bapt\s+install\b/,
|
|
29076
|
+
/\bapt-get\s+install\b/,
|
|
29077
|
+
/\bgit\s+(push|commit|checkout|reset|rebase|merge|pull|stash|cherry-pick|revert)\b/,
|
|
29078
|
+
/\bgit\s+add\b/,
|
|
29079
|
+
/\|\s*(bash|sh|zsh|fish)\b/,
|
|
29080
|
+
/curl.*\|\s*(bash|sh)/,
|
|
29081
|
+
/wget.*\|\s*(bash|sh)/,
|
|
29082
|
+
/>\s*[^|]/,
|
|
29083
|
+
/>>/,
|
|
29084
|
+
/\bkill\b/,
|
|
29085
|
+
/\bpkill\b/,
|
|
29086
|
+
/\bkillall\b/,
|
|
29087
|
+
/\bmkfs\b/,
|
|
29088
|
+
/\bdd\b/,
|
|
29089
|
+
/\bfdisk\b/,
|
|
29090
|
+
/\bparted\b/,
|
|
29091
|
+
/\bnc\s+-l/,
|
|
29092
|
+
/\bnetcat\s+-l/,
|
|
29093
|
+
/\bvim?\b/,
|
|
29094
|
+
/\bnano\b/,
|
|
29095
|
+
/\bemacs\b/,
|
|
29096
|
+
/\bmake\b/,
|
|
29097
|
+
/\bcmake\b/,
|
|
29098
|
+
/\bdocker\s+(run|exec|build|push)\b/
|
|
29099
|
+
];
|
|
28996
29100
|
static executor = async (input) => {
|
|
28997
29101
|
const command = input.command;
|
|
28998
29102
|
const cwd2 = input.cwd || process.cwd();
|
|
28999
|
-
const timeout = input.timeout ||
|
|
29000
|
-
const
|
|
29001
|
-
/rm\s+-rf\s+[\/~]/i,
|
|
29002
|
-
/rm\s+-rf\s+\*/i,
|
|
29003
|
-
/mkfs/i,
|
|
29004
|
-
/dd\s+if=/i,
|
|
29005
|
-
/>\s*\/dev\/sd/i,
|
|
29006
|
-
/chmod\s+-R\s+777\s+\//i
|
|
29007
|
-
];
|
|
29008
|
-
for (const pattern of dangerousPatterns) {
|
|
29103
|
+
const timeout = input.timeout || 30000;
|
|
29104
|
+
for (const pattern of this.BLOCKED_PATTERNS) {
|
|
29009
29105
|
if (pattern.test(command)) {
|
|
29010
|
-
return `Error: This command
|
|
29106
|
+
return `Error: This command is not allowed. Only read-only commands are permitted (ls, cat, grep, find, git status/log/diff, etc.)`;
|
|
29011
29107
|
}
|
|
29012
29108
|
}
|
|
29109
|
+
const commandTrimmed = command.trim().toLowerCase();
|
|
29110
|
+
const isAllowed = this.ALLOWED_COMMANDS.some((allowed) => commandTrimmed.startsWith(allowed.toLowerCase()));
|
|
29111
|
+
if (!isAllowed) {
|
|
29112
|
+
return `Error: Command not in allowed list. Permitted commands: cat, head, tail, ls, find, grep, wc, file, stat, pwd, which, echo, git status/log/diff/branch/show, connect-*`;
|
|
29113
|
+
}
|
|
29013
29114
|
try {
|
|
29014
29115
|
const proc = Bun.spawn(["bash", "-c", command], {
|
|
29015
29116
|
cwd: cwd2,
|
|
@@ -29038,15 +29139,31 @@ ${stderr || stdout}`.trim();
|
|
|
29038
29139
|
|
|
29039
29140
|
// packages/core/src/tools/filesystem.ts
|
|
29040
29141
|
import { join as join2, resolve, dirname } from "path";
|
|
29142
|
+
import { homedir as homedir2 } from "os";
|
|
29041
29143
|
var {Glob } = globalThis.Bun;
|
|
29144
|
+
var currentSessionId = "default";
|
|
29145
|
+
function getTempFolder() {
|
|
29146
|
+
return join2(homedir2(), ".oldpal", "temp", currentSessionId);
|
|
29147
|
+
}
|
|
29148
|
+
function isInTempFolder(path) {
|
|
29149
|
+
const tempFolder = getTempFolder();
|
|
29150
|
+
const resolved = resolve(path);
|
|
29151
|
+
return resolved.startsWith(tempFolder);
|
|
29152
|
+
}
|
|
29042
29153
|
|
|
29043
29154
|
class FilesystemTools {
|
|
29044
|
-
static registerAll(registry) {
|
|
29155
|
+
static registerAll(registry, sessionId) {
|
|
29156
|
+
if (sessionId) {
|
|
29157
|
+
currentSessionId = sessionId;
|
|
29158
|
+
}
|
|
29045
29159
|
registry.register(this.readTool, this.readExecutor);
|
|
29046
29160
|
registry.register(this.writeTool, this.writeExecutor);
|
|
29047
29161
|
registry.register(this.globTool, this.globExecutor);
|
|
29048
29162
|
registry.register(this.grepTool, this.grepExecutor);
|
|
29049
29163
|
}
|
|
29164
|
+
static setSessionId(sessionId) {
|
|
29165
|
+
currentSessionId = sessionId;
|
|
29166
|
+
}
|
|
29050
29167
|
static readTool = {
|
|
29051
29168
|
name: "read",
|
|
29052
29169
|
description: "Read the contents of a file",
|
|
@@ -29093,30 +29210,38 @@ class FilesystemTools {
|
|
|
29093
29210
|
};
|
|
29094
29211
|
static writeTool = {
|
|
29095
29212
|
name: "write",
|
|
29096
|
-
description: "Write content to a file
|
|
29213
|
+
description: "Write content to a file. RESTRICTED: Can only write to ~/.oldpal/temp/{session}/ folder. Provide just the filename and it will be saved to the temp folder.",
|
|
29097
29214
|
parameters: {
|
|
29098
29215
|
type: "object",
|
|
29099
29216
|
properties: {
|
|
29100
|
-
|
|
29217
|
+
filename: {
|
|
29101
29218
|
type: "string",
|
|
29102
|
-
description: "The
|
|
29219
|
+
description: "The filename to write to (will be saved in temp folder)"
|
|
29103
29220
|
},
|
|
29104
29221
|
content: {
|
|
29105
29222
|
type: "string",
|
|
29106
29223
|
description: "The content to write"
|
|
29107
29224
|
}
|
|
29108
29225
|
},
|
|
29109
|
-
required: ["
|
|
29226
|
+
required: ["filename", "content"]
|
|
29110
29227
|
}
|
|
29111
29228
|
};
|
|
29112
29229
|
static writeExecutor = async (input) => {
|
|
29113
|
-
const
|
|
29230
|
+
const filename = input.filename || input.path;
|
|
29114
29231
|
const content = input.content;
|
|
29232
|
+
const tempFolder = getTempFolder();
|
|
29233
|
+
const sanitizedFilename = filename.replace(/\.\./g, "").replace(/^\/+/, "");
|
|
29234
|
+
const path = join2(tempFolder, sanitizedFilename);
|
|
29235
|
+
if (!isInTempFolder(path)) {
|
|
29236
|
+
return `Error: Cannot write outside temp folder. Files are saved to ${tempFolder}`;
|
|
29237
|
+
}
|
|
29115
29238
|
try {
|
|
29116
29239
|
const dir = dirname(path);
|
|
29117
29240
|
await Bun.$`mkdir -p ${dir}`.quiet();
|
|
29118
29241
|
await Bun.write(path, content);
|
|
29119
|
-
return `Successfully wrote ${content.length} characters to ${path}
|
|
29242
|
+
return `Successfully wrote ${content.length} characters to ${path}
|
|
29243
|
+
|
|
29244
|
+
You can review and copy this file to your project if needed.`;
|
|
29120
29245
|
} catch (error) {
|
|
29121
29246
|
return `Error: ${error instanceof Error ? error.message : String(error)}`;
|
|
29122
29247
|
}
|
|
@@ -29506,11 +29631,11 @@ class WebTools {
|
|
|
29506
29631
|
import { existsSync as existsSync2, writeFileSync, unlinkSync } from "fs";
|
|
29507
29632
|
import { tmpdir } from "os";
|
|
29508
29633
|
import { join as join3 } from "path";
|
|
29509
|
-
import { homedir as
|
|
29634
|
+
import { homedir as homedir3 } from "os";
|
|
29510
29635
|
async function getViuPath() {
|
|
29511
29636
|
const locations = [
|
|
29512
29637
|
"viu",
|
|
29513
|
-
join3(
|
|
29638
|
+
join3(homedir3(), ".cargo", "bin", "viu"),
|
|
29514
29639
|
"/usr/local/bin/viu",
|
|
29515
29640
|
"/opt/homebrew/bin/viu"
|
|
29516
29641
|
];
|
|
@@ -29621,12 +29746,12 @@ class ImageTools {
|
|
|
29621
29746
|
|
|
29622
29747
|
// packages/core/src/skills/loader.ts
|
|
29623
29748
|
import { join as join4 } from "path";
|
|
29624
|
-
import { homedir as
|
|
29749
|
+
import { homedir as homedir4 } from "os";
|
|
29625
29750
|
var {Glob: Glob2 } = globalThis.Bun;
|
|
29626
29751
|
class SkillLoader {
|
|
29627
29752
|
skills = new Map;
|
|
29628
29753
|
async loadAll(projectDir = process.cwd()) {
|
|
29629
|
-
const userSkillsDir = join4(
|
|
29754
|
+
const userSkillsDir = join4(homedir4(), ".oldpal", "skills");
|
|
29630
29755
|
await this.loadFromDirectory(userSkillsDir);
|
|
29631
29756
|
const projectSkillsDir = join4(projectDir, ".oldpal", "skills");
|
|
29632
29757
|
await this.loadFromDirectory(projectSkillsDir);
|
|
@@ -29921,7 +30046,7 @@ class HookExecutor {
|
|
|
29921
30046
|
// packages/core/src/commands/loader.ts
|
|
29922
30047
|
import { existsSync as existsSync3, readdirSync, statSync } from "fs";
|
|
29923
30048
|
import { join as join5, basename, extname } from "path";
|
|
29924
|
-
import { homedir as
|
|
30049
|
+
import { homedir as homedir5 } from "os";
|
|
29925
30050
|
|
|
29926
30051
|
class CommandLoader {
|
|
29927
30052
|
commands = new Map;
|
|
@@ -29931,7 +30056,7 @@ class CommandLoader {
|
|
|
29931
30056
|
}
|
|
29932
30057
|
async loadAll() {
|
|
29933
30058
|
this.commands.clear();
|
|
29934
|
-
const globalDir = join5(
|
|
30059
|
+
const globalDir = join5(homedir5(), ".oldpal", "commands");
|
|
29935
30060
|
await this.loadFromDirectory(globalDir, "global");
|
|
29936
30061
|
const projectDir = join5(this.cwd, ".oldpal", "commands");
|
|
29937
30062
|
await this.loadFromDirectory(projectDir, "project");
|
|
@@ -30120,7 +30245,7 @@ ${stderr}`;
|
|
|
30120
30245
|
}
|
|
30121
30246
|
// packages/core/src/commands/builtin.ts
|
|
30122
30247
|
import { join as join6 } from "path";
|
|
30123
|
-
import { homedir as
|
|
30248
|
+
import { homedir as homedir6 } from "os";
|
|
30124
30249
|
import { existsSync as existsSync4, mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
30125
30250
|
|
|
30126
30251
|
class BuiltinCommands {
|
|
@@ -30407,7 +30532,7 @@ Format the summary as a brief bullet-point list. This summary will replace the c
|
|
|
30407
30532
|
handler: async (args, context) => {
|
|
30408
30533
|
const configPaths = [
|
|
30409
30534
|
join6(context.cwd, ".oldpal", "config.json"),
|
|
30410
|
-
join6(
|
|
30535
|
+
join6(homedir6(), ".oldpal", "config.json")
|
|
30411
30536
|
];
|
|
30412
30537
|
let message = `
|
|
30413
30538
|
**Configuration**
|
|
@@ -30425,7 +30550,7 @@ Format the summary as a brief bullet-point list. This summary will replace the c
|
|
|
30425
30550
|
`;
|
|
30426
30551
|
message += ` - Project: ${join6(context.cwd, ".oldpal", "commands")}
|
|
30427
30552
|
`;
|
|
30428
|
-
message += ` - Global: ${join6(
|
|
30553
|
+
message += ` - Global: ${join6(homedir6(), ".oldpal", "commands")}
|
|
30429
30554
|
`;
|
|
30430
30555
|
context.emit("text", message);
|
|
30431
30556
|
context.emit("done");
|
|
@@ -30647,7 +30772,7 @@ async function createLLMClient(config) {
|
|
|
30647
30772
|
|
|
30648
30773
|
// packages/core/src/config.ts
|
|
30649
30774
|
import { join as join8 } from "path";
|
|
30650
|
-
import { homedir as
|
|
30775
|
+
import { homedir as homedir8 } from "os";
|
|
30651
30776
|
var DEFAULT_CONFIG = {
|
|
30652
30777
|
llm: {
|
|
30653
30778
|
provider: "anthropic",
|
|
@@ -30677,7 +30802,7 @@ var DEFAULT_CONFIG = {
|
|
|
30677
30802
|
]
|
|
30678
30803
|
};
|
|
30679
30804
|
function getConfigDir() {
|
|
30680
|
-
return join8(
|
|
30805
|
+
return join8(homedir8(), ".oldpal");
|
|
30681
30806
|
}
|
|
30682
30807
|
function getConfigPath(filename) {
|
|
30683
30808
|
return join8(getConfigDir(), filename);
|
|
@@ -30749,14 +30874,19 @@ async function loadJsonFile(path) {
|
|
|
30749
30874
|
return null;
|
|
30750
30875
|
}
|
|
30751
30876
|
}
|
|
30752
|
-
async function ensureConfigDir() {
|
|
30877
|
+
async function ensureConfigDir(sessionId) {
|
|
30753
30878
|
const { mkdir } = await import("fs/promises");
|
|
30754
30879
|
const configDir = getConfigDir();
|
|
30755
|
-
|
|
30880
|
+
const dirs = [
|
|
30756
30881
|
mkdir(configDir, { recursive: true }),
|
|
30757
30882
|
mkdir(join8(configDir, "sessions"), { recursive: true }),
|
|
30758
|
-
mkdir(join8(configDir, "skills"), { recursive: true })
|
|
30759
|
-
|
|
30883
|
+
mkdir(join8(configDir, "skills"), { recursive: true }),
|
|
30884
|
+
mkdir(join8(configDir, "temp"), { recursive: true })
|
|
30885
|
+
];
|
|
30886
|
+
if (sessionId) {
|
|
30887
|
+
dirs.push(mkdir(join8(configDir, "temp", sessionId), { recursive: true }));
|
|
30888
|
+
}
|
|
30889
|
+
await Promise.all(dirs);
|
|
30760
30890
|
}
|
|
30761
30891
|
async function loadSystemPrompt(cwd2 = process.cwd()) {
|
|
30762
30892
|
const prompts = [];
|
|
@@ -30834,7 +30964,7 @@ class AgentLoop {
|
|
|
30834
30964
|
async initialize() {
|
|
30835
30965
|
const [config] = await Promise.all([
|
|
30836
30966
|
loadConfig(this.cwd),
|
|
30837
|
-
ensureConfigDir()
|
|
30967
|
+
ensureConfigDir(this.sessionId)
|
|
30838
30968
|
]);
|
|
30839
30969
|
this.config = config;
|
|
30840
30970
|
const [, , , hooksConfig, systemPrompt] = await Promise.all([
|
|
@@ -30848,7 +30978,7 @@ class AgentLoop {
|
|
|
30848
30978
|
this.commandLoader.loadAll()
|
|
30849
30979
|
]);
|
|
30850
30980
|
this.toolRegistry.register(BashTool.tool, BashTool.executor);
|
|
30851
|
-
FilesystemTools.registerAll(this.toolRegistry);
|
|
30981
|
+
FilesystemTools.registerAll(this.toolRegistry, this.sessionId);
|
|
30852
30982
|
WebTools.registerAll(this.toolRegistry);
|
|
30853
30983
|
ImageTools.registerAll(this.toolRegistry);
|
|
30854
30984
|
this.connectorBridge.registerAll(this.toolRegistry);
|
|
@@ -31060,7 +31190,7 @@ init_anthropic();
|
|
|
31060
31190
|
// packages/core/src/logger.ts
|
|
31061
31191
|
import { existsSync as existsSync6, mkdirSync as mkdirSync2, appendFileSync } from "fs";
|
|
31062
31192
|
import { join as join9 } from "path";
|
|
31063
|
-
import { homedir as
|
|
31193
|
+
import { homedir as homedir9 } from "os";
|
|
31064
31194
|
|
|
31065
31195
|
class Logger {
|
|
31066
31196
|
logDir;
|
|
@@ -31068,7 +31198,7 @@ class Logger {
|
|
|
31068
31198
|
sessionId;
|
|
31069
31199
|
constructor(sessionId) {
|
|
31070
31200
|
this.sessionId = sessionId;
|
|
31071
|
-
this.logDir = join9(
|
|
31201
|
+
this.logDir = join9(homedir9(), ".oldpal", "logs");
|
|
31072
31202
|
this.ensureDir(this.logDir);
|
|
31073
31203
|
const date = new Date().toISOString().split("T")[0];
|
|
31074
31204
|
this.logFile = join9(this.logDir, `${date}.log`);
|
|
@@ -31114,7 +31244,7 @@ class SessionStorage {
|
|
|
31114
31244
|
sessionId;
|
|
31115
31245
|
constructor(sessionId) {
|
|
31116
31246
|
this.sessionId = sessionId;
|
|
31117
|
-
this.sessionsDir = join9(
|
|
31247
|
+
this.sessionsDir = join9(homedir9(), ".oldpal", "sessions");
|
|
31118
31248
|
this.ensureDir(this.sessionsDir);
|
|
31119
31249
|
this.sessionFile = join9(this.sessionsDir, `${sessionId}.json`);
|
|
31120
31250
|
}
|
|
@@ -31133,7 +31263,7 @@ class SessionStorage {
|
|
|
31133
31263
|
}
|
|
31134
31264
|
}
|
|
31135
31265
|
function initOldpalDir() {
|
|
31136
|
-
const baseDir = join9(
|
|
31266
|
+
const baseDir = join9(homedir9(), ".oldpal");
|
|
31137
31267
|
const dirs = [
|
|
31138
31268
|
baseDir,
|
|
31139
31269
|
join9(baseDir, "sessions"),
|
|
@@ -31579,19 +31709,28 @@ function Messages4({
|
|
|
31579
31709
|
const startIndex = Math.max(0, endIndex - maxVisible);
|
|
31580
31710
|
const visibleMessages = messages.slice(startIndex, endIndex);
|
|
31581
31711
|
const groupedMessages = groupConsecutiveToolMessages(visibleMessages);
|
|
31712
|
+
const historicalItems = groupedMessages.map((group) => {
|
|
31713
|
+
if (group.type === "single") {
|
|
31714
|
+
return { id: group.message.id, group };
|
|
31715
|
+
}
|
|
31716
|
+
return { id: group.messages[0].id, group };
|
|
31717
|
+
});
|
|
31582
31718
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
31583
31719
|
flexDirection: "column",
|
|
31584
31720
|
children: [
|
|
31585
|
-
|
|
31586
|
-
|
|
31587
|
-
|
|
31588
|
-
|
|
31589
|
-
|
|
31590
|
-
|
|
31591
|
-
|
|
31592
|
-
|
|
31593
|
-
|
|
31594
|
-
|
|
31721
|
+
/* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Static, {
|
|
31722
|
+
items: historicalItems,
|
|
31723
|
+
children: (item) => {
|
|
31724
|
+
if (item.group.type === "single") {
|
|
31725
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(MessageBubble, {
|
|
31726
|
+
message: item.group.message
|
|
31727
|
+
}, item.id, false, undefined, this);
|
|
31728
|
+
}
|
|
31729
|
+
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(CombinedToolMessage, {
|
|
31730
|
+
messages: item.group.messages
|
|
31731
|
+
}, item.id, false, undefined, this);
|
|
31732
|
+
}
|
|
31733
|
+
}, undefined, false, undefined, this),
|
|
31595
31734
|
activityLog.map((entry) => {
|
|
31596
31735
|
if (entry.type === "text" && entry.content) {
|
|
31597
31736
|
return /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
@@ -32412,8 +32551,8 @@ function App2({ cwd: cwd2 }) {
|
|
|
32412
32551
|
padding: 1,
|
|
32413
32552
|
children: [
|
|
32414
32553
|
showWelcome && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(WelcomeBanner, {
|
|
32415
|
-
version: "0.4.
|
|
32416
|
-
model: "claude-4
|
|
32554
|
+
version: "0.4.1",
|
|
32555
|
+
model: "claude-sonnet-4",
|
|
32417
32556
|
directory: cwd2
|
|
32418
32557
|
}, undefined, false, undefined, this),
|
|
32419
32558
|
scrollOffset > 0 && /* @__PURE__ */ jsx_dev_runtime8.jsxDEV(Box_default, {
|
|
@@ -32502,7 +32641,7 @@ var options = {
|
|
|
32502
32641
|
help: args.includes("--help") || args.includes("-h")
|
|
32503
32642
|
};
|
|
32504
32643
|
if (options.version) {
|
|
32505
|
-
console.log("oldpal v0.4.
|
|
32644
|
+
console.log("oldpal v0.4.1");
|
|
32506
32645
|
process.exit(0);
|
|
32507
32646
|
}
|
|
32508
32647
|
if (options.help) {
|
|
@@ -32533,4 +32672,4 @@ waitUntilExit().then(() => {
|
|
|
32533
32672
|
process.exit(0);
|
|
32534
32673
|
});
|
|
32535
32674
|
|
|
32536
|
-
//# debugId=
|
|
32675
|
+
//# debugId=165DC707B2BFFF8564756E2164756E21
|