standout 0.5.35 → 0.5.36
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/dist/cli.js +7 -138
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __toBinaryNode = Uint8Array.fromBase64 || ((base64) => new Uint8Array(Buffer.from(base64, "base64")));
|
|
3
3
|
|
|
4
4
|
// src/cli.ts
|
|
5
|
-
import
|
|
5
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
6
6
|
import chalk2 from "chalk";
|
|
7
7
|
import { writeFileSync } from "node:fs";
|
|
8
8
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -244,138 +244,7 @@ function boostProficiencyForDisplay(p) {
|
|
|
244
244
|
return { ...p, score, craft_bonus: Math.max(0, score - p.base) };
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
// ../../lib/
|
|
248
|
-
import Anthropic from "@anthropic-ai/sdk";
|
|
249
|
-
import { SpanStatusCode as SpanStatusCode2 } from "@opentelemetry/api";
|
|
250
|
-
import { startObservation } from "@langfuse/tracing";
|
|
251
|
-
import OpenAI from "openai";
|
|
252
|
-
|
|
253
|
-
// ../../lib/llm/langfuse.ts
|
|
254
|
-
import { SpanStatusCode } from "@opentelemetry/api";
|
|
255
|
-
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
|
|
256
|
-
import { LangfuseSpanProcessor } from "@langfuse/otel";
|
|
257
|
-
import { setLangfuseTracerProvider } from "@langfuse/tracing";
|
|
258
|
-
import { CallbackHandler } from "@langfuse/langchain";
|
|
259
|
-
|
|
260
|
-
// ../../lib/llm/useCase.ts
|
|
261
|
-
var DEFAULT_RETRY_STRATEGY = {
|
|
262
|
-
maxRetries: 5,
|
|
263
|
-
initialDelaySeconds: 1,
|
|
264
|
-
maxDelaySeconds: 16,
|
|
265
|
-
retryAfterFloorMs: 500
|
|
266
|
-
};
|
|
267
|
-
function sleep(ms) {
|
|
268
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
269
|
-
}
|
|
270
|
-
var RetryingAnthropic = class extends Anthropic {
|
|
271
|
-
constructor(opts = {}) {
|
|
272
|
-
const strategy = {
|
|
273
|
-
...DEFAULT_RETRY_STRATEGY,
|
|
274
|
-
...opts.retryStrategy ?? {}
|
|
275
|
-
};
|
|
276
|
-
const { retryStrategy: _strategy, ...clientOpts } = opts;
|
|
277
|
-
super({
|
|
278
|
-
...clientOpts,
|
|
279
|
-
maxRetries: clientOpts.maxRetries ?? strategy.maxRetries
|
|
280
|
-
});
|
|
281
|
-
this.retryStrategy = strategy;
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
RetryingAnthropic.prototype.retryRequest = async function(options, retriesRemaining, requestLogID, responseHeaders) {
|
|
285
|
-
const strategy = this.retryStrategy;
|
|
286
|
-
let timeoutMillis;
|
|
287
|
-
const retryAfterMillisHeader = responseHeaders?.get("retry-after-ms");
|
|
288
|
-
if (retryAfterMillisHeader) {
|
|
289
|
-
const ms = parseFloat(retryAfterMillisHeader);
|
|
290
|
-
if (!Number.isNaN(ms)) timeoutMillis = ms;
|
|
291
|
-
}
|
|
292
|
-
const retryAfterHeader = responseHeaders?.get("retry-after");
|
|
293
|
-
if (retryAfterHeader && timeoutMillis === void 0) {
|
|
294
|
-
const seconds = parseFloat(retryAfterHeader);
|
|
295
|
-
if (!Number.isNaN(seconds)) {
|
|
296
|
-
timeoutMillis = seconds * 1e3;
|
|
297
|
-
} else {
|
|
298
|
-
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (timeoutMillis === void 0 || Number.isNaN(timeoutMillis)) {
|
|
302
|
-
const numRetries = strategy.maxRetries - retriesRemaining;
|
|
303
|
-
const sleepSeconds = Math.min(
|
|
304
|
-
strategy.initialDelaySeconds * Math.pow(2, numRetries),
|
|
305
|
-
strategy.maxDelaySeconds
|
|
306
|
-
);
|
|
307
|
-
const jitter = 1 - Math.random() * 0.25;
|
|
308
|
-
timeoutMillis = sleepSeconds * jitter * 1e3;
|
|
309
|
-
} else {
|
|
310
|
-
timeoutMillis = Math.max(timeoutMillis, strategy.retryAfterFloorMs);
|
|
311
|
-
}
|
|
312
|
-
await sleep(timeoutMillis);
|
|
313
|
-
const makeRequest = this.makeRequest;
|
|
314
|
-
return makeRequest.call(this, options, retriesRemaining - 1, requestLogID);
|
|
315
|
-
};
|
|
316
|
-
var RetryingOpenAI = class extends OpenAI {
|
|
317
|
-
constructor(opts = {}) {
|
|
318
|
-
const strategy = {
|
|
319
|
-
...DEFAULT_RETRY_STRATEGY,
|
|
320
|
-
...opts.retryStrategy ?? {}
|
|
321
|
-
};
|
|
322
|
-
const { retryStrategy: _strategy, ...clientOpts } = opts;
|
|
323
|
-
super({
|
|
324
|
-
...clientOpts,
|
|
325
|
-
maxRetries: clientOpts.maxRetries ?? strategy.maxRetries
|
|
326
|
-
});
|
|
327
|
-
this.retryStrategy = strategy;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
RetryingOpenAI.prototype.retryRequest = async function(options, retriesRemaining, responseHeaders) {
|
|
331
|
-
const strategy = this.retryStrategy;
|
|
332
|
-
let timeoutMillis;
|
|
333
|
-
const retryAfterMillisHeader = responseHeaders?.get("retry-after-ms");
|
|
334
|
-
if (retryAfterMillisHeader) {
|
|
335
|
-
const ms = parseFloat(retryAfterMillisHeader);
|
|
336
|
-
if (!Number.isNaN(ms)) timeoutMillis = ms;
|
|
337
|
-
}
|
|
338
|
-
const retryAfterHeader = responseHeaders?.get("retry-after");
|
|
339
|
-
if (retryAfterHeader && timeoutMillis === void 0) {
|
|
340
|
-
const seconds = parseFloat(retryAfterHeader);
|
|
341
|
-
if (!Number.isNaN(seconds)) {
|
|
342
|
-
timeoutMillis = seconds * 1e3;
|
|
343
|
-
} else {
|
|
344
|
-
timeoutMillis = Date.parse(retryAfterHeader) - Date.now();
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (timeoutMillis === void 0 || Number.isNaN(timeoutMillis)) {
|
|
348
|
-
const numRetries = strategy.maxRetries - retriesRemaining;
|
|
349
|
-
const sleepSeconds = Math.min(
|
|
350
|
-
strategy.initialDelaySeconds * Math.pow(2, numRetries),
|
|
351
|
-
strategy.maxDelaySeconds
|
|
352
|
-
);
|
|
353
|
-
const jitter = 1 - Math.random() * 0.25;
|
|
354
|
-
timeoutMillis = sleepSeconds * jitter * 1e3;
|
|
355
|
-
} else {
|
|
356
|
-
timeoutMillis = Math.max(timeoutMillis, strategy.retryAfterFloorMs);
|
|
357
|
-
}
|
|
358
|
-
await sleep(timeoutMillis);
|
|
359
|
-
const makeRequest = this.makeRequest;
|
|
360
|
-
return makeRequest.call(this, options, retriesRemaining - 1);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
// ../../lib/llm/disableLangsmith.ts
|
|
364
|
-
process.env.LANGSMITH_TRACING = "false";
|
|
365
|
-
process.env.LANGCHAIN_TRACING_V2 = "false";
|
|
366
|
-
process.env.LANGCHAIN_TRACING = "false";
|
|
367
|
-
delete process.env.LANGSMITH_API_KEY;
|
|
368
|
-
delete process.env.LANGCHAIN_API_KEY;
|
|
369
|
-
delete process.env.LANGSMITH_ENDPOINT;
|
|
370
|
-
delete process.env.LANGCHAIN_ENDPOINT;
|
|
371
|
-
delete process.env.LANGSMITH_PROJECT;
|
|
372
|
-
delete process.env.LANGCHAIN_PROJECT;
|
|
373
|
-
|
|
374
|
-
// ../../lib/llm/models.ts
|
|
375
|
-
import { ChatAnthropic } from "@langchain/anthropic";
|
|
376
|
-
import { ChatOpenAI } from "@langchain/openai";
|
|
377
|
-
|
|
378
|
-
// ../../lib/standout/wrapped/narrative.ts
|
|
247
|
+
// ../../lib/standout/wrapped/stat-pack.ts
|
|
379
248
|
var SOURCES = ["claude_code", "codex", "cursor"];
|
|
380
249
|
var INFRA_FRAMEWORKS = /* @__PURE__ */ new Set([
|
|
381
250
|
"github-actions",
|
|
@@ -6836,14 +6705,14 @@ function describeError(err) {
|
|
|
6836
6705
|
}
|
|
6837
6706
|
return parts.join(" <- ") || String(err);
|
|
6838
6707
|
}
|
|
6839
|
-
var
|
|
6708
|
+
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
6840
6709
|
function isReady(computed) {
|
|
6841
6710
|
if (!computed) return false;
|
|
6842
6711
|
return computed.status === "ready" || computed.archetype != null;
|
|
6843
6712
|
}
|
|
6844
6713
|
async function pollComputed(id) {
|
|
6845
6714
|
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
6846
|
-
await
|
|
6715
|
+
await sleep(POLL_INTERVAL_MS);
|
|
6847
6716
|
while (Date.now() < deadline) {
|
|
6848
6717
|
try {
|
|
6849
6718
|
const res = await fetch(`${STANDOUT_API_URL}/api/public/wrapped/${id}`, {
|
|
@@ -6856,7 +6725,7 @@ async function pollComputed(id) {
|
|
|
6856
6725
|
}
|
|
6857
6726
|
} catch {
|
|
6858
6727
|
}
|
|
6859
|
-
await
|
|
6728
|
+
await sleep(POLL_INTERVAL_MS);
|
|
6860
6729
|
}
|
|
6861
6730
|
return null;
|
|
6862
6731
|
}
|
|
@@ -6890,7 +6759,7 @@ async function createWrapped(args) {
|
|
|
6890
6759
|
break;
|
|
6891
6760
|
} catch (err) {
|
|
6892
6761
|
if (isPreConnectError(err) && attempt < MAX_ATTEMPTS) {
|
|
6893
|
-
await
|
|
6762
|
+
await sleep(RETRY_BASE_DELAY_MS * attempt);
|
|
6894
6763
|
continue;
|
|
6895
6764
|
}
|
|
6896
6765
|
const detail = describeError(err);
|
|
@@ -7261,7 +7130,7 @@ async function runAgent(jobId) {
|
|
|
7261
7130
|
console.log(` Applying to: ${STANDOUT_API_URL}/jobs/${jobId}
|
|
7262
7131
|
`);
|
|
7263
7132
|
}
|
|
7264
|
-
const client = new
|
|
7133
|
+
const client = new Anthropic({
|
|
7265
7134
|
apiKey: "proxied-by-standout",
|
|
7266
7135
|
baseURL: `${STANDOUT_API_URL}/api/public/agent-chat`,
|
|
7267
7136
|
defaultHeaders: {
|