@whittlelabs/sifter 0.1.3 → 0.2.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 +22 -5
- package/bin.js.map +2 -2
- package/package.json +1 -1
package/bin.js
CHANGED
|
@@ -15279,6 +15279,7 @@ var require_client = __commonJS({
|
|
|
15279
15279
|
var JobsClient = class {
|
|
15280
15280
|
baseUrl;
|
|
15281
15281
|
headers;
|
|
15282
|
+
onResponse;
|
|
15282
15283
|
constructor(config) {
|
|
15283
15284
|
this.baseUrl = config.baseUrl.replace(/\/$/, "");
|
|
15284
15285
|
this.headers = { "Content-Type": "application/json" };
|
|
@@ -15287,6 +15288,7 @@ var require_client = __commonJS({
|
|
|
15287
15288
|
} else if (config.accessToken) {
|
|
15288
15289
|
this.headers["Authorization"] = `Bearer ${config.accessToken}`;
|
|
15289
15290
|
}
|
|
15291
|
+
this.onResponse = config.onResponse;
|
|
15290
15292
|
}
|
|
15291
15293
|
// ── Attention Pools ──────────────────────────────────────────────
|
|
15292
15294
|
async createAttentionPool(options) {
|
|
@@ -15490,6 +15492,7 @@ var require_client = __commonJS({
|
|
|
15490
15492
|
headers: this.headers,
|
|
15491
15493
|
body: body ? JSON.stringify(body) : void 0
|
|
15492
15494
|
});
|
|
15495
|
+
this.onResponse?.(response);
|
|
15493
15496
|
const json = await response.json();
|
|
15494
15497
|
if (!response.ok || !json.success) {
|
|
15495
15498
|
const errorMessage = json.error?.message ?? `Request failed with status ${response.status}`;
|
|
@@ -15503,6 +15506,7 @@ var require_client = __commonJS({
|
|
|
15503
15506
|
async requestPaginated(method, path) {
|
|
15504
15507
|
const url = this.buildUrl(path);
|
|
15505
15508
|
const response = await fetch(url, { method, headers: this.headers });
|
|
15509
|
+
this.onResponse?.(response);
|
|
15506
15510
|
const json = await response.json();
|
|
15507
15511
|
if (!response.ok || !json.success) {
|
|
15508
15512
|
const errorMessage = json.error?.message ?? `Request failed with status ${response.status}`;
|
|
@@ -16282,11 +16286,13 @@ var require_service_token = __commonJS({
|
|
|
16282
16286
|
clientId;
|
|
16283
16287
|
clientSecret;
|
|
16284
16288
|
enabled;
|
|
16289
|
+
onResponse;
|
|
16285
16290
|
constructor(config) {
|
|
16286
16291
|
this.keepApiUrl = config.keepApiUrl.replace(/\/$/, "");
|
|
16287
16292
|
this.clientId = config.clientId;
|
|
16288
16293
|
this.clientSecret = config.clientSecret;
|
|
16289
16294
|
this.enabled = !!(config.clientId && config.clientSecret && config.keepApiUrl);
|
|
16295
|
+
this.onResponse = config.onResponse;
|
|
16290
16296
|
if (!this.enabled) {
|
|
16291
16297
|
console.warn("[ServiceTokenManager] Keep credentials not configured (KEEP_CLIENT_ID, KEEP_CLIENT_SECRET, KEEP_API_URL). Service-to-service auth is disabled.");
|
|
16292
16298
|
}
|
|
@@ -16321,6 +16327,7 @@ var require_service_token = __commonJS({
|
|
|
16321
16327
|
clientSecret: this.clientSecret
|
|
16322
16328
|
})
|
|
16323
16329
|
});
|
|
16330
|
+
this.onResponse?.(response);
|
|
16324
16331
|
const json = await response.json();
|
|
16325
16332
|
if (!response.ok || !json.success) {
|
|
16326
16333
|
const msg = json.error?.message ?? `Token exchange failed with status ${response.status}`;
|
|
@@ -17446,6 +17453,7 @@ var require_shuttle = __commonJS({
|
|
|
17446
17453
|
var jobs_1 = require_dist2();
|
|
17447
17454
|
var keep_1 = require_dist3();
|
|
17448
17455
|
var apply_1 = require_apply();
|
|
17456
|
+
var version_check_1 = require_version_check();
|
|
17449
17457
|
var logger_1 = require_logger();
|
|
17450
17458
|
var registry_1 = require_registry();
|
|
17451
17459
|
var claude_code_1 = require_claude_code();
|
|
@@ -17477,11 +17485,19 @@ var require_shuttle = __commonJS({
|
|
|
17477
17485
|
const logger = (0, logger_1.getLogger)();
|
|
17478
17486
|
logger.info(`${this.brand.product.title} starting...`);
|
|
17479
17487
|
const paths = (0, apply_1.resolvePaths)(this.brand);
|
|
17480
|
-
const
|
|
17488
|
+
const enforceMinVersion = (response) => {
|
|
17489
|
+
(0, version_check_1.checkResponseMinVersion)({
|
|
17490
|
+
response,
|
|
17491
|
+
currentVersion: this.brand.product.version,
|
|
17492
|
+
packageName: this.brand.product.packageName
|
|
17493
|
+
});
|
|
17494
|
+
};
|
|
17495
|
+
const auth = await resolveAuth(this.brand, this.config, paths.configFile, enforceMinVersion);
|
|
17481
17496
|
const jobsClient = new jobs_1.JobsClient({
|
|
17482
17497
|
baseUrl: this.config.auth.jobsApiUrl,
|
|
17483
17498
|
apiKey: auth.kind === "apiKey" ? auth.apiKey : void 0,
|
|
17484
|
-
accessToken: auth.kind === "serviceToken" ? auth.accessToken : void 0
|
|
17499
|
+
accessToken: auth.kind === "serviceToken" ? auth.accessToken : void 0,
|
|
17500
|
+
onResponse: enforceMinVersion
|
|
17485
17501
|
});
|
|
17486
17502
|
const registry = new registry_1.ExecutorRegistry(this.brand.executorAllowlist);
|
|
17487
17503
|
registerBuiltInExecutors(registry, this.brand.executorAllowlist);
|
|
@@ -17549,14 +17565,15 @@ var require_shuttle = __commonJS({
|
|
|
17549
17565
|
}
|
|
17550
17566
|
}
|
|
17551
17567
|
}
|
|
17552
|
-
async function resolveAuth(brand, config, pairingFile) {
|
|
17568
|
+
async function resolveAuth(brand, config, pairingFile, onResponse) {
|
|
17553
17569
|
const store = new store_1.PairingConfigStore(pairingFile);
|
|
17554
17570
|
if (store.exists()) {
|
|
17555
17571
|
const pairing = store.read();
|
|
17556
17572
|
const tokens = new keep_1.ServiceTokenManager({
|
|
17557
17573
|
keepApiUrl: pairing.keepApiUrl,
|
|
17558
17574
|
clientId: pairing.credentials.clientId,
|
|
17559
|
-
clientSecret: pairing.credentials.clientSecret
|
|
17575
|
+
clientSecret: pairing.credentials.clientSecret,
|
|
17576
|
+
onResponse
|
|
17560
17577
|
});
|
|
17561
17578
|
const token = await tokens.getToken();
|
|
17562
17579
|
if (token)
|
|
@@ -18087,7 +18104,7 @@ var require_package = __commonJS({
|
|
|
18087
18104
|
"package.json"(exports2, module2) {
|
|
18088
18105
|
module2.exports = {
|
|
18089
18106
|
name: "@whittlelabs/sifter",
|
|
18090
|
-
version: "0.
|
|
18107
|
+
version: "0.2.0",
|
|
18091
18108
|
description: "Whittle Sifter: paired AI reviewer for Whittle Sift attention pools.",
|
|
18092
18109
|
bin: {
|
|
18093
18110
|
"whittle-sifter": "./dist/bin.js"
|