@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.cjs
CHANGED
|
@@ -322,7 +322,8 @@ function createAgentJobManager(options) {
|
|
|
322
322
|
transition(job, "completed", "No source changes were proposed.");
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
const shouldApplyDirectly = options.ai.execution.applyMode === "auto" && preparedChange.autoApplyEligible || options.ai.execution.applyMode === "trusted-auto" && job.trustedFastModeConsent;
|
|
326
|
+
if (shouldApplyDirectly) {
|
|
326
327
|
try {
|
|
327
328
|
await applyChange(job, preparedChange);
|
|
328
329
|
} catch {
|
|
@@ -397,6 +398,10 @@ function createAgentJobManager(options) {
|
|
|
397
398
|
if (closed) {
|
|
398
399
|
throw new import_shared.SpotPatchError(import_shared.ERROR_CODES.AI_DISABLED);
|
|
399
400
|
}
|
|
401
|
+
const trustedFastModeConfigured = options.ai.execution.applyMode === "trusted-auto";
|
|
402
|
+
if (trustedFastModeConfigured !== (request.trustedFastModeConsent === true)) {
|
|
403
|
+
throw new import_shared.SpotPatchError(import_shared.ERROR_CODES.INVALID_REQUEST);
|
|
404
|
+
}
|
|
400
405
|
if (hasActiveJob()) {
|
|
401
406
|
throw new import_shared.SpotPatchError(import_shared.ERROR_CODES.AGENT_BUSY);
|
|
402
407
|
}
|
|
@@ -430,6 +435,7 @@ function createAgentJobManager(options) {
|
|
|
430
435
|
runPromise: void 0,
|
|
431
436
|
sequence: 0,
|
|
432
437
|
status: "queued",
|
|
438
|
+
trustedFastModeConsent: request.trustedFastModeConsent === true,
|
|
433
439
|
updatedAt: timestamp,
|
|
434
440
|
workingTreeMode: request.workingTreeMode
|
|
435
441
|
};
|
|
@@ -662,7 +668,7 @@ var aiOptionsSchema = import_zod.z.strictObject({
|
|
|
662
668
|
defaultProvider: import_zod.z.string(),
|
|
663
669
|
execution: import_zod.z.strictObject({
|
|
664
670
|
isolation: import_zod.z.literal("git-worktree").optional(),
|
|
665
|
-
applyMode: import_zod.z.enum(
|
|
671
|
+
applyMode: import_zod.z.enum(import_shared2.AGENT_APPLY_MODES).optional(),
|
|
666
672
|
checks: import_zod.z.record(import_zod.z.string(), agentCheckSchema).optional(),
|
|
667
673
|
limits: agentLimitsSchema
|
|
668
674
|
}).optional()
|
|
@@ -857,8 +863,8 @@ function resolveAiOptions(options) {
|
|
|
857
863
|
const limits = resolveLimits(validated.execution?.limits);
|
|
858
864
|
const checks = resolveChecks(validated.execution?.checks, limits.checkTimeoutMs);
|
|
859
865
|
const applyMode = validated.execution?.applyMode ?? "review";
|
|
860
|
-
if (applyMode
|
|
861
|
-
throw new RangeError(
|
|
866
|
+
if (applyMode !== "review" && !Object.values(checks).some((check) => check.required)) {
|
|
867
|
+
throw new RangeError(`SpotPatch AI ${applyMode} mode requires a required check.`);
|
|
862
868
|
}
|
|
863
869
|
const providers = resolveProviders(validated.providers);
|
|
864
870
|
if (!(validated.defaultProvider in providers)) {
|
|
@@ -1472,6 +1478,7 @@ async function authorizeAgentJobRequest(input) {
|
|
|
1472
1478
|
providerProfileId: input.request.providerProfileId,
|
|
1473
1479
|
modelProfileId: input.request.modelProfileId,
|
|
1474
1480
|
providerDataConsent: true,
|
|
1481
|
+
...input.request.trustedFastModeConsent === true ? { trustedFastModeConsent: true } : {},
|
|
1475
1482
|
workingTreeMode: input.request.workingTreeMode
|
|
1476
1483
|
});
|
|
1477
1484
|
}
|