pairit 0.3.7 → 0.3.8
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 +4 -4
- package/dist/index.js +12 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@ A lightweight command line utility for working with Pairit experiment configurat
|
|
|
8
8
|
- `config upload` — compile and upload a config through the manager service, optionally with per-experiment LLM provider keys
|
|
9
9
|
- `config list` — list configs stored via the manager service
|
|
10
10
|
- `config delete` — delete a stored config
|
|
11
|
-
- `media upload` — upload a binary asset to Cloud Storage via the manager service
|
|
12
|
-
- `media list` — list media objects
|
|
13
|
-
- `media delete` — delete
|
|
11
|
+
- `media upload` — upload a binary asset to Cloud Storage via the manager service. It goes in your own folder (`<your user id>/<name>`) and returns a stable public URL. Anyone with the URL can read it
|
|
12
|
+
- `media list` — list your media objects (admins see everyone's)
|
|
13
|
+
- `media delete` — delete one of your media objects (admins can delete any)
|
|
14
14
|
- `data export` — export sessions, events, and chat messages for a config as CSV/JSON/JSONL
|
|
15
15
|
- `admin add-user` / `admin remove-user` / `admin list-users` — manage the manager allowlist (admin role required)
|
|
16
16
|
- `admin activity` — show studies with recent sessions, live group studies first (admin role required)
|
|
@@ -59,7 +59,7 @@ pairit data export <configId> --format jsonl # Export as JSONL
|
|
|
59
59
|
pairit data export <configId> --out ./exports # Export to specific directory
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Media is public: anyone with an object's URL can read it, so do not upload sensitive files. `--private` is no longer supported. Uploads go under your own folder, so `media upload intro.mp4 --object onboarding/intro.mp4` stores `<your user id>/onboarding/intro.mp4`. `media list` and `media delete` work only on your own objects. Media uploaded before per-researcher folders keeps its URL, and only an admin can delete it. Allowed content types are image, audio, video, font, PDF, JSON, plain text, CSV, and WebVTT. Other files are stored as downloads (`application/octet-stream`). Files above 5 MiB use a signed upload, up to 500 MiB.
|
|
63
63
|
|
|
64
64
|
### Example
|
|
65
65
|
|
package/dist/index.js
CHANGED
|
@@ -10350,7 +10350,7 @@ function lintEndRedirectUrls(config) {
|
|
|
10350
10350
|
|
|
10351
10351
|
// src/index.ts
|
|
10352
10352
|
var program2 = new Command;
|
|
10353
|
-
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.
|
|
10353
|
+
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.3.8").option("--env <name>", "Target environment: staging or production", (value) => {
|
|
10354
10354
|
try {
|
|
10355
10355
|
return parseEnvName(value);
|
|
10356
10356
|
} catch (error) {
|
|
@@ -10501,17 +10501,19 @@ configCommand.command("delete").argument("<configId>", "Config id to delete").op
|
|
|
10501
10501
|
}
|
|
10502
10502
|
});
|
|
10503
10503
|
var mediaCommand = program2.command("media").description("Manage Cloud Storage media assets");
|
|
10504
|
-
mediaCommand.command("upload").argument("<file>", "Path to the media file to upload").option("--bucket <bucket>", "Destination Google Cloud Storage bucket (optional override)").option("--object <object>", "Destination object path (defaults to derived hash)").option("--content-type <contentType>", "Content type to set on the object").option("--metadata <json>", "Optional metadata JSON string").
|
|
10504
|
+
mediaCommand.command("upload").argument("<file>", "Path to the media file to upload").option("--bucket <bucket>", "Destination Google Cloud Storage bucket (optional override)").option("--object <object>", "Destination object path (defaults to derived hash)").option("--content-type <contentType>", "Content type to set on the object").option("--metadata <json>", "Optional metadata JSON string").addOption(new Option("--private").hideHelp()).description("Upload a media asset. Anyone with its URL can read it; it is stored under your own folder.").action(async (filePath, options) => {
|
|
10505
10505
|
try {
|
|
10506
|
-
|
|
10506
|
+
if (options.private) {
|
|
10507
|
+
throw new Error("--private is no longer supported. Anyone with a media object's URL can read it, so do not upload sensitive files.");
|
|
10508
|
+
}
|
|
10507
10509
|
const { object, checksum, response } = await uploadMedia(filePath, {
|
|
10508
10510
|
bucket: options.bucket,
|
|
10509
10511
|
object: options.object,
|
|
10510
10512
|
metadata: options.metadata,
|
|
10511
|
-
contentType: options.contentType
|
|
10512
|
-
public: isPublic
|
|
10513
|
+
contentType: options.contentType
|
|
10513
10514
|
});
|
|
10514
|
-
|
|
10515
|
+
const stored = response?.object ?? object;
|
|
10516
|
+
console.log(`✓ Uploaded media ${stored} (${checksum})`);
|
|
10515
10517
|
if (typeof response !== "undefined") {
|
|
10516
10518
|
console.log(JSON.stringify(response, null, 2));
|
|
10517
10519
|
}
|
|
@@ -10541,7 +10543,7 @@ mediaCommand.command("list").option("--bucket <bucket>", "Bucket to list from (o
|
|
|
10541
10543
|
reportCliError("Media list failed", error);
|
|
10542
10544
|
}
|
|
10543
10545
|
});
|
|
10544
|
-
mediaCommand.command("delete").argument("<object>", "Object
|
|
10546
|
+
mediaCommand.command("delete").argument("<object>", "Object to delete: a name in your folder, or the full name from media list").option("--force", "Skip confirmation").description("Delete a media object via Pairit Functions").action(async (object, options) => {
|
|
10545
10547
|
try {
|
|
10546
10548
|
if (!options.force) {
|
|
10547
10549
|
const confirmed = await promptConfirm(`Delete media ${object}? (y/N)`);
|
|
@@ -10787,7 +10789,6 @@ async function uploadMedia(filePath, options) {
|
|
|
10787
10789
|
const checksum = hashBuffer.toString("hex");
|
|
10788
10790
|
const defaultObject = `${toBase64Url(hashBuffer.subarray(0, 12))}${path3.extname(resolved)}`;
|
|
10789
10791
|
const object = options.object ?? defaultObject;
|
|
10790
|
-
const shouldBePublic = typeof options.public === "boolean" ? options.public : true;
|
|
10791
10792
|
const maxInlineBytes = getInlineMediaLimit();
|
|
10792
10793
|
let metadata;
|
|
10793
10794
|
if (options.metadata) {
|
|
@@ -10801,8 +10802,7 @@ async function uploadMedia(filePath, options) {
|
|
|
10801
10802
|
const signedResponse = await requestSignedUpload({
|
|
10802
10803
|
bucket: options.bucket,
|
|
10803
10804
|
object,
|
|
10804
|
-
contentType: options.contentType
|
|
10805
|
-
public: shouldBePublic
|
|
10805
|
+
contentType: options.contentType
|
|
10806
10806
|
});
|
|
10807
10807
|
await uploadViaSignedUrl(fileBuffer, signedResponse);
|
|
10808
10808
|
return { object, checksum, response: signedResponse };
|
|
@@ -10813,8 +10813,7 @@ async function uploadMedia(filePath, options) {
|
|
|
10813
10813
|
checksum,
|
|
10814
10814
|
data: fileBuffer.toString("base64"),
|
|
10815
10815
|
contentType: options.contentType ?? null,
|
|
10816
|
-
metadata: metadata ?? null
|
|
10817
|
-
public: shouldBePublic
|
|
10816
|
+
metadata: metadata ?? null
|
|
10818
10817
|
};
|
|
10819
10818
|
const response = await callFunctions("/media/upload", {
|
|
10820
10819
|
method: "POST",
|
|
@@ -10829,8 +10828,7 @@ async function requestSignedUpload(input) {
|
|
|
10829
10828
|
body: JSON.stringify({
|
|
10830
10829
|
bucket: input.bucket,
|
|
10831
10830
|
object: input.object,
|
|
10832
|
-
contentType: input.contentType ?? null
|
|
10833
|
-
public: input.public
|
|
10831
|
+
contentType: input.contentType ?? null
|
|
10834
10832
|
}),
|
|
10835
10833
|
headers: { "Content-Type": "application/json" }
|
|
10836
10834
|
});
|