portable-agent-layer 0.33.0 → 0.34.0
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 +1 -0
- package/assets/templates/PAL/README.md +1 -1
- package/package.json +2 -3
- package/src/cli/index.ts +7 -0
- package/src/tools/token-cost.ts +4 -4
package/README.md
CHANGED
|
@@ -82,6 +82,7 @@ pal cli status # check your setup
|
|
|
82
82
|
| `pal cli import` | Import user state from a zip |
|
|
83
83
|
| `pal cli status` | Show current PAL configuration |
|
|
84
84
|
| `pal cli doctor` | Check prerequisites and system health |
|
|
85
|
+
| `pal cli usage` | Summarize token usage and estimated cost |
|
|
85
86
|
|
|
86
87
|
### Target flags
|
|
87
88
|
|
|
@@ -82,7 +82,7 @@ Persistent storage across sessions:
|
|
|
82
82
|
- **state/** — Session registry, counts cache, debug logs
|
|
83
83
|
|
|
84
84
|
### Tools (`src/tools/`)
|
|
85
|
-
CLI utilities: `tool:opinion` (manage opinions), `tool:reflect` (relationship reflection), `tool:analyze` (learning analysis), `
|
|
85
|
+
CLI utilities: `tool:opinion` (manage opinions), `tool:reflect` (relationship reflection), `tool:analyze` (learning analysis), `pal cli usage` (token usage tracking), `tool:export` / `tool:import` (state portability).
|
|
86
86
|
|
|
87
87
|
### TELOS (`telos/`)
|
|
88
88
|
Personal context system — mission, goals, projects, beliefs, challenges, strategies, ideas, learnings, mental models, narratives. Managed via the telos skill.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "portable-agent-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "PAL — Portable Agent Layer: persistent personal context for AI coding assistants",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
"tool:wisdom-frame": "bun run src/tools/agent/wisdom-frame.ts",
|
|
52
52
|
"tool:reflect": "bun run src/tools/relationship-reflect.ts",
|
|
53
53
|
"tool:export": "bun run src/tools/export.ts",
|
|
54
|
-
"tool:import": "bun run src/tools/import.ts"
|
|
55
|
-
"tool:tokens": "bun run src/tools/token-cost.ts"
|
|
54
|
+
"tool:import": "bun run src/tools/import.ts"
|
|
56
55
|
},
|
|
57
56
|
"lint-staged": {
|
|
58
57
|
"*.ts": [
|
package/src/cli/index.ts
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* import [path] [--dry-run] Import user state from zip
|
|
16
16
|
* status Show current PAL configuration
|
|
17
17
|
* doctor Check prerequisites and system health
|
|
18
|
+
* usage Summarize token usage and cost
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
21
|
import { spawnSync } from "node:child_process";
|
|
@@ -168,6 +169,11 @@ async function runCli(command: string | undefined, args: string[]) {
|
|
|
168
169
|
case "doctor":
|
|
169
170
|
doctor();
|
|
170
171
|
break;
|
|
172
|
+
case "usage": {
|
|
173
|
+
const { usage } = await import("../tools/token-cost");
|
|
174
|
+
usage();
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
171
177
|
case "--help":
|
|
172
178
|
case "-h":
|
|
173
179
|
case "help":
|
|
@@ -206,6 +212,7 @@ function showHelp() {
|
|
|
206
212
|
pal cli import [path] [--dry-run] Import state from zip
|
|
207
213
|
pal cli status Show PAL configuration
|
|
208
214
|
pal cli doctor Check prerequisites and health
|
|
215
|
+
pal cli usage Summarize token usage and cost
|
|
209
216
|
|
|
210
217
|
Environment:
|
|
211
218
|
PAL_HOME Override user state directory (default: ~/.pal or repo root)
|
package/src/tools/token-cost.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Summarize token usage and estimated cost.
|
|
3
3
|
*
|
|
4
4
|
* Reads from two sources:
|
|
5
5
|
* 1. Claude Code session transcripts (~/.claude/projects/)
|
|
6
6
|
* 2. PAL Haiku inference logs (memory/signals/token-usage.jsonl)
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* Invoked via `pal cli usage [--today|--week|--month|--all] [--project <name>]`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
@@ -372,7 +372,7 @@ export function readPalInference(): {
|
|
|
372
372
|
|
|
373
373
|
// ── CLI ──
|
|
374
374
|
|
|
375
|
-
function
|
|
375
|
+
export function usage() {
|
|
376
376
|
parseArgs({
|
|
377
377
|
options: {
|
|
378
378
|
today: { type: "boolean", default: false },
|
|
@@ -441,4 +441,4 @@ function run() {
|
|
|
441
441
|
console.log(`\n Grand Total: ${fmtCost(grand.cost)}\n`);
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
if (import.meta.main)
|
|
444
|
+
if (import.meta.main) usage();
|