pairit 0.1.3 → 0.1.5
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 +23 -4
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A lightweight command line utility for working with Pairit experiment configurat
|
|
|
5
5
|
- `login` — authenticate with Google OAuth (required for all hosted commands)
|
|
6
6
|
- `config lint` — run minimal validation (schema_version, initialPageId, pages)
|
|
7
7
|
- `config compile` — normalize a YAML config and emit sibling canonical JSON
|
|
8
|
-
- `config upload` — compile and upload a config through the manager service
|
|
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
11
|
- `media upload` — upload a binary asset to Cloud Storage via the manager service (uploads are public unless `--private` is passed; the backend selects the bucket unless you override with `--bucket`)
|
|
@@ -42,8 +42,9 @@ pairit login # Authenticate (required firs
|
|
|
42
42
|
|
|
43
43
|
pairit config lint path/to/config.yaml
|
|
44
44
|
pairit config compile path/to/config.yaml
|
|
45
|
-
pairit config upload configs/simple-survey-basic.yaml --
|
|
46
|
-
pairit config
|
|
45
|
+
pairit config upload configs/simple-survey-basic.yaml --config-id simple-survey-basic
|
|
46
|
+
pairit config upload configs/agent-study.yaml --config-id agent-study --openai-api-key sk-...
|
|
47
|
+
pairit config list
|
|
47
48
|
pairit config delete 2f3c4d5e...
|
|
48
49
|
|
|
49
50
|
pairit media upload assets/video.mp4 --content-type video/mp4
|
|
@@ -64,7 +65,8 @@ Add `--private` if you need to keep an object private. Use `--bucket <name>` onl
|
|
|
64
65
|
# Point to local manager server (default is http://localhost:3002)
|
|
65
66
|
export PAIRIT_API_URL=http://localhost:3002
|
|
66
67
|
|
|
67
|
-
bun run apps/manager/cli/src/index.ts config upload configs/simple-survey-basic.yaml --
|
|
68
|
+
bun run apps/manager/cli/src/index.ts config upload configs/simple-survey-basic.yaml --config-id simple-survey-basic
|
|
69
|
+
bun run apps/manager/cli/src/index.ts config upload configs/agent-study.yaml --config-id agent-study --openai-api-key sk-...
|
|
68
70
|
bun run apps/manager/cli/src/index.ts config list
|
|
69
71
|
bun run apps/manager/cli/src/index.ts config delete 2f3c4d5e... --force
|
|
70
72
|
|
|
@@ -75,6 +77,23 @@ bun run apps/manager/cli/src/index.ts media delete onboarding/logo.png --force
|
|
|
75
77
|
|
|
76
78
|
`config compile` writes `configs/simple-survey-basic.json` next to the source YAML. `config upload` defaults the config id to a 16-character base64url string derived from the SHA-256 hash of the compiled JSON (unless `--config-id` overrides it).
|
|
77
79
|
|
|
80
|
+
## Per-experiment LLM credentials
|
|
81
|
+
|
|
82
|
+
If your config uses AI agents, attach provider credentials when uploading:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pairit config upload path/to/config.yaml --config-id my-exp --openai-api-key sk-...
|
|
86
|
+
pairit config upload path/to/config.yaml --config-id my-exp --anthropic-api-key sk-ant-...
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Notes:
|
|
90
|
+
- Keys are stored per config, encrypted at rest by the manager server.
|
|
91
|
+
- Re-uploading the same `configId` without a new key keeps the previously stored key for that config.
|
|
92
|
+
- That means billing continues on the experimenter's previously uploaded key, not on a shared platform key.
|
|
93
|
+
- If an agent uses `gpt-*` and the config has no OpenAI key, the run fails.
|
|
94
|
+
- If an agent uses `claude*` and the config has no Anthropic key, the run fails.
|
|
95
|
+
- There is no global platform-key fallback for experiment agent execution.
|
|
96
|
+
|
|
78
97
|
`data export` creates three files in the output directory:
|
|
79
98
|
- `{configId}-sessions.{format}` — session ID, user_state fields (flattened), timestamps, status
|
|
80
99
|
- `{configId}-events.{format}` — session ID, event type, component info, payload, timestamps
|
package/dist/index.js
CHANGED
|
@@ -10111,7 +10111,7 @@ async function loadKeytar() {
|
|
|
10111
10111
|
|
|
10112
10112
|
// src/index.ts
|
|
10113
10113
|
var program2 = new Command;
|
|
10114
|
-
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.1.
|
|
10114
|
+
program2.name("pairit").description("CLI for Pairit experiment configs").version("0.1.3");
|
|
10115
10115
|
program2.command("login").description("Login to Pairit Manager").action(async () => {
|
|
10116
10116
|
try {
|
|
10117
10117
|
await login();
|
|
@@ -10146,7 +10146,7 @@ configCommand.command("compile").argument("<config>", "Path to YAML config").des
|
|
|
10146
10146
|
process9.exitCode = 1;
|
|
10147
10147
|
}
|
|
10148
10148
|
});
|
|
10149
|
-
configCommand.command("upload").argument("<config>", "Path to YAML config").option("--config-id <configId>", "Config id (defaults to hash)").option("--metadata <json>", "Optional metadata JSON string").description("Compile and upload config via Pairit Functions").action(async (configPath, options) => {
|
|
10149
|
+
configCommand.command("upload").argument("<config>", "Path to YAML config").option("--config-id <configId>", "Config id (defaults to hash)").option("--metadata <json>", "Optional metadata JSON string").option("--openai-api-key <key>", "OpenAI API key for this experiment").option("--anthropic-api-key <key>", "Anthropic API key for this experiment").description("Compile and upload config via Pairit Functions").action(async (configPath, options) => {
|
|
10150
10150
|
try {
|
|
10151
10151
|
const { payload, checksum } = await buildUploadPayload(configPath, options);
|
|
10152
10152
|
const response = await callFunctions("/configs/upload", {
|
|
@@ -10357,12 +10357,19 @@ async function buildUploadPayload(configPath, options) {
|
|
|
10357
10357
|
if (!metadata.originalFilename) {
|
|
10358
10358
|
metadata.originalFilename = path2.basename(configPath);
|
|
10359
10359
|
}
|
|
10360
|
+
const llmCredentials = {
|
|
10361
|
+
...options.openaiApiKey && { openaiApiKey: options.openaiApiKey },
|
|
10362
|
+
...options.anthropicApiKey && {
|
|
10363
|
+
anthropicApiKey: options.anthropicApiKey
|
|
10364
|
+
}
|
|
10365
|
+
};
|
|
10360
10366
|
return {
|
|
10361
10367
|
payload: {
|
|
10362
10368
|
configId,
|
|
10363
10369
|
checksum,
|
|
10364
10370
|
metadata: metadata ?? null,
|
|
10365
10371
|
config: parsed,
|
|
10372
|
+
...Object.keys(llmCredentials).length > 0 && { llmCredentials },
|
|
10366
10373
|
allowRetake,
|
|
10367
10374
|
...requireAuth !== undefined && { requireAuth }
|
|
10368
10375
|
},
|