portable-agent-layer 0.97.0 → 0.99.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/package.json +2 -2
- package/src/cli/cost.ts +18 -0
- package/src/cli/events.ts +22 -0
- package/src/cli/tree.ts +2 -0
- package/src/hooks/lib/commitment-events.ts +3 -3
- package/src/hooks/lib/entity-events.ts +18 -5
- package/src/hooks/lib/events.ts +54 -4
- package/src/hooks/lib/interaction.ts +25 -5
- package/src/hooks/lib/ledger.ts +61 -2
- package/src/hooks/lib/models.ts +42 -10
- package/src/hooks/lib/remote.ts +3 -0
- package/src/hooks/lib/signals.ts +54 -4
- package/src/hooks/lib/work-tracking.ts +39 -2
- package/src/targets/lib.ts +1 -3
- package/src/tools/agent/project.ts +7 -2
- package/src/tools/knowledge/lib.ts +11 -2
- package/src/tools/lib/backfill/entities.ts +31 -0
- package/src/tools/lib/backfill/git.ts +184 -0
- package/src/tools/lib/backfill/index.ts +38 -0
- package/src/tools/lib/backfill/ledger.ts +28 -0
- package/src/tools/lib/backfill/projects.ts +40 -0
- package/src/tools/lib/backfill/promises.ts +91 -0
- package/src/tools/lib/backfill/ratings.ts +21 -0
- package/src/tools/lib/backfill/rows.ts +33 -0
- package/src/tools/lib/backfill/sessions.ts +56 -0
- package/src/tools/lib/backfill/turns.ts +32 -0
- package/src/tools/lib/collectors/billing.ts +105 -0
- package/src/tools/lib/collectors/claude.ts +61 -21
- package/src/tools/lib/collectors/codex.ts +6 -3
- package/src/tools/lib/collectors/copilot.ts +2 -0
- package/src/tools/lib/collectors/index.ts +8 -1
- package/src/tools/lib/collectors/opencode.ts +10 -2
- package/src/tools/lib/cost-report.ts +134 -0
- package/src/tools/lib/plan-prices.ts +24 -0
- package/src/tools/lib/project-history.ts +100 -0
- package/src/tools/lib/session-usage.ts +11 -7
- package/src/tools/lib/usage-buckets.ts +10 -5
|
@@ -90,8 +90,13 @@ function addCall(bucket: Bucket, tokens: Tokens, cost: number | null, calls = 1)
|
|
|
90
90
|
if (cost === null) bucket.unpriced += calls;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export function addToBucket(
|
|
94
|
-
|
|
93
|
+
export function addToBucket(
|
|
94
|
+
bucket: Bucket,
|
|
95
|
+
model: string,
|
|
96
|
+
tokens: Tokens,
|
|
97
|
+
ts: string
|
|
98
|
+
): void {
|
|
99
|
+
addCall(bucket, tokens, costOfUsage(model, tokens, ts));
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
/**
|
|
@@ -117,7 +122,7 @@ export function addToTimeBuckets(
|
|
|
117
122
|
tokens: Tokens,
|
|
118
123
|
horizons: Horizons
|
|
119
124
|
): void {
|
|
120
|
-
addToWindows(buckets, ts, horizons, (bucket) => addToBucket(bucket, model, tokens));
|
|
125
|
+
addToWindows(buckets, ts, horizons, (bucket) => addToBucket(bucket, model, tokens, ts));
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
export function totalTokens(bucket: Bucket): number {
|
|
@@ -290,7 +295,7 @@ export function readClaudeCode(
|
|
|
290
295
|
model: call.model,
|
|
291
296
|
tokens: call.tokens,
|
|
292
297
|
project: call.project,
|
|
293
|
-
cost: costOfUsage(call.model, call.tokens),
|
|
298
|
+
cost: costOfUsage(call.model, call.tokens, call.ts),
|
|
294
299
|
});
|
|
295
300
|
}
|
|
296
301
|
return tally.usage;
|
|
@@ -357,7 +362,7 @@ export function readPalInference(
|
|
|
357
362
|
);
|
|
358
363
|
|
|
359
364
|
result.byCaller[entry.caller] ??= emptyBucket();
|
|
360
|
-
addToBucket(result.byCaller[entry.caller], entry.model, tokens);
|
|
365
|
+
addToBucket(result.byCaller[entry.caller], entry.model, tokens, entry.ts);
|
|
361
366
|
}
|
|
362
367
|
|
|
363
368
|
return result;
|