nomarmy 0.1.0-alpha.2 → 0.1.0-alpha.21

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 (102) hide show
  1. package/README.md +86 -480
  2. package/bin/nomarmy.mjs +1081 -185
  3. package/docker/Dockerfile +2 -2
  4. package/docker/Dockerfile.go +6 -4
  5. package/docker/Dockerfile.rust +17 -2
  6. package/harnesses/_template/README.md +27 -0
  7. package/harnesses/_template/harness.yml +26 -0
  8. package/harnesses/browser-playwright/README.md +35 -0
  9. package/harnesses/browser-playwright/fixture/package.json +1 -0
  10. package/harnesses/browser-playwright/fixture/page.html +1 -0
  11. package/harnesses/browser-playwright/fixture/page.spec.js +5 -0
  12. package/harnesses/browser-playwright/fixture/playwright.config.js +8 -0
  13. package/harnesses/browser-playwright/harness.yml +18 -0
  14. package/harnesses/go/README.md +45 -0
  15. package/harnesses/go/harness.yml +14 -0
  16. package/harnesses/mock-oidc/README.md +31 -0
  17. package/harnesses/mock-oidc/fixture/.nomarmy.yml +4 -0
  18. package/harnesses/mock-oidc/fixture/discovery.test.mjs +16 -0
  19. package/harnesses/mock-oidc/harness.yml +19 -0
  20. package/harnesses/node/README.md +53 -0
  21. package/harnesses/node/harness.yml +18 -0
  22. package/harnesses/python/README.md +46 -0
  23. package/harnesses/python/harness.yml +16 -0
  24. package/harnesses/rust/README.md +45 -0
  25. package/harnesses/rust/harness.yml +13 -0
  26. package/install.sh +29 -9
  27. package/lib/admission.mjs +178 -30
  28. package/lib/agents.mjs +8 -6
  29. package/lib/army.mjs +25 -10
  30. package/lib/codex-link.mjs +37 -0
  31. package/lib/config.mjs +15 -0
  32. package/lib/connect.mjs +232 -19
  33. package/lib/continue-from.mjs +103 -0
  34. package/lib/coordinator-instructions.mjs +5 -1
  35. package/lib/diff-checks.mjs +114 -0
  36. package/lib/dispatch-schema.mjs +14 -12
  37. package/lib/doctor.mjs +98 -9
  38. package/lib/egress-proxy.mjs +116 -0
  39. package/lib/execute.mjs +241 -33
  40. package/lib/git-record.mjs +27 -3
  41. package/lib/harness-schema.mjs +61 -0
  42. package/lib/harnesses.mjs +99 -0
  43. package/lib/health.mjs +162 -18
  44. package/lib/install-freshness.mjs +114 -0
  45. package/lib/jev-checks.mjs +110 -0
  46. package/lib/job-format.mjs +54 -0
  47. package/lib/judge.mjs +130 -0
  48. package/lib/limits.mjs +77 -0
  49. package/lib/model-probe.mjs +61 -0
  50. package/lib/mutation.mjs +159 -0
  51. package/lib/notify.mjs +30 -3
  52. package/lib/openclaw-install.mjs +122 -0
  53. package/lib/openclaw-path.mjs +28 -0
  54. package/lib/openclaw-run.mjs +74 -12
  55. package/lib/openclaw-runtime-health.mjs +56 -0
  56. package/lib/outcome.mjs +21 -2
  57. package/lib/outcomes.mjs +6 -0
  58. package/lib/path-utils.mjs +4 -0
  59. package/lib/podman-health.mjs +41 -0
  60. package/lib/process.mjs +4 -1
  61. package/lib/propose.mjs +10 -11
  62. package/lib/refusal-retry.mjs +16 -0
  63. package/lib/registry-python.mjs +98 -0
  64. package/lib/registry-secrets.mjs +140 -0
  65. package/lib/repo-query.mjs +13 -7
  66. package/lib/runs.mjs +7 -1
  67. package/lib/same-path.mjs +14 -0
  68. package/lib/sandbox-images.mjs +499 -83
  69. package/lib/sandbox-vm.mjs +32 -0
  70. package/lib/scan.mjs +5 -1
  71. package/lib/schema.mjs +20 -11
  72. package/lib/scout.mjs +21 -3
  73. package/lib/server-context.mjs +21 -1
  74. package/lib/setup-steps.mjs +55 -0
  75. package/lib/share.mjs +82 -0
  76. package/lib/stale-sessions.mjs +60 -0
  77. package/lib/stats.mjs +315 -0
  78. package/lib/statusline.mjs +32 -6
  79. package/lib/subscription-setup.mjs +13 -0
  80. package/lib/suggestions.mjs +153 -0
  81. package/lib/thinking.mjs +23 -0
  82. package/lib/transcript.mjs +30 -5
  83. package/lib/usage-limits.mjs +329 -0
  84. package/lib/user-config.mjs +106 -0
  85. package/lib/validators.mjs +220 -0
  86. package/lib/verification-artifacts.mjs +46 -0
  87. package/lib/verification-flow.mjs +52 -7
  88. package/lib/verification-network.mjs +66 -0
  89. package/lib/verify.mjs +338 -85
  90. package/lib/worker-prompt.mjs +5 -2
  91. package/lib/wsl-cli.mjs +152 -0
  92. package/lib/wsl.mjs +230 -0
  93. package/lib/zod-issues.mjs +15 -0
  94. package/mcp/server.mjs +165 -34
  95. package/package.json +7 -5
  96. package/playbooks/feature.md +8 -5
  97. package/scripts/configure-openclaw.sh +4 -2
  98. package/scripts/generate-harness-docs.mjs +42 -0
  99. package/scripts/install-openclaw.mjs +23 -0
  100. package/scripts/lib.sh +9 -2
  101. package/scripts/select-model.mjs +12 -5
  102. package/scripts/start-inference.sh +2 -2
