ai-engineering-loop 1.10.0 → 1.11.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/.agents/devil-advocate.md +13 -1
- package/.agents/judge.md +10 -0
- package/.agents/skills/backend-development/SKILL.md +272 -0
- package/.agents/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.agents/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.agents/skills/backend-development/references/security-checklist.md +60 -0
- package/.agents/workflows/ai-engineering-loop.md +4 -4
- package/.claude/agents/devil-advocate.md +13 -1
- package/.claude/agents/judge.md +10 -0
- package/.claude/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.claude/skills/backend-development/SKILL.md +272 -0
- package/.claude/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.claude/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.claude/skills/backend-development/references/security-checklist.md +60 -0
- package/.gemini/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.gemini/skills/backend-development/SKILL.md +272 -0
- package/.gemini/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.gemini/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.gemini/skills/backend-development/references/security-checklist.md +60 -0
- package/.grok/agents/devil-advocate.md +13 -1
- package/.grok/agents/judge.md +10 -0
- package/.grok/skills/ai-engineering-loop/SKILL.md +4 -4
- package/.grok/skills/backend-development/SKILL.md +272 -0
- package/.grok/skills/backend-development/references/api-design-guidelines.md +95 -0
- package/.grok/skills/backend-development/references/query-and-database-best-practices.md +53 -0
- package/.grok/skills/backend-development/references/security-checklist.md +60 -0
- package/README.md +33 -1
- package/README.npm.md +8 -1
- package/agents/shared/devil-advocate.body.md +13 -1
- package/agents/shared/judge.body.md +10 -0
- package/bin/ai-engineering-loop.js +207 -2
- package/core/runtime-safety.md +43 -0
- package/lib/budget.js +35 -0
- package/lib/doctor.js +4 -0
- package/lib/run-compaction.js +170 -0
- package/lib/runtime-policy.js +24 -1
- package/lib/safe-context.js +32 -7
- package/lib/smart-context.js +643 -0
- package/lib/studio-server.js +19 -2
- package/lib/sync-hosts.js +20 -0
- package/lib/update-manager.js +147 -0
- package/lib/verification-summary.js +130 -0
- package/package.json +1 -1
- package/policies/review-budget.md +12 -0
- package/studio/app.js +5 -2
package/lib/runtime-policy.js
CHANGED
|
@@ -10,6 +10,7 @@ const {
|
|
|
10
10
|
const DEFAULT_POLICY = Object.freeze({
|
|
11
11
|
schemaVersion: 1,
|
|
12
12
|
defaultMode: RUN_MODES.ASSISTED,
|
|
13
|
+
reviewProfile: 'lean',
|
|
13
14
|
allowUnattended: false,
|
|
14
15
|
requireSandboxForUnattended: true,
|
|
15
16
|
perRunTokenLimit: 50_000,
|
|
@@ -17,6 +18,8 @@ const DEFAULT_POLICY = Object.freeze({
|
|
|
17
18
|
killSwitch: false
|
|
18
19
|
});
|
|
19
20
|
|
|
21
|
+
const REVIEW_PROFILES = Object.freeze(['lean', 'standard', 'thorough']);
|
|
22
|
+
|
|
20
23
|
function policyPath(rootDir) {
|
|
21
24
|
return path.join(rootDir, '.ai-engineering-loop', 'runtime-policy.json');
|
|
22
25
|
}
|
|
@@ -32,6 +35,17 @@ function normalizeMode(value, fallback = null) {
|
|
|
32
35
|
return RUN_MODES[normalized];
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
function normalizeReviewProfile(value, fallback = DEFAULT_POLICY.reviewProfile) {
|
|
39
|
+
if (value == null || value === '') return fallback;
|
|
40
|
+
const normalized = String(value).trim().replace(/_/g, '-').toLowerCase();
|
|
41
|
+
if (!REVIEW_PROFILES.includes(normalized)) {
|
|
42
|
+
const err = new Error(`Unknown reviewProfile: ${value}. Use ${REVIEW_PROFILES.join('|')}`);
|
|
43
|
+
err.code = 'INVALID_REVIEW_PROFILE';
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
return normalized;
|
|
47
|
+
}
|
|
48
|
+
|
|
35
49
|
function validatePolicy(value) {
|
|
36
50
|
const errors = [];
|
|
37
51
|
if (!value || typeof value !== 'object' || Array.isArray(value)) {
|
|
@@ -43,6 +57,11 @@ function validatePolicy(value) {
|
|
|
43
57
|
} catch (cause) {
|
|
44
58
|
errors.push(cause.message);
|
|
45
59
|
}
|
|
60
|
+
try {
|
|
61
|
+
normalizeReviewProfile(value.reviewProfile);
|
|
62
|
+
} catch (cause) {
|
|
63
|
+
errors.push(cause.message);
|
|
64
|
+
}
|
|
46
65
|
for (const key of ['allowUnattended', 'requireSandboxForUnattended', 'killSwitch']) {
|
|
47
66
|
if (typeof value[key] !== 'boolean') errors.push(`${key} must be boolean`);
|
|
48
67
|
}
|
|
@@ -74,12 +93,12 @@ function loadPolicy(rootDir) {
|
|
|
74
93
|
throw err;
|
|
75
94
|
}
|
|
76
95
|
policy.defaultMode = normalizeMode(policy.defaultMode);
|
|
96
|
+
policy.reviewProfile = normalizeReviewProfile(policy.reviewProfile);
|
|
77
97
|
return policy;
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
function writePolicy(rootDir, policy) {
|
|
81
101
|
const next = { ...DEFAULT_POLICY, ...policy, schemaVersion: 1 };
|
|
82
|
-
next.defaultMode = normalizeMode(next.defaultMode);
|
|
83
102
|
const errors = validatePolicy(next);
|
|
84
103
|
if (errors.length) {
|
|
85
104
|
const err = new Error(`Invalid runtime policy: ${errors.join('; ')}`);
|
|
@@ -87,6 +106,8 @@ function writePolicy(rootDir, policy) {
|
|
|
87
106
|
err.details = errors;
|
|
88
107
|
throw err;
|
|
89
108
|
}
|
|
109
|
+
next.defaultMode = normalizeMode(next.defaultMode);
|
|
110
|
+
next.reviewProfile = normalizeReviewProfile(next.reviewProfile);
|
|
90
111
|
atomicWriteJson(policyPath(rootDir), next);
|
|
91
112
|
return next;
|
|
92
113
|
}
|
|
@@ -108,8 +129,10 @@ function assertModeAllowed(rootDir, mode) {
|
|
|
108
129
|
|
|
109
130
|
module.exports = {
|
|
110
131
|
DEFAULT_POLICY,
|
|
132
|
+
REVIEW_PROFILES,
|
|
111
133
|
policyPath,
|
|
112
134
|
normalizeMode,
|
|
135
|
+
normalizeReviewProfile,
|
|
113
136
|
validatePolicy,
|
|
114
137
|
loadPolicy,
|
|
115
138
|
writePolicy,
|
package/lib/safe-context.js
CHANGED
|
@@ -5,12 +5,26 @@ const fs = require('fs');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const { atomicWriteJson, getCurrentRun, loadRun, runsDir } = require('./run-state.js');
|
|
7
7
|
const { assertBudgetAvailable } = require('./budget.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const { loadPolicy, normalizeReviewProfile } = require('./runtime-policy.js');
|
|
9
|
+
|
|
10
|
+
const CONTEXT_PROFILE_LIMITS = Object.freeze({
|
|
11
|
+
lean: Object.freeze({
|
|
12
|
+
maker: Object.freeze({ maxFiles: 8, maxFileBytes: 16_000, maxTotalBytes: 48_000, maxEstimatedTokens: 12_000 }),
|
|
13
|
+
'devil-advocate': Object.freeze({ maxFiles: 6, maxFileBytes: 8_000, maxTotalBytes: 24_000, maxEstimatedTokens: 6_000 }),
|
|
14
|
+
judge: Object.freeze({ maxFiles: 3, maxFileBytes: 4_000, maxTotalBytes: 12_000, maxEstimatedTokens: 3_000 })
|
|
15
|
+
}),
|
|
16
|
+
standard: Object.freeze({
|
|
17
|
+
maker: Object.freeze({ maxFiles: 10, maxFileBytes: 24_000, maxTotalBytes: 72_000, maxEstimatedTokens: 18_000 }),
|
|
18
|
+
'devil-advocate': Object.freeze({ maxFiles: 8, maxFileBytes: 12_000, maxTotalBytes: 48_000, maxEstimatedTokens: 12_000 }),
|
|
19
|
+
judge: Object.freeze({ maxFiles: 3, maxFileBytes: 8_000, maxTotalBytes: 24_000, maxEstimatedTokens: 6_000 })
|
|
20
|
+
}),
|
|
21
|
+
thorough: Object.freeze({
|
|
22
|
+
maker: Object.freeze({ maxFiles: 12, maxFileBytes: 32_000, maxTotalBytes: 96_000, maxEstimatedTokens: 24_000 }),
|
|
23
|
+
'devil-advocate': Object.freeze({ maxFiles: 8, maxFileBytes: 16_000, maxTotalBytes: 64_000, maxEstimatedTokens: 16_000 }),
|
|
24
|
+
judge: Object.freeze({ maxFiles: 3, maxFileBytes: 12_000, maxTotalBytes: 32_000, maxEstimatedTokens: 8_000 })
|
|
25
|
+
})
|
|
13
26
|
});
|
|
27
|
+
const STAGE_LIMITS = CONTEXT_PROFILE_LIMITS.lean;
|
|
14
28
|
|
|
15
29
|
const SENSITIVE_NAMES = [
|
|
16
30
|
/^\.env(?:\.|$)/i,
|
|
@@ -114,11 +128,18 @@ function resolveRun(rootDir, runId) {
|
|
|
114
128
|
return current;
|
|
115
129
|
}
|
|
116
130
|
|
|
117
|
-
function
|
|
118
|
-
const
|
|
131
|
+
function contextLimitsForProfile(profile, stage) {
|
|
132
|
+
const reviewProfile = normalizeReviewProfile(profile);
|
|
133
|
+
const limits = CONTEXT_PROFILE_LIMITS[reviewProfile]?.[stage];
|
|
119
134
|
if (!limits) {
|
|
120
135
|
throw contextError(`Unknown context stage: ${stage}. Use ${Object.keys(STAGE_LIMITS).join('|')}`, 'UNKNOWN_CONTEXT_STAGE');
|
|
121
136
|
}
|
|
137
|
+
return { reviewProfile, limits };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function createContextPack(rootDir, { runId, stage, files, profile } = {}) {
|
|
141
|
+
const policy = loadPolicy(rootDir);
|
|
142
|
+
const { reviewProfile, limits } = contextLimitsForProfile(profile || policy.reviewProfile, stage);
|
|
122
143
|
const run = resolveRun(rootDir, runId);
|
|
123
144
|
assertBudgetAvailable(rootDir, { runId: run.runId });
|
|
124
145
|
const uniqueFiles = [...new Set((files || []).map((file) => String(file).trim()).filter(Boolean))];
|
|
@@ -164,6 +185,7 @@ function createContextPack(rootDir, { runId, stage, files } = {}) {
|
|
|
164
185
|
schemaVersion: 1,
|
|
165
186
|
runId: run.runId,
|
|
166
187
|
stage,
|
|
188
|
+
reviewProfile,
|
|
167
189
|
createdAt: new Date().toISOString(),
|
|
168
190
|
transcriptInherited: false,
|
|
169
191
|
limits,
|
|
@@ -184,6 +206,7 @@ function contextPackSummary(result) {
|
|
|
184
206
|
schemaVersion: result.pack.schemaVersion,
|
|
185
207
|
runId: result.pack.runId,
|
|
186
208
|
stage: result.pack.stage,
|
|
209
|
+
reviewProfile: result.pack.reviewProfile,
|
|
187
210
|
path: result.path,
|
|
188
211
|
files: result.pack.entries.length,
|
|
189
212
|
totalBytes: result.pack.totalBytes,
|
|
@@ -194,7 +217,9 @@ function contextPackSummary(result) {
|
|
|
194
217
|
}
|
|
195
218
|
|
|
196
219
|
module.exports = {
|
|
220
|
+
CONTEXT_PROFILE_LIMITS,
|
|
197
221
|
STAGE_LIMITS,
|
|
222
|
+
contextLimitsForProfile,
|
|
198
223
|
isSensitivePath,
|
|
199
224
|
resolveSafeRepoFile,
|
|
200
225
|
redactSecrets,
|