plures 1.7.1 → 1.9.1

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 CHANGED
@@ -48,6 +48,7 @@ if (event.type === "task.completed" && event.data.result?.agreement === 1) {
48
48
  - `plures.tasks.retrieve(id)`, `plures.tasks.list({ status?, limit?, starting_after?, app? })`, `plures.tasks.cancel(id)`
49
49
  - `new Plures(key, { app: "support-agent" })` or `PLURES_APP`: send everything to one of your apps. `plures.apps.list()`, `.create({ name, id? })`, `.retrieve(id)`, `.update(id, { name?, id?, default? })`, `.del(id)`. Each app keeps its own tasks, ledger view, map and quality.
50
50
  - `plures.maps.guide()`, `.retrieve(app)`, `.upload(app, map)`, `.setCheckpoint(app, id, status)`: the agent map, where your agent needs a person. Or run `npx plures map` in your repo: your own coding agent reads the code and only the map is sent.
51
+ - `plures.maps.createKey(app, { label? })`, `.keys(app)`, `.revokeKey(app, id)`: map keys for CI, which can only read and upload that app's map. `.workflow(app, branch?)` returns the GitHub Action that maps on every push; `npx plures map workflow` writes it to `.github/workflows/plures-map.yml`. Or use **Map with GitHub** on the app's map page and Plures opens the pull request for you. `plures.maps.startRun(app)` and `.runs(app)`: in CI with no Claude key, `npx plures map` starts a run where Plures runs Claude (first map free, then Claude's cost plus 30%, at most $5).
51
52
  - `plures.quality.sample({ rubric, output, input? })`: send every output; a share is graded by people against the rubric, with personal details taken out first. `plures.quality.rubrics.create({ name, question, options, sample_rate })`, `.retrieve(name)` (score by day, this week against the four before, drift), `.list()`, `.update()`, `.del()`. `plures.quality.compare({ release, input, a, b })` and `plures.quality.release(name)` for blind release checks. `plures.quality.export(rubric)` returns graded samples for evals or fine tuning.
52
53
  - `plures.testMix.set({ unanimous: 70, split: 20, tie: 5, expired: 5 })`, `.get()`, `.clear()`: with a test key, makes a share of test tasks split, tie or expire at random so you can test routing to your team without changing your agent. A task can override it with `metadata.test_mix`, and `metadata.test_outcome` beats both.
53
54
  - `plures.routing.get()`, `plures.routing.set({ groups, rules, team })`: named teams of your own people and rules by category, like `{ groups: [{ name: "Finance", emails: ["ap@acme.com"] }], rules: [{ category: "refunds", route: "team", group: "Finance" }] }`. What you send replaces what's there; the rest stays.
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var VERSION = "1.7.1";
2
+ var VERSION = "1.9.1";
3
3
  var PluresError = class extends Error {
4
4
  constructor(message, status, type) {
5
5
  super(message);
@@ -101,7 +101,19 @@ var Plures = class {
101
101
  retrieve: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map`),
102
102
  /** Uploads a new version. Checks you already added or dismissed keep that. */
103
103
  upload: (app, map) => this.req("PUT", `/api/v1/apps/${encodeURIComponent(app)}/map`, map),
104
- setCheckpoint: (app, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app)}/map/checkpoints/${encodeURIComponent(id)}`, { status })
104
+ setCheckpoint: (app, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app)}/map/checkpoints/${encodeURIComponent(id)}`, { status }),
105
+ /** A key that can only read and upload this app's map, for CI. The key is in the response once. */
106
+ createKey: (app, opts = {}) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app)}/map_keys`, opts),
107
+ keys: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map_keys`),
108
+ revokeKey: (app, id) => this.req("DELETE", `/api/v1/apps/${encodeURIComponent(app)}/map_keys/${encodeURIComponent(id)}`),
109
+ /** Starts a map run where Plures runs Claude (CI with no Anthropic key). npx plures map does this. */
110
+ startRun: (app) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app)}/map_runs`, {}),
111
+ runs: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map_runs`),
112
+ /** The GitHub Actions workflow that maps a repo on every push to its main branch. */
113
+ workflow: async (app, branch = "main") => {
114
+ const r = await fetch(`${this.base}/api/v1/map_workflow?app=${encodeURIComponent(app)}&branch=${encodeURIComponent(branch)}`);
115
+ return r.text();
116
+ }
105
117
  };
106
118
  /**
107
119
  * Quality: people grade a sample of your agent's outputs against a rubric, so you see drift
package/dist/cli.cjs CHANGED
@@ -6,7 +6,7 @@ var import_node_child_process = require("child_process");
6
6
  var import_node_fs = require("fs");
7
7
 
8
8
  // src/index.ts
9
- var VERSION = "1.7.1";
9
+ var VERSION = "1.9.1";
10
10
  var PluresError = class extends Error {
11
11
  constructor(message, status, type) {
12
12
  super(message);
@@ -108,7 +108,19 @@ var Plures = class {
108
108
  retrieve: (app2) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app2)}/map`),