package/scripts/lib.sh CHANGED
@@ -19,9 +19,13 @@ nomarmy_compat_prefix(){
19
19
  done
20
20
  }
21
21
 
22
+ # Your settings live here, over the package's config/ defaults, so an update
23
+ # can't reset them (lib/user-config.mjs does the same for the CLI).
24
+ nomarmy_user_config_dir(){ echo "${NOMARMY_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/nomarmy}"; }
25
+
22
26
  nomarmy_available_profiles(){
23
27
  local root; root="$(nomarmy_root)"
24
- find "$root/config/profiles" -name '*.env' -exec basename {} .env \; | sort | tr '\n' ' '
28
+ { find "$root/config/profiles" -name '*.env' -exec basename {} .env \; ; find "$(nomarmy_user_config_dir)/profiles" -name '*.env' -exec basename {} .env \; 2>/dev/null; } | sort -u | tr '\n' ' '
25
29
  }
26
30
 
27
31
  # Where this install's models run (lib/execution.mjs is the same logic for the
@@ -129,7 +133,8 @@ load_profile(){
129
133
  elif command -v nvidia-smi >/dev/null 2>&1; then profile=nvidia-linux
130
134
  else profile=cpu-linux; fi
131
135
  fi
132
- profile_file="$root/config/profiles/$profile.env"
136
+ profile_file="$(nomarmy_user_config_dir)/profiles/$profile.env"
137
+ [[ -f "$profile_file" ]] || profile_file="$root/config/profiles/$profile.env"
133
138
  if [[ ! -f "$profile_file" ]]; then
134
139
  echo "ERROR: unknown profile '$profile'. Available: $(nomarmy_available_profiles)" >&2
135
140
  exit 2
@@ -137,6 +142,8 @@ load_profile(){
137
142
  set -a
138
143
  # shellcheck disable=SC1091
139
144
  source "$root/config/common.env"
145
+ # shellcheck disable=SC1091
146
+ [[ -f "$(nomarmy_user_config_dir)/common.env" ]] && source "$(nomarmy_user_config_dir)/common.env"
140
147
  # shellcheck disable=SC1090
141
148
  source "$profile_file"
142
149
  set +a
@@ -3,12 +3,17 @@ import { createInterface } from "node:readline/promises";
3
3
  import { stdin as input, stdout as output } from "node:process";
4
4
  import { readFile, writeFile } from "node:fs/promises";
5
5
  import path from "node:path";
6
+ import { userCommonPath } from "../lib/user-config.mjs";
7
+ import { fileURLToPath } from "node:url";
6
8
 
7
- const root = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
9
+ // fileURLToPath, not URL.pathname: on Windows that gave "/C:/Users/Jason%20Pugh/...",
10
+ // a stray slash and an encoded space, and connect failed copying from C:\\C:\\...
11
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
8
12
  const args = process.argv.slice(2);
9
13
  let query = "";
10
14
  let repo = "";
11
- let configPath = path.join(root, "config", "common.env");
15
+ // Your settings file, not the package's config/ (an update would reset it): lib/user-config.mjs.
16
+ let configPath = userCommonPath();
12
17
 
13
18
  for (let index = 0; index < args.length; index += 1) {
14
19
  const value = args[index];
@@ -70,16 +75,18 @@ try {
70
75
  const alias = (await rl.question(`Local model alias [${defaultAlias}]: `)).trim() || defaultAlias;
71
76
  if (!/^[A-Za-z0-9._-]+$/.test(alias)) throw new Error("Alias may contain only letters, numbers, dots, underscores, and hyphens.");
72
77
 
73
- console.log(`\nReady to update ${path.relative(root, configPath)}:`);
78
+ console.log(`\nReady to update ${configPath}:`);
74
79
  console.log(` NOMARMY_MODEL_REPO=${repo}`);
75
80
  console.log(` NOMARMY_MODEL_QUANT=${requestedQuant}`);
76
81
  console.log(` NOMARMY_MODEL_ALIAS=${alias}`);
77
- if ((await rl.question("Apply this model configuration? [y/N] ")).trim().toLowerCase() !== "y") {
82
+ if (["n", "no"].includes((await rl.question("Apply this model configuration? [Y/n] ")).trim().toLowerCase())) {
78
83
  console.log("Canceled; no model configuration changed.");
79
84
  process.exit(0);
80
85
  }
81
86
 
82
- const existing = await readFile(configPath, "utf8");
87
+ // Your settings file may not exist yet: start it rather than fail.
88
+ const existing = await readFile(configPath, "utf8").catch(() => "");
89
+ await import("node:fs").then((fs) => fs.mkdirSync(path.dirname(configPath), { recursive: true }));
83
90
  const replace = (key, value, text) => {
84
91
  const line = `${key}=${value}`;
85
92
  return new RegExp(`^${key}=.*$`, "m").test(text) ? text.replace(new RegExp(`^${key}=.*$`, "m"), line) : `${text.trimEnd()}\n${line}\n`;
@@ -15,8 +15,8 @@ if [[ -f "$PID" ]] && kill -0 "$(cat "$PID")" 2>/dev/null; then echo "llama-serv
15
15
  BIN="$NOMARMY_INSTALL_ROOT/llama-server"; [[ -x "$BIN" ]] || { echo "ERROR: $BIN missing"; exit 1; }
16
16
  ARGS=(-hf "$NOMARMY_MODEL_REPO:$NOMARMY_MODEL_QUANT" --alias "$NOMARMY_MODEL_ALIAS" --host "$NOMARMY_LLAMA_HOST" --port "$NOMARMY_LLAMA_PORT" -c "$NOMARMY_LLAMA_CONTEXT" -np "$NOMARMY_LLAMA_PARALLEL" -ngl "$NOMARMY_LLAMA_GPU_LAYERS" -t "$NOMARMY_LLAMA_THREADS" --metrics)
17
17
  # Everything below is optional advanced tuning, unset by default: nothing
18
- # here changes behavior for anyone who hasn't set these. See README's
19
- # "Advanced llama-server tuning" section for what each one is for.
18
+ # here changes behavior for anyone who hasn't set these. See "Advanced
19
+ # llama-server tuning" in docs/configuration.md for what each one is for.
20
20
  [[ -n "${NOMARMY_LLAMA_CACHE_TYPE_K:-}" ]] && ARGS+=(--cache-type-k "$NOMARMY_LLAMA_CACHE_TYPE_K")
21
21
  [[ -n "${NOMARMY_LLAMA_CACHE_TYPE_V:-}" ]] && ARGS+=(--cache-type-v "$NOMARMY_LLAMA_CACHE_TYPE_V")
22
22
  [[ -n "${NOMARMY_LLAMA_FLASH_ATTN:-}" ]] && ARGS+=(--flash-attn "$NOMARMY_LLAMA_FLASH_ATTN")