@re-cinq/floor-pipeline 0.1.1 → 0.1.4
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/cli.js +0 -0
- package/dist/floor.d.ts +2 -5
- package/dist/floor.js +14 -22
- package/package.json +2 -1
package/dist/cli.js
CHANGED
|
File without changes
|
package/dist/floor.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { type Asking } from "@re-cinq/floor-client";
|
|
1
2
|
export interface Floor {
|
|
2
3
|
url: string;
|
|
3
4
|
token: string;
|
|
4
5
|
}
|
|
5
|
-
export
|
|
6
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
7
|
-
path: string;
|
|
8
|
-
body?: unknown;
|
|
9
|
-
}
|
|
6
|
+
export type { Asking };
|
|
10
7
|
/** Null for what the floor does not have. Anything else it refuses is thrown, in the floor's own words. */
|
|
11
8
|
export declare function asked<Answer>(floor: Floor, asking: Asking): Promise<Answer | null>;
|
|
12
9
|
export declare function blobStored(floor: Floor, bytes: Buffer): Promise<string>;
|
package/dist/floor.js
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
// The floor, as this tool reaches it:
|
|
2
|
-
|
|
1
|
+
// The floor, as this tool reaches it: the shared client, under the names this tool's own callers already use.
|
|
2
|
+
import { asked as askedOfFloor, createFloorClient, reach, serviceToken } from "@re-cinq/floor-client";
|
|
3
3
|
const HTTP_NOT_FOUND = 404;
|
|
4
4
|
/** Null for what the floor does not have. Anything else it refuses is thrown, in the floor's own words. */
|
|
5
5
|
export async function asked(floor, asking) {
|
|
6
|
-
|
|
7
|
-
if (response.status === HTTP_NOT_FOUND)
|
|
8
|
-
return null;
|
|
9
|
-
const answer = await response.text();
|
|
10
|
-
return answer ? JSON.parse(answer) : null;
|
|
6
|
+
return askedOfFloor(reachable(floor), asking, [HTTP_NOT_FOUND]);
|
|
11
7
|
}
|
|
12
8
|
export async function blobStored(floor, bytes) {
|
|
13
|
-
const
|
|
14
|
-
const stored = (await response.json());
|
|
9
|
+
const stored = await askedOfFloor(reachable(floor), { method: "POST", path: "/blobs", bytes: { content: new Uint8Array(bytes), contentType: "application/octet-stream" } });
|
|
15
10
|
return stored.hash;
|
|
16
11
|
}
|
|
12
|
+
// A line names its files by hash, so a hash the floor does not hold is a pipeline that cannot be read, not an absence to carry on past.
|
|
17
13
|
export async function blobRead(floor, hash) {
|
|
18
|
-
const
|
|
19
|
-
|
|
14
|
+
const { blobs } = clientFor(floor);
|
|
15
|
+
const stored = await blobs.get(hash);
|
|
16
|
+
if (!stored)
|
|
20
17
|
throw new Error(`the floor has no blob "${hash}", which a line names as its file`);
|
|
21
|
-
return Buffer.from(
|
|
18
|
+
return Buffer.from(stored.bytes);
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
|
|
29
|
-
});
|
|
30
|
-
if (response.ok || response.status === HTTP_NOT_FOUND)
|
|
31
|
-
return response;
|
|
32
|
-
throw new Error(`the floor refused ${asking.method} ${asking.path} with ${response.status}: ${await response.text()}`);
|
|
20
|
+
function reachable(floor) {
|
|
21
|
+
return reach(floor.url, serviceToken(floor.token));
|
|
22
|
+
}
|
|
23
|
+
function clientFor(floor) {
|
|
24
|
+
return createFloorClient({ url: floor.url, token: serviceToken(floor.token) });
|
|
33
25
|
}
|
|
34
26
|
//# sourceMappingURL=floor.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@re-cinq/floor-pipeline",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A floor's pipeline as one YAML file: an assembly line with its stations, its agent definitions and their prompts, its files and its schedules. Exports one from a floor, imports one into a floor, and applies a folder of them in order, each once. It speaks the floor's HTTP API and nothing else.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"typecheck": "tsc --noEmit"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
+
"@re-cinq/floor-client": "0.1.4",
|
|
52
53
|
"yaml": "^2.7.0",
|
|
53
54
|
"zod": "^4.5.4"
|
|
54
55
|
},
|