109
109
  /** Uploads a new version. Checks you already added or dismissed keep that. */
110
110
  upload: (app2, map2) => this.req("PUT", `/api/v1/apps/${encodeURIComponent(app2)}/map`, map2),
111
- setCheckpoint: (app2, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app2)}/map/checkpoints/${encodeURIComponent(id)}`, { status })
111
+ setCheckpoint: (app2, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app2)}/map/checkpoints/${encodeURIComponent(id)}`, { status }),
112
+ /** A key that can only read and upload this app's map, for CI. The key is in the response once. */
113
+ createKey: (app2, opts = {}) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app2)}/map_keys`, opts),
114
+ keys: (app2) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app2)}/map_keys`),
115
+ revokeKey: (app2, id) => this.req("DELETE", `/api/v1/apps/${encodeURIComponent(app2)}/map_keys/${encodeURIComponent(id)}`),
116
+ /** Starts a map run where Plures runs Claude (CI with no Anthropic key). npx plures map does this. */
117
+ startRun: (app2) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app2)}/map_runs`, {}),
118
+ runs: (app2) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app2)}/map_runs`),
119
+ /** The GitHub Actions workflow that maps a repo on every push to its main branch. */
120
+ workflow: async (app2, branch2 = "main") => {
121
+ const r = await fetch(`${this.base}/api/v1/map_workflow?app=${encodeURIComponent(app2)}&branch=${encodeURIComponent(branch2)}`);
122
+ return r.text();
123
+ }
112
124
  };
