chuk-artifacts 0.2.2__py3-none-any.whl → 0.4__py3-none-any.whl

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.
@@ -1,719 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: chuk-artifacts
3
- Version: 0.2.2
4
- Summary: Chuk Artifacts provides a production-ready, modular artifact storage system that works seamlessly across multiple storage backends (memory, filesystem, AWS S3, IBM Cloud Object Storage) with Redis or memory-based metadata caching and strict session-based security.
5
- License: MIT
6
- Requires-Python: >=3.11
7
- Description-Content-Type: text/markdown
8
- License-File: LICENSE
9
- Requires-Dist: chuk-tool-processor>=0.4
10
- Requires-Dist: pydantic>=2.10.6
11
- Requires-Dist: pyyaml>=6.0.2
12
- Requires-Dist: aioboto3>=14.3.0
13
- Requires-Dist: redis>=6.2.0
14
- Requires-Dist: ibm-cos-sdk>=2.13.5
15
- Requires-Dist: chuk-sessions>=0.2
16
- Provides-Extra: websocket
17
- Requires-Dist: websockets>=10.0; extra == "websocket"
18
- Provides-Extra: dev
19
- Requires-Dist: pytest>=8.3.5; extra == "dev"
20
- Requires-Dist: pytest-asyncio>=0.26.0; extra == "dev"
21
- Requires-Dist: ruff>=0.4.6; extra == "dev"
22
- Dynamic: license-file
23
-
24
- # Chuk Artifacts
25
-
26
- [![Tests](https://img.shields.io/badge/tests-passing-brightgreen)](https://github.com/your-org/chuk-artifacts)
27
- [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://python.org)
28
- [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
29
-
30
- **Asynchronous, multi-backend artifact storage with mandatory session-based security and grid architecture**
31
-
32
- Chuk Artifacts provides a production-ready, modular artifact storage system that works seamlessly across multiple storage backends (memory, filesystem, AWS S3, IBM Cloud Object Storage) with Redis or memory-based metadata caching and **strict session-based security**.
33
-
34
- ## ✨ Key Features
35
-
36
- - 🏗️ **Modular Architecture**: 5 specialized operation modules for clean separation of concerns
37
- - 🔒 **Mandatory Session Security**: Strict isolation with no anonymous artifacts or cross-session operations
38
- - 🌐 **Grid Architecture**: `grid/{sandbox_id}/{session_id}/{artifact_id}` paths for federation-ready organization
39
- - 🔄 **Multi-Backend Support**: Memory, filesystem, S3, IBM COS with seamless switching
40
- - ⚡ **High Performance**: Built with async/await for high throughput (3,000+ ops/sec)
41
- - 🔗 **Presigned URLs**: Secure, time-limited access without credential exposure
42
- - 📊 **Batch Operations**: Efficient multi-file uploads and processing
43
- - 🗃️ **Metadata Caching**: Fast lookups with Redis or memory-based sessions
44
- - 📁 **Directory-Like Operations**: Organize files with path-based prefixes
45
- - 🔧 **Zero Configuration**: Works out of the box with sensible defaults
46
- - 🌍 **Production Ready**: Battle-tested with comprehensive error handling
47
-
48
- ## 🚀 Quick Start
49
-
50
- ### Installation
51
-
52
- ```bash
53
- pip install chuk-artifacts
54
- # or with uv
55
- uv add chuk-artifacts
56
- ```
57
-
58
- ### Basic Usage
59
-
60
- ```python
61
- from chuk_artifacts import ArtifactStore
62
-
63
- # Zero-config setup (uses memory provider)
64
- async with ArtifactStore() as store:
65
- # Store an artifact (session auto-allocated)
66
- artifact_id = await store.store(
67
- data=b"Hello, world!",
68
- mime="text/plain",
69
- summary="A simple greeting",
70
- filename="hello.txt"
71
- # session_id auto-allocated if not provided
72
- )
73
-
74
- # Retrieve it
75
- data = await store.retrieve(artifact_id)
76
- print(data.decode()) # "Hello, world!"
77
-
78
- # Generate a presigned URL
79
- download_url = await store.presign_medium(artifact_id) # 1 hour
80
- ```
81
-
82
- ### Session-Based File Management
83
-
84
- ```python
85
- async with ArtifactStore() as store:
86
- # Create files in user sessions
87
- doc_id = await store.write_file(
88
- content="# User's Document\n\nPrivate content here.",
89
- filename="docs/private.md",
90
- mime="text/markdown",
91
- session_id="user_alice"
92
- )
93
-
94
- # List files in a session
95
- files = await store.list_by_session("user_alice")
96
- print(f"Alice has {len(files)} files")
97
-
98
- # List directory-like contents
99
- docs = await store.get_directory_contents("user_alice", "docs/")
100
- print(f"Alice's docs: {len(docs)} files")
101
-
102
- # Copy within same session (allowed)
103
- backup_id = await store.copy_file(
104
- doc_id,
105
- new_filename="docs/private_backup.md"
106
- )
107
-
108
- # Cross-session operations are BLOCKED for security
109
- try:
110
- await store.copy_file(
111
- doc_id,
112
- target_session_id="user_bob" # This will fail
113
- )
114
- except ArtifactStoreError:
115
- print("✅ Cross-session operations blocked!")
116
- ```
117
-
118
- ### Configuration
119
-
120
- ```python
121
- # Production setup with S3 and Redis
122
- store = ArtifactStore(
123
- storage_provider="s3",
124
- session_provider="redis",
125
- bucket="my-artifacts"
126
- )
127
-
128
- # Or use environment variables
129
- # ARTIFACT_PROVIDER=s3
130
- # SESSION_PROVIDER=redis
131
- # AWS_ACCESS_KEY_ID=your_key
132
- # AWS_SECRET_ACCESS_KEY=your_secret
133
- # ARTIFACT_BUCKET=my-artifacts
134
-
135
- store = ArtifactStore() # Auto-loads configuration
136
- ```
137
-
138
- ## 🏗️ Modular Architecture
139
-
140
- Chuk Artifacts uses a clean modular architecture with specialized operation modules:
141
-
142
- ```
143
- ArtifactStore (Main Coordinator)
144
- ├── CoreStorageOperations # store() and retrieve()
145
- ├── MetadataOperations # metadata, exists, delete, update, list operations
146
- ├── PresignedURLOperations # URL generation and upload workflows
147
- ├── BatchOperations # store_batch() for multiple files
148
- └── AdminOperations # validate_configuration, get_stats
149
- ```
150
-
151
- ### Grid Architecture
152
-
153
- All artifacts are organized using a consistent grid structure:
154
-
155
- ```
156
- grid/{sandbox_id}/{session_id}/{artifact_id}
157
- ```
158
-
159
- **Benefits:**
160
- - **Federation Ready**: Cross-sandbox discovery and routing
161
- - **Session Isolation**: Clear boundaries for security
162
- - **Predictable Paths**: Easy to understand and manage
163
- - **Scalable**: Handles multi-tenant applications
164
-
165
- This design provides:
166
- - **Better testability**: Each module can be tested independently
167
- - **Enhanced maintainability**: Clear separation of concerns
168
- - **Easy extensibility**: Add new operation types without touching core
169
- - **Improved debugging**: Isolated functionality for easier troubleshooting
170
-
171
- ## 🔒 Session-Based Security
172
-
173
- ### Mandatory Sessions
174
- ```python
175
- # Every artifact belongs to a session - no anonymous artifacts
176
- artifact_id = await store.store(
177
- data=b"content",
178
- mime="text/plain",
179
- summary="description"
180
- # session_id auto-allocated if not provided
181
- )
182
-
183
- # Get the session it was allocated to
184
- metadata = await store.metadata(artifact_id)
185
- session_id = metadata["session_id"]
186
- ```
187
-
188
- ### Strict Session Isolation
189
- ```python
190
- # Users can only access their own files
191
- alice_files = await store.list_by_session("user_alice")
192
- bob_files = await store.list_by_session("user_bob")
193
-
194
- # Cross-session operations are blocked
195
- await store.copy_file(alice_file_id, target_session_id="user_bob") # ❌ Blocked
196
- await store.move_file(alice_file_id, new_session_id="user_bob") # ❌ Blocked
197
- ```
198
-
199
- ### Multi-Tenant Safe
200
- ```python
201
- # Perfect for SaaS applications
202
- company_a_files = await store.list_by_session("company_a")
203
- company_b_files = await store.list_by_session("company_b")
204
-
205
- # Companies cannot access each other's data
206
- # Compliance-ready: GDPR, SOX, HIPAA
207
- ```
208
-
209
- ## 📦 Storage Providers
210
-
211
- ### Memory Provider
212
- ```python
213
- store = ArtifactStore(storage_provider="memory")
214
- ```
215
- - Perfect for development and testing
216
- - Zero configuration required
217
- - Non-persistent (data lost on restart)
218
- - **Note**: Provider isolation limitations for testing
219
-
220
- ### Filesystem Provider
221
- ```python
222
- store = ArtifactStore(storage_provider="filesystem")
223
- # Set root directory
224
- os.environ["ARTIFACT_FS_ROOT"] = "./my-artifacts"
225
- ```
226
- - Local disk storage
227
- - Persistent across restarts
228
- - `file://` URLs for local access
229
- - **Full session listing support**
230
- - Great for development and staging
231
-
232
- ### AWS S3 Provider
233
- ```python
234
- store = ArtifactStore(storage_provider="s3")
235
- # Configure via environment
236
- os.environ.update({
237
- "AWS_ACCESS_KEY_ID": "your_key",
238
- "AWS_SECRET_ACCESS_KEY": "your_secret",
239
- "AWS_REGION": "us-east-1",
240
- "ARTIFACT_BUCKET": "my-bucket"
241
- })
242
- ```
243
- - Industry-standard cloud storage
244
- - Native presigned URL support
245
- - Highly scalable and durable
246
- - **Full session listing support**
247
- - Perfect for production workloads
248
-
249
- ### IBM Cloud Object Storage
250
- ```python
251
- # HMAC authentication
252
- store = ArtifactStore(storage_provider="ibm_cos")
253
- os.environ.update({
254
- "AWS_ACCESS_KEY_ID": "your_hmac_key",
255
- "AWS_SECRET_ACCESS_KEY": "your_hmac_secret",
256
- "IBM_COS_ENDPOINT": "https://s3.us-south.cloud-object-storage.appdomain.cloud"
257
- })
258
-
259
- # IAM authentication
260
- store = ArtifactStore(storage_provider="ibm_cos_iam")
261
- os.environ.update({
262
- "IBM_COS_APIKEY": "your_api_key",
263
- "IBM_COS_INSTANCE_CRN": "crn:v1:bluemix:public:cloud-object-storage:..."
264
- })
265
- ```
266
-
267
- ## 🗃️ Session Providers
268
-
269
- ### Memory Sessions
270
- ```python
271
- store = ArtifactStore(session_provider="memory")
272
- ```
273
- - In-memory metadata storage
274
- - Fast but non-persistent
275
- - Perfect for testing
276
-
277
- ### Redis Sessions
278
- ```python
279
- store = ArtifactStore(session_provider="redis")
280
- os.environ["SESSION_REDIS_URL"] = "redis://localhost:6379/0"
281
- ```
282
- - Persistent metadata storage
283
- - Shared across multiple instances
284
- - Production-ready caching
285
-
286
- ## 🎯 Common Use Cases
287
-
288
- ### MCP Server Integration
289
-
290
- ```python
291
- from chuk_artifacts import ArtifactStore
292
-
293
- # Initialize for MCP server
294
- store = ArtifactStore(
295
- storage_provider="filesystem", # or "s3" for production
296
- session_provider="redis"
297
- )
298
-
299
- # MCP tool: Upload file
300
- async def upload_file(data_base64: str, filename: str, mime: str, session_id: str):
301
- data = base64.b64decode(data_base64)
302
- artifact_id = await store.store(
303
- data=data,
304
- mime=mime,
305
- summary=f"Uploaded: {filename}",
306
- filename=filename,
307
- session_id=session_id # Session isolation
308
- )
309
- return {"artifact_id": artifact_id}
310
-
311
- # MCP tool: List session files
312
- async def list_session_files(session_id: str, prefix: str = ""):
313
- files = await store.get_directory_contents(session_id, prefix)
314
- return {"files": files}
315
-
316
- # MCP tool: Copy file (within session only)
317
- async def copy_file(artifact_id: str, new_filename: str):
318
- new_id = await store.copy_file(artifact_id, new_filename=new_filename)
319
- return {"new_artifact_id": new_id}
320
- ```
321
-
322
- ### Web Framework Integration
323
-
324
- ```python
325
- from chuk_artifacts import ArtifactStore
326
-
327
- # Initialize once at startup
328
- store = ArtifactStore(
329
- storage_provider="s3",
330
- session_provider="redis"
331
- )
332
-
333
- async def upload_file(file_content: bytes, filename: str, content_type: str, user_id: str):
334
- """Handle file upload in FastAPI/Flask with user isolation"""
335
- artifact_id = await store.store(
336
- data=file_content,
337
- mime=content_type,
338
- summary=f"Uploaded: {filename}",
339
- filename=filename,
340
- session_id=f"user_{user_id}" # User-specific session
341
- )
342
-
343
- # Return download URL
344
- download_url = await store.presign_medium(artifact_id)
345
- return {
346
- "artifact_id": artifact_id,
347
- "download_url": download_url
348
- }
349
-
350
- async def list_user_files(user_id: str, directory: str = ""):
351
- """List files for a specific user"""
352
- return await store.get_directory_contents(f"user_{user_id}", directory)
353
- ```
354
-
355
- ### Advanced File Operations
356
-
357
- ```python
358
- # Read file content directly
359
- content = await store.read_file(artifact_id, as_text=True)
360
- print(f"File content: {content}")
361
-
362
- # Write file with content
363
- new_id = await store.write_file(
364
- content="# New Document\n\nThis is a new file.",
365
- filename="documents/new_doc.md",
366
- mime="text/markdown",
367
- session_id="user_123"
368
- )
369
-
370
- # Move/rename file within session
371
- await store.move_file(
372
- artifact_id,
373
- new_filename="documents/renamed_doc.md"
374
- )
375
-
376
- # Update metadata
377
- await store.update_metadata(
378
- artifact_id,
379
- summary="Updated summary",
380
- meta={"version": 2, "updated_by": "user_123"}
381
- )
382
-
383
- # Extend TTL
384
- await store.extend_ttl(artifact_id, additional_seconds=3600)
385
- ```
386
-
387
- ### Batch Processing
388
-
389
- ```python
390
- # Prepare multiple files
391
- items = [
392
- {
393
- "data": file1_content,
394
- "mime": "image/png",
395
- "summary": "Product image 1",
396
- "filename": "images/product1.png"
397
- },
398
- {
399
- "data": file2_content,
400
- "mime": "image/png",
401
- "summary": "Product image 2",
402
- "filename": "images/product2.png"
403
- }
404
- ]
405
-
406
- # Store all at once with session isolation
407
- artifact_ids = await store.store_batch(items, session_id="product-catalog")
408
- ```
409
-
410
- ## 🧪 Testing
411
-
412
- ### Run All Tests
413
- ```bash
414
- # MCP server scenarios (recommended)
415
- uv run examples/mcp_test_demo.py
416
-
417
- # Session security testing
418
- uv run examples/session_operations_demo.py
419
-
420
- # Grid architecture demo
421
- uv run examples/grid_demo.py
422
-
423
- # Complete verification
424
- uv run examples/complete_verification.py
425
- ```
426
-
427
- ### Test Results
428
- Recent test results show excellent performance:
429
- ```
430
- 📤 Test 1: Rapid file creation...
431
- ✅ Created 20 files in 0.006s (3,083 files/sec)
432
-
433
- 📋 Test 2: Session listing performance...
434
- ✅ Listed 20 files in 0.002s
435
-
436
- 📁 Test 3: Directory operations...
437
- ✅ Listed uploads/ directory (20 files) in 0.002s
438
-
439
- 📖 Test 4: Batch read operations...
440
- ✅ Read 10 files in 0.002s (4,693 reads/sec)
441
-
442
- 📋 Test 5: Copy operations...
443
- ✅ Copied 5 files in 0.003s (1,811 copies/sec)
444
- ```
445
-
446
- ### Development Setup
447
- ```python
448
- from chuk_artifacts.config import development_setup
449
-
450
- store = development_setup() # Uses memory providers
451
- ```
452
-
453
- ### Testing Setup
454
- ```python
455
- from chuk_artifacts.config import testing_setup
456
-
457
- store = testing_setup("./test-artifacts") # Uses filesystem
458
- ```
459
-
460
- ## 🔧 Configuration
461
-
462
- ### Environment Variables
463
-
464
- ```bash
465
- # Storage configuration
466
- ARTIFACT_PROVIDER=s3 # memory, filesystem, s3, ibm_cos, ibm_cos_iam
467
- ARTIFACT_BUCKET=my-artifacts # Bucket/container name
468
- ARTIFACT_FS_ROOT=./artifacts # Filesystem root (filesystem provider)
469
- ARTIFACT_SANDBOX_ID=my-app # Sandbox identifier for multi-tenancy
470
-
471
- # Session configuration
472
- SESSION_PROVIDER=redis # memory, redis
473
- SESSION_REDIS_URL=redis://localhost:6379/0
474
-
475
- # AWS/S3 configuration
476
- AWS_ACCESS_KEY_ID=your_key
477
- AWS_SECRET_ACCESS_KEY=your_secret
478
- AWS_REGION=us-east-1
479
- S3_ENDPOINT_URL=https://custom-s3.com # Optional: custom S3 endpoint
480
-
481
- # IBM COS configuration
482
- IBM_COS_ENDPOINT=https://s3.us-south.cloud-object-storage.appdomain.cloud
483
- IBM_COS_APIKEY=your_api_key # For IAM auth
484
- IBM_COS_INSTANCE_CRN=crn:v1:... # For IAM auth
485
- ```
486
-
487
- ### Programmatic Configuration
488
-
489
- ```python
490
- from chuk_artifacts.config import configure_s3, configure_redis_session
491
-
492
- # Configure S3 storage
493
- configure_s3(
494
- access_key="AKIA...",
495
- secret_key="...",
496
- bucket="prod-artifacts",
497
- region="us-west-2"
498
- )
499
-
500
- # Configure Redis sessions
501
- configure_redis_session("redis://prod-redis:6379/1")
502
-
503
- # Create store with this configuration
504
- store = ArtifactStore()
505
- ```
506
-
507
- ## 🚀 Performance
508
-
509
- - **High Throughput**: 3,000+ file operations per second
510
- - **Async/Await**: Non-blocking I/O for high concurrency
511
- - **Connection Pooling**: Efficient resource usage with aioboto3
512
- - **Metadata Caching**: Sub-millisecond lookups with Redis
513
- - **Batch Operations**: Reduced overhead for multiple files
514
- - **Grid Architecture**: Optimized session-based queries
515
-
516
- ### Performance Benchmarks
517
- ```
518
- ✅ File Creation: 3,083 files/sec
519
- ✅ File Reading: 4,693 reads/sec
520
- ✅ File Copying: 1,811 copies/sec
521
- ✅ Session Listing: ~0.002s for 20+ files
522
- ✅ Directory Listing: ~0.002s for filtered results
523
- ```
524
-
525
- ## 🔒 Security
526
-
527
- - **Mandatory Sessions**: No anonymous artifacts allowed
528
- - **Session Isolation**: Strict boundaries prevent cross-session access
529
- - **No Cross-Session Operations**: Copy, move, overwrite blocked across sessions
530
- - **Grid Architecture**: Clear audit trail in paths
531
- - **Presigned URLs**: Time-limited access without credential sharing
532
- - **Secure Defaults**: Conservative TTL and expiration settings
533
- - **Credential Isolation**: Environment-based configuration
534
- - **Error Handling**: No sensitive data in logs or exceptions
535
-
536
- ### Security Validation
537
- ```python
538
- # All these operations are blocked for security
539
- await store.copy_file(user_a_file, target_session_id="user_b") # ❌ Blocked
540
- await store.move_file(user_a_file, new_session_id="user_b") # ❌ Blocked
541
-
542
- # Security test results:
543
- # ✅ Cross-session copy correctly blocked
544
- # ✅ Cross-session move correctly blocked
545
- # ✅ Cross-session overwrite correctly blocked
546
- # 🛡️ ALL SECURITY TESTS PASSED!
547
- ```
548
-
549
- ## 📝 API Reference
550
-
551
- ### Core Methods
552
-
553
- #### `store(data, *, mime, summary, meta=None, filename=None, session_id=None, user_id=None, ttl=900)`
554
- Store artifact data with metadata. Session auto-allocated if not provided.
555
-
556
- #### `retrieve(artifact_id)`
557
- Retrieve artifact data by ID.
558
-
559
- #### `metadata(artifact_id)`
560
- Get artifact metadata.
561
-
562
- #### `exists(artifact_id)` / `delete(artifact_id)`
563
- Check existence or delete artifacts.
564
-
565
- ### Session Operations
566
-
567
- #### `create_session(user_id=None, ttl_hours=None)`
568
- Create a new session explicitly.
569
-
570
- #### `validate_session(session_id)` / `get_session_info(session_id)`
571
- Session validation and information retrieval.
572
-
573
- #### `list_by_session(session_id, limit=100)`
574
- List all artifacts in a session.
575
-
576
- #### `get_directory_contents(session_id, directory_prefix="", limit=100)`
577
- Get files in a directory-like structure.
578
-
579
- ### File Operations
580
-
581
- #### `write_file(content, *, filename, mime="text/plain", session_id=None, ...)`
582
- Write content to new file.
583
-
584
- #### `read_file(artifact_id, *, encoding="utf-8", as_text=True)`
585
- Read file content directly as text or binary.
586
-
587
- #### `copy_file(artifact_id, *, new_filename=None, new_meta=None, summary=None)`
588
- Copy file within same session only (cross-session blocked).
589
-
590
- #### `move_file(artifact_id, *, new_filename=None, new_meta=None)`
591
- Move/rename file within same session only (cross-session blocked).
592
-
593
- #### `list_files(session_id, prefix="", limit=100)`
594
- List files with optional prefix filtering.
595
-
596
- ### Metadata Operations
597
-
598
- #### `update_metadata(artifact_id, *, summary=None, meta=None, merge=True, **kwargs)`
599
- Update artifact metadata.
600
-
601
- #### `extend_ttl(artifact_id, additional_seconds)`
602
- Extend artifact TTL.
603
-
604
- ### Presigned URLs
605
-
606
- #### `presign(artifact_id, expires=3600)`
607
- Generate presigned URL for download.
608
-
609
- #### `presign_short(artifact_id)` / `presign_medium(artifact_id)` / `presign_long(artifact_id)`
610
- Generate URLs with predefined durations (15min/1hr/24hr).
611
-
612
- #### `presign_upload(session_id=None, filename=None, mime_type="application/octet-stream", expires=3600)`
613
- Generate presigned URL for upload.
614
-
615
- #### `register_uploaded_artifact(artifact_id, *, mime, summary, ...)`
616
- Register metadata for presigned uploads.
617
-
618
- ### Batch Operations
619
-
620
- #### `store_batch(items, session_id=None, ttl=900)`
621
- Store multiple artifacts efficiently.
622
-
623
- ### Admin Operations
624
-
625
- #### `validate_configuration()`
626
- Validate storage and session provider connectivity.
627
-
628
- #### `get_stats()`
629
- Get storage statistics and configuration info.
630
-
631
- ### Grid Operations
632
-
633
- #### `get_canonical_prefix(session_id)`
634
- Get grid path prefix for session.
635
-
636
- #### `generate_artifact_key(session_id, artifact_id)`
637
- Generate grid artifact key.
638
-
639
- ## 🛠️ Advanced Features
640
-
641
- ### Error Handling
642
- ```python
643
- from chuk_artifacts import (
644
- ArtifactNotFoundError,
645
- ArtifactExpiredError,
646
- ProviderError,
647
- SessionError,
648
- ArtifactStoreError # For session security violations
649
- )
650
-
651
- try:
652
- await store.copy_file(artifact_id, target_session_id="other_session")
653
- except ArtifactStoreError as e:
654
- print(f"Security violation: {e}")
655
- except ArtifactNotFoundError:
656
- print("Artifact not found or expired")
657
- except ProviderError as e:
658
- print(f"Storage provider error: {e}")
659
- ```
660
-
661
- ### Validation and Monitoring
662
- ```python
663
- # Validate configuration
664
- config_status = await store.validate_configuration()
665
- print(f"Storage: {config_status['storage']['status']}")
666
- print(f"Session: {config_status['session']['status']}")
667
-
668
- # Get statistics
669
- stats = await store.get_stats()
670
- print(f"Provider: {stats['storage_provider']}")
671
- print(f"Bucket: {stats['bucket']}")
672
- print(f"Sandbox: {stats['sandbox_id']}")
673
- ```
674
-
675
- ### Context Manager Usage
676
- ```python
677
- async with ArtifactStore() as store:
678
- artifact_id = await store.store(
679
- data=b"Temporary data",
680
- mime="text/plain",
681
- summary="Auto-cleanup example"
682
- )
683
- # Store automatically closed on exit
684
- ```
685
-
686
- ## 🤝 Contributing
687
-
688
- 1. Fork the repository
689
- 2. Create a feature branch: `git checkout -b feature-name`
690
- 3. Make your changes
691
- 4. Run tests: `uv run examples/mcp_test_demo.py`
692
- 5. Test session operations: `uv run examples/session_operations_demo.py`
693
- 6. Submit a pull request
694
-
695
- ## 📄 License
696
-
697
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
698
-
699
- ## 🎯 Roadmap
700
-
701
- - [x] **Session-based security** with strict isolation
702
- - [x] **Grid architecture** with federation-ready paths
703
- - [x] **Modular design** with specialized operation modules
704
- - [x] **High-performance operations** (3,000+ ops/sec)
705
- - [x] **Directory-like operations** with prefix filtering
706
- - [x] **Comprehensive testing** with real-world scenarios
707
- - [ ] Azure Blob Storage provider
708
- - [ ] Google Cloud Storage provider
709
- - [ ] Encryption at rest
710
- - [ ] Artifact versioning
711
- - [ ] Webhook notifications
712
- - [ ] Prometheus metrics export
713
- - [ ] Federation implementation
714
-
715
- ---
716
-
717
- **Made with ❤️ for secure, scalable artifact storage**
718
-
719
- *Production-ready artifact storage with mandatory session security and grid architecture*