@hasna/oldpal 0.3.7 → 0.3.8
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 +135 -6
- package/dist/index.js.map +7 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30118,16 +30118,20 @@ class BuiltinCommands {
|
|
|
30118
30118
|
registerAll(loader) {
|
|
30119
30119
|
loader.register(this.helpCommand(loader));
|
|
30120
30120
|
loader.register(this.clearCommand());
|
|
30121
|
+
loader.register(this.newCommand());
|
|
30121
30122
|
loader.register(this.statusCommand());
|
|
30123
|
+
loader.register(this.tokensCommand());
|
|
30122
30124
|
loader.register(this.compactCommand());
|
|
30123
30125
|
loader.register(this.configCommand());
|
|
30124
30126
|
loader.register(this.initCommand());
|
|
30125
30127
|
loader.register(this.costCommand());
|
|
30126
30128
|
loader.register(this.modelCommand());
|
|
30129
|
+
loader.register(this.skillsCommand(loader));
|
|
30127
30130
|
loader.register(this.memoryCommand());
|
|
30128
30131
|
loader.register(this.bugCommand());
|
|
30129
30132
|
loader.register(this.prCommand());
|
|
30130
30133
|
loader.register(this.reviewCommand());
|
|
30134
|
+
loader.register(this.exitCommand());
|
|
30131
30135
|
}
|
|
30132
30136
|
updateTokenUsage(usage) {
|
|
30133
30137
|
Object.assign(this.tokenUsage, usage);
|
|
@@ -30203,6 +30207,117 @@ class BuiltinCommands {
|
|
|
30203
30207
|
}
|
|
30204
30208
|
};
|
|
30205
30209
|
}
|
|
30210
|
+
newCommand() {
|
|
30211
|
+
return {
|
|
30212
|
+
name: "new",
|
|
30213
|
+
description: "Start a new conversation",
|
|
30214
|
+
builtin: true,
|
|
30215
|
+
selfHandled: true,
|
|
30216
|
+
content: "",
|
|
30217
|
+
handler: async (args, context) => {
|
|
30218
|
+
context.clearMessages();
|
|
30219
|
+
this.tokenUsage.inputTokens = 0;
|
|
30220
|
+
this.tokenUsage.outputTokens = 0;
|
|
30221
|
+
this.tokenUsage.totalTokens = 0;
|
|
30222
|
+
context.emit("text", `Starting new conversation.
|
|
30223
|
+
`);
|
|
30224
|
+
context.emit("done");
|
|
30225
|
+
return { handled: true, clearConversation: true };
|
|
30226
|
+
}
|
|
30227
|
+
};
|
|
30228
|
+
}
|
|
30229
|
+
exitCommand() {
|
|
30230
|
+
return {
|
|
30231
|
+
name: "exit",
|
|
30232
|
+
description: "Exit oldpal",
|
|
30233
|
+
builtin: true,
|
|
30234
|
+
selfHandled: true,
|
|
30235
|
+
content: "",
|
|
30236
|
+
handler: async (args, context) => {
|
|
30237
|
+
context.emit("text", `Goodbye!
|
|
30238
|
+
`);
|
|
30239
|
+
context.emit("done");
|
|
30240
|
+
return { handled: true, exit: true };
|
|
30241
|
+
}
|
|
30242
|
+
};
|
|
30243
|
+
}
|
|
30244
|
+
tokensCommand() {
|
|
30245
|
+
return {
|
|
30246
|
+
name: "tokens",
|
|
30247
|
+
description: "Show token usage",
|
|
30248
|
+
builtin: true,
|
|
30249
|
+
selfHandled: true,
|
|
30250
|
+
content: "",
|
|
30251
|
+
handler: async (args, context) => {
|
|
30252
|
+
const usage = this.tokenUsage;
|
|
30253
|
+
const usedPercent = Math.round(usage.totalTokens / usage.maxContextTokens * 100);
|
|
30254
|
+
let message = `
|
|
30255
|
+
**Token Usage**
|
|
30256
|
+
|
|
30257
|
+
`;
|
|
30258
|
+
message += `Input: ${usage.inputTokens.toLocaleString()}
|
|
30259
|
+
`;
|
|
30260
|
+
message += `Output: ${usage.outputTokens.toLocaleString()}
|
|
30261
|
+
`;
|
|
30262
|
+
message += `Total: ${usage.totalTokens.toLocaleString()} / ${usage.maxContextTokens.toLocaleString()} (${usedPercent}%)
|
|
30263
|
+
`;
|
|
30264
|
+
const barLength = 30;
|
|
30265
|
+
const filledLength = Math.round(usedPercent / 100 * barLength);
|
|
30266
|
+
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
30267
|
+
message += `
|
|
30268
|
+
[${bar}] ${usedPercent}%
|
|
30269
|
+
`;
|
|
30270
|
+
context.emit("text", message);
|
|
30271
|
+
context.emit("done");
|
|
30272
|
+
return { handled: true };
|
|
30273
|
+
}
|
|
30274
|
+
};
|
|
30275
|
+
}
|
|
30276
|
+
skillsCommand(loader) {
|
|
30277
|
+
return {
|
|
30278
|
+
name: "skills",
|
|
30279
|
+
description: "List available skills",
|
|
30280
|
+
builtin: true,
|
|
30281
|
+
selfHandled: true,
|
|
30282
|
+
content: "",
|
|
30283
|
+
handler: async (args, context) => {
|
|
30284
|
+
let message = `
|
|
30285
|
+
**Available Skills**
|
|
30286
|
+
|
|
30287
|
+
`;
|
|
30288
|
+
message += `Skills are invoked with /skill-name [arguments]
|
|
30289
|
+
|
|
30290
|
+
`;
|
|
30291
|
+
message += `**Built-in Skills:**
|
|
30292
|
+
`;
|
|
30293
|
+
message += ` /brainstorm - Generate ideas on a topic
|
|
30294
|
+
`;
|
|
30295
|
+
message += ` /draft - Draft content (emails, docs, etc.)
|
|
30296
|
+
`;
|
|
30297
|
+
message += ` /research - Research a topic
|
|
30298
|
+
`;
|
|
30299
|
+
message += ` /summarize - Summarize text or content
|
|
30300
|
+
`;
|
|
30301
|
+
message += `
|
|
30302
|
+
**Connector Skills:**
|
|
30303
|
+
`;
|
|
30304
|
+
message += ` /calendar - Manage calendar events
|
|
30305
|
+
`;
|
|
30306
|
+
message += ` /email - Read and send emails
|
|
30307
|
+
`;
|
|
30308
|
+
message += ` /notes - Manage notes (Notion)
|
|
30309
|
+
`;
|
|
30310
|
+
message += ` /search - Search the web
|
|
30311
|
+
`;
|
|
30312
|
+
message += `
|
|
30313
|
+
Custom skills can be added in .oldpal/skills/
|
|
30314
|
+
`;
|
|
30315
|
+
context.emit("text", message);
|
|
30316
|
+
context.emit("done");
|
|
30317
|
+
return { handled: true };
|
|
30318
|
+
}
|
|
30319
|
+
};
|
|
30320
|
+
}
|
|
30206
30321
|
statusCommand() {
|
|
30207
30322
|
return {
|
|
30208
30323
|
name: "status",
|
|
@@ -30759,6 +30874,9 @@ class AgentLoop {
|
|
|
30759
30874
|
if (commandResult.clearConversation) {
|
|
30760
30875
|
this.context = new AgentContext;
|
|
30761
30876
|
}
|
|
30877
|
+
if (commandResult.exit) {
|
|
30878
|
+
this.emit({ type: "exit" });
|
|
30879
|
+
}
|
|
30762
30880
|
return;
|
|
30763
30881
|
}
|
|
30764
30882
|
if (commandResult.prompt) {
|
|
@@ -31259,10 +31377,19 @@ var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
|
31259
31377
|
var COMMANDS = [
|
|
31260
31378
|
{ name: "/help", description: "show available commands" },
|
|
31261
31379
|
{ name: "/clear", description: "clear the conversation" },
|
|
31262
|
-
{ name: "/model", description: "change the AI model" },
|
|
31263
|
-
{ name: "/skills", description: "list available skills" },
|
|
31264
|
-
{ name: "/tokens", description: "show token usage" },
|
|
31265
31380
|
{ name: "/new", description: "start a new conversation" },
|
|
31381
|
+
{ name: "/status", description: "show session status" },
|
|
31382
|
+
{ name: "/tokens", description: "show token usage" },
|
|
31383
|
+
{ name: "/cost", description: "show estimated API cost" },
|
|
31384
|
+
{ name: "/model", description: "show model information" },
|
|
31385
|
+
{ name: "/skills", description: "list available skills" },
|
|
31386
|
+
{ name: "/config", description: "show configuration" },
|
|
31387
|
+
{ name: "/init", description: "initialize oldpal in project" },
|
|
31388
|
+
{ name: "/compact", description: "summarize to save context" },
|
|
31389
|
+
{ name: "/memory", description: "show what AI remembers" },
|
|
31390
|
+
{ name: "/bug", description: "analyze and fix a bug" },
|
|
31391
|
+
{ name: "/pr", description: "create a pull request" },
|
|
31392
|
+
{ name: "/review", description: "review code changes" },
|
|
31266
31393
|
{ name: "/exit", description: "exit oldpal" }
|
|
31267
31394
|
];
|
|
31268
31395
|
function Input({ onSubmit, isProcessing, queueLength = 0, commands }) {
|
|
@@ -32157,6 +32284,8 @@ function App2({ cwd: cwd2 }) {
|
|
|
32157
32284
|
} else if (chunk.type === "error" && chunk.error) {
|
|
32158
32285
|
setError(chunk.error);
|
|
32159
32286
|
setIsProcessing(false);
|
|
32287
|
+
} else if (chunk.type === "exit") {
|
|
32288
|
+
exit();
|
|
32160
32289
|
} else if (chunk.type === "usage" && chunk.usage) {
|
|
32161
32290
|
setTokenUsage(chunk.usage);
|
|
32162
32291
|
setCurrentTurnTokens((prev) => prev + (chunk.usage?.outputTokens || 0));
|
|
@@ -32365,7 +32494,7 @@ function App2({ cwd: cwd2 }) {
|
|
|
32365
32494
|
padding: 1,
|
|
32366
32495
|
children: [
|
|
32367
32496
|
showWelcome && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(WelcomeBanner, {
|
|
32368
|
-
version: "0.3.
|
|
32497
|
+
version: "0.3.8",
|
|
32369
32498
|
model: "claude-sonnet-4-20250514",
|
|
32370
32499
|
directory: cwd2
|
|
32371
32500
|
}, undefined, false, undefined, this),
|
|
@@ -32445,7 +32574,7 @@ var options = {
|
|
|
32445
32574
|
help: args.includes("--help") || args.includes("-h")
|
|
32446
32575
|
};
|
|
32447
32576
|
if (options.version) {
|
|
32448
|
-
console.log("oldpal v0.3.
|
|
32577
|
+
console.log("oldpal v0.3.8");
|
|
32449
32578
|
process.exit(0);
|
|
32450
32579
|
}
|
|
32451
32580
|
if (options.help) {
|
|
@@ -32476,4 +32605,4 @@ waitUntilExit().then(() => {
|
|
|
32476
32605
|
process.exit(0);
|
|
32477
32606
|
});
|
|
32478
32607
|
|
|
32479
|
-
//# debugId=
|
|
32608
|
+
//# debugId=13C80C7BB59BEAC264756E2164756E21
|