@alpic-ai/tracks 0.15.0 → 0.17.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/dist/main.js +29 -20
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -454,15 +454,15 @@ const Prompt = Schema.Union([Schema.Struct({
|
|
|
454
454
|
description: "A prompt the agent has finished."
|
|
455
455
|
})]).annotate({ description: "One instruction to the agent and the work it did in response." });
|
|
456
456
|
const EndReason = Schema.Literals([
|
|
457
|
-
"
|
|
457
|
+
"finished",
|
|
458
458
|
"idle_timeout",
|
|
459
459
|
"time_limit",
|
|
460
460
|
"budget_exceeded",
|
|
461
|
-
"
|
|
461
|
+
"errored",
|
|
462
462
|
"canceled"
|
|
463
463
|
]).annotate({
|
|
464
464
|
identifier: "EndReason",
|
|
465
|
-
description: "Why the run ended. When `
|
|
465
|
+
description: "Why the run ended. When `errored`, `failure` explains what went wrong."
|
|
466
466
|
});
|
|
467
467
|
const FailureKind = Schema.Literals([
|
|
468
468
|
"repository_checkout_failed",
|
|
@@ -510,7 +510,7 @@ const Run = Schema.Union([
|
|
|
510
510
|
Schema.Struct({
|
|
511
511
|
...endedRunFields,
|
|
512
512
|
end_reason: EndReason.pick([
|
|
513
|
-
"
|
|
513
|
+
"finished",
|
|
514
514
|
"idle_timeout",
|
|
515
515
|
"time_limit",
|
|
516
516
|
"budget_exceeded",
|
|
@@ -522,11 +522,11 @@ const Run = Schema.Union([
|
|
|
522
522
|
}),
|
|
523
523
|
Schema.Struct({
|
|
524
524
|
...endedRunFields,
|
|
525
|
-
end_reason: Schema.Literal("
|
|
525
|
+
end_reason: Schema.Literal("errored"),
|
|
526
526
|
failure: Schema.String.annotate({ description: "What went wrong." }),
|
|
527
527
|
failure_kind: FailureKind
|
|
528
528
|
}).annotate({
|
|
529
|
-
identifier: "
|
|
529
|
+
identifier: "ErroredRun",
|
|
530
530
|
description: "A run that ended because something went wrong."
|
|
531
531
|
})
|
|
532
532
|
]).annotate({ description: "A coding agent working on your prompt in an isolated sandbox." });
|
|
@@ -567,17 +567,15 @@ var RunNotIdle = class extends Schema.TaggedError()("RunNotIdle", { message: Sch
|
|
|
567
567
|
}) {};
|
|
568
568
|
const Count$1 = Schema.Natural;
|
|
569
569
|
const RunUsage = Schema.Struct({
|
|
570
|
-
cost_usd: Schema.Number.annotate({ description: "
|
|
570
|
+
cost_usd: Schema.Number.annotate({ description: "What was taken from your balance for the run so far, its model calls and its run fee, in US dollars." }),
|
|
571
|
+
run_fee_usd: Schema.Number.annotate({ description: "The run fee, in US dollars: charged once the run has ended, unless it failed on our side, 0 until then." }),
|
|
571
572
|
models: Schema.Array(Schema.Struct({
|
|
572
573
|
provider: Schema.String.annotate({ description: "Company serving the model, such as `anthropic`." }),
|
|
573
574
|
model: Schema.String,
|
|
574
575
|
quantities: Schema.Record(Schema.String, Count$1).annotate({ description: "Units consumed, keyed by unit as the provider counts them, such as input tokens or web searches." }),
|
|
575
576
|
cost_usd: Schema.Number.annotate({ description: "Cost of this model's usage, in US dollars." })
|
|
576
577
|
})).annotate({ description: "Model usage, one entry per model." }),
|
|
577
|
-
sandbox: Schema.Struct({
|
|
578
|
-
seconds: Schema.Number.annotate({ description: "Time the sandbox ran, in seconds." }),
|
|
579
|
-
cost_usd: Schema.Number.annotate({ description: "Cost of the sandbox time, in US dollars." })
|
|
580
|
-
})
|
|
578
|
+
sandbox: Schema.Struct({ seconds: Schema.Number.annotate({ description: "Time the sandbox ran, in seconds, covered by the run fee." }) })
|
|
581
579
|
}).annotate({
|
|
582
580
|
identifier: "RunUsage",
|
|
583
581
|
description: "What a run consumed and what it cost."
|
|
@@ -765,14 +763,14 @@ var RunsApi = class extends HttpApiGroup.make("runs").add(HttpApiEndpoint.post("
|
|
|
765
763
|
error: RunNotFound
|
|
766
764
|
}).annotateMerge(OpenApi.annotations({
|
|
767
765
|
summary: "Get a run's usage",
|
|
768
|
-
description: "Returns what the run has consumed so far, per model and in sandbox time, and what it
|
|
766
|
+
description: "Returns what the run has consumed so far, per model and in sandbox time, and what it is charged."
|
|
769
767
|
})), HttpApiEndpoint.post("end", "/runs/:id/end", {
|
|
770
768
|
params: { id: RunId },
|
|
771
769
|
success: Run.pipe(HttpApiSchema.status(202)),
|
|
772
770
|
error: RunNotFound
|
|
773
771
|
}).annotateMerge(OpenApi.annotations({
|
|
774
772
|
summary: "End a run",
|
|
775
|
-
description: "Ends the run with `
|
|
773
|
+
description: "Ends the run with `finished` once its current prompt finishes, then destroys its sandbox. Ending a run that has ended does nothing."
|
|
776
774
|
})), HttpApiEndpoint.post("cancel", "/runs/:id/cancel", {
|
|
777
775
|
params: { id: RunId },
|
|
778
776
|
success: Run.pipe(HttpApiSchema.status(202)),
|
|
@@ -999,12 +997,12 @@ const Execution = Schema.Struct({
|
|
|
999
997
|
running: Count.annotate({ description: "Runs not started yet or not ended." }),
|
|
1000
998
|
judging: Count.annotate({ description: "Ended runs waiting for their evaluation results." }),
|
|
1001
999
|
judged: Count.annotate({ description: "Runs with a verdict." }),
|
|
1002
|
-
passed: Count.annotate({ description: "Runs that
|
|
1000
|
+
passed: Count.annotate({ description: "Runs that satisfied their scenario's pass policy." })
|
|
1003
1001
|
}).annotate({ description: "How many of its slots, one per scenario, variant, agent and repetition, stand where." }),
|
|
1004
1002
|
pass_rate: Schema.OptionFromOptionalKey(Schema.Int.check(Schema.isBetween({
|
|
1005
1003
|
minimum: 0,
|
|
1006
1004
|
maximum: 100
|
|
1007
|
-
})).annotate({ description: "Runs that
|
|
1005
|
+
})).annotate({ description: "Runs that succeeded out of those with a verdict, as a whole percent. Absent until one run has a verdict." })),
|
|
1008
1006
|
cost_usd: Schema.Number.annotate({ description: "What its runs cost so far, in US dollars." })
|
|
1009
1007
|
}).annotate({
|
|
1010
1008
|
identifier: "Execution",
|
|
@@ -1017,7 +1015,7 @@ const NotEvaluatedReason = Schema.Literals([
|
|
|
1017
1015
|
"agent_failed",
|
|
1018
1016
|
"evidence_too_long",
|
|
1019
1017
|
"too_many_attempts"
|
|
1020
|
-
]).annotate({ description: "Why the run has no verdict: it never started, its scenario has no evaluations, it did not end `
|
|
1018
|
+
]).annotate({ description: "Why the run has no verdict: it never started, its scenario has no evaluations, it did not end `finished`, its agent stopped with an error such as its model provider being unreachable, what it did was too long to judge, or judging failed too many times." });
|
|
1021
1019
|
const Slot = Schema.Struct({
|
|
1022
1020
|
id: Schema.String.annotate({ description: "Unique identifier of the slot." }),
|
|
1023
1021
|
scenario_id: Schema.String,
|
|
@@ -1032,7 +1030,7 @@ const Slot = Schema.Struct({
|
|
|
1032
1030
|
"judged",
|
|
1033
1031
|
"not_evaluated"
|
|
1034
1032
|
]).annotate({ description: "`running` while its run waits to start or has not ended, `judging` while it waits for evaluation results, `judged` once they are all in, or `not_evaluated` when it never will be." }),
|
|
1035
|
-
verdict: Schema.OptionFromOptionalKey(Schema.Literals(["
|
|
1033
|
+
verdict: Schema.OptionFromOptionalKey(Schema.Literals(["succeeded", "failed"]).annotate({ description: "Whether the run satisfied its scenario's pass policy, once judged." })),
|
|
1036
1034
|
score: Schema.OptionFromOptionalKey(Schema.Number.annotate({ description: "Weighted share of evaluations passed, out of 100, once every evaluation result is in." })),
|
|
1037
1035
|
not_evaluated_reason: Schema.OptionFromOptionalKey(NotEvaluatedReason),
|
|
1038
1036
|
refusal: Schema.OptionFromOptionalKey(Schema.String.annotate({ description: "Why its run could not start." })),
|
|
@@ -1244,6 +1242,9 @@ const Secrets = Schema.Struct({
|
|
|
1244
1242
|
IDENTITY_PROVIDER_CLIENT_SECRET: Secret,
|
|
1245
1243
|
SESSION_SECRET: Secret,
|
|
1246
1244
|
VERCEL_CLIENT_SECRET: Secret,
|
|
1245
|
+
AGENTMAIL_API_KEY: Secret,
|
|
1246
|
+
BROWSER_USE_API_KEY: Secret,
|
|
1247
|
+
IPROYAL_API_TOKEN: Schema.optionalKey(Secret),
|
|
1247
1248
|
SENTRY_DSN: Schema.optionalKey(Schema.Redacted(SentryDsn))
|
|
1248
1249
|
});
|
|
1249
1250
|
const Variables = Schema.Struct({
|
|
@@ -1255,6 +1256,7 @@ const Variables = Schema.Struct({
|
|
|
1255
1256
|
FILES_ENDPOINT: Schema.optionalKey(SecureUrl),
|
|
1256
1257
|
CONNECTION_RETURN_ORIGINS: Origins.pipe(Schema.withDecodingDefaultKey(Effect.succeed(""))),
|
|
1257
1258
|
EGRESS_IPS: IpAddresses.pipe(Schema.withDecodingDefaultKey(Effect.succeed(""))),
|
|
1259
|
+
TRUSTED_PROXY_NETWORKS: Schema.fromJsonString(Schema.Array(Schema.IpNetworkFromString)).pipe(Schema.withDecodingDefaultKey(Effect.succeed("[]"))),
|
|
1258
1260
|
DATABASE_HOST: Schema.NonEmptyString,
|
|
1259
1261
|
DATABASE_PORT: Port.pipe(Schema.withDecodingDefaultKey(Effect.succeed(5432))),
|
|
1260
1262
|
DATABASE_NAME: Schema.NonEmptyString.pipe(Schema.withDecodingDefaultKey(Effect.succeed("app"))),
|
|
@@ -1329,6 +1331,11 @@ const AGENT_RUNNER_ENV = [
|
|
|
1329
1331
|
...GATEWAY_ENV,
|
|
1330
1332
|
...CONNECTIONS_ENV
|
|
1331
1333
|
];
|
|
1334
|
+
const WEB_HARNESSES_ENV = [
|
|
1335
|
+
"AGENTMAIL_API_KEY",
|
|
1336
|
+
"BROWSER_USE_API_KEY",
|
|
1337
|
+
"IPROYAL_API_TOKEN"
|
|
1338
|
+
];
|
|
1332
1339
|
const LOG_ENV = ["LOG_FORMAT", "LOG_LEVEL"];
|
|
1333
1340
|
const OBSERVABILITY_ENV = [
|
|
1334
1341
|
"SENTRY_DSN",
|
|
@@ -1342,18 +1349,20 @@ const SERVICE_ENV = [
|
|
|
1342
1349
|
"TYPESAFE_API_KEY",
|
|
1343
1350
|
"PORT",
|
|
1344
1351
|
"EGRESS_IPS",
|
|
1352
|
+
"TRUSTED_PROXY_NETWORKS",
|
|
1345
1353
|
...LOG_ENV,
|
|
1346
1354
|
...OBSERVABILITY_ENV,
|
|
1347
1355
|
...AGENT_RUNNER_ENV,
|
|
1348
1356
|
...PAYMENTS_ENV,
|
|
1349
1357
|
...IDENTITY_ENV,
|
|
1350
|
-
...TRAFFIC_ENV
|
|
1358
|
+
...TRAFFIC_ENV,
|
|
1359
|
+
...WEB_HARNESSES_ENV
|
|
1351
1360
|
];
|
|
1352
1361
|
const isDatabaseVariable = (name) => DATABASE_ENV.some((databaseName) => databaseName === name);
|
|
1353
1362
|
SERVICE_ENV.flatMap((name) => isSecret(name) && !isDatabaseVariable(name) ? [name] : []);
|
|
1354
1363
|
const readEnv = (...names) => Config.schema(Env.mapFields(Struct.pick(names)));
|
|
1355
1364
|
// package.json
|
|
1356
|
-
var version = "0.
|
|
1365
|
+
var version = "0.17.1";
|
|
1357
1366
|
// src/connections.ts
|
|
1358
1367
|
const encodeConnection = Schema.encodeEffect(Schema.fromJsonString(Connection, { space: 2 }));
|
|
1359
1368
|
const encodeConnections = Schema.encodeEffect(Schema.fromJsonString(List(Connection), { space: 2 }));
|
|
@@ -1788,7 +1797,7 @@ const follow = Command.make("follow", {
|
|
|
1788
1797
|
lastSeen = Option.orElse(yield* followOnce(lastSeen), () => lastSeen);
|
|
1789
1798
|
const run = yield* client.runs.get({ params: { id } });
|
|
1790
1799
|
if (run.status !== "ended") continue;
|
|
1791
|
-
if (run.end_reason === "
|
|
1800
|
+
if (run.end_reason === "finished" || run.end_reason === "idle_timeout") return;
|
|
1792
1801
|
return yield* new RunUnfinished({
|
|
1793
1802
|
id,
|
|
1794
1803
|
endReason: run.end_reason
|