@withgauge/cli 0.12.1 → 0.14.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 +24 -5
- package/dist/index.js +1234 -1510
- package/package.json +4 -2
- package/scripts/install-skill.mjs +64 -0
package/dist/index.js
CHANGED
|
@@ -755,28 +755,180 @@ var canarySchema = z8.object({
|
|
|
755
755
|
});
|
|
756
756
|
var canaryListSchema = z8.object({ items: z8.array(canarySchema) });
|
|
757
757
|
|
|
758
|
-
// ../packages/api-schemas/src/
|
|
758
|
+
// ../packages/api-schemas/src/catalog.ts
|
|
759
759
|
import { z as z9 } from "zod";
|
|
760
|
+
var key = z9.string().trim().min(1).max(200);
|
|
761
|
+
var tokens = z9.number().int().positive().max(1e8);
|
|
762
|
+
var capabilities = {
|
|
763
|
+
tools: z9.boolean().default(true),
|
|
764
|
+
images: z9.boolean().default(false),
|
|
765
|
+
reasoning: z9.boolean().default(true),
|
|
766
|
+
streaming: z9.boolean().default(true)
|
|
767
|
+
};
|
|
768
|
+
var catalogReleaseSchema = z9.object({
|
|
769
|
+
harness: z9.enum(["claude-code", "codex", "pi", "opencode"]),
|
|
770
|
+
releaseVersion: key,
|
|
771
|
+
executableVersion: key,
|
|
772
|
+
distribution: key,
|
|
773
|
+
artifactDigest: key,
|
|
774
|
+
sandboxImageDigest: key,
|
|
775
|
+
adapterRevision: key,
|
|
776
|
+
eventContractRevision: key,
|
|
777
|
+
runtimeVersion: key,
|
|
778
|
+
freestyleSnapshotId: z9.string().regex(/^sh-[a-f0-9]{32}$/)
|
|
779
|
+
}).strict();
|
|
780
|
+
var catalogManifestSchema = z9.object({
|
|
781
|
+
revision: key,
|
|
782
|
+
releases: z9.array(catalogReleaseSchema).max(4).default([]),
|
|
783
|
+
models: z9.array(
|
|
784
|
+
z9.object({
|
|
785
|
+
slug: key,
|
|
786
|
+
displayName: key,
|
|
787
|
+
family: key,
|
|
788
|
+
trainingDataCutoff: key.nullable().optional(),
|
|
789
|
+
provider: key,
|
|
790
|
+
providerModelId: key,
|
|
791
|
+
accountRef: key.optional(),
|
|
792
|
+
// Reuse an existing deployment when qualifying a new runtime or new rates.
|
|
793
|
+
deploymentRevision: key.optional(),
|
|
794
|
+
protocol: z9.enum([
|
|
795
|
+
"ANTHROPIC_MESSAGES",
|
|
796
|
+
"OPENAI_RESPONSES",
|
|
797
|
+
"OPENAI_CHAT_COMPLETIONS",
|
|
798
|
+
"GOOGLE_GENERATIVE_LANGUAGE"
|
|
799
|
+
]),
|
|
800
|
+
contextWindowTokens: tokens,
|
|
801
|
+
maxOutputTokens: tokens.nullable(),
|
|
802
|
+
...capabilities,
|
|
803
|
+
pricing: z9.object({
|
|
804
|
+
revision: key.optional(),
|
|
805
|
+
effectiveFrom: z9.iso.datetime(),
|
|
806
|
+
input: z9.number().nonnegative(),
|
|
807
|
+
output: z9.number().nonnegative(),
|
|
808
|
+
cacheRead: z9.number().nonnegative().nullable().default(null),
|
|
809
|
+
cacheWrite: z9.number().nonnegative().nullable().default(null)
|
|
810
|
+
}).strict(),
|
|
811
|
+
harnesses: z9.array(
|
|
812
|
+
z9.object({
|
|
813
|
+
slug: z9.enum(["claude-code", "codex", "pi", "opencode"]),
|
|
814
|
+
releaseVersion: key,
|
|
815
|
+
configRecipe: key,
|
|
816
|
+
contextWindowTokens: tokens.optional(),
|
|
817
|
+
maxOutputTokens: tokens.nullable().optional(),
|
|
818
|
+
resume: z9.boolean().default(false)
|
|
819
|
+
}).strict()
|
|
820
|
+
).min(1).max(4)
|
|
821
|
+
}).strict()
|
|
822
|
+
).min(1).max(100)
|
|
823
|
+
}).strict().superRefine((manifest, ctx) => {
|
|
824
|
+
const cells = /* @__PURE__ */ new Set();
|
|
825
|
+
for (const model of manifest.models) {
|
|
826
|
+
for (const harness of model.harnesses) {
|
|
827
|
+
const id = `${model.slug}:${harness.slug}`;
|
|
828
|
+
if (cells.has(id))
|
|
829
|
+
ctx.addIssue({ code: "custom", message: `Duplicate cell ${id}` });
|
|
830
|
+
cells.add(id);
|
|
831
|
+
const protocol = harness.slug === "claude-code" ? "ANTHROPIC_MESSAGES" : harness.slug === "codex" ? "OPENAI_RESPONSES" : "OPENAI_CHAT_COMPLETIONS";
|
|
832
|
+
if (model.protocol !== protocol)
|
|
833
|
+
ctx.addIssue({
|
|
834
|
+
code: "custom",
|
|
835
|
+
message: `Unsupported harness protocol for ${id}: expected ${protocol}`
|
|
836
|
+
});
|
|
837
|
+
if ((harness.contextWindowTokens ?? model.contextWindowTokens) > model.contextWindowTokens)
|
|
838
|
+
ctx.addIssue({
|
|
839
|
+
code: "custom",
|
|
840
|
+
message: `Harness context exceeds deployment for ${id}`
|
|
841
|
+
});
|
|
842
|
+
if (model.maxOutputTokens !== null && harness.maxOutputTokens != null && harness.maxOutputTokens > model.maxOutputTokens)
|
|
843
|
+
ctx.addIssue({
|
|
844
|
+
code: "custom",
|
|
845
|
+
message: `Harness output exceeds deployment for ${id}`
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const releases = /* @__PURE__ */ new Set();
|
|
850
|
+
for (const release of manifest.releases) {
|
|
851
|
+
const id = `${release.harness}:${release.releaseVersion}`;
|
|
852
|
+
if (releases.has(id))
|
|
853
|
+
ctx.addIssue({ code: "custom", message: `Duplicate release ${id}` });
|
|
854
|
+
releases.add(id);
|
|
855
|
+
if (!manifest.models.some(
|
|
856
|
+
(m) => m.harnesses.some(
|
|
857
|
+
(h) => h.slug === release.harness && h.releaseVersion === release.releaseVersion
|
|
858
|
+
)
|
|
859
|
+
))
|
|
860
|
+
ctx.addIssue({ code: "custom", message: `Unused release ${id}` });
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
var catalogRequestSchema = z9.object({
|
|
864
|
+
action: z9.enum([
|
|
865
|
+
"plan",
|
|
866
|
+
"apply",
|
|
867
|
+
"canary",
|
|
868
|
+
"status",
|
|
869
|
+
"activate",
|
|
870
|
+
"disable"
|
|
871
|
+
]),
|
|
872
|
+
manifest: catalogManifestSchema,
|
|
873
|
+
runIds: z9.array(key).max(400).optional(),
|
|
874
|
+
force: z9.boolean().default(false)
|
|
875
|
+
}).strict().superRefine((input, ctx) => {
|
|
876
|
+
if (input.force && input.action !== "activate")
|
|
877
|
+
ctx.addIssue({
|
|
878
|
+
code: "custom",
|
|
879
|
+
message: "force is only supported by activate"
|
|
880
|
+
});
|
|
881
|
+
if (input.runIds && !["activate", "status"].includes(input.action))
|
|
882
|
+
ctx.addIssue({
|
|
883
|
+
code: "custom",
|
|
884
|
+
message: "runIds are only supported by activate or status"
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
function pendingCatalogManifest(manifest, cells) {
|
|
888
|
+
const models = manifest.models.map((model) => ({
|
|
889
|
+
...model,
|
|
890
|
+
harnesses: model.harnesses.filter(
|
|
891
|
+
(harness) => !cells.some(
|
|
892
|
+
(cell2) => cell2.model === model.slug && cell2.harness === harness.slug && cell2.admission === "PUBLIC"
|
|
893
|
+
)
|
|
894
|
+
)
|
|
895
|
+
})).filter((model) => model.harnesses.length > 0);
|
|
896
|
+
if (!models.length) return null;
|
|
897
|
+
return {
|
|
898
|
+
...manifest,
|
|
899
|
+
models,
|
|
900
|
+
releases: manifest.releases.filter(
|
|
901
|
+
(release) => models.some(
|
|
902
|
+
(model) => model.harnesses.some(
|
|
903
|
+
(harness) => harness.slug === release.harness && harness.releaseVersion === release.releaseVersion
|
|
904
|
+
)
|
|
905
|
+
)
|
|
906
|
+
)
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// ../packages/api-schemas/src/checkpoints.ts
|
|
911
|
+
import { z as z10 } from "zod";
|
|
760
912
|
var CHECKPOINT_STORE_VERSION = 2;
|
|
761
913
|
var ALIGNED_CHECKPOINT_SUPERVISOR_ARTIFACT = "0.0.76-byok-ha-26071639";
|
|
762
914
|
var ALIGNED_RUNSC_VERSION = "release-20260112.0";
|
|
763
915
|
var ALIGNED_RUNSC_PLATFORM = "systrap";
|
|
764
916
|
var SHA256_PATTERN = /^sha256:[0-9a-f]{64}$/;
|
|
765
917
|
var CHECKPOINT_ARTIFACT_PATTERN = /^alg-checkpoint:v2:sha256:[0-9a-f]{64}$/;
|
|
766
|
-
var sha256DigestSchema =
|
|
918
|
+
var sha256DigestSchema = z10.custom(
|
|
767
919
|
(value) => typeof value === "string" && SHA256_PATTERN.test(value),
|
|
768
920
|
"expected a sha256:<64 lowercase hex> digest"
|
|
769
921
|
);
|
|
770
|
-
var checkpointArtifactRefSchema =
|
|
922
|
+
var checkpointArtifactRefSchema = z10.custom(
|
|
771
923
|
(value) => typeof value === "string" && CHECKPOINT_ARTIFACT_PATTERN.test(value),
|
|
772
924
|
"expected an alg-checkpoint:v2 artifact reference"
|
|
773
925
|
);
|
|
774
|
-
var publicArtifactScopeSchema =
|
|
775
|
-
var orgArtifactScopeSchema =
|
|
776
|
-
kind:
|
|
777
|
-
organizationId:
|
|
926
|
+
var publicArtifactScopeSchema = z10.object({ kind: z10.literal("public") });
|
|
927
|
+
var orgArtifactScopeSchema = z10.object({
|
|
928
|
+
kind: z10.literal("org"),
|
|
929
|
+
organizationId: z10.string().min(1)
|
|
778
930
|
});
|
|
779
|
-
var artifactScopeSchema =
|
|
931
|
+
var artifactScopeSchema = z10.discriminatedUnion("kind", [
|
|
780
932
|
publicArtifactScopeSchema,
|
|
781
933
|
orgArtifactScopeSchema
|
|
782
934
|
]);
|
|
@@ -792,27 +944,27 @@ function manifestScopeReferenceViolation(manifestScope, referenced) {
|
|
|
792
944
|
}
|
|
793
945
|
return "a manifest must not reference another organization's object";
|
|
794
946
|
}
|
|
795
|
-
var checkpointStorePrincipalSchema =
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
kind:
|
|
799
|
-
organizationId:
|
|
947
|
+
var checkpointStorePrincipalSchema = z10.discriminatedUnion("kind", [
|
|
948
|
+
z10.object({ kind: z10.literal("system") }),
|
|
949
|
+
z10.object({
|
|
950
|
+
kind: z10.literal("organization"),
|
|
951
|
+
organizationId: z10.string().min(1)
|
|
800
952
|
})
|
|
801
953
|
]);
|
|
802
|
-
var checkpointChunkSchema =
|
|
803
|
-
ordinal:
|
|
954
|
+
var checkpointChunkSchema = z10.object({
|
|
955
|
+
ordinal: z10.number().int().nonnegative(),
|
|
804
956
|
digest: sha256DigestSchema,
|
|
805
957
|
rawDigest: sha256DigestSchema,
|
|
806
|
-
rawBytes:
|
|
807
|
-
storedBytes:
|
|
958
|
+
rawBytes: z10.number().int().positive(),
|
|
959
|
+
storedBytes: z10.number().int().positive()
|
|
808
960
|
});
|
|
809
|
-
var chunkedPayloadSchema =
|
|
810
|
-
format:
|
|
961
|
+
var chunkedPayloadSchema = z10.object({
|
|
962
|
+
format: z10.enum([
|
|
811
963
|
"canonical-workspace-chunked-zstd-v1",
|
|
812
964
|
"runsc-checkpoint-chunked-zstd-v1",
|
|
813
965
|
"overlay-upper-chunked-zstd-v1"
|
|
814
966
|
]),
|
|
815
|
-
chunks:
|
|
967
|
+
chunks: z10.array(checkpointChunkSchema).min(1).superRefine((chunks, context) => {
|
|
816
968
|
for (const [index, chunk] of chunks.entries()) {
|
|
817
969
|
if (chunk.ordinal !== index) {
|
|
818
970
|
context.addIssue({
|
|
@@ -825,10 +977,10 @@ var chunkedPayloadSchema = z9.object({
|
|
|
825
977
|
})
|
|
826
978
|
});
|
|
827
979
|
var canonicalBaselinePayloadSchema = chunkedPayloadSchema.extend({
|
|
828
|
-
format:
|
|
980
|
+
format: z10.literal("canonical-workspace-chunked-zstd-v1")
|
|
829
981
|
});
|
|
830
|
-
var nydusBaselineBlobSchema =
|
|
831
|
-
nydusBlobId:
|
|
982
|
+
var nydusBaselineBlobSchema = z10.object({
|
|
983
|
+
nydusBlobId: z10.string().regex(/^[0-9a-f]{64}$/),
|
|
832
984
|
object: checkpointChunkSchema,
|
|
833
985
|
/**
|
|
834
986
|
* CAS scope this blob's object actually lives in, when it is NOT the manifest's own
|
|
@@ -846,34 +998,34 @@ var nydusBaselineBlobSchema = z9.object({
|
|
|
846
998
|
*/
|
|
847
999
|
scope: artifactScopeSchema.optional()
|
|
848
1000
|
});
|
|
849
|
-
var nydusBaselinePayloadSchema =
|
|
850
|
-
format:
|
|
851
|
-
fsVersion:
|
|
1001
|
+
var nydusBaselinePayloadSchema = z10.object({
|
|
1002
|
+
format: z10.literal("nydus-rafs-v6"),
|
|
1003
|
+
fsVersion: z10.literal(6),
|
|
852
1004
|
/** Always the manifest's own scope: a build always produces its own bootstrap, so
|
|
853
1005
|
* only inherited BLOBS can be foreign. Confining the override to where a foreign
|
|
854
1006
|
* scope is possible is what keeps the invariant checkable. */
|
|
855
1007
|
bootstrap: checkpointChunkSchema,
|
|
856
|
-
blobs:
|
|
1008
|
+
blobs: z10.array(nydusBaselineBlobSchema)
|
|
857
1009
|
});
|
|
858
|
-
var workspaceBaselinePayloadSchema =
|
|
1010
|
+
var workspaceBaselinePayloadSchema = z10.discriminatedUnion("format", [
|
|
859
1011
|
canonicalBaselinePayloadSchema,
|
|
860
1012
|
nydusBaselinePayloadSchema
|
|
861
1013
|
]);
|
|
862
|
-
var workspaceBaselineManifestV2Schema =
|
|
863
|
-
schemaVersion:
|
|
864
|
-
kind:
|
|
1014
|
+
var workspaceBaselineManifestV2Schema = z10.object({
|
|
1015
|
+
schemaVersion: z10.literal(CHECKPOINT_STORE_VERSION),
|
|
1016
|
+
kind: z10.literal("workspace-baseline"),
|
|
865
1017
|
scope: artifactScopeSchema,
|
|
866
1018
|
workspaceRoot: sha256DigestSchema,
|
|
867
1019
|
payload: workspaceBaselinePayloadSchema,
|
|
868
|
-
repo:
|
|
869
|
-
canonicalUrl:
|
|
870
|
-
requestedRef:
|
|
871
|
-
resolvedCommit:
|
|
1020
|
+
repo: z10.object({
|
|
1021
|
+
canonicalUrl: z10.string().url(),
|
|
1022
|
+
requestedRef: z10.string().min(1),
|
|
1023
|
+
resolvedCommit: z10.string().regex(/^[0-9a-f]{40,64}$/)
|
|
872
1024
|
}),
|
|
873
|
-
recipe:
|
|
1025
|
+
recipe: z10.object({
|
|
874
1026
|
digest: sha256DigestSchema,
|
|
875
1027
|
sandboxImageDigest: sha256DigestSchema,
|
|
876
|
-
architecture:
|
|
1028
|
+
architecture: z10.string().min(1)
|
|
877
1029
|
})
|
|
878
1030
|
}).superRefine((manifest, context) => {
|
|
879
1031
|
if (manifest.payload.format !== "nydus-rafs-v6") return;
|
|
@@ -891,94 +1043,111 @@ var workspaceBaselineManifestV2Schema = z9.object({
|
|
|
891
1043
|
}
|
|
892
1044
|
}
|
|
893
1045
|
});
|
|
894
|
-
var checkpointBoundaryV2Schema =
|
|
895
|
-
kind:
|
|
896
|
-
turn:
|
|
897
|
-
ordinal:
|
|
898
|
-
toolName:
|
|
899
|
-
url:
|
|
1046
|
+
var checkpointBoundaryV2Schema = z10.object({
|
|
1047
|
+
kind: z10.enum(["tool_call", "assistant_message", "user_message"]),
|
|
1048
|
+
turn: z10.number().int().nonnegative(),
|
|
1049
|
+
ordinal: z10.number().int().nonnegative(),
|
|
1050
|
+
toolName: z10.string().optional(),
|
|
1051
|
+
url: z10.string().url().optional()
|
|
900
1052
|
});
|
|
901
|
-
var memoryDiskManifestV2Schema =
|
|
902
|
-
schemaVersion:
|
|
903
|
-
kind:
|
|
1053
|
+
var memoryDiskManifestV2Schema = z10.object({
|
|
1054
|
+
schemaVersion: z10.literal(CHECKPOINT_STORE_VERSION),
|
|
1055
|
+
kind: z10.literal("runsc-memory-disk"),
|
|
904
1056
|
scope: orgArtifactScopeSchema,
|
|
905
1057
|
boundary: checkpointBoundaryV2Schema,
|
|
906
1058
|
memory: chunkedPayloadSchema.extend({
|
|
907
|
-
format:
|
|
1059
|
+
format: z10.literal("runsc-checkpoint-chunked-zstd-v1")
|
|
908
1060
|
}),
|
|
909
|
-
disk:
|
|
1061
|
+
disk: z10.object({
|
|
910
1062
|
baselineArtifact: checkpointArtifactRefSchema,
|
|
911
1063
|
baselineScope: artifactScopeSchema,
|
|
912
1064
|
baselineWorkspaceRoot: sha256DigestSchema,
|
|
913
1065
|
delta: chunkedPayloadSchema.extend({
|
|
914
|
-
format:
|
|
1066
|
+
format: z10.literal("overlay-upper-chunked-zstd-v1")
|
|
915
1067
|
})
|
|
916
1068
|
}),
|
|
917
|
-
runtime:
|
|
918
|
-
runscVersion:
|
|
919
|
-
platform:
|
|
1069
|
+
runtime: z10.object({
|
|
1070
|
+
runscVersion: z10.string().min(1),
|
|
1071
|
+
platform: z10.string().min(1),
|
|
920
1072
|
configDigest: sha256DigestSchema,
|
|
921
|
-
supervisorArtifact:
|
|
922
|
-
architecture:
|
|
1073
|
+
supervisorArtifact: z10.string().min(1),
|
|
1074
|
+
architecture: z10.string().min(1)
|
|
923
1075
|
}),
|
|
924
|
-
memorySharing:
|
|
1076
|
+
memorySharing: z10.literal("none")
|
|
925
1077
|
});
|
|
926
|
-
var workspaceSourceSchema =
|
|
927
|
-
|
|
928
|
-
kind:
|
|
1078
|
+
var workspaceSourceSchema = z10.discriminatedUnion("kind", [
|
|
1079
|
+
z10.object({
|
|
1080
|
+
kind: z10.literal("nvme-baseline"),
|
|
929
1081
|
artifact: checkpointArtifactRefSchema,
|
|
930
1082
|
workspaceRoot: sha256DigestSchema,
|
|
931
1083
|
scope: artifactScopeSchema
|
|
932
1084
|
}),
|
|
933
|
-
|
|
934
|
-
kind:
|
|
1085
|
+
z10.object({
|
|
1086
|
+
kind: z10.literal("memory-disk"),
|
|
935
1087
|
artifact: checkpointArtifactRefSchema,
|
|
936
1088
|
boundary: checkpointBoundaryV2Schema
|
|
937
1089
|
}),
|
|
938
|
-
|
|
939
|
-
kind:
|
|
940
|
-
volumeSnapshot:
|
|
941
|
-
resumeSessionId:
|
|
1090
|
+
z10.object({
|
|
1091
|
+
kind: z10.literal("legacy-ebs"),
|
|
1092
|
+
volumeSnapshot: z10.string().min(1),
|
|
1093
|
+
resumeSessionId: z10.string().min(1).optional()
|
|
942
1094
|
})
|
|
943
1095
|
]);
|
|
944
|
-
var baselinePayloadFormatSchema =
|
|
1096
|
+
var baselinePayloadFormatSchema = z10.enum([
|
|
945
1097
|
"canonical-workspace-chunked-zstd-v1",
|
|
946
1098
|
"runsc-checkpoint-chunked-zstd-v1",
|
|
947
1099
|
"overlay-upper-chunked-zstd-v1",
|
|
948
1100
|
"nydus-rafs-v6"
|
|
949
1101
|
]);
|
|
950
|
-
var checkpointStoreCapabilitiesSchema =
|
|
951
|
-
storeVersion:
|
|
952
|
-
manifestSchemas:
|
|
953
|
-
payloadFormats:
|
|
954
|
-
runtime:
|
|
955
|
-
runscVersion:
|
|
956
|
-
platform:
|
|
957
|
-
supervisorArtifact:
|
|
1102
|
+
var checkpointStoreCapabilitiesSchema = z10.object({
|
|
1103
|
+
storeVersion: z10.literal(CHECKPOINT_STORE_VERSION),
|
|
1104
|
+
manifestSchemas: z10.array(z10.literal(CHECKPOINT_STORE_VERSION)).min(1),
|
|
1105
|
+
payloadFormats: z10.array(baselinePayloadFormatSchema),
|
|
1106
|
+
runtime: z10.object({
|
|
1107
|
+
runscVersion: z10.literal(ALIGNED_RUNSC_VERSION),
|
|
1108
|
+
platform: z10.literal(ALIGNED_RUNSC_PLATFORM),
|
|
1109
|
+
supervisorArtifact: z10.literal(ALIGNED_CHECKPOINT_SUPERVISOR_ARTIFACT)
|
|
958
1110
|
})
|
|
959
1111
|
});
|
|
960
1112
|
|
|
961
1113
|
// ../packages/api-schemas/src/cli-auth.ts
|
|
962
|
-
import { z as
|
|
1114
|
+
import { z as z11 } from "zod";
|
|
963
1115
|
var PKCE_VERIFIER_PATTERN = /^[A-Za-z0-9._~-]{43,128}$/;
|
|
964
|
-
var cliAuthorizationTokenRequestSchema =
|
|
965
|
-
code:
|
|
966
|
-
codeVerifier:
|
|
1116
|
+
var cliAuthorizationTokenRequestSchema = z11.object({
|
|
1117
|
+
code: z11.string().min(1).max(512),
|
|
1118
|
+
codeVerifier: z11.string().regex(PKCE_VERIFIER_PATTERN)
|
|
967
1119
|
});
|
|
968
|
-
var cliAuthorizationTokenResponseSchema =
|
|
969
|
-
accessToken:
|
|
970
|
-
tokenType:
|
|
971
|
-
expiresAt:
|
|
1120
|
+
var cliAuthorizationTokenResponseSchema = z11.object({
|
|
1121
|
+
accessToken: z11.string(),
|
|
1122
|
+
tokenType: z11.literal("bearer"),
|
|
1123
|
+
expiresAt: z11.string().nullable()
|
|
972
1124
|
});
|
|
973
1125
|
|
|
974
1126
|
// ../packages/api-schemas/src/connections.ts
|
|
975
|
-
import { z as
|
|
1127
|
+
import { z as z12 } from "zod";
|
|
976
1128
|
var MAX_CONNECTION_SET_ENTRIES = 32;
|
|
977
|
-
var exactHostSchema =
|
|
1129
|
+
var exactHostSchema = z12.string().min(1).max(253).regex(
|
|
978
1130
|
/^(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/
|
|
979
1131
|
);
|
|
980
|
-
var headerNameSchema =
|
|
981
|
-
var parameterNameSchema =
|
|
1132
|
+
var headerNameSchema = z12.string().min(1).max(128).regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/);
|
|
1133
|
+
var parameterNameSchema = z12.string().min(1).max(128).regex(/^[A-Za-z0-9._~-]+$/);
|
|
1134
|
+
var credentialEnvKeySchema = z12.string().min(1).max(64).regex(/^[A-Z][A-Z0-9_]*$/);
|
|
1135
|
+
var basicCredentialFieldSchema = z12.string().min(1).max(4096).refine(
|
|
1136
|
+
(value) => [...value].every(
|
|
1137
|
+
(character) => character.charCodeAt(0) >= 32 && character.charCodeAt(0) !== 127
|
|
1138
|
+
),
|
|
1139
|
+
"Credentials cannot contain control characters"
|
|
1140
|
+
);
|
|
1141
|
+
var basicCredentialSchema = z12.object({
|
|
1142
|
+
username: basicCredentialFieldSchema.refine(
|
|
1143
|
+
(value) => !value.includes(":"),
|
|
1144
|
+
"Basic username cannot contain a colon"
|
|
1145
|
+
),
|
|
1146
|
+
password: basicCredentialFieldSchema
|
|
1147
|
+
}).strict();
|
|
1148
|
+
var basicCredentialDocumentSchema = basicCredentialSchema.extend({
|
|
1149
|
+
version: z12.literal("alg.connection-basic.v1")
|
|
1150
|
+
});
|
|
982
1151
|
function safeCredentialPathTemplate(value) {
|
|
983
1152
|
if (value.split("{credential}").length !== 2 || /[\\?#]/.test(value) || [...value].some((character) => {
|
|
984
1153
|
const code = character.charCodeAt(0);
|
|
@@ -1003,124 +1172,148 @@ function safeCredentialPathTemplate(value) {
|
|
|
1003
1172
|
}
|
|
1004
1173
|
return false;
|
|
1005
1174
|
}
|
|
1006
|
-
var hostedConnectionPresentationSchema =
|
|
1175
|
+
var hostedConnectionPresentationSchema = z12.discriminatedUnion(
|
|
1007
1176
|
"style",
|
|
1008
1177
|
[
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
style:
|
|
1178
|
+
z12.object({ style: z12.literal("bearer") }).strict(),
|
|
1179
|
+
z12.object({
|
|
1180
|
+
style: z12.literal("header"),
|
|
1012
1181
|
headerName: headerNameSchema,
|
|
1013
|
-
valuePrefix:
|
|
1182
|
+
valuePrefix: z12.string().max(256)
|
|
1183
|
+
}).strict(),
|
|
1184
|
+
z12.object({
|
|
1185
|
+
style: z12.literal("basic"),
|
|
1186
|
+
fields: z12.object({
|
|
1187
|
+
usernameKey: credentialEnvKeySchema,
|
|
1188
|
+
passwordKey: credentialEnvKeySchema
|
|
1189
|
+
}).strict().refine(
|
|
1190
|
+
(fields) => fields.usernameKey !== fields.passwordKey,
|
|
1191
|
+
"Basic username and password placeholders must differ"
|
|
1192
|
+
).optional()
|
|
1014
1193
|
}).strict(),
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
pathTemplate: z11.string().startsWith("/").max(512).refine(
|
|
1194
|
+
z12.object({ style: z12.literal("query"), queryParam: parameterNameSchema }).strict(),
|
|
1195
|
+
z12.object({
|
|
1196
|
+
style: z12.literal("path"),
|
|
1197
|
+
pathTemplate: z12.string().startsWith("/").max(512).refine(
|
|
1020
1198
|
safeCredentialPathTemplate,
|
|
1021
1199
|
"path template must contain one credential in an unambiguous path"
|
|
1022
1200
|
)
|
|
1023
1201
|
}).strict()
|
|
1024
1202
|
]
|
|
1025
1203
|
);
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1204
|
+
function pairedBasicGrantIsValid(input) {
|
|
1205
|
+
const presentation = input.presentation;
|
|
1206
|
+
return presentation.style !== "basic" || !presentation.fields || input.credentialKind === "static" && input.credentialKey === presentation.fields.usernameKey;
|
|
1207
|
+
}
|
|
1208
|
+
var hostedConnectionDeliveryV1Schema = z12.object({
|
|
1209
|
+
version: z12.literal("alg.connection-hosted-delivery.v1"),
|
|
1210
|
+
allowedHosts: z12.array(exactHostSchema).min(1).max(32),
|
|
1029
1211
|
presentation: hostedConnectionPresentationSchema,
|
|
1030
|
-
credentialKind:
|
|
1031
|
-
profileGrantDigest:
|
|
1032
|
-
}).strict()
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1212
|
+
credentialKind: z12.enum(["static", "oauth"]),
|
|
1213
|
+
profileGrantDigest: z12.string().regex(/^[0-9a-f]{64}$/)
|
|
1214
|
+
}).strict().refine(
|
|
1215
|
+
(delivery) => delivery.presentation.style !== "basic" || !delivery.presentation.fields || delivery.credentialKind === "static",
|
|
1216
|
+
"Paired Basic credentials must be static"
|
|
1217
|
+
);
|
|
1218
|
+
var connectionSetEntrySchema = z12.object({
|
|
1219
|
+
connectionId: z12.string().min(1),
|
|
1220
|
+
handle: z12.string().min(1),
|
|
1221
|
+
profileId: z12.string().min(1),
|
|
1222
|
+
profileSlug: z12.string().min(1),
|
|
1223
|
+
providerName: z12.string().min(1),
|
|
1224
|
+
credentialKey: z12.string().min(1),
|
|
1040
1225
|
// Empty is the legacy OpenShell representation for basic/query/path. Hosted
|
|
1041
1226
|
// delivery uses the discriminated presentation below and never invents one.
|
|
1042
|
-
headerName:
|
|
1043
|
-
headerValuePrefix:
|
|
1227
|
+
headerName: z12.string(),
|
|
1228
|
+
headerValuePrefix: z12.string(),
|
|
1044
1229
|
hostedDelivery: hostedConnectionDeliveryV1Schema.optional()
|
|
1045
|
-
}).strict()
|
|
1046
|
-
|
|
1230
|
+
}).strict().refine(
|
|
1231
|
+
(entry) => !entry.hostedDelivery || pairedBasicGrantIsValid({
|
|
1232
|
+
credentialKey: entry.credentialKey,
|
|
1233
|
+
credentialKind: entry.hostedDelivery.credentialKind,
|
|
1234
|
+
presentation: entry.hostedDelivery.presentation
|
|
1235
|
+
}),
|
|
1236
|
+
"Basic username placeholder must match the connection credential key"
|
|
1237
|
+
);
|
|
1238
|
+
var connectionSetSchema = z12.array(connectionSetEntrySchema).max(
|
|
1047
1239
|
MAX_CONNECTION_SET_ENTRIES,
|
|
1048
1240
|
`a run may attach at most ${MAX_CONNECTION_SET_ENTRIES} connections`
|
|
1049
1241
|
);
|
|
1050
|
-
var connectionSummarySchema =
|
|
1051
|
-
id:
|
|
1052
|
-
handle:
|
|
1053
|
-
providerName:
|
|
1054
|
-
credentialKey:
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1242
|
+
var connectionSummarySchema = z12.object({
|
|
1243
|
+
id: z12.string(),
|
|
1244
|
+
handle: z12.string(),
|
|
1245
|
+
providerName: z12.string(),
|
|
1246
|
+
credentialKey: z12.string(),
|
|
1247
|
+
basicPasswordKey: credentialEnvKeySchema.nullable().optional(),
|
|
1248
|
+
allowedHosts: z12.array(z12.string()),
|
|
1249
|
+
profileSlug: z12.string(),
|
|
1250
|
+
profileLabel: z12.string(),
|
|
1251
|
+
kind: z12.enum(["static", "oauth"]),
|
|
1252
|
+
last4: z12.string().nullable(),
|
|
1253
|
+
createdAt: z12.string()
|
|
1061
1254
|
}).strict();
|
|
1062
|
-
var listConnectionsResponseSchema =
|
|
1255
|
+
var listConnectionsResponseSchema = z12.object({ items: z12.array(connectionSummarySchema) }).strict();
|
|
1063
1256
|
|
|
1064
1257
|
// ../packages/api-schemas/src/dashboards.ts
|
|
1065
|
-
import { z as
|
|
1258
|
+
import { z as z15 } from "zod";
|
|
1066
1259
|
|
|
1067
1260
|
// ../packages/api-schemas/src/query.ts
|
|
1068
|
-
import { z as
|
|
1261
|
+
import { z as z14 } from "zod";
|
|
1069
1262
|
|
|
1070
1263
|
// ../packages/api-schemas/src/stats.ts
|
|
1071
|
-
import { z as
|
|
1264
|
+
import { z as z13 } from "zod";
|
|
1072
1265
|
var BRAND_KINDS2 = ["OWNED", "COMPETITOR", "OTHER"];
|
|
1073
|
-
var brandKindSchema2 =
|
|
1074
|
-
var brandRankingSchema =
|
|
1075
|
-
rank:
|
|
1076
|
-
brandId:
|
|
1077
|
-
brandName:
|
|
1266
|
+
var brandKindSchema2 = z13.enum(BRAND_KINDS2);
|
|
1267
|
+
var brandRankingSchema = z13.object({
|
|
1268
|
+
rank: z13.number().int(),
|
|
1269
|
+
brandId: z13.string(),
|
|
1270
|
+
brandName: z13.string(),
|
|
1078
1271
|
kind: brandKindSchema2,
|
|
1079
|
-
installs:
|
|
1080
|
-
installRate:
|
|
1081
|
-
mentionRate:
|
|
1272
|
+
installs: z13.number().int(),
|
|
1273
|
+
installRate: z13.number(),
|
|
1274
|
+
mentionRate: z13.number(),
|
|
1082
1275
|
/** Movement between the two most recent batch windows; null if not ranked in both. */
|
|
1083
|
-
deltaRank:
|
|
1276
|
+
deltaRank: z13.number().int().nullable()
|
|
1084
1277
|
});
|
|
1085
|
-
var packageRateSchema =
|
|
1086
|
-
ecosystem:
|
|
1087
|
-
name:
|
|
1088
|
-
brandName:
|
|
1278
|
+
var packageRateSchema = z13.object({
|
|
1279
|
+
ecosystem: z13.string(),
|
|
1280
|
+
name: z13.string(),
|
|
1281
|
+
brandName: z13.string().optional(),
|
|
1089
1282
|
kind: brandKindSchema2.optional(),
|
|
1090
|
-
installs:
|
|
1091
|
-
rate:
|
|
1283
|
+
installs: z13.number().int(),
|
|
1284
|
+
rate: z13.number()
|
|
1092
1285
|
});
|
|
1093
|
-
var brandRateSchema =
|
|
1094
|
-
brandId:
|
|
1095
|
-
brandName:
|
|
1286
|
+
var brandRateSchema = z13.object({
|
|
1287
|
+
brandId: z13.string(),
|
|
1288
|
+
brandName: z13.string(),
|
|
1096
1289
|
kind: brandKindSchema2,
|
|
1097
|
-
installs:
|
|
1098
|
-
rate:
|
|
1290
|
+
installs: z13.number().int(),
|
|
1291
|
+
rate: z13.number()
|
|
1099
1292
|
});
|
|
1100
|
-
var brandFunnelRowSchema =
|
|
1101
|
-
brandId:
|
|
1102
|
-
brandName:
|
|
1293
|
+
var brandFunnelRowSchema = z13.object({
|
|
1294
|
+
brandId: z13.string(),
|
|
1295
|
+
brandName: z13.string(),
|
|
1103
1296
|
kind: brandKindSchema2,
|
|
1104
|
-
mentionRate:
|
|
1105
|
-
installRate:
|
|
1106
|
-
});
|
|
1107
|
-
var domainRateSchema =
|
|
1108
|
-
domain:
|
|
1109
|
-
runs:
|
|
1110
|
-
rate:
|
|
1111
|
-
requests:
|
|
1112
|
-
brandName:
|
|
1113
|
-
owned:
|
|
1114
|
-
});
|
|
1115
|
-
var statsFreshnessSchema =
|
|
1297
|
+
mentionRate: z13.number(),
|
|
1298
|
+
installRate: z13.number()
|
|
1299
|
+
});
|
|
1300
|
+
var domainRateSchema = z13.object({
|
|
1301
|
+
domain: z13.string(),
|
|
1302
|
+
runs: z13.number().int(),
|
|
1303
|
+
rate: z13.number(),
|
|
1304
|
+
requests: z13.number().int(),
|
|
1305
|
+
brandName: z13.string().optional(),
|
|
1306
|
+
owned: z13.boolean().optional()
|
|
1307
|
+
});
|
|
1308
|
+
var statsFreshnessSchema = z13.object({
|
|
1116
1309
|
/** Newest run-ingest time across the org (ISO), or null if nothing ingested. */
|
|
1117
|
-
watermark:
|
|
1310
|
+
watermark: z13.string().nullable(),
|
|
1118
1311
|
/** Runs that succeeded recently but haven't landed in the warehouse yet. */
|
|
1119
|
-
pending:
|
|
1312
|
+
pending: z13.number().int(),
|
|
1120
1313
|
/** False when the freshness read itself failed (distinguish from genuine zero). */
|
|
1121
|
-
available:
|
|
1314
|
+
available: z13.boolean()
|
|
1122
1315
|
});
|
|
1123
|
-
var statsResponseSchema = (item) =>
|
|
1316
|
+
var statsResponseSchema = (item) => z13.object({ items: z13.array(item), freshness: statsFreshnessSchema });
|
|
1124
1317
|
var rankingsResponseSchema = statsResponseSchema(brandRankingSchema);
|
|
1125
1318
|
var installsResponseSchema = statsResponseSchema(packageRateSchema);
|
|
1126
1319
|
var brandsResponseSchema = statsResponseSchema(brandRateSchema);
|
|
@@ -1139,7 +1332,7 @@ var DATASETS = [
|
|
|
1139
1332
|
"tokens",
|
|
1140
1333
|
"brand_rollup"
|
|
1141
1334
|
];
|
|
1142
|
-
var datasetSchema =
|
|
1335
|
+
var datasetSchema = z14.enum(DATASETS);
|
|
1143
1336
|
var WHERE_OPS = [
|
|
1144
1337
|
"eq",
|
|
1145
1338
|
"neq",
|
|
@@ -1151,234 +1344,234 @@ var WHERE_OPS = [
|
|
|
1151
1344
|
"lt",
|
|
1152
1345
|
"lte"
|
|
1153
1346
|
];
|
|
1154
|
-
var whereOpSchema =
|
|
1347
|
+
var whereOpSchema = z14.enum(WHERE_OPS);
|
|
1155
1348
|
var GRANULARITIES = ["day", "week", "month"];
|
|
1156
|
-
var granularitySchema =
|
|
1349
|
+
var granularitySchema = z14.enum(GRANULARITIES);
|
|
1157
1350
|
var DEFAULT_QUERY_LIMIT = 50;
|
|
1158
1351
|
var MAX_QUERY_LIMIT = 1e3;
|
|
1159
|
-
var scalar =
|
|
1160
|
-
var whereClauseSchema =
|
|
1161
|
-
dimension:
|
|
1352
|
+
var scalar = z14.union([z14.string(), z14.number(), z14.boolean()]);
|
|
1353
|
+
var whereClauseSchema = z14.object({
|
|
1354
|
+
dimension: z14.string().min(1),
|
|
1162
1355
|
op: whereOpSchema,
|
|
1163
|
-
value:
|
|
1164
|
-
});
|
|
1165
|
-
var queryFiltersSchema =
|
|
1166
|
-
prompt:
|
|
1167
|
-
visibilityPrompt:
|
|
1168
|
-
preferenceOnly:
|
|
1169
|
-
topic:
|
|
1170
|
-
tag:
|
|
1171
|
-
repo:
|
|
1172
|
-
language:
|
|
1173
|
-
framework:
|
|
1174
|
-
size:
|
|
1175
|
-
agent:
|
|
1356
|
+
value: z14.union([scalar, z14.array(scalar)])
|
|
1357
|
+
});
|
|
1358
|
+
var queryFiltersSchema = z14.object({
|
|
1359
|
+
prompt: z14.string(),
|
|
1360
|
+
visibilityPrompt: z14.array(z14.string()),
|
|
1361
|
+
preferenceOnly: z14.boolean(),
|
|
1362
|
+
topic: z14.array(z14.string()),
|
|
1363
|
+
tag: z14.array(z14.string()),
|
|
1364
|
+
repo: z14.array(z14.string()),
|
|
1365
|
+
language: z14.array(z14.string()),
|
|
1366
|
+
framework: z14.array(z14.string()),
|
|
1367
|
+
size: z14.array(z14.string()),
|
|
1368
|
+
agent: z14.array(z14.string()),
|
|
1176
1369
|
/** Persona UserProfile ids; the NO_PERSONA sentinel = default judge. */
|
|
1177
|
-
persona:
|
|
1178
|
-
model:
|
|
1179
|
-
scenario:
|
|
1180
|
-
experiment:
|
|
1181
|
-
branded:
|
|
1370
|
+
persona: z14.array(z14.string()),
|
|
1371
|
+
model: z14.array(z14.string()),
|
|
1372
|
+
scenario: z14.array(z14.string()),
|
|
1373
|
+
experiment: z14.array(z14.string()),
|
|
1374
|
+
branded: z14.boolean()
|
|
1182
1375
|
}).partial();
|
|
1183
|
-
var dateRangeSchema =
|
|
1184
|
-
since:
|
|
1185
|
-
until:
|
|
1186
|
-
lastDays:
|
|
1376
|
+
var dateRangeSchema = z14.object({
|
|
1377
|
+
since: z14.string(),
|
|
1378
|
+
until: z14.string(),
|
|
1379
|
+
lastDays: z14.number().int().positive()
|
|
1187
1380
|
}).partial();
|
|
1188
|
-
var orderBySchema =
|
|
1381
|
+
var orderBySchema = z14.object({
|
|
1189
1382
|
/** A selected dimension or metric name. */
|
|
1190
|
-
key:
|
|
1191
|
-
dir:
|
|
1383
|
+
key: z14.string().min(1),
|
|
1384
|
+
dir: z14.enum(["asc", "desc"]).default("desc")
|
|
1192
1385
|
});
|
|
1193
|
-
var querySpecSchema =
|
|
1386
|
+
var querySpecSchema = z14.object({
|
|
1194
1387
|
dataset: datasetSchema.default("runs"),
|
|
1195
|
-
dimensions:
|
|
1196
|
-
metrics:
|
|
1388
|
+
dimensions: z14.array(z14.string()).default([]),
|
|
1389
|
+
metrics: z14.array(z14.string()).min(1, "at least one metric is required"),
|
|
1197
1390
|
filters: queryFiltersSchema.default({}),
|
|
1198
|
-
where:
|
|
1391
|
+
where: z14.array(whereClauseSchema).default([]),
|
|
1199
1392
|
dateRange: dateRangeSchema.optional(),
|
|
1200
|
-
orderBy:
|
|
1201
|
-
limit:
|
|
1393
|
+
orderBy: z14.array(orderBySchema).default([]),
|
|
1394
|
+
limit: z14.number().int().min(1).max(MAX_QUERY_LIMIT).default(DEFAULT_QUERY_LIMIT),
|
|
1202
1395
|
granularity: granularitySchema.default("day"),
|
|
1203
1396
|
/** When true, the response echoes the compiled SQL (params bound, not inlined). */
|
|
1204
|
-
explain:
|
|
1397
|
+
explain: z14.boolean().default(false)
|
|
1205
1398
|
});
|
|
1206
|
-
var columnKindSchema =
|
|
1207
|
-
var queryColumnSchema =
|
|
1208
|
-
key:
|
|
1399
|
+
var columnKindSchema = z14.enum(["dimension", "metric"]);
|
|
1400
|
+
var queryColumnSchema = z14.object({
|
|
1401
|
+
key: z14.string(),
|
|
1209
1402
|
kind: columnKindSchema
|
|
1210
1403
|
});
|
|
1211
|
-
var queryRowSchema =
|
|
1212
|
-
|
|
1213
|
-
|
|
1404
|
+
var queryRowSchema = z14.record(
|
|
1405
|
+
z14.string(),
|
|
1406
|
+
z14.union([z14.string(), z14.number(), z14.boolean(), z14.null()])
|
|
1214
1407
|
);
|
|
1215
|
-
var queryResponseSchema =
|
|
1216
|
-
columns:
|
|
1217
|
-
rows:
|
|
1408
|
+
var queryResponseSchema = z14.object({
|
|
1409
|
+
columns: z14.array(queryColumnSchema),
|
|
1410
|
+
rows: z14.array(queryRowSchema),
|
|
1218
1411
|
/** Present only when the request set explain=true. */
|
|
1219
|
-
sql:
|
|
1412
|
+
sql: z14.string().optional(),
|
|
1220
1413
|
freshness: statsFreshnessSchema
|
|
1221
1414
|
});
|
|
1222
|
-
var fieldTypeSchema =
|
|
1415
|
+
var fieldTypeSchema = z14.enum([
|
|
1223
1416
|
"string",
|
|
1224
1417
|
"number",
|
|
1225
1418
|
"rate",
|
|
1226
1419
|
"date",
|
|
1227
1420
|
"boolean"
|
|
1228
1421
|
]);
|
|
1229
|
-
var fieldSchema =
|
|
1230
|
-
name:
|
|
1422
|
+
var fieldSchema = z14.object({
|
|
1423
|
+
name: z14.string(),
|
|
1231
1424
|
type: fieldTypeSchema,
|
|
1232
1425
|
/** One-line human/agent hint. */
|
|
1233
|
-
description:
|
|
1426
|
+
description: z14.string().optional()
|
|
1234
1427
|
});
|
|
1235
|
-
var datasetMetaSchema =
|
|
1428
|
+
var datasetMetaSchema = z14.object({
|
|
1236
1429
|
name: datasetSchema,
|
|
1237
|
-
grain:
|
|
1238
|
-
dimensions:
|
|
1239
|
-
metrics:
|
|
1430
|
+
grain: z14.string(),
|
|
1431
|
+
dimensions: z14.array(fieldSchema),
|
|
1432
|
+
metrics: z14.array(fieldSchema)
|
|
1240
1433
|
});
|
|
1241
|
-
var metadataResponseSchema =
|
|
1242
|
-
datasets:
|
|
1434
|
+
var metadataResponseSchema = z14.object({
|
|
1435
|
+
datasets: z14.array(datasetMetaSchema)
|
|
1243
1436
|
});
|
|
1244
1437
|
|
|
1245
1438
|
// ../packages/api-schemas/src/dashboards.ts
|
|
1246
1439
|
var VIZ_TYPES = ["line", "bar", "table", "kpi"];
|
|
1247
|
-
var vizTypeSchema =
|
|
1248
|
-
var widgetEncodingSchema =
|
|
1249
|
-
x:
|
|
1440
|
+
var vizTypeSchema = z15.enum(VIZ_TYPES);
|
|
1441
|
+
var widgetEncodingSchema = z15.object({
|
|
1442
|
+
x: z15.string(),
|
|
1250
1443
|
// dimension key for the x axis (line)
|
|
1251
|
-
series:
|
|
1444
|
+
series: z15.string(),
|
|
1252
1445
|
// dimension key split into one series per value (line)
|
|
1253
|
-
y:
|
|
1446
|
+
y: z15.array(z15.string())
|
|
1254
1447
|
// metric keys for the value axis
|
|
1255
1448
|
}).partial();
|
|
1256
|
-
var preferenceSpecSchema =
|
|
1257
|
-
dataset:
|
|
1258
|
-
report:
|
|
1449
|
+
var preferenceSpecSchema = z15.object({
|
|
1450
|
+
dataset: z15.literal("preference"),
|
|
1451
|
+
report: z15.enum([
|
|
1259
1452
|
"ranking",
|
|
1260
1453
|
"head_to_head",
|
|
1261
1454
|
"recommended_over_time",
|
|
1262
1455
|
"mentioned_over_time"
|
|
1263
1456
|
])
|
|
1264
1457
|
});
|
|
1265
|
-
var widgetSpecSchema =
|
|
1458
|
+
var widgetSpecSchema = z15.union([
|
|
1266
1459
|
querySpecSchema,
|
|
1267
1460
|
preferenceSpecSchema
|
|
1268
1461
|
]);
|
|
1269
1462
|
var widgetFields = {
|
|
1270
|
-
id:
|
|
1271
|
-
title:
|
|
1463
|
+
id: z15.string().min(1),
|
|
1464
|
+
title: z15.string(),
|
|
1272
1465
|
viz: vizTypeSchema,
|
|
1273
1466
|
spec: widgetSpecSchema,
|
|
1274
1467
|
// 12-col grid placement.
|
|
1275
|
-
x:
|
|
1276
|
-
y:
|
|
1277
|
-
w:
|
|
1278
|
-
h:
|
|
1468
|
+
x: z15.number().int().min(0).max(11),
|
|
1469
|
+
y: z15.number().int().min(0),
|
|
1470
|
+
w: z15.number().int().min(1).max(12),
|
|
1471
|
+
h: z15.number().int().min(1),
|
|
1279
1472
|
encoding: widgetEncodingSchema.optional()
|
|
1280
1473
|
};
|
|
1281
|
-
var widgetSchema =
|
|
1474
|
+
var widgetSchema = z15.object(widgetFields).refine((w) => w.x + w.w <= 12, {
|
|
1282
1475
|
message: "widget spills past the 12-column grid (x + w must be \u2264 12)"
|
|
1283
1476
|
});
|
|
1284
|
-
var widgetPatchSchema =
|
|
1285
|
-
var dashboardFiltersSchema =
|
|
1477
|
+
var widgetPatchSchema = z15.object(widgetFields).partial();
|
|
1478
|
+
var dashboardFiltersSchema = z15.object({
|
|
1286
1479
|
filters: queryFiltersSchema,
|
|
1287
1480
|
dateRange: dateRangeSchema
|
|
1288
1481
|
}).partial();
|
|
1289
|
-
var overlayPatchSchema =
|
|
1290
|
-
name:
|
|
1482
|
+
var overlayPatchSchema = z15.object({
|
|
1483
|
+
name: z15.string(),
|
|
1291
1484
|
defaultFilters: dashboardFiltersSchema,
|
|
1292
|
-
widgets:
|
|
1485
|
+
widgets: z15.record(z15.string(), widgetPatchSchema.nullable()),
|
|
1293
1486
|
// Explicit widget-id ordering (for reordering and from-scratch widgets).
|
|
1294
|
-
order:
|
|
1487
|
+
order: z15.array(z15.string())
|
|
1295
1488
|
}).partial();
|
|
1296
|
-
var resolvedDashboardSchema =
|
|
1297
|
-
key:
|
|
1298
|
-
name:
|
|
1299
|
-
widgets:
|
|
1489
|
+
var resolvedDashboardSchema = z15.object({
|
|
1490
|
+
key: z15.string(),
|
|
1491
|
+
name: z15.string(),
|
|
1492
|
+
widgets: z15.array(widgetSchema),
|
|
1300
1493
|
defaultFilters: dashboardFiltersSchema,
|
|
1301
|
-
hasOrgOverlay:
|
|
1302
|
-
hasUserOverlay:
|
|
1303
|
-
});
|
|
1304
|
-
var dashboardTemplateSchema =
|
|
1305
|
-
key:
|
|
1306
|
-
name:
|
|
1307
|
-
description:
|
|
1308
|
-
widgets:
|
|
1494
|
+
hasOrgOverlay: z15.boolean(),
|
|
1495
|
+
hasUserOverlay: z15.boolean()
|
|
1496
|
+
});
|
|
1497
|
+
var dashboardTemplateSchema = z15.object({
|
|
1498
|
+
key: z15.string().min(1),
|
|
1499
|
+
name: z15.string(),
|
|
1500
|
+
description: z15.string().optional(),
|
|
1501
|
+
widgets: z15.array(widgetSchema),
|
|
1309
1502
|
defaultFilters: dashboardFiltersSchema.optional()
|
|
1310
1503
|
});
|
|
1311
|
-
var dashboardSummarySchema =
|
|
1312
|
-
key:
|
|
1313
|
-
name:
|
|
1314
|
-
source:
|
|
1315
|
-
isUserDefault:
|
|
1316
|
-
isOrgDefault:
|
|
1504
|
+
var dashboardSummarySchema = z15.object({
|
|
1505
|
+
key: z15.string(),
|
|
1506
|
+
name: z15.string(),
|
|
1507
|
+
source: z15.enum(["template", "org", "user"]),
|
|
1508
|
+
isUserDefault: z15.boolean(),
|
|
1509
|
+
isOrgDefault: z15.boolean()
|
|
1317
1510
|
});
|
|
1318
|
-
var listDashboardsResponseSchema =
|
|
1319
|
-
items:
|
|
1511
|
+
var listDashboardsResponseSchema = z15.object({
|
|
1512
|
+
items: z15.array(dashboardSummarySchema)
|
|
1320
1513
|
});
|
|
1321
|
-
var createDashboardBodySchema =
|
|
1322
|
-
name:
|
|
1323
|
-
widgets:
|
|
1514
|
+
var createDashboardBodySchema = z15.object({
|
|
1515
|
+
name: z15.string().min(1).max(120),
|
|
1516
|
+
widgets: z15.array(widgetSchema).optional()
|
|
1324
1517
|
});
|
|
1325
|
-
var updateDashboardBodySchema =
|
|
1326
|
-
name:
|
|
1518
|
+
var updateDashboardBodySchema = z15.object({
|
|
1519
|
+
name: z15.string().min(1).max(120)
|
|
1327
1520
|
});
|
|
1328
1521
|
|
|
1329
1522
|
// ../packages/api-schemas/src/device.ts
|
|
1330
|
-
import { z as
|
|
1331
|
-
var deviceAuthorizeRequestSchema =
|
|
1523
|
+
import { z as z16 } from "zod";
|
|
1524
|
+
var deviceAuthorizeRequestSchema = z16.object({
|
|
1332
1525
|
/** Device label (the CLI's hostname) for display + token naming. */
|
|
1333
|
-
deviceName:
|
|
1526
|
+
deviceName: z16.string().trim().max(64).optional(),
|
|
1334
1527
|
/** Optional: email a magic-link that lands on the approval page pre-scoped
|
|
1335
1528
|
* to this device (best-effort — the printed URL always works regardless). */
|
|
1336
|
-
email:
|
|
1529
|
+
email: z16.string().trim().email().max(320).optional()
|
|
1337
1530
|
});
|
|
1338
|
-
var deviceAuthorizeResponseSchema =
|
|
1531
|
+
var deviceAuthorizeResponseSchema = z16.object({
|
|
1339
1532
|
/** The one-time secret the CLI polls with (never shown again). */
|
|
1340
|
-
deviceCode:
|
|
1533
|
+
deviceCode: z16.string(),
|
|
1341
1534
|
/** Short human-typed code the user confirms in the browser (e.g. WXYZ-1234). */
|
|
1342
|
-
userCode:
|
|
1535
|
+
userCode: z16.string(),
|
|
1343
1536
|
/** Where the user approves (e.g. https://…/cli/authorize). */
|
|
1344
|
-
verificationUri:
|
|
1537
|
+
verificationUri: z16.string(),
|
|
1345
1538
|
/** verificationUri with the code pre-filled, for one-click / QR. */
|
|
1346
|
-
verificationUriComplete:
|
|
1539
|
+
verificationUriComplete: z16.string(),
|
|
1347
1540
|
/** Minimum seconds between polls. */
|
|
1348
|
-
interval:
|
|
1541
|
+
interval: z16.number().int().positive(),
|
|
1349
1542
|
/** Seconds until the device code expires. */
|
|
1350
|
-
expiresIn:
|
|
1543
|
+
expiresIn: z16.number().int().positive(),
|
|
1351
1544
|
/** Whether a magic-link email was dispatched (best-effort). */
|
|
1352
|
-
emailSent:
|
|
1545
|
+
emailSent: z16.boolean()
|
|
1353
1546
|
});
|
|
1354
|
-
var deviceTokenRequestSchema =
|
|
1355
|
-
deviceCode:
|
|
1547
|
+
var deviceTokenRequestSchema = z16.object({
|
|
1548
|
+
deviceCode: z16.string().min(1)
|
|
1356
1549
|
});
|
|
1357
|
-
var deviceTokenApprovedSchema =
|
|
1358
|
-
status:
|
|
1550
|
+
var deviceTokenApprovedSchema = z16.object({
|
|
1551
|
+
status: z16.literal("approved"),
|
|
1359
1552
|
/** The `gauge_…` bearer secret. Store it now — never returned again. */
|
|
1360
|
-
accessToken:
|
|
1361
|
-
tokenType:
|
|
1553
|
+
accessToken: z16.string(),
|
|
1554
|
+
tokenType: z16.literal("bearer"),
|
|
1362
1555
|
/** ISO-8601 expiry, or null for no expiry. */
|
|
1363
|
-
expiresAt:
|
|
1556
|
+
expiresAt: z16.string().nullable()
|
|
1364
1557
|
});
|
|
1365
|
-
var deviceTokenResultSchema =
|
|
1558
|
+
var deviceTokenResultSchema = z16.discriminatedUnion("status", [
|
|
1366
1559
|
// Not yet approved — keep polling at `interval`.
|
|
1367
|
-
|
|
1560
|
+
z16.object({ status: z16.literal("pending") }),
|
|
1368
1561
|
// Polled faster than `interval` — back off by `interval` seconds.
|
|
1369
|
-
|
|
1562
|
+
z16.object({ status: z16.literal("slow_down"), interval: z16.number().int() }),
|
|
1370
1563
|
// The user explicitly denied the request. Stop.
|
|
1371
|
-
|
|
1564
|
+
z16.object({ status: z16.literal("denied") }),
|
|
1372
1565
|
// The device code expired or is unknown/already-redeemed. Stop and restart.
|
|
1373
|
-
|
|
1566
|
+
z16.object({ status: z16.literal("expired") }),
|
|
1374
1567
|
deviceTokenApprovedSchema
|
|
1375
1568
|
]);
|
|
1376
1569
|
|
|
1377
1570
|
// ../packages/api-schemas/src/evals.ts
|
|
1378
|
-
import { z as
|
|
1571
|
+
import { z as z21 } from "zod";
|
|
1379
1572
|
|
|
1380
1573
|
// ../packages/api-schemas/src/ownedConfigurations.ts
|
|
1381
|
-
import { z as
|
|
1574
|
+
import { z as z20 } from "zod";
|
|
1382
1575
|
|
|
1383
1576
|
// ../packages/api-schemas/src/runConfig.ts
|
|
1384
1577
|
var runConfig_exports = {};
|
|
@@ -1394,38 +1587,38 @@ __export(runConfig_exports, {
|
|
|
1394
1587
|
schedulableAgentSchema: () => schedulableAgentSchema,
|
|
1395
1588
|
totalRunsPerCycle: () => totalRunsPerCycle
|
|
1396
1589
|
});
|
|
1397
|
-
import { z as
|
|
1590
|
+
import { z as z19 } from "zod";
|
|
1398
1591
|
|
|
1399
1592
|
// ../packages/api-schemas/src/runs.ts
|
|
1400
|
-
import { z as
|
|
1593
|
+
import { z as z18 } from "zod";
|
|
1401
1594
|
|
|
1402
1595
|
// ../packages/api-schemas/src/web-fixtures.ts
|
|
1403
|
-
import { z as
|
|
1596
|
+
import { z as z17 } from "zod";
|
|
1404
1597
|
var MAX_WEB_FIXTURE_BYTES = 1e6;
|
|
1405
1598
|
function normalizeWebFixtureUrl(raw) {
|
|
1406
1599
|
const url = new URL(raw);
|
|
1407
1600
|
url.hash = "";
|
|
1408
1601
|
return url.href;
|
|
1409
1602
|
}
|
|
1410
|
-
var searchResultSchema =
|
|
1411
|
-
title:
|
|
1412
|
-
url:
|
|
1413
|
-
snippet:
|
|
1414
|
-
});
|
|
1415
|
-
var searchFixtureSchema =
|
|
1416
|
-
query:
|
|
1417
|
-
results:
|
|
1418
|
-
});
|
|
1419
|
-
var pageFixtureSchema =
|
|
1420
|
-
url:
|
|
1421
|
-
status:
|
|
1422
|
-
contentType:
|
|
1423
|
-
body:
|
|
1424
|
-
});
|
|
1425
|
-
var webFixtureSchema =
|
|
1426
|
-
version:
|
|
1427
|
-
searches:
|
|
1428
|
-
pages:
|
|
1603
|
+
var searchResultSchema = z17.object({
|
|
1604
|
+
title: z17.string().min(1),
|
|
1605
|
+
url: z17.url().transform(normalizeWebFixtureUrl),
|
|
1606
|
+
snippet: z17.string()
|
|
1607
|
+
});
|
|
1608
|
+
var searchFixtureSchema = z17.object({
|
|
1609
|
+
query: z17.string().trim().min(1),
|
|
1610
|
+
results: z17.array(searchResultSchema)
|
|
1611
|
+
});
|
|
1612
|
+
var pageFixtureSchema = z17.object({
|
|
1613
|
+
url: z17.url().transform(normalizeWebFixtureUrl),
|
|
1614
|
+
status: z17.int().min(100).max(599).default(200),
|
|
1615
|
+
contentType: z17.string().trim().min(1).default("text/html"),
|
|
1616
|
+
body: z17.string()
|
|
1617
|
+
});
|
|
1618
|
+
var webFixtureSchema = z17.object({
|
|
1619
|
+
version: z17.literal(1),
|
|
1620
|
+
searches: z17.array(searchFixtureSchema).default([]),
|
|
1621
|
+
pages: z17.array(pageFixtureSchema).default([])
|
|
1429
1622
|
}).superRefine((fixture, ctx) => {
|
|
1430
1623
|
const queries = /* @__PURE__ */ new Set();
|
|
1431
1624
|
fixture.searches.forEach((entry, index) => {
|
|
@@ -1469,7 +1662,7 @@ var RUN_STATUSES = [
|
|
|
1469
1662
|
"TIMED_OUT",
|
|
1470
1663
|
"CANCELED"
|
|
1471
1664
|
];
|
|
1472
|
-
var runStatusSchema =
|
|
1665
|
+
var runStatusSchema = z18.enum(RUN_STATUSES);
|
|
1473
1666
|
var AGENTS = [
|
|
1474
1667
|
"CLAUDE_CODE",
|
|
1475
1668
|
"CODEX_CLI",
|
|
@@ -1477,147 +1670,147 @@ var AGENTS = [
|
|
|
1477
1670
|
"PI",
|
|
1478
1671
|
"OPENCODE"
|
|
1479
1672
|
];
|
|
1480
|
-
var agentSchema =
|
|
1673
|
+
var agentSchema = z18.enum(AGENTS);
|
|
1481
1674
|
var OBSERVED_PROVIDER_SOURCES = [
|
|
1482
1675
|
"AGENT_STREAM",
|
|
1483
1676
|
"GATEWAY_RESPONSE",
|
|
1484
1677
|
"GATEWAY_AUDIT",
|
|
1485
1678
|
"CANARY"
|
|
1486
1679
|
];
|
|
1487
|
-
var observedProviderSourceSchema =
|
|
1488
|
-
var selectedProviderSchema =
|
|
1489
|
-
slug:
|
|
1490
|
-
displayName:
|
|
1680
|
+
var observedProviderSourceSchema = z18.enum(OBSERVED_PROVIDER_SOURCES);
|
|
1681
|
+
var selectedProviderSchema = z18.object({
|
|
1682
|
+
slug: z18.string(),
|
|
1683
|
+
displayName: z18.string()
|
|
1491
1684
|
});
|
|
1492
|
-
var observedProviderSchema =
|
|
1493
|
-
slug:
|
|
1685
|
+
var observedProviderSchema = z18.object({
|
|
1686
|
+
slug: z18.string(),
|
|
1494
1687
|
source: observedProviderSourceSchema
|
|
1495
1688
|
});
|
|
1496
|
-
var runStatusFilterSchema =
|
|
1689
|
+
var runStatusFilterSchema = z18.string().transform(
|
|
1497
1690
|
(raw) => raw.split(",").map((s) => s.trim().toUpperCase()).filter(Boolean)
|
|
1498
|
-
).pipe(
|
|
1691
|
+
).pipe(z18.array(runStatusSchema).min(1));
|
|
1499
1692
|
var runListQuerySchema = listQuerySchema.extend({
|
|
1500
1693
|
status: runStatusFilterSchema.optional(),
|
|
1501
|
-
batch:
|
|
1502
|
-
prompt:
|
|
1503
|
-
experiment:
|
|
1504
|
-
evalSet:
|
|
1505
|
-
since:
|
|
1506
|
-
});
|
|
1507
|
-
var runListItemSchema =
|
|
1508
|
-
id:
|
|
1694
|
+
batch: z18.string().optional(),
|
|
1695
|
+
prompt: z18.string().optional(),
|
|
1696
|
+
experiment: z18.string().optional(),
|
|
1697
|
+
evalSet: z18.string().optional(),
|
|
1698
|
+
since: z18.string().optional()
|
|
1699
|
+
});
|
|
1700
|
+
var runListItemSchema = z18.object({
|
|
1701
|
+
id: z18.string(),
|
|
1509
1702
|
status: runStatusSchema,
|
|
1510
1703
|
agent: agentSchema,
|
|
1511
1704
|
/** Requested logical-model pin. Empty means the platform default was used. */
|
|
1512
|
-
model:
|
|
1705
|
+
model: z18.string(),
|
|
1513
1706
|
/** Model reported by the harness; null until observed or on legacy runs. */
|
|
1514
|
-
resolvedModel:
|
|
1707
|
+
resolvedModel: z18.string().nullable().optional(),
|
|
1515
1708
|
/** Catalog presentation label for the selected logical model. */
|
|
1516
|
-
modelDisplayName:
|
|
1709
|
+
modelDisplayName: z18.string().nullable().optional(),
|
|
1517
1710
|
/** Catalog provider selected before execution; null on legacy runs. */
|
|
1518
1711
|
selectedProvider: selectedProviderSchema.nullable().optional(),
|
|
1519
1712
|
/** Trusted terminal upstream observation; may differ from the selected
|
|
1520
1713
|
* aggregator and is null when the runtime supplies no provenance. */
|
|
1521
1714
|
observedProvider: observedProviderSchema.nullable().optional(),
|
|
1522
|
-
promptId:
|
|
1715
|
+
promptId: z18.string(),
|
|
1523
1716
|
/** First ~80 chars of the batch's prompt snapshot, whitespace-collapsed. */
|
|
1524
|
-
promptSnippet:
|
|
1525
|
-
batchId:
|
|
1526
|
-
experiment:
|
|
1717
|
+
promptSnippet: z18.string(),
|
|
1718
|
+
batchId: z18.string(),
|
|
1719
|
+
experiment: z18.string().nullable(),
|
|
1527
1720
|
/** The eval set whose expansion (or backfill) minted the batch; null for
|
|
1528
1721
|
* schedule/visibility/ad-hoc runs. */
|
|
1529
|
-
evalSetId:
|
|
1530
|
-
turns:
|
|
1531
|
-
usdCost:
|
|
1532
|
-
durationMs:
|
|
1533
|
-
exitReason:
|
|
1534
|
-
createdAt:
|
|
1535
|
-
startedAt:
|
|
1536
|
-
finishedAt:
|
|
1722
|
+
evalSetId: z18.string().nullable(),
|
|
1723
|
+
turns: z18.number().int().nullable(),
|
|
1724
|
+
usdCost: z18.number().nullable(),
|
|
1725
|
+
durationMs: z18.number().int().nullable(),
|
|
1726
|
+
exitReason: z18.string().nullable(),
|
|
1727
|
+
createdAt: z18.string(),
|
|
1728
|
+
startedAt: z18.string().nullable(),
|
|
1729
|
+
finishedAt: z18.string().nullable(),
|
|
1537
1730
|
/** Fork lineage (fork-simulations WS1): the source run this was forked from,
|
|
1538
1731
|
* or null for an organic run. Forks are excluded from aggregate analytics but
|
|
1539
1732
|
* kept visible; consumers badge on these fields. */
|
|
1540
|
-
parentRunId:
|
|
1733
|
+
parentRunId: z18.string().nullable(),
|
|
1541
1734
|
/** Set when this run is a fetch-fork simulation variant (injected web
|
|
1542
1735
|
* content); null otherwise. Distinguishes a "Simulation" badge from a plain
|
|
1543
1736
|
* conversation fork. */
|
|
1544
|
-
fetchForkPlanId:
|
|
1737
|
+
fetchForkPlanId: z18.string().nullable()
|
|
1545
1738
|
});
|
|
1546
1739
|
var runListResponseSchema = listResponseSchema(runListItemSchema);
|
|
1547
1740
|
var runDetailSchema = runListItemSchema.omit({ promptSnippet: true }).extend({
|
|
1548
|
-
promptText:
|
|
1549
|
-
attempt:
|
|
1550
|
-
cancelRequested:
|
|
1551
|
-
failureReason:
|
|
1552
|
-
repoUrl:
|
|
1553
|
-
repoRef:
|
|
1554
|
-
scenario:
|
|
1555
|
-
funding:
|
|
1741
|
+
promptText: z18.string(),
|
|
1742
|
+
attempt: z18.number().int(),
|
|
1743
|
+
cancelRequested: z18.boolean(),
|
|
1744
|
+
failureReason: z18.string().nullable(),
|
|
1745
|
+
repoUrl: z18.string().nullable(),
|
|
1746
|
+
repoRef: z18.string().nullable(),
|
|
1747
|
+
scenario: z18.string(),
|
|
1748
|
+
funding: z18.string(),
|
|
1556
1749
|
/** Raw harness usage write-back (token counts etc.); shape may evolve. */
|
|
1557
|
-
usage:
|
|
1750
|
+
usage: z18.unknown().nullable(),
|
|
1558
1751
|
/** Artifact pointer: a working-tree diff exists at GET /runs/{id}/diff. */
|
|
1559
|
-
hasDiff:
|
|
1560
|
-
claimedAt:
|
|
1752
|
+
hasDiff: z18.boolean(),
|
|
1753
|
+
claimedAt: z18.string().nullable(),
|
|
1561
1754
|
/** Judged criteria verdicts for eval-set runs (empty otherwise). `name`
|
|
1562
1755
|
* is the judge-time snapshot; `criterionId` is null once the criterion
|
|
1563
1756
|
* was deleted from its set. */
|
|
1564
|
-
criterionResults:
|
|
1565
|
-
|
|
1566
|
-
criterionId:
|
|
1567
|
-
name:
|
|
1568
|
-
passed:
|
|
1569
|
-
reasoning:
|
|
1757
|
+
criterionResults: z18.array(
|
|
1758
|
+
z18.object({
|
|
1759
|
+
criterionId: z18.string().nullable(),
|
|
1760
|
+
name: z18.string(),
|
|
1761
|
+
passed: z18.boolean(),
|
|
1762
|
+
reasoning: z18.string().nullable()
|
|
1570
1763
|
})
|
|
1571
1764
|
)
|
|
1572
1765
|
});
|
|
1573
|
-
var cancelRunResponseSchema =
|
|
1574
|
-
id:
|
|
1766
|
+
var cancelRunResponseSchema = z18.object({
|
|
1767
|
+
id: z18.string(),
|
|
1575
1768
|
status: runStatusSchema,
|
|
1576
|
-
cancelRequested:
|
|
1577
|
-
note:
|
|
1769
|
+
cancelRequested: z18.boolean(),
|
|
1770
|
+
note: z18.string().optional()
|
|
1578
1771
|
});
|
|
1579
|
-
var regradeRunResponseSchema =
|
|
1580
|
-
runId:
|
|
1581
|
-
evalSetId:
|
|
1582
|
-
criteria:
|
|
1772
|
+
var regradeRunResponseSchema = z18.object({
|
|
1773
|
+
runId: z18.string(),
|
|
1774
|
+
evalSetId: z18.string(),
|
|
1775
|
+
criteria: z18.number().int()
|
|
1583
1776
|
});
|
|
1584
|
-
var forkRunBodySchema =
|
|
1585
|
-
prompt:
|
|
1586
|
-
turn:
|
|
1777
|
+
var forkRunBodySchema = z18.object({
|
|
1778
|
+
prompt: z18.string().trim().min(1).max(2e4),
|
|
1779
|
+
turn: z18.number().int().min(0).optional(),
|
|
1587
1780
|
webFixture: webFixtureSchema.optional()
|
|
1588
1781
|
});
|
|
1589
|
-
var forkRunResponseSchema =
|
|
1590
|
-
runId:
|
|
1591
|
-
batchId:
|
|
1592
|
-
parentRunId:
|
|
1593
|
-
checkpointId:
|
|
1594
|
-
turn:
|
|
1782
|
+
var forkRunResponseSchema = z18.object({
|
|
1783
|
+
runId: z18.string(),
|
|
1784
|
+
batchId: z18.string(),
|
|
1785
|
+
parentRunId: z18.string(),
|
|
1786
|
+
checkpointId: z18.string(),
|
|
1787
|
+
turn: z18.number().int().min(0)
|
|
1595
1788
|
});
|
|
1596
|
-
var fetchForkAtFetchBodySchema =
|
|
1597
|
-
boundarySeq:
|
|
1598
|
-
injectedContent:
|
|
1599
|
-
prompts:
|
|
1789
|
+
var fetchForkAtFetchBodySchema = z18.object({
|
|
1790
|
+
boundarySeq: z18.string().min(1),
|
|
1791
|
+
injectedContent: z18.string(),
|
|
1792
|
+
prompts: z18.array(z18.string()).min(1)
|
|
1600
1793
|
});
|
|
1601
|
-
var fetchForkAtFetchResponseSchema =
|
|
1602
|
-
planId:
|
|
1794
|
+
var fetchForkAtFetchResponseSchema = z18.object({
|
|
1795
|
+
planId: z18.string()
|
|
1603
1796
|
});
|
|
1604
|
-
var fetchForkPlanStatusSchema =
|
|
1797
|
+
var fetchForkPlanStatusSchema = z18.enum([
|
|
1605
1798
|
"DRAFT",
|
|
1606
1799
|
"SURGERY_RUNNING",
|
|
1607
1800
|
"SURGERY_READY",
|
|
1608
1801
|
"FORKED",
|
|
1609
1802
|
"FAILED"
|
|
1610
1803
|
]);
|
|
1611
|
-
var fetchForkPlanResponseSchema =
|
|
1612
|
-
id:
|
|
1804
|
+
var fetchForkPlanResponseSchema = z18.object({
|
|
1805
|
+
id: z18.string(),
|
|
1613
1806
|
status: fetchForkPlanStatusSchema,
|
|
1614
|
-
boundaryUrl:
|
|
1615
|
-
boundaryTurn:
|
|
1616
|
-
prompts:
|
|
1617
|
-
surgicalCheckpointId:
|
|
1618
|
-
forkBatchId:
|
|
1619
|
-
errorText:
|
|
1620
|
-
forkedRunIds:
|
|
1807
|
+
boundaryUrl: z18.string(),
|
|
1808
|
+
boundaryTurn: z18.number().int(),
|
|
1809
|
+
prompts: z18.array(z18.string()),
|
|
1810
|
+
surgicalCheckpointId: z18.string().nullable(),
|
|
1811
|
+
forkBatchId: z18.string().nullable(),
|
|
1812
|
+
errorText: z18.string().nullable(),
|
|
1813
|
+
forkedRunIds: z18.array(z18.string())
|
|
1621
1814
|
});
|
|
1622
1815
|
var RUN_INSIGHT_STATUSES = [
|
|
1623
1816
|
"PENDING",
|
|
@@ -1626,24 +1819,24 @@ var RUN_INSIGHT_STATUSES = [
|
|
|
1626
1819
|
"FAILED",
|
|
1627
1820
|
"SKIPPED"
|
|
1628
1821
|
];
|
|
1629
|
-
var runInsightStatusSchema =
|
|
1630
|
-
var insightPassSchema =
|
|
1822
|
+
var runInsightStatusSchema = z18.enum(RUN_INSIGHT_STATUSES);
|
|
1823
|
+
var insightPassSchema = z18.object({
|
|
1631
1824
|
status: runInsightStatusSchema,
|
|
1632
|
-
model:
|
|
1633
|
-
inputTokens:
|
|
1634
|
-
outputTokens:
|
|
1635
|
-
usdCost:
|
|
1636
|
-
error:
|
|
1637
|
-
});
|
|
1638
|
-
var runDecisionSchema =
|
|
1639
|
-
index:
|
|
1640
|
-
category:
|
|
1641
|
-
categoryRaw:
|
|
1642
|
-
chosenName:
|
|
1643
|
-
chosenEcosystem:
|
|
1644
|
-
chosenPackage:
|
|
1645
|
-
reversed:
|
|
1646
|
-
detail:
|
|
1825
|
+
model: z18.string().nullable(),
|
|
1826
|
+
inputTokens: z18.number().int().nullable(),
|
|
1827
|
+
outputTokens: z18.number().int().nullable(),
|
|
1828
|
+
usdCost: z18.number().nullable(),
|
|
1829
|
+
error: z18.string().nullable()
|
|
1830
|
+
});
|
|
1831
|
+
var runDecisionSchema = z18.object({
|
|
1832
|
+
index: z18.number().int(),
|
|
1833
|
+
category: z18.string(),
|
|
1834
|
+
categoryRaw: z18.string().nullable(),
|
|
1835
|
+
chosenName: z18.string(),
|
|
1836
|
+
chosenEcosystem: z18.string().nullable(),
|
|
1837
|
+
chosenPackage: z18.string().nullable(),
|
|
1838
|
+
reversed: z18.boolean(),
|
|
1839
|
+
detail: z18.unknown()
|
|
1647
1840
|
});
|
|
1648
1841
|
var RUN_INSIGHT_PASS_KINDS = [
|
|
1649
1842
|
"INSTALL",
|
|
@@ -1652,26 +1845,26 @@ var RUN_INSIGHT_PASS_KINDS = [
|
|
|
1652
1845
|
"EXPERIMENT_DELTA",
|
|
1653
1846
|
"VISIBILITY"
|
|
1654
1847
|
];
|
|
1655
|
-
var runInsightPassKindSchema =
|
|
1848
|
+
var runInsightPassKindSchema = z18.enum(RUN_INSIGHT_PASS_KINDS);
|
|
1656
1849
|
var insightPipelinePassSchema = insightPassSchema.extend({
|
|
1657
1850
|
kind: runInsightPassKindSchema
|
|
1658
1851
|
});
|
|
1659
|
-
var runInsightResponseSchema =
|
|
1660
|
-
runId:
|
|
1852
|
+
var runInsightResponseSchema = z18.object({
|
|
1853
|
+
runId: z18.string(),
|
|
1661
1854
|
decision: insightPassSchema,
|
|
1662
|
-
passes:
|
|
1663
|
-
decisions:
|
|
1664
|
-
experimentDelta:
|
|
1855
|
+
passes: z18.array(insightPipelinePassSchema),
|
|
1856
|
+
decisions: z18.array(runDecisionSchema),
|
|
1857
|
+
experimentDelta: z18.unknown().nullable(),
|
|
1665
1858
|
/** The VISIBILITY pass's output (winners/picks) — loose server JSON, null
|
|
1666
1859
|
* for non-visibility runs or before the pass completes. */
|
|
1667
|
-
visibilityVerdict:
|
|
1860
|
+
visibilityVerdict: z18.unknown().nullable()
|
|
1668
1861
|
});
|
|
1669
|
-
var runEventSchema =
|
|
1670
|
-
run_id:
|
|
1671
|
-
seq:
|
|
1672
|
-
turn:
|
|
1673
|
-
ts:
|
|
1674
|
-
type:
|
|
1862
|
+
var runEventSchema = z18.looseObject({
|
|
1863
|
+
run_id: z18.string(),
|
|
1864
|
+
seq: z18.number(),
|
|
1865
|
+
turn: z18.number(),
|
|
1866
|
+
ts: z18.string(),
|
|
1867
|
+
type: z18.string()
|
|
1675
1868
|
});
|
|
1676
1869
|
|
|
1677
1870
|
// ../packages/api-schemas/src/runConfig.ts
|
|
@@ -1681,16 +1874,16 @@ var SCHEDULABLE_AGENTS = [
|
|
|
1681
1874
|
"PI",
|
|
1682
1875
|
"OPENCODE"
|
|
1683
1876
|
];
|
|
1684
|
-
var schedulableAgentSchema =
|
|
1685
|
-
var agentConfigSchema =
|
|
1877
|
+
var schedulableAgentSchema = z19.enum(SCHEDULABLE_AGENTS);
|
|
1878
|
+
var agentConfigSchema = z19.object({
|
|
1686
1879
|
agent: agentSchema,
|
|
1687
|
-
models:
|
|
1880
|
+
models: z19.array(z19.string().min(1))
|
|
1688
1881
|
});
|
|
1689
|
-
var agentConfigInputSchema =
|
|
1882
|
+
var agentConfigInputSchema = z19.object({
|
|
1690
1883
|
agent: schedulableAgentSchema,
|
|
1691
|
-
models:
|
|
1884
|
+
models: z19.array(z19.string().min(1)).default([])
|
|
1692
1885
|
});
|
|
1693
|
-
var assetRefSchema =
|
|
1886
|
+
var assetRefSchema = z19.string().max(320).regex(
|
|
1694
1887
|
/^[A-Za-z0-9][A-Za-z0-9._-]*@[^\s,]+$/,
|
|
1695
1888
|
'asset references must be "name@label"'
|
|
1696
1889
|
);
|
|
@@ -1698,7 +1891,7 @@ function refAssetName(ref) {
|
|
|
1698
1891
|
const at = ref.indexOf("@");
|
|
1699
1892
|
return at < 0 ? ref : ref.slice(0, at);
|
|
1700
1893
|
}
|
|
1701
|
-
var assetRefListSchema =
|
|
1894
|
+
var assetRefListSchema = z19.array(assetRefSchema).superRefine((refs, ctx) => {
|
|
1702
1895
|
const names = /* @__PURE__ */ new Set();
|
|
1703
1896
|
for (const ref of refs) {
|
|
1704
1897
|
const name = refAssetName(ref);
|
|
@@ -1722,62 +1915,62 @@ function totalRunsPerCycle(owners, samplesPerCycle) {
|
|
|
1722
1915
|
}
|
|
1723
1916
|
|
|
1724
1917
|
// ../packages/api-schemas/src/ownedConfigurations.ts
|
|
1725
|
-
var sampleCountSchema =
|
|
1726
|
-
var nextRunAtInputSchema =
|
|
1727
|
-
var ownedCadenceSchema =
|
|
1918
|
+
var sampleCountSchema = z20.number().int().min(1).max(50);
|
|
1919
|
+
var nextRunAtInputSchema = z20.string().regex(/^\d{4}-\d{2}-\d{2}/, "Next run must be a calendar date").nullable();
|
|
1920
|
+
var ownedCadenceSchema = z20.enum([
|
|
1728
1921
|
"NONE",
|
|
1729
1922
|
"DAILY",
|
|
1730
1923
|
"WEEKLY",
|
|
1731
1924
|
"MONTHLY"
|
|
1732
1925
|
]);
|
|
1733
1926
|
var ownedConfigurationInputShape = {
|
|
1734
|
-
repoUrl:
|
|
1735
|
-
repoRef:
|
|
1736
|
-
profileId:
|
|
1737
|
-
agents:
|
|
1927
|
+
repoUrl: z20.string().nullish(),
|
|
1928
|
+
repoRef: z20.string().nullish(),
|
|
1929
|
+
profileId: z20.string().nullish(),
|
|
1930
|
+
agents: z20.array(agentConfigInputSchema).min(1, "Select at least one agent"),
|
|
1738
1931
|
skillRefs: assetRefListSchema.optional().default([]),
|
|
1739
1932
|
mcpRefs: assetRefListSchema.optional().default([]),
|
|
1740
|
-
connectionIds:
|
|
1933
|
+
connectionIds: z20.array(z20.string().min(1)).max(32).optional().default([]),
|
|
1741
1934
|
cadence: ownedCadenceSchema.optional().default("NONE"),
|
|
1742
1935
|
nextRunAt: nextRunAtInputSchema.optional(),
|
|
1743
1936
|
sampleCount: sampleCountSchema.optional().default(1)
|
|
1744
1937
|
};
|
|
1745
|
-
var ownedConfigurationInputSchema =
|
|
1938
|
+
var ownedConfigurationInputSchema = z20.object(ownedConfigurationInputShape).strict();
|
|
1746
1939
|
var ownedConfigurationPatchShape = {
|
|
1747
|
-
repoUrl:
|
|
1748
|
-
repoRef:
|
|
1749
|
-
profileId:
|
|
1750
|
-
agents:
|
|
1940
|
+
repoUrl: z20.string().nullish(),
|
|
1941
|
+
repoRef: z20.string().nullish(),
|
|
1942
|
+
profileId: z20.string().nullish(),
|
|
1943
|
+
agents: z20.array(agentConfigInputSchema).min(1, "Select at least one agent").optional(),
|
|
1751
1944
|
skillRefs: assetRefListSchema.optional(),
|
|
1752
1945
|
mcpRefs: assetRefListSchema.optional(),
|
|
1753
|
-
connectionIds:
|
|
1946
|
+
connectionIds: z20.array(z20.string().min(1)).max(32).optional(),
|
|
1754
1947
|
cadence: ownedCadenceSchema.optional(),
|
|
1755
1948
|
nextRunAt: nextRunAtInputSchema.optional(),
|
|
1756
1949
|
sampleCount: sampleCountSchema.optional()
|
|
1757
1950
|
};
|
|
1758
|
-
var ownedConfigurationSchema =
|
|
1759
|
-
repoUrl:
|
|
1760
|
-
repoRef:
|
|
1761
|
-
profile:
|
|
1762
|
-
agents:
|
|
1763
|
-
skillRefs:
|
|
1764
|
-
mcpRefs:
|
|
1765
|
-
connectionIds:
|
|
1951
|
+
var ownedConfigurationSchema = z20.object({
|
|
1952
|
+
repoUrl: z20.string().nullable(),
|
|
1953
|
+
repoRef: z20.string().nullable(),
|
|
1954
|
+
profile: z20.object({ id: z20.string(), name: z20.string() }).nullable(),
|
|
1955
|
+
agents: z20.array(agentConfigSchema),
|
|
1956
|
+
skillRefs: z20.array(z20.string()),
|
|
1957
|
+
mcpRefs: z20.array(z20.string()),
|
|
1958
|
+
connectionIds: z20.array(z20.string()),
|
|
1766
1959
|
cadence: ownedCadenceSchema,
|
|
1767
1960
|
sampleCount: sampleCountSchema,
|
|
1768
|
-
lastScheduledAt:
|
|
1769
|
-
nextRunAt:
|
|
1770
|
-
});
|
|
1771
|
-
var visibilityScenarioSchema =
|
|
1772
|
-
id:
|
|
1773
|
-
repoUrl:
|
|
1774
|
-
repoRef:
|
|
1775
|
-
profile:
|
|
1776
|
-
});
|
|
1777
|
-
var visibilityScenarioInputSchema =
|
|
1778
|
-
repoUrl:
|
|
1779
|
-
repoRef:
|
|
1780
|
-
profileId:
|
|
1961
|
+
lastScheduledAt: z20.string().nullable(),
|
|
1962
|
+
nextRunAt: z20.string().nullable()
|
|
1963
|
+
});
|
|
1964
|
+
var visibilityScenarioSchema = z20.object({
|
|
1965
|
+
id: z20.string(),
|
|
1966
|
+
repoUrl: z20.string().nullable(),
|
|
1967
|
+
repoRef: z20.string().nullable(),
|
|
1968
|
+
profile: z20.object({ id: z20.string(), name: z20.string() }).nullable()
|
|
1969
|
+
});
|
|
1970
|
+
var visibilityScenarioInputSchema = z20.object({
|
|
1971
|
+
repoUrl: z20.string().nullish(),
|
|
1972
|
+
repoRef: z20.string().nullish(),
|
|
1973
|
+
profileId: z20.string().nullish()
|
|
1781
1974
|
}).strict();
|
|
1782
1975
|
var visibilityPromptSettingsInputShape = {
|
|
1783
1976
|
agents: ownedConfigurationInputShape.agents,
|
|
@@ -1797,416 +1990,141 @@ var visibilityPromptSettingsPatchShape = {
|
|
|
1797
1990
|
nextRunAt: ownedConfigurationPatchShape.nextRunAt,
|
|
1798
1991
|
sampleCount: ownedConfigurationPatchShape.sampleCount
|
|
1799
1992
|
};
|
|
1800
|
-
var visibilityPromptSettingsSchema =
|
|
1801
|
-
agents:
|
|
1802
|
-
skillRefs:
|
|
1803
|
-
mcpRefs:
|
|
1804
|
-
connectionIds:
|
|
1993
|
+
var visibilityPromptSettingsSchema = z20.object({
|
|
1994
|
+
agents: z20.array(agentConfigSchema),
|
|
1995
|
+
skillRefs: z20.array(z20.string()),
|
|
1996
|
+
mcpRefs: z20.array(z20.string()),
|
|
1997
|
+
connectionIds: z20.array(z20.string()),
|
|
1805
1998
|
cadence: ownedCadenceSchema,
|
|
1806
1999
|
sampleCount: sampleCountSchema,
|
|
1807
|
-
lastScheduledAt:
|
|
1808
|
-
nextRunAt:
|
|
1809
|
-
});
|
|
1810
|
-
var runAgentsOverrideSchema =
|
|
1811
|
-
var runEvalBodySchema =
|
|
1812
|
-
var runVisibilityBodySchema =
|
|
1813
|
-
billToOrg:
|
|
1814
|
-
visibilityScenarioIds:
|
|
2000
|
+
lastScheduledAt: z20.string().nullable(),
|
|
2001
|
+
nextRunAt: z20.string().nullable()
|
|
2002
|
+
});
|
|
2003
|
+
var runAgentsOverrideSchema = z20.array(agentConfigInputSchema).min(1, "Select at least one agent");
|
|
2004
|
+
var runEvalBodySchema = z20.object({ billToOrg: z20.boolean().optional() }).strict();
|
|
2005
|
+
var runVisibilityBodySchema = z20.object({
|
|
2006
|
+
billToOrg: z20.boolean().optional(),
|
|
2007
|
+
visibilityScenarioIds: z20.array(z20.string().min(1)).min(1).optional()
|
|
1815
2008
|
}).strict();
|
|
1816
2009
|
|
|
1817
2010
|
// ../packages/api-schemas/src/evals.ts
|
|
1818
|
-
var criterionSchema =
|
|
1819
|
-
id:
|
|
1820
|
-
name:
|
|
1821
|
-
rubric:
|
|
1822
|
-
position:
|
|
2011
|
+
var criterionSchema = z21.object({
|
|
2012
|
+
id: z21.string(),
|
|
2013
|
+
name: z21.string(),
|
|
2014
|
+
rubric: z21.string(),
|
|
2015
|
+
position: z21.number().int()
|
|
1823
2016
|
});
|
|
1824
|
-
var criterionInputSchema =
|
|
2017
|
+
var criterionInputSchema = z21.object({
|
|
1825
2018
|
/** Present = update in place; absent = create. */
|
|
1826
|
-
id:
|
|
2019
|
+
id: z21.string().optional(),
|
|
1827
2020
|
/** Label only; omit and the server derives it from the rubric. */
|
|
1828
|
-
name:
|
|
1829
|
-
rubric:
|
|
2021
|
+
name: z21.string().min(1).optional(),
|
|
2022
|
+
rubric: z21.string().min(1)
|
|
1830
2023
|
});
|
|
1831
|
-
var evalSetSchema =
|
|
1832
|
-
id:
|
|
2024
|
+
var evalSetSchema = z21.object({
|
|
2025
|
+
id: z21.string(),
|
|
1833
2026
|
/** Repository-generated suite provenance; null for ordinary evals. */
|
|
1834
|
-
suiteId:
|
|
1835
|
-
name:
|
|
1836
|
-
promptText:
|
|
1837
|
-
createdAt:
|
|
1838
|
-
criteria:
|
|
2027
|
+
suiteId: z21.string().nullable(),
|
|
2028
|
+
name: z21.string(),
|
|
2029
|
+
promptText: z21.string(),
|
|
2030
|
+
createdAt: z21.string(),
|
|
2031
|
+
criteria: z21.array(criterionSchema),
|
|
1839
2032
|
/** User tag names on the hidden backing prompt (Surface:* excluded). */
|
|
1840
|
-
tags:
|
|
2033
|
+
tags: z21.array(z21.string())
|
|
1841
2034
|
}).extend(ownedConfigurationSchema.shape);
|
|
1842
|
-
var agentPassRateSchema =
|
|
2035
|
+
var agentPassRateSchema = z21.object({
|
|
1843
2036
|
agent: agentSchema,
|
|
1844
|
-
model:
|
|
1845
|
-
runId:
|
|
1846
|
-
finishedAt:
|
|
1847
|
-
passed:
|
|
1848
|
-
total:
|
|
1849
|
-
});
|
|
1850
|
-
var evalSetStatSchema =
|
|
1851
|
-
passRates:
|
|
1852
|
-
runCount:
|
|
2037
|
+
model: z21.string(),
|
|
2038
|
+
runId: z21.string(),
|
|
2039
|
+
finishedAt: z21.string().nullable(),
|
|
2040
|
+
passed: z21.number().int(),
|
|
2041
|
+
total: z21.number().int()
|
|
2042
|
+
});
|
|
2043
|
+
var evalSetStatSchema = z21.object({
|
|
2044
|
+
passRates: z21.array(agentPassRateSchema),
|
|
2045
|
+
runCount: z21.number().int(),
|
|
1853
2046
|
/** Run-level aggregate: a run passes only when every criterion passed. */
|
|
1854
|
-
judgedRuns:
|
|
1855
|
-
passedRuns:
|
|
2047
|
+
judgedRuns: z21.number().int(),
|
|
2048
|
+
passedRuns: z21.number().int()
|
|
1856
2049
|
});
|
|
1857
|
-
var csv2 =
|
|
2050
|
+
var csv2 = z21.string().transform(
|
|
1858
2051
|
(s) => s.split(",").map((x) => x.trim()).filter(Boolean)
|
|
1859
2052
|
);
|
|
1860
|
-
var listEvalSetsQuerySchema =
|
|
1861
|
-
agents: csv2.pipe(
|
|
2053
|
+
var listEvalSetsQuerySchema = z21.object({
|
|
2054
|
+
agents: csv2.pipe(z21.array(agentSchema)).optional(),
|
|
1862
2055
|
models: csv2.optional(),
|
|
1863
|
-
since:
|
|
2056
|
+
since: z21.coerce.date().optional()
|
|
1864
2057
|
});
|
|
1865
2058
|
var evalSetListItemSchema = evalSetSchema.extend({
|
|
1866
2059
|
stats: evalSetStatSchema
|
|
1867
2060
|
});
|
|
1868
|
-
var listEvalSetsResponseSchema =
|
|
1869
|
-
items:
|
|
2061
|
+
var listEvalSetsResponseSchema = z21.object({
|
|
2062
|
+
items: z21.array(evalSetListItemSchema)
|
|
1870
2063
|
});
|
|
1871
|
-
var createEvalSetBodySchema =
|
|
1872
|
-
name:
|
|
1873
|
-
promptText:
|
|
1874
|
-
criteria:
|
|
2064
|
+
var createEvalSetBodySchema = z21.object({
|
|
2065
|
+
name: z21.string().min(1),
|
|
2066
|
+
promptText: z21.string().min(1),
|
|
2067
|
+
criteria: z21.array(criterionInputSchema).min(1),
|
|
1875
2068
|
/** User tag names, create-on-type (Surface:* rejected/dropped). */
|
|
1876
|
-
tags:
|
|
2069
|
+
tags: z21.array(z21.string()).optional()
|
|
1877
2070
|
}).extend(ownedConfigurationInputSchema.shape).strict();
|
|
1878
|
-
var updateEvalSetBodySchema =
|
|
1879
|
-
name:
|
|
1880
|
-
promptText:
|
|
1881
|
-
criteria:
|
|
1882
|
-
tags:
|
|
2071
|
+
var updateEvalSetBodySchema = z21.object({
|
|
2072
|
+
name: z21.string().min(1).optional(),
|
|
2073
|
+
promptText: z21.string().min(1).optional(),
|
|
2074
|
+
criteria: z21.array(criterionInputSchema).min(1).optional(),
|
|
2075
|
+
tags: z21.array(z21.string()).optional()
|
|
1883
2076
|
}).extend(ownedConfigurationPatchShape).strict();
|
|
1884
|
-
var runEvalSetResponseSchema =
|
|
1885
|
-
batchIds:
|
|
1886
|
-
runIds:
|
|
2077
|
+
var runEvalSetResponseSchema = z21.object({
|
|
2078
|
+
batchIds: z21.array(z21.string()),
|
|
2079
|
+
runIds: z21.array(z21.string()),
|
|
1887
2080
|
/** Durable launch request; absent for older and climb-trial launch paths. */
|
|
1888
|
-
runRequestId:
|
|
2081
|
+
runRequestId: z21.string().optional()
|
|
1889
2082
|
});
|
|
1890
|
-
var evalSetRunSchema =
|
|
1891
|
-
id:
|
|
1892
|
-
status:
|
|
2083
|
+
var evalSetRunSchema = z21.object({
|
|
2084
|
+
id: z21.string(),
|
|
2085
|
+
status: z21.string(),
|
|
1893
2086
|
agent: agentSchema,
|
|
1894
|
-
model:
|
|
1895
|
-
resolvedModel:
|
|
1896
|
-
createdAt:
|
|
1897
|
-
startedAt:
|
|
1898
|
-
finishedAt:
|
|
1899
|
-
failureReason:
|
|
1900
|
-
judge:
|
|
1901
|
-
criterionResults:
|
|
1902
|
-
|
|
1903
|
-
criterionId:
|
|
1904
|
-
name:
|
|
1905
|
-
passed:
|
|
1906
|
-
reasoning:
|
|
2087
|
+
model: z21.string().nullable(),
|
|
2088
|
+
resolvedModel: z21.string().nullable(),
|
|
2089
|
+
createdAt: z21.string(),
|
|
2090
|
+
startedAt: z21.string().nullable(),
|
|
2091
|
+
finishedAt: z21.string().nullable(),
|
|
2092
|
+
failureReason: z21.string().nullable(),
|
|
2093
|
+
judge: z21.object({ status: z21.string(), error: z21.string().nullable() }).nullable(),
|
|
2094
|
+
criterionResults: z21.array(
|
|
2095
|
+
z21.object({
|
|
2096
|
+
criterionId: z21.string().nullable(),
|
|
2097
|
+
name: z21.string(),
|
|
2098
|
+
passed: z21.boolean(),
|
|
2099
|
+
reasoning: z21.string().nullable()
|
|
1907
2100
|
})
|
|
1908
2101
|
)
|
|
1909
2102
|
});
|
|
1910
|
-
var listEvalSetRunsResponseSchema =
|
|
1911
|
-
items:
|
|
2103
|
+
var listEvalSetRunsResponseSchema = z21.object({
|
|
2104
|
+
items: z21.array(evalSetRunSchema)
|
|
1912
2105
|
});
|
|
1913
2106
|
|
|
1914
2107
|
// ../packages/api-schemas/src/executionTargets.ts
|
|
1915
|
-
import { z as
|
|
1916
|
-
var executionTargetCapabilitiesSchema =
|
|
1917
|
-
skills:
|
|
1918
|
-
mcp:
|
|
1919
|
-
connections:
|
|
1920
|
-
agentContext:
|
|
1921
|
-
resume:
|
|
1922
|
-
});
|
|
1923
|
-
var executionTargetSchema =
|
|
2108
|
+
import { z as z22 } from "zod";
|
|
2109
|
+
var executionTargetCapabilitiesSchema = z22.object({
|
|
2110
|
+
skills: z22.boolean(),
|
|
2111
|
+
mcp: z22.boolean(),
|
|
2112
|
+
connections: z22.boolean(),
|
|
2113
|
+
agentContext: z22.boolean(),
|
|
2114
|
+
resume: z22.boolean()
|
|
2115
|
+
});
|
|
2116
|
+
var executionTargetSchema = z22.object({
|
|
1924
2117
|
harness: agentSchema,
|
|
1925
|
-
harnessSlug:
|
|
1926
|
-
harnessLabel:
|
|
1927
|
-
model:
|
|
1928
|
-
modelLabel:
|
|
1929
|
-
providerSlug:
|
|
1930
|
-
providerLabel:
|
|
2118
|
+
harnessSlug: z22.string(),
|
|
2119
|
+
harnessLabel: z22.string(),
|
|
2120
|
+
model: z22.string(),
|
|
2121
|
+
modelLabel: z22.string(),
|
|
2122
|
+
providerSlug: z22.string(),
|
|
2123
|
+
providerLabel: z22.string(),
|
|
1931
2124
|
capabilities: executionTargetCapabilitiesSchema
|
|
1932
2125
|
});
|
|
1933
|
-
var executionTargetsResponseSchema =
|
|
1934
|
-
items:
|
|
1935
|
-
});
|
|
1936
|
-
|
|
1937
|
-
// ../packages/api-schemas/src/experiments.ts
|
|
1938
|
-
var experiments_exports = {};
|
|
1939
|
-
__export(experiments_exports, {
|
|
1940
|
-
EXPERIMENT_MODES: () => EXPERIMENT_MODES,
|
|
1941
|
-
EXPERIMENT_STATUSES: () => EXPERIMENT_STATUSES,
|
|
1942
|
-
SUPPORT_CLASSES: () => SUPPORT_CLASSES,
|
|
1943
|
-
TERMINAL_EXPERIMENT_STATUSES: () => TERMINAL_EXPERIMENT_STATUSES,
|
|
1944
|
-
addVariantBodySchema: () => addVariantBodySchema,
|
|
1945
|
-
cancelResponseSchema: () => cancelResponseSchema,
|
|
1946
|
-
createExperimentBodyFields: () => createExperimentBodyFields,
|
|
1947
|
-
createExperimentBodySchema: () => createExperimentBodySchema,
|
|
1948
|
-
createExperimentResponseSchema: () => createExperimentResponseSchema,
|
|
1949
|
-
eligibleExperimentRunSchema: () => eligibleExperimentRunSchema,
|
|
1950
|
-
experimentBoundarySchema: () => experimentBoundarySchema,
|
|
1951
|
-
experimentContentQuerySchema: () => experimentContentQuerySchema,
|
|
1952
|
-
experimentContentResponseSchema: () => experimentContentResponseSchema,
|
|
1953
|
-
experimentContentTypeSchema: () => experimentContentTypeSchema,
|
|
1954
|
-
experimentDetailSchema: () => experimentDetailSchema,
|
|
1955
|
-
experimentListQuerySchema: () => experimentListQuerySchema,
|
|
1956
|
-
experimentListResponseSchema: () => experimentListResponseSchema,
|
|
1957
|
-
experimentModeSchema: () => experimentModeSchema,
|
|
1958
|
-
experimentStatusResponseSchema: () => experimentStatusResponseSchema,
|
|
1959
|
-
experimentStatusSchema: () => experimentStatusSchema,
|
|
1960
|
-
experimentSummarySchema: () => experimentSummarySchema,
|
|
1961
|
-
experimentVariantSchema: () => experimentVariantSchema,
|
|
1962
|
-
fixerEditSchema: () => fixerEditSchema,
|
|
1963
|
-
launchResultSchema: () => launchResultSchema,
|
|
1964
|
-
patchVariantBodySchema: () => patchVariantBodySchema,
|
|
1965
|
-
recommendationSchema: () => recommendationSchema,
|
|
1966
|
-
shipBodySchema: () => shipBodySchema,
|
|
1967
|
-
supportClassSchema: () => supportClassSchema,
|
|
1968
|
-
variantDeltaSchema: () => variantDeltaSchema,
|
|
1969
|
-
variantRefSchema: () => variantRefSchema,
|
|
1970
|
-
variantRunSchema: () => variantRunSchema,
|
|
1971
|
-
writeRoundResponseSchema: () => writeRoundResponseSchema,
|
|
1972
|
-
writeVariantContentBodySchema: () => writeVariantContentBodySchema,
|
|
1973
|
-
writeVariantContentResponseSchema: () => writeVariantContentResponseSchema
|
|
1974
|
-
});
|
|
1975
|
-
import { z as z22 } from "zod";
|
|
1976
|
-
var EXPERIMENT_STATUSES = [
|
|
1977
|
-
"DRAFT",
|
|
1978
|
-
"GENERATING",
|
|
1979
|
-
"LAUNCHING",
|
|
1980
|
-
"RUNNING",
|
|
1981
|
-
"SYNTHESIZING",
|
|
1982
|
-
"COMPLETE",
|
|
1983
|
-
"PARTIAL",
|
|
1984
|
-
"FAILED",
|
|
1985
|
-
"CANCELED"
|
|
1986
|
-
];
|
|
1987
|
-
var experimentStatusSchema = z22.enum(EXPERIMENT_STATUSES);
|
|
1988
|
-
var TERMINAL_EXPERIMENT_STATUSES = [
|
|
1989
|
-
"COMPLETE",
|
|
1990
|
-
"PARTIAL",
|
|
1991
|
-
"FAILED",
|
|
1992
|
-
"CANCELED"
|
|
1993
|
-
];
|
|
1994
|
-
var SUPPORT_CLASSES = [
|
|
1995
|
-
"RECOMMENDED",
|
|
1996
|
-
"PROMISING",
|
|
1997
|
-
"NOT_SUPPORTED",
|
|
1998
|
-
"NOT_EVALUABLE"
|
|
1999
|
-
];
|
|
2000
|
-
var supportClassSchema = z22.enum(SUPPORT_CLASSES);
|
|
2001
|
-
var jsonValue = z22.unknown();
|
|
2002
|
-
var EXPERIMENT_MODES = ["PROPOSE", "DIRECT", "MANUAL"];
|
|
2003
|
-
var experimentModeSchema = z22.enum(EXPERIMENT_MODES);
|
|
2004
|
-
var createExperimentBodyFields = z22.object({
|
|
2005
|
-
runId: z22.string().min(1),
|
|
2006
|
-
boundarySeq: z22.string().min(1),
|
|
2007
|
-
problemText: z22.string().trim().min(1).optional(),
|
|
2008
|
-
/** OPTIONAL, and it stays optional: a CLI built before the bifurcation must
|
|
2009
|
-
* keep working, and omitting it means PROPOSE — the behaviour it already
|
|
2010
|
-
* expects. */
|
|
2011
|
-
mode: experimentModeSchema.optional(),
|
|
2012
|
-
/** DIRECT only: the one change to make, in the author's own words. Ignored
|
|
2013
|
-
* in the other modes. Carried as the single rewrite's title, and REQUIRED
|
|
2014
|
-
* when `mode` is DIRECT — see the cross-field check below. */
|
|
2015
|
-
changeInstruction: z22.string().trim().min(1).max(200).optional()
|
|
2016
|
-
});
|
|
2017
|
-
var createExperimentBodySchema = createExperimentBodyFields.superRefine((body, ctx) => {
|
|
2018
|
-
if (body.mode === "DIRECT" && !body.changeInstruction) {
|
|
2019
|
-
ctx.addIssue({
|
|
2020
|
-
code: "custom",
|
|
2021
|
-
path: ["changeInstruction"],
|
|
2022
|
-
message: "mode DIRECT requires changeInstruction \u2014 the one change to make, in your own words"
|
|
2023
|
-
});
|
|
2024
|
-
}
|
|
2025
|
-
});
|
|
2026
|
-
var createExperimentResponseSchema = z22.object({
|
|
2027
|
-
experimentId: z22.string(),
|
|
2028
|
-
/** false = an existing draft for this (run, boundary) was resumed. */
|
|
2029
|
-
created: z22.boolean(),
|
|
2030
|
-
/** What is persisted — a resume keeps the statement it was opened with. */
|
|
2031
|
-
problemText: z22.string(),
|
|
2032
|
-
/** The PERSISTED mode, echoed for the same reason `problemText` is: exactly
|
|
2033
|
-
* one live draft exists per (run, boundary), so a resume returns the mode
|
|
2034
|
-
* that draft was opened with — which may not be the one this call asked
|
|
2035
|
-
* for. Clients report what came back, not what they sent. */
|
|
2036
|
-
mode: experimentModeSchema
|
|
2037
|
-
});
|
|
2038
|
-
var experimentListQuerySchema = z22.object({
|
|
2039
|
-
status: z22.string().transform(
|
|
2040
|
-
(s) => s.split(",").map((x) => x.trim().toUpperCase()).filter(Boolean)
|
|
2041
|
-
).pipe(z22.array(experimentStatusSchema)).optional(),
|
|
2042
|
-
limit: z22.coerce.number().int().min(1).max(100).default(25)
|
|
2043
|
-
});
|
|
2044
|
-
var experimentSummarySchema = z22.object({
|
|
2045
|
-
id: z22.string(),
|
|
2046
|
-
status: experimentStatusSchema,
|
|
2047
|
-
problem: z22.string(),
|
|
2048
|
-
boundaryUrl: z22.string().nullable(),
|
|
2049
|
-
sourceRunId: z22.string(),
|
|
2050
|
-
variantCount: z22.number().int(),
|
|
2051
|
-
createdAt: z22.string()
|
|
2052
|
-
});
|
|
2053
|
-
var experimentListResponseSchema = z22.object({
|
|
2054
|
-
items: z22.array(experimentSummarySchema)
|
|
2055
|
-
});
|
|
2056
|
-
var eligibleExperimentRunSchema = z22.object({
|
|
2057
|
-
runId: z22.string(),
|
|
2058
|
-
agent: agentSchema,
|
|
2059
|
-
promptText: z22.string(),
|
|
2060
|
-
createdAt: z22.string(),
|
|
2061
|
-
verdict: z22.string().nullable(),
|
|
2062
|
-
boundaryCount: z22.number().int()
|
|
2063
|
-
});
|
|
2064
|
-
var experimentBoundarySchema = z22.object({
|
|
2065
|
-
boundarySeq: z22.union([z22.string(), z22.number()]),
|
|
2066
|
-
turn: z22.number().int().nullable(),
|
|
2067
|
-
url: z22.string(),
|
|
2068
|
-
domain: z22.string().nullable(),
|
|
2069
|
-
fetchPrompt: z22.string().nullable(),
|
|
2070
|
-
source: z22.string(),
|
|
2071
|
-
boundaryCheckpointId: z22.string().nullable(),
|
|
2072
|
-
boundaryOrdinal: z22.number().int().nullable(),
|
|
2073
|
-
capturedOccurrence: z22.number().int().nullable()
|
|
2074
|
-
});
|
|
2075
|
-
var variantRunSchema = z22.object({
|
|
2076
|
-
runId: z22.string(),
|
|
2077
|
-
status: z22.string(),
|
|
2078
|
-
failureReason: z22.string().nullable(),
|
|
2079
|
-
integrations: z22.array(jsonValue)
|
|
2080
|
-
});
|
|
2081
|
-
var experimentVariantSchema = z22.object({
|
|
2082
|
-
variantId: z22.string(),
|
|
2083
|
-
key: z22.string(),
|
|
2084
|
-
title: z22.string(),
|
|
2085
|
-
hypothesis: z22.string(),
|
|
2086
|
-
rewriteChars: z22.number().int(),
|
|
2087
|
-
hasRewrite: z22.boolean(),
|
|
2088
|
-
invalidReason: z22.string().nullable(),
|
|
2089
|
-
planStatus: z22.string().nullable(),
|
|
2090
|
-
planError: z22.string().nullable(),
|
|
2091
|
-
runs: z22.array(variantRunSchema),
|
|
2092
|
-
/** Arm verdict / finding counts / EXPERIMENT_DELTA output — server-owned
|
|
2093
|
-
* analytic JSON, null until computable. */
|
|
2094
|
-
verdict: jsonValue.nullable(),
|
|
2095
|
-
findings: jsonValue.nullable(),
|
|
2096
|
-
delta: jsonValue.nullable()
|
|
2097
|
-
});
|
|
2098
|
-
var experimentDetailSchema = z22.object({
|
|
2099
|
-
id: z22.string(),
|
|
2100
|
-
status: experimentStatusSchema,
|
|
2101
|
-
problem: z22.string(),
|
|
2102
|
-
boundaryUrl: z22.string().nullable(),
|
|
2103
|
-
createdAt: z22.string(),
|
|
2104
|
-
editable: z22.boolean(),
|
|
2105
|
-
roundInFlight: z22.boolean(),
|
|
2106
|
-
launching: z22.boolean(),
|
|
2107
|
-
launchError: z22.string().nullable(),
|
|
2108
|
-
planned: z22.boolean(),
|
|
2109
|
-
livePage: jsonValue.nullable(),
|
|
2110
|
-
sourceRun: z22.object({
|
|
2111
|
-
runId: z22.string(),
|
|
2112
|
-
agent: agentSchema,
|
|
2113
|
-
status: z22.string(),
|
|
2114
|
-
task: z22.string(),
|
|
2115
|
-
repoUrl: z22.string().nullable(),
|
|
2116
|
-
verdict: jsonValue.nullable(),
|
|
2117
|
-
integrations: z22.array(jsonValue)
|
|
2118
|
-
}),
|
|
2119
|
-
variants: z22.array(experimentVariantSchema),
|
|
2120
|
-
/** The settled comparison (winners vs baseline) — null until launched. */
|
|
2121
|
-
summary: jsonValue.nullable()
|
|
2122
|
-
});
|
|
2123
|
-
var experimentStatusResponseSchema = z22.object({
|
|
2124
|
-
id: z22.string(),
|
|
2125
|
-
status: experimentStatusSchema,
|
|
2126
|
-
planned: z22.boolean(),
|
|
2127
|
-
writeStartedAt: z22.string().nullable(),
|
|
2128
|
-
launchStartedAt: z22.string().nullable(),
|
|
2129
|
-
launchError: z22.string().nullable(),
|
|
2130
|
-
shippedVariantId: z22.string().nullable(),
|
|
2131
|
-
shippedAt: z22.string().nullable()
|
|
2132
|
-
});
|
|
2133
|
-
var addVariantBodySchema = z22.object({
|
|
2134
|
-
title: z22.string().optional(),
|
|
2135
|
-
hypothesis: z22.string().optional()
|
|
2136
|
-
});
|
|
2137
|
-
var patchVariantBodySchema = z22.object({
|
|
2138
|
-
title: z22.string().optional(),
|
|
2139
|
-
hypothesis: z22.string().optional()
|
|
2140
|
-
});
|
|
2141
|
-
var fixerEditSchema = z22.object({
|
|
2142
|
-
find: z22.string().min(1),
|
|
2143
|
-
replace: z22.string()
|
|
2144
|
-
});
|
|
2145
|
-
var experimentContentTypeSchema = z22.string().trim().toLowerCase().max(127).regex(
|
|
2146
|
-
/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/,
|
|
2147
|
-
"contentType must be a MIME type such as text/markdown"
|
|
2148
|
-
);
|
|
2149
|
-
var writeVariantContentBodySchema = z22.object({
|
|
2150
|
-
content: z22.string().optional(),
|
|
2151
|
-
edits: z22.array(fixerEditSchema).optional(),
|
|
2152
|
-
contentType: experimentContentTypeSchema.optional()
|
|
2153
|
-
});
|
|
2154
|
-
var writeVariantContentResponseSchema = z22.object({
|
|
2155
|
-
variantId: z22.string(),
|
|
2156
|
-
chars: z22.number().int(),
|
|
2157
|
-
truncated: z22.boolean(),
|
|
2158
|
-
applied: z22.number().int(),
|
|
2159
|
-
skipped: z22.number().int()
|
|
2160
|
-
});
|
|
2161
|
-
var experimentContentQuerySchema = z22.object({
|
|
2162
|
-
variantId: z22.string().optional(),
|
|
2163
|
-
offset: z22.coerce.number().int().min(0).default(0),
|
|
2164
|
-
maxChars: z22.coerce.number().int().min(1).max(4e4).default(2e4)
|
|
2165
|
-
});
|
|
2166
|
-
var experimentContentResponseSchema = z22.object({
|
|
2167
|
-
source: z22.string(),
|
|
2168
|
-
totalChars: z22.number().int(),
|
|
2169
|
-
offset: z22.number().int(),
|
|
2170
|
-
returnedChars: z22.number().int(),
|
|
2171
|
-
nextOffset: z22.number().int().nullable(),
|
|
2172
|
-
content: z22.string()
|
|
2173
|
-
});
|
|
2174
|
-
var writeRoundResponseSchema = z22.object({
|
|
2175
|
-
queued: z22.number().int(),
|
|
2176
|
-
reason: z22.enum(["round_in_flight", "nothing_pending"]).optional()
|
|
2177
|
-
});
|
|
2178
|
-
var launchResultSchema = z22.object({
|
|
2179
|
-
experimentId: z22.string(),
|
|
2180
|
-
status: z22.literal("LAUNCHING")
|
|
2181
|
-
});
|
|
2182
|
-
var shipBodySchema = z22.object({ variantId: z22.string().min(1) });
|
|
2183
|
-
var cancelResponseSchema = z22.object({
|
|
2184
|
-
id: z22.string(),
|
|
2185
|
-
status: z22.literal("CANCELED")
|
|
2186
|
-
});
|
|
2187
|
-
var variantDeltaSchema = z22.object({
|
|
2188
|
-
changed: z22.boolean().nullable(),
|
|
2189
|
-
hypothesisSupported: z22.enum(["supported", "refuted", "inconclusive"]).nullable(),
|
|
2190
|
-
summary: z22.string().nullable()
|
|
2191
|
-
});
|
|
2192
|
-
var variantRefSchema = z22.object({
|
|
2193
|
-
key: z22.string(),
|
|
2194
|
-
title: z22.string(),
|
|
2195
|
-
effect: z22.number().nullable(),
|
|
2196
|
-
consistency: z22.string().nullable(),
|
|
2197
|
-
note: z22.string().nullable(),
|
|
2198
|
-
delta: variantDeltaSchema.nullable().optional()
|
|
2199
|
-
});
|
|
2200
|
-
var recommendationSchema = z22.object({
|
|
2201
|
-
evaluatorVersion: z22.string(),
|
|
2202
|
-
summary: z22.string(),
|
|
2203
|
-
groups: z22.object({
|
|
2204
|
-
recommended: z22.array(variantRefSchema),
|
|
2205
|
-
promising: z22.array(variantRefSchema),
|
|
2206
|
-
notSupported: z22.array(variantRefSchema),
|
|
2207
|
-
notEvaluable: z22.array(variantRefSchema)
|
|
2208
|
-
}),
|
|
2209
|
-
tradeoffs: z22.array(z22.string())
|
|
2126
|
+
var executionTargetsResponseSchema = z22.object({
|
|
2127
|
+
items: z22.array(executionTargetSchema)
|
|
2210
2128
|
});
|
|
2211
2129
|
|
|
2212
2130
|
// ../packages/api-schemas/src/invites.ts
|
|
@@ -2575,7 +2493,7 @@ var token = z28.string().min(1).max(4096);
|
|
|
2575
2493
|
var optionFlag = z28.string().regex(/^--?[A-Za-z0-9][A-Za-z0-9-]*$/);
|
|
2576
2494
|
var envKey = z28.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/);
|
|
2577
2495
|
var relativePath = z28.string().min(1).max(1024).refine(
|
|
2578
|
-
(
|
|
2496
|
+
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.includes("\0") && path3.split("/").every(
|
|
2579
2497
|
(part) => part && part !== "." && part !== ".." && ![".git", "node_modules", ".pnpm", ".yarn", ".venv"].includes(part)
|
|
2580
2498
|
),
|
|
2581
2499
|
"Use a workspace-relative path without traversal"
|
|
@@ -2702,15 +2620,15 @@ var cliTargetSchema = z28.object({
|
|
|
2702
2620
|
path: ["commands", index, "id"],
|
|
2703
2621
|
message: "Duplicate command ID"
|
|
2704
2622
|
});
|
|
2705
|
-
const { capabilities } = command;
|
|
2706
|
-
if (new Set(
|
|
2623
|
+
const { capabilities: capabilities2 } = command;
|
|
2624
|
+
if (new Set(capabilities2.operations).size !== capabilities2.operations.length)
|
|
2707
2625
|
ctx.addIssue({
|
|
2708
2626
|
code: "custom",
|
|
2709
2627
|
path: ["commands", index, "capabilities", "operations"],
|
|
2710
2628
|
message: "Duplicate operation"
|
|
2711
2629
|
});
|
|
2712
2630
|
const requires = (kind, valid, message) => {
|
|
2713
|
-
if (
|
|
2631
|
+
if (capabilities2.operations.includes(kind) && !valid)
|
|
2714
2632
|
ctx.addIssue({
|
|
2715
2633
|
code: "custom",
|
|
2716
2634
|
path: ["commands", index, "capabilities", "operations"],
|
|
@@ -2719,42 +2637,42 @@ var cliTargetSchema = z28.object({
|
|
|
2719
2637
|
};
|
|
2720
2638
|
requires(
|
|
2721
2639
|
"streamOutput",
|
|
2722
|
-
|
|
2640
|
+
capabilities2.outputModes.includes("streaming"),
|
|
2723
2641
|
"Streaming output needs a qualified streaming mode"
|
|
2724
2642
|
);
|
|
2725
2643
|
requires(
|
|
2726
2644
|
"completeOutput",
|
|
2727
|
-
|
|
2645
|
+
capabilities2.outputModes.includes("completed"),
|
|
2728
2646
|
"Completed output needs a qualified completed mode"
|
|
2729
2647
|
);
|
|
2730
2648
|
requires(
|
|
2731
2649
|
"structuredStdin",
|
|
2732
|
-
|
|
2650
|
+
capabilities2.stdinFormats.length > 0,
|
|
2733
2651
|
"Structured stdin needs a qualified format"
|
|
2734
2652
|
);
|
|
2735
2653
|
requires(
|
|
2736
2654
|
"promptRecipe",
|
|
2737
|
-
|
|
2655
|
+
capabilities2.recipeIds.length > 0,
|
|
2738
2656
|
"Prompt recipes need qualified prompt IDs"
|
|
2739
2657
|
);
|
|
2740
2658
|
requires(
|
|
2741
2659
|
"generatedFile",
|
|
2742
|
-
|
|
2660
|
+
capabilities2.generatedPaths.length > 0,
|
|
2743
2661
|
"Generated files need attributed output paths"
|
|
2744
2662
|
);
|
|
2745
2663
|
requires(
|
|
2746
2664
|
"setEnv",
|
|
2747
|
-
|
|
2665
|
+
capabilities2.settings.length > 0,
|
|
2748
2666
|
"Environment changes need supported settings"
|
|
2749
2667
|
);
|
|
2750
2668
|
requires(
|
|
2751
2669
|
"ensureOption",
|
|
2752
|
-
|
|
2670
|
+
capabilities2.options.length > 0,
|
|
2753
2671
|
"Arguments need supported options"
|
|
2754
2672
|
);
|
|
2755
2673
|
requires(
|
|
2756
2674
|
"replaceOption",
|
|
2757
|
-
|
|
2675
|
+
capabilities2.options.length > 0,
|
|
2758
2676
|
"Arguments need supported options"
|
|
2759
2677
|
);
|
|
2760
2678
|
}
|
|
@@ -2935,7 +2853,7 @@ var cliInterventionSchema = z28.object({
|
|
|
2935
2853
|
"template"
|
|
2936
2854
|
]).nullable()
|
|
2937
2855
|
}).strict().superRefine((bundle, ctx) => {
|
|
2938
|
-
const fail = (
|
|
2856
|
+
const fail = (path3, message) => ctx.addIssue({ code: "custom", path: path3, message });
|
|
2939
2857
|
if (bundle.schemaVersion !== bundle.catalog.version)
|
|
2940
2858
|
fail(["schemaVersion"], "Bundle and catalog schema versions differ");
|
|
2941
2859
|
if (bundle.identityPolicy && bundle.schemaVersion !== 2)
|
|
@@ -3051,24 +2969,24 @@ var cliInterventionSchema = z28.object({
|
|
|
3051
2969
|
)
|
|
3052
2970
|
);
|
|
3053
2971
|
bundle.operations.forEach((operation, index) => {
|
|
3054
|
-
const
|
|
2972
|
+
const path3 = ["operations", index];
|
|
3055
2973
|
if (!command.capabilities.operations.includes(operation.kind))
|
|
3056
|
-
fail(
|
|
2974
|
+
fail(path3, `${operation.kind} is not qualified for this command`);
|
|
3057
2975
|
if ("option" in operation && !command.capabilities.options.some(
|
|
3058
2976
|
(option) => option.flag === operation.option
|
|
3059
2977
|
))
|
|
3060
|
-
fail(
|
|
2978
|
+
fail(path3, "Option is not supported by this version");
|
|
3061
2979
|
if (operation.kind === "ensureOption" || operation.kind === "replaceOption") {
|
|
3062
2980
|
const option = command.capabilities.options.find(
|
|
3063
2981
|
(item) => item.flag === operation.option
|
|
3064
2982
|
);
|
|
3065
2983
|
if (option && option.takesValue !== (operation.value !== void 0))
|
|
3066
|
-
fail(
|
|
2984
|
+
fail(path3, "Option value does not match its qualified arity");
|
|
3067
2985
|
}
|
|
3068
2986
|
if (operation.kind === "setEnv" && !command.capabilities.settings.includes(operation.key))
|
|
3069
|
-
fail(
|
|
2987
|
+
fail(path3, "Environment setting is not supported by this version");
|
|
3070
2988
|
if (operation.kind === "structuredStdin" && !command.capabilities.stdinFormats.includes(operation.format))
|
|
3071
|
-
fail(
|
|
2989
|
+
fail(path3, "Stdin format is not qualified");
|
|
3072
2990
|
if (operation.kind === "structuredStdin" && operation.payload.source === "literal" && operation.format !== "text") {
|
|
3073
2991
|
const records = operation.format === "json" ? [operation.payload.value] : operation.payload.value.trimEnd().split("\n");
|
|
3074
2992
|
try {
|
|
@@ -3077,30 +2995,30 @@ var cliInterventionSchema = z28.object({
|
|
|
3077
2995
|
for (const record of records) JSON.parse(record);
|
|
3078
2996
|
} catch {
|
|
3079
2997
|
fail(
|
|
3080
|
-
|
|
2998
|
+
path3,
|
|
3081
2999
|
"Structured stdin payload does not match its declared JSON format"
|
|
3082
3000
|
);
|
|
3083
3001
|
}
|
|
3084
3002
|
}
|
|
3085
3003
|
if (operation.kind === "promptRecipe" && !command.capabilities.recipeIds.includes(operation.recipeId))
|
|
3086
|
-
fail(
|
|
3004
|
+
fail(path3, "Prompt recipe is not qualified");
|
|
3087
3005
|
if (operation.kind === "generatedFile" && !command.capabilities.generatedPaths.includes(operation.path))
|
|
3088
|
-
fail(
|
|
3006
|
+
fail(path3, "Output path is not attributed to this command");
|
|
3089
3007
|
if (operation.kind === "generatedFile" && !bundle.baselineInvocations.some(
|
|
3090
3008
|
(invocation) => invocation.targetId === target.id && invocation.commandId === command.id && invocation.recordFiles.some(
|
|
3091
3009
|
(file) => file.path === operation.path && file.status === "generated" && file.beforeSha256 === operation.beforeSha256 && file.generatedSha256 === operation.generatedSha256
|
|
3092
3010
|
)
|
|
3093
3011
|
))
|
|
3094
3012
|
fail(
|
|
3095
|
-
|
|
3013
|
+
path3,
|
|
3096
3014
|
"No attributed baseline file matches the preimage and real generated bytes"
|
|
3097
3015
|
);
|
|
3098
3016
|
if (operation.kind === "streamOutput" && !command.capabilities.outputModes.includes("streaming"))
|
|
3099
|
-
fail(
|
|
3017
|
+
fail(path3, "Streaming output is not qualified");
|
|
3100
3018
|
if (operation.kind === "completeOutput" && !command.capabilities.outputModes.includes("completed"))
|
|
3101
|
-
fail(
|
|
3019
|
+
fail(path3, "Completed output is not qualified");
|
|
3102
3020
|
if (operation.kind === "streamOutput" && operation.edit.find === operation.edit.replace || operation.kind === "generatedFile" && operation.edit.find === operation.edit.replace || operation.kind === "completeOutput" && operation.matcher.kind === "literal" && operation.matcher.text === operation.replace)
|
|
3103
|
-
fail(
|
|
3021
|
+
fail(path3, "A trial operation must change the matched content");
|
|
3104
3022
|
const sources = [
|
|
3105
3023
|
"value" in operation ? operation.value : null,
|
|
3106
3024
|
operation.kind === "structuredStdin" ? operation.payload : null,
|
|
@@ -3109,17 +3027,17 @@ var cliInterventionSchema = z28.object({
|
|
|
3109
3027
|
if (sources.some(
|
|
3110
3028
|
(source) => source?.source === "localFact" && !command.capabilities.localFacts.includes(source.key)
|
|
3111
3029
|
))
|
|
3112
|
-
fail(
|
|
3030
|
+
fail(path3, "Local fact is not declared non-secret for this command");
|
|
3113
3031
|
if (sources.some(
|
|
3114
3032
|
(source) => source?.source === "localFact" && changedEnvironment.has(source.key)
|
|
3115
3033
|
))
|
|
3116
3034
|
fail(
|
|
3117
|
-
|
|
3035
|
+
path3,
|
|
3118
3036
|
"A local fact cannot be changed by another operation in the same trial"
|
|
3119
3037
|
);
|
|
3120
3038
|
const conflict = operation.kind === "ensureOption" || operation.kind === "replaceOption" ? `option:${operation.option}` : operation.kind === "setEnv" ? `env:${operation.key}` : operation.kind === "structuredStdin" ? "stdin" : operation.kind === "promptRecipe" ? `prompt:${operation.recipeId}` : operation.kind === "generatedFile" ? `file:${operation.path}` : null;
|
|
3121
3039
|
if (conflict && seen.has(conflict))
|
|
3122
|
-
fail(
|
|
3040
|
+
fail(path3, "Conflicting operation on the same input or output");
|
|
3123
3041
|
if (conflict) seen.add(conflict);
|
|
3124
3042
|
});
|
|
3125
3043
|
if (bundle.operations.filter((item) => item.kind === "generatedFile").length > bundle.limits.generatedFileCount)
|
|
@@ -3173,7 +3091,7 @@ var ecosystemSchema = z29.enum(["npm", "pypi", "cargo", "go", "gem"]);
|
|
|
3173
3091
|
var overrideFilesSchema = z29.array(
|
|
3174
3092
|
z29.object({
|
|
3175
3093
|
path: z29.string().min(1).refine(
|
|
3176
|
-
(
|
|
3094
|
+
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.split("/").includes(".."),
|
|
3177
3095
|
"Use a relative path within the target"
|
|
3178
3096
|
),
|
|
3179
3097
|
body: z29.string()
|
|
@@ -4018,7 +3936,7 @@ var builtDirectoryResourceSchema = z39.object({
|
|
|
4018
3936
|
});
|
|
4019
3937
|
});
|
|
4020
3938
|
var bundleRelativeScriptSchema = z39.string().min(1).refine(
|
|
4021
|
-
(
|
|
3939
|
+
(path3) => !path3.startsWith("/") && !path3.includes("\\") && !path3.includes("\0") && !path3.split("/").includes("..") && path3.split("/").some((part) => part !== "" && part !== "."),
|
|
4022
3940
|
"Install script must be a bundle-relative path without traversal"
|
|
4023
3941
|
);
|
|
4024
3942
|
var preparedDirectoryPrepareSchema = z39.union([
|
|
@@ -4160,7 +4078,7 @@ var githubCasePathSchema = z40.string().regex(
|
|
|
4160
4078
|
/^evals\/[A-Za-z0-9_./-]+\.md$/,
|
|
4161
4079
|
"Expected an explicit evals/*.md path"
|
|
4162
4080
|
).refine(
|
|
4163
|
-
(
|
|
4081
|
+
(path3) => path3.split("/").every((part) => part !== "" && part !== "." && part !== ".."),
|
|
4164
4082
|
"Case path must not contain traversal or empty segments"
|
|
4165
4083
|
);
|
|
4166
4084
|
var runDefinitionFileConfigSchema = z40.object({
|
|
@@ -4565,8 +4483,8 @@ function writeConfig(config) {
|
|
|
4565
4483
|
}
|
|
4566
4484
|
function updateConfig(patch) {
|
|
4567
4485
|
const next = { ...readConfig(), ...patch };
|
|
4568
|
-
for (const
|
|
4569
|
-
if (next[
|
|
4486
|
+
for (const key2 of [...CONFIG_KEYS, "staff"]) {
|
|
4487
|
+
if (next[key2] === void 0) delete next[key2];
|
|
4570
4488
|
}
|
|
4571
4489
|
writeConfig(next);
|
|
4572
4490
|
return next;
|
|
@@ -4642,28 +4560,28 @@ var ApiClient = class {
|
|
|
4642
4560
|
this.baseUrl = (options.baseUrl ?? resolveBaseUrl()).replace(/\/+$/, "");
|
|
4643
4561
|
this.token = options.token !== void 0 ? options.token : resolveToken();
|
|
4644
4562
|
}
|
|
4645
|
-
async get(
|
|
4646
|
-
return this.request("GET",
|
|
4563
|
+
async get(path3, query) {
|
|
4564
|
+
return this.request("GET", path3, { query });
|
|
4647
4565
|
}
|
|
4648
|
-
async post(
|
|
4649
|
-
return this.request("POST",
|
|
4566
|
+
async post(path3, body, query) {
|
|
4567
|
+
return this.request("POST", path3, { body, query });
|
|
4650
4568
|
}
|
|
4651
|
-
async patch(
|
|
4652
|
-
return this.request("PATCH",
|
|
4569
|
+
async patch(path3, body, query) {
|
|
4570
|
+
return this.request("PATCH", path3, { body, query });
|
|
4653
4571
|
}
|
|
4654
|
-
async put(
|
|
4655
|
-
return this.request("PUT",
|
|
4572
|
+
async put(path3, body, query) {
|
|
4573
|
+
return this.request("PUT", path3, { body, query });
|
|
4656
4574
|
}
|
|
4657
|
-
async delete(
|
|
4658
|
-
return this.request("DELETE",
|
|
4575
|
+
async delete(path3, query) {
|
|
4576
|
+
return this.request("DELETE", path3, { query });
|
|
4659
4577
|
}
|
|
4660
4578
|
/**
|
|
4661
4579
|
* Tail a server-sent-event endpoint (e.g. GET /runs/{id}/events), invoking
|
|
4662
4580
|
* `onEvent` per data frame. Resolves when the server closes the stream or
|
|
4663
4581
|
* `options.signal` aborts.
|
|
4664
4582
|
*/
|
|
4665
|
-
async sse(
|
|
4666
|
-
const res = await this.fetch(this.url(
|
|
4583
|
+
async sse(path3, onEvent, options = {}) {
|
|
4584
|
+
const res = await this.fetch(this.url(path3, options.query), {
|
|
4667
4585
|
method: "GET",
|
|
4668
4586
|
headers: this.headers({ Accept: "text/event-stream" }),
|
|
4669
4587
|
signal: options.signal
|
|
@@ -4695,10 +4613,10 @@ var ApiClient = class {
|
|
|
4695
4613
|
throw new CliError("network", `Event stream failed: ${messageOf(error)}`);
|
|
4696
4614
|
}
|
|
4697
4615
|
}
|
|
4698
|
-
url(
|
|
4699
|
-
const url = new URL(`${this.baseUrl}${
|
|
4700
|
-
for (const [
|
|
4701
|
-
if (value !== void 0) url.searchParams.set(
|
|
4616
|
+
url(path3, query) {
|
|
4617
|
+
const url = new URL(`${this.baseUrl}${path3}`);
|
|
4618
|
+
for (const [key2, value] of Object.entries(query ?? {})) {
|
|
4619
|
+
if (value !== void 0) url.searchParams.set(key2, String(value));
|
|
4702
4620
|
}
|
|
4703
4621
|
return url;
|
|
4704
4622
|
}
|
|
@@ -4727,11 +4645,11 @@ var ApiClient = class {
|
|
|
4727
4645
|
);
|
|
4728
4646
|
}
|
|
4729
4647
|
}
|
|
4730
|
-
async request(method,
|
|
4648
|
+
async request(method, path3, options = {}) {
|
|
4731
4649
|
const headers = this.headers(
|
|
4732
4650
|
options.body === void 0 ? void 0 : { "Content-Type": "application/json" }
|
|
4733
4651
|
);
|
|
4734
|
-
const res = await this.fetch(this.url(
|
|
4652
|
+
const res = await this.fetch(this.url(path3, options.query), {
|
|
4735
4653
|
method,
|
|
4736
4654
|
headers,
|
|
4737
4655
|
body: options.body === void 0 ? void 0 : JSON.stringify(options.body)
|
|
@@ -4836,7 +4754,7 @@ function printItems(items, format, columns) {
|
|
|
4836
4754
|
console.log("(no results)");
|
|
4837
4755
|
return;
|
|
4838
4756
|
}
|
|
4839
|
-
const cols = columns ?? Object.keys(items[0]).map((
|
|
4757
|
+
const cols = columns ?? Object.keys(items[0]).map((key2) => ({ key: key2 }));
|
|
4840
4758
|
const headers = cols.map((col) => col.header ?? col.key);
|
|
4841
4759
|
const rows = items.map((item) => cols.map((col) => cell(item[col.key])));
|
|
4842
4760
|
const widths = headers.map(
|
|
@@ -4965,14 +4883,14 @@ var EXAMPLE_SPEC = {
|
|
|
4965
4883
|
}
|
|
4966
4884
|
]
|
|
4967
4885
|
};
|
|
4968
|
-
function readSpec(
|
|
4886
|
+
function readSpec(path3) {
|
|
4969
4887
|
let raw;
|
|
4970
4888
|
try {
|
|
4971
|
-
raw = readFileSync3(
|
|
4889
|
+
raw = readFileSync3(path3, "utf8");
|
|
4972
4890
|
} catch (e) {
|
|
4973
4891
|
throw new CliError(
|
|
4974
4892
|
"usage",
|
|
4975
|
-
`cannot read spec file ${
|
|
4893
|
+
`cannot read spec file ${path3}: ${e instanceof Error ? e.message : String(e)}`
|
|
4976
4894
|
);
|
|
4977
4895
|
}
|
|
4978
4896
|
let parsed;
|
|
@@ -5116,11 +5034,11 @@ import { createInterface } from "readline";
|
|
|
5116
5034
|
import { setTimeout as sleep } from "timers/promises";
|
|
5117
5035
|
|
|
5118
5036
|
// src/lib/paginate.ts
|
|
5119
|
-
async function fetchAllPages(client,
|
|
5037
|
+
async function fetchAllPages(client, path3, query = {}) {
|
|
5120
5038
|
const items = [];
|
|
5121
5039
|
let cursor;
|
|
5122
5040
|
do {
|
|
5123
|
-
const page = await client.get(
|
|
5041
|
+
const page = await client.get(path3, {
|
|
5124
5042
|
limit: 200,
|
|
5125
5043
|
...query,
|
|
5126
5044
|
cursor
|
|
@@ -5269,11 +5187,11 @@ async function browserLogin() {
|
|
|
5269
5187
|
}
|
|
5270
5188
|
}
|
|
5271
5189
|
var DEVICE_ENDPOINT = "/api/v1/device";
|
|
5272
|
-
async function bootstrapPost(
|
|
5190
|
+
async function bootstrapPost(path3, body) {
|
|
5273
5191
|
const base = resolveBaseUrl().replace(/\/+$/, "");
|
|
5274
5192
|
let res;
|
|
5275
5193
|
try {
|
|
5276
|
-
res = await fetch(`${base}${
|
|
5194
|
+
res = await fetch(`${base}${path3}`, {
|
|
5277
5195
|
method: "POST",
|
|
5278
5196
|
headers: {
|
|
5279
5197
|
"Content-Type": "application/json",
|
|
@@ -5535,8 +5453,8 @@ function register3(program2) {
|
|
|
5535
5453
|
`Token source: ${source === "env" ? "GAUGE_API_TOKEN environment variable" : credentialsPath()}`
|
|
5536
5454
|
);
|
|
5537
5455
|
});
|
|
5538
|
-
const
|
|
5539
|
-
|
|
5456
|
+
const tokens2 = auth.command("tokens").description("Manage API tokens");
|
|
5457
|
+
tokens2.command("list").description("List your API tokens").action(async (_opts, command) => {
|
|
5540
5458
|
const output = resolveOutput(command);
|
|
5541
5459
|
const items = await fetchAllTokens(createClient());
|
|
5542
5460
|
if (output === "json") {
|
|
@@ -5545,7 +5463,7 @@ function register3(program2) {
|
|
|
5545
5463
|
}
|
|
5546
5464
|
printItems(items.map(tokenRow), "table");
|
|
5547
5465
|
});
|
|
5548
|
-
|
|
5466
|
+
tokens2.command("create <name>").description("Create an API token (the secret is shown exactly once)").option("--expires-in <duration>", "e.g. 90d, 12h, or never", "never").action(
|
|
5549
5467
|
async (name, opts, command) => {
|
|
5550
5468
|
const output = resolveOutput(command);
|
|
5551
5469
|
const expiresAt = parseExpiresIn(opts.expiresIn);
|
|
@@ -5566,7 +5484,7 @@ function register3(program2) {
|
|
|
5566
5484
|
console.log("Store it now \u2014 it won't be shown again.");
|
|
5567
5485
|
}
|
|
5568
5486
|
);
|
|
5569
|
-
|
|
5487
|
+
tokens2.command("revoke <id>").description("Revoke an API token").action(async (id, _opts, command) => {
|
|
5570
5488
|
await createClient().delete(
|
|
5571
5489
|
`${TOKENS_PATH}/${encodeURIComponent(id)}`
|
|
5572
5490
|
);
|
|
@@ -6009,37 +5927,137 @@ function register7(program2, opts = {}) {
|
|
|
6009
5927
|
});
|
|
6010
5928
|
}
|
|
6011
5929
|
|
|
5930
|
+
// src/commands/catalog.ts
|
|
5931
|
+
import { readFile } from "fs/promises";
|
|
5932
|
+
var path2 = "/api/v1/staff/catalog";
|
|
5933
|
+
function register8(program2, options = {}) {
|
|
5934
|
+
const catalog = program2.command("catalog", { hidden: options.hidden ?? false }).description(
|
|
5935
|
+
"Staff manifest \u2192 apply \u2192 canary \u2192 activate model catalog flow"
|
|
5936
|
+
);
|
|
5937
|
+
catalog.command("releases").description("List exact harness releases for a manifest").action(async () => printJson(await createClient().get(path2)));
|
|
5938
|
+
for (const action of [
|
|
5939
|
+
"plan",
|
|
5940
|
+
"apply",
|
|
5941
|
+
"canary",
|
|
5942
|
+
"activate",
|
|
5943
|
+
"enable",
|
|
5944
|
+
"disable"
|
|
5945
|
+
]) {
|
|
5946
|
+
catalog.command(`${action} <manifest>`).option("--runs <ids>", "canary run IDs, comma separated (activate)").option(
|
|
5947
|
+
"--force",
|
|
5948
|
+
"activate without successful canary evidence (activate)"
|
|
5949
|
+
).option("--timeout <seconds>", "canary wait timeout", "1800").action(
|
|
5950
|
+
async (file, opts) => {
|
|
5951
|
+
if (opts.force && action !== "activate")
|
|
5952
|
+
throw new Error("--force is only supported by activate");
|
|
5953
|
+
if (opts.runs && action !== "activate")
|
|
5954
|
+
throw new Error("--runs is only supported by activate");
|
|
5955
|
+
const seconds = Number(opts.timeout);
|
|
5956
|
+
if (!Number.isFinite(seconds) || seconds <= 0)
|
|
5957
|
+
throw new Error("--timeout must be positive seconds");
|
|
5958
|
+
let manifest = catalogManifestSchema.parse(
|
|
5959
|
+
JSON.parse(await readFile(file, "utf8"))
|
|
5960
|
+
);
|
|
5961
|
+
const client = createClient();
|
|
5962
|
+
const request = async (step, extra = {}) => {
|
|
5963
|
+
const result = await client.post(path2, {
|
|
5964
|
+
action: step,
|
|
5965
|
+
manifest,
|
|
5966
|
+
...extra
|
|
5967
|
+
});
|
|
5968
|
+
if (result.errors?.length) {
|
|
5969
|
+
printJson(result);
|
|
5970
|
+
throw new Error(
|
|
5971
|
+
result.errors.map((e) => `${e.model}: ${e.message}`).join("; ")
|
|
5972
|
+
);
|
|
5973
|
+
}
|
|
5974
|
+
return result;
|
|
5975
|
+
};
|
|
5976
|
+
if (action === "enable") {
|
|
5977
|
+
const applied = await request("apply");
|
|
5978
|
+
const pending = pendingCatalogManifest(manifest, applied.cells);
|
|
5979
|
+
if (!pending) {
|
|
5980
|
+
printJson(applied);
|
|
5981
|
+
return;
|
|
5982
|
+
}
|
|
5983
|
+
manifest = pending;
|
|
5984
|
+
}
|
|
5985
|
+
if (action === "canary" || action === "enable") {
|
|
5986
|
+
const { runIds, errors } = await client.post(path2, {
|
|
5987
|
+
action: "canary",
|
|
5988
|
+
manifest
|
|
5989
|
+
});
|
|
5990
|
+
process.stderr.write(`Canary runs: ${runIds.join(",")}
|
|
5991
|
+
`);
|
|
5992
|
+
if (errors?.length)
|
|
5993
|
+
throw new Error(
|
|
5994
|
+
`Canary launch incomplete: ${JSON.stringify({ runIds, errors })}`
|
|
5995
|
+
);
|
|
5996
|
+
const deadline = Date.now() + seconds * 1e3;
|
|
5997
|
+
while (Date.now() < deadline) {
|
|
5998
|
+
const status = await client.post(path2, {
|
|
5999
|
+
action: "status",
|
|
6000
|
+
manifest,
|
|
6001
|
+
runIds
|
|
6002
|
+
});
|
|
6003
|
+
if (status.passed) {
|
|
6004
|
+
printJson(
|
|
6005
|
+
action === "enable" ? await request("activate", { runIds }) : { runIds, ...status }
|
|
6006
|
+
);
|
|
6007
|
+
return;
|
|
6008
|
+
}
|
|
6009
|
+
if (status.terminal)
|
|
6010
|
+
throw new Error(
|
|
6011
|
+
`Canary failed: ${JSON.stringify(status.runs)}`
|
|
6012
|
+
);
|
|
6013
|
+
await new Promise((resolve2) => setTimeout(resolve2, 5e3));
|
|
6014
|
+
}
|
|
6015
|
+
throw new Error(
|
|
6016
|
+
`Canary timed out; runs continue. Inspect ${runIds.join(",")} then activate with --runs.`
|
|
6017
|
+
);
|
|
6018
|
+
}
|
|
6019
|
+
printJson(
|
|
6020
|
+
await request(action, {
|
|
6021
|
+
...opts.runs ? { runIds: opts.runs.split(",") } : {},
|
|
6022
|
+
...opts.force ? { force: true } : {}
|
|
6023
|
+
})
|
|
6024
|
+
);
|
|
6025
|
+
}
|
|
6026
|
+
);
|
|
6027
|
+
}
|
|
6028
|
+
}
|
|
6029
|
+
|
|
6012
6030
|
// src/commands/config.ts
|
|
6013
6031
|
var config_exports = {};
|
|
6014
6032
|
__export(config_exports, {
|
|
6015
|
-
register: () =>
|
|
6033
|
+
register: () => register9
|
|
6016
6034
|
});
|
|
6017
|
-
function assertKey(
|
|
6018
|
-
if (CONFIG_KEYS.includes(
|
|
6019
|
-
return
|
|
6035
|
+
function assertKey(key2) {
|
|
6036
|
+
if (CONFIG_KEYS.includes(key2)) {
|
|
6037
|
+
return key2;
|
|
6020
6038
|
}
|
|
6021
6039
|
throw new CliError(
|
|
6022
6040
|
"usage",
|
|
6023
|
-
`Unknown config key '${
|
|
6041
|
+
`Unknown config key '${key2}'. Valid keys: ${CONFIG_KEYS.join(", ")}`
|
|
6024
6042
|
);
|
|
6025
6043
|
}
|
|
6026
|
-
function
|
|
6044
|
+
function register9(program2) {
|
|
6027
6045
|
const config = program2.command("config").description("Local client config (~/.config/gauge/config.json)");
|
|
6028
|
-
config.command("get [key]").description("Print the whole config, or a single key's value").action((
|
|
6046
|
+
config.command("get [key]").description("Print the whole config, or a single key's value").action((key2) => {
|
|
6029
6047
|
const current = readConfig();
|
|
6030
|
-
if (
|
|
6048
|
+
if (key2 === void 0) {
|
|
6031
6049
|
printJson(current);
|
|
6032
6050
|
return;
|
|
6033
6051
|
}
|
|
6034
|
-
console.log(current[assertKey(
|
|
6052
|
+
console.log(current[assertKey(key2)] ?? "");
|
|
6035
6053
|
});
|
|
6036
|
-
config.command("set <key> <value>").description(`Set a config key (${CONFIG_KEYS.join(", ")})`).action((
|
|
6037
|
-
const configKey = assertKey(
|
|
6054
|
+
config.command("set <key> <value>").description(`Set a config key (${CONFIG_KEYS.join(", ")})`).action((key2, value) => {
|
|
6055
|
+
const configKey = assertKey(key2);
|
|
6038
6056
|
updateConfig({ [configKey]: value });
|
|
6039
6057
|
console.log(`${configKey} = ${value} (${configPath()})`);
|
|
6040
6058
|
});
|
|
6041
|
-
config.command("unset <key>").description("Remove a config key").action((
|
|
6042
|
-
const configKey = assertKey(
|
|
6059
|
+
config.command("unset <key>").description("Remove a config key").action((key2) => {
|
|
6060
|
+
const configKey = assertKey(key2);
|
|
6043
6061
|
updateConfig({ [configKey]: void 0 });
|
|
6044
6062
|
console.log(`${configKey} unset (${configPath()})`);
|
|
6045
6063
|
});
|
|
@@ -6048,12 +6066,12 @@ function register8(program2) {
|
|
|
6048
6066
|
// src/commands/connections.ts
|
|
6049
6067
|
var connections_exports2 = {};
|
|
6050
6068
|
__export(connections_exports2, {
|
|
6051
|
-
register: () =>
|
|
6069
|
+
register: () => register10
|
|
6052
6070
|
});
|
|
6053
6071
|
function connectionsPath(org) {
|
|
6054
6072
|
return `/api/v1/orgs/${encodeURIComponent(org)}/connections`;
|
|
6055
6073
|
}
|
|
6056
|
-
function
|
|
6074
|
+
function register10(program2) {
|
|
6057
6075
|
const group = program2.command("connections").alias("credentials").description("Inspect the org's stored credentials (no secrets)");
|
|
6058
6076
|
group.command("list").description("List credentials with the ids --connection accepts").action(async (_opts, cmd) => {
|
|
6059
6077
|
const org = resolveOrg(cmd);
|
|
@@ -6069,7 +6087,7 @@ function register9(program2) {
|
|
|
6069
6087
|
id: c.id,
|
|
6070
6088
|
name: c.handle,
|
|
6071
6089
|
vendor: c.profileLabel,
|
|
6072
|
-
placeholder: c.credentialKey,
|
|
6090
|
+
placeholder: [c.credentialKey, c.basicPasswordKey].filter(Boolean).join(", "),
|
|
6073
6091
|
domains: c.allowedHosts.join(", "),
|
|
6074
6092
|
kind: c.kind,
|
|
6075
6093
|
value: c.last4 ? `\xB7\xB7\xB7\xB7${c.last4}` : ""
|
|
@@ -6082,13 +6100,13 @@ function register9(program2) {
|
|
|
6082
6100
|
// src/commands/dashboards.ts
|
|
6083
6101
|
var dashboards_exports2 = {};
|
|
6084
6102
|
__export(dashboards_exports2, {
|
|
6085
|
-
register: () =>
|
|
6103
|
+
register: () => register11
|
|
6086
6104
|
});
|
|
6087
6105
|
import { readFileSync as readFileSync5 } from "fs";
|
|
6088
6106
|
function dashboardsPath(org) {
|
|
6089
6107
|
return `/api/v1/orgs/${encodeURIComponent(org)}/dashboards`;
|
|
6090
6108
|
}
|
|
6091
|
-
function
|
|
6109
|
+
function register11(program2) {
|
|
6092
6110
|
const group = program2.command("dashboards").description("Saved dashboards (CRUD + view filters; layout is UI-only)");
|
|
6093
6111
|
group.command("list").description("List your dashboard library").action(async (_opts, cmd) => {
|
|
6094
6112
|
const org = resolveOrg(cmd);
|
|
@@ -6107,10 +6125,10 @@ function register10(program2) {
|
|
|
6107
6125
|
"table"
|
|
6108
6126
|
);
|
|
6109
6127
|
});
|
|
6110
|
-
group.command("get <key>").description("Show one resolved dashboard (widgets + saved filters)").action(async (
|
|
6128
|
+
group.command("get <key>").description("Show one resolved dashboard (widgets + saved filters)").action(async (key2, _opts, cmd) => {
|
|
6111
6129
|
const org = resolveOrg(cmd);
|
|
6112
6130
|
const dashboard = await createClient().get(
|
|
6113
|
-
`${dashboardsPath(org)}/${encodeURIComponent(
|
|
6131
|
+
`${dashboardsPath(org)}/${encodeURIComponent(key2)}`
|
|
6114
6132
|
);
|
|
6115
6133
|
if (resolveOutput(cmd) === "json") {
|
|
6116
6134
|
printJson(dashboard);
|
|
@@ -6132,25 +6150,25 @@ function register10(program2) {
|
|
|
6132
6150
|
if (resolveOutput(cmd) === "json") printJson(created);
|
|
6133
6151
|
else console.log(`Created dashboard ${created.key}`);
|
|
6134
6152
|
});
|
|
6135
|
-
group.command("rename <key> <name>").description("Rename a dashboard (in your overlay)").action(async (
|
|
6153
|
+
group.command("rename <key> <name>").description("Rename a dashboard (in your overlay)").action(async (key2, name, _opts, cmd) => {
|
|
6136
6154
|
const org = resolveOrg(cmd);
|
|
6137
6155
|
const updated = await createClient().patch(
|
|
6138
|
-
`${dashboardsPath(org)}/${encodeURIComponent(
|
|
6156
|
+
`${dashboardsPath(org)}/${encodeURIComponent(key2)}`,
|
|
6139
6157
|
{ name }
|
|
6140
6158
|
);
|
|
6141
6159
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
6142
6160
|
else console.log(`Renamed to ${updated.name}`);
|
|
6143
6161
|
});
|
|
6144
|
-
group.command("rm <key>").description("Delete a dashboard (built-in templates refuse)").action(async (
|
|
6162
|
+
group.command("rm <key>").description("Delete a dashboard (built-in templates refuse)").action(async (key2, _opts, cmd) => {
|
|
6145
6163
|
const org = resolveOrg(cmd);
|
|
6146
6164
|
await createClient().delete(
|
|
6147
|
-
`${dashboardsPath(org)}/${encodeURIComponent(
|
|
6165
|
+
`${dashboardsPath(org)}/${encodeURIComponent(key2)}`
|
|
6148
6166
|
);
|
|
6149
6167
|
if (resolveOutput(cmd) !== "json")
|
|
6150
|
-
console.log(`Deleted dashboard ${
|
|
6168
|
+
console.log(`Deleted dashboard ${key2}`);
|
|
6151
6169
|
});
|
|
6152
6170
|
group.command("filters <key>").description("Replace a dashboard's saved view-level filters").option("--json <json>", "the filters object inline").option("--file <path>", 'the filters object from a file ("-" for stdin)').option("--clear", "remove all saved filters").action(
|
|
6153
|
-
async (
|
|
6171
|
+
async (key2, opts, cmd) => {
|
|
6154
6172
|
const org = resolveOrg(cmd);
|
|
6155
6173
|
const provided = [opts.json, opts.file, opts.clear].filter(
|
|
6156
6174
|
(v) => v !== void 0 && v !== false
|
|
@@ -6173,7 +6191,7 @@ function register10(program2) {
|
|
|
6173
6191
|
}
|
|
6174
6192
|
}
|
|
6175
6193
|
const updated = await createClient().put(
|
|
6176
|
-
`${dashboardsPath(org)}/${encodeURIComponent(
|
|
6194
|
+
`${dashboardsPath(org)}/${encodeURIComponent(key2)}/filters`,
|
|
6177
6195
|
filters
|
|
6178
6196
|
);
|
|
6179
6197
|
if (resolveOutput(cmd) === "json") printJson(updated);
|
|
@@ -6190,7 +6208,7 @@ var evals_exports2 = {};
|
|
|
6190
6208
|
__export(evals_exports2, {
|
|
6191
6209
|
evalSetsPath: () => evalSetsPath,
|
|
6192
6210
|
parseCriterion: () => parseCriterion,
|
|
6193
|
-
register: () =>
|
|
6211
|
+
register: () => register12
|
|
6194
6212
|
});
|
|
6195
6213
|
import { readFileSync as readFileSync6 } from "fs";
|
|
6196
6214
|
import { Option as Option2 } from "commander";
|
|
@@ -6411,28 +6429,28 @@ import { isAbsolute, relative, resolve, sep } from "path";
|
|
|
6411
6429
|
// ../packages/api-schemas/src/compileRunDefinition.ts
|
|
6412
6430
|
import { createHash as createHash2 } from "crypto";
|
|
6413
6431
|
import { parseDocument } from "yaml";
|
|
6414
|
-
function utf8(bytes,
|
|
6432
|
+
function utf8(bytes, path3) {
|
|
6415
6433
|
try {
|
|
6416
6434
|
return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
6417
6435
|
} catch {
|
|
6418
|
-
throw new Error(`${
|
|
6436
|
+
throw new Error(`${path3} is not UTF-8 text`);
|
|
6419
6437
|
}
|
|
6420
6438
|
}
|
|
6421
|
-
function markdownCase(
|
|
6422
|
-
const source = utf8(bytes,
|
|
6439
|
+
function markdownCase(path3, bytes) {
|
|
6440
|
+
const source = utf8(bytes, path3);
|
|
6423
6441
|
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(source);
|
|
6424
6442
|
if (!match)
|
|
6425
|
-
throw new Error(`${
|
|
6443
|
+
throw new Error(`${path3}: expected YAML frontmatter between --- lines`);
|
|
6426
6444
|
const document = parseDocument(match[1], { uniqueKeys: true });
|
|
6427
6445
|
if (document.errors.length)
|
|
6428
6446
|
throw new Error(
|
|
6429
|
-
`${
|
|
6447
|
+
`${path3}: ${document.errors.map((error) => error.message).join("; ")}`
|
|
6430
6448
|
);
|
|
6431
6449
|
const parsed = runDefinitionFrontmatterSchema.safeParse(document.toJS());
|
|
6432
|
-
if (!parsed.success) throw new Error(`${
|
|
6450
|
+
if (!parsed.success) throw new Error(`${path3}: ${parsed.error.message}`);
|
|
6433
6451
|
const prompt = match[2].trim();
|
|
6434
|
-
if (!prompt) throw new Error(`${
|
|
6435
|
-
return { path:
|
|
6452
|
+
if (!prompt) throw new Error(`${path3}: Markdown body is empty`);
|
|
6453
|
+
return { path: path3, prompt, ...parsed.data };
|
|
6436
6454
|
}
|
|
6437
6455
|
function compileRunDefinitionFromBlobs(input) {
|
|
6438
6456
|
if (!uncredentialedRepoUrlSchema.safeParse(input.repoUrl).success)
|
|
@@ -6467,18 +6485,18 @@ function compileRunDefinitionFromBlobs(input) {
|
|
|
6467
6485
|
throw new Error("gauge.json: install requires prepare");
|
|
6468
6486
|
if (preparation && !input.repoUrl.startsWith("https://"))
|
|
6469
6487
|
throw new Error("Project preparation requires a public HTTPS Git origin");
|
|
6470
|
-
const cases = input.casePaths.map((
|
|
6471
|
-
const bytes = input.blobs.get(
|
|
6472
|
-
if (!
|
|
6473
|
-
throw new Error(`Missing committed Markdown case: ${
|
|
6474
|
-
return markdownCase(
|
|
6488
|
+
const cases = input.casePaths.map((path3) => {
|
|
6489
|
+
const bytes = input.blobs.get(path3);
|
|
6490
|
+
if (!path3.endsWith(".md") || !bytes)
|
|
6491
|
+
throw new Error(`Missing committed Markdown case: ${path3}`);
|
|
6492
|
+
return markdownCase(path3, bytes);
|
|
6475
6493
|
});
|
|
6476
6494
|
const hash = createHash2("sha256");
|
|
6477
6495
|
hash.update("gauge-run-definition-v1\0");
|
|
6478
|
-
for (const [
|
|
6496
|
+
for (const [path3, bytes] of [...input.blobs.entries()].sort(
|
|
6479
6497
|
([a], [b]) => a < b ? -1 : a > b ? 1 : 0
|
|
6480
6498
|
)) {
|
|
6481
|
-
hash.update(
|
|
6499
|
+
hash.update(path3);
|
|
6482
6500
|
hash.update("\0");
|
|
6483
6501
|
hash.update(String(bytes.length));
|
|
6484
6502
|
hash.update("\0");
|
|
@@ -6525,20 +6543,20 @@ function git(cwd, args) {
|
|
|
6525
6543
|
throw new CliError("usage", `git ${args[0]} failed: ${detail}`);
|
|
6526
6544
|
}
|
|
6527
6545
|
}
|
|
6528
|
-
function committedBlob(root, commit,
|
|
6529
|
-
return git(root, ["show", `${commit}:${
|
|
6546
|
+
function committedBlob(root, commit, path3) {
|
|
6547
|
+
return git(root, ["show", `${commit}:${path3}`]);
|
|
6530
6548
|
}
|
|
6531
6549
|
function relativeGitPath(root, cwd, input) {
|
|
6532
6550
|
if (!input || input.includes("\0") || /[*?[\]{}]/.test(input))
|
|
6533
6551
|
throw new CliError("usage", `expected an explicit case path: ${input}`);
|
|
6534
6552
|
const absolute = resolve(cwd, input);
|
|
6535
|
-
const
|
|
6536
|
-
if (!
|
|
6553
|
+
const path3 = relative(root, absolute);
|
|
6554
|
+
if (!path3 || path3 === ".." || path3.startsWith(`..${sep}`) || isAbsolute(path3))
|
|
6537
6555
|
throw new CliError(
|
|
6538
6556
|
"usage",
|
|
6539
6557
|
`case path is outside this Git repository: ${input}`
|
|
6540
6558
|
);
|
|
6541
|
-
const gitPath =
|
|
6559
|
+
const gitPath = path3.split(sep).join("/");
|
|
6542
6560
|
if (!gitPath.endsWith(".md"))
|
|
6543
6561
|
throw new CliError("usage", `case path must end in .md: ${input}`);
|
|
6544
6562
|
return gitPath;
|
|
@@ -6577,7 +6595,7 @@ function loadCommittedRunDefinitionWithContext(files, cwd = process.cwd()) {
|
|
|
6577
6595
|
committedBlob(root, commit, ".gauge/prepare.sh")
|
|
6578
6596
|
);
|
|
6579
6597
|
}
|
|
6580
|
-
for (const
|
|
6598
|
+
for (const path3 of paths) blobs.set(path3, committedBlob(root, commit, path3));
|
|
6581
6599
|
try {
|
|
6582
6600
|
const result = compileRunDefinitionFromBlobs({
|
|
6583
6601
|
repoUrl,
|
|
@@ -6614,10 +6632,10 @@ function parseCriterion(raw) {
|
|
|
6614
6632
|
}
|
|
6615
6633
|
return { name: raw.slice(0, idx).trim(), rubric: raw.slice(idx + 1).trim() };
|
|
6616
6634
|
}
|
|
6617
|
-
function readCriteriaFile(
|
|
6635
|
+
function readCriteriaFile(path3) {
|
|
6618
6636
|
let parsed;
|
|
6619
6637
|
try {
|
|
6620
|
-
parsed = JSON.parse(readFileSync6(
|
|
6638
|
+
parsed = JSON.parse(readFileSync6(path3 === "-" ? 0 : path3, "utf8"));
|
|
6621
6639
|
} catch (e) {
|
|
6622
6640
|
throw new CliError(
|
|
6623
6641
|
"usage",
|
|
@@ -6676,7 +6694,7 @@ function printDetail2(e) {
|
|
|
6676
6694
|
console.log("criteria:");
|
|
6677
6695
|
for (const c of e.criteria) console.log(` [${c.id}] ${c.name}: ${c.rubric}`);
|
|
6678
6696
|
}
|
|
6679
|
-
function
|
|
6697
|
+
function register12(program2) {
|
|
6680
6698
|
const group = program2.command("evals").description("Manage eval sets (judged agent-experience measurements)");
|
|
6681
6699
|
group.command("plan").description(
|
|
6682
6700
|
"Validate committed Markdown cases and preview a Git-native run"
|
|
@@ -6929,418 +6947,6 @@ function register11(program2) {
|
|
|
6929
6947
|
);
|
|
6930
6948
|
}
|
|
6931
6949
|
|
|
6932
|
-
// src/commands/experiments.ts
|
|
6933
|
-
var experiments_exports2 = {};
|
|
6934
|
-
__export(experiments_exports2, {
|
|
6935
|
-
register: () => register12,
|
|
6936
|
-
rewriteContentType: () => rewriteContentType
|
|
6937
|
-
});
|
|
6938
|
-
import { readFileSync as readFileSync7 } from "fs";
|
|
6939
|
-
import { extname } from "path";
|
|
6940
|
-
var TERMINAL = /* @__PURE__ */ new Set(["COMPLETE", "PARTIAL", "FAILED", "CANCELED"]);
|
|
6941
|
-
function experimentsPath(org) {
|
|
6942
|
-
return `/api/v1/orgs/${encodeURIComponent(org)}/experiments`;
|
|
6943
|
-
}
|
|
6944
|
-
function itemPath(org, id) {
|
|
6945
|
-
return `${experimentsPath(org)}/${encodeURIComponent(id)}`;
|
|
6946
|
-
}
|
|
6947
|
-
function readText(path2) {
|
|
6948
|
-
return readFileSync7(path2 === "-" ? 0 : path2, "utf8");
|
|
6949
|
-
}
|
|
6950
|
-
var REWRITE_FILE_CONTENT_TYPES = {
|
|
6951
|
-
".md": "text/markdown",
|
|
6952
|
-
".markdown": "text/markdown",
|
|
6953
|
-
".html": "text/html",
|
|
6954
|
-
".htm": "text/html",
|
|
6955
|
-
".txt": "text/plain"
|
|
6956
|
-
};
|
|
6957
|
-
function rewriteContentType(path2, explicit) {
|
|
6958
|
-
if (explicit !== void 0) return explicit;
|
|
6959
|
-
if (path2 === void 0 || path2 === "-") return void 0;
|
|
6960
|
-
return REWRITE_FILE_CONTENT_TYPES[extname(path2).toLowerCase()];
|
|
6961
|
-
}
|
|
6962
|
-
function sleep2(ms) {
|
|
6963
|
-
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
6964
|
-
}
|
|
6965
|
-
function toRow3(e) {
|
|
6966
|
-
return {
|
|
6967
|
-
id: e.id,
|
|
6968
|
-
status: e.status,
|
|
6969
|
-
problem: e.problem.length > 60 ? `${e.problem.slice(0, 57)}...` : e.problem,
|
|
6970
|
-
page: e.boundaryUrl ?? "",
|
|
6971
|
-
variants: e.variantCount,
|
|
6972
|
-
"source run": e.sourceRunId,
|
|
6973
|
-
created: e.createdAt
|
|
6974
|
-
};
|
|
6975
|
-
}
|
|
6976
|
-
function printDetail3(e) {
|
|
6977
|
-
console.log(`id: ${e.id}`);
|
|
6978
|
-
console.log(`status: ${e.status}`);
|
|
6979
|
-
console.log(`problem: ${e.problem}`);
|
|
6980
|
-
console.log(`page: ${e.boundaryUrl ?? "(none)"}`);
|
|
6981
|
-
console.log(`source run: ${e.sourceRun.runId} (${e.sourceRun.agent})`);
|
|
6982
|
-
if (e.launchError) console.log(`launch err: ${e.launchError}`);
|
|
6983
|
-
console.log("variants:");
|
|
6984
|
-
for (const v of e.variants) {
|
|
6985
|
-
const rewrite = v.hasRewrite ? `${v.rewriteChars} chars` : "no rewrite yet";
|
|
6986
|
-
const state = v.invalidReason ? `invalid: ${v.invalidReason}` : v.planStatus ?? "draft";
|
|
6987
|
-
console.log(
|
|
6988
|
-
` [${v.key}] ${v.title || "(untitled)"} \u2014 ${rewrite}, ${state}`
|
|
6989
|
-
);
|
|
6990
|
-
if (v.hypothesis) console.log(` hypothesis: ${v.hypothesis}`);
|
|
6991
|
-
for (const r of v.runs) {
|
|
6992
|
-
console.log(
|
|
6993
|
-
` run ${r.runId}: ${r.status}${r.failureReason ? ` (${r.failureReason})` : ""}`
|
|
6994
|
-
);
|
|
6995
|
-
}
|
|
6996
|
-
}
|
|
6997
|
-
}
|
|
6998
|
-
function register12(program2) {
|
|
6999
|
-
const group = program2.command("experiments").description(
|
|
7000
|
-
"Author, launch, and read content experiments (legacy: orgs with Optimizations reject writes; use `gauge optimizations`)"
|
|
7001
|
-
);
|
|
7002
|
-
group.command("list").description("List the org's experiments").option(
|
|
7003
|
-
"--status <statuses>",
|
|
7004
|
-
"comma-separated statuses (e.g. RUNNING,COMPLETE)"
|
|
7005
|
-
).option("--limit <n>", "max rows (default 25)").action(async (opts, cmd) => {
|
|
7006
|
-
const org = resolveOrg(cmd);
|
|
7007
|
-
const res = await createClient().get(
|
|
7008
|
-
experimentsPath(org),
|
|
7009
|
-
{ status: opts.status, limit: opts.limit }
|
|
7010
|
-
);
|
|
7011
|
-
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
7012
|
-
else printItems(res.items.map(toRow3), "table");
|
|
7013
|
-
});
|
|
7014
|
-
group.command("eligible").description("Recent runs worth experimenting on (worst verdicts first)").action(async (_opts, cmd) => {
|
|
7015
|
-
const org = resolveOrg(cmd);
|
|
7016
|
-
const res = await createClient().get(`${experimentsPath(org)}/eligible-runs`);
|
|
7017
|
-
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
7018
|
-
else
|
|
7019
|
-
printItems(
|
|
7020
|
-
res.items.map((r) => ({
|
|
7021
|
-
"run id": r.runId,
|
|
7022
|
-
agent: r.agent,
|
|
7023
|
-
verdict: r.verdict ?? "-",
|
|
7024
|
-
boundaries: r.boundaryCount,
|
|
7025
|
-
created: r.createdAt
|
|
7026
|
-
})),
|
|
7027
|
-
"table"
|
|
7028
|
-
);
|
|
7029
|
-
});
|
|
7030
|
-
group.command("boundaries").description("The forkable fetches of a run (pass boundarySeq to create)").requiredOption("--run <runId>", "source run id").action(async (opts, cmd) => {
|
|
7031
|
-
const org = resolveOrg(cmd);
|
|
7032
|
-
const res = await createClient().get(`${experimentsPath(org)}/boundaries`, { runId: opts.run });
|
|
7033
|
-
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
7034
|
-
else
|
|
7035
|
-
printItems(
|
|
7036
|
-
res.items.map((b) => ({
|
|
7037
|
-
boundarySeq: String(b.boundarySeq),
|
|
7038
|
-
turn: b.turn ?? "?",
|
|
7039
|
-
url: b.url,
|
|
7040
|
-
prompt: b.fetchPrompt ?? ""
|
|
7041
|
-
})),
|
|
7042
|
-
"table"
|
|
7043
|
-
);
|
|
7044
|
-
});
|
|
7045
|
-
group.command("create").description(
|
|
7046
|
-
"Open (or resume) an experiment draft and start the plan round"
|
|
7047
|
-
).requiredOption("--run <runId>", "source run id").requiredOption(
|
|
7048
|
-
"--boundary <seq>",
|
|
7049
|
-
"opaque boundarySeq from `experiments boundaries`"
|
|
7050
|
-
).option("--problem <text>", "problem statement (derived if omitted)").option(
|
|
7051
|
-
"--mode <mode>",
|
|
7052
|
-
"who writes the rewrites: propose (default, directions are proposed then each is written), direct (one --change instruction, one write), manual (no generation \u2014 the rewrite is seeded with the page the agent read)",
|
|
7053
|
-
"propose"
|
|
7054
|
-
).option(
|
|
7055
|
-
"--change <text>",
|
|
7056
|
-
"--mode direct only: the one change to make, in your words"
|
|
7057
|
-
).action(
|
|
7058
|
-
async (opts, cmd) => {
|
|
7059
|
-
const org = resolveOrg(cmd);
|
|
7060
|
-
const parsedMode = experiments_exports.experimentModeSchema.safeParse(
|
|
7061
|
-
opts.mode.toUpperCase()
|
|
7062
|
-
);
|
|
7063
|
-
if (!parsedMode.success) {
|
|
7064
|
-
throw new Error(
|
|
7065
|
-
`--mode must be one of ${experiments_exports.EXPERIMENT_MODES.map((m) => m.toLowerCase()).join(", ")}`
|
|
7066
|
-
);
|
|
7067
|
-
}
|
|
7068
|
-
const mode = parsedMode.data;
|
|
7069
|
-
if (mode === "DIRECT" && !opts.change?.trim()) {
|
|
7070
|
-
throw new Error("--mode direct requires --change <text>");
|
|
7071
|
-
}
|
|
7072
|
-
if (mode !== "DIRECT" && opts.change !== void 0) {
|
|
7073
|
-
throw new Error(`--change only applies to --mode direct`);
|
|
7074
|
-
}
|
|
7075
|
-
const body = {
|
|
7076
|
-
runId: opts.run,
|
|
7077
|
-
boundarySeq: opts.boundary,
|
|
7078
|
-
...opts.problem !== void 0 ? { problemText: opts.problem } : {},
|
|
7079
|
-
mode,
|
|
7080
|
-
...opts.change !== void 0 ? { changeInstruction: opts.change.trim() } : {}
|
|
7081
|
-
};
|
|
7082
|
-
const result = await createClient().post(
|
|
7083
|
-
experimentsPath(org),
|
|
7084
|
-
body
|
|
7085
|
-
);
|
|
7086
|
-
if (resolveOutput(cmd) === "json") {
|
|
7087
|
-
printJson(result);
|
|
7088
|
-
return;
|
|
7089
|
-
}
|
|
7090
|
-
console.log(
|
|
7091
|
-
`${result.created ? "Created" : "Resumed"} experiment ${result.experimentId}`
|
|
7092
|
-
);
|
|
7093
|
-
console.log(`Problem: ${result.problemText}`);
|
|
7094
|
-
console.log(`Mode: ${result.mode.toLowerCase()}`);
|
|
7095
|
-
if (!result.created && result.mode !== mode) {
|
|
7096
|
-
console.error(
|
|
7097
|
-
`Note: this fetch already had a live ${result.mode.toLowerCase()} draft, so --mode ${mode.toLowerCase()} was not applied \u2014 that draft was resumed instead.`
|
|
7098
|
-
);
|
|
7099
|
-
}
|
|
7100
|
-
console.error(
|
|
7101
|
-
result.mode === "MANUAL" ? `Tip: \`gauge experiments get ${result.experimentId}\` shows the seeded rewrite once the page is recovered` : `Tip: \`gauge experiments watch ${result.experimentId}\` follows the ${result.mode === "DIRECT" ? "write" : "plan"} round`
|
|
7102
|
-
);
|
|
7103
|
-
}
|
|
7104
|
-
);
|
|
7105
|
-
group.command("get <id>").description("Full detail: directions, rewrites, arms, verdicts").action(async (id, _opts, cmd) => {
|
|
7106
|
-
const org = resolveOrg(cmd);
|
|
7107
|
-
const detail = await createClient().get(
|
|
7108
|
-
itemPath(org, id)
|
|
7109
|
-
);
|
|
7110
|
-
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
7111
|
-
else printDetail3(detail);
|
|
7112
|
-
});
|
|
7113
|
-
group.command("status <id>").description("The async round/launch state (carries launchError)").action(async (id, _opts, cmd) => {
|
|
7114
|
-
const org = resolveOrg(cmd);
|
|
7115
|
-
const status = await createClient().get(
|
|
7116
|
-
`${itemPath(org, id)}/status`
|
|
7117
|
-
);
|
|
7118
|
-
if (resolveOutput(cmd) === "json") printJson(status);
|
|
7119
|
-
else {
|
|
7120
|
-
console.log(`status: ${status.status}`);
|
|
7121
|
-
if (status.launchError)
|
|
7122
|
-
console.log(`launch error: ${status.launchError}`);
|
|
7123
|
-
if (status.shippedVariantId)
|
|
7124
|
-
console.log(
|
|
7125
|
-
`shipped: ${status.shippedVariantId} at ${status.shippedAt}`
|
|
7126
|
-
);
|
|
7127
|
-
}
|
|
7128
|
-
});
|
|
7129
|
-
const variants = group.command("variants").description("Manage a draft's rewrite directions");
|
|
7130
|
-
variants.command("add <experimentId>").description("Add a direction (a candidate rewrite slot)").option("--title <title>", "direction title").option("--hypothesis <text>", "what this rewrite should change").action(
|
|
7131
|
-
async (experimentId, opts, cmd) => {
|
|
7132
|
-
const org = resolveOrg(cmd);
|
|
7133
|
-
const created = await createClient().post(
|
|
7134
|
-
`${itemPath(org, experimentId)}/variants`,
|
|
7135
|
-
opts
|
|
7136
|
-
);
|
|
7137
|
-
if (resolveOutput(cmd) === "json") printJson(created);
|
|
7138
|
-
else console.log(`Added variant ${created.key} (${created.id})`);
|
|
7139
|
-
}
|
|
7140
|
-
);
|
|
7141
|
-
variants.command("edit <experimentId> <variantId>").description("Retitle / re-hypothesize a direction").option("--title <title>", "direction title").option("--hypothesis <text>", "hypothesis").action(
|
|
7142
|
-
async (experimentId, variantId, opts, cmd) => {
|
|
7143
|
-
if (opts.title === void 0 && opts.hypothesis === void 0)
|
|
7144
|
-
throw new CliError("usage", "nothing to change");
|
|
7145
|
-
const org = resolveOrg(cmd);
|
|
7146
|
-
await createClient().patch(
|
|
7147
|
-
`${itemPath(org, experimentId)}/variants/${encodeURIComponent(variantId)}`,
|
|
7148
|
-
opts
|
|
7149
|
-
);
|
|
7150
|
-
if (resolveOutput(cmd) !== "json") console.log("Updated");
|
|
7151
|
-
}
|
|
7152
|
-
);
|
|
7153
|
-
variants.command("rm <experimentId> <variantId>").description("Remove a direction from the draft").action(
|
|
7154
|
-
async (experimentId, variantId, _o, cmd) => {
|
|
7155
|
-
const org = resolveOrg(cmd);
|
|
7156
|
-
await createClient().delete(
|
|
7157
|
-
`${itemPath(org, experimentId)}/variants/${encodeURIComponent(variantId)}`
|
|
7158
|
-
);
|
|
7159
|
-
if (resolveOutput(cmd) !== "json") console.log("Removed");
|
|
7160
|
-
}
|
|
7161
|
-
);
|
|
7162
|
-
group.command("content <id>").description("Read the live page (or a rewrite) in bounded windows").option("--variant <variantId>", "read this variant's rewrite instead").option("--offset <n>", "start offset (default 0)").option("--max-chars <n>", "window size (default 20000, max 40000)").action(
|
|
7163
|
-
async (id, opts, cmd) => {
|
|
7164
|
-
const org = resolveOrg(cmd);
|
|
7165
|
-
const result = await createClient().get(
|
|
7166
|
-
`${itemPath(org, id)}/content`,
|
|
7167
|
-
{
|
|
7168
|
-
variantId: opts.variant,
|
|
7169
|
-
offset: opts.offset,
|
|
7170
|
-
maxChars: opts.maxChars
|
|
7171
|
-
}
|
|
7172
|
-
);
|
|
7173
|
-
if (resolveOutput(cmd) === "json") {
|
|
7174
|
-
printJson(result);
|
|
7175
|
-
return;
|
|
7176
|
-
}
|
|
7177
|
-
process.stdout.write(result.content);
|
|
7178
|
-
if (result.nextOffset != null)
|
|
7179
|
-
console.error(
|
|
7180
|
-
`
|
|
7181
|
-
--- ${result.returnedChars}/${result.totalChars} chars; continue with --offset ${result.nextOffset}`
|
|
7182
|
-
);
|
|
7183
|
-
}
|
|
7184
|
-
);
|
|
7185
|
-
group.command("rewrite <id> <variantId>").description(
|
|
7186
|
-
"Write a variant's page: --file replaces it; --edits-file applies {find, replace} ops"
|
|
7187
|
-
).option("--file <path>", 'full content ("-" for stdin)').option(
|
|
7188
|
-
"--content-type <mime>",
|
|
7189
|
-
"rewrite MIME type (inferred for .md, .markdown, .html, .htm, and .txt)"
|
|
7190
|
-
).option(
|
|
7191
|
-
"--edits-file <path>",
|
|
7192
|
-
'JSON array of {find, replace} ops ("-" for stdin)'
|
|
7193
|
-
).action(
|
|
7194
|
-
async (id, variantId, opts, cmd) => {
|
|
7195
|
-
if (opts.file === void 0 === (opts.editsFile === void 0))
|
|
7196
|
-
throw new CliError(
|
|
7197
|
-
"usage",
|
|
7198
|
-
"pass exactly one of --file or --edits-file"
|
|
7199
|
-
);
|
|
7200
|
-
const org = resolveOrg(cmd);
|
|
7201
|
-
const body = {};
|
|
7202
|
-
if (opts.file !== void 0) body.content = readText(opts.file);
|
|
7203
|
-
else {
|
|
7204
|
-
let parsed;
|
|
7205
|
-
try {
|
|
7206
|
-
parsed = JSON.parse(readText(opts.editsFile));
|
|
7207
|
-
} catch (e) {
|
|
7208
|
-
throw new CliError(
|
|
7209
|
-
"usage",
|
|
7210
|
-
`could not read --edits-file: ${e instanceof Error ? e.message : e}`
|
|
7211
|
-
);
|
|
7212
|
-
}
|
|
7213
|
-
if (!Array.isArray(parsed) || parsed.length === 0)
|
|
7214
|
-
throw new CliError(
|
|
7215
|
-
"usage",
|
|
7216
|
-
"--edits-file must be a non-empty JSON array of {find, replace}"
|
|
7217
|
-
);
|
|
7218
|
-
body.edits = parsed;
|
|
7219
|
-
}
|
|
7220
|
-
body.contentType = rewriteContentType(opts.file, opts.contentType);
|
|
7221
|
-
const result = await createClient().put(
|
|
7222
|
-
`${itemPath(org, id)}/variants/${encodeURIComponent(variantId)}/content`,
|
|
7223
|
-
body
|
|
7224
|
-
);
|
|
7225
|
-
if (resolveOutput(cmd) === "json") printJson(result);
|
|
7226
|
-
else {
|
|
7227
|
-
console.log(`Wrote ${result.chars} chars`);
|
|
7228
|
-
if (body.edits)
|
|
7229
|
-
console.log(
|
|
7230
|
-
`Edits: ${result.applied} applied, ${result.skipped} skipped`
|
|
7231
|
-
);
|
|
7232
|
-
if (result.truncated) console.error("warning: content was truncated");
|
|
7233
|
-
}
|
|
7234
|
-
}
|
|
7235
|
-
);
|
|
7236
|
-
group.command("replan <id>").description("Discard the directions and propose fresh ones").action(async (id, _opts, cmd) => {
|
|
7237
|
-
const org = resolveOrg(cmd);
|
|
7238
|
-
await createClient().post(`${itemPath(org, id)}/replan`, {});
|
|
7239
|
-
if (resolveOutput(cmd) !== "json")
|
|
7240
|
-
console.log("Replanning \u2014 follow with `gauge experiments watch`");
|
|
7241
|
-
});
|
|
7242
|
-
group.command("write <id>").description("Write rewrites for directions that lack one").action(async (id, _opts, cmd) => {
|
|
7243
|
-
const org = resolveOrg(cmd);
|
|
7244
|
-
const result = await createClient().post(
|
|
7245
|
-
`${itemPath(org, id)}/write`,
|
|
7246
|
-
{}
|
|
7247
|
-
);
|
|
7248
|
-
if (resolveOutput(cmd) === "json") {
|
|
7249
|
-
printJson(result);
|
|
7250
|
-
return;
|
|
7251
|
-
}
|
|
7252
|
-
if (result.queued > 0) console.log(`Queued ${result.queued} rewrite(s)`);
|
|
7253
|
-
else if (result.reason === "round_in_flight")
|
|
7254
|
-
console.log("A round is already running");
|
|
7255
|
-
else console.log("Nothing pending \u2014 every direction has a rewrite");
|
|
7256
|
-
});
|
|
7257
|
-
group.command("launch <id>").description("Claim the draft for launch (spends credits; async fan-out)").action(async (id, _opts, cmd) => {
|
|
7258
|
-
const org = resolveOrg(cmd);
|
|
7259
|
-
const result = await createClient().post(
|
|
7260
|
-
`${itemPath(org, id)}/launch`,
|
|
7261
|
-
{}
|
|
7262
|
-
);
|
|
7263
|
-
if (resolveOutput(cmd) === "json") printJson(result);
|
|
7264
|
-
else
|
|
7265
|
-
console.log(
|
|
7266
|
-
`Launching ${result.experimentId} \u2014 \`gauge experiments watch ${result.experimentId}\` follows it`
|
|
7267
|
-
);
|
|
7268
|
-
});
|
|
7269
|
-
group.command("watch <id>").description(
|
|
7270
|
-
"Follow the running round or launch; prints the recommendation on settle"
|
|
7271
|
-
).option("--interval <seconds>", "poll interval (default 10)").action(async (id, opts, cmd) => {
|
|
7272
|
-
const org = resolveOrg(cmd);
|
|
7273
|
-
const client = createClient();
|
|
7274
|
-
const intervalMs = Math.max(Number(opts.interval ?? 10) * 1e3, 2e3);
|
|
7275
|
-
const GRACE_POLLS = 3;
|
|
7276
|
-
let sawActive = false;
|
|
7277
|
-
let draftPolls = 0;
|
|
7278
|
-
let last = "";
|
|
7279
|
-
for (; ; ) {
|
|
7280
|
-
const status = await client.get(
|
|
7281
|
-
`${itemPath(org, id)}/status`
|
|
7282
|
-
);
|
|
7283
|
-
if (status.status !== last) {
|
|
7284
|
-
last = status.status;
|
|
7285
|
-
console.error(`status: ${status.status}`);
|
|
7286
|
-
if (status.launchError)
|
|
7287
|
-
console.error(`launch error: ${status.launchError}`);
|
|
7288
|
-
}
|
|
7289
|
-
if (TERMINAL.has(status.status)) break;
|
|
7290
|
-
if (status.status === "DRAFT") {
|
|
7291
|
-
if (status.launchError) {
|
|
7292
|
-
process.exitCode = 1;
|
|
7293
|
-
return;
|
|
7294
|
-
}
|
|
7295
|
-
if (sawActive) {
|
|
7296
|
-
console.error(
|
|
7297
|
-
`Round finished \u2014 \`gauge experiments get ${id}\` shows the directions and rewrites.`
|
|
7298
|
-
);
|
|
7299
|
-
return;
|
|
7300
|
-
}
|
|
7301
|
-
draftPolls += 1;
|
|
7302
|
-
if (draftPolls >= GRACE_POLLS) {
|
|
7303
|
-
console.error(
|
|
7304
|
-
`Nothing is running \u2014 \`gauge experiments get ${id}\` shows the draft.`
|
|
7305
|
-
);
|
|
7306
|
-
return;
|
|
7307
|
-
}
|
|
7308
|
-
} else {
|
|
7309
|
-
sawActive = true;
|
|
7310
|
-
}
|
|
7311
|
-
await sleep2(intervalMs);
|
|
7312
|
-
}
|
|
7313
|
-
const rec = await client.get(
|
|
7314
|
-
`${itemPath(org, id)}/recommendation`
|
|
7315
|
-
);
|
|
7316
|
-
printJson(rec);
|
|
7317
|
-
});
|
|
7318
|
-
group.command("export <id>").description("Print the settled recommendation (JSON)").action(async (id, _opts, cmd) => {
|
|
7319
|
-
const org = resolveOrg(cmd);
|
|
7320
|
-
const rec = await createClient().get(
|
|
7321
|
-
`${itemPath(org, id)}/recommendation`
|
|
7322
|
-
);
|
|
7323
|
-
printJson(rec);
|
|
7324
|
-
});
|
|
7325
|
-
group.command("ship <id> <variantId>").description("Mark a variant as shipped to your live docs").action(
|
|
7326
|
-
async (id, variantId, _o, cmd) => {
|
|
7327
|
-
const org = resolveOrg(cmd);
|
|
7328
|
-
await createClient().post(`${itemPath(org, id)}/ship`, { variantId });
|
|
7329
|
-
if (resolveOutput(cmd) !== "json") console.log("Marked shipped");
|
|
7330
|
-
}
|
|
7331
|
-
);
|
|
7332
|
-
group.command("unship <id>").description("Clear the shipped mark").action(async (id, _opts, cmd) => {
|
|
7333
|
-
const org = resolveOrg(cmd);
|
|
7334
|
-
await createClient().delete(`${itemPath(org, id)}/ship`);
|
|
7335
|
-
if (resolveOutput(cmd) !== "json") console.log("Cleared");
|
|
7336
|
-
});
|
|
7337
|
-
group.command("cancel <id>").description("Cancel a draft/generating/launching experiment").action(async (id, _opts, cmd) => {
|
|
7338
|
-
const org = resolveOrg(cmd);
|
|
7339
|
-
await createClient().post(`${itemPath(org, id)}/cancel`, {});
|
|
7340
|
-
if (resolveOutput(cmd) !== "json") console.log(`Canceled ${id}`);
|
|
7341
|
-
});
|
|
7342
|
-
}
|
|
7343
|
-
|
|
7344
6950
|
// src/commands/instructions.ts
|
|
7345
6951
|
var instructions_exports = {};
|
|
7346
6952
|
__export(instructions_exports, {
|
|
@@ -7349,38 +6955,133 @@ __export(instructions_exports, {
|
|
|
7349
6955
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
7350
6956
|
import { join as join3 } from "path";
|
|
7351
6957
|
|
|
6958
|
+
// src/instructions/evals.ts
|
|
6959
|
+
var EVALS = `---
|
|
6960
|
+
name: gauge-evals
|
|
6961
|
+
description: Create and review Gauge eval prompts, model selections, and judging
|
|
6962
|
+
criteria. Read before creating or editing evals; includes a migration example.
|
|
6963
|
+
---
|
|
6964
|
+
|
|
6965
|
+
# Evals
|
|
6966
|
+
|
|
6967
|
+
- Measure one meaningful developer outcome. Record the learning goal, reproducible starting state, observable finish line, and execution budget; a coherent migration can span browser and server workflows.
|
|
6968
|
+
- Write the prompt as a real user's request, in their language. Describe their goal, relevant context, and intended outcome. Preserve constraints they actually supplied; do not assume technical expertise or invent features, UI actions, business rules, commands, filenames, or verification recipes. Leave discovery and implementation choices to the agent.
|
|
6969
|
+
- Align a small set of independently assessable criteria with the requested outcome and existing application. Accept equivalent supported approaches and execution evidence; remove hidden requirements when revising the prompt.
|
|
6970
|
+
- Keep repository revisions, credentials, connections, runtime setup, and budgets in supported configuration or fixtures where possible. Inspect \`gauge evals create --help\` and \`gauge evals edit --help\` for current controls; do not assume proposed limits are enforced.
|
|
6971
|
+
- Saved evals use \`gauge evals create --file <path> --criteria-file <path>\` (criteria JSON: [{"name":"...","rubric":"..."}]). For committed Markdown cases, preview with \`gauge evals plan --files <paths...>\` before \`gauge evals run --files <paths...>\`.
|
|
6972
|
+
- Pilot before scaling; confirm before spending credits. Creating definitions does not authorize launching runs. Report sample counts and distinguish incorrect behavior, missing evidence, environment failures, and budget exhaustion.
|
|
6973
|
+
|
|
6974
|
+
## Model selection
|
|
6975
|
+
|
|
6976
|
+
Choose a roster for the question and budget. For exploratory testing, start with a diverse panel of open models; reserve a smaller set of Claude Code and Codex sessions for calibration and confirmation. Do not automatically use only Claude Opus and GPT Sol. Honor an explicitly requested model or harness when that experience is the measurement.
|
|
6977
|
+
|
|
6978
|
+
- **Breadth:** Open models make repetition and coverage across tasks, repositories, personas, skills, and MCP configurations more affordable. Select several available model families rather than treating one model as representative.
|
|
6979
|
+
- **Confirmation:** Use frontier sessions to investigate disagreements and confirm consequential findings. Periodically repeat a subset of open-model cases with frontier targets and investigate meaningful drift.
|
|
6980
|
+
- **Limits:** Gauge's proxy evidence comes from Agent Preference comparisons. Similar product choices do not establish equal coding ability or identical eval pass rates. Calibrate on your own tasks before generalizing.
|
|
6981
|
+
- **Controls:** Run \`gauge models list -o json\` for the current organization catalog. A target combines a model and harness; select supported pairs with repeated \`--agent pi:<model>\`, \`--agent opencode:<model>\`, \`--agent claude-code:<model>\`, or \`--agent codex:<model>\` flags. Pin catalog identifiers explicitly; omitting a model uses the harness default. Treat the harness as part of the comparison.
|
|
6982
|
+
- **Comparison:** Keep each case's prompt, fixture, criteria, and other settings fixed when comparing targets. Budget for targets \xD7 samples per case; inspect per-target results and execution evidence rather than only a pooled score.
|
|
6983
|
+
|
|
6984
|
+
Background: [Open models as preference proxies](https://www.withgauge.com/blog/open-models-useful-proxies-data-from-1000-sessions/).
|
|
6985
|
+
|
|
6986
|
+
## Migration prompt and criteria
|
|
6987
|
+
|
|
6988
|
+
This example tests migration of an existing feature-flag application across browser and server workflows. Its starting repository contains the application, while attached connections supply destination credentials. The source account's targeting configuration is unavailable.
|
|
6989
|
+
|
|
6990
|
+
### Keep the substantial task
|
|
6991
|
+
|
|
6992
|
+
A bad version of this migration prompt would add specific features, such as a flag selector, an account switcher, or an activity log. It might also specify exact UI layouts, clicks to perform, SDK calls, or files to edit. Those directions assume the user already knows the implementation and add requirements beyond their goal.
|
|
6993
|
+
|
|
6994
|
+
Use the kind of language a user would naturally use to ask for a change. For example, "Let me pass a feature to the CLI and get instructions for it" describes the desired behavior without prescribing command registration or rendering code. Keep details the user actually requests; do not add exact specifications or UI/UX actions just to make grading easier.
|
|
6995
|
+
|
|
6996
|
+
For the migration, express the user's goal:
|
|
6997
|
+
|
|
6998
|
+
> Migrate this app from its current feature-flag provider to the replacement provider while preserving its existing functionality. Get it running locally, verify the migration works, and explain any limitations.
|
|
6999
|
+
|
|
7000
|
+
If the user also asks for a complete replacement, carry that decision into the rubric. Do not add backward compatibility or a gradual production rollout solely because a migration guide recommends them.
|
|
7001
|
+
|
|
7002
|
+
This remains a substantial task. The agent must inspect the application, identify integration boundaries, discover suitable interfaces, implement the migration, and demonstrate the result. A short prompt does not imply a trivial outcome.
|
|
7003
|
+
|
|
7004
|
+
### Define observable success
|
|
7005
|
+
|
|
7006
|
+
Inspect the starting application and relevant migration guidance before drafting criteria. For this application, success means existing browser and server workflows continue to work through the destination provider, live evaluations drive the running UI, and active dependencies on the source provider are removed when full replacement is requested. The rubric can assess behavior present in the source without dictating SDK methods, edited files, or an exact test sequence.
|
|
7007
|
+
|
|
7008
|
+
Suitable criteria for this fixture:
|
|
7009
|
+
|
|
7010
|
+
- **Complete migration:** Required flags and code references are accounted for. The active integration uses the destination provider, and the app no longer needs the source provider at runtime when full replacement is requested. A separate demo or hardcoded replacement is insufficient.
|
|
7011
|
+
- **Preserved behavior:** Existing browser/server workflows, context changes, and server-provided initial values continue to work. Available configuration is preserved or differences explained. Exact historical targeting parity cannot be established without source rules.
|
|
7012
|
+
- **Verified working application:** Execution evidence connects live flag evaluation from the destination provider to the running app's behavior across its browser and server workflows. A build or standalone SDK probe alone does not demonstrate the migration.
|
|
7013
|
+
- **Appropriate product surfaces:** Supported SDKs/providers fit the browser and server runtimes; supported management interfaces handle configuration; credentials fit each surface. Equivalent approaches are acceptable, and using every tool is unnecessary.
|
|
7014
|
+
|
|
7015
|
+
Keep environment identifiers, credential mappings, repository revision, and resource isolation in supported connection or fixture mechanisms where possible. Authoring notes and source limitations must not become an extra implementation checklist.
|
|
7016
|
+
|
|
7017
|
+
Missing source rules limit the parity claim. Record that uncertainty and assess observable application behavior; do not replace it with an invented targeting contract. If account-configuration migration is the requested outcome, prepare the required source data before calling the fixture ready.
|
|
7018
|
+
`;
|
|
7019
|
+
|
|
7352
7020
|
// src/instructions/index.ts
|
|
7353
7021
|
var ROOT = `---
|
|
7354
7022
|
name: gauge
|
|
7355
|
-
description:
|
|
7356
|
-
|
|
7357
|
-
what it says.
|
|
7023
|
+
description: Understand Gauge, use its CLI, and choose the module guidance
|
|
7024
|
+
for your task. Read before running a gauge command.
|
|
7358
7025
|
---
|
|
7359
7026
|
|
|
7360
7027
|
# Gauge
|
|
7361
7028
|
|
|
7362
|
-
Gauge
|
|
7363
|
-
|
|
7364
|
-
|
|
7029
|
+
Gauge helps you understand and improve how coding agents discover and use your
|
|
7030
|
+
product. It runs real agents in sandboxes under reproducible conditions, then
|
|
7031
|
+
judges their work. Evals measure successful product use; Agent Preference
|
|
7032
|
+
measures which tools agents choose and why. Optimizations test improvements to
|
|
7033
|
+
your docs and skills against those measurements.
|
|
7034
|
+
|
|
7035
|
+
## Use Gauge and the CLI
|
|
7036
|
+
|
|
7037
|
+
Run \`gauge onboard\` to sign in and set up a workspace, or \`gauge auth login\`
|
|
7038
|
+
for an existing account. Select your organization with \`gauge orgs use <org>\`,
|
|
7039
|
+
then inspect it with \`gauge status\`. Configure a measurement, run a small
|
|
7040
|
+
pilot, inspect sessions and judging evidence, and use those findings to test
|
|
7041
|
+
improvements. \`gauge models list\` shows the available agent/model targets.
|
|
7042
|
+
|
|
7043
|
+
- Use \`gauge --help\` for commands and \`gauge <group> --help\` for flags.
|
|
7044
|
+
- Pass \`-o json\` on reads and parse it. Tables are for people.
|
|
7045
|
+
- Confirm before launches spend credits. Use \`--yes\` for work already approved.
|
|
7046
|
+
- Retry writes with their supported idempotency flag; blind retries can launch
|
|
7047
|
+
duplicate paid sessions.
|
|
7048
|
+
- Report measured results with sample counts and evidence, including limits.
|
|
7049
|
+
- Run \`gauge update\` to install the latest published CLI.
|
|
7050
|
+
- Exit codes: 0 ok, 1 error, 2 usage, 3 billing-blocked, 4 needs your input.
|
|
7365
7051
|
|
|
7366
|
-
|
|
7367
|
-
one of them alone.
|
|
7052
|
+
## Module guidance
|
|
7368
7053
|
|
|
7369
|
-
|
|
7054
|
+
These summaries cover the essentials. Read the full page before detailed work;
|
|
7055
|
+
\`gauge instructions --list\` lists the available modules.
|
|
7370
7056
|
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7057
|
+
### Evals
|
|
7058
|
+
|
|
7059
|
+
Measure one developer outcome with a reproducible fixture and observable criteria.
|
|
7060
|
+
Write a real user request; leave discovery and implementation to the agent. Keep
|
|
7061
|
+
credentials and setup in configuration. Start exploratory testing with a diverse
|
|
7062
|
+
open-model panel; use fewer frontier sessions for calibration, disagreements,
|
|
7063
|
+
and confirmation. Honor requested targets. Discover supported model/harness pairs
|
|
7064
|
+
with \`gauge models list -o json\` and pin selections explicitly. Preference
|
|
7065
|
+
similarity does not guarantee equal coding performance; calibrate on your tasks.
|
|
7066
|
+
Hold each case's prompt, fixture, and rubric fixed across targets. Pilot before
|
|
7067
|
+
scaling, confirm paid launches, and report per-target evidence, sample counts,
|
|
7068
|
+
failures, and missing evidence.
|
|
7380
7069
|
|
|
7381
|
-
|
|
7070
|
+
Full guidance and migration example: \`gauge instructions evals\`.
|
|
7382
7071
|
|
|
7383
|
-
|
|
7072
|
+
### Optimization
|
|
7073
|
+
|
|
7074
|
+
Gauge measures trials; you author the changes. Start from an eval or preference
|
|
7075
|
+
prompt, diagnose friction, and write a hypothesis. Change one variable per trial
|
|
7076
|
+
against the frozen baseline; keep the measurement and its criteria fixed. Read
|
|
7077
|
+
\`nextAction\` on every detail and follow the named step. Use
|
|
7078
|
+
\`gauge optimizations watch <id>\` to track progress; exit 4 means your input is
|
|
7079
|
+
needed. Submit changes with an idempotency key and confirm paid launches.
|
|
7080
|
+
Inspect scores and session evidence before adopting. Adoption updates Gauge's
|
|
7081
|
+
measured baseline. Apply the winning text to your source repository in a pull
|
|
7082
|
+
request, citing the trial and measured score.
|
|
7083
|
+
|
|
7084
|
+
Full guidance: \`gauge instructions optimization\`.
|
|
7384
7085
|
`;
|
|
7385
7086
|
var OPTIMIZATIONS = `---
|
|
7386
7087
|
name: gauge-optimizations
|
|
@@ -7431,28 +7132,18 @@ source in a pull request and cite the trial key and its score.
|
|
|
7431
7132
|
`;
|
|
7432
7133
|
var TOPICS = {
|
|
7433
7134
|
root: { name: "gauge", markdown: ROOT },
|
|
7434
|
-
|
|
7135
|
+
evals: { name: "gauge-evals", markdown: EVALS },
|
|
7136
|
+
optimization: { name: "gauge-optimizations", markdown: OPTIMIZATIONS }
|
|
7435
7137
|
};
|
|
7436
7138
|
var TOPIC_NAMES = Object.keys(TOPICS).filter(
|
|
7437
7139
|
(topic) => topic !== "root"
|
|
7438
7140
|
);
|
|
7439
|
-
function documentBody(markdown) {
|
|
7440
|
-
const end = markdown.indexOf("\n---\n", 4);
|
|
7441
|
-
return end === -1 ? markdown : markdown.slice(end + 5);
|
|
7442
|
-
}
|
|
7443
|
-
function nested(markdown) {
|
|
7444
|
-
return documentBody(markdown).trim().replace(/^(#{1,5}) /gm, "#$1 ");
|
|
7445
|
-
}
|
|
7446
7141
|
function instructions(topic) {
|
|
7447
|
-
|
|
7448
|
-
const bodies = TOPIC_NAMES.map((name) => nested(TOPICS[name].markdown));
|
|
7449
|
-
return `${TOPICS.root.markdown.trimEnd()}
|
|
7450
|
-
|
|
7451
|
-
${bodies.join("\n\n")}
|
|
7452
|
-
`;
|
|
7142
|
+
return resolveTopic(topic ?? "root").markdown;
|
|
7453
7143
|
}
|
|
7454
7144
|
function resolveTopic(topic) {
|
|
7455
|
-
const
|
|
7145
|
+
const normalized = topic.trim().toLowerCase();
|
|
7146
|
+
const found = TOPICS[normalized === "optimizations" ? "optimization" : normalized];
|
|
7456
7147
|
if (!found)
|
|
7457
7148
|
throw new CliError(
|
|
7458
7149
|
"usage",
|
|
@@ -7465,7 +7156,7 @@ function resolveTopic(topic) {
|
|
|
7465
7156
|
var INSTALL_ROOT = ".claude/skills";
|
|
7466
7157
|
function register13(program2) {
|
|
7467
7158
|
program2.command("instructions [topic]").description(
|
|
7468
|
-
`Instructions for a coding agent using this CLI. Run before your first gauge command; a topic
|
|
7159
|
+
`Instructions for a coding agent using this CLI. Run before your first gauge command; a topic loads the full module guidance: ${TOPIC_NAMES.join(", ")}`
|
|
7469
7160
|
).option("--list", "print the topic names only").option(
|
|
7470
7161
|
"--install",
|
|
7471
7162
|
`write the skill under ${INSTALL_ROOT}/ instead of printing it`
|
|
@@ -7482,10 +7173,10 @@ function register13(program2) {
|
|
|
7482
7173
|
}
|
|
7483
7174
|
const name = topic ? resolveTopic(topic).name : TOPICS.root.name;
|
|
7484
7175
|
const dir = join3(opts.dir ?? INSTALL_ROOT, name);
|
|
7485
|
-
const
|
|
7176
|
+
const path3 = join3(dir, "SKILL.md");
|
|
7486
7177
|
mkdirSync3(dir, { recursive: true });
|
|
7487
|
-
writeFileSync3(
|
|
7488
|
-
console.log(`Wrote ${
|
|
7178
|
+
writeFileSync3(path3, markdown);
|
|
7179
|
+
console.log(`Wrote ${path3}`);
|
|
7489
7180
|
console.error(
|
|
7490
7181
|
"Re-run this after you upgrade the CLI: the instructions ship with it."
|
|
7491
7182
|
);
|
|
@@ -7516,8 +7207,8 @@ async function readKeyInput(opts) {
|
|
|
7516
7207
|
process.stderr.write(
|
|
7517
7208
|
"warning: --key exposes the secret to shell history and process listings; prefer piping it to stdin or setting GAUGE_PROVIDER_KEY.\n"
|
|
7518
7209
|
);
|
|
7519
|
-
const
|
|
7520
|
-
if (
|
|
7210
|
+
const key3 = opts.key.trim();
|
|
7211
|
+
if (key3) return key3;
|
|
7521
7212
|
throw new CliError("usage", "Empty --key value");
|
|
7522
7213
|
}
|
|
7523
7214
|
if (!opts.stdin) {
|
|
@@ -7530,14 +7221,14 @@ async function readKeyInput(opts) {
|
|
|
7530
7221
|
process.stdin.setEncoding("utf8");
|
|
7531
7222
|
let data = "";
|
|
7532
7223
|
for await (const chunk of process.stdin) data += chunk;
|
|
7533
|
-
const
|
|
7534
|
-
if (!
|
|
7224
|
+
const key2 = data.trim();
|
|
7225
|
+
if (!key2) {
|
|
7535
7226
|
throw new CliError(
|
|
7536
7227
|
"usage",
|
|
7537
7228
|
"No key provided. Pipe it to stdin (e.g. `gauge keys set anthropic < key.txt`) or set GAUGE_PROVIDER_KEY."
|
|
7538
7229
|
);
|
|
7539
7230
|
}
|
|
7540
|
-
return
|
|
7231
|
+
return key2;
|
|
7541
7232
|
}
|
|
7542
7233
|
function register14(program2) {
|
|
7543
7234
|
const group = program2.command("keys").description("Manage BYOK provider keys (write-only; reads show last4)");
|
|
@@ -7550,10 +7241,10 @@ function register14(program2) {
|
|
|
7550
7241
|
async (provider, opts, cmd) => {
|
|
7551
7242
|
const type = providerArg(provider);
|
|
7552
7243
|
const org = resolveOrg(cmd);
|
|
7553
|
-
const
|
|
7244
|
+
const key2 = await readKeyInput(opts);
|
|
7554
7245
|
const res = await createClient().put(
|
|
7555
7246
|
`${keysPath(org)}/${type}`,
|
|
7556
|
-
{ key }
|
|
7247
|
+
{ key: key2 }
|
|
7557
7248
|
);
|
|
7558
7249
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
7559
7250
|
else console.log(`Saved ${res.providerType} key (\u2026${res.last4})`);
|
|
@@ -7597,7 +7288,7 @@ var mcp_exports2 = {};
|
|
|
7597
7288
|
__export(mcp_exports2, {
|
|
7598
7289
|
register: () => register15
|
|
7599
7290
|
});
|
|
7600
|
-
import { readFileSync as
|
|
7291
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
7601
7292
|
function mcpPath(org) {
|
|
7602
7293
|
return `/api/v1/orgs/${encodeURIComponent(org)}/mcp-servers`;
|
|
7603
7294
|
}
|
|
@@ -7613,7 +7304,7 @@ function specFromOpts(opts) {
|
|
|
7613
7304
|
throw new CliError("usage", "--spec-file conflicts with --command/--url");
|
|
7614
7305
|
try {
|
|
7615
7306
|
return JSON.parse(
|
|
7616
|
-
|
|
7307
|
+
readFileSync7(opts.specFile === "-" ? 0 : opts.specFile, "utf8")
|
|
7617
7308
|
);
|
|
7618
7309
|
} catch (e) {
|
|
7619
7310
|
throw new CliError(
|
|
@@ -7822,8 +7513,8 @@ __export(models_exports, {
|
|
|
7822
7513
|
function executionTargetsPath(org) {
|
|
7823
7514
|
return `/api/v1/orgs/${encodeURIComponent(org)}/execution-targets`;
|
|
7824
7515
|
}
|
|
7825
|
-
function capabilityLabel(
|
|
7826
|
-
return Object.entries(
|
|
7516
|
+
function capabilityLabel(capabilities2) {
|
|
7517
|
+
return Object.entries(capabilities2).filter(([, supported]) => supported).map(([name]) => name === "agentContext" ? "context" : name).join(", ");
|
|
7827
7518
|
}
|
|
7828
7519
|
function register17(program2) {
|
|
7829
7520
|
const group = program2.command("models").description("Discover supported models, harnesses, and providers");
|
|
@@ -7972,23 +7663,23 @@ __export(optimizations_exports2, {
|
|
|
7972
7663
|
trialTemplate: () => trialTemplate,
|
|
7973
7664
|
watchStops: () => watchStops
|
|
7974
7665
|
});
|
|
7975
|
-
import { readdirSync, readFileSync as
|
|
7666
|
+
import { readdirSync, readFileSync as readFileSync8, statSync } from "fs";
|
|
7976
7667
|
import { join as join4, relative as relative2, sep as sep2 } from "path";
|
|
7977
|
-
var
|
|
7668
|
+
var TERMINAL = /* @__PURE__ */ new Set(["DONE", "ARCHIVED"]);
|
|
7978
7669
|
var EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
7979
7670
|
function basePath(org) {
|
|
7980
7671
|
return `/api/v1/orgs/${encodeURIComponent(org)}/optimizations`;
|
|
7981
7672
|
}
|
|
7982
|
-
function
|
|
7673
|
+
function itemPath(org, id) {
|
|
7983
7674
|
return `${basePath(org)}/${encodeURIComponent(id)}`;
|
|
7984
7675
|
}
|
|
7985
7676
|
function trialPath(org, id, trialId) {
|
|
7986
|
-
return `${
|
|
7677
|
+
return `${itemPath(org, id)}/trials/${encodeURIComponent(trialId)}`;
|
|
7987
7678
|
}
|
|
7988
|
-
function
|
|
7989
|
-
return
|
|
7679
|
+
function readText(path3) {
|
|
7680
|
+
return readFileSync8(path3 === "-" ? 0 : path3, "utf8");
|
|
7990
7681
|
}
|
|
7991
|
-
function
|
|
7682
|
+
function sleep2(ms) {
|
|
7992
7683
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
7993
7684
|
}
|
|
7994
7685
|
function parseSubject(opts) {
|
|
@@ -8041,19 +7732,19 @@ var NEXT_ACTION_HINT = {
|
|
|
8041
7732
|
AUTHOR_TRIAL: "author the next trial: `gauge optimizations trials add <id>`",
|
|
8042
7733
|
LAUNCH_ROUND: "launch the saved round: `gauge optimizations launch <id>`",
|
|
8043
7734
|
ADOPT: "adopt the winning trial: `gauge optimizations adopt <id> <trial>`",
|
|
8044
|
-
RESUME: "resume it
|
|
7735
|
+
RESUME: "resume it in the web app, or `gauge optimizations cancel <id>`",
|
|
8045
7736
|
NONE: "nothing to do in Gauge"
|
|
8046
7737
|
};
|
|
8047
7738
|
function awaitingInput(detail) {
|
|
8048
7739
|
return detail.nextAction !== "WAIT" && detail.nextAction !== "NONE";
|
|
8049
7740
|
}
|
|
8050
7741
|
function watchStops(detail, follow) {
|
|
8051
|
-
return
|
|
7742
|
+
return TERMINAL.has(detail.status) || detail.nextAction === "NONE" || !follow && awaitingInput(detail);
|
|
8052
7743
|
}
|
|
8053
|
-
function readObject(
|
|
7744
|
+
function readObject(path3) {
|
|
8054
7745
|
let value;
|
|
8055
7746
|
try {
|
|
8056
|
-
value = JSON.parse(
|
|
7747
|
+
value = JSON.parse(readText(path3));
|
|
8057
7748
|
} catch {
|
|
8058
7749
|
throw new CliError("usage", "the file must contain valid JSON");
|
|
8059
7750
|
}
|
|
@@ -8086,13 +7777,13 @@ function parseStatuses(raw) {
|
|
|
8086
7777
|
);
|
|
8087
7778
|
return parts.join(",");
|
|
8088
7779
|
}
|
|
8089
|
-
function readSkillDir(dir, read =
|
|
7780
|
+
function readSkillDir(dir, read = readText, walk = listFiles) {
|
|
8090
7781
|
const paths = walk(dir).sort();
|
|
8091
7782
|
if (!paths.length)
|
|
8092
7783
|
throw new CliError("usage", `no files under ${dir} to send`);
|
|
8093
|
-
const files = paths.map((
|
|
8094
|
-
path: relative2(dir,
|
|
8095
|
-
body: read(
|
|
7784
|
+
const files = paths.map((path3) => ({
|
|
7785
|
+
path: relative2(dir, path3).split(sep2).join("/"),
|
|
7786
|
+
body: read(path3)
|
|
8096
7787
|
}));
|
|
8097
7788
|
if (!files.some((file) => file.path === "SKILL.md"))
|
|
8098
7789
|
throw new CliError(
|
|
@@ -8109,11 +7800,11 @@ function listFiles(dir) {
|
|
|
8109
7800
|
throw new CliError("usage", `cannot read the directory ${dir}`);
|
|
8110
7801
|
}
|
|
8111
7802
|
return entries.flatMap((entry) => {
|
|
8112
|
-
const
|
|
8113
|
-
return statSync(
|
|
7803
|
+
const path3 = join4(dir, entry);
|
|
7804
|
+
return statSync(path3).isDirectory() ? listFiles(path3) : [path3];
|
|
8114
7805
|
});
|
|
8115
7806
|
}
|
|
8116
|
-
function trialBodyFromOpts(opts, read =
|
|
7807
|
+
function trialBodyFromOpts(opts, read = readText, walk) {
|
|
8117
7808
|
const launch = opts.launch === true;
|
|
8118
7809
|
const idempotencyKey = opts.idempotencyKey;
|
|
8119
7810
|
const fork = opts.forkRun || opts.forkBoundary ? (() => {
|
|
@@ -8255,7 +7946,7 @@ function pct(value) {
|
|
|
8255
7946
|
function subjectLabel(kind) {
|
|
8256
7947
|
return kind === "EVAL_SET" ? "eval" : "preference";
|
|
8257
7948
|
}
|
|
8258
|
-
function
|
|
7949
|
+
function toRow3(o) {
|
|
8259
7950
|
return {
|
|
8260
7951
|
id: o.id,
|
|
8261
7952
|
name: o.name.length > 40 ? `${o.name.slice(0, 37)}...` : o.name,
|
|
@@ -8284,7 +7975,7 @@ function trialRow(t) {
|
|
|
8284
7975
|
id: t.id
|
|
8285
7976
|
};
|
|
8286
7977
|
}
|
|
8287
|
-
function
|
|
7978
|
+
function printDetail3(o) {
|
|
8288
7979
|
console.log(`id: ${o.id}`);
|
|
8289
7980
|
console.log(`name: ${o.name}`);
|
|
8290
7981
|
console.log(
|
|
@@ -8356,8 +8047,8 @@ function printRoundPreview(preview) {
|
|
|
8356
8047
|
console.log(`=== ${change.path}`);
|
|
8357
8048
|
console.log(change.hunks);
|
|
8358
8049
|
}
|
|
8359
|
-
for (const
|
|
8360
|
-
console.log(` ${
|
|
8050
|
+
for (const path3 of trial.droppedFiles ?? [])
|
|
8051
|
+
console.log(` ${path3}: dropped`);
|
|
8361
8052
|
}
|
|
8362
8053
|
console.log(`previewDigest ${preview.previewDigest}`);
|
|
8363
8054
|
}
|
|
@@ -8430,14 +8121,14 @@ function register19(program2) {
|
|
|
8430
8121
|
}
|
|
8431
8122
|
);
|
|
8432
8123
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
8433
|
-
else printItems(res.items.map(
|
|
8124
|
+
else printItems(res.items.map(toRow3), "table");
|
|
8434
8125
|
}
|
|
8435
8126
|
);
|
|
8436
8127
|
group.command("get <id>").description("One optimization: settings, score, and its trial ladder").action(async (id, _opts, cmd) => {
|
|
8437
8128
|
const org = resolveOrg(cmd);
|
|
8438
|
-
const detail = await createClient().get(
|
|
8129
|
+
const detail = await createClient().get(itemPath(org, id));
|
|
8439
8130
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8440
|
-
else
|
|
8131
|
+
else printDetail3(detail);
|
|
8441
8132
|
});
|
|
8442
8133
|
addSubjectOptions(
|
|
8443
8134
|
group.command("diagnose").description(
|
|
@@ -8520,7 +8211,7 @@ function register19(program2) {
|
|
|
8520
8211
|
opts.yes
|
|
8521
8212
|
);
|
|
8522
8213
|
const detail = await createClient().post(
|
|
8523
|
-
`${
|
|
8214
|
+
`${itemPath(org, id)}/cancel`,
|
|
8524
8215
|
{}
|
|
8525
8216
|
);
|
|
8526
8217
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -8544,7 +8235,7 @@ function register19(program2) {
|
|
|
8544
8235
|
}
|
|
8545
8236
|
);
|
|
8546
8237
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8547
|
-
else
|
|
8238
|
+
else printDetail3(detail);
|
|
8548
8239
|
}
|
|
8549
8240
|
);
|
|
8550
8241
|
addPlanOptions(
|
|
@@ -8563,11 +8254,11 @@ function register19(program2) {
|
|
|
8563
8254
|
if (!Object.keys(body).length)
|
|
8564
8255
|
throw new CliError("usage", "pass plan flags, --name, or --file");
|
|
8565
8256
|
const detail = await createClient().patch(
|
|
8566
|
-
|
|
8257
|
+
itemPath(resolveOrg(cmd), id),
|
|
8567
8258
|
body
|
|
8568
8259
|
);
|
|
8569
8260
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8570
|
-
else
|
|
8261
|
+
else printDetail3(detail);
|
|
8571
8262
|
}
|
|
8572
8263
|
);
|
|
8573
8264
|
addPlanOptions(
|
|
@@ -8578,11 +8269,11 @@ function register19(program2) {
|
|
|
8578
8269
|
const client = createClient();
|
|
8579
8270
|
const plan = planFromOpts(opts);
|
|
8580
8271
|
const creditCap = parseCreditEstimate(opts.creditCap);
|
|
8581
|
-
const current = await client.get(
|
|
8272
|
+
const current = await client.get(itemPath(org, id));
|
|
8582
8273
|
if (current.status !== "DRAFT")
|
|
8583
8274
|
throw new CliError(
|
|
8584
8275
|
"usage",
|
|
8585
|
-
"only a draft can start; use
|
|
8276
|
+
"only a draft can start; use continue instead"
|
|
8586
8277
|
);
|
|
8587
8278
|
const target = plan.target ?? (current.settings.pinnedAgent ? {
|
|
8588
8279
|
agent: current.settings.pinnedAgent,
|
|
@@ -8610,13 +8301,13 @@ function register19(program2) {
|
|
|
8610
8301
|
`Start baseline for ${id}? Estimated full optimization: ${creditCap ?? estimate.estimate} credits, not a spending cap.`,
|
|
8611
8302
|
opts.yes
|
|
8612
8303
|
);
|
|
8613
|
-
const detail = await client.post(`${
|
|
8304
|
+
const detail = await client.post(`${itemPath(org, id)}/start`, {
|
|
8614
8305
|
...plan,
|
|
8615
8306
|
name: opts.name,
|
|
8616
8307
|
creditCap
|
|
8617
8308
|
});
|
|
8618
8309
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8619
|
-
else
|
|
8310
|
+
else printDetail3(detail);
|
|
8620
8311
|
}
|
|
8621
8312
|
);
|
|
8622
8313
|
group.command("launch <id>").description(
|
|
@@ -8627,7 +8318,7 @@ function register19(program2) {
|
|
|
8627
8318
|
opts.yes
|
|
8628
8319
|
);
|
|
8629
8320
|
const result = await createClient().post(
|
|
8630
|
-
`${
|
|
8321
|
+
`${itemPath(resolveOrg(cmd), id)}/rounds/current/launch`,
|
|
8631
8322
|
{}
|
|
8632
8323
|
);
|
|
8633
8324
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -8651,26 +8342,16 @@ function register19(program2) {
|
|
|
8651
8342
|
opts.yes
|
|
8652
8343
|
);
|
|
8653
8344
|
const detail = await createClient().post(
|
|
8654
|
-
`${
|
|
8345
|
+
`${itemPath(resolveOrg(cmd), id)}/continue`,
|
|
8655
8346
|
{ rounds, maxTrialsPerRound }
|
|
8656
8347
|
);
|
|
8657
8348
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8658
|
-
else
|
|
8349
|
+
else printDetail3(detail);
|
|
8659
8350
|
}
|
|
8660
8351
|
);
|
|
8661
|
-
group.command("resume <id>").description(
|
|
8662
|
-
"Resume a legacy paused optimization with interactive authoring"
|
|
8663
|
-
).action(async (id, _opts, cmd) => {
|
|
8664
|
-
const detail = await createClient().post(
|
|
8665
|
-
`${itemPath2(resolveOrg(cmd), id)}/resume`,
|
|
8666
|
-
{}
|
|
8667
|
-
);
|
|
8668
|
-
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8669
|
-
else printDetail4(detail);
|
|
8670
|
-
});
|
|
8671
8352
|
group.command("activity <id>").description("Read the optimization's decision log").option("--after <timestamp>", "entries after this ISO timestamp").option("--limit <n>", "maximum entries (1\u2013500)").action(
|
|
8672
8353
|
async (id, opts, cmd) => {
|
|
8673
|
-
const res = await createClient().get(`${
|
|
8354
|
+
const res = await createClient().get(`${itemPath(resolveOrg(cmd), id)}/activity`, {
|
|
8674
8355
|
after: opts.after,
|
|
8675
8356
|
limit: parseCount(opts.limit, "--limit", 500)
|
|
8676
8357
|
});
|
|
@@ -8689,7 +8370,7 @@ function register19(program2) {
|
|
|
8689
8370
|
);
|
|
8690
8371
|
group.command("chat <id>").description("Resolve your optimization chat and print its URL path").action(async (id, _opts, cmd) => {
|
|
8691
8372
|
const res = await createClient().post(
|
|
8692
|
-
`${
|
|
8373
|
+
`${itemPath(resolveOrg(cmd), id)}/chat`,
|
|
8693
8374
|
{}
|
|
8694
8375
|
);
|
|
8695
8376
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
@@ -8700,7 +8381,7 @@ function register19(program2) {
|
|
|
8700
8381
|
`Delete optimization ${id}, its rounds, trials, and activity? Session history is kept.`,
|
|
8701
8382
|
opts.yes
|
|
8702
8383
|
);
|
|
8703
|
-
await createClient().delete(
|
|
8384
|
+
await createClient().delete(itemPath(resolveOrg(cmd), id));
|
|
8704
8385
|
if (resolveOutput(cmd) === "json") printJson({ deleted: id });
|
|
8705
8386
|
else console.log(`Deleted ${id}.`);
|
|
8706
8387
|
});
|
|
@@ -8712,7 +8393,7 @@ function register19(program2) {
|
|
|
8712
8393
|
opts.yes
|
|
8713
8394
|
);
|
|
8714
8395
|
const detail = await createClient().post(
|
|
8715
|
-
`${
|
|
8396
|
+
`${itemPath(org, id)}/complete`,
|
|
8716
8397
|
opts.adopt ? { adoptTrialId: opts.adopt } : {}
|
|
8717
8398
|
);
|
|
8718
8399
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
@@ -8735,7 +8416,7 @@ function register19(program2) {
|
|
|
8735
8416
|
const intervalMs = Math.max(interval * 1e3, 2e3);
|
|
8736
8417
|
let last = "";
|
|
8737
8418
|
for (; ; ) {
|
|
8738
|
-
const detail = await client.get(
|
|
8419
|
+
const detail = await client.get(itemPath(org, id));
|
|
8739
8420
|
const trials2 = detail.rounds.flatMap((round2) => round2.trials);
|
|
8740
8421
|
const line = `${detail.status}${detail.stopReason ? ` (${detail.stopReason})` : ""} \xB7 round ${detail.round}/${detail.maxRounds} \xB7 ${pct(detail.before)} \u2192 ${pct(detail.after)} \xB7 ${detail.creditsSpent} credits spent \xB7 ${trials2.filter((t) => t.status === "RUNNING").map((t) => t.key).join(",") || "idle"}`;
|
|
8741
8422
|
if (line !== last) {
|
|
@@ -8745,11 +8426,11 @@ function register19(program2) {
|
|
|
8745
8426
|
const needsInput = awaitingInput(detail);
|
|
8746
8427
|
if (watchStops(detail, !!opts.follow)) {
|
|
8747
8428
|
if (resolveOutput(cmd) === "json") printJson(detail);
|
|
8748
|
-
else
|
|
8429
|
+
else printDetail3(detail);
|
|
8749
8430
|
if (needsInput) process.exitCode = NEEDS_INPUT_EXIT;
|
|
8750
8431
|
return;
|
|
8751
8432
|
}
|
|
8752
|
-
await
|
|
8433
|
+
await sleep2(intervalMs);
|
|
8753
8434
|
}
|
|
8754
8435
|
}
|
|
8755
8436
|
);
|
|
@@ -8757,7 +8438,7 @@ function register19(program2) {
|
|
|
8757
8438
|
"What the next round may change: kinds, CLI targets and commands, baseline invocations, revision"
|
|
8758
8439
|
).action(async (id, _opts, cmd) => {
|
|
8759
8440
|
printJson(
|
|
8760
|
-
await createClient().get(`${
|
|
8441
|
+
await createClient().get(`${itemPath(resolveOrg(cmd), id)}/authoring`)
|
|
8761
8442
|
);
|
|
8762
8443
|
});
|
|
8763
8444
|
group.command("invocation <id> <invocationId>").description(
|
|
@@ -8766,7 +8447,7 @@ function register19(program2) {
|
|
|
8766
8447
|
async (id, invocationId, _opts, cmd) => {
|
|
8767
8448
|
printJson(
|
|
8768
8449
|
await createClient().get(
|
|
8769
|
-
`${
|
|
8450
|
+
`${itemPath(resolveOrg(cmd), id)}/authoring/target`,
|
|
8770
8451
|
{ cliInvocationId: invocationId }
|
|
8771
8452
|
)
|
|
8772
8453
|
);
|
|
@@ -8777,7 +8458,7 @@ function register19(program2) {
|
|
|
8777
8458
|
).requiredOption("--file <path>", "the change JSON; '-' for stdin").action(async (id, opts, cmd) => {
|
|
8778
8459
|
printJson(
|
|
8779
8460
|
await createClient().post(
|
|
8780
|
-
`${
|
|
8461
|
+
`${itemPath(resolveOrg(cmd), id)}/cli-changes`,
|
|
8781
8462
|
readObject(opts.file)
|
|
8782
8463
|
)
|
|
8783
8464
|
);
|
|
@@ -8787,7 +8468,7 @@ function register19(program2) {
|
|
|
8787
8468
|
);
|
|
8788
8469
|
round.command("preview <id>").description("Validate a round file and print its diff and previewDigest").requiredOption("--file <path>", "the round JSON; '-' for stdin").action(async (id, opts, cmd) => {
|
|
8789
8470
|
const preview = await createClient().post(
|
|
8790
|
-
`${
|
|
8471
|
+
`${itemPath(resolveOrg(cmd), id)}/rounds/current/preview`,
|
|
8791
8472
|
readObject(opts.file)
|
|
8792
8473
|
);
|
|
8793
8474
|
if (resolveOutput(cmd) === "json") printJson(preview);
|
|
@@ -8798,7 +8479,7 @@ function register19(program2) {
|
|
|
8798
8479
|
).requiredOption("--file <path>", "the round JSON you previewed").requiredOption("--digest <digest>", "previewDigest from `round preview`").action(
|
|
8799
8480
|
async (id, opts, cmd) => {
|
|
8800
8481
|
const result = await createClient().put(
|
|
8801
|
-
`${
|
|
8482
|
+
`${itemPath(resolveOrg(cmd), id)}/rounds/current`,
|
|
8802
8483
|
{ ...readObject(opts.file), previewDigest: opts.digest }
|
|
8803
8484
|
);
|
|
8804
8485
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
@@ -8811,7 +8492,7 @@ function register19(program2) {
|
|
|
8811
8492
|
trials.command("list <id>").description("Every trial of an optimization with score and verdict").action(async (id, _opts, cmd) => {
|
|
8812
8493
|
const org = resolveOrg(cmd);
|
|
8813
8494
|
const res = await createClient().get(
|
|
8814
|
-
`${
|
|
8495
|
+
`${itemPath(org, id)}/trials`
|
|
8815
8496
|
);
|
|
8816
8497
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
8817
8498
|
else printItems(res.items.map(trialRow), "table");
|
|
@@ -8829,7 +8510,7 @@ function register19(program2) {
|
|
|
8829
8510
|
"local directory holding the complete edited bundle, SKILL.md included"
|
|
8830
8511
|
).option("--page <url>", "docs page to rewrite (with --body-file)").option("--body-file <path>", "the rewritten page body; '-' for stdin").option("--fork-run <runId>", "fork-at-fetch source run for a docs rewrite").option(
|
|
8831
8512
|
"--fork-boundary <seq>",
|
|
8832
|
-
"fork-at-fetch boundary from `gauge
|
|
8513
|
+
"fork-at-fetch boundary from `gauge runs fork-boundaries`"
|
|
8833
8514
|
).option(
|
|
8834
8515
|
"--launch",
|
|
8835
8516
|
"run the trial after saving (spends credits); otherwise save a draft"
|
|
@@ -8845,7 +8526,7 @@ function register19(program2) {
|
|
|
8845
8526
|
`Run trial "${body.trial.title}" on ${id} now? Spends credits.`,
|
|
8846
8527
|
opts.yes
|
|
8847
8528
|
);
|
|
8848
|
-
const result = await createClient().post(`${
|
|
8529
|
+
const result = await createClient().post(`${itemPath(org, id)}/trials`, body);
|
|
8849
8530
|
if (resolveOutput(cmd) === "json") printJson(result);
|
|
8850
8531
|
else if (result.replayed)
|
|
8851
8532
|
console.log(
|
|
@@ -8951,7 +8632,7 @@ function register19(program2) {
|
|
|
8951
8632
|
).requiredOption("--url <url>", "the page URL").action(async (id, opts, cmd) => {
|
|
8952
8633
|
const org = resolveOrg(cmd);
|
|
8953
8634
|
const res = await createClient().get(
|
|
8954
|
-
`${
|
|
8635
|
+
`${itemPath(org, id)}/page`,
|
|
8955
8636
|
{ url: opts.url }
|
|
8956
8637
|
);
|
|
8957
8638
|
if (resolveOutput(cmd) === "json") printJson(res);
|
|
@@ -9183,8 +8864,8 @@ function parseWhere(expr) {
|
|
|
9183
8864
|
return { dimension, op: opFor[sym], value: rest.trim() };
|
|
9184
8865
|
}
|
|
9185
8866
|
function parseOrderBy(raw) {
|
|
9186
|
-
const [
|
|
9187
|
-
return { key:
|
|
8867
|
+
const [key2, dir] = raw.split(":");
|
|
8868
|
+
return { key: key2.trim(), dir: dir?.trim() === "asc" ? "asc" : "desc" };
|
|
9188
8869
|
}
|
|
9189
8870
|
async function readStdin2() {
|
|
9190
8871
|
const chunks = [];
|
|
@@ -9383,7 +9064,7 @@ function reposPath(org) {
|
|
|
9383
9064
|
async function fetchAllRepos(client, org) {
|
|
9384
9065
|
return fetchAllPages(client, reposPath(org));
|
|
9385
9066
|
}
|
|
9386
|
-
function
|
|
9067
|
+
function toRow4(repo) {
|
|
9387
9068
|
return {
|
|
9388
9069
|
name: repo.name,
|
|
9389
9070
|
url: repo.url,
|
|
@@ -9408,7 +9089,7 @@ function register24(program2) {
|
|
|
9408
9089
|
printJson(items);
|
|
9409
9090
|
return;
|
|
9410
9091
|
}
|
|
9411
|
-
printItems(items.map(
|
|
9092
|
+
printItems(items.map(toRow4), "table");
|
|
9412
9093
|
});
|
|
9413
9094
|
repos.command("add <url>").description("Add a repository (pulls languages/size/stars from GitHub)").option(
|
|
9414
9095
|
"--ref <ref>",
|
|
@@ -9501,11 +9182,11 @@ var pollIntervalMs = 5e3;
|
|
|
9501
9182
|
function register25(program2) {
|
|
9502
9183
|
program2.command("run-requests").description("Read a durable launch and its aggregate verdict").command("wait <id>").description("Wait for all sessions and judging in a launch request").action(async (id, _opts, cmd) => {
|
|
9503
9184
|
const org = resolveOrg(cmd);
|
|
9504
|
-
const
|
|
9185
|
+
const path3 = `/api/v1/orgs/${encodeURIComponent(org)}/run-requests/${encodeURIComponent(id)}`;
|
|
9505
9186
|
const client = createClient();
|
|
9506
9187
|
let lastStatus = "";
|
|
9507
9188
|
while (true) {
|
|
9508
|
-
const result = await client.get(
|
|
9189
|
+
const result = await client.get(path3);
|
|
9509
9190
|
if (resolveOutput(cmd) !== "json" && result.status !== lastStatus) {
|
|
9510
9191
|
console.error(`Run request ${id}: ${result.status}`);
|
|
9511
9192
|
lastStatus = result.status;
|
|
@@ -9554,7 +9235,7 @@ function compact(value, max = 140) {
|
|
|
9554
9235
|
const one = s.replace(/\s+/g, " ").trim();
|
|
9555
9236
|
return one.length > max ? `${one.slice(0, max - 1)}\u2026` : one;
|
|
9556
9237
|
}
|
|
9557
|
-
function
|
|
9238
|
+
function toRow5(run) {
|
|
9558
9239
|
const selected = run.selectedProvider?.slug ?? "";
|
|
9559
9240
|
const observed = run.observedProvider?.slug;
|
|
9560
9241
|
return {
|
|
@@ -9816,7 +9497,7 @@ function register26(program2) {
|
|
|
9816
9497
|
printJson(page);
|
|
9817
9498
|
return;
|
|
9818
9499
|
}
|
|
9819
|
-
printItems(page.items.map(
|
|
9500
|
+
printItems(page.items.map(toRow5), "table");
|
|
9820
9501
|
if (page.nextCursor) {
|
|
9821
9502
|
console.error(
|
|
9822
9503
|
`(more results \u2014 rerun with --cursor ${page.nextCursor})`
|
|
@@ -9942,8 +9623,8 @@ function skillPath(org, ref) {
|
|
|
9942
9623
|
}
|
|
9943
9624
|
function sourceLabel(s) {
|
|
9944
9625
|
if (!s) return "";
|
|
9945
|
-
const
|
|
9946
|
-
return `${s.repoFullName}${
|
|
9626
|
+
const path3 = s.subpath ? `/${s.subpath}` : "";
|
|
9627
|
+
return `${s.repoFullName}${path3}#${s.ref}${s.autoIngest ? " (auto)" : ""}`;
|
|
9947
9628
|
}
|
|
9948
9629
|
async function buildSkillEditBody(opts, fetchCurrentSource) {
|
|
9949
9630
|
if (opts.note !== void 0 && opts.clearNote)
|
|
@@ -10168,7 +9849,7 @@ function noteFreshness2(f) {
|
|
|
10168
9849
|
);
|
|
10169
9850
|
}
|
|
10170
9851
|
}
|
|
10171
|
-
async function runStats(command, resource, opts,
|
|
9852
|
+
async function runStats(command, resource, opts, toRow7) {
|
|
10172
9853
|
const org = resolveOrg(command);
|
|
10173
9854
|
const output = resolveOutput(command);
|
|
10174
9855
|
const res = await createClient().get(
|
|
@@ -10179,7 +9860,7 @@ async function runStats(command, resource, opts, toRow8) {
|
|
|
10179
9860
|
printJson(res);
|
|
10180
9861
|
return;
|
|
10181
9862
|
}
|
|
10182
|
-
printItems(res.items.map(
|
|
9863
|
+
printItems(res.items.map(toRow7), "table");
|
|
10183
9864
|
noteFreshness2(res.freshness);
|
|
10184
9865
|
}
|
|
10185
9866
|
var rankingRow = (r) => ({
|
|
@@ -10367,12 +10048,54 @@ function register30(program2) {
|
|
|
10367
10048
|
});
|
|
10368
10049
|
}
|
|
10369
10050
|
|
|
10051
|
+
// src/commands/update.ts
|
|
10052
|
+
var update_exports = {};
|
|
10053
|
+
__export(update_exports, {
|
|
10054
|
+
register: () => register31
|
|
10055
|
+
});
|
|
10056
|
+
import {
|
|
10057
|
+
spawnSync
|
|
10058
|
+
} from "child_process";
|
|
10059
|
+
function register31(program2, { run = spawnSync, platform = process.platform } = {}) {
|
|
10060
|
+
program2.command("update").description(
|
|
10061
|
+
"Update the globally installed Gauge CLI to the latest version"
|
|
10062
|
+
).action((_opts, command) => {
|
|
10063
|
+
const output = resolveOutput(command);
|
|
10064
|
+
console.error("Updating Gauge CLI to the latest published version...");
|
|
10065
|
+
const result = run(
|
|
10066
|
+
platform === "win32" ? "npm.cmd" : "npm",
|
|
10067
|
+
["install", "--global", "@withgauge/cli@latest"],
|
|
10068
|
+
{
|
|
10069
|
+
// Windows needs a shell for npm.cmd; all arguments are fixed literals.
|
|
10070
|
+
shell: platform === "win32",
|
|
10071
|
+
// Keep npm progress out of machine-readable stdout.
|
|
10072
|
+
stdio: ["inherit", output === "json" ? 2 : "inherit", "inherit"]
|
|
10073
|
+
}
|
|
10074
|
+
);
|
|
10075
|
+
if (result.error || result.status !== 0) {
|
|
10076
|
+
const reason = result.error ? result.error.message : result.signal ? `npm was interrupted by ${result.signal}` : `npm exited with code ${result.status}`;
|
|
10077
|
+
throw new CliError(
|
|
10078
|
+
"internal",
|
|
10079
|
+
`CLI update failed: ${reason}.
|
|
10080
|
+
Retry with: npm install --global @withgauge/cli@latest`
|
|
10081
|
+
);
|
|
10082
|
+
}
|
|
10083
|
+
if (output === "json") {
|
|
10084
|
+
printJson({ updated: true, package: "@withgauge/cli", tag: "latest" });
|
|
10085
|
+
} else {
|
|
10086
|
+
console.log(
|
|
10087
|
+
"Updated Gauge CLI. Run `gauge --version` to see the installed version."
|
|
10088
|
+
);
|
|
10089
|
+
}
|
|
10090
|
+
});
|
|
10091
|
+
}
|
|
10092
|
+
|
|
10370
10093
|
// src/commands/usage.ts
|
|
10371
10094
|
var usage_exports = {};
|
|
10372
10095
|
__export(usage_exports, {
|
|
10373
|
-
register: () =>
|
|
10096
|
+
register: () => register32
|
|
10374
10097
|
});
|
|
10375
|
-
function
|
|
10098
|
+
function register32(program2) {
|
|
10376
10099
|
program2.command("usage").description("List credit ledger entries").option("--since <window>", 'e.g. "30d", "24h", or an ISO date').option("--limit <n>", "page size (1-200)", parseLimit, 50).option("--cursor <cursor>", "resume from a previous page's nextCursor").action(
|
|
10377
10100
|
async (opts, cmd) => {
|
|
10378
10101
|
const org = resolveOrg(cmd);
|
|
@@ -10419,7 +10142,7 @@ function register31(program2) {
|
|
|
10419
10142
|
// src/commands/visibility.ts
|
|
10420
10143
|
var visibility_exports2 = {};
|
|
10421
10144
|
__export(visibility_exports2, {
|
|
10422
|
-
register: () =>
|
|
10145
|
+
register: () => register33,
|
|
10423
10146
|
visibilityPath: () => visibilityPath
|
|
10424
10147
|
});
|
|
10425
10148
|
import { Option as Option3 } from "commander";
|
|
@@ -10451,7 +10174,7 @@ function brandsLabel(v) {
|
|
|
10451
10174
|
if (v.kind === "HEAD_TO_HEAD") return `${v.brandA} vs ${v.brandB}`;
|
|
10452
10175
|
return v.branded ? v.brandA ?? "branded" : "organic";
|
|
10453
10176
|
}
|
|
10454
|
-
function
|
|
10177
|
+
function toRow6(v) {
|
|
10455
10178
|
return {
|
|
10456
10179
|
id: v.id,
|
|
10457
10180
|
name: v.name,
|
|
@@ -10463,7 +10186,7 @@ function toRow7(v) {
|
|
|
10463
10186
|
"last run": v.lastRunAt ?? "-"
|
|
10464
10187
|
};
|
|
10465
10188
|
}
|
|
10466
|
-
function
|
|
10189
|
+
function printDetail4(v) {
|
|
10467
10190
|
console.log(`id: ${v.id}`);
|
|
10468
10191
|
console.log(`name: ${v.name}`);
|
|
10469
10192
|
console.log(`kind: ${v.kind}`);
|
|
@@ -10498,7 +10221,7 @@ function registerPreferenceGroup(group) {
|
|
|
10498
10221
|
visibilityPath(org)
|
|
10499
10222
|
);
|
|
10500
10223
|
if (resolveOutput(cmd) === "json") printJson(res.items);
|
|
10501
|
-
else printItems(res.items.map(
|
|
10224
|
+
else printItems(res.items.map(toRow6), "table");
|
|
10502
10225
|
});
|
|
10503
10226
|
group.command("get <id>").description("Show one preference prompt").action(async (id, _opts, cmd) => {
|
|
10504
10227
|
const org = resolveOrg(cmd);
|
|
@@ -10506,7 +10229,7 @@ function registerPreferenceGroup(group) {
|
|
|
10506
10229
|
`${visibilityPath(org)}/${encodeURIComponent(id)}`
|
|
10507
10230
|
);
|
|
10508
10231
|
if (resolveOutput(cmd) === "json") printJson(vp);
|
|
10509
|
-
else
|
|
10232
|
+
else printDetail4(vp);
|
|
10510
10233
|
});
|
|
10511
10234
|
addRunSettingsCreateOptions(
|
|
10512
10235
|
group.command("create").description(
|
|
@@ -10775,7 +10498,7 @@ function registerPreferenceGroup(group) {
|
|
|
10775
10498
|
);
|
|
10776
10499
|
});
|
|
10777
10500
|
}
|
|
10778
|
-
function
|
|
10501
|
+
function register33(program2) {
|
|
10779
10502
|
const preference = program2.command("preference").description("Manage Agent Preference prompts and measured markets");
|
|
10780
10503
|
registerPreferenceGroup(preference);
|
|
10781
10504
|
const legacy = program2.command("visibility", { hidden: true });
|
|
@@ -10794,6 +10517,7 @@ program.name("gauge").description(
|
|
|
10794
10517
|
);
|
|
10795
10518
|
for (const group of [
|
|
10796
10519
|
instructions_exports,
|
|
10520
|
+
update_exports,
|
|
10797
10521
|
auth_exports,
|
|
10798
10522
|
onboard_exports,
|
|
10799
10523
|
status_exports,
|
|
@@ -10811,7 +10535,6 @@ for (const group of [
|
|
|
10811
10535
|
runs_exports2,
|
|
10812
10536
|
runRequests_exports2,
|
|
10813
10537
|
optimizations_exports2,
|
|
10814
|
-
experiments_exports2,
|
|
10815
10538
|
apply_exports,
|
|
10816
10539
|
batches_exports,
|
|
10817
10540
|
brands_exports2,
|
|
@@ -10828,6 +10551,7 @@ for (const group of [
|
|
|
10828
10551
|
group.register(program);
|
|
10829
10552
|
}
|
|
10830
10553
|
register7(program, { hidden: !staffCommandsVisible() });
|
|
10554
|
+
register8(program, { hidden: !staffCommandsVisible() });
|
|
10831
10555
|
program.exitOverride();
|
|
10832
10556
|
try {
|
|
10833
10557
|
await program.parseAsync(process.argv);
|