@fitlab-ai/agent-infra 0.9.10 → 0.9.11
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 +13 -3
- package/README.zh-CN.md +13 -3
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +50 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +7 -8
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +5 -15
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +4 -0
- package/dist/lib/init.js +2 -2
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/internal/task-validate.js +2 -1
- package/dist/lib/merge.js +205 -103
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +3 -12
- package/dist/lib/sandbox/control/executor.js +131 -39
- package/dist/lib/sandbox/control/lifecycle.js +29 -20
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +4 -2
- package/dist/lib/task/codex-orchestration.js +1 -1
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-operation.js +21 -25
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +6 -1
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +263 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/index.js +19 -20
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +16 -0
- package/dist/lib/task/orchestration.js +50 -13
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +19 -6
- package/dist/lib/task/verification-engine.js +38 -15
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +6 -37
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +7 -8
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +5 -18
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +4 -0
- package/lib/init.ts +2 -2
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/internal/task-validate.ts +3 -2
- package/lib/merge.ts +236 -120
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +2 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/executor.ts +148 -51
- package/lib/sandbox/control/lifecycle.ts +34 -28
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +5 -3
- package/lib/task/codex-orchestration.ts +2 -1
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-operation.ts +25 -30
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +6 -1
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +340 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/events.ts +10 -5
- package/lib/task/index.ts +19 -20
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +20 -0
- package/lib/task/orchestration.ts +40 -15
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +33 -7
- package/lib/task/verification-engine.ts +33 -18
- package/lib/task/verification-review.ts +1 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +6 -40
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/compatibility-policy.en.md +5 -4
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +5 -4
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/issue-fields.github.en.md +1 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +1 -1
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +2 -2
- package/templates/.agents/rules/milestone-inference.github.en.md +1 -1
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +1 -1
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +1 -1
- package/templates/.agents/rules/pr-sync.github.en.md +1 -1
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +1 -1
- package/templates/.agents/rules/release-commands.github.en.md +6 -0
- package/templates/.agents/rules/release-commands.github.zh-CN.md +6 -0
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/task-management.en.md +1 -2
- package/templates/.agents/rules/task-management.zh-CN.md +1 -2
- package/templates/.agents/skills/analyze-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/commit/SKILL.en.md +27 -7
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -5
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/create-pr/SKILL.en.md +5 -7
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +5 -7
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +9 -4
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +9 -4
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/plan-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +2 -1
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +2 -1
- package/templates/.agents/skills/review-plan/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +4 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +4 -0
- package/templates/.agents/skills/run-task/SKILL.en.md +4 -0
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +4 -0
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +140 -109
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.en.md +0 -1
- package/templates/{.trae/skills → .traecli/commands}/update-agent-infra.zh-CN.md +0 -1
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
|
@@ -116,6 +116,10 @@ const DEFAULTS = {
|
|
|
116
116
|
],
|
|
117
117
|
"ejected": [],
|
|
118
118
|
"retiredManaged": [
|
|
119
|
+
{
|
|
120
|
+
"path": ".trae/skills/",
|
|
121
|
+
"templateHashes": []
|
|
122
|
+
},
|
|
119
123
|
{
|
|
120
124
|
"path": ".agents/workspace/README.md",
|
|
121
125
|
"templateHashes": [
|
|
@@ -200,18 +204,17 @@ const AGENT_CLIENT_MANIFEST = [
|
|
|
200
204
|
"displayName": "TraeCode CLI",
|
|
201
205
|
"invocation": "/${skillName}",
|
|
202
206
|
"ownedPathPrefixes": [
|
|
203
|
-
".
|
|
207
|
+
".traecli/"
|
|
204
208
|
],
|
|
205
209
|
"managed": [
|
|
206
|
-
".
|
|
210
|
+
".traecli/commands/"
|
|
207
211
|
],
|
|
208
212
|
"merged": [],
|
|
209
213
|
"ejected": [],
|
|
210
214
|
"customCommand": {
|
|
211
|
-
"target": ".
|
|
215
|
+
"target": ".traecli/commands/${skillName}.md",
|
|
212
216
|
"frontmatter": {},
|
|
213
|
-
"
|
|
214
|
-
"inheritDisableModelInvocation": true
|
|
217
|
+
"argumentsToken": "$ARGUMENTS"
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
];
|
|
@@ -230,84 +233,19 @@ const CUSTOM_TUI_CONTRACT = {
|
|
|
230
233
|
const KNOWN_PLATFORMS = new Set(['github', 'none']);
|
|
231
234
|
const KNOWN_LANGUAGES = new Set(['en', 'zh-CN']);
|
|
232
235
|
|
|
233
|
-
const
|
|
236
|
+
const AGENT_CLIENT_IDS = AGENT_CLIENT_MANIFEST.map((entry) => entry.id);
|
|
234
237
|
|
|
235
238
|
function normalizeAgentClientConfig(cfg) {
|
|
236
239
|
const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
237
|
-
const diagnostics = [];
|
|
238
240
|
const failure = (code, path) => ({
|
|
239
|
-
source: null,
|
|
240
241
|
state: null,
|
|
241
242
|
canonical: null,
|
|
242
|
-
remainingSandboxTools: undefined,
|
|
243
|
-
removeLegacyTuis: false,
|
|
244
|
-
changed: false,
|
|
245
|
-
diagnostics,
|
|
246
243
|
error: `${code} at ${path}`,
|
|
247
244
|
errorCode: code,
|
|
248
245
|
errorPath: path
|
|
249
246
|
});
|
|
250
|
-
const
|
|
251
|
-
|
|
252
|
-
return Object.fromEntries(BUILTIN_TUI_IDS.map((id) => [id, true]));
|
|
253
|
-
}
|
|
254
|
-
const enabled = new Set();
|
|
255
|
-
for (const [index, candidate] of value.entries()) {
|
|
256
|
-
if (BUILTIN_TUI_IDS.includes(candidate)) enabled.add(candidate);
|
|
257
|
-
else diagnostics.push({ code: 'LEGACY_VALUE_IGNORED', path: `tuis[${index}]` });
|
|
258
|
-
}
|
|
259
|
-
return Object.fromEntries(BUILTIN_TUI_IDS.map((id) => [id, enabled.has(id)]));
|
|
260
|
-
};
|
|
261
|
-
const projectSandbox = (value) => {
|
|
262
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
263
|
-
return {
|
|
264
|
-
installed: Object.fromEntries(BUILTIN_TUI_IDS.map((id) => [id, true])),
|
|
265
|
-
clientSignals: new Set(),
|
|
266
|
-
remainingTools: Array.isArray(value) ? [] : undefined
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
const installed = new Set();
|
|
270
|
-
const remainingTools = [];
|
|
271
|
-
for (const [index, candidate] of value.entries()) {
|
|
272
|
-
if (BUILTIN_TUI_IDS.includes(candidate)) installed.add(candidate);
|
|
273
|
-
else if (typeof candidate === 'string') remainingTools.push(candidate);
|
|
274
|
-
else diagnostics.push({ code: 'LEGACY_VALUE_IGNORED', path: `sandbox.tools[${index}]` });
|
|
275
|
-
}
|
|
276
|
-
return {
|
|
277
|
-
installed: Object.fromEntries(BUILTIN_TUI_IDS.map((id) => [id, installed.has(id)])),
|
|
278
|
-
clientSignals: installed,
|
|
279
|
-
remainingTools
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
const serialize = (state) => BUILTIN_TUI_IDS.map((id) => ({ id, ...state[id] }));
|
|
283
|
-
const hasCanonical = own(cfg, 'agentClients');
|
|
284
|
-
const hasLegacyTuis = own(cfg, 'tuis');
|
|
285
|
-
const sandbox = cfg.sandbox && typeof cfg.sandbox === 'object' && !Array.isArray(cfg.sandbox)
|
|
286
|
-
? cfg.sandbox
|
|
287
|
-
: undefined;
|
|
288
|
-
const hasSandboxTools = sandbox !== undefined && own(sandbox, 'tools');
|
|
289
|
-
const tuiProjection = projectTuis(cfg.tuis);
|
|
290
|
-
const sandboxProjection = projectSandbox(sandbox?.tools);
|
|
291
|
-
|
|
292
|
-
if (!hasCanonical) {
|
|
293
|
-
const state = Object.fromEntries(BUILTIN_TUI_IDS.map((id) => [id, {
|
|
294
|
-
enabled: tuiProjection[id],
|
|
295
|
-
installInSandbox: sandboxProjection.installed[id]
|
|
296
|
-
}]));
|
|
297
|
-
return {
|
|
298
|
-
source: 'legacy',
|
|
299
|
-
state,
|
|
300
|
-
canonical: serialize(state),
|
|
301
|
-
remainingSandboxTools: sandboxProjection.remainingTools,
|
|
302
|
-
removeLegacyTuis: hasLegacyTuis,
|
|
303
|
-
changed: true,
|
|
304
|
-
diagnostics,
|
|
305
|
-
error: null,
|
|
306
|
-
errorCode: null,
|
|
307
|
-
errorPath: null
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
|
|
247
|
+
const serialize = (state) => AGENT_CLIENT_IDS.map((id) => ({ id, ...state[id] }));
|
|
248
|
+
if (!own(cfg, 'agentClients')) return failure('MISSING_AGENT_CLIENT', 'agentClients');
|
|
311
249
|
if (!Array.isArray(cfg.agentClients)) return failure('INVALID_AGENT_CLIENTS', 'agentClients');
|
|
312
250
|
const entries = new Map();
|
|
313
251
|
for (const [index, candidate] of cfg.agentClients.entries()) {
|
|
@@ -325,7 +263,7 @@ function normalizeAgentClientConfig(cfg) {
|
|
|
325
263
|
) {
|
|
326
264
|
return failure('INVALID_AGENT_CLIENTS', entryPath);
|
|
327
265
|
}
|
|
328
|
-
if (!
|
|
266
|
+
if (!AGENT_CLIENT_IDS.includes(candidate.id)) {
|
|
329
267
|
return failure('UNKNOWN_AGENT_CLIENT', `${entryPath}.id`);
|
|
330
268
|
}
|
|
331
269
|
if (entries.has(candidate.id)) return failure('DUPLICATE_AGENT_CLIENT', `${entryPath}.id`);
|
|
@@ -335,24 +273,44 @@ function normalizeAgentClientConfig(cfg) {
|
|
|
335
273
|
let orchestration;
|
|
336
274
|
if (own(candidate, 'orchestration')) {
|
|
337
275
|
const policy = candidate.orchestration;
|
|
338
|
-
const exact = (value) => typeof value === 'string' && value.length > 0 && value.trim() === value;
|
|
339
|
-
const validRole = (role) => role
|
|
340
|
-
&& typeof role === 'object'
|
|
341
|
-
&& !Array.isArray(role)
|
|
342
|
-
&& Object.keys(role).length === 2
|
|
343
|
-
&& exact(role.model)
|
|
344
|
-
&& exact(role.reasoningEffort);
|
|
345
276
|
if (
|
|
346
277
|
!policy
|
|
347
278
|
|| typeof policy !== 'object'
|
|
348
279
|
|| Array.isArray(policy)
|
|
349
280
|
|| Object.keys(policy).length !== 2
|
|
350
|
-
|| !
|
|
351
|
-
|| !
|
|
281
|
+
|| !own(policy, 'executor')
|
|
282
|
+
|| !own(policy, 'reviewer')
|
|
352
283
|
) {
|
|
353
284
|
return failure('INVALID_AGENT_CLIENTS', `${entryPath}.orchestration`);
|
|
354
285
|
}
|
|
355
|
-
|
|
286
|
+
const parseExact = (value, path) => {
|
|
287
|
+
if (typeof value !== 'string' || value.length === 0 || value.trim() !== value) {
|
|
288
|
+
return failure('INVALID_AGENT_CLIENTS', path);
|
|
289
|
+
}
|
|
290
|
+
return value;
|
|
291
|
+
};
|
|
292
|
+
const parseRole = (role, rolePath) => {
|
|
293
|
+
if (
|
|
294
|
+
!role
|
|
295
|
+
|| typeof role !== 'object'
|
|
296
|
+
|| Array.isArray(role)
|
|
297
|
+
|| Object.keys(role).length !== 2
|
|
298
|
+
|| !own(role, 'model')
|
|
299
|
+
|| !own(role, 'reasoningEffort')
|
|
300
|
+
) {
|
|
301
|
+
return failure('INVALID_AGENT_CLIENTS', rolePath);
|
|
302
|
+
}
|
|
303
|
+
const model = parseExact(role.model, `${rolePath}.model`);
|
|
304
|
+
if (typeof model !== 'string') return model;
|
|
305
|
+
const reasoningEffort = parseExact(role.reasoningEffort, `${rolePath}.reasoningEffort`);
|
|
306
|
+
if (typeof reasoningEffort !== 'string') return reasoningEffort;
|
|
307
|
+
return { model, reasoningEffort };
|
|
308
|
+
};
|
|
309
|
+
const executor = parseRole(policy.executor, `${entryPath}.orchestration.executor`);
|
|
310
|
+
if (executor.errorCode) return executor;
|
|
311
|
+
const reviewer = parseRole(policy.reviewer, `${entryPath}.orchestration.reviewer`);
|
|
312
|
+
if (reviewer.errorCode) return reviewer;
|
|
313
|
+
orchestration = { executor, reviewer };
|
|
356
314
|
}
|
|
357
315
|
entries.set(candidate.id, {
|
|
358
316
|
enabled: candidate.enabled,
|
|
@@ -360,25 +318,29 @@ function normalizeAgentClientConfig(cfg) {
|
|
|
360
318
|
...(orchestration ? { orchestration } : {})
|
|
361
319
|
});
|
|
362
320
|
}
|
|
363
|
-
if (
|
|
321
|
+
if (AGENT_CLIENT_IDS.some((id) => !entries.has(id))) {
|
|
364
322
|
return failure('MISSING_AGENT_CLIENT', 'agentClients');
|
|
365
323
|
}
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
324
|
+
for (const [index, id] of AGENT_CLIENT_IDS.entries()) {
|
|
325
|
+
if (cfg.agentClients[index]?.id !== id) {
|
|
326
|
+
return failure('INVALID_AGENT_CLIENTS', `agentClients[${index}].id`);
|
|
327
|
+
}
|
|
369
328
|
}
|
|
370
|
-
if (
|
|
371
|
-
|
|
329
|
+
if (own(cfg, 'tuis')) return failure('INVALID_AGENT_CLIENTS', 'tuis');
|
|
330
|
+
const sandbox = cfg.sandbox && typeof cfg.sandbox === 'object' && !Array.isArray(cfg.sandbox)
|
|
331
|
+
? cfg.sandbox
|
|
332
|
+
: undefined;
|
|
333
|
+
if (Array.isArray(sandbox?.tools)) {
|
|
334
|
+
for (const [index, tool] of sandbox.tools.entries()) {
|
|
335
|
+
if (AGENT_CLIENT_IDS.includes(tool)) {
|
|
336
|
+
return failure('INVALID_AGENT_CLIENTS', `sandbox.tools[${index}]`);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
372
339
|
}
|
|
373
|
-
const
|
|
340
|
+
const state = Object.fromEntries(AGENT_CLIENT_IDS.map((id) => [id, entries.get(id)]));
|
|
374
341
|
return {
|
|
375
|
-
source: 'canonical',
|
|
376
342
|
state,
|
|
377
343
|
canonical: serialize(state),
|
|
378
|
-
remainingSandboxTools: hasSandboxTools ? sandboxProjection.remainingTools : undefined,
|
|
379
|
-
removeLegacyTuis: hasLegacyTuis,
|
|
380
|
-
changed: hasLegacyTuis || sandboxProjection.clientSignals.size > 0 || !sameOrder,
|
|
381
|
-
diagnostics,
|
|
382
344
|
error: null,
|
|
383
345
|
errorCode: null,
|
|
384
346
|
errorPath: null
|
|
@@ -387,16 +349,6 @@ function normalizeAgentClientConfig(cfg) {
|
|
|
387
349
|
|
|
388
350
|
function materializeAgentClientConfig(cfg, normalized) {
|
|
389
351
|
cfg.agentClients = normalized.canonical;
|
|
390
|
-
delete cfg.tuis;
|
|
391
|
-
if (normalized.remainingSandboxTools !== undefined) {
|
|
392
|
-
cfg.sandbox = {
|
|
393
|
-
...(cfg.sandbox || {}),
|
|
394
|
-
tools: [
|
|
395
|
-
'agent-infra',
|
|
396
|
-
...normalized.remainingSandboxTools.filter((tool) => tool !== 'agent-infra')
|
|
397
|
-
]
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
352
|
}
|
|
401
353
|
|
|
402
354
|
function assetMatches(entry, target) {
|
|
@@ -483,6 +435,17 @@ function isInsideProject(projectRoot, relativePath) {
|
|
|
483
435
|
return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
484
436
|
}
|
|
485
437
|
|
|
438
|
+
function isInsideProjectDirectory(projectRoot, directory, relativePath) {
|
|
439
|
+
if (!isInsideProject(projectRoot, directory) || !isInsideProject(projectRoot, relativePath)) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
const root = path.resolve(projectRoot, directory);
|
|
444
|
+
const resolved = path.resolve(projectRoot, relativePath);
|
|
445
|
+
const rel = path.relative(root, resolved);
|
|
446
|
+
return rel !== '' && !rel.startsWith('..') && !path.isAbsolute(rel);
|
|
447
|
+
}
|
|
448
|
+
|
|
486
449
|
function isPathOwnedByOtherPlatform(relativePath, platformType) {
|
|
487
450
|
const normalized = norm(relativePath).replace(/^\.\//, '');
|
|
488
451
|
const top = normalized.split('/')[0];
|
|
@@ -1310,7 +1273,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
|
|
|
1310
1273
|
return { error: enabledResolution.error };
|
|
1311
1274
|
}
|
|
1312
1275
|
const enabledTUIs = new Set(
|
|
1313
|
-
|
|
1276
|
+
AGENT_CLIENT_IDS.filter((id) => enabledResolution.state[id].enabled)
|
|
1314
1277
|
);
|
|
1315
1278
|
materializeAgentClientConfig(cfg, enabledResolution);
|
|
1316
1279
|
const customTUIsConfig = Array.isArray(cfg.customTUIs) ? cfg.customTUIs : [];
|
|
@@ -1330,6 +1293,10 @@ function syncTemplates(projectRoot, templateRootOverride) {
|
|
|
1330
1293
|
(descriptor.templateHashes || []).map(trustedBaseline).filter(Boolean)
|
|
1331
1294
|
)];
|
|
1332
1295
|
}));
|
|
1296
|
+
const retiredManagedForTarget = (target) => [...retiredManaged.entries()].find(
|
|
1297
|
+
([entry]) => assetMatches(entry, target)
|
|
1298
|
+
&& (!entry.endsWith('/') || isInsideProjectDirectory(projectRoot, entry, target))
|
|
1299
|
+
);
|
|
1333
1300
|
const planningRegistry = {
|
|
1334
1301
|
...currentRegistry,
|
|
1335
1302
|
managed: currentRegistry.managed.filter((entry) => !retiredManaged.has(norm(entry)))
|
|
@@ -1358,7 +1325,7 @@ function syncTemplates(projectRoot, templateRootOverride) {
|
|
|
1358
1325
|
for (const target of Object.keys(managedBaselines)) {
|
|
1359
1326
|
if (
|
|
1360
1327
|
!guardedManaged.has(norm(target))
|
|
1361
|
-
&& !
|
|
1328
|
+
&& !retiredManagedForTarget(target)
|
|
1362
1329
|
&& !allClientManaged.some((entry) => assetMatches(entry, target))
|
|
1363
1330
|
) {
|
|
1364
1331
|
delete managedBaselines[target];
|
|
@@ -1434,8 +1401,72 @@ function syncTemplates(projectRoot, templateRootOverride) {
|
|
|
1434
1401
|
);
|
|
1435
1402
|
|
|
1436
1403
|
for (const [entry, historicalTemplateHashes] of retiredManaged) {
|
|
1437
|
-
const target = path.join(projectRoot, entry);
|
|
1404
|
+
const target = path.join(projectRoot, entry.endsWith('/') ? entry.slice(0, -1) : entry);
|
|
1438
1405
|
const owned = currentRegistry.managed.some((candidate) => norm(candidate) === entry);
|
|
1406
|
+
if (entry.endsWith('/')) {
|
|
1407
|
+
if (fs.existsSync(target)) {
|
|
1408
|
+
const targetStat = fs.lstatSync(target);
|
|
1409
|
+
if (!targetStat.isDirectory() || targetStat.isSymbolicLink()) {
|
|
1410
|
+
report.managed.protected.push({
|
|
1411
|
+
target: entry,
|
|
1412
|
+
reason: 'invalid-type',
|
|
1413
|
+
baseline: null,
|
|
1414
|
+
local: null,
|
|
1415
|
+
template: null
|
|
1416
|
+
});
|
|
1417
|
+
continue;
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
const candidates = new Set(
|
|
1421
|
+
Object.keys(managedBaselines).filter((candidate) =>
|
|
1422
|
+
assetMatches(entry, candidate)
|
|
1423
|
+
&& isInsideProjectDirectory(projectRoot, entry, candidate)
|
|
1424
|
+
)
|
|
1425
|
+
);
|
|
1426
|
+
if (owned && fs.existsSync(target)) {
|
|
1427
|
+
for (const filePath of walkDir(target)) {
|
|
1428
|
+
candidates.add(norm(path.relative(projectRoot, filePath)));
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
for (const candidate of candidates) {
|
|
1433
|
+
const candidatePath = path.join(projectRoot, candidate);
|
|
1434
|
+
const baseline = trustedBaseline(managedBaselines[candidate]);
|
|
1435
|
+
if (!fs.existsSync(candidatePath)) {
|
|
1436
|
+
if (Object.prototype.hasOwnProperty.call(managedBaselines, candidate)) {
|
|
1437
|
+
delete managedBaselines[candidate];
|
|
1438
|
+
baselinesChanged = true;
|
|
1439
|
+
}
|
|
1440
|
+
continue;
|
|
1441
|
+
}
|
|
1442
|
+
const stat = fs.lstatSync(candidatePath);
|
|
1443
|
+
const localHash = stat.isFile() && !stat.isSymbolicLink()
|
|
1444
|
+
? sha256(fs.readFileSync(candidatePath))
|
|
1445
|
+
: null;
|
|
1446
|
+
const safeToRemove = localHash !== null
|
|
1447
|
+
&& (localHash === baseline || historicalTemplateHashes.has(localHash));
|
|
1448
|
+
if (safeToRemove) {
|
|
1449
|
+
fs.unlinkSync(candidatePath);
|
|
1450
|
+
report.managed.removed.push(candidate);
|
|
1451
|
+
} else {
|
|
1452
|
+
report.managed.protected.push({
|
|
1453
|
+
target: candidate,
|
|
1454
|
+
reason: localHash === null
|
|
1455
|
+
? 'invalid-type'
|
|
1456
|
+
: (baseline !== null ? 'user-modified' : 'unknown-origin'),
|
|
1457
|
+
baseline,
|
|
1458
|
+
local: localHash,
|
|
1459
|
+
template: null
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
if (Object.prototype.hasOwnProperty.call(managedBaselines, candidate)) {
|
|
1463
|
+
delete managedBaselines[candidate];
|
|
1464
|
+
baselinesChanged = true;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
removeEmptyDirs(target);
|
|
1468
|
+
continue;
|
|
1469
|
+
}
|
|
1439
1470
|
if (!fs.existsSync(target)) continue;
|
|
1440
1471
|
const stat = fs.lstatSync(target);
|
|
1441
1472
|
const baseline = trustedBaseline(managedBaselines[entry]);
|
|
@@ -21,7 +21,7 @@ Version stamp rule: before creating or updating `task.md` frontmatter, read `.ag
|
|
|
21
21
|
|
|
22
22
|
## Task Context Resolution
|
|
23
23
|
|
|
24
|
-
> Keep `--pr <number>` and PR URLs on the existing PR-anchored path. Otherwise, the task path may omit the task ref
|
|
24
|
+
> Keep `--pr <number>` and PR URLs on the existing PR-anchored path. Otherwise, the task path may omit the task ref; explicit task scope accepts only `--task <ref>` or `-t <ref>`, and positional task refs are not interpreted. Separate task scope from the full arguments, then call `agent-infra-internal task-context resolve {task-scope}` and bind `{task-id}` to the returned full `taskId`. A PR anchor and task scope are mutually exclusive.
|
|
25
25
|
|
|
26
26
|
## Step Start: Write the started Marker
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ After prerequisites pass and before this round's first artifact action, append a
|
|
|
40
40
|
Resolve the target PR number `{pr#}` and an optional `{task-id}` via these deterministic branches:
|
|
41
41
|
|
|
42
42
|
- Scenario A (argument omitted): reverse-lookup the active task from the current branch, then read its `pr_number`.
|
|
43
|
-
- Scenario B (omitted task ref
|
|
43
|
+
- Scenario B (omitted task ref or `--task/-t`, **task-anchored primary path**): resolve the full `{task-id}` via "Task Context Resolution" and read `.agents/workspace/active/{task-id}/task.md` for `pr_number` as `{pr#}`; if `pr_number` is empty, follow "Error Handling" to prompt running `create-pr` first, then stop.
|
|
44
44
|
- Scenario C (`--pr <number>` or a PR URL): use that PR number directly as `{pr#}`; then determine `{task-id}` via "Reverse-lookup task".
|
|
45
45
|
- Reverse-lookup task (scenarios A / C): use task context/query capabilities to find the unique active task bound to `{pr#}`. If none exists, stop and request binding first; the typed checks intent does not create a second taskless state machine.
|
|
46
46
|
|
|
@@ -21,7 +21,7 @@ description: >
|
|
|
21
21
|
|
|
22
22
|
## 任务上下文解析
|
|
23
23
|
|
|
24
|
-
> 入口允许省略 task ref
|
|
24
|
+
> 入口允许省略 task ref,也接受 `--task <ref>` / `-t <ref>`。先从完整参数中分离 task scope 并原样保留其他业务操作数,再调用 `agent-infra-internal task-context resolve {task-scope}`;`{task-scope}` 为空或 task flag 之一。只读取结构化结果的 `taskId`,后续把 `{task-id}` 绑定为该完整 `TASK-YYYYMMDD-HHMMSS`。解析失败时透传非零退出码,不自行扫描任务。
|
|
25
25
|
|
|
26
26
|
## 步骤开始:写入 started 标记
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ description: >
|
|
|
40
40
|
按以下确定性分支解析出目标 PR 号 `{pr#}` 与可选 `{task-id}`:
|
|
41
41
|
|
|
42
42
|
- 场景 A(省略入参):从当前分支反查 active task;定位后读取其 `pr_number`。
|
|
43
|
-
- 场景 B(省略 task ref
|
|
43
|
+
- 场景 B(省略 task ref 或 `--task/-t`,**任务锚定主路径**):按「任务上下文解析」取得完整 `{task-id}`。读 `.agents/workspace/active/{task-id}/task.md` 取 `pr_number` 作为 `{pr#}`;`pr_number` 为空时按「错误处理」提示先 `create-pr`,停止。
|
|
44
44
|
- 场景 C(`--pr <number>` 或 PR URL):直接取该 PR 号为 `{pr#}`;随后按「反查任务」确定 `{task-id}`。
|
|
45
45
|
- 反查任务(场景 A / C):通过任务上下文/任务查询取得与 `{pr#}` 唯一绑定的 active task。未命中时停止并提示先绑定 PR;typed checks intent 不建立第二套无任务状态机。
|
|
46
46
|
|
|
@@ -80,7 +80,7 @@ pr_status: pending # PR status: pending (default) | created (PR crea
|
|
|
80
80
|
|
|
81
81
|
## Human Rulings
|
|
82
82
|
|
|
83
|
-
<!-- Use ai decide <
|
|
83
|
+
<!-- Use ai decide [--task <ref> | -t <ref>] (--item <ordinal|ledger-id> | -i <ordinal|ledger-id>) [--needs-implementation true|false] <decision> for needs-human-decision rulings; upstream AI predeclares implementation intent for new code decisions, while the explicit option remains for legacy tasks or consistency checks. -->
|
|
84
84
|
|
|
85
85
|
## Implementation Inputs
|
|
86
86
|
|
|
@@ -80,7 +80,7 @@ pr_status: pending # PR 状态:pending(默认)| created(已
|
|
|
80
80
|
|
|
81
81
|
## 人工裁决
|
|
82
82
|
|
|
83
|
-
<!-- 使用 ai decide <
|
|
83
|
+
<!-- 使用 ai decide [--task <ref> | -t <ref>] (--item <序号|账本ID> | -i <序号|账本ID>) [--needs-implementation true|false] <裁决内容> 写入 needs-human-decision 裁定;新建 code 裁决的实现意图由上游 AI 预先声明,显式参数仅用于历史任务兼容或一致性复核。 -->
|
|
84
84
|
|
|
85
85
|
## 实现输入
|
|
86
86
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Analyze a task and produce a requirements document"
|
|
3
|
-
usage: "/analyze-task [task
|
|
3
|
+
usage: "/analyze-task [--task <ref> | -t <ref>]"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Read and execute the analyze-task skill from `.agents/skills/analyze-task/SKILL.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Mark PR manual validation as completed and update the summary comment"
|
|
3
|
-
usage: "/complete-manual-validation [task
|
|
3
|
+
usage: "/complete-manual-validation [--task <ref> | -t <ref>] [pr-ref] <verification-summary>"
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "标记 PR 人工验证已完成并更新摘要评论"
|
|
3
|
-
usage: "/complete-manual-validation [task
|
|
3
|
+
usage: "/complete-manual-validation [--task <ref> | -t <ref>] [pr-ref] <verification-summary>"
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Mark a task as completed and archive it"
|
|
3
|
-
usage: "/complete-task [task
|
|
3
|
+
usage: "/complete-task [--task <ref> | -t <ref>] [--skip-pr] [--force]"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Read and execute the complete-task skill from `.agents/skills/complete-task/SKILL.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Create a Pull Request to a target branch"
|
|
3
|
-
usage: "/create-pr [task
|
|
3
|
+
usage: "/create-pr [--task <ref> | -t <ref>] [target-branch]"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Read and execute the create-pr skill from `.agents/skills/create-pr/SKILL.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: "Review code implementation and output a code review report"
|
|
3
|
-
usage: "/review-code [task
|
|
3
|
+
usage: "/review-code [--task <ref> | -t <ref>]"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
Read and execute the review-code skill from `.agents/skills/review-code/SKILL.md`.
|