@juli-os/ledger 0.1.0 → 0.1.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/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
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';
4
+ export { priceUsage, findPrice, type UsageCost, type UsageRow } from './platform/ledger/pricing.ts';
5
+ export { emptyCaseFile, parseCaseFile, serializeCaseFile, type CaseFileDoc, appendSection, appendExecution, appendDecision, appendReference, originalEmail, } 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,32 @@ var parseCaseFile = (raw, now) => {
103
103
  };
104
104
  };
105
105
  var serializeCaseFile = (cf) => JSON.stringify(cf);
106
+ var appendSection = (cf, section, value, now) => ({
107
+ ...cf,
108
+ ...section === "extract" ? { extract: value } : { draft: value },
109
+ updatedAt: rfc3339(now)
110
+ });
111
+ var appendExecution = (cf, execution, now) => ({
112
+ ...cf,
113
+ executions: [...cf.executions, execution],
114
+ updatedAt: rfc3339(now)
115
+ });
116
+ var appendDecision = (cf, d, now) => ({
117
+ ...cf,
118
+ decisions: [...cf.decisions, { ...d, at: rfc3339(now) }],
119
+ updatedAt: rfc3339(now)
120
+ });
121
+ var appendReference = (cf, messageId, now) => ({
122
+ ...cf,
123
+ references: [...cf.references, messageId],
124
+ updatedAt: rfc3339(now)
125
+ });
126
+ var originalEmail = (cf) => ({
127
+ from: cf.original["from"] ?? "",
128
+ subject: cf.original["subject"] ?? "",
129
+ body: cf.original["body"] ?? "",
130
+ messageId: cf.original["message_id"] ?? ""
131
+ });
106
132
 
107
133
  // src/platform/ledger/store.ts
108
134
  var MIGRATIONS = `
@@ -1202,10 +1228,16 @@ var parseAssistantLine = (line) => {
1202
1228
  }
1203
1229
  };
1204
1230
  export {
1231
+ appendDecision,
1232
+ appendExecution,
1233
+ appendReference,
1234
+ appendSection,
1205
1235
  asRecord,
1206
1236
  createLedgerStore,
1207
1237
  createUsageStore,
1208
1238
  emptyCaseFile,
1239
+ findPrice,
1240
+ originalEmail,
1209
1241
  parseCaseFile,
1210
1242
  priceUsage,
1211
1243
  randomIds,
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.1",
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",