@perstack/core 0.0.26 → 0.0.28

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 CHANGED
@@ -64,16 +64,47 @@ export const apiExpertSchema = expertSchema.omit({
64
64
  - `AdapterRunParams`, `AdapterRunResult` - Adapter execution types
65
65
  - Event creators for normalized checkpoint/event handling
66
66
 
67
+ 5. **Storage Abstractions**: Abstract interface for data persistence:
68
+ - `Storage` - Interface for storage backends (filesystem, S3, R2)
69
+ - `EventMeta` - Metadata type for event listings
70
+
67
71
  ### Execution Hierarchy
68
72
 
69
- | Schema | Description |
70
- | ------------ | --------------------------------------------------- |
71
- | `Job` | Top-level execution unit. Contains all Runs. |
72
- | `Run` | Single Expert execution within a Job. |
73
- | `Checkpoint` | Snapshot at step end within a Run. |
73
+ | Schema | Description |
74
+ | ------------ | -------------------------------------------- |
75
+ | `Job` | Top-level execution unit. Contains all Runs. |
76
+ | `Run` | Single Expert execution within a Job. |
77
+ | `Checkpoint` | Snapshot at step end within a Run. |
74
78
 
75
79
  For the full hierarchy and execution model, see [State Management](https://github.com/perstack-ai/perstack/blob/main/docs/using-experts/state-management.md).
76
80
 
81
+ ### Storage Interface
82
+
83
+ The `Storage` interface provides an abstraction for persisting Perstack data:
84
+
85
+ ```typescript
86
+ import type { Storage, EventMeta } from "@perstack/core"
87
+
88
+ interface Storage {
89
+ storeCheckpoint(checkpoint: Checkpoint): Promise<void>
90
+ retrieveCheckpoint(jobId: string, checkpointId: string): Promise<Checkpoint>
91
+ getCheckpointsByJobId(jobId: string): Promise<Checkpoint[]>
92
+ storeEvent(event: RunEvent): Promise<void>
93
+ getEventsByRun(jobId: string, runId: string): Promise<EventMeta[]>
94
+ getEventContents(jobId: string, runId: string, maxStep?: number): Promise<RunEvent[]>
95
+ storeJob(job: Job): Promise<void>
96
+ retrieveJob(jobId: string): Promise<Job | undefined>
97
+ getAllJobs(): Promise<Job[]>
98
+ storeRunSetting(setting: RunSetting): Promise<void>
99
+ getAllRuns(): Promise<RunSetting[]>
100
+ }
101
+ ```
102
+
103
+ Available implementations:
104
+ - `@perstack/filesystem-storage` - Local filesystem storage (default)
105
+ - `@perstack/s3-storage` - AWS S3 storage
106
+ - `@perstack/r2-storage` - Cloudflare R2 storage
107
+
77
108
  ### What Core Should NOT Contain
78
109
 
79
110
  1. **Package-Internal Types**: Implementation details that don't cross package boundaries should remain in their respective packages.