@juli-os/ledger 0.1.0 → 0.1.2

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.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createLedgerStore, type LifecycleStore } from './platform/ledger/store.ts';
2
2
  export type { Workflow, Step, WorkflowStatus, StepStatus, StepKind } from './contracts/entities.ts';
3
- export { createUsageStore, type UsageStore, type UsageStats } from './platform/ledger/usage.ts';
4
- export { priceUsage, type UsageCost, type UsageRow } from './platform/ledger/pricing.ts';
5
- export { emptyCaseFile, parseCaseFile, serializeCaseFile, type CaseFileDoc, } from './platform/ledger/casefile.ts';
3
+ export { createUsageStore, type UsageRecord, type UsageStats, type TimelinePoint, type UsageStore, } from './platform/ledger/usage.ts';
4
+ export { findPrice, priceUsage, type TierWhen, type PriceTier, type ModelPrice, PRICING_SOURCE, PRICING_RETRIEVED_AT, BIGMODEL_PRICES, type UsageRow, type CostBreakdown, type ModelUsageCost, type UsageCost, } from './platform/ledger/pricing.ts';
5
+ export { emptyCaseFile, parseCaseFile, serializeCaseFile, withOriginal, appendSection, appendExecution, appendDecision, appendReference, originalEmail, type CaseDecision, type ArtifactRef, type CaseFileDoc, } from './platform/ledger/casefile.ts';
6
6
  export { rfc3339, systemClock, randomIds, type Clock, type IdGen } from './platform/shared/clock.ts';
7
7
  export { asRecord, safeParse, type JsonRecord, type JsonValue } from './platform/shared/json.ts';
package/dist/index.js CHANGED
@@ -103,6 +103,43 @@ var parseCaseFile = (raw, now) => {
103
103
  };
104
104
  };
105
105
  var serializeCaseFile = (cf) => JSON.stringify(cf);
106
+ var withOriginal = (cf, o, now) => ({
107
+ ...cf,
108
+ original: {
109
+ from: o.from,
110
+ ...o.fromName !== void 0 && o.fromName !== "" ? { from_name: o.fromName } : {},
111
+ subject: o.subject,
112
+ body: o.body,
113
+ message_id: o.messageId
114
+ },
115
+ updatedAt: rfc3339(now)
116
+ });
117
+ var appendSection = (cf, section, value, now) => ({
118
+ ...cf,
119
+ ...section === "extract" ? { extract: value } : { draft: value },
120
+ updatedAt: rfc3339(now)
121
+ });
122
+ var appendExecution = (cf, execution, now) => ({
123
+ ...cf,
124
+ executions: [...cf.executions, execution],
125
+ updatedAt: rfc3339(now)
126
+ });
127
+ var appendDecision = (cf, d, now) => ({
128
+ ...cf,
129
+ decisions: [...cf.decisions, { ...d, at: rfc3339(now) }],
130
+ updatedAt: rfc3339(now)
131
+ });
132
+ var appendReference = (cf, messageId, now) => ({
133
+ ...cf,
134
+ references: [...cf.references, messageId],
135
+ updatedAt: rfc3339(now)
136
+ });
137
+ var originalEmail = (cf) => ({
138
+ from: cf.original["from"] ?? "",
139
+ subject: cf.original["subject"] ?? "",
140
+ body: cf.original["body"] ?? "",
141
+ messageId: cf.original["message_id"] ?? ""
142
+ });
106
143
 
107
144
  // src/platform/ledger/store.ts
108
145
  var MIGRATIONS = `
@@ -1202,15 +1239,25 @@ var parseAssistantLine = (line) => {
1202
1239
  }
1203
1240
  };
1204
1241
  export {
1242
+ BIGMODEL_PRICES,
1243
+ PRICING_RETRIEVED_AT,
1244
+ PRICING_SOURCE,
1245
+ appendDecision,
1246
+ appendExecution,
1247
+ appendReference,
1248
+ appendSection,
1205
1249
  asRecord,
1206
1250
  createLedgerStore,
1207
1251
  createUsageStore,
1208
1252
  emptyCaseFile,
1253
+ findPrice,
1254
+ originalEmail,
1209
1255
  parseCaseFile,
1210
1256
  priceUsage,
1211
1257
  randomIds,
1212
1258
  rfc3339,
1213
1259
  safeParse,
1214
1260
  serializeCaseFile,
1215
- systemClock
1261
+ systemClock,
1262
+ withOriginal
1216
1263
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juli-os/ledger",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "juli-os L1 layer: the ledger of record for agent work — workflows, steps, case files, and token usage in one zero-dependency SQLite layer.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",