@getmagical/cli 0.9.0 → 0.9.2
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 +25 -0
- package/dist/index.js +133 -45
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,6 +28,31 @@ mgcl automations run-draft --draft-automation-id ... --agent-id ... --idempotenc
|
|
|
28
28
|
mgcl automations publish --draft-automation-id ... # non-production only: mgcl refuses against the production API, and the API rejects it too
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
+
## Regression tests
|
|
32
|
+
|
|
33
|
+
Choose how many historical baseline runs to test per pathway:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
mgcl regression run \
|
|
37
|
+
--automation-version <automation-version-id> \
|
|
38
|
+
--agent-version <agent-version-id> \
|
|
39
|
+
--runs-per-path 5 \
|
|
40
|
+
--json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--runs-per-path` accepts integers from 1 to 20 and defaults to 2. This is an
|
|
44
|
+
upper limit: pathways with fewer eligible historical runs use the available
|
|
45
|
+
runs. Each selected baseline gets 30 replay attempts by default, so five
|
|
46
|
+
baselines produce up to 150 attempts per pathway.
|
|
47
|
+
|
|
48
|
+
The count applies only when creating a regression test. Repeating the command
|
|
49
|
+
for the same automation and agent version pair returns the existing test;
|
|
50
|
+
changing the count does not expand or rerun it.
|
|
51
|
+
|
|
52
|
+
`mgcl pathway-regression preview --runs-per-path <count>` remains a historical
|
|
53
|
+
coverage lookup, accepting 1–50 with a default of 2. It does not configure a
|
|
54
|
+
later regression test.
|
|
55
|
+
|
|
31
56
|
## Typed classification
|
|
32
57
|
|
|
33
58
|
Use `mgcl classify` for focused typed judgments over context you already have.
|
package/dist/index.js
CHANGED
|
@@ -7889,6 +7889,53 @@ function safeJsonParseWithoutLogging(json) {
|
|
|
7889
7889
|
}
|
|
7890
7890
|
}
|
|
7891
7891
|
|
|
7892
|
+
// ../common/dist/src/constants/agent-node-presets.js
|
|
7893
|
+
var AGENT_NODE_PRESET_TYPES = {
|
|
7894
|
+
minimal: "minimal",
|
|
7895
|
+
browser: "browser",
|
|
7896
|
+
desktop: "desktop",
|
|
7897
|
+
voice: "voice"
|
|
7898
|
+
};
|
|
7899
|
+
var agentNodePresetOrder = [
|
|
7900
|
+
AGENT_NODE_PRESET_TYPES.minimal,
|
|
7901
|
+
AGENT_NODE_PRESET_TYPES.browser,
|
|
7902
|
+
AGENT_NODE_PRESET_TYPES.desktop,
|
|
7903
|
+
AGENT_NODE_PRESET_TYPES.voice
|
|
7904
|
+
];
|
|
7905
|
+
var presetToEnvironmentMap = {
|
|
7906
|
+
[AGENT_NODE_PRESET_TYPES.minimal]: ["minimal"],
|
|
7907
|
+
[AGENT_NODE_PRESET_TYPES.browser]: ["browser", "browserCoordinates"],
|
|
7908
|
+
[AGENT_NODE_PRESET_TYPES.desktop]: ["desktop", "desktopApp"],
|
|
7909
|
+
[AGENT_NODE_PRESET_TYPES.voice]: ["voice"]
|
|
7910
|
+
};
|
|
7911
|
+
var environmentToPresetMap = {
|
|
7912
|
+
minimal: AGENT_NODE_PRESET_TYPES.minimal,
|
|
7913
|
+
browser: AGENT_NODE_PRESET_TYPES.browser,
|
|
7914
|
+
browserCoordinates: AGENT_NODE_PRESET_TYPES.browser,
|
|
7915
|
+
desktop: AGENT_NODE_PRESET_TYPES.desktop,
|
|
7916
|
+
desktopApp: AGENT_NODE_PRESET_TYPES.desktop,
|
|
7917
|
+
voice: AGENT_NODE_PRESET_TYPES.voice
|
|
7918
|
+
};
|
|
7919
|
+
|
|
7920
|
+
// ../common/dist/src/constants/agents.js
|
|
7921
|
+
var defaultAgentNamesByType = {
|
|
7922
|
+
trigger: "Trigger Agent",
|
|
7923
|
+
worker: "Worker Agent",
|
|
7924
|
+
specialist: "Specialist Agent",
|
|
7925
|
+
asset: "Library Asset",
|
|
7926
|
+
code: "Code Agent",
|
|
7927
|
+
extract: "Extract Agent",
|
|
7928
|
+
branch: "Decision Agent",
|
|
7929
|
+
api: "API Agent",
|
|
7930
|
+
specialized: "Specialized Agent",
|
|
7931
|
+
[AGENT_NODE_PRESET_TYPES.minimal]: "Orchestrate Agent",
|
|
7932
|
+
[AGENT_NODE_PRESET_TYPES.browser]: "Browser Agent",
|
|
7933
|
+
[AGENT_NODE_PRESET_TYPES.desktop]: "Desktop Agent",
|
|
7934
|
+
[AGENT_NODE_PRESET_TYPES.voice]: "Voice Agent"
|
|
7935
|
+
};
|
|
7936
|
+
var PATHWAY_REGRESSION_RUNS_PER_PATH_DEFAULT = 2;
|
|
7937
|
+
var PATHWAY_REGRESSION_MAX_RUNS_PER_PATH = 20;
|
|
7938
|
+
|
|
7892
7939
|
// ../common/dist/src/constants/automation.js
|
|
7893
7940
|
var AUTOMATION_BRANCH_NAME_MAX_LENGTH = 100;
|
|
7894
7941
|
var AUTOMATION_BRANCH_NAME_MAX_LENGTH_MESSAGE = `Branch name must be ${AUTOMATION_BRANCH_NAME_MAX_LENGTH} characters or fewer.`;
|
|
@@ -13232,7 +13279,7 @@ var magicalBaseModels = [
|
|
|
13232
13279
|
];
|
|
13233
13280
|
var DEFAULT_MODEL = "gemini-2.5-flash";
|
|
13234
13281
|
var modelOptionsSchema = z11.object({
|
|
13235
|
-
reasoningEffort: z11.enum(["low", "medium", "high"]).optional().describe("Reasoning effort level for models that support it
|
|
13282
|
+
reasoningEffort: z11.enum(["low", "medium", "high", "xhigh", "max"]).optional().describe("Reasoning effort level for models that support it. Higher effort may produce better results but takes longer. The xhigh and max levels are available on supported OpenAI models."),
|
|
13236
13283
|
temperature: z11.number().min(0).max(2).optional().describe("Controls randomness in model output. 0 is deterministic, higher values (up to 2) increase creativity and randomness."),
|
|
13237
13284
|
timeoutMs: z11.number().int().min(1).optional().describe("Maximum time to wait for an LLM provider request before failing through the normal result path.")
|
|
13238
13285
|
});
|
|
@@ -14066,6 +14113,15 @@ var baseToolDeclarations = {
|
|
|
14066
14113
|
...reportStopDataSchema.shape
|
|
14067
14114
|
})
|
|
14068
14115
|
},
|
|
14116
|
+
handOff: {
|
|
14117
|
+
id: "handOff",
|
|
14118
|
+
description: "Hand off this work item to another root agent of the same automation and end this run.",
|
|
14119
|
+
parameters: z16.object({
|
|
14120
|
+
[COMMON_PARAMETERS_KEY]: DEFAULT_COMMON_PARAMETERS,
|
|
14121
|
+
agentId: z16.string(),
|
|
14122
|
+
input: z16.record(z16.string(), z16.unknown()).optional()
|
|
14123
|
+
})
|
|
14124
|
+
},
|
|
14069
14125
|
terminateRun: {
|
|
14070
14126
|
id: "terminateRun",
|
|
14071
14127
|
description: "End the whole run early using a configured termination code. This stops every agent in the run, not just the current one, and marks the run as early-terminated.",
|
|
@@ -15256,6 +15312,7 @@ var baseAgentConfigFieldsSchema = z25.object({
|
|
|
15256
15312
|
taskQueue: z25.string().optional().describe("Temporal task queue name for this agent. If specified, queued child agents run on this queue instead of the parent queue."),
|
|
15257
15313
|
waitUponQueueing: z25.boolean().optional().default(false).describe("If true, wait for queued child agents to complete before proceeding."),
|
|
15258
15314
|
queueableAgentIds: z25.array(brandedStringValidator("agentId")).optional().default(() => []).describe("List of agent IDs that this agent can queue using the queueAgents tool. Enables the agent to run a new automation with a different agent as the starting point."),
|
|
15315
|
+
handOffAgentIds: z25.array(brandedStringValidator("agentId")).optional().describe("Other root agents in this automation that can receive this agent\u2019s work item through handOff. Requires root agent handoff to be enabled; targets always use the latest version."),
|
|
15259
15316
|
callableAgentIds: z25.array(brandedStringValidator("agentId")).optional().describe("List of external root agent IDs that this agent can call using the callSpecializedAgent tool. Same-automation callable agents continue to be configured by graph connections."),
|
|
15260
15317
|
queuedAgentVariables: z25.record(brandedStringValidator("agentId"), z25.record(z25.string(), z25.unknown())).optional().describe("Static automation variable values to pass when this agent queues another automation by target agent ID."),
|
|
15261
15318
|
checkpoint: z25.object({
|
|
@@ -15266,7 +15323,7 @@ var baseAgentConfigFieldsSchema = z25.object({
|
|
|
15266
15323
|
additionalSystemPrompt: z25.string().optional().describe("Additional instructions appended to the system prompt for this agent. Combined with automation-level additionalSystemPrompt."),
|
|
15267
15324
|
// Backlinking metadata for imported agents
|
|
15268
15325
|
importedFrom: z25.object({
|
|
15269
|
-
automationId: brandedStringValidator("
|
|
15326
|
+
automationId: brandedStringValidator("automationId").describe("ID of the source automation from which this agent was imported."),
|
|
15270
15327
|
originalAgentId: brandedStringValidator("agentId").describe("Original agent ID in the source automation.")
|
|
15271
15328
|
}).optional().describe("Metadata for agents imported from another automation. Used for traceability and updates."),
|
|
15272
15329
|
ignoreUnstableSessionState: z25.boolean().optional().describe("When true, skips screenshot consistency checks before tool execution. Overrides the automation-level ignoreUnstableSessionState setting."),
|
|
@@ -15340,10 +15397,11 @@ var OutcomePayloadSchema = z25.object({
|
|
|
15340
15397
|
input: z25.record(z25.string(), z25.unknown()).describe("Input data for the outcome. Maps parameter keys to values."),
|
|
15341
15398
|
preview: z25.string().describe("Rendered text representation of the outcome.")
|
|
15342
15399
|
});
|
|
15400
|
+
var decisionIncludeScreenshotDescription = "Requires screenshot context from the calling agent. Every way this Decision can be invoked must provide one.";
|
|
15343
15401
|
var branchAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
|
|
15344
15402
|
type: z25.literal("branch").describe("Decision agent type - makes decisions to route to different agents."),
|
|
15345
15403
|
model: agentModelConfigSchema.describe("LLM model configuration for this decision agent."),
|
|
15346
|
-
includeScreenshot: z25.boolean().optional().describe(
|
|
15404
|
+
includeScreenshot: z25.boolean().optional().describe(decisionIncludeScreenshotDescription),
|
|
15347
15405
|
conditionsAndOutcomes: z25.object({
|
|
15348
15406
|
if: z25.array(z25.object({
|
|
15349
15407
|
caseName: z25.string().describe("Name of the condition case."),
|
|
@@ -15356,7 +15414,7 @@ var branchAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
|
|
|
15356
15414
|
var draftBranchAgentConfigSchema = baseAgentConfigFieldsSchema.safeExtend({
|
|
15357
15415
|
type: z25.literal("branch").describe("Decision agent draft configuration. Allows incomplete conditions and outcomes while the agent is still being authored."),
|
|
15358
15416
|
model: agentModelConfigSchema.describe("LLM model configuration for this decision agent."),
|
|
15359
|
-
includeScreenshot: z25.boolean().optional().describe(
|
|
15417
|
+
includeScreenshot: z25.boolean().optional().describe(decisionIncludeScreenshotDescription),
|
|
15360
15418
|
conditionsAndOutcomes: z25.object({
|
|
15361
15419
|
if: z25.array(z25.object({
|
|
15362
15420
|
caseName: z25.string().describe("Name of the condition case."),
|
|
@@ -15581,6 +15639,7 @@ var automationRunSlaSchema = z27.object({
|
|
|
15581
15639
|
type: automationRunSlaTypeSchema.optional().default("all").describe("SLA policy type that applies to this automation run.")
|
|
15582
15640
|
}).superRefine(refineAutomationRunSlaTimestampOrder).describe("Optional service-level timing metadata for queueing and runtime consumers of this automation run.");
|
|
15583
15641
|
var automationRunConfigBaseSchema = z27.object({
|
|
15642
|
+
branchId: z27.uuid().nullable().default(null).describe("Infrastructure-owned originating draft branch ID. Null and omitted legacy values identify main. Branch identity remains fixed for the lifetime of the run."),
|
|
15584
15643
|
approvalMode: z27.enum(["HUMAN_APPROVAL", "OFF"]).default("OFF"),
|
|
15585
15644
|
consistencyCheckCount: z27.number().int().nonnegative().max(CONSISTENCY_CHECK_COUNT_MAX).nullable().default(null),
|
|
15586
15645
|
settingsSourceAgentId: z27.uuid().nullable().optional().describe("Optional provenance/debug field recording which top-level agent supplied canonical run settings when the run started. Runtime consumers must not use this as a live pointer once resolvedRunSettingsSource has been decided."),
|
|
@@ -15588,6 +15647,13 @@ var automationRunConfigBaseSchema = z27.object({
|
|
|
15588
15647
|
captureActions: z27.boolean().default(false).describe("When true, attach an action recording while a draft run is paused in takeover mode."),
|
|
15589
15648
|
runDraftQueuedAgents: z27.boolean().optional().describe("Draft-run-only option. When false, queue-agent actions in the draft run report success without starting downstream queued draft child runs. Omit or true preserves queueing."),
|
|
15590
15649
|
allowPointOfNoReturnOverride: z27.boolean().optional().describe("Internal rerun authorization. When true, the rerun and its queued descendants may proceed past a point-of-no-return crossing owned by an earlier run."),
|
|
15650
|
+
rootAgentHandoffEnabled: z27.literal(true).optional().describe("Infrastructure-owned capability captured when a work-item-backed run is created. Only these runs can hand off to another root agent."),
|
|
15651
|
+
rootAgentHandoff: z27.object({
|
|
15652
|
+
automationBranchId: z27.uuid().optional().describe("Draft branch captured at run creation. Draft handoffs resolve the current head of this branch."),
|
|
15653
|
+
sourceAutomationRunId: z27.uuid().optional().describe("Predecessor run for an admitted handoff. This run executes the latest version resolved at admission."),
|
|
15654
|
+
successorAutomationRunId: z27.uuid().optional().describe("Accepted handoff receipt. The source can no longer mutate the shared Store once this is recorded."),
|
|
15655
|
+
stopRequestedAt: z27.iso.datetime().optional().describe("Time a stop request was recorded, preventing subsequent handoff admission.")
|
|
15656
|
+
}).optional().describe("Infrastructure-owned durable handoff receipt and stop-intent fence. Updated only while holding the source run lock."),
|
|
15591
15657
|
pointOfNoReturnGateEnabled: z27.literal(true).optional().describe("Infrastructure-owned rollout marker. PONR is enforced only for run trees created after the gate rollout."),
|
|
15592
15658
|
sla: automationRunSlaSchema.optional(),
|
|
15593
15659
|
networkTrafficCapture: networkTrafficCaptureSchema.optional(),
|
|
@@ -15613,6 +15679,7 @@ var automationRunConfigSchema = automationRunConfigBaseSchema.superRefine((confi
|
|
|
15613
15679
|
var automationRunStartConfigSchema = automationRunConfigBaseSchema.omit({
|
|
15614
15680
|
allowPointOfNoReturnOverride: true,
|
|
15615
15681
|
automationVersionPinned: true,
|
|
15682
|
+
branchId: true,
|
|
15616
15683
|
credentialVariableResourcePools: true,
|
|
15617
15684
|
implicitNetworkTrafficRecordingDecision: true,
|
|
15618
15685
|
networkTrafficCapture: true,
|
|
@@ -15620,7 +15687,9 @@ var automationRunStartConfigSchema = automationRunConfigBaseSchema.omit({
|
|
|
15620
15687
|
queueResourcePools: true,
|
|
15621
15688
|
resolvedRunSettings: true,
|
|
15622
15689
|
resolvedRunSettingsSource: true,
|
|
15623
|
-
pointOfNoReturnGateEnabled: true
|
|
15690
|
+
pointOfNoReturnGateEnabled: true,
|
|
15691
|
+
rootAgentHandoffEnabled: true,
|
|
15692
|
+
rootAgentHandoff: true
|
|
15624
15693
|
}).extend({
|
|
15625
15694
|
networkTrafficCapture: networkTrafficCaptureSchema.nullable().optional().describe("Network traffic capture preference for this run. Omit to apply the implicit recording policy, pass null to explicitly disable capture, or pass a record/replay config to explicitly enable capture.")
|
|
15626
15695
|
});
|
|
@@ -20076,7 +20145,7 @@ mutation ApplyAutomationPatch(
|
|
|
20076
20145
|
branchContext: "optional",
|
|
20077
20146
|
name: "update-automation-by-id",
|
|
20078
20147
|
path: ["automations", "update"],
|
|
20079
|
-
description: "Update an automation. Inspect publishChecks and repair blocking failures before completing the task. Changing agent
|
|
20148
|
+
description: "Update an automation. Inspect publishChecks and repair blocking failures before completing the task. Changing an existing agent's type in place is not supported. To change its type, create a replacement agent, update references to the replacement, and remove the original agent.",
|
|
20080
20149
|
resultKey: "updateAutomation",
|
|
20081
20150
|
options: [
|
|
20082
20151
|
stringOption({
|
|
@@ -20698,7 +20767,7 @@ ${evalRunExportSelection}
|
|
|
20698
20767
|
];
|
|
20699
20768
|
|
|
20700
20769
|
// src/program.ts
|
|
20701
|
-
import { Command as Command6, InvalidArgumentError as
|
|
20770
|
+
import { Command as Command6, InvalidArgumentError as InvalidArgumentError3, Option as Option7 } from "commander";
|
|
20702
20771
|
|
|
20703
20772
|
// src/api.ts
|
|
20704
20773
|
import { randomUUID } from "node:crypto";
|
|
@@ -20894,15 +20963,15 @@ var agentRunPathwaySignatureResponseSchema = z29.union([
|
|
|
20894
20963
|
var pathwayRegressionRunStatusSchema = z29.enum([
|
|
20895
20964
|
"queued",
|
|
20896
20965
|
"running",
|
|
20897
|
-
"
|
|
20898
|
-
"
|
|
20966
|
+
"matched",
|
|
20967
|
+
"deviated",
|
|
20899
20968
|
"inconclusive",
|
|
20900
20969
|
"errored"
|
|
20901
20970
|
]);
|
|
20902
20971
|
var pathwayRegressionReplayIterationStatusSchema = z29.enum([
|
|
20903
20972
|
"running",
|
|
20904
|
-
"
|
|
20905
|
-
"
|
|
20973
|
+
"matched",
|
|
20974
|
+
"deviated",
|
|
20906
20975
|
"inconclusive",
|
|
20907
20976
|
"errored"
|
|
20908
20977
|
]);
|
|
@@ -20940,8 +21009,8 @@ var pathwayRegressionAgentVersionRunPathStatusSchema = z29.enum([
|
|
|
20940
21009
|
var pathwayRegressionAgentVersionRunStatusSchema = z29.enum([
|
|
20941
21010
|
"queued",
|
|
20942
21011
|
"running",
|
|
20943
|
-
"
|
|
20944
|
-
"
|
|
21012
|
+
"matched",
|
|
21013
|
+
"deviated",
|
|
20945
21014
|
"inconclusive",
|
|
20946
21015
|
"errored",
|
|
20947
21016
|
"not_started"
|
|
@@ -21025,10 +21094,10 @@ var pathwayRegressionAgentVersionRunResponseSchema = z29.union([
|
|
|
21025
21094
|
pathwayRegressionAgentVersionRegressionRunResponseSchema
|
|
21026
21095
|
]);
|
|
21027
21096
|
var pathwayRegressionCheckSummarySchema = z29.object({
|
|
21097
|
+
deviated: z29.number(),
|
|
21028
21098
|
errored: z29.number(),
|
|
21029
|
-
failed: z29.number(),
|
|
21030
21099
|
inconclusive: z29.number(),
|
|
21031
|
-
|
|
21100
|
+
matched: z29.number(),
|
|
21032
21101
|
plannedTotal: z29.number(),
|
|
21033
21102
|
total: z29.number()
|
|
21034
21103
|
});
|
|
@@ -21054,7 +21123,7 @@ var pathwayRegressionReplayCheckResultSchema = z29.object({
|
|
|
21054
21123
|
llmRequestId: z29.string().min(1).nullable(),
|
|
21055
21124
|
modelId: z29.string().min(1).nullable(),
|
|
21056
21125
|
outputResult: z29.unknown().nullable(),
|
|
21057
|
-
status: z29.enum(["
|
|
21126
|
+
status: z29.enum(["matched", "deviated", "errored"]),
|
|
21058
21127
|
strictExactMatch: z29.boolean().nullable()
|
|
21059
21128
|
});
|
|
21060
21129
|
var pathwayRegressionReplayIterationCheckResultsResponseSchema = z29.object({
|
|
@@ -21102,16 +21171,16 @@ var regressionTestPathwayStatusSchema = z29.enum([
|
|
|
21102
21171
|
"no_matching_runs",
|
|
21103
21172
|
"queued",
|
|
21104
21173
|
"running",
|
|
21105
|
-
"
|
|
21106
|
-
"
|
|
21174
|
+
"matched",
|
|
21175
|
+
"deviated",
|
|
21107
21176
|
"inconclusive",
|
|
21108
21177
|
"errored"
|
|
21109
21178
|
]);
|
|
21110
21179
|
var regressionTestStatusSchema = z29.enum([
|
|
21111
21180
|
"queued",
|
|
21112
21181
|
"running",
|
|
21113
|
-
"
|
|
21114
|
-
"
|
|
21182
|
+
"matched",
|
|
21183
|
+
"deviated",
|
|
21115
21184
|
"inconclusive",
|
|
21116
21185
|
"errored"
|
|
21117
21186
|
]);
|
|
@@ -21130,9 +21199,9 @@ var regressionTestKickoffResponseSchema = z29.object({
|
|
|
21130
21199
|
status: regressionTestStatusSchema
|
|
21131
21200
|
});
|
|
21132
21201
|
var regressionTestIterationCountsSchema = z29.object({
|
|
21202
|
+
deviated: z29.number(),
|
|
21133
21203
|
errored: z29.number(),
|
|
21134
|
-
|
|
21135
|
-
passed: z29.number(),
|
|
21204
|
+
matched: z29.number(),
|
|
21136
21205
|
total: z29.number()
|
|
21137
21206
|
});
|
|
21138
21207
|
var regressionTestBaselineRunSummarySchema = z29.object({
|
|
@@ -21161,23 +21230,23 @@ var regressionTestBaselineStepSchema = z29.object({
|
|
|
21161
21230
|
id: z29.string().min(1),
|
|
21162
21231
|
iterationIndex: z29.number()
|
|
21163
21232
|
});
|
|
21164
|
-
var
|
|
21233
|
+
var regressionTestDeviatedToolCallSchema = z29.object({
|
|
21165
21234
|
count: z29.number(),
|
|
21166
21235
|
observedToolCall: z29.unknown()
|
|
21167
21236
|
});
|
|
21168
|
-
var
|
|
21237
|
+
var regressionTestDeviatedIterationSchema = z29.object({
|
|
21169
21238
|
baselineIterationId: z29.string().min(1),
|
|
21170
|
-
|
|
21239
|
+
deviatedToolCalls: z29.array(regressionTestDeviatedToolCallSchema)
|
|
21171
21240
|
});
|
|
21172
21241
|
var regressionTestReplayCountsSchema = z29.object({
|
|
21242
|
+
deviated: z29.number(),
|
|
21173
21243
|
errored: z29.number(),
|
|
21174
|
-
|
|
21175
|
-
passed: z29.number()
|
|
21244
|
+
matched: z29.number()
|
|
21176
21245
|
});
|
|
21177
21246
|
var regressionTestBaselineRunSchema = z29.object({
|
|
21178
21247
|
baselineAgentRunId: z29.string().min(1),
|
|
21179
21248
|
baselineIterations: z29.array(regressionTestBaselineStepSchema),
|
|
21180
|
-
|
|
21249
|
+
deviatedIterations: z29.array(regressionTestDeviatedIterationSchema),
|
|
21181
21250
|
replayCounts: regressionTestReplayCountsSchema
|
|
21182
21251
|
});
|
|
21183
21252
|
var regressionTestPathwayDetailSchema = z29.object({
|
|
@@ -22143,8 +22212,12 @@ function createMagicalApiClient({
|
|
|
22143
22212
|
agentVersionId,
|
|
22144
22213
|
automationVersionId,
|
|
22145
22214
|
impersonatedOrganizationId,
|
|
22146
|
-
organizationId
|
|
22215
|
+
organizationId,
|
|
22216
|
+
runsPerPath
|
|
22147
22217
|
}) {
|
|
22218
|
+
const query = new URLSearchParams(
|
|
22219
|
+
runsPerPath === void 0 ? {} : { runsPerPath: String(runsPerPath) }
|
|
22220
|
+
);
|
|
22148
22221
|
const parsedResponse = regressionTestKickoffResponseSchema.safeParse(
|
|
22149
22222
|
await fetchJson({
|
|
22150
22223
|
accessToken,
|
|
@@ -22153,7 +22226,7 @@ function createMagicalApiClient({
|
|
|
22153
22226
|
...organizationId ? { organizationId } : {},
|
|
22154
22227
|
path: `/pathway-regression/tests/automation-versions/${encodeURIComponent(
|
|
22155
22228
|
automationVersionId
|
|
22156
|
-
)}/agent-versions/${encodeURIComponent(agentVersionId)}/run`,
|
|
22229
|
+
)}/agent-versions/${encodeURIComponent(agentVersionId)}/run${query.size > 0 ? `?${query.toString()}` : ""}`,
|
|
22157
22230
|
init: {
|
|
22158
22231
|
method: "POST"
|
|
22159
22232
|
}
|
|
@@ -27941,14 +28014,14 @@ async function prepareFileUpload(inputPath, workingDirectory) {
|
|
|
27941
28014
|
);
|
|
27942
28015
|
}
|
|
27943
28016
|
const checksum = await (async () => {
|
|
27944
|
-
let value = 0;
|
|
28017
|
+
let value = void 0;
|
|
27945
28018
|
for await (const chunk of createReadStream2(filePath)) {
|
|
27946
28019
|
if (!(chunk instanceof Uint8Array)) {
|
|
27947
28020
|
throw new CliError("Upload file stream returned invalid bytes.");
|
|
27948
28021
|
}
|
|
27949
28022
|
value = updateS3Crc32Checksum(chunk, value);
|
|
27950
28023
|
}
|
|
27951
|
-
return value;
|
|
28024
|
+
return value ?? updateS3Crc32Checksum(new Uint8Array());
|
|
27952
28025
|
})().catch((error) => {
|
|
27953
28026
|
throw new CliError(`Failed to checksum upload file "${filePath}".`, {
|
|
27954
28027
|
cause: error
|
|
@@ -28975,10 +29048,10 @@ var SESSION_ONLY_API_KEY_MANAGEMENT_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
28975
29048
|
|
|
28976
29049
|
// src/regression-commands.ts
|
|
28977
29050
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
28978
|
-
import { Command as Command4, Option as Option4 } from "commander";
|
|
29051
|
+
import { Command as Command4, InvalidArgumentError as InvalidArgumentError2, Option as Option4 } from "commander";
|
|
28979
29052
|
var REGRESSION_TEST_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
28980
|
-
"
|
|
28981
|
-
"
|
|
29053
|
+
"matched",
|
|
29054
|
+
"deviated",
|
|
28982
29055
|
"inconclusive",
|
|
28983
29056
|
"errored"
|
|
28984
29057
|
]);
|
|
@@ -29024,11 +29097,11 @@ function summarizeRegressionTestPathway(result) {
|
|
|
29024
29097
|
baselineAgentRunId: run.baselineAgentRunId,
|
|
29025
29098
|
replayCounts: run.replayCounts,
|
|
29026
29099
|
baselineIterationCount: run.baselineIterations.length,
|
|
29027
|
-
|
|
29028
|
-
baselineIterationId:
|
|
29029
|
-
|
|
29030
|
-
observedToolCall:
|
|
29031
|
-
count:
|
|
29100
|
+
deviatedIterations: run.deviatedIterations.map((iteration) => ({
|
|
29101
|
+
baselineIterationId: iteration.baselineIterationId,
|
|
29102
|
+
deviatedToolCalls: iteration.deviatedToolCalls.map((toolCall) => ({
|
|
29103
|
+
observedToolCall: toolCall.observedToolCall,
|
|
29104
|
+
count: toolCall.count
|
|
29032
29105
|
}))
|
|
29033
29106
|
}))
|
|
29034
29107
|
}))
|
|
@@ -29102,7 +29175,8 @@ async function handleRegressionRunCommand({
|
|
|
29102
29175
|
input: {
|
|
29103
29176
|
...authParams,
|
|
29104
29177
|
agentVersionId: options.agentVersion,
|
|
29105
|
-
automationVersionId: options.automationVersion
|
|
29178
|
+
automationVersionId: options.automationVersion,
|
|
29179
|
+
...options.runsPerPath === void 0 ? {} : { runsPerPath: options.runsPerPath }
|
|
29106
29180
|
},
|
|
29107
29181
|
startRegressionTest: startAgentVersionRegressionTest
|
|
29108
29182
|
});
|
|
@@ -29189,6 +29263,7 @@ function addRegressionCommands({
|
|
|
29189
29263
|
`
|
|
29190
29264
|
${formatExamples("Examples", [
|
|
29191
29265
|
"mgcl regression run --automation-version <id> --agent-version <id>",
|
|
29266
|
+
"mgcl regression run --automation-version <id> --agent-version <id> --runs-per-path 5",
|
|
29192
29267
|
"mgcl regression show <testId>",
|
|
29193
29268
|
"mgcl regression show <testId> --pathway <pathwayId>"
|
|
29194
29269
|
])}`
|
|
@@ -29207,6 +29282,19 @@ ${formatExamples("Examples", [
|
|
|
29207
29282
|
).helpGroup("Regression options:").makeOptionMandatory(true)
|
|
29208
29283
|
).addOption(
|
|
29209
29284
|
new Option4("--agent-version <id>", "Agent version to test.").helpGroup("Regression options:").makeOptionMandatory(true)
|
|
29285
|
+
).addOption(
|
|
29286
|
+
new Option4(
|
|
29287
|
+
"--runs-per-path <count>",
|
|
29288
|
+
`Maximum historical baseline runs per pathway (1\u2013${PATHWAY_REGRESSION_MAX_RUNS_PER_PATH}; default: ${PATHWAY_REGRESSION_RUNS_PER_PATH_DEFAULT}). Applies only to new tests; existing tests are reused unchanged.`
|
|
29289
|
+
).helpGroup("Regression options:").argParser((rawValue) => {
|
|
29290
|
+
const count = Number(rawValue);
|
|
29291
|
+
if (!Number.isInteger(count) || count < 1 || count > PATHWAY_REGRESSION_MAX_RUNS_PER_PATH) {
|
|
29292
|
+
throw new InvalidArgumentError2(
|
|
29293
|
+
`Expected an integer from 1 to ${PATHWAY_REGRESSION_MAX_RUNS_PER_PATH}.`
|
|
29294
|
+
);
|
|
29295
|
+
}
|
|
29296
|
+
return count;
|
|
29297
|
+
})
|
|
29210
29298
|
).action(async function() {
|
|
29211
29299
|
await handleRegressionRunCommand({
|
|
29212
29300
|
dependencies,
|
|
@@ -31051,7 +31139,7 @@ function parseCommandOptionValue(rawValue, optionSpec) {
|
|
|
31051
31139
|
case "number": {
|
|
31052
31140
|
const parsedNumber = Number(rawValue);
|
|
31053
31141
|
if (Number.isNaN(parsedNumber)) {
|
|
31054
|
-
throw new
|
|
31142
|
+
throw new InvalidArgumentError3(
|
|
31055
31143
|
`Expected a number for --${optionSpec.flagName}.`
|
|
31056
31144
|
);
|
|
31057
31145
|
}
|
|
@@ -31063,7 +31151,7 @@ function parseCommandOptionValue(rawValue, optionSpec) {
|
|
|
31063
31151
|
case "json": {
|
|
31064
31152
|
const parsedJson = safeJsonParse(rawValue);
|
|
31065
31153
|
if (isErr(parsedJson)) {
|
|
31066
|
-
throw new
|
|
31154
|
+
throw new InvalidArgumentError3(
|
|
31067
31155
|
`Expected valid JSON for --${optionSpec.flagName}.`
|
|
31068
31156
|
);
|
|
31069
31157
|
}
|
|
@@ -31096,7 +31184,7 @@ function createCliCommanderOption(optionSpec, helpGroup) {
|
|
|
31096
31184
|
function parsePositiveIntegerOption(rawValue) {
|
|
31097
31185
|
const parsedValue = Number(rawValue);
|
|
31098
31186
|
if (!Number.isInteger(parsedValue) || parsedValue < 1) {
|
|
31099
|
-
throw new
|
|
31187
|
+
throw new InvalidArgumentError3("Expected a positive integer.");
|
|
31100
31188
|
}
|
|
31101
31189
|
return parsedValue;
|
|
31102
31190
|
}
|
|
@@ -31712,7 +31800,7 @@ function summarizePathwayRegressionResult(result) {
|
|
|
31712
31800
|
baselineAutomationRunId: replay.baselineAutomationRunId,
|
|
31713
31801
|
status: replay.status,
|
|
31714
31802
|
checks: replay.checks,
|
|
31715
|
-
|
|
31803
|
+
nonMatchingIterations: replay.iterations.filter((iteration) => iteration.status !== "matched").map((iteration) => ({
|
|
31716
31804
|
regressionReplayIterationId: iteration.id,
|
|
31717
31805
|
sequence: iteration.sequence,
|
|
31718
31806
|
status: iteration.status,
|