plures 1.3.0 → 1.4.0
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 +1 -0
- package/dist/index.cjs +12 -1
- package/dist/index.d.cts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +12 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ if (event.type === "task.completed" && event.data.result?.agreement === 1) {
|
|
|
46
46
|
|
|
47
47
|
- `plures.tasks.create(params, { idempotencyKey? })`: send a task. Params: `question`, `options` (2 to 8, strings or `{ id, label }`), `context`, `image_url`, `audio_url` or `video_url` with `media_seconds` (a clip up to 180 seconds that people play through before answering), `sensitive`, `instructions`, `verifiers` (1, 3, 5, 7 or 9), `max_verifiers`, `presence_check` (default true), `webhook_url`, `metadata`, `expires_in`.
|
|
48
48
|
- `plures.tasks.retrieve(id)`, `plures.tasks.list({ status?, limit?, starting_after? })`, `plures.tasks.cancel(id)`
|
|
49
|
+
- `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.
|
|
49
50
|
- `plures.balance()`: your prepaid credit for live tasks, in cents. Live tasks cost $0.20 per answer (more for clips); a task that could cost more than your available credit throws a `PluresError` with `type` `insufficient_credits` (status 402).
|
|
50
51
|
- `plures.tasks.waitFor(id, { timeoutMs?, intervalMs? })`: poll until settled
|
|
51
52
|
- `plures.verify(params, { timeoutMs?, idempotencyKey? })`: create and wait
|
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.
|
|
29
|
+
var VERSION = "1.4.0";
|
|
30
30
|
var PluresError = class extends Error {
|
|
31
31
|
constructor(message, status, type) {
|
|
32
32
|
super(message);
|
|
@@ -81,6 +81,17 @@ var Plures = class {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* Test keys only. How test tasks behave when they don't set metadata.test_outcome,
|
|
86
|
+
* so an agent running unchanged sends a share of decisions to your team.
|
|
87
|
+
* A single task can override it with metadata.test_mix.
|
|
88
|
+
*/
|
|
89
|
+
testMix = {
|
|
90
|
+
get: () => this.req("GET", "/api/v1/test_mix"),
|
|
91
|
+
/** For example { unanimous: 70, split: 20, tie: 5, expired: 5 }. Pass null to turn it off. */
|
|
92
|
+
set: (mix) => this.req("PUT", "/api/v1/test_mix", { mix }),
|
|
93
|
+
clear: () => this.req("DELETE", "/api/v1/test_mix")
|
|
94
|
+
};
|
|
84
95
|
/** Your prepaid credit. A live task that could cost more than available_cents is refused with a 402 insufficient_credits error. */
|
|
85
96
|
balance = () => this.req("GET", "/api/v1/balance");
|
|
86
97
|
/** Creates a task and waits for people to answer it. */
|
package/dist/index.d.cts
CHANGED
|
@@ -84,6 +84,18 @@ type CreateTask = {
|
|
|
84
84
|
/** Agreement below which this task goes to your team, 0 to 1. Default from your dashboard. */
|
|
85
85
|
escalate_below?: number;
|
|
86
86
|
};
|
|
87
|
+
/** Whole number shares of test task outcomes that add up to 100. */
|
|
88
|
+
type Mix = {
|
|
89
|
+
unanimous?: number;
|
|
90
|
+
split?: number;
|
|
91
|
+
tie?: number;
|
|
92
|
+
expired?: number;
|
|
93
|
+
};
|
|
94
|
+
type TestMix = {
|
|
95
|
+
object: "test_mix";
|
|
96
|
+
mix: Mix | null;
|
|
97
|
+
to_team_percent: number;
|
|
98
|
+
};
|
|
87
99
|
/** Prepaid credit for live tasks, in US cents. */
|
|
88
100
|
type Balance = {
|
|
89
101
|
object: "balance";
|
|
@@ -105,7 +117,7 @@ type WebhookEvent = {
|
|
|
105
117
|
created_at: string;
|
|
106
118
|
data: Task;
|
|
107
119
|
};
|
|
108
|
-
declare const VERSION = "1.
|
|
120
|
+
declare const VERSION = "1.4.0";
|
|
109
121
|
declare class PluresError extends Error {
|
|
110
122
|
readonly status: number;
|
|
111
123
|
readonly type: string;
|
|
@@ -140,6 +152,17 @@ declare class Plures {
|
|
|
140
152
|
intervalMs?: number;
|
|
141
153
|
}) => Promise<Task>;
|
|
142
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Test keys only. How test tasks behave when they don't set metadata.test_outcome,
|
|
157
|
+
* so an agent running unchanged sends a share of decisions to your team.
|
|
158
|
+
* A single task can override it with metadata.test_mix.
|
|
159
|
+
*/
|
|
160
|
+
testMix: {
|
|
161
|
+
get: () => Promise<TestMix>;
|
|
162
|
+
/** For example { unanimous: 70, split: 20, tie: 5, expired: 5 }. Pass null to turn it off. */
|
|
163
|
+
set: (mix: Mix | null) => Promise<TestMix>;
|
|
164
|
+
clear: () => Promise<TestMix>;
|
|
165
|
+
};
|
|
143
166
|
/** Your prepaid credit. A live task that could cost more than available_cents is refused with a 402 insufficient_credits error. */
|
|
144
167
|
balance: () => Promise<Balance>;
|
|
145
168
|
/** Creates a task and waits for people to answer it. */
|
|
@@ -155,4 +178,4 @@ declare class Plures {
|
|
|
155
178
|
static verifyWebhook(rawBody: string, signatureHeader: string | null, secret: string, toleranceSec?: number): Promise<WebhookEvent>;
|
|
156
179
|
}
|
|
157
180
|
|
|
158
|
-
export { type Balance, type CreateTask, type Escalation, type Option, Plures, PluresError, type Result, type Task, type TaskStatus, VERSION, type WebhookEvent, Plures as default };
|
|
181
|
+
export { type Balance, type CreateTask, type Escalation, type Mix, type Option, Plures, PluresError, type Result, type Task, type TaskStatus, type TestMix, VERSION, type WebhookEvent, Plures as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -84,6 +84,18 @@ type CreateTask = {
|
|
|
84
84
|
/** Agreement below which this task goes to your team, 0 to 1. Default from your dashboard. */
|
|
85
85
|
escalate_below?: number;
|
|
86
86
|
};
|
|
87
|
+
/** Whole number shares of test task outcomes that add up to 100. */
|
|
88
|
+
type Mix = {
|
|
89
|
+
unanimous?: number;
|
|
90
|
+
split?: number;
|
|
91
|
+
tie?: number;
|
|
92
|
+
expired?: number;
|
|
93
|
+
};
|
|
94
|
+
type TestMix = {
|
|
95
|
+
object: "test_mix";
|
|
96
|
+
mix: Mix | null;
|
|
97
|
+
to_team_percent: number;
|
|
98
|
+
};
|
|
87
99
|
/** Prepaid credit for live tasks, in US cents. */
|
|
88
100
|
type Balance = {
|
|
89
101
|
object: "balance";
|
|
@@ -105,7 +117,7 @@ type WebhookEvent = {
|
|
|
105
117
|
created_at: string;
|
|
106
118
|
data: Task;
|
|
107
119
|
};
|
|
108
|
-
declare const VERSION = "1.
|
|
120
|
+
declare const VERSION = "1.4.0";
|
|
109
121
|
declare class PluresError extends Error {
|
|
110
122
|
readonly status: number;
|
|
111
123
|
readonly type: string;
|
|
@@ -140,6 +152,17 @@ declare class Plures {
|
|
|
140
152
|
intervalMs?: number;
|
|
141
153
|
}) => Promise<Task>;
|
|
142
154
|
};
|
|
155
|
+
/**
|
|
156
|
+
* Test keys only. How test tasks behave when they don't set metadata.test_outcome,
|
|
157
|
+
* so an agent running unchanged sends a share of decisions to your team.
|
|
158
|
+
* A single task can override it with metadata.test_mix.
|
|
159
|
+
*/
|
|
160
|
+
testMix: {
|
|
161
|
+
get: () => Promise<TestMix>;
|
|
162
|
+
/** For example { unanimous: 70, split: 20, tie: 5, expired: 5 }. Pass null to turn it off. */
|
|
163
|
+
set: (mix: Mix | null) => Promise<TestMix>;
|
|
164
|
+
clear: () => Promise<TestMix>;
|
|
165
|
+
};
|
|
143
166
|
/** Your prepaid credit. A live task that could cost more than available_cents is refused with a 402 insufficient_credits error. */
|
|
144
167
|
balance: () => Promise<Balance>;
|
|
145
168
|
/** Creates a task and waits for people to answer it. */
|
|
@@ -155,4 +178,4 @@ declare class Plures {
|
|
|
155
178
|
static verifyWebhook(rawBody: string, signatureHeader: string | null, secret: string, toleranceSec?: number): Promise<WebhookEvent>;
|
|
156
179
|
}
|
|
157
180
|
|
|
158
|
-
export { type Balance, type CreateTask, type Escalation, type Option, Plures, PluresError, type Result, type Task, type TaskStatus, VERSION, type WebhookEvent, Plures as default };
|
|
181
|
+
export { type Balance, type CreateTask, type Escalation, type Mix, type Option, Plures, PluresError, type Result, type Task, type TaskStatus, type TestMix, VERSION, type WebhookEvent, Plures as default };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
var VERSION = "1.
|
|
2
|
+
var VERSION = "1.4.0";
|
|
3
3
|
var PluresError = class extends Error {
|
|
4
4
|
constructor(message, status, type) {
|
|
5
5
|
super(message);
|
|
@@ -54,6 +54,17 @@ var Plures = class {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Test keys only. How test tasks behave when they don't set metadata.test_outcome,
|
|
59
|
+
* so an agent running unchanged sends a share of decisions to your team.
|
|
60
|
+
* A single task can override it with metadata.test_mix.
|
|
61
|
+
*/
|
|
62
|
+
testMix = {
|
|
63
|
+
get: () => this.req("GET", "/api/v1/test_mix"),
|
|
64
|
+
/** For example { unanimous: 70, split: 20, tie: 5, expired: 5 }. Pass null to turn it off. */
|
|
65
|
+
set: (mix) => this.req("PUT", "/api/v1/test_mix", { mix }),
|
|
66
|
+
clear: () => this.req("DELETE", "/api/v1/test_mix")
|
|
67
|
+
};
|
|
57
68
|
/** Your prepaid credit. A live task that could cost more than available_cents is refused with a 402 insufficient_credits error. */
|
|
58
69
|
balance = () => this.req("GET", "/api/v1/balance");
|
|
59
70
|
/** Creates a task and waits for people to answer it. */
|