@runtypelabs/cli 2.22.17 → 2.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +434 -77
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -179,8 +179,8 @@ var CallbackServer = class {
|
|
|
179
179
|
expectedState;
|
|
180
180
|
constructor() {
|
|
181
181
|
this.app = express();
|
|
182
|
-
this.codePromise = new Promise((
|
|
183
|
-
this.codeResolve =
|
|
182
|
+
this.codePromise = new Promise((resolve12, reject) => {
|
|
183
|
+
this.codeResolve = resolve12;
|
|
184
184
|
this.codeReject = reject;
|
|
185
185
|
});
|
|
186
186
|
this.app.get("/callback", (req, res) => {
|
|
@@ -20404,6 +20404,41 @@ function validateUpsertRecordSourceShape(flowSteps, buckets) {
|
|
|
20404
20404
|
}
|
|
20405
20405
|
}
|
|
20406
20406
|
}
|
|
20407
|
+
function validateStoreVectorSource(flowSteps, buckets, declaredFlowInputs) {
|
|
20408
|
+
const declaredVariables = collectDeclaredFlowInputs(flowSteps, declaredFlowInputs);
|
|
20409
|
+
for (const [stepIndex, step] of flowSteps.entries()) {
|
|
20410
|
+
if (step.enabled === false) continue;
|
|
20411
|
+
if (!isObjectRecord(step.config)) continue;
|
|
20412
|
+
const config3 = step.config;
|
|
20413
|
+
if (step.type === "store-vector") {
|
|
20414
|
+
const rawSource = typeof config3.vectorsSource === "string" ? config3.vectorsSource.trim() : "";
|
|
20415
|
+
if (rawSource) {
|
|
20416
|
+
const templateMatch = rawSource.match(/^\s*\{\{\s*([^}]+?)\s*\}\}\s*$/);
|
|
20417
|
+
const reference = (templateMatch?.[1] ?? rawSource).trim();
|
|
20418
|
+
const classification = classifyVariableReference(reference);
|
|
20419
|
+
if (classification.namespace === "plain" || classification.namespace === "flow") {
|
|
20420
|
+
const baseName = classification.baseName;
|
|
20421
|
+
const rootVariable = baseName.split(".")[0] || "";
|
|
20422
|
+
if (rootVariable && !declaredVariables.has(rootVariable) && !declaredVariables.has(baseName)) {
|
|
20423
|
+
addIssue(
|
|
20424
|
+
"warning",
|
|
20425
|
+
{
|
|
20426
|
+
code: "STORE_VECTOR_SOURCE_UNRESOLVED",
|
|
20427
|
+
message: `Vectors source "${rawSource}" references variable "${rootVariable}", but no earlier step declares an output variable "${rootVariable}" (and it is not a flow input). This will fail at runtime with "Could not resolve vectors". Set a prior step's outputVariable to "${rootVariable}" (typically a generate-embedding step), or declare "${rootVariable}" as a flow input.`,
|
|
20428
|
+
path: `flowSteps[${stepIndex}].config.vectorsSource`,
|
|
20429
|
+
step: { index: stepIndex, name: step.name, type: step.type },
|
|
20430
|
+
details: { vectorsSource: rawSource, rootVariable }
|
|
20431
|
+
},
|
|
20432
|
+
buckets
|
|
20433
|
+
);
|
|
20434
|
+
}
|
|
20435
|
+
}
|
|
20436
|
+
}
|
|
20437
|
+
}
|
|
20438
|
+
const outputVar = getStepOutputVariable(step);
|
|
20439
|
+
if (outputVar) declaredVariables.add(outputVar);
|
|
20440
|
+
}
|
|
20441
|
+
}
|
|
20407
20442
|
function checkConditionExpression(expr, path19, stepRef, buckets) {
|
|
20408
20443
|
if (typeof expr !== "string" || !expr.includes("{{")) return;
|
|
20409
20444
|
const match = UNQUOTED_TEMPLATE_BEFORE_OP.exec(expr) || UNQUOTED_TEMPLATE_AFTER_OP.exec(expr);
|
|
@@ -21061,6 +21096,7 @@ function collectFlowStructureIssues(flowData, deps, buckets) {
|
|
|
21061
21096
|
deps.declaredFlowInputs
|
|
21062
21097
|
);
|
|
21063
21098
|
validateUpsertRecordSourceShape(flowData.flowSteps, buckets);
|
|
21099
|
+
validateStoreVectorSource(flowData.flowSteps, buckets, deps.declaredFlowInputs);
|
|
21064
21100
|
validateConditionExpressions(flowData.flowSteps, buckets, conditionalStepsExceedingDepth);
|
|
21065
21101
|
return { pendingChecks };
|
|
21066
21102
|
}
|
|
@@ -37587,7 +37623,43 @@ var checkGraderSchema = external_exports.discriminatedUnion("kind", [
|
|
|
37587
37623
|
}),
|
|
37588
37624
|
external_exports.object({ kind: external_exports.literal("latency"), maxMs: external_exports.number().int().positive() }),
|
|
37589
37625
|
// Today's implicit "success" made explicit: the case produced output without erroring.
|
|
37590
|
-
external_exports.object({ kind: external_exports.literal("no_error") })
|
|
37626
|
+
external_exports.object({ kind: external_exports.literal("no_error") }),
|
|
37627
|
+
// -------------------------------------------------------------------------
|
|
37628
|
+
// Trace checks — deterministic, free, pure assertions over the run's
|
|
37629
|
+
// EXECUTION TRACE (which tools/steps ran, in what order, whether it
|
|
37630
|
+
// completed, what it cost) rather than its final output text. Scored by the
|
|
37631
|
+
// same pure `runCheck` engine against `GradingTarget.trace`. These are the
|
|
37632
|
+
// assertions a string/JSON check can't express (planning doc §3.1).
|
|
37633
|
+
// -------------------------------------------------------------------------
|
|
37634
|
+
// At least one tool call named `name` happened. Optional filters narrow the
|
|
37635
|
+
// match: `input`/`output` deep-equal a call's resolved input/result,
|
|
37636
|
+
// `isError` matches a call's error flag, and `times` asserts the matching
|
|
37637
|
+
// count EXACTLY (omit `times` for "at least once").
|
|
37638
|
+
external_exports.object({
|
|
37639
|
+
kind: external_exports.literal("called_tool"),
|
|
37640
|
+
name: external_exports.string().min(1),
|
|
37641
|
+
input: external_exports.unknown().optional(),
|
|
37642
|
+
output: external_exports.unknown().optional(),
|
|
37643
|
+
isError: external_exports.boolean().optional(),
|
|
37644
|
+
times: external_exports.number().int().positive().optional()
|
|
37645
|
+
}),
|
|
37646
|
+
// No tool named `name` was called.
|
|
37647
|
+
external_exports.object({ kind: external_exports.literal("not_called_tool"), name: external_exports.string().min(1) }),
|
|
37648
|
+
// The run made no tool calls at all.
|
|
37649
|
+
external_exports.object({ kind: external_exports.literal("used_no_tools") }),
|
|
37650
|
+
// The run made at most `max` tool calls.
|
|
37651
|
+
external_exports.object({ kind: external_exports.literal("max_tool_calls"), max: external_exports.number().int().nonnegative() }),
|
|
37652
|
+
// `tools` appears as an ordered SUBSEQUENCE of the tool-call names (other
|
|
37653
|
+
// calls may interleave; relative order of the listed tools must hold).
|
|
37654
|
+
external_exports.object({ kind: external_exports.literal("tool_order"), tools: external_exports.array(external_exports.string()).min(1) }),
|
|
37655
|
+
// A step named (or typed) `name` ran.
|
|
37656
|
+
external_exports.object({ kind: external_exports.literal("ran_step"), name: external_exports.string().min(1) }),
|
|
37657
|
+
// `steps` appears as an ordered SUBSEQUENCE of the steps that ran.
|
|
37658
|
+
external_exports.object({ kind: external_exports.literal("step_order"), steps: external_exports.array(external_exports.string()).min(1) }),
|
|
37659
|
+
// The run completed (finished without erroring and was not left paused).
|
|
37660
|
+
external_exports.object({ kind: external_exports.literal("completed") }),
|
|
37661
|
+
// Total run cost was within `maxUsd` (US dollars).
|
|
37662
|
+
external_exports.object({ kind: external_exports.literal("cost"), maxUsd: external_exports.number().positive() })
|
|
37591
37663
|
]);
|
|
37592
37664
|
var aiGraderSchema = external_exports.object({
|
|
37593
37665
|
kind: external_exports.literal("ai"),
|
|
@@ -38065,6 +38137,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
38065
38137
|
"glm-5-2": {
|
|
38066
38138
|
"vercel": "zai/glm-5.2"
|
|
38067
38139
|
},
|
|
38140
|
+
"glm-5-2-fast": {
|
|
38141
|
+
"vercel": "zai/glm-5.2-fast"
|
|
38142
|
+
},
|
|
38068
38143
|
"glm-5-turbo": {
|
|
38069
38144
|
"vercel": "zai/glm-5-turbo"
|
|
38070
38145
|
},
|
|
@@ -38074,6 +38149,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
38074
38149
|
"glm-5.2": {
|
|
38075
38150
|
"vercel": "zai/glm-5.2"
|
|
38076
38151
|
},
|
|
38152
|
+
"glm-5.2-fast": {
|
|
38153
|
+
"vercel": "zai/glm-5.2-fast"
|
|
38154
|
+
},
|
|
38077
38155
|
"glm-5v-turbo": {
|
|
38078
38156
|
"vercel": "zai/glm-5v-turbo"
|
|
38079
38157
|
},
|
|
@@ -38118,6 +38196,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
38118
38196
|
"gpt-4o-mini-search-preview": {
|
|
38119
38197
|
"vercel": "openai/gpt-4o-mini-search-preview"
|
|
38120
38198
|
},
|
|
38199
|
+
"gpt-4o-mini-transcribe": {
|
|
38200
|
+
"vercel": "openai/gpt-4o-mini-transcribe"
|
|
38201
|
+
},
|
|
38202
|
+
"gpt-4o-transcribe": {
|
|
38203
|
+
"vercel": "openai/gpt-4o-transcribe"
|
|
38204
|
+
},
|
|
38121
38205
|
"gpt-5": {
|
|
38122
38206
|
"openai": "gpt-5",
|
|
38123
38207
|
"vercel": "openai/gpt-5"
|
|
@@ -38405,6 +38489,18 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
38405
38489
|
"grok-imagine-video-1.5-preview": {
|
|
38406
38490
|
"vercel": "xai/grok-imagine-video-1.5-preview"
|
|
38407
38491
|
},
|
|
38492
|
+
"grok-stt": {
|
|
38493
|
+
"vercel": "xai/grok-stt"
|
|
38494
|
+
},
|
|
38495
|
+
"grok-tts": {
|
|
38496
|
+
"vercel": "xai/grok-tts"
|
|
38497
|
+
},
|
|
38498
|
+
"grok-voice-think-fast-1-0": {
|
|
38499
|
+
"vercel": "xai/grok-voice-think-fast-1.0"
|
|
38500
|
+
},
|
|
38501
|
+
"grok-voice-think-fast-1.0": {
|
|
38502
|
+
"vercel": "xai/grok-voice-think-fast-1.0"
|
|
38503
|
+
},
|
|
38408
38504
|
"imagen-4-0-fast-generate-001": {
|
|
38409
38505
|
"vercel": "google/imagen-4.0-fast-generate-001"
|
|
38410
38506
|
},
|
|
@@ -39138,6 +39234,12 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39138
39234
|
"trinity-mini": {
|
|
39139
39235
|
"vercel": "arcee-ai/trinity-mini"
|
|
39140
39236
|
},
|
|
39237
|
+
"tts-1": {
|
|
39238
|
+
"vercel": "openai/tts-1"
|
|
39239
|
+
},
|
|
39240
|
+
"tts-1-hd": {
|
|
39241
|
+
"vercel": "openai/tts-1-hd"
|
|
39242
|
+
},
|
|
39141
39243
|
"veo-3-0-fast-generate-001": {
|
|
39142
39244
|
"vercel": "google/veo-3.0-fast-generate-001"
|
|
39143
39245
|
},
|
|
@@ -39234,6 +39336,9 @@ var MODEL_FAMILY_PROVIDER_IDS = {
|
|
|
39234
39336
|
"wan-v2.6-t2v": {
|
|
39235
39337
|
"vercel": "alibaba/wan-v2.6-t2v"
|
|
39236
39338
|
},
|
|
39339
|
+
"whisper-1": {
|
|
39340
|
+
"vercel": "openai/whisper-1"
|
|
39341
|
+
},
|
|
39237
39342
|
"zai-org/GLM-5": {
|
|
39238
39343
|
"togetherai": "togetherai/zai-org/GLM-5"
|
|
39239
39344
|
},
|
|
@@ -42010,7 +42115,7 @@ var FLOW_STEP_TYPE_METADATA = {
|
|
|
42010
42115
|
configHints: "provider, query, maxResults, outputVariable"
|
|
42011
42116
|
},
|
|
42012
42117
|
"generate-embedding": {
|
|
42013
|
-
description: "Create a vector embedding from text using an embedding model.",
|
|
42118
|
+
description: "Create a vector embedding from text using an embedding model. Writes { embedding, model, dimensions, textLength, metadata } to outputVariable; feed that variable into a store-vector step via vectorsSource.",
|
|
42014
42119
|
category: "vector",
|
|
42015
42120
|
isPrompt: false,
|
|
42016
42121
|
configHints: "inputSource, text, embeddingModel, outputVariable"
|
|
@@ -42022,10 +42127,10 @@ var FLOW_STEP_TYPE_METADATA = {
|
|
|
42022
42127
|
configHints: "query, limit, threshold, outputVariable"
|
|
42023
42128
|
},
|
|
42024
42129
|
"store-vector": {
|
|
42025
|
-
description: "Store vector embeddings in a vector database.",
|
|
42130
|
+
description: "Store vector embeddings in a vector database (pgvector, Weaviate, or Vectorize). vectorsSource accepts a bare variable name, a dot-path, or a {{var}} template, and must resolve to a number[] or an { embedding: number[] } object (the output of a prior generate-embedding step). The vector length must match the target index dimension.",
|
|
42026
42131
|
category: "vector",
|
|
42027
42132
|
isPrompt: false,
|
|
42028
|
-
configHints: "vectorsSource, destination, outputVariable"
|
|
42133
|
+
configHints: "vectorsSource, destination, idTemplate, outputVariable"
|
|
42029
42134
|
},
|
|
42030
42135
|
crawl: {
|
|
42031
42136
|
description: "Crawl a website and extract content from pages.",
|
|
@@ -44831,14 +44936,14 @@ async function promptConfirm(message, options) {
|
|
|
44831
44936
|
output: process.stdout,
|
|
44832
44937
|
terminal: true
|
|
44833
44938
|
});
|
|
44834
|
-
return new Promise((
|
|
44939
|
+
return new Promise((resolve12) => {
|
|
44835
44940
|
rl.question(chalk3.cyan(`${message} (${hint}): `), (answer) => {
|
|
44836
44941
|
rl.close();
|
|
44837
44942
|
const trimmed = answer.trim().toLowerCase();
|
|
44838
44943
|
if (trimmed === "") {
|
|
44839
|
-
|
|
44944
|
+
resolve12(defaultYes);
|
|
44840
44945
|
} else {
|
|
44841
|
-
|
|
44946
|
+
resolve12(trimmed === "y" || trimmed === "yes");
|
|
44842
44947
|
}
|
|
44843
44948
|
});
|
|
44844
44949
|
});
|
|
@@ -46546,13 +46651,13 @@ promptsCommand.command("delete <id>").description("Delete a prompt").option("--t
|
|
|
46546
46651
|
await waitUntilExit2();
|
|
46547
46652
|
return;
|
|
46548
46653
|
}
|
|
46549
|
-
const confirmed = await new Promise((
|
|
46654
|
+
const confirmed = await new Promise((resolve12) => {
|
|
46550
46655
|
const { unmount } = render4(
|
|
46551
46656
|
React4.createElement(ConfirmPrompt, {
|
|
46552
46657
|
message: `Delete prompt ${id}?`,
|
|
46553
46658
|
defaultValue: false,
|
|
46554
46659
|
onConfirm: (result) => {
|
|
46555
|
-
|
|
46660
|
+
resolve12(result);
|
|
46556
46661
|
unmount();
|
|
46557
46662
|
}
|
|
46558
46663
|
})
|
|
@@ -47437,13 +47542,13 @@ secretsCommand.command("delete <id>").description("Delete a secret").option("--t
|
|
|
47437
47542
|
await waitUntilExit2();
|
|
47438
47543
|
return;
|
|
47439
47544
|
}
|
|
47440
|
-
const confirmed = await new Promise((
|
|
47545
|
+
const confirmed = await new Promise((resolve12) => {
|
|
47441
47546
|
const { unmount } = render6(
|
|
47442
47547
|
React6.createElement(ConfirmPrompt, {
|
|
47443
47548
|
message: `Delete secret ${id}?`,
|
|
47444
47549
|
defaultValue: false,
|
|
47445
47550
|
onConfirm: (result) => {
|
|
47446
|
-
|
|
47551
|
+
resolve12(result);
|
|
47447
47552
|
unmount();
|
|
47448
47553
|
}
|
|
47449
47554
|
})
|
|
@@ -47855,13 +47960,13 @@ toolsCommand.command("delete <id>").description("Delete a tool").option("--tty",
|
|
|
47855
47960
|
await waitUntilExit2();
|
|
47856
47961
|
return;
|
|
47857
47962
|
}
|
|
47858
|
-
const confirmed = await new Promise((
|
|
47963
|
+
const confirmed = await new Promise((resolve12) => {
|
|
47859
47964
|
const { unmount } = render7(
|
|
47860
47965
|
React7.createElement(ConfirmPrompt, {
|
|
47861
47966
|
message: `Delete tool ${id}?`,
|
|
47862
47967
|
defaultValue: false,
|
|
47863
47968
|
onConfirm: (result) => {
|
|
47864
|
-
|
|
47969
|
+
resolve12(result);
|
|
47865
47970
|
unmount();
|
|
47866
47971
|
}
|
|
47867
47972
|
})
|
|
@@ -50283,13 +50388,13 @@ conversationsCommand.command("delete <id>").description("Delete a conversation")
|
|
|
50283
50388
|
await waitUntilExit2();
|
|
50284
50389
|
return;
|
|
50285
50390
|
}
|
|
50286
|
-
const confirmed = await new Promise((
|
|
50391
|
+
const confirmed = await new Promise((resolve12) => {
|
|
50287
50392
|
const { unmount } = render14(
|
|
50288
50393
|
React14.createElement(ConfirmPrompt, {
|
|
50289
50394
|
message: `Delete conversation ${id}?`,
|
|
50290
50395
|
defaultValue: false,
|
|
50291
50396
|
onConfirm: (result) => {
|
|
50292
|
-
|
|
50397
|
+
resolve12(result);
|
|
50293
50398
|
unmount();
|
|
50294
50399
|
}
|
|
50295
50400
|
})
|
|
@@ -56154,8 +56259,8 @@ function MarathonApp({
|
|
|
56154
56259
|
setIsCheckpointExploring(false);
|
|
56155
56260
|
setIsTerminalCheckpoint(Boolean(isTerminal));
|
|
56156
56261
|
isTerminalCheckpointRef.current = Boolean(isTerminal);
|
|
56157
|
-
return new Promise((
|
|
56158
|
-
checkpointResolveRef.current =
|
|
56262
|
+
return new Promise((resolve12) => {
|
|
56263
|
+
checkpointResolveRef.current = resolve12;
|
|
56159
56264
|
});
|
|
56160
56265
|
},
|
|
56161
56266
|
updateMilestone: (milestone) => {
|
|
@@ -57565,16 +57670,16 @@ function MarathonStartupShell({
|
|
|
57565
57670
|
latestAppPropsRef.current = marathonAppProps;
|
|
57566
57671
|
useEffect26(() => {
|
|
57567
57672
|
if (scene !== "app" || !appReadyResolverRef.current) return;
|
|
57568
|
-
const
|
|
57673
|
+
const resolve12 = appReadyResolverRef.current;
|
|
57569
57674
|
appReadyResolverRef.current = null;
|
|
57570
|
-
|
|
57675
|
+
resolve12();
|
|
57571
57676
|
}, [scene]);
|
|
57572
57677
|
const beginTransition = (target) => {
|
|
57573
57678
|
if (transitionPromiseRef.current) return transitionPromiseRef.current;
|
|
57574
57679
|
if (target === "app" && !latestAppPropsRef.current) {
|
|
57575
57680
|
throw new Error("Cannot complete startup before marathon app props are ready.");
|
|
57576
57681
|
}
|
|
57577
|
-
const promise2 = new Promise((
|
|
57682
|
+
const promise2 = new Promise((resolve12) => {
|
|
57578
57683
|
globalThis.setTimeout(() => {
|
|
57579
57684
|
setPrompt(null);
|
|
57580
57685
|
setModelChoices(null);
|
|
@@ -57595,12 +57700,12 @@ function MarathonStartupShell({
|
|
|
57595
57700
|
if (target === "app") {
|
|
57596
57701
|
appReadyResolverRef.current = () => {
|
|
57597
57702
|
transitionPromiseRef.current = null;
|
|
57598
|
-
|
|
57703
|
+
resolve12();
|
|
57599
57704
|
};
|
|
57600
57705
|
} else {
|
|
57601
57706
|
dismissResolverRef.current = () => {
|
|
57602
57707
|
transitionPromiseRef.current = null;
|
|
57603
|
-
|
|
57708
|
+
resolve12();
|
|
57604
57709
|
};
|
|
57605
57710
|
}
|
|
57606
57711
|
}, Math.max(0, MIN_HOLD_MS - (Date.now() - mountedAtRef.current)));
|
|
@@ -57617,8 +57722,8 @@ function MarathonStartupShell({
|
|
|
57617
57722
|
setModelChoices(null);
|
|
57618
57723
|
setPrompt(nextPrompt);
|
|
57619
57724
|
setSelectedPromptIndex(0);
|
|
57620
|
-
return new Promise((
|
|
57621
|
-
promptResolverRef.current =
|
|
57725
|
+
return new Promise((resolve12) => {
|
|
57726
|
+
promptResolverRef.current = resolve12;
|
|
57622
57727
|
});
|
|
57623
57728
|
},
|
|
57624
57729
|
requestModelChoice: async (nextCurrentModel, models) => {
|
|
@@ -57626,8 +57731,8 @@ function MarathonStartupShell({
|
|
|
57626
57731
|
setPlaybookConfirm(null);
|
|
57627
57732
|
setCurrentModel(nextCurrentModel);
|
|
57628
57733
|
setModelChoices(models);
|
|
57629
|
-
return new Promise((
|
|
57630
|
-
modelResolverRef.current =
|
|
57734
|
+
return new Promise((resolve12) => {
|
|
57735
|
+
modelResolverRef.current = resolve12;
|
|
57631
57736
|
});
|
|
57632
57737
|
},
|
|
57633
57738
|
requestPlaybookModelConfirm: async (playbookName, milestoneModels) => {
|
|
@@ -57642,8 +57747,8 @@ function MarathonStartupShell({
|
|
|
57642
57747
|
// Default selection is the "Confirm" action (first item after milestones)
|
|
57643
57748
|
selectedIndex: names.length
|
|
57644
57749
|
});
|
|
57645
|
-
return new Promise((
|
|
57646
|
-
playbookConfirmResolverRef.current =
|
|
57750
|
+
return new Promise((resolve12) => {
|
|
57751
|
+
playbookConfirmResolverRef.current = resolve12;
|
|
57647
57752
|
});
|
|
57648
57753
|
},
|
|
57649
57754
|
completeStartup: () => beginTransition("app"),
|
|
@@ -58157,15 +58262,15 @@ async function retryOnNetworkError(fn, opts = {}) {
|
|
|
58157
58262
|
}
|
|
58158
58263
|
const delay = Math.min(baseDelay * 2 ** attempt, maxDelay);
|
|
58159
58264
|
opts.onRetry?.(attempt + 1, delay, error51);
|
|
58160
|
-
await new Promise((
|
|
58265
|
+
await new Promise((resolve12) => {
|
|
58161
58266
|
const signal = opts.signal;
|
|
58162
58267
|
const onAbort = () => {
|
|
58163
58268
|
clearTimeout(timer);
|
|
58164
|
-
|
|
58269
|
+
resolve12();
|
|
58165
58270
|
};
|
|
58166
58271
|
const timer = setTimeout(() => {
|
|
58167
58272
|
signal?.removeEventListener("abort", onAbort);
|
|
58168
|
-
|
|
58273
|
+
resolve12();
|
|
58169
58274
|
}, delay);
|
|
58170
58275
|
if (signal) {
|
|
58171
58276
|
if (signal.aborted) onAbort();
|
|
@@ -58431,14 +58536,14 @@ async function promptNumericSelect(choices, promptLabel) {
|
|
|
58431
58536
|
output: process.stdout,
|
|
58432
58537
|
terminal: true
|
|
58433
58538
|
});
|
|
58434
|
-
return new Promise((
|
|
58539
|
+
return new Promise((resolve12) => {
|
|
58435
58540
|
const ask = () => {
|
|
58436
58541
|
rl.question(chalk21.cyan(`
|
|
58437
58542
|
${promptLabel} (1-${choices.length}): `), (answer) => {
|
|
58438
58543
|
const value = parseInt(answer.trim(), 10);
|
|
58439
58544
|
if (value >= 1 && value <= choices.length) {
|
|
58440
58545
|
rl.close();
|
|
58441
|
-
|
|
58546
|
+
resolve12(choices[value - 1].value);
|
|
58442
58547
|
return;
|
|
58443
58548
|
}
|
|
58444
58549
|
console.log(chalk21.red(`Please enter a number between 1 and ${choices.length}.`));
|
|
@@ -58466,7 +58571,7 @@ ${message}`));
|
|
|
58466
58571
|
const previousRawMode = input.isRaw === true;
|
|
58467
58572
|
let selectedIndex = 0;
|
|
58468
58573
|
let renderedLineCount = 0;
|
|
58469
|
-
return new Promise((
|
|
58574
|
+
return new Promise((resolve12) => {
|
|
58470
58575
|
const renderMenu = () => {
|
|
58471
58576
|
if (renderedLineCount > 0) {
|
|
58472
58577
|
clearRenderedLines(output, renderedLineCount);
|
|
@@ -58488,7 +58593,7 @@ ${message}`));
|
|
|
58488
58593
|
};
|
|
58489
58594
|
const finish = (value) => {
|
|
58490
58595
|
cleanup();
|
|
58491
|
-
|
|
58596
|
+
resolve12(value);
|
|
58492
58597
|
};
|
|
58493
58598
|
const onKeypress = (_2, key) => {
|
|
58494
58599
|
if (key.ctrl && key.name === "c") {
|
|
@@ -61089,7 +61194,7 @@ async function taskAction(agent, options) {
|
|
|
61089
61194
|
waitForUiExit = renderedShell.waitUntilExit;
|
|
61090
61195
|
rerenderUi = renderedShell.rerender;
|
|
61091
61196
|
unmountUi = renderedShell.unmount;
|
|
61092
|
-
await new Promise((
|
|
61197
|
+
await new Promise((resolve12) => setTimeout(resolve12, 0));
|
|
61093
61198
|
if (!startupShellRef.current) {
|
|
61094
61199
|
exitAltScreen();
|
|
61095
61200
|
unmountUi?.();
|
|
@@ -61722,7 +61827,7 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
61722
61827
|
waitForUiExit = renderedApp.waitUntilExit;
|
|
61723
61828
|
unmountUi = renderedApp.unmount;
|
|
61724
61829
|
}
|
|
61725
|
-
await new Promise((
|
|
61830
|
+
await new Promise((resolve12) => setTimeout(resolve12, 0));
|
|
61726
61831
|
const streamActions = streamRef.current;
|
|
61727
61832
|
if (!streamActions) {
|
|
61728
61833
|
exitAltScreen();
|
|
@@ -61901,7 +62006,7 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
61901
62006
|
};
|
|
61902
62007
|
if (event.phase === "start") {
|
|
61903
62008
|
currentActions.startContextCompaction(absoluteEvent);
|
|
61904
|
-
await new Promise((
|
|
62009
|
+
await new Promise((resolve12) => setTimeout(resolve12, 0));
|
|
61905
62010
|
return;
|
|
61906
62011
|
}
|
|
61907
62012
|
currentActions.finishContextCompaction(absoluteEvent);
|
|
@@ -62333,8 +62438,8 @@ Saving state... done. Session saved to ${filePath}`);
|
|
|
62333
62438
|
const INDEXING_SETTLE_GRACE_MS = 5e3;
|
|
62334
62439
|
await Promise.race([
|
|
62335
62440
|
Promise.allSettled(indexingRequests),
|
|
62336
|
-
new Promise((
|
|
62337
|
-
const timer = setTimeout(
|
|
62441
|
+
new Promise((resolve12) => {
|
|
62442
|
+
const timer = setTimeout(resolve12, INDEXING_SETTLE_GRACE_MS);
|
|
62338
62443
|
timer.unref?.();
|
|
62339
62444
|
})
|
|
62340
62445
|
]);
|
|
@@ -63768,7 +63873,122 @@ import React19 from "react";
|
|
|
63768
63873
|
import { render as render19 } from "ink";
|
|
63769
63874
|
import { useState as useState36, useEffect as useEffect30 } from "react";
|
|
63770
63875
|
import { Text as Text34 } from "ink";
|
|
63771
|
-
import { readFileSync as readFileSync16 } from "fs";
|
|
63876
|
+
import { readFileSync as readFileSync16, writeFileSync as writeFileSync6, mkdirSync as mkdirSync8 } from "fs";
|
|
63877
|
+
import { dirname as dirname8, relative as relative6, resolve as resolve10 } from "path";
|
|
63878
|
+
|
|
63879
|
+
// src/lib/eval-discovery.ts
|
|
63880
|
+
import { readdirSync as readdirSync6 } from "fs";
|
|
63881
|
+
import { join as join11, relative as relative5, sep as sep5 } from "path";
|
|
63882
|
+
import { createJiti as createJiti2 } from "jiti";
|
|
63883
|
+
var EVAL_FILE_SUFFIXES = [".eval.ts", ".eval.mts"];
|
|
63884
|
+
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
63885
|
+
"node_modules",
|
|
63886
|
+
".git",
|
|
63887
|
+
"dist",
|
|
63888
|
+
"build",
|
|
63889
|
+
".next",
|
|
63890
|
+
".turbo",
|
|
63891
|
+
"coverage",
|
|
63892
|
+
".cache"
|
|
63893
|
+
]);
|
|
63894
|
+
function isEvalFile(name) {
|
|
63895
|
+
return EVAL_FILE_SUFFIXES.some((suffix) => name.endsWith(suffix));
|
|
63896
|
+
}
|
|
63897
|
+
function discoverEvalFiles(rootDir) {
|
|
63898
|
+
const found = [];
|
|
63899
|
+
const walk = (dir) => {
|
|
63900
|
+
let entries;
|
|
63901
|
+
try {
|
|
63902
|
+
entries = readdirSync6(dir, { withFileTypes: true });
|
|
63903
|
+
} catch {
|
|
63904
|
+
return;
|
|
63905
|
+
}
|
|
63906
|
+
for (const entry of entries) {
|
|
63907
|
+
const name = entry.name.toString();
|
|
63908
|
+
if (entry.isDirectory()) {
|
|
63909
|
+
if (!IGNORED_DIRS.has(name) && !name.startsWith(".")) {
|
|
63910
|
+
walk(join11(dir, name));
|
|
63911
|
+
}
|
|
63912
|
+
} else if (entry.isFile() && isEvalFile(name)) {
|
|
63913
|
+
found.push(join11(dir, name));
|
|
63914
|
+
}
|
|
63915
|
+
}
|
|
63916
|
+
};
|
|
63917
|
+
walk(rootDir);
|
|
63918
|
+
return found.sort();
|
|
63919
|
+
}
|
|
63920
|
+
function filterEvalFilesByPrefix(files, rootDir, prefix) {
|
|
63921
|
+
const normalized = prefix.replace(/\//g, sep5);
|
|
63922
|
+
return files.filter((file2) => {
|
|
63923
|
+
const rel = relative5(rootDir, file2);
|
|
63924
|
+
const base = rel.split(sep5).pop() ?? rel;
|
|
63925
|
+
return rel.startsWith(normalized) || base.includes(prefix);
|
|
63926
|
+
});
|
|
63927
|
+
}
|
|
63928
|
+
var jitiLoader2;
|
|
63929
|
+
async function loadEvalDefinition(filePath) {
|
|
63930
|
+
jitiLoader2 ??= createJiti2(import.meta.url, { interopDefault: false });
|
|
63931
|
+
let mod;
|
|
63932
|
+
try {
|
|
63933
|
+
mod = await jitiLoader2.import(filePath);
|
|
63934
|
+
} catch (error51) {
|
|
63935
|
+
const message = error51 instanceof Error ? error51.message : String(error51);
|
|
63936
|
+
throw new Error(`Failed to load eval file ${filePath}: ${message}`, { cause: error51 });
|
|
63937
|
+
}
|
|
63938
|
+
const exported = mod.default;
|
|
63939
|
+
if (exported === void 0 || exported === null) {
|
|
63940
|
+
throw new Error(
|
|
63941
|
+
`Eval file ${filePath} must have a default export: the result of defineEval({...}) from @runtypelabs/sdk.`
|
|
63942
|
+
);
|
|
63943
|
+
}
|
|
63944
|
+
if (typeof exported !== "object" || !("target" in exported) || !("cases" in exported) || !Array.isArray(exported.cases)) {
|
|
63945
|
+
throw new Error(
|
|
63946
|
+
`Eval file ${filePath} default export is not an eval definition. Export defineEval({ target, cases, ... }).`
|
|
63947
|
+
);
|
|
63948
|
+
}
|
|
63949
|
+
return exported;
|
|
63950
|
+
}
|
|
63951
|
+
|
|
63952
|
+
// src/lib/eval-junit.ts
|
|
63953
|
+
function escapeXml(value) {
|
|
63954
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
63955
|
+
}
|
|
63956
|
+
function buildJUnitXml(suites) {
|
|
63957
|
+
const totalTests = suites.reduce((sum, s) => sum + s.cases.length, 0);
|
|
63958
|
+
const totalFailures = suites.reduce(
|
|
63959
|
+
(sum, s) => sum + s.cases.filter((c2) => !c2.passed).length,
|
|
63960
|
+
0
|
|
63961
|
+
);
|
|
63962
|
+
const lines = [];
|
|
63963
|
+
lines.push('<?xml version="1.0" encoding="UTF-8"?>');
|
|
63964
|
+
lines.push(
|
|
63965
|
+
`<testsuites name="runtype-eval" tests="${totalTests}" failures="${totalFailures}">`
|
|
63966
|
+
);
|
|
63967
|
+
for (const suite of suites) {
|
|
63968
|
+
const suiteFailures = suite.cases.filter((c2) => !c2.passed).length;
|
|
63969
|
+
lines.push(
|
|
63970
|
+
` <testsuite name="${escapeXml(suite.name)}" tests="${suite.cases.length}" failures="${suiteFailures}">`
|
|
63971
|
+
);
|
|
63972
|
+
for (const testCase of suite.cases) {
|
|
63973
|
+
const classname = escapeXml(suite.name);
|
|
63974
|
+
const caseName = escapeXml(testCase.name);
|
|
63975
|
+
if (testCase.passed) {
|
|
63976
|
+
lines.push(` <testcase name="${caseName}" classname="${classname}" />`);
|
|
63977
|
+
} else {
|
|
63978
|
+
const reason = testCase.errored ? "Case errored while producing output" : "One or more graders failed";
|
|
63979
|
+
const detail = testCase.failedGraders.length ? testCase.failedGraders.join("\n") : reason;
|
|
63980
|
+
lines.push(` <testcase name="${caseName}" classname="${classname}">`);
|
|
63981
|
+
lines.push(` <failure message="${escapeXml(reason)}">${escapeXml(detail)}</failure>`);
|
|
63982
|
+
lines.push(" </testcase>");
|
|
63983
|
+
}
|
|
63984
|
+
}
|
|
63985
|
+
lines.push(" </testsuite>");
|
|
63986
|
+
}
|
|
63987
|
+
lines.push("</testsuites>");
|
|
63988
|
+
return lines.join("\n") + "\n";
|
|
63989
|
+
}
|
|
63990
|
+
|
|
63991
|
+
// src/commands/eval.ts
|
|
63772
63992
|
var evalCommand = new Command20("eval").description("Manage evaluations");
|
|
63773
63993
|
evalCommand.command("submit").description("Submit an eval batch").requiredOption("-f, --flow <id>", "Flow ID to evaluate").requiredOption("-r, --records <file>", "JSON file with record IDs").option("-n, --name <name>", "Eval batch name").option("--json", "Output as JSON").option("--tty", "Force TTY mode").option("--no-tty", "Force non-TTY mode").action(async (options) => {
|
|
63774
63994
|
const apiKey = await ensureAuth();
|
|
@@ -64067,6 +64287,143 @@ evalCommand.command("compare <groupId>").description("Compare evals in a group")
|
|
|
64067
64287
|
const { waitUntilExit } = render19(React19.createElement(App));
|
|
64068
64288
|
await waitUntilExit();
|
|
64069
64289
|
});
|
|
64290
|
+
var EVAL_RUN_EXIT = { pass: 0, fail: 1, config: 2 };
|
|
64291
|
+
function failConfig(message) {
|
|
64292
|
+
console.error(chalk27.red(`Error: ${message}`));
|
|
64293
|
+
process.exit(EVAL_RUN_EXIT.config);
|
|
64294
|
+
}
|
|
64295
|
+
function printSuiteResult(rootDir, outcome) {
|
|
64296
|
+
const { definition, result } = outcome;
|
|
64297
|
+
const rel = relative6(rootDir, outcome.file) || outcome.file;
|
|
64298
|
+
const badge = result.passed ? chalk27.green("PASS") : chalk27.red("FAIL");
|
|
64299
|
+
const score = `${result.passedCases}/${result.totalCases}`;
|
|
64300
|
+
console.log(`${badge} ${chalk27.bold(definition.name)} ${chalk27.gray(`(${score} cases \xB7 ${rel})`)}`);
|
|
64301
|
+
for (const testCase of result.cases) {
|
|
64302
|
+
const caseBadge = testCase.passed ? chalk27.green(" \u2713") : chalk27.red(" \u2717");
|
|
64303
|
+
console.log(`${caseBadge} ${testCase.name}`);
|
|
64304
|
+
if (!testCase.passed) {
|
|
64305
|
+
for (const outcomeItem of testCase.outcomes.filter((o) => !o.passed)) {
|
|
64306
|
+
const reason = outcomeItem.reasoning ? `: ${outcomeItem.reasoning}` : "";
|
|
64307
|
+
console.log(chalk27.red(` \u2717 ${outcomeItem.kind}${reason}`));
|
|
64308
|
+
}
|
|
64309
|
+
if (testCase.errored) {
|
|
64310
|
+
console.log(chalk27.red(` \u2717 errored: ${testCase.outputExcerpt.slice(0, 200)}`));
|
|
64311
|
+
}
|
|
64312
|
+
}
|
|
64313
|
+
}
|
|
64314
|
+
}
|
|
64315
|
+
function toJUnitSuite(outcome) {
|
|
64316
|
+
return {
|
|
64317
|
+
name: outcome.definition.name,
|
|
64318
|
+
cases: outcome.result.cases.map((c2) => ({
|
|
64319
|
+
name: c2.name,
|
|
64320
|
+
passed: c2.passed,
|
|
64321
|
+
errored: c2.errored,
|
|
64322
|
+
failedGraders: c2.outcomes.filter((o) => !o.passed).map((o) => `${o.kind}${o.reasoning ? `: ${o.reasoning}` : ""}`)
|
|
64323
|
+
}))
|
|
64324
|
+
};
|
|
64325
|
+
}
|
|
64326
|
+
evalCommand.command("run [idOrDirPrefix]").description("Run code-colocated eval suites (**/*.eval.ts) as a CI gate (exit 0 pass / 1 fail / 2 config)").option("--strict", "Fail on soft-threshold misses too (no-op until severity lands)").option("--virtual", "Run inline without persisting a suite/batch to the dashboard").option("--junit <path>", "Write JUnit XML results to <path>").option("--url <api>", "Override the API base URL (e.g. staging)").option("--cwd <dir>", "Directory to discover *.eval.ts under (default: current directory)").action(
|
|
64327
|
+
async (idOrDirPrefix, options) => {
|
|
64328
|
+
const apiKey = await ensureAuth();
|
|
64329
|
+
if (!apiKey) {
|
|
64330
|
+
failConfig("Not authenticated. Set RUNTYPE_API_KEY or run `runtype login`.");
|
|
64331
|
+
}
|
|
64332
|
+
const rootDir = resolve10(options.cwd ?? process.cwd());
|
|
64333
|
+
const allFiles = discoverEvalFiles(rootDir);
|
|
64334
|
+
if (allFiles.length === 0) {
|
|
64335
|
+
failConfig(`No *.eval.ts files found under ${rootDir}.`);
|
|
64336
|
+
}
|
|
64337
|
+
const loadAll = async (files) => {
|
|
64338
|
+
const loaded2 = [];
|
|
64339
|
+
for (const file2 of files) {
|
|
64340
|
+
try {
|
|
64341
|
+
loaded2.push({ file: file2, def: await loadEvalDefinition(file2) });
|
|
64342
|
+
} catch (error51) {
|
|
64343
|
+
failConfig(error51 instanceof Error ? error51.message : String(error51));
|
|
64344
|
+
}
|
|
64345
|
+
}
|
|
64346
|
+
return loaded2;
|
|
64347
|
+
};
|
|
64348
|
+
let loaded;
|
|
64349
|
+
if (idOrDirPrefix) {
|
|
64350
|
+
const byPath = filterEvalFilesByPrefix(allFiles, rootDir, idOrDirPrefix);
|
|
64351
|
+
loaded = byPath.length > 0 ? await loadAll(byPath) : [];
|
|
64352
|
+
if (loaded.length === 0) {
|
|
64353
|
+
const everything = await loadAll(allFiles);
|
|
64354
|
+
loaded = everything.filter(
|
|
64355
|
+
({ def }) => def.name === idOrDirPrefix || def.name.includes(idOrDirPrefix)
|
|
64356
|
+
);
|
|
64357
|
+
}
|
|
64358
|
+
if (loaded.length === 0) {
|
|
64359
|
+
failConfig(`No eval suites matched "${idOrDirPrefix}".`);
|
|
64360
|
+
}
|
|
64361
|
+
} else {
|
|
64362
|
+
loaded = await loadAll(allFiles);
|
|
64363
|
+
}
|
|
64364
|
+
if (options.strict) {
|
|
64365
|
+
console.log(
|
|
64366
|
+
chalk27.gray("Note: --strict has no effect yet (grader severity lands in a later increment).")
|
|
64367
|
+
);
|
|
64368
|
+
}
|
|
64369
|
+
const client = createCliClient(apiKey, options.url);
|
|
64370
|
+
const outcomes = [];
|
|
64371
|
+
for (const { file: file2, def } of loaded) {
|
|
64372
|
+
const runVirtual = options.virtual || def.virtual;
|
|
64373
|
+
try {
|
|
64374
|
+
let result;
|
|
64375
|
+
if (runVirtual) {
|
|
64376
|
+
result = await client.post("/eval/run", { definition: def });
|
|
64377
|
+
} else {
|
|
64378
|
+
const ensured = await client.post("/eval/ensure", {
|
|
64379
|
+
name: def.name,
|
|
64380
|
+
definition: def
|
|
64381
|
+
});
|
|
64382
|
+
if (!ensured.suiteId) {
|
|
64383
|
+
throw new Error(`ensure did not return a suiteId (result: ${ensured.result})`);
|
|
64384
|
+
}
|
|
64385
|
+
result = await client.post("/eval/run", { suiteId: ensured.suiteId });
|
|
64386
|
+
}
|
|
64387
|
+
outcomes.push({ file: file2, definition: def, result });
|
|
64388
|
+
printSuiteResult(rootDir, { file: file2, definition: def, result });
|
|
64389
|
+
} catch (error51) {
|
|
64390
|
+
failConfig(
|
|
64391
|
+
`Suite "${def.name}" (${relative6(rootDir, file2) || file2}): ` + (error51 instanceof Error ? error51.message : String(error51))
|
|
64392
|
+
);
|
|
64393
|
+
}
|
|
64394
|
+
}
|
|
64395
|
+
if (options.junit) {
|
|
64396
|
+
try {
|
|
64397
|
+
const xml = buildJUnitXml(outcomes.map(toJUnitSuite));
|
|
64398
|
+
const outPath = resolve10(options.junit);
|
|
64399
|
+
mkdirSync8(dirname8(outPath), { recursive: true });
|
|
64400
|
+
writeFileSync6(outPath, xml, "utf-8");
|
|
64401
|
+
console.log(chalk27.gray(`JUnit results written to ${options.junit}`));
|
|
64402
|
+
} catch (error51) {
|
|
64403
|
+
failConfig(`Failed to write JUnit report: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
64404
|
+
}
|
|
64405
|
+
}
|
|
64406
|
+
const failedSuites = outcomes.filter((o) => !o.result.passed);
|
|
64407
|
+
const totalCases = outcomes.reduce((sum, o) => sum + o.result.totalCases, 0);
|
|
64408
|
+
const passedCases = outcomes.reduce((sum, o) => sum + o.result.passedCases, 0);
|
|
64409
|
+
console.log();
|
|
64410
|
+
if (failedSuites.length === 0) {
|
|
64411
|
+
console.log(
|
|
64412
|
+
chalk27.green(
|
|
64413
|
+
`All ${outcomes.length} suite(s) passed (${passedCases}/${totalCases} cases).`
|
|
64414
|
+
)
|
|
64415
|
+
);
|
|
64416
|
+
process.exit(EVAL_RUN_EXIT.pass);
|
|
64417
|
+
} else {
|
|
64418
|
+
console.log(
|
|
64419
|
+
chalk27.red(
|
|
64420
|
+
`${failedSuites.length} of ${outcomes.length} suite(s) failed (${passedCases}/${totalCases} cases passed).`
|
|
64421
|
+
)
|
|
64422
|
+
);
|
|
64423
|
+
process.exit(EVAL_RUN_EXIT.fail);
|
|
64424
|
+
}
|
|
64425
|
+
}
|
|
64426
|
+
);
|
|
64070
64427
|
|
|
64071
64428
|
// src/commands/api-keys.ts
|
|
64072
64429
|
import { Command as Command21 } from "commander";
|
|
@@ -64333,13 +64690,13 @@ apiKeysCommand.command("delete <id>").description("Delete an API key").option("-
|
|
|
64333
64690
|
await waitUntilExit2();
|
|
64334
64691
|
return;
|
|
64335
64692
|
}
|
|
64336
|
-
const confirmed = await new Promise((
|
|
64693
|
+
const confirmed = await new Promise((resolve12) => {
|
|
64337
64694
|
const { unmount } = render20(
|
|
64338
64695
|
React20.createElement(ConfirmPrompt, {
|
|
64339
64696
|
message: `Delete API key ${id}?`,
|
|
64340
64697
|
defaultValue: false,
|
|
64341
64698
|
onConfirm: (result) => {
|
|
64342
|
-
|
|
64699
|
+
resolve12(result);
|
|
64343
64700
|
unmount();
|
|
64344
64701
|
}
|
|
64345
64702
|
})
|
|
@@ -64805,13 +65162,13 @@ clientTokensCommand.command("delete <id>").description("Delete a client token").
|
|
|
64805
65162
|
await waitUntilExit2();
|
|
64806
65163
|
return;
|
|
64807
65164
|
}
|
|
64808
|
-
const confirmed = await new Promise((
|
|
65165
|
+
const confirmed = await new Promise((resolve12) => {
|
|
64809
65166
|
const { unmount } = render21(
|
|
64810
65167
|
React21.createElement(ConfirmPrompt, {
|
|
64811
65168
|
message: `Delete client token ${id}?`,
|
|
64812
65169
|
defaultValue: false,
|
|
64813
65170
|
onConfirm: (result) => {
|
|
64814
|
-
|
|
65171
|
+
resolve12(result);
|
|
64815
65172
|
unmount();
|
|
64816
65173
|
}
|
|
64817
65174
|
})
|
|
@@ -65433,7 +65790,7 @@ async function runPersonaInit(options) {
|
|
|
65433
65790
|
// src/lib/persona-demo.ts
|
|
65434
65791
|
import { createServer } from "http";
|
|
65435
65792
|
import { createServer as createNetServer } from "net";
|
|
65436
|
-
import { existsSync as existsSync13, mkdirSync as
|
|
65793
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync9, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
|
|
65437
65794
|
import path16 from "path";
|
|
65438
65795
|
var PERSONA_DEMO_DEFAULT_DIR = "persona-demo";
|
|
65439
65796
|
var PERSONA_DEMO_DEFAULT_PORT = 43110;
|
|
@@ -65469,12 +65826,12 @@ function ensurePersonaDemoCanWrite(directory, force) {
|
|
|
65469
65826
|
}
|
|
65470
65827
|
function writePersonaDemoPage(options) {
|
|
65471
65828
|
ensurePersonaDemoCanWrite(options.directory, options.force);
|
|
65472
|
-
|
|
65829
|
+
mkdirSync9(options.directory, { recursive: true });
|
|
65473
65830
|
const filePath = personaDemoIndexPath(options.directory);
|
|
65474
65831
|
const readmePath = personaDemoReadmePath(options.directory);
|
|
65475
|
-
|
|
65832
|
+
writeFileSync7(filePath, `${options.html.trim()}
|
|
65476
65833
|
`, "utf8");
|
|
65477
|
-
|
|
65834
|
+
writeFileSync7(readmePath, `${options.readme.trim()}
|
|
65478
65835
|
`, "utf8");
|
|
65479
65836
|
return { directory: options.directory, filePath, readmePath };
|
|
65480
65837
|
}
|
|
@@ -65488,13 +65845,13 @@ async function findAvailablePersonaDemoPort(preferredPort = PERSONA_DEMO_DEFAULT
|
|
|
65488
65845
|
throw new Error(`Could not find an available local port starting at ${preferredPort}`);
|
|
65489
65846
|
}
|
|
65490
65847
|
function canListenOnPort(port) {
|
|
65491
|
-
return new Promise((
|
|
65848
|
+
return new Promise((resolve12) => {
|
|
65492
65849
|
const server = createNetServer();
|
|
65493
65850
|
server.once("error", () => {
|
|
65494
|
-
|
|
65851
|
+
resolve12(false);
|
|
65495
65852
|
});
|
|
65496
65853
|
server.once("listening", () => {
|
|
65497
|
-
server.close(() =>
|
|
65854
|
+
server.close(() => resolve12(true));
|
|
65498
65855
|
});
|
|
65499
65856
|
server.listen(port, "127.0.0.1");
|
|
65500
65857
|
});
|
|
@@ -65518,10 +65875,10 @@ async function startPersonaDemoServer(options) {
|
|
|
65518
65875
|
return {
|
|
65519
65876
|
url: `http://127.0.0.1:${options.port}/`,
|
|
65520
65877
|
port: options.port,
|
|
65521
|
-
close: () => new Promise((
|
|
65878
|
+
close: () => new Promise((resolve12, reject) => {
|
|
65522
65879
|
server.close((error51) => {
|
|
65523
65880
|
if (error51) reject(error51);
|
|
65524
|
-
else
|
|
65881
|
+
else resolve12();
|
|
65525
65882
|
});
|
|
65526
65883
|
})
|
|
65527
65884
|
};
|
|
@@ -65530,11 +65887,11 @@ function readIndexHtml(filePath) {
|
|
|
65530
65887
|
return readFileSync17(filePath, "utf8");
|
|
65531
65888
|
}
|
|
65532
65889
|
function listen(server, port) {
|
|
65533
|
-
return new Promise((
|
|
65890
|
+
return new Promise((resolve12, reject) => {
|
|
65534
65891
|
server.once("error", reject);
|
|
65535
65892
|
server.listen(port, "127.0.0.1", () => {
|
|
65536
65893
|
server.off("error", reject);
|
|
65537
|
-
|
|
65894
|
+
resolve12();
|
|
65538
65895
|
});
|
|
65539
65896
|
});
|
|
65540
65897
|
}
|
|
@@ -66139,8 +66496,8 @@ function parsePort(raw, fallback) {
|
|
|
66139
66496
|
}
|
|
66140
66497
|
async function promptLine(rl, question, defaultValue) {
|
|
66141
66498
|
const hint = defaultValue ? chalk30.dim(` (${defaultValue})`) : "";
|
|
66142
|
-
const answer = await new Promise((
|
|
66143
|
-
rl.question(`${question}${hint}: `,
|
|
66499
|
+
const answer = await new Promise((resolve12) => {
|
|
66500
|
+
rl.question(`${question}${hint}: `, resolve12);
|
|
66144
66501
|
});
|
|
66145
66502
|
const trimmed = answer.trim();
|
|
66146
66503
|
if (!trimmed && defaultValue !== void 0) {
|
|
@@ -66150,8 +66507,8 @@ async function promptLine(rl, question, defaultValue) {
|
|
|
66150
66507
|
}
|
|
66151
66508
|
async function promptConfirm2(rl, message, defaultYes = false) {
|
|
66152
66509
|
const hint = defaultYes ? chalk30.dim(" (Y/n)") : chalk30.dim(" (y/N)");
|
|
66153
|
-
const answer = await new Promise((
|
|
66154
|
-
rl.question(`${message}${hint}: `,
|
|
66510
|
+
const answer = await new Promise((resolve12) => {
|
|
66511
|
+
rl.question(`${message}${hint}: `, resolve12);
|
|
66155
66512
|
});
|
|
66156
66513
|
const t = answer.trim().toLowerCase();
|
|
66157
66514
|
if (t === "") return defaultYes;
|
|
@@ -66239,13 +66596,13 @@ Dashboard: ${initial.dashboardUrl}`));
|
|
|
66239
66596
|
output: process.stdout,
|
|
66240
66597
|
terminal: true
|
|
66241
66598
|
});
|
|
66242
|
-
await new Promise((
|
|
66599
|
+
await new Promise((resolve12) => {
|
|
66243
66600
|
let finished = false;
|
|
66244
66601
|
const finish = () => {
|
|
66245
66602
|
if (finished) return;
|
|
66246
66603
|
finished = true;
|
|
66247
66604
|
rl.close();
|
|
66248
|
-
|
|
66605
|
+
resolve12();
|
|
66249
66606
|
};
|
|
66250
66607
|
const runAction = async (name) => {
|
|
66251
66608
|
if (name === "q") {
|
|
@@ -67835,11 +68192,11 @@ async function runTail(options) {
|
|
|
67835
68192
|
process.stderr.write(
|
|
67836
68193
|
(useColor ? chalk35.gray(`Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) : `Retrying in ${delay / 1e3}s (attempt ${attempt}/${MAX_ATTEMPTS})...`) + "\n"
|
|
67837
68194
|
);
|
|
67838
|
-
await new Promise((
|
|
67839
|
-
const timer = setTimeout(
|
|
68195
|
+
await new Promise((resolve12) => {
|
|
68196
|
+
const timer = setTimeout(resolve12, delay);
|
|
67840
68197
|
const onAbort = () => {
|
|
67841
68198
|
clearTimeout(timer);
|
|
67842
|
-
|
|
68199
|
+
resolve12();
|
|
67843
68200
|
};
|
|
67844
68201
|
controller.signal.addEventListener("abort", onAbort, { once: true });
|
|
67845
68202
|
});
|
|
@@ -69181,7 +69538,7 @@ import { Command as Command31 } from "commander";
|
|
|
69181
69538
|
import chalk39 from "chalk";
|
|
69182
69539
|
|
|
69183
69540
|
// src/lib/skills-install.ts
|
|
69184
|
-
import { mkdirSync as
|
|
69541
|
+
import { mkdirSync as mkdirSync11, readFileSync as readFileSync19, writeFileSync as writeFileSync9 } from "fs";
|
|
69185
69542
|
import path18 from "path";
|
|
69186
69543
|
import readline4 from "readline";
|
|
69187
69544
|
import chalk38 from "chalk";
|
|
@@ -69205,8 +69562,8 @@ function readSkillsInstallMetadata() {
|
|
|
69205
69562
|
}
|
|
69206
69563
|
function writeSkillsInstallMetadata(metadata) {
|
|
69207
69564
|
try {
|
|
69208
|
-
|
|
69209
|
-
|
|
69565
|
+
mkdirSync11(path18.dirname(metadataPath()), { recursive: true });
|
|
69566
|
+
writeFileSync9(metadataPath(), JSON.stringify(metadata, null, 2));
|
|
69210
69567
|
} catch {
|
|
69211
69568
|
}
|
|
69212
69569
|
}
|
|
@@ -69256,8 +69613,8 @@ async function promptConfirm3(message, defaultYes = true) {
|
|
|
69256
69613
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
69257
69614
|
const hint = defaultYes ? chalk38.dim(" (Y/n)") : chalk38.dim(" (y/N)");
|
|
69258
69615
|
try {
|
|
69259
|
-
const answer = await new Promise((
|
|
69260
|
-
rl.question(`${message}${hint}: `,
|
|
69616
|
+
const answer = await new Promise((resolve12) => {
|
|
69617
|
+
rl.question(`${message}${hint}: `, resolve12);
|
|
69261
69618
|
});
|
|
69262
69619
|
const t = answer.trim().toLowerCase();
|
|
69263
69620
|
if (t === "") return defaultYes;
|
|
@@ -69462,8 +69819,8 @@ skillsCommand.command("install").description(`Install Runtype skills (${SKILLS_R
|
|
|
69462
69819
|
);
|
|
69463
69820
|
|
|
69464
69821
|
// src/commands/apps.ts
|
|
69465
|
-
import { readdirSync as
|
|
69466
|
-
import { join as
|
|
69822
|
+
import { readdirSync as readdirSync7, readFileSync as readFileSync20, lstatSync, statSync as statSync7, existsSync as existsSync15 } from "fs";
|
|
69823
|
+
import { join as join13, relative as relative7 } from "path";
|
|
69467
69824
|
import { Command as Command32 } from "commander";
|
|
69468
69825
|
import chalk40 from "chalk";
|
|
69469
69826
|
import { zipSync } from "fflate";
|
|
@@ -69474,16 +69831,16 @@ var MANIFEST_FILENAME = "runtype.app.json";
|
|
|
69474
69831
|
function collectBundleFiles(dir) {
|
|
69475
69832
|
const zippable = {};
|
|
69476
69833
|
const walk = (current) => {
|
|
69477
|
-
for (const entry of
|
|
69834
|
+
for (const entry of readdirSync7(current)) {
|
|
69478
69835
|
if (entry.startsWith(".")) continue;
|
|
69479
|
-
const full =
|
|
69836
|
+
const full = join13(current, entry);
|
|
69480
69837
|
const stat = lstatSync(full);
|
|
69481
69838
|
if (stat.isSymbolicLink()) continue;
|
|
69482
69839
|
if (stat.isDirectory()) {
|
|
69483
69840
|
if (entry === "node_modules") continue;
|
|
69484
69841
|
walk(full);
|
|
69485
69842
|
} else {
|
|
69486
|
-
zippable[
|
|
69843
|
+
zippable[relative7(dir, full).split("\\").join("/")] = readFileSync20(full);
|
|
69487
69844
|
}
|
|
69488
69845
|
}
|
|
69489
69846
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runtypelabs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.1",
|
|
4
4
|
"description": "Command-line interface for Runtype AI platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"rosie-skills": "0.8.1",
|
|
25
25
|
"yaml": "^2.9.0",
|
|
26
26
|
"@runtypelabs/ink-components": "0.3.4",
|
|
27
|
-
"@runtypelabs/sdk": "5.
|
|
27
|
+
"@runtypelabs/sdk": "5.5.0",
|
|
28
28
|
"@runtypelabs/terminal-animations": "0.2.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"tsx": "^4.7.1",
|
|
40
40
|
"typescript": "^6.0.3",
|
|
41
41
|
"vitest": "^4.1.0",
|
|
42
|
-
"@runtypelabs/shared": "1.42.
|
|
42
|
+
"@runtypelabs/shared": "1.42.5"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
45
|
"node": ">=22.0.0"
|