odai-dsh-agent 0.1.1 → 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.
Files changed (57) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +134 -132
  3. package/bin/odai-dsh-agent.mjs +108 -106
  4. package/package.json +69 -69
  5. package/preset/odai/agent.cordis.yml +260 -260
  6. package/preset/odai/preset.yml +3 -3
  7. package/preset/odai/runtime/compaction-config.mjs +388 -357
  8. package/preset/odai/runtime/governance.mjs +121 -121
  9. package/preset/odai/runtime/human-safety-continuity-store.mjs +254 -0
  10. package/preset/odai/runtime/human-safety-continuity.mjs +259 -0
  11. package/preset/odai/runtime/human-safety.mjs +50 -0
  12. package/preset/odai/runtime/index.mjs +1977 -1486
  13. package/preset/odai/runtime/model-route.mjs +80 -0
  14. package/preset/odai/runtime/output-config.mjs +304 -304
  15. package/preset/odai/runtime/research-packet.mjs +150 -150
  16. package/preset/odai/runtime/responsibility-gap.mjs +101 -0
  17. package/preset/odai/runtime/role-overlays.mjs +27 -27
  18. package/preset/odai/runtime/route-card.mjs +152 -126
  19. package/preset/odai/runtime/router.mjs +651 -535
  20. package/preset/odai/runtime/routing-config.mjs +436 -400
  21. package/preset/odai/runtime/routing-context.mjs +321 -209
  22. package/preset/odai/runtime/semantic-memory-store.mjs +452 -452
  23. package/preset/odai/runtime/semantic-memory.mjs +842 -840
  24. package/preset/odai/runtime/session-compat.mjs +389 -389
  25. package/preset/odai/runtime/skill-bundle.mjs +318 -318
  26. package/preset/odai/runtime/skill-evolution.mjs +1413 -1413
  27. package/preset/odai/skills/odai/SKILL.md +68 -66
  28. package/preset/odai/skills/odai/agents/openai.yaml +4 -4
  29. package/preset/odai/skills/odai/assets/claude-agents/agent.md +11 -11
  30. package/preset/odai/skills/odai/assets/codex-agents/config.toml +11 -11
  31. package/preset/odai/skills/odai/assets/codex-agents/role.toml +5 -5
  32. package/preset/odai/skills/odai/assets/copilot-agents/agent.md +13 -13
  33. package/preset/odai/skills/odai/assets/hooks-policy.example.json +24 -24
  34. package/preset/odai/skills/odai/assets/routing-roles/controller.md +15 -15
  35. package/preset/odai/skills/odai/assets/routing-roles/executor.md +11 -11
  36. package/preset/odai/skills/odai/assets/routing-roles/frontend.md +7 -7
  37. package/preset/odai/skills/odai/assets/routing-roles/planner.md +29 -29
  38. package/preset/odai/skills/odai/assets/routing-roles/researcher.md +6 -6
  39. package/preset/odai/skills/odai/assets/routing-roles/reviewer.md +11 -11
  40. package/preset/odai/skills/odai/assets/task-state.md +14 -14
  41. package/preset/odai/skills/odai/manifest.json +36 -35
  42. package/preset/odai/skills/odai/references/craft.md +54 -54
  43. package/preset/odai/skills/odai/references/dao.md +30 -30
  44. package/preset/odai/skills/odai/references/human-safety.md +91 -0
  45. package/preset/odai/skills/odai/references/leverage.md +53 -51
  46. package/preset/odai/skills/odai/references/planning.md +82 -82
  47. package/preset/odai/skills/odai/references/support.md +36 -36
  48. package/preset/odai/skills/odai/references/verification.md +23 -23
  49. package/preset/odai/skills/odai/scripts/build-hooks.mjs +273 -273
  50. package/preset/odai/skills/odai/scripts/build-routing.mjs +274 -274
  51. package/preset/odai/skills/odai/scripts/install-routing.mjs +397 -397
  52. package/preset/odai/skills/odai/scripts/odai-hook.mjs +457 -457
  53. package/preset/odai/skills/odai/scripts/run-role.mjs +336 -336
  54. package/preset/odai/skills/odai/scripts/run-routing.mjs +1154 -1154
  55. package/preset/odai/skills/odai/scripts/verify-routing.mjs +103 -103
  56. package/scripts/verify-agent-load.mjs +257 -246
  57. package/src/installer.mjs +382 -329