113
125
  /**
114
126
  * Quality: people grade a sample of your agent's outputs against a rubric, so you see drift
@@ -181,6 +193,7 @@ var flag = (name) => {
181
193
  argv.splice(i, 2);
182
194
  return v;
183
195
  };
196
+ var branch = flag("branch");
184
197
  var app = flag("app") ?? process.env.PLURES_APP ?? "default";
185
198
  var key = flag("key") ?? process.env.PLURES_API_KEY;
186
199
  var base = flag("base-url") ?? process.env.PLURES_BASE_URL ?? "https://plures.si";
@@ -198,7 +211,7 @@ function die(msg) {
198
211
  }
199
212
  function client() {
200
213
  if (!key) die("Set PLURES_API_KEY (a free pk_test_ key works), or pass --key. Get one at https://plures.si/?for=developers#join");
201
- return new Plures(key, { baseUrl: base, app, userAgent: `plures-cli/${VERSION}` });
214
+ return new Plures(key, { baseUrl: base, app, userAgent: `plures-cli/${VERSION}${process.env.GITHUB_ACTIONS ? " github-actions" : ""}` });
202
215
  }
203
216
  async function upload(file) {
204
217
  if (!(0, import_node_fs.existsSync)(file)) die(`No ${file} here. Run npx plures map to make one, or pass the file's path.`);
@@ -252,19 +265,48 @@ With plures-mcp connected, just ask: ${cyan("Map this app for Plures")}`);
252
265
  return;
253
266
  }
254
267
  const before = (0, import_node_fs.existsSync)(FILE) ? (0, import_node_fs.statSync)(FILE).mtimeMs : 0;
255
- console.log(`Reading this repo on your machine with Claude Code. ${dim("Only the map leaves it.")}
268
+ const childEnv = { ...process.env };
269
+ const ownClaude = Boolean(process.env.ANTHROPIC_API_KEY || process.env.CLAUDE_CODE_OAUTH_TOKEN || process.env.ANTHROPIC_AUTH_TOKEN);
270
+ if (!ownClaude && (process.env.CI || argv.includes("--plures-claude"))) {
271
+ let run;
272
+ try {
273
+ run = await client().maps.startRun(app);
274
+ } catch (e) {
275
+ die(e instanceof PluresError ? e.message : String(e));
276
+ }
277
+ childEnv.ANTHROPIC_BASE_URL = run.base_url;
278
+ childEnv.ANTHROPIC_API_KEY = run.token;
279
+ console.log(dim(run.free ? "Plures is mapping this repo. Your first map is free." : `Plures is mapping this repo, at most $${(run.max_cents / 100).toFixed(2)} from your credit.`));
280
+ }
281
+ console.log(`Reading this repo ${process.env.CI ? "on this runner" : "on your machine"} with Claude Code. ${dim("Only the map is sent to Plures.")}
256
282
  `);
257
283
  const prompt = `${guide}
258
284
 
259
285
  Write the map to ${FILE} in the current directory now. Read the code; don't run it or change anything else.`;
260
286
  const code = await new Promise((resolve) => {
261
- const p = (0, import_node_child_process.spawn)("claude", ["-p", prompt, "--allowedTools", "Read,Grep,Glob,Write,Bash(git rev-parse:*),Bash(git remote:*)"], { stdio: ["ignore", "inherit", "inherit"] });
287
+ const p = (0, import_node_child_process.spawn)("claude", ["-p", prompt, "--allowedTools", "Read,Grep,Glob,Write,Bash(git rev-parse:*),Bash(git remote:*)"], { stdio: ["ignore", "inherit", "inherit"], env: childEnv });
262
288
  p.on("close", (n) => resolve(n ?? 1));
263
289
  p.on("error", () => resolve(1));
264
290
  });
265
291
  if (code !== 0 || !(0, import_node_fs.existsSync)(FILE) || (0, import_node_fs.statSync)(FILE).mtimeMs === before) die(`Claude Code didn't write ${FILE}. Ask it directly, then run npx plures map upload.`);
266
292
  await upload(FILE);
267
293
  }
294
+ async function workflow() {
295
+ const def = (0, import_node_child_process.spawnSync)("git", ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"], { encoding: "utf8" }).stdout?.trim().replace(/^origin\//, "");
296
+ const b = branch ?? (def || "main");
297
+ const r = await fetch(`${base}/api/v1/map_workflow?app=${encodeURIComponent(app)}&branch=${encodeURIComponent(b)}`).catch(() => null);
298
+ if (!r?.ok) die("Couldn't reach Plures for the workflow. Check your connection.");
299
+ const path = ".github/workflows/plures-map.yml";
300
+ (0, import_node_fs.mkdirSync)(".github/workflows", { recursive: true });
301
+ (0, import_node_fs.writeFileSync)(path, await r.text());
302
+ console.log(`${bold("Wrote " + path)}: maps this repo on every push to ${b}.
303
+
304
+ Then add two repository secrets (Settings, Secrets and variables, Actions):
305
+ ${cyan("PLURES_MAP_KEY")} a map key: ${dim(`${base}/dashboard/apps/${app}/map`)} or ${dim("POST /api/v1/apps/" + app + "/map_keys")}
306
+ ${cyan("ANTHROPIC_API_KEY")} or ${cyan("CLAUDE_CODE_OAUTH_TOKEN")} from ${dim("claude setup-token")}
307
+
308
+ Or let Plures do all of this: ${bold("Map with GitHub")} on the app's map page.`);
309
+ }
268
310
  async function main() {
269
311
  const [cmd, sub, arg] = argv;
270
312
  if (cmd !== "map") {
@@ -273,12 +315,14 @@ async function main() {
273
315
  npx plures map [--app <id>] map this repo's agent and upload it
274
316
  npx plures map upload [file] upload ${FILE}
275
317
  npx plures map guide print the steps for any coding agent
318
+ npx plures map workflow add a GitHub Action that maps on every push
276
319
 
277
320
  Docs: https://plures.si/docs`);
278
321
  return;
279
322
  }
280
323
  if (sub === "upload") return upload(arg ?? FILE);
281
324
  if (sub === "guide") return void console.log(await (await fetch(`${base}/api/v1/map_guide`)).text());
325
+ if (sub === "workflow") return workflow();
282
326
  return map();
283
327
  }
284
328
  main().catch((e) => die(String(e?.message ?? e)));
package/dist/cli.js CHANGED
@@ -3,11 +3,11 @@ import {
3
3
  Plures,
4
4
  PluresError,
5
5
  VERSION
6
- } from "./chunk-N4GCKRA6.js";
6
+ } from "./chunk-23ZYPCPM.js";
7
7
 
8
8
  // src/cli.ts
9
9
  import { spawnSync, spawn } from "child_process";
10
- import { existsSync, readFileSync, statSync } from "fs";
10
+ import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
11
11
  var argv = process.argv.slice(2);
12
12
  var flag = (name) => {
13
13
  const i = argv.indexOf(`--${name}`);
@@ -16,6 +16,7 @@ var flag = (name) => {
16
16
  argv.splice(i, 2);
17
17
  return v;
18
18
  };
19
+ var branch = flag("branch");
19
20
  var app = flag("app") ?? process.env.PLURES_APP ?? "default";
20
21
  var key = flag("key") ?? process.env.PLURES_API_KEY;
21
22
  var base = flag("base-url") ?? process.env.PLURES_BASE_URL ?? "https://plures.si";
@@ -33,7 +34,7 @@ function die(msg) {
33
34
  }
34
35
  function client() {
35
36
  if (!key) die("Set PLURES_API_KEY (a free pk_test_ key works), or pass --key. Get one at https://plures.si/?for=developers#join");
36
- return new Plures(key, { baseUrl: base, app, userAgent: `plures-cli/${VERSION}` });
37
+ return new Plures(key, { baseUrl: base, app, userAgent: `plures-cli/${VERSION}${process.env.GITHUB_ACTIONS ? " github-actions" : ""}` });
37
38
  }
38
39
  async function upload(file) {
39
40
  if (!existsSync(file)) die(`No ${file} here. Run npx plures map to make one, or pass the file's path.`);
@@ -87,19 +88,48 @@ With plures-mcp connected, just ask: ${cyan("Map this app for Plures")}`);
87
88
  return;
88
89
  }
89
90
  const before = existsSync(FILE) ? statSync(FILE).mtimeMs : 0;
90
- console.log(`Reading this repo on your machine with Claude Code. ${dim("Only the map leaves it.")}
91
+ const childEnv = { ...process.env };
92
+ const ownClaude = Boolean(process.env.ANTHROPIC_API_KEY || process.env.CLAUDE_CODE_OAUTH_TOKEN || process.env.ANTHROPIC_AUTH_TOKEN);
93
+ if (!ownClaude && (process.env.CI || argv.includes("--plures-claude"))) {
94
+ let run;
95
+ try {
96
+ run = await client().maps.startRun(app);
97
+ } catch (e) {
98
+ die(e instanceof PluresError ? e.message : String(e));
99
+ }
100
+ childEnv.ANTHROPIC_BASE_URL = run.base_url;
101
+ childEnv.ANTHROPIC_API_KEY = run.token;
102
+ console.log(dim(run.free ? "Plures is mapping this repo. Your first map is free." : `Plures is mapping this repo, at most $${(run.max_cents / 100).toFixed(2)} from your credit.`));
103
+ }
104
+ console.log(`Reading this repo ${process.env.CI ? "on this runner" : "on your machine"} with Claude Code. ${dim("Only the map is sent to Plures.")}
91
105
  `);
92
106
  const prompt = `${guide}
93
107
 
94
108
  Write the map to ${FILE} in the current directory now. Read the code; don't run it or change anything else.`;
95
109
  const code = await new Promise((resolve) => {
96
- const p = spawn("claude", ["-p", prompt, "--allowedTools", "Read,Grep,Glob,Write,Bash(git rev-parse:*),Bash(git remote:*)"], { stdio: ["ignore", "inherit", "inherit"] });
110
+ const p = spawn("claude", ["-p", prompt, "--allowedTools", "Read,Grep,Glob,Write,Bash(git rev-parse:*),Bash(git remote:*)"], { stdio: ["ignore", "inherit", "inherit"], env: childEnv });
97
111
  p.on("close", (n) => resolve(n ?? 1));
98
112
  p.on("error", () => resolve(1));
99
113
  });
100
114
  if (code !== 0 || !existsSync(FILE) || statSync(FILE).mtimeMs === before) die(`Claude Code didn't write ${FILE}. Ask it directly, then run npx plures map upload.`);
101
115
  await upload(FILE);
102
116
  }
117
+ async function workflow() {
118
+ const def = spawnSync("git", ["symbolic-ref", "--short", "refs/remotes/origin/HEAD"], { encoding: "utf8" }).stdout?.trim().replace(/^origin\//, "");
119
+ const b = branch ?? (def || "main");
120
+ const r = await fetch(`${base}/api/v1/map_workflow?app=${encodeURIComponent(app)}&branch=${encodeURIComponent(b)}`).catch(() => null);
121
+ if (!r?.ok) die("Couldn't reach Plures for the workflow. Check your connection.");
122
+ const path = ".github/workflows/plures-map.yml";
123
+ mkdirSync(".github/workflows", { recursive: true });
124
+ writeFileSync(path, await r.text());
125
+ console.log(`${bold("Wrote " + path)}: maps this repo on every push to ${b}.
126
+
127
+ Then add two repository secrets (Settings, Secrets and variables, Actions):
128
+ ${cyan("PLURES_MAP_KEY")} a map key: ${dim(`${base}/dashboard/apps/${app}/map`)} or ${dim("POST /api/v1/apps/" + app + "/map_keys")}
129
+ ${cyan("ANTHROPIC_API_KEY")} or ${cyan("CLAUDE_CODE_OAUTH_TOKEN")} from ${dim("claude setup-token")}
130
+
131
+ Or let Plures do all of this: ${bold("Map with GitHub")} on the app's map page.`);
132
+ }
103
133
  async function main() {
104
134
  const [cmd, sub, arg] = argv;
105
135
  if (cmd !== "map") {
@@ -108,12 +138,14 @@ async function main() {
108
138
  npx plures map [--app <id>] map this repo's agent and upload it
109
139
  npx plures map upload [file] upload ${FILE}
110
140
  npx plures map guide print the steps for any coding agent
141
+ npx plures map workflow add a GitHub Action that maps on every push
111
142
 
112
143
  Docs: https://plures.si/docs`);
113
144
  return;
114
145
  }
115
146
  if (sub === "upload") return upload(arg ?? FILE);
116
147
  if (sub === "guide") return void console.log(await (await fetch(`${base}/api/v1/map_guide`)).text());
148
+ if (sub === "workflow") return workflow();
117
149
  return map();
118
150
  }
119
151
  main().catch((e) => die(String(e?.message ?? e)));
package/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@ __export(index_exports, {
26
26
  default: () => index_default
27
27
  });
28
28
  module.exports = __toCommonJS(index_exports);
29
- var VERSION = "1.7.1";
29
+ var VERSION = "1.9.1";
30
30
  var PluresError = class extends Error {
31
31
  constructor(message, status, type) {
32
32
  super(message);
@@ -128,7 +128,19 @@ var Plures = class {
128
128
  retrieve: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map`),
129
129
  /** Uploads a new version. Checks you already added or dismissed keep that. */
