@renxqoo/renx-code 0.0.4 → 0.0.5
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/bin/renx.cjs +16 -0
- package/package.json +2 -45
- package/src/agent/runtime/runtime.context-usage.test.ts +4 -5
- package/src/agent/runtime/runtime.error-handling.test.ts +4 -5
- package/src/agent/runtime/runtime.test.ts +7 -4
- package/src/agent/runtime/runtime.ts +3 -9
- package/src/agent/runtime/runtime.usage-forwarding.test.ts +4 -5
- package/src/agent/runtime/source-modules.test.ts +16 -35
- package/src/agent/runtime/source-modules.ts +17 -0
- package/vendor/agent-root/src/agent/ENTERPRISE_ACCEPTANCE_CHECKLIST.md +95 -0
- package/vendor/agent-root/src/agent/ENTERPRISE_REALTIME.html +1345 -0
- package/vendor/agent-root/src/agent/ENTERPRISE_REALTIME.md +1353 -0
- package/vendor/agent-root/src/agent/ERROR_CONTRACT.md +60 -0
- package/vendor/agent-root/src/agent/TEST_COVERAGE_ANALYSIS.md +278 -0
- package/vendor/agent-root/src/agent/__test__/error-contract.test.ts +72 -0
- package/vendor/agent-root/src/agent/__test__/types.test.ts +137 -0
- package/vendor/agent-root/src/agent/agent/__test__/abort-runtime.test.ts +83 -0
- package/vendor/agent-root/src/agent/agent/__test__/callback-safety.test.ts +34 -0
- package/vendor/agent-root/src/agent/agent/__test__/compaction.test.ts +323 -0
- package/vendor/agent-root/src/agent/agent/__test__/concurrency.test.ts +290 -0
- package/vendor/agent-root/src/agent/agent/__test__/error-normalizer.test.ts +377 -0
- package/vendor/agent-root/src/agent/agent/__test__/error.test.ts +212 -0
- package/vendor/agent-root/src/agent/agent/__test__/fault-injection.test.ts +295 -0
- package/vendor/agent-root/src/agent/agent/__test__/index.test.ts +3607 -0
- package/vendor/agent-root/src/agent/agent/__test__/logger.test.ts +35 -0
- package/vendor/agent-root/src/agent/agent/__test__/message-utils.test.ts +517 -0
- package/vendor/agent-root/src/agent/agent/__test__/telemetry.test.ts +97 -0
- package/vendor/agent-root/src/agent/agent/__test__/timeout-budget.test.ts +479 -0
- package/vendor/agent-root/src/agent/agent/__test__/tool-call-merge.test.ts +80 -0
- package/vendor/agent-root/src/agent/agent/__test__/tool-execution-ledger.test.ts +76 -0
- package/vendor/agent-root/src/agent/agent/__test__/write-buffer.test.ts +173 -0
- package/vendor/agent-root/src/agent/agent/__test__/write-file-session.test.ts +109 -0
- package/vendor/agent-root/src/agent/agent/abort-runtime.ts +71 -0
- package/vendor/agent-root/src/agent/agent/callback-safety.ts +33 -0
- package/vendor/agent-root/src/agent/agent/compaction.ts +291 -0
- package/vendor/agent-root/src/agent/agent/concurrency.ts +103 -0
- package/vendor/agent-root/src/agent/agent/error-normalizer.ts +190 -0
- package/vendor/agent-root/src/agent/agent/error.ts +198 -0
- package/vendor/agent-root/src/agent/agent/index.ts +1772 -0
- package/vendor/agent-root/src/agent/agent/logger.ts +65 -0
- package/vendor/agent-root/src/agent/agent/message-utils.ts +101 -0
- package/vendor/agent-root/src/agent/agent/stream-events.ts +61 -0
- package/vendor/agent-root/src/agent/agent/telemetry.ts +123 -0
- package/vendor/agent-root/src/agent/agent/timeout-budget.ts +227 -0
- package/vendor/agent-root/src/agent/agent/tool-call-merge.ts +111 -0
- package/vendor/agent-root/src/agent/agent/tool-execution-ledger.ts +164 -0
- package/vendor/agent-root/src/agent/agent/write-buffer.ts +188 -0
- package/vendor/agent-root/src/agent/agent/write-file-session.ts +238 -0
- package/vendor/agent-root/src/agent/app/__test__/agent-app-service.test.ts +1053 -0
- package/vendor/agent-root/src/agent/app/__test__/minimal-agent-application.test.ts +158 -0
- package/vendor/agent-root/src/agent/app/__test__/sqlite-agent-app-store.test.ts +437 -0
- package/vendor/agent-root/src/agent/app/agent-app-service.ts +748 -0
- package/vendor/agent-root/src/agent/app/contracts.ts +109 -0
- package/vendor/agent-root/src/agent/app/index.ts +5 -0
- package/vendor/agent-root/src/agent/app/minimal-agent-application.ts +151 -0
- package/vendor/agent-root/src/agent/app/ports.ts +72 -0
- package/vendor/agent-root/src/agent/app/sqlite-agent-app-store.ts +1182 -0
- package/vendor/agent-root/src/agent/app/sqlite-client.ts +177 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/00-README.md +36 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/01-scope-and-goals.md +33 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/02-architecture-overview.md +40 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/03-domain-model-and-contracts.md +91 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/04-ports-and-interfaces.md +116 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/05-run-orchestration-and-state-machine.md +52 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/06-cli-commands-and-ux.md +53 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/07-storage-design-local.md +52 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/08-error-and-observability.md +40 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/09-security-and-policy-boundary.md +19 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/10-test-plan-and-acceptance.md +28 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/11-implementation-phases.md +26 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/12-open-questions-and-risks.md +30 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/13-sqlite-schema-fields-and-rationale.md +567 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/14-project-flow-mermaid.md +583 -0
- package/vendor/agent-root/src/agent/docs/cli-app-layer/15-openclaw-style-project-blueprint.md +972 -0
- package/vendor/agent-root/src/agent/error-contract.ts +154 -0
- package/vendor/agent-root/src/agent/prompts/system.ts +246 -0
- package/vendor/agent-root/src/agent/prompts/system1.ts +208 -0
- package/vendor/agent-root/src/agent/storage/__test__/file-history-store.test.ts +98 -0
- package/vendor/agent-root/src/agent/storage/file-history-store.ts +313 -0
- package/vendor/agent-root/src/agent/storage/file-storage-config.ts +94 -0
- package/vendor/agent-root/src/agent/storage/file-system.ts +31 -0
- package/vendor/agent-root/src/agent/storage/file-write-service.ts +21 -0
- package/vendor/agent-root/src/agent/tool/__test__/base-tool.test.ts +413 -0
- package/vendor/agent-root/src/agent/tool/__test__/bash-policy.test.ts +356 -0
- package/vendor/agent-root/src/agent/tool/__test__/bash.mocked-coverage.test.ts +375 -0
- package/vendor/agent-root/src/agent/tool/__test__/bash.test.ts +372 -0
- package/vendor/agent-root/src/agent/tool/__test__/error.test.ts +108 -0
- package/vendor/agent-root/src/agent/tool/__test__/file-edit-tool.test.ts +258 -0
- package/vendor/agent-root/src/agent/tool/__test__/file-history-tools.test.ts +121 -0
- package/vendor/agent-root/src/agent/tool/__test__/file-read-tool.test.ts +210 -0
- package/vendor/agent-root/src/agent/tool/__test__/glob.test.ts +139 -0
- package/vendor/agent-root/src/agent/tool/__test__/grep.mocked-coverage.test.ts +456 -0
- package/vendor/agent-root/src/agent/tool/__test__/grep.test.ts +192 -0
- package/vendor/agent-root/src/agent/tool/__test__/lsp.test.ts +300 -0
- package/vendor/agent-root/src/agent/tool/__test__/outside-workspace-confirmation.test.ts +214 -0
- package/vendor/agent-root/src/agent/tool/__test__/path-security.test.ts +336 -0
- package/vendor/agent-root/src/agent/tool/__test__/skill-loader.test.ts +494 -0
- package/vendor/agent-root/src/agent/tool/__test__/skill-parser.test.ts +543 -0
- package/vendor/agent-root/src/agent/tool/__test__/skill-tool.test.ts +172 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-concurrency-and-version.test.ts +116 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-create-get-list-update.test.ts +267 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-create.test.ts +519 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-errors.test.ts +225 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-output-blocking.test.ts +223 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-output.test.ts +184 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-parent-abort.test.ts +287 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-real-runner-adapter.test.ts +190 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-run-lifecycle.test.ts +352 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-store-runner-branches.test.ts +395 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-store.test.ts +391 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-subagent-config-integration.test.ts +176 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-subagent-config.test.ts +68 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-tools-core-edges.test.ts +630 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-tools-runtime-edges.test.ts +732 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-types.test.ts +494 -0
- package/vendor/agent-root/src/agent/tool/__test__/task-utils-branches.test.ts +175 -0
- package/vendor/agent-root/src/agent/tool/__test__/tool-manager.test.ts +505 -0
- package/vendor/agent-root/src/agent/tool/__test__/types.test.ts +55 -0
- package/vendor/agent-root/src/agent/tool/__test__/web-fetch.test.ts +244 -0
- package/vendor/agent-root/src/agent/tool/__test__/web-search.test.ts +290 -0
- package/vendor/agent-root/src/agent/tool/__test__/write-file.test.ts +368 -0
- package/vendor/agent-root/src/agent/tool/base-tool.ts +345 -0
- package/vendor/agent-root/src/agent/tool/bash-policy.ts +636 -0
- package/vendor/agent-root/src/agent/tool/bash.ts +688 -0
- package/vendor/agent-root/src/agent/tool/error.ts +131 -0
- package/vendor/agent-root/src/agent/tool/file-edit-tool.ts +264 -0
- package/vendor/agent-root/src/agent/tool/file-history-list.ts +103 -0
- package/vendor/agent-root/src/agent/tool/file-history-restore.ts +149 -0
- package/vendor/agent-root/src/agent/tool/file-read-tool.ts +211 -0
- package/vendor/agent-root/src/agent/tool/glob.ts +171 -0
- package/vendor/agent-root/src/agent/tool/grep.ts +496 -0
- package/vendor/agent-root/src/agent/tool/lsp.ts +481 -0
- package/vendor/agent-root/src/agent/tool/path-security.ts +117 -0
- package/vendor/agent-root/src/agent/tool/search/common.ts +153 -0
- package/vendor/agent-root/src/agent/tool/skill/index.ts +13 -0
- package/vendor/agent-root/src/agent/tool/skill/loader.ts +229 -0
- package/vendor/agent-root/src/agent/tool/skill/parser.ts +124 -0
- package/vendor/agent-root/src/agent/tool/skill/types.ts +27 -0
- package/vendor/agent-root/src/agent/tool/skill-tool.ts +143 -0
- package/vendor/agent-root/src/agent/tool/task-create.ts +186 -0
- package/vendor/agent-root/src/agent/tool/task-errors.ts +42 -0
- package/vendor/agent-root/src/agent/tool/task-get.ts +116 -0
- package/vendor/agent-root/src/agent/tool/task-graph.ts +78 -0
- package/vendor/agent-root/src/agent/tool/task-list.ts +141 -0
- package/vendor/agent-root/src/agent/tool/task-mock-runner-adapter.ts +232 -0
- package/vendor/agent-root/src/agent/tool/task-output.ts +223 -0
- package/vendor/agent-root/src/agent/tool/task-parent-abort.ts +115 -0
- package/vendor/agent-root/src/agent/tool/task-real-runner-adapter.ts +336 -0
- package/vendor/agent-root/src/agent/tool/task-runner-adapter.ts +55 -0
- package/vendor/agent-root/src/agent/tool/task-stop.ts +187 -0
- package/vendor/agent-root/src/agent/tool/task-store.ts +217 -0
- package/vendor/agent-root/src/agent/tool/task-subagent-config.ts +149 -0
- package/vendor/agent-root/src/agent/tool/task-types.ts +264 -0
- package/vendor/agent-root/src/agent/tool/task-update.ts +315 -0
- package/vendor/agent-root/src/agent/tool/task.ts +209 -0
- package/vendor/agent-root/src/agent/tool/tool-manager.ts +362 -0
- package/vendor/agent-root/src/agent/tool/tool-prompts.ts +242 -0
- package/vendor/agent-root/src/agent/tool/types.ts +116 -0
- package/vendor/agent-root/src/agent/tool/web-fetch.ts +227 -0
- package/vendor/agent-root/src/agent/tool/web-search.ts +208 -0
- package/vendor/agent-root/src/agent/tool/write-file.ts +497 -0
- package/vendor/agent-root/src/agent/types.ts +232 -0
- package/vendor/agent-root/src/agent/utils/__tests__/index.test.ts +18 -0
- package/vendor/agent-root/src/agent/utils/__tests__/message-utils.test.ts +610 -0
- package/vendor/agent-root/src/agent/utils/__tests__/message.test.ts +223 -0
- package/vendor/agent-root/src/agent/utils/__tests__/token.test.ts +42 -0
- package/vendor/agent-root/src/agent/utils/index.ts +16 -0
- package/vendor/agent-root/src/agent/utils/message.ts +171 -0
- package/vendor/agent-root/src/agent/utils/token.ts +28 -0
- package/vendor/agent-root/src/config/__tests__/load-config-to-env.test.ts +129 -0
- package/vendor/agent-root/src/config/__tests__/loader.test.ts +247 -0
- package/vendor/agent-root/src/config/__tests__/runtime.test.ts +88 -0
- package/vendor/agent-root/src/config/index.ts +54 -0
- package/vendor/agent-root/src/config/loader.ts +431 -0
- package/vendor/agent-root/src/config/paths.ts +30 -0
- package/vendor/agent-root/src/config/runtime.ts +163 -0
- package/vendor/agent-root/src/config/types.ts +70 -0
- package/vendor/agent-root/src/logger/index.ts +57 -0
- package/vendor/agent-root/src/logger/logger.ts +819 -0
- package/vendor/agent-root/src/logger/types.ts +150 -0
- package/vendor/agent-root/src/providers/__tests__/errors.test.ts +441 -0
- package/vendor/agent-root/src/providers/__tests__/index.test.ts +16 -0
- package/vendor/agent-root/src/providers/__tests__/openai-compatible.options.test.ts +318 -0
- package/vendor/agent-root/src/providers/__tests__/openai-compatible.test.ts +600 -0
- package/vendor/agent-root/src/providers/__tests__/registry.test.ts +449 -0
- package/vendor/agent-root/src/providers/__tests__/responses-adapter.test.ts +298 -0
- package/vendor/agent-root/src/providers/adapters/__tests__/anthropic.test.ts +354 -0
- package/vendor/agent-root/src/providers/adapters/__tests__/kimi.test.ts +58 -0
- package/vendor/agent-root/src/providers/adapters/__tests__/standard.test.ts +261 -0
- package/vendor/agent-root/src/providers/adapters/anthropic.ts +572 -0
- package/vendor/agent-root/src/providers/adapters/base.ts +131 -0
- package/vendor/agent-root/src/providers/adapters/kimi.ts +48 -0
- package/vendor/agent-root/src/providers/adapters/responses.ts +732 -0
- package/vendor/agent-root/src/providers/adapters/standard.ts +120 -0
- package/vendor/agent-root/src/providers/http/__tests__/client.timeout.test.ts +313 -0
- package/vendor/agent-root/src/providers/http/client.ts +289 -0
- package/vendor/agent-root/src/providers/http/stream-parser.ts +109 -0
- package/vendor/agent-root/src/providers/index.ts +76 -0
- package/vendor/agent-root/src/providers/kimi-headers.ts +177 -0
- package/vendor/agent-root/src/providers/openai-compatible.ts +387 -0
- package/vendor/agent-root/src/providers/registry/model-config.ts +230 -0
- package/vendor/agent-root/src/providers/registry/provider-factory.ts +123 -0
- package/vendor/agent-root/src/providers/registry.ts +135 -0
- package/vendor/agent-root/src/providers/types/api.ts +284 -0
- package/vendor/agent-root/src/providers/types/config.ts +58 -0
- package/vendor/agent-root/src/providers/types/errors.ts +323 -0
- package/vendor/agent-root/src/providers/types/index.ts +72 -0
- package/vendor/agent-root/src/providers/types/provider.ts +45 -0
- package/vendor/agent-root/src/providers/types/registry.ts +88 -0
package/bin/renx.cjs
CHANGED
|
@@ -6,8 +6,23 @@ const path = require("node:path");
|
|
|
6
6
|
|
|
7
7
|
const packageRoot = path.resolve(__dirname, "..");
|
|
8
8
|
const entryPath = path.join(packageRoot, "src", "index.tsx");
|
|
9
|
+
const packagedRepoRoot = path.join(packageRoot, "vendor", "agent-root");
|
|
10
|
+
const localRepoRoot = path.resolve(packageRoot, "..");
|
|
9
11
|
const bunExecutable = process.env.RENX_BUN_PATH || "bun";
|
|
10
12
|
|
|
13
|
+
const hasAgentSourceRoot = root =>
|
|
14
|
+
fs.existsSync(path.join(root, "src", "providers", "index.ts")) &&
|
|
15
|
+
fs.existsSync(path.join(root, "src", "config", "index.ts")) &&
|
|
16
|
+
fs.existsSync(path.join(root, "src", "agent", "app", "index.ts"));
|
|
17
|
+
|
|
18
|
+
const resolvedRepoRoot =
|
|
19
|
+
process.env.AGENT_REPO_ROOT ||
|
|
20
|
+
(hasAgentSourceRoot(packagedRepoRoot)
|
|
21
|
+
? packagedRepoRoot
|
|
22
|
+
: hasAgentSourceRoot(localRepoRoot)
|
|
23
|
+
? localRepoRoot
|
|
24
|
+
: undefined);
|
|
25
|
+
|
|
11
26
|
if (!fs.existsSync(entryPath)) {
|
|
12
27
|
console.error(`Could not find CLI entrypoint: ${entryPath}`);
|
|
13
28
|
process.exit(1);
|
|
@@ -19,6 +34,7 @@ const result = childProcess.spawnSync(bunExecutable, [entryPath, ...process.argv
|
|
|
19
34
|
env: {
|
|
20
35
|
...process.env,
|
|
21
36
|
AGENT_WORKDIR: process.env.AGENT_WORKDIR || process.cwd(),
|
|
37
|
+
...(resolvedRepoRoot ? { AGENT_REPO_ROOT: resolvedRepoRoot } : {}),
|
|
22
38
|
},
|
|
23
39
|
});
|
|
24
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renxqoo/renx-code",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"module": "src/index.tsx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -10,57 +10,14 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"bin",
|
|
12
12
|
"src",
|
|
13
|
+
"vendor",
|
|
13
14
|
"README.md",
|
|
14
15
|
"tsconfig.json"
|
|
15
16
|
],
|
|
16
|
-
"scripts": {
|
|
17
|
-
"dev": "bun run src/index.tsx",
|
|
18
|
-
"dev:watch": "bun run --watch src/index.tsx",
|
|
19
|
-
"lint": "eslint . --ext .ts,.tsx",
|
|
20
|
-
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
21
|
-
"format": "prettier --write .",
|
|
22
|
-
"format:check": "prettier --check .",
|
|
23
|
-
"test:run": "bun test src/context-usage-regressions.test.ts src/ui/theme.simple.test.ts src/ui/theme.test.ts src/runtime/exit.test.ts src/runtime/clipboard.test.ts src/runtime/terminal-theme.test.ts src/utils/time.test.ts src/components/tool-confirm-dialog-content.test.ts src/hooks/chat-local-replies.fixed.test.ts src/hooks/chat-local-replies.test.ts src/hooks/turn-updater.test.ts src/hooks/agent-event-handlers.test.ts src/hooks/use-agent-chat.status.test.ts src/files/attachment-capabilities.test.ts src/files/file-mention-query.test.ts src/commands/slash-commands.test.ts src/agent/runtime/runtime.simple.test.ts src/agent/runtime/tool-call-buffer.test.ts src/components/chat/assistant-reply.test.tsx src/components/chat/assistant-segment.test.ts src/components/chat/code-block.test.tsx src/components/chat/segment-groups.test.ts",
|
|
24
|
-
"type-check": "tsc --noEmit",
|
|
25
|
-
"check": "bun run type-check && bun run lint && bun run format:check",
|
|
26
|
-
"pack:dry": "npm pack --dry-run",
|
|
27
|
-
"pack:tgz": "npm pack",
|
|
28
|
-
"version:fix": "npm version patch",
|
|
29
|
-
"version:feature": "npm version minor",
|
|
30
|
-
"version:breaking": "npm version major",
|
|
31
|
-
"publish:fix": "npm run version:fix && npm publish",
|
|
32
|
-
"publish:feature": "npm run version:feature && npm publish",
|
|
33
|
-
"publish:breaking": "npm run version:breaking && npm publish",
|
|
34
|
-
"publish:patch": "npm run publish:fix",
|
|
35
|
-
"publish:minor": "npm run publish:feature",
|
|
36
|
-
"publish:major": "npm run publish:breaking",
|
|
37
|
-
"proxy": "w2 start",
|
|
38
|
-
"proxy:stop": "w2 stop",
|
|
39
|
-
"proxy:restart": "w2 restart"
|
|
40
|
-
},
|
|
41
17
|
"engines": {
|
|
42
18
|
"node": ">=20.0.0",
|
|
43
19
|
"bun": ">=1.1.0"
|
|
44
20
|
},
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@eslint/js": "^10.0.1",
|
|
47
|
-
"@testing-library/react": "^16.3.2",
|
|
48
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
49
|
-
"@testing-library/user-event": "^14.6.1",
|
|
50
|
-
"@types/bun": "latest",
|
|
51
|
-
"@types/react": "^19.2.14",
|
|
52
|
-
"@types/react-dom": "^19.2.3",
|
|
53
|
-
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
54
|
-
"@typescript-eslint/parser": "^8.57.0",
|
|
55
|
-
"eslint": "^10.0.3",
|
|
56
|
-
"eslint-config-prettier": "^10.1.8",
|
|
57
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
58
|
-
"eslint-plugin-react": "^7.37.5",
|
|
59
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
60
|
-
"globals": "^17.4.0",
|
|
61
|
-
"prettier": "^3.8.1",
|
|
62
|
-
"whistle": "^2.10.1"
|
|
63
|
-
},
|
|
64
21
|
"peerDependencies": {
|
|
65
22
|
"typescript": "^5.9.3"
|
|
66
23
|
},
|
|
@@ -9,10 +9,6 @@ vi.mock('./source-modules', () => ({
|
|
|
9
9
|
resolveWorkspaceRoot: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
vi.mock('../../../../src/agent/prompts/system', () => ({
|
|
13
|
-
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
12
|
import { disposeAgentRuntime, runAgentPrompt } from './runtime';
|
|
17
13
|
import * as sourceModules from './source-modules';
|
|
18
14
|
import type { AgentContextUsageEvent, AgentEventHandlers } from './types';
|
|
@@ -124,7 +120,10 @@ describe('runAgentPrompt context usage forwarding', () => {
|
|
|
124
120
|
createFromEnv: () => ({}),
|
|
125
121
|
},
|
|
126
122
|
loadEnvFiles: vi.fn().mockResolvedValue([]),
|
|
127
|
-
|
|
123
|
+
loadConfigToEnv: vi.fn().mockReturnValue([]),
|
|
124
|
+
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
125
|
+
resolveRenxDatabasePath: vi.fn(() => '/tmp/renx/data.db'),
|
|
126
|
+
resolveRenxTaskDir: vi.fn(() => '/tmp/renx/task'),
|
|
128
127
|
createLoggerFromEnv: vi.fn(() => ({ info: vi.fn(), warn: vi.fn(), error: vi.fn() })),
|
|
129
128
|
createAgentLoggerAdapter: vi.fn((logger: Record<string, unknown>) => ({
|
|
130
129
|
info: typeof logger.info === 'function' ? logger.info.bind(logger) : undefined,
|
|
@@ -9,10 +9,6 @@ vi.mock('./source-modules', () => ({
|
|
|
9
9
|
resolveWorkspaceRoot: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
vi.mock('../../../../src/agent/prompts/system', () => ({
|
|
13
|
-
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
12
|
import { disposeAgentRuntime, runAgentPrompt } from './runtime';
|
|
17
13
|
import * as sourceModules from './source-modules';
|
|
18
14
|
|
|
@@ -95,7 +91,10 @@ describe('runAgentPrompt error handling', () => {
|
|
|
95
91
|
createFromEnv: () => ({}),
|
|
96
92
|
},
|
|
97
93
|
loadEnvFiles: vi.fn().mockResolvedValue([]),
|
|
98
|
-
|
|
94
|
+
loadConfigToEnv: vi.fn().mockReturnValue([]),
|
|
95
|
+
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
96
|
+
resolveRenxDatabasePath: vi.fn(() => '/tmp/renx/data.db'),
|
|
97
|
+
resolveRenxTaskDir: vi.fn(() => '/tmp/renx/task'),
|
|
99
98
|
createLoggerFromEnv,
|
|
100
99
|
createAgentLoggerAdapter: vi.fn(() => ({
|
|
101
100
|
info: vi.fn(),
|
|
@@ -10,10 +10,6 @@ vi.mock('./source-modules', () => ({
|
|
|
10
10
|
resolveWorkspaceRoot: vi.fn(),
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
vi.mock('../../../../src/agent/prompts/system', () => ({
|
|
14
|
-
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
15
|
-
}));
|
|
16
|
-
|
|
17
13
|
import {
|
|
18
14
|
disposeAgentRuntime,
|
|
19
15
|
getAgentModelId,
|
|
@@ -103,6 +99,13 @@ const buildMockModules = () => {
|
|
|
103
99
|
},
|
|
104
100
|
loadEnvFiles: vi.fn().mockResolvedValue([]),
|
|
105
101
|
loadConfigToEnv: vi.fn().mockReturnValue([]),
|
|
102
|
+
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
103
|
+
resolveRenxDatabasePath: vi.fn((env?: NodeJS.ProcessEnv) =>
|
|
104
|
+
path.join(env?.RENX_HOME ?? renxHome, 'data.db')
|
|
105
|
+
),
|
|
106
|
+
resolveRenxTaskDir: vi.fn((env?: NodeJS.ProcessEnv) =>
|
|
107
|
+
path.join(env?.RENX_HOME ?? renxHome, 'task')
|
|
108
|
+
),
|
|
106
109
|
createLoggerFromEnv: vi.fn(() => ({ info: vi.fn(), warn: vi.fn(), error: vi.fn() })),
|
|
107
110
|
createAgentLoggerAdapter: vi.fn((logger: Record<string, unknown>) => ({
|
|
108
111
|
info: typeof logger.info === 'function' ? logger.info.bind(logger) : undefined,
|
|
@@ -30,8 +30,6 @@ import {
|
|
|
30
30
|
type ToolConfirmEventLike,
|
|
31
31
|
} from './source-modules';
|
|
32
32
|
import { ToolCallBuffer } from './tool-call-buffer';
|
|
33
|
-
import { buildSystemPrompt } from '../../../../src/agent/prompts/system';
|
|
34
|
-
import { resolveRenxDatabasePath, resolveRenxTaskDir } from '../../../../src/config/paths';
|
|
35
33
|
import type { AttachmentModelCapabilities } from '../../files/attachment-capabilities';
|
|
36
34
|
import { resolveAttachmentModelCapabilities } from '../../files/attachment-capabilities';
|
|
37
35
|
import type { MessageContent } from '../../types/message-content';
|
|
@@ -129,10 +127,6 @@ const resolveConversationId = () => {
|
|
|
129
127
|
return `opentui-${Date.now()}`;
|
|
130
128
|
};
|
|
131
129
|
|
|
132
|
-
const resolveDbPath = (): string => {
|
|
133
|
-
return resolveRenxDatabasePath(process.env);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
130
|
const buildCliLoggerEnv = (env: NodeJS.ProcessEnv): NodeJS.ProcessEnv => ({
|
|
137
131
|
...env,
|
|
138
132
|
AGENT_LOG_CONSOLE: 'false',
|
|
@@ -359,7 +353,7 @@ const createRuntime = async (): Promise<RuntimeCore> => {
|
|
|
359
353
|
});
|
|
360
354
|
const toolManager = new modules.DefaultToolManager();
|
|
361
355
|
const taskStore = new modules.TaskStore({
|
|
362
|
-
baseDir: resolveRenxTaskDir(process.env),
|
|
356
|
+
baseDir: modules.resolveRenxTaskDir(process.env),
|
|
363
357
|
});
|
|
364
358
|
toolManager.registerTool(new modules.BashTool());
|
|
365
359
|
toolManager.registerTool(
|
|
@@ -411,7 +405,7 @@ const createRuntime = async (): Promise<RuntimeCore> => {
|
|
|
411
405
|
logger: agentLogger,
|
|
412
406
|
});
|
|
413
407
|
|
|
414
|
-
const appStore = modules.createSqliteAgentAppStore(
|
|
408
|
+
const appStore = modules.createSqliteAgentAppStore(modules.resolveRenxDatabasePath(process.env));
|
|
415
409
|
const preparableStore = appStore as AgentAppStoreLike & {
|
|
416
410
|
prepare?: () => Promise<void>;
|
|
417
411
|
};
|
|
@@ -636,7 +630,7 @@ export const runAgentPrompt = async (
|
|
|
636
630
|
conversationId: runtime.conversationId,
|
|
637
631
|
userInput: prompt,
|
|
638
632
|
historyMessages: historyMessages as AgentV4MessageLike[],
|
|
639
|
-
systemPrompt: buildSystemPrompt({ directory: runtime.workspaceRoot }),
|
|
633
|
+
systemPrompt: runtime.modules.buildSystemPrompt({ directory: runtime.workspaceRoot }),
|
|
640
634
|
tools: runtime.parentTools,
|
|
641
635
|
config: resolvePromptCacheConfig(runtime.conversationId),
|
|
642
636
|
maxSteps: runtime.maxSteps,
|
|
@@ -9,10 +9,6 @@ vi.mock('./source-modules', () => ({
|
|
|
9
9
|
resolveWorkspaceRoot: vi.fn(),
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
|
-
vi.mock('../../../../src/agent/prompts/system', () => ({
|
|
13
|
-
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
12
|
import { disposeAgentRuntime, runAgentPrompt } from './runtime';
|
|
17
13
|
import * as sourceModules from './source-modules';
|
|
18
14
|
import type { AgentEventHandlers } from './types';
|
|
@@ -148,7 +144,10 @@ describe('runAgentPrompt usage forwarding', () => {
|
|
|
148
144
|
createFromEnv: () => ({}),
|
|
149
145
|
},
|
|
150
146
|
loadEnvFiles: vi.fn().mockResolvedValue([]),
|
|
151
|
-
|
|
147
|
+
loadConfigToEnv: vi.fn().mockReturnValue([]),
|
|
148
|
+
buildSystemPrompt: vi.fn(() => 'Test system prompt'),
|
|
149
|
+
resolveRenxDatabasePath: vi.fn(() => '/tmp/renx/data.db'),
|
|
150
|
+
resolveRenxTaskDir: vi.fn(() => '/tmp/renx/task'),
|
|
152
151
|
createLoggerFromEnv: vi.fn(() => loggerFromEnv),
|
|
153
152
|
createAgentLoggerAdapter: vi.fn((logger: typeof loggerFromEnv) => ({
|
|
154
153
|
info: (message: string, _context?: Record<string, unknown>, _data?: unknown) =>
|
|
@@ -1,57 +1,38 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
|
|
5
|
-
import { resolveRepoRoot, resolveWorkspaceRoot } from './source-modules';
|
|
3
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
4
|
|
|
7
5
|
const runtimeDir = fileURLToPath(new URL('.', import.meta.url));
|
|
8
6
|
const packageRoot = resolve(runtimeDir, '../../..');
|
|
9
7
|
const workspaceRoot = resolve(runtimeDir, '../../../..');
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const sourceModulesUrl = pathToFileURL(resolve(runtimeDir, 'source-modules.ts')).href;
|
|
9
|
+
|
|
10
|
+
const importSourceModules = async () => {
|
|
11
|
+
return import(`${sourceModulesUrl}?real=${Date.now()}-${Math.random()}`);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
delete process.env.AGENT_REPO_ROOT;
|
|
16
|
+
delete process.env.AGENT_WORKDIR;
|
|
17
|
+
});
|
|
12
18
|
|
|
13
19
|
afterEach(() => {
|
|
14
20
|
vi.restoreAllMocks();
|
|
15
|
-
|
|
16
|
-
if (originalAgentRepoRoot === undefined) {
|
|
17
|
-
delete process.env.AGENT_REPO_ROOT;
|
|
18
|
-
} else {
|
|
19
|
-
process.env.AGENT_REPO_ROOT = originalAgentRepoRoot;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (originalAgentWorkdir === undefined) {
|
|
23
|
-
delete process.env.AGENT_WORKDIR;
|
|
24
|
-
} else {
|
|
25
|
-
process.env.AGENT_WORKDIR = originalAgentWorkdir;
|
|
26
|
-
}
|
|
27
21
|
});
|
|
28
22
|
|
|
29
23
|
describe('resolveRepoRoot', () => {
|
|
30
|
-
it('finds the workspace root when launched from opentui-agent-cli', () => {
|
|
24
|
+
it('finds the workspace root when launched from opentui-agent-cli', async () => {
|
|
25
|
+
const { resolveRepoRoot } = await importSourceModules();
|
|
31
26
|
vi.spyOn(process, 'cwd').mockReturnValue(packageRoot);
|
|
32
27
|
|
|
33
28
|
expect(resolveRepoRoot()).toBe(workspaceRoot);
|
|
34
29
|
});
|
|
35
30
|
|
|
36
|
-
it('respects AGENT_REPO_ROOT when provided', () => {
|
|
31
|
+
it('respects AGENT_REPO_ROOT when provided', async () => {
|
|
32
|
+
const { resolveRepoRoot } = await importSourceModules();
|
|
37
33
|
process.env.AGENT_REPO_ROOT = workspaceRoot;
|
|
38
34
|
vi.spyOn(process, 'cwd').mockReturnValue('D:\\temp\\example-workspace');
|
|
39
35
|
|
|
40
36
|
expect(resolveRepoRoot()).toBe(workspaceRoot);
|
|
41
37
|
});
|
|
42
38
|
});
|
|
43
|
-
|
|
44
|
-
describe('resolveWorkspaceRoot', () => {
|
|
45
|
-
it('defaults to the current working directory', () => {
|
|
46
|
-
vi.spyOn(process, 'cwd').mockReturnValue(packageRoot);
|
|
47
|
-
|
|
48
|
-
expect(resolveWorkspaceRoot()).toBe(packageRoot);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('respects AGENT_WORKDIR when provided', () => {
|
|
52
|
-
process.env.AGENT_WORKDIR = workspaceRoot;
|
|
53
|
-
vi.spyOn(process, 'cwd').mockReturnValue(packageRoot);
|
|
54
|
-
|
|
55
|
-
expect(resolveWorkspaceRoot()).toBe(workspaceRoot);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -167,6 +167,16 @@ export type SourceModules = {
|
|
|
167
167
|
ProviderRegistry: ProviderRegistryLike;
|
|
168
168
|
loadEnvFiles: (cwd?: string) => Promise<string[]>;
|
|
169
169
|
loadConfigToEnv: (options?: Record<string, unknown>) => string[];
|
|
170
|
+
buildSystemPrompt: (options: {
|
|
171
|
+
directory: string;
|
|
172
|
+
language?: string;
|
|
173
|
+
currentDateTime?: string;
|
|
174
|
+
sandboxMode?: string;
|
|
175
|
+
networkPolicy?: string;
|
|
176
|
+
runtimeToolNames?: string[];
|
|
177
|
+
}) => string;
|
|
178
|
+
resolveRenxDatabasePath: (env?: NodeJS.ProcessEnv) => string;
|
|
179
|
+
resolveRenxTaskDir: (env?: NodeJS.ProcessEnv) => string;
|
|
170
180
|
createLoggerFromEnv: (env?: NodeJS.ProcessEnv, cwd?: string) => unknown;
|
|
171
181
|
createAgentLoggerAdapter: (
|
|
172
182
|
logger: Record<string, unknown>,
|
|
@@ -254,6 +264,8 @@ const loadSourceModules = async (): Promise<SourceModules> => {
|
|
|
254
264
|
const [
|
|
255
265
|
providerMod,
|
|
256
266
|
configMod,
|
|
267
|
+
pathConfigMod,
|
|
268
|
+
systemPromptMod,
|
|
257
269
|
appMod,
|
|
258
270
|
agentV4Mod,
|
|
259
271
|
agentLoggerMod,
|
|
@@ -279,6 +291,8 @@ const loadSourceModules = async (): Promise<SourceModules> => {
|
|
|
279
291
|
] = await Promise.all([
|
|
280
292
|
import(toModuleUrl(resolve(repoRoot, 'src/providers/index.ts'))),
|
|
281
293
|
import(toModuleUrl(resolve(repoRoot, 'src/config/index.ts'))),
|
|
294
|
+
import(toModuleUrl(resolve(repoRoot, 'src/config/paths.ts'))),
|
|
295
|
+
import(toModuleUrl(resolve(repoRoot, 'src/agent/prompts/system.ts'))),
|
|
282
296
|
import(toModuleUrl(resolve(repoRoot, 'src/agent/app/index.ts'))),
|
|
283
297
|
import(toModuleUrl(resolve(repoRoot, 'src/agent/agent/index.ts'))),
|
|
284
298
|
import(toModuleUrl(resolve(repoRoot, 'src/agent/agent/logger.ts'))),
|
|
@@ -308,6 +322,9 @@ const loadSourceModules = async (): Promise<SourceModules> => {
|
|
|
308
322
|
ProviderRegistry: getRequiredExport<ProviderRegistryLike>(providerMod, 'ProviderRegistry'),
|
|
309
323
|
loadEnvFiles: getRequiredExport(configMod, 'loadEnvFiles'),
|
|
310
324
|
loadConfigToEnv: getRequiredExport(configMod, 'loadConfigToEnv'),
|
|
325
|
+
buildSystemPrompt: getRequiredExport(systemPromptMod, 'buildSystemPrompt'),
|
|
326
|
+
resolveRenxDatabasePath: getRequiredExport(pathConfigMod, 'resolveRenxDatabasePath'),
|
|
327
|
+
resolveRenxTaskDir: getRequiredExport(pathConfigMod, 'resolveRenxTaskDir'),
|
|
311
328
|
createLoggerFromEnv: getRequiredExport(configMod, 'createLoggerFromEnv'),
|
|
312
329
|
createAgentLoggerAdapter: getRequiredExport(agentLoggerMod, 'createAgentLoggerAdapter'),
|
|
313
330
|
StatelessAgent: getRequiredExport<StatelessAgentCtor>(agentV4Mod, 'StatelessAgent'),
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Agent-V4 企业级验收清单与改造路线图
|
|
2
|
+
|
|
3
|
+
## 1. 文档目的
|
|
4
|
+
- 给 `StatelessAgent` 提供一套可执行、可验收、可持续迭代的企业级基线。
|
|
5
|
+
- 明确 P0/P1 改造顺序,避免“功能堆叠但不可运维”。
|
|
6
|
+
|
|
7
|
+
## 2. 当前基线(已具备)
|
|
8
|
+
- 无状态单轮流程:LLM -> Tool -> 回写消息。
|
|
9
|
+
- 支持流式处理、工具调用、重试退避、`abortSignal`。
|
|
10
|
+
- `write_file` 支持 `direct/finalize` 缓冲写入协议。
|
|
11
|
+
- `agent-v4` 测试已覆盖主流程与关键异常分支。
|
|
12
|
+
|
|
13
|
+
## 3. 验收范围定义
|
|
14
|
+
- 验收对象:`src/agent-v4`。
|
|
15
|
+
- 验收目标:可作为企业级基础内核(非完整平台)。
|
|
16
|
+
- 非目标:多租户平台治理、完整控制面、运营后台。
|
|
17
|
+
|
|
18
|
+
## 4. 企业级验收清单(可量化)
|
|
19
|
+
| 编号 | 项目 | 当前状态 | 验收标准(DoD) | 优先级 |
|
|
20
|
+
|---|---|---|---|---|
|
|
21
|
+
| A1 | 核心流程正确性 | 已有 | 主链路 E2E + 回归稳定(无随机失败) | P0 |
|
|
22
|
+
| A2 | 错误模型统一 | 部分 | 统一错误码、可机读分类、外层稳定映射 | P0 |
|
|
23
|
+
| A3 | 重试与退避治理 | 已有基础 | 可重试/不可重试清晰分层,重试预算可配置 | P0 |
|
|
24
|
+
| A4 | 工具幂等(副作用) | 缺失 | `executionId + toolCallId` 去重账本 | P0 |
|
|
25
|
+
| A5 | 全链路超时取消 | 已有基础 | timeout budget 拆分到 LLM/Tool,原因可观测 | P0 |
|
|
26
|
+
| A6 | 安全策略控制 | 部分 | 工具策略校验层,拒绝理由标准化+审计 | P0 |
|
|
27
|
+
| A7 | 可观测性闭环 | 部分 | 结构化日志 + 指标 + trace/span | P0 |
|
|
28
|
+
| A8 | write_file 协议稳定性 | 已有 | 协议版本化、兼容策略、坏包回放测试 | P0 |
|
|
29
|
+
| A9 | 并发一致性 | 已有基础 | 并发压测无竞态写坏、锁策略可解释 | P0 |
|
|
30
|
+
| A10 | 故障注入与压测 | 部分 | chaos + soak + 基准报告 | P0 |
|
|
31
|
+
| B1 | 配置治理 | 部分 | 配置 schema 校验 + 变更审计 | P1 |
|
|
32
|
+
| B2 | 多租户隔离与配额 | 缺失 | tenant 级限流/配额/隔离 | P1 |
|
|
33
|
+
| B3 | 成本治理 | 缺失 | token/tool 成本指标、预算告警、降级 | P1 |
|
|
34
|
+
| B4 | Runbook/SLO | 缺失 | SLI/SLO/告警阈值与应急手册 | P1 |
|
|
35
|
+
| B5 | 协议与版本升级策略 | 缺失 | 兼容矩阵与回滚策略 | P1 |
|
|
36
|
+
|
|
37
|
+
## 5. P0 改造顺序(必须先做)
|
|
38
|
+
1. **错误契约冻结(A2)**
|
|
39
|
+
- 输出统一错误码表(Agent/Tool/Provider)。
|
|
40
|
+
- 定义 `retryable`、`category`、`httpMapping`。
|
|
41
|
+
- 对外 API 返回稳定错误结构。
|
|
42
|
+
2. **幂等执行账本(A4)**
|
|
43
|
+
- 引入执行去重键:`executionId + toolCallId`。
|
|
44
|
+
- 重试/超时恢复时,副作用工具不重复执行。
|
|
45
|
+
3. **超时预算治理(A5)**
|
|
46
|
+
- 引入全局 `timeoutBudgetMs`,拆分到 LLM/Tool 子预算。
|
|
47
|
+
- 记录 `timeout_stage`、`elapsed_ms`。
|
|
48
|
+
4. **安全策略层(A6)**
|
|
49
|
+
- 工具执行前统一策略检查(路径、命令、危险参数)。
|
|
50
|
+
- 拒绝行为带错误码和审计字段。
|
|
51
|
+
5. **可观测性最小闭环(A7)**
|
|
52
|
+
- 日志结构化字段:`executionId`、`stepIndex`、`toolCallId`、`errorCode`、`latencyMs`。
|
|
53
|
+
- 指标:成功率、P95 时延、重试率、工具失败率。
|
|
54
|
+
6. **write_file 协议加固(A8)**
|
|
55
|
+
- 增加 `protocolVersion`。
|
|
56
|
+
- 增加乱序/重复包/坏包处理规则与回放测试。
|
|
57
|
+
7. **并发一致性与压测(A9/A10)**
|
|
58
|
+
- 混合场景压测:并发工具 + 断点续写 + abort + retry。
|
|
59
|
+
- 输出基线报告(吞吐、延迟、错误率、资源占用)。
|
|
60
|
+
8. **发布门禁(A1~A10 汇总)**
|
|
61
|
+
- CI 强制:契约测试、故障注入测试、性能阈值。
|
|
62
|
+
- 未达阈值禁止发版。
|
|
63
|
+
|
|
64
|
+
## 6. P1 改造顺序(增强能力)
|
|
65
|
+
1. 配置中心化与灰度开关(B1)。
|
|
66
|
+
2. 多租户隔离与配额(B2)。
|
|
67
|
+
3. 成本治理与自动降级(B3)。
|
|
68
|
+
4. Runbook + SLO + 告警演练(B4)。
|
|
69
|
+
5. 协议版本升级与兼容矩阵(B5)。
|
|
70
|
+
|
|
71
|
+
## 7. 每项验收模板(建议)
|
|
72
|
+
```md
|
|
73
|
+
### [A2] 错误契约冻结
|
|
74
|
+
- 目标:
|
|
75
|
+
- 代码改动:
|
|
76
|
+
- 风险:
|
|
77
|
+
- 回滚方案:
|
|
78
|
+
- 测试:
|
|
79
|
+
- 单测:
|
|
80
|
+
- 集成:
|
|
81
|
+
- 故障注入:
|
|
82
|
+
- 验收结果:
|
|
83
|
+
- [ ] 通过
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 8. 推荐里程碑
|
|
87
|
+
- M1(1周):A2/A4/A5 完成并通过回归。
|
|
88
|
+
- M2(1周):A6/A7/A8 完成并接入 CI。
|
|
89
|
+
- M3(1周):A9/A10 压测与故障注入完成,形成发布门禁。
|
|
90
|
+
- M4(持续):B1~B5 按业务优先级迭代。
|
|
91
|
+
|
|
92
|
+
## 9. 结论
|
|
93
|
+
- 当前 `agent-v4` 已接近“企业级基础内核”。
|
|
94
|
+
- 完成本清单的 P0 后,可作为生产基础 Agent 投入企业场景。
|
|
95
|
+
- P1 决定系统在规模化、治理、成本控制上的上限。
|