@whittlelabs/sifter 0.19.0 → 0.20.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/bin.js +29 -21
- package/bin.js.map +2 -2
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -3158,7 +3158,6 @@ var require_device_code = __commonJS({
|
|
|
3158
3158
|
const device = await startDeviceCode({
|
|
3159
3159
|
keepApiUrl: reg.keepApiUrl,
|
|
3160
3160
|
oauthClientId: reg.oauthClientId,
|
|
3161
|
-
scopes: reg.scopes,
|
|
3162
3161
|
fetcher,
|
|
3163
3162
|
brand: opts.brand
|
|
3164
3163
|
});
|
|
@@ -3241,8 +3240,7 @@ var require_device_code = __commonJS({
|
|
|
3241
3240
|
method: "POST",
|
|
3242
3241
|
headers: { "Content-Type": "application/json" },
|
|
3243
3242
|
body: JSON.stringify({
|
|
3244
|
-
client_id: opts.oauthClientId
|
|
3245
|
-
scope: opts.scopes.join(" ")
|
|
3243
|
+
client_id: opts.oauthClientId
|
|
3246
3244
|
})
|
|
3247
3245
|
});
|
|
3248
3246
|
(0, version_check_1.checkResponseMinVersion)({
|
|
@@ -15641,26 +15639,38 @@ var require_subscribe = __commonJS({
|
|
|
15641
15639
|
return;
|
|
15642
15640
|
}
|
|
15643
15641
|
const controller = new AbortController();
|
|
15644
|
-
let
|
|
15645
|
-
|
|
15646
|
-
|
|
15642
|
+
let quietTimer = null;
|
|
15643
|
+
const quietWindowMs = dispatch.deadline ? new Date(dispatch.deadline).getTime() - Date.now() : null;
|
|
15644
|
+
const armQuietTimer = () => {
|
|
15645
|
+
if (quietWindowMs === null)
|
|
15646
|
+
return;
|
|
15647
|
+
if (quietTimer !== null)
|
|
15648
|
+
clearTimeout(quietTimer);
|
|
15649
|
+
const ms = quietWindowMs - 3e4;
|
|
15647
15650
|
if (ms > 0) {
|
|
15648
|
-
|
|
15651
|
+
quietTimer = setTimeout(() => controller.abort(), ms);
|
|
15649
15652
|
} else {
|
|
15650
15653
|
controller.abort();
|
|
15651
15654
|
}
|
|
15652
|
-
}
|
|
15655
|
+
};
|
|
15656
|
+
armQuietTimer();
|
|
15657
|
+
const activity = {
|
|
15658
|
+
record: () => {
|
|
15659
|
+
if (!controller.signal.aborted)
|
|
15660
|
+
armQuietTimer();
|
|
15661
|
+
}
|
|
15662
|
+
};
|
|
15653
15663
|
let result;
|
|
15654
15664
|
try {
|
|
15655
|
-
result = await opts.onJob(dispatch, controller.signal);
|
|
15665
|
+
result = await opts.onJob(dispatch, controller.signal, activity);
|
|
15656
15666
|
} catch (err) {
|
|
15657
15667
|
result = {
|
|
15658
15668
|
status: "failed",
|
|
15659
15669
|
reason: `onJob threw: ${err instanceof Error ? err.message : String(err)}`
|
|
15660
15670
|
};
|
|
15661
15671
|
} finally {
|
|
15662
|
-
if (
|
|
15663
|
-
clearTimeout(
|
|
15672
|
+
if (quietTimer !== null)
|
|
15673
|
+
clearTimeout(quietTimer);
|
|
15664
15674
|
}
|
|
15665
15675
|
try {
|
|
15666
15676
|
for (const output of result.outputs ?? []) {
|
|
@@ -18569,7 +18579,7 @@ var require_client2 = __commonJS({
|
|
|
18569
18579
|
/**
|
|
18570
18580
|
* Mint a short-lived `act_` token for an end user, with this client's
|
|
18571
18581
|
* service identity recorded as the conduit. Requires this client to be
|
|
18572
|
-
* constructed with a service token holding `keep:actor-tokens:
|
|
18582
|
+
* constructed with a service token holding `keep:actor-tokens:write`.
|
|
18573
18583
|
*/
|
|
18574
18584
|
async mintActorToken(actor) {
|
|
18575
18585
|
return this.request("POST", "/api/actor-tokens", { actor });
|
|
@@ -18691,7 +18701,7 @@ var require_client2 = __commonJS({
|
|
|
18691
18701
|
/**
|
|
18692
18702
|
* Reveal a hosted-Sifter customer's plaintext Anthropic API key for
|
|
18693
18703
|
* one dispatch. Service-token only; requires the
|
|
18694
|
-
* `keep:managed-sifter-
|
|
18704
|
+
* `keep:managed-sifter-key-material:read` scope, granted only to the
|
|
18695
18705
|
* `whittle-hosted-sifter` service identity.
|
|
18696
18706
|
*
|
|
18697
18707
|
* Callers must use the returned key for a single Anthropic request
|
|
@@ -18706,9 +18716,9 @@ var require_client2 = __commonJS({
|
|
|
18706
18716
|
* Read a user's hosted-Sifter opt-in status. Returns `{enabled:
|
|
18707
18717
|
* false}` for users who never opted in (no row) and users who
|
|
18708
18718
|
* opted in then disabled. Service-to-service only; requires the
|
|
18709
|
-
* `keep:managed-sifter-
|
|
18710
|
-
* from
|
|
18711
|
-
* other.
|
|
18719
|
+
* `keep:managed-sifter-enrollments:read` scope, which is distinct
|
|
18720
|
+
* from `keep:managed-sifter-key-material:read` so a service identity
|
|
18721
|
+
* can hold one without the other.
|
|
18712
18722
|
*/
|
|
18713
18723
|
async getManagedSifterStatus(userId) {
|
|
18714
18724
|
return this.request("GET", `/api/users/${encodeURIComponent(userId)}/managed-sifter-status`);
|
|
@@ -20980,7 +20990,6 @@ var require_defaults2 = __commonJS({
|
|
|
20980
20990
|
oauthClientId: "shuttle-dev",
|
|
20981
20991
|
orgSlug: "whittle-labs",
|
|
20982
20992
|
roleSlug: "shuttle-dev",
|
|
20983
|
-
scopes: ["jobs:subscribe", "jobs:submit"],
|
|
20984
20993
|
serviceIdentityDisplayName: "{user}'s Shuttle on {hostname}"
|
|
20985
20994
|
},
|
|
20986
20995
|
defaultCaps: {
|
|
@@ -21270,7 +21279,7 @@ var require_shuttle = __commonJS({
|
|
|
21270
21279
|
error: err instanceof Error ? err.message : String(err)
|
|
21271
21280
|
});
|
|
21272
21281
|
};
|
|
21273
|
-
const onJob = async (dispatch, signal) => {
|
|
21282
|
+
const onJob = async (dispatch, signal, activity) => {
|
|
21274
21283
|
const jobId = dispatch.job.id;
|
|
21275
21284
|
const attendanceId = dispatch.attendanceId;
|
|
21276
21285
|
const startedAt = Date.now();
|
|
@@ -21308,7 +21317,7 @@ var require_shuttle = __commonJS({
|
|
|
21308
21317
|
const dispatchStartedAt = Date.now();
|
|
21309
21318
|
const executionCtx = {
|
|
21310
21319
|
reportProgress: (channel, frames) => {
|
|
21311
|
-
void jobsClient.postProgress(jobId, { channel, frames }).catch(() => {
|
|
21320
|
+
void jobsClient.postProgress(jobId, { channel, frames }).then(() => activity.record()).catch(() => {
|
|
21312
21321
|
});
|
|
21313
21322
|
}
|
|
21314
21323
|
};
|
|
@@ -21998,7 +22007,7 @@ var import_path = require("path");
|
|
|
21998
22007
|
var import_promises = require("fs/promises");
|
|
21999
22008
|
var import_yaml = __toESM(require_dist());
|
|
22000
22009
|
var import_shuttle = __toESM(require_dist5());
|
|
22001
|
-
var buildVersion = true ? "0.
|
|
22010
|
+
var buildVersion = true ? "0.20.0" : pkg.version;
|
|
22002
22011
|
var sifterBrand = {
|
|
22003
22012
|
product: {
|
|
22004
22013
|
id: "sifter",
|
|
@@ -22036,7 +22045,6 @@ var sifterBrand = {
|
|
|
22036
22045
|
oauthClientId: process.env.SIFTER_OAUTH_CLIENT_ID ?? "sifter",
|
|
22037
22046
|
orgSlug: "whittle-labs",
|
|
22038
22047
|
roleSlug: "sift-sifter",
|
|
22039
|
-
scopes: ["jobs:subscribe", "jobs:submit"],
|
|
22040
22048
|
serviceIdentityDisplayName: "{user}'s Sifter on {hostname}"
|
|
22041
22049
|
},
|
|
22042
22050
|
defaultCaps: {
|