shennian 0.3.77 → 0.3.79

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.
@@ -31,8 +31,8 @@
31
31
  },
32
32
  {
33
33
  "file": "src/agents/codex-managed-permissions.js",
34
- "beforeBytes": 12579,
35
- "afterBytes": 4943
34
+ "beforeBytes": 12532,
35
+ "afterBytes": 4902
36
36
  },
37
37
  {
38
38
  "file": "src/agents/codex-managed-room-tools.js",
@@ -1 +1 @@
1
- import a from"node:fs";import h from"node:os";import s from"node:path";import{resolveProtectedShennianDirectories as y}from"../security/managed-agent-credential-paths.js";const i="shennian-managed",E={".env":"deny",".env.*":"deny","**/.env":"deny","**/.env.*":"deny","*.key":"deny","**/*.key":"deny","*.pem":"deny","**/*.pem":"deny",".ssh":"deny","**/.ssh":"deny",".aws":"deny","**/.aws":"deny",".azure":"deny","**/.azure":"deny",".config/gcloud":"deny","**/.config/gcloud":"deny"},l=e=>({commandNetwork:{allow:e,deny:!0},webSearch:{allow:e,deny:!0},browser:{allow:e,deny:!0},computerUse:{allow:e,deny:!0},mcp:{allow:e,deny:!0}}),I={minimumRuntimeVersion:"0.138.0",maximumRuntimeVersionExclusive:"0.153.0",platforms:{darwin:{level:"hard",fileAccess:{"workspace-read":!0,"workspace-write":!0,"host-full":!0},externalCapabilities:l(!0)},linux:{level:"hard",fileAccess:{"workspace-read":!0,"workspace-write":!0,"host-full":!0},externalCapabilities:l(!0)},win32:{level:"partial",fileAccess:{"workspace-read":!1,"workspace-write":!1,"host-full":!1},externalCapabilities:l(!0),knownGaps:["sandbox.nativeWindowsReadIsolationUnavailable"]}}};function M(e,n,r={}){const t=O(n),o=e.effectivePolicy,m=g(x(e.platform)),f=o.fileAccess==="workspace-write"?"write":"read",c=o.fileAccess==="workspace-read"?":read-only":o.fileAccess==="workspace-write"?":workspace":null,_={":root":o.fileAccess==="host-full"?"write":"deny",...o.fileAccess==="host-full"?{}:{":minimal":"read",":tmpdir":"deny",":slash_tmp":"deny",...Object.fromEntries(m.map(w=>[w,"read"]))},...b(),glob_scan_max_depth:8,":workspace_roots":{".":o.fileAccess==="host-full"?"write":f,...E}},d=o.externalCapabilities.commandNetwork,p={enabled:!0,domains:d?{"*":"allow"}:{},unix_sockets:{},allow_local_binding:d,dangerously_allow_all_unix_sockets:!1};return{profileId:i,threadConfig:{default_permissions:i,permissions:{[i]:{description:"Shennian managed Agent permissions",...c?{extends:c}:{},workspace_roots:{[t]:!0},filesystem:_,network:p}},web_search:o.externalCapabilities.webSearch?"live":"disabled",features:v(o.externalCapabilities),allow_login_shell:!1,shell_environment_policy:A(r.shellSubprocessPolicy),...P(o.externalCapabilities.mcp,r.configuredMcpServerNames),...e.platform==="win32"?{windows:{sandbox:"elevated"}}:{}}}}function x(e){return e==="darwin"&&a.existsSync("/System/Library/OpenSSL")?["/System/Library/OpenSSL"]:[]}function b(){const e=s.normalize(h.homedir()),n=[...y(),...e&&s.isAbsolute(e)?[".shennian",".ssh",".aws",".azure",s.join(".config","gcloud"),".netrc",".npmrc"].map(r=>s.join(e,r)):[]].filter(r=>r&&s.isAbsolute(r));return Object.fromEntries([...new Set(n)].map(r=>[r,"deny"]))}function A(e){const n=[...new Set(e?.allowedEnvKeys??["PATH","HOME","USERPROFILE","LANG","LC_ALL","LC_CTYPE","TMPDIR","TMP","TEMP"])].filter(u).filter(t=>!S.has(t)).sort(),r=[...new Set(e?.deniedEnvKeys??["OPENAI_BASE_URL","OPENAI_API_KEY"])].filter(u).sort();return{inherit:"all",experimental_use_profile:!1,ignore_default_excludes:!0,filters:{...Object.fromEntries(n.map(t=>[t,"include"])),...Object.fromEntries(r.map(t=>[t,"exclude"]))}}}const S=new Set(["SHENNIAN_MANAGED_ROOM_CONTEXT","SHENNIAN_MANAGED_ROOM_IPC_ROOT"]);function u(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}function D(e){if(!e||typeof e!="object")throw new Error("codex_managed_config_read_invalid");const n=e.config;if(!n||typeof n!="object"||Array.isArray(n))throw new Error("codex_managed_config_read_invalid");const r=n.mcp_servers;if(r===void 0)return[];if(!r||typeof r!="object"||Array.isArray(r))throw new Error("codex_managed_config_read_invalid");return Object.keys(r).sort()}function j(e,n=i){if((e&&typeof e=="object"?e.activePermissionProfile:void 0)?.id!==n)throw new Error("codex_managed_permission_profile_unavailable")}function v(e){return{network_proxy:!0,apps:e.mcp,plugins:e.mcp,hooks:e.mcp,request_permissions_tool:!1,browser_use:e.browser,browser_use_external:e.browser,browser_use_full_cdp_access:!1,computer_use:e.computerUse}}function P(e,n){if(e)return{};const r=[...new Set(n??[])].filter(Boolean).sort();return r.length?{mcp_servers:Object.fromEntries(r.map(t=>[t,{enabled:!1}]))}:{}}function O(e){const n=s.normalize(e.trim());if(!n||!s.isAbsolute(n))throw new Error("codex_managed_workdir_invalid");let r;try{r=a.realpathSync(n)}catch{throw new Error("codex_managed_workdir_unavailable")}if(s.normalize(r)!==n)throw new Error("codex_managed_workdir_not_realpath");return n}function g(e){const n=[...new Set(e??[])].map(r=>s.normalize(r.trim())).filter(r=>r&&s.isAbsolute(r)).flatMap(r=>{try{const t=a.realpathSync(r);return t===r?[r]:[r,t]}catch{try{const t=a.realpathSync(s.dirname(r)),o=s.join(t,s.basename(r));return o===r?[r]:[r,o]}catch{return[r]}}});return[...new Set(n)].sort()}export{i as CODEX_MANAGED_PERMISSION_PROFILE_ID,I as CODEX_MANAGED_RUNTIME_SECURITY,j as assertCodexManagedPermissionProfile,M as compileCodexManagedPermissions,D as extractCodexMcpServerNames};
1
+ import a from"node:fs";import h from"node:os";import s from"node:path";import{resolveProtectedShennianDirectories as y}from"../security/managed-agent-credential-paths.js";const i="shennian-managed",E={".env":"deny",".env.*":"deny","**/.env":"deny","**/.env.*":"deny","*.key":"deny","**/*.key":"deny","*.pem":"deny","**/*.pem":"deny",".ssh":"deny","**/.ssh":"deny",".aws":"deny","**/.aws":"deny",".azure":"deny","**/.azure":"deny",".config/gcloud":"deny","**/.config/gcloud":"deny"},l=e=>({commandNetwork:{allow:e,deny:!0},webSearch:{allow:e,deny:!0},browser:{allow:e,deny:!0},computerUse:{allow:e,deny:!0},mcp:{allow:e,deny:!0}}),I={minimumRuntimeVersion:"0.138.0",platforms:{darwin:{level:"hard",fileAccess:{"workspace-read":!0,"workspace-write":!0,"host-full":!0},externalCapabilities:l(!0)},linux:{level:"hard",fileAccess:{"workspace-read":!0,"workspace-write":!0,"host-full":!0},externalCapabilities:l(!0)},win32:{level:"partial",fileAccess:{"workspace-read":!1,"workspace-write":!1,"host-full":!1},externalCapabilities:l(!0),knownGaps:["sandbox.nativeWindowsReadIsolationUnavailable"]}}};function M(e,n,r={}){const t=O(n),o=e.effectivePolicy,f=g(b(e.platform)),m=o.fileAccess==="workspace-write"?"write":"read",c=o.fileAccess==="workspace-read"?":read-only":o.fileAccess==="workspace-write"?":workspace":null,_={":root":o.fileAccess==="host-full"?"write":"deny",...o.fileAccess==="host-full"?{}:{":minimal":"read",":tmpdir":"deny",":slash_tmp":"deny",...Object.fromEntries(f.map(w=>[w,"read"]))},...A(),glob_scan_max_depth:8,":workspace_roots":{".":o.fileAccess==="host-full"?"write":m,...E}},d=o.externalCapabilities.commandNetwork,p={enabled:!0,domains:d?{"*":"allow"}:{},unix_sockets:{},allow_local_binding:d,dangerously_allow_all_unix_sockets:!1};return{profileId:i,threadConfig:{default_permissions:i,permissions:{[i]:{description:"Shennian managed Agent permissions",...c?{extends:c}:{},workspace_roots:{[t]:!0},filesystem:_,network:p}},web_search:o.externalCapabilities.webSearch?"live":"disabled",features:v(o.externalCapabilities),allow_login_shell:!1,shell_environment_policy:x(r.shellSubprocessPolicy),...P(o.externalCapabilities.mcp,r.configuredMcpServerNames),...e.platform==="win32"?{windows:{sandbox:"elevated"}}:{}}}}function b(e){return e==="darwin"&&a.existsSync("/System/Library/OpenSSL")?["/System/Library/OpenSSL"]:[]}function A(){const e=s.normalize(h.homedir()),n=[...y(),...e&&s.isAbsolute(e)?[".shennian",".ssh",".aws",".azure",s.join(".config","gcloud"),".netrc",".npmrc"].map(r=>s.join(e,r)):[]].filter(r=>r&&s.isAbsolute(r));return Object.fromEntries([...new Set(n)].map(r=>[r,"deny"]))}function x(e){const n=[...new Set(e?.allowedEnvKeys??["PATH","HOME","USERPROFILE","LANG","LC_ALL","LC_CTYPE","TMPDIR","TMP","TEMP"])].filter(u).filter(t=>!S.has(t)).sort(),r=[...new Set(e?.deniedEnvKeys??["OPENAI_BASE_URL","OPENAI_API_KEY"])].filter(u).sort();return{inherit:"all",experimental_use_profile:!1,ignore_default_excludes:!0,filters:{...Object.fromEntries(n.map(t=>[t,"include"])),...Object.fromEntries(r.map(t=>[t,"exclude"]))}}}const S=new Set(["SHENNIAN_MANAGED_ROOM_CONTEXT","SHENNIAN_MANAGED_ROOM_IPC_ROOT"]);function u(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}function D(e){if(!e||typeof e!="object")throw new Error("codex_managed_config_read_invalid");const n=e.config;if(!n||typeof n!="object"||Array.isArray(n))throw new Error("codex_managed_config_read_invalid");const r=n.mcp_servers;if(r===void 0)return[];if(!r||typeof r!="object"||Array.isArray(r))throw new Error("codex_managed_config_read_invalid");return Object.keys(r).sort()}function j(e,n=i){if((e&&typeof e=="object"?e.activePermissionProfile:void 0)?.id!==n)throw new Error("codex_managed_permission_profile_unavailable")}function v(e){return{network_proxy:!0,apps:e.mcp,plugins:e.mcp,hooks:e.mcp,request_permissions_tool:!1,browser_use:e.browser,browser_use_external:e.browser,browser_use_full_cdp_access:!1,computer_use:e.computerUse}}function P(e,n){if(e)return{};const r=[...new Set(n??[])].filter(Boolean).sort();return r.length?{mcp_servers:Object.fromEntries(r.map(t=>[t,{enabled:!1}]))}:{}}function O(e){const n=s.normalize(e.trim());if(!n||!s.isAbsolute(n))throw new Error("codex_managed_workdir_invalid");let r;try{r=a.realpathSync(n)}catch{throw new Error("codex_managed_workdir_unavailable")}if(s.normalize(r)!==n)throw new Error("codex_managed_workdir_not_realpath");return n}function g(e){const n=[...new Set(e??[])].map(r=>s.normalize(r.trim())).filter(r=>r&&s.isAbsolute(r)).flatMap(r=>{try{const t=a.realpathSync(r);return t===r?[r]:[r,t]}catch{try{const t=a.realpathSync(s.dirname(r)),o=s.join(t,s.basename(r));return o===r?[r]:[r,o]}catch{return[r]}}});return[...new Set(n)].sort()}export{i as CODEX_MANAGED_PERMISSION_PROFILE_ID,I as CODEX_MANAGED_RUNTIME_SECURITY,j as assertCodexManagedPermissionProfile,M as compileCodexManagedPermissions,D as extractCodexMcpServerNames};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shennian",
3
- "version": "0.3.77",
3
+ "version": "0.3.79",
4
4
  "description": "Shennian — AI Agent Control Plane CLI",
5
5
  "type": "module",
6
6
  "bin": {