@spotpatch/dev-server 0.1.2 → 0.2.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/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -280,7 +280,8 @@ function createAgentJobManager(options) {
|
|
|
280
280
|
transition(job, "completed", "No source changes were proposed.");
|
|
281
281
|
return;
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
const shouldApplyDirectly = options.ai.execution.applyMode === "auto" && preparedChange.autoApplyEligible || options.ai.execution.applyMode === "trusted-auto" && job.trustedFastModeConsent;
|
|
284
|
+
if (shouldApplyDirectly) {
|
|
284
285
|
try {
|
|
285
286
|
await applyChange(job, preparedChange);
|
|
286
287
|
} catch {
|
|
@@ -355,6 +356,10 @@ function createAgentJobManager(options) {
|
|
|
355
356
|
if (closed) {
|
|
356
357
|
throw new SpotPatchError(ERROR_CODES.AI_DISABLED);
|
|
357
358
|
}
|
|
359
|
+
const trustedFastModeConfigured = options.ai.execution.applyMode === "trusted-auto";
|
|
360
|
+
if (trustedFastModeConfigured !== (request.trustedFastModeConsent === true)) {
|
|
361
|
+
throw new SpotPatchError(ERROR_CODES.INVALID_REQUEST);
|
|
362
|
+
}
|
|
358
363
|
if (hasActiveJob()) {
|
|
359
364
|
throw new SpotPatchError(ERROR_CODES.AGENT_BUSY);
|
|
360
365
|
}
|
|
@@ -388,6 +393,7 @@ function createAgentJobManager(options) {
|
|
|
388
393
|
runPromise: void 0,
|
|
389
394
|
sequence: 0,
|
|
390
395
|
status: "queued",
|
|
396
|
+
trustedFastModeConsent: request.trustedFastModeConsent === true,
|
|
391
397
|
updatedAt: timestamp,
|
|
392
398
|
workingTreeMode: request.workingTreeMode
|
|
393
399
|
};
|
|
@@ -545,6 +551,7 @@ function resolveEnvironmentAiConfiguration(environment) {
|
|
|
545
551
|
|
|
546
552
|
// src/options.ts
|
|
547
553
|
import {
|
|
554
|
+
AGENT_APPLY_MODES,
|
|
548
555
|
DEFAULT_AGENT_LIMITS,
|
|
549
556
|
MAX_ANNOTATION_TARGETS,
|
|
550
557
|
SPOTPATCH_EDITOR_PREFERENCES,
|
|
@@ -625,7 +632,7 @@ var aiOptionsSchema = z.strictObject({
|
|
|
625
632
|
defaultProvider: z.string(),
|
|
626
633
|
execution: z.strictObject({
|
|
627
634
|
isolation: z.literal("git-worktree").optional(),
|
|
628
|
-
applyMode: z.enum(
|
|
635
|
+
applyMode: z.enum(AGENT_APPLY_MODES).optional(),
|
|
629
636
|
checks: z.record(z.string(), agentCheckSchema).optional(),
|
|
630
637
|
limits: agentLimitsSchema
|
|
631
638
|
}).optional()
|
|
@@ -820,8 +827,8 @@ function resolveAiOptions(options) {
|
|
|
820
827
|
const limits = resolveLimits(validated.execution?.limits);
|
|
821
828
|
const checks = resolveChecks(validated.execution?.checks, limits.checkTimeoutMs);
|
|
822
829
|
const applyMode = validated.execution?.applyMode ?? "review";
|
|
823
|
-
if (applyMode
|
|
824
|
-
throw new RangeError(
|
|
830
|
+
if (applyMode !== "review" && !Object.values(checks).some((check) => check.required)) {
|
|
831
|
+
throw new RangeError(`SpotPatch AI ${applyMode} mode requires a required check.`);
|
|
825
832
|
}
|
|
826
833
|
const providers = resolveProviders(validated.providers);
|
|
827
834
|
if (!(validated.defaultProvider in providers)) {
|
|
@@ -1459,6 +1466,7 @@ async function authorizeAgentJobRequest(input) {
|
|
|
1459
1466
|
providerProfileId: input.request.providerProfileId,
|
|
1460
1467
|
modelProfileId: input.request.modelProfileId,
|
|
1461
1468
|
providerDataConsent: true,
|
|
1469
|
+
...input.request.trustedFastModeConsent === true ? { trustedFastModeConsent: true } : {},
|
|
1462
1470
|
workingTreeMode: input.request.workingTreeMode
|
|
1463
1471
|
});
|
|
1464
1472
|
}
|