@@ -1,106 +1,108 @@
1
- #!/usr/bin/env node
2
-
3
- import { readDshVersion } from "../src/dsh-version.mjs";
4
- import {
5
- inspectAgentInstallation,
6
- installAgentPreset,
7
- SUPPORTED_DSH_VERSION,
8
- uninstallAgentPreset,
9
- } from "../src/installer.mjs";
10
-
11
- const HELP = `Usage: odai-dsh-agent <command> [options]
12
-
13
- Commands:
14
- install Install or update the managed Odai preset
15
- status Inspect the managed Odai preset
16
- uninstall Remove the preset when its managed files are unchanged
17
-
18
- Options:
19
- --dsh-home <path> Override DSH_HOME
20
- --json Print JSON
21
- --yes Confirm DSH is stopped; active-process verification still applies
22
- -h, --help Show this help
23
- `;
24
-
25
- try {
26
- const args = parseArgs(process.argv.slice(2));
27
- if (args.help) {
28
- process.stdout.write(HELP);
29
- } else if (args.command === "install") {
30
- assertDshVersion();
31
- print(await installAgentPreset({
32
- dshHome: args.dshHome,
33
- confirmDshStopped: args.yes,
34
- }), args.json);
35
- } else if (args.command === "status") {
36
- const result = await inspectAgentInstallation({ dshHome: args.dshHome });
37
- print(result, args.json);
38
- if (result.status === "drifted") process.exitCode = 2;
39
- } else if (args.command === "uninstall") {
40
- print(await uninstallAgentPreset({
41
- dshHome: args.dshHome,
42
- confirmDshStopped: args.yes,
43
- }), args.json);
44
- } else {
45
- throw new Error("a command is required\n\n" + HELP);
46
- }
47
- } catch (error) {
48
- process.stderr.write(`odai-dsh-agent: ${error instanceof Error ? error.message : String(error)}\n`);
49
- process.exitCode = 1;
50
- }
51
-
52
- function assertDshVersion() {
53
- const dsh = process.env.DSH_BIN ?? "dsh";
54
- let actual;
55
- try {
56
- actual = readDshVersion({ dsh });
57
- } catch (error) {
58
- throw new Error(`cannot run ${dsh} -V; install DSH ${SUPPORTED_DSH_VERSION} before installing the preset`);
59
- }
60
- if (actual !== SUPPORTED_DSH_VERSION) {
61
- throw new Error(`unsupported DSH version ${actual || "<empty>"}; expected ${SUPPORTED_DSH_VERSION}`);
62
- }
63
- }
64
-
65
- function parseArgs(argv) {
66
- const parsed = { command: undefined, dshHome: undefined, json: false, yes: false, help: false };
67
- for (let index = 0; index < argv.length; index += 1) {
68
- const arg = argv[index];
69
- if (arg === "-h" || arg === "--help") parsed.help = true;
70
- else if (arg === "--json") parsed.json = true;
71
- else if (arg === "--yes") parsed.yes = true;
72
- else if (arg === "--dsh-home") parsed.dshHome = argv[++index];
73
- else if (!parsed.command && ["install", "status", "uninstall"].includes(arg)) parsed.command = arg;
74
- else throw new Error(`unknown argument: ${arg}`);
75
- }
76
- if (parsed.dshHome !== undefined && (typeof parsed.dshHome !== "string" || parsed.dshHome.trim() === "")) {
77
- throw new Error("--dsh-home requires a non-empty path");
78
- }
79
- return parsed;
80
- }
81
-
82
- function print(result, json) {
83
- if (json) {
84
- process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
85
- return;
86
- }
87
- if (result.status) {
88
- process.stdout.write(`${result.status}: ${result.target}\n`);
89
- for (const issue of result.issues ?? []) process.stdout.write(`- ${issue}\n`);
90
- return;
91
- }
92
- process.stdout.write(`${result.operation}: ${result.target}\n`);
93
- if (result.sessionCompatibility?.repairedEvents > 0) {
94
- process.stdout.write(`session compatibility: made ${result.sessionCompatibility.repairedEvents} legacy Odai event(s) ignorable in ${result.sessionCompatibility.repairedArtifacts} session artifact(s)\n`);
95
- }
96
- if (result.sessionCompatibility?.backupPaths?.length > 0) {
97
- process.stdout.write(`session compatibility: retained ${result.sessionCompatibility.backupPaths.length} verified backup artifact(s)\n`);
98
- }
99
- for (const path of result.sessionCompatibility?.tornArtifacts ?? []) {
100
- process.stdout.write(`session compatibility warning: preserved DSH-recoverable torn tail: ${path}\n`);
101
- }
102
- for (const failure of result.sessionCompatibility?.failures ?? []) {
103
- process.stdout.write(`session compatibility warning: ${failure.path}: ${failure.error}\n`);
104
- }
105
- if (result.security) process.stdout.write(`security: ${result.security}\n`);
106
- }
1
+ #!/usr/bin/env node
2
+
3
+ import { readDshVersion } from "../src/dsh-version.mjs";
4
+ import {
5
+ inspectAgentInstallation,
6
+ installAgentPreset,
7
+ SUPPORTED_DSH_VERSIONS,
8
+ uninstallAgentPreset,
9
+ } from "../src/installer.mjs";
10
+
11
+ const HELP = `Usage: odai-dsh-agent <command> [options]
12
+
13
+ Commands:
14
+ install Install or update the managed Odai preset
15
+ status Inspect the managed Odai preset
16
+ uninstall Remove the preset when its managed files are unchanged
17
+
18
+ Options:
19
+ --dsh-home <path> Override DSH_HOME
20
+ --json Print JSON
21
+ --yes Confirm DSH is stopped; active-process verification still applies
22
+ -h, --help Show this help
23
+ `;
24
+
25
+ try {
26
+ const args = parseArgs(process.argv.slice(2));
27
+ if (args.help) {
28
+ process.stdout.write(HELP);
29
+ } else if (args.command === "install") {
30
+ const dshVersion = assertDshVersion();
31
+ print(await installAgentPreset({
32
+ dshHome: args.dshHome,
33
+ dshVersion,
34
+ confirmDshStopped: args.yes,
35
+ }), args.json);
36
+ } else if (args.command === "status") {
37
+ const result = await inspectAgentInstallation({ dshHome: args.dshHome });
38
+ print(result, args.json);
39
+ if (result.status === "drifted") process.exitCode = 2;
40
+ } else if (args.command === "uninstall") {
41
+ print(await uninstallAgentPreset({
42
+ dshHome: args.dshHome,
43
+ confirmDshStopped: args.yes,
44
+ }), args.json);
45
+ } else {
46
+ throw new Error("a command is required\n\n" + HELP);
47
+ }
48
+ } catch (error) {
49
+ process.stderr.write(`odai-dsh-agent: ${error instanceof Error ? error.message : String(error)}\n`);
50
+ process.exitCode = 1;
51
+ }
52
+
53
+ function assertDshVersion() {
54
+ const dsh = process.env.DSH_BIN ?? "dsh";
55
+ let actual;
56
+ try {
57
+ actual = readDshVersion({ dsh });
58
+ } catch (error) {
59
+ throw new Error(`cannot run ${dsh} -V; install one of ${SUPPORTED_DSH_VERSIONS.join(", ")} before installing the preset`);
60
+ }
61
+ if (!SUPPORTED_DSH_VERSIONS.includes(actual)) {
62
+ throw new Error(`unsupported DSH version ${actual || "<empty>"}; expected one of ${SUPPORTED_DSH_VERSIONS.join(", ")}`);
63
+ }
64
+ return actual;
65
+ }
66
+
67
+ function parseArgs(argv) {
68
+ const parsed = { command: undefined, dshHome: undefined, json: false, yes: false, help: false };
69
+ for (let index = 0; index < argv.length; index += 1) {
70
+ const arg = argv[index];
71
+ if (arg === "-h" || arg === "--help") parsed.help = true;
72
+ else if (arg === "--json") parsed.json = true;
73
+ else if (arg === "--yes") parsed.yes = true;
74
+ else if (arg === "--dsh-home") parsed.dshHome = argv[++index];
75
+ else if (!parsed.command && ["install", "status", "uninstall"].includes(arg)) parsed.command = arg;
76
+ else throw new Error(`unknown argument: ${arg}`);
77
+ }
78
+ if (parsed.dshHome !== undefined && (typeof parsed.dshHome !== "string" || parsed.dshHome.trim() === "")) {
79
+ throw new Error("--dsh-home requires a non-empty path");
80
+ }
81
+ return parsed;
82
+ }
83
+
84
+ function print(result, json) {
85
+ if (json) {
86
+ process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
87
+ return;
88
+ }
89
+ if (result.status) {
90
+ process.stdout.write(`${result.status}: ${result.target}\n`);
91
+ for (const issue of result.issues ?? []) process.stdout.write(`- ${issue}\n`);
92
+ return;
93
+ }
94
+ process.stdout.write(`${result.operation}: ${result.target}\n`);
95
+ if (result.sessionCompatibility?.repairedEvents > 0) {
96
+ process.stdout.write(`session compatibility: made ${result.sessionCompatibility.repairedEvents} legacy Odai event(s) ignorable in ${result.sessionCompatibility.repairedArtifacts} session artifact(s)\n`);
97
+ }
98
+ if (result.sessionCompatibility?.backupPaths?.length > 0) {
99
+ process.stdout.write(`session compatibility: retained ${result.sessionCompatibility.backupPaths.length} verified backup artifact(s)\n`);
100
+ }
101
+ for (const path of result.sessionCompatibility?.tornArtifacts ?? []) {
102
+ process.stdout.write(`session compatibility warning: preserved DSH-recoverable torn tail: ${path}\n`);
103
+ }
104
+ for (const failure of result.sessionCompatibility?.failures ?? []) {
105
+ process.stdout.write(`session compatibility warning: ${failure.path}: ${failure.error}\n`);
106
+ }
107
+ if (result.security) process.stdout.write(`security: ${result.security}\n`);
108
+ }
package/package.json CHANGED
@@ -1,69 +1,69 @@
1
- {
2
- "name": "odai-dsh-agent",
3
- "version": "0.1.1",
4
- "description": "完整继承 DSH 标准模式 全部能力的 Odai Agent preset。主要用于治理、规划、测试、验证 等,可当成默认总控使用。",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/orziz/odai.git",
9
- "directory": "dsh/agent"
10
- },
11
- "homepage": "https://github.com/orziz/odai#readme",
12
- "bugs": {
13
- "url": "https://github.com/orziz/odai/issues"
14
- },
15
- "type": "module",
16
- "main": "./src/installer.mjs",
17
- "exports": {
18
- ".": "./src/installer.mjs",
19
- "./package.json": "./package.json"
20
- },
21
- "bin": {
22
- "odai-dsh-agent": "./bin/odai-dsh-agent.mjs"
23
- },
24
- "publishConfig": {
25
- "registry": "https://registry.npmjs.org/",
26
- "access": "public"
27
- },
28
- "files": [
29
- "bin",
30
- "src",
31
- "scripts/verify-agent-load.mjs",
32
- "preset",
33
- "README.md",
34
- "LICENSE"
35
- ],
36
- "scripts": {
37
- "check": "find bin src scripts tests -name '*.mjs' -print0 | xargs -0 -n1 node --check",
38
- "prepare:artifact": "node ../../scripts/package-odai-artifact.mjs prepare --skill-root preset/odai/skills --runtime-root preset/odai/runtime",
39
- "clean:artifact": "node ../../scripts/package-odai-artifact.mjs clean --skill-root preset/odai/skills --runtime-root preset/odai/runtime",
40
- "prepare": "npm run prepare:artifact",
41
- "verify:version": "node ../../scripts/verify-dsh-package-versions.mjs",
42
- "prepack": "npm run verify:version && node ../../scripts/validate-odai-skill.mjs",
43
- "postpack": "npm run clean:artifact",
44
- "pack:dry-run": "node ../../scripts/run-package-pack.mjs --clean preset/odai/runtime --clean preset/odai/skills -- --dry-run",
45
- "test": "npm run verify:version && node --test ./tests/*.test.mjs",
46
- "verify:dsh": "node ./scripts/verify-agent-load.mjs"
47
- },
48
- "dependencies": {
49
- "yaml": "^2.8.1"
50
- },
51
- "peerDependencies": {
52
- "@deepseek-ai/dsh": "0.1.0-rc.6"
53
- },
54
- "peerDependenciesMeta": {
55
- "@deepseek-ai/dsh": {
56
- "optional": true
57
- }
58
- },
59
- "engines": {
60
- "node": ">=22.15.0"
61
- },
62
- "keywords": [
63
- "agent",
64
- "deepseek-harness",
65
- "dsh",
66
- "odai",
67
- "preset"
68
- ]
69
- }
1
+ {
2
+ "name": "odai-dsh-agent",
3
+ "version": "0.2.0",
4
+ "description": "完整继承 DSH 标准模式 全部能力的 Odai Agent preset。主要用于治理、规划、测试、验证 等,可当成默认总控使用。",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/orziz/odai.git",
9
+ "directory": "dsh/agent"
10
+ },
11
+ "homepage": "https://github.com/orziz/odai#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/orziz/odai/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./src/installer.mjs",
17
+ "exports": {
18
+ ".": "./src/installer.mjs",
19
+ "./package.json": "./package.json"
20
+ },
21
+ "bin": {
22
+ "odai-dsh-agent": "./bin/odai-dsh-agent.mjs"
23
+ },
24
+ "publishConfig": {
25
+ "registry": "https://registry.npmjs.org/",
26
+ "access": "public"
27
+ },
28
+ "files": [
29
+ "bin",
30
+ "src",
31
+ "scripts/verify-agent-load.mjs",
32
+ "preset",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "check": "find bin src scripts tests -name '*.mjs' -print0 | xargs -0 -n1 node --check",
38
+ "prepare:artifact": "node ../../scripts/package-odai-artifact.mjs prepare --skill-root preset/odai/skills --runtime-root preset/odai/runtime",
39
+ "clean:artifact": "node ../../scripts/package-odai-artifact.mjs clean --skill-root preset/odai/skills --runtime-root preset/odai/runtime",
40
+ "prepare": "npm run prepare:artifact",
41
+ "verify:version": "node ../../scripts/verify-dsh-package-versions.mjs",
42
+ "prepack": "npm run verify:version && node ../../scripts/validate-odai-skill.mjs",
43
+ "postpack": "npm run clean:artifact",
44
+ "pack:dry-run": "node ../../scripts/run-package-pack.mjs --clean preset/odai/runtime --clean preset/odai/skills -- --dry-run",
45
+ "test": "npm run verify:version && node --test ./tests/*.test.mjs",
46
+ "verify:dsh": "node ./scripts/verify-agent-load.mjs"
47
+ },
48
+ "dependencies": {
49
+ "yaml": "^2.8.1"
50
+ },
51
+ "peerDependencies": {
52
+ "@deepseek-ai/dsh": "0.1.0-rc.6 || 0.1.0-rc.7"
53
+ },
54
+ "peerDependenciesMeta": {
55
+ "@deepseek-ai/dsh": {
56
+ "optional": true
57
+ }
58
+ },
59
+ "engines": {
60
+ "node": ">=22.15.0"
61
+ },
62
+ "keywords": [
63
+ "agent",
64
+ "deepseek-harness",
65
+ "dsh",
66
+ "odai",
67
+ "preset"
68
+ ]
69
+ }