diff --git a/.github-openclaw-intelligence/CONTRIBUTING.md b/.github-openclaw-intelligence/CONTRIBUTING.md index bdb0fef..d53be60 100644 --- a/.github-openclaw-intelligence/CONTRIBUTING.md +++ b/.github-openclaw-intelligence/CONTRIBUTING.md @@ -69,6 +69,11 @@ The validation workflow runs these credential-free checks on pushes to `main` an pull requests, including in the template repository where agent execution is intentionally disabled. Live model responses still require a configured provider. +Preflight validates the constraints in `config/settings.schema.json` without +installed dependencies. Optional settings may be omitted, but explicit `null` +values and unknown fields inside `trustPolicy`, `limits`, or `compaction` are +rejected. Add preflight regression cases when changing these constraints. + --- ## Style and Conventions diff --git a/.github-openclaw-intelligence/PACKAGES.md b/.github-openclaw-intelligence/PACKAGES.md index c4eeb53..d14c76c 100644 --- a/.github-openclaw-intelligence/PACKAGES.md +++ b/.github-openclaw-intelligence/PACKAGES.md @@ -20,6 +20,12 @@ to reproduce it. The `ws` override uses 8.21.3 because `@buape/carbon@0.16.0` pins a vulnerable 8.20.0 release; remove the override once upstream uses a patched version. +OpenClaw 2026.9.5 also pins affected versions of `@modelcontextprotocol/sdk`, +`minimatch`, `undici`, and `zod`. Targeted overrides use 1.32.0, 11.0.1, 8.12.2, +and 4.6.6 respectively. Remove these overrides once upstream pins patched +versions. The minimatch override crosses a major version; preserve coverage of +the glob APIs used by OpenClaw when updating it. + ### OpenClaw Feature Surface Beyond the CLI binary, OCI uses the following OpenClaw feature categories: diff --git a/.github-openclaw-intelligence/bun.lock b/.github-openclaw-intelligence/bun.lock index 144f9c4..a360b6b 100644 --- a/.github-openclaw-intelligence/bun.lock +++ b/.github-openclaw-intelligence/bun.lock @@ -14,7 +14,11 @@ }, }, "overrides": { + "@modelcontextprotocol/sdk": "1.32.0", + "minimatch": "11.0.1", + "undici": "8.12.2", "ws": "8.21.3", + "zod": "4.6.6", }, "packages": { "@agentclientprotocol/sdk": ["@agentclientprotocol/sdk@1.4.0", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-/eufudw+aFY1LKLolT6yFE6UMmYRl7fMJ/DEONSIyR6wI3slHWITBsANRGqXEY8FRzqUxwh7QEaGiZHcJPVThg=="], @@ -55,10 +59,12 @@ "@homebridge/ciao": ["@homebridge/ciao@1.3.12", "", { "dependencies": { "debug": "^4.4.3", "fast-deep-equal": "^3.1.3", "source-map-support": "^0.5.21", "tslib": "^2.8.1" }, "bin": { "ciao-bcs": "lib/bonjour-conformance-testing.js" } }, "sha512-84/0u0kqKy4qcKupIDaTtbkmk+3qFDuMzxTC0NPfVlHcUT+jHGdP+QCqwEw94/GJxRezDeBLwxaclkBZgCdeUg=="], - "@hono/node-server": ["@hono/node-server@1.19.15", "", { "peerDependencies": { "hono": "^4" } }, "sha512-Za2ai6TLdKjUvnur+eenO6nuYYipVAEhyCAdaV8IRvmU9kK8crOZUSYvIXn72E4f8fJqyAbpcJuTsYYmZp9Deg=="], + "@hono/node-server": ["@hono/node-server@2.1.3", "", { "peerDependencies": { "hono": "^4" } }, "sha512-TA//nWMqPhbfdfneACk6t5a9eqbS9lABEPyKn0/xZTah3H3U2XaVg85rJFl0/Fyit0I552YDHgXGVSf3GwqbUw=="], "@isaacs/fs-minipass": ["@isaacs/fs-minipass@4.0.1", "", { "dependencies": { "minipass": "^7.0.4" } }, "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w=="], + "@isaacs/nonrecursive-glob-match": ["@isaacs/nonrecursive-glob-match@1.0.3", "", {}, "sha512-SI7kyKHq4XXDRozw+r9GlRZkia1ZkFrpLW98r2IC2Bpr8YkFGE3fvjzmxCG0x78A++69HmDNrDvSMYBZmHGpKA=="], + "@koromix/koffi-android-arm64": ["@koromix/koffi-android-arm64@3.2.1", "", { "os": "android", "cpu": "arm64" }, "sha512-1pJQ4jnZlUJduK9u9DC5CGy3aOgDUPvIXpNb6syV3+Dh5Q/ugezAIGCqvY+w+1mgXsve0pd0NVvJRjdZNHQ6MA=="], "@koromix/koffi-android-x64": ["@koromix/koffi-android-x64@3.2.1", "", { "os": "android", "cpu": "x64" }, "sha512-HH40xGh3gVQifjOBnhwT2tECC0lL1lYe+nxHvWNSzxDIyQNcVPXg38ta7vuONRFpD+uIrw7fqGYLzbZIagkVcg=="], @@ -113,7 +119,7 @@ "@mistralai/mistralai": ["@mistralai/mistralai@2.6.4", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.40.0", "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" }, "peerDependencies": { "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.220.0", "@opentelemetry/resources": "^2.9.0", "@opentelemetry/sdk-trace-base": "^2.9.0" }, "optionalPeers": ["@opentelemetry/api", "@opentelemetry/exporter-trace-otlp-http", "@opentelemetry/resources", "@opentelemetry/sdk-trace-base"] }, "sha512-PPt4GyJqs2hEsWrYCJZK5f0ORmT+L2MSm75LVGD7kBLf6ZKsoDpld/FRBQXr8xG6iFCBOFJFYzvGYhUb+UCkbw=="], - "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.30.0", "", { "dependencies": { "@hono/node-server": "^1.19.9 || ^2.0.5", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-xKd8OIzlqNzcqcNumGAa6g+PW2kjD5vrpcKOnfldAUPP3j7lnqMPwlTXQm8gF+UwH72z0lqaRbjr9hqGz0eITA=="], + "@modelcontextprotocol/sdk": ["@modelcontextprotocol/sdk@1.32.0", "", { "dependencies": { "@hono/node-server": "^1.19.9 || ^2.0.5", "ajv": "^8.17.1", "ajv-formats": "^3.0.1", "content-type": "^1.0.5", "cors": "^2.8.5", "cross-spawn": "^7.0.5", "eventsource": "^3.0.2", "eventsource-parser": "^3.0.0", "express": "^5.2.1", "express-rate-limit": "^8.2.1", "hono": "^4.11.4", "jose": "^6.1.3", "json-schema-typed": "^8.0.2", "pkce-challenge": "^5.0.0", "raw-body": "^3.0.0", "zod": "^3.25 || ^4.0", "zod-to-json-schema": "^3.25.1" }, "peerDependencies": { "@cfworker/json-schema": "^4.1.1" }, "optionalPeers": ["@cfworker/json-schema"] }, "sha512-8BviX/hK4Gd2eL1KdTwm0gfl4d3wdoErW0Jd00h6nomUAtk6IJk5vwQJc6kfWtJTzN5OEV/lgIiJKI8fiDGAlA=="], "@mozilla/readability": ["@mozilla/readability@0.6.0", "", {}, "sha512-juG5VWh4qAivzTAeMzvY9xs9HY5rAcr2E4I7tiSSCokRFi7XIZCAu92ZkSTsIj1OPceCifL3cpfteP3pDT9/QQ=="], @@ -281,7 +287,7 @@ "bn.js": ["bn.js@4.12.3", "", {}, "sha512-fGTi3gxV/23FTYdAoUtLYp6qySe2KE3teyZitipKNRuVYcBkoP/bB3guXN/XVKUe9mxCHXnc9C4ocyz8OmgN0g=="], - "body-parser": ["body-parser@2.3.0", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^2.0.0", "debug": "^4.4.3", "http-errors": "^2.0.1", "iconv-lite": "^0.7.2", "on-finished": "^2.4.1", "qs": "^6.15.2", "raw-body": "^3.0.2", "type-is": "^2.1.0" } }, "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw=="], + "body-parser": ["body-parser@2.4.0", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^2.1.0", "debug": "^4.4.3", "http-errors": "^2.0.1", "iconv-lite": "^0.7.3", "on-finished": "^2.4.1", "qs": "^6.16.1", "raw-body": "^3.0.2", "type-is": "^2.1.0" } }, "sha512-Ifk1KcLrxaGt1occQagQNFNNOqRt1LFuehEnHHzB8Z6cRgIxRU1TBaiIsUiCdA+gy5PL7Y1IX31DNKkRmxtXjQ=="], "boolbase": ["boolbase@2.0.0", "", {}, "sha512-DkVaaQHymRhpYEYo9x1oo7Q7B0Y6KJUsjm3c9eTyFDby4MHLBTwZ6ZDWBel5zrYxj1WsZgC5oLpiz+93MluXeA=="], @@ -427,7 +433,7 @@ "fast-string-width": ["fast-string-width@3.0.2", "", { "dependencies": { "fast-string-truncated-width": "^3.0.2" } }, "sha512-gX8LrtNEI5hq8DVUfRQMbr5lpaS4nMIWV+7XEbXk2b8kiQIizgnlr12B4dA3ZEx3308ze0O4Q1R+cHts8kyUJg=="], - "fast-uri": ["fast-uri@3.1.6", "", {}, "sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q=="], + "fast-uri": ["fast-uri@3.1.9", "", {}, "sha512-hS/0Wt3Ya043oKXs0sIxrMpKQITXhMLIrVAKKXi4gozGC9v7YRWVnXIZzjNPTO02M9BdxLCWqK1yRXgNziVyJQ=="], "fast-wrap-ansi": ["fast-wrap-ansi@0.2.2", "", { "dependencies": { "fast-string-width": "^3.0.2" } }, "sha512-7F2Fl+TjRSenLqlU3UjSH0iyqopqoZIu7eZVpEirP2g1GtWa2G/ecEmBdgz31+Mxr+ELclgg6sokpSFIQiZ02Q=="], @@ -441,7 +447,7 @@ "find-up": ["find-up@4.1.0", "", { "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw=="], - "follow-redirects": ["follow-redirects@1.16.0", "", { "peerDependencies": { "debug": "*" }, "optionalPeers": ["debug"] }, "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw=="], + "follow-redirects": ["follow-redirects@1.16.2", "", { "peerDependencies": { "debug": "*" }, "optionalPeers": ["debug"] }, "sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow=="], "form-data": ["form-data@4.0.6", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.4", "mime-types": "^2.1.35" } }, "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ=="], @@ -485,7 +491,7 @@ "highlight.js": ["highlight.js@11.12.0", "", {}, "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg=="], - "hono": ["hono@4.13.5", "", {}, "sha512-O6+/eCYRkzzzy0rPWwKLiGBR1nFuUPZynnwjxN1MBA62NNqbT0wQEzQyK2gSO5yDIDB336sXQleAhOHrzlYyKw=="], + "hono": ["hono@4.13.11", "", {}, "sha512-/SMX/RQNJn7oNmFwH6DtwDqcrzZU2otm1FD6OJe2cWF6cfy/F8hq0XVBv7xW3FTJshRQwuBnXHDq2kNsdZnshg=="], "hosted-git-info": ["hosted-git-info@10.1.1", "", { "dependencies": { "lru-cache": "^11.1.0" } }, "sha512-DeOnSPAvOndYKfw075gt8yZzQ7S2hNztw34zBTfhIzLhmBTswIBg5/y+pqu/VD5cYWm5goAFTusDmUEmKZ0PEQ=="], @@ -513,7 +519,7 @@ "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], - "ip-address": ["ip-address@10.3.1", "", {}, "sha512-1e9d3kb97NHJTIJDZW9rKqW2h6+dFa50Dy0fpPSMQp2ADje5gvKsXmdiK6dwY5t76TaTt5+P5N1Y/LoToIxP6g=="], + "ip-address": ["ip-address@10.7.4", "", {}, "sha512-DWBMKyeM25D70nrIiTkgQth59/G+naKOTep6huF9j+GmeK3DMD60Zvxg5d5qQnz+38AHgou6ean2LECX+lrKDg=="], "ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="], @@ -587,7 +593,7 @@ "minimalistic-assert": ["minimalistic-assert@1.0.1", "", {}, "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A=="], - "minimatch": ["minimatch@10.2.6", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="], + "minimatch": ["minimatch@11.0.1", "", { "dependencies": { "@isaacs/nonrecursive-glob-match": "^1.0.1", "brace-expansion": "^5.0.12" } }, "sha512-t+Vn6DX4wPCxS23y03C0uhF7S1jpi1GfqPrnlEipCJaA2ykiNbMkVlDutZtmvLfRcUN6R8AYVlzTsQrT4RZoLQ=="], "minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="], @@ -671,13 +677,13 @@ "protobufjs": ["protobufjs@7.6.5", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.5", "@protobufjs/eventemitter": "^1.1.1", "@protobufjs/fetch": "^1.1.1", "@protobufjs/float": "^1.0.2", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.1", "@types/node": ">=13.7.0", "long": "^5.3.2" } }, "sha512-/FPD0nUc9jH6rfFjji9IBqOz4pcSE3CsT1m7Ep6Mdb0LxSUMj8hgl6GomOvZzpNpAqqGaXA0P3VSrZLFzIhQrw=="], - "proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="], + "proxy-addr": ["proxy-addr@2.0.8", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ=="], "proxy-from-env": ["proxy-from-env@2.1.0", "", {}, "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA=="], "qrcode": ["qrcode@1.5.4", "", { "dependencies": { "dijkstrajs": "^1.0.1", "pngjs": "^5.0.0", "yargs": "^15.3.1" }, "bin": { "qrcode": "bin/qrcode" } }, "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg=="], - "qs": ["qs@6.16.0", "", { "dependencies": { "es-define-property": "^1.0.1", "side-channel": "^1.1.1" } }, "sha512-h6fhOIaRrID2CbEY2fqs+7t+UXZo+MLAnU5gRIq85uFtdiUPCdsApMlHhXogKVM4HM2DVbIjGNTTYH2OcmP1vA=="], + "qs": ["qs@6.16.1", "", { "dependencies": { "es-define-property": "^1.0.1", "side-channel": "^1.1.1" } }, "sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg=="], "quickjs-wasi": ["quickjs-wasi@3.6.0", "", {}, "sha512-/CNzMq42B8ThzUpzjLSF8K50ntVLV3RREyT8zr4wHaP2CZSHFhPkqg3E1GULmTerehf8Bo+UguQ+4LoOMCTC6A=="], @@ -799,7 +805,7 @@ "uint8array-extras": ["uint8array-extras@1.5.0", "", {}, "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A=="], - "undici": ["undici@8.10.2", "", {}, "sha512-/y4/bH9YNU5hi9NIrpOuvGXFcxrj3CMrV+/AYpowAYTpHn8gX/XPFjNy766FPoYY0miQhdW977JFWKGNhBdwyQ=="], + "undici": ["undici@8.12.2", "", {}, "sha512-XtuDWVdqTLr3NAxm2ly9/hU6kUsJOgGh1RASzMBbsw6aWCOaQzHdW+QQDfdERjfJ2V5vL5pRPa4RetO9UfivDg=="], "undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="], @@ -849,13 +855,13 @@ "yoctocolors": ["yoctocolors@2.2.0", "", {}, "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg=="], - "zod": ["zod@4.5.4", "", {}, "sha512-sC95tT5iHHH9gtpj6A81kh+NEaRAUFN+qlUPDUbRfOMvNf5QCBqsb3WgvnpVtK5Y+4UfA6KqufotuTvMGiTlsA=="], + "zod": ["zod@4.6.6", "", {}, "sha512-4UmzQUF5fxvfcYHlbjBmejU+w+hbDnWFx4aS8kBx7nPBHcO2SqPbpAG8snbdg+Xse4pRefR98hgjFgIMCI/UhA=="], "zod-to-json-schema": ["zod-to-json-schema@3.25.2", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="], "@earendil-works/pi-tui/marked": ["marked@18.0.5", "", { "bin": { "marked": "bin/marked.js" } }, "sha512-S6GcvALHg6K4ohtu4E7x0a1AqhAjp6cV8KhLSyN9qVapnzJkusVBxZRcIU9AeYsbe6P1hKDusSbEOzGyyuce6w=="], - "body-parser/content-type": ["content-type@2.0.0", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="], + "body-parser/content-type": ["content-type@2.1.0", "", {}, "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag=="], "cli-highlight/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], diff --git a/.github-openclaw-intelligence/lifecycle/dependency-compatibility.test.ts b/.github-openclaw-intelligence/lifecycle/dependency-compatibility.test.ts new file mode 100644 index 0000000..8c32ae4 --- /dev/null +++ b/.github-openclaw-intelligence/lifecycle/dependency-compatibility.test.ts @@ -0,0 +1,41 @@ +import { expect, test } from "bun:test"; +import { execFileSync } from "child_process"; +import { resolve } from "path"; + +test("minimatch override preserves the glob APIs used by OpenClaw", () => { + const output = execFileSync("node", [ + "--input-type=module", + "--eval", + ` + import assert from "node:assert/strict"; + import { createRequire } from "node:module"; + const require = createRequire(process.argv[1]); + const { minimatch, Minimatch, escape } = require("minimatch"); + + assert.equal(minimatch(".config/model.json", "**/*.json", { dot: true }), true); + assert.equal(minimatch("openai/GPT-5.5", "openai/gpt-*", { nocase: true }), true); + assert.equal(minimatch("anthropic/claude", "openai/*"), false); + assert.deepEqual(minimatch.match(["a.ts", "b.js", "c.md"], "*.{ts,js}"), ["a.ts", "b.js"]); + + const matcher = new Minimatch("docs/**/*.md", { + nocomment: true, nonegate: true, windowsPathsNoEscape: true, + }); + assert.equal(matcher.match("docs/nested/guide.md"), true); + assert.equal(matcher.match("src/guide.md"), false); + assert.equal(minimatch("config[1].env", escape("config[1].env")), true); + assert.equal(minimatch("config1.env", escape("config[1].env")), false); + + const [parts] = new Minimatch("/etc/openclaw/*.env", { + nobrace: true, noext: true, noglobstar: true, + platform: "linux", optimizationLevel: 0, + }).set; + assert.deepEqual(parts.slice(0, 3), ["", "etc", "openclaw"]); + assert.equal(parts[3].test("agent.env"), true); + assert.equal(parts[3].test("agent.txt"), false); + console.log("compatible"); + `, + resolve(import.meta.dir, "../node_modules/openclaw/package.json"), + ], { encoding: "utf8", timeout: 30_000 }); + + expect(output.trim()).toBe("compatible"); +}); diff --git a/.github-openclaw-intelligence/lifecycle/preflight.test.ts b/.github-openclaw-intelligence/lifecycle/preflight.test.ts new file mode 100644 index 0000000..7fe6930 --- /dev/null +++ b/.github-openclaw-intelligence/lifecycle/preflight.test.ts @@ -0,0 +1,108 @@ +import { afterEach, beforeEach, describe, expect, test } from "bun:test"; +import { copyFileSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "fs"; +import { tmpdir } from "os"; +import { join, resolve } from "path"; +import settings from "../.pi/settings.json"; +import installSettings from "../install/settings.json"; + +describe("preflight", () => { + let directory: string; + + beforeEach(() => { + directory = mkdtempSync(join(tmpdir(), "openclaw-preflight-")); + for (const name of ["lifecycle", ".pi", "config"]) { + mkdirSync(join(directory, name)); + } + copyFileSync(import.meta.path.replace(".test.ts", ".ts"), join(directory, "lifecycle/preflight.ts")); + copyFileSync( + resolve(import.meta.dir, "../config/settings.schema.json"), + join(directory, "config/settings.schema.json"), + ); + for (const name of ["ENABLED.md", "bun.lock", "lifecycle/agent.ts", "lifecycle/enabled.ts", "lifecycle/local-chat.ts"]) { + writeFileSync(join(directory, name), ""); + } + writeFileSync(join(directory, "package.json"), JSON.stringify({ + scripts: { chat: "bun run lifecycle/local-chat.ts" }, + })); + }); + + afterEach(() => { + rmSync(directory, { recursive: true, force: true }); + }); + + function runPreflight(value: unknown) { + writeFileSync(join(directory, ".pi/settings.json"), JSON.stringify(value)); + return Bun.spawnSync([process.execPath, join(directory, "lifecycle/preflight.ts")]); + } + + for (const [name, value] of [ + ["repository settings", settings], + ["installer settings", installSettings], + ["optional sections omitted", { + defaultProvider: "openai", defaultModel: "test", defaultThinkingLevel: "none", + }], + ["empty optional sections", { ...settings, trustPolicy: {}, limits: {}, compaction: {} }], + ["unknown top-level settings", { ...settings, customSetting: true }], + ["minimum boundaries", { + ...settings, limits: { workflowTimeoutMinutes: 1 }, + compaction: { enabled: false, reserveTokens: 1024, keepRecentTokens: 1024 }, + }], + ["maximum timeout", { ...settings, limits: { workflowTimeoutMinutes: 360 } }], + ] as const) { + test(`accepts ${name}`, () => { + const result = runPreflight(value); + expect(result.exitCode).toBe(0); + expect(result.stdout.toString()).toContain("Preflight passed"); + }); + } + + for (const [name, value, field] of [ + ["null root", null, "settings.json"], + ["array root", [], "settings.json"], + ["missing required field", {}, "defaultProvider"], + ["invalid provider", { ...settings, defaultProvider: "invalid" }, "defaultProvider"], + ["empty model", { ...settings, defaultModel: "" }, "defaultModel"], + ["non-string model", { ...settings, defaultModel: 42 }, "defaultModel"], + ["invalid thinking level", { ...settings, defaultThinkingLevel: "invalid" }, "defaultThinkingLevel"], + ["null trust policy", { ...settings, trustPolicy: null }, "trustPolicy"], + ["array trust policy", { ...settings, trustPolicy: [] }, "trustPolicy"], + ["unknown trust field", { ...settings, trustPolicy: { trustedUser: ["octocat"] } }, "trustedUser"], + ["null trusted users", { ...settings, trustPolicy: { trustedUsers: null } }, "trustedUsers"], + ["non-string trusted user", { ...settings, trustPolicy: { trustedUsers: [1] } }, "trustedUsers"], + ["invalid role", { ...settings, trustPolicy: { semiTrustedRoles: ["read"] } }, "semiTrustedRoles"], + ["invalid behavior", { ...settings, trustPolicy: { untrustedBehavior: "allow" } }, "untrustedBehavior"], + ["null limits", { ...settings, limits: null }, "limits"], + ["unknown limit", { ...settings, limits: { timeoutMinutes: 30 } }, "timeoutMinutes"], + ["null timeout", { ...settings, limits: { workflowTimeoutMinutes: null } }, "workflowTimeoutMinutes"], + ["fractional timeout", { ...settings, limits: { workflowTimeoutMinutes: 1.5 } }, "workflowTimeoutMinutes"], + ["timeout below minimum", { ...settings, limits: { workflowTimeoutMinutes: 0 } }, "workflowTimeoutMinutes"], + ["timeout above maximum", { ...settings, limits: { workflowTimeoutMinutes: 361 } }, "workflowTimeoutMinutes"], + ["null compaction", { ...settings, compaction: null }, "compaction"], + ["unknown compaction field", { ...settings, compaction: { enable: true } }, "enable"], + ["null enabled flag", { ...settings, compaction: { enabled: null } }, "enabled"], + ["non-boolean enabled flag", { ...settings, compaction: { enabled: "false" } }, "enabled"], + ["reserve below minimum", { ...settings, compaction: { reserveTokens: 1023 } }, "reserveTokens"], + ["recent tokens below minimum", { ...settings, compaction: { keepRecentTokens: 1023 } }, "keepRecentTokens"], + ] as const) { + test(`rejects ${name}`, () => { + const result = runPreflight(value); + expect(result.exitCode).toBe(1); + expect(result.stderr.toString()).toContain(field); + expect(result.stdout.toString()).not.toContain("Preflight passed"); + }); + } + + test("rejects a missing schema", () => { + rmSync(join(directory, "config/settings.schema.json")); + const result = runPreflight(settings); + expect(result.exitCode).toBe(1); + expect(result.stderr.toString()).toContain("Missing schema file"); + }); + + test("rejects malformed settings JSON", () => { + writeFileSync(join(directory, ".pi/settings.json"), "{"); + const result = Bun.spawnSync([process.execPath, join(directory, "lifecycle/preflight.ts")]); + expect(result.exitCode).toBe(1); + expect(result.stderr.toString()).toContain("failed to parse"); + }); +}); diff --git a/.github-openclaw-intelligence/lifecycle/preflight.ts b/.github-openclaw-intelligence/lifecycle/preflight.ts index 98b3483..6467491 100644 --- a/.github-openclaw-intelligence/lifecycle/preflight.ts +++ b/.github-openclaw-intelligence/lifecycle/preflight.ts @@ -87,127 +87,71 @@ if (existsSync(packageJsonPath)) { } // ── 2. Validate settings.json against the schema ──────────────────────────── -if (existsSync(piSettingsPath) && existsSync(schemaPath)) { - try { - const settings = JSON.parse(readFileSync(piSettingsPath, "utf-8")); - const schema = JSON.parse(readFileSync(schemaPath, "utf-8")); - - // Validate required fields - if (schema.required) { - for (const field of schema.required) { - if (!(field in settings)) { - errors.push(`settings.json: missing required field "${field}"`); - } - } - } - - // Validate each property against schema constraints - const props = schema.properties ?? {}; - for (const [key, def] of Object.entries(props) as [string, any][]) { - if (!(key in settings)) continue; - const value = settings[key]; - - // Type check - if (def.type === "string" && typeof value !== "string") { - errors.push(`settings.json: "${key}" must be a string, got ${typeof value}`); - continue; - } - - // Enum check - if (def.type === "string" && def.enum && !def.enum.includes(value)) { - errors.push( - `settings.json: "${key}" must be one of [${def.enum.join(", ")}], got "${value}"` - ); - } +interface SettingsSchema { + type: string; + required?: string[]; + properties?: Record; + additionalProperties?: boolean; + items?: SettingsSchema; + enum?: unknown[]; + minLength?: number; + minimum?: number; + maximum?: number; +} - // minLength check - if (typeof def.minLength === "number" && typeof value === "string" && value.length < def.minLength) { - errors.push(`settings.json: "${key}" must be at least ${def.minLength} character(s) long`); - } +// Supports the validation keywords used by config/settings.schema.json. +function validateSetting(value: unknown, schema: SettingsSchema, path: string): void { + const isObject = (input: unknown): input is Record => + input !== null && typeof input === "object" && !Array.isArray(input); + const matchesType = schema.type === "object" ? isObject(value) + : schema.type === "array" ? Array.isArray(value) + : schema.type === "integer" ? typeof value === "number" && Number.isInteger(value) + : typeof value === schema.type; + + if (!matchesType) { + errors.push(`${path}: must be ${schema.type}`); + return; + } + if (schema.enum && !schema.enum.includes(value)) { + errors.push(`${path}: must be one of [${schema.enum.join(", ")}], got ${JSON.stringify(value)}`); + } + if (typeof value === "string" && schema.minLength !== undefined && [...value].length < schema.minLength) { + errors.push(`${path}: must be at least ${schema.minLength} character(s) long`); + } + if (typeof value === "number") { + if (schema.minimum !== undefined && value < schema.minimum) { + errors.push(`${path}: must be at least ${schema.minimum}`); } - - // ── Validate trustPolicy ───────────────────────────────────────────────── - if (settings.trustPolicy != null) { - const tp = settings.trustPolicy; - if (tp === null || typeof tp !== "object" || Array.isArray(tp)) { - errors.push('settings.json: "trustPolicy" must be an object'); - } else { - if (tp.trustedUsers != null) { - if (!Array.isArray(tp.trustedUsers)) { - errors.push('settings.json: "trustPolicy.trustedUsers" must be an array of strings'); - } else if (tp.trustedUsers.some((u: unknown) => typeof u !== "string")) { - errors.push('settings.json: "trustPolicy.trustedUsers" entries must be strings'); - } - } - if (tp.semiTrustedRoles != null) { - const validRoles = ["admin", "maintain", "write"]; - if (!Array.isArray(tp.semiTrustedRoles)) { - errors.push('settings.json: "trustPolicy.semiTrustedRoles" must be an array'); - } else { - for (const role of tp.semiTrustedRoles) { - if (!validRoles.includes(role)) { - errors.push( - `settings.json: "trustPolicy.semiTrustedRoles" contains invalid value "${role}" (must be one of [${validRoles.join(", ")}])` - ); - } - } - } - } - if (tp.untrustedBehavior != null) { - const validBehaviors = ["read-only-response", "block"]; - if (!validBehaviors.includes(tp.untrustedBehavior)) { - errors.push( - `settings.json: "trustPolicy.untrustedBehavior" must be one of [${validBehaviors.join(", ")}], got "${tp.untrustedBehavior}"` - ); - } - } - } + if (schema.maximum !== undefined && value > schema.maximum) { + errors.push(`${path}: must be at most ${schema.maximum}`); } - - // ── Validate limits ────────────────────────────────────────────────────── - if (settings.limits != null) { - const lim = settings.limits; - if (lim === null || typeof lim !== "object" || Array.isArray(lim)) { - errors.push('settings.json: "limits" must be an object'); - } else { - if (lim.workflowTimeoutMinutes != null) { - if (typeof lim.workflowTimeoutMinutes !== "number" || !Number.isInteger(lim.workflowTimeoutMinutes)) { - errors.push('settings.json: "limits.workflowTimeoutMinutes" must be an integer'); - } else if (lim.workflowTimeoutMinutes < 1) { - errors.push('settings.json: "limits.workflowTimeoutMinutes" must be at least 1'); - } else if (lim.workflowTimeoutMinutes > 360) { - errors.push('settings.json: "limits.workflowTimeoutMinutes" must be at most 360'); - } - } + } + if (Array.isArray(value) && schema.items) { + const itemSchema = schema.items; + value.forEach((item, index) => validateSetting(item, itemSchema, `${path}[${index}]`)); + } + if (isObject(value)) { + const properties = schema.properties ?? {}; + for (const key of schema.required ?? []) { + if (!Object.hasOwn(value, key)) { + errors.push(`${path}: missing required field "${key}"`); } } - - // ── Validate compaction ────────────────────────────────────────────────── - if (settings.compaction != null) { - const comp = settings.compaction; - if (comp === null || typeof comp !== "object" || Array.isArray(comp)) { - errors.push('settings.json: "compaction" must be an object'); - } else { - if (comp.enabled != null && typeof comp.enabled !== "boolean") { - errors.push('settings.json: "compaction.enabled" must be a boolean'); - } - if (comp.reserveTokens != null) { - if (typeof comp.reserveTokens !== "number" || !Number.isInteger(comp.reserveTokens)) { - errors.push('settings.json: "compaction.reserveTokens" must be an integer'); - } else if (comp.reserveTokens < 1024) { - errors.push('settings.json: "compaction.reserveTokens" must be at least 1024'); - } - } - if (comp.keepRecentTokens != null) { - if (typeof comp.keepRecentTokens !== "number" || !Number.isInteger(comp.keepRecentTokens)) { - errors.push('settings.json: "compaction.keepRecentTokens" must be an integer'); - } else if (comp.keepRecentTokens < 1024) { - errors.push('settings.json: "compaction.keepRecentTokens" must be at least 1024'); - } - } + for (const [key, entry] of Object.entries(value)) { + if (Object.hasOwn(properties, key)) { + validateSetting(entry, properties[key], `${path}.${key}`); + } else if (schema.additionalProperties === false) { + errors.push(`${path}: unknown field "${key}"`); } } + } +} +if (existsSync(piSettingsPath) && existsSync(schemaPath)) { + try { + const settings: unknown = JSON.parse(readFileSync(piSettingsPath, "utf-8")); + const schema: SettingsSchema = JSON.parse(readFileSync(schemaPath, "utf-8")); + validateSetting(settings, schema, "settings.json"); } catch (e) { errors.push(`settings.json: failed to parse — ${(e as Error).message}`); } diff --git a/.github-openclaw-intelligence/package.json b/.github-openclaw-intelligence/package.json index ff80b67..d137604 100644 --- a/.github-openclaw-intelligence/package.json +++ b/.github-openclaw-intelligence/package.json @@ -17,6 +17,10 @@ }, "packageManager": "bun@1.4.2", "overrides": { - "ws": "8.21.3" + "@modelcontextprotocol/sdk": "1.32.0", + "minimatch": "11.0.1", + "undici": "8.12.2", + "ws": "8.21.3", + "zod": "4.6.6" } }