130
130
  upload: (app, map) => this.req("PUT", `/api/v1/apps/${encodeURIComponent(app)}/map`, map),
131
- setCheckpoint: (app, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app)}/map/checkpoints/${encodeURIComponent(id)}`, { status })
131
+ setCheckpoint: (app, id, status) => this.req("PATCH", `/api/v1/apps/${encodeURIComponent(app)}/map/checkpoints/${encodeURIComponent(id)}`, { status }),
132
+ /** A key that can only read and upload this app's map, for CI. The key is in the response once. */
133
+ createKey: (app, opts = {}) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app)}/map_keys`, opts),
134
+ keys: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map_keys`),
135
+ revokeKey: (app, id) => this.req("DELETE", `/api/v1/apps/${encodeURIComponent(app)}/map_keys/${encodeURIComponent(id)}`),
136
+ /** Starts a map run where Plures runs Claude (CI with no Anthropic key). npx plures map does this. */
137
+ startRun: (app) => this.req("POST", `/api/v1/apps/${encodeURIComponent(app)}/map_runs`, {}),
138
+ runs: (app) => this.req("GET", `/api/v1/apps/${encodeURIComponent(app)}/map_runs`),
139
+ /** The GitHub Actions workflow that maps a repo on every push to its main branch. */
140
+ workflow: async (app, branch = "main") => {
141
+ const r = await fetch(`${this.base}/api/v1/map_workflow?app=${encodeURIComponent(app)}&branch=${encodeURIComponent(branch)}`);
142
+ return r.text();
143
+ }
132
144
  };
133
145
  /**
134
146
  * Quality: people grade a sample of your agent's outputs against a rubric, so you see drift
package/dist/index.d.cts CHANGED
@@ -242,6 +242,15 @@ type AgentMap = {
242
242
  }[];
243
243
  checkpoints: MapCheckpoint[];
244
244
  };
245
+ type MapKey = {
246
+ object: "map_key";
247
+ id: string;
248
+ app: string;
249
+ prefix: string;
250
+ label: string | null;
251
+ created_at: string;
252
+ last_used_at: string | null;
253
+ };
245
254
  type StoredAgentMap = AgentMap & {
246
255
  object: "agent_map";
247
256
  app: string;
@@ -341,7 +350,7 @@ type WebhookEvent = {
341
350
  created_at: string;
342
351
  data: Task;
343
352
  };
344
- declare const VERSION = "1.7.1";
353
+ declare const VERSION = "1.9.1";
345
354
  declare class PluresError extends Error {
346
355
  readonly status: number;
347
356
  readonly type: string;
@@ -437,6 +446,46 @@ declare class Plures {
437
446
  /** Uploads a new version. Checks you already added or dismissed keep that. */
438
447
  upload: (app: string, map: AgentMap) => Promise<StoredAgentMap>;
439
448
  setCheckpoint: (app: string, id: string, status: "added" | "dismissed" | "suggested") => Promise<StoredAgentMap>;
449
+ /** A key that can only read and upload this app's map, for CI. The key is in the response once. */
450
+ createKey: (app: string, opts?: {
451
+ label?: string;
452
+ }) => Promise<MapKey & {
453
+ key: string;
454
+ }>;
455
+ keys: (app: string) => Promise<{
456
+ object: "list";
457
+ data: MapKey[];
458
+ }>;
459
+ revokeKey: (app: string, id: string) => Promise<{
460
+ object: "map_key";
461
+ id: string;
462
+ deleted: true;
463
+ }>;
464
+ /** Starts a map run where Plures runs Claude (CI with no Anthropic key). npx plures map does this. */
465
+ startRun: (app: string) => Promise<{
466
+ object: "map_run";
467
+ id: string;
468
+ app: string;
469
+ free: boolean;
470
+ max_cents: number;
471
+ token: string;
472
+ base_url: string;
473
+ model: string;
474
+ expires_in: number;
475
+ }>;
476
+ runs: (app: string) => Promise<{
477
+ object: "list";
478
+ data: {
479
+ object: "map_run";
480
+ id: string;
481
+ status: string;
482
+ free: boolean;
483
+ charged_cents: number | null;
484
+ created_at: string;
485
+ }[];
486
+ }>;
487
+ /** The GitHub Actions workflow that maps a repo on every push to its main branch. */
488
+ workflow: (app: string, branch?: string) => Promise<string>;
440
489
  };
441
490
  /**
442
491
  * Quality: people grade a sample of your agent's outputs against a rubric, so you see drift
@@ -529,4 +578,4 @@ declare class Plures {
529
578
  static verifyWebhook(rawBody: string, signatureHeader: string | null, secret: string, toleranceSec?: number): Promise<WebhookEvent>;
530
579
  }
531
580
 
532
- export { type AgentMap, type App, type Balance, type Consensus, type CreateTask, type Escalation, type MapCheckpoint, type MapDraft, type MapNode, type Mix, type Option, Plures, PluresError, type Release, type Result, type Route, type Routing, type RoutingRule, type RoutingUpdate, type Rubric, type RubricParams, type Sample, type StoredAgentMap, type Task, type TaskStatus, type TeamTally, type TeamVote, type TestMix, VERSION, type WebhookEvent, Plures as default };
581
+ export { type AgentMap, type App, type Balance, type Consensus, type CreateTask, type Escalation, type MapCheckpoint, type MapDraft, type MapKey, type MapNode, type Mix, type Option, Plures, PluresError, type Release, type Result, type Route, type Routing, type RoutingRule, type RoutingUpdate, type Rubric, type RubricParams, type Sample, type StoredAgentMap, type Task, type TaskStatus, type TeamTally, type TeamVote, type TestMix, VERSION, type WebhookEvent, Plures as default };
package/dist/index.d.ts CHANGED
@@ -242,6 +242,15 @@ type AgentMap = {
242
242
  }[];
243
243
  checkpoints: MapCheckpoint[];
244
244
  };
245
+ type MapKey = {
246
+ object: "map_key";
247
+ id: string;
248
+ app: string;
249
+ prefix: string;
250
+ label: string | null;
251
+ created_at: string;
252
+ last_used_at: string | null;
253
+ };
245
254
  type StoredAgentMap = AgentMap & {
246
255
  object: "agent_map";
247
256
  app: string;
@@ -341,7 +350,7 @@ type WebhookEvent = {
341
350
  created_at: string;
342
351
  data: Task;
343
352
  };
344
- declare const VERSION = "1.7.1";
353
+ declare const VERSION = "1.9.1";
345
354
  declare class PluresError extends Error {
346
355
  readonly status: number;
347
356
  readonly type: string;
@@ -437,6 +446,46 @@ declare class Plures {
437
446
  /** Uploads a new version. Checks you already added or dismissed keep that. */
438
447
  upload: (app: string, map: AgentMap) => Promise<StoredAgentMap>;
439
448
  setCheckpoint: (app: string, id: string, status: "added" | "dismissed" | "suggested") => Promise<StoredAgentMap>;
449
+ /** A key that can only read and upload this app's map, for CI. The key is in the response once. */
450
+ createKey: (app: string, opts?: {
451
+ label?: string;
452
+ }) => Promise<MapKey & {
453
+ key: string;
454
+ }>;
455
+ keys: (app: string) => Promise<{
456
+ object: "list";
457
+ data: MapKey[];
458
+ }>;
459
+ revokeKey: (app: string, id: string) => Promise<{
460
+ object: "map_key";
461
+ id: string;
462
+ deleted: true;
463
+ }>;
464
+ /** Starts a map run where Plures runs Claude (CI with no Anthropic key). npx plures map does this. */
465
+ startRun: (app: string) => Promise<{
466
+ object: "map_run";
467
+ id: string;
468
+ app: string;
469
+ free: boolean;
470
+ max_cents: number;
471
+ token: string;
472
+ base_url: string;
473
+ model: string;
474
+ expires_in: number;
475
+ }>;
476
+ runs: (app: string) => Promise<{
477
+ object: "list";
478
+ data: {
479
+ object: "map_run";
480
+ id: string;
481
+ status: string;
482
+ free: boolean;
483
+ charged_cents: number | null;
484
+ created_at: string;
485
+ }[];
486
+ }>;
487
+ /** The GitHub Actions workflow that maps a repo on every push to its main branch. */
488
+ workflow: (app: string, branch?: string) => Promise<string>;
440
489
  };
441
490
  /**
442
491
  * Quality: people grade a sample of your agent's outputs against a rubric, so you see drift
@@ -529,4 +578,4 @@ declare class Plures {
529
578
  static verifyWebhook(rawBody: string, signatureHeader: string | null, secret: string, toleranceSec?: number): Promise<WebhookEvent>;
530
579
  }
531
580
 
532
- export { type AgentMap, type App, type Balance, type Consensus, type CreateTask, type Escalation, type MapCheckpoint, type MapDraft, type MapNode, type Mix, type Option, Plures, PluresError, type Release, type Result, type Route, type Routing, type RoutingRule, type RoutingUpdate, type Rubric, type RubricParams, type Sample, type StoredAgentMap, type Task, type TaskStatus, type TeamTally, type TeamVote, type TestMix, VERSION, type WebhookEvent, Plures as default };
581
+ export { type AgentMap, type App, type Balance, type Consensus, type CreateTask, type Escalation, type MapCheckpoint, type MapDraft, type MapKey, type MapNode, type Mix, type Option, Plures, PluresError, type Release, type Result, type Route, type Routing, type RoutingRule, type RoutingUpdate, type Rubric, type RubricParams, type Sample, type StoredAgentMap, type Task, type TaskStatus, type TeamTally, type TeamVote, type TestMix, VERSION, type WebhookEvent, Plures as default };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  PluresError,
4
4
  VERSION,
5
5
  index_default
6
- } from "./chunk-N4GCKRA6.js";
6
+ } from "./chunk-23ZYPCPM.js";
7
7
  export {
8
8
  Plures,
9
9
  PluresError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plures",
3
- "version": "1.7.1",
3
+ "version": "1.9.1",
4
4
  "description": "Human judgment as an API for AI agents. Send a decision to ID verified people and get their consensus back.",
5
5
  "keywords": [
6
6
  "human-in-the-loop",