voratiq 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/auth/providers/claude/constants.d.ts +7 -0
- package/dist/auth/providers/claude/constants.js +9 -0
- package/dist/auth/providers/claude/credentials.d.ts +5 -0
- package/dist/auth/providers/claude/credentials.js +112 -0
- package/dist/auth/providers/claude/error.d.ts +5 -0
- package/dist/auth/providers/claude/error.js +6 -0
- package/dist/auth/providers/claude/keychain.d.ts +4 -0
- package/dist/auth/providers/claude/keychain.js +158 -0
- package/dist/auth/providers/claude.d.ts +2 -0
- package/dist/auth/providers/claude.js +124 -0
- package/dist/auth/providers/codex.d.ts +2 -0
- package/dist/auth/providers/codex.js +93 -0
- package/dist/auth/providers/gemini.d.ts +2 -0
- package/dist/auth/providers/gemini.js +159 -0
- package/dist/auth/providers/index.d.ts +2 -0
- package/dist/auth/providers/index.js +16 -0
- package/dist/auth/providers/messages.d.ts +1 -0
- package/dist/auth/providers/messages.js +3 -0
- package/dist/auth/providers/secret-staging.d.ts +14 -0
- package/dist/auth/providers/secret-staging.js +72 -0
- package/dist/auth/providers/teardown.d.ts +2 -0
- package/dist/auth/providers/teardown.js +6 -0
- package/dist/auth/providers/types.d.ts +31 -0
- package/dist/auth/providers/types.js +1 -0
- package/dist/auth/providers/utils.d.ts +20 -0
- package/dist/auth/providers/utils.js +148 -0
- package/dist/auth/runtime.d.ts +2 -0
- package/dist/auth/runtime.js +17 -0
- package/dist/auth/staging.d.ts +8 -0
- package/dist/auth/staging.js +7 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +142 -0
- package/dist/cli/apply.d.ts +14 -0
- package/dist/cli/apply.js +38 -0
- package/dist/cli/commander-utils.d.ts +3 -0
- package/dist/cli/commander-utils.js +27 -0
- package/dist/cli/confirmation.d.ts +14 -0
- package/dist/cli/confirmation.js +16 -0
- package/dist/cli/errors.d.ts +5 -0
- package/dist/cli/errors.js +16 -0
- package/dist/cli/init.d.ts +10 -0
- package/dist/cli/init.js +41 -0
- package/dist/cli/list.d.ts +14 -0
- package/dist/cli/list.js +48 -0
- package/dist/cli/output.d.ts +14 -0
- package/dist/cli/output.js +62 -0
- package/dist/cli/prune.d.ts +14 -0
- package/dist/cli/prune.js +54 -0
- package/dist/cli/review.d.ts +12 -0
- package/dist/cli/review.js +33 -0
- package/dist/cli/run.d.ts +13 -0
- package/dist/cli/run.js +51 -0
- package/dist/commands/apply/command.d.ts +9 -0
- package/dist/commands/apply/command.js +135 -0
- package/dist/commands/apply/errors.d.ts +35 -0
- package/dist/commands/apply/errors.js +73 -0
- package/dist/commands/apply/types.d.ts +13 -0
- package/dist/commands/apply/types.js +1 -0
- package/dist/commands/errors.d.ts +4 -0
- package/dist/commands/errors.js +7 -0
- package/dist/commands/fetch.d.ts +8 -0
- package/dist/commands/fetch.js +25 -0
- package/dist/commands/init/agents.d.ts +3 -0
- package/dist/commands/init/agents.js +159 -0
- package/dist/commands/init/command.d.ts +2 -0
- package/dist/commands/init/command.js +40 -0
- package/dist/commands/init/environment.d.ts +2 -0
- package/dist/commands/init/environment.js +76 -0
- package/dist/commands/init/evals.d.ts +4 -0
- package/dist/commands/init/evals.js +219 -0
- package/dist/commands/init/types.d.ts +48 -0
- package/dist/commands/init/types.js +1 -0
- package/dist/commands/list/command.d.ts +13 -0
- package/dist/commands/list/command.js +60 -0
- package/dist/commands/prune/command.d.ts +2 -0
- package/dist/commands/prune/command.js +336 -0
- package/dist/commands/prune/errors.d.ts +20 -0
- package/dist/commands/prune/errors.js +39 -0
- package/dist/commands/prune/types.d.ts +42 -0
- package/dist/commands/prune/types.js +1 -0
- package/dist/commands/review/command.d.ts +10 -0
- package/dist/commands/review/command.js +26 -0
- package/dist/commands/run/agent-execution.d.ts +19 -0
- package/dist/commands/run/agent-execution.js +63 -0
- package/dist/commands/run/agents/auth-stage.d.ts +23 -0
- package/dist/commands/run/agents/auth-stage.js +108 -0
- package/dist/commands/run/agents/chat-preserver.d.ts +9 -0
- package/dist/commands/run/agents/chat-preserver.js +35 -0
- package/dist/commands/run/agents/eval-runner.d.ts +19 -0
- package/dist/commands/run/agents/eval-runner.js +27 -0
- package/dist/commands/run/agents/failures.d.ts +7 -0
- package/dist/commands/run/agents/failures.js +32 -0
- package/dist/commands/run/agents/lifecycle.d.ts +9 -0
- package/dist/commands/run/agents/lifecycle.js +157 -0
- package/dist/commands/run/agents/preparation.d.ts +2 -0
- package/dist/commands/run/agents/preparation.js +123 -0
- package/dist/commands/run/agents/run-context.d.ts +46 -0
- package/dist/commands/run/agents/run-context.js +193 -0
- package/dist/commands/run/agents/sandbox-launcher.d.ts +44 -0
- package/dist/commands/run/agents/sandbox-launcher.js +211 -0
- package/dist/commands/run/agents/types.d.ts +47 -0
- package/dist/commands/run/agents/types.js +1 -0
- package/dist/commands/run/agents/watchdog.d.ts +39 -0
- package/dist/commands/run/agents/watchdog.js +172 -0
- package/dist/commands/run/agents/workspace-prep.d.ts +17 -0
- package/dist/commands/run/agents/workspace-prep.js +78 -0
- package/dist/commands/run/agents.d.ts +14 -0
- package/dist/commands/run/agents.js +47 -0
- package/dist/commands/run/argv.d.ts +1 -0
- package/dist/commands/run/argv.js +19 -0
- package/dist/commands/run/command.d.ts +14 -0
- package/dist/commands/run/command.js +170 -0
- package/dist/commands/run/errors.d.ts +61 -0
- package/dist/commands/run/errors.js +86 -0
- package/dist/commands/run/id.d.ts +1 -0
- package/dist/commands/run/id.js +22 -0
- package/dist/commands/run/lifecycle.d.ts +19 -0
- package/dist/commands/run/lifecycle.js +186 -0
- package/dist/commands/run/phases.d.ts +11 -0
- package/dist/commands/run/phases.js +1 -0
- package/dist/commands/run/prompts.d.ts +4 -0
- package/dist/commands/run/prompts.js +16 -0
- package/dist/commands/run/record-init.d.ts +15 -0
- package/dist/commands/run/record-init.js +29 -0
- package/dist/commands/run/reports.d.ts +14 -0
- package/dist/commands/run/reports.js +63 -0
- package/dist/commands/run/sandbox-registry.d.ts +4 -0
- package/dist/commands/run/sandbox-registry.js +54 -0
- package/dist/commands/run/sandbox.d.ts +16 -0
- package/dist/commands/run/sandbox.js +96 -0
- package/dist/commands/run/shim/agent-manifest.d.ts +7 -0
- package/dist/commands/run/shim/agent-manifest.js +1 -0
- package/dist/commands/run/shim/run-agent-shim.d.ts +1 -0
- package/dist/commands/run/shim/run-agent-shim.js +232 -0
- package/dist/commands/run/shim/run-agent-shim.mjs +10 -0
- package/dist/commands/run/validation.d.ts +20 -0
- package/dist/commands/run/validation.js +60 -0
- package/dist/configs/agents/defaults.d.ts +9 -0
- package/dist/configs/agents/defaults.js +55 -0
- package/dist/configs/agents/errors.d.ts +40 -0
- package/dist/configs/agents/errors.js +78 -0
- package/dist/configs/agents/loader.d.ts +8 -0
- package/dist/configs/agents/loader.js +137 -0
- package/dist/configs/agents/types.d.ts +39 -0
- package/dist/configs/agents/types.js +31 -0
- package/dist/configs/environment/detect.d.ts +17 -0
- package/dist/configs/environment/detect.js +79 -0
- package/dist/configs/environment/errors.d.ts +12 -0
- package/dist/configs/environment/errors.js +26 -0
- package/dist/configs/environment/loader.d.ts +10 -0
- package/dist/configs/environment/loader.js +80 -0
- package/dist/configs/environment/types.d.ts +21 -0
- package/dist/configs/environment/types.js +98 -0
- package/dist/configs/evals/defaults.d.ts +8 -0
- package/dist/configs/evals/defaults.js +28 -0
- package/dist/configs/evals/detect.d.ts +10 -0
- package/dist/configs/evals/detect.js +224 -0
- package/dist/configs/evals/errors.d.ts +16 -0
- package/dist/configs/evals/errors.js +29 -0
- package/dist/configs/evals/loader.d.ts +9 -0
- package/dist/configs/evals/loader.js +46 -0
- package/dist/configs/evals/types.d.ts +42 -0
- package/dist/configs/evals/types.js +74 -0
- package/dist/configs/sandbox/defaults.d.ts +14 -0
- package/dist/configs/sandbox/defaults.js +54 -0
- package/dist/configs/sandbox/errors.d.ts +5 -0
- package/dist/configs/sandbox/errors.js +8 -0
- package/dist/configs/sandbox/loader.d.ts +6 -0
- package/dist/configs/sandbox/loader.js +192 -0
- package/dist/configs/sandbox/merge.d.ts +9 -0
- package/dist/configs/sandbox/merge.js +94 -0
- package/dist/configs/sandbox/schemas.d.ts +58 -0
- package/dist/configs/sandbox/schemas.js +72 -0
- package/dist/configs/sandbox/types.d.ts +34 -0
- package/dist/configs/sandbox/types.js +1 -0
- package/dist/configs/shared/loader-factory.d.ts +19 -0
- package/dist/configs/shared/loader-factory.js +33 -0
- package/dist/configs/shared/yaml-error-formatter.d.ts +40 -0
- package/dist/configs/shared/yaml-error-formatter.js +41 -0
- package/dist/evals/runner.d.ts +16 -0
- package/dist/evals/runner.js +132 -0
- package/dist/preflight/errors.d.ts +10 -0
- package/dist/preflight/errors.js +21 -0
- package/dist/preflight/index.d.ts +30 -0
- package/dist/preflight/index.js +157 -0
- package/dist/records/enhanced.d.ts +38 -0
- package/dist/records/enhanced.js +139 -0
- package/dist/records/errors.d.ts +23 -0
- package/dist/records/errors.js +43 -0
- package/dist/records/history-lock.d.ts +27 -0
- package/dist/records/history-lock.js +184 -0
- package/dist/records/mutators.d.ts +17 -0
- package/dist/records/mutators.js +144 -0
- package/dist/records/persistence.d.ts +95 -0
- package/dist/records/persistence.js +459 -0
- package/dist/records/types.d.ts +238 -0
- package/dist/records/types.js +131 -0
- package/dist/render/interactions/confirmation.d.ts +19 -0
- package/dist/render/interactions/confirmation.js +63 -0
- package/dist/render/transcripts/apply.d.ts +2 -0
- package/dist/render/transcripts/apply.js +52 -0
- package/dist/render/transcripts/init.d.ts +18 -0
- package/dist/render/transcripts/init.js +84 -0
- package/dist/render/transcripts/list.d.ts +3 -0
- package/dist/render/transcripts/list.js +44 -0
- package/dist/render/transcripts/prune.d.ts +16 -0
- package/dist/render/transcripts/prune.js +50 -0
- package/dist/render/transcripts/review.d.ts +2 -0
- package/dist/render/transcripts/review.js +36 -0
- package/dist/render/transcripts/run.d.ts +25 -0
- package/dist/render/transcripts/run.js +295 -0
- package/dist/render/transcripts/shared.d.ts +12 -0
- package/dist/render/transcripts/shared.js +41 -0
- package/dist/render/utils/agents.d.ts +28 -0
- package/dist/render/utils/agents.js +261 -0
- package/dist/render/utils/badges.d.ts +20 -0
- package/dist/render/utils/badges.js +37 -0
- package/dist/render/utils/errors.d.ts +2 -0
- package/dist/render/utils/errors.js +14 -0
- package/dist/render/utils/records.d.ts +1 -0
- package/dist/render/utils/records.js +32 -0
- package/dist/render/utils/runs.d.ts +16 -0
- package/dist/render/utils/runs.js +50 -0
- package/dist/render/utils/table.d.ts +12 -0
- package/dist/render/utils/table.js +32 -0
- package/dist/render/utils/transcript.d.ts +14 -0
- package/dist/render/utils/transcript.js +44 -0
- package/dist/status/colors.d.ts +10 -0
- package/dist/status/colors.js +33 -0
- package/dist/status/index.d.ts +37 -0
- package/dist/status/index.js +30 -0
- package/dist/testing/test-hooks.d.ts +7 -0
- package/dist/testing/test-hooks.js +16 -0
- package/dist/utils/binaries.d.ts +1 -0
- package/dist/utils/binaries.js +13 -0
- package/dist/utils/cli-root.d.ts +2 -0
- package/dist/utils/cli-root.js +42 -0
- package/dist/utils/colors.d.ts +2 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/diff.d.ts +9 -0
- package/dist/utils/diff.js +61 -0
- package/dist/utils/env.d.ts +10 -0
- package/dist/utils/env.js +56 -0
- package/dist/utils/errors.d.ts +31 -0
- package/dist/utils/errors.js +53 -0
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.js +70 -0
- package/dist/utils/git.d.ts +40 -0
- package/dist/utils/git.js +126 -0
- package/dist/utils/output.d.ts +4 -0
- package/dist/utils/output.js +12 -0
- package/dist/utils/path.d.ts +11 -0
- package/dist/utils/path.js +84 -0
- package/dist/utils/process.d.ts +37 -0
- package/dist/utils/process.js +152 -0
- package/dist/utils/terminal.d.ts +5 -0
- package/dist/utils/terminal.js +5 -0
- package/dist/utils/validators.d.ts +1 -0
- package/dist/utils/validators.js +15 -0
- package/dist/utils/version.d.ts +1 -0
- package/dist/utils/version.js +25 -0
- package/dist/utils/yaml-reader.d.ts +14 -0
- package/dist/utils/yaml-reader.js +41 -0
- package/dist/utils/yaml.d.ts +33 -0
- package/dist/utils/yaml.js +75 -0
- package/dist/workspace/agents.d.ts +33 -0
- package/dist/workspace/agents.js +189 -0
- package/dist/workspace/chat/artifacts.d.ts +14 -0
- package/dist/workspace/chat/artifacts.js +157 -0
- package/dist/workspace/chat/sources.d.ts +5 -0
- package/dist/workspace/chat/sources.js +80 -0
- package/dist/workspace/chat/types.d.ts +1 -0
- package/dist/workspace/chat/types.js +1 -0
- package/dist/workspace/cleanup.d.ts +4 -0
- package/dist/workspace/cleanup.js +12 -0
- package/dist/workspace/credential-guard.d.ts +4 -0
- package/dist/workspace/credential-guard.js +71 -0
- package/dist/workspace/dependencies.d.ts +23 -0
- package/dist/workspace/dependencies.js +190 -0
- package/dist/workspace/errors.d.ts +16 -0
- package/dist/workspace/errors.js +43 -0
- package/dist/workspace/layout.d.ts +30 -0
- package/dist/workspace/layout.js +124 -0
- package/dist/workspace/prune.d.ts +8 -0
- package/dist/workspace/prune.js +29 -0
- package/dist/workspace/run.d.ts +14 -0
- package/dist/workspace/run.js +28 -0
- package/dist/workspace/sandbox-requirements.d.ts +17 -0
- package/dist/workspace/sandbox-requirements.js +69 -0
- package/dist/workspace/setup.d.ts +3 -0
- package/dist/workspace/setup.js +81 -0
- package/dist/workspace/shim.d.ts +4 -0
- package/dist/workspace/shim.js +65 -0
- package/dist/workspace/structure.d.ts +77 -0
- package/dist/workspace/structure.js +134 -0
- package/dist/workspace/templates.d.ts +9 -0
- package/dist/workspace/templates.js +66 -0
- package/dist/workspace/types.d.ts +4 -0
- package/dist/workspace/types.js +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { agentIdSchema } from "../configs/agents/types.js";
|
|
3
|
+
import { evalSlugSchema, evalStatusSchema } from "../configs/evals/types.js";
|
|
4
|
+
import { agentStatusSchema as sharedAgentStatusSchema, applyStatusEnum, runStatusSchema, } from "../status/index.js";
|
|
5
|
+
import { assertRepoRelativePath } from "../utils/path.js";
|
|
6
|
+
function validateRepoRelativePath(value, ctx) {
|
|
7
|
+
try {
|
|
8
|
+
assertRepoRelativePath(value);
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
ctx.addIssue({
|
|
12
|
+
code: z.ZodIssueCode.custom,
|
|
13
|
+
message: error instanceof Error ? error.message : "invalid repo-relative path",
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const repoRelativePathSchema = z
|
|
18
|
+
.string()
|
|
19
|
+
.superRefine((value, ctx) => validateRepoRelativePath(value, ctx));
|
|
20
|
+
export const runSpecDescriptorSchema = z.object({
|
|
21
|
+
path: repoRelativePathSchema,
|
|
22
|
+
});
|
|
23
|
+
export const agentStatusSchema = sharedAgentStatusSchema;
|
|
24
|
+
export const TERMINAL_AGENT_STATUSES = [
|
|
25
|
+
"succeeded",
|
|
26
|
+
"failed",
|
|
27
|
+
"errored",
|
|
28
|
+
"skipped",
|
|
29
|
+
"aborted",
|
|
30
|
+
];
|
|
31
|
+
export const EVAL_REQUIRED_AGENT_STATUSES = [
|
|
32
|
+
"succeeded",
|
|
33
|
+
"failed",
|
|
34
|
+
"errored",
|
|
35
|
+
"skipped",
|
|
36
|
+
];
|
|
37
|
+
export const IN_PROGRESS_AGENT_STATUSES = [
|
|
38
|
+
"queued",
|
|
39
|
+
"running",
|
|
40
|
+
];
|
|
41
|
+
const CHAT_ARTIFACT_FORMATS = [
|
|
42
|
+
"json",
|
|
43
|
+
"jsonl",
|
|
44
|
+
];
|
|
45
|
+
const WATCHDOG_TRIGGERS = ["silence", "wall-clock", "fatal-pattern"];
|
|
46
|
+
export const watchdogMetadataSchema = z.object({
|
|
47
|
+
/** Silence timeout in milliseconds that was enforced. */
|
|
48
|
+
silenceTimeoutMs: z.number(),
|
|
49
|
+
/** Wall-clock cap in milliseconds that was enforced. */
|
|
50
|
+
wallClockCapMs: z.number(),
|
|
51
|
+
/** Which watchdog trigger caused termination, if any. */
|
|
52
|
+
trigger: z.enum(WATCHDOG_TRIGGERS).optional(),
|
|
53
|
+
});
|
|
54
|
+
export const agentArtifactStateSchema = z.object({
|
|
55
|
+
diffAttempted: z.boolean().optional(),
|
|
56
|
+
diffCaptured: z.boolean().optional(),
|
|
57
|
+
stdoutCaptured: z.boolean().optional(),
|
|
58
|
+
stderrCaptured: z.boolean().optional(),
|
|
59
|
+
summaryCaptured: z.boolean().optional(),
|
|
60
|
+
chatCaptured: z.boolean().optional(),
|
|
61
|
+
chatFormat: z.enum(CHAT_ARTIFACT_FORMATS).optional(),
|
|
62
|
+
});
|
|
63
|
+
export const agentEvalSnapshotSchema = z.object({
|
|
64
|
+
slug: evalSlugSchema,
|
|
65
|
+
status: evalStatusSchema,
|
|
66
|
+
exitCode: z.number().nullable().optional(),
|
|
67
|
+
command: z.string().optional(),
|
|
68
|
+
hasLog: z.boolean().optional(),
|
|
69
|
+
error: z.string().optional(),
|
|
70
|
+
});
|
|
71
|
+
export const agentInvocationRecordSchema = z
|
|
72
|
+
.object({
|
|
73
|
+
agentId: agentIdSchema,
|
|
74
|
+
model: z.string(),
|
|
75
|
+
status: agentStatusSchema,
|
|
76
|
+
startedAt: z.string().optional(),
|
|
77
|
+
completedAt: z.string().optional(),
|
|
78
|
+
commitSha: z.string().optional(),
|
|
79
|
+
artifacts: agentArtifactStateSchema.optional(),
|
|
80
|
+
evals: z.array(agentEvalSnapshotSchema).optional(),
|
|
81
|
+
error: z.string().optional(),
|
|
82
|
+
warnings: z.array(z.string()).optional(),
|
|
83
|
+
diffStatistics: z.string().optional(),
|
|
84
|
+
watchdog: watchdogMetadataSchema.optional(),
|
|
85
|
+
})
|
|
86
|
+
.superRefine((data, ctx) => {
|
|
87
|
+
if (IN_PROGRESS_AGENT_STATUSES.includes(data.status)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (TERMINAL_AGENT_STATUSES.includes(data.status)) {
|
|
91
|
+
if (!data.startedAt) {
|
|
92
|
+
ctx.addIssue({
|
|
93
|
+
code: z.ZodIssueCode.custom,
|
|
94
|
+
path: ["startedAt"],
|
|
95
|
+
message: "startedAt is required once the agent completes",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (!data.completedAt) {
|
|
99
|
+
ctx.addIssue({
|
|
100
|
+
code: z.ZodIssueCode.custom,
|
|
101
|
+
path: ["completedAt"],
|
|
102
|
+
message: "completedAt is required once the agent completes",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (EVAL_REQUIRED_AGENT_STATUSES.includes(data.status) && !data.evals) {
|
|
106
|
+
ctx.addIssue({
|
|
107
|
+
code: z.ZodIssueCode.custom,
|
|
108
|
+
path: ["evals"],
|
|
109
|
+
message: "eval results are required once the agent completes",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export const applyStatusSchema = z.object({
|
|
115
|
+
agentId: agentIdSchema,
|
|
116
|
+
status: applyStatusEnum,
|
|
117
|
+
appliedAt: z.string(),
|
|
118
|
+
ignoredBaseMismatch: z.boolean(),
|
|
119
|
+
detail: z.string().max(256).nullable().optional(),
|
|
120
|
+
});
|
|
121
|
+
export const runRecordSchema = z.object({
|
|
122
|
+
runId: z.string(),
|
|
123
|
+
baseRevisionSha: z.string(),
|
|
124
|
+
rootPath: repoRelativePathSchema,
|
|
125
|
+
spec: runSpecDescriptorSchema,
|
|
126
|
+
status: runStatusSchema,
|
|
127
|
+
createdAt: z.string(),
|
|
128
|
+
agents: z.array(agentInvocationRecordSchema),
|
|
129
|
+
applyStatus: applyStatusSchema.optional(),
|
|
130
|
+
deletedAt: z.string().nullable().optional(),
|
|
131
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ConfirmationOptions {
|
|
2
|
+
message: string;
|
|
3
|
+
defaultValue: boolean;
|
|
4
|
+
prefaceLines?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface PromptOptions {
|
|
7
|
+
message: string;
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
prefaceLines?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface ConfirmationInteractor {
|
|
12
|
+
confirm(options: ConfirmationOptions): Promise<boolean>;
|
|
13
|
+
prompt(options: PromptOptions): Promise<string>;
|
|
14
|
+
close(): void;
|
|
15
|
+
}
|
|
16
|
+
export interface ConfirmationInteractorOptions {
|
|
17
|
+
assumeYes?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function createConfirmationInteractor(options?: ConfirmationInteractorOptions): ConfirmationInteractor;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import { createInterface } from "node:readline/promises";
|
|
3
|
+
export function createConfirmationInteractor(options = {}) {
|
|
4
|
+
const { assumeYes = false } = options;
|
|
5
|
+
const readlineInterface = createInterface({
|
|
6
|
+
input: process.stdin,
|
|
7
|
+
output: process.stdout,
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
async confirm(options) {
|
|
11
|
+
const { message, defaultValue, prefaceLines = [] } = options;
|
|
12
|
+
if (assumeYes) {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
for (const line of prefaceLines) {
|
|
16
|
+
if (line.length === 0) {
|
|
17
|
+
process.stdout.write("\n");
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
process.stdout.write(`${line}\n`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const suffix = defaultValue ? "(Y/n)" : "(y/N)";
|
|
24
|
+
for (;;) {
|
|
25
|
+
const response = await readlineInterface.question(`${message} ${suffix}: `);
|
|
26
|
+
const normalized = response.trim().toLowerCase();
|
|
27
|
+
if (normalized.length === 0) {
|
|
28
|
+
return defaultValue;
|
|
29
|
+
}
|
|
30
|
+
if (normalized === "y" || normalized === "yes") {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
if (normalized === "n" || normalized === "no") {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
process.stdout.write("Please answer Y or N.\n");
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
async prompt(options) {
|
|
40
|
+
const { message, defaultValue, prefaceLines = [] } = options;
|
|
41
|
+
if (assumeYes) {
|
|
42
|
+
return defaultValue ?? "";
|
|
43
|
+
}
|
|
44
|
+
for (const line of prefaceLines) {
|
|
45
|
+
if (line.length === 0) {
|
|
46
|
+
process.stdout.write("\n");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
process.stdout.write(`${line}\n`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const suffix = defaultValue && defaultValue.length > 0 ? ` [${defaultValue}]` : "";
|
|
53
|
+
const response = await readlineInterface.question(`${message}${suffix}: `);
|
|
54
|
+
if (response.trim().length === 0) {
|
|
55
|
+
return defaultValue ?? "";
|
|
56
|
+
}
|
|
57
|
+
return response.trim();
|
|
58
|
+
},
|
|
59
|
+
close() {
|
|
60
|
+
readlineInterface.close();
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { colorize } from "../../utils/colors.js";
|
|
2
|
+
import { formatRunWorkspaceRelative } from "../../workspace/layout.js";
|
|
3
|
+
import { buildAgentArtifactPaths, buildAgentEvalViews, getAgentDirectoryPath, getAgentManifestPath, } from "../../workspace/structure.js";
|
|
4
|
+
import { formatRunTimestamp } from "../utils/records.js";
|
|
5
|
+
import { renderTranscriptWithMetadata } from "./shared.js";
|
|
6
|
+
export function renderApplyTranscript(result) {
|
|
7
|
+
const agent = result.agent;
|
|
8
|
+
const artifacts = agent.artifacts ?? {};
|
|
9
|
+
const { startedAt, completedAt } = agent;
|
|
10
|
+
if (!startedAt || !completedAt) {
|
|
11
|
+
throw new Error("apply transcript requires agent lifecycle timestamps");
|
|
12
|
+
}
|
|
13
|
+
const assets = buildAgentArtifactPaths({
|
|
14
|
+
runId: result.runId,
|
|
15
|
+
agentId: agent.agentId,
|
|
16
|
+
artifacts,
|
|
17
|
+
});
|
|
18
|
+
const agentDisplay = {
|
|
19
|
+
...agent,
|
|
20
|
+
startedAt,
|
|
21
|
+
completedAt,
|
|
22
|
+
baseDirectory: getAgentDirectoryPath(result.runId, agent.agentId),
|
|
23
|
+
runtimeManifestPath: getAgentManifestPath(result.runId, agent.agentId),
|
|
24
|
+
assets,
|
|
25
|
+
evals: buildAgentEvalViews({
|
|
26
|
+
runId: result.runId,
|
|
27
|
+
agentId: agent.agentId,
|
|
28
|
+
evals: agent.evals,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
const warnings = result.ignoredBaseMismatch
|
|
32
|
+
? [
|
|
33
|
+
`${colorize("Warning:", "yellow")} Applied despite base mismatch (\`--ignore-base-mismatch\`).`,
|
|
34
|
+
]
|
|
35
|
+
: undefined;
|
|
36
|
+
return renderTranscriptWithMetadata({
|
|
37
|
+
metadata: {
|
|
38
|
+
runId: result.runId,
|
|
39
|
+
status: result.status,
|
|
40
|
+
specPath: result.specPath,
|
|
41
|
+
workspacePath: formatRunWorkspaceRelative(result.runId),
|
|
42
|
+
createdAt: formatRunTimestamp(result.createdAt),
|
|
43
|
+
baseRevisionSha: result.baseRevisionSha,
|
|
44
|
+
},
|
|
45
|
+
agents: [agentDisplay],
|
|
46
|
+
warnings,
|
|
47
|
+
afterAgents: [[colorize("Diff applied to working tree.", "green")]],
|
|
48
|
+
hint: {
|
|
49
|
+
message: "Review changes (e.g., `git status`) and run tests before committing.",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InitCommandResult } from "../../commands/init/types.js";
|
|
2
|
+
import type { EvalSlug } from "../../configs/evals/types.js";
|
|
3
|
+
export declare function buildInitializationPrompt(): string;
|
|
4
|
+
interface AgentPromptRenderOptions {
|
|
5
|
+
agentId: string;
|
|
6
|
+
binaryPath?: string;
|
|
7
|
+
detected: boolean;
|
|
8
|
+
firstPrompt: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function renderAgentPromptPreface({ agentId, binaryPath, detected, firstPrompt, }: AgentPromptRenderOptions): string[];
|
|
11
|
+
interface EvalCommandPromptRenderOptions {
|
|
12
|
+
commandName: EvalSlug;
|
|
13
|
+
commandText: string;
|
|
14
|
+
firstPrompt: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function renderEvalCommandPreface({ commandName, commandText, firstPrompt, }: EvalCommandPromptRenderOptions): string[];
|
|
17
|
+
export declare function renderInitTranscript({ agentSummary, environmentSummary, evalSummary, sandboxSummary, }: InitCommandResult): string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { colorize } from "../../utils/colors.js";
|
|
2
|
+
import { renderTranscript } from "../utils/transcript.js";
|
|
3
|
+
export function buildInitializationPrompt() {
|
|
4
|
+
return "Initializing Voratiq…";
|
|
5
|
+
}
|
|
6
|
+
export function renderAgentPromptPreface({ agentId, binaryPath, detected, firstPrompt, }) {
|
|
7
|
+
const lines = [];
|
|
8
|
+
if (firstPrompt) {
|
|
9
|
+
lines.push("");
|
|
10
|
+
lines.push("Configuring agents…");
|
|
11
|
+
lines.push("");
|
|
12
|
+
}
|
|
13
|
+
if (detected && binaryPath) {
|
|
14
|
+
lines.push(`\`${agentId}\` binary detected: \`${binaryPath}\``);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
lines.push(`\`${agentId}\` binary not detected. Keeping disabled.`);
|
|
18
|
+
}
|
|
19
|
+
return lines;
|
|
20
|
+
}
|
|
21
|
+
export function renderEvalCommandPreface({ commandName, commandText, firstPrompt, }) {
|
|
22
|
+
const lines = [];
|
|
23
|
+
if (firstPrompt) {
|
|
24
|
+
lines.push("");
|
|
25
|
+
lines.push("Configuring evals…");
|
|
26
|
+
lines.push("");
|
|
27
|
+
}
|
|
28
|
+
lines.push(`\`${commandName}\` command detected: \`${commandText}\``);
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
31
|
+
export function renderInitTranscript({ agentSummary, environmentSummary, evalSummary, sandboxSummary, }) {
|
|
32
|
+
const sections = [];
|
|
33
|
+
sections.push(buildAgentsSection(agentSummary));
|
|
34
|
+
sections.push(buildEnvironmentSection(environmentSummary));
|
|
35
|
+
sections.push(buildEvalsSection(evalSummary));
|
|
36
|
+
sections.push(buildSandboxSection(sandboxSummary));
|
|
37
|
+
sections.push([buildWorkspaceInitializedSection()]);
|
|
38
|
+
return renderTranscript({
|
|
39
|
+
sections,
|
|
40
|
+
hint: {
|
|
41
|
+
message: "To begin a run:\n voratiq run --spec <path>",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function buildAgentsSection(summary) {
|
|
46
|
+
const lines = [];
|
|
47
|
+
if (summary.zeroDetections && summary.enabledAgents.length === 0) {
|
|
48
|
+
lines.push("No agents configured, unable to find agent binaries.");
|
|
49
|
+
lines.push(`To modify agent setup manually, edit \`${summary.configPath}\`.`);
|
|
50
|
+
return lines;
|
|
51
|
+
}
|
|
52
|
+
lines.push(`Agents configured (${formatEnabled(summary.enabledAgents)}).`);
|
|
53
|
+
lines.push(`To modify, edit \`${summary.configPath}\`.`);
|
|
54
|
+
return lines;
|
|
55
|
+
}
|
|
56
|
+
function buildEnvironmentSection(summary) {
|
|
57
|
+
const lines = [];
|
|
58
|
+
const details = summary.detectedEntries.length > 0
|
|
59
|
+
? summary.detectedEntries.join(", ")
|
|
60
|
+
: "none";
|
|
61
|
+
lines.push(`Environment configured (${details}).`);
|
|
62
|
+
lines.push(`To modify, edit \`${summary.configPath}\`.`);
|
|
63
|
+
return lines;
|
|
64
|
+
}
|
|
65
|
+
function buildEvalsSection(summary) {
|
|
66
|
+
const lines = [];
|
|
67
|
+
if (summary.configuredEvals.length === 0) {
|
|
68
|
+
lines.push("No evals configured, unable to detect project tooling yet.");
|
|
69
|
+
lines.push(`To modify eval setup manually, edit \`${summary.configPath}\`.`);
|
|
70
|
+
return lines;
|
|
71
|
+
}
|
|
72
|
+
lines.push(`Evals configured (${formatEnabled(summary.configuredEvals)}).`);
|
|
73
|
+
lines.push(`To modify, edit \`${summary.configPath}\`.`);
|
|
74
|
+
return lines;
|
|
75
|
+
}
|
|
76
|
+
function buildSandboxSection(summary) {
|
|
77
|
+
return ["Sandbox configured.", `To modify, edit \`${summary.configPath}\`.`];
|
|
78
|
+
}
|
|
79
|
+
function buildWorkspaceInitializedSection() {
|
|
80
|
+
return colorize("Voratiq initialized.", "green");
|
|
81
|
+
}
|
|
82
|
+
function formatEnabled(values) {
|
|
83
|
+
return values.length > 0 ? values.join(", ") : "none";
|
|
84
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { formatRunTimestamp } from "../utils/records.js";
|
|
2
|
+
import { renderTable } from "../utils/table.js";
|
|
3
|
+
import { renderTranscript } from "../utils/transcript.js";
|
|
4
|
+
export function renderRunList(records) {
|
|
5
|
+
const rows = records.map((record) => ({
|
|
6
|
+
run: record.runId,
|
|
7
|
+
status: record.status.toUpperCase(),
|
|
8
|
+
spec: record.spec.path,
|
|
9
|
+
created: formatRunTimestamp(record.createdAt),
|
|
10
|
+
}));
|
|
11
|
+
const columns = [
|
|
12
|
+
{ header: "RUN", accessor: (row) => row.run },
|
|
13
|
+
{
|
|
14
|
+
header: "STATUS",
|
|
15
|
+
accessor: (row) => row.status,
|
|
16
|
+
},
|
|
17
|
+
{ header: "SPEC", accessor: (row) => row.spec },
|
|
18
|
+
{
|
|
19
|
+
header: "CREATED",
|
|
20
|
+
accessor: (row) => row.created,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
const lines = renderTable({
|
|
24
|
+
columns,
|
|
25
|
+
rows,
|
|
26
|
+
});
|
|
27
|
+
return lines.join("\n");
|
|
28
|
+
}
|
|
29
|
+
export function renderListTranscript(records) {
|
|
30
|
+
if (records.length === 0) {
|
|
31
|
+
return "";
|
|
32
|
+
}
|
|
33
|
+
const tableOutput = renderRunList(records);
|
|
34
|
+
const sections = [];
|
|
35
|
+
if (tableOutput.trim().length > 0) {
|
|
36
|
+
sections.push(tableOutput.split("\n"));
|
|
37
|
+
}
|
|
38
|
+
return renderTranscript({
|
|
39
|
+
sections,
|
|
40
|
+
hint: {
|
|
41
|
+
message: "To review a run in more detail:\n voratiq review --run <run-id>",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PruneResult } from "../../commands/prune/types.js";
|
|
2
|
+
import type { RunStatus } from "../../status/index.js";
|
|
3
|
+
export interface PruneConfirmationPrefaceOptions {
|
|
4
|
+
runId: string;
|
|
5
|
+
specPath: string;
|
|
6
|
+
runStatus: RunStatus;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
runPath?: string;
|
|
9
|
+
workspaces: readonly string[];
|
|
10
|
+
directories: readonly string[];
|
|
11
|
+
branches: readonly string[];
|
|
12
|
+
purge: boolean;
|
|
13
|
+
previouslyDeletedAt?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildPruneConfirmationPreface(options: PruneConfirmationPrefaceOptions): string[];
|
|
16
|
+
export declare function renderPruneTranscript(result: PruneResult): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { colorize } from "../../utils/colors.js";
|
|
2
|
+
import { formatRunTimestamp } from "../utils/records.js";
|
|
3
|
+
import { buildRunMetadataSection } from "../utils/runs.js";
|
|
4
|
+
import { renderTranscript } from "../utils/transcript.js";
|
|
5
|
+
export function buildPruneConfirmationPreface(options) {
|
|
6
|
+
const { runId, specPath, runStatus, createdAt, runPath, workspaces, directories, branches, purge, previouslyDeletedAt, } = options;
|
|
7
|
+
const introLines = buildRunMetadataSection({
|
|
8
|
+
runId,
|
|
9
|
+
specPath,
|
|
10
|
+
status: runStatus,
|
|
11
|
+
workspacePath: runPath,
|
|
12
|
+
createdAt: formatRunTimestamp(createdAt),
|
|
13
|
+
});
|
|
14
|
+
const lines = ["", ...introLines];
|
|
15
|
+
if (previouslyDeletedAt) {
|
|
16
|
+
lines.push(`Marked deleted: ${previouslyDeletedAt}`, "Proceeding will update the deletion timestamp.");
|
|
17
|
+
}
|
|
18
|
+
if (purge) {
|
|
19
|
+
if (directories.length > 0) {
|
|
20
|
+
lines.push("", "Directories to be deleted:");
|
|
21
|
+
directories.forEach((directory) => lines.push(` - ${directory}`));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (workspaces.length > 0) {
|
|
25
|
+
lines.push("", "Workspaces to be removed:");
|
|
26
|
+
workspaces.forEach((workspace) => lines.push(` - ${workspace}`));
|
|
27
|
+
}
|
|
28
|
+
if (branches.length > 0) {
|
|
29
|
+
lines.push("", "Branches to be deleted:");
|
|
30
|
+
branches.forEach((branch) => lines.push(` - ${branch}`));
|
|
31
|
+
}
|
|
32
|
+
lines.push("");
|
|
33
|
+
return lines;
|
|
34
|
+
}
|
|
35
|
+
export function renderPruneTranscript(result) {
|
|
36
|
+
if (result.status === "aborted") {
|
|
37
|
+
const sections = [
|
|
38
|
+
[colorize("Prune aborted; no changes were made.", "yellow")],
|
|
39
|
+
];
|
|
40
|
+
return renderTranscript({
|
|
41
|
+
sections,
|
|
42
|
+
hint: {
|
|
43
|
+
message: `Re-run \`voratiq prune --run ${result.runId}\` when you are ready.`,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return renderTranscript({
|
|
48
|
+
sections: [[colorize("Run pruned successfully.", "green")]],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { colorize } from "../../utils/colors.js";
|
|
2
|
+
import { formatRunWorkspaceRelative } from "../../workspace/layout.js";
|
|
3
|
+
import { formatRunTimestamp } from "../utils/records.js";
|
|
4
|
+
import { renderTranscriptWithMetadata } from "./shared.js";
|
|
5
|
+
export function renderReviewTranscript(run) {
|
|
6
|
+
const enhanced = run;
|
|
7
|
+
const beforeAgents = enhanced.status === "pruned"
|
|
8
|
+
? [
|
|
9
|
+
[
|
|
10
|
+
colorize("Note: Run was pruned; associated artifacts may no longer be available.", "yellow"),
|
|
11
|
+
],
|
|
12
|
+
]
|
|
13
|
+
: undefined;
|
|
14
|
+
const hasEvalIssues = enhanced.agents.some((agent) => agent.evals.some((evaluation) => evaluation.status === "failed" || evaluation.status === "errored"));
|
|
15
|
+
const warnings = hasEvalIssues
|
|
16
|
+
? [
|
|
17
|
+
`${colorize("Warning:", "yellow")} Evaluation issues detected. Review logs before proceeding.`,
|
|
18
|
+
]
|
|
19
|
+
: undefined;
|
|
20
|
+
return renderTranscriptWithMetadata({
|
|
21
|
+
metadata: {
|
|
22
|
+
runId: enhanced.runId,
|
|
23
|
+
status: enhanced.status,
|
|
24
|
+
specPath: enhanced.spec.path,
|
|
25
|
+
workspacePath: formatRunWorkspaceRelative(enhanced.runId),
|
|
26
|
+
createdAt: formatRunTimestamp(enhanced.createdAt),
|
|
27
|
+
baseRevisionSha: enhanced.baseRevisionSha,
|
|
28
|
+
},
|
|
29
|
+
agents: enhanced.agents,
|
|
30
|
+
beforeAgents,
|
|
31
|
+
warnings,
|
|
32
|
+
hint: {
|
|
33
|
+
message: `To integrate a solution:\n voratiq apply --run ${run.runId} --agent <agent-id>`,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AgentInvocationRecord, RunReport } from "../../records/types.js";
|
|
2
|
+
type CliWriter = Pick<NodeJS.WriteStream, "write"> & {
|
|
3
|
+
isTTY?: boolean;
|
|
4
|
+
};
|
|
5
|
+
interface RunProgressContext {
|
|
6
|
+
runId: string;
|
|
7
|
+
status: RunReport["status"];
|
|
8
|
+
specPath: string;
|
|
9
|
+
workspacePath: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
baseRevisionSha: string;
|
|
12
|
+
}
|
|
13
|
+
interface RunRendererOptions {
|
|
14
|
+
stdout?: CliWriter;
|
|
15
|
+
stderr?: CliWriter;
|
|
16
|
+
now?: () => number;
|
|
17
|
+
}
|
|
18
|
+
interface RunProgressRenderer {
|
|
19
|
+
begin(context?: RunProgressContext): void;
|
|
20
|
+
update(record: AgentInvocationRecord): void;
|
|
21
|
+
complete(report: RunReport): string;
|
|
22
|
+
}
|
|
23
|
+
export declare function createRunRenderer(options?: RunRendererOptions): RunProgressRenderer;
|
|
24
|
+
export declare function buildRunTranscriptSections(report: RunReport): string[][];
|
|
25
|
+
export type { RunProgressContext, RunProgressRenderer };
|