@fungi.computer/darkroom 0.11.5 → 0.11.7
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 +49 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
# Darkroom
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
another generation.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
Darkroom generates an image, keeps the result, and lets you retry a failed save
|
|
4
|
+
without paying for another generation.
|
|
5
|
+
|
|
6
|
+
```mermaid
|
|
7
|
+
flowchart LR
|
|
8
|
+
App[Your host] --> Darkroom
|
|
9
|
+
Darkroom -->|generate| Provider[Your model provider]
|
|
10
|
+
Darkroom -->|save, retry| Destination[Your file destination]
|
|
11
|
+
Darkroom --> DO[(Operation record)]
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
The root catalog and `server` work without a Workers runtime. The `cloudflare`
|
|
15
|
-
adapter runs on workerd, celld and Cloudflare with SQLite Durable Objects and
|
|
16
|
-
R2.
|
|
17
|
-
|
|
18
14
|
## Quick start
|
|
19
15
|
|
|
20
16
|
Save this as `worker.ts`. TypeScript hosts use
|
|
@@ -61,6 +57,9 @@ export default {
|
|
|
61
57
|
write: async (path, bytes) => {
|
|
62
58
|
await env.OUTPUTS.put(path, bytes);
|
|
63
59
|
},
|
|
60
|
+
// This demo never deletes the saved file. See "Recover or erase
|
|
61
|
+
// retained results" for a destination that can.
|
|
62
|
+
remove: async () => "kept",
|
|
64
63
|
},
|
|
65
64
|
});
|
|
66
65
|
if (new URL(request.url).pathname === "/catalog")
|
|
@@ -104,6 +103,43 @@ Repeat the same request to replay its saved result. Change the input with the
|
|
|
104
103
|
same ID and the service returns 409. This example admits one local owner. Add
|
|
105
104
|
your host's authentication and destination authorization before serving others.
|
|
106
105
|
|
|
106
|
+
## Common tasks
|
|
107
|
+
|
|
108
|
+
### Generate and save an image
|
|
109
|
+
|
|
110
|
+
The Quick start uses a fixed one-pixel provider so you need no model account.
|
|
111
|
+
|
|
112
|
+
### Use your own provider and models
|
|
113
|
+
|
|
114
|
+
See [Bring your own provider and models](#bring-your-own-provider-and-models).
|
|
115
|
+
|
|
116
|
+
### Store results in your own bucket
|
|
117
|
+
|
|
118
|
+
See [Use your own R2 bucket](#use-your-own-r2-bucket).
|
|
119
|
+
|
|
120
|
+
### Recover or erase kept results
|
|
121
|
+
|
|
122
|
+
See [Recover or erase retained results](#recover-or-erase-retained-results).
|
|
123
|
+
|
|
124
|
+
## Reference
|
|
125
|
+
|
|
126
|
+
### Overview
|
|
127
|
+
|
|
128
|
+
Generate an image, keep the output, and retry a failed save without paying for
|
|
129
|
+
another generation. Your host supplies identity, permissions, a provider and a
|
|
130
|
+
place to put the file.
|
|
131
|
+
|
|
132
|
+
## Install
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
npm install @fungi.computer/darkroom
|
|
136
|
+
npm install --save-dev wrangler @cloudflare/workers-types
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
The root catalog and `server` work without a Workers runtime. The `cloudflare`
|
|
140
|
+
adapter runs on workerd, celld and Cloudflare with SQLite Durable Objects and
|
|
141
|
+
R2.
|
|
142
|
+
|
|
107
143
|
## Core concepts
|
|
108
144
|
|
|
109
145
|
The host chooses `actorId`, `namespace`, `owner` and `destinationId`. Request
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/darkroom",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.7",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Media generation, durable output retention and provenance with host-owned authority and billing",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"exifreader": "4.46.0",
|
|
61
61
|
"@fungi.computer/ts-webp": "0.1.6",
|
|
62
62
|
"@xmldom/xmldom": "0.9.12",
|
|
63
|
-
"@fungi.computer/agar": "0.
|
|
63
|
+
"@fungi.computer/agar": "0.22.1",
|
|
64
64
|
"@fungi.computer/capnweb": "0.12.0-fungi